[SCM] libav/experimental: Remove some duplicate local copies of avctx fields. This is an av_cold function, and we don't need to duplicate variables just to save a few characters.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:20:15 UTC 2013


The following commit has been merged in the experimental branch:
commit 1607db0a95a1e07b6f7e51fc7db6456b65059860
Author: Justin Ruggles <justin.ruggles at gmail.com>
Date:   Tue Dec 14 14:52:21 2010 +0000

    Remove some duplicate local copies of avctx fields.
    This is an av_cold function, and we don't need to duplicate variables just to
    save a few characters.
    
    Originally committed as revision 25979 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index 301f805..aa95327 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -1252,8 +1252,6 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels,
 
 static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
 {
-    int freq = avctx->sample_rate;
-    int bitrate = avctx->bit_rate;
     int i, j;
 
     if (!avctx->channel_layout) {
@@ -1269,12 +1267,12 @@ static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
     /* frequency */
     for (i = 0; i < 3; i++) {
         for (j = 0; j < 3; j++)
-            if ((ff_ac3_sample_rate_tab[j] >> i) == freq)
+            if ((ff_ac3_sample_rate_tab[j] >> i) == avctx->sample_rate)
                 goto found;
     }
     return -1;
  found:
-    s->sample_rate        = freq;
+    s->sample_rate        = avctx->sample_rate;
     s->bit_alloc.sr_shift = i;
     s->bit_alloc.sr_code  = j;
     s->bitstream_id       = 8 + s->bit_alloc.sr_shift;
@@ -1282,12 +1280,12 @@ static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
 
     /* bitrate & frame size */
     for (i = 0; i < 19; i++) {
-        if ((ff_ac3_bitrate_tab[i] >> s->bit_alloc.sr_shift)*1000 == bitrate)
+        if ((ff_ac3_bitrate_tab[i] >> s->bit_alloc.sr_shift)*1000 == avctx->bit_rate)
             break;
     }
     if (i == 19)
         return -1;
-    s->bit_rate        = bitrate;
+    s->bit_rate        = avctx->bit_rate;
     s->frame_size_code = i << 1;
 
     return 0;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list