Display YUV in OpenGL

前端 未结 3 1275
天命终不由人
天命终不由人 2021-01-31 12:01

I am having trouble displaying a raw YUV file that it is in NV12 format.

I can display a selected frame, however, it is still mainly in black and white with certain shade

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-31 12:42

    The picture looks like you have 4:1:1 format. You should change your lines to

    float U = lookupTableU [uvBuffer [ (y * (YUV_WIDTH / 4) + (x/4)) * 2 ] ]
    float V = lookupTableU [uvBuffer [ (y * (YUV_WIDTH / 4) + (x/4)) * 2 + 1] ]
    

    Maybe you can post the result to see, what else is wrong. I find it always hard to think about it. It's much easier to approach this iteratively.

提交回复
热议问题