Originally committed as revision 13959 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
@@ -64,13 +64,11 @@ const unsigned char std_chrominance_quant_tbl[64] = { | |||||
/* IMPORTANT: these are only valid for 8-bit data precision! */ | /* IMPORTANT: these are only valid for 8-bit data precision! */ | ||||
const uint8_t ff_mjpeg_bits_dc_luminance[17] = | const uint8_t ff_mjpeg_bits_dc_luminance[17] = | ||||
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; | { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; | ||||
const uint8_t ff_mjpeg_val_dc_luminance[] = | |||||
const uint8_t ff_mjpeg_val_dc[12] = | |||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; | ||||
const uint8_t ff_mjpeg_bits_dc_chrominance[17] = | const uint8_t ff_mjpeg_bits_dc_chrominance[17] = | ||||
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; | { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; | ||||
const uint8_t ff_mjpeg_val_dc_chrominance[] = | |||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; | |||||
const uint8_t ff_mjpeg_bits_ac_luminance[17] = | const uint8_t ff_mjpeg_bits_ac_luminance[17] = | ||||
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; | { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; | ||||
@@ -138,10 +138,9 @@ static inline void put_marker(PutBitContext *p, int code) | |||||
} | } | ||||
extern const uint8_t ff_mjpeg_bits_dc_luminance[]; | extern const uint8_t ff_mjpeg_bits_dc_luminance[]; | ||||
extern const uint8_t ff_mjpeg_val_dc_luminance[]; | |||||
extern const uint8_t ff_mjpeg_val_dc[]; | |||||
extern const uint8_t ff_mjpeg_bits_dc_chrominance[]; | extern const uint8_t ff_mjpeg_bits_dc_chrominance[]; | ||||
extern const uint8_t ff_mjpeg_val_dc_chrominance[]; | |||||
extern const uint8_t ff_mjpeg_bits_ac_luminance[]; | extern const uint8_t ff_mjpeg_bits_ac_luminance[]; | ||||
extern const uint8_t ff_mjpeg_val_ac_luminance[]; | extern const uint8_t ff_mjpeg_val_ac_luminance[]; | ||||
@@ -64,9 +64,9 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_tab | |||||
static void build_basic_mjpeg_vlc(MJpegDecodeContext * s) { | static void build_basic_mjpeg_vlc(MJpegDecodeContext * s) { | ||||
build_vlc(&s->vlcs[0][0], ff_mjpeg_bits_dc_luminance, | build_vlc(&s->vlcs[0][0], ff_mjpeg_bits_dc_luminance, | ||||
ff_mjpeg_val_dc_luminance, 12, 0, 0); | |||||
ff_mjpeg_val_dc, 12, 0, 0); | |||||
build_vlc(&s->vlcs[0][1], ff_mjpeg_bits_dc_chrominance, | build_vlc(&s->vlcs[0][1], ff_mjpeg_bits_dc_chrominance, | ||||
ff_mjpeg_val_dc_chrominance, 12, 0, 0); | |||||
ff_mjpeg_val_dc, 12, 0, 0); | |||||
build_vlc(&s->vlcs[1][0], ff_mjpeg_bits_ac_luminance, | build_vlc(&s->vlcs[1][0], ff_mjpeg_bits_ac_luminance, | ||||
ff_mjpeg_val_ac_luminance, 251, 0, 1); | ff_mjpeg_val_ac_luminance, 251, 0, 1); | ||||
build_vlc(&s->vlcs[1][1], ff_mjpeg_bits_ac_chrominance, | build_vlc(&s->vlcs[1][1], ff_mjpeg_bits_ac_chrominance, | ||||
@@ -59,11 +59,11 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s) | |||||
ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance, | ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance, | ||||
m->huff_code_dc_luminance, | m->huff_code_dc_luminance, | ||||
ff_mjpeg_bits_dc_luminance, | ff_mjpeg_bits_dc_luminance, | ||||
ff_mjpeg_val_dc_luminance); | |||||
ff_mjpeg_val_dc); | |||||
ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance, | ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance, | ||||
m->huff_code_dc_chrominance, | m->huff_code_dc_chrominance, | ||||
ff_mjpeg_bits_dc_chrominance, | ff_mjpeg_bits_dc_chrominance, | ||||
ff_mjpeg_val_dc_chrominance); | |||||
ff_mjpeg_val_dc); | |||||
ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance, | ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance, | ||||
m->huff_code_ac_luminance, | m->huff_code_ac_luminance, | ||||
ff_mjpeg_bits_ac_luminance, | ff_mjpeg_bits_ac_luminance, | ||||
@@ -139,9 +139,9 @@ static void jpeg_table_header(MpegEncContext *s) | |||||
put_bits(p, 16, 0); /* patched later */ | put_bits(p, 16, 0); /* patched later */ | ||||
size = 2; | size = 2; | ||||
size += put_huffman_table(s, 0, 0, ff_mjpeg_bits_dc_luminance, | size += put_huffman_table(s, 0, 0, ff_mjpeg_bits_dc_luminance, | ||||
ff_mjpeg_val_dc_luminance); | |||||
ff_mjpeg_val_dc); | |||||
size += put_huffman_table(s, 0, 1, ff_mjpeg_bits_dc_chrominance, | size += put_huffman_table(s, 0, 1, ff_mjpeg_bits_dc_chrominance, | ||||
ff_mjpeg_val_dc_chrominance); | |||||
ff_mjpeg_val_dc); | |||||
size += put_huffman_table(s, 1, 0, ff_mjpeg_bits_ac_luminance, | size += put_huffman_table(s, 1, 0, ff_mjpeg_bits_ac_luminance, | ||||
ff_mjpeg_val_ac_luminance); | ff_mjpeg_val_ac_luminance); | ||||
@@ -98,7 +98,7 @@ static void common_init(MpegEncContext * s) | |||||
case 3: | case 3: | ||||
if(s->workaround_bugs){ | if(s->workaround_bugs){ | ||||
s->y_dc_scale_table= old_ff_y_dc_scale_table; | s->y_dc_scale_table= old_ff_y_dc_scale_table; | ||||
s->c_dc_scale_table= old_ff_c_dc_scale_table; | |||||
s->c_dc_scale_table= wmv1_c_dc_scale_table; | |||||
} else{ | } else{ | ||||
s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table; | s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table; | ||||
s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table; | s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table; | ||||
@@ -1823,10 +1823,6 @@ const uint8_t old_ff_y_dc_scale_table[32]={ | |||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ||||
0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 | 0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 | ||||
}; | }; | ||||
const uint8_t old_ff_c_dc_scale_table[32]={ | |||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |||||
0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22 | |||||
}; | |||||
const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={ | const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={ | ||||
{ | { | ||||
@@ -76,7 +76,6 @@ extern RLTable rl_table[NB_RL_TABLES]; | |||||
extern const uint8_t wmv1_y_dc_scale_table[32]; | extern const uint8_t wmv1_y_dc_scale_table[32]; | ||||
extern const uint8_t wmv1_c_dc_scale_table[32]; | extern const uint8_t wmv1_c_dc_scale_table[32]; | ||||
extern const uint8_t old_ff_y_dc_scale_table[32]; | extern const uint8_t old_ff_y_dc_scale_table[32]; | ||||
extern const uint8_t old_ff_c_dc_scale_table[32]; | |||||
extern MVTable mv_tables[2]; | extern MVTable mv_tables[2]; | ||||
@@ -783,8 +783,8 @@ static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb) | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
v->zz_8x4 = ff_vc1_simple_progressive_8x4_zz; | |||||
v->zz_4x8 = ff_vc1_simple_progressive_4x8_zz; | |||||
v->zz_8x4 = wmv2_scantableA; | |||||
v->zz_4x8 = wmv2_scantableB; | |||||
v->res_sm = get_bits(gb, 2); //reserved | v->res_sm = get_bits(gb, 2); //reserved | ||||
if (v->res_sm) | if (v->res_sm) | ||||
{ | { | ||||
@@ -2398,11 +2398,11 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded | |||||
if(v->s.ac_pred) { | if(v->s.ac_pred) { | ||||
if(!dc_pred_dir) | if(!dc_pred_dir) | ||||
zz_table = ff_vc1_horizontal_zz; | |||||
zz_table = wmv1_scantable[2]; | |||||
else | else | ||||
zz_table = ff_vc1_vertical_zz; | |||||
zz_table = wmv1_scantable[3]; | |||||
} else | } else | ||||
zz_table = ff_vc1_normal_zz; | |||||
zz_table = wmv1_scantable[1]; | |||||
ac_val = s->ac_val[0][0] + s->block_index[n] * 16; | ac_val = s->ac_val[0][0] + s->block_index[n] * 16; | ||||
ac_val2 = ac_val; | ac_val2 = ac_val; | ||||
@@ -2581,11 +2581,11 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c | |||||
if(v->s.ac_pred) { | if(v->s.ac_pred) { | ||||
if(!dc_pred_dir) | if(!dc_pred_dir) | ||||
zz_table = ff_vc1_horizontal_zz; | |||||
zz_table = wmv1_scantable[2]; | |||||
else | else | ||||
zz_table = ff_vc1_vertical_zz; | |||||
zz_table = wmv1_scantable[3]; | |||||
} else | } else | ||||
zz_table = ff_vc1_normal_zz; | |||||
zz_table = wmv1_scantable[1]; | |||||
while (!last) { | while (!last) { | ||||
vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); | vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); | ||||
@@ -2786,7 +2786,7 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c | |||||
const int8_t *zz_table; | const int8_t *zz_table; | ||||
int k; | int k; | ||||
zz_table = ff_vc1_simple_progressive_8x8_zz; | |||||
zz_table = wmv1_scantable[0]; | |||||
while (!last) { | while (!last) { | ||||
vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); | vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); | ||||
@@ -2928,7 +2928,7 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan | |||||
i += skip; | i += skip; | ||||
if(i > 63) | if(i > 63) | ||||
break; | break; | ||||
idx = ff_vc1_simple_progressive_8x8_zz[i++]; | |||||
idx = wmv1_scantable[0][i++]; | |||||
block[idx] = value * scale; | block[idx] = value * scale; | ||||
if(!v->pquantizer) | if(!v->pquantizer) | ||||
block[idx] += (block[idx] < 0) ? -mquant : mquant; | block[idx] += (block[idx] < 0) ? -mquant : mquant; | ||||
@@ -562,75 +562,6 @@ const uint8_t ff_vc1_mv_diff_bits[4][73] = { | |||||
/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ | /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ | ||||
/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */ | |||||
const int8_t ff_vc1_normal_zz[64] = { | |||||
0, 8, 1, 2, 9, 16, 24, 17, | |||||
10, 3, 4, 11, 18, 25, 32, 40, | |||||
33, 48, 26, 19, 12, 5, 6, 13, | |||||
20, 27, 34, 41, 56, 49, 57, 42, | |||||
35, 28, 21, 14, 7, 15, 22, 29, | |||||
36, 43, 50, 58, 51, 59, 44, 37, | |||||
30, 23, 31, 38, 45, 52, 60, 53, | |||||
61, 46, 39, 47, 54, 62, 55, 63 | |||||
}; | |||||
const int8_t ff_vc1_horizontal_zz [64] = /* Table 227 */ | |||||
{ | |||||
0, 1, 8, 2, 3, 9, 16, 24, | |||||
17, 10, 4, 5, 11, 18, 25, 32, | |||||
40, 48, 33, 26, 19, 12, 6, 7, | |||||
13, 20, 27, 34, 41, 56, 49, 57, | |||||
42, 35, 28, 21, 14, 15, 22, 29, | |||||
36, 43, 50, 58, 51, 44, 37, 30, | |||||
23, 31, 38, 45, 52, 59, 60, 53, | |||||
46, 39, 47, 54, 61, 62, 55, 63 | |||||
}; | |||||
const int8_t ff_vc1_vertical_zz [64] = /* Table 228 */ | |||||
{ | |||||
0, 8, 16, 1, 24, 32, 40, 9, | |||||
2, 3, 10, 17, 25, 48, 56, 41, | |||||
33, 26, 18, 11, 4, 5, 12, 19, | |||||
27, 34, 49, 57, 50, 42, 35, 28, | |||||
20, 13, 6, 7, 14, 21, 29, 36, | |||||
43, 51, 58, 59, 52, 44, 37, 30, | |||||
22, 15, 23, 31, 38, 45, 60, 53, | |||||
46, 39, 47, 54, 61, 62, 55, 63 | |||||
}; | |||||
const int8_t ff_vc1_simple_progressive_8x8_zz [64] = | |||||
/* Table 229 */ | |||||
{ | |||||
0, 8, 1, 2, 9, 16, 24, 17, | |||||
10, 3, 4, 11, 18, 25, 32, 40, | |||||
48, 56, 41, 33, 26, 19, 12, 5, | |||||
6, 13, 20, 27, 34, 49, 57, 58, | |||||
50, 42, 35, 28, 21, 14, 7, 15, | |||||
22, 29, 36, 43, 51, 59, 60, 52, | |||||
44, 37, 30, 23, 31, 38, 45, 53, | |||||
61, 62, 54, 46, 39, 47, 55, 63 | |||||
}; | |||||
const int8_t ff_vc1_simple_progressive_8x4_zz [32] = /* Table 230 */ | |||||
{ | |||||
0, 1, 2, 8, 3, 9, 10, 16, | |||||
4, 11, 17, 24, 18, 12, 5, 19, | |||||
25, 13, 20, 26, 27, 6, 21, 28, | |||||
14, 22, 29, 7, 30, 15, 23, 31 | |||||
}; | |||||
const int8_t ff_vc1_simple_progressive_4x8_zz [32] = /* Table 231 */ | |||||
{ | |||||
0, 8, 1, 16, | |||||
9, 24, 17, 2, | |||||
32, 10, 25, 40, | |||||
18, 48, 33, 26, | |||||
56, 41, 34, 3, | |||||
49, 57, 11, 42, | |||||
19, 50, 27, 58, | |||||
35, 43, 51, 59 | |||||
}; | |||||
/* Table 232 */ | /* Table 232 */ | ||||
const int8_t ff_vc1_simple_progressive_4x4_zz [16] = | const int8_t ff_vc1_simple_progressive_4x4_zz [16] = | ||||
{ | { | ||||
@@ -143,12 +143,6 @@ extern const uint8_t ff_vc1_mv_diff_bits[4][73]; | |||||
/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ | /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ | ||||
/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */ | /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */ | ||||
extern const int8_t ff_vc1_normal_zz[64]; | |||||
extern const int8_t ff_vc1_horizontal_zz [64]; | |||||
extern const int8_t ff_vc1_vertical_zz [64]; | |||||
extern const int8_t ff_vc1_simple_progressive_8x8_zz [64]; | |||||
extern const int8_t ff_vc1_simple_progressive_8x4_zz [32]; | |||||
extern const int8_t ff_vc1_simple_progressive_4x8_zz [32]; | |||||
extern const int8_t ff_vc1_simple_progressive_4x4_zz [16]; | extern const int8_t ff_vc1_simple_progressive_4x4_zz [16]; | ||||
extern const int8_t ff_vc1_adv_progressive_8x4_zz [32]; | extern const int8_t ff_vc1_adv_progressive_8x4_zz [32]; | ||||
extern const int8_t ff_vc1_adv_progressive_4x8_zz [32]; | extern const int8_t ff_vc1_adv_progressive_4x8_zz [32]; | ||||