[FFmpeg-devel] [PATCH] aac: Eliminate an unnecessary variable

Alex Converse alex.converse
Tue Oct 6 17:16:55 CEST 2009


On Tue, Oct 6, 2009 at 11:03 AM, Reimar D?ffinger
<Reimar.Doeffinger at gmx.de> wrote:
> On Tue, Oct 06, 2009 at 10:53:46AM -0400, Alex Converse wrote:
>> $subj
>
>> From 0024dd40299ccd10d8d22b34ae6980a79b42a501 Mon Sep 17 00:00:00 2001
>> From: Alex Converse <alex.converse at gmail.com>
>> Date: Tue, 6 Oct 2009 09:37:38 -0400
>> Subject: [PATCH 1/3] aac: Eliminate an unnecessary variable.
>> MIME-Version: 1.0
>> Content-Type: multipart/mixed; boundary="------------1"
>>
>> This is a multi-part message in MIME format.
>> --------------1
>> Content-Type: text/plain; charset=UTF-8; format=fixed
>> Content-Transfer-Encoding: 8bit
>>
>> ---
>> ?libavcodec/aac.c | ? ?7 +++----
>> ?1 files changed, 3 insertions(+), 4 deletions(-)
>>
>>
>> --------------1
>> Content-Type: text/x-patch; name="0001-aac-Eliminate-an-unnecessary-variable.patch"
>> Content-Transfer-Encoding: 8bit
>> Content-Disposition: attachment; filename="0001-aac-Eliminate-an-unnecessary-variable.patch"
>>
>> diff --git a/libavcodec/aac.c b/libavcodec/aac.c
>> index 2dc7960..dd045ab 100644
>> --- a/libavcodec/aac.c
>> +++ b/libavcodec/aac.c
>> @@ -723,7 +723,6 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
>> ? ? ?int g, i, idx = 0;
>> ? ? ?int offset[3] = { global_gain, global_gain - 90, 100 };
>> ? ? ?int noise_flag = 1;
>> - ? ?static const char *sf_str[3] = { "Global gain", "Noise gain", "Intensity stereo position" };
>> ? ? ?for (g = 0; g < ics->num_window_groups; g++) {
>> ? ? ? ? ?for (i = 0; i < ics->max_sfb;) {
>> ? ? ? ? ? ? ?int run_end = band_type_run_end[idx];
>> @@ -735,7 +734,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
>> ? ? ? ? ? ? ? ? ? ? ?offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
>> ? ? ? ? ? ? ? ? ? ? ?if (offset[2] > 255U) {
>> ? ? ? ? ? ? ? ? ? ? ? ? ?av_log(ac->avccontext, AV_LOG_ERROR,
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "%s (%d) out of range.\n", sf_str[2], offset[2]);
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "Intensity stereo position (%d) out of range.\n", offset[2]);
>> ? ? ? ? ? ? ? ? ? ? ? ? ?return -1;
>> ? ? ? ? ? ? ? ? ? ? ?}
>> ? ? ? ? ? ? ? ? ? ? ?sf[idx] = ff_aac_pow2sf_tab[-offset[2] + 300];
>> @@ -748,7 +747,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
>> ? ? ? ? ? ? ? ? ? ? ? ? ?offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
>> ? ? ? ? ? ? ? ? ? ? ?if (offset[1] > 255U) {
>> ? ? ? ? ? ? ? ? ? ? ? ? ?av_log(ac->avccontext, AV_LOG_ERROR,
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "%s (%d) out of range.\n", sf_str[1], offset[1]);
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "Noise gain (%d) out of range.\n", offset[1]);
>> ? ? ? ? ? ? ? ? ? ? ? ? ?return -1;
>> ? ? ? ? ? ? ? ? ? ? ?}
>> ? ? ? ? ? ? ? ? ? ? ?sf[idx] = -ff_aac_pow2sf_tab[offset[1] + sf_offset + 100];
>> @@ -758,7 +757,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
>> ? ? ? ? ? ? ? ? ? ? ?offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
>> ? ? ? ? ? ? ? ? ? ? ?if (offset[0] > 255U) {
>> ? ? ? ? ? ? ? ? ? ? ? ? ?av_log(ac->avccontext, AV_LOG_ERROR,
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "%s (%d) out of range.\n", sf_str[0], offset[0]);
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "Global gain (%d) out of range.\n", offset[0]);
>> ? ? ? ? ? ? ? ? ? ? ? ? ?return -1;
>> ? ? ? ? ? ? ? ? ? ? ?}
>> ? ? ? ? ? ? ? ? ? ? ?sf[idx] = -ff_aac_pow2sf_tab[ offset[0] + sf_offset];
>
> Well, an obvious question is of course if it isn't possible to get rid
> of the code duplication instead, which probably was the original reason
> for it...

The amount of redundancy is decreased by the patches that followed this one.



More information about the ffmpeg-devel mailing list