mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
vl: bitstream decoder finds startcodes
This commit is contained in:
parent
bff1ac875c
commit
7d2bdc2d4d
7 changed files with 28 additions and 23 deletions
|
|
@ -429,6 +429,7 @@ sp_mpeg12_create(struct pipe_context *pipe, enum pipe_video_profile profile,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue