FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h264data.h
Go to the documentation of this file.
1 /*
2  * H26L/H264/AVC/JVT/14496-10/... encoder/decoder
3  * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * @brief
25  * H264 / AVC / MPEG4 part10 codec data table
26  * @author Michael Niedermayer <michaelni@gmx.at>
27  */
28 
29 #ifndef AVCODEC_H264DATA_H
30 #define AVCODEC_H264DATA_H
31 
32 #include <stdint.h>
33 
34 #include "libavutil/rational.h"
35 #include "h264.h"
36 
37 static const uint8_t golomb_to_pict_type[5] = {
40 };
41 
42 static const uint8_t golomb_to_intra4x4_cbp[48] = {
43  47, 31, 15, 0, 23, 27, 29, 30, 7, 11, 13, 14, 39, 43, 45, 46,
44  16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4,
45  8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41
46 };
47 
48 static const uint8_t golomb_to_inter_cbp[48] = {
49  0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13,
50  14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46,
51  17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41
52 };
53 
54 static const uint8_t zigzag_scan[16+1] = {
55  0 + 0 * 4, 1 + 0 * 4, 0 + 1 * 4, 0 + 2 * 4,
56  1 + 1 * 4, 2 + 0 * 4, 3 + 0 * 4, 2 + 1 * 4,
57  1 + 2 * 4, 0 + 3 * 4, 1 + 3 * 4, 2 + 2 * 4,
58  3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4,
59 };
60 
61 static const uint8_t chroma_dc_scan[4] = {
62  (0 + 0 * 2) * 16, (1 + 0 * 2) * 16,
63  (0 + 1 * 2) * 16, (1 + 1 * 2) * 16,
64 };
65 
66 static const uint8_t chroma422_dc_scan[8] = {
67  (0 + 0 * 2) * 16, (0 + 1 * 2) * 16,
68  (1 + 0 * 2) * 16, (0 + 2 * 2) * 16,
69  (0 + 3 * 2) * 16, (1 + 1 * 2) * 16,
70  (1 + 2 * 2) * 16, (1 + 3 * 2) * 16,
71 };
72 
73 typedef struct IMbInfo {
74  uint16_t type;
77 } IMbInfo;
78 
79 static const IMbInfo i_mb_type_info[26] = {
80  { MB_TYPE_INTRA4x4, -1, -1 },
81  { MB_TYPE_INTRA16x16, 2, 0 },
82  { MB_TYPE_INTRA16x16, 1, 0 },
83  { MB_TYPE_INTRA16x16, 0, 0 },
84  { MB_TYPE_INTRA16x16, 3, 0 },
85  { MB_TYPE_INTRA16x16, 2, 16 },
86  { MB_TYPE_INTRA16x16, 1, 16 },
87  { MB_TYPE_INTRA16x16, 0, 16 },
88  { MB_TYPE_INTRA16x16, 3, 16 },
89  { MB_TYPE_INTRA16x16, 2, 32 },
90  { MB_TYPE_INTRA16x16, 1, 32 },
91  { MB_TYPE_INTRA16x16, 0, 32 },
92  { MB_TYPE_INTRA16x16, 3, 32 },
93  { MB_TYPE_INTRA16x16, 2, 15 + 0 },
94  { MB_TYPE_INTRA16x16, 1, 15 + 0 },
95  { MB_TYPE_INTRA16x16, 0, 15 + 0 },
96  { MB_TYPE_INTRA16x16, 3, 15 + 0 },
97  { MB_TYPE_INTRA16x16, 2, 15 + 16 },
98  { MB_TYPE_INTRA16x16, 1, 15 + 16 },
99  { MB_TYPE_INTRA16x16, 0, 15 + 16 },
100  { MB_TYPE_INTRA16x16, 3, 15 + 16 },
101  { MB_TYPE_INTRA16x16, 2, 15 + 32 },
102  { MB_TYPE_INTRA16x16, 1, 15 + 32 },
103  { MB_TYPE_INTRA16x16, 0, 15 + 32 },
104  { MB_TYPE_INTRA16x16, 3, 15 + 32 },
105  { MB_TYPE_INTRA_PCM, -1, -1 },
106 };
107 
108 typedef struct PMbInfo {
109  uint16_t type;
111 } PMbInfo;
112 
113 static const PMbInfo p_mb_type_info[5] = {
114  { MB_TYPE_16x16 | MB_TYPE_P0L0, 1 },
119 };
120 
121 static const PMbInfo p_sub_mb_type_info[4] = {
122  { MB_TYPE_16x16 | MB_TYPE_P0L0, 1 },
123  { MB_TYPE_16x8 | MB_TYPE_P0L0, 2 },
124  { MB_TYPE_8x16 | MB_TYPE_P0L0, 2 },
125  { MB_TYPE_8x8 | MB_TYPE_P0L0, 4 },
126 };
127 
128 static const PMbInfo b_mb_type_info[23] = {
129  { MB_TYPE_DIRECT2 | MB_TYPE_L0L1, 1, },
130  { MB_TYPE_16x16 | MB_TYPE_P0L0, 1, },
131  { MB_TYPE_16x16 | MB_TYPE_P0L1, 1, },
152 };
153 
154 static const PMbInfo b_sub_mb_type_info[13] = {
155  { MB_TYPE_DIRECT2, 1, },
156  { MB_TYPE_16x16 | MB_TYPE_P0L0, 1, },
157  { MB_TYPE_16x16 | MB_TYPE_P0L1, 1, },
168 };
169 
170 static const AVRational ff_h264_pixel_aspect[17] = {
171  { 0, 1 },
172  { 1, 1 },
173  { 12, 11 },
174  { 10, 11 },
175  { 16, 11 },
176  { 40, 33 },
177  { 24, 11 },
178  { 20, 11 },
179  { 32, 11 },
180  { 80, 33 },
181  { 18, 11 },
182  { 15, 11 },
183  { 64, 33 },
184  { 160, 99 },
185  { 4, 3 },
186  { 3, 2 },
187  { 2, 1 },
188 };
189 #endif /* AVCODEC_H264DATA_H */
#define MB_TYPE_INTRA16x16
Definition: avcodec.h:1141
uint8_t pred_mode
Definition: h264data.h:75
static const uint8_t chroma422_dc_scan[8]
Definition: h264data.h:66
#define MB_TYPE_INTRA4x4
Definition: avcodec.h:1140
#define MB_TYPE_P0L0
Definition: avcodec.h:1152
uint8_t partition_count
Definition: h264data.h:110
static const PMbInfo b_sub_mb_type_info[13]
Definition: h264data.h:154
Switching Intra.
Definition: avutil.h:270
static const uint8_t golomb_to_pict_type[5]
Definition: h264data.h:37
static const AVRational ff_h264_pixel_aspect[17]
Definition: h264data.h:170
uint8_t
#define MB_TYPE_INTRA_PCM
Definition: avcodec.h:1142
#define MB_TYPE_P1L1
Definition: avcodec.h:1155
static const IMbInfo i_mb_type_info[26]
Definition: h264data.h:79
uint16_t type
Definition: h264data.h:109
#define MB_TYPE_P1L0
Definition: avcodec.h:1153
H.264 / AVC / MPEG4 part10 codec.
#define MB_TYPE_P0L1
Definition: avcodec.h:1154
#define MB_TYPE_DIRECT2
Definition: avcodec.h:1148
#define MB_TYPE_L0L1
Definition: avcodec.h:1158
static const uint8_t golomb_to_intra4x4_cbp[48]
Definition: h264data.h:42
#define MB_TYPE_8x16
Definition: avcodec.h:1145
static const uint8_t zigzag_scan[16+1]
Definition: h264data.h:54
Switching Predicted.
Definition: avutil.h:271
rational number numerator/denominator
Definition: rational.h:43
static const uint8_t chroma_dc_scan[4]
Definition: h264data.h:61
#define MB_TYPE_16x16
Definition: avcodec.h:1143
#define MB_TYPE_REF0
Definition: h264.h:104
static const PMbInfo b_mb_type_info[23]
Definition: h264data.h:128
static const PMbInfo p_mb_type_info[5]
Definition: h264data.h:113
static const PMbInfo p_sub_mb_type_info[4]
Definition: h264data.h:121
uint8_t cbp
Definition: h264data.h:76
rational numbers
#define MB_TYPE_8x8
Definition: avcodec.h:1146
Bi-dir predicted.
Definition: avutil.h:268
static const uint8_t golomb_to_inter_cbp[48]
Definition: h264data.h:48
#define MB_TYPE_16x8
Definition: avcodec.h:1144
uint16_t type
Definition: h264data.h:74
Predicted.
Definition: avutil.h:267