diff mbox series

[FFmpeg-devel,1/2] avcodec/dstdec: Use local channels variable

Message ID 20200213222456.26522-1-michael@niedermayer.cc
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avcodec/dstdec: Use local channels variable | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Feb. 13, 2020, 10:24 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/dstdec.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Paul B Mahol Feb. 14, 2020, 9:20 a.m. UTC | #1
lgtm

On 2/13/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/dstdec.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
> index 880b838b0c..bdabced823 100644
> --- a/libavcodec/dstdec.c
> +++ b/libavcodec/dstdec.c
> @@ -262,7 +262,7 @@ static int decode_frame(AVCodecContext *avctx, void
> *data,
>          skip_bits1(gb);
>          if (get_bits(gb, 6))
>              return AVERROR_INVALIDDATA;
> -        memcpy(frame->data[0], avpkt->data + 1, FFMIN(avpkt->size - 1,
> frame->nb_samples * avctx->channels));
> +        memcpy(frame->data[0], avpkt->data + 1, FFMIN(avpkt->size - 1,
> frame->nb_samples * channels));
>          goto dsd;
>      }
>
> @@ -287,7 +287,7 @@ static int decode_frame(AVCodecContext *avctx, void
> *data,
>
>      same_map = get_bits1(gb);
>
> -    if ((ret = read_map(gb, &s->fsets, map_ch_to_felem, avctx->channels)) <
> 0)
> +    if ((ret = read_map(gb, &s->fsets, map_ch_to_felem, channels)) < 0)
>          return ret;
>
>      if (same_map) {
> @@ -295,13 +295,13 @@ static int decode_frame(AVCodecContext *avctx, void
> *data,
>          memcpy(map_ch_to_pelem, map_ch_to_felem, sizeof(map_ch_to_felem));
>      } else {
>          avpriv_request_sample(avctx, "Not Same Mapping");
> -        if ((ret = read_map(gb, &s->probs, map_ch_to_pelem,
> avctx->channels)) < 0)
> +        if ((ret = read_map(gb, &s->probs, map_ch_to_pelem, channels)) < 0)
>              return ret;
>      }
>
>      /* Half Probability (10.10) */
>
> -    for (ch = 0; ch < avctx->channels; ch++)
> +    for (ch = 0; ch < channels; ch++)
>          half_prob[ch] = get_bits1(gb);
>
>      /* Filter Coef Sets (10.12) */
> @@ -325,7 +325,7 @@ static int decode_frame(AVCodecContext *avctx, void
> *data,
>      build_filter(s->filter, &s->fsets);
>
>      memset(s->status, 0xAA, sizeof(s->status));
> -    memset(dsd, 0, frame->nb_samples * 4 * avctx->channels);
> +    memset(dsd, 0, frame->nb_samples * 4 * channels);
>
>      ac_get(ac, gb, prob_dst_x_bit(s->fsets.coeff[0][0]), &dst_x_bit);
>
> @@ -364,10 +364,10 @@ static int decode_frame(AVCodecContext *avctx, void
> *data,
>      }
>
>  dsd:
> -    for (i = 0; i < avctx->channels; i++) {
> +    for (i = 0; i < channels; i++) {
>          ff_dsd2pcm_translate(&s->dsdctx[i], frame->nb_samples, 0,
>                               frame->data[0] + i * 4,
> -                             avctx->channels * 4, pcm + i,
> avctx->channels);
> +                             channels * 4, pcm + i, channels);
>      }
>
>      *got_frame_ptr = 1;
> --
> 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 Feb. 14, 2020, 3:30 p.m. UTC | #2
On Fri, Feb 14, 2020 at 10:20:41AM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
index 880b838b0c..bdabced823 100644
--- a/libavcodec/dstdec.c
+++ b/libavcodec/dstdec.c
@@ -262,7 +262,7 @@  static int decode_frame(AVCodecContext *avctx, void *data,
         skip_bits1(gb);
         if (get_bits(gb, 6))
             return AVERROR_INVALIDDATA;
-        memcpy(frame->data[0], avpkt->data + 1, FFMIN(avpkt->size - 1, frame->nb_samples * avctx->channels));
+        memcpy(frame->data[0], avpkt->data + 1, FFMIN(avpkt->size - 1, frame->nb_samples * channels));
         goto dsd;
     }
 
@@ -287,7 +287,7 @@  static int decode_frame(AVCodecContext *avctx, void *data,
 
     same_map = get_bits1(gb);
 
-    if ((ret = read_map(gb, &s->fsets, map_ch_to_felem, avctx->channels)) < 0)
+    if ((ret = read_map(gb, &s->fsets, map_ch_to_felem, channels)) < 0)
         return ret;
 
     if (same_map) {
@@ -295,13 +295,13 @@  static int decode_frame(AVCodecContext *avctx, void *data,
         memcpy(map_ch_to_pelem, map_ch_to_felem, sizeof(map_ch_to_felem));
     } else {
         avpriv_request_sample(avctx, "Not Same Mapping");
-        if ((ret = read_map(gb, &s->probs, map_ch_to_pelem, avctx->channels)) < 0)
+        if ((ret = read_map(gb, &s->probs, map_ch_to_pelem, channels)) < 0)
             return ret;
     }
 
     /* Half Probability (10.10) */
 
-    for (ch = 0; ch < avctx->channels; ch++)
+    for (ch = 0; ch < channels; ch++)
         half_prob[ch] = get_bits1(gb);
 
     /* Filter Coef Sets (10.12) */
@@ -325,7 +325,7 @@  static int decode_frame(AVCodecContext *avctx, void *data,
     build_filter(s->filter, &s->fsets);
 
     memset(s->status, 0xAA, sizeof(s->status));
-    memset(dsd, 0, frame->nb_samples * 4 * avctx->channels);
+    memset(dsd, 0, frame->nb_samples * 4 * channels);
 
     ac_get(ac, gb, prob_dst_x_bit(s->fsets.coeff[0][0]), &dst_x_bit);
 
@@ -364,10 +364,10 @@  static int decode_frame(AVCodecContext *avctx, void *data,
     }
 
 dsd:
-    for (i = 0; i < avctx->channels; i++) {
+    for (i = 0; i < channels; i++) {
         ff_dsd2pcm_translate(&s->dsdctx[i], frame->nb_samples, 0,
                              frame->data[0] + i * 4,
-                             avctx->channels * 4, pcm + i, avctx->channels);
+                             channels * 4, pcm + i, channels);
     }
 
     *got_frame_ptr = 1;