[Libva] [PATCH Libva-intel-driver] Encoding: Remove the redundant MVC structure for encoding

Gwenole Beauchesne gb.devel at gmail.com
Mon Jun 16 08:20:07 PDT 2014


OK. Thanks.

2014-06-16 3:29 GMT+02:00 Zhao, Yakui <yakui.zhao at intel.com>:
> From: "Zhao, Yakui" <yakui.zhao at intel.com>
>
> Now the corresponding structures/slice_header data will be handled by
> the upper-layer. So the corresponding definition in driver looks redundant.
>
> Signed-off-by: Zhao, Yakui <yakui.zhao at intel.com>
> ---
>  src/gen6_mfc_common.c    | 56 +++++++++----------------------------------
>  src/i965_encoder_utils.c | 62 ------------------------------------------------
>  src/i965_encoder_utils.h | 10 --------
>  3 files changed, 11 insertions(+), 117 deletions(-)
>
> diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
> index 8eea8a2..c983293 100644
> --- a/src/gen6_mfc_common.c
> +++ b/src/gen6_mfc_common.c
> @@ -1577,51 +1577,17 @@ void intel_avc_slice_insert_packed_data(VADriverContextP ctx,
>          VAEncSliceParameterBufferH264 *pSliceParameter = (VAEncSliceParameterBufferH264 *)encode_state->slice_params_ext[slice_index]->buffer;
>
>          /* No slice header data is passed. And the driver needs to generate it */
> -        if (encoder_context->codec == CODEC_H264_MVC) {
> -            VAEncSequenceParameterBufferH264_MVC *mvc_seq_param   = (VAEncSequenceParameterBufferH264_MVC *)pSequenceParameter;
> -            VAEncPictureParameterBufferH264_MVC  *mvc_pic_param   = (VAEncPictureParameterBufferH264_MVC*)pPicParameter;
> -            VAEncSliceParameterBufferH264   *slice_param     = pSliceParameter;
> -
> -            if (mvc_pic_param->view_id != 0) {
> -                /* generate one extension slice header with type of 20 */
> -                slice_header_length_in_bits = build_avc_mvc_slice_header(mvc_seq_param,
> -                                                                     mvc_pic_param,
> -                                                                     slice_param,
> -                                                                     &slice_header);
> -                mfc_context->insert_object(ctx, encoder_context,
> -                                       (unsigned int *)slice_header,
> -                                       ALIGN(slice_header_length_in_bits, 32) >> 5,
> -                                       slice_header_length_in_bits & 0x1f,
> -                                       8,  /* first 5 bytes are start code + nal unit type */
> -                                       1, 0, 1, slice_batch);
> -
> -            } else {
> -
> -                /* generate common H264 slice header */
> -                slice_header_length_in_bits = build_avc_slice_header(pSequenceParameter,
> -                                                                 pPicParameter,
> -                                                                 pSliceParameter,
> -                                                                 &slice_header);
> -                mfc_context->insert_object(ctx, encoder_context,
> -                                           (unsigned int *)slice_header,
> -                                           ALIGN(slice_header_length_in_bits, 32) >> 5,
> -                                           slice_header_length_in_bits & 0x1f,
> -                                           5,  /* first 5 bytes are start code + nal unit type */
> -                                           1, 0, 1, slice_batch);
> -            }
> -        } else {
> -            /* For the Normal H264 */
> -            slice_header_length_in_bits = build_avc_slice_header(pSequenceParameter,
> -                                                                pPicParameter,
> -                                                                pSliceParameter,
> -                                                                &slice_header);
> -            mfc_context->insert_object(ctx, encoder_context,
> -                                      (unsigned int *)slice_header,
> -                                      ALIGN(slice_header_length_in_bits, 32) >> 5,
> -                                      slice_header_length_in_bits & 0x1f,
> -                                      5,  /* first 5 bytes are start code + nal unit type */
> -                                      1, 0, 1, slice_batch);
> -        }
> +        /* For the Normal H264 */
> +        slice_header_length_in_bits = build_avc_slice_header(pSequenceParameter,
> +                                                             pPicParameter,
> +                                                             pSliceParameter,
> +                                                             &slice_header);
> +        mfc_context->insert_object(ctx, encoder_context,
> +                                   (unsigned int *)slice_header,
> +                                   ALIGN(slice_header_length_in_bits, 32) >> 5,
> +                                   slice_header_length_in_bits & 0x1f,
> +                                   5,  /* first 5 bytes are start code + nal unit type */
> +                                   1, 0, 1, slice_batch);
>          free(slice_header);
>      } else {
>          unsigned int skip_emul_byte_cnt;
> diff --git a/src/i965_encoder_utils.c b/src/i965_encoder_utils.c
> index e59e7fb..a232564 100644
> --- a/src/i965_encoder_utils.c
> +++ b/src/i965_encoder_utils.c
> @@ -201,25 +201,6 @@ static void nal_header(avc_bitstream *bs, int nal_ref_idc, int nal_unit_type)
>      avc_bitstream_put_ui(bs, nal_unit_type, 5);
>  }
>
> -static void
> -nal_header_mvc_extension(avc_bitstream *bs,
> -                     VAEncSequenceParameterBufferH264_MVC *mvc_sps_param,
> -                     VAEncPictureParameterBufferH264_MVC  *mvc_pic_param,
> -                     VAEncSliceParameterBufferH264   *slice_param)
> -{
> -    VAEncPictureParameterBufferH264 *pic_param = &mvc_pic_param->base;
> -    int non_idr = !pic_param->pic_fields.bits.idr_pic_flag;
> -
> -    avc_bitstream_put_ui(bs, 0, 1);                             /* svc extension flag */
> -    avc_bitstream_put_ui(bs, non_idr, 1);                       /* non_idr_flag */
> -    avc_bitstream_put_ui(bs, 5, 6);                             /* priority_id */
> -    avc_bitstream_put_ui(bs, mvc_pic_param->view_id, 10);       /* view_id */
> -    avc_bitstream_put_ui(bs, 0, 3);                             /* temporal_id */
> -    avc_bitstream_put_ui(bs, mvc_pic_param->anchor_pic_flag, 1);/* anchor_pic_flag */
> -    avc_bitstream_put_ui(bs, mvc_pic_param->inter_view_flag, 1);/* inter_view_flag */
> -    avc_bitstream_put_ui(bs, 1, 1);                             /* reserved_one_bit */
> -}
> -
>  static void
>  slice_header(avc_bitstream *bs,
>               VAEncSequenceParameterBufferH264 *sps_param,
> @@ -518,47 +499,4 @@ build_mpeg2_slice_header(VAEncSequenceParameterBufferMPEG2 *sps_param,
>      return bs.bit_offset;
>  }
>
> -int
> -build_avc_mvc_prefix_nal_unit(VAEncSequenceParameterBufferH264_MVC *mvc_sps_param,
> -                              VAEncPictureParameterBufferH264_MVC  *mvc_pic_param,
> -                              VAEncSliceParameterBufferH264   *slice_param,
> -                              unsigned char **nal_unit_buffer)
> -{
> -    VAEncPictureParameterBufferH264 *pic_param = &mvc_pic_param->base;
> -    int is_ref = !!pic_param->pic_fields.bits.reference_pic_flag;
> -    avc_bitstream bs;
>
> -    avc_bitstream_start(&bs);
> -    nal_start_code_prefix(&bs);
> -
> -    nal_header(&bs, is_ref ? NAL_REF_IDC_LOW : NAL_REF_IDC_NONE, NAL_PREFIX);
> -    nal_header_mvc_extension(&bs, mvc_sps_param, mvc_pic_param, slice_param);
> -
> -    avc_bitstream_end(&bs);
> -    *nal_unit_buffer = (unsigned char *)bs.buffer;
> -
> -    return bs.bit_offset;
> -}
> -
> -int
> -build_avc_mvc_slice_header(VAEncSequenceParameterBufferH264_MVC *mvc_sps_param,
> -                           VAEncPictureParameterBufferH264_MVC  *mvc_pic_param,
> -                           VAEncSliceParameterBufferH264   *slice_param,
> -                           unsigned char **slice_header_buffer)
> -{
> -    avc_bitstream bs;
> -    VAEncPictureParameterBufferH264 *pic_param = &mvc_pic_param->base;
> -    int is_ref = !!pic_param->pic_fields.bits.reference_pic_flag;
> -
> -    avc_bitstream_start(&bs);
> -    nal_start_code_prefix(&bs);
> -
> -    nal_header(&bs, is_ref ? NAL_REF_IDC_HIGH : NAL_REF_IDC_NONE, NAL_SLICE_EXTENSION);
> -    nal_header_mvc_extension(&bs, mvc_sps_param, mvc_pic_param, slice_param);
> -    slice_header(&bs, &mvc_sps_param->base, &mvc_pic_param->base, slice_param);
> -
> -    avc_bitstream_end(&bs);
> -    *slice_header_buffer = (unsigned char *)bs.buffer;
> -
> -    return bs.bit_offset;
> -}
> diff --git a/src/i965_encoder_utils.h b/src/i965_encoder_utils.h
> index 4885376..60dada1 100644
> --- a/src/i965_encoder_utils.h
> +++ b/src/i965_encoder_utils.h
> @@ -33,15 +33,5 @@ build_mpeg2_slice_header(VAEncSequenceParameterBufferMPEG2 *sps_param,
>                           VAEncSliceParameterBufferMPEG2 *slice_param,
>                           unsigned char **slice_header_buffer);
>
> -int
> -build_avc_mvc_prefix_nal_unit(VAEncSequenceParameterBufferH264_MVC *mvc_sps_param,
> -                              VAEncPictureParameterBufferH264_MVC  *mvc_pic_param,
> -                              VAEncSliceParameterBufferH264   *slice_param,
> -                              unsigned char **nal_unit_buffer);
> -int
> -build_avc_mvc_slice_header(VAEncSequenceParameterBufferH264_MVC *mvc_sps_param,
> -                           VAEncPictureParameterBufferH264_MVC  *mvc_pic_param,
> -                           VAEncSliceParameterBufferH264   *slice_param,
> -                           unsigned char **slice_header_buffer);
>
>  #endif /* __I965_ENCODER_UTILS_H__ */
> --
> 1.7.12-rc1
>
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva



-- 
Gwenole Beauchesne
Intel Corporation SAS / 2 rue de Paris, 92196 Meudon Cedex, France
Registration Number (RCS): Nanterre B 302 456 199


More information about the Libva mailing list