diff options
author | Vladimir Voroshilov <voroshil@gmail.com> | 2007-09-29 19:20:22 +0400 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2007-09-29 19:20:22 +0400 |
commit | 8787d8377f8024f43b732f099a4ce36b9f1b717e (patch) | |
tree | 94753eb5f837977ce2f885e9cd194f08430d46fc | |
parent | 55ffe9df2acfc06236b139c5226d202f3cc5ef59 (diff) |
AMV video decoder.
Patch by Vladimir Voroshilov (voroshil - gmail - com)
Originally committed as revision 10617 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | Changelog | 2 | ||||
-rw-r--r-- | doc/general.texi | 1 | ||||
-rw-r--r-- | libavcodec/Makefile | 1 | ||||
-rw-r--r-- | libavcodec/allcodecs.c | 1 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 1 | ||||
-rw-r--r-- | libavcodec/mjpegdec.c | 5 | ||||
-rw-r--r-- | libavcodec/sp5xdec.c | 16 |
7 files changed, 26 insertions, 1 deletions
@@ -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: diff --git a/doc/general.texi b/doc/general.texi index bf5815e33e..2056de8579 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -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. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index daca9b90bb..1770260d3f 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -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 diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index bd566a51fa..334a8e379e 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -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); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 638b42d2ea..8e6944eb90 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -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, diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 7dc0616a8f..d1d81d3493 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -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++) { diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c index 2234afa697..ada46ca353 100644 --- a/libavcodec/sp5xdec.c +++ b/libavcodec/sp5xdec.c @@ -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 +}; |