[Libva] [PATCH] avcenc.c: use multi-slice encoding

Sean V Kelley sean.v.kelley at intel.com
Wed Aug 22 08:39:41 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

What are you using to test/validate?

Any additional description?

Sean


On 08/22/2012 08:04 AM, Haitao Huang wrote:
> Change-Id: Ibb5e03ddb6165aeb298a2960d369cb22fa948453 Signed-off-by:
> Haitao Huang <haitao.huang at intel.com> --- test/encode/avcenc.c |
> 96 ++++++++++++++++++++++---------------------------- 1 files
> changed, 42 insertions(+), 54 deletions(-)
> 
> diff --git a/test/encode/avcenc.c b/test/encode/avcenc.c index
> 54761a5..1d501b3 100644 --- a/test/encode/avcenc.c +++
> b/test/encode/avcenc.c @@ -367,63 +367,51 @@ static void
> avcenc_update_slice_parameter(int slice_type) { 
> VAEncSliceParameterBufferH264 *slice_param; VAStatus va_status; -
> int i; - -    // Slice level -    i = 0; -    slice_param =
> &avcenc_context.slice_param[i]; -
> slice_param->macroblock_address = 0; -
> slice_param->num_macroblocks = picture_height_in_mbs *
> picture_width_in_mbs; -    slice_param->pic_parameter_set_id = 0; -
> slice_param->slice_type = slice_type; -
> slice_param->direct_spatial_mv_pred_flag = 0; -
> slice_param->num_ref_idx_l0_active_minus1 = 0;      /* FIXME: ???
> */ -    slice_param->num_ref_idx_l1_active_minus1 = 0; -
> slice_param->cabac_init_idc = 0; -    slice_param->slice_qp_delta =
> 0; -    slice_param->disable_deblocking_filter_idc = 0; -
> slice_param->slice_alpha_c0_offset_div2 = 2; -
> slice_param->slice_beta_offset_div2 = 2; -
> slice_param->idr_pic_id = 0; - -    /* FIXME: fill other fields */ 
> +    int sliceIndex, actualSliceHeightInMB; +    int sliceNum=2; + 
> +    int unevenRowsInMB = picture_height_in_mbs % sliceNum; +
> int sliceHeightInMB = (picture_height_in_mbs - unevenRowsInMB) /
> sliceNum ; + +    int startAddressInMB = 0; + +    for (sliceIndex
> = 0; sliceIndex < sliceNum; sliceIndex++) { + +        slice_param
> = &avcenc_context.slice_param[sliceIndex]; +
> slice_param->pic_parameter_set_id = 0; +
> slice_param->slice_type = slice_type; +
> slice_param->direct_spatial_mv_pred_flag = 0; +
> slice_param->num_ref_idx_l0_active_minus1 = 0;      /* FIXME: ???
> */ +        slice_param->num_ref_idx_l1_active_minus1 = 0; +
> slice_param->cabac_init_idc = 0; +
> slice_param->slice_qp_delta = 0; +
> slice_param->disable_deblocking_filter_idc = 0; +
> slice_param->slice_alpha_c0_offset_div2 = 2; +
> slice_param->slice_beta_offset_div2 = 2; +
> slice_param->idr_pic_id = 0; + +        actualSliceHeightInMB =
> sliceHeightInMB; +        if (sliceIndex < unevenRowsInMB) { +
> //spread the remaining MB rows evenly one each for first few
> slices +            actualSliceHeightInMB ++; +        } +
> slice_param->macroblock_address = startAddressInMB; +
> slice_param->num_macroblocks = actualSliceHeightInMB *
> picture_width_in_mbs;
> 
> -    va_status = vaCreateBuffer(va_dpy, -
> avcenc_context.context_id, -
> VAEncSliceParameterBufferType, -
> sizeof(*slice_param), 1, slice_param, -
> &avcenc_context.slice_param_buf_id[i]); -
> CHECK_VASTATUS(va_status,"vaCreateBuffer");; -    i++; +        /*
> FIXME: fill other fields */ +        va_status = vaCreateBuffer( +
> va_dpy, +                avcenc_context.context_id, +
> VAEncSliceParameterBufferType, +
> sizeof(VAEncSliceParameterBufferH264), +                1,
> slice_param, +
> &avcenc_context.slice_param_buf_id[sliceIndex]); +
> CHECK_VASTATUS(va_status,"vaCreateBuffer")
> 
> -#if 0 -    slice_param = &avcenc_context.slice_param[i]; -
> slice_param->macroblock_address = picture_height_in_mbs *
> picture_width_in_mbs / 2; -    slice_param->num_macroblocks =
> picture_height_in_mbs * picture_width_in_mbs / 2; -
> slice_param->pic_parameter_set_id = 0; -    slice_param->slice_type
> = slice_type; -    slice_param->direct_spatial_mv_pred_flag = 0; -
> slice_param->num_ref_idx_l0_active_minus1 = 0;      /* FIXME: ???
> */ -    slice_param->num_ref_idx_l1_active_minus1 = 0; -
> slice_param->cabac_init_idc = 0; -    slice_param->slice_qp_delta =
> 0; -    slice_param->disable_deblocking_filter_idc = 0; -
> slice_param->slice_alpha_c0_offset_div2 = 2; -
> slice_param->slice_beta_offset_div2 = 2; -
> slice_param->idr_pic_id = 0; - -    /* FIXME: fill other fields */
> 
> -    va_status = vaCreateBuffer(va_dpy, -
> avcenc_context.context_id, -
> VAEncSliceParameterBufferType, -
> sizeof(*slice_param), 1, slice_param, -
> &avcenc_context.slice_param_buf_id[i]); -
> CHECK_VASTATUS(va_status,"vaCreateBuffer");; -    i++; -#endif - -
> avcenc_context.num_slices = i; +        startAddressInMB +=
> actualSliceHeightInMB*picture_width_in_mbs; +    } +
> avcenc_context.num_slices = sliceNum; }
> 
> static int begin_picture(FILE *yuv_fp, int frame_num, int
> display_num, int slice_type, int is_idr)
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQNP08AAoJEFbADDnFRzIGsJcIAK8fnmEn1l9JCS2Qdw7zK9oz
593YnTL7dXAtFldTcXwWXwmmkQEIYlr3CHHP2uVdSSlRdFL/m0SU42K2ADj66AH/
favJBBo9zir0+bS+WI/59JoNOHM5s0OHjRG+mV8YRNPE36JFcLg9bnLW7ezz4hLD
6mlAISgJ5zh8TPIIlvpEcEv2OP7tFFHlUJXvC/i40fyQr99P1EgcloKHPCj583r2
3DuyhQqA8kWBq45bt5Xv/sUmbPxDvrlqZ7EkjddUoXHQbeYbgeBA6OYH+HBCKHGg
xQMILbXdaAbXy0p8br+Z9CegyLwBLA9AAWdJiSVCDO7IA2fGEwR/ZzHpDcuDlO0=
=scn+
-----END PGP SIGNATURE-----


More information about the Libva mailing list