summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/vl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/vl')
-rw-r--r--src/gallium/auxiliary/vl/vl_vp8_decoder.c21
-rw-r--r--src/gallium/auxiliary/vl/vp8/vp8_decoder.c41
2 files changed, 43 insertions, 19 deletions
diff --git a/src/gallium/auxiliary/vl/vl_vp8_decoder.c b/src/gallium/auxiliary/vl/vl_vp8_decoder.c
index 626feefdce..07c6d8ebb6 100644
--- a/src/gallium/auxiliary/vl/vl_vp8_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_vp8_decoder.c
@@ -207,11 +207,30 @@ vl_vp8_decode_bitstream(struct pipe_video_decoder *decoder,
struct vl_vp8_buffer *buf;
assert(dec && target && picture);
- assert(num_buffers == 1);
+ assert(num_buffers < 3);
buf = vl_vp8_get_decode_buffer(dec, target);
assert(buf);
+ // Try and detect start_code from the first data buffer
+ if (num_buffers > 1)
+ {
+ const uint8_t *datab = (const uint8_t *)buffers[dec->current_buffer];
+
+ if ((sizes[dec->current_buffer] == 3) &&
+ (datab[0] == 0x9D && datab[1] == 0x01 && datab[2] == 0x2A))
+ {
+ // The start_code [0x9D012A] is present in a dedicated buffer
+ ++dec->current_buffer;
+ dec->current_buffer %= 4;
+ }
+ else
+ {
+ printf("[G3DVL] Error : First VP8 VDPAU bitstream buffer is invalid !\n");
+ return;
+ }
+ }
+
// Start bitstream decoding
//vl_vp8_bs_decode(&buf->bs, target, desc, num_buffers, buffers, sizes);
diff --git a/src/gallium/auxiliary/vl/vp8/vp8_decoder.c b/src/gallium/auxiliary/vl/vp8/vp8_decoder.c
index 4aff049dd6..8a54ab4166 100644
--- a/src/gallium/auxiliary/vl/vp8/vp8_decoder.c
+++ b/src/gallium/auxiliary/vl/vp8/vp8_decoder.c
@@ -140,33 +140,37 @@ int vp8_decoder_start(VP8_COMMON *common,
const unsigned char *data, unsigned data_size)
{
int retcode = 0;
+ int bitstreambuffer_offset = 0;
- common->error.error_code = VPX_CODEC_OK;
-
- {
- common->data = data;
- common->data_size = data_size;
+ if (frame_header->key_frame == 0)
+ bitstreambuffer_offset = 10;
+ else
+ bitstreambuffer_offset = 3;
- common->new_fb_idx = get_free_fb(common);
+ common->data = data + bitstreambuffer_offset;
+ common->data_size = data_size - bitstreambuffer_offset;
+ common->new_fb_idx = get_free_fb(common);
- if (setjmp(common->error.jmp))
- {
- common->error.setjmp = 0;
+ common->error.error_code = VPX_CODEC_OK;
- /* We do not know if the missing frame(s) was supposed to update
- * any of the reference buffers, but we act conservative and
- * mark only the last buffer as corrupted. */
- common->yv12_fb[common->lst_fb_idx].corrupted = 1;
+ if (setjmp(common->error.jmp))
+ {
+ common->error.setjmp = 0;
- if (common->fb_idx_ref_cnt[common->new_fb_idx] > 0)
- common->fb_idx_ref_cnt[common->new_fb_idx]--;
+ /* We do not know if the missing frame(s) was supposed to update
+ * any of the reference buffers, but we act conservative and
+ * mark only the last buffer as corrupted. */
+ common->yv12_fb[common->lst_fb_idx].corrupted = 1;
- return -1;
- }
+ if (common->fb_idx_ref_cnt[common->new_fb_idx] > 0)
+ common->fb_idx_ref_cnt[common->new_fb_idx]--;
- common->error.setjmp = 1;
+ return -1;
}
+ common->error.setjmp = 1;
+
+ // Frame decoding
retcode = vp8_frame_decode(common, frame_header);
if (retcode < 0)
@@ -179,6 +183,7 @@ int vp8_decoder_start(VP8_COMMON *common,
return retcode;
}
+ // Software frame buffer handling
{
if (swap_frame_buffers(common))
{