1
1
mirror of https://github.com/wader/fq.git synced 2024-12-23 21:31:33 +03:00

avc: Correct sign expgolomb decode

This commit is contained in:
Mattias Wadman 2021-09-15 00:32:00 +02:00
parent 13d5cbd81b
commit 777191f685
6 changed files with 19 additions and 16 deletions

View File

@ -325,15 +325,15 @@ $ fq -d matroska verbose /avc.mkv
0x000| e3 | . | num_ref_idx_l1_default_active_minus1: 0 0x1-0x1 (0.1)
0x000| e3 | . | weighted_pred_flag: true 0x1.1-0x1.1 (0.1)
0x000| e3 | . | weighted_bipred_idc: 2 0x1.2-0x1.3 (0.2)
0x000| e3 c4 | .. | pic_init_qp_minus26: 3 0x1.4-0x2 (0.5)
0x000| e3 c4 | .. | pic_init_qp_minus26: -3 0x1.4-0x2 (0.5)
0x000| c4 | . | pic_init_qs_minus26: 0 0x2.1-0x2.1 (0.1)
0x000| c4 48 | .H | chroma_qp_index_offset: -4 0x2.2-0x3 (0.7)
0x000| c4 48 | .H | chroma_qp_index_offset: 4 0x2.2-0x3 (0.7)
0x000| 48 | H | deblocking_filter_control_present_flag: true 0x3.1-0x3.1 (0.1)
0x000| 48 | H | constrained_intra_pred_flag: false 0x3.2-0x3.2 (0.1)
0x000| 48 | H | redundant_pic_cnt_present_flag: false 0x3.3-0x3.3 (0.1)
0x000| 48 | H | transform_8x8_mode_flag: true 0x3.4-0x3.4 (0.1)
0x000| 48 | H | pic_scaling_matrix_present_flag: false 0x3.5-0x3.5 (0.1)
0x000| 48 44| | HD| | second_chroma_qp_index_offset: -4 0x3.6-0x4.4 (0.7)
0x000| 48 44| | HD| | second_chroma_qp_index_offset: 4 0x3.6-0x4.4 (0.7)
0x000| 44| | D| | rbsp_trailing_bits: 80 0x4.5-0x4.7 (0.3)
0x01a0| 68 | h | forbidden_zero_bit: false 0x1a5-0x1a5 (0.1)
0x01a0| 68 | h | nal_ref_idc: 3 0x1a5.1-0x1a5.2 (0.2)

View File

@ -290,15 +290,15 @@ $ fq -d mp4 verbose /avc.mp4
0x000| e3 | . | num_ref_idx_l1_default_active_minus1: 0 0x1-0x1 (0.1)
0x000| e3 | . | weighted_pred_flag: true 0x1.1-0x1.1 (0.1)
0x000| e3 | . | weighted_bipred_idc: 2 0x1.2-0x1.3 (0.2)
0x000| e3 c4 | .. | pic_init_qp_minus26: 3 0x1.4-0x2 (0.5)
0x000| e3 c4 | .. | pic_init_qp_minus26: -3 0x1.4-0x2 (0.5)
0x000| c4 | . | pic_init_qs_minus26: 0 0x2.1-0x2.1 (0.1)
0x000| c4 48 | .H | chroma_qp_index_offset: -4 0x2.2-0x3 (0.7)
0x000| c4 48 | .H | chroma_qp_index_offset: 4 0x2.2-0x3 (0.7)
0x000| 48 | H | deblocking_filter_control_present_flag: true 0x3.1-0x3.1 (0.1)
0x000| 48 | H | constrained_intra_pred_flag: false 0x3.2-0x3.2 (0.1)
0x000| 48 | H | redundant_pic_cnt_present_flag: false 0x3.3-0x3.3 (0.1)
0x000| 48 | H | transform_8x8_mode_flag: true 0x3.4-0x3.4 (0.1)
0x000| 48 | H | pic_scaling_matrix_present_flag: false 0x3.5-0x3.5 (0.1)
0x000| 48 44| | HD| | second_chroma_qp_index_offset: -4 0x3.6-0x4.4 (0.7)
0x000| 48 44| | HD| | second_chroma_qp_index_offset: 4 0x3.6-0x4.4 (0.7)
0x000| 44| | D| | rbsp_trailing_bits: 80 0x4.5-0x4.7 (0.3)
0x0d10| 68 | h | forbidden_zero_bit: false 0xd1b-0xd1b (0.1)
0x0d10| 68 | h | nal_ref_idc: 3 0xd1b.1-0xd1b.2 (0.2)

View File

@ -775,15 +775,15 @@ $ fq -d mp4 verbose /dash_video_init.mp4
0x00|ee |. | num_ref_idx_l1_default_active_minus1: 0 0x0.6-0x0.6 (0.1)
0x00|ee |. | weighted_pred_flag: false 0x0.7-0x0.7 (0.1)
0x00| 0f | . | weighted_bipred_idc: 0 0x1-0x1.1 (0.2)
0x00| 0f | . | pic_init_qp_minus26: 3 0x1.2-0x1.6 (0.5)
0x00| 0f | . | pic_init_qp_minus26: -3 0x1.2-0x1.6 (0.5)
0x00| 0f | . | pic_init_qs_minus26: 0 0x1.7-0x1.7 (0.1)
0x00| 11 | . | chroma_qp_index_offset: -4 0x2-0x2.6 (0.7)
0x00| 11 | . | chroma_qp_index_offset: 4 0x2-0x2.6 (0.7)
0x00| 11 | . | deblocking_filter_control_present_flag: true 0x2.7-0x2.7 (0.1)
0x00| 21 | ! | constrained_intra_pred_flag: false 0x3-0x3 (0.1)
0x00| 21 | ! | redundant_pic_cnt_present_flag: false 0x3.1-0x3.1 (0.1)
0x00| 21 | ! | transform_8x8_mode_flag: true 0x3.2-0x3.2 (0.1)
0x00| 21 | ! | pic_scaling_matrix_present_flag: false 0x3.3-0x3.3 (0.1)
0x00| 21 10| | !.| | second_chroma_qp_index_offset: -4 0x3.4-0x4.2 (0.7)
0x00| 21 10| | !.| | second_chroma_qp_index_offset: 4 0x3.4-0x4.2 (0.7)
0x00| 10| | .| | rbsp_trailing_bits: 80 0x4.3-0x4.7 (0.5)
0x290| 68 | h | forbidden_zero_bit: false 0x299-0x299 (0.1)
0x290| 68 | h | nal_ref_idc: 3 0x299.1-0x299.2 (0.2)

