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 724266 - encoder: h264: add initial support for MVC profiles
encoder: h264: add initial support for MVC profiles
Status: RESOLVED FIXED
Product: gstreamer-vaapi
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gstreamer-vaapi maintainer(s)
gstreamer-vaapi maintainer(s)
Depends on:
Blocks: 720305
 
 
Reported: 2014-02-13 03:26 UTC by xiaowei
Modified: 2014-06-03 11:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
MVC profiles definition (2.76 KB, patch)
2014-02-13 03:27 UTC, xiaowei
none Details | Review
Isolate the bitstream writer from encoder (32.39 KB, patch)
2014-02-13 03:30 UTC, xiaowei
none Details | Review
Support subset sps bitstream writing (5.89 KB, application/octet-stream)
2014-02-13 03:31 UTC, xiaowei
  Details
Wrap the ref and reorder frame list management (22.51 KB, patch)
2014-02-13 04:21 UTC, xiaowei
none Details | Review
Encode two views and generate MVC bitstream (16.55 KB, patch)
2014-02-13 05:53 UTC, xiaowei
none Details | Review
Add MVC profiles mapping to driver profiles (1.47 KB, patch)
2014-02-19 07:30 UTC, xiaowei
reviewed Details | Review
Add MVC subset sps bit stream writting (5.34 KB, patch)
2014-02-19 07:32 UTC, xiaowei
reviewed Details | Review
Wrap the ref and reorder frame list management (21.40 KB, patch)
2014-02-19 07:35 UTC, xiaowei
reviewed Details | Review
MVC enc: Encode two views and generate MVC bitstream (20.85 KB, patch)
2014-02-19 07:35 UTC, xiaowei
reviewed Details | Review
encoder: h264: Fix the pipeline hang while doing mvc encoding with b-frames (1.14 KB, patch)
2014-04-09 09:22 UTC, sreerenj
none Details | Review
encoder: h264: store subset sps to generate the codec-data (3.46 KB, patch)
2014-04-10 11:23 UTC, sreerenj
none Details | Review
add MVCDecoderConfigurationRecord as codec_data (4.75 KB, patch)
2014-04-10 11:39 UTC, sreerenj
none Details | Review

Description xiaowei 2014-02-13 03:26:26 UTC
Create one bug to trace the patches for MVC encoding for gst-vaapi, Current just ramp up the functionality and only support 2 views encoding.
Comment 1 xiaowei 2014-02-13 03:27:27 UTC
Created attachment 268978 [details] [review]
MVC profiles definition
Comment 2 xiaowei 2014-02-13 03:30:31 UTC
Created attachment 268979 [details] [review]
Isolate the bitstream writer from encoder
Comment 3 xiaowei 2014-02-13 03:31:24 UTC
Created attachment 268980 [details]
Support subset sps bitstream writing
Comment 4 xiaowei 2014-02-13 04:21:08 UTC
Created attachment 268983 [details] [review]
Wrap the ref and reorder frame list management
Comment 5 xiaowei 2014-02-13 05:53:12 UTC
Created attachment 268987 [details] [review]
 Encode two views and generate MVC bitstream
Comment 6 xiaowei 2014-02-19 07:30:26 UTC
Created attachment 269669 [details] [review]
Add MVC profiles mapping to driver profiles
Comment 7 xiaowei 2014-02-19 07:32:18 UTC
Created attachment 269671 [details] [review]
Add MVC subset sps bit stream writting
Comment 8 xiaowei 2014-02-19 07:35:08 UTC
Created attachment 269672 [details] [review]
Wrap the ref and reorder frame list management
Comment 9 xiaowei 2014-02-19 07:35:56 UTC
Created attachment 269673 [details] [review]
MVC enc: Encode two views and generate MVC bitstream
Comment 10 sreerenj 2014-03-28 10:22:53 UTC
Review of attachment 269669 [details] [review]:

Would be good to add a VA_VERSION check to maintain the backward compatibility.
But yes, the mvc-patches are still hanging in libva-staging branch. I think Gwenole can add it later once libva has mvc support in master.
Comment 11 sreerenj 2014-03-28 10:29:29 UTC
Review of attachment 269671 [details] [review]:

Patch seems to be fine for me other than missing mvc_vui_extension() from the subset sps.
Comment 12 sreerenj 2014-03-28 10:31:03 UTC
Review of attachment 269672 [details] [review]:

Seems to be fine for me
Comment 13 sreerenj 2014-03-28 10:46:51 UTC
Review of attachment 269673 [details] [review]:

I have noticed a couple of issues:

-- enabling max-bframes >=1 causing the pipeline to hang in all occurrences.
-- have to store the subsetSPS also, which we need to generate the codec_data.
-- minor typo : warning message at the end of add_packed_mvc_sequence_header() should be GST_WARNING ("failed to write Subset SPS NAL unit");
Comment 14 sreerenj 2014-03-28 10:51:29 UTC
@Gwenole: 

It seems that the indentation has messed-up in the gstvaapiencoder_h264.c. It has a mess-up of upstream gstreamer indentation and gstreamer-vaapi indentation :)
May be it is the time to apply gst-indent on all gstreamer-vaapi files :)
Comment 15 sreerenj 2014-04-09 09:22:29 UTC
Created attachment 273871 [details] [review]
encoder: h264: Fix the pipeline hang while doing mvc encoding with b-frames
Comment 16 sreerenj 2014-04-10 11:23:14 UTC
Created attachment 273978 [details] [review]
encoder: h264: store subset sps to generate the codec-data

