[FFmpeg-devel] [PATCH] Alpha channel decoding for HuffYUV v2

Alexander Strange astrange
Thu Jan 14 02:34:23 CET 2010


On Jan 13, 2010, at 5:32 PM, Michael Niedermayer wrote:

> On Wed, Jan 13, 2010 at 02:47:43PM -0500, Alexander Strange wrote:
>> This implements alpha decoding for 32-bit files and fills it with 255 for 24-bit files.
>> 
>> Tested on:
>> http://samples.mplayerhq.hu/V-codecs/HuffYUV/camera2_hfyu32.avi (32-bit)
>> http://samples.mplayerhq.hu/V-codecs/HuffYUV/angels_480-huffyuvcompress.avi (24-bit)
>> on x86-64 vs. the official decoder output.
>> 
>> About this part:
>>> @@ -406,7 +408,7 @@ static av_cold void alloc_temp(HYuvContext *s){
>>>             s->temp[i]= av_malloc(s->width + 16);
>>>         }
>>>     }else{
>>> -        s->temp[0]= av_malloc(4*s->width + 16);
>>> +        s->temp[0]= av_mallocz(4*s->width + 16);
>>>     }
>>> }
>> 
>> I think it's necessary for 24-bit files, because decode_bgr_1() won't write anything to the alpha channel if it finds a code not in the joint table in the first row of the first frame. But that's pretty rare, so I haven't found any samples that decode wrong without the change.
>> 
> 
>> dsputil.c |   11 +++++++++--
>> dsputil.h |    2 +-
>> huffyuv.c |   16 ++++++++++------
>> 3 files changed, 20 insertions(+), 9 deletions(-)
>> e55267b32220e7b1c384f3dcfc6ee2c9ff2c162d  0001-Implement-alpha-channel-decoding-for-BGR-HuffYUV.patch
>> From 495aa71c742a31f1aaa203b9cbc723b888debfc1 Mon Sep 17 00:00:00 2001
>> From: Alexander Strange <astrange at ithinksw.com>
>> Date: Wed, 13 Jan 2010 01:13:15 -0500
>> Subject: [PATCH] Implement alpha channel decoding for BGR HuffYUV.
>> 
>> Since BGR24 is decoded as BGR32, fill its alpha channel with 255
>> using the appropriate predictors.
>> ---
>> libavcodec/dsputil.c |   11 +++++++++--
>> libavcodec/dsputil.h |    2 +-
>> libavcodec/huffyuv.c |   16 ++++++++++------
>> 3 files changed, 20 insertions(+), 9 deletions(-)
> 
> ok
> 
> [...]

Applied.




More information about the ffmpeg-devel mailing list