[FFmpeg-devel] [PATCH] lavc/cfhd:fixed alpha channel decoding in gbrap12

Paul B Mahol onemda at gmail.com
Tue Mar 20 14:19:31 EET 2018


On 3/20/18, Gagandeep Singh <deepgagan231197 at gmail.com> wrote:
> On Tue, 20 Mar 2018, 16:31 Kieran Kunhya, <kierank at obe.tv> wrote:
>
>> >
>> > ticket #6265, oops forgot this
>> >
>>
>> Can you confirm this makes the png in the ticket look as expected?
>> I was expecting the companding curve to also change for alpha.
>>
>> Kieran
>>
>
> preserving the limits (max and min)
> ---
>  libavcodec/cfhd.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> index d64acab8d4..a950dc0f28 100644
> --- a/libavcodec/cfhd.c
> +++ b/libavcodec/cfhd.c
> @@ -103,6 +103,8 @@ static inline void process_alpha(int16_t *alpha, int
> width)
>          channel <<= 8;
>          channel  -= 128;
>          channel  /= 223;
> +        channel   = FFMIN(channel, (1 << 12) - 1);
> +        channel   = FFMAX(channel, 0);
>          alpha[i]  = channel;
>      }
>  }
> --
> 2.14.1

Please post full patch, not patch against previous patch.

Use av_clip instead of FFMIN/FFMAX as already previously mentioned.


More information about the ffmpeg-devel mailing list