diff options
author | Thomas Balling Sørensen <tball@tball-laptop.(none)> | 2010-10-08 13:59:31 +0200 |
---|---|---|
committer | Thomas Balling Sørensen <tball@tball-laptop.(none)> | 2010-10-08 13:59:31 +0200 |
commit | 7d2bdc2d4db8321a72edcc921a0fcfa4e4d41ef9 (patch) | |
tree | dcc405ace707c0793d87e411db12030933bece59 /src/gallium/state_trackers/vdpau | |
parent | bff1ac875c2c62ba5045bb953f800253c49361cb (diff) |
vl: bitstream decoder finds startcodes
Diffstat (limited to 'src/gallium/state_trackers/vdpau')
-rw-r--r-- | src/gallium/state_trackers/vdpau/decode.c | 19 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/ftab.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c | 17 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/surface.c | 5 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/vdpau_private.h | 1 |
6 files changed, 27 insertions, 23 deletions
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index 1b49b4b2520..5d3674c5eb2 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -40,10 +40,9 @@ vlVdpDecoderCreate ( VdpDevice device, VdpDecoder *decoder ) { - struct vl_screen *vscreen; - enum pipe_video_profile p_profile; - VdpStatus ret; - vlVdpDecoder *vldecoder; + enum pipe_video_profile p_profile = PIPE_VIDEO_PROFILE_UNKNOWN; + VdpStatus ret = VDP_STATUS_OK; + vlVdpDecoder *vldecoder = NULL; debug_printf("[VDPAU] Creating decoder\n"); @@ -137,12 +136,13 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder, if(!(vldecoder && vlsurf)) return VDP_STATUS_INVALID_POINTER; - vctx = vldecoder->vctx; + vctx = vldecoder->vctx->vpipe; memset(&tmplt, 0, sizeof(struct pipe_resource)); tmplt.target = PIPE_TEXTURE_2D; - tmplt.format = vlsurf->format; + tmplt.format = vctx->get_param(vctx,PIPE_CAP_DECODE_TARGET_PREFERRED_FORMAT); tmplt.last_level = 0; + if (vctx->is_format_supported(vctx, tmplt.format, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET, PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO)) { @@ -156,6 +156,7 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder, tmplt.width0 = util_next_power_of_two(vlsurf->width); tmplt.height0 = util_next_power_of_two(vlsurf->height); } + tmplt.depth0 = 1; tmplt.usage = PIPE_USAGE_DEFAULT; tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; @@ -170,7 +171,7 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder, if (!vlsurf->psurface) return VDP_STATUS_RESOURCES; - + debug_printf("[VDPAU] Done creating surface\n"); return VDP_STATUS_OK; } @@ -275,12 +276,10 @@ vlVdpDecoderRender (VdpDecoder decoder, if (!vscreen) return VDP_STATUS_RESOURCES; - vldecoder->vctx = vl_video_create(vscreen, vldecoder->profile, vlsurf->format, vldecoder->width, vldecoder->height); + vldecoder->vctx = vl_video_create(vscreen, vldecoder->profile, vlsurf->chroma_format, vldecoder->width, vldecoder->height); if (!vldecoder->vctx) return VDP_STATUS_RESOURCES; - vldecoder->vctx->vscreen = vscreen; - // TODO: Right now only mpeg2 is supported. switch (vldecoder->vctx->vpipe->profile) { case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE: diff --git a/src/gallium/state_trackers/vdpau/ftab.c b/src/gallium/state_trackers/vdpau/ftab.c index 2142dcd4f6a..de08b810268 100644 --- a/src/gallium/state_trackers/vdpau/ftab.c +++ b/src/gallium/state_trackers/vdpau/ftab.c @@ -33,7 +33,7 @@ static void* ftab[67] = &vlVdpGetErrorString, /* VDP_FUNC_ID_GET_ERROR_STRING */ &vlVdpGetProcAddress, /* VDP_FUNC_ID_GET_PROC_ADDRESS */ &vlVdpGetApiVersion, /* VDP_FUNC_ID_GET_API_VERSION */ - 0x555, /* DUMMY */ + 0x55, /* DUMMY */ &vlVdpGetInformationString, /* VDP_FUNC_ID_GET_INFORMATION_STRING */ &vlVdpDeviceDestroy, /* VDP_FUNC_ID_DEVICE_DESTROY */ &vlVdpGenerateCSCMatrix, /* VDP_FUNC_ID_GENERATE_CSC_MATRIX */ diff --git a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c index 3c456a07ca1..436e7908e5b 100644 --- a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c +++ b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.c @@ -30,8 +30,9 @@ int vlVdpMPEG2NextStartCode(struct vdpMPEG2BitstreamParser *parser) { - uint32_t integer = 0; - uint32_t bytes_to_end; + uint32_t integer = 0xffffff00; + uint8_t * ptr_read = parser->ptr_bitstream; + int32_t bytes_to_end; /* Move cursor to the start of a byte */ while(parser->cursor % 8) @@ -47,9 +48,9 @@ vlVdpMPEG2NextStartCode(struct vdpMPEG2BitstreamParser *parser) parser->state = MPEG2_HEADER_DONE; return 1; } - - integer << 8; - integer = integer & (unsigned char)(parser->ptr_bitstream + parser->cursor/8)[0]; + integer = ( integer | *ptr_read++ ) << 8; + + debug_printf("[VDPAU][Bitstream parser] Current read uint32_t: %08x .. Bytes to end: %d\n", integer,bytes_to_end); bytes_to_end--; parser->cursor += 8; @@ -57,7 +58,7 @@ vlVdpMPEG2NextStartCode(struct vdpMPEG2BitstreamParser *parser) } /* start_code found. rewind cursor a byte */ - parser->cursor -= 8; + //parser->cursor -= 8; return 0; } @@ -89,8 +90,8 @@ vlVdpMPEG2BitstreamToMacroblock ( { case MPEG2_HEADER_START_CODE: if (vlVdpMPEG2NextStartCode(&parser)) - continue; - + exit(1); + debug_printf("[VDPAU] START_CODE: %02x\n",(parser.ptr_bitstream + parser.cursor/8)[0]); /* Start_code found */ switch ((parser.ptr_bitstream + parser.cursor/8)[0]) { diff --git a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h index 74a216a4d81..b7e778f780b 100644 --- a/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h +++ b/src/gallium/state_trackers/vdpau/mpeg2_bitstream_parser.h @@ -44,7 +44,11 @@ struct vdpMPEG2BitstreamParser uint32_t cursor; // current bit cursor uint32_t cur_bitstream; uint32_t cur_bitstream_length; - unsigned char *ptr_bitstream; + uint8_t *ptr_bitstream; + + /* The decoded bitstream goes here: */ + /* Sequence_header_info */ + uint32_t horizontal_size_value; }; int diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index f957d94bdf7..9b6dac9c3f4 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -30,7 +30,6 @@ #include <pipe/p_state.h> #include <util/u_memory.h> #include <util/u_format.h> -#include <stdio.h> VdpStatus vlVdpVideoSurfaceCreate(VdpDevice device, @@ -68,8 +67,10 @@ vlVdpVideoSurfaceCreate(VdpDevice device, goto inv_device; } - p_surf->chroma_format = FormatToPipe(chroma_type); + p_surf->chroma_format = TypeToPipe(chroma_type); p_surf->device = dev; + p_surf->width = width; + p_surf->height = height; *surface = vlAddDataHTAB(p_surf); if (*surface == 0) { diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index de206365ce2..d582b8e6c29 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -192,7 +192,6 @@ typedef struct uint32_t height; uint32_t pitch; struct pipe_surface *psurface; - enum pipe_format format; enum pipe_video_chroma_format chroma_format; uint8_t *data; } vlVdpSurface; |