Display YUV in OpenGL

前端 未结 3 1252
天命终不由人
天命终不由人 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:55

    Next try :) I think you're uv buffer is not interleaved. It looks like the U values come first and then the array of V values. Changing the lines to

    unsigned int voffset = YUV_HEIGHT * YUV_WIDTH / 2;
    float U = lookupTableU [uvBuffer [ y * (YUV_WIDTH / 2) + x/2] ]; 
    float V = lookupTableV [uvBuffer [ voffset + y * (YUV_WIDTH / 2) + x/2] ];
    

    might indicate if this is really the case.

提交回复
热议问题