Coverage Report

Created: 2023-03-26 07:08

/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
34
{
35
    int i_nal_type;
36
    int i_nal_ref_idc;
37
38
    enum h264_slice_type_e type;
39
    int i_pic_parameter_set_id;
40
    unsigned i_frame_num;
41
42
    int i_field_pic_flag;
43
    int i_bottom_field_flag;
44
45
    int i_idr_pic_id;
46
47
    int i_pic_order_cnt_type;
48
    int i_pic_order_cnt_lsb;
49
    int i_delta_pic_order_cnt_bottom;
50
51
    int i_delta_pic_order_cnt0;
52
    int i_delta_pic_order_cnt1;
53
54
    bool has_mmco5;
55
} h264_slice_t;
56
57
static inline void h264_slice_init( h264_slice_t *p_slice )
58
0
{
59
0
    p_slice->i_nal_type = -1;
60
0
    p_slice->i_nal_ref_idc = -1;
61
0
    p_slice->i_idr_pic_id = -1;
62
0
    p_slice->i_frame_num = 0;
63
0
    p_slice->type = H264_SLICE_TYPE_UNKNOWN;
64
0
    p_slice->i_pic_parameter_set_id = -1;
65
0
    p_slice->i_field_pic_flag = 0;
66
0
    p_slice->i_bottom_field_flag = -1;
67
0
    p_slice->i_pic_order_cnt_type = -1;
68
0
    p_slice->i_pic_order_cnt_lsb = -1;
69
0
    p_slice->i_delta_pic_order_cnt_bottom = -1;
70
0
    p_slice->i_delta_pic_order_cnt0 = 0;
71
0
    p_slice->i_delta_pic_order_cnt1 = 0;
72
0
    p_slice->has_mmco5 = false;
73
0
}
Unexecuted instantiation: h264.c:h264_slice_init
Unexecuted instantiation: h264_slice.c:h264_slice_init
74
75
bool h264_decode_slice( const uint8_t *p_buffer, size_t i_buffer,
76
                        void (* get_sps_pps)(uint8_t pps_id, void *,
77
                                             const h264_sequence_parameter_set_t **,
78
                                             const h264_picture_parameter_set_t ** ),
79
                        void *, h264_slice_t *p_slice );
80
81
typedef struct
82
{
83
    struct
84
    {
85
        int lsb;
86
        int msb;
87
    } prevPicOrderCnt;
88
    unsigned prevFrameNum;
89
    unsigned prevFrameNumOffset;
90
    int  prevRefPictureTFOC;
91
    bool prevRefPictureIsBottomField;
92
    bool prevRefPictureHasMMCO5;
93
} h264_poc_context_t;
94
95
static inline void h264_poc_context_init( h264_poc_context_t *p_ctx )
96
0
{
97
0
    p_ctx->prevPicOrderCnt.lsb = 0;
98
0
    p_ctx->prevPicOrderCnt.msb = 0;
99
0
    p_ctx->prevFrameNum = 0;
100
0
    p_ctx->prevFrameNumOffset = 0;
101
0
    p_ctx->prevRefPictureIsBottomField = false;
102
0
    p_ctx->prevRefPictureHasMMCO5 = false;
103
0
}
Unexecuted instantiation: h264.c:h264_poc_context_init
Unexecuted instantiation: h264_slice.c:h264_poc_context_init
104
105
void h264_compute_poc( const h264_sequence_parameter_set_t *p_sps,
106
                       const h264_slice_t *p_slice, h264_poc_context_t *p_ctx,
107
                       int *p_PictureOrderCount, int *p_tFOC, int *p_bFOC );
108
109
uint8_t h264_get_num_ts( const h264_sequence_parameter_set_t *p_sps,
110
                         const h264_slice_t *p_slice, uint8_t pic_struct, int tFOC, int bFOC );
111
112
#endif