Mercurial > libavcodec.hg
comparison mpeg12.c @ 9044:a56d79b0b9fb libavcodec
More AVhwaccel hunks from Gwenole Beauchesne.
author | michael |
---|---|
date | Wed, 25 Feb 2009 19:16:27 +0000 |
parents | 8e5fe9e56b93 |
children | 3c5920f57063 |
comparison
equal
deleted
inserted
replaced
9043:47e456d3f15b | 9044:a56d79b0b9fb |
---|---|
1214 return PIX_FMT_VDPAU_MPEG1; | 1214 return PIX_FMT_VDPAU_MPEG1; |
1215 else | 1215 else |
1216 return PIX_FMT_VDPAU_MPEG2; | 1216 return PIX_FMT_VDPAU_MPEG2; |
1217 }else{ | 1217 }else{ |
1218 if(s->chroma_format < 2) | 1218 if(s->chroma_format < 2) |
1219 return PIX_FMT_YUV420P; | 1219 return avctx->get_format(avctx,ff_pixfmt_list_420); |
1220 else if(s->chroma_format == 2) | 1220 else if(s->chroma_format == 2) |
1221 return PIX_FMT_YUV422P; | 1221 return PIX_FMT_YUV422P; |
1222 else | 1222 else |
1223 return PIX_FMT_YUV444P; | 1223 return PIX_FMT_YUV444P; |
1224 } | 1224 } |
1603 tmp = s->pblocks[4]; | 1603 tmp = s->pblocks[4]; |
1604 s->pblocks[4] = s->pblocks[5]; | 1604 s->pblocks[4] = s->pblocks[5]; |
1605 s->pblocks[5] = tmp; | 1605 s->pblocks[5] = tmp; |
1606 } | 1606 } |
1607 | 1607 |
1608 static int mpeg_field_start(MpegEncContext *s){ | 1608 static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size){ |
1609 AVCodecContext *avctx= s->avctx; | 1609 AVCodecContext *avctx= s->avctx; |
1610 Mpeg1Context *s1 = (Mpeg1Context*)s; | 1610 Mpeg1Context *s1 = (Mpeg1Context*)s; |
1611 | 1611 |
1612 /* start frame decoding */ | 1612 /* start frame decoding */ |
1613 if(s->first_field || s->picture_structure==PICT_FRAME){ | 1613 if(s->first_field || s->picture_structure==PICT_FRAME){ |
1643 if(s->picture_structure == PICT_BOTTOM_FIELD){ | 1643 if(s->picture_structure == PICT_BOTTOM_FIELD){ |
1644 s->current_picture.data[i] += s->current_picture_ptr->linesize[i]; | 1644 s->current_picture.data[i] += s->current_picture_ptr->linesize[i]; |
1645 } | 1645 } |
1646 } | 1646 } |
1647 } | 1647 } |
1648 | |
1649 if (avctx->hwaccel) { | |
1650 if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) | |
1651 return -1; | |
1652 } | |
1653 | |
1648 // MPV_frame_start will call this function too, | 1654 // MPV_frame_start will call this function too, |
1649 // but we need to call it on every field | 1655 // but we need to call it on every field |
1650 if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) | 1656 if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) |
1651 if(ff_xvmc_field_start(s,avctx) < 0) | 1657 if(ff_xvmc_field_start(s,avctx) < 0) |
1652 return -1; | 1658 return -1; |
2072 s->low_delay= 1; | 2078 s->low_delay= 1; |
2073 | 2079 |
2074 avctx->pix_fmt = mpeg_get_pixelformat(avctx); | 2080 avctx->pix_fmt = mpeg_get_pixelformat(avctx); |
2075 avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); | 2081 avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); |
2076 | 2082 |
2077 if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT || | 2083 if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel || |
2078 s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ) | 2084 s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ) |
2079 if( avctx->idct_algo == FF_IDCT_AUTO ) | 2085 if( avctx->idct_algo == FF_IDCT_AUTO ) |
2080 avctx->idct_algo = FF_IDCT_SIMPLE; | 2086 avctx->idct_algo = FF_IDCT_SIMPLE; |
2081 | 2087 |
2082 if (MPV_common_init(s) < 0) | 2088 if (MPV_common_init(s) < 0) |
2382 break; | 2388 break; |
2383 } | 2389 } |
2384 | 2390 |
2385 if(s2->first_slice){ | 2391 if(s2->first_slice){ |
2386 s2->first_slice=0; | 2392 s2->first_slice=0; |
2387 if(mpeg_field_start(s2) < 0) | 2393 if(mpeg_field_start(s2, buf, buf_size) < 0) |
2388 return -1; | 2394 return -1; |
2389 } | 2395 } |
2390 if(!s2->current_picture_ptr){ | 2396 if(!s2->current_picture_ptr){ |
2391 av_log(avctx, AV_LOG_ERROR, "current_picture not initialized\n"); | 2397 av_log(avctx, AV_LOG_ERROR, "current_picture not initialized\n"); |
2392 return -1; | 2398 return -1; |