1
1
mirror of https://github.com/wader/fq.git synced 2024-11-24 03:05:22 +03:00

avc_pps: Correct check if there is more rbsp data

Also add rbsp_stop_one_bit field
This commit is contained in:
Mattias Wadman 2022-05-04 12:24:52 +02:00
parent d1ca8ff40f
commit b0096bc170
3 changed files with 22 additions and 5 deletions

View File

@ -15,12 +15,9 @@ func init() {
})
}
// TODO:
// ffmpeg does: get_bits_left(gb) > 0 && show_bits(gb, 8) != 0x80
// we do: there is more than trailing rbsp left
func moreRBSPData(d *decode.D) bool {
l := d.BitsLeft()
return l > 8 //|| (l == 8 && d.PeekBits(8) != 1)
return l >= 8 && d.PeekBits(8) != 0b1000_0000
}
func avcPPSDecode(d *decode.D, in interface{}) interface{} {
@ -77,7 +74,6 @@ func avcPPSDecode(d *decode.D, in interface{}) interface{} {
d.FieldBool("constrained_intra_pred_flag")
d.FieldBool("redundant_pic_cnt_present_flag")
// TODO: more_data() is there non-zero bits left?
if moreRBSPData(d) {
d.FieldBool("transform_8x8_mode_flag")
picScalingMatrixPresentFlag := d.FieldBool("pic_scaling_matrix_present_flag")
@ -89,6 +85,8 @@ func avcPPSDecode(d *decode.D, in interface{}) interface{} {
})
}
d.FieldSFn("second_chroma_qp_index_offset", sEV)
} else {
d.FieldBool("rbsp_stop_one_bit")
}
d.FieldRawLen("rbsp_trailing_bits", d.BitsLeft())

Binary file not shown.

View File

@ -0,0 +1,19 @@
$ fq -d avc_pps ddv avc_pps_stop_more_8bit
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: avc_pps_stop_more_8bit (avc_pps) 0x0-0x3.7 (4)
0x0|ce |. | pic_parameter_set_id: 0 0x0-0x0 (0.1)
0x0|ce |. | seq_parameter_set_id: 0 0x0.1-0x0.1 (0.1)
0x0|ce |. | entropy_coding_mode_flag: false 0x0.2-0x0.2 (0.1)
0x0|ce |. | bottom_field_pic_order_in_frame_present_flag: false 0x0.3-0x0.3 (0.1)
0x0|ce |. | num_slice_groups: 1 0x0.4-0x0.4 (0.1)
0x0|ce |. | num_ref_idx_l0_default_active: 1 0x0.5-0x0.5 (0.1)
0x0|ce |. | num_ref_idx_l1_default_active: 1 0x0.6-0x0.6 (0.1)
0x0|ce |. | weighted_pred_flag: false 0x0.7-0x0.7 (0.1)
0x0| 1f | . | weighted_bipred_idc: 0 0x1-0x1.1 (0.2)
0x0| 1f | . | pic_init_qp: 25 0x1.2-0x1.4 (0.3)
0x0| 1f | . | pic_init_qs: 26 0x1.5-0x1.5 (0.1)
0x0| 1f | . | chroma_qp_index_offset: 0 0x1.6-0x1.6 (0.1)
0x0| 1f | . | deblocking_filter_control_present_flag: true 0x1.7-0x1.7 (0.1)
0x0| 20 | | constrained_intra_pred_flag: false 0x2-0x2 (0.1)
0x0| 20 | | redundant_pic_cnt_present_flag: false 0x2.1-0x2.1 (0.1)
0x0| 20 | | rbsp_stop_one_bit: true 0x2.2-0x2.2 (0.1)
0x0| 20 00| | .| | rbsp_trailing_bits: raw bits 0x2.3-0x3.7 (1.5)