diff mbox series

[FFmpeg-devel,1/2] avcodec/cfhd: Replace a few literal numbers by named constants

Message ID 20200829204428.11064-1-michael@niedermayer.cc
State Accepted
Commit 2359656da2e5a8a191e49fdc667d04c16ff0ea7b
Headers show
Series [FFmpeg-devel,1/2] avcodec/cfhd: Replace a few literal numbers by named constants | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer Aug. 29, 2020, 8:44 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/cfhd.c | 8 ++++----
 libavcodec/cfhd.h | 4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Paul B Mahol Aug. 29, 2020, 8:53 p.m. UTC | #1
LGTM

On 8/29/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/cfhd.c | 8 ++++----
>  libavcodec/cfhd.h | 4 ++++
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> index 036df00f72..ea35f03869 100644
> --- a/libavcodec/cfhd.c
> +++ b/libavcodec/cfhd.c
> @@ -593,20 +593,20 @@ static int cfhd_decode(AVCodecContext *avctx, void
> *data, int *got_frame,
>                  break;
>              }
>              s->planes = data == 2 ? 4 :
> av_pix_fmt_count_planes(s->coded_format);
> -        } else if (tag == -85) {
> +        } else if (tag == -DisplayHeight) {
>              av_log(avctx, AV_LOG_DEBUG, "Cropped height %"PRIu16"\n",
> data);
>              s->cropped_height = data;
> -        } else if (tag == -75) {
> +        } else if (tag == -PeakOffsetLow) {
>              s->peak.offset &= ~0xffff;
>              s->peak.offset |= (data & 0xffff);
>              s->peak.base    = gb;
>              s->peak.level   = 0;
> -        } else if (tag == -76) {
> +        } else if (tag == -PeakOffsetHigh) {
>              s->peak.offset &= 0xffff;
>              s->peak.offset |= (data & 0xffffU)<<16;
>              s->peak.base    = gb;
>              s->peak.level   = 0;
> -        } else if (tag == -74 && s->peak.offset) {
> +        } else if (tag == -PeakLevel && s->peak.offset) {
>              s->peak.level = data;
>              bytestream2_seek(&s->peak.base, s->peak.offset - 4, SEEK_CUR);
>          } else
> diff --git a/libavcodec/cfhd.h b/libavcodec/cfhd.h
> index fdc6f1e546..8ea91270cd 100644
> --- a/libavcodec/cfhd.h
> +++ b/libavcodec/cfhd.h
> @@ -83,10 +83,14 @@ enum CFHDParam {
>      Precision        =  70,
>      InputFormat      =  71,
>      BandCodingFlags  =  72,
> +    PeakLevel        =  74,
> +    PeakOffsetLow    =  75,
> +    PeakOffsetHigh   =  76,
>      Version          =  79,
>      BandSecondPass   =  82,
>      PrescaleTable    =  83,
>      EncodedFormat    =  84,
> +    DisplayHeight    =  85,
>      ChannelWidth     = 104,
>      ChannelHeight    = 105,
>  };
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Aug. 30, 2020, 2:13 p.m. UTC | #2
On Sat, Aug 29, 2020 at 10:53:21PM +0200, Paul B Mahol wrote:
> LGTM

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 036df00f72..ea35f03869 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -593,20 +593,20 @@  static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
                 break;
             }
             s->planes = data == 2 ? 4 : av_pix_fmt_count_planes(s->coded_format);
-        } else if (tag == -85) {
+        } else if (tag == -DisplayHeight) {
             av_log(avctx, AV_LOG_DEBUG, "Cropped height %"PRIu16"\n", data);
             s->cropped_height = data;
-        } else if (tag == -75) {
+        } else if (tag == -PeakOffsetLow) {
             s->peak.offset &= ~0xffff;
             s->peak.offset |= (data & 0xffff);
             s->peak.base    = gb;
             s->peak.level   = 0;
-        } else if (tag == -76) {
+        } else if (tag == -PeakOffsetHigh) {
             s->peak.offset &= 0xffff;
             s->peak.offset |= (data & 0xffffU)<<16;
             s->peak.base    = gb;
             s->peak.level   = 0;
-        } else if (tag == -74 && s->peak.offset) {
+        } else if (tag == -PeakLevel && s->peak.offset) {
             s->peak.level = data;
             bytestream2_seek(&s->peak.base, s->peak.offset - 4, SEEK_CUR);
         } else
diff --git a/libavcodec/cfhd.h b/libavcodec/cfhd.h
index fdc6f1e546..8ea91270cd 100644
--- a/libavcodec/cfhd.h
+++ b/libavcodec/cfhd.h
@@ -83,10 +83,14 @@  enum CFHDParam {
     Precision        =  70,
     InputFormat      =  71,
     BandCodingFlags  =  72,
+    PeakLevel        =  74,
+    PeakOffsetLow    =  75,
+    PeakOffsetHigh   =  76,
     Version          =  79,
     BandSecondPass   =  82,
     PrescaleTable    =  83,
     EncodedFormat    =  84,
+    DisplayHeight    =  85,
     ChannelWidth     = 104,
     ChannelHeight    = 105,
 };