Store the SubsetSPS nal unit which we need for MVC specific codec_data generation.
Comment 17 sreerenj 2014-04-10 11:39:39 UTC
Created attachment 273979 [details] [review]
add MVCDecoderConfigurationRecord as codec_data

This patch is in "not for commit" state at the moment. We need to confirm few other things before enabling this. I am just submitting this patch to show the exact format of mvc_codec_data other than the normal avc_codec_data.

--Do we really need to provide codec_data separately for base_view and sub_view here? Then we need some major changes in gst-vaapi plugin implementation. Because the get_codec_data() won't get invoked second time by encoder plugins unless the input buffer format get changed.

--Do we just need to provide one MVCDecoderConfigurationRecord(mvc_codec_data) instead of avc_codec_data for the whole stream? Then also we need some major changes with in vaapiencoder_h264 to generate and store the  subset sps together with baseview. Because at the moment we are generating subset_sps only when view_idx changes to 1, which means for the non-baseview. So the first invocation of get_codec_data() (which get invoked before pushing first encoded base_view frame) can't generate the mvc-codec-data.
Comment 18 Gwenole Beauchesne 2014-04-10 17:29:47 UTC
I have not formally checked the MP4 spec. I believe the records are different, so this probably means to keep codec_data in different buffers? I think we actually need to check the various muxers (mkv, ts, mp4) and how likely/easy it would be to extend them to support the MVC records. On the other hand, it's common to look for "codec-data" only.

What about handling "codec-data" as a buffer list instead of a unique buffer? Though, the difficulty here would be a way to identify AVC vs. MVC vs. anything else.
Comment 19 sreerenj 2014-04-25 14:27:25 UTC
(In reply to comment #18)
As per the ISO Base file spec, we are supposed to provide two configuration records since we have both avc compatible base view and mvc specific non-base-view. 

As per mp4 spec:
If an MVC elementary stream contains a usable AVC compatible base view, then an AVC visual sample entry(‘avc1’ or ‘avc2’) shall be used. Here, the entry shall contain initially an AVC Configuration Box, possibly followed by an MVC Configuration Box as defined below. The AVC Configuration Box documents the Profile, Level and Parameter Set information pertaining to the AVC compatible base view as defined by the AVCDecoderConfigurationRecord. The MVC Configuration Box documents the Profile, Level and Parameter Set information pertaining to the entire stream containing the non-base views as defined by the MVCDecoderConfigurationRecord, stored in the MVCConfigurationBox.

A buffer-list might be the right option. Would be good to add some of the upstream guys also to the cc list.
Comment 20 Gwenole Beauchesne 2014-06-03 11:44:34 UTC
commit 73355a680f87d9cc56e7c165fb4e1904c5feb166
Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Date:   Wed May 7 00:09:19 2014 +0300

    encoder: h264: store subset sps to generate the codec-data
    
    Store the SubsetSPS nal unit which we need for MVC specific
    codec_data generation.

commit f0924ba0d1839405f8a5dfdda6ff7e29379a20ec
Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Date:   Wed May 7 00:08:33 2014 +0300

    encoder: h264: fix MVC pipeline hang while encoding with B-frames.
    
    Since we are encoding each view independently from each other, we
    need a higher number of pre-allocated surfaces to be used as the
    reconstructed frames. For Stereo High profile encoding, this means
    to effectively double the number of frames to be stored in the DPB.

commit 7bdf3fa177dffa5be4c5dd079aace0c5368d5277
Author: Li Xiaowei <xiaowei.a.li@intel.com>
Date:   Mon Feb 17 15:51:43 2014 +0800

    encoder: h264: add initial support for H.264 Stereo High profile.
    
    Add initial support for Subset SPS, Prefix NAL and Slice Extension NAL
    for non-base-view streams encoding, and the usual SPS, PPS and Slice
    NALs for base-view encoding.
    
    The H.264 Stereo High profile encoding mode will be turned on when the
    "num-views" parameter is set to 2. The source (raw) YUV frames will be
    considered as Left/Right view, alternatively.
    
    Each of the two views has its own frames reordering pool and reference
    frames list management system. Inter-view references are not supported
    yet, so the views are encoded independently from each other.
    
    Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
    [limited to Stereo High profile per the definition of MAX_NUM_VIEWS]
    Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>

commit 5323570a353425930596755dbaf20af6b063e9a7
Author: Li Xiaowei <xiaowei.a.li@intel.com>
Date:   Mon Feb 17 11:10:26 2014 +0800

    encoder: h264: wrap pools for refs and frames reordering.
    
    Create structures to maintain the reference frames list (RefPool) and
    frames reordering (ReorderPool) logic.
    
    This is a prerequisite for H.264 MVC support.
    
    Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>

commit 4beee390e5a1bbf04f4bfe710ef044dd1e0c52e7
Author: Li Xiaowei <xiaowei.a.li@intel.com>
Date:   Fri Feb 14 15:33:15 2014 +0800

    encoder: h264: add provisional support for subset SPS headers.
    
    Add provisions to write subset SPS headers to the bitstream in view
    to supporting the H.264 MVC specification.
    
    This assumes the libva "staging" branch is in use.
    
    Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>

commit fb7ecb15e27a89525569503d627478f9d90df561
Author: Li Xiaowei <xiaowei.a.li@intel.com>
Date:   Wed Dec 18 13:47:32 2013 +0800

    utils: add H.264 MVC profiles.
    
    Add "MultiView High" and "Stereo High" definitions.
    
    Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
    [require VA-API >= 0.35.2 for MVC profiles]
    Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>