[Libav-user] Encoding problem using AV_PIX_FMT_YUV422P10

Dirr Bernhard Bernhard.Dirr at newtec.de
Tue Feb 17 15:16:29 CET 2015


> Ok, then your nested loops should not have any problem. The problem might be with the pointers or the YUV values that you assign to pixels. For example, why do you cast an unsigned char pointer to an unsigned int?

The planes in struct AVFrame are defined as:
uint8_t *data[AV_NUM_DATA_POINTERS];
Hence the cast to uint16_t, as the Y U V values are unsigned 16 bit values, true?

Is the following calculation of pointers to the components at pixel line nr. aYPos ok?
aPtr = avFrame->data[0] + aYPos * avFrame->linesize[0];
y = (uint16_t *)aPtr;
aPtr = avFrame->data[1] + aYPos * avFrame->linesize[1];
u = (uint16_t *)aPtr;
aPtr = avFrame->data[2] + aYPos * avFrame->linesize[2];
v = (uint16_t *)aPtr;

In VideoCoder::open(), does following instruction allocate the correct buffers?
ret = av_frame_get_buffer(mFrame, 32);
Are this buffers reusable? I do not free/reallocate buffers between encoding
subsequent frames!

Regards
Bernhard Dirr


More information about the Libav-user mailing list