From be4f2ecbde13b8f3d1f185351e42b6b2884348f7 Mon Sep 17 00:00:00 2001 From: as2120 <126.org@gmail.com> Date: Wed, 27 Dec 2017 12:48:07 +0800 Subject: [PATCH 1/9] fix memory leak : read_nal_unit return in some cases without freeing allocated memory --- h264_stream.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/h264_stream.c b/h264_stream.c index fefd75e..d89a50d 100644 --- a/h264_stream.c +++ b/h264_stream.c @@ -279,6 +279,8 @@ int read_nal_unit(h264_stream_t* h, uint8_t* buf, int size) case NAL_UNIT_TYPE_CODED_SLICE_DATA_PARTITION_B: case NAL_UNIT_TYPE_CODED_SLICE_DATA_PARTITION_C: default: + bs_free(b); + free(rbsp_buf); return -1; } From 4eb49e1fcbba6f4f1eb613551dc1d1121b724634 Mon Sep 17 00:00:00 2001 From: as2120 <126.org@gmail.com> Date: Wed, 27 Dec 2017 15:18:03 +0800 Subject: [PATCH 2/9] fix memory leak : in function h264_free --- h264_nal.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/h264_nal.c b/h264_nal.c index ecaa022..0b883f8 100755 --- a/h264_nal.c +++ b/h264_nal.c @@ -88,6 +88,7 @@ void h264_free(h264_stream_t* h) } for ( int i = 0; i < 256; i++ ) { free( h->pps_table[i] ); } + free(h->pps); free(h->aud); if(h->seis != NULL) { @@ -101,9 +102,19 @@ void h264_free(h264_stream_t* h) free(h->sh); if (h->sh_svc_ext != NULL) free(h->sh_svc_ext); - + + if (h->slice_data != NULL) + { + if (h->slice_data->rbsp_buf != NULL) + { + free(h->slice_data->rbsp_buf); + } + + free(h->slice_data); + } + free(h->sps); - + free(h->sps_subset->sps); free(h->sps_subset->sps_svc_ext); free(h->sps_subset); From f0fc18b9bbf519a7b92eee0d577911da0ce24ca6 Mon Sep 17 00:00:00 2001 From: Alex Izvorski Date: Thu, 29 Mar 2018 18:08:18 -0700 Subject: [PATCH 3/9] Add howto/readme for samples --- samples/HOWTO.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 samples/HOWTO.md diff --git a/samples/HOWTO.md b/samples/HOWTO.md new file mode 100644 index 0000000..8189021 --- /dev/null +++ b/samples/HOWTO.md @@ -0,0 +1,12 @@ +Sources for samples: + +https://samples.mplayerhq.hu/V-codecs/h264/ +http://www.itec.aau.at/ftp/datasets/SVCDASHDataset2015/ + +Commands used to create some of the samples from scratch: + + ffmpeg -f lavfi -i color=c=black:s=640x480:d=0.5 test.y4m + x264 --profile high test.y4m -o test.264 + ./h264_analyze test.264 > test.out + + From 4dca82c944a586b8d0762950fedb26ed6f0da6ae Mon Sep 17 00:00:00 2001 From: Alex Izvorski Date: Thu, 29 Mar 2018 18:11:40 -0700 Subject: [PATCH 4/9] Add svc_split to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1f10187..e52b30d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ build-aux config.* configure h264_analyze +svc_split libtool m4/libtool.m4 m4/lt* From 805fc10635c3fa13526082d62e278037677f30d2 Mon Sep 17 00:00:00 2001 From: Alex Izvorski Date: Thu, 29 Mar 2018 18:31:14 -0700 Subject: [PATCH 5/9] Makefile.unix: add test; turn off code generation since code has diverged from templates --- Makefile.unix | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Makefile.unix b/Makefile.unix index 0ef3f12..b09674f 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -16,14 +16,14 @@ BINARIES = h264_analyze all: libh264bitstream.a $(BINARIES) -h264_slice_data.c: h264_slice_data.in.c process.pl - perl process.pl > h264_slice_data.c < h264_slice_data.in.c +# h264_slice_data.c: h264_slice_data.in.c process.pl +# perl process.pl > h264_slice_data.c < h264_slice_data.in.c -h264_stream.c: h264_stream.in.c process.pl - perl process.pl > h264_stream.c < h264_stream.in.c +# h264_stream.c: h264_stream.in.c process.pl +# perl process.pl > h264_stream.c < h264_stream.in.c -h264_sei.c: h264_sei.in.c process.pl - perl process.pl > h264_sei.c < h264_sei.in.c +# h264_sei.c: h264_sei.in.c process.pl +# perl process.pl > h264_sei.c < h264_sei.in.c h264_analyze: h264_analyze.o libh264bitstream.a $(LD) $(LDFLAGS) -o h264_analyze h264_analyze.o -L. -lh264bitstream -lm @@ -48,3 +48,10 @@ dist: clean tar czf ../h264bitstream-$(VERSION).tar.gz h264bitstream-$(VERSION) rm -rf h264bitstream-$(VERSION) +test: + ./h264_analyze samples/JM_cqm_cabac.264 > tmp1.out + diff -u samples/JM_cqm_cabac.out tmp1.out + ./h264_analyze samples/x264_test.264 > tmp2.out + diff -u samples/x264_test.out tmp2.out + ./h264_analyze samples/riverbed-II-360p-48961.264 > tmp3.out + diff -u samples/riverbed-II-360p-48961.out tmp3.out From 2449474c42d3e7dd38e9370d3079d6e9f0dece99 Mon Sep 17 00:00:00 2001 From: Alex Izvorski Date: Thu, 29 Mar 2018 18:42:21 -0700 Subject: [PATCH 6/9] Fix printf format warnings for difference of pointers --- h264_sei.c | 154 +++++++------- h264_stream.c | 550 +++++++++++++++++++++++++------------------------- 2 files changed, 352 insertions(+), 352 deletions(-) diff --git a/h264_sei.c b/h264_sei.c index b3aca34..4bd93de 100644 --- a/h264_sei.c +++ b/h264_sei.c @@ -494,149 +494,149 @@ void read_debug_sei_scalability_info( h264_stream_t* h, bs_t* b ) { sei_scalability_info_t* sei_svc = h->sei->sei_svc; - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->temporal_id_nesting_flag = bs_read_u1(b); printf("sei_svc->temporal_id_nesting_flag: %d \n", sei_svc->temporal_id_nesting_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->priority_layer_info_present_flag = bs_read_u1(b); printf("sei_svc->priority_layer_info_present_flag: %d \n", sei_svc->priority_layer_info_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->priority_id_setting_flag = bs_read_u1(b); printf("sei_svc->priority_id_setting_flag: %d \n", sei_svc->priority_id_setting_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->num_layers_minus1 = bs_read_ue(b); printf("sei_svc->num_layers_minus1: %d \n", sei_svc->num_layers_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->temporal_id_nesting_flag = bs_read_u1(b); printf("sei_svc->temporal_id_nesting_flag: %d \n", sei_svc->temporal_id_nesting_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->priority_layer_info_present_flag = bs_read_u1(b); printf("sei_svc->priority_layer_info_present_flag: %d \n", sei_svc->priority_layer_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->priority_id_setting_flag = bs_read_u1(b); printf("sei_svc->priority_id_setting_flag: %d \n", sei_svc->priority_id_setting_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->num_layers_minus1 = bs_read_ue(b); printf("sei_svc->num_layers_minus1: %d \n", sei_svc->num_layers_minus1); for( int i = 0; i <= sei_svc->num_layers_minus1; i++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].layer_id = bs_read_ue(b); printf("sei_svc->layers[i].layer_id: %d \n", sei_svc->layers[i].layer_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].priority_id = bs_read_u(b, 6); printf("sei_svc->layers[i].priority_id: %d \n", sei_svc->layers[i].priority_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].discardable_flag = bs_read_u1(b); printf("sei_svc->layers[i].discardable_flag: %d \n", sei_svc->layers[i].discardable_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].dependency_id = bs_read_u(b, 3); printf("sei_svc->layers[i].dependency_id: %d \n", sei_svc->layers[i].dependency_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].quality_id = bs_read_u(b, 4); printf("sei_svc->layers[i].quality_id: %d \n", sei_svc->layers[i].quality_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].temporal_id = bs_read_u(b, 3); printf("sei_svc->layers[i].temporal_id: %d \n", sei_svc->layers[i].temporal_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].sub_pic_layer_flag = bs_read_u1(b); printf("sei_svc->layers[i].sub_pic_layer_flag: %d \n", sei_svc->layers[i].sub_pic_layer_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].sub_region_layer_flag = bs_read_u1(b); printf("sei_svc->layers[i].sub_region_layer_flag: %d \n", sei_svc->layers[i].sub_region_layer_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].iroi_division_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].iroi_division_info_present_flag: %d \n", sei_svc->layers[i].iroi_division_info_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].profile_level_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].profile_level_info_present_flag: %d \n", sei_svc->layers[i].profile_level_info_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].bitrate_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].bitrate_info_present_flag: %d \n", sei_svc->layers[i].bitrate_info_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].frm_rate_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].frm_rate_info_present_flag: %d \n", sei_svc->layers[i].frm_rate_info_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].frm_size_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].frm_size_info_present_flag: %d \n", sei_svc->layers[i].frm_size_info_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].layer_dependency_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].layer_dependency_info_present_flag: %d \n", sei_svc->layers[i].layer_dependency_info_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].parameter_sets_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].parameter_sets_info_present_flag: %d \n", sei_svc->layers[i].parameter_sets_info_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].bitstream_restriction_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].bitstream_restriction_info_present_flag: %d \n", sei_svc->layers[i].bitstream_restriction_info_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].exact_inter_layer_pred_flag = bs_read_u1(b); printf("sei_svc->layers[i].exact_inter_layer_pred_flag: %d \n", sei_svc->layers[i].exact_inter_layer_pred_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].layer_id = bs_read_ue(b); printf("sei_svc->layers[i].layer_id: %d \n", sei_svc->layers[i].layer_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].priority_id = bs_read_u(b, 6); printf("sei_svc->layers[i].priority_id: %d \n", sei_svc->layers[i].priority_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].discardable_flag = bs_read_u1(b); printf("sei_svc->layers[i].discardable_flag: %d \n", sei_svc->layers[i].discardable_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].dependency_id = bs_read_u(b, 3); printf("sei_svc->layers[i].dependency_id: %d \n", sei_svc->layers[i].dependency_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].quality_id = bs_read_u(b, 4); printf("sei_svc->layers[i].quality_id: %d \n", sei_svc->layers[i].quality_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].temporal_id = bs_read_u(b, 3); printf("sei_svc->layers[i].temporal_id: %d \n", sei_svc->layers[i].temporal_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].sub_pic_layer_flag = bs_read_u1(b); printf("sei_svc->layers[i].sub_pic_layer_flag: %d \n", sei_svc->layers[i].sub_pic_layer_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].sub_region_layer_flag = bs_read_u1(b); printf("sei_svc->layers[i].sub_region_layer_flag: %d \n", sei_svc->layers[i].sub_region_layer_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].iroi_division_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].iroi_division_info_present_flag: %d \n", sei_svc->layers[i].iroi_division_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].profile_level_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].profile_level_info_present_flag: %d \n", sei_svc->layers[i].profile_level_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].bitrate_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].bitrate_info_present_flag: %d \n", sei_svc->layers[i].bitrate_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].frm_rate_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].frm_rate_info_present_flag: %d \n", sei_svc->layers[i].frm_rate_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].frm_size_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].frm_size_info_present_flag: %d \n", sei_svc->layers[i].frm_size_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].layer_dependency_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].layer_dependency_info_present_flag: %d \n", sei_svc->layers[i].layer_dependency_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].parameter_sets_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].parameter_sets_info_present_flag: %d \n", sei_svc->layers[i].parameter_sets_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].bitstream_restriction_info_present_flag = bs_read_u1(b); printf("sei_svc->layers[i].bitstream_restriction_info_present_flag: %d \n", sei_svc->layers[i].bitstream_restriction_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].exact_inter_layer_pred_flag = bs_read_u1(b); printf("sei_svc->layers[i].exact_inter_layer_pred_flag: %d \n", sei_svc->layers[i].exact_inter_layer_pred_flag); if( sei_svc->layers[i].sub_pic_layer_flag || sei_svc->layers[i].iroi_division_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].exact_sample_value_match_flag = bs_read_u1(b); printf("sei_svc->layers[i].exact_sample_value_match_flag: %d \n", sei_svc->layers[i].exact_sample_value_match_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].exact_sample_value_match_flag = bs_read_u1(b); printf("sei_svc->layers[i].exact_sample_value_match_flag: %d \n", sei_svc->layers[i].exact_sample_value_match_flag); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].layer_conversion_flag = bs_read_u1(b); printf("sei_svc->layers[i].layer_conversion_flag: %d \n", sei_svc->layers[i].layer_conversion_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].layer_output_flag = bs_read_u1(b); printf("sei_svc->layers[i].layer_output_flag: %d \n", sei_svc->layers[i].layer_output_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].layer_conversion_flag = bs_read_u1(b); printf("sei_svc->layers[i].layer_conversion_flag: %d \n", sei_svc->layers[i].layer_conversion_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].layer_output_flag = bs_read_u1(b); printf("sei_svc->layers[i].layer_output_flag: %d \n", sei_svc->layers[i].layer_output_flag); if( sei_svc->layers[i].profile_level_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].layer_profile_level_idc = bs_read_u(b, 24); printf("sei_svc->layers[i].layer_profile_level_idc: %d \n", sei_svc->layers[i].layer_profile_level_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].layer_profile_level_idc = bs_read_u(b, 24); printf("sei_svc->layers[i].layer_profile_level_idc: %d \n", sei_svc->layers[i].layer_profile_level_idc); } if( sei_svc->layers[i].bitrate_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].avg_bitrate = bs_read_u(b, 16); printf("sei_svc->layers[i].avg_bitrate: %d \n", sei_svc->layers[i].avg_bitrate); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].max_bitrate_layer = bs_read_u(b, 16); printf("sei_svc->layers[i].max_bitrate_layer: %d \n", sei_svc->layers[i].max_bitrate_layer); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].max_bitrate_layer_representation = bs_read_u(b, 16); printf("sei_svc->layers[i].max_bitrate_layer_representation: %d \n", sei_svc->layers[i].max_bitrate_layer_representation); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].max_bitrate_calc_window = bs_read_u(b, 16); printf("sei_svc->layers[i].max_bitrate_calc_window: %d \n", sei_svc->layers[i].max_bitrate_calc_window); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].avg_bitrate = bs_read_u(b, 16); printf("sei_svc->layers[i].avg_bitrate: %d \n", sei_svc->layers[i].avg_bitrate); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].max_bitrate_layer = bs_read_u(b, 16); printf("sei_svc->layers[i].max_bitrate_layer: %d \n", sei_svc->layers[i].max_bitrate_layer); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].max_bitrate_layer_representation = bs_read_u(b, 16); printf("sei_svc->layers[i].max_bitrate_layer_representation: %d \n", sei_svc->layers[i].max_bitrate_layer_representation); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].max_bitrate_calc_window = bs_read_u(b, 16); printf("sei_svc->layers[i].max_bitrate_calc_window: %d \n", sei_svc->layers[i].max_bitrate_calc_window); } if( sei_svc->layers[i].frm_rate_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].constant_frm_rate_idc = bs_read_u(b, 2); printf("sei_svc->layers[i].constant_frm_rate_idc: %d \n", sei_svc->layers[i].constant_frm_rate_idc); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].avg_frm_rate = bs_read_u(b, 16); printf("sei_svc->layers[i].avg_frm_rate: %d \n", sei_svc->layers[i].avg_frm_rate); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].constant_frm_rate_idc = bs_read_u(b, 2); printf("sei_svc->layers[i].constant_frm_rate_idc: %d \n", sei_svc->layers[i].constant_frm_rate_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].avg_frm_rate = bs_read_u(b, 16); printf("sei_svc->layers[i].avg_frm_rate: %d \n", sei_svc->layers[i].avg_frm_rate); } if( sei_svc->layers[i].frm_size_info_present_flag || sei_svc->layers[i].iroi_division_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].frm_width_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].frm_width_in_mbs_minus1: %d \n", sei_svc->layers[i].frm_width_in_mbs_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].frm_height_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].frm_height_in_mbs_minus1: %d \n", sei_svc->layers[i].frm_height_in_mbs_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].frm_width_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].frm_width_in_mbs_minus1: %d \n", sei_svc->layers[i].frm_width_in_mbs_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].frm_height_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].frm_height_in_mbs_minus1: %d \n", sei_svc->layers[i].frm_height_in_mbs_minus1); } if( sei_svc->layers[i].sub_region_layer_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].base_region_layer_id = bs_read_ue(b); printf("sei_svc->layers[i].base_region_layer_id: %d \n", sei_svc->layers[i].base_region_layer_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].dynamic_rect_flag = bs_read_u1(b); printf("sei_svc->layers[i].dynamic_rect_flag: %d \n", sei_svc->layers[i].dynamic_rect_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].base_region_layer_id = bs_read_ue(b); printf("sei_svc->layers[i].base_region_layer_id: %d \n", sei_svc->layers[i].base_region_layer_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].dynamic_rect_flag = bs_read_u1(b); printf("sei_svc->layers[i].dynamic_rect_flag: %d \n", sei_svc->layers[i].dynamic_rect_flag); if( sei_svc->layers[i].dynamic_rect_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].horizontal_offset = bs_read_u(b, 16); printf("sei_svc->layers[i].horizontal_offset: %d \n", sei_svc->layers[i].horizontal_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].vertical_offset = bs_read_u(b, 16); printf("sei_svc->layers[i].vertical_offset: %d \n", sei_svc->layers[i].vertical_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].region_width = bs_read_u(b, 16); printf("sei_svc->layers[i].region_width: %d \n", sei_svc->layers[i].region_width); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].region_height = bs_read_u(b, 16); printf("sei_svc->layers[i].region_height: %d \n", sei_svc->layers[i].region_height); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].horizontal_offset = bs_read_u(b, 16); printf("sei_svc->layers[i].horizontal_offset: %d \n", sei_svc->layers[i].horizontal_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].vertical_offset = bs_read_u(b, 16); printf("sei_svc->layers[i].vertical_offset: %d \n", sei_svc->layers[i].vertical_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].region_width = bs_read_u(b, 16); printf("sei_svc->layers[i].region_width: %d \n", sei_svc->layers[i].region_width); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].region_height = bs_read_u(b, 16); printf("sei_svc->layers[i].region_height: %d \n", sei_svc->layers[i].region_height); } } if( sei_svc->layers[i].sub_pic_layer_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].roi_id = bs_read_ue(b); printf("sei_svc->layers[i].roi_id: %d \n", sei_svc->layers[i].roi_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].roi_id = bs_read_ue(b); printf("sei_svc->layers[i].roi_id: %d \n", sei_svc->layers[i].roi_id); } if( sei_svc->layers[i].iroi_division_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].iroi_grid_flag = bs_read_u1(b); printf("sei_svc->layers[i].iroi_grid_flag: %d \n", sei_svc->layers[i].iroi_grid_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].iroi_grid_flag = bs_read_u1(b); printf("sei_svc->layers[i].iroi_grid_flag: %d \n", sei_svc->layers[i].iroi_grid_flag); if( sei_svc->layers[i].iroi_grid_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].grid_width_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].grid_width_in_mbs_minus1: %d \n", sei_svc->layers[i].grid_width_in_mbs_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].grid_height_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].grid_height_in_mbs_minus1: %d \n", sei_svc->layers[i].grid_height_in_mbs_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].grid_width_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].grid_width_in_mbs_minus1: %d \n", sei_svc->layers[i].grid_width_in_mbs_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].grid_height_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].grid_height_in_mbs_minus1: %d \n", sei_svc->layers[i].grid_height_in_mbs_minus1); } else { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].num_rois_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].num_rois_minus1: %d \n", sei_svc->layers[i].num_rois_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].num_rois_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].num_rois_minus1: %d \n", sei_svc->layers[i].num_rois_minus1); for( int j = 0; j <= sei_svc->layers[i].num_rois_minus1; j++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].roi[j].first_mb_in_roi = bs_read_ue(b); printf("sei_svc->layers[i].roi[j].first_mb_in_roi: %d \n", sei_svc->layers[i].roi[j].first_mb_in_roi); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].roi[j].roi_width_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].roi[j].roi_width_in_mbs_minus1: %d \n", sei_svc->layers[i].roi[j].roi_width_in_mbs_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].roi[j].roi_height_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].roi[j].roi_height_in_mbs_minus1: %d \n", sei_svc->layers[i].roi[j].roi_height_in_mbs_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].roi[j].first_mb_in_roi = bs_read_ue(b); printf("sei_svc->layers[i].roi[j].first_mb_in_roi: %d \n", sei_svc->layers[i].roi[j].first_mb_in_roi); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].roi[j].roi_width_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].roi[j].roi_width_in_mbs_minus1: %d \n", sei_svc->layers[i].roi[j].roi_width_in_mbs_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].roi[j].roi_height_in_mbs_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].roi[j].roi_height_in_mbs_minus1: %d \n", sei_svc->layers[i].roi[j].roi_height_in_mbs_minus1); } } } if( sei_svc->layers[i].layer_dependency_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].num_directly_dependent_layers = bs_read_ue(b); printf("sei_svc->layers[i].num_directly_dependent_layers: %d \n", sei_svc->layers[i].num_directly_dependent_layers); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].num_directly_dependent_layers = bs_read_ue(b); printf("sei_svc->layers[i].num_directly_dependent_layers: %d \n", sei_svc->layers[i].num_directly_dependent_layers); for( int j = 0; j < sei_svc->layers[i].num_directly_dependent_layers; j++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].directly_dependent_layer_id_delta_minus1[j] = bs_read_ue(b); printf("sei_svc->layers[i].directly_dependent_layer_id_delta_minus1[j]: %d \n", sei_svc->layers[i].directly_dependent_layer_id_delta_minus1[j]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].directly_dependent_layer_id_delta_minus1[j] = bs_read_ue(b); printf("sei_svc->layers[i].directly_dependent_layer_id_delta_minus1[j]: %d \n", sei_svc->layers[i].directly_dependent_layer_id_delta_minus1[j]); } } else { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].layer_dependency_info_src_layer_id_delta = bs_read_ue(b); printf("sei_svc->layers[i].layer_dependency_info_src_layer_id_delta: %d \n", sei_svc->layers[i].layer_dependency_info_src_layer_id_delta); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].layer_dependency_info_src_layer_id_delta = bs_read_ue(b); printf("sei_svc->layers[i].layer_dependency_info_src_layer_id_delta: %d \n", sei_svc->layers[i].layer_dependency_info_src_layer_id_delta); } if( sei_svc->layers[i].parameter_sets_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].num_seq_parameter_sets = bs_read_ue(b); printf("sei_svc->layers[i].num_seq_parameter_sets: %d \n", sei_svc->layers[i].num_seq_parameter_sets); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].num_seq_parameter_sets = bs_read_ue(b); printf("sei_svc->layers[i].num_seq_parameter_sets: %d \n", sei_svc->layers[i].num_seq_parameter_sets); for( int j = 0; j < sei_svc->layers[i].num_seq_parameter_sets; j++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].seq_parameter_set_id_delta[j] = bs_read_ue(b); printf("sei_svc->layers[i].seq_parameter_set_id_delta[j]: %d \n", sei_svc->layers[i].seq_parameter_set_id_delta[j]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].seq_parameter_set_id_delta[j] = bs_read_ue(b); printf("sei_svc->layers[i].seq_parameter_set_id_delta[j]: %d \n", sei_svc->layers[i].seq_parameter_set_id_delta[j]); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].num_subset_seq_parameter_sets = bs_read_ue(b); printf("sei_svc->layers[i].num_subset_seq_parameter_sets: %d \n", sei_svc->layers[i].num_subset_seq_parameter_sets); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].num_subset_seq_parameter_sets = bs_read_ue(b); printf("sei_svc->layers[i].num_subset_seq_parameter_sets: %d \n", sei_svc->layers[i].num_subset_seq_parameter_sets); for( int j = 0; j < sei_svc->layers[i].num_subset_seq_parameter_sets; j++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].subset_seq_parameter_set_id_delta[j] = bs_read_ue(b); printf("sei_svc->layers[i].subset_seq_parameter_set_id_delta[j]: %d \n", sei_svc->layers[i].subset_seq_parameter_set_id_delta[j]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].subset_seq_parameter_set_id_delta[j] = bs_read_ue(b); printf("sei_svc->layers[i].subset_seq_parameter_set_id_delta[j]: %d \n", sei_svc->layers[i].subset_seq_parameter_set_id_delta[j]); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].num_pic_parameter_sets_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].num_pic_parameter_sets_minus1: %d \n", sei_svc->layers[i].num_pic_parameter_sets_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].num_pic_parameter_sets_minus1 = bs_read_ue(b); printf("sei_svc->layers[i].num_pic_parameter_sets_minus1: %d \n", sei_svc->layers[i].num_pic_parameter_sets_minus1); for( int j = 0; j < sei_svc->layers[i].num_pic_parameter_sets_minus1; j++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].pic_parameter_set_id_delta[j] = bs_read_ue(b); printf("sei_svc->layers[i].pic_parameter_set_id_delta[j]: %d \n", sei_svc->layers[i].pic_parameter_set_id_delta[j]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].pic_parameter_set_id_delta[j] = bs_read_ue(b); printf("sei_svc->layers[i].pic_parameter_set_id_delta[j]: %d \n", sei_svc->layers[i].pic_parameter_set_id_delta[j]); } } else { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].parameter_sets_info_src_layer_id_delta = bs_read_ue(b); printf("sei_svc->layers[i].parameter_sets_info_src_layer_id_delta: %d \n", sei_svc->layers[i].parameter_sets_info_src_layer_id_delta); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].parameter_sets_info_src_layer_id_delta = bs_read_ue(b); printf("sei_svc->layers[i].parameter_sets_info_src_layer_id_delta: %d \n", sei_svc->layers[i].parameter_sets_info_src_layer_id_delta); } if( sei_svc->layers[i].bitstream_restriction_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].motion_vectors_over_pic_boundaries_flag = bs_read_u1(b); printf("sei_svc->layers[i].motion_vectors_over_pic_boundaries_flag: %d \n", sei_svc->layers[i].motion_vectors_over_pic_boundaries_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].max_bytes_per_pic_denom = bs_read_ue(b); printf("sei_svc->layers[i].max_bytes_per_pic_denom: %d \n", sei_svc->layers[i].max_bytes_per_pic_denom); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].max_bits_per_mb_denom = bs_read_ue(b); printf("sei_svc->layers[i].max_bits_per_mb_denom: %d \n", sei_svc->layers[i].max_bits_per_mb_denom); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].log2_max_mv_length_horizontal = bs_read_ue(b); printf("sei_svc->layers[i].log2_max_mv_length_horizontal: %d \n", sei_svc->layers[i].log2_max_mv_length_horizontal); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].log2_max_mv_length_vertical = bs_read_ue(b); printf("sei_svc->layers[i].log2_max_mv_length_vertical: %d \n", sei_svc->layers[i].log2_max_mv_length_vertical); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].max_num_reorder_frames = bs_read_ue(b); printf("sei_svc->layers[i].max_num_reorder_frames: %d \n", sei_svc->layers[i].max_num_reorder_frames); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].max_dec_frame_buffering = bs_read_ue(b); printf("sei_svc->layers[i].max_dec_frame_buffering: %d \n", sei_svc->layers[i].max_dec_frame_buffering); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].motion_vectors_over_pic_boundaries_flag = bs_read_u1(b); printf("sei_svc->layers[i].motion_vectors_over_pic_boundaries_flag: %d \n", sei_svc->layers[i].motion_vectors_over_pic_boundaries_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].max_bytes_per_pic_denom = bs_read_ue(b); printf("sei_svc->layers[i].max_bytes_per_pic_denom: %d \n", sei_svc->layers[i].max_bytes_per_pic_denom); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].max_bits_per_mb_denom = bs_read_ue(b); printf("sei_svc->layers[i].max_bits_per_mb_denom: %d \n", sei_svc->layers[i].max_bits_per_mb_denom); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].log2_max_mv_length_horizontal = bs_read_ue(b); printf("sei_svc->layers[i].log2_max_mv_length_horizontal: %d \n", sei_svc->layers[i].log2_max_mv_length_horizontal); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].log2_max_mv_length_vertical = bs_read_ue(b); printf("sei_svc->layers[i].log2_max_mv_length_vertical: %d \n", sei_svc->layers[i].log2_max_mv_length_vertical); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].max_num_reorder_frames = bs_read_ue(b); printf("sei_svc->layers[i].max_num_reorder_frames: %d \n", sei_svc->layers[i].max_num_reorder_frames); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].max_dec_frame_buffering = bs_read_ue(b); printf("sei_svc->layers[i].max_dec_frame_buffering: %d \n", sei_svc->layers[i].max_dec_frame_buffering); } if( sei_svc->layers[i].layer_conversion_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].conversion_type_idc = bs_read_ue(b); printf("sei_svc->layers[i].conversion_type_idc: %d \n", sei_svc->layers[i].conversion_type_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].conversion_type_idc = bs_read_ue(b); printf("sei_svc->layers[i].conversion_type_idc: %d \n", sei_svc->layers[i].conversion_type_idc); for( int j = 0; j < 2; j++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].rewriting_info_flag[j] = bs_read_u(b, 1); printf("sei_svc->layers[i].rewriting_info_flag[j]: %d \n", sei_svc->layers[i].rewriting_info_flag[j]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].rewriting_info_flag[j] = bs_read_u(b, 1); printf("sei_svc->layers[i].rewriting_info_flag[j]: %d \n", sei_svc->layers[i].rewriting_info_flag[j]); if( sei_svc->layers[i].rewriting_info_flag[j] ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].rewriting_profile_level_idc[j] = bs_read_u(b, 24); printf("sei_svc->layers[i].rewriting_profile_level_idc[j]: %d \n", sei_svc->layers[i].rewriting_profile_level_idc[j]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].rewriting_avg_bitrate[j] = bs_read_u(b, 16); printf("sei_svc->layers[i].rewriting_avg_bitrate[j]: %d \n", sei_svc->layers[i].rewriting_avg_bitrate[j]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->layers[i].rewriting_max_bitrate[j] = bs_read_u(b, 16); printf("sei_svc->layers[i].rewriting_max_bitrate[j]: %d \n", sei_svc->layers[i].rewriting_max_bitrate[j]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].rewriting_profile_level_idc[j] = bs_read_u(b, 24); printf("sei_svc->layers[i].rewriting_profile_level_idc[j]: %d \n", sei_svc->layers[i].rewriting_profile_level_idc[j]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].rewriting_avg_bitrate[j] = bs_read_u(b, 16); printf("sei_svc->layers[i].rewriting_avg_bitrate[j]: %d \n", sei_svc->layers[i].rewriting_avg_bitrate[j]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->layers[i].rewriting_max_bitrate[j] = bs_read_u(b, 16); printf("sei_svc->layers[i].rewriting_max_bitrate[j]: %d \n", sei_svc->layers[i].rewriting_max_bitrate[j]); } } } @@ -644,17 +644,17 @@ void read_debug_sei_scalability_info( h264_stream_t* h, bs_t* b ) if( sei_svc->priority_layer_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->pr_num_dIds_minus1 = bs_read_ue(b); printf("sei_svc->pr_num_dIds_minus1: %d \n", sei_svc->pr_num_dIds_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->pr_num_dIds_minus1 = bs_read_ue(b); printf("sei_svc->pr_num_dIds_minus1: %d \n", sei_svc->pr_num_dIds_minus1); for( int i = 0; i <= sei_svc->pr_num_dIds_minus1; i++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->pr[i].pr_dependency_id = bs_read_u(b, 3); printf("sei_svc->pr[i].pr_dependency_id: %d \n", sei_svc->pr[i].pr_dependency_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->pr[i].pr_num_minus1 = bs_read_ue(b); printf("sei_svc->pr[i].pr_num_minus1: %d \n", sei_svc->pr[i].pr_num_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->pr[i].pr_dependency_id = bs_read_u(b, 3); printf("sei_svc->pr[i].pr_dependency_id: %d \n", sei_svc->pr[i].pr_dependency_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->pr[i].pr_num_minus1 = bs_read_ue(b); printf("sei_svc->pr[i].pr_num_minus1: %d \n", sei_svc->pr[i].pr_num_minus1); for( int j = 0; j <= sei_svc->pr[i].pr_num_minus1; j++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->pr[i].pr_info[j].pr_id = bs_read_ue(b); printf("sei_svc->pr[i].pr_info[j].pr_id: %d \n", sei_svc->pr[i].pr_info[j].pr_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->pr[i].pr_info[j].pr_profile_level_idc = bs_read_u(b, 24); printf("sei_svc->pr[i].pr_info[j].pr_profile_level_idc: %d \n", sei_svc->pr[i].pr_info[j].pr_profile_level_idc); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->pr[i].pr_info[j].pr_avg_bitrate = bs_read_u(b, 16); printf("sei_svc->pr[i].pr_info[j].pr_avg_bitrate: %d \n", sei_svc->pr[i].pr_info[j].pr_avg_bitrate); - printf("%d.%d: ", b->p - b->start, b->bits_left); sei_svc->pr[i].pr_info[j].pr_max_bitrate = bs_read_u(b, 16); printf("sei_svc->pr[i].pr_info[j].pr_max_bitrate: %d \n", sei_svc->pr[i].pr_info[j].pr_max_bitrate); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->pr[i].pr_info[j].pr_id = bs_read_ue(b); printf("sei_svc->pr[i].pr_info[j].pr_id: %d \n", sei_svc->pr[i].pr_info[j].pr_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->pr[i].pr_info[j].pr_profile_level_idc = bs_read_u(b, 24); printf("sei_svc->pr[i].pr_info[j].pr_profile_level_idc: %d \n", sei_svc->pr[i].pr_info[j].pr_profile_level_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->pr[i].pr_info[j].pr_avg_bitrate = bs_read_u(b, 16); printf("sei_svc->pr[i].pr_info[j].pr_avg_bitrate: %d \n", sei_svc->pr[i].pr_info[j].pr_avg_bitrate); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sei_svc->pr[i].pr_info[j].pr_max_bitrate = bs_read_u(b, 16); printf("sei_svc->pr[i].pr_info[j].pr_max_bitrate: %d \n", sei_svc->pr[i].pr_info[j].pr_max_bitrate); } } @@ -684,7 +684,7 @@ void read_debug_sei_payload( h264_stream_t* h, bs_t* b ) } for ( i = 0; i < s->payloadSize; i++ ) - printf("%d.%d: ", b->p - b->start, b->bits_left); s->data[i] = bs_read_u8(b); printf("s->data[i]: %d \n", s->data[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); s->data[i] = bs_read_u8(b); printf("s->data[i]: %d \n", s->data[i]); } //if( 1 ) diff --git a/h264_stream.c b/h264_stream.c index d89a50d..e2903e4 100644 --- a/h264_stream.c +++ b/h264_stream.c @@ -2838,19 +2838,19 @@ int read_debug_nal_unit(h264_stream_t* h, uint8_t* buf, int size) } bs_t* b = bs_new(rbsp_buf, rbsp_size); - printf("%d.%d: ", b->p - b->start, b->bits_left); int forbidden_zero_bit = bs_read_u(b, 1); printf("forbidden_zero_bit: %d \n", forbidden_zero_bit); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->nal_ref_idc = bs_read_u(b, 2); printf("nal->nal_ref_idc: %d \n", nal->nal_ref_idc); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->nal_unit_type = bs_read_u(b, 5); printf("nal->nal_unit_type: %d \n", nal->nal_unit_type); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); int forbidden_zero_bit = bs_read_u(b, 1); printf("forbidden_zero_bit: %d \n", forbidden_zero_bit); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->nal_ref_idc = bs_read_u(b, 2); printf("nal->nal_ref_idc: %d \n", nal->nal_ref_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->nal_unit_type = bs_read_u(b, 5); printf("nal->nal_unit_type: %d \n", nal->nal_unit_type); if( nal->nal_unit_type == 14 || nal->nal_unit_type == 21 || nal->nal_unit_type == 20 ) { if( nal->nal_unit_type != 21 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->svc_extension_flag = bs_read_u1(b); printf("nal->svc_extension_flag: %d \n", nal->svc_extension_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->svc_extension_flag = bs_read_u1(b); printf("nal->svc_extension_flag: %d \n", nal->svc_extension_flag); } else { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->avc_3d_extension_flag = bs_read_u1(b); printf("nal->avc_3d_extension_flag: %d \n", nal->avc_3d_extension_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->avc_3d_extension_flag = bs_read_u1(b); printf("nal->avc_3d_extension_flag: %d \n", nal->avc_3d_extension_flag); } if( nal->svc_extension_flag ) @@ -2962,16 +2962,16 @@ int read_debug_nal_unit(h264_stream_t* h, uint8_t* buf, int size) //G.7.3.1.1 NAL unit header SVC extension syntax void read_debug_nal_unit_header_svc_extension(nal_svc_ext_t* nal_svc_ext, bs_t* b) { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->idr_flag = bs_read_u1(b); printf("nal_svc_ext->idr_flag: %d \n", nal_svc_ext->idr_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->priority_id = bs_read_u(b, 6); printf("nal_svc_ext->priority_id: %d \n", nal_svc_ext->priority_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->no_inter_layer_pred_flag = bs_read_u1(b); printf("nal_svc_ext->no_inter_layer_pred_flag: %d \n", nal_svc_ext->no_inter_layer_pred_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->dependency_id = bs_read_u(b, 3); printf("nal_svc_ext->dependency_id: %d \n", nal_svc_ext->dependency_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->quality_id = bs_read_u(b, 4); printf("nal_svc_ext->quality_id: %d \n", nal_svc_ext->quality_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->temporal_id = bs_read_u(b, 3); printf("nal_svc_ext->temporal_id: %d \n", nal_svc_ext->temporal_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->use_ref_base_pic_flag = bs_read_u1(b); printf("nal_svc_ext->use_ref_base_pic_flag: %d \n", nal_svc_ext->use_ref_base_pic_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->discardable_flag = bs_read_u1(b); printf("nal_svc_ext->discardable_flag: %d \n", nal_svc_ext->discardable_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->output_flag = bs_read_u1(b); printf("nal_svc_ext->output_flag: %d \n", nal_svc_ext->output_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); nal_svc_ext->reserved_three_2bits = bs_read_u(b, 2); printf("nal_svc_ext->reserved_three_2bits: %d \n", nal_svc_ext->reserved_three_2bits); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->idr_flag = bs_read_u1(b); printf("nal_svc_ext->idr_flag: %d \n", nal_svc_ext->idr_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->priority_id = bs_read_u(b, 6); printf("nal_svc_ext->priority_id: %d \n", nal_svc_ext->priority_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->no_inter_layer_pred_flag = bs_read_u1(b); printf("nal_svc_ext->no_inter_layer_pred_flag: %d \n", nal_svc_ext->no_inter_layer_pred_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->dependency_id = bs_read_u(b, 3); printf("nal_svc_ext->dependency_id: %d \n", nal_svc_ext->dependency_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->quality_id = bs_read_u(b, 4); printf("nal_svc_ext->quality_id: %d \n", nal_svc_ext->quality_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->temporal_id = bs_read_u(b, 3); printf("nal_svc_ext->temporal_id: %d \n", nal_svc_ext->temporal_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->use_ref_base_pic_flag = bs_read_u1(b); printf("nal_svc_ext->use_ref_base_pic_flag: %d \n", nal_svc_ext->use_ref_base_pic_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->discardable_flag = bs_read_u1(b); printf("nal_svc_ext->discardable_flag: %d \n", nal_svc_ext->discardable_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->output_flag = bs_read_u1(b); printf("nal_svc_ext->output_flag: %d \n", nal_svc_ext->output_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal_svc_ext->reserved_three_2bits = bs_read_u(b, 2); printf("nal_svc_ext->reserved_three_2bits: %d \n", nal_svc_ext->reserved_three_2bits); } //G.7.3.2.12.1 Prefix NAL unit SVC syntax @@ -2979,18 +2979,18 @@ void read_debug_prefix_nal_unit_svc(nal_t* nal, bs_t* b) { if( nal->nal_ref_idc != 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->prefix_nal_svc->store_ref_base_pic_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->store_ref_base_pic_flag: %d \n", nal->prefix_nal_svc->store_ref_base_pic_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->prefix_nal_svc->store_ref_base_pic_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->store_ref_base_pic_flag: %d \n", nal->prefix_nal_svc->store_ref_base_pic_flag); if( ( nal->nal_svc_ext->use_ref_base_pic_flag || nal->prefix_nal_svc->store_ref_base_pic_flag ) && !nal->nal_svc_ext->idr_flag ) { read_debug_dec_ref_base_pic_marking( nal, b ); } - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->prefix_nal_svc->additional_prefix_nal_unit_extension_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->additional_prefix_nal_unit_extension_flag: %d \n", nal->prefix_nal_svc->additional_prefix_nal_unit_extension_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->prefix_nal_svc->additional_prefix_nal_unit_extension_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->additional_prefix_nal_unit_extension_flag: %d \n", nal->prefix_nal_svc->additional_prefix_nal_unit_extension_flag); if( nal->prefix_nal_svc->additional_prefix_nal_unit_extension_flag ) { while( more_rbsp_data( b ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag: %d \n", nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag: %d \n", nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag); } } } @@ -2998,7 +2998,7 @@ void read_debug_prefix_nal_unit_svc(nal_t* nal, bs_t* b) { while( more_rbsp_data( b ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag: %d \n", nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag: %d \n", nal->prefix_nal_svc->additional_prefix_nal_unit_extension_data_flag); } } } @@ -3023,16 +3023,16 @@ void read_debug_seq_parameter_set_rbsp(sps_t* sps, bs_t* b) sps->chroma_format_idc = 1; } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->profile_idc = bs_read_u8(b); printf("sps->profile_idc: %d \n", sps->profile_idc); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->constraint_set0_flag = bs_read_u1(b); printf("sps->constraint_set0_flag: %d \n", sps->constraint_set0_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->constraint_set1_flag = bs_read_u1(b); printf("sps->constraint_set1_flag: %d \n", sps->constraint_set1_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->constraint_set2_flag = bs_read_u1(b); printf("sps->constraint_set2_flag: %d \n", sps->constraint_set2_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->constraint_set3_flag = bs_read_u1(b); printf("sps->constraint_set3_flag: %d \n", sps->constraint_set3_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->constraint_set4_flag = bs_read_u1(b); printf("sps->constraint_set4_flag: %d \n", sps->constraint_set4_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->constraint_set5_flag = bs_read_u1(b); printf("sps->constraint_set5_flag: %d \n", sps->constraint_set5_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); int reserved_zero_2bits = bs_read_u(b, 2); printf("reserved_zero_2bits: %d \n", reserved_zero_2bits); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->level_idc = bs_read_u8(b); printf("sps->level_idc: %d \n", sps->level_idc); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->seq_parameter_set_id = bs_read_ue(b); printf("sps->seq_parameter_set_id: %d \n", sps->seq_parameter_set_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->profile_idc = bs_read_u8(b); printf("sps->profile_idc: %d \n", sps->profile_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->constraint_set0_flag = bs_read_u1(b); printf("sps->constraint_set0_flag: %d \n", sps->constraint_set0_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->constraint_set1_flag = bs_read_u1(b); printf("sps->constraint_set1_flag: %d \n", sps->constraint_set1_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->constraint_set2_flag = bs_read_u1(b); printf("sps->constraint_set2_flag: %d \n", sps->constraint_set2_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->constraint_set3_flag = bs_read_u1(b); printf("sps->constraint_set3_flag: %d \n", sps->constraint_set3_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->constraint_set4_flag = bs_read_u1(b); printf("sps->constraint_set4_flag: %d \n", sps->constraint_set4_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->constraint_set5_flag = bs_read_u1(b); printf("sps->constraint_set5_flag: %d \n", sps->constraint_set5_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); int reserved_zero_2bits = bs_read_u(b, 2); printf("reserved_zero_2bits: %d \n", reserved_zero_2bits); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->level_idc = bs_read_u8(b); printf("sps->level_idc: %d \n", sps->level_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->seq_parameter_set_id = bs_read_ue(b); printf("sps->seq_parameter_set_id: %d \n", sps->seq_parameter_set_id); if( sps->profile_idc == 100 || sps->profile_idc == 110 || sps->profile_idc == 122 || sps->profile_idc == 244 || @@ -3042,20 +3042,20 @@ void read_debug_seq_parameter_set_rbsp(sps_t* sps, bs_t* b) sps->profile_idc == 139 || sps->profile_idc == 134 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->chroma_format_idc = bs_read_ue(b); printf("sps->chroma_format_idc: %d \n", sps->chroma_format_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->chroma_format_idc = bs_read_ue(b); printf("sps->chroma_format_idc: %d \n", sps->chroma_format_idc); if( sps->chroma_format_idc == 3 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->residual_colour_transform_flag = bs_read_u1(b); printf("sps->residual_colour_transform_flag: %d \n", sps->residual_colour_transform_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->residual_colour_transform_flag = bs_read_u1(b); printf("sps->residual_colour_transform_flag: %d \n", sps->residual_colour_transform_flag); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->bit_depth_luma_minus8 = bs_read_ue(b); printf("sps->bit_depth_luma_minus8: %d \n", sps->bit_depth_luma_minus8); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->bit_depth_chroma_minus8 = bs_read_ue(b); printf("sps->bit_depth_chroma_minus8: %d \n", sps->bit_depth_chroma_minus8); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->qpprime_y_zero_transform_bypass_flag = bs_read_u1(b); printf("sps->qpprime_y_zero_transform_bypass_flag: %d \n", sps->qpprime_y_zero_transform_bypass_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->seq_scaling_matrix_present_flag = bs_read_u1(b); printf("sps->seq_scaling_matrix_present_flag: %d \n", sps->seq_scaling_matrix_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->bit_depth_luma_minus8 = bs_read_ue(b); printf("sps->bit_depth_luma_minus8: %d \n", sps->bit_depth_luma_minus8); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->bit_depth_chroma_minus8 = bs_read_ue(b); printf("sps->bit_depth_chroma_minus8: %d \n", sps->bit_depth_chroma_minus8); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->qpprime_y_zero_transform_bypass_flag = bs_read_u1(b); printf("sps->qpprime_y_zero_transform_bypass_flag: %d \n", sps->qpprime_y_zero_transform_bypass_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->seq_scaling_matrix_present_flag = bs_read_u1(b); printf("sps->seq_scaling_matrix_present_flag: %d \n", sps->seq_scaling_matrix_present_flag); if( sps->seq_scaling_matrix_present_flag ) { for( i = 0; i < 8; i++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->seq_scaling_list_present_flag[ i ] = bs_read_u1(b); printf("sps->seq_scaling_list_present_flag[ i ]: %d \n", sps->seq_scaling_list_present_flag[ i ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->seq_scaling_list_present_flag[ i ] = bs_read_u1(b); printf("sps->seq_scaling_list_present_flag[ i ]: %d \n", sps->seq_scaling_list_present_flag[ i ]); if( sps->seq_scaling_list_present_flag[ i ] ) { if( i < 6 ) @@ -3072,42 +3072,42 @@ void read_debug_seq_parameter_set_rbsp(sps_t* sps, bs_t* b) } } } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->log2_max_frame_num_minus4 = bs_read_ue(b); printf("sps->log2_max_frame_num_minus4: %d \n", sps->log2_max_frame_num_minus4); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->pic_order_cnt_type = bs_read_ue(b); printf("sps->pic_order_cnt_type: %d \n", sps->pic_order_cnt_type); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->log2_max_frame_num_minus4 = bs_read_ue(b); printf("sps->log2_max_frame_num_minus4: %d \n", sps->log2_max_frame_num_minus4); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->pic_order_cnt_type = bs_read_ue(b); printf("sps->pic_order_cnt_type: %d \n", sps->pic_order_cnt_type); if( sps->pic_order_cnt_type == 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->log2_max_pic_order_cnt_lsb_minus4 = bs_read_ue(b); printf("sps->log2_max_pic_order_cnt_lsb_minus4: %d \n", sps->log2_max_pic_order_cnt_lsb_minus4); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->log2_max_pic_order_cnt_lsb_minus4 = bs_read_ue(b); printf("sps->log2_max_pic_order_cnt_lsb_minus4: %d \n", sps->log2_max_pic_order_cnt_lsb_minus4); } else if( sps->pic_order_cnt_type == 1 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->delta_pic_order_always_zero_flag = bs_read_u1(b); printf("sps->delta_pic_order_always_zero_flag: %d \n", sps->delta_pic_order_always_zero_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->offset_for_non_ref_pic = bs_read_se(b); printf("sps->offset_for_non_ref_pic: %d \n", sps->offset_for_non_ref_pic); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->offset_for_top_to_bottom_field = bs_read_se(b); printf("sps->offset_for_top_to_bottom_field: %d \n", sps->offset_for_top_to_bottom_field); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->num_ref_frames_in_pic_order_cnt_cycle = bs_read_ue(b); printf("sps->num_ref_frames_in_pic_order_cnt_cycle: %d \n", sps->num_ref_frames_in_pic_order_cnt_cycle); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->delta_pic_order_always_zero_flag = bs_read_u1(b); printf("sps->delta_pic_order_always_zero_flag: %d \n", sps->delta_pic_order_always_zero_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->offset_for_non_ref_pic = bs_read_se(b); printf("sps->offset_for_non_ref_pic: %d \n", sps->offset_for_non_ref_pic); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->offset_for_top_to_bottom_field = bs_read_se(b); printf("sps->offset_for_top_to_bottom_field: %d \n", sps->offset_for_top_to_bottom_field); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->num_ref_frames_in_pic_order_cnt_cycle = bs_read_ue(b); printf("sps->num_ref_frames_in_pic_order_cnt_cycle: %d \n", sps->num_ref_frames_in_pic_order_cnt_cycle); for( i = 0; i < sps->num_ref_frames_in_pic_order_cnt_cycle; i++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->offset_for_ref_frame[ i ] = bs_read_se(b); printf("sps->offset_for_ref_frame[ i ]: %d \n", sps->offset_for_ref_frame[ i ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->offset_for_ref_frame[ i ] = bs_read_se(b); printf("sps->offset_for_ref_frame[ i ]: %d \n", sps->offset_for_ref_frame[ i ]); } } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->num_ref_frames = bs_read_ue(b); printf("sps->num_ref_frames: %d \n", sps->num_ref_frames); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->gaps_in_frame_num_value_allowed_flag = bs_read_u1(b); printf("sps->gaps_in_frame_num_value_allowed_flag: %d \n", sps->gaps_in_frame_num_value_allowed_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->pic_width_in_mbs_minus1 = bs_read_ue(b); printf("sps->pic_width_in_mbs_minus1: %d \n", sps->pic_width_in_mbs_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->pic_height_in_map_units_minus1 = bs_read_ue(b); printf("sps->pic_height_in_map_units_minus1: %d \n", sps->pic_height_in_map_units_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->frame_mbs_only_flag = bs_read_u1(b); printf("sps->frame_mbs_only_flag: %d \n", sps->frame_mbs_only_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->num_ref_frames = bs_read_ue(b); printf("sps->num_ref_frames: %d \n", sps->num_ref_frames); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->gaps_in_frame_num_value_allowed_flag = bs_read_u1(b); printf("sps->gaps_in_frame_num_value_allowed_flag: %d \n", sps->gaps_in_frame_num_value_allowed_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->pic_width_in_mbs_minus1 = bs_read_ue(b); printf("sps->pic_width_in_mbs_minus1: %d \n", sps->pic_width_in_mbs_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->pic_height_in_map_units_minus1 = bs_read_ue(b); printf("sps->pic_height_in_map_units_minus1: %d \n", sps->pic_height_in_map_units_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->frame_mbs_only_flag = bs_read_u1(b); printf("sps->frame_mbs_only_flag: %d \n", sps->frame_mbs_only_flag); if( !sps->frame_mbs_only_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->mb_adaptive_frame_field_flag = bs_read_u1(b); printf("sps->mb_adaptive_frame_field_flag: %d \n", sps->mb_adaptive_frame_field_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->mb_adaptive_frame_field_flag = bs_read_u1(b); printf("sps->mb_adaptive_frame_field_flag: %d \n", sps->mb_adaptive_frame_field_flag); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->direct_8x8_inference_flag = bs_read_u1(b); printf("sps->direct_8x8_inference_flag: %d \n", sps->direct_8x8_inference_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->frame_cropping_flag = bs_read_u1(b); printf("sps->frame_cropping_flag: %d \n", sps->frame_cropping_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->direct_8x8_inference_flag = bs_read_u1(b); printf("sps->direct_8x8_inference_flag: %d \n", sps->direct_8x8_inference_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->frame_cropping_flag = bs_read_u1(b); printf("sps->frame_cropping_flag: %d \n", sps->frame_cropping_flag); if( sps->frame_cropping_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->frame_crop_left_offset = bs_read_ue(b); printf("sps->frame_crop_left_offset: %d \n", sps->frame_crop_left_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->frame_crop_right_offset = bs_read_ue(b); printf("sps->frame_crop_right_offset: %d \n", sps->frame_crop_right_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->frame_crop_top_offset = bs_read_ue(b); printf("sps->frame_crop_top_offset: %d \n", sps->frame_crop_top_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->frame_crop_bottom_offset = bs_read_ue(b); printf("sps->frame_crop_bottom_offset: %d \n", sps->frame_crop_bottom_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->frame_crop_left_offset = bs_read_ue(b); printf("sps->frame_crop_left_offset: %d \n", sps->frame_crop_left_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->frame_crop_right_offset = bs_read_ue(b); printf("sps->frame_crop_right_offset: %d \n", sps->frame_crop_right_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->frame_crop_top_offset = bs_read_ue(b); printf("sps->frame_crop_top_offset: %d \n", sps->frame_crop_top_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->frame_crop_bottom_offset = bs_read_ue(b); printf("sps->frame_crop_bottom_offset: %d \n", sps->frame_crop_bottom_offset); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui_parameters_present_flag = bs_read_u1(b); printf("sps->vui_parameters_present_flag: %d \n", sps->vui_parameters_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui_parameters_present_flag = bs_read_u1(b); printf("sps->vui_parameters_present_flag: %d \n", sps->vui_parameters_present_flag); if( sps->vui_parameters_present_flag ) { read_debug_vui_parameters(sps, b); @@ -3132,7 +3132,7 @@ void read_debug_scaling_list(bs_t* b, int* scalingList, int sizeOfScalingList, i delta_scale = (nextScale - lastScale) % 256 ; } - printf("%d.%d: ", b->p - b->start, b->bits_left); delta_scale = bs_read_se(b); printf("delta_scale: %d \n", delta_scale); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); delta_scale = bs_read_se(b); printf("delta_scale: %d \n", delta_scale); if( 1 ) { @@ -3160,7 +3160,7 @@ void read_debug_subset_seq_parameter_set_rbsp(sps_subset_t* sps_subset, bs_t* b) read_debug_seq_parameter_set_svc_extension(sps_subset, b); /* specified in Annex G */ sps_svc_ext_t* sps_svc_ext = sps_subset->sps_svc_ext; - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->svc_vui_parameters_present_flag = bs_read_u1(b); printf("sps_svc_ext->svc_vui_parameters_present_flag: %d \n", sps_svc_ext->svc_vui_parameters_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->svc_vui_parameters_present_flag = bs_read_u1(b); printf("sps_svc_ext->svc_vui_parameters_present_flag: %d \n", sps_svc_ext->svc_vui_parameters_present_flag); if( sps_svc_ext->svc_vui_parameters_present_flag ) { @@ -3170,12 +3170,12 @@ void read_debug_subset_seq_parameter_set_rbsp(sps_subset_t* sps_subset, bs_t* b) default: break; } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_subset->additional_extension2_flag = bs_read_u1(b); printf("sps_subset->additional_extension2_flag: %d \n", sps_subset->additional_extension2_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_subset->additional_extension2_flag = bs_read_u1(b); printf("sps_subset->additional_extension2_flag: %d \n", sps_subset->additional_extension2_flag); if( sps_subset->additional_extension2_flag ) { while( more_rbsp_data( b ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_subset->additional_extension2_flag = bs_read_u1(b); printf("sps_subset->additional_extension2_flag: %d \n", sps_subset->additional_extension2_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_subset->additional_extension2_flag = bs_read_u1(b); printf("sps_subset->additional_extension2_flag: %d \n", sps_subset->additional_extension2_flag); } } @@ -3185,59 +3185,59 @@ void read_debug_subset_seq_parameter_set_rbsp(sps_subset_t* sps_subset, bs_t* b) void read_debug_seq_parameter_set_svc_extension(sps_subset_t* sps_subset, bs_t* b) { sps_svc_ext_t* sps_svc_ext = sps_subset->sps_svc_ext; - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->inter_layer_deblocking_filter_control_present_flag = bs_read_u1(b); printf("sps_svc_ext->inter_layer_deblocking_filter_control_present_flag: %d \n", sps_svc_ext->inter_layer_deblocking_filter_control_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->extended_spatial_scalability_idc = bs_read_u(b, 2); printf("sps_svc_ext->extended_spatial_scalability_idc: %d \n", sps_svc_ext->extended_spatial_scalability_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->inter_layer_deblocking_filter_control_present_flag = bs_read_u1(b); printf("sps_svc_ext->inter_layer_deblocking_filter_control_present_flag: %d \n", sps_svc_ext->inter_layer_deblocking_filter_control_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->extended_spatial_scalability_idc = bs_read_u(b, 2); printf("sps_svc_ext->extended_spatial_scalability_idc: %d \n", sps_svc_ext->extended_spatial_scalability_idc); if( sps_subset->sps->chroma_format_idc == 1 || sps_subset->sps->chroma_format_idc == 2 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->chroma_phase_x_plus1_flag = bs_read_u1(b); printf("sps_svc_ext->chroma_phase_x_plus1_flag: %d \n", sps_svc_ext->chroma_phase_x_plus1_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->chroma_phase_x_plus1_flag = bs_read_u1(b); printf("sps_svc_ext->chroma_phase_x_plus1_flag: %d \n", sps_svc_ext->chroma_phase_x_plus1_flag); } if( sps_subset->sps->chroma_format_idc == 1 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->chroma_phase_y_plus1 = bs_read_u(b, 2); printf("sps_svc_ext->chroma_phase_y_plus1: %d \n", sps_svc_ext->chroma_phase_y_plus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->chroma_phase_y_plus1 = bs_read_u(b, 2); printf("sps_svc_ext->chroma_phase_y_plus1: %d \n", sps_svc_ext->chroma_phase_y_plus1); } if( sps_svc_ext->extended_spatial_scalability_idc ) { if( sps_subset->sps->chroma_format_idc > 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->seq_ref_layer_chroma_phase_x_plus1_flag = bs_read_u1(b); printf("sps_svc_ext->seq_ref_layer_chroma_phase_x_plus1_flag: %d \n", sps_svc_ext->seq_ref_layer_chroma_phase_x_plus1_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->seq_ref_layer_chroma_phase_y_plus1 = bs_read_u(b, 2); printf("sps_svc_ext->seq_ref_layer_chroma_phase_y_plus1: %d \n", sps_svc_ext->seq_ref_layer_chroma_phase_y_plus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->seq_ref_layer_chroma_phase_x_plus1_flag = bs_read_u1(b); printf("sps_svc_ext->seq_ref_layer_chroma_phase_x_plus1_flag: %d \n", sps_svc_ext->seq_ref_layer_chroma_phase_x_plus1_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->seq_ref_layer_chroma_phase_y_plus1 = bs_read_u(b, 2); printf("sps_svc_ext->seq_ref_layer_chroma_phase_y_plus1: %d \n", sps_svc_ext->seq_ref_layer_chroma_phase_y_plus1); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->seq_scaled_ref_layer_left_offset = bs_read_se(b); printf("sps_svc_ext->seq_scaled_ref_layer_left_offset: %d \n", sps_svc_ext->seq_scaled_ref_layer_left_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->seq_scaled_ref_layer_top_offset = bs_read_se(b); printf("sps_svc_ext->seq_scaled_ref_layer_top_offset: %d \n", sps_svc_ext->seq_scaled_ref_layer_top_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->seq_scaled_ref_layer_right_offset = bs_read_se(b); printf("sps_svc_ext->seq_scaled_ref_layer_right_offset: %d \n", sps_svc_ext->seq_scaled_ref_layer_right_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->seq_scaled_ref_layer_bottom_offset = bs_read_se(b); printf("sps_svc_ext->seq_scaled_ref_layer_bottom_offset: %d \n", sps_svc_ext->seq_scaled_ref_layer_bottom_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->seq_scaled_ref_layer_left_offset = bs_read_se(b); printf("sps_svc_ext->seq_scaled_ref_layer_left_offset: %d \n", sps_svc_ext->seq_scaled_ref_layer_left_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->seq_scaled_ref_layer_top_offset = bs_read_se(b); printf("sps_svc_ext->seq_scaled_ref_layer_top_offset: %d \n", sps_svc_ext->seq_scaled_ref_layer_top_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->seq_scaled_ref_layer_right_offset = bs_read_se(b); printf("sps_svc_ext->seq_scaled_ref_layer_right_offset: %d \n", sps_svc_ext->seq_scaled_ref_layer_right_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->seq_scaled_ref_layer_bottom_offset = bs_read_se(b); printf("sps_svc_ext->seq_scaled_ref_layer_bottom_offset: %d \n", sps_svc_ext->seq_scaled_ref_layer_bottom_offset); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->seq_tcoeff_level_prediction_flag = bs_read_u1(b); printf("sps_svc_ext->seq_tcoeff_level_prediction_flag: %d \n", sps_svc_ext->seq_tcoeff_level_prediction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->seq_tcoeff_level_prediction_flag = bs_read_u1(b); printf("sps_svc_ext->seq_tcoeff_level_prediction_flag: %d \n", sps_svc_ext->seq_tcoeff_level_prediction_flag); if( sps_svc_ext->seq_tcoeff_level_prediction_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->adaptive_tcoeff_level_prediction_flag = bs_read_u1(b); printf("sps_svc_ext->adaptive_tcoeff_level_prediction_flag: %d \n", sps_svc_ext->adaptive_tcoeff_level_prediction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->adaptive_tcoeff_level_prediction_flag = bs_read_u1(b); printf("sps_svc_ext->adaptive_tcoeff_level_prediction_flag: %d \n", sps_svc_ext->adaptive_tcoeff_level_prediction_flag); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->slice_header_restriction_flag = bs_read_u1(b); printf("sps_svc_ext->slice_header_restriction_flag: %d \n", sps_svc_ext->slice_header_restriction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->slice_header_restriction_flag = bs_read_u1(b); printf("sps_svc_ext->slice_header_restriction_flag: %d \n", sps_svc_ext->slice_header_restriction_flag); } //Appendix G.14.1 SVC VUI parameters extension syntax void read_debug_svc_vui_parameters_extension(sps_svc_ext_t* sps_svc_ext, bs_t* b) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_num_entries_minus1 = bs_read_ue(b); printf("sps_svc_ext->vui.vui_ext_num_entries_minus1: %d \n", sps_svc_ext->vui.vui_ext_num_entries_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_num_entries_minus1 = bs_read_ue(b); printf("sps_svc_ext->vui.vui_ext_num_entries_minus1: %d \n", sps_svc_ext->vui.vui_ext_num_entries_minus1); for( int i = 0; i <= sps_svc_ext->vui.vui_ext_num_entries_minus1; i++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_dependency_id[i] = bs_read_u(b, 3); printf("sps_svc_ext->vui.vui_ext_dependency_id[i]: %d \n", sps_svc_ext->vui.vui_ext_dependency_id[i]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_quality_id[i] = bs_read_u(b, 4); printf("sps_svc_ext->vui.vui_ext_quality_id[i]: %d \n", sps_svc_ext->vui.vui_ext_quality_id[i]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_temporal_id[i] = bs_read_u(b, 3); printf("sps_svc_ext->vui.vui_ext_temporal_id[i]: %d \n", sps_svc_ext->vui.vui_ext_temporal_id[i]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_timing_info_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_timing_info_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_timing_info_present_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_dependency_id[i] = bs_read_u(b, 3); printf("sps_svc_ext->vui.vui_ext_dependency_id[i]: %d \n", sps_svc_ext->vui.vui_ext_dependency_id[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_quality_id[i] = bs_read_u(b, 4); printf("sps_svc_ext->vui.vui_ext_quality_id[i]: %d \n", sps_svc_ext->vui.vui_ext_quality_id[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_temporal_id[i] = bs_read_u(b, 3); printf("sps_svc_ext->vui.vui_ext_temporal_id[i]: %d \n", sps_svc_ext->vui.vui_ext_temporal_id[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_timing_info_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_timing_info_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_timing_info_present_flag[i]); if( sps_svc_ext->vui.vui_ext_timing_info_present_flag[i] ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_num_units_in_tick[i] = bs_read_u(b, 32); printf("sps_svc_ext->vui.vui_ext_num_units_in_tick[i]: %d \n", sps_svc_ext->vui.vui_ext_num_units_in_tick[i]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_time_scale[i] = bs_read_u(b, 32); printf("sps_svc_ext->vui.vui_ext_time_scale[i]: %d \n", sps_svc_ext->vui.vui_ext_time_scale[i]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_fixed_frame_rate_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_fixed_frame_rate_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_fixed_frame_rate_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_num_units_in_tick[i] = bs_read_u(b, 32); printf("sps_svc_ext->vui.vui_ext_num_units_in_tick[i]: %d \n", sps_svc_ext->vui.vui_ext_num_units_in_tick[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_time_scale[i] = bs_read_u(b, 32); printf("sps_svc_ext->vui.vui_ext_time_scale[i]: %d \n", sps_svc_ext->vui.vui_ext_time_scale[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_fixed_frame_rate_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_fixed_frame_rate_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_fixed_frame_rate_flag[i]); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i]); if( sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] ) { read_debug_hrd_parameters(&sps_svc_ext->hrd_vcl, b); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i]); if( sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i] ) { read_debug_hrd_parameters(&sps_svc_ext->hrd_nal, b); @@ -3246,81 +3246,81 @@ void read_debug_svc_vui_parameters_extension(sps_svc_ext_t* sps_svc_ext, bs_t* b if( sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] || sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i] ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_low_delay_hrd_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_low_delay_hrd_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_low_delay_hrd_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_low_delay_hrd_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_low_delay_hrd_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_low_delay_hrd_flag[i]); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps_svc_ext->vui.vui_ext_pic_struct_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_pic_struct_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_pic_struct_present_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_pic_struct_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_pic_struct_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_pic_struct_present_flag[i]); } } //Appendix E.1.1 VUI parameters syntax void read_debug_vui_parameters(sps_t* sps, bs_t* b) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.aspect_ratio_info_present_flag = bs_read_u1(b); printf("sps->vui.aspect_ratio_info_present_flag: %d \n", sps->vui.aspect_ratio_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.aspect_ratio_info_present_flag = bs_read_u1(b); printf("sps->vui.aspect_ratio_info_present_flag: %d \n", sps->vui.aspect_ratio_info_present_flag); if( sps->vui.aspect_ratio_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.aspect_ratio_idc = bs_read_u8(b); printf("sps->vui.aspect_ratio_idc: %d \n", sps->vui.aspect_ratio_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.aspect_ratio_idc = bs_read_u8(b); printf("sps->vui.aspect_ratio_idc: %d \n", sps->vui.aspect_ratio_idc); if( sps->vui.aspect_ratio_idc == SAR_Extended ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.sar_width = bs_read_u(b, 16); printf("sps->vui.sar_width: %d \n", sps->vui.sar_width); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.sar_height = bs_read_u(b, 16); printf("sps->vui.sar_height: %d \n", sps->vui.sar_height); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.sar_width = bs_read_u(b, 16); printf("sps->vui.sar_width: %d \n", sps->vui.sar_width); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.sar_height = bs_read_u(b, 16); printf("sps->vui.sar_height: %d \n", sps->vui.sar_height); } } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.overscan_info_present_flag = bs_read_u1(b); printf("sps->vui.overscan_info_present_flag: %d \n", sps->vui.overscan_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.overscan_info_present_flag = bs_read_u1(b); printf("sps->vui.overscan_info_present_flag: %d \n", sps->vui.overscan_info_present_flag); if( sps->vui.overscan_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.overscan_appropriate_flag = bs_read_u1(b); printf("sps->vui.overscan_appropriate_flag: %d \n", sps->vui.overscan_appropriate_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.overscan_appropriate_flag = bs_read_u1(b); printf("sps->vui.overscan_appropriate_flag: %d \n", sps->vui.overscan_appropriate_flag); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.video_signal_type_present_flag = bs_read_u1(b); printf("sps->vui.video_signal_type_present_flag: %d \n", sps->vui.video_signal_type_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.video_signal_type_present_flag = bs_read_u1(b); printf("sps->vui.video_signal_type_present_flag: %d \n", sps->vui.video_signal_type_present_flag); if( sps->vui.video_signal_type_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.video_format = bs_read_u(b, 3); printf("sps->vui.video_format: %d \n", sps->vui.video_format); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.video_full_range_flag = bs_read_u1(b); printf("sps->vui.video_full_range_flag: %d \n", sps->vui.video_full_range_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.colour_description_present_flag = bs_read_u1(b); printf("sps->vui.colour_description_present_flag: %d \n", sps->vui.colour_description_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.video_format = bs_read_u(b, 3); printf("sps->vui.video_format: %d \n", sps->vui.video_format); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.video_full_range_flag = bs_read_u1(b); printf("sps->vui.video_full_range_flag: %d \n", sps->vui.video_full_range_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.colour_description_present_flag = bs_read_u1(b); printf("sps->vui.colour_description_present_flag: %d \n", sps->vui.colour_description_present_flag); if( sps->vui.colour_description_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.colour_primaries = bs_read_u8(b); printf("sps->vui.colour_primaries: %d \n", sps->vui.colour_primaries); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.transfer_characteristics = bs_read_u8(b); printf("sps->vui.transfer_characteristics: %d \n", sps->vui.transfer_characteristics); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.matrix_coefficients = bs_read_u8(b); printf("sps->vui.matrix_coefficients: %d \n", sps->vui.matrix_coefficients); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.colour_primaries = bs_read_u8(b); printf("sps->vui.colour_primaries: %d \n", sps->vui.colour_primaries); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.transfer_characteristics = bs_read_u8(b); printf("sps->vui.transfer_characteristics: %d \n", sps->vui.transfer_characteristics); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.matrix_coefficients = bs_read_u8(b); printf("sps->vui.matrix_coefficients: %d \n", sps->vui.matrix_coefficients); } } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.chroma_loc_info_present_flag = bs_read_u1(b); printf("sps->vui.chroma_loc_info_present_flag: %d \n", sps->vui.chroma_loc_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.chroma_loc_info_present_flag = bs_read_u1(b); printf("sps->vui.chroma_loc_info_present_flag: %d \n", sps->vui.chroma_loc_info_present_flag); if( sps->vui.chroma_loc_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.chroma_sample_loc_type_top_field = bs_read_ue(b); printf("sps->vui.chroma_sample_loc_type_top_field: %d \n", sps->vui.chroma_sample_loc_type_top_field); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.chroma_sample_loc_type_bottom_field = bs_read_ue(b); printf("sps->vui.chroma_sample_loc_type_bottom_field: %d \n", sps->vui.chroma_sample_loc_type_bottom_field); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.chroma_sample_loc_type_top_field = bs_read_ue(b); printf("sps->vui.chroma_sample_loc_type_top_field: %d \n", sps->vui.chroma_sample_loc_type_top_field); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.chroma_sample_loc_type_bottom_field = bs_read_ue(b); printf("sps->vui.chroma_sample_loc_type_bottom_field: %d \n", sps->vui.chroma_sample_loc_type_bottom_field); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.timing_info_present_flag = bs_read_u1(b); printf("sps->vui.timing_info_present_flag: %d \n", sps->vui.timing_info_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.timing_info_present_flag = bs_read_u1(b); printf("sps->vui.timing_info_present_flag: %d \n", sps->vui.timing_info_present_flag); if( sps->vui.timing_info_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.num_units_in_tick = bs_read_u(b, 32); printf("sps->vui.num_units_in_tick: %d \n", sps->vui.num_units_in_tick); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.time_scale = bs_read_u(b, 32); printf("sps->vui.time_scale: %d \n", sps->vui.time_scale); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.fixed_frame_rate_flag = bs_read_u1(b); printf("sps->vui.fixed_frame_rate_flag: %d \n", sps->vui.fixed_frame_rate_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.num_units_in_tick = bs_read_u(b, 32); printf("sps->vui.num_units_in_tick: %d \n", sps->vui.num_units_in_tick); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.time_scale = bs_read_u(b, 32); printf("sps->vui.time_scale: %d \n", sps->vui.time_scale); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.fixed_frame_rate_flag = bs_read_u1(b); printf("sps->vui.fixed_frame_rate_flag: %d \n", sps->vui.fixed_frame_rate_flag); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.nal_hrd_parameters_present_flag = bs_read_u1(b); printf("sps->vui.nal_hrd_parameters_present_flag: %d \n", sps->vui.nal_hrd_parameters_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.nal_hrd_parameters_present_flag = bs_read_u1(b); printf("sps->vui.nal_hrd_parameters_present_flag: %d \n", sps->vui.nal_hrd_parameters_present_flag); if( sps->vui.nal_hrd_parameters_present_flag ) { read_debug_hrd_parameters(&sps->hrd_nal, b); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.vcl_hrd_parameters_present_flag = bs_read_u1(b); printf("sps->vui.vcl_hrd_parameters_present_flag: %d \n", sps->vui.vcl_hrd_parameters_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.vcl_hrd_parameters_present_flag = bs_read_u1(b); printf("sps->vui.vcl_hrd_parameters_present_flag: %d \n", sps->vui.vcl_hrd_parameters_present_flag); if( sps->vui.vcl_hrd_parameters_present_flag ) { read_debug_hrd_parameters(&sps->hrd_vcl, b); } if( sps->vui.nal_hrd_parameters_present_flag || sps->vui.vcl_hrd_parameters_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.low_delay_hrd_flag = bs_read_u1(b); printf("sps->vui.low_delay_hrd_flag: %d \n", sps->vui.low_delay_hrd_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.low_delay_hrd_flag = bs_read_u1(b); printf("sps->vui.low_delay_hrd_flag: %d \n", sps->vui.low_delay_hrd_flag); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.pic_struct_present_flag = bs_read_u1(b); printf("sps->vui.pic_struct_present_flag: %d \n", sps->vui.pic_struct_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.bitstream_restriction_flag = bs_read_u1(b); printf("sps->vui.bitstream_restriction_flag: %d \n", sps->vui.bitstream_restriction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.pic_struct_present_flag = bs_read_u1(b); printf("sps->vui.pic_struct_present_flag: %d \n", sps->vui.pic_struct_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.bitstream_restriction_flag = bs_read_u1(b); printf("sps->vui.bitstream_restriction_flag: %d \n", sps->vui.bitstream_restriction_flag); if( sps->vui.bitstream_restriction_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.motion_vectors_over_pic_boundaries_flag = bs_read_u1(b); printf("sps->vui.motion_vectors_over_pic_boundaries_flag: %d \n", sps->vui.motion_vectors_over_pic_boundaries_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.max_bytes_per_pic_denom = bs_read_ue(b); printf("sps->vui.max_bytes_per_pic_denom: %d \n", sps->vui.max_bytes_per_pic_denom); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.max_bits_per_mb_denom = bs_read_ue(b); printf("sps->vui.max_bits_per_mb_denom: %d \n", sps->vui.max_bits_per_mb_denom); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.log2_max_mv_length_horizontal = bs_read_ue(b); printf("sps->vui.log2_max_mv_length_horizontal: %d \n", sps->vui.log2_max_mv_length_horizontal); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.log2_max_mv_length_vertical = bs_read_ue(b); printf("sps->vui.log2_max_mv_length_vertical: %d \n", sps->vui.log2_max_mv_length_vertical); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.num_reorder_frames = bs_read_ue(b); printf("sps->vui.num_reorder_frames: %d \n", sps->vui.num_reorder_frames); - printf("%d.%d: ", b->p - b->start, b->bits_left); sps->vui.max_dec_frame_buffering = bs_read_ue(b); printf("sps->vui.max_dec_frame_buffering: %d \n", sps->vui.max_dec_frame_buffering); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.motion_vectors_over_pic_boundaries_flag = bs_read_u1(b); printf("sps->vui.motion_vectors_over_pic_boundaries_flag: %d \n", sps->vui.motion_vectors_over_pic_boundaries_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.max_bytes_per_pic_denom = bs_read_ue(b); printf("sps->vui.max_bytes_per_pic_denom: %d \n", sps->vui.max_bytes_per_pic_denom); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.max_bits_per_mb_denom = bs_read_ue(b); printf("sps->vui.max_bits_per_mb_denom: %d \n", sps->vui.max_bits_per_mb_denom); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.log2_max_mv_length_horizontal = bs_read_ue(b); printf("sps->vui.log2_max_mv_length_horizontal: %d \n", sps->vui.log2_max_mv_length_horizontal); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.log2_max_mv_length_vertical = bs_read_ue(b); printf("sps->vui.log2_max_mv_length_vertical: %d \n", sps->vui.log2_max_mv_length_vertical); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.num_reorder_frames = bs_read_ue(b); printf("sps->vui.num_reorder_frames: %d \n", sps->vui.num_reorder_frames); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps->vui.max_dec_frame_buffering = bs_read_ue(b); printf("sps->vui.max_dec_frame_buffering: %d \n", sps->vui.max_dec_frame_buffering); } } @@ -3328,19 +3328,19 @@ void read_debug_vui_parameters(sps_t* sps, bs_t* b) //Appendix E.1.2 HRD parameters syntax void read_debug_hrd_parameters(hrd_t* hrd, bs_t* b) { - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->cpb_cnt_minus1 = bs_read_ue(b); printf("hrd->cpb_cnt_minus1: %d \n", hrd->cpb_cnt_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->bit_rate_scale = bs_read_u(b, 4); printf("hrd->bit_rate_scale: %d \n", hrd->bit_rate_scale); - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->cpb_size_scale = bs_read_u(b, 4); printf("hrd->cpb_size_scale: %d \n", hrd->cpb_size_scale); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->cpb_cnt_minus1 = bs_read_ue(b); printf("hrd->cpb_cnt_minus1: %d \n", hrd->cpb_cnt_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->bit_rate_scale = bs_read_u(b, 4); printf("hrd->bit_rate_scale: %d \n", hrd->bit_rate_scale); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->cpb_size_scale = bs_read_u(b, 4); printf("hrd->cpb_size_scale: %d \n", hrd->cpb_size_scale); for( int SchedSelIdx = 0; SchedSelIdx <= hrd->cpb_cnt_minus1; SchedSelIdx++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->bit_rate_value_minus1[ SchedSelIdx ] = bs_read_ue(b); printf("hrd->bit_rate_value_minus1[ SchedSelIdx ]: %d \n", hrd->bit_rate_value_minus1[ SchedSelIdx ]); - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->cpb_size_value_minus1[ SchedSelIdx ] = bs_read_ue(b); printf("hrd->cpb_size_value_minus1[ SchedSelIdx ]: %d \n", hrd->cpb_size_value_minus1[ SchedSelIdx ]); - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->cbr_flag[ SchedSelIdx ] = bs_read_u1(b); printf("hrd->cbr_flag[ SchedSelIdx ]: %d \n", hrd->cbr_flag[ SchedSelIdx ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->bit_rate_value_minus1[ SchedSelIdx ] = bs_read_ue(b); printf("hrd->bit_rate_value_minus1[ SchedSelIdx ]: %d \n", hrd->bit_rate_value_minus1[ SchedSelIdx ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->cpb_size_value_minus1[ SchedSelIdx ] = bs_read_ue(b); printf("hrd->cpb_size_value_minus1[ SchedSelIdx ]: %d \n", hrd->cpb_size_value_minus1[ SchedSelIdx ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->cbr_flag[ SchedSelIdx ] = bs_read_u1(b); printf("hrd->cbr_flag[ SchedSelIdx ]: %d \n", hrd->cbr_flag[ SchedSelIdx ]); } - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->initial_cpb_removal_delay_length_minus1 = bs_read_u(b, 5); printf("hrd->initial_cpb_removal_delay_length_minus1: %d \n", hrd->initial_cpb_removal_delay_length_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->cpb_removal_delay_length_minus1 = bs_read_u(b, 5); printf("hrd->cpb_removal_delay_length_minus1: %d \n", hrd->cpb_removal_delay_length_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->dpb_output_delay_length_minus1 = bs_read_u(b, 5); printf("hrd->dpb_output_delay_length_minus1: %d \n", hrd->dpb_output_delay_length_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); hrd->time_offset_length = bs_read_u(b, 5); printf("hrd->time_offset_length: %d \n", hrd->time_offset_length); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->initial_cpb_removal_delay_length_minus1 = bs_read_u(b, 5); printf("hrd->initial_cpb_removal_delay_length_minus1: %d \n", hrd->initial_cpb_removal_delay_length_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->cpb_removal_delay_length_minus1 = bs_read_u(b, 5); printf("hrd->cpb_removal_delay_length_minus1: %d \n", hrd->cpb_removal_delay_length_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->dpb_output_delay_length_minus1 = bs_read_u(b, 5); printf("hrd->dpb_output_delay_length_minus1: %d \n", hrd->dpb_output_delay_length_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); hrd->time_offset_length = bs_read_u(b, 5); printf("hrd->time_offset_length: %d \n", hrd->time_offset_length); } @@ -3348,15 +3348,15 @@ void read_debug_hrd_parameters(hrd_t* hrd, bs_t* b) UNIMPLEMENTED //7.3.2.1.2 Sequence parameter set extension RBSP syntax int read_debug_seq_parameter_set_extension_rbsp(bs_t* b, sps_ext_t* sps_ext) { - printf("%d.%d: ", b->p - b->start, b->bits_left); seq_parameter_set_id = bs_read_ue(b); printf("seq_parameter_set_id: %d \n", seq_parameter_set_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); aux_format_idc = bs_read_ue(b); printf("aux_format_idc: %d \n", aux_format_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); seq_parameter_set_id = bs_read_ue(b); printf("seq_parameter_set_id: %d \n", seq_parameter_set_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); aux_format_idc = bs_read_ue(b); printf("aux_format_idc: %d \n", aux_format_idc); if( aux_format_idc != 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); bit_depth_aux_minus8 = bs_read_ue(b); printf("bit_depth_aux_minus8: %d \n", bit_depth_aux_minus8); - printf("%d.%d: ", b->p - b->start, b->bits_left); alpha_incr_flag = bs_read_u1(b); printf("alpha_incr_flag: %d \n", alpha_incr_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); bit_depth_aux_minus8 = bs_read_ue(b); printf("bit_depth_aux_minus8: %d \n", bit_depth_aux_minus8); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); alpha_incr_flag = bs_read_u1(b); printf("alpha_incr_flag: %d \n", alpha_incr_flag); alpha_opaque_value = bs_read_debug_u(v); alpha_transparent_value = bs_read_debug_u(v); } - printf("%d.%d: ", b->p - b->start, b->bits_left); additional_extension_flag = bs_read_u1(b); printf("additional_extension_flag: %d \n", additional_extension_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); additional_extension_flag = bs_read_u1(b); printf("additional_extension_flag: %d \n", additional_extension_flag); read_debug_rbsp_trailing_bits(); } */ @@ -3370,57 +3370,57 @@ void read_debug_pic_parameter_set_rbsp(h264_stream_t* h, bs_t* b) memset(pps, 0, sizeof(pps_t)); } - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->pic_parameter_set_id = bs_read_ue(b); printf("pps->pic_parameter_set_id: %d \n", pps->pic_parameter_set_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->seq_parameter_set_id = bs_read_ue(b); printf("pps->seq_parameter_set_id: %d \n", pps->seq_parameter_set_id); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->entropy_coding_mode_flag = bs_read_u1(b); printf("pps->entropy_coding_mode_flag: %d \n", pps->entropy_coding_mode_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->pic_order_present_flag = bs_read_u1(b); printf("pps->pic_order_present_flag: %d \n", pps->pic_order_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->num_slice_groups_minus1 = bs_read_ue(b); printf("pps->num_slice_groups_minus1: %d \n", pps->num_slice_groups_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->pic_parameter_set_id = bs_read_ue(b); printf("pps->pic_parameter_set_id: %d \n", pps->pic_parameter_set_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->seq_parameter_set_id = bs_read_ue(b); printf("pps->seq_parameter_set_id: %d \n", pps->seq_parameter_set_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->entropy_coding_mode_flag = bs_read_u1(b); printf("pps->entropy_coding_mode_flag: %d \n", pps->entropy_coding_mode_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->pic_order_present_flag = bs_read_u1(b); printf("pps->pic_order_present_flag: %d \n", pps->pic_order_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->num_slice_groups_minus1 = bs_read_ue(b); printf("pps->num_slice_groups_minus1: %d \n", pps->num_slice_groups_minus1); if( pps->num_slice_groups_minus1 > 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->slice_group_map_type = bs_read_ue(b); printf("pps->slice_group_map_type: %d \n", pps->slice_group_map_type); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->slice_group_map_type = bs_read_ue(b); printf("pps->slice_group_map_type: %d \n", pps->slice_group_map_type); if( pps->slice_group_map_type == 0 ) { for( int i_group = 0; i_group <= pps->num_slice_groups_minus1; i_group++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->run_length_minus1[ i_group ] = bs_read_ue(b); printf("pps->run_length_minus1[ i_group ]: %d \n", pps->run_length_minus1[ i_group ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->run_length_minus1[ i_group ] = bs_read_ue(b); printf("pps->run_length_minus1[ i_group ]: %d \n", pps->run_length_minus1[ i_group ]); } } else if( pps->slice_group_map_type == 2 ) { for( int i_group = 0; i_group < pps->num_slice_groups_minus1; i_group++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->top_left[ i_group ] = bs_read_ue(b); printf("pps->top_left[ i_group ]: %d \n", pps->top_left[ i_group ]); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->bottom_right[ i_group ] = bs_read_ue(b); printf("pps->bottom_right[ i_group ]: %d \n", pps->bottom_right[ i_group ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->top_left[ i_group ] = bs_read_ue(b); printf("pps->top_left[ i_group ]: %d \n", pps->top_left[ i_group ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->bottom_right[ i_group ] = bs_read_ue(b); printf("pps->bottom_right[ i_group ]: %d \n", pps->bottom_right[ i_group ]); } } else if( pps->slice_group_map_type == 3 || pps->slice_group_map_type == 4 || pps->slice_group_map_type == 5 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->slice_group_change_direction_flag = bs_read_u1(b); printf("pps->slice_group_change_direction_flag: %d \n", pps->slice_group_change_direction_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->slice_group_change_rate_minus1 = bs_read_ue(b); printf("pps->slice_group_change_rate_minus1: %d \n", pps->slice_group_change_rate_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->slice_group_change_direction_flag = bs_read_u1(b); printf("pps->slice_group_change_direction_flag: %d \n", pps->slice_group_change_direction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->slice_group_change_rate_minus1 = bs_read_ue(b); printf("pps->slice_group_change_rate_minus1: %d \n", pps->slice_group_change_rate_minus1); } else if( pps->slice_group_map_type == 6 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->pic_size_in_map_units_minus1 = bs_read_ue(b); printf("pps->pic_size_in_map_units_minus1: %d \n", pps->pic_size_in_map_units_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->pic_size_in_map_units_minus1 = bs_read_ue(b); printf("pps->pic_size_in_map_units_minus1: %d \n", pps->pic_size_in_map_units_minus1); for( int i = 0; i <= pps->pic_size_in_map_units_minus1; i++ ) { int v = intlog2( pps->num_slice_groups_minus1 + 1 ); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->slice_group_id[ i ] = bs_read_u(b, v); printf("pps->slice_group_id[ i ]: %d \n", pps->slice_group_id[ i ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->slice_group_id[ i ] = bs_read_u(b, v); printf("pps->slice_group_id[ i ]: %d \n", pps->slice_group_id[ i ]); } } } - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->num_ref_idx_l0_active_minus1 = bs_read_ue(b); printf("pps->num_ref_idx_l0_active_minus1: %d \n", pps->num_ref_idx_l0_active_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->num_ref_idx_l1_active_minus1 = bs_read_ue(b); printf("pps->num_ref_idx_l1_active_minus1: %d \n", pps->num_ref_idx_l1_active_minus1); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->weighted_pred_flag = bs_read_u1(b); printf("pps->weighted_pred_flag: %d \n", pps->weighted_pred_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->weighted_bipred_idc = bs_read_u(b, 2); printf("pps->weighted_bipred_idc: %d \n", pps->weighted_bipred_idc); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->pic_init_qp_minus26 = bs_read_se(b); printf("pps->pic_init_qp_minus26: %d \n", pps->pic_init_qp_minus26); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->pic_init_qs_minus26 = bs_read_se(b); printf("pps->pic_init_qs_minus26: %d \n", pps->pic_init_qs_minus26); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->chroma_qp_index_offset = bs_read_se(b); printf("pps->chroma_qp_index_offset: %d \n", pps->chroma_qp_index_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->deblocking_filter_control_present_flag = bs_read_u1(b); printf("pps->deblocking_filter_control_present_flag: %d \n", pps->deblocking_filter_control_present_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->constrained_intra_pred_flag = bs_read_u1(b); printf("pps->constrained_intra_pred_flag: %d \n", pps->constrained_intra_pred_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->redundant_pic_cnt_present_flag = bs_read_u1(b); printf("pps->redundant_pic_cnt_present_flag: %d \n", pps->redundant_pic_cnt_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->num_ref_idx_l0_active_minus1 = bs_read_ue(b); printf("pps->num_ref_idx_l0_active_minus1: %d \n", pps->num_ref_idx_l0_active_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->num_ref_idx_l1_active_minus1 = bs_read_ue(b); printf("pps->num_ref_idx_l1_active_minus1: %d \n", pps->num_ref_idx_l1_active_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->weighted_pred_flag = bs_read_u1(b); printf("pps->weighted_pred_flag: %d \n", pps->weighted_pred_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->weighted_bipred_idc = bs_read_u(b, 2); printf("pps->weighted_bipred_idc: %d \n", pps->weighted_bipred_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->pic_init_qp_minus26 = bs_read_se(b); printf("pps->pic_init_qp_minus26: %d \n", pps->pic_init_qp_minus26); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->pic_init_qs_minus26 = bs_read_se(b); printf("pps->pic_init_qs_minus26: %d \n", pps->pic_init_qs_minus26); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->chroma_qp_index_offset = bs_read_se(b); printf("pps->chroma_qp_index_offset: %d \n", pps->chroma_qp_index_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->deblocking_filter_control_present_flag = bs_read_u1(b); printf("pps->deblocking_filter_control_present_flag: %d \n", pps->deblocking_filter_control_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->constrained_intra_pred_flag = bs_read_u1(b); printf("pps->constrained_intra_pred_flag: %d \n", pps->constrained_intra_pred_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->redundant_pic_cnt_present_flag = bs_read_u1(b); printf("pps->redundant_pic_cnt_present_flag: %d \n", pps->redundant_pic_cnt_present_flag); int have_more_data = 0; if( 1 ) { have_more_data = more_rbsp_data(b); } @@ -3431,13 +3431,13 @@ void read_debug_pic_parameter_set_rbsp(h264_stream_t* h, bs_t* b) if( have_more_data ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->transform_8x8_mode_flag = bs_read_u1(b); printf("pps->transform_8x8_mode_flag: %d \n", pps->transform_8x8_mode_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->pic_scaling_matrix_present_flag = bs_read_u1(b); printf("pps->pic_scaling_matrix_present_flag: %d \n", pps->pic_scaling_matrix_present_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->transform_8x8_mode_flag = bs_read_u1(b); printf("pps->transform_8x8_mode_flag: %d \n", pps->transform_8x8_mode_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->pic_scaling_matrix_present_flag = bs_read_u1(b); printf("pps->pic_scaling_matrix_present_flag: %d \n", pps->pic_scaling_matrix_present_flag); if( pps->pic_scaling_matrix_present_flag ) { for( int i = 0; i < 6 + 2* pps->transform_8x8_mode_flag; i++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->pic_scaling_list_present_flag[ i ] = bs_read_u1(b); printf("pps->pic_scaling_list_present_flag[ i ]: %d \n", pps->pic_scaling_list_present_flag[ i ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->pic_scaling_list_present_flag[ i ] = bs_read_u1(b); printf("pps->pic_scaling_list_present_flag[ i ]: %d \n", pps->pic_scaling_list_present_flag[ i ]); if( pps->pic_scaling_list_present_flag[ i ] ) { if( i < 6 ) @@ -3453,7 +3453,7 @@ void read_debug_pic_parameter_set_rbsp(h264_stream_t* h, bs_t* b) } } } - printf("%d.%d: ", b->p - b->start, b->bits_left); pps->second_chroma_qp_index_offset = bs_read_se(b); printf("pps->second_chroma_qp_index_offset: %d \n", pps->second_chroma_qp_index_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); pps->second_chroma_qp_index_offset = bs_read_se(b); printf("pps->second_chroma_qp_index_offset: %d \n", pps->second_chroma_qp_index_offset); } if( 1 ) @@ -3514,7 +3514,7 @@ void read_debug_sei_message(h264_stream_t* h, bs_t* b) //7.3.2.4 Access unit delimiter RBSP syntax void read_debug_access_unit_delimiter_rbsp(h264_stream_t* h, bs_t* b) { - printf("%d.%d: ", b->p - b->start, b->bits_left); h->aud->primary_pic_type = bs_read_u(b, 3); printf("h->aud->primary_pic_type: %d \n", h->aud->primary_pic_type); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); h->aud->primary_pic_type = bs_read_u(b, 3); printf("h->aud->primary_pic_type: %d \n", h->aud->primary_pic_type); } //7.3.2.5 End of sequence RBSP syntax @@ -3532,7 +3532,7 @@ void read_debug_filler_data_rbsp(h264_stream_t* h, bs_t* b) { while( bs_next_bits(b, 8) == 0xFF ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); int ff_byte = bs_read_u(b, 8); printf("ff_byte: %d \n", ff_byte); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); int ff_byte = bs_read_u(b, 8); printf("ff_byte: %d \n", ff_byte); } } @@ -3583,18 +3583,18 @@ slice_data_partition_a_layer_rbsp( ) { //7.3.2.9.2 Slice data partition B RBSP syntax slice_data_partition_b_layer_rbsp( ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); slice_id = bs_read_ue(b); printf("slice_id: %d \n", slice_id); // only category 3 + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); slice_id = bs_read_ue(b); printf("slice_id: %d \n", slice_id); // only category 3 if( redundant_pic_cnt_present_flag ) - printf("%d.%d: ", b->p - b->start, b->bits_left); redundant_pic_cnt = bs_read_ue(b); printf("redundant_pic_cnt: %d \n", redundant_pic_cnt); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); redundant_pic_cnt = bs_read_ue(b); printf("redundant_pic_cnt: %d \n", redundant_pic_cnt); read_debug_slice_data( ); // only category 3 read_debug_rbsp_slice_trailing_bits( ); // only category 3 } //7.3.2.9.3 Slice data partition C RBSP syntax slice_data_partition_c_layer_rbsp( ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); slice_id = bs_read_ue(b); printf("slice_id: %d \n", slice_id); // only category 4 + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); slice_id = bs_read_ue(b); printf("slice_id: %d \n", slice_id); // only category 4 if( redundant_pic_cnt_present_flag ) - printf("%d.%d: ", b->p - b->start, b->bits_left); redundant_pic_cnt = bs_read_ue(b); printf("redundant_pic_cnt: %d \n", redundant_pic_cnt); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); redundant_pic_cnt = bs_read_ue(b); printf("redundant_pic_cnt: %d \n", redundant_pic_cnt); read_debug_slice_data( ); // only category 4 rbsp_slice_trailing_bits( ); // only category 4 } @@ -3608,7 +3608,7 @@ void read_debug_rbsp_slice_trailing_bits(h264_stream_t* h, bs_t* b) { while( more_rbsp_trailing_data(h, b) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); int cabac_zero_word = bs_read_u(b, 16); printf("cabac_zero_word: %d \n", cabac_zero_word); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); int cabac_zero_word = bs_read_u(b, 16); printf("cabac_zero_word: %d \n", cabac_zero_word); } } } @@ -3616,11 +3616,11 @@ void read_debug_rbsp_slice_trailing_bits(h264_stream_t* h, bs_t* b) //7.3.2.11 RBSP trailing bits syntax void read_debug_rbsp_trailing_bits(bs_t* b) { - printf("%d.%d: ", b->p - b->start, b->bits_left); int rbsp_stop_one_bit = bs_read_u(b, 1); printf("rbsp_stop_one_bit: %d \n", rbsp_stop_one_bit); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); int rbsp_stop_one_bit = bs_read_u(b, 1); printf("rbsp_stop_one_bit: %d \n", rbsp_stop_one_bit); while( !bs_byte_aligned(b) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); int rbsp_alignment_zero_bit = bs_read_u(b, 1); printf("rbsp_alignment_zero_bit: %d \n", rbsp_alignment_zero_bit); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); int rbsp_alignment_zero_bit = bs_read_u(b, 1); printf("rbsp_alignment_zero_bit: %d \n", rbsp_alignment_zero_bit); } } @@ -3635,9 +3635,9 @@ void read_debug_slice_header(h264_stream_t* h, bs_t* b) nal_t* nal = h->nal; - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->first_mb_in_slice = bs_read_ue(b); printf("sh->first_mb_in_slice: %d \n", sh->first_mb_in_slice); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_type = bs_read_ue(b); printf("sh->slice_type: %d \n", sh->slice_type); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pic_parameter_set_id = bs_read_ue(b); printf("sh->pic_parameter_set_id: %d \n", sh->pic_parameter_set_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->first_mb_in_slice = bs_read_ue(b); printf("sh->first_mb_in_slice: %d \n", sh->first_mb_in_slice); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_type = bs_read_ue(b); printf("sh->slice_type: %d \n", sh->slice_type); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pic_parameter_set_id = bs_read_ue(b); printf("sh->pic_parameter_set_id: %d \n", sh->pic_parameter_set_id); // TODO check existence, otherwise fail pps_t* pps = h->pps; @@ -3647,55 +3647,55 @@ void read_debug_slice_header(h264_stream_t* h, bs_t* b) if (sps->residual_colour_transform_flag) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->colour_plane_id = bs_read_u(b, 2); printf("sh->colour_plane_id: %d \n", sh->colour_plane_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->colour_plane_id = bs_read_u(b, 2); printf("sh->colour_plane_id: %d \n", sh->colour_plane_id); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->frame_num = bs_read_u(b, sps->log2_max_frame_num_minus4 + 4 ); printf("sh->frame_num: %d \n", sh->frame_num); // was u(v) + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->frame_num = bs_read_u(b, sps->log2_max_frame_num_minus4 + 4 ); printf("sh->frame_num: %d \n", sh->frame_num); // was u(v) if( !sps->frame_mbs_only_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->field_pic_flag = bs_read_u1(b); printf("sh->field_pic_flag: %d \n", sh->field_pic_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->field_pic_flag = bs_read_u1(b); printf("sh->field_pic_flag: %d \n", sh->field_pic_flag); if( sh->field_pic_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->bottom_field_flag = bs_read_u1(b); printf("sh->bottom_field_flag: %d \n", sh->bottom_field_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->bottom_field_flag = bs_read_u1(b); printf("sh->bottom_field_flag: %d \n", sh->bottom_field_flag); } } if( nal->nal_unit_type == 5 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->idr_pic_id = bs_read_ue(b); printf("sh->idr_pic_id: %d \n", sh->idr_pic_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->idr_pic_id = bs_read_ue(b); printf("sh->idr_pic_id: %d \n", sh->idr_pic_id); } if( sps->pic_order_cnt_type == 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pic_order_cnt_lsb = bs_read_u(b, sps->log2_max_pic_order_cnt_lsb_minus4 + 4 ); printf("sh->pic_order_cnt_lsb: %d \n", sh->pic_order_cnt_lsb); // was u(v) + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pic_order_cnt_lsb = bs_read_u(b, sps->log2_max_pic_order_cnt_lsb_minus4 + 4 ); printf("sh->pic_order_cnt_lsb: %d \n", sh->pic_order_cnt_lsb); // was u(v) if( pps->pic_order_present_flag && !sh->field_pic_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->delta_pic_order_cnt_bottom = bs_read_se(b); printf("sh->delta_pic_order_cnt_bottom: %d \n", sh->delta_pic_order_cnt_bottom); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->delta_pic_order_cnt_bottom = bs_read_se(b); printf("sh->delta_pic_order_cnt_bottom: %d \n", sh->delta_pic_order_cnt_bottom); } } if( sps->pic_order_cnt_type == 1 && !sps->delta_pic_order_always_zero_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->delta_pic_order_cnt[ 0 ] = bs_read_se(b); printf("sh->delta_pic_order_cnt[ 0 ]: %d \n", sh->delta_pic_order_cnt[ 0 ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->delta_pic_order_cnt[ 0 ] = bs_read_se(b); printf("sh->delta_pic_order_cnt[ 0 ]: %d \n", sh->delta_pic_order_cnt[ 0 ]); if( pps->pic_order_present_flag && !sh->field_pic_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->delta_pic_order_cnt[ 1 ] = bs_read_se(b); printf("sh->delta_pic_order_cnt[ 1 ]: %d \n", sh->delta_pic_order_cnt[ 1 ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->delta_pic_order_cnt[ 1 ] = bs_read_se(b); printf("sh->delta_pic_order_cnt[ 1 ]: %d \n", sh->delta_pic_order_cnt[ 1 ]); } } if( pps->redundant_pic_cnt_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->redundant_pic_cnt = bs_read_ue(b); printf("sh->redundant_pic_cnt: %d \n", sh->redundant_pic_cnt); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->redundant_pic_cnt = bs_read_ue(b); printf("sh->redundant_pic_cnt: %d \n", sh->redundant_pic_cnt); } if( is_slice_type( sh->slice_type, SH_SLICE_TYPE_B ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->direct_spatial_mv_pred_flag = bs_read_u1(b); printf("sh->direct_spatial_mv_pred_flag: %d \n", sh->direct_spatial_mv_pred_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->direct_spatial_mv_pred_flag = bs_read_u1(b); printf("sh->direct_spatial_mv_pred_flag: %d \n", sh->direct_spatial_mv_pred_flag); } if( is_slice_type( sh->slice_type, SH_SLICE_TYPE_P ) || is_slice_type( sh->slice_type, SH_SLICE_TYPE_SP ) || is_slice_type( sh->slice_type, SH_SLICE_TYPE_B ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->num_ref_idx_active_override_flag = bs_read_u1(b); printf("sh->num_ref_idx_active_override_flag: %d \n", sh->num_ref_idx_active_override_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->num_ref_idx_active_override_flag = bs_read_u1(b); printf("sh->num_ref_idx_active_override_flag: %d \n", sh->num_ref_idx_active_override_flag); if( sh->num_ref_idx_active_override_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->num_ref_idx_l0_active_minus1 = bs_read_ue(b); printf("sh->num_ref_idx_l0_active_minus1: %d \n", sh->num_ref_idx_l0_active_minus1); // FIXME does this modify the pps? + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->num_ref_idx_l0_active_minus1 = bs_read_ue(b); printf("sh->num_ref_idx_l0_active_minus1: %d \n", sh->num_ref_idx_l0_active_minus1); // FIXME does this modify the pps? if( is_slice_type( sh->slice_type, SH_SLICE_TYPE_B ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->num_ref_idx_l1_active_minus1 = bs_read_ue(b); printf("sh->num_ref_idx_l1_active_minus1: %d \n", sh->num_ref_idx_l1_active_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->num_ref_idx_l1_active_minus1 = bs_read_ue(b); printf("sh->num_ref_idx_l1_active_minus1: %d \n", sh->num_ref_idx_l1_active_minus1); } } } @@ -3711,31 +3711,31 @@ void read_debug_slice_header(h264_stream_t* h, bs_t* b) } if( pps->entropy_coding_mode_flag && ! is_slice_type( sh->slice_type, SH_SLICE_TYPE_I ) && ! is_slice_type( sh->slice_type, SH_SLICE_TYPE_SI ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->cabac_init_idc = bs_read_ue(b); printf("sh->cabac_init_idc: %d \n", sh->cabac_init_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->cabac_init_idc = bs_read_ue(b); printf("sh->cabac_init_idc: %d \n", sh->cabac_init_idc); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_qp_delta = bs_read_se(b); printf("sh->slice_qp_delta: %d \n", sh->slice_qp_delta); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_qp_delta = bs_read_se(b); printf("sh->slice_qp_delta: %d \n", sh->slice_qp_delta); if( is_slice_type( sh->slice_type, SH_SLICE_TYPE_SP ) || is_slice_type( sh->slice_type, SH_SLICE_TYPE_SI ) ) { if( is_slice_type( sh->slice_type, SH_SLICE_TYPE_SP ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->sp_for_switch_flag = bs_read_u1(b); printf("sh->sp_for_switch_flag: %d \n", sh->sp_for_switch_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->sp_for_switch_flag = bs_read_u1(b); printf("sh->sp_for_switch_flag: %d \n", sh->sp_for_switch_flag); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_qs_delta = bs_read_se(b); printf("sh->slice_qs_delta: %d \n", sh->slice_qs_delta); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_qs_delta = bs_read_se(b); printf("sh->slice_qs_delta: %d \n", sh->slice_qs_delta); } if( pps->deblocking_filter_control_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->disable_deblocking_filter_idc = bs_read_ue(b); printf("sh->disable_deblocking_filter_idc: %d \n", sh->disable_deblocking_filter_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->disable_deblocking_filter_idc = bs_read_ue(b); printf("sh->disable_deblocking_filter_idc: %d \n", sh->disable_deblocking_filter_idc); if( sh->disable_deblocking_filter_idc != 1 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_alpha_c0_offset_div2 = bs_read_se(b); printf("sh->slice_alpha_c0_offset_div2: %d \n", sh->slice_alpha_c0_offset_div2); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_beta_offset_div2 = bs_read_se(b); printf("sh->slice_beta_offset_div2: %d \n", sh->slice_beta_offset_div2); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_alpha_c0_offset_div2 = bs_read_se(b); printf("sh->slice_alpha_c0_offset_div2: %d \n", sh->slice_alpha_c0_offset_div2); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_beta_offset_div2 = bs_read_se(b); printf("sh->slice_beta_offset_div2: %d \n", sh->slice_beta_offset_div2); } } if( pps->num_slice_groups_minus1 > 0 && pps->slice_group_map_type >= 3 && pps->slice_group_map_type <= 5) { int v = intlog2( pps->pic_size_in_map_units_minus1 + pps->slice_group_change_rate_minus1 + 1 ); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_group_change_cycle = bs_read_u(b, v); printf("sh->slice_group_change_cycle: %d \n", sh->slice_group_change_cycle); // FIXME add 2? + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_group_change_cycle = bs_read_u(b, v); printf("sh->slice_group_change_cycle: %d \n", sh->slice_group_change_cycle); // FIXME add 2? } } @@ -3747,44 +3747,44 @@ void read_debug_ref_pic_list_reordering(h264_stream_t* h, bs_t* b) if( ! is_slice_type( sh->slice_type, SH_SLICE_TYPE_I ) && ! is_slice_type( sh->slice_type, SH_SLICE_TYPE_SI ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->rplr.ref_pic_list_reordering_flag_l0 = bs_read_u1(b); printf("sh->rplr.ref_pic_list_reordering_flag_l0: %d \n", sh->rplr.ref_pic_list_reordering_flag_l0); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->rplr.ref_pic_list_reordering_flag_l0 = bs_read_u1(b); printf("sh->rplr.ref_pic_list_reordering_flag_l0: %d \n", sh->rplr.ref_pic_list_reordering_flag_l0); if( sh->rplr.ref_pic_list_reordering_flag_l0 ) { int n = -1; do { n++; - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ]: %d \n", sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ]: %d \n", sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ]); if( sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ] == 0 || sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ] == 1 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->rplr.reorder_l0.abs_diff_pic_num_minus1[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l0.abs_diff_pic_num_minus1[ n ]: %d \n", sh->rplr.reorder_l0.abs_diff_pic_num_minus1[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->rplr.reorder_l0.abs_diff_pic_num_minus1[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l0.abs_diff_pic_num_minus1[ n ]: %d \n", sh->rplr.reorder_l0.abs_diff_pic_num_minus1[ n ]); } else if( sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ] == 2 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->rplr.reorder_l0.long_term_pic_num[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l0.long_term_pic_num[ n ]: %d \n", sh->rplr.reorder_l0.long_term_pic_num[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->rplr.reorder_l0.long_term_pic_num[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l0.long_term_pic_num[ n ]: %d \n", sh->rplr.reorder_l0.long_term_pic_num[ n ]); } } while( sh->rplr.reorder_l0.reordering_of_pic_nums_idc[ n ] != 3 && ! bs_eof(b) ); } } if( is_slice_type( sh->slice_type, SH_SLICE_TYPE_B ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->rplr.ref_pic_list_reordering_flag_l1 = bs_read_u1(b); printf("sh->rplr.ref_pic_list_reordering_flag_l1: %d \n", sh->rplr.ref_pic_list_reordering_flag_l1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->rplr.ref_pic_list_reordering_flag_l1 = bs_read_u1(b); printf("sh->rplr.ref_pic_list_reordering_flag_l1: %d \n", sh->rplr.ref_pic_list_reordering_flag_l1); if( sh->rplr.ref_pic_list_reordering_flag_l1 ) { int n = -1; do { n++; - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ]: %d \n", sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ]: %d \n", sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ]); if( sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ] == 0 || sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ] == 1 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->rplr.reorder_l1.abs_diff_pic_num_minus1[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l1.abs_diff_pic_num_minus1[ n ]: %d \n", sh->rplr.reorder_l1.abs_diff_pic_num_minus1[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->rplr.reorder_l1.abs_diff_pic_num_minus1[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l1.abs_diff_pic_num_minus1[ n ]: %d \n", sh->rplr.reorder_l1.abs_diff_pic_num_minus1[ n ]); } else if( sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ] == 2 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->rplr.reorder_l1.long_term_pic_num[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l1.long_term_pic_num[ n ]: %d \n", sh->rplr.reorder_l1.long_term_pic_num[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->rplr.reorder_l1.long_term_pic_num[ n ] = bs_read_ue(b); printf("sh->rplr.reorder_l1.long_term_pic_num[ n ]: %d \n", sh->rplr.reorder_l1.long_term_pic_num[ n ]); } } while( sh->rplr.reorder_l1.reordering_of_pic_nums_idc[ n ] != 3 && ! bs_eof(b) ); } @@ -3800,28 +3800,28 @@ void read_debug_pred_weight_table(h264_stream_t* h, bs_t* b) int i, j; - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.luma_log2_weight_denom = bs_read_ue(b); printf("sh->pwt.luma_log2_weight_denom: %d \n", sh->pwt.luma_log2_weight_denom); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.luma_log2_weight_denom = bs_read_ue(b); printf("sh->pwt.luma_log2_weight_denom: %d \n", sh->pwt.luma_log2_weight_denom); if( sps->chroma_format_idc != 0 ) //FIXME ChromaArrayType may differ from chroma_format_idc { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.chroma_log2_weight_denom = bs_read_ue(b); printf("sh->pwt.chroma_log2_weight_denom: %d \n", sh->pwt.chroma_log2_weight_denom); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.chroma_log2_weight_denom = bs_read_ue(b); printf("sh->pwt.chroma_log2_weight_denom: %d \n", sh->pwt.chroma_log2_weight_denom); } for( i = 0; i <= pps->num_ref_idx_l0_active_minus1; i++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.luma_weight_l0_flag[i] = bs_read_u1(b); printf("sh->pwt.luma_weight_l0_flag[i]: %d \n", sh->pwt.luma_weight_l0_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.luma_weight_l0_flag[i] = bs_read_u1(b); printf("sh->pwt.luma_weight_l0_flag[i]: %d \n", sh->pwt.luma_weight_l0_flag[i]); if( sh->pwt.luma_weight_l0_flag[i] ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.luma_weight_l0[ i ] = bs_read_se(b); printf("sh->pwt.luma_weight_l0[ i ]: %d \n", sh->pwt.luma_weight_l0[ i ]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.luma_offset_l0[ i ] = bs_read_se(b); printf("sh->pwt.luma_offset_l0[ i ]: %d \n", sh->pwt.luma_offset_l0[ i ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.luma_weight_l0[ i ] = bs_read_se(b); printf("sh->pwt.luma_weight_l0[ i ]: %d \n", sh->pwt.luma_weight_l0[ i ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.luma_offset_l0[ i ] = bs_read_se(b); printf("sh->pwt.luma_offset_l0[ i ]: %d \n", sh->pwt.luma_offset_l0[ i ]); } if ( sps->chroma_format_idc != 0 ) //FIXME ChromaArrayType may differ from chroma_format_idc { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.chroma_weight_l0_flag[i] = bs_read_u1(b); printf("sh->pwt.chroma_weight_l0_flag[i]: %d \n", sh->pwt.chroma_weight_l0_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.chroma_weight_l0_flag[i] = bs_read_u1(b); printf("sh->pwt.chroma_weight_l0_flag[i]: %d \n", sh->pwt.chroma_weight_l0_flag[i]); if( sh->pwt.chroma_weight_l0_flag[i] ) { for( j =0; j < 2; j++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.chroma_weight_l0[ i ][ j ] = bs_read_se(b); printf("sh->pwt.chroma_weight_l0[ i ][ j ]: %d \n", sh->pwt.chroma_weight_l0[ i ][ j ]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.chroma_offset_l0[ i ][ j ] = bs_read_se(b); printf("sh->pwt.chroma_offset_l0[ i ][ j ]: %d \n", sh->pwt.chroma_offset_l0[ i ][ j ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.chroma_weight_l0[ i ][ j ] = bs_read_se(b); printf("sh->pwt.chroma_weight_l0[ i ][ j ]: %d \n", sh->pwt.chroma_weight_l0[ i ][ j ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.chroma_offset_l0[ i ][ j ] = bs_read_se(b); printf("sh->pwt.chroma_offset_l0[ i ][ j ]: %d \n", sh->pwt.chroma_offset_l0[ i ][ j ]); } } } @@ -3830,21 +3830,21 @@ void read_debug_pred_weight_table(h264_stream_t* h, bs_t* b) { for( i = 0; i <= pps->num_ref_idx_l1_active_minus1; i++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.luma_weight_l1_flag[i] = bs_read_u1(b); printf("sh->pwt.luma_weight_l1_flag[i]: %d \n", sh->pwt.luma_weight_l1_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.luma_weight_l1_flag[i] = bs_read_u1(b); printf("sh->pwt.luma_weight_l1_flag[i]: %d \n", sh->pwt.luma_weight_l1_flag[i]); if( sh->pwt.luma_weight_l1_flag[i] ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.luma_weight_l1[ i ] = bs_read_se(b); printf("sh->pwt.luma_weight_l1[ i ]: %d \n", sh->pwt.luma_weight_l1[ i ]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.luma_offset_l1[ i ] = bs_read_se(b); printf("sh->pwt.luma_offset_l1[ i ]: %d \n", sh->pwt.luma_offset_l1[ i ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.luma_weight_l1[ i ] = bs_read_se(b); printf("sh->pwt.luma_weight_l1[ i ]: %d \n", sh->pwt.luma_weight_l1[ i ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.luma_offset_l1[ i ] = bs_read_se(b); printf("sh->pwt.luma_offset_l1[ i ]: %d \n", sh->pwt.luma_offset_l1[ i ]); } if( sps->chroma_format_idc != 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.chroma_weight_l1_flag[i] = bs_read_u1(b); printf("sh->pwt.chroma_weight_l1_flag[i]: %d \n", sh->pwt.chroma_weight_l1_flag[i]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.chroma_weight_l1_flag[i] = bs_read_u1(b); printf("sh->pwt.chroma_weight_l1_flag[i]: %d \n", sh->pwt.chroma_weight_l1_flag[i]); if( sh->pwt.chroma_weight_l1_flag[i] ) { for( j = 0; j < 2; j++ ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.chroma_weight_l1[ i ][ j ] = bs_read_se(b); printf("sh->pwt.chroma_weight_l1[ i ][ j ]: %d \n", sh->pwt.chroma_weight_l1[ i ][ j ]); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pwt.chroma_offset_l1[ i ][ j ] = bs_read_se(b); printf("sh->pwt.chroma_offset_l1[ i ][ j ]: %d \n", sh->pwt.chroma_offset_l1[ i ][ j ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.chroma_weight_l1[ i ][ j ] = bs_read_se(b); printf("sh->pwt.chroma_weight_l1[ i ][ j ]: %d \n", sh->pwt.chroma_weight_l1[ i ][ j ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pwt.chroma_offset_l1[ i ][ j ] = bs_read_se(b); printf("sh->pwt.chroma_offset_l1[ i ][ j ]: %d \n", sh->pwt.chroma_offset_l1[ i ][ j ]); } } } @@ -3860,36 +3860,36 @@ void read_debug_dec_ref_pic_marking(h264_stream_t* h, bs_t* b) if( h->nal->nal_unit_type == 5 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->drpm.no_output_of_prior_pics_flag = bs_read_u1(b); printf("sh->drpm.no_output_of_prior_pics_flag: %d \n", sh->drpm.no_output_of_prior_pics_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->drpm.long_term_reference_flag = bs_read_u1(b); printf("sh->drpm.long_term_reference_flag: %d \n", sh->drpm.long_term_reference_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->drpm.no_output_of_prior_pics_flag = bs_read_u1(b); printf("sh->drpm.no_output_of_prior_pics_flag: %d \n", sh->drpm.no_output_of_prior_pics_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->drpm.long_term_reference_flag = bs_read_u1(b); printf("sh->drpm.long_term_reference_flag: %d \n", sh->drpm.long_term_reference_flag); } else { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->drpm.adaptive_ref_pic_marking_mode_flag = bs_read_u1(b); printf("sh->drpm.adaptive_ref_pic_marking_mode_flag: %d \n", sh->drpm.adaptive_ref_pic_marking_mode_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->drpm.adaptive_ref_pic_marking_mode_flag = bs_read_u1(b); printf("sh->drpm.adaptive_ref_pic_marking_mode_flag: %d \n", sh->drpm.adaptive_ref_pic_marking_mode_flag); if( sh->drpm.adaptive_ref_pic_marking_mode_flag ) { int n = -1; do { n++; - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->drpm.memory_management_control_operation[ n ] = bs_read_ue(b); printf("sh->drpm.memory_management_control_operation[ n ]: %d \n", sh->drpm.memory_management_control_operation[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->drpm.memory_management_control_operation[ n ] = bs_read_ue(b); printf("sh->drpm.memory_management_control_operation[ n ]: %d \n", sh->drpm.memory_management_control_operation[ n ]); if( sh->drpm.memory_management_control_operation[ n ] == 1 || sh->drpm.memory_management_control_operation[ n ] == 3 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->drpm.difference_of_pic_nums_minus1[ n ] = bs_read_ue(b); printf("sh->drpm.difference_of_pic_nums_minus1[ n ]: %d \n", sh->drpm.difference_of_pic_nums_minus1[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->drpm.difference_of_pic_nums_minus1[ n ] = bs_read_ue(b); printf("sh->drpm.difference_of_pic_nums_minus1[ n ]: %d \n", sh->drpm.difference_of_pic_nums_minus1[ n ]); } if(sh->drpm.memory_management_control_operation[ n ] == 2 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->drpm.long_term_pic_num[ n ] = bs_read_ue(b); printf("sh->drpm.long_term_pic_num[ n ]: %d \n", sh->drpm.long_term_pic_num[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->drpm.long_term_pic_num[ n ] = bs_read_ue(b); printf("sh->drpm.long_term_pic_num[ n ]: %d \n", sh->drpm.long_term_pic_num[ n ]); } if( sh->drpm.memory_management_control_operation[ n ] == 3 || sh->drpm.memory_management_control_operation[ n ] == 6 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->drpm.long_term_frame_idx[ n ] = bs_read_ue(b); printf("sh->drpm.long_term_frame_idx[ n ]: %d \n", sh->drpm.long_term_frame_idx[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->drpm.long_term_frame_idx[ n ] = bs_read_ue(b); printf("sh->drpm.long_term_frame_idx[ n ]: %d \n", sh->drpm.long_term_frame_idx[ n ]); } if( sh->drpm.memory_management_control_operation[ n ] == 4 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->drpm.max_long_term_frame_idx_plus1[ n ] = bs_read_ue(b); printf("sh->drpm.max_long_term_frame_idx_plus1[ n ]: %d \n", sh->drpm.max_long_term_frame_idx_plus1[ n ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->drpm.max_long_term_frame_idx_plus1[ n ] = bs_read_ue(b); printf("sh->drpm.max_long_term_frame_idx_plus1[ n ]: %d \n", sh->drpm.max_long_term_frame_idx_plus1[ n ]); } } while( sh->drpm.memory_management_control_operation[ n ] != 0 && ! bs_eof(b) ); } @@ -3909,9 +3909,9 @@ void read_debug_slice_header_in_scalable_extension(h264_stream_t* h, bs_t* b) nal_t* nal = h->nal; - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->first_mb_in_slice = bs_read_ue(b); printf("sh->first_mb_in_slice: %d \n", sh->first_mb_in_slice); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_type = bs_read_ue(b); printf("sh->slice_type: %d \n", sh->slice_type); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pic_parameter_set_id = bs_read_ue(b); printf("sh->pic_parameter_set_id: %d \n", sh->pic_parameter_set_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->first_mb_in_slice = bs_read_ue(b); printf("sh->first_mb_in_slice: %d \n", sh->first_mb_in_slice); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_type = bs_read_ue(b); printf("sh->slice_type: %d \n", sh->slice_type); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pic_parameter_set_id = bs_read_ue(b); printf("sh->pic_parameter_set_id: %d \n", sh->pic_parameter_set_id); // TODO check existence, otherwise fail pps_t* pps = h->pps; @@ -3923,58 +3923,58 @@ void read_debug_slice_header_in_scalable_extension(h264_stream_t* h, bs_t* b) if (sps_subset->sps->residual_colour_transform_flag) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->colour_plane_id = bs_read_u(b, 2); printf("sh->colour_plane_id: %d \n", sh->colour_plane_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->colour_plane_id = bs_read_u(b, 2); printf("sh->colour_plane_id: %d \n", sh->colour_plane_id); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->frame_num = bs_read_u(b, sps_subset->sps->log2_max_frame_num_minus4 + 4 ); printf("sh->frame_num: %d \n", sh->frame_num); // was u(v) + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->frame_num = bs_read_u(b, sps_subset->sps->log2_max_frame_num_minus4 + 4 ); printf("sh->frame_num: %d \n", sh->frame_num); // was u(v) if( !sps_subset->sps->frame_mbs_only_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->field_pic_flag = bs_read_u1(b); printf("sh->field_pic_flag: %d \n", sh->field_pic_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->field_pic_flag = bs_read_u1(b); printf("sh->field_pic_flag: %d \n", sh->field_pic_flag); if( sh->field_pic_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->bottom_field_flag = bs_read_u1(b); printf("sh->bottom_field_flag: %d \n", sh->bottom_field_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->bottom_field_flag = bs_read_u1(b); printf("sh->bottom_field_flag: %d \n", sh->bottom_field_flag); } } if( nal->nal_unit_type == 5 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->idr_pic_id = bs_read_ue(b); printf("sh->idr_pic_id: %d \n", sh->idr_pic_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->idr_pic_id = bs_read_ue(b); printf("sh->idr_pic_id: %d \n", sh->idr_pic_id); } if( sps_subset->sps->pic_order_cnt_type == 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->pic_order_cnt_lsb = bs_read_u(b, sps_subset->sps->log2_max_pic_order_cnt_lsb_minus4 + 4 ); printf("sh->pic_order_cnt_lsb: %d \n", sh->pic_order_cnt_lsb); // was u(v) + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->pic_order_cnt_lsb = bs_read_u(b, sps_subset->sps->log2_max_pic_order_cnt_lsb_minus4 + 4 ); printf("sh->pic_order_cnt_lsb: %d \n", sh->pic_order_cnt_lsb); // was u(v) if( pps->pic_order_present_flag && !sh->field_pic_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->delta_pic_order_cnt_bottom = bs_read_se(b); printf("sh->delta_pic_order_cnt_bottom: %d \n", sh->delta_pic_order_cnt_bottom); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->delta_pic_order_cnt_bottom = bs_read_se(b); printf("sh->delta_pic_order_cnt_bottom: %d \n", sh->delta_pic_order_cnt_bottom); } } if( sps_subset->sps->pic_order_cnt_type == 1 && !sps_subset->sps->delta_pic_order_always_zero_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->delta_pic_order_cnt[ 0 ] = bs_read_se(b); printf("sh->delta_pic_order_cnt[ 0 ]: %d \n", sh->delta_pic_order_cnt[ 0 ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->delta_pic_order_cnt[ 0 ] = bs_read_se(b); printf("sh->delta_pic_order_cnt[ 0 ]: %d \n", sh->delta_pic_order_cnt[ 0 ]); if( pps->pic_order_present_flag && !sh->field_pic_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->delta_pic_order_cnt[ 1 ] = bs_read_se(b); printf("sh->delta_pic_order_cnt[ 1 ]: %d \n", sh->delta_pic_order_cnt[ 1 ]); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->delta_pic_order_cnt[ 1 ] = bs_read_se(b); printf("sh->delta_pic_order_cnt[ 1 ]: %d \n", sh->delta_pic_order_cnt[ 1 ]); } } if( pps->redundant_pic_cnt_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->redundant_pic_cnt = bs_read_ue(b); printf("sh->redundant_pic_cnt: %d \n", sh->redundant_pic_cnt); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->redundant_pic_cnt = bs_read_ue(b); printf("sh->redundant_pic_cnt: %d \n", sh->redundant_pic_cnt); } if( nal->nal_svc_ext->quality_id == 0) { if( is_slice_type( sh->slice_type, SH_SLICE_TYPE_EB ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->direct_spatial_mv_pred_flag = bs_read_u1(b); printf("sh->direct_spatial_mv_pred_flag: %d \n", sh->direct_spatial_mv_pred_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->direct_spatial_mv_pred_flag = bs_read_u1(b); printf("sh->direct_spatial_mv_pred_flag: %d \n", sh->direct_spatial_mv_pred_flag); } if( is_slice_type( sh->slice_type, SH_SLICE_TYPE_EP ) || is_slice_type( sh->slice_type, SH_SLICE_TYPE_EB ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->num_ref_idx_active_override_flag = bs_read_u1(b); printf("sh->num_ref_idx_active_override_flag: %d \n", sh->num_ref_idx_active_override_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->num_ref_idx_active_override_flag = bs_read_u1(b); printf("sh->num_ref_idx_active_override_flag: %d \n", sh->num_ref_idx_active_override_flag); if( sh->num_ref_idx_active_override_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->num_ref_idx_l0_active_minus1 = bs_read_ue(b); printf("sh->num_ref_idx_l0_active_minus1: %d \n", sh->num_ref_idx_l0_active_minus1); // FIXME does this modify the pps? + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->num_ref_idx_l0_active_minus1 = bs_read_ue(b); printf("sh->num_ref_idx_l0_active_minus1: %d \n", sh->num_ref_idx_l0_active_minus1); // FIXME does this modify the pps? if( is_slice_type( sh->slice_type, SH_SLICE_TYPE_EB ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->num_ref_idx_l1_active_minus1 = bs_read_ue(b); printf("sh->num_ref_idx_l1_active_minus1: %d \n", sh->num_ref_idx_l1_active_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->num_ref_idx_l1_active_minus1 = bs_read_ue(b); printf("sh->num_ref_idx_l1_active_minus1: %d \n", sh->num_ref_idx_l1_active_minus1); } } } @@ -3985,7 +3985,7 @@ void read_debug_slice_header_in_scalable_extension(h264_stream_t* h, bs_t* b) //svc specific if( !nal->nal_svc_ext->no_inter_layer_pred_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->base_pred_weight_table_flag = bs_read_u1(b); printf("sh_svc_ext->base_pred_weight_table_flag: %d \n", sh_svc_ext->base_pred_weight_table_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->base_pred_weight_table_flag = bs_read_u1(b); printf("sh_svc_ext->base_pred_weight_table_flag: %d \n", sh_svc_ext->base_pred_weight_table_flag); } if( nal->nal_svc_ext->no_inter_layer_pred_flag || !sh_svc_ext->base_pred_weight_table_flag ) { @@ -3999,7 +3999,7 @@ void read_debug_slice_header_in_scalable_extension(h264_stream_t* h, bs_t* b) //svc specific if( !sps_subset->sps_svc_ext->slice_header_restriction_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->store_ref_base_pic_flag = bs_read_u1(b); printf("sh_svc_ext->store_ref_base_pic_flag: %d \n", sh_svc_ext->store_ref_base_pic_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->store_ref_base_pic_flag = bs_read_u1(b); printf("sh_svc_ext->store_ref_base_pic_flag: %d \n", sh_svc_ext->store_ref_base_pic_flag); if( ( nal->nal_svc_ext->use_ref_base_pic_flag || sh_svc_ext->store_ref_base_pic_flag ) && ( nal->nal_unit_type != 5 ) ) { @@ -4011,112 +4011,112 @@ void read_debug_slice_header_in_scalable_extension(h264_stream_t* h, bs_t* b) if( pps->entropy_coding_mode_flag && ! is_slice_type( sh->slice_type, SH_SLICE_TYPE_EI ) ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->cabac_init_idc = bs_read_ue(b); printf("sh->cabac_init_idc: %d \n", sh->cabac_init_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->cabac_init_idc = bs_read_ue(b); printf("sh->cabac_init_idc: %d \n", sh->cabac_init_idc); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_qp_delta = bs_read_se(b); printf("sh->slice_qp_delta: %d \n", sh->slice_qp_delta); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_qp_delta = bs_read_se(b); printf("sh->slice_qp_delta: %d \n", sh->slice_qp_delta); if( pps->deblocking_filter_control_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->disable_deblocking_filter_idc = bs_read_ue(b); printf("sh->disable_deblocking_filter_idc: %d \n", sh->disable_deblocking_filter_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->disable_deblocking_filter_idc = bs_read_ue(b); printf("sh->disable_deblocking_filter_idc: %d \n", sh->disable_deblocking_filter_idc); if( sh->disable_deblocking_filter_idc != 1 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_alpha_c0_offset_div2 = bs_read_se(b); printf("sh->slice_alpha_c0_offset_div2: %d \n", sh->slice_alpha_c0_offset_div2); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_beta_offset_div2 = bs_read_se(b); printf("sh->slice_beta_offset_div2: %d \n", sh->slice_beta_offset_div2); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_alpha_c0_offset_div2 = bs_read_se(b); printf("sh->slice_alpha_c0_offset_div2: %d \n", sh->slice_alpha_c0_offset_div2); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_beta_offset_div2 = bs_read_se(b); printf("sh->slice_beta_offset_div2: %d \n", sh->slice_beta_offset_div2); } } if( pps->num_slice_groups_minus1 > 0 && pps->slice_group_map_type >= 3 && pps->slice_group_map_type <= 5) { int v = intlog2( pps->pic_size_in_map_units_minus1 + pps->slice_group_change_rate_minus1 + 1 ); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh->slice_group_change_cycle = bs_read_u(b, v); printf("sh->slice_group_change_cycle: %d \n", sh->slice_group_change_cycle); // FIXME add 2? + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh->slice_group_change_cycle = bs_read_u(b, v); printf("sh->slice_group_change_cycle: %d \n", sh->slice_group_change_cycle); // FIXME add 2? } //svc specific if( !nal->nal_svc_ext->no_inter_layer_pred_flag && nal->nal_svc_ext->quality_id == 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->ref_layer_dq_id = bs_read_ue(b); printf("sh_svc_ext->ref_layer_dq_id: %d \n", sh_svc_ext->ref_layer_dq_id); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->ref_layer_dq_id = bs_read_ue(b); printf("sh_svc_ext->ref_layer_dq_id: %d \n", sh_svc_ext->ref_layer_dq_id); if( sps_subset->sps_svc_ext->inter_layer_deblocking_filter_control_present_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->disable_inter_layer_deblocking_filter_idc = bs_read_ue(b); printf("sh_svc_ext->disable_inter_layer_deblocking_filter_idc: %d \n", sh_svc_ext->disable_inter_layer_deblocking_filter_idc); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->disable_inter_layer_deblocking_filter_idc = bs_read_ue(b); printf("sh_svc_ext->disable_inter_layer_deblocking_filter_idc: %d \n", sh_svc_ext->disable_inter_layer_deblocking_filter_idc); if( sh_svc_ext->disable_inter_layer_deblocking_filter_idc != 1 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->inter_layer_slice_alpha_c0_offset_div2 = bs_read_se(b); printf("sh_svc_ext->inter_layer_slice_alpha_c0_offset_div2: %d \n", sh_svc_ext->inter_layer_slice_alpha_c0_offset_div2); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->inter_layer_slice_beta_offset_div2 = bs_read_se(b); printf("sh_svc_ext->inter_layer_slice_beta_offset_div2: %d \n", sh_svc_ext->inter_layer_slice_beta_offset_div2); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->inter_layer_slice_alpha_c0_offset_div2 = bs_read_se(b); printf("sh_svc_ext->inter_layer_slice_alpha_c0_offset_div2: %d \n", sh_svc_ext->inter_layer_slice_alpha_c0_offset_div2); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->inter_layer_slice_beta_offset_div2 = bs_read_se(b); printf("sh_svc_ext->inter_layer_slice_beta_offset_div2: %d \n", sh_svc_ext->inter_layer_slice_beta_offset_div2); } } - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->constrained_intra_resampling_flag = bs_read_u1(b); printf("sh_svc_ext->constrained_intra_resampling_flag: %d \n", sh_svc_ext->constrained_intra_resampling_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->constrained_intra_resampling_flag = bs_read_u1(b); printf("sh_svc_ext->constrained_intra_resampling_flag: %d \n", sh_svc_ext->constrained_intra_resampling_flag); if( sps_subset->sps_svc_ext->extended_spatial_scalability_idc == 2 ) { if( sps_subset->sps->chroma_format_idc > 0 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->ref_layer_chroma_phase_x_plus1_flag = bs_read_u1(b); printf("sh_svc_ext->ref_layer_chroma_phase_x_plus1_flag: %d \n", sh_svc_ext->ref_layer_chroma_phase_x_plus1_flag); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->ref_layer_chroma_phase_y_plus1 = bs_read_u(b, 2); printf("sh_svc_ext->ref_layer_chroma_phase_y_plus1: %d \n", sh_svc_ext->ref_layer_chroma_phase_y_plus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->ref_layer_chroma_phase_x_plus1_flag = bs_read_u1(b); printf("sh_svc_ext->ref_layer_chroma_phase_x_plus1_flag: %d \n", sh_svc_ext->ref_layer_chroma_phase_x_plus1_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->ref_layer_chroma_phase_y_plus1 = bs_read_u(b, 2); printf("sh_svc_ext->ref_layer_chroma_phase_y_plus1: %d \n", sh_svc_ext->ref_layer_chroma_phase_y_plus1); } - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->scaled_ref_layer_left_offset = bs_read_se(b); printf("sh_svc_ext->scaled_ref_layer_left_offset: %d \n", sh_svc_ext->scaled_ref_layer_left_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->scaled_ref_layer_top_offset = bs_read_se(b); printf("sh_svc_ext->scaled_ref_layer_top_offset: %d \n", sh_svc_ext->scaled_ref_layer_top_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->scaled_ref_layer_right_offset = bs_read_se(b); printf("sh_svc_ext->scaled_ref_layer_right_offset: %d \n", sh_svc_ext->scaled_ref_layer_right_offset); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->scaled_ref_layer_bottom_offset = bs_read_se(b); printf("sh_svc_ext->scaled_ref_layer_bottom_offset: %d \n", sh_svc_ext->scaled_ref_layer_bottom_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->scaled_ref_layer_left_offset = bs_read_se(b); printf("sh_svc_ext->scaled_ref_layer_left_offset: %d \n", sh_svc_ext->scaled_ref_layer_left_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->scaled_ref_layer_top_offset = bs_read_se(b); printf("sh_svc_ext->scaled_ref_layer_top_offset: %d \n", sh_svc_ext->scaled_ref_layer_top_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->scaled_ref_layer_right_offset = bs_read_se(b); printf("sh_svc_ext->scaled_ref_layer_right_offset: %d \n", sh_svc_ext->scaled_ref_layer_right_offset); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->scaled_ref_layer_bottom_offset = bs_read_se(b); printf("sh_svc_ext->scaled_ref_layer_bottom_offset: %d \n", sh_svc_ext->scaled_ref_layer_bottom_offset); } } if( !nal->nal_svc_ext->no_inter_layer_pred_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->slice_skip_flag = bs_read_u1(b); printf("sh_svc_ext->slice_skip_flag: %d \n", sh_svc_ext->slice_skip_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->slice_skip_flag = bs_read_u1(b); printf("sh_svc_ext->slice_skip_flag: %d \n", sh_svc_ext->slice_skip_flag); if( sh_svc_ext->slice_skip_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->num_mbs_in_slice_minus1 = bs_read_ue(b); printf("sh_svc_ext->num_mbs_in_slice_minus1: %d \n", sh_svc_ext->num_mbs_in_slice_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->num_mbs_in_slice_minus1 = bs_read_ue(b); printf("sh_svc_ext->num_mbs_in_slice_minus1: %d \n", sh_svc_ext->num_mbs_in_slice_minus1); } else { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->adaptive_base_mode_flag = bs_read_u1(b); printf("sh_svc_ext->adaptive_base_mode_flag: %d \n", sh_svc_ext->adaptive_base_mode_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->adaptive_base_mode_flag = bs_read_u1(b); printf("sh_svc_ext->adaptive_base_mode_flag: %d \n", sh_svc_ext->adaptive_base_mode_flag); if( !sh_svc_ext->adaptive_base_mode_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->default_base_mode_flag = bs_read_u1(b); printf("sh_svc_ext->default_base_mode_flag: %d \n", sh_svc_ext->default_base_mode_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->default_base_mode_flag = bs_read_u1(b); printf("sh_svc_ext->default_base_mode_flag: %d \n", sh_svc_ext->default_base_mode_flag); } if( !sh_svc_ext->default_base_mode_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->adaptive_motion_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->adaptive_motion_prediction_flag: %d \n", sh_svc_ext->adaptive_motion_prediction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->adaptive_motion_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->adaptive_motion_prediction_flag: %d \n", sh_svc_ext->adaptive_motion_prediction_flag); if( !sh_svc_ext->adaptive_motion_prediction_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->default_motion_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->default_motion_prediction_flag: %d \n", sh_svc_ext->default_motion_prediction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->default_motion_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->default_motion_prediction_flag: %d \n", sh_svc_ext->default_motion_prediction_flag); } } - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->adaptive_residual_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->adaptive_residual_prediction_flag: %d \n", sh_svc_ext->adaptive_residual_prediction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->adaptive_residual_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->adaptive_residual_prediction_flag: %d \n", sh_svc_ext->adaptive_residual_prediction_flag); if( !sh_svc_ext->adaptive_residual_prediction_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->default_residual_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->default_residual_prediction_flag: %d \n", sh_svc_ext->default_residual_prediction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->default_residual_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->default_residual_prediction_flag: %d \n", sh_svc_ext->default_residual_prediction_flag); } } if( sps_subset->sps_svc_ext->adaptive_tcoeff_level_prediction_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->tcoeff_level_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->tcoeff_level_prediction_flag: %d \n", sh_svc_ext->tcoeff_level_prediction_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->tcoeff_level_prediction_flag = bs_read_u1(b); printf("sh_svc_ext->tcoeff_level_prediction_flag: %d \n", sh_svc_ext->tcoeff_level_prediction_flag); } } if( !sps_subset->sps_svc_ext->slice_header_restriction_flag && !sh_svc_ext->slice_skip_flag ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->scan_idx_start = bs_read_u(b, 4); printf("sh_svc_ext->scan_idx_start: %d \n", sh_svc_ext->scan_idx_start); - printf("%d.%d: ", b->p - b->start, b->bits_left); sh_svc_ext->scan_idx_end = bs_read_u(b, 4); printf("sh_svc_ext->scan_idx_end: %d \n", sh_svc_ext->scan_idx_end); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->scan_idx_start = bs_read_u(b, 4); printf("sh_svc_ext->scan_idx_start: %d \n", sh_svc_ext->scan_idx_start); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sh_svc_ext->scan_idx_end = bs_read_u(b, 4); printf("sh_svc_ext->scan_idx_end: %d \n", sh_svc_ext->scan_idx_end); } } //G.7.3.3.5 Decoded reference base picture marking syntax void read_debug_dec_ref_base_pic_marking(nal_t* nal, bs_t* b) { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->prefix_nal_svc->adaptive_ref_base_pic_marking_mode_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->adaptive_ref_base_pic_marking_mode_flag: %d \n", nal->prefix_nal_svc->adaptive_ref_base_pic_marking_mode_flag); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->prefix_nal_svc->adaptive_ref_base_pic_marking_mode_flag = bs_read_u1(b); printf("nal->prefix_nal_svc->adaptive_ref_base_pic_marking_mode_flag: %d \n", nal->prefix_nal_svc->adaptive_ref_base_pic_marking_mode_flag); if( nal->prefix_nal_svc->adaptive_ref_base_pic_marking_mode_flag ) { do { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->prefix_nal_svc->memory_management_base_control_operation = bs_read_ue(b); printf("nal->prefix_nal_svc->memory_management_base_control_operation: %d \n", nal->prefix_nal_svc->memory_management_base_control_operation); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->prefix_nal_svc->memory_management_base_control_operation = bs_read_ue(b); printf("nal->prefix_nal_svc->memory_management_base_control_operation: %d \n", nal->prefix_nal_svc->memory_management_base_control_operation); if( nal->prefix_nal_svc->memory_management_base_control_operation == 1 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->prefix_nal_svc->difference_of_base_pic_nums_minus1 = bs_read_ue(b); printf("nal->prefix_nal_svc->difference_of_base_pic_nums_minus1: %d \n", nal->prefix_nal_svc->difference_of_base_pic_nums_minus1); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->prefix_nal_svc->difference_of_base_pic_nums_minus1 = bs_read_ue(b); printf("nal->prefix_nal_svc->difference_of_base_pic_nums_minus1: %d \n", nal->prefix_nal_svc->difference_of_base_pic_nums_minus1); } if( nal->prefix_nal_svc->memory_management_base_control_operation == 2 ) { - printf("%d.%d: ", b->p - b->start, b->bits_left); nal->prefix_nal_svc->long_term_base_pic_num = bs_read_ue(b); printf("nal->prefix_nal_svc->long_term_base_pic_num: %d \n", nal->prefix_nal_svc->long_term_base_pic_num); + printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); nal->prefix_nal_svc->long_term_base_pic_num = bs_read_ue(b); printf("nal->prefix_nal_svc->long_term_base_pic_num: %d \n", nal->prefix_nal_svc->long_term_base_pic_num); } } while( nal->prefix_nal_svc->memory_management_base_control_operation != 0 ); } From 6bf8e0704659fbdbe7017f3cb607113f59ebf3fe Mon Sep 17 00:00:00 2001 From: Alex Izvorski Date: Thu, 29 Mar 2018 18:50:25 -0700 Subject: [PATCH 7/9] Bugfix: read/write svc_vui_parameters_extension only used first table entry (SVC-only bug) --- h264_stream.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/h264_stream.c b/h264_stream.c index e2903e4..2426bf3 100644 --- a/h264_stream.c +++ b/h264_stream.c @@ -577,12 +577,12 @@ void read_svc_vui_parameters_extension(sps_svc_ext_t* sps_svc_ext, bs_t* b) sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] = bs_read_u1(b); if( sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] ) { - read_hrd_parameters(&sps_svc_ext->hrd_vcl, b); + read_hrd_parameters(&sps_svc_ext->hrd_vcl[i], b); } sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i] = bs_read_u1(b); if( sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i] ) { - read_hrd_parameters(&sps_svc_ext->hrd_nal, b); + read_hrd_parameters(&sps_svc_ext->hrd_nal[i], b); } if( sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] || @@ -1906,12 +1906,12 @@ void write_svc_vui_parameters_extension(sps_svc_ext_t* sps_svc_ext, bs_t* b) bs_write_u1(b, sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i]); if( sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] ) { - write_hrd_parameters(&sps_svc_ext->hrd_vcl, b); + write_hrd_parameters(&sps_svc_ext->hrd_vcl[i], b); } bs_write_u1(b, sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i]); if( sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i] ) { - write_hrd_parameters(&sps_svc_ext->hrd_nal, b); + write_hrd_parameters(&sps_svc_ext->hrd_nal[i], b); } if( sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] || @@ -3235,12 +3235,12 @@ void read_debug_svc_vui_parameters_extension(sps_svc_ext_t* sps_svc_ext, bs_t* b printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i]); if( sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] ) { - read_debug_hrd_parameters(&sps_svc_ext->hrd_vcl, b); + read_debug_hrd_parameters(&sps_svc_ext->hrd_vcl[i], b); } printf("%ld.%d: ", (long int)(b->p - b->start), b->bits_left); sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i] = bs_read_u1(b); printf("sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i]: %d \n", sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i]); if( sps_svc_ext->vui.vui_ext_vcl_hrd_parameters_present_flag[i] ) { - read_debug_hrd_parameters(&sps_svc_ext->hrd_nal, b); + read_debug_hrd_parameters(&sps_svc_ext->hrd_nal[i], b); } if( sps_svc_ext->vui.vui_ext_nal_hrd_parameters_present_flag[i] || From e193335babc1826945a9259788a61c7744d0d32d Mon Sep 17 00:00:00 2001 From: Alex Izvorski Date: Thu, 29 Mar 2018 18:54:24 -0700 Subject: [PATCH 8/9] Bugfix: read/write dec_ref_base_pic_marking passed pointer of wrong type (SVC-only bug) --- h264_stream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/h264_stream.c b/h264_stream.c index 2426bf3..db520e8 100644 --- a/h264_stream.c +++ b/h264_stream.c @@ -1337,7 +1337,7 @@ void read_slice_header_in_scalable_extension(h264_stream_t* h, bs_t* b) if( ( nal->nal_svc_ext->use_ref_base_pic_flag || sh_svc_ext->store_ref_base_pic_flag ) && ( nal->nal_unit_type != 5 ) ) { - read_dec_ref_base_pic_marking(h, b); + read_dec_ref_base_pic_marking(nal, b); } } } @@ -2666,7 +2666,7 @@ void write_slice_header_in_scalable_extension(h264_stream_t* h, bs_t* b) if( ( nal->nal_svc_ext->use_ref_base_pic_flag || sh_svc_ext->store_ref_base_pic_flag ) && ( nal->nal_unit_type != 5 ) ) { - write_dec_ref_base_pic_marking(h, b); + write_dec_ref_base_pic_marking(nal, b); } } } @@ -4003,7 +4003,7 @@ void read_debug_slice_header_in_scalable_extension(h264_stream_t* h, bs_t* b) if( ( nal->nal_svc_ext->use_ref_base_pic_flag || sh_svc_ext->store_ref_base_pic_flag ) && ( nal->nal_unit_type != 5 ) ) { - read_debug_dec_ref_base_pic_marking(h, b); + read_debug_dec_ref_base_pic_marking(nal, b); } } } From e888b8de45bfde6cc2ec5b759c5db88e381e81c5 Mon Sep 17 00:00:00 2001 From: Alex Izvorski Date: Thu, 29 Mar 2018 18:59:42 -0700 Subject: [PATCH 9/9] Fix some calloc and typedef warnings --- h264_sei.c | 6 +++--- h264_sei.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/h264_sei.c b/h264_sei.c index 4bd93de..6c728fc 100644 --- a/h264_sei.c +++ b/h264_sei.c @@ -259,7 +259,7 @@ void read_sei_payload( h264_stream_t* h, bs_t* b ) case SEI_TYPE_SCALABILITY_INFO: if( 1 ) { - s->sei_svc = (uint8_t*)calloc( 1, sizeof(sei_scalability_info_t) ); + s->sei_svc = (sei_scalability_info_t*)calloc( 1, sizeof(sei_scalability_info_t) ); } read_sei_scalability_info( h, b ); break; @@ -466,7 +466,7 @@ void write_sei_payload( h264_stream_t* h, bs_t* b ) case SEI_TYPE_SCALABILITY_INFO: if( 0 ) { - s->sei_svc = (uint8_t*)calloc( 1, sizeof(sei_scalability_info_t) ); + s->sei_svc = (sei_scalability_info_t*)calloc( 1, sizeof(sei_scalability_info_t) ); } write_sei_scalability_info( h, b ); break; @@ -673,7 +673,7 @@ void read_debug_sei_payload( h264_stream_t* h, bs_t* b ) case SEI_TYPE_SCALABILITY_INFO: if( 1 ) { - s->sei_svc = (uint8_t*)calloc( 1, sizeof(sei_scalability_info_t) ); + s->sei_svc = (sei_scalability_info_t*)calloc( 1, sizeof(sei_scalability_info_t) ); } read_debug_sei_scalability_info( h, b ); break; diff --git a/h264_sei.h b/h264_sei.h index 25d8c9d..e23a170 100644 --- a/h264_sei.h +++ b/h264_sei.h @@ -110,7 +110,7 @@ typedef struct #define MAX_LENGTH 128 -typedef sei_scalability_priority_layer_info_t; +// typedef sei_scalability_priority_layer_info_t; typedef struct {