Justin,

On Mon, Dec 2, 2013 at 4:26 PM, Justin Ruggles <[email protected]>wrote:

> On 12/02/2013 09:39 AM, Pascal Massimino wrote:
>
>> Hi,
>>
>>
>> On Sun, Dec 1, 2013 at 11:04 PM, Justin Ruggles <[email protected]
>> >wrote:
>>
>> +            av_image_copy(alt_frame->data, alt_frame->linesize,
>> +                          frame->data, frame->linesize,
>>
>> FYI, i get a warning related to frame->data constness here:
>>
>> libavcodec/libwebpenc.c: In function ‘libwebp_encode_frame’:
>> libavcodec/libwebpenc.c:171:27: warning: passing argument 3 of
>> ‘av_image_copy’ from incompatible pointer type [enabled by default]
>> ./libavutil/imgutils.h:115:6: note: expected ‘const uint8_t **’ but
>> argument is of type ‘uint8_t * const*’
>>
>
> Yeah, this is safe though. av_image_copy() does not modify anything in the
> source.
>
>
>
>>
>> +                          avctx->pix_fmt, frame->width, frame->height);
>>
>>> +            frame = alt_frame;
>>> +        }
>>> +        pic->use_argb  = 0;
>>> +        pic->y         = frame->data[0];
>>> +        pic->u         = frame->data[1];
>>> +        pic->v         = frame->data[2];
>>> +        pic->y_stride  = frame->linesize[0];
>>> +        pic->uv_stride = frame->linesize[1];
>>> +        if (avctx->pix_fmt == AV_PIX_FMT_YUVA420P) {
>>> +            pic->colorspace = WEBP_YUV420A;
>>> +            pic->a          = frame->data[3];
>>> +            pic->a_stride   = frame->linesize[3];
>>> +        } else {
>>> +            pic->colorspace = WEBP_YUV420;
>>> +        }
>>> +
>>> +        if (s->lossless) {
>>>
>>>  normally, whole this block should be unnecessary. But, trying the
>> patch, i
>> realized
>> there's a bug in libwebp (uhttps://
>> code.google.com/p/webp/issues/detail?id=178)
>> that prevents automatic conversion as it should. Sorry about that, the
>> workaround
>> you have must have been puzzling to find.
>> I've got a fix (https://gerrit.chromium.org/gerrit/#/c/67969) but it's
>> going to be available
>> only in future versions. A temporary ugly fix can be:
>>
>> #if (WEBP_ENCODER_ABI_VERSION <= 0x201)
>>    if (s->lossless) {   /* workaround issue #178 */
>>        pic->memory_ = (void*)1;  /* something non-null */
>>        if (!WebPPictureYUVAToARGB(pic)) goto end;
>>        pic->memory_ = NULL;  /* restore pointer */
>>    }
>> #endif
>>
>>
>> but that's pretty hacky. Your call.
>>
>> (PS: Otherwise, patch works ok!)
>>
>>
> That does look hacky, but it's definitely simpler. What does that do
> exactly,


it just safely works around a spurious, unwarranted test in
WebPPictureYUVAToARGB()

and do I still need to call WebPPictureFree(pic)
>

yep, nothing changes here.


- skal
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to