[FFmpeg-devel] AVFrame linesize and OpenGL GL_UNPACK_ROW_LENGTH

Kirill Gavrilov gavr.mail at gmail.com
Tue May 7 06:22:14 CEST 2013


Hi Pavel,

If AVFrame data rows are not pixel aligned then data has to be copied
> row-by-row into an intermediate frame with compatible alignment.

It's wasteful and I would like to avoid this because it noticably hurts
> playback performance in my player.
>
You need not create extra frame. The most common way is to create texture
with uninitialized data (NULL pointer):
  glTexImage2D(GL_TEXTURE_2D, 0, myTextFormat, mySizeX, mySizeY, 0,
theDataFormat, GL_UNSIGNED_BYTE, NULL);
and then fill it using glTexSubImage2D function (either entirely with one
call or row-by-row).
Row-by-row copy doesn't impact any noticeable penalty in most cases (if
image data is not stretched vertically like 8x4096).
-----------------------------------------------
Kirill Gavrilov,
Software designer.
<kirill at sview.ru>


More information about the ffmpeg-devel mailing list