This file is indexed.

/usr/include/bitstream/mpeg/h264.h is in libbitstream-dev 1.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
/*****************************************************************************
 * h264.h: ISO/IEC 14496-10 (video)
 *****************************************************************************
 * Copyright (C) 2013 VideoLAN
 *
 * Authors: Christophe Massiot <massiot@via.ecp.fr>
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject
 * to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *****************************************************************************/

/*
 * Normative references:
 *  - ISO/IEC 14496-10 (advanced video coding)
 */

#ifndef __BITSTREAM_MPEG_H264_H__
#define __BITSTREAM_MPEG_H264_H__

#include <stdint.h>   /* uint8_t, uint16_t, etc... */
#include <stdbool.h>  /* bool */
#include <string.h>   /* memset */

#ifdef __cplusplus
extern "C"
{
#endif

/*****************************************************************************
 * H264 network abstraction layer (annex B)
 *****************************************************************************/
#define H264NAL_TYPE_NONIDR             1
#define H264NAL_TYPE_PARTA              2
#define H264NAL_TYPE_PARTB              3
#define H264NAL_TYPE_PARTC              4
#define H264NAL_TYPE_IDR                5
#define H264NAL_TYPE_SEI                6
#define H264NAL_TYPE_SPS                7
#define H264NAL_TYPE_PPS                8
#define H264NAL_TYPE_AUD                9
#define H264NAL_TYPE_ENDSEQ             10
#define H264NAL_TYPE_ENDSTR             11
#define H264NAL_TYPE_FILLER             12
#define H264NAL_TYPE_SPSX               13
#define H264NAL_TYPE_PFX                14
#define H264NAL_TYPE_SSPS               15

static inline void h264nal_init(uint8_t *p_h264nal)
{
    p_h264nal[0] = 0x0;
    p_h264nal[1] = 0x0;
    p_h264nal[2] = 0x1;
    p_h264nal[3] = 0;
}

static inline void h264nal_set_ref(uint8_t *p_h264nal, uint8_t ref)
{
    p_h264nal[3] &= 0x1f;
    p_h264nal[3] |= ref << 5;
}

static inline uint8_t h264nal_get_ref(const uint8_t *p_h264nal)
{
    return (p_h264nal[3] & 0x60) >> 5;
}

static inline void h264nal_set_type(uint8_t *p_h264nal, uint8_t type)
{
    p_h264nal[3] &= 0xe0;
    p_h264nal[3] |= type;
}

static inline uint8_t h264nal_get_type(const uint8_t *p_h264nal)
{
    return p_h264nal[3] & 0x1f;
}

static inline uint8_t h264nalst_get_ref(uint8_t start)
{
    return (start & 0x60) >> 5;
}

static inline uint8_t h264nalst_get_type(uint8_t start)
{
    return start & 0x1f;
}

/*****************************************************************************
 * H264 supplemental enhancement information
 *****************************************************************************/
#define H264SEI_HEADER_SIZE         4

#define H264SEI_BUFFERING_PERIOD    0
#define H264SEI_PIC_TIMING          1
#define H264SEI_PAN_SCAN_RECT       2
#define H264SEI_FILLER_PAYLOAD      3
#define H264SEI_USER_T_T35          4
#define H264SEI_USER_UNREGISTERED   5
#define H264SEI_RECOVERY_POINT      6
#define H264SEI_DEC_REF_PIC_MARK_R  7
#define H264SEI_SPARE_PIC           8
#define H264SEI_SCENE_INFO          9
#define H264SEI_SUB_SEQ_INFO        10
#define H264SEI_SUB_SEQ_LAYER_CHAR  11
#define H264SEI_SUB_SEQ_CHAR        12
#define H264SEI_FULL_FRAME_FREEZE   13
#define H264SEI_FULL_FRAME_FREEZE_R 14
#define H264SEI_FULL_FRAME_SNAP     15
#define H264SEI_PROG_REF_SEGMENT_S  16
#define H264SEI_PROG_REF_SEGMENT_E  17
#define H264SEI_MOTION_CONS_SGRP_S  18
#define H264SEI_FILM_GRAIN_CHAR     19
#define H264SEI_DEBLOCK_DIS_PREF    20
#define H264SEI_STEREO_VIDEO_INFO   21
#define H264SEI_POST_FILTER_HINT    22
#define H264SEI_TONE_MAPPING_INFO   23
#define H264SEI_SCALABILITY_INFO    24
#define H264SEI_SUBPIC_SCAL_LAYER   25
#define H264SEI_NONREQ_LAYER_REP    26
#define H264SEI_PRIO_LAYER_INFO     27
#define H264SEI_LAYERS_NOT_PRES     28
#define H264SEI_LAYER_DEP_CHANGE    29
#define H264SEI_SCALABLE_NESTING    30
#define H264SEI_BASE_LAYER_TEMP_HRD 31
#define H264SEI_QUAL_LAYER_INT_CHK  32
#define H264SEI_REDUND_PIC_PROP     33
#define H264SEI_TL0_DEP_REP         34
#define H264SEI_TL_SWITCHING_POINT  35
#define H264SEI_PARALLEL_DEC_INFO   36
#define H264SEI_MVC_SCAL_NESTING    37
#define H264SEI_VIEW_SCAL_INFO      38
#define H264SEI_MULTIVIEW_SCN_INFO  39
#define H264SEI_MULTIVIEW_ACQ_INFO  40
#define H264SEI_NONREQ_VIEW_COMP    41
#define H264SEI_VIEW_DEP_CHANGE     42
#define H264SEI_OP_POINTS_NOT_PRES  43
#define H264SEI_BASE_VIEW_TEMP_HRD  44
#define H264SEI_FRAME_PACK_ARRANG   45

#define H264SEI_STRUCT_FRAME        0
#define H264SEI_STRUCT_TOP          1
#define H264SEI_STRUCT_BOT          2
#define H264SEI_STRUCT_TOP_BOT      3
#define H264SEI_STRUCT_BOT_TOP      4
#define H264SEI_STRUCT_TOP_BOT_TOP  5
#define H264SEI_STRUCT_BOT_TOP_BOT  6
#define H264SEI_STRUCT_DOUBLE       7
#define H264SEI_STRUCT_TRIPLE       8

static inline void h264sei_init(uint8_t *p_h264sei)
{
    h264nal_init(p_h264sei);
    h264nal_set_type(p_h264sei, H264NAL_TYPE_SEI);
}

/*****************************************************************************
 * H264 sequence parameter set
 *****************************************************************************/
#define H264SPS_HEADER_SIZE         7

#define H264SPS_ID_MAX              32

#define H264SPS_CHROMA_MONO         0
#define H264SPS_CHROMA_420          1
#define H264SPS_CHROMA_422          2
#define H264SPS_CHROMA_444          3

static inline void h264sps_init(uint8_t *p_h264sps)
{
    h264nal_init(p_h264sps);
    h264nal_set_ref(p_h264sps, 1);
    h264nal_set_type(p_h264sps, H264NAL_TYPE_SPS);
    p_h264sps[5] = 0x0;
}

static inline void h264sps_set_profile(uint8_t *p_h264sps, uint8_t i_profile)
{
    p_h264sps[4] = i_profile;
}

static inline uint8_t h264sps_get_profile(const uint8_t *p_h264sps)
{
    return p_h264sps[4];
}

static inline void h264sps_set_level(uint8_t *p_h264sps, uint8_t i_level)
{
    p_h264sps[6] = i_level;
}

static inline uint8_t h264sps_get_level(const uint8_t *p_h264sps)
{
    return p_h264sps[6];
}

/*****************************************************************************
 * H264 picture parameter set
 *****************************************************************************/
#define H264PPS_HEADER_SIZE         7

#define H264PPS_ID_MAX              256

static inline void h264pps_init(uint8_t *p_h264pps)
{
    h264nal_init(p_h264pps);
    h264nal_set_ref(p_h264pps, 1);
    h264nal_set_type(p_h264pps, H264NAL_TYPE_PPS);
}

/*****************************************************************************
 * H264 access unit delimiter
 *****************************************************************************/
#define H264AUD_HEADER_SIZE         5

static inline void h264aud_init(uint8_t *p_h264aud)
{
    h264nal_init(p_h264aud);
    h264nal_set_type(p_h264aud, H264NAL_TYPE_AUD);
    p_h264aud[4] = 0x10;
}

static inline void h264aud_set_pic_type(uint8_t *p_h264aud, uint8_t i_type)
{
    p_h264aud[4] = i_type << 5;
}

static inline uint8_t h264aud_get_pic_type(const uint8_t *p_h264aud)
{
    return p_h264aud[4] >> 5;
}

/*****************************************************************************
 * H264 end sequence
 *****************************************************************************/
#define H264ENDSEQ_HEADER_SIZE      4

static inline void h264endseq_init(uint8_t *p_h264endseq)
{
    h264nal_init(p_h264endseq);
    h264nal_set_type(p_h264endseq, H264NAL_TYPE_ENDSEQ);
}

/*****************************************************************************
 * H264 end stream
 *****************************************************************************/
#define H264ENDSTR_HEADER_SIZE      4

static inline void h264endstr_init(uint8_t *p_h264endstr)
{
    h264nal_init(p_h264endstr);
    h264nal_set_type(p_h264endstr, H264NAL_TYPE_ENDSTR);
}

/*****************************************************************************
 * H264 sequence parameter set extension
 *****************************************************************************/
#define H264SPSX_HEADER_SIZE        4

static inline void h264spsx_init(uint8_t *p_h264spsx)
{
    h264nal_init(p_h264spsx);
    h264nal_set_ref(p_h264spsx, 1);
    h264nal_set_type(p_h264spsx, H264NAL_TYPE_SPSX);
}

/*****************************************************************************
 * H264 subset sequence parameter set
 *****************************************************************************/
#define H264SSPS_HEADER_SIZE        4

static inline void h264ssps_init(uint8_t *p_h264ssps)
{
    h264nal_init(p_h264ssps);
    h264nal_set_ref(p_h264ssps, 1);
    h264nal_set_type(p_h264ssps, H264NAL_TYPE_SSPS);
}

/*****************************************************************************
 * H264 video usability information
 *****************************************************************************/
#define H264VUI_AR_EXTENDED         255

/*****************************************************************************
 * H264 slices
 *****************************************************************************/
#define H264SLI_TYPE_P              0
#define H264SLI_TYPE_B              1
#define H264SLI_TYPE_I              2
#define H264SLI_TYPE_SP             3
#define H264SLI_TYPE_SI             4

#ifdef __cplusplus
}
#endif

#endif