diff options
author | Christian König <[email protected]> | 2011-01-10 23:41:08 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2011-01-10 23:41:08 +0100 |
commit | 9032d2a13ecd019206a48767d9205c0aafa7cca2 (patch) | |
tree | 5bd816287ab7ace941a455e02b1da7bd94571cf9 /src/gallium/auxiliary/vl | |
parent | b725bbebae19890ceaaa31c1d7fb7f155ac3b6ef (diff) | |
parent | 2b296ec77c2b95e7632b45100de5a0878ac2a294 (diff) |
Merge remote branch 'vdpau/pipe-video' into pipe-video
Conflicts:
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
src/gallium/drivers/softpipe/sp_video_context.c
src/gallium/include/pipe/p_format.h
src/gallium/state_trackers/xorg/xvmc/context.c
src/gallium/tests/unit/SConscript
Diffstat (limited to 'src/gallium/auxiliary/vl')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_bitstream_parser.c | 47 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_bitstream_parser.h | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.c | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 2 |
4 files changed, 53 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/vl/vl_bitstream_parser.c b/src/gallium/auxiliary/vl/vl_bitstream_parser.c index 3193ea5f41c..f07b3443b92 100644 --- a/src/gallium/auxiliary/vl/vl_bitstream_parser.c +++ b/src/gallium/auxiliary/vl/vl_bitstream_parser.c @@ -29,17 +29,58 @@ #include <assert.h> #include <limits.h> #include <util/u_memory.h> +#include <stdio.h> + +inline void endian_swap_ushort(unsigned short *x) +{ + x[0] = (x[0]>>8) | + (x[0]<<8); +} + +inline void endian_swap_uint(unsigned int *x) +{ + x[0] = (x[0]>>24) | + ((x[0]<<8) & 0x00FF0000) | + ((x[0]>>8) & 0x0000FF00) | + (x[0]<<24); +} + +inline void endian_swap_ulonglong(unsigned long long *x) +{ + x[0] = (x[0]>>56) | + ((x[0]<<40) & 0x00FF000000000000) | + ((x[0]<<24) & 0x0000FF0000000000) | + ((x[0]<<8) & 0x000000FF00000000) | + ((x[0]>>8) & 0x00000000FF000000) | + ((x[0]>>24) & 0x0000000000FF0000) | + ((x[0]>>40) & 0x000000000000FF00) | + (x[0]<<56); +} static unsigned grab_bits(unsigned cursor, unsigned how_many_bits, unsigned bitstream_elt) { - unsigned excess_bits = sizeof(unsigned) * CHAR_BIT - how_many_bits - cursor; + unsigned excess_bits = sizeof(unsigned) * CHAR_BIT - how_many_bits; assert(cursor < sizeof(unsigned) * CHAR_BIT); assert(how_many_bits > 0 && how_many_bits <= sizeof(unsigned) * CHAR_BIT); assert(cursor + how_many_bits <= sizeof(unsigned) * CHAR_BIT); - - return (bitstream_elt << excess_bits) >> (excess_bits + cursor); + + #ifndef PIPE_ARCH_BIG_ENDIAN + switch (sizeof(unsigned)) { + case 2: + endian_swap_ushort(&bitstream_elt); + break; + case 4: + endian_swap_uint(&bitstream_elt); + break; + case 8: + endian_swap_ulonglong(&bitstream_elt); + break; + } + #endif // !PIPE_ARCH_BIG_ENDIAN + + return (bitstream_elt << cursor) >> (excess_bits); } static unsigned diff --git a/src/gallium/auxiliary/vl/vl_bitstream_parser.h b/src/gallium/auxiliary/vl/vl_bitstream_parser.h index 30ec743fa75..eeb51dd4295 100644 --- a/src/gallium/auxiliary/vl/vl_bitstream_parser.h +++ b/src/gallium/auxiliary/vl/vl_bitstream_parser.h @@ -39,6 +39,10 @@ struct vl_bitstream_parser unsigned cursor; }; +inline void endian_swap_ushort(unsigned short *x); +inline void endian_swap_uint(unsigned int *x); +inline void endian_swap_ulonglong(unsigned long long *x); + bool vl_bitstream_parser_init(struct vl_bitstream_parser *parser, unsigned num_bitstreams, const void **bitstreams, diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 5187c635e4b..d7b29497ace 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -32,6 +32,7 @@ #include <util/u_inlines.h> #include <util/u_memory.h> #include <util/u_keymap.h> +#include <util/u_draw.h> #include <util/u_sampler.h> #include <tgsi/tgsi_ureg.h> #include "vl_csc.h" @@ -557,6 +558,7 @@ static void draw_layers(struct vl_compositor *c, c->pipe->bind_fs_state(c->pipe, frag_shaders[i]); c->pipe->set_fragment_sampler_views(c->pipe, 1, &surface_view); + util_draw_arrays(c->pipe, PIPE_PRIM_TRIANGLES, i * 6, 6); if (delete_view) { @@ -629,8 +631,8 @@ void vl_compositor_set_csc_matrix(struct vl_compositor *compositor, const float pipe_buffer_map(compositor->pipe, compositor->fs_const_buf, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD, &buf_transfer), - mat, - sizeof(struct fragment_shader_consts) + mat, + sizeof(struct fragment_shader_consts) ); pipe_buffer_unmap(compositor->pipe, buf_transfer); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 3b94e104b44..de83b6a5338 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -35,6 +35,7 @@ #include <util/u_memory.h> #include <util/u_keymap.h> #include <util/u_sampler.h> +#include <util/u_draw.h> #include <tgsi/tgsi_ureg.h> #define DEFAULT_BUF_ALIGNMENT 1 @@ -636,7 +637,6 @@ get_motion_vectors(struct pipe_mpeg12_macroblock *mb, struct vertex2s mv[4]) case PIPE_MPEG12_MACROBLOCK_TYPE_BI: { if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) { - mv[2].x = mb->pmv[0][1][0]; mv[2].y = mb->pmv[0][1][1]; |