diff options
author | Christian König <[email protected]> | 2011-04-20 13:44:26 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2011-04-20 13:44:26 +0200 |
commit | b7acf83d523563cde613fe805bd8edaa02f64b53 (patch) | |
tree | adb2a0d5a668fab33b62ee478b767f10673d6fa3 /src/gallium/auxiliary/vl | |
parent | 3511780a43077d1359bd491eadb4ab9b3b86795a (diff) |
[g3dvl] make motion vector buffers a public interface
Diffstat (limited to 'src/gallium/auxiliary/vl')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mc.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 23 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_vertex_buffers.c | 43 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_vertex_buffers.h | 18 |
4 files changed, 43 insertions, 43 deletions
diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c index 9785327cdbe..137a1beaa0d 100644 --- a/src/gallium/auxiliary/vl/vl_mc.c +++ b/src/gallium/auxiliary/vl/vl_mc.c @@ -136,7 +136,7 @@ create_ref_vert_shader(struct vl_mc *r) 0.5f / r->buffer_width, 0.5f / r->buffer_height, 1.0f / 4.0f, - 1.0f / 255.0f); + 1.0f / PIPE_VIDEO_MV_WEIGHT_MAX); for (i = 0; i < 2; ++i) { ureg_MAD(shader, ureg_writemask(o_vmv[i], TGSI_WRITEMASK_XY), mv_scale, vmv[i], ureg_src(t_vpos)); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 182294894c1..f262c13e0fc 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -231,6 +231,26 @@ vl_mpeg12_buffer_map(struct pipe_video_decode_buffer *buffer) map_buffers(dec, buf); } +static unsigned +vl_mpeg12_buffer_get_mv_stream_stride(struct pipe_video_decode_buffer *buffer) +{ + struct vl_mpeg12_buffer *buf = (struct vl_mpeg12_buffer*)buffer; + + assert(buf); + + return vl_vb_get_mv_stream_stride(&buf->vertex_stream); +} + +static struct pipe_motionvector * +vl_mpeg12_buffer_get_mv_stream(struct pipe_video_decode_buffer *buffer, int ref_frame) +{ + struct vl_mpeg12_buffer *buf = (struct vl_mpeg12_buffer*)buffer; + + assert(buf); + + return vl_vb_get_mv_stream(&buf->vertex_stream, ref_frame); +} + static void vl_mpeg12_buffer_add_macroblocks(struct pipe_video_decode_buffer *buffer, unsigned num_macroblocks, @@ -251,7 +271,6 @@ vl_mpeg12_buffer_add_macroblocks(struct pipe_video_decode_buffer *buffer, assert(macroblocks->codec == PIPE_VIDEO_CODEC_MPEG12); for ( i = 0; i < num_macroblocks; ++i ) { - vl_vb_add_block(&buf->vertex_stream, &mb[i]); upload_buffer(dec, buf, &mb[i]); } } @@ -389,6 +408,8 @@ vl_mpeg12_create_buffer(struct pipe_video_decoder *decoder) buffer->base.decoder = decoder; buffer->base.destroy = vl_mpeg12_buffer_destroy; buffer->base.map = vl_mpeg12_buffer_map; + buffer->base.get_mv_stream_stride = vl_mpeg12_buffer_get_mv_stream_stride; + buffer->base.get_mv_stream = vl_mpeg12_buffer_get_mv_stream; buffer->base.add_macroblocks = vl_mpeg12_buffer_add_macroblocks; buffer->base.unmap = vl_mpeg12_buffer_unmap; diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c index 212ace7512a..e61425843ff 100644 --- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c +++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c @@ -38,11 +38,6 @@ struct vl_ycbcr_vertex_stream uint8_t field; }; -struct vl_mv_vertex_stream -{ - struct vertex4s mv[2]; -}; - /* vertices for a quad covering a block */ static const struct vertex2f block_quad[4] = { {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f} @@ -242,7 +237,7 @@ vl_vb_init(struct vl_vertex_buffer *buffer, struct pipe_context *pipe, pipe->screen, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM, - sizeof(struct vl_mv_vertex_stream) * size + sizeof(struct pipe_motionvector) * size ); } @@ -270,7 +265,7 @@ vl_vb_get_mv(struct vl_vertex_buffer *buffer, int motionvector) assert(buffer); - buf.stride = sizeof(struct vl_mv_vertex_stream); + buf.stride = sizeof(struct pipe_motionvector); buf.buffer_offset = 0; buf.buffer = buffer->mv[motionvector].resource; @@ -324,39 +319,21 @@ void vl_vb_add_ycbcr(struct vl_vertex_buffer *buffer, buffer->ycbcr[component].num_instances++; } -static void -get_motion_vectors(enum pipe_mpeg12_motion_type mo_type, struct pipe_motionvector *src, struct vertex4s dst[2]) +unsigned +vl_vb_get_mv_stream_stride(struct vl_vertex_buffer *buffer) { - if (mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) { - dst[0].x = dst[1].x = src->top.x; - dst[0].y = dst[1].y = src->top.y; - dst[0].z = dst[1].z = 0; - - } else { - dst[0].x = src->top.x; - dst[0].y = src->top.y; - dst[0].z = src->top.field_select ? 3 : 1; - - dst[1].x = src->bottom.x; - dst[1].y = src->bottom.y; - dst[1].z = src->bottom.field_select ? 3 : 1; - } + assert(buffer); - dst[0].w = src->top.wheight; - dst[1].w = src->bottom.wheight; + return buffer->width; } -void -vl_vb_add_block(struct vl_vertex_buffer *buffer, struct pipe_mpeg12_macroblock *mb) +struct pipe_motionvector * +vl_vb_get_mv_stream(struct vl_vertex_buffer *buffer, int ref_frame) { - unsigned mv_pos; - assert(buffer); - assert(mb); + assert(ref_frame < VL_MAX_REF_FRAMES); - mv_pos = mb->mbx + mb->mby * buffer->width; - get_motion_vectors(mb->mo_type, &mb->mv[0], buffer->mv[0].vertex_stream[mv_pos].mv); - get_motion_vectors(mb->mo_type, &mb->mv[1], buffer->mv[1].vertex_stream[mv_pos].mv); + return buffer->mv[ref_frame].vertex_stream; } void diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.h b/src/gallium/auxiliary/vl/vl_vertex_buffers.h index 5632eb297bd..6a83111b4a8 100644 --- a/src/gallium/auxiliary/vl/vl_vertex_buffers.h +++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.h @@ -62,9 +62,9 @@ struct vl_vertex_buffer } ycbcr[VL_MAX_PLANES]; struct { - struct pipe_resource *resource; - struct pipe_transfer *transfer; - struct vl_mv_vertex_stream *vertex_stream; + struct pipe_resource *resource; + struct pipe_transfer *transfer; + struct pipe_motionvector *vertex_stream; } mv[VL_MAX_REF_FRAMES]; }; @@ -80,17 +80,19 @@ void vl_vb_init(struct vl_vertex_buffer *buffer, struct pipe_context *pipe, unsigned width, unsigned height); -struct pipe_vertex_buffer vl_vb_get_ycbcr(struct vl_vertex_buffer *buffer, int component); - -struct pipe_vertex_buffer vl_vb_get_mv(struct vl_vertex_buffer *buffer, int motionvector); - void vl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe); +struct pipe_vertex_buffer vl_vb_get_ycbcr(struct vl_vertex_buffer *buffer, int component); + void vl_vb_add_ycbcr(struct vl_vertex_buffer *buffer, unsigned component, unsigned x, unsigned y, bool intra, enum pipe_mpeg12_dct_type type); -void vl_vb_add_block(struct vl_vertex_buffer *buffer, struct pipe_mpeg12_macroblock *mb); +struct pipe_vertex_buffer vl_vb_get_mv(struct vl_vertex_buffer *buffer, int ref_frame); + +unsigned vl_vb_get_mv_stream_stride(struct vl_vertex_buffer *buffer); + +struct pipe_motionvector *vl_vb_get_mv_stream(struct vl_vertex_buffer *buffer, int ref_frame); void vl_vb_unmap(struct vl_vertex_buffer *buffer, struct pipe_context *pipe); |