History

avcodec/h264dec: add ref_pic_marking and pic_order_cnt bit_size to slice context

The V4L2_CID_STATELESS_H264_DECODE_PARAMS control require following: - dec_ref_pic_marking_bit_size Size in bits of the dec_ref_pic_marking() syntax element. - pic_order_cnt_bit_size Combined size in bits of the picture order count related syntax elements: pic_order_cnt_lsb, delta_pic_order_cnt_bottom, delta_pic_order_cnt0, and delta_pic_order_cnt1. Save the bit sizes while parsing for later use in hwaccel, similar to short/long_term_ref_pic_set_size in hevcdec.

Boris Brezillon committed 2 years ago

Commit 21285231 parent 4f3a3592 files · +7 −1Browse files

Unified · Split

2 files
  1. libavcodec/h264_slice.c +5 −1
  2. libavcodec/h264dec.h +2 −0
libavcodec/h264_slice.c+5−1
@@ -1701,7 +1701,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, · 1700 unmodified lines
17011701 unsigned int slice_type, tmp, i;
17021702 int field_pic_flag, bottom_field_flag;
17031703 int first_slice = sl == h->slice_ctx && !h->current_slice;
1704− int picture_structure;
1704+ int picture_structure, pos;
17051705
17061706 if (first_slice)
17071707 av_assert0(!h->setup_finished);
@@ -1792,6 +1792,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, · 84 unmodified lines
17921792
17931793 sl->poc_lsb = 0;
17941794 sl->delta_poc_bottom = 0;
1795+ pos = get_bits_left(&sl->gb);
17951796 if (sps->poc_type == 0) {
17961797 sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb);
17971798
@@ -1806,6 +1807,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, · 8 unmodified lines
18061807 if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME)
18071808 sl->delta_poc[1] = get_se_golomb(&sl->gb);
18081809 }
1810+ sl->pic_order_cnt_bit_size = pos - get_bits_left(&sl->gb);
18091811
18101812 sl->redundant_pic_count = 0;
18111813 if (pps->redundant_pic_cnt_present)
@@ -1845,9 +1847,11 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, · 33 unmodified lines
18451847
18461848 sl->explicit_ref_marking = 0;
18471849 if (nal->ref_idc) {
1850+ pos = get_bits_left(&sl->gb);
18481851 ret = ff_h264_decode_ref_pic_marking(sl, &sl->gb, nal, h->avctx);
18491852 if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
18501853 return AVERROR_INVALIDDATA;
1854+ sl->ref_pic_marking_bit_size = pos - get_bits_left(&sl->gb);
18511855 }
18521856
18531857 if (sl->slice_type_nos != AV_PICTURE_TYPE_I && pps->cabac) {
libavcodec/h264dec.h+2−0
@@ -324,6 +324,7 @@ typedef struct H264SliceContext { · 323 unmodified lines
324324 MMCO mmco[H264_MAX_MMCO_COUNT];
325325 int nb_mmco;
326326 int explicit_ref_marking;
327+ int ref_pic_marking_bit_size;
327328
328329 int frame_num;
329330 int idr_pic_id;
@@ -332,6 +333,7 @@ typedef struct H264SliceContext { · 2 unmodified lines
332333 int delta_poc[2];
333334 int curr_pic_num;
334335 int max_pic_num;
336+ int pic_order_cnt_bit_size;
335337 } H264SliceContext;
336338
337339 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t