diff mbox

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

Message ID CAOi=zRvEQcRo1F9evkm+AYqY3G6CTYsoxsSoAcNZtnin3tQm1w@mail.gmail.com
State New
Headers show

Commit Message

Gagandeep Singh March 20, 2018, 12:16 p.m. UTC
On Tue, 20 Mar 2018, 16:31 Kieran Kunhya, <kierank@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(+)

 }

Comments

Paul B Mahol March 20, 2018, 12:19 p.m. UTC | #1
On 3/20/18, Gagandeep Singh <deepgagan231197@gmail.com> wrote:
> On Tue, 20 Mar 2018, 16:31 Kieran Kunhya, <kierank@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.
diff mbox

Patch

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;
     }