On Tue, Jul 21, 2015 at 7:43 AM, Luca Barbato <[email protected]> wrote:
> On 21/07/15 00:47, Vittorio Giovara wrote:
>> From: Michael Niedermayer <[email protected]>
>>
>> Found-By: ami_stuff
>> Signed-off-by: Vittorio Giovara <[email protected]>
>> ---
>>  libavcodec/dds.c | 12 +++++++-----
>>  1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavcodec/dds.c b/libavcodec/dds.c
>> index 19f7dd0..1266ef2 100644
>> --- a/libavcodec/dds.c
>> +++ b/libavcodec/dds.c
>> @@ -357,13 +357,13 @@ static int parse_pixel_format(AVCodecContext *avctx)
>>              avctx->pix_fmt = AV_PIX_FMT_BGR24;
>>          /* 32 bpp */
>>          else if (bpp == 32 && r == 0xff0000 && g == 0xff00 && b == 0xff && 
>> a == 0)
>> -            avctx->pix_fmt = AV_PIX_FMT_RGBA; // opaque
>> -        else if (bpp == 32 && r == 0xff && g == 0xff00 && b == 0xff0000 && 
>> a == 0)
>>              avctx->pix_fmt = AV_PIX_FMT_BGRA; // opaque
>> +        else if (bpp == 32 && r == 0xff && g == 0xff00 && b == 0xff0000 && 
>> a == 0)
>> +            avctx->pix_fmt = AV_PIX_FMT_RGBA; // opaque
>>          else if (bpp == 32 && r == 0xff0000 && g == 0xff00 && b == 0xff && 
>> a == 0xff000000)
>> -            avctx->pix_fmt = AV_PIX_FMT_RGBA;
>> -        else if (bpp == 32 && r == 0xff && g == 0xff00 && b == 0xff0000 && 
>> a == 0xff000000)
>>              avctx->pix_fmt = AV_PIX_FMT_BGRA;
>> +        else if (bpp == 32 && r == 0xff && g == 0xff00 && b == 0xff0000 && 
>> a == 0xff000000)
>> +            avctx->pix_fmt = AV_PIX_FMT_RGBA;
>
> RGBA -> BGRA basically?

yes

>>          /* give up */
>>          else {
>>              av_log(avctx, AV_LOG_ERROR, "Unknown pixel format "
>> @@ -646,7 +646,9 @@ static int dds_decode(AVCodecContext *avctx, void *data,
>>      }
>>
>>      /* Run any post processing here if needed. */
>> -    if (avctx->pix_fmt == AV_PIX_FMT_RGBA || avctx->pix_fmt == 
>> AV_PIX_FMT_YA8)
>> +    if (avctx->pix_fmt == AV_PIX_FMT_BGRA ||
>> +        avctx->pix_fmt == AV_PIX_FMT_RGBA ||
>> +        avctx->pix_fmt == AV_PIX_FMT_YA8)
>>          run_postproc(avctx, frame);
>
> Possibly ok, do you have other 32bit or 4 channel pixel formats that
> would require post processing?

Not to my knowledge, I could maybe change it to check for postproc ==
NONE if you think it's better.
-- 
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to