[Libva] [Libva-intel-driver][PATCH v2] Remove unused fields in struct encode_state
Sean V Kelley
seanvk at posteo.de
Fri Aug 19 22:53:19 UTC 2016
On Tue, 2016-08-16 at 12:33 +0800, Xiang, Haihao wrote:
> It also fixes a wrong assert() in gen8_mfc.c
>
> v2: Correct condition code when removing used fields
>
> Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
lgtm, tested, applied.
Thanks,
Sean
> ---
> src/gen8_mfc.c | 2 +-
> src/i965_drv_video.c | 29 +++--------------------------
> src/i965_drv_video.h | 6 ------
> 3 files changed, 4 insertions(+), 33 deletions(-)
>
> diff --git a/src/gen8_mfc.c b/src/gen8_mfc.c
> index 2bedcad..fc11e63 100644
> --- a/src/gen8_mfc.c
> +++ b/src/gen8_mfc.c
> @@ -3221,7 +3221,7 @@
> gen8_mfc_jpeg_pipeline_picture_programing(VADriverContextP ctx,
>
> //I dont think I need this for loop. Just to be consistent with
> other encoding logic...
> for(i = 0; i < encode_state->num_slice_params_ext; i++) {
> - assert(encode_state->slice_params && encode_state-
> >slice_params_ext[i]->buffer);
> + assert(encode_state->slice_params_ext && encode_state-
> >slice_params_ext[i]->buffer);
> slice_param = (VAEncSliceParameterBufferJPEG *)encode_state-
> >slice_params_ext[i]->buffer;
>
> for(j = 0; j < encode_state->slice_params_ext[i]-
> >num_elements; j++) {
> diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
> index 1c24d00..f84709e 100644
> --- a/src/i965_drv_video.c
> +++ b/src/i965_drv_video.c
> @@ -2067,18 +2067,9 @@ i965_destroy_context(struct object_heap *heap,
> struct object_base *obj)
> i965_release_buffer_store(&obj_context-
> >codec_state.proc.pipeline_param);
>
> } else if (obj_context->codec_type == CODEC_ENC) {
> - assert(obj_context->codec_state.encode.num_slice_params <=
> obj_context->codec_state.encode.max_slice_params);
> - i965_release_buffer_store(&obj_context-
> >codec_state.encode.pic_param);
> - i965_release_buffer_store(&obj_context-
> >codec_state.encode.seq_param);
> -
> i965_release_buffer_store(&obj_context-
> >codec_state.encode.q_matrix);
> i965_release_buffer_store(&obj_context-
> >codec_state.encode.huffman_table);
>
> - for (i = 0; i < obj_context-
> >codec_state.encode.num_slice_params; i++)
> - i965_release_buffer_store(&obj_context-
> >codec_state.encode.slice_params[i]);
> -
> - free(obj_context->codec_state.encode.slice_params);
> -
> assert(obj_context->codec_state.encode.num_slice_params_ext
> <= obj_context->codec_state.encode.max_slice_params_ext);
> i965_release_buffer_store(&obj_context-
> >codec_state.encode.pic_param_ext);
> i965_release_buffer_store(&obj_context-
> >codec_state.encode.seq_param_ext);
> @@ -2236,9 +2227,6 @@ i965_CreateContext(VADriverContextP ctx,
> obj_context->codec_type = CODEC_ENC;
> memset(&obj_context->codec_state.encode, 0,
> sizeof(obj_context->codec_state.encode));
> obj_context->codec_state.encode.current_render_target =
> VA_INVALID_ID;
> - obj_context->codec_state.encode.max_slice_params =
> NUM_SLICES;
> - obj_context->codec_state.encode.slice_params =
> calloc(obj_context->codec_state.encode.max_slice_params,
> - sizeo
> f(*obj_context->codec_state.encode.slice_params));
> obj_context-
> >codec_state.encode.max_packed_header_params_ext = NUM_SLICES;
> obj_context->codec_state.encode.packed_header_params_ext
> =
> calloc(obj_context-
> >codec_state.encode.max_packed_header_params_ext,
> @@ -2829,14 +2817,6 @@ i965_BeginPicture(VADriverContextP ctx,
> if (obj_context->codec_type == CODEC_PROC) {
> obj_context->codec_state.proc.current_render_target =
> render_target;
> } else if (obj_context->codec_type == CODEC_ENC) {
> - i965_release_buffer_store(&obj_context-
> >codec_state.encode.pic_param);
> -
> - for (i = 0; i < obj_context-
> >codec_state.encode.num_slice_params; i++) {
> - i965_release_buffer_store(&obj_context-
> >codec_state.encode.slice_params[i]);
> - }
> -
> - obj_context->codec_state.encode.num_slice_params = 0;
> -
> /* ext */
> i965_release_buffer_store(&obj_context-
> >codec_state.encode.pic_param_ext);
>
> @@ -3534,19 +3514,16 @@ i965_EndPicture(VADriverContextP ctx,
> VAContextID context)
> WARN_ONCE("the packed header/data is not paired for
> encoding!\n");
> return VA_STATUS_ERROR_INVALID_PARAMETER;
> }
> - if (!(obj_context->codec_state.encode.pic_param ||
> - obj_context->codec_state.encode.pic_param_ext)) {
> + if (!obj_context->codec_state.encode.pic_param_ext) {
> return VA_STATUS_ERROR_INVALID_PARAMETER;
> }
> - if (!(obj_context->codec_state.encode.seq_param ||
> - obj_context->codec_state.encode.seq_param_ext) &&
> + if (!obj_context->codec_state.encode.seq_param_ext &&
> (VAEntrypointEncPicture != obj_config->entrypoint))
> {
> /* The seq_param is not mandatory for VP9 encoding */
> if (obj_config->profile != VAProfileVP9Profile0)
> return VA_STATUS_ERROR_INVALID_PARAMETER;
> }
> - if ((obj_context->codec_state.encode.num_slice_params <=0)
> &&
> - (obj_context-
> >codec_state.encode.num_slice_params_ext <=0) &&
> + if ((obj_context->codec_state.encode.num_slice_params_ext
> <=0) &&
> ((obj_config->profile != VAProfileVP8Version0_3) &&
> (obj_config->profile != VAProfileVP9Profile0))) {
> return VA_STATUS_ERROR_INVALID_PARAMETER;
> diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h
> index f67599e..9fe042f 100644
> --- a/src/i965_drv_video.h
> +++ b/src/i965_drv_video.h
> @@ -145,15 +145,9 @@ struct decode_state
> struct encode_state
> {
> struct codec_state_base base;
> - struct buffer_store *seq_param;
> - struct buffer_store *pic_param;
> - struct buffer_store *pic_control;
> struct buffer_store *iq_matrix;
> struct buffer_store *q_matrix;
> - struct buffer_store **slice_params;
> struct buffer_store *huffman_table;
> - int max_slice_params;
> - int num_slice_params;
>
> /* for ext */
> struct buffer_store *seq_param_ext;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/libva/attachments/20160819/542ea609/attachment-0001.sig>
More information about the Libva
mailing list