[Libva] [PATCH] va: Add va_enc_mvc.h for MVC encoding

Yuan, Feng feng.yuan at intel.com
Thu Jan 2 23:34:06 PST 2014



>-----Original Message-----
>From: libva-bounces at lists.freedesktop.org
>[mailto:libva-bounces at lists.freedesktop.org] On Behalf Of Li, Xiaowei A
>Sent: Friday, January 03, 2014 10:49 AM
>To: Li, Xiaowei A; 'Gwenole Beauchesne'
>Cc: libva at lists.freedesktop.org
>Subject: Re: [Libva] [PATCH] va: Add va_enc_mvc.h for MVC encoding
>
>The max overhead could be more than: sizeof(struct H264SPSExtMVCView) *
>1024 + sizeof(uint16_t)) * 64 * 1024 * 1024 if we define one full range static
>array in seq-mvc, that's terrible, so we'd better use (number + VABufferID *)
>or (number + prt*) to carry the valid info.
If this buffer as separate, is it possible to define 
 struct VAEncMultiviewInfoBuffer {
    uint16_t num_views;
    VAEncMultiviewInfo views[0];
 };
Let user to decide how many views they need which can also save overhead.

Thanks,
Wind

>
>Thanks,
>Xiaowei
>-----Original Message-----
>From: libva-bounces at lists.freedesktop.org
>[mailto:libva-bounces at lists.freedesktop.org] On Behalf Of Li, Xiaowei A
>Sent: Friday, January 3, 2014 9:04 AM
>To: 'Gwenole Beauchesne'
>Cc: libva at lists.freedesktop.org
>Subject: Re: [Libva] [PATCH] va: Add va_enc_mvc.h for MVC encoding
>
>Hi,
>   I mean that the max number of view and max applicable operation point
>can be up to 1024 and level value number can up to 64 at most, if I allocate
>the full range arrays in the seq-param, this will take up much memory, in real
>case we will not apply so many views and level values, so I want to minimize
>the memory usage. If use the VABufferID method and only allocate valid value,
>this will save many memory space.
>
>Thanks
>Xiaowei
>
>-----Original Message-----
>From: Gwenole Beauchesne [mailto:gb.devel at gmail.com]
>Sent: Thursday, January 2, 2014 4:54 PM
>To: Li, Xiaowei A
>Cc: libva at lists.freedesktop.org
>Subject: Re: [Libva] [PATCH] va: Add va_enc_mvc.h for MVC encoding
>
>Hi,
>
>2013/12/27 Li, Xiaowei A <xiaowei.a.li at intel.com>:
>
>>     Do you mean to use VAEncMiscParameterBuffer to load the
>LevelValue
>> and LevelValueOP info? I need to define
>> VAEncMicsParameterMultiviweLevelValueType and
>> VAEncMicsParameterMultiviweLevelValueOpType then(according to
>> "VAEncMiscParameterBuffer" usage example, all MISC parameter need to
>> be defined like this)
>
>Yes, that was the idea.
>
>BTW, what's wrong with defining the full range arrays in
>VAEncSequenceParameterBufferH264_MVC in the first place? You initially
>mentioned overhead, but is it really overhead after all? And how? I mean,
>seq-param buffers are not going to be uploaded for every frame.
>And even if that was the case, the range of valid values would be limited and
>determined with the num_* fields.
>
>i.e. could you please quantify this overhead?
>
>Thanks,
>Gwenole.
>
>> -----Original Message-----
>> From: Gwenole Beauchesne [mailto:gb.devel at gmail.com]
>> Sent: Friday, December 20, 2013 2:15 PM
>> To: Li, Xiaowei A
>> Cc: libva at lists.freedesktop.org
>> Subject: Re: [Libva] [PATCH] va: Add va_enc_mvc.h for MVC encoding
>>
>> Hi,
>>
>> On a second thought, since the seq-param and pic-param structs for
>encoding are only meant for the driver, and not the HW, this is bound to live in
>system memory. Thus, we could efficiently use the existing VABuffer
>mechanisms to have variable number of elements in buffers.
>>
>> VAEncMultiviewInfoBufferType
>> VAEncMultiviewLevelValueType
>> VAEncMultiviewLevelValueOpType
>> use re-use the VAEncMiscParameterBuffer functionality.
>>
>> and use VABufferIDs in VAEncSequenceParameterBufferH264_MVC. That
>way, we can have the full range of possible views, level values and level value
>ops.
>>
>> That's because having only 2 views supported is terribly limiting.
>>
>> Regards,
>> Gwenole.
>>
>> 2013/12/20 Li Xiaowei <xiaowei.a.li at intel.com>:
>>> Signed-off-by: Li Xiaowei <xiaowei.a.li at intel.com>
>>> ---
>>>  va/Makefile.am  |    1 +
>>>  va/va_enc_mvc.h |  172
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>  2 files changed, 173 insertions(+)
>>>  create mode 100644 va/va_enc_mvc.h
>>>
>>> diff --git a/va/Makefile.am b/va/Makefile.am index 425225c..af4f86f
>>> 100644
>>> --- a/va/Makefile.am
>>> +++ b/va/Makefile.am
>>> @@ -49,6 +49,7 @@ libva_source_h = \
>>>         va_drmcommon.h          \
>>>         va_enc.h                \
>>>         va_enc_h264.h           \
>>> +       va_enc_mvc.h            \
>>>         va_enc_jpeg.h           \
>>>         va_enc_vp8.h            \
>>>         va_enc_mpeg2.h          \
>>> diff --git a/va/va_enc_mvc.h b/va/va_enc_mvc.h new file mode 100644
>>> index 0000000..267442b
>>> --- /dev/null
>>> +++ b/va/va_enc_mvc.h
>>> @@ -0,0 +1,172 @@
>>> +/*
>>> + * Copyright (c) 2007-2013 Intel Corporation. All Rights Reserved.
>>> + *
>>> + * Permission is hereby granted, free of charge, to any person
>>> +obtaining a
>>> + * copy of this software and associated documentation files (the
>>> + * "Software"), to deal in the Software without restriction,
>>> +including
>>> + * without limitation the rights to use, copy, modify, merge,
>>> +publish,
>>> + * distribute, sub license, and/or sell copies of the Software, and
>>> +to
>>> + * permit persons to whom the Software is furnished to do so,
>>> +subject to
>>> + * the following conditions:
>>> + *
>>> + * The above copyright notice and this permission notice (including
>>> +the
>>> + * next paragraph) shall be included in all copies or substantial
>>> +portions
>>> + * of the Software.
>>> + *
>>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
>KIND,
>>> +EXPRESS
>>> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>>> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
>NON-INFRINGEMENT.
>>> + * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
>>> + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
>OF
>>> +CONTRACT,
>>> + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
>WITH THE
>>> + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
>>> + */
>>> +
>>> +/**
>>> + * \file va_enc_mvc.h
>>> + * \brief MVC(Multiview video coding) encoding API
>>> + *
>>> + * This file contains the \ref api_enc_mvc "mvc encoding API".
>>> + */
>>> +
>>> +#ifndef VA_ENC_MVC_H
>>> +#define VA_ENC_MVC_H
>>> +
>>> +#ifdef __cplusplus
>>> +extern "C" {
>>> +#endif
>>> +
>>> +#include <stdint.h>
>>> +#include "va_enc_h264.h"
>>> +
>>> +/* In order to minimize the overhead payload of the structure,
>>> + * we limit the max number for view and other parameters here,
>>> + * although the actual view number and applicable operation point
>>> + * number can be up to 1024, and level value can be up to 64
>>> + * according to H264 MVC specification.
>>> + */
>>> +
>>> +#define VA_MVC_MAX_VIEW_NUM 2
>>> +#define VA_MVC_MAX_LEVEL_VALUE_NUM 2 #define
>>> +VA_MVC_MAX_APPLICABLE_OP_NUM 1
>>> +
>>> +/**
>>> + * \defgroup api_enc_mvc MVC encoding API
>>> + *
>>> + * @{
>>> + */
>>> +
>>> +/****************************
>>> + * H.264/MVC data structures
>>> + ****************************/
>>> +
>>> +/**
>>> + * \brief H.264/MVC Sequence Parameter Buffer
>>> + *
>>> + */
>>> +typedef struct _VAEncSequenceParameterBufferH264_MVC {
>>> +
>>> +     VAEncSequenceParameterBufferH264 base;
>>> +
>>> +     /* plus 1 specifies the max number of views
>>> +      * coded in the video sequence */
>>> +     uint16_t num_views_minus1;
>>> +
>>> +     /*inter-view dependency relationships for the coded video
>sequence*/
>>> +     struct H264SPSExtMVCView {
>>> +           /* The view identifier */
>>> +           uint16_t view_id;
>>> +           /* specifies the number of view components for inter-view
>>> +            * prediction in the initialized RefPicList0 in decoding
>>> +            * anchor views.
>>> +            */
>>> +           uint8_t  num_anchor_refs_l0;
>>> +           /* specifies the view_id for inter-view prediction in
>>> +            * the initialized RefPicList0 in decoding anchor views.
>>> +            */
>>> +           uint8_t anchor_ref_l0[15];
>>> +           /* specifies the number of view components for inter-view
>>> +            * prediction in the initialized RefPicList0 in decoding
>>> +            * anchor views
>>> +            */
>>> +           uint8_t  num_anchor_refs_l1;
>>> +           /* specifies the view_id for inter-view prediction in
>>> +            * the initialized RefPicList1 in decoding anchor views.
>>> +            */
>>> +           uint16_t anchor_ref_l1[15];
>>> +           /* specifies the number of view components for inter-view
>>> +            * prediction in the initialized RefPicList0 in decoding
>>> +            * non-anchor views.
>>> +            */
>>> +           uint8_t  num_non_anchor_refs_l0;
>>> +           /* specifies the view_id for inter-view prediction in
>>> +            * the initialized RefPicList0 in decoding non-anchor views.
>>> +            */
>>> +           uint16_t non_anchor_ref_l0[15];
>>> +           /* specifies the number of view components for inter-view
>>> +            * prediction in the initialized RefPicList1 in decoding
>>> +            * non-anchor view.
>>> +            */
>>> +           uint8_t  num_non_anchor_refs_l1;
>>> +           /* specifies the view_id for inter-view prediction in
>>> +            * the initialized RefPicList1 in decoding non-anchor views.
>>> +            */
>>> +           uint16_t non_anchor_ref_l1[15];
>>> +     } view[VA_MVC_MAX_VIEW_NUM];
>>> +
>>> +     /* plus 1 specifies the number of level values
>>> +      * signalled for the coded video sequence.
>>> +      */
>>> +     uint8_t num_level_values_signalled_minus1;
>>> +
>>> +     /* level values for a subset of the operation points for
>>> +      * the coded video sequence
>>> +      */
>>> +     struct H264SPSExtMVCLevelValue {
>>> +         /* specifies the level value signalled for the coded video
>sequence */
>>> +         uint8_t level_idc;
>>> +
>>> +         /* plus 1 specifies the number of operation points to
>>> +          * which the level indicated by level_idc applies
>>> +          */
>>> +         uint16_t num_applicable_ops_minus1;
>>> +
>>> +         /* Represent the operation points for the coded
>>> +          * video sequence
>>> +          */
>>> +         struct H264SPSExtMVCLevelValueOp {
>>> +             uint8_t  temporal_id;
>>> +             uint16_t num_target_views_minus1;
>>> +             uint16_t target_view_id[VA_MVC_MAX_VIEW_NUM];
>>> +             uint16_t num_views_minus1;
>>> +         } applicable_op[VA_MVC_MAX_APPLICABLE_OP_NUM];
>>> +
>>> +     } level_value[VA_MVC_MAX_LEVEL_VALUE_NUM];
>>> +
>>> +} VAEncSequenceParameterBufferH264_MVC;
>>> +
>>> +/**
>>> + * \brief H.264/MVC Picture Parameter Buffer
>>> + *
>>> + */
>>> +typedef struct _VAEncPictureParameterBufferH264_MVC
>>> +{
>>> +    VAEncPictureParameterBufferH264 base;
>>> +
>>> +    /* specifes the view id for current picture */
>>> +    uint16_t view_id;
>>> +
>>> +    /* specifes current picture is one anchor picture */
>>> +    uint8_t  anchor_pic_flag;
>>> +
>>> +    /* specifes whether inter view reference frame
>>> +     * is used to encode current picture.
>>> +     */
>>> +    uint8_t  inter_view_flag;
>>> +} VAEncPictureParameterBufferH264_MVC;
>>> +
>>> +#ifdef __cplusplus
>>> +}
>>> +#endif
>>> +
>>> +#endif /* VA_ENC_MVC_H */
>>> --
>>> 1.7.9.5
>>>
>>> _______________________________________________
>>> Libva mailing list
>>> Libva at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/libva
>_______________________________________________
>Libva mailing list
>Libva at lists.freedesktop.org
>http://lists.freedesktop.org/mailman/listinfo/libva
>_______________________________________________
>Libva mailing list
>Libva at lists.freedesktop.org
>http://lists.freedesktop.org/mailman/listinfo/libva


More information about the Libva mailing list