Coverage Report

Created: 2025-08-25 06:17

/src/vlc/modules/packetizer/h264_slice.h
Line
Count
Source (jump to first uncovered line)
1
/*****************************************************************************
2
 * h264_slice.c: h264 slice parser
3
 *****************************************************************************
4
 * Copyright (C) 2001-17 VLC authors and VideoLAN
5
 *
6
 * This program is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU Lesser General Public License as published by
8
 * the Free Software Foundation; either version 2.1 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with this program; if not, write to the Free Software Foundation,
18
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19
 *****************************************************************************/
20
#ifndef VLC_H264_SLICE_H
21
#define VLC_H264_SLICE_H
22
23
enum h264_slice_type_e
24
{
25
    H264_SLICE_TYPE_P = 0,
26
    H264_SLICE_TYPE_B,
27
    H264_SLICE_TYPE_I,
28
    H264_SLICE_TYPE_SP,
29
    H264_SLICE_TYPE_SI,
30
    H264_SLICE_TYPE_UNKNOWN,
31
};
32
33
typedef struct h264_slice_s h264_slice_t;
34
35
enum h264_slice_type_e h264_get_slice_type( const h264_slice_t *p_slice );
36
37
enum h264_slice_struct_e
38
{
39
    H264_SLICE_FRAME,
40
    H264_SLICE_FIELD,
41
    H264_SLICE_MBAFF,
42
};
43
44
enum h264_slice_struct_e h264_get_slice_struct( const h264_slice_t *p_slice );
45
bool h264_is_field_pic( const h264_slice_t *p_slice );
46
47
int h264_get_slice_pps_id( const h264_slice_t *p_slice );
48
unsigned h264_get_frame_num( const h264_slice_t *p_slice );
49
unsigned h264_get_nal_ref_idc( const h264_slice_t *p_slice );
50
bool h264_has_mmco5( const h264_slice_t *p_slice );
51
void h264_slice_release( h264_slice_t *p_slice );
52
void h264_slice_copy_idr_id( const h264_slice_t *src, h264_slice_t *dst );
53
54
55
h264_slice_t * h264_decode_slice( const uint8_t *p_buffer, size_t i_buffer,
56
                        void (* get_sps_pps)(uint8_t pps_id, void *,
57
                                             const h264_sequence_parameter_set_t **,
58
                                             const h264_picture_parameter_set_t ** ),
59
                        void * );
60
61
typedef struct
62
{
63
    struct
64
    {
65
        int lsb;
66
        int msb;
67
    } prevPicOrderCnt;
68
    unsigned prevFrameNum;
69
    unsigned prevFrameNumOffset;
70
    int  prevRefPictureTFOC;
71
    bool prevRefPictureIsBottomField;
72
    bool prevRefPictureHasMMCO5;
73
} h264_poc_context_t;
74
75
static inline void h264_poc_context_init( h264_poc_context_t *p_ctx )
76
0
{
77
0
    p_ctx->prevPicOrderCnt.lsb = 0;
78
0
    p_ctx->prevPicOrderCnt.msb = 0;
79
0
    p_ctx->prevFrameNum = 0;
80
0
    p_ctx->prevFrameNumOffset = 0;
81
0
    p_ctx->prevRefPictureIsBottomField = false;
82
0
    p_ctx->prevRefPictureHasMMCO5 = false;
83
0
}
Unexecuted instantiation: h264.c:h264_poc_context_init
Unexecuted instantiation: h264_slice.c:h264_poc_context_init
84
85
void h264_compute_poc( const h264_sequence_parameter_set_t *p_sps,
86
                       const h264_slice_t *p_slice, h264_poc_context_t *p_ctx,
87
                       int *p_PictureOrderCount, int *p_tFOC, int *p_bFOC );
88
89
uint8_t h264_get_num_ts( const h264_sequence_parameter_set_t *p_sps,
90
                         const h264_slice_t *p_slice, uint8_t pic_struct, int tFOC, int bFOC );
91
92
bool h264_slice_top_field( const h264_slice_t *p_slice );
93
94
bool h264_IsFirstVCLNALUnit( const h264_slice_t *p_prev, const h264_slice_t *p_cur );
95
96
bool h264_CanSwapPTSWithDTS( const h264_slice_t *p_slice, const h264_sequence_parameter_set_t * );
97
98
#endif