summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2009-02-27 08:20:45 +0000
committerBenoit Fouet <benoit.fouet@free.fr>2009-02-27 08:20:45 +0000
commit6aca2c67858e4cc926ed70165ace763ff7d0a178 (patch)
tree59a598a9f1030509b0a33ff6c384eee5264710ed
parent11647a9f8ce89ef19dd2b0a0da6e4fe7f1902433 (diff)
Remove superfluous call to mpeg_decode_slice() for hwaccel, this
function already contains the needed code. Patch by Gwenole Beauchesne. Originally committed as revision 17636 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/mpeg12.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 6988da22f6..d543c87a8b 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1216,7 +1216,7 @@ static enum PixelFormat mpeg_get_pixelformat(AVCodecContext *avctx){
return PIX_FMT_VDPAU_MPEG2;
}else{
if(s->chroma_format < 2)
- return avctx->get_format(avctx,ff_pixfmt_list_420);
+ return avctx->get_format(avctx,ff_hwaccel_pixfmt_list_420);
else if(s->chroma_format == 2)
return PIX_FMT_YUV422P;
else
@@ -1704,6 +1704,19 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
s->mb_x=0;
+ if (avctx->hwaccel) {
+ const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */
+ int start_code = -1;
+ buf_end = ff_find_start_code(buf_start + 2, *buf + buf_size, &start_code);
+ if (buf_end < *buf + buf_size)
+ buf_end -= 4;
+ s->mb_y = mb_y;
+ if (avctx->hwaccel->decode_slice(avctx, buf_start, buf_end - buf_start) < 0)
+ return DECODE_SLICE_ERROR;
+ *buf = buf_end;
+ return DECODE_SLICE_OK;
+ }
+
for(;;) {
int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
if (code < 0){
@@ -1922,6 +1935,11 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
if (!s1->mpeg_enc_ctx_allocated || !s->current_picture_ptr)
return 0;
+ if (s->avctx->hwaccel) {
+ if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+ av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");
+ }
+
if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
ff_xvmc_field_end(s);