[Libva] [PATCH 3/4] decoder: h264: use frame store context to maintain ref frames.
Zhao, Yakui
yakui.zhao at intel.com
Mon Jun 2 20:12:22 PDT 2014
On Mon, 2014-06-02 at 11:58 -0600, Gwenole Beauchesne wrote:
> This is a convenience to use the GenFrameStoreContext structure,
> when the whole frame store machinery is maintain. No functional
> change.
>
> Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
> ---
> src/gen6_mfd.c | 4 ++--
> src/gen75_mfd.c | 3 ++-
> src/gen7_mfd.c | 3 ++-
> src/gen8_mfd.c | 4 ++--
> src/i965_avc_bsd.c | 4 ++--
> src/i965_decoder_utils.c | 17 +++++++++--------
> src/i965_decoder_utils.h | 10 ++++++----
> 7 files changed, 25 insertions(+), 20 deletions(-)
>
> diff --git a/src/gen6_mfd.c b/src/gen6_mfd.c
> index 1c3b9e3..0cc82e6 100755
> --- a/src/gen6_mfd.c
> +++ b/src/gen6_mfd.c
> @@ -820,8 +820,8 @@ gen6_mfd_avc_decode_init(VADriverContextP ctx,
>
> assert(decode_state->pic_param && decode_state->pic_param->buffer);
> pic_param = (VAPictureParameterBufferH264 *)decode_state->pic_param->buffer;
> - intel_update_avc_frame_store_index(ctx, decode_state, pic_param,
> - gen6_mfd_context->fsc.used_frames);
> + intel_update_avc_frame_store_index(ctx, &gen6_mfd_context->fsc,
> + decode_state, pic_param);
> width_in_mbs = ((pic_param->picture_width_in_mbs_minus1 + 1) & 0xff);
>
> /* Current decoded picture */
> diff --git a/src/gen75_mfd.c b/src/gen75_mfd.c
> index 018740e..673ca14 100644
> --- a/src/gen75_mfd.c
> +++ b/src/gen75_mfd.c
> @@ -1045,7 +1045,8 @@ gen75_mfd_avc_decode_init(VADriverContextP ctx,
>
> assert(decode_state->pic_param && decode_state->pic_param->buffer);
> pic_param = (VAPictureParameterBufferH264 *)decode_state->pic_param->buffer;
> - intel_update_avc_frame_store_index(ctx, decode_state, pic_param, gen7_mfd_context->fsc.used_frames);
> + intel_update_avc_frame_store_index(ctx, &gen7_mfd_context->fsc,
> + decode_state, pic_param);
> width_in_mbs = pic_param->picture_width_in_mbs_minus1 + 1;
> height_in_mbs = pic_param->picture_height_in_mbs_minus1 + 1;
> assert(width_in_mbs > 0 && width_in_mbs <= 256); /* 4K */
> diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c
> index 07cdd46..69253c1 100755
> --- a/src/gen7_mfd.c
> +++ b/src/gen7_mfd.c
> @@ -735,7 +735,8 @@ gen7_mfd_avc_decode_init(VADriverContextP ctx,
>
> assert(decode_state->pic_param && decode_state->pic_param->buffer);
> pic_param = (VAPictureParameterBufferH264 *)decode_state->pic_param->buffer;
> - intel_update_avc_frame_store_index(ctx, decode_state, pic_param, gen7_mfd_context->fsc.used_frames);
> + intel_update_avc_frame_store_index(ctx, &gen7_mfd_context->fsc,
> + decode_state, pic_param);
> width_in_mbs = pic_param->picture_width_in_mbs_minus1 + 1;
> height_in_mbs = pic_param->picture_height_in_mbs_minus1 + 1;
> assert(width_in_mbs > 0 && width_in_mbs <= 256); /* 4K */
> diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c
> index 10c109c..13514df 100644
> --- a/src/gen8_mfd.c
> +++ b/src/gen8_mfd.c
> @@ -822,8 +822,8 @@ gen8_mfd_avc_decode_init(VADriverContextP ctx,
>
> assert(decode_state->pic_param && decode_state->pic_param->buffer);
> pic_param = (VAPictureParameterBufferH264 *)decode_state->pic_param->buffer;
> - intel_update_avc_frame_store_index(ctx, decode_state, pic_param,
> - gen7_mfd_context->fsc.used_frames);
> + intel_update_avc_frame_store_index(ctx, &gen7_mfd_context->fsc,
> + decode_state, pic_param);
> width_in_mbs = pic_param->picture_width_in_mbs_minus1 + 1;
> height_in_mbs = pic_param->picture_height_in_mbs_minus1 + 1;
> assert(width_in_mbs > 0 && width_in_mbs <= 256); /* 4K */
> diff --git a/src/i965_avc_bsd.c b/src/i965_avc_bsd.c
> index ce03439..43b8e68 100644
> --- a/src/i965_avc_bsd.c
> +++ b/src/i965_avc_bsd.c
> @@ -796,8 +796,8 @@ i965_avc_bsd_pipeline(VADriverContextP ctx, struct decode_state *decode_state, v
>
> assert(decode_state->pic_param && decode_state->pic_param->buffer);
> pic_param = (VAPictureParameterBufferH264 *)decode_state->pic_param->buffer;
> - intel_update_avc_frame_store_index(ctx, decode_state, pic_param,
> - i965_h264_context->fs_context.used_frames);
> + intel_update_avc_frame_store_index(ctx, &i965_h264_context->fs_context,
> + decode_state, pic_param);
>
> i965_h264_context->enable_avc_ildb = 0;
> i965_h264_context->picture.i_flag = 1;
> diff --git a/src/i965_decoder_utils.c b/src/i965_decoder_utils.c
> index fff20c6..8f23bfb 100644
> --- a/src/i965_decoder_utils.c
> +++ b/src/i965_decoder_utils.c
> @@ -452,10 +452,10 @@ gen_frame_store_context_init(GenFrameStoreContext *fsc)
>
> void
> intel_update_avc_frame_store_index(
> - VADriverContextP ctx,
> - struct decode_state *decode_state,
> - VAPictureParameterBufferH264 *pic_param,
> - GenFrameStore frame_store[MAX_GEN_REFERENCE_FRAMES]
> + VADriverContextP ctx,
> + GenFrameStoreContext *fs_ctx,
> + struct decode_state *decode_state,
> + VAPictureParameterBufferH264 *pic_param
> )
> {
> int free_slots[MAX_GEN_REFERENCE_FRAMES];
Neither this patch or the previous patch defines the structure of
free_slot.
> @@ -464,7 +464,7 @@ intel_update_avc_frame_store_index(
>
> /* Remove obsolete entries from the internal DPB */
> for (i = 0, n = 0; i < MAX_GEN_REFERENCE_FRAMES; i++) {
> - GenFrameStore * const fs = &frame_store[i];
> + GenFrameStore * const fs = &fs_ctx->used_frames[i];
> if (fs->surface_id == VA_INVALID_ID || !fs->obj_surface) {
> free_slots[n++] = i;
> continue;
> @@ -501,17 +501,18 @@ intel_update_avc_frame_store_index(
> // Find whether the current frame is not already in our frame store
> found = false;
> for (j = 0; j < MAX_GEN_REFERENCE_FRAMES; j++) {
> - if ((found = frame_store[j].obj_surface == obj_surface))
> + if ((found = fs_ctx->used_frames[j].obj_surface == obj_surface))
> break;
> }
>
> // ... or add it
> if (!found) {
> if (n < num_free_slots) {
> - GenFrameStore * const fs = &frame_store[free_slots[n++]];
> + GenFrameStore * const fs =
> + &fs_ctx->used_frames[free_slots[n++]];
> fs->surface_id = obj_surface->base.id;
> fs->obj_surface = obj_surface;
> - fs->frame_store_id = fs - frame_store;
> + fs->frame_store_id = fs - fs_ctx->used_frames;
> }
> else {
> WARN_ONCE("No free slot found for DPB reference list!!!\n");
> diff --git a/src/i965_decoder_utils.h b/src/i965_decoder_utils.h
> index a4c9415..77e9d2e 100644
> --- a/src/i965_decoder_utils.h
> +++ b/src/i965_decoder_utils.h
> @@ -92,10 +92,12 @@ intel_decoder_sanity_check_input(VADriverContextP ctx,
> struct decode_state *decode_state);
>
> void
> -intel_update_avc_frame_store_index(VADriverContextP ctx,
> - struct decode_state *decode_state,
> - VAPictureParameterBufferH264 *pic_param,
> - GenFrameStore frame_store[MAX_GEN_REFERENCE_FRAMES]);
> +intel_update_avc_frame_store_index(
> + VADriverContextP ctx,
> + GenFrameStoreContext *fs_ctx,
> + struct decode_state *decode_state,
> + VAPictureParameterBufferH264 *pic_param
> +);
>
> void
> intel_update_vc1_frame_store_index(VADriverContextP ctx,
More information about the Libva
mailing list