ctx->base.height = height;
ctx->base.screen = pipe->screen;
+
ctx->base.destroy = sp_mpeg12_destroy;
ctx->base.get_param = sp_mpeg12_get_param;
ctx->base.is_format_supported = sp_mpeg12_is_format_supported;
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");
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)) {
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;
if (!vlsurf->psurface)
return VDP_STATUS_RESOURCES;
-
+ debug_printf("[VDPAU] Done creating surface\n");
return VDP_STATUS_OK;
}
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:
&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 */
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)
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;
}
/* start_code found. rewind cursor a byte */
- parser->cursor -= 8;
+ //parser->cursor -= 8;
return 0;
}
{
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])
{
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
#include <pipe/p_state.h>
#include <util/u_memory.h>
#include <util/u_format.h>
-#include <stdio.h>
VdpStatus
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) {
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;