Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any further plan about slice_data? #1

Open
inksong opened this issue May 16, 2022 · 1 comment
Open

any further plan about slice_data? #1

inksong opened this issue May 16, 2022 · 1 comment

Comments

@inksong
Copy link

inksong commented May 16, 2022

First of all great work! I was just looking for NALPhaser written concisely and clearly, and your work came out just right!
By the way, the analysis of the specific RBSP content here does not seem to have been completed.
Here-> #L84 h264_slice_layer_without_partitioning_rbsp_parser.cc
Do you have any plans to write it in the future?
A demo parsing NALU to a bitmap would be a huge help!(I Frame)
Thanks again for your hard work! Extremely grateful! 😀😀😀

@chemag
Copy link
Owner

chemag commented May 16, 2022

Thanks for the feedback!

Do you have any plans to write it in the future?

Not in the short term: I only implemented what I needed for my work. Adding the slice_layer should not be much work though: I'd suggest to check some of the other patches that add different features. Maybe you want to give it a try?

chemag added a commit that referenced this issue Oct 25, 2022
Updated to last webrtc version.

Tested:
```
$ make test
Running tests...
Test project h264nal/build
      Start  1: h264_common_unittest
 1/22 Test  #1: h264_common_unittest .........................................   Passed    0.00 sec
      Start  2: h264_hrd_parameters_parser_unittest
 2/22 Test  #2: h264_hrd_parameters_parser_unittest ..........................   Passed    0.00 sec
      Start  3: h264_vui_parameters_parser_unittest
 3/22 Test  #3: h264_vui_parameters_parser_unittest ..........................   Passed    0.00 sec
      Start  4: h264_sps_parser_unittest
 4/22 Test  #4: h264_sps_parser_unittest .....................................   Passed    0.00 sec
      Start  5: h264_pps_parser_unittest
 5/22 Test  #5: h264_pps_parser_unittest .....................................   Passed    0.00 sec
      Start  6: h264_ref_pic_list_modification_parser_unittest
 6/22 Test  #6: h264_ref_pic_list_modification_parser_unittest ...............   Passed    0.00 sec
      Start  7: h264_pred_weight_table_parser_unittest
 7/22 Test  #7: h264_pred_weight_table_parser_unittest .......................   Passed    0.00 sec
      Start  8: h264_dec_ref_pic_marking_parser_unittest
 8/22 Test  #8: h264_dec_ref_pic_marking_parser_unittest .....................   Passed    0.00 sec
      Start  9: h264_rtp_single_parser_unittest
 9/22 Test  #9: h264_rtp_single_parser_unittest ..............................   Passed    0.00 sec
      Start 10: h264_rtp_stapa_parser_unittest
10/22 Test #10: h264_rtp_stapa_parser_unittest ...............................   Passed    0.00 sec
      Start 11: h264_rtp_fua_parser_unittest
11/22 Test #11: h264_rtp_fua_parser_unittest .................................   Passed    0.00 sec
      Start 12: h264_rtp_parser_unittest
12/22 Test #12: h264_rtp_parser_unittest .....................................   Passed    0.00 sec
      Start 13: h264_slice_header_parser_unittest
13/22 Test #13: h264_slice_header_parser_unittest ............................   Passed    0.00 sec
      Start 14: h264_slice_header_in_scalable_extension_parser_unittest
14/22 Test #14: h264_slice_header_in_scalable_extension_parser_unittest ......   Passed    0.00 sec
      Start 15: h264_slice_layer_without_partitioning_rbsp_parser_unittest
15/22 Test #15: h264_slice_layer_without_partitioning_rbsp_parser_unittest ...   Passed    0.00 sec
      Start 16: h264_slice_layer_extension_rbsp_parser_unittest
16/22 Test #16: h264_slice_layer_extension_rbsp_parser_unittest ..............   Passed    0.00 sec
      Start 17: h264_subset_sps_parser_unittest
17/22 Test #17: h264_subset_sps_parser_unittest ..............................   Passed    0.00 sec
      Start 18: h264_sps_svc_extension_parser_unittest
18/22 Test #18: h264_sps_svc_extension_parser_unittest .......................   Passed    0.00 sec
      Start 19: h264_bitstream_parser_unittest
19/22 Test #19: h264_bitstream_parser_unittest ...............................   Passed    0.00 sec
      Start 20: h264_prefix_nal_unit_parser_unittest
20/22 Test #20: h264_prefix_nal_unit_parser_unittest .........................   Passed    0.00 sec
      Start 21: h264_nal_unit_header_svc_extension_parser_unittest
21/22 Test #21: h264_nal_unit_header_svc_extension_parser_unittest ...........   Passed    0.00 sec
      Start 22: h264_nal_unit_parser_unittest
22/22 Test #22: h264_nal_unit_parser_unittest ................................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 22

Total Test time (real) =   0.05 sec
```
chemag added a commit that referenced this issue Oct 27, 2022
…eblocking_filter_idc

Had to fix a couple of tests.

Tested:

Ran unittest.

```
$ make test
Running tests...
Test project h264nal/build
      Start  1: h264_common_unittest
 1/23 Test  #1: h264_common_unittest .........................................   Passed    0.00 sec
      Start  2: h264_hrd_parameters_parser_unittest
 2/23 Test  #2: h264_hrd_parameters_parser_unittest ..........................   Passed    0.00 sec
      Start  3: h264_vui_parameters_parser_unittest
 3/23 Test  #3: h264_vui_parameters_parser_unittest ..........................   Passed    0.00 sec
      Start  4: h264_sps_parser_unittest
 4/23 Test  #4: h264_sps_parser_unittest .....................................   Passed    0.00 sec
      Start  5: h264_pps_parser_unittest
 5/23 Test  #5: h264_pps_parser_unittest .....................................   Passed    0.00 sec
      Start  6: h264_ref_pic_list_modification_parser_unittest
 6/23 Test  #6: h264_ref_pic_list_modification_parser_unittest ...............   Passed    0.00 sec
      Start  7: h264_pred_weight_table_parser_unittest
 7/23 Test  #7: h264_pred_weight_table_parser_unittest .......................   Passed    0.00 sec
      Start  8: h264_dec_ref_pic_marking_parser_unittest
 8/23 Test  #8: h264_dec_ref_pic_marking_parser_unittest .....................   Passed    0.00 sec
      Start  9: h264_rtp_single_parser_unittest
 9/23 Test  #9: h264_rtp_single_parser_unittest ..............................   Passed    0.00 sec
      Start 10: h264_rtp_stapa_parser_unittest
10/23 Test #10: h264_rtp_stapa_parser_unittest ...............................   Passed    0.00 sec
      Start 11: h264_rtp_fua_parser_unittest
11/23 Test #11: h264_rtp_fua_parser_unittest .................................   Passed    0.00 sec
      Start 12: h264_rtp_parser_unittest
12/23 Test #12: h264_rtp_parser_unittest .....................................   Passed    0.00 sec
      Start 13: h264_slice_header_parser_unittest
13/23 Test #13: h264_slice_header_parser_unittest ............................   Passed    0.00 sec
      Start 14: h264_slice_header_in_scalable_extension_parser_unittest
14/23 Test #14: h264_slice_header_in_scalable_extension_parser_unittest ......   Passed    0.00 sec
      Start 15: h264_slice_layer_without_partitioning_rbsp_parser_unittest
15/23 Test #15: h264_slice_layer_without_partitioning_rbsp_parser_unittest ...   Passed    0.00 sec
      Start 16: h264_slice_layer_extension_rbsp_parser_unittest
16/23 Test #16: h264_slice_layer_extension_rbsp_parser_unittest ..............   Passed    0.00 sec
      Start 17: h264_sps_extension_parser_unittest
17/23 Test #17: h264_sps_extension_parser_unittest ...........................   Passed    0.00 sec
      Start 18: h264_subset_sps_parser_unittest
18/23 Test #18: h264_subset_sps_parser_unittest ..............................   Passed    0.00 sec
      Start 19: h264_sps_svc_extension_parser_unittest
19/23 Test #19: h264_sps_svc_extension_parser_unittest .......................   Passed    0.00 sec
      Start 20: h264_bitstream_parser_unittest
20/23 Test #20: h264_bitstream_parser_unittest ...............................   Passed    0.00 sec
      Start 21: h264_prefix_nal_unit_parser_unittest
21/23 Test #21: h264_prefix_nal_unit_parser_unittest .........................   Passed    0.00 sec
      Start 22: h264_nal_unit_header_svc_extension_parser_unittest
22/23 Test #22: h264_nal_unit_header_svc_extension_parser_unittest ...........   Passed    0.00 sec
      Start 23: h264_nal_unit_parser_unittest
23/23 Test #23: h264_nal_unit_parser_unittest ................................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 23

Total Test time (real) =   0.08 sec
```
chemag added a commit that referenced this issue Aug 9, 2024
Implemented equation (7-21) correctly.

Added a fuzzer unittest.

Tested:

Before:
```
$ ../build/fuzz/h264_bitstream_parser_fuzzer ../fuzz/corpus/h264_bitstream_parser_fuzzer/crash-8ab5ce8d529e1c76b686e7d5fec52460dd35a140
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 2723373092
INFO: Loaded 1 modules   (2085 inline 8-bit counters): 2085 [0x640610, 0x640e35),
INFO: Loaded 1 PC tables (2085 PCs): 2085 [0x5f2538,0x5fa788),
../build/fuzz/h264_bitstream_parser_fuzzer: Running 1 inputs 1 time(s) each.
Running: ../fuzz/corpus/h264_bitstream_parser_fuzzer/crash-8ab5ce8d529e1c76b686e7d5fec52460dd35a140
h264_bitstream_parser_fuzzer: h264nal/webrtc/rtc_base/bit_buffer.cc:123: bool rtc::BitBuffer::PeekBits(size_t, uint32_t &): Assertion `bit_count > 0' failed.
==3232375== ERROR: libFuzzer: deadly signal
    #0 0x548665 in __sanitizer_print_stack_trace (h264nal/build/fuzz/h264_bitstream_parser_fuzzer+0x548665) (BuildId: 2597a253418594a64ea5b0a174c0002984c7fc61)
    #1 0x4a209c in fuzzer::PrintStackTrace() (h264nal/build/fuzz/h264_bitstream_parser_fuzzer+0x4a209c) (BuildId: 2597a253418594a64ea5b0a174c0002984c7fc61)
    #2 0x486e57 in fuzzer::Fuzzer::CrashCallback() (h264nal/build/fuzz/h264_bitstream_parser_fuzzer+0x486e57) (BuildId: 2597a253418594a64ea5b0a174c0002984c7fc61)
    #3 0x7f549bf3dcff  (/lib64/libc.so.6+0x40cff) (BuildId: 77c77fee058b19c6f001cf2cb0371ce3b8341211)
    #4 0x7f549bf96663 in __pthread_kill_implementation /usr/src/debug/glibc-2.39-22.fc40.x86_64/nptl/pthread_kill.c:43:17
    #5 0x7f549bf3dc4d in gsignal /usr/src/debug/glibc-2.39-22.fc40.x86_64/signal/../sysdeps/posix/raise.c:26:13
    #6 0x7f549bf25901 in abort /usr/src/debug/glibc-2.39-22.fc40.x86_64/stdlib/abort.c:79:7
    #7 0x7f549bf2581d in __assert_fail_base.cold /usr/src/debug/glibc-2.39-22.fc40.x86_64/assert/assert.c:94:3
    #8 0x7f549bf35d86 in __assert_fail /usr/src/debug/glibc-2.39-22.fc40.x86_64/assert/assert.c:103:3
    #9 0x5c51a3 in rtc::BitBuffer::PeekBits(unsigned long, unsigned int&) h264nal/webrtc/rtc_base/bit_buffer.cc:123:3
    #10 0x5c5048 in rtc::BitBuffer::ReadBits(unsigned long, unsigned int&) h264nal/webrtc/rtc_base/bit_buffer.cc:188:10
    #11 0x5bb8ec in h264nal::H264SliceHeaderParser::ParseSliceHeader(rtc::BitBuffer*, unsigned int, unsigned int, h264nal::H264BitstreamParserState*) h264nal/src/h264_slice_header_parser.cc:476:22
    ...
    #24 0x46bad4 in _start (h264nal/build/fuzz/h264_bitstream_parser_fuzzer+0x46bad4) (BuildId: 2597a253418594a64ea5b0a174c0002984c7fc61)

NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
```

After:
```
$ ../build/fuzz/h264_bitstream_parser_fuzzer ../fuzz/corpus/h264_bitstream_parser_fuzzer/crash-8ab5ce8d529e1c76b686e7d5fec52460dd35a140
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 1396213500
INFO: Loaded 1 modules   (2085 inline 8-bit counters): 2085 [0x640610, 0x640e35),
INFO: Loaded 1 PC tables (2085 PCs): 2085 [0x5f2538,0x5fa788),
../build/fuzz/h264_bitstream_parser_fuzzer: Running 1 inputs 1 time(s) each.
Running: ../fuzz/corpus/h264_bitstream_parser_fuzzer/crash-8ab5ce8d529e1c76b686e7d5fec52460dd35a140
Executed ../fuzz/corpus/h264_bitstream_parser_fuzzer/crash-8ab5ce8d529e1c76b686e7d5fec52460dd35a140 in 0 ms
***
*** NOTE: fuzzing was not performed, you have only
***       executed the target code on a fixed set of inputs.
***
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants