1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/mpeg12enc: Reindentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-11-24 14:43:46 +01:00
parent bf5bfcdbd3
commit 3de3d2f5e2

View File

@ -1037,74 +1037,70 @@ void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64],
static av_cold void mpeg12_encode_init_static(void) static av_cold void mpeg12_encode_init_static(void)
{ {
int f_code; ff_rl_init(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]);
int mv; ff_rl_init(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]);
int i;
ff_rl_init(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]); for (int i = 0; i < 64; i++) {
ff_rl_init(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]); mpeg1_max_level[0][i] = ff_rl_mpeg1.max_level[0][i];
mpeg1_index_run[0][i] = ff_rl_mpeg1.index_run[0][i];
}
for (i = 0; i < 64; i++) { init_uni_ac_vlc(&ff_rl_mpeg1, uni_mpeg1_ac_vlc_len);
mpeg1_max_level[0][i] = ff_rl_mpeg1.max_level[0][i]; init_uni_ac_vlc(&ff_rl_mpeg2, uni_mpeg2_ac_vlc_len);
mpeg1_index_run[0][i] = ff_rl_mpeg1.index_run[0][i];
}
init_uni_ac_vlc(&ff_rl_mpeg1, uni_mpeg1_ac_vlc_len); /* build unified dc encoding tables */
init_uni_ac_vlc(&ff_rl_mpeg2, uni_mpeg2_ac_vlc_len); for (int i = -255; i < 256; i++) {
int adiff, index;
int bits, code;
int diff = i;
/* build unified dc encoding tables */ adiff = FFABS(diff);
for (i = -255; i < 256; i++) { if (diff < 0)
int adiff, index; diff--;
int bits, code; index = av_log2(2 * adiff);
int diff = i;
adiff = FFABS(diff); bits = ff_mpeg12_vlc_dc_lum_bits[index] + index;
if (diff < 0) code = (ff_mpeg12_vlc_dc_lum_code[index] << index) +
diff--; av_mod_uintp2(diff, index);
index = av_log2(2 * adiff); mpeg1_lum_dc_uni[i + 255] = bits + (code << 8);
bits = ff_mpeg12_vlc_dc_lum_bits[index] + index; bits = ff_mpeg12_vlc_dc_chroma_bits[index] + index;
code = (ff_mpeg12_vlc_dc_lum_code[index] << index) + code = (ff_mpeg12_vlc_dc_chroma_code[index] << index) +
av_mod_uintp2(diff, index); av_mod_uintp2(diff, index);
mpeg1_lum_dc_uni[i + 255] = bits + (code << 8); mpeg1_chr_dc_uni[i + 255] = bits + (code << 8);
}
bits = ff_mpeg12_vlc_dc_chroma_bits[index] + index; for (int f_code = 1; f_code <= MAX_FCODE; f_code++)
code = (ff_mpeg12_vlc_dc_chroma_code[index] << index) + for (int mv = -MAX_DMV; mv <= MAX_DMV; mv++) {
av_mod_uintp2(diff, index); int len;
mpeg1_chr_dc_uni[i + 255] = bits + (code << 8);
}
for (f_code = 1; f_code <= MAX_FCODE; f_code++) if (mv == 0) {
for (mv = -MAX_DMV; mv <= MAX_DMV; mv++) { len = ff_mpeg12_mbMotionVectorTable[0][1];
int len; } else {
int val, bit_size, code;
if (mv == 0) { bit_size = f_code - 1;
len = ff_mpeg12_mbMotionVectorTable[0][1];
} else {
int val, bit_size, code;
bit_size = f_code - 1; val = mv;
if (val < 0)
val = mv; val = -val;
if (val < 0) val--;
val = -val; code = (val >> bit_size) + 1;
val--; if (code < 17)
code = (val >> bit_size) + 1; len = ff_mpeg12_mbMotionVectorTable[code][1] +
if (code < 17) 1 + bit_size;
len = ff_mpeg12_mbMotionVectorTable[code][1] + else
1 + bit_size; len = ff_mpeg12_mbMotionVectorTable[16][1] +
else 2 + bit_size;
len = ff_mpeg12_mbMotionVectorTable[16][1] +
2 + bit_size;
}
mv_penalty[f_code][mv + MAX_DMV] = len;
} }
mv_penalty[f_code][mv + MAX_DMV] = len;
}
for (f_code = MAX_FCODE; f_code > 0; f_code--)
for (mv = -(8 << f_code); mv < (8 << f_code); mv++) for (int f_code = MAX_FCODE; f_code > 0; f_code--)
fcode_tab[mv + MAX_MV] = f_code; for (int mv = -(8 << f_code); mv < (8 << f_code); mv++)
fcode_tab[mv + MAX_MV] = f_code;
} }
av_cold void ff_mpeg1_encode_init(MpegEncContext *s) av_cold void ff_mpeg1_encode_init(MpegEncContext *s)