X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpeg4data.h;h=87bb5391b14c000cb70c29611b318442e937dadf;hb=9f99a5f1d078721a30a76aec27c58805b7b87e58;hp=0ceef90b7a85a81edbefd97ef7ace3b7b8bd5e16;hpb=c26ae41db21d6a7d5092b3cb51ce2e4866b076ae;p=ffmpeg diff --git a/libavcodec/mpeg4data.h b/libavcodec/mpeg4data.h index 0ceef90b7a8..87bb5391b14 100644 --- a/libavcodec/mpeg4data.h +++ b/libavcodec/mpeg4data.h @@ -1,59 +1,50 @@ +/* + * copyright (c) 2000,2001 Fabrice Bellard + * H263+ support + * copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of Libav. + * + * 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. + * + * 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** - * @file mpeg4data.h + * @file * mpeg4 tables. */ -// shapes -#define RECT_SHAPE 0 -#define BIN_SHAPE 1 -#define BIN_ONLY_SHAPE 2 -#define GRAY_SHAPE 3 - -#define SIMPLE_VO_TYPE 1 -#define CORE_VO_TYPE 3 -#define MAIN_VO_TYPE 4 -#define NBIT_VO_TYPE 5 -#define ARTS_VO_TYPE 10 -#define ACE_VO_TYPE 12 -#define ADV_SIMPLE_VO_TYPE 17 - -// aspect_ratio_info -#define EXTENDED_PAR 15 +#ifndef AVCODEC_MPEG4DATA_H +#define AVCODEC_MPEG4DATA_H -//vol_sprite_usage / sprite_enable -#define STATIC_SPRITE 1 -#define GMC_SPRITE 2 - -#define MOTION_MARKER 0x1F001 -#define DC_MARKER 0x6B001 - -static const int mb_type_b_map[4]= { - MB_TYPE_DIRECT2 | MB_TYPE_L0L1, - MB_TYPE_L0L1 | MB_TYPE_16x16, - MB_TYPE_L1 | MB_TYPE_16x16, - MB_TYPE_L0 | MB_TYPE_16x16, -}; - -#define VOS_STARTCODE 0x1B0 -#define USER_DATA_STARTCODE 0x1B2 -#define GOP_STARTCODE 0x1B3 -#define VISUAL_OBJ_STARTCODE 0x1B5 -#define VOP_STARTCODE 0x1B6 +#include +#include "mpegvideo.h" /* dc encoding for mpeg4 */ -const uint8_t DCtab_lum[13][2] = +const uint8_t ff_mpeg4_DCtab_lum[13][2] = { {3,3}, {3,2}, {2,2}, {2,3}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, {1,8}, {1,9}, {1,10}, {1,11}, -}; +}; -const uint8_t DCtab_chrom[13][2] = +const uint8_t ff_mpeg4_DCtab_chrom[13][2] = { {3,2}, {2,2}, {1,2}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, {1,8}, {1,9}, {1,10}, {1,11}, {1,12}, -}; +}; -const uint16_t intra_vlc[103][2] = { +const uint16_t ff_mpeg4_intra_vlc[103][2] = { { 0x2, 2 }, { 0x6, 3 },{ 0xf, 4 },{ 0xd, 5 },{ 0xc, 5 }, { 0x15, 6 },{ 0x13, 6 },{ 0x12, 6 },{ 0x17, 7 }, @@ -83,7 +74,7 @@ const uint16_t intra_vlc[103][2] = { { 0x5f, 12 },{ 0x3, 7 }, }; -const int8_t intra_level[102] = { +const int8_t ff_mpeg4_intra_level[102] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, @@ -99,7 +90,7 @@ const int8_t intra_level[102] = { 1, 1, 1, 1, 1, 1, }; -const int8_t intra_run[102] = { +const int8_t ff_mpeg4_intra_run[102] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -115,15 +106,16 @@ const int8_t intra_run[102] = { 15, 16, 17, 18, 19, 20, }; -static RLTable rl_intra = { +RLTable ff_mpeg4_rl_intra = { 102, 67, - intra_vlc, - intra_run, - intra_level, + ff_mpeg4_intra_vlc, + ff_mpeg4_intra_run, + ff_mpeg4_intra_level, }; -static const uint16_t inter_rvlc[170][2]={ //note this is identical to the intra rvlc except that its reordered +/* Note this is identical to the intra rvlc except that it is reordered. */ +static const uint16_t inter_rvlc[170][2]={ {0x0006, 3},{0x0001, 4},{0x0004, 5},{0x001C, 7}, {0x003C, 8},{0x003D, 8},{0x007C, 9},{0x00FC, 10}, {0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12}, @@ -169,57 +161,57 @@ static const uint16_t inter_rvlc[170][2]={ //note this is identical to the intra {0x3F7C, 15},{0x3F7D, 15},{0x0000, 4} }; -static const uint8_t inter_rvlc_run[169]={ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 2, 2, - 2, 2, 2, 2, 3, 3, 3, 3, - 3, 3, 3, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 6, 6, 6, 6, - 7, 7, 7, 7, 8, 8, 8, 9, - 9, 9, 10, 10, 11, 11, 12, 12, -13, 13, 14, 14, 15, 15, 16, 16, -17, 17, 18, 19, 20, 21, 22, 23, -24, 25, 26, 27, 28, 29, 30, 31, -32, 33, 34, 35, 36, 37, 38, - 0, 0, 0, 0, 0, 1, 1, 1, - 1, 1, 2, 2, 2, 3, 3, 4, - 4, 5, 5, 6, 6, 7, 7, 8, - 8, 9, 9, 10, 10, 11, 11, 12, -12, 13, 13, 14, 15, 16, 17, 18, -19, 20, 21, 22, 23, 24, 25, 26, -27, 28, 29, 30, 31, 32, 33, 34, -35, 36, 37, 38, 39, 40, 41, 42, -43, 44, +static const int8_t inter_rvlc_run[169]={ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 2, 2, + 2, 2, 2, 2, 3, 3, 3, 3, + 3, 3, 3, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 8, 8, 9, + 9, 9, 10, 10, 11, 11, 12, 12, +13, 13, 14, 14, 15, 15, 16, 16, +17, 17, 18, 19, 20, 21, 22, 23, +24, 25, 26, 27, 28, 29, 30, 31, +32, 33, 34, 35, 36, 37, 38, + 0, 0, 0, 0, 0, 1, 1, 1, + 1, 1, 2, 2, 2, 3, 3, 4, + 4, 5, 5, 6, 6, 7, 7, 8, + 8, 9, 9, 10, 10, 11, 11, 12, +12, 13, 13, 14, 15, 16, 17, 18, +19, 20, 21, 22, 23, 24, 25, 26, +27, 28, 29, 30, 31, 32, 33, 34, +35, 36, 37, 38, 39, 40, 41, 42, +43, 44, }; -static const uint8_t inter_rvlc_level[169]={ - 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, -17, 18, 19, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 1, 2, 3, - 4, 5, 6, 7, 1, 2, 3, 4, - 5, 6, 7, 1, 2, 3, 4, 5, - 1, 2, 3, 4, 1, 2, 3, 4, - 1, 2, 3, 4, 1, 2, 3, 1, - 2, 3, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, - 1, 2, 3, 4, 5, 1, 2, 3, - 4, 5, 1, 2, 3, 1, 2, 1, - 2, 1, 2, 1, 2, 1, 2, 1, - 2, 1, 2, 1, 2, 1, 2, 1, - 2, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, +static const int8_t inter_rvlc_level[169]={ + 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, +17, 18, 19, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 1, 2, 3, + 4, 5, 6, 7, 1, 2, 3, 4, + 5, 6, 7, 1, 2, 3, 4, 5, + 1, 2, 3, 4, 1, 2, 3, 4, + 1, 2, 3, 4, 1, 2, 3, 1, + 2, 3, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, + 1, 2, 3, 4, 5, 1, 2, 3, + 4, 5, 1, 2, 3, 1, 2, 1, + 2, 1, 2, 1, 2, 1, 2, 1, + 2, 1, 2, 1, 2, 1, 2, 1, + 2, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, }; -static RLTable rvlc_rl_inter = { +RLTable ff_rvlc_rl_inter = { 169, 103, inter_rvlc, @@ -273,57 +265,57 @@ static const uint16_t intra_rvlc[170][2]={ {0x3F7C, 15},{0x3F7D, 15},{0x0000, 4} }; -static const uint8_t intra_rvlc_run[169]={ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 4, 4, 4, 4, - 4, 4, 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 7, 7, 7, - 7, 7, 8, 8, 8, 8, 9, 9, - 9, 9, 10, 10, 11, 11, 12, 12, -13, 14, 15, 16, 17, 18, 19, - 0, 0, 0, 0, 0, 1, 1, 1, - 1, 1, 2, 2, 2, 3, 3, 4, - 4, 5, 5, 6, 6, 7, 7, 8, - 8, 9, 9, 10, 10, 11, 11, 12, -12, 13, 13, 14, 15, 16, 17, 18, -19, 20, 21, 22, 23, 24, 25, 26, -27, 28, 29, 30, 31, 32, 33, 34, -35, 36, 37, 38, 39, 40, 41, 42, -43, 44, +static const int8_t intra_rvlc_run[169]={ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 4, 4, 4, 4, + 4, 4, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 7, 7, 7, + 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 10, 10, 11, 11, 12, 12, +13, 14, 15, 16, 17, 18, 19, + 0, 0, 0, 0, 0, 1, 1, 1, + 1, 1, 2, 2, 2, 3, 3, 4, + 4, 5, 5, 6, 6, 7, 7, 8, + 8, 9, 9, 10, 10, 11, 11, 12, +12, 13, 13, 14, 15, 16, 17, 18, +19, 20, 21, 22, 23, 24, 25, 26, +27, 28, 29, 30, 31, 32, 33, 34, +35, 36, 37, 38, 39, 40, 41, 42, +43, 44, }; -static const uint8_t intra_rvlc_level[169]={ - 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, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, - 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 1, 2, 3, 4, - 5, 6, 1, 2, 3, 4, 5, 6, - 1, 2, 3, 4, 5, 1, 2, 3, - 4, 5, 1, 2, 3, 4, 1, 2, - 3, 4, 1, 2, 1, 2, 1, 2, - 1, 1, 1, 1, 1, 1, 1, - 1, 2, 3, 4, 5, 1, 2, 3, - 4, 5, 1, 2, 3, 1, 2, 1, - 2, 1, 2, 1, 2, 1, 2, 1, - 2, 1, 2, 1, 2, 1, 2, 1, - 2, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, +static const int8_t intra_rvlc_level[169]={ + 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, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, + 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 1, 2, 3, 4, + 5, 6, 1, 2, 3, 4, 5, 6, + 1, 2, 3, 4, 5, 1, 2, 3, + 4, 5, 1, 2, 3, 4, 1, 2, + 3, 4, 1, 2, 1, 2, 1, 2, + 1, 1, 1, 1, 1, 1, 1, + 1, 2, 3, 4, 5, 1, 2, 3, + 4, 5, 1, 2, 3, 1, 2, 1, + 2, 1, 2, 1, 2, 1, 2, 1, + 2, 1, 2, 1, 2, 1, 2, 1, + 2, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, }; -static RLTable rvlc_rl_intra = { +RLTable ff_rvlc_rl_intra = { 169, 103, intra_rvlc, @@ -331,35 +323,16 @@ static RLTable rvlc_rl_intra = { intra_rvlc_level, }; -static const uint16_t sprite_trajectory_tab[15][2] = { +const uint16_t ff_sprite_trajectory_tab[15][2] = { {0x00, 2}, {0x02, 3}, {0x03, 3}, {0x04, 3}, {0x05, 3}, {0x06, 3}, - {0x0E, 4}, {0x1E, 5}, {0x3E, 6}, {0x7E, 7}, {0xFE, 8}, + {0x0E, 4}, {0x1E, 5}, {0x3E, 6}, {0x7E, 7}, {0xFE, 8}, {0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12}, }; -static const uint8_t mb_type_b_tab[4][2] = { +const uint8_t ff_mb_type_b_tab[4][2] = { {1, 1}, {1, 2}, {1, 3}, {1, 4}, }; -static const AVRational pixel_aspect[16]={ - {0, 1}, - {1, 1}, - {12, 11}, - {10, 11}, - {16, 11}, - {40, 33}, - {0, 1}, - {0, 1}, - {0, 1}, - {0, 1}, - {0, 1}, - {0, 1}, - {0, 1}, - {0, 1}, - {0, 1}, - {0, 1}, -}; - /* these matrixes will be permuted for the idct */ const int16_t ff_mpeg4_default_intra_matrix[64] = { 8, 17, 18, 19, 21, 23, 25, 27, @@ -369,7 +342,7 @@ const int16_t ff_mpeg4_default_intra_matrix[64] = { 22, 23, 24, 26, 28, 30, 32, 35, 23, 24, 26, 28, 30, 32, 35, 38, 25, 26, 28, 30, 32, 35, 38, 41, - 27, 28, 30, 32, 35, 38, 41, 45, + 27, 28, 30, 32, 35, 38, 41, 45, }; const int16_t ff_mpeg4_default_non_intra_matrix[64] = { @@ -396,6 +369,8 @@ const uint16_t ff_mpeg4_resync_prefix[8]={ 0x7F00, 0x7E00, 0x7C00, 0x7800, 0x7000, 0x6000, 0x4000, 0x0000 }; -static const uint8_t mpeg4_dc_threshold[8]={ +const uint8_t ff_mpeg4_dc_threshold[8]={ 99, 13, 15, 17, 19, 21, 23, 0 }; + +#endif /* AVCODEC_MPEG4DATA_H */