[Mesa-dev] [PATCH 1/3] st/omx: move YUV deinterlace function to common
Leo Liu
leo.liu at amd.com
Fri Aug 25 15:09:15 UTC 2017
On 08/24/2017 02:48 PM, Leo Liu wrote:
>
>
> On 08/24/2017 11:34 AM, Christian König wrote:
>> Am 24.08.2017 um 17:11 schrieb Leo Liu:
>>> Signed-off-by: Leo Liu <leo.liu at amd.com>
>>
>> Reviewed-by: Christian König <christian.koenig at amd.com> for the series.
>>
>> Andy do you want to test this? Should make VA-API transcoding simpler
>> to use.
>
> Just got chance to test the transcoding(encoding previously). There is
> an issue with current patch 2, which is encode/decoder have buffer
> deinterlaced/interlaced.
> v3, will address that, and performance keep same as before.
Forget the V4, it's not the right logic, the V3 handling is correct. If
it's the other way around , and then should ignore, not reallocated.
Regards,
Leo
>
> Regards,
> Leo
>
>
>
>
>>
>> Regards,
>> Christian.
>>
>>> ---
>>> src/gallium/auxiliary/vl/vl_compositor.c | 87
>>> +++++++++++++++++++++-----------
>>> src/gallium/auxiliary/vl/vl_compositor.h | 21 ++++----
>>> src/gallium/state_trackers/omx/vid_dec.c | 32 +-----------
>>> 3 files changed, 68 insertions(+), 72 deletions(-)
>>>
>>> diff --git a/src/gallium/auxiliary/vl/vl_compositor.c
>>> b/src/gallium/auxiliary/vl/vl_compositor.c
>>> index a79bf11264..794c8b5b17 100644
>>> --- a/src/gallium/auxiliary/vl/vl_compositor.c
>>> +++ b/src/gallium/auxiliary/vl/vl_compositor.c
>>> @@ -885,6 +885,32 @@ draw_layers(struct vl_compositor *c, struct
>>> vl_compositor_state *s, struct u_rec
>>> }
>>> }
>>> +static void
>>> +set_yuv_layer(struct vl_compositor_state *s, struct vl_compositor
>>> *c, unsigned layer,
>>> + struct pipe_video_buffer *buffer, struct u_rect
>>> *src_rect,
>>> + struct u_rect *dst_rect, bool y)
>>> +{
>>> + struct pipe_sampler_view **sampler_views;
>>> + unsigned i;
>>> +
>>> + assert(s && c && buffer);
>>> +
>>> + assert(layer < VL_COMPOSITOR_MAX_LAYERS);
>>> +
>>> + s->used_layers |= 1 << layer;
>>> + sampler_views = buffer->get_sampler_view_components(buffer);
>>> + for (i = 0; i < 3; ++i) {
>>> + s->layers[layer].samplers[i] = c->sampler_linear;
>>> + pipe_sampler_view_reference(&s->layers[layer].sampler_views[i],
>>> sampler_views[i]);
>>> + }
>>> +
>>> + calc_src_and_dst(&s->layers[layer], buffer->width, buffer->height,
>>> + src_rect ? *src_rect :
>>> default_rect(&s->layers[layer]),
>>> + dst_rect ? *dst_rect :
>>> default_rect(&s->layers[layer]));
>>> +
>>> + s->layers[layer].fs = (y) ? c->fs_weave_yuv.y : c->fs_weave_yuv.uv;
>>> +}
>>> +
>>> void
>>> vl_compositor_reset_dirty_area(struct u_rect *dirty)
>>> {
>>> @@ -1143,36 +1169,6 @@ vl_compositor_set_layer_rotation(struct
>>> vl_compositor_state *s,
>>> }
>>> void
>>> -vl_compositor_set_yuv_layer(struct vl_compositor_state *s,
>>> - struct vl_compositor *c,
>>> - unsigned layer,
>>> - struct pipe_video_buffer *buffer,
>>> - struct u_rect *src_rect,
>>> - struct u_rect *dst_rect,
>>> - bool y)
>>> -{
>>> - struct pipe_sampler_view **sampler_views;
>>> - unsigned i;
>>> -
>>> - assert(s && c && buffer);
>>> -
>>> - assert(layer < VL_COMPOSITOR_MAX_LAYERS);
>>> -
>>> - s->used_layers |= 1 << layer;
>>> - sampler_views = buffer->get_sampler_view_components(buffer);
>>> - for (i = 0; i < 3; ++i) {
>>> - s->layers[layer].samplers[i] = c->sampler_linear;
>>> - pipe_sampler_view_reference(&s->layers[layer].sampler_views[i],
>>> sampler_views[i]);
>>> - }
>>> -
>>> - calc_src_and_dst(&s->layers[layer], buffer->width, buffer->height,
>>> - src_rect ? *src_rect :
>>> default_rect(&s->layers[layer]),
>>> - dst_rect ? *dst_rect :
>>> default_rect(&s->layers[layer]));
>>> -
>>> - s->layers[layer].fs = (y) ? c->fs_weave_yuv.y : c->fs_weave_yuv.uv;
>>> -}
>>> -
>>> -void
>>> vl_compositor_render(struct vl_compositor_state *s,
>>> struct vl_compositor *c,
>>> struct pipe_surface *dst_surface,
>>> @@ -1215,6 +1211,37 @@ vl_compositor_render(struct
>>> vl_compositor_state *s,
>>> draw_layers(c, s, dirty_area);
>>> }
>>> +void
>>> +vl_compositor_yuv_deint(struct vl_compositor_state *s,
>>> + struct vl_compositor *c,
>>> + struct pipe_video_buffer *src,
>>> + struct pipe_video_buffer *dst)
>>> +{
>>> + struct pipe_surface **dst_surfaces;
>>> + struct u_rect dst_rect;
>>> +
>>> + dst_surfaces = dst->get_surfaces(dst);
>>> + vl_compositor_clear_layers(s);
>>> +
>>> + dst_rect.x0 = 0;
>>> + dst_rect.x1 = src->width;
>>> + dst_rect.y0 = 0;
>>> + dst_rect.y1 = src->height;
>>> +
>>> + set_yuv_layer(s, c, 0, src, NULL, NULL, true);
>>> + vl_compositor_set_layer_dst_area(s, 0, &dst_rect);
>>> + vl_compositor_render(s, c, dst_surfaces[0], NULL, false);
>>> +
>>> + dst_rect.x1 /= 2;
>>> + dst_rect.y1 /= 2;
>>> +
>>> + set_yuv_layer(s, c, 0, src, NULL, NULL, false);
>>> + vl_compositor_set_layer_dst_area(s, 0, &dst_rect);
>>> + vl_compositor_render(s, c, dst_surfaces[1], NULL, false);
>>> +
>>> + s->pipe->flush(s->pipe, NULL, 0);
>>> +}
>>> +
>>> bool
>>> vl_compositor_init(struct vl_compositor *c, struct pipe_context
>>> *pipe)
>>> {
>>> diff --git a/src/gallium/auxiliary/vl/vl_compositor.h
>>> b/src/gallium/auxiliary/vl/vl_compositor.h
>>> index 535abb75cd..2546d75b23 100644
>>> --- a/src/gallium/auxiliary/vl/vl_compositor.h
>>> +++ b/src/gallium/auxiliary/vl/vl_compositor.h
>>> @@ -240,18 +240,6 @@ vl_compositor_set_layer_rotation(struct
>>> vl_compositor_state *state,
>>> unsigned layer,
>>> enum vl_compositor_rotation rotate);
>>> -/**
>>> - * set a layer of y or uv to render
>>> - */
>>> -void
>>> -vl_compositor_set_yuv_layer(struct vl_compositor_state *s,
>>> - struct vl_compositor *c,
>>> - unsigned layer,
>>> - struct pipe_video_buffer *buffer,
>>> - struct u_rect *src_rect,
>>> - struct u_rect *dst_rect,
>>> - bool y);
>>> -
>>> /*@}*/
>>> /**
>>> @@ -265,6 +253,15 @@ vl_compositor_render(struct vl_compositor_state
>>> *state,
>>> bool clear_dirty);
>>> /**
>>> + * deinterlace yuv buffer
>>> + */
>>> +void
>>> +vl_compositor_yuv_deint(struct vl_compositor_state *state,
>>> + struct vl_compositor *compositor,
>>> + struct pipe_video_buffer *src,
>>> + struct pipe_video_buffer *dst);
>>> +
>>> +/**
>>> * destroy this compositor
>>> */
>>> void
>>> diff --git a/src/gallium/state_trackers/omx/vid_dec.c
>>> b/src/gallium/state_trackers/omx/vid_dec.c
>>> index 313bc0aa8b..28741c09a4 100644
>>> --- a/src/gallium/state_trackers/omx/vid_dec.c
>>> +++ b/src/gallium/state_trackers/omx/vid_dec.c
>>> @@ -579,34 +579,6 @@ static void
>>> vid_dec_FillOutput(vid_dec_PrivateType *priv, struct pipe_video_buff
>>> }
>>> }
>>> -static void vid_dec_deint(vid_dec_PrivateType *priv, struct
>>> pipe_video_buffer *src_buf,
>>> - struct pipe_video_buffer *dst_buf)
>>> -{
>>> - struct vl_compositor *compositor = &priv->compositor;
>>> - struct vl_compositor_state *s = &priv->cstate;
>>> - struct pipe_surface **dst_surface;
>>> - struct u_rect dst_rect;
>>> -
>>> - dst_surface = dst_buf->get_surfaces(dst_buf);
>>> - vl_compositor_clear_layers(s);
>>> -
>>> - dst_rect.x0 = 0;
>>> - dst_rect.x1 = src_buf->width;
>>> - dst_rect.y0 = 0;
>>> - dst_rect.y1 = src_buf->height;
>>> -
>>> - vl_compositor_set_yuv_layer(s, compositor, 0, src_buf, NULL,
>>> NULL, true);
>>> - vl_compositor_set_layer_dst_area(s, 0, &dst_rect);
>>> - vl_compositor_render(s, compositor, dst_surface[0], NULL, false);
>>> -
>>> - dst_rect.x1 /= 2;
>>> - dst_rect.y1 /= 2;
>>> -
>>> - vl_compositor_set_yuv_layer(s, compositor, 0, src_buf, NULL,
>>> NULL, false);
>>> - vl_compositor_set_layer_dst_area(s, 0, &dst_rect);
>>> - vl_compositor_render(s, compositor, dst_surface[1], NULL, false);
>>> -}
>>> -
>>> static void vid_dec_FrameDecoded(OMX_COMPONENTTYPE *comp,
>>> OMX_BUFFERHEADERTYPE* input,
>>> OMX_BUFFERHEADERTYPE* output)
>>> {
>>> @@ -642,8 +614,8 @@ static void
>>> vid_dec_FrameDecoded(OMX_COMPONENTTYPE *comp, OMX_BUFFERHEADERTYPE*
>>> new_vbuf = priv->pipe->create_video_buffer(priv->pipe,
>>> &templat);
>>> /* convert the interlaced to the progressive */
>>> - vid_dec_deint(priv, input->pInputPortPrivate, new_vbuf);
>>> - priv->pipe->flush(priv->pipe, NULL, 0);
>>> + vl_compositor_yuv_deint(&priv->cstate, &priv->compositor,
>>> + input->pInputPortPrivate, new_vbuf);
>>> /* set the progrssive buffer for next round */
>>> vbuf->destroy(vbuf);
>>
>>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list