?? skl_mpg4_v12.cpp
字號:
PMV[0][0][1] >>= 1; Read_DMV_Vector(FBB, PMV[0][0], dMV, VOL->Fwd_Code); // always forward int Dir, Parity; if (VOL->Top_Field_First) { Parity = 1; Dir = 0x02; } else { Parity = 3; Dir = 0x01; } cMV[0][0] = RND2(PMV[0][0][0], Parity) + dMV[0]; cMV[0][1] = RND2(PMV[0][0][1], Parity) + dMV[1] - 1; cMV[1][0] = RND2(PMV[0][0][0], 4-Parity) + dMV[0]; cMV[1][1] = RND2(PMV[0][0][1], 4-Parity) + dMV[1] + 1; Predict_Fields_MPEG12(cMV, VOL->Copy_Ops, Dir, 1); PMV[0][0][1]<<=1; Predict_MPEG12(PMV[0][0], VOL->Add_Ops, 1); SKL_COPY_MV(PMV[0][1], PMV[0][0]); // update 2nd predictor}#undef RND2//////////////////////////////////////////////////////////// VLC for Address Increment// ISO/IEC 13818-2 section 6.2.5 // Table B-1 // Note: Len is pre-offset by -1, as leading '1' bit // is handled separatly /* bLen=4 minCode=b0010xxxxxx maxCode=b1100xxxxxx (0x80/0x33f) */static const SKL_VLC Tab_B1_Mod_0[14] = { { 7, 4},{ 6, 4},{ 5, 3},{ 5, 3},{ 4, 3},{ 4, 3}, { 3, 2},{ 3, 2},{ 3, 2},{ 3, 2},{ 2, 2},{ 2, 2},{ 2, 2},{ 2, 2}}; /* bLen=7 minCode=b0000110xxx maxCode=b0001110xxx (0x30/0x77) */static const SKL_VLC Tab_B1_Mod_1[10] = { {15, 7},{14, 7}, {13, 7},{12, 7},{11, 7},{10, 7},{ 9, 6},{ 9, 6},{ 8, 6},{ 8, 6}}; /* bLen=10 minCode=b0000001000 maxCode=b0000101110 (0x8/0x2e) */static const SKL_VLC Tab_B1_Mod_2[40] = { {-1,10},{ 0,-1},{ 0,-1},{ 0,-1},{ 0,-1},{ 0,-1},{ 0,-1},{ 0,-1}, { 0,-1},{ 0,-1},{ 0,-1},{ 0,-1},{ 0,-1},{ 0,-1},{ 0,-1},{ 0,-1}, {33,10},{32,10},{31,10},{30,10},{29,10},{28,10},{27,10},{26,10}, {25,10},{24,10},{23,10},{22,10},{21, 9},{21, 9},{20, 9},{20, 9}, {19, 9},{19, 9},{18, 9},{18, 9},{17, 9},{17, 9},{16, 9},{16, 9}};static SKL_VLC_CHUNK Incr_Tab_Chunks[] = { /* bSize=10 (total size=64)*/ { Tab_B1_Mod_0 - 0x2, 0x80, 6 }, { Tab_B1_Mod_1 - 0x6, 0x30, 3 }, { Tab_B1_Mod_2 - 0x8, 0x8, 0 }, {0,0}};static int Read_Addr_Incr(SKL_FBB *FBB){ if (FBB->Get_Bits(1)) return 1; int Mb_Addr = 0; SKL_UINT32 Bits = FBB->See_Bits(10); while(Bits<24) { FBB->Discard(10); if (Bits==0x08) Mb_Addr += 33; // escape else if (Bits==0x0f) {} // stuffing (MPEG1) else return 0; // Error. forbidden codes [0-7][9-14][16-23] if (FBB->Get_Bits(1)) return Mb_Addr+1; Bits = FBB->See_Bits(10); } const SKL_VLC *vlc = Skl_VLC_Search( Incr_Tab_Chunks, Bits ); SKL_ASSERT(vlc!=0); FBB->Discard(vlc->Len); return (Mb_Addr + vlc->Value);}//////////////////////////////////////////////////////////// VLC for non Spatial-Scalable macroblock types// ISO/IEC 13818-2 section 6.2.5// Tables B-2..B-4 // Table B-2 (I-VOP) //#define MBLK_ERROR {MPEG12_MBLK_ERROR,0}static const SKL_VLC MBlk_Type_B_2[] = { {MPEG12_MBLK_QUANT|MPEG12_MBLK_INTRA,2} , {MPEG12_MBLK_INTRA, 1}}; // Table B-3 (P-VOP) //#define MBLK_B3_1 {MPEG12_MBLK_PATTERN|MPEG12_MBLK_MFWD, 1}#define MBLK_B3_2 {MPEG12_MBLK_PATTERN, 2}#define MBLK_B3_3 {MPEG12_MBLK_MFWD, 3}#define MBLK_B3_4 {MPEG12_MBLK_INTRA, 5}#define MBLK_B3_5 {MPEG12_MBLK_PATTERN|MPEG12_MBLK_MFWD|MPEG12_MBLK_QUANT, 5}#define MBLK_B3_6 {MPEG12_MBLK_PATTERN|MPEG12_MBLK_QUANT, 5}#define MBLK_B3_7 {MPEG12_MBLK_INTRA|MPEG12_MBLK_QUANT, 6}static const SKL_VLC MBlk_Type_B_3[] = { MBLK_B3_7, MBLK_B3_6, MBLK_B3_5, MBLK_B3_4, MBLK_B3_3, MBLK_B3_3, MBLK_B3_3, MBLK_B3_3, MBLK_B3_2, MBLK_B3_2, MBLK_B3_2, MBLK_B3_2, MBLK_B3_2, MBLK_B3_2, MBLK_B3_2, MBLK_B3_2, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1, MBLK_B3_1}; // Table B-4 (B-VOP) //#define MBLK_B4_1 {MPEG12_MBLK_PATTERN|MPEG12_MBLK_MFWD|MPEG12_MBLK_MBWD, 2}#define MBLK_B4_2 {MPEG12_MBLK_MFWD|MPEG12_MBLK_MBWD, 2}#define MBLK_B4_3 {MPEG12_MBLK_PATTERN|MPEG12_MBLK_MBWD, 3}#define MBLK_B4_4 {MPEG12_MBLK_MBWD, 3}#define MBLK_B4_5 {MPEG12_MBLK_PATTERN|MPEG12_MBLK_MFWD, 4}#define MBLK_B4_6 {MPEG12_MBLK_MFWD, 4}#define MBLK_B4_7 {MPEG12_MBLK_INTRA, 5}#define MBLK_B4_8 {MPEG12_MBLK_PATTERN|MPEG12_MBLK_MFWD|MPEG12_MBLK_MBWD|MPEG12_MBLK_QUANT, 5}#define MBLK_B4_9 {MPEG12_MBLK_PATTERN|MPEG12_MBLK_MFWD|MPEG12_MBLK_QUANT, 6}#define MBLK_B4_10 {MPEG12_MBLK_PATTERN|MPEG12_MBLK_MBWD|MPEG12_MBLK_QUANT, 6}#define MBLK_B4_11 {MPEG12_MBLK_INTRA|MPEG12_MBLK_QUANT, 6}static const SKL_VLC MBlk_Type_B_4[] = { MBLK_ERROR, MBLK_B4_11, MBLK_B4_10, MBLK_B4_9, MBLK_B4_8, MBLK_B4_8, MBLK_B4_7, MBLK_B4_7, MBLK_B4_6, MBLK_B4_6, MBLK_B4_6, MBLK_B4_6, MBLK_B4_5, MBLK_B4_5, MBLK_B4_5, MBLK_B4_5, MBLK_B4_4, MBLK_B4_4, MBLK_B4_4, MBLK_B4_4, MBLK_B4_4, MBLK_B4_4, MBLK_B4_4, MBLK_B4_4, MBLK_B4_3, MBLK_B4_3, MBLK_B4_3, MBLK_B4_3, MBLK_B4_3, MBLK_B4_3, MBLK_B4_3, MBLK_B4_3, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_2, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1, MBLK_B4_1}; // Special for old D-Framesstatic const SKL_VLC MBlk_Type_B_D_Frame[] = { { MPEG12_MBLK_INTRA, 1 }, { MPEG12_MBLK_INTRA, 1 }};//////////////////////////////////////////////////////////static const SKL_VLC * const MBlk_Type_Tabs[4] = { MBlk_Type_B_2, MBlk_Type_B_3, MBlk_Type_B_4, MBlk_Type_B_D_Frame,};static const int MBlk_Type_Tabs_Bitsize[4] = { 1, 5, 6, 1 };static int Read_MBlk_Type(SKL_FBB *FBB, int Coding){ SKL_ASSERT(Coding>=I_VOP && Coding<=D_VOP); int Bits = FBB->See_Bits( MBlk_Type_Tabs_Bitsize[Coding] ); const SKL_VLC *vlc = MBlk_Type_Tabs[Coding]; FBB->Discard( vlc[Bits].Len ); return vlc[Bits].Value;}//////////////////////////////////////////////////////////// Coded block pattern// ISO/IEC 13818-2 section 6.2.5// Table B-9static const SKL_VLC Tab_B9_1[24] = { {62, 5},{ 2, 5},{61, 5},{ 1, 5},{56, 5},{52, 5},{44, 5},{28, 5}, {40, 5},{20, 5},{48, 5},{12, 5},{32, 4},{32, 4},{16, 4},{16, 4}, { 8, 4},{ 8, 4},{ 4, 4},{ 4, 4},{60, 3},{60, 3},{60, 3},{60, 3}};static const SKL_VLC Tab_B9_2[16] = { {34, 7},{18, 7},{10, 7},{ 6, 7},{33, 7},{17, 7},{ 9, 7},{ 5, 7}, {63, 6},{63, 6},{ 3, 6},{ 3, 6},{36, 6},{36, 6},{24, 6},{24, 6}};static const SKL_VLC Tab_B9_3[63] = { { 0, 9},{39, 9},{27, 9},{59, 9},{55, 9},{47, 9},{31, 9}, {58, 8},{58, 8},{54, 8},{54, 8},{46, 8},{46, 8},{30, 8},{30, 8}, {57, 8},{57, 8},{53, 8},{53, 8},{45, 8},{45, 8},{29, 8},{29, 8}, {38, 8},{38, 8},{26, 8},{26, 8},{37, 8},{37, 8},{25, 8},{25, 8}, {43, 8},{43, 8},{23, 8},{23, 8},{51, 8},{51, 8},{15, 8},{15, 8}, {42, 8},{42, 8},{22, 8},{22, 8},{50, 8},{50, 8},{14, 8},{14, 8}, {41, 8},{41, 8},{21, 8},{21, 8},{49, 8},{49, 8},{13, 8},{13, 8}, {35, 8},{35, 8},{19, 8},{19, 8},{11, 8},{11, 8},{ 7, 8},{ 7, 8}};static const SKL_VLC_CHUNK CBP_Tab_Chunks[] = { /* bSize=9 (total size=103)*/ { Tab_B9_1 - 8, 128, 4 }, /* bLen=5 min=0x80 Max=0x1cf */ { Tab_B9_2 - 16, 64, 2 }, /* bLen=7 min=0x40 Max=0x7b */ { Tab_B9_3 - 1, 1, 0 }, /* bLen=9 min=0x1 Max=0x3e */ {0,0}};static int Read_Coded_Block_Pattern(SKL_FBB *FBB){ int Bits = FBB->See_Bits( 9 ); const SKL_VLC *vlc = Skl_VLC_Search( CBP_Tab_Chunks, Bits ); FBB->Discard(vlc->Len); return vlc->Value;}//////////////////////////////////////////////////////////// DC-Size tables (B-12 / B-13)////////////////////////////////////////////////////////// // Lum-DC-Size Table B-12 (genhufftab 2 3 2) // Note: This table is coded for 10bits input code (instead of 9bits in the norm). // With this, we have the same loop for decoding both Lum or Chroma. // => we shift by 1 before final look-up. /* bLen=5 minCode=b00000xxxx maxCode=b11110xxxx (0x0/0x1ef) */static const SKL_VLC Tab_B12_1[31] = { { 1, 2},{ 1, 2},{ 1, 2},{ 1, 2},{ 1, 2},{ 1, 2},{ 1, 2},{ 1, 2}, { 2, 2},{ 2, 2},{ 2, 2},{ 2, 2},{ 2, 2},{ 2, 2},{ 2, 2},{ 2, 2}, { 0, 3},{ 0, 3},{ 0, 3},{ 0, 3},{ 3, 3},{ 3, 3},{ 3, 3},{ 3, 3}, { 4, 3},{ 4, 3},{ 4, 3},{ 4, 3},{ 5, 4},{ 5, 4},{ 6, 5}}; /* bLen=9 minCode=b111110000 maxCode=b111111111 (0x1f0/0x1ff) */static const SKL_VLC Tab_B12_3[16] = { { 7, 6},{ 7, 6},{ 7, 6},{ 7, 6},{ 7, 6},{ 7, 6},{ 7, 6},{ 7, 6}, { 8, 7},{ 8, 7},{ 8, 7},{ 8, 7},{ 9, 8},{ 9, 8},{10, 9},{11, 9}};static const SKL_VLC_CHUNK DC_Size_Chunks_Lum[] = { /* bSize=9 (total size=47)*/ { Tab_B12_3 - 0x1f0, (0x1f0<<1), 0+1 }, { Tab_B12_1 - 0x0, 0x0, 4+1 }, {0,0}}; // Chroma-DC-Size table B-13 (genhufftab 2 3 2) /* bLen=5 minCode=b00000xxxxx maxCode=b11110xxxxx (0x0/0x3df) */static const SKL_VLC Tab_B13_1[31] = { { 0, 2},{ 0, 2},{ 0, 2},{ 0, 2},{ 0, 2},{ 0, 2},{ 0, 2},{ 0, 2}, { 1, 2},{ 1, 2},{ 1, 2},{ 1, 2},{ 1, 2},{ 1, 2},{ 1, 2},{ 1, 2}, { 2, 2},{ 2, 2},{ 2, 2},{ 2, 2},{ 2, 2},{ 2, 2},{ 2, 2},{ 2, 2}, { 3, 3},{ 3, 3},{ 3, 3},{ 3, 3},{ 4, 4},{ 4, 4},{ 5, 5}}; /* bLen=10 minCode=b1111100000 maxCode=b1111111111 (0x3e0/0x3ff) */static const SKL_VLC Tab_B13_3[32] = { { 6, 6},{ 6, 6},{ 6, 6},{ 6, 6},{ 6, 6},{ 6, 6},{ 6, 6},{ 6, 6}, { 6, 6},{ 6, 6},{ 6, 6},{ 6, 6},{ 6, 6},{ 6, 6},{ 6, 6},{ 6, 6}, { 7, 7},{ 7, 7},{ 7, 7},{ 7, 7},{ 7, 7},{ 7, 7},{ 7, 7},{ 7, 7}, { 8, 8},{ 8, 8},{ 8, 8},{ 8, 8},{ 9, 9},{ 9, 9},{10,10},{11,10}};static const SKL_VLC_CHUNK DC_Size_Chunks_Chroma[] = { /* bSize=10 (total size=63)*/ { Tab_B13_3 - 0x3e0, 0x3e0, 0 }, { Tab_B13_1 - 0x0, 0x0, 5 }, {0,0}};//////////////////////////////////////////////////////////// DCT B-14/B-15 flavored tables//////////////////////////////////////////////////////////// B14-DC: genhufftab -s -v4 -n 26 5 8 10 13 15 16// B14-AC: genhufftab -s -v4 -n 27 5 8 10 13 15 16// B15-AC: genhufftab -s -v4 -n 28 5 8 10 13 15 16// (Official table: genhufftab 4 2 2 2 1 1 1 1 1) // Table B-14 for AC Coeffs#define ESC {-1,0,6}#define EOB {64,0,2} /* bLen=5 minCode=b00101xxxxxxxxxxx maxCode=b11000xxxxxxxxxxx (0x2800/0xc7ff) */static const SKL_DCT_VLC Tab_B14_AC_0[27] = { { 0, 3, 5},{ 4, 1, 5},{ 3, 1, 5}, { 0, 2, 4},{ 0, 2, 4},{ 2, 1, 4},{ 2, 1, 4},{ 1, 1, 3},{ 1, 1, 3},{ 1, 1, 3},{ 1, 1, 3}, EOB, EOB, EOB, EOB, EOB, EOB, EOB, EOB, { 0, 1, 2},{ 0, 1, 2},{ 0, 1, 2},{ 0, 1, 2},{ 0, 1, 2},{ 0, 1, 2},{ 0, 1, 2},{ 0, 1, 2}}; /* bLen=8 minCode=b00000100xxxxxxxx maxCode=b00100111xxxxxxxx (0x400/0x27ff) */static const SKL_DCT_VLC Tab_B14_AC_1[36] = { ESC, ESC, ESC, ESC, { 2, 2, 7},{ 2, 2, 7},{ 9, 1, 7},{ 9, 1, 7},{ 0, 4, 7},{ 0, 4, 7},{ 8, 1, 7},{ 8, 1, 7}, { 7, 1, 6},{ 7, 1, 6},{ 7, 1, 6},{ 7, 1, 6},{ 6, 1, 6},{ 6, 1, 6},{ 6, 1, 6},{ 6, 1, 6}, { 1, 2, 6},{ 1, 2, 6},{ 1, 2, 6},{ 1, 2, 6},{ 5, 1, 6},{ 5, 1, 6},{ 5, 1, 6},{ 5, 1, 6}, {13, 1, 8},{ 0, 6, 8},{12, 1, 8},{11, 1, 8},{ 3, 2, 8},{ 1, 3, 8},{ 0, 5, 8},{10, 1, 8}}; /* bLen=10 minCode=b0000001000xxxxxx maxCode=b0000001111xxxxxx (0x200/0x3ff) */static const SKL_DCT_VLC Tab_B14_AC_2[8] = { {16, 1,10},{ 5, 2,10},{ 0, 7,10},{ 2, 3,10},{ 1, 4,10},{15, 1,10},{14, 1,10},{ 4, 2,10}}; /* bLen=13 minCode=b0000000010000xxx maxCode=b0000000111110xxx (0x80/0x1f7) */static const SKL_DCT_VLC Tab_B14_AC_3[48] = { {10, 2,13},{ 9, 2,13},{ 5, 3,13},{ 3, 4,13},{ 2, 5,13},{ 1, 7,13},{ 1, 6,13},{ 0,15,13}, { 0,14,13},{ 0,13,13},{ 0,12,13},{26, 1,13},{25, 1,13},{24, 1,13},{23, 1,13},{22, 1,13}, { 0,11,12},{ 0,11,12},{ 8, 2,12},{ 8, 2,12},{ 4, 3,12},{ 4, 3,12},{ 0,10,12},{ 0,10,12}, { 2, 4,12},{ 2, 4,12},{ 7, 2,12},{ 7, 2,12},{21, 1,12},{21, 1,12},{20, 1,12},{20, 1,12}, { 0, 9,12},{ 0, 9,12},{19, 1,12},{19, 1,12},{18, 1,12},{18, 1,12},{ 1, 5,12},{ 1, 5,12}, { 3, 3,12},{ 3, 3,12},{ 0, 8,12},{ 0, 8,12},{ 6, 2,12},{ 6, 2,12},{17, 1,12},{17, 1,12}}; /* bLen=15 minCode=b000000000010000x maxCode=b000000000111110x (0x20/0x7d) */static const SKL_DCT_VLC Tab_B14_AC_4[48] = { { 0,40,15},{ 0,39,15},{ 0,38,15},{ 0,37,15},{ 0,36,15},{ 0,35,15},{ 0,34,15},{ 0,33,15}, { 0,32,15},{ 1,14,15},{ 1,13,15},{ 1,12,15},{ 1,11,15},{ 1,10,15},{ 1, 9,15},{ 1, 8,15}, { 0,31,14},{ 0,31,14},{ 0,30,14},{ 0,30,14},{ 0,29,14},{ 0,29,14},{ 0,28,14},{ 0,28,14}, { 0,27,14},{ 0,27,14},{ 0,26,14},{ 0,26,14},{ 0,25,14},{ 0,25,14},{ 0,24,14},{ 0,24,14}, { 0,23,14},{ 0,23,14},{ 0,22,14},{ 0,22,14},{ 0,21,14},{ 0,21,14},{ 0,20,14},{ 0,20,14}, { 0,19,14},{ 0,19,14},{ 0,18,14},{ 0,18,14},{ 0,17,14},{ 0,17,14},{ 0,16,14},{ 0,16,14}}; /* bLen=16 minCode=b0000000000010000 maxCode=b0000000000011111 (0x10/0x1f) */static const SKL_DCT_VLC Tab_B14_AC_5[16] = { { 1,18,16},{ 1,17,16},{ 1,16,16},{ 1,15,16},{ 6, 3,16},{16, 2,16},{15, 2,16},{14, 2,16}, {13, 2,16},{12, 2,16},{11, 2,16},{31, 1,16},{30, 1,16},{29, 1,16},{28, 1,16},{27, 1,16}}; // Modified B-14 for DC Coeff in Inter only /* bLen=5 minCode=b00101xxxxxxxxxxx maxCode=b10000xxxxxxxxxxx (0x2800/0x87ff) */static const SKL_DCT_VLC Tab_B14_DC_0[27] = { { 0, 3, 5},{ 4, 1, 5},{ 3, 1, 5}, { 0, 2, 4},{ 0, 2, 4},{ 2, 1, 4},{ 2, 1, 4},{ 1, 1, 3},{ 1, 1, 3},{ 1, 1, 3},{ 1, 1, 3}, { 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1}, { 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1},{ 0, 1, 1}}; // Table B-15 for Intra_VLC_Format=1#define EOB2 {64,0,4} // warning! EOB code is longer (4bits)#define NOP {0,0,64} // Note: The real official tables for B-15 are exactly the same // than B-14 (see Tab_B14_AC_3->Tab_B14_AC_5), notwithstanding // some minor unreachable NOP codes. We'll then share some B-14 // slices in B-15 search table... /* bLen=8 minCode=b00000100xxxxxxxx maxCode=b11111111xxxxxxxx (0x400/0xffff) */static const SKL_DCT_VLC Tab_B15_AC_1[252] = { ESC, ESC, ESC, ESC, { 7, 1, 7},{ 7, 1, 7},{ 8, 1, 7},{ 8, 1, 7},{ 6, 1, 7},{ 6, 1, 7},{ 2, 2, 7},{ 2, 2, 7}, { 0, 7, 6},{ 0, 7, 6},{ 0, 7, 6},{ 0, 7, 6},{ 0, 6, 6},{ 0, 6, 6},{ 0, 6, 6},{ 0, 6, 6}, { 4, 1, 6},{ 4, 1, 6},{ 4, 1, 6},{ 4, 1, 6},{ 5, 1, 6},{ 5, 1, 6},{ 5, 1, 6},{ 5, 1, 6}, { 1, 5, 8},{11, 1, 8},{ 0,11, 8},{ 0,10, 8},{13, 1, 8},{12, 1, 8},{ 3, 2, 8},{ 1, 4, 8}, { 2, 1, 5},{ 2, 1, 5},{ 2, 1, 5},{ 2, 1, 5},{ 2, 1, 5},{ 2, 1, 5},{ 2, 1, 5},{ 2, 1, 5}, { 1, 2, 5},{ 1, 2, 5},{ 1, 2, 5},{ 1, 2, 5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 0, 8, 7}, { 0, 9, 7},{ 0, 9, 7},{ 0,12, 8},{ 0,13, 8},{ 2, 3, 8},{ 4, 2, 8},{ 0,14, 8},{ 0,15, 8}}; /* bLen=10 minCode=b0000001000xxxxxx maxCode=b0000001110xxxxxx (0x200/0x3bf) */static const SKL_DCT_VLC Tab_B15_AC_2[8] = { { 5, 2, 9},{ 5, 2, 9},{14, 1, 9},{14, 1, 9},{ 2, 4,10},{16, 1,10},{15, 1, 9},{15, 1, 9}}; /* bLen=13 minCode=b0000000010000xxx maxCode=b0000000111110xxx (0x80/0x1f7) */static const SKL_DCT_VLC Tab_B15_AC_3[48] = { {10, 2,13},{ 9, 2,13},{ 5, 3,13},{ 3, 4,13},{ 2, 5,13},{ 1, 7,13},{ 1, 6,13}, NOP , NOP , NOP , NOP ,{26, 1,13},{25, 1,13},{24, 1,13},{23, 1,13},{22, 1,13}, NOP , NOP ,{ 8, 2,12},{ 8, 2,12},{ 4, 3,12},{ 4, 3,12}, NOP , NOP , NOP , NOP ,{ 7, 2,12},{ 7, 2,12},{21, 1,12},{21, 1,12},{20, 1,12},{20, 1,12}, NOP , NOP ,{19, 1,12},{19, 1,12},{18, 1,12},{18, 1,12}, NOP , NOP , { 3, 3,12},{ 3, 3,12}, NOP , NOP ,{ 6, 2,12},{ 6, 2,12},{17, 1,12},{17, 1,12}}; /* bLen=15 minCode=b000000000010000x maxCode=b000000000111110x (0x20/0x7d) */static const SKL_DCT_VLC Tab_B15_AC_4[48] = { { 0,40,15},{ 0,39,15},{ 0,38,15},{ 0,37,15},{ 0,36,15},{ 0,35,15},{ 0,34,15},{ 0,33,15}, { 0,32,15},{ 1,14,15},{ 1,13,15},{ 1,12,15},{ 1,11,15},{ 1,10,15},{ 1, 9,15},{ 1, 8,15}, { 0,31,14},{ 0,31,14},{ 0,30,14},{ 0,30,14},{ 0,29,14},{ 0,29,14},{ 0,28,14},{ 0,28,14}, { 0,27,14},{ 0,27,14},{ 0,26,14},{ 0,26,14},{ 0,25,14},{ 0,25,14},{ 0,24,14},{ 0,24,14}, { 0,23,14},{ 0,23,14},{ 0,22,14},{ 0,22,14},{ 0,21,14},{ 0,21,14},{ 0,20,14},{ 0,20,14}, { 0,19,14},{ 0,19,14},{ 0,18,14},{ 0,18,14},{ 0,17,14},{ 0,17,14},{ 0,16,14},{ 0,16,14}}; /* bLen=16 minCode=b0000000000010000 maxCode=b0000000000011111 (0x10/0x1f) */static const SKL_DCT_VLC Tab_B15_AC_5[16] = { { 1,18,16},{ 1,17,16},{ 1,16,16},{ 1,15,16},{ 6, 3,16},{16, 2,16},{15, 2,16},{14, 2,16}, {13, 2,16},{12, 2,16},{11, 2,16},{31, 1,16},{30, 1,16},{29, 1,16},{28, 1,16},{27, 1,16}};// -- Final tables // AC table for Intra_VLC_Format=0static const SKL_DCT_CHUNK B14_AC_Chunks[] = {/* bSize=16 (total size=183)*/ { Tab_B14_AC_0 - 0x5, 0x28000000, 27 }, /* nbBits:5 */ // <- contains EOB { Tab_B14_AC_1 - 0x4, 0x04000000, 24 }, /* nbBits:8 */ // <- contains ESC { Tab_B14_AC_2 - 0x8, 0x02000000, 22 }, /* nbBits:10 */ { Tab_B14_AC_3 - 0x10, 0x00800000, 19 }, /* nbBits:13 */ { Tab_B14_AC_4 - 0x10, 0x00200000, 17 }, /* nbBits:15 */ { Tab_B14_AC_5 - 0x10, 0x00100000, 16 }, /* nbBits:16 */ {0,0}}; // Modified B14 for Coeff[0][0] in Inter onlystatic const SKL_DCT_CHUNK B14_DC_Chunks[] = { /* bSize=16 (total size=183)*/ { Tab_B14_DC_0 - 0x5, 0x28000000, 27 }, /* nbBits:5 */ // <- alternative codes. no EOB { Tab_B14_AC_1 - 0x4, 0x04000000, 24 }, /* nbBits:8 */ // <- contains ESC { Tab_B14_AC_2 - 0x8, 0x02000000, 22 }, /* nbBits:10 */ { Tab_B14_AC_3 - 0x10, 0x00800000, 19 }, /* nbBits:13 */ { Tab_B14_AC_4 - 0x10, 0x00200000, 17 }, /* nbBits:15 */ { Tab_B14_AC_5 - 0x10, 0x00100000, 16 }, /* nbBits:16 */ {0,0}}; // AC table for Intra_VLC_Format=1 (MPEG-2)static const SKL_DCT_CHUNK B15_AC_Chunks[] = { /* bSize=16 (total size=380)*/ { Tab_B15_AC_1 - 0x4, 0x04000000, 24 }, /* nbBits:8 */ { Tab_B15_AC_2 - 0x8, 0x02000000, 22 }, /* nbBits:10 */ { Tab_B15_AC_3 - 0x10, 0x00800000, 19 }, /* nbBits:13 */ { Tab_B15_AC_4 - 0x10, 0x00200000, 17 }, /* nbBits:15 */ { Tab_B15_AC_5 - 0x10, 0x00100000, 16 }, /* nbBits:16 */ {0,0}};//////////////////////////////////////////////////////////// Lum-DC diff// Chunks = DC_Size_Chunks_Lum for luma decoding// = DC_Size_Chunks_Chroma for chroma decoding//static const SKL_VLC_CHUNK *DCT_Chunks[3] = { DC_Size_Chunks_Lum, DC_Size_Chunks_Chroma, DC_Size_Chunks_Chroma};static inline int Read_DC_Diff_MPEG2(SKL_FBB *FBB, const SKL_VLC_CHUNK *Chk){ int Bits = FBB->See_Bits( 10 ); const SKL_VLC *vlc = Skl_VLC_Search( Chk, Bits ); FBB->Discard(vlc->Len); int Size = vlc->Value; if (!Size) return 0; SKL_INT32 Diff = FBB->Get_Bits( Size ); if ( !(Diff & SKL_BMASKS::Or[Size]) ) Diff -= SKL_BMASKS::And[Size]; return Diff;}//////////////////////////////////////////////////////////// -- Escape valuesinline static int Read_MPEG1_Escape(SKL_FBB *FBB) { int Val = FBB->Get_Bits(8); if (Val==0) Val = FBB->Get_Bits(8); else if (Val==128) Val = FBB->Get_Bits(8) - 256; else if (Val>128) Val-=256; return Val;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -