After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 685215 - codecparsers: h264: Add initial MVC parser
codecparsers: h264: Add initial MVC parser
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 684568
Blocks: 696135 721772
 
 
Reported: 2012-10-01 13:30 UTC by Gwenole Beauchesne
Modified: 2014-10-29 13:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
codecparsers: h264: add gst_h264_parse_sps_data() helper (7.87 KB, patch)
2012-10-01 13:31 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: add gst_h264_parse_nalu_header() helper. (2.60 KB, patch)
2012-10-01 13:32 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: parse MVC syntax elements (11.62 KB, patch)
2012-10-01 13:33 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: parse seq_parameter_set_mvc_extension() (16.92 KB, patch)
2012-10-01 13:36 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: parse MVC syntax elements (14.15 KB, patch)
2012-10-01 15:58 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: parse seq_parameter_set_mvc_extension() (17.91 KB, patch)
2012-10-01 15:58 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: add gst_h264_parse_nalu_header() helper (2.60 KB, patch)
2013-02-04 13:50 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: parse MVC syntax elements (14.22 KB, patch)
2013-02-04 13:54 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264parse: Fix the nal_unit header parsing. (1.46 KB, patch)
2013-02-08 15:16 UTC, sreerenj
none Details | Review
codecparsers: h264parse: Fix the nal_unit header parsing. (1.46 KB, patch)
2013-02-08 15:31 UTC, sreerenj
none Details | Review
264parser: Fix the IdrPicFlag calculation for MVC streams. (1.18 KB, patch)
2013-02-25 12:47 UTC, sreerenj
none Details | Review
codecparsers: h264parser: parse mvc extension for Stereoscopic High Profile (1.16 KB, patch)
2013-03-04 13:50 UTC, sreerenj
none Details | Review
h264parser: Add stereo_video_info payload parsing to SEI parser API. (4.50 KB, patch)
2013-03-08 16:34 UTC, sreerenj
none Details | Review
h264parser: Add frame_packing_arrangement payload parsing to SEI parser API. (6.96 KB, patch)
2013-03-08 16:36 UTC, sreerenj
none Details | Review
h264parser: Add enum value for sps_extension nal unit type. (862 bytes, patch)
2013-03-13 13:01 UTC, sreerenj
none Details | Review
h264parser: define the max value for SPS+SSPS count. (1.17 KB, patch)
2013-03-17 20:30 UTC, sreerenj
rejected Details | Review
codecparsers: h264: complete set of NAL unit types (1.79 KB, patch)
2014-03-24 14:59 UTC, Gwenole Beauchesne
committed Details | Review
codecparsers: h264: add gst_h264_parse_sps_data() helper (7.96 KB, patch)
2014-03-24 15:00 UTC, Gwenole Beauchesne
committed Details | Review
codecparsers: h264: add gst_h264_parse_nalu_header() helper (2.54 KB, patch)
2014-03-24 15:00 UTC, Gwenole Beauchesne
committed Details | Review
codecparsers: h264: parse MVC syntax elements (13.86 KB, patch)
2014-03-24 15:02 UTC, Gwenole Beauchesne
committed Details | Review
codecparsers: h264: parse seq_parameter_set_mvc_extension() (18.34 KB, patch)
2014-03-24 15:03 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: fix slice_header() parsing for MVC (1.27 KB, patch)
2014-03-24 15:04 UTC, Gwenole Beauchesne
committed Details | Review
codecparsers: h264: add support for Stereo Video Information SEI message (3.84 KB, patch)
2014-03-24 15:05 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: add support for Frame Packing Arrangement SEI message (8.04 KB, patch)
2014-03-24 15:08 UTC, Gwenole Beauchesne
none Details | Review
codecparsers: h264: parse seq_parameter_set_mvc_extension() (18.33 KB, patch)
2014-03-25 13:20 UTC, Gwenole Beauchesne
committed Details | Review
codecparsers: h264: add support for Stereo Video Information SEI message (4.61 KB, patch)
2014-03-25 13:21 UTC, Gwenole Beauchesne
committed Details | Review
codecparsers: h264: add support for Frame Packing Arrangement SEI message (7.90 KB, patch)
2014-03-25 13:23 UTC, Gwenole Beauchesne
committed Details | Review

Description Gwenole Beauchesne 2012-10-01 13:30:26 UTC
Hi,

This patch series adds initial parsing for MVC. The first two patches are just helper functions that are to be reused for both MVC and SVC parsers. The third patch adds initial MVC support if the user doesn't care of MVC specific syntax elements in subset SPS header. The last patch adds full MVC SPS header parsing. New VUI and SEI messages are left out for now.

I am not fully sure this is the right way to handle the subset SPS headers but it's definitely needed to perform dynamic memory allocation somewhere. Otherwise, a full SPS descriptor suitable for MVC expands to a few MBs.

Just wanted to publish the MVC codec parser early so that to get your feedback on the proposed API. Thanks.
Comment 1 Gwenole Beauchesne 2012-10-01 13:31:49 UTC
Created attachment 225487 [details] [review]
codecparsers: h264: add gst_h264_parse_sps_data() helper

Split seq_parameter_set_data() parsing off gst_h264_parse_sps() so that it could be re-used later on.
Comment 2 Gwenole Beauchesne 2012-10-01 13:32:18 UTC
Created attachment 225488 [details] [review]
codecparsers: h264: add gst_h264_parse_nalu_header() helper.

Add helper to parse the NALU header. Move bounds checking to there.
Comment 3 Gwenole Beauchesne 2012-10-01 13:33:28 UTC
Created attachment 225489 [details] [review]
codecparsers: h264: parse MVC syntax elements

Add basic MVC parser without MVC-specific subset SPS header data.
Comment 4 Gwenole Beauchesne 2012-10-01 13:36:08 UTC
Created attachment 225490 [details] [review]
codecparsers: h264: parse seq_parameter_set_mvc_extension()

The "large" patch that handles subset SPS data for MVC. Due to the number of possible views, dynamically allocation of data structures were necessary to me, unless we want the full subset SPS structure to be larger than one megabyte, thus not fitting stack anyway.
Comment 5 Gwenole Beauchesne 2012-10-01 15:58:00 UTC
Created attachment 225506 [details] [review]
codecparsers: h264: parse MVC syntax elements
Comment 6 Gwenole Beauchesne 2012-10-01 15:58:42 UTC
Created attachment 225507 [details] [review]
codecparsers: h264: parse seq_parameter_set_mvc_extension()

Fixed and cleaned up version.
Comment 7 Gwenole Beauchesne 2013-02-04 13:50:55 UTC
Created attachment 235146 [details] [review]
codecparsers: h264: add gst_h264_parse_nalu_header()  helper

Fix minor off-by-one error in gst_h264_parse_nalu_header().
Comment 8 Gwenole Beauchesne 2013-02-04 13:54:41 UTC
Created attachment 235147 [details] [review]
codecparsers: h264: parse MVC syntax elements

- handle stereoscopic profiles ;
- re-arrange gst_h264_parse_nalu_header() to accomodate SVC ;
- remove slice_parse_ref_pic_list_mvc_modification(). The final ISO specification fixed the typos ;
- add constraint_set{4,5}_flag
Comment 9 Gwenole Beauchesne 2013-02-04 13:56:50 UTC
This has been laying in my private repositories for a long time. Not touched since, just regenerated the patches and submitted here. This fixed a couple of parsing regressions and improvements to cover more streams.

I also removed the videoparsers changes. Slightly more changes are needed, especially for better AU detection.
Comment 10 sreerenj 2013-02-05 16:14:14 UTC
The second attachment (http://bugzilla-attachments.gnome.org/attachment.cgi?id=225506) seems obsoleted by fourth one..right?
Comment 11 Gwenole Beauchesne 2013-02-05 16:37:54 UTC
(In reply to comment #10)
> The second attachment
> (http://bugzilla-attachments.gnome.org/attachment.cgi?id=225506) seems
> obsoleted by fourth one..right?

Fixed. You should get patches 0001 to 0004 now with other correctly obsoleted.
Comment 12 sreerenj 2013-02-08 15:16:32 UTC
Created attachment 235513 [details] [review]
codecparsers: h264parse: Fix the nal_unit header parsing.

Initialize the bit reader to correct offset and skip the
svc_extension_flag before parsing NalUnitExtensionMVC header.
Comment 13 sreerenj 2013-02-08 15:31:30 UTC
Created attachment 235515 [details] [review]
codecparsers: h264parse: Fix the nal_unit header parsing.

Initialize the bit reader to correct offset and skip the
svc_extension_flag before parsing NalUnitExtensionMVC header.

Just renamed the previous patch to 0005-* to keep the proper order with Gwenole's patch sets.
Comment 14 sreerenj 2013-02-25 12:47:21 UTC
Created attachment 237352 [details] [review]
264parser: Fix the IdrPicFlag calculation for MVC streams.

If there is a non_idr_flag present in the MVC nal unit header
extension, the IdrPicFlag calculation will be based on this field.
Comment 15 sreerenj 2013-03-04 13:50:48 UTC
Created attachment 237984 [details] [review]
codecparsers: h264parser: parse mvc extension for Stereoscopic High Profile

Parse the seq_parameter_set_mvc_extension for both Stereoscopic(profile_idc==128)
profile and Multiview (profile_idc==118) profile during subset sequence parameter
set parsing. Currently the parser API is only considering the Multiview profile.
Comment 16 sreerenj 2013-03-08 16:34:52 UTC
Created attachment 238381 [details] [review]
h264parser: Add stereo_video_info payload parsing to SEI parser API.

Adding necessary payload parsing support to SEI parser api to support the StereoScopic profile.
Comment 17 sreerenj 2013-03-08 16:36:04 UTC
Created attachment 238382 [details] [review]
h264parser: Add frame_packing_arrangement payload parsing to SEI parser API.

This will parse the frame_packing_arrangement payload in SEI message. This information can be used by the decoders to appropriately rearrange the samples which belongs to Stereoscopic and Multiview profiles.
Comment 18 sreerenj 2013-03-13 13:01:58 UTC
Created attachment 238774 [details] [review]
 h264parser: Add enum value for sps_extension nal unit type.

Not related to mvc parser. But just completing the NAL_UNIT type enums.
Comment 19 sreerenj 2013-03-17 20:30:44 UTC
Created attachment 239074 [details] [review]
h264parser: define the max value for SPS+SSPS count.

For MVC streams, numOfSequenceParameterSets indicates the number of SPSs and subset SPSs that are used for decoding the MVC elementary stream which has a max count value of 128 (7 bit field in MVCDecoderConfigurationRecord).
Comment 20 sreerenj 2013-03-19 13:02:41 UTC
I have created a new bug for tracking mvc stream parsing support in h264_videoparser element based on the APIs provided here.

https://bugzilla.gnome.org/show_bug.cgi?id=696135
Comment 21 sreerenj 2013-05-06 08:23:13 UTC
This has been hanging here for the last seven months !! Why can't we push these stuffs?
Comment 22 Tim-Philipp Müller 2013-05-06 09:17:27 UTC
Like all new API it will have to go through our API review process. Please be patient. It might have to wait to the next cycle (along with the other stereoscopic/multiview stuff).
Comment 23 sreerenj 2014-03-10 10:02:11 UTC
I can't see any reason to keep all these patches in bugzilla with out pushing to master for more than a year !! Keeping something like this will not help to stabilize the code.
Comment 24 Sebastian Dröge (slomo) 2014-03-12 08:16:00 UTC
While I agree with you, it still needs someone to review the code and spend some time on it. It would be great to merge this though...

Do these patches still apply against latest master? I could move this up on my list a bit, but no promises...
Comment 25 sreerenj 2014-03-12 08:30:46 UTC
(In reply to comment #24)
> While I agree with you, it still needs someone to review the code and spend
> some time on it. It would be great to merge this though...

It was a working code (and had decent stability). If it get pushed sometimes before, then it could have  reached enough stability by this time.

> 
> Do these patches still apply against latest master?

most probably not..and this is one of the main problem because of the delay. Each time some one need to put effort to rebase it..


 I could move this up on my
> list a bit, but no promises...
Comment 26 sreerenj 2014-03-12 08:31:37 UTC
(In reply to comment #24)
> While I agree with you, it still needs someone to review the code and spend
> some time on it. It would be great to merge this though...

It was a working code (and had decent stability). If it get pushed sometimes before, then it could have  reached enough stability by this time.

> 
> Do these patches still apply against latest master?

most probably not..and this is one of the main problem because of the delay. Each time some one need to put effort to rebase it..


 I could move this up on my
> list a bit, but no promises...
Comment 27 Gwenole Beauchesne 2014-03-24 13:49:31 UTC
Review of attachment 239074 [details] [review]:

I have dropped this patch from the MVC codecparser series. The H.264 standard is strict, SPS id range is from 0 to 31, thus 32 entries maximum. If this is an issue for the videoparser, please open a separate issue.
Comment 28 Gwenole Beauchesne 2014-03-24 13:54:04 UTC
Review of attachment 238381 [details] [review]:

Fixed locally. Several issues in there. BTW, it would be interesting to list any sample that exhibit this SEI message. Thanks. :)

BTW, this patch is non-essential for the whole MVC codecparser series.

::: gst-libs/gst/codecparsers/gsth264parser.c
@@ +1210,3 @@
+  READ_UINT8 (nr, info->next_frame_is_second_view_flag, 1);
+  READ_UINT8 (nr, info->left_view_self_contained_flag, 1);
+  READ_UINT8 (nr, info->right_view_self_contained_flag, 1);

Missed field_views_flag condition for top_field_is_left_view_flag, current_frame_is_left_view_flag, next_frame_is_second_view_flag.

Besides, using the _unchecked variant is possible and desirable.

::: gst-libs/gst/codecparsers/gsth264parser.h
@@ +875,3 @@
     GstH264BufferingPeriod buffering_period;
     GstH264PicTiming pic_timing;
+    GstH264StereoVideoInfo stereo_info;

stereo_video_info to match H.264 spec.
Comment 29 Gwenole Beauchesne 2014-03-24 13:58:12 UTC
Review of attachment 238382 [details] [review]:

Non essential to MVC codecparser series but should be OK. Thanks.
Comment 30 Gwenole Beauchesne 2014-03-24 14:59:34 UTC
Created attachment 272783 [details] [review]
codecparsers: h264: complete set of NAL unit types
Comment 31 Gwenole Beauchesne 2014-03-24 15:00:15 UTC
Created attachment 272784 [details] [review]
codecparsers: h264: add gst_h264_parse_sps_data() helper
Comment 32 Gwenole Beauchesne 2014-03-24 15:00:58 UTC
Created attachment 272785 [details] [review]
codecparsers: h264: add gst_h264_parse_nalu_header() helper
Comment 33 Gwenole Beauchesne 2014-03-24 15:02:00 UTC
Created attachment 272786 [details] [review]
codecparsers: h264: parse MVC syntax elements
Comment 34 Gwenole Beauchesne 2014-03-24 15:03:31 UTC
Created attachment 272787 [details] [review]
codecparsers: h264: parse  seq_parameter_set_mvc_extension()
Comment 35 Gwenole Beauchesne 2014-03-24 15:04:46 UTC
Created attachment 272788 [details] [review]
codecparsers: h264: fix slice_header() parsing for MVC

The idr_pic_id syntax element depends on IdrPicFlag, which is a calculated value that does not only depend on NAL unit type (IDR), but possibly also on MVC non_idr_flag syntax element.

This is not specific to MVC. So, I will eventually commit as is, as obvious bug fix.
Comment 36 Gwenole Beauchesne 2014-03-24 15:05:39 UTC
Created attachment 272789 [details] [review]
codecparsers: h264: add support for Stereo Video  Information SEI message
Comment 37 Gwenole Beauchesne 2014-03-24 15:08:02 UTC
Created attachment 272790 [details] [review]
codecparsers: h264: add support for Frame Packing  Arrangement SEI message

Added GST_H264_FRAME_PACKING_NONE and fixed conformance to D.2.25 in regards to frame_packing_arrangement_extension_flag and any subsequent bits, within the payload, that need to be skipped.
Comment 38 Gwenole Beauchesne 2014-03-24 15:12:29 UTC
Patches submitted as attachment #272783 [details], attachment #272784 [details], attachment #272785 [details], attachment #272788 [details] are trivial enough to be committed as is. Comments welcome for others, but they are fine to me.

SEI message parsing selection will be changed to a switch instead.
Comment 39 Gwenole Beauchesne 2014-03-24 15:39:56 UTC
(In reply to comment #24)
> While I agree with you, it still needs someone to review the code and spend
> some time on it. It would be great to merge this though...
> 
> Do these patches still apply against latest master? I could move this up on my
> list a bit, but no promises...

Done, patches were rebased to master. Reviewed once more, and patches mentioned in comment #38 are either trivial or cosmetical changes. Even the SEI related ones, I'd say.

Others indeed brings in new APIs that could be discussed. I renamed gst_h264_sps_free_1() to gst_h264_sps_clear() as it could be misleading. i.e. it only clears the internal resources, no the actual GstH264Sps structure.
Comment 40 Gwenole Beauchesne 2014-03-24 17:19:10 UTC
Regression testing completed with the patches mentioned in comment #38, they will be pushed so that to only keep MVC-specific patches in this bug report.
Comment 41 Gwenole Beauchesne 2014-03-24 22:53:11 UTC
Review of attachment 272790 [details] [review]:

::: gst-libs/gst/codecparsers/gsth264parser.c
@@ +950,3 @@
+  if (!frame_packing_extension_flag)
+    goto error;
+  nal_reader_skip (nr, payload_size - (nal_reader_get_pos (nr) - start_pos));

I will introduce a nal_reader_skip_long() function instead. It looks like nal_reader_skip() is more tailored to nbits <= sizeof(cache) * 8 [64 bits]. Thus, also simplifying the default case in the SEI payloader parser.
Comment 42 Gwenole Beauchesne 2014-03-24 22:53:40 UTC
Review of attachment 272783 [details] [review]:

Pused to master.
Comment 43 Gwenole Beauchesne 2014-03-24 22:54:04 UTC
Review of attachment 272784 [details] [review]:

Pushed to master.
Comment 44 Gwenole Beauchesne 2014-03-24 22:54:14 UTC
Review of attachment 272785 [details] [review]:

Pushed to master.
Comment 45 Gwenole Beauchesne 2014-03-24 22:54:24 UTC
Review of attachment 272788 [details] [review]:

Pushed to master.
Comment 46 Gwenole Beauchesne 2014-03-24 22:54:48 UTC
Review of attachment 272783 [details] [review]:

Pushed to master.
Comment 47 Gwenole Beauchesne 2014-03-25 10:23:27 UTC
Review of attachment 272787 [details] [review]:

I will keep gst_h264_sps_copy() internal and only export (and comment) gst_h264_sps_clear() function instead. WDYT?

In terms of new functions, that's the only tolerable one. As to the MVC specific structure names, comments are welcome. Though, I could hardly do differently but dynamically allocating the arrays to be completely generic and conforming. Hence, gst_h264_sps_clear() will be needed to release any internal resources used.
Comment 48 Gwenole Beauchesne 2014-03-25 10:44:20 UTC
Review of attachment 272786 [details] [review]:

::: gst-libs/gst/codecparsers/gsth264parser.h
@@ +481,3 @@
   guint8 constraint_set3_flag;
+  guint8 constraint_set4_flag;
+  guint8 constraint_set5_flag;

I will move that down to maintain some binary compatibility.
Comment 49 Gwenole Beauchesne 2014-03-25 12:10:28 UTC
(In reply to comment #48)
> Review of attachment 272786 [details] [review]:
> 
> ::: gst-libs/gst/codecparsers/gsth264parser.h
> @@ +481,3 @@
>    guint8 constraint_set3_flag;
> +  guint8 constraint_set4_flag;
> +  guint8 constraint_set5_flag;
> 
> I will move that down to maintain some binary compatibility.

Sorry, I lied, no release was made up from -bad master, and I would like to keep the fields aligned together. There is readily an ABI incompatible change in maste vs. 1.2, so another one wouldn't hurt I believe. And we can still bump the SONAME anyway.
Comment 50 Gwenole Beauchesne 2014-03-25 13:20:26 UTC
Created attachment 272847 [details] [review]
codecparsers: h264: parse  seq_parameter_set_mvc_extension()

Changes:
- Made gst_h264_sps_copy() internal only
Comment 51 Gwenole Beauchesne 2014-03-25 13:21:51 UTC
Created attachment 272848 [details] [review]
codecparsers: h264: add support for Stereo Video  Information SEI message

Changes:
- Migrated to use a switch in gst_h264_parser_parse_sei_message()
- Added some log message in h264parse element to shut up compiler warnings
Comment 52 Gwenole Beauchesne 2014-03-25 13:23:21 UTC
Created attachment 272849 [details] [review]
codecparsers: h264: add support for Frame Packing  Arrangement SEI message

Changes:
- Migrated to use a switch in gst_h264_parser_parse_sei_message()
- Added log message in h264parse element to shut up compiler warnings
- Used nal_reader_skip_long() as depicted in the previous comment
Comment 53 Gwenole Beauchesne 2014-04-29 13:10:21 UTC
Review of attachment 272786 [details] [review]:

::: gst-libs/gst/codecparsers/gsth264parser.c
@@ +242,3 @@
+      break;
+    default:
+      nalu->extension_type = GST_H264_NAL_EXTENSION_NONE;

Before I forget, default initialization to GST_H264_NAL_EXTENSION_NONE needs to be moved up before the switch() so that we can have some sensible value for SVC streams, even if we don't support them. Or, we should correctly initialize that for SVC NAL units too, and reject them subsequently in parser functions.
Comment 54 Gwenole Beauchesne 2014-05-21 20:03:45 UTC
No additional change needed beyond comment #53. Full H.264 MVC decoding support was pushed to gstreamer-vaapi git master branch. No regression on H.264 AVC conformance testing either.

Please let me know if this could be suitable for 1.4.y with y > 0 or y == 0? :)

I would prefer 1.4.0 because of bug #727017, thus avoiding further ABI changes in the future. Even though gstreamer-vaapi is the only user at this time, and has its own local copy, I'd really like minimal changes between those, reduced to none actually. Thanks.
Comment 55 Jan Schmidt 2014-10-29 12:28:58 UTC
Thanks, merged with one minor fix and pushed to master. Sorry it took so long!
Comment 56 Tim-Philipp Müller 2014-10-29 12:55:51 UTC
Just to be sure, this breaks ABI through the SPS structure extension and is not suitable for 1.4 (because of that and in general).