mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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
This commit is contained in:
parent
8f60f70d44
commit
1607db0a95
@ -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)
|
static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
|
||||||
{
|
{
|
||||||
int freq = avctx->sample_rate;
|
|
||||||
int bitrate = avctx->bit_rate;
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if (!avctx->channel_layout) {
|
if (!avctx->channel_layout) {
|
||||||
@ -1269,12 +1267,12 @@ static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s)
|
|||||||
/* frequency */
|
/* frequency */
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
for (j = 0; j < 3; j++)
|
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;
|
goto found;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
found:
|
found:
|
||||||
s->sample_rate = freq;
|
s->sample_rate = avctx->sample_rate;
|
||||||
s->bit_alloc.sr_shift = i;
|
s->bit_alloc.sr_shift = i;
|
||||||
s->bit_alloc.sr_code = j;
|
s->bit_alloc.sr_code = j;
|
||||||
s->bitstream_id = 8 + s->bit_alloc.sr_shift;
|
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 */
|
/* bitrate & frame size */
|
||||||
for (i = 0; i < 19; i++) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
if (i == 19)
|
if (i == 19)
|
||||||
return -1;
|
return -1;
|
||||||
s->bit_rate = bitrate;
|
s->bit_rate = avctx->bit_rate;
|
||||||
s->frame_size_code = i << 1;
|
s->frame_size_code = i << 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user