summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/msmpeg4.c24
-rw-r--r--libavcodec/msmpeg4data.h8
-rw-r--r--libavcodec/vc9.c29
-rw-r--r--libavcodec/vc9data.h119
4 files changed, 33 insertions, 147 deletions
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
index e839b3fdb1..756f852082 100644
--- a/libavcodec/msmpeg4.c
+++ b/libavcodec/msmpeg4.c
@@ -882,15 +882,15 @@ static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr
if (s->dc_table_index == 0) {
if (n < 4) {
- put_bits(&s->pb, table0_dc_lum[code][1], table0_dc_lum[code][0]);
+ put_bits(&s->pb, ff_table0_dc_lum[code][1], ff_table0_dc_lum[code][0]);
} else {
- put_bits(&s->pb, table0_dc_chroma[code][1], table0_dc_chroma[code][0]);
+ put_bits(&s->pb, ff_table0_dc_chroma[code][1], ff_table0_dc_chroma[code][0]);
}
} else {
if (n < 4) {
- put_bits(&s->pb, table1_dc_lum[code][1], table1_dc_lum[code][0]);
+ put_bits(&s->pb, ff_table1_dc_lum[code][1], ff_table1_dc_lum[code][0]);
} else {
- put_bits(&s->pb, table1_dc_chroma[code][1], table1_dc_chroma[code][0]);
+ put_bits(&s->pb, ff_table1_dc_chroma[code][1], ff_table1_dc_chroma[code][0]);
}
}
@@ -1122,17 +1122,17 @@ int ff_msmpeg4_decode_init(MpegEncContext *s)
}
init_vlc(&dc_lum_vlc[0], DC_VLC_BITS, 120,
- &table0_dc_lum[0][1], 8, 4,
- &table0_dc_lum[0][0], 8, 4, 1);
+ &ff_table0_dc_lum[0][1], 8, 4,
+ &ff_table0_dc_lum[0][0], 8, 4, 1);
init_vlc(&dc_chroma_vlc[0], DC_VLC_BITS, 120,
- &table0_dc_chroma[0][1], 8, 4,
- &table0_dc_chroma[0][0], 8, 4, 1);
+ &ff_table0_dc_chroma[0][1], 8, 4,
+ &ff_table0_dc_chroma[0][0], 8, 4, 1);
init_vlc(&dc_lum_vlc[1], DC_VLC_BITS, 120,
- &table1_dc_lum[0][1], 8, 4,
- &table1_dc_lum[0][0], 8, 4, 1);
+ &ff_table1_dc_lum[0][1], 8, 4,
+ &ff_table1_dc_lum[0][0], 8, 4, 1);
init_vlc(&dc_chroma_vlc[1], DC_VLC_BITS, 120,
- &table1_dc_chroma[0][1], 8, 4,
- &table1_dc_chroma[0][0], 8, 4, 1);
+ &ff_table1_dc_chroma[0][1], 8, 4,
+ &ff_table1_dc_chroma[0][0], 8, 4, 1);
init_vlc(&v2_dc_lum_vlc, DC_VLC_BITS, 512,
&v2_dc_lum_table[0][1], 8, 4,
diff --git a/libavcodec/msmpeg4data.h b/libavcodec/msmpeg4data.h
index 69568cbf63..492d59541e 100644
--- a/libavcodec/msmpeg4data.h
+++ b/libavcodec/msmpeg4data.h
@@ -61,7 +61,7 @@ static const uint32_t table_mb_non_intra[128][2] = {
/* dc table 0 */
-static const uint32_t table0_dc_lum[120][2] = {
+const uint32_t ff_table0_dc_lum[120][2] = {
{ 0x1, 1 },{ 0x1, 2 },{ 0x1, 4 },{ 0x1, 5 },
{ 0x5, 5 },{ 0x7, 5 },{ 0x8, 6 },{ 0xc, 6 },
{ 0x0, 7 },{ 0x2, 7 },{ 0x12, 7 },{ 0x1a, 7 },
@@ -94,7 +94,7 @@ static const uint32_t table0_dc_lum[120][2] = {
{ 0x6078c, 24 },{ 0x6078d, 24 },{ 0x6078e, 24 },{ 0x6078f, 24 },
};
-static const uint32_t table0_dc_chroma[120][2] = {
+const uint32_t ff_table0_dc_chroma[120][2] = {
{ 0x0, 2 },{ 0x1, 2 },{ 0x5, 3 },{ 0x9, 4 },
{ 0xd, 4 },{ 0x11, 5 },{ 0x1d, 5 },{ 0x1f, 5 },
{ 0x21, 6 },{ 0x31, 6 },{ 0x38, 6 },{ 0x33, 6 },
@@ -129,7 +129,7 @@ static const uint32_t table0_dc_chroma[120][2] = {
/* dc table 1 */
-static const uint32_t table1_dc_lum[120][2] = {
+const uint32_t ff_table1_dc_lum[120][2] = {
{ 0x2, 2 },{ 0x3, 2 },{ 0x3, 3 },{ 0x2, 4 },
{ 0x5, 4 },{ 0x1, 5 },{ 0x3, 5 },{ 0x8, 5 },
{ 0x0, 6 },{ 0x5, 6 },{ 0xd, 6 },{ 0xf, 6 },
@@ -162,7 +162,7 @@ static const uint32_t table1_dc_lum[120][2] = {
{ 0x1e6964, 26 },{ 0x1e6965, 26 },{ 0x1e6966, 26 },{ 0x1e6967, 26 },
};
-static const uint32_t table1_dc_chroma[120][2] = {
+const uint32_t ff_table1_dc_chroma[120][2] = {
{ 0x0, 2 },{ 0x1, 2 },{ 0x4, 3 },{ 0x7, 3 },
{ 0xb, 4 },{ 0xd, 4 },{ 0x15, 5 },{ 0x28, 6 },
{ 0x30, 6 },{ 0x32, 6 },{ 0x52, 7 },{ 0x62, 7 },
diff --git a/libavcodec/vc9.c b/libavcodec/vc9.c
index 30c8e963e1..d786802984 100644
--- a/libavcodec/vc9.c
+++ b/libavcodec/vc9.c
@@ -26,13 +26,14 @@
*
* TODO: Norm-6 bitplane imode, most AP stuff, optimize, all of MB layer :)
* TODO: use MPV_ !!
- * TODO: export decode012 in bitstream.h ?
*/
#include "common.h"
#include "dsputil.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "vc9data.h"
+extern const uint32_t ff_table0_dc_lum[120][2], ff_table1_dc_lum[120][2];
+extern const uint32_t ff_table0_dc_chroma[120][2], ff_table1_dc_chroma[120][2];
/* Some inhibiting stuff */
#define HAS_ADVANCED_PROFILE 1
@@ -139,9 +140,8 @@ static VLC vc9_cbpcy_i_vlc;
static VLC vc9_cbpcy_p_vlc[4];
#define VC9_4MV_BLOCK_PATTERN_VLC_BITS 6
static VLC vc9_4mv_block_pattern_vlc[4];
-#define VC9_LUMA_DC_VLC_BITS 9
+#define VC9_DC_VLC_BITS 9
static VLC vc9_luma_dc_vlc[2];
-#define VC9_CHROMA_DC_VLC_BITS 9
static VLC vc9_chroma_dc_vlc[2];
//We mainly need data and is_raw, so this struct could be avoided
@@ -345,15 +345,18 @@ static int init_common(VC9Context *v)
INIT_VLC(&vc9_imode_vlc, VC9_IMODE_VLC_BITS, 7,
vc9_imode_bits, 1, 1,
vc9_imode_codes, 1, 1, 1);
- for (i=0; i<2; i++)
- {
- INIT_VLC(&vc9_luma_dc_vlc[i], VC9_LUMA_DC_VLC_BITS, 26,
- vc9_luma_dc_bits[i], 1, 1,
- vc9_luma_dc_codes[i], 4, 4, 1);
- INIT_VLC(&vc9_chroma_dc_vlc[i], VC9_CHROMA_DC_VLC_BITS, 26,
- vc9_chroma_dc_bits[i], 1, 1,
- vc9_chroma_dc_codes[i], 4, 4, 1);
- }
+ INIT_VLC(&vc9_luma_dc_vlc[0], VC9_DC_VLC_BITS, 120,
+ &ff_table0_dc_lum[0][1], 8, 4,
+ &ff_table0_dc_lum[0][0], 8, 4, 1);
+ INIT_VLC(&vc9_chroma_dc_vlc[0], VC9_DC_VLC_BITS, 120,
+ &ff_table0_dc_chroma[0][1], 8, 4,
+ &ff_table0_dc_chroma[0][0], 8, 4, 1);
+ INIT_VLC(&vc9_luma_dc_vlc[1], VC9_DC_VLC_BITS, 120,
+ &ff_table1_dc_lum[0][1], 8, 4,
+ &ff_table1_dc_lum[0][0], 8, 4, 1);
+ INIT_VLC(&vc9_chroma_dc_vlc[1], VC9_DC_VLC_BITS, 120,
+ &ff_table1_dc_chroma[0][1], 8, 4,
+ &ff_table1_dc_chroma[0][0], 8, 4, 1);
for (i=0; i<3; i++)
{
INIT_VLC(&vc9_ttmb_vlc[i], VC9_TTMB_VLC_BITS, 16,
@@ -1373,7 +1376,7 @@ int decode_luma_intra_block(VC9Context *v, int mquant)
int dcdiff;
dcdiff = get_vlc2(&v->gb, v->luma_dc_vlc->table,
- VC9_LUMA_DC_VLC_BITS, 2);
+ VC9_DC_VLC_BITS, 2);
if (dcdiff)
{
if (dcdiff == 119 /* ESC index value */)
diff --git a/libavcodec/vc9data.h b/libavcodec/vc9data.h
index 4e21b4fbda..f959cffed3 100644
--- a/libavcodec/vc9data.h
+++ b/libavcodec/vc9data.h
@@ -392,124 +392,7 @@ static const uint8_t vc9_mv_diff_bits[4][73] = {
}
};
-/* DC differentials low+hi-mo, p217 */
-//same as msmpeg4 table0/1_dc_lum
-static const uint32_t vc9_luma_dc_codes[2][120] = {
- {
- 1, 1, 1, 1, 5, 7, 8, 12,
- 0, 2, 18, 26, 3, 7, 39, 55,
- 5, 76, 108, 109, 8, 25, 155, 27,
- 154, 19, 52, 53, 97, 72, 196, 74,
- 198, 199, 146, 395, 147, 387, 386, 150,
- 151, 384, 788, 789, 1541, 1540, 1542, 3086,
- 197581, 197577, 197576, 197578, 197579, 197580, 197582, 197583,
- 197584, 197585, 197586, 197587, 197588, 197589, 197590, 197591,
- 197592, 197593, 197594, 197595, 197596, 197597, 197598, 197599,
- 197600, 197601, 197602, 197603, 197604, 197605, 197606, 197607,
- 197608, 197609, 197610, 197611, 197612, 197613, 197614, 197615,
- 197616, 197617, 197618, 197619, 197620, 197621, 197622, 197623,
- 197624, 197625, 197626, 197627, 197628, 197629, 197630, 197631,
- 395136, 395137, 395138, 395139, 395140, 395141, 395142, 395143,
- 395144, 395145, 395146, 395147, 395148, 395149, 395150, 395151
- },
- {
- 2, 3, 3, 2, 5, 1, 3, 8,
- 0, 5, 13, 15, 19, 8, 24, 28,
- 36, 4, 6, 18, 50, 59, 74, 75,
- 11, 38, 39, 102, 116, 117, 20, 28,
- 31, 29, 43, 61, 413, 415, 84, 825,
- 824, 829, 171, 241, 1656, 242, 480, 481,
- 340, 3314, 972, 683, 6631, 974, 6630, 1364,
- 1951, 1365, 3901, 3895, 3900, 3893, 7789, 7784,
- 15576, 15571, 15577, 31140, 996538, 996532, 996533, 996534,
- 996535, 996536, 996537, 996539, 996540, 996541, 996542, 996543,
- 1993024, 1993025, 1993026, 1993027, 1993028, 1993029, 1993030, 1993031,
- 1993032, 1993033, 1993034, 1993035, 1993036, 1993037, 1993038, 1993039,
- 1993040, 1993041, 1993042, 1993043, 1993044, 1993045, 1993046, 1993047,
- 1993048, 1993049, 1993050, 1993051, 1993052, 1993053, 1993054, 1993055,
- 1993056, 1993057, 1993058, 1993059, 1993060, 1993061, 1993062, 1993063
- }
-};
-static const uint8_t vc9_luma_dc_bits[2][120] = {
- {
- 1, 2, 4, 5, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
- 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 12, 13, 13, 13,
- 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 16, 16, 16, 17,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24 /* lowmo, 120 values */
- },
- {
-
- 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
- 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10,
- 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14,
- 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18,
- 19, 19, 19, 20, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26 /* himo, 120 values */
- }
-};
-
-static const uint32_t vc9_chroma_dc_codes[2][120] = {
- {
- 0, 1, 5, 9, 13, 17, 29, 31,
- 33, 49, 56, 51, 57, 61, 97, 121,
- 128, 200, 202, 240, 129, 192, 201, 263,
- 262, 406, 387, 483, 482, 522, 523, 1545,
- 1042, 1043, 1547, 1041, 1546, 1631, 1040, 1629,
- 1630, 3256, 3088, 3257, 6179, 12357, 24713, 49424,
- 3163208, 3163209, 3163210, 3163211, 3163212, 3163213, 3163214, 3163215,
- 3163216, 3163217, 3163218, 3163219, 3163220, 3163221, 3163222, 3163223,
- 3163224, 3163225, 3163226, 3163227, 3163228, 3163229, 3163230, 3163231,
- 3163232, 3163233, 3163234, 3163235, 3163236, 3163237, 3163238, 3163239,
- 3163240, 3163241, 3163242, 3163243, 3163244, 3163245, 3163248, 3163231,
- 3163248, 3163249, 3163250, 3163251, 3163252, 3163253, 3163254, 3163255,
- 3163256, 3163257, 3163258, 3163259, 3163260, 3163261, 3163262, 3163263,
- 6326400, 6326401, 6326402, 6326403, 6326404, 6326405, 6326406, 6326407,
- 6326408, 6326409, 6326410, 6326411, 6326412, 6326413, 6326414, 6326415
- },
- {
- 0, 1, 4, 7, 11, 13, 21, 40,
- 48, 50, 82, 98, 102, 166, 198, 207,
- 335, 398, 412, 669, 826, 1336, 1596, 1598,
- 1599, 1654, 2675, 3194, 3311, 5349, 6621, 10696,
- 10697, 25565, 13240, 13241, 51126, 25560, 25567, 51123,
- 51124, 51125, 25566, 51127, 51128, 51129, 102245, 204488,
- 13087304,13087305,13087306,13087307,13087308,13087309,13087310,13087311,
- 13087312,13087313,13087314,13087315,13087316,13087317,13087318,13087319,
- 13087320,13087321,13087322,13087323,13087324,13087325,13087326,13087327,
- 13087328,13087329,13087330,13087331,13087332,13087333,13087334,13087335,
- 13087336,13087337,13087338,13087339,13087340,13087341,13087342,13087343,
- 13087344,13087345,13087346,13087347,13087348,13087349,13087350,13087351,
- 13087352,13087353,13087354,13087355,13087356,13087357,13087358,13087359,
- 26174592,26174593,26174594,26174595,26174596,26174597,26174598,26174599,
- 26174600,26174601,26174602,26174603,26174604,26174605,26174606,26174607
- }
-};
-static const uint8_t vc9_chroma_dc_bits[2][120] = {
- {
- 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7,
- 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 11,
- 11, 11, 11, 11, 12, 12, 12, 13, 14, 15, 16, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 23 /* lowmo, 120 values */
- },
- {
- 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8,
- 9, 9, 9, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 13, 13, 14,
- 14, 15, 14, 14, 16, 15, 15, 16, 16, 16, 15, 16, 16, 16, 17, 18,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25,
- 25, 25, 25, 25, 25, 25, 25, 25 /* himo, 120 values */
- },
-};
+/* 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) */