AMV video decoder.

Patch by Vladimir Voroshilov (voroshil - gmail - com)

Originally committed as revision 10617 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Vladimir Voroshilov 2007-09-29 15:20:22 +00:00 committed by Vitor Sessak
parent 55ffe9df2a
commit 8787d8377f
7 changed files with 26 additions and 1 deletions

View File

@ -95,7 +95,7 @@ version <next>
- Matroska muxer
- Slice-based parallel H.264 decoding
- Monkey's Audio demuxer and decoder
- AMV audio decoder
- AMV audio and video decoder
version 0.4.9-pre1:

View File

@ -231,6 +231,7 @@ following image formats are supported:
@item THP @tab @tab X @tab Used on the Nintendo GameCube.
@item Bethsoft VID @tab @tab X @tab Used in some games from Bethesda Softworks.
@item Renderware TXD @tab @tab X @tab Texture dictionaries used by the Renderware Engine.
@item AMV @tab @tab X @tab Used in chinese MP3 players
@end multitable
@code{X} means that encoding (resp. decoding) is supported.

View File

@ -35,6 +35,7 @@ OBJS-$(CONFIG_AASC_DECODER) += aasc.o
OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3tab.o ac3.o mdct.o fft.o
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc.o ac3tab.o ac3.o
OBJS-$(CONFIG_ALAC_DECODER) += alac.o
OBJS-$(CONFIG_AMV_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o
OBJS-$(CONFIG_APE_DECODER) += apedec.o
OBJS-$(CONFIG_ASV1_DECODER) += asv1.o
OBJS-$(CONFIG_ASV1_ENCODER) += asv1.o

View File

@ -61,6 +61,7 @@ void avcodec_register_all(void)
/* video codecs */
REGISTER_DECODER (AASC, aasc);
REGISTER_DECODER (AMV, amv);
REGISTER_ENCDEC (ASV1, asv1);
REGISTER_ENCDEC (ASV2, asv2);
REGISTER_DECODER (AVS, avs);

View File

@ -167,6 +167,7 @@ enum CodecID {
CODEC_ID_PTX,
CODEC_ID_TXD,
CODEC_ID_VP6A,
CODEC_ID_AMV,
/* various PCM "codecs" */
CODEC_ID_PCM_S16LE= 0x10000,

View File

@ -669,6 +669,11 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int ss, i
int c = s->comp_index[i];
data[c] = s->picture.data[c];
linesize[c]=s->linesize[c];
if(s->avctx->codec->id==CODEC_ID_AMV) {
//picture should be flipped upside-down for this codec
data[c] += (linesize[c] * (s->v_scount[i] * 8 * s->mb_height - 1));
linesize[c] *= -1;
}
}
for(mb_y = 0; mb_y < s->mb_height; mb_y++) {

View File

@ -72,6 +72,10 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
memcpy(recoded+j, &sp5x_data_sos[0], sizeof(sp5x_data_sos));
j += sizeof(sp5x_data_sos);
if(avctx->codec_id==CODEC_ID_AMV)
for (i = 2; i < buf_size-2 && j < buf_size+1024-2; i++)
recoded[j++] = buf[i];
else
for (i = 14; i < buf_size && j < buf_size+1024-2; i++)
{
recoded[j++] = buf[i];
@ -194,3 +198,15 @@ AVCodec sp5x_decoder = {
CODEC_CAP_DR1,
NULL
};
AVCodec amv_decoder = {
"amv",
CODEC_TYPE_VIDEO,
CODEC_ID_AMV,
sizeof(MJpegDecodeContext),
ff_mjpeg_decode_init,
NULL,
ff_mjpeg_decode_end,
sp5x_decode_frame,
CODEC_CAP_DR1
};