View File

@ -258,15 +258,15 @@ $ fq -d mp4 verbose /fragmented.mp4
0x000|ee |. | num_ref_idx_l1_default_active_minus1: 0 0x0.6-0x0.6 (0.1)
0x000|ee |. | weighted_pred_flag: false 0x0.7-0x0.7 (0.1)
0x000| 0f | . | weighted_bipred_idc: 0 0x1-0x1.1 (0.2)
0x000| 0f | . | pic_init_qp_minus26: 3 0x1.2-0x1.6 (0.5)
0x000| 0f | . | pic_init_qp_minus26: -3 0x1.2-0x1.6 (0.5)
0x000| 0f | . | pic_init_qs_minus26: 0 0x1.7-0x1.7 (0.1)
0x000| 11 | . | chroma_qp_index_offset: -4 0x2-0x2.6 (0.7)
0x000| 11 | . | chroma_qp_index_offset: 4 0x2-0x2.6 (0.7)
0x000| 11 | . | deblocking_filter_control_present_flag: true 0x2.7-0x2.7 (0.1)
0x000| 21 | ! | constrained_intra_pred_flag: false 0x3-0x3 (0.1)
0x000| 21 | ! | redundant_pic_cnt_present_flag: false 0x3.1-0x3.1 (0.1)
0x000| 21 | ! | transform_8x8_mode_flag: true 0x3.2-0x3.2 (0.1)
0x000| 21 | ! | pic_scaling_matrix_present_flag: false 0x3.3-0x3.3 (0.1)
0x000| 21 10| | !.| | second_chroma_qp_index_offset: -4 0x3.4-0x4.2 (0.7)
0x000| 21 10| | !.| | second_chroma_qp_index_offset: 4 0x3.4-0x4.2 (0.7)
0x000| 10| | .| | rbsp_trailing_bits: 80 0x4.3-0x4.7 (0.5)
0x0220| 68 | h | forbidden_zero_bit: false 0x226-0x226 (0.1)
0x0220| 68 | h | nal_ref_idc: 3 0x226.1-0x226.2 (0.2)

View File

@ -51,7 +51,10 @@ func fieldUEV(d *decode.D, name string) uint64 {
})
}
func sEV(d *decode.D) int64 { return num.ZigZag(expGolomb(d)) }
func sEV(d *decode.D) int64 {
v := expGolomb(d) + 1
return num.ZigZag(v) - -int64(v&1)
}
func fieldSEV(d *decode.D, name string) int64 { //nolint:unparam
return d.FieldSFn(name, func() (int64, decode.DisplayFormat, string) {

View File

@ -74,15 +74,15 @@ $ fq -d avc_annexb verbose /avc_annexb
0x000| e3 | . | num_ref_idx_l1_default_active_minus1: 0 0x1-0x1 (0.1)
0x000| e3 | . | weighted_pred_flag: true 0x1.1-0x1.1 (0.1)
0x000| e3 | . | weighted_bipred_idc: 2 0x1.2-0x1.3 (0.2)
0x000| e3 c4 | .. | pic_init_qp_minus26: 3 0x1.4-0x2 (0.5)
0x000| e3 c4 | .. | pic_init_qp_minus26: -3 0x1.4-0x2 (0.5)
0x000| c4 | . | pic_init_qs_minus26: 0 0x2.1-0x2.1 (0.1)
0x000| c4 48 | .H | chroma_qp_index_offset: -4 0x2.2-0x3 (0.7)
0x000| c4 48 | .H | chroma_qp_index_offset: 4 0x2.2-0x3 (0.7)
0x000| 48 | H | deblocking_filter_control_present_flag: true 0x3.1-0x3.1 (0.1)
0x000| 48 | H | constrained_intra_pred_flag: false 0x3.2-0x3.2 (0.1)
0x000| 48 | H | redundant_pic_cnt_present_flag: false 0x3.3-0x3.3 (0.1)
0x000| 48 | H | transform_8x8_mode_flag: true 0x3.4-0x3.4 (0.1)
0x000| 48 | H | pic_scaling_matrix_present_flag: false 0x3.5-0x3.5 (0.1)
0x000| 48 44| | HD| | second_chroma_qp_index_offset: -4 0x3.6-0x4.4 (0.7)
0x000| 48 44| | HD| | second_chroma_qp_index_offset: 4 0x3.6-0x4.4 (0.7)
0x000| 44| | D| | rbsp_trailing_bits: 80 0x4.5-0x4.7 (0.3)
0x0020| 68 | h | forbidden_zero_bit: false 0x21-0x21 (0.1)
0x0020| 68 | h | nal_ref_idc: 3 0x21.1-0x21.2 (0.2)