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.
Unified · Split
| @@ -1701,7 +1701,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, · 1700 unmodified lines | ||
| 1701 | 1701 | unsigned int slice_type, tmp, i; |
| 1702 | 1702 | int field_pic_flag, bottom_field_flag; |
| 1703 | 1703 | int first_slice = sl == h->slice_ctx && !h->current_slice; |
| 1704 | − int picture_structure; | |
| 1704 | + int picture_structure, pos; | |
| 1705 | 1705 | |
| 1706 | 1706 | if (first_slice) |
| 1707 | 1707 | av_assert0(!h->setup_finished); |
| @@ -1792,6 +1792,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, · 84 unmodified lines | ||
| 1792 | 1792 | |
| 1793 | 1793 | sl->poc_lsb = 0; |
| 1794 | 1794 | sl->delta_poc_bottom = 0; |
| 1795 | + pos = get_bits_left(&sl->gb); | |
| 1795 | 1796 | if (sps->poc_type == 0) { |
| 1796 | 1797 | sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb); |
| 1797 | 1798 | |
| @@ -1806,6 +1807,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, · 8 unmodified lines | ||
| 1806 | 1807 | if (pps->pic_order_present == 1 && picture_structure == PICT_FRAME) |
| 1807 | 1808 | sl->delta_poc[1] = get_se_golomb(&sl->gb); |
| 1808 | 1809 | } |
| 1810 | + sl->pic_order_cnt_bit_size = pos - get_bits_left(&sl->gb); | |
| 1809 | 1811 | |
| 1810 | 1812 | sl->redundant_pic_count = 0; |
| 1811 | 1813 | if (pps->redundant_pic_cnt_present) |
| @@ -1845,9 +1847,11 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, · 33 unmodified lines | ||
| 1845 | 1847 | |
| 1846 | 1848 | sl->explicit_ref_marking = 0; |
| 1847 | 1849 | if (nal->ref_idc) { |
| 1850 | + pos = get_bits_left(&sl->gb); | |
| 1848 | 1851 | ret = ff_h264_decode_ref_pic_marking(sl, &sl->gb, nal, h->avctx); |
| 1849 | 1852 | if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) |
| 1850 | 1853 | return AVERROR_INVALIDDATA; |
| 1854 | + sl->ref_pic_marking_bit_size = pos - get_bits_left(&sl->gb); | |
| 1851 | 1855 | } |
| 1852 | 1856 | |
| 1853 | 1857 | if (sl->slice_type_nos != AV_PICTURE_TYPE_I && pps->cabac) { |
| @@ -324,6 +324,7 @@ typedef struct H264SliceContext { · 323 unmodified lines | ||
| 324 | 324 | MMCO mmco[H264_MAX_MMCO_COUNT]; |
| 325 | 325 | int nb_mmco; |
| 326 | 326 | int explicit_ref_marking; |
| 327 | + int ref_pic_marking_bit_size; | |
| 327 | 328 | |
| 328 | 329 | int frame_num; |
| 329 | 330 | int idr_pic_id; |
| @@ -332,6 +333,7 @@ typedef struct H264SliceContext { · 2 unmodified lines | ||
| 332 | 333 | int delta_poc[2]; |
| 333 | 334 | int curr_pic_num; |
| 334 | 335 | int max_pic_num; |
| 336 | + int pic_order_cnt_bit_size; | |
| 335 | 337 | } H264SliceContext; |
| 336 | 338 | |
| 337 | 339 | /** |