[libav-api] Converting from Webcam/V4l2 capture data format (YUYV or UYVY)

Eric Glaser eglaser2010 at gmail.com
Wed Jun 22 22:15:38 CEST 2011


On Mon, Jun 13, 2011 at 6:57 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> Hi,
>
> On Mon, Jun 13, 2011 at 9:49 PM, Eric Glaser <eglaser2010 at gmail.com> wrote:
>> On Sun, Jun 12, 2011 at 7:13 PM, Tristan Matthews
>> <le.businessman at gmail.com> wrote:
>>> 2011/6/12 Ronald S. Bultje <rsbultje at gmail.com>
>>>>
>>>> Hi,
>>>>
>>>> On Sun, Jun 12, 2011 at 1:56 PM, Eric Glaser <eglaser2010 at gmail.com> wrote:
>>>> > Hi, I am having some trouble converting from YUYV to RGB format - it
>>>> > crashes in sws_scale.
>>>>
>>>> Can you provide a backtrace?
>>>>
>>>> >            int numRGBBytes = ww * hh * 4;   //src width * src height * 4
>>>> >            buffer = malloc (sizeof(uint8_t)*numRGBBytes);
>>>>
>>>> Use av_malloc(), malloc() return values are not aligned and crash
>>>> randomly when using SIMD functions.
>>>
>>> libavcodec/api-example.c uses malloc in a similar context, instead of
>>> av_malloc. Should this be updated?
>>>
>>> -T
>>>
>>>>
>>>> >        int ret = sws_scale(pOGLContext->img_convert_ctx,
>>>> > (uint8_t**)pFrame->data, pFrame->linesize, 0, hh, pFrameRGB->data,
>>>> > pFrameRGB->linesize);
>>>>
>>>> So here it crashes? That's likely in the runtime-generated MMX code
>>>> then. Again, can you provide a backtrace, and then the output (in gdb)
>>>> "disass $pc-32,$pc+32" and "info all-registers".
>>>>
>>>> Ronald
>>>> _______________________________________________
>>>

Hi Sorry about the late response, since I have to malloc from a  C++
file, av_malloc and av_free whose prototypes are not extern'ed with
"C" for g++  fails due to name mangling - so I cant use them directly.
I will have to modify the code to be able to allocate from within C
file. I found an alternate solution though which is dump all the raw
data to GPU - which also does the scaling. So I am using that path
instead. Thanks much - if I have some free time, I will try to repro
the issue again.


More information about the libav-api mailing list