]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/msmpeg4data.c
hevc: eliminate the last element from TransformTree
[ffmpeg] / libavcodec / msmpeg4data.c
index 8ad462c03ea0b0cee90c981c52f0eed2b810df51..cf291afc801e1ee2714ffad022fa3c29616f3f96 100644 (file)
@@ -1,60 +1,66 @@
 /*
- * MSMPEG4 backend for ffmpeg encoder and decoder
+ * MSMPEG4 backend for encoder and decoder
  * copyright (c) 2001 Fabrice Bellard
  * copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
  *
  * msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni@gmx.at>
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
- * @file msmpeg4data.c
+ * @file
  * MSMPEG4 data tables.
  */
 
+#include "h263.h"
+#include "mpeg4video.h"
 #include "msmpeg4data.h"
 
+uint32_t ff_v2_dc_lum_table[512][2];
+uint32_t ff_v2_dc_chroma_table[512][2];
+uint8_t  ff_static_rl_table_store[NB_RL_TABLES][2][2 * MAX_RUN + MAX_LEVEL + 3];
+
 VLC ff_msmp4_mb_i_vlc;
 VLC ff_msmp4_dc_luma_vlc[2];
 VLC ff_msmp4_dc_chroma_vlc[2];
 
-/* intra picture macro block coded block pattern */
+/* intra picture macroblock coded block pattern */
 const uint16_t ff_msmp4_mb_i_table[64][2] = {
-{ 0x1, 1 },{ 0x17, 6 },{ 0x9, 5 },{ 0x5, 5 },
-{ 0x6, 5 },{ 0x47, 9 },{ 0x20, 7 },{ 0x10, 7 },
-{ 0x2, 5 },{ 0x7c, 9 },{ 0x3a, 7 },{ 0x1d, 7 },
-{ 0x2, 6 },{ 0xec, 9 },{ 0x77, 8 },{ 0x0, 8 },
-{ 0x3, 5 },{ 0xb7, 9 },{ 0x2c, 7 },{ 0x13, 7 },
-{ 0x1, 6 },{ 0x168, 10 },{ 0x46, 8 },{ 0x3f, 8 },
-{ 0x1e, 6 },{ 0x712, 13 },{ 0xb5, 9 },{ 0x42, 8 },
-{ 0x22, 7 },{ 0x1c5, 11 },{ 0x11e, 10 },{ 0x87, 9 },
-{ 0x6, 4 },{ 0x3, 9 },{ 0x1e, 7 },{ 0x1c, 6 },
-{ 0x12, 7 },{ 0x388, 12 },{ 0x44, 9 },{ 0x70, 9 },
-{ 0x1f, 6 },{ 0x23e, 11 },{ 0x39, 8 },{ 0x8e, 9 },
-{ 0x1, 7 },{ 0x1c6, 11 },{ 0xb6, 9 },{ 0x45, 9 },
-{ 0x14, 6 },{ 0x23f, 11 },{ 0x7d, 9 },{ 0x18, 9 },
-{ 0x7, 7 },{ 0x1c7, 11 },{ 0x86, 9 },{ 0x19, 9 },
-{ 0x15, 6 },{ 0x1db, 10 },{ 0x2, 9 },{ 0x46, 9 },
-{ 0xd, 8 },{ 0x713, 13 },{ 0x1da, 10 },{ 0x169, 10 },
+{  0x1, 1 },{  0x17,  6 },{   0x9,  5 },{   0x5,  5 },
+{  0x6, 5 },{  0x47,  9 },{  0x20,  7 },{  0x10,  7 },
+{  0x2, 5 },{  0x7c,  9 },{  0x3a,  7 },{  0x1d,  7 },
+{  0x2, 6 },{  0xec,  9 },{  0x77,  8 },{   0x0,  8 },
+{  0x3, 5 },{  0xb7,  9 },{  0x2c,  7 },{  0x13,  7 },
+{  0x1, 6 },{ 0x168, 10 },{  0x46,  8 },{  0x3f,  8 },
+{ 0x1e, 6 },{ 0x712, 13 },{  0xb5,  9 },{  0x42,  8 },
+{ 0x22, 7 },{ 0x1c5, 11 },{ 0x11e, 10 },{  0x87,  9 },
+{  0x6, 4 },{   0x3,  9 },{  0x1e,  7 },{  0x1c,  6 },
+{ 0x12, 7 },{ 0x388, 12 },{  0x44,  9 },{  0x70,  9 },
+{ 0x1f, 6 },{ 0x23e, 11 },{  0x39,  8 },{  0x8e,  9 },
+{  0x1, 7 },{ 0x1c6, 11 },{  0xb6,  9 },{  0x45,  9 },
+{ 0x14, 6 },{ 0x23f, 11 },{  0x7d,  9 },{  0x18,  9 },
+{  0x7, 7 },{ 0x1c7, 11 },{  0x86,  9 },{  0x19,  9 },
+{ 0x15, 6 },{ 0x1db, 10 },{   0x2,  9 },{  0x46,  9 },
+{  0xd, 8 },{ 0x713, 13 },{ 0x1da, 10 },{ 0x169, 10 },
 };
 
-/* non intra picture macro block coded block pattern + mb type */
-const uint32_t table_mb_non_intra[128][2] = {
+/* non intra picture macroblock coded block pattern + mb type */
+const uint32_t ff_table_mb_non_intra[128][2] = {
 {   0x40,  7 },{   0x13c9, 13 },{   0x9fd, 12 },{   0x1fc, 15 },
 {  0x9fc, 12 },{    0xa83, 18 },{ 0x12d34, 17 },{  0x83bc, 16 },
 {  0x83a, 12 },{    0x7f8, 17 },{   0x3fd, 16 },{   0x3ff, 16 },
@@ -304,7 +310,7 @@ static const int8_t table0_run[132] = {
  23, 24, 25, 26,
 };
 
-/* vlc table 1, for intra chroma and P macro blocks */
+/* vlc table 1, for intra chroma and P macroblocks */
 
 static const uint16_t table1_vlc[149][2] = {
 {    0x4,  3 },{   0x14,  5 },{   0x17,  7 },{   0x7f,  8 },
@@ -592,15 +598,7 @@ static const int8_t table4_run[168] = {
  29, 30, 31, 32, 33, 34, 35, 36,
 };
 
-extern const uint16_t inter_vlc[103][2];
-extern const int8_t inter_level[102];
-extern const int8_t inter_run[102];
-
-extern const uint16_t intra_vlc[103][2];
-extern const int8_t intra_level[102];
-extern const int8_t intra_run[102];
-
-RLTable rl_table[NB_RL_TABLES] = {
+RLTable ff_rl_table[NB_RL_TABLES] = {
     /* intra luminance tables */
     /* low motion  */
     {
@@ -622,9 +620,9 @@ RLTable rl_table[NB_RL_TABLES] = {
     {
         102,
         67,
-        intra_vlc,
-        intra_run,
-        intra_level,
+        ff_mpeg4_intra_vlc,
+        ff_mpeg4_intra_run,
+        ff_mpeg4_intra_level,
     },
     /* intra chrominance / non intra tables */
     /* low motion inter */
@@ -647,9 +645,9 @@ RLTable rl_table[NB_RL_TABLES] = {
     {
         102,
         58,
-        inter_vlc,
-        inter_run,
-        inter_level,
+        ff_inter_vlc,
+        ff_inter_run,
+        ff_inter_level,
     },
 };
 
@@ -1784,7 +1782,7 @@ static const uint8_t table1_mvy[1099] = {
  34, 28, 21,
 };
 
-MVTable mv_tables[2] = {
+MVTable ff_mv_tables[2] = {
     {
         1099,
         table0_mv_code,
@@ -1801,34 +1799,30 @@ MVTable mv_tables[2] = {
     }
 };
 
-const uint8_t v2_mb_type[8][2] = {
+const uint8_t ff_v2_mb_type[8][2] = {
  {1, 1}, {0   , 2}, {3   , 3}, {9   , 5},
  {5, 4}, {0x21, 7}, {0x20, 7}, {0x11, 6},
 };
 
-const uint8_t v2_intra_cbpc[4][2] = {
+const uint8_t ff_v2_intra_cbpc[4][2] = {
  {1, 1}, {0, 3}, {1, 3}, {1, 2},
 };
 
-const uint8_t wmv1_y_dc_scale_table[32]={
+const uint8_t ff_wmv1_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, 8, 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
 };
-const uint8_t wmv1_c_dc_scale_table[32]={
+const uint8_t ff_wmv1_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 old_ff_y_dc_scale_table[32]={
+const uint8_t ff_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, 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 ff_wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={
   {
     0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11,
     0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28,
@@ -1871,7 +1865,7 @@ const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={
   }
 };
 
-const uint8_t table_inter_intra[4][2]={
+const uint8_t ff_table_inter_intra[4][2]={
     {0,1} /*Luma-Left Chroma-Left*/,
     {2,2} /*Luma-Top  Chroma-Left*/,
     {6,3} /*luma-Left Chroma-Top */,
@@ -1983,21 +1977,21 @@ static const uint32_t table_mb_non_intra4[128][2] = {
 {0x000011,  5}, {0x0001AC,  9}, {0x0000F3,  8}, {0x000439, 11},
 };
 
-const uint32_t (*wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2]={
+const uint32_t (* const ff_wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2]={
     table_mb_non_intra2,
     table_mb_non_intra3,
     table_mb_non_intra4,
-    table_mb_non_intra,
+    ff_table_mb_non_intra,
 };
 
-const uint8_t wmv2_scantableA[64]={
+const uint8_t ff_wmv2_scantableA[64]={
 0x00, 0x01, 0x02, 0x08, 0x03, 0x09, 0x0A, 0x10,
 0x04, 0x0B, 0x11, 0x18, 0x12, 0x0C, 0x05, 0x13,
 0x19, 0x0D, 0x14, 0x1A, 0x1B, 0x06, 0x15, 0x1C,
 0x0E, 0x16, 0x1D, 0x07, 0x1E, 0x0F, 0x17, 0x1F,
 };
 
-const uint8_t wmv2_scantableB[64]={
+const uint8_t ff_wmv2_scantableB[64]={
 0x00, 0x08, 0x01, 0x10, 0x09, 0x18, 0x11, 0x02,
 0x20, 0x0A, 0x19, 0x28, 0x12, 0x30, 0x21, 0x1A,
 0x38, 0x29, 0x22, 0x03, 0x31, 0x39, 0x0B, 0x2A,