diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/debian/changelog chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/debian/changelog --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/debian/changelog 2011-02-04 16:50:48.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/debian/changelog 2011-02-04 16:50:49.000000000 +0000 @@ -1,3 +1,9 @@ +chromium-codecs-ffmpeg (0.6+svn20101129r67548+69665-0ubuntu0.10.04.1) lucid-security; urgency=high + + * New upstream snapshot (LP: #712655) + + -- Fabien Tassin Thu, 03 Feb 2011 22:56:37 +0100 + chromium-codecs-ffmpeg (0.6+svn20100904r58574+58998-0ubuntu0.10.04.1) lucid-security; urgency=low * New upstream snapshot (LP: #635949) Binary files /tmp/E4kVbRVAOB/chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/ffmpeg-mt.tar.gz and /tmp/wChKy5e3fT/chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/ffmpeg-mt.tar.gz differ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/from_upstream/19_vorbis_decode.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/from_upstream/19_vorbis_decode.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/from_upstream/19_vorbis_decode.patch 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/from_upstream/19_vorbis_decode.patch 2011-02-03 22:58:12.000000000 +0000 @@ -0,0 +1,24 @@ +diff -wurp -N orig/libavcodec/vorbis_dec.c ffmpeg-mt/libavcodec/vorbis_dec.c +--- orig/libavcodec/vorbis_dec.c 2010-11-12 17:53:13 -0800 ++++ ffmpeg-mt/libavcodec/vorbis_dec.c 2010-11-12 12:59:09 -0800 +@@ -1148,8 +1146,8 @@ static int vorbis_floor1_decode(vorbis_c + int_fast16_t book; + uint_fast16_t offset; + uint_fast16_t i,j; +- /*u*/int_fast16_t adx, ady, off, predicted; // WTF ? dy/adx = (unsigned)dy/adx ? +- int_fast16_t dy, err; ++ int_fast16_t adx, ady, dy, off, predicted; ++ int_fast32_t err; + + + if (!get_bits1(gb)) // silence +@@ -1212,7 +1210,7 @@ static int vorbis_floor1_decode(vorbis_c + adx = vf->list[high_neigh_offs].x - vf->list[low_neigh_offs].x; + ady = FFABS(dy); + err = ady * (vf->list[i].x - vf->list[low_neigh_offs].x); +- off = (int16_t)err / (int16_t)(adx?adx:1); ++ off = err / adx; + if (dy < 0) { + predicted = floor1_Y_final[low_neigh_offs] - off; + } else { + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/from_upstream/20_r25798_ogg_data_offset.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/from_upstream/20_r25798_ogg_data_offset.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/from_upstream/20_r25798_ogg_data_offset.patch 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/from_upstream/20_r25798_ogg_data_offset.patch 2011-02-03 22:58:12.000000000 +0000 @@ -0,0 +1,33 @@ +diff -wurp -N orig/libavformat/oggdec.c ffmpeg-mt/libavformat/oggdec.c +--- orig/libavformat/oggdec.c 2010-11-29 08:28:58 -0800 ++++ ffmpeg-mt/libavformat/oggdec.c 2010-11-29 08:29:07 -0800 +@@ -383,9 +383,27 @@ ogg_packet (AVFormatContext * s, int *st + if (!os->header){ + os->segp = segp; + os->psize = psize; +- if (!ogg->headers) +- s->data_offset = os->sync_pos; ++ ++ // We've reached the first non-header packet. All header ++ // packets must be complete before the first non-header ++ // one, so everything that follows must be non-header. + ogg->headers = 1; ++ ++ // Update the header state for all streams and ++ // compute the data_offset. ++ s->data_offset = os->sync_pos; ++ for (i = 0; i < ogg->nstreams; i++) { ++ struct ogg_stream *cur_os = ogg->streams + i; ++ // Set stream header state to 0 if its last packet ++ // was a header. ++ if (cur_os->header > 0) ++ cur_os->header = 0; ++ ++ // if we have a partial non-header packet, its start is ++ // obviously at or after the data start. ++ if (cur_os->incomplete) ++ s->data_offset = FFMIN(s->data_offset, cur_os->sync_pos); ++ } + }else{ + os->pstart += os->psize; + os->psize = 0; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/01_static_pthread_O2.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/01_static_pthread_O2.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/01_static_pthread_O2.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/01_static_pthread_O2.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,7 +1,7 @@ -diff -rpu -N orig/configure ffmpeg-mt/configure ---- orig/configure 2010-08-11 14:22:13.093665900 -0700 -+++ ffmpeg-mt/configure 2010-08-11 14:22:17.313087800 -0700 -@@ -1806,7 +1806,7 @@ if $cc -v 2>&1 | grep -qi ^gcc; then +diff -wurp -N orig/configure ffmpeg-mt/configure +--- orig/configure 2010-11-08 15:07:20 -0800 ++++ ffmpeg-mt/configure 2010-11-08 15:07:27 -0800 +@@ -1846,7 +1846,7 @@ elif $cc -v 2>&1 | grep -qi ^gcc; then CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' fi @@ -10,32 +10,44 @@ size_cflags='-Os' elif $cc --version 2>/dev/null | grep -q Intel; then cc_type=icc -@@ -2650,6 +2650,9 @@ if ! disabled pthreads && ! enabled w32t +@@ -1996,6 +1996,7 @@ elif $cc -v 2>&1 | grep -q Open64; then + cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :) + CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' + AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' ++# O2 produces smaller/faster code on P4 and same performance on Core/Atom. + speed_cflags='-O2' + size_cflags='-Os' + fi +@@ -2715,6 +2716,10 @@ if ! disabled pthreads && ! enabled w32t add_extralibs -pthreads elif check_func pthread_create -lpthreadGC2; then add_extralibs -lpthreadGC2 ++# static pthreads improves startup time + elif check_func pthread_create -lpthreadGC2 -lws2_32; then + add_cflags -DPTW32_STATIC_LIB + add_extralibs -lpthreadGC2 -lws2_32 elif ! check_lib pthread.h pthread_create -lpthread; then disable pthreads fi -@@ -2870,7 +2873,6 @@ elif enabled ccc; then +@@ -2943,7 +2948,8 @@ elif enabled ccc; then elif enabled gcc; then check_cflags -fno-tree-vectorize check_cflags -Werror=implicit-function-declaration - check_cflags -Werror=missing-prototypes ++# Removed to allow msys gcc 4.2.1-sjlj to compile ++# check_cflags -Werror=missing-prototypes + elif enabled llvm_gcc; then + check_cflags -mllvm -stack-alignment=16 elif enabled clang; then - check_cflags -Qunused-arguments - elif enabled armcc; then -diff -rpu -N orig/libavcodec/allcodecs.c ffmpeg-mt/libavcodec/allcodecs.c ---- orig/libavcodec/allcodecs.c 2010-08-11 14:22:13.284685000 -0700 -+++ ffmpeg-mt/libavcodec/allcodecs.c 2010-08-11 14:22:17.319088400 -0700 -@@ -45,6 +45,14 @@ +diff -wurp -N orig/libavcodec/allcodecs.c ffmpeg-mt/libavcodec/allcodecs.c +--- orig/libavcodec/allcodecs.c 2010-11-08 15:07:20 -0800 ++++ ffmpeg-mt/libavcodec/allcodecs.c 2010-11-08 15:07:27 -0800 +@@ -45,6 +45,15 @@ extern AVBitStreamFilter x##_bsf; \ if(CONFIG_##X##_BSF) av_register_bitstream_filter(&x##_bsf); } - + +#ifdef PTW32_STATIC_LIB ++#include "pthread.h" +static void detach_ptw32(void) +{ + pthread_win32_thread_detach_np(); @@ -46,10 +58,10 @@ void avcodec_register_all(void) { static int initialized; -@@ -53,6 +61,11 @@ void avcodec_register_all(void) +@@ -53,6 +62,11 @@ void avcodec_register_all(void) return; initialized = 1; - + +#ifdef PTW32_STATIC_LIB + pthread_win32_process_attach_np(); + pthread_win32_thread_attach_np(); @@ -58,3 +70,4 @@ /* hardware accelerators */ REGISTER_HWACCEL (H263_VAAPI, h263_vaapi); REGISTER_HWACCEL (H264_DXVA2, h264_dxva2); + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/02_mov_dref_looping.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/02_mov_dref_looping.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/02_mov_dref_looping.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/02_mov_dref_looping.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,6 +1,6 @@ -diff -rpu -N orig/libavformat/mov.c ffmpeg-mt/libavformat/mov.c ---- orig/libavformat/mov.c 2010-08-11 14:22:22.293585800 -0700 -+++ ffmpeg-mt/libavformat/mov.c 2010-08-11 14:22:23.395696000 -0700 +diff -wurp -N orig/libavformat/mov.c ffmpeg-mt/libavformat/mov.c +--- orig/libavformat/mov.c 2010-11-08 15:07:45 -0800 ++++ ffmpeg-mt/libavformat/mov.c 2010-11-08 15:07:48 -0800 @@ -344,6 +344,8 @@ static int mov_read_dref(MOVContext *c, MOVDref *dref = &sc->drefs[i]; uint32_t size = get_be32(pb); @@ -8,5 +8,5 @@ + if (size < 8) + return -1; - dref->type = get_le32(pb); - get_be32(pb); // version + flags + if (size < 12) + return -1; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/03_mpeg4_video_to_elementary_stream.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/03_mpeg4_video_to_elementary_stream.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/03_mpeg4_video_to_elementary_stream.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/03_mpeg4_video_to_elementary_stream.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,167 +0,0 @@ -diff -rpu -N orig/libavcodec/Makefile ffmpeg-mt/libavcodec/Makefile ---- orig/libavcodec/Makefile 2010-08-11 14:22:27.770133400 -0700 -+++ ffmpeg-mt/libavcodec/Makefile 2010-08-11 14:22:29.550311400 -0700 -@@ -595,6 +595,14 @@ OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) - OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o - OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o - OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o -+OBJS-$(CONFIG_MPEG4VIDEO_ES_BSF) += mpeg4video_es_bsf.o \ -+ mpeg4videoenc.o ituh263enc.o \ -+ mpegvideo_enc.o motion_est.o \ -+ ratecontrol.o mpeg12data.o \ -+ aandcttab.o jfdctfst.o \ -+ jfdctint.o faandct.o \ -+ mpeg4video_parser.o mpegvideo.o \ -+ error_resilience.o h263.o mpeg4video.o mpeg4videodec.o ituh263dec.o h263dec.o - OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o - OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o - OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o -diff -rpu -N orig/libavcodec/allcodecs.c ffmpeg-mt/libavcodec/allcodecs.c ---- orig/libavcodec/allcodecs.c 2010-08-11 14:22:27.440100400 -0700 -+++ ffmpeg-mt/libavcodec/allcodecs.c 2010-08-11 14:22:29.558312200 -0700 -@@ -399,6 +399,7 @@ void avcodec_register_all(void) - REGISTER_BSF (CHOMP, chomp); - REGISTER_BSF (DUMP_EXTRADATA, dump_extradata); - REGISTER_BSF (H264_MP4TOANNEXB, h264_mp4toannexb); -+ REGISTER_BSF (MPEG4VIDEO_ES, mpeg4video_es); - REGISTER_BSF (IMX_DUMP_HEADER, imx_dump_header); - REGISTER_BSF (MJPEGA_DUMP_HEADER, mjpega_dump_header); - REGISTER_BSF (MP3_HEADER_COMPRESS, mp3_header_compress); -diff -rpu -N orig/libavcodec/mpeg4video.h ffmpeg-mt/libavcodec/mpeg4video.h ---- orig/libavcodec/mpeg4video.h 2010-08-11 14:22:27.826139000 -0700 -+++ ffmpeg-mt/libavcodec/mpeg4video.h 2010-08-11 14:22:29.563312700 -0700 -@@ -91,6 +91,9 @@ void mpeg4_encode_mb(MpegEncContext *s, - void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n, - int dir); - void ff_set_mpeg4_time(MpegEncContext * s); -+void mpeg4_encode_gop_header(MpegEncContext * s); -+void mpeg4_encode_visual_object_header(MpegEncContext * s); -+void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number); - void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number); - - int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb); -diff -rpu -N orig/libavcodec/mpeg4video_es_bsf.c ffmpeg-mt/libavcodec/mpeg4video_es_bsf.c ---- orig/libavcodec/mpeg4video_es_bsf.c 1969-12-31 16:00:00.000000000 -0800 -+++ ffmpeg-mt/libavcodec/mpeg4video_es_bsf.c 2010-08-11 14:22:29.571313500 -0700 -@@ -0,0 +1,91 @@ -+/* -+ * Copyright (c) 2009 Google Inc. -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "avcodec.h" -+#include "mpegvideo.h" -+ -+static int mpeg4video_es_filter(AVBitStreamFilterContext *bsfc, -+ AVCodecContext *avctx, const char *args, -+ uint8_t **poutbuf, int *poutbuf_size, -+ const uint8_t *buf, int buf_size, -+ int keyframe) { -+ AVCodecParserContext *cpc; -+ ParseContext1 *pc; -+ MpegEncContext *s; -+ int first_picture; -+ int ret; -+ uint8_t *frame_data; -+ int frame_size; -+ int outbuf_idx = 0; -+ int count = 0; -+ -+ if (avctx->codec_id != CODEC_ID_MPEG4) { -+ av_log(NULL, AV_LOG_ERROR, "Codec is not MPEG4\n"); -+ return -1; -+ } -+ -+ if (!bsfc->parser) { -+ bsfc->parser = av_parser_init(CODEC_ID_MPEG4); -+ } -+ cpc = bsfc->parser; -+ pc = cpc->priv_data; -+ s = pc->enc; -+ -+ *poutbuf = NULL; -+ *poutbuf_size = 0; -+ while (buf_size > 0) { -+ first_picture = pc->first_picture; -+ ret = cpc->parser->parser_parse(cpc, avctx, &frame_data, &frame_size, buf, buf_size); -+ -+ if (ret < 0) -+ return ret; -+ -+ buf_size -= ret; -+ buf += ret; -+ -+ // If the first picture is decoded, encode the header. -+ if (first_picture && !pc->first_picture) { -+ assert(!*poutbuf); -+ *poutbuf = av_malloc(1024); -+ *poutbuf_size = 1024; -+ init_put_bits(&s->pb, *poutbuf, 1024); -+ mpeg4_encode_visual_object_header(s); -+ mpeg4_encode_vol_header(s, 0, 0); -+ flush_put_bits(&s->pb); -+ outbuf_idx = (put_bits_count(&s->pb)+7)>>3; -+ } -+ -+ if (!frame_size) -+ break; -+ -+ *poutbuf = av_fast_realloc(*poutbuf, poutbuf_size, outbuf_idx + frame_size); -+ memcpy(*poutbuf + outbuf_idx, frame_data, frame_size); -+ outbuf_idx += frame_size; -+ } -+ -+ *poutbuf_size = outbuf_idx; -+ return 0; -+} -+ -+AVBitStreamFilter mpeg4video_es_bsf = { -+ "mpeg4video_es", -+ 0, -+ mpeg4video_es_filter, -+}; -diff -rpu -N orig/libavcodec/mpeg4videoenc.c ffmpeg-mt/libavcodec/mpeg4videoenc.c ---- orig/libavcodec/mpeg4videoenc.c 2010-08-11 14:22:27.828139200 -0700 -+++ ffmpeg-mt/libavcodec/mpeg4videoenc.c 2010-08-11 14:22:29.577314100 -0700 -@@ -872,7 +872,7 @@ void ff_set_mpeg4_time(MpegEncContext * - } - } - --static void mpeg4_encode_gop_header(MpegEncContext * s){ -+void mpeg4_encode_gop_header(MpegEncContext * s){ - int hours, minutes, seconds; - int64_t time; - -@@ -902,7 +902,7 @@ static void mpeg4_encode_gop_header(Mpeg - ff_mpeg4_stuffing(&s->pb); - } - --static void mpeg4_encode_visual_object_header(MpegEncContext * s){ -+void mpeg4_encode_visual_object_header(MpegEncContext * s){ - int profile_and_level_indication; - int vo_ver_id; - -@@ -947,7 +947,7 @@ static void mpeg4_encode_visual_object_h - ff_mpeg4_stuffing(&s->pb); - } - --static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number) -+void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number) - { - int vo_ver_id; - diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/04_vc1_bsfs.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/04_vc1_bsfs.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/04_vc1_bsfs.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/04_vc1_bsfs.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,302 +0,0 @@ -diff -rpu -N orig/libavcodec/Makefile ffmpeg-mt/libavcodec/Makefile ---- orig/libavcodec/Makefile 2010-08-11 14:22:33.678724200 -0700 -+++ ffmpeg-mt/libavcodec/Makefile 2010-08-11 14:22:35.355891900 -0700 -@@ -612,6 +612,9 @@ OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) - OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o - OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o - OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o -+OBJS-$(CONFIG_VC1_ASFTORCV_BSF) += vc1_asftorcv_bsf.o -+OBJS-$(CONFIG_VC1_ASFTOANNEXG_BSF) += vc1_asftoannexg_bsf.o vc1.o \ -+ vc1data.o msmpeg4data.o - - # thread libraries - OBJS-$(HAVE_PTHREADS) += pthread.o -diff -rpu -N orig/libavcodec/allcodecs.c ffmpeg-mt/libavcodec/allcodecs.c ---- orig/libavcodec/allcodecs.c 2010-08-11 14:22:33.344690800 -0700 -+++ ffmpeg-mt/libavcodec/allcodecs.c 2010-08-11 14:22:35.362892600 -0700 -@@ -408,5 +408,7 @@ void avcodec_register_all(void) - REGISTER_BSF (NOISE, noise); - REGISTER_BSF (REMOVE_EXTRADATA, remove_extradata); - REGISTER_BSF (TEXT2MOVSUB, text2movsub); -+ REGISTER_BSF (VC1_ASFTORCV, vc1_asftorcv); -+ REGISTER_BSF (VC1_ASFTOANNEXG, vc1_asftoannexg); - } - -diff -rpu -N orig/libavcodec/vc1_asftoannexg_bsf.c ffmpeg-mt/libavcodec/vc1_asftoannexg_bsf.c ---- orig/libavcodec/vc1_asftoannexg_bsf.c 1969-12-31 16:00:00.000000000 -0800 -+++ ffmpeg-mt/libavcodec/vc1_asftoannexg_bsf.c 2010-08-11 14:22:35.371893500 -0700 -@@ -0,0 +1,182 @@ -+/* -+ * copyright (c) 2010 Google Inc. -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "avcodec.h" -+#include "bytestream.h" -+#include "vc1.h" -+ -+// An arbitrary limit in bytes greater than the current bytes used. -+#define MAX_SEQ_HEADER_SIZE 50 -+ -+typedef struct ASFTOANNEXGBSFContext { -+ int frames; -+ uint8_t *seq_header; -+ int seq_header_size; -+ uint8_t *ep_header; -+ int ep_header_size; -+} ASFTOANNEXGBSFContext; -+ -+static int generate_sequence_header(VC1Context *v, ASFTOANNEXGBSFContext *ctx) -+{ -+ PutBitContext pb; -+ ctx->seq_header = av_mallocz(MAX_SEQ_HEADER_SIZE); -+ init_put_bits(&pb, ctx->seq_header, MAX_SEQ_HEADER_SIZE); -+ -+ put_bits(&pb, 32, VC1_CODE_SEQHDR); // start code -+ put_bits(&pb, 2, PROFILE_ADVANCED); // profile -+ put_bits(&pb, 3, v->level); // level -+ put_bits(&pb, 2, v->chromaformat); // chromaformat -+ put_bits(&pb, 3, v->frmrtq_postproc); // frmrtq postproc -+ put_bits(&pb, 5, v->bitrtq_postproc); // bitrtq postproc -+ put_bits(&pb, 1, v->postprocflag); // post proc flag -+ put_bits(&pb, 12, (v->s.avctx->coded_width >> 1) - 1); // codec width -+ put_bits(&pb, 12, (v->s.avctx->coded_height >> 1) - 1); // codec height -+ put_bits(&pb, 1, v->broadcast); // broadcast -+ put_bits(&pb, 1, v->interlace); // interlace -+ put_bits(&pb, 1, v->tfcntrflag); // tfcntrflag -+ put_bits(&pb, 1, v->finterpflag); // finterpflag -+ put_bits(&pb, 1, 1); // reserved -+ put_bits(&pb, 1, v->psf); // progressive segmented frame mode -+ put_bits(&pb, 1, 1); // has display info -+ put_bits(&pb, 14, v->s.avctx->width - 1); // width -+ put_bits(&pb, 14, v->s.avctx->height - 1); // height -+ put_bits(&pb, 1, 0); // no aspect ratio -+ put_bits(&pb, 1, 1); // frame rate -+ put_bits(&pb, 8, 3); // fake it to be 30fps, see vc1.c and vc1data.c -+ put_bits(&pb, 4, 1); // fake dr to be 1000, see vc1.c and vc1data.c -+ put_bits(&pb, 1, 0); // no color info -+ put_bits(&pb, 1, 0); // no hrd param -+ -+ align_put_bits(&pb); -+ ctx->seq_header_size = (put_bits_count(&pb) + 7) >> 3; -+ return 0; -+} -+ -+static int decode_sequence_header(AVCodecContext *avctx, VC1Context *v, uint8_t *header, int header_size) { -+ GetBitContext gb; -+ uint8_t *buf = av_mallocz(header_size + FF_INPUT_BUFFER_PADDING_SIZE); -+ int buf_size = vc1_unescape_buffer(header + 4, header_size - 4, buf); -+ int ret; -+ init_get_bits(&gb, buf, buf_size * 8); -+ ret = vc1_decode_sequence_header(avctx, v, &gb); -+ av_free(buf); -+ return ret; -+} -+ -+static int parse_extradata(AVCodecContext *avctx, ASFTOANNEXGBSFContext *ctx, uint8_t *extradata, int extradata_size) { -+ const uint8_t *start = extradata; -+ const uint8_t *end = extradata + extradata_size; -+ const uint8_t *next; -+ VC1Context vc1ctx; -+ int size; -+ int seq_ret; -+ -+ if(extradata_size < 16) { -+ av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", extradata_size); -+ return -1; -+ } -+ -+ start = find_next_marker(start, end); -+ next = start; -+ for(; next < end; start = next){ -+ next = find_next_marker(start + 4, end); -+ size = next - start; -+ if(size <= 0) continue; -+ switch(AV_RB32(start)){ -+ case VC1_CODE_SEQHDR: -+ memset(&vc1ctx, 0, sizeof(VC1Context)); -+ vc1ctx.profile = PROFILE_ADVANCED; -+ vc1ctx.s.avctx = avctx; -+ -+ seq_ret = decode_sequence_header(avctx, &vc1ctx, start, size) < 0 || -+ generate_sequence_header(&vc1ctx, ctx) < 0; -+ if (seq_ret) { -+ av_log(avctx, AV_LOG_ERROR, "Cannot regenerate sequence header\n"); -+ return -1; -+ } -+ break; -+ case VC1_CODE_ENTRYPOINT: -+ ctx->ep_header = av_malloc(size); -+ ctx->ep_header_size = size; -+ memcpy(ctx->ep_header, start, size); -+ break; -+ default: -+ break; -+ } -+ } -+ -+ if(!ctx->seq_header || !ctx->ep_header) { -+ av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n"); -+ return -1; -+ } -+ return 0; -+} -+ -+static int asftoannexg_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, -+ uint8_t **poutbuf, int *poutbuf_size, -+ const uint8_t *buf, int buf_size, int keyframe){ -+ ASFTOANNEXGBSFContext* ctx = (ASFTOANNEXGBSFContext*)bsfc->priv_data; -+ -+ if (avctx->codec_id != CODEC_ID_VC1) { -+ av_log(avctx, AV_LOG_ERROR, "Only VC1 Advanced profile is accepted!\n"); -+ return -1; -+ } -+ -+ if (!ctx->frames && parse_extradata(avctx, ctx, avctx->extradata, avctx->extradata_size) < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Cannot parse extra data!\n"); -+ return -1; -+ } -+ -+ uint8_t* bs; -+ if (keyframe) { -+ // If this is the keyframe, need to put sequence header and entry point header. -+ *poutbuf_size = ctx->seq_header_size + ctx->ep_header_size + 4 + buf_size; -+ *poutbuf = av_malloc(*poutbuf_size); -+ bs = *poutbuf; -+ -+ memcpy(bs, ctx->seq_header, ctx->seq_header_size); -+ bs += ctx->seq_header_size; -+ memcpy(bs, ctx->ep_header, ctx->ep_header_size); -+ bs += ctx->ep_header_size; -+ } else { -+ *poutbuf_size = 4 + buf_size; -+ *poutbuf = av_malloc(*poutbuf_size); -+ bs = *poutbuf; -+ } -+ -+ // Put the frame start code and frame data. -+ bytestream_put_be32(&bs, VC1_CODE_FRAME); -+ memcpy(bs, buf, buf_size); -+ ++ctx->frames; -+ return 0; -+} -+ -+static void asftoannexg_close(AVBitStreamFilterContext *bsfc) { -+ ASFTOANNEXGBSFContext *ctx = bsfc->priv_data; -+ av_freep(&ctx->seq_header); -+ av_freep(&ctx->ep_header); -+} -+ -+AVBitStreamFilter vc1_asftoannexg_bsf = { -+ "vc1_asftoannexg", -+ sizeof(ASFTOANNEXGBSFContext), -+ asftoannexg_filter, -+ asftoannexg_close, -+}; -diff -rpu -N orig/libavcodec/vc1_asftorcv_bsf.c ffmpeg-mt/libavcodec/vc1_asftorcv_bsf.c ---- orig/libavcodec/vc1_asftorcv_bsf.c 1969-12-31 16:00:00.000000000 -0800 -+++ ffmpeg-mt/libavcodec/vc1_asftorcv_bsf.c 2010-08-11 14:22:35.401896500 -0700 -@@ -0,0 +1,88 @@ -+/* -+ * copyright (c) 2010 Google Inc. -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "avcodec.h" -+#include "bytestream.h" -+ -+#define RCV_STREAM_HEADER_SIZE 36 -+#define RCV_PICTURE_HEADER_SIZE 8 -+ -+typedef struct ASFTORCVBSFContext { -+ int frames; -+} ASFTORCVBSFContext; -+ -+static int asftorcv_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, -+ uint8_t **poutbuf, int *poutbuf_size, -+ const uint8_t *buf, int buf_size, int keyframe){ -+ ASFTORCVBSFContext* ctx = (ASFTORCVBSFContext*)bsfc->priv_data; -+ -+ if (avctx->codec_id != CODEC_ID_WMV3) { -+ av_log(avctx, AV_LOG_ERROR, "Only WMV3 is accepted!\n"); -+ return -1; -+ } -+ -+ uint8_t* bs = NULL; -+ if (!ctx->frames) { -+ // Write the header if this is the first frame. -+ *poutbuf = av_malloc(RCV_STREAM_HEADER_SIZE + RCV_PICTURE_HEADER_SIZE + buf_size); -+ *poutbuf_size = RCV_STREAM_HEADER_SIZE + RCV_PICTURE_HEADER_SIZE + buf_size; -+ bs = *poutbuf; -+ -+ // The following structure of stream header comes from libavformat/vc1testenc.c. -+ bytestream_put_le24(&bs, 0); // Frame count. 0 for streaming. -+ bytestream_put_byte(&bs, 0xC5); -+ bytestream_put_le32(&bs, 4); // 4 bytes of extra data. -+ bytestream_put_byte(&bs, avctx->extradata[0]); -+ bytestream_put_byte(&bs, avctx->extradata[1]); -+ bytestream_put_byte(&bs, avctx->extradata[2]); -+ bytestream_put_byte(&bs, avctx->extradata[3]); -+ bytestream_put_le32(&bs, avctx->height); -+ bytestream_put_le32(&bs, avctx->width); -+ bytestream_put_le32(&bs, 0xC); -+ bytestream_put_le24(&bs, 0); // hrd_buffer -+ bytestream_put_byte(&bs, 0x80); // level|cbr|res1 -+ bytestream_put_le32(&bs, 0); // hrd_rate -+ -+ // The following LE32 describes the frame rate. Since we don't care so fill -+ // it with 0xFFFFFFFF which means variable framerate. -+ // See: libavformat/vc1testenc.c -+ bytestream_put_le32(&bs, 0xFFFFFFFF); -+ } else { -+ *poutbuf = av_malloc(RCV_PICTURE_HEADER_SIZE + buf_size); -+ *poutbuf_size = RCV_PICTURE_HEADER_SIZE + buf_size; -+ bs = *poutbuf; -+ } -+ -+ // Write the picture header. -+ bytestream_put_le32(&bs, buf_size | (keyframe ? 0x80000000 : 0)); -+ -+ // The following LE32 describes the pts. Since we don't care so fill it with 0. -+ bytestream_put_le32(&bs, 0); -+ memcpy(bs, buf, buf_size); -+ -+ ++ctx->frames; -+ return 0; -+} -+ -+AVBitStreamFilter vc1_asftorcv_bsf = { -+ "vc1_asftorcv", -+ sizeof(ASFTORCVBSFContext), -+ asftorcv_filter, -+}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/05_respect_flac_dirac_configure.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/05_respect_flac_dirac_configure.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/05_respect_flac_dirac_configure.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/05_respect_flac_dirac_configure.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,7 +1,7 @@ -diff -rpu -N orig/libavcodec/Makefile ffmpeg-mt/libavcodec/Makefile ---- orig/libavcodec/Makefile 2010-08-11 14:22:38.950251300 -0700 -+++ ffmpeg-mt/libavcodec/Makefile 2010-08-11 14:22:40.769433200 -0700 -@@ -517,8 +517,7 @@ OBJS-$(CONFIG_MATROSKA_MUXER) + +diff -wurp -N orig/libavcodec/Makefile ffmpeg-mt/libavcodec/Makefile +--- orig/libavcodec/Makefile 2010-11-08 15:08:06 -0800 ++++ ffmpeg-mt/libavcodec/Makefile 2010-11-08 15:08:11 -0800 +@@ -522,8 +522,7 @@ OBJS-$(CONFIG_MATROSKA_MUXER) + OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o mpeg4audio.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o @@ -9,12 +9,12 @@ - dirac.o mpeg12data.o +OBJS-$(CONFIG_OGG_DEMUXER) += dirac.o mpeg12data.o OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o - OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o + OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o xiph.o OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \ -diff -rpu -N orig/libavformat/Makefile ffmpeg-mt/libavformat/Makefile ---- orig/libavformat/Makefile 2010-08-11 14:22:39.550311300 -0700 -+++ ffmpeg-mt/libavformat/Makefile 2010-08-11 14:22:40.781434400 -0700 -@@ -146,12 +146,12 @@ OBJS-$(CONFIG_NULL_MUXER) +diff -wurp -N orig/libavformat/Makefile ffmpeg-mt/libavformat/Makefile +--- orig/libavformat/Makefile 2010-11-08 15:08:08 -0800 ++++ ffmpeg-mt/libavformat/Makefile 2010-11-08 15:08:11 -0800 +@@ -153,12 +153,12 @@ OBJS-$(CONFIG_NULL_MUXER) OBJS-$(CONFIG_NUT_DEMUXER) += nutdec.o nut.o riff.o OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o riff.o OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o riff.o @@ -30,9 +30,9 @@ oggparsetheora.o \ oggparsevorbis.o \ riff.o \ -diff -rpu -N orig/libavformat/oggdec.c ffmpeg-mt/libavformat/oggdec.c ---- orig/libavformat/oggdec.c 2010-08-11 14:22:39.590315300 -0700 -+++ ffmpeg-mt/libavformat/oggdec.c 2010-08-11 14:22:40.787435000 -0700 +diff -wurp -N orig/libavformat/oggdec.c ffmpeg-mt/libavformat/oggdec.c +--- orig/libavformat/oggdec.c 2010-11-08 15:08:08 -0800 ++++ ffmpeg-mt/libavformat/oggdec.c 2010-11-08 15:08:11 -0800 @@ -40,13 +40,23 @@ static const struct ogg_codec * const ogg_codecs[] = { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/06_remove_decode_on_config_no_svq3.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/06_remove_decode_on_config_no_svq3.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/06_remove_decode_on_config_no_svq3.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/06_remove_decode_on_config_no_svq3.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,6 +1,6 @@ -diff -rpu -N orig/libavcodec/h264.h ffmpeg-mt/libavcodec/h264.h ---- orig/libavcodec/h264.h 2010-08-11 14:22:43.995755800 -0700 -+++ ffmpeg-mt/libavcodec/h264.h 2010-08-11 14:22:45.816937900 -0700 +diff -wurp -N orig/libavcodec/h264.h ffmpeg-mt/libavcodec/h264.h +--- orig/libavcodec/h264.h 2010-11-08 15:08:28 -0800 ++++ ffmpeg-mt/libavcodec/h264.h 2010-11-08 15:08:33 -0800 @@ -602,9 +602,20 @@ typedef struct H264Context{ extern const uint8_t ff_h264_chroma_qp[52]; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/11_mkv_buffer_overflow.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/11_mkv_buffer_overflow.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/11_mkv_buffer_overflow.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/11_mkv_buffer_overflow.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,6 +1,6 @@ -diff -rpu -N orig/libavformat/matroskadec.c ffmpeg-mt/libavformat/matroskadec.c ---- orig/libavformat/matroskadec.c 2010-08-11 14:23:10.350391000 -0700 -+++ ffmpeg-mt/libavformat/matroskadec.c 2010-08-11 14:23:12.533609300 -0700 +diff -wurp -N orig/libavformat/matroskadec.c ffmpeg-mt/libavformat/matroskadec.c +--- orig/libavformat/matroskadec.c 2010-11-08 15:10:21 -0800 ++++ ffmpeg-mt/libavformat/matroskadec.c 2010-11-08 15:10:23 -0800 @@ -34,13 +34,17 @@ /* For ff_codec_get_id(). */ #include "riff.h" @@ -19,7 +19,7 @@ #if CONFIG_ZLIB #include #endif -@@ -620,12 +624,14 @@ static int ebml_read_float(ByteIOContext +@@ -633,12 +637,14 @@ static int ebml_read_float(ByteIOContext static int ebml_read_ascii(ByteIOContext *pb, int size, char **str) { av_free(*str); @@ -35,7 +35,7 @@ return AVERROR(EIO); } (*str)[size] = '\0'; -@@ -647,6 +653,7 @@ static int ebml_read_binary(ByteIOContex +@@ -660,6 +666,7 @@ static int ebml_read_binary(ByteIOContex bin->pos = url_ftell(pb); if (get_buffer(pb, bin->data, length) != length) { av_freep(&bin->data); @@ -43,7 +43,7 @@ return AVERROR(EIO); } -@@ -867,6 +874,8 @@ static int matroska_probe(AVProbeData *p +@@ -880,6 +887,8 @@ static int matroska_probe(AVProbeData *p * Not fully fool-proof, but good enough. */ for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) { int probelen = strlen(matroska_doctypes[i]); @@ -52,7 +52,7 @@ for (n = 4+size; n <= 4+size+total-probelen; n++) if (!memcmp(p->buf+n, matroska_doctypes[i], probelen)) return AVPROBE_SCORE_MAX; -@@ -904,6 +913,7 @@ static int matroska_decode_buffer(uint8_ +@@ -920,6 +929,7 @@ static int matroska_decode_buffer(uint8_ switch (encodings[0].compression.algo) { case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: return encodings[0].compression.settings.size; @@ -60,7 +60,7 @@ case MATROSKA_TRACK_ENCODING_COMP_LZO: do { olen = pkt_size *= 3; -@@ -914,6 +924,7 @@ static int matroska_decode_buffer(uint8_ +@@ -930,6 +940,7 @@ static int matroska_decode_buffer(uint8_ goto failed; pkt_size -= olen; break; @@ -68,7 +68,7 @@ #if CONFIG_ZLIB case MATROSKA_TRACK_ENCODING_COMP_ZLIB: { z_stream zstream = {0}; -@@ -1174,6 +1185,7 @@ static int matroska_read_header(AVFormat +@@ -1196,6 +1207,7 @@ static int matroska_read_header(AVFormat ebml_free(ebml_syntax, &ebml); return AVERROR_PATCHWELCOME; } @@ -76,7 +76,7 @@ for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) if (!strcmp(ebml.doctype, matroska_doctypes[i])) break; -@@ -1233,14 +1245,17 @@ static int matroska_read_header(AVFormat +@@ -1255,14 +1267,17 @@ static int matroska_read_header(AVFormat "Multiple combined encodings no supported"); } else if (encodings_list->nb_elem == 1) { if (encodings[0].type || @@ -98,7 +98,7 @@ encodings[0].scope = 0; av_log(matroska->ctx, AV_LOG_ERROR, "Unsupported encoding type"); -@@ -1365,11 +1380,13 @@ static int matroska_read_header(AVFormat +@@ -1387,11 +1402,13 @@ static int matroska_read_header(AVFormat st->codec->block_align = track->audio.coded_framesize; track->codec_priv.size = 0; } else { @@ -112,7 +112,7 @@ st->codec->block_align = track->audio.sub_packet_size; extradata_offset = 78; } -@@ -1432,6 +1449,8 @@ static int matroska_read_header(AVFormat +@@ -1454,6 +1471,8 @@ static int matroska_read_header(AVFormat } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->sample_rate = track->audio.out_samplerate; @@ -121,7 +121,7 @@ st->codec->channels = track->audio.channels; if (st->codec->codec_id != CODEC_ID_AAC) st->need_parsing = AVSTREAM_PARSE_HEADERS; -@@ -1711,8 +1730,10 @@ static int matroska_parse_block(Matroska +@@ -1733,8 +1752,10 @@ static int matroska_parse_block(Matroska memcpy(track->audio.buf+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), data+x*sps, sps); if (++track->audio.sub_packet_cnt >= h) { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/12_ogg_seek_to_zero.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/12_ogg_seek_to_zero.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/12_ogg_seek_to_zero.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/12_ogg_seek_to_zero.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,6 +1,6 @@ -diff -rpu -N orig/libavformat/oggdec.c ffmpeg-mt/libavformat/oggdec.c ---- orig/libavformat/oggdec.c 2010-08-11 14:23:16.459001800 -0700 -+++ ffmpeg-mt/libavformat/oggdec.c 2010-08-11 14:23:17.510106900 -0700 +diff -wurp -N orig/libavformat/oggdec.c ffmpeg-mt/libavformat/oggdec.c +--- orig/libavformat/oggdec.c 2010-11-08 15:10:43 -0800 ++++ ffmpeg-mt/libavformat/oggdec.c 2010-11-08 15:10:46 -0800 @@ -596,6 +596,8 @@ ogg_read_timestamp (AVFormatContext * s, ByteIOContext *bc = s->pb; int64_t pts = AV_NOPTS_VALUE; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/14_vp8_encode_options.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/14_vp8_encode_options.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/14_vp8_encode_options.patch 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/14_vp8_encode_options.patch 2011-02-03 22:58:12.000000000 +0000 @@ -0,0 +1,199 @@ +diff -wurp -N orig/ffpresets/libvpx-1080p.ffpreset ffmpeg-mt/ffpresets/libvpx-1080p.ffpreset +--- orig/ffpresets/libvpx-1080p.ffpreset 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/ffpresets/libvpx-1080p.ffpreset 2010-11-08 15:11:28 -0800 +@@ -0,0 +1,13 @@ ++vcodec=libvpx ++g=120 ++rc_lookahead=16 ++level=216 ++profile=1 ++qmax=51 ++qmin=11 ++slices=4 ++vb=2M ++ ++#ignored unless using -pass 2 ++maxrate=24M ++minrate=100k +diff -wurp -N orig/ffpresets/libvpx-1080p50_60.ffpreset ffmpeg-mt/ffpresets/libvpx-1080p50_60.ffpreset +--- orig/ffpresets/libvpx-1080p50_60.ffpreset 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/ffpresets/libvpx-1080p50_60.ffpreset 2010-11-08 15:11:28 -0800 +@@ -0,0 +1,13 @@ ++vcodec=libvpx ++g=120 ++rc_lookahead=25 ++level=216 ++profile=1 ++qmax=51 ++qmin=11 ++slices=4 ++vb=2M ++ ++#ignored unless using -pass 2 ++maxrate=24M ++minrate=100k +diff -wurp -N orig/ffpresets/libvpx-360p.ffpreset ffmpeg-mt/ffpresets/libvpx-360p.ffpreset +--- orig/ffpresets/libvpx-360p.ffpreset 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/ffpresets/libvpx-360p.ffpreset 2010-11-08 15:11:28 -0800 +@@ -0,0 +1,12 @@ ++vcodec=libvpx ++g=120 ++rc_lookahead=16 ++level=216 ++profile=0 ++qmax=63 ++qmin=0 ++vb=768k ++ ++#ignored unless using -pass 2 ++maxrate=1.5M ++minrate=40k +diff -wurp -N orig/ffpresets/libvpx-720p.ffpreset ffmpeg-mt/ffpresets/libvpx-720p.ffpreset +--- orig/ffpresets/libvpx-720p.ffpreset 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/ffpresets/libvpx-720p.ffpreset 2010-11-08 15:11:28 -0800 +@@ -0,0 +1,13 @@ ++vcodec=libvpx ++g=120 ++rc_lookahead=16 ++level=216 ++profile=0 ++qmax=51 ++qmin=11 ++slices=4 ++vb=2M ++ ++#ignored unless using -pass 2 ++maxrate=24M ++minrate=100k +diff -wurp -N orig/ffpresets/libvpx-720p50_60.ffpreset ffmpeg-mt/ffpresets/libvpx-720p50_60.ffpreset +--- orig/ffpresets/libvpx-720p50_60.ffpreset 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/ffpresets/libvpx-720p50_60.ffpreset 2010-11-08 15:11:28 -0800 +@@ -0,0 +1,13 @@ ++vcodec=libvpx ++g=120 ++rc_lookahead=25 ++level=216 ++profile=0 ++qmax=51 ++qmin=11 ++slices=4 ++vb=2M ++ ++#ignored unless using -pass 2 ++maxrate=24M ++minrate=100k +diff -wurp -N orig/libavcodec/avcodec.h ffmpeg-mt/libavcodec/avcodec.h +--- orig/libavcodec/avcodec.h 2010-11-08 15:11:22 -0800 ++++ ffmpeg-mt/libavcodec/avcodec.h 2010-11-08 15:11:28 -0800 +@@ -656,6 +656,7 @@ typedef struct RcOverride{ + #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. + #define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined. + #define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes. ++#define CODEC_FLAG2_ALT_REF 0x00400000 ///< Allow encoder to insert alternate reference frames (VP8 only) + + /* Unsupported options : + * Syntax Arithmetic coding (SAC) +@@ -2805,6 +2806,19 @@ typedef struct AVCodecContext { + * - decoding: Set by libavcodec. + */ + int active_thread_type; ++ ++ /** ++ * Number of token partitions. ++ * Indicates number of sub-streams in the bitstream. Used for parallelized ++ * decoding. ++ * Valid values are 1, 2, 4 & 8 ++ * - encoding: Set by user. ++ * - decoding: unused ++ * ++ * @attention VP8 specific ++ */ ++ int token_partitions; ++ + } AVCodecContext; + + /** +diff -wurp -N orig/libavcodec/libvpxenc.c ffmpeg-mt/libavcodec/libvpxenc.c +--- orig/libavcodec/libvpxenc.c 2010-11-08 15:11:23 -0800 ++++ ffmpeg-mt/libavcodec/libvpxenc.c 2010-11-08 15:11:28 -0800 +@@ -218,11 +218,21 @@ static av_cold int vp8_init(AVCodecConte + } + dump_enc_cfg(avctx, &enccfg); + ++ /* With altref set an additional frame at the same pts may be produced. ++ Increasing the time_base gives the library a window to place these frames ++ ensuring strictly increasing timestamps. */ ++ if (avctx->flags2 & CODEC_FLAG2_ALT_REF) { ++ avctx->ticks_per_frame = 2; ++ avctx->time_base = av_mul_q(avctx->time_base, ++ (AVRational){1, avctx->ticks_per_frame}); ++ } ++ + enccfg.g_w = avctx->width; + enccfg.g_h = avctx->height; + enccfg.g_timebase.num = avctx->time_base.num; + enccfg.g_timebase.den = avctx->time_base.den; + enccfg.g_threads = avctx->thread_count; ++ enccfg.g_lag_in_frames= FFMIN(avctx->rc_lookahead, 25); //0-25, avoids init failure + + if (avctx->flags & CODEC_FLAG_PASS1) + enccfg.g_pass = VPX_RC_FIRST_PASS; +@@ -256,6 +266,7 @@ static av_cold int vp8_init(AVCodecConte + enccfg.rc_buf_initial_sz = + avctx->rc_initial_buffer_occupancy * 1000 / avctx->bit_rate; + enccfg.rc_buf_optimal_sz = enccfg.rc_buf_sz * 5 / 6; ++ enccfg.rc_undershoot_pct = round(avctx->rc_buffer_aggressivity * 100); + + //_enc_init() will balk if kf_min_dist differs from max w/VPX_KF_AUTO + if (avctx->keyint_min == avctx->gop_size) +@@ -291,12 +302,29 @@ static av_cold int vp8_init(AVCodecConte + enccfg.rc_twopass_stats_in = ctx->twopass_stats; + } + +- ctx->deadline = VPX_DL_GOOD_QUALITY; + /* 0-3: For non-zero values the encoder increasingly optimizes for reduced + complexity playback on low powered devices at the expense of encode + quality. */ + if (avctx->profile != FF_PROFILE_UNKNOWN) + enccfg.g_profile = avctx->profile; ++ switch (FFABS(avctx->level) / 100) { ++ case 1: ++ ctx->deadline = VPX_DL_BEST_QUALITY; ++ break; ++ case 2: ++ default: ++ ctx->deadline = VPX_DL_GOOD_QUALITY; ++ break; ++ case 3: ++ ctx->deadline = VPX_DL_REALTIME; ++ break; ++ } ++ av_log(avctx, AV_LOG_DEBUG, "Using deadline: %lu\n", ctx->deadline); ++ ++ if (avctx->level != FF_LEVEL_UNKNOWN) { ++ enccfg.g_error_resilient = avctx->level < 0; ++ cpuused = FFABS(avctx->level) % 100 - 16; //[-16,16] ++ } + + dump_enc_cfg(avctx, &enccfg); + /* Construct Encoder Context */ +@@ -311,6 +339,7 @@ static av_cold int vp8_init(AVCodecConte + codecctl_int(avctx, VP8E_SET_CPUUSED, cpuused); + codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction); + codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices)); ++ codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, !!(avctx->flags2 & CODEC_FLAG2_ALT_REF)); + + //provide dummy value to initialize wrapper, values will be updated each _encode() + vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1, +diff -wurp -N orig/libavcodec/options.c ffmpeg-mt/libavcodec/options.c +--- orig/libavcodec/options.c 2010-11-08 15:11:24 -0800 ++++ ffmpeg-mt/libavcodec/options.c 2010-11-08 15:11:28 -0800 +@@ -430,6 +430,8 @@ static const AVOption options[]={ + {"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_INT, FF_THREAD_SLICE|FF_THREAD_FRAME, 0, INT_MAX, V|E|D, "thread_type"}, + {"slice", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_SLICE, INT_MIN, INT_MAX, V|E|D, "thread_type"}, + {"frame", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_FRAME, INT_MIN, INT_MAX, V|E|D, "thread_type"}, ++{"altref", "enable use of alternate reference frames (VP8/2-pass only)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_ALT_REF, INT_MIN, INT_MAX, V|E, "flags2"}, ++{"token_partitions", "Number of sub-streams in bitstream (1,2,4,8). Used for parallelized decoding.", OFFSET(token_partitions), FF_OPT_TYPE_INT, 1, 1, INT_MAX, V|E}, + {NULL}, + }; + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/15_webp_ffmpeg.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/15_webp_ffmpeg.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/15_webp_ffmpeg.patch 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/15_webp_ffmpeg.patch 2011-02-03 22:58:12.000000000 +0000 @@ -0,0 +1,694 @@ +diff -wurp -N orig/libavformat/Makefile ffmpeg-mt/libavformat/Makefile +--- orig/libavformat/Makefile 2010-11-08 15:11:46 -0800 ++++ ffmpeg-mt/libavformat/Makefile 2010-11-08 15:11:49 -0800 +@@ -284,6 +284,8 @@ OBJS-$(CONFIG_WC3_DEMUXER) + OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ + riff.o isom.o avc.o \ + flacenc_header.o ++OBJS-$(CONFIG_WEBP_DEMUXER) += webpdec.o webp.o ++OBJS-$(CONFIG_WEBP_MUXER) += webpenc.o webp.o + OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o + OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o + OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o +diff -wurp -N orig/libavformat/Makefile~ ffmpeg-mt/libavformat/Makefile~ +--- orig/libavformat/Makefile~ 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/libavformat/Makefile~ 2010-11-08 15:11:49 -0800 +@@ -0,0 +1,327 @@ ++include $(SUBDIR)../config.mak ++ ++NAME = avformat ++FFLIBS = avcodec avcore avutil ++ ++HEADERS = avformat.h avio.h ++ ++OBJS = allformats.o \ ++ cutils.o \ ++ id3v1.o \ ++ id3v2.o \ ++ metadata.o \ ++ metadata_compat.o \ ++ options.o \ ++ os_support.o \ ++ sdp.o \ ++ seek.o \ ++ utils.o \ ++ ++# muxers/demuxers ++OBJS-$(CONFIG_A64_MUXER) += a64.o ++OBJS-$(CONFIG_AAC_DEMUXER) += aacdec.o rawdec.o ++OBJS-$(CONFIG_AC3_DEMUXER) += ac3dec.o rawdec.o ++OBJS-$(CONFIG_AC3_MUXER) += rawenc.o ++OBJS-$(CONFIG_ADTS_MUXER) += adtsenc.o ++OBJS-$(CONFIG_AEA_DEMUXER) += aea.o pcm.o ++OBJS-$(CONFIG_AIFF_DEMUXER) += aiffdec.o riff.o pcm.o ++OBJS-$(CONFIG_AIFF_MUXER) += aiffenc.o riff.o ++OBJS-$(CONFIG_AMR_DEMUXER) += amr.o ++OBJS-$(CONFIG_AMR_MUXER) += amr.o ++OBJS-$(CONFIG_ANM_DEMUXER) += anm.o ++OBJS-$(CONFIG_APC_DEMUXER) += apc.o ++OBJS-$(CONFIG_APE_DEMUXER) += ape.o apetag.o ++OBJS-$(CONFIG_APPLEHTTP_DEMUXER) += applehttp.o ++OBJS-$(CONFIG_ASF_DEMUXER) += asfdec.o asf.o asfcrypt.o \ ++ riff.o avlanguage.o ++OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o riff.o ++OBJS-$(CONFIG_ASS_DEMUXER) += assdec.o ++OBJS-$(CONFIG_ASS_MUXER) += assenc.o ++OBJS-$(CONFIG_AU_DEMUXER) += au.o pcm.o ++OBJS-$(CONFIG_AU_MUXER) += au.o ++OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o riff.o avi.o ++OBJS-$(CONFIG_AVI_MUXER) += avienc.o riff.o avi.o ++OBJS-$(CONFIG_AVISYNTH) += avisynth.o ++OBJS-$(CONFIG_AVM2_MUXER) += swfenc.o ++OBJS-$(CONFIG_AVS_DEMUXER) += avs.o vocdec.o voc.o ++OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o ++OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o ++OBJS-$(CONFIG_BINK_DEMUXER) += bink.o ++OBJS-$(CONFIG_C93_DEMUXER) += c93.o vocdec.o voc.o ++OBJS-$(CONFIG_CAF_DEMUXER) += cafdec.o caf.o mov.o riff.o isom.o ++OBJS-$(CONFIG_CAVSVIDEO_DEMUXER) += cavsvideodec.o rawdec.o ++OBJS-$(CONFIG_CDG_DEMUXER) += cdg.o ++OBJS-$(CONFIG_CRC_MUXER) += crcenc.o ++OBJS-$(CONFIG_DAUD_DEMUXER) += daud.o ++OBJS-$(CONFIG_DAUD_MUXER) += daud.o ++OBJS-$(CONFIG_DIRAC_DEMUXER) += diracdec.o rawdec.o ++OBJS-$(CONFIG_DIRAC_MUXER) += rawenc.o ++OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddec.o rawdec.o ++OBJS-$(CONFIG_DNXHD_MUXER) += rawenc.o ++OBJS-$(CONFIG_DSICIN_DEMUXER) += dsicin.o ++OBJS-$(CONFIG_DTS_DEMUXER) += dtsdec.o rawdec.o ++OBJS-$(CONFIG_DTS_MUXER) += rawenc.o ++OBJS-$(CONFIG_DV_DEMUXER) += dv.o ++OBJS-$(CONFIG_DV_MUXER) += dvenc.o ++OBJS-$(CONFIG_DXA_DEMUXER) += dxa.o riff.o ++OBJS-$(CONFIG_EA_CDATA_DEMUXER) += eacdata.o ++OBJS-$(CONFIG_EA_DEMUXER) += electronicarts.o ++OBJS-$(CONFIG_EAC3_DEMUXER) += ac3dec.o rawdec.o ++OBJS-$(CONFIG_EAC3_MUXER) += rawenc.o ++OBJS-$(CONFIG_FFM_DEMUXER) += ffmdec.o ++OBJS-$(CONFIG_FFM_MUXER) += ffmenc.o ++OBJS-$(CONFIG_FILMSTRIP_DEMUXER) += filmstripdec.o ++OBJS-$(CONFIG_FILMSTRIP_MUXER) += filmstripenc.o ++OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o rawdec.o \ ++ oggparsevorbis.o \ ++ vorbiscomment.o ++OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ ++ vorbiscomment.o ++OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o ++OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o ++OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o ++OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o ++OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o ++OBJS-$(CONFIG_FRAMEMD5_MUXER) += md5enc.o ++OBJS-$(CONFIG_GIF_MUXER) += gif.o ++OBJS-$(CONFIG_GSM_DEMUXER) += rawdec.o ++OBJS-$(CONFIG_GXF_DEMUXER) += gxf.o ++OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o audiointerleave.o ++OBJS-$(CONFIG_G722_DEMUXER) += rawdec.o ++OBJS-$(CONFIG_G722_MUXER) += rawenc.o ++OBJS-$(CONFIG_H261_DEMUXER) += h261dec.o rawdec.o ++OBJS-$(CONFIG_H261_MUXER) += rawenc.o ++OBJS-$(CONFIG_H263_DEMUXER) += h263dec.o rawdec.o ++OBJS-$(CONFIG_H263_MUXER) += rawenc.o ++OBJS-$(CONFIG_H264_DEMUXER) += h264dec.o rawdec.o ++OBJS-$(CONFIG_H264_MUXER) += rawenc.o ++OBJS-$(CONFIG_IDCIN_DEMUXER) += idcin.o ++OBJS-$(CONFIG_IFF_DEMUXER) += iff.o ++OBJS-$(CONFIG_IMAGE2_DEMUXER) += img2.o ++OBJS-$(CONFIG_IMAGE2_MUXER) += img2.o ++OBJS-$(CONFIG_IMAGE2PIPE_DEMUXER) += img2.o ++OBJS-$(CONFIG_IMAGE2PIPE_MUXER) += img2.o ++OBJS-$(CONFIG_INGENIENT_DEMUXER) += ingenientdec.o rawdec.o ++OBJS-$(CONFIG_IPMOVIE_DEMUXER) += ipmovie.o ++OBJS-$(CONFIG_ISS_DEMUXER) += iss.o ++OBJS-$(CONFIG_IV8_DEMUXER) += iv8.o ++OBJS-$(CONFIG_IVF_DEMUXER) += ivfdec.o riff.o ++OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o ++OBJS-$(CONFIG_LXF_DEMUXER) += lxfdec.o ++OBJS-$(CONFIG_M4V_DEMUXER) += m4vdec.o rawdec.o ++OBJS-$(CONFIG_M4V_MUXER) += rawenc.o ++OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \ ++ riff.o isom.o rmdec.o rm.o ++OBJS-$(CONFIG_MATROSKA_MUXER) += matroskaenc.o matroska.o \ ++ riff.o isom.o avc.o \ ++ flacenc_header.o ++OBJS-$(CONFIG_MD5_MUXER) += md5enc.o ++OBJS-$(CONFIG_MJPEG_DEMUXER) += rawdec.o ++OBJS-$(CONFIG_MJPEG_MUXER) += rawenc.o ++OBJS-$(CONFIG_MLP_DEMUXER) += rawdec.o ++OBJS-$(CONFIG_MLP_MUXER) += rawenc.o ++OBJS-$(CONFIG_MM_DEMUXER) += mm.o ++OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o pcm.o ++OBJS-$(CONFIG_MMF_MUXER) += mmf.o riff.o ++OBJS-$(CONFIG_MOV_DEMUXER) += mov.o riff.o isom.o ++OBJS-$(CONFIG_MOV_MUXER) += movenc.o riff.o isom.o avc.o movenchint.o ++OBJS-$(CONFIG_MP2_MUXER) += mp3.o ++OBJS-$(CONFIG_MP3_DEMUXER) += mp3.o ++OBJS-$(CONFIG_MP3_MUXER) += mp3.o ++OBJS-$(CONFIG_MPC_DEMUXER) += mpc.o apetag.o ++OBJS-$(CONFIG_MPC8_DEMUXER) += mpc8.o ++OBJS-$(CONFIG_MPEG1SYSTEM_MUXER) += mpegenc.o ++OBJS-$(CONFIG_MPEG1VCD_MUXER) += mpegenc.o ++OBJS-$(CONFIG_MPEG2DVD_MUXER) += mpegenc.o ++OBJS-$(CONFIG_MPEG2VOB_MUXER) += mpegenc.o ++OBJS-$(CONFIG_MPEG2SVCD_MUXER) += mpegenc.o ++OBJS-$(CONFIG_MPEG1VIDEO_MUXER) += rawenc.o ++OBJS-$(CONFIG_MPEG2VIDEO_MUXER) += rawenc.o ++OBJS-$(CONFIG_MPEGPS_DEMUXER) += mpeg.o ++OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpegts.o ++OBJS-$(CONFIG_MPEGTS_MUXER) += mpegtsenc.o adtsenc.o ++OBJS-$(CONFIG_MPEGVIDEO_DEMUXER) += mpegvideodec.o rawdec.o ++OBJS-$(CONFIG_MPJPEG_MUXER) += mpjpeg.o ++OBJS-$(CONFIG_MSNWC_TCP_DEMUXER) += msnwc_tcp.o ++OBJS-$(CONFIG_MTV_DEMUXER) += mtv.o ++OBJS-$(CONFIG_MVI_DEMUXER) += mvi.o ++OBJS-$(CONFIG_MXF_DEMUXER) += mxfdec.o mxf.o ++OBJS-$(CONFIG_MXF_MUXER) += mxfenc.o mxf.o audiointerleave.o ++OBJS-$(CONFIG_NC_DEMUXER) += ncdec.o ++OBJS-$(CONFIG_NSV_DEMUXER) += nsvdec.o ++OBJS-$(CONFIG_NULL_MUXER) += nullenc.o ++OBJS-$(CONFIG_NUT_DEMUXER) += nutdec.o nut.o riff.o ++OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o riff.o ++OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o riff.o ++OBJS-$(CONFIG_FLAC_DECODER) += oggparseflac.o ++OBJS-$(CONFIG_DIRAC_DEMUXER) += oggparsedirac.o ++OBJS-$(CONFIG_LIBSPEEX) += oggparsespeex.o ++OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \ ++ oggparseogm.o \ ++ oggparseskeleton.o \ ++ oggparsetheora.o \ ++ oggparsevorbis.o \ ++ riff.o \ ++ vorbiscomment.o ++OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \ ++ vorbiscomment.o ++OBJS-$(CONFIG_OMA_DEMUXER) += oma.o pcm.o ++OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_ALAW_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_F32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_F32BE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_F32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_F32LE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_F64BE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_F64BE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_F64LE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_F64LE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_MULAW_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_MULAW_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_S16BE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_S16BE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_S16LE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_S16LE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_S24BE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_S24BE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_S24LE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_S24LE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_S32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_S32BE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_S32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_S32LE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_S8_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_S8_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_U16BE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_U16BE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_U16LE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_U16LE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_U24BE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_U24BE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_U24LE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_U24LE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_U32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_U32BE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_U32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_U32LE_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PCM_U8_DEMUXER) += pcmdec.o pcm.o rawdec.o ++OBJS-$(CONFIG_PCM_U8_MUXER) += pcmenc.o rawenc.o ++OBJS-$(CONFIG_PVA_DEMUXER) += pva.o ++OBJS-$(CONFIG_QCP_DEMUXER) += qcp.o ++OBJS-$(CONFIG_R3D_DEMUXER) += r3d.o ++OBJS-$(CONFIG_RAWVIDEO_DEMUXER) += rawvideodec.o rawdec.o ++OBJS-$(CONFIG_RAWVIDEO_MUXER) += rawenc.o ++OBJS-$(CONFIG_RL2_DEMUXER) += rl2.o ++OBJS-$(CONFIG_RM_DEMUXER) += rmdec.o rm.o ++OBJS-$(CONFIG_RM_MUXER) += rmenc.o rm.o ++OBJS-$(CONFIG_ROQ_DEMUXER) += idroqdec.o ++OBJS-$(CONFIG_ROQ_MUXER) += idroqenc.o rawenc.o ++OBJS-$(CONFIG_RSO_DEMUXER) += rsodec.o rso.o pcm.o ++OBJS-$(CONFIG_RSO_MUXER) += rsoenc.o rso.o ++OBJS-$(CONFIG_RPL_DEMUXER) += rpl.o ++OBJS-$(CONFIG_RTP_MUXER) += rtp.o \ ++ rtpenc_aac.o \ ++ rtpenc_amr.o \ ++ rtpenc_h263.o \ ++ rtpenc_mpv.o \ ++ rtpenc.o \ ++ rtpenc_h264.o \ ++ rtpenc_vp8.o \ ++ rtpenc_xiph.o \ ++ avc.o ++OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o httpauth.o ++OBJS-$(CONFIG_RTSP_MUXER) += rtsp.o rtspenc.o httpauth.o ++OBJS-$(CONFIG_SAP_MUXER) += sapenc.o rtpenc_chain.o ++OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o \ ++ rdt.o \ ++ rtp.o \ ++ rtpdec.o \ ++ rtpdec_amr.o \ ++ rtpdec_asf.o \ ++ rtpdec_h263.o \ ++ rtpdec_h264.o \ ++ rtpdec_latm.o \ ++ rtpdec_mpeg4.o \ ++ rtpdec_qdm2.o \ ++ rtpdec_qt.o \ ++ rtpdec_svq3.o \ ++ rtpdec_vp8.o \ ++ rtpdec_xiph.o \ ++ rtpenc_chain.o ++OBJS-$(CONFIG_SEGAFILM_DEMUXER) += segafilm.o ++OBJS-$(CONFIG_SHORTEN_DEMUXER) += rawdec.o ++OBJS-$(CONFIG_SIFF_DEMUXER) += siff.o ++OBJS-$(CONFIG_SMACKER_DEMUXER) += smacker.o ++OBJS-$(CONFIG_SOL_DEMUXER) += sol.o pcm.o ++OBJS-$(CONFIG_SOX_DEMUXER) += soxdec.o pcm.o ++OBJS-$(CONFIG_SOX_MUXER) += soxenc.o ++OBJS-$(CONFIG_SPDIF_MUXER) += spdif.o ++OBJS-$(CONFIG_SRT_DEMUXER) += srtdec.o ++OBJS-$(CONFIG_SRT_MUXER) += rawenc.o ++OBJS-$(CONFIG_STR_DEMUXER) += psxstr.o ++OBJS-$(CONFIG_SWF_DEMUXER) += swfdec.o ++OBJS-$(CONFIG_SWF_MUXER) += swfenc.o ++OBJS-$(CONFIG_THP_DEMUXER) += thp.o ++OBJS-$(CONFIG_TIERTEXSEQ_DEMUXER) += tiertexseq.o ++OBJS-$(CONFIG_TMV_DEMUXER) += tmv.o ++OBJS-$(CONFIG_TRUEHD_DEMUXER) += rawdec.o ++OBJS-$(CONFIG_TRUEHD_MUXER) += rawenc.o ++OBJS-$(CONFIG_TTA_DEMUXER) += tta.o ++OBJS-$(CONFIG_TTY_DEMUXER) += tty.o sauce.o ++OBJS-$(CONFIG_TXD_DEMUXER) += txd.o ++OBJS-$(CONFIG_VC1_DEMUXER) += rawdec.o ++OBJS-$(CONFIG_VC1T_DEMUXER) += vc1test.o ++OBJS-$(CONFIG_VC1T_MUXER) += vc1testenc.o ++OBJS-$(CONFIG_VMD_DEMUXER) += sierravmd.o ++OBJS-$(CONFIG_VOC_DEMUXER) += vocdec.o voc.o ++OBJS-$(CONFIG_VOC_MUXER) += vocenc.o voc.o ++OBJS-$(CONFIG_VQF_DEMUXER) += vqf.o ++OBJS-$(CONFIG_W64_DEMUXER) += wav.o riff.o pcm.o ++OBJS-$(CONFIG_WAV_DEMUXER) += wav.o riff.o pcm.o ++OBJS-$(CONFIG_WAV_MUXER) += wav.o riff.o ++OBJS-$(CONFIG_WC3_DEMUXER) += wc3movie.o ++OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ ++ riff.o isom.o avc.o \ ++ flacenc_header.o ++OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o ++OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o ++OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o ++OBJS-$(CONFIG_XA_DEMUXER) += xa.o ++OBJS-$(CONFIG_YOP_DEMUXER) += yop.o ++OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg.o ++OBJS-$(CONFIG_YUV4MPEGPIPE_DEMUXER) += yuv4mpeg.o ++ ++# external libraries ++OBJS-$(CONFIG_LIBNUT_DEMUXER) += libnut.o riff.o ++OBJS-$(CONFIG_LIBNUT_MUXER) += libnut.o riff.o ++ ++# protocols I/O ++OBJS+= avio.o aviobuf.o ++ ++OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o ++OBJS-$(CONFIG_FILE_PROTOCOL) += file.o ++OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o ++OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o ++OBJS-$(CONFIG_MMSH_PROTOCOL) += mmsh.o mms.o asf.o ++OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o mms.o asf.o ++OBJS-$(CONFIG_MD5_PROTOCOL) += md5proto.o ++OBJS-$(CONFIG_PIPE_PROTOCOL) += file.o ++ ++# external or internal rtmp ++RTMP-OBJS-$(CONFIG_LIBRTMP) = librtmp.o ++RTMP-OBJS-$(!CONFIG_LIBRTMP) = rtmpproto.o rtmppkt.o ++OBJS-$(CONFIG_RTMP_PROTOCOL) += $(RTMP-OBJS-yes) ++ ++OBJS-$(CONFIG_RTP_PROTOCOL) += rtpproto.o ++OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o ++OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o ++ ++# libavdevice dependencies ++OBJS-$(CONFIG_JACK_INDEV) += timefilter.o ++ ++EXAMPLES = output ++TESTPROGS = timefilter ++ ++include $(SUBDIR)../subdir.mak ++ ++$(SUBDIR)output-example$(EXESUF): ELIBS = -lswscale +diff -wurp -N orig/libavformat/allformats.c ffmpeg-mt/libavformat/allformats.c +--- orig/libavformat/allformats.c 2010-11-08 15:11:46 -0800 ++++ ffmpeg-mt/libavformat/allformats.c 2010-11-08 15:11:49 -0800 +@@ -215,6 +215,7 @@ void av_register_all(void) + REGISTER_MUXDEMUX (WAV, wav); + REGISTER_DEMUXER (WC3, wc3); + REGISTER_MUXER (WEBM, webm); ++ REGISTER_MUXDEMUX (WEBP, webp); + REGISTER_DEMUXER (WSAUD, wsaud); + REGISTER_DEMUXER (WSVQA, wsvqa); + REGISTER_DEMUXER (WV, wv); +diff -wurp -N orig/libavformat/webp.c ffmpeg-mt/libavformat/webp.c +--- orig/libavformat/webp.c 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/libavformat/webp.c 2010-11-08 15:11:49 -0800 +@@ -0,0 +1,34 @@ ++/* ++ * Copyright (c) 2010, Google, Inc. ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++/* ++ * @file ++ * common code for WebP muxer/demuxer ++ */ ++ ++#include "webp.h" ++ ++const AVMetadataConv ff_webp_metadata_conv[] = { ++ { "IART", "artist" }, ++ { "ICOP", "copyright" }, ++ { "INAM", "title" }, ++ { "ICMT", "comment" }, ++ { 0 } ++}; +diff -wurp -N orig/libavformat/webp.h ffmpeg-mt/libavformat/webp.h +--- orig/libavformat/webp.h 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/libavformat/webp.h 2010-11-08 15:11:49 -0800 +@@ -0,0 +1,35 @@ ++/* ++ * Copyright (c) 2010, Google, Inc. ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++/* ++ * @file ++ * common header for WebP muxer/demuxer ++ */ ++ ++#ifndef AVFORMAT_WEBP_H ++#define AVFORMAT_WEBP_H ++ ++#include "avformat.h" ++#include "riff.h" ++#include "metadata.h" ++ ++extern const AVMetadataConv ff_webp_metadata_conv[]; ++ ++#endif /* AVFORMAT_WEBP_H */ +diff -wurp -N orig/libavformat/webpdec.c ffmpeg-mt/libavformat/webpdec.c +--- orig/libavformat/webpdec.c 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/libavformat/webpdec.c 2010-11-08 15:11:49 -0800 +@@ -0,0 +1,132 @@ ++/* ++ * Copyright (c) 2010, Google, Inc. ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++/* ++ * @file ++ * WebP demuxer ++ * http://code.google.com/p/webp ++ * ++ * supports metadata: artist, copyright, title, comment ++ * Encoding/decoding examples: ++ * ffmpeg -i my_image ++ * -metadata artist=me -metadata title="sunset" ++ * -metadata copyright=2010 -metadata comment="nice pic!" ++ * -profile 1 -qmin 5 my_image.webp ++ * ffmpeg -i my_image.webp -y my_image.png ++ */ ++ ++#include "webp.h" ++#include "libavutil/intreadwrite.h" ++ ++static const AVCodecTag webp_codec_tags[] = { ++ { CODEC_ID_VP8, MKTAG('V', 'P', '8', ' ') }, ++ { CODEC_ID_NONE, 0 } ++}; ++ ++static int probe(AVProbeData *p) ++{ ++ if (!memcmp(p->buf, "RIFF", 4) && !memcmp(p->buf + 8, "WEBP", 4)) ++ return AVPROBE_SCORE_MAX; ++ ++ return 0; ++} ++ ++static int read_header(AVFormatContext *s, AVFormatParameters *ap) ++{ ++ AVStream *st; ++ uint32_t riff_size; ++ ++ if (get_le32(s->pb) != AV_RL32("RIFF")) ++ return AVERROR(EINVAL); ++ riff_size = get_le32(s->pb); ++ if (get_le32(s->pb) != AV_RL32("WEBP")) ++ return AVERROR(EINVAL); ++ ++ st = av_new_stream(s, 0); ++ if (!st) ++ return AVERROR(ENOMEM); ++ ++ st->codec->codec_type = AVMEDIA_TYPE_VIDEO; ++ st->codec->codec_tag = AV_RL32("VP8 "); ++ st->codec->codec_id = ff_codec_get_id(webp_codec_tags, ++ st->codec->codec_tag); ++ av_set_pts_info(st, 24, 1, 1000); ++ ++ return 0; ++} ++ ++static int set_metadata(ByteIOContext* pb, AVMetadata** metadata, ++ const char* generic_key, uint32_t size) ++{ ++ char* const value = av_malloc(size + 1); ++ if (!value) ++ return AVERROR(ENOMEM); ++ if (get_buffer(pb, value, size) < 0) ++ return AVERROR(EINVAL); ++ value[size] = 0; ++ if (av_metadata_set2(metadata, generic_key, value, 0)) ++ return AVERROR(EINVAL); ++ av_free(value); ++ return size; ++} ++ ++static int read_packet(AVFormatContext *s, AVPacket *pkt) ++{ ++ int ret = -1; ++ AVStream *stream = s->streams[pkt->stream_index]; ++ uint32_t tag = get_le32(s->pb); ++ uint32_t chunk_size = get_le32(s->pb); ++ if (tag == stream->codec->codec_tag) { ++ ret = av_get_packet(s->pb, pkt, chunk_size); ++ pkt->flags |= AV_PKT_FLAG_KEY; ++ } ++ else { ++ int i; ++ for (i = 0; ff_webp_metadata_conv[i].native; ++i) { ++ const char* native_tag = ff_webp_metadata_conv[i].native; ++ if (tag == AV_RL32(native_tag)) { ++ ret = set_metadata(s->pb, &stream->metadata, ++ ff_webp_metadata_conv[i].generic, ++ chunk_size); ++ break; ++ } ++ } ++ } ++ return ret; ++} ++ ++static int read_close(struct AVFormatContext *s) ++{ ++ return 0; ++} ++ ++AVInputFormat webp_demuxer = { ++ .name = "webp", ++ .long_name = NULL_IF_CONFIG_SMALL("WebP"), ++ .priv_data_size = 0, ++ .read_probe = probe, ++ .read_header = read_header, ++ .read_packet = read_packet, ++ .read_close = read_close, ++ .flags = AVFMT_GENERIC_INDEX, ++ .extensions = "webp", ++ .value = CODEC_ID_VP8, ++ .codec_tag = (const AVCodecTag*[]){webp_codec_tags, 0}, ++}; +diff -wurp -N orig/libavformat/webpenc.c ffmpeg-mt/libavformat/webpenc.c +--- orig/libavformat/webpenc.c 1969-12-31 16:00:00 -0800 ++++ ffmpeg-mt/libavformat/webpenc.c 2010-11-08 15:11:49 -0800 +@@ -0,0 +1,123 @@ ++/* ++ * Copyright (c) 2010, Google, Inc. ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++/* ++ * @file ++ * WebP muxer ++ * http://code.google.com/p/webp ++ * ++ * supports metadata: artist, copyright, title, comment ++ * Encoding/decoding examples: ++ * ffmpeg -i my_image ++ * -metadata artist=me -metadata title="sunset" ++ * -metadata copyright=2010 -metadata comment="nice pic!" ++ * -profile 1 -qmin 5 my_image.webp ++ * ffmpeg -i my_image.webp -y my_image.png ++ */ ++ ++#include "webp.h" ++ ++typedef struct { ++ uint64_t riff_start; ++} WEBPContext; ++ ++static int write_header(AVFormatContext *s) ++{ ++ ByteIOContext *pb = s->pb; ++ WEBPContext *webp = s->priv_data; ++ AVStream *stream; ++ AVCodecContext *codec; ++ ++ if (s->nb_streams != 1) { ++ av_log(s, AV_LOG_ERROR, "muxer only support 1 video stream."); ++ return AVERROR(EINVAL); ++ } ++ stream = s->streams[0]; ++ codec = stream->codec; ++ if (codec->codec_type != AVMEDIA_TYPE_VIDEO) ++ return AVERROR(EINVAL); ++ if (codec->codec_id != CODEC_ID_VP8) ++ return AVERROR(EINVAL); ++ ++ webp->riff_start = ff_start_tag(pb, "RIFF"); ++ put_tag(pb, "WEBP"); ++ return 0; ++} ++ ++static int write_packet(AVFormatContext *s, AVPacket *pkt) ++{ ++ AVStream *stream = s->streams[pkt->stream_index]; ++ AVCodecContext *codec = stream->codec; ++ ByteIOContext *pb = s->pb; ++ uint64_t vp8_start; ++ ++ if (codec->codec_id != CODEC_ID_VP8) { ++ av_log(s, AV_LOG_ERROR, "muxer only supports VP8 codec."); ++ return AVERROR(EINVAL); ++ } ++ vp8_start = ff_start_tag(pb, "VP8 "); ++ put_buffer(pb, pkt->data, pkt->size); ++ if (pkt->size & 1) put_byte(pb, 0); // pad ++ ff_end_tag(pb, vp8_start); ++ put_flush_packet(pb); ++ return 0; ++} ++ ++static void put_metadata(AVFormatContext *s, ++ const AVMetadataConv* metadata) ++{ ++ ByteIOContext *pb = s->pb; ++ AVMetadataTag *t; ++ uint64_t pos; ++ int len; ++ t = av_metadata_get(s->metadata, metadata->generic, NULL, 0); ++ if (!t) return; ++ pos = ff_start_tag(pb, metadata->native); ++ len = strlen(t->value) + 1; ++ put_buffer(pb, t->value, len); ++ if (len & 1) put_byte(pb, 0); // pad ++ ff_end_tag(pb, pos); ++} ++ ++static int write_trailer(AVFormatContext *s) ++{ ++ ByteIOContext *pb = s->pb; ++ WEBPContext *webp = s->priv_data; ++ int i; ++ for (i = 0; ff_webp_metadata_conv[i].native; ++i) { ++ put_metadata(s, &ff_webp_metadata_conv[i]); ++ } ++ ff_end_tag(pb, webp->riff_start); ++ put_flush_packet(pb); ++ return 0; ++} ++ ++AVOutputFormat webp_muxer = { ++ .name = "webp", ++ .long_name = NULL_IF_CONFIG_SMALL("WebP"), ++ .mime_type = "image/webp", ++ .extensions = "webp", ++ .priv_data_size = sizeof(WEBPContext), ++ .audio_codec = CODEC_ID_NONE, ++ .video_codec = CODEC_ID_VP8, ++ .write_header = write_header, ++ .write_packet = write_packet, ++ .write_trailer = write_trailer, ++}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/16_neon_offsets.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/16_neon_offsets.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/16_neon_offsets.patch 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/16_neon_offsets.patch 2011-02-03 22:58:12.000000000 +0000 @@ -0,0 +1,22 @@ +diff -wurp -N orig/libavcodec/arm/asm-offsets.h ffmpeg-mt/libavcodec/arm/asm-offsets.h +--- orig/libavcodec/arm/asm-offsets.h 2010-11-08 15:12:06 -0800 ++++ ffmpeg-mt/libavcodec/arm/asm-offsets.h 2010-11-08 15:12:12 -0800 +@@ -30,12 +30,12 @@ + + /* MpegEncContext */ + #if defined(__ARM_EABI__) || defined(__eabi__) +-#define Y_DC_SCALE 0xa54 +-#define C_DC_SCALE 0xa58 +-#define AC_PRED 0xa80 +-#define BLOCK_LAST_INDEX 0x2160 +-#define INTER_SCANTAB_RASTER_END 0x2360 +-#define H263_AIC 0x2610 ++#define Y_DC_SCALE (0xa54+72) ++#define C_DC_SCALE (0xa58+72) ++#define AC_PRED (0xa80+72) ++#define BLOCK_LAST_INDEX (0x2160+72) ++#define INTER_SCANTAB_RASTER_END (0x2360+72) ++#define H263_AIC (0x2610+80) + #elif defined(__APPLE__) + #define Y_DC_SCALE 0xa30 + #define C_DC_SCALE 0xa34 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/17_mpegthread.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/17_mpegthread.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/17_mpegthread.patch 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/17_mpegthread.patch 2011-02-03 22:58:12.000000000 +0000 @@ -0,0 +1,25 @@ +diff -wurp -N orig/libavcodec/mpegvideo.c ffmpeg-mt/libavcodec/mpegvideo.c +--- orig/libavcodec/mpegvideo.c 2010-11-08 15:12:29 -0800 ++++ ffmpeg-mt/libavcodec/mpegvideo.c 2010-11-08 15:12:33 -0800 +@@ -584,8 +584,7 @@ av_cold int MPV_common_init(MpegEncConte + return -1; + } + +- if(s->avctx->active_thread_type&FF_THREAD_SLICE && +- (s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height))){ ++ if(s->avctx->thread_count > MAX_THREADS){ + av_log(s->avctx, AV_LOG_ERROR, "too many threads\n"); + return -1; + } +@@ -745,6 +744,11 @@ av_cold int MPV_common_init(MpegEncConte + if (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE) { + threads = s->avctx->thread_count; + ++ if (s->avctx->thread_count > s->mb_height && s->mb_height) { ++ av_log(s->avctx, AV_LOG_WARNING, "Reducing from %d to %d threads due to height of %d pixels.\n", s->avctx->thread_count, s->mb_height, s->height); ++ threads = s->mb_height; ++ } ++ + for(i=1; ithread_context[i]= av_malloc(sizeof(MpegEncContext)); + memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/18_respect_swscale.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/18_respect_swscale.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/to_upstream/18_respect_swscale.patch 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/to_upstream/18_respect_swscale.patch 2011-02-03 22:58:12.000000000 +0000 @@ -0,0 +1,64 @@ +diff -wurp -N orig/cmdutils.c ffmpeg-mt/cmdutils.c +--- orig/cmdutils.c 2010-11-08 15:12:49 -0800 ++++ ffmpeg-mt/cmdutils.c 2010-11-08 15:12:57 -0800 +@@ -32,7 +32,9 @@ + #include "libavformat/avformat.h" + #include "libavfilter/avfilter.h" + #include "libavdevice/avdevice.h" ++#if CONFIG_SWSCALE + #include "libswscale/swscale.h" ++#endif + #include "libpostproc/postprocess.h" + #include "libavutil/avstring.h" + #include "libavutil/pixdesc.h" +@@ -53,7 +55,9 @@ const char **opt_values; + static int opt_name_count; + AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; + AVFormatContext *avformat_opts; ++#if CONFIG_SWSCALE + struct SwsContext *sws_opts; ++#endif + + const int this_year = 2010; + +@@ -63,7 +67,9 @@ void init_opts(void) + for (i = 0; i < AVMEDIA_TYPE_NB; i++) + avcodec_opts[i] = avcodec_alloc_context2(i); + avformat_opts = avformat_alloc_context(); ++#if CONFIG_SWSCALE + sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, NULL, NULL, NULL); ++#endif + } + + void uninit_opts(void) +@@ -73,7 +79,9 @@ void uninit_opts(void) + av_freep(&avcodec_opts[i]); + av_freep(&avformat_opts->key); + av_freep(&avformat_opts); ++#if CONFIG_SWSCALE + av_freep(&sws_opts); ++#endif + } + + void log_callback_help(void* ptr, int level, const char* fmt, va_list vl) +@@ -225,8 +233,10 @@ int opt_default(const char *opt, const c + } + if(!o && avformat_opts) + ret = av_set_string3(avformat_opts, opt, arg, 1, &o); ++#if CONFIG_SWSCALE + if(!o && sws_opts) + ret = av_set_string3(sws_opts, opt, arg, 1, &o); ++#endif + if(!o){ + if(opt[0] == 'a') + ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_AUDIO], opt+1, arg, 1, &o); +@@ -390,7 +400,9 @@ static void print_all_libs_info(FILE* ou + PRINT_LIB_INFO(outstream, avformat, AVFORMAT, flags); + PRINT_LIB_INFO(outstream, avdevice, AVDEVICE, flags); + PRINT_LIB_INFO(outstream, avfilter, AVFILTER, flags); ++#if CONFIG_SWSCALE + PRINT_LIB_INFO(outstream, swscale, SWSCALE, flags); ++#endif + PRINT_LIB_INFO(outstream, postproc, POSTPROC, flags); + } + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/07_get_bits_overrun.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/07_get_bits_overrun.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/07_get_bits_overrun.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/07_get_bits_overrun.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,6 +1,6 @@ -diff -rpu -N orig/libavcodec/get_bits.h ffmpeg-mt/libavcodec/get_bits.h ---- orig/libavcodec/get_bits.h 2010-08-11 14:22:49.144270600 -0700 -+++ ffmpeg-mt/libavcodec/get_bits.h 2010-08-11 14:22:50.934449600 -0700 +diff -wurp -N orig/libavcodec/get_bits.h ffmpeg-mt/libavcodec/get_bits.h +--- orig/libavcodec/get_bits.h 2010-11-08 15:08:51 -0800 ++++ ffmpeg-mt/libavcodec/get_bits.h 2010-11-08 15:08:56 -0800 @@ -53,13 +53,21 @@ /* buffer, buffer_end and size_in_bits must be present and used by every reader */ typedef struct GetBitContext { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/08_enforce_theora_oob.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/08_enforce_theora_oob.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/08_enforce_theora_oob.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/08_enforce_theora_oob.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,6 +1,6 @@ -diff -rpu -N orig/libavcodec/vp3.c ffmpeg-mt/libavcodec/vp3.c ---- orig/libavcodec/vp3.c 2010-08-11 14:22:54.820838200 -0700 -+++ ffmpeg-mt/libavcodec/vp3.c 2010-08-11 14:22:56.210977200 -0700 +diff -wurp -N orig/libavcodec/vp3.c ffmpeg-mt/libavcodec/vp3.c +--- orig/libavcodec/vp3.c 2010-11-08 15:09:15 -0800 ++++ ffmpeg-mt/libavcodec/vp3.c 2010-11-08 15:09:18 -0800 @@ -869,6 +869,11 @@ static int unpack_vlcs(Vp3DecodeContext int num_coeffs = s->num_coded_frags[plane][coeff_index]; int16_t *dct_tokens = s->dct_tokens[plane][coeff_index]; @@ -25,7 +25,7 @@ return 0; } -@@ -1845,6 +1855,7 @@ static int vp3_decode_frame(AVCodecConte +@@ -1846,6 +1856,7 @@ static int vp3_decode_frame(AVCodecConte int i; init_get_bits(&gb, buf, buf_size * 8); @@ -33,7 +33,7 @@ if (s->theora && get_bits1(&gb)) { -@@ -2289,6 +2300,7 @@ static av_cold int theora_decode_init(AV +@@ -2291,6 +2302,7 @@ static av_cold int theora_decode_init(AV for(i=0;i<3;i++) { init_get_bits(&gb, header_start[i], header_len[i] * 8); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/09_enforce_vorbis_oob_divzero.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/09_enforce_vorbis_oob_divzero.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/09_enforce_vorbis_oob_divzero.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/09_enforce_vorbis_oob_divzero.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,6 +1,6 @@ -diff -rpu -N orig/libavcodec/vorbis_dec.c ffmpeg-mt/libavcodec/vorbis_dec.c ---- orig/libavcodec/vorbis_dec.c 2010-08-11 14:23:00.111367200 -0700 -+++ ffmpeg-mt/libavcodec/vorbis_dec.c 2010-08-11 14:23:01.634519500 -0700 +diff -wurp -N orig/libavcodec/vorbis_dec.c ffmpeg-mt/libavcodec/vorbis_dec.c +--- orig/libavcodec/vorbis_dec.c 2010-11-08 15:09:36 -0800 ++++ ffmpeg-mt/libavcodec/vorbis_dec.c 2010-11-08 15:09:39 -0800 @@ -974,6 +974,7 @@ static av_cold int vorbis_decode_init(AV } @@ -17,7 +17,7 @@ hdr_type = get_bits(gb, 8); if (hdr_type != 5) { av_log(avccontext, AV_LOG_ERROR, "Third header is not the setup header.\n"); -@@ -1207,7 +1209,7 @@ static uint_fast8_t vorbis_floor1_decode +@@ -1210,7 +1212,7 @@ static int vorbis_floor1_decode(vorbis_c adx = vf->list[high_neigh_offs].x - vf->list[low_neigh_offs].x; ady = FFABS(dy); err = ady * (vf->list[i].x - vf->list[low_neigh_offs].x); @@ -26,7 +26,7 @@ if (dy < 0) { predicted = floor1_Y_final[low_neigh_offs] - off; } else { -@@ -1293,7 +1295,7 @@ static av_always_inline int vorbis_resid +@@ -1296,7 +1298,7 @@ static av_always_inline int vorbis_resid uint_fast16_t j_times_ptns_to_read; voffset = vr->begin; @@ -35,7 +35,7 @@ if (!pass) { uint_fast32_t inverse_class = ff_inverse[vr->classifications]; for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) { -@@ -1613,6 +1615,7 @@ static int vorbis_decode_frame(AVCodecCo +@@ -1623,6 +1625,7 @@ static int vorbis_decode_frame(AVCodecCo AV_DEBUG("packet length %d \n", buf_size); init_get_bits(gb, buf, buf_size*8); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/10_aac_oob_read.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/10_aac_oob_read.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/10_aac_oob_read.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/10_aac_oob_read.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,32 +1,32 @@ -diff -rpu -N orig/libavcodec/aacdec.c ffmpeg-mt/libavcodec/aacdec.c ---- orig/libavcodec/aacdec.c 2010-08-11 14:23:04.537809800 -0700 -+++ ffmpeg-mt/libavcodec/aacdec.c 2010-08-11 14:23:06.572013200 -0700 -@@ -466,6 +466,7 @@ static int decode_audio_specific_config( +diff -wurp -N orig/libavcodec/aacdec.c ffmpeg-mt/libavcodec/aacdec.c +--- orig/libavcodec/aacdec.c 2010-11-09 08:43:11 -0800 ++++ ffmpeg-mt/libavcodec/aacdec.c 2010-11-09 08:49:22 -0800 +@@ -462,6 +462,7 @@ static int decode_audio_specific_config( int i; init_get_bits(&gb, data, data_size * 8); + gb.buffer_enforcing = 1; - if ((i = ff_mpeg4audio_get_config(&ac->m4ac, data, data_size)) < 0) + if ((i = ff_mpeg4audio_get_config(m4ac, data, data_size)) < 0) return -1; -@@ -1952,6 +1953,7 @@ static int aac_decode_frame(AVCodecConte - int buf_offset; - - init_get_bits(&gb, buf, buf_size * 8); -+ gb.buffer_enforcing = 1; - - if (show_bits(&gb, 12) == 0xfff) { - if (parse_adts_frame_header(ac, &gb) < 0) { -@@ -1967,6 +1969,12 @@ static int aac_decode_frame(AVCodecConte - memset(ac->tags_seen_this_frame, 0, sizeof(ac->tags_seen_this_frame)); +@@ -1959,6 +1960,12 @@ static int aac_decode_frame_int(AVCodecC + ac->tags_mapped = 0; // parse - while ((elem_type = get_bits(&gb, 3)) != TYPE_END) { + while ((elem_type = get_bits(gb, 3)) != TYPE_END) { +#ifdef ALT_BITSTREAM_READER -+ if (gb.buffer_exhausted) { -+ av_log(ac->avctx, AV_LOG_ERROR, "out of bounds read: index, size: %d, %d\n", gb.index, gb.size_in_bits); ++ if (gb->buffer_exhausted) { ++ av_log(ac->avctx, AV_LOG_ERROR, "out of bounds read: index, size: %d, %d\n", gb->index, gb->size_in_bits); + return -1; + } +#endif - elem_id = get_bits(&gb, 4); + elem_id = get_bits(gb, 4); if (elem_type < TYPE_DSE) { +@@ -2072,6 +2079,7 @@ static int aac_decode_frame(AVCodecConte + int err; + + init_get_bits(&gb, buf, buf_size * 8); ++ gb.buffer_enforcing = 1; + + if ((err = aac_decode_frame_int(avctx, data, data_size, &gb)) < 0) + return err; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/13_remove_avcore.patch chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/13_remove_avcore.patch --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/patches/ugly/13_remove_avcore.patch 2010-08-18 02:00:46.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/patches/ugly/13_remove_avcore.patch 2011-02-03 22:58:12.000000000 +0000 @@ -1,6 +1,6 @@ -diff -rpu -N orig/libavcodec/Makefile ffmpeg-mt/libavcodec/Makefile ---- orig/libavcodec/Makefile 2010-08-17 09:19:42.159858300 -0700 -+++ ffmpeg-mt/libavcodec/Makefile 2010-08-17 09:20:14.390858300 -0700 +diff -wurp -N orig/libavcodec/Makefile ffmpeg-mt/libavcodec/Makefile +--- orig/libavcodec/Makefile 2010-11-08 18:12:22 -0800 ++++ ffmpeg-mt/libavcodec/Makefile 2010-11-08 18:08:39 -0800 @@ -1,7 +1,9 @@ include $(SUBDIR)../config.mak @@ -12,12 +12,13 @@ HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h xvmc.h -@@ -22,6 +24,8 @@ OBJS = allcodecs.o +@@ -22,6 +24,9 @@ OBJS = allcodecs.o resample2.o \ simple_idct.o \ utils.o \ + ../libavcore/imgutils.o \ -+ ../libavcore/parseutils.o ++ ../libavcore/parseutils.o \ ++ ../libavcore/samplefmt.o # parts needed for many different codecs OBJS-$(CONFIG_AANDCT) += aandcttab.o diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/common.gypi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/common.gypi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/common.gypi 2010-09-10 02:00:32.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/common.gypi 2011-02-03 22:58:28.000000000 +0000 @@ -73,16 +73,34 @@ 'library%': 'static_library', }, - # Set default value of toolkit_views on for Windows, Chrome OS - # and the touch UI. - # We set it at this level of nesting so the value is available for + # We set those at this level of nesting so the values are available for # other conditionals below. 'conditions': [ + # Set default value of toolkit_views on for Windows, Chrome OS + # and the touch UI. ['OS=="win" or chromeos==1 or touchui==1', { 'toolkit_views%': 1, }, { 'toolkit_views%': 0, }], + + # A flag to enable or disable our compile-time dependency + # on gnome-keyring. If that dependency is disabled, no gnome-keyring + # support will be available. This option is useful + # for Linux distributions. + ['chromeos==1', { + 'use_gnome_keyring%': 0, + }, { + 'use_gnome_keyring%': 1, + }], + + # Set to 1 compile with -fPIC cflag on linux. This is a must for shared + # libraries on linux x86-64 and arm. + ['host_arch=="ia32"', { + 'linux_fpic%': 0, + }, { + 'linux_fpic%': 1, + }], ], 'host_arch%': '<(host_arch)', @@ -91,7 +109,7 @@ # building on. 'target_arch%': '<(host_arch)', - # Copy conditionally-set chromeos and touchui variables out one scope. + # Copy conditionally-set variables out one scope. 'chromeos%': '<(chromeos)', 'touchui%': '<(touchui)', @@ -104,10 +122,6 @@ # compilation. 'fastbuild%': 0, - # Set to 1 compile with -fPIC cflag on linux. This is a must for shared - # libraries on linux x86-64 and arm. - 'linux_fpic%': 0, - # Python version. 'python_ver%': '2.5', @@ -126,6 +140,9 @@ # Remoting compilation is enabled by default. Set to 0 to disable. 'remoting%': 1, + # Use libjpeg-turbo as the JPEG codec used by Chromium. + 'use_libjpeg_turbo%': 0, + 'library%': '<(library)', # Variable 'component' is for cases where we would like to build some @@ -143,11 +160,12 @@ 'target_arch%': '<(target_arch)', 'host_arch%': '<(host_arch)', 'toolkit_views%': '<(toolkit_views)', + 'use_gnome_keyring%': '<(use_gnome_keyring)', + 'linux_fpic%': '<(linux_fpic)', 'chromeos%': '<(chromeos)', 'touchui%': '<(touchui)', 'inside_chromium_build%': '<(inside_chromium_build)', 'fastbuild%': '<(fastbuild)', - 'linux_fpic%': '<(linux_fpic)', 'python_ver%': '<(python_ver)', 'armv7%': '<(armv7)', 'arm_neon%': '<(arm_neon)', @@ -240,12 +258,20 @@ # Set this to true to enable SELinux support. 'selinux%': 0, + # Set this to true when building with Clang. + # See http://code.google.com/p/chromium/wiki/Clang for details. + # TODO: eventually clang should behave identically to gcc, and this + # won't be necessary. + 'clang%': 0, + # Override whether we should use Breakpad on Linux. I.e. for Chrome bot. 'linux_breakpad%': 0, # And if we want to dump symbols for Breakpad-enabled builds. 'linux_dump_symbols%': 0, # And if we want to strip the binary after dumping symbols. 'linux_strip_binary%': 0, + # Strip the test binaries needed for Linux reliability tests. + 'linux_strip_reliability_tests%': 0, # Enable TCMalloc. 'linux_use_tcmalloc%': 1, @@ -291,6 +317,12 @@ # whether to compile in the sources for the GPU plugin / process. 'enable_gpu%': 1, + # Use GConf, the GNOME configuration system. + 'use_gconf%': 1, + + # Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803 + 'use_openssl%': 0, + 'conditions': [ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { # This will set gcc_version to XY if you are running gcc X.Y.*. @@ -366,6 +398,18 @@ 'NACL_WIN64', ], }], + ['OS=="mac" or (OS=="linux" and chromeos==0 and target_arch!="arm")', { + 'use_cups%': 1, + }, { + 'use_cups%': 0, + }], + # Set the relative path from this file to the GYP file of the JPEG + # library used by Chromium. + ['use_libjpeg_turbo==1', { + 'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp', + }, { + 'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp', + }], # use_libjpeg_turbo==1 ], # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_' @@ -403,6 +447,12 @@ # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx 'win_debug_InlineFunctionExpansion%': '', # empty = default, 0 = off, 'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max + # VS inserts quite a lot of extra checks to algorithms like + # std::partial_sort in Debug build which make them O(N^2) + # instead of O(N*logN). This is particularly slow under memory + # tools like ThreadSanitizer so we want it to be disablable. + # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx + 'win_debug_disable_iterator_debugging%': '0', 'release_extra_cflags%': '', 'debug_extra_cflags%': '', @@ -475,6 +525,11 @@ 'ENABLE_GPU=1', ], }], + ['use_openssl==1', { + 'defines': [ + 'USE_OPENSSL=1', + ], + }], ['enable_eglimage==1', { 'defines': [ 'ENABLE_EGLIMAGE=1', @@ -496,9 +551,6 @@ }], ], }], - # Linux gyp (into scons) doesn't like target_conditions? - # TODO(???): track down why 'target_conditions' doesn't work - # on Linux gyp into scons like it does on Mac gyp into xcodeproj. ['OS=="linux"', { 'cflags': [ '-ftest-coverage', '-fprofile-arcs' ], @@ -570,31 +622,31 @@ ], 'conditions': [ ['OS!="win"', { - 'sources/': [ ['exclude', '_win(_unittest)?\\.cc$'], - ['exclude', '/win/'], - ['exclude', '/win_[^/]*\\.cc$'] ], + 'sources/': [ ['exclude', '_win(_unittest)?\\.(h|cc)$'], + ['exclude', '(^|/)win/'], + ['exclude', '(^|/)win_[^/]*\\.(h|cc)$'] ], }], ['OS!="mac"', { - 'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.cc$'], - ['exclude', '/(cocoa|mac)/'], - ['exclude', '\.mm?$' ] ], + 'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.(h|cc)$'], + ['exclude', '(^|/)(cocoa|mac)/'], + ['exclude', '\\.mm?$' ] ], }], ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', { 'sources/': [ - ['exclude', '_(chromeos|gtk|x|x11|xdg)(_unittest)?\\.cc$'], - ['exclude', '/gtk/'], - ['exclude', '/(gtk|x11)_[^/]*\\.cc$'], + ['exclude', '_(chromeos|gtk|x|x11|xdg)(_unittest)?\\.(h|cc)$'], + ['exclude', '(^|/)gtk/'], + ['exclude', '(^|/)(gtk|x11)_[^/]*\\.(h|cc)$'], ], }], ['OS!="linux"', { 'sources/': [ - ['exclude', '_linux(_unittest)?\\.cc$'], - ['exclude', '/linux/'], + ['exclude', '_linux(_unittest)?\\.(h|cc)$'], + ['exclude', '(^|/)linux/'], ], }], # We use "POSIX" to refer to all non-Windows operating systems. ['OS=="win"', { - 'sources/': [ ['exclude', '_posix\\.cc$'] ], + 'sources/': [ ['exclude', '_posix\\.(h|cc)$'] ], # turn on warnings for signed/unsigned mismatch on chromium code. 'msvs_settings': { 'VCCLCompilerTool': { @@ -603,10 +655,10 @@ }, }], ['chromeos!=1', { - 'sources/': [ ['exclude', '_chromeos\\.cc$'] ] + 'sources/': [ ['exclude', '_chromeos\\.(h|cc)$'] ] }], ['toolkit_views==0', { - 'sources/': [ ['exclude', '_views\\.cc$'] ] + 'sources/': [ ['exclude', '_views\\.(h|cc)$'] ] }], ], }], @@ -619,8 +671,7 @@ # 2 == /INCREMENTAL # Debug links incremental, Release does not. # - # Abstract base configurations to cover common - # attributes. + # Abstract base configurations to cover common attributes. # 'Common_Base': { 'abstract': 1, @@ -687,6 +738,9 @@ 'InlineFunctionExpansion': '<(win_debug_InlineFunctionExpansion)', }], + ['win_debug_disable_iterator_debugging==1', { + 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'], + }], ], }, 'VCLinkerTool': { @@ -835,6 +889,7 @@ # Don't export any symbols (for example, to plugins we dlopen()). # Note: this is *required* to make some plugins work. '-fvisibility=hidden', + '-pipe', ], 'cflags_cc': [ '-fno-rtti', @@ -846,73 +901,6 @@ 'ldflags': [ '-pthread', '-Wl,-z,noexecstack', ], - 'scons_variable_settings': { - 'LIBPATH': ['$LIB_DIR'], - # Linking of large files uses lots of RAM, so serialize links - # using the handy flock command from util-linux. - 'FLOCK_LINK': ['flock', '$TOP_BUILDDIR/linker.lock', '$LINK'], - 'FLOCK_SHLINK': ['flock', '$TOP_BUILDDIR/linker.lock', '$SHLINK'], - 'FLOCK_LDMODULE': ['flock', '$TOP_BUILDDIR/linker.lock', '$LDMODULE'], - - # We have several cases where archives depend on each other in - # a cyclic fashion. Since the GNU linker does only a single - # pass over the archives we surround the libraries with - # --start-group and --end-group (aka -( and -) ). That causes - # ld to loop over the group until no more undefined symbols - # are found. In an ideal world we would only make groups from - # those libraries which we knew to be in cycles. However, - # that's tough with SCons, so we bodge it by making all the - # archives a group by redefining the linking command here. - # - # TODO: investigate whether we still have cycles that - # require --{start,end}-group. There has been a lot of - # refactoring since this was first coded, which might have - # eliminated the circular dependencies. - # - # Note: $_LIBDIRFLAGS comes before ${LINK,SHLINK,LDMODULE}FLAGS - # so that we prefer our own built libraries (e.g. -lpng) to - # system versions of libraries that pkg-config might turn up. - # TODO(sgk): investigate handling this not by re-ordering the - # flags this way, but by adding a hook to use the SCons - # ParseFlags() option on the output from pkg-config. - 'LINKCOM': [['$FLOCK_LINK', '-o', '$TARGET', - '$_LIBDIRFLAGS', '$LINKFLAGS', '$SOURCES', - '-Wl,--start-group', '$_LIBFLAGS', '-Wl,--end-group']], - 'SHLINKCOM': [['$FLOCK_SHLINK', '-o', '$TARGET', - '$_LIBDIRFLAGS', '$SHLINKFLAGS', '$SOURCES', - '-Wl,--start-group', '$_LIBFLAGS', '-Wl,--end-group']], - 'LDMODULECOM': [['$FLOCK_LDMODULE', '-o', '$TARGET', - '$_LIBDIRFLAGS', '$LDMODULEFLAGS', '$SOURCES', - '-Wl,--start-group', '$_LIBFLAGS', '-Wl,--end-group']], - 'IMPLICIT_COMMAND_DEPENDENCIES': 0, - # -rpath is only used when building with shared libraries. - 'conditions': [ - [ 'library=="shared_library"', { - 'RPATH': '$LIB_DIR', - }], - ], - }, - 'scons_import_variables': [ - 'AS', - 'CC', - 'CXX', - 'LINK', - ], - 'scons_propagate_variables': [ - 'AS', - 'CC', - 'CCACHE_DIR', - 'CXX', - 'DISTCC_DIR', - 'DISTCC_HOSTS', - 'HOME', - 'INCLUDE_SERVER_ARGS', - 'INCLUDE_SERVER_PORT', - 'LINK', - 'CHROME_BUILD_TYPE', - 'CHROMIUM_BUILD', - 'OFFICIAL_BUILD', - ], 'configurations': { 'Debug_Base': { 'variables': { @@ -959,6 +947,11 @@ '-Wl,--gc-sections', ], }], + ['clang==1', { + 'cflags!': [ + '-fno-ident', + ], + }], ] }, }, @@ -1100,6 +1093,27 @@ ], }]] }], + ['clang==1', { + 'cflags': [ + # Don't warn about unused variables, due to a common pattern: + # scoped_deleter unused_variable(&thing_to_delete); + '-Wno-unused-variable', + # Clang spots more unused functions. + '-Wno-unused-function', + # gtest confuses clang. + '-Wno-bool-conversions', + # Don't die on dtoa code that uses a char as an array index. + '-Wno-char-subscripts', + # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see + # http://code.google.com/p/googletest/source/detail?r=446 . + # TODO(thakis): Use -isystem instead (http://crbug.com/58751 ). + '-Wno-unnamed-type-template-args', + ], + 'cflags!': [ + # Clang doesn't seem to know know this flag. + '-mfpmath=sse', + ], + }], ['no_strict_aliasing==1', { 'cflags': [ '-fno-strict-aliasing', @@ -1109,9 +1123,6 @@ 'cflags': [ '-g' ], 'defines': ['USE_LINUX_BREAKPAD'], }], - ['linux_use_seccomp_sandbox==1 and buildtype!="Official"', { - 'defines': ['USE_SECCOMP_SANDBOX'], - }], ['library=="shared_library"', { # When building with shared libraries, remove the visiblity-hiding # flag. @@ -1122,6 +1133,11 @@ 'cflags': ['-fPIC'] }] ], + 'ldflags!': [ + # --as-needed confuses library interdependencies. + # See http://code.google.com/p/chromium/issues/detail?id=61430 + '-Wl,--as-needed', + ], }], ['linux_use_heapchecker==1', { 'variables': {'linux_use_tcmalloc%': 1}, @@ -1197,6 +1213,19 @@ ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'}, {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'} ], + ['clang==1', { + 'WARNING_CFLAGS': [ + # Don't die on dtoa code that uses a char as an array index. + # This is required solely for base/third_party/dmg_fp/dtoa.cc. + '-Wno-char-subscripts', + # Clang spots more unused functions. + '-Wno-unused-function', + # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see + # http://code.google.com/p/googletest/source/detail?r=446 . + # TODO(thakis): Use -isystem instead (http://crbug.com/58751 ). + '-Wno-unnamed-type-template-args', + ], + }], ], }, 'target_conditions': [ @@ -1413,10 +1442,6 @@ }, }], ], - 'scons_settings': { - 'sconsbuild_dir': '<(DEPTH)/sconsbuild', - 'tools': ['ar', 'as', 'gcc', 'g++', 'gnulink', 'chromium_builders'], - }, 'xcode_settings': { # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT! # This block adds *project-wide* configuration settings to each project diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/features_override.gypi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/features_override.gypi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/features_override.gypi 2010-09-03 02:00:27.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/features_override.gypi 2011-02-03 22:58:28.000000000 +0000 @@ -11,9 +11,11 @@ # but not listed below, it will revert to its hardcoded webkit value. 'feature_defines': [ 'ENABLE_3D_CANVAS=1', + 'ENABLE_3D_PLUGIN=1', 'ENABLE_BLOB=1', 'ENABLE_BLOB_SLICE=1', 'ENABLE_CHANNEL_MESSAGING=1', + 'ENABLE_CLIENT_BASED_GEOLOCATION=0', 'ENABLE_DASHBOARD_SUPPORT=0', 'ENABLE_DATABASE=1', 'ENABLE_DATAGRID=0', @@ -54,6 +56,8 @@ 'ENABLE_XHR_RESPONSE_BLOB=1', 'ENABLE_XPATH=1', 'ENABLE_XSLT=1', + 'WTF_USE_WEBP=1', + 'WTF_USE_WEBKIT_IMAGE_DECODERS=1', ], # We have to nest variables inside variables so that they can be overridden # through GYP_DEFINES. diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/gyp_chromium chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/gyp_chromium --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/gyp_chromium 2010-07-13 02:00:30.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/gyp_chromium 2011-02-03 22:58:28.000000000 +0000 @@ -18,6 +18,33 @@ sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) import gyp +def apply_gyp_environment(file_path=None): + """ + Reads in a *.gyp_env file and applies the valid keys to os.environ. + """ + if not file_path or not os.path.exists(file_path): + return + file_contents = open(file_path).read() + try: + file_data = eval(file_contents, {'__builtins__': None}, None) + except SyntaxError, e: + e.filename = os.path.abspath(file_path) + raise + supported_vars = ( 'CHROMIUM_GYP_FILE', + 'CHROMIUM_GYP_SYNTAX_CHECK', + 'GYP_DEFINES', + 'GYP_GENERATOR_FLAGS', + 'GYP_GENERATOR_OUTPUT', ) + for var in supported_vars: + val = file_data.get(var) + if val: + if var in os.environ: + print 'INFO: Environment value for "%s" overrides value in %s.' % ( + var, os.path.abspath(file_path) + ) + else: + os.environ[var] = val + def additional_include_files(args=[]): """ Returns a list of additional (.gypi) files to include, without @@ -51,6 +78,11 @@ if __name__ == '__main__': args = sys.argv[1:] + if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: + # Update the environment based on chromium.gyp_env + gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env') + apply_gyp_environment(gyp_env_path) + # This could give false positives since it doesn't actually do real option # parsing. Oh well. gyp_file_specified = False diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/chrome_linux.croc chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/chrome_linux.croc --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/chrome_linux.croc 2010-05-13 02:01:01.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/chrome_linux.croc 2011-02-03 22:58:28.000000000 +0000 @@ -14,9 +14,9 @@ 'regexp' : '.*/(chromeos|views)/', 'include' : 0, }, - # Don't include windows or mac specific files + # Don't include chromeos, windows, or mac specific files { - 'regexp' : '.*(_|/)(mac|win|views)(\\.|_)', + 'regexp' : '.*(_|/)(chromeos|mac|win|views)(\\.|_)', 'include' : 0, }, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/dump_signature.py chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/dump_signature.py --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/dump_signature.py 2010-04-06 02:01:14.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/dump_signature.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -#!/usr/bin/python -# -# Copyright (c) 2010 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# This generates symbol signatures with the same algorithm as -# src/breakpad/src/common/linux/file_id.cc@461 - -import struct -import sys -import subprocess - -if len(sys.argv) != 2: - sys.stderr.write("Error, no filename specified.\n") - sys.exit(1) - -# Shell out to objdump to get the offset of the .text section -objdump = subprocess.Popen(['objdump', '-h', sys.argv[1]], stdout = subprocess.PIPE) -(sections, _) = objdump.communicate() -if objdump.returncode != 0: - sys.stderr.write('Failed to run objdump to find .text section.\n') - sys.exit(1) - -text_section = [x for x in sections.splitlines() if '.text' in x] -if len(text_section) == 0: - sys.stderr.write('objdump failed to find a .text section.\n') - sys.exit(1) -text_section = text_section[0] -try: - file_offset = int(text_section.split()[5], 16) -except ValueError: - sys.stderr.write("Failed to parse objdump output. Here is the failing line:\n"); - sys.stderr.write(text_section) - sys.exit(1) - -bin = open(sys.argv[1]) -bin.seek(file_offset) -if bin.tell() != file_offset: - sys.stderr.write("Failed to seek to the .text segment. Truncated file?\n"); - sys.exit(1) - -data = bin.read(4096) -if len(data) != 4096: - sys.stderr.write("Error, did not read first page of data.\n"); - sys.exit(1) -bin.close() - -signature = [0] * 16 -for i in range(0, 4096): - signature[i % 16] ^= ord(data[i]) - -# Append a 0 at the end for the generation number (always 0 on Linux) -out = ('%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X0' % - struct.unpack('I2H8B', struct.pack('16B', *signature))) -sys.stdout.write(out) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/pkg-config-wrapper chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/pkg-config-wrapper --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/pkg-config-wrapper 2010-03-06 03:01:50.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/pkg-config-wrapper 2011-02-03 22:58:28.000000000 +0000 @@ -1,14 +1,37 @@ -#!/bin/sh +#!/bin/bash +# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This program wraps around pkg-config to generate the correct include and +# library paths when cross-compiling using a sysroot. +# The assumption is that the sysroot contains the .pc files in usr/lib/pkgconfig +# and usr/share/pkgconfig (relative to the sysroot) and that they output paths +# relative to some parent path of the sysroot. +# This assumption is valid for a range of sysroots, in particular: a +# LSB-compliant root filesystem mounted at the sysroot, and a board build +# directory of a Chromium OS chroot. root="$1" if [ -z "$root" ] then - echo "usage: $0 /path/to/sysroot [pkg-config-arguments]" >&2 + echo "usage: $0 /path/to/sysroot [pkg-config-arguments] package" >&2 exit 1 fi rewrite=`dirname $0`/rewrite_dirs.py +package=${!#} shift config_path=$root/usr/lib/pkgconfig:$root/usr/share/pkgconfig -PKG_CONFIG_PATH=$config_path pkg-config --define-variable=prefix=/usr "$@" | $rewrite $root +set -e +# Some sysroots, like the Chromium OS ones, may generate paths that are not +# relative to the sysroot. For example, +# /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths +# relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of +# relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr). +# To support this correctly, it's necessary to extract the prefix to strip from +# pkg-config's |prefix| variable. +prefix=`PKG_CONFIG_PATH=$config_path pkg-config --variable=prefix "$package" | sed -e 's|/usr$||'` +result=`PKG_CONFIG_PATH=$config_path pkg-config "$@"` +echo "$result"| $rewrite --sysroot "$root" --strip-prefix "$prefix" diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/rewrite_dirs.py chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/rewrite_dirs.py --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/rewrite_dirs.py 2010-02-23 03:01:31.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/rewrite_dirs.py 2011-02-03 22:58:28.000000000 +0000 @@ -7,6 +7,7 @@ import sys import os +import optparse REWRITE_PREFIX = ['-I', '-idirafter', @@ -18,15 +19,19 @@ '-isystem', '-L'] -def RewritePath(path, sysroot): - """Rewrites a path by prefixing it with the sysroot if it is absolute.""" +def RewritePath(path, opts): + """Rewrites a path by stripping the prefix and prepending the sysroot.""" + sysroot = opts.sysroot + prefix = opts.strip_prefix if os.path.isabs(path) and not path.startswith(sysroot): + if path.startswith(prefix): + path = path[len(prefix):] path = path.lstrip('/') return os.path.join(sysroot, path) else: return path -def RewriteLine(line, sysroot): +def RewriteLine(line, opts): """Rewrites all the paths in recognized options.""" args = line.split() count = len(args) @@ -38,25 +43,24 @@ if args[i] == prefix: i += 1 try: - args[i] = RewritePath(args[i], sysroot) + args[i] = RewritePath(args[i], opts) except IndexError: sys.stderr.write('Missing argument following %s\n' % prefix) break elif args[i].startswith(prefix): - args[i] = prefix + RewritePath(args[i][len(prefix):], sysroot) + args[i] = prefix + RewritePath(args[i][len(prefix):], opts) i += 1 return ' '.join(args) def main(argv): - try: - sysroot = argv[1] - except IndexError: - sys.stderr.write('usage: %s /path/to/sysroot\n' % argv[0]) - return 1 + parser = optparse.OptionParser() + parser.add_option('-s', '--sysroot', default='/', help='sysroot to prepend') + parser.add_option('-p', '--strip-prefix', default='', help='prefix to strip') + opts, args = parser.parse_args(argv[1:]) for line in sys.stdin.readlines(): - line = RewriteLine(line.strip(), sysroot) + line = RewriteLine(line.strip(), opts) print line return 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/system.gyp chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/system.gyp --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/build/linux/system.gyp 2010-08-05 02:00:40.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/build/linux/system.gyp 2011-02-03 22:58:28.000000000 +0000 @@ -15,7 +15,7 @@ }], [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { 'variables': { - # We use our own copy of libssl, although we still need to link against + # We use our own copy of libssl3, although we still need to link against # the rest of NSS. 'use_system_ssl%': 0, }, @@ -46,6 +46,11 @@ 'patches/to_upstream/01_static_pthread_O2.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/01_static_pthread_O2.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/02_mov_dref_looping.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/to_upstream/02_mov_dref_looping.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/02_mov_dref_looping.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/03_mpeg4_video_to_elementary_stream.patch + patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/05_respect_flac_dirac_configure.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/to_upstream/03_mpeg4_video_to_elementary_stream.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/05_respect_flac_dirac_configure.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/04_vc1_bsfs.patch + patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/06_remove_decode_on_config_no_svq3.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/to_upstream/04_vc1_bsfs.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/06_remove_decode_on_config_no_svq3.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/05_respect_flac_dirac_configure.patch + patch -p1 --no-backup-if-mismatch < ../patches/ugly/07_get_bits_overrun.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/to_upstream/05_respect_flac_dirac_configure.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/ugly/07_get_bits_overrun.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/06_remove_decode_on_config_no_svq3.patch + patch -p1 --no-backup-if-mismatch < ../patches/ugly/08_enforce_theora_oob.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/to_upstream/06_remove_decode_on_config_no_svq3.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/ugly/08_enforce_theora_oob.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/ugly/07_get_bits_overrun.patch + patch -p1 --no-backup-if-mismatch < ../patches/ugly/09_enforce_vorbis_oob_divzero.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/ugly/07_get_bits_overrun.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/ugly/09_enforce_vorbis_oob_divzero.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/ugly/08_enforce_theora_oob.patch + patch -p1 --no-backup-if-mismatch < ../patches/ugly/10_aac_oob_read.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/ugly/08_enforce_theora_oob.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/ugly/10_aac_oob_read.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/ugly/09_enforce_vorbis_oob_divzero.patch + patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/11_mkv_buffer_overflow.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/ugly/09_enforce_vorbis_oob_divzero.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/11_mkv_buffer_overflow.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/ugly/10_aac_oob_read.patch + patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/12_ogg_seek_to_zero.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/ugly/10_aac_oob_read.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/12_ogg_seek_to_zero.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/11_mkv_buffer_overflow.patch + patch -p1 --no-backup-if-mismatch < ../patches/ugly/13_remove_avcore.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/to_upstream/11_mkv_buffer_overflow.patch + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/ugly/13_remove_avcore.patch rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/12_ogg_seek_to_zero.patch + patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/14_vp8_encode_options.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/to_upstream/12_ogg_seek_to_zero.patch - + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/14_vp8_encode_options.patch + rm -rf orig cp -R ffmpeg-mt orig cd ffmpeg-mt - patch -p1 --no-backup-if-mismatch < ../patches/ugly/13_remove_avcore.patch + patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/15_webp_ffmpeg.patch + cd .. + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/15_webp_ffmpeg.patch + + rm -rf orig + cp -R ffmpeg-mt orig + cd ffmpeg-mt + patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/16_neon_offsets.patch cd .. - diff -rpu -N orig ffmpeg-mt - diff -rpu -N orig ffmpeg-mt >patches/ugly/13_remove_avcore.patch - + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/16_neon_offsets.patch + + rm -rf orig + cp -R ffmpeg-mt orig + cd ffmpeg-mt + patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/17_mpegthread.patch + cd .. + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/17_mpegthread.patch + + rm -rf orig + cp -R ffmpeg-mt orig + cd ffmpeg-mt + patch -p1 --no-backup-if-mismatch < ../patches/to_upstream/18_respect_swscale.patch + cd .. + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/to_upstream/18_respect_swscale.patch + + rm -rf orig + cp -R ffmpeg-mt orig + cd ffmpeg-mt + patch -p1 --no-backup-if-mismatch < ../patches/from_upstream/19_vorbis_decode.patch + cd .. + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/from_upstream/19_vorbis_decode.patch + + rm -rf orig + cp -R ffmpeg-mt orig + cd ffmpeg-mt + patch -p1 --no-backup-if-mismatch < ../patches/from_upstream/20_r25798_ogg_data_offset.patch + cd .. + diff -wurp -N orig ffmpeg-mt + diff -wurp -N orig ffmpeg-mt >patches/from_upstream/20_r25798_ogg_data_offset.patch + Testing Updates should be tested against http://wiki.xiph.org/TheoraTestsuite WebKit Layout Tests http://www.chromium.org/developers/testing/webkit-layout-tests - make -j16 -r test_shell BUILDTYPE=Debug + make -r test_shell BUILDTYPE=Debug ./src/webkit/tools/layout_tests/run_webkit_tests.sh --debug media/\* diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/avcodec-52.novpx_sigs chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/avcodec-52.novpx_sigs --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/avcodec-52.novpx_sigs 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/avcodec-52.novpx_sigs 2011-02-03 22:58:15.000000000 +0000 @@ -0,0 +1,25 @@ +# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Functions from avcodec used in chromium code. + +AVCodec *avcodec_find_decoder(enum CodecID id); +AVFrame *avcodec_alloc_frame(void); +int av_get_bits_per_sample_fmt(enum SampleFormat sample_fmt); +int av_new_packet(AVPacket *pkt, int size); +int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt); +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt); +int avcodec_open(AVCodecContext *avctx, AVCodec *codec); +int avcodec_close(AVCodecContext *avctx); +int avcodec_thread_init(AVCodecContext *s, int thread_count); +void av_free_packet(AVPacket *pkt); +void av_init_packet(AVPacket *pkt); +int av_dup_packet(AVPacket *pkt); +void avcodec_flush_buffers(AVCodecContext *avctx); +void avcodec_init(void); +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe); +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); +void av_destruct_packet(AVPacket *pkt); +int av_lockmgr_register(AVLockMgrOperation cb); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/avcodec-52.sigs chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/avcodec-52.sigs --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/avcodec-52.sigs 2010-06-09 02:00:31.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/avcodec-52.sigs 2011-02-03 22:58:15.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # @@ -6,7 +6,7 @@ AVCodec *avcodec_find_decoder(enum CodecID id); AVFrame *avcodec_alloc_frame(void); -int av_get_bits_per_sample_format(enum SampleFormat sample_fmt); +int av_get_bits_per_sample_fmt(enum SampleFormat sample_fmt); int av_new_packet(AVPacket *pkt, int size); int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt); int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt); @@ -23,3 +23,17 @@ void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); void av_destruct_packet(AVPacket *pkt); int av_lockmgr_register(AVLockMgrOperation cb); + +# Export symbols for libvpx since Chromium is also using libvpx directly. +vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface, vpx_codec_enc_cfg_t *cfg, unsigned int usage); +vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx, vpx_codec_iface_t *iface, vpx_codec_enc_cfg_t *cfg, vpx_codec_flags_t flags, int ver); +vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx, const vpx_image_t *img, vpx_codec_pts_t pts, unsigned long duration, vpx_enc_frame_flags_t flags, unsigned long deadline); +const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx); +const char *vpx_codec_error(vpx_codec_ctx_t *ctx); +const char *vpx_codec_err_to_string(vpx_codec_err_t err); +const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx, vpx_codec_iter_t *iter); +vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx); +vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id, ...); +vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx, vpx_codec_iface_t *iface, vpx_codec_dec_cfg_t *cfg, vpx_codec_flags_t flags, int ver); +vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx, const uint8_t *data, unsigned int data_sz, void *user_priv, long deadline); +vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx, vpx_codec_iter_t *iter); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chrome/linux/arm/config.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chrome/linux/arm/config.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chrome/linux/arm/config.h 2010-08-18 02:00:49.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chrome/linux/arm/config.h 2011-02-03 22:58:22.000000000 +0000 @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --enable-shared --enable-decoder='theora,vorbis,libvpx,aac,h264,mp3' --enable-demuxer='ogg,matroska,mp3,mov' --enable-parser=mpegaudio --enable-cross-compile --arch=arm --target-os=linux --enable-armv6 --enable-armv6t2 --enable-armvfp --disable-neon --cross-prefix=/usr/local/google/cross-tools/arm-2009q3/bin/arm-none-linux-gnueabi- --extra-cflags='-march=armv7-a -mtune=cortex-a8 -mfpu=vfp -mfloat-abi=softfp'" +#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --disable-swscale --enable-shared --enable-decoder='theora,vorbis,pcm_u8,pcm_s16le,pcm_f32le,aac,h264,mp3' --enable-demuxer='ogg,matroska,wav,mp3,mov' --enable-parser=mpegaudio --enable-cross-compile --arch=arm --target-os=linux --enable-armv6 --enable-armv6t2 --enable-armvfp --disable-neon --cross-prefix=/usr/local/google/cross-tools/arm-2009q3/bin/arm-none-linux-gnueabi- --extra-cflags='-march=armv7-a -mtune=cortex-a8 -mfpu=vfp -mfloat-abi=softfp'" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define CC_TYPE "gcc" @@ -9,7 +9,8 @@ #define restrict restrict #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t" #define EXTERN_PREFIX "" -#define EXTERN_ASM +#define EXTERN_ASM +#define SLIBSUF ".so" #define ARCH_ALPHA 0 #define ARCH_ARM 1 #define ARCH_AVR32 0 @@ -51,6 +52,7 @@ #define HAVE_FAST_UNALIGNED 1 #define HAVE_PTHREADS 1 #define HAVE_W32THREADS 0 +#define HAVE_ALIGNED_STACK 0 #define HAVE_ALSA_ASOUNDLIB_H 0 #define HAVE_ALTIVEC_H 0 #define HAVE_ARPA_INET_H 0 @@ -119,6 +121,7 @@ #define HAVE_POLL_H 1 #define HAVE_SETRLIMIT 1 #define HAVE_STRERROR_R 1 +#define HAVE_STRTOK_R 1 #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 @@ -140,6 +143,7 @@ #define HAVE_VIRTUALALLOC 0 #define HAVE_WINSOCK2_H 0 #define HAVE_XFORM_ASM 0 +#define HAVE_XMM_CLOBBERS 0 #define HAVE_YASM 0 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 @@ -165,11 +169,12 @@ #define CONFIG_DWT 0 #define CONFIG_DXVA2 0 #define CONFIG_FASTDIV 1 -#define CONFIG_FFMPEG 1 +#define CONFIG_FFMPEG 0 #define CONFIG_FFPLAY 0 #define CONFIG_FFPROBE 1 #define CONFIG_FFSERVER 0 #define CONFIG_FFT 1 +#define CONFIG_FREI0R 0 #define CONFIG_GOLOMB 1 #define CONFIG_GPL 0 #define CONFIG_GRAY 0 @@ -185,6 +190,7 @@ #define CONFIG_LIBNUT 0 #define CONFIG_LIBOPENCORE_AMRNB 0 #define CONFIG_LIBOPENCORE_AMRWB 0 +#define CONFIG_LIBOPENCV 0 #define CONFIG_LIBOPENJPEG 0 #define CONFIG_LIBRTMP 0 #define CONFIG_LIBSCHROEDINGER 0 @@ -206,12 +212,13 @@ #define CONFIG_PIC 1 #define CONFIG_POSTPROC 0 #define CONFIG_RDFT 1 +#define CONFIG_RTPDEC 0 #define CONFIG_RUNTIME_CPUDETECT 0 #define CONFIG_SHARED 1 #define CONFIG_SMALL 0 #define CONFIG_SRAM 0 #define CONFIG_STATIC 1 -#define CONFIG_SWSCALE 1 +#define CONFIG_SWSCALE 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_VAAPI 0 #define CONFIG_VDPAU 0 @@ -314,6 +321,7 @@ #define CONFIG_QDRAW_DECODER 0 #define CONFIG_QPEG_DECODER 0 #define CONFIG_QTRLE_DECODER 0 +#define CONFIG_R10K_DECODER 0 #define CONFIG_R210_DECODER 0 #define CONFIG_RAWVIDEO_DECODER 0 #define CONFIG_RL2_DECODER 0 @@ -368,6 +376,7 @@ #define CONFIG_ZLIB_DECODER 0 #define CONFIG_ZMBV_DECODER 0 #define CONFIG_AAC_DECODER 1 +#define CONFIG_AAC_LATM_DECODER 0 #define CONFIG_AC3_DECODER 0 #define CONFIG_ALAC_DECODER 0 #define CONFIG_ALS_DECODER 0 @@ -425,20 +434,21 @@ #define CONFIG_PCM_BLURAY_DECODER 0 #define CONFIG_PCM_DVD_DECODER 0 #define CONFIG_PCM_F32BE_DECODER 0 -#define CONFIG_PCM_F32LE_DECODER 0 +#define CONFIG_PCM_F32LE_DECODER 1 #define CONFIG_PCM_F64BE_DECODER 0 #define CONFIG_PCM_F64LE_DECODER 0 +#define CONFIG_PCM_LXF_DECODER 0 #define CONFIG_PCM_MULAW_DECODER 0 #define CONFIG_PCM_S8_DECODER 0 #define CONFIG_PCM_S16BE_DECODER 0 -#define CONFIG_PCM_S16LE_DECODER 0 +#define CONFIG_PCM_S16LE_DECODER 1 #define CONFIG_PCM_S16LE_PLANAR_DECODER 0 #define CONFIG_PCM_S24BE_DECODER 0 #define CONFIG_PCM_S24DAUD_DECODER 0 #define CONFIG_PCM_S24LE_DECODER 0 #define CONFIG_PCM_S32BE_DECODER 0 #define CONFIG_PCM_S32LE_DECODER 0 -#define CONFIG_PCM_U8_DECODER 0 +#define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 #define CONFIG_PCM_U24BE_DECODER 0 @@ -459,6 +469,7 @@ #define CONFIG_ADPCM_EA_R2_DECODER 0 #define CONFIG_ADPCM_EA_R3_DECODER 0 #define CONFIG_ADPCM_EA_XAS_DECODER 0 +#define CONFIG_ADPCM_G722_DECODER 0 #define CONFIG_ADPCM_G726_DECODER 0 #define CONFIG_ADPCM_IMA_AMV_DECODER 0 #define CONFIG_ADPCM_IMA_DK3_DECODER 0 @@ -491,6 +502,8 @@ #define CONFIG_LIBSCHROEDINGER_DECODER 0 #define CONFIG_LIBSPEEX_DECODER 0 #define CONFIG_LIBVPX_DECODER 0 +#define CONFIG_A64MULTI_ENCODER 0 +#define CONFIG_A64MULTI5_ENCODER 0 #define CONFIG_ASV1_ENCODER 0 #define CONFIG_ASV2_ENCODER 0 #define CONFIG_BMP_ENCODER 0 @@ -572,6 +585,7 @@ #define CONFIG_PCM_ZORK_ENCODER 0 #define CONFIG_ROQ_DPCM_ENCODER 0 #define CONFIG_ADPCM_ADX_ENCODER 0 +#define CONFIG_ADPCM_G722_ENCODER 0 #define CONFIG_ADPCM_G726_ENCODER 0 #define CONFIG_ADPCM_IMA_QT_ENCODER 0 #define CONFIG_ADPCM_IMA_WAV_ENCODER 0 @@ -605,6 +619,7 @@ #define CONFIG_WMV3_DXVA2_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_AAC_PARSER 0 +#define CONFIG_AAC_LATM_PARSER 0 #define CONFIG_AC3_PARSER 0 #define CONFIG_CAVSVIDEO_PARSER 0 #define CONFIG_DCA_PARSER 0 @@ -647,6 +662,7 @@ #define CONFIG_ANM_DEMUXER 0 #define CONFIG_APC_DEMUXER 0 #define CONFIG_APE_DEMUXER 0 +#define CONFIG_APPLEHTTP_DEMUXER 0 #define CONFIG_ASF_DEMUXER 0 #define CONFIG_ASS_DEMUXER 0 #define CONFIG_AU_DEMUXER 0 @@ -676,6 +692,7 @@ #define CONFIG_FLIC_DEMUXER 0 #define CONFIG_FLV_DEMUXER 0 #define CONFIG_FOURXM_DEMUXER 0 +#define CONFIG_G722_DEMUXER 0 #define CONFIG_GSM_DEMUXER 0 #define CONFIG_GXF_DEMUXER 0 #define CONFIG_H261_DEMUXER 0 @@ -691,6 +708,7 @@ #define CONFIG_IV8_DEMUXER 0 #define CONFIG_IVF_DEMUXER 0 #define CONFIG_LMLM4_DEMUXER 0 +#define CONFIG_LXF_DEMUXER 0 #define CONFIG_M4V_DEMUXER 0 #define CONFIG_MATROSKA_DEMUXER 1 #define CONFIG_MJPEG_DEMUXER 0 @@ -744,7 +762,9 @@ #define CONFIG_ROQ_DEMUXER 0 #define CONFIG_RPL_DEMUXER 0 #define CONFIG_RSO_DEMUXER 0 +#define CONFIG_RTP_DEMUXER 0 #define CONFIG_RTSP_DEMUXER 0 +#define CONFIG_SAP_DEMUXER 0 #define CONFIG_SDP_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 @@ -768,8 +788,9 @@ #define CONFIG_VOC_DEMUXER 0 #define CONFIG_VQF_DEMUXER 0 #define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_DEMUXER 0 +#define CONFIG_WAV_DEMUXER 1 #define CONFIG_WC3_DEMUXER 0 +#define CONFIG_WEBP_DEMUXER 0 #define CONFIG_WSAUD_DEMUXER 0 #define CONFIG_WSVQA_DEMUXER 0 #define CONFIG_WV_DEMUXER 0 @@ -777,6 +798,7 @@ #define CONFIG_YOP_DEMUXER 0 #define CONFIG_YUV4MPEGPIPE_DEMUXER 0 #define CONFIG_LIBNUT_DEMUXER 0 +#define CONFIG_A64_MUXER 0 #define CONFIG_AC3_MUXER 0 #define CONFIG_ADTS_MUXER 0 #define CONFIG_AIFF_MUXER 0 @@ -801,6 +823,7 @@ #define CONFIG_FLV_MUXER 0 #define CONFIG_FRAMECRC_MUXER 0 #define CONFIG_FRAMEMD5_MUXER 0 +#define CONFIG_G722_MUXER 0 #define CONFIG_GIF_MUXER 0 #define CONFIG_GXF_MUXER 0 #define CONFIG_H261_MUXER 0 @@ -861,6 +884,7 @@ #define CONFIG_RSO_MUXER 0 #define CONFIG_RTP_MUXER 0 #define CONFIG_RTSP_MUXER 0 +#define CONFIG_SAP_MUXER 0 #define CONFIG_SOX_MUXER 0 #define CONFIG_SPDIF_MUXER 0 #define CONFIG_SRT_MUXER 0 @@ -872,21 +896,36 @@ #define CONFIG_VOC_MUXER 0 #define CONFIG_WAV_MUXER 0 #define CONFIG_WEBM_MUXER 0 +#define CONFIG_WEBP_MUXER 0 #define CONFIG_YUV4MPEGPIPE_MUXER 0 #define CONFIG_LIBNUT_MUXER 0 +#define CONFIG_ANULL_FILTER 0 +#define CONFIG_ANULLSRC_FILTER 0 +#define CONFIG_ANULLSINK_FILTER 0 #define CONFIG_ASPECT_FILTER 0 +#define CONFIG_BLACKFRAME_FILTER 0 #define CONFIG_CROP_FILTER 0 +#define CONFIG_CROPDETECT_FILTER 0 +#define CONFIG_DRAWBOX_FILTER 0 +#define CONFIG_FIFO_FILTER 0 #define CONFIG_FORMAT_FILTER 0 +#define CONFIG_FREI0R_FILTER 0 +#define CONFIG_HFLIP_FILTER 0 #define CONFIG_NOFORMAT_FILTER 0 #define CONFIG_NULL_FILTER 0 +#define CONFIG_OCV_SMOOTH_FILTER 0 #define CONFIG_PAD_FILTER 0 #define CONFIG_PIXDESCTEST_FILTER 0 #define CONFIG_PIXELASPECT_FILTER 0 #define CONFIG_SCALE_FILTER 0 +#define CONFIG_SETPTS_FILTER 0 +#define CONFIG_SETTB_FILTER 0 #define CONFIG_SLICIFY_FILTER 0 +#define CONFIG_TRANSPOSE_FILTER 0 #define CONFIG_UNSHARP_FILTER 0 #define CONFIG_VFLIP_FILTER 0 -#define CONFIG_BUFFER_FILTER 1 +#define CONFIG_YADIF_FILTER 0 +#define CONFIG_BUFFER_FILTER 0 #define CONFIG_COLOR_FILTER 0 #define CONFIG_NULLSRC_FILTER 0 #define CONFIG_NULLSINK_FILTER 0 @@ -894,6 +933,7 @@ #define CONFIG_FILE_PROTOCOL 0 #define CONFIG_GOPHER_PROTOCOL 0 #define CONFIG_HTTP_PROTOCOL 0 +#define CONFIG_MMSH_PROTOCOL 0 #define CONFIG_MMST_PROTOCOL 0 #define CONFIG_MD5_PROTOCOL 0 #define CONFIG_PIPE_PROTOCOL 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chrome/linux/arm-neon/config.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chrome/linux/arm-neon/config.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chrome/linux/arm-neon/config.h 2010-08-18 02:00:49.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chrome/linux/arm-neon/config.h 2011-02-03 22:58:22.000000000 +0000 @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --enable-shared --enable-decoder='theora,vorbis,libvpx,aac,h264,mp3' --enable-demuxer='ogg,matroska,mp3,mov' --enable-parser=mpegaudio --enable-cross-compile --arch=arm --target-os=linux --enable-armv6 --enable-armv6t2 --enable-armvfp --enable-neon --cross-prefix=/usr/local/google/cross-tools/arm-2009q3/bin/arm-none-linux-gnueabi- --extra-cflags='-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp'" +#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --disable-swscale --enable-shared --enable-decoder='theora,vorbis,pcm_u8,pcm_s16le,pcm_f32le,aac,h264,mp3' --enable-demuxer='ogg,matroska,wav,mp3,mov' --enable-parser=mpegaudio --enable-cross-compile --arch=arm --target-os=linux --enable-armv6 --enable-armv6t2 --enable-armvfp --enable-neon --cross-prefix=/usr/local/google/cross-tools/arm-2009q3/bin/arm-none-linux-gnueabi- --extra-cflags='-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp'" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define CC_TYPE "gcc" @@ -9,7 +9,8 @@ #define restrict restrict #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t" #define EXTERN_PREFIX "" -#define EXTERN_ASM +#define EXTERN_ASM +#define SLIBSUF ".so" #define ARCH_ALPHA 0 #define ARCH_ARM 1 #define ARCH_AVR32 0 @@ -51,6 +52,7 @@ #define HAVE_FAST_UNALIGNED 1 #define HAVE_PTHREADS 1 #define HAVE_W32THREADS 0 +#define HAVE_ALIGNED_STACK 0 #define HAVE_ALSA_ASOUNDLIB_H 0 #define HAVE_ALTIVEC_H 0 #define HAVE_ARPA_INET_H 0 @@ -119,6 +121,7 @@ #define HAVE_POLL_H 1 #define HAVE_SETRLIMIT 1 #define HAVE_STRERROR_R 1 +#define HAVE_STRTOK_R 1 #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 @@ -140,6 +143,7 @@ #define HAVE_VIRTUALALLOC 0 #define HAVE_WINSOCK2_H 0 #define HAVE_XFORM_ASM 0 +#define HAVE_XMM_CLOBBERS 0 #define HAVE_YASM 0 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 @@ -165,11 +169,12 @@ #define CONFIG_DWT 0 #define CONFIG_DXVA2 0 #define CONFIG_FASTDIV 1 -#define CONFIG_FFMPEG 1 +#define CONFIG_FFMPEG 0 #define CONFIG_FFPLAY 0 #define CONFIG_FFPROBE 1 #define CONFIG_FFSERVER 0 #define CONFIG_FFT 1 +#define CONFIG_FREI0R 0 #define CONFIG_GOLOMB 1 #define CONFIG_GPL 0 #define CONFIG_GRAY 0 @@ -185,6 +190,7 @@ #define CONFIG_LIBNUT 0 #define CONFIG_LIBOPENCORE_AMRNB 0 #define CONFIG_LIBOPENCORE_AMRWB 0 +#define CONFIG_LIBOPENCV 0 #define CONFIG_LIBOPENJPEG 0 #define CONFIG_LIBRTMP 0 #define CONFIG_LIBSCHROEDINGER 0 @@ -206,12 +212,13 @@ #define CONFIG_PIC 1 #define CONFIG_POSTPROC 0 #define CONFIG_RDFT 1 +#define CONFIG_RTPDEC 0 #define CONFIG_RUNTIME_CPUDETECT 0 #define CONFIG_SHARED 1 #define CONFIG_SMALL 0 #define CONFIG_SRAM 0 #define CONFIG_STATIC 1 -#define CONFIG_SWSCALE 1 +#define CONFIG_SWSCALE 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_VAAPI 0 #define CONFIG_VDPAU 0 @@ -314,6 +321,7 @@ #define CONFIG_QDRAW_DECODER 0 #define CONFIG_QPEG_DECODER 0 #define CONFIG_QTRLE_DECODER 0 +#define CONFIG_R10K_DECODER 0 #define CONFIG_R210_DECODER 0 #define CONFIG_RAWVIDEO_DECODER 0 #define CONFIG_RL2_DECODER 0 @@ -368,6 +376,7 @@ #define CONFIG_ZLIB_DECODER 0 #define CONFIG_ZMBV_DECODER 0 #define CONFIG_AAC_DECODER 1 +#define CONFIG_AAC_LATM_DECODER 0 #define CONFIG_AC3_DECODER 0 #define CONFIG_ALAC_DECODER 0 #define CONFIG_ALS_DECODER 0 @@ -425,20 +434,21 @@ #define CONFIG_PCM_BLURAY_DECODER 0 #define CONFIG_PCM_DVD_DECODER 0 #define CONFIG_PCM_F32BE_DECODER 0 -#define CONFIG_PCM_F32LE_DECODER 0 +#define CONFIG_PCM_F32LE_DECODER 1 #define CONFIG_PCM_F64BE_DECODER 0 #define CONFIG_PCM_F64LE_DECODER 0 +#define CONFIG_PCM_LXF_DECODER 0 #define CONFIG_PCM_MULAW_DECODER 0 #define CONFIG_PCM_S8_DECODER 0 #define CONFIG_PCM_S16BE_DECODER 0 -#define CONFIG_PCM_S16LE_DECODER 0 +#define CONFIG_PCM_S16LE_DECODER 1 #define CONFIG_PCM_S16LE_PLANAR_DECODER 0 #define CONFIG_PCM_S24BE_DECODER 0 #define CONFIG_PCM_S24DAUD_DECODER 0 #define CONFIG_PCM_S24LE_DECODER 0 #define CONFIG_PCM_S32BE_DECODER 0 #define CONFIG_PCM_S32LE_DECODER 0 -#define CONFIG_PCM_U8_DECODER 0 +#define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 #define CONFIG_PCM_U24BE_DECODER 0 @@ -459,6 +469,7 @@ #define CONFIG_ADPCM_EA_R2_DECODER 0 #define CONFIG_ADPCM_EA_R3_DECODER 0 #define CONFIG_ADPCM_EA_XAS_DECODER 0 +#define CONFIG_ADPCM_G722_DECODER 0 #define CONFIG_ADPCM_G726_DECODER 0 #define CONFIG_ADPCM_IMA_AMV_DECODER 0 #define CONFIG_ADPCM_IMA_DK3_DECODER 0 @@ -491,6 +502,8 @@ #define CONFIG_LIBSCHROEDINGER_DECODER 0 #define CONFIG_LIBSPEEX_DECODER 0 #define CONFIG_LIBVPX_DECODER 0 +#define CONFIG_A64MULTI_ENCODER 0 +#define CONFIG_A64MULTI5_ENCODER 0 #define CONFIG_ASV1_ENCODER 0 #define CONFIG_ASV2_ENCODER 0 #define CONFIG_BMP_ENCODER 0 @@ -572,6 +585,7 @@ #define CONFIG_PCM_ZORK_ENCODER 0 #define CONFIG_ROQ_DPCM_ENCODER 0 #define CONFIG_ADPCM_ADX_ENCODER 0 +#define CONFIG_ADPCM_G722_ENCODER 0 #define CONFIG_ADPCM_G726_ENCODER 0 #define CONFIG_ADPCM_IMA_QT_ENCODER 0 #define CONFIG_ADPCM_IMA_WAV_ENCODER 0 @@ -605,6 +619,7 @@ #define CONFIG_WMV3_DXVA2_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_AAC_PARSER 0 +#define CONFIG_AAC_LATM_PARSER 0 #define CONFIG_AC3_PARSER 0 #define CONFIG_CAVSVIDEO_PARSER 0 #define CONFIG_DCA_PARSER 0 @@ -647,6 +662,7 @@ #define CONFIG_ANM_DEMUXER 0 #define CONFIG_APC_DEMUXER 0 #define CONFIG_APE_DEMUXER 0 +#define CONFIG_APPLEHTTP_DEMUXER 0 #define CONFIG_ASF_DEMUXER 0 #define CONFIG_ASS_DEMUXER 0 #define CONFIG_AU_DEMUXER 0 @@ -676,6 +692,7 @@ #define CONFIG_FLIC_DEMUXER 0 #define CONFIG_FLV_DEMUXER 0 #define CONFIG_FOURXM_DEMUXER 0 +#define CONFIG_G722_DEMUXER 0 #define CONFIG_GSM_DEMUXER 0 #define CONFIG_GXF_DEMUXER 0 #define CONFIG_H261_DEMUXER 0 @@ -691,6 +708,7 @@ #define CONFIG_IV8_DEMUXER 0 #define CONFIG_IVF_DEMUXER 0 #define CONFIG_LMLM4_DEMUXER 0 +#define CONFIG_LXF_DEMUXER 0 #define CONFIG_M4V_DEMUXER 0 #define CONFIG_MATROSKA_DEMUXER 1 #define CONFIG_MJPEG_DEMUXER 0 @@ -744,7 +762,9 @@ #define CONFIG_ROQ_DEMUXER 0 #define CONFIG_RPL_DEMUXER 0 #define CONFIG_RSO_DEMUXER 0 +#define CONFIG_RTP_DEMUXER 0 #define CONFIG_RTSP_DEMUXER 0 +#define CONFIG_SAP_DEMUXER 0 #define CONFIG_SDP_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 @@ -768,8 +788,9 @@ #define CONFIG_VOC_DEMUXER 0 #define CONFIG_VQF_DEMUXER 0 #define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_DEMUXER 0 +#define CONFIG_WAV_DEMUXER 1 #define CONFIG_WC3_DEMUXER 0 +#define CONFIG_WEBP_DEMUXER 0 #define CONFIG_WSAUD_DEMUXER 0 #define CONFIG_WSVQA_DEMUXER 0 #define CONFIG_WV_DEMUXER 0 @@ -777,6 +798,7 @@ #define CONFIG_YOP_DEMUXER 0 #define CONFIG_YUV4MPEGPIPE_DEMUXER 0 #define CONFIG_LIBNUT_DEMUXER 0 +#define CONFIG_A64_MUXER 0 #define CONFIG_AC3_MUXER 0 #define CONFIG_ADTS_MUXER 0 #define CONFIG_AIFF_MUXER 0 @@ -801,6 +823,7 @@ #define CONFIG_FLV_MUXER 0 #define CONFIG_FRAMECRC_MUXER 0 #define CONFIG_FRAMEMD5_MUXER 0 +#define CONFIG_G722_MUXER 0 #define CONFIG_GIF_MUXER 0 #define CONFIG_GXF_MUXER 0 #define CONFIG_H261_MUXER 0 @@ -861,6 +884,7 @@ #define CONFIG_RSO_MUXER 0 #define CONFIG_RTP_MUXER 0 #define CONFIG_RTSP_MUXER 0 +#define CONFIG_SAP_MUXER 0 #define CONFIG_SOX_MUXER 0 #define CONFIG_SPDIF_MUXER 0 #define CONFIG_SRT_MUXER 0 @@ -872,21 +896,36 @@ #define CONFIG_VOC_MUXER 0 #define CONFIG_WAV_MUXER 0 #define CONFIG_WEBM_MUXER 0 +#define CONFIG_WEBP_MUXER 0 #define CONFIG_YUV4MPEGPIPE_MUXER 0 #define CONFIG_LIBNUT_MUXER 0 +#define CONFIG_ANULL_FILTER 0 +#define CONFIG_ANULLSRC_FILTER 0 +#define CONFIG_ANULLSINK_FILTER 0 #define CONFIG_ASPECT_FILTER 0 +#define CONFIG_BLACKFRAME_FILTER 0 #define CONFIG_CROP_FILTER 0 +#define CONFIG_CROPDETECT_FILTER 0 +#define CONFIG_DRAWBOX_FILTER 0 +#define CONFIG_FIFO_FILTER 0 #define CONFIG_FORMAT_FILTER 0 +#define CONFIG_FREI0R_FILTER 0 +#define CONFIG_HFLIP_FILTER 0 #define CONFIG_NOFORMAT_FILTER 0 #define CONFIG_NULL_FILTER 0 +#define CONFIG_OCV_SMOOTH_FILTER 0 #define CONFIG_PAD_FILTER 0 #define CONFIG_PIXDESCTEST_FILTER 0 #define CONFIG_PIXELASPECT_FILTER 0 #define CONFIG_SCALE_FILTER 0 +#define CONFIG_SETPTS_FILTER 0 +#define CONFIG_SETTB_FILTER 0 #define CONFIG_SLICIFY_FILTER 0 +#define CONFIG_TRANSPOSE_FILTER 0 #define CONFIG_UNSHARP_FILTER 0 #define CONFIG_VFLIP_FILTER 0 -#define CONFIG_BUFFER_FILTER 1 +#define CONFIG_YADIF_FILTER 0 +#define CONFIG_BUFFER_FILTER 0 #define CONFIG_COLOR_FILTER 0 #define CONFIG_NULLSRC_FILTER 0 #define CONFIG_NULLSINK_FILTER 0 @@ -894,6 +933,7 @@ #define CONFIG_FILE_PROTOCOL 0 #define CONFIG_GOPHER_PROTOCOL 0 #define CONFIG_HTTP_PROTOCOL 0 +#define CONFIG_MMSH_PROTOCOL 0 #define CONFIG_MMST_PROTOCOL 0 #define CONFIG_MD5_PROTOCOL 0 #define CONFIG_PIPE_PROTOCOL 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chrome/linux/ia32/config.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chrome/linux/ia32/config.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chrome/linux/ia32/config.h 2010-08-18 02:00:49.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chrome/linux/ia32/config.h 2011-02-03 22:58:22.000000000 +0000 @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --enable-shared --enable-libvpx --enable-decoder='theora,vorbis,libvpx,aac,h264,mp3' --enable-demuxer='ogg,matroska,mp3,mov' --enable-parser=mpegaudio --extra-cflags='-m32 -fPIC' --extra-ldflags='-m32 -L../../libvpx/linux32/lib'" +#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --disable-swscale --disable-amd3dnow --disable-amd3dnowext --enable-shared --enable-libvpx --enable-decoder='theora,vorbis,libvpx,pcm_u8,pcm_s16le,pcm_f32le,aac,h264,mp3' --enable-encoder=libvpx --enable-demuxer='ogg,matroska,wav,mp3,mov' --enable-parser=mpegaudio --extra-cflags='-m32 -fPIC' --extra-ldflags='-m32 -L../../libvpx/linux32/usr/local/lib'" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define CC_TYPE "gcc" @@ -9,7 +9,8 @@ #define restrict restrict #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t" #define EXTERN_PREFIX "" -#define EXTERN_ASM +#define EXTERN_ASM +#define SLIBSUF ".so" #define ARCH_ALPHA 0 #define ARCH_ARM 0 #define ARCH_AVR32 0 @@ -32,8 +33,8 @@ #define ARCH_X86_32 1 #define ARCH_X86_64 0 #define HAVE_ALTIVEC 0 -#define HAVE_AMD3DNOW 1 -#define HAVE_AMD3DNOWEXT 1 +#define HAVE_AMD3DNOW 0 +#define HAVE_AMD3DNOWEXT 0 #define HAVE_ARMV5TE 0 #define HAVE_ARMV6 0 #define HAVE_ARMV6T2 0 @@ -51,6 +52,7 @@ #define HAVE_FAST_UNALIGNED 1 #define HAVE_PTHREADS 1 #define HAVE_W32THREADS 0 +#define HAVE_ALIGNED_STACK 1 #define HAVE_ALSA_ASOUNDLIB_H 0 #define HAVE_ALTIVEC_H 0 #define HAVE_ARPA_INET_H 0 @@ -119,6 +121,7 @@ #define HAVE_POLL_H 1 #define HAVE_SETRLIMIT 1 #define HAVE_STRERROR_R 1 +#define HAVE_STRTOK_R 1 #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 @@ -140,11 +143,12 @@ #define HAVE_VIRTUALALLOC 0 #define HAVE_WINSOCK2_H 0 #define HAVE_XFORM_ASM 0 +#define HAVE_XMM_CLOBBERS 0 #define HAVE_YASM 1 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 #define CONFIG_DEMUXERS 1 -#define CONFIG_ENCODERS 0 +#define CONFIG_ENCODERS 1 #define CONFIG_FILTERS 0 #define CONFIG_HWACCELS 0 #define CONFIG_INDEVS 0 @@ -165,11 +169,12 @@ #define CONFIG_DWT 0 #define CONFIG_DXVA2 0 #define CONFIG_FASTDIV 1 -#define CONFIG_FFMPEG 1 +#define CONFIG_FFMPEG 0 #define CONFIG_FFPLAY 0 #define CONFIG_FFPROBE 1 #define CONFIG_FFSERVER 0 #define CONFIG_FFT 1 +#define CONFIG_FREI0R 0 #define CONFIG_GOLOMB 1 #define CONFIG_GPL 0 #define CONFIG_GRAY 0 @@ -185,6 +190,7 @@ #define CONFIG_LIBNUT 0 #define CONFIG_LIBOPENCORE_AMRNB 0 #define CONFIG_LIBOPENCORE_AMRWB 0 +#define CONFIG_LIBOPENCV 0 #define CONFIG_LIBOPENJPEG 0 #define CONFIG_LIBRTMP 0 #define CONFIG_LIBSCHROEDINGER 0 @@ -206,12 +212,13 @@ #define CONFIG_PIC 1 #define CONFIG_POSTPROC 0 #define CONFIG_RDFT 1 +#define CONFIG_RTPDEC 0 #define CONFIG_RUNTIME_CPUDETECT 0 #define CONFIG_SHARED 1 #define CONFIG_SMALL 0 #define CONFIG_SRAM 0 #define CONFIG_STATIC 1 -#define CONFIG_SWSCALE 1 +#define CONFIG_SWSCALE 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_VAAPI 0 #define CONFIG_VDPAU 0 @@ -314,6 +321,7 @@ #define CONFIG_QDRAW_DECODER 0 #define CONFIG_QPEG_DECODER 0 #define CONFIG_QTRLE_DECODER 0 +#define CONFIG_R10K_DECODER 0 #define CONFIG_R210_DECODER 0 #define CONFIG_RAWVIDEO_DECODER 0 #define CONFIG_RL2_DECODER 0 @@ -368,6 +376,7 @@ #define CONFIG_ZLIB_DECODER 0 #define CONFIG_ZMBV_DECODER 0 #define CONFIG_AAC_DECODER 1 +#define CONFIG_AAC_LATM_DECODER 0 #define CONFIG_AC3_DECODER 0 #define CONFIG_ALAC_DECODER 0 #define CONFIG_ALS_DECODER 0 @@ -425,20 +434,21 @@ #define CONFIG_PCM_BLURAY_DECODER 0 #define CONFIG_PCM_DVD_DECODER 0 #define CONFIG_PCM_F32BE_DECODER 0 -#define CONFIG_PCM_F32LE_DECODER 0 +#define CONFIG_PCM_F32LE_DECODER 1 #define CONFIG_PCM_F64BE_DECODER 0 #define CONFIG_PCM_F64LE_DECODER 0 +#define CONFIG_PCM_LXF_DECODER 0 #define CONFIG_PCM_MULAW_DECODER 0 #define CONFIG_PCM_S8_DECODER 0 #define CONFIG_PCM_S16BE_DECODER 0 -#define CONFIG_PCM_S16LE_DECODER 0 +#define CONFIG_PCM_S16LE_DECODER 1 #define CONFIG_PCM_S16LE_PLANAR_DECODER 0 #define CONFIG_PCM_S24BE_DECODER 0 #define CONFIG_PCM_S24DAUD_DECODER 0 #define CONFIG_PCM_S24LE_DECODER 0 #define CONFIG_PCM_S32BE_DECODER 0 #define CONFIG_PCM_S32LE_DECODER 0 -#define CONFIG_PCM_U8_DECODER 0 +#define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 #define CONFIG_PCM_U24BE_DECODER 0 @@ -459,6 +469,7 @@ #define CONFIG_ADPCM_EA_R2_DECODER 0 #define CONFIG_ADPCM_EA_R3_DECODER 0 #define CONFIG_ADPCM_EA_XAS_DECODER 0 +#define CONFIG_ADPCM_G722_DECODER 0 #define CONFIG_ADPCM_G726_DECODER 0 #define CONFIG_ADPCM_IMA_AMV_DECODER 0 #define CONFIG_ADPCM_IMA_DK3_DECODER 0 @@ -491,6 +502,8 @@ #define CONFIG_LIBSCHROEDINGER_DECODER 0 #define CONFIG_LIBSPEEX_DECODER 0 #define CONFIG_LIBVPX_DECODER 1 +#define CONFIG_A64MULTI_ENCODER 0 +#define CONFIG_A64MULTI5_ENCODER 0 #define CONFIG_ASV1_ENCODER 0 #define CONFIG_ASV2_ENCODER 0 #define CONFIG_BMP_ENCODER 0 @@ -572,6 +585,7 @@ #define CONFIG_PCM_ZORK_ENCODER 0 #define CONFIG_ROQ_DPCM_ENCODER 0 #define CONFIG_ADPCM_ADX_ENCODER 0 +#define CONFIG_ADPCM_G722_ENCODER 0 #define CONFIG_ADPCM_G726_ENCODER 0 #define CONFIG_ADPCM_IMA_QT_ENCODER 0 #define CONFIG_ADPCM_IMA_WAV_ENCODER 0 @@ -590,7 +604,7 @@ #define CONFIG_LIBSCHROEDINGER_ENCODER 0 #define CONFIG_LIBTHEORA_ENCODER 0 #define CONFIG_LIBVORBIS_ENCODER 0 -#define CONFIG_LIBVPX_ENCODER 0 +#define CONFIG_LIBVPX_ENCODER 1 #define CONFIG_LIBX264_ENCODER 0 #define CONFIG_LIBXAVS_ENCODER 0 #define CONFIG_LIBXVID_ENCODER 0 @@ -605,6 +619,7 @@ #define CONFIG_WMV3_DXVA2_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_AAC_PARSER 0 +#define CONFIG_AAC_LATM_PARSER 0 #define CONFIG_AC3_PARSER 0 #define CONFIG_CAVSVIDEO_PARSER 0 #define CONFIG_DCA_PARSER 0 @@ -647,6 +662,7 @@ #define CONFIG_ANM_DEMUXER 0 #define CONFIG_APC_DEMUXER 0 #define CONFIG_APE_DEMUXER 0 +#define CONFIG_APPLEHTTP_DEMUXER 0 #define CONFIG_ASF_DEMUXER 0 #define CONFIG_ASS_DEMUXER 0 #define CONFIG_AU_DEMUXER 0 @@ -676,6 +692,7 @@ #define CONFIG_FLIC_DEMUXER 0 #define CONFIG_FLV_DEMUXER 0 #define CONFIG_FOURXM_DEMUXER 0 +#define CONFIG_G722_DEMUXER 0 #define CONFIG_GSM_DEMUXER 0 #define CONFIG_GXF_DEMUXER 0 #define CONFIG_H261_DEMUXER 0 @@ -691,6 +708,7 @@ #define CONFIG_IV8_DEMUXER 0 #define CONFIG_IVF_DEMUXER 0 #define CONFIG_LMLM4_DEMUXER 0 +#define CONFIG_LXF_DEMUXER 0 #define CONFIG_M4V_DEMUXER 0 #define CONFIG_MATROSKA_DEMUXER 1 #define CONFIG_MJPEG_DEMUXER 0 @@ -744,7 +762,9 @@ #define CONFIG_ROQ_DEMUXER 0 #define CONFIG_RPL_DEMUXER 0 #define CONFIG_RSO_DEMUXER 0 +#define CONFIG_RTP_DEMUXER 0 #define CONFIG_RTSP_DEMUXER 0 +#define CONFIG_SAP_DEMUXER 0 #define CONFIG_SDP_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 @@ -768,8 +788,9 @@ #define CONFIG_VOC_DEMUXER 0 #define CONFIG_VQF_DEMUXER 0 #define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_DEMUXER 0 +#define CONFIG_WAV_DEMUXER 1 #define CONFIG_WC3_DEMUXER 0 +#define CONFIG_WEBP_DEMUXER 0 #define CONFIG_WSAUD_DEMUXER 0 #define CONFIG_WSVQA_DEMUXER 0 #define CONFIG_WV_DEMUXER 0 @@ -777,6 +798,7 @@ #define CONFIG_YOP_DEMUXER 0 #define CONFIG_YUV4MPEGPIPE_DEMUXER 0 #define CONFIG_LIBNUT_DEMUXER 0 +#define CONFIG_A64_MUXER 0 #define CONFIG_AC3_MUXER 0 #define CONFIG_ADTS_MUXER 0 #define CONFIG_AIFF_MUXER 0 @@ -801,6 +823,7 @@ #define CONFIG_FLV_MUXER 0 #define CONFIG_FRAMECRC_MUXER 0 #define CONFIG_FRAMEMD5_MUXER 0 +#define CONFIG_G722_MUXER 0 #define CONFIG_GIF_MUXER 0 #define CONFIG_GXF_MUXER 0 #define CONFIG_H261_MUXER 0 @@ -861,6 +884,7 @@ #define CONFIG_RSO_MUXER 0 #define CONFIG_RTP_MUXER 0 #define CONFIG_RTSP_MUXER 0 +#define CONFIG_SAP_MUXER 0 #define CONFIG_SOX_MUXER 0 #define CONFIG_SPDIF_MUXER 0 #define CONFIG_SRT_MUXER 0 @@ -872,21 +896,36 @@ #define CONFIG_VOC_MUXER 0 #define CONFIG_WAV_MUXER 0 #define CONFIG_WEBM_MUXER 0 +#define CONFIG_WEBP_MUXER 0 #define CONFIG_YUV4MPEGPIPE_MUXER 0 #define CONFIG_LIBNUT_MUXER 0 +#define CONFIG_ANULL_FILTER 0 +#define CONFIG_ANULLSRC_FILTER 0 +#define CONFIG_ANULLSINK_FILTER 0 #define CONFIG_ASPECT_FILTER 0 +#define CONFIG_BLACKFRAME_FILTER 0 #define CONFIG_CROP_FILTER 0 +#define CONFIG_CROPDETECT_FILTER 0 +#define CONFIG_DRAWBOX_FILTER 0 +#define CONFIG_FIFO_FILTER 0 #define CONFIG_FORMAT_FILTER 0 +#define CONFIG_FREI0R_FILTER 0 +#define CONFIG_HFLIP_FILTER 0 #define CONFIG_NOFORMAT_FILTER 0 #define CONFIG_NULL_FILTER 0 +#define CONFIG_OCV_SMOOTH_FILTER 0 #define CONFIG_PAD_FILTER 0 #define CONFIG_PIXDESCTEST_FILTER 0 #define CONFIG_PIXELASPECT_FILTER 0 #define CONFIG_SCALE_FILTER 0 +#define CONFIG_SETPTS_FILTER 0 +#define CONFIG_SETTB_FILTER 0 #define CONFIG_SLICIFY_FILTER 0 +#define CONFIG_TRANSPOSE_FILTER 0 #define CONFIG_UNSHARP_FILTER 0 #define CONFIG_VFLIP_FILTER 0 -#define CONFIG_BUFFER_FILTER 1 +#define CONFIG_YADIF_FILTER 0 +#define CONFIG_BUFFER_FILTER 0 #define CONFIG_COLOR_FILTER 0 #define CONFIG_NULLSRC_FILTER 0 #define CONFIG_NULLSINK_FILTER 0 @@ -894,6 +933,7 @@ #define CONFIG_FILE_PROTOCOL 0 #define CONFIG_GOPHER_PROTOCOL 0 #define CONFIG_HTTP_PROTOCOL 0 +#define CONFIG_MMSH_PROTOCOL 0 #define CONFIG_MMST_PROTOCOL 0 #define CONFIG_MD5_PROTOCOL 0 #define CONFIG_PIPE_PROTOCOL 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chrome/linux/x64/config.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chrome/linux/x64/config.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chrome/linux/x64/config.h 2010-08-18 02:00:49.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chrome/linux/x64/config.h 2011-02-03 22:58:22.000000000 +0000 @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --enable-shared --enable-libvpx --enable-decoder='theora,vorbis,libvpx,aac,h264,mp3' --enable-demuxer='ogg,matroska,mp3,mov' --enable-parser=mpegaudio" +#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --disable-swscale --disable-amd3dnow --disable-amd3dnowext --enable-shared --enable-libvpx --enable-decoder='theora,vorbis,libvpx,pcm_u8,pcm_s16le,pcm_f32le,aac,h264,mp3' --enable-encoder=libvpx --enable-demuxer='ogg,matroska,wav,mp3,mov' --enable-parser=mpegaudio --extra-ldflags=-L../../libvpx/linux64/usr/local/lib" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define CC_TYPE "gcc" @@ -9,7 +9,8 @@ #define restrict restrict #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t" #define EXTERN_PREFIX "" -#define EXTERN_ASM +#define EXTERN_ASM +#define SLIBSUF ".so" #define ARCH_ALPHA 0 #define ARCH_ARM 0 #define ARCH_AVR32 0 @@ -32,8 +33,8 @@ #define ARCH_X86_32 0 #define ARCH_X86_64 1 #define HAVE_ALTIVEC 0 -#define HAVE_AMD3DNOW 1 -#define HAVE_AMD3DNOWEXT 1 +#define HAVE_AMD3DNOW 0 +#define HAVE_AMD3DNOWEXT 0 #define HAVE_ARMV5TE 0 #define HAVE_ARMV6 0 #define HAVE_ARMV6T2 0 @@ -51,6 +52,7 @@ #define HAVE_FAST_UNALIGNED 1 #define HAVE_PTHREADS 1 #define HAVE_W32THREADS 0 +#define HAVE_ALIGNED_STACK 1 #define HAVE_ALSA_ASOUNDLIB_H 0 #define HAVE_ALTIVEC_H 0 #define HAVE_ARPA_INET_H 0 @@ -119,6 +121,7 @@ #define HAVE_POLL_H 1 #define HAVE_SETRLIMIT 1 #define HAVE_STRERROR_R 1 +#define HAVE_STRTOK_R 1 #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 @@ -140,11 +143,12 @@ #define HAVE_VIRTUALALLOC 0 #define HAVE_WINSOCK2_H 0 #define HAVE_XFORM_ASM 0 +#define HAVE_XMM_CLOBBERS 1 #define HAVE_YASM 1 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 #define CONFIG_DEMUXERS 1 -#define CONFIG_ENCODERS 0 +#define CONFIG_ENCODERS 1 #define CONFIG_FILTERS 0 #define CONFIG_HWACCELS 0 #define CONFIG_INDEVS 0 @@ -165,11 +169,12 @@ #define CONFIG_DWT 0 #define CONFIG_DXVA2 0 #define CONFIG_FASTDIV 1 -#define CONFIG_FFMPEG 1 +#define CONFIG_FFMPEG 0 #define CONFIG_FFPLAY 0 #define CONFIG_FFPROBE 1 #define CONFIG_FFSERVER 0 #define CONFIG_FFT 1 +#define CONFIG_FREI0R 0 #define CONFIG_GOLOMB 1 #define CONFIG_GPL 0 #define CONFIG_GRAY 0 @@ -185,6 +190,7 @@ #define CONFIG_LIBNUT 0 #define CONFIG_LIBOPENCORE_AMRNB 0 #define CONFIG_LIBOPENCORE_AMRWB 0 +#define CONFIG_LIBOPENCV 0 #define CONFIG_LIBOPENJPEG 0 #define CONFIG_LIBRTMP 0 #define CONFIG_LIBSCHROEDINGER 0 @@ -206,12 +212,13 @@ #define CONFIG_PIC 1 #define CONFIG_POSTPROC 0 #define CONFIG_RDFT 1 +#define CONFIG_RTPDEC 0 #define CONFIG_RUNTIME_CPUDETECT 0 #define CONFIG_SHARED 1 #define CONFIG_SMALL 0 #define CONFIG_SRAM 0 #define CONFIG_STATIC 1 -#define CONFIG_SWSCALE 1 +#define CONFIG_SWSCALE 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_VAAPI 0 #define CONFIG_VDPAU 0 @@ -314,6 +321,7 @@ #define CONFIG_QDRAW_DECODER 0 #define CONFIG_QPEG_DECODER 0 #define CONFIG_QTRLE_DECODER 0 +#define CONFIG_R10K_DECODER 0 #define CONFIG_R210_DECODER 0 #define CONFIG_RAWVIDEO_DECODER 0 #define CONFIG_RL2_DECODER 0 @@ -368,6 +376,7 @@ #define CONFIG_ZLIB_DECODER 0 #define CONFIG_ZMBV_DECODER 0 #define CONFIG_AAC_DECODER 1 +#define CONFIG_AAC_LATM_DECODER 0 #define CONFIG_AC3_DECODER 0 #define CONFIG_ALAC_DECODER 0 #define CONFIG_ALS_DECODER 0 @@ -425,20 +434,21 @@ #define CONFIG_PCM_BLURAY_DECODER 0 #define CONFIG_PCM_DVD_DECODER 0 #define CONFIG_PCM_F32BE_DECODER 0 -#define CONFIG_PCM_F32LE_DECODER 0 +#define CONFIG_PCM_F32LE_DECODER 1 #define CONFIG_PCM_F64BE_DECODER 0 #define CONFIG_PCM_F64LE_DECODER 0 +#define CONFIG_PCM_LXF_DECODER 0 #define CONFIG_PCM_MULAW_DECODER 0 #define CONFIG_PCM_S8_DECODER 0 #define CONFIG_PCM_S16BE_DECODER 0 -#define CONFIG_PCM_S16LE_DECODER 0 +#define CONFIG_PCM_S16LE_DECODER 1 #define CONFIG_PCM_S16LE_PLANAR_DECODER 0 #define CONFIG_PCM_S24BE_DECODER 0 #define CONFIG_PCM_S24DAUD_DECODER 0 #define CONFIG_PCM_S24LE_DECODER 0 #define CONFIG_PCM_S32BE_DECODER 0 #define CONFIG_PCM_S32LE_DECODER 0 -#define CONFIG_PCM_U8_DECODER 0 +#define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 #define CONFIG_PCM_U24BE_DECODER 0 @@ -459,6 +469,7 @@ #define CONFIG_ADPCM_EA_R2_DECODER 0 #define CONFIG_ADPCM_EA_R3_DECODER 0 #define CONFIG_ADPCM_EA_XAS_DECODER 0 +#define CONFIG_ADPCM_G722_DECODER 0 #define CONFIG_ADPCM_G726_DECODER 0 #define CONFIG_ADPCM_IMA_AMV_DECODER 0 #define CONFIG_ADPCM_IMA_DK3_DECODER 0 @@ -491,6 +502,8 @@ #define CONFIG_LIBSCHROEDINGER_DECODER 0 #define CONFIG_LIBSPEEX_DECODER 0 #define CONFIG_LIBVPX_DECODER 1 +#define CONFIG_A64MULTI_ENCODER 0 +#define CONFIG_A64MULTI5_ENCODER 0 #define CONFIG_ASV1_ENCODER 0 #define CONFIG_ASV2_ENCODER 0 #define CONFIG_BMP_ENCODER 0 @@ -572,6 +585,7 @@ #define CONFIG_PCM_ZORK_ENCODER 0 #define CONFIG_ROQ_DPCM_ENCODER 0 #define CONFIG_ADPCM_ADX_ENCODER 0 +#define CONFIG_ADPCM_G722_ENCODER 0 #define CONFIG_ADPCM_G726_ENCODER 0 #define CONFIG_ADPCM_IMA_QT_ENCODER 0 #define CONFIG_ADPCM_IMA_WAV_ENCODER 0 @@ -590,7 +604,7 @@ #define CONFIG_LIBSCHROEDINGER_ENCODER 0 #define CONFIG_LIBTHEORA_ENCODER 0 #define CONFIG_LIBVORBIS_ENCODER 0 -#define CONFIG_LIBVPX_ENCODER 0 +#define CONFIG_LIBVPX_ENCODER 1 #define CONFIG_LIBX264_ENCODER 0 #define CONFIG_LIBXAVS_ENCODER 0 #define CONFIG_LIBXVID_ENCODER 0 @@ -605,6 +619,7 @@ #define CONFIG_WMV3_DXVA2_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_AAC_PARSER 0 +#define CONFIG_AAC_LATM_PARSER 0 #define CONFIG_AC3_PARSER 0 #define CONFIG_CAVSVIDEO_PARSER 0 #define CONFIG_DCA_PARSER 0 @@ -647,6 +662,7 @@ #define CONFIG_ANM_DEMUXER 0 #define CONFIG_APC_DEMUXER 0 #define CONFIG_APE_DEMUXER 0 +#define CONFIG_APPLEHTTP_DEMUXER 0 #define CONFIG_ASF_DEMUXER 0 #define CONFIG_ASS_DEMUXER 0 #define CONFIG_AU_DEMUXER 0 @@ -676,6 +692,7 @@ #define CONFIG_FLIC_DEMUXER 0 #define CONFIG_FLV_DEMUXER 0 #define CONFIG_FOURXM_DEMUXER 0 +#define CONFIG_G722_DEMUXER 0 #define CONFIG_GSM_DEMUXER 0 #define CONFIG_GXF_DEMUXER 0 #define CONFIG_H261_DEMUXER 0 @@ -691,6 +708,7 @@ #define CONFIG_IV8_DEMUXER 0 #define CONFIG_IVF_DEMUXER 0 #define CONFIG_LMLM4_DEMUXER 0 +#define CONFIG_LXF_DEMUXER 0 #define CONFIG_M4V_DEMUXER 0 #define CONFIG_MATROSKA_DEMUXER 1 #define CONFIG_MJPEG_DEMUXER 0 @@ -744,7 +762,9 @@ #define CONFIG_ROQ_DEMUXER 0 #define CONFIG_RPL_DEMUXER 0 #define CONFIG_RSO_DEMUXER 0 +#define CONFIG_RTP_DEMUXER 0 #define CONFIG_RTSP_DEMUXER 0 +#define CONFIG_SAP_DEMUXER 0 #define CONFIG_SDP_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 @@ -768,8 +788,9 @@ #define CONFIG_VOC_DEMUXER 0 #define CONFIG_VQF_DEMUXER 0 #define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_DEMUXER 0 +#define CONFIG_WAV_DEMUXER 1 #define CONFIG_WC3_DEMUXER 0 +#define CONFIG_WEBP_DEMUXER 0 #define CONFIG_WSAUD_DEMUXER 0 #define CONFIG_WSVQA_DEMUXER 0 #define CONFIG_WV_DEMUXER 0 @@ -777,6 +798,7 @@ #define CONFIG_YOP_DEMUXER 0 #define CONFIG_YUV4MPEGPIPE_DEMUXER 0 #define CONFIG_LIBNUT_DEMUXER 0 +#define CONFIG_A64_MUXER 0 #define CONFIG_AC3_MUXER 0 #define CONFIG_ADTS_MUXER 0 #define CONFIG_AIFF_MUXER 0 @@ -801,6 +823,7 @@ #define CONFIG_FLV_MUXER 0 #define CONFIG_FRAMECRC_MUXER 0 #define CONFIG_FRAMEMD5_MUXER 0 +#define CONFIG_G722_MUXER 0 #define CONFIG_GIF_MUXER 0 #define CONFIG_GXF_MUXER 0 #define CONFIG_H261_MUXER 0 @@ -861,6 +884,7 @@ #define CONFIG_RSO_MUXER 0 #define CONFIG_RTP_MUXER 0 #define CONFIG_RTSP_MUXER 0 +#define CONFIG_SAP_MUXER 0 #define CONFIG_SOX_MUXER 0 #define CONFIG_SPDIF_MUXER 0 #define CONFIG_SRT_MUXER 0 @@ -872,21 +896,36 @@ #define CONFIG_VOC_MUXER 0 #define CONFIG_WAV_MUXER 0 #define CONFIG_WEBM_MUXER 0 +#define CONFIG_WEBP_MUXER 0 #define CONFIG_YUV4MPEGPIPE_MUXER 0 #define CONFIG_LIBNUT_MUXER 0 +#define CONFIG_ANULL_FILTER 0 +#define CONFIG_ANULLSRC_FILTER 0 +#define CONFIG_ANULLSINK_FILTER 0 #define CONFIG_ASPECT_FILTER 0 +#define CONFIG_BLACKFRAME_FILTER 0 #define CONFIG_CROP_FILTER 0 +#define CONFIG_CROPDETECT_FILTER 0 +#define CONFIG_DRAWBOX_FILTER 0 +#define CONFIG_FIFO_FILTER 0 #define CONFIG_FORMAT_FILTER 0 +#define CONFIG_FREI0R_FILTER 0 +#define CONFIG_HFLIP_FILTER 0 #define CONFIG_NOFORMAT_FILTER 0 #define CONFIG_NULL_FILTER 0 +#define CONFIG_OCV_SMOOTH_FILTER 0 #define CONFIG_PAD_FILTER 0 #define CONFIG_PIXDESCTEST_FILTER 0 #define CONFIG_PIXELASPECT_FILTER 0 #define CONFIG_SCALE_FILTER 0 +#define CONFIG_SETPTS_FILTER 0 +#define CONFIG_SETTB_FILTER 0 #define CONFIG_SLICIFY_FILTER 0 +#define CONFIG_TRANSPOSE_FILTER 0 #define CONFIG_UNSHARP_FILTER 0 #define CONFIG_VFLIP_FILTER 0 -#define CONFIG_BUFFER_FILTER 1 +#define CONFIG_YADIF_FILTER 0 +#define CONFIG_BUFFER_FILTER 0 #define CONFIG_COLOR_FILTER 0 #define CONFIG_NULLSRC_FILTER 0 #define CONFIG_NULLSINK_FILTER 0 @@ -894,6 +933,7 @@ #define CONFIG_FILE_PROTOCOL 0 #define CONFIG_GOPHER_PROTOCOL 0 #define CONFIG_HTTP_PROTOCOL 0 +#define CONFIG_MMSH_PROTOCOL 0 #define CONFIG_MMST_PROTOCOL 0 #define CONFIG_MD5_PROTOCOL 0 #define CONFIG_PIPE_PROTOCOL 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chromium/linux/arm/config.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chromium/linux/arm/config.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chromium/linux/arm/config.h 2010-08-18 02:00:48.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chromium/linux/arm/config.h 2011-02-03 22:58:19.000000000 +0000 @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --enable-shared --enable-decoder='theora,vorbis,libvpx' --enable-demuxer='ogg,matroska' --enable-cross-compile --arch=arm --target-os=linux --enable-armv6 --enable-armv6t2 --enable-armvfp --disable-neon --cross-prefix=/usr/local/google/cross-tools/arm-2009q3/bin/arm-none-linux-gnueabi- --extra-cflags='-march=armv7-a -mtune=cortex-a8 -mfpu=vfp -mfloat-abi=softfp'" +#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --disable-swscale --enable-shared --enable-decoder='theora,vorbis,pcm_u8,pcm_s16le,pcm_f32le' --enable-demuxer='ogg,matroska,wav' --enable-cross-compile --arch=arm --target-os=linux --enable-armv6 --enable-armv6t2 --enable-armvfp --disable-neon --cross-prefix=/usr/local/google/cross-tools/arm-2009q3/bin/arm-none-linux-gnueabi- --extra-cflags='-march=armv7-a -mtune=cortex-a8 -mfpu=vfp -mfloat-abi=softfp'" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define CC_TYPE "gcc" @@ -9,7 +9,8 @@ #define restrict restrict #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t" #define EXTERN_PREFIX "" -#define EXTERN_ASM +#define EXTERN_ASM +#define SLIBSUF ".so" #define ARCH_ALPHA 0 #define ARCH_ARM 1 #define ARCH_AVR32 0 @@ -51,6 +52,7 @@ #define HAVE_FAST_UNALIGNED 1 #define HAVE_PTHREADS 1 #define HAVE_W32THREADS 0 +#define HAVE_ALIGNED_STACK 0 #define HAVE_ALSA_ASOUNDLIB_H 0 #define HAVE_ALTIVEC_H 0 #define HAVE_ARPA_INET_H 0 @@ -119,6 +121,7 @@ #define HAVE_POLL_H 1 #define HAVE_SETRLIMIT 1 #define HAVE_STRERROR_R 1 +#define HAVE_STRTOK_R 1 #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 @@ -140,6 +143,7 @@ #define HAVE_VIRTUALALLOC 0 #define HAVE_WINSOCK2_H 0 #define HAVE_XFORM_ASM 0 +#define HAVE_XMM_CLOBBERS 0 #define HAVE_YASM 0 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 @@ -165,11 +169,12 @@ #define CONFIG_DWT 0 #define CONFIG_DXVA2 0 #define CONFIG_FASTDIV 1 -#define CONFIG_FFMPEG 1 +#define CONFIG_FFMPEG 0 #define CONFIG_FFPLAY 0 #define CONFIG_FFPROBE 1 #define CONFIG_FFSERVER 0 #define CONFIG_FFT 1 +#define CONFIG_FREI0R 0 #define CONFIG_GOLOMB 1 #define CONFIG_GPL 0 #define CONFIG_GRAY 0 @@ -185,6 +190,7 @@ #define CONFIG_LIBNUT 0 #define CONFIG_LIBOPENCORE_AMRNB 0 #define CONFIG_LIBOPENCORE_AMRWB 0 +#define CONFIG_LIBOPENCV 0 #define CONFIG_LIBOPENJPEG 0 #define CONFIG_LIBRTMP 0 #define CONFIG_LIBSCHROEDINGER 0 @@ -206,12 +212,13 @@ #define CONFIG_PIC 1 #define CONFIG_POSTPROC 0 #define CONFIG_RDFT 0 +#define CONFIG_RTPDEC 0 #define CONFIG_RUNTIME_CPUDETECT 0 #define CONFIG_SHARED 1 #define CONFIG_SMALL 0 #define CONFIG_SRAM 0 #define CONFIG_STATIC 1 -#define CONFIG_SWSCALE 1 +#define CONFIG_SWSCALE 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_VAAPI 0 #define CONFIG_VDPAU 0 @@ -314,6 +321,7 @@ #define CONFIG_QDRAW_DECODER 0 #define CONFIG_QPEG_DECODER 0 #define CONFIG_QTRLE_DECODER 0 +#define CONFIG_R10K_DECODER 0 #define CONFIG_R210_DECODER 0 #define CONFIG_RAWVIDEO_DECODER 0 #define CONFIG_RL2_DECODER 0 @@ -368,6 +376,7 @@ #define CONFIG_ZLIB_DECODER 0 #define CONFIG_ZMBV_DECODER 0 #define CONFIG_AAC_DECODER 0 +#define CONFIG_AAC_LATM_DECODER 0 #define CONFIG_AC3_DECODER 0 #define CONFIG_ALAC_DECODER 0 #define CONFIG_ALS_DECODER 0 @@ -425,20 +434,21 @@ #define CONFIG_PCM_BLURAY_DECODER 0 #define CONFIG_PCM_DVD_DECODER 0 #define CONFIG_PCM_F32BE_DECODER 0 -#define CONFIG_PCM_F32LE_DECODER 0 +#define CONFIG_PCM_F32LE_DECODER 1 #define CONFIG_PCM_F64BE_DECODER 0 #define CONFIG_PCM_F64LE_DECODER 0 +#define CONFIG_PCM_LXF_DECODER 0 #define CONFIG_PCM_MULAW_DECODER 0 #define CONFIG_PCM_S8_DECODER 0 #define CONFIG_PCM_S16BE_DECODER 0 -#define CONFIG_PCM_S16LE_DECODER 0 +#define CONFIG_PCM_S16LE_DECODER 1 #define CONFIG_PCM_S16LE_PLANAR_DECODER 0 #define CONFIG_PCM_S24BE_DECODER 0 #define CONFIG_PCM_S24DAUD_DECODER 0 #define CONFIG_PCM_S24LE_DECODER 0 #define CONFIG_PCM_S32BE_DECODER 0 #define CONFIG_PCM_S32LE_DECODER 0 -#define CONFIG_PCM_U8_DECODER 0 +#define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 #define CONFIG_PCM_U24BE_DECODER 0 @@ -459,6 +469,7 @@ #define CONFIG_ADPCM_EA_R2_DECODER 0 #define CONFIG_ADPCM_EA_R3_DECODER 0 #define CONFIG_ADPCM_EA_XAS_DECODER 0 +#define CONFIG_ADPCM_G722_DECODER 0 #define CONFIG_ADPCM_G726_DECODER 0 #define CONFIG_ADPCM_IMA_AMV_DECODER 0 #define CONFIG_ADPCM_IMA_DK3_DECODER 0 @@ -491,6 +502,8 @@ #define CONFIG_LIBSCHROEDINGER_DECODER 0 #define CONFIG_LIBSPEEX_DECODER 0 #define CONFIG_LIBVPX_DECODER 0 +#define CONFIG_A64MULTI_ENCODER 0 +#define CONFIG_A64MULTI5_ENCODER 0 #define CONFIG_ASV1_ENCODER 0 #define CONFIG_ASV2_ENCODER 0 #define CONFIG_BMP_ENCODER 0 @@ -572,6 +585,7 @@ #define CONFIG_PCM_ZORK_ENCODER 0 #define CONFIG_ROQ_DPCM_ENCODER 0 #define CONFIG_ADPCM_ADX_ENCODER 0 +#define CONFIG_ADPCM_G722_ENCODER 0 #define CONFIG_ADPCM_G726_ENCODER 0 #define CONFIG_ADPCM_IMA_QT_ENCODER 0 #define CONFIG_ADPCM_IMA_WAV_ENCODER 0 @@ -605,6 +619,7 @@ #define CONFIG_WMV3_DXVA2_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_AAC_PARSER 0 +#define CONFIG_AAC_LATM_PARSER 0 #define CONFIG_AC3_PARSER 0 #define CONFIG_CAVSVIDEO_PARSER 0 #define CONFIG_DCA_PARSER 0 @@ -647,6 +662,7 @@ #define CONFIG_ANM_DEMUXER 0 #define CONFIG_APC_DEMUXER 0 #define CONFIG_APE_DEMUXER 0 +#define CONFIG_APPLEHTTP_DEMUXER 0 #define CONFIG_ASF_DEMUXER 0 #define CONFIG_ASS_DEMUXER 0 #define CONFIG_AU_DEMUXER 0 @@ -676,6 +692,7 @@ #define CONFIG_FLIC_DEMUXER 0 #define CONFIG_FLV_DEMUXER 0 #define CONFIG_FOURXM_DEMUXER 0 +#define CONFIG_G722_DEMUXER 0 #define CONFIG_GSM_DEMUXER 0 #define CONFIG_GXF_DEMUXER 0 #define CONFIG_H261_DEMUXER 0 @@ -691,6 +708,7 @@ #define CONFIG_IV8_DEMUXER 0 #define CONFIG_IVF_DEMUXER 0 #define CONFIG_LMLM4_DEMUXER 0 +#define CONFIG_LXF_DEMUXER 0 #define CONFIG_M4V_DEMUXER 0 #define CONFIG_MATROSKA_DEMUXER 1 #define CONFIG_MJPEG_DEMUXER 0 @@ -744,7 +762,9 @@ #define CONFIG_ROQ_DEMUXER 0 #define CONFIG_RPL_DEMUXER 0 #define CONFIG_RSO_DEMUXER 0 +#define CONFIG_RTP_DEMUXER 0 #define CONFIG_RTSP_DEMUXER 0 +#define CONFIG_SAP_DEMUXER 0 #define CONFIG_SDP_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 @@ -768,8 +788,9 @@ #define CONFIG_VOC_DEMUXER 0 #define CONFIG_VQF_DEMUXER 0 #define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_DEMUXER 0 +#define CONFIG_WAV_DEMUXER 1 #define CONFIG_WC3_DEMUXER 0 +#define CONFIG_WEBP_DEMUXER 0 #define CONFIG_WSAUD_DEMUXER 0 #define CONFIG_WSVQA_DEMUXER 0 #define CONFIG_WV_DEMUXER 0 @@ -777,6 +798,7 @@ #define CONFIG_YOP_DEMUXER 0 #define CONFIG_YUV4MPEGPIPE_DEMUXER 0 #define CONFIG_LIBNUT_DEMUXER 0 +#define CONFIG_A64_MUXER 0 #define CONFIG_AC3_MUXER 0 #define CONFIG_ADTS_MUXER 0 #define CONFIG_AIFF_MUXER 0 @@ -801,6 +823,7 @@ #define CONFIG_FLV_MUXER 0 #define CONFIG_FRAMECRC_MUXER 0 #define CONFIG_FRAMEMD5_MUXER 0 +#define CONFIG_G722_MUXER 0 #define CONFIG_GIF_MUXER 0 #define CONFIG_GXF_MUXER 0 #define CONFIG_H261_MUXER 0 @@ -861,6 +884,7 @@ #define CONFIG_RSO_MUXER 0 #define CONFIG_RTP_MUXER 0 #define CONFIG_RTSP_MUXER 0 +#define CONFIG_SAP_MUXER 0 #define CONFIG_SOX_MUXER 0 #define CONFIG_SPDIF_MUXER 0 #define CONFIG_SRT_MUXER 0 @@ -872,21 +896,36 @@ #define CONFIG_VOC_MUXER 0 #define CONFIG_WAV_MUXER 0 #define CONFIG_WEBM_MUXER 0 +#define CONFIG_WEBP_MUXER 0 #define CONFIG_YUV4MPEGPIPE_MUXER 0 #define CONFIG_LIBNUT_MUXER 0 +#define CONFIG_ANULL_FILTER 0 +#define CONFIG_ANULLSRC_FILTER 0 +#define CONFIG_ANULLSINK_FILTER 0 #define CONFIG_ASPECT_FILTER 0 +#define CONFIG_BLACKFRAME_FILTER 0 #define CONFIG_CROP_FILTER 0 +#define CONFIG_CROPDETECT_FILTER 0 +#define CONFIG_DRAWBOX_FILTER 0 +#define CONFIG_FIFO_FILTER 0 #define CONFIG_FORMAT_FILTER 0 +#define CONFIG_FREI0R_FILTER 0 +#define CONFIG_HFLIP_FILTER 0 #define CONFIG_NOFORMAT_FILTER 0 #define CONFIG_NULL_FILTER 0 +#define CONFIG_OCV_SMOOTH_FILTER 0 #define CONFIG_PAD_FILTER 0 #define CONFIG_PIXDESCTEST_FILTER 0 #define CONFIG_PIXELASPECT_FILTER 0 #define CONFIG_SCALE_FILTER 0 +#define CONFIG_SETPTS_FILTER 0 +#define CONFIG_SETTB_FILTER 0 #define CONFIG_SLICIFY_FILTER 0 +#define CONFIG_TRANSPOSE_FILTER 0 #define CONFIG_UNSHARP_FILTER 0 #define CONFIG_VFLIP_FILTER 0 -#define CONFIG_BUFFER_FILTER 1 +#define CONFIG_YADIF_FILTER 0 +#define CONFIG_BUFFER_FILTER 0 #define CONFIG_COLOR_FILTER 0 #define CONFIG_NULLSRC_FILTER 0 #define CONFIG_NULLSINK_FILTER 0 @@ -894,6 +933,7 @@ #define CONFIG_FILE_PROTOCOL 0 #define CONFIG_GOPHER_PROTOCOL 0 #define CONFIG_HTTP_PROTOCOL 0 +#define CONFIG_MMSH_PROTOCOL 0 #define CONFIG_MMST_PROTOCOL 0 #define CONFIG_MD5_PROTOCOL 0 #define CONFIG_PIPE_PROTOCOL 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chromium/linux/arm-neon/config.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chromium/linux/arm-neon/config.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chromium/linux/arm-neon/config.h 2010-08-18 02:00:48.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chromium/linux/arm-neon/config.h 2011-02-03 22:58:19.000000000 +0000 @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --enable-shared --enable-decoder='theora,vorbis,libvpx' --enable-demuxer='ogg,matroska' --enable-cross-compile --arch=arm --target-os=linux --enable-armv6 --enable-armv6t2 --enable-armvfp --enable-neon --cross-prefix=/usr/local/google/cross-tools/arm-2009q3/bin/arm-none-linux-gnueabi- --extra-cflags='-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp'" +#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --disable-swscale --enable-shared --enable-decoder='theora,vorbis,pcm_u8,pcm_s16le,pcm_f32le' --enable-demuxer='ogg,matroska,wav' --enable-cross-compile --arch=arm --target-os=linux --enable-armv6 --enable-armv6t2 --enable-armvfp --enable-neon --cross-prefix=/usr/local/google/cross-tools/arm-2009q3/bin/arm-none-linux-gnueabi- --extra-cflags='-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp'" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define CC_TYPE "gcc" @@ -9,7 +9,8 @@ #define restrict restrict #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t" #define EXTERN_PREFIX "" -#define EXTERN_ASM +#define EXTERN_ASM +#define SLIBSUF ".so" #define ARCH_ALPHA 0 #define ARCH_ARM 1 #define ARCH_AVR32 0 @@ -51,6 +52,7 @@ #define HAVE_FAST_UNALIGNED 1 #define HAVE_PTHREADS 1 #define HAVE_W32THREADS 0 +#define HAVE_ALIGNED_STACK 0 #define HAVE_ALSA_ASOUNDLIB_H 0 #define HAVE_ALTIVEC_H 0 #define HAVE_ARPA_INET_H 0 @@ -119,6 +121,7 @@ #define HAVE_POLL_H 1 #define HAVE_SETRLIMIT 1 #define HAVE_STRERROR_R 1 +#define HAVE_STRTOK_R 1 #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 @@ -140,6 +143,7 @@ #define HAVE_VIRTUALALLOC 0 #define HAVE_WINSOCK2_H 0 #define HAVE_XFORM_ASM 0 +#define HAVE_XMM_CLOBBERS 0 #define HAVE_YASM 0 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 @@ -165,11 +169,12 @@ #define CONFIG_DWT 0 #define CONFIG_DXVA2 0 #define CONFIG_FASTDIV 1 -#define CONFIG_FFMPEG 1 +#define CONFIG_FFMPEG 0 #define CONFIG_FFPLAY 0 #define CONFIG_FFPROBE 1 #define CONFIG_FFSERVER 0 #define CONFIG_FFT 1 +#define CONFIG_FREI0R 0 #define CONFIG_GOLOMB 1 #define CONFIG_GPL 0 #define CONFIG_GRAY 0 @@ -185,6 +190,7 @@ #define CONFIG_LIBNUT 0 #define CONFIG_LIBOPENCORE_AMRNB 0 #define CONFIG_LIBOPENCORE_AMRWB 0 +#define CONFIG_LIBOPENCV 0 #define CONFIG_LIBOPENJPEG 0 #define CONFIG_LIBRTMP 0 #define CONFIG_LIBSCHROEDINGER 0 @@ -206,12 +212,13 @@ #define CONFIG_PIC 1 #define CONFIG_POSTPROC 0 #define CONFIG_RDFT 0 +#define CONFIG_RTPDEC 0 #define CONFIG_RUNTIME_CPUDETECT 0 #define CONFIG_SHARED 1 #define CONFIG_SMALL 0 #define CONFIG_SRAM 0 #define CONFIG_STATIC 1 -#define CONFIG_SWSCALE 1 +#define CONFIG_SWSCALE 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_VAAPI 0 #define CONFIG_VDPAU 0 @@ -314,6 +321,7 @@ #define CONFIG_QDRAW_DECODER 0 #define CONFIG_QPEG_DECODER 0 #define CONFIG_QTRLE_DECODER 0 +#define CONFIG_R10K_DECODER 0 #define CONFIG_R210_DECODER 0 #define CONFIG_RAWVIDEO_DECODER 0 #define CONFIG_RL2_DECODER 0 @@ -368,6 +376,7 @@ #define CONFIG_ZLIB_DECODER 0 #define CONFIG_ZMBV_DECODER 0 #define CONFIG_AAC_DECODER 0 +#define CONFIG_AAC_LATM_DECODER 0 #define CONFIG_AC3_DECODER 0 #define CONFIG_ALAC_DECODER 0 #define CONFIG_ALS_DECODER 0 @@ -425,20 +434,21 @@ #define CONFIG_PCM_BLURAY_DECODER 0 #define CONFIG_PCM_DVD_DECODER 0 #define CONFIG_PCM_F32BE_DECODER 0 -#define CONFIG_PCM_F32LE_DECODER 0 +#define CONFIG_PCM_F32LE_DECODER 1 #define CONFIG_PCM_F64BE_DECODER 0 #define CONFIG_PCM_F64LE_DECODER 0 +#define CONFIG_PCM_LXF_DECODER 0 #define CONFIG_PCM_MULAW_DECODER 0 #define CONFIG_PCM_S8_DECODER 0 #define CONFIG_PCM_S16BE_DECODER 0 -#define CONFIG_PCM_S16LE_DECODER 0 +#define CONFIG_PCM_S16LE_DECODER 1 #define CONFIG_PCM_S16LE_PLANAR_DECODER 0 #define CONFIG_PCM_S24BE_DECODER 0 #define CONFIG_PCM_S24DAUD_DECODER 0 #define CONFIG_PCM_S24LE_DECODER 0 #define CONFIG_PCM_S32BE_DECODER 0 #define CONFIG_PCM_S32LE_DECODER 0 -#define CONFIG_PCM_U8_DECODER 0 +#define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 #define CONFIG_PCM_U24BE_DECODER 0 @@ -459,6 +469,7 @@ #define CONFIG_ADPCM_EA_R2_DECODER 0 #define CONFIG_ADPCM_EA_R3_DECODER 0 #define CONFIG_ADPCM_EA_XAS_DECODER 0 +#define CONFIG_ADPCM_G722_DECODER 0 #define CONFIG_ADPCM_G726_DECODER 0 #define CONFIG_ADPCM_IMA_AMV_DECODER 0 #define CONFIG_ADPCM_IMA_DK3_DECODER 0 @@ -491,6 +502,8 @@ #define CONFIG_LIBSCHROEDINGER_DECODER 0 #define CONFIG_LIBSPEEX_DECODER 0 #define CONFIG_LIBVPX_DECODER 0 +#define CONFIG_A64MULTI_ENCODER 0 +#define CONFIG_A64MULTI5_ENCODER 0 #define CONFIG_ASV1_ENCODER 0 #define CONFIG_ASV2_ENCODER 0 #define CONFIG_BMP_ENCODER 0 @@ -572,6 +585,7 @@ #define CONFIG_PCM_ZORK_ENCODER 0 #define CONFIG_ROQ_DPCM_ENCODER 0 #define CONFIG_ADPCM_ADX_ENCODER 0 +#define CONFIG_ADPCM_G722_ENCODER 0 #define CONFIG_ADPCM_G726_ENCODER 0 #define CONFIG_ADPCM_IMA_QT_ENCODER 0 #define CONFIG_ADPCM_IMA_WAV_ENCODER 0 @@ -605,6 +619,7 @@ #define CONFIG_WMV3_DXVA2_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_AAC_PARSER 0 +#define CONFIG_AAC_LATM_PARSER 0 #define CONFIG_AC3_PARSER 0 #define CONFIG_CAVSVIDEO_PARSER 0 #define CONFIG_DCA_PARSER 0 @@ -647,6 +662,7 @@ #define CONFIG_ANM_DEMUXER 0 #define CONFIG_APC_DEMUXER 0 #define CONFIG_APE_DEMUXER 0 +#define CONFIG_APPLEHTTP_DEMUXER 0 #define CONFIG_ASF_DEMUXER 0 #define CONFIG_ASS_DEMUXER 0 #define CONFIG_AU_DEMUXER 0 @@ -676,6 +692,7 @@ #define CONFIG_FLIC_DEMUXER 0 #define CONFIG_FLV_DEMUXER 0 #define CONFIG_FOURXM_DEMUXER 0 +#define CONFIG_G722_DEMUXER 0 #define CONFIG_GSM_DEMUXER 0 #define CONFIG_GXF_DEMUXER 0 #define CONFIG_H261_DEMUXER 0 @@ -691,6 +708,7 @@ #define CONFIG_IV8_DEMUXER 0 #define CONFIG_IVF_DEMUXER 0 #define CONFIG_LMLM4_DEMUXER 0 +#define CONFIG_LXF_DEMUXER 0 #define CONFIG_M4V_DEMUXER 0 #define CONFIG_MATROSKA_DEMUXER 1 #define CONFIG_MJPEG_DEMUXER 0 @@ -744,7 +762,9 @@ #define CONFIG_ROQ_DEMUXER 0 #define CONFIG_RPL_DEMUXER 0 #define CONFIG_RSO_DEMUXER 0 +#define CONFIG_RTP_DEMUXER 0 #define CONFIG_RTSP_DEMUXER 0 +#define CONFIG_SAP_DEMUXER 0 #define CONFIG_SDP_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 @@ -768,8 +788,9 @@ #define CONFIG_VOC_DEMUXER 0 #define CONFIG_VQF_DEMUXER 0 #define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_DEMUXER 0 +#define CONFIG_WAV_DEMUXER 1 #define CONFIG_WC3_DEMUXER 0 +#define CONFIG_WEBP_DEMUXER 0 #define CONFIG_WSAUD_DEMUXER 0 #define CONFIG_WSVQA_DEMUXER 0 #define CONFIG_WV_DEMUXER 0 @@ -777,6 +798,7 @@ #define CONFIG_YOP_DEMUXER 0 #define CONFIG_YUV4MPEGPIPE_DEMUXER 0 #define CONFIG_LIBNUT_DEMUXER 0 +#define CONFIG_A64_MUXER 0 #define CONFIG_AC3_MUXER 0 #define CONFIG_ADTS_MUXER 0 #define CONFIG_AIFF_MUXER 0 @@ -801,6 +823,7 @@ #define CONFIG_FLV_MUXER 0 #define CONFIG_FRAMECRC_MUXER 0 #define CONFIG_FRAMEMD5_MUXER 0 +#define CONFIG_G722_MUXER 0 #define CONFIG_GIF_MUXER 0 #define CONFIG_GXF_MUXER 0 #define CONFIG_H261_MUXER 0 @@ -861,6 +884,7 @@ #define CONFIG_RSO_MUXER 0 #define CONFIG_RTP_MUXER 0 #define CONFIG_RTSP_MUXER 0 +#define CONFIG_SAP_MUXER 0 #define CONFIG_SOX_MUXER 0 #define CONFIG_SPDIF_MUXER 0 #define CONFIG_SRT_MUXER 0 @@ -872,21 +896,36 @@ #define CONFIG_VOC_MUXER 0 #define CONFIG_WAV_MUXER 0 #define CONFIG_WEBM_MUXER 0 +#define CONFIG_WEBP_MUXER 0 #define CONFIG_YUV4MPEGPIPE_MUXER 0 #define CONFIG_LIBNUT_MUXER 0 +#define CONFIG_ANULL_FILTER 0 +#define CONFIG_ANULLSRC_FILTER 0 +#define CONFIG_ANULLSINK_FILTER 0 #define CONFIG_ASPECT_FILTER 0 +#define CONFIG_BLACKFRAME_FILTER 0 #define CONFIG_CROP_FILTER 0 +#define CONFIG_CROPDETECT_FILTER 0 +#define CONFIG_DRAWBOX_FILTER 0 +#define CONFIG_FIFO_FILTER 0 #define CONFIG_FORMAT_FILTER 0 +#define CONFIG_FREI0R_FILTER 0 +#define CONFIG_HFLIP_FILTER 0 #define CONFIG_NOFORMAT_FILTER 0 #define CONFIG_NULL_FILTER 0 +#define CONFIG_OCV_SMOOTH_FILTER 0 #define CONFIG_PAD_FILTER 0 #define CONFIG_PIXDESCTEST_FILTER 0 #define CONFIG_PIXELASPECT_FILTER 0 #define CONFIG_SCALE_FILTER 0 +#define CONFIG_SETPTS_FILTER 0 +#define CONFIG_SETTB_FILTER 0 #define CONFIG_SLICIFY_FILTER 0 +#define CONFIG_TRANSPOSE_FILTER 0 #define CONFIG_UNSHARP_FILTER 0 #define CONFIG_VFLIP_FILTER 0 -#define CONFIG_BUFFER_FILTER 1 +#define CONFIG_YADIF_FILTER 0 +#define CONFIG_BUFFER_FILTER 0 #define CONFIG_COLOR_FILTER 0 #define CONFIG_NULLSRC_FILTER 0 #define CONFIG_NULLSINK_FILTER 0 @@ -894,6 +933,7 @@ #define CONFIG_FILE_PROTOCOL 0 #define CONFIG_GOPHER_PROTOCOL 0 #define CONFIG_HTTP_PROTOCOL 0 +#define CONFIG_MMSH_PROTOCOL 0 #define CONFIG_MMST_PROTOCOL 0 #define CONFIG_MD5_PROTOCOL 0 #define CONFIG_PIPE_PROTOCOL 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chromium/linux/ia32/config.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chromium/linux/ia32/config.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chromium/linux/ia32/config.h 2010-08-18 02:00:48.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chromium/linux/ia32/config.h 2011-02-03 22:58:19.000000000 +0000 @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --enable-shared --enable-libvpx --enable-decoder='theora,vorbis,libvpx' --enable-demuxer='ogg,matroska' --extra-cflags='-m32 -fPIC' --extra-ldflags='-m32 -L../../libvpx/linux32/lib'" +#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --disable-swscale --disable-amd3dnow --disable-amd3dnowext --enable-shared --enable-libvpx --enable-decoder='theora,vorbis,libvpx,pcm_u8,pcm_s16le,pcm_f32le' --enable-encoder=libvpx --enable-demuxer='ogg,matroska,wav' --extra-cflags='-m32 -fPIC' --extra-ldflags='-m32 -L../../libvpx/linux32/usr/local/lib'" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define CC_TYPE "gcc" @@ -9,7 +9,8 @@ #define restrict restrict #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t" #define EXTERN_PREFIX "" -#define EXTERN_ASM +#define EXTERN_ASM +#define SLIBSUF ".so" #define ARCH_ALPHA 0 #define ARCH_ARM 0 #define ARCH_AVR32 0 @@ -32,8 +33,8 @@ #define ARCH_X86_32 1 #define ARCH_X86_64 0 #define HAVE_ALTIVEC 0 -#define HAVE_AMD3DNOW 1 -#define HAVE_AMD3DNOWEXT 1 +#define HAVE_AMD3DNOW 0 +#define HAVE_AMD3DNOWEXT 0 #define HAVE_ARMV5TE 0 #define HAVE_ARMV6 0 #define HAVE_ARMV6T2 0 @@ -51,6 +52,7 @@ #define HAVE_FAST_UNALIGNED 1 #define HAVE_PTHREADS 1 #define HAVE_W32THREADS 0 +#define HAVE_ALIGNED_STACK 1 #define HAVE_ALSA_ASOUNDLIB_H 0 #define HAVE_ALTIVEC_H 0 #define HAVE_ARPA_INET_H 0 @@ -119,6 +121,7 @@ #define HAVE_POLL_H 1 #define HAVE_SETRLIMIT 1 #define HAVE_STRERROR_R 1 +#define HAVE_STRTOK_R 1 #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 @@ -140,11 +143,12 @@ #define HAVE_VIRTUALALLOC 0 #define HAVE_WINSOCK2_H 0 #define HAVE_XFORM_ASM 0 +#define HAVE_XMM_CLOBBERS 0 #define HAVE_YASM 1 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 #define CONFIG_DEMUXERS 1 -#define CONFIG_ENCODERS 0 +#define CONFIG_ENCODERS 1 #define CONFIG_FILTERS 0 #define CONFIG_HWACCELS 0 #define CONFIG_INDEVS 0 @@ -165,11 +169,12 @@ #define CONFIG_DWT 0 #define CONFIG_DXVA2 0 #define CONFIG_FASTDIV 1 -#define CONFIG_FFMPEG 1 +#define CONFIG_FFMPEG 0 #define CONFIG_FFPLAY 0 #define CONFIG_FFPROBE 1 #define CONFIG_FFSERVER 0 #define CONFIG_FFT 1 +#define CONFIG_FREI0R 0 #define CONFIG_GOLOMB 1 #define CONFIG_GPL 0 #define CONFIG_GRAY 0 @@ -185,6 +190,7 @@ #define CONFIG_LIBNUT 0 #define CONFIG_LIBOPENCORE_AMRNB 0 #define CONFIG_LIBOPENCORE_AMRWB 0 +#define CONFIG_LIBOPENCV 0 #define CONFIG_LIBOPENJPEG 0 #define CONFIG_LIBRTMP 0 #define CONFIG_LIBSCHROEDINGER 0 @@ -206,12 +212,13 @@ #define CONFIG_PIC 1 #define CONFIG_POSTPROC 0 #define CONFIG_RDFT 0 +#define CONFIG_RTPDEC 0 #define CONFIG_RUNTIME_CPUDETECT 0 #define CONFIG_SHARED 1 #define CONFIG_SMALL 0 #define CONFIG_SRAM 0 #define CONFIG_STATIC 1 -#define CONFIG_SWSCALE 1 +#define CONFIG_SWSCALE 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_VAAPI 0 #define CONFIG_VDPAU 0 @@ -314,6 +321,7 @@ #define CONFIG_QDRAW_DECODER 0 #define CONFIG_QPEG_DECODER 0 #define CONFIG_QTRLE_DECODER 0 +#define CONFIG_R10K_DECODER 0 #define CONFIG_R210_DECODER 0 #define CONFIG_RAWVIDEO_DECODER 0 #define CONFIG_RL2_DECODER 0 @@ -368,6 +376,7 @@ #define CONFIG_ZLIB_DECODER 0 #define CONFIG_ZMBV_DECODER 0 #define CONFIG_AAC_DECODER 0 +#define CONFIG_AAC_LATM_DECODER 0 #define CONFIG_AC3_DECODER 0 #define CONFIG_ALAC_DECODER 0 #define CONFIG_ALS_DECODER 0 @@ -425,20 +434,21 @@ #define CONFIG_PCM_BLURAY_DECODER 0 #define CONFIG_PCM_DVD_DECODER 0 #define CONFIG_PCM_F32BE_DECODER 0 -#define CONFIG_PCM_F32LE_DECODER 0 +#define CONFIG_PCM_F32LE_DECODER 1 #define CONFIG_PCM_F64BE_DECODER 0 #define CONFIG_PCM_F64LE_DECODER 0 +#define CONFIG_PCM_LXF_DECODER 0 #define CONFIG_PCM_MULAW_DECODER 0 #define CONFIG_PCM_S8_DECODER 0 #define CONFIG_PCM_S16BE_DECODER 0 -#define CONFIG_PCM_S16LE_DECODER 0 +#define CONFIG_PCM_S16LE_DECODER 1 #define CONFIG_PCM_S16LE_PLANAR_DECODER 0 #define CONFIG_PCM_S24BE_DECODER 0 #define CONFIG_PCM_S24DAUD_DECODER 0 #define CONFIG_PCM_S24LE_DECODER 0 #define CONFIG_PCM_S32BE_DECODER 0 #define CONFIG_PCM_S32LE_DECODER 0 -#define CONFIG_PCM_U8_DECODER 0 +#define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 #define CONFIG_PCM_U24BE_DECODER 0 @@ -459,6 +469,7 @@ #define CONFIG_ADPCM_EA_R2_DECODER 0 #define CONFIG_ADPCM_EA_R3_DECODER 0 #define CONFIG_ADPCM_EA_XAS_DECODER 0 +#define CONFIG_ADPCM_G722_DECODER 0 #define CONFIG_ADPCM_G726_DECODER 0 #define CONFIG_ADPCM_IMA_AMV_DECODER 0 #define CONFIG_ADPCM_IMA_DK3_DECODER 0 @@ -491,6 +502,8 @@ #define CONFIG_LIBSCHROEDINGER_DECODER 0 #define CONFIG_LIBSPEEX_DECODER 0 #define CONFIG_LIBVPX_DECODER 1 +#define CONFIG_A64MULTI_ENCODER 0 +#define CONFIG_A64MULTI5_ENCODER 0 #define CONFIG_ASV1_ENCODER 0 #define CONFIG_ASV2_ENCODER 0 #define CONFIG_BMP_ENCODER 0 @@ -572,6 +585,7 @@ #define CONFIG_PCM_ZORK_ENCODER 0 #define CONFIG_ROQ_DPCM_ENCODER 0 #define CONFIG_ADPCM_ADX_ENCODER 0 +#define CONFIG_ADPCM_G722_ENCODER 0 #define CONFIG_ADPCM_G726_ENCODER 0 #define CONFIG_ADPCM_IMA_QT_ENCODER 0 #define CONFIG_ADPCM_IMA_WAV_ENCODER 0 @@ -590,7 +604,7 @@ #define CONFIG_LIBSCHROEDINGER_ENCODER 0 #define CONFIG_LIBTHEORA_ENCODER 0 #define CONFIG_LIBVORBIS_ENCODER 0 -#define CONFIG_LIBVPX_ENCODER 0 +#define CONFIG_LIBVPX_ENCODER 1 #define CONFIG_LIBX264_ENCODER 0 #define CONFIG_LIBXAVS_ENCODER 0 #define CONFIG_LIBXVID_ENCODER 0 @@ -605,6 +619,7 @@ #define CONFIG_WMV3_DXVA2_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_AAC_PARSER 0 +#define CONFIG_AAC_LATM_PARSER 0 #define CONFIG_AC3_PARSER 0 #define CONFIG_CAVSVIDEO_PARSER 0 #define CONFIG_DCA_PARSER 0 @@ -647,6 +662,7 @@ #define CONFIG_ANM_DEMUXER 0 #define CONFIG_APC_DEMUXER 0 #define CONFIG_APE_DEMUXER 0 +#define CONFIG_APPLEHTTP_DEMUXER 0 #define CONFIG_ASF_DEMUXER 0 #define CONFIG_ASS_DEMUXER 0 #define CONFIG_AU_DEMUXER 0 @@ -676,6 +692,7 @@ #define CONFIG_FLIC_DEMUXER 0 #define CONFIG_FLV_DEMUXER 0 #define CONFIG_FOURXM_DEMUXER 0 +#define CONFIG_G722_DEMUXER 0 #define CONFIG_GSM_DEMUXER 0 #define CONFIG_GXF_DEMUXER 0 #define CONFIG_H261_DEMUXER 0 @@ -691,6 +708,7 @@ #define CONFIG_IV8_DEMUXER 0 #define CONFIG_IVF_DEMUXER 0 #define CONFIG_LMLM4_DEMUXER 0 +#define CONFIG_LXF_DEMUXER 0 #define CONFIG_M4V_DEMUXER 0 #define CONFIG_MATROSKA_DEMUXER 1 #define CONFIG_MJPEG_DEMUXER 0 @@ -744,7 +762,9 @@ #define CONFIG_ROQ_DEMUXER 0 #define CONFIG_RPL_DEMUXER 0 #define CONFIG_RSO_DEMUXER 0 +#define CONFIG_RTP_DEMUXER 0 #define CONFIG_RTSP_DEMUXER 0 +#define CONFIG_SAP_DEMUXER 0 #define CONFIG_SDP_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 @@ -768,8 +788,9 @@ #define CONFIG_VOC_DEMUXER 0 #define CONFIG_VQF_DEMUXER 0 #define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_DEMUXER 0 +#define CONFIG_WAV_DEMUXER 1 #define CONFIG_WC3_DEMUXER 0 +#define CONFIG_WEBP_DEMUXER 0 #define CONFIG_WSAUD_DEMUXER 0 #define CONFIG_WSVQA_DEMUXER 0 #define CONFIG_WV_DEMUXER 0 @@ -777,6 +798,7 @@ #define CONFIG_YOP_DEMUXER 0 #define CONFIG_YUV4MPEGPIPE_DEMUXER 0 #define CONFIG_LIBNUT_DEMUXER 0 +#define CONFIG_A64_MUXER 0 #define CONFIG_AC3_MUXER 0 #define CONFIG_ADTS_MUXER 0 #define CONFIG_AIFF_MUXER 0 @@ -801,6 +823,7 @@ #define CONFIG_FLV_MUXER 0 #define CONFIG_FRAMECRC_MUXER 0 #define CONFIG_FRAMEMD5_MUXER 0 +#define CONFIG_G722_MUXER 0 #define CONFIG_GIF_MUXER 0 #define CONFIG_GXF_MUXER 0 #define CONFIG_H261_MUXER 0 @@ -861,6 +884,7 @@ #define CONFIG_RSO_MUXER 0 #define CONFIG_RTP_MUXER 0 #define CONFIG_RTSP_MUXER 0 +#define CONFIG_SAP_MUXER 0 #define CONFIG_SOX_MUXER 0 #define CONFIG_SPDIF_MUXER 0 #define CONFIG_SRT_MUXER 0 @@ -872,21 +896,36 @@ #define CONFIG_VOC_MUXER 0 #define CONFIG_WAV_MUXER 0 #define CONFIG_WEBM_MUXER 0 +#define CONFIG_WEBP_MUXER 0 #define CONFIG_YUV4MPEGPIPE_MUXER 0 #define CONFIG_LIBNUT_MUXER 0 +#define CONFIG_ANULL_FILTER 0 +#define CONFIG_ANULLSRC_FILTER 0 +#define CONFIG_ANULLSINK_FILTER 0 #define CONFIG_ASPECT_FILTER 0 +#define CONFIG_BLACKFRAME_FILTER 0 #define CONFIG_CROP_FILTER 0 +#define CONFIG_CROPDETECT_FILTER 0 +#define CONFIG_DRAWBOX_FILTER 0 +#define CONFIG_FIFO_FILTER 0 #define CONFIG_FORMAT_FILTER 0 +#define CONFIG_FREI0R_FILTER 0 +#define CONFIG_HFLIP_FILTER 0 #define CONFIG_NOFORMAT_FILTER 0 #define CONFIG_NULL_FILTER 0 +#define CONFIG_OCV_SMOOTH_FILTER 0 #define CONFIG_PAD_FILTER 0 #define CONFIG_PIXDESCTEST_FILTER 0 #define CONFIG_PIXELASPECT_FILTER 0 #define CONFIG_SCALE_FILTER 0 +#define CONFIG_SETPTS_FILTER 0 +#define CONFIG_SETTB_FILTER 0 #define CONFIG_SLICIFY_FILTER 0 +#define CONFIG_TRANSPOSE_FILTER 0 #define CONFIG_UNSHARP_FILTER 0 #define CONFIG_VFLIP_FILTER 0 -#define CONFIG_BUFFER_FILTER 1 +#define CONFIG_YADIF_FILTER 0 +#define CONFIG_BUFFER_FILTER 0 #define CONFIG_COLOR_FILTER 0 #define CONFIG_NULLSRC_FILTER 0 #define CONFIG_NULLSINK_FILTER 0 @@ -894,6 +933,7 @@ #define CONFIG_FILE_PROTOCOL 0 #define CONFIG_GOPHER_PROTOCOL 0 #define CONFIG_HTTP_PROTOCOL 0 +#define CONFIG_MMSH_PROTOCOL 0 #define CONFIG_MMST_PROTOCOL 0 #define CONFIG_MD5_PROTOCOL 0 #define CONFIG_PIPE_PROTOCOL 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chromium/linux/x64/config.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chromium/linux/x64/config.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/config/Chromium/linux/x64/config.h 2010-08-18 02:00:48.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/config/Chromium/linux/x64/config.h 2011-02-03 22:58:19.000000000 +0000 @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --enable-shared --enable-libvpx --enable-decoder='theora,vorbis,libvpx' --enable-demuxer='ogg,matroska'" +#define FFMPEG_CONFIGURATION "--disable-everything --disable-network --disable-bzlib --disable-zlib --disable-swscale --disable-amd3dnow --disable-amd3dnowext --enable-shared --enable-libvpx --enable-decoder='theora,vorbis,libvpx,pcm_u8,pcm_s16le,pcm_f32le' --enable-encoder=libvpx --enable-demuxer='ogg,matroska,wav' --extra-ldflags=-L../../libvpx/linux64/usr/local/lib" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define CC_TYPE "gcc" @@ -9,7 +9,8 @@ #define restrict restrict #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t" #define EXTERN_PREFIX "" -#define EXTERN_ASM +#define EXTERN_ASM +#define SLIBSUF ".so" #define ARCH_ALPHA 0 #define ARCH_ARM 0 #define ARCH_AVR32 0 @@ -32,8 +33,8 @@ #define ARCH_X86_32 0 #define ARCH_X86_64 1 #define HAVE_ALTIVEC 0 -#define HAVE_AMD3DNOW 1 -#define HAVE_AMD3DNOWEXT 1 +#define HAVE_AMD3DNOW 0 +#define HAVE_AMD3DNOWEXT 0 #define HAVE_ARMV5TE 0 #define HAVE_ARMV6 0 #define HAVE_ARMV6T2 0 @@ -51,6 +52,7 @@ #define HAVE_FAST_UNALIGNED 1 #define HAVE_PTHREADS 1 #define HAVE_W32THREADS 0 +#define HAVE_ALIGNED_STACK 1 #define HAVE_ALSA_ASOUNDLIB_H 0 #define HAVE_ALTIVEC_H 0 #define HAVE_ARPA_INET_H 0 @@ -96,15 +98,15 @@ #define HAVE_LLRINTF 1 #define HAVE_LOCAL_ALIGNED_16 1 #define HAVE_LOCAL_ALIGNED_8 1 -#define HAVE_LOG2 1 -#define HAVE_LOG2F 1 +#define HAVE_LOG2 0 +#define HAVE_LOG2F 0 #define HAVE_LOONGSON 0 #define HAVE_LRINT 1 #define HAVE_LRINTF 1 #define HAVE_LZO1X_999_COMPRESS 0 #define HAVE_MACHINE_IOCTL_BT848_H 0 #define HAVE_MACHINE_IOCTL_METEOR_H 0 -#define HAVE_MALLOC_H 1 +#define HAVE_MALLOC_H 0 #define HAVE_MEMALIGN 1 #define HAVE_MKSTEMP 1 #define HAVE_PLD 0 @@ -119,6 +121,7 @@ #define HAVE_POLL_H 1 #define HAVE_SETRLIMIT 1 #define HAVE_STRERROR_R 1 +#define HAVE_STRTOK_R 1 #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 @@ -140,11 +143,12 @@ #define HAVE_VIRTUALALLOC 0 #define HAVE_WINSOCK2_H 0 #define HAVE_XFORM_ASM 0 +#define HAVE_XMM_CLOBBERS 1 #define HAVE_YASM 1 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 #define CONFIG_DEMUXERS 1 -#define CONFIG_ENCODERS 0 +#define CONFIG_ENCODERS 1 #define CONFIG_FILTERS 0 #define CONFIG_HWACCELS 0 #define CONFIG_INDEVS 0 @@ -165,11 +169,12 @@ #define CONFIG_DWT 0 #define CONFIG_DXVA2 0 #define CONFIG_FASTDIV 1 -#define CONFIG_FFMPEG 1 +#define CONFIG_FFMPEG 0 #define CONFIG_FFPLAY 0 #define CONFIG_FFPROBE 1 #define CONFIG_FFSERVER 0 #define CONFIG_FFT 1 +#define CONFIG_FREI0R 0 #define CONFIG_GOLOMB 1 #define CONFIG_GPL 0 #define CONFIG_GRAY 0 @@ -185,6 +190,7 @@ #define CONFIG_LIBNUT 0 #define CONFIG_LIBOPENCORE_AMRNB 0 #define CONFIG_LIBOPENCORE_AMRWB 0 +#define CONFIG_LIBOPENCV 0 #define CONFIG_LIBOPENJPEG 0 #define CONFIG_LIBRTMP 0 #define CONFIG_LIBSCHROEDINGER 0 @@ -206,12 +212,13 @@ #define CONFIG_PIC 1 #define CONFIG_POSTPROC 0 #define CONFIG_RDFT 0 +#define CONFIG_RTPDEC 0 #define CONFIG_RUNTIME_CPUDETECT 0 #define CONFIG_SHARED 1 #define CONFIG_SMALL 0 #define CONFIG_SRAM 0 #define CONFIG_STATIC 1 -#define CONFIG_SWSCALE 1 +#define CONFIG_SWSCALE 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_VAAPI 0 #define CONFIG_VDPAU 0 @@ -314,6 +321,7 @@ #define CONFIG_QDRAW_DECODER 0 #define CONFIG_QPEG_DECODER 0 #define CONFIG_QTRLE_DECODER 0 +#define CONFIG_R10K_DECODER 0 #define CONFIG_R210_DECODER 0 #define CONFIG_RAWVIDEO_DECODER 0 #define CONFIG_RL2_DECODER 0 @@ -368,6 +376,7 @@ #define CONFIG_ZLIB_DECODER 0 #define CONFIG_ZMBV_DECODER 0 #define CONFIG_AAC_DECODER 0 +#define CONFIG_AAC_LATM_DECODER 0 #define CONFIG_AC3_DECODER 0 #define CONFIG_ALAC_DECODER 0 #define CONFIG_ALS_DECODER 0 @@ -425,20 +434,21 @@ #define CONFIG_PCM_BLURAY_DECODER 0 #define CONFIG_PCM_DVD_DECODER 0 #define CONFIG_PCM_F32BE_DECODER 0 -#define CONFIG_PCM_F32LE_DECODER 0 +#define CONFIG_PCM_F32LE_DECODER 1 #define CONFIG_PCM_F64BE_DECODER 0 #define CONFIG_PCM_F64LE_DECODER 0 +#define CONFIG_PCM_LXF_DECODER 0 #define CONFIG_PCM_MULAW_DECODER 0 #define CONFIG_PCM_S8_DECODER 0 #define CONFIG_PCM_S16BE_DECODER 0 -#define CONFIG_PCM_S16LE_DECODER 0 +#define CONFIG_PCM_S16LE_DECODER 1 #define CONFIG_PCM_S16LE_PLANAR_DECODER 0 #define CONFIG_PCM_S24BE_DECODER 0 #define CONFIG_PCM_S24DAUD_DECODER 0 #define CONFIG_PCM_S24LE_DECODER 0 #define CONFIG_PCM_S32BE_DECODER 0 #define CONFIG_PCM_S32LE_DECODER 0 -#define CONFIG_PCM_U8_DECODER 0 +#define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 #define CONFIG_PCM_U24BE_DECODER 0 @@ -459,6 +469,7 @@ #define CONFIG_ADPCM_EA_R2_DECODER 0 #define CONFIG_ADPCM_EA_R3_DECODER 0 #define CONFIG_ADPCM_EA_XAS_DECODER 0 +#define CONFIG_ADPCM_G722_DECODER 0 #define CONFIG_ADPCM_G726_DECODER 0 #define CONFIG_ADPCM_IMA_AMV_DECODER 0 #define CONFIG_ADPCM_IMA_DK3_DECODER 0 @@ -491,6 +502,8 @@ #define CONFIG_LIBSCHROEDINGER_DECODER 0 #define CONFIG_LIBSPEEX_DECODER 0 #define CONFIG_LIBVPX_DECODER 1 +#define CONFIG_A64MULTI_ENCODER 0 +#define CONFIG_A64MULTI5_ENCODER 0 #define CONFIG_ASV1_ENCODER 0 #define CONFIG_ASV2_ENCODER 0 #define CONFIG_BMP_ENCODER 0 @@ -572,6 +585,7 @@ #define CONFIG_PCM_ZORK_ENCODER 0 #define CONFIG_ROQ_DPCM_ENCODER 0 #define CONFIG_ADPCM_ADX_ENCODER 0 +#define CONFIG_ADPCM_G722_ENCODER 0 #define CONFIG_ADPCM_G726_ENCODER 0 #define CONFIG_ADPCM_IMA_QT_ENCODER 0 #define CONFIG_ADPCM_IMA_WAV_ENCODER 0 @@ -590,7 +604,7 @@ #define CONFIG_LIBSCHROEDINGER_ENCODER 0 #define CONFIG_LIBTHEORA_ENCODER 0 #define CONFIG_LIBVORBIS_ENCODER 0 -#define CONFIG_LIBVPX_ENCODER 0 +#define CONFIG_LIBVPX_ENCODER 1 #define CONFIG_LIBX264_ENCODER 0 #define CONFIG_LIBXAVS_ENCODER 0 #define CONFIG_LIBXVID_ENCODER 0 @@ -605,6 +619,7 @@ #define CONFIG_WMV3_DXVA2_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_AAC_PARSER 0 +#define CONFIG_AAC_LATM_PARSER 0 #define CONFIG_AC3_PARSER 0 #define CONFIG_CAVSVIDEO_PARSER 0 #define CONFIG_DCA_PARSER 0 @@ -647,6 +662,7 @@ #define CONFIG_ANM_DEMUXER 0 #define CONFIG_APC_DEMUXER 0 #define CONFIG_APE_DEMUXER 0 +#define CONFIG_APPLEHTTP_DEMUXER 0 #define CONFIG_ASF_DEMUXER 0 #define CONFIG_ASS_DEMUXER 0 #define CONFIG_AU_DEMUXER 0 @@ -676,6 +692,7 @@ #define CONFIG_FLIC_DEMUXER 0 #define CONFIG_FLV_DEMUXER 0 #define CONFIG_FOURXM_DEMUXER 0 +#define CONFIG_G722_DEMUXER 0 #define CONFIG_GSM_DEMUXER 0 #define CONFIG_GXF_DEMUXER 0 #define CONFIG_H261_DEMUXER 0 @@ -691,6 +708,7 @@ #define CONFIG_IV8_DEMUXER 0 #define CONFIG_IVF_DEMUXER 0 #define CONFIG_LMLM4_DEMUXER 0 +#define CONFIG_LXF_DEMUXER 0 #define CONFIG_M4V_DEMUXER 0 #define CONFIG_MATROSKA_DEMUXER 1 #define CONFIG_MJPEG_DEMUXER 0 @@ -744,7 +762,9 @@ #define CONFIG_ROQ_DEMUXER 0 #define CONFIG_RPL_DEMUXER 0 #define CONFIG_RSO_DEMUXER 0 +#define CONFIG_RTP_DEMUXER 0 #define CONFIG_RTSP_DEMUXER 0 +#define CONFIG_SAP_DEMUXER 0 #define CONFIG_SDP_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 @@ -768,8 +788,9 @@ #define CONFIG_VOC_DEMUXER 0 #define CONFIG_VQF_DEMUXER 0 #define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_DEMUXER 0 +#define CONFIG_WAV_DEMUXER 1 #define CONFIG_WC3_DEMUXER 0 +#define CONFIG_WEBP_DEMUXER 0 #define CONFIG_WSAUD_DEMUXER 0 #define CONFIG_WSVQA_DEMUXER 0 #define CONFIG_WV_DEMUXER 0 @@ -777,6 +798,7 @@ #define CONFIG_YOP_DEMUXER 0 #define CONFIG_YUV4MPEGPIPE_DEMUXER 0 #define CONFIG_LIBNUT_DEMUXER 0 +#define CONFIG_A64_MUXER 0 #define CONFIG_AC3_MUXER 0 #define CONFIG_ADTS_MUXER 0 #define CONFIG_AIFF_MUXER 0 @@ -801,6 +823,7 @@ #define CONFIG_FLV_MUXER 0 #define CONFIG_FRAMECRC_MUXER 0 #define CONFIG_FRAMEMD5_MUXER 0 +#define CONFIG_G722_MUXER 0 #define CONFIG_GIF_MUXER 0 #define CONFIG_GXF_MUXER 0 #define CONFIG_H261_MUXER 0 @@ -861,6 +884,7 @@ #define CONFIG_RSO_MUXER 0 #define CONFIG_RTP_MUXER 0 #define CONFIG_RTSP_MUXER 0 +#define CONFIG_SAP_MUXER 0 #define CONFIG_SOX_MUXER 0 #define CONFIG_SPDIF_MUXER 0 #define CONFIG_SRT_MUXER 0 @@ -872,21 +896,36 @@ #define CONFIG_VOC_MUXER 0 #define CONFIG_WAV_MUXER 0 #define CONFIG_WEBM_MUXER 0 +#define CONFIG_WEBP_MUXER 0 #define CONFIG_YUV4MPEGPIPE_MUXER 0 #define CONFIG_LIBNUT_MUXER 0 +#define CONFIG_ANULL_FILTER 0 +#define CONFIG_ANULLSRC_FILTER 0 +#define CONFIG_ANULLSINK_FILTER 0 #define CONFIG_ASPECT_FILTER 0 +#define CONFIG_BLACKFRAME_FILTER 0 #define CONFIG_CROP_FILTER 0 +#define CONFIG_CROPDETECT_FILTER 0 +#define CONFIG_DRAWBOX_FILTER 0 +#define CONFIG_FIFO_FILTER 0 #define CONFIG_FORMAT_FILTER 0 +#define CONFIG_FREI0R_FILTER 0 +#define CONFIG_HFLIP_FILTER 0 #define CONFIG_NOFORMAT_FILTER 0 #define CONFIG_NULL_FILTER 0 +#define CONFIG_OCV_SMOOTH_FILTER 0 #define CONFIG_PAD_FILTER 0 #define CONFIG_PIXDESCTEST_FILTER 0 #define CONFIG_PIXELASPECT_FILTER 0 #define CONFIG_SCALE_FILTER 0 +#define CONFIG_SETPTS_FILTER 0 +#define CONFIG_SETTB_FILTER 0 #define CONFIG_SLICIFY_FILTER 0 +#define CONFIG_TRANSPOSE_FILTER 0 #define CONFIG_UNSHARP_FILTER 0 #define CONFIG_VFLIP_FILTER 0 -#define CONFIG_BUFFER_FILTER 1 +#define CONFIG_YADIF_FILTER 0 +#define CONFIG_BUFFER_FILTER 0 #define CONFIG_COLOR_FILTER 0 #define CONFIG_NULLSRC_FILTER 0 #define CONFIG_NULLSINK_FILTER 0 @@ -894,6 +933,7 @@ #define CONFIG_FILE_PROTOCOL 0 #define CONFIG_GOPHER_PROTOCOL 0 #define CONFIG_HTTP_PROTOCOL 0 +#define CONFIG_MMSH_PROTOCOL 0 #define CONFIG_MMST_PROTOCOL 0 #define CONFIG_MD5_PROTOCOL 0 #define CONFIG_PIPE_PROTOCOL 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/ffmpeg.gyp chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/ffmpeg.gyp --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/ffmpeg.gyp 2010-08-31 02:00:33.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/ffmpeg.gyp 2011-02-03 22:58:15.000000000 +0000 @@ -6,7 +6,7 @@ # ffmpeg_branding # Controls whether we build the Chromium or Google Chrome version of # FFmpeg. The Google Chrome version contains additional codecs. -# Typical values are Chromium, Chrome, ChromiumOS, and ChromeOS. +# Typical values are Chromium or Chrome. # use_system_ffmpeg # When set to non-zero will build Chromium against the system FFmpeg # headers via pkg-config. When Chromium is launched it will assume that @@ -44,11 +44,6 @@ # environment variable. Affects the ffmpeg_binaries target. 'conditions': [ - ['chromeos==1', { - 'ffmpeg_branding%': '<(branding)OS', - }, { # otherwise, assume Chrome/Chromium. - 'ffmpeg_branding%': '<(branding)', - }], ['armv7==1 and arm_neon==1', { # Need a separate config for arm+neon vs arm 'ffmpeg_config%': 'arm-neon', @@ -61,6 +56,11 @@ ['target_arch=="arm"', { 'ffmpeg_asm_lib': 0, }], + ['OS=="mac" or OS=="win"', { + 'os_config%': '<(OS)', + }, { # all other Unix OS's use the linux config + 'os_config%': 'linux', + }], # libvpx location. # TODO(scherkus): libvpx_hack_dir is a hack to make -L work on linux. @@ -77,6 +77,8 @@ 'libvpx_hack_dir': 'WebKit/chromium/third_party/libvpx', }], ], + + 'ffmpeg_branding%': '<(branding)', 'ffmpeg_variant%': '<(target_arch)', 'use_system_ffmpeg%': 0, @@ -101,18 +103,21 @@ 'patched-ffmpeg-mt/libavcodec/bitstream.c', 'patched-ffmpeg-mt/libavcodec/bitstream_filter.c', 'patched-ffmpeg-mt/libavcodec/dsputil.c', + 'patched-ffmpeg-mt/libavcodec/faandct.c', # sep 09 'patched-ffmpeg-mt/libavcodec/faanidct.c', 'patched-ffmpeg-mt/libavcodec/fft.c', 'patched-ffmpeg-mt/libavcodec/golomb.c', 'patched-ffmpeg-mt/libavcodec/imgconvert.c', + 'patched-ffmpeg-mt/libavcodec/jfdctfst.c', # sep 09 + 'patched-ffmpeg-mt/libavcodec/jfdctint.c', # sep 09 'patched-ffmpeg-mt/libavcodec/jrevdct.c', - 'patched-ffmpeg-mt/libavcodec/libvpxdec.c', 'patched-ffmpeg-mt/libavcodec/mdct.c', 'patched-ffmpeg-mt/libavcodec/mpeg12data.c', 'patched-ffmpeg-mt/libavcodec/mpeg4audio.c', 'patched-ffmpeg-mt/libavcodec/opt.c', 'patched-ffmpeg-mt/libavcodec/options.c', 'patched-ffmpeg-mt/libavcodec/parser.c', + 'patched-ffmpeg-mt/libavcodec/pcm.c', 'patched-ffmpeg-mt/libavcodec/pthread.c', 'patched-ffmpeg-mt/libavcodec/raw.c', 'patched-ffmpeg-mt/libavcodec/simple_idct.c', @@ -123,14 +128,16 @@ 'patched-ffmpeg-mt/libavcodec/vp3.c', 'patched-ffmpeg-mt/libavcodec/vp3dsp.c', 'patched-ffmpeg-mt/libavcodec/xiph.c', - 'patched-ffmpeg-mt/libavcore/imgutils.c', # aug 11 + 'patched-ffmpeg-mt/libavcore/imgutils.c', # aug 11 'patched-ffmpeg-mt/libavcore/parseutils.c', # aug 11 + 'patched-ffmpeg-mt/libavcore/samplefmt.c', # nov 4 'patched-ffmpeg-mt/libavformat/allformats.c', 'patched-ffmpeg-mt/libavformat/avi.c', 'patched-ffmpeg-mt/libavformat/avio.c', 'patched-ffmpeg-mt/libavformat/aviobuf.c', 'patched-ffmpeg-mt/libavformat/cutils.c', 'patched-ffmpeg-mt/libavformat/id3v1.c', + 'patched-ffmpeg-mt/libavformat/id3v2.c', 'patched-ffmpeg-mt/libavformat/isom.c', 'patched-ffmpeg-mt/libavformat/matroska.c', 'patched-ffmpeg-mt/libavformat/matroskadec.c', @@ -142,13 +149,16 @@ 'patched-ffmpeg-mt/libavformat/oggparsetheora.c', 'patched-ffmpeg-mt/libavformat/oggparsevorbis.c', 'patched-ffmpeg-mt/libavformat/options.c', + 'patched-ffmpeg-mt/libavformat/pcm.c', # sep 09 'patched-ffmpeg-mt/libavformat/riff.c', 'patched-ffmpeg-mt/libavformat/rm.c', 'patched-ffmpeg-mt/libavformat/rmdec.c', 'patched-ffmpeg-mt/libavformat/utils.c', 'patched-ffmpeg-mt/libavformat/vorbiscomment.c', + 'patched-ffmpeg-mt/libavformat/wav.c', 'patched-ffmpeg-mt/libavutil/avstring.c', 'patched-ffmpeg-mt/libavutil/base64.c', + 'patched-ffmpeg-mt/libavutil/cpu.c', # sep 09 'patched-ffmpeg-mt/libavutil/crc.c', 'patched-ffmpeg-mt/libavutil/eval.c', 'patched-ffmpeg-mt/libavutil/intfloat_readwrite.c', @@ -157,14 +167,14 @@ 'patched-ffmpeg-mt/libavutil/lzo.c', 'patched-ffmpeg-mt/libavutil/mathematics.c', 'patched-ffmpeg-mt/libavutil/mem.c', + 'patched-ffmpeg-mt/libavutil/opt.c', # oct 05 'patched-ffmpeg-mt/libavutil/pixdesc.c', 'patched-ffmpeg-mt/libavutil/rational.c', - # Config file for the OS and architecture. - 'config/<(ffmpeg_branding)/<(OS)/<(ffmpeg_config)/config.h', + 'config/<(ffmpeg_branding)/<(os_config)/<(ffmpeg_config)/config.h', 'config/libavutil/avconfig.h', ], 'include_dirs': [ - 'config/<(ffmpeg_branding)/<(OS)/<(ffmpeg_config)', + 'config/<(ffmpeg_branding)/<(os_config)/<(ffmpeg_config)', 'patched-ffmpeg-mt', 'config', ], @@ -176,7 +186,7 @@ '-fomit-frame-pointer', ], 'conditions': [ - ['ffmpeg_branding=="Chrome" or ffmpeg_branding=="ChromeOS"', { + ['ffmpeg_branding=="Chrome"', { 'sources': [ 'patched-ffmpeg-mt/libavcodec/aacadtsdec.c', #new 'patched-ffmpeg-mt/libavcodec/aacdec.c', @@ -205,101 +215,37 @@ 'patched-ffmpeg-mt/libavcodec/mpegvideo.c', 'patched-ffmpeg-mt/libavcodec/rdft.c', 'patched-ffmpeg-mt/libavformat/gxf.c', - 'patched-ffmpeg-mt/libavformat/id3v2.c', 'patched-ffmpeg-mt/libavformat/mov.c', 'patched-ffmpeg-mt/libavformat/mp3.c', ], }], # ffmpeg_branding - ['ffmpeg_branding=="ChromiumOS" or ffmpeg_branding=="ChromeOS"', { - 'sources': [ - 'patched-ffmpeg-mt/libavcodec/pcm.c', - 'patched-ffmpeg-mt/libavformat/raw.c', - 'patched-ffmpeg-mt/libavformat/wav.c', - ], - }], # ffmpeg_branding - ['ffmpeg_branding=="ChromeOS"', { - 'sources': [ - 'patched-ffmpeg-mt/libavcodec/aandcttab.c', - 'patched-ffmpeg-mt/libavcodec/error_resilience.c', - 'patched-ffmpeg-mt/libavcodec/faandct.c', - 'patched-ffmpeg-mt/libavcodec/h263.c', - 'patched-ffmpeg-mt/libavcodec/h263_parser.c', - 'patched-ffmpeg-mt/libavcodec/h263dec.c', - 'patched-ffmpeg-mt/libavcodec/h264_mp4toannexb_bsf.c', - 'patched-ffmpeg-mt/libavcodec/intrax8.c', - 'patched-ffmpeg-mt/libavcodec/intrax8dsp.c', - 'patched-ffmpeg-mt/libavcodec/ituh263dec.c', - 'patched-ffmpeg-mt/libavcodec/ituh263enc.c', - 'patched-ffmpeg-mt/libavcodec/jfdctint.c', - 'patched-ffmpeg-mt/libavcodec/jfdctfst.c', - 'patched-ffmpeg-mt/libavcodec/motion_est.c', - 'patched-ffmpeg-mt/libavcodec/mpeg4data.h', - 'patched-ffmpeg-mt/libavcodec/mpeg4video.c', - 'patched-ffmpeg-mt/libavcodec/mpeg4video.h', - 'patched-ffmpeg-mt/libavcodec/mpeg4video_parser.c', - 'patched-ffmpeg-mt/libavcodec/mpeg4video_es_bsf.c', - 'patched-ffmpeg-mt/libavcodec/mpeg4videoenc.c', - 'patched-ffmpeg-mt/libavcodec/mpeg4videodec.c', - 'patched-ffmpeg-mt/libavcodec/mpegvideo.c', - 'patched-ffmpeg-mt/libavcodec/mpegvideo_enc.c', - 'patched-ffmpeg-mt/libavcodec/msmpeg4.c', - 'patched-ffmpeg-mt/libavcodec/msmpeg4data.c', - 'patched-ffmpeg-mt/libavcodec/ratecontrol.c', - 'patched-ffmpeg-mt/libavcodec/vc1.c', - 'patched-ffmpeg-mt/libavcodec/vc1data.c', - 'patched-ffmpeg-mt/libavcodec/vc1dec.c', - 'patched-ffmpeg-mt/libavcodec/vc1dsp.c', - 'patched-ffmpeg-mt/libavcodec/wma.c', - 'patched-ffmpeg-mt/libavcodec/wmadec.c', - 'patched-ffmpeg-mt/libavcodec/wmaprodec.c', - 'patched-ffmpeg-mt/libavcodec/wmv2.c', - 'patched-ffmpeg-mt/libavcodec/wmv2dec.c', - 'patched-ffmpeg-mt/libavcodec/vc1_asftoannexg_bsf.c', - 'patched-ffmpeg-mt/libavcodec/vc1_asftorcv_bsf.c', - 'patched-ffmpeg-mt/libavformat/asf.c', - 'patched-ffmpeg-mt/libavformat/asfcrypt.c', - 'patched-ffmpeg-mt/libavformat/asfdec.c', - 'patched-ffmpeg-mt/libavformat/avidec.c', - 'patched-ffmpeg-mt/libavformat/avlanguage.c', - 'patched-ffmpeg-mt/libavutil/des.c', - 'patched-ffmpeg-mt/libavutil/rc4.c', - ], - }], # ffmpeg_branding ['target_arch=="ia32" or target_arch=="x64"', { 'dependencies': [ 'make_ffmpeg_asm_lib', ], 'sources': [ - 'patched-ffmpeg-mt/libavcodec/x86/cpuid.c', + 'patched-ffmpeg-mt/libavcodec/libvpxdec.c', + 'patched-ffmpeg-mt/libavcodec/libvpxenc.c', # sep 09 'patched-ffmpeg-mt/libavcodec/x86/dsputil_mmx.c', + 'patched-ffmpeg-mt/libavcodec/x86/dsputilenc_mmx.c', # sep 09 'patched-ffmpeg-mt/libavcodec/x86/fdct_mmx.c', 'patched-ffmpeg-mt/libavcodec/x86/fft.c', - 'patched-ffmpeg-mt/libavcodec/x86/fft_3dn.c', - 'patched-ffmpeg-mt/libavcodec/x86/fft_3dn2.c', 'patched-ffmpeg-mt/libavcodec/x86/fft_sse.c', + 'patched-ffmpeg-mt/libavcodec/x86/h264_intrapred_init.c', # sep 09 + 'patched-ffmpeg-mt/libavcodec/x86/h264dsp_mmx.c', # sep 09 'patched-ffmpeg-mt/libavcodec/x86/idct_mmx_xvid.c', 'patched-ffmpeg-mt/libavcodec/x86/idct_sse2_xvid.c', + 'patched-ffmpeg-mt/libavcodec/x86/motion_est_mmx.c', # sep 09 'patched-ffmpeg-mt/libavcodec/x86/simple_idct_mmx.c', - 'patched-ffmpeg-mt/libavcodec/x86/vp3dsp_mmx.c', - 'patched-ffmpeg-mt/libavcodec/x86/vp3dsp_sse2.c', + 'patched-ffmpeg-mt/libavutil/x86/cpu.c', # sep 09 ], }], - ['(target_arch=="ia32" or target_arch=="x64") and (ffmpeg_branding=="ChromeOS" or ffmpeg_branding=="Chrome")', { + ['(target_arch=="ia32" or target_arch=="x64") and ffmpeg_branding=="Chrome"', { 'dependencies': [ 'make_ffmpeg_asm_lib', ], 'sources': [ 'patched-ffmpeg-mt/libavcodec/x86/mpegvideo_mmx.c', -# aug 11 'patched-ffmpeg-mt/libavcodec/x86/h264dsp_mmx.c', - - ], - }], - ['(target_arch=="ia32" or target_arch=="x64") and ffmpeg_branding=="ChromeOS"', { - 'dependencies': [ - 'make_ffmpeg_asm_lib', - ], - 'sources': [ - 'patched-ffmpeg-mt/libavcodec/x86/vc1dsp_mmx.c', ], }], ['target_arch=="ia32"', { @@ -340,6 +286,7 @@ 'patched-ffmpeg-mt/libavcodec/arm/simple_idct_arm.S', 'patched-ffmpeg-mt/libavcodec/arm/simple_idct_armv5te.S', 'patched-ffmpeg-mt/libavcodec/arm/simple_idct_armv6.S', + 'patched-ffmpeg-mt/libavutil/arm/cpu.c', ], # TODO(scherkus): Temporary until libvpx compiles on ARM. 'sources!': [ @@ -352,15 +299,16 @@ 'patched-ffmpeg-mt/libavcodec/arm/dsputil_neon.S', 'patched-ffmpeg-mt/libavcodec/arm/fft_neon.S', 'patched-ffmpeg-mt/libavcodec/arm/int_neon.S', + 'patched-ffmpeg-mt/libavcodec/arm/mdct_neon.S', + 'patched-ffmpeg-mt/libavcodec/arm/mpegvideo_neon.S', # oct 10 'patched-ffmpeg-mt/libavcodec/arm/rdft_neon.S', 'patched-ffmpeg-mt/libavcodec/arm/simple_idct_neon.S', 'patched-ffmpeg-mt/libavcodec/arm/vp3dsp_neon.S', - 'patched-ffmpeg-mt/libavcodec/arm/mdct_neon.S', ], }], ], }], # target_arch=="arm" - ['target_arch=="arm" and (ffmpeg_branding=="Chrome" or ffmpeg_branding=="ChromeOS")', { + ['target_arch=="arm" and ffmpeg_branding=="Chrome"', { 'sources': [ 'patched-ffmpeg-mt/libavcodec/arm/h264dsp_init_arm.c', 'patched-ffmpeg-mt/libavcodec/arm/h264pred_init_arm.c', @@ -422,11 +370,24 @@ 'ldflags': [ '-L<(libvpx_hack_dir)/lib/<(OS)/<(target_arch)', ], + }, { + # Using libvpx provided by the system. + 'ldflags': [ + '-L/usr/local/lib', + ], }], ], }, }], # OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" ['OS=="mac"', { + 'conditions': [ + ['mac_breakpad==1', { + 'variables': { + # A real .dSYM is needed for dump_syms to operate on. + 'mac_real_dsym': 1, + }, + }], + ], 'libraries': [ # TODO(ajwong): Move into link_settings when this is fixed: # @@ -516,13 +477,17 @@ ], 'sources': [ # The FFmpeg yasm files. - 'patched-ffmpeg-mt/libavcodec/x86/deinterlace.asm', # aug 11 + 'patched-ffmpeg-mt/libavcodec/x86/deinterlace.asm', # aug 11 'patched-ffmpeg-mt/libavcodec/x86/dsputil_yasm.asm', + 'patched-ffmpeg-mt/libavcodec/x86/dsputilenc_yasm.asm',# oct 05 'patched-ffmpeg-mt/libavcodec/x86/fft_mmx.asm', - 'patched-ffmpeg-mt/libavcodec/x86/h264_deblock_sse2.asm', # aug 11 - 'patched-ffmpeg-mt/libavcodec/x86/h264_intrapred.asm', # new - 'patched-ffmpeg-mt/libavcodec/x86/h264_weight_sse2.asm', # aug 11 - 'patched-ffmpeg-mt/libavcodec/x86/vc1dsp_yasm.asm', # new + 'patched-ffmpeg-mt/libavcodec/x86/h264_chromamc.asm', # sep 09 + 'patched-ffmpeg-mt/libavcodec/x86/h264_deblock.asm', # sep 09 + 'patched-ffmpeg-mt/libavcodec/x86/h264_idct.asm', # oct 05 + 'patched-ffmpeg-mt/libavcodec/x86/h264_intrapred.asm', # new + 'patched-ffmpeg-mt/libavcodec/x86/h264_weight.asm', # sep 09 + 'patched-ffmpeg-mt/libavcodec/x86/vc1dsp_yasm.asm', # new + 'patched-ffmpeg-mt/libavcodec/x86/vp3dsp.asm', # sep 09 ], 'rules': [ { @@ -615,13 +580,18 @@ # Make sure this stays in sync with the corresponding sources # in assemble_ffmpeg_asm. 'asm_objects': [ + '<(shared_generated_dir)/deinterlace.o', '<(shared_generated_dir)/dsputil_yasm.o', + '<(shared_generated_dir)/dsputilenc_yasm.o', '<(shared_generated_dir)/fft_mmx.o', - '<(shared_generated_dir)/h264_deblock_sse2.o', + '<(shared_generated_dir)/h264_chromamc.o', + '<(shared_generated_dir)/h264_deblock.o', + '<(shared_generated_dir)/h264_idct.o', '<(shared_generated_dir)/h264_intrapred.o', - '<(shared_generated_dir)/h264_weight_sse2.o', + '<(shared_generated_dir)/h264_weight.o', '<(shared_generated_dir)/vc1dsp_yasm.o', + '<(shared_generated_dir)/vp3dsp.o', ], 'library_path': '<(shared_generated_dir)/<(STATIC_LIB_PREFIX)<(asm_library)<(STATIC_LIB_SUFFIX)', }, @@ -671,16 +641,29 @@ ], # conditions 'targets': [ { + # Determine whether we should export libvpx symbols. 'variables': { 'generate_stubs_script': '../../tools/generate_stubs/generate_stubs.py', - 'sig_files': [ - # Note that these must be listed in dependency order. - # (i.e. if A depends on B, then B must be listed before A.) - 'avutil-50.sigs', - 'avcodec-52.sigs', - 'avformat-52.sigs', - ], 'extra_header': 'ffmpeg_stub_headers.fragment', + 'conditions': [ + ['target_arch=="arm" or use_system_ffmpeg==1 or use_system_vpx == 1', { + 'sig_files': [ + # Note that these must be listed in dependency order. + # (i.e. if A depends on B, then B must be listed before A.) + 'avutil-50.sigs', + 'avcodec-52.novpx_sigs', + 'avformat-52.sigs', + ], + }, { # otherwise we export libvpx symbols. + 'sig_files': [ + # Note that these must be listed in dependency order. + # (i.e. if A depends on B, then B must be listed before A.) + 'avutil-50.sigs', + 'avcodec-52.sigs', + 'avformat-52.sigs', + ], + }], + ], }, 'target_name': 'ffmpeg', @@ -749,6 +732,25 @@ }, 'rules': [ { + # TODO(hclam): Remove this when the novpx hack is unneeded. + 'rule_name': 'generate_libs_novpx', + 'extension': 'novpx_sigs', + 'inputs': [ + '<(generate_stubs_script)', + '<@(sig_files)', + ], + 'outputs': [ + '<(output_dir)/<(RULE_INPUT_ROOT).lib', + ], + 'action': ['python', '<(generate_stubs_script)', + '-i', '<(intermediate_dir)', + '-o', '<(output_dir)', + '-t', '<(outfile_type)', + '<@(RULE_INPUT_PATH)', + ], + 'message': 'Generating FFmpeg import libraries.', + }, + { 'rule_name': 'generate_libs', 'extension': 'sigs', 'inputs': [ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/ffmpeg_stub_headers.fragment chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/ffmpeg_stub_headers.fragment --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/src/source/ffmpeg_stub_headers.fragment 2010-06-09 02:00:31.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/src/source/ffmpeg_stub_headers.fragment 2011-02-03 22:58:15.000000000 +0000 @@ -6,6 +6,11 @@ #include #include +#define VPX_CODEC_DISABLE_COMPAT 1 +#include "third_party/libvpx/include/vpx/vpx_codec.h" +#include "third_party/libvpx/include/vpx/vpx_encoder.h" +#include "third_party/libvpx/include/vpx/vpx_decoder.h" + typedef int (*AVLockMgrOperation)(void**, enum AVLockOp); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/Changelog chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/Changelog --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/Changelog 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/Changelog 2010-11-06 17:21:26.000000000 +0000 @@ -8,7 +8,6 @@ - low overhead Ogg muxing - MMS-TCP support - VP8 de/encoding via libvpx -- CODEC_CAP_EXPERIMENTAL added - Demuxer for On2's IVF format - Pictor/PC Paint decoder - HE-AAC v2 decoder @@ -28,7 +27,32 @@ - Chinese AVS encoding via libxavs - ffprobe -show_packets option added - RTP packetization of Theora and Vorbis - +- RTP depacketization of MP4A-LATM +- RTP packetization and depacketization of VP8 +- hflip filter +- Apple HTTP Live Streaming demuxer +- a64 codec +- MMS-HTTP support +- G.722 ADPCM audio encoder/decoder +- R10k video decoder +- ocv_smooth filter +- frei0r wrapper filter +- change crop filter syntax to width:height:x:y +- make the crop filter accept parametric expressions +- make ffprobe accept AVFormatContext options +- yadif filter +- blackframe filter +- Demuxer for Leitch/Harris' VR native stream format (LXF) +- RTP depacketization of the X-QT QuickTime format +- SAP (Session Announcement Protocol, RFC 2974) muxer and demuxer +- cropdetect filter +- ffmpeg -crop* options removed +- transpose filter added +- ffmpeg -force_key_frames option added +- demuxer for receiving raw rtp:// URLs without an SDP description +- single stream LATM/LOAS decoder +- setpts filter added +- Win64 support for optimized asm functions version 0.6: @@ -109,7 +133,6 @@ - RealAudio 1.0 (14.4K) encoder - version 0.5: - DV50 AKA DVCPRO50 encoder, decoder, muxer and demuxer @@ -272,7 +295,6 @@ - generic metadata API - version 0.4.9-pre1: - DV encoder, DV muxer @@ -357,7 +379,6 @@ - FunCom ISS audio file demuxer and according ADPCM decoding - version 0.4.8: - MPEG-2 video encoding (Michael) @@ -369,7 +390,6 @@ - Duck DK3 and DK4 ADPCM audio decoders (Mike Melanson) - version 0.4.7: - RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from mplayerhq @@ -411,7 +431,6 @@ .. And lots more new enhancements and fixes. - version 0.4.6: - completely new integer only MPEG audio layer 1/2/3 decoder rewritten @@ -449,7 +468,6 @@ - 16-bit and 15-bit RGB/BGR/GBR support (Bisqwit) - version 0.4.5: - some header fixes (Zdenek Kabelac ) @@ -481,7 +499,6 @@ - added JPEG image format support (input/output) - version 0.4.4: - fixed some std header definitions (Bjorn Lindgren @@ -507,7 +524,6 @@ segfault) - version 0.4.3: - BGR24 patch (initial patch by Jeroen Vreeken ) @@ -529,7 +545,6 @@ instead of a protocol) - version 0.4.2: - added H.263/MPEG-4/MSMPEG4 decoding support. MPEG-4 decoding support @@ -560,7 +575,6 @@ - factorized some motion estimation code - version 0.4.0: - removing grab code from ffserver and moved it to ffmpeg. Added @@ -589,13 +603,11 @@ codecs - version 0.3.4: - added stereo in MPEG audio encoder - version 0.3.3: - added 'high quality' mode which use motion vectors. It can be used in @@ -604,14 +616,12 @@ bitrates and large GOP size - version 0.3.2: small fixes - ASF fixes - put_seek bug fix - version 0.3.1: added avi/divx support - added AVI support @@ -619,5 +629,4 @@ - added sound for flash format (not tested) - version 0.3: initial public release diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/cmdutils.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/cmdutils.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/cmdutils.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/cmdutils.c 2010-11-06 17:21:26.000000000 +0000 @@ -49,6 +49,7 @@ #endif const char **opt_names; +const char **opt_values; static int opt_name_count; AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; AVFormatContext *avformat_opts; @@ -56,6 +57,30 @@ const int this_year = 2010; +void init_opts(void) +{ + int i; + for (i = 0; i < AVMEDIA_TYPE_NB; i++) + avcodec_opts[i] = avcodec_alloc_context2(i); + avformat_opts = avformat_alloc_context(); + sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, NULL, NULL, NULL); +} + +void uninit_opts(void) +{ + int i; + for (i = 0; i < AVMEDIA_TYPE_NB; i++) + av_freep(&avcodec_opts[i]); + av_freep(&avformat_opts->key); + av_freep(&avformat_opts); + av_freep(&sws_opts); +} + +void log_callback_help(void* ptr, int level, const char* fmt, va_list vl) +{ + vfprintf(stdout, fmt, vl); +} + double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max) { char *tail; @@ -193,12 +218,12 @@ const AVOption *o= NULL; int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0}; - for(type=0; type= 0; type++){ + for(type=0; *avcodec_opts && type= 0; type++){ const AVOption *o2 = av_find_opt(avcodec_opts[0], opt, NULL, opt_types[type], opt_types[type]); if(o2) ret = av_set_string3(avcodec_opts[type], opt, arg, 1, &o); } - if(!o) + if(!o && avformat_opts) ret = av_set_string3(avformat_opts, opt, arg, 1, &o); if(!o && sws_opts) ret = av_set_string3(sws_opts, opt, arg, 1, &o); @@ -215,17 +240,27 @@ exit(1); } if (!o) { + AVCodec *p = NULL; + while ((p=av_codec_next(p))){ + AVClass *c= p->priv_class; + if(c && av_find_opt(&c, opt, NULL, 0, 0)) + break; + } + if(!p){ fprintf(stderr, "Unrecognized option '%s'\n", opt); exit(1); + } } // av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avcodec_opts, opt, NULL), (int)av_get_int(avcodec_opts, opt, NULL)); //FIXME we should always use avcodec_opts, ... for storing options so there will not be any need to keep track of what i set over this + opt_values= av_realloc(opt_values, sizeof(void*)*(opt_name_count+1)); + opt_values[opt_name_count]= o ? NULL : arg; opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1)); - opt_names[opt_name_count++]= o->name; + opt_names[opt_name_count++]= o ? o->name : opt; - if(avcodec_opts[0]->debug || avformat_opts->debug) + if ((*avcodec_opts && avcodec_opts[0]->debug) || (avformat_opts && avformat_opts->debug)) av_log_set_level(AV_LOG_DEBUG); return 0; } @@ -278,9 +313,16 @@ return 0; } -void set_context_opts(void *ctx, void *opts_ctx, int flags) +void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec) { int i; + void *priv_ctx=NULL; + if(!strcmp("AVCodecContext", (*(AVClass**)ctx)->class_name)){ + AVCodecContext *avctx= ctx; + if(codec && codec->priv_class && avctx->priv_data){ + priv_ctx= avctx->priv_data; + } + } for(i=0; iflags & flags) == flags)) av_set_string3(ctx, opt_names[i], str, 1, NULL); + /* We need to use a differnt system to pass options to the private context because + it is not known which codec and thus context kind that will be when parsing options + we thus use opt_values directly instead of opts_ctx */ + if(!str && priv_ctx && av_get_string(priv_ctx, opt_names[i], &opt, buf, sizeof(buf))){ + av_set_string3(priv_ctx, opt_names[i], opt_values[i], 1, NULL); + } } } @@ -672,3 +720,93 @@ fclose(f); return 0; } + +void init_pts_correction(PtsCorrectionContext *ctx) +{ + ctx->num_faulty_pts = ctx->num_faulty_dts = 0; + ctx->last_pts = ctx->last_dts = INT64_MIN; +} + +int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t reordered_pts, int64_t dts) +{ + int64_t pts = AV_NOPTS_VALUE; + + if (dts != AV_NOPTS_VALUE) { + ctx->num_faulty_dts += dts <= ctx->last_dts; + ctx->last_dts = dts; + } + if (reordered_pts != AV_NOPTS_VALUE) { + ctx->num_faulty_pts += reordered_pts <= ctx->last_pts; + ctx->last_pts = reordered_pts; + } + if ((ctx->num_faulty_pts<=ctx->num_faulty_dts || dts == AV_NOPTS_VALUE) + && reordered_pts != AV_NOPTS_VALUE) + pts = reordered_pts; + else + pts = dts; + + return pts; +} + +#if CONFIG_AVFILTER + +static int ffsink_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + FFSinkContext *priv = ctx->priv; + + if (!opaque) + return AVERROR(EINVAL); + *priv = *(FFSinkContext *)opaque; + + return 0; +} + +static void null_end_frame(AVFilterLink *inlink) { } + +static int ffsink_query_formats(AVFilterContext *ctx) +{ + FFSinkContext *priv = ctx->priv; + enum PixelFormat pix_fmts[] = { priv->pix_fmt, PIX_FMT_NONE }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +AVFilter ffsink = { + .name = "ffsink", + .priv_size = sizeof(FFSinkContext), + .init = ffsink_init, + + .query_formats = ffsink_query_formats, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .end_frame = null_end_frame, + .min_perms = AV_PERM_READ, }, + { .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = NULL }}, +}; + +int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame, + AVFilterBufferRef **picref_ptr, AVRational *tb) +{ + int ret; + AVFilterBufferRef *picref; + + if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0) + return ret; + if (!(picref = ctx->inputs[0]->cur_buf)) + return AVERROR(ENOENT); + *picref_ptr = picref; + ctx->inputs[0]->cur_buf = NULL; + *tb = ctx->inputs[0]->time_base; + + memcpy(frame->data, picref->data, sizeof(frame->data)); + memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize)); + frame->interlaced_frame = picref->video->interlaced; + frame->top_field_first = picref->video->top_field_first; + + return 1; +} + +#endif /* CONFIG_AVFILTER */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/cmdutils.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/cmdutils.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/cmdutils.h 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/cmdutils.h 2010-11-06 17:21:26.000000000 +0000 @@ -45,6 +45,23 @@ extern struct SwsContext *sws_opts; /** + * Initialize the cmdutils option system, in particular + * allocate the *_opts contexts. + */ +void init_opts(void); +/** + * Uninitialize the cmdutils option system, in particular + * free the *_opts contexts and their contents. + */ +void uninit_opts(void); + +/** + * Trivial log callback. + * Only suitable for show_help and similar since it lacks prefix handling. + */ +void log_callback_help(void* ptr, int level, const char* fmt, va_list vl); + +/** * Fallback for options that are not explicitly handled, these will be * parsed through AVOptions. */ @@ -132,7 +149,7 @@ void parse_options(int argc, char **argv, const OptionDef *options, void (* parse_arg_function)(const char*)); -void set_context_opts(void *ctx, void *opts_ctx, int flags); +void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec); /** * Print an error message to stderr, indicating filename and a human @@ -220,4 +237,48 @@ */ int read_file(const char *filename, char **bufptr, size_t *size); +typedef struct { + int64_t num_faulty_pts; /// Number of incorrect PTS values so far + int64_t num_faulty_dts; /// Number of incorrect DTS values so far + int64_t last_pts; /// PTS of the last frame + int64_t last_dts; /// DTS of the last frame +} PtsCorrectionContext; + +/** + * Reset the state of the PtsCorrectionContext. + */ +void init_pts_correction(PtsCorrectionContext *ctx); + +/** + * Attempt to guess proper monotonic timestamps for decoded video frames + * which might have incorrect times. Input timestamps may wrap around, in + * which case the output will as well. + * + * @param pts the pts field of the decoded AVPacket, as passed through + * AVCodecContext.reordered_opaque + * @param dts the dts field of the decoded AVPacket + * @return one of the input values, may be AV_NOPTS_VALUE + */ +int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t pts, int64_t dts); + +#if CONFIG_AVFILTER +#include "libavfilter/avfilter.h" + +typedef struct { + enum PixelFormat pix_fmt; +} FFSinkContext; + +extern AVFilter ffsink; + +/** + * Extract a frame from sink. + * + * @return a negative error in case of failure, 1 if one frame has + * been extracted successfully. + */ +int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame, + AVFilterBufferRef **picref, AVRational *pts_tb); + +#endif /* CONFIG_AVFILTER */ + #endif /* FFMPEG_CMDUTILS_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/common.mak chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/common.mak --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/common.mak 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/common.mak 2010-11-06 17:21:26.000000000 +0000 @@ -36,6 +36,7 @@ IFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) CPPFLAGS := $(IFLAGS) $(CPPFLAGS) CFLAGS += $(ECFLAGS) +YASMFLAGS += $(IFLAGS) -Pconfig.asm HOSTCFLAGS += $(IFLAGS) @@ -106,11 +107,8 @@ $(HOSTPROGS): %$(HOSTEXESUF): %.o $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS) -DEPS := $(OBJS:.o=.d) -depend dep: $(DEPS) - CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver DISTCLEANSUFFIXES = *.pc LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp --include $(wildcard $(DEPS)) +-include $(wildcard $(OBJS:.o=.d)) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/configure chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/configure --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/configure 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/configure 2010-11-06 17:21:26.000000000 +0000 @@ -162,8 +162,10 @@ External library support: --enable-avisynth enable reading of AVISynth script files [no] --enable-bzlib enable bzlib [autodetect] + --enable-frei0r enable frei0r video filtering --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no] --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no] + --enable-libopencv enable video filtering via libopencv [no] --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394 and libraw1394 [no] --enable-libdirac enable Dirac support via libdirac [no] @@ -495,20 +497,29 @@ done } +print_config_h(){ + enabled $1 && v=1 || v=0 + echo "#define $2 $v" +} + +print_config_mak(){ + enabled $1 && v= || v=! + echo "$v$2=yes" +} + +print_config_asm(){ + enabled $1 && echo "%define $2" +} + print_config(){ pfx=$1 - header=$2 - makefile=$3 - shift 3 + files=$2 + shift 2 for cfg; do ucname="$(toupper $cfg)" - if enabled $cfg; then - echo "#define ${pfx}${ucname} 1" >> $header - echo "${pfx}${ucname}=yes" >> $makefile - else - echo "#define ${pfx}${ucname} 0" >> $header - echo "!${pfx}${ucname}=yes" >> $makefile - fi + for f in $files; do + "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f + done done } @@ -863,6 +874,7 @@ ffprobe ffserver fft + frei0r golomb gpl gray @@ -878,6 +890,7 @@ libnut libopencore_amrnb libopencore_amrwb + libopencv libopenjpeg librtmp libschroedinger @@ -899,6 +912,7 @@ pic postproc rdft + rtpdec runtime_cpudetect shared small @@ -970,6 +984,7 @@ $ARCH_EXT_LIST $HAVE_LIST_PUB $THREADS_LIST + aligned_stack alsa_asoundlib_h altivec_h arpa_inet_h @@ -1038,6 +1053,7 @@ poll_h setrlimit strerror_r + strtok_r struct_addrinfo struct_ipv6_mreq struct_sockaddr_in6 @@ -1059,6 +1075,7 @@ VirtualAlloc winsock2_h xform_asm + xmm_clobbers yasm " @@ -1153,6 +1170,7 @@ sse_deps="mmx" ssse3_deps="sse" +aligned_stack_if_any="ppc x86" fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64" fast_clz_if_any="alpha armv5te avr32 mips ppc x86" fast_unaligned_if_any="armv6 ppc x86" @@ -1170,6 +1188,7 @@ # decoders / encoders / hardware accelerators aac_decoder_select="mdct rdft" aac_encoder_select="mdct" +aac_latm_decoder_select="aac_decoder aac_latm_parser" ac3_decoder_select="mdct ac3_parser" alac_encoder_select="lpc" amrnb_decoder_select="lsp" @@ -1344,11 +1363,13 @@ mxf_d10_muxer_select="mxf_muxer" ogg_demuxer_select="golomb" psp_muxer_select="mov_muxer" -rtsp_demuxer_deps="sdp_demuxer" -rtsp_muxer_deps="sdp_demuxer" -rtsp_muxer_select="rtp_muxer" -sdp_demuxer_deps="rtp_protocol mpegts_demuxer" -sdp_demuxer_select="asf_demuxer rm_demuxer" +rtp_demuxer_select="sdp_demuxer" +rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer" +rtsp_demuxer_select="http_protocol rtpdec" +rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol" +sap_demuxer_select="sdp_demuxer" +sap_muxer_select="rtp_muxer rtp_protocol" +sdp_demuxer_select="rtpdec" spdif_muxer_select="aac_parser" tg2_muxer_select="mov_muxer" tgp_muxer_select="mov_muxer" @@ -1374,12 +1395,20 @@ gopher_protocol_deps="network" http_protocol_deps="network" http_protocol_select="tcp_protocol" +mmsh_protocol_select="http_protocol" mmst_protocol_deps="network" rtmp_protocol_select="tcp_protocol" rtp_protocol_select="udp_protocol" tcp_protocol_deps="network" udp_protocol_deps="network" +# filters +blackframe_filter_deps="gpl" +cropdetect_filter_deps="gpl" +frei0r_filter_deps="frei0r dlopen strtok_r" +ocv_smooth_filter_deps="libopencv" +yadif_filter_deps="gpl" + # libraries avdevice_deps="avcodec avformat" avformat_deps="avcodec" @@ -1427,7 +1456,7 @@ asv1 \ asv2 \ bmp \ - dnxhd="hdxhd_1080i dnxhd_720p dnxhd_720p_rd" \ + dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \ dvvideo="dv dv50" \ ffv1 \ flac \ @@ -1492,6 +1521,7 @@ set_ne_test_deps pixdesc set_ne_test_deps pixfmts_crop +set_ne_test_deps pixfmts_hflip set_ne_test_deps pixfmts_null set_ne_test_deps pixfmts_pad set_ne_test_deps pixfmts_scale @@ -1777,6 +1807,7 @@ tmpfile TMPS .S tmpfile TMPV .ver tmpfile TMPSH .sh +tmpfile TMPASM .asm unset -f mktemp @@ -1797,7 +1828,16 @@ filter_cppflags=echo filter_asflags=echo -if $cc -v 2>&1 | grep -qi ^gcc; then +if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then + cc_type=llvm_gcc + cc_version=__VERSION__ + gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)') + cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver" + CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' + AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' + speed_cflags='-O3' + size_cflags='-Os' +elif $cc -v 2>&1 | grep -qi ^gcc; then cc_type=gcc cc_version=__VERSION__ gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)') @@ -1812,6 +1852,7 @@ cc_type=icc cc_version="AV_STRINGIFY(__INTEL_COMPILER)" cc_ident=$($cc --version | head -n1) + icc_version=$($cc -dumpversion) CC_DEPFLAGS='-MMD' AS_DEPFLAGS='-MMD' speed_cflags='-O3' @@ -1843,6 +1884,7 @@ --configure_sysroot="$sysroot" \ --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 || die "Error creating armcc configuration file." + $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc" as_default="${cross_prefix}gcc" CC_DEPFLAGS='-MMD' @@ -1940,7 +1982,7 @@ esac done } -elif $cc -v 2>&1 | grep -q PathScale; then +elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then cc_type=pathscale cc_version=__PATHSCALE__ cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :) @@ -1948,6 +1990,14 @@ AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' speed_cflags='-O2' size_cflags='-Os' +elif $cc -v 2>&1 | grep -q Open64; then + cc_type=open64 + cc_version=__OPEN64__ + cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :) + CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' + AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' + speed_cflags='-O2' + size_cflags='-Os' fi test -n "$cc_type" && enable $cc_type || @@ -1966,7 +2016,7 @@ if test -n "$sysroot"; then case "$cc_type" in - gcc) + gcc|llvm_gcc) add_cppflags --sysroot="$sysroot" add_ldflags --sysroot="$sysroot" ;; @@ -1985,7 +2035,7 @@ enabled cross_compile && die "--cpu=host makes no sense when cross-compiling." case "$cc_type" in - gcc) + gcc|llvm_gcc) check_native(){ $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return sed -n "/$1=/{ @@ -2103,7 +2153,7 @@ disable cmov ;; # targets that do support conditional mov (cmov) - i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10|barcelona) + i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10|barcelona|atom) cpuflags="-march=$cpu" enable cmov enable fast_cmov @@ -2375,6 +2425,8 @@ ;; esac +echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate + check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic set_default $PATHS_LIST @@ -2541,6 +2593,9 @@ check_asm ebx_available '""::"b"(0)' && check_asm ebx_available '"":::"%ebx"' + # check whether xmm clobbers are supported + check_asm xmm_clobbers '"":::"%xmm0"' + # check whether more than 10 operands are supported check_cc <= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame enabled libnut && require libnut libnut.h nut_demuxer_init -lnut enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb +enabled libopencv && { check_lib opencv/cv.h cvCreateImageHeader $(pkg-config --libs opencv) || + die "ERROR: libopencv not found"; } enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg enabled librtmp && { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) || die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f"; } @@ -2703,8 +2771,8 @@ enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx || die "ERROR: libvpx encoder version must be >=0.9.1"; } } enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && - { check_cpp_condition x264.h "X264_BUILD >= 98" || - die "ERROR: libx264 version must be >= 0.98."; } + { check_cpp_condition x264.h "X264_BUILD >= 99" || + die "ERROR: libx264 version must be >= 0.99."; } enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib @@ -2733,7 +2801,7 @@ if enabled network; then check_type "sys/types.h sys/socket.h" socklen_t check_type netdb.h "struct addrinfo" - check_type netinet/in.h "struct ipv6_mreq" + check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE check_type netinet/in.h "struct sockaddr_in6" check_type "sys/types.h sys/socket.h" "struct sockaddr_storage" check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len @@ -2859,6 +2927,11 @@ check_ldflags -march=$cpu # icc 11.0 and 11.1 work with ebp_available, but don't pass the test enable ebp_available + if enabled x86_32; then + test ${icc_version%%.*} -ge 11 && \ + check_cflags -falign-stack=maintain-16-byte || \ + disable aligned_stack + fi elif enabled ccc; then # disable some annoying warnings add_cflags -msg_disable cvtu32to64 @@ -2871,12 +2944,15 @@ check_cflags -fno-tree-vectorize check_cflags -Werror=implicit-function-declaration check_cflags -Werror=missing-prototypes +elif enabled llvm_gcc; then + check_cflags -mllvm -stack-alignment=16 elif enabled clang; then + check_cflags -mllvm -stack-alignment=16 check_cflags -Qunused-arguments elif enabled armcc; then # 2523: use of inline assembler is deprecated - add_cflags -Wrvct,--diag_suppress=2523 - add_cflags -Wrvct,--diag_suppress=1207 + add_cflags -W${armcc_opt},--diag_suppress=2523 + add_cflags -W${armcc_opt},--diag_suppress=1207 elif enabled tms470; then add_cflags -pds=824 -pds=837 fi @@ -2962,6 +3038,7 @@ echo "SDL support ${sdl-no}" echo "Sun medialib support ${mlib-no}" echo "AVISynth enabled ${avisynth-no}" +echo "frei0r enabled ${frei0r-no}" echo "libdc1394 support ${libdc1394-no}" echo "libdirac enabled ${libdirac-no}" echo "libfaac enabled ${libfaac-no}" @@ -2970,6 +3047,7 @@ echo "libnut enabled ${libnut-no}" echo "libopencore-amrnb support ${libopencore_amrnb-no}" echo "libopencore-amrwb support ${libopencore_amrwb-no}" +echo "libopencv support ${libopencv-no}" echo "libopenjpeg enabled ${libopenjpeg-no}" echo "librtmp enabled ${librtmp-no}" echo "libschroedinger enabled ${libschroedinger-no}" @@ -3015,6 +3093,7 @@ libavcore libavdevice libavfilter + libavfilter/$arch libavformat libavutil libavutil/$arch @@ -3034,6 +3113,7 @@ libavcore/Makefile libavdevice/Makefile libavfilter/Makefile + libavfilter/${arch}/Makefile libavformat/Makefile libavutil/Makefile libpostproc/Makefile @@ -3045,6 +3125,8 @@ enabled stripping || strip="echo skipping strip" +config_files="$TMPH config.mak" + cat > config.mak <> $TMPH fi -print_config ARCH_ $TMPH config.mak $ARCH_LIST -print_config HAVE_ $TMPH config.mak $HAVE_LIST -print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \ - $CONFIG_EXTRA \ - $DECODER_LIST \ - $ENCODER_LIST \ - $HWACCEL_LIST \ - $PARSER_LIST \ - $BSF_LIST \ - $DEMUXER_LIST \ - $MUXER_LIST \ - $FILTER_LIST \ - $PROTOCOL_LIST \ - $INDEV_LIST \ - $OUTDEV_LIST \ +if enabled yasm; then + append config_files $TMPASM + printf '' >$TMPASM +fi + +print_config ARCH_ "$config_files" $ARCH_LIST +print_config HAVE_ "$config_files" $HAVE_LIST +print_config CONFIG_ "$config_files" $CONFIG_LIST \ + $CONFIG_EXTRA \ + $DECODER_LIST \ + $ENCODER_LIST \ + $HWACCEL_LIST \ + $PARSER_LIST \ + $BSF_LIST \ + $DEMUXER_LIST \ + $MUXER_LIST \ + $FILTER_LIST \ + $PROTOCOL_LIST \ + $INDEV_LIST \ + $OUTDEV_LIST \ cat >>config.mak < $TMPH <> $TMPH cp_if_changed $TMPH libavutil/avconfig.h -echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate - test -n "$WARNINGS" && printf "\n$WARNINGS" # build pkg-config files @@ -3216,7 +3304,7 @@ version=$3 libs=$4 requires=$5 -enabled $shortname || return 0 +enabled ${name#lib} || return 0 cat < $name/$name.pc prefix=$prefix exec_prefix=\${prefix} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/APIchanges chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/APIchanges --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/APIchanges 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/APIchanges 2010-11-06 17:21:26.000000000 +0000 @@ -13,6 +13,121 @@ API changes, most recent first: +2010-11-02 - r25654 - lavcore 0.12.0 - av_get_bits_per_sample_fmt() + Add av_get_bits_per_sample_fmt() to libavcore/samplefmt.h and + deprecate av_get_bits_per_sample_format(). + +2010-11-02 - r25653 - lavcore 0.11.0 - samplefmt.h + Add sample format functions in libavcore/samplefmt.h: + av_get_sample_fmt_name(), + av_get_sample_fmt(), + av_get_sample_fmt_string(), + and deprecate the corresponding libavcodec/audioconvert.h functions: + avcodec_get_sample_fmt_name(), + avcodec_get_sample_fmt(), + avcodec_sample_fmt_string(). + +2010-11-02 - r25652 - lavcore 0.10.0 - samplefmt.h + Define enum AVSampleFormat in libavcore/samplefmt.h, deprecate enum + SampleFormat. + +2010-10-16 - r25502 - lavfi 1.52.0 - avfilter_graph_config() + Add the function avfilter_graph_config() in avfiltergraph.h. + +2010-10-15 - r25493 - lavf 52.83.0 - metadata API + Change demuxers to export metadata in generic format and + muxers to accept generic format. Deprecate the public + conversion API. + +2010-10-10 - r25441 - lavfi 1.49.0 - AVFilterLink.time_base + Add time_base field to AVFilterLink. + +2010-09-27 - r25236 - lavu 50.31.0 - av_set_options_string() + Move av_set_options_string() from libavfilter/parseutils.h to + libavutil/opt.h. + +2010-09-27 - r25227 - lavfi 1.47.0 - AVFilterLink + Make the AVFilterLink fields srcpad and dstpad store the pointers to + the source and destination pads, rather than their indexes. + +2010-09-27 - r25225 - lavu 50.30.0 - av_get_token() + Move av_get_token() from libavfilter/parseutils.h to + libavutil/avstring.h. + +2010-09-26 - r32368 - lsws 0.12.0 - swscale.h + Add the functions sws_alloc_context() and sws_init_context(). + +2010-09-26 - r25210 - lavu 50.29.0 - opt.h + Move libavcodec/opt.h to libavutil/opt.h. + +2010-09-24 - r25174 - lavu 50.28.0 - av_log_set_flags() + Default of av_log() changed due to many problems to the old no repeat + detection. Read the docs of AV_LOG_SKIP_REPEATED in log.h before + enabling it for your app!. + +2010-09-24 - r25167 - lavc 52.90.0 - av_opt_show2() + Deprecate av_opt_show() in favor or av_opt_show2(). + +2010-09-14 - r25120 - lavu 50.27.0 - av_popcount() + Add av_popcount() to libavutil/common.h. + +2010-09-08 - r25076 - lavu 50.26.0 - av_get_cpu_flags() + Add av_get_cpu_flags(). + +2010-09-07 - r25067 - lavcore 0.9.0 - av_image_copy() + Add av_image_copy(). + +2010-09-07 - r25064 - lavcore 0.8.0 - av_image_copy_plane() + Add av_image_copy_plane(). + +2010-09-07 - r25057 - lavcore 0.7.0 - imgutils.h + Adopt hierarchical scheme for the imgutils.h function names, + deprecate the old names. + +2010-09-04 - r25040 - lavu 50.25.0 - AV_CPU_FLAG_* + Deprecate the FF_MM_* flags defined in libavcodec/avcodec.h in favor + of the AV_CPU_FLAG_* flags defined in libavutil/cpu.h. + +2010-08-26 - r24936 - lavc 52.87.0 - avcodec_get_channel_layout() + Add avcodec_get_channel_layout() in audioconvert.h. + +2010-08-20 - r24851 - lavcore 0.6.0 - av_fill_image_max_pixsteps() + Rename av_fill_image_max_pixstep() to av_fill_image_max_pixsteps(). + +2010-08-18 - r24827 - lavcore 0.5.0 - av_fill_image_max_pixstep() + Add av_fill_image_max_pixstep() in imgutils.h. + +2010-08-17 - r24814 - lavu 50.24.0 - AV_NE() + Add the AV_NE macro. + +2010-08-17 - r24811 - lavfi 1.36.0 - audio framework + Implement AVFilterBufferRefAudioProps struct for audio properties, + get_audio_buffer(), filter_samples() functions and related changes. + +2010-08-12 - r24787 - lavcore 0.4.0 - av_get_image_linesize() + Add av_get_image_linesize() in imgutils.h. + +2010-08-11 - r24773 - lavfi 1.34.0 - AVFilterBufferRef + Resize data and linesize arrays in AVFilterBufferRef to 8. + + This change breaks libavfilter API/ABI. + +2010-08-11 - r24768 - lavc 52.85.0 - av_picture_data_copy() + Add av_picture_data_copy in avcodec.h. + +2010-08-11 - r24765 - lavfi 1.33.0 - avfilter_open() + Change avfilter_open() signature: + AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name) -> + int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name); + + This change breaks libavfilter API/ABI. + +2010-08-11 - r24763 - lavfi 1.32.0 - AVFilterBufferRef + Add a type field to AVFilterBufferRef, and move video specific + properties to AVFilterBufferRefVideoProps. + + This change breaks libavfilter API/ABI. + 2010-08-07 - r24732 - lavfi 1.31.0 - AVFilterLink Rename AVFilterLink fields: AVFilterLink.srcpic -> AVFilterLink.src_buf diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/build_system.txt chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/build_system.txt --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/build_system.txt 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/build_system.txt 2010-11-06 17:21:26.000000000 +0000 @@ -0,0 +1,34 @@ +FFmpeg currently uses a custom build system, this text attempts to document +some of its obscure features and options. + +Options to make: +make V=1 + Build target with verbosity 1, instead of 1, 2 can be used too + + +Useful standard make commands: +make -t + Touch all files that otherwise would be build, this is useful to reduce + unneeded rebuilding when changing headers, but note you must force rebuilds + of files that actually need it by hand then. + +make -j + rebuild with multiple jobs at the same time. Faster on multi processor systems + +make -k + continue build in case of errors, this is useful for the regression tests + sometimes but note it will still not run all reg tests. + + +Targets to make: +fate-list + Will list all fate/regression test targets + +fate + Run the fate test suite, note you must have installed it + + +Setting up local fate: +use the following command to get the fate test samples +rsync -aL rsync://rsync.mplayerhq.hu:/samples/fate-suite/ fate/fate-suite +pass --samples= to configure diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/developer.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/developer.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/developer.texi 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/developer.texi 2010-11-06 17:21:26.000000000 +0000 @@ -149,9 +149,9 @@ Also if you have doubts about splitting or not splitting, do not hesitate to ask/discuss it on the developer mailing list. @item - Do not change behavior of the program (renaming options etc) without - first discussing it on the ffmpeg-devel mailing list. Do not remove - functionality from the code. Just improve! + Do not change behavior of the programs (renaming options etc) or public + API or ABI without first discussing it on the ffmpeg-devel mailing list. + Do not remove functionality from the code. Just improve! Note: Redundant code can be removed. @item @@ -289,8 +289,8 @@ Did you add a long_name under NULL_IF_CONFIG_SMALL to the AVCodec or AVInputFormat/AVOutputFormat struct? @item - Did you bump the minor version number in @file{avcodec.h} or - @file{avformat.h}? + Did you bump the minor version number (and reset the micro version + number) in @file{avcodec.h} or @file{avformat.h}? @item Did you register it in @file{allcodecs.c} or @file{allformats.c}? @item diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/eval.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/eval.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/eval.texi 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/eval.texi 2010-11-06 17:21:26.000000000 +0000 @@ -0,0 +1,140 @@ +@chapter Expression Evaluation +@c man begin EXPRESSION EVALUATION + +When evaluating an arithemetic expression, FFmpeg uses an internal +formula evaluator, implemented through the @file{libavutil/eval.h} +interface. + +An expression may contain unary, binary operators, constants, and +functions. + +Two expressions @var{expr1} and @var{expr2} can be combined to form +another expression "@var{expr1};@var{expr2}". +@var{expr1} and @var{expr2} are evaluated in turn, and the new +expression evaluates to the value of @var{expr2}. + +The following binary operators are available: @code{+}, @code{-}, +@code{*}, @code{/}, @code{^}. + +The following unary operators are available: @code{+}, @code{-}. + +The following functions are available: +@table @option +@item sinh(x) +@item cosh(x) +@item tanh(x) +@item sin(x) +@item cos(x) +@item tan(x) +@item atan(x) +@item asin(x) +@item acos(x) +@item exp(x) +@item log(x) +@item abs(x) +@item squish(x) +@item gauss(x) +@item isnan(x) +Return 1.0 if @var{x} is NAN, 0.0 otherwise. + +@item mod(x, y) +@item max(x, y) +@item min(x, y) +@item eq(x, y) +@item gte(x, y) +@item gt(x, y) +@item lte(x, y) +@item lt(x, y) +@item st(var, expr) +Allow to store the value of the expression @var{expr} in an internal +variable. @var{var} specifies the number of the variable where to +store the value, and it is a value ranging from 0 to 9. The function +returns the value stored in the internal variable. + +@item ld(var) +Allow to load the value of the internal variable with number +@var{var}, which was previosly stored with st(@var{var}, @var{expr}). +The function returns the loaded value. + +@item while(cond, expr) +Evaluate expression @var{expr} while the expression @var{cond} is +non-zero, and returns the value of the last @var{expr} evaluation, or +NAN if @var{cond} was always false. +@end table + +Note that: + +@code{*} works like AND + +@code{+} works like OR + +thus +@example +if A then B else C +@end example +is equivalent to +@example +A*B + not(A)*C +@end example + +When A evaluates to either 1 or 0, that is the same as +@example +A*B + eq(A,0)*C +@end example + +In your C code, you can extend the list of unary and binary functions, +and define recognized constants, so that they are available for your +expressions. + +The evaluator also recognizes the International System number +postfixes. If 'i' is appended after the postfix, powers of 2 are used +instead of powers of 10. The 'B' postfix multiplies the value for 8, +and can be appended after another postfix or used alone. This allows +using for example 'KB', 'MiB', 'G' and 'B' as postfix. + +Follows the list of available International System postfixes, with +indication of the corresponding powers of 10 and of 2. +@table @option +@item y +-24 / -80 +@item z +-21 / -70 +@item a +-18 / -60 +@item f +-15 / -50 +@item p +-12 / -40 +@item n +-9 / -30 +@item u +-6 / -20 +@item m +-3 / -10 +@item c +-2 +@item d +-1 +@item h +2 +@item k +3 / 10 +@item K +3 / 10 +@item M +6 / 20 +@item G +9 / 30 +@item T +12 / 40 +@item P +15 / 40 +@item E +18 / 50 +@item Z +21 / 60 +@item Y +24 / 70 +@end table + +@c man end diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/faq.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/faq.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/faq.texi 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/faq.texi 2010-11-06 17:21:26.000000000 +0000 @@ -221,11 +221,11 @@ @item needed stuff -acodec libfaac -vcodec mpeg4 width<=320 height<=240 @item working stuff -4mv, title +mv4, title @item non-working stuff B-frames @item example command line -ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 320x180 -metadata title=X output.mp4 +ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +mv4 -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 320x180 -metadata title=X output.mp4 @end table @section How do I encode videos which play on the PSP? @@ -234,11 +234,11 @@ @item needed stuff -acodec libfaac -vcodec mpeg4 width*height<=76800 width%16=0 height%16=0 -ar 24000 -r 30000/1001 or 15000/1001 -f psp @item working stuff -4mv, title +mv4, title @item non-working stuff B-frames @item example command line -ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -ar 24000 -mbd 2 -flags +4mv -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 368x192 -r 30000/1001 -metadata title=X -f psp output.mp4 +ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -ar 24000 -mbd 2 -flags +mv4 -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 368x192 -r 30000/1001 -metadata title=X -f psp output.mp4 @item needed stuff for H.264 -acodec libfaac -vcodec libx264 width*height<=76800 width%16=0? height%16=0? -ar 48000 -coder 1 -r 30000/1001 or 15000/1001 -f psp @item working stuff for H.264 @@ -255,7 +255,7 @@ @section Which are good parameters for encoding high quality MPEG-4? -'-mbd rd -flags +4mv+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1/2', +'-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1/2', things to try: '-bf 2', '-flags qprd', '-flags mv0', '-flags skiprd'. @section Which are good parameters for encoding high quality MPEG-1/MPEG-2? diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/ffmpeg-doc.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/ffmpeg-doc.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/ffmpeg-doc.texi 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/ffmpeg-doc.texi 2010-11-06 17:21:26.000000000 +0000 @@ -226,14 +226,13 @@ @item -aspect @var{aspect} Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777). -@item -croptop @var{size} (deprecated - use -vf crop=x:y:width:height instead) -Set top crop band size (in pixels). -@item -cropbottom @var{size} (deprecated - use -vf crop=x:y:width:height instead) -Set bottom crop band size (in pixels). -@item -cropleft @var{size} (deprecated - use -vf crop=x:y:width:height instead) -Set left crop band size (in pixels). -@item -cropright @var{size} (deprecated - use -vf crop=x:y:width:height instead) -Set right crop band size (in pixels). +@item -croptop @var{size} +@item -cropbottom @var{size} +@item -cropleft @var{size} +@item -cropright @var{size} +All the crop options have been removed. Use -vf +crop=width:height:x:y instead. + @item -padtop @var{size} @item -padbottom @var{size} @item -padleft @var{size} @@ -355,8 +354,39 @@ @item -i_qoffset @var{offset} qp offset between P- and I-frames @item -rc_eq @var{equation} -Set rate control equation (@pxref{FFmpeg formula -evaluator}) (default = @code{tex^qComp}). +Set rate control equation (see section "Expression Evaluation") +(default = @code{tex^qComp}). + +When computing the rate control equation expression, besides the +standard functions defined in the section "Expression Evaluation", the +following functions are available: +@table @var +@item bits2qp(bits) +@item qp2bits(qp) +@end table + +and the following constants are available: +@table @var +@item iTex +@item pTex +@item tex +@item mv +@item fCode +@item iCount +@item mcVar +@item var +@item isI +@item isP +@item isB +@item avgQP +@item qComp +@item avgIITex +@item avgPITex +@item avgPPTex +@item avgBPTex +@item avgTex +@end table + @item -rc_override @var{override} rate control override for specific intervals @item -me_method @var{method} @@ -496,6 +526,12 @@ @example ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264 @end example +@item -force_key_frames @var{time}[,@var{time}...] +Force key frames at the specified timestamps, more precisely at the first +frames after each specified time. +This option can be useful to ensure that a seek point is present at a +chapter mark or any other designated place in the output file. +The timestamps must be specified in ascending order. @end table @section Audio Options @@ -510,7 +546,10 @@ @item -aq @var{q} Set the audio quality (codec-specific, VBR). @item -ac @var{channels} -Set the number of audio channels (default = 1). +Set the number of audio channels. For input streams it is set by +default to 1, for output streams it is set by default to the same +number of audio channels in input. If the input file has audio streams +with different channel count, the behaviour is undefined. @item -an Disable audio recording. @item -acodec @var{codec} @@ -578,8 +617,19 @@ Just enumerate the input streams in the order you want them in the output. @var{sync_stream_id} if specified sets the input stream to sync against. -@item -map_meta_data @var{outfile}:@var{infile} -Set meta data information of @var{outfile} from @var{infile}. +@item -map_meta_data @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}] +Set meta data information of @var{outfile} from @var{infile}. Note that those +are file indices (zero-based), not filenames. +Optional @var{metadata} parameters specify, which metadata to copy - (g)lobal +(i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or +per-(p)rogram. All metadata specifiers other than global must be followed by the +stream/chapter/program number. If metadata specifier is omitted, it defaults to +global. +For example to copy metadata from the first stream of the input file to global metadata +of the output file: +@example +ffmpeg -i in.ogg -map_meta_data 0:0,s0 out.mp3 +@end example @item -debug Print specific debug info. @item -benchmark @@ -675,74 +725,6 @@ the preset file options will be applied. For example, if you select the video codec with @code{-vcodec libx264} and use @code{-vpre max}, then it will search for the file @file{libx264-max.ffpreset}. - -@anchor{FFmpeg formula evaluator} -@section FFmpeg formula evaluator - -When evaluating a rate control string, FFmpeg uses an internal formula -evaluator. - -The following binary operators are available: @code{+}, @code{-}, -@code{*}, @code{/}, @code{^}. - -The following unary operators are available: @code{+}, @code{-}, -@code{(...)}. - -The following statements are available: @code{ld}, @code{st}, -@code{while}. - -The following functions are available: -@table @var -@item sinh(x) -@item cosh(x) -@item tanh(x) -@item sin(x) -@item cos(x) -@item tan(x) -@item atan(x) -@item asin(x) -@item acos(x) -@item exp(x) -@item log(x) -@item abs(x) -@item squish(x) -@item gauss(x) -@item mod(x, y) -@item max(x, y) -@item min(x, y) -@item eq(x, y) -@item gte(x, y) -@item gt(x, y) -@item lte(x, y) -@item lt(x, y) -@item bits2qp(bits) -@item qp2bits(qp) -@end table - -The following constants are available: -@table @var -@item PI -@item E -@item iTex -@item pTex -@item tex -@item mv -@item fCode -@item iCount -@item mcVar -@item var -@item isI -@item isP -@item isB -@item avgQP -@item qComp -@item avgIITex -@item avgPITex -@item avgPPTex -@item avgBPTex -@item avgTex -@end table - @c man end @chapter Tips @@ -814,14 +796,14 @@ FFmpeg can grab the X11 display. @example -ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpg +ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg @end example 0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable. @example -ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg +ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg @end example 0.0 is display.screen number of your X11 server, same as the DISPLAY environment @@ -951,6 +933,7 @@ file to which you want to add them. @c man end EXAMPLES +@include eval.texi @include indevs.texi @include outdevs.texi @include protocols.texi diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/ffplay-doc.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/ffplay-doc.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/ffplay-doc.texi 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/ffplay-doc.texi 2010-11-06 17:21:26.000000000 +0000 @@ -153,6 +153,7 @@ @c man end +@include eval.texi @include indevs.texi @include outdevs.texi @include protocols.texi diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/ffprobe-doc.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/ffprobe-doc.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/ffprobe-doc.texi 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/ffprobe-doc.texi 2010-11-06 17:21:26.000000000 +0000 @@ -50,8 +50,8 @@ @end example Metadata tags stored in the container or in the streams are recognized -and printed in the corresponding ``FORMAT'' or ``STREAM'' section, and -are prefixed by the string ``TAG:''. +and printed in the corresponding "FORMAT" or "STREAM" section, and +are prefixed by the string "TAG:". @c man end @@ -64,9 +64,6 @@ @table @option -@item -convert_tags -Convert the tag names in the format container to the generic FFmpeg tag names. - @item -f @var{format} Force format to use. @@ -74,8 +71,8 @@ Show the unit of the displayed values. @item -prefix -Show a SI prefixes of the displayed values. -Unless ``-byte_binary_prefix'' option is used all the prefix +Use SI prefixes for the displayed values. +Unless the "-byte_binary_prefix" option is used all the prefixes are decimal. @item -byte_binary_prefix @@ -86,28 +83,28 @@ @item -pretty Prettify the format of the displayed values, it corresponds to the -options ``-unit -prefix -byte_binary_prefix -sexagesimal''. +options "-unit -prefix -byte_binary_prefix -sexagesimal". @item -show_format Show information about the container format of the input multimedia stream. All the container format information is printed within a section with -name ``FORMAT''. +name "FORMAT". @item -show_packets Show information about each packet contained in the input multimedia stream. The information for each single packet is printed within a dedicated -section with name ``PACKET''. +section with name "PACKET". @item -show_streams Show information about each media stream contained in the input multimedia stream. Each media stream information is printed within a dedicated section -with name ``STREAM''. +with name "STREAM". @end table @c man end diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/filters.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/filters.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/filters.texi 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/filters.texi 2010-11-06 17:21:26.000000000 +0000 @@ -1,3 +1,66 @@ +@chapter Audio Filters +@c man begin AUDIO FILTERS + +When you configure your FFmpeg build, you can disable any of the +existing filters using --disable-filters. +The configure output will show the audio filters included in your +build. + +Below is a description of the currently available audio filters. + +@section anull + +Pass the audio source unchanged to the output. + +@c man end AUDIO FILTERS + +@chapter Audio Sources +@c man begin AUDIO SOURCES + +Below is a description of the currently available audio sources. + +@section anullsrc + +Null audio source, never return audio frames. It is mainly useful as a +template and to be employed in analysis / debugging tools. + +It accepts as optional parameter a string of the form +@var{sample_rate}:@var{channel_layout}. + +@var{sample_rate} specify the sample rate, and defaults to 44100. + +@var{channel_layout} specify the channel layout, and can be either an +integer or a string representing a channel layout. The default value +of @var{channel_layout} is 3, which corresponds to CH_LAYOUT_STEREO. + +Check the channel_layout_map definition in +@file{libavcodec/audioconvert.c} for the mapping between strings and +channel layout values. + +Follow some examples: +@example +# set the sample rate to 48000 Hz and the channel layout to CH_LAYOUT_MONO. +anullsrc=48000:4 + +# same as +anullsrc=48000:mono +@end example + +@c man end AUDIO SOURCES + +@chapter Audio Sinks +@c man begin AUDIO SINKS + +Below is a description of the currently available audio sinks. + +@section anullsink + +Null audio sink, do absolutely nothing with the input audio. It is +mainly useful as a template and to be employed in analysis / debugging +tools. + +@c man end AUDIO SINKS + @chapter Video Filters @c man begin VIDEO FILTERS @@ -8,36 +71,200 @@ Below is a description of the currently available video filters. +@section blackframe + +Detect frames that are (almost) completely black. Can be useful to +detect chapter transitions or commercials. Output lines consist of +the frame number of the detected frame, the percentage of blackness, +the position in the file if known or -1 and the timestamp in seconds. + +In order to display the output lines, you need to set the loglevel at +least to the AV_LOG_INFO value. + +The filter accepts the syntax: +@example +blackframe[=@var{amount}:[@var{threshold}]] +@end example + +@var{amount} is the percentage of the pixels that have to be below the +threshold, and defaults to 98. + +@var{threshold} is the threshold below which a pixel value is +considered black, and defaults to 32. + @section crop -Crop the input video to @var{x}:@var{y}:@var{width}:@var{height}. +Crop the input video to @var{out_w}:@var{out_h}:@var{x}:@var{y}. + +The parameters are expressions containing the following constants: + +@table @option +@item E, PI, PHI +the corresponding mathematical approximated values for e +(euler number), pi (greek PI), PHI (golden ratio) + +@item x, y +the computed values for @var{x} and @var{y}. They are evaluated for +each new frame. + +@item in_w, in_h +the input width and heigth + +@item iw, ih +same as @var{in_w} and @var{in_h} + +@item out_w, out_h +the output (cropped) width and heigth + +@item ow, oh +same as @var{out_w} and @var{out_h} + +@item n +the number of input frame, starting from 0 +@item pos +the position in the file of the input frame, NAN if unknown + +@item t +timestamp expressed in seconds, NAN if the input timestamp is unknown + +@end table + +The @var{out_w} and @var{out_h} parameters specify the expressions for +the width and height of the output (cropped) video. They are +evaluated just at the configuration of the filter. + +The default value of @var{out_w} is "in_w", and the default value of +@var{out_h} is "in_h". + +The expression for @var{out_w} may depend on the value of @var{out_h}, +and the expression for @var{out_h} may depend on @var{out_w}, but they +cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are +evaluated after @var{out_w} and @var{out_h}. + +The @var{x} and @var{y} parameters specify the expressions for the +position of the top-left corner of the output (non-cropped) area. They +are evaluated for each frame. If the evaluated value is not valid, it +is approximated to the nearest valid value. + +The default value of @var{x} is "(in_w-out_w)/2", and the default +value for @var{y} is "(in_h-out_h)/2", which set the cropped area at +the center of the input image. + +The expression for @var{x} may depend on @var{y}, and the expression +for @var{y} may depend on @var{x}. + +Follow some examples: @example -./ffmpeg -i in.avi -vf "crop=0:0:0:240" out.avi +# crop the central input area with size 100x100 +crop=100:100 + +# crop the central input area with size 2/3 of the input video +"crop=2/3*in_w:2/3*in_h" + +# crop the input video central square +crop=in_h + +# delimit the rectangle with the top-left corner placed at position +# 100:100 and the right-bottom corner corresponding to the right-bottom +# corner of the input image. +crop=in_w-100:in_h-100:100:100 + +# crop 10 pixels from the lefth and right borders, and 20 pixels from +# the top and bottom borders +"crop=in_w-2*10:in_h-2*20" + +# keep only the bottom right quarter of the input image +"crop=in_w/2:in_h/2:in_w/2:in_h/2" + +# crop height for getting Greek harmony +"crop=in_w:1/PHI*in_w" + +# trembling effect +"crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)" + +# erratic camera effect depending on timestamp and position +"crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)" + +# set x depending on the value of y +"crop=in_w/2:in_h/2:y:10+10*sin(n/10)" @end example -@var{x} and @var{y} specify the position of the top-left corner of the -output (non-cropped) area. +@section cropdetect -The default value of @var{x} and @var{y} is 0. +Auto-detect crop size. + +Calculate necessary cropping parameters and prints the recommended +parameters through the logging system. The detected dimensions +correspond to the non-black area of the input video. -The @var{width} and @var{height} parameters specify the width and height -of the output (non-cropped) area. +It accepts the syntax: +@example +cropdetect[=@var{limit}[:@var{round}[:@var{reset}]]] +@end example -A value of 0 is interpreted as the maximum possible size contained in -the area delimited by the top-left corner at position x:y. +@table @option -For example the parameters: +@item limit +Threshold, which can be optionally specified from nothing (0) to +everything (255), defaults to 24. + +@item round +Value which the width/height should be divisible by, defaults to +16. The offset is automatically adjusted to center the video. Use 2 to +get only even dimensions (needed for 4:2:2 video). 16 is best when +encoding to most video codecs. + +@item reset +Counter that determines after how many frames cropdetect will reset +the previously detected largest video area and start over to detect +the current optimal crop area. Defaults to 0. + +This can be useful when channel logos distort the video area. 0 +indicates never reset and return the largest area encountered during +playback. +@end table +@section drawbox + +Draw a colored box on the input image. + +It accepts the syntax: @example -"crop=100:100:0:0" +drawbox=@var{x}:@var{y}:@var{width}:@var{height}:@var{color} @end example -will delimit the rectangle with the top-left corner placed at position -100:100 and the right-bottom corner corresponding to the right-bottom -corner of the input image. +@table @option + +@item x, y +Specify the top left corner coordinates of the box. Default to 0. -The default value of @var{width} and @var{height} is 0. +@item width, height +Specify the width and height of the box, if 0 they are interpreted as +the input width and height. Default to 0. + +@item color +Specify the color of the box to write, it can be the name of a color +(case insensitive match) or a 0xRRGGBB[AA] sequence. +@end table + +Follow some examples: +@example +# draw a black box around the edge of the input image +drawbox + +# draw a box with color red and an opacity of 50% +drawbox=10:20:200:60:red@@0.5" +@end example + +@section fifo + +Buffer input images and send them when they are requested. + +This filter is mainly useful when auto-inserted by the libavfilter +framework. + +The filter does not take parameters. @section format @@ -45,8 +272,8 @@ Libavfilter will try to pick one that is supported for the input to the next filter. -The filter accepts a list of pixel format names, separated by ``:'', -for example ``yuv420p:monow:rgb24''. +The filter accepts a list of pixel format names, separated by ":", +for example "yuv420p:monow:rgb24". The following command: @@ -54,15 +281,75 @@ ./ffmpeg -i in.avi -vf "format=yuv420p" out.avi @end example -will convert the input video to the format ``yuv420p''. +will convert the input video to the format "yuv420p". + +@section frei0r + +Apply a frei0r effect to the input video. + +To enable compilation of this filter you need to install the frei0r +header and configure FFmpeg with --enable-frei0r. + +The filter supports the syntax: +@example +@var{filter_name}:@var{param1}:@var{param2}:...:@var{paramN} +@end example + +@var{filter_name} is the name to the frei0r effect to load. If the +environment variable @env{FREI0R_PATH} is defined, the frei0r effect +is searched in each one of the directories specified by the colon +separated list in @env{FREIOR_PATH}, otherwise in the standard frei0r +paths, which are in this order: @file{HOME/.frei0r-1/lib/}, +@file{/usr/local/lib/frei0r-1/}, @file{/usr/lib/frei0r-1/}. + +@var{param1}, @var{param2}, ... , @var{paramN} specify the parameters +for the frei0r effect. + +A frei0r effect parameter can be a boolean (whose values are specified +with "y" and "n"), a double, a color (specified by the syntax +@var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float +numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color +description), a position (specified by the syntax @var{X}/@var{Y}, +@var{X} and @var{Y} being float numbers) and a string. + +The number and kind of parameters depend on the loaded effect. If an +effect parameter is not specified the default value is set. + +Some examples follow: +@example +# apply the distort0r effect, set the first two double parameters +frei0r=distort0r:0.5:0.01 + +# apply the colordistance effect, takes a color as first parameter +frei0r=colordistance:0.2/0.3/0.4 +frei0r=colordistance:violet +frei0r=colordistance:0x112233 + +# apply the perspective effect, specify the top left and top right +# image positions +frei0r=perspective:0.2/0.2:0.8/0.2 +@end example + +For more information see: +@url{http://piksel.org/frei0r} + +@section hflip + +Flip the input video horizontally. + +For example to horizontally flip the video in input with +@file{ffmpeg}: +@example +ffmpeg -i in.avi -vf "hflip" out.avi +@end example @section noformat Force libavfilter not to use any of the specified pixel formats for the input to the next filter. -The filter accepts a list of pixel format names, separated by ``:'', -for example ``yuv420p:monow:rgb24''. +The filter accepts a list of pixel format names, separated by ":", +for example "yuv420p:monow:rgb24". The following command: @@ -70,12 +357,39 @@ ./ffmpeg -i in.avi -vf "noformat=yuv420p, vflip" out.avi @end example -will make libavfilter use a format different from ``yuv420p'' for the +will make libavfilter use a format different from "yuv420p" for the input to the vflip filter. @section null -Pass the source unchanged to the output. +Pass the video source unchanged to the output. + +@section ocv_smooth + +Apply smooth transform using libopencv. + +To enable this filter install libopencv library and headers and +configure FFmpeg with --enable-libopencv. + +The filter accepts the following parameters: +@var{type}:@var{param1}:@var{param2}:@var{param3}:@var{param4}. + +@var{type} is the type of smooth filter to apply, and can be one of +the following values: "blur", "blur_no_scale", "median", "gaussian", +"bilateral". The default value is "gaussian". + +@var{param1}, @var{param2}, @var{param3}, and @var{param4} are +parameters whose meanings depend on smooth type. @var{param1} and +@var{param2} accept integer positive values or 0, @var{param3} and +@var{param4} accept float values. + +The default value for @var{param1} is 3, the default value for the +other parameters is 0. + +These parameters correspond to the parameters assigned to the +libopencv function @code{cvSmooth}. Refer to the official libopencv +documentation for the exact meaning of the parameters: +@url{http://opencv.willowgarage.com/documentation/c/image_filtering.html} @section pad @@ -108,10 +422,19 @@ Specify the color of the padded area, it can be the name of a color (case insensitive match) or a 0xRRGGBB[AA] sequence. -The default value of @var{color} is ``black''. +The default value of @var{color} is "black". @end table +For example: + +@example +# Add paddings with color "violet" to the input video. Output video +# size is 640x480, the top-left corner of the input video is placed at +# row 0, column 40. +pad=640:480:0:40:violet +@end example + @section pixdesctest Pixel format descriptor test filter, mainly useful for internal @@ -149,6 +472,96 @@ The default value of @var{width} and @var{height} is 0. +@section setpts + +Change the PTS (presentation timestamp) of the input video frames. + +Accept in input an expression evaluated through the eval API, which +can contain the following constants: + +@table @option +@item PTS +the presentation timestamp in input + +@item PI +Greek PI + +@item PHI +golden ratio + +@item E +Euler number + +@item N +the count of the input frame, starting from 0. + +@item STARTPTS +the PTS of the first video frame + +@item INTERLACED +tell if the current frame is interlaced + +@item POS +original position in the file of the frame, or undefined if undefined +for the current frame + +@item PREV_INPTS +previous input PTS + +@item PREV_OUTPTS +previous output PTS + +@end table + +Some examples follow: + +@example +# start counting PTS from zero +setpts=PTS-STARTPTS + +# fast motion +setpts=0.5*PTS + +# slow motion +setpts=2.0*PTS + +# fixed rate 25 fps +setpts=N/(25*TB) + +# fixed rate 25 fps with some jitter +setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))' +@end example + +@section settb + +Set the timebase to use for the output frames timestamps. +It is mainly useful for testing timebase configuration. + +It accepts in input an arithmetic expression representing a rational. +The expression can contain the constants "PI", "E", "PHI", "AVTB" (the +default timebase), and "intb" (the input timebase). + +The default value for the input is "intb". + +Follow some examples. + +@example +# set the timebase to 1/25 +settb=1/25 + +# set the timebase to 1/10 +settb=0.1 + +#set the timebase to 1001/1000 +settb=1+0.001 + +#set the timebase to 2*intb +settb=2*intb + +#set the default timebase value +settb=AVTB +@end example + @section slicify Pass the images of input video on to next video filter as multiple @@ -164,6 +577,47 @@ Adding this in the beginning of filter chains should make filtering faster due to better use of the memory cache. +@section transpose + +Transpose rows with columns in the input video and optionally flip it. + +It accepts a parameter representing an integer, which can assume the +values: + +@table @samp +@item 0 +Rotate by 90 degrees counterclockwise and vertically flip (default), that is: +@example +L.R L.l +. . -> . . +l.r R.r +@end example + +@item 1 +Rotate by 90 degrees clockwise, that is: +@example +L.R l.L +. . -> . . +l.r r.R +@end example + +@item 2 +Rotate by 90 degrees counterclockwise, that is: +@example +L.R R.r +. . -> . . +l.r L.l +@end example + +@item 3 +Rotate by 90 degrees clockwise and vertically flip, that is: +@example +L.R r.R +. . -> . . +l.r l.L +@end example +@end table + @section unsharp Sharpen or blur the input video. @@ -222,6 +676,36 @@ ./ffmpeg -i in.avi -vf "vflip" out.avi @end example +@section yadif + +yadif is "yet another deinterlacing filter". + +It accepts the syntax: +@example +yadif=[@var{mode}[:@var{parity}]] +@end example + +@table @option + +@item mode +Specify the interlacing mode to adopt, accepts one of the following values. + +0: Output 1 frame for each frame. + +1: Output 1 frame for each field. + +2: Like 0 but skips spatial interlacing check. + +3: Like 1 but skips spatial interlacing check. + +Default value is 0. + +@item parity +0 if is bottom field first, 1 if the interlaced video is top field +first, -1 to enable automatic detection. + +@end table + @c man end VIDEO FILTERS @chapter Video Sources @@ -237,7 +721,7 @@ through the interface defined in @file{libavfilter/vsrc_buffer.h}. It accepts the following parameters: -@var{width}:@var{height}:@var{pix_fmt_string} +@var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den} All the parameters need to be explicitely defined. @@ -249,24 +733,27 @@ Specify the width and height of the buffered video frames. @item pix_fmt_string - A string representing the pixel format of the buffered video frames. It may be a number corresponding to a pixel format, or a pixel format name. +@item timebase_num, timebase_den +Specify numerator and denomitor of the timebase assumed by the +timestamps of the buffered frames. @end table For example: @example -buffer=320:240:yuv410p +buffer=320:240:yuv410p:1:24 @end example will instruct the source to accept video frames with size 320x240 and -with format "yuv410p". Since the pixel format with name "yuv410p" -corresponds to the number 6 (check the enum PixelFormat definition in -@file{libavutil/pixfmt.h}), this example corresponds to: +with format "yuv410p" and assuming 1/24 as the timestamps timebase. +Since the pixel format with name "yuv410p" corresponds to the number 6 +(check the enum PixelFormat definition in @file{libavutil/pixfmt.h}), +this example corresponds to: @example -buffer=320:240:6 +buffer=320:240:6:1:24 @end example @section color @@ -314,11 +801,15 @@ template and to be employed in analysis / debugging tools. It accepts as optional parameter a string of the form -@var{width}:@var{height}, where @var{width} and @var{height} specify the size of -the configured source. +@var{width}:@var{height}:@var{timebase}. -The default values of @var{width} and @var{height} are respectively 352 -and 288 (corresponding to the CIF size format). +@var{width} and @var{height} specify the size of the configured +source. The default values of @var{width} and @var{height} are +respectively 352 and 288 (corresponding to the CIF size format). + +@var{timebase} specifies an arithmetic expression representing a +timebase. The expression can contain the constants "PI", "E", "PHI", +"AVTB" (the default timebase), and defaults to the value "AVTB". @c man end VIDEO SOURCES diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/general.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/general.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/general.texi 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/general.texi 2010-11-06 17:21:26.000000000 +0000 @@ -49,6 +49,7 @@ @item American Laser Games MM @tab @tab X @tab Multimedia format used in games like Mad Dog McCree. @item 3GPP AMR @tab X @tab X +@item Apple HTTP Live Streaming @tab @tab X @item ASF @tab X @tab X @item AVI @tab X @tab X @item AVISynth @tab @tab X @@ -113,6 +114,8 @@ @tab A format used by libvpx @item LMLM4 @tab @tab X @tab Used by Linux Media Labs MPEG-4 PCI boards +@item LXF @tab @tab X + @tab VR native stream format, used by Leitch/Harris' video servers. @item Matroska @tab X @tab X @item Matroska audio @tab X @tab @item MAXIS XA @tab @tab X @@ -212,8 +215,9 @@ @item Lego Mindstorms RSO @tab X @tab X @item RTMP @tab X @tab X @tab Output is performed by publishing stream to RTMP server -@item RTP @tab X @tab +@item RTP @tab X @tab X @item RTSP @tab X @tab X +@item SAP @tab X @tab X @item SDP @tab @tab X @item Sega FILM/CPK @tab @tab X @tab Used in many Sega Saturn console games. @@ -314,6 +318,8 @@ @item 8088flex TMV @tab @tab X @item 8SVX exponential @tab @tab X @item 8SVX fibonacci @tab @tab X +@item A64 multicolor @tab X @tab + @tab Creates video suitable to be played on a commodore 64 (multicolor mode). @item American Laser Games MM @tab @tab X @tab Used in games like Mad Dog McCree. @item AMV Video @tab @tab X @@ -457,6 +463,7 @@ @tab fourcc: 'smc ' @item QuickTime video (RPZA) @tab @tab X @tab fourcc: rpza +@item R10K AJA Kona 10-bit RGB Codec @tab @tab X @item R210 Quicktime Uncompressed RGB 10-bit @tab @tab X @item Raw Video @tab X @tab X @item RealVideo 1.0 @tab X @tab X @@ -532,6 +539,7 @@ @item ADPCM Electronic Arts R2 @tab @tab X @item ADPCM Electronic Arts R3 @tab @tab X @item ADPCM Electronic Arts XAS @tab @tab X +@item ADPCM G.722 @tab X @tab X @item ADPCM G.726 @tab X @tab X @item ADPCM IMA AMV @tab @tab X @tab Used in AMV files @@ -971,15 +979,27 @@ the static libraries, as described above. But in Step 4, you should only need to add the directory where the LIB files are installed (i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files are -installed in the @file{bin} directory. And instead of adding @file{libxx.a} -files, you should add @file{avcodec.lib}, @file{avformat.lib}, and -@file{avutil.lib}. There should be no need for @file{libmingwex.a}, +installed in the @file{bin} directory. And instead of adding the static +libraries (@file{libxxx.a} files) you should add the MSVC import libraries +(@file{avcodec.lib}, @file{avformat.lib}, @file{avcore.lib}, and +@file{avutil.lib}). Note that you should not use the GCC import +libraries (@file{libxxx.dll.a} files), as these will give you undefined +reference errors. There should be no need for @file{libmingwex.a}, @file{libgcc.a}, and @file{wsock32.lib}, nor any other external library statically linked into the DLLs. The @file{bin} directory contains a bunch of DLL files, but the ones that are actually used to run your application are the ones with a major version number in their filenames (i.e. @file{avcodec-51.dll}). +FFmpeg headers do not declare global data for Windows DLLs through the usual +dllexport/dllimport interface. Such data will be exported properly while +building, but to use them in your MSVC++ code you will have to edit the +appropriate headers and mark the data as dllimport. For example, in +libavutil/pixdesc.h you should have: +@example +extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[]; +@end example + @subsection Cross compilation for Windows with Linux You must use the MinGW cross compilation tools available at diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/indevs.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/indevs.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/indevs.texi 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/indevs.texi 2010-11-06 17:21:26.000000000 +0000 @@ -167,6 +167,10 @@ VfW (Video for Windows) capture input device. +The filename passed as input is the capture driver number, ranging from +0 to 9. You may use "list" as filename to print a list of drivers. Any +other filename will be interpreted as device number 0. + @section x11grab X11 video input device. diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/optimization.txt chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/optimization.txt --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/optimization.txt 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/optimization.txt 2010-11-06 17:21:26.000000000 +0000 @@ -157,15 +157,68 @@ __asm__( "1: .... ... - "jump_instruciton .... + "jump_instruction .... Do not use C loops: do{ __asm__( ... }while() -Use __asm__() instead of intrinsics. The latter requires a good optimizing compiler -which gcc is not. +For x86, mark registers that are clobbered in your asm. This means both +general x86 registers (e.g. eax) as well as XMM registers. This last one is +particularly important on Win64, where xmm6-15 are callee-save, and not +restoring their contents leads to undefined results. In external asm (e.g. +yasm), you do this by using: +cglobal functon_name, num_args, num_regs, num_xmm_regs +In inline asm, you specify clobbered registers at the end of your asm: +__asm__(".." ::: "%eax"). +If gcc is not set to support sse (-msse) it will not accept xmm registers +in the clobber list. For that we use two macros to declare the clobbers. +XMM_CLOBBERS should be used when there are other clobbers, for example: +__asm__(".." ::: XMM_CLOBBERS("xmm0",) "eax"); +and XMM_CLOBBERS_ONLY should be used when the only clobbers are xmm registers: +__asm__(".." :: XMM_CLOBBERS_ONLY("xmm0")); + +Do not expect a compiler to maintain values in your registers between separate +(inline) asm code blocks. It is not required to. For example, this is bad: +__asm__("movdqa %0, %%xmm7" : src); +/* do something */ +__asm__("movdqa %%xmm7, %1" : dst); +- first of all, you're assuming that the compiler will not use xmm7 in + between the two asm blocks. It probably won't when you test it, but it's + a poor assumption that will break at some point for some --cpu compiler flag +- secondly, you didn't mark xmm7 as clobbered. If you did, the compiler would + have restored the original value of xmm7 after the first asm block, thus + rendering the combination of the two blocks of code invalid +Code that depends on data in registries being untouched, should be written as +a single __asm__() statement. Ideally, a single function contains only one +__asm__() block. + +Use external asm (nasm/yasm) or inline asm (__asm__()), do not use intrinsics. +The latter requires a good optimizing compiler which gcc is not. + +Inline asm vs. external asm +--------------------------- +Both inline asm (__asm__("..") in a .c file, handled by a compiler such as gcc) +and external asm (.s or .asm files, handled by an assembler such as yasm/nasm) +are accepted in FFmpeg. Which one to use differs per specific case. + +- if your code is intended to be inlined in a C function, inline asm is always + better, because external asm cannot be inlined +- if your code calls external functions, yasm is always better +- if your code takes huge and complex structs as function arguments (e.g. + MpegEncContext; note that this is not ideal and is discouraged if there + are alternatives), then inline asm is always better, because predicting + member offsets in complex structs is almost impossible. It's safest to let + the compiler take care of that +- in many cases, both can be used and it just depends on the preference of the + person writing the asm. For new asm, the choice is up to you. For existing + asm, you'll likely want to maintain whatever form it is currently in unless + there is a good reason to change it. +- if, for some reason, you believe that a particular chunk of existing external + asm could be improved upon further if written in inline asm (or the other + way around), then please make the move from external asm <-> inline asm a + separate patch before your patches that actually improve the asm. Links: diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/protocols.texi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/protocols.texi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/doc/protocols.texi 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/doc/protocols.texi 2010-11-06 17:21:26.000000000 +0000 @@ -73,6 +73,15 @@ MMS (Microsoft Media Server) protocol over TCP. +@section mmsh + +MMS (Microsoft Media Server) protocol over HTTP. + +The required syntax is: +@example +mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] +@end example + @section md5 MD5 output protocol. @@ -208,6 +217,168 @@ Real-Time Protocol. +@section rtsp + +RTSP is not technically a protocol handler in libavformat, it is a demuxer +and muxer. The demuxer supports both normal RTSP (with data transferred +over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with +data transferred over RDT). + +The muxer can be used to send a stream using RTSP ANNOUNCE to a server +supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's +RTSP server, @url{http://github.com/revmischa/rtsp-server}). + +The required syntax for a RTSP url is: +@example +rtsp://@var{hostname}[:@var{port}]/@var{path}[?@var{options}] +@end example + +@var{options} is a @code{&}-separated list. The following options +are supported: + +@table @option + +@item udp +Use UDP as lower transport protocol. + +@item tcp +Use TCP (interleaving within the RTSP control channel) as lower +transport protocol. + +@item multicast +Use UDP multicast as lower transport protocol. + +@item http +Use HTTP tunneling as lower transport protocol, which is useful for +passing proxies. +@end table + +Multiple lower transport protocols may be specified, in that case they are +tried one at a time (if the setup of one fails, the next one is tried). +For the muxer, only the @code{tcp} and @code{udp} options are supported. + +When receiving data over UDP, the demuxer tries to reorder received packets +(since they may arrive out of order, or packets may get lost totally). In +order for this to be enabled, a maximum delay must be specified in the +@code{max_delay} field of AVFormatContext. + +When watching multi-bitrate Real-RTSP streams with @file{ffplay}, the +streams to display can be chosen with @code{-vst} @var{n} and +@code{-ast} @var{n} for video and audio respectively, and can be switched +on the fly by pressing @code{v} and @code{a}. + +Example command lines: + +To watch a stream over UDP, with a max reordering delay of 0.5 seconds: + +@example +ffplay -max_delay 500000 rtsp://server/video.mp4?udp +@end example + +To watch a stream tunneled over HTTP: + +@example +ffplay rtsp://server/video.mp4?http +@end example + +To send a stream in realtime to a RTSP server, for others to watch: + +@example +ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp +@end example + +@section sap + +Session Announcement Protocol (RFC 2974). This is not technically a +protocol handler in libavformat, it is a muxer and demuxer. +It is used for signalling of RTP streams, by announcing the SDP for the +streams regularly on a separate port. + +@subsection Muxer + +The syntax for a SAP url given to the muxer is: +@example +sap://@var{destination}[:@var{port}][?@var{options}] +@end example + +The RTP packets are sent to @var{destination} on port @var{port}, +or to port 5004 if no port is specified. +@var{options} is a @code{&}-separated list. The following options +are supported: + +@table @option + +@item announce_addr=@var{address} +Specify the destination IP address for sending the announcements to. +If omitted, the announcements are sent to the commonly used SAP +announcement multicast address 224.2.127.254 (sap.mcast.net), or +ff0e::2:7ffe if @var{destination} is an IPv6 address. + +@item announce_port=@var{port} +Specify the port to send the announcements on, defaults to +9875 if not specified. + +@item ttl=@var{ttl} +Specify the time to live value for the announcements and RTP packets, +defaults to 255. + +@item same_port=@var{0|1} +If set to 1, send all RTP streams on the same port pair. If zero (the +default), all streams are sent on unique ports, with each stream on a +port 2 numbers higher than the previous. +VLC/Live555 requires this to be set to 1, to be able to receive the stream. +The RTP stack in libavformat for receiving requires all streams to be sent +on unique ports. +@end table + +Example command lines follow. + +To broadcast a stream on the local subnet, for watching in VLC: + +@example +ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1 +@end example + +Similarly, for watching in ffplay: + +@example +ffmpeg -re -i @var{input} -f sap sap://224.0.0.255 +@end example + +And for watching in ffplay, over IPv6: + +@example +ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4] +@end example + +@subsection Demuxer + +The syntax for a SAP url given to the demuxer is: +@example +sap://[@var{address}][:@var{port}] +@end example + +@var{address} is the multicast address to listen for announcements on, +if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port} +is the port that is listened on, 9875 if omitted. + +The demuxers listens for announcements on the given address and port. +Once an announcement is received, it tries to receive that particular stream. + +Example command lines follow. + +To play back the first stream announced on the normal SAP multicast address: + +@example +ffplay sap:// +@end example + +To play back the first stream announced on one the default IPv6 SAP multicast address: + +@example +ffplay sap://[ff0e::2:7ffe] +@end example + @section tcp Trasmission Control Protocol. @@ -216,4 +387,54 @@ User Datagram Protocol. +The required syntax for a UDP url is: +@example +udp://@var{hostname}:@var{port}[?@var{options}] +@end example + +@var{options} contains a list of &-seperated options of the form @var{key}=@var{val}. +Follow the list of supported options. + +@table @option + +@item buffer_size=@var{size} +set the UDP buffer size in bytes + +@item localport=@var{port} +override the local UDP port to bind with + +@item pkt_size=@var{size} +set the size in bytes of UDP packets + +@item reuse=@var{1|0} +explicitly allow or disallow reusing UDP sockets + +@item ttl=@var{ttl} +set the time to live value (for multicast only) + +@item connect=@var{1|0} +Initialize the UDP socket with @code{connect()}. In this case, the +destination address can't be changed with udp_set_remote_url later. +This allows finding out the source address for the packets with getsockname, +and makes writes return with AVERROR(ECONNREFUSED) if "destination +unreachable" is received. +@end table + +Some usage examples of the udp protocol with @file{ffmpeg} follow. + +To stream over UDP to a remote endpoint: +@example +ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port} +@end example + +To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer: +@example +ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535 +@end example + +To receive over UDP from a remote endpoint: +@example +ffmpeg -i udp://[@var{multicast-address}]:@var{port} +@end example + @c man end PROTOCOLS diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/ffmpeg.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/ffmpeg.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/ffmpeg.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/ffmpeg.c 2010-11-06 17:21:26.000000000 +0000 @@ -37,8 +37,10 @@ #include "libavcodec/opt.h" #include "libavcodec/audioconvert.h" #include "libavcore/parseutils.h" +#include "libavcore/samplefmt.h" #include "libavutil/colorspace.h" #include "libavutil/fifo.h" +#include "libavutil/intreadwrite.h" #include "libavutil/pixdesc.h" #include "libavutil/avstring.h" #include "libavutil/libm.h" @@ -79,8 +81,7 @@ #include "cmdutils.h" -#undef NDEBUG -#include +#include "libavutil/avassert.h" const char program_name[] = "FFmpeg"; const int program_birth_year = 2000; @@ -93,47 +94,54 @@ int sync_stream_index; } AVStreamMap; -/** select an input file for an output file */ +/** + * select an input file for an output file + */ typedef struct AVMetaDataMap { - int out_file; - int in_file; + int file; //< file index + char type; //< type of metadata to copy -- (g)lobal, (s)tream, (c)hapter or (p)rogram + int index; //< stream/chapter/program number } AVMetaDataMap; static const OptionDef options[]; #define MAX_FILES 100 +#if !FF_API_MAX_STREAMS +#define MAX_STREAMS 1024 /* arbitrary sanity check value */ +#endif static const char *last_asked_format = NULL; static AVFormatContext *input_files[MAX_FILES]; static int64_t input_files_ts_offset[MAX_FILES]; -static double input_files_ts_scale[MAX_FILES][MAX_STREAMS]; -static AVCodec *input_codecs[MAX_FILES*MAX_STREAMS]; +static double *input_files_ts_scale[MAX_FILES] = {NULL}; +static AVCodec **input_codecs = NULL; static int nb_input_files = 0; -static int nb_icodecs; +static int nb_input_codecs = 0; +static int nb_input_files_ts_scale[MAX_FILES] = {0}; static AVFormatContext *output_files[MAX_FILES]; -static AVCodec *output_codecs[MAX_FILES*MAX_STREAMS]; +static AVCodec **output_codecs = NULL; static int nb_output_files = 0; -static int nb_ocodecs; +static int nb_output_codecs = 0; -static AVStreamMap stream_maps[MAX_FILES*MAX_STREAMS]; +static AVStreamMap *stream_maps = NULL; static int nb_stream_maps; -static AVMetaDataMap meta_data_maps[MAX_FILES]; +/* first item specifies output metadata, second is input */ +static AVMetaDataMap (*meta_data_maps)[2] = NULL; static int nb_meta_data_maps; +static int metadata_streams_autocopy = 1; +static int metadata_chapters_autocopy = 1; /* indexed by output file stream index */ -static int streamid_map[MAX_STREAMS]; +static int *streamid_map = NULL; +static int nb_streamid_map = 0; static int frame_width = 0; static int frame_height = 0; static float frame_aspect_ratio = 0; static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE; static enum SampleFormat audio_sample_fmt = SAMPLE_FMT_NONE; -static int frame_topBand = 0; -static int frame_bottomBand = 0; -static int frame_leftBand = 0; -static int frame_rightBand = 0; static int max_frames[4] = {INT_MAX, INT_MAX, INT_MAX, INT_MAX}; static AVRational frame_rate; static float video_qscale = 0; @@ -182,8 +190,7 @@ static int64_t recording_timestamp = 0; static int64_t input_ts_offset = 0; static int file_overwrite = 0; -static int metadata_count; -static AVMetadataTag *metadata; +static AVMetadata *metadata; static int do_benchmark = 0; static int do_hex_dump = 0; static int do_pkt_dump = 0; @@ -224,8 +231,8 @@ static int input_sync; static uint64_t limit_filesize = 0; static int force_fps = 0; +static char *forced_key_frames = NULL; -static int pgmyuv_compatibility_hack=0; static float dts_delta_threshold = 10; static unsigned int sws_flags = SWS_BICUBIC; @@ -241,7 +248,6 @@ static AVBitStreamFilterContext *video_bitstream_filters=NULL; static AVBitStreamFilterContext *audio_bitstream_filters=NULL; static AVBitStreamFilterContext *subtitle_bitstream_filters=NULL; -static AVBitStreamFilterContext *bitstream_filters[MAX_FILES][MAX_STREAMS]; #define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass" @@ -259,6 +265,7 @@ //double sync_ipts; /* dts from the AVPacket of the demuxer in second units */ struct AVInputStream *sync_ist; /* input stream to sync against */ int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ //FIXME look at frame_number + AVBitStreamFilterContext *bitstream_filters; /* video only */ int video_resample; AVFrame pict_tmp; /* temporary image for resampling */ @@ -271,18 +278,10 @@ int original_height; int original_width; - /* cropping area sizes */ - int video_crop; - int topBand; - int bottomBand; - int leftBand; - int rightBand; - - /* cropping area of first frame */ - int original_topBand; - int original_bottomBand; - int original_leftBand; - int original_rightBand; + /* forced key frames */ + int64_t *forced_kf_pts; + int forced_kf_count; + int forced_kf_index; /* audio only */ int audio_resample; @@ -293,6 +292,9 @@ FILE *logfile; } AVOutputStream; +static AVOutputStream **output_streams_for_file[MAX_FILES] = { NULL }; +static int nb_output_streams_for_file[MAX_FILES] = { 0 }; + typedef struct AVInputStream { int file_index; int index; @@ -305,11 +307,12 @@ int64_t next_pts; /* synthetic pts for cases where pkt.pts is not defined */ int64_t pts; /* current pts */ + PtsCorrectionContext pts_ctx; int is_start; /* is 1 at the start and after a discontinuity */ int showed_multi_packet_warning; int is_past_recording_time; #if CONFIG_AVFILTER - AVFilterContext *out_video_filter; + AVFilterContext *output_video_filter; AVFilterContext *input_video_filter; AVFrame *filter_frame; int has_filter_frame; @@ -331,74 +334,6 @@ #endif #if CONFIG_AVFILTER -typedef struct { - int pix_fmt; -} FilterOutPriv; - - -static int output_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - FilterOutPriv *priv = ctx->priv; - - if(!opaque) return -1; - - priv->pix_fmt = *((int *)opaque); - - return 0; -} - -static void output_end_frame(AVFilterLink *link) -{ -} - -static int output_query_formats(AVFilterContext *ctx) -{ - FilterOutPriv *priv = ctx->priv; - enum PixelFormat pix_fmts[] = { priv->pix_fmt, PIX_FMT_NONE }; - - avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); - return 0; -} - -static int get_filtered_video_pic(AVFilterContext *ctx, - AVFilterBufferRef **picref, AVFrame *pic2, - uint64_t *pts) -{ - AVFilterBufferRef *pic; - - if(avfilter_request_frame(ctx->inputs[0])) - return -1; - if(!(pic = ctx->inputs[0]->cur_buf)) - return -1; - *picref = pic; - ctx->inputs[0]->cur_buf = NULL; - - *pts = pic->pts; - - memcpy(pic2->data, pic->data, sizeof(pic->data)); - memcpy(pic2->linesize, pic->linesize, sizeof(pic->linesize)); - pic2->interlaced_frame = pic->interlaced; - pic2->top_field_first = pic->top_field_first; - - return 1; -} - -static AVFilter output_filter = -{ - .name = "ffmpeg_output", - - .priv_size = sizeof(FilterOutPriv), - .init = output_init, - - .query_formats = output_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .end_frame = output_end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; static int configure_filters(AVInputStream *ist, AVOutputStream *ost) { @@ -406,57 +341,41 @@ /** filter graph containing all filters including input & output */ AVCodecContext *codec = ost->st->codec; AVCodecContext *icodec = ist->st->codec; + FFSinkContext ffsink_ctx = { .pix_fmt = codec->pix_fmt }; char args[255]; + int ret; graph = av_mallocz(sizeof(AVFilterGraph)); - if (!(ist->input_video_filter = avfilter_open(avfilter_get_by_name("buffer"), "src"))) - return -1; - if (!(ist->out_video_filter = avfilter_open(&output_filter, "out"))) - return -1; - - snprintf(args, 255, "%d:%d:%d", ist->st->codec->width, - ist->st->codec->height, ist->st->codec->pix_fmt); - if (avfilter_init_filter(ist->input_video_filter, args, NULL)) - return -1; - if (avfilter_init_filter(ist->out_video_filter, NULL, &codec->pix_fmt)) - return -1; + if ((ret = avfilter_open(&ist->input_video_filter, avfilter_get_by_name("buffer"), "src")) < 0) + return ret; + if ((ret = avfilter_open(&ist->output_video_filter, &ffsink, "out")) < 0) + return ret; + + snprintf(args, 255, "%d:%d:%d:%d:%d", ist->st->codec->width, + ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE); + if ((ret = avfilter_init_filter(ist->input_video_filter, args, NULL)) < 0) + return ret; + if ((ret = avfilter_init_filter(ist->output_video_filter, NULL, &ffsink_ctx)) < 0) + return ret; /* add input and output filters to the overall graph */ avfilter_graph_add_filter(graph, ist->input_video_filter); - avfilter_graph_add_filter(graph, ist->out_video_filter); + avfilter_graph_add_filter(graph, ist->output_video_filter); last_filter = ist->input_video_filter; - if (ost->video_crop) { - snprintf(args, 255, "%d:%d:%d:%d", ost->leftBand, ost->topBand, - codec->width, - codec->height); - filter = avfilter_open(avfilter_get_by_name("crop"), NULL); - if (!filter) - return -1; - if (avfilter_init_filter(filter, args, NULL)) - return -1; - if (avfilter_link(last_filter, 0, filter, 0)) - return -1; - last_filter = filter; - avfilter_graph_add_filter(graph, last_filter); - } - - if((codec->width != - icodec->width - (frame_leftBand + frame_rightBand)) || - (codec->height != icodec->height - (frame_topBand + frame_bottomBand))) { + if (codec->width != icodec->width || codec->height != icodec->height) { snprintf(args, 255, "%d:%d:flags=0x%X", codec->width, codec->height, (int)av_get_int(sws_opts, "sws_flags", NULL)); - filter = avfilter_open(avfilter_get_by_name("scale"), NULL); - if (!filter) - return -1; - if (avfilter_init_filter(filter, args, NULL)) - return -1; - if (avfilter_link(last_filter, 0, filter, 0)) - return -1; + if ((ret = avfilter_open(&filter, avfilter_get_by_name("scale"), NULL)) < 0) + return ret; + if ((ret = avfilter_init_filter(filter, args, NULL)) < 0) + return ret; + if ((ret = avfilter_link(last_filter, 0, filter, 0)) < 0) + return ret; last_filter = filter; avfilter_graph_add_filter(graph, last_filter); } @@ -474,28 +393,23 @@ outputs->next = NULL; inputs->name = av_strdup("out"); - inputs->filter = ist->out_video_filter; + inputs->filter = ist->output_video_filter; inputs->pad_idx = 0; inputs->next = NULL; - if (avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL) < 0) - return -1; + if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0) + return ret; av_freep(&vfilters); } else { - if (avfilter_link(last_filter, 0, ist->out_video_filter, 0) < 0) - return -1; + if ((ret = avfilter_link(last_filter, 0, ist->output_video_filter, 0)) < 0) + return ret; } - /* configure all the filter links */ - if (avfilter_graph_check_validity(graph, NULL)) - return -1; - if (avfilter_graph_config_formats(graph, NULL)) - return -1; - if (avfilter_graph_config_links(graph, NULL)) - return -1; + if ((ret = avfilter_graph_config(graph, NULL)) < 0) + return ret; - codec->width = ist->out_video_filter->inputs[0]->w; - codec->height = ist->out_video_filter->inputs[0]->h; + codec->width = ist->output_video_filter->inputs[0]->w; + codec->height = ist->output_video_filter->inputs[0]->h; return 0; } @@ -503,6 +417,7 @@ static void term_exit(void) { + av_log(NULL, AV_LOG_QUIET, ""); #if HAVE_TERMIOS_H tcsetattr (0, TCSANOW, &oldtty); #endif @@ -593,6 +508,7 @@ for(j=0;jnb_streams;j++) { av_metadata_free(&s->streams[j]->metadata); av_free(s->streams[j]->codec); + av_free(s->streams[j]->info); av_free(s->streams[j]); } for(j=0;jnb_programs;j++) { @@ -603,9 +519,12 @@ } av_metadata_free(&s->metadata); av_free(s); + av_free(output_streams_for_file[i]); } - for(i=0;i= INT_MAX / elem_size) { + fprintf(stderr, "Array too big.\n"); + ffmpeg_exit(1); + } + if (*size < new_size) { + uint8_t *tmp = av_realloc(array, new_size*elem_size); + if (!tmp) { + fprintf(stderr, "Could not alloc buffer.\n"); + ffmpeg_exit(1); + } + memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); + *size = new_size; + return tmp; + } + return array; +} + static void choose_sample_fmt(AVStream *st, AVCodec *codec) { if(codec && codec->sample_fmts){ @@ -696,6 +637,27 @@ } } +static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx) +{ + int idx = oc->nb_streams - 1; + AVOutputStream *ost; + + output_streams_for_file[file_idx] = + grow_array(output_streams_for_file[file_idx], + sizeof(*output_streams_for_file[file_idx]), + &nb_output_streams_for_file[file_idx], + oc->nb_streams); + ost = output_streams_for_file[file_idx][idx] = + av_mallocz(sizeof(AVOutputStream)); + if (!ost) { + fprintf(stderr, "Could not alloc output stream\n"); + ffmpeg_exit(1); + } + ost->file_index = file_idx; + ost->index = idx; + return ost; +} + static int read_ffserver_streams(AVFormatContext *s, const char *filename) { int i, err; @@ -706,11 +668,13 @@ if (err < 0) return err; /* copy stream format */ - s->nb_streams = ic->nb_streams; + s->nb_streams = 0; for(i=0;inb_streams;i++) { AVStream *st; AVCodec *codec; + s->nb_streams++; + // FIXME: a more elegant solution is needed st = av_mallocz(sizeof(AVStream)); memcpy(st, ic->streams[i], sizeof(AVStream)); @@ -737,6 +701,8 @@ if(st->codec->flags & CODEC_FLAG_BITEXACT) nopts = 1; + + new_output_stream(s, nb_output_files); } if (!nopts) @@ -799,8 +765,8 @@ int size_out, frame_bytes, ret; AVCodecContext *enc= ost->st->codec; AVCodecContext *dec= ist->st->codec; - int osize= av_get_bits_per_sample_format(enc->sample_fmt)/8; - int isize= av_get_bits_per_sample_format(dec->sample_fmt)/8; + int osize= av_get_bits_per_sample_fmt(enc->sample_fmt)/8; + int isize= av_get_bits_per_sample_fmt(dec->sample_fmt)/8; const int coded_bps = av_get_bits_per_sample(enc->codec->id); need_realloc: @@ -854,8 +820,8 @@ dec->sample_fmt, 1, NULL, 0); if (!ost->reformat_ctx) { fprintf(stderr, "Cannot convert %s sample format to %s sample format\n", - avcodec_get_sample_fmt_name(dec->sample_fmt), - avcodec_get_sample_fmt_name(enc->sample_fmt)); + av_get_sample_fmt_name(dec->sample_fmt), + av_get_sample_fmt_name(enc->sample_fmt)); ffmpeg_exit(1); } ost->reformat_pair=MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt); @@ -863,9 +829,9 @@ if(audio_sync_method){ double delta = get_sync_ipts(ost) * enc->sample_rate - ost->sync_opts - - av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2); - double idelta= delta*ist->st->codec->sample_rate / enc->sample_rate; - int byte_delta= ((int)idelta)*2*ist->st->codec->channels; + - av_fifo_size(ost->fifo)/(enc->channels * 2); + double idelta= delta*dec->sample_rate / enc->sample_rate; + int byte_delta= ((int)idelta)*2*dec->channels; //FIXME resample delay if(fabs(delta) > 50){ @@ -898,7 +864,7 @@ } }else if(audio_sync_method>1){ int comp= av_clip(delta, -audio_sync_method, audio_sync_method); - assert(ost->audio_resample); + av_assert0(ost->audio_resample); if(verbose > 2) fprintf(stderr, "compensating audio timestamp drift:%f compensation:%d in:%d\n", delta, comp, enc->sample_rate); // fprintf(stderr, "drift:%f len:%d opts:%"PRId64" ipts:%"PRId64" fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2)); @@ -907,13 +873,13 @@ } }else ost->sync_opts= lrintf(get_sync_ipts(ost) * enc->sample_rate) - - av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2); //FIXME wrong + - av_fifo_size(ost->fifo)/(enc->channels * 2); //FIXME wrong if (ost->audio_resample) { buftmp = audio_buf; size_out = audio_resample(ost->resample, (short *)buftmp, (short *)buf, - size / (ist->st->codec->channels * isize)); + size / (dec->channels * isize)); size_out = size_out * enc->channels * osize; } else { buftmp = buf; @@ -968,7 +934,7 @@ if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; - write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); + write_frame(s, &pkt, enc, ost->bitstream_filters); ost->sync_opts += enc->frame_size; } @@ -1003,7 +969,7 @@ if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; - write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); + write_frame(s, &pkt, enc, ost->bitstream_filters); } } @@ -1108,7 +1074,7 @@ else pkt.pts += 90 * sub->end_display_time; } - write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); + write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters); } } @@ -1122,17 +1088,10 @@ int *frame_size) { int nb_frames, i, ret; -#if !CONFIG_AVFILTER - int64_t topBand, bottomBand, leftBand, rightBand; -#endif AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src; - AVFrame picture_crop_temp, picture_pad_temp; AVCodecContext *enc, *dec; double sync_ipts; - avcodec_get_frame_defaults(&picture_crop_temp); - avcodec_get_frame_defaults(&picture_pad_temp); - enc = ost->st->codec; dec = ist->st->codec; @@ -1172,28 +1131,13 @@ if (nb_frames <= 0) return; -#if CONFIG_AVFILTER formatted_picture = in_picture; -#else - if (ost->video_crop) { - if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture *)in_picture, dec->pix_fmt, ost->topBand, ost->leftBand) < 0) { - fprintf(stderr, "error cropping picture\n"); - if (exit_on_error) - ffmpeg_exit(1); - return; - } - formatted_picture = &picture_crop_temp; - } else { - formatted_picture = in_picture; - } -#endif - final_picture = formatted_picture; padding_src = formatted_picture; resampling_dst = &ost->pict_tmp; - if( (ost->resample_height != (ist->st->codec->height - (ost->topBand + ost->bottomBand))) - || (ost->resample_width != (ist->st->codec->width - (ost->leftBand + ost->rightBand))) + if ( ost->resample_height != ist->st->codec->height + || ost->resample_width != ist->st->codec->width || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) { fprintf(stderr,"Input Stream #%d.%d frame size changed to %dx%d, %s\n", ist->file_index, ist->index, ist->st->codec->width, ist->st->codec->height,avcodec_get_pix_fmt_name(ist->st->codec->pix_fmt)); @@ -1205,37 +1149,16 @@ if (ost->video_resample) { padding_src = NULL; final_picture = &ost->pict_tmp; - if( (ost->resample_height != (ist->st->codec->height - (ost->topBand + ost->bottomBand))) - || (ost->resample_width != (ist->st->codec->width - (ost->leftBand + ost->rightBand))) + if( ost->resample_height != ist->st->codec->height + || ost->resample_width != ist->st->codec->width || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) { - /* keep bands proportional to the frame size */ - topBand = ((int64_t)ist->st->codec->height * ost->original_topBand / ost->original_height) & ~1; - bottomBand = ((int64_t)ist->st->codec->height * ost->original_bottomBand / ost->original_height) & ~1; - leftBand = ((int64_t)ist->st->codec->width * ost->original_leftBand / ost->original_width) & ~1; - rightBand = ((int64_t)ist->st->codec->width * ost->original_rightBand / ost->original_width) & ~1; - - /* sanity check to ensure no bad band sizes sneak in */ - assert(topBand <= INT_MAX && topBand >= 0); - assert(bottomBand <= INT_MAX && bottomBand >= 0); - assert(leftBand <= INT_MAX && leftBand >= 0); - assert(rightBand <= INT_MAX && rightBand >= 0); - - ost->topBand = topBand; - ost->bottomBand = bottomBand; - ost->leftBand = leftBand; - ost->rightBand = rightBand; - - ost->resample_height = ist->st->codec->height - (ost->topBand + ost->bottomBand); - ost->resample_width = ist->st->codec->width - (ost->leftBand + ost->rightBand); - ost->resample_pix_fmt= ist->st->codec->pix_fmt; - /* initialize a new scaler context */ sws_freeContext(ost->img_resample_ctx); sws_flags = av_get_int(sws_opts, "sws_flags", NULL); ost->img_resample_ctx = sws_getContext( - ist->st->codec->width - (ost->leftBand + ost->rightBand), - ist->st->codec->height - (ost->topBand + ost->bottomBand), + ist->st->codec->width, + ist->st->codec->height, ist->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height, @@ -1268,7 +1191,7 @@ pkt.pts= av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; - write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); + write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters); enc->coded_frame = old_frame; } else { AVFrame big_picture; @@ -1293,6 +1216,11 @@ big_picture.pts= ost->sync_opts; // big_picture.pts= av_rescale(ost->sync_opts, AV_TIME_BASE*(int64_t)enc->time_base.num, enc->time_base.den); //av_log(NULL, AV_LOG_DEBUG, "%"PRId64" -> encoder\n", ost->sync_opts); + if (ost->forced_kf_index < ost->forced_kf_count && + big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) { + big_picture.pict_type = FF_I_TYPE; + ost->forced_kf_index++; + } ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, &big_picture); @@ -1312,7 +1240,7 @@ if(enc->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; - write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); + write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters); *frame_size = ret; video_size += ret; //fprintf(stderr,"\nFrame: %3d size: %5d type: %d", @@ -1505,12 +1433,13 @@ void *buffer_to_free; static unsigned int samples_size= 0; AVSubtitle subtitle, *subtitle_to_free; + int64_t pkt_pts = AV_NOPTS_VALUE; #if CONFIG_AVFILTER int frame_available; #endif AVPacket avpkt; - int bps = av_get_bits_per_sample_format(ist->st->codec->sample_fmt)>>3; + int bps = av_get_bits_per_sample_fmt(ist->st->codec->sample_fmt)>>3; if(ist->next_pts == AV_NOPTS_VALUE) ist->next_pts= ist->pts; @@ -1527,6 +1456,8 @@ if(pkt->dts != AV_NOPTS_VALUE) ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); + if(pkt->pts != AV_NOPTS_VALUE) + pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); //while we have more to decode or while the decoder did output something on EOF while (avpkt.size > 0 || (!pkt && ist->next_pts != ist->pts)) { @@ -1579,6 +1510,8 @@ decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2; /* XXX: allocate picture correctly */ avcodec_get_frame_defaults(&picture); + ist->st->codec->reordered_opaque = pkt_pts; + pkt_pts = AV_NOPTS_VALUE; ret = avcodec_decode_video2(ist->st->codec, &picture, &got_picture, &avpkt); @@ -1589,6 +1522,7 @@ /* no picture yet */ goto discard_packet; } + ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.reordered_opaque, ist->pts); if (ist->st->codec->time_base.num != 0) { int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; ist->next_pts += ((int64_t)AV_TIME_BASE * @@ -1668,15 +1602,18 @@ } #if CONFIG_AVFILTER frame_available = ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO || - !ist->out_video_filter || avfilter_poll_frame(ist->out_video_filter->inputs[0]); + !ist->output_video_filter || avfilter_poll_frame(ist->output_video_filter->inputs[0]); #endif /* if output time reached then transcode raw format, encode packets and output them */ if (start_time == 0 || ist->pts >= start_time) #if CONFIG_AVFILTER while (frame_available) { - if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ist->out_video_filter) - get_filtered_video_pic(ist->out_video_filter, &ist->picref, &picture, &ist->pts); + AVRational ist_pts_tb; + if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ist->output_video_filter) + get_filtered_video_frame(ist->output_video_filter, &picture, &ist->picref, &ist_pts_tb); + if (ist->picref) + ist->pts = av_rescale_q(ist->picref->pts, ist_pts_tb, AV_TIME_BASE_Q); #endif for(i=0;isync_ipts = (double)(ist->pts + input_files_ts_offset[ist->file_index] - start_time)/ AV_TIME_BASE; if (ost->encoding_needed) { - assert(ist->decoding_needed); + av_assert0(ist->decoding_needed); switch(ost->st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: do_audio_out(os, ost, ist, decoded_data_buf, decoded_data_size); break; case AVMEDIA_TYPE_VIDEO: #if CONFIG_AVFILTER - ost->st->codec->sample_aspect_ratio = ist->picref->pixel_aspect; + if (ist->picref->video) + ost->st->codec->sample_aspect_ratio = ist->picref->video->pixel_aspect; #endif do_video_out(os, ost, ist, &picture, &frame_size); if (vstats_filename && frame_size) @@ -1760,7 +1698,7 @@ opkt.size = data_size; } - write_frame(os, &opkt, ost->st->codec, bitstream_filters[ost->file_index][opkt.stream_index]); + write_frame(os, &opkt, ost->st->codec, ost->bitstream_filters); ost->st->codec->frame_number++; ost->frame_number++; av_free_packet(&opkt); @@ -1770,7 +1708,7 @@ #if CONFIG_AVFILTER frame_available = (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) && - ist->out_video_filter && avfilter_poll_frame(ist->out_video_filter->inputs[0]); + ist->output_video_filter && avfilter_poll_frame(ist->output_video_filter->inputs[0]); if(ist->picref) avfilter_unref_buffer(ist->picref); } @@ -1818,7 +1756,7 @@ ret = 0; /* encode any samples remaining in fifo */ if (fifo_bytes > 0) { - int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3; + int osize = av_get_bits_per_sample_fmt(enc->sample_fmt) >> 3; int fs_tmp = enc->frame_size; av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); @@ -1869,7 +1807,7 @@ pkt.size= ret; if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); - write_frame(os, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); + write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters); } } } @@ -1919,8 +1857,9 @@ out_ch->start = FFMAX(0, in_ch->start - ts_off); out_ch->end = FFMIN(rt, in_ch->end - ts_off); - while ((t = av_metadata_get(in_ch->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) - av_metadata_set2(&out_ch->metadata, t->key, t->value, 0); + if (metadata_chapters_autocopy) + while ((t = av_metadata_get(in_ch->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) + av_metadata_set2(&out_ch->metadata, t->key, t->value, 0); os->nb_chapters++; os->chapters = av_realloc(os->chapters, sizeof(AVChapter)*os->nb_chapters); @@ -1931,6 +1870,29 @@ return 0; } +static void parse_forced_key_frames(char *kf, AVOutputStream *ost, + AVCodecContext *avctx) +{ + char *p; + int n = 1, i; + int64_t t; + + for (p = kf; *p; p++) + if (*p == ',') + n++; + ost->forced_kf_count = n; + ost->forced_kf_pts = av_malloc(sizeof(*ost->forced_kf_pts) * n); + if (!ost->forced_kf_pts) { + av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n"); + ffmpeg_exit(1); + } + for (i = 0; i < n; i++) { + p = i ? strchr(p, ',') + 1 : kf; + t = parse_time_or_die("force_key_frames", p, 1); + ost->forced_kf_pts[i] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base); + } +} + /* * The following code is the main loop of the file converter */ @@ -2035,21 +1997,12 @@ ost_table = av_mallocz(sizeof(AVOutputStream *) * nb_ostreams); if (!ost_table) goto fail; - for(i=0;inb_streams;i++,n++) { int found; - ost = ost_table[n]; - ost->file_index = k; - ost->index = i; + ost = ost_table[n] = output_streams_for_file[k][i]; ost->st = os->streams[i]; if (nb_stream_maps > 0) { ost->source_index = file_table[stream_maps[n].file_index].ist_index + @@ -2067,33 +2020,33 @@ } else { int best_nb_frames=-1; - /* get corresponding input stream index : we select the first one with the right type */ - found = 0; - for(j=0;jfile_index ]; - skip=1; - for(pi=0; pinb_programs; pi++){ - AVProgram *p= f->programs[pi]; - if(p->id == opt_programid) - for(si=0; sinb_stream_indexes; si++){ - if(f->streams[ p->stream_index[si] ] == ist->st) - skip=0; - } - } + /* get corresponding input stream index : we select the first one with the right type */ + found = 0; + for(j=0;jfile_index ]; + skip=1; + for(pi=0; pinb_programs; pi++){ + AVProgram *p= f->programs[pi]; + if(p->id == opt_programid) + for(si=0; sinb_stream_indexes; si++){ + if(f->streams[ p->stream_index[si] ] == ist->st) + skip=0; + } } - if (ist->discard && ist->st->discard != AVDISCARD_ALL && !skip && - ist->st->codec->codec_type == ost->st->codec->codec_type) { - if(best_nb_frames < ist->st->codec_info_nb_frames){ - best_nb_frames= ist->st->codec_info_nb_frames; - ost->source_index = j; - found = 1; - } + } + if (ist->discard && ist->st->discard != AVDISCARD_ALL && !skip && + ist->st->codec->codec_type == ost->st->codec->codec_type) { + if(best_nb_frames < ist->st->codec_info_nb_frames){ + best_nb_frames= ist->st->codec_info_nb_frames; + ost->source_index = j; + found = 1; } } + } if (!found) { if(! opt_programid) { @@ -2134,9 +2087,10 @@ codec = ost->st->codec; icodec = ist->st->codec; - while ((t = av_metadata_get(ist->st->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) { - av_metadata_set2(&ost->st->metadata, t->key, t->value, AV_METADATA_DONT_OVERWRITE); - } + if (metadata_streams_autocopy) + while ((t = av_metadata_get(ist->st->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) { + av_metadata_set2(&ost->st->metadata, t->key, t->value, AV_METADATA_DONT_OVERWRITE); + } ost->st->disposition = ist->st->disposition; codec->bits_per_raw_sample= icodec->bits_per_raw_sample; @@ -2160,6 +2114,8 @@ } codec->bit_rate = icodec->bit_rate; + codec->rc_max_rate = icodec->rc_max_rate; + codec->rc_buffer_size = icodec->rc_buffer_size; codec->extradata= av_mallocz(extra_size); if (!codec->extradata) goto fail; @@ -2218,18 +2174,9 @@ fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n"); ffmpeg_exit(1); } - ost->video_crop = ((frame_leftBand + frame_rightBand + frame_topBand + frame_bottomBand) != 0); - ost->video_resample = ((codec->width != icodec->width - - (frame_leftBand + frame_rightBand)) || - (codec->height != icodec->height - - (frame_topBand + frame_bottomBand)) || + ost->video_resample = (codec->width != icodec->width || + codec->height != icodec->height || (codec->pix_fmt != icodec->pix_fmt)); - if (ost->video_crop) { - ost->topBand = ost->original_topBand = frame_topBand; - ost->bottomBand = ost->original_bottomBand = frame_bottomBand; - ost->leftBand = ost->original_leftBand = frame_leftBand; - ost->rightBand = ost->original_rightBand = frame_rightBand; - } if (ost->video_resample) { avcodec_get_frame_defaults(&ost->pict_tmp); if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt, @@ -2239,8 +2186,8 @@ } sws_flags = av_get_int(sws_opts, "sws_flags", NULL); ost->img_resample_ctx = sws_getContext( - icodec->width - (frame_leftBand + frame_rightBand), - icodec->height - (frame_topBand + frame_bottomBand), + icodec->width, + icodec->height, icodec->pix_fmt, codec->width, codec->height, @@ -2257,8 +2204,8 @@ #endif codec->bits_per_raw_sample= 0; } - ost->resample_height = icodec->height - (frame_topBand + frame_bottomBand); - ost->resample_width = icodec->width - (frame_leftBand + frame_rightBand); + ost->resample_height = icodec->height; + ost->resample_width = icodec->width; ost->resample_pix_fmt= icodec->pix_fmt; ost->encoding_needed = 1; ist->decoding_needed = 1; @@ -2324,7 +2271,7 @@ for(i=0;iencoding_needed) { - AVCodec *codec = output_codecs[i]; + AVCodec *codec = i < nb_output_codecs ? output_codecs[i] : NULL; if (!codec) codec = avcodec_find_encoder(ost->st->codec->codec_id); if (!codec) { @@ -2347,7 +2294,7 @@ for(i=0;idecoding_needed) { - AVCodec *codec = input_codecs[i]; + AVCodec *codec = i < nb_input_codecs ? input_codecs[i] : NULL; if (!codec) codec = avcodec_find_decoder(ist->st->codec->codec_id); if (!codec) { @@ -2374,39 +2321,58 @@ st= ist->st; ist->pts = st->avg_frame_rate.num ? - st->codec->has_b_frames*AV_TIME_BASE / av_q2d(st->avg_frame_rate) : 0; ist->next_pts = AV_NOPTS_VALUE; + init_pts_correction(&ist->pts_ctx); ist->is_start = 1; } /* set meta data information from input file if required */ for (i=0;i= nb_output_files) { - snprintf(error, sizeof(error), "Invalid output file index %d map_meta_data(%d,%d)", - out_file_index, out_file_index, in_file_index); - ret = AVERROR(EINVAL); - goto dump_format; - } - if (in_file_index < 0 || in_file_index >= nb_input_files) { - snprintf(error, sizeof(error), "Invalid input file index %d map_meta_data(%d,%d)", - in_file_index, out_file_index, in_file_index); - ret = AVERROR(EINVAL); - goto dump_format; +#define METADATA_CHECK_INDEX(index, nb_elems, desc)\ + if ((index) < 0 || (index) >= (nb_elems)) {\ + snprintf(error, sizeof(error), "Invalid %s index %d while processing metadata maps\n",\ + (desc), (index));\ + ret = AVERROR(EINVAL);\ + goto dump_format;\ + } + + int out_file_index = meta_data_maps[i][0].file; + int in_file_index = meta_data_maps[i][1].file; + METADATA_CHECK_INDEX(out_file_index, nb_output_files, "output file") + METADATA_CHECK_INDEX(in_file_index, nb_input_files, "input file") + + files[0] = output_files[out_file_index]; + files[1] = input_files[in_file_index]; + + for (j = 0; j < 2; j++) { + AVMetaDataMap *map = &meta_data_maps[i][j]; + + switch (map->type) { + case 'g': + meta[j] = &files[j]->metadata; + break; + case 's': + METADATA_CHECK_INDEX(map->index, files[j]->nb_streams, "stream") + meta[j] = &files[j]->streams[map->index]->metadata; + break; + case 'c': + METADATA_CHECK_INDEX(map->index, files[j]->nb_chapters, "chapter") + meta[j] = &files[j]->chapters[map->index]->metadata; + break; + case 'p': + METADATA_CHECK_INDEX(map->index, files[j]->nb_programs, "program") + meta[j] = &files[j]->programs[map->index]->metadata; + break; + } } - out_file = output_files[out_file_index]; - in_file = input_files[in_file_index]; - - mtag=NULL; - while((mtag=av_metadata_get(in_file->metadata, "", mtag, AV_METADATA_IGNORE_SUFFIX))) - av_metadata_set2(&out_file->metadata, mtag->key, mtag->value, AV_METADATA_DONT_OVERWRITE); - av_metadata_conv(out_file, out_file->oformat->metadata_conv, - in_file->iformat->metadata_conv); + while((mtag=av_metadata_get(*meta[1], "", mtag, AV_METADATA_IGNORE_SUFFIX))) + av_metadata_set2(meta[0], mtag->key, mtag->value, AV_METADATA_DONT_OVERWRITE); } /* copy chapters from the first input file that has them*/ @@ -2532,7 +2498,7 @@ } /* finish if limit size exhausted */ - if (limit_filesize != 0 && limit_filesize < url_ftell(output_files[0]->pb)) + if (limit_filesize != 0 && limit_filesize <= url_ftell(output_files[0]->pb)) break; /* read a frame from it and output it in the fifo */ @@ -2571,7 +2537,8 @@ if (pkt.pts != AV_NOPTS_VALUE) pkt.pts += av_rescale_q(input_files_ts_offset[ist->file_index], AV_TIME_BASE_Q, ist->st->time_base); - if(input_files_ts_scale[file_index][pkt.stream_index]){ + if (pkt.stream_index < nb_input_files_ts_scale[file_index] + && input_files_ts_scale[file_index][pkt.stream_index]){ if(pkt.pts != AV_NOPTS_VALUE) pkt.pts *= input_files_ts_scale[file_index][pkt.stream_index]; if(pkt.dts != AV_NOPTS_VALUE) @@ -2688,6 +2655,7 @@ av_fifo_free(ost->fifo); /* works even if fifo is not initialized but set to zero */ av_free(ost->pict_tmp.data[0]); + av_free(ost->forced_kf_pts); if (ost->video_resample) sws_freeContext(ost->img_resample_ctx); if (ost->resample) @@ -2704,14 +2672,6 @@ static void opt_format(const char *arg) { - /* compatibility stuff for pgmyuv */ - if (!strcmp(arg, "pgmyuv")) { - pgmyuv_compatibility_hack=1; -// opt_image_format(arg); - arg = "image2"; - fprintf(stderr, "pgmyuv format is deprecated, use image2\n"); - } - last_asked_format = arg; } @@ -2753,64 +2713,10 @@ return 0; } -static void opt_frame_crop_top(const char *arg) +static int opt_frame_crop(const char *opt, const char *arg) { - frame_topBand = atoi(arg); - if (frame_topBand < 0) { - fprintf(stderr, "Incorrect top crop size\n"); - ffmpeg_exit(1); - } - if ((frame_topBand) >= frame_height){ - fprintf(stderr, "Vertical crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n"); - ffmpeg_exit(1); - } - fprintf(stderr, "-crop* is deprecated in favor of the crop avfilter\n"); - frame_height -= frame_topBand; -} - -static void opt_frame_crop_bottom(const char *arg) -{ - frame_bottomBand = atoi(arg); - if (frame_bottomBand < 0) { - fprintf(stderr, "Incorrect bottom crop size\n"); - ffmpeg_exit(1); - } - if ((frame_bottomBand) >= frame_height){ - fprintf(stderr, "Vertical crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n"); - ffmpeg_exit(1); - } - fprintf(stderr, "-crop* is deprecated in favor of the crop avfilter\n"); - frame_height -= frame_bottomBand; -} - -static void opt_frame_crop_left(const char *arg) -{ - frame_leftBand = atoi(arg); - if (frame_leftBand < 0) { - fprintf(stderr, "Incorrect left crop size\n"); - ffmpeg_exit(1); - } - if ((frame_leftBand) >= frame_width){ - fprintf(stderr, "Horizontal crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n"); - ffmpeg_exit(1); - } - fprintf(stderr, "-crop* is deprecated in favor of the crop avfilter\n"); - frame_width -= frame_leftBand; -} - -static void opt_frame_crop_right(const char *arg) -{ - frame_rightBand = atoi(arg); - if (frame_rightBand < 0) { - fprintf(stderr, "Incorrect right crop size\n"); - ffmpeg_exit(1); - } - if ((frame_rightBand) >= frame_width){ - fprintf(stderr, "Horizontal crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n"); - ffmpeg_exit(1); - } - fprintf(stderr, "-crop* is deprecated in favor of the crop avfilter\n"); - frame_width -= frame_rightBand; + fprintf(stderr, "Option '%s' has been removed, use the crop filter instead\n", opt); + return AVERROR(EINVAL); } static void opt_frame_size(const char *arg) @@ -2874,10 +2780,7 @@ } *mid++= 0; - metadata_count++; - metadata= av_realloc(metadata, sizeof(*metadata)*metadata_count); - metadata[metadata_count-1].key = av_strdup(arg); - metadata[metadata_count-1].value= av_strdup(mid); + av_metadata_set2(&metadata, arg, mid, 0); return 0; } @@ -2910,9 +2813,9 @@ static void opt_audio_sample_fmt(const char *arg) { if (strcmp(arg, "list")) - audio_sample_fmt = avcodec_get_sample_fmt(arg); + audio_sample_fmt = av_get_sample_fmt(arg); else { - list_fmts(avcodec_sample_fmt_string, SAMPLE_FMT_NB); + list_fmts(av_get_sample_fmt_string, SAMPLE_FMT_NB); ffmpeg_exit(0); } } @@ -2955,24 +2858,6 @@ opt_codec(&audio_stream_copy, &audio_codec_name, AVMEDIA_TYPE_AUDIO, arg); } -static void opt_audio_tag(const char *arg) -{ - char *tail; - audio_codec_tag= strtol(arg, &tail, 0); - - if(!tail || *tail) - audio_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24); -} - -static void opt_video_tag(const char *arg) -{ - char *tail; - video_codec_tag= strtol(arg, &tail, 0); - - if(!tail || *tail) - video_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24); -} - static void opt_video_codec(const char *arg) { opt_codec(&video_stream_copy, &video_codec_name, AVMEDIA_TYPE_VIDEO, arg); @@ -2983,13 +2868,22 @@ opt_codec(&subtitle_stream_copy, &subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, arg); } -static void opt_subtitle_tag(const char *arg) +static int opt_codec_tag(const char *opt, const char *arg) { char *tail; - subtitle_codec_tag= strtol(arg, &tail, 0); + uint32_t *codec_tag; + + codec_tag = !strcmp(opt, "atag") ? &audio_codec_tag : + !strcmp(opt, "vtag") ? &video_codec_tag : + !strcmp(opt, "stag") ? &subtitle_codec_tag : NULL; + if (!codec_tag) + return -1; + + *codec_tag = strtol(arg, &tail, 0); + if (!tail || *tail) + *codec_tag = AV_RL32(arg); - if(!tail || *tail) - subtitle_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24); + return 0; } static void opt_map(const char *arg) @@ -2997,7 +2891,8 @@ AVStreamMap *m; char *p; - m = &stream_maps[nb_stream_maps++]; + stream_maps = grow_array(stream_maps, sizeof(*stream_maps), &nb_stream_maps, nb_stream_maps + 1); + m = &stream_maps[nb_stream_maps-1]; m->file_index = strtol(arg, &p, 0); if (*p) @@ -3016,18 +2911,49 @@ } } +static void parse_meta_type(const char *arg, char *type, int *index, char **endptr) +{ + *endptr = arg; + if (*arg == ',') { + *type = *(++arg); + switch (*arg) { + case 'g': + break; + case 's': + case 'c': + case 'p': + *index = strtol(++arg, endptr, 0); + break; + default: + fprintf(stderr, "Invalid metadata type %c.\n", *arg); + ffmpeg_exit(1); + } + } else + *type = 'g'; +} + static void opt_map_meta_data(const char *arg) { - AVMetaDataMap *m; + AVMetaDataMap *m, *m1; char *p; - m = &meta_data_maps[nb_meta_data_maps++]; + meta_data_maps = grow_array(meta_data_maps, sizeof(*meta_data_maps), + &nb_meta_data_maps, nb_meta_data_maps + 1); - m->out_file = strtol(arg, &p, 0); + m = &meta_data_maps[nb_meta_data_maps - 1][0]; + m->file = strtol(arg, &p, 0); + parse_meta_type(p, &m->type, &m->index, &p); if (*p) p++; - m->in_file = strtol(p, &p, 0); + m1 = &meta_data_maps[nb_meta_data_maps - 1][1]; + m1->file = strtol(p, &p, 0); + parse_meta_type(p, &m1->type, &m1->index, &p); + + if (m->type == 's' || m1->type == 's') + metadata_streams_autocopy = 0; + if (m->type == 'c' || m1->type == 'c') + metadata_chapters_autocopy = 0; } static void opt_input_ts_scale(const char *arg) @@ -3044,6 +2970,7 @@ if(stream >= MAX_STREAMS) ffmpeg_exit(1); + input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); input_files_ts_scale[nb_input_files][stream]= scale; } @@ -3147,7 +3074,7 @@ ap->channel = video_channel; ap->standard = video_standard; - set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM); + set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL); ic->video_codec_id = find_codec_or_die(video_codec_name , AVMEDIA_TYPE_VIDEO , 0, @@ -3160,9 +3087,6 @@ avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance); ic->flags |= AVFMT_FLAG_NONBLOCK; - if(pgmyuv_compatibility_hack) - ic->video_codec_id= CODEC_ID_PGMYUV; - /* open the input file with generic libav function */ err = av_open_input_file(&ic, filename, file_iformat, 0, ap); if (err < 0) { @@ -3225,20 +3149,27 @@ AVStream *st = ic->streams[i]; AVCodecContext *dec = st->codec; avcodec_thread_init(dec, thread_count); + input_codecs = grow_array(input_codecs, sizeof(*input_codecs), &nb_input_codecs, nb_input_codecs + 1); switch (dec->codec_type) { case AVMEDIA_TYPE_AUDIO: - set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM); + input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(audio_codec_name); + set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM, input_codecs[nb_input_codecs-1]); //fprintf(stderr, "\nInput Audio channels: %d", dec->channels); channel_layout = dec->channel_layout; audio_channels = dec->channels; audio_sample_rate = dec->sample_rate; audio_sample_fmt = dec->sample_fmt; - input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(audio_codec_name); if(audio_disable) st->discard= AVDISCARD_ALL; + /* Note that av_find_stream_info can add more streams, and we + * currently have no chance of setting up lowres decoding + * early enough for them. */ + if (dec->lowres) + audio_sample_rate >>= dec->lowres; break; case AVMEDIA_TYPE_VIDEO: - set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM); + input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(video_codec_name); + set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM, input_codecs[nb_input_codecs-1]); frame_height = dec->height; frame_width = dec->width; if(ic->streams[i]->sample_aspect_ratio.num) @@ -3269,7 +3200,6 @@ frame_rate.num = rfps; frame_rate.den = rfps_base; - input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(video_codec_name); if(video_disable) st->discard= AVDISCARD_ALL; else if(video_discard) @@ -3278,13 +3208,12 @@ case AVMEDIA_TYPE_DATA: break; case AVMEDIA_TYPE_SUBTITLE: - input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(subtitle_codec_name); + input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(subtitle_codec_name); if(subtitle_disable) st->discard = AVDISCARD_ALL; break; case AVMEDIA_TYPE_ATTACHMENT: case AVMEDIA_TYPE_UNKNOWN: - nb_icodecs++; break; default: abort(); @@ -3343,19 +3272,36 @@ *has_subtitle_ptr = has_subtitle; } -static void new_video_stream(AVFormatContext *oc) +static void new_video_stream(AVFormatContext *oc, int file_idx) { AVStream *st; + AVOutputStream *ost; AVCodecContext *video_enc; enum CodecID codec_id; + AVCodec *codec= NULL; - st = av_new_stream(oc, streamid_map[oc->nb_streams]); + st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } - avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO); - bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; + ost = new_output_stream(oc, file_idx); + + output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); + if(!video_stream_copy){ + if (video_codec_name) { + codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1, + avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance); + codec = avcodec_find_encoder_by_name(video_codec_name); + output_codecs[nb_output_codecs-1] = codec; + } else { + codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); + codec = avcodec_find_encoder(codec_id); + } + } + + avcodec_get_context_defaults3(st->codec, codec); + ost->bitstream_filters = video_bitstream_filters; video_bitstream_filters= NULL; st->codec->thread_count= thread_count; @@ -3383,22 +3329,10 @@ } else { const char *p; int i; - AVCodec *codec; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; - if (video_codec_name) { - codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1, - video_enc->strict_std_compliance); - codec = avcodec_find_encoder_by_name(video_codec_name); - output_codecs[nb_ocodecs] = codec; - } else { - codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); - codec = avcodec_find_encoder(codec_id); - } - video_enc->codec_id = codec_id; - - set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM); + set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); if (codec && codec->supported_framerates && !force_fps) fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)]; @@ -3467,8 +3401,10 @@ video_enc->flags |= CODEC_FLAG_PASS2; } } + + if (forced_key_frames) + parse_forced_key_frames(forced_key_frames, ost, video_enc); } - nb_ocodecs++; if (video_language) { av_metadata_set2(&st->metadata, "language", video_language, 0); av_freep(&video_language); @@ -3477,24 +3413,42 @@ /* reset some key parameters */ video_disable = 0; av_freep(&video_codec_name); + av_freep(&forced_key_frames); video_stream_copy = 0; frame_pix_fmt = PIX_FMT_NONE; } -static void new_audio_stream(AVFormatContext *oc) +static void new_audio_stream(AVFormatContext *oc, int file_idx) { AVStream *st; + AVOutputStream *ost; + AVCodec *codec= NULL; AVCodecContext *audio_enc; enum CodecID codec_id; - st = av_new_stream(oc, streamid_map[oc->nb_streams]); + st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } - avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO); + ost = new_output_stream(oc, file_idx); + + output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); + if(!audio_stream_copy){ + if (audio_codec_name) { + codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1, + avcodec_opts[AVMEDIA_TYPE_AUDIO]->strict_std_compliance); + codec = avcodec_find_encoder_by_name(audio_codec_name); + output_codecs[nb_output_codecs-1] = codec; + } else { + codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO); + codec = avcodec_find_encoder(codec_id); + } + } - bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters; + avcodec_get_context_defaults3(st->codec, codec); + + ost->bitstream_filters = audio_bitstream_filters; audio_bitstream_filters= NULL; st->codec->thread_count= thread_count; @@ -3514,20 +3468,8 @@ audio_enc->channels = audio_channels; audio_enc->sample_rate = audio_sample_rate; } else { - AVCodec *codec; - - set_context_opts(audio_enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM); - - if (audio_codec_name) { - codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1, - audio_enc->strict_std_compliance); - codec = avcodec_find_encoder_by_name(audio_codec_name); - output_codecs[nb_ocodecs] = codec; - } else { - codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO); - codec = avcodec_find_encoder(codec_id); - } audio_enc->codec_id = codec_id; + set_context_opts(audio_enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); if (audio_qscale > QSCALE_NONE) { audio_enc->flags |= CODEC_FLAG_QSCALE; @@ -3542,7 +3484,6 @@ choose_sample_fmt(st, codec); choose_sample_rate(st, codec); } - nb_ocodecs++; audio_enc->time_base= (AVRational){1, audio_sample_rate}; if (audio_language) { av_metadata_set2(&st->metadata, "language", audio_language, 0); @@ -3555,22 +3496,31 @@ audio_stream_copy = 0; } -static void new_subtitle_stream(AVFormatContext *oc) +static void new_subtitle_stream(AVFormatContext *oc, int file_idx) { AVStream *st; + AVOutputStream *ost; + AVCodec *codec=NULL; AVCodecContext *subtitle_enc; - st = av_new_stream(oc, streamid_map[oc->nb_streams]); + st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } - avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE); + ost = new_output_stream(oc, file_idx); + subtitle_enc = st->codec; + output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); + if(!subtitle_stream_copy){ + subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, + avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance); + codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name); + } + avcodec_get_context_defaults3(st->codec, codec); - bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters; + ost->bitstream_filters = subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; - subtitle_enc = st->codec; subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE; if(subtitle_codec_tag) @@ -3579,12 +3529,8 @@ if (subtitle_stream_copy) { st->stream_copy = 1; } else { - set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM); - subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, - subtitle_enc->strict_std_compliance); - output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name); + set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); } - nb_ocodecs++; if (subtitle_language) { av_metadata_set2(&st->metadata, "language", subtitle_language, 0); @@ -3596,41 +3542,25 @@ subtitle_stream_copy = 0; } -static void opt_new_audio_stream(void) -{ - AVFormatContext *oc; - if (nb_output_files <= 0) { - fprintf(stderr, "At least one output file must be specified\n"); - ffmpeg_exit(1); - } - oc = output_files[nb_output_files - 1]; - new_audio_stream(oc); -} - -static void opt_new_video_stream(void) +static int opt_new_stream(const char *opt, const char *arg) { AVFormatContext *oc; + int file_idx = nb_output_files - 1; if (nb_output_files <= 0) { fprintf(stderr, "At least one output file must be specified\n"); ffmpeg_exit(1); } - oc = output_files[nb_output_files - 1]; - new_video_stream(oc); -} + oc = output_files[file_idx]; -static void opt_new_subtitle_stream(void) -{ - AVFormatContext *oc; - if (nb_output_files <= 0) { - fprintf(stderr, "At least one output file must be specified\n"); - ffmpeg_exit(1); - } - oc = output_files[nb_output_files - 1]; - new_subtitle_stream(oc); + if (!strcmp(opt, "newvideo" )) new_video_stream (oc, file_idx); + else if (!strcmp(opt, "newaudio" )) new_audio_stream (oc, file_idx); + else if (!strcmp(opt, "newsubtitle")) new_subtitle_stream(oc, file_idx); + else av_assert0(0); + return 0; } /* arg format is "output-stream-index:streamid-value". */ -static void opt_streamid(const char *opt, const char *arg) +static int opt_streamid(const char *opt, const char *arg) { int idx; char *p; @@ -3647,7 +3577,9 @@ } *p++ = '\0'; idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); + streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); + return 0; } static void opt_output_file(const char *filename) @@ -3657,6 +3589,7 @@ int input_has_video, input_has_audio, input_has_subtitle; AVFormatParameters params, *ap = ¶ms; AVOutputFormat *file_oformat; + AVMetadataTag *tag = NULL; if (!strcmp(filename, "-")) filename = "pipe:"; @@ -3714,35 +3647,19 @@ } /* manual disable */ - if (audio_disable) { - use_audio = 0; - } - if (video_disable) { - use_video = 0; - } - if (subtitle_disable) { - use_subtitle = 0; - } - - if (use_video) { - new_video_stream(oc); - } - - if (use_audio) { - new_audio_stream(oc); - } - - if (use_subtitle) { - new_subtitle_stream(oc); - } + if (audio_disable) use_audio = 0; + if (video_disable) use_video = 0; + if (subtitle_disable) use_subtitle = 0; + + if (use_video) new_video_stream(oc, nb_output_files); + if (use_audio) new_audio_stream(oc, nb_output_files); + if (use_subtitle) new_subtitle_stream(oc, nb_output_files); oc->timestamp = recording_timestamp; - for(; metadata_count>0; metadata_count--){ - av_metadata_set2(&oc->metadata, metadata[metadata_count-1].key, - metadata[metadata_count-1].value, 0); - } - av_metadata_conv(oc, oc->oformat->metadata_conv, NULL); + while ((tag = av_metadata_get(metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) + av_metadata_set2(&oc->metadata, tag->key, tag->value, 0); + av_metadata_free(&metadata); } output_files[nb_output_files++] = oc; @@ -3796,9 +3713,10 @@ oc->loop_output = loop_output; oc->flags |= AVFMT_FLAG_NONBLOCK; - set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM); + set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL); - memset(streamid_map, 0, sizeof(streamid_map)); + nb_streamid_map = 0; + av_freep(&forced_key_frames); } /* same option as mencoder */ @@ -3878,15 +3796,6 @@ parse_matrix_coeffs(intra_matrix, arg); } -/** - * Trivial log callback. - * Only suitable for show_help and similar since it lacks prefix handling. - */ -static void log_callback_help(void* ptr, int level, const char* fmt, va_list vl) -{ - vfprintf(stdout, fmt, vl); -} - static void show_usage(void) { printf("Hyper fast Audio and Video encoder\n"); @@ -3922,11 +3831,11 @@ OPT_GRAB, OPT_GRAB); printf("\n"); - av_opt_show(avcodec_opts[0], NULL); + av_opt_show2(avcodec_opts[0], NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); printf("\n"); - av_opt_show(avformat_opts, NULL); + av_opt_show2(avformat_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); printf("\n"); - av_opt_show(sws_opts, NULL); + av_opt_show2(sws_opts, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); } static void opt_target(const char *arg) @@ -4179,7 +4088,7 @@ { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" }, { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" }, { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file:stream[:syncfile:syncstream]" }, - { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "set meta data information of outfile from infile", "outfile:infile" }, + { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "set meta data information of outfile from infile", "outfile[,metadata]:infile[,metadata]" }, { "t", OPT_FUNC2 | HAS_ARG, {(void*)opt_recording_time}, "record or transcode \"duration\" seconds of audio/video", "duration" }, { "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the limit file size in bytes", "limit_size" }, // { "ss", OPT_FUNC2 | HAS_ARG, {(void*)opt_start_time}, "set the start time offset", "time_off" }, @@ -4220,10 +4129,10 @@ { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" }, { "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" }, { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" }, - { "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_top}, "Deprecated, please use the crop avfilter", "size" }, - { "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_bottom}, "Deprecated, please use the crop avfilter", "size" }, - { "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_left}, "Deprecated, please use the crop avfilter", "size" }, - { "cropright", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_right}, "Deprecated, please use the crop avfilter", "size" }, + { "croptop", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, + { "cropbottom", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, + { "cropleft", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, + { "cropright", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, { "padtop", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, { "padbottom", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, { "padleft", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, @@ -4252,12 +4161,13 @@ { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" }, { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" }, { "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" }, - { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" }, - { "newvideo", OPT_VIDEO, {(void*)opt_new_video_stream}, "add a new video stream to the current output stream" }, + { "vtag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_codec_tag}, "force video tag/fourcc", "fourcc/tag" }, + { "newvideo", OPT_VIDEO | OPT_FUNC2, {(void*)opt_new_stream}, "add a new video stream to the current output stream" }, { "vlang", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void *)&video_language}, "set the ISO 639 language code (3 letters) of the current video stream" , "code" }, { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" }, { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&force_fps}, "force the selected framerate, disable the best supported framerate selection" }, { "streamid", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" }, + { "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void *)&forced_key_frames}, "force key frames at specified timestamps", "timestamps" }, /* audio options */ { "ab", OPT_FUNC2 | HAS_ARG | OPT_AUDIO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" }, @@ -4267,18 +4177,18 @@ { "ac", HAS_ARG | OPT_FUNC2 | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" }, { "an", OPT_BOOL | OPT_AUDIO, {(void*)&audio_disable}, "disable audio" }, { "acodec", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" }, - { "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_tag}, "force audio tag/fourcc", "fourcc/tag" }, + { "atag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_codec_tag}, "force audio tag/fourcc", "fourcc/tag" }, { "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, // - { "newaudio", OPT_AUDIO, {(void*)opt_new_audio_stream}, "add a new audio stream to the current output stream" }, + { "newaudio", OPT_AUDIO | OPT_FUNC2, {(void*)opt_new_stream}, "add a new audio stream to the current output stream" }, { "alang", HAS_ARG | OPT_STRING | OPT_AUDIO, {(void *)&audio_language}, "set the ISO 639 language code (3 letters) of the current audio stream" , "code" }, { "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_sample_fmt}, "set sample format, 'list' as argument shows all the sample formats supported", "format" }, /* subtitle options */ { "sn", OPT_BOOL | OPT_SUBTITLE, {(void*)&subtitle_disable}, "disable subtitle" }, { "scodec", HAS_ARG | OPT_SUBTITLE, {(void*)opt_subtitle_codec}, "force subtitle codec ('copy' to copy stream)", "codec" }, - { "newsubtitle", OPT_SUBTITLE, {(void*)opt_new_subtitle_stream}, "add a new subtitle stream to the current output stream" }, + { "newsubtitle", OPT_SUBTITLE | OPT_FUNC2, {(void*)opt_new_stream}, "add a new subtitle stream to the current output stream" }, { "slang", HAS_ARG | OPT_STRING | OPT_SUBTITLE, {(void *)&subtitle_language}, "set the ISO 639 language code (3 letters) of the current subtitle stream" , "code" }, - { "stag", HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_subtitle_tag}, "force subtitle tag/fourcc", "fourcc/tag" }, + { "stag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_codec_tag}, "force subtitle tag/fourcc", "fourcc/tag" }, /* grab options */ { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" }, @@ -4304,9 +4214,10 @@ int main(int argc, char **argv) { - int i; int64_t ti; + av_log_set_flags(AV_LOG_SKIP_REPEATED); + avcodec_register_all(); #if CONFIG_AVDEVICE avdevice_register_all(); @@ -4321,11 +4232,7 @@ url_set_interrupt_cb(decode_interrupt_cb); #endif - for(i=0; i #include @@ -26,7 +28,9 @@ #include "libavutil/avstring.h" #include "libavutil/colorspace.h" #include "libavutil/pixdesc.h" +#include "libavcore/imgutils.h" #include "libavcore/parseutils.h" +#include "libavcore/samplefmt.h" #include "libavformat/avformat.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" @@ -204,10 +208,7 @@ char filename[1024]; int width, height, xleft, ytop; - int64_t faulty_pts; - int64_t faulty_dts; - int64_t last_dts_for_fault_detection; - int64_t last_pts_for_fault_detection; + PtsCorrectionContext pts_ctx; #if CONFIG_AVFILTER AVFilterContext *out_video_filter; ///pictq[is->pictq_rindex]; if (vp->bmp) { #if CONFIG_AVFILTER - if (vp->picref->pixel_aspect.num == 0) + if (vp->picref->video->pixel_aspect.num == 0) aspect_ratio = 0; else - aspect_ratio = av_q2d(vp->picref->pixel_aspect); + aspect_ratio = av_q2d(vp->picref->video->pixel_aspect); #else /* XXX: use variable in the frame */ @@ -1283,13 +1284,64 @@ if (is->audio_st && is->video_st) av_diff = get_audio_clock(is) - get_video_clock(is); printf("%7.2f A-V:%7.3f s:%3.1f aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r", - get_master_clock(is), av_diff, FFMAX(is->skip_frames-1, 0), aqsize / 1024, vqsize / 1024, sqsize, is->faulty_dts, is->faulty_pts); + get_master_clock(is), av_diff, FFMAX(is->skip_frames-1, 0), aqsize / 1024, vqsize / 1024, sqsize, is->pts_ctx.num_faulty_dts, is->pts_ctx.num_faulty_pts); fflush(stdout); last_time = cur_time; } } } +static void stream_close(VideoState *is) +{ + VideoPicture *vp; + int i; + /* XXX: use a special url_shutdown call to abort parse cleanly */ + is->abort_request = 1; + SDL_WaitThread(is->parse_tid, NULL); + SDL_WaitThread(is->refresh_tid, NULL); + + /* free all pictures */ + for(i=0;ipictq[i]; +#if CONFIG_AVFILTER + if (vp->picref) { + avfilter_unref_buffer(vp->picref); + vp->picref = NULL; + } +#endif + if (vp->bmp) { + SDL_FreeYUVOverlay(vp->bmp); + vp->bmp = NULL; + } + } + SDL_DestroyMutex(is->pictq_mutex); + SDL_DestroyCond(is->pictq_cond); + SDL_DestroyMutex(is->subpq_mutex); + SDL_DestroyCond(is->subpq_cond); +#if !CONFIG_AVFILTER + if (is->img_convert_ctx) + sws_freeContext(is->img_convert_ctx); +#endif + av_free(is); +} + +static void do_exit(void) +{ + if (cur_stream) { + stream_close(cur_stream); + cur_stream = NULL; + } + uninit_opts(); +#if CONFIG_AVFILTER + avfilter_uninit(); +#endif + if (show_status) + printf("\n"); + SDL_Quit(); + av_log(NULL, AV_LOG_QUIET, ""); + exit(0); +} + /* allocate a picture (needs to do that in main thread to avoid potential locking problems */ static void alloc_picture(void *opaque) @@ -1319,6 +1371,14 @@ vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height, SDL_YV12_OVERLAY, screen); + if (!vp->bmp || vp->bmp->pitches[0] < vp->width) { + /* SDL allocates a buffer smaller than requested if the video + * overlay hardware is unable to support the requested size. */ + fprintf(stderr, "Error: the video system does not support an image\n" + "size of %dx%d pixels. Try using -lowres or -vf \"scale=w:h\"\n" + "to reduce the image size.\n", vp->width, vp->height ); + do_exit(); + } SDL_LockMutex(is->pictq_mutex); vp->allocated = 1; @@ -1499,8 +1559,7 @@ is->video_current_pos= -1; SDL_UnlockMutex(is->pictq_mutex); - is->last_dts_for_fault_detection= - is->last_pts_for_fault_detection= INT64_MIN; + init_pts_correction(&is->pts_ctx); is->frame_last_pts= AV_NOPTS_VALUE; is->frame_last_delay = 0; is->frame_timer = (double)av_gettime() / 1000000.0; @@ -1517,25 +1576,18 @@ pkt); if (got_picture) { - if(pkt->dts != AV_NOPTS_VALUE){ - is->faulty_dts += pkt->dts <= is->last_dts_for_fault_detection; - is->last_dts_for_fault_detection= pkt->dts; - } - if(frame->reordered_opaque != AV_NOPTS_VALUE){ - is->faulty_pts += frame->reordered_opaque <= is->last_pts_for_fault_detection; - is->last_pts_for_fault_detection= frame->reordered_opaque; + if (decoder_reorder_pts == -1) { + *pts = guess_correct_pts(&is->pts_ctx, frame->reordered_opaque, pkt->dts); + } else if (decoder_reorder_pts) { + *pts = frame->reordered_opaque; + } else { + *pts = pkt->dts; } - } - if( ( decoder_reorder_pts==1 - || (decoder_reorder_pts && is->faulty_ptsfaulty_dts) - || pkt->dts == AV_NOPTS_VALUE) - && frame->reordered_opaque != AV_NOPTS_VALUE) - *pts= frame->reordered_opaque; - else if(pkt->dts != AV_NOPTS_VALUE) - *pts= pkt->dts; - else - *pts= 0; + if (*pts == AV_NOPTS_VALUE) { + *pts = 0; + } + } // if (len1 < 0) // break; @@ -1582,8 +1634,8 @@ if(!(ref = avfilter_get_video_buffer(ctx->outputs[0], perms, w, h))) return -1; - ref->w = codec->width; - ref->h = codec->height; + ref->video->w = codec->width; + ref->video->h = codec->height; for(i = 0; i < 4; i ++) { unsigned hshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_w : 0; unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_h : 0; @@ -1616,7 +1668,7 @@ return codec->get_buffer(codec, pic); } - if ((codec->width != ref->w) || (codec->height != ref->h) || + if ((codec->width != ref->video->w) || (codec->height != ref->video->h) || (codec->pix_fmt != ref->format)) { av_log(codec, AV_LOG_ERROR, "Picture properties changed.\n"); return -1; @@ -1670,14 +1722,15 @@ picref = avfilter_ref_buffer(priv->frame->opaque, ~0); } else { picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h); - av_picture_copy((AVPicture *)&picref->data, (AVPicture *)priv->frame, - picref->format, link->w, link->h); + av_image_copy(picref->data, picref->linesize, + priv->frame->data, priv->frame->linesize, + picref->format, link->w, link->h); } av_free_packet(&pkt); picref->pts = pts; picref->pos = pkt.pos; - picref->pixel_aspect = priv->is->video_st->codec->sample_aspect_ratio; + picref->video->pixel_aspect = priv->is->video_st->codec->sample_aspect_ratio; avfilter_start_frame(link, picref); avfilter_draw_slice(link, 0, link->h, 1); avfilter_end_frame(link); @@ -1703,6 +1756,7 @@ link->w = c->width; link->h = c->height; + link->time_base = priv->is->video_st->time_base; return 0; } @@ -1726,52 +1780,6 @@ { .name = NULL }}, }; -static void output_end_frame(AVFilterLink *link) -{ -} - -static int output_query_formats(AVFilterContext *ctx) -{ - enum PixelFormat pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE }; - - avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); - return 0; -} - -static int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame, - int64_t *pts, int64_t *pos) -{ - AVFilterBufferRef *pic; - - if(avfilter_request_frame(ctx->inputs[0])) - return -1; - if(!(pic = ctx->inputs[0]->cur_buf)) - return -1; - ctx->inputs[0]->cur_buf = NULL; - - frame->opaque = pic; - *pts = pic->pts; - *pos = pic->pos; - - memcpy(frame->data, pic->data, sizeof(frame->data)); - memcpy(frame->linesize, pic->linesize, sizeof(frame->linesize)); - - return 1; -} - -static AVFilter output_filter = -{ - .name = "ffplay_output", - - .query_formats = output_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .end_frame = output_end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; #endif /* CONFIG_AVFILTER */ static int video_thread(void *arg) @@ -1785,16 +1793,17 @@ #if CONFIG_AVFILTER int64_t pos; char sws_flags_str[128]; + FFSinkContext ffsink_ctx = { .pix_fmt = PIX_FMT_YUV420P }; AVFilterContext *filt_src = NULL, *filt_out = NULL; AVFilterGraph *graph = av_mallocz(sizeof(AVFilterGraph)); snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); graph->scale_sws_opts = av_strdup(sws_flags_str); - if(!(filt_src = avfilter_open(&input_filter, "src"))) goto the_end; - if(!(filt_out = avfilter_open(&output_filter, "out"))) goto the_end; + if (avfilter_open(&filt_src, &input_filter, "src") < 0) goto the_end; + if (avfilter_open(&filt_out, &ffsink , "out") < 0) goto the_end; if(avfilter_init_filter(filt_src, NULL, is)) goto the_end; - if(avfilter_init_filter(filt_out, NULL, frame)) goto the_end; + if(avfilter_init_filter(filt_out, NULL, &ffsink_ctx)) goto the_end; if(vfilters) { @@ -1820,9 +1829,8 @@ avfilter_graph_add_filter(graph, filt_src); avfilter_graph_add_filter(graph, filt_out); - if(avfilter_graph_check_validity(graph, NULL)) goto the_end; - if(avfilter_graph_config_formats(graph, NULL)) goto the_end; - if(avfilter_graph_config_links(graph, NULL)) goto the_end; + if (avfilter_graph_config(graph, NULL) < 0) + goto the_end; is->out_video_filter = filt_out; #endif @@ -1830,11 +1838,28 @@ for(;;) { #if !CONFIG_AVFILTER AVPacket pkt; +#else + AVFilterBufferRef *picref; + AVRational tb; #endif while (is->paused && !is->videoq.abort_request) SDL_Delay(10); #if CONFIG_AVFILTER - ret = get_filtered_video_frame(filt_out, frame, &pts_int, &pos); + ret = get_filtered_video_frame(filt_out, frame, &picref, &tb); + if (picref) { + pts_int = picref->pts; + pos = picref->pos; + frame->opaque = picref; + } + + if (av_cmp_q(tb, is->video_st->time_base)) { + int64_t pts1 = pts_int; + pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base); + av_log(NULL, AV_LOG_DEBUG, "video_thread(): " + "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n", + tb.num, tb.den, pts1, + is->video_st->time_base.num, is->video_st->time_base.den, pts_int); + } #else ret = get_video_frame(is, frame, &pts_int, &pkt); #endif @@ -2075,8 +2100,8 @@ dec->sample_fmt, 1, NULL, 0); if (!is->reformat_ctx) { fprintf(stderr, "Cannot convert %s sample format to %s sample format\n", - avcodec_get_sample_fmt_name(dec->sample_fmt), - avcodec_get_sample_fmt_name(SAMPLE_FMT_S16)); + av_get_sample_fmt_name(dec->sample_fmt), + av_get_sample_fmt_name(SAMPLE_FMT_S16)); break; } is->audio_src_fmt= dec->sample_fmt; @@ -2085,7 +2110,7 @@ if (is->reformat_ctx) { const void *ibuf[6]= {is->audio_buf1}; void *obuf[6]= {is->audio_buf2}; - int istride[6]= {av_get_bits_per_sample_format(dec->sample_fmt)/8}; + int istride[6]= {av_get_bits_per_sample_fmt(dec->sample_fmt)/8}; int ostride[6]= {2}; int len= data_size/istride[0]; if (av_audio_convert(is->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) { @@ -2224,7 +2249,7 @@ avctx->error_concealment= error_concealment; avcodec_thread_init(avctx, thread_count); - set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0); + set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0, codec); if (!codec || avcodec_open(avctx, codec) < 0) @@ -2402,7 +2427,7 @@ ap->time_base= (AVRational){1, 25}; ap->pix_fmt = frame_pix_fmt; - set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM); + set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL); err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap); if (err < 0) { @@ -2553,7 +2578,7 @@ SDL_Delay(10); continue; } - if(url_feof(ic->pb) || eof) { + if(eof) { if(is->video_stream >= 0){ av_init_packet(pkt); pkt->data=NULL; @@ -2574,7 +2599,7 @@ } ret = av_read_frame(ic, pkt); if (ret < 0) { - if (ret == AVERROR_EOF) + if (ret == AVERROR_EOF || url_feof(ic->pb)) eof=1; if (url_ferror(ic->pb)) break; @@ -2658,40 +2683,6 @@ return is; } -static void stream_close(VideoState *is) -{ - VideoPicture *vp; - int i; - /* XXX: use a special url_shutdown call to abort parse cleanly */ - is->abort_request = 1; - SDL_WaitThread(is->parse_tid, NULL); - SDL_WaitThread(is->refresh_tid, NULL); - - /* free all pictures */ - for(i=0;ipictq[i]; -#if CONFIG_AVFILTER - if (vp->picref) { - avfilter_unref_buffer(vp->picref); - vp->picref = NULL; - } -#endif - if (vp->bmp) { - SDL_FreeYUVOverlay(vp->bmp); - vp->bmp = NULL; - } - } - SDL_DestroyMutex(is->pictq_mutex); - SDL_DestroyCond(is->pictq_cond); - SDL_DestroyMutex(is->subpq_mutex); - SDL_DestroyCond(is->subpq_cond); -#if !CONFIG_AVFILTER - if (is->img_convert_ctx) - sws_freeContext(is->img_convert_ctx); -#endif - av_free(is); -} - static void stream_cycle_channel(VideoState *is, int codec_type) { AVFormatContext *ic = is->ic; @@ -2769,26 +2760,6 @@ step = 1; } -static void do_exit(void) -{ - int i; - if (cur_stream) { - stream_close(cur_stream); - cur_stream = NULL; - } - for (i = 0; i < AVMEDIA_TYPE_NB; i++) - av_free(avcodec_opts[i]); - av_free(avformat_opts); - av_free(sws_opts); -#if CONFIG_AVFILTER - avfilter_uninit(); -#endif - if (show_status) - printf("\n"); - SDL_Quit(); - exit(0); -} - static void toggle_audio_display(void) { if (cur_stream) { @@ -3091,11 +3062,23 @@ static void show_help(void) { + av_log_set_callback(log_callback_help); show_usage(); show_help_options(options, "Main options:\n", OPT_EXPERT, 0); show_help_options(options, "\nAdvanced options:\n", OPT_EXPERT, OPT_EXPERT); + printf("\n"); + av_opt_show2(avcodec_opts[0], NULL, + AV_OPT_FLAG_DECODING_PARAM, 0); + printf("\n"); + av_opt_show2(avformat_opts, NULL, + AV_OPT_FLAG_DECODING_PARAM, 0); +#if !CONFIG_AVFILTER + printf("\n"); + av_opt_show2(sws_opts, NULL, + AV_OPT_FLAG_ENCODING_PARAM, 0); +#endif printf("\nWhile playing:\n" "q, ESC quit\n" "f toggle full screen\n" @@ -3126,7 +3109,9 @@ /* Called from the main */ int main(int argc, char **argv) { - int flags, i; + int flags; + + av_log_set_flags(AV_LOG_SKIP_REPEATED); /* register all codecs, demux and protocols */ avcodec_register_all(); @@ -3138,13 +3123,7 @@ #endif av_register_all(); - for(i=0; ir_frame_rate.num, stream->r_frame_rate.den); printf("avg_frame_rate=%d/%d\n", stream->avg_frame_rate.num, stream->avg_frame_rate.den); printf("time_base=%d/%d\n", stream->time_base.num, stream->time_base.den); - if (stream->language[0]) - printf("language=%s\n", stream->language); printf("start_time=%s\n", time_value_string(val_str, sizeof(val_str), stream->start_time, &stream->time_base)); printf("duration=%s\n", time_value_string(val_str, sizeof(val_str), stream->duration, @@ -255,8 +252,6 @@ printf("bit_rate=%s\n", value_string(val_str, sizeof(val_str), fmt_ctx->bit_rate, unit_bit_per_second_str)); - if (convert_tags) - av_metadata_conv(fmt_ctx, NULL, fmt_ctx->iformat->metadata_conv); while ((tag = av_metadata_get(fmt_ctx->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) printf("TAG:%s=%s\n", tag->key, tag->value); @@ -269,6 +264,7 @@ AVFormatContext *fmt_ctx; fmt_ctx = avformat_alloc_context(); + set_context_opts(fmt_ctx, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL); if ((err = av_open_input_file(&fmt_ctx, filename, iformat, 0, NULL)) < 0) { print_error(filename, err); @@ -353,9 +349,12 @@ static void show_help(void) { + av_log_set_callback(log_callback_help); show_usage(); show_help_options(options, "Main options:\n", 0, 0); printf("\n"); + av_opt_show2(avformat_opts, NULL, + AV_OPT_FLAG_DECODING_PARAM, 0); } static void opt_pretty(void) @@ -368,7 +367,6 @@ static const OptionDef options[] = { #include "cmdutils_common_opts.h" - { "convert_tags", OPT_BOOL, {(void*)&convert_tags}, "convert tag names to the FFmpeg generic tag names" }, { "f", HAS_ARG, {(void*)opt_format}, "force format", "format" }, { "unit", OPT_BOOL, {(void*)&show_value_unit}, "show unit of the displayed values" }, { "prefix", OPT_BOOL, {(void*)&use_value_prefix}, "use SI prefixes for the displayed values" }, @@ -381,16 +379,21 @@ { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, + { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, { NULL, }, }; int main(int argc, char **argv) { + int ret; + av_register_all(); #if CONFIG_AVDEVICE avdevice_register_all(); #endif + avformat_opts = avformat_alloc_context(); + show_banner(); parse_options(argc, argv, options, opt_input_file); @@ -401,5 +404,9 @@ exit(1); } - return probe_file(input_filename); + ret = probe_file(input_filename); + + av_free(avformat_opts); + + return ret; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/ffserver.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/ffserver.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/ffserver.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/ffserver.c 2010-11-06 17:21:26.000000000 +0000 @@ -92,6 +92,10 @@ "RTSP_SEND_PACKET", }; +#if !FF_API_MAX_STREAMS +#define MAX_STREAMS 20 +#endif + #define IOBUFFER_INIT_SIZE 8192 /* timeouts are in ms */ @@ -2930,7 +2934,7 @@ struct in_addr my_ip) { AVFormatContext *avc; - AVStream avs[MAX_STREAMS]; + AVStream *avs = NULL; int i; avc = avformat_alloc_context(); @@ -2948,14 +2952,29 @@ snprintf(avc->filename, 1024, "rtp://0.0.0.0"); } +#if !FF_API_MAX_STREAMS + if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) || + !(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams)))) + goto sdp_done; +#endif + if (avc->nb_streams >= INT_MAX/sizeof(*avs) || + !(avs = av_malloc(avc->nb_streams * sizeof(*avs)))) + goto sdp_done; + for(i = 0; i < stream->nb_streams; i++) { avc->streams[i] = &avs[i]; avc->streams[i]->codec = stream->streams[i]->codec; } *pbuffer = av_mallocz(2048); avf_sdp_create(&avc, 1, *pbuffer, 2048); + + sdp_done: +#if !FF_API_MAX_STREAMS + av_free(avc->streams); +#endif av_metadata_free(&avc->metadata); av_free(avc); + av_free(avs); return strlen(*pbuffer); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/a64colors.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/a64colors.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/a64colors.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/a64colors.h 2010-11-06 17:21:26.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * a64 video encoder - c64 colors in rgb (Pepto) + * Copyright (c) 2009 Tobias Bindhammer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * a64 video encoder - c64 colors in rgb + */ + +#ifndef AVCODEC_A64COLORS_H +#define AVCODEC_A64COLORS_H + +#include + +/* c64 palette in RGB */ +static const uint8_t a64_palette[16][3] = { + {0x00, 0x00, 0x00}, + {0xff, 0xff, 0xff}, + {0x68, 0x37, 0x2b}, + {0x70, 0xa4, 0xb2}, + {0x6f, 0x3d, 0x86}, + {0x58, 0x8d, 0x43}, + {0x35, 0x28, 0x79}, + {0xb8, 0xc7, 0x6f}, + {0x6f, 0x4f, 0x25}, + {0x43, 0x39, 0x00}, + {0x9a, 0x67, 0x59}, + {0x44, 0x44, 0x44}, + {0x6c, 0x6c, 0x6c}, + {0x9a, 0xd2, 0x84}, + {0x6c, 0x5e, 0xb5}, + {0x95, 0x95, 0x95}, +}; + +#endif /* AVCODEC_A64COLORS_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/a64enc.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/a64enc.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/a64enc.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/a64enc.h 2010-11-06 17:21:26.000000000 +0000 @@ -0,0 +1,55 @@ +/* + * a64 video encoder - basic headers + * Copyright (c) 2009 Tobias Bindhammer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * a64 video encoder - basic headers + */ + +#ifndef AVCODEC_A64ENC_H +#define AVCODEC_A64ENC_H + +#include "libavutil/lfg.h" +#include "avcodec.h" + +#define C64XRES 320 +#define C64YRES 200 + +typedef struct A64Context { + /* general variables */ + AVFrame picture; + + /* variables for multicolor modes */ + AVLFG randctx; + int mc_lifetime; + int mc_use_5col; + int mc_frame_counter; + int *mc_meta_charset; + int *mc_charmap; + int *mc_best_cb; + int mc_luma_vals[5]; + uint8_t *mc_charset; + uint8_t *mc_colram; + uint8_t *mc_palette; + int mc_pal_size; +} A64Context; + +#endif /* AVCODEC_A64ENC_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/a64multienc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/a64multienc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/a64multienc.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/a64multienc.c 2010-11-06 17:21:26.000000000 +0000 @@ -0,0 +1,389 @@ +/* + * a64 video encoder - multicolor modes + * Copyright (c) 2009 Tobias Bindhammer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * a64 video encoder - multicolor modes + */ + +#include "a64enc.h" +#include "a64colors.h" +#include "a64tables.h" +#include "elbg.h" +#include "libavutil/intreadwrite.h" + +#define DITHERSTEPS 8 +#define CHARSET_CHARS 256 +#define INTERLACED 1 +#define CROP_SCREENS 1 + +/* gray gradient */ +static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1}; + +/* other possible gradients - to be tested */ +//static const int mc_colors[5]={0x0,0x8,0xa,0xf,0x7}; +//static const int mc_colors[5]={0x0,0x9,0x8,0xa,0x3}; + +static void to_meta_with_crop(AVCodecContext *avctx, AVFrame *p, int *dest) +{ + int blockx, blocky, x, y; + int luma = 0; + int height = FFMIN(avctx->height, C64YRES); + int width = FFMIN(avctx->width , C64XRES); + uint8_t *src = p->data[0]; + + for (blocky = 0; blocky < C64YRES; blocky += 8) { + for (blockx = 0; blockx < C64XRES; blockx += 8) { + for (y = blocky; y < blocky + 8 && y < C64YRES; y++) { + for (x = blockx; x < blockx + 8 && x < C64XRES; x += 2) { + if(x < width && y < height) { + /* build average over 2 pixels */ + luma = (src[(x + 0 + y * p->linesize[0])] + + src[(x + 1 + y * p->linesize[0])]) / 2; + /* write blocks as linear data now so they are suitable for elbg */ + dest[0] = luma; + } + dest++; + } + } + } + } +} + +static void render_charset(AVCodecContext *avctx, uint8_t *charset, + uint8_t *colrammap) +{ + A64Context *c = avctx->priv_data; + uint8_t row1, row2; + int charpos, x, y; + int a, b; + uint8_t pix; + int lowdiff, highdiff; + int *best_cb = c->mc_best_cb; + static uint8_t index1[256]; + static uint8_t index2[256]; + static uint8_t dither[256]; + int i; + int distance; + + /* generate lookup-tables for dither and index before looping */ + i = 0; + for (a=0; a < 256; a++) { + if(i < c->mc_pal_size -1 && a == c->mc_luma_vals[i + 1]) { + distance = c->mc_luma_vals[i + 1] - c->mc_luma_vals[i]; + for(b = 0; b <= distance; b++) { + dither[c->mc_luma_vals[i] + b] = b * (DITHERSTEPS - 1) / distance; + } + i++; + } + if(i >= c->mc_pal_size - 1) dither[a] = 0; + index1[a] = i; + index2[a] = FFMIN(i + 1, c->mc_pal_size - 1); + } + + /* and render charset */ + for (charpos = 0; charpos < CHARSET_CHARS; charpos++) { + lowdiff = 0; + highdiff = 0; + for (y = 0; y < 8; y++) { + row1 = 0; row2 = 0; + for (x = 0; x < 4; x++) { + pix = best_cb[y * 4 + x]; + + /* accumulate error for brightest/darkest color */ + if (index1[pix] >= 3) + highdiff += pix - c->mc_luma_vals[3]; + if (index1[pix] < 1) + lowdiff += c->mc_luma_vals[1] - pix; + + row1 <<= 2; + + if (INTERLACED) { + row2 <<= 2; + if (interlaced_dither_patterns[dither[pix]][(y & 3) * 2 + 0][x & 3]) + row1 |= 3-(index2[pix] & 3); + else + row1 |= 3-(index1[pix] & 3); + + if (interlaced_dither_patterns[dither[pix]][(y & 3) * 2 + 1][x & 3]) + row2 |= 3-(index2[pix] & 3); + else + row2 |= 3-(index1[pix] & 3); + } + else { + if (multi_dither_patterns[dither[pix]][(y & 3)][x & 3]) + row1 |= 3-(index2[pix] & 3); + else + row1 |= 3-(index1[pix] & 3); + } + } + charset[y+0x000] = row1; + if (INTERLACED) charset[y+0x800] = row2; + } + /* do we need to adjust pixels? */ + if (highdiff > 0 && lowdiff > 0 && c->mc_use_5col) { + if (lowdiff > highdiff) { + for (x = 0; x < 32; x++) + best_cb[x] = FFMIN(c->mc_luma_vals[3], best_cb[x]); + } else { + for (x = 0; x < 32; x++) + best_cb[x] = FFMAX(c->mc_luma_vals[1], best_cb[x]); + } + charpos--; /* redo now adjusted char */ + /* no adjustment needed, all fine */ + } else { + /* advance pointers */ + best_cb += 32; + charset += 8; + + /* remember colorram value */ + colrammap[charpos] = (highdiff > 0); + } + } +} + +static av_cold int a64multi_close_encoder(AVCodecContext *avctx) +{ + A64Context *c = avctx->priv_data; + av_free(c->mc_meta_charset); + av_free(c->mc_best_cb); + av_free(c->mc_charset); + av_free(c->mc_charmap); + av_free(c->mc_colram); + return 0; +} + +static av_cold int a64multi_init_encoder(AVCodecContext *avctx) +{ + A64Context *c = avctx->priv_data; + int a; + av_lfg_init(&c->randctx, 1); + + if (avctx->global_quality < 1) { + c->mc_lifetime = 4; + } else { + c->mc_lifetime = avctx->global_quality /= FF_QP2LAMBDA; + } + + av_log(avctx, AV_LOG_INFO, "charset lifetime set to %d frame(s)\n", c->mc_lifetime); + + c->mc_frame_counter = 0; + c->mc_use_5col = avctx->codec->id == CODEC_ID_A64_MULTI5; + c->mc_pal_size = 4 + c->mc_use_5col; + + /* precalc luma values for later use */ + for (a = 0; a < c->mc_pal_size; a++) { + c->mc_luma_vals[a]=a64_palette[mc_colors[a]][0] * 0.30 + + a64_palette[mc_colors[a]][1] * 0.59 + + a64_palette[mc_colors[a]][2] * 0.11; + } + + if (!(c->mc_meta_charset = av_malloc(32000 * c->mc_lifetime * sizeof(int))) || + !(c->mc_best_cb = av_malloc(CHARSET_CHARS * 32 * sizeof(int))) || + !(c->mc_charmap = av_mallocz(1000 * c->mc_lifetime * sizeof(int))) || + !(c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t))) || + !(c->mc_charset = av_malloc(0x800 * (INTERLACED+1) * sizeof(uint8_t)))) { + av_log(avctx, AV_LOG_ERROR, "Failed to allocate buffer memory.\n"); + return AVERROR(ENOMEM); + } + + /* set up extradata */ + if (!(avctx->extradata = av_mallocz(8 * 4 + FF_INPUT_BUFFER_PADDING_SIZE))) { + av_log(avctx, AV_LOG_ERROR, "Failed to allocate memory for extradata.\n"); + return AVERROR(ENOMEM); + } + avctx->extradata_size = 8 * 4; + AV_WB32(avctx->extradata, c->mc_lifetime); + AV_WB32(avctx->extradata + 16, INTERLACED); + + avcodec_get_frame_defaults(&c->picture); + avctx->coded_frame = &c->picture; + avctx->coded_frame->pict_type = FF_I_TYPE; + avctx->coded_frame->key_frame = 1; + if (!avctx->codec_tag) + avctx->codec_tag = AV_RL32("a64m"); + + return 0; +} + +static void a64_compress_colram(unsigned char *buf, int *charmap, uint8_t *colram) +{ + int a; + uint8_t temp; + /* only needs to be done in 5col mode */ + /* XXX could be squeezed to 0x80 bytes */ + for (a = 0; a < 256; a++) { + temp = colram[charmap[a + 0x000]] << 0; + temp |= colram[charmap[a + 0x100]] << 1; + temp |= colram[charmap[a + 0x200]] << 2; + if (a < 0xe8) temp |= colram[charmap[a + 0x300]] << 3; + buf[a] = temp << 2; + } +} + +static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf, + int buf_size, void *data) +{ + A64Context *c = avctx->priv_data; + AVFrame *pict = data; + AVFrame *const p = (AVFrame *) & c->picture; + + int frame; + int x, y; + int b_height; + int b_width; + + int req_size; + int num_frames = c->mc_lifetime; + + int *charmap = c->mc_charmap; + uint8_t *colram = c->mc_colram; + uint8_t *charset = c->mc_charset; + int *meta = c->mc_meta_charset; + int *best_cb = c->mc_best_cb; + + int charset_size = 0x800 * (INTERLACED + 1); + int colram_size = 0x100 * c->mc_use_5col; + int screen_size; + + if(CROP_SCREENS) { + b_height = FFMIN(avctx->height,C64YRES) >> 3; + b_width = FFMIN(avctx->width ,C64XRES) >> 3; + screen_size = b_width * b_height; + } else { + b_height = C64YRES >> 3; + b_width = C64XRES >> 3; + screen_size = 0x400; + } + + /* no data, means end encoding asap */ + if (!data) { + /* all done, end encoding */ + if (!c->mc_lifetime) return 0; + /* no more frames in queue, prepare to flush remaining frames */ + if (!c->mc_frame_counter) { + num_frames = c->mc_lifetime; + c->mc_lifetime = 0; + } + /* still frames in queue so limit lifetime to remaining frames */ + else c->mc_lifetime = c->mc_frame_counter; + /* still new data available */ + } else { + /* fill up mc_meta_charset with data until lifetime exceeds */ + if (c->mc_frame_counter < c->mc_lifetime) { + *p = *pict; + p->pict_type = FF_I_TYPE; + p->key_frame = 1; + to_meta_with_crop(avctx, p, meta + 32000 * c->mc_frame_counter); + c->mc_frame_counter++; + /* lifetime is not reached so wait for next frame first */ + return 0; + } + } + + /* lifetime reached so now convert X frames at once */ + if (c->mc_frame_counter == c->mc_lifetime) { + req_size = 0; + /* any frames to encode? */ + if (c->mc_lifetime) { + /* calc optimal new charset + charmaps */ + ff_init_elbg(meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx); + ff_do_elbg (meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx); + + /* create colorram map and a c64 readable charset */ + render_charset(avctx, charset, colram); + + /* copy charset to buf */ + memcpy(buf,charset, charset_size); + + /* advance pointers */ + buf += charset_size; + charset += charset_size; + req_size += charset_size; + } + /* no charset so clean buf */ + else memset(buf, 0, charset_size); + + /* write x frames to buf */ + for (frame = 0; frame < c->mc_lifetime; frame++) { + /* copy charmap to buf. buf is uchar*, charmap is int*, so no memcpy here, sorry */ + for (y = 0; y < b_height; y++) { + for (x = 0; x < b_width; x++) { + buf[y * b_width + x] = charmap[y * b_width + x]; + } + } + /* advance pointers */ + buf += screen_size; + req_size += screen_size; + + /* compress and copy colram to buf */ + if (c->mc_use_5col) { + a64_compress_colram(buf, charmap, colram); + /* advance pointers */ + buf += colram_size; + req_size += colram_size; + } + + /* advance to next charmap */ + charmap += 1000; + } + + AV_WB32(avctx->extradata + 4, c->mc_frame_counter); + AV_WB32(avctx->extradata + 8, charset_size); + AV_WB32(avctx->extradata + 12, screen_size + colram_size); + + /* reset counter */ + c->mc_frame_counter = 0; + + if (req_size > buf_size) { + av_log(avctx, AV_LOG_ERROR, "buf size too small (need %d, got %d)\n", req_size, buf_size); + return -1; + } + return req_size; + } + return 0; +} + +AVCodec a64multi_encoder = { + .name = "a64multi", + .type = AVMEDIA_TYPE_VIDEO, + .id = CODEC_ID_A64_MULTI, + .priv_data_size = sizeof(A64Context), + .init = a64multi_init_encoder, + .encode = a64multi_encode_frame, + .close = a64multi_close_encoder, + .pix_fmts = (enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE}, + .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"), + .capabilities = CODEC_CAP_DELAY, +}; + +AVCodec a64multi5_encoder = { + .name = "a64multi5", + .type = AVMEDIA_TYPE_VIDEO, + .id = CODEC_ID_A64_MULTI5, + .priv_data_size = sizeof(A64Context), + .init = a64multi_init_encoder, + .encode = a64multi_encode_frame, + .close = a64multi_close_encoder, + .pix_fmts = (enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE}, + .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"), + .capabilities = CODEC_CAP_DELAY, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/a64tables.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/a64tables.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/a64tables.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/a64tables.h 2010-11-06 17:21:26.000000000 +0000 @@ -0,0 +1,150 @@ +/* + * a64 video encoder - tables used by a64 encoders + * Copyright (c) 2009 Tobias Bindhammer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * a64 video encoder - tables used by a64 encoders + */ + +#ifndef AVCODEC_A64TABLES_H +#define AVCODEC_A64TABLES_H + +#include + +/** + * dither patterns used vor rendering the multicolor charset + */ + +static const uint8_t multi_dither_patterns[9][4][4] = { + { + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0} + }, + { + {1, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 1, 0}, + {0, 0, 0, 0} + }, + { + {1, 0, 0, 0}, + {0, 0, 1, 0}, + {0, 1, 0, 0}, + {0, 0, 0, 1} + }, + { + {1, 0, 0, 0}, + {0, 1, 0, 1}, + {0, 0, 1, 0}, + {0, 1, 0, 1} + }, + { + {1, 0, 1, 0}, + {0, 1, 0, 1}, + {1, 0, 1, 0}, + {0, 1, 0, 1} + }, + { + {1, 1, 1, 0}, + {0, 1, 0, 1}, + {1, 0, 1, 1}, + {0, 1, 0, 1} + }, + { + {0, 1, 1, 1}, + {1, 1, 0, 1}, + {1, 0, 1, 1}, + {1, 1, 1, 0} + }, + { + {0, 1, 1, 1}, + {1, 1, 1, 1}, + {1, 1, 0, 1}, + {1, 1, 1, 1} + }, + { + {1, 1, 1, 1}, + {1, 1, 1, 1}, + {1, 1, 1, 1}, + {1, 1, 1, 1} + }, +}; + +static const uint8_t interlaced_dither_patterns[9][8][4] = { + { + {0, 0, 0, 0}, {0, 0, 0, 0}, + {0, 0, 0, 0}, {0, 0, 0, 0}, + {0, 0, 0, 0}, {0, 0, 0, 0}, + {0, 0, 0, 0}, {0, 0, 0, 0}, + }, + { + {1, 0, 1, 0}, {0, 0, 0, 0}, + {0, 0, 0, 0}, {0, 0, 0, 0}, + {1, 0, 1, 0}, {0, 0, 0, 0}, + {0, 0, 0, 0}, {0, 0, 0, 0}, + }, + { + {1, 0, 1, 0}, {0, 0, 0, 0}, + {0, 0, 0, 0}, {0, 1, 0, 1}, + {1, 0, 1, 0}, {0, 0, 0, 0}, + {0, 0, 0, 0}, {0, 1, 0, 1}, + }, + { + {1, 0, 1, 0}, {0, 1, 0, 1}, + {0, 1, 0, 1}, {0, 0, 0, 0}, + {1, 0, 1, 0}, {0, 1, 0, 1}, + {0, 1, 0, 1}, {0, 0, 0, 0}, + }, + { + {1, 0, 1, 0}, {0, 1, 0, 1}, + {0, 1, 0, 1}, {1, 0, 1, 0}, + {1, 0, 1, 0}, {0, 1, 0, 1}, + {0, 1, 0, 1}, {1, 0, 1, 0}, + }, + { + {1, 0, 1, 0}, {0, 1, 0, 1}, + {1, 1, 1, 1}, {1, 0, 1, 0}, + {1, 0, 1, 0}, {0, 1, 0, 1}, + {1, 1, 1, 1}, {1, 0, 1, 0}, + }, + { + {1, 0, 1, 0}, {1, 1, 1, 1}, + {1, 1, 1, 1}, {0, 1, 0, 1}, + {1, 0, 1, 0}, {1, 1, 1, 1}, + {1, 1, 1, 1}, {0, 1, 0, 1}, + }, + { + {1, 1, 1, 1}, {1, 1, 1, 1}, + {1, 1, 1, 1}, {0, 1, 0, 1}, + {1, 1, 1, 1}, {1, 1, 1, 1}, + {1, 1, 1, 1}, {0, 1, 0, 1}, + }, + { + {1, 1, 1, 1}, {1, 1, 1, 1}, + {1, 1, 1, 1}, {1, 1, 1, 1}, + {1, 1, 1, 1}, {1, 1, 1, 1}, + {1, 1, 1, 1}, {1, 1, 1, 1}, + } +}; + +#endif /* AVCODEC_A64TABLES_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aacdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aacdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aacdec.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aacdec.c 2010-11-06 17:21:26.000000000 +0000 @@ -3,6 +3,10 @@ * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) * + * AAC LATM decoder + * Copyright (c) 2008-2010 Paul Kendall + * Copyright (c) 2010 Janne Grunau + * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or @@ -113,28 +117,11 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) { - /* Some buggy encoders appear to set all elem_ids to zero and rely on - channels always occurring in the same order. This is expressly forbidden - by the spec but we will try to work around it. - */ - int err_printed = 0; - while (ac->tags_seen_this_frame[type][elem_id] && elem_id < MAX_ELEM_ID) { - if (ac->output_configured < OC_LOCKED && !err_printed) { - av_log(ac->avctx, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n"); - err_printed = 1; - } - elem_id++; - } - if (elem_id == MAX_ELEM_ID) - return NULL; - ac->tags_seen_this_frame[type][elem_id] = 1; - - if (ac->tag_che_map[type][elem_id]) { + // For PCE based channel configurations map the channels solely based on tags. + if (!ac->m4ac.chan_config) { return ac->tag_che_map[type][elem_id]; } - if (ac->tags_mapped >= tags_per_config[ac->m4ac.chan_config]) { - return NULL; - } + // For indexed channel configurations map the channels solely based on position. switch (ac->m4ac.chan_config) { case 7: if (ac->tags_mapped == 3 && type == TYPE_CPE) { @@ -242,7 +229,6 @@ } memset(ac->tag_che_map, 0, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0])); - ac->tags_mapped = 0; avctx->channel_layout = aac_channel_layout[channel_config - 1]; } else { @@ -263,7 +249,6 @@ } memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0])); - ac->tags_mapped = 4 * MAX_ELEM_ID; avctx->channel_layout = 0; } @@ -300,7 +285,8 @@ * * @return Returns error status. 0 - OK, !0 - error */ -static int decode_pce(AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], +static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac, + enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], GetBitContext *gb) { int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc, sampling_index; @@ -309,8 +295,8 @@ skip_bits(gb, 2); // object_type sampling_index = get_bits(gb, 4); - if (ac->m4ac.sampling_index != sampling_index) - av_log(ac->avctx, AV_LOG_WARNING, "Sample rate index in program config element does not match the sample rate index configured by the container.\n"); + if (m4ac->sampling_index != sampling_index) + av_log(avctx, AV_LOG_WARNING, "Sample rate index in program config element does not match the sample rate index configured by the container.\n"); num_front = get_bits(gb, 4); num_side = get_bits(gb, 4); @@ -341,7 +327,7 @@ /* comment field, first byte is length */ comment_len = get_bits(gb, 8) * 8; if (get_bits_left(gb) < comment_len) { - av_log(ac->avctx, AV_LOG_ERROR, overread_err); + av_log(avctx, AV_LOG_ERROR, overread_err); return -1; } skip_bits_long(gb, comment_len); @@ -356,12 +342,12 @@ * * @return Returns error status. 0 - OK, !0 - error */ -static av_cold int set_default_channel_config(AACContext *ac, +static av_cold int set_default_channel_config(AVCodecContext *avctx, enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], int channel_config) { if (channel_config < 1 || channel_config > 7) { - av_log(ac->avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n", + av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n", channel_config); return -1; } @@ -397,16 +383,21 @@ /** * Decode GA "General Audio" specific configuration; reference: table 4.1. * + * @param ac pointer to AACContext, may be null + * @param avctx pointer to AVCCodecContext, used for logging + * * @return Returns error status. 0 - OK, !0 - error */ -static int decode_ga_specific_config(AACContext *ac, GetBitContext *gb, +static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx, + GetBitContext *gb, + MPEG4AudioConfig *m4ac, int channel_config) { enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; int extension_flag, ret; if (get_bits1(gb)) { // frameLengthFlag - av_log_missing_feature(ac->avctx, "960/120 MDCT window is", 1); + av_log_missing_feature(avctx, "960/120 MDCT window is", 1); return -1; } @@ -414,24 +405,24 @@ skip_bits(gb, 14); // coreCoderDelay extension_flag = get_bits1(gb); - if (ac->m4ac.object_type == AOT_AAC_SCALABLE || - ac->m4ac.object_type == AOT_ER_AAC_SCALABLE) + if (m4ac->object_type == AOT_AAC_SCALABLE || + m4ac->object_type == AOT_ER_AAC_SCALABLE) skip_bits(gb, 3); // layerNr memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); if (channel_config == 0) { skip_bits(gb, 4); // element_instance_tag - if ((ret = decode_pce(ac, new_che_pos, gb))) + if ((ret = decode_pce(avctx, m4ac, new_che_pos, gb))) return ret; } else { - if ((ret = set_default_channel_config(ac, new_che_pos, channel_config))) + if ((ret = set_default_channel_config(avctx, new_che_pos, channel_config))) return ret; } - if ((ret = output_configure(ac, ac->che_pos, new_che_pos, channel_config, OC_GLOBAL_HDR))) + if (ac && (ret = output_configure(ac, ac->che_pos, new_che_pos, channel_config, OC_GLOBAL_HDR))) return ret; if (extension_flag) { - switch (ac->m4ac.object_type) { + switch (m4ac->object_type) { case AOT_ER_BSAC: skip_bits(gb, 5); // numOfSubFrame skip_bits(gb, 11); // layer_length @@ -454,42 +445,48 @@ /** * Decode audio specific configuration; reference: table 1.13. * + * @param ac pointer to AACContext, may be null + * @param avctx pointer to AVCCodecContext, used for logging + * @param m4ac pointer to MPEG4AudioConfig, used for parsing * @param data pointer to AVCodecContext extradata * @param data_size size of AVCCodecContext extradata * - * @return Returns error status. 0 - OK, !0 - error + * @return Returns error status or number of consumed bits. <0 - error */ -static int decode_audio_specific_config(AACContext *ac, void *data, - int data_size) +static int decode_audio_specific_config(AACContext *ac, + AVCodecContext *avctx, + MPEG4AudioConfig *m4ac, + const uint8_t *data, int data_size) { GetBitContext gb; int i; init_get_bits(&gb, data, data_size * 8); - if ((i = ff_mpeg4audio_get_config(&ac->m4ac, data, data_size)) < 0) + if ((i = ff_mpeg4audio_get_config(m4ac, data, data_size)) < 0) return -1; - if (ac->m4ac.sampling_index > 12) { - av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); + if (m4ac->sampling_index > 12) { + av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index); return -1; } - if (ac->m4ac.sbr == 1 && ac->m4ac.ps == -1) - ac->m4ac.ps = 1; + if (m4ac->sbr == 1 && m4ac->ps == -1) + m4ac->ps = 1; skip_bits_long(&gb, i); - switch (ac->m4ac.object_type) { + switch (m4ac->object_type) { case AOT_AAC_MAIN: case AOT_AAC_LC: - if (decode_ga_specific_config(ac, &gb, ac->m4ac.chan_config)) + if (decode_ga_specific_config(ac, avctx, &gb, m4ac, m4ac->chan_config)) return -1; break; default: - av_log(ac->avctx, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n", - ac->m4ac.sbr == 1? "SBR+" : "", ac->m4ac.object_type); + av_log(avctx, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n", + m4ac->sbr == 1? "SBR+" : "", m4ac->object_type); return -1; } - return 0; + + return get_bits_count(&gb); } /** @@ -542,7 +539,9 @@ ac->m4ac.sample_rate = avctx->sample_rate; if (avctx->extradata_size > 0) { - if (decode_audio_specific_config(ac, avctx->extradata, avctx->extradata_size)) + if (decode_audio_specific_config(ac, ac->avctx, &ac->m4ac, + avctx->extradata, + avctx->extradata_size) < 0) return -1; } @@ -1910,7 +1909,7 @@ enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); ac->m4ac.chan_config = hdr_info.chan_config; - if (set_default_channel_config(ac, new_che_pos, hdr_info.chan_config)) + if (set_default_channel_config(ac->avctx, new_che_pos, hdr_info.chan_config)) return -7; if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config, OC_TRIAL_FRAME)) return -7; @@ -1937,24 +1936,17 @@ return size; } -static int aac_decode_frame(AVCodecContext *avctx, void *data, - int *data_size, AVPacket *avpkt) +static int aac_decode_frame_int(AVCodecContext *avctx, void *data, + int *data_size, GetBitContext *gb) { - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; AACContext *ac = avctx->priv_data; ChannelElement *che = NULL, *che_prev = NULL; - GetBitContext gb; enum RawDataBlockType elem_type, elem_type_prev = TYPE_END; int err, elem_id, data_size_tmp; - int buf_consumed; int samples = 0, multiplier; - int buf_offset; - - init_get_bits(&gb, buf, buf_size * 8); - if (show_bits(&gb, 12) == 0xfff) { - if (parse_adts_frame_header(ac, &gb) < 0) { + if (show_bits(gb, 12) == 0xfff) { + if (parse_adts_frame_header(ac, gb) < 0) { av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); return -1; } @@ -1964,10 +1956,10 @@ } } - memset(ac->tags_seen_this_frame, 0, sizeof(ac->tags_seen_this_frame)); + ac->tags_mapped = 0; // parse - while ((elem_type = get_bits(&gb, 3)) != TYPE_END) { - elem_id = get_bits(&gb, 4); + while ((elem_type = get_bits(gb, 3)) != TYPE_END) { + elem_id = get_bits(gb, 4); if (elem_type < TYPE_DSE) { if (!(che=get_che(ac, elem_type, elem_id))) { @@ -1981,29 +1973,29 @@ switch (elem_type) { case TYPE_SCE: - err = decode_ics(ac, &che->ch[0], &gb, 0, 0); + err = decode_ics(ac, &che->ch[0], gb, 0, 0); break; case TYPE_CPE: - err = decode_cpe(ac, &gb, che); + err = decode_cpe(ac, gb, che); break; case TYPE_CCE: - err = decode_cce(ac, &gb, che); + err = decode_cce(ac, gb, che); break; case TYPE_LFE: - err = decode_ics(ac, &che->ch[0], &gb, 0, 0); + err = decode_ics(ac, &che->ch[0], gb, 0, 0); break; case TYPE_DSE: - err = skip_data_stream_element(ac, &gb); + err = skip_data_stream_element(ac, gb); break; case TYPE_PCE: { enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); - if ((err = decode_pce(ac, new_che_pos, &gb))) + if ((err = decode_pce(avctx, &ac->m4ac, new_che_pos, gb))) break; if (ac->output_configured > OC_TRIAL_PCE) av_log(avctx, AV_LOG_ERROR, @@ -2015,13 +2007,13 @@ case TYPE_FIL: if (elem_id == 15) - elem_id += get_bits(&gb, 8) - 1; - if (get_bits_left(&gb) < 8 * elem_id) { + elem_id += get_bits(gb, 8) - 1; + if (get_bits_left(gb) < 8 * elem_id) { av_log(avctx, AV_LOG_ERROR, overread_err); return -1; } while (elem_id > 0) - elem_id -= decode_extension_payload(ac, &gb, elem_id, che_prev, elem_type_prev); + elem_id -= decode_extension_payload(ac, gb, elem_id, che_prev, elem_type_prev); err = 0; /* FIXME */ break; @@ -2036,7 +2028,7 @@ if (err) return err; - if (get_bits_left(&gb) < 3) { + if (get_bits_left(gb) < 3) { av_log(avctx, AV_LOG_ERROR, overread_err); return -1; } @@ -2066,6 +2058,24 @@ if (ac->output_configured) ac->output_configured = OC_LOCKED; + return 0; +} + +static int aac_decode_frame(AVCodecContext *avctx, void *data, + int *data_size, AVPacket *avpkt) +{ + const uint8_t *buf = avpkt->data; + int buf_size = avpkt->size; + GetBitContext gb; + int buf_consumed; + int buf_offset; + int err; + + init_get_bits(&gb, buf, buf_size * 8); + + if ((err = aac_decode_frame_int(avctx, data, data_size, &gb)) < 0) + return err; + buf_consumed = (get_bits_count(&gb) + 7) >> 3; for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++) if (buf[buf_offset]) @@ -2092,6 +2102,261 @@ return 0; } + +#define LOAS_SYNC_WORD 0x2b7 ///< 11 bits LOAS sync word + +struct LATMContext { + AACContext aac_ctx; ///< containing AACContext + int initialized; ///< initilized after a valid extradata was seen + + // parser data + int audio_mux_version_A; ///< LATM syntax version + int frame_length_type; ///< 0/1 variable/fixed frame length + int frame_length; ///< frame length for fixed frame length +}; + +static inline uint32_t latm_get_value(GetBitContext *b) +{ + int length = get_bits(b, 2); + + return get_bits_long(b, (length+1)*8); +} + +static int latm_decode_audio_specific_config(struct LATMContext *latmctx, + GetBitContext *gb) +{ + AVCodecContext *avctx = latmctx->aac_ctx.avctx; + MPEG4AudioConfig m4ac; + int config_start_bit = get_bits_count(gb); + int bits_consumed, esize; + + if (config_start_bit % 8) { + av_log_missing_feature(latmctx->aac_ctx.avctx, "audio specific " + "config not byte aligned.\n", 1); + return AVERROR_INVALIDDATA; + } else { + bits_consumed = + decode_audio_specific_config(NULL, avctx, &m4ac, + gb->buffer + (config_start_bit / 8), + get_bits_left(gb) / 8); + + if (bits_consumed < 0) + return AVERROR_INVALIDDATA; + + esize = (bits_consumed+7) / 8; + + if (avctx->extradata_size <= esize) { + av_free(avctx->extradata); + avctx->extradata = av_malloc(esize + FF_INPUT_BUFFER_PADDING_SIZE); + if (!avctx->extradata) + return AVERROR(ENOMEM); + } + + avctx->extradata_size = esize; + memcpy(avctx->extradata, gb->buffer + (config_start_bit/8), esize); + memset(avctx->extradata+esize, 0, FF_INPUT_BUFFER_PADDING_SIZE); + } + + return bits_consumed; +} + +static int read_stream_mux_config(struct LATMContext *latmctx, + GetBitContext *gb) +{ + int ret, audio_mux_version = get_bits(gb, 1); + + latmctx->audio_mux_version_A = 0; + if (audio_mux_version) + latmctx->audio_mux_version_A = get_bits(gb, 1); + + if (!latmctx->audio_mux_version_A) { + + if (audio_mux_version) + latm_get_value(gb); // taraFullness + + skip_bits(gb, 1); // allStreamSameTimeFraming + skip_bits(gb, 6); // numSubFrames + // numPrograms + if (get_bits(gb, 4)) { // numPrograms + av_log_missing_feature(latmctx->aac_ctx.avctx, + "multiple programs are not supported\n", 1); + return AVERROR_PATCHWELCOME; + } + + // for each program (which there is only on in DVB) + + // for each layer (which there is only on in DVB) + if (get_bits(gb, 3)) { // numLayer + av_log_missing_feature(latmctx->aac_ctx.avctx, + "multiple layers are not supported\n", 1); + return AVERROR_PATCHWELCOME; + } + + // for all but first stream: use_same_config = get_bits(gb, 1); + if (!audio_mux_version) { + if ((ret = latm_decode_audio_specific_config(latmctx, gb)) < 0) + return ret; + } else { + int ascLen = latm_get_value(gb); + if ((ret = latm_decode_audio_specific_config(latmctx, gb)) < 0) + return ret; + ascLen -= ret; + skip_bits_long(gb, ascLen); + } + + latmctx->frame_length_type = get_bits(gb, 3); + switch (latmctx->frame_length_type) { + case 0: + skip_bits(gb, 8); // latmBufferFullness + break; + case 1: + latmctx->frame_length = get_bits(gb, 9); + break; + case 3: + case 4: + case 5: + skip_bits(gb, 6); // CELP frame length table index + break; + case 6: + case 7: + skip_bits(gb, 1); // HVXC frame length table index + break; + } + + if (get_bits(gb, 1)) { // other data + if (audio_mux_version) { + latm_get_value(gb); // other_data_bits + } else { + int esc; + do { + esc = get_bits(gb, 1); + skip_bits(gb, 8); + } while (esc); + } + } + + if (get_bits(gb, 1)) // crc present + skip_bits(gb, 8); // config_crc + } + + return 0; +} + +static int read_payload_length_info(struct LATMContext *ctx, GetBitContext *gb) +{ + uint8_t tmp; + + if (ctx->frame_length_type == 0) { + int mux_slot_length = 0; + do { + tmp = get_bits(gb, 8); + mux_slot_length += tmp; + } while (tmp == 255); + return mux_slot_length; + } else if (ctx->frame_length_type == 1) { + return ctx->frame_length; + } else if (ctx->frame_length_type == 3 || + ctx->frame_length_type == 5 || + ctx->frame_length_type == 7) { + skip_bits(gb, 2); // mux_slot_length_coded + } + return 0; +} + +static int read_audio_mux_element(struct LATMContext *latmctx, + GetBitContext *gb) +{ + int err; + uint8_t use_same_mux = get_bits(gb, 1); + if (!use_same_mux) { + if ((err = read_stream_mux_config(latmctx, gb)) < 0) + return err; + } else if (!latmctx->aac_ctx.avctx->extradata) { + av_log(latmctx->aac_ctx.avctx, AV_LOG_DEBUG, + "no decoder config found\n"); + return AVERROR(EAGAIN); + } + if (latmctx->audio_mux_version_A == 0) { + int mux_slot_length_bytes = read_payload_length_info(latmctx, gb); + if (mux_slot_length_bytes * 8 > get_bits_left(gb)) { + av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, "incomplete frame\n"); + return AVERROR_INVALIDDATA; + } else if (mux_slot_length_bytes * 8 + 256 < get_bits_left(gb)) { + av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, + "frame length mismatch %d << %d\n", + mux_slot_length_bytes * 8, get_bits_left(gb)); + return AVERROR_INVALIDDATA; + } + } + return 0; +} + + +static int latm_decode_frame(AVCodecContext *avctx, void *out, int *out_size, + AVPacket *avpkt) +{ + struct LATMContext *latmctx = avctx->priv_data; + int muxlength, err; + GetBitContext gb; + + if (avpkt->size == 0) + return 0; + + init_get_bits(&gb, avpkt->data, avpkt->size * 8); + + // check for LOAS sync word + if (get_bits(&gb, 11) != LOAS_SYNC_WORD) + return AVERROR_INVALIDDATA; + + muxlength = get_bits(&gb, 13); + // not enough data, the parser should have sorted this + if (muxlength+3 > avpkt->size) + return AVERROR_INVALIDDATA; + + if ((err = read_audio_mux_element(latmctx, &gb)) < 0) + return err; + + if (!latmctx->initialized) { + if (!avctx->extradata) { + *out_size = 0; + return avpkt->size; + } else { + if ((err = aac_decode_init(avctx)) < 0) + return err; + latmctx->initialized = 1; + } + } + + if (show_bits(&gb, 12) == 0xfff) { + av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, + "ADTS header detected, probably as result of configuration " + "misparsing\n"); + return AVERROR_INVALIDDATA; + } + + if ((err = aac_decode_frame_int(avctx, out, out_size, &gb)) < 0) + return err; + + return muxlength; +} + +av_cold static int latm_decode_init(AVCodecContext *avctx) +{ + struct LATMContext *latmctx = avctx->priv_data; + int ret; + + ret = aac_decode_init(avctx); + + if (avctx->extradata_size > 0) { + latmctx->initialized = !ret; + } else { + latmctx->initialized = 0; + } + + return ret; +} + + AVCodec aac_decoder = { "aac", AVMEDIA_TYPE_AUDIO, @@ -2107,3 +2372,23 @@ }, .channel_layouts = aac_channel_layout, }; + +/* + Note: This decoder filter is intended to decode LATM streams transferred + in MPEG transport streams which only contain one program. + To do a more complex LATM demuxing a separate LATM demuxer should be used. +*/ +AVCodec aac_latm_decoder = { + .name = "aac_latm", + .type = CODEC_TYPE_AUDIO, + .id = CODEC_ID_AAC_LATM, + .priv_data_size = sizeof(struct LATMContext), + .init = latm_decode_init, + .close = aac_decode_close, + .decode = latm_decode_frame, + .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"), + .sample_fmts = (const enum SampleFormat[]) { + SAMPLE_FMT_S16,SAMPLE_FMT_NONE + }, + .channel_layouts = aac_channel_layout, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aacenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aacenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aacenc.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aacenc.c 2010-11-06 17:21:26.000000000 +0000 @@ -302,7 +302,7 @@ static void adjust_frame_information(AACEncContext *apc, ChannelElement *cpe, int chans) { int i, w, w2, g, ch; - int start, sum, maxsfb, cmaxsfb; + int start, maxsfb, cmaxsfb; for (ch = 0; ch < chans; ch++) { IndividualChannelStream *ics = &cpe->ch[ch].ics; @@ -311,9 +311,8 @@ cpe->ch[ch].pulse.num_pulse = 0; for (w = 0; w < ics->num_windows*16; w += 16) { for (g = 0; g < ics->num_swb; g++) { - sum = 0; //apply M/S - if (!ch && cpe->ms_mask[w + g]) { + if (cpe->common_window && !ch && cpe->ms_mask[w + g]) { for (i = 0; i < ics->swb_sizes[g]; i++) { cpe->ch[0].coeffs[start+i] = (cpe->ch[0].coeffs[start+i] + cpe->ch[1].coeffs[start+i]) / 2.0; cpe->ch[1].coeffs[start+i] = cpe->ch[0].coeffs[start+i] - cpe->ch[1].coeffs[start+i]; @@ -544,7 +543,6 @@ for (k = 0; k < ics->num_windows; k++) ics->group_len[k] = wi[j].grouping[k]; - s->cur_channel = cur_channel; apply_window_and_mdct(avctx, s, &cpe->ch[j], samples2); } start_ch += chans; @@ -561,6 +559,8 @@ tag = chan_map[i+1]; chans = tag == TYPE_CPE ? 2 : 1; cpe = &s->cpe[i]; + put_bits(&s->pb, 3, tag); + put_bits(&s->pb, 4, chan_el_counter[tag]++); for (j = 0; j < chans; j++) { s->cur_channel = start_ch + j; ff_psy_set_band_info(&s->psy, s->cur_channel, cpe->ch[j].coeffs, &wi[j]); @@ -583,8 +583,6 @@ if (cpe->common_window && s->coder->search_for_ms) s->coder->search_for_ms(s, cpe, s->lambda); adjust_frame_information(s, cpe, chans); - put_bits(&s->pb, 3, tag); - put_bits(&s->pb, 4, chan_el_counter[tag]++); if (chans == 2) { put_bits(&s->pb, 1, cpe->common_window); if (cpe->common_window) { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aac.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aac.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aac.h 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aac.h 2010-11-06 17:21:26.000000000 +0000 @@ -251,7 +251,6 @@ */ ChannelElement *che[4][MAX_ELEM_ID]; ChannelElement *tag_che_map[4][MAX_ELEM_ID]; - uint8_t tags_seen_this_frame[4][MAX_ELEM_ID]; int tags_mapped; /** @} */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aacpsy.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aacpsy.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aacpsy.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aacpsy.c 2010-11-06 17:21:26.000000000 +0000 @@ -39,11 +39,19 @@ * constants for 3GPP AAC psychoacoustic model * @{ */ -#define PSY_3GPP_SPREAD_LOW 1.5f // spreading factor for ascending threshold spreading (15 dB/Bark) -#define PSY_3GPP_SPREAD_HI 3.0f // spreading factor for descending threshold spreading (30 dB/Bark) +#define PSY_3GPP_SPREAD_HI 1.5f // spreading factor for ascending threshold spreading (15 dB/Bark) +#define PSY_3GPP_SPREAD_LOW 3.0f // spreading factor for descending threshold spreading (30 dB/Bark) #define PSY_3GPP_RPEMIN 0.01f #define PSY_3GPP_RPELEV 2.0f + +/* LAME psy model constants */ +#define PSY_LAME_FIR_LEN 21 ///< LAME psy model FIR order +#define AAC_BLOCK_SIZE_LONG 1024 ///< long block size +#define AAC_BLOCK_SIZE_SHORT 128 ///< short block size +#define AAC_NUM_BLOCKS_SHORT 8 ///< number of blocks in a short sequence +#define PSY_LAME_NUM_SUBBLOCKS 3 ///< Number of sub-blocks in each short block + /** * @} */ @@ -51,44 +59,156 @@ /** * information for single band used by 3GPP TS26.403-inspired psychoacoustic model */ -typedef struct Psy3gppBand{ +typedef struct AacPsyBand{ float energy; ///< band energy float ffac; ///< form factor float thr; ///< energy threshold float min_snr; ///< minimal SNR float thr_quiet; ///< threshold in quiet -}Psy3gppBand; +}AacPsyBand; /** * single/pair channel context for psychoacoustic model */ -typedef struct Psy3gppChannel{ - Psy3gppBand band[128]; ///< bands information - Psy3gppBand prev_band[128]; ///< bands information from the previous frame +typedef struct AacPsyChannel{ + AacPsyBand band[128]; ///< bands information + AacPsyBand prev_band[128]; ///< bands information from the previous frame float win_energy; ///< sliding average of channel energy float iir_state[2]; ///< hi-pass IIR filter state uint8_t next_grouping; ///< stored grouping scheme for the next frame (in case of 8 short window sequence) enum WindowSequence next_window_seq; ///< window sequence to be used in the next frame -}Psy3gppChannel; + /* LAME psy model specific members */ + float attack_threshold; ///< attack threshold for this channel + float prev_energy_subshort[AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS]; + int prev_attack; ///< attack value for the last short block in the previous sequence +}AacPsyChannel; /** * psychoacoustic model frame type-dependent coefficients */ -typedef struct Psy3gppCoeffs{ +typedef struct AacPsyCoeffs{ float ath [64]; ///< absolute threshold of hearing per bands float barks [64]; ///< Bark value for each spectral band in long frame float spread_low[64]; ///< spreading factor for low-to-high threshold spreading in long frame float spread_hi [64]; ///< spreading factor for high-to-low threshold spreading in long frame -}Psy3gppCoeffs; +}AacPsyCoeffs; /** * 3GPP TS26.403-inspired psychoacoustic model specific data */ -typedef struct Psy3gppContext{ - Psy3gppCoeffs psy_coef[2]; - Psy3gppChannel *ch; -}Psy3gppContext; +typedef struct AacPsyContext{ + AacPsyCoeffs psy_coef[2]; + AacPsyChannel *ch; +}AacPsyContext; + +/** + * LAME psy model preset struct + */ +typedef struct { + int quality; ///< Quality to map the rest of the vaules to. + /* This is overloaded to be both kbps per channel in ABR mode, and + * requested quality in constant quality mode. + */ + float st_lrm; ///< short threshold for L, R, and M channels +} PsyLamePreset; + +/** + * LAME psy model preset table for ABR + */ +static const PsyLamePreset psy_abr_map[] = { +/* TODO: Tuning. These were taken from LAME. */ +/* kbps/ch st_lrm */ + { 8, 6.60}, + { 16, 6.60}, + { 24, 6.60}, + { 32, 6.60}, + { 40, 6.60}, + { 48, 6.60}, + { 56, 6.60}, + { 64, 6.40}, + { 80, 6.00}, + { 96, 5.60}, + {112, 5.20}, + {128, 5.20}, + {160, 5.20} +}; + +/** +* LAME psy model preset table for constant quality +*/ +static const PsyLamePreset psy_vbr_map[] = { +/* vbr_q st_lrm */ + { 0, 4.20}, + { 1, 4.20}, + { 2, 4.20}, + { 3, 4.20}, + { 4, 4.20}, + { 5, 4.20}, + { 6, 4.20}, + { 7, 4.20}, + { 8, 4.20}, + { 9, 4.20}, + {10, 4.20} +}; + +/** + * LAME psy model FIR coefficient table + */ +static const float psy_fir_coeffs[] = { + -8.65163e-18 * 2, -0.00851586 * 2, -6.74764e-18 * 2, 0.0209036 * 2, + -3.36639e-17 * 2, -0.0438162 * 2, -1.54175e-17 * 2, 0.0931738 * 2, + -5.52212e-17 * 2, -0.313819 * 2 +}; + +/** + * calculates the attack threshold for ABR from the above table for the LAME psy model + */ +static float lame_calc_attack_threshold(int bitrate) +{ + /* Assume max bitrate to start with */ + int lower_range = 12, upper_range = 12; + int lower_range_kbps = psy_abr_map[12].quality; + int upper_range_kbps = psy_abr_map[12].quality; + int i; + + /* Determine which bitrates the value specified falls between. + * If the loop ends without breaking our above assumption of 320kbps was correct. + */ + for (i = 1; i < 13; i++) { + if (FFMAX(bitrate, psy_abr_map[i].quality) != bitrate) { + upper_range = i; + upper_range_kbps = psy_abr_map[i ].quality; + lower_range = i - 1; + lower_range_kbps = psy_abr_map[i - 1].quality; + break; /* Upper range found */ + } + } + + /* Determine which range the value specified is closer to */ + if ((upper_range_kbps - bitrate) > (bitrate - lower_range_kbps)) + return psy_abr_map[lower_range].st_lrm; + return psy_abr_map[upper_range].st_lrm; +} + +/** + * LAME psy model specific initialization + */ +static void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx) { + int i, j; + + for (i = 0; i < avctx->channels; i++) { + AacPsyChannel *pch = &ctx->ch[i]; + + if (avctx->flags & CODEC_FLAG_QSCALE) + pch->attack_threshold = psy_vbr_map[avctx->global_quality / FF_QP2LAMBDA].st_lrm; + else + pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->channels / 1000); + + for (j = 0; j < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; j++) + pch->prev_energy_subshort[j] = 10.0f; + } +} /** * Calculate Bark value for given line. @@ -113,17 +233,17 @@ } static av_cold int psy_3gpp_init(FFPsyContext *ctx) { - Psy3gppContext *pctx; + AacPsyContext *pctx; float bark; int i, j, g, start; float prev, minscale, minath; - ctx->model_priv_data = av_mallocz(sizeof(Psy3gppContext)); - pctx = (Psy3gppContext*) ctx->model_priv_data; + ctx->model_priv_data = av_mallocz(sizeof(AacPsyContext)); + pctx = (AacPsyContext*) ctx->model_priv_data; minath = ath(3410, ATH_ADD); for (j = 0; j < 2; j++) { - Psy3gppCoeffs *coeffs = &pctx->psy_coef[j]; + AacPsyCoeffs *coeffs = &pctx->psy_coef[j]; float line_to_frequency = ctx->avctx->sample_rate / (j ? 256.f : 2048.0f); i = 0; prev = 0.0; @@ -147,7 +267,10 @@ } } - pctx->ch = av_mallocz(sizeof(Psy3gppChannel) * ctx->avctx->channels); + pctx->ch = av_mallocz(sizeof(AacPsyChannel) * ctx->avctx->channels); + + lame_window_init(pctx, ctx->avctx); + return 0; } @@ -182,8 +305,8 @@ int i, j; int br = ctx->avctx->bit_rate / ctx->avctx->channels; int attack_ratio = br <= 16000 ? 18 : 10; - Psy3gppContext *pctx = (Psy3gppContext*) ctx->model_priv_data; - Psy3gppChannel *pch = &pctx->ch[channel]; + AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data; + AacPsyChannel *pch = &pctx->ch[channel]; uint8_t grouping = 0; int next_type = pch->next_window_seq; FFPsyWindowInfo wi; @@ -264,24 +387,23 @@ * Calculate band thresholds as suggested in 3GPP TS26.403 */ static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, - const float *coefs, FFPsyWindowInfo *wi) + const float *coefs, const FFPsyWindowInfo *wi) { - Psy3gppContext *pctx = (Psy3gppContext*) ctx->model_priv_data; - Psy3gppChannel *pch = &pctx->ch[channel]; + AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data; + AacPsyChannel *pch = &pctx->ch[channel]; int start = 0; int i, w, g; const int num_bands = ctx->num_bands[wi->num_windows == 8]; const uint8_t* band_sizes = ctx->bands[wi->num_windows == 8]; - Psy3gppCoeffs *coeffs = &pctx->psy_coef[wi->num_windows == 8]; + AacPsyCoeffs *coeffs = &pctx->psy_coef[wi->num_windows == 8]; //calculate energies, initial thresholds and related values - 5.4.2 "Threshold Calculation" for (w = 0; w < wi->num_windows*16; w += 16) { for (g = 0; g < num_bands; g++) { - Psy3gppBand *band = &pch->band[w+g]; + AacPsyBand *band = &pch->band[w+g]; band->energy = 0.0f; for (i = 0; i < band_sizes[g]; i++) band->energy += coefs[start+i] * coefs[start+i]; - band->energy *= 1.0f / (512*512); band->thr = band->energy * 0.001258925f; start += band_sizes[g]; @@ -290,18 +412,16 @@ } //modify thresholds - spread, threshold in quiet - 5.4.3 "Spreaded Energy Calculation" for (w = 0; w < wi->num_windows*16; w += 16) { - Psy3gppBand *band = &pch->band[w]; + AacPsyBand *band = &pch->band[w]; for (g = 1; g < num_bands; g++) - band[g].thr = FFMAX(band[g].thr, band[g-1].thr * coeffs->spread_low[g-1]); + band[g].thr = FFMAX(band[g].thr, band[g-1].thr * coeffs->spread_hi [g]); for (g = num_bands - 2; g >= 0; g--) - band[g].thr = FFMAX(band[g].thr, band[g+1].thr * coeffs->spread_hi [g]); + band[g].thr = FFMAX(band[g].thr, band[g+1].thr * coeffs->spread_low[g]); for (g = 0; g < num_bands; g++) { - band[g].thr_quiet = FFMAX(band[g].thr, coeffs->ath[g]); - if (wi->num_windows != 8 && wi->window_type[1] != EIGHT_SHORT_SEQUENCE) - band[g].thr_quiet = FFMAX(PSY_3GPP_RPEMIN*band[g].thr_quiet, - FFMIN(band[g].thr_quiet, - PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet)); - band[g].thr = FFMAX(band[g].thr, band[g].thr_quiet * 0.25); + band[g].thr_quiet = band[g].thr = FFMAX(band[g].thr, coeffs->ath[g]); + if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w))) + band[g].thr = FFMAX(PSY_3GPP_RPEMIN*band[g].thr, FFMIN(band[g].thr, + PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet)); ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].threshold = band[g].thr; } @@ -311,17 +431,196 @@ static av_cold void psy_3gpp_end(FFPsyContext *apc) { - Psy3gppContext *pctx = (Psy3gppContext*) apc->model_priv_data; + AacPsyContext *pctx = (AacPsyContext*) apc->model_priv_data; av_freep(&pctx->ch); av_freep(&apc->model_priv_data); } +static void lame_apply_block_type(AacPsyChannel *ctx, FFPsyWindowInfo *wi, int uselongblock) +{ + int blocktype = ONLY_LONG_SEQUENCE; + if (uselongblock) { + if (ctx->next_window_seq == EIGHT_SHORT_SEQUENCE) + blocktype = LONG_STOP_SEQUENCE; + } else { + blocktype = EIGHT_SHORT_SEQUENCE; + if (ctx->next_window_seq == ONLY_LONG_SEQUENCE) + ctx->next_window_seq = LONG_START_SEQUENCE; + if (ctx->next_window_seq == LONG_STOP_SEQUENCE) + ctx->next_window_seq = EIGHT_SHORT_SEQUENCE; + } + + wi->window_type[0] = ctx->next_window_seq; + ctx->next_window_seq = blocktype; +} + +static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, + const int16_t *audio, const int16_t *la, + int channel, int prev_type) +{ + AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data; + AacPsyChannel *pch = &pctx->ch[channel]; + int grouping = 0; + int uselongblock = 1; + int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 }; + int i; + FFPsyWindowInfo wi; + + memset(&wi, 0, sizeof(wi)); + if (la) { + float hpfsmpl[AAC_BLOCK_SIZE_LONG]; + float const *pf = hpfsmpl; + float attack_intensity[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS]; + float energy_subshort[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS]; + float energy_short[AAC_NUM_BLOCKS_SHORT + 1] = { 0 }; + int chans = ctx->avctx->channels; + const int16_t *firbuf = la + (AAC_BLOCK_SIZE_SHORT/4 - PSY_LAME_FIR_LEN) * chans; + int j, att_sum = 0; + + /* LAME comment: apply high pass filter of fs/4 */ + for (i = 0; i < AAC_BLOCK_SIZE_LONG; i++) { + float sum1, sum2; + sum1 = firbuf[(i + ((PSY_LAME_FIR_LEN - 1) / 2)) * chans]; + sum2 = 0.0; + for (j = 0; j < ((PSY_LAME_FIR_LEN - 1) / 2) - 1; j += 2) { + sum1 += psy_fir_coeffs[j] * (firbuf[(i + j) * chans] + firbuf[(i + PSY_LAME_FIR_LEN - j) * chans]); + sum2 += psy_fir_coeffs[j + 1] * (firbuf[(i + j + 1) * chans] + firbuf[(i + PSY_LAME_FIR_LEN - j - 1) * chans]); + } + hpfsmpl[i] = sum1 + sum2; + } + + /* Calculate the energies of each sub-shortblock */ + for (i = 0; i < PSY_LAME_NUM_SUBBLOCKS; i++) { + energy_subshort[i] = pch->prev_energy_subshort[i + ((AAC_NUM_BLOCKS_SHORT - 1) * PSY_LAME_NUM_SUBBLOCKS)]; + assert(pch->prev_energy_subshort[i + ((AAC_NUM_BLOCKS_SHORT - 2) * PSY_LAME_NUM_SUBBLOCKS + 1)] > 0); + attack_intensity[i] = energy_subshort[i] / pch->prev_energy_subshort[i + ((AAC_NUM_BLOCKS_SHORT - 2) * PSY_LAME_NUM_SUBBLOCKS + 1)]; + energy_short[0] += energy_subshort[i]; + } + + for (i = 0; i < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; i++) { + float const *const pfe = pf + AAC_BLOCK_SIZE_LONG / (AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS); + float p = 1.0f; + for (; pf < pfe; pf++) + if (p < fabsf(*pf)) + p = fabsf(*pf); + pch->prev_energy_subshort[i] = energy_subshort[i + PSY_LAME_NUM_SUBBLOCKS] = p; + energy_short[1 + i / PSY_LAME_NUM_SUBBLOCKS] += p; + /* FIXME: The indexes below are [i + 3 - 2] in the LAME source. + * Obviously the 3 and 2 have some significance, or this would be just [i + 1] + * (which is what we use here). What the 3 stands for is ambigious, as it is both + * number of short blocks, and the number of sub-short blocks. + * It seems that LAME is comparing each sub-block to sub-block + 1 in the + * previous block. + */ + if (p > energy_subshort[i + 1]) + p = p / energy_subshort[i + 1]; + else if (energy_subshort[i + 1] > p * 10.0f) + p = energy_subshort[i + 1] / (p * 10.0f); + else + p = 0.0; + attack_intensity[i + PSY_LAME_NUM_SUBBLOCKS] = p; + } + + /* compare energy between sub-short blocks */ + for (i = 0; i < (AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS; i++) + if (!attacks[i / PSY_LAME_NUM_SUBBLOCKS]) + if (attack_intensity[i] > pch->attack_threshold) + attacks[i / PSY_LAME_NUM_SUBBLOCKS] = (i % PSY_LAME_NUM_SUBBLOCKS) + 1; + + /* should have energy change between short blocks, in order to avoid periodic signals */ + /* Good samples to show the effect are Trumpet test songs */ + /* GB: tuned (1) to avoid too many short blocks for test sample TRUMPET */ + /* RH: tuned (2) to let enough short blocks through for test sample FSOL and SNAPS */ + for (i = 1; i < AAC_NUM_BLOCKS_SHORT + 1; i++) { + float const u = energy_short[i - 1]; + float const v = energy_short[i]; + float const m = FFMAX(u, v); + if (m < 40000) { /* (2) */ + if (u < 1.7f * v && v < 1.7f * u) { /* (1) */ + if (i == 1 && attacks[0] < attacks[i]) + attacks[0] = 0; + attacks[i] = 0; + } + } + att_sum += attacks[i]; + } + + if (attacks[0] <= pch->prev_attack) + attacks[0] = 0; + + att_sum += attacks[0]; + /* 3 below indicates the previous attack happened in the last sub-block of the previous sequence */ + if (pch->prev_attack == 3 || att_sum) { + uselongblock = 0; + + if (attacks[1] && attacks[0]) + attacks[1] = 0; + if (attacks[2] && attacks[1]) + attacks[2] = 0; + if (attacks[3] && attacks[2]) + attacks[3] = 0; + if (attacks[4] && attacks[3]) + attacks[4] = 0; + if (attacks[5] && attacks[4]) + attacks[5] = 0; + if (attacks[6] && attacks[5]) + attacks[6] = 0; + if (attacks[7] && attacks[6]) + attacks[7] = 0; + if (attacks[8] && attacks[7]) + attacks[8] = 0; + } + } else { + /* We have no lookahead info, so just use same type as the previous sequence. */ + uselongblock = !(prev_type == EIGHT_SHORT_SEQUENCE); + } + + lame_apply_block_type(pch, &wi, uselongblock); + + wi.window_type[1] = prev_type; + if (wi.window_type[0] != EIGHT_SHORT_SEQUENCE) { + wi.num_windows = 1; + wi.grouping[0] = 1; + if (wi.window_type[0] == LONG_START_SEQUENCE) + wi.window_shape = 0; + else + wi.window_shape = 1; + } else { + int lastgrp = 0; + + wi.num_windows = 8; + wi.window_shape = 0; + for (i = 0; i < 8; i++) { + if (!((pch->next_grouping >> i) & 1)) + lastgrp = i; + wi.grouping[lastgrp]++; + } + } + + /* Determine grouping, based on the location of the first attack, and save for + * the next frame. + * FIXME: Move this to analysis. + * TODO: Tune groupings depending on attack location + * TODO: Handle more than one attack in a group + */ + for (i = 0; i < 9; i++) { + if (attacks[i]) { + grouping = i; + break; + } + } + pch->next_grouping = window_grouping[grouping]; + + pch->prev_attack = attacks[8]; + + return wi; +} const FFPsyModel ff_aac_psy_model = { .name = "3GPP TS 26.403-inspired model", .init = psy_3gpp_init, - .window = psy_3gpp_window, + .window = psy_lame_window, .analyze = psy_3gpp_analyze, .end = psy_3gpp_end, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aac_tablegen_decl.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aac_tablegen_decl.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/aac_tablegen_decl.h 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/aac_tablegen_decl.h 2010-11-06 17:21:26.000000000 +0000 @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AAC_TABLEGEN_INIT_H -#define AAC_TABLEGEN_INIT_H +#ifndef AAC_TABLEGEN_DECL_H +#define AAC_TABLEGEN_DECL_H #if CONFIG_HARDCODED_TABLES #define ff_aac_tableinit() @@ -31,4 +31,4 @@ extern float ff_aac_pow2sf_tab[428]; #endif /* CONFIG_HARDCODED_TABLES */ -#endif /* AAC_TABLEGEN_INIT_H */ +#endif /* AAC_TABLEGEN_DECL_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/adpcm.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/adpcm.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/adpcm.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/adpcm.c 2010-11-06 17:21:26.000000000 +0000 @@ -578,6 +578,7 @@ } } + flush_put_bits(&pb); dst += put_bits_count(&pb)>>3; break; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/alac.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/alac.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/alac.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/alac.c 2010-11-06 17:21:26.000000000 +0000 @@ -65,9 +65,6 @@ AVCodecContext *avctx; GetBitContext gb; - /* init to 0; first frame decode should initialize from extradata and - * set this to 1 */ - int context_initialized; int numchannels; int bytespersample; @@ -471,21 +468,7 @@ /* short-circuit null buffers */ if (!inbuffer || !input_buffer_size) - return input_buffer_size; - - /* initialize from the extradata */ - if (!alac->context_initialized) { - if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE) { - av_log(avctx, AV_LOG_ERROR, "alac: expected %d extradata bytes\n", - ALAC_EXTRADATA_SIZE); - return input_buffer_size; - } - if (alac_set_info(alac)) { - av_log(avctx, AV_LOG_ERROR, "alac: set_info failed\n"); - return input_buffer_size; - } - alac->context_initialized = 1; - } + return -1; init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8); @@ -493,7 +476,7 @@ if (channels > MAX_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "channels > %d not supported\n", MAX_CHANNELS); - return input_buffer_size; + return -1; } /* 2^result = something to do with output waiting. @@ -678,10 +661,19 @@ { ALACContext *alac = avctx->priv_data; alac->avctx = avctx; - alac->context_initialized = 0; - alac->numchannels = alac->avctx->channels; + /* initialize from the extradata */ + if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE) { + av_log(avctx, AV_LOG_ERROR, "alac: expected %d extradata bytes\n", + ALAC_EXTRADATA_SIZE); + return -1; + } + if (alac_set_info(alac)) { + av_log(avctx, AV_LOG_ERROR, "alac: set_info failed\n"); + return -1; + } + return 0; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/allcodecs.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/allcodecs.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/allcodecs.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/allcodecs.c 2010-11-06 17:21:26.000000000 +0000 @@ -66,6 +66,8 @@ REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi); /* video codecs */ + REGISTER_ENCODER (A64MULTI, a64multi); + REGISTER_ENCODER (A64MULTI5, a64multi5); REGISTER_DECODER (AASC, aasc); REGISTER_DECODER (AMV, amv); REGISTER_DECODER (ANM, anm); @@ -161,6 +163,7 @@ REGISTER_DECODER (QDRAW, qdraw); REGISTER_DECODER (QPEG, qpeg); REGISTER_ENCDEC (QTRLE, qtrle); + REGISTER_DECODER (R10K, r10k); REGISTER_DECODER (R210, r210); REGISTER_ENCDEC (RAWVIDEO, rawvideo); REGISTER_DECODER (RL2, rl2); @@ -217,6 +220,7 @@ /* audio codecs */ REGISTER_ENCDEC (AAC, aac); + REGISTER_DECODER (AAC_LATM, aac_latm); REGISTER_ENCDEC (AC3, ac3); REGISTER_ENCDEC (ALAC, alac); REGISTER_DECODER (ALS, als); @@ -280,6 +284,7 @@ REGISTER_ENCDEC (PCM_F32LE, pcm_f32le); REGISTER_ENCDEC (PCM_F64BE, pcm_f64be); REGISTER_ENCDEC (PCM_F64LE, pcm_f64le); + REGISTER_DECODER (PCM_LXF, pcm_lxf); REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw); REGISTER_ENCDEC (PCM_S8, pcm_s8); REGISTER_ENCDEC (PCM_S16BE, pcm_s16be); @@ -315,6 +320,7 @@ REGISTER_DECODER (ADPCM_EA_R2, adpcm_ea_r2); REGISTER_DECODER (ADPCM_EA_R3, adpcm_ea_r3); REGISTER_DECODER (ADPCM_EA_XAS, adpcm_ea_xas); + REGISTER_ENCDEC (ADPCM_G722, adpcm_g722); REGISTER_ENCDEC (ADPCM_G726, adpcm_g726); REGISTER_DECODER (ADPCM_IMA_AMV, adpcm_ima_amv); REGISTER_DECODER (ADPCM_IMA_DK3, adpcm_ima_dk3); @@ -361,6 +367,7 @@ /* parsers */ REGISTER_PARSER (AAC, aac); + REGISTER_PARSER (AAC_LATM, aac_latm); REGISTER_PARSER (AC3, ac3); REGISTER_PARSER (CAVSVIDEO, cavsvideo); REGISTER_PARSER (DCA, dca); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/alsdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/alsdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/alsdec.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/alsdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -36,6 +36,7 @@ #include "bytestream.h" #include "bgmc.h" #include "dsputil.h" +#include "libavcore/samplefmt.h" #include "libavutil/crc.h" #include @@ -1426,7 +1427,7 @@ // check for size of decoded data size = ctx->cur_frame_length * avctx->channels * - (av_get_bits_per_sample_format(avctx->sample_fmt) >> 3); + (av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3); if (size > *data_size) { av_log(avctx, AV_LOG_ERROR, "Decoded data exceeds buffer size.\n"); @@ -1679,7 +1680,7 @@ ctx->crc_buffer = av_malloc(sizeof(*ctx->crc_buffer) * ctx->cur_frame_length * avctx->channels * - (av_get_bits_per_sample_format(avctx->sample_fmt) >> 3)); + (av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3)); if (!ctx->crc_buffer) { av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n"); decode_end(avctx); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/amr.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/amr.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/amr.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/amr.h 2010-11-06 17:21:27.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * Shared functions between AMR codecs + * + * Copyright (c) 2010 Marcelo Galvao Povoa + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AMR_H +#define AVCODEC_AMR_H + +#include "avcodec.h" + +#ifdef AMR_USE_16BIT_TABLES +#define R_TABLE_TYPE uint16_t +#else +#define R_TABLE_TYPE uint8_t +#endif + +/** + * Fill the frame structure variables from bitstream by parsing the + * given reordering table that uses the following format: + * + * Each field (16 bits) in the AMR Frame is stored as: + * - one byte for the number of bits in the field + * - one byte for the field index + * - then, one byte for each bit of the field (from most-significant to least) + * of the position of that bit in the AMR frame. + * + * @param out pointer to the frame struct + * @param size the size in bytes of the frame struct + * @param data input bitstream after the frame header + * @param ord_table the reordering table as above + */ +static inline void ff_amr_bit_reorder(uint16_t *out, int size, + const uint8_t *data, + const R_TABLE_TYPE *ord_table) +{ + int field_size; + + memset(out, 0, size); + while ((field_size = *ord_table++)) { + int field = 0; + int field_offset = *ord_table++; + while (field_size--) { + int bit = *ord_table++; + field <<= 1; + field |= data[bit >> 3] >> (bit & 7) & 1; + } + out[field_offset] = field; + } +} + +#endif /* AVCODEC_AMR_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/amrnbdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/amrnbdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/amrnbdec.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/amrnbdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -52,6 +52,7 @@ #include "acelp_vectors.h" #include "acelp_pitch_delay.h" #include "lsp.h" +#include "amr.h" #include "amrnbdata.h" @@ -195,24 +196,9 @@ p->bad_frame_indicator = !get_bits1(&gb); // quality bit skip_bits(&gb, 2); // two padding bits - if (mode < MODE_DTX) { - uint16_t *data = (uint16_t *)&p->frame; - const uint8_t *order = amr_unpacking_bitmaps_per_mode[mode]; - int field_size; - - memset(&p->frame, 0, sizeof(AMRNBFrame)); - buf++; - while ((field_size = *order++)) { - int field = 0; - int field_offset = *order++; - while (field_size--) { - int bit = *order++; - field <<= 1; - field |= buf[bit >> 3] >> (bit & 7) & 1; - } - data[field_offset] = field; - } - } + if (mode < MODE_DTX) + ff_amr_bit_reorder((uint16_t *) &p->frame, sizeof(AMRNBFrame), buf + 1, + amr_unpacking_bitmaps_per_mode[mode]); return mode; } @@ -222,20 +208,6 @@ /// @{ /** - * Convert an lsf vector into an lsp vector. - * - * @param lsf input lsf vector - * @param lsp output lsp vector - */ -static void lsf2lsp(const float *lsf, double *lsp) -{ - int i; - - for (i = 0; i < LP_FILTER_ORDER; i++) - lsp[i] = cos(2.0 * M_PI * lsf[i]); -} - -/** * Interpolate the LSF vector (used for fixed gain smoothing). * The interpolation is done over all four subframes even in MODE_12k2. * @@ -293,7 +265,7 @@ if (update) interpolate_lsf(p->lsf_q, lsf_q); - lsf2lsp(lsf_q, lsp); + ff_acelp_lsf2lspd(lsp, lsf_q, LP_FILTER_ORDER); } /** @@ -357,7 +329,7 @@ interpolate_lsf(p->lsf_q, lsf_q); memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r)); - lsf2lsp(lsf_q, p->lsp[3]); + ff_acelp_lsf2lspd(p->lsp[3], lsf_q, LP_FILTER_ORDER); // interpolate LSP vectors at subframes 1, 2 and 3 for (i = 1; i <= 3; i++) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ansi.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ansi.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ansi.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ansi.c 2010-11-06 17:21:27.000000000 +0000 @@ -24,9 +24,9 @@ * ASCII/ANSI art decoder */ +#include "libavutil/lfg.h" #include "avcodec.h" #include "cga_data.h" -#include #define ATTR_BOLD 0x01 /**< Bold/Bright-foreground (mode 1) */ #define ATTR_FAINT 0x02 /**< Faint (mode 2) */ @@ -424,7 +424,7 @@ AVCodec ansi_decoder = { .name = "ansi", - .type = CODEC_TYPE_VIDEO, + .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_ANSI, .priv_data_size = sizeof(AnsiContext), .init = decode_init, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/asm-offsets.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/asm-offsets.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/asm-offsets.h 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/asm-offsets.h 2010-11-06 17:21:27.000000000 +0000 @@ -33,16 +33,16 @@ #define Y_DC_SCALE 0xa54 #define C_DC_SCALE 0xa58 #define AC_PRED 0xa80 -#define BLOCK_LAST_INDEX 0x2164 -#define INTER_SCANTAB_RASTER_END 0x2364 +#define BLOCK_LAST_INDEX 0x2160 +#define INTER_SCANTAB_RASTER_END 0x2360 #define H263_AIC 0x2610 #elif defined(__APPLE__) #define Y_DC_SCALE 0xa30 #define C_DC_SCALE 0xa34 #define AC_PRED 0xa5c -#define BLOCK_LAST_INDEX 0x2140 -#define INTER_SCANTAB_RASTER_END 0x2340 -#define H263_AIC 0x25e4 +#define BLOCK_LAST_INDEX 0x213c +#define INTER_SCANTAB_RASTER_END 0x233c +#define H263_AIC 0x25e0 #endif #endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/asm.S chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/asm.S --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/asm.S 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/asm.S 2010-11-06 17:21:27.000000000 +0000 @@ -62,7 +62,7 @@ .endm .macro movrel rd, val -#if HAVE_ARMV6T2 && !CONFIG_PIC +#if HAVE_ARMV6T2 && !CONFIG_PIC && !defined(__APPLE__) movw \rd, #:lower16:\val movt \rd, #:upper16:\val #else diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/dsputil_init_arm.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/dsputil_init_arm.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/dsputil_init_arm.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/dsputil_init_arm.c 2010-11-06 17:21:27.000000000 +0000 @@ -73,11 +73,6 @@ ff_add_pixels_clamped(block, dest, line_size); } -int mm_support(void) -{ - return HAVE_IWMMXT * FF_MM_IWMMXT; -} - void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx) { ff_put_pixels_clamped = c->put_pixels_clamped; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/dsputil_iwmmxt.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/dsputil_iwmmxt.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/dsputil_iwmmxt.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/dsputil_iwmmxt.c 2010-11-06 17:21:27.000000000 +0000 @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/dsputil.h" #define DEF(x, y) x ## _no_rnd_ ## y ##_iwmmxt @@ -150,18 +151,19 @@ /* A run time test is not simple. If this file is compiled in * then we should install the functions */ -int mm_flags = FF_MM_IWMMXT; /* multimedia extension flags */ void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx) { + int mm_flags = AV_CPU_FLAG_IWMMXT; /* multimedia extension flags */ + if (avctx->dsp_mask) { - if (avctx->dsp_mask & FF_MM_FORCE) + if (avctx->dsp_mask & AV_CPU_FLAG_FORCE) mm_flags |= (avctx->dsp_mask & 0xffff); else mm_flags &= ~(avctx->dsp_mask & 0xffff); } - if (!(mm_flags & FF_MM_IWMMXT)) return; + if (!(mm_flags & AV_CPU_FLAG_IWMMXT)) return; c->add_pixels_clamped = add_pixels_clamped_iwmmxt; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/h264idct_neon.S chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/h264idct_neon.S --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/h264idct_neon.S 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/h264idct_neon.S 2010-11-06 17:21:27.000000000 +0000 @@ -150,13 +150,13 @@ mov r2, r3 ldr r6, [sp, #32] movrel r7, scan8+16 - mov ip, #8 + mov ip, #7 1: ldrb r8, [r7], #1 ldr r0, [r5], #4 ldrb r8, [r6, r8] tst ip, #4 - addeq r0, r0, r4 - addne r0, r0, r9 + addne r0, r0, r4 + addeq r0, r0, r9 cmp r8, #0 ldrsh r8, [r1] adrne lr, ff_h264_idct_add_neon @@ -165,7 +165,7 @@ blxne lr subs ip, ip, #1 add r1, r1, #32 - bne 1b + bge 1b pop {r4-r10,pc} endfunc diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/mpegvideo_iwmmxt.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/mpegvideo_iwmmxt.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/arm/mpegvideo_iwmmxt.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/arm/mpegvideo_iwmmxt.c 2010-11-06 17:21:27.000000000 +0000 @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" #include "libavcodec/mpegvideo.h" @@ -111,7 +112,7 @@ void MPV_common_init_iwmmxt(MpegEncContext *s) { - if (!(mm_flags & FF_MM_IWMMXT)) return; + if (!(mm_flags & AV_CPU_FLAG_IWMMXT)) return; s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt; #if 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/audioconvert.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/audioconvert.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/audioconvert.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/audioconvert.c 2010-11-06 17:21:27.000000000 +0000 @@ -27,50 +27,26 @@ #include "libavutil/avstring.h" #include "libavutil/libm.h" +#include "libavcore/samplefmt.h" #include "avcodec.h" #include "audioconvert.h" -typedef struct SampleFmtInfo { - const char *name; - int bits; -} SampleFmtInfo; - -/** this table gives more information about formats */ -static const SampleFmtInfo sample_fmt_info[SAMPLE_FMT_NB] = { - [SAMPLE_FMT_U8] = { .name = "u8", .bits = 8 }, - [SAMPLE_FMT_S16] = { .name = "s16", .bits = 16 }, - [SAMPLE_FMT_S32] = { .name = "s32", .bits = 32 }, - [SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 }, - [SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64 }, -}; - +#if FF_API_OLD_SAMPLE_FMT const char *avcodec_get_sample_fmt_name(int sample_fmt) { - if (sample_fmt < 0 || sample_fmt >= SAMPLE_FMT_NB) - return NULL; - return sample_fmt_info[sample_fmt].name; + return av_get_sample_fmt_name(sample_fmt); } enum SampleFormat avcodec_get_sample_fmt(const char* name) { - int i; - - for (i=0; i < SAMPLE_FMT_NB; i++) - if (!strcmp(sample_fmt_info[i].name, name)) - return i; - return SAMPLE_FMT_NONE; + return av_get_sample_fmt(name); } void avcodec_sample_fmt_string (char *buf, int buf_size, int sample_fmt) { - /* print header */ - if (sample_fmt < 0) - snprintf (buf, buf_size, "name " " depth"); - else if (sample_fmt < SAMPLE_FMT_NB) { - SampleFmtInfo info= sample_fmt_info[sample_fmt]; - snprintf (buf, buf_size, "%-6s" " %2d ", info.name, info.bits); - } + av_get_sample_fmt_string(buf, buf_size, sample_fmt); } +#endif static const char* const channel_names[]={ "FL", "FR", "FC", "LFE", "BL", "BR", "FLC", "FRC", @@ -121,6 +97,18 @@ { 0 } }; +int64_t avcodec_get_channel_layout(const char *name) +{ + int i = 0; + do { + if (!strcmp(channel_layout_map[i].name, name)) + return channel_layout_map[i].layout; + i++; + } while (channel_layout_map[i].name); + + return 0; +} + void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout) { int i; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/audioconvert.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/audioconvert.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/audioconvert.h 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/audioconvert.h 2010-11-06 17:21:27.000000000 +0000 @@ -29,30 +29,28 @@ */ +#include "libavutil/cpu.h" #include "avcodec.h" - +#if FF_API_OLD_SAMPLE_FMT /** - * Generate string corresponding to the sample format with - * number sample_fmt, or a header if sample_fmt is negative. - * - * @param[in] buf the buffer where to write the string - * @param[in] buf_size the size of buf - * @param[in] sample_fmt the number of the sample format to print the corresponding info string, or - * a negative value to print the corresponding header. - * Meaningful values for obtaining a sample format info vary from 0 to SAMPLE_FMT_NB -1. + * @deprecated Use av_get_sample_fmt_string() instead. */ +attribute_deprecated void avcodec_sample_fmt_string(char *buf, int buf_size, int sample_fmt); /** - * @return NULL on error + * @deprecated Use av_get_sample_fmt_name() instead. */ +attribute_deprecated const char *avcodec_get_sample_fmt_name(int sample_fmt); /** - * @return SAMPLE_FMT_NONE on error + * @deprecated Use av_get_sample_fmt() instead. */ +attribute_deprecated enum SampleFormat avcodec_get_sample_fmt(const char* name); +#endif /** * @return NULL on error @@ -60,6 +58,11 @@ const char *avcodec_get_channel_name(int channel_id); /** + * @return channel layout that matches name, 0 if no match + */ +int64_t avcodec_get_channel_layout(const char *name); + +/** * Return description of channel layout */ void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout); @@ -88,7 +91,7 @@ * @param in_fmt Input sample format * @param in_channels Number of input channels * @param[in] matrix Channel mixing matrix (of dimension in_channel*out_channels). Set to NULL to ignore. - * @param flags See FF_MM_xx + * @param flags See AV_CPU_FLAG_xx * @return NULL on error */ AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channels, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/avcodec.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/avcodec.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/avcodec.h 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/avcodec.h 2010-11-06 17:21:27.000000000 +0000 @@ -27,10 +27,12 @@ */ #include +#include "libavcore/samplefmt.h" #include "libavutil/avutil.h" +#include "libavutil/cpu.h" #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 85 +#define LIBAVCODEC_VERSION_MINOR 95 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -43,6 +45,41 @@ #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) +/** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_PALETTE_CONTROL +#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_MM_FLAGS +#define FF_API_MM_FLAGS (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_OPT_SHOW +#define FF_API_OPT_SHOW (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_AUDIO_OLD +#define FF_API_AUDIO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_VIDEO_OLD +#define FF_API_VIDEO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_SUBTITLE_OLD +#define FF_API_SUBTITLE_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_USE_LPC +#define FF_API_USE_LPC (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_SET_STRING_OLD +#define FF_API_SET_STRING_OLD (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_INOFFICIAL +#define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_OLD_SAMPLE_FMT +#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 53) +#endif + #define AV_NOPTS_VALUE INT64_C(0x8000000000000000) #define AV_TIME_BASE 1000000 #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} @@ -213,6 +250,9 @@ CODEC_ID_VP8, CODEC_ID_PICTOR, CODEC_ID_ANSI, + CODEC_ID_A64_MULTI, + CODEC_ID_A64_MULTI5, + CODEC_ID_R10K, /* various PCM "codecs" */ CODEC_ID_PCM_S16LE= 0x10000, @@ -240,6 +280,7 @@ CODEC_ID_PCM_F64BE, CODEC_ID_PCM_F64LE, CODEC_ID_PCM_BLURAY, + CODEC_ID_PCM_LXF, /* various ADPCM codecs */ CODEC_ID_ADPCM_IMA_QT= 0x11000, @@ -270,6 +311,7 @@ CODEC_ID_ADPCM_EA_XAS, CODEC_ID_ADPCM_EA_MAXIS_XA, CODEC_ID_ADPCM_IMA_ISS, + CODEC_ID_ADPCM_G722, /* AMR */ CODEC_ID_AMR_NB= 0x12000, @@ -338,6 +380,7 @@ CODEC_ID_ATRAC1, CODEC_ID_BINKAUDIO_RDFT, CODEC_ID_BINKAUDIO_DCT, + CODEC_ID_AAC_LATM, /* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= 0x17000, @@ -371,18 +414,17 @@ #define CODEC_TYPE_NB AVMEDIA_TYPE_NB #endif -/** - * all in native-endian format - */ -enum SampleFormat { - SAMPLE_FMT_NONE = -1, - SAMPLE_FMT_U8, ///< unsigned 8 bits - SAMPLE_FMT_S16, ///< signed 16 bits - SAMPLE_FMT_S32, ///< signed 32 bits - SAMPLE_FMT_FLT, ///< float - SAMPLE_FMT_DBL, ///< double - SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec -}; +#if FF_API_OLD_SAMPLE_FMT +#define SampleFormat AVSampleFormat + +#define SAMPLE_FMT_NONE AV_SAMPLE_FMT_NONE +#define SAMPLE_FMT_U8 AV_SAMPLE_FMT_U8 +#define SAMPLE_FMT_S16 AV_SAMPLE_FMT_S16 +#define SAMPLE_FMT_S32 AV_SAMPLE_FMT_S32 +#define SAMPLE_FMT_FLT AV_SAMPLE_FMT_FLT +#define SAMPLE_FMT_DBL AV_SAMPLE_FMT_DBL +#define SAMPLE_FMT_NB AV_SAMPLE_FMT_NB +#endif /* Audio channel masks */ #define CH_FRONT_LEFT 0x00000001 @@ -666,9 +708,13 @@ */ #define CODEC_CAP_EXPERIMENTAL 0x0200 /** - * Codec supports frame-level multithreading. + * Codec should fill in channel configuration and samplerate instead of container */ -#define CODEC_CAP_FRAME_THREADS 0x0400 +#define CODEC_CAP_CHANNEL_CONF 0x0400 +/** +* Codec supports frame-level multithreading. +*/ +#define CODEC_CAP_FRAME_THREADS 0x0800 //The following defines may change, don't expect compatibility if you use them. #define MB_TYPE_INTRA4x4 0x0001 @@ -1394,7 +1440,7 @@ #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. #define FF_COMPLIANCE_NORMAL 0 -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_INOFFICIAL #define FF_COMPLIANCE_INOFFICIAL -1 ///< Allow inofficial extensions (deprecated - use FF_COMPLIANCE_UNOFFICIAL instead). #endif #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions @@ -1667,27 +1713,25 @@ * result into program crash.) */ unsigned dsp_mask; -#define FF_MM_FORCE 0x80000000 /* Force usage of selected flags (OR) */ - /* lower 16 bits - CPU features */ -#define FF_MM_MMX 0x0001 ///< standard MMX -#define FF_MM_3DNOW 0x0004 ///< AMD 3DNOW -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define FF_MM_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext + +#if FF_API_MM_FLAGS +#define FF_MM_FORCE AV_CPU_FLAG_FORCE +#define FF_MM_MMX AV_CPU_FLAG_MMX +#define FF_MM_3DNOW AV_CPU_FLAG_3DNOW +#define FF_MM_MMXEXT AV_CPU_FLAG_MMX2 +#define FF_MM_MMX2 AV_CPU_FLAG_MMX2 +#define FF_MM_SSE AV_CPU_FLAG_SSE +#define FF_MM_SSE2 AV_CPU_FLAG_SSE2 +#define FF_MM_SSE2SLOW AV_CPU_FLAG_SSE2SLOW +#define FF_MM_3DNOWEXT AV_CPU_FLAG_3DNOWEXT +#define FF_MM_SSE3 AV_CPU_FLAG_SSE3 +#define FF_MM_SSE3SLOW AV_CPU_FLAG_SSE3SLOW +#define FF_MM_SSSE3 AV_CPU_FLAG_SSSE3 +#define FF_MM_SSE4 AV_CPU_FLAG_SSE4 +#define FF_MM_SSE42 AV_CPU_FLAG_SSE42 +#define FF_MM_IWMMXT AV_CPU_FLAG_IWMMXT +#define FF_MM_ALTIVEC AV_CPU_FLAG_ALTIVEC #endif -#define FF_MM_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext -#define FF_MM_SSE 0x0008 ///< SSE functions -#define FF_MM_SSE2 0x0010 ///< PIV SSE2 functions -#define FF_MM_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster - ///< than regular MMX/SSE (e.g. Core1) -#define FF_MM_3DNOWEXT 0x0020 ///< AMD 3DNowExt -#define FF_MM_SSE3 0x0040 ///< Prescott SSE3 functions -#define FF_MM_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster - ///< than regular MMX/SSE (e.g. Core1) -#define FF_MM_SSSE3 0x0080 ///< Conroe SSSE3 functions -#define FF_MM_SSE4 0x0100 ///< Penryn SSE4.1 functions -#define FF_MM_SSE42 0x0200 ///< Nehalem SSE4.2 functions -#define FF_MM_IWMMXT 0x0100 ///< XScale IWMMXT -#define FF_MM_ALTIVEC 0x0001 ///< standard AltiVec /** * bits per sample/pixel from the demuxer (needed for huffyuv). @@ -1932,12 +1976,6 @@ */ void *internal_buffer; -#define FF_LAMBDA_SHIFT 7 -#define FF_LAMBDA_SCALE (1<pic.data[0] = NULL; - if (av_check_image_size(avctx->width, avctx->height, 0, avctx) < 0) { + if (av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) { return 1; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/cavsdsp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/cavsdsp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/cavsdsp.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/cavsdsp.c 2010-11-06 17:21:27.000000000 +0000 @@ -511,6 +511,11 @@ CAVS_MC(avg_, 8) CAVS_MC(avg_, 16) +#define ff_put_cavs_qpel8_mc00_c ff_put_pixels8x8_c +#define ff_avg_cavs_qpel8_mc00_c ff_avg_pixels8x8_c +#define ff_put_cavs_qpel16_mc00_c ff_put_pixels16x16_c +#define ff_avg_cavs_qpel16_mc00_c ff_avg_pixels16x16_c + av_cold void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx) { #define dspfunc(PFX, IDX, NUM) \ c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_c; \ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/cscd.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/cscd.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/cscd.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/cscd.c 2010-11-06 17:21:27.000000000 +0000 @@ -35,19 +35,19 @@ unsigned char* decomp_buf; } CamStudioContext; -static void copy_frame_default(AVFrame *f, const uint8_t *src, +static void copy_frame_default(AVFrame *f, const uint8_t *src, int src_stride, int linelen, int height) { int i; uint8_t *dst = f->data[0]; dst += (height - 1) * f->linesize[0]; for (i = height; i; i--) { memcpy(dst, src, linelen); - src += linelen; + src += src_stride; dst -= f->linesize[0]; } } -static void add_frame_default(AVFrame *f, const uint8_t *src, +static void add_frame_default(AVFrame *f, const uint8_t *src, int src_stride, int linelen, int height) { int i, j; uint8_t *dst = f->data[0]; @@ -55,15 +55,16 @@ for (i = height; i; i--) { for (j = linelen; j; j--) *dst++ += *src++; + src += src_stride - linelen; dst -= f->linesize[0] + linelen; } } #if !HAVE_BIGENDIAN -#define copy_frame_16 copy_frame_default -#define copy_frame_32 copy_frame_default -#define add_frame_16 add_frame_default -#define add_frame_32 add_frame_default +#define copy_frame_16(f, s, l, h) copy_frame_default(f, s, l, l, h) +#define copy_frame_32(f, s, l, h) copy_frame_default(f, s, l, l, h) +#define add_frame_16(f, s, l, h) add_frame_default(f, s, l, l, h) +#define add_frame_32(f, s, l, h) add_frame_default(f, s, l, l, h) #else static void copy_frame_16(AVFrame *f, const uint8_t *src, int linelen, int height) { @@ -192,7 +193,8 @@ copy_frame_32(&c->pic, c->decomp_buf, c->linelen, c->height); break; default: - copy_frame_default(&c->pic, c->decomp_buf, c->linelen, c->height); + copy_frame_default(&c->pic, c->decomp_buf, FFALIGN(c->linelen, 4), + c->linelen, c->height); } } else { c->pic.pict_type = FF_P_TYPE; @@ -205,7 +207,8 @@ add_frame_32(&c->pic, c->decomp_buf, c->linelen, c->height); break; default: - add_frame_default(&c->pic, c->decomp_buf, c->linelen, c->height); + add_frame_default(&c->pic, c->decomp_buf, FFALIGN(c->linelen, 4), + c->linelen, c->height); } } @@ -216,6 +219,7 @@ static av_cold int decode_init(AVCodecContext *avctx) { CamStudioContext *c = avctx->priv_data; + int stride; switch (avctx->bits_per_coded_sample) { case 16: avctx->pix_fmt = PIX_FMT_RGB555; break; case 24: avctx->pix_fmt = PIX_FMT_BGR24; break; @@ -224,13 +228,16 @@ av_log(avctx, AV_LOG_ERROR, "CamStudio codec error: invalid depth %i bpp\n", avctx->bits_per_coded_sample); - return 1; + return 1; } c->bpp = avctx->bits_per_coded_sample; c->pic.data[0] = NULL; c->linelen = avctx->width * avctx->bits_per_coded_sample / 8; c->height = avctx->height; - c->decomp_size = c->height * c->linelen; + stride = c->linelen; + if (avctx->bits_per_coded_sample == 24) + stride = FFALIGN(stride, 4); + c->decomp_size = c->height * stride; c->decomp_buf = av_malloc(c->decomp_size + AV_LZO_OUTPUT_PADDING); if (!c->decomp_buf) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dca.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dca.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dca.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dca.c 2010-11-06 17:21:27.000000000 +0000 @@ -1500,4 +1500,5 @@ .decode = dca_decode_frame, .close = dca_decode_end, .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), + .capabilities = CODEC_CAP_CHANNEL_CONF, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dct-test.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dct-test.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dct-test.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dct-test.c 2010-11-06 17:21:27.000000000 +0000 @@ -32,6 +32,7 @@ #include #include +#include "libavutil/cpu.h" #include "libavutil/common.h" #include "libavutil/lfg.h" @@ -94,24 +95,24 @@ {"SIMPLE-C", 1, ff_simple_idct, ff_ref_idct, NO_PERM}, #if HAVE_MMX - {"MMX", 0, ff_fdct_mmx, ff_ref_fdct, NO_PERM, FF_MM_MMX}, + {"MMX", 0, ff_fdct_mmx, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_MMX}, #if HAVE_MMX2 - {"MMX2", 0, ff_fdct_mmx2, ff_ref_fdct, NO_PERM, FF_MM_MMX2}, - {"SSE2", 0, ff_fdct_sse2, ff_ref_fdct, NO_PERM, FF_MM_SSE2}, + {"MMX2", 0, ff_fdct_mmx2, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_MMX2}, + {"SSE2", 0, ff_fdct_sse2, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_SSE2}, #endif #if CONFIG_GPL - {"LIBMPEG2-MMX", 1, ff_mmx_idct, ff_ref_idct, MMX_PERM, FF_MM_MMX}, - {"LIBMPEG2-MMX2", 1, ff_mmxext_idct, ff_ref_idct, MMX_PERM, FF_MM_MMX2}, + {"LIBMPEG2-MMX", 1, ff_mmx_idct, ff_ref_idct, MMX_PERM, AV_CPU_FLAG_MMX}, + {"LIBMPEG2-MMX2", 1, ff_mmxext_idct, ff_ref_idct, MMX_PERM, AV_CPU_FLAG_MMX2}, #endif - {"SIMPLE-MMX", 1, ff_simple_idct_mmx, ff_ref_idct, MMX_SIMPLE_PERM, FF_MM_MMX}, - {"XVID-MMX", 1, ff_idct_xvid_mmx, ff_ref_idct, NO_PERM, FF_MM_MMX}, - {"XVID-MMX2", 1, ff_idct_xvid_mmx2, ff_ref_idct, NO_PERM, FF_MM_MMX2}, - {"XVID-SSE2", 1, ff_idct_xvid_sse2, ff_ref_idct, SSE2_PERM, FF_MM_SSE2}, + {"SIMPLE-MMX", 1, ff_simple_idct_mmx, ff_ref_idct, MMX_SIMPLE_PERM, AV_CPU_FLAG_MMX}, + {"XVID-MMX", 1, ff_idct_xvid_mmx, ff_ref_idct, NO_PERM, AV_CPU_FLAG_MMX}, + {"XVID-MMX2", 1, ff_idct_xvid_mmx2, ff_ref_idct, NO_PERM, AV_CPU_FLAG_MMX2}, + {"XVID-SSE2", 1, ff_idct_xvid_sse2, ff_ref_idct, SSE2_PERM, AV_CPU_FLAG_SSE2}, #endif #if HAVE_ALTIVEC - {"altivecfdct", 0, fdct_altivec, ff_ref_fdct, NO_PERM, FF_MM_ALTIVEC}, + {"altivecfdct", 0, fdct_altivec, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_ALTIVEC}, #endif #if ARCH_BFIN @@ -187,7 +188,7 @@ static inline void mmx_emms(void) { #if HAVE_MMX - if (cpu_flags & FF_MM_MMX) + if (cpu_flags & AV_CPU_FLAG_MMX) __asm__ volatile ("emms\n\t"); #endif } @@ -554,7 +555,7 @@ int test_idct = 0, test_248_dct = 0; int c,i; int test=1; - cpu_flags = mm_support(); + cpu_flags = av_get_cpu_flags(); ff_ref_dct_init(); idct_mmx_init(); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dirac.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dirac.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dirac.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dirac.c 2010-11-06 17:21:27.000000000 +0000 @@ -269,7 +269,7 @@ if (parse_source_parameters(avctx, gb, source)) return -1; - if (av_check_image_size(source->width, source->height, 0, avctx)) + if (av_image_check_size(source->width, source->height, 0, avctx)) return -1; avcodec_set_dimensions(avctx, source->width, source->height); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dnxhddec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dnxhddec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dnxhddec.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dnxhddec.c 2010-11-06 17:21:27.000000000 +0000 @@ -306,7 +306,7 @@ } avctx->pix_fmt = PIX_FMT_YUV422P; - if (av_check_image_size(ctx->width, ctx->height, 0, avctx)) + if (av_image_check_size(ctx->width, ctx->height, 0, avctx)) return -1; avcodec_set_dimensions(avctx, ctx->width, ctx->height); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dpx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dpx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dpx.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dpx.c 2010-11-06 17:21:27.000000000 +0000 @@ -140,7 +140,7 @@ if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); - if (av_check_image_size(w, h, 0, avctx)) + if (av_image_check_size(w, h, 0, avctx)) return -1; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dsputil.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dsputil.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dsputil.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dsputil.c 2010-11-06 17:21:27.000000000 +0000 @@ -27,6 +27,7 @@ * DSP utils */ +#include "libavcore/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "simple_idct.h" @@ -1166,7 +1167,7 @@ CALL_2X_PIXELS(OPNAME ## _pixels16_x2_c , OPNAME ## _pixels8_x2_c , 8)\ CALL_2X_PIXELS(OPNAME ## _pixels16_y2_c , OPNAME ## _pixels8_y2_c , 8)\ CALL_2X_PIXELS(OPNAME ## _pixels16_xy2_c, OPNAME ## _pixels8_xy2_c, 8)\ -CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_c , OPNAME ## _pixels8_c , 8)\ +av_unused CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_c , OPNAME ## _pixels8_c , 8)\ CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_x2_c , OPNAME ## _no_rnd_pixels8_x2_c , 8)\ CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_y2_c , OPNAME ## _no_rnd_pixels8_y2_c , 8)\ CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_xy2_c, OPNAME ## _no_rnd_pixels8_xy2_c, 8)\ @@ -1180,6 +1181,9 @@ #undef op_avg #undef op_put +#define put_no_rnd_pixels8_c put_pixels8_c +#define put_no_rnd_pixels16_c put_pixels16_c + #define avg2(a,b) ((a+b+1)>>1) #define avg4(a,b,c,d) ((a+b+c+d+2)>>2) @@ -1762,10 +1766,6 @@ }\ }\ \ -static void OPNAME ## qpel8_mc00_c (uint8_t *dst, uint8_t *src, int stride){\ - OPNAME ## pixels8_c(dst, src, stride, 8);\ -}\ -\ static void OPNAME ## qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){\ uint8_t half[64];\ put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\ @@ -1944,9 +1944,6 @@ put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\ OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\ }\ -static void OPNAME ## qpel16_mc00_c (uint8_t *dst, uint8_t *src, int stride){\ - OPNAME ## pixels16_c(dst, src, stride, 16);\ -}\ \ static void OPNAME ## qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride){\ uint8_t half[256];\ @@ -2141,6 +2138,13 @@ #undef op_put #undef op_put_no_rnd +#define put_qpel8_mc00_c ff_put_pixels8x8_c +#define avg_qpel8_mc00_c ff_avg_pixels8x8_c +#define put_qpel16_mc00_c ff_put_pixels16x16_c +#define avg_qpel16_mc00_c ff_avg_pixels16x16_c +#define put_no_rnd_qpel8_mc00_c ff_put_pixels8x8_c +#define put_no_rnd_qpel16_mc00_c ff_put_pixels16x16_c + #if 1 #define H264_LOWPASS(OPNAME, OP, OP2) \ static av_unused void OPNAME ## h264_qpel2_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ @@ -2407,7 +2411,7 @@ }\ #define H264_MC(OPNAME, SIZE) \ -static void OPNAME ## h264_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\ +static av_unused void OPNAME ## h264_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\ }\ \ @@ -2565,6 +2569,11 @@ #undef op2_put #endif +#define put_h264_qpel8_mc00_c ff_put_pixels8x8_c +#define avg_h264_qpel8_mc00_c ff_avg_pixels8x8_c +#define put_h264_qpel16_mc00_c ff_put_pixels16x16_c +#define avg_h264_qpel16_mc00_c ff_avg_pixels16x16_c + static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int i; @@ -2583,31 +2592,18 @@ } } -#if CONFIG_CAVS_DECODER -/* AVS specific */ -void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) { +void ff_put_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride) { put_pixels8_c(dst, src, stride, 8); } -void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) { +void ff_avg_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride) { avg_pixels8_c(dst, src, stride, 8); } -void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) { +void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride) { put_pixels16_c(dst, src, stride, 16); } -void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) { +void ff_avg_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride) { avg_pixels16_c(dst, src, stride, 16); } -#endif /* CONFIG_CAVS_DECODER */ - -#if CONFIG_VC1_DECODER -/* VC-1 specific */ -void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { - put_pixels8_c(dst, src, stride, 8); -} -void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { - avg_pixels8_c(dst, src, stride, 8); -} -#endif /* CONFIG_VC1_DECODER */ #if CONFIG_RV40_DECODER static void put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){ @@ -2653,10 +2649,6 @@ } } -static void put_mspel8_mc00_c (uint8_t *dst, uint8_t *src, int stride){ - put_pixels8_c(dst, src, stride, 8); -} - static void put_mspel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){ uint8_t half[64]; wmv2_mspel8_h_lowpass(half, src, 8, stride, 8); @@ -4368,7 +4360,7 @@ c->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c; #endif - c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c; + c->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c; c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c; c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c; @@ -4433,9 +4425,6 @@ c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c; c->vp3_idct_dc_add= ff_vp3_idct_dc_add_c; } - if (CONFIG_VP6_DECODER) { - c->vp6_filter_diag4= ff_vp6_filter_diag4_c; - } c->h261_loop_filter= h261_loop_filter_c; @@ -4471,7 +4460,7 @@ c->sv_fmul_scalar[0] = sv_fmul_scalar_2_c; c->sv_fmul_scalar[1] = sv_fmul_scalar_4_c; - c->shrink[0]= ff_img_copy_plane; + c->shrink[0]= av_image_copy_plane; c->shrink[1]= ff_shrink22; c->shrink[2]= ff_shrink44; c->shrink[3]= ff_shrink88; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dsputil.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dsputil.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dsputil.h 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dsputil.h 2010-11-06 17:21:27.000000000 +0000 @@ -82,6 +82,11 @@ extern uint32_t ff_squareTbl[512]; extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP]; +void ff_put_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride); +void ff_avg_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride); +void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride); +void ff_avg_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride); + /* VP3 DSP functions */ void ff_vp3_idct_c(DCTELEM *block/* align 16*/); void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/); @@ -91,30 +96,23 @@ void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values); void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values); -/* VP6 DSP functions */ -void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride, - const int16_t *h_weights, const int16_t *v_weights); - /* Bink functions */ void ff_bink_idct_c (DCTELEM *block); void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block); void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); -/* CAVS functions */ -void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); -void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); -void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); -void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); - -/* VC1 functions */ -void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd); -void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd); - /* EA functions */ void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); /* 1/2^n downscaling functions from imgconvert.c */ +#if LIBAVCODEC_VERSION_MAJOR < 53 +/** + * @deprecated Use av_image_copy_plane() instead. + */ +attribute_deprecated void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); +#endif + void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); @@ -369,9 +367,6 @@ void (*vp3_v_loop_filter)(uint8_t *src, int stride, int *bounding_values); void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values); - void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, int stride, - const int16_t *h_weights,const int16_t *v_weights); - /* assume len is a multiple of 4, and arrays are 16-byte aligned */ void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize); void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len); @@ -617,11 +612,6 @@ */ #define emms_c() -/* should be defined by architectures supporting - one or more MultiMedia extension */ -int mm_support(void); -extern int mm_flags; - void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); @@ -649,12 +639,7 @@ __asm__ volatile ("emms;":::"memory"); } - -#define emms_c() \ -{\ - if (mm_flags & FF_MM_MMX)\ - emms();\ -} +#define emms_c() emms() #elif ARCH_ARM @@ -670,11 +655,6 @@ #define STRIDE_ALIGN 16 -#else - -#define mm_flags 0 -#define mm_support() 0 - #endif #ifndef STRIDE_ALIGN diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dv.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dv.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dv.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dv.c 2010-11-06 17:21:27.000000000 +0000 @@ -948,7 +948,7 @@ int mb_x, mb_y, c_offset, linesize, y_stride; uint8_t* y_ptr; uint8_t* dif; - uint8_t scratch[64]; + LOCAL_ALIGNED_8(uint8_t, scratch, [64]); EncBlockInfo enc_blks[5*DV_MAX_BPM]; PutBitContext pbs[5*DV_MAX_BPM]; PutBitContext* pb; @@ -1081,6 +1081,8 @@ const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; DVVideoContext *s = avctx->priv_data; + const uint8_t* vsc_pack; + int apt, is16_9; s->sys = ff_dv_frame_profile(s->sys, buf, buf_size); if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) { @@ -1114,6 +1116,14 @@ *data_size = sizeof(AVFrame); *(AVFrame*)data = s->picture; + /* Determine the codec's sample_aspect ratio from the packet */ + vsc_pack = buf + 80*5 + 48 + 5; + if ( *vsc_pack == dv_video_control ) { + apt = buf[4] & 0x07; + is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || (!apt && (vsc_pack[2] & 0x07) == 0x07))); + avctx->sample_aspect_ratio = s->sys->sar[is16_9]; + } + return s->sys->frame_size; } #endif /* CONFIG_DVVIDEO_DECODER */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dvdata.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dvdata.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dvdata.c 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dvdata.c 2010-11-06 17:21:27.000000000 +0000 @@ -52,7 +52,7 @@ .ltc_divisor = 30, .height = 480, .width = 720, - .sar = {{10, 11}, {40, 33}}, + .sar = {{8, 9}, {32, 27}}, .work_chunks = &work_chunks_dv25ntsc[0], .idct_factor = &dv_idct_factor_sd[0], .pix_fmt = PIX_FMT_YUV411P, @@ -72,7 +72,7 @@ .ltc_divisor = 25, .height = 576, .width = 720, - .sar = {{59, 54}, {118, 81}}, + .sar = {{16, 15}, {64, 45}}, .work_chunks = &work_chunks_dv25pal[0], .idct_factor = &dv_idct_factor_sd[0], .pix_fmt = PIX_FMT_YUV420P, @@ -92,7 +92,7 @@ .ltc_divisor = 25, .height = 576, .width = 720, - .sar = {{59, 54}, {118, 81}}, + .sar = {{16, 15}, {64, 45}}, .work_chunks = &work_chunks_dv25pal411[0], .idct_factor = &dv_idct_factor_sd[0], .pix_fmt = PIX_FMT_YUV411P, @@ -112,7 +112,7 @@ .ltc_divisor = 30, .height = 480, .width = 720, - .sar = {{10, 11}, {40, 33}}, + .sar = {{8, 9}, {32, 27}}, .work_chunks = &work_chunks_dv50ntsc[0], .idct_factor = &dv_idct_factor_sd[0], .pix_fmt = PIX_FMT_YUV422P, @@ -132,7 +132,7 @@ .ltc_divisor = 25, .height = 576, .width = 720, - .sar = {{59, 54}, {118, 81}}, + .sar = {{16, 15}, {64, 45}}, .work_chunks = &work_chunks_dv50pal[0], .idct_factor = &dv_idct_factor_sd[0], .pix_fmt = PIX_FMT_YUV422P, @@ -232,7 +232,7 @@ .ltc_divisor = 25, .height = 576, .width = 720, - .sar = {{59, 54}, {118, 81}}, + .sar = {{16, 15}, {64, 45}}, .work_chunks = &work_chunks_dv25pal[0], .idct_factor = &dv_idct_factor_sd[0], .pix_fmt = PIX_FMT_YUV420P, @@ -255,7 +255,7 @@ int stype = frame[80*5 + 48 + 3] & 0x1f; /* 576i50 25Mbps 4:1:1 is a special case */ - if (dsf == 1 && stype == 0 && frame[5] & 0x07) { + if (dsf == 1 && stype == 0 && frame[4] & 0x07 /* the APT field */) { return &dv_profiles[2]; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dxva2_h264.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dxva2_h264.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/dxva2_h264.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/dxva2_h264.c 2010-11-06 17:21:27.000000000 +0000 @@ -194,7 +194,7 @@ slice->first_mb_in_slice = (s->mb_y >> FIELD_OR_MBAFF_PICTURE) * s->mb_width + s->mb_x; slice->NumMbsForSlice = 0; /* XXX it is set once we have all slices */ - slice->BitOffsetToSliceData = get_bits_count(&s->gb) + 8; + slice->BitOffsetToSliceData = get_bits_count(&s->gb); slice->slice_type = ff_h264_get_slice_type(h); if (h->slice_type_fixed) slice->slice_type += 5; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/eacmv.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/eacmv.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/eacmv.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/eacmv.c 2010-11-06 17:21:27.000000000 +0000 @@ -157,7 +157,7 @@ return buf_size; } - if (av_check_image_size(s->width, s->height, 0, s->avctx)) + if (av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; /* shuffle */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/eamad.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/eamad.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/eamad.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/eamad.c 2010-11-06 17:21:27.000000000 +0000 @@ -261,7 +261,7 @@ buf += 16; if (avctx->width != s->width || avctx->height != s->height) { - if (av_check_image_size(s->width, s->height, 0, avctx) < 0) + if (av_image_check_size(s->width, s->height, 0, avctx) < 0) return -1; avcodec_set_dimensions(avctx, s->width, s->height); if (t->frame.data[0]) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/eatgv.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/eatgv.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/eatgv.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/eatgv.c 2010-11-06 17:21:27.000000000 +0000 @@ -276,7 +276,7 @@ } } - if (av_check_image_size(s->width, s->height, 0, avctx)) + if (av_image_check_size(s->width, s->height, 0, avctx)) return -1; /* shuffle */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/fft-test.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/fft-test.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/fft-test.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/fft-test.c 2010-11-06 17:21:27.000000000 +0000 @@ -186,7 +186,7 @@ for (i = 0; i < n; i++) { double e= fabsf(tab1[i] - (tab2[i] / scale)); if (e >= 1e-3) { - av_log(NULL, AV_LOG_ERROR, "ERROR %d: %f %f\n", + av_log(NULL, AV_LOG_ERROR, "ERROR %5d: %10.6f %10.6f\n", i, tab1[i], tab2[i]); err = 1; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ffv1.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ffv1.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ffv1.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ffv1.c 2010-11-06 17:21:27.000000000 +0000 @@ -32,10 +32,14 @@ #include "rangecoder.h" #include "golomb.h" #include "mathops.h" +#include "libavutil/avassert.h" #define MAX_PLANES 4 #define CONTEXT_SIZE 32 +#define MAX_QUANT_TABLES 8 +#define MAX_CONTEXT_INPUTS 5 + extern const uint8_t ff_log2_run[32]; static const int8_t quant3[256]={ @@ -213,17 +217,23 @@ } VlcState; typedef struct PlaneContext{ + int16_t quant_table[MAX_CONTEXT_INPUTS][256]; + int quant_table_index; int context_count; uint8_t (*state)[CONTEXT_SIZE]; VlcState *vlc_state; uint8_t interlace_bit_state[2]; } PlaneContext; +#define MAX_SLICES 256 + typedef struct FFV1Context{ AVCodecContext *avctx; RangeCoder c; GetBitContext gb; PutBitContext pb; + uint64_t rc_stat[256][2]; + uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2]; int version; int width, height; int chroma_h_shift, chroma_v_shift; @@ -233,13 +243,28 @@ int plane_count; int ac; ///< 1=range coder <-> 0=golomb rice PlaneContext plane[MAX_PLANES]; - int16_t quant_table[5][256]; + int16_t quant_table[MAX_CONTEXT_INPUTS][256]; + int16_t quant_tables[MAX_QUANT_TABLES][MAX_CONTEXT_INPUTS][256]; + int context_count[MAX_QUANT_TABLES]; uint8_t state_transition[256]; + uint8_t (*initial_states[MAX_QUANT_TABLES])[32]; int run_index; int colorspace; int_fast16_t *sample_buffer; + int gob_count; + + int quant_table_count; DSPContext dsp; + + struct FFV1Context *slice_context[MAX_SLICES]; + int slice_count; + int num_v_slices; + int num_h_slices; + int slice_width; + int slice_height; + int slice_x; + int slice_y; }FFV1Context; static av_always_inline int fold(int diff, int bits){ @@ -262,24 +287,75 @@ return mid_pred(L, L + T - LT, T); } -static inline int get_context(FFV1Context *f, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){ +static inline int get_context(PlaneContext *p, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){ const int LT= last[-1]; const int T= last[ 0]; const int RT= last[ 1]; const int L = src[-1]; - if(f->quant_table[3][127]){ + if(p->quant_table[3][127]){ const int TT= last2[0]; const int LL= src[-2]; - return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF] - +f->quant_table[3][(LL-L) & 0xFF] + f->quant_table[4][(TT-T) & 0xFF]; + return p->quant_table[0][(L-LT) & 0xFF] + p->quant_table[1][(LT-T) & 0xFF] + p->quant_table[2][(T-RT) & 0xFF] + +p->quant_table[3][(LL-L) & 0xFF] + p->quant_table[4][(TT-T) & 0xFF]; }else - return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF]; + return p->quant_table[0][(L-LT) & 0xFF] + p->quant_table[1][(LT-T) & 0xFF] + p->quant_table[2][(T-RT) & 0xFF]; +} + +static void find_best_state(uint8_t best_state[256][256], const uint8_t one_state[256]){ + int i,j,k,m; + double l2tab[256]; + + for(i=1; i<256; i++) + l2tab[i]= log2(i/256.0); + + for(i=0; i<256; i++){ + double best_len[256]; + double p= i/256.0; + + for(j=0; j<256; j++) + best_len[j]= 1<<30; + + for(j=FFMAX(i-10,1); jplane[plane_index]; RangeCoder * const c= &s->c; int x; @@ -452,7 +529,7 @@ for(x=0; xac){ - put_symbol_inline(c, p->state[context], diff, 1); + if(s->flags & CODEC_FLAG_PASS1){ + put_symbol_inline(c, p->state[context], diff, 1, s->rc_stat, s->rc_stat2[p->quant_table_index][context]); + }else{ + put_symbol_inline(c, p->state[context], diff, 1, NULL, NULL); + } }else{ if(context == 0) run_mode=1; @@ -591,31 +672,50 @@ put_symbol(c, state, i-last-1, 0); } +static void write_quant_tables(RangeCoder *c, int16_t quant_table[MAX_CONTEXT_INPUTS][256]){ + int i; + for(i=0; i<5; i++) + write_quant_table(c, quant_table[i]); +} + static void write_header(FFV1Context *f){ uint8_t state[CONTEXT_SIZE]; - int i; - RangeCoder * const c= &f->c; + int i, j; + RangeCoder * const c= &f->slice_context[0]->c; memset(state, 128, sizeof(state)); - put_symbol(c, state, f->version, 0); - put_symbol(c, state, f->ac, 0); - if(f->ac>1){ - for(i=1; i<256; i++){ - f->state_transition[i]=ver2_state[i]; - put_symbol(c, state, ver2_state[i] - c->one_state[i], 1); + if(f->version < 2){ + put_symbol(c, state, f->version, 0); + put_symbol(c, state, f->ac, 0); + if(f->ac>1){ + for(i=1; i<256; i++){ + put_symbol(c, state, f->state_transition[i] - c->one_state[i], 1); + } } - } - put_symbol(c, state, f->colorspace, 0); //YUV cs type - if(f->version>0) - put_symbol(c, state, f->avctx->bits_per_raw_sample, 0); - put_rac(c, state, 1); //chroma planes - put_symbol(c, state, f->chroma_h_shift, 0); - put_symbol(c, state, f->chroma_v_shift, 0); - put_rac(c, state, 0); //no transparency plane + put_symbol(c, state, f->colorspace, 0); //YUV cs type + if(f->version>0) + put_symbol(c, state, f->avctx->bits_per_raw_sample, 0); + put_rac(c, state, 1); //chroma planes + put_symbol(c, state, f->chroma_h_shift, 0); + put_symbol(c, state, f->chroma_v_shift, 0); + put_rac(c, state, 0); //no transparency plane - for(i=0; i<5; i++) - write_quant_table(c, f->quant_table[i]); + write_quant_tables(c, f->quant_table); + }else{ + put_symbol(c, state, f->slice_count, 0); + for(i=0; islice_count; i++){ + FFV1Context *fs= f->slice_context[i]; + put_symbol(c, state, (fs->slice_x +1)*f->num_h_slices / f->width , 0); + put_symbol(c, state, (fs->slice_y +1)*f->num_v_slices / f->height , 0); + put_symbol(c, state, (fs->slice_width +1)*f->num_h_slices / f->width -1, 0); + put_symbol(c, state, (fs->slice_height+1)*f->num_v_slices / f->height-1, 0); + for(j=0; jplane_count; j++){ + put_symbol(c, state, f->plane[j].quant_table_index, 0); + av_assert0(f->plane[j].quant_table_index == f->avctx->context_model); + } + } + } } #endif /* CONFIG_FFV1_ENCODER */ @@ -631,70 +731,237 @@ s->height= avctx->height; assert(s->width && s->height); + //defaults + s->num_h_slices=1; + s->num_v_slices=1; - s->sample_buffer = av_malloc(6 * (s->width+6) * sizeof(*s->sample_buffer)); - if (!s->sample_buffer) - return AVERROR(ENOMEM); return 0; } +static int init_slice_state(FFV1Context *f){ + int i, j; + + for(i=0; islice_count; i++){ + FFV1Context *fs= f->slice_context[i]; + for(j=0; jplane_count; j++){ + PlaneContext * const p= &fs->plane[j]; + + if(fs->ac){ + if(!p-> state) p-> state= av_malloc(CONTEXT_SIZE*p->context_count*sizeof(uint8_t)); + if(!p-> state) + return AVERROR(ENOMEM); + }else{ + if(!p->vlc_state) p->vlc_state= av_malloc(p->context_count*sizeof(VlcState)); + if(!p->vlc_state) + return AVERROR(ENOMEM); + } + } + + if (fs->ac>1){ + //FIXME only redo if state_transition changed + for(j=1; j<256; j++){ + fs->c.one_state [ j]= fs->state_transition[j]; + fs->c.zero_state[256-j]= 256-fs->c.one_state [j]; + } + } + } + + return 0; +} + +static av_cold int init_slice_contexts(FFV1Context *f){ + int i; + + f->slice_count= f->num_h_slices * f->num_v_slices; + + for(i=0; islice_count; i++){ + FFV1Context *fs= av_mallocz(sizeof(*fs)); + int sx= i % f->num_h_slices; + int sy= i / f->num_h_slices; + int sxs= f->avctx->width * sx / f->num_h_slices; + int sxe= f->avctx->width *(sx+1) / f->num_h_slices; + int sys= f->avctx->height* sy / f->num_v_slices; + int sye= f->avctx->height*(sy+1) / f->num_v_slices; + f->slice_context[i]= fs; + memcpy(fs, f, sizeof(*fs)); + memset(fs->rc_stat2, 0, sizeof(fs->rc_stat2)); + + fs->slice_width = sxe - sxs; + fs->slice_height= sye - sys; + fs->slice_x = sxs; + fs->slice_y = sys; + + fs->sample_buffer = av_malloc(6 * (fs->width+6) * sizeof(*fs->sample_buffer)); + if (!fs->sample_buffer) + return AVERROR(ENOMEM); + } + return 0; +} + +static int allocate_initial_states(FFV1Context *f){ + int i; + + for(i=0; iquant_table_count; i++){ + f->initial_states[i]= av_malloc(f->context_count[i]*sizeof(*f->initial_states[i])); + if(!f->initial_states[i]) + return AVERROR(ENOMEM); + memset(f->initial_states[i], 128, f->context_count[i]*sizeof(*f->initial_states[i])); + } + return 0; +} + #if CONFIG_FFV1_ENCODER +static int write_extra_header(FFV1Context *f){ + RangeCoder * const c= &f->c; + uint8_t state[CONTEXT_SIZE]; + int i, j, k; + uint8_t state2[32][CONTEXT_SIZE]; + + memset(state2, 128, sizeof(state2)); + memset(state, 128, sizeof(state)); + + f->avctx->extradata= av_malloc(f->avctx->extradata_size= 10000 + (11*11*5*5*5+11*11*11)*32); + ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size); + ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); + + put_symbol(c, state, f->version, 0); + put_symbol(c, state, f->ac, 0); + if(f->ac>1){ + for(i=1; i<256; i++){ + put_symbol(c, state, f->state_transition[i] - c->one_state[i], 1); + } + } + put_symbol(c, state, f->colorspace, 0); //YUV cs type + put_symbol(c, state, f->avctx->bits_per_raw_sample, 0); + put_rac(c, state, 1); //chroma planes + put_symbol(c, state, f->chroma_h_shift, 0); + put_symbol(c, state, f->chroma_v_shift, 0); + put_rac(c, state, 0); //no transparency plane + put_symbol(c, state, f->num_h_slices-1, 0); + put_symbol(c, state, f->num_v_slices-1, 0); + + put_symbol(c, state, f->quant_table_count, 0); + for(i=0; iquant_table_count; i++) + write_quant_tables(c, f->quant_tables[i]); + + for(i=0; iquant_table_count; i++){ + for(j=0; jcontext_count[i]*CONTEXT_SIZE; j++) + if(f->initial_states[i] && f->initial_states[i][0][j] != 128) + break; + if(jcontext_count[i]*CONTEXT_SIZE){ + put_rac(c, state, 1); + for(j=0; jcontext_count[i]; j++){ + for(k=0; kinitial_states[i][j-1][k] : 128; + put_symbol(c, state2[k], (int8_t)(f->initial_states[i][j][k]-pred), 1); + } + } + }else{ + put_rac(c, state, 0); + } + } + + f->avctx->extradata_size= ff_rac_terminate(c); + + return 0; +} + +static int sort_stt(FFV1Context *s, uint8_t stt[256]){ + int i,i2,changed,print=0; + + do{ + changed=0; + for(i=12; i<244; i++){ + for(i2=i+1; i2<245 && i2rc_stat[old][0]*-log2((256-(new))/256.0)\ + +s->rc_stat[old][1]*-log2( (new) /256.0) + +#define COST2(old, new) \ + COST(old, new)\ + +COST(256-(old), 256-(new)) + + double size0= COST2(i, i ) + COST2(i2, i2); + double sizeX= COST2(i, i2) + COST2(i2, i ); + if(sizeX < size0 && i!=128 && i2!=128){ + int j; + FFSWAP(int, stt[ i], stt[ i2]); + FFSWAP(int, s->rc_stat[i ][0],s->rc_stat[ i2][0]); + FFSWAP(int, s->rc_stat[i ][1],s->rc_stat[ i2][1]); + if(i != 256-i2){ + FFSWAP(int, stt[256-i], stt[256-i2]); + FFSWAP(int, s->rc_stat[256-i][0],s->rc_stat[256-i2][0]); + FFSWAP(int, s->rc_stat[256-i][1],s->rc_stat[256-i2][1]); + } + for(j=1; j<256; j++){ + if (stt[j] == i ) stt[j] = i2; + else if(stt[j] == i2) stt[j] = i ; + if(i != 256-i2){ + if (stt[256-j] == 256-i ) stt[256-j] = 256-i2; + else if(stt[256-j] == 256-i2) stt[256-j] = 256-i ; + } + } + print=changed=1; + } + } + } + }while(changed); + return print; +} + static av_cold int encode_init(AVCodecContext *avctx) { FFV1Context *s = avctx->priv_data; - int i; + int i, j, k, m; common_init(avctx); s->version=0; s->ac= avctx->coder_type ? 2:0; + if(s->ac>1) + for(i=1; i<256; i++) + s->state_transition[i]=ver2_state[i]; + s->plane_count=2; for(i=0; i<256; i++){ + s->quant_table_count=2; if(avctx->bits_per_raw_sample <=8){ - s->quant_table[0][i]= quant11[i]; - s->quant_table[1][i]= 11*quant11[i]; - if(avctx->context_model==0){ - s->quant_table[2][i]= 11*11*quant11[i]; - s->quant_table[3][i]= - s->quant_table[4][i]=0; - }else{ - s->quant_table[2][i]= 11*11*quant5 [i]; - s->quant_table[3][i]= 5*11*11*quant5 [i]; - s->quant_table[4][i]= 5*5*11*11*quant5 [i]; - } + s->quant_tables[0][0][i]= quant11[i]; + s->quant_tables[0][1][i]= 11*quant11[i]; + s->quant_tables[0][2][i]= 11*11*quant11[i]; + s->quant_tables[1][0][i]= quant11[i]; + s->quant_tables[1][1][i]= 11*quant11[i]; + s->quant_tables[1][2][i]= 11*11*quant5 [i]; + s->quant_tables[1][3][i]= 5*11*11*quant5 [i]; + s->quant_tables[1][4][i]= 5*5*11*11*quant5 [i]; }else{ - s->quant_table[0][i]= quant9_10bit[i]; - s->quant_table[1][i]= 11*quant9_10bit[i]; - if(avctx->context_model==0){ - s->quant_table[2][i]= 11*11*quant9_10bit[i]; - s->quant_table[3][i]= - s->quant_table[4][i]=0; - }else{ - s->quant_table[2][i]= 11*11*quant5_10bit[i]; - s->quant_table[3][i]= 5*11*11*quant5_10bit[i]; - s->quant_table[4][i]= 5*5*11*11*quant5_10bit[i]; - } + s->quant_tables[0][0][i]= quant9_10bit[i]; + s->quant_tables[0][1][i]= 11*quant9_10bit[i]; + s->quant_tables[0][2][i]= 11*11*quant9_10bit[i]; + s->quant_tables[1][0][i]= quant9_10bit[i]; + s->quant_tables[1][1][i]= 11*quant9_10bit[i]; + s->quant_tables[1][2][i]= 11*11*quant5_10bit[i]; + s->quant_tables[1][3][i]= 5*11*11*quant5_10bit[i]; + s->quant_tables[1][4][i]= 5*5*11*11*quant5_10bit[i]; } } + s->context_count[0]= (11*11*11+1)/2; + s->context_count[1]= (11*11*5*5*5+1)/2; + memcpy(s->quant_table, s->quant_tables[avctx->context_model], sizeof(s->quant_table)); for(i=0; iplane_count; i++){ PlaneContext * const p= &s->plane[i]; - if(avctx->context_model==0){ - p->context_count= (11*11*11+1)/2; - }else{ - p->context_count= (11*11*5*5*5+1)/2; - } - - if(s->ac){ - if(!p->state) p->state= av_malloc(CONTEXT_SIZE*p->context_count*sizeof(uint8_t)); - }else{ - if(!p->vlc_state) p->vlc_state= av_malloc(p->context_count*sizeof(VlcState)); - } + memcpy(p->quant_table, s->quant_table, sizeof(p->quant_table)); + p->quant_table_index= avctx->context_model; + p->context_count= s->context_count[p->quant_table_index]; } + if(allocate_initial_states(s) < 0) + return AVERROR(ENOMEM); + avctx->coded_frame= &s->picture; switch(avctx->pix_fmt){ case PIX_FMT_YUV444P16: @@ -708,7 +975,7 @@ av_log(avctx, AV_LOG_ERROR, "bits_per_raw_sample of more than 8 needs -coder 1 currently\n"); return -1; } - s->version= 1; + s->version= FFMAX(s->version, 1); case PIX_FMT_YUV444P: case PIX_FMT_YUV422P: case PIX_FMT_YUV420P: @@ -727,43 +994,167 @@ s->picture_number=0; + if(avctx->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)){ + for(i=0; iquant_table_count; i++){ + s->rc_stat2[i]= av_mallocz(s->context_count[i]*sizeof(*s->rc_stat2[i])); + if(!s->rc_stat2[i]) + return AVERROR(ENOMEM); + } + } + if(avctx->stats_in){ + char *p= avctx->stats_in; + uint8_t best_state[256][256]; + int gob_count=0; + char *next; + + av_assert0(s->version>=2); + + for(;;){ + for(j=0; j<256; j++){ + for(i=0; i<2; i++){ + s->rc_stat[j][i]= strtol(p, &next, 0); + if(next==p){ + av_log(avctx, AV_LOG_ERROR, "2Pass file invalid at %d %d [%s]\n", j,i,p); + return -1; + } + p=next; + } + } + for(i=0; iquant_table_count; i++){ + for(j=0; jcontext_count[i]; j++){ + for(k=0; k<32; k++){ + for(m=0; m<2; m++){ + s->rc_stat2[i][j][k][m]= strtol(p, &next, 0); + if(next==p){ + av_log(avctx, AV_LOG_ERROR, "2Pass file invalid at %d %d %d %d [%s]\n", i,j,k,m,p); + return -1; + } + p=next; + } + } + } + } + gob_count= strtol(p, &next, 0); + if(next==p || gob_count <0){ + av_log(avctx, AV_LOG_ERROR, "2Pass file invalid\n"); + return -1; + } + p=next; + while(*p=='\n' || *p==' ') p++; + if(p[0]==0) break; + } + sort_stt(s, s->state_transition); + + find_best_state(best_state, s->state_transition); + + for(i=0; iquant_table_count; i++){ + for(j=0; jcontext_count[i]; j++){ + for(k=0; k<32; k++){ + double p= 128; + if(s->rc_stat2[i][j][k][0]+s->rc_stat2[i][j][k][1]){ + p=256.0*s->rc_stat2[i][j][k][1] / (s->rc_stat2[i][j][k][0]+s->rc_stat2[i][j][k][1]); + } + s->initial_states[i][j][k]= best_state[av_clip(round(p), 1, 255)][av_clip((s->rc_stat2[i][j][k][0]+s->rc_stat2[i][j][k][1])/gob_count, 0, 255)]; + } + } + } + } + + if(s->version>1){ + s->num_h_slices=2; + s->num_v_slices=2; + write_extra_header(s); + } + + if(init_slice_contexts(s) < 0) + return -1; + if(init_slice_state(s) < 0) + return -1; + +#define STATS_OUT_SIZE 1024*1024*6 + if(avctx->flags & CODEC_FLAG_PASS1){ + avctx->stats_out= av_mallocz(STATS_OUT_SIZE); + for(i=0; iquant_table_count; i++){ + for(j=0; jslice_count; j++){ + FFV1Context *sf= s->slice_context[j]; + av_assert0(!sf->rc_stat2[i]); + sf->rc_stat2[i]= av_mallocz(s->context_count[i]*sizeof(*sf->rc_stat2[i])); + if(!sf->rc_stat2[i]) + return AVERROR(ENOMEM); + } + } + } + return 0; } #endif /* CONFIG_FFV1_ENCODER */ static void clear_state(FFV1Context *f){ - int i, j; - - for(i=0; iplane_count; i++){ - PlaneContext *p= &f->plane[i]; - - p->interlace_bit_state[0]= 128; - p->interlace_bit_state[1]= 128; + int i, si, j; - for(j=0; jcontext_count; j++){ - if(f->ac){ - memset(p->state[j], 128, sizeof(uint8_t)*CONTEXT_SIZE); + for(si=0; sislice_count; si++){ + FFV1Context *fs= f->slice_context[si]; + for(i=0; iplane_count; i++){ + PlaneContext *p= &fs->plane[i]; + + p->interlace_bit_state[0]= 128; + p->interlace_bit_state[1]= 128; + + if(fs->ac){ + if(f->initial_states[p->quant_table_index]){ + memcpy(p->state, f->initial_states[p->quant_table_index], CONTEXT_SIZE*p->context_count); + }else + memset(p->state, 128, CONTEXT_SIZE*p->context_count); }else{ - p->vlc_state[j].drift= 0; - p->vlc_state[j].error_sum= 4; //FFMAX((RANGE + 32)/64, 2); - p->vlc_state[j].bias= 0; - p->vlc_state[j].count= 1; + for(j=0; jcontext_count; j++){ + p->vlc_state[j].drift= 0; + p->vlc_state[j].error_sum= 4; //FFMAX((RANGE + 32)/64, 2); + p->vlc_state[j].bias= 0; + p->vlc_state[j].count= 1; + } } } } } #if CONFIG_FFV1_ENCODER +static int encode_slice(AVCodecContext *c, void *arg){ + FFV1Context *fs= *(void**)arg; + FFV1Context *f= fs->avctx->priv_data; + int width = fs->slice_width; + int height= fs->slice_height; + int x= fs->slice_x; + int y= fs->slice_y; + AVFrame * const p= &f->picture; + + if(f->colorspace==0){ + const int chroma_width = -((-width )>>f->chroma_h_shift); + const int chroma_height= -((-height)>>f->chroma_v_shift); + const int cx= x>>f->chroma_h_shift; + const int cy= y>>f->chroma_v_shift; + + encode_plane(fs, p->data[0] + x + y*p->linesize[0], width, height, p->linesize[0], 0); + + encode_plane(fs, p->data[1] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1); + encode_plane(fs, p->data[2] + cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1); + }else{ + encode_rgb_frame(fs, (uint32_t*)(p->data[0]) + x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4); + } + emms_c(); + + return 0; +} + static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ FFV1Context *f = avctx->priv_data; - RangeCoder * const c= &f->c; + RangeCoder * const c= &f->slice_context[0]->c; AVFrame *pict = data; - const int width= f->width; - const int height= f->height; AVFrame * const p= &f->picture; int used_count= 0; uint8_t keystate=128; + uint8_t *buf_p; + int i; ff_init_range_encoder(c, buf, buf_size); ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); @@ -774,6 +1165,7 @@ if(avctx->gop_size==0 || f->picture_number % avctx->gop_size == 0){ put_rac(c, &keystate, 1); p->key_frame= 1; + f->gob_count++; write_header(f); clear_state(f); }else{ @@ -784,7 +1176,7 @@ if(!f->ac){ used_count += ff_rac_terminate(c); //printf("pos=%d\n", used_count); - init_put_bits(&f->pb, buf + used_count, buf_size - used_count); + init_put_bits(&f->slice_context[0]->pb, buf + used_count, buf_size - used_count); }else if (f->ac>1){ int i; for(i=1; i<256; i++){ @@ -793,42 +1185,119 @@ } } - if(f->colorspace==0){ - const int chroma_width = -((-width )>>f->chroma_h_shift); - const int chroma_height= -((-height)>>f->chroma_v_shift); + for(i=1; islice_count; i++){ + FFV1Context *fs= f->slice_context[i]; + uint8_t *start= buf + (buf_size-used_count)*i/f->slice_count; + int len= buf_size/f->slice_count; - encode_plane(f, p->data[0], width, height, p->linesize[0], 0); - - encode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1); - encode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1); - }else{ - encode_rgb_frame(f, (uint32_t*)(p->data[0]), width, height, p->linesize[0]/4); + if(fs->ac){ + ff_init_range_encoder(&fs->c, start, len); + }else{ + init_put_bits(&fs->pb, start, len); + } } - emms_c(); + avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void*)); - f->picture_number++; + buf_p=buf; + for(i=0; islice_count; i++){ + FFV1Context *fs= f->slice_context[i]; + int bytes; - if(f->ac){ - return ff_rac_terminate(c); - }else{ - flush_put_bits(&f->pb); //nicer padding FIXME - return used_count + (put_bits_count(&f->pb)+7)/8; - } + if(fs->ac){ + uint8_t state=128; + put_rac(&fs->c, &state, 0); + bytes= ff_rac_terminate(&fs->c); + }else{ + flush_put_bits(&fs->pb); //nicer padding FIXME + bytes= used_count + (put_bits_count(&fs->pb)+7)/8; + used_count= 0; + } + if(i>0){ + av_assert0(bytes < buf_size/f->slice_count); + memmove(buf_p, fs->ac ? fs->c.bytestream_start : fs->pb.buf, bytes); + av_assert0(bytes < (1<<24)); + AV_WB24(buf_p+bytes, bytes); + bytes+=3; + } + buf_p += bytes; + } + + if((avctx->flags&CODEC_FLAG_PASS1) && (f->picture_number&31)==0){ + int j, k, m; + char *p= avctx->stats_out; + char *end= p + STATS_OUT_SIZE; + + memset(f->rc_stat, 0, sizeof(f->rc_stat)); + for(i=0; iquant_table_count; i++) + memset(f->rc_stat2[i], 0, f->context_count[i]*sizeof(*f->rc_stat2[i])); + + for(j=0; jslice_count; j++){ + FFV1Context *fs= f->slice_context[j]; + for(i=0; i<256; i++){ + f->rc_stat[i][0] += fs->rc_stat[i][0]; + f->rc_stat[i][1] += fs->rc_stat[i][1]; + } + for(i=0; iquant_table_count; i++){ + for(k=0; kcontext_count[i]; k++){ + for(m=0; m<32; m++){ + f->rc_stat2[i][k][m][0] += fs->rc_stat2[i][k][m][0]; + f->rc_stat2[i][k][m][1] += fs->rc_stat2[i][k][m][1]; + } + } + } + } + + for(j=0; j<256; j++){ + snprintf(p, end-p, "%"PRIu64" %"PRIu64" ", f->rc_stat[j][0], f->rc_stat[j][1]); + p+= strlen(p); + } + snprintf(p, end-p, "\n"); + + for(i=0; iquant_table_count; i++){ + for(j=0; jcontext_count[i]; j++){ + for(m=0; m<32; m++){ + snprintf(p, end-p, "%"PRIu64" %"PRIu64" ", f->rc_stat2[i][j][m][0], f->rc_stat2[i][j][m][1]); + p+= strlen(p); + } + } + } + snprintf(p, end-p, "%d\n", f->gob_count); + } else if(avctx->flags&CODEC_FLAG_PASS1) + avctx->stats_out[0] = '\0'; + + f->picture_number++; + return buf_p-buf; } #endif /* CONFIG_FFV1_ENCODER */ static av_cold int common_end(AVCodecContext *avctx){ FFV1Context *s = avctx->priv_data; - int i; + int i, j; - for(i=0; iplane_count; i++){ - PlaneContext *p= &s->plane[i]; + for(j=0; jslice_count; j++){ + FFV1Context *fs= s->slice_context[j]; + for(i=0; iplane_count; i++){ + PlaneContext *p= &fs->plane[i]; - av_freep(&p->state); - av_freep(&p->vlc_state); + av_freep(&p->state); + av_freep(&p->vlc_state); + } + av_freep(&fs->sample_buffer); } - av_freep(&s->sample_buffer); + av_freep(&avctx->stats_out); + for(j=0; jquant_table_count; j++){ + av_freep(&s->initial_states[j]); + for(i=0; islice_count; i++){ + FFV1Context *sf= s->slice_context[i]; + av_freep(&sf->rc_stat2[j]); + } + av_freep(&s->rc_stat2[j]); + } + + for(i=0; islice_count; i++){ + av_freep(&s->slice_context[i]); + } return 0; } @@ -844,13 +1313,14 @@ for(x=0; xcontext_count); if(s->ac){ diff= get_symbol_inline(c, p->state[context], 1); @@ -967,6 +1437,34 @@ } } +static int decode_slice(AVCodecContext *c, void *arg){ + FFV1Context *fs= *(void**)arg; + FFV1Context *f= fs->avctx->priv_data; + int width = fs->slice_width; + int height= fs->slice_height; + int x= fs->slice_x; + int y= fs->slice_y; + AVFrame * const p= &f->picture; + + av_assert1(width && height); + if(f->colorspace==0){ + const int chroma_width = -((-width )>>f->chroma_h_shift); + const int chroma_height= -((-height)>>f->chroma_v_shift); + const int cx= x>>f->chroma_h_shift; + const int cy= y>>f->chroma_v_shift; + decode_plane(fs, p->data[0] + x + y*p->linesize[0], width, height, p->linesize[0], 0); + + decode_plane(fs, p->data[1] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1); + decode_plane(fs, p->data[2] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[2], 1); + }else{ + decode_rgb_frame(fs, (uint32_t*)p->data[0] + x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4); + } + + emms_c(); + + return 0; +} + static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ int v; int i=0; @@ -995,13 +1493,31 @@ return 2*v - 1; } -static int read_header(FFV1Context *f){ - uint8_t state[CONTEXT_SIZE]; - int i, context_count; +static int read_quant_tables(RangeCoder *c, int16_t quant_table[MAX_CONTEXT_INPUTS][256]){ + int i; + int context_count=1; + + for(i=0; i<5; i++){ + context_count*= read_quant_table(c, quant_table[i], context_count); + if(context_count > 32768U){ + return -1; + } + } + return (context_count+1)/2; +} + +static int read_extra_header(FFV1Context *f){ RangeCoder * const c= &f->c; + uint8_t state[CONTEXT_SIZE]; + int i, j, k; + uint8_t state2[32][CONTEXT_SIZE]; + memset(state2, 128, sizeof(state2)); memset(state, 128, sizeof(state)); + ff_init_range_decoder(c, f->avctx->extradata, f->avctx->extradata_size); + ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); + f->version= get_symbol(c, state, 0); f->ac= f->avctx->coder_type= get_symbol(c, state, 0); if(f->ac>1){ @@ -1010,13 +1526,70 @@ } } f->colorspace= get_symbol(c, state, 0); //YUV cs type - if(f->version>0) - f->avctx->bits_per_raw_sample= get_symbol(c, state, 0); + f->avctx->bits_per_raw_sample= get_symbol(c, state, 0); get_rac(c, state); //no chroma = false f->chroma_h_shift= get_symbol(c, state, 0); f->chroma_v_shift= get_symbol(c, state, 0); get_rac(c, state); //transparency plane f->plane_count= 2; + f->num_h_slices= 1 + get_symbol(c, state, 0); + f->num_v_slices= 1 + get_symbol(c, state, 0); + if(f->num_h_slices > (unsigned)f->width || f->num_v_slices > (unsigned)f->height){ + av_log(f->avctx, AV_LOG_ERROR, "too many slices\n"); + return -1; + } + + f->quant_table_count= get_symbol(c, state, 0); + if(f->quant_table_count > (unsigned)MAX_QUANT_TABLES) + return -1; + for(i=0; iquant_table_count; i++){ + if((f->context_count[i]= read_quant_tables(c, f->quant_tables[i])) < 0){ + av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n"); + return -1; + } + } + + if(allocate_initial_states(f) < 0) + return AVERROR(ENOMEM); + + for(i=0; iquant_table_count; i++){ + if(get_rac(c, state)){ + for(j=0; jcontext_count[i]; j++){ + for(k=0; kinitial_states[i][j-1][k] : 128; + f->initial_states[i][j][k]= (pred+get_symbol(c, state2[k], 1))&0xFF; + } + } + } + } + + return 0; +} + +static int read_header(FFV1Context *f){ + uint8_t state[CONTEXT_SIZE]; + int i, j, context_count; + RangeCoder * const c= &f->slice_context[0]->c; + + memset(state, 128, sizeof(state)); + + if(f->version < 2){ + f->version= get_symbol(c, state, 0); + f->ac= f->avctx->coder_type= get_symbol(c, state, 0); + if(f->ac>1){ + for(i=1; i<256; i++){ + f->state_transition[i]= get_symbol(c, state, 1) + c->one_state[i]; + } + } + f->colorspace= get_symbol(c, state, 0); //YUV cs type + if(f->version>0) + f->avctx->bits_per_raw_sample= get_symbol(c, state, 0); + get_rac(c, state); //no chroma = false + f->chroma_h_shift= get_symbol(c, state, 0); + f->chroma_v_shift= get_symbol(c, state, 0); + get_rac(c, state); //transparency plane + f->plane_count= 2; + } if(f->colorspace==0){ if(f->avctx->bits_per_raw_sample<=8){ @@ -1052,26 +1625,60 @@ } //printf("%d %d %d\n", f->chroma_h_shift, f->chroma_v_shift,f->avctx->pix_fmt); - - context_count=1; - for(i=0; i<5; i++){ - context_count*= read_quant_table(c, f->quant_table[i], context_count); - if(context_count < 0 || context_count > 32768){ - av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n"); - return -1; + if(f->version < 2){ + context_count= read_quant_tables(c, f->quant_table); + if(context_count < 0){ + av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n"); + return -1; } + }else{ + f->slice_count= get_symbol(c, state, 0); + if(f->slice_count > (unsigned)MAX_SLICES) + return -1; } - context_count= (context_count+1)/2; - for(i=0; iplane_count; i++){ - PlaneContext * const p= &f->plane[i]; + for(j=0; jslice_count; j++){ + FFV1Context *fs= f->slice_context[j]; + fs->ac= f->ac; + + if(f->version >= 2){ + fs->slice_x = get_symbol(c, state, 0) *f->width ; + fs->slice_y = get_symbol(c, state, 0) *f->height; + fs->slice_width =(get_symbol(c, state, 0)+1)*f->width + fs->slice_x; + fs->slice_height=(get_symbol(c, state, 0)+1)*f->height + fs->slice_y; + + fs->slice_x /= f->num_h_slices; + fs->slice_y /= f->num_v_slices; + fs->slice_width = fs->slice_width /f->num_h_slices - fs->slice_x; + fs->slice_height = fs->slice_height/f->num_v_slices - fs->slice_y; + if((unsigned)fs->slice_width > f->width || (unsigned)fs->slice_height > f->height) + return -1; + if( (unsigned)fs->slice_x + (uint64_t)fs->slice_width > f->width + || (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height) + return -1; + } - p->context_count= context_count; + for(i=0; iplane_count; i++){ + PlaneContext * const p= &fs->plane[i]; - if(f->ac){ - if(!p->state) p->state= av_malloc(CONTEXT_SIZE*p->context_count*sizeof(uint8_t)); - }else{ - if(!p->vlc_state) p->vlc_state= av_malloc(p->context_count*sizeof(VlcState)); + if(f->version >= 2){ + int idx=get_symbol(c, state, 0); + if(idx > (unsigned)f->quant_table_count){ + av_log(f->avctx, AV_LOG_ERROR, "quant_table_index out of range\n"); + return -1; + } + p->quant_table_index= idx; + memcpy(p->quant_table, f->quant_tables[idx], sizeof(p->quant_table)); + context_count= f->context_count[idx]; + }else{ + memcpy(p->quant_table, f->quant_table, sizeof(p->quant_table)); + } + + if(p->context_count < context_count){ + av_freep(&p->state); + av_freep(&p->vlc_state); + } + p->context_count= context_count; } } @@ -1080,10 +1687,16 @@ static av_cold int decode_init(AVCodecContext *avctx) { -// FFV1Context *s = avctx->priv_data; + FFV1Context *f = avctx->priv_data; common_init(avctx); + if(avctx->extradata && read_extra_header(f) < 0) + return -1; + + if(init_slice_contexts(f) < 0) + return -1; + return 0; } @@ -1091,12 +1704,11 @@ const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; FFV1Context *f = avctx->priv_data; - RangeCoder * const c= &f->c; - const int width= f->width; - const int height= f->height; + RangeCoder * const c= &f->slice_context[0]->c; AVFrame * const p= &f->picture; - int bytes_read; + int bytes_read, i; uint8_t keystate= 128; + const uint8_t *buf_p; AVFrame *picture = data; @@ -1109,6 +1721,9 @@ p->key_frame= 1; if(read_header(f) < 0) return -1; + if(init_slice_state(f) < 0) + return -1; + clear_state(f); }else{ p->key_frame= 0; @@ -1121,9 +1736,6 @@ } } - if(!f->plane[0].state && !f->plane[0].vlc_state) - return -1; - p->reference= 0; if(avctx->get_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); @@ -1137,24 +1749,28 @@ bytes_read = c->bytestream - c->bytestream_start - 1; if(bytes_read ==0) av_log(avctx, AV_LOG_ERROR, "error at end of AC stream\n"); //FIXME //printf("pos=%d\n", bytes_read); - init_get_bits(&f->gb, buf + bytes_read, buf_size - bytes_read); + init_get_bits(&f->slice_context[0]->gb, buf + bytes_read, buf_size - bytes_read); } else { bytes_read = 0; /* avoid warning */ } - if(f->colorspace==0){ - const int chroma_width = -((-width )>>f->chroma_h_shift); - const int chroma_height= -((-height)>>f->chroma_v_shift); - decode_plane(f, p->data[0], width, height, p->linesize[0], 0); - - decode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1); - decode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1); - }else{ - decode_rgb_frame(f, (uint32_t*)p->data[0], width, height, p->linesize[0]/4); + buf_p= buf + buf_size; + for(i=f->slice_count-1; i>0; i--){ + FFV1Context *fs= f->slice_context[i]; + int v= AV_RB24(buf_p-3)+3; + if(buf_p - buf <= v){ + av_log(avctx, AV_LOG_ERROR, "Slice pointer chain broken\n"); + return -1; + } + buf_p -= v; + if(fs->ac){ + ff_init_range_decoder(&fs->c, buf_p, v); + }else{ + init_get_bits(&fs->gb, buf_p, v); + } } - emms_c(); - + avctx->execute(avctx, decode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void*)); f->picture_number++; *picture= *p; @@ -1163,14 +1779,7 @@ *data_size = sizeof(AVFrame); - if(f->ac){ - bytes_read= c->bytestream - c->bytestream_start - 1; - if(bytes_read ==0) av_log(f->avctx, AV_LOG_ERROR, "error at end of frame\n"); - }else{ - bytes_read+= (get_bits_count(&f->gb)+7)/8; - } - - return bytes_read; + return buf_size; } AVCodec ffv1_decoder = { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/flacdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/flacdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/flacdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/flacdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -581,18 +581,27 @@ return -1; } - if (fi.channels != s->channels) { + if (s->channels && fi.channels != s->channels) { av_log(s->avctx, AV_LOG_ERROR, "switching channel layout mid-stream " "is not supported\n"); return -1; } + s->channels = s->avctx->channels = fi.channels; s->ch_mode = fi.ch_mode; - if (fi.bps && fi.bps != s->bps) { + if (!s->bps && !fi.bps) { + av_log(s->avctx, AV_LOG_ERROR, "bps not found in STREAMINFO or frame header\n"); + return -1; + } + if (!fi.bps) { + fi.bps = s->bps; + } else if (s->bps && fi.bps != s->bps) { av_log(s->avctx, AV_LOG_ERROR, "switching bps mid-stream is not " "supported\n"); return -1; } + s->bps = s->avctx->bits_per_raw_sample = fi.bps; + if (s->bps > 16) { s->avctx->sample_fmt = SAMPLE_FMT_S32; s->sample_shift = 32 - s->bps; @@ -603,6 +612,8 @@ s->is32 = 0; } + if (!s->max_blocksize) + s->max_blocksize = FLAC_MAX_BLOCKSIZE; if (fi.blocksize > s->max_blocksize) { av_log(s->avctx, AV_LOG_ERROR, "blocksize %d > %d\n", fi.blocksize, s->max_blocksize); @@ -610,14 +621,25 @@ } s->blocksize = fi.blocksize; + if (!s->samplerate && !fi.samplerate) { + av_log(s->avctx, AV_LOG_ERROR, "sample rate not found in STREAMINFO" + " or frame header\n"); + return -1; + } if (fi.samplerate == 0) { fi.samplerate = s->samplerate; - } else if (fi.samplerate != s->samplerate) { + } else if (s->samplerate && fi.samplerate != s->samplerate) { av_log(s->avctx, AV_LOG_WARNING, "sample rate changed from %d to %d\n", s->samplerate, fi.samplerate); } s->samplerate = s->avctx->sample_rate = fi.samplerate; + if (!s->got_streaminfo) { + allocate_buffers(s); + s->got_streaminfo = 1; + dump_headers(s->avctx, (FLACStreaminfo *)s); + } + // dump_headers(s->avctx, (FLACStreaminfo *)s); /* subframes */ @@ -650,7 +672,9 @@ *data_size=0; if (s->max_framesize == 0) { - s->max_framesize= FFMAX(4, buf_size); // should hopefully be enough for the first header + s->max_framesize = + ff_flac_get_max_frame_size(s->max_blocksize ? s->max_blocksize : FLAC_MAX_BLOCKSIZE, + FLAC_MAX_CHANNELS, 32); s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/flacenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/flacenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/flacenc.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/flacenc.c 2010-11-06 17:21:27.000000000 +0000 @@ -288,7 +288,7 @@ s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level]; /* set compression option overrides from AVCodecContext */ -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_USE_LPC /* for compatibility with deprecated AVCodecContext.use_lpc */ if (avctx->use_lpc == 0) { s->options.lpc_type = AV_LPC_TYPE_FIXED; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/flicvideo.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/flicvideo.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/flicvideo.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/flicvideo.c 2010-11-06 17:21:27.000000000 +0000 @@ -159,7 +159,7 @@ int pixel_skip; int pixel_countdown; unsigned char *pixels; - int pixel_limit; + unsigned int pixel_limit; s->frame.reference = 1; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; @@ -253,10 +253,13 @@ av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets); } else if ((line_packets & 0xC000) == 0x8000) { // "last byte" opcode - pixels[y_ptr + s->frame.linesize[0] - 1] = line_packets & 0xff; + pixel_ptr= y_ptr + s->frame.linesize[0] - 1; + CHECK_PIXEL_PTR(0); + pixels[pixel_ptr] = line_packets & 0xff; } else { compressed_lines--; pixel_ptr = y_ptr; + CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { /* account for the skip bytes */ @@ -268,7 +271,7 @@ byte_run = -byte_run; palette_idx1 = buf[stream_ptr++]; palette_idx2 = buf[stream_ptr++]; - CHECK_PIXEL_PTR(byte_run); + CHECK_PIXEL_PTR(byte_run * 2); for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { pixels[pixel_ptr++] = palette_idx1; pixels[pixel_ptr++] = palette_idx2; @@ -298,6 +301,7 @@ stream_ptr += 2; while (compressed_lines > 0) { pixel_ptr = y_ptr; + CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; line_packets = buf[stream_ptr++]; if (line_packets > 0) { @@ -453,7 +457,7 @@ int pixel_countdown; unsigned char *pixels; int pixel; - int pixel_limit; + unsigned int pixel_limit; s->frame.reference = 1; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; @@ -503,6 +507,7 @@ } else { compressed_lines--; pixel_ptr = y_ptr; + CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { /* account for the skip bytes */ @@ -514,13 +519,13 @@ byte_run = -byte_run; pixel = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; - CHECK_PIXEL_PTR(byte_run); + CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { *((signed short*)(&pixels[pixel_ptr])) = pixel; pixel_ptr += 2; } } else { - CHECK_PIXEL_PTR(byte_run); + CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; @@ -611,7 +616,7 @@ if (byte_run > 0) { pixel = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; - CHECK_PIXEL_PTR(byte_run); + CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++) { *((signed short*)(&pixels[pixel_ptr])) = pixel; pixel_ptr += 2; @@ -622,7 +627,7 @@ } } else { /* copy pixels if byte_run < 0 */ byte_run = -byte_run; - CHECK_PIXEL_PTR(byte_run); + CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++) { *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]); stream_ptr += 2; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/flvdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/flvdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/flvdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/flvdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -83,7 +83,7 @@ width = height = 0; break; } - if(av_check_image_size(width, height, 0, s->avctx)) + if(av_image_check_size(width, height, 0, s->avctx)) return -1; s->width = width; s->height = height; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/fraps.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/fraps.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/fraps.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/fraps.c 2010-11-06 17:21:27.000000000 +0000 @@ -155,7 +155,7 @@ case 0: default: /* Fraps v0 is a reordered YUV420 */ - avctx->pix_fmt = PIX_FMT_YUV420P; + avctx->pix_fmt = PIX_FMT_YUVJ420P; if ( (buf_size != avctx->width*avctx->height*3/2+header_size) && (buf_size != header_size) ) { @@ -240,7 +240,7 @@ * Fraps v2 is Huffman-coded YUV420 planes * Fraps v4 is virtually the same */ - avctx->pix_fmt = PIX_FMT_YUV420P; + avctx->pix_fmt = PIX_FMT_YUVJ420P; planes = 3; f->reference = 1; f->buffer_hints = FF_BUFFER_HINTS_VALID | diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/g722.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/g722.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/g722.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/g722.c 2010-11-06 17:21:27.000000000 +0000 @@ -0,0 +1,385 @@ +/* + * G.722 ADPCM audio encoder/decoder + * + * Copyright (c) CMU 1993 Computer Science, Speech Group + * Chengxiang Lu and Alex Hauptmann + * Copyright (c) 2005 Steve Underwood + * Copyright (c) 2009 Kenan Gillet + * Copyright (c) 2010 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * + * G.722 ADPCM audio codec + * + * This G.722 decoder is a bit-exact implementation of the ITU G.722 + * specification for all three specified bitrates - 64000bps, 56000bps + * and 48000bps. It passes the ITU tests. + * + * @note For the 56000bps and 48000bps bitrates, the lowest 1 or 2 bits + * respectively of each byte are ignored. + */ + +#include "avcodec.h" +#include "mathops.h" +#include "get_bits.h" + +#define PREV_SAMPLES_BUF_SIZE 1024 + +typedef struct { + int16_t prev_samples[PREV_SAMPLES_BUF_SIZE]; ///< memory of past decoded samples + int prev_samples_pos; ///< the number of values in prev_samples + + /** + * The band[0] and band[1] correspond respectively to the lower band and higher band. + */ + struct G722Band { + int16_t s_predictor; ///< predictor output value + int32_t s_zero; ///< previous output signal from zero predictor + int8_t part_reconst_mem[2]; ///< signs of previous partially reconstructed signals + int16_t prev_qtzd_reconst; ///< previous quantized reconstructed signal (internal value, using low_inv_quant4) + int16_t pole_mem[2]; ///< second-order pole section coefficient buffer + int32_t diff_mem[6]; ///< quantizer difference signal memory + int16_t zero_mem[6]; ///< Seventh-order zero section coefficient buffer + int16_t log_factor; ///< delayed 2-logarithmic quantizer factor + int16_t scale_factor; ///< delayed quantizer scale factor + } band[2]; +} G722Context; + + +static const int8_t sign_lookup[2] = { -1, 1 }; + +static const int16_t inv_log2_table[32] = { + 2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383, + 2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834, + 2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371, + 3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008 +}; +static const int16_t high_log_factor_step[2] = { 798, -214 }; +static const int16_t high_inv_quant[4] = { -926, -202, 926, 202 }; +/** + * low_log_factor_step[index] == wl[rl42[index]] + */ +static const int16_t low_log_factor_step[16] = { + -60, 3042, 1198, 538, 334, 172, 58, -30, + 3042, 1198, 538, 334, 172, 58, -30, -60 +}; +static const int16_t low_inv_quant4[16] = { + 0, -2557, -1612, -1121, -786, -530, -323, -150, + 2557, 1612, 1121, 786, 530, 323, 150, 0 +}; + +/** + * quadrature mirror filter (QMF) coefficients + * + * ITU-T G.722 Table 11 + */ +static const int16_t qmf_coeffs[12] = { + 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11, +}; + + +/** + * adaptive predictor + * + * @param cur_diff the dequantized and scaled delta calculated from the + * current codeword + */ +static void do_adaptive_prediction(struct G722Band *band, const int cur_diff) +{ + int sg[2], limit, i, cur_qtzd_reconst; + + const int cur_part_reconst = band->s_zero + cur_diff < 0; + + sg[0] = sign_lookup[cur_part_reconst != band->part_reconst_mem[0]]; + sg[1] = sign_lookup[cur_part_reconst == band->part_reconst_mem[1]]; + band->part_reconst_mem[1] = band->part_reconst_mem[0]; + band->part_reconst_mem[0] = cur_part_reconst; + + band->pole_mem[1] = av_clip((sg[0] * av_clip(band->pole_mem[0], -8191, 8191) >> 5) + + (sg[1] << 7) + (band->pole_mem[1] * 127 >> 7), -12288, 12288); + + limit = 15360 - band->pole_mem[1]; + band->pole_mem[0] = av_clip(-192 * sg[0] + (band->pole_mem[0] * 255 >> 8), -limit, limit); + + + if (cur_diff) { + for (i = 0; i < 6; i++) + band->zero_mem[i] = ((band->zero_mem[i]*255) >> 8) + + ((band->diff_mem[i]^cur_diff) < 0 ? -128 : 128); + } else + for (i = 0; i < 6; i++) + band->zero_mem[i] = (band->zero_mem[i]*255) >> 8; + + for (i = 5; i > 0; i--) + band->diff_mem[i] = band->diff_mem[i-1]; + band->diff_mem[0] = av_clip_int16(cur_diff << 1); + + band->s_zero = 0; + for (i = 5; i >= 0; i--) + band->s_zero += (band->zero_mem[i]*band->diff_mem[i]) >> 15; + + + cur_qtzd_reconst = av_clip_int16((band->s_predictor + cur_diff) << 1); + band->s_predictor = av_clip_int16(band->s_zero + + (band->pole_mem[0] * cur_qtzd_reconst >> 15) + + (band->pole_mem[1] * band->prev_qtzd_reconst >> 15)); + band->prev_qtzd_reconst = cur_qtzd_reconst; +} + +static int inline linear_scale_factor(const int log_factor) +{ + const int wd1 = inv_log2_table[(log_factor >> 6) & 31]; + const int shift = log_factor >> 11; + return shift < 0 ? wd1 >> -shift : wd1 << shift; +} + +static void update_low_predictor(struct G722Band *band, const int ilow) +{ + do_adaptive_prediction(band, + band->scale_factor * low_inv_quant4[ilow] >> 10); + + // quantizer adaptation + band->log_factor = av_clip((band->log_factor * 127 >> 7) + + low_log_factor_step[ilow], 0, 18432); + band->scale_factor = linear_scale_factor(band->log_factor - (8 << 11)); +} + +static void update_high_predictor(struct G722Band *band, const int dhigh, + const int ihigh) +{ + do_adaptive_prediction(band, dhigh); + + // quantizer adaptation + band->log_factor = av_clip((band->log_factor * 127 >> 7) + + high_log_factor_step[ihigh&1], 0, 22528); + band->scale_factor = linear_scale_factor(band->log_factor - (10 << 11)); +} + +static void apply_qmf(const int16_t *prev_samples, int *xout1, int *xout2) +{ + int i; + + *xout1 = 0; + *xout2 = 0; + for (i = 0; i < 12; i++) { + MAC16(*xout2, prev_samples[2*i ], qmf_coeffs[i ]); + MAC16(*xout1, prev_samples[2*i+1], qmf_coeffs[11-i]); + } +} + +static av_cold int g722_init(AVCodecContext * avctx) +{ + G722Context *c = avctx->priv_data; + + if (avctx->channels != 1) { + av_log(avctx, AV_LOG_ERROR, "Only mono tracks are allowed.\n"); + return AVERROR_INVALIDDATA; + } + avctx->sample_fmt = SAMPLE_FMT_S16; + + switch (avctx->bits_per_coded_sample) { + case 8: + case 7: + case 6: + break; + default: + av_log(avctx, AV_LOG_WARNING, "Unsupported bits_per_coded_sample [%d], " + "assuming 8\n", + avctx->bits_per_coded_sample); + case 0: + avctx->bits_per_coded_sample = 8; + break; + } + + c->band[0].scale_factor = 8; + c->band[1].scale_factor = 2; + c->prev_samples_pos = 22; + + if (avctx->lowres) + avctx->sample_rate /= 2; + + return 0; +} + +#if CONFIG_ADPCM_G722_DECODER +static const int16_t low_inv_quant5[32] = { + -35, -35, -2919, -2195, -1765, -1458, -1219, -1023, + -858, -714, -587, -473, -370, -276, -190, -110, + 2919, 2195, 1765, 1458, 1219, 1023, 858, 714, + 587, 473, 370, 276, 190, 110, 35, -35 +}; +static const int16_t low_inv_quant6[64] = { + -17, -17, -17, -17, -3101, -2738, -2376, -2088, + -1873, -1689, -1535, -1399, -1279, -1170, -1072, -982, + -899, -822, -750, -682, -618, -558, -501, -447, + -396, -347, -300, -254, -211, -170, -130, -91, + 3101, 2738, 2376, 2088, 1873, 1689, 1535, 1399, + 1279, 1170, 1072, 982, 899, 822, 750, 682, + 618, 558, 501, 447, 396, 347, 300, 254, + 211, 170, 130, 91, 54, 17, -54, -17 +}; + +static const int16_t *low_inv_quants[3] = { low_inv_quant6, low_inv_quant5, + low_inv_quant4 }; + +static int g722_decode_frame(AVCodecContext *avctx, void *data, + int *data_size, AVPacket *avpkt) +{ + G722Context *c = avctx->priv_data; + int16_t *out_buf = data; + int j, out_len = 0; + const int skip = 8 - avctx->bits_per_coded_sample; + const int16_t *quantizer_table = low_inv_quants[skip]; + GetBitContext gb; + + init_get_bits(&gb, avpkt->data, avpkt->size * 8); + + for (j = 0; j < avpkt->size; j++) { + int ilow, ihigh, rlow; + + ihigh = get_bits(&gb, 2); + ilow = get_bits(&gb, 6 - skip); + skip_bits(&gb, skip); + + rlow = av_clip((c->band[0].scale_factor * quantizer_table[ilow] >> 10) + + c->band[0].s_predictor, -16384, 16383); + + update_low_predictor(&c->band[0], ilow >> (2 - skip)); + + if (!avctx->lowres) { + const int dhigh = c->band[1].scale_factor * + high_inv_quant[ihigh] >> 10; + const int rhigh = av_clip(dhigh + c->band[1].s_predictor, + -16384, 16383); + int xout1, xout2; + + update_high_predictor(&c->band[1], dhigh, ihigh); + + c->prev_samples[c->prev_samples_pos++] = rlow + rhigh; + c->prev_samples[c->prev_samples_pos++] = rlow - rhigh; + apply_qmf(c->prev_samples + c->prev_samples_pos - 24, + &xout1, &xout2); + out_buf[out_len++] = av_clip_int16(xout1 >> 12); + out_buf[out_len++] = av_clip_int16(xout2 >> 12); + if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) { + memmove(c->prev_samples, + c->prev_samples + c->prev_samples_pos - 22, + 22 * sizeof(c->prev_samples[0])); + c->prev_samples_pos = 22; + } + } else + out_buf[out_len++] = rlow; + } + *data_size = out_len << 1; + return avpkt->size; +} + +AVCodec adpcm_g722_decoder = { + .name = "g722", + .type = AVMEDIA_TYPE_AUDIO, + .id = CODEC_ID_ADPCM_G722, + .priv_data_size = sizeof(G722Context), + .init = g722_init, + .decode = g722_decode_frame, + .long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"), + .max_lowres = 1, +}; +#endif + +#if CONFIG_ADPCM_G722_ENCODER +static const int16_t low_quant[33] = { + 35, 72, 110, 150, 190, 233, 276, 323, + 370, 422, 473, 530, 587, 650, 714, 786, + 858, 940, 1023, 1121, 1219, 1339, 1458, 1612, + 1765, 1980, 2195, 2557, 2919 +}; + +static inline void filter_samples(G722Context *c, const int16_t *samples, + int *xlow, int *xhigh) +{ + int xout1, xout2; + c->prev_samples[c->prev_samples_pos++] = samples[0]; + c->prev_samples[c->prev_samples_pos++] = samples[1]; + apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2); + *xlow = xout1 + xout2 >> 13; + *xhigh = xout1 - xout2 >> 13; + if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) { + memmove(c->prev_samples, + c->prev_samples + c->prev_samples_pos - 22, + 22 * sizeof(c->prev_samples[0])); + c->prev_samples_pos = 22; + } +} + +static inline int encode_high(const struct G722Band *state, int xhigh) +{ + int diff = av_clip_int16(xhigh - state->s_predictor); + int pred = 141 * state->scale_factor >> 8; + /* = diff >= 0 ? (diff < pred) + 2 : diff >= -pred */ + return ((diff ^ (diff >> (sizeof(diff)*8-1))) < pred) + 2*(diff >= 0); +} + +static inline int encode_low(const struct G722Band* state, int xlow) +{ + int diff = av_clip_int16(xlow - state->s_predictor); + /* = diff >= 0 ? diff : -(diff + 1) */ + int limit = diff ^ (diff >> (sizeof(diff)*8-1)); + int i = 0; + limit = limit + 1 << 10; + if (limit > low_quant[8] * state->scale_factor) + i = 9; + while (i < 29 && limit > low_quant[i] * state->scale_factor) + i++; + return (diff < 0 ? (i < 2 ? 63 : 33) : 61) - i; +} + +static int g722_encode_frame(AVCodecContext *avctx, + uint8_t *dst, int buf_size, void *data) +{ + G722Context *c = avctx->priv_data; + const int16_t *samples = data; + int i; + + for (i = 0; i < buf_size >> 1; i++) { + int xlow, xhigh, ihigh, ilow; + filter_samples(c, &samples[2*i], &xlow, &xhigh); + ihigh = encode_high(&c->band[1], xhigh); + ilow = encode_low(&c->band[0], xlow); + update_high_predictor(&c->band[1], c->band[1].scale_factor * + high_inv_quant[ihigh] >> 10, ihigh); + update_low_predictor(&c->band[0], ilow >> 2); + *dst++ = ihigh << 6 | ilow; + } + return i; +} + +AVCodec adpcm_g722_encoder = { + .name = "g722", + .type = AVMEDIA_TYPE_AUDIO, + .id = CODEC_ID_ADPCM_G722, + .priv_data_size = sizeof(G722Context), + .init = g722_init, + .encode = g722_encode_frame, + .long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"), + .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, +}; +#endif + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/g726.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/g726.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/g726.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/g726.c 2010-11-06 17:21:27.000000000 +0000 @@ -334,6 +334,11 @@ if (avctx->codec->decode) avctx->sample_fmt = SAMPLE_FMT_S16; + /* select a frame size that will end on a byte boundary and have a size of + approximately 1024 bytes */ + if (avctx->codec->encode) + avctx->frame_size = ((int[]){ 4096, 2736, 2048, 1640 })[index]; + return 0; } @@ -350,10 +355,11 @@ G726Context *c = avctx->priv_data; const short *samples = data; PutBitContext pb; + int i; init_put_bits(&pb, dst, 1024*1024); - for (; buf_size; buf_size--) + for (i = 0; i < avctx->frame_size; i++) put_bits(&pb, c->code_size, g726_encode(c, *samples++)); flush_put_bits(&pb); @@ -394,6 +400,7 @@ g726_encode_frame, g726_close, NULL, + .capabilities = CODEC_CAP_SMALL_LAST_FRAME, .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"), }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gifdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gifdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gifdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gifdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -297,7 +297,7 @@ return -1; avctx->pix_fmt = PIX_FMT_PAL8; - if (av_check_image_size(s->screen_width, s->screen_height, 0, avctx)) + if (av_image_check_size(s->screen_width, s->screen_height, 0, avctx)) return -1; avcodec_set_dimensions(avctx, s->screen_width, s->screen_height); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gsmdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gsmdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gsmdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gsmdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -24,26 +24,11 @@ * GSM decoder */ -#define ALT_BITSTREAM_READER_LE #include "avcodec.h" #include "get_bits.h" +#include "msgsmdec.h" -// input and output sizes in byte -#define GSM_BLOCK_SIZE 33 -#define GSM_MS_BLOCK_SIZE 65 -#define GSM_FRAME_SIZE 160 - -typedef struct { - // Contains first 120 elements from the previous frame - // (used by long_term_synth according to the "lag"), - // then in the following 160 elements the current - // frame is constructed. - int16_t ref_buf[280]; - int v[9]; - int lar[2][8]; - int lar_idx; - int msr; -} GSMContext; +#include "gsmdec_template.c" static av_cold int gsm_init(AVCodecContext *avctx) { @@ -65,199 +50,6 @@ return 0; } -static const int16_t dequant_tab[64][8] = { - { -28, -20, -12, -4, 4, 12, 20, 28}, - { -56, -40, -24, -8, 8, 24, 40, 56}, - { -84, -60, -36, -12, 12, 36, 60, 84}, - { -112, -80, -48, -16, 16, 48, 80, 112}, - { -140, -100, -60, -20, 20, 60, 100, 140}, - { -168, -120, -72, -24, 24, 72, 120, 168}, - { -196, -140, -84, -28, 28, 84, 140, 196}, - { -224, -160, -96, -32, 32, 96, 160, 224}, - { -252, -180, -108, -36, 36, 108, 180, 252}, - { -280, -200, -120, -40, 40, 120, 200, 280}, - { -308, -220, -132, -44, 44, 132, 220, 308}, - { -336, -240, -144, -48, 48, 144, 240, 336}, - { -364, -260, -156, -52, 52, 156, 260, 364}, - { -392, -280, -168, -56, 56, 168, 280, 392}, - { -420, -300, -180, -60, 60, 180, 300, 420}, - { -448, -320, -192, -64, 64, 192, 320, 448}, - { -504, -360, -216, -72, 72, 216, 360, 504}, - { -560, -400, -240, -80, 80, 240, 400, 560}, - { -616, -440, -264, -88, 88, 264, 440, 616}, - { -672, -480, -288, -96, 96, 288, 480, 672}, - { -728, -520, -312, -104, 104, 312, 520, 728}, - { -784, -560, -336, -112, 112, 336, 560, 784}, - { -840, -600, -360, -120, 120, 360, 600, 840}, - { -896, -640, -384, -128, 128, 384, 640, 896}, - { -1008, -720, -432, -144, 144, 432, 720, 1008}, - { -1120, -800, -480, -160, 160, 480, 800, 1120}, - { -1232, -880, -528, -176, 176, 528, 880, 1232}, - { -1344, -960, -576, -192, 192, 576, 960, 1344}, - { -1456, -1040, -624, -208, 208, 624, 1040, 1456}, - { -1568, -1120, -672, -224, 224, 672, 1120, 1568}, - { -1680, -1200, -720, -240, 240, 720, 1200, 1680}, - { -1792, -1280, -768, -256, 256, 768, 1280, 1792}, - { -2016, -1440, -864, -288, 288, 864, 1440, 2016}, - { -2240, -1600, -960, -320, 320, 960, 1600, 2240}, - { -2464, -1760, -1056, -352, 352, 1056, 1760, 2464}, - { -2688, -1920, -1152, -384, 384, 1152, 1920, 2688}, - { -2912, -2080, -1248, -416, 416, 1248, 2080, 2912}, - { -3136, -2240, -1344, -448, 448, 1344, 2240, 3136}, - { -3360, -2400, -1440, -480, 480, 1440, 2400, 3360}, - { -3584, -2560, -1536, -512, 512, 1536, 2560, 3584}, - { -4032, -2880, -1728, -576, 576, 1728, 2880, 4032}, - { -4480, -3200, -1920, -640, 640, 1920, 3200, 4480}, - { -4928, -3520, -2112, -704, 704, 2112, 3520, 4928}, - { -5376, -3840, -2304, -768, 768, 2304, 3840, 5376}, - { -5824, -4160, -2496, -832, 832, 2496, 4160, 5824}, - { -6272, -4480, -2688, -896, 896, 2688, 4480, 6272}, - { -6720, -4800, -2880, -960, 960, 2880, 4800, 6720}, - { -7168, -5120, -3072, -1024, 1024, 3072, 5120, 7168}, - { -8063, -5759, -3456, -1152, 1152, 3456, 5760, 8064}, - { -8959, -6399, -3840, -1280, 1280, 3840, 6400, 8960}, - { -9855, -7039, -4224, -1408, 1408, 4224, 7040, 9856}, - {-10751, -7679, -4608, -1536, 1536, 4608, 7680, 10752}, - {-11647, -8319, -4992, -1664, 1664, 4992, 8320, 11648}, - {-12543, -8959, -5376, -1792, 1792, 5376, 8960, 12544}, - {-13439, -9599, -5760, -1920, 1920, 5760, 9600, 13440}, - {-14335, -10239, -6144, -2048, 2048, 6144, 10240, 14336}, - {-16127, -11519, -6912, -2304, 2304, 6912, 11519, 16127}, - {-17919, -12799, -7680, -2560, 2560, 7680, 12799, 17919}, - {-19711, -14079, -8448, -2816, 2816, 8448, 14079, 19711}, - {-21503, -15359, -9216, -3072, 3072, 9216, 15359, 21503}, - {-23295, -16639, -9984, -3328, 3328, 9984, 16639, 23295}, - {-25087, -17919, -10752, -3584, 3584, 10752, 17919, 25087}, - {-26879, -19199, -11520, -3840, 3840, 11520, 19199, 26879}, - {-28671, -20479, -12288, -4096, 4096, 12288, 20479, 28671} -}; - -static void apcm_dequant_add(GetBitContext *gb, int16_t *dst) -{ - int i; - int maxidx = get_bits(gb, 6); - const int16_t *tab = dequant_tab[maxidx]; - for (i = 0; i < 13; i++) - dst[3*i] += tab[get_bits(gb, 3)]; -} - -static inline int gsm_mult(int a, int b) -{ - return (a * b + (1 << 14)) >> 15; -} - -static const uint16_t long_term_gain_tab[4] = { - 3277, 11469, 21299, 32767 -}; - -static void long_term_synth(int16_t *dst, int lag, int gain_idx) -{ - int i; - const int16_t *src = dst - lag; - uint16_t gain = long_term_gain_tab[gain_idx]; - for (i = 0; i < 40; i++) - dst[i] = gsm_mult(gain, src[i]); -} - -static inline int decode_log_area(int coded, int factor, int offset) -{ - coded <<= 10; - coded -= offset; - return gsm_mult(coded, factor) << 1; -} - -static av_noinline int get_rrp(int filtered) -{ - int abs = FFABS(filtered); - if (abs < 11059) abs <<= 1; - else if (abs < 20070) abs += 11059; - else abs = (abs >> 2) + 26112; - return filtered < 0 ? -abs : abs; -} - -static int filter_value(int in, int rrp[8], int v[9]) -{ - int i; - for (i = 7; i >= 0; i--) { - in -= gsm_mult(rrp[i], v[i]); - v[i + 1] = v[i] + gsm_mult(rrp[i], in); - } - v[0] = in; - return in; -} - -static void short_term_synth(GSMContext *ctx, int16_t *dst, const int16_t *src) -{ - int i; - int rrp[8]; - int *lar = ctx->lar[ctx->lar_idx]; - int *lar_prev = ctx->lar[ctx->lar_idx ^ 1]; - for (i = 0; i < 8; i++) - rrp[i] = get_rrp((lar_prev[i] >> 2) + (lar_prev[i] >> 1) + (lar[i] >> 2)); - for (i = 0; i < 13; i++) - dst[i] = filter_value(src[i], rrp, ctx->v); - - for (i = 0; i < 8; i++) - rrp[i] = get_rrp((lar_prev[i] >> 1) + (lar [i] >> 1)); - for (i = 13; i < 27; i++) - dst[i] = filter_value(src[i], rrp, ctx->v); - - for (i = 0; i < 8; i++) - rrp[i] = get_rrp((lar_prev[i] >> 2) + (lar [i] >> 1) + (lar[i] >> 2)); - for (i = 27; i < 40; i++) - dst[i] = filter_value(src[i], rrp, ctx->v); - - for (i = 0; i < 8; i++) - rrp[i] = get_rrp(lar[i]); - for (i = 40; i < 160; i++) - dst[i] = filter_value(src[i], rrp, ctx->v); - - ctx->lar_idx ^= 1; -} - -static int postprocess(int16_t *data, int msr) -{ - int i; - for (i = 0; i < 160; i++) { - msr = av_clip_int16(data[i] + gsm_mult(msr, 28180)); - data[i] = av_clip_int16(msr << 1) & ~7; - } - return msr; -} - -static int gsm_decode_block(AVCodecContext *avctx, int16_t *samples, - GetBitContext *gb) -{ - GSMContext *ctx = avctx->priv_data; - int i; - int16_t *ref_dst = ctx->ref_buf + 120; - int *lar = ctx->lar[ctx->lar_idx]; - lar[0] = decode_log_area(get_bits(gb, 6), 13107, 1 << 15); - lar[1] = decode_log_area(get_bits(gb, 6), 13107, 1 << 15); - lar[2] = decode_log_area(get_bits(gb, 5), 13107, (1 << 14) + 2048*2); - lar[3] = decode_log_area(get_bits(gb, 5), 13107, (1 << 14) - 2560*2); - lar[4] = decode_log_area(get_bits(gb, 4), 19223, (1 << 13) + 94*2); - lar[5] = decode_log_area(get_bits(gb, 4), 17476, (1 << 13) - 1792*2); - lar[6] = decode_log_area(get_bits(gb, 3), 31454, (1 << 12) - 341*2); - lar[7] = decode_log_area(get_bits(gb, 3), 29708, (1 << 12) - 1144*2); - - for (i = 0; i < 4; i++) { - int lag = get_bits(gb, 7); - int gain_idx = get_bits(gb, 2); - int offset = get_bits(gb, 2); - lag = av_clip(lag, 40, 120); - long_term_synth(ref_dst, lag, gain_idx); - apcm_dequant_add(gb, ref_dst + offset); - ref_dst += 40; - } - memcpy(ctx->ref_buf, ctx->ref_buf + 160, 120 * sizeof(*ctx->ref_buf)); - short_term_synth(ctx, samples, ctx->ref_buf + 120); - // for optimal speed this could be merged with short_term_synth, - // not done yet because it is a bit ugly - ctx->msr = postprocess(samples, ctx->msr); - return 0; -} - static int gsm_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { @@ -273,10 +65,10 @@ *data_size = 0; if(buf_size < avctx->block_align) return AVERROR_INVALIDDATA; - init_get_bits(&gb, buf, buf_size * 8); switch (avctx->codec_id) { case CODEC_ID_GSM: + init_get_bits(&gb, buf, buf_size * 8); if (get_bits(&gb, 4) != 0xd) av_log(avctx, AV_LOG_WARNING, "Missing GSM magic!\n"); res = gsm_decode_block(avctx, samples, &gb); @@ -284,10 +76,7 @@ return res; break; case CODEC_ID_GSM_MS: - res = gsm_decode_block(avctx, samples, &gb); - if (res < 0) - return res; - res = gsm_decode_block(avctx, samples + GSM_FRAME_SIZE, &gb); + res = ff_msgsm_decode_block(avctx, samples, buf); if (res < 0) return res; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gsmdec_data.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gsmdec_data.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gsmdec_data.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gsmdec_data.c 2010-11-06 17:21:27.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * gsm 06.10 decoder data + * Copyright (c) 2010 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include "gsmdec_data.h" + +const uint16_t ff_gsm_long_term_gain_tab[4] = { + 3277, 11469, 21299, 32767 +}; + +const int16_t ff_gsm_dequant_tab[64][8] = { + { -28, -20, -12, -4, 4, 12, 20, 28}, + { -56, -40, -24, -8, 8, 24, 40, 56}, + { -84, -60, -36, -12, 12, 36, 60, 84}, + { -112, -80, -48, -16, 16, 48, 80, 112}, + { -140, -100, -60, -20, 20, 60, 100, 140}, + { -168, -120, -72, -24, 24, 72, 120, 168}, + { -196, -140, -84, -28, 28, 84, 140, 196}, + { -224, -160, -96, -32, 32, 96, 160, 224}, + { -252, -180, -108, -36, 36, 108, 180, 252}, + { -280, -200, -120, -40, 40, 120, 200, 280}, + { -308, -220, -132, -44, 44, 132, 220, 308}, + { -336, -240, -144, -48, 48, 144, 240, 336}, + { -364, -260, -156, -52, 52, 156, 260, 364}, + { -392, -280, -168, -56, 56, 168, 280, 392}, + { -420, -300, -180, -60, 60, 180, 300, 420}, + { -448, -320, -192, -64, 64, 192, 320, 448}, + { -504, -360, -216, -72, 72, 216, 360, 504}, + { -560, -400, -240, -80, 80, 240, 400, 560}, + { -616, -440, -264, -88, 88, 264, 440, 616}, + { -672, -480, -288, -96, 96, 288, 480, 672}, + { -728, -520, -312, -104, 104, 312, 520, 728}, + { -784, -560, -336, -112, 112, 336, 560, 784}, + { -840, -600, -360, -120, 120, 360, 600, 840}, + { -896, -640, -384, -128, 128, 384, 640, 896}, + { -1008, -720, -432, -144, 144, 432, 720, 1008}, + { -1120, -800, -480, -160, 160, 480, 800, 1120}, + { -1232, -880, -528, -176, 176, 528, 880, 1232}, + { -1344, -960, -576, -192, 192, 576, 960, 1344}, + { -1456, -1040, -624, -208, 208, 624, 1040, 1456}, + { -1568, -1120, -672, -224, 224, 672, 1120, 1568}, + { -1680, -1200, -720, -240, 240, 720, 1200, 1680}, + { -1792, -1280, -768, -256, 256, 768, 1280, 1792}, + { -2016, -1440, -864, -288, 288, 864, 1440, 2016}, + { -2240, -1600, -960, -320, 320, 960, 1600, 2240}, + { -2464, -1760, -1056, -352, 352, 1056, 1760, 2464}, + { -2688, -1920, -1152, -384, 384, 1152, 1920, 2688}, + { -2912, -2080, -1248, -416, 416, 1248, 2080, 2912}, + { -3136, -2240, -1344, -448, 448, 1344, 2240, 3136}, + { -3360, -2400, -1440, -480, 480, 1440, 2400, 3360}, + { -3584, -2560, -1536, -512, 512, 1536, 2560, 3584}, + { -4032, -2880, -1728, -576, 576, 1728, 2880, 4032}, + { -4480, -3200, -1920, -640, 640, 1920, 3200, 4480}, + { -4928, -3520, -2112, -704, 704, 2112, 3520, 4928}, + { -5376, -3840, -2304, -768, 768, 2304, 3840, 5376}, + { -5824, -4160, -2496, -832, 832, 2496, 4160, 5824}, + { -6272, -4480, -2688, -896, 896, 2688, 4480, 6272}, + { -6720, -4800, -2880, -960, 960, 2880, 4800, 6720}, + { -7168, -5120, -3072, -1024, 1024, 3072, 5120, 7168}, + { -8063, -5759, -3456, -1152, 1152, 3456, 5760, 8064}, + { -8959, -6399, -3840, -1280, 1280, 3840, 6400, 8960}, + { -9855, -7039, -4224, -1408, 1408, 4224, 7040, 9856}, + {-10751, -7679, -4608, -1536, 1536, 4608, 7680, 10752}, + {-11647, -8319, -4992, -1664, 1664, 4992, 8320, 11648}, + {-12543, -8959, -5376, -1792, 1792, 5376, 8960, 12544}, + {-13439, -9599, -5760, -1920, 1920, 5760, 9600, 13440}, + {-14335, -10239, -6144, -2048, 2048, 6144, 10240, 14336}, + {-16127, -11519, -6912, -2304, 2304, 6912, 11519, 16127}, + {-17919, -12799, -7680, -2560, 2560, 7680, 12799, 17919}, + {-19711, -14079, -8448, -2816, 2816, 8448, 14079, 19711}, + {-21503, -15359, -9216, -3072, 3072, 9216, 15359, 21503}, + {-23295, -16639, -9984, -3328, 3328, 9984, 16639, 23295}, + {-25087, -17919, -10752, -3584, 3584, 10752, 17919, 25087}, + {-26879, -19199, -11520, -3840, 3840, 11520, 19199, 26879}, + {-28671, -20479, -12288, -4096, 4096, 12288, 20479, 28671} +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gsmdec_data.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gsmdec_data.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gsmdec_data.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gsmdec_data.h 2010-11-06 17:21:27.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * gsm 06.10 decoder data + * Copyright (c) 2010 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef GSMDEC_DATA +#define GSMDEC_DATA + +#include + +// input and output sizes in byte +#define GSM_BLOCK_SIZE 33 +#define GSM_MS_BLOCK_SIZE 65 +#define GSM_FRAME_SIZE 160 + +typedef struct { + // Contains first 120 elements from the previous frame + // (used by long_term_synth according to the "lag"), + // then in the following 160 elements the current + // frame is constructed. + int16_t ref_buf[280]; + int v[9]; + int lar[2][8]; + int lar_idx; + int msr; +} GSMContext; + +extern const uint16_t ff_gsm_long_term_gain_tab[4]; +extern const int16_t ff_gsm_dequant_tab[64][8]; + +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gsmdec_template.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gsmdec_template.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/gsmdec_template.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/gsmdec_template.c 2010-11-06 17:21:27.000000000 +0000 @@ -0,0 +1,150 @@ +/* + * gsm 06.10 decoder + * Copyright (c) 2010 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * GSM decoder + */ + +#include "get_bits.h" +#include "gsmdec_data.h" + +static void apcm_dequant_add(GetBitContext *gb, int16_t *dst) +{ + int i; + int maxidx = get_bits(gb, 6); + const int16_t *tab = ff_gsm_dequant_tab[maxidx]; + for (i = 0; i < 13; i++) + dst[3*i] += tab[get_bits(gb, 3)]; +} + +static inline int gsm_mult(int a, int b) +{ + return (a * b + (1 << 14)) >> 15; +} + +static void long_term_synth(int16_t *dst, int lag, int gain_idx) +{ + int i; + const int16_t *src = dst - lag; + uint16_t gain = ff_gsm_long_term_gain_tab[gain_idx]; + for (i = 0; i < 40; i++) + dst[i] = gsm_mult(gain, src[i]); +} + +static inline int decode_log_area(int coded, int factor, int offset) +{ + coded <<= 10; + coded -= offset; + return gsm_mult(coded, factor) << 1; +} + +static av_noinline int get_rrp(int filtered) +{ + int abs = FFABS(filtered); + if (abs < 11059) abs <<= 1; + else if (abs < 20070) abs += 11059; + else abs = (abs >> 2) + 26112; + return filtered < 0 ? -abs : abs; +} + +static int filter_value(int in, int rrp[8], int v[9]) +{ + int i; + for (i = 7; i >= 0; i--) { + in -= gsm_mult(rrp[i], v[i]); + v[i + 1] = v[i] + gsm_mult(rrp[i], in); + } + v[0] = in; + return in; +} + +static void short_term_synth(GSMContext *ctx, int16_t *dst, const int16_t *src) +{ + int i; + int rrp[8]; + int *lar = ctx->lar[ctx->lar_idx]; + int *lar_prev = ctx->lar[ctx->lar_idx ^ 1]; + for (i = 0; i < 8; i++) + rrp[i] = get_rrp((lar_prev[i] >> 2) + (lar_prev[i] >> 1) + (lar[i] >> 2)); + for (i = 0; i < 13; i++) + dst[i] = filter_value(src[i], rrp, ctx->v); + + for (i = 0; i < 8; i++) + rrp[i] = get_rrp((lar_prev[i] >> 1) + (lar [i] >> 1)); + for (i = 13; i < 27; i++) + dst[i] = filter_value(src[i], rrp, ctx->v); + + for (i = 0; i < 8; i++) + rrp[i] = get_rrp((lar_prev[i] >> 2) + (lar [i] >> 1) + (lar[i] >> 2)); + for (i = 27; i < 40; i++) + dst[i] = filter_value(src[i], rrp, ctx->v); + + for (i = 0; i < 8; i++) + rrp[i] = get_rrp(lar[i]); + for (i = 40; i < 160; i++) + dst[i] = filter_value(src[i], rrp, ctx->v); + + ctx->lar_idx ^= 1; +} + +static int postprocess(int16_t *data, int msr) +{ + int i; + for (i = 0; i < 160; i++) { + msr = av_clip_int16(data[i] + gsm_mult(msr, 28180)); + data[i] = av_clip_int16(msr << 1) & ~7; + } + return msr; +} + +static int gsm_decode_block(AVCodecContext *avctx, int16_t *samples, + GetBitContext *gb) +{ + GSMContext *ctx = avctx->priv_data; + int i; + int16_t *ref_dst = ctx->ref_buf + 120; + int *lar = ctx->lar[ctx->lar_idx]; + lar[0] = decode_log_area(get_bits(gb, 6), 13107, 1 << 15); + lar[1] = decode_log_area(get_bits(gb, 6), 13107, 1 << 15); + lar[2] = decode_log_area(get_bits(gb, 5), 13107, (1 << 14) + 2048*2); + lar[3] = decode_log_area(get_bits(gb, 5), 13107, (1 << 14) - 2560*2); + lar[4] = decode_log_area(get_bits(gb, 4), 19223, (1 << 13) + 94*2); + lar[5] = decode_log_area(get_bits(gb, 4), 17476, (1 << 13) - 1792*2); + lar[6] = decode_log_area(get_bits(gb, 3), 31454, (1 << 12) - 341*2); + lar[7] = decode_log_area(get_bits(gb, 3), 29708, (1 << 12) - 1144*2); + + for (i = 0; i < 4; i++) { + int lag = get_bits(gb, 7); + int gain_idx = get_bits(gb, 2); + int offset = get_bits(gb, 2); + lag = av_clip(lag, 40, 120); + long_term_synth(ref_dst, lag, gain_idx); + apcm_dequant_add(gb, ref_dst + offset); + ref_dst += 40; + } + memcpy(ctx->ref_buf, ctx->ref_buf + 160, 120 * sizeof(*ctx->ref_buf)); + short_term_synth(ctx, samples, ctx->ref_buf + 120); + // for optimal speed this could be merged with short_term_synth, + // not done yet because it is a bit ugly + ctx->msr = postprocess(samples, ctx->msr); + return 0; +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/h263dec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/h263dec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/h263dec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/h263dec.c 2010-11-06 17:21:27.000000000 +0000 @@ -25,6 +25,7 @@ * H.263 decoder. */ +#include "libavutil/cpu.h" #include "internal.h" #include "avcodec.h" #include "dsputil.h" @@ -556,7 +557,7 @@ #endif #if HAVE_MMX - if(s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (mm_flags & FF_MM_MMX)){ + if (s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) { avctx->idct_algo= FF_IDCT_XVIDMMX; avctx->coded_width= 0; // force reinit // dsputil_init(&s->dsp, avctx); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/h264.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/h264.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/h264.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/h264.c 2010-11-06 17:21:27.000000000 +0000 @@ -25,6 +25,7 @@ * @author Michael Niedermayer */ +#include "libavcore/imgutils.h" #include "internal.h" #include "dsputil.h" #include "avcodec.h" @@ -38,6 +39,7 @@ #include "rectangle.h" #include "thread.h" #include "vdpau_internal.h" +#include "libavutil/avassert.h" #include "cabac.h" @@ -1727,14 +1729,9 @@ chroma_dc_dequant_idct_c(h->mb + 16*16, h->chroma_qp[0], h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]); chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->chroma_qp[1], h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]); if(is_h264){ - idct_add = h->h264dsp.h264_idct_add; - idct_dc_add = h->h264dsp.h264_idct_dc_add; - for(i=16; i<16+8; i++){ - if(h->non_zero_count_cache[ scan8[i] ]) - idct_add (dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize); - else if(h->mb[i*16]) - idct_dc_add(dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize); - } + h->h264dsp.h264_idct_add8(dest, block_offset, + h->mb, uvlinesize, + h->non_zero_count_cache); }else{ for(i=16; i<16+8; i++){ if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ @@ -2226,7 +2223,7 @@ if(h->sps.frame_mbs_only_flag) s->height= 16*s->mb_height - 2*FFMIN(h->sps.crop_bottom, 7); else - s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3); + s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 7); if (s->context_initialized && ( s->width != s->avctx->width || s->height != s->avctx->height @@ -2245,8 +2242,7 @@ avcodec_set_dimensions(s->avctx, s->width, s->height); s->avctx->sample_aspect_ratio= h->sps.sar; - if(!s->avctx->sample_aspect_ratio.den) - s->avctx->sample_aspect_ratio.den = 1; + av_assert0(s->avctx->sample_aspect_ratio.den); if(h->sps.video_signal_type_present_flag){ s->avctx->color_range = h->sps.full_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; @@ -2326,6 +2322,7 @@ while(h->frame_num != h->prev_frame_num && h->frame_num != (h->prev_frame_num+1)%(1<sps.log2_max_frame_num)){ + Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL; av_log(h->s.avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num); if (ff_h264_frame_start(h) < 0) return -1; @@ -2336,6 +2333,21 @@ ff_thread_report_progress((AVFrame*)s->current_picture_ptr, INT_MAX, 1); ff_generate_sliding_window_mmcos(h); ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index); + /* Error concealment: if a ref is missing, copy the previous ref in its place. + * FIXME: avoiding a memcpy would be nice, but ref handling makes many assumptions + * about there being no actual duplicates. + * FIXME: this doesn't copy padding for out-of-frame motion vectors. Given we're + * concealing a lost frame, this probably isn't noticable by comparison, but it should + * be fixed. */ + if (h->short_ref_count) { + if (prev) { + av_image_copy(h->short_ref[0]->data, h->short_ref[0]->linesize, + (const uint8_t**)prev->data, prev->linesize, + s->avctx->pix_fmt, s->mb_width*16, s->mb_height*16); + h->short_ref[0]->poc = prev->poc+2; + } + h->short_ref[0]->frame_num = h->prev_frame_num; + } } /* See if we have a decoded first field looking for a pair... */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/h264_ps.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/h264_ps.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/h264_ps.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/h264_ps.c 2010-11-06 17:21:27.000000000 +0000 @@ -289,6 +289,7 @@ if(sps == NULL) return -1; + sps->time_offset_length = 24; sps->profile_idc= profile_idc; sps->level_idc= level_idc; @@ -342,7 +343,7 @@ sps->mb_width = get_ue_golomb(&s->gb) + 1; sps->mb_height= get_ue_golomb(&s->gb) + 1; if((unsigned)sps->mb_width >= INT_MAX/16 || (unsigned)sps->mb_height >= INT_MAX/16 || - av_check_image_size(16*sps->mb_width, 16*sps->mb_height, 0, h->s.avctx)){ + av_image_check_size(16*sps->mb_width, 16*sps->mb_height, 0, h->s.avctx)){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_width/height overflow\n"); goto fail; } @@ -372,7 +373,7 @@ if(sps->crop_left || sps->crop_top){ av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n"); } - if(sps->crop_right >= 8 || sps->crop_bottom >= (8>> !sps->frame_mbs_only_flag)){ + if(sps->crop_right >= 8 || sps->crop_bottom >= 8){ av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n"); } }else{ @@ -387,6 +388,9 @@ if (decode_vui_parameters(h, sps) < 0) goto fail; + if(!sps->sar.den) + sps->sar.den= 1; + if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d\n", sps_id, sps->profile_idc, sps->level_idc, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/iff.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/iff.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/iff.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/iff.c 2010-11-06 17:21:27.000000000 +0000 @@ -161,7 +161,7 @@ return AVERROR_INVALIDDATA; } - if ((err = av_check_image_size(avctx->width, avctx->height, 0, avctx))) + if ((err = av_image_check_size(avctx->width, avctx->height, 0, avctx))) return err; s->planesize = FFALIGN(avctx->width, 16) >> 3; // Align plane size in bits to word-boundary s->planebuf = av_malloc(s->planesize + FF_INPUT_BUFFER_PADDING_SIZE); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/imc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/imc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/imc.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/imc.c 2010-11-06 17:21:27.000000000 +0000 @@ -362,7 +362,7 @@ iacc = 0; for(j = (stream_format_code & 0x2)?4:0; j < BANDS; j++) { - cwlen = av_clip((int)((q->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6); + cwlen = av_clipf(((q->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6); q->bitsBandT[j] = cwlen; summer += q->bandWidthT[j] * cwlen; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/imgconvert.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/imgconvert.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/imgconvert.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/imgconvert.c 2010-11-06 17:21:27.000000000 +0000 @@ -501,13 +501,13 @@ #if LIBAVCODEC_VERSION_MAJOR < 53 int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width) { - return av_fill_image_linesizes(picture->linesize, pix_fmt, width); + return av_image_fill_linesizes(picture->linesize, pix_fmt, width); } int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, int height) { - return av_fill_image_pointers(picture->data, pix_fmt, height, ptr, picture->linesize); + return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture->linesize); } #endif @@ -515,13 +515,13 @@ enum PixelFormat pix_fmt, int width, int height) { - if(av_check_image_size(width, height, 0, NULL)) + if(av_image_check_size(width, height, 0, NULL)) return -1; - if (av_fill_image_linesizes(picture->linesize, pix_fmt, width)) + if (av_image_fill_linesizes(picture->linesize, pix_fmt, width)) return -1; - return av_fill_image_pointers(picture->data, pix_fmt, height, ptr, picture->linesize); + return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture->linesize); } int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height, @@ -597,7 +597,7 @@ int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height) { AVPicture dummy_pict; - if(av_check_image_size(width, height, 0, NULL)) + if(av_image_check_size(width, height, 0, NULL)) return -1; switch (pix_fmt) { case PIX_FMT_RGB8: @@ -781,100 +781,33 @@ return dst_pix_fmt; } +#if LIBAVCODEC_VERSION_MAJOR < 53 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height) { - if((!dst) || (!src)) - return; - for(;height > 0; height--) { - memcpy(dst, src, width); - dst += dst_wrap; - src += src_wrap; - } + av_image_copy_plane(dst, dst_wrap, src, src_wrap, width, height); } int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane) { - int bits; - const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; - const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; - - pf = &pix_fmt_info[pix_fmt]; - switch(pf->pixel_type) { - case FF_PIXEL_PACKED: - switch(pix_fmt) { - case PIX_FMT_YUYV422: - case PIX_FMT_UYVY422: - case PIX_FMT_RGB565BE: - case PIX_FMT_RGB565LE: - case PIX_FMT_RGB555BE: - case PIX_FMT_RGB555LE: - case PIX_FMT_RGB444BE: - case PIX_FMT_RGB444LE: - case PIX_FMT_BGR565BE: - case PIX_FMT_BGR565LE: - case PIX_FMT_BGR555BE: - case PIX_FMT_BGR555LE: - case PIX_FMT_BGR444BE: - case PIX_FMT_BGR444LE: - bits = 16; - break; - case PIX_FMT_UYYVYY411: - bits = 12; - break; - default: - bits = pf->depth * pf->nb_channels; - break; - } - return (width * bits + 7) >> 3; - break; - case FF_PIXEL_PLANAR: - if ((pix_fmt != PIX_FMT_NV12 && pix_fmt != PIX_FMT_NV21) && - (plane == 1 || plane == 2)) - width= -((-width)>>desc->log2_chroma_w); - - return (width * pf->depth + 7) >> 3; - break; - case FF_PIXEL_PALETTE: - if (plane == 0) - return width; - break; - } + return av_image_get_linesize(pix_fmt, width, plane); +} - return -1; +void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], + uint8_t *src_data[4], int src_linesize[4], + enum PixelFormat pix_fmt, int width, int height) +{ + av_image_copy(dst_data, dst_linesize, src_data, src_linesize, + pix_fmt, width, height); } +#endif void av_picture_copy(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int width, int height) { - int i; - const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; - const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; - - switch(pf->pixel_type) { - case FF_PIXEL_PACKED: - case FF_PIXEL_PLANAR: - for(i = 0; i < pf->nb_channels; i++) { - int h; - int bwidth = ff_get_plane_bytewidth(pix_fmt, width, i); - h = height; - if (i == 1 || i == 2) { - h= -((-height)>>desc->log2_chroma_h); - } - ff_img_copy_plane(dst->data[i], dst->linesize[i], - src->data[i], src->linesize[i], - bwidth, h); - } - break; - case FF_PIXEL_PALETTE: - ff_img_copy_plane(dst->data[0], dst->linesize[0], - src->data[0], src->linesize[0], - width, height); - /* copy the palette */ - memcpy(dst->data[1], src->data[1], 4*256); - break; - } + av_image_copy(dst->data, dst->linesize, src->data, + src->linesize, pix_fmt, width, height); } /* 2x2 -> 1x1 */ @@ -1242,7 +1175,9 @@ int i; if (pix_fmt != PIX_FMT_YUV420P && + pix_fmt != PIX_FMT_YUVJ420P && pix_fmt != PIX_FMT_YUV422P && + pix_fmt != PIX_FMT_YUVJ422P && pix_fmt != PIX_FMT_YUV444P && pix_fmt != PIX_FMT_YUV411P && pix_fmt != PIX_FMT_GRAY8) @@ -1253,11 +1188,13 @@ for(i=0;i<3;i++) { if (i == 1) { switch(pix_fmt) { + case PIX_FMT_YUVJ420P: case PIX_FMT_YUV420P: width >>= 1; height >>= 1; break; case PIX_FMT_YUV422P: + case PIX_FMT_YUVJ422P: width >>= 1; break; case PIX_FMT_YUV411P: diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/imgconvert.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/imgconvert.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/imgconvert.h 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/imgconvert.h 2010-11-06 17:21:27.000000000 +0000 @@ -33,9 +33,10 @@ attribute_deprecated int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, int height); -#endif +attribute_deprecated int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane); +#endif int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/indeo3.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/indeo3.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/indeo3.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/indeo3.c 2010-11-06 17:21:27.000000000 +0000 @@ -996,7 +996,7 @@ image_height = bytestream_get_le16(&buf_pos); image_width = bytestream_get_le16(&buf_pos); - if(av_check_image_size(image_width, image_height, 0, avctx)) + if(av_image_check_size(image_width, image_height, 0, avctx)) return -1; if (image_width != avctx->width || image_height != avctx->height) { int ret; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ituh263enc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ituh263enc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ituh263enc.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ituh263enc.c 2010-11-06 17:21:27.000000000 +0000 @@ -162,7 +162,7 @@ put_bits(&s->pb, 3, 7); put_bits(&s->pb,3,ufep); /* Update Full Extended PTYPE */ - if (format == 7) + if (format == 8) put_bits(&s->pb,3,6); /* Custom Source Format */ else put_bits(&s->pb, 3, format); @@ -192,7 +192,7 @@ /* This should be here if PLUSPTYPE */ put_bits(&s->pb, 1, 0); /* Continuous Presence Multipoint mode: off */ - if (format == 7) { + if (format == 8) { /* Custom Picture Format (CPFMT) */ s->aspect_ratio_info= ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/kgv1dec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/kgv1dec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/kgv1dec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/kgv1dec.c 2010-11-06 17:21:27.000000000 +0000 @@ -51,7 +51,7 @@ h = (buf[1] + 1) * 8; buf += 2; - if (av_check_image_size(w, h, 0, avctx)) + if (av_image_check_size(w, h, 0, avctx)) return -1; if (w != avctx->width || h != avctx->height) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/latm_parser.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/latm_parser.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/latm_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/latm_parser.c 2010-11-06 17:21:27.000000000 +0000 @@ -0,0 +1,119 @@ +/* + * copyright (c) 2008 Paul Kendall + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * AAC LATM parser + */ + +#include +#include +#include +#include +#include + +#include "parser.h" + +#define LATM_HEADER 0x56e000 // 0x2b7 (11 bits) +#define LATM_MASK 0xFFE000 // top 11 bits +#define LATM_SIZE_MASK 0x001FFF // bottom 13 bits + +typedef struct LATMParseContext{ + ParseContext pc; + int count; +} LATMParseContext; + +/** + * finds the end of the current frame in the bitstream. + * @return the position of the first byte of the next frame, or -1 + */ +static int latm_find_frame_end(AVCodecParserContext *s1, const uint8_t *buf, + int buf_size) +{ + LATMParseContext *s = s1->priv_data; + ParseContext *pc = &s->pc; + int pic_found, i; + uint32_t state; + + pic_found = pc->frame_start_found; + state = pc->state; + + i = 0; + if (!pic_found) { + for (i = 0; i < buf_size; i++) { + state = (state<<8) | buf[i]; + if ((state & LATM_MASK) == LATM_HEADER) { + i++; + s->count = -i; + pic_found = 1; + break; + } + } + } + + if (pic_found) { + /* EOF considered as end of frame */ + if (buf_size == 0) + return 0; + if ((state & LATM_SIZE_MASK) - s->count <= buf_size) { + pc->frame_start_found = 0; + pc->state = -1; + return (state & LATM_SIZE_MASK) - s->count; + } + } + + s->count += buf_size; + pc->frame_start_found = pic_found; + pc->state = state; + + return END_NOT_FOUND; +} + +static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size) +{ + LATMParseContext *s = s1->priv_data; + ParseContext *pc = &s->pc; + int next; + + if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) { + next = buf_size; + } else { + next = latm_find_frame_end(s1, buf, buf_size); + + if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { + *poutbuf = NULL; + *poutbuf_size = 0; + return buf_size; + } + } + *poutbuf = buf; + *poutbuf_size = buf_size; + return next; +} + +AVCodecParser aac_latm_parser = { + { CODEC_ID_AAC_LATM }, + sizeof(LATMParseContext), + NULL, + latm_parse, + ff_parse_close +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libdiracdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libdiracdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libdiracdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libdiracdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -106,7 +106,7 @@ /* tell FFmpeg about sequence details */ dirac_sourceparams_t *src_params = &p_dirac_params->p_decoder->src_params; - if (av_check_image_size(src_params->width, src_params->height, + if (av_image_check_size(src_params->width, src_params->height, 0, avccontext) < 0) { av_log(avccontext, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", src_params->width, src_params->height); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libmp3lame.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libmp3lame.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libmp3lame.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libmp3lame.c 2010-11-06 17:21:27.000000000 +0000 @@ -55,13 +55,12 @@ } else { lame_set_quality(s->gfp, avctx->compression_level); } - /* lame 3.91 doesn't work in mono */ - lame_set_mode(s->gfp, JOINT_STEREO); + lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO); lame_set_brate(s->gfp, avctx->bit_rate/1000); if(avctx->flags & CODEC_FLAG_QSCALE) { lame_set_brate(s->gfp, 0); lame_set_VBR(s->gfp, vbr_default); - lame_set_VBR_q(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA); + lame_set_VBR_quality(s->gfp, avctx->global_quality/(float)FF_QP2LAMBDA); } lame_set_bWriteVbrTag(s->gfp,0); lame_set_disable_reservoir(s->gfp, avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR ? 0 : 1); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libopenjpeg.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libopenjpeg.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libopenjpeg.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libopenjpeg.c 2010-11-06 17:21:27.000000000 +0000 @@ -114,7 +114,7 @@ } width = image->comps[0].w << avctx->lowres; height = image->comps[0].h << avctx->lowres; - if(av_check_image_size(width, height, 0, avctx) < 0) { + if(av_image_check_size(width, height, 0, avctx) < 0) { av_log(avctx, AV_LOG_ERROR, "%dx%d dimension invalid.\n", width, height); goto done; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libschroedingerdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libschroedingerdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libschroedingerdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libschroedingerdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -170,7 +170,7 @@ p_schro_params->format = schro_decoder_get_video_format(decoder); /* Tell FFmpeg about sequence details. */ - if (av_check_image_size(p_schro_params->format->width, p_schro_params->format->height, + if (av_image_check_size(p_schro_params->format->width, p_schro_params->format->height, 0, avccontext) < 0) { av_log(avccontext, AV_LOG_ERROR, "invalid dimensions (%dx%d)\n", p_schro_params->format->width, p_schro_params->format->height); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libvorbis.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libvorbis.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libvorbis.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libvorbis.c 2010-11-06 17:21:27.000000000 +0000 @@ -26,6 +26,7 @@ #include +#include "libavutil/opt.h" #include "avcodec.h" #include "bytestream.h" #include "vorbis.h" @@ -38,6 +39,7 @@ #define BUFFER_SIZE (1024*64) typedef struct OggVorbisContext { + AVClass *av_class; vorbis_info vi ; vorbis_dsp_state vd ; vorbis_block vb ; @@ -48,10 +50,18 @@ /* decoder */ vorbis_comment vc ; ogg_packet op; + + double iblock; } OggVorbisContext ; +static const AVOption options[]={ +{"iblock", "Sets the impulse block bias", offsetof(OggVorbisContext, iblock), FF_OPT_TYPE_DOUBLE, 0, -15, 0, AV_OPT_FLAG_ENCODING_PARAM}, +{NULL} +}; +static const AVClass class = { "libvorbis", av_default_item_name, options, LIBAVUTIL_VERSION_INT }; static av_cold int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) { + OggVorbisContext *context = avccontext->priv_data ; double cfreq; if(avccontext->flags & CODEC_FLAG_QSCALE) { @@ -82,6 +92,10 @@ return -1; } + if(context->iblock){ + vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &context->iblock); + } + return vorbis_encode_setup_init(vi); } @@ -240,4 +254,5 @@ .capabilities= CODEC_CAP_DELAY, .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"), + .priv_class= &class, } ; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libvpxdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libvpxdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libvpxdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libvpxdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -87,7 +87,7 @@ if ((int) img->d_w != avctx->width || (int) img->d_h != avctx->height) { av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n", avctx->width, avctx->height, img->d_w, img->d_h); - if (av_check_image_size(img->d_w, img->d_h, 0, avctx)) + if (av_image_check_size(img->d_w, img->d_h, 0, avctx)) return AVERROR_INVALIDDATA; avcodec_set_dimensions(avctx, img->d_w, img->d_h); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libvpxenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libvpxenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libvpxenc.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libvpxenc.c 2010-11-06 17:21:27.000000000 +0000 @@ -310,6 +310,7 @@ av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n"); codecctl_int(avctx, VP8E_SET_CPUUSED, cpuused); codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction); + codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices)); //provide dummy value to initialize wrapper, values will be updated each _encode() vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libx264.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libx264.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libx264.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libx264.c 2010-11-06 17:21:27.000000000 +0000 @@ -100,7 +100,11 @@ } x4->pic.i_pts = frame->pts; - x4->pic.i_type = X264_TYPE_AUTO; + x4->pic.i_type = + frame->pict_type == FF_I_TYPE ? X264_TYPE_KEYFRAME : + frame->pict_type == FF_P_TYPE ? X264_TYPE_P : + frame->pict_type == FF_B_TYPE ? X264_TYPE_B : + X264_TYPE_AUTO; } do { @@ -294,6 +298,8 @@ x4->params.b_interlaced = avctx->flags & CODEC_FLAG_INTERLACED_DCT; + x4->params.i_slice_count = avctx->slices; + if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) x4->params.b_repeat_headers = 0; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libxavs.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libxavs.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libxavs.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libxavs.c 2010-11-06 17:21:27.000000000 +0000 @@ -338,7 +338,7 @@ AVCodec libxavs_encoder = { .name = "libxavs", - .type = CODEC_TYPE_VIDEO, + .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_CAVS, .priv_data_size = sizeof(XavsContext), .init = XAVS_init, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libxvidff.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libxvidff.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/libxvidff.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/libxvidff.c 2010-11-06 17:21:27.000000000 +0000 @@ -31,6 +31,7 @@ #include #include #include "avcodec.h" +#include "libavutil/cpu.h" #include "libavutil/intreadwrite.h" #include "libxvid_internal.h" #if !HAVE_MKSTEMP @@ -44,9 +45,6 @@ #define BUFFER_REMAINING(x) (BUFFER_SIZE - strlen(x)) #define BUFFER_CAT(x) (&((x)[strlen(x)])) -/* For PPC Use */ -int has_altivec(void); - /** * Structure for the private Xvid context. * This stores all the private context for the codec. @@ -215,7 +213,7 @@ #if ARCH_PPC /* Xvid's PPC support is borked, use libavcodec to detect */ #if HAVE_ALTIVEC - if( has_altivec() ) { + if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { xvid_gbl_init.cpu_flags = XVID_CPU_FORCE | XVID_CPU_ALTIVEC; } else #endif @@ -451,7 +449,11 @@ xvid_enc_frame.vop_flags = x->vop_flags; xvid_enc_frame.vol_flags = x->vol_flags; xvid_enc_frame.motion = x->me_flags; - xvid_enc_frame.type = XVID_TYPE_AUTO; + xvid_enc_frame.type = + picture->pict_type == FF_I_TYPE ? XVID_TYPE_IVOP : + picture->pict_type == FF_P_TYPE ? XVID_TYPE_PVOP : + picture->pict_type == FF_B_TYPE ? XVID_TYPE_BVOP : + XVID_TYPE_AUTO; /* Pixel aspect ratio setting */ if (avctx->sample_aspect_ratio.num < 1 || avctx->sample_aspect_ratio.num > 255 || diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/lsp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/lsp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/lsp.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/lsp.c 2010-11-06 17:21:27.000000000 +0000 @@ -65,6 +65,14 @@ lsp[i] = ff_cos(lsf[i] * 20861 >> 15); // divide by PI and (0,13) -> (0,14) } +void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order) +{ + int i; + + for(i = 0; i < lp_order; i++) + lsp[i] = cos(2.0 * M_PI * lsf[i]); +} + /** * \brief decodes polynomial coefficients from LSP * \param f [out] decoded polynomial coefficients (-0x20000000 <= (3.22) <= 0x1fffffff) @@ -109,6 +117,32 @@ } } +void ff_amrwb_lsp2lpc(const double *lsp, float *lp, int lp_order) +{ + int lp_half_order = lp_order >> 1; + double buf[lp_half_order + 1]; + double pa[lp_half_order + 1]; + double *qa = buf + 1; + int i,j; + + qa[-1] = 0.0; + + ff_lsp2polyf(lsp , pa, lp_half_order ); + ff_lsp2polyf(lsp + 1, qa, lp_half_order - 1); + + for (i = 1, j = lp_order - 1; i < lp_half_order; i++, j--) { + double paf = pa[i] * (1 + lsp[lp_order - 1]); + double qaf = (qa[i] - qa[i-2]) * (1 - lsp[lp_order - 1]); + lp[i-1] = (paf + qaf) * 0.5; + lp[j-1] = (paf - qaf) * 0.5; + } + + lp[lp_half_order - 1] = (1.0 + lsp[lp_order - 1]) * + pa[lp_half_order] * 0.5; + + lp[lp_order - 1] = lsp[lp_order - 1]; +} + void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd, const int16_t* lsp_prev, int lp_order) { int16_t lsp_1st[MAX_LP_ORDER]; // (0.15) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/lsp.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/lsp.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/lsp.h 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/lsp.h 2010-11-06 17:21:27.000000000 +0000 @@ -63,6 +63,11 @@ void ff_acelp_lsf2lsp(int16_t *lsp, const int16_t *lsf, int lp_order); /** + * Floating point version of ff_acelp_lsf2lsp() + */ +void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order); + +/** * \brief LSP to LP conversion (3.2.6 of G.729) * \param[out] lp decoded LP coefficients (-0x8000 <= (3.12) < 0x8000) * \param lsp LSP coefficients (-0x8000 <= (0.15) < 0x8000) @@ -71,6 +76,11 @@ void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order); /** + * LSP to LP conversion (5.2.4 of AMR-WB) + */ +void ff_amrwb_lsp2lpc(const double *lsp, float *lp, int lp_order); + +/** * \brief Interpolate LSP for the first subframe and convert LSP -> LP for both subframes (3.2.5 and 3.2.6 of G.729) * \param[out] lp_1st decoded LP coefficients for first subframe (-0x8000 <= (3.12) < 0x8000) * \param[out] lp_2nd decoded LP coefficients for second subframe (-0x8000 <= (3.12) < 0x8000) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/Makefile chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/Makefile --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/Makefile 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/Makefile 2010-11-06 17:21:26.000000000 +0000 @@ -44,6 +44,8 @@ OBJS-$(CONFIG_VDPAU) += vdpau.o # decoders/encoders/hardware accelerators +OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o +OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \ aacadtsdec.o mpeg4audio.o OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \ @@ -134,8 +136,8 @@ OBJS-$(CONFIG_FRWU_DECODER) += frwu.o OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o -OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o -OBJS-$(CONFIG_GSM_MS_DECODER) += gsmdec.o +OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o +OBJS-$(CONFIG_GSM_MS_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o \ mpegvideo.o error_resilience.o OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o \ @@ -287,6 +289,7 @@ OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o +OBJS-$(CONFIG_R10K_DECODER) += r210dec.o OBJS-$(CONFIG_R210_DECODER) += r210dec.o OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o @@ -473,6 +476,8 @@ OBJS-$(CONFIG_ADPCM_EA_R2_DECODER) += adpcm.o OBJS-$(CONFIG_ADPCM_EA_R3_DECODER) += adpcm.o OBJS-$(CONFIG_ADPCM_EA_XAS_DECODER) += adpcm.o +OBJS-$(CONFIG_ADPCM_G722_DECODER) += g722.o +OBJS-$(CONFIG_ADPCM_G722_ENCODER) += g722.o OBJS-$(CONFIG_ADPCM_G726_DECODER) += g726.o OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o @@ -520,7 +525,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \ dirac.o mpeg12data.o OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o -OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o +OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o xiph.o OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \ flacdec.o flacdata.o flac.o @@ -571,6 +576,7 @@ h264_loopfilter.o h264_cabac.o \ h264_cavlc.o h264_ps.o \ mpegvideo.o error_resilience.o +OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o OBJS-$(CONFIG_MLP_PARSER) += mlp_parser.o mlp.o OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \ @@ -631,7 +637,6 @@ EXAMPLES = api TESTPROGS = cabac dct eval fft h264 iirfilter rangecoder snow -TESTPROGS-$(ARCH_X86) += x86/cpuid TESTPROGS-$(HAVE_MMX) += motion TESTOBJS = dctref.o diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/mjpegdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/mjpegdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/mjpegdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/mjpegdec.c 2010-11-06 17:21:27.000000000 +0000 @@ -44,23 +44,22 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table, int nb_codes, int use_static, int is_ac) { - uint8_t huff_size[256+16]; - uint16_t huff_code[256+16]; + uint8_t huff_size[256]; + uint16_t huff_code[256]; + uint16_t huff_sym[256]; + int i; assert(nb_codes <= 256); memset(huff_size, 0, sizeof(huff_size)); ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table); - if(is_ac){ - memmove(huff_size+16, huff_size, sizeof(uint8_t)*nb_codes); - memmove(huff_code+16, huff_code, sizeof(uint16_t)*nb_codes); - memset(huff_size, 0, sizeof(uint8_t)*16); - memset(huff_code, 0, sizeof(uint16_t)*16); - nb_codes += 16; - } + for(i=0; i<256; i++) + huff_sym[i]= i + 16*is_ac; + + if(is_ac) huff_sym[0]= 16*256; - return init_vlc(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2, use_static); + return init_vlc_sparse(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2, huff_sym, 2, 2, use_static); } static void build_basic_mjpeg_vlc(MJpegDecodeContext * s) { @@ -72,6 +71,10 @@ ff_mjpeg_val_ac_luminance, 251, 0, 1); build_vlc(&s->vlcs[1][1], ff_mjpeg_bits_ac_chrominance, ff_mjpeg_val_ac_chrominance, 251, 0, 1); + build_vlc(&s->vlcs[2][0], ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance, 251, 0, 0); + build_vlc(&s->vlcs[2][1], ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance, 251, 0, 0); } av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) @@ -191,6 +194,13 @@ if(build_vlc(&s->vlcs[class][index], bits_table, val_table, code_max + 1, 0, class > 0) < 0){ return -1; } + + if(class>0){ + free_vlc(&s->vlcs[2][index]); + if(build_vlc(&s->vlcs[2][index], bits_table, val_table, code_max + 1, 0, 0) < 0){ + return -1; + } + } } return 0; } @@ -219,7 +229,7 @@ height= s->height; av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height); - if(av_check_image_size(width, height, 0, s->avctx)) + if(av_image_check_size(width, height, 0, s->avctx)) return -1; nb_components = get_bits(&s->gb, 8); @@ -407,16 +417,13 @@ /* AC coefs */ i = 0; {OPEN_READER(re, &s->gb) - for(;;) { + do { UPDATE_CACHE(re, &s->gb); GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) - /* EOB */ - if (code == 0x10) - break; i += ((unsigned)code) >> 4; - if(code != 0x100){ code &= 0xf; + if(code){ if(code > MIN_CACHE_BITS - 16){ UPDATE_CACHE(re, &s->gb) } @@ -428,19 +435,14 @@ LAST_SKIP_BITS(re, &s->gb, code) - if (i >= 63) { - if(i == 63){ - j = s->scantable.permutated[63]; - block[j] = level * quant_matrix[j]; - break; - } + if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return -1; } j = s->scantable.permutated[i]; block[j] = level * quant_matrix[j]; } - } + }while(i<63); CLOSE_READER(re, &s->gb)} return 0; @@ -476,12 +478,12 @@ {OPEN_READER(re, &s->gb) for(i=ss;;i++) { UPDATE_CACHE(re, &s->gb); - GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) - /* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */ - code -= 16; - if(code & 0xF) { - i += ((unsigned) code) >> 4; - code &= 0xf; + GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2) + + run = ((unsigned) code) >> 4; + code &= 0xF; + if(code) { + i += run; if(code > MIN_CACHE_BITS - 16){ UPDATE_CACHE(re, &s->gb) } @@ -505,17 +507,20 @@ j = s->scantable.permutated[i]; block[j] = level * quant_matrix[j] << Al; }else{ - run = ((unsigned) code) >> 4; if(run == 0xF){// ZRL - skip 15 coefficients i += 15; + if (i >= se) { + av_log(s->avctx, AV_LOG_ERROR, "ZRL overflow: %d\n", i); + return -1; + } }else{ - val = run; - run = (1 << run); - UPDATE_CACHE(re, &s->gb); - run += (GET_CACHE(re, &s->gb) >> (32 - val)) & (run - 1); - if(val) - LAST_SKIP_BITS(re, &s->gb, val); - *EOBRUN = run - 1; + val = (1 << run); + if(run){ + UPDATE_CACHE(re, &s->gb); + val += NEG_USR32(GET_CACHE(re, &s->gb), run); + LAST_SKIP_BITS(re, &s->gb, run); + } + *EOBRUN = val - 1; break; } } @@ -564,9 +569,8 @@ else { for(;;i++) { UPDATE_CACHE(re, &s->gb); - GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) - /* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */ - code -= 16; + GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2) + if(code & 0xF) { run = ((unsigned) code) >> 4; UPDATE_CACHE(re, &s->gb); @@ -1027,7 +1031,7 @@ if(8*len + get_bits_count(&s->gb) > s->gb.size_in_bits) return -1; - id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16); + id = get_bits_long(&s->gb, 32); id = av_be2ne32(id); len -= 6; @@ -1134,7 +1138,7 @@ /* Apple MJPEG-A */ if ((s->start_code == APP1) && (len > (0x28 - 8))) { - id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16); + id = get_bits_long(&s->gb, 32); id = av_be2ne32(id); len -= 4; if (id == AV_RL32("mjpg")) /* Apple MJPEG-A */ @@ -1521,7 +1525,7 @@ av_freep(&s->ljpeg_buffer); s->ljpeg_buffer_size=0; - for(i=0;i<2;i++) { + for(i=0;i<3;i++) { for(j=0;j<4;j++) free_vlc(&s->vlcs[i][j]); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/mjpegdec.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/mjpegdec.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/mjpegdec.h 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/mjpegdec.h 2010-11-06 17:21:27.000000000 +0000 @@ -44,7 +44,7 @@ uint8_t *buffer; int16_t quant_matrixes[4][64]; - VLC vlcs[2][4]; + VLC vlcs[3][4]; int qscale[4]; ///< quantizer scale calculated from quant_matrixes int org_height; /* size given at codec init */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/motion-test.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/motion-test.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/motion-test.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/motion-test.c 2010-11-06 17:21:27.000000000 +0000 @@ -128,7 +128,7 @@ AVCodecContext *ctx; int c; DSPContext cctx, mmxctx; - int flags[2] = { FF_MM_MMX, FF_MM_MMX2 }; + int flags[2] = { AV_CPU_FLAG_MMX, AV_CPU_FLAG_MMX2 }; int flags_size = HAVE_MMX2 ? 2 : 1; for(;;) { @@ -145,11 +145,11 @@ printf("ffmpeg motion test\n"); ctx = avcodec_alloc_context(); - ctx->dsp_mask = FF_MM_FORCE; + ctx->dsp_mask = AV_CPU_FLAG_FORCE; dsputil_init(&cctx, ctx); for (c = 0; c < flags_size; c++) { int x; - ctx->dsp_mask = FF_MM_FORCE | flags[c]; + ctx->dsp_mask = AV_CPU_FLAG_FORCE | flags[c]; dsputil_init(&mmxctx, ctx); for (x = 0; x < 2; x++) { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/mpegvideo.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/mpegvideo.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/mpegvideo.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/mpegvideo.c 2010-11-06 17:21:28.000000000 +0000 @@ -576,7 +576,7 @@ if(s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; - else + else if (s->codec_id != CODEC_ID_H264) s->mb_height = (s->height + 15) / 16; if(s->avctx->pix_fmt == PIX_FMT_NONE){ @@ -590,7 +590,7 @@ return -1; } - if((s->width || s->height) && av_check_image_size(s->width, s->height, 0, s->avctx)) + if((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; dsputil_init(&s->dsp, s->avctx); @@ -1052,7 +1052,14 @@ return -1; s->current_picture_ptr= pic; - s->current_picture_ptr->top_field_first= s->top_field_first; //FIXME use only the vars from current_pic + //FIXME use only the vars from current_pic + if(s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO) { + if(s->picture_structure == PICT_FRAME) + s->current_picture_ptr->top_field_first= s->top_field_first; + else + s->current_picture_ptr->top_field_first= (s->picture_structure == PICT_TOP_FIELD) == s->first_field; + } else + s->current_picture_ptr->top_field_first= s->top_field_first; s->current_picture_ptr->interlaced_frame= !s->progressive_frame && !s->progressive_sequence; s->current_picture_ptr->field_picture= s->picture_structure != PICT_FRAME; } @@ -1356,7 +1363,7 @@ av_log(s->avctx, AV_LOG_DEBUG, "?"); - if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264) + if(IS_INTERLACED(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "="); else av_log(s->avctx, AV_LOG_DEBUG, " "); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/mpegvideo_enc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/mpegvideo_enc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/mpegvideo_enc.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/mpegvideo_enc.c 2010-11-06 17:21:28.000000000 +0000 @@ -352,12 +352,12 @@ av_log(avctx, AV_LOG_INFO, "impossible bitrate constraints, this will fail\n"); } - if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){ + if(avctx->rc_buffer_size && avctx->bit_rate*(int64_t)avctx->time_base.num > avctx->rc_buffer_size * (int64_t)avctx->time_base.den){ av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n"); return -1; } - if(avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){ + if(!s->fixed_qscale && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){ av_log(avctx, AV_LOG_ERROR, "bitrate tolerance too small for bitrate\n"); return -1; } @@ -571,7 +571,7 @@ break; case CODEC_ID_H263: if (!CONFIG_H263_ENCODER) return -1; - if (ff_match_2uint16(h263_format, FF_ARRAY_ELEMS(h263_format), s->width, s->height) == 7) { + if (ff_match_2uint16(h263_format, FF_ARRAY_ELEMS(h263_format), s->width, s->height) == 8) { av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height); return -1; } @@ -619,7 +619,7 @@ s->h263_aic=1; s->h263_plus=1; s->loop_filter=1; - s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; + s->unrestricted_mv= 0; break; case CODEC_ID_MPEG4: s->out_format = FMT_H263; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/msgsmdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/msgsmdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/msgsmdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/msgsmdec.c 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,37 @@ +/* + * gsm 06.10 decoder, Microsoft variant + * Copyright (c) 2010 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define ALT_BITSTREAM_READER_LE +#include "avcodec.h" +#include "msgsmdec.h" +#include "gsmdec_template.c" + +int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples, + const uint8_t *buf) +{ + int res; + GetBitContext gb; + init_get_bits(&gb, buf, GSM_MS_BLOCK_SIZE * 8); + res = gsm_decode_block(avctx, samples, &gb); + if (res < 0) + return res; + return gsm_decode_block(avctx, samples + GSM_FRAME_SIZE, &gb); +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/msgsmdec.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/msgsmdec.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/msgsmdec.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/msgsmdec.h 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,30 @@ +/* + * gsm 06.10 decoder, Microsoft variant + * Copyright (c) 2010 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MSGSMDEC_H +#define MSGSMDEC_H + +#include "avcodec.h" + +int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples, + const uint8_t *buf); + +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/msmpeg4.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/msmpeg4.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/msmpeg4.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/msmpeg4.c 2010-11-06 17:21:28.000000000 +0000 @@ -1395,8 +1395,7 @@ #endif if(s->msmpeg4_version==1){ - int start_code; - start_code = (get_bits(&s->gb, 16)<<16) | get_bits(&s->gb, 16); + int start_code = get_bits_long(&s->gb, 32); if(start_code!=0x00000100){ av_log(s->avctx, AV_LOG_ERROR, "invalid startcode\n"); return -1; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/msrledec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/msrledec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/msrledec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/msrledec.c 2010-11-06 17:21:28.000000000 +0000 @@ -45,7 +45,7 @@ unsigned char rle_code; unsigned char extra_byte, odd_pixel; unsigned char stream_byte; - int pixel_ptr = 0; + unsigned int pixel_ptr = 0; int row_dec = pic->linesize[0]; int row_ptr = (avctx->height - 1) * row_dec; int frame_size = row_dec * avctx->height; @@ -70,39 +70,37 @@ pixel_ptr += stream_byte; FETCH_NEXT_STREAM_BYTE(); row_ptr -= stream_byte * row_dec; - } else { - // copy pixels from encoded stream - odd_pixel = stream_byte & 1; - rle_code = (stream_byte + 1) / 2; - extra_byte = rle_code & 0x01; - if ((row_ptr + pixel_ptr + stream_byte > frame_size) || - (row_ptr < 0)) { - av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n"); - return -1; - } + } else { + // copy pixels from encoded stream + odd_pixel = stream_byte & 1; + rle_code = (stream_byte + 1) / 2; + extra_byte = rle_code & 0x01; + if (row_ptr + pixel_ptr + stream_byte > frame_size) { + av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n"); + return -1; + } - for (i = 0; i < rle_code; i++) { - if (pixel_ptr >= avctx->width) - break; - FETCH_NEXT_STREAM_BYTE(); - pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4; - pixel_ptr++; - if (i + 1 == rle_code && odd_pixel) - break; - if (pixel_ptr >= avctx->width) - break; - pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F; - pixel_ptr++; - } + for (i = 0; i < rle_code; i++) { + if (pixel_ptr >= avctx->width) + break; + FETCH_NEXT_STREAM_BYTE(); + pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4; + pixel_ptr++; + if (i + 1 == rle_code && odd_pixel) + break; + if (pixel_ptr >= avctx->width) + break; + pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F; + pixel_ptr++; + } - // if the RLE code is odd, skip a byte in the stream - if (extra_byte) - stream_ptr++; + // if the RLE code is odd, skip a byte in the stream + if (extra_byte) + stream_ptr++; } } else { // decode a run of data - if ((row_ptr + pixel_ptr + stream_byte > frame_size) || - (row_ptr < 0)) { + if (row_ptr + pixel_ptr + stream_byte > frame_size) { av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n"); return -1; } @@ -138,6 +136,7 @@ int p1, p2, line=avctx->height - 1, pos=0, i; uint16_t av_uninit(pix16); uint32_t av_uninit(pix32); + unsigned int width= FFABS(pic->linesize[0]) / (depth >> 3); output = pic->data[0] + (avctx->height - 1) * pic->linesize[0]; output_end = pic->data[0] + (avctx->height) * pic->linesize[0]; @@ -159,11 +158,11 @@ p1 = *src++; p2 = *src++; line -= p2; - if (line < 0){ + pos += p1; + if (line < 0 || pos >= width){ av_log(avctx, AV_LOG_ERROR, "Skip beyond picture bounds\n"); return -1; } - pos += p1; output = pic->data[0] + line * pic->linesize[0] + pos * (depth >> 3); continue; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/nuv.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/nuv.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/nuv.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/nuv.c 2010-11-06 17:21:28.000000000 +0000 @@ -112,7 +112,7 @@ if (quality >= 0) get_quant_quality(c, quality); if (width != c->width || height != c->height) { - if (av_check_image_size(height, width, 0, avctx) < 0) + if (av_image_check_size(height, width, 0, avctx) < 0) return 0; avctx->width = c->width = width; avctx->height = c->height = height; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/opt.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/opt.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/opt.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/opt.c 2010-11-06 17:21:28.000000000 +0000 @@ -1,6 +1,6 @@ /* - * AVOptions - * Copyright (c) 2005 Michael Niedermayer + * AVOptions ABI compatibility wrapper + * Copyright (c) 2010 Michael Niedermayer * * This file is part of FFmpeg. * @@ -19,187 +19,53 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/** - * @file - * AVOptions - * @author Michael Niedermayer - */ - #include "avcodec.h" #include "opt.h" -#include "libavutil/eval.h" -//FIXME order them and do a bin search -const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags){ - AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass - const AVOption *o= c->option; +#if LIBAVCODEC_VERSION_MAJOR < 53 && CONFIG_SHARED && HAVE_SYMVER - for(;o && o->name; o++){ - if(!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) && (o->flags & mask) == flags ) - return o; - } - return NULL; +FF_SYMVER(const AVOption *, av_find_opt, (void *obj, const char *name, const char *unit, int mask, int flags), "LIBAVCODEC_52"){ + return av_find_opt(obj, name, unit, mask, flags); } - -const AVOption *av_next_option(void *obj, const AVOption *last){ - if(last && last[1].name) return ++last; - else if(last) return NULL; - else return (*(AVClass**)obj)->option; +FF_SYMVER(int, av_set_string3, (void *obj, const char *name, const char *val, int alloc, const AVOption **o_out), "LIBAVCODEC_52"){ + return av_set_string3(obj, name, val, alloc, o_out); } - -static int av_set_number2(void *obj, const char *name, double num, int den, int64_t intnum, const AVOption **o_out){ - const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); - void *dst; - if(o_out) - *o_out= o; - if(!o || o->offset<=0) - return AVERROR(ENOENT); - - if(o->max*den < num*intnum || o->min*den > num*intnum) { - av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name); - return AVERROR(ERANGE); - } - - dst= ((uint8_t*)obj) + o->offset; - - switch(o->type){ - case FF_OPT_TYPE_FLAGS: - case FF_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break; - case FF_OPT_TYPE_INT64: *(int64_t *)dst= llrint(num/den)*intnum; break; - case FF_OPT_TYPE_FLOAT: *(float *)dst= num*intnum/den; break; - case FF_OPT_TYPE_DOUBLE:*(double *)dst= num*intnum/den; break; - case FF_OPT_TYPE_RATIONAL: - if((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den}; - else *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24); - break; - default: - return AVERROR(EINVAL); - } - return 0; +FF_SYMVER(const AVOption *, av_set_double, (void *obj, const char *name, double n), "LIBAVCODEC_52"){ + return av_set_double(obj, name, n); } - -static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){ - const AVOption *o = NULL; - if (av_set_number2(obj, name, num, den, intnum, &o) < 0) - return NULL; - else - return o; +FF_SYMVER(const AVOption *, av_set_q, (void *obj, const char *name, AVRational n), "LIBAVCODEC_52"){ + return av_set_q(obj, name, n); } - -static const double const_values[]={ - M_PI, - M_E, - FF_QP2LAMBDA, - 0 -}; - -static const char * const const_names[]={ - "PI", - "E", - "QP2LAMBDA", - 0 -}; - -static int hexchar2int(char c) { - if (c >= '0' && c <= '9') return c - '0'; - if (c >= 'a' && c <= 'f') return c - 'a' + 10; - if (c >= 'A' && c <= 'F') return c - 'A' + 10; - return -1; +FF_SYMVER(const AVOption *, av_set_int, (void *obj, const char *name, int64_t n), "LIBAVCODEC_52"){ + return av_set_int(obj, name, n); } - -int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out){ - int ret; - const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); - if (o_out) - *o_out = o; - if(!o) - return AVERROR(ENOENT); - if(!val || o->offset<=0) - return AVERROR(EINVAL); - - if(o->type == FF_OPT_TYPE_BINARY){ - uint8_t **dst = (uint8_t **)(((uint8_t*)obj) + o->offset); - int *lendst = (int *)(dst + 1); - uint8_t *bin, *ptr; - int len = strlen(val); - av_freep(dst); - *lendst = 0; - if (len & 1) return AVERROR(EINVAL); - len /= 2; - ptr = bin = av_malloc(len); - while (*val) { - int a = hexchar2int(*val++); - int b = hexchar2int(*val++); - if (a < 0 || b < 0) { - av_free(bin); - return AVERROR(EINVAL); - } - *ptr++ = (a << 4) | b; - } - *dst = bin; - *lendst = len; - return 0; - } - if(o->type != FF_OPT_TYPE_STRING){ - int notfirst=0; - for(;;){ - int i; - char buf[256]; - int cmd=0; - double d; - - if(*val == '+' || *val == '-') - cmd= *(val++); - - for(i=0; iunit, 0, 0); - if(o_named && o_named->type == FF_OPT_TYPE_CONST) - d= o_named->default_val; - else if(!strcmp(buf, "default")) d= o->default_val; - else if(!strcmp(buf, "max" )) d= o->max; - else if(!strcmp(buf, "min" )) d= o->min; - else if(!strcmp(buf, "none" )) d= 0; - else if(!strcmp(buf, "all" )) d= ~0; - else { - int res = av_parse_and_eval_expr(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj); - if (res < 0) { - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val); - return res; - } - } - } - if(o->type == FF_OPT_TYPE_FLAGS){ - if (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d; - else if(cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d; - }else{ - if (cmd=='+') d= notfirst*av_get_double(obj, name, NULL) + d; - else if(cmd=='-') d= notfirst*av_get_double(obj, name, NULL) - d; - } - - if ((ret = av_set_number2(obj, name, d, 1, 1, o_out)) < 0) - return ret; - val+= i; - if(!*val) - return 0; - notfirst=1; - } - return AVERROR(EINVAL); - } - - if(alloc){ - av_free(*(void**)(((uint8_t*)obj) + o->offset)); - val= av_strdup(val); - } - - memcpy(((uint8_t*)obj) + o->offset, &val, sizeof(val)); - return 0; +FF_SYMVER(double, av_get_double, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){ + return av_get_double(obj, name, o_out); +} +FF_SYMVER(AVRational, av_get_q, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){ + return av_get_q(obj, name, o_out); +} +FF_SYMVER(int64_t, av_get_int, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){ + return av_get_int(obj, name, o_out); +} +FF_SYMVER(const char *, av_get_string, (void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len), "LIBAVCODEC_52"){ + return av_get_string(obj, name, o_out, buf, buf_len); +} +FF_SYMVER(const AVOption *, av_next_option, (void *obj, const AVOption *last), "LIBAVCODEC_52"){ + return av_next_option(obj, last); } +FF_SYMVER(int, av_opt_show2, (void *obj, void *av_log_obj, int req_flags, int rej_flags), "LIBAVCODEC_52"){ + return av_opt_show2(obj, av_log_obj, req_flags, rej_flags); +} +FF_SYMVER(void, av_opt_set_defaults, (void *s), "LIBAVCODEC_52"){ + return av_opt_set_defaults(s); +} +FF_SYMVER(void, av_opt_set_defaults2, (void *s, int mask, int flags), "LIBAVCODEC_52"){ + return av_opt_set_defaults2(s, mask, flags); +} +#endif -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_SET_STRING_OLD const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc){ const AVOption *o; if (av_set_string3(obj, name, val, alloc, &o) < 0) @@ -215,241 +81,9 @@ } #endif -const AVOption *av_set_double(void *obj, const char *name, double n){ - return av_set_number(obj, name, n, 1, 1); -} - -const AVOption *av_set_q(void *obj, const char *name, AVRational n){ - return av_set_number(obj, name, n.num, n.den, 1); -} - -const AVOption *av_set_int(void *obj, const char *name, int64_t n){ - return av_set_number(obj, name, 1, 1, n); -} - -/** - * - * @param buf a buffer which is used for returning non string values as strings, can be NULL - * @param buf_len allocated length in bytes of buf - */ -const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len){ - const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); - void *dst; - uint8_t *bin; - int len, i; - if(!o || o->offset<=0) - return NULL; - if(o->type != FF_OPT_TYPE_STRING && (!buf || !buf_len)) - return NULL; - - dst= ((uint8_t*)obj) + o->offset; - if(o_out) *o_out= o; - - switch(o->type){ - case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; - case FF_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; - case FF_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; - case FF_OPT_TYPE_FLOAT: snprintf(buf, buf_len, "%f" , *(float *)dst);break; - case FF_OPT_TYPE_DOUBLE: snprintf(buf, buf_len, "%f" , *(double *)dst);break; - case FF_OPT_TYPE_RATIONAL: snprintf(buf, buf_len, "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; - case FF_OPT_TYPE_STRING: return *(void**)dst; - case FF_OPT_TYPE_BINARY: - len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); - if(len >= (buf_len + 1)/2) return NULL; - bin = *(uint8_t**)dst; - for(i = 0; i < len; i++) snprintf(buf + i*2, 3, "%02X", bin[i]); - break; - default: return NULL; - } - return buf; -} - -static int av_get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum){ - const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); - void *dst; - if(!o || o->offset<=0) - goto error; - - dst= ((uint8_t*)obj) + o->offset; - - if(o_out) *o_out= o; - - switch(o->type){ - case FF_OPT_TYPE_FLAGS: *intnum= *(unsigned int*)dst;return 0; - case FF_OPT_TYPE_INT: *intnum= *(int *)dst;return 0; - case FF_OPT_TYPE_INT64: *intnum= *(int64_t*)dst;return 0; - case FF_OPT_TYPE_FLOAT: *num= *(float *)dst;return 0; - case FF_OPT_TYPE_DOUBLE: *num= *(double *)dst;return 0; - case FF_OPT_TYPE_RATIONAL: *intnum= ((AVRational*)dst)->num; - *den = ((AVRational*)dst)->den; - return 0; - } -error: - *den=*intnum=0; - return -1; -} - -double av_get_double(void *obj, const char *name, const AVOption **o_out){ - int64_t intnum=1; - double num=1; - int den=1; - - av_get_number(obj, name, o_out, &num, &den, &intnum); - return num*intnum/den; -} - -AVRational av_get_q(void *obj, const char *name, const AVOption **o_out){ - int64_t intnum=1; - double num=1; - int den=1; - - av_get_number(obj, name, o_out, &num, &den, &intnum); - if(num == 1.0 && (int)intnum == intnum) - return (AVRational){intnum, den}; - else - return av_d2q(num*intnum/den, 1<<24); -} - -int64_t av_get_int(void *obj, const char *name, const AVOption **o_out){ - int64_t intnum=1; - double num=1; - int den=1; - - av_get_number(obj, name, o_out, &num, &den, &intnum); - return num*intnum/den; -} - -static void opt_list(void *obj, void *av_log_obj, const char *unit) -{ - const AVOption *opt=NULL; - - while((opt= av_next_option(obj, opt))){ - if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM))) - continue; - - /* Don't print CONST's on level one. - * Don't print anything but CONST's on level two. - * Only print items from the requested unit. - */ - if (!unit && opt->type==FF_OPT_TYPE_CONST) - continue; - else if (unit && opt->type!=FF_OPT_TYPE_CONST) - continue; - else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit)) - continue; - else if (unit && opt->type == FF_OPT_TYPE_CONST) - av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name); - else - av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name); - - switch( opt->type ) - { - case FF_OPT_TYPE_FLAGS: - av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); - break; - case FF_OPT_TYPE_INT: - av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); - break; - case FF_OPT_TYPE_INT64: - av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); - break; - case FF_OPT_TYPE_DOUBLE: - av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); - break; - case FF_OPT_TYPE_FLOAT: - av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); - break; - case FF_OPT_TYPE_STRING: - av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); - break; - case FF_OPT_TYPE_RATIONAL: - av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); - break; - case FF_OPT_TYPE_BINARY: - av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); - break; - case FF_OPT_TYPE_CONST: - default: - av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" ); - break; - } - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.'); - - if(opt->help) - av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help); - av_log(av_log_obj, AV_LOG_INFO, "\n"); - if (opt->unit && opt->type != FF_OPT_TYPE_CONST) { - opt_list(obj, av_log_obj, opt->unit); - } - } -} - +#if FF_API_OPT_SHOW int av_opt_show(void *obj, void *av_log_obj){ - if(!obj) - return -1; - - av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name); - - opt_list(obj, av_log_obj, NULL); - - return 0; -} - -/** Set the values of the AVCodecContext or AVFormatContext structure. - * They are set to the defaults specified in the according AVOption options - * array default_val field. - * - * @param s AVCodecContext or AVFormatContext for which the defaults will be set - */ -void av_opt_set_defaults2(void *s, int mask, int flags) -{ - const AVOption *opt = NULL; - while ((opt = av_next_option(s, opt)) != NULL) { - if((opt->flags & mask) != flags) - continue; - switch(opt->type) { - case FF_OPT_TYPE_CONST: - /* Nothing to be done here */ - break; - case FF_OPT_TYPE_FLAGS: - case FF_OPT_TYPE_INT: { - int val; - val = opt->default_val; - av_set_int(s, opt->name, val); - } - break; - case FF_OPT_TYPE_INT64: - if((double)(opt->default_val+0.6) == opt->default_val) - av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name); - av_set_int(s, opt->name, opt->default_val); - break; - case FF_OPT_TYPE_FLOAT: { - double val; - val = opt->default_val; - av_set_double(s, opt->name, val); - } - break; - case FF_OPT_TYPE_RATIONAL: { - AVRational val; - val = av_d2q(opt->default_val, INT_MAX); - av_set_q(s, opt->name, val); - } - break; - case FF_OPT_TYPE_STRING: - case FF_OPT_TYPE_BINARY: - /* Cannot set default for string as default_val is of type * double */ - break; - default: - av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name); - } - } + return av_opt_show2(obj, av_log_obj, + AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); } - -void av_opt_set_defaults(void *s){ - av_opt_set_defaults2(s, 0, 0); -} - +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/opt.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/opt.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/opt.h 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/opt.h 2010-11-06 17:21:28.000000000 +0000 @@ -29,130 +29,9 @@ #include "libavutil/rational.h" #include "avcodec.h" +#include "libavutil/opt.h" -enum AVOptionType{ - FF_OPT_TYPE_FLAGS, - FF_OPT_TYPE_INT, - FF_OPT_TYPE_INT64, - FF_OPT_TYPE_DOUBLE, - FF_OPT_TYPE_FLOAT, - FF_OPT_TYPE_STRING, - FF_OPT_TYPE_RATIONAL, - FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length - FF_OPT_TYPE_CONST=128, -}; - -/** - * AVOption - */ -typedef struct AVOption { - const char *name; - - /** - * short English help text - * @todo What about other languages? - */ - const char *help; - - /** - * The offset relative to the context structure where the option - * value is stored. It should be 0 for named constants. - */ - int offset; - enum AVOptionType type; - - /** - * the default value for scalar options - */ - double default_val; - double min; ///< minimum valid value for the option - double max; ///< maximum valid value for the option - - int flags; -#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding -#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding -#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... -#define AV_OPT_FLAG_AUDIO_PARAM 8 -#define AV_OPT_FLAG_VIDEO_PARAM 16 -#define AV_OPT_FLAG_SUBTITLE_PARAM 32 -//FIXME think about enc-audio, ... style flags - - /** - * The logical unit to which the option belongs. Non-constant - * options and corresponding named constants share the same - * unit. May be NULL. - */ - const char *unit; -} AVOption; - -/** - * AVOption2. - * THIS IS NOT PART OF THE API/ABI YET! - * This is identical to AVOption except that default_val was replaced by - * an union, it should be compatible with AVOption on normal platforms. - */ -typedef struct AVOption2 { - const char *name; - - /** - * short English help text - * @todo What about other languages? - */ - const char *help; - - /** - * The offset relative to the context structure where the option - * value is stored. It should be 0 for named constants. - */ - int offset; - enum AVOptionType type; - - /** - * the default value for scalar options - */ - union { - double dbl; - const char *str; - } default_val; - - double min; ///< minimum valid value for the option - double max; ///< maximum valid value for the option - - int flags; -/* -#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding -#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding -#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... -#define AV_OPT_FLAG_AUDIO_PARAM 8 -#define AV_OPT_FLAG_VIDEO_PARAM 16 -#define AV_OPT_FLAG_SUBTITLE_PARAM 32 -*/ -//FIXME think about enc-audio, ... style flags - - /** - * The logical unit to which the option belongs. Non-constant - * options and corresponding named constants share the same - * unit. May be NULL. - */ - const char *unit; -} AVOption2; - - -/** - * Look for an option in obj. Look only for the options which - * have the flags set as specified in mask and flags (that is, - * for which it is the case that opt->flags & mask == flags). - * - * @param[in] obj a pointer to a struct whose first element is a - * pointer to an AVClass - * @param[in] name the name of the option to look for - * @param[in] unit the unit of the option to look for, or any if NULL - * @return a pointer to the option found, or NULL if no option - * has been found - */ -const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); - -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_SET_STRING_OLD /** * @see av_set_string2() */ @@ -166,46 +45,11 @@ */ attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc); #endif - +#if FF_API_OPT_SHOW /** - * Set the field of obj with the given name to value. - * - * @param[in] obj A struct whose first element is a pointer to an - * AVClass. - * @param[in] name the name of the field to set - * @param[in] val The value to set. If the field is not of a string - * type, then the given string is parsed. - * SI postfixes and some named scalars are supported. - * If the field is of a numeric type, it has to be a numeric or named - * scalar. Behavior with more than one scalar and +- infix operators - * is undefined. - * If the field is of a flags type, it has to be a sequence of numeric - * scalars or named flags separated by '+' or '-'. Prefixing a flag - * with '+' causes it to be set without affecting the other flags; - * similarly, '-' unsets a flag. - * @param[out] o_out if non-NULL put here a pointer to the AVOption - * found - * @param alloc when 1 then the old value will be av_freed() and the - * new av_strduped() - * when 0 then no av_free() nor av_strdup() will be used - * @return 0 if the value has been set, or an AVERROR code in case of - * error: - * AVERROR(ENOENT) if no matching option exists - * AVERROR(ERANGE) if the value is out of range - * AVERROR(EINVAL) if the value is not valid + * @deprecated Use av_opt_show2() instead. */ -int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); - -const AVOption *av_set_double(void *obj, const char *name, double n); -const AVOption *av_set_q(void *obj, const char *name, AVRational n); -const AVOption *av_set_int(void *obj, const char *name, int64_t n); -double av_get_double(void *obj, const char *name, const AVOption **o_out); -AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); -int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); -const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); -const AVOption *av_next_option(void *obj, const AVOption *last); -int av_opt_show(void *obj, void *av_log_obj); -void av_opt_set_defaults(void *s); -void av_opt_set_defaults2(void *s, int mask, int flags); +attribute_deprecated int av_opt_show(void *obj, void *av_log_obj); +#endif #endif /* AVCODEC_OPT_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/options.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/options.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/options.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/options.c 2010-11-06 17:21:28.000000000 +0000 @@ -25,7 +25,7 @@ */ #include "avcodec.h" -#include "opt.h" +#include "libavutil/opt.h" #include /* FLT_MIN, FLT_MAX */ static const char* context_to_name(void* ptr) { @@ -160,7 +160,7 @@ {"very", "strictly conform to a older more strict version of the spec or reference software", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_VERY_STRICT, INT_MIN, INT_MAX, V|D|E, "strict"}, {"strict", "strictly conform to all the things in the spec no matter what consequences", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_STRICT, INT_MIN, INT_MAX, V|D|E, "strict"}, {"normal", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_NORMAL, INT_MIN, INT_MAX, V|D|E, "strict"}, -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_INOFFICIAL {"inofficial", "allow unofficial extensions (deprecated - use unofficial)", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_UNOFFICIAL, INT_MIN, INT_MAX, V|D|E, "strict"}, #endif {"unofficial", "allow unofficial extensions", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_UNOFFICIAL, INT_MIN, INT_MAX, V|D|E, "strict"}, @@ -334,7 +334,7 @@ {"aac_ltp", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_LTP, INT_MIN, INT_MAX, A|E, "profile"}, {"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"}, {"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"}, -{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|D}, +{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|A|D}, {"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, @@ -383,7 +383,7 @@ {"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_VLC, INT_MIN, INT_MAX, V|E, "flags2"}, {"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, 40, 1, INT_MAX, V|E}, {"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, FF_COMPRESSION_DEFAULT, INT_MIN, INT_MAX, V|A|E}, -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_USE_LPC {"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, #endif {"lpc_coeff_precision", "LPC coefficient precision (FLAC)", OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|E}, @@ -426,6 +426,7 @@ {"levinson", NULL, 0, FF_OPT_TYPE_CONST, AV_LPC_TYPE_LEVINSON, INT_MIN, INT_MAX, A|E, "lpc_type"}, {"cholesky", NULL, 0, FF_OPT_TYPE_CONST, AV_LPC_TYPE_CHOLESKY, INT_MIN, INT_MAX, A|E, "lpc_type"}, {"lpc_passes", "number of passes to use for Cholesky factorization during LPC analysis", OFFSET(lpc_passes), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, +{"slices", "number of slices, used in parallelized decoding", OFFSET(slices), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|E}, {"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_INT, FF_THREAD_SLICE|FF_THREAD_FRAME, 0, INT_MAX, V|E|D, "thread_type"}, {"slice", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_SLICE, INT_MIN, INT_MAX, V|E|D, "thread_type"}, {"frame", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_FRAME, INT_MIN, INT_MAX, V|E|D, "thread_type"}, @@ -471,6 +472,36 @@ s->reordered_opaque= AV_NOPTS_VALUE; } +int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){ + avcodec_get_context_defaults2(s, codec ? codec->type : AVMEDIA_TYPE_UNKNOWN); + if(codec && codec->priv_data_size){ + if(!s->priv_data){ + s->priv_data= av_mallocz(codec->priv_data_size); + if (!s->priv_data) { + return AVERROR(ENOMEM); + } + } + if(codec->priv_class){ + *(AVClass**)s->priv_data= codec->priv_class; + av_opt_set_defaults(s->priv_data); + } + } + return 0; +} + +AVCodecContext *avcodec_alloc_context3(AVCodec *codec){ + AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); + + if(avctx==NULL) return NULL; + + if(avcodec_get_context_defaults3(avctx, codec) < 0){ + av_free(avctx); + return NULL; + } + + return avctx; +} + AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/parser.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/parser.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/parser.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/parser.c 2010-11-06 17:21:28.000000000 +0000 @@ -150,6 +150,12 @@ int index, i; uint8_t dummy_buf[FF_INPUT_BUFFER_PADDING_SIZE]; + if(!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) { + s->next_frame_offset = + s->cur_offset = pos; + s->flags |= PARSER_FLAG_FETCHED_OFFSET; + } + if (buf_size == 0) { /* padding is always necessary even if EOF, so we add it here */ memset(dummy_buf, 0, sizeof(dummy_buf)); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pcm.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pcm.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pcm.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pcm.c 2010-11-06 17:21:28.000000000 +0000 @@ -259,7 +259,7 @@ const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; PCMDecode *s = avctx->priv_data; - int sample_size, c, n; + int sample_size, c, n, i; short *samples; const uint8_t *src, *src8, *src2[MAX_CHANNELS]; uint8_t *dstu8; @@ -288,6 +288,9 @@ if (CODEC_ID_PCM_DVD == avctx->codec_id) /* 2 samples are interleaved per block in PCM_DVD */ sample_size = avctx->bits_per_coded_sample * 2 / 8; + else if (avctx->codec_id == CODEC_ID_PCM_LXF) + /* we process 40-bit blocks per channel for LXF */ + sample_size = 5; n = avctx->channels * sample_size; @@ -436,6 +439,26 @@ } samples = (short *) dst_int32_t; break; + case CODEC_ID_PCM_LXF: + dst_int32_t = data; + n /= avctx->channels; + //unpack and de-planerize + for (i = 0; i < n; i++) { + for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) { + //extract low 20 bits and expand to 32 bits + *dst_int32_t++ = (src8[2] << 28) | (src8[1] << 20) | (src8[0] << 12) | + ((src8[2] & 0xF) << 8) | src8[1]; + } + + for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) { + //extract high 20 bits and expand to 32 bits + *dst_int32_t++ = (src8[4] << 24) | (src8[3] << 16) | + ((src8[2] & 0xF0) << 8) | (src8[4] << 4) | (src8[3] >> 4); + } + } + src += n * avctx->channels * 5; + samples = (short *) dst_int32_t; + break; default: return -1; } @@ -485,6 +508,7 @@ PCM_CODEC (CODEC_ID_PCM_F32LE, SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian"); PCM_CODEC (CODEC_ID_PCM_F64BE, SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian"); PCM_CODEC (CODEC_ID_PCM_F64LE, SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian"); +PCM_DECODER(CODEC_ID_PCM_LXF, SAMPLE_FMT_S32, pcm_lxf, "PCM signed 20-bit little-endian planar"); PCM_CODEC (CODEC_ID_PCM_MULAW, SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law"); PCM_CODEC (CODEC_ID_PCM_S8, SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit"); PCM_CODEC (CODEC_ID_PCM_S16BE, SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian"); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pcx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pcx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pcx.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pcx.c 2010-11-06 17:21:28.000000000 +0000 @@ -143,7 +143,7 @@ if (p->data[0]) avctx->release_buffer(avctx, p); - if (av_check_image_size(w, h, 0, avctx)) + if (av_image_check_size(w, h, 0, avctx)) return -1; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pgssubdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pgssubdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pgssubdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pgssubdec.c 2010-11-06 17:21:28.000000000 +0000 @@ -28,6 +28,7 @@ #include "dsputil.h" #include "bytestream.h" #include "libavutil/colorspace.h" +#include "libavcore/imgutils.h" //#define DEBUG_PACKET_CONTENTS @@ -44,8 +45,6 @@ typedef struct PGSSubPresentation { int x; int y; - int video_w; - int video_h; int id_number; } PGSSubPresentation; @@ -186,7 +185,7 @@ height = bytestream_get_be16(&buf); /* Make sure the bitmap is not too large */ - if (ctx->presentation.video_w < width || ctx->presentation.video_h < height) { + if (avctx->width < width || avctx->height < height) { av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger then video.\n"); return -1; } @@ -266,11 +265,13 @@ int x, y; uint8_t block; - ctx->presentation.video_w = bytestream_get_be16(&buf); - ctx->presentation.video_h = bytestream_get_be16(&buf); + int w = bytestream_get_be16(&buf); + int h = bytestream_get_be16(&buf); dprintf(avctx, "Video Dimensions %dx%d\n", - ctx->presentation.video_w, ctx->presentation.video_h); + w, h); + if (av_image_check_size(w, h, 0, avctx) >= 0) + avcodec_set_dimensions(avctx, w, h); /* Skip 1 bytes of unknown, frame rate? */ buf++; @@ -298,9 +299,9 @@ dprintf(avctx, "Subtitle Placement x=%d, y=%d\n", x, y); - if (x > ctx->presentation.video_w || y > ctx->presentation.video_h) { + if (x > avctx->width || y > avctx->height) { av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n", - x, y, ctx->presentation.video_w, ctx->presentation.video_h); + x, y, avctx->width, avctx->height); x = 0; y = 0; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pictordec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pictordec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pictordec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pictordec.c 2010-11-06 17:21:28.000000000 +0000 @@ -136,7 +136,7 @@ avctx->pix_fmt = PIX_FMT_PAL8; if (s->width != avctx->width && s->height != avctx->height) { - if (av_check_image_size(s->width, s->height, 0, avctx) < 0) + if (av_image_check_size(s->width, s->height, 0, avctx) < 0) return -1; avcodec_set_dimensions(avctx, s->width, s->height); if (s->frame.data[0]) @@ -239,7 +239,7 @@ AVCodec pictor_decoder = { "pictor", - CODEC_TYPE_VIDEO, + AVMEDIA_TYPE_VIDEO, CODEC_ID_PICTOR, sizeof(PicContext), NULL, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pngdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pngdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pngdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pngdec.c 2010-11-06 17:21:28.000000000 +0000 @@ -442,7 +442,7 @@ goto fail; s->width = bytestream_get_be32(&s->bytestream); s->height = bytestream_get_be32(&s->bytestream); - if(av_check_image_size(s->width, s->height, 0, avctx)){ + if(av_image_check_size(s->width, s->height, 0, avctx)){ s->width= s->height= 0; goto fail; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pnm.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pnm.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pnm.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pnm.c 2010-11-06 17:21:28.000000000 +0000 @@ -102,7 +102,7 @@ } } /* check that all tags are present */ - if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || av_check_image_size(w, h, 0, avctx)) + if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || av_image_check_size(w, h, 0, avctx)) return -1; avctx->width = w; @@ -135,7 +135,7 @@ return -1; pnm_get(s, buf1, sizeof(buf1)); avctx->height = atoi(buf1); - if(av_check_image_size(avctx->width, avctx->height, 0, avctx)) + if(av_image_check_size(avctx->width, avctx->height, 0, avctx)) return -1; if (avctx->pix_fmt != PIX_FMT_MONOWHITE) { pnm_get(s, buf1, sizeof(buf1)); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/check_altivec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/check_altivec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/check_altivec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/check_altivec.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -/** - * @file - * Check for AltiVec presence. - */ - -#ifdef __APPLE__ -#undef _POSIX_C_SOURCE -#include -#elif defined(__OpenBSD__) -#include -#include -#include -#elif defined(__AMIGAOS4__) -#include -#include -#include -#endif /* __APPLE__ */ - -#include "config.h" -#include "dsputil_altivec.h" - -/** - * This function MAY rely on signal() or fork() in order to make sure AltiVec - * is present. - */ - -int has_altivec(void) -{ -#ifdef __AMIGAOS4__ - ULONG result = 0; - extern struct ExecIFace *IExec; - - IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); - if (result == VECTORTYPE_ALTIVEC) return 1; - return 0; -#elif defined(__APPLE__) || defined(__OpenBSD__) -#ifdef __OpenBSD__ - int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC}; -#else - int sels[2] = {CTL_HW, HW_VECTORUNIT}; -#endif - int has_vu = 0; - size_t len = sizeof(has_vu); - int err; - - err = sysctl(sels, 2, &has_vu, &len, NULL, 0); - - if (err == 0) return has_vu != 0; - return 0; -#elif CONFIG_RUNTIME_CPUDETECT - int proc_ver; - // Support of mfspr PVR emulation added in Linux 2.6.17. - __asm__ volatile("mfspr %0, 287" : "=r" (proc_ver)); - proc_ver >>= 16; - if (proc_ver & 0x8000 || - proc_ver == 0x000c || - proc_ver == 0x0039 || proc_ver == 0x003c || - proc_ver == 0x0044 || proc_ver == 0x0045 || - proc_ver == 0x0070) - return 1; - return 0; -#else - // Since we were compiled for AltiVec, just assume we have it - // until someone comes up with a proper way (not involving signal hacks). - return 1; -#endif /* __AMIGAOS4__ */ -} - diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/dsputil_altivec.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/dsputil_altivec.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/dsputil_altivec.h 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/dsputil_altivec.h 2010-11-06 17:21:28.000000000 +0000 @@ -30,8 +30,6 @@ void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); -int has_altivec(void); - void fdct_altivec(int16_t *block); void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/dsputil_ppc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/dsputil_ppc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/dsputil_ppc.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/dsputil_ppc.c 2010-11-06 17:21:28.000000000 +0000 @@ -20,22 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/dsputil.h" #include "dsputil_altivec.h" -int mm_flags = 0; - -int mm_support(void) -{ - int result = 0; -#if HAVE_ALTIVEC - if (has_altivec()) { - result |= FF_MM_ALTIVEC; - } -#endif /* result */ - return result; -} - /* ***** WARNING ***** WARNING ***** WARNING ***** */ /* clear_blocks_dcbz32_ppc will not work properly on PowerPC processors with a @@ -181,9 +169,7 @@ #if HAVE_ALTIVEC if(CONFIG_H264_DECODER) dsputil_h264_init_ppc(c, avctx); - if (has_altivec()) { - mm_flags |= FF_MM_ALTIVEC; - + if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { dsputil_init_altivec(c, avctx); if(CONFIG_VC1_DECODER) vc1dsp_init_altivec(c, avctx); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/h264_altivec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/h264_altivec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/h264_altivec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/h264_altivec.c 2010-11-06 17:21:28.000000000 +0000 @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/h264data.h" #include "libavcodec/h264dsp.h" @@ -969,7 +970,7 @@ void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) { - if (has_altivec()) { + if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec; c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec; c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; @@ -1001,7 +1002,7 @@ void ff_h264dsp_init_ppc(H264DSPContext *c) { - if (has_altivec()) { + if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { c->h264_idct_add = ff_h264_idct_add_altivec; c->h264_idct_add8 = ff_h264_idct_add8_altivec; c->h264_idct_add16 = ff_h264_idct_add16_altivec; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/Makefile chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/Makefile --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/Makefile 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/Makefile 2010-11-06 17:21:28.000000000 +0000 @@ -18,8 +18,7 @@ ALTIVEC-OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \ $(FFT-OBJS-yes) -OBJS-$(HAVE_ALTIVEC) += ppc/check_altivec.o \ - ppc/dsputil_altivec.o \ +OBJS-$(HAVE_ALTIVEC) += ppc/dsputil_altivec.o \ ppc/fdct_altivec.o \ ppc/float_altivec.o \ ppc/gmc_altivec.o \ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/mpegvideo_altivec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/mpegvideo_altivec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/mpegvideo_altivec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/mpegvideo_altivec.c 2010-11-06 17:21:28.000000000 +0000 @@ -23,6 +23,7 @@ #include #include +#include "libavutil/cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/mpegvideo.h" @@ -570,7 +571,7 @@ void MPV_common_init_altivec(MpegEncContext *s) { - if ((mm_flags & FF_MM_ALTIVEC) == 0) return; + if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return; if (s->avctx->lowres==0) { if ((s->avctx->idct_algo == FF_IDCT_AUTO) || diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/vp8dsp_altivec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/vp8dsp_altivec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ppc/vp8dsp_altivec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ppc/vp8dsp_altivec.c 2010-11-06 17:21:28.000000000 +0000 @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/vp8dsp.h" #include "dsputil_altivec.h" #include "types_altivec.h" @@ -265,7 +266,7 @@ av_cold void ff_vp8dsp_init_altivec(VP8DSPContext *c) { - if (!has_altivec()) + if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return; c->put_vp8_epel_pixels_tab[0][0][0] = put_vp8_pixels16_altivec; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/psymodel.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/psymodel.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/psymodel.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/psymodel.c 2010-11-06 17:21:28.000000000 +0000 @@ -53,7 +53,7 @@ } void ff_psy_set_band_info(FFPsyContext *ctx, int channel, - const float *coeffs, FFPsyWindowInfo *wi) + const float *coeffs, const FFPsyWindowInfo *wi) { ctx->model->analyze(ctx, channel, coeffs, wi); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/psymodel.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/psymodel.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/psymodel.h 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/psymodel.h 2010-11-06 17:21:28.000000000 +0000 @@ -72,7 +72,7 @@ const char *name; int (*init) (FFPsyContext *apc); FFPsyWindowInfo (*window)(FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type); - void (*analyze)(FFPsyContext *ctx, int channel, const float *coeffs, FFPsyWindowInfo *wi); + void (*analyze)(FFPsyContext *ctx, int channel, const float *coeffs, const FFPsyWindowInfo *wi); void (*end) (FFPsyContext *apc); } FFPsyModel; @@ -116,7 +116,7 @@ * @param wi window information */ void ff_psy_set_band_info(FFPsyContext *ctx, int channel, const float *coeffs, - FFPsyWindowInfo *wi); + const FFPsyWindowInfo *wi); /** * Cleanup model context at the end. diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pthread.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pthread.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/pthread.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/pthread.c 2010-11-06 17:21:28.000000000 +0000 @@ -434,7 +434,7 @@ } int ff_thread_decode_frame(AVCodecContext *avctx, - void *data, int *data_size, + AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { FrameThreadContext *fctx = avctx->thread_opaque; @@ -452,7 +452,7 @@ if (fctx->delaying && avpkt->size) { if (fctx->next_decoding >= (thread_count-1)) fctx->delaying = 0; - *data_size=0; + *got_picture_ptr=0; return 0; } @@ -468,14 +468,14 @@ pthread_mutex_unlock(&p->progress_mutex); } - *(AVFrame*)data = p->picture; - *data_size = p->got_picture; + *picture = p->picture; + *got_picture_ptr = p->got_picture; avcodec_get_frame_defaults(&p->picture); p->got_picture = 0; if (returning_thread >= thread_count) returning_thread = 0; - } while (!avpkt->size && !*data_size && returning_thread != fctx->next_finished); + } while (!avpkt->size && !*got_picture_ptr && returning_thread != fctx->next_finished); update_thread_context_from_copy(avctx, p->avctx, 1); @@ -778,7 +778,7 @@ return -1; } - avctx->thread_count = thread_count; + avctx->thread_count = FFMAX(1, thread_count); if (avctx->codec) { validate_thread_parameters(avctx); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ptx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ptx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ptx.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ptx.c 2010-11-06 17:21:28.000000000 +0000 @@ -65,7 +65,7 @@ if (p->data[0]) avctx->release_buffer(avctx, p); - if (av_check_image_size(w, h, 0, avctx)) + if (av_image_check_size(w, h, 0, avctx)) return -1; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/qdm2.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/qdm2.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/qdm2.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/qdm2.c 2010-11-06 17:21:28.000000000 +0000 @@ -1209,7 +1209,8 @@ init_get_bits(&gb, header.data, header.size*8); if (header.type == 2 || header.type == 4 || header.type == 5) { - int csum = 257 * get_bits(&gb, 8) + 2 * get_bits(&gb, 8); + int csum = 257 * get_bits(&gb, 8); + csum += 2 * get_bits(&gb, 8); csum = qdm2_packet_checksum(q->compressed_data, q->checksum_size, csum); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/qtrleenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/qtrleenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/qtrleenc.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/qtrleenc.c 2010-11-06 17:21:28.000000000 +0000 @@ -63,7 +63,7 @@ { QtrleEncContext *s = avctx->priv_data; - if (av_check_image_size(avctx->width, avctx->height, 0, avctx) < 0) { + if (av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) { return -1; } s->avctx=avctx; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/r210dec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/r210dec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/r210dec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/r210dec.c 2010-11-06 17:21:28.000000000 +0000 @@ -63,9 +63,15 @@ for (w = 0; w < avctx->width; w++) { uint32_t pixel = av_be2ne32(*src++); uint16_t r, g, b; - b = pixel << 6; - g = (pixel >> 4) & 0xffc0; - r = (pixel >> 14) & 0xffc0; + if (avctx->codec_id==CODEC_ID_R210) { + b = pixel << 6; + g = (pixel >> 4) & 0xffc0; + r = (pixel >> 14) & 0xffc0; + } else { + b = pixel << 4; + g = (pixel >> 6) & 0xffc0; + r = (pixel >> 16) & 0xffc0; + } *dst++ = r | (r >> 10); *dst++ = g | (g >> 10); *dst++ = b | (b >> 10); @@ -90,6 +96,7 @@ return 0; } +#if CONFIG_R210_DECODER AVCodec r210_decoder = { "r210", AVMEDIA_TYPE_VIDEO, @@ -102,3 +109,18 @@ CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"), }; +#endif +#if CONFIG_R10K_DECODER +AVCodec r10k_decoder = { + "r10k", + AVMEDIA_TYPE_VIDEO, + CODEC_ID_R10K, + 0, + decode_init, + NULL, + decode_close, + decode_frame, + CODEC_CAP_DR1, + .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"), +}; +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ra144enc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ra144enc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ra144enc.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ra144enc.c 2010-11-06 17:21:28.000000000 +0000 @@ -502,7 +502,7 @@ AVCodec ra_144_encoder = { "real_144", - CODEC_TYPE_AUDIO, + AVMEDIA_TYPE_AUDIO, CODEC_ID_RA_144, sizeof(RA144Context), ra144_encode_init, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/rawdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/rawdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/rawdec.c 2010-08-11 17:40:54.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/rawdec.c 2010-11-06 17:21:28.000000000 +0000 @@ -25,10 +25,13 @@ */ #include "avcodec.h" +#include "imgconvert.h" #include "raw.h" #include "libavutil/intreadwrite.h" +#include "libavcore/imgutils.h" typedef struct RawVideoContext { + uint32_t palette[AVPALETTE_COUNT]; unsigned char * buffer; /* block of memory for holding one frame */ int length; /* number of bytes in buffer */ int flip; @@ -80,16 +83,20 @@ else if (avctx->pix_fmt == PIX_FMT_NONE && avctx->bits_per_coded_sample) avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_avi, avctx->bits_per_coded_sample); + ff_set_systematic_pal(context->palette, avctx->pix_fmt); context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); - context->buffer = av_malloc(context->length); + if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) && + avctx->pix_fmt==PIX_FMT_PAL8 && + (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){ + context->buffer = av_malloc(context->length); + if (!context->buffer) + return -1; + } context->pic.pict_type = FF_I_TYPE; context->pic.key_frame = 1; avctx->coded_frame= &context->pic; - if (!context->buffer) - return -1; - if((avctx->extradata_size >= 9 && !memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9)) || avctx->codec_tag == MKTAG( 3 , 0 , 0 , 0 )) context->flip=1; @@ -115,13 +122,12 @@ frame->interlaced_frame = avctx->coded_frame->interlaced_frame; frame->top_field_first = avctx->coded_frame->top_field_first; + frame->reordered_opaque = avctx->reordered_opaque; //2bpp and 4bpp raw in avi and mov (yes this is ugly ...) - if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) && - avctx->pix_fmt==PIX_FMT_PAL8 && - (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){ + if (context->buffer) { int i; - uint8_t *dst = context->buffer + 256*4; + uint8_t *dst = context->buffer; buf_size = context->length - 256*4; if (avctx->bits_per_coded_sample == 4){ for(i=0; 2*i+1 < buf_size; i++){ @@ -146,8 +152,10 @@ return -1; avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height); - if(avctx->pix_fmt==PIX_FMT_PAL8 && buf_size < context->length){ - frame->data[1]= context->buffer; + if((avctx->pix_fmt==PIX_FMT_PAL8 && buf_size < context->length) || + (avctx->pix_fmt!=PIX_FMT_PAL8 && + (av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PAL))){ + frame->data[1]= context->palette; } if (avctx->palctrl && avctx->palctrl->palette_changed) { memcpy(frame->data[1], avctx->palctrl->palette, AVPALETTE_SIZE); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/resample.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/resample.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/resample.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/resample.c 2010-11-06 17:21:28.000000000 +0000 @@ -26,7 +26,8 @@ #include "avcodec.h" #include "audioconvert.h" -#include "opt.h" +#include "libavutil/opt.h" +#include "libavcore/samplefmt.h" struct AVResampleContext; @@ -174,15 +175,15 @@ s->sample_fmt [0] = sample_fmt_in; s->sample_fmt [1] = sample_fmt_out; - s->sample_size[0] = av_get_bits_per_sample_format(s->sample_fmt[0])>>3; - s->sample_size[1] = av_get_bits_per_sample_format(s->sample_fmt[1])>>3; + s->sample_size[0] = av_get_bits_per_sample_fmt(s->sample_fmt[0])>>3; + s->sample_size[1] = av_get_bits_per_sample_fmt(s->sample_fmt[1])>>3; if (s->sample_fmt[0] != SAMPLE_FMT_S16) { if (!(s->convert_ctx[0] = av_audio_convert_alloc(SAMPLE_FMT_S16, 1, s->sample_fmt[0], 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "Cannot convert %s sample format to s16 sample format\n", - avcodec_get_sample_fmt_name(s->sample_fmt[0])); + av_get_sample_fmt_name(s->sample_fmt[0])); av_free(s); return NULL; } @@ -193,7 +194,7 @@ SAMPLE_FMT_S16, 1, NULL, 0))) { av_log(s, AV_LOG_ERROR, "Cannot convert s16 sample format to %s sample format\n", - avcodec_get_sample_fmt_name(s->sample_fmt[1])); + av_get_sample_fmt_name(s->sample_fmt[1])); av_audio_convert_free(s->convert_ctx[0]); av_free(s); return NULL; @@ -217,7 +218,7 @@ return s; } -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_AUDIO_OLD ReSampleContext *audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate) { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/rv10.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/rv10.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/rv10.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/rv10.c 2010-11-06 17:21:28.000000000 +0000 @@ -370,7 +370,7 @@ } if(new_w != s->width || new_h != s->height){ av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h); - if (av_check_image_size(new_w, new_h, 0, s->avctx) < 0) + if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0) return -1; MPV_common_end(s); avcodec_set_dimensions(s->avctx, new_w, new_h); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/rv20enc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/rv20enc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/rv20enc.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/rv20enc.c 2010-11-06 17:21:28.000000000 +0000 @@ -41,7 +41,7 @@ put_bits(&s->pb, 1, s->no_rounding); assert(s->f_code == 1); - assert(s->unrestricted_mv == 1); + assert(s->unrestricted_mv == 0); assert(s->alt_inter_vlc == 0); assert(s->umvplus == 0); assert(s->modified_quant==1); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/rv40.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/rv40.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/rv40.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/rv40.c 2010-11-06 17:21:28.000000000 +0000 @@ -144,7 +144,7 @@ si->pts = get_bits(gb, 13); if(!si->type || !get_bits1(gb)) rv40_parse_picture_size(gb, &w, &h); - if(av_check_image_size(w, h, 0, r->s.avctx) < 0) + if(av_image_check_size(w, h, 0, r->s.avctx) < 0) return -1; si->width = w; si->height = h; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/sgidec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/sgidec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/sgidec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/sgidec.c 2010-11-06 17:21:28.000000000 +0000 @@ -202,7 +202,7 @@ return -1; } - if (av_check_image_size(s->width, s->height, 0, avctx)) + if (av_image_check_size(s->width, s->height, 0, avctx)) return -1; avcodec_set_dimensions(avctx, s->width, s->height); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/sipr.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/sipr.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/sipr.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/sipr.c 2010-11-06 17:21:28.000000000 +0000 @@ -209,32 +209,6 @@ } } -static void lsp2lpc_sipr(const double *lsp, float *Az) -{ - int lp_half_order = LP_FILTER_ORDER >> 1; - double buf[(LP_FILTER_ORDER >> 1) + 1]; - double pa[(LP_FILTER_ORDER >> 1) + 1]; - double *qa = buf + 1; - int i,j; - - qa[-1] = 0.0; - - ff_lsp2polyf(lsp , pa, lp_half_order ); - ff_lsp2polyf(lsp + 1, qa, lp_half_order - 1); - - for (i = 1, j = LP_FILTER_ORDER - 1; i < lp_half_order; i++, j--) { - double paf = pa[i] * (1 + lsp[LP_FILTER_ORDER - 1]); - double qaf = (qa[i] - qa[i-2]) * (1 - lsp[LP_FILTER_ORDER - 1]); - Az[i-1] = (paf + qaf) * 0.5; - Az[j-1] = (paf - qaf) * 0.5; - } - - Az[lp_half_order - 1] = (1.0 + lsp[LP_FILTER_ORDER - 1]) * - pa[lp_half_order] * 0.5; - - Az[LP_FILTER_ORDER - 1] = lsp[LP_FILTER_ORDER - 1]; -} - static void sipr_decode_lp(float *lsfnew, const float *lsfold, float *Az, int num_subfr) { @@ -247,7 +221,7 @@ for (j = 0; j < LP_FILTER_ORDER; j++) lsfint[j] = lsfold[j] * (1 - t) + t * lsfnew[j]; - lsp2lpc_sipr(lsfint, Az); + ff_amrwb_lsp2lpc(lsfint, Az, LP_FILTER_ORDER); Az += LP_FILTER_ORDER; t += t0; } @@ -573,7 +547,7 @@ mode_par->subframe_count * sizeof(float); return mode_par->bits_per_frame >> 3; -}; +} AVCodec sipr_decoder = { "sipr", diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/sp5xdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/sp5xdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/sp5xdec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/sp5xdec.c 2010-11-06 17:21:28.000000000 +0000 @@ -37,9 +37,6 @@ const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AVPacket avpkt_recoded; -#if 0 - MJpegDecodeContext *s = avctx->priv_data; -#endif const int qscale = 5; const uint8_t *buf_ptr; uint8_t *recoded; @@ -50,7 +47,6 @@ buf_ptr = buf; -#if 1 recoded = av_mallocz(buf_size + 1024); if (!recoded) return -1; @@ -98,98 +94,6 @@ av_free(recoded); -#else - /* SOF */ - s->bits = 8; - s->width = avctx->coded_width; - s->height = avctx->coded_height; - s->nb_components = 3; - s->component_id[0] = 0; - s->h_count[0] = 2; - s->v_count[0] = 2; - s->quant_index[0] = 0; - s->component_id[1] = 1; - s->h_count[1] = 1; - s->v_count[1] = 1; - s->quant_index[1] = 1; - s->component_id[2] = 2; - s->h_count[2] = 1; - s->v_count[2] = 1; - s->quant_index[2] = 1; - s->h_max = 2; - s->v_max = 2; - - s->qscale_table = av_mallocz((s->width+15)/16); - avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420; - s->interlaced = 0; - - s->picture.reference = 0; - if (avctx->get_buffer(avctx, &s->picture) < 0) - { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } - - s->picture.pict_type = FF_I_TYPE; - s->picture.key_frame = 1; - - for (i = 0; i < 3; i++) - s->linesize[i] = s->picture.linesize[i] << s->interlaced; - - /* DQT */ - for (i = 0; i < 64; i++) - { - j = s->scantable.permutated[i]; - s->quant_matrixes[0][j] = sp5x_quant_table[(qscale * 2) + i]; - } - s->qscale[0] = FFMAX( - s->quant_matrixes[0][s->scantable.permutated[1]], - s->quant_matrixes[0][s->scantable.permutated[8]]) >> 1; - - for (i = 0; i < 64; i++) - { - j = s->scantable.permutated[i]; - s->quant_matrixes[1][j] = sp5x_quant_table[(qscale * 2) + 1 + i]; - } - s->qscale[1] = FFMAX( - s->quant_matrixes[1][s->scantable.permutated[1]], - s->quant_matrixes[1][s->scantable.permutated[8]]) >> 1; - - /* DHT */ - - /* SOS */ - s->comp_index[0] = 0; - s->nb_blocks[0] = s->h_count[0] * s->v_count[0]; - s->h_scount[0] = s->h_count[0]; - s->v_scount[0] = s->v_count[0]; - s->dc_index[0] = 0; - s->ac_index[0] = 0; - - s->comp_index[1] = 1; - s->nb_blocks[1] = s->h_count[1] * s->v_count[1]; - s->h_scount[1] = s->h_count[1]; - s->v_scount[1] = s->v_count[1]; - s->dc_index[1] = 1; - s->ac_index[1] = 1; - - s->comp_index[2] = 2; - s->nb_blocks[2] = s->h_count[2] * s->v_count[2]; - s->h_scount[2] = s->h_count[2]; - s->v_scount[2] = s->v_count[2]; - s->dc_index[2] = 1; - s->ac_index[2] = 1; - - for (i = 0; i < 3; i++) - s->last_dc[i] = 1024; - - s->mb_width = (s->width * s->h_max * 8 -1) / (s->h_max * 8); - s->mb_height = (s->height * s->v_max * 8 -1) / (s->v_max * 8); - - init_get_bits(&s->gb, buf+14, (buf_size-14)*8); - - return mjpeg_decode_scan(s); -#endif - return i; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/sunrast.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/sunrast.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/sunrast.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/sunrast.c 2010-11-06 17:21:28.000000000 +0000 @@ -98,7 +98,7 @@ if (p->data[0]) avctx->release_buffer(avctx, p); - if (av_check_image_size(w, h, 0, avctx)) + if (av_image_check_size(w, h, 0, avctx)) return -1; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/targa.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/targa.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/targa.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/targa.c 2010-11-06 17:21:28.000000000 +0000 @@ -22,14 +22,7 @@ #include "libavutil/intreadwrite.h" #include "libavcore/imgutils.h" #include "avcodec.h" - -enum TargaCompr{ - TGA_NODATA = 0, // no image data - TGA_PAL = 1, // palettized - TGA_RGB = 2, // true-color - TGA_BW = 3, // black & white or grayscale - TGA_RLE = 8, // flag pointing that data is RLE-coded -}; +#include "targa.h" typedef struct TargaContext { AVFrame picture; @@ -146,7 +139,7 @@ if(s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); - if(av_check_image_size(w, h, 0, avctx)) + if(av_image_check_size(w, h, 0, avctx)) return -1; if(w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/targaenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/targaenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/targaenc.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/targaenc.c 2010-11-06 17:21:28.000000000 +0000 @@ -22,6 +22,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" #include "rle.h" +#include "targa.h" typedef struct TargaContext { AVFrame picture; @@ -81,12 +82,12 @@ if(avctx->width > 0xffff || avctx->height > 0xffff) { av_log(avctx, AV_LOG_ERROR, "image dimensions too large\n"); - return -1; + return AVERROR(EINVAL); } picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); if(buf_size < picsize + 45) { av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n"); - return -1; + return AVERROR(EINVAL); } p->pict_type= FF_I_TYPE; @@ -96,24 +97,30 @@ memset(outbuf, 0, 12); AV_WL16(outbuf+12, avctx->width); AV_WL16(outbuf+14, avctx->height); - outbuf[17] = 0x20; /* origin is top-left. no alpha */ + /* image descriptor byte: origin is always top-left, bits 0-3 specify alpha */ + outbuf[17] = 0x20 | (avctx->pix_fmt == PIX_FMT_BGRA ? 8 : 0); - /* TODO: support alpha channel */ switch(avctx->pix_fmt) { case PIX_FMT_GRAY8: - outbuf[2] = 3; /* uncompressed grayscale image */ + outbuf[2] = TGA_BW; /* uncompressed grayscale image */ outbuf[16] = 8; /* bpp */ break; case PIX_FMT_RGB555LE: - outbuf[2] = 2; /* uncompresses true-color image */ + outbuf[2] = TGA_RGB; /* uncompresses true-color image */ outbuf[16] = 16; /* bpp */ break; case PIX_FMT_BGR24: - outbuf[2] = 2; /* uncompressed true-color image */ + outbuf[2] = TGA_RGB; /* uncompressed true-color image */ outbuf[16] = 24; /* bpp */ break; + case PIX_FMT_BGRA: + outbuf[2] = TGA_RGB; /* uncompressed true-color image */ + outbuf[16] = 32; /* bpp */ + break; default: - return -1; + av_log(avctx, AV_LOG_ERROR, "Pixel format '%s' not supported.\n", + avcodec_get_pix_fmt_name(avctx->pix_fmt)); + return AVERROR(EINVAL); } bpp = outbuf[16] >> 3; @@ -158,6 +165,6 @@ .priv_data_size = sizeof(TargaContext), .init = targa_encode_init, .encode = targa_encode_frame, - .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555LE, PIX_FMT_GRAY8, PIX_FMT_NONE}, + .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_BGRA, PIX_FMT_RGB555LE, PIX_FMT_GRAY8, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("Truevision Targa image"), }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/targa.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/targa.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/targa.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/targa.h 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * targa file common definitions + * + * Based on: + * http://www.gamers.org/dEngine/quake3/TGA.txt + * + * and other specs you can find referenced for example in: + * http://en.wikipedia.org/wiki/Truevision_TGA + */ + +enum TargaCompr { + TGA_NODATA = 0, // no image data + TGA_PAL = 1, // palettized + TGA_RGB = 2, // true-color + TGA_BW = 3, // black & white or grayscale + TGA_RLE = 8, // flag pointing that data is RLE-coded +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/thread.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/thread.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/thread.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/thread.h 2010-11-06 17:21:28.000000000 +0000 @@ -1,5 +1,4 @@ /* - * Multithreading support * Copyright (c) 2008 Alexander Strange * * This file is part of FFmpeg. @@ -20,8 +19,8 @@ */ /** - * @file thread.h - * Multithreading support header. + * @file + * Multithreading support functions * @author Alexander Strange */ @@ -32,80 +31,74 @@ #include "avcodec.h" /** - * Waits for decoding threads to finish and resets the internal + * Waits for decoding threads to finish and resets internal * state. Called by avcodec_flush_buffers(). + * + * @param avctx The context. */ void ff_thread_flush(AVCodecContext *avctx); /** - * Submits a new frame to a decoding thread. Parameters are the - * same as avcodec_decode_video2(). Returns the earliest available - * decoded picture. - * - * NULL AVFrames returned from the codec will be dropped if - * the client passes NULL data in. - */ -int ff_thread_decode_frame(AVCodecContext *avctx, - void *data, int *data_size, - AVPacket *avpkt); - -/** - * For codecs which define update_thread_context. - * Call this when the context is set up for the next frame to be - * decoded. The next decoding thread will start afterwards. - * The codec must not modify parts of the context read by - * update_thread_context after calling this or it will cause a race - * condition. + * Submits a new frame to a decoding thread. + * Returns the next available frame in picture. *got_picture_ptr + * will be 0 if none is available. + * + * Parameters are the same as avcodec_decode_video2(). + */ +int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, + int *got_picture_ptr, AVPacket *avpkt); + +/** + * Codecs which define update_thread_context should call this + * when they are ready for the next thread to start decoding + * the next frame. After calling it, do not change any variables + * read by the update_thread_context method. + * + * @param avctx The context. */ void ff_thread_finish_setup(AVCodecContext *avctx); /** * Call this when some part of the picture is finished decoding. - * Later calls with lower progress values will be ignored. + * Later calls with lower values of progress have no effect. * - * @param f The AVFrame containing the current field or frame - * @param progress The highest-numbered part finished so far - * @param field The field being decoded, for field pictures. - * 0 for top field or progressive, 1 for bottom. + * @param f The picture being decoded. + * @param progress Value, in arbitrary units, of how much of the picture has decoded. + * @param field The field being decoded, for field-picture codecs. + * 0 for top field or frame pictures, 1 for bottom field. */ void ff_thread_report_progress(AVFrame *f, int progress, int field); /** - * Call this before accessing some part of a previous field or frame. - * Returns after the previous decoding thread has called ff_thread_report_progress() - * with sufficiently high progress. - * - * @param f The AVFrame containing the reference field or frame - * @param progress The highest-numbered part of the reference picture to wait for - * @param field The field being referenced, for field pictures. - * 0 for top field or progressive, 1 for bottom. + * Call this before accessing some part of a picture. + * + * @param f The picture being referenced. + * @param progress Value, in arbitrary units, to wait for. + * @param field The field being referenced, for field-picture codecs. + * 0 for top field or frame pictures, 1 for bottom field. */ void ff_thread_await_progress(AVFrame *f, int progress, int field); /** - * Convenience function to set progress for both fields to INT_MAX. - * Can be used to prevent deadlocks in later threads when a decoder - * exits early due to errors. + * Sets progress of both fields of a picture to INT_MAX * - * @param f The frame or field picture being decoded. + * @param f The picture. */ void ff_thread_finish_frame(AVFrame *f); /** - * Replacement for get_buffer() for frame-level threading. + * Call this function instead of avctx->get_buffer(f). * - * Codecs with CODEC_CAP_FRAME_THREADS must call this instead - * of calling get_buffer() directly. + * @param avctx The current context. + * @param f The frame to write into. */ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f); /** - * Replacement for release_buffer() for frame-level threading. - * - * Codecs with CODEC_CAP_FRAME_THREADS must call this instead - * of calling release_buffer() directly. + * Call this function instead of avctx->release_buffer(f). * - * On return, \p f->data will be cleared. + * @param avctx The current context. + * @param f The picture being released. */ void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/tiff.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/tiff.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/tiff.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/tiff.c 2010-11-06 17:21:28.000000000 +0000 @@ -306,7 +306,7 @@ return -1; } if(s->width != s->avctx->width || s->height != s->avctx->height){ - if(av_check_image_size(s->width, s->height, 0, s->avctx)) + if(av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; avcodec_set_dimensions(s->avctx, s->width, s->height); } @@ -508,7 +508,7 @@ s->bpp = 1; avctx->pix_fmt = PIX_FMT_MONOBLACK; if(s->width != s->avctx->width || s->height != s->avctx->height){ - if(av_check_image_size(s->width, s->height, 0, s->avctx)) + if(av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; avcodec_set_dimensions(s->avctx, s->width, s->height); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/truemotion1.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/truemotion1.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/truemotion1.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/truemotion1.c 2010-11-06 17:21:28.000000000 +0000 @@ -35,6 +35,7 @@ #include "avcodec.h" #include "dsputil.h" +#include "libavcore/imgutils.h" #include "truemotion1data.h" @@ -71,6 +72,7 @@ int last_deltaset, last_vectable; unsigned int *vert_pred; + int vert_pred_size; } TrueMotion1Context; @@ -178,11 +180,7 @@ return (lo + (hi << 16)) << 1; } -#if HAVE_BIGENDIAN -static int make_cdt15_entry(int p2, int p1, int16_t *cdt) -#else static int make_cdt15_entry(int p1, int p2, int16_t *cdt) -#endif { int r, b, lo; @@ -207,11 +205,7 @@ return (lo + (hi << 16)) << 1; } -#if HAVE_BIGENDIAN -static int make_cdt16_entry(int p2, int p1, int16_t *cdt) -#else static int make_cdt16_entry(int p1, int p2, int16_t *cdt) -#endif { int r, b, lo; @@ -221,11 +215,7 @@ return (lo + (lo << 16)) << 1; } -#if HAVE_BIGENDIAN -static int make_ydt24_entry(int p2, int p1, int16_t *ydt) -#else static int make_ydt24_entry(int p1, int p2, int16_t *ydt) -#endif { int lo, hi; @@ -234,11 +224,7 @@ return (lo + (hi << 8) + (hi << 16)) << 1; } -#if HAVE_BIGENDIAN -static int make_cdt24_entry(int p2, int p1, int16_t *cdt) -#else static int make_cdt24_entry(int p1, int p2, int16_t *cdt) -#endif { int r, b; @@ -321,15 +307,12 @@ static int truemotion1_decode_header(TrueMotion1Context *s) { int i; + int width_shift = 0; + int new_pix_fmt; struct frame_header header; uint8_t header_buffer[128]; /* logical maximum size of the header */ const uint8_t *sel_vector_table; - /* There is 1 change bit per 4 pixels, so each change byte represents - * 32 pixels; divide width by 4 to obtain the number of change bits and - * then round up to the nearest byte. */ - s->mb_change_bits_row_size = ((s->avctx->width >> 2) + 7) >> 3; - header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f; if (s->buf[0] < 0x10) { @@ -412,11 +395,30 @@ } } - // FIXME: where to place this ?!?! - if (compression_types[header.compression].algorithm == ALGO_RGB24H) - s->avctx->pix_fmt = PIX_FMT_RGB32; - else - s->avctx->pix_fmt = PIX_FMT_RGB555; // RGB565 is supported as well + if (compression_types[header.compression].algorithm == ALGO_RGB24H) { + new_pix_fmt = PIX_FMT_RGB32; + width_shift = 1; + } else + new_pix_fmt = PIX_FMT_RGB555; // RGB565 is supported as well + + s->w >>= width_shift; + if (av_image_check_size(s->w, s->h, 0, s->avctx) < 0) + return -1; + + if (s->w != s->avctx->width || s->h != s->avctx->height || + new_pix_fmt != s->avctx->pix_fmt) { + if (s->frame.data[0]) + s->avctx->release_buffer(s->avctx, &s->frame); + s->avctx->sample_aspect_ratio = (AVRational){ 1 << width_shift, 1 }; + s->avctx->pix_fmt = new_pix_fmt; + avcodec_set_dimensions(s->avctx, s->w, s->h); + av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int)); + } + + /* There is 1 change bit per 4 pixels, so each change byte represents + * 32 pixels; divide width by 4 to obtain the number of change bits and + * then round up to the nearest byte. */ + s->mb_change_bits_row_size = ((s->avctx->width >> (2 - width_shift)) + 7) >> 3; if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable)) { @@ -476,8 +478,7 @@ /* there is a vertical predictor for each pixel in a line; each vertical * predictor is 0 to start with */ - s->vert_pred = - (unsigned int *)av_malloc(s->avctx->width * sizeof(unsigned int)); + av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int)); return 0; } @@ -831,7 +832,7 @@ } } - pixels_left -= 4; + pixels_left -= 2; } /* next change row */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/tta.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/tta.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/tta.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/tta.c 2010-11-06 17:21:28.000000000 +0000 @@ -63,7 +63,7 @@ int32_t *decode_buffer; - TTAChannel *ch_ctx;; + TTAChannel *ch_ctx; } TTAContext; #if 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/txd.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/txd.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/txd.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/txd.c 2010-11-06 17:21:28.000000000 +0000 @@ -80,7 +80,7 @@ if (p->data[0]) avctx->release_buffer(avctx, p); - if (av_check_image_size(w, h, 0, avctx)) + if (av_image_check_size(w, h, 0, avctx)) return -1; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/utils.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/utils.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/utils.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/utils.c 2010-11-06 17:21:28.000000000 +0000 @@ -30,9 +30,10 @@ #include "libavutil/crc.h" #include "libavutil/pixdesc.h" #include "libavcore/imgutils.h" +#include "libavcore/samplefmt.h" #include "avcodec.h" #include "dsputil.h" -#include "opt.h" +#include "libavutil/opt.h" #include "imgconvert.h" #include "thread.h" #include "audioconvert.h" @@ -140,7 +141,7 @@ case PIX_FMT_YUVA420P: w_align= 16; //FIXME check for non mpeg style codecs and use less alignment h_align= 16; - if(s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MJPEG || s->codec_id == CODEC_ID_AMV || s->codec_id == CODEC_ID_THP) + if(s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MJPEG || s->codec_id == CODEC_ID_AMV || s->codec_id == CODEC_ID_THP || s->codec_id == CODEC_ID_H264) h_align= 32; // interlaced is rounded up to 2 MBs break; case PIX_FMT_YUV411P: @@ -216,7 +217,7 @@ #if LIBAVCODEC_VERSION_MAJOR < 53 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){ - return av_check_image_size(w, h, 0, av_log_ctx); + return av_image_check_size(w, h, 0, av_log_ctx); } #endif @@ -236,7 +237,7 @@ return -1; } - if(av_check_image_size(w, h, 0, s)) + if(av_image_check_size(w, h, 0, s)) return -1; if(s->internal_buffer==NULL){ @@ -289,7 +290,7 @@ do { // NOTE: do not align linesizes individually, this breaks e.g. assumptions // that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2 - av_fill_image_linesizes(picture.linesize, s->pix_fmt, w); + av_image_fill_linesizes(picture.linesize, s->pix_fmt, w); // increase alignment of w for next try (rhs gives the lowest bit set in w) w += w & ~(w-1); @@ -299,7 +300,7 @@ } } while (unaligned); - tmpsize = av_fill_image_pointers(picture.data, s->pix_fmt, h, NULL, picture.linesize); + tmpsize = av_image_fill_pointers(picture.data, s->pix_fmt, h, NULL, picture.linesize); if (tmpsize < 0) return -1; @@ -479,11 +480,17 @@ goto end; if (codec->priv_data_size > 0) { + if(!avctx->priv_data){ avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; } + if(codec->priv_class){ //this can be droped once all user apps use avcodec_get_context_defaults3() + *(AVClass**)avctx->priv_data= codec->priv_class; + av_opt_set_defaults(avctx->priv_data); + } + } } else { avctx->priv_data = NULL; } @@ -493,10 +500,15 @@ else if(avctx->width && avctx->height) avcodec_set_dimensions(avctx, avctx->width, avctx->height); + if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) + && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 + || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { + av_log(avctx, AV_LOG_WARNING, "ignoring invalid width/height values\n"); + avcodec_set_dimensions(avctx, 0, 0); + } + #define SANE_NB_CHANNELS 128U - if (((avctx->coded_width || avctx->coded_height) - && av_check_image_size(avctx->coded_width, avctx->coded_height, 0, avctx)) - || avctx->channels > SANE_NB_CHANNELS) { + if (avctx->channels > SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } @@ -516,25 +528,25 @@ if (HAVE_THREADS && !avctx->thread_opaque) { ret = avcodec_thread_init(avctx, avctx->thread_count); if (ret < 0) { - av_freep(&avctx->priv_data); - avctx->codec= NULL; - goto end; + goto free_and_end; } } - if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ - if(avctx->codec_type == AVMEDIA_TYPE_VIDEO && - avctx->codec->max_lowres < avctx->lowres){ - av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", - avctx->codec->max_lowres); - goto free_and_end; - } + if (avctx->codec->max_lowres < avctx->lowres) { + av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", + avctx->codec->max_lowres); + goto free_and_end; + } - ret = avctx->codec->init(avctx); - if (ret < 0) { - goto free_and_end; + if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ + if(avctx->codec->init){ + ret = avctx->codec->init(avctx); + if (ret < 0) { + goto free_and_end; + } } } + ret=0; end: entangled_thread_counter--; @@ -572,7 +584,7 @@ av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n"); return -1; } - if(av_check_image_size(avctx->width, avctx->height, 0, avctx)) + if(av_image_check_size(avctx->width, avctx->height, 0, avctx)) return -1; if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){ int ret = avctx->codec->encode(avctx, buf, buf_size, pict); @@ -599,7 +611,7 @@ return ret; } -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_VIDEO_OLD int attribute_align_arg avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, const uint8_t *buf, int buf_size) @@ -623,7 +635,7 @@ int threaded = avctx->active_thread_type&FF_THREAD_FRAME; *got_picture_ptr= 0; - if((avctx->coded_width||avctx->coded_height) && av_check_image_size(avctx->coded_width, avctx->coded_height, 0, avctx)) + if((avctx->coded_width||avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx)) return -1; if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || threaded){ if (HAVE_PTHREADS && threaded) ret = ff_thread_decode_frame(avctx, picture, @@ -641,7 +653,7 @@ return ret; } -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_AUDIO_OLD int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, const uint8_t *buf, int buf_size) @@ -682,7 +694,7 @@ return ret; } -#if LIBAVCODEC_VERSION_MAJOR < 53 +#if FF_API_SUBTITLE_OLD int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const uint8_t *buf, int buf_size) @@ -935,7 +947,7 @@ avcodec_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout); if (enc->sample_fmt != SAMPLE_FMT_NONE) { snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %s", avcodec_get_sample_fmt_name(enc->sample_fmt)); + ", %s", av_get_sample_fmt_name(enc->sample_fmt)); } break; case AVMEDIA_TYPE_DATA: @@ -1078,21 +1090,11 @@ } } +#if FF_API_OLD_SAMPLE_FMT int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) { - switch (sample_fmt) { - case SAMPLE_FMT_U8: - return 8; - case SAMPLE_FMT_S16: - return 16; - case SAMPLE_FMT_S32: - case SAMPLE_FMT_FLT: - return 32; - case SAMPLE_FMT_DBL: - return 64; - default: - return 0; - } + return av_get_bits_per_sample_fmt(sample_fmt); } +#endif #if !HAVE_THREADS int avcodec_thread_init(AVCodecContext *s, int thread_count){ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vc1.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vc1.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vc1.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vc1.c 2010-11-06 17:21:28.000000000 +0000 @@ -306,13 +306,17 @@ { v->zz_8x4 = wmv2_scantableA; v->zz_4x8 = wmv2_scantableB; - v->res_sm = get_bits(gb, 2); //reserved - if (v->res_sm) + v->res_y411 = get_bits1(gb); + v->res_sprite = get_bits1(gb); + if (v->res_y411) { av_log(avctx, AV_LOG_ERROR, - "Reserved RES_SM=%i is forbidden\n", v->res_sm); + "Old interlaced mode is not supported\n"); return -1; } + if (v->res_sprite) { + av_log(avctx, AV_LOG_ERROR, "WMVP is not fully supported\n"); + } } // (fps-2)/4 (->30) @@ -382,7 +386,21 @@ v->quantizer_mode = get_bits(gb, 2); //common v->finterpflag = get_bits1(gb); //common - v->res_rtm_flag = get_bits1(gb); //reserved + + if (v->res_sprite) { + v->s.avctx->width = v->s.avctx->coded_width = get_bits(gb, 11); + v->s.avctx->height = v->s.avctx->coded_height = get_bits(gb, 11); + skip_bits(gb, 5); //frame rate + v->res_x8 = get_bits1(gb); + if (get_bits1(gb)) { // something to do with DC VLC selection + av_log(avctx, AV_LOG_ERROR, "Unsupported sprite feature\n"); + return -1; + } + skip_bits(gb, 3); //slice code + v->res_rtm_flag = 0; + } else { + v->res_rtm_flag = get_bits1(gb); //reserved + } if (!v->res_rtm_flag) { // av_log(avctx, AV_LOG_ERROR, @@ -561,6 +579,9 @@ { int pqindex, lowquant, status; + if(v->res_sprite) { + skip_bits(gb, 2); //not yet deciphered + } if(v->finterpflag) v->interpfrm = get_bits1(gb); skip_bits(gb, 2); //framecnt unused v->rangeredfrm = 0; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vc1dec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vc1dec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vc1dec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vc1dec.c 2010-11-06 17:21:28.000000000 +0000 @@ -3240,6 +3240,11 @@ } } + if(v->res_sprite && (s->pict_type!=FF_I_TYPE)){ + av_free(buf2); + return -1; + } + // for hurry_up==5 s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == FF_I_TYPE; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vc1dsp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vc1dsp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vc1dsp.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vc1dsp.c 2010-11-06 17:21:28.000000000 +0000 @@ -630,7 +630,7 @@ dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_c; dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_c; - dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_c; + dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_pixels8x8_c; dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_c; dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_c; dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_c; @@ -647,7 +647,7 @@ dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_c; dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_c; - dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_c; + dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_pixels8x8_c; dsp->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_c; dsp->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_c; dsp->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_c; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vc1.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vc1.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vc1.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vc1.h 2010-11-06 17:21:28.000000000 +0000 @@ -160,7 +160,8 @@ /** Simple/Main Profile sequence header */ //@{ - int res_sm; ///< reserved, 2b + int res_sprite; ///< reserved, sprite mode + int res_y411; ///< reserved, old interlaced mode int res_x8; ///< reserved int multires; ///< frame-level RESPIC syntax element present int res_fasttx; ///< reserved, always 1 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vorbis_dec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vorbis_dec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vorbis_dec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vorbis_dec.c 2010-11-06 17:21:28.000000000 +0000 @@ -61,8 +61,8 @@ typedef struct vorbis_floor1_s vorbis_floor1; struct vorbis_context_s; typedef -uint_fast8_t (* vorbis_floor_decode_func) - (struct vorbis_context_s *, vorbis_floor_data *, float *); +int (* vorbis_floor_decode_func) + (struct vorbis_context_s *, vorbis_floor_data *, float *); typedef struct { uint_fast8_t floor_type; vorbis_floor_decode_func decode; @@ -459,15 +459,15 @@ // Process floors part -static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc, - vorbis_floor_data *vfu, float *vec); +static int vorbis_floor0_decode(vorbis_context *vc, + vorbis_floor_data *vfu, float *vec); static void create_map(vorbis_context *vc, uint_fast8_t floor_number); -static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, - vorbis_floor_data *vfu, float *vec); +static int vorbis_floor1_decode(vorbis_context *vc, + vorbis_floor_data *vfu, float *vec); static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) { GetBitContext *gb = &vc->gb; - uint_fast16_t i,j,k; + int i,j,k; vc->floor_count = get_bits(gb, 6) + 1; @@ -1015,8 +1015,8 @@ // Read and decode floor -static uint_fast8_t vorbis_floor0_decode(vorbis_context *vc, - vorbis_floor_data *vfu, float *vec) +static int vorbis_floor0_decode(vorbis_context *vc, + vorbis_floor_data *vfu, float *vec) { vorbis_floor0 *vf = &vfu->t0; float *lsp = vf->lsp; @@ -1040,6 +1040,9 @@ } AV_DEBUG("floor0 dec: booknumber: %u\n", book_idx); codebook = vc->codebooks[vf->book_list[book_idx]]; + /* Invalid codebook! */ + if (!codebook.codevectors) + return -1; while (lsp_lenorder) { int vec_off; @@ -1125,8 +1128,8 @@ return 0; } -static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, - vorbis_floor_data *vfu, float *vec) +static int vorbis_floor1_decode(vorbis_context *vc, + vorbis_floor_data *vfu, float *vec) { vorbis_floor1 *vf = &vfu->t1; GetBitContext *gb = &vc->gb; @@ -1502,13 +1505,20 @@ for (i = 0; i < vc->audio_channels; ++i) { vorbis_floor *floor; + int ret; if (mapping->submaps > 1) { floor = &vc->floors[mapping->submap_floor[mapping->mux[i]]]; } else { floor = &vc->floors[mapping->submap_floor[0]]; } - no_residue[i] = floor->decode(vc, &floor->data, ch_floor_ptr); + ret = floor->decode(vc, &floor->data, ch_floor_ptr); + + if (ret < 0) { + av_log(vc->avccontext, AV_LOG_ERROR, "Invalid codebook in vorbis_floor_decode.\n"); + return -1; + } + no_residue[i] = ret; ch_floor_ptr += blocksize / 2; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vorbis_enc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vorbis_enc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vorbis_enc.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vorbis_enc.c 2010-11-06 17:21:28.000000000 +0000 @@ -126,6 +126,17 @@ int64_t sample_count; } vorbis_enc_context; +#define MAX_CHANNELS 2 +#define MAX_CODEBOOK_DIM 8 + +#define MAX_FLOOR_CLASS_DIM 4 +#define NUM_FLOOR_PARTITIONS 8 +#define MAX_FLOOR_VALUES (MAX_FLOOR_CLASS_DIM*NUM_FLOOR_PARTITIONS+2) + +#define RESIDUE_SIZE 1600 +#define RESIDUE_PART_SIZE 32 +#define NUM_RESIDUE_PARTITIONS (RESIDUE_SIZE/RESIDUE_PART_SIZE) + static inline void put_codeword(PutBitContext *pb, vorbis_enc_codebook *cb, int entry) { @@ -263,7 +274,7 @@ // just 1 floor fc = &venc->floors[0]; - fc->partitions = 8; + fc->partitions = NUM_FLOOR_PARTITIONS; fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions); fc->nclasses = 0; for (i = 0; i < fc->partitions; i++) { @@ -668,7 +679,7 @@ int range = 255 / fc->multiplier + 1; int i; float tot_average = 0.; - float averages[fc->values]; + float averages[MAX_FLOOR_VALUES]; for (i = 0; i < fc->values; i++) { averages[i] = get_floor_average(fc, coeffs, i); tot_average += averages[i]; @@ -699,7 +710,7 @@ float *floor, int samples) { int range = 255 / fc->multiplier + 1; - int coded[fc->values]; // first 2 values are unused + int coded[MAX_FLOOR_VALUES]; // first 2 values are unused int i, counter; put_bits(pb, 1, 1); // non zero @@ -807,7 +818,7 @@ int psize = rc->partition_size; int partitions = (rc->end - rc->begin) / psize; int channels = (rc->type == 2) ? 1 : real_ch; - int classes[channels][partitions]; + int classes[MAX_CHANNELS][NUM_RESIDUE_PARTITIONS]; int classwords = venc->codebooks[rc->classbook].ndimentions; assert(rc->type == 2); @@ -864,7 +875,7 @@ s = real_ch * samples; for (k = 0; k < psize; k += book->ndimentions) { int dim, a2 = a1, b2 = b1; - float vec[book->ndimentions], *pv = vec; + float vec[MAX_CODEBOOK_DIM], *pv = vec; for (dim = book->ndimentions; dim--; ) { *pv++ = coeffs[a2 + b2]; if ((a2 += samples) == s) { @@ -999,7 +1010,7 @@ for (i = 0; i < venc->channels; i++) { vorbis_enc_floor *fc = &venc->floors[mapping->floor[mapping->mux[i]]]; - uint_fast16_t posts[fc->values]; + uint_fast16_t posts[MAX_FLOOR_VALUES]; floor_fit(venc, fc, &venc->coeffs[i * samples], posts, samples); floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp3.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp3.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp3.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp3.c 2010-11-06 17:21:28.000000000 +0000 @@ -1320,21 +1320,23 @@ int offset[4]; if (HAVE_PTHREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) { - int y_flipped = s->flipped_image ? s->height-y : y; + int y_flipped = s->flipped_image ? s->avctx->height-y : y; - ff_thread_report_progress(&s->current_frame, y_flipped==s->height ? s->height : y_flipped-1, 0); + // At the end of the frame, report INT_MAX instead of the height of the frame. + // This makes the other threads' ff_thread_await_progress() calls cheaper, because + // they don't have to clip their values. + ff_thread_report_progress(&s->current_frame, y_flipped==s->avctx->height ? INT_MAX : y_flipped-1, 0); } if(s->avctx->draw_horiz_band==NULL) return; h= y - s->last_slice_end; + s->last_slice_end= y; y -= h; if (!s->flipped_image) { - if (y == 0) - h -= s->height - s->avctx->height; // account for non-mod16 - y = s->height - y - h; + y = s->avctx->height - y - h; } cy = y >> s->chroma_y_shift; @@ -1345,22 +1347,17 @@ emms_c(); s->avctx->draw_horiz_band(s->avctx, &s->current_frame, offset, y, 3, h); - s->last_slice_end= y + h; } /** - * Wait for the reference frame of a fragment. - * Units used are luma pixel rows. + * Wait for the reference frame of the current fragment. + * The progress value is in luma pixel rows. */ static void await_reference_row(Vp3DecodeContext *s, Vp3Fragment *fragment, int motion_y, int y) { AVFrame *ref_frame; - int border = motion_y&1; - int max_row = s->height; int ref_row; - - if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) - return; + int border = motion_y&1; if (fragment->coding_method == MODE_USING_GOLDEN || fragment->coding_method == MODE_GOLDEN_MV) @@ -1368,10 +1365,10 @@ else ref_frame = &s->last_frame; - ref_row = y + (motion_y >> 1); + ref_row = y + (motion_y>>1); ref_row = FFMAX(FFABS(ref_row), ref_row + 8 + border); - ff_thread_await_progress(ref_frame, FFMIN(ref_row, max_row), 0); + ff_thread_await_progress(ref_frame, ref_row, 0); } /* @@ -1380,7 +1377,7 @@ */ static void render_slice(Vp3DecodeContext *s, int slice) { - int x, y, i, j; + int x, y, i, j, fragment; LOCAL_ALIGNED_16(DCTELEM, block, [64]); int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef; int motion_halfpel_index; @@ -1406,6 +1403,7 @@ int fragment_width = s->fragment_width[!!plane]; int fragment_height = s->fragment_height[!!plane]; int fragment_start = s->fragment_start[plane]; + int do_await = !plane && HAVE_PTHREADS && (s->avctx->active_thread_type&FF_THREAD_FRAME); if (!s->flipped_image) stride = -stride; if (CONFIG_GRAY && plane && (s->avctx->flags & CODEC_FLAG_GRAY)) @@ -1425,8 +1423,9 @@ for (j = 0; j < 16; j++) { x = 4*sb_x + hilbert_offset[j][0]; y = 4*sb_y + hilbert_offset[j][1]; + fragment = y*fragment_width + x; - i = fragment_start + y*fragment_width + x; + i = fragment_start + fragment; // bounds check if (x >= fragment_width || y >= fragment_height) @@ -1434,8 +1433,8 @@ first_pixel = 8*y*stride + 8*x; - if (s->all_fragments[i].coding_method != MODE_INTRA && !plane) - await_reference_row(s, &s->all_fragments[i], motion_val[y*fragment_width + x][1], (16*y) >> s->chroma_y_shift); + if (do_await && s->all_fragments[i].coding_method != MODE_INTRA) + await_reference_row(s, &s->all_fragments[i], motion_val[fragment][1], (16*y) >> s->chroma_y_shift); /* transform if this block was coded */ if (s->all_fragments[i].coding_method != MODE_COPY) { @@ -1453,8 +1452,8 @@ if ((s->all_fragments[i].coding_method > MODE_INTRA) && (s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) { int src_x, src_y; - motion_x = motion_val[y*fragment_width + x][0]; - motion_y = motion_val[y*fragment_width + x][1]; + motion_x = motion_val[fragment][0]; + motion_y = motion_val[fragment][1]; src_x= (motion_x>>1) + 8*x; src_y= (motion_y>>1) + 8*y; @@ -1545,10 +1544,10 @@ * dispatch (slice - 1); */ - vp3_draw_horiz_band(s, FFMIN(64*slice + 64-16, s->height-16)); + vp3_draw_horiz_band(s, FFMIN((32 << s->chroma_y_shift) * (slice + 1) -16, s->height-16)); } -/// Allocate tables for frame data in Vp3DecodeContext +/// Allocate tables for per-frame data in Vp3DecodeContext static av_cold int allocate_tables(AVCodecContext *avctx) { Vp3DecodeContext *s = avctx->priv_data; @@ -1781,7 +1780,6 @@ s->current_frame.data[0]= NULL; /* ensure that we catch any access to this released frame */ } -#define copy_fields(to, from, start_field, end_field) memcpy(&to->start_field, &from->start_field, (char*)&to->end_field - (char*)&to->start_field) static int vp3_update_thread_context(AVCodecContext *dst, AVCodecContext *src) { Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data; @@ -1806,6 +1804,8 @@ memcpy(s->motion_val[1], s1->motion_val[1], c_fragment_count * sizeof(*s->motion_val[1])); } +#define copy_fields(to, from, start_field, end_field) memcpy(&to->start_field, &from->start_field, (char*)&to->end_field - (char*)&to->start_field) + // copy previous frame data copy_fields(s, s1, golden_frame, dsp); @@ -1824,6 +1824,7 @@ if (qps_changed) copy_fields(s, s1, qps, superblock_count); +#undef copy_fields } update_frames(dst); @@ -1968,7 +1969,7 @@ int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1; apply_loop_filter(s, i, row, row+1); } - vp3_draw_horiz_band(s, s->height); + vp3_draw_horiz_band(s, s->avctx->height); *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; @@ -2077,7 +2078,7 @@ Vp3DecodeContext *s = avctx->priv_data; int visible_width, visible_height, colorspace; int offset_x = 0, offset_y = 0; - AVRational fps; + AVRational fps, aspect; s->theora = get_bits_long(gb, 24); av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora); @@ -2093,7 +2094,7 @@ visible_width = s->width = get_bits(gb, 16) << 4; visible_height = s->height = get_bits(gb, 16) << 4; - if(av_check_image_size(s->width, s->height, 0, avctx)){ + if(av_image_check_size(s->width, s->height, 0, avctx)){ av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s->height); s->width= s->height= 0; return -1; @@ -2114,8 +2115,13 @@ fps.den, fps.num, 1<<30); } - avctx->sample_aspect_ratio.num = get_bits_long(gb, 24); - avctx->sample_aspect_ratio.den = get_bits_long(gb, 24); + aspect.num = get_bits_long(gb, 24); + aspect.den = get_bits_long(gb, 24); + if (aspect.num && aspect.den) { + av_reduce(&avctx->sample_aspect_ratio.num, + &avctx->sample_aspect_ratio.den, + aspect.num, aspect.den, 1<<30); + } if (s->theora < 0x030200) skip_bits(gb, 5); /* keyframe frequency force */ @@ -2161,13 +2167,9 @@ if (s->theora >= 0x030200) { n = get_bits(gb, 3); /* loop filter limit values table */ - for (i = 0; i < 64; i++) { - s->filter_limit_values[i] = get_bits(gb, n); - if (s->filter_limit_values[i] > 127) { - av_log(avctx, AV_LOG_ERROR, "filter limit value too large (%i > 127), clamping\n", s->filter_limit_values[i]); - s->filter_limit_values[i] = 127; - } - } + if (n) + for (i = 0; i < 64; i++) + s->filter_limit_values[i] = get_bits(gb, n); } if (s->theora >= 0x030200) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp56dsp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp56dsp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp56dsp.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp56dsp.c 2010-11-06 17:21:28.000000000 +0000 @@ -82,7 +82,12 @@ } else { s->edge_filter_hor = vp6_edge_filter_hor; s->edge_filter_ver = vp6_edge_filter_ver; + + if (CONFIG_VP6_DECODER) { + s->vp6_filter_diag4 = ff_vp6_filter_diag4_c; + } } if (ARCH_ARM) ff_vp56dsp_init_arm(s, codec); + if (HAVE_MMX) ff_vp56dsp_init_x86(s, codec); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp56dsp.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp56dsp.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp56dsp.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp56dsp.h 2010-11-06 17:21:28.000000000 +0000 @@ -22,13 +22,21 @@ #define AVCODEC_VP56DSP_H #include +#include "avcodec.h" typedef struct VP56DSPContext { void (*edge_filter_hor)(uint8_t *yuv, int stride, int t); void (*edge_filter_ver)(uint8_t *yuv, int stride, int t); + + void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, int stride, + const int16_t *h_weights,const int16_t *v_weights); } VP56DSPContext; +void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride, + const int16_t *h_weights, const int16_t *v_weights); + void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec); void ff_vp56dsp_init_arm(VP56DSPContext *s, enum CodecID codec); +void ff_vp56dsp_init_x86(VP56DSPContext* c, enum CodecID codec); #endif /* AVCODEC_VP56DSP_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp56.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp56.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp56.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp56.h 2010-11-06 17:21:28.000000000 +0000 @@ -194,8 +194,8 @@ code_word <<= shift; bits += shift; if(bits >= 0 && c->buffer < c->end) { - code_word |= *c->buffer++ << bits; - bits -= 8; + code_word |= bytestream_get_be16(&c->buffer) << bits; + bits -= 16; } c->bits = bits; return code_word; @@ -211,7 +211,7 @@ { unsigned int code_word = vp56_rac_renorm(c); unsigned int low = 1 + (((c->high - 1) * prob) >> 8); - unsigned int low_shift = low << 8; + unsigned int low_shift = low << 16; int bit = code_word >= low_shift; c->high = bit ? c->high - low : low; @@ -226,7 +226,7 @@ { unsigned long code_word = vp56_rac_renorm(c); unsigned low = 1 + (((c->high - 1) * prob) >> 8); - unsigned low_shift = low << 8; + unsigned low_shift = low << 16; if (code_word >= low_shift) { c->high -= low; @@ -244,7 +244,7 @@ unsigned int code_word = vp56_rac_renorm(c); /* equiprobable */ int low = (c->high + 1) >> 1; - unsigned int low_shift = low << 8; + unsigned int low_shift = low << 16; int bit = code_word >= low_shift; if (bit) { c->high -= low; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp56rac.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp56rac.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp56rac.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp56rac.c 2010-11-06 17:21:28.000000000 +0000 @@ -40,8 +40,8 @@ void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size) { c->high = 255; - c->bits = -8; + c->bits = -16; c->buffer = buf; c->end = buf + buf_size; - c->code_word = bytestream_get_be16(&c->buffer); + c->code_word = bytestream_get_be24(&c->buffer); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp6.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp6.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp6.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp6.c 2010-11-06 17:21:28.000000000 +0000 @@ -559,7 +559,7 @@ vp6_filter_hv4(dst, src+offset1, stride, stride, vp6_block_copy_filter[select][y8]); } else { - s->dsp.vp6_filter_diag4(dst, src+offset1+((mv.x^mv.y)>>31), stride, + s->vp56dsp.vp6_filter_diag4(dst, src+offset1+((mv.x^mv.y)>>31), stride, vp6_block_copy_filter[select][x8], vp6_block_copy_filter[select][y8]); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp6dsp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp6dsp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp6dsp.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp6dsp.c 2010-11-06 17:21:28.000000000 +0000 @@ -22,7 +22,7 @@ */ #include "libavutil/common.h" -#include "dsputil.h" +#include "vp56dsp.h" void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp8.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp8.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vp8.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vp8.c 2010-11-06 17:21:28.000000000 +0000 @@ -87,12 +87,10 @@ VP8Macroblock *macroblocks; VP8Macroblock *macroblocks_base; VP8FilterStrength *filter_strength; - int mb_stride; uint8_t *intra4x4_pred_mode_top; uint8_t intra4x4_pred_mode_left[4]; uint8_t *segmentation_map; - int b4_stride; /** * Cache of the top row needed for intra prediction @@ -225,7 +223,7 @@ static int update_dimensions(VP8Context *s, int width, int height) { - if (av_check_image_size(width, height, 0, s->avctx)) + if (av_image_check_size(width, height, 0, s->avctx)) return AVERROR_INVALIDDATA; vp8_decode_flush(s->avctx); @@ -235,17 +233,12 @@ s->mb_width = (s->avctx->coded_width +15) / 16; s->mb_height = (s->avctx->coded_height+15) / 16; - // we allocate a border around the top/left of intra4x4 modes - // this is 4 blocks for intra4x4 to keep 4-byte alignment for fill_rectangle - s->mb_stride = s->mb_width+1; - s->b4_stride = 4*s->mb_stride; - - s->macroblocks_base = av_mallocz((s->mb_stride+s->mb_height*2+2)*sizeof(*s->macroblocks)); - s->filter_strength = av_mallocz(s->mb_stride*sizeof(*s->filter_strength)); - s->intra4x4_pred_mode_top = av_mallocz(s->b4_stride*4); + s->macroblocks_base = av_mallocz((s->mb_width+s->mb_height*2+1)*sizeof(*s->macroblocks)); + s->filter_strength = av_mallocz(s->mb_width*sizeof(*s->filter_strength)); + s->intra4x4_pred_mode_top = av_mallocz(s->mb_width*4); s->top_nnz = av_mallocz(s->mb_width*sizeof(*s->top_nnz)); s->top_border = av_mallocz((s->mb_width+1)*sizeof(*s->top_border)); - s->segmentation_map = av_mallocz(s->mb_stride*s->mb_height); + s->segmentation_map = av_mallocz(s->mb_width*s->mb_height); if (!s->macroblocks_base || !s->filter_strength || !s->intra4x4_pred_mode_top || !s->top_nnz || !s->top_border || !s->segmentation_map) @@ -535,7 +528,7 @@ } static av_always_inline -void find_near_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, +void find_near_mvs(VP8Context *s, VP8Macroblock *mb, VP56mv near[2], VP56mv *best, uint8_t cnt[4]) { VP8Macroblock *mb_edge[3] = { mb + 2 /* top */, @@ -767,7 +760,7 @@ s->ref_count[mb->ref_frame-1]++; // motion vectors, 16.3 - find_near_mvs(s, mb, mb_x, mb_y, near, &best, cnt); + find_near_mvs(s, mb, near, &best, cnt); if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[0]][0])) { if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[1]][1])) { if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[2]][2])) { @@ -778,8 +771,8 @@ } else { mb->mode = VP8_MVMODE_NEW; clamp_mv(s, &mb->mv, &mb->mv, mb_x, mb_y); - mb->mv.y += + read_mv_component(c, s->prob->mvc[0]); - mb->mv.x += + read_mv_component(c, s->prob->mvc[1]); + mb->mv.y += read_mv_component(c, s->prob->mvc[0]); + mb->mv.x += read_mv_component(c, s->prob->mvc[1]); } } else { mb->mode = VP8_MVMODE_NEAR; @@ -1536,26 +1529,26 @@ memset(s->top_nnz, 0, s->mb_width*sizeof(*s->top_nnz)); - /* Zero macroblock structures for top/left prediction from outside the frame. */ - memset(s->macroblocks, 0, (s->mb_width + s->mb_height*2)*sizeof(*s->macroblocks)); + /* Zero macroblock structures for top/top-left prediction from outside the frame. */ + memset(s->macroblocks + s->mb_height*2 - 1, 0, (s->mb_width+1)*sizeof(*s->macroblocks)); // top edge of 127 for intra prediction memset(s->top_border, 127, (s->mb_width+1)*sizeof(*s->top_border)); memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->keyframe) - memset(s->intra4x4_pred_mode_top, DC_PRED, s->b4_stride*4); + memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4); for (mb_y = 0; mb_y < s->mb_height; mb_y++) { VP56RangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions-1)]; VP8Macroblock *mb = s->macroblocks + (s->mb_height - mb_y - 1)*2; - uint8_t *segment_map = s->segmentation_map + mb_y*s->mb_stride; - int mb_xy = mb_y * s->mb_stride; + int mb_xy = mb_y*s->mb_width; uint8_t *dst[3] = { curframe->data[0] + 16*mb_y*s->linesize, curframe->data[1] + 8*mb_y*s->uvlinesize, curframe->data[2] + 8*mb_y*s->uvlinesize }; + memset(mb - 1, 0, sizeof(*mb)); // zero left macroblock memset(s->left_nnz, 0, sizeof(s->left_nnz)); AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101); @@ -1568,13 +1561,11 @@ memset(s->top_border, 129, sizeof(*s->top_border)); for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { - uint8_t *segment_mb = segment_map+mb_x; - /* Prefetch the current frame, 4 MBs ahead */ s->dsp.prefetch(dst[0] + (mb_x&3)*4*s->linesize + 64, s->linesize, 4); s->dsp.prefetch(dst[1] + (mb_x&7)*s->uvlinesize + 64, dst[2] - dst[1], 2); - decode_mb_mode(s, mb, mb_x, mb_y, segment_mb); + decode_mb_mode(s, mb, mb_x, mb_y, s->segmentation_map + mb_xy); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_PREVIOUS); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vqavideo.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vqavideo.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/vqavideo.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/vqavideo.c 2010-11-06 17:21:28.000000000 +0000 @@ -148,7 +148,7 @@ s->vqa_version = vqa_header[0]; s->width = AV_RL16(&vqa_header[6]); s->height = AV_RL16(&vqa_header[8]); - if(av_check_image_size(s->width, s->height, 0, avctx)){ + if(av_image_check_size(s->width, s->height, 0, avctx)){ s->width= s->height= 0; return -1; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/wmavoice.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/wmavoice.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/wmavoice.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/wmavoice.c 2010-11-06 17:21:28.000000000 +0000 @@ -1033,7 +1033,8 @@ static void aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb, int block_idx, AMRFixed *fcb) { - uint16_t use_mask[7]; // only 5 are used, rest is padding + uint16_t use_mask_mem[9]; // only 5 are used, rest is padding + uint16_t *use_mask = use_mask_mem + 2; /* in this function, idx is the index in the 80-bit (+ padding) use_mask * bit-array. Since use_mask consists of 16-bit values, the lower 4 bits * of idx are the position of the bit within a particular item in the @@ -1065,6 +1066,7 @@ /* aw_pulse_set1() already applies pulses around pulse_off (to be exactly, * in the range of [pulse_off, pulse_off + s->aw_pulse_range], and thus * we exclude that range from being pulsed again in this function. */ + memset(&use_mask[-2], 0, 2 * sizeof(use_mask[0])); memset( use_mask, -1, 5 * sizeof(use_mask[0])); memset(&use_mask[5], 0, 2 * sizeof(use_mask[0])); if (s->aw_n_pulses[block_idx] > 0) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ws-snd1.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ws-snd1.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/ws-snd1.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/ws-snd1.c 2010-11-06 17:21:28.000000000 +0000 @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "libavutil/intreadwrite.h" #include "avcodec.h" @@ -31,8 +32,8 @@ * http://www.multimedia.cx */ -static const char ws_adpcm_2bit[] = { -2, -1, 0, 1}; -static const char ws_adpcm_4bit[] = { +static const int8_t ws_adpcm_2bit[] = { -2, -1, 0, 1}; +static const int8_t ws_adpcm_4bit[] = { -9, -8, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 8 }; @@ -120,7 +121,7 @@ break; case 2: /* no compression */ if (count & 0x20) { /* big delta */ - char t; + int8_t t; t = count; t <<= 3; sample += t >> 3; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/cavsdsp_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/cavsdsp_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/cavsdsp_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/cavsdsp_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -23,6 +23,7 @@ */ #include "libavutil/common.h" +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/cavsdsp.h" @@ -173,7 +174,7 @@ ); } - add_pixels_clamped_mmx(b2, dst, stride); + ff_add_pixels_clamped_mmx(b2, dst, stride); } /***************************************************************************** @@ -472,8 +473,8 @@ void ff_cavsdsp_init_mmx(CAVSDSPContext *c, AVCodecContext *avctx) { - int mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); - if (mm_flags & FF_MM_MMX2) ff_cavsdsp_init_mmx2 (c, avctx); - if (mm_flags & FF_MM_3DNOW) ff_cavsdsp_init_3dnow(c, avctx); + if (mm_flags & AV_CPU_FLAG_MMX2) ff_cavsdsp_init_mmx2 (c, avctx); + if (mm_flags & AV_CPU_FLAG_3DNOW) ff_cavsdsp_init_3dnow(c, avctx); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/cpuid.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/cpuid.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/cpuid.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/cpuid.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,150 +0,0 @@ -/* - * CPU detection code, extracted from mmx.h - * (c)1997-99 by H. Dietz and R. Fisher - * Converted to C and improved by Fabrice Bellard. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "libavutil/x86_cpu.h" -#include "libavcodec/dsputil.h" - -#undef printf - -/* ebx saving is necessary for PIC. gcc seems unable to see it alone */ -#define cpuid(index,eax,ebx,ecx,edx)\ - __asm__ volatile\ - ("mov %%"REG_b", %%"REG_S"\n\t"\ - "cpuid\n\t"\ - "xchg %%"REG_b", %%"REG_S\ - : "=a" (eax), "=S" (ebx),\ - "=c" (ecx), "=d" (edx)\ - : "0" (index)); - -/* Function to test if multimedia instructions are supported... */ -int mm_support(void) -{ - int rval = 0; - int eax, ebx, ecx, edx; - int max_std_level, max_ext_level, std_caps=0, ext_caps=0; - int family=0, model=0; - union { int i[3]; char c[12]; } vendor; - -#if ARCH_X86_32 - x86_reg a, c; - __asm__ volatile ( - /* See if CPUID instruction is supported ... */ - /* ... Get copies of EFLAGS into eax and ecx */ - "pushfl\n\t" - "pop %0\n\t" - "mov %0, %1\n\t" - - /* ... Toggle the ID bit in one copy and store */ - /* to the EFLAGS reg */ - "xor $0x200000, %0\n\t" - "push %0\n\t" - "popfl\n\t" - - /* ... Get the (hopefully modified) EFLAGS */ - "pushfl\n\t" - "pop %0\n\t" - : "=a" (a), "=c" (c) - : - : "cc" - ); - - if (a == c) - return 0; /* CPUID not supported */ -#endif - - cpuid(0, max_std_level, vendor.i[0], vendor.i[2], vendor.i[1]); - - if(max_std_level >= 1){ - cpuid(1, eax, ebx, ecx, std_caps); - family = ((eax>>8)&0xf) + ((eax>>20)&0xff); - model = ((eax>>4)&0xf) + ((eax>>12)&0xf0); - if (std_caps & (1<<23)) - rval |= FF_MM_MMX; - if (std_caps & (1<<25)) - rval |= FF_MM_MMX2 -#if HAVE_SSE - | FF_MM_SSE; - if (std_caps & (1<<26)) - rval |= FF_MM_SSE2; - if (ecx & 1) - rval |= FF_MM_SSE3; - if (ecx & 0x00000200 ) - rval |= FF_MM_SSSE3; - if (ecx & 0x00080000 ) - rval |= FF_MM_SSE4; - if (ecx & 0x00100000 ) - rval |= FF_MM_SSE42; -#endif - ; - } - - cpuid(0x80000000, max_ext_level, ebx, ecx, edx); - - if(max_ext_level >= 0x80000001){ - cpuid(0x80000001, eax, ebx, ecx, ext_caps); - if (ext_caps & (1<<31)) - rval |= FF_MM_3DNOW; - if (ext_caps & (1<<30)) - rval |= FF_MM_3DNOWEXT; - if (ext_caps & (1<<23)) - rval |= FF_MM_MMX; - if (ext_caps & (1<<22)) - rval |= FF_MM_MMX2; - } - - if (!strncmp(vendor.c, "GenuineIntel", 12) && - family == 6 && (model == 9 || model == 13 || model == 14)) { - /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and 6/14 (core1 "yonah") - * theoretically support sse2, but it's usually slower than mmx, - * so let's just pretend they don't. */ - if (rval & FF_MM_SSE2) rval ^= FF_MM_SSE2SLOW|FF_MM_SSE2; - if (rval & FF_MM_SSE3) rval ^= FF_MM_SSE3SLOW|FF_MM_SSE3; - } - -#if 0 - av_log(NULL, AV_LOG_DEBUG, "%s%s%s%s%s%s%s%s%s%s%s%s\n", - (rval&FF_MM_MMX) ? "MMX ":"", - (rval&FF_MM_MMX2) ? "MMX2 ":"", - (rval&FF_MM_SSE) ? "SSE ":"", - (rval&FF_MM_SSE2) ? "SSE2 ":"", - (rval&FF_MM_SSE2SLOW) ? "SSE2(slow) ":"", - (rval&FF_MM_SSE3) ? "SSE3 ":"", - (rval&FF_MM_SSE3SLOW) ? "SSE3(slow) ":"", - (rval&FF_MM_SSSE3) ? "SSSE3 ":"", - (rval&FF_MM_SSE4) ? "SSE4.1 ":"", - (rval&FF_MM_SSE42) ? "SSE4.2 ":"", - (rval&FF_MM_3DNOW) ? "3DNow ":"", - (rval&FF_MM_3DNOWEXT) ? "3DNowExt ":""); -#endif - return rval; -} - -#ifdef TEST -int main ( void ) -{ - int mm_flags; - mm_flags = mm_support(); - printf("mm_support = 0x%08X\n",mm_flags); - return 0; -} -#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dct32_sse.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dct32_sse.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dct32_sse.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dct32_sse.c 2010-11-06 17:21:28.000000000 +0000 @@ -288,7 +288,9 @@ "movss %%xmm2, 116(%1) \n\t" :"+&r"(tmp1) :"r"(out), "r"(b1), "r"(smask), "r"(in) - :"memory" + :XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", + "%xmm4", "%xmm5", "%xmm6", "%xmm7",) + "memory" ); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dnxhd_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dnxhd_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dnxhd_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dnxhd_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -27,16 +27,16 @@ static void get_pixels_8x4_sym_sse2(DCTELEM *block, const uint8_t *pixels, int line_size) { __asm__ volatile( - "pxor %%xmm7, %%xmm7 \n\t" + "pxor %%xmm5, %%xmm5 \n\t" "movq (%0), %%xmm0 \n\t" "add %2, %0 \n\t" "movq (%0), %%xmm1 \n\t" "movq (%0, %2), %%xmm2 \n\t" "movq (%0, %2,2), %%xmm3 \n\t" - "punpcklbw %%xmm7, %%xmm0 \n\t" - "punpcklbw %%xmm7, %%xmm1 \n\t" - "punpcklbw %%xmm7, %%xmm2 \n\t" - "punpcklbw %%xmm7, %%xmm3 \n\t" + "punpcklbw %%xmm5, %%xmm0 \n\t" + "punpcklbw %%xmm5, %%xmm1 \n\t" + "punpcklbw %%xmm5, %%xmm2 \n\t" + "punpcklbw %%xmm5, %%xmm3 \n\t" "movdqa %%xmm0, (%1) \n\t" "movdqa %%xmm1, 16(%1) \n\t" "movdqa %%xmm2, 32(%1) \n\t" @@ -52,7 +52,7 @@ void ff_dnxhd_init_mmx(DNXHDEncContext *ctx) { - if (mm_flags & FF_MM_SSE2) { + if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2) { ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2; } } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputilenc_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputilenc_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputilenc_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputilenc_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -22,6 +22,7 @@ * MMX optimization by Nick Kurshev */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/mpegvideo.h" @@ -60,16 +61,16 @@ static void get_pixels_sse2(DCTELEM *block, const uint8_t *pixels, int line_size) { __asm__ volatile( - "pxor %%xmm7, %%xmm7 \n\t" + "pxor %%xmm4, %%xmm4 \n\t" "movq (%0), %%xmm0 \n\t" "movq (%0, %2), %%xmm1 \n\t" "movq (%0, %2,2), %%xmm2 \n\t" "movq (%0, %3), %%xmm3 \n\t" "lea (%0,%2,4), %0 \n\t" - "punpcklbw %%xmm7, %%xmm0 \n\t" - "punpcklbw %%xmm7, %%xmm1 \n\t" - "punpcklbw %%xmm7, %%xmm2 \n\t" - "punpcklbw %%xmm7, %%xmm3 \n\t" + "punpcklbw %%xmm4, %%xmm0 \n\t" + "punpcklbw %%xmm4, %%xmm1 \n\t" + "punpcklbw %%xmm4, %%xmm2 \n\t" + "punpcklbw %%xmm4, %%xmm3 \n\t" "movdqa %%xmm0, (%1) \n\t" "movdqa %%xmm1, 16(%1) \n\t" "movdqa %%xmm2, 32(%1) \n\t" @@ -78,10 +79,10 @@ "movq (%0, %2), %%xmm1 \n\t" "movq (%0, %2,2), %%xmm2 \n\t" "movq (%0, %3), %%xmm3 \n\t" - "punpcklbw %%xmm7, %%xmm0 \n\t" - "punpcklbw %%xmm7, %%xmm1 \n\t" - "punpcklbw %%xmm7, %%xmm2 \n\t" - "punpcklbw %%xmm7, %%xmm3 \n\t" + "punpcklbw %%xmm4, %%xmm0 \n\t" + "punpcklbw %%xmm4, %%xmm1 \n\t" + "punpcklbw %%xmm4, %%xmm2 \n\t" + "punpcklbw %%xmm4, %%xmm3 \n\t" "movdqa %%xmm0, 64(%1) \n\t" "movdqa %%xmm1, 80(%1) \n\t" "movdqa %%xmm2, 96(%1) \n\t" @@ -322,67 +323,7 @@ return tmp; } -static int sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { - int tmp; - __asm__ volatile ( - "shr $1,%2\n" - "pxor %%xmm0,%%xmm0\n" /* mm0 = 0 */ - "pxor %%xmm7,%%xmm7\n" /* mm7 holds the sum */ - "1:\n" - "movdqu (%0),%%xmm1\n" /* mm1 = pix1[0][0-15] */ - "movdqu (%1),%%xmm2\n" /* mm2 = pix2[0][0-15] */ - "movdqu (%0,%4),%%xmm3\n" /* mm3 = pix1[1][0-15] */ - "movdqu (%1,%4),%%xmm4\n" /* mm4 = pix2[1][0-15] */ - - /* todo: mm1-mm2, mm3-mm4 */ - /* algo: subtract mm1 from mm2 with saturation and vice versa */ - /* OR the results to get absolute difference */ - "movdqa %%xmm1,%%xmm5\n" - "movdqa %%xmm3,%%xmm6\n" - "psubusb %%xmm2,%%xmm1\n" - "psubusb %%xmm4,%%xmm3\n" - "psubusb %%xmm5,%%xmm2\n" - "psubusb %%xmm6,%%xmm4\n" - - "por %%xmm1,%%xmm2\n" - "por %%xmm3,%%xmm4\n" - - /* now convert to 16-bit vectors so we can square them */ - "movdqa %%xmm2,%%xmm1\n" - "movdqa %%xmm4,%%xmm3\n" - - "punpckhbw %%xmm0,%%xmm2\n" - "punpckhbw %%xmm0,%%xmm4\n" - "punpcklbw %%xmm0,%%xmm1\n" /* mm1 now spread over (mm1,mm2) */ - "punpcklbw %%xmm0,%%xmm3\n" /* mm4 now spread over (mm3,mm4) */ - - "pmaddwd %%xmm2,%%xmm2\n" - "pmaddwd %%xmm4,%%xmm4\n" - "pmaddwd %%xmm1,%%xmm1\n" - "pmaddwd %%xmm3,%%xmm3\n" - - "lea (%0,%4,2), %0\n" /* pix1 += 2*line_size */ - "lea (%1,%4,2), %1\n" /* pix2 += 2*line_size */ - - "paddd %%xmm2,%%xmm1\n" - "paddd %%xmm4,%%xmm3\n" - "paddd %%xmm1,%%xmm7\n" - "paddd %%xmm3,%%xmm7\n" - - "decl %2\n" - "jnz 1b\n" - - "movdqa %%xmm7,%%xmm1\n" - "psrldq $8, %%xmm7\n" /* shift hi qword to lo */ - "paddd %%xmm1,%%xmm7\n" - "movdqa %%xmm7,%%xmm1\n" - "psrldq $4, %%xmm7\n" /* shift hi dword to lo */ - "paddd %%xmm1,%%xmm7\n" - "movd %%xmm7,%3\n" - : "+r" (pix1), "+r" (pix2), "+r"(h), "=r"(tmp) - : "r" ((x86_reg)line_size)); - return tmp; -} +int ff_sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h); static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) { int tmp; @@ -938,55 +879,6 @@ *left = src2[w-1]; } -#define DIFF_PIXELS_1(m,a,t,p1,p2)\ - "mov"#m" "#p1", "#a" \n\t"\ - "mov"#m" "#p2", "#t" \n\t"\ - "punpcklbw "#a", "#t" \n\t"\ - "punpcklbw "#a", "#a" \n\t"\ - "psubw "#t", "#a" \n\t"\ - -#define DIFF_PIXELS_8(m0,m1,mm,p1,p2,stride,temp) {\ - uint8_t *p1b=p1, *p2b=p2;\ - __asm__ volatile(\ - DIFF_PIXELS_1(m0, mm##0, mm##7, (%1), (%2))\ - DIFF_PIXELS_1(m0, mm##1, mm##7, (%1,%3), (%2,%3))\ - DIFF_PIXELS_1(m0, mm##2, mm##7, (%1,%3,2), (%2,%3,2))\ - "add %4, %1 \n\t"\ - "add %4, %2 \n\t"\ - DIFF_PIXELS_1(m0, mm##3, mm##7, (%1), (%2))\ - DIFF_PIXELS_1(m0, mm##4, mm##7, (%1,%3), (%2,%3))\ - DIFF_PIXELS_1(m0, mm##5, mm##7, (%1,%3,2), (%2,%3,2))\ - DIFF_PIXELS_1(m0, mm##6, mm##7, (%1,%4), (%2,%4))\ - "mov"#m1" "#mm"0, %0 \n\t"\ - DIFF_PIXELS_1(m0, mm##7, mm##0, (%1,%3,4), (%2,%3,4))\ - "mov"#m1" %0, "#mm"0 \n\t"\ - : "+m"(temp), "+r"(p1b), "+r"(p2b)\ - : "r"((x86_reg)stride), "r"((x86_reg)stride*3)\ - );\ -} - //the "+m"(temp) is needed as gcc 2.95 sometimes fails to compile "=m"(temp) - -#define DIFF_PIXELS_4x8(p1,p2,stride,temp) DIFF_PIXELS_8(d, q, %%mm, p1, p2, stride, temp) -#define DIFF_PIXELS_8x8(p1,p2,stride,temp) DIFF_PIXELS_8(q, dqa, %%xmm, p1, p2, stride, temp) - -#define LBUTTERFLY2(a1,b1,a2,b2)\ - "paddw " #b1 ", " #a1 " \n\t"\ - "paddw " #b2 ", " #a2 " \n\t"\ - "paddw " #b1 ", " #b1 " \n\t"\ - "paddw " #b2 ", " #b2 " \n\t"\ - "psubw " #a1 ", " #b1 " \n\t"\ - "psubw " #a2 ", " #b2 " \n\t" - -#define HADAMARD8(m0, m1, m2, m3, m4, m5, m6, m7)\ - LBUTTERFLY2(m0, m1, m2, m3)\ - LBUTTERFLY2(m4, m5, m6, m7)\ - LBUTTERFLY2(m0, m2, m1, m3)\ - LBUTTERFLY2(m4, m6, m5, m7)\ - LBUTTERFLY2(m0, m4, m1, m5)\ - LBUTTERFLY2(m2, m6, m3, m7)\ - -#define HADAMARD48 HADAMARD8(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm6, %%mm7) - #define MMABS_MMX(a,z)\ "pxor " #z ", " #z " \n\t"\ "pcmpgtw " #a ", " #z " \n\t"\ @@ -1005,34 +897,6 @@ MMABS(a,z)\ "paddusw " #a ", " #sum " \n\t" -#define MMABS_SUM_8x8_NOSPILL\ - MMABS(%%xmm0, %%xmm8)\ - MMABS(%%xmm1, %%xmm9)\ - MMABS_SUM(%%xmm2, %%xmm8, %%xmm0)\ - MMABS_SUM(%%xmm3, %%xmm9, %%xmm1)\ - MMABS_SUM(%%xmm4, %%xmm8, %%xmm0)\ - MMABS_SUM(%%xmm5, %%xmm9, %%xmm1)\ - MMABS_SUM(%%xmm6, %%xmm8, %%xmm0)\ - MMABS_SUM(%%xmm7, %%xmm9, %%xmm1)\ - "paddusw %%xmm1, %%xmm0 \n\t" - -#if ARCH_X86_64 -#define MMABS_SUM_8x8_SSE2 MMABS_SUM_8x8_NOSPILL -#else -#define MMABS_SUM_8x8_SSE2\ - "movdqa %%xmm7, (%1) \n\t"\ - MMABS(%%xmm0, %%xmm7)\ - MMABS(%%xmm1, %%xmm7)\ - MMABS_SUM(%%xmm2, %%xmm7, %%xmm0)\ - MMABS_SUM(%%xmm3, %%xmm7, %%xmm1)\ - MMABS_SUM(%%xmm4, %%xmm7, %%xmm0)\ - MMABS_SUM(%%xmm5, %%xmm7, %%xmm1)\ - MMABS_SUM(%%xmm6, %%xmm7, %%xmm0)\ - "movdqa (%1), %%xmm2 \n\t"\ - MMABS_SUM(%%xmm2, %%xmm7, %%xmm1)\ - "paddusw %%xmm1, %%xmm0 \n\t" -#endif - /* FIXME: HSUM_* saturates at 64k, while an 8x8 hadamard or dct block can get up to * about 100k on extreme inputs. But that's very unlikely to occur in natural video, * and it's even more unlikely to not have any alternative mvs/modes with lower cost. */ @@ -1061,133 +925,16 @@ "paddusw "#t", "#a" \n\t"\ "movd "#a", "#dst" \n\t"\ -#define HADAMARD8_DIFF_MMX(cpu) \ -static int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){\ - DECLARE_ALIGNED(8, uint64_t, temp)[13];\ - int sum;\ -\ - assert(h==8);\ -\ - DIFF_PIXELS_4x8(src1, src2, stride, temp[0]);\ -\ - __asm__ volatile(\ - HADAMARD48\ -\ - "movq %%mm7, 96(%1) \n\t"\ -\ - TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\ - STORE4(8, 0(%1), %%mm0, %%mm3, %%mm7, %%mm2)\ -\ - "movq 96(%1), %%mm7 \n\t"\ - TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\ - STORE4(8, 64(%1), %%mm4, %%mm7, %%mm0, %%mm6)\ -\ - : "=r" (sum)\ - : "r"(temp)\ - );\ -\ - DIFF_PIXELS_4x8(src1+4, src2+4, stride, temp[4]);\ -\ - __asm__ volatile(\ - HADAMARD48\ -\ - "movq %%mm7, 96(%1) \n\t"\ -\ - TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\ - STORE4(8, 32(%1), %%mm0, %%mm3, %%mm7, %%mm2)\ -\ - "movq 96(%1), %%mm7 \n\t"\ - TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\ - "movq %%mm7, %%mm5 \n\t"/*FIXME remove*/\ - "movq %%mm6, %%mm7 \n\t"\ - "movq %%mm0, %%mm6 \n\t"\ -\ - LOAD4(8, 64(%1), %%mm0, %%mm1, %%mm2, %%mm3)\ -\ - HADAMARD48\ - "movq %%mm7, 64(%1) \n\t"\ - MMABS(%%mm0, %%mm7)\ - MMABS(%%mm1, %%mm7)\ - MMABS_SUM(%%mm2, %%mm7, %%mm0)\ - MMABS_SUM(%%mm3, %%mm7, %%mm1)\ - MMABS_SUM(%%mm4, %%mm7, %%mm0)\ - MMABS_SUM(%%mm5, %%mm7, %%mm1)\ - MMABS_SUM(%%mm6, %%mm7, %%mm0)\ - "movq 64(%1), %%mm2 \n\t"\ - MMABS_SUM(%%mm2, %%mm7, %%mm1)\ - "paddusw %%mm1, %%mm0 \n\t"\ - "movq %%mm0, 64(%1) \n\t"\ -\ - LOAD4(8, 0(%1), %%mm0, %%mm1, %%mm2, %%mm3)\ - LOAD4(8, 32(%1), %%mm4, %%mm5, %%mm6, %%mm7)\ -\ - HADAMARD48\ - "movq %%mm7, (%1) \n\t"\ - MMABS(%%mm0, %%mm7)\ - MMABS(%%mm1, %%mm7)\ - MMABS_SUM(%%mm2, %%mm7, %%mm0)\ - MMABS_SUM(%%mm3, %%mm7, %%mm1)\ - MMABS_SUM(%%mm4, %%mm7, %%mm0)\ - MMABS_SUM(%%mm5, %%mm7, %%mm1)\ - MMABS_SUM(%%mm6, %%mm7, %%mm0)\ - "movq (%1), %%mm2 \n\t"\ - MMABS_SUM(%%mm2, %%mm7, %%mm1)\ - "paddusw 64(%1), %%mm0 \n\t"\ - "paddusw %%mm1, %%mm0 \n\t"\ -\ - HSUM(%%mm0, %%mm1, %0)\ -\ - : "=r" (sum)\ - : "r"(temp)\ - );\ - return sum&0xFFFF;\ -}\ -WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu) - -#define HADAMARD8_DIFF_SSE2(cpu) \ -static int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){\ - DECLARE_ALIGNED(16, uint64_t, temp)[4];\ - int sum;\ -\ - assert(h==8);\ -\ - DIFF_PIXELS_8x8(src1, src2, stride, temp[0]);\ -\ - __asm__ volatile(\ - HADAMARD8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)\ - TRANSPOSE8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7, (%1))\ - HADAMARD8(%%xmm0, %%xmm5, %%xmm7, %%xmm3, %%xmm6, %%xmm4, %%xmm2, %%xmm1)\ - MMABS_SUM_8x8\ - HSUM_SSE2(%%xmm0, %%xmm1, %0)\ - : "=r" (sum)\ - : "r"(temp)\ - );\ - return sum&0xFFFF;\ -}\ -WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu) - -#define MMABS(a,z) MMABS_MMX(a,z) -#define HSUM(a,t,dst) HSUM_MMX(a,t,dst) -HADAMARD8_DIFF_MMX(mmx) -#undef MMABS -#undef HSUM - -#define MMABS(a,z) MMABS_MMX2(a,z) -#define MMABS_SUM_8x8 MMABS_SUM_8x8_SSE2 -#define HSUM(a,t,dst) HSUM_MMX2(a,t,dst) -HADAMARD8_DIFF_MMX(mmx2) -HADAMARD8_DIFF_SSE2(sse2) -#undef MMABS -#undef MMABS_SUM_8x8 -#undef HSUM - -#if HAVE_SSSE3 -#define MMABS(a,z) MMABS_SSSE3(a,z) -#define MMABS_SUM_8x8 MMABS_SUM_8x8_NOSPILL -HADAMARD8_DIFF_SSE2(ssse3) -#undef MMABS -#undef MMABS_SUM_8x8 -#endif +#define hadamard_func(cpu) \ +int ff_hadamard8_diff_##cpu (void *s, uint8_t *src1, uint8_t *src2, \ + int stride, int h); \ +int ff_hadamard8_diff16_##cpu(void *s, uint8_t *src1, uint8_t *src2, \ + int stride, int h); + +hadamard_func(mmx) +hadamard_func(mmx2) +hadamard_func(sse2) +hadamard_func(ssse3) #define DCT_SAD4(m,mm,o)\ "mov"#m" "#o"+ 0(%1), "#mm"2 \n\t"\ @@ -1350,12 +1097,14 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx) { - if (mm_flags & FF_MM_MMX) { + int mm_flags = av_get_cpu_flags(); + + if (mm_flags & AV_CPU_FLAG_MMX) { const int dct_algo = avctx->dct_algo; if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){ - if(mm_flags & FF_MM_SSE2){ + if(mm_flags & AV_CPU_FLAG_SSE2){ c->fdct = ff_fdct_sse2; - }else if(mm_flags & FF_MM_MMX2){ + }else if(mm_flags & AV_CPU_FLAG_MMX2){ c->fdct = ff_fdct_mmx2; }else{ c->fdct = ff_fdct_mmx; @@ -1369,11 +1118,13 @@ c->diff_bytes= diff_bytes_mmx; c->sum_abs_dctelem= sum_abs_dctelem_mmx; - c->hadamard8_diff[0]= hadamard8_diff16_mmx; - c->hadamard8_diff[1]= hadamard8_diff_mmx; +#if HAVE_YASM + c->hadamard8_diff[0]= ff_hadamard8_diff16_mmx; + c->hadamard8_diff[1]= ff_hadamard8_diff_mmx; +#endif c->pix_norm1 = pix_norm1_mmx; - c->sse[0] = (mm_flags & FF_MM_SSE2) ? sse16_sse2 : sse16_mmx; + c->sse[0] = (HAVE_YASM && mm_flags & AV_CPU_FLAG_SSE2) ? ff_sse16_sse2 : sse16_mmx; c->sse[1] = sse8_mmx; c->vsad[4]= vsad_intra16_mmx; @@ -1391,10 +1142,12 @@ c->ssd_int8_vs_int16 = ssd_int8_vs_int16_mmx; - if (mm_flags & FF_MM_MMX2) { + if (mm_flags & AV_CPU_FLAG_MMX2) { c->sum_abs_dctelem= sum_abs_dctelem_mmx2; - c->hadamard8_diff[0]= hadamard8_diff16_mmx2; - c->hadamard8_diff[1]= hadamard8_diff_mmx2; +#if HAVE_YASM + c->hadamard8_diff[0]= ff_hadamard8_diff16_mmx2; + c->hadamard8_diff[1]= ff_hadamard8_diff_mmx2; +#endif c->vsad[4]= vsad_intra16_mmx2; if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ @@ -1404,30 +1157,34 @@ c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2; } - if(mm_flags & FF_MM_SSE2){ + if(mm_flags & AV_CPU_FLAG_SSE2){ c->get_pixels = get_pixels_sse2; c->sum_abs_dctelem= sum_abs_dctelem_sse2; - c->hadamard8_diff[0]= hadamard8_diff16_sse2; - c->hadamard8_diff[1]= hadamard8_diff_sse2; +#if HAVE_YASM && HAVE_ALIGNED_STACK + c->hadamard8_diff[0]= ff_hadamard8_diff16_sse2; + c->hadamard8_diff[1]= ff_hadamard8_diff_sse2; +#endif } - if (CONFIG_LPC && mm_flags & (FF_MM_SSE2|FF_MM_SSE2SLOW)) { + if (CONFIG_LPC && mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) { c->lpc_compute_autocorr = ff_lpc_compute_autocorr_sse2; } #if HAVE_SSSE3 - if(mm_flags & FF_MM_SSSE3){ + if(mm_flags & AV_CPU_FLAG_SSSE3){ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->try_8x8basis= try_8x8basis_ssse3; } c->add_8x8basis= add_8x8basis_ssse3; c->sum_abs_dctelem= sum_abs_dctelem_ssse3; - c->hadamard8_diff[0]= hadamard8_diff16_ssse3; - c->hadamard8_diff[1]= hadamard8_diff_ssse3; +#if HAVE_YASM && HAVE_ALIGNED_STACK + c->hadamard8_diff[0]= ff_hadamard8_diff16_ssse3; + c->hadamard8_diff[1]= ff_hadamard8_diff_ssse3; +#endif } #endif - if(mm_flags & FF_MM_3DNOW){ + if(mm_flags & AV_CPU_FLAG_3DNOW){ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->try_8x8basis= try_8x8basis_3dnow; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputilenc_yasm.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputilenc_yasm.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputilenc_yasm.asm 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputilenc_yasm.asm 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,342 @@ +;***************************************************************************** +;* MMX optimized DSP utils +;***************************************************************************** +;* Copyright (c) 2000, 2001 Fabrice Bellard +;* Copyright (c) 2002-2004 Michael Niedermayer +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg is distributed in the hope that it will be useful, +;* but WITHOUT ANY WARRANTY; without even the implied warranty of +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;***************************************************************************** + +%include "x86inc.asm" +%include "x86util.asm" + +SECTION .text + +%macro DIFF_PIXELS_1 4 + movh %1, %3 + movh %2, %4 + punpcklbw %2, %1 + punpcklbw %1, %1 + psubw %1, %2 +%endmacro + +; %1=uint8_t *pix1, %2=uint8_t *pix2, %3=static offset, %4=stride, %5=stride*3 +; %6=temporary storage location +; this macro requires $mmsize stack space (aligned) on %6 (except on SSE+x86-64) +%macro DIFF_PIXELS_8 6 + DIFF_PIXELS_1 m0, m7, [%1 +%3], [%2 +%3] + DIFF_PIXELS_1 m1, m7, [%1+%4 +%3], [%2+%4 +%3] + DIFF_PIXELS_1 m2, m7, [%1+%4*2+%3], [%2+%4*2+%3] + add %1, %5 + add %2, %5 + DIFF_PIXELS_1 m3, m7, [%1 +%3], [%2 +%3] + DIFF_PIXELS_1 m4, m7, [%1+%4 +%3], [%2+%4 +%3] + DIFF_PIXELS_1 m5, m7, [%1+%4*2+%3], [%2+%4*2+%3] + DIFF_PIXELS_1 m6, m7, [%1+%5 +%3], [%2+%5 +%3] +%ifdef m8 + DIFF_PIXELS_1 m7, m8, [%1+%4*4+%3], [%2+%4*4+%3] +%else + mova [%6], m0 + DIFF_PIXELS_1 m7, m0, [%1+%4*4+%3], [%2+%4*4+%3] + mova m0, [%6] +%endif + sub %1, %5 + sub %2, %5 +%endmacro + +%macro HADAMARD8 0 + SUMSUB_BADC m0, m1, m2, m3 + SUMSUB_BADC m4, m5, m6, m7 + SUMSUB_BADC m0, m2, m1, m3 + SUMSUB_BADC m4, m6, m5, m7 + SUMSUB_BADC m0, m4, m1, m5 + SUMSUB_BADC m2, m6, m3, m7 +%endmacro + +%macro ABS1_SUM 3 + ABS1 %1, %2 + paddusw %3, %1 +%endmacro + +%macro ABS2_SUM 6 + ABS2 %1, %2, %3, %4 + paddusw %5, %1 + paddusw %6, %2 +%endmacro + +%macro ABS_SUM_8x8_64 1 + ABS2 m0, m1, m8, m9 + ABS2_SUM m2, m3, m8, m9, m0, m1 + ABS2_SUM m4, m5, m8, m9, m0, m1 + ABS2_SUM m6, m7, m8, m9, m0, m1 + paddusw m0, m1 +%endmacro + +%macro ABS_SUM_8x8_32 1 + mova [%1], m7 + ABS1 m0, m7 + ABS1 m1, m7 + ABS1_SUM m2, m7, m0 + ABS1_SUM m3, m7, m1 + ABS1_SUM m4, m7, m0 + ABS1_SUM m5, m7, m1 + ABS1_SUM m6, m7, m0 + mova m2, [%1] + ABS1_SUM m2, m7, m1 + paddusw m0, m1 +%endmacro + +; FIXME: HSUM_* saturates at 64k, while an 8x8 hadamard or dct block can get up to +; about 100k on extreme inputs. But that's very unlikely to occur in natural video, +; and it's even more unlikely to not have any alternative mvs/modes with lower cost. +%macro HSUM_MMX 3 + mova %2, %1 + psrlq %1, 32 + paddusw %1, %2 + mova %2, %1 + psrlq %1, 16 + paddusw %1, %2 + movd %3, %1 +%endmacro + +%macro HSUM_MMX2 3 + pshufw %2, %1, 0xE + paddusw %1, %2 + pshufw %2, %1, 0x1 + paddusw %1, %2 + movd %3, %1 +%endmacro + +%macro HSUM_SSE2 3 + movhlps %2, %1 + paddusw %1, %2 + pshuflw %2, %1, 0xE + paddusw %1, %2 + pshuflw %2, %1, 0x1 + paddusw %1, %2 + movd %3, %1 +%endmacro + +%macro STORE4 5 + mova [%1+mmsize*0], %2 + mova [%1+mmsize*1], %3 + mova [%1+mmsize*2], %4 + mova [%1+mmsize*3], %5 +%endmacro + +%macro LOAD4 5 + mova %2, [%1+mmsize*0] + mova %3, [%1+mmsize*1] + mova %4, [%1+mmsize*2] + mova %5, [%1+mmsize*3] +%endmacro + +%macro hadamard8_16_wrapper 3 +cglobal hadamard8_diff_%1, 4, 4, %2 +%ifndef m8 + %assign pad %3*mmsize-(4+stack_offset&(mmsize-1)) + SUB rsp, pad +%endif + call hadamard8x8_diff_%1 +%ifndef m8 + ADD rsp, pad +%endif + RET + +cglobal hadamard8_diff16_%1, 5, 6, %2 +%ifndef m8 + %assign pad %3*mmsize-(4+stack_offset&(mmsize-1)) + SUB rsp, pad +%endif + + call hadamard8x8_diff_%1 + mov r5d, eax + + add r1, 8 + add r2, 8 + call hadamard8x8_diff_%1 + add r5d, eax + + cmp r4d, 16 + jne .done + + lea r1, [r1+r3*8-8] + lea r2, [r2+r3*8-8] + call hadamard8x8_diff_%1 + add r5d, eax + + add r1, 8 + add r2, 8 + call hadamard8x8_diff_%1 + add r5d, eax + +.done + mov eax, r5d +%ifndef m8 + ADD rsp, pad +%endif + RET +%endmacro + +%macro HADAMARD8_DIFF_MMX 1 +ALIGN 16 +; int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2, +; int stride, int h) +; r0 = void *s = unused, int h = unused (always 8) +; note how r1, r2 and r3 are not clobbered in this function, so 16x16 +; can simply call this 2x2x (and that's why we access rsp+gprsize +; everywhere, which is rsp of calling func +hadamard8x8_diff_%1: + lea r0, [r3*3] + + ; first 4x8 pixels + DIFF_PIXELS_8 r1, r2, 0, r3, r0, rsp+gprsize+0x60 + HADAMARD8 + mova [rsp+gprsize+0x60], m7 + TRANSPOSE4x4W 0, 1, 2, 3, 7 + STORE4 rsp+gprsize, m0, m1, m2, m3 + mova m7, [rsp+gprsize+0x60] + TRANSPOSE4x4W 4, 5, 6, 7, 0 + STORE4 rsp+gprsize+0x40, m4, m5, m6, m7 + + ; second 4x8 pixels + DIFF_PIXELS_8 r1, r2, 4, r3, r0, rsp+gprsize+0x60 + HADAMARD8 + mova [rsp+gprsize+0x60], m7 + TRANSPOSE4x4W 0, 1, 2, 3, 7 + STORE4 rsp+gprsize+0x20, m0, m1, m2, m3 + mova m7, [rsp+gprsize+0x60] + TRANSPOSE4x4W 4, 5, 6, 7, 0 + + LOAD4 rsp+gprsize+0x40, m0, m1, m2, m3 + HADAMARD8 + ABS_SUM_8x8_32 rsp+gprsize+0x60 + mova [rsp+gprsize+0x60], m0 + + LOAD4 rsp+gprsize , m0, m1, m2, m3 + LOAD4 rsp+gprsize+0x20, m4, m5, m6, m7 + HADAMARD8 + ABS_SUM_8x8_32 rsp+gprsize + paddusw m0, [rsp+gprsize+0x60] + + HSUM m0, m1, eax + and rax, 0xFFFF + ret + +hadamard8_16_wrapper %1, 0, 14 +%endmacro + +%macro HADAMARD8_DIFF_SSE2 2 +hadamard8x8_diff_%1: + lea r0, [r3*3] + DIFF_PIXELS_8 r1, r2, 0, r3, r0, rsp+gprsize + HADAMARD8 +%ifdef ARCH_X86_64 + TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, 8 +%else + TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, [rsp+gprsize], [rsp+mmsize+gprsize] +%endif + HADAMARD8 + ABS_SUM_8x8 rsp+gprsize + HSUM_SSE2 m0, m1, eax + and eax, 0xFFFF + ret + +hadamard8_16_wrapper %1, %2, 3 +%endmacro + +INIT_MMX +%define ABS1 ABS1_MMX +%define HSUM HSUM_MMX +HADAMARD8_DIFF_MMX mmx + +%define ABS1 ABS1_MMX2 +%define HSUM HSUM_MMX2 +HADAMARD8_DIFF_MMX mmx2 + +INIT_XMM +%define ABS2 ABS2_MMX2 +%ifdef ARCH_X86_64 +%define ABS_SUM_8x8 ABS_SUM_8x8_64 +%else +%define ABS_SUM_8x8 ABS_SUM_8x8_32 +%endif +HADAMARD8_DIFF_SSE2 sse2, 10 + +%define ABS2 ABS2_SSSE3 +%define ABS_SUM_8x8 ABS_SUM_8x8_64 +HADAMARD8_DIFF_SSE2 ssse3, 9 + +INIT_XMM +; sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) +cglobal sse16_sse2, 5, 5, 8 + shr r4d, 1 + pxor m0, m0 ; mm0 = 0 + pxor m7, m7 ; mm7 holds the sum + +.next2lines ; FIXME why are these unaligned movs? pix1[] is aligned + movu m1, [r1 ] ; mm1 = pix1[0][0-15] + movu m2, [r2 ] ; mm2 = pix2[0][0-15] + movu m3, [r1+r3] ; mm3 = pix1[1][0-15] + movu m4, [r2+r3] ; mm4 = pix2[1][0-15] + + ; todo: mm1-mm2, mm3-mm4 + ; algo: subtract mm1 from mm2 with saturation and vice versa + ; OR the result to get the absolute difference + mova m5, m1 + mova m6, m3 + psubusb m1, m2 + psubusb m3, m4 + psubusb m2, m5 + psubusb m4, m6 + + por m2, m1 + por m4, m3 + + ; now convert to 16-bit vectors so we can square them + mova m1, m2 + mova m3, m4 + + punpckhbw m2, m0 + punpckhbw m4, m0 + punpcklbw m1, m0 ; mm1 not spread over (mm1,mm2) + punpcklbw m3, m0 ; mm4 not spread over (mm3,mm4) + + pmaddwd m2, m2 + pmaddwd m4, m4 + pmaddwd m1, m1 + pmaddwd m3, m3 + + lea r1, [r1+r3*2] ; pix1 += 2*line_size + lea r2, [r2+r3*2] ; pix2 += 2*line_size + + paddd m1, m2 + paddd m3, m4 + paddd m7, m1 + paddd m7, m3 + + dec r4 + jnz .next2lines + + mova m1, m7 + psrldq m7, 8 ; shift hi qword to lo + paddd m7, m1 + mova m1, m7 + psrldq m7, 4 ; shift hi dword to lo + paddd m7, m1 + movd eax, m7 ; return value + RET diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputil_h264_template_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputil_h264_template_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputil_h264_template_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputil_h264_template_mmx.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2005 Zoltan Hidvegi , - * Loren Merritt - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * MMX optimized version of (put|avg)_h264_chroma_mc8. - * H264_CHROMA_MC8_TMPL must be defined to the desired function name - * H264_CHROMA_OP must be defined to empty for put and pavgb/pavgusb for avg - * H264_CHROMA_MC8_MV0 must be defined to a (put|avg)_pixels8 function - */ -static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, const uint64_t *rnd_reg) -{ - DECLARE_ALIGNED(8, uint64_t, AA); - DECLARE_ALIGNED(8, uint64_t, DD); - int i; - - if(y==0 && x==0) { - /* no filter needed */ - H264_CHROMA_MC8_MV0(dst, src, stride, h); - return; - } - - assert(x<8 && y<8 && x>=0 && y>=0); - - if(y==0 || x==0) - { - /* 1 dimensional filter only */ - const int dxy = x ? 1 : stride; - - __asm__ volatile( - "movd %0, %%mm5\n\t" - "movq %1, %%mm4\n\t" - "movq %2, %%mm6\n\t" /* mm6 = rnd >> 3 */ - "punpcklwd %%mm5, %%mm5\n\t" - "punpckldq %%mm5, %%mm5\n\t" /* mm5 = B = x */ - "pxor %%mm7, %%mm7\n\t" - "psubw %%mm5, %%mm4\n\t" /* mm4 = A = 8-x */ - :: "rm"(x+y), "m"(ff_pw_8), "m"(*(rnd_reg+1))); - - for(i=0; i> 3)) >> 3 */ - "paddw %%mm6, %%mm0\n\t" - "paddw %%mm6, %%mm1\n\t" - "paddw %%mm2, %%mm0\n\t" - "paddw %%mm3, %%mm1\n\t" - "psrlw $3, %%mm0\n\t" - "psrlw $3, %%mm1\n\t" - "packuswb %%mm1, %%mm0\n\t" - H264_CHROMA_OP(%0, %%mm0) - "movq %%mm0, %0\n\t" - : "=m" (dst[0])); - - src += stride; - dst += stride; - } - return; - } - - /* general case, bilinear */ - __asm__ volatile("movd %2, %%mm4\n\t" - "movd %3, %%mm6\n\t" - "punpcklwd %%mm4, %%mm4\n\t" - "punpcklwd %%mm6, %%mm6\n\t" - "punpckldq %%mm4, %%mm4\n\t" /* mm4 = x words */ - "punpckldq %%mm6, %%mm6\n\t" /* mm6 = y words */ - "movq %%mm4, %%mm5\n\t" - "pmullw %%mm6, %%mm4\n\t" /* mm4 = x * y */ - "psllw $3, %%mm5\n\t" - "psllw $3, %%mm6\n\t" - "movq %%mm5, %%mm7\n\t" - "paddw %%mm6, %%mm7\n\t" - "movq %%mm4, %1\n\t" /* DD = x * y */ - "psubw %%mm4, %%mm5\n\t" /* mm5 = B = 8x - xy */ - "psubw %%mm4, %%mm6\n\t" /* mm6 = C = 8y - xy */ - "paddw %4, %%mm4\n\t" - "psubw %%mm7, %%mm4\n\t" /* mm4 = A = xy - (8x+8y) + 64 */ - "pxor %%mm7, %%mm7\n\t" - "movq %%mm4, %0\n\t" - : "=m" (AA), "=m" (DD) : "rm" (x), "rm" (y), "m" (ff_pw_64)); - - __asm__ volatile( - /* mm0 = src[0..7], mm1 = src[1..8] */ - "movq %0, %%mm0\n\t" - "movq %1, %%mm1\n\t" - : : "m" (src[0]), "m" (src[1])); - - for(i=0; i> 6 */ - "paddw %1, %%mm2\n\t" - "paddw %1, %%mm3\n\t" - "psrlw $6, %%mm2\n\t" - "psrlw $6, %%mm3\n\t" - "packuswb %%mm3, %%mm2\n\t" - H264_CHROMA_OP(%0, %%mm2) - "movq %%mm2, %0\n\t" - : "=m" (dst[0]) : "m" (*rnd_reg)); - dst+= stride; - } -} - -static void H264_CHROMA_MC4_TMPL(uint8_t *dst/*align 4*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, const uint64_t *rnd_reg) -{ - __asm__ volatile( - "pxor %%mm7, %%mm7 \n\t" - "movd %5, %%mm2 \n\t" - "movd %6, %%mm3 \n\t" - "movq "MANGLE(ff_pw_8)", %%mm4\n\t" - "movq "MANGLE(ff_pw_8)", %%mm5\n\t" - "punpcklwd %%mm2, %%mm2 \n\t" - "punpcklwd %%mm3, %%mm3 \n\t" - "punpcklwd %%mm2, %%mm2 \n\t" - "punpcklwd %%mm3, %%mm3 \n\t" - "psubw %%mm2, %%mm4 \n\t" - "psubw %%mm3, %%mm5 \n\t" - - "movd (%1), %%mm0 \n\t" - "movd 1(%1), %%mm6 \n\t" - "add %3, %1 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm6 \n\t" - "pmullw %%mm4, %%mm0 \n\t" - "pmullw %%mm2, %%mm6 \n\t" - "paddw %%mm0, %%mm6 \n\t" - - "1: \n\t" - "movd (%1), %%mm0 \n\t" - "movd 1(%1), %%mm1 \n\t" - "add %3, %1 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "pmullw %%mm4, %%mm0 \n\t" - "pmullw %%mm2, %%mm1 \n\t" - "paddw %%mm0, %%mm1 \n\t" - "movq %%mm1, %%mm0 \n\t" - "pmullw %%mm5, %%mm6 \n\t" - "pmullw %%mm3, %%mm1 \n\t" - "paddw %4, %%mm6 \n\t" - "paddw %%mm6, %%mm1 \n\t" - "psrlw $6, %%mm1 \n\t" - "packuswb %%mm1, %%mm1 \n\t" - H264_CHROMA_OP4((%0), %%mm1, %%mm6) - "movd %%mm1, (%0) \n\t" - "add %3, %0 \n\t" - "movd (%1), %%mm6 \n\t" - "movd 1(%1), %%mm1 \n\t" - "add %3, %1 \n\t" - "punpcklbw %%mm7, %%mm6 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "pmullw %%mm4, %%mm6 \n\t" - "pmullw %%mm2, %%mm1 \n\t" - "paddw %%mm6, %%mm1 \n\t" - "movq %%mm1, %%mm6 \n\t" - "pmullw %%mm5, %%mm0 \n\t" - "pmullw %%mm3, %%mm1 \n\t" - "paddw %4, %%mm0 \n\t" - "paddw %%mm0, %%mm1 \n\t" - "psrlw $6, %%mm1 \n\t" - "packuswb %%mm1, %%mm1 \n\t" - H264_CHROMA_OP4((%0), %%mm1, %%mm0) - "movd %%mm1, (%0) \n\t" - "add %3, %0 \n\t" - "sub $2, %2 \n\t" - "jnz 1b \n\t" - : "+r"(dst), "+r"(src), "+r"(h) - : "r"((x86_reg)stride), "m"(*rnd_reg), "m"(x), "m"(y) - ); -} - -#ifdef H264_CHROMA_MC2_TMPL -static void H264_CHROMA_MC2_TMPL(uint8_t *dst/*align 2*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - int tmp = ((1<<16)-1)*x + 8; - int CD= tmp*y; - int AB= (tmp<<3) - CD; - __asm__ volatile( - /* mm5 = {A,B,A,B} */ - /* mm6 = {C,D,C,D} */ - "movd %0, %%mm5\n\t" - "movd %1, %%mm6\n\t" - "punpckldq %%mm5, %%mm5\n\t" - "punpckldq %%mm6, %%mm6\n\t" - "pxor %%mm7, %%mm7\n\t" - /* mm0 = src[0,1,1,2] */ - "movd %2, %%mm2\n\t" - "punpcklbw %%mm7, %%mm2\n\t" - "pshufw $0x94, %%mm2, %%mm2\n\t" - :: "r"(AB), "r"(CD), "m"(src[0])); - - - __asm__ volatile( - "1:\n\t" - "add %4, %1\n\t" - /* mm1 = A * src[0,1] + B * src[1,2] */ - "movq %%mm2, %%mm1\n\t" - "pmaddwd %%mm5, %%mm1\n\t" - /* mm0 = src[0,1,1,2] */ - "movd (%1), %%mm0\n\t" - "punpcklbw %%mm7, %%mm0\n\t" - "pshufw $0x94, %%mm0, %%mm0\n\t" - /* mm1 += C * src[0,1] + D * src[1,2] */ - "movq %%mm0, %%mm2\n\t" - "pmaddwd %%mm6, %%mm0\n\t" - "paddw %3, %%mm1\n\t" - "paddw %%mm0, %%mm1\n\t" - /* dst[0,1] = pack((mm1 + 32) >> 6) */ - "psrlw $6, %%mm1\n\t" - "packssdw %%mm7, %%mm1\n\t" - "packuswb %%mm7, %%mm1\n\t" - H264_CHROMA_OP4((%0), %%mm1, %%mm3) - "movd %%mm1, %%esi\n\t" - "movw %%si, (%0)\n\t" - "add %4, %0\n\t" - "sub $1, %2\n\t" - "jnz 1b\n\t" - : "+r" (dst), "+r"(src), "+r"(h) - : "m" (ff_pw_32), "r"((x86_reg)stride) - : "%esi"); - -} -#endif - diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputil_h264_template_ssse3.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputil_h264_template_ssse3.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputil_h264_template_ssse3.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputil_h264_template_ssse3.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2008 Loren Merritt - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * SSSE3 optimized version of (put|avg)_h264_chroma_mc8. - * H264_CHROMA_MC8_TMPL must be defined to the desired function name - * H264_CHROMA_MC8_MV0 must be defined to a (put|avg)_pixels8 function - * AVG_OP must be defined to empty for put and the identify for avg - */ -static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, int rnd) -{ - if(y==0 && x==0) { - /* no filter needed */ - H264_CHROMA_MC8_MV0(dst, src, stride, h); - return; - } - - assert(x<8 && y<8 && x>=0 && y>=0); - - if(y==0 || x==0) - { - /* 1 dimensional filter only */ - __asm__ volatile( - "movd %0, %%xmm7 \n\t" - "movq %1, %%xmm6 \n\t" - "pshuflw $0, %%xmm7, %%xmm7 \n\t" - "movlhps %%xmm6, %%xmm6 \n\t" - "movlhps %%xmm7, %%xmm7 \n\t" - :: "r"(255*(x+y)+8), "m"(*(rnd?&ff_pw_4.a:&ff_pw_3)) - ); - - if(x) { - __asm__ volatile( - "1: \n\t" - "movq (%1), %%xmm0 \n\t" - "movq 1(%1), %%xmm1 \n\t" - "movq (%1,%3), %%xmm2 \n\t" - "movq 1(%1,%3), %%xmm3 \n\t" - "punpcklbw %%xmm1, %%xmm0 \n\t" - "punpcklbw %%xmm3, %%xmm2 \n\t" - "pmaddubsw %%xmm7, %%xmm0 \n\t" - "pmaddubsw %%xmm7, %%xmm2 \n\t" - AVG_OP("movq (%0), %%xmm4 \n\t") - AVG_OP("movhps (%0,%3), %%xmm4 \n\t") - "paddw %%xmm6, %%xmm0 \n\t" - "paddw %%xmm6, %%xmm2 \n\t" - "psrlw $3, %%xmm0 \n\t" - "psrlw $3, %%xmm2 \n\t" - "packuswb %%xmm2, %%xmm0 \n\t" - AVG_OP("pavgb %%xmm4, %%xmm0 \n\t") - "movq %%xmm0, (%0) \n\t" - "movhps %%xmm0, (%0,%3) \n\t" - "sub $2, %2 \n\t" - "lea (%1,%3,2), %1 \n\t" - "lea (%0,%3,2), %0 \n\t" - "jg 1b \n\t" - :"+r"(dst), "+r"(src), "+r"(h) - :"r"((x86_reg)stride) - ); - } else { - __asm__ volatile( - "1: \n\t" - "movq (%1), %%xmm0 \n\t" - "movq (%1,%3), %%xmm1 \n\t" - "movdqa %%xmm1, %%xmm2 \n\t" - "movq (%1,%3,2), %%xmm3 \n\t" - "punpcklbw %%xmm1, %%xmm0 \n\t" - "punpcklbw %%xmm3, %%xmm2 \n\t" - "pmaddubsw %%xmm7, %%xmm0 \n\t" - "pmaddubsw %%xmm7, %%xmm2 \n\t" - AVG_OP("movq (%0), %%xmm4 \n\t") - AVG_OP("movhps (%0,%3), %%xmm4 \n\t") - "paddw %%xmm6, %%xmm0 \n\t" - "paddw %%xmm6, %%xmm2 \n\t" - "psrlw $3, %%xmm0 \n\t" - "psrlw $3, %%xmm2 \n\t" - "packuswb %%xmm2, %%xmm0 \n\t" - AVG_OP("pavgb %%xmm4, %%xmm0 \n\t") - "movq %%xmm0, (%0) \n\t" - "movhps %%xmm0, (%0,%3) \n\t" - "sub $2, %2 \n\t" - "lea (%1,%3,2), %1 \n\t" - "lea (%0,%3,2), %0 \n\t" - "jg 1b \n\t" - :"+r"(dst), "+r"(src), "+r"(h) - :"r"((x86_reg)stride) - ); - } - return; - } - - /* general case, bilinear */ - __asm__ volatile( - "movd %0, %%xmm7 \n\t" - "movd %1, %%xmm6 \n\t" - "movdqa %2, %%xmm5 \n\t" - "pshuflw $0, %%xmm7, %%xmm7 \n\t" - "pshuflw $0, %%xmm6, %%xmm6 \n\t" - "movlhps %%xmm7, %%xmm7 \n\t" - "movlhps %%xmm6, %%xmm6 \n\t" - :: "r"((x*255+8)*(8-y)), "r"((x*255+8)*y), "m"(*(rnd?&ff_pw_32:&ff_pw_28)) - ); - - __asm__ volatile( - "movq (%1), %%xmm0 \n\t" - "movq 1(%1), %%xmm1 \n\t" - "punpcklbw %%xmm1, %%xmm0 \n\t" - "add %3, %1 \n\t" - "1: \n\t" - "movq (%1), %%xmm1 \n\t" - "movq 1(%1), %%xmm2 \n\t" - "movq (%1,%3), %%xmm3 \n\t" - "movq 1(%1,%3), %%xmm4 \n\t" - "lea (%1,%3,2), %1 \n\t" - "punpcklbw %%xmm2, %%xmm1 \n\t" - "punpcklbw %%xmm4, %%xmm3 \n\t" - "movdqa %%xmm1, %%xmm2 \n\t" - "movdqa %%xmm3, %%xmm4 \n\t" - "pmaddubsw %%xmm7, %%xmm0 \n\t" - "pmaddubsw %%xmm6, %%xmm1 \n\t" - "pmaddubsw %%xmm7, %%xmm2 \n\t" - "pmaddubsw %%xmm6, %%xmm3 \n\t" - "paddw %%xmm5, %%xmm0 \n\t" - "paddw %%xmm5, %%xmm2 \n\t" - "paddw %%xmm0, %%xmm1 \n\t" - "paddw %%xmm2, %%xmm3 \n\t" - "movdqa %%xmm4, %%xmm0 \n\t" - "psrlw $6, %%xmm1 \n\t" - "psrlw $6, %%xmm3 \n\t" - AVG_OP("movq (%0), %%xmm2 \n\t") - AVG_OP("movhps (%0,%3), %%xmm2 \n\t") - "packuswb %%xmm3, %%xmm1 \n\t" - AVG_OP("pavgb %%xmm2, %%xmm1 \n\t") - "movq %%xmm1, (%0)\n\t" - "movhps %%xmm1, (%0,%3)\n\t" - "sub $2, %2 \n\t" - "lea (%0,%3,2), %0 \n\t" - "jg 1b \n\t" - :"+r"(dst), "+r"(src), "+r"(h) - :"r"((x86_reg)stride) - ); -} - -static void H264_CHROMA_MC4_TMPL(uint8_t *dst/*align 4*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - __asm__ volatile( - "movd %0, %%mm7 \n\t" - "movd %1, %%mm6 \n\t" - "movq %2, %%mm5 \n\t" - "pshufw $0, %%mm7, %%mm7 \n\t" - "pshufw $0, %%mm6, %%mm6 \n\t" - :: "r"((x*255+8)*(8-y)), "r"((x*255+8)*y), "m"(ff_pw_32) - ); - - __asm__ volatile( - "movd (%1), %%mm0 \n\t" - "punpcklbw 1(%1), %%mm0 \n\t" - "add %3, %1 \n\t" - "1: \n\t" - "movd (%1), %%mm1 \n\t" - "movd (%1,%3), %%mm3 \n\t" - "punpcklbw 1(%1), %%mm1 \n\t" - "punpcklbw 1(%1,%3), %%mm3 \n\t" - "lea (%1,%3,2), %1 \n\t" - "movq %%mm1, %%mm2 \n\t" - "movq %%mm3, %%mm4 \n\t" - "pmaddubsw %%mm7, %%mm0 \n\t" - "pmaddubsw %%mm6, %%mm1 \n\t" - "pmaddubsw %%mm7, %%mm2 \n\t" - "pmaddubsw %%mm6, %%mm3 \n\t" - "paddw %%mm5, %%mm0 \n\t" - "paddw %%mm5, %%mm2 \n\t" - "paddw %%mm0, %%mm1 \n\t" - "paddw %%mm2, %%mm3 \n\t" - "movq %%mm4, %%mm0 \n\t" - "psrlw $6, %%mm1 \n\t" - "psrlw $6, %%mm3 \n\t" - "packuswb %%mm1, %%mm1 \n\t" - "packuswb %%mm3, %%mm3 \n\t" - AVG_OP("pavgb (%0), %%mm1 \n\t") - AVG_OP("pavgb (%0,%3), %%mm3 \n\t") - "movd %%mm1, (%0)\n\t" - "movd %%mm3, (%0,%3)\n\t" - "sub $2, %2 \n\t" - "lea (%0,%3,2), %0 \n\t" - "jg 1b \n\t" - :"+r"(dst), "+r"(src), "+r"(h) - :"r"((x86_reg)stride) - ); -} - diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputil_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputil_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputil_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputil_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -22,23 +22,18 @@ * MMX optimization by Nick Kurshev */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/h264dsp.h" #include "libavcodec/mpegvideo.h" #include "libavcodec/simple_idct.h" #include "dsputil_mmx.h" -#include "vp3dsp_mmx.h" -#include "vp3dsp_sse2.h" -#include "vp6dsp_mmx.h" -#include "vp6dsp_sse2.h" #include "idct_xvid.h" //#undef NDEBUG //#include -int mm_flags; /* multimedia extension flags */ - /* pixel operations */ DECLARE_ALIGNED(8, const uint64_t, ff_bone) = 0x0101010101010101ULL; DECLARE_ALIGNED(8, const uint64_t, ff_wtwo) = 0x0002000200020002ULL; @@ -53,6 +48,7 @@ DECLARE_ALIGNED(16, const xmm_reg, ff_pw_9 ) = {0x0009000900090009ULL, 0x0009000900090009ULL}; DECLARE_ALIGNED(8, const uint64_t, ff_pw_15 ) = 0x000F000F000F000FULL; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_16 ) = {0x0010001000100010ULL, 0x0010001000100010ULL}; +DECLARE_ALIGNED(16, const xmm_reg, ff_pw_17 ) = {0x0011001100110011ULL, 0x0011001100110011ULL}; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_18 ) = {0x0012001200120012ULL, 0x0012001200120012ULL}; DECLARE_ALIGNED(8, const uint64_t, ff_pw_20 ) = 0x0014001400140014ULL; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_27 ) = {0x001B001B001B001BULL, 0x001B001B001B001BULL}; @@ -66,6 +62,7 @@ DECLARE_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL; DECLARE_ALIGNED(8, const uint64_t, ff_pw_255) = 0x00ff00ff00ff00ffULL; +DECLARE_ALIGNED(16, const xmm_reg, ff_pb_0 ) = {0x0000000000000000ULL, 0x0000000000000000ULL}; DECLARE_ALIGNED(16, const xmm_reg, ff_pb_1 ) = {0x0101010101010101ULL, 0x0101010101010101ULL}; DECLARE_ALIGNED(16, const xmm_reg, ff_pb_3 ) = {0x0303030303030303ULL, 0x0303030303030303ULL}; DECLARE_ALIGNED(16, const xmm_reg, ff_pb_4 ) = {0x0404040404040404ULL, 0x0404040404040404ULL}; @@ -74,7 +71,7 @@ DECLARE_ALIGNED(8, const uint64_t, ff_pb_3F ) = 0x3F3F3F3F3F3F3F3FULL; DECLARE_ALIGNED(16, const xmm_reg, ff_pb_80 ) = {0x8080808080808080ULL, 0x8080808080808080ULL}; DECLARE_ALIGNED(8, const uint64_t, ff_pb_81 ) = 0x8181818181818181ULL; -DECLARE_ALIGNED(8, const uint64_t, ff_pb_A1 ) = 0xA1A1A1A1A1A1A1A1ULL; +DECLARE_ALIGNED(16, const xmm_reg, ff_pb_A1 ) = {0xA1A1A1A1A1A1A1A1ULL, 0xA1A1A1A1A1A1A1A1ULL}; DECLARE_ALIGNED(16, const xmm_reg, ff_pb_F8 ) = {0xF8F8F8F8F8F8F8F8ULL, 0xF8F8F8F8F8F8F8F8ULL}; DECLARE_ALIGNED(8, const uint64_t, ff_pb_FC ) = 0xFCFCFCFCFCFCFCFCULL; DECLARE_ALIGNED(16, const xmm_reg, ff_pb_FE ) = {0xFEFEFEFEFEFEFEFEULL, 0xFEFEFEFEFEFEFEFEULL}; @@ -232,7 +229,7 @@ /***********************************/ /* standard MMX */ -void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) +void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) { const DCTELEM *p; uint8_t *pix; @@ -308,7 +305,7 @@ "movq %%mm3, (%0, %3, 2) \n\t"\ "movq %%mm4, (%0, %1) \n\t" -void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) +void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) { x86_reg line_skip = line_size; x86_reg line_skip3; @@ -324,7 +321,7 @@ :"memory"); } -void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) +void ff_add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) { const DCTELEM *p; uint8_t *pix; @@ -615,7 +612,7 @@ __asm__ volatile( "mov %7, %3 \n" "1: \n" - "movzx (%3,%4), %2 \n" + "movzbl (%3,%4), %2 \n" "mov %2, %k3 \n" "sub %b1, %b3 \n" "add %b0, %b3 \n" @@ -732,35 +729,6 @@ } } -static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){ - __asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ... - "movd %4, %%mm0 \n\t" - "movd %5, %%mm1 \n\t" - "movd %6, %%mm2 \n\t" - "movd %7, %%mm3 \n\t" - "punpcklbw %%mm1, %%mm0 \n\t" - "punpcklbw %%mm3, %%mm2 \n\t" - "movq %%mm0, %%mm1 \n\t" - "punpcklwd %%mm2, %%mm0 \n\t" - "punpckhwd %%mm2, %%mm1 \n\t" - "movd %%mm0, %0 \n\t" - "punpckhdq %%mm0, %%mm0 \n\t" - "movd %%mm0, %1 \n\t" - "movd %%mm1, %2 \n\t" - "punpckhdq %%mm1, %%mm1 \n\t" - "movd %%mm1, %3 \n\t" - - : "=m" (*(uint32_t*)(dst + 0*dst_stride)), - "=m" (*(uint32_t*)(dst + 1*dst_stride)), - "=m" (*(uint32_t*)(dst + 2*dst_stride)), - "=m" (*(uint32_t*)(dst + 3*dst_stride)) - : "m" (*(uint32_t*)(src + 0*src_stride)), - "m" (*(uint32_t*)(src + 1*src_stride)), - "m" (*(uint32_t*)(src + 2*src_stride)), - "m" (*(uint32_t*)(src + 3*src_stride)) - ); -} - static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){ if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { const int strength= ff_h263_loop_filter_strength[qscale]; @@ -1829,8 +1797,59 @@ PREFETCH(prefetch_3dnow, prefetch) #undef PREFETCH -#include "h264dsp_mmx.c" -#include "rv40dsp_mmx.c" +#include "h264_qpel_mmx.c" + +void ff_put_h264_chroma_mc8_mmx_rnd (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_put_vc1_chroma_mc8_mmx_nornd (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_h264_chroma_mc8_mmx2_rnd (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_vc1_chroma_mc8_mmx2_nornd (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_rv40_chroma_mc8_mmx2 (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_h264_chroma_mc8_3dnow_rnd (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_vc1_chroma_mc8_3dnow_nornd(uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_rv40_chroma_mc8_3dnow (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); + +void ff_put_h264_chroma_mc4_mmx (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_put_rv40_chroma_mc4_mmx (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_h264_chroma_mc4_mmx2 (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_rv40_chroma_mc4_mmx2 (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_h264_chroma_mc4_3dnow (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_rv40_chroma_mc4_3dnow (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); + +void ff_put_h264_chroma_mc2_mmx2 (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_h264_chroma_mc2_mmx2 (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); + +void ff_put_h264_chroma_mc8_ssse3_rnd (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_put_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_put_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); + +void ff_avg_h264_chroma_mc8_ssse3_rnd (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); + /* CAVS specific */ void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) { @@ -1860,43 +1879,43 @@ static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block) { ff_mmx_idct (block); - put_pixels_clamped_mmx(block, dest, line_size); + ff_put_pixels_clamped_mmx(block, dest, line_size); } static void ff_libmpeg2mmx_idct_add(uint8_t *dest, int line_size, DCTELEM *block) { ff_mmx_idct (block); - add_pixels_clamped_mmx(block, dest, line_size); + ff_add_pixels_clamped_mmx(block, dest, line_size); } static void ff_libmpeg2mmx2_idct_put(uint8_t *dest, int line_size, DCTELEM *block) { ff_mmxext_idct (block); - put_pixels_clamped_mmx(block, dest, line_size); + ff_put_pixels_clamped_mmx(block, dest, line_size); } static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *block) { ff_mmxext_idct (block); - add_pixels_clamped_mmx(block, dest, line_size); + ff_add_pixels_clamped_mmx(block, dest, line_size); } #endif static void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, DCTELEM *block) { ff_idct_xvid_mmx (block); - put_pixels_clamped_mmx(block, dest, line_size); + ff_put_pixels_clamped_mmx(block, dest, line_size); } static void ff_idct_xvid_mmx_add(uint8_t *dest, int line_size, DCTELEM *block) { ff_idct_xvid_mmx (block); - add_pixels_clamped_mmx(block, dest, line_size); + ff_add_pixels_clamped_mmx(block, dest, line_size); } static void ff_idct_xvid_mmx2_put(uint8_t *dest, int line_size, DCTELEM *block) { ff_idct_xvid_mmx2 (block); - put_pixels_clamped_mmx(block, dest, line_size); + ff_put_pixels_clamped_mmx(block, dest, line_size); } static void ff_idct_xvid_mmx2_add(uint8_t *dest, int line_size, DCTELEM *block) { ff_idct_xvid_mmx2 (block); - add_pixels_clamped_mmx(block, dest, line_size); + ff_add_pixels_clamped_mmx(block, dest, line_size); } static void vorbis_inverse_coupling_3dnow(float *mag, float *ang, int blocksize) @@ -1990,7 +2009,9 @@ "jl 1b \n"\ :"+&r"(i)\ :"r"(samples[0]+len), "r"(matrix)\ - :"memory"\ + :XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \ + "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\ + "memory"\ ); #define MIX_MISC(stereo)\ @@ -1998,8 +2019,8 @@ "1: \n"\ "movaps (%3,%0), %%xmm0 \n"\ stereo("movaps %%xmm0, %%xmm1 \n")\ - "mulps %%xmm6, %%xmm0 \n"\ - stereo("mulps %%xmm7, %%xmm1 \n")\ + "mulps %%xmm4, %%xmm0 \n"\ + stereo("mulps %%xmm5, %%xmm1 \n")\ "lea 1024(%3,%0), %1 \n"\ "mov %5, %2 \n"\ "2: \n"\ @@ -2037,12 +2058,12 @@ __asm__ volatile( "1: \n" "sub $8, %0 \n" - "movss (%2,%0), %%xmm6 \n" - "movss 4(%2,%0), %%xmm7 \n" - "shufps $0, %%xmm6, %%xmm6 \n" - "shufps $0, %%xmm7, %%xmm7 \n" - "movaps %%xmm6, (%1,%0,4) \n" - "movaps %%xmm7, 16(%1,%0,4) \n" + "movss (%2,%0), %%xmm4 \n" + "movss 4(%2,%0), %%xmm5 \n" + "shufps $0, %%xmm4, %%xmm4 \n" + "shufps $0, %%xmm5, %%xmm5 \n" + "movaps %%xmm4, (%1,%0,4) \n" + "movaps %%xmm5, 16(%1,%0,4) \n" "jg 1b \n" :"+&r"(j) :"r"(matrix_simd), "r"(matrix) @@ -2385,6 +2406,19 @@ ); } +void ff_vp3_idct_mmx(int16_t *input_data); +void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block); +void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block); + +void ff_vp3_idct_dc_add_mmx2(uint8_t *dest, int line_size, const DCTELEM *block); + +void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values); +void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values); + +void ff_vp3_idct_sse2(int16_t *input_data); +void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block); +void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block); + void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len); void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len); void ff_float_to_int16_interleave6_3dn2(int16_t *dst, const float **src, int len); @@ -2396,20 +2430,8 @@ void ff_add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top); int ff_add_hfyu_left_prediction_ssse3(uint8_t *dst, const uint8_t *src, int w, int left); int ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src, int w, int left); -void ff_x264_deblock_v_luma_sse2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0); -void ff_x264_deblock_h_luma_sse2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0); -void ff_x264_deblock_h_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta); -void ff_x264_deblock_v_luma_intra_sse2(uint8_t *pix, int stride, int alpha, int beta); -void ff_x264_deblock_h_luma_intra_sse2(uint8_t *pix, int stride, int alpha, int beta); - -#if HAVE_YASM && ARCH_X86_32 -void ff_x264_deblock_v8_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta); -static void ff_x264_deblock_v_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta) -{ - ff_x264_deblock_v8_luma_intra_mmxext(pix+0, stride, alpha, beta); - ff_x264_deblock_v8_luma_intra_mmxext(pix+8, stride, alpha, beta); -} -#elif !HAVE_YASM + +#if !HAVE_YASM #define ff_float_to_int16_interleave6_sse(a,b,c) float_to_int16_interleave_misc_sse(a,b,c,6) #define ff_float_to_int16_interleave6_3dnow(a,b,c) float_to_int16_interleave_misc_3dnow(a,b,c,6) #define ff_float_to_int16_interleave6_3dn2(a,b,c) float_to_int16_interleave_misc_3dnow(a,b,c,6) @@ -2509,10 +2531,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) { - mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); if (avctx->dsp_mask) { - if (avctx->dsp_mask & FF_MM_FORCE) + if (avctx->dsp_mask & AV_CPU_FLAG_FORCE) mm_flags |= (avctx->dsp_mask & 0xffff); else mm_flags &= ~(avctx->dsp_mask & 0xffff); @@ -2520,20 +2542,20 @@ #if 0 av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:"); - if (mm_flags & FF_MM_MMX) + if (mm_flags & AV_CPU_FLAG_MMX) av_log(avctx, AV_LOG_INFO, " mmx"); - if (mm_flags & FF_MM_MMX2) + if (mm_flags & AV_CPU_FLAG_MMX2) av_log(avctx, AV_LOG_INFO, " mmx2"); - if (mm_flags & FF_MM_3DNOW) + if (mm_flags & AV_CPU_FLAG_3DNOW) av_log(avctx, AV_LOG_INFO, " 3dnow"); - if (mm_flags & FF_MM_SSE) + if (mm_flags & AV_CPU_FLAG_SSE) av_log(avctx, AV_LOG_INFO, " sse"); - if (mm_flags & FF_MM_SSE2) + if (mm_flags & AV_CPU_FLAG_SSE2) av_log(avctx, AV_LOG_INFO, " sse2"); av_log(avctx, AV_LOG_INFO, "\n"); #endif - if (mm_flags & FF_MM_MMX) { + if (mm_flags & AV_CPU_FLAG_MMX) { const int idct_algo= avctx->idct_algo; if(avctx->lowres==0){ @@ -2544,7 +2566,7 @@ c->idct_permutation_type= FF_SIMPLE_IDCT_PERM; #if CONFIG_GPL }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){ - if(mm_flags & FF_MM_MMX2){ + if(mm_flags & AV_CPU_FLAG_MMX2){ c->idct_put= ff_libmpeg2mmx2_idct_put; c->idct_add= ff_libmpeg2mmx2_idct_add; c->idct = ff_mmxext_idct; @@ -2556,8 +2578,8 @@ c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; #endif }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER) && - idct_algo==FF_IDCT_VP3){ - if(mm_flags & FF_MM_SSE2){ + idct_algo==FF_IDCT_VP3 && HAVE_YASM){ + if(mm_flags & AV_CPU_FLAG_SSE2){ c->idct_put= ff_vp3_idct_put_sse2; c->idct_add= ff_vp3_idct_add_sse2; c->idct = ff_vp3_idct_sse2; @@ -2571,12 +2593,12 @@ }else if(idct_algo==FF_IDCT_CAVS){ c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM; }else if(idct_algo==FF_IDCT_XVIDMMX){ - if(mm_flags & FF_MM_SSE2){ + if(mm_flags & AV_CPU_FLAG_SSE2){ c->idct_put= ff_idct_xvid_sse2_put; c->idct_add= ff_idct_xvid_sse2_add; c->idct = ff_idct_xvid_sse2; c->idct_permutation_type= FF_SSE2_IDCT_PERM; - }else if(mm_flags & FF_MM_MMX2){ + }else if(mm_flags & AV_CPU_FLAG_MMX2){ c->idct_put= ff_idct_xvid_mmx2_put; c->idct_add= ff_idct_xvid_mmx2_add; c->idct = ff_idct_xvid_mmx2; @@ -2588,12 +2610,12 @@ } } - c->put_pixels_clamped = put_pixels_clamped_mmx; - c->put_signed_pixels_clamped = put_signed_pixels_clamped_mmx; - c->add_pixels_clamped = add_pixels_clamped_mmx; + c->put_pixels_clamped = ff_put_pixels_clamped_mmx; + c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx; + c->add_pixels_clamped = ff_add_pixels_clamped_mmx; c->clear_block = clear_block_mmx; c->clear_blocks = clear_blocks_mmx; - if ((mm_flags & FF_MM_SSE) && + if ((mm_flags & AV_CPU_FLAG_SSE) && !(CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)){ /* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */ c->clear_block = clear_block_sse; @@ -2626,18 +2648,17 @@ c->h263_v_loop_filter= h263_v_loop_filter_mmx; c->h263_h_loop_filter= h263_h_loop_filter_mmx; } - c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx_rnd; - c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_mmx; - c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_vc1_chroma_mc8_mmx_nornd; - c->put_rv40_chroma_pixels_tab[0]= put_rv40_chroma_mc8_mmx; - c->put_rv40_chroma_pixels_tab[1]= put_rv40_chroma_mc4_mmx; +#if HAVE_YASM + c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_mmx_rnd; + c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_mmx; + c->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd; - if (CONFIG_VP6_DECODER) { - c->vp6_filter_diag4 = ff_vp6_filter_diag4_mmx; - } + c->put_rv40_chroma_pixels_tab[0]= ff_put_rv40_chroma_mc8_mmx; + c->put_rv40_chroma_pixels_tab[1]= ff_put_rv40_chroma_mc4_mmx; +#endif - if (mm_flags & FF_MM_MMX2) { + if (mm_flags & AV_CPU_FLAG_MMX2) { c->prefetch = prefetch_mmx2; c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2; @@ -2662,12 +2683,12 @@ c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2; c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2; - if (CONFIG_VP3_DECODER) { + if (CONFIG_VP3_DECODER && HAVE_YASM) { c->vp3_v_loop_filter= ff_vp3_v_loop_filter_mmx2; c->vp3_h_loop_filter= ff_vp3_h_loop_filter_mmx2; } } - if (CONFIG_VP3_DECODER) { + if (CONFIG_VP3_DECODER && HAVE_YASM) { c->vp3_idct_dc_add = ff_vp3_idct_dc_add_mmx2; } @@ -2714,21 +2735,21 @@ SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, mmx2); SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmx2); - c->avg_rv40_chroma_pixels_tab[0]= avg_rv40_chroma_mc8_mmx2; - c->avg_rv40_chroma_pixels_tab[1]= avg_rv40_chroma_mc4_mmx2; +#if HAVE_YASM + c->avg_rv40_chroma_pixels_tab[0]= ff_avg_rv40_chroma_mc8_mmx2; + c->avg_rv40_chroma_pixels_tab[1]= ff_avg_rv40_chroma_mc4_mmx2; - c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_vc1_chroma_mc8_mmx2_nornd; + c->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd; - c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_mmx2_rnd; - c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_mmx2; - c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_mmx2; - c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_mmx2; + c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_mmx2_rnd; + c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_mmx2; + c->avg_h264_chroma_pixels_tab[2]= ff_avg_h264_chroma_mc2_mmx2; + c->put_h264_chroma_pixels_tab[2]= ff_put_h264_chroma_mc2_mmx2; -#if HAVE_YASM c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_mmx2; #endif #if HAVE_7REGS && HAVE_TEN_OPERANDS - if( mm_flags&FF_MM_3DNOW ) + if( mm_flags&AV_CPU_FLAG_3DNOW ) c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov; #endif @@ -2736,7 +2757,7 @@ ff_vc1dsp_init_mmx(c, avctx); c->add_png_paeth_prediction= add_png_paeth_prediction_mmx2; - } else if (mm_flags & FF_MM_3DNOW) { + } else if (mm_flags & AV_CPU_FLAG_3DNOW) { c->prefetch = prefetch_3dnow; c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow; @@ -2787,11 +2808,15 @@ SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, 3dnow); SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, 3dnow); - c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_3dnow_rnd; - c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow; +#if HAVE_YASM + c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_3dnow_rnd; + c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_3dnow; + + c->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd; - c->avg_rv40_chroma_pixels_tab[0]= avg_rv40_chroma_mc8_3dnow; - c->avg_rv40_chroma_pixels_tab[1]= avg_rv40_chroma_mc4_3dnow; + c->avg_rv40_chroma_pixels_tab[0]= ff_avg_rv40_chroma_mc8_3dnow; + c->avg_rv40_chroma_pixels_tab[1]= ff_avg_rv40_chroma_mc4_3dnow; +#endif } @@ -2800,13 +2825,14 @@ c->put_h264_qpel_pixels_tab[1][x+y*4] = put_h264_qpel8_mc##x##y##_##CPU;\ c->avg_h264_qpel_pixels_tab[0][x+y*4] = avg_h264_qpel16_mc##x##y##_##CPU;\ c->avg_h264_qpel_pixels_tab[1][x+y*4] = avg_h264_qpel8_mc##x##y##_##CPU; - if((mm_flags & FF_MM_SSE2) && !(mm_flags & FF_MM_3DNOW)){ + if((mm_flags & AV_CPU_FLAG_SSE2) && !(mm_flags & AV_CPU_FLAG_3DNOW)){ // these functions are slower than mmx on AMD, but faster on Intel c->put_pixels_tab[0][0] = put_pixels16_sse2; + c->put_no_rnd_pixels_tab[0][0] = put_pixels16_sse2; c->avg_pixels_tab[0][0] = avg_pixels16_sse2; H264_QPEL_FUNCS(0, 0, sse2); } - if(mm_flags & FF_MM_SSE2){ + if(mm_flags & AV_CPU_FLAG_SSE2){ H264_QPEL_FUNCS(0, 1, sse2); H264_QPEL_FUNCS(0, 2, sse2); H264_QPEL_FUNCS(0, 3, sse2); @@ -2819,13 +2845,9 @@ H264_QPEL_FUNCS(3, 1, sse2); H264_QPEL_FUNCS(3, 2, sse2); H264_QPEL_FUNCS(3, 3, sse2); - - if (CONFIG_VP6_DECODER) { - c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2; - } } #if HAVE_SSSE3 - if(mm_flags & FF_MM_SSSE3){ + if(mm_flags & AV_CPU_FLAG_SSSE3){ H264_QPEL_FUNCS(1, 0, ssse3); H264_QPEL_FUNCS(1, 1, ssse3); H264_QPEL_FUNCS(1, 2, ssse3); @@ -2838,22 +2860,22 @@ H264_QPEL_FUNCS(3, 1, ssse3); H264_QPEL_FUNCS(3, 2, ssse3); H264_QPEL_FUNCS(3, 3, ssse3); - c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_vc1_chroma_mc8_ssse3_nornd; - c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_vc1_chroma_mc8_ssse3_nornd; - c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_ssse3_rnd; - c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_ssse3_rnd; - c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_ssse3; - c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_ssse3; c->add_png_paeth_prediction= add_png_paeth_prediction_ssse3; #if HAVE_YASM + c->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd; + c->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd; + c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_ssse3_rnd; + c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_ssse3_rnd; + c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_ssse3; + c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_ssse3; c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_ssse3; - if (mm_flags & FF_MM_SSE4) // not really sse4, just slow on Conroe + if (mm_flags & AV_CPU_FLAG_SSE4) // not really sse4, just slow on Conroe c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_sse4; #endif } #endif - if(mm_flags & FF_MM_3DNOW){ + if(mm_flags & AV_CPU_FLAG_3DNOW){ c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow; c->vector_fmul = vector_fmul_3dnow; if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ @@ -2861,20 +2883,20 @@ c->float_to_int16_interleave = float_to_int16_interleave_3dnow; } } - if(mm_flags & FF_MM_3DNOWEXT){ + if(mm_flags & AV_CPU_FLAG_3DNOWEXT){ c->vector_fmul_reverse = vector_fmul_reverse_3dnow2; c->vector_fmul_window = vector_fmul_window_3dnow2; if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->float_to_int16_interleave = float_to_int16_interleave_3dn2; } } - if(mm_flags & FF_MM_MMX2){ + if(mm_flags & AV_CPU_FLAG_MMX2){ #if HAVE_YASM c->scalarproduct_int16 = ff_scalarproduct_int16_mmx2; c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmx2; #endif } - if(mm_flags & FF_MM_SSE){ + if(mm_flags & AV_CPU_FLAG_SSE){ c->vorbis_inverse_coupling = vorbis_inverse_coupling_sse; c->ac3_downmix = ac3_downmix_sse; c->vector_fmul = vector_fmul_sse; @@ -2889,9 +2911,9 @@ c->scalarproduct_float = ff_scalarproduct_float_sse; #endif } - if(mm_flags & FF_MM_3DNOW) + if(mm_flags & AV_CPU_FLAG_3DNOW) c->vector_fmul_add = vector_fmul_add_3dnow; // faster than sse - if(mm_flags & FF_MM_SSE2){ + if(mm_flags & AV_CPU_FLAG_SSE2){ c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse2; c->float_to_int16 = float_to_int16_sse2; c->float_to_int16_interleave = float_to_int16_interleave_sse2; @@ -2900,7 +2922,7 @@ c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2; #endif } - if((mm_flags & FF_MM_SSSE3) && !(mm_flags & (FF_MM_SSE42|FF_MM_3DNOW)) && HAVE_YASM) // cachesplit + if((mm_flags & AV_CPU_FLAG_SSSE3) && !(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW)) && HAVE_YASM) // cachesplit c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3; } @@ -2942,89 +2964,3 @@ //ff_idct = just_return; #endif } - -#if CONFIG_H264DSP -void ff_h264dsp_init_x86(H264DSPContext *c) -{ - mm_flags = mm_support(); - - if (mm_flags & FF_MM_MMX) { - c->h264_idct_dc_add= - c->h264_idct_add= ff_h264_idct_add_mmx; - c->h264_idct8_dc_add= - c->h264_idct8_add= ff_h264_idct8_add_mmx; - - c->h264_idct_add16 = ff_h264_idct_add16_mmx; - c->h264_idct8_add4 = ff_h264_idct8_add4_mmx; - c->h264_idct_add8 = ff_h264_idct_add8_mmx; - c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx; - - if (mm_flags & FF_MM_MMX2) { - c->h264_idct_dc_add= ff_h264_idct_dc_add_mmx2; - c->h264_idct8_dc_add= ff_h264_idct8_dc_add_mmx2; - c->h264_idct_add16 = ff_h264_idct_add16_mmx2; - c->h264_idct8_add4 = ff_h264_idct8_add4_mmx2; - c->h264_idct_add8 = ff_h264_idct_add8_mmx2; - c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx2; - - c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_mmx2; - c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_mmx2; - c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_mmx2; - c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_mmx2; - c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_mmx2; - c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_mmx2; - c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2; - - c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_mmx2; - c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_mmx2; - c->weight_h264_pixels_tab[2]= ff_h264_weight_8x16_mmx2; - c->weight_h264_pixels_tab[3]= ff_h264_weight_8x8_mmx2; - c->weight_h264_pixels_tab[4]= ff_h264_weight_8x4_mmx2; - c->weight_h264_pixels_tab[5]= ff_h264_weight_4x8_mmx2; - c->weight_h264_pixels_tab[6]= ff_h264_weight_4x4_mmx2; - c->weight_h264_pixels_tab[7]= ff_h264_weight_4x2_mmx2; - - c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_mmx2; - c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_mmx2; - c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_mmx2; - c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_mmx2; - c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_mmx2; - c->biweight_h264_pixels_tab[5]= ff_h264_biweight_4x8_mmx2; - c->biweight_h264_pixels_tab[6]= ff_h264_biweight_4x4_mmx2; - c->biweight_h264_pixels_tab[7]= ff_h264_biweight_4x2_mmx2; - } - if(mm_flags & FF_MM_SSE2){ - c->h264_idct8_add = ff_h264_idct8_add_sse2; - c->h264_idct8_add4= ff_h264_idct8_add4_sse2; - } - -#if HAVE_YASM - if (mm_flags & FF_MM_MMX2){ -#if ARCH_X86_32 - c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_mmxext; - c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_mmxext; -#endif - if( mm_flags&FF_MM_SSE2 ){ - c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_sse2; - c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_sse2; -#if ARCH_X86_64 || !defined(__ICC) || __ICC > 1110 - c->h264_v_loop_filter_luma = ff_x264_deblock_v_luma_sse2; - c->h264_h_loop_filter_luma = ff_x264_deblock_h_luma_sse2; - c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_sse2; - c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_sse2; -#endif -#if CONFIG_GPL - c->h264_idct_add16 = ff_h264_idct_add16_sse2; - c->h264_idct_add8 = ff_h264_idct_add8_sse2; - c->h264_idct_add16intra = ff_h264_idct_add16intra_sse2; -#endif - } - if ( mm_flags&FF_MM_SSSE3 ){ - c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_ssse3; - c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_ssse3; - } - } -#endif - } -} -#endif /* CONFIG_H264DSP */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputil_mmx.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputil_mmx.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/dsputil_mmx.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/dsputil_mmx.h 2010-11-06 17:21:28.000000000 +0000 @@ -57,7 +57,7 @@ extern const uint64_t ff_pb_1F; extern const uint64_t ff_pb_3F; extern const uint64_t ff_pb_81; -extern const uint64_t ff_pb_A1; +extern const xmm_reg ff_pb_A1; extern const xmm_reg ff_pb_F8; extern const uint64_t ff_pb_FC; extern const xmm_reg ff_pb_FE; @@ -94,6 +94,35 @@ SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\ SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */ +static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){ + __asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ... + "movd %4, %%mm0 \n\t" + "movd %5, %%mm1 \n\t" + "movd %6, %%mm2 \n\t" + "movd %7, %%mm3 \n\t" + "punpcklbw %%mm1, %%mm0 \n\t" + "punpcklbw %%mm3, %%mm2 \n\t" + "movq %%mm0, %%mm1 \n\t" + "punpcklwd %%mm2, %%mm0 \n\t" + "punpckhwd %%mm2, %%mm1 \n\t" + "movd %%mm0, %0 \n\t" + "punpckhdq %%mm0, %%mm0 \n\t" + "movd %%mm0, %1 \n\t" + "movd %%mm1, %2 \n\t" + "punpckhdq %%mm1, %%mm1 \n\t" + "movd %%mm1, %3 \n\t" + + : "=m" (*(uint32_t*)(dst + 0*dst_stride)), + "=m" (*(uint32_t*)(dst + 1*dst_stride)), + "=m" (*(uint32_t*)(dst + 2*dst_stride)), + "=m" (*(uint32_t*)(dst + 3*dst_stride)) + : "m" (*(uint32_t*)(src + 0*src_stride)), + "m" (*(uint32_t*)(src + 1*src_stride)), + "m" (*(uint32_t*)(src + 2*src_stride)), + "m" (*(uint32_t*)(src + 3*src_stride)) + ); +} + // e,f,g,h can be memory // out: a,d,t,c #define TRANSPOSE8x4(a,b,c,d,e,f,g,h,t)\ @@ -158,9 +187,9 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx); void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx); -void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size); -void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size); -void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size); +void ff_add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size); +void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size); +void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size); void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fdct_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fdct_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fdct_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fdct_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -31,6 +31,7 @@ */ #include "libavutil/common.h" +#include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" ////////////////////////////////////////////////////////////////////// @@ -430,7 +431,10 @@ FDCT_ROW_SSE2_H2(80,192) FDCT_ROW_SSE2(80) : - : "r" (in), "r" (tab_frw_01234567_sse2.tab_frw_01234567_sse2), "r" (fdct_r_row_sse2.fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out) + : "r" (in), "r" (tab_frw_01234567_sse2.tab_frw_01234567_sse2), + "r" (fdct_r_row_sse2.fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out) + XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", + "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fft_3dn2.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fft_3dn2.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fft_3dn2.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fft_3dn2.c 2010-11-06 17:21:28.000000000 +0000 @@ -56,7 +56,7 @@ void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input) { x86_reg j, k; - long n = 1 << s->mdct_bits; + long n = s->mdct_size; long n2 = n >> 1; long n4 = n >> 2; long n8 = n >> 3; @@ -147,7 +147,7 @@ void ff_imdct_calc_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input) { x86_reg j, k; - long n = 1 << s->mdct_bits; + long n = s->mdct_size; long n4 = n >> 2; ff_imdct_half_3dn2(s, output+n4, input); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fft.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fft.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fft.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fft.c 2010-11-06 17:21:28.000000000 +0000 @@ -16,25 +16,26 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavcodec/dsputil.h" #include "fft.h" av_cold void ff_fft_init_mmx(FFTContext *s) { #if HAVE_YASM - int has_vectors = mm_support(); - if (has_vectors & FF_MM_SSE && HAVE_SSE) { + int has_vectors = av_get_cpu_flags(); + if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) { /* SSE for P3/P4/K8 */ s->imdct_calc = ff_imdct_calc_sse; s->imdct_half = ff_imdct_half_sse; s->fft_permute = ff_fft_permute_sse; s->fft_calc = ff_fft_calc_sse; - } else if (has_vectors & FF_MM_3DNOWEXT && HAVE_AMD3DNOWEXT) { + } else if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) { /* 3DNowEx for K7 */ s->imdct_calc = ff_imdct_calc_3dn2; s->imdct_half = ff_imdct_half_3dn2; s->fft_calc = ff_fft_calc_3dn2; - } else if (has_vectors & FF_MM_3DNOW && HAVE_AMD3DNOW) { + } else if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) { /* 3DNow! for K6-2/3 */ s->imdct_calc = ff_imdct_calc_3dn; s->imdct_half = ff_imdct_half_3dn; @@ -46,8 +47,8 @@ #if CONFIG_DCT av_cold void ff_dct_init_mmx(DCTContext *s) { - int has_vectors = mm_support(); - if (has_vectors & FF_MM_SSE && HAVE_SSE) + int has_vectors = av_get_cpu_flags(); + if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) s->dct32 = ff_dct32_float_sse; } #endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fft_mmx.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fft_mmx.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fft_mmx.asm 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fft_mmx.asm 2010-11-06 17:21:28.000000000 +0000 @@ -29,6 +29,23 @@ %include "x86inc.asm" +%ifdef ARCH_X86_64 +%define pointer resq +%else +%define pointer resd +%endif + +struc FFTContext + .nbits: resd 1 + .reverse: resd 1 + .revtab: pointer 1 + .tmpbuf: pointer 1 + .mdctsize: resd 1 + .mdctbits: resd 1 + .tcos: pointer 1 + .tsin: pointer 1 +endstruc + SECTION_RODATA %define M_SQRT1_2 0.70710678118654752440 @@ -137,9 +154,9 @@ mova m1, %3 ; wim mova m3, m5 mulps m2, m0 ; r2*wre -IF%1 mova m6, Z(6) +IF%1 mova m6, Z2(6) mulps m3, m1 ; i2*wim -IF%1 mova m7, Z(7) +IF%1 mova m7, Z2(7) mulps m4, m1 ; r2*wim mulps m5, m0 ; i2*wre addps m2, m3 ; r2*wre + i2*wim @@ -166,14 +183,14 @@ mova m4, m6 subps m6, m5 ; r3 addps m5, m4 ; r1 - mova Z(6), m6 + mova Z2(6), m6 mova Z(2), m5 mova m2, Z(3) addps m3, m0 ; t6 subps m2, m1 ; i3 mova m7, Z(1) addps m1, Z(3) ; i1 - mova Z(7), m2 + mova Z2(7), m2 mova Z(3), m1 mova m4, m7 subps m7, m3 ; i2 @@ -191,9 +208,9 @@ mova m3, m5 mova m1, [wq+o1q] ; wim mulps m2, m0 ; r2*wre - mova m6, Z(6) ; r3 + mova m6, Z2(6) ; r3 mulps m3, m1 ; i2*wim - mova m7, Z(7) ; i3 + mova m7, Z2(7) ; i3 mulps m4, m1 ; r2*wim mulps m5, m0 ; i2*wre addps m2, m3 ; r2*wre + i2*wim @@ -220,14 +237,14 @@ mova m4, m6 subps m6, m5 ; r3 addps m5, m4 ; r1 -IF%1 mova Z(6), m6 +IF%1 mova Z2(6), m6 IF%1 mova Z(2), m5 mova m2, Z(3) addps m3, m0 ; t6 subps m2, m1 ; i3 mova m7, Z(1) addps m1, Z(3) ; i1 -IF%1 mova Z(7), m2 +IF%1 mova Z2(7), m2 IF%1 mova Z(3), m1 mova m4, m7 subps m7, m3 ; i2 @@ -245,8 +262,8 @@ mova m2, Z(4) mova Z(2), m5 mova Z(3), m4 - mova Z(6), m6 - mova Z(7), m0 + mova Z2(6), m6 + mova Z2(7), m0 mova m5, m1 ; r0 mova m4, m2 ; r2 unpcklps m1, m3 @@ -270,6 +287,7 @@ %define mova movaps %define Z(x) [r0+mmsize*x] +%define Z2(x) [r0+mmsize*x] align 16 fft4_sse: @@ -309,8 +327,8 @@ mova Z(2), m2 mova Z(3), m3 T4_SSE m4, m5, m6 - mova m6, Z(6) - mova m7, Z(7) + mova m6, Z2(6) + mova m7, Z2(7) T4_SSE m6, m7, m0 PASS_SMALL 0, [cos_16], [cos_16+16] ret @@ -341,8 +359,8 @@ T4_3DN m0, m1, m2, m3, m4, m5 mova Z(0), m0 mova Z(2), m2 - T2_3DN m4, m5, Z(4), Z(5) - T2_3DN m6, m7, Z(6), Z(7) + T2_3DN m4, m5, Z(4), Z(5) + T2_3DN m6, m7, Z2(6), Z2(7) pswapd m0, m5 pswapd m2, m7 pxor m0, [ps_m1p1] @@ -353,7 +371,7 @@ pfmul m7, [ps_root2] T4_3DN m1, m3, m5, m7, m0, m2 mova Z(5), m5 - mova Z(7), m7 + mova Z2(7), m7 mova m0, Z(0) mova m2, Z(2) T4_3DN m0, m2, m4, m6, m5, m7 @@ -363,12 +381,12 @@ mova Z(1), m5 mova Z(2), m2 mova Z(3), m7 - PUNPCK m4, Z(5), m5 - PUNPCK m6, Z(7), m7 + PUNPCK m4, Z(5), m5 + PUNPCK m6, Z2(7), m7 mova Z(4), m4 mova Z(5), m5 - mova Z(6), m6 - mova Z(7), m7 + mova Z2(6), m6 + mova Z2(7), m7 ret %endmacro @@ -388,7 +406,8 @@ FFT48_3DN _3dn -%define Z(x) [zq + o1q*(x&6)*((x/6)^1) + o3q*(x/6) + mmsize*(x&1)] +%define Z(x) [zq + o1q*(x&6) + mmsize*(x&1)] +%define Z2(x) [zq + o3q + mmsize*(x&1)] %macro DECL_PASS 2+ ; name, payload align 16 @@ -428,6 +447,16 @@ %define SECTION_REL %endif +%macro FFT_DISPATCH 2; clobbers 5 GPRs, 8 XMMs + lea r2, [dispatch_tab%1] + mov r2, [r2 + (%2q-2)*gprsize] +%ifdef PIC + lea r3, [$$] + add r2, r3 +%endif + call r2 +%endmacro ; FFT_DISPATCH + %macro DECL_FFT 2-3 ; nbits, cpu, suffix %xdefine list_of_fft fft4%2 SECTION_REL, fft8%2 SECTION_REL %if %1==5 @@ -464,13 +493,7 @@ ; On x86_32, this function does the register saving and restoring for all of fft. ; The others pass args in registers and don't spill anything. cglobal fft_dispatch%3%2, 2,5,8, z, nbits - lea r2, [dispatch_tab%3%2] - mov r2, [r2 + (nbitsq-2)*gprsize] -%ifdef PIC - lea r3, [$$] - add r2, r3 -%endif - call r2 + FFT_DISPATCH %3%2, nbits RET %endmacro ; DECL_FFT @@ -481,3 +504,165 @@ DECL_FFT 4, _3dn2 DECL_FFT 4, _3dn2, _interleave +INIT_XMM +%undef mulps +%undef addps +%undef subps +%undef unpcklps +%undef unpckhps + +%macro PREROTATER 5 ;-2*k, 2*k, input+n4, tcos+n8, tsin+n8 + movaps xmm0, [%3+%2*4] + movaps xmm1, [%3+%1*4-0x10] + movaps xmm2, xmm0 + shufps xmm0, xmm1, 0x88 + shufps xmm1, xmm2, 0x77 + movlps xmm4, [%4+%2*2] + movlps xmm5, [%5+%2*2+0x0] + movhps xmm4, [%4+%1*2-0x8] + movhps xmm5, [%5+%1*2-0x8] + movaps xmm2, xmm0 + movaps xmm3, xmm1 + mulps xmm0, xmm5 + mulps xmm1, xmm4 + mulps xmm2, xmm4 + mulps xmm3, xmm5 + subps xmm1, xmm0 + addps xmm2, xmm3 + movaps xmm0, xmm1 + unpcklps xmm1, xmm2 + unpckhps xmm0, xmm2 +%endmacro + +%macro CMUL 6 ;j, xmm0, xmm1, 3, 4, 5 + movaps xmm6, [%4+%1*2] + movaps %2, [%4+%1*2+0x10] + movaps %3, xmm6 + movaps xmm7, %2 + mulps xmm6, [%5+%1] + mulps %2, [%6+%1] + mulps %3, [%6+%1] + mulps xmm7, [%5+%1] + subps %2, xmm6 + addps %3, xmm7 +%endmacro + +%macro POSROTATESHUF 5 ;j, k, z+n8, tcos+n8, tsin+n8 +.post: + CMUL %1, xmm0, xmm1, %3, %4, %5 + CMUL %2, xmm4, xmm5, %3, %4, %5 + shufps xmm1, xmm1, 0x1b + shufps xmm5, xmm5, 0x1b + movaps xmm6, xmm4 + unpckhps xmm4, xmm1 + unpcklps xmm6, xmm1 + movaps xmm2, xmm0 + unpcklps xmm0, xmm5 + unpckhps xmm2, xmm5 + movaps [%3+%2*2], xmm6 + movaps [%3+%2*2+0x10], xmm4 + movaps [%3+%1*2], xmm0 + movaps [%3+%1*2+0x10], xmm2 + sub %2, 0x10 + add %1, 0x10 + jl .post +%endmacro + +cglobal imdct_half_sse, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample *input +%ifdef ARCH_X86_64 +%define rrevtab r10 +%define rtcos r11 +%define rtsin r12 + push r12 + push r13 + push r14 +%else +%define rrevtab r6 +%define rtsin r6 +%define rtcos r5 +%endif + mov r3d, [r0+FFTContext.mdctsize] + add r2, r3 + shr r3, 1 + mov rtcos, [r0+FFTContext.tcos] + mov rtsin, [r0+FFTContext.tsin] + add rtcos, r3 + add rtsin, r3 +%ifndef ARCH_X86_64 + push rtcos + push rtsin +%endif + shr r3, 1 + mov rrevtab, [r0+FFTContext.revtab] + add rrevtab, r3 +%ifndef ARCH_X86_64 + push rrevtab +%endif + + sub r3, 4 +%ifdef ARCH_X86_64 + xor r4, r4 + sub r4, r3 +%endif +.pre: +%ifndef ARCH_X86_64 +;unspill + xor r4, r4 + sub r4, r3 + mov rtsin, [esp+4] + mov rtcos, [esp+8] +%endif + + PREROTATER r4, r3, r2, rtcos, rtsin +%ifdef ARCH_X86_64 + movzx r5, word [rrevtab+r4-4] + movzx r6, word [rrevtab+r4-2] + movzx r13, word [rrevtab+r3] + movzx r14, word [rrevtab+r3+2] + movlps [r1+r5 *8], xmm0 + movhps [r1+r6 *8], xmm0 + movlps [r1+r13*8], xmm1 + movhps [r1+r14*8], xmm1 + add r4, 4 +%else + mov r6, [esp] + movzx r5, word [r6+r4-4] + movzx r4, word [r6+r4-2] + movlps [r1+r5*8], xmm0 + movhps [r1+r4*8], xmm0 + movzx r5, word [r6+r3] + movzx r4, word [r6+r3+2] + movlps [r1+r5*8], xmm1 + movhps [r1+r4*8], xmm1 +%endif + sub r3, 4 + jns .pre + + mov r5, r0 + mov r6, r1 + mov r0, r1 + mov r1d, [r5+FFTContext.nbits] + + FFT_DISPATCH _sse, r1 + + mov r0d, [r5+FFTContext.mdctsize] + add r6, r0 + shr r0, 1 +%ifndef ARCH_X86_64 +%define rtcos r2 +%define rtsin r3 + mov rtcos, [esp+8] + mov rtsin, [esp+4] +%endif + neg r0 + mov r1, -16 + sub r1, r0 + POSROTATESHUF r0, r1, r6, rtcos, rtsin +%ifdef ARCH_X86_64 + pop r14 + pop r13 + pop r12 +%else + add esp, 12 +%endif + RET diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fft_sse.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fft_sse.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/fft_sse.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/fft_sse.c 2010-11-06 17:21:28.000000000 +0000 @@ -71,111 +71,10 @@ memcpy(z, s->tmp_buf, n*sizeof(FFTComplex)); } -void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input) -{ - av_unused x86_reg i, j, k, l; - long n = 1 << s->mdct_bits; - long n2 = n >> 1; - long n4 = n >> 2; - long n8 = n >> 3; - const uint16_t *revtab = s->revtab + n8; - const FFTSample *tcos = s->tcos; - const FFTSample *tsin = s->tsin; - FFTComplex *z = (FFTComplex *)output; - - /* pre rotation */ - for(k=n8-2; k>=0; k-=2) { - __asm__ volatile( - "movaps (%2,%1,2), %%xmm0 \n" // { z[k].re, z[k].im, z[k+1].re, z[k+1].im } - "movaps -16(%2,%0,2), %%xmm1 \n" // { z[-k-2].re, z[-k-2].im, z[-k-1].re, z[-k-1].im } - "movaps %%xmm0, %%xmm2 \n" - "shufps $0x88, %%xmm1, %%xmm0 \n" // { z[k].re, z[k+1].re, z[-k-2].re, z[-k-1].re } - "shufps $0x77, %%xmm2, %%xmm1 \n" // { z[-k-1].im, z[-k-2].im, z[k+1].im, z[k].im } - "movlps (%3,%1), %%xmm4 \n" - "movlps (%4,%1), %%xmm5 \n" - "movhps -8(%3,%0), %%xmm4 \n" // { cos[k], cos[k+1], cos[-k-2], cos[-k-1] } - "movhps -8(%4,%0), %%xmm5 \n" // { sin[k], sin[k+1], sin[-k-2], sin[-k-1] } - "movaps %%xmm0, %%xmm2 \n" - "movaps %%xmm1, %%xmm3 \n" - "mulps %%xmm5, %%xmm0 \n" // re*sin - "mulps %%xmm4, %%xmm1 \n" // im*cos - "mulps %%xmm4, %%xmm2 \n" // re*cos - "mulps %%xmm5, %%xmm3 \n" // im*sin - "subps %%xmm0, %%xmm1 \n" // -> re - "addps %%xmm3, %%xmm2 \n" // -> im - "movaps %%xmm1, %%xmm0 \n" - "unpcklps %%xmm2, %%xmm1 \n" // { z[k], z[k+1] } - "unpckhps %%xmm2, %%xmm0 \n" // { z[-k-2], z[-k-1] } - ::"r"(-4*k), "r"(4*k), - "r"(input+n4), "r"(tcos+n8), "r"(tsin+n8) - ); -#if ARCH_X86_64 - // if we have enough regs, don't let gcc make the luts latency-bound - // but if not, latency is faster than spilling - __asm__("movlps %%xmm0, %0 \n" - "movhps %%xmm0, %1 \n" - "movlps %%xmm1, %2 \n" - "movhps %%xmm1, %3 \n" - :"=m"(z[revtab[-k-2]]), - "=m"(z[revtab[-k-1]]), - "=m"(z[revtab[ k ]]), - "=m"(z[revtab[ k+1]]) - ); -#else - __asm__("movlps %%xmm0, %0" :"=m"(z[revtab[-k-2]])); - __asm__("movhps %%xmm0, %0" :"=m"(z[revtab[-k-1]])); - __asm__("movlps %%xmm1, %0" :"=m"(z[revtab[ k ]])); - __asm__("movhps %%xmm1, %0" :"=m"(z[revtab[ k+1]])); -#endif - } - - ff_fft_dispatch_sse(z, s->nbits); - - /* post rotation + reinterleave + reorder */ - -#define CMUL(j,xmm0,xmm1)\ - "movaps (%2,"#j",2), %%xmm6 \n"\ - "movaps 16(%2,"#j",2), "#xmm0"\n"\ - "movaps %%xmm6, "#xmm1"\n"\ - "movaps "#xmm0",%%xmm7 \n"\ - "mulps (%3,"#j"), %%xmm6 \n"\ - "mulps (%4,"#j"), "#xmm0"\n"\ - "mulps (%4,"#j"), "#xmm1"\n"\ - "mulps (%3,"#j"), %%xmm7 \n"\ - "subps %%xmm6, "#xmm0"\n"\ - "addps %%xmm7, "#xmm1"\n" - - j = -n2; - k = n2-16; - __asm__ volatile( - "1: \n" - CMUL(%0, %%xmm0, %%xmm1) - CMUL(%1, %%xmm4, %%xmm5) - "shufps $0x1b, %%xmm1, %%xmm1 \n" - "shufps $0x1b, %%xmm5, %%xmm5 \n" - "movaps %%xmm4, %%xmm6 \n" - "unpckhps %%xmm1, %%xmm4 \n" - "unpcklps %%xmm1, %%xmm6 \n" - "movaps %%xmm0, %%xmm2 \n" - "unpcklps %%xmm5, %%xmm0 \n" - "unpckhps %%xmm5, %%xmm2 \n" - "movaps %%xmm6, (%2,%1,2) \n" - "movaps %%xmm4, 16(%2,%1,2) \n" - "movaps %%xmm0, (%2,%0,2) \n" - "movaps %%xmm2, 16(%2,%0,2) \n" - "sub $16, %1 \n" - "add $16, %0 \n" - "jl 1b \n" - :"+&r"(j), "+&r"(k) - :"r"(z+n8), "r"(tcos+n8), "r"(tsin+n8) - :"memory" - ); -} - void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input) { x86_reg j, k; - long n = 1 << s->mdct_bits; + long n = s->mdct_size; long n4 = n >> 2; ff_imdct_half_sse(s, output+n4, input); @@ -198,6 +97,7 @@ :"+r"(j), "+r"(k) :"r"(output+n4), "r"(output+n4*3), "m"(*m1m1m1m1) + XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm7") ); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_chromamc.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_chromamc.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_chromamc.asm 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_chromamc.asm 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,671 @@ +;****************************************************************************** +;* MMX/SSSE3-optimized functions for H264 chroma MC +;* Copyright (c) 2005 Zoltan Hidvegi , +;* 2005-2008 Loren Merritt +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg is distributed in the hope that it will be useful, +;* but WITHOUT ANY WARRANTY; without even the implied warranty of +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" +%include "x86util.asm" + +SECTION_RODATA + +rnd_rv40_2d_tbl: times 4 dw 0 + times 4 dw 16 + times 4 dw 32 + times 4 dw 16 + times 4 dw 32 + times 4 dw 28 + times 4 dw 32 + times 4 dw 28 + times 4 dw 0 + times 4 dw 32 + times 4 dw 16 + times 4 dw 32 + times 4 dw 32 + times 4 dw 28 + times 4 dw 32 + times 4 dw 28 +rnd_rv40_1d_tbl: times 4 dw 0 + times 4 dw 2 + times 4 dw 4 + times 4 dw 2 + times 4 dw 4 + times 4 dw 3 + times 4 dw 4 + times 4 dw 3 + times 4 dw 0 + times 4 dw 4 + times 4 dw 2 + times 4 dw 4 + times 4 dw 4 + times 4 dw 3 + times 4 dw 4 + times 4 dw 3 + +cextern pw_3 +cextern pw_4 +cextern pw_8 +cextern pw_28 +cextern pw_32 +cextern pw_64 + +SECTION .text + +%macro mv0_pixels_mc8 0 + lea r4, [r2*2 ] +.next4rows + movq mm0, [r1 ] + movq mm1, [r1+r2] + CHROMAMC_AVG mm0, [r0 ] + CHROMAMC_AVG mm1, [r0+r2] + movq [r0 ], mm0 + movq [r0+r2], mm1 + add r0, r4 + add r1, r4 + movq mm0, [r1 ] + movq mm1, [r1+r2] + CHROMAMC_AVG mm0, [r0 ] + CHROMAMC_AVG mm1, [r0+r2] + add r1, r4 + movq [r0 ], mm0 + movq [r0+r2], mm1 + add r0, r4 + sub r3d, 4 + jne .next4rows +%endmacro + +%macro chroma_mc8_mmx_func 3 +; put/avg_h264_chroma_mc8_mmx_*(uint8_t *dst /*align 8*/, uint8_t *src /*align 1*/, +; int stride, int h, int mx, int my) +cglobal %1_%2_chroma_mc8_%3, 6, 7, 0 +%ifdef ARCH_X86_64 + movsxd r2, r2d +%endif + mov r6d, r5d + or r6d, r4d + jne .at_least_one_non_zero + ; mx == 0 AND my == 0 - no filter needed + mv0_pixels_mc8 + REP_RET + +.at_least_one_non_zero +%ifidn %2, rv40 +%ifdef PIC +%define rnd_1d_rv40 r11 +%define rnd_2d_rv40 r11 +%else ; no-PIC +%define rnd_1d_rv40 rnd_rv40_1d_tbl +%define rnd_2d_rv40 rnd_rv40_2d_tbl +%endif +%ifdef ARCH_X86_64 + mov r10, r5 + and r10, 6 ; &~1 for mx/my=[0,7] + lea r10, [r10*4+r4] + sar r10d, 1 +%define rnd_bias r10 +%define dest_reg r0 +%else ; x86-32 + mov r0, r5 + and r0, 6 ; &~1 for mx/my=[0,7] + lea r0, [r0*4+r4] + sar r0d, 1 +%define rnd_bias r0 +%define dest_reg r5 +%endif +%else ; vc1, h264 +%define rnd_bias 0 +%define dest_reg r0 +%endif + + test r5d, r5d + mov r6, 1 + je .my_is_zero + test r4d, r4d + mov r6, r2 ; dxy = x ? 1 : stride + jne .both_non_zero +.my_is_zero + ; mx == 0 XOR my == 0 - 1 dimensional filter only + or r4d, r5d ; x + y + +%ifidn %2, rv40 +%ifdef PIC + lea r11, [rnd_rv40_1d_tbl] +%endif +%ifndef ARCH_X86_64 + mov r5, r0m +%endif +%endif + + movd m5, r4d + movq m4, [pw_8] + movq m6, [rnd_1d_%2+rnd_bias*8] ; mm6 = rnd >> 3 + punpcklwd m5, m5 + punpckldq m5, m5 ; mm5 = B = x + pxor m7, m7 + psubw m4, m5 ; mm4 = A = 8-x + +.next1drow + movq m0, [r1 ] ; mm0 = src[0..7] + movq m2, [r1+r6] ; mm1 = src[1..8] + + movq m1, m0 + movq m3, m2 + punpcklbw m0, m7 + punpckhbw m1, m7 + punpcklbw m2, m7 + punpckhbw m3, m7 + pmullw m0, m4 ; [mm0,mm1] = A * src[0..7] + pmullw m1, m4 + pmullw m2, m5 ; [mm2,mm3] = B * src[1..8] + pmullw m3, m5 + + paddw m0, m6 + paddw m1, m6 + paddw m0, m2 + paddw m1, m3 + psrlw m0, 3 + psrlw m1, 3 + packuswb m0, m1 + CHROMAMC_AVG m0, [dest_reg] + movq [dest_reg], m0 ; dst[0..7] = (A * src[0..7] + B * src[1..8] + (rnd >> 3)) >> 3 + + add dest_reg, r2 + add r1, r2 + dec r3d + jne .next1drow + REP_RET + +.both_non_zero ; general case, bilinear + movd m4, r4d ; x + movd m6, r5d ; y +%ifidn %2, rv40 +%ifdef PIC + lea r11, [rnd_rv40_2d_tbl] +%endif +%ifndef ARCH_X86_64 + mov r5, r0m +%endif +%endif + mov r6, rsp ; backup stack pointer + and rsp, ~(mmsize-1) ; align stack + sub rsp, 16 ; AA and DD + + punpcklwd m4, m4 + punpcklwd m6, m6 + punpckldq m4, m4 ; mm4 = x words + punpckldq m6, m6 ; mm6 = y words + movq m5, m4 + pmullw m4, m6 ; mm4 = x * y + psllw m5, 3 + psllw m6, 3 + movq m7, m5 + paddw m7, m6 + movq [rsp+8], m4 ; DD = x * y + psubw m5, m4 ; mm5 = B = 8x - xy + psubw m6, m4 ; mm6 = C = 8y - xy + paddw m4, [pw_64] + psubw m4, m7 ; mm4 = A = xy - (8x+8y) + 64 + pxor m7, m7 + movq [rsp ], m4 + + movq m0, [r1 ] ; mm0 = src[0..7] + movq m1, [r1+1] ; mm1 = src[1..8] +.next2drow + add r1, r2 + + movq m2, m0 + movq m3, m1 + punpckhbw m0, m7 + punpcklbw m1, m7 + punpcklbw m2, m7 + punpckhbw m3, m7 + pmullw m0, [rsp] + pmullw m2, [rsp] + pmullw m1, m5 + pmullw m3, m5 + paddw m2, m1 ; mm2 = A * src[0..3] + B * src[1..4] + paddw m3, m0 ; mm3 = A * src[4..7] + B * src[5..8] + + movq m0, [r1] + movq m1, m0 + punpcklbw m0, m7 + punpckhbw m1, m7 + pmullw m0, m6 + pmullw m1, m6 + paddw m2, m0 + paddw m3, m1 ; [mm2,mm3] += C * src[0..7] + + movq m1, [r1+1] + movq m0, m1 + movq m4, m1 + punpcklbw m0, m7 + punpckhbw m4, m7 + pmullw m0, [rsp+8] + pmullw m4, [rsp+8] + paddw m2, m0 + paddw m3, m4 ; [mm2,mm3] += D * src[1..8] + movq m0, [r1] + + paddw m2, [rnd_2d_%2+rnd_bias*8] + paddw m3, [rnd_2d_%2+rnd_bias*8] + psrlw m2, 6 + psrlw m3, 6 + packuswb m2, m3 + CHROMAMC_AVG m2, [dest_reg] + movq [dest_reg], m2 ; dst[0..7] = ([mm2,mm3] + rnd) >> 6 + + add dest_reg, r2 + dec r3d + jne .next2drow + mov rsp, r6 ; restore stack pointer + RET +%endmacro + +%macro chroma_mc4_mmx_func 3 +cglobal %1_%2_chroma_mc4_%3, 6, 6, 0 +%ifdef ARCH_X86_64 + movsxd r2, r2d +%endif + pxor m7, m7 + movd m2, r4d ; x + movd m3, r5d ; y + movq m4, [pw_8] + movq m5, [pw_8] + punpcklwd m2, m2 + punpcklwd m3, m3 + punpcklwd m2, m2 + punpcklwd m3, m3 + psubw m4, m2 + psubw m5, m3 + +%ifidn %2, rv40 +%ifdef PIC + lea r11, [rnd_rv40_2d_tbl] +%define rnd_2d_rv40 r11 +%else +%define rnd_2d_rv40 rnd_rv40_2d_tbl +%endif + and r5, 6 ; &~1 for mx/my=[0,7] + lea r5, [r5*4+r4] + sar r5d, 1 +%define rnd_bias r5 +%else ; vc1, h264 +%define rnd_bias 0 +%endif + + movd m0, [r1 ] + movd m6, [r1+1] + add r1, r2 + punpcklbw m0, m7 + punpcklbw m6, m7 + pmullw m0, m4 + pmullw m6, m2 + paddw m6, m0 + +.next2rows + movd m0, [r1 ] + movd m1, [r1+1] + add r1, r2 + punpcklbw m0, m7 + punpcklbw m1, m7 + pmullw m0, m4 + pmullw m1, m2 + paddw m1, m0 + movq m0, m1 + + pmullw m6, m5 + pmullw m1, m3 + paddw m6, [rnd_2d_%2+rnd_bias*8] + paddw m1, m6 + psrlw m1, 6 + packuswb m1, m1 + CHROMAMC_AVG4 m1, m6, [r0] + movd [r0], m1 + add r0, r2 + + movd m6, [r1 ] + movd m1, [r1+1] + add r1, r2 + punpcklbw m6, m7 + punpcklbw m1, m7 + pmullw m6, m4 + pmullw m1, m2 + paddw m1, m6 + movq m6, m1 + pmullw m0, m5 + pmullw m1, m3 + paddw m0, [rnd_2d_%2+rnd_bias*8] + paddw m1, m0 + psrlw m1, 6 + packuswb m1, m1 + CHROMAMC_AVG4 m1, m0, [r0] + movd [r0], m1 + add r0, r2 + sub r3d, 2 + jnz .next2rows + REP_RET +%endmacro + +%macro chroma_mc2_mmx_func 3 +cglobal %1_%2_chroma_mc2_%3, 6, 7, 0 +%ifdef ARCH_X86_64 + movsxd r2, r2d +%endif + + mov r6d, r4d + shl r4d, 16 + sub r4d, r6d + add r4d, 8 + imul r5d, r4d ; x*y<<16 | y*(8-x) + shl r4d, 3 + sub r4d, r5d ; x*(8-y)<<16 | (8-x)*(8-y) + + movd m5, r4d + movd m6, r5d + punpckldq m5, m5 ; mm5 = {A,B,A,B} + punpckldq m6, m6 ; mm6 = {C,D,C,D} + pxor m7, m7 + movd m2, [r1] + punpcklbw m2, m7 + pshufw m2, m2, 0x94 ; mm0 = src[0,1,1,2] + +.nextrow + add r1, r2 + movq m1, m2 + pmaddwd m1, m5 ; mm1 = A * src[0,1] + B * src[1,2] + movd m0, [r1] + punpcklbw m0, m7 + pshufw m0, m0, 0x94 ; mm0 = src[0,1,1,2] + movq m2, m0 + pmaddwd m0, m6 + paddw m1, [rnd_2d_%2] + paddw m1, m0 ; mm1 += C * src[0,1] + D * src[1,2] + psrlw m1, 6 + packssdw m1, m7 + packuswb m1, m7 + CHROMAMC_AVG4 m1, m3, [r0] + movd r5d, m1 + mov [r0], r5w + add r0, r2 + sub r3d, 1 + jnz .nextrow + REP_RET +%endmacro + +%define rnd_1d_h264 pw_4 +%define rnd_2d_h264 pw_32 +%define rnd_1d_vc1 pw_3 +%define rnd_2d_vc1 pw_28 + +%macro NOTHING 2-3 +%endmacro +%macro DIRECT_AVG 2 + PAVG %1, %2 +%endmacro +%macro COPY_AVG 3 + movd %2, %3 + PAVG %1, %2 +%endmacro + +INIT_MMX +%define CHROMAMC_AVG NOTHING +%define CHROMAMC_AVG4 NOTHING +chroma_mc8_mmx_func put, h264, mmx_rnd +chroma_mc8_mmx_func put, vc1, mmx_nornd +chroma_mc8_mmx_func put, rv40, mmx +chroma_mc4_mmx_func put, h264, mmx +chroma_mc4_mmx_func put, rv40, mmx +chroma_mc2_mmx_func put, h264, mmx2 + +%define CHROMAMC_AVG DIRECT_AVG +%define CHROMAMC_AVG4 COPY_AVG +%define PAVG pavgb +chroma_mc8_mmx_func avg, h264, mmx2_rnd +chroma_mc8_mmx_func avg, vc1, mmx2_nornd +chroma_mc8_mmx_func avg, rv40, mmx2 +chroma_mc4_mmx_func avg, h264, mmx2 +chroma_mc4_mmx_func avg, rv40, mmx2 +chroma_mc2_mmx_func avg, h264, mmx2 + +%define PAVG pavgusb +chroma_mc8_mmx_func avg, h264, 3dnow_rnd +chroma_mc8_mmx_func avg, vc1, 3dnow_nornd +chroma_mc8_mmx_func avg, rv40, 3dnow +chroma_mc4_mmx_func avg, h264, 3dnow +chroma_mc4_mmx_func avg, rv40, 3dnow + +%macro chroma_mc8_ssse3_func 3 +cglobal %1_%2_chroma_mc8_%3, 6, 7, 8 +%ifdef ARCH_X86_64 + movsxd r2, r2d +%endif + mov r6d, r5d + or r6d, r4d + jne .at_least_one_non_zero + ; mx == 0 AND my == 0 - no filter needed + mv0_pixels_mc8 + REP_RET + +.at_least_one_non_zero + test r5d, r5d + je .my_is_zero + test r4d, r4d + je .mx_is_zero + + ; general case, bilinear + mov r6d, r4d + shl r4d, 8 + sub r4, r6 + add r4, 8 ; x*288+8 = x<<8 | (8-x) + mov r6, 8 + sub r6d, r5d + imul r6, r4 ; (8-y)*(x*255+8) = (8-y)*x<<8 | (8-y)*(8-x) + imul r4d, r5d ; y *(x*255+8) = y *x<<8 | y *(8-x) + + movd m7, r6d + movd m6, r4d + movdqa m5, [rnd_2d_%2] + pshuflw m7, m7, 0 + pshuflw m6, m6, 0 + movlhps m7, m7 + movlhps m6, m6 + + movq m0, [r1 ] + movq m1, [r1 +1] + punpcklbw m0, m1 + add r1, r2 +.next2rows + movq m1, [r1 ] + movq m2, [r1 +1] + movq m3, [r1+r2 ] + movq m4, [r1+r2+1] + lea r1, [r1+r2*2] + punpcklbw m1, m2 + punpcklbw m3, m4 + movdqa m2, m1 + movdqa m4, m3 + pmaddubsw m0, m7 + pmaddubsw m1, m6 + pmaddubsw m2, m7 + pmaddubsw m3, m6 + paddw m0, m5 + paddw m2, m5 + paddw m1, m0 + paddw m3, m2 + movdqa m0, m4 + psrlw m1, 6 + psrlw m3, 6 +%ifidn %1, avg + movq m2, [r0 ] + movhps m2, [r0+r2] +%endif + packuswb m1, m3 + CHROMAMC_AVG m1, m2 + movq [r0 ], m1 + movhps [r0+r2], m1 + sub r3d, 2 + lea r0, [r0+r2*2] + jg .next2rows + REP_RET + +.my_is_zero + mov r5d, r4d + shl r4d, 8 + add r4, 8 + sub r4, r5 ; 255*x+8 = x<<8 | (8-x) + movd m7, r4d + movq m6, [rnd_1d_%2] + pshuflw m7, m7, 0 + movlhps m6, m6 + movlhps m7, m7 + +.next2xrows + movq m0, [r1 ] + movq m1, [r1 +1] + movq m2, [r1+r2 ] + movq m3, [r1+r2+1] + punpcklbw m0, m1 + punpcklbw m2, m3 + pmaddubsw m0, m7 + pmaddubsw m2, m7 +%ifidn %1, avg + movq m4, [r0 ] + movhps m4, [r0+r2] +%endif + paddw m0, m6 + paddw m2, m6 + psrlw m0, 3 + psrlw m2, 3 + packuswb m0, m2 + CHROMAMC_AVG m0, m4 + movq [r0 ], m0 + movhps [r0+r2], m0 + sub r3d, 2 + lea r0, [r0+r2*2] + lea r1, [r1+r2*2] + jg .next2xrows + REP_RET + +.mx_is_zero + mov r4d, r5d + shl r5d, 8 + add r5, 8 + sub r5, r4 ; 255*y+8 = y<<8 | (8-y) + movd m7, r5d + movq m6, [rnd_1d_%2] + pshuflw m7, m7, 0 + movlhps m6, m6 + movlhps m7, m7 + +.next2yrows + movq m0, [r1 ] + movq m1, [r1+r2 ] + movdqa m2, m1 + movq m3, [r1+r2*2] + punpcklbw m0, m1 + punpcklbw m2, m3 + pmaddubsw m0, m7 + pmaddubsw m2, m7 +%ifidn %1, avg + movq m4, [r0 ] + movhps m4, [r0+r2] +%endif + paddw m0, m6 + paddw m2, m6 + psrlw m0, 3 + psrlw m2, 3 + packuswb m0, m2 + CHROMAMC_AVG m0, m4 + movq [r0 ], m0 + movhps [r0+r2], m0 + sub r3d, 2 + lea r0, [r0+r2*2] + lea r1, [r1+r2*2] + jg .next2yrows + REP_RET +%endmacro + +%macro chroma_mc4_ssse3_func 3 +cglobal %1_%2_chroma_mc4_%3, 6, 7, 0 +%ifdef ARCH_X86_64 + movsxd r2, r2d +%endif + mov r6, r4 + shl r4d, 8 + sub r4d, r6d + add r4d, 8 ; x*288+8 + mov r6, 8 + sub r6d, r5d + imul r6d, r4d ; (8-y)*(x*255+8) = (8-y)*x<<8 | (8-y)*(8-x) + imul r4d, r5d ; y *(x*255+8) = y *x<<8 | y *(8-x) + + movd m7, r6d + movd m6, r4d + movq m5, [pw_32] + pshufw m7, m7, 0 + pshufw m6, m6, 0 + + movd m0, [r1 ] + punpcklbw m0, [r1 +1] + add r1, r2 +.next2rows + movd m1, [r1 ] + movd m3, [r1+r2 ] + punpcklbw m1, [r1 +1] + punpcklbw m3, [r1+r2+1] + lea r1, [r1+r2*2] + movq m2, m1 + movq m4, m3 + pmaddubsw m0, m7 + pmaddubsw m1, m6 + pmaddubsw m2, m7 + pmaddubsw m3, m6 + paddw m0, m5 + paddw m2, m5 + paddw m1, m0 + paddw m3, m2 + movq m0, m4 + psrlw m1, 6 + psrlw m3, 6 + packuswb m1, m1 + packuswb m3, m3 + CHROMAMC_AVG m1, [r0 ] + CHROMAMC_AVG m3, [r0+r2] + movd [r0 ], m1 + movd [r0+r2], m3 + sub r3d, 2 + lea r0, [r0+r2*2] + jg .next2rows + REP_RET +%endmacro + +%define CHROMAMC_AVG NOTHING +INIT_XMM +chroma_mc8_ssse3_func put, h264, ssse3_rnd +chroma_mc8_ssse3_func put, vc1, ssse3_nornd +INIT_MMX +chroma_mc4_ssse3_func put, h264, ssse3 + +%define CHROMAMC_AVG DIRECT_AVG +%define PAVG pavgb +INIT_XMM +chroma_mc8_ssse3_func avg, h264, ssse3_rnd +chroma_mc8_ssse3_func avg, vc1, ssse3_nornd +INIT_MMX +chroma_mc4_ssse3_func avg, h264, ssse3 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_deblock.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_deblock.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_deblock.asm 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_deblock.asm 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,889 @@ +;***************************************************************************** +;* MMX/SSE2-optimized H.264 deblocking code +;***************************************************************************** +;* Copyright (C) 2005-2008 x264 project +;* +;* Authors: Loren Merritt +;* Jason Garrett-Glaser +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg is distributed in the hope that it will be useful, +;* but WITHOUT ANY WARRANTY; without even the implied warranty of +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" +%include "x86util.asm" + +SECTION_RODATA + +cextern pb_0 +cextern pb_1 +cextern pb_3 +cextern pb_A1 + +SECTION .text + +; expands to [base],...,[base+7*stride] +%define PASS8ROWS(base, base3, stride, stride3) \ + [base], [base+stride], [base+stride*2], [base3], \ + [base3+stride], [base3+stride*2], [base3+stride3], [base3+stride*4] + +; in: 8 rows of 4 bytes in %1..%8 +; out: 4 rows of 8 bytes in m0..m3 +%macro TRANSPOSE4x8_LOAD 8 + movd m0, %1 + movd m2, %2 + movd m1, %3 + movd m3, %4 + punpcklbw m0, m2 + punpcklbw m1, m3 + movq m2, m0 + punpcklwd m0, m1 + punpckhwd m2, m1 + + movd m4, %5 + movd m6, %6 + movd m5, %7 + movd m7, %8 + punpcklbw m4, m6 + punpcklbw m5, m7 + movq m6, m4 + punpcklwd m4, m5 + punpckhwd m6, m5 + + movq m1, m0 + movq m3, m2 + punpckldq m0, m4 + punpckhdq m1, m4 + punpckldq m2, m6 + punpckhdq m3, m6 +%endmacro + +; in: 4 rows of 8 bytes in m0..m3 +; out: 8 rows of 4 bytes in %1..%8 +%macro TRANSPOSE8x4_STORE 8 + movq m4, m0 + movq m5, m1 + movq m6, m2 + punpckhdq m4, m4 + punpckhdq m5, m5 + punpckhdq m6, m6 + + punpcklbw m0, m1 + punpcklbw m2, m3 + movq m1, m0 + punpcklwd m0, m2 + punpckhwd m1, m2 + movd %1, m0 + punpckhdq m0, m0 + movd %2, m0 + movd %3, m1 + punpckhdq m1, m1 + movd %4, m1 + + punpckhdq m3, m3 + punpcklbw m4, m5 + punpcklbw m6, m3 + movq m5, m4 + punpcklwd m4, m6 + punpckhwd m5, m6 + movd %5, m4 + punpckhdq m4, m4 + movd %6, m4 + movd %7, m5 + punpckhdq m5, m5 + movd %8, m5 +%endmacro + +%macro SBUTTERFLY3 4 + movq %4, %2 + punpckl%1 %2, %3 + punpckh%1 %4, %3 +%endmacro + +; in: 8 rows of 8 (only the middle 6 pels are used) in %1..%8 +; out: 6 rows of 8 in [%9+0*16] .. [%9+5*16] +%macro TRANSPOSE6x8_MEM 9 + movq m0, %1 + movq m1, %2 + movq m2, %3 + movq m3, %4 + movq m4, %5 + movq m5, %6 + movq m6, %7 + SBUTTERFLY3 bw, m0, m1, m7 + SBUTTERFLY3 bw, m2, m3, m1 + SBUTTERFLY3 bw, m4, m5, m3 + movq [%9+0x10], m1 + SBUTTERFLY3 bw, m6, %8, m5 + SBUTTERFLY3 wd, m0, m2, m1 + SBUTTERFLY3 wd, m4, m6, m2 + punpckhdq m0, m4 + movq [%9+0x00], m0 + SBUTTERFLY3 wd, m7, [%9+0x10], m6 + SBUTTERFLY3 wd, m3, m5, m4 + SBUTTERFLY3 dq, m7, m3, m0 + SBUTTERFLY3 dq, m1, m2, m5 + punpckldq m6, m4 + movq [%9+0x10], m1 + movq [%9+0x20], m5 + movq [%9+0x30], m7 + movq [%9+0x40], m0 + movq [%9+0x50], m6 +%endmacro + +; in: 8 rows of 8 in %1..%8 +; out: 8 rows of 8 in %9..%16 +%macro TRANSPOSE8x8_MEM 16 + movq m0, %1 + movq m1, %2 + movq m2, %3 + movq m3, %4 + movq m4, %5 + movq m5, %6 + movq m6, %7 + SBUTTERFLY3 bw, m0, m1, m7 + SBUTTERFLY3 bw, m2, m3, m1 + SBUTTERFLY3 bw, m4, m5, m3 + SBUTTERFLY3 bw, m6, %8, m5 + movq %9, m3 + SBUTTERFLY3 wd, m0, m2, m3 + SBUTTERFLY3 wd, m4, m6, m2 + SBUTTERFLY3 wd, m7, m1, m6 + movq %11, m2 + movq m2, %9 + SBUTTERFLY3 wd, m2, m5, m1 + SBUTTERFLY3 dq, m0, m4, m5 + SBUTTERFLY3 dq, m7, m2, m4 + movq %9, m0 + movq %10, m5 + movq %13, m7 + movq %14, m4 + SBUTTERFLY3 dq, m3, %11, m0 + SBUTTERFLY3 dq, m6, m1, m5 + movq %11, m3 + movq %12, m0 + movq %15, m6 + movq %16, m5 +%endmacro + +; out: %4 = |%1-%2|>%3 +; clobbers: %5 +%macro DIFF_GT 5 + mova %5, %2 + mova %4, %1 + psubusb %5, %1 + psubusb %4, %2 + por %4, %5 + psubusb %4, %3 +%endmacro + +; out: %4 = |%1-%2|>%3 +; clobbers: %5 +%macro DIFF_GT2 5 + mova %5, %2 + mova %4, %1 + psubusb %5, %1 + psubusb %4, %2 + psubusb %5, %3 + psubusb %4, %3 + pcmpeqb %4, %5 +%endmacro + +%macro SPLATW 1 +%ifidn m0, xmm0 + pshuflw %1, %1, 0 + punpcklqdq %1, %1 +%else + pshufw %1, %1, 0 +%endif +%endmacro + +; in: m0=p1 m1=p0 m2=q0 m3=q1 %1=alpha-1 %2=beta-1 +; out: m5=beta-1, m7=mask, %3=alpha-1 +; clobbers: m4,m6 +%macro LOAD_MASK 2-3 + movd m4, %1 + movd m5, %2 + SPLATW m4 + SPLATW m5 + packuswb m4, m4 ; 16x alpha-1 + packuswb m5, m5 ; 16x beta-1 +%if %0>2 + mova %3, m4 +%endif + DIFF_GT m1, m2, m4, m7, m6 ; |p0-q0| > alpha-1 + DIFF_GT m0, m1, m5, m4, m6 ; |p1-p0| > beta-1 + por m7, m4 + DIFF_GT m3, m2, m5, m4, m6 ; |q1-q0| > beta-1 + por m7, m4 + pxor m6, m6 + pcmpeqb m7, m6 +%endmacro + +; in: m0=p1 m1=p0 m2=q0 m3=q1 m7=(tc&mask) +; out: m1=p0' m2=q0' +; clobbers: m0,3-6 +%macro DEBLOCK_P0_Q0 0 + mova m5, m1 + pxor m5, m2 ; p0^q0 + pand m5, [pb_1] ; (p0^q0)&1 + pcmpeqb m4, m4 + pxor m3, m4 + pavgb m3, m0 ; (p1 - q1 + 256)>>1 + pavgb m3, [pb_3] ; (((p1 - q1 + 256)>>1)+4)>>1 = 64+2+(p1-q1)>>2 + pxor m4, m1 + pavgb m4, m2 ; (q0 - p0 + 256)>>1 + pavgb m3, m5 + paddusb m3, m4 ; d+128+33 + mova m6, [pb_A1] + psubusb m6, m3 + psubusb m3, [pb_A1] + pminub m6, m7 + pminub m3, m7 + psubusb m1, m6 + psubusb m2, m3 + paddusb m1, m3 + paddusb m2, m6 +%endmacro + +; in: m1=p0 m2=q0 +; %1=p1 %2=q2 %3=[q2] %4=[q1] %5=tc0 %6=tmp +; out: [q1] = clip( (q2+((p0+q0+1)>>1))>>1, q1-tc0, q1+tc0 ) +; clobbers: q2, tmp, tc0 +%macro LUMA_Q1 6 + mova %6, m1 + pavgb %6, m2 + pavgb %2, %6 ; avg(p2,avg(p0,q0)) + pxor %6, %3 + pand %6, [pb_1] ; (p2^avg(p0,q0))&1 + psubusb %2, %6 ; (p2+((p0+q0+1)>>1))>>1 + mova %6, %1 + psubusb %6, %5 + paddusb %5, %1 + pmaxub %2, %6 + pminub %2, %5 + mova %4, %2 +%endmacro + +%ifdef ARCH_X86_64 +;----------------------------------------------------------------------------- +; void x264_deblock_v_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) +;----------------------------------------------------------------------------- +INIT_XMM +cglobal x264_deblock_v_luma_sse2, 5,5,10 + movd m8, [r4] ; tc0 + lea r4, [r1*3] + dec r2d ; alpha-1 + neg r4 + dec r3d ; beta-1 + add r4, r0 ; pix-3*stride + + mova m0, [r4+r1] ; p1 + mova m1, [r4+2*r1] ; p0 + mova m2, [r0] ; q0 + mova m3, [r0+r1] ; q1 + LOAD_MASK r2d, r3d + + punpcklbw m8, m8 + punpcklbw m8, m8 ; tc = 4x tc0[3], 4x tc0[2], 4x tc0[1], 4x tc0[0] + pcmpeqb m9, m9 + pcmpeqb m9, m8 + pandn m9, m7 + pand m8, m9 + + movdqa m3, [r4] ; p2 + DIFF_GT2 m1, m3, m5, m6, m7 ; |p2-p0| > beta-1 + pand m6, m9 + mova m7, m8 + psubb m7, m6 + pand m6, m8 + LUMA_Q1 m0, m3, [r4], [r4+r1], m6, m4 + + movdqa m4, [r0+2*r1] ; q2 + DIFF_GT2 m2, m4, m5, m6, m3 ; |q2-q0| > beta-1 + pand m6, m9 + pand m8, m6 + psubb m7, m6 + mova m3, [r0+r1] + LUMA_Q1 m3, m4, [r0+2*r1], [r0+r1], m8, m6 + + DEBLOCK_P0_Q0 + mova [r4+2*r1], m1 + mova [r0], m2 + RET + +;----------------------------------------------------------------------------- +; void x264_deblock_h_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) +;----------------------------------------------------------------------------- +INIT_MMX +cglobal x264_deblock_h_luma_sse2, 5,7 + movsxd r10, r1d + lea r11, [r10+r10*2] + lea r6, [r0-4] + lea r5, [r0-4+r11] +%ifdef WIN64 + sub rsp, 0x98 + %define pix_tmp rsp+0x30 +%else + sub rsp, 0x68 + %define pix_tmp rsp +%endif + + ; transpose 6x16 -> tmp space + TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r10, r11), pix_tmp + lea r6, [r6+r10*8] + lea r5, [r5+r10*8] + TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r10, r11), pix_tmp+8 + + ; vertical filter + ; alpha, beta, tc0 are still in r2d, r3d, r4 + ; don't backup r6, r5, r10, r11 because x264_deblock_v_luma_sse2 doesn't use them + lea r0, [pix_tmp+0x30] + mov r1d, 0x10 +%ifdef WIN64 + mov [rsp+0x20], r4 +%endif + call x264_deblock_v_luma_sse2 + + ; transpose 16x4 -> original space (only the middle 4 rows were changed by the filter) + add r6, 2 + add r5, 2 + movq m0, [pix_tmp+0x18] + movq m1, [pix_tmp+0x28] + movq m2, [pix_tmp+0x38] + movq m3, [pix_tmp+0x48] + TRANSPOSE8x4_STORE PASS8ROWS(r6, r5, r10, r11) + + shl r10, 3 + sub r6, r10 + sub r5, r10 + shr r10, 3 + movq m0, [pix_tmp+0x10] + movq m1, [pix_tmp+0x20] + movq m2, [pix_tmp+0x30] + movq m3, [pix_tmp+0x40] + TRANSPOSE8x4_STORE PASS8ROWS(r6, r5, r10, r11) + +%ifdef WIN64 + add rsp, 0x98 +%else + add rsp, 0x68 +%endif + RET + +%else + +%macro DEBLOCK_LUMA 3 +;----------------------------------------------------------------------------- +; void x264_deblock_v8_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) +;----------------------------------------------------------------------------- +cglobal x264_deblock_%2_luma_%1, 5,5 + lea r4, [r1*3] + dec r2 ; alpha-1 + neg r4 + dec r3 ; beta-1 + add r4, r0 ; pix-3*stride + %assign pad 2*%3+12-(stack_offset&15) + SUB esp, pad + + mova m0, [r4+r1] ; p1 + mova m1, [r4+2*r1] ; p0 + mova m2, [r0] ; q0 + mova m3, [r0+r1] ; q1 + LOAD_MASK r2, r3 + + mov r3, r4mp + movd m4, [r3] ; tc0 + punpcklbw m4, m4 + punpcklbw m4, m4 ; tc = 4x tc0[3], 4x tc0[2], 4x tc0[1], 4x tc0[0] + mova [esp+%3], m4 ; tc + pcmpeqb m3, m3 + pcmpgtb m4, m3 + pand m4, m7 + mova [esp], m4 ; mask + + mova m3, [r4] ; p2 + DIFF_GT2 m1, m3, m5, m6, m7 ; |p2-p0| > beta-1 + pand m6, m4 + pand m4, [esp+%3] ; tc + mova m7, m4 + psubb m7, m6 + pand m6, m4 + LUMA_Q1 m0, m3, [r4], [r4+r1], m6, m4 + + mova m4, [r0+2*r1] ; q2 + DIFF_GT2 m2, m4, m5, m6, m3 ; |q2-q0| > beta-1 + mova m5, [esp] ; mask + pand m6, m5 + mova m5, [esp+%3] ; tc + pand m5, m6 + psubb m7, m6 + mova m3, [r0+r1] + LUMA_Q1 m3, m4, [r0+2*r1], [r0+r1], m5, m6 + + DEBLOCK_P0_Q0 + mova [r4+2*r1], m1 + mova [r0], m2 + ADD esp, pad + RET + +;----------------------------------------------------------------------------- +; void x264_deblock_h_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) +;----------------------------------------------------------------------------- +INIT_MMX +cglobal x264_deblock_h_luma_%1, 0,5 + mov r0, r0mp + mov r3, r1m + lea r4, [r3*3] + sub r0, 4 + lea r1, [r0+r4] + %assign pad 0x78-(stack_offset&15) + SUB esp, pad +%define pix_tmp esp+12 + + ; transpose 6x16 -> tmp space + TRANSPOSE6x8_MEM PASS8ROWS(r0, r1, r3, r4), pix_tmp + lea r0, [r0+r3*8] + lea r1, [r1+r3*8] + TRANSPOSE6x8_MEM PASS8ROWS(r0, r1, r3, r4), pix_tmp+8 + + ; vertical filter + lea r0, [pix_tmp+0x30] + PUSH dword r4m + PUSH dword r3m + PUSH dword r2m + PUSH dword 16 + PUSH dword r0 + call x264_deblock_%2_luma_%1 +%ifidn %2, v8 + add dword [esp ], 8 ; pix_tmp+0x38 + add dword [esp+16], 2 ; tc0+2 + call x264_deblock_%2_luma_%1 +%endif + ADD esp, 20 + + ; transpose 16x4 -> original space (only the middle 4 rows were changed by the filter) + mov r0, r0mp + sub r0, 2 + lea r1, [r0+r4] + + movq m0, [pix_tmp+0x10] + movq m1, [pix_tmp+0x20] + movq m2, [pix_tmp+0x30] + movq m3, [pix_tmp+0x40] + TRANSPOSE8x4_STORE PASS8ROWS(r0, r1, r3, r4) + + lea r0, [r0+r3*8] + lea r1, [r1+r3*8] + movq m0, [pix_tmp+0x18] + movq m1, [pix_tmp+0x28] + movq m2, [pix_tmp+0x38] + movq m3, [pix_tmp+0x48] + TRANSPOSE8x4_STORE PASS8ROWS(r0, r1, r3, r4) + + ADD esp, pad + RET +%endmacro ; DEBLOCK_LUMA + +INIT_MMX +DEBLOCK_LUMA mmxext, v8, 8 +INIT_XMM +DEBLOCK_LUMA sse2, v, 16 + +%endif ; ARCH + + + +%macro LUMA_INTRA_P012 4 ; p0..p3 in memory + mova t0, p2 + mova t1, p0 + pavgb t0, p1 + pavgb t1, q0 + pavgb t0, t1 ; ((p2+p1+1)/2 + (p0+q0+1)/2 + 1)/2 + mova t5, t1 + mova t2, p2 + mova t3, p0 + paddb t2, p1 + paddb t3, q0 + paddb t2, t3 + mova t3, t2 + mova t4, t2 + psrlw t2, 1 + pavgb t2, mpb_0 + pxor t2, t0 + pand t2, mpb_1 + psubb t0, t2 ; p1' = (p2+p1+p0+q0+2)/4; + + mova t1, p2 + mova t2, p2 + pavgb t1, q1 + psubb t2, q1 + paddb t3, t3 + psubb t3, t2 ; p2+2*p1+2*p0+2*q0+q1 + pand t2, mpb_1 + psubb t1, t2 + pavgb t1, p1 + pavgb t1, t5 ; (((p2+q1)/2 + p1+1)/2 + (p0+q0+1)/2 + 1)/2 + psrlw t3, 2 + pavgb t3, mpb_0 + pxor t3, t1 + pand t3, mpb_1 + psubb t1, t3 ; p0'a = (p2+2*p1+2*p0+2*q0+q1+4)/8 + + mova t3, p0 + mova t2, p0 + pxor t3, q1 + pavgb t2, q1 + pand t3, mpb_1 + psubb t2, t3 + pavgb t2, p1 ; p0'b = (2*p1+p0+q0+2)/4 + + pxor t1, t2 + pxor t2, p0 + pand t1, mask1p + pand t2, mask0 + pxor t1, t2 + pxor t1, p0 + mova %1, t1 ; store p0 + + mova t1, %4 ; p3 + mova t2, t1 + pavgb t1, p2 + paddb t2, p2 + pavgb t1, t0 ; (p3+p2+1)/2 + (p2+p1+p0+q0+2)/4 + paddb t2, t2 + paddb t2, t4 ; 2*p3+3*p2+p1+p0+q0 + psrlw t2, 2 + pavgb t2, mpb_0 + pxor t2, t1 + pand t2, mpb_1 + psubb t1, t2 ; p2' = (2*p3+3*p2+p1+p0+q0+4)/8 + + pxor t0, p1 + pxor t1, p2 + pand t0, mask1p + pand t1, mask1p + pxor t0, p1 + pxor t1, p2 + mova %2, t0 ; store p1 + mova %3, t1 ; store p2 +%endmacro + +%macro LUMA_INTRA_SWAP_PQ 0 + %define q1 m0 + %define q0 m1 + %define p0 m2 + %define p1 m3 + %define p2 q2 + %define mask1p mask1q +%endmacro + +%macro DEBLOCK_LUMA_INTRA 2 + %define p1 m0 + %define p0 m1 + %define q0 m2 + %define q1 m3 + %define t0 m4 + %define t1 m5 + %define t2 m6 + %define t3 m7 +%ifdef ARCH_X86_64 + %define p2 m8 + %define q2 m9 + %define t4 m10 + %define t5 m11 + %define mask0 m12 + %define mask1p m13 + %define mask1q [rsp-24] + %define mpb_0 m14 + %define mpb_1 m15 +%else + %define spill(x) [esp+16*x+((stack_offset+4)&15)] + %define p2 [r4+r1] + %define q2 [r0+2*r1] + %define t4 spill(0) + %define t5 spill(1) + %define mask0 spill(2) + %define mask1p spill(3) + %define mask1q spill(4) + %define mpb_0 [pb_0] + %define mpb_1 [pb_1] +%endif + +;----------------------------------------------------------------------------- +; void x264_deblock_v_luma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta ) +;----------------------------------------------------------------------------- +cglobal x264_deblock_%2_luma_intra_%1, 4,6,16 +%ifndef ARCH_X86_64 + sub esp, 0x60 +%endif + lea r4, [r1*4] + lea r5, [r1*3] ; 3*stride + dec r2d ; alpha-1 + jl .end + neg r4 + dec r3d ; beta-1 + jl .end + add r4, r0 ; pix-4*stride + mova p1, [r4+2*r1] + mova p0, [r4+r5] + mova q0, [r0] + mova q1, [r0+r1] +%ifdef ARCH_X86_64 + pxor mpb_0, mpb_0 + mova mpb_1, [pb_1] + LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0 + SWAP 7, 12 ; m12=mask0 + pavgb t5, mpb_0 + pavgb t5, mpb_1 ; alpha/4+1 + movdqa p2, [r4+r1] + movdqa q2, [r0+2*r1] + DIFF_GT2 p0, q0, t5, t0, t3 ; t0 = |p0-q0| > alpha/4+1 + DIFF_GT2 p0, p2, m5, t2, t5 ; mask1 = |p2-p0| > beta-1 + DIFF_GT2 q0, q2, m5, t4, t5 ; t4 = |q2-q0| > beta-1 + pand t0, mask0 + pand t4, t0 + pand t2, t0 + mova mask1q, t4 + mova mask1p, t2 +%else + LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0 + mova m4, t5 + mova mask0, m7 + pavgb m4, [pb_0] + pavgb m4, [pb_1] ; alpha/4+1 + DIFF_GT2 p0, q0, m4, m6, m7 ; m6 = |p0-q0| > alpha/4+1 + pand m6, mask0 + DIFF_GT2 p0, p2, m5, m4, m7 ; m4 = |p2-p0| > beta-1 + pand m4, m6 + mova mask1p, m4 + DIFF_GT2 q0, q2, m5, m4, m7 ; m4 = |q2-q0| > beta-1 + pand m4, m6 + mova mask1q, m4 +%endif + LUMA_INTRA_P012 [r4+r5], [r4+2*r1], [r4+r1], [r4] + LUMA_INTRA_SWAP_PQ + LUMA_INTRA_P012 [r0], [r0+r1], [r0+2*r1], [r0+r5] +.end: +%ifndef ARCH_X86_64 + add esp, 0x60 +%endif + RET + +INIT_MMX +%ifdef ARCH_X86_64 +;----------------------------------------------------------------------------- +; void x264_deblock_h_luma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta ) +;----------------------------------------------------------------------------- +cglobal x264_deblock_h_luma_intra_%1, 4,7 + movsxd r10, r1d + lea r11, [r10*3] + lea r6, [r0-4] + lea r5, [r0-4+r11] + sub rsp, 0x88 + %define pix_tmp rsp + + ; transpose 8x16 -> tmp space + TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30) + lea r6, [r6+r10*8] + lea r5, [r5+r10*8] + TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30) + + lea r0, [pix_tmp+0x40] + mov r1, 0x10 + call x264_deblock_v_luma_intra_%1 + + ; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8) + lea r5, [r6+r11] + TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11) + shl r10, 3 + sub r6, r10 + sub r5, r10 + shr r10, 3 + TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11) + add rsp, 0x88 + RET +%else +cglobal x264_deblock_h_luma_intra_%1, 2,4 + lea r3, [r1*3] + sub r0, 4 + lea r2, [r0+r3] +%assign pad 0x8c-(stack_offset&15) + SUB rsp, pad + %define pix_tmp rsp + + ; transpose 8x16 -> tmp space + TRANSPOSE8x8_MEM PASS8ROWS(r0, r2, r1, r3), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30) + lea r0, [r0+r1*8] + lea r2, [r2+r1*8] + TRANSPOSE8x8_MEM PASS8ROWS(r0, r2, r1, r3), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30) + + lea r0, [pix_tmp+0x40] + PUSH dword r3m + PUSH dword r2m + PUSH dword 16 + PUSH r0 + call x264_deblock_%2_luma_intra_%1 +%ifidn %2, v8 + add dword [rsp], 8 ; pix_tmp+8 + call x264_deblock_%2_luma_intra_%1 +%endif + ADD esp, 16 + + mov r1, r1m + mov r0, r0mp + lea r3, [r1*3] + sub r0, 4 + lea r2, [r0+r3] + ; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8) + TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r0, r2, r1, r3) + lea r0, [r0+r1*8] + lea r2, [r2+r1*8] + TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r0, r2, r1, r3) + ADD rsp, pad + RET +%endif ; ARCH_X86_64 +%endmacro ; DEBLOCK_LUMA_INTRA + +INIT_XMM +DEBLOCK_LUMA_INTRA sse2, v +%ifndef ARCH_X86_64 +INIT_MMX +DEBLOCK_LUMA_INTRA mmxext, v8 +%endif + + + +INIT_MMX + +%macro CHROMA_V_START 0 + dec r2d ; alpha-1 + dec r3d ; beta-1 + mov t5, r0 + sub t5, r1 + sub t5, r1 +%endmacro + +%macro CHROMA_H_START 0 + dec r2d + dec r3d + sub r0, 2 + lea t6, [r1*3] + mov t5, r0 + add r0, t6 +%endmacro + +%define t5 r5 +%define t6 r6 + +;----------------------------------------------------------------------------- +; void x264_deblock_v_chroma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) +;----------------------------------------------------------------------------- +cglobal x264_deblock_v_chroma_mmxext, 5,6 + CHROMA_V_START + movq m0, [t5] + movq m1, [t5+r1] + movq m2, [r0] + movq m3, [r0+r1] + call x264_chroma_inter_body_mmxext + movq [t5+r1], m1 + movq [r0], m2 + RET + +;----------------------------------------------------------------------------- +; void x264_deblock_h_chroma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) +;----------------------------------------------------------------------------- +cglobal x264_deblock_h_chroma_mmxext, 5,7 +%ifdef ARCH_X86_64 + %define buf0 [rsp-24] + %define buf1 [rsp-16] +%else + %define buf0 r0m + %define buf1 r2m +%endif + CHROMA_H_START + TRANSPOSE4x8_LOAD PASS8ROWS(t5, r0, r1, t6) + movq buf0, m0 + movq buf1, m3 + call x264_chroma_inter_body_mmxext + movq m0, buf0 + movq m3, buf1 + TRANSPOSE8x4_STORE PASS8ROWS(t5, r0, r1, t6) + RET + +ALIGN 16 +x264_chroma_inter_body_mmxext: + LOAD_MASK r2d, r3d + movd m6, [r4] ; tc0 + punpcklbw m6, m6 + pand m7, m6 + DEBLOCK_P0_Q0 + ret + + + +; in: %1=p0 %2=p1 %3=q1 +; out: p0 = (p0 + q1 + 2*p1 + 2) >> 2 +%macro CHROMA_INTRA_P0 3 + movq m4, %1 + pxor m4, %3 + pand m4, [pb_1] ; m4 = (p0^q1)&1 + pavgb %1, %3 + psubusb %1, m4 + pavgb %1, %2 ; dst = avg(p1, avg(p0,q1) - ((p0^q1)&1)) +%endmacro + +%define t5 r4 +%define t6 r5 + +;----------------------------------------------------------------------------- +; void x264_deblock_v_chroma_intra( uint8_t *pix, int stride, int alpha, int beta ) +;----------------------------------------------------------------------------- +cglobal x264_deblock_v_chroma_intra_mmxext, 4,5 + CHROMA_V_START + movq m0, [t5] + movq m1, [t5+r1] + movq m2, [r0] + movq m3, [r0+r1] + call x264_chroma_intra_body_mmxext + movq [t5+r1], m1 + movq [r0], m2 + RET + +;----------------------------------------------------------------------------- +; void x264_deblock_h_chroma_intra( uint8_t *pix, int stride, int alpha, int beta ) +;----------------------------------------------------------------------------- +cglobal x264_deblock_h_chroma_intra_mmxext, 4,6 + CHROMA_H_START + TRANSPOSE4x8_LOAD PASS8ROWS(t5, r0, r1, t6) + call x264_chroma_intra_body_mmxext + TRANSPOSE8x4_STORE PASS8ROWS(t5, r0, r1, t6) + RET + +ALIGN 16 +x264_chroma_intra_body_mmxext: + LOAD_MASK r2d, r3d + movq m5, m1 + movq m6, m2 + CHROMA_INTRA_P0 m1, m0, m3 + CHROMA_INTRA_P0 m2, m3, m0 + psubb m1, m5 + psubb m2, m6 + pand m1, m7 + pand m2, m7 + paddb m1, m5 + paddb m2, m6 + ret diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_deblock_sse2.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_deblock_sse2.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_deblock_sse2.asm 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_deblock_sse2.asm 1970-01-01 00:00:00.000000000 +0000 @@ -1,761 +0,0 @@ -;***************************************************************************** -;* MMX/SSE2-optimized H.264 deblocking code -;***************************************************************************** -;* Copyright (C) 2005-2008 x264 project -;* -;* Authors: Loren Merritt -;* -;* This file is part of FFmpeg. -;* -;* FFmpeg is free software; you can redistribute it and/or -;* modify it under the terms of the GNU Lesser General Public -;* License as published by the Free Software Foundation; either -;* version 2.1 of the License, or (at your option) any later version. -;* -;* FFmpeg is distributed in the hope that it will be useful, -;* but WITHOUT ANY WARRANTY; without even the implied warranty of -;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;* Lesser General Public License for more details. -;* -;* You should have received a copy of the GNU Lesser General Public -;* License along with FFmpeg; if not, write to the Free Software -;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -;****************************************************************************** - -%include "x86inc.asm" - -SECTION_RODATA -pb_00: times 16 db 0x00 -pb_01: times 16 db 0x01 -pb_03: times 16 db 0x03 -pb_a1: times 16 db 0xa1 - -SECTION .text - -; expands to [base],...,[base+7*stride] -%define PASS8ROWS(base, base3, stride, stride3) \ - [base], [base+stride], [base+stride*2], [base3], \ - [base3+stride], [base3+stride*2], [base3+stride3], [base3+stride*4] - -; in: 8 rows of 4 bytes in %1..%8 -; out: 4 rows of 8 bytes in m0..m3 -%macro TRANSPOSE4x8_LOAD 8 - movd m0, %1 - movd m2, %2 - movd m1, %3 - movd m3, %4 - punpcklbw m0, m2 - punpcklbw m1, m3 - movq m2, m0 - punpcklwd m0, m1 - punpckhwd m2, m1 - - movd m4, %5 - movd m6, %6 - movd m5, %7 - movd m7, %8 - punpcklbw m4, m6 - punpcklbw m5, m7 - movq m6, m4 - punpcklwd m4, m5 - punpckhwd m6, m5 - - movq m1, m0 - movq m3, m2 - punpckldq m0, m4 - punpckhdq m1, m4 - punpckldq m2, m6 - punpckhdq m3, m6 -%endmacro - -; in: 4 rows of 8 bytes in m0..m3 -; out: 8 rows of 4 bytes in %1..%8 -%macro TRANSPOSE8x4_STORE 8 - movq m4, m0 - movq m5, m1 - movq m6, m2 - punpckhdq m4, m4 - punpckhdq m5, m5 - punpckhdq m6, m6 - - punpcklbw m0, m1 - punpcklbw m2, m3 - movq m1, m0 - punpcklwd m0, m2 - punpckhwd m1, m2 - movd %1, m0 - punpckhdq m0, m0 - movd %2, m0 - movd %3, m1 - punpckhdq m1, m1 - movd %4, m1 - - punpckhdq m3, m3 - punpcklbw m4, m5 - punpcklbw m6, m3 - movq m5, m4 - punpcklwd m4, m6 - punpckhwd m5, m6 - movd %5, m4 - punpckhdq m4, m4 - movd %6, m4 - movd %7, m5 - punpckhdq m5, m5 - movd %8, m5 -%endmacro - -%macro SBUTTERFLY 4 - movq %4, %2 - punpckl%1 %2, %3 - punpckh%1 %4, %3 -%endmacro - -; in: 8 rows of 8 (only the middle 6 pels are used) in %1..%8 -; out: 6 rows of 8 in [%9+0*16] .. [%9+5*16] -%macro TRANSPOSE6x8_MEM 9 - movq m0, %1 - movq m1, %2 - movq m2, %3 - movq m3, %4 - movq m4, %5 - movq m5, %6 - movq m6, %7 - SBUTTERFLY bw, m0, m1, m7 - SBUTTERFLY bw, m2, m3, m1 - SBUTTERFLY bw, m4, m5, m3 - movq [%9+0x10], m1 - SBUTTERFLY bw, m6, %8, m5 - SBUTTERFLY wd, m0, m2, m1 - SBUTTERFLY wd, m4, m6, m2 - punpckhdq m0, m4 - movq [%9+0x00], m0 - SBUTTERFLY wd, m7, [%9+0x10], m6 - SBUTTERFLY wd, m3, m5, m4 - SBUTTERFLY dq, m7, m3, m0 - SBUTTERFLY dq, m1, m2, m5 - punpckldq m6, m4 - movq [%9+0x10], m1 - movq [%9+0x20], m5 - movq [%9+0x30], m7 - movq [%9+0x40], m0 - movq [%9+0x50], m6 -%endmacro - -; in: 8 rows of 8 in %1..%8 -; out: 8 rows of 8 in %9..%16 -%macro TRANSPOSE8x8_MEM 16 - movq m0, %1 - movq m1, %2 - movq m2, %3 - movq m3, %4 - movq m4, %5 - movq m5, %6 - movq m6, %7 - SBUTTERFLY bw, m0, m1, m7 - SBUTTERFLY bw, m2, m3, m1 - SBUTTERFLY bw, m4, m5, m3 - SBUTTERFLY bw, m6, %8, m5 - movq %9, m3 - SBUTTERFLY wd, m0, m2, m3 - SBUTTERFLY wd, m4, m6, m2 - SBUTTERFLY wd, m7, m1, m6 - movq %11, m2 - movq m2, %9 - SBUTTERFLY wd, m2, m5, m1 - SBUTTERFLY dq, m0, m4, m5 - SBUTTERFLY dq, m7, m2, m4 - movq %9, m0 - movq %10, m5 - movq %13, m7 - movq %14, m4 - SBUTTERFLY dq, m3, %11, m0 - SBUTTERFLY dq, m6, m1, m5 - movq %11, m3 - movq %12, m0 - movq %15, m6 - movq %16, m5 -%endmacro - -; out: %4 = |%1-%2|>%3 -; clobbers: %5 -%macro DIFF_GT 5 - mova %5, %2 - mova %4, %1 - psubusb %5, %1 - psubusb %4, %2 - por %4, %5 - psubusb %4, %3 -%endmacro - -; out: %4 = |%1-%2|>%3 -; clobbers: %5 -%macro DIFF_GT2 5 - mova %5, %2 - mova %4, %1 - psubusb %5, %1 - psubusb %4, %2 - psubusb %5, %3 - psubusb %4, %3 - pcmpeqb %4, %5 -%endmacro - -%macro SPLATW 1 -%ifidn m0, xmm0 - pshuflw %1, %1, 0 - punpcklqdq %1, %1 -%else - pshufw %1, %1, 0 -%endif -%endmacro - -; in: m0=p1 m1=p0 m2=q0 m3=q1 %1=alpha-1 %2=beta-1 -; out: m5=beta-1, m7=mask, %3=alpha-1 -; clobbers: m4,m6 -%macro LOAD_MASK 2-3 - movd m4, %1 - movd m5, %2 - SPLATW m4 - SPLATW m5 - packuswb m4, m4 ; 16x alpha-1 - packuswb m5, m5 ; 16x beta-1 -%if %0>2 - mova %3, m4 -%endif - DIFF_GT m1, m2, m4, m7, m6 ; |p0-q0| > alpha-1 - DIFF_GT m0, m1, m5, m4, m6 ; |p1-p0| > beta-1 - por m7, m4 - DIFF_GT m3, m2, m5, m4, m6 ; |q1-q0| > beta-1 - por m7, m4 - pxor m6, m6 - pcmpeqb m7, m6 -%endmacro - -; in: m0=p1 m1=p0 m2=q0 m3=q1 m7=(tc&mask) -; out: m1=p0' m2=q0' -; clobbers: m0,3-6 -%macro DEBLOCK_P0_Q0 0 - mova m5, m1 - pxor m5, m2 ; p0^q0 - pand m5, [pb_01] ; (p0^q0)&1 - pcmpeqb m4, m4 - pxor m3, m4 - pavgb m3, m0 ; (p1 - q1 + 256)>>1 - pavgb m3, [pb_03] ; (((p1 - q1 + 256)>>1)+4)>>1 = 64+2+(p1-q1)>>2 - pxor m4, m1 - pavgb m4, m2 ; (q0 - p0 + 256)>>1 - pavgb m3, m5 - paddusb m3, m4 ; d+128+33 - mova m6, [pb_a1] - psubusb m6, m3 - psubusb m3, [pb_a1] - pminub m6, m7 - pminub m3, m7 - psubusb m1, m6 - psubusb m2, m3 - paddusb m1, m3 - paddusb m2, m6 -%endmacro - -; in: m1=p0 m2=q0 -; %1=p1 %2=q2 %3=[q2] %4=[q1] %5=tc0 %6=tmp -; out: [q1] = clip( (q2+((p0+q0+1)>>1))>>1, q1-tc0, q1+tc0 ) -; clobbers: q2, tmp, tc0 -%macro LUMA_Q1 6 - mova %6, m1 - pavgb %6, m2 - pavgb %2, %6 ; avg(p2,avg(p0,q0)) - pxor %6, %3 - pand %6, [pb_01] ; (p2^avg(p0,q0))&1 - psubusb %2, %6 ; (p2+((p0+q0+1)>>1))>>1 - mova %6, %1 - psubusb %6, %5 - paddusb %5, %1 - pmaxub %2, %6 - pminub %2, %5 - mova %4, %2 -%endmacro - -%ifdef ARCH_X86_64 -;----------------------------------------------------------------------------- -; void x264_deblock_v_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) -;----------------------------------------------------------------------------- -INIT_XMM -cglobal x264_deblock_v_luma_sse2, 5,5,10 - movd m8, [r4] ; tc0 - lea r4, [r1*3] - dec r2d ; alpha-1 - neg r4 - dec r3d ; beta-1 - add r4, r0 ; pix-3*stride - - mova m0, [r4+r1] ; p1 - mova m1, [r4+2*r1] ; p0 - mova m2, [r0] ; q0 - mova m3, [r0+r1] ; q1 - LOAD_MASK r2d, r3d - - punpcklbw m8, m8 - punpcklbw m8, m8 ; tc = 4x tc0[3], 4x tc0[2], 4x tc0[1], 4x tc0[0] - pcmpeqb m9, m9 - pcmpeqb m9, m8 - pandn m9, m7 - pand m8, m9 - - movdqa m3, [r4] ; p2 - DIFF_GT2 m1, m3, m5, m6, m7 ; |p2-p0| > beta-1 - pand m6, m9 - mova m7, m8 - psubb m7, m6 - pand m6, m8 - LUMA_Q1 m0, m3, [r4], [r4+r1], m6, m4 - - movdqa m4, [r0+2*r1] ; q2 - DIFF_GT2 m2, m4, m5, m6, m3 ; |q2-q0| > beta-1 - pand m6, m9 - pand m8, m6 - psubb m7, m6 - mova m3, [r0+r1] - LUMA_Q1 m3, m4, [r0+2*r1], [r0+r1], m8, m6 - - DEBLOCK_P0_Q0 - mova [r4+2*r1], m1 - mova [r0], m2 - RET - -;----------------------------------------------------------------------------- -; void x264_deblock_h_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) -;----------------------------------------------------------------------------- -INIT_MMX -cglobal x264_deblock_h_luma_sse2, 5,7 - movsxd r10, r1d - lea r11, [r10+r10*2] - lea r6, [r0-4] - lea r5, [r0-4+r11] -%ifdef WIN64 - sub rsp, 0x98 - %define pix_tmp rsp+0x30 -%else - sub rsp, 0x68 - %define pix_tmp rsp -%endif - - ; transpose 6x16 -> tmp space - TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r10, r11), pix_tmp - lea r6, [r6+r10*8] - lea r5, [r5+r10*8] - TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r10, r11), pix_tmp+8 - - ; vertical filter - ; alpha, beta, tc0 are still in r2d, r3d, r4 - ; don't backup r6, r5, r10, r11 because x264_deblock_v_luma_sse2 doesn't use them - lea r0, [pix_tmp+0x30] - mov r1d, 0x10 -%ifdef WIN64 - mov [rsp+0x20], r4 -%endif - call x264_deblock_v_luma_sse2 - - ; transpose 16x4 -> original space (only the middle 4 rows were changed by the filter) - add r6, 2 - add r5, 2 - movq m0, [pix_tmp+0x18] - movq m1, [pix_tmp+0x28] - movq m2, [pix_tmp+0x38] - movq m3, [pix_tmp+0x48] - TRANSPOSE8x4_STORE PASS8ROWS(r6, r5, r10, r11) - - shl r10, 3 - sub r6, r10 - sub r5, r10 - shr r10, 3 - movq m0, [pix_tmp+0x10] - movq m1, [pix_tmp+0x20] - movq m2, [pix_tmp+0x30] - movq m3, [pix_tmp+0x40] - TRANSPOSE8x4_STORE PASS8ROWS(r6, r5, r10, r11) - -%ifdef WIN64 - add rsp, 0x98 -%else - add rsp, 0x68 -%endif - RET - -%else - -%macro DEBLOCK_LUMA 3 -;----------------------------------------------------------------------------- -; void x264_deblock_v8_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) -;----------------------------------------------------------------------------- -cglobal x264_deblock_%2_luma_%1, 5,5 - lea r4, [r1*3] - dec r2 ; alpha-1 - neg r4 - dec r3 ; beta-1 - add r4, r0 ; pix-3*stride - %assign pad 2*%3+12-(stack_offset&15) - SUB esp, pad - - mova m0, [r4+r1] ; p1 - mova m1, [r4+2*r1] ; p0 - mova m2, [r0] ; q0 - mova m3, [r0+r1] ; q1 - LOAD_MASK r2, r3 - - mov r3, r4mp - movd m4, [r3] ; tc0 - punpcklbw m4, m4 - punpcklbw m4, m4 ; tc = 4x tc0[3], 4x tc0[2], 4x tc0[1], 4x tc0[0] - mova [esp+%3], m4 ; tc - pcmpeqb m3, m3 - pcmpgtb m4, m3 - pand m4, m7 - mova [esp], m4 ; mask - - mova m3, [r4] ; p2 - DIFF_GT2 m1, m3, m5, m6, m7 ; |p2-p0| > beta-1 - pand m6, m4 - pand m4, [esp+%3] ; tc - mova m7, m4 - psubb m7, m6 - pand m6, m4 - LUMA_Q1 m0, m3, [r4], [r4+r1], m6, m4 - - mova m4, [r0+2*r1] ; q2 - DIFF_GT2 m2, m4, m5, m6, m3 ; |q2-q0| > beta-1 - mova m5, [esp] ; mask - pand m6, m5 - mova m5, [esp+%3] ; tc - pand m5, m6 - psubb m7, m6 - mova m3, [r0+r1] - LUMA_Q1 m3, m4, [r0+2*r1], [r0+r1], m5, m6 - - DEBLOCK_P0_Q0 - mova [r4+2*r1], m1 - mova [r0], m2 - ADD esp, pad - RET - -;----------------------------------------------------------------------------- -; void x264_deblock_h_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 ) -;----------------------------------------------------------------------------- -INIT_MMX -cglobal x264_deblock_h_luma_%1, 0,5 - mov r0, r0mp - mov r3, r1m - lea r4, [r3*3] - sub r0, 4 - lea r1, [r0+r4] - %assign pad 0x78-(stack_offset&15) - SUB esp, pad -%define pix_tmp esp+12 - - ; transpose 6x16 -> tmp space - TRANSPOSE6x8_MEM PASS8ROWS(r0, r1, r3, r4), pix_tmp - lea r0, [r0+r3*8] - lea r1, [r1+r3*8] - TRANSPOSE6x8_MEM PASS8ROWS(r0, r1, r3, r4), pix_tmp+8 - - ; vertical filter - lea r0, [pix_tmp+0x30] - PUSH dword r4m - PUSH dword r3m - PUSH dword r2m - PUSH dword 16 - PUSH dword r0 - call x264_deblock_%2_luma_%1 -%ifidn %2, v8 - add dword [esp ], 8 ; pix_tmp+0x38 - add dword [esp+16], 2 ; tc0+2 - call x264_deblock_%2_luma_%1 -%endif - ADD esp, 20 - - ; transpose 16x4 -> original space (only the middle 4 rows were changed by the filter) - mov r0, r0mp - sub r0, 2 - lea r1, [r0+r4] - - movq m0, [pix_tmp+0x10] - movq m1, [pix_tmp+0x20] - movq m2, [pix_tmp+0x30] - movq m3, [pix_tmp+0x40] - TRANSPOSE8x4_STORE PASS8ROWS(r0, r1, r3, r4) - - lea r0, [r0+r3*8] - lea r1, [r1+r3*8] - movq m0, [pix_tmp+0x18] - movq m1, [pix_tmp+0x28] - movq m2, [pix_tmp+0x38] - movq m3, [pix_tmp+0x48] - TRANSPOSE8x4_STORE PASS8ROWS(r0, r1, r3, r4) - - ADD esp, pad - RET -%endmacro ; DEBLOCK_LUMA - -INIT_XMM -DEBLOCK_LUMA sse2, v, 16 - -%endif ; ARCH - - - -%macro LUMA_INTRA_P012 4 ; p0..p3 in memory - mova t0, p2 - mova t1, p0 - pavgb t0, p1 - pavgb t1, q0 - pavgb t0, t1 ; ((p2+p1+1)/2 + (p0+q0+1)/2 + 1)/2 - mova t5, t1 - mova t2, p2 - mova t3, p0 - paddb t2, p1 - paddb t3, q0 - paddb t2, t3 - mova t3, t2 - mova t4, t2 - psrlw t2, 1 - pavgb t2, mpb_00 - pxor t2, t0 - pand t2, mpb_01 - psubb t0, t2 ; p1' = (p2+p1+p0+q0+2)/4; - - mova t1, p2 - mova t2, p2 - pavgb t1, q1 - psubb t2, q1 - paddb t3, t3 - psubb t3, t2 ; p2+2*p1+2*p0+2*q0+q1 - pand t2, mpb_01 - psubb t1, t2 - pavgb t1, p1 - pavgb t1, t5 ; (((p2+q1)/2 + p1+1)/2 + (p0+q0+1)/2 + 1)/2 - psrlw t3, 2 - pavgb t3, mpb_00 - pxor t3, t1 - pand t3, mpb_01 - psubb t1, t3 ; p0'a = (p2+2*p1+2*p0+2*q0+q1+4)/8 - - mova t3, p0 - mova t2, p0 - pxor t3, q1 - pavgb t2, q1 - pand t3, mpb_01 - psubb t2, t3 - pavgb t2, p1 ; p0'b = (2*p1+p0+q0+2)/4 - - pxor t1, t2 - pxor t2, p0 - pand t1, mask1p - pand t2, mask0 - pxor t1, t2 - pxor t1, p0 - mova %1, t1 ; store p0 - - mova t1, %4 ; p3 - mova t2, t1 - pavgb t1, p2 - paddb t2, p2 - pavgb t1, t0 ; (p3+p2+1)/2 + (p2+p1+p0+q0+2)/4 - paddb t2, t2 - paddb t2, t4 ; 2*p3+3*p2+p1+p0+q0 - psrlw t2, 2 - pavgb t2, mpb_00 - pxor t2, t1 - pand t2, mpb_01 - psubb t1, t2 ; p2' = (2*p3+3*p2+p1+p0+q0+4)/8 - - pxor t0, p1 - pxor t1, p2 - pand t0, mask1p - pand t1, mask1p - pxor t0, p1 - pxor t1, p2 - mova %2, t0 ; store p1 - mova %3, t1 ; store p2 -%endmacro - -%macro LUMA_INTRA_SWAP_PQ 0 - %define q1 m0 - %define q0 m1 - %define p0 m2 - %define p1 m3 - %define p2 q2 - %define mask1p mask1q -%endmacro - -%macro DEBLOCK_LUMA_INTRA 2 - %define p1 m0 - %define p0 m1 - %define q0 m2 - %define q1 m3 - %define t0 m4 - %define t1 m5 - %define t2 m6 - %define t3 m7 -%ifdef ARCH_X86_64 - %define p2 m8 - %define q2 m9 - %define t4 m10 - %define t5 m11 - %define mask0 m12 - %define mask1p m13 - %define mask1q [rsp-24] - %define mpb_00 m14 - %define mpb_01 m15 -%else - %define spill(x) [esp+16*x+((stack_offset+4)&15)] - %define p2 [r4+r1] - %define q2 [r0+2*r1] - %define t4 spill(0) - %define t5 spill(1) - %define mask0 spill(2) - %define mask1p spill(3) - %define mask1q spill(4) - %define mpb_00 [pb_00] - %define mpb_01 [pb_01] -%endif - -;----------------------------------------------------------------------------- -; void x264_deblock_v_luma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta ) -;----------------------------------------------------------------------------- -cglobal x264_deblock_%2_luma_intra_%1, 4,6,16 -%ifndef ARCH_X86_64 - sub esp, 0x60 -%endif - lea r4, [r1*4] - lea r5, [r1*3] ; 3*stride - dec r2d ; alpha-1 - jl .end - neg r4 - dec r3d ; beta-1 - jl .end - add r4, r0 ; pix-4*stride - mova p1, [r4+2*r1] - mova p0, [r4+r5] - mova q0, [r0] - mova q1, [r0+r1] -%ifdef ARCH_X86_64 - pxor mpb_00, mpb_00 - mova mpb_01, [pb_01] - LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0 - SWAP 7, 12 ; m12=mask0 - pavgb t5, mpb_00 - pavgb t5, mpb_01 ; alpha/4+1 - movdqa p2, [r4+r1] - movdqa q2, [r0+2*r1] - DIFF_GT2 p0, q0, t5, t0, t3 ; t0 = |p0-q0| > alpha/4+1 - DIFF_GT2 p0, p2, m5, t2, t5 ; mask1 = |p2-p0| > beta-1 - DIFF_GT2 q0, q2, m5, t4, t5 ; t4 = |q2-q0| > beta-1 - pand t0, mask0 - pand t4, t0 - pand t2, t0 - mova mask1q, t4 - mova mask1p, t2 -%else - LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0 - mova m4, t5 - mova mask0, m7 - pavgb m4, [pb_00] - pavgb m4, [pb_01] ; alpha/4+1 - DIFF_GT2 p0, q0, m4, m6, m7 ; m6 = |p0-q0| > alpha/4+1 - pand m6, mask0 - DIFF_GT2 p0, p2, m5, m4, m7 ; m4 = |p2-p0| > beta-1 - pand m4, m6 - mova mask1p, m4 - DIFF_GT2 q0, q2, m5, m4, m7 ; m4 = |q2-q0| > beta-1 - pand m4, m6 - mova mask1q, m4 -%endif - LUMA_INTRA_P012 [r4+r5], [r4+2*r1], [r4+r1], [r4] - LUMA_INTRA_SWAP_PQ - LUMA_INTRA_P012 [r0], [r0+r1], [r0+2*r1], [r0+r5] -.end: -%ifndef ARCH_X86_64 - add esp, 0x60 -%endif - RET - -INIT_MMX -%ifdef ARCH_X86_64 -;----------------------------------------------------------------------------- -; void x264_deblock_h_luma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta ) -;----------------------------------------------------------------------------- -cglobal x264_deblock_h_luma_intra_%1, 4,7 - movsxd r10, r1d - lea r11, [r10*3] - lea r6, [r0-4] - lea r5, [r0-4+r11] - sub rsp, 0x88 - %define pix_tmp rsp - - ; transpose 8x16 -> tmp space - TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30) - lea r6, [r6+r10*8] - lea r5, [r5+r10*8] - TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30) - - lea r0, [pix_tmp+0x40] - mov r1, 0x10 - call x264_deblock_v_luma_intra_%1 - - ; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8) - lea r5, [r6+r11] - TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11) - shl r10, 3 - sub r6, r10 - sub r5, r10 - shr r10, 3 - TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11) - add rsp, 0x88 - RET -%else -cglobal x264_deblock_h_luma_intra_%1, 2,4 - lea r3, [r1*3] - sub r0, 4 - lea r2, [r0+r3] -%assign pad 0x8c-(stack_offset&15) - SUB rsp, pad - %define pix_tmp rsp - - ; transpose 8x16 -> tmp space - TRANSPOSE8x8_MEM PASS8ROWS(r0, r2, r1, r3), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30) - lea r0, [r0+r1*8] - lea r2, [r2+r1*8] - TRANSPOSE8x8_MEM PASS8ROWS(r0, r2, r1, r3), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30) - - lea r0, [pix_tmp+0x40] - PUSH dword r3m - PUSH dword r2m - PUSH dword 16 - PUSH r0 - call x264_deblock_%2_luma_intra_%1 -%ifidn %2, v8 - add dword [rsp], 8 ; pix_tmp+8 - call x264_deblock_%2_luma_intra_%1 -%endif - ADD esp, 16 - - mov r1, r1m - mov r0, r0mp - lea r3, [r1*3] - sub r0, 4 - lea r2, [r0+r3] - ; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8) - TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r0, r2, r1, r3) - lea r0, [r0+r1*8] - lea r2, [r2+r1*8] - TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r0, r2, r1, r3) - ADD rsp, pad - RET -%endif ; ARCH_X86_64 -%endmacro ; DEBLOCK_LUMA_INTRA - -INIT_XMM -DEBLOCK_LUMA_INTRA sse2, v -%ifndef ARCH_X86_64 -INIT_MMX -DEBLOCK_LUMA_INTRA mmxext, v8 -%endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264dsp_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264dsp_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264dsp_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264dsp_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -18,784 +18,167 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" +#include "libavutil/x86_cpu.h" +#include "libavcodec/h264dsp.h" #include "dsputil_mmx.h" -#include "libavcodec/h264pred.h" DECLARE_ALIGNED(8, static const uint64_t, ff_pb_3_1 ) = 0x0103010301030103ULL; -DECLARE_ALIGNED(8, static const uint64_t, ff_pb_7_3 ) = 0x0307030703070307ULL; /***********************************/ /* IDCT */ -#define SUMSUB_BADC( a, b, c, d ) \ - "paddw "#b", "#a" \n\t"\ - "paddw "#d", "#c" \n\t"\ - "paddw "#b", "#b" \n\t"\ - "paddw "#d", "#d" \n\t"\ - "psubw "#a", "#b" \n\t"\ - "psubw "#c", "#d" \n\t" - -#define SUMSUBD2_AB( a, b, t ) \ - "movq "#b", "#t" \n\t"\ - "psraw $1 , "#b" \n\t"\ - "paddw "#a", "#b" \n\t"\ - "psraw $1 , "#a" \n\t"\ - "psubw "#t", "#a" \n\t" - -#define IDCT4_1D( s02, s13, d02, d13, t ) \ - SUMSUB_BA ( s02, d02 )\ - SUMSUBD2_AB( s13, d13, t )\ - SUMSUB_BADC( d13, s02, s13, d02 ) - -#define STORE_DIFF_4P( p, t, z ) \ - "psraw $6, "#p" \n\t"\ - "movd (%0), "#t" \n\t"\ - "punpcklbw "#z", "#t" \n\t"\ - "paddsw "#t", "#p" \n\t"\ - "packuswb "#z", "#p" \n\t"\ - "movd "#p", (%0) \n\t" - -static void ff_h264_idct_add_mmx(uint8_t *dst, int16_t *block, int stride) -{ - /* Load dct coeffs */ - __asm__ volatile( - "movq (%0), %%mm0 \n\t" - "movq 8(%0), %%mm1 \n\t" - "movq 16(%0), %%mm2 \n\t" - "movq 24(%0), %%mm3 \n\t" - :: "r"(block) ); - - __asm__ volatile( - /* mm1=s02+s13 mm2=s02-s13 mm4=d02+d13 mm0=d02-d13 */ - IDCT4_1D( %%mm2, %%mm1, %%mm0, %%mm3, %%mm4 ) - - "movq %0, %%mm6 \n\t" - /* in: 1,4,0,2 out: 1,2,3,0 */ - TRANSPOSE4( %%mm3, %%mm1, %%mm0, %%mm2, %%mm4 ) - - "paddw %%mm6, %%mm3 \n\t" - - /* mm2=s02+s13 mm3=s02-s13 mm4=d02+d13 mm1=d02-d13 */ - IDCT4_1D( %%mm4, %%mm2, %%mm3, %%mm0, %%mm1 ) - - "pxor %%mm7, %%mm7 \n\t" - :: "m"(ff_pw_32)); - - __asm__ volatile( - STORE_DIFF_4P( %%mm0, %%mm1, %%mm7) - "add %1, %0 \n\t" - STORE_DIFF_4P( %%mm2, %%mm1, %%mm7) - "add %1, %0 \n\t" - STORE_DIFF_4P( %%mm3, %%mm1, %%mm7) - "add %1, %0 \n\t" - STORE_DIFF_4P( %%mm4, %%mm1, %%mm7) - : "+r"(dst) - : "r" ((x86_reg)stride) - ); -} - -static inline void h264_idct8_1d(int16_t *block) -{ - __asm__ volatile( - "movq 112(%0), %%mm7 \n\t" - "movq 80(%0), %%mm0 \n\t" - "movq 48(%0), %%mm3 \n\t" - "movq 16(%0), %%mm5 \n\t" - - "movq %%mm0, %%mm4 \n\t" - "movq %%mm5, %%mm1 \n\t" - "psraw $1, %%mm4 \n\t" - "psraw $1, %%mm1 \n\t" - "paddw %%mm0, %%mm4 \n\t" - "paddw %%mm5, %%mm1 \n\t" - "paddw %%mm7, %%mm4 \n\t" - "paddw %%mm0, %%mm1 \n\t" - "psubw %%mm5, %%mm4 \n\t" - "paddw %%mm3, %%mm1 \n\t" - - "psubw %%mm3, %%mm5 \n\t" - "psubw %%mm3, %%mm0 \n\t" - "paddw %%mm7, %%mm5 \n\t" - "psubw %%mm7, %%mm0 \n\t" - "psraw $1, %%mm3 \n\t" - "psraw $1, %%mm7 \n\t" - "psubw %%mm3, %%mm5 \n\t" - "psubw %%mm7, %%mm0 \n\t" - - "movq %%mm4, %%mm3 \n\t" - "movq %%mm1, %%mm7 \n\t" - "psraw $2, %%mm1 \n\t" - "psraw $2, %%mm3 \n\t" - "paddw %%mm5, %%mm3 \n\t" - "psraw $2, %%mm5 \n\t" - "paddw %%mm0, %%mm1 \n\t" - "psraw $2, %%mm0 \n\t" - "psubw %%mm4, %%mm5 \n\t" - "psubw %%mm0, %%mm7 \n\t" - - "movq 32(%0), %%mm2 \n\t" - "movq 96(%0), %%mm6 \n\t" - "movq %%mm2, %%mm4 \n\t" - "movq %%mm6, %%mm0 \n\t" - "psraw $1, %%mm4 \n\t" - "psraw $1, %%mm6 \n\t" - "psubw %%mm0, %%mm4 \n\t" - "paddw %%mm2, %%mm6 \n\t" - - "movq (%0), %%mm2 \n\t" - "movq 64(%0), %%mm0 \n\t" - SUMSUB_BA( %%mm0, %%mm2 ) - SUMSUB_BA( %%mm6, %%mm0 ) - SUMSUB_BA( %%mm4, %%mm2 ) - SUMSUB_BA( %%mm7, %%mm6 ) - SUMSUB_BA( %%mm5, %%mm4 ) - SUMSUB_BA( %%mm3, %%mm2 ) - SUMSUB_BA( %%mm1, %%mm0 ) - :: "r"(block) - ); -} - -static void ff_h264_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride) -{ - int i; - DECLARE_ALIGNED(8, int16_t, b2)[64]; - - block[0] += 32; - - for(i=0; i<2; i++){ - DECLARE_ALIGNED(8, uint64_t, tmp); - - h264_idct8_1d(block+4*i); - - __asm__ volatile( - "movq %%mm7, %0 \n\t" - TRANSPOSE4( %%mm0, %%mm2, %%mm4, %%mm6, %%mm7 ) - "movq %%mm0, 8(%1) \n\t" - "movq %%mm6, 24(%1) \n\t" - "movq %%mm7, 40(%1) \n\t" - "movq %%mm4, 56(%1) \n\t" - "movq %0, %%mm7 \n\t" - TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 ) - "movq %%mm7, (%1) \n\t" - "movq %%mm1, 16(%1) \n\t" - "movq %%mm0, 32(%1) \n\t" - "movq %%mm3, 48(%1) \n\t" - : "=m"(tmp) - : "r"(b2+32*i) - : "memory" - ); - } - - for(i=0; i<2; i++){ - h264_idct8_1d(b2+4*i); - - __asm__ volatile( - "psraw $6, %%mm7 \n\t" - "psraw $6, %%mm6 \n\t" - "psraw $6, %%mm5 \n\t" - "psraw $6, %%mm4 \n\t" - "psraw $6, %%mm3 \n\t" - "psraw $6, %%mm2 \n\t" - "psraw $6, %%mm1 \n\t" - "psraw $6, %%mm0 \n\t" - - "movq %%mm7, (%0) \n\t" - "movq %%mm5, 16(%0) \n\t" - "movq %%mm3, 32(%0) \n\t" - "movq %%mm1, 48(%0) \n\t" - "movq %%mm0, 64(%0) \n\t" - "movq %%mm2, 80(%0) \n\t" - "movq %%mm4, 96(%0) \n\t" - "movq %%mm6, 112(%0) \n\t" - :: "r"(b2+4*i) - : "memory" - ); - } - - add_pixels_clamped_mmx(b2, dst, stride); -} - -#define STORE_DIFF_8P( p, d, t, z )\ - "movq "#d", "#t" \n"\ - "psraw $6, "#p" \n"\ - "punpcklbw "#z", "#t" \n"\ - "paddsw "#t", "#p" \n"\ - "packuswb "#p", "#p" \n"\ - "movq "#p", "#d" \n" - -#define H264_IDCT8_1D_SSE2(a,b,c,d,e,f,g,h)\ - "movdqa "#c", "#a" \n"\ - "movdqa "#g", "#e" \n"\ - "psraw $1, "#c" \n"\ - "psraw $1, "#g" \n"\ - "psubw "#e", "#c" \n"\ - "paddw "#a", "#g" \n"\ - "movdqa "#b", "#e" \n"\ - "psraw $1, "#e" \n"\ - "paddw "#b", "#e" \n"\ - "paddw "#d", "#e" \n"\ - "paddw "#f", "#e" \n"\ - "movdqa "#f", "#a" \n"\ - "psraw $1, "#a" \n"\ - "paddw "#f", "#a" \n"\ - "paddw "#h", "#a" \n"\ - "psubw "#b", "#a" \n"\ - "psubw "#d", "#b" \n"\ - "psubw "#d", "#f" \n"\ - "paddw "#h", "#b" \n"\ - "psubw "#h", "#f" \n"\ - "psraw $1, "#d" \n"\ - "psraw $1, "#h" \n"\ - "psubw "#d", "#b" \n"\ - "psubw "#h", "#f" \n"\ - "movdqa "#e", "#d" \n"\ - "movdqa "#a", "#h" \n"\ - "psraw $2, "#d" \n"\ - "psraw $2, "#h" \n"\ - "paddw "#f", "#d" \n"\ - "paddw "#b", "#h" \n"\ - "psraw $2, "#f" \n"\ - "psraw $2, "#b" \n"\ - "psubw "#f", "#e" \n"\ - "psubw "#a", "#b" \n"\ - "movdqa 0x00(%1), "#a" \n"\ - "movdqa 0x40(%1), "#f" \n"\ - SUMSUB_BA(f, a)\ - SUMSUB_BA(g, f)\ - SUMSUB_BA(c, a)\ - SUMSUB_BA(e, g)\ - SUMSUB_BA(b, c)\ - SUMSUB_BA(h, a)\ - SUMSUB_BA(d, f) - -static void ff_h264_idct8_add_sse2(uint8_t *dst, int16_t *block, int stride) -{ - __asm__ volatile( - "movdqa 0x10(%1), %%xmm1 \n" - "movdqa 0x20(%1), %%xmm2 \n" - "movdqa 0x30(%1), %%xmm3 \n" - "movdqa 0x50(%1), %%xmm5 \n" - "movdqa 0x60(%1), %%xmm6 \n" - "movdqa 0x70(%1), %%xmm7 \n" - H264_IDCT8_1D_SSE2(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7) - TRANSPOSE8(%%xmm4, %%xmm1, %%xmm7, %%xmm3, %%xmm5, %%xmm0, %%xmm2, %%xmm6, (%1)) - "paddw %4, %%xmm4 \n" - "movdqa %%xmm4, 0x00(%1) \n" - "movdqa %%xmm2, 0x40(%1) \n" - H264_IDCT8_1D_SSE2(%%xmm4, %%xmm0, %%xmm6, %%xmm3, %%xmm2, %%xmm5, %%xmm7, %%xmm1) - "movdqa %%xmm6, 0x60(%1) \n" - "movdqa %%xmm7, 0x70(%1) \n" - "pxor %%xmm7, %%xmm7 \n" - STORE_DIFF_8P(%%xmm2, (%0), %%xmm6, %%xmm7) - STORE_DIFF_8P(%%xmm0, (%0,%2), %%xmm6, %%xmm7) - STORE_DIFF_8P(%%xmm1, (%0,%2,2), %%xmm6, %%xmm7) - STORE_DIFF_8P(%%xmm3, (%0,%3), %%xmm6, %%xmm7) - "lea (%0,%2,4), %0 \n" - STORE_DIFF_8P(%%xmm5, (%0), %%xmm6, %%xmm7) - STORE_DIFF_8P(%%xmm4, (%0,%2), %%xmm6, %%xmm7) - "movdqa 0x60(%1), %%xmm0 \n" - "movdqa 0x70(%1), %%xmm1 \n" - STORE_DIFF_8P(%%xmm0, (%0,%2,2), %%xmm6, %%xmm7) - STORE_DIFF_8P(%%xmm1, (%0,%3), %%xmm6, %%xmm7) - :"+r"(dst) - :"r"(block), "r"((x86_reg)stride), "r"((x86_reg)3L*stride), "m"(ff_pw_32) - ); -} - -static void ff_h264_idct_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride) -{ - int dc = (block[0] + 32) >> 6; - __asm__ volatile( - "movd %0, %%mm0 \n\t" - "pshufw $0, %%mm0, %%mm0 \n\t" - "pxor %%mm1, %%mm1 \n\t" - "psubw %%mm0, %%mm1 \n\t" - "packuswb %%mm0, %%mm0 \n\t" - "packuswb %%mm1, %%mm1 \n\t" - ::"r"(dc) - ); - __asm__ volatile( - "movd %0, %%mm2 \n\t" - "movd %1, %%mm3 \n\t" - "movd %2, %%mm4 \n\t" - "movd %3, %%mm5 \n\t" - "paddusb %%mm0, %%mm2 \n\t" - "paddusb %%mm0, %%mm3 \n\t" - "paddusb %%mm0, %%mm4 \n\t" - "paddusb %%mm0, %%mm5 \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm1, %%mm3 \n\t" - "psubusb %%mm1, %%mm4 \n\t" - "psubusb %%mm1, %%mm5 \n\t" - "movd %%mm2, %0 \n\t" - "movd %%mm3, %1 \n\t" - "movd %%mm4, %2 \n\t" - "movd %%mm5, %3 \n\t" - :"+m"(*(uint32_t*)(dst+0*stride)), - "+m"(*(uint32_t*)(dst+1*stride)), - "+m"(*(uint32_t*)(dst+2*stride)), - "+m"(*(uint32_t*)(dst+3*stride)) - ); -} - -static void ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride) -{ - int dc = (block[0] + 32) >> 6; - int y; - __asm__ volatile( - "movd %0, %%mm0 \n\t" - "pshufw $0, %%mm0, %%mm0 \n\t" - "pxor %%mm1, %%mm1 \n\t" - "psubw %%mm0, %%mm1 \n\t" - "packuswb %%mm0, %%mm0 \n\t" - "packuswb %%mm1, %%mm1 \n\t" - ::"r"(dc) - ); - for(y=2; y--; dst += 4*stride){ - __asm__ volatile( - "movq %0, %%mm2 \n\t" - "movq %1, %%mm3 \n\t" - "movq %2, %%mm4 \n\t" - "movq %3, %%mm5 \n\t" - "paddusb %%mm0, %%mm2 \n\t" - "paddusb %%mm0, %%mm3 \n\t" - "paddusb %%mm0, %%mm4 \n\t" - "paddusb %%mm0, %%mm5 \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm1, %%mm3 \n\t" - "psubusb %%mm1, %%mm4 \n\t" - "psubusb %%mm1, %%mm5 \n\t" - "movq %%mm2, %0 \n\t" - "movq %%mm3, %1 \n\t" - "movq %%mm4, %2 \n\t" - "movq %%mm5, %3 \n\t" - :"+m"(*(uint64_t*)(dst+0*stride)), - "+m"(*(uint64_t*)(dst+1*stride)), - "+m"(*(uint64_t*)(dst+2*stride)), - "+m"(*(uint64_t*)(dst+3*stride)) - ); - } -} - -//FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split -static const uint8_t scan8[16 + 2*4]={ - 4+1*8, 5+1*8, 4+2*8, 5+2*8, - 6+1*8, 7+1*8, 6+2*8, 7+2*8, - 4+3*8, 5+3*8, 4+4*8, 5+4*8, - 6+3*8, 7+3*8, 6+4*8, 7+4*8, - 1+1*8, 2+1*8, - 1+2*8, 2+2*8, - 1+4*8, 2+4*8, - 1+5*8, 2+5*8, -}; - -static void ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=0; i<16; i++){ - if(nnzc[ scan8[i] ]) - ff_h264_idct_add_mmx(dst + block_offset[i], block + i*16, stride); - } -} - -static void ff_h264_idct8_add4_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=0; i<16; i+=4){ - if(nnzc[ scan8[i] ]) - ff_h264_idct8_add_mmx(dst + block_offset[i], block + i*16, stride); - } -} - - -static void ff_h264_idct_add16_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=0; i<16; i++){ - int nnz = nnzc[ scan8[i] ]; - if(nnz){ - if(nnz==1 && block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i*16, stride); - else ff_h264_idct_add_mmx (dst + block_offset[i], block + i*16, stride); - } - } -} - -static void ff_h264_idct_add16intra_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=0; i<16; i++){ - if(nnzc[ scan8[i] ] || block[i*16]) - ff_h264_idct_add_mmx(dst + block_offset[i], block + i*16, stride); - } -} - -static void ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=0; i<16; i++){ - if(nnzc[ scan8[i] ]) ff_h264_idct_add_mmx (dst + block_offset[i], block + i*16, stride); - else if(block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i*16, stride); - } -} - -static void ff_h264_idct8_add4_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=0; i<16; i+=4){ - int nnz = nnzc[ scan8[i] ]; - if(nnz){ - if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride); - else ff_h264_idct8_add_mmx (dst + block_offset[i], block + i*16, stride); - } - } -} - -static void ff_h264_idct8_add4_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=0; i<16; i+=4){ - int nnz = nnzc[ scan8[i] ]; - if(nnz){ - if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride); - else ff_h264_idct8_add_sse2 (dst + block_offset[i], block + i*16, stride); - } - } -} - -static void ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=16; i<16+8; i++){ - if(nnzc[ scan8[i] ] || block[i*16]) - ff_h264_idct_add_mmx (dest[(i&4)>>2] + block_offset[i], block + i*16, stride); - } -} - -static void ff_h264_idct_add8_mmx2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=16; i<16+8; i++){ - if(nnzc[ scan8[i] ]) - ff_h264_idct_add_mmx (dest[(i&4)>>2] + block_offset[i], block + i*16, stride); - else if(block[i*16]) - ff_h264_idct_dc_add_mmx2(dest[(i&4)>>2] + block_offset[i], block + i*16, stride); - } -} - -#if CONFIG_GPL && HAVE_YASM -static void ff_h264_idct_dc_add8_mmx2(uint8_t *dst, int16_t *block, int stride) -{ - __asm__ volatile( - "movd %0, %%mm0 \n\t" // 0 0 X D - "punpcklwd %1, %%mm0 \n\t" // x X d D - "paddsw %2, %%mm0 \n\t" - "psraw $6, %%mm0 \n\t" - "punpcklwd %%mm0, %%mm0 \n\t" // d d D D - "pxor %%mm1, %%mm1 \n\t" // 0 0 0 0 - "psubw %%mm0, %%mm1 \n\t" // -d-d-D-D - "packuswb %%mm1, %%mm0 \n\t" // -d-d-D-D d d D D - "pshufw $0xFA, %%mm0, %%mm1 \n\t" // -d-d-d-d-D-D-D-D - "punpcklwd %%mm0, %%mm0 \n\t" // d d d d D D D D - ::"m"(block[ 0]), - "m"(block[16]), - "m"(ff_pw_32) - ); - __asm__ volatile( - "movq %0, %%mm2 \n\t" - "movq %1, %%mm3 \n\t" - "movq %2, %%mm4 \n\t" - "movq %3, %%mm5 \n\t" - "paddusb %%mm0, %%mm2 \n\t" - "paddusb %%mm0, %%mm3 \n\t" - "paddusb %%mm0, %%mm4 \n\t" - "paddusb %%mm0, %%mm5 \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm1, %%mm3 \n\t" - "psubusb %%mm1, %%mm4 \n\t" - "psubusb %%mm1, %%mm5 \n\t" - "movq %%mm2, %0 \n\t" - "movq %%mm3, %1 \n\t" - "movq %%mm4, %2 \n\t" - "movq %%mm5, %3 \n\t" - :"+m"(*(uint64_t*)(dst+0*stride)), - "+m"(*(uint64_t*)(dst+1*stride)), - "+m"(*(uint64_t*)(dst+2*stride)), - "+m"(*(uint64_t*)(dst+3*stride)) - ); -} - -extern void ff_x264_add8x4_idct_sse2(uint8_t *dst, int16_t *block, int stride); - -static void ff_h264_idct_add16_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=0; i<16; i+=2) - if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ]) - ff_x264_add8x4_idct_sse2 (dst + block_offset[i], block + i*16, stride); -} - -static void ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=0; i<16; i+=2){ - if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ]) - ff_x264_add8x4_idct_sse2 (dst + block_offset[i], block + i*16, stride); - else if(block[i*16]|block[i*16+16]) - ff_h264_idct_dc_add8_mmx2(dst + block_offset[i], block + i*16, stride); - } -} - -static void ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ - int i; - for(i=16; i<16+8; i+=2){ - if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ]) - ff_x264_add8x4_idct_sse2 (dest[(i&4)>>2] + block_offset[i], block + i*16, stride); - else if(block[i*16]|block[i*16+16]) - ff_h264_idct_dc_add8_mmx2(dest[(i&4)>>2] + block_offset[i], block + i*16, stride); - } -} -#endif +void ff_h264_idct_add_mmx (uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct8_add_mmx (uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct8_add_sse2 (uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct_dc_add_mmx2 (uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride); + +void ff_h264_idct_add16_mmx (uint8_t *dst, const int *block_offset, + DCTELEM *block, int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct8_add4_mmx (uint8_t *dst, const int *block_offset, + DCTELEM *block, int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct_add16_mmx2 (uint8_t *dst, const int *block_offset, + DCTELEM *block, int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct_add16intra_mmx (uint8_t *dst, const int *block_offset, + DCTELEM *block, int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset, + DCTELEM *block, int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct8_add4_mmx2 (uint8_t *dst, const int *block_offset, + DCTELEM *block, int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct8_add4_sse2 (uint8_t *dst, const int *block_offset, + DCTELEM *block, int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct_add8_mmx (uint8_t **dest, const int *block_offset, + DCTELEM *block, int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct_add8_mmx2 (uint8_t **dest, const int *block_offset, + DCTELEM *block, int stride, const uint8_t nnzc[6*8]); + +void ff_h264_idct_add16_sse2 (uint8_t *dst, const int *block_offset, DCTELEM *block, + int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, + int stride, const uint8_t nnzc[6*8]); +void ff_h264_idct_add8_sse2 (uint8_t **dest, const int *block_offset, DCTELEM *block, + int stride, const uint8_t nnzc[6*8]); /***********************************/ /* deblocking */ -// out: o = |x-y|>a -// clobbers: t -#define DIFF_GT_MMX(x,y,a,o,t)\ - "movq "#y", "#t" \n\t"\ - "movq "#x", "#o" \n\t"\ - "psubusb "#x", "#t" \n\t"\ - "psubusb "#y", "#o" \n\t"\ - "por "#t", "#o" \n\t"\ - "psubusb "#a", "#o" \n\t" - -// out: o = |x-y|>a -// clobbers: t -#define DIFF_GT2_MMX(x,y,a,o,t)\ - "movq "#y", "#t" \n\t"\ - "movq "#x", "#o" \n\t"\ - "psubusb "#x", "#t" \n\t"\ - "psubusb "#y", "#o" \n\t"\ - "psubusb "#a", "#t" \n\t"\ - "psubusb "#a", "#o" \n\t"\ - "pcmpeqb "#t", "#o" \n\t"\ - -// in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 -// out: mm5=beta-1, mm7=mask -// clobbers: mm4,mm6 -#define H264_DEBLOCK_MASK(alpha1, beta1) \ - "pshufw $0, "#alpha1", %%mm4 \n\t"\ - "pshufw $0, "#beta1 ", %%mm5 \n\t"\ - "packuswb %%mm4, %%mm4 \n\t"\ - "packuswb %%mm5, %%mm5 \n\t"\ - DIFF_GT_MMX(%%mm1, %%mm2, %%mm4, %%mm7, %%mm6) /* |p0-q0| > alpha-1 */\ - DIFF_GT_MMX(%%mm0, %%mm1, %%mm5, %%mm4, %%mm6) /* |p1-p0| > beta-1 */\ - "por %%mm4, %%mm7 \n\t"\ - DIFF_GT_MMX(%%mm3, %%mm2, %%mm5, %%mm4, %%mm6) /* |q1-q0| > beta-1 */\ - "por %%mm4, %%mm7 \n\t"\ - "pxor %%mm6, %%mm6 \n\t"\ - "pcmpeqb %%mm6, %%mm7 \n\t" - -// in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 mm7=(tc&mask) -// out: mm1=p0' mm2=q0' -// clobbers: mm0,3-6 -#define H264_DEBLOCK_P0_Q0(pb_01, pb_3f)\ - "movq %%mm1 , %%mm5 \n\t"\ - "pxor %%mm2 , %%mm5 \n\t" /* p0^q0*/\ - "pand "#pb_01" , %%mm5 \n\t" /* (p0^q0)&1*/\ - "pcmpeqb %%mm4 , %%mm4 \n\t"\ - "pxor %%mm4 , %%mm3 \n\t"\ - "pavgb %%mm0 , %%mm3 \n\t" /* (p1 - q1 + 256)>>1*/\ - "pavgb "MANGLE(ff_pb_3)" , %%mm3 \n\t" /*(((p1 - q1 + 256)>>1)+4)>>1 = 64+2+(p1-q1)>>2*/\ - "pxor %%mm1 , %%mm4 \n\t"\ - "pavgb %%mm2 , %%mm4 \n\t" /* (q0 - p0 + 256)>>1*/\ - "pavgb %%mm5 , %%mm3 \n\t"\ - "paddusb %%mm4 , %%mm3 \n\t" /* d+128+33*/\ - "movq "MANGLE(ff_pb_A1)" , %%mm6 \n\t"\ - "psubusb %%mm3 , %%mm6 \n\t"\ - "psubusb "MANGLE(ff_pb_A1)" , %%mm3 \n\t"\ - "pminub %%mm7 , %%mm6 \n\t"\ - "pminub %%mm7 , %%mm3 \n\t"\ - "psubusb %%mm6 , %%mm1 \n\t"\ - "psubusb %%mm3 , %%mm2 \n\t"\ - "paddusb %%mm3 , %%mm1 \n\t"\ - "paddusb %%mm6 , %%mm2 \n\t" - -// in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 mm7=(tc&mask) %8=ff_bone -// out: (q1addr) = av_clip( (q2+((p0+q0+1)>>1))>>1, q1-tc0, q1+tc0 ) -// clobbers: q2, tmp, tc0 -#define H264_DEBLOCK_Q1(p1, q2, q2addr, q1addr, tc0, tmp)\ - "movq %%mm1, "#tmp" \n\t"\ - "pavgb %%mm2, "#tmp" \n\t"\ - "pavgb "#tmp", "#q2" \n\t" /* avg(p2,avg(p0,q0)) */\ - "pxor "q2addr", "#tmp" \n\t"\ - "pand %9, "#tmp" \n\t" /* (p2^avg(p0,q0))&1 */\ - "psubusb "#tmp", "#q2" \n\t" /* (p2+((p0+q0+1)>>1))>>1 */\ - "movq "#p1", "#tmp" \n\t"\ - "psubusb "#tc0", "#tmp" \n\t"\ - "paddusb "#p1", "#tc0" \n\t"\ - "pmaxub "#tmp", "#q2" \n\t"\ - "pminub "#tc0", "#q2" \n\t"\ - "movq "#q2", "q1addr" \n\t" - -static inline void h264_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha1, int beta1, int8_t *tc0) -{ - DECLARE_ALIGNED(8, uint64_t, tmp0)[2]; - - __asm__ volatile( - "movq (%2,%4), %%mm0 \n\t" //p1 - "movq (%2,%4,2), %%mm1 \n\t" //p0 - "movq (%3), %%mm2 \n\t" //q0 - "movq (%3,%4), %%mm3 \n\t" //q1 - H264_DEBLOCK_MASK(%7, %8) - - "movd %6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm4 \n\t" - "punpcklwd %%mm4, %%mm4 \n\t" - "pcmpeqb %%mm3, %%mm3 \n\t" - "movq %%mm4, %%mm6 \n\t" - "pcmpgtb %%mm3, %%mm4 \n\t" - "movq %%mm6, %1 \n\t" - "pand %%mm4, %%mm7 \n\t" - "movq %%mm7, %0 \n\t" - - /* filter p1 */ - "movq (%2), %%mm3 \n\t" //p2 - DIFF_GT2_MMX(%%mm1, %%mm3, %%mm5, %%mm6, %%mm4) // |p2-p0|>beta-1 - "pand %%mm7, %%mm6 \n\t" // mask & |p2-p0|beta-1 - "pand %0, %%mm6 \n\t" - "movq %1, %%mm5 \n\t" // can be merged with the and below but is slower then - "pand %%mm6, %%mm5 \n\t" - "psubb %%mm6, %%mm7 \n\t" - "movq (%3,%4), %%mm3 \n\t" - H264_DEBLOCK_Q1(%%mm3, %%mm4, "(%3,%4,2)", "(%3,%4)", %%mm5, %%mm6) - - /* filter p0, q0 */ - H264_DEBLOCK_P0_Q0(%9, unused) - "movq %%mm1, (%2,%4,2) \n\t" - "movq %%mm2, (%3) \n\t" - - : "=m"(tmp0[0]), "=m"(tmp0[1]) - : "r"(pix-3*stride), "r"(pix), "r"((x86_reg)stride), - "m"(*tmp0/*unused*/), "m"(*(uint32_t*)tc0), "m"(alpha1), "m"(beta1), - "m"(ff_bone) - ); -} - -static void h264_v_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) -{ - if((tc0[0] & tc0[1]) >= 0) - h264_loop_filter_luma_mmx2(pix, stride, alpha-1, beta-1, tc0); - if((tc0[2] & tc0[3]) >= 0) - h264_loop_filter_luma_mmx2(pix+8, stride, alpha-1, beta-1, tc0+2); -} -static void h264_h_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) -{ - //FIXME: could cut some load/stores by merging transpose with filter - // also, it only needs to transpose 6x8 - DECLARE_ALIGNED(8, uint8_t, trans)[8*8]; - int i; - for(i=0; i<2; i++, pix+=8*stride, tc0+=2) { - if((tc0[0] & tc0[1]) < 0) - continue; - transpose4x4(trans, pix-4, 8, stride); - transpose4x4(trans +4*8, pix, 8, stride); - transpose4x4(trans+4, pix-4+4*stride, 8, stride); - transpose4x4(trans+4+4*8, pix +4*stride, 8, stride); - h264_loop_filter_luma_mmx2(trans+4*8, 8, alpha-1, beta-1, tc0); - transpose4x4(pix-2, trans +2*8, stride, 8); - transpose4x4(pix-2+4*stride, trans+4+2*8, stride, 8); - } -} - -static inline void h264_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha1, int beta1, int8_t *tc0) -{ - __asm__ volatile( - "movq (%0), %%mm0 \n\t" //p1 - "movq (%0,%2), %%mm1 \n\t" //p0 - "movq (%1), %%mm2 \n\t" //q0 - "movq (%1,%2), %%mm3 \n\t" //q1 - H264_DEBLOCK_MASK(%4, %5) - "movd %3, %%mm6 \n\t" - "punpcklbw %%mm6, %%mm6 \n\t" - "pand %%mm6, %%mm7 \n\t" // mm7 = tc&mask - H264_DEBLOCK_P0_Q0(%6, %7) - "movq %%mm1, (%0,%2) \n\t" - "movq %%mm2, (%1) \n\t" - - :: "r"(pix-2*stride), "r"(pix), "r"((x86_reg)stride), - "r"(*(uint32_t*)tc0), - "m"(alpha1), "m"(beta1), "m"(ff_bone), "m"(ff_pb_3F) - ); -} - -static void h264_v_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) -{ - h264_loop_filter_chroma_mmx2(pix, stride, alpha-1, beta-1, tc0); -} - -static void h264_h_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) -{ - //FIXME: could cut some load/stores by merging transpose with filter - DECLARE_ALIGNED(8, uint8_t, trans)[8*4]; - transpose4x4(trans, pix-2, 8, stride); - transpose4x4(trans+4, pix-2+4*stride, 8, stride); - h264_loop_filter_chroma_mmx2(trans+2*8, 8, alpha-1, beta-1, tc0); - transpose4x4(pix-2, trans, stride, 8); - transpose4x4(pix-2+4*stride, trans+4, stride, 8); -} - -// p0 = (p0 + q1 + 2*p1 + 2) >> 2 -#define H264_FILTER_CHROMA4(p0, p1, q1, one) \ - "movq "#p0", %%mm4 \n\t"\ - "pxor "#q1", %%mm4 \n\t"\ - "pand "#one", %%mm4 \n\t" /* mm4 = (p0^q1)&1 */\ - "pavgb "#q1", "#p0" \n\t"\ - "psubusb %%mm4, "#p0" \n\t"\ - "pavgb "#p1", "#p0" \n\t" /* dst = avg(p1, avg(p0,q1) - ((p0^q1)&1)) */\ - -static inline void h264_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha1, int beta1) -{ - __asm__ volatile( - "movq (%0), %%mm0 \n\t" - "movq (%0,%2), %%mm1 \n\t" - "movq (%1), %%mm2 \n\t" - "movq (%1,%2), %%mm3 \n\t" - H264_DEBLOCK_MASK(%3, %4) - "movq %%mm1, %%mm5 \n\t" - "movq %%mm2, %%mm6 \n\t" - H264_FILTER_CHROMA4(%%mm1, %%mm0, %%mm3, %5) //p0' - H264_FILTER_CHROMA4(%%mm2, %%mm3, %%mm0, %5) //q0' - "psubb %%mm5, %%mm1 \n\t" - "psubb %%mm6, %%mm2 \n\t" - "pand %%mm7, %%mm1 \n\t" - "pand %%mm7, %%mm2 \n\t" - "paddb %%mm5, %%mm1 \n\t" - "paddb %%mm6, %%mm2 \n\t" - "movq %%mm1, (%0,%2) \n\t" - "movq %%mm2, (%1) \n\t" - :: "r"(pix-2*stride), "r"(pix), "r"((x86_reg)stride), - "m"(alpha1), "m"(beta1), "m"(ff_bone) - ); -} - -static void h264_v_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta) -{ - h264_loop_filter_chroma_intra_mmx2(pix, stride, alpha-1, beta-1); -} - -static void h264_h_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta) -{ - //FIXME: could cut some load/stores by merging transpose with filter - DECLARE_ALIGNED(8, uint8_t, trans)[8*4]; - transpose4x4(trans, pix-2, 8, stride); - transpose4x4(trans+4, pix-2+4*stride, 8, stride); - h264_loop_filter_chroma_intra_mmx2(trans+2*8, 8, alpha-1, beta-1); - transpose4x4(pix-2, trans, stride, 8); - transpose4x4(pix-2+4*stride, trans+4, stride, 8); -} +#define h264_loop_filter_strength_iteration_mmx2(bS, nz, ref, mv, bidir, edges, step, mask_mv, dir, d_idx, mask_dir) \ + do { \ + x86_reg b_idx; \ + mask_mv <<= 3; \ + for( b_idx=0; b_idx= limit */ \ + "psubusb %%mm5, %%mm3 \n" \ + "packsswb %%mm3, %%mm1 \n" \ + \ + "por %%mm1, %%mm0 \n" \ + "movq %a7(%1,%2,4), %%mm1 \n" \ + "movq %a8(%1,%2,4), %%mm2 \n" \ + "movq %%mm1, %%mm3 \n" \ + "movq %%mm2, %%mm4 \n" \ + "psubw 48(%1,%2,4), %%mm1 \n" \ + "psubw 56(%1,%2,4), %%mm2 \n" \ + "psubw 208(%1,%2,4), %%mm3 \n" \ + "psubw 216(%1,%2,4), %%mm4 \n" \ + "packsswb %%mm2, %%mm1 \n" \ + "packsswb %%mm4, %%mm3 \n" \ + "paddb %%mm6, %%mm1 \n" \ + "paddb %%mm6, %%mm3 \n" \ + "psubusb %%mm5, %%mm1 \n" /* abs(mv[b] - mv[bn]) >= limit */ \ + "psubusb %%mm5, %%mm3 \n" \ + "packsswb %%mm3, %%mm1 \n" \ + \ + "pshufw $0x4E, %%mm1, %%mm1 \n" \ + "por %%mm1, %%mm0 \n" \ + "pshufw $0x4E, %%mm0, %%mm1 \n" \ + "pminub %%mm1, %%mm0 \n" \ + ::"r"(ref), \ + "r"(mv), \ + "r"(b_idx), \ + "i"(d_idx+12), \ + "i"(d_idx+52), \ + "i"(d_idx*4+48), \ + "i"(d_idx*4+56), \ + "i"(d_idx*4+208), \ + "i"(d_idx*4+216) \ + ); \ + } else { \ + __asm__ volatile( \ + "movd 12(%0,%2), %%mm0 \n" \ + "psubb %a3(%0,%2), %%mm0 \n" /* ref[b] != ref[bn] */ \ + "movq 48(%1,%2,4), %%mm1 \n" \ + "movq 56(%1,%2,4), %%mm2 \n" \ + "psubw %a4(%1,%2,4), %%mm1 \n" \ + "psubw %a5(%1,%2,4), %%mm2 \n" \ + "packsswb %%mm2, %%mm1 \n" \ + "paddb %%mm6, %%mm1 \n" \ + "psubusb %%mm5, %%mm1 \n" /* abs(mv[b] - mv[bn]) >= limit */ \ + "packsswb %%mm1, %%mm1 \n" \ + "por %%mm1, %%mm0 \n" \ + ::"r"(ref), \ + "r"(mv), \ + "r"(b_idx), \ + "i"(d_idx+12), \ + "i"(d_idx*4+48), \ + "i"(d_idx*4+56) \ + ); \ + } \ + } \ + __asm__ volatile( \ + "movd 12(%0,%1), %%mm1 \n" \ + "por %a2(%0,%1), %%mm1 \n" /* nnz[b] || nnz[bn] */ \ + ::"r"(nnz), \ + "r"(b_idx), \ + "i"(d_idx+12) \ + ); \ + __asm__ volatile( \ + "pminub %%mm7, %%mm1 \n" \ + "pminub %%mm7, %%mm0 \n" \ + "psllw $1, %%mm1 \n" \ + "pxor %%mm2, %%mm2 \n" \ + "pmaxub %%mm0, %%mm1 \n" \ + "punpcklbw %%mm2, %%mm1 \n" \ + "movq %%mm1, %a1(%0,%2) \n" \ + ::"r"(bS), \ + "i"(32*dir), \ + "r"(b_idx) \ + :"memory" \ + ); \ + } \ + } while (0) static void h264_loop_filter_strength_mmx2( int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2], int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field ) { - int dir; __asm__ volatile( "movq %0, %%mm7 \n" "movq %1, %%mm6 \n" @@ -813,95 +196,11 @@ // could do a special case for dir==0 && edges==1, but it only reduces the // average filter time by 1.2% - for( dir=1; dir>=0; dir-- ) { - const x86_reg d_idx = dir ? -8 : -1; - const int mask_mv = dir ? mask_mv1 : mask_mv0; - DECLARE_ALIGNED(8, const uint64_t, mask_dir) = dir ? 0 : 0xffffffffffffffffULL; - int b_idx, edge; - for( b_idx=12, edge=0; edge= limit - "psubusb %%mm5, %%mm3 \n" - "packsswb %%mm3, %%mm1 \n" - "add $40, %0 \n" - "cmp $40, %0 \n" - "jl 1b \n" - "sub $80, %0 \n" - "pshufw $0x4E, %%mm1, %%mm1 \n" - "por %%mm1, %%mm0 \n" - "pshufw $0x4E, %%mm0, %%mm1 \n" - "pminub %%mm1, %%mm0 \n" - ::"r"(d_idx), - "r"(ref[0]+b_idx), - "r"(mv[0]+b_idx) - ); - } else { - __asm__ volatile( - "movd (%1), %%mm0 \n" - "psubb (%1,%0), %%mm0 \n" // ref[b] != ref[bn] - "movq (%2), %%mm1 \n" - "movq 8(%2), %%mm2 \n" - "psubw (%2,%0,4), %%mm1 \n" - "psubw 8(%2,%0,4), %%mm2 \n" - "packsswb %%mm2, %%mm1 \n" - "paddb %%mm6, %%mm1 \n" - "psubusb %%mm5, %%mm1 \n" // abs(mv[b] - mv[bn]) >= limit - "packsswb %%mm1, %%mm1 \n" - "por %%mm1, %%mm0 \n" - ::"r"(d_idx), - "r"(ref[0]+b_idx), - "r"(mv[0]+b_idx) - ); - } - } - __asm__ volatile( - "movd %0, %%mm1 \n" - "por %1, %%mm1 \n" // nnz[b] || nnz[bn] - ::"m"(nnz[b_idx]), - "m"(nnz[b_idx+d_idx]) - ); - __asm__ volatile( - "pminub %%mm7, %%mm1 \n" - "pminub %%mm7, %%mm0 \n" - "psllw $1, %%mm1 \n" - "pxor %%mm2, %%mm2 \n" - "pmaxub %%mm0, %%mm1 \n" - "punpcklbw %%mm2, %%mm1 \n" - "movq %%mm1, %0 \n" - :"=m"(*bS[dir][edge]) - ::"memory" - ); - } - edges = 4; - step = 1; - } + step <<= 3; + edges <<= 3; + h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, edges, step, mask_mv1, 1, -8, 0); + h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, 32, 8, mask_mv0, 0, -1, -1); + __asm__ volatile( "movq (%0), %%mm0 \n\t" "movq 8(%0), %%mm1 \n\t" @@ -917,1507 +216,163 @@ ); } -/***********************************/ -/* motion compensation */ - -#define QPEL_H264V_MM(A,B,C,D,E,F,OP,T,Z,d,q)\ - "mov"#q" "#C", "#T" \n\t"\ - "mov"#d" (%0), "#F" \n\t"\ - "paddw "#D", "#T" \n\t"\ - "psllw $2, "#T" \n\t"\ - "psubw "#B", "#T" \n\t"\ - "psubw "#E", "#T" \n\t"\ - "punpcklbw "#Z", "#F" \n\t"\ - "pmullw %4, "#T" \n\t"\ - "paddw %5, "#A" \n\t"\ - "add %2, %0 \n\t"\ - "paddw "#F", "#A" \n\t"\ - "paddw "#A", "#T" \n\t"\ - "psraw $5, "#T" \n\t"\ - "packuswb "#T", "#T" \n\t"\ - OP(T, (%1), A, d)\ - "add %3, %1 \n\t" - -#define QPEL_H264HV_MM(A,B,C,D,E,F,OF,T,Z,d,q)\ - "mov"#q" "#C", "#T" \n\t"\ - "mov"#d" (%0), "#F" \n\t"\ - "paddw "#D", "#T" \n\t"\ - "psllw $2, "#T" \n\t"\ - "paddw %4, "#A" \n\t"\ - "psubw "#B", "#T" \n\t"\ - "psubw "#E", "#T" \n\t"\ - "punpcklbw "#Z", "#F" \n\t"\ - "pmullw %3, "#T" \n\t"\ - "paddw "#F", "#A" \n\t"\ - "add %2, %0 \n\t"\ - "paddw "#A", "#T" \n\t"\ - "mov"#q" "#T", "#OF"(%1) \n\t" - -#define QPEL_H264V(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%mm6,%%mm7,d,q) -#define QPEL_H264HV(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%mm6,%%mm7,d,q) -#define QPEL_H264V_XMM(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%xmm6,%%xmm7,q,dqa) -#define QPEL_H264HV_XMM(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%xmm6,%%xmm7,q,dqa) - - -#define QPEL_H264(OPNAME, OP, MMX)\ -static av_noinline void OPNAME ## h264_qpel4_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - int h=4;\ -\ - __asm__ volatile(\ - "pxor %%mm7, %%mm7 \n\t"\ - "movq "MANGLE(ff_pw_5) ", %%mm4\n\t"\ - "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\ - "1: \n\t"\ - "movd -1(%0), %%mm1 \n\t"\ - "movd (%0), %%mm2 \n\t"\ - "movd 1(%0), %%mm3 \n\t"\ - "movd 2(%0), %%mm0 \n\t"\ - "punpcklbw %%mm7, %%mm1 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpcklbw %%mm7, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "paddw %%mm0, %%mm1 \n\t"\ - "paddw %%mm3, %%mm2 \n\t"\ - "movd -2(%0), %%mm0 \n\t"\ - "movd 3(%0), %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "punpcklbw %%mm7, %%mm3 \n\t"\ - "paddw %%mm3, %%mm0 \n\t"\ - "psllw $2, %%mm2 \n\t"\ - "psubw %%mm1, %%mm2 \n\t"\ - "pmullw %%mm4, %%mm2 \n\t"\ - "paddw %%mm5, %%mm0 \n\t"\ - "paddw %%mm2, %%mm0 \n\t"\ - "psraw $5, %%mm0 \n\t"\ - "packuswb %%mm0, %%mm0 \n\t"\ - OP(%%mm0, (%1),%%mm6, d)\ - "add %3, %0 \n\t"\ - "add %4, %1 \n\t"\ - "decl %2 \n\t"\ - " jnz 1b \n\t"\ - : "+a"(src), "+c"(dst), "+g"(h)\ - : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\ - : "memory"\ - );\ -}\ -static av_noinline void OPNAME ## h264_qpel4_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ - int h=4;\ - __asm__ volatile(\ - "pxor %%mm7, %%mm7 \n\t"\ - "movq %0, %%mm4 \n\t"\ - "movq %1, %%mm5 \n\t"\ - :: "m"(ff_pw_5), "m"(ff_pw_16)\ - );\ - do{\ - __asm__ volatile(\ - "movd -1(%0), %%mm1 \n\t"\ - "movd (%0), %%mm2 \n\t"\ - "movd 1(%0), %%mm3 \n\t"\ - "movd 2(%0), %%mm0 \n\t"\ - "punpcklbw %%mm7, %%mm1 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpcklbw %%mm7, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "paddw %%mm0, %%mm1 \n\t"\ - "paddw %%mm3, %%mm2 \n\t"\ - "movd -2(%0), %%mm0 \n\t"\ - "movd 3(%0), %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "punpcklbw %%mm7, %%mm3 \n\t"\ - "paddw %%mm3, %%mm0 \n\t"\ - "psllw $2, %%mm2 \n\t"\ - "psubw %%mm1, %%mm2 \n\t"\ - "pmullw %%mm4, %%mm2 \n\t"\ - "paddw %%mm5, %%mm0 \n\t"\ - "paddw %%mm2, %%mm0 \n\t"\ - "movd (%2), %%mm3 \n\t"\ - "psraw $5, %%mm0 \n\t"\ - "packuswb %%mm0, %%mm0 \n\t"\ - PAVGB" %%mm3, %%mm0 \n\t"\ - OP(%%mm0, (%1),%%mm6, d)\ - "add %4, %0 \n\t"\ - "add %4, %1 \n\t"\ - "add %3, %2 \n\t"\ - : "+a"(src), "+c"(dst), "+d"(src2)\ - : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride)\ - : "memory"\ - );\ - }while(--h);\ -}\ -static av_noinline void OPNAME ## h264_qpel4_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - src -= 2*srcStride;\ - __asm__ volatile(\ - "pxor %%mm7, %%mm7 \n\t"\ - "movd (%0), %%mm0 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm1 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm2 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm3 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm4 \n\t"\ - "add %2, %0 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "punpcklbw %%mm7, %%mm1 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpcklbw %%mm7, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm4 \n\t"\ - QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\ - QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\ - QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\ - QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\ - \ - : "+a"(src), "+c"(dst)\ - : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\ - : "memory"\ - );\ -}\ -static av_noinline void OPNAME ## h264_qpel4_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ - int h=4;\ - int w=3;\ - src -= 2*srcStride+2;\ - while(w--){\ - __asm__ volatile(\ - "pxor %%mm7, %%mm7 \n\t"\ - "movd (%0), %%mm0 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm1 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm2 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm3 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm4 \n\t"\ - "add %2, %0 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "punpcklbw %%mm7, %%mm1 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpcklbw %%mm7, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm4 \n\t"\ - QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*3)\ - QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*3)\ - QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*3)\ - QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*3)\ - \ - : "+a"(src)\ - : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)\ - : "memory"\ - );\ - tmp += 4;\ - src += 4 - 9*srcStride;\ - }\ - tmp -= 3*4;\ - __asm__ volatile(\ - "1: \n\t"\ - "movq (%0), %%mm0 \n\t"\ - "paddw 10(%0), %%mm0 \n\t"\ - "movq 2(%0), %%mm1 \n\t"\ - "paddw 8(%0), %%mm1 \n\t"\ - "movq 4(%0), %%mm2 \n\t"\ - "paddw 6(%0), %%mm2 \n\t"\ - "psubw %%mm1, %%mm0 \n\t"/*a-b (abccba)*/\ - "psraw $2, %%mm0 \n\t"/*(a-b)/4 */\ - "psubw %%mm1, %%mm0 \n\t"/*(a-b)/4-b */\ - "paddsw %%mm2, %%mm0 \n\t"\ - "psraw $2, %%mm0 \n\t"/*((a-b)/4-b+c)/4 */\ - "paddw %%mm2, %%mm0 \n\t"/*(a-5*b+20*c)/16 */\ - "psraw $6, %%mm0 \n\t"\ - "packuswb %%mm0, %%mm0 \n\t"\ - OP(%%mm0, (%1),%%mm7, d)\ - "add $24, %0 \n\t"\ - "add %3, %1 \n\t"\ - "decl %2 \n\t"\ - " jnz 1b \n\t"\ - : "+a"(tmp), "+c"(dst), "+g"(h)\ - : "S"((x86_reg)dstStride)\ - : "memory"\ - );\ -}\ -\ -static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - int h=8;\ - __asm__ volatile(\ - "pxor %%mm7, %%mm7 \n\t"\ - "movq "MANGLE(ff_pw_5)", %%mm6\n\t"\ - "1: \n\t"\ - "movq (%0), %%mm0 \n\t"\ - "movq 1(%0), %%mm2 \n\t"\ - "movq %%mm0, %%mm1 \n\t"\ - "movq %%mm2, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "punpckhbw %%mm7, %%mm1 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpckhbw %%mm7, %%mm3 \n\t"\ - "paddw %%mm2, %%mm0 \n\t"\ - "paddw %%mm3, %%mm1 \n\t"\ - "psllw $2, %%mm0 \n\t"\ - "psllw $2, %%mm1 \n\t"\ - "movq -1(%0), %%mm2 \n\t"\ - "movq 2(%0), %%mm4 \n\t"\ - "movq %%mm2, %%mm3 \n\t"\ - "movq %%mm4, %%mm5 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpckhbw %%mm7, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm4 \n\t"\ - "punpckhbw %%mm7, %%mm5 \n\t"\ - "paddw %%mm4, %%mm2 \n\t"\ - "paddw %%mm3, %%mm5 \n\t"\ - "psubw %%mm2, %%mm0 \n\t"\ - "psubw %%mm5, %%mm1 \n\t"\ - "pmullw %%mm6, %%mm0 \n\t"\ - "pmullw %%mm6, %%mm1 \n\t"\ - "movd -2(%0), %%mm2 \n\t"\ - "movd 7(%0), %%mm5 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpcklbw %%mm7, %%mm5 \n\t"\ - "paddw %%mm3, %%mm2 \n\t"\ - "paddw %%mm5, %%mm4 \n\t"\ - "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\ - "paddw %%mm5, %%mm2 \n\t"\ - "paddw %%mm5, %%mm4 \n\t"\ - "paddw %%mm2, %%mm0 \n\t"\ - "paddw %%mm4, %%mm1 \n\t"\ - "psraw $5, %%mm0 \n\t"\ - "psraw $5, %%mm1 \n\t"\ - "packuswb %%mm1, %%mm0 \n\t"\ - OP(%%mm0, (%1),%%mm5, q)\ - "add %3, %0 \n\t"\ - "add %4, %1 \n\t"\ - "decl %2 \n\t"\ - " jnz 1b \n\t"\ - : "+a"(src), "+c"(dst), "+g"(h)\ - : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\ - : "memory"\ - );\ -}\ -\ -static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ - int h=8;\ - __asm__ volatile(\ - "pxor %%mm7, %%mm7 \n\t"\ - "movq %0, %%mm6 \n\t"\ - :: "m"(ff_pw_5)\ - );\ - do{\ - __asm__ volatile(\ - "movq (%0), %%mm0 \n\t"\ - "movq 1(%0), %%mm2 \n\t"\ - "movq %%mm0, %%mm1 \n\t"\ - "movq %%mm2, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "punpckhbw %%mm7, %%mm1 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpckhbw %%mm7, %%mm3 \n\t"\ - "paddw %%mm2, %%mm0 \n\t"\ - "paddw %%mm3, %%mm1 \n\t"\ - "psllw $2, %%mm0 \n\t"\ - "psllw $2, %%mm1 \n\t"\ - "movq -1(%0), %%mm2 \n\t"\ - "movq 2(%0), %%mm4 \n\t"\ - "movq %%mm2, %%mm3 \n\t"\ - "movq %%mm4, %%mm5 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpckhbw %%mm7, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm4 \n\t"\ - "punpckhbw %%mm7, %%mm5 \n\t"\ - "paddw %%mm4, %%mm2 \n\t"\ - "paddw %%mm3, %%mm5 \n\t"\ - "psubw %%mm2, %%mm0 \n\t"\ - "psubw %%mm5, %%mm1 \n\t"\ - "pmullw %%mm6, %%mm0 \n\t"\ - "pmullw %%mm6, %%mm1 \n\t"\ - "movd -2(%0), %%mm2 \n\t"\ - "movd 7(%0), %%mm5 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpcklbw %%mm7, %%mm5 \n\t"\ - "paddw %%mm3, %%mm2 \n\t"\ - "paddw %%mm5, %%mm4 \n\t"\ - "movq %5, %%mm5 \n\t"\ - "paddw %%mm5, %%mm2 \n\t"\ - "paddw %%mm5, %%mm4 \n\t"\ - "paddw %%mm2, %%mm0 \n\t"\ - "paddw %%mm4, %%mm1 \n\t"\ - "psraw $5, %%mm0 \n\t"\ - "psraw $5, %%mm1 \n\t"\ - "movq (%2), %%mm4 \n\t"\ - "packuswb %%mm1, %%mm0 \n\t"\ - PAVGB" %%mm4, %%mm0 \n\t"\ - OP(%%mm0, (%1),%%mm5, q)\ - "add %4, %0 \n\t"\ - "add %4, %1 \n\t"\ - "add %3, %2 \n\t"\ - : "+a"(src), "+c"(dst), "+d"(src2)\ - : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride),\ - "m"(ff_pw_16)\ - : "memory"\ - );\ - }while(--h);\ -}\ -\ -static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ - int w= 2;\ - src -= 2*srcStride;\ - \ - while(w--){\ - __asm__ volatile(\ - "pxor %%mm7, %%mm7 \n\t"\ - "movd (%0), %%mm0 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm1 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm2 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm3 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm4 \n\t"\ - "add %2, %0 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "punpcklbw %%mm7, %%mm1 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpcklbw %%mm7, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm4 \n\t"\ - QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\ - QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\ - QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\ - QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\ - QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\ - QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\ - QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\ - QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\ - \ - : "+a"(src), "+c"(dst)\ - : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\ - : "memory"\ - );\ - if(h==16){\ - __asm__ volatile(\ - QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\ - QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\ - QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\ - QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\ - QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\ - QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\ - QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\ - QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\ - \ - : "+a"(src), "+c"(dst)\ - : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\ - : "memory"\ - );\ - }\ - src += 4-(h+5)*srcStride;\ - dst += 4-h*dstStride;\ - }\ -}\ -static av_always_inline void OPNAME ## h264_qpel8or16_hv1_lowpass_ ## MMX(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){\ - int w = (size+8)>>2;\ - src -= 2*srcStride+2;\ - while(w--){\ - __asm__ volatile(\ - "pxor %%mm7, %%mm7 \n\t"\ - "movd (%0), %%mm0 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm1 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm2 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm3 \n\t"\ - "add %2, %0 \n\t"\ - "movd (%0), %%mm4 \n\t"\ - "add %2, %0 \n\t"\ - "punpcklbw %%mm7, %%mm0 \n\t"\ - "punpcklbw %%mm7, %%mm1 \n\t"\ - "punpcklbw %%mm7, %%mm2 \n\t"\ - "punpcklbw %%mm7, %%mm3 \n\t"\ - "punpcklbw %%mm7, %%mm4 \n\t"\ - QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*48)\ - QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*48)\ - QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*48)\ - QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*48)\ - QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 4*48)\ - QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 5*48)\ - QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 6*48)\ - QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 7*48)\ - : "+a"(src)\ - : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)\ - : "memory"\ - );\ - if(size==16){\ - __asm__ volatile(\ - QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 8*48)\ - QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 9*48)\ - QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 10*48)\ - QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 11*48)\ - QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 12*48)\ - QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 13*48)\ - QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 14*48)\ - QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 15*48)\ - : "+a"(src)\ - : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)\ - : "memory"\ - );\ - }\ - tmp += 4;\ - src += 4 - (size+5)*srcStride;\ - }\ -}\ -static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\ - int w = size>>4;\ - do{\ - int h = size;\ - __asm__ volatile(\ - "1: \n\t"\ - "movq (%0), %%mm0 \n\t"\ - "movq 8(%0), %%mm3 \n\t"\ - "movq 2(%0), %%mm1 \n\t"\ - "movq 10(%0), %%mm4 \n\t"\ - "paddw %%mm4, %%mm0 \n\t"\ - "paddw %%mm3, %%mm1 \n\t"\ - "paddw 18(%0), %%mm3 \n\t"\ - "paddw 16(%0), %%mm4 \n\t"\ - "movq 4(%0), %%mm2 \n\t"\ - "movq 12(%0), %%mm5 \n\t"\ - "paddw 6(%0), %%mm2 \n\t"\ - "paddw 14(%0), %%mm5 \n\t"\ - "psubw %%mm1, %%mm0 \n\t"\ - "psubw %%mm4, %%mm3 \n\t"\ - "psraw $2, %%mm0 \n\t"\ - "psraw $2, %%mm3 \n\t"\ - "psubw %%mm1, %%mm0 \n\t"\ - "psubw %%mm4, %%mm3 \n\t"\ - "paddsw %%mm2, %%mm0 \n\t"\ - "paddsw %%mm5, %%mm3 \n\t"\ - "psraw $2, %%mm0 \n\t"\ - "psraw $2, %%mm3 \n\t"\ - "paddw %%mm2, %%mm0 \n\t"\ - "paddw %%mm5, %%mm3 \n\t"\ - "psraw $6, %%mm0 \n\t"\ - "psraw $6, %%mm3 \n\t"\ - "packuswb %%mm3, %%mm0 \n\t"\ - OP(%%mm0, (%1),%%mm7, q)\ - "add $48, %0 \n\t"\ - "add %3, %1 \n\t"\ - "decl %2 \n\t"\ - " jnz 1b \n\t"\ - : "+a"(tmp), "+c"(dst), "+g"(h)\ - : "S"((x86_reg)dstStride)\ - : "memory"\ - );\ - tmp += 8 - size*24;\ - dst += 8 - size*dstStride;\ - }while(w--);\ -}\ -\ -static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\ -}\ -static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\ - OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\ -}\ -\ -static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\ - OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\ - src += 8*srcStride;\ - dst += 8*dstStride;\ - OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\ - OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\ -}\ -\ -static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ - OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\ - OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\ - src += 8*dstStride;\ - dst += 8*dstStride;\ - src2 += 8*src2Stride;\ - OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\ - OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\ -}\ -\ -static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\ - put_h264_qpel8or16_hv1_lowpass_ ## MMX(tmp, src, tmpStride, srcStride, size);\ - OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\ -}\ -static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ - OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 8);\ -}\ -\ -static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ - OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 16);\ -}\ -\ -static av_noinline void OPNAME ## pixels4_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\ -{\ - __asm__ volatile(\ - "movq (%1), %%mm0 \n\t"\ - "movq 24(%1), %%mm1 \n\t"\ - "psraw $5, %%mm0 \n\t"\ - "psraw $5, %%mm1 \n\t"\ - "packuswb %%mm0, %%mm0 \n\t"\ - "packuswb %%mm1, %%mm1 \n\t"\ - PAVGB" (%0), %%mm0 \n\t"\ - PAVGB" (%0,%3), %%mm1 \n\t"\ - OP(%%mm0, (%2), %%mm4, d)\ - OP(%%mm1, (%2,%4), %%mm5, d)\ - "lea (%0,%3,2), %0 \n\t"\ - "lea (%2,%4,2), %2 \n\t"\ - "movq 48(%1), %%mm0 \n\t"\ - "movq 72(%1), %%mm1 \n\t"\ - "psraw $5, %%mm0 \n\t"\ - "psraw $5, %%mm1 \n\t"\ - "packuswb %%mm0, %%mm0 \n\t"\ - "packuswb %%mm1, %%mm1 \n\t"\ - PAVGB" (%0), %%mm0 \n\t"\ - PAVGB" (%0,%3), %%mm1 \n\t"\ - OP(%%mm0, (%2), %%mm4, d)\ - OP(%%mm1, (%2,%4), %%mm5, d)\ - :"+a"(src8), "+c"(src16), "+d"(dst)\ - :"S"((x86_reg)src8Stride), "D"((x86_reg)dstStride)\ - :"memory");\ -}\ -static av_noinline void OPNAME ## pixels8_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\ -{\ - do{\ - __asm__ volatile(\ - "movq (%1), %%mm0 \n\t"\ - "movq 8(%1), %%mm1 \n\t"\ - "movq 48(%1), %%mm2 \n\t"\ - "movq 8+48(%1), %%mm3 \n\t"\ - "psraw $5, %%mm0 \n\t"\ - "psraw $5, %%mm1 \n\t"\ - "psraw $5, %%mm2 \n\t"\ - "psraw $5, %%mm3 \n\t"\ - "packuswb %%mm1, %%mm0 \n\t"\ - "packuswb %%mm3, %%mm2 \n\t"\ - PAVGB" (%0), %%mm0 \n\t"\ - PAVGB" (%0,%3), %%mm2 \n\t"\ - OP(%%mm0, (%2), %%mm5, q)\ - OP(%%mm2, (%2,%4), %%mm5, q)\ - ::"a"(src8), "c"(src16), "d"(dst),\ - "r"((x86_reg)src8Stride), "r"((x86_reg)dstStride)\ - :"memory");\ - src8 += 2L*src8Stride;\ - src16 += 48;\ - dst += 2L*dstStride;\ - }while(h-=2);\ -}\ -static void OPNAME ## pixels16_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\ -{\ - OPNAME ## pixels8_l2_shift5_ ## MMX(dst , src16 , src8 , dstStride, src8Stride, h);\ - OPNAME ## pixels8_l2_shift5_ ## MMX(dst+8, src16+8, src8+8, dstStride, src8Stride, h);\ -}\ - - -#if ARCH_X86_64 -#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\ -static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ - int h=16;\ - __asm__ volatile(\ - "pxor %%xmm15, %%xmm15 \n\t"\ - "movdqa %6, %%xmm14 \n\t"\ - "movdqa %7, %%xmm13 \n\t"\ - "1: \n\t"\ - "lddqu 6(%0), %%xmm1 \n\t"\ - "lddqu -2(%0), %%xmm7 \n\t"\ - "movdqa %%xmm1, %%xmm0 \n\t"\ - "punpckhbw %%xmm15, %%xmm1 \n\t"\ - "punpcklbw %%xmm15, %%xmm0 \n\t"\ - "punpcklbw %%xmm15, %%xmm7 \n\t"\ - "movdqa %%xmm1, %%xmm2 \n\t"\ - "movdqa %%xmm0, %%xmm6 \n\t"\ - "movdqa %%xmm1, %%xmm3 \n\t"\ - "movdqa %%xmm0, %%xmm8 \n\t"\ - "movdqa %%xmm1, %%xmm4 \n\t"\ - "movdqa %%xmm0, %%xmm9 \n\t"\ - "movdqa %%xmm0, %%xmm12 \n\t"\ - "movdqa %%xmm1, %%xmm11 \n\t"\ - "palignr $10,%%xmm0, %%xmm11\n\t"\ - "palignr $10,%%xmm7, %%xmm12\n\t"\ - "palignr $2, %%xmm0, %%xmm4 \n\t"\ - "palignr $2, %%xmm7, %%xmm9 \n\t"\ - "palignr $4, %%xmm0, %%xmm3 \n\t"\ - "palignr $4, %%xmm7, %%xmm8 \n\t"\ - "palignr $6, %%xmm0, %%xmm2 \n\t"\ - "palignr $6, %%xmm7, %%xmm6 \n\t"\ - "paddw %%xmm0 ,%%xmm11 \n\t"\ - "palignr $8, %%xmm0, %%xmm1 \n\t"\ - "palignr $8, %%xmm7, %%xmm0 \n\t"\ - "paddw %%xmm12,%%xmm7 \n\t"\ - "paddw %%xmm3, %%xmm2 \n\t"\ - "paddw %%xmm8, %%xmm6 \n\t"\ - "paddw %%xmm4, %%xmm1 \n\t"\ - "paddw %%xmm9, %%xmm0 \n\t"\ - "psllw $2, %%xmm2 \n\t"\ - "psllw $2, %%xmm6 \n\t"\ - "psubw %%xmm1, %%xmm2 \n\t"\ - "psubw %%xmm0, %%xmm6 \n\t"\ - "paddw %%xmm13,%%xmm11 \n\t"\ - "paddw %%xmm13,%%xmm7 \n\t"\ - "pmullw %%xmm14,%%xmm2 \n\t"\ - "pmullw %%xmm14,%%xmm6 \n\t"\ - "lddqu (%2), %%xmm3 \n\t"\ - "paddw %%xmm11,%%xmm2 \n\t"\ - "paddw %%xmm7, %%xmm6 \n\t"\ - "psraw $5, %%xmm2 \n\t"\ - "psraw $5, %%xmm6 \n\t"\ - "packuswb %%xmm2,%%xmm6 \n\t"\ - "pavgb %%xmm3, %%xmm6 \n\t"\ - OP(%%xmm6, (%1), %%xmm4, dqa)\ - "add %5, %0 \n\t"\ - "add %5, %1 \n\t"\ - "add %4, %2 \n\t"\ - "decl %3 \n\t"\ - "jg 1b \n\t"\ - : "+a"(src), "+c"(dst), "+d"(src2), "+g"(h)\ - : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride),\ - "m"(ff_pw_5), "m"(ff_pw_16)\ - : "memory"\ - );\ -} -#else // ARCH_X86_64 -#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\ -static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ - OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\ - OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\ - src += 8*dstStride;\ - dst += 8*dstStride;\ - src2 += 8*src2Stride;\ - OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\ - OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\ -} -#endif // ARCH_X86_64 - -#define QPEL_H264_H_XMM(OPNAME, OP, MMX)\ -static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ - int h=8;\ - __asm__ volatile(\ - "pxor %%xmm7, %%xmm7 \n\t"\ - "movdqa %0, %%xmm6 \n\t"\ - :: "m"(ff_pw_5)\ - );\ - do{\ - __asm__ volatile(\ - "lddqu -2(%0), %%xmm1 \n\t"\ - "movdqa %%xmm1, %%xmm0 \n\t"\ - "punpckhbw %%xmm7, %%xmm1 \n\t"\ - "punpcklbw %%xmm7, %%xmm0 \n\t"\ - "movdqa %%xmm1, %%xmm2 \n\t"\ - "movdqa %%xmm1, %%xmm3 \n\t"\ - "movdqa %%xmm1, %%xmm4 \n\t"\ - "movdqa %%xmm1, %%xmm5 \n\t"\ - "palignr $2, %%xmm0, %%xmm4 \n\t"\ - "palignr $4, %%xmm0, %%xmm3 \n\t"\ - "palignr $6, %%xmm0, %%xmm2 \n\t"\ - "palignr $8, %%xmm0, %%xmm1 \n\t"\ - "palignr $10,%%xmm0, %%xmm5 \n\t"\ - "paddw %%xmm5, %%xmm0 \n\t"\ - "paddw %%xmm3, %%xmm2 \n\t"\ - "paddw %%xmm4, %%xmm1 \n\t"\ - "psllw $2, %%xmm2 \n\t"\ - "movq (%2), %%xmm3 \n\t"\ - "psubw %%xmm1, %%xmm2 \n\t"\ - "paddw %5, %%xmm0 \n\t"\ - "pmullw %%xmm6, %%xmm2 \n\t"\ - "paddw %%xmm0, %%xmm2 \n\t"\ - "psraw $5, %%xmm2 \n\t"\ - "packuswb %%xmm2, %%xmm2 \n\t"\ - "pavgb %%xmm3, %%xmm2 \n\t"\ - OP(%%xmm2, (%1), %%xmm4, q)\ - "add %4, %0 \n\t"\ - "add %4, %1 \n\t"\ - "add %3, %2 \n\t"\ - : "+a"(src), "+c"(dst), "+d"(src2)\ - : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride),\ - "m"(ff_pw_16)\ - : "memory"\ - );\ - }while(--h);\ -}\ -QPEL_H264_H16_XMM(OPNAME, OP, MMX)\ -\ -static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - int h=8;\ - __asm__ volatile(\ - "pxor %%xmm7, %%xmm7 \n\t"\ - "movdqa "MANGLE(ff_pw_5)", %%xmm6\n\t"\ - "1: \n\t"\ - "lddqu -2(%0), %%xmm1 \n\t"\ - "movdqa %%xmm1, %%xmm0 \n\t"\ - "punpckhbw %%xmm7, %%xmm1 \n\t"\ - "punpcklbw %%xmm7, %%xmm0 \n\t"\ - "movdqa %%xmm1, %%xmm2 \n\t"\ - "movdqa %%xmm1, %%xmm3 \n\t"\ - "movdqa %%xmm1, %%xmm4 \n\t"\ - "movdqa %%xmm1, %%xmm5 \n\t"\ - "palignr $2, %%xmm0, %%xmm4 \n\t"\ - "palignr $4, %%xmm0, %%xmm3 \n\t"\ - "palignr $6, %%xmm0, %%xmm2 \n\t"\ - "palignr $8, %%xmm0, %%xmm1 \n\t"\ - "palignr $10,%%xmm0, %%xmm5 \n\t"\ - "paddw %%xmm5, %%xmm0 \n\t"\ - "paddw %%xmm3, %%xmm2 \n\t"\ - "paddw %%xmm4, %%xmm1 \n\t"\ - "psllw $2, %%xmm2 \n\t"\ - "psubw %%xmm1, %%xmm2 \n\t"\ - "paddw "MANGLE(ff_pw_16)", %%xmm0\n\t"\ - "pmullw %%xmm6, %%xmm2 \n\t"\ - "paddw %%xmm0, %%xmm2 \n\t"\ - "psraw $5, %%xmm2 \n\t"\ - "packuswb %%xmm2, %%xmm2 \n\t"\ - OP(%%xmm2, (%1), %%xmm4, q)\ - "add %3, %0 \n\t"\ - "add %4, %1 \n\t"\ - "decl %2 \n\t"\ - " jnz 1b \n\t"\ - : "+a"(src), "+c"(dst), "+g"(h)\ - : "D"((x86_reg)srcStride), "S"((x86_reg)dstStride)\ - : "memory"\ - );\ -}\ -static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\ - OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\ - src += 8*srcStride;\ - dst += 8*dstStride;\ - OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\ - OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\ -}\ - -#define QPEL_H264_V_XMM(OPNAME, OP, MMX)\ -static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ - src -= 2*srcStride;\ - \ - __asm__ volatile(\ - "pxor %%xmm7, %%xmm7 \n\t"\ - "movq (%0), %%xmm0 \n\t"\ - "add %2, %0 \n\t"\ - "movq (%0), %%xmm1 \n\t"\ - "add %2, %0 \n\t"\ - "movq (%0), %%xmm2 \n\t"\ - "add %2, %0 \n\t"\ - "movq (%0), %%xmm3 \n\t"\ - "add %2, %0 \n\t"\ - "movq (%0), %%xmm4 \n\t"\ - "add %2, %0 \n\t"\ - "punpcklbw %%xmm7, %%xmm0 \n\t"\ - "punpcklbw %%xmm7, %%xmm1 \n\t"\ - "punpcklbw %%xmm7, %%xmm2 \n\t"\ - "punpcklbw %%xmm7, %%xmm3 \n\t"\ - "punpcklbw %%xmm7, %%xmm4 \n\t"\ - QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\ - QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\ - QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\ - QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\ - QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\ - QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\ - QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\ - QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\ - \ - : "+a"(src), "+c"(dst)\ - : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\ - : "memory"\ - );\ - if(h==16){\ - __asm__ volatile(\ - QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\ - QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\ - QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\ - QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\ - QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\ - QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\ - QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\ - QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\ - \ - : "+a"(src), "+c"(dst)\ - : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\ - : "memory"\ - );\ - }\ -}\ -static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\ -}\ -static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ - OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\ - OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\ -} - -static av_always_inline void put_h264_qpel8or16_hv1_lowpass_sse2(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){ - int w = (size+8)>>3; - src -= 2*srcStride+2; - while(w--){ - __asm__ volatile( - "pxor %%xmm7, %%xmm7 \n\t" - "movq (%0), %%xmm0 \n\t" - "add %2, %0 \n\t" - "movq (%0), %%xmm1 \n\t" - "add %2, %0 \n\t" - "movq (%0), %%xmm2 \n\t" - "add %2, %0 \n\t" - "movq (%0), %%xmm3 \n\t" - "add %2, %0 \n\t" - "movq (%0), %%xmm4 \n\t" - "add %2, %0 \n\t" - "punpcklbw %%xmm7, %%xmm0 \n\t" - "punpcklbw %%xmm7, %%xmm1 \n\t" - "punpcklbw %%xmm7, %%xmm2 \n\t" - "punpcklbw %%xmm7, %%xmm3 \n\t" - "punpcklbw %%xmm7, %%xmm4 \n\t" - QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 0*48) - QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 1*48) - QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 2*48) - QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 3*48) - QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 4*48) - QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 5*48) - QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 6*48) - QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 7*48) - : "+a"(src) - : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16) - : "memory" - ); - if(size==16){ - __asm__ volatile( - QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 8*48) - QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 9*48) - QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 10*48) - QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 11*48) - QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 12*48) - QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 13*48) - QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 14*48) - QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 15*48) - : "+a"(src) - : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16) - : "memory" - ); - } - tmp += 8; - src += 8 - (size+5)*srcStride; - } -} - -#define QPEL_H264_HV2_XMM(OPNAME, OP, MMX)\ -static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\ - int h = size;\ - if(size == 16){\ - __asm__ volatile(\ - "1: \n\t"\ - "movdqa 32(%0), %%xmm4 \n\t"\ - "movdqa 16(%0), %%xmm5 \n\t"\ - "movdqa (%0), %%xmm7 \n\t"\ - "movdqa %%xmm4, %%xmm3 \n\t"\ - "movdqa %%xmm4, %%xmm2 \n\t"\ - "movdqa %%xmm4, %%xmm1 \n\t"\ - "movdqa %%xmm4, %%xmm0 \n\t"\ - "palignr $10, %%xmm5, %%xmm0 \n\t"\ - "palignr $8, %%xmm5, %%xmm1 \n\t"\ - "palignr $6, %%xmm5, %%xmm2 \n\t"\ - "palignr $4, %%xmm5, %%xmm3 \n\t"\ - "palignr $2, %%xmm5, %%xmm4 \n\t"\ - "paddw %%xmm5, %%xmm0 \n\t"\ - "paddw %%xmm4, %%xmm1 \n\t"\ - "paddw %%xmm3, %%xmm2 \n\t"\ - "movdqa %%xmm5, %%xmm6 \n\t"\ - "movdqa %%xmm5, %%xmm4 \n\t"\ - "movdqa %%xmm5, %%xmm3 \n\t"\ - "palignr $8, %%xmm7, %%xmm4 \n\t"\ - "palignr $2, %%xmm7, %%xmm6 \n\t"\ - "palignr $10, %%xmm7, %%xmm3 \n\t"\ - "paddw %%xmm6, %%xmm4 \n\t"\ - "movdqa %%xmm5, %%xmm6 \n\t"\ - "palignr $6, %%xmm7, %%xmm5 \n\t"\ - "palignr $4, %%xmm7, %%xmm6 \n\t"\ - "paddw %%xmm7, %%xmm3 \n\t"\ - "paddw %%xmm6, %%xmm5 \n\t"\ - \ - "psubw %%xmm1, %%xmm0 \n\t"\ - "psubw %%xmm4, %%xmm3 \n\t"\ - "psraw $2, %%xmm0 \n\t"\ - "psraw $2, %%xmm3 \n\t"\ - "psubw %%xmm1, %%xmm0 \n\t"\ - "psubw %%xmm4, %%xmm3 \n\t"\ - "paddw %%xmm2, %%xmm0 \n\t"\ - "paddw %%xmm5, %%xmm3 \n\t"\ - "psraw $2, %%xmm0 \n\t"\ - "psraw $2, %%xmm3 \n\t"\ - "paddw %%xmm2, %%xmm0 \n\t"\ - "paddw %%xmm5, %%xmm3 \n\t"\ - "psraw $6, %%xmm0 \n\t"\ - "psraw $6, %%xmm3 \n\t"\ - "packuswb %%xmm0, %%xmm3 \n\t"\ - OP(%%xmm3, (%1), %%xmm7, dqa)\ - "add $48, %0 \n\t"\ - "add %3, %1 \n\t"\ - "decl %2 \n\t"\ - " jnz 1b \n\t"\ - : "+a"(tmp), "+c"(dst), "+g"(h)\ - : "S"((x86_reg)dstStride)\ - : "memory"\ - );\ - }else{\ - __asm__ volatile(\ - "1: \n\t"\ - "movdqa 16(%0), %%xmm1 \n\t"\ - "movdqa (%0), %%xmm0 \n\t"\ - "movdqa %%xmm1, %%xmm2 \n\t"\ - "movdqa %%xmm1, %%xmm3 \n\t"\ - "movdqa %%xmm1, %%xmm4 \n\t"\ - "movdqa %%xmm1, %%xmm5 \n\t"\ - "palignr $10, %%xmm0, %%xmm5 \n\t"\ - "palignr $8, %%xmm0, %%xmm4 \n\t"\ - "palignr $6, %%xmm0, %%xmm3 \n\t"\ - "palignr $4, %%xmm0, %%xmm2 \n\t"\ - "palignr $2, %%xmm0, %%xmm1 \n\t"\ - "paddw %%xmm5, %%xmm0 \n\t"\ - "paddw %%xmm4, %%xmm1 \n\t"\ - "paddw %%xmm3, %%xmm2 \n\t"\ - "psubw %%xmm1, %%xmm0 \n\t"\ - "psraw $2, %%xmm0 \n\t"\ - "psubw %%xmm1, %%xmm0 \n\t"\ - "paddw %%xmm2, %%xmm0 \n\t"\ - "psraw $2, %%xmm0 \n\t"\ - "paddw %%xmm2, %%xmm0 \n\t"\ - "psraw $6, %%xmm0 \n\t"\ - "packuswb %%xmm0, %%xmm0 \n\t"\ - OP(%%xmm0, (%1), %%xmm7, q)\ - "add $48, %0 \n\t"\ - "add %3, %1 \n\t"\ - "decl %2 \n\t"\ - " jnz 1b \n\t"\ - : "+a"(tmp), "+c"(dst), "+g"(h)\ - : "S"((x86_reg)dstStride)\ - : "memory"\ - );\ - }\ -} - -#define QPEL_H264_HV_XMM(OPNAME, OP, MMX)\ -static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\ - put_h264_qpel8or16_hv1_lowpass_sse2(tmp, src, tmpStride, srcStride, size);\ - OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\ -}\ -static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ - OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 8);\ -}\ -static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ - OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 16);\ -}\ - -#define put_pixels8_l2_sse2 put_pixels8_l2_mmx2 -#define avg_pixels8_l2_sse2 avg_pixels8_l2_mmx2 -#define put_pixels16_l2_sse2 put_pixels16_l2_mmx2 -#define avg_pixels16_l2_sse2 avg_pixels16_l2_mmx2 -#define put_pixels8_l2_ssse3 put_pixels8_l2_mmx2 -#define avg_pixels8_l2_ssse3 avg_pixels8_l2_mmx2 -#define put_pixels16_l2_ssse3 put_pixels16_l2_mmx2 -#define avg_pixels16_l2_ssse3 avg_pixels16_l2_mmx2 - -#define put_pixels8_l2_shift5_sse2 put_pixels8_l2_shift5_mmx2 -#define avg_pixels8_l2_shift5_sse2 avg_pixels8_l2_shift5_mmx2 -#define put_pixels16_l2_shift5_sse2 put_pixels16_l2_shift5_mmx2 -#define avg_pixels16_l2_shift5_sse2 avg_pixels16_l2_shift5_mmx2 -#define put_pixels8_l2_shift5_ssse3 put_pixels8_l2_shift5_mmx2 -#define avg_pixels8_l2_shift5_ssse3 avg_pixels8_l2_shift5_mmx2 -#define put_pixels16_l2_shift5_ssse3 put_pixels16_l2_shift5_mmx2 -#define avg_pixels16_l2_shift5_ssse3 avg_pixels16_l2_shift5_mmx2 - -#define put_h264_qpel8_h_lowpass_l2_sse2 put_h264_qpel8_h_lowpass_l2_mmx2 -#define avg_h264_qpel8_h_lowpass_l2_sse2 avg_h264_qpel8_h_lowpass_l2_mmx2 -#define put_h264_qpel16_h_lowpass_l2_sse2 put_h264_qpel16_h_lowpass_l2_mmx2 -#define avg_h264_qpel16_h_lowpass_l2_sse2 avg_h264_qpel16_h_lowpass_l2_mmx2 - -#define put_h264_qpel8_v_lowpass_ssse3 put_h264_qpel8_v_lowpass_sse2 -#define avg_h264_qpel8_v_lowpass_ssse3 avg_h264_qpel8_v_lowpass_sse2 -#define put_h264_qpel16_v_lowpass_ssse3 put_h264_qpel16_v_lowpass_sse2 -#define avg_h264_qpel16_v_lowpass_ssse3 avg_h264_qpel16_v_lowpass_sse2 - -#define put_h264_qpel8or16_hv2_lowpass_sse2 put_h264_qpel8or16_hv2_lowpass_mmx2 -#define avg_h264_qpel8or16_hv2_lowpass_sse2 avg_h264_qpel8or16_hv2_lowpass_mmx2 - -#define H264_MC(OPNAME, SIZE, MMX, ALIGN) \ -H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\ -H264_MC_V(OPNAME, SIZE, MMX, ALIGN)\ -H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\ -H264_MC_HV(OPNAME, SIZE, MMX, ALIGN)\ - -static void put_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){ - put_pixels16_sse2(dst, src, stride, 16); -} -static void avg_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){ - avg_pixels16_sse2(dst, src, stride, 16); -} -#define put_h264_qpel8_mc00_sse2 put_h264_qpel8_mc00_mmx2 -#define avg_h264_qpel8_mc00_sse2 avg_h264_qpel8_mc00_mmx2 - -#define H264_MC_C(OPNAME, SIZE, MMX, ALIGN) \ -static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ - OPNAME ## pixels ## SIZE ## _ ## MMX(dst, src, stride, SIZE);\ -}\ - -#define H264_MC_H(OPNAME, SIZE, MMX, ALIGN) \ -static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src, stride, stride);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## MMX(dst, src, stride, stride);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src+1, stride, stride);\ -}\ - -#define H264_MC_V(OPNAME, SIZE, MMX, ALIGN) \ -static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ - put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\ - OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride, SIZE);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## MMX(dst, src, stride, stride);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ - put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\ - OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride, SIZE);\ -}\ - -#define H264_MC_HV(OPNAME, SIZE, MMX, ALIGN) \ -static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ - put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\ - OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ - put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\ - OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ - put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\ - OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ - put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\ - OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint16_t, temp)[SIZE*(SIZE<8?12:24)];\ - OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(dst, temp, src, stride, SIZE, stride);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\ - uint8_t * const halfHV= temp;\ - int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ - assert(((int)temp & 7) == 0);\ - put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ - OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, halfHV, stride, SIZE);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\ - uint8_t * const halfHV= temp;\ - int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ - assert(((int)temp & 7) == 0);\ - put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ - OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, halfHV, stride, SIZE);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\ - uint8_t * const halfHV= temp;\ - int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ - assert(((int)temp & 7) == 0);\ - put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ - OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+2, halfHV, stride, SIZE, SIZE);\ -}\ -\ -static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ - DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\ - uint8_t * const halfHV= temp;\ - int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ - assert(((int)temp & 7) == 0);\ - put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ - OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+3, halfHV, stride, SIZE, SIZE);\ -}\ - -#define H264_MC_4816(MMX)\ -H264_MC(put_, 4, MMX, 8)\ -H264_MC(put_, 8, MMX, 8)\ -H264_MC(put_, 16,MMX, 8)\ -H264_MC(avg_, 4, MMX, 8)\ -H264_MC(avg_, 8, MMX, 8)\ -H264_MC(avg_, 16,MMX, 8)\ - -#define H264_MC_816(QPEL, XMM)\ -QPEL(put_, 8, XMM, 16)\ -QPEL(put_, 16,XMM, 16)\ -QPEL(avg_, 8, XMM, 16)\ -QPEL(avg_, 16,XMM, 16)\ - - -#define AVG_3DNOW_OP(a,b,temp, size) \ -"mov" #size " " #b ", " #temp " \n\t"\ -"pavgusb " #temp ", " #a " \n\t"\ -"mov" #size " " #a ", " #b " \n\t" -#define AVG_MMX2_OP(a,b,temp, size) \ -"mov" #size " " #b ", " #temp " \n\t"\ -"pavgb " #temp ", " #a " \n\t"\ -"mov" #size " " #a ", " #b " \n\t" - -#define PAVGB "pavgusb" -QPEL_H264(put_, PUT_OP, 3dnow) -QPEL_H264(avg_, AVG_3DNOW_OP, 3dnow) -#undef PAVGB -#define PAVGB "pavgb" -QPEL_H264(put_, PUT_OP, mmx2) -QPEL_H264(avg_, AVG_MMX2_OP, mmx2) -QPEL_H264_V_XMM(put_, PUT_OP, sse2) -QPEL_H264_V_XMM(avg_, AVG_MMX2_OP, sse2) -QPEL_H264_HV_XMM(put_, PUT_OP, sse2) -QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, sse2) -#if HAVE_SSSE3 -QPEL_H264_H_XMM(put_, PUT_OP, ssse3) -QPEL_H264_H_XMM(avg_, AVG_MMX2_OP, ssse3) -QPEL_H264_HV2_XMM(put_, PUT_OP, ssse3) -QPEL_H264_HV2_XMM(avg_, AVG_MMX2_OP, ssse3) -QPEL_H264_HV_XMM(put_, PUT_OP, ssse3) -QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, ssse3) -#endif -#undef PAVGB - -H264_MC_4816(3dnow) -H264_MC_4816(mmx2) -H264_MC_816(H264_MC_V, sse2) -H264_MC_816(H264_MC_HV, sse2) -#if HAVE_SSSE3 -H264_MC_816(H264_MC_H, ssse3) -H264_MC_816(H264_MC_HV, ssse3) -#endif - -/* rnd interleaved with rnd div 8, use p+1 to access rnd div 8 */ -DECLARE_ALIGNED(8, static const uint64_t, h264_rnd_reg)[4] = { - 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL -}; - -#define H264_CHROMA_OP(S,D) -#define H264_CHROMA_OP4(S,D,T) -#define H264_CHROMA_MC8_TMPL put_h264_chroma_generic_mc8_mmx -#define H264_CHROMA_MC4_TMPL put_h264_chroma_generic_mc4_mmx -#define H264_CHROMA_MC2_TMPL put_h264_chroma_mc2_mmx2 -#define H264_CHROMA_MC8_MV0 put_pixels8_mmx -#include "dsputil_h264_template_mmx.c" - -static void put_h264_chroma_mc8_mmx_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - put_h264_chroma_generic_mc8_mmx(dst, src, stride, h, x, y, h264_rnd_reg); -} -static void put_vc1_chroma_mc8_mmx_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - put_h264_chroma_generic_mc8_mmx(dst, src, stride, h, x, y, h264_rnd_reg+2); -} -static void put_h264_chroma_mc4_mmx(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - put_h264_chroma_generic_mc4_mmx(dst, src, stride, h, x, y, h264_rnd_reg); -} - -#undef H264_CHROMA_OP -#undef H264_CHROMA_OP4 -#undef H264_CHROMA_MC8_TMPL -#undef H264_CHROMA_MC4_TMPL -#undef H264_CHROMA_MC2_TMPL -#undef H264_CHROMA_MC8_MV0 - -#define H264_CHROMA_OP(S,D) "pavgb " #S ", " #D " \n\t" -#define H264_CHROMA_OP4(S,D,T) "movd " #S ", " #T " \n\t"\ - "pavgb " #T ", " #D " \n\t" -#define H264_CHROMA_MC8_TMPL avg_h264_chroma_generic_mc8_mmx2 -#define H264_CHROMA_MC4_TMPL avg_h264_chroma_generic_mc4_mmx2 -#define H264_CHROMA_MC2_TMPL avg_h264_chroma_mc2_mmx2 -#define H264_CHROMA_MC8_MV0 avg_pixels8_mmx2 -#include "dsputil_h264_template_mmx.c" -static void avg_h264_chroma_mc8_mmx2_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - avg_h264_chroma_generic_mc8_mmx2(dst, src, stride, h, x, y, h264_rnd_reg); -} -static void avg_vc1_chroma_mc8_mmx2_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - avg_h264_chroma_generic_mc8_mmx2(dst, src, stride, h, x, y, h264_rnd_reg+2); -} -static void avg_h264_chroma_mc4_mmx2(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - avg_h264_chroma_generic_mc4_mmx2(dst, src, stride, h, x, y, h264_rnd_reg); -} -#undef H264_CHROMA_OP -#undef H264_CHROMA_OP4 -#undef H264_CHROMA_MC8_TMPL -#undef H264_CHROMA_MC4_TMPL -#undef H264_CHROMA_MC2_TMPL -#undef H264_CHROMA_MC8_MV0 - -#define H264_CHROMA_OP(S,D) "pavgusb " #S ", " #D " \n\t" -#define H264_CHROMA_OP4(S,D,T) "movd " #S ", " #T " \n\t"\ - "pavgusb " #T ", " #D " \n\t" -#define H264_CHROMA_MC8_TMPL avg_h264_chroma_generic_mc8_3dnow -#define H264_CHROMA_MC4_TMPL avg_h264_chroma_generic_mc4_3dnow -#define H264_CHROMA_MC8_MV0 avg_pixels8_3dnow -#include "dsputil_h264_template_mmx.c" -static void avg_h264_chroma_mc8_3dnow_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - avg_h264_chroma_generic_mc8_3dnow(dst, src, stride, h, x, y, h264_rnd_reg); -} -static void avg_h264_chroma_mc4_3dnow(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) +#define LF_FUNC(DIR, TYPE, OPT) \ +void ff_x264_deblock_ ## DIR ## _ ## TYPE ## _ ## OPT (uint8_t *pix, int stride, \ + int alpha, int beta, int8_t *tc0); +#define LF_IFUNC(DIR, TYPE, OPT) \ +void ff_x264_deblock_ ## DIR ## _ ## TYPE ## _ ## OPT (uint8_t *pix, int stride, \ + int alpha, int beta); + +LF_FUNC (h, chroma, mmxext) +LF_IFUNC(h, chroma_intra, mmxext) +LF_FUNC (v, chroma, mmxext) +LF_IFUNC(v, chroma_intra, mmxext) + +LF_FUNC (h, luma, mmxext) +LF_IFUNC(h, luma_intra, mmxext) +#if HAVE_YASM && ARCH_X86_32 +LF_FUNC (v8, luma, mmxext) +static void ff_x264_deblock_v_luma_mmxext(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) { - avg_h264_chroma_generic_mc4_3dnow(dst, src, stride, h, x, y, h264_rnd_reg); -} -#undef H264_CHROMA_OP -#undef H264_CHROMA_OP4 -#undef H264_CHROMA_MC8_TMPL -#undef H264_CHROMA_MC4_TMPL -#undef H264_CHROMA_MC8_MV0 - -#if HAVE_SSSE3 -#define AVG_OP(X) -#undef H264_CHROMA_MC8_TMPL -#undef H264_CHROMA_MC4_TMPL -#define H264_CHROMA_MC8_TMPL put_h264_chroma_mc8_ssse3 -#define H264_CHROMA_MC4_TMPL put_h264_chroma_mc4_ssse3 -#define H264_CHROMA_MC8_MV0 put_pixels8_mmx -#include "dsputil_h264_template_ssse3.c" -static void put_h264_chroma_mc8_ssse3_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - put_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 1); -} -static void put_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - put_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 0); -} - -#undef AVG_OP -#undef H264_CHROMA_MC8_TMPL -#undef H264_CHROMA_MC4_TMPL -#undef H264_CHROMA_MC8_MV0 -#define AVG_OP(X) X -#define H264_CHROMA_MC8_TMPL avg_h264_chroma_mc8_ssse3 -#define H264_CHROMA_MC4_TMPL avg_h264_chroma_mc4_ssse3 -#define H264_CHROMA_MC8_MV0 avg_pixels8_mmx2 -#include "dsputil_h264_template_ssse3.c" -static void avg_h264_chroma_mc8_ssse3_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - avg_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 1); + if((tc0[0] & tc0[1]) >= 0) + ff_x264_deblock_v8_luma_mmxext(pix+0, stride, alpha, beta, tc0); + if((tc0[2] & tc0[3]) >= 0) + ff_x264_deblock_v8_luma_mmxext(pix+8, stride, alpha, beta, tc0+2); } -static void avg_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) +LF_IFUNC(v8, luma_intra, mmxext) +static void ff_x264_deblock_v_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta) { - avg_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 0); + ff_x264_deblock_v8_luma_intra_mmxext(pix+0, stride, alpha, beta); + ff_x264_deblock_v8_luma_intra_mmxext(pix+8, stride, alpha, beta); } -#undef AVG_OP -#undef H264_CHROMA_MC8_TMPL -#undef H264_CHROMA_MC4_TMPL -#undef H264_CHROMA_MC8_MV0 #endif +LF_FUNC (h, luma, sse2) +LF_IFUNC(h, luma_intra, sse2) +LF_FUNC (v, luma, sse2) +LF_IFUNC(v, luma_intra, sse2) + /***********************************/ /* weighted prediction */ -static inline void ff_h264_weight_WxH_mmx2(uint8_t *dst, int stride, int log2_denom, int weight, int offset, int w, int h) -{ - int x, y; - offset <<= log2_denom; - offset += (1 << log2_denom) >> 1; - __asm__ volatile( - "movd %0, %%mm4 \n\t" - "movd %1, %%mm5 \n\t" - "movd %2, %%mm6 \n\t" - "pshufw $0, %%mm4, %%mm4 \n\t" - "pshufw $0, %%mm5, %%mm5 \n\t" - "pxor %%mm7, %%mm7 \n\t" - :: "g"(weight), "g"(offset), "g"(log2_denom) - ); - for(y=0; ypred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_mmx; - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx; - h->pred8x8 [VERT_PRED8x8] = ff_pred8x8_vertical_mmx; - h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx; - if (codec_id == CODEC_ID_VP8) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmx; - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmx; - h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx; - } - } - - if (mm_flags & FF_MM_MMX2) { - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext; - h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmxext; - h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext; - h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext; - if (codec_id == CODEC_ID_VP8) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmxext; - h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext; - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmxext; - h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmxext; - h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext; - } - } - - if (mm_flags & FF_MM_SSE) { - h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse; - } + int mm_flags = av_get_cpu_flags(); - if (mm_flags & FF_MM_SSE2) { - h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2; - if (codec_id == CODEC_ID_VP8) { - h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2; - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2; - } + if (mm_flags & AV_CPU_FLAG_MMX2) { + c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2; } +#if HAVE_YASM + if (mm_flags & AV_CPU_FLAG_MMX) { + c->h264_idct_dc_add= + c->h264_idct_add= ff_h264_idct_add_mmx; + c->h264_idct8_dc_add= + c->h264_idct8_add= ff_h264_idct8_add_mmx; + + c->h264_idct_add16 = ff_h264_idct_add16_mmx; + c->h264_idct8_add4 = ff_h264_idct8_add4_mmx; + c->h264_idct_add8 = ff_h264_idct_add8_mmx; + c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx; + + if (mm_flags & AV_CPU_FLAG_MMX2) { + c->h264_idct_dc_add= ff_h264_idct_dc_add_mmx2; + c->h264_idct8_dc_add= ff_h264_idct8_dc_add_mmx2; + c->h264_idct_add16 = ff_h264_idct_add16_mmx2; + c->h264_idct8_add4 = ff_h264_idct8_add4_mmx2; + c->h264_idct_add8 = ff_h264_idct_add8_mmx2; + c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx2; + + c->h264_v_loop_filter_chroma= ff_x264_deblock_v_chroma_mmxext; + c->h264_h_loop_filter_chroma= ff_x264_deblock_h_chroma_mmxext; + c->h264_v_loop_filter_chroma_intra= ff_x264_deblock_v_chroma_intra_mmxext; + c->h264_h_loop_filter_chroma_intra= ff_x264_deblock_h_chroma_intra_mmxext; +#if ARCH_X86_32 + c->h264_v_loop_filter_luma= ff_x264_deblock_v_luma_mmxext; + c->h264_h_loop_filter_luma= ff_x264_deblock_h_luma_mmxext; + c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_mmxext; + c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_mmxext; +#endif + c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_mmx2; + c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_mmx2; + c->weight_h264_pixels_tab[2]= ff_h264_weight_8x16_mmx2; + c->weight_h264_pixels_tab[3]= ff_h264_weight_8x8_mmx2; + c->weight_h264_pixels_tab[4]= ff_h264_weight_8x4_mmx2; + c->weight_h264_pixels_tab[5]= ff_h264_weight_4x8_mmx2; + c->weight_h264_pixels_tab[6]= ff_h264_weight_4x4_mmx2; + c->weight_h264_pixels_tab[7]= ff_h264_weight_4x2_mmx2; + + c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_mmx2; + c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_mmx2; + c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_mmx2; + c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_mmx2; + c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_mmx2; + c->biweight_h264_pixels_tab[5]= ff_h264_biweight_4x8_mmx2; + c->biweight_h264_pixels_tab[6]= ff_h264_biweight_4x4_mmx2; + c->biweight_h264_pixels_tab[7]= ff_h264_biweight_4x2_mmx2; + + if (mm_flags&AV_CPU_FLAG_SSE2) { + c->h264_idct8_add = ff_h264_idct8_add_sse2; + c->h264_idct8_add4= ff_h264_idct8_add4_sse2; + + c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_sse2; + c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_sse2; + c->weight_h264_pixels_tab[2]= ff_h264_weight_8x16_sse2; + c->weight_h264_pixels_tab[3]= ff_h264_weight_8x8_sse2; + c->weight_h264_pixels_tab[4]= ff_h264_weight_8x4_sse2; + + c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_sse2; + c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_sse2; + c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_sse2; + c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_sse2; + c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_sse2; + +#if HAVE_ALIGNED_STACK + c->h264_v_loop_filter_luma = ff_x264_deblock_v_luma_sse2; + c->h264_h_loop_filter_luma = ff_x264_deblock_h_luma_sse2; + c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_sse2; + c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_sse2; +#endif - if (mm_flags & FF_MM_SSSE3) { - h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3; - h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3; - h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3; - if (codec_id == CODEC_ID_VP8) { - h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_ssse3; - h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3; + c->h264_idct_add16 = ff_h264_idct_add16_sse2; + c->h264_idct_add8 = ff_h264_idct_add8_sse2; + c->h264_idct_add16intra = ff_h264_idct_add16intra_sse2; + } + if (mm_flags&AV_CPU_FLAG_SSSE3) { + c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_ssse3; + c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_ssse3; + c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_ssse3; + c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_ssse3; + c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_ssse3; + } } } #endif } -#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_idct.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_idct.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_idct.asm 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_idct.asm 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,856 @@ +;***************************************************************************** +;* MMX/SSE2-optimized H.264 iDCT +;***************************************************************************** +;* Copyright (C) 2004-2005 Michael Niedermayer, Loren Merritt +;* Copyright (C) 2003-2008 x264 project +;* +;* Authors: Laurent Aimar +;* Loren Merritt +;* Holger Lubitz +;* Min Chen +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg is distributed in the hope that it will be useful, +;* but WITHOUT ANY WARRANTY; without even the implied warranty of +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;***************************************************************************** + +%include "x86inc.asm" +%include "x86util.asm" + +SECTION_RODATA + +; FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split +scan8_mem: db 4+1*8, 5+1*8, 4+2*8, 5+2*8 + db 6+1*8, 7+1*8, 6+2*8, 7+2*8 + db 4+3*8, 5+3*8, 4+4*8, 5+4*8 + db 6+3*8, 7+3*8, 6+4*8, 7+4*8 + db 1+1*8, 2+1*8 + db 1+2*8, 2+2*8 + db 1+4*8, 2+4*8 + db 1+5*8, 2+5*8 +%ifdef PIC +%define scan8 r11 +%else +%define scan8 scan8_mem +%endif + +cextern pw_32 + +SECTION .text + +; %1=uint8_t *dst, %2=int16_t *block, %3=int stride +%macro IDCT4_ADD 3 + ; Load dct coeffs + movq m0, [%2] + movq m1, [%2+8] + movq m2, [%2+16] + movq m3, [%2+24] + + IDCT4_1D 0, 1, 2, 3, 4, 5 + mova m6, [pw_32] + TRANSPOSE4x4W 0, 1, 2, 3, 4 + paddw m0, m6 + IDCT4_1D 0, 1, 2, 3, 4, 5 + pxor m7, m7 + + STORE_DIFFx2 m0, m1, m4, m5, m7, 6, %1, %3 + lea %1, [%1+%3*2] + STORE_DIFFx2 m2, m3, m4, m5, m7, 6, %1, %3 +%endmacro + +INIT_MMX +; ff_h264_idct_add_mmx(uint8_t *dst, int16_t *block, int stride) +cglobal h264_idct_add_mmx, 3, 3, 0 + IDCT4_ADD r0, r1, r2 + RET + +%macro IDCT8_1D 2 + mova m4, m5 + mova m0, m1 + psraw m4, 1 + psraw m1, 1 + paddw m4, m5 + paddw m1, m0 + paddw m4, m7 + paddw m1, m5 + psubw m4, m0 + paddw m1, m3 + + psubw m0, m3 + psubw m5, m3 + paddw m0, m7 + psubw m5, m7 + psraw m3, 1 + psraw m7, 1 + psubw m0, m3 + psubw m5, m7 + + mova m3, m4 + mova m7, m1 + psraw m1, 2 + psraw m3, 2 + paddw m3, m0 + psraw m0, 2 + paddw m1, m5 + psraw m5, 2 + psubw m0, m4 + psubw m7, m5 + + mova m4, m2 + mova m5, m6 + psraw m4, 1 + psraw m6, 1 + psubw m4, m5 + paddw m6, m2 + + mova m2, %1 + mova m5, %2 + SUMSUB_BA m5, m2 + SUMSUB_BA m6, m5 + SUMSUB_BA m4, m2 + SUMSUB_BA m7, m6 + SUMSUB_BA m0, m4 + SUMSUB_BA m3, m2 + SUMSUB_BA m1, m5 + SWAP 7, 6, 4, 5, 2, 3, 1, 0 ; 70315246 -> 01234567 +%endmacro + +%macro IDCT8_1D_FULL 1 + mova m7, [%1+112] + mova m6, [%1+ 96] + mova m5, [%1+ 80] + mova m3, [%1+ 48] + mova m2, [%1+ 32] + mova m1, [%1+ 16] + IDCT8_1D [%1], [%1+ 64] +%endmacro + +; %1=int16_t *block, %2=int16_t *dstblock +%macro IDCT8_ADD_MMX_START 2 + IDCT8_1D_FULL %1 + mova [%1], m7 + TRANSPOSE4x4W 0, 1, 2, 3, 7 + mova m7, [%1] + mova [%2 ], m0 + mova [%2+16], m1 + mova [%2+32], m2 + mova [%2+48], m3 + TRANSPOSE4x4W 4, 5, 6, 7, 3 + mova [%2+ 8], m4 + mova [%2+24], m5 + mova [%2+40], m6 + mova [%2+56], m7 +%endmacro + +; %1=uint8_t *dst, %2=int16_t *block, %3=int stride +%macro IDCT8_ADD_MMX_END 3 + IDCT8_1D_FULL %2 + mova [%2 ], m5 + mova [%2+16], m6 + mova [%2+32], m7 + + pxor m7, m7 + STORE_DIFFx2 m0, m1, m5, m6, m7, 6, %1, %3 + lea %1, [%1+%3*2] + STORE_DIFFx2 m2, m3, m5, m6, m7, 6, %1, %3 + mova m0, [%2 ] + mova m1, [%2+16] + mova m2, [%2+32] + lea %1, [%1+%3*2] + STORE_DIFFx2 m4, m0, m5, m6, m7, 6, %1, %3 + lea %1, [%1+%3*2] + STORE_DIFFx2 m1, m2, m5, m6, m7, 6, %1, %3 +%endmacro + +INIT_MMX +; ff_h264_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride) +cglobal h264_idct8_add_mmx, 3, 4, 0 + %assign pad 128+4-(stack_offset&7) + SUB rsp, pad + + add word [r1], 32 + IDCT8_ADD_MMX_START r1 , rsp + IDCT8_ADD_MMX_START r1+8, rsp+64 + lea r3, [r0+4] + IDCT8_ADD_MMX_END r0 , rsp, r2 + IDCT8_ADD_MMX_END r3 , rsp+8, r2 + + ADD rsp, pad + RET + +; %1=uint8_t *dst, %2=int16_t *block, %3=int stride +%macro IDCT8_ADD_SSE 4 + IDCT8_1D_FULL %2 +%ifdef ARCH_X86_64 + TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, 8 +%else + TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, [%2], [%2+16] +%endif + paddw m0, [pw_32] + +%ifndef ARCH_X86_64 + mova [%2 ], m0 + mova [%2+16], m4 + IDCT8_1D [%2], [%2+ 16] + mova [%2 ], m6 + mova [%2+16], m7 +%else + SWAP 0, 8 + SWAP 4, 9 + IDCT8_1D m8, m9 + SWAP 6, 8 + SWAP 7, 9 +%endif + + pxor m7, m7 + lea %4, [%3*3] + STORE_DIFF m0, m6, m7, [%1 ] + STORE_DIFF m1, m6, m7, [%1+%3 ] + STORE_DIFF m2, m6, m7, [%1+%3*2] + STORE_DIFF m3, m6, m7, [%1+%4 ] +%ifndef ARCH_X86_64 + mova m0, [%2 ] + mova m1, [%2+16] +%else + SWAP 0, 8 + SWAP 1, 9 +%endif + lea %1, [%1+%3*4] + STORE_DIFF m4, m6, m7, [%1 ] + STORE_DIFF m5, m6, m7, [%1+%3 ] + STORE_DIFF m0, m6, m7, [%1+%3*2] + STORE_DIFF m1, m6, m7, [%1+%4 ] +%endmacro + +INIT_XMM +; ff_h264_idct8_add_sse2(uint8_t *dst, int16_t *block, int stride) +cglobal h264_idct8_add_sse2, 3, 4, 10 + IDCT8_ADD_SSE r0, r1, r2, r3 + RET + +%macro DC_ADD_MMX2_INIT 2-3 +%if %0 == 2 + movsx %1, word [%1] + add %1, 32 + sar %1, 6 + movd m0, %1d + lea %1, [%2*3] +%else + add %3, 32 + sar %3, 6 + movd m0, %3d + lea %3, [%2*3] +%endif + pshufw m0, m0, 0 + pxor m1, m1 + psubw m1, m0 + packuswb m0, m0 + packuswb m1, m1 +%endmacro + +%macro DC_ADD_MMX2_OP 3-4 + %1 m2, [%2 ] + %1 m3, [%2+%3 ] + %1 m4, [%2+%3*2] + %1 m5, [%2+%4 ] + paddusb m2, m0 + paddusb m3, m0 + paddusb m4, m0 + paddusb m5, m0 + psubusb m2, m1 + psubusb m3, m1 + psubusb m4, m1 + psubusb m5, m1 + %1 [%2 ], m2 + %1 [%2+%3 ], m3 + %1 [%2+%3*2], m4 + %1 [%2+%4 ], m5 +%endmacro + +INIT_MMX +; ff_h264_idct_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride) +cglobal h264_idct_dc_add_mmx2, 3, 3, 0 + DC_ADD_MMX2_INIT r1, r2 + DC_ADD_MMX2_OP movh, r0, r2, r1 + RET + +; ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride) +cglobal h264_idct8_dc_add_mmx2, 3, 3, 0 + DC_ADD_MMX2_INIT r1, r2 + DC_ADD_MMX2_OP mova, r0, r2, r1 + lea r0, [r0+r2*4] + DC_ADD_MMX2_OP mova, r0, r2, r1 + RET + +; ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct_add16_mmx, 5, 7, 0 + xor r5, r5 +%ifdef PIC + lea r11, [scan8_mem] +%endif +.nextblock + movzx r6, byte [scan8+r5] + movzx r6, byte [r4+r6] + test r6, r6 + jz .skipblock + mov r6d, dword [r1+r5*4] + lea r6, [r0+r6] + IDCT4_ADD r6, r2, r3 +.skipblock + inc r5 + add r2, 32 + cmp r5, 16 + jl .nextblock + REP_RET + +; ff_h264_idct8_add4_mmx(uint8_t *dst, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct8_add4_mmx, 5, 7, 0 + %assign pad 128+4-(stack_offset&7) + SUB rsp, pad + + xor r5, r5 +%ifdef PIC + lea r11, [scan8_mem] +%endif +.nextblock + movzx r6, byte [scan8+r5] + movzx r6, byte [r4+r6] + test r6, r6 + jz .skipblock + mov r6d, dword [r1+r5*4] + lea r6, [r0+r6] + add word [r2], 32 + IDCT8_ADD_MMX_START r2 , rsp + IDCT8_ADD_MMX_START r2+8, rsp+64 + IDCT8_ADD_MMX_END r6 , rsp, r3 + mov r6d, dword [r1+r5*4] + lea r6, [r0+r6+4] + IDCT8_ADD_MMX_END r6 , rsp+8, r3 +.skipblock + add r5, 4 + add r2, 128 + cmp r5, 16 + jl .nextblock + ADD rsp, pad + RET + +; ff_h264_idct_add16_mmx2(uint8_t *dst, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct_add16_mmx2, 5, 7, 0 + xor r5, r5 +%ifdef PIC + lea r11, [scan8_mem] +%endif +.nextblock + movzx r6, byte [scan8+r5] + movzx r6, byte [r4+r6] + test r6, r6 + jz .skipblock + cmp r6, 1 + jnz .no_dc + movsx r6, word [r2] + test r6, r6 + jz .no_dc + DC_ADD_MMX2_INIT r2, r3, r6 +%ifdef ARCH_X86_64 +%define dst_reg r10 +%define dst_regd r10d +%else +%define dst_reg r1 +%define dst_regd r1d +%endif + mov dst_regd, dword [r1+r5*4] + lea dst_reg, [r0+dst_reg] + DC_ADD_MMX2_OP movh, dst_reg, r3, r6 +%ifndef ARCH_X86_64 + mov r1, r1m +%endif + inc r5 + add r2, 32 + cmp r5, 16 + jl .nextblock + REP_RET +.no_dc + mov r6d, dword [r1+r5*4] + lea r6, [r0+r6] + IDCT4_ADD r6, r2, r3 +.skipblock + inc r5 + add r2, 32 + cmp r5, 16 + jl .nextblock + REP_RET + +; ff_h264_idct_add16intra_mmx(uint8_t *dst, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct_add16intra_mmx, 5, 7, 0 + xor r5, r5 +%ifdef PIC + lea r11, [scan8_mem] +%endif +.nextblock + movzx r6, byte [scan8+r5] + movzx r6, byte [r4+r6] + or r6w, word [r2] + test r6, r6 + jz .skipblock + mov r6d, dword [r1+r5*4] + lea r6, [r0+r6] + IDCT4_ADD r6, r2, r3 +.skipblock + inc r5 + add r2, 32 + cmp r5, 16 + jl .nextblock + REP_RET + +; ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct_add16intra_mmx2, 5, 7, 0 + xor r5, r5 +%ifdef PIC + lea r11, [scan8_mem] +%endif +.nextblock + movzx r6, byte [scan8+r5] + movzx r6, byte [r4+r6] + test r6, r6 + jz .try_dc + mov r6d, dword [r1+r5*4] + lea r6, [r0+r6] + IDCT4_ADD r6, r2, r3 + inc r5 + add r2, 32 + cmp r5, 16 + jl .nextblock + REP_RET +.try_dc + movsx r6, word [r2] + test r6, r6 + jz .skipblock + DC_ADD_MMX2_INIT r2, r3, r6 +%ifdef ARCH_X86_64 +%define dst_reg r10 +%define dst_regd r10d +%else +%define dst_reg r1 +%define dst_regd r1d +%endif + mov dst_regd, dword [r1+r5*4] + lea dst_reg, [r0+dst_reg] + DC_ADD_MMX2_OP movh, dst_reg, r3, r6 +%ifndef ARCH_X86_64 + mov r1, r1m +%endif +.skipblock + inc r5 + add r2, 32 + cmp r5, 16 + jl .nextblock + REP_RET + +; ff_h264_idct8_add4_mmx2(uint8_t *dst, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct8_add4_mmx2, 5, 7, 0 + %assign pad 128+4-(stack_offset&7) + SUB rsp, pad + + xor r5, r5 +%ifdef PIC + lea r11, [scan8_mem] +%endif +.nextblock + movzx r6, byte [scan8+r5] + movzx r6, byte [r4+r6] + test r6, r6 + jz .skipblock + cmp r6, 1 + jnz .no_dc + movsx r6, word [r2] + test r6, r6 + jz .no_dc + DC_ADD_MMX2_INIT r2, r3, r6 +%ifdef ARCH_X86_64 +%define dst_reg r10 +%define dst_regd r10d +%else +%define dst_reg r1 +%define dst_regd r1d +%endif + mov dst_regd, dword [r1+r5*4] + lea dst_reg, [r0+dst_reg] + DC_ADD_MMX2_OP mova, dst_reg, r3, r6 + lea dst_reg, [dst_reg+r3*4] + DC_ADD_MMX2_OP mova, dst_reg, r3, r6 +%ifndef ARCH_X86_64 + mov r1, r1m +%endif + add r5, 4 + add r2, 128 + cmp r5, 16 + jl .nextblock + + ADD rsp, pad + RET +.no_dc + mov r6d, dword [r1+r5*4] + lea r6, [r0+r6] + add word [r2], 32 + IDCT8_ADD_MMX_START r2 , rsp + IDCT8_ADD_MMX_START r2+8, rsp+64 + IDCT8_ADD_MMX_END r6 , rsp, r3 + mov r6d, dword [r1+r5*4] + lea r6, [r0+r6+4] + IDCT8_ADD_MMX_END r6 , rsp+8, r3 +.skipblock + add r5, 4 + add r2, 128 + cmp r5, 16 + jl .nextblock + + ADD rsp, pad + RET + +INIT_XMM +; ff_h264_idct8_add4_sse2(uint8_t *dst, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct8_add4_sse2, 5, 7, 10 + xor r5, r5 +%ifdef PIC + lea r11, [scan8_mem] +%endif +.nextblock + movzx r6, byte [scan8+r5] + movzx r6, byte [r4+r6] + test r6, r6 + jz .skipblock + cmp r6, 1 + jnz .no_dc + movsx r6, word [r2] + test r6, r6 + jz .no_dc +INIT_MMX + DC_ADD_MMX2_INIT r2, r3, r6 +%ifdef ARCH_X86_64 +%define dst_reg r10 +%define dst_regd r10d +%else +%define dst_reg r1 +%define dst_regd r1d +%endif + mov dst_regd, dword [r1+r5*4] + lea dst_reg, [r0+dst_reg] + DC_ADD_MMX2_OP mova, dst_reg, r3, r6 + lea dst_reg, [dst_reg+r3*4] + DC_ADD_MMX2_OP mova, dst_reg, r3, r6 +%ifndef ARCH_X86_64 + mov r1, r1m +%endif + add r5, 4 + add r2, 128 + cmp r5, 16 + jl .nextblock + REP_RET +.no_dc +INIT_XMM + mov dst_regd, dword [r1+r5*4] + lea dst_reg, [r0+dst_reg] + IDCT8_ADD_SSE dst_reg, r2, r3, r6 +%ifndef ARCH_X86_64 + mov r1, r1m +%endif +.skipblock + add r5, 4 + add r2, 128 + cmp r5, 16 + jl .nextblock + REP_RET + +INIT_MMX +h264_idct_add8_mmx_plane: +.nextblock + movzx r6, byte [scan8+r5] + movzx r6, byte [r4+r6] + or r6w, word [r2] + test r6, r6 + jz .skipblock +%ifdef ARCH_X86_64 + mov r0d, dword [r1+r5*4] + add r0, [r10] +%else + mov r0, r1m ; XXX r1m here is actually r0m of the calling func + mov r0, [r0] + add r0, dword [r1+r5*4] +%endif + IDCT4_ADD r0, r2, r3 +.skipblock + inc r5 + add r2, 32 + test r5, 3 + jnz .nextblock + rep ret + +; ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct_add8_mmx, 5, 7, 0 + mov r5, 16 + add r2, 512 +%ifdef PIC + lea r11, [scan8_mem] +%endif +%ifdef ARCH_X86_64 + mov r10, r0 +%endif + call h264_idct_add8_mmx_plane +%ifdef ARCH_X86_64 + add r10, gprsize +%else + add r0mp, gprsize +%endif + call h264_idct_add8_mmx_plane + RET + +h264_idct_add8_mmx2_plane +.nextblock + movzx r6, byte [scan8+r5] + movzx r6, byte [r4+r6] + test r6, r6 + jz .try_dc +%ifdef ARCH_X86_64 + mov r0d, dword [r1+r5*4] + add r0, [r10] +%else + mov r0, r1m ; XXX r1m here is actually r0m of the calling func + mov r0, [r0] + add r0, dword [r1+r5*4] +%endif + IDCT4_ADD r0, r2, r3 + inc r5 + add r2, 32 + test r5, 3 + jnz .nextblock + rep ret +.try_dc + movsx r6, word [r2] + test r6, r6 + jz .skipblock + DC_ADD_MMX2_INIT r2, r3, r6 +%ifdef ARCH_X86_64 + mov r0d, dword [r1+r5*4] + add r0, [r10] +%else + mov r0, r1m ; XXX r1m here is actually r0m of the calling func + mov r0, [r0] + add r0, dword [r1+r5*4] +%endif + DC_ADD_MMX2_OP movh, r0, r3, r6 +.skipblock + inc r5 + add r2, 32 + test r5, 3 + jnz .nextblock + rep ret + +; ff_h264_idct_add8_mmx2(uint8_t **dest, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct_add8_mmx2, 5, 7, 0 + mov r5, 16 + add r2, 512 +%ifdef ARCH_X86_64 + mov r10, r0 +%endif +%ifdef PIC + lea r11, [scan8_mem] +%endif + call h264_idct_add8_mmx2_plane +%ifdef ARCH_X86_64 + add r10, gprsize +%else + add r0mp, gprsize +%endif + call h264_idct_add8_mmx2_plane + RET + +INIT_MMX +; r0 = uint8_t *dst, r2 = int16_t *block, r3 = int stride, r6=clobbered +h264_idct_dc_add8_mmx2: + movd m0, [r2 ] ; 0 0 X D + punpcklwd m0, [r2+32] ; x X d D + paddsw m0, [pw_32] + psraw m0, 6 + punpcklwd m0, m0 ; d d D D + pxor m1, m1 ; 0 0 0 0 + psubw m1, m0 ; -d-d-D-D + packuswb m0, m1 ; -d-d-D-D d d D D + pshufw m1, m0, 0xFA ; -d-d-d-d-D-D-D-D + punpcklwd m0, m0 ; d d d d D D D D + lea r6, [r3*3] + DC_ADD_MMX2_OP movq, r0, r3, r6 + ret + +ALIGN 16 +INIT_XMM +; r0 = uint8_t *dst (clobbered), r2 = int16_t *block, r3 = int stride +x264_add8x4_idct_sse2: + movq m0, [r2+ 0] + movq m1, [r2+ 8] + movq m2, [r2+16] + movq m3, [r2+24] + movhps m0, [r2+32] + movhps m1, [r2+40] + movhps m2, [r2+48] + movhps m3, [r2+56] + IDCT4_1D 0,1,2,3,4,5 + TRANSPOSE2x4x4W 0,1,2,3,4 + paddw m0, [pw_32] + IDCT4_1D 0,1,2,3,4,5 + pxor m7, m7 + STORE_DIFFx2 m0, m1, m4, m5, m7, 6, r0, r3 + lea r0, [r0+r3*2] + STORE_DIFFx2 m2, m3, m4, m5, m7, 6, r0, r3 + ret + +%macro add16_sse2_cycle 2 + movzx r0, word [r4+%2] + test r0, r0 + jz .cycle%1end + mov r0d, dword [r1+%1*8] +%ifdef ARCH_X86_64 + add r0, r10 +%else + add r0, r0m +%endif + call x264_add8x4_idct_sse2 +.cycle%1end +%if %1 < 7 + add r2, 64 +%endif +%endmacro + +; ff_h264_idct_add16_sse2(uint8_t *dst, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct_add16_sse2, 5, 5, 8 +%ifdef ARCH_X86_64 + mov r10, r0 +%endif + ; unrolling of the loop leads to an average performance gain of + ; 20-25% + add16_sse2_cycle 0, 0xc + add16_sse2_cycle 1, 0x14 + add16_sse2_cycle 2, 0xe + add16_sse2_cycle 3, 0x16 + add16_sse2_cycle 4, 0x1c + add16_sse2_cycle 5, 0x24 + add16_sse2_cycle 6, 0x1e + add16_sse2_cycle 7, 0x26 + RET + +%macro add16intra_sse2_cycle 2 + movzx r0, word [r4+%2] + test r0, r0 + jz .try%1dc + mov r0d, dword [r1+%1*8] +%ifdef ARCH_X86_64 + add r0, r10 +%else + add r0, r0m +%endif + call x264_add8x4_idct_sse2 + jmp .cycle%1end +.try%1dc + movsx r0, word [r2 ] + or r0w, word [r2+32] + jz .cycle%1end + mov r0d, dword [r1+%1*8] +%ifdef ARCH_X86_64 + add r0, r10 +%else + add r0, r0m +%endif + call h264_idct_dc_add8_mmx2 +.cycle%1end +%if %1 < 7 + add r2, 64 +%endif +%endmacro + +; ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct_add16intra_sse2, 5, 7, 8 +%ifdef ARCH_X86_64 + mov r10, r0 +%endif + add16intra_sse2_cycle 0, 0xc + add16intra_sse2_cycle 1, 0x14 + add16intra_sse2_cycle 2, 0xe + add16intra_sse2_cycle 3, 0x16 + add16intra_sse2_cycle 4, 0x1c + add16intra_sse2_cycle 5, 0x24 + add16intra_sse2_cycle 6, 0x1e + add16intra_sse2_cycle 7, 0x26 + RET + +%macro add8_sse2_cycle 2 + movzx r0, word [r4+%2] + test r0, r0 + jz .try%1dc +%ifdef ARCH_X86_64 + mov r0d, dword [r1+%1*8+64] + add r0, [r10] +%else + mov r0, r0m + mov r0, [r0] + add r0, dword [r1+%1*8+64] +%endif + call x264_add8x4_idct_sse2 + jmp .cycle%1end +.try%1dc + movsx r0, word [r2 ] + or r0w, word [r2+32] + jz .cycle%1end +%ifdef ARCH_X86_64 + mov r0d, dword [r1+%1*8+64] + add r0, [r10] +%else + mov r0, r0m + mov r0, [r0] + add r0, dword [r1+%1*8+64] +%endif + call h264_idct_dc_add8_mmx2 +.cycle%1end +%if %1 < 3 + add r2, 64 +%endif +%endmacro + +; ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset, +; DCTELEM *block, int stride, const uint8_t nnzc[6*8]) +cglobal h264_idct_add8_sse2, 5, 7, 8 + add r2, 512 +%ifdef ARCH_X86_64 + mov r10, r0 +%endif + add8_sse2_cycle 0, 0x09 + add8_sse2_cycle 1, 0x11 +%ifdef ARCH_X86_64 + add r10, gprsize +%else + add r0mp, gprsize +%endif + add8_sse2_cycle 2, 0x21 + add8_sse2_cycle 3, 0x29 + RET diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_idct_sse2.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_idct_sse2.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_idct_sse2.asm 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_idct_sse2.asm 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -;***************************************************************************** -;* SSE2-optimized H.264 iDCT -;***************************************************************************** -;* Copyright (C) 2003-2008 x264 project -;* -;* Authors: Laurent Aimar -;* Loren Merritt -;* Holger Lubitz -;* Min Chen -;* -;* This program is free software; you can redistribute it and/or modify -;* it under the terms of the GNU General Public License as published by -;* the Free Software Foundation; either version 2 of the License, or -;* (at your option) any later version. -;* -;* This program is distributed in the hope that it will be useful, -;* but WITHOUT ANY WARRANTY; without even the implied warranty of -;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;* GNU General Public License for more details. -;* -;* You should have received a copy of the GNU General Public License -;* along with this program; if not, write to the Free Software -;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. -;***************************************************************************** - -%include "x86inc.asm" -%include "x86util.asm" - -SECTION_RODATA -pw_32: times 8 dw 32 - -SECTION .text - -INIT_XMM -cglobal x264_add8x4_idct_sse2, 3,3,8 - movq m0, [r1+ 0] - movq m1, [r1+ 8] - movq m2, [r1+16] - movq m3, [r1+24] - movhps m0, [r1+32] - movhps m1, [r1+40] - movhps m2, [r1+48] - movhps m3, [r1+56] - IDCT4_1D 0,1,2,3,4,5 - TRANSPOSE2x4x4W 0,1,2,3,4 - paddw m0, [pw_32] - IDCT4_1D 0,1,2,3,4,5 - pxor m7, m7 - STORE_DIFF m0, m4, m7, [r0] - STORE_DIFF m1, m4, m7, [r0+r2] - lea r0, [r0+r2*2] - STORE_DIFF m2, m4, m7, [r0] - STORE_DIFF m3, m4, m7, [r0+r2] - RET diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_intrapred.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_intrapred.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_intrapred.asm 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_intrapred.asm 2010-11-06 17:21:28.000000000 +0000 @@ -24,11 +24,23 @@ SECTION_RODATA tm_shuf: times 8 db 0x03, 0x80 +plane_shuf: db -8, -7, -6, -5, -4, -3, -2, -1 + db 1, 2, 3, 4, 5, 6, 7, 8 +plane8_shuf: db -4, -3, -2, -1, 0, 0, 0, 0 + db 1, 2, 3, 4, 0, 0, 0, 0 +pw_0to7: dw 0, 1, 2, 3, 4, 5, 6, 7 +pw_1to8: dw 1, 2, 3, 4, 5, 6, 7, 8 +pw_m8tom1: dw -8, -7, -6, -5, -4, -3, -2, -1 +pw_m4to4: dw -4, -3, -2, -1, 1, 2, 3, 4 SECTION .text cextern pb_1 cextern pb_3 +cextern pw_5 +cextern pw_16 +cextern pw_17 +cextern pw_32 ;----------------------------------------------------------------------------- ; void pred16x16_vertical(uint8_t *src, int stride) @@ -266,6 +278,498 @@ REP_RET ;----------------------------------------------------------------------------- +; void pred16x16_plane(uint8_t *src, int stride) +;----------------------------------------------------------------------------- + +%macro H264_PRED16x16_PLANE 3 +cglobal pred16x16_plane_%3_%1, 2, 7, %2 + mov r2, r1 ; +stride + neg r1 ; -stride + + movh m0, [r0+r1 -1] +%if mmsize == 8 + pxor m4, m4 + movh m1, [r0+r1 +3 ] + movh m2, [r0+r1 +8 ] + movh m3, [r0+r1 +12] + punpcklbw m0, m4 + punpcklbw m1, m4 + punpcklbw m2, m4 + punpcklbw m3, m4 + pmullw m0, [pw_m8tom1 ] + pmullw m1, [pw_m8tom1+8] + pmullw m2, [pw_1to8 ] + pmullw m3, [pw_1to8 +8] + paddw m0, m2 + paddw m1, m3 +%else ; mmsize == 16 +%ifidn %1, sse2 + pxor m2, m2 + movh m1, [r0+r1 +8] + punpcklbw m0, m2 + punpcklbw m1, m2 + pmullw m0, [pw_m8tom1] + pmullw m1, [pw_1to8] + paddw m0, m1 +%else ; ssse3 + movhps m0, [r0+r1 +8] + pmaddubsw m0, [plane_shuf] ; H coefficients +%endif + movhlps m1, m0 +%endif + paddw m0, m1 +%ifidn %1, mmx + mova m1, m0 + psrlq m1, 32 +%elifidn %1, mmx2 + pshufw m1, m0, 0xE +%else ; mmsize == 16 + pshuflw m1, m0, 0xE +%endif + paddw m0, m1 +%ifidn %1, mmx + mova m1, m0 + psrlq m1, 16 +%elifidn %1, mmx2 + pshufw m1, m0, 0x1 +%else + pshuflw m1, m0, 0x1 +%endif + paddw m0, m1 ; sum of H coefficients + +%ifidn %3, h264 + pmullw m0, [pw_5] + paddw m0, [pw_32] + psraw m0, 6 +%elifidn %3, rv40 + pmullw m0, [pw_5] + psraw m0, 6 +%elifidn %3, svq3 + movd r3d, m0 + movsx r3, r3w + test r3, r3 + lea r4, [r3+3] + cmovs r3, r4 + sar r3, 2 ; H/4 + lea r3, [r3*5] ; 5*(H/4) + test r3, r3 + lea r4, [r3+15] + cmovs r3, r4 + sar r3, 4 ; (5*(H/4))/16 + movd m0, r3d +%endif + + lea r4, [r0+r2*8-1] + lea r3, [r0+r2*4-1] + add r4, r2 + +%ifdef ARCH_X86_64 +%define e_reg r11 +%else +%define e_reg r0 +%endif + + movzx e_reg, byte [r3+r2*2 ] + movzx r5, byte [r4+r1 ] + sub r5, e_reg + + movzx e_reg, byte [r3+r2 ] + movzx r6, byte [r4 ] + sub r6, e_reg + lea r5, [r5+r6*2] + + movzx e_reg, byte [r3+r1 ] + movzx r6, byte [r4+r2*2 ] + sub r6, e_reg + lea r5, [r5+r6*4] + + movzx e_reg, byte [r3 ] +%ifdef ARCH_X86_64 + movzx r10, byte [r4+r2 ] + sub r10, e_reg +%else + movzx r6, byte [r4+r2 ] + sub r6, e_reg + lea r5, [r5+r6*4] + sub r5, r6 +%endif + + lea e_reg, [r3+r1*4] + lea r3, [r4+r2*4] + + movzx r4, byte [e_reg+r2 ] + movzx r6, byte [r3 ] + sub r6, r4 +%ifdef ARCH_X86_64 + lea r6, [r10+r6*2] + lea r5, [r5+r6*2] + add r5, r6 +%else + lea r5, [r5+r6*4] + lea r5, [r5+r6*2] +%endif + + movzx r4, byte [e_reg ] +%ifdef ARCH_X86_64 + movzx r10, byte [r3 +r2 ] + sub r10, r4 + sub r5, r10 +%else + movzx r6, byte [r3 +r2 ] + sub r6, r4 + lea r5, [r5+r6*8] + sub r5, r6 +%endif + + movzx r4, byte [e_reg+r1 ] + movzx r6, byte [r3 +r2*2] + sub r6, r4 +%ifdef ARCH_X86_64 + add r6, r10 +%endif + lea r5, [r5+r6*8] + + movzx r4, byte [e_reg+r2*2] + movzx r6, byte [r3 +r1 ] + sub r6, r4 + lea r5, [r5+r6*4] + add r5, r6 ; sum of V coefficients + +%ifndef ARCH_X86_64 + mov r0, r0m +%endif + +%ifidn %3, h264 + lea r5, [r5*5+32] + sar r5, 6 +%elifidn %3, rv40 + lea r5, [r5*5] + sar r5, 6 +%elifidn %3, svq3 + test r5, r5 + lea r6, [r5+3] + cmovs r5, r6 + sar r5, 2 ; V/4 + lea r5, [r5*5] ; 5*(V/4) + test r5, r5 + lea r6, [r5+15] + cmovs r5, r6 + sar r5, 4 ; (5*(V/4))/16 +%endif + + movzx r4, byte [r0+r1 +15] + movzx r3, byte [r3+r2*2 ] + lea r3, [r3+r4+1] + shl r3, 4 + movd r1d, m0 + movsx r1d, r1w + add r1d, r5d + add r3d, r1d + shl r1d, 3 + sub r3d, r1d ; a + + movd m1, r5d + movd m3, r3d +%ifidn %1, mmx + punpcklwd m0, m0 + punpcklwd m1, m1 + punpcklwd m3, m3 + punpckldq m0, m0 + punpckldq m1, m1 + punpckldq m3, m3 +%elifidn %1, mmx2 + pshufw m0, m0, 0x0 + pshufw m1, m1, 0x0 + pshufw m3, m3, 0x0 +%else + pshuflw m0, m0, 0x0 + pshuflw m1, m1, 0x0 + pshuflw m3, m3, 0x0 + punpcklqdq m0, m0 ; splat H (words) + punpcklqdq m1, m1 ; splat V (words) + punpcklqdq m3, m3 ; splat a (words) +%endif +%ifidn %3, svq3 + SWAP 0, 1 +%endif + mova m2, m0 +%if mmsize == 8 + mova m5, m0 +%endif + pmullw m0, [pw_0to7] ; 0*H, 1*H, ..., 7*H (words) +%if mmsize == 16 + psllw m2, 3 +%else + psllw m5, 3 + psllw m2, 2 + mova m6, m5 + paddw m6, m2 +%endif + paddw m0, m3 ; a + {0,1,2,3,4,5,6,7}*H + paddw m2, m0 ; a + {8,9,10,11,12,13,14,15}*H +%if mmsize == 8 + paddw m5, m0 ; a + {8,9,10,11}*H + paddw m6, m0 ; a + {12,13,14,15}*H +%endif + + mov r4, 8 +.loop + mova m3, m0 ; b[0..7] + mova m4, m2 ; b[8..15] + psraw m3, 5 + psraw m4, 5 + packuswb m3, m4 + mova [r0], m3 +%if mmsize == 8 + mova m3, m5 ; b[8..11] + mova m4, m6 ; b[12..15] + psraw m3, 5 + psraw m4, 5 + packuswb m3, m4 + mova [r0+8], m3 +%endif + paddw m0, m1 + paddw m2, m1 +%if mmsize == 8 + paddw m5, m1 + paddw m6, m1 +%endif + + mova m3, m0 ; b[0..7] + mova m4, m2 ; b[8..15] + psraw m3, 5 + psraw m4, 5 + packuswb m3, m4 + mova [r0+r2], m3 +%if mmsize == 8 + mova m3, m5 ; b[8..11] + mova m4, m6 ; b[12..15] + psraw m3, 5 + psraw m4, 5 + packuswb m3, m4 + mova [r0+r2+8], m3 +%endif + paddw m0, m1 + paddw m2, m1 +%if mmsize == 8 + paddw m5, m1 + paddw m6, m1 +%endif + + lea r0, [r0+r2*2] + dec r4 + jg .loop + REP_RET +%endmacro + +INIT_MMX +H264_PRED16x16_PLANE mmx, 0, h264 +H264_PRED16x16_PLANE mmx, 0, rv40 +H264_PRED16x16_PLANE mmx, 0, svq3 +H264_PRED16x16_PLANE mmx2, 0, h264 +H264_PRED16x16_PLANE mmx2, 0, rv40 +H264_PRED16x16_PLANE mmx2, 0, svq3 +INIT_XMM +H264_PRED16x16_PLANE sse2, 8, h264 +H264_PRED16x16_PLANE sse2, 8, rv40 +H264_PRED16x16_PLANE sse2, 8, svq3 +H264_PRED16x16_PLANE ssse3, 8, h264 +H264_PRED16x16_PLANE ssse3, 8, rv40 +H264_PRED16x16_PLANE ssse3, 8, svq3 + +;----------------------------------------------------------------------------- +; void pred8x8_plane(uint8_t *src, int stride) +;----------------------------------------------------------------------------- + +%macro H264_PRED8x8_PLANE 2 +cglobal pred8x8_plane_%1, 2, 7, %2 + mov r2, r1 ; +stride + neg r1 ; -stride + + movd m0, [r0+r1 -1] +%if mmsize == 8 + pxor m2, m2 + movh m1, [r0+r1 +4 ] + punpcklbw m0, m2 + punpcklbw m1, m2 + pmullw m0, [pw_m4to4] + pmullw m1, [pw_m4to4+8] +%else ; mmsize == 16 +%ifidn %1, sse2 + pxor m2, m2 + movd m1, [r0+r1 +4] + punpckldq m0, m1 + punpcklbw m0, m2 + pmullw m0, [pw_m4to4] +%else ; ssse3 + movhps m0, [r0+r1 +4] ; this reads 4 bytes more than necessary + pmaddubsw m0, [plane8_shuf] ; H coefficients +%endif + movhlps m1, m0 +%endif + paddw m0, m1 + +%ifnidn %1, ssse3 +%ifidn %1, mmx + mova m1, m0 + psrlq m1, 32 +%elifidn %1, mmx2 + pshufw m1, m0, 0xE +%else ; mmsize == 16 + pshuflw m1, m0, 0xE +%endif + paddw m0, m1 +%endif ; !ssse3 + +%ifidn %1, mmx + mova m1, m0 + psrlq m1, 16 +%elifidn %1, mmx2 + pshufw m1, m0, 0x1 +%else + pshuflw m1, m0, 0x1 +%endif + paddw m0, m1 ; sum of H coefficients + + pmullw m0, [pw_17] + paddw m0, [pw_16] + psraw m0, 5 + + lea r4, [r0+r2*4-1] + lea r3, [r0 -1] + add r4, r2 + +%ifdef ARCH_X86_64 +%define e_reg r11 +%else +%define e_reg r0 +%endif + + movzx e_reg, byte [r3+r2*2 ] + movzx r5, byte [r4+r1 ] + sub r5, e_reg + + movzx e_reg, byte [r3 ] +%ifdef ARCH_X86_64 + movzx r10, byte [r4+r2 ] + sub r10, e_reg + sub r5, r10 +%else + movzx r6, byte [r4+r2 ] + sub r6, e_reg + lea r5, [r5+r6*4] + sub r5, r6 +%endif + + movzx e_reg, byte [r3+r1 ] + movzx r6, byte [r4+r2*2 ] + sub r6, e_reg +%ifdef ARCH_X86_64 + add r6, r10 +%endif + lea r5, [r5+r6*4] + + movzx e_reg, byte [r3+r2 ] + movzx r6, byte [r4 ] + sub r6, e_reg + lea r6, [r5+r6*2] + + lea r5, [r6*9+16] + lea r5, [r5+r6*8] + sar r5, 5 + +%ifndef ARCH_X86_64 + mov r0, r0m +%endif + + movzx r3, byte [r4+r2*2 ] + movzx r4, byte [r0+r1 +7] + lea r3, [r3+r4+1] + shl r3, 4 + movd r1d, m0 + movsx r1d, r1w + add r1d, r5d + sub r3d, r1d + add r1d, r1d + sub r3d, r1d ; a + + movd m1, r5d + movd m3, r3d +%ifidn %1, mmx + punpcklwd m0, m0 + punpcklwd m1, m1 + punpcklwd m3, m3 + punpckldq m0, m0 + punpckldq m1, m1 + punpckldq m3, m3 +%elifidn %1, mmx2 + pshufw m0, m0, 0x0 + pshufw m1, m1, 0x0 + pshufw m3, m3, 0x0 +%else + pshuflw m0, m0, 0x0 + pshuflw m1, m1, 0x0 + pshuflw m3, m3, 0x0 + punpcklqdq m0, m0 ; splat H (words) + punpcklqdq m1, m1 ; splat V (words) + punpcklqdq m3, m3 ; splat a (words) +%endif +%if mmsize == 8 + mova m2, m0 +%endif + pmullw m0, [pw_0to7] ; 0*H, 1*H, ..., 7*H (words) + paddw m0, m3 ; a + {0,1,2,3,4,5,6,7}*H +%if mmsize == 8 + psllw m2, 2 + paddw m2, m0 ; a + {4,5,6,7}*H +%endif + + mov r4, 4 +ALIGN 16 +.loop +%if mmsize == 16 + mova m3, m0 ; b[0..7] + paddw m0, m1 + psraw m3, 5 + mova m4, m0 ; V+b[0..7] + paddw m0, m1 + psraw m4, 5 + packuswb m3, m4 + movh [r0], m3 + movhps [r0+r2], m3 +%else ; mmsize == 8 + mova m3, m0 ; b[0..3] + mova m4, m2 ; b[4..7] + paddw m0, m1 + paddw m2, m1 + psraw m3, 5 + psraw m4, 5 + mova m5, m0 ; V+b[0..3] + mova m6, m2 ; V+b[4..7] + paddw m0, m1 + paddw m2, m1 + psraw m5, 5 + psraw m6, 5 + packuswb m3, m4 + packuswb m5, m6 + mova [r0], m3 + mova [r0+r2], m5 +%endif + + lea r0, [r0+r2*2] + dec r4 + jg .loop + REP_RET +%endmacro + +INIT_MMX +H264_PRED8x8_PLANE mmx, 0 +H264_PRED8x8_PLANE mmx2, 0 +INIT_XMM +H264_PRED8x8_PLANE sse2, 8 +H264_PRED8x8_PLANE ssse3, 8 + +;----------------------------------------------------------------------------- ; void pred8x8_vertical(uint8_t *src, int stride) ;----------------------------------------------------------------------------- diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_intrapred_init.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_intrapred_init.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_intrapred_init.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_intrapred_init.c 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2010 Jason Garrett-Glaser + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/cpu.h" +#include "libavcodec/h264pred.h" + +void ff_pred16x16_vertical_mmx (uint8_t *src, int stride); +void ff_pred16x16_vertical_sse (uint8_t *src, int stride); +void ff_pred16x16_horizontal_mmx (uint8_t *src, int stride); +void ff_pred16x16_horizontal_mmxext(uint8_t *src, int stride); +void ff_pred16x16_horizontal_ssse3 (uint8_t *src, int stride); +void ff_pred16x16_dc_mmxext (uint8_t *src, int stride); +void ff_pred16x16_dc_sse2 (uint8_t *src, int stride); +void ff_pred16x16_dc_ssse3 (uint8_t *src, int stride); +void ff_pred16x16_plane_h264_mmx (uint8_t *src, int stride); +void ff_pred16x16_plane_h264_mmx2 (uint8_t *src, int stride); +void ff_pred16x16_plane_h264_sse2 (uint8_t *src, int stride); +void ff_pred16x16_plane_h264_ssse3 (uint8_t *src, int stride); +void ff_pred16x16_plane_rv40_mmx (uint8_t *src, int stride); +void ff_pred16x16_plane_rv40_mmx2 (uint8_t *src, int stride); +void ff_pred16x16_plane_rv40_sse2 (uint8_t *src, int stride); +void ff_pred16x16_plane_rv40_ssse3 (uint8_t *src, int stride); +void ff_pred16x16_plane_svq3_mmx (uint8_t *src, int stride); +void ff_pred16x16_plane_svq3_mmx2 (uint8_t *src, int stride); +void ff_pred16x16_plane_svq3_sse2 (uint8_t *src, int stride); +void ff_pred16x16_plane_svq3_ssse3 (uint8_t *src, int stride); +void ff_pred16x16_tm_vp8_mmx (uint8_t *src, int stride); +void ff_pred16x16_tm_vp8_mmxext (uint8_t *src, int stride); +void ff_pred16x16_tm_vp8_sse2 (uint8_t *src, int stride); +void ff_pred8x8_dc_rv40_mmxext (uint8_t *src, int stride); +void ff_pred8x8_vertical_mmx (uint8_t *src, int stride); +void ff_pred8x8_horizontal_mmx (uint8_t *src, int stride); +void ff_pred8x8_horizontal_mmxext (uint8_t *src, int stride); +void ff_pred8x8_horizontal_ssse3 (uint8_t *src, int stride); +void ff_pred8x8_plane_mmx (uint8_t *src, int stride); +void ff_pred8x8_plane_mmx2 (uint8_t *src, int stride); +void ff_pred8x8_plane_sse2 (uint8_t *src, int stride); +void ff_pred8x8_plane_ssse3 (uint8_t *src, int stride); +void ff_pred8x8_tm_vp8_mmx (uint8_t *src, int stride); +void ff_pred8x8_tm_vp8_mmxext (uint8_t *src, int stride); +void ff_pred8x8_tm_vp8_sse2 (uint8_t *src, int stride); +void ff_pred8x8_tm_vp8_ssse3 (uint8_t *src, int stride); +void ff_pred4x4_dc_mmxext (uint8_t *src, const uint8_t *topright, int stride); +void ff_pred4x4_tm_vp8_mmx (uint8_t *src, const uint8_t *topright, int stride); +void ff_pred4x4_tm_vp8_mmxext (uint8_t *src, const uint8_t *topright, int stride); +void ff_pred4x4_tm_vp8_ssse3 (uint8_t *src, const uint8_t *topright, int stride); +void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int stride); + +void ff_h264_pred_init_x86(H264PredContext *h, int codec_id) +{ + int mm_flags = av_get_cpu_flags(); + +#if HAVE_YASM + if (mm_flags & AV_CPU_FLAG_MMX) { + h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_mmx; + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx; + h->pred8x8 [VERT_PRED8x8] = ff_pred8x8_vertical_mmx; + h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx; + if (codec_id == CODEC_ID_VP8) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmx; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmx; + h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx; + } else { + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx; + if (codec_id == CODEC_ID_SVQ3) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx; + } else if (codec_id == CODEC_ID_RV40) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx; + } else { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx; + } + } + } + + if (mm_flags & AV_CPU_FLAG_MMX2) { + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext; + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmxext; + h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext; + h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext; + if (codec_id == CODEC_ID_VP8) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmxext; + h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmxext; + h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmxext; + h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext; + } else { + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2; + if (codec_id == CODEC_ID_SVQ3) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx2; + } else if (codec_id == CODEC_ID_RV40) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx2; + } else { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx2; + } + } + } + + if (mm_flags & AV_CPU_FLAG_SSE) { + h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse; + } + + if (mm_flags & AV_CPU_FLAG_SSE2) { + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2; + if (codec_id == CODEC_ID_VP8) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2; + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2; + } else { + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_sse2; + if (codec_id == CODEC_ID_SVQ3) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2; + } else if (codec_id == CODEC_ID_RV40) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2; + } else { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2; + } + } + } + + if (mm_flags & AV_CPU_FLAG_SSSE3) { + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3; + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3; + h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3; + if (codec_id == CODEC_ID_VP8) { + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_ssse3; + h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3; + } else { + h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3; + if (codec_id == CODEC_ID_SVQ3) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3; + } else if (codec_id == CODEC_ID_RV40) { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3; + } else { + h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3; + } + } + } +#endif +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_qpel_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_qpel_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_qpel_mmx.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_qpel_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,1201 @@ +/* + * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "dsputil_mmx.h" + +/***********************************/ +/* motion compensation */ + +#define QPEL_H264V_MM(A,B,C,D,E,F,OP,T,Z,d,q)\ + "mov"#q" "#C", "#T" \n\t"\ + "mov"#d" (%0), "#F" \n\t"\ + "paddw "#D", "#T" \n\t"\ + "psllw $2, "#T" \n\t"\ + "psubw "#B", "#T" \n\t"\ + "psubw "#E", "#T" \n\t"\ + "punpcklbw "#Z", "#F" \n\t"\ + "pmullw "MANGLE(ff_pw_5)", "#T"\n\t"\ + "paddw "MANGLE(ff_pw_16)", "#A"\n\t"\ + "add %2, %0 \n\t"\ + "paddw "#F", "#A" \n\t"\ + "paddw "#A", "#T" \n\t"\ + "psraw $5, "#T" \n\t"\ + "packuswb "#T", "#T" \n\t"\ + OP(T, (%1), A, d)\ + "add %3, %1 \n\t" + +#define QPEL_H264HV_MM(A,B,C,D,E,F,OF,T,Z,d,q)\ + "mov"#q" "#C", "#T" \n\t"\ + "mov"#d" (%0), "#F" \n\t"\ + "paddw "#D", "#T" \n\t"\ + "psllw $2, "#T" \n\t"\ + "paddw "MANGLE(ff_pw_16)", "#A"\n\t"\ + "psubw "#B", "#T" \n\t"\ + "psubw "#E", "#T" \n\t"\ + "punpcklbw "#Z", "#F" \n\t"\ + "pmullw "MANGLE(ff_pw_5)", "#T"\n\t"\ + "paddw "#F", "#A" \n\t"\ + "add %2, %0 \n\t"\ + "paddw "#A", "#T" \n\t"\ + "mov"#q" "#T", "#OF"(%1) \n\t" + +#define QPEL_H264V(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%mm6,%%mm7,d,q) +#define QPEL_H264HV(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%mm6,%%mm7,d,q) +#define QPEL_H264V_XMM(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%xmm6,%%xmm7,q,dqa) +#define QPEL_H264HV_XMM(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%xmm6,%%xmm7,q,dqa) + + +#define QPEL_H264(OPNAME, OP, MMX)\ +static av_noinline void OPNAME ## h264_qpel4_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + int h=4;\ +\ + __asm__ volatile(\ + "pxor %%mm7, %%mm7 \n\t"\ + "movq "MANGLE(ff_pw_5) ", %%mm4\n\t"\ + "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\ + "1: \n\t"\ + "movd -1(%0), %%mm1 \n\t"\ + "movd (%0), %%mm2 \n\t"\ + "movd 1(%0), %%mm3 \n\t"\ + "movd 2(%0), %%mm0 \n\t"\ + "punpcklbw %%mm7, %%mm1 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpcklbw %%mm7, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "paddw %%mm0, %%mm1 \n\t"\ + "paddw %%mm3, %%mm2 \n\t"\ + "movd -2(%0), %%mm0 \n\t"\ + "movd 3(%0), %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "punpcklbw %%mm7, %%mm3 \n\t"\ + "paddw %%mm3, %%mm0 \n\t"\ + "psllw $2, %%mm2 \n\t"\ + "psubw %%mm1, %%mm2 \n\t"\ + "pmullw %%mm4, %%mm2 \n\t"\ + "paddw %%mm5, %%mm0 \n\t"\ + "paddw %%mm2, %%mm0 \n\t"\ + "psraw $5, %%mm0 \n\t"\ + "packuswb %%mm0, %%mm0 \n\t"\ + OP(%%mm0, (%1),%%mm6, d)\ + "add %3, %0 \n\t"\ + "add %4, %1 \n\t"\ + "decl %2 \n\t"\ + " jnz 1b \n\t"\ + : "+a"(src), "+c"(dst), "+g"(h)\ + : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\ + : "memory"\ + );\ +}\ +static av_noinline void OPNAME ## h264_qpel4_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ + int h=4;\ + __asm__ volatile(\ + "pxor %%mm7, %%mm7 \n\t"\ + "movq %0, %%mm4 \n\t"\ + "movq %1, %%mm5 \n\t"\ + :: "m"(ff_pw_5), "m"(ff_pw_16)\ + );\ + do{\ + __asm__ volatile(\ + "movd -1(%0), %%mm1 \n\t"\ + "movd (%0), %%mm2 \n\t"\ + "movd 1(%0), %%mm3 \n\t"\ + "movd 2(%0), %%mm0 \n\t"\ + "punpcklbw %%mm7, %%mm1 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpcklbw %%mm7, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "paddw %%mm0, %%mm1 \n\t"\ + "paddw %%mm3, %%mm2 \n\t"\ + "movd -2(%0), %%mm0 \n\t"\ + "movd 3(%0), %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "punpcklbw %%mm7, %%mm3 \n\t"\ + "paddw %%mm3, %%mm0 \n\t"\ + "psllw $2, %%mm2 \n\t"\ + "psubw %%mm1, %%mm2 \n\t"\ + "pmullw %%mm4, %%mm2 \n\t"\ + "paddw %%mm5, %%mm0 \n\t"\ + "paddw %%mm2, %%mm0 \n\t"\ + "movd (%2), %%mm3 \n\t"\ + "psraw $5, %%mm0 \n\t"\ + "packuswb %%mm0, %%mm0 \n\t"\ + PAVGB" %%mm3, %%mm0 \n\t"\ + OP(%%mm0, (%1),%%mm6, d)\ + "add %4, %0 \n\t"\ + "add %4, %1 \n\t"\ + "add %3, %2 \n\t"\ + : "+a"(src), "+c"(dst), "+d"(src2)\ + : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride)\ + : "memory"\ + );\ + }while(--h);\ +}\ +static av_noinline void OPNAME ## h264_qpel4_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + src -= 2*srcStride;\ + __asm__ volatile(\ + "pxor %%mm7, %%mm7 \n\t"\ + "movd (%0), %%mm0 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm1 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm2 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm3 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm4 \n\t"\ + "add %2, %0 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "punpcklbw %%mm7, %%mm1 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpcklbw %%mm7, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm4 \n\t"\ + QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\ + QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\ + QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\ + QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\ + \ + : "+a"(src), "+c"(dst)\ + : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\ + : "memory"\ + );\ +}\ +static av_noinline void OPNAME ## h264_qpel4_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ + int h=4;\ + int w=3;\ + src -= 2*srcStride+2;\ + while(w--){\ + __asm__ volatile(\ + "pxor %%mm7, %%mm7 \n\t"\ + "movd (%0), %%mm0 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm1 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm2 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm3 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm4 \n\t"\ + "add %2, %0 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "punpcklbw %%mm7, %%mm1 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpcklbw %%mm7, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm4 \n\t"\ + QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*3)\ + QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*3)\ + QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*3)\ + QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*3)\ + \ + : "+a"(src)\ + : "c"(tmp), "S"((x86_reg)srcStride)\ + : "memory"\ + );\ + tmp += 4;\ + src += 4 - 9*srcStride;\ + }\ + tmp -= 3*4;\ + __asm__ volatile(\ + "1: \n\t"\ + "movq (%0), %%mm0 \n\t"\ + "paddw 10(%0), %%mm0 \n\t"\ + "movq 2(%0), %%mm1 \n\t"\ + "paddw 8(%0), %%mm1 \n\t"\ + "movq 4(%0), %%mm2 \n\t"\ + "paddw 6(%0), %%mm2 \n\t"\ + "psubw %%mm1, %%mm0 \n\t"/*a-b (abccba)*/\ + "psraw $2, %%mm0 \n\t"/*(a-b)/4 */\ + "psubw %%mm1, %%mm0 \n\t"/*(a-b)/4-b */\ + "paddsw %%mm2, %%mm0 \n\t"\ + "psraw $2, %%mm0 \n\t"/*((a-b)/4-b+c)/4 */\ + "paddw %%mm2, %%mm0 \n\t"/*(a-5*b+20*c)/16 */\ + "psraw $6, %%mm0 \n\t"\ + "packuswb %%mm0, %%mm0 \n\t"\ + OP(%%mm0, (%1),%%mm7, d)\ + "add $24, %0 \n\t"\ + "add %3, %1 \n\t"\ + "decl %2 \n\t"\ + " jnz 1b \n\t"\ + : "+a"(tmp), "+c"(dst), "+g"(h)\ + : "S"((x86_reg)dstStride)\ + : "memory"\ + );\ +}\ +\ +static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + int h=8;\ + __asm__ volatile(\ + "pxor %%mm7, %%mm7 \n\t"\ + "movq "MANGLE(ff_pw_5)", %%mm6\n\t"\ + "1: \n\t"\ + "movq (%0), %%mm0 \n\t"\ + "movq 1(%0), %%mm2 \n\t"\ + "movq %%mm0, %%mm1 \n\t"\ + "movq %%mm2, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "punpckhbw %%mm7, %%mm1 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpckhbw %%mm7, %%mm3 \n\t"\ + "paddw %%mm2, %%mm0 \n\t"\ + "paddw %%mm3, %%mm1 \n\t"\ + "psllw $2, %%mm0 \n\t"\ + "psllw $2, %%mm1 \n\t"\ + "movq -1(%0), %%mm2 \n\t"\ + "movq 2(%0), %%mm4 \n\t"\ + "movq %%mm2, %%mm3 \n\t"\ + "movq %%mm4, %%mm5 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpckhbw %%mm7, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm4 \n\t"\ + "punpckhbw %%mm7, %%mm5 \n\t"\ + "paddw %%mm4, %%mm2 \n\t"\ + "paddw %%mm3, %%mm5 \n\t"\ + "psubw %%mm2, %%mm0 \n\t"\ + "psubw %%mm5, %%mm1 \n\t"\ + "pmullw %%mm6, %%mm0 \n\t"\ + "pmullw %%mm6, %%mm1 \n\t"\ + "movd -2(%0), %%mm2 \n\t"\ + "movd 7(%0), %%mm5 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpcklbw %%mm7, %%mm5 \n\t"\ + "paddw %%mm3, %%mm2 \n\t"\ + "paddw %%mm5, %%mm4 \n\t"\ + "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\ + "paddw %%mm5, %%mm2 \n\t"\ + "paddw %%mm5, %%mm4 \n\t"\ + "paddw %%mm2, %%mm0 \n\t"\ + "paddw %%mm4, %%mm1 \n\t"\ + "psraw $5, %%mm0 \n\t"\ + "psraw $5, %%mm1 \n\t"\ + "packuswb %%mm1, %%mm0 \n\t"\ + OP(%%mm0, (%1),%%mm5, q)\ + "add %3, %0 \n\t"\ + "add %4, %1 \n\t"\ + "decl %2 \n\t"\ + " jnz 1b \n\t"\ + : "+a"(src), "+c"(dst), "+g"(h)\ + : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\ + : "memory"\ + );\ +}\ +\ +static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ + int h=8;\ + __asm__ volatile(\ + "pxor %%mm7, %%mm7 \n\t"\ + "movq "MANGLE(ff_pw_5)", %%mm6\n\t"\ + "1: \n\t"\ + "movq (%0), %%mm0 \n\t"\ + "movq 1(%0), %%mm2 \n\t"\ + "movq %%mm0, %%mm1 \n\t"\ + "movq %%mm2, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "punpckhbw %%mm7, %%mm1 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpckhbw %%mm7, %%mm3 \n\t"\ + "paddw %%mm2, %%mm0 \n\t"\ + "paddw %%mm3, %%mm1 \n\t"\ + "psllw $2, %%mm0 \n\t"\ + "psllw $2, %%mm1 \n\t"\ + "movq -1(%0), %%mm2 \n\t"\ + "movq 2(%0), %%mm4 \n\t"\ + "movq %%mm2, %%mm3 \n\t"\ + "movq %%mm4, %%mm5 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpckhbw %%mm7, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm4 \n\t"\ + "punpckhbw %%mm7, %%mm5 \n\t"\ + "paddw %%mm4, %%mm2 \n\t"\ + "paddw %%mm3, %%mm5 \n\t"\ + "psubw %%mm2, %%mm0 \n\t"\ + "psubw %%mm5, %%mm1 \n\t"\ + "pmullw %%mm6, %%mm0 \n\t"\ + "pmullw %%mm6, %%mm1 \n\t"\ + "movd -2(%0), %%mm2 \n\t"\ + "movd 7(%0), %%mm5 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpcklbw %%mm7, %%mm5 \n\t"\ + "paddw %%mm3, %%mm2 \n\t"\ + "paddw %%mm5, %%mm4 \n\t"\ + "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\ + "paddw %%mm5, %%mm2 \n\t"\ + "paddw %%mm5, %%mm4 \n\t"\ + "paddw %%mm2, %%mm0 \n\t"\ + "paddw %%mm4, %%mm1 \n\t"\ + "psraw $5, %%mm0 \n\t"\ + "psraw $5, %%mm1 \n\t"\ + "movq (%2), %%mm4 \n\t"\ + "packuswb %%mm1, %%mm0 \n\t"\ + PAVGB" %%mm4, %%mm0 \n\t"\ + OP(%%mm0, (%1),%%mm5, q)\ + "add %5, %0 \n\t"\ + "add %5, %1 \n\t"\ + "add %4, %2 \n\t"\ + "decl %3 \n\t"\ + "jg 1b \n\t"\ + : "+a"(src), "+c"(dst), "+d"(src2), "+g"(h)\ + : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride)\ + : "memory"\ + );\ +}\ +\ +static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ + int w= 2;\ + src -= 2*srcStride;\ + \ + while(w--){\ + __asm__ volatile(\ + "pxor %%mm7, %%mm7 \n\t"\ + "movd (%0), %%mm0 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm1 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm2 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm3 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm4 \n\t"\ + "add %2, %0 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "punpcklbw %%mm7, %%mm1 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpcklbw %%mm7, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm4 \n\t"\ + QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\ + QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\ + QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\ + QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\ + QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\ + QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\ + QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\ + QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\ + "cmpl $16, %4 \n\t"\ + "jne 2f \n\t"\ + QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\ + QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\ + QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\ + QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\ + QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\ + QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\ + QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\ + QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\ + "2: \n\t"\ + \ + : "+a"(src), "+c"(dst)\ + : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "g"(h)\ + : "memory"\ + );\ + src += 4-(h+5)*srcStride;\ + dst += 4-h*dstStride;\ + }\ +}\ +static av_always_inline void OPNAME ## h264_qpel8or16_hv1_lowpass_ ## MMX(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){\ + int w = (size+8)>>2;\ + src -= 2*srcStride+2;\ + while(w--){\ + __asm__ volatile(\ + "pxor %%mm7, %%mm7 \n\t"\ + "movd (%0), %%mm0 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm1 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm2 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm3 \n\t"\ + "add %2, %0 \n\t"\ + "movd (%0), %%mm4 \n\t"\ + "add %2, %0 \n\t"\ + "punpcklbw %%mm7, %%mm0 \n\t"\ + "punpcklbw %%mm7, %%mm1 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpcklbw %%mm7, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm4 \n\t"\ + QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*48)\ + QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*48)\ + QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*48)\ + QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*48)\ + QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 4*48)\ + QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 5*48)\ + QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 6*48)\ + QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 7*48)\ + "cmpl $16, %3 \n\t"\ + "jne 2f \n\t"\ + QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 8*48)\ + QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 9*48)\ + QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 10*48)\ + QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 11*48)\ + QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 12*48)\ + QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 13*48)\ + QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 14*48)\ + QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 15*48)\ + "2: \n\t"\ + : "+a"(src)\ + : "c"(tmp), "S"((x86_reg)srcStride), "g"(size)\ + : "memory"\ + );\ + tmp += 4;\ + src += 4 - (size+5)*srcStride;\ + }\ +}\ +static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\ + int w = size>>4;\ + do{\ + int h = size;\ + __asm__ volatile(\ + "1: \n\t"\ + "movq (%0), %%mm0 \n\t"\ + "movq 8(%0), %%mm3 \n\t"\ + "movq 2(%0), %%mm1 \n\t"\ + "movq 10(%0), %%mm4 \n\t"\ + "paddw %%mm4, %%mm0 \n\t"\ + "paddw %%mm3, %%mm1 \n\t"\ + "paddw 18(%0), %%mm3 \n\t"\ + "paddw 16(%0), %%mm4 \n\t"\ + "movq 4(%0), %%mm2 \n\t"\ + "movq 12(%0), %%mm5 \n\t"\ + "paddw 6(%0), %%mm2 \n\t"\ + "paddw 14(%0), %%mm5 \n\t"\ + "psubw %%mm1, %%mm0 \n\t"\ + "psubw %%mm4, %%mm3 \n\t"\ + "psraw $2, %%mm0 \n\t"\ + "psraw $2, %%mm3 \n\t"\ + "psubw %%mm1, %%mm0 \n\t"\ + "psubw %%mm4, %%mm3 \n\t"\ + "paddsw %%mm2, %%mm0 \n\t"\ + "paddsw %%mm5, %%mm3 \n\t"\ + "psraw $2, %%mm0 \n\t"\ + "psraw $2, %%mm3 \n\t"\ + "paddw %%mm2, %%mm0 \n\t"\ + "paddw %%mm5, %%mm3 \n\t"\ + "psraw $6, %%mm0 \n\t"\ + "psraw $6, %%mm3 \n\t"\ + "packuswb %%mm3, %%mm0 \n\t"\ + OP(%%mm0, (%1),%%mm7, q)\ + "add $48, %0 \n\t"\ + "add %3, %1 \n\t"\ + "decl %2 \n\t"\ + " jnz 1b \n\t"\ + : "+a"(tmp), "+c"(dst), "+g"(h)\ + : "S"((x86_reg)dstStride)\ + : "memory"\ + );\ + tmp += 8 - size*24;\ + dst += 8 - size*dstStride;\ + }while(w--);\ +}\ +\ +static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\ +}\ +static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\ + OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\ +}\ +\ +static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\ + OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\ + src += 8*srcStride;\ + dst += 8*dstStride;\ + OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\ + OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\ +}\ +\ +static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ + OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\ + OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\ + src += 8*dstStride;\ + dst += 8*dstStride;\ + src2 += 8*src2Stride;\ + OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\ + OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\ +}\ +\ +static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\ + put_h264_qpel8or16_hv1_lowpass_ ## MMX(tmp, src, tmpStride, srcStride, size);\ + OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\ +}\ +static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ + OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 8);\ +}\ +\ +static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ + OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 16);\ +}\ +\ +static av_noinline void OPNAME ## pixels4_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\ +{\ + __asm__ volatile(\ + "movq (%1), %%mm0 \n\t"\ + "movq 24(%1), %%mm1 \n\t"\ + "psraw $5, %%mm0 \n\t"\ + "psraw $5, %%mm1 \n\t"\ + "packuswb %%mm0, %%mm0 \n\t"\ + "packuswb %%mm1, %%mm1 \n\t"\ + PAVGB" (%0), %%mm0 \n\t"\ + PAVGB" (%0,%3), %%mm1 \n\t"\ + OP(%%mm0, (%2), %%mm4, d)\ + OP(%%mm1, (%2,%4), %%mm5, d)\ + "lea (%0,%3,2), %0 \n\t"\ + "lea (%2,%4,2), %2 \n\t"\ + "movq 48(%1), %%mm0 \n\t"\ + "movq 72(%1), %%mm1 \n\t"\ + "psraw $5, %%mm0 \n\t"\ + "psraw $5, %%mm1 \n\t"\ + "packuswb %%mm0, %%mm0 \n\t"\ + "packuswb %%mm1, %%mm1 \n\t"\ + PAVGB" (%0), %%mm0 \n\t"\ + PAVGB" (%0,%3), %%mm1 \n\t"\ + OP(%%mm0, (%2), %%mm4, d)\ + OP(%%mm1, (%2,%4), %%mm5, d)\ + :"+a"(src8), "+c"(src16), "+d"(dst)\ + :"S"((x86_reg)src8Stride), "D"((x86_reg)dstStride)\ + :"memory");\ +}\ +static av_noinline void OPNAME ## pixels8_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\ +{\ + do{\ + __asm__ volatile(\ + "movq (%1), %%mm0 \n\t"\ + "movq 8(%1), %%mm1 \n\t"\ + "movq 48(%1), %%mm2 \n\t"\ + "movq 8+48(%1), %%mm3 \n\t"\ + "psraw $5, %%mm0 \n\t"\ + "psraw $5, %%mm1 \n\t"\ + "psraw $5, %%mm2 \n\t"\ + "psraw $5, %%mm3 \n\t"\ + "packuswb %%mm1, %%mm0 \n\t"\ + "packuswb %%mm3, %%mm2 \n\t"\ + PAVGB" (%0), %%mm0 \n\t"\ + PAVGB" (%0,%3), %%mm2 \n\t"\ + OP(%%mm0, (%2), %%mm5, q)\ + OP(%%mm2, (%2,%4), %%mm5, q)\ + ::"a"(src8), "c"(src16), "d"(dst),\ + "r"((x86_reg)src8Stride), "r"((x86_reg)dstStride)\ + :"memory");\ + src8 += 2L*src8Stride;\ + src16 += 48;\ + dst += 2L*dstStride;\ + }while(h-=2);\ +}\ +static void OPNAME ## pixels16_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\ +{\ + OPNAME ## pixels8_l2_shift5_ ## MMX(dst , src16 , src8 , dstStride, src8Stride, h);\ + OPNAME ## pixels8_l2_shift5_ ## MMX(dst+8, src16+8, src8+8, dstStride, src8Stride, h);\ +}\ + + +#if ARCH_X86_64 +#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\ +static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ + int h=16;\ + __asm__ volatile(\ + "pxor %%xmm15, %%xmm15 \n\t"\ + "movdqa %6, %%xmm14 \n\t"\ + "movdqa %7, %%xmm13 \n\t"\ + "1: \n\t"\ + "lddqu 6(%0), %%xmm1 \n\t"\ + "lddqu -2(%0), %%xmm7 \n\t"\ + "movdqa %%xmm1, %%xmm0 \n\t"\ + "punpckhbw %%xmm15, %%xmm1 \n\t"\ + "punpcklbw %%xmm15, %%xmm0 \n\t"\ + "punpcklbw %%xmm15, %%xmm7 \n\t"\ + "movdqa %%xmm1, %%xmm2 \n\t"\ + "movdqa %%xmm0, %%xmm6 \n\t"\ + "movdqa %%xmm1, %%xmm3 \n\t"\ + "movdqa %%xmm0, %%xmm8 \n\t"\ + "movdqa %%xmm1, %%xmm4 \n\t"\ + "movdqa %%xmm0, %%xmm9 \n\t"\ + "movdqa %%xmm0, %%xmm12 \n\t"\ + "movdqa %%xmm1, %%xmm11 \n\t"\ + "palignr $10,%%xmm0, %%xmm11\n\t"\ + "palignr $10,%%xmm7, %%xmm12\n\t"\ + "palignr $2, %%xmm0, %%xmm4 \n\t"\ + "palignr $2, %%xmm7, %%xmm9 \n\t"\ + "palignr $4, %%xmm0, %%xmm3 \n\t"\ + "palignr $4, %%xmm7, %%xmm8 \n\t"\ + "palignr $6, %%xmm0, %%xmm2 \n\t"\ + "palignr $6, %%xmm7, %%xmm6 \n\t"\ + "paddw %%xmm0 ,%%xmm11 \n\t"\ + "palignr $8, %%xmm0, %%xmm1 \n\t"\ + "palignr $8, %%xmm7, %%xmm0 \n\t"\ + "paddw %%xmm12,%%xmm7 \n\t"\ + "paddw %%xmm3, %%xmm2 \n\t"\ + "paddw %%xmm8, %%xmm6 \n\t"\ + "paddw %%xmm4, %%xmm1 \n\t"\ + "paddw %%xmm9, %%xmm0 \n\t"\ + "psllw $2, %%xmm2 \n\t"\ + "psllw $2, %%xmm6 \n\t"\ + "psubw %%xmm1, %%xmm2 \n\t"\ + "psubw %%xmm0, %%xmm6 \n\t"\ + "paddw %%xmm13,%%xmm11 \n\t"\ + "paddw %%xmm13,%%xmm7 \n\t"\ + "pmullw %%xmm14,%%xmm2 \n\t"\ + "pmullw %%xmm14,%%xmm6 \n\t"\ + "lddqu (%2), %%xmm3 \n\t"\ + "paddw %%xmm11,%%xmm2 \n\t"\ + "paddw %%xmm7, %%xmm6 \n\t"\ + "psraw $5, %%xmm2 \n\t"\ + "psraw $5, %%xmm6 \n\t"\ + "packuswb %%xmm2,%%xmm6 \n\t"\ + "pavgb %%xmm3, %%xmm6 \n\t"\ + OP(%%xmm6, (%1), %%xmm4, dqa)\ + "add %5, %0 \n\t"\ + "add %5, %1 \n\t"\ + "add %4, %2 \n\t"\ + "decl %3 \n\t"\ + "jg 1b \n\t"\ + : "+a"(src), "+c"(dst), "+d"(src2), "+g"(h)\ + : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride),\ + "m"(ff_pw_5), "m"(ff_pw_16)\ + : XMM_CLOBBERS("%xmm0" , "%xmm1" , "%xmm2" , "%xmm3" , \ + "%xmm4" , "%xmm5" , "%xmm6" , "%xmm7" , \ + "%xmm8" , "%xmm9" , "%xmm10", "%xmm11", \ + "%xmm12", "%xmm13", "%xmm14", "%xmm15",)\ + "memory"\ + );\ +} +#else // ARCH_X86_64 +#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\ +static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ + OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\ + OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\ + src += 8*dstStride;\ + dst += 8*dstStride;\ + src2 += 8*src2Stride;\ + OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\ + OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\ +} +#endif // ARCH_X86_64 + +#define QPEL_H264_H_XMM(OPNAME, OP, MMX)\ +static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\ + int h=8;\ + __asm__ volatile(\ + "pxor %%xmm7, %%xmm7 \n\t"\ + "movdqa "MANGLE(ff_pw_5)", %%xmm6\n\t"\ + "1: \n\t"\ + "lddqu -2(%0), %%xmm1 \n\t"\ + "movdqa %%xmm1, %%xmm0 \n\t"\ + "punpckhbw %%xmm7, %%xmm1 \n\t"\ + "punpcklbw %%xmm7, %%xmm0 \n\t"\ + "movdqa %%xmm1, %%xmm2 \n\t"\ + "movdqa %%xmm1, %%xmm3 \n\t"\ + "movdqa %%xmm1, %%xmm4 \n\t"\ + "movdqa %%xmm1, %%xmm5 \n\t"\ + "palignr $2, %%xmm0, %%xmm4 \n\t"\ + "palignr $4, %%xmm0, %%xmm3 \n\t"\ + "palignr $6, %%xmm0, %%xmm2 \n\t"\ + "palignr $8, %%xmm0, %%xmm1 \n\t"\ + "palignr $10,%%xmm0, %%xmm5 \n\t"\ + "paddw %%xmm5, %%xmm0 \n\t"\ + "paddw %%xmm3, %%xmm2 \n\t"\ + "paddw %%xmm4, %%xmm1 \n\t"\ + "psllw $2, %%xmm2 \n\t"\ + "movq (%2), %%xmm3 \n\t"\ + "psubw %%xmm1, %%xmm2 \n\t"\ + "paddw "MANGLE(ff_pw_16)", %%xmm0\n\t"\ + "pmullw %%xmm6, %%xmm2 \n\t"\ + "paddw %%xmm0, %%xmm2 \n\t"\ + "psraw $5, %%xmm2 \n\t"\ + "packuswb %%xmm2, %%xmm2 \n\t"\ + "pavgb %%xmm3, %%xmm2 \n\t"\ + OP(%%xmm2, (%1), %%xmm4, q)\ + "add %5, %0 \n\t"\ + "add %5, %1 \n\t"\ + "add %4, %2 \n\t"\ + "decl %3 \n\t"\ + "jg 1b \n\t"\ + : "+a"(src), "+c"(dst), "+d"(src2), "+g"(h)\ + : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride)\ + : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \ + "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\ + "memory"\ + );\ +}\ +QPEL_H264_H16_XMM(OPNAME, OP, MMX)\ +\ +static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + int h=8;\ + __asm__ volatile(\ + "pxor %%xmm7, %%xmm7 \n\t"\ + "movdqa "MANGLE(ff_pw_5)", %%xmm6\n\t"\ + "1: \n\t"\ + "lddqu -2(%0), %%xmm1 \n\t"\ + "movdqa %%xmm1, %%xmm0 \n\t"\ + "punpckhbw %%xmm7, %%xmm1 \n\t"\ + "punpcklbw %%xmm7, %%xmm0 \n\t"\ + "movdqa %%xmm1, %%xmm2 \n\t"\ + "movdqa %%xmm1, %%xmm3 \n\t"\ + "movdqa %%xmm1, %%xmm4 \n\t"\ + "movdqa %%xmm1, %%xmm5 \n\t"\ + "palignr $2, %%xmm0, %%xmm4 \n\t"\ + "palignr $4, %%xmm0, %%xmm3 \n\t"\ + "palignr $6, %%xmm0, %%xmm2 \n\t"\ + "palignr $8, %%xmm0, %%xmm1 \n\t"\ + "palignr $10,%%xmm0, %%xmm5 \n\t"\ + "paddw %%xmm5, %%xmm0 \n\t"\ + "paddw %%xmm3, %%xmm2 \n\t"\ + "paddw %%xmm4, %%xmm1 \n\t"\ + "psllw $2, %%xmm2 \n\t"\ + "psubw %%xmm1, %%xmm2 \n\t"\ + "paddw "MANGLE(ff_pw_16)", %%xmm0\n\t"\ + "pmullw %%xmm6, %%xmm2 \n\t"\ + "paddw %%xmm0, %%xmm2 \n\t"\ + "psraw $5, %%xmm2 \n\t"\ + "packuswb %%xmm2, %%xmm2 \n\t"\ + OP(%%xmm2, (%1), %%xmm4, q)\ + "add %3, %0 \n\t"\ + "add %4, %1 \n\t"\ + "decl %2 \n\t"\ + " jnz 1b \n\t"\ + : "+a"(src), "+c"(dst), "+g"(h)\ + : "D"((x86_reg)srcStride), "S"((x86_reg)dstStride)\ + : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \ + "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\ + "memory"\ + );\ +}\ +static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\ + OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\ + src += 8*srcStride;\ + dst += 8*dstStride;\ + OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\ + OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\ +}\ + +#define QPEL_H264_V_XMM(OPNAME, OP, MMX)\ +static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ + src -= 2*srcStride;\ + \ + __asm__ volatile(\ + "pxor %%xmm7, %%xmm7 \n\t"\ + "movq (%0), %%xmm0 \n\t"\ + "add %2, %0 \n\t"\ + "movq (%0), %%xmm1 \n\t"\ + "add %2, %0 \n\t"\ + "movq (%0), %%xmm2 \n\t"\ + "add %2, %0 \n\t"\ + "movq (%0), %%xmm3 \n\t"\ + "add %2, %0 \n\t"\ + "movq (%0), %%xmm4 \n\t"\ + "add %2, %0 \n\t"\ + "punpcklbw %%xmm7, %%xmm0 \n\t"\ + "punpcklbw %%xmm7, %%xmm1 \n\t"\ + "punpcklbw %%xmm7, %%xmm2 \n\t"\ + "punpcklbw %%xmm7, %%xmm3 \n\t"\ + "punpcklbw %%xmm7, %%xmm4 \n\t"\ + QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\ + QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\ + QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\ + QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\ + QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\ + QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\ + QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\ + QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\ + "cmpl $16, %4 \n\t"\ + "jne 2f \n\t"\ + QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\ + QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\ + QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\ + QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\ + QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\ + QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\ + QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\ + QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\ + "2: \n\t"\ + \ + : "+a"(src), "+c"(dst)\ + : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "g"(h)\ + : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \ + "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\ + "memory"\ + );\ +}\ +static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\ +}\ +static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ + OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\ + OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\ +} + +static av_always_inline void put_h264_qpel8or16_hv1_lowpass_sse2(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){ + int w = (size+8)>>3; + src -= 2*srcStride+2; + while(w--){ + __asm__ volatile( + "pxor %%xmm7, %%xmm7 \n\t" + "movq (%0), %%xmm0 \n\t" + "add %2, %0 \n\t" + "movq (%0), %%xmm1 \n\t" + "add %2, %0 \n\t" + "movq (%0), %%xmm2 \n\t" + "add %2, %0 \n\t" + "movq (%0), %%xmm3 \n\t" + "add %2, %0 \n\t" + "movq (%0), %%xmm4 \n\t" + "add %2, %0 \n\t" + "punpcklbw %%xmm7, %%xmm0 \n\t" + "punpcklbw %%xmm7, %%xmm1 \n\t" + "punpcklbw %%xmm7, %%xmm2 \n\t" + "punpcklbw %%xmm7, %%xmm3 \n\t" + "punpcklbw %%xmm7, %%xmm4 \n\t" + QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 0*48) + QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 1*48) + QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 2*48) + QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 3*48) + QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 4*48) + QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 5*48) + QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 6*48) + QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 7*48) + "cmpl $16, %3 \n\t" + "jne 2f \n\t" + QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 8*48) + QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 9*48) + QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 10*48) + QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 11*48) + QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 12*48) + QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 13*48) + QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 14*48) + QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 15*48) + "2: \n\t" + : "+a"(src) + : "c"(tmp), "S"((x86_reg)srcStride), "g"(size) + : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", + "%xmm4", "%xmm5", "%xmm6", "%xmm7",) + "memory" + ); + tmp += 8; + src += 8 - (size+5)*srcStride; + } +} + +#define QPEL_H264_HV2_XMM(OPNAME, OP, MMX)\ +static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\ + int h = size;\ + if(size == 16){\ + __asm__ volatile(\ + "1: \n\t"\ + "movdqa 32(%0), %%xmm4 \n\t"\ + "movdqa 16(%0), %%xmm5 \n\t"\ + "movdqa (%0), %%xmm7 \n\t"\ + "movdqa %%xmm4, %%xmm3 \n\t"\ + "movdqa %%xmm4, %%xmm2 \n\t"\ + "movdqa %%xmm4, %%xmm1 \n\t"\ + "movdqa %%xmm4, %%xmm0 \n\t"\ + "palignr $10, %%xmm5, %%xmm0 \n\t"\ + "palignr $8, %%xmm5, %%xmm1 \n\t"\ + "palignr $6, %%xmm5, %%xmm2 \n\t"\ + "palignr $4, %%xmm5, %%xmm3 \n\t"\ + "palignr $2, %%xmm5, %%xmm4 \n\t"\ + "paddw %%xmm5, %%xmm0 \n\t"\ + "paddw %%xmm4, %%xmm1 \n\t"\ + "paddw %%xmm3, %%xmm2 \n\t"\ + "movdqa %%xmm5, %%xmm6 \n\t"\ + "movdqa %%xmm5, %%xmm4 \n\t"\ + "movdqa %%xmm5, %%xmm3 \n\t"\ + "palignr $8, %%xmm7, %%xmm4 \n\t"\ + "palignr $2, %%xmm7, %%xmm6 \n\t"\ + "palignr $10, %%xmm7, %%xmm3 \n\t"\ + "paddw %%xmm6, %%xmm4 \n\t"\ + "movdqa %%xmm5, %%xmm6 \n\t"\ + "palignr $6, %%xmm7, %%xmm5 \n\t"\ + "palignr $4, %%xmm7, %%xmm6 \n\t"\ + "paddw %%xmm7, %%xmm3 \n\t"\ + "paddw %%xmm6, %%xmm5 \n\t"\ + \ + "psubw %%xmm1, %%xmm0 \n\t"\ + "psubw %%xmm4, %%xmm3 \n\t"\ + "psraw $2, %%xmm0 \n\t"\ + "psraw $2, %%xmm3 \n\t"\ + "psubw %%xmm1, %%xmm0 \n\t"\ + "psubw %%xmm4, %%xmm3 \n\t"\ + "paddw %%xmm2, %%xmm0 \n\t"\ + "paddw %%xmm5, %%xmm3 \n\t"\ + "psraw $2, %%xmm0 \n\t"\ + "psraw $2, %%xmm3 \n\t"\ + "paddw %%xmm2, %%xmm0 \n\t"\ + "paddw %%xmm5, %%xmm3 \n\t"\ + "psraw $6, %%xmm0 \n\t"\ + "psraw $6, %%xmm3 \n\t"\ + "packuswb %%xmm0, %%xmm3 \n\t"\ + OP(%%xmm3, (%1), %%xmm7, dqa)\ + "add $48, %0 \n\t"\ + "add %3, %1 \n\t"\ + "decl %2 \n\t"\ + " jnz 1b \n\t"\ + : "+a"(tmp), "+c"(dst), "+g"(h)\ + : "S"((x86_reg)dstStride)\ + : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \ + "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\ + "memory"\ + );\ + }else{\ + __asm__ volatile(\ + "1: \n\t"\ + "movdqa 16(%0), %%xmm1 \n\t"\ + "movdqa (%0), %%xmm0 \n\t"\ + "movdqa %%xmm1, %%xmm2 \n\t"\ + "movdqa %%xmm1, %%xmm3 \n\t"\ + "movdqa %%xmm1, %%xmm4 \n\t"\ + "movdqa %%xmm1, %%xmm5 \n\t"\ + "palignr $10, %%xmm0, %%xmm5 \n\t"\ + "palignr $8, %%xmm0, %%xmm4 \n\t"\ + "palignr $6, %%xmm0, %%xmm3 \n\t"\ + "palignr $4, %%xmm0, %%xmm2 \n\t"\ + "palignr $2, %%xmm0, %%xmm1 \n\t"\ + "paddw %%xmm5, %%xmm0 \n\t"\ + "paddw %%xmm4, %%xmm1 \n\t"\ + "paddw %%xmm3, %%xmm2 \n\t"\ + "psubw %%xmm1, %%xmm0 \n\t"\ + "psraw $2, %%xmm0 \n\t"\ + "psubw %%xmm1, %%xmm0 \n\t"\ + "paddw %%xmm2, %%xmm0 \n\t"\ + "psraw $2, %%xmm0 \n\t"\ + "paddw %%xmm2, %%xmm0 \n\t"\ + "psraw $6, %%xmm0 \n\t"\ + "packuswb %%xmm0, %%xmm0 \n\t"\ + OP(%%xmm0, (%1), %%xmm7, q)\ + "add $48, %0 \n\t"\ + "add %3, %1 \n\t"\ + "decl %2 \n\t"\ + " jnz 1b \n\t"\ + : "+a"(tmp), "+c"(dst), "+g"(h)\ + : "S"((x86_reg)dstStride)\ + : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \ + "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\ + "memory"\ + );\ + }\ +} + +#define QPEL_H264_HV_XMM(OPNAME, OP, MMX)\ +static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\ + put_h264_qpel8or16_hv1_lowpass_sse2(tmp, src, tmpStride, srcStride, size);\ + OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\ +}\ +static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ + OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 8);\ +}\ +static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\ + OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 16);\ +}\ + +#define put_pixels8_l2_sse2 put_pixels8_l2_mmx2 +#define avg_pixels8_l2_sse2 avg_pixels8_l2_mmx2 +#define put_pixels16_l2_sse2 put_pixels16_l2_mmx2 +#define avg_pixels16_l2_sse2 avg_pixels16_l2_mmx2 +#define put_pixels8_l2_ssse3 put_pixels8_l2_mmx2 +#define avg_pixels8_l2_ssse3 avg_pixels8_l2_mmx2 +#define put_pixels16_l2_ssse3 put_pixels16_l2_mmx2 +#define avg_pixels16_l2_ssse3 avg_pixels16_l2_mmx2 + +#define put_pixels8_l2_shift5_sse2 put_pixels8_l2_shift5_mmx2 +#define avg_pixels8_l2_shift5_sse2 avg_pixels8_l2_shift5_mmx2 +#define put_pixels16_l2_shift5_sse2 put_pixels16_l2_shift5_mmx2 +#define avg_pixels16_l2_shift5_sse2 avg_pixels16_l2_shift5_mmx2 +#define put_pixels8_l2_shift5_ssse3 put_pixels8_l2_shift5_mmx2 +#define avg_pixels8_l2_shift5_ssse3 avg_pixels8_l2_shift5_mmx2 +#define put_pixels16_l2_shift5_ssse3 put_pixels16_l2_shift5_mmx2 +#define avg_pixels16_l2_shift5_ssse3 avg_pixels16_l2_shift5_mmx2 + +#define put_h264_qpel8_h_lowpass_l2_sse2 put_h264_qpel8_h_lowpass_l2_mmx2 +#define avg_h264_qpel8_h_lowpass_l2_sse2 avg_h264_qpel8_h_lowpass_l2_mmx2 +#define put_h264_qpel16_h_lowpass_l2_sse2 put_h264_qpel16_h_lowpass_l2_mmx2 +#define avg_h264_qpel16_h_lowpass_l2_sse2 avg_h264_qpel16_h_lowpass_l2_mmx2 + +#define put_h264_qpel8_v_lowpass_ssse3 put_h264_qpel8_v_lowpass_sse2 +#define avg_h264_qpel8_v_lowpass_ssse3 avg_h264_qpel8_v_lowpass_sse2 +#define put_h264_qpel16_v_lowpass_ssse3 put_h264_qpel16_v_lowpass_sse2 +#define avg_h264_qpel16_v_lowpass_ssse3 avg_h264_qpel16_v_lowpass_sse2 + +#define put_h264_qpel8or16_hv2_lowpass_sse2 put_h264_qpel8or16_hv2_lowpass_mmx2 +#define avg_h264_qpel8or16_hv2_lowpass_sse2 avg_h264_qpel8or16_hv2_lowpass_mmx2 + +#define H264_MC(OPNAME, SIZE, MMX, ALIGN) \ +H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\ +H264_MC_V(OPNAME, SIZE, MMX, ALIGN)\ +H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\ +H264_MC_HV(OPNAME, SIZE, MMX, ALIGN)\ + +static void put_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){ + put_pixels16_sse2(dst, src, stride, 16); +} +static void avg_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){ + avg_pixels16_sse2(dst, src, stride, 16); +} +#define put_h264_qpel8_mc00_sse2 put_h264_qpel8_mc00_mmx2 +#define avg_h264_qpel8_mc00_sse2 avg_h264_qpel8_mc00_mmx2 + +#define H264_MC_C(OPNAME, SIZE, MMX, ALIGN) \ +static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## pixels ## SIZE ## _ ## MMX(dst, src, stride, SIZE);\ +}\ + +#define H264_MC_H(OPNAME, SIZE, MMX, ALIGN) \ +static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src, stride, stride);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## MMX(dst, src, stride, stride);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src+1, stride, stride);\ +}\ + +#define H264_MC_V(OPNAME, SIZE, MMX, ALIGN) \ +static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## MMX(dst, src, stride, stride);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride, SIZE);\ +}\ + +#define H264_MC_HV(OPNAME, SIZE, MMX, ALIGN) \ +static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\ + put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint16_t, temp)[SIZE*(SIZE<8?12:24)];\ + OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(dst, temp, src, stride, SIZE, stride);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\ + uint8_t * const halfHV= temp;\ + int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ + assert(((int)temp & 7) == 0);\ + put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, halfHV, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\ + uint8_t * const halfHV= temp;\ + int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ + assert(((int)temp & 7) == 0);\ + put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ + OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, halfHV, stride, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\ + uint8_t * const halfHV= temp;\ + int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ + assert(((int)temp & 7) == 0);\ + put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+2, halfHV, stride, SIZE, SIZE);\ +}\ +\ +static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ + DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\ + uint8_t * const halfHV= temp;\ + int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\ + assert(((int)temp & 7) == 0);\ + put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\ + OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+3, halfHV, stride, SIZE, SIZE);\ +}\ + +#define H264_MC_4816(MMX)\ +H264_MC(put_, 4, MMX, 8)\ +H264_MC(put_, 8, MMX, 8)\ +H264_MC(put_, 16,MMX, 8)\ +H264_MC(avg_, 4, MMX, 8)\ +H264_MC(avg_, 8, MMX, 8)\ +H264_MC(avg_, 16,MMX, 8)\ + +#define H264_MC_816(QPEL, XMM)\ +QPEL(put_, 8, XMM, 16)\ +QPEL(put_, 16,XMM, 16)\ +QPEL(avg_, 8, XMM, 16)\ +QPEL(avg_, 16,XMM, 16)\ + + +#define AVG_3DNOW_OP(a,b,temp, size) \ +"mov" #size " " #b ", " #temp " \n\t"\ +"pavgusb " #temp ", " #a " \n\t"\ +"mov" #size " " #a ", " #b " \n\t" +#define AVG_MMX2_OP(a,b,temp, size) \ +"mov" #size " " #b ", " #temp " \n\t"\ +"pavgb " #temp ", " #a " \n\t"\ +"mov" #size " " #a ", " #b " \n\t" + +#define PAVGB "pavgusb" +QPEL_H264(put_, PUT_OP, 3dnow) +QPEL_H264(avg_, AVG_3DNOW_OP, 3dnow) +#undef PAVGB +#define PAVGB "pavgb" +QPEL_H264(put_, PUT_OP, mmx2) +QPEL_H264(avg_, AVG_MMX2_OP, mmx2) +QPEL_H264_V_XMM(put_, PUT_OP, sse2) +QPEL_H264_V_XMM(avg_, AVG_MMX2_OP, sse2) +QPEL_H264_HV_XMM(put_, PUT_OP, sse2) +QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, sse2) +#if HAVE_SSSE3 +QPEL_H264_H_XMM(put_, PUT_OP, ssse3) +QPEL_H264_H_XMM(avg_, AVG_MMX2_OP, ssse3) +QPEL_H264_HV2_XMM(put_, PUT_OP, ssse3) +QPEL_H264_HV2_XMM(avg_, AVG_MMX2_OP, ssse3) +QPEL_H264_HV_XMM(put_, PUT_OP, ssse3) +QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, ssse3) +#endif +#undef PAVGB + +H264_MC_4816(3dnow) +H264_MC_4816(mmx2) +H264_MC_816(H264_MC_V, sse2) +H264_MC_816(H264_MC_HV, sse2) +#if HAVE_SSSE3 +H264_MC_816(H264_MC_H, ssse3) +H264_MC_816(H264_MC_HV, ssse3) +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_weight.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_weight.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_weight.asm 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_weight.asm 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,375 @@ +;***************************************************************************** +;* SSE2-optimized weighted prediction code +;***************************************************************************** +;* Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt +;* Copyright (C) 2010 Eli Friedman +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg is distributed in the hope that it will be useful, +;* but WITHOUT ANY WARRANTY; without even the implied warranty of +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" + +SECTION .text + +;----------------------------------------------------------------------------- +; biweight pred: +; +; void h264_biweight_16x16_sse2(uint8_t *dst, uint8_t *src, int stride, +; int log2_denom, int weightd, int weights, +; int offset); +; and +; void h264_weight_16x16_sse2(uint8_t *dst, int stride, +; int log2_denom, int weight, +; int offset); +;----------------------------------------------------------------------------- + +%macro WEIGHT_SETUP 0 + add r4, r4 + inc r4 + movd m3, r3d + movd m5, r4d + movd m6, r2d + pslld m5, m6 + psrld m5, 1 +%if mmsize == 16 + pshuflw m3, m3, 0 + pshuflw m5, m5, 0 + punpcklqdq m3, m3 + punpcklqdq m5, m5 +%else + pshufw m3, m3, 0 + pshufw m5, m5, 0 +%endif + pxor m7, m7 +%endmacro + +%macro WEIGHT_OP 2 + movh m0, [r0+%1] + movh m1, [r0+%2] + punpcklbw m0, m7 + punpcklbw m1, m7 + pmullw m0, m3 + pmullw m1, m3 + paddsw m0, m5 + paddsw m1, m5 + psraw m0, m6 + psraw m1, m6 + packuswb m0, m1 +%endmacro + +%macro WEIGHT_FUNC_DBL_MM 1 +cglobal h264_weight_16x%1_mmx2, 5, 5, 0 + WEIGHT_SETUP + mov r2, %1 +%if %1 == 16 +.nextrow + WEIGHT_OP 0, 4 + mova [r0 ], m0 + WEIGHT_OP 8, 12 + mova [r0+8], m0 + add r0, r1 + dec r2 + jnz .nextrow + REP_RET +%else + jmp mangle(ff_h264_weight_16x16_mmx2.nextrow) +%endif +%endmacro + +INIT_MMX +WEIGHT_FUNC_DBL_MM 16 +WEIGHT_FUNC_DBL_MM 8 + +%macro WEIGHT_FUNC_MM 4 +cglobal h264_weight_%1x%2_%4, 7, 7, %3 + WEIGHT_SETUP + mov r2, %2 +%if %2 == 16 +.nextrow + WEIGHT_OP 0, mmsize/2 + mova [r0], m0 + add r0, r1 + dec r2 + jnz .nextrow + REP_RET +%else + jmp mangle(ff_h264_weight_%1x16_%4.nextrow) +%endif +%endmacro + +INIT_MMX +WEIGHT_FUNC_MM 8, 16, 0, mmx2 +WEIGHT_FUNC_MM 8, 8, 0, mmx2 +WEIGHT_FUNC_MM 8, 4, 0, mmx2 +INIT_XMM +WEIGHT_FUNC_MM 16, 16, 8, sse2 +WEIGHT_FUNC_MM 16, 8, 8, sse2 + +%macro WEIGHT_FUNC_HALF_MM 5 +cglobal h264_weight_%1x%2_%5, 5, 5, %4 + WEIGHT_SETUP + mov r2, %2/2 + lea r3, [r1*2] +%if %2 == mmsize +.nextrow + WEIGHT_OP 0, r1 + movh [r0], m0 +%if mmsize == 16 + movhps [r0+r1], m0 +%else + psrlq m0, 32 + movh [r0+r1], m0 +%endif + add r0, r3 + dec r2 + jnz .nextrow + REP_RET +%else + jmp mangle(ff_h264_weight_%1x%3_%5.nextrow) +%endif +%endmacro + +INIT_MMX +WEIGHT_FUNC_HALF_MM 4, 8, 8, 0, mmx2 +WEIGHT_FUNC_HALF_MM 4, 4, 8, 0, mmx2 +WEIGHT_FUNC_HALF_MM 4, 2, 8, 0, mmx2 +INIT_XMM +WEIGHT_FUNC_HALF_MM 8, 16, 16, 8, sse2 +WEIGHT_FUNC_HALF_MM 8, 8, 16, 8, sse2 +WEIGHT_FUNC_HALF_MM 8, 4, 16, 8, sse2 + +%macro BIWEIGHT_SETUP 0 + add r6, 1 + or r6, 1 + add r3, 1 + movd m3, r4d + movd m4, r5d + movd m5, r6d + movd m6, r3d + pslld m5, m6 + psrld m5, 1 +%if mmsize == 16 + pshuflw m3, m3, 0 + pshuflw m4, m4, 0 + pshuflw m5, m5, 0 + punpcklqdq m3, m3 + punpcklqdq m4, m4 + punpcklqdq m5, m5 +%else + pshufw m3, m3, 0 + pshufw m4, m4, 0 + pshufw m5, m5, 0 +%endif + pxor m7, m7 +%endmacro + +%macro BIWEIGHT_STEPA 3 + movh m%1, [r0+%3] + movh m%2, [r1+%3] + punpcklbw m%1, m7 + punpcklbw m%2, m7 + pmullw m%1, m3 + pmullw m%2, m4 + paddsw m%1, m%2 +%endmacro + +%macro BIWEIGHT_STEPB 0 + paddsw m0, m5 + paddsw m1, m5 + psraw m0, m6 + psraw m1, m6 + packuswb m0, m1 +%endmacro + +%macro BIWEIGHT_FUNC_DBL_MM 1 +cglobal h264_biweight_16x%1_mmx2, 7, 7, 0 + BIWEIGHT_SETUP + mov r3, %1 +%if %1 == 16 +.nextrow + BIWEIGHT_STEPA 0, 1, 0 + BIWEIGHT_STEPA 1, 2, 4 + BIWEIGHT_STEPB + mova [r0], m0 + BIWEIGHT_STEPA 0, 1, 8 + BIWEIGHT_STEPA 1, 2, 12 + BIWEIGHT_STEPB + mova [r0+8], m0 + add r0, r2 + add r1, r2 + dec r3 + jnz .nextrow + REP_RET +%else + jmp mangle(ff_h264_biweight_16x16_mmx2.nextrow) +%endif +%endmacro + +INIT_MMX +BIWEIGHT_FUNC_DBL_MM 16 +BIWEIGHT_FUNC_DBL_MM 8 + +%macro BIWEIGHT_FUNC_MM 4 +cglobal h264_biweight_%1x%2_%4, 7, 7, %3 + BIWEIGHT_SETUP + mov r3, %2 +%if %2 == 16 +.nextrow + BIWEIGHT_STEPA 0, 1, 0 + BIWEIGHT_STEPA 1, 2, mmsize/2 + BIWEIGHT_STEPB + mova [r0], m0 + add r0, r2 + add r1, r2 + dec r3 + jnz .nextrow + REP_RET +%else + jmp mangle(ff_h264_biweight_%1x16_%4.nextrow) +%endif +%endmacro + +INIT_MMX +BIWEIGHT_FUNC_MM 8, 16, 0, mmx2 +BIWEIGHT_FUNC_MM 8, 8, 0, mmx2 +BIWEIGHT_FUNC_MM 8, 4, 0, mmx2 +INIT_XMM +BIWEIGHT_FUNC_MM 16, 16, 8, sse2 +BIWEIGHT_FUNC_MM 16, 8, 8, sse2 + +%macro BIWEIGHT_FUNC_HALF_MM 5 +cglobal h264_biweight_%1x%2_%5, 7, 7, %4 + BIWEIGHT_SETUP + mov r3, %2/2 + lea r4, [r2*2] +%if %2 == mmsize +.nextrow + BIWEIGHT_STEPA 0, 1, 0 + BIWEIGHT_STEPA 1, 2, r2 + BIWEIGHT_STEPB + movh [r0], m0 +%if mmsize == 16 + movhps [r0+r2], m0 +%else + psrlq m0, 32 + movh [r0+r2], m0 +%endif + add r0, r4 + add r1, r4 + dec r3 + jnz .nextrow + REP_RET +%else + jmp mangle(ff_h264_biweight_%1x%3_%5.nextrow) +%endif +%endmacro + +INIT_MMX +BIWEIGHT_FUNC_HALF_MM 4, 8, 8, 0, mmx2 +BIWEIGHT_FUNC_HALF_MM 4, 4, 8, 0, mmx2 +BIWEIGHT_FUNC_HALF_MM 4, 2, 8, 0, mmx2 +INIT_XMM +BIWEIGHT_FUNC_HALF_MM 8, 16, 16, 8, sse2 +BIWEIGHT_FUNC_HALF_MM 8, 8, 16, 8, sse2 +BIWEIGHT_FUNC_HALF_MM 8, 4, 16, 8, sse2 + +%macro BIWEIGHT_SSSE3_SETUP 0 + add r6, 1 + or r6, 1 + add r3, 1 + movd m4, r4d + movd m0, r5d + movd m5, r6d + movd m6, r3d + pslld m5, m6 + psrld m5, 1 + punpcklbw m4, m0 + pshuflw m4, m4, 0 + pshuflw m5, m5, 0 + punpcklqdq m4, m4 + punpcklqdq m5, m5 +%endmacro + +%macro BIWEIGHT_SSSE3_OP 0 + pmaddubsw m0, m4 + pmaddubsw m2, m4 + paddsw m0, m5 + paddsw m2, m5 + psraw m0, m6 + psraw m2, m6 + packuswb m0, m2 +%endmacro + +%macro BIWEIGHT_SSSE3_16 1 +cglobal h264_biweight_16x%1_ssse3, 7, 7, 8 + BIWEIGHT_SSSE3_SETUP + mov r3, %1 + +%if %1 == 16 +.nextrow + movh m0, [r0] + movh m2, [r0+8] + movh m3, [r1+8] + punpcklbw m0, [r1] + punpcklbw m2, m3 + BIWEIGHT_SSSE3_OP + mova [r0], m0 + add r0, r2 + add r1, r2 + dec r3 + jnz .nextrow + REP_RET +%else + jmp mangle(ff_h264_biweight_16x16_ssse3.nextrow) +%endif +%endmacro + +INIT_XMM +BIWEIGHT_SSSE3_16 16 +BIWEIGHT_SSSE3_16 8 + +%macro BIWEIGHT_SSSE3_8 1 +cglobal h264_biweight_8x%1_ssse3, 7, 7, 8 + BIWEIGHT_SSSE3_SETUP + mov r3, %1/2 + lea r4, [r2*2] + +%if %1 == 16 +.nextrow + movh m0, [r0] + movh m1, [r1] + movh m2, [r0+r2] + movh m3, [r1+r2] + punpcklbw m0, m1 + punpcklbw m2, m3 + BIWEIGHT_SSSE3_OP + movh [r0], m0 + movhps [r0+r2], m0 + add r0, r4 + add r1, r4 + dec r3 + jnz .nextrow + REP_RET +%else + jmp mangle(ff_h264_biweight_8x16_ssse3.nextrow) +%endif +%endmacro + +INIT_XMM +BIWEIGHT_SSSE3_8 16 +BIWEIGHT_SSSE3_8 8 +BIWEIGHT_SSSE3_8 4 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_weight_sse2.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_weight_sse2.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/h264_weight_sse2.asm 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/h264_weight_sse2.asm 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -;***************************************************************************** -;* SSE2-optimized weighted prediction code -;***************************************************************************** -;* Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt -;* Copyright (C) 2010 Eli Friedman -;* -;* This file is part of FFmpeg. -;* -;* FFmpeg is free software; you can redistribute it and/or -;* modify it under the terms of the GNU Lesser General Public -;* License as published by the Free Software Foundation; either -;* version 2.1 of the License, or (at your option) any later version. -;* -;* FFmpeg is distributed in the hope that it will be useful, -;* but WITHOUT ANY WARRANTY; without even the implied warranty of -;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;* Lesser General Public License for more details. -;* -;* You should have received a copy of the GNU Lesser General Public -;* License along with FFmpeg; if not, write to the Free Software -;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -;****************************************************************************** - -%include "x86inc.asm" - -SECTION .text -INIT_XMM - -;----------------------------------------------------------------------------- -; biweight pred: -; -; void h264_biweight_16x16_sse2(uint8_t *dst, uint8_t *src, int stride, -; int log2_denom, int weightd, int weights, -; int offset); -;----------------------------------------------------------------------------- - -%macro BIWEIGHT_SSE2_SETUP 0 - add r6, 1 - or r6, 1 - add r3, 1 - movd m3, r4 - movd m4, r5 - movd m5, r6 - movd m6, r3 - pslld m5, m6 - psrld m5, 1 - pshuflw m3, m3, 0 - pshuflw m4, m4, 0 - pshuflw m5, m5, 0 - punpcklqdq m3, m3 - punpcklqdq m4, m4 - punpcklqdq m5, m5 - pxor m7, m7 -%endmacro - -%macro BIWEIGHT_SSE2_STEPA 3 - movh m%1, [r0+%3] - movh m%2, [r1+%3] - punpcklbw m%1, m7 - punpcklbw m%2, m7 - pmullw m%1, m3 - pmullw m%2, m4 - paddsw m%1, m%2 -%endmacro - -%macro BIWEIGHT_SSE2_STEPB 0 - paddsw m0, m5 - paddsw m1, m5 - psraw m0, m6 - psraw m1, m6 - packuswb m0, m1 -%endmacro - -cglobal h264_biweight_16x16_sse2, 7, 7, 8 - BIWEIGHT_SSE2_SETUP - mov r3, 16 - -.nextrow - BIWEIGHT_SSE2_STEPA 0, 1, 0 - BIWEIGHT_SSE2_STEPA 1, 2, 8 - BIWEIGHT_SSE2_STEPB - mova [r0], m0 - add r0, r2 - add r1, r2 - dec r3 - jnz .nextrow - REP_RET - -cglobal h264_biweight_8x8_sse2, 7, 7, 8 - BIWEIGHT_SSE2_SETUP - mov r3, 4 - lea r4, [r2*2] - -.nextrow - BIWEIGHT_SSE2_STEPA 0, 1, 0 - BIWEIGHT_SSE2_STEPA 1, 2, r2 - BIWEIGHT_SSE2_STEPB - movh [r0], m0 - movhps [r0+r2], m0 - add r0, r4 - add r1, r4 - dec r3 - jnz .nextrow - REP_RET - -%macro BIWEIGHT_SSSE3_SETUP 0 - add r6, 1 - or r6, 1 - add r3, 1 - movd m4, r4 - movd m0, r5 - movd m5, r6 - movd m6, r3 - pslld m5, m6 - psrld m5, 1 - punpcklbw m4, m0 - pshuflw m4, m4, 0 - pshuflw m5, m5, 0 - punpcklqdq m4, m4 - punpcklqdq m5, m5 -%endmacro - -%macro BIWEIGHT_SSSE3_OP 0 - pmaddubsw m0, m4 - pmaddubsw m2, m4 - paddsw m0, m5 - paddsw m2, m5 - psraw m0, m6 - psraw m2, m6 - packuswb m0, m2 -%endmacro - -cglobal h264_biweight_16x16_ssse3, 7, 7, 8 - BIWEIGHT_SSSE3_SETUP - mov r3, 16 - -.nextrow - movh m0, [r0] - movh m2, [r0+8] - movh m3, [r1+8] - punpcklbw m0, [r1] - punpcklbw m2, m3 - BIWEIGHT_SSSE3_OP - mova [r0], m0 - add r0, r2 - add r1, r2 - dec r3 - jnz .nextrow - REP_RET - -cglobal h264_biweight_8x8_ssse3, 7, 7, 8 - BIWEIGHT_SSSE3_SETUP - mov r3, 4 - lea r4, [r2*2] - -.nextrow - movh m0, [r0] - movh m1, [r1] - movh m2, [r0+r2] - movh m3, [r1+r2] - punpcklbw m0, m1 - punpcklbw m2, m3 - BIWEIGHT_SSSE3_OP - movh [r0], m0 - movhps [r0+r2], m0 - add r0, r4 - add r1, r4 - dec r3 - jnz .nextrow - REP_RET diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/idct_sse2_xvid.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/idct_sse2_xvid.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/idct_sse2_xvid.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/idct_sse2_xvid.c 2010-11-06 17:21:28.000000000 +0000 @@ -39,6 +39,7 @@ */ #include "libavcodec/dsputil.h" +#include "libavutil/x86_cpu.h" #include "idct_xvid.h" #include "dsputil_mmx.h" @@ -379,17 +380,24 @@ "6: \n\t" : "+r"(block) : - : "%eax", "%ecx", "%edx", "%esi", "memory"); + : XMM_CLOBBERS("%xmm0" , "%xmm1" , "%xmm2" , "%xmm3" , + "%xmm4" , "%xmm5" , "%xmm6" , "%xmm7" ,) +#if ARCH_X86_64 + XMM_CLOBBERS("%xmm8" , "%xmm9" , "%xmm10", "%xmm11", + "%xmm12", "%xmm13", "%xmm14",) +#endif + "%eax", "%ecx", "%edx", "%esi", "memory" + ); } void ff_idct_xvid_sse2_put(uint8_t *dest, int line_size, short *block) { ff_idct_xvid_sse2(block); - put_pixels_clamped_mmx(block, dest, line_size); + ff_put_pixels_clamped_mmx(block, dest, line_size); } void ff_idct_xvid_sse2_add(uint8_t *dest, int line_size, short *block) { ff_idct_xvid_sse2(block); - add_pixels_clamped_mmx(block, dest, line_size); + ff_add_pixels_clamped_mmx(block, dest, line_size); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/lpc_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/lpc_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/lpc_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/lpc_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -29,16 +29,15 @@ x86_reg i = -n2*sizeof(int32_t); x86_reg j = n2*sizeof(int32_t); __asm__ volatile( - "movsd %0, %%xmm7 \n\t" + "movsd %4, %%xmm7 \n\t" "movapd "MANGLE(ff_pd_1)", %%xmm6 \n\t" "movapd "MANGLE(ff_pd_2)", %%xmm5 \n\t" "movlhps %%xmm7, %%xmm7 \n\t" "subpd %%xmm5, %%xmm7 \n\t" "addsd %%xmm6, %%xmm7 \n\t" - ::"m"(c) - ); + "test $1, %5 \n\t" + "jz 2f \n\t" #define WELCH(MOVPD, offset)\ - __asm__ volatile(\ "1: \n\t"\ "movapd %%xmm7, %%xmm1 \n\t"\ "mulpd %%xmm1, %%xmm1 \n\t"\ @@ -55,13 +54,17 @@ "sub $8, %1 \n\t"\ "add $8, %0 \n\t"\ "jl 1b \n\t"\ - :"+&r"(i), "+&r"(j)\ - :"r"(w_data+n2), "r"(data+n2)\ - ); - if(len&1) + WELCH("movupd", -1) - else + "jmp 3f \n\t" + "2: \n\t" WELCH("movapd", -2) + "3: \n\t" + :"+&r"(i), "+&r"(j) + :"r"(w_data+n2), "r"(data+n2), "m"(c), "r"(len) + XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", + "%xmm5", "%xmm6", "%xmm7") + ); #undef WELCH } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/Makefile chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/Makefile --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/Makefile 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/Makefile 2010-11-06 17:21:28.000000000 +0000 @@ -6,12 +6,14 @@ YASM-OBJS-FFT-$(HAVE_SSE) += x86/fft_sse.o YASM-OBJS-$(CONFIG_FFT) += x86/fft_mmx.o \ $(YASM-OBJS-FFT-yes) -YASM-OBJS-$(CONFIG_GPL) += x86/h264_idct_sse2.o \ -YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock_sse2.o \ - x86/h264_weight_sse2.o \ +MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_mmx.o +YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \ + x86/h264_weight.o \ + x86/h264_idct.o \ YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o +MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_yasm.o @@ -22,28 +24,27 @@ MMX-OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += x86/mpegaudiodec_mmx.o MMX-OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += x86/mpegaudiodec_mmx.o MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o +YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_yasm.o MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o MMX-OBJS-$(CONFIG_LPC) += x86/lpc_mmx.o MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp_mmx.o MMX-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_mmx.o -MMX-OBJS-$(CONFIG_VP3_DECODER) += x86/vp3dsp_mmx.o \ - x86/vp3dsp_sse2.o -MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp3dsp_mmx.o \ - x86/vp3dsp_sse2.o -MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp_mmx.o \ - x86/vp3dsp_sse2.o \ - x86/vp6dsp_mmx.o \ - x86/vp6dsp_sse2.o +YASM-OBJS-$(CONFIG_VP3_DECODER) += x86/vp3dsp.o +YASM-OBJS-$(CONFIG_VP5_DECODER) += x86/vp3dsp.o +MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp56dsp_init.o +YASM-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp.o \ + x86/vp56dsp.o +MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp56dsp_init.o YASM-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp.o MMX-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp-init.o MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \ x86/deinterlace.o \ + x86/h264_chromamc.o \ $(YASM-OBJS-yes) MMX-OBJS-$(CONFIG_FFT) += x86/fft.o -OBJS-$(HAVE_MMX) += x86/cpuid.o \ - x86/dnxhd_mmx.o \ +OBJS-$(HAVE_MMX) += x86/dnxhd_mmx.o \ x86/dsputil_mmx.o \ x86/fdct_mmx.o \ x86/idct_mmx_xvid.o \ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/motion_est_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/motion_est_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/motion_est_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/motion_est_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -94,28 +94,25 @@ { int ret; __asm__ volatile( - "pxor %%xmm6, %%xmm6 \n\t" + "pxor %%xmm2, %%xmm2 \n\t" ASMALIGN(4) "1: \n\t" "movdqu (%1), %%xmm0 \n\t" - "movdqu (%1, %3), %%xmm1 \n\t" + "movdqu (%1, %4), %%xmm1 \n\t" "psadbw (%2), %%xmm0 \n\t" - "psadbw (%2, %3), %%xmm1 \n\t" - "paddw %%xmm0, %%xmm6 \n\t" - "paddw %%xmm1, %%xmm6 \n\t" - "lea (%1,%3,2), %1 \n\t" - "lea (%2,%3,2), %2 \n\t" + "psadbw (%2, %4), %%xmm1 \n\t" + "paddw %%xmm0, %%xmm2 \n\t" + "paddw %%xmm1, %%xmm2 \n\t" + "lea (%1,%4,2), %1 \n\t" + "lea (%2,%4,2), %2 \n\t" "sub $2, %0 \n\t" " jg 1b \n\t" - : "+r" (h), "+r" (blk1), "+r" (blk2) + "movhlps %%xmm2, %%xmm0 \n\t" + "paddw %%xmm0, %%xmm2 \n\t" + "movd %%xmm2, %3 \n\t" + : "+r" (h), "+r" (blk1), "+r" (blk2), "=r"(ret) : "r" ((x86_reg)stride) ); - __asm__ volatile( - "movhlps %%xmm6, %%xmm0 \n\t" - "paddw %%xmm0, %%xmm6 \n\t" - "movd %%xmm6, %0 \n\t" - : "=r"(ret) - ); return ret; } @@ -427,7 +424,9 @@ void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx) { - if (mm_flags & FF_MM_MMX) { + int mm_flags = av_get_cpu_flags(); + + if (mm_flags & AV_CPU_FLAG_MMX) { c->pix_abs[0][0] = sad16_mmx; c->pix_abs[0][1] = sad16_x2_mmx; c->pix_abs[0][2] = sad16_y2_mmx; @@ -440,7 +439,7 @@ c->sad[0]= sad16_mmx; c->sad[1]= sad8_mmx; } - if (mm_flags & FF_MM_MMX2) { + if (mm_flags & AV_CPU_FLAG_MMX2) { c->pix_abs[0][0] = sad16_mmx2; c->pix_abs[1][0] = sad8_mmx2; @@ -456,7 +455,7 @@ c->pix_abs[1][3] = sad8_xy2_mmx2; } } - if ((mm_flags & FF_MM_SSE2) && !(mm_flags & FF_MM_3DNOW) && avctx->codec_id != CODEC_ID_SNOW) { + if ((mm_flags & AV_CPU_FLAG_SSE2) && !(mm_flags & AV_CPU_FLAG_3DNOW) && avctx->codec_id != CODEC_ID_SNOW) { c->sad[0]= sad16_sse2; } } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/mpegaudiodec_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/mpegaudiodec_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/mpegaudiodec_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/mpegaudiodec_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #define CONFIG_FLOAT 1 @@ -149,9 +150,9 @@ void ff_mpegaudiodec_init_mmx(MPADecodeContext *s) { - mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); - if (mm_flags & FF_MM_SSE2) { + if (mm_flags & AV_CPU_FLAG_SSE2) { s->apply_window_mp3 = apply_window_mp3; } } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/mpegvideo_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/mpegvideo_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/mpegvideo_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/mpegvideo_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -22,6 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" @@ -580,6 +581,8 @@ " jb 1b \n\t" : "+r" (block), "+r" (sum), "+r" (offset) : "r"(block+64) + XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", + "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); } @@ -625,7 +628,9 @@ void MPV_common_init_mmx(MpegEncContext *s) { - if (mm_flags & FF_MM_MMX) { + int mm_flags = av_get_cpu_flags(); + + if (mm_flags & AV_CPU_FLAG_MMX) { const int dct_algo = s->avctx->dct_algo; s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx; @@ -636,7 +641,7 @@ s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx; s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx; - if (mm_flags & FF_MM_SSE2) { + if (mm_flags & AV_CPU_FLAG_SSE2) { s->denoise_dct= denoise_dct_sse2; } else { s->denoise_dct= denoise_dct_mmx; @@ -644,13 +649,13 @@ if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){ #if HAVE_SSSE3 - if(mm_flags & FF_MM_SSSE3){ + if(mm_flags & AV_CPU_FLAG_SSSE3){ s->dct_quantize= dct_quantize_SSSE3; } else #endif - if(mm_flags & FF_MM_SSE2){ + if(mm_flags & AV_CPU_FLAG_SSE2){ s->dct_quantize= dct_quantize_SSE2; - } else if(mm_flags & FF_MM_MMX2){ + } else if(mm_flags & AV_CPU_FLAG_MMX2){ s->dct_quantize= dct_quantize_MMX2; } else { s->dct_quantize= dct_quantize_MMX; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/mpegvideo_mmx_template.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/mpegvideo_mmx_template.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/mpegvideo_mmx_template.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/mpegvideo_mmx_template.c 2010-11-06 17:21:28.000000000 +0000 @@ -180,6 +180,8 @@ : "+a" (last_non_zero_p1) : "r" (block+64), "r" (qmat), "r" (bias), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) + XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", + "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); }else{ // FMT_H263 __asm__ volatile( @@ -212,6 +214,8 @@ : "+a" (last_non_zero_p1) : "r" (block+64), "r" (qmat+64), "r" (bias+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) + XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", + "%xmm4", "%xmm5", "%xmm6", "%xmm7") ); } __asm__ volatile( diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/rv40dsp_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/rv40dsp_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/rv40dsp_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/rv40dsp_mmx.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2008 Konstantin Shishkov, Mathieu Velten - * - * MMX-optimized DSP functions for RV40, based on H.264 optimizations by - * Michael Niedermayer and Loren Merritt - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "dsputil_mmx.h" - -/* bias interleaved with bias div 8, use p+1 to access bias div 8 */ -DECLARE_ALIGNED(8, static const uint64_t, rv40_bias_reg)[4][8] = { - { 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0010001000100010ULL, 0x0002000200020002ULL, - 0x0020002000200020ULL, 0x0004000400040004ULL, 0x0010001000100010ULL, 0x0002000200020002ULL }, - { 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL, - 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL }, - { 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0020002000200020ULL, 0x0004000400040004ULL, - 0x0010001000100010ULL, 0x0002000200020002ULL, 0x0020002000200020ULL, 0x0004000400040004ULL }, - { 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL, - 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL } -}; - -static void put_rv40_chroma_mc8_mmx(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - put_h264_chroma_generic_mc8_mmx(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]); -} -static void put_rv40_chroma_mc4_mmx(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - put_h264_chroma_generic_mc4_mmx(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]); -} -static void avg_rv40_chroma_mc8_mmx2(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - avg_h264_chroma_generic_mc8_mmx2(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]); -} -static void avg_rv40_chroma_mc4_mmx2(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - avg_h264_chroma_generic_mc4_mmx2(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]); -} -static void avg_rv40_chroma_mc8_3dnow(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - avg_h264_chroma_generic_mc8_3dnow(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]); -} -static void avg_rv40_chroma_mc4_3dnow(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) -{ - avg_h264_chroma_generic_mc4_3dnow(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]); -} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/simple_idct_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/simple_idct_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/simple_idct_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/simple_idct_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -1287,10 +1287,10 @@ void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block) { idct(block); - put_pixels_clamped_mmx(block, dest, line_size); + ff_put_pixels_clamped_mmx(block, dest, line_size); } void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block) { idct(block); - add_pixels_clamped_mmx(block, dest, line_size); + ff_add_pixels_clamped_mmx(block, dest, line_size); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/snowdsp_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/snowdsp_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/snowdsp_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/snowdsp_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/avcodec.h" #include "libavcodec/snow.h" @@ -811,7 +812,7 @@ "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\ "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\ "add %%"REG_c", (%%"REG_a") \n\t"\ - "add $"PTR_SIZE"*1, %1 \n\t"\ + "add"OPSIZE " $"PTR_SIZE"*1, %1 \n\t"\ "add %%"REG_c", %0 \n\t"\ "dec %2 \n\t"\ "jnz 1b \n\t"\ @@ -874,10 +875,10 @@ void ff_dwt_init_x86(DWTContext *c) { - mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); - if (mm_flags & FF_MM_MMX) { - if(mm_flags & FF_MM_SSE2 & 0){ + if (mm_flags & AV_CPU_FLAG_MMX) { + if(mm_flags & AV_CPU_FLAG_SSE2 & 0){ c->horizontal_compose97i = ff_snow_horizontal_compose97i_sse2; #if HAVE_7REGS c->vertical_compose97i = ff_snow_vertical_compose97i_sse2; @@ -885,7 +886,7 @@ c->inner_add_yblock = ff_snow_inner_add_yblock_sse2; } else{ - if(mm_flags & FF_MM_MMX2){ + if(mm_flags & AV_CPU_FLAG_MMX2){ c->horizontal_compose97i = ff_snow_horizontal_compose97i_mmx; #if HAVE_7REGS c->vertical_compose97i = ff_snow_vertical_compose97i_mmx; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vc1dsp_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vc1dsp_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vc1dsp_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vc1dsp_mmx.c 2010-11-06 17:21:28.000000000 +0000 @@ -24,6 +24,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "dsputil_mmx.h" @@ -714,7 +715,7 @@ #endif void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) { - mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx; dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx; @@ -736,7 +737,7 @@ dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx; dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx; - if (mm_flags & FF_MM_MMX2){ + if (mm_flags & AV_CPU_FLAG_MMX2){ dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2; dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmx2; dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmx2; @@ -772,23 +773,23 @@ dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT #if HAVE_YASM - if (mm_flags & FF_MM_MMX) { + if (mm_flags & AV_CPU_FLAG_MMX) { ASSIGN_LF(mmx); } return; - if (mm_flags & FF_MM_MMX2) { + if (mm_flags & AV_CPU_FLAG_MMX2) { ASSIGN_LF(mmx2); } - if (mm_flags & FF_MM_SSE2) { + if (mm_flags & AV_CPU_FLAG_SSE2) { dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2; dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2; dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2; dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2; } - if (mm_flags & FF_MM_SSSE3) { + if (mm_flags & AV_CPU_FLAG_SSSE3) { ASSIGN_LF(ssse3); } - if (mm_flags & FF_MM_SSE4) { + if (mm_flags & AV_CPU_FLAG_SSE4) { dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4; dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vc1dsp_yasm.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vc1dsp_yasm.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vc1dsp_yasm.asm 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vc1dsp_yasm.asm 2010-11-06 17:21:28.000000000 +0000 @@ -36,7 +36,7 @@ %endmacro %macro STORE_4_WORDS_MMX 6 - movd %6, %5 + movd %6d, %5 %if mmsize==16 psrldq %5, 4 %else @@ -45,7 +45,7 @@ mov %1, %6w shr %6, 16 mov %2, %6w - movd %6, %5 + movd %6d, %5 mov %3, %6w shr %6, 16 mov %4, %6w @@ -88,7 +88,7 @@ pxor m7, m3 ; d_sign ^= a0_sign pxor m5, m5 - movd m3, r2 + movd m3, r2d %if %1 > 4 punpcklbw m3, m3 %endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp.asm 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp.asm 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,618 @@ +;****************************************************************************** +;* MMX/SSE2-optimized functions for the VP3 decoder +;* Copyright (c) 2007 Aurelien Jacobs +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg is distributed in the hope that it will be useful, +;* but WITHOUT ANY WARRANTY; without even the implied warranty of +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" +%include "x86util.asm" + +; MMX-optimized functions cribbed from the original VP3 source code. + +SECTION_RODATA + +vp3_idct_data: times 8 dw 64277 + times 8 dw 60547 + times 8 dw 54491 + times 8 dw 46341 + times 8 dw 36410 + times 8 dw 25080 + times 8 dw 12785 + +cextern pb_1 +cextern pb_3 +cextern pb_7 +cextern pb_1F +cextern pb_81 + +cextern pw_8 + +cextern put_signed_pixels_clamped_mmx +cextern add_pixels_clamped_mmx + +SECTION .text + +; this is off by one or two for some cases when filter_limit is greater than 63 +; in: p0 in mm6, p1 in mm4, p2 in mm2, p3 in mm1 +; out: p1 in mm4, p2 in mm3 +%macro VP3_LOOP_FILTER 0 + movq m7, m6 + pand m6, [pb_7] ; p0&7 + psrlw m7, 3 + pand m7, [pb_1F] ; p0>>3 + movq m3, m2 ; p2 + pxor m2, m4 + pand m2, [pb_1] ; (p2^p1)&1 + movq m5, m2 + paddb m2, m2 + paddb m2, m5 ; 3*(p2^p1)&1 + paddb m2, m6 ; extra bits lost in shifts + pcmpeqb m0, m0 + pxor m1, m0 ; 255 - p3 + pavgb m1, m2 ; (256 - p3 + extrabits) >> 1 + pxor m0, m4 ; 255 - p1 + pavgb m0, m3 ; (256 + p2-p1) >> 1 + paddb m1, [pb_3] + pavgb m1, m0 ; 128+2+( p2-p1 - p3) >> 2 + pavgb m1, m0 ; 128+1+(3*(p2-p1) - p3) >> 3 + paddusb m7, m1 ; d+128+1 + movq m6, [pb_81] + psubusb m6, m7 + psubusb m7, [pb_81] + + movq m5, [r2+516] ; flim + pminub m6, m5 + pminub m7, m5 + movq m0, m6 + movq m1, m7 + paddb m6, m6 + paddb m7, m7 + pminub m6, m5 + pminub m7, m5 + psubb m6, m0 + psubb m7, m1 + paddusb m4, m7 + psubusb m4, m6 + psubusb m3, m7 + paddusb m3, m6 +%endmacro + +%macro STORE_4_WORDS 1 + movd r2d, %1 + mov [r0 -1], r2w + psrlq %1, 32 + shr r2, 16 + mov [r0+r1 -1], r2w + movd r2d, %1 + mov [r0+r1*2-1], r2w + shr r2, 16 + mov [r0+r3 -1], r2w +%endmacro + +INIT_MMX +cglobal vp3_v_loop_filter_mmx2, 3, 4 +%ifdef ARCH_X86_64 + movsxd r1, r1d +%endif + mov r3, r1 + neg r1 + movq m6, [r0+r1*2] + movq m4, [r0+r1 ] + movq m2, [r0 ] + movq m1, [r0+r3 ] + + VP3_LOOP_FILTER + + movq [r0+r1], m4 + movq [r0 ], m3 + RET + +cglobal vp3_h_loop_filter_mmx2, 3, 4 +%ifdef ARCH_X86_64 + movsxd r1, r1d +%endif + lea r3, [r1*3] + + movd m6, [r0 -2] + movd m4, [r0+r1 -2] + movd m2, [r0+r1*2-2] + movd m1, [r0+r3 -2] + lea r0, [r0+r1*4 ] + punpcklbw m6, [r0 -2] + punpcklbw m4, [r0+r1 -2] + punpcklbw m2, [r0+r1*2-2] + punpcklbw m1, [r0+r3 -2] + sub r0, r3 + sub r0, r1 + + TRANSPOSE4x4B 6, 4, 2, 1, 0 + VP3_LOOP_FILTER + SBUTTERFLY bw, 4, 3, 5 + + STORE_4_WORDS m4 + lea r0, [r0+r1*4 ] + STORE_4_WORDS m3 + RET + +; from original comments: The Macro does IDct on 4 1-D Dcts +%macro BeginIDCT 0 + movq m2, I(3) + movq m6, C(3) + movq m4, m2 + movq m7, J(5) + pmulhw m4, m6 ; r4 = c3*i3 - i3 + movq m1, C(5) + pmulhw m6, m7 ; r6 = c3*i5 - i5 + movq m5, m1 + pmulhw m1, m2 ; r1 = c5*i3 - i3 + movq m3, I(1) + pmulhw m5, m7 ; r5 = c5*i5 - i5 + movq m0, C(1) + paddw m4, m2 ; r4 = c3*i3 + paddw m6, m7 ; r6 = c3*i5 + paddw m2, m1 ; r2 = c5*i3 + movq m1, J(7) + paddw m7, m5 ; r7 = c5*i5 + movq m5, m0 ; r5 = c1 + pmulhw m0, m3 ; r0 = c1*i1 - i1 + paddsw m4, m7 ; r4 = C = c3*i3 + c5*i5 + pmulhw m5, m1 ; r5 = c1*i7 - i7 + movq m7, C(7) + psubsw m6, m2 ; r6 = D = c3*i5 - c5*i3 + paddw m0, m3 ; r0 = c1*i1 + pmulhw m3, m7 ; r3 = c7*i1 + movq m2, I(2) + pmulhw m7, m1 ; r7 = c7*i7 + paddw m5, m1 ; r5 = c1*i7 + movq m1, m2 ; r1 = i2 + pmulhw m2, C(2) ; r2 = c2*i2 - i2 + psubsw m3, m5 ; r3 = B = c7*i1 - c1*i7 + movq m5, J(6) + paddsw m0, m7 ; r0 = A = c1*i1 + c7*i7 + movq m7, m5 ; r7 = i6 + psubsw m0, m4 ; r0 = A - C + pmulhw m5, C(2) ; r5 = c2*i6 - i6 + paddw m2, m1 ; r2 = c2*i2 + pmulhw m1, C(6) ; r1 = c6*i2 + paddsw m4, m4 ; r4 = C + C + paddsw m4, m0 ; r4 = C. = A + C + psubsw m3, m6 ; r3 = B - D + paddw m5, m7 ; r5 = c2*i6 + paddsw m6, m6 ; r6 = D + D + pmulhw m7, C(6) ; r7 = c6*i6 + paddsw m6, m3 ; r6 = D. = B + D + movq I(1), m4 ; save C. at I(1) + psubsw m1, m5 ; r1 = H = c6*i2 - c2*i6 + movq m4, C(4) + movq m5, m3 ; r5 = B - D + pmulhw m3, m4 ; r3 = (c4 - 1) * (B - D) + paddsw m7, m2 ; r3 = (c4 - 1) * (B - D) + movq I(2), m6 ; save D. at I(2) + movq m2, m0 ; r2 = A - C + movq m6, I(0) + pmulhw m0, m4 ; r0 = (c4 - 1) * (A - C) + paddw m5, m3 ; r5 = B. = c4 * (B - D) + movq m3, J(4) + psubsw m5, m1 ; r5 = B.. = B. - H + paddw m2, m0 ; r0 = A. = c4 * (A - C) + psubsw m6, m3 ; r6 = i0 - i4 + movq m0, m6 + pmulhw m6, m4 ; r6 = (c4 - 1) * (i0 - i4) + paddsw m3, m3 ; r3 = i4 + i4 + paddsw m1, m1 ; r1 = H + H + paddsw m3, m0 ; r3 = i0 + i4 + paddsw m1, m5 ; r1 = H. = B + H + pmulhw m4, m3 ; r4 = (c4 - 1) * (i0 + i4) + paddsw m6, m0 ; r6 = F = c4 * (i0 - i4) + psubsw m6, m2 ; r6 = F. = F - A. + paddsw m2, m2 ; r2 = A. + A. + movq m0, I(1) ; r0 = C. + paddsw m2, m6 ; r2 = A.. = F + A. + paddw m4, m3 ; r4 = E = c4 * (i0 + i4) + psubsw m2, m1 ; r2 = R2 = A.. - H. +%endmacro + +; RowIDCT gets ready to transpose +%macro RowIDCT 0 + BeginIDCT + movq m3, I(2) ; r3 = D. + psubsw m4, m7 ; r4 = E. = E - G + paddsw m1, m1 ; r1 = H. + H. + paddsw m7, m7 ; r7 = G + G + paddsw m1, m2 ; r1 = R1 = A.. + H. + paddsw m7, m4 ; r1 = R1 = A.. + H. + psubsw m4, m3 ; r4 = R4 = E. - D. + paddsw m3, m3 + psubsw m6, m5 ; r6 = R6 = F. - B.. + paddsw m5, m5 + paddsw m3, m4 ; r3 = R3 = E. + D. + paddsw m5, m6 ; r5 = R5 = F. + B.. + psubsw m7, m0 ; r7 = R7 = G. - C. + paddsw m0, m0 + movq I(1), m1 ; save R1 + paddsw m0, m7 ; r0 = R0 = G. + C. +%endmacro + +; Column IDCT normalizes and stores final results +%macro ColumnIDCT 0 + BeginIDCT + paddsw m2, OC_8 ; adjust R2 (and R1) for shift + paddsw m1, m1 ; r1 = H. + H. + paddsw m1, m2 ; r1 = R1 = A.. + H. + psraw m2, 4 ; r2 = NR2 + psubsw m4, m7 ; r4 = E. = E - G + psraw m1, 4 ; r1 = NR2 + movq m3, I(2) ; r3 = D. + paddsw m7, m7 ; r7 = G + G + movq I(2), m2 ; store NR2 at I2 + paddsw m7, m4 ; r7 = G. = E + G + movq I(1), m1 ; store NR1 at I1 + psubsw m4, m3 ; r4 = R4 = E. - D. + paddsw m4, OC_8 ; adjust R4 (and R3) for shift + paddsw m3, m3 ; r3 = D. + D. + paddsw m3, m4 ; r3 = R3 = E. + D. + psraw m4, 4 ; r4 = NR4 + psubsw m6, m5 ; r6 = R6 = F. - B.. + psraw m3, 4 ; r3 = NR3 + paddsw m6, OC_8 ; adjust R6 (and R5) for shift + paddsw m5, m5 ; r5 = B.. + B.. + paddsw m5, m6 ; r5 = R5 = F. + B.. + psraw m6, 4 ; r6 = NR6 + movq J(4), m4 ; store NR4 at J4 + psraw m5, 4 ; r5 = NR5 + movq I(3), m3 ; store NR3 at I3 + psubsw m7, m0 ; r7 = R7 = G. - C. + paddsw m7, OC_8 ; adjust R7 (and R0) for shift + paddsw m0, m0 ; r0 = C. + C. + paddsw m0, m7 ; r0 = R0 = G. + C. + psraw m7, 4 ; r7 = NR7 + movq J(6), m6 ; store NR6 at J6 + psraw m0, 4 ; r0 = NR0 + movq J(5), m5 ; store NR5 at J5 + movq J(7), m7 ; store NR7 at J7 + movq I(0), m0 ; store NR0 at I0 +%endmacro + +; Following macro does two 4x4 transposes in place. +; +; At entry (we assume): +; +; r0 = a3 a2 a1 a0 +; I(1) = b3 b2 b1 b0 +; r2 = c3 c2 c1 c0 +; r3 = d3 d2 d1 d0 +; +; r4 = e3 e2 e1 e0 +; r5 = f3 f2 f1 f0 +; r6 = g3 g2 g1 g0 +; r7 = h3 h2 h1 h0 +; +; At exit, we have: +; +; I(0) = d0 c0 b0 a0 +; I(1) = d1 c1 b1 a1 +; I(2) = d2 c2 b2 a2 +; I(3) = d3 c3 b3 a3 +; +; J(4) = h0 g0 f0 e0 +; J(5) = h1 g1 f1 e1 +; J(6) = h2 g2 f2 e2 +; J(7) = h3 g3 f3 e3 +; +; I(0) I(1) I(2) I(3) is the transpose of r0 I(1) r2 r3. +; J(4) J(5) J(6) J(7) is the transpose of r4 r5 r6 r7. +; +; Since r1 is free at entry, we calculate the Js first. +%macro Transpose 0 + movq m1, m4 ; r1 = e3 e2 e1 e0 + punpcklwd m4, m5 ; r4 = f1 e1 f0 e0 + movq I(0), m0 ; save a3 a2 a1 a0 + punpckhwd m1, m5 ; r1 = f3 e3 f2 e2 + movq m0, m6 ; r0 = g3 g2 g1 g0 + punpcklwd m6, m7 ; r6 = h1 g1 h0 g0 + movq m5, m4 ; r5 = f1 e1 f0 e0 + punpckldq m4, m6 ; r4 = h0 g0 f0 e0 = R4 + punpckhdq m5, m6 ; r5 = h1 g1 f1 e1 = R5 + movq m6, m1 ; r6 = f3 e3 f2 e2 + movq J(4), m4 + punpckhwd m0, m7 ; r0 = h3 g3 h2 g2 + movq J(5), m5 + punpckhdq m6, m0 ; r6 = h3 g3 f3 e3 = R7 + movq m4, I(0) ; r4 = a3 a2 a1 a0 + punpckldq m1, m0 ; r1 = h2 g2 f2 e2 = R6 + movq m5, I(1) ; r5 = b3 b2 b1 b0 + movq m0, m4 ; r0 = a3 a2 a1 a0 + movq J(7), m6 + punpcklwd m0, m5 ; r0 = b1 a1 b0 a0 + movq J(6), m1 + punpckhwd m4, m5 ; r4 = b3 a3 b2 a2 + movq m5, m2 ; r5 = c3 c2 c1 c0 + punpcklwd m2, m3 ; r2 = d1 c1 d0 c0 + movq m1, m0 ; r1 = b1 a1 b0 a0 + punpckldq m0, m2 ; r0 = d0 c0 b0 a0 = R0 + punpckhdq m1, m2 ; r1 = d1 c1 b1 a1 = R1 + movq m2, m4 ; r2 = b3 a3 b2 a2 + movq I(0), m0 + punpckhwd m5, m3 ; r5 = d3 c3 d2 c2 + movq I(1), m1 + punpckhdq m4, m5 ; r4 = d3 c3 b3 a3 = R3 + punpckldq m2, m5 ; r2 = d2 c2 b2 a2 = R2 + movq I(3), m4 + movq I(2), m2 +%endmacro + +%macro VP3_IDCT_mmx 1 + ; eax = quantized input + ; ebx = dequantizer matrix + ; ecx = IDCT constants + ; M(I) = ecx + MaskOffset(0) + I * 8 + ; C(I) = ecx + CosineOffset(32) + (I-1) * 8 + ; edx = output + ; r0..r7 = mm0..mm7 +%define OC_8 [pw_8] +%define C(x) [vp3_idct_data+16*(x-1)] + + ; at this point, function has completed dequantization + dezigzag + + ; partial transposition; now do the idct itself +%define I(x) [%1+16* x ] +%define J(x) [%1+16*(x-4)+8] + RowIDCT + Transpose + +%define I(x) [%1+16* x +64] +%define J(x) [%1+16*(x-4)+72] + RowIDCT + Transpose + +%define I(x) [%1+16*x] +%define J(x) [%1+16*x] + ColumnIDCT + +%define I(x) [%1+16*x+8] +%define J(x) [%1+16*x+8] + ColumnIDCT +%endmacro + +%macro VP3_1D_IDCT_SSE2 0 + movdqa m2, I(3) ; xmm2 = i3 + movdqa m6, C(3) ; xmm6 = c3 + movdqa m4, m2 ; xmm4 = i3 + movdqa m7, I(5) ; xmm7 = i5 + pmulhw m4, m6 ; xmm4 = c3 * i3 - i3 + movdqa m1, C(5) ; xmm1 = c5 + pmulhw m6, m7 ; xmm6 = c3 * i5 - i5 + movdqa m5, m1 ; xmm5 = c5 + pmulhw m1, m2 ; xmm1 = c5 * i3 - i3 + movdqa m3, I(1) ; xmm3 = i1 + pmulhw m5, m7 ; xmm5 = c5 * i5 - i5 + movdqa m0, C(1) ; xmm0 = c1 + paddw m4, m2 ; xmm4 = c3 * i3 + paddw m6, m7 ; xmm6 = c3 * i5 + paddw m2, m1 ; xmm2 = c5 * i3 + movdqa m1, I(7) ; xmm1 = i7 + paddw m7, m5 ; xmm7 = c5 * i5 + movdqa m5, m0 ; xmm5 = c1 + pmulhw m0, m3 ; xmm0 = c1 * i1 - i1 + paddsw m4, m7 ; xmm4 = c3 * i3 + c5 * i5 = C + pmulhw m5, m1 ; xmm5 = c1 * i7 - i7 + movdqa m7, C(7) ; xmm7 = c7 + psubsw m6, m2 ; xmm6 = c3 * i5 - c5 * i3 = D + paddw m0, m3 ; xmm0 = c1 * i1 + pmulhw m3, m7 ; xmm3 = c7 * i1 + movdqa m2, I(2) ; xmm2 = i2 + pmulhw m7, m1 ; xmm7 = c7 * i7 + paddw m5, m1 ; xmm5 = c1 * i7 + movdqa m1, m2 ; xmm1 = i2 + pmulhw m2, C(2) ; xmm2 = i2 * c2 -i2 + psubsw m3, m5 ; xmm3 = c7 * i1 - c1 * i7 = B + movdqa m5, I(6) ; xmm5 = i6 + paddsw m0, m7 ; xmm0 = c1 * i1 + c7 * i7 = A + movdqa m7, m5 ; xmm7 = i6 + psubsw m0, m4 ; xmm0 = A - C + pmulhw m5, C(2) ; xmm5 = c2 * i6 - i6 + paddw m2, m1 ; xmm2 = i2 * c2 + pmulhw m1, C(6) ; xmm1 = c6 * i2 + paddsw m4, m4 ; xmm4 = C + C + paddsw m4, m0 ; xmm4 = A + C = C. + psubsw m3, m6 ; xmm3 = B - D + paddw m5, m7 ; xmm5 = c2 * i6 + paddsw m6, m6 ; xmm6 = D + D + pmulhw m7, C(6) ; xmm7 = c6 * i6 + paddsw m6, m3 ; xmm6 = B + D = D. + movdqa I(1), m4 ; Save C. at I(1) + psubsw m1, m5 ; xmm1 = c6 * i2 - c2 * i6 = H + movdqa m4, C(4) ; xmm4 = C4 + movdqa m5, m3 ; xmm5 = B - D + pmulhw m3, m4 ; xmm3 = ( c4 -1 ) * ( B - D ) + paddsw m7, m2 ; xmm7 = c2 * i2 + c6 * i6 = G + movdqa I(2), m6 ; save D. at I(2) + movdqa m2, m0 ; xmm2 = A - C + movdqa m6, I(0) ; xmm6 = i0 + pmulhw m0, m4 ; xmm0 = ( c4 - 1 ) * ( A - C ) = A. + paddw m5, m3 ; xmm5 = c4 * ( B - D ) = B. + movdqa m3, I(4) ; xmm3 = i4 + psubsw m5, m1 ; xmm5 = B. - H = B.. + paddw m2, m0 ; xmm2 = c4 * ( A - C) = A. + psubsw m6, m3 ; xmm6 = i0 - i4 + movdqa m0, m6 ; xmm0 = i0 - i4 + pmulhw m6, m4 ; xmm6 = (c4 - 1) * (i0 - i4) = F + paddsw m3, m3 ; xmm3 = i4 + i4 + paddsw m1, m1 ; xmm1 = H + H + paddsw m3, m0 ; xmm3 = i0 + i4 + paddsw m1, m5 ; xmm1 = B. + H = H. + pmulhw m4, m3 ; xmm4 = ( c4 - 1 ) * ( i0 + i4 ) + paddw m6, m0 ; xmm6 = c4 * ( i0 - i4 ) + psubsw m6, m2 ; xmm6 = F - A. = F. + paddsw m2, m2 ; xmm2 = A. + A. + movdqa m0, I(1) ; Load C. from I(1) + paddsw m2, m6 ; xmm2 = F + A. = A.. + paddw m4, m3 ; xmm4 = c4 * ( i0 + i4 ) = 3 + psubsw m2, m1 ; xmm2 = A.. - H. = R2 + ADD(m2) ; Adjust R2 and R1 before shifting + paddsw m1, m1 ; xmm1 = H. + H. + paddsw m1, m2 ; xmm1 = A.. + H. = R1 + SHIFT(m2) ; xmm2 = op2 + psubsw m4, m7 ; xmm4 = E - G = E. + SHIFT(m1) ; xmm1 = op1 + movdqa m3, I(2) ; Load D. from I(2) + paddsw m7, m7 ; xmm7 = G + G + paddsw m7, m4 ; xmm7 = E + G = G. + psubsw m4, m3 ; xmm4 = E. - D. = R4 + ADD(m4) ; Adjust R4 and R3 before shifting + paddsw m3, m3 ; xmm3 = D. + D. + paddsw m3, m4 ; xmm3 = E. + D. = R3 + SHIFT(m4) ; xmm4 = op4 + psubsw m6, m5 ; xmm6 = F. - B..= R6 + SHIFT(m3) ; xmm3 = op3 + ADD(m6) ; Adjust R6 and R5 before shifting + paddsw m5, m5 ; xmm5 = B.. + B.. + paddsw m5, m6 ; xmm5 = F. + B.. = R5 + SHIFT(m6) ; xmm6 = op6 + SHIFT(m5) ; xmm5 = op5 + psubsw m7, m0 ; xmm7 = G. - C. = R7 + ADD(m7) ; Adjust R7 and R0 before shifting + paddsw m0, m0 ; xmm0 = C. + C. + paddsw m0, m7 ; xmm0 = G. + C. + SHIFT(m7) ; xmm7 = op7 + SHIFT(m0) ; xmm0 = op0 +%endmacro + +%macro PUT_BLOCK 8 + movdqa O(0), m%1 + movdqa O(1), m%2 + movdqa O(2), m%3 + movdqa O(3), m%4 + movdqa O(4), m%5 + movdqa O(5), m%6 + movdqa O(6), m%7 + movdqa O(7), m%8 +%endmacro + +%macro VP3_IDCT_sse2 1 +%define I(x) [%1+16*x] +%define O(x) [%1+16*x] +%define C(x) [vp3_idct_data+16*(x-1)] +%define SHIFT(x) +%define ADD(x) + VP3_1D_IDCT_SSE2 +%ifdef ARCH_X86_64 + TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, 8 +%else + TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, [%1], [%1+16] +%endif + PUT_BLOCK 0, 1, 2, 3, 4, 5, 6, 7 + +%define SHIFT(x) psraw x, 4 +%define ADD(x) paddsw x, [pw_8] + VP3_1D_IDCT_SSE2 + PUT_BLOCK 0, 1, 2, 3, 4, 5, 6, 7 +%endmacro + +%macro vp3_idct_funcs 3 +cglobal vp3_idct_%1, 1, 1, %2 + VP3_IDCT_%1 r0 + RET + +cglobal vp3_idct_put_%1, 3, %3, %2 + VP3_IDCT_%1 r2 +%ifdef ARCH_X86_64 + mov r3, r2 + mov r2, r1 + mov r1, r0 + mov r0, r3 +%else + mov r0m, r2 + mov r1m, r0 + mov r2m, r1 +%endif +%ifdef WIN64 + call put_signed_pixels_clamped_mmx + RET +%else + jmp put_signed_pixels_clamped_mmx +%endif + +cglobal vp3_idct_add_%1, 3, %3, %2 + VP3_IDCT_%1 r2 +%ifdef ARCH_X86_64 + mov r3, r2 + mov r2, r1 + mov r1, r0 + mov r0, r3 +%else + mov r0m, r2 + mov r1m, r0 + mov r2m, r1 +%endif +%ifdef WIN64 + call add_pixels_clamped_mmx + RET +%else + jmp add_pixels_clamped_mmx +%endif +%endmacro + +%ifdef ARCH_X86_64 +%define REGS 4 +%else +%define REGS 3 +%endif +INIT_MMX +vp3_idct_funcs mmx, 0, REGS +INIT_XMM +vp3_idct_funcs sse2, 9, REGS +%undef REGS + +%macro DC_ADD 0 + movq m2, [r0 ] + movq m3, [r0+r1 ] + paddusb m2, m0 + movq m4, [r0+r1*2] + paddusb m3, m0 + movq m5, [r0+r3 ] + paddusb m4, m0 + paddusb m5, m0 + psubusb m2, m1 + psubusb m3, m1 + movq [r0 ], m2 + psubusb m4, m1 + movq [r0+r1 ], m3 + psubusb m5, m1 + movq [r0+r1*2], m4 + movq [r0+r3 ], m5 +%endmacro + +INIT_MMX +cglobal vp3_idct_dc_add_mmx2, 3, 4 +%ifdef ARCH_X86_64 + movsxd r1, r1d +%endif + lea r3, [r1*3] + movsx r2, word [r2] + add r2, 15 + sar r2, 5 + movd m0, r2d + pshufw m0, m0, 0x0 + pxor m1, m1 + psubw m1, m0 + packuswb m0, m0 + packuswb m1, m1 + DC_ADD + lea r0, [r0+r1*4] + DC_ADD + RET diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp_mmx.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,436 +0,0 @@ -/* - * Copyright (C) 2004 the ffmpeg project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * MMX-optimized functions cribbed from the original VP3 source code. - */ - -#include "libavutil/x86_cpu.h" -#include "libavcodec/dsputil.h" -#include "dsputil_mmx.h" -#include "vp3dsp_mmx.h" - -extern const uint16_t ff_vp3_idct_data[]; - -// this is off by one or two for some cases when filter_limit is greater than 63 -// in: p0 in mm6, p1 in mm4, p2 in mm2, p3 in mm1 -// out: p1 in mm4, p2 in mm3 -#define VP3_LOOP_FILTER(flim) \ - "movq %%mm6, %%mm7 \n\t" \ - "pand "MANGLE(ff_pb_7 )", %%mm6 \n\t" /* p0&7 */ \ - "psrlw $3, %%mm7 \n\t" \ - "pand "MANGLE(ff_pb_1F)", %%mm7 \n\t" /* p0>>3 */ \ - "movq %%mm2, %%mm3 \n\t" /* mm3 = p2 */ \ - "pxor %%mm4, %%mm2 \n\t" \ - "pand "MANGLE(ff_pb_1 )", %%mm2 \n\t" /* (p2^p1)&1 */ \ - "movq %%mm2, %%mm5 \n\t" \ - "paddb %%mm2, %%mm2 \n\t" \ - "paddb %%mm5, %%mm2 \n\t" /* 3*(p2^p1)&1 */ \ - "paddb %%mm6, %%mm2 \n\t" /* extra bits lost in shifts */ \ - "pcmpeqb %%mm0, %%mm0 \n\t" \ - "pxor %%mm0, %%mm1 \n\t" /* 255 - p3 */ \ - "pavgb %%mm2, %%mm1 \n\t" /* (256 - p3 + extrabits) >> 1 */ \ - "pxor %%mm4, %%mm0 \n\t" /* 255 - p1 */ \ - "pavgb %%mm3, %%mm0 \n\t" /* (256 + p2-p1) >> 1 */ \ - "paddb "MANGLE(ff_pb_3 )", %%mm1 \n\t" \ - "pavgb %%mm0, %%mm1 \n\t" /* 128+2+( p2-p1 - p3) >> 2 */ \ - "pavgb %%mm0, %%mm1 \n\t" /* 128+1+(3*(p2-p1) - p3) >> 3 */ \ - "paddusb %%mm1, %%mm7 \n\t" /* d+128+1 */ \ - "movq "MANGLE(ff_pb_81)", %%mm6 \n\t" \ - "psubusb %%mm7, %%mm6 \n\t" \ - "psubusb "MANGLE(ff_pb_81)", %%mm7 \n\t" \ -\ - "movq "#flim", %%mm5 \n\t" \ - "pminub %%mm5, %%mm6 \n\t" \ - "pminub %%mm5, %%mm7 \n\t" \ - "movq %%mm6, %%mm0 \n\t" \ - "movq %%mm7, %%mm1 \n\t" \ - "paddb %%mm6, %%mm6 \n\t" \ - "paddb %%mm7, %%mm7 \n\t" \ - "pminub %%mm5, %%mm6 \n\t" \ - "pminub %%mm5, %%mm7 \n\t" \ - "psubb %%mm0, %%mm6 \n\t" \ - "psubb %%mm1, %%mm7 \n\t" \ - "paddusb %%mm7, %%mm4 \n\t" \ - "psubusb %%mm6, %%mm4 \n\t" \ - "psubusb %%mm7, %%mm3 \n\t" \ - "paddusb %%mm6, %%mm3 \n\t" - -#define STORE_4_WORDS(dst0, dst1, dst2, dst3, mm) \ - "movd "#mm", %0 \n\t" \ - "movw %w0, -1"#dst0" \n\t" \ - "psrlq $32, "#mm" \n\t" \ - "shr $16, %0 \n\t" \ - "movw %w0, -1"#dst1" \n\t" \ - "movd "#mm", %0 \n\t" \ - "movw %w0, -1"#dst2" \n\t" \ - "shr $16, %0 \n\t" \ - "movw %w0, -1"#dst3" \n\t" - -void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values) -{ - __asm__ volatile( - "movq %0, %%mm6 \n\t" - "movq %1, %%mm4 \n\t" - "movq %2, %%mm2 \n\t" - "movq %3, %%mm1 \n\t" - - VP3_LOOP_FILTER(%4) - - "movq %%mm4, %1 \n\t" - "movq %%mm3, %2 \n\t" - - : "+m" (*(uint64_t*)(src - 2*stride)), - "+m" (*(uint64_t*)(src - 1*stride)), - "+m" (*(uint64_t*)(src + 0*stride)), - "+m" (*(uint64_t*)(src + 1*stride)) - : "m"(*(uint64_t*)(bounding_values+129)) - ); -} - -void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values) -{ - x86_reg tmp; - - __asm__ volatile( - "movd -2(%1), %%mm6 \n\t" - "movd -2(%1,%3), %%mm0 \n\t" - "movd -2(%1,%3,2), %%mm1 \n\t" - "movd -2(%1,%4), %%mm4 \n\t" - - TRANSPOSE8x4(%%mm6, %%mm0, %%mm1, %%mm4, -2(%2), -2(%2,%3), -2(%2,%3,2), -2(%2,%4), %%mm2) - VP3_LOOP_FILTER(%5) - SBUTTERFLY(%%mm4, %%mm3, %%mm5, bw, q) - - STORE_4_WORDS((%1), (%1,%3), (%1,%3,2), (%1,%4), %%mm4) - STORE_4_WORDS((%2), (%2,%3), (%2,%3,2), (%2,%4), %%mm5) - - : "=&r"(tmp) - : "r"(src), "r"(src+4*stride), "r"((x86_reg)stride), "r"((x86_reg)3*stride), - "m"(*(uint64_t*)(bounding_values+129)) - : "memory" - ); -} - -/* from original comments: The Macro does IDct on 4 1-D Dcts */ -#define BeginIDCT() \ - "movq "I(3)", %%mm2 \n\t" \ - "movq "C(3)", %%mm6 \n\t" \ - "movq %%mm2, %%mm4 \n\t" \ - "movq "J(5)", %%mm7 \n\t" \ - "pmulhw %%mm6, %%mm4 \n\t" /* r4 = c3*i3 - i3 */ \ - "movq "C(5)", %%mm1 \n\t" \ - "pmulhw %%mm7, %%mm6 \n\t" /* r6 = c3*i5 - i5 */ \ - "movq %%mm1, %%mm5 \n\t" \ - "pmulhw %%mm2, %%mm1 \n\t" /* r1 = c5*i3 - i3 */ \ - "movq "I(1)", %%mm3 \n\t" \ - "pmulhw %%mm7, %%mm5 \n\t" /* r5 = c5*i5 - i5 */ \ - "movq "C(1)", %%mm0 \n\t" \ - "paddw %%mm2, %%mm4 \n\t" /* r4 = c3*i3 */ \ - "paddw %%mm7, %%mm6 \n\t" /* r6 = c3*i5 */ \ - "paddw %%mm1, %%mm2 \n\t" /* r2 = c5*i3 */ \ - "movq "J(7)", %%mm1 \n\t" \ - "paddw %%mm5, %%mm7 \n\t" /* r7 = c5*i5 */ \ - "movq %%mm0, %%mm5 \n\t" /* r5 = c1 */ \ - "pmulhw %%mm3, %%mm0 \n\t" /* r0 = c1*i1 - i1 */ \ - "paddsw %%mm7, %%mm4 \n\t" /* r4 = C = c3*i3 + c5*i5 */ \ - "pmulhw %%mm1, %%mm5 \n\t" /* r5 = c1*i7 - i7 */ \ - "movq "C(7)", %%mm7 \n\t" \ - "psubsw %%mm2, %%mm6 \n\t" /* r6 = D = c3*i5 - c5*i3 */ \ - "paddw %%mm3, %%mm0 \n\t" /* r0 = c1*i1 */ \ - "pmulhw %%mm7, %%mm3 \n\t" /* r3 = c7*i1 */ \ - "movq "I(2)", %%mm2 \n\t" \ - "pmulhw %%mm1, %%mm7 \n\t" /* r7 = c7*i7 */ \ - "paddw %%mm1, %%mm5 \n\t" /* r5 = c1*i7 */ \ - "movq %%mm2, %%mm1 \n\t" /* r1 = i2 */ \ - "pmulhw "C(2)", %%mm2 \n\t" /* r2 = c2*i2 - i2 */ \ - "psubsw %%mm5, %%mm3 \n\t" /* r3 = B = c7*i1 - c1*i7 */ \ - "movq "J(6)", %%mm5 \n\t" \ - "paddsw %%mm7, %%mm0 \n\t" /* r0 = A = c1*i1 + c7*i7 */ \ - "movq %%mm5, %%mm7 \n\t" /* r7 = i6 */ \ - "psubsw %%mm4, %%mm0 \n\t" /* r0 = A - C */ \ - "pmulhw "C(2)", %%mm5 \n\t" /* r5 = c2*i6 - i6 */ \ - "paddw %%mm1, %%mm2 \n\t" /* r2 = c2*i2 */ \ - "pmulhw "C(6)", %%mm1 \n\t" /* r1 = c6*i2 */ \ - "paddsw %%mm4, %%mm4 \n\t" /* r4 = C + C */ \ - "paddsw %%mm0, %%mm4 \n\t" /* r4 = C. = A + C */ \ - "psubsw %%mm6, %%mm3 \n\t" /* r3 = B - D */ \ - "paddw %%mm7, %%mm5 \n\t" /* r5 = c2*i6 */ \ - "paddsw %%mm6, %%mm6 \n\t" /* r6 = D + D */ \ - "pmulhw "C(6)", %%mm7 \n\t" /* r7 = c6*i6 */ \ - "paddsw %%mm3, %%mm6 \n\t" /* r6 = D. = B + D */ \ - "movq %%mm4, "I(1)"\n\t" /* save C. at I(1) */ \ - "psubsw %%mm5, %%mm1 \n\t" /* r1 = H = c6*i2 - c2*i6 */ \ - "movq "C(4)", %%mm4 \n\t" \ - "movq %%mm3, %%mm5 \n\t" /* r5 = B - D */ \ - "pmulhw %%mm4, %%mm3 \n\t" /* r3 = (c4 - 1) * (B - D) */ \ - "paddsw %%mm2, %%mm7 \n\t" /* r3 = (c4 - 1) * (B - D) */ \ - "movq %%mm6, "I(2)"\n\t" /* save D. at I(2) */ \ - "movq %%mm0, %%mm2 \n\t" /* r2 = A - C */ \ - "movq "I(0)", %%mm6 \n\t" \ - "pmulhw %%mm4, %%mm0 \n\t" /* r0 = (c4 - 1) * (A - C) */ \ - "paddw %%mm3, %%mm5 \n\t" /* r5 = B. = c4 * (B - D) */ \ - "movq "J(4)", %%mm3 \n\t" \ - "psubsw %%mm1, %%mm5 \n\t" /* r5 = B.. = B. - H */ \ - "paddw %%mm0, %%mm2 \n\t" /* r0 = A. = c4 * (A - C) */ \ - "psubsw %%mm3, %%mm6 \n\t" /* r6 = i0 - i4 */ \ - "movq %%mm6, %%mm0 \n\t" \ - "pmulhw %%mm4, %%mm6 \n\t" /* r6 = (c4 - 1) * (i0 - i4) */ \ - "paddsw %%mm3, %%mm3 \n\t" /* r3 = i4 + i4 */ \ - "paddsw %%mm1, %%mm1 \n\t" /* r1 = H + H */ \ - "paddsw %%mm0, %%mm3 \n\t" /* r3 = i0 + i4 */ \ - "paddsw %%mm5, %%mm1 \n\t" /* r1 = H. = B + H */ \ - "pmulhw %%mm3, %%mm4 \n\t" /* r4 = (c4 - 1) * (i0 + i4) */ \ - "paddsw %%mm0, %%mm6 \n\t" /* r6 = F = c4 * (i0 - i4) */ \ - "psubsw %%mm2, %%mm6 \n\t" /* r6 = F. = F - A. */ \ - "paddsw %%mm2, %%mm2 \n\t" /* r2 = A. + A. */ \ - "movq "I(1)", %%mm0 \n\t" /* r0 = C. */ \ - "paddsw %%mm6, %%mm2 \n\t" /* r2 = A.. = F + A. */ \ - "paddw %%mm3, %%mm4 \n\t" /* r4 = E = c4 * (i0 + i4) */ \ - "psubsw %%mm1, %%mm2 \n\t" /* r2 = R2 = A.. - H. */ - -/* RowIDCT gets ready to transpose */ -#define RowIDCT() \ - BeginIDCT() \ - "movq "I(2)", %%mm3 \n\t" /* r3 = D. */ \ - "psubsw %%mm7, %%mm4 \n\t" /* r4 = E. = E - G */ \ - "paddsw %%mm1, %%mm1 \n\t" /* r1 = H. + H. */ \ - "paddsw %%mm7, %%mm7 \n\t" /* r7 = G + G */ \ - "paddsw %%mm2, %%mm1 \n\t" /* r1 = R1 = A.. + H. */ \ - "paddsw %%mm4, %%mm7 \n\t" /* r1 = R1 = A.. + H. */ \ - "psubsw %%mm3, %%mm4 \n\t" /* r4 = R4 = E. - D. */ \ - "paddsw %%mm3, %%mm3 \n\t" \ - "psubsw %%mm5, %%mm6 \n\t" /* r6 = R6 = F. - B.. */ \ - "paddsw %%mm5, %%mm5 \n\t" \ - "paddsw %%mm4, %%mm3 \n\t" /* r3 = R3 = E. + D. */ \ - "paddsw %%mm6, %%mm5 \n\t" /* r5 = R5 = F. + B.. */ \ - "psubsw %%mm0, %%mm7 \n\t" /* r7 = R7 = G. - C. */ \ - "paddsw %%mm0, %%mm0 \n\t" \ - "movq %%mm1, "I(1)"\n\t" /* save R1 */ \ - "paddsw %%mm7, %%mm0 \n\t" /* r0 = R0 = G. + C. */ - -/* Column IDCT normalizes and stores final results */ -#define ColumnIDCT() \ - BeginIDCT() \ - "paddsw "OC_8", %%mm2 \n\t" /* adjust R2 (and R1) for shift */ \ - "paddsw %%mm1, %%mm1 \n\t" /* r1 = H. + H. */ \ - "paddsw %%mm2, %%mm1 \n\t" /* r1 = R1 = A.. + H. */ \ - "psraw $4, %%mm2 \n\t" /* r2 = NR2 */ \ - "psubsw %%mm7, %%mm4 \n\t" /* r4 = E. = E - G */ \ - "psraw $4, %%mm1 \n\t" /* r1 = NR1 */ \ - "movq "I(2)", %%mm3 \n\t" /* r3 = D. */ \ - "paddsw %%mm7, %%mm7 \n\t" /* r7 = G + G */ \ - "movq %%mm2, "I(2)"\n\t" /* store NR2 at I2 */ \ - "paddsw %%mm4, %%mm7 \n\t" /* r7 = G. = E + G */ \ - "movq %%mm1, "I(1)"\n\t" /* store NR1 at I1 */ \ - "psubsw %%mm3, %%mm4 \n\t" /* r4 = R4 = E. - D. */ \ - "paddsw "OC_8", %%mm4 \n\t" /* adjust R4 (and R3) for shift */ \ - "paddsw %%mm3, %%mm3 \n\t" /* r3 = D. + D. */ \ - "paddsw %%mm4, %%mm3 \n\t" /* r3 = R3 = E. + D. */ \ - "psraw $4, %%mm4 \n\t" /* r4 = NR4 */ \ - "psubsw %%mm5, %%mm6 \n\t" /* r6 = R6 = F. - B.. */ \ - "psraw $4, %%mm3 \n\t" /* r3 = NR3 */ \ - "paddsw "OC_8", %%mm6 \n\t" /* adjust R6 (and R5) for shift */ \ - "paddsw %%mm5, %%mm5 \n\t" /* r5 = B.. + B.. */ \ - "paddsw %%mm6, %%mm5 \n\t" /* r5 = R5 = F. + B.. */ \ - "psraw $4, %%mm6 \n\t" /* r6 = NR6 */ \ - "movq %%mm4, "J(4)"\n\t" /* store NR4 at J4 */ \ - "psraw $4, %%mm5 \n\t" /* r5 = NR5 */ \ - "movq %%mm3, "I(3)"\n\t" /* store NR3 at I3 */ \ - "psubsw %%mm0, %%mm7 \n\t" /* r7 = R7 = G. - C. */ \ - "paddsw "OC_8", %%mm7 \n\t" /* adjust R7 (and R0) for shift */ \ - "paddsw %%mm0, %%mm0 \n\t" /* r0 = C. + C. */ \ - "paddsw %%mm7, %%mm0 \n\t" /* r0 = R0 = G. + C. */ \ - "psraw $4, %%mm7 \n\t" /* r7 = NR7 */ \ - "movq %%mm6, "J(6)"\n\t" /* store NR6 at J6 */ \ - "psraw $4, %%mm0 \n\t" /* r0 = NR0 */ \ - "movq %%mm5, "J(5)"\n\t" /* store NR5 at J5 */ \ - "movq %%mm7, "J(7)"\n\t" /* store NR7 at J7 */ \ - "movq %%mm0, "I(0)"\n\t" /* store NR0 at I0 */ - -/* Following macro does two 4x4 transposes in place. - - At entry (we assume): - - r0 = a3 a2 a1 a0 - I(1) = b3 b2 b1 b0 - r2 = c3 c2 c1 c0 - r3 = d3 d2 d1 d0 - - r4 = e3 e2 e1 e0 - r5 = f3 f2 f1 f0 - r6 = g3 g2 g1 g0 - r7 = h3 h2 h1 h0 - - At exit, we have: - - I(0) = d0 c0 b0 a0 - I(1) = d1 c1 b1 a1 - I(2) = d2 c2 b2 a2 - I(3) = d3 c3 b3 a3 - - J(4) = h0 g0 f0 e0 - J(5) = h1 g1 f1 e1 - J(6) = h2 g2 f2 e2 - J(7) = h3 g3 f3 e3 - - I(0) I(1) I(2) I(3) is the transpose of r0 I(1) r2 r3. - J(4) J(5) J(6) J(7) is the transpose of r4 r5 r6 r7. - - Since r1 is free at entry, we calculate the Js first. */ -#define Transpose() \ - "movq %%mm4, %%mm1 \n\t" /* r1 = e3 e2 e1 e0 */ \ - "punpcklwd %%mm5, %%mm4 \n\t" /* r4 = f1 e1 f0 e0 */ \ - "movq %%mm0, "I(0)"\n\t" /* save a3 a2 a1 a0 */ \ - "punpckhwd %%mm5, %%mm1 \n\t" /* r1 = f3 e3 f2 e2 */ \ - "movq %%mm6, %%mm0 \n\t" /* r0 = g3 g2 g1 g0 */ \ - "punpcklwd %%mm7, %%mm6 \n\t" /* r6 = h1 g1 h0 g0 */ \ - "movq %%mm4, %%mm5 \n\t" /* r5 = f1 e1 f0 e0 */ \ - "punpckldq %%mm6, %%mm4 \n\t" /* r4 = h0 g0 f0 e0 = R4 */ \ - "punpckhdq %%mm6, %%mm5 \n\t" /* r5 = h1 g1 f1 e1 = R5 */ \ - "movq %%mm1, %%mm6 \n\t" /* r6 = f3 e3 f2 e2 */ \ - "movq %%mm4, "J(4)"\n\t" \ - "punpckhwd %%mm7, %%mm0 \n\t" /* r0 = h3 g3 h2 g2 */ \ - "movq %%mm5, "J(5)"\n\t" \ - "punpckhdq %%mm0, %%mm6 \n\t" /* r6 = h3 g3 f3 e3 = R7 */ \ - "movq "I(0)", %%mm4 \n\t" /* r4 = a3 a2 a1 a0 */ \ - "punpckldq %%mm0, %%mm1 \n\t" /* r1 = h2 g2 f2 e2 = R6 */ \ - "movq "I(1)", %%mm5 \n\t" /* r5 = b3 b2 b1 b0 */ \ - "movq %%mm4, %%mm0 \n\t" /* r0 = a3 a2 a1 a0 */ \ - "movq %%mm6, "J(7)"\n\t" \ - "punpcklwd %%mm5, %%mm0 \n\t" /* r0 = b1 a1 b0 a0 */ \ - "movq %%mm1, "J(6)"\n\t" \ - "punpckhwd %%mm5, %%mm4 \n\t" /* r4 = b3 a3 b2 a2 */ \ - "movq %%mm2, %%mm5 \n\t" /* r5 = c3 c2 c1 c0 */ \ - "punpcklwd %%mm3, %%mm2 \n\t" /* r2 = d1 c1 d0 c0 */ \ - "movq %%mm0, %%mm1 \n\t" /* r1 = b1 a1 b0 a0 */ \ - "punpckldq %%mm2, %%mm0 \n\t" /* r0 = d0 c0 b0 a0 = R0 */ \ - "punpckhdq %%mm2, %%mm1 \n\t" /* r1 = d1 c1 b1 a1 = R1 */ \ - "movq %%mm4, %%mm2 \n\t" /* r2 = b3 a3 b2 a2 */ \ - "movq %%mm0, "I(0)"\n\t" \ - "punpckhwd %%mm3, %%mm5 \n\t" /* r5 = d3 c3 d2 c2 */ \ - "movq %%mm1, "I(1)"\n\t" \ - "punpckhdq %%mm5, %%mm4 \n\t" /* r4 = d3 c3 b3 a3 = R3 */ \ - "punpckldq %%mm5, %%mm2 \n\t" /* r2 = d2 c2 b2 a2 = R2 */ \ - "movq %%mm4, "I(3)"\n\t" \ - "movq %%mm2, "I(2)"\n\t" - -void ff_vp3_idct_mmx(int16_t *output_data) -{ - /* eax = quantized input - * ebx = dequantizer matrix - * ecx = IDCT constants - * M(I) = ecx + MaskOffset(0) + I * 8 - * C(I) = ecx + CosineOffset(32) + (I-1) * 8 - * edx = output - * r0..r7 = mm0..mm7 - */ - -#define C(x) AV_STRINGIFY(16*(x-1))"(%1)" -#define OC_8 "%2" - - /* at this point, function has completed dequantization + dezigzag + - * partial transposition; now do the idct itself */ -#define I(x) AV_STRINGIFY(16* x )"(%0)" -#define J(x) AV_STRINGIFY(16*(x-4) + 8)"(%0)" - - __asm__ volatile ( - RowIDCT() - Transpose() - -#undef I -#undef J -#define I(x) AV_STRINGIFY(16* x + 64)"(%0)" -#define J(x) AV_STRINGIFY(16*(x-4) + 72)"(%0)" - - RowIDCT() - Transpose() - -#undef I -#undef J -#define I(x) AV_STRINGIFY(16*x)"(%0)" -#define J(x) AV_STRINGIFY(16*x)"(%0)" - - ColumnIDCT() - -#undef I -#undef J -#define I(x) AV_STRINGIFY(16*x + 8)"(%0)" -#define J(x) AV_STRINGIFY(16*x + 8)"(%0)" - - ColumnIDCT() - :: "r"(output_data), "r"(ff_vp3_idct_data), "m"(ff_pw_8) - ); -#undef I -#undef J - -} - -void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block) -{ - ff_vp3_idct_mmx(block); - put_signed_pixels_clamped_mmx(block, dest, line_size); -} - -void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block) -{ - ff_vp3_idct_mmx(block); - add_pixels_clamped_mmx(block, dest, line_size); -} - -void ff_vp3_idct_dc_add_mmx2(uint8_t *dest, int linesize, const DCTELEM *block) -{ - int dc = (block[0] + 15) >> 5; - - __asm__ volatile( - "movd %3, %%mm0 \n\t" - "pshufw $0, %%mm0, %%mm0 \n\t" - "pxor %%mm1, %%mm1 \n\t" - "psubw %%mm0, %%mm1 \n\t" - "packuswb %%mm0, %%mm0 \n\t" - "packuswb %%mm1, %%mm1 \n\t" - -#define DC_ADD \ - "movq (%0), %%mm2 \n\t" \ - "movq (%0,%1), %%mm3 \n\t" \ - "paddusb %%mm0, %%mm2 \n\t" \ - "movq (%0,%1,2), %%mm4 \n\t" \ - "paddusb %%mm0, %%mm3 \n\t" \ - "movq (%0,%2), %%mm5 \n\t" \ - "paddusb %%mm0, %%mm4 \n\t" \ - "paddusb %%mm0, %%mm5 \n\t" \ - "psubusb %%mm1, %%mm2 \n\t" \ - "psubusb %%mm1, %%mm3 \n\t" \ - "movq %%mm2, (%0) \n\t" \ - "psubusb %%mm1, %%mm4 \n\t" \ - "movq %%mm3, (%0,%1) \n\t" \ - "psubusb %%mm1, %%mm5 \n\t" \ - "movq %%mm4, (%0,%1,2) \n\t" \ - "movq %%mm5, (%0,%2) \n\t" - - DC_ADD - "lea (%0,%1,4), %0 \n\t" - DC_ADD - - : "+r"(dest) - : "r"((x86_reg)linesize), "r"((x86_reg)3*linesize), "r"(dc) - ); -} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp_mmx.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp_mmx.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp_mmx.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp_mmx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* - * vp3dsp MMX function declarations - * Copyright (c) 2007 Aurelien Jacobs - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_X86_VP3DSP_MMX_H -#define AVCODEC_X86_VP3DSP_MMX_H - -#include -#include "libavcodec/dsputil.h" - -void ff_vp3_idct_mmx(int16_t *data); -void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block); -void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block); -void ff_vp3_idct_dc_add_mmx2(uint8_t *dest, int line_size, const DCTELEM *block); - -void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values); -void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values); - -#endif /* AVCODEC_X86_VP3DSP_MMX_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp_sse2.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp_sse2.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp_sse2.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp_sse2.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2004 the ffmpeg project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * SSE2-optimized functions cribbed from the original VP3 source code. - */ - -#include "libavcodec/dsputil.h" -#include "dsputil_mmx.h" -#include "vp3dsp_sse2.h" - -DECLARE_ALIGNED(16, const uint16_t, ff_vp3_idct_data)[7 * 8] = -{ - 64277,64277,64277,64277,64277,64277,64277,64277, - 60547,60547,60547,60547,60547,60547,60547,60547, - 54491,54491,54491,54491,54491,54491,54491,54491, - 46341,46341,46341,46341,46341,46341,46341,46341, - 36410,36410,36410,36410,36410,36410,36410,36410, - 25080,25080,25080,25080,25080,25080,25080,25080, - 12785,12785,12785,12785,12785,12785,12785,12785 -}; - - -#define VP3_1D_IDCT_SSE2(ADD, SHIFT) \ - "movdqa "I(3)", %%xmm2 \n\t" /* xmm2 = i3 */ \ - "movdqa "C(3)", %%xmm6 \n\t" /* xmm6 = c3 */ \ - "movdqa %%xmm2, %%xmm4 \n\t" /* xmm4 = i3 */ \ - "movdqa "I(5)", %%xmm7 \n\t" /* xmm7 = i5 */ \ - "pmulhw %%xmm6, %%xmm4 \n\t" /* xmm4 = c3 * i3 - i3 */ \ - "movdqa "C(5)", %%xmm1 \n\t" /* xmm1 = c5 */ \ - "pmulhw %%xmm7, %%xmm6 \n\t" /* xmm6 = c3 * i5 - i5 */ \ - "movdqa %%xmm1, %%xmm5 \n\t" /* xmm5 = c5 */ \ - "pmulhw %%xmm2, %%xmm1 \n\t" /* xmm1 = c5 * i3 - i3 */ \ - "movdqa "I(1)", %%xmm3 \n\t" /* xmm3 = i1 */ \ - "pmulhw %%xmm7, %%xmm5 \n\t" /* xmm5 = c5 * i5 - i5 */ \ - "movdqa "C(1)", %%xmm0 \n\t" /* xmm0 = c1 */ \ - "paddw %%xmm2, %%xmm4 \n\t" /* xmm4 = c3 * i3 */ \ - "paddw %%xmm7, %%xmm6 \n\t" /* xmm6 = c3 * i5 */ \ - "paddw %%xmm1, %%xmm2 \n\t" /* xmm2 = c5 * i3 */ \ - "movdqa "I(7)", %%xmm1 \n\t" /* xmm1 = i7 */ \ - "paddw %%xmm5, %%xmm7 \n\t" /* xmm7 = c5 * i5 */ \ - "movdqa %%xmm0, %%xmm5 \n\t" /* xmm5 = c1 */ \ - "pmulhw %%xmm3, %%xmm0 \n\t" /* xmm0 = c1 * i1 - i1 */ \ - "paddsw %%xmm7, %%xmm4 \n\t" /* xmm4 = c3 * i3 + c5 * i5 = C */ \ - "pmulhw %%xmm1, %%xmm5 \n\t" /* xmm5 = c1 * i7 - i7 */ \ - "movdqa "C(7)", %%xmm7 \n\t" /* xmm7 = c7 */ \ - "psubsw %%xmm2, %%xmm6 \n\t" /* xmm6 = c3 * i5 - c5 * i3 = D */ \ - "paddw %%xmm3, %%xmm0 \n\t" /* xmm0 = c1 * i1 */ \ - "pmulhw %%xmm7, %%xmm3 \n\t" /* xmm3 = c7 * i1 */ \ - "movdqa "I(2)", %%xmm2 \n\t" /* xmm2 = i2 */ \ - "pmulhw %%xmm1, %%xmm7 \n\t" /* xmm7 = c7 * i7 */ \ - "paddw %%xmm1, %%xmm5 \n\t" /* xmm5 = c1 * i7 */ \ - "movdqa %%xmm2, %%xmm1 \n\t" /* xmm1 = i2 */ \ - "pmulhw "C(2)", %%xmm2 \n\t" /* xmm2 = i2 * c2 -i2 */ \ - "psubsw %%xmm5, %%xmm3 \n\t" /* xmm3 = c7 * i1 - c1 * i7 = B */ \ - "movdqa "I(6)", %%xmm5 \n\t" /* xmm5 = i6 */ \ - "paddsw %%xmm7, %%xmm0 \n\t" /* xmm0 = c1 * i1 + c7 * i7 = A */ \ - "movdqa %%xmm5, %%xmm7 \n\t" /* xmm7 = i6 */ \ - "psubsw %%xmm4, %%xmm0 \n\t" /* xmm0 = A - C */ \ - "pmulhw "C(2)", %%xmm5 \n\t" /* xmm5 = c2 * i6 - i6 */ \ - "paddw %%xmm1, %%xmm2 \n\t" /* xmm2 = i2 * c2 */ \ - "pmulhw "C(6)", %%xmm1 \n\t" /* xmm1 = c6 * i2 */ \ - "paddsw %%xmm4, %%xmm4 \n\t" /* xmm4 = C + C */ \ - "paddsw %%xmm0, %%xmm4 \n\t" /* xmm4 = A + C = C. */ \ - "psubsw %%xmm6, %%xmm3 \n\t" /* xmm3 = B - D */ \ - "paddw %%xmm7, %%xmm5 \n\t" /* xmm5 = c2 * i6 */ \ - "paddsw %%xmm6, %%xmm6 \n\t" /* xmm6 = D + D */ \ - "pmulhw "C(6)", %%xmm7 \n\t" /* xmm7 = c6 * i6 */ \ - "paddsw %%xmm3, %%xmm6 \n\t" /* xmm6 = B + D = D. */ \ - "movdqa %%xmm4, "I(1)" \n\t" /* Save C. at I(1) */ \ - "psubsw %%xmm5, %%xmm1 \n\t" /* xmm1 = c6 * i2 - c2 * i6 = H */ \ - "movdqa "C(4)", %%xmm4 \n\t" /* xmm4 = c4 */ \ - "movdqa %%xmm3, %%xmm5 \n\t" /* xmm5 = B - D */ \ - "pmulhw %%xmm4, %%xmm3 \n\t" /* xmm3 = ( c4 -1 ) * ( B - D ) */ \ - "paddsw %%xmm2, %%xmm7 \n\t" /* xmm7 = c2 * i2 + c6 * i6 = G */ \ - "movdqa %%xmm6, "I(2)" \n\t" /* Save D. at I(2) */ \ - "movdqa %%xmm0, %%xmm2 \n\t" /* xmm2 = A - C */ \ - "movdqa "I(0)", %%xmm6 \n\t" /* xmm6 = i0 */ \ - "pmulhw %%xmm4, %%xmm0 \n\t" /* xmm0 = ( c4 - 1 ) * ( A - C ) = A. */ \ - "paddw %%xmm3, %%xmm5 \n\t" /* xmm5 = c4 * ( B - D ) = B. */ \ - "movdqa "I(4)", %%xmm3 \n\t" /* xmm3 = i4 */ \ - "psubsw %%xmm1, %%xmm5 \n\t" /* xmm5 = B. - H = B.. */ \ - "paddw %%xmm0, %%xmm2 \n\t" /* xmm2 = c4 * ( A - C) = A. */ \ - "psubsw %%xmm3, %%xmm6 \n\t" /* xmm6 = i0 - i4 */ \ - "movdqa %%xmm6, %%xmm0 \n\t" /* xmm0 = i0 - i4 */ \ - "pmulhw %%xmm4, %%xmm6 \n\t" /* xmm6 = (c4 - 1) * (i0 - i4) = F */ \ - "paddsw %%xmm3, %%xmm3 \n\t" /* xmm3 = i4 + i4 */ \ - "paddsw %%xmm1, %%xmm1 \n\t" /* xmm1 = H + H */ \ - "paddsw %%xmm0, %%xmm3 \n\t" /* xmm3 = i0 + i4 */ \ - "paddsw %%xmm5, %%xmm1 \n\t" /* xmm1 = B. + H = H. */ \ - "pmulhw %%xmm3, %%xmm4 \n\t" /* xmm4 = ( c4 - 1 ) * ( i0 + i4 ) */ \ - "paddw %%xmm0, %%xmm6 \n\t" /* xmm6 = c4 * ( i0 - i4 ) */ \ - "psubsw %%xmm2, %%xmm6 \n\t" /* xmm6 = F - A. = F. */ \ - "paddsw %%xmm2, %%xmm2 \n\t" /* xmm2 = A. + A. */ \ - "movdqa "I(1)", %%xmm0 \n\t" /* Load C. from I(1) */ \ - "paddsw %%xmm6, %%xmm2 \n\t" /* xmm2 = F + A. = A.. */ \ - "paddw %%xmm3, %%xmm4 \n\t" /* xmm4 = c4 * ( i0 + i4 ) = 3 */ \ - "psubsw %%xmm1, %%xmm2 \n\t" /* xmm2 = A.. - H. = R2 */ \ - ADD(%%xmm2) /* Adjust R2 and R1 before shifting */ \ - "paddsw %%xmm1, %%xmm1 \n\t" /* xmm1 = H. + H. */ \ - "paddsw %%xmm2, %%xmm1 \n\t" /* xmm1 = A.. + H. = R1 */ \ - SHIFT(%%xmm2) /* xmm2 = op2 */ \ - "psubsw %%xmm7, %%xmm4 \n\t" /* xmm4 = E - G = E. */ \ - SHIFT(%%xmm1) /* xmm1 = op1 */ \ - "movdqa "I(2)", %%xmm3 \n\t" /* Load D. from I(2) */ \ - "paddsw %%xmm7, %%xmm7 \n\t" /* xmm7 = G + G */ \ - "paddsw %%xmm4, %%xmm7 \n\t" /* xmm7 = E + G = G. */ \ - "psubsw %%xmm3, %%xmm4 \n\t" /* xmm4 = E. - D. = R4 */ \ - ADD(%%xmm4) /* Adjust R4 and R3 before shifting */ \ - "paddsw %%xmm3, %%xmm3 \n\t" /* xmm3 = D. + D. */ \ - "paddsw %%xmm4, %%xmm3 \n\t" /* xmm3 = E. + D. = R3 */ \ - SHIFT(%%xmm4) /* xmm4 = op4 */ \ - "psubsw %%xmm5, %%xmm6 \n\t" /* xmm6 = F. - B..= R6 */ \ - SHIFT(%%xmm3) /* xmm3 = op3 */ \ - ADD(%%xmm6) /* Adjust R6 and R5 before shifting */ \ - "paddsw %%xmm5, %%xmm5 \n\t" /* xmm5 = B.. + B.. */ \ - "paddsw %%xmm6, %%xmm5 \n\t" /* xmm5 = F. + B.. = R5 */ \ - SHIFT(%%xmm6) /* xmm6 = op6 */ \ - SHIFT(%%xmm5) /* xmm5 = op5 */ \ - "psubsw %%xmm0, %%xmm7 \n\t" /* xmm7 = G. - C. = R7 */ \ - ADD(%%xmm7) /* Adjust R7 and R0 before shifting */ \ - "paddsw %%xmm0, %%xmm0 \n\t" /* xmm0 = C. + C. */ \ - "paddsw %%xmm7, %%xmm0 \n\t" /* xmm0 = G. + C. */ \ - SHIFT(%%xmm7) /* xmm7 = op7 */ \ - SHIFT(%%xmm0) /* xmm0 = op0 */ - -#define PUT_BLOCK(r0, r1, r2, r3, r4, r5, r6, r7) \ - "movdqa " #r0 ", " O(0) "\n\t" \ - "movdqa " #r1 ", " O(1) "\n\t" \ - "movdqa " #r2 ", " O(2) "\n\t" \ - "movdqa " #r3 ", " O(3) "\n\t" \ - "movdqa " #r4 ", " O(4) "\n\t" \ - "movdqa " #r5 ", " O(5) "\n\t" \ - "movdqa " #r6 ", " O(6) "\n\t" \ - "movdqa " #r7 ", " O(7) "\n\t" - -#define NOP(xmm) -#define SHIFT4(xmm) "psraw $4, "#xmm"\n\t" -#define ADD8(xmm) "paddsw %2, "#xmm"\n\t" - -void ff_vp3_idct_sse2(int16_t *input_data) -{ -#define I(x) AV_STRINGIFY(16*x)"(%0)" -#define O(x) I(x) -#define C(x) AV_STRINGIFY(16*(x-1))"(%1)" - - __asm__ volatile ( - VP3_1D_IDCT_SSE2(NOP, NOP) - - TRANSPOSE8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7, (%0)) - PUT_BLOCK(%%xmm0, %%xmm5, %%xmm7, %%xmm3, %%xmm6, %%xmm4, %%xmm2, %%xmm1) - - VP3_1D_IDCT_SSE2(ADD8, SHIFT4) - PUT_BLOCK(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7) - :: "r"(input_data), "r"(ff_vp3_idct_data), "m"(ff_pw_8) - ); -} - -void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block) -{ - ff_vp3_idct_sse2(block); - put_signed_pixels_clamped_mmx(block, dest, line_size); -} - -void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block) -{ - ff_vp3_idct_sse2(block); - add_pixels_clamped_mmx(block, dest, line_size); -} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp_sse2.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp_sse2.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp3dsp_sse2.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp3dsp_sse2.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* - * vp3dsp SSE2 function declarations - * Copyright (c) 2007 Aurelien Jacobs - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_X86_VP3DSP_SSE2_H -#define AVCODEC_X86_VP3DSP_SSE2_H - -#include "libavcodec/dsputil.h" - -void ff_vp3_idct_sse2(int16_t *input_data); -void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block); -void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block); - -#endif /* AVCODEC_X86_VP3DSP_SSE2_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp56_arith.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp56_arith.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp56_arith.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp56_arith.h 2010-11-06 17:21:28.000000000 +0000 @@ -31,7 +31,7 @@ unsigned int code_word = vp56_rac_renorm(c); unsigned int high = c->high; unsigned int low = 1 + (((high - 1) * prob) >> 8); - unsigned int low_shift = low << 8; + unsigned int low_shift = low << 16; int bit = 0; __asm__( diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp56dsp.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp56dsp.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp56dsp.asm 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp56dsp.asm 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,173 @@ +;****************************************************************************** +;* MMX/SSE2-optimized functions for the VP6 decoder +;* Copyright (C) 2009 Sebastien Lucas +;* Copyright (C) 2009 Zuxy Meng +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg is distributed in the hope that it will be useful, +;* but WITHOUT ANY WARRANTY; without even the implied warranty of +;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" +%include "x86util.asm" + +cextern pw_64 + +SECTION .text + +%macro DIAG4_MMX 6 + movq m0, [%1+%2] + movq m1, [%1+%3] + movq m3, m0 + movq m4, m1 + punpcklbw m0, m7 + punpcklbw m1, m7 + punpckhbw m3, m7 + punpckhbw m4, m7 + pmullw m0, [rsp+8*11] ; src[x-8 ] * biweight [0] + pmullw m1, [rsp+8*12] ; src[x ] * biweight [1] + pmullw m3, [rsp+8*11] ; src[x-8 ] * biweight [0] + pmullw m4, [rsp+8*12] ; src[x ] * biweight [1] + paddw m0, m1 + paddw m3, m4 + movq m1, [%1+%4] + movq m2, [%1+%5] + movq m4, m1 + movq m5, m2 + punpcklbw m1, m7 + punpcklbw m2, m7 + punpckhbw m4, m7 + punpckhbw m5, m7 + pmullw m1, [rsp+8*13] ; src[x+8 ] * biweight [2] + pmullw m2, [rsp+8*14] ; src[x+16] * biweight [3] + pmullw m4, [rsp+8*13] ; src[x+8 ] * biweight [2] + pmullw m5, [rsp+8*14] ; src[x+16] * biweight [3] + paddw m1, m2 + paddw m4, m5 + paddsw m0, m1 + paddsw m3, m4 + paddsw m0, m6 ; Add 64 + paddsw m3, m6 ; Add 64 + psraw m0, 7 + psraw m3, 7 + packuswb m0, m3 + movq [%6], m0 +%endmacro + +%macro DIAG4_SSE2 6 + movq m0, [%1+%2] + movq m1, [%1+%3] + punpcklbw m0, m7 + punpcklbw m1, m7 + pmullw m0, m4 ; src[x-8 ] * biweight [0] + pmullw m1, m5 ; src[x ] * biweight [1] + paddw m0, m1 + movq m1, [%1+%4] + movq m2, [%1+%5] + punpcklbw m1, m7 + punpcklbw m2, m7 + pmullw m1, m6 ; src[x+8 ] * biweight [2] + pmullw m2, m3 ; src[x+16] * biweight [3] + paddw m1, m2 + paddsw m0, m1 + paddsw m0, [pw_64] ; Add 64 + psraw m0, 7 + packuswb m0, m0 + movq [%6], m0 +%endmacro + +%macro SPLAT4REGS_MMX 0 + movq m5, m3 + punpcklwd m3, m3 + movq m4, m3 + punpckldq m3, m3 + punpckhdq m4, m4 + punpckhwd m5, m5 + movq m2, m5 + punpckhdq m2, m2 + punpckldq m5, m5 + movq [rsp+8*11], m3 + movq [rsp+8*12], m4 + movq [rsp+8*13], m5 + movq [rsp+8*14], m2 +%endmacro + +%macro SPLAT4REGS_SSE2 0 + pshuflw m4, m3, 0x0 + pshuflw m5, m3, 0x55 + pshuflw m6, m3, 0xAA + pshuflw m3, m3, 0xFF + punpcklqdq m4, m4 + punpcklqdq m5, m5 + punpcklqdq m6, m6 + punpcklqdq m3, m3 +%endmacro + +%macro vp6_filter_diag4 2 +; void ff_vp6_filter_diag4_(uint8_t *dst, uint8_t *src, int stride, +; const int16_t h_weight[4], const int16_t v_weights[4]) +cglobal vp6_filter_diag4_%1, 5, 7, %2 + mov r5, rsp ; backup stack pointer + and rsp, ~(mmsize-1) ; align stack +%ifidn %1, sse2 + sub rsp, 8*11 +%else + sub rsp, 8*15 + movq m6, [pw_64] +%endif +%ifdef ARCH_X86_64 + movsxd r2, r2d +%endif + + sub r1, r2 + + pxor m7, m7 + movq m3, [r3] + SPLAT4REGS + + mov r3, rsp + mov r6, 11 +.nextrow + DIAG4 r1, -1, 0, 1, 2, r3 + add r3, 8 + add r1, r2 + dec r6 + jnz .nextrow + + movq m3, [r4] + SPLAT4REGS + + lea r3, [rsp+8] + mov r6, 8 +.nextcol + DIAG4 r3, -8, 0, 8, 16, r0 + add r3, 8 + add r0, r2 + dec r6 + jnz .nextcol + + mov rsp, r5 ; restore stack pointer + RET +%endmacro + +INIT_MMX +%define DIAG4 DIAG4_MMX +%define SPLAT4REGS SPLAT4REGS_MMX +vp6_filter_diag4 mmx, 0 + +INIT_XMM +%define DIAG4 DIAG4_SSE2 +%define SPLAT4REGS SPLAT4REGS_SSE2 +vp6_filter_diag4 sse2, 8 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp56dsp_init.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp56dsp_init.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp56dsp_init.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp56dsp_init.c 2010-11-06 17:21:28.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * VP6 MMX/SSE2 optimizations + * Copyright (C) 2009 Sebastien Lucas + * Copyright (C) 2009 Zuxy Meng + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/cpu.h" +#include "libavutil/x86_cpu.h" +#include "libavcodec/dsputil.h" +#include "libavcodec/vp56dsp.h" + +void ff_vp6_filter_diag4_mmx(uint8_t *dst, uint8_t *src, int stride, + const int16_t *h_weights,const int16_t *v_weights); +void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride, + const int16_t *h_weights,const int16_t *v_weights); + +av_cold void ff_vp56dsp_init_x86(VP56DSPContext* c, enum CodecID codec) +{ +#if HAVE_YASM + int mm_flags = av_get_cpu_flags(); + + if (CONFIG_VP6_DECODER && codec == CODEC_ID_VP6) { + if (mm_flags & AV_CPU_FLAG_MMX) { + c->vp6_filter_diag4 = ff_vp6_filter_diag4_mmx; + } + + if (mm_flags & AV_CPU_FLAG_SSE2) { + c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2; + } + } +#endif +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp6dsp_mmx.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp6dsp_mmx.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp6dsp_mmx.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp6dsp_mmx.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -/** - * @file - * MMX-optimized functions for the VP6 decoder - * - * Copyright (C) 2009 Sebastien Lucas - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/x86_cpu.h" -#include "libavcodec/dsputil.h" -#include "dsputil_mmx.h" -#include "vp6dsp_mmx.h" - - -#define DIAG4_MMX(in1,in2,in3,in4) \ - "movq "#in1"(%0), %%mm0 \n\t" \ - "movq "#in2"(%0), %%mm1 \n\t" \ - "movq %%mm0, %%mm3 \n\t" \ - "movq %%mm1, %%mm4 \n\t" \ - "punpcklbw %%mm7, %%mm0 \n\t" \ - "punpcklbw %%mm7, %%mm1 \n\t" \ - "punpckhbw %%mm7, %%mm3 \n\t" \ - "punpckhbw %%mm7, %%mm4 \n\t" \ - "pmullw 0(%2), %%mm0 \n\t" /* src[x-8 ] * biweight [0] */ \ - "pmullw 8(%2), %%mm1 \n\t" /* src[x ] * biweight [1] */ \ - "pmullw 0(%2), %%mm3 \n\t" /* src[x-8 ] * biweight [0] */ \ - "pmullw 8(%2), %%mm4 \n\t" /* src[x ] * biweight [1] */ \ - "paddw %%mm1, %%mm0 \n\t" \ - "paddw %%mm4, %%mm3 \n\t" \ - "movq "#in3"(%0), %%mm1 \n\t" \ - "movq "#in4"(%0), %%mm2 \n\t" \ - "movq %%mm1, %%mm4 \n\t" \ - "movq %%mm2, %%mm5 \n\t" \ - "punpcklbw %%mm7, %%mm1 \n\t" \ - "punpcklbw %%mm7, %%mm2 \n\t" \ - "punpckhbw %%mm7, %%mm4 \n\t" \ - "punpckhbw %%mm7, %%mm5 \n\t" \ - "pmullw 16(%2), %%mm1 \n\t" /* src[x+8 ] * biweight [2] */ \ - "pmullw 24(%2), %%mm2 \n\t" /* src[x+16] * biweight [3] */ \ - "pmullw 16(%2), %%mm4 \n\t" /* src[x+8 ] * biweight [2] */ \ - "pmullw 24(%2), %%mm5 \n\t" /* src[x+16] * biweight [3] */ \ - "paddw %%mm2, %%mm1 \n\t" \ - "paddw %%mm5, %%mm4 \n\t" \ - "paddsw %%mm1, %%mm0 \n\t" \ - "paddsw %%mm4, %%mm3 \n\t" \ - "paddsw %%mm6, %%mm0 \n\t" /* Add 64 */ \ - "paddsw %%mm6, %%mm3 \n\t" /* Add 64 */ \ - "psraw $7, %%mm0 \n\t" \ - "psraw $7, %%mm3 \n\t" \ - "packuswb %%mm3, %%mm0 \n\t" \ - "movq %%mm0, (%1) \n\t" - -void ff_vp6_filter_diag4_mmx(uint8_t *dst, uint8_t *src, int stride, - const int16_t *h_weights, const int16_t *v_weights) -{ - uint8_t tmp[8*11], *t = tmp; - int16_t weights[4*4]; - int i; - src -= stride; - - for (i=0; i<4*4; i++) - weights[i] = h_weights[i>>2]; - - __asm__ volatile( - "pxor %%mm7, %%mm7 \n\t" - "movq "MANGLE(ff_pw_64)", %%mm6 \n\t" - "1: \n\t" - DIAG4_MMX(-1,0,1,2) - "add $8, %1 \n\t" - "add %3, %0 \n\t" - "decl %4 \n\t" - "jnz 1b \n\t" - : "+r"(src), "+r"(t) - : "r"(weights), "r"((x86_reg)stride), "r"(11) - : "memory"); - - t = tmp + 8; - for (i=0; i<4*4; i++) - weights[i] = v_weights[i>>2]; - - __asm__ volatile( - "pxor %%mm7, %%mm7 \n\t" - "movq "MANGLE(ff_pw_64)", %%mm6 \n\t" - "1: \n\t" - DIAG4_MMX(-8,0,8,16) - "add $8, %0 \n\t" - "add %3, %1 \n\t" - "decl %4 \n\t" - "jnz 1b \n\t" - : "+r"(t), "+r"(dst) - : "r"(weights), "r"((x86_reg)stride), "r"(8) - : "memory"); -} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp6dsp_mmx.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp6dsp_mmx.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp6dsp_mmx.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp6dsp_mmx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* - * vp6dsp MMX function declarations - * Copyright (c) 2009 Sebastien Lucas - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_X86_VP6DSP_MMX_H -#define AVCODEC_X86_VP6DSP_MMX_H - -#include - -void ff_vp6_filter_diag4_mmx(uint8_t *dst, uint8_t *src, int stride, - const int16_t *h_weights,const int16_t *v_weights); - -#endif /* AVCODEC_X86_VP6DSP_MMX_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp6dsp_sse2.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp6dsp_sse2.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp6dsp_sse2.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp6dsp_sse2.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/** - * @file - * SSE2-optimized functions for the VP6 decoder - * - * Copyright (C) 2009 Zuxy Meng - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/x86_cpu.h" -#include "libavcodec/dsputil.h" -#include "dsputil_mmx.h" -#include "vp6dsp_sse2.h" - -#define DIAG4_SSE2(in1,in2,in3,in4) \ - "movq "#in1"(%0), %%xmm0 \n\t" \ - "movq "#in2"(%0), %%xmm1 \n\t" \ - "punpcklbw %%xmm7, %%xmm0 \n\t" \ - "punpcklbw %%xmm7, %%xmm1 \n\t" \ - "pmullw %%xmm4, %%xmm0 \n\t" /* src[x-8 ] * biweight [0] */ \ - "pmullw %%xmm5, %%xmm1 \n\t" /* src[x ] * biweight [1] */ \ - "paddw %%xmm1, %%xmm0 \n\t" \ - "movq "#in3"(%0), %%xmm1 \n\t" \ - "movq "#in4"(%0), %%xmm2 \n\t" \ - "punpcklbw %%xmm7, %%xmm1 \n\t" \ - "punpcklbw %%xmm7, %%xmm2 \n\t" \ - "pmullw %%xmm6, %%xmm1 \n\t" /* src[x+8 ] * biweight [2] */ \ - "pmullw %%xmm3, %%xmm2 \n\t" /* src[x+16] * biweight [3] */ \ - "paddw %%xmm2, %%xmm1 \n\t" \ - "paddsw %%xmm1, %%xmm0 \n\t" \ - "paddsw "MANGLE(ff_pw_64)", %%xmm0 \n\t" /* Add 64 */ \ - "psraw $7, %%xmm0 \n\t" \ - "packuswb %%xmm0, %%xmm0 \n\t" \ - "movq %%xmm0, (%1) \n\t" \ - -void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride, - const int16_t *h_weights,const int16_t *v_weights) -{ - uint8_t tmp[8*11], *t = tmp; - src -= stride; - - __asm__ volatile( - "pxor %%xmm7, %%xmm7 \n\t" - "movq %4, %%xmm3 \n\t" - "pshuflw $0, %%xmm3, %%xmm4 \n\t" - "punpcklqdq %%xmm4, %%xmm4 \n\t" - "pshuflw $85, %%xmm3, %%xmm5 \n\t" - "punpcklqdq %%xmm5, %%xmm5 \n\t" - "pshuflw $170, %%xmm3, %%xmm6 \n\t" - "punpcklqdq %%xmm6, %%xmm6 \n\t" - "pshuflw $255, %%xmm3, %%xmm3 \n\t" - "punpcklqdq %%xmm3, %%xmm3 \n\t" - "1: \n\t" - DIAG4_SSE2(-1,0,1,2) - "add $8, %1 \n\t" - "add %2, %0 \n\t" - "decl %3 \n\t" - "jnz 1b \n\t" - : "+r"(src), "+r"(t) - : "g"((x86_reg)stride), "r"(11), "m"(*(const int64_t*)h_weights) - : "memory"); - - t = tmp + 8; - - __asm__ volatile( - "movq %4, %%xmm3 \n\t" - "pshuflw $0, %%xmm3, %%xmm4 \n\t" - "punpcklqdq %%xmm4, %%xmm4 \n\t" - "pshuflw $85, %%xmm3, %%xmm5 \n\t" - "punpcklqdq %%xmm5, %%xmm5 \n\t" - "pshuflw $170, %%xmm3, %%xmm6 \n\t" - "punpcklqdq %%xmm6, %%xmm6 \n\t" - "pshuflw $255, %%xmm3, %%xmm3 \n\t" - "punpcklqdq %%xmm3, %%xmm3 \n\t" - "1: \n\t" - DIAG4_SSE2(-8,0,8,16) - "add $8, %0 \n\t" - "add %2, %1 \n\t" - "decl %3 \n\t" - "jnz 1b \n\t" - : "+r"(t), "+r"(dst) - : "g"((x86_reg)stride), "r"(8), "m"(*(const int64_t*)v_weights) - : "memory"); -} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp6dsp_sse2.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp6dsp_sse2.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp6dsp_sse2.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp6dsp_sse2.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* - * vp6dsp SSE2 function declarations - * Copyright (c) 2009 Zuxy Meng - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_X86_VP6DSP_SSE2_H -#define AVCODEC_X86_VP6DSP_SSE2_H - -#include - -void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride, - const int16_t *h_weights,const int16_t *v_weights); - -#endif /* AVCODEC_X86_VP6DSP_SSE2_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp8dsp.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp8dsp.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp8dsp.asm 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp8dsp.asm 2010-11-06 17:21:28.000000000 +0000 @@ -211,7 +211,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET @@ -242,7 +242,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET @@ -281,7 +281,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET @@ -328,7 +328,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET %endmacro @@ -381,7 +381,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET @@ -438,7 +438,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET @@ -486,7 +486,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET @@ -548,7 +548,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET @@ -601,7 +601,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET @@ -666,7 +666,7 @@ ; go to next line add r0, r1 add r2, r3 - dec r4 ; next row + dec r4d ; next row jg .nextrow REP_RET %endmacro @@ -718,7 +718,7 @@ lea r0, [r0+r1*2] lea r2, [r2+r3*2] - sub r4, 2 + sub r4d, 2 jg .nextrow REP_RET @@ -764,7 +764,7 @@ lea r0, [r0+r1*2] lea r2, [r2+r3*2] - sub r4, 2 + sub r4d, 2 jg .nextrow REP_RET %endmacro @@ -807,7 +807,7 @@ lea r0, [r0+r1*2] lea r2, [r2+r3*2] - sub r4, 2 + sub r4d, 2 jg .nextrow REP_RET @@ -843,7 +843,7 @@ lea r0, [r0+r1*2] lea r2, [r2+r3*2] - sub r4, 2 + sub r4d, 2 jg .nextrow REP_RET %endmacro @@ -1342,7 +1342,7 @@ psrldq m%2, 4 %if %10 == 8 movd [%5+%8*2], m%1 - movd %5, m%3 + movd %5d, m%3 %endif psrldq m%3, 4 psrldq m%4, 4 @@ -1379,26 +1379,26 @@ ; 4 is a pointer to the destination's 4th line ; 5/6 is -stride and +stride %macro WRITE_2x4W 6 - movd %3, %1 + movd %3d, %1 punpckhdq %1, %1 mov [%4+%5*4], %3w shr %3, 16 add %4, %6 mov [%4+%5*4], %3w - movd %3, %1 + movd %3d, %1 add %4, %5 mov [%4+%5*2], %3w shr %3, 16 mov [%4+%5 ], %3w - movd %3, %2 + movd %3d, %2 punpckhdq %2, %2 mov [%4 ], %3w shr %3, 16 mov [%4+%6 ], %3w - movd %3, %2 + movd %3d, %2 add %4, %6 mov [%4+%6 ], %3w shr %3, 16 @@ -1407,27 +1407,27 @@ %endmacro %macro WRITE_8W_SSE2 5 - movd %2, %1 + movd %2d, %1 psrldq %1, 4 mov [%3+%4*4], %2w shr %2, 16 add %3, %5 mov [%3+%4*4], %2w - movd %2, %1 + movd %2d, %1 psrldq %1, 4 add %3, %4 mov [%3+%4*2], %2w shr %2, 16 mov [%3+%4 ], %2w - movd %2, %1 + movd %2d, %1 psrldq %1, 4 mov [%3 ], %2w shr %2, 16 mov [%3+%5 ], %2w - movd %2, %1 + movd %2d, %1 add %3, %5 mov [%3+%5 ], %2w shr %2, 16 @@ -1446,32 +1446,32 @@ %endmacro %macro SPLATB_REG_MMX 2-3 - movd %1, %2 + movd %1, %2d punpcklbw %1, %1 punpcklwd %1, %1 punpckldq %1, %1 %endmacro %macro SPLATB_REG_MMXEXT 2-3 - movd %1, %2 + movd %1, %2d punpcklbw %1, %1 pshufw %1, %1, 0x0 %endmacro %macro SPLATB_REG_SSE2 2-3 - movd %1, %2 + movd %1, %2d punpcklbw %1, %1 pshuflw %1, %1, 0x0 punpcklqdq %1, %1 %endmacro %macro SPLATB_REG_SSSE3 3 - movd %1, %2 + movd %1, %2d pshufb %1, %3 %endmacro -%macro SIMPLE_LOOPFILTER 3 -cglobal vp8_%2_loop_filter_simple_%1, 3, %3 +%macro SIMPLE_LOOPFILTER 4 +cglobal vp8_%2_loop_filter_simple_%1, 3, %3, %4 %if mmsize == 8 ; mmx/mmxext mov r3, 2 %endif @@ -1612,21 +1612,21 @@ INIT_MMX %define SPLATB_REG SPLATB_REG_MMX -SIMPLE_LOOPFILTER mmx, v, 4 -SIMPLE_LOOPFILTER mmx, h, 5 +SIMPLE_LOOPFILTER mmx, v, 4, 0 +SIMPLE_LOOPFILTER mmx, h, 5, 0 %define SPLATB_REG SPLATB_REG_MMXEXT -SIMPLE_LOOPFILTER mmxext, v, 4 -SIMPLE_LOOPFILTER mmxext, h, 5 +SIMPLE_LOOPFILTER mmxext, v, 4, 0 +SIMPLE_LOOPFILTER mmxext, h, 5, 0 INIT_XMM %define SPLATB_REG SPLATB_REG_SSE2 %define WRITE_8W WRITE_8W_SSE2 -SIMPLE_LOOPFILTER sse2, v, 3 -SIMPLE_LOOPFILTER sse2, h, 5 +SIMPLE_LOOPFILTER sse2, v, 3, 8 +SIMPLE_LOOPFILTER sse2, h, 5, 8 %define SPLATB_REG SPLATB_REG_SSSE3 -SIMPLE_LOOPFILTER ssse3, v, 3 -SIMPLE_LOOPFILTER ssse3, h, 5 +SIMPLE_LOOPFILTER ssse3, v, 3, 8 +SIMPLE_LOOPFILTER ssse3, h, 5, 8 %define WRITE_8W WRITE_8W_SSE4 -SIMPLE_LOOPFILTER sse4, h, 5 +SIMPLE_LOOPFILTER sse4, h, 5, 8 ;----------------------------------------------------------------------------- ; void vp8_h/v_loop_filter_inner_(uint8_t *dst, [uint8_t *v,] int stride, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp8dsp-init.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp8dsp-init.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/vp8dsp-init.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/vp8dsp-init.c 2010-11-06 17:21:28.000000000 +0000 @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/cpu.h" #include "libavutil/x86_cpu.h" #include "libavcodec/vp8dsp.h" @@ -282,10 +283,10 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c) { - mm_flags = mm_support(); + int mm_flags = av_get_cpu_flags(); #if HAVE_YASM - if (mm_flags & FF_MM_MMX) { + if (mm_flags & AV_CPU_FLAG_MMX) { c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx; c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx; c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx; @@ -312,7 +313,7 @@ /* note that 4-tap width=16 functions are missing because w=16 * is only used for luma, and luma is always a copy or sixtap. */ - if (mm_flags & FF_MM_MMX2) { + if (mm_flags & AV_CPU_FLAG_MMX2) { VP8_LUMA_MC_FUNC(0, 16, mmxext); VP8_MC_FUNC(1, 8, mmxext); VP8_MC_FUNC(2, 4, mmxext); @@ -334,14 +335,14 @@ c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmxext; } - if (mm_flags & FF_MM_SSE) { + if (mm_flags & AV_CPU_FLAG_SSE) { c->vp8_idct_add = ff_vp8_idct_add_sse; c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_sse; c->put_vp8_epel_pixels_tab[0][0][0] = c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse; } - if (mm_flags & (FF_MM_SSE2|FF_MM_SSE2SLOW)) { + if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) { VP8_LUMA_MC_FUNC(0, 16, sse2); VP8_MC_FUNC(1, 8, sse2); VP8_BILINEAR_MC_FUNC(0, 16, sse2); @@ -356,7 +357,7 @@ c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_sse2; } - if (mm_flags & FF_MM_SSE2) { + if (mm_flags & AV_CPU_FLAG_SSE2) { c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_sse2; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2; @@ -368,7 +369,7 @@ c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse2; } - if (mm_flags & FF_MM_SSSE3) { + if (mm_flags & AV_CPU_FLAG_SSSE3) { VP8_LUMA_MC_FUNC(0, 16, ssse3); VP8_MC_FUNC(1, 8, ssse3); VP8_MC_FUNC(2, 4, ssse3); @@ -390,7 +391,7 @@ c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_ssse3; } - if (mm_flags & FF_MM_SSE4) { + if (mm_flags & AV_CPU_FLAG_SSE4) { c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse4; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse4; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/x86util.asm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/x86util.asm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/x86/x86util.asm 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/x86/x86util.asm 2010-11-06 17:21:28.000000000 +0000 @@ -148,12 +148,30 @@ %endmacro %macro ABS1_MMX 2 ; a, tmp + pxor %2, %2 + pcmpgtw %2, %1 + pxor %1, %2 + psubw %1, %2 +%endmacro + +%macro ABS2_MMX 4 ; a, b, tmp0, tmp1 + pxor %3, %3 + pxor %4, %4 + pcmpgtw %3, %1 + pcmpgtw %4, %2 + pxor %1, %3 + pxor %2, %4 + psubw %1, %3 + psubw %2, %4 +%endmacro + +%macro ABS1_MMX2 2 ; a, tmp pxor %2, %2 psubw %2, %1 pmaxsw %1, %2 %endmacro -%macro ABS2_MMX 4 ; a, b, tmp0, tmp1 +%macro ABS2_MMX2 4 ; a, b, tmp0, tmp1 pxor %3, %3 pxor %4, %4 psubw %3, %1 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/xan.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/xan.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/xan.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/xan.c 2010-11-06 17:21:28.000000000 +0000 @@ -68,8 +68,8 @@ if ((avctx->codec->id == CODEC_ID_XAN_WC3) && (s->avctx->palctrl == NULL)) { - av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n"); - return -1; + av_log(avctx, AV_LOG_ERROR, "palette expected\n"); + return AVERROR(EINVAL); } avctx->pix_fmt = PIX_FMT_PAL8; @@ -77,12 +77,12 @@ s->buffer1_size = avctx->width * avctx->height; s->buffer1 = av_malloc(s->buffer1_size); if (!s->buffer1) - return -1; + return AVERROR(ENOMEM); s->buffer2_size = avctx->width * avctx->height; s->buffer2 = av_malloc(s->buffer2_size + 130); if (!s->buffer2) { av_freep(&s->buffer1); - return -1; + return AVERROR(ENOMEM); } return 0; @@ -359,13 +359,13 @@ AVPacket *avpkt) { const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; + int ret, buf_size = avpkt->size; XanContext *s = avctx->priv_data; AVPaletteControl *palette_control = avctx->palctrl; - if (avctx->get_buffer(avctx, &s->current_frame)) { - av_log(s->avctx, AV_LOG_ERROR, " Xan Video: get_buffer() failed\n"); - return -1; + if ((ret = avctx->get_buffer(avctx, &s->current_frame))) { + av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return ret; } s->current_frame.reference = 3; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/xsubdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/xsubdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/xsubdec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/xsubdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -77,7 +77,7 @@ // read header w = bytestream_get_le16(&buf); h = bytestream_get_le16(&buf); - if (av_check_image_size(w, h, 0, avctx) < 0) + if (av_image_check_size(w, h, 0, avctx) < 0) return -1; x = bytestream_get_le16(&buf); y = bytestream_get_le16(&buf); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/yop.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/yop.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcodec/yop.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcodec/yop.c 2010-11-06 17:21:29.000000000 +0000 @@ -85,7 +85,7 @@ s->avctx = avctx; if (avctx->width & 1 || avctx->height & 1 || - av_check_image_size(avctx->width, avctx->height, 0, avctx) < 0) { + av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) { av_log(avctx, AV_LOG_ERROR, "YOP has invalid dimensions\n"); return -1; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/avcore.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/avcore.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/avcore.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/avcore.h 2010-11-06 17:21:29.000000000 +0000 @@ -24,10 +24,10 @@ * shared media utilities for the libav* libraries */ -#include +#include "libavutil/avutil.h" #define LIBAVCORE_VERSION_MAJOR 0 -#define LIBAVCORE_VERSION_MINOR 3 +#define LIBAVCORE_VERSION_MINOR 12 #define LIBAVCORE_VERSION_MICRO 0 #define LIBAVCORE_VERSION_INT AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \ @@ -55,4 +55,12 @@ */ const char *avcore_license(void); +/** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_OLD_IMAGE_NAMES +#define FF_API_OLD_IMAGE_NAMES (LIBAVCORE_VERSION_MAJOR < 1) +#endif + #endif /* AVCORE_AVCORE_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/imgutils.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/imgutils.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/imgutils.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/imgutils.c 2010-11-06 17:21:29.000000000 +0000 @@ -24,7 +24,40 @@ #include "imgutils.h" #include "libavutil/pixdesc.h" -int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width) +void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc) +{ + int i; + memset(max_pixsteps, 0, 4*sizeof(max_pixsteps[0])); + if (max_pixstep_comps) + memset(max_pixstep_comps, 0, 4*sizeof(max_pixstep_comps[0])); + + for (i = 0; i < 4; i++) { + const AVComponentDescriptor *comp = &(pixdesc->comp[i]); + if ((comp->step_minus1+1) > max_pixsteps[comp->plane]) { + max_pixsteps[comp->plane] = comp->step_minus1+1; + if (max_pixstep_comps) + max_pixstep_comps[comp->plane] = i; + } + } +} + +int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane) +{ + const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; + int max_step [4]; /* max pixel step for each plane */ + int max_step_comp[4]; /* the component for each plane which has the max pixel step */ + int s; + + if (desc->flags & PIX_FMT_BITSTREAM) + return (width * (desc->comp[0].step_minus1+1) + 7) >> 3; + + av_image_fill_max_pixsteps(max_step, max_step_comp, desc); + s = (max_step_comp[plane] == 1 || max_step_comp[plane] == 2) ? desc->log2_chroma_w : 0; + return max_step[plane] * (((width + (1 << s) - 1)) >> s); +} + +int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width) { int i; const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; @@ -33,7 +66,7 @@ memset(linesizes, 0, 4*sizeof(linesizes[0])); - if (desc->flags & PIX_FMT_HWACCEL) + if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL) return AVERROR(EINVAL); if (desc->flags & PIX_FMT_BITSTREAM) { @@ -41,16 +74,7 @@ return 0; } - memset(max_step , 0, sizeof(max_step )); - memset(max_step_comp, 0, sizeof(max_step_comp)); - for (i = 0; i < 4; i++) { - const AVComponentDescriptor *comp = &(desc->comp[i]); - if ((comp->step_minus1+1) > max_step[comp->plane]) { - max_step [comp->plane] = comp->step_minus1+1; - max_step_comp[comp->plane] = i; - } - } - + av_image_fill_max_pixsteps(max_step, max_step_comp, desc); for (i = 0; i < 4; i++) { int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0; linesizes[i] = max_step[i] * (((width + (1 << s) - 1)) >> s); @@ -59,7 +83,7 @@ return 0; } -int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, +int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, uint8_t *ptr, const int linesizes[4]) { int i, total_size, size[4], has_plane[4]; @@ -69,7 +93,7 @@ memset(size , 0, sizeof(size)); memset(has_plane, 0, sizeof(has_plane)); - if (desc->flags & PIX_FMT_HWACCEL) + if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL) return AVERROR(EINVAL); data[0] = ptr; @@ -104,13 +128,89 @@ static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, log_ctx) }; -int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) +int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) { ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx }; - if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) + if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) return 0; av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h); return AVERROR(EINVAL); } + +void av_image_copy_plane(uint8_t *dst, int dst_linesize, + const uint8_t *src, int src_linesize, + int bytewidth, int height) +{ + if (!dst || !src) + return; + for (;height > 0; height--) { + memcpy(dst, src, bytewidth); + dst += dst_linesize; + src += src_linesize; + } +} + +void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], + const uint8_t *src_data[4], const int src_linesizes[4], + enum PixelFormat pix_fmt, int width, int height) +{ + const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; + + if (desc->flags & PIX_FMT_HWACCEL) + return; + + if (desc->flags & PIX_FMT_PAL) { + av_image_copy_plane(dst_data[0], dst_linesizes[0], + src_data[0], src_linesizes[0], + width, height); + /* copy the palette */ + memcpy(dst_data[1], src_data[1], 4*256); + } else { + int i, planes_nb = 0; + + for (i = 0; i < desc->nb_components; i++) + planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1); + + for (i = 0; i < planes_nb; i++) { + int h = height; + int bwidth = av_image_get_linesize(pix_fmt, width, i); + if (i == 1 || i == 2) { + h= -((-height)>>desc->log2_chroma_h); + } + av_image_copy_plane(dst_data[i], dst_linesizes[i], + src_data[i], src_linesizes[i], + bwidth, h); + } + } +} + +#if FF_API_OLD_IMAGE_NAMES +void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc) +{ + av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc); +} + +int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane) +{ + return av_image_get_linesize(pix_fmt, width, plane); +} + +int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width) +{ + return av_image_fill_linesizes(linesizes, pix_fmt, width); +} + +int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, + uint8_t *ptr, const int linesizes[4]) +{ + return av_image_fill_pointers(data, pix_fmt, height, ptr, linesizes); +} + +int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) +{ + return av_image_check_size(w, h, log_offset, log_ctx); +} +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/imgutils.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/imgutils.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/imgutils.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/imgutils.h 2010-11-06 17:21:29.000000000 +0000 @@ -24,17 +24,44 @@ * misc image utilities */ -#include "libavutil/pixfmt.h" +#include "libavutil/pixdesc.h" #include "avcore.h" /** + * Compute the max pixel step for each plane of an image with a + * format described by pixdesc. + * + * The pixel step is the distance in bytes between the first byte of + * the group of bytes which describe a pixel component and the first + * byte of the successive group in the same plane for the same + * component. + * + * @param max_pixsteps an array which is filled with the max pixel step + * for each plane. Since a plane may contain different pixel + * components, the computed max_pixsteps[plane] is relative to the + * component in the plane with the max pixel step. + * @param max_pixstep_comps an array which is filled with the component + * for each plane which has the max pixel step. May be NULL. + */ +void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc); + +/** + * Compute the size of an image line with format pix_fmt and width + * width for the plane plane. + * + * @return the computed size in bytes + */ +int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane); + +/** * Fill plane linesizes for an image with pixel format pix_fmt and * width width. * * @param linesizes array to be filled with the linesize for each plane * @return >= 0 in case of success, a negative error code otherwise */ -int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); +int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); /** * Fill plane data pointers for an image with pixel format pix_fmt and @@ -43,14 +70,37 @@ * @param data pointers array to be filled with the pointer for each image plane * @param ptr the pointer to a buffer which will contain the image * @param linesizes[4] the array containing the linesize for each - * plane, should be filled by av_fill_image_linesizes() + * plane, should be filled by av_image_fill_linesizes() * @return the size in bytes required for the image buffer, a negative * error code in case of failure */ -int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, +int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, uint8_t *ptr, const int linesizes[4]); /** + * Copy image plane from src to dst. + * That is, copy "height" number of lines of "bytewidth" bytes each. + * The first byte of each successive line is separated by *_linesize + * bytes. + * + * @param dst_linesize linesize for the image plane in dst + * @param src_linesize linesize for the image plane in src + */ +void av_image_copy_plane(uint8_t *dst, int dst_linesize, + const uint8_t *src, int src_linesize, + int bytewidth, int height); + +/** + * Copy image in src_data to dst_data. + * + * @param dst_linesize linesizes for the image in dst_data + * @param src_linesize linesizes for the image in src_data + */ +void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], + const uint8_t *src_data[4], const int src_linesizes[4], + enum PixelFormat pix_fmt, int width, int height); + +/** * Check if the given dimension of an image is valid, meaning that all * bytes of the image can be addressed with a signed int. * @@ -60,6 +110,25 @@ * @param log_ctx the parent logging context, it may be NULL * @return >= 0 if valid, a negative error code otherwise */ +int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); + +#if FF_API_OLD_IMAGE_NAMES +attribute_deprecated +void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc); + +attribute_deprecated +int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane); + +attribute_deprecated +int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); + +attribute_deprecated +int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, + uint8_t *ptr, const int linesizes[4]); + +attribute_deprecated int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); +#endif #endif /* AVCORE_IMGUTILS_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/Makefile chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/Makefile --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/Makefile 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/Makefile 2010-11-06 17:21:29.000000000 +0000 @@ -6,9 +6,11 @@ HEADERS = avcore.h \ imgutils.h \ parseutils.h \ + samplefmt.h \ OBJS = imgutils.o \ parseutils.o \ + samplefmt.o \ utils.o \ include $(SUBDIR)../subdir.mak diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/parseutils.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/parseutils.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/parseutils.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/parseutils.c 2010-11-06 17:21:29.000000000 +0000 @@ -23,6 +23,7 @@ #include "parseutils.h" #include "libavutil/avutil.h" +#include "libavutil/eval.h" typedef struct { const char *abbr; @@ -115,33 +116,74 @@ int av_parse_video_rate(AVRational *rate, const char *arg) { - int i; + int i, ret; int n = FF_ARRAY_ELEMS(video_rate_abbrs); - char *cp; + double res; /* First, we check our abbreviation table */ for (i = 0; i < n; ++i) - if (!strcmp(video_rate_abbrs[i].abbr, arg)) { - *rate = video_rate_abbrs[i].rate; - return 0; - } + if (!strcmp(video_rate_abbrs[i].abbr, arg)) { + *rate = video_rate_abbrs[i].rate; + return 0; + } /* Then, we try to parse it as fraction */ - cp = strchr(arg, '/'); - if (!cp) - cp = strchr(arg, ':'); - if (cp) { - char *cpp; - rate->num = strtol(arg, &cpp, 10); - if (cpp != arg || cpp == cp) - rate->den = strtol(cp+1, &cpp, 10); - else - rate->num = 0; - } else { - /* Finally we give up and parse it as double */ - *rate = av_d2q(strtod(arg, 0), 1001000); - } + if ((ret = av_parse_and_eval_expr(&res, arg, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, 0, NULL)) < 0) + return ret; + *rate = av_d2q(res, 1001000); if (rate->num <= 0 || rate->den <= 0) return AVERROR(EINVAL); return 0; } + +#ifdef TEST + +#undef printf + +int main(void) +{ + printf("Testing av_parse_video_rate()\n"); + { + int i; + const char *rates[] = { + "-inf", + "inf", + "nan", + "123/0", + "-123 / 0", + "", + "/", + " 123 / 321", + "foo/foo", + "foo/1", + "1/foo", + "0/0", + "/0", + "1/", + "1", + "0", + "-123/123", + "-foo", + "123.23", + ".23", + "-.23", + "-0.234", + "-0.0000001", + " 21332.2324 ", + " -21332.2324 ", + }; + + for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) { + int ret; + AVRational q = (AVRational){0, 0}; + ret = av_parse_video_rate(&q, rates[i]), + printf("'%s' -> %d/%d ret:%d\n", + rates[i], q.num, q.den, ret); + } + } + + return 0; +} + +#endif /* TEST */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/parseutils.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/parseutils.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/parseutils.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/parseutils.h 2010-11-06 17:21:29.000000000 +0000 @@ -19,7 +19,7 @@ #ifndef AVCORE_PARSEUTILS_H #define AVCORE_PARSEUTILS_H -#include +#include "libavutil/rational.h" /** * @file diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/samplefmt.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/samplefmt.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/samplefmt.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/samplefmt.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avcore.h" +#include "samplefmt.h" + +typedef struct SampleFmtInfo { + const char *name; + int bits; +} SampleFmtInfo; + +/** this table gives more information about formats */ +static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB] = { + [AV_SAMPLE_FMT_U8] = { .name = "u8", .bits = 8 }, + [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16 }, + [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32 }, + [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 }, + [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64 }, +}; + +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt) +{ + if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB) + return NULL; + return sample_fmt_info[sample_fmt].name; +} + +enum AVSampleFormat av_get_sample_fmt(const char *name) +{ + int i; + + for (i = 0; i < AV_SAMPLE_FMT_NB; i++) + if (!strcmp(sample_fmt_info[i].name, name)) + return i; + return AV_SAMPLE_FMT_NONE; +} + +char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sample_fmt) +{ + /* print header */ + if (sample_fmt < 0) + snprintf(buf, buf_size, "name " " depth"); + else if (sample_fmt < AV_SAMPLE_FMT_NB) { + SampleFmtInfo info = sample_fmt_info[sample_fmt]; + snprintf (buf, buf_size, "%-6s" " %2d ", info.name, info.bits); + } + + return buf; +} + +int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt) +{ + return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ? + 0 : sample_fmt_info[sample_fmt].bits; +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/samplefmt.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/samplefmt.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavcore/samplefmt.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavcore/samplefmt.h 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCORE_SAMPLEFMT_H +#define AVCORE_SAMPLEFMT_H + +/** + * all in native-endian format + */ +enum AVSampleFormat { + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcore +}; + +/** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + */ +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); + +/** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + */ +enum AVSampleFormat av_get_sample_fmt(const char *name); + +/** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + */ +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); + +/** + * Return sample format bits per sample. + * + * @param sample_fmt the sample format + * @return number of bits per sample or zero if unknown for the given + * sample format + */ +int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); + +#endif /* AVCORE_SAMPLEFMT_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/alsa-audio.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/alsa-audio.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/alsa-audio.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/alsa-audio.h 2010-11-06 17:21:29.000000000 +0000 @@ -37,11 +37,7 @@ /* XXX: we make the assumption that the soundcard accepts this format */ /* XXX: find better solution with "preinit" method, needed also in other formats */ -#if HAVE_BIGENDIAN -#define DEFAULT_CODEC_ID CODEC_ID_PCM_S16BE -#else -#define DEFAULT_CODEC_ID CODEC_ID_PCM_S16LE -#endif +#define DEFAULT_CODEC_ID AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE) typedef struct { snd_pcm_t *h; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/avdevice.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/avdevice.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/avdevice.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/avdevice.h 2010-11-06 17:21:29.000000000 +0000 @@ -23,7 +23,7 @@ #define LIBAVDEVICE_VERSION_MAJOR 52 #define LIBAVDEVICE_VERSION_MINOR 2 -#define LIBAVDEVICE_VERSION_MICRO 1 +#define LIBAVDEVICE_VERSION_MICRO 2 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ LIBAVDEVICE_VERSION_MINOR, \ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/oss_audio.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/oss_audio.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/oss_audio.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/oss_audio.c 2010-11-06 17:21:29.000000000 +0000 @@ -315,11 +315,7 @@ /* XXX: we make the assumption that the soundcard accepts this format */ /* XXX: find better solution with "preinit" method, needed also in other formats */ -#if HAVE_BIGENDIAN - CODEC_ID_PCM_S16BE, -#else - CODEC_ID_PCM_S16LE, -#endif + AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE), CODEC_ID_NONE, audio_write_header, audio_write_packet, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/v4l2.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/v4l2.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/v4l2.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/v4l2.c 2010-11-06 17:21:29.000000000 +0000 @@ -78,76 +78,22 @@ }; static struct fmt_map fmt_conversion_table[] = { - { - .ff_fmt = PIX_FMT_YUV420P, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_YUV420, - }, - { - .ff_fmt = PIX_FMT_YUV422P, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_YUV422P, - }, - { - .ff_fmt = PIX_FMT_YUYV422, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_YUYV, - }, - { - .ff_fmt = PIX_FMT_UYVY422, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_UYVY, - }, - { - .ff_fmt = PIX_FMT_YUV411P, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_YUV411P, - }, - { - .ff_fmt = PIX_FMT_YUV410P, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_YUV410, - }, - { - .ff_fmt = PIX_FMT_RGB555, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_RGB555, - }, - { - .ff_fmt = PIX_FMT_RGB565, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_RGB565, - }, - { - .ff_fmt = PIX_FMT_BGR24, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_BGR24, - }, - { - .ff_fmt = PIX_FMT_RGB24, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_RGB24, - }, - { - .ff_fmt = PIX_FMT_BGRA, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_BGR32, - }, - { - .ff_fmt = PIX_FMT_GRAY8, - .codec_id = CODEC_ID_RAWVIDEO, - .v4l2_fmt = V4L2_PIX_FMT_GREY, - }, - { - .ff_fmt = PIX_FMT_NONE, - .codec_id = CODEC_ID_MJPEG, - .v4l2_fmt = V4L2_PIX_FMT_MJPEG, - }, - { - .ff_fmt = PIX_FMT_NONE, - .codec_id = CODEC_ID_MJPEG, - .v4l2_fmt = V4L2_PIX_FMT_JPEG, - }, + //ff_fmt codec_id v4l2_fmt + { PIX_FMT_YUV420P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420 }, + { PIX_FMT_YUV422P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV422P }, + { PIX_FMT_YUYV422, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUYV }, + { PIX_FMT_UYVY422, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY }, + { PIX_FMT_YUV411P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P }, + { PIX_FMT_YUV410P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410 }, + { PIX_FMT_RGB555, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555 }, + { PIX_FMT_RGB565, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565 }, + { PIX_FMT_BGR24, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24 }, + { PIX_FMT_RGB24, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24 }, + { PIX_FMT_BGRA, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR32 }, + { PIX_FMT_GRAY8, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_GREY }, + { PIX_FMT_NV12, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV12 }, + { PIX_FMT_NONE, CODEC_ID_MJPEG, V4L2_PIX_FMT_MJPEG }, + { PIX_FMT_NONE, CODEC_ID_MJPEG, V4L2_PIX_FMT_JPEG }, }; static int device_open(AVFormatContext *ctx, uint32_t *capabilities) @@ -291,7 +237,7 @@ req.count = desired_video_buffers; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.memory = V4L2_MEMORY_MMAP; - res = ioctl (s->fd, VIDIOC_REQBUFS, &req); + res = ioctl(s->fd, VIDIOC_REQBUFS, &req); if (res < 0) { if (errno == EINVAL) { av_log(ctx, AV_LOG_ERROR, "Device does not support mmap\n"); @@ -329,7 +275,7 @@ buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; buf.index = i; - res = ioctl (s->fd, VIDIOC_QUERYBUF, &buf); + res = ioctl(s->fd, VIDIOC_QUERYBUF, &buf); if (res < 0) { av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYBUF)\n"); @@ -376,7 +322,7 @@ fd = buf_descriptor->fd; av_free(buf_descriptor); - res = ioctl (fd, VIDIOC_QBUF, &buf); + res = ioctl(fd, VIDIOC_QBUF, &buf); if (res < 0) { av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF)\n"); } @@ -425,7 +371,7 @@ * allocate a buffer for memcopying into it */ av_log(ctx, AV_LOG_ERROR, "Failed to allocate a buffer descriptor\n"); - res = ioctl (s->fd, VIDIOC_QBUF, &buf); + res = ioctl(s->fd, VIDIOC_QBUF, &buf); return AVERROR(ENOMEM); } @@ -455,7 +401,7 @@ buf.memory = V4L2_MEMORY_MMAP; buf.index = i; - res = ioctl (s->fd, VIDIOC_QBUF, &buf); + res = ioctl(s->fd, VIDIOC_QBUF, &buf); if (res < 0) { av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", strerror(errno)); @@ -464,7 +410,7 @@ } type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - res = ioctl (s->fd, VIDIOC_STREAMON, &type); + res = ioctl(s->fd, VIDIOC_STREAMON, &type); if (res < 0) { av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_STREAMON): %s\n", strerror(errno)); @@ -491,34 +437,34 @@ av_free(s->buf_len); } -static int v4l2_set_parameters( AVFormatContext *s1, AVFormatParameters *ap ) +static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap) { struct video_data *s = s1->priv_data; struct v4l2_input input; struct v4l2_standard standard; int i; - if(ap->channel>=0) { + if (ap->channel>=0) { /* set tv video input */ memset (&input, 0, sizeof (input)); input.index = ap->channel; - if(ioctl (s->fd, VIDIOC_ENUMINPUT, &input) < 0) { + if (ioctl(s->fd, VIDIOC_ENUMINPUT, &input) < 0) { av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl enum input failed:\n"); return AVERROR(EIO); } av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set input_id: %d, input: %s\n", ap->channel, input.name); - if(ioctl (s->fd, VIDIOC_S_INPUT, &input.index) < 0 ) { + if (ioctl(s->fd, VIDIOC_S_INPUT, &input.index) < 0) { av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set input(%d) failed\n", ap->channel); return AVERROR(EIO); } } - if(ap->standard) { + if (ap->standard) { av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n", - ap->standard ); + ap->standard); /* set tv standard */ memset (&standard, 0, sizeof (standard)); for(i=0;;i++) { @@ -529,7 +475,7 @@ return AVERROR(EIO); } - if(!strcasecmp(standard.name, ap->standard)) { + if (!strcasecmp(standard.name, ap->standard)) { break; } } @@ -543,6 +489,33 @@ } } + if (ap->time_base.num && ap->time_base.den) { + struct v4l2_streamparm streamparm = { 0 }; + struct v4l2_fract *tpf = &streamparm.parm.capture.timeperframe; + + av_log(s1, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n", + ap->time_base.num, ap->time_base.den); + streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + tpf->numerator = ap->time_base.num; + tpf->denominator = ap->time_base.den; + if (ioctl(s->fd, VIDIOC_S_PARM, &streamparm) != 0) { + av_log(s1, AV_LOG_ERROR, + "ioctl set time per frame(%d/%d) failed\n", + ap->time_base.num, ap->time_base.den); + return AVERROR(EIO); + } + + if (ap->time_base.den != tpf->denominator || + ap->time_base.num != tpf->numerator) { + av_log(s1, AV_LOG_INFO, + "The driver changed the time per frame from %d/%d to %d/%d\n", + ap->time_base.num, ap->time_base.den, + tpf->numerator, tpf->denominator); + ap->time_base.num = tpf->numerator; + ap->time_base.den = tpf->denominator; + } + } + return 0; } @@ -624,11 +597,11 @@ return AVERROR(EIO); } - if (av_check_image_size(s->width, s->height, 0, s1) < 0) + if (av_image_check_size(s->width, s->height, 0, s1) < 0) return AVERROR(EINVAL); s->frame_format = desired_format; - if( v4l2_set_parameters( s1, ap ) < 0 ) + if (v4l2_set_parameters(s1, ap) < 0) return AVERROR(EIO); st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/v4l.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/v4l.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/v4l.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/v4l.c 2010-11-06 17:21:29.000000000 +0000 @@ -117,7 +117,7 @@ } } - if(av_check_image_size(s->video_win.width, s->video_win.height, 0, s1) < 0) + if(av_image_check_size(s->video_win.width, s->video_win.height, 0, s1) < 0) return -1; desired_palette = -1; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/vfwcap.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/vfwcap.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavdevice/vfwcap.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavdevice/vfwcap.c 2010-11-06 17:21:29.000000000 +0000 @@ -248,6 +248,22 @@ int height; int ret; + if (!strcmp(s->filename, "list")) { + for (devnum = 0; devnum <= 9; devnum++) { + char driver_name[256]; + char driver_ver[256]; + ret = capGetDriverDescription(devnum, + driver_name, sizeof(driver_name), + driver_ver, sizeof(driver_ver)); + if (ret) { + av_log(s, AV_LOG_INFO, "Driver %d\n", devnum); + av_log(s, AV_LOG_INFO, " %s\n", driver_name); + av_log(s, AV_LOG_INFO, " %s\n", driver_ver); + } + } + return AVERROR(EIO); + } + if(!ap->time_base.den) { av_log(s, AV_LOG_ERROR, "A time base must be specified.\n"); return AVERROR(EIO); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/af_anull.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/af_anull.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/af_anull.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/af_anull.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,41 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * null audio filter + */ + +#include "avfilter.h" + +AVFilter avfilter_af_anull = { + .name = "anull", + .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."), + + .priv_size = 0, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .get_audio_buffer = avfilter_null_get_audio_buffer, + .filter_samples = avfilter_null_filter_samples }, + { .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_AUDIO, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/allfilters.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/allfilters.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/allfilters.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/allfilters.c 2010-11-06 17:21:29.000000000 +0000 @@ -34,18 +34,35 @@ return; initialized = 1; + REGISTER_FILTER (ANULL, anull, af); + + REGISTER_FILTER (ANULLSRC, anullsrc, asrc); + + REGISTER_FILTER (ANULLSINK, anullsink, asink); + REGISTER_FILTER (ASPECT, aspect, vf); + REGISTER_FILTER (BLACKFRAME, blackframe, vf); REGISTER_FILTER (CROP, crop, vf); + REGISTER_FILTER (CROPDETECT, cropdetect, vf); + REGISTER_FILTER (DRAWBOX, drawbox, vf); + REGISTER_FILTER (FIFO, fifo, vf); REGISTER_FILTER (FORMAT, format, vf); + REGISTER_FILTER (FREI0R, frei0r, vf); + REGISTER_FILTER (HFLIP, hflip, vf); REGISTER_FILTER (NOFORMAT, noformat, vf); REGISTER_FILTER (NULL, null, vf); + REGISTER_FILTER (OCV_SMOOTH, ocv_smooth, vf); REGISTER_FILTER (PAD, pad, vf); REGISTER_FILTER (PIXDESCTEST, pixdesctest, vf); REGISTER_FILTER (PIXELASPECT, pixelaspect, vf); REGISTER_FILTER (SCALE, scale, vf); + REGISTER_FILTER (SETPTS, setpts, vf); + REGISTER_FILTER (SETTB, settb, vf); REGISTER_FILTER (SLICIFY, slicify, vf); + REGISTER_FILTER (TRANSPOSE, transpose, vf); REGISTER_FILTER (UNSHARP, unsharp, vf); REGISTER_FILTER (VFLIP, vflip, vf); + REGISTER_FILTER (YADIF, yadif, vf); REGISTER_FILTER (BUFFER, buffer, vsrc); REGISTER_FILTER (COLOR, color, vsrc); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/asink_anullsink.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/asink_anullsink.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/asink_anullsink.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/asink_anullsink.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avfilter.h" + +static void null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) { } + +AVFilter avfilter_asink_anullsink = { + .name = "anullsink", + .description = NULL_IF_CONFIG_SMALL("Do absolutely nothing with the input audio."), + + .priv_size = 0, + + .inputs = (AVFilterPad[]) { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .filter_samples = null_filter_samples, + }, + { .name = NULL}, + }, + .outputs = (AVFilterPad[]) {{ .name = NULL }}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/asrc_anullsrc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/asrc_anullsrc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/asrc_anullsrc.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/asrc_anullsrc.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,96 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * null audio source + */ + +#include "avfilter.h" +#include "libavcodec/audioconvert.h" + +typedef struct { + int64_t channel_layout; + int64_t sample_rate; +} ANullContext; + +static int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + ANullContext *priv = ctx->priv; + char channel_layout_str[128] = ""; + + priv->sample_rate = 44100; + priv->channel_layout = CH_LAYOUT_STEREO; + + if (args) + sscanf(args, "%"PRId64":%s", &priv->sample_rate, channel_layout_str); + + if (priv->sample_rate < 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid negative sample rate: %"PRId64"\n", priv->sample_rate); + return AVERROR(EINVAL); + } + + if (*channel_layout_str) + if (!(priv->channel_layout = avcodec_get_channel_layout(channel_layout_str)) + && sscanf(channel_layout_str, "%"PRId64, &priv->channel_layout) != 1) { + av_log(ctx, AV_LOG_ERROR, "Invalid value '%s' for channel layout\n", + channel_layout_str); + return AVERROR(EINVAL); + } + + return 0; +} + +static int config_props(AVFilterLink *outlink) +{ + ANullContext *priv = outlink->src->priv; + char buf[128]; + int chans_nb; + + outlink->sample_rate = priv->sample_rate; + outlink->channel_layout = priv->channel_layout; + + chans_nb = avcodec_channel_layout_num_channels(priv->channel_layout); + avcodec_get_channel_layout_string(buf, sizeof(buf), chans_nb, priv->channel_layout); + av_log(outlink->src, AV_LOG_INFO, + "sample_rate:%"PRId64 " channel_layout:%"PRId64 " channel_layout_description:'%s'\n", + priv->sample_rate, priv->channel_layout, buf); + + return 0; +} + +static int request_frame(AVFilterLink *link) +{ + return -1; +} + +AVFilter avfilter_asrc_anullsrc = { + .name = "anullsrc", + .description = NULL_IF_CONFIG_SMALL("Null audio source, never return audio frames."), + + .init = init, + .priv_size = sizeof(ANullContext), + + .inputs = (AVFilterPad[]) {{ .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .config_props = config_props, + .request_frame = request_frame, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/avfilter.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/avfilter.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/avfilter.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/avfilter.c 2010-11-06 17:21:29.000000000 +0000 @@ -21,8 +21,9 @@ /* #define DEBUG */ -#include "libavcodec/imgconvert.h" #include "libavutil/pixdesc.h" +#include "libavutil/rational.h" +#include "libavcore/imgutils.h" #include "avfilter.h" #include "internal.h" @@ -41,14 +42,27 @@ return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1; } -/** helper macros to get the in/out pad on the dst/src filter */ -#define link_dpad(link) link->dst-> input_pads[link->dstpad] -#define link_spad(link) link->src->output_pads[link->srcpad] - AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) { AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); + if (!ret) + return NULL; *ret = *ref; + if (ref->type == AVMEDIA_TYPE_VIDEO) { + ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps)); + if (!ret->video) { + av_free(ret); + return NULL; + } + *ret->video = *ref->video; + } else if (ref->type == AVMEDIA_TYPE_AUDIO) { + ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps)); + if (!ret->audio) { + av_free(ret); + return NULL; + } + *ret->audio = *ref->audio; + } ret->perms &= pmask; ret->buf->refcount ++; return ret; @@ -56,8 +70,10 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref) { - if(!(--ref->buf->refcount)) + if (!(--ref->buf->refcount)) ref->buf->free(ref->buf); + av_free(ref->video); + av_free(ref->audio); av_free(ref); } @@ -76,10 +92,10 @@ memcpy(*pads+idx, newpad, sizeof(AVFilterPad)); (*links)[idx] = NULL; - (*count) ++; - for(i = idx+1; i < *count; i ++) - if(*links[i]) - (*(unsigned *)((uint8_t *) *links[i] + padidx_off)) ++; + (*count)++; + for (i = idx+1; i < *count; i++) + if (*links[i]) + (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++; } int avfilter_link(AVFilterContext *src, unsigned srcpad, @@ -87,8 +103,8 @@ { AVFilterLink *link; - if(src->output_count <= srcpad || dst->input_count <= dstpad || - src->outputs[srcpad] || dst->inputs[dstpad]) + if (src->output_count <= srcpad || dst->input_count <= dstpad || + src->outputs[srcpad] || dst->inputs[dstpad]) return -1; src->outputs[srcpad] = @@ -96,8 +112,8 @@ link->src = src; link->dst = dst; - link->srcpad = srcpad; - link->dstpad = dstpad; + link->srcpad = &src->output_pads[srcpad]; + link->dstpad = &dst->input_pads[dstpad]; link->type = src->output_pads[srcpad].type; assert(PIX_FMT_NONE == -1 && SAMPLE_FMT_NONE == -1); link->format = -1; @@ -106,29 +122,32 @@ } int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, - unsigned in, unsigned out) + unsigned filt_srcpad_idx, unsigned filt_dstpad_idx) { + int ret; + unsigned dstpad_idx = link->dstpad - link->dst->input_pads; + av_log(link->dst, AV_LOG_INFO, "auto-inserting filter '%s' " "between the filter '%s' and the filter '%s'\n", filt->name, link->src->name, link->dst->name); - link->dst->inputs[link->dstpad] = NULL; - if(avfilter_link(filt, out, link->dst, link->dstpad)) { + link->dst->inputs[dstpad_idx] = NULL; + if ((ret = avfilter_link(filt, filt_dstpad_idx, link->dst, dstpad_idx)) < 0) { /* failed to link output filter to new filter */ - link->dst->inputs[link->dstpad] = link; - return -1; + link->dst->inputs[dstpad_idx] = link; + return ret; } /* re-hookup the link to the new destination filter we inserted */ link->dst = filt; - link->dstpad = in; - filt->inputs[in] = link; + link->dstpad = &filt->input_pads[filt_srcpad_idx]; + filt->inputs[filt_srcpad_idx] = link; /* if any information on supported media formats already exists on the * link, we need to preserve that */ - if(link->out_formats) + if (link->out_formats) avfilter_formats_changeref(&link->out_formats, - &filt->outputs[out]->out_formats); + &filt->outputs[filt_dstpad_idx]->out_formats); return 0; } @@ -137,13 +156,14 @@ { int (*config_link)(AVFilterLink *); unsigned i; + int ret; - for(i = 0; i < filter->input_count; i ++) { + for (i = 0; i < filter->input_count; i ++) { AVFilterLink *link = filter->inputs[i]; - if(!link) continue; + if (!link) continue; - switch(link->init_state) { + switch (link->init_state) { case AVLINK_INIT: continue; case AVLINK_STARTINIT: @@ -152,17 +172,21 @@ case AVLINK_UNINIT: link->init_state = AVLINK_STARTINIT; - if(avfilter_config_links(link->src)) - return -1; + if ((ret = avfilter_config_links(link->src)) < 0) + return ret; - if(!(config_link = link_spad(link).config_props)) + if (!(config_link = link->srcpad->config_props)) config_link = avfilter_default_config_output_link; - if(config_link(link)) - return -1; + if ((ret = config_link(link)) < 0) + return ret; - if((config_link = link_dpad(link).config_props)) - if(config_link(link)) - return -1; + if (link->time_base.num == 0 && link->time_base.den == 0) + link->time_base = link->src && link->src->input_count ? + link->src->inputs[0]->time_base : AV_TIME_BASE_Q; + + if ((config_link = link->dstpad->config_props)) + if ((ret = config_link(link)) < 0) + return ret; link->init_state = AVLINK_INIT; } @@ -171,16 +195,43 @@ return 0; } -void ff_dprintf_picref(void *ctx, AVFilterBufferRef *picref, int end) +char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) +{ + snprintf(buf, buf_size, "%s%s%s%s%s", + perms & AV_PERM_READ ? "r" : "", + perms & AV_PERM_WRITE ? "w" : "", + perms & AV_PERM_PRESERVE ? "p" : "", + perms & AV_PERM_REUSE ? "r" : "", + perms & AV_PERM_REUSE2 ? "R" : ""); + return buf; +} + +void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) { + av_unused char buf[16]; dprintf(ctx, - "picref[%p data[%p, %p, %p, %p] linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64" a:%d/%d s:%dx%d]%s", - picref, - picref->data [0], picref->data [1], picref->data [2], picref->data [3], - picref->linesize[0], picref->linesize[1], picref->linesize[2], picref->linesize[3], - picref->pts, picref->pos, - picref->pixel_aspect.num, picref->pixel_aspect.den, picref->w, picref->h, - end ? "\n" : ""); + "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64, + ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0], + ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3], + ref->pts, ref->pos); + + if (ref->video) { + dprintf(ctx, " a:%d/%d s:%dx%d i:%c", + ref->video->pixel_aspect.num, ref->video->pixel_aspect.den, + ref->video->w, ref->video->h, + !ref->video->interlaced ? 'P' : /* Progressive */ + ref->video->top_field_first ? 'T' : 'B'); /* Top / Bottom */ + } + if (ref->audio) { + dprintf(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d", + ref->audio->channel_layout, + ref->audio->samples_nb, + ref->audio->size, + ref->audio->sample_rate, + ref->audio->planar); + } + + dprintf(ctx, "]%s", end ? "\n" : ""); } void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) @@ -198,15 +249,38 @@ { AVFilterBufferRef *ret = NULL; - FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d w:%d h:%d\n", perms, w, h); + av_unused char buf[16]; + FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); + dprintf(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); - if(link_dpad(link).get_video_buffer) - ret = link_dpad(link).get_video_buffer(link, perms, w, h); + if (link->dstpad->get_video_buffer) + ret = link->dstpad->get_video_buffer(link, perms, w, h); - if(!ret) + if (!ret) ret = avfilter_default_get_video_buffer(link, perms, w, h); - FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_picref(NULL, ret, 1); + if (ret) + ret->type = AVMEDIA_TYPE_VIDEO; + + FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); + + return ret; +} + +AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, + enum SampleFormat sample_fmt, int size, + int64_t channel_layout, int planar) +{ + AVFilterBufferRef *ret = NULL; + + if (link->dstpad->get_audio_buffer) + ret = link->dstpad->get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar); + + if (!ret) + ret = avfilter_default_get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar); + + if (ret) + ret->type = AVMEDIA_TYPE_AUDIO; return ret; } @@ -215,23 +289,23 @@ { FF_DPRINTF_START(NULL, request_frame); ff_dprintf_link(NULL, link, 1); - if(link_spad(link).request_frame) - return link_spad(link).request_frame(link); - else if(link->src->inputs[0]) + if (link->srcpad->request_frame) + return link->srcpad->request_frame(link); + else if (link->src->inputs[0]) return avfilter_request_frame(link->src->inputs[0]); else return -1; } int avfilter_poll_frame(AVFilterLink *link) { - int i, min=INT_MAX; + int i, min = INT_MAX; - if(link_spad(link).poll_frame) - return link_spad(link).poll_frame(link); + if (link->srcpad->poll_frame) + return link->srcpad->poll_frame(link); - for (i=0; isrc->input_count; i++) { + for (i = 0; i < link->src->input_count; i++) { int val; - if(!link->src->inputs[i]) + if (!link->src->inputs[i]) return -1; val = avfilter_poll_frame(link->src->inputs[i]); min = FFMIN(min, val); @@ -245,24 +319,22 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) { void (*start_frame)(AVFilterLink *, AVFilterBufferRef *); - AVFilterPad *dst = &link_dpad(link); + AVFilterPad *dst = link->dstpad; - FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_picref(NULL, picref, 1); + FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_ref(NULL, picref, 1); - if(!(start_frame = dst->start_frame)) + if (!(start_frame = dst->start_frame)) start_frame = avfilter_default_start_frame; /* prepare to copy the picture if it has insufficient permissions */ - if((dst->min_perms & picref->perms) != dst->min_perms || - dst->rej_perms & picref->perms) { - /* - av_log(link->dst, AV_LOG_INFO, + if ((dst->min_perms & picref->perms) != dst->min_perms || + dst->rej_perms & picref->perms) { + av_log(link->dst, AV_LOG_DEBUG, "frame copy needed (have perms %x, need %x, reject %x)\n", picref->perms, - link_dpad(link).min_perms, link_dpad(link).rej_perms); - */ + link->dstpad->min_perms, link->dstpad->rej_perms); - link->cur_buf = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h); + link->cur_buf = avfilter_get_video_buffer(link, dst->min_perms, link->w, link->h); link->src_buf = picref; avfilter_copy_buffer_ref_props(link->cur_buf, link->src_buf); } @@ -276,18 +348,17 @@ { void (*end_frame)(AVFilterLink *); - if(!(end_frame = link_dpad(link).end_frame)) + if (!(end_frame = link->dstpad->end_frame)) end_frame = avfilter_default_end_frame; end_frame(link); /* unreference the source picture if we're feeding the destination filter * a copied version dues to permission issues */ - if(link->src_buf) { + if (link->src_buf) { avfilter_unref_buffer(link->src_buf); link->src_buf = NULL; } - } void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) @@ -299,11 +370,11 @@ FF_DPRINTF_START(NULL, draw_slice); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir); /* copy the slice if needed for permission reasons */ - if(link->src_buf) { + if (link->src_buf) { vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; - for(i = 0; i < 4; i ++) { - if(link->src_buf->data[i]) { + for (i = 0; i < 4; i++) { + if (link->src_buf->data[i]) { src[i] = link->src_buf-> data[i] + (y >> (i==0 ? 0 : vsub)) * link->src_buf-> linesize[i]; dst[i] = link->cur_buf->data[i] + @@ -312,25 +383,59 @@ src[i] = dst[i] = NULL; } - for(i = 0; i < 4; i ++) { + for (i = 0; i < 4; i++) { int planew = - ff_get_plane_bytewidth(link->format, link->cur_buf->w, i); + av_image_get_linesize(link->format, link->cur_buf->video->w, i); - if(!src[i]) continue; + if (!src[i]) continue; - for(j = 0; j < h >> (i==0 ? 0 : vsub); j ++) { + for (j = 0; j < h >> (i==0 ? 0 : vsub); j++) { memcpy(dst[i], src[i], planew); - src[i] += link->src_buf ->linesize[i]; + src[i] += link->src_buf->linesize[i]; dst[i] += link->cur_buf->linesize[i]; } } } - if(!(draw_slice = link_dpad(link).draw_slice)) + if (!(draw_slice = link->dstpad->draw_slice)) draw_slice = avfilter_default_draw_slice; draw_slice(link, y, h, slice_dir); } +void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) +{ + void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *); + AVFilterPad *dst = link->dstpad; + + if (!(filter_samples = dst->filter_samples)) + filter_samples = avfilter_default_filter_samples; + + /* prepare to copy the samples if the buffer has insufficient permissions */ + if ((dst->min_perms & samplesref->perms) != dst->min_perms || + dst->rej_perms & samplesref->perms) { + + av_log(link->dst, AV_LOG_DEBUG, + "Copying audio data in avfilter (have perms %x, need %x, reject %x)\n", + samplesref->perms, link->dstpad->min_perms, link->dstpad->rej_perms); + + link->cur_buf = avfilter_default_get_audio_buffer(link, dst->min_perms, + samplesref->format, + samplesref->audio->size, + samplesref->audio->channel_layout, + samplesref->audio->planar); + link->cur_buf->pts = samplesref->pts; + link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate; + + /* Copy actual data into new samples buffer */ + memcpy(link->cur_buf->data[0], samplesref->data[0], samplesref->audio->size); + + avfilter_unref_buffer(samplesref); + } else + link->cur_buf = samplesref; + + filter_samples(link, link->cur_buf); +} + #define MAX_REGISTERED_AVFILTERS_NB 64 static AVFilter *registered_avfilters[MAX_REGISTERED_AVFILTERS_NB + 1]; @@ -389,12 +494,13 @@ LIBAVUTIL_VERSION_INT, }; -AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name) +int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name) { AVFilterContext *ret; + *filter_ctx = NULL; if (!filter) - return 0; + return AVERROR(EINVAL); ret = av_mallocz(sizeof(AVFilterContext)); @@ -417,33 +523,35 @@ ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); } - return ret; + *filter_ctx = ret; + return 0; } void avfilter_destroy(AVFilterContext *filter) { int i; + AVFilterLink *link; - if(filter->filter->uninit) + if (filter->filter->uninit) filter->filter->uninit(filter); - for(i = 0; i < filter->input_count; i ++) { - if(filter->inputs[i]) { - if (filter->inputs[i]->src) - filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL; - avfilter_formats_unref(&filter->inputs[i]->in_formats); - avfilter_formats_unref(&filter->inputs[i]->out_formats); + for (i = 0; i < filter->input_count; i++) { + if ((link = filter->inputs[i])) { + if (link->src) + link->src->outputs[link->srcpad - link->src->output_pads] = NULL; + avfilter_formats_unref(&link->in_formats); + avfilter_formats_unref(&link->out_formats); } - av_freep(&filter->inputs[i]); + av_freep(&link); } - for(i = 0; i < filter->output_count; i ++) { - if(filter->outputs[i]) { - if (filter->outputs[i]->dst) - filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL; - avfilter_formats_unref(&filter->outputs[i]->in_formats); - avfilter_formats_unref(&filter->outputs[i]->out_formats); + for (i = 0; i < filter->output_count; i++) { + if ((link = filter->outputs[i])) { + if (link->dst) + link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL; + avfilter_formats_unref(&link->in_formats); + avfilter_formats_unref(&link->out_formats); } - av_freep(&filter->outputs[i]); + av_freep(&link); } av_freep(&filter->name); @@ -459,7 +567,7 @@ { int ret=0; - if(filter->filter->init) + if (filter->filter->init) ret = filter->filter->init(filter, args, opaque); return ret; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/avfiltergraph.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/avfiltergraph.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/avfiltergraph.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/avfiltergraph.c 2010-11-06 17:21:29.000000000 +0000 @@ -133,8 +133,7 @@ /* couldn't merge format lists. auto-insert scale filter */ snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d", scaler_count++); - scale = - avfilter_open(avfilter_get_by_name("scale"),inst_name); + avfilter_open(&scale, avfilter_get_by_name("scale"), inst_name); snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts); if(!scale || scale->filter->init(scale, scale_args, NULL) || @@ -203,3 +202,16 @@ return 0; } +int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx) +{ + int ret; + + if ((ret = avfilter_graph_check_validity(graphctx, log_ctx))) + return ret; + if ((ret = avfilter_graph_config_formats(graphctx, log_ctx))) + return ret; + if ((ret = avfilter_graph_config_links(graphctx, log_ctx))) + return ret; + + return 0; +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/avfiltergraph.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/avfiltergraph.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/avfiltergraph.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/avfiltergraph.h 2010-11-06 17:21:29.000000000 +0000 @@ -70,6 +70,14 @@ int avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx); /** + * Check validity and configure all the links and formats in the graph. + * + * @see avfilter_graph_check_validity(), avfilter_graph_config_links(), + * avfilter_graph_config_formats() + */ +int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx); + +/** * Free a graph and destroy its links. */ void avfilter_graph_destroy(AVFilterGraph *graph); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/avfilter.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/avfilter.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/avfilter.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/avfilter.h 2010-11-06 17:21:29.000000000 +0000 @@ -25,7 +25,7 @@ #include "libavutil/avutil.h" #define LIBAVFILTER_VERSION_MAJOR 1 -#define LIBAVFILTER_VERSION_MINOR 31 +#define LIBAVFILTER_VERSION_MINOR 54 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ @@ -64,8 +64,7 @@ * should not store pointers to this structure directly, but instead use the * AVFilterBufferRef structure below. */ -typedef struct AVFilterBuffer -{ +typedef struct AVFilterBuffer { uint8_t *data[8]; ///< buffer data for each plane/channel int linesize[8]; ///< number of bytes per line @@ -89,6 +88,32 @@ #define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time /** + * Audio specific properties in a reference to an AVFilterBuffer. Since + * AVFilterBufferRef is common to different media formats, audio specific + * per reference properties must be separated out. + */ +typedef struct AVFilterBufferRefAudioProps { + int64_t channel_layout; ///< channel layout of audio buffer + int samples_nb; ///< number of audio samples + int size; ///< audio buffer size + uint32_t sample_rate; ///< audio buffer sample rate + int planar; ///< audio buffer - planar or packed +} AVFilterBufferRefAudioProps; + +/** + * Video specific properties in a reference to an AVFilterBuffer. Since + * AVFilterBufferRef is common to different media formats, video specific + * per reference properties must be separated out. + */ +typedef struct AVFilterBufferRefVideoProps { + int w; ///< image width + int h; ///< image height + AVRational pixel_aspect; ///< pixel aspect ratio + int interlaced; ///< is frame interlaced + int top_field_first; ///< field order +} AVFilterBufferRefVideoProps; + +/** * A reference to an AVFilterBuffer. Since filters can manipulate the origin of * a buffer to, for example, crop image without any memcpy, the buffer origin * and dimensions are per-reference properties. Linesize is also useful for @@ -96,43 +121,45 @@ * * TODO: add anything necessary for frame reordering */ -typedef struct AVFilterBufferRef -{ +typedef struct AVFilterBufferRef { AVFilterBuffer *buf; ///< the buffer that this is a reference to - uint8_t *data[4]; ///< picture data for each plane - int linesize[4]; ///< number of bytes per line - int w; ///< image width - int h; ///< image height + uint8_t *data[8]; ///< picture/audio data for each plane + int linesize[8]; ///< number of bytes per line int format; ///< media format - int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE + /** + * presentation timestamp. The time unit may change during + * filtering, as it is specified in the link and the filter code + * may need to rescale the PTS accordingly. + */ + int64_t pts; int64_t pos; ///< byte position in stream, -1 if unknown - AVRational pixel_aspect; ///< pixel aspect ratio - int perms; ///< permissions, see the AV_PERM_* flags - int interlaced; ///< is frame interlaced - int top_field_first; + enum AVMediaType type; ///< media type of buffer data + AVFilterBufferRefVideoProps *video; ///< video buffer specific properties + AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties } AVFilterBufferRef; /** - * Copy properties of src to dst, without copying the actual video - * data. + * Copy properties of src to dst, without copying the actual data */ static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) { + // copy common properties dst->pts = src->pts; dst->pos = src->pos; - dst->pixel_aspect = src->pixel_aspect; - dst->interlaced = src->interlaced; - dst->top_field_first = src->top_field_first; - dst->w = src->w; - dst->h = src->h; + + switch (src->type) { + case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; + case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; + } } /** * Add a new reference to a buffer. + * * @param ref an existing reference to the buffer * @param pmask a bitmask containing the allowable permissions in the new * reference @@ -144,6 +171,7 @@ /** * Remove a reference to a buffer. If this is the last reference to the * buffer, the buffer itself is also automatically freed. + * * @param ref reference to the buffer */ void avfilter_unref_buffer(AVFilterBufferRef *ref); @@ -188,19 +216,18 @@ * get updated as well. Therefore, we have the format list structure store a * pointer to each of the pointers to itself. */ -typedef struct AVFilterFormats AVFilterFormats; -struct AVFilterFormats -{ +typedef struct AVFilterFormats { unsigned format_count; ///< number of formats int *formats; ///< list of media formats unsigned refcount; ///< number of references to this list - AVFilterFormats ***refs; ///< references to this list -}; + struct AVFilterFormats ***refs; ///< references to this list +} AVFilterFormats;; /** * Create a list of supported formats. This is intended for use in * AVFilter->query_formats(). + * * @param fmts list of media formats, terminated by -1 * @return the format list, with no existing references */ @@ -281,8 +308,7 @@ /** * A filter pad used for either input or output. */ -struct AVFilterPad -{ +struct AVFilterPad { /** * Pad name. The name is unique among inputs and among outputs, but an * input may have the same name as an output. This may be NULL if this @@ -326,7 +352,7 @@ void (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref); /** - * Callback function to get a buffer. If NULL, the filter system will + * Callback function to get a video buffer. If NULL, the filter system will * use avfilter_default_get_video_buffer(). * * Input video pads only. @@ -334,6 +360,16 @@ AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h); /** + * Callback function to get an audio buffer. If NULL, the filter system will + * use avfilter_default_get_audio_buffer(). + * + * Input audio pads only. + */ + AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms, + enum SampleFormat sample_fmt, int size, + int64_t channel_layout, int planar); + + /** * Callback called after the slices of a frame are completely sent. If * NULL, the filter layer will default to releasing the reference stored * in the link structure during start_frame(). @@ -351,8 +387,16 @@ void (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir); /** + * Samples filtering callback. This is where a filter receives audio data + * and should do its processing. + * + * Input audio pads only. + */ + void (*filter_samples)(AVFilterLink *link, AVFilterBufferRef *samplesref); + + /** * Frame poll callback. This returns the number of immediately available - * frames. It should return a positive value if the next request_frame() + * samples. It should return a positive value if the next request_frame() * is guaranteed to return one frame (with no delay). * * Defaults to just calling the source poll_frame() method. @@ -389,23 +433,38 @@ /** default handler for start_frame() for video inputs */ void avfilter_default_start_frame(AVFilterLink *link, AVFilterBufferRef *picref); + /** default handler for draw_slice() for video inputs */ void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir); + /** default handler for end_frame() for video inputs */ void avfilter_default_end_frame(AVFilterLink *link); -/** default handler for config_props() for video outputs */ + +/** default handler for filter_samples() for audio inputs */ +void avfilter_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref); + +/** default handler for config_props() for audio/video outputs */ int avfilter_default_config_output_link(AVFilterLink *link); -/** default handler for config_props() for video inputs */ + +/** default handler for config_props() for audio/video inputs */ int avfilter_default_config_input_link (AVFilterLink *link); + /** default handler for get_video_buffer() for video inputs */ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, - int perms, int w, int h); + int perms, int w, int h); + +/** default handler for get_audio_buffer() for audio inputs */ +AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms, + enum SampleFormat sample_fmt, int size, + int64_t channel_layout, int planar); + /** * A helper for query_formats() which sets all links to the same list of * formats. If there are no links hooked to this filter, the list of formats is * freed. */ void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats); + /** Default handler for query_formats() */ int avfilter_default_query_formats(AVFilterContext *ctx); @@ -418,16 +477,23 @@ /** end_frame() handler for filters which simply pass video along */ void avfilter_null_end_frame(AVFilterLink *link); +/** filter_samples() handler for filters which simply pass audio along */ +void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref); + /** get_video_buffer() handler for filters which simply pass video along */ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h); +/** get_audio_buffer() handler for filters which simply pass audio along */ +AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms, + enum SampleFormat sample_fmt, int size, + int64_t channel_layout, int planar); + /** * Filter definition. This defines the pads a filter contains, and all the * callback functions used to interact with the filter. */ -typedef struct AVFilter -{ +typedef struct AVFilter { const char *name; ///< filter name int priv_size; ///< size of private data to allocate for the filter @@ -468,8 +534,7 @@ } AVFilter; /** An instance of a filter */ -struct AVFilterContext -{ +struct AVFilterContext { const AVClass *av_class; ///< needed for av_log() AVFilter *filter; ///< the AVFilter of which this is an instance @@ -494,13 +559,12 @@ * which have been negotiated and agreed upon between the filter, such as * image dimensions, format, etc. */ -struct AVFilterLink -{ +struct AVFilterLink { AVFilterContext *src; ///< source filter - unsigned int srcpad; ///< index of the output pad on the source filter + AVFilterPad *srcpad; ///< output pad on the source filter AVFilterContext *dst; ///< dest filter - unsigned int dstpad; ///< index of the input pad on the dest filter + AVFilterPad *dstpad; ///< input pad on the dest filter /** stage of the initialization of the link properties (dimensions, etc) */ enum { @@ -511,8 +575,13 @@ enum AVMediaType type; ///< filter media type + /* These two parameters apply only to video */ int w; ///< agreed upon image width int h; ///< agreed upon image height + /* These two parameters apply only to audio */ + int64_t channel_layout; ///< channel layout of current buffer (see avcodec.h) + int64_t sample_rate; ///< samples per second + int format; ///< agreed upon media format /** @@ -534,10 +603,20 @@ AVFilterBufferRef *cur_buf; AVFilterBufferRef *out_buf; + + /** + * Define the time base used by the PTS of the frames/samples + * which will pass through this link. + * During the configuration stage, each filter is supposed to + * change only the output timebase, while the timebase of the + * input link is assumed to be an unchangeable property. + */ + AVRational time_base; }; /** * Link two filters together. + * * @param src the source filter * @param srcpad index of the output pad on the source filter * @param dst the destination filter @@ -549,6 +628,7 @@ /** * Negotiate the media format, dimensions, etc of all inputs to a filter. + * * @param filter the filter to negotiate the properties for its inputs * @return zero on successful negotiation */ @@ -556,6 +636,7 @@ /** * Request a picture buffer with a specific set of permissions. + * * @param link the output link to the filter from which the buffer will * be requested * @param perms the required access permissions @@ -568,7 +649,25 @@ int w, int h); /** + * Request an audio samples buffer with a specific set of permissions. + * + * @param link the output link to the filter from which the buffer will + * be requested + * @param perms the required access permissions + * @param sample_fmt the format of each sample in the buffer to allocate + * @param size the buffer size in bytes + * @param channel_layout the number and type of channels per sample in the buffer to allocate + * @param planar audio data layout - planar or packed + * @return A reference to the samples. This must be unreferenced with + * avfilter_unref_buffer when you are finished with it. + */ +AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, + enum SampleFormat sample_fmt, int size, + int64_t channel_layout, int planar); + +/** * Request an input frame from the filter at the other end of the link. + * * @param link the input link * @return zero on success */ @@ -576,6 +675,7 @@ /** * Poll a frame from the filter chain. + * * @param link the input link * @return the number of immediately available frames, a negative * number in case of error @@ -584,6 +684,7 @@ /** * Notifie the next filter of the start of a frame. + * * @param link the output link the frame will be sent over * @param picref A reference to the frame about to be sent. The data for this * frame need only be valid once draw_slice() is called for that @@ -594,6 +695,7 @@ /** * Notifie the next filter that the current frame has finished. + * * @param link the output link the frame was sent over */ void avfilter_end_frame(AVFilterLink *link); @@ -615,6 +717,16 @@ */ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir); +/** + * Send a buffer of audio samples to the next filter. + * + * @param link the output link over which the audio samples are being sent + * @param samplesref a reference to the buffer of audio samples being sent. The + * receiving filter will free this reference when it no longer + * needs it or pass it on to the next filter. + */ +void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref); + /** Initialize the filter system. Register all builtin filters. */ void avfilter_register_all(void); @@ -626,6 +738,7 @@ * avfilter_get_by_name later to lookup the AVFilter structure by name. A * filter can still by instantiated with avfilter_open even if it is not * registered. + * * @param filter the filter to register * @return 0 if the registration was succesfull, a negative value * otherwise @@ -634,6 +747,7 @@ /** * Get a filter definition matching the given name. + * * @param name the filter name to find * @return the filter definition, if any matching one is registered. * NULL if none found. @@ -650,14 +764,18 @@ /** * Create a filter instance. + * + * @param filter_ctx put here a pointer to the created filter context + * on success, NULL on failure * @param filter the filter to create an instance of * @param inst_name Name to give to the new instance. Can be NULL for none. - * @return Pointer to the new instance on success. NULL on failure. + * @return >= 0 in case of success, a negative error code otherwise */ -AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name); +int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name); /** * Initialize a filter. + * * @param filter the filter to initialize * @param args A string of parameters to use when initializing the filter. * The format and meaning of this string varies by filter. @@ -669,23 +787,26 @@ /** * Destroy a filter. + * * @param filter the filter to destroy */ void avfilter_destroy(AVFilterContext *filter); /** * Insert a filter in the middle of an existing link. + * * @param link the link into which the filter should be inserted * @param filt the filter to be inserted - * @param in the input pad on the filter to connect - * @param out the output pad on the filter to connect + * @param filt_srcpad_idx the input pad on the filter to connect + * @param filt_dstpad_idx the output pad on the filter to connect * @return zero on success */ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, - unsigned in, unsigned out); + unsigned filt_srcpad_idx, unsigned filt_dstpad_idx); /** * Insert a new pad. + * * @param idx Insertion point. Pad is inserted at the end if this point * is beyond the end of the list of pads. * @param count Pointer to the number of pads in the list diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/defaults.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/defaults.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/defaults.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/defaults.c 2010-11-06 17:21:29.000000000 +0000 @@ -20,6 +20,8 @@ */ #include "libavcore/imgutils.h" +#include "libavcore/samplefmt.h" +#include "libavcodec/audioconvert.h" #include "avfilter.h" /* TODO: buffer pool. see comment for avfilter_default_get_video_buffer() */ @@ -35,13 +37,17 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer)); - AVFilterBufferRef *ref = av_mallocz(sizeof(AVFilterBufferRef)); + AVFilterBufferRef *ref = NULL; int i, tempsize; - char *buf; + char *buf = NULL; + + if (!pic || !(ref = av_mallocz(sizeof(AVFilterBufferRef)))) + goto fail; - ref->buf = pic; - ref->w = w; - ref->h = h; + ref->buf = pic; + ref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps)); + ref->video->w = w; + ref->video->h = h; /* make sure the buffer gets read permission or it's useless for output */ ref->perms = perms | AV_PERM_READ; @@ -49,74 +55,192 @@ pic->refcount = 1; ref->format = link->format; pic->free = avfilter_default_free_buffer; - av_fill_image_linesizes(pic->linesize, ref->format, ref->w); + av_image_fill_linesizes(pic->linesize, ref->format, ref->video->w); - for (i=0; i<4;i++) + for (i = 0; i < 4; i++) pic->linesize[i] = FFALIGN(pic->linesize[i], 16); - tempsize = av_fill_image_pointers(pic->data, ref->format, ref->h, NULL, pic->linesize); + tempsize = av_image_fill_pointers(pic->data, ref->format, ref->video->h, NULL, pic->linesize); buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be // SIMD-friendly - av_fill_image_pointers(pic->data, ref->format, ref->h, buf, pic->linesize); + if (!buf) + goto fail; + av_image_fill_pointers(pic->data, ref->format, ref->video->h, buf, pic->linesize); - memcpy(ref->data, pic->data, 4*sizeof(pic->data[0])); - memcpy(ref->linesize, pic->linesize, 4*sizeof(pic->linesize[0])); + memcpy(ref->data, pic->data, sizeof(ref->data)); + memcpy(ref->linesize, pic->linesize, sizeof(ref->linesize)); return ref; -} -void avfilter_default_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) -{ - AVFilterLink *out = NULL; +fail: + av_free(buf); + if (ref && ref->video) + av_free(ref->video); + av_free(ref); + av_free(pic); + return NULL; +} + +AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms, + enum SampleFormat sample_fmt, int size, + int64_t channel_layout, int planar) +{ + AVFilterBuffer *samples = av_mallocz(sizeof(AVFilterBuffer)); + AVFilterBufferRef *ref = NULL; + int i, sample_size, chans_nb, bufsize, per_channel_size, step_size = 0; + char *buf; + + if (!samples || !(ref = av_mallocz(sizeof(AVFilterBufferRef)))) + goto fail; + + ref->buf = samples; + ref->format = sample_fmt; + + ref->audio = av_mallocz(sizeof(AVFilterBufferRefAudioProps)); + if (!ref->audio) + goto fail; + + ref->audio->channel_layout = channel_layout; + ref->audio->size = size; + ref->audio->planar = planar; + + /* make sure the buffer gets read permission or it's useless for output */ + ref->perms = perms | AV_PERM_READ; + + samples->refcount = 1; + samples->free = avfilter_default_free_buffer; + + sample_size = av_get_bits_per_sample_fmt(sample_fmt) >>3; + chans_nb = avcodec_channel_layout_num_channels(channel_layout); + + per_channel_size = size/chans_nb; + ref->audio->samples_nb = per_channel_size/sample_size; + + /* Set the number of bytes to traverse to reach next sample of a particular channel: + * For planar, this is simply the sample size. + * For packed, this is the number of samples * sample_size. + */ + for (i = 0; i < chans_nb; i++) + samples->linesize[i] = planar > 0 ? per_channel_size : sample_size; + memset(&samples->linesize[chans_nb], 0, (8-chans_nb) * sizeof(samples->linesize[0])); + + /* Calculate total buffer size, round to multiple of 16 to be SIMD friendly */ + bufsize = (size + 15)&~15; + buf = av_malloc(bufsize); + if (!buf) + goto fail; + + /* For planar, set the start point of each channel's data within the buffer + * For packed, set the start point of the entire buffer only + */ + samples->data[0] = buf; + if (buf && planar) { + for (i = 1; i < chans_nb; i++) { + step_size += per_channel_size; + samples->data[i] = buf + step_size; + } + } else { + for (i = 1; i < chans_nb; i++) + samples->data[i] = buf; + } + + memset(&samples->data[chans_nb], 0, (8-chans_nb) * sizeof(samples->data[0])); - if(link->dst->output_count) - out = link->dst->outputs[0]; + memcpy(ref->data, samples->data, sizeof(ref->data)); + memcpy(ref->linesize, samples->linesize, sizeof(ref->linesize)); - if(out) { - out->out_buf = avfilter_get_video_buffer(out, AV_PERM_WRITE, out->w, out->h); - avfilter_copy_buffer_ref_props(out->out_buf, picref); - avfilter_start_frame(out, avfilter_ref_buffer(out->out_buf, ~0)); + return ref; + +fail: + av_free(buf); + if (ref && ref->audio) + av_free(ref->audio); + av_free(ref); + av_free(samples); + return NULL; +} + +void avfilter_default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) +{ + AVFilterLink *outlink = NULL; + + if (inlink->dst->output_count) + outlink = inlink->dst->outputs[0]; + + if (outlink) { + outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); + avfilter_copy_buffer_ref_props(outlink->out_buf, picref); + avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0)); } } -void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) +void avfilter_default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { - AVFilterLink *out = NULL; + AVFilterLink *outlink = NULL; - if(link->dst->output_count) - out = link->dst->outputs[0]; + if (inlink->dst->output_count) + outlink = inlink->dst->outputs[0]; - if(out) - avfilter_draw_slice(out, y, h, slice_dir); + if (outlink) + avfilter_draw_slice(outlink, y, h, slice_dir); } -void avfilter_default_end_frame(AVFilterLink *link) +void avfilter_default_end_frame(AVFilterLink *inlink) { - AVFilterLink *out = NULL; + AVFilterLink *outlink = NULL; - if(link->dst->output_count) - out = link->dst->outputs[0]; + if (inlink->dst->output_count) + outlink = inlink->dst->outputs[0]; - avfilter_unref_buffer(link->cur_buf); - link->cur_buf = NULL; + avfilter_unref_buffer(inlink->cur_buf); + inlink->cur_buf = NULL; - if(out) { - if(out->out_buf) { - avfilter_unref_buffer(out->out_buf); - out->out_buf = NULL; + if (outlink) { + if (outlink->out_buf) { + avfilter_unref_buffer(outlink->out_buf); + outlink->out_buf = NULL; } - avfilter_end_frame(out); + avfilter_end_frame(outlink); } } +/* FIXME: samplesref is same as link->cur_buf. Need to consider removing the redundant parameter. */ +void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref) +{ + AVFilterLink *outlink = NULL; + + if (inlink->dst->output_count) + outlink = inlink->dst->outputs[0]; + + if (outlink) { + outlink->out_buf = avfilter_default_get_audio_buffer(inlink, AV_PERM_WRITE, samplesref->format, + samplesref->audio->size, + samplesref->audio->channel_layout, + samplesref->audio->planar); + outlink->out_buf->pts = samplesref->pts; + outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate; + avfilter_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0)); + avfilter_unref_buffer(outlink->out_buf); + outlink->out_buf = NULL; + } + avfilter_unref_buffer(samplesref); + inlink->cur_buf = NULL; +} + /** * default config_link() implementation for output video links to simplify * the implementation of one input one output video filters */ int avfilter_default_config_output_link(AVFilterLink *link) { - if(link->src->input_count && link->src->inputs[0]) { - link->w = link->src->inputs[0]->w; - link->h = link->src->inputs[0]->h; + if (link->src->input_count && link->src->inputs[0]) { + if (link->type == AVMEDIA_TYPE_VIDEO) { + link->w = link->src->inputs[0]->w; + link->h = link->src->inputs[0]->h; + link->time_base = link->src->inputs[0]->time_base; + } else if (link->type == AVMEDIA_TYPE_AUDIO) { + link->channel_layout = link->src->inputs[0]->channel_layout; + link->sample_rate = link->src->inputs[0]->sample_rate; + } } else { /* XXX: any non-simple filter which would cause this branch to be taken * really should implement its own config_props() for this link. */ @@ -138,20 +262,20 @@ { int count = 0, i; - for(i = 0; i < ctx->input_count; i ++) { - if(ctx->inputs[i]) { + for (i = 0; i < ctx->input_count; i++) { + if (ctx->inputs[i]) { avfilter_formats_ref(formats, &ctx->inputs[i]->out_formats); - count ++; + count++; } } - for(i = 0; i < ctx->output_count; i ++) { - if(ctx->outputs[i]) { + for (i = 0; i < ctx->output_count; i++) { + if (ctx->outputs[i]) { avfilter_formats_ref(formats, &ctx->outputs[i]->in_formats); - count ++; + count++; } } - if(!count) { + if (!count) { av_free(formats->formats); av_free(formats->refs); av_free(formats); @@ -160,8 +284,8 @@ int avfilter_default_query_formats(AVFilterContext *ctx) { - enum AVMediaType type = ctx->inputs [0] ? ctx->inputs [0]->type : - ctx->outputs[0] ? ctx->outputs[0]->type : + enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type : + ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type : AVMEDIA_TYPE_VIDEO; avfilter_set_common_formats(ctx, avfilter_all_formats(type)); @@ -183,8 +307,21 @@ avfilter_end_frame(link->dst->outputs[0]); } +void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) +{ + avfilter_filter_samples(link->dst->outputs[0], samplesref); +} + AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); } +AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms, + enum SampleFormat sample_fmt, int size, + int64_t channel_layout, int packed) +{ + return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt, + size, channel_layout, packed); +} + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/formats.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/formats.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/formats.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/formats.c 2010-11-06 17:21:29.000000000 +0000 @@ -107,7 +107,8 @@ { AVFilterFormats *ret = NULL; int fmt; - int num_formats = type == AVMEDIA_TYPE_VIDEO ? PIX_FMT_NB : 0; + int num_formats = type == AVMEDIA_TYPE_VIDEO ? PIX_FMT_NB : + type == AVMEDIA_TYPE_AUDIO ? SAMPLE_FMT_NB : 0; for (fmt = 0; fmt < num_formats; fmt++) if ((type != AVMEDIA_TYPE_VIDEO) || diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/graphparser.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/graphparser.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/graphparser.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/graphparser.c 2010-11-06 17:21:29.000000000 +0000 @@ -23,6 +23,7 @@ #include #include +#include "libavutil/avstring.h" #include "graphparser.h" #include "avfilter.h" #include "avfiltergraph.h" @@ -111,7 +112,7 @@ return NULL; } - filt_ctx = avfilter_open(filt, inst_name); + avfilter_open(&filt_ctx, filt, inst_name); if (!filt_ctx) { av_log(log_ctx, AV_LOG_ERROR, "Error creating filter '%s'\n", filt_name); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/internal.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/internal.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/internal.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/internal.h 2010-11-06 17:21:29.000000000 +0000 @@ -26,7 +26,9 @@ #include "avfilter.h" -void ff_dprintf_picref(void *ctx, AVFilterBufferRef *picref, int end); +void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end); + +char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms); void ff_dprintf_link(void *ctx, AVFilterLink *link, int end); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/Makefile chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/Makefile --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/Makefile 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/Makefile 2010-11-06 17:21:29.000000000 +0000 @@ -14,18 +14,35 @@ graphparser.o \ parseutils.o \ +OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o + +OBJS-$(CONFIG_ANULLSRC_FILTER) += asrc_anullsrc.o + +OBJS-$(CONFIG_ANULLSINK_FILTER) += asink_anullsink.o + OBJS-$(CONFIG_ASPECT_FILTER) += vf_aspect.o +OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o OBJS-$(CONFIG_CROP_FILTER) += vf_crop.o +OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o +OBJS-$(CONFIG_DRAWBOX_FILTER) += vf_drawbox.o +OBJS-$(CONFIG_FIFO_FILTER) += vf_fifo.o OBJS-$(CONFIG_FORMAT_FILTER) += vf_format.o +OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o +OBJS-$(CONFIG_HFLIP_FILTER) += vf_hflip.o OBJS-$(CONFIG_NOFORMAT_FILTER) += vf_format.o OBJS-$(CONFIG_NULL_FILTER) += vf_null.o +OBJS-$(CONFIG_OCV_SMOOTH_FILTER) += vf_libopencv.o OBJS-$(CONFIG_PAD_FILTER) += vf_pad.o OBJS-$(CONFIG_PIXDESCTEST_FILTER) += vf_pixdesctest.o OBJS-$(CONFIG_PIXELASPECT_FILTER) += vf_aspect.o OBJS-$(CONFIG_SCALE_FILTER) += vf_scale.o +OBJS-$(CONFIG_SETPTS_FILTER) += vf_setpts.o +OBJS-$(CONFIG_SETTB_FILTER) += vf_settb.o OBJS-$(CONFIG_SLICIFY_FILTER) += vf_slicify.o +OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o OBJS-$(CONFIG_UNSHARP_FILTER) += vf_unsharp.o OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o +OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o OBJS-$(CONFIG_BUFFER_FILTER) += vsrc_buffer.o OBJS-$(CONFIG_COLOR_FILTER) += vf_pad.o @@ -33,4 +50,8 @@ OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o +-include $(SUBDIR)$(ARCH)/Makefile + +DIRS = x86 + include $(SUBDIR)../subdir.mak diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/parseutils.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/parseutils.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/parseutils.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/parseutils.c 2010-11-06 17:21:29.000000000 +0000 @@ -28,42 +28,6 @@ #include "libavutil/random_seed.h" #include "parseutils.h" -#define WHITESPACES " \n\t" - -char *av_get_token(const char **buf, const char *term) -{ - char *out = av_malloc(strlen(*buf) + 1); - char *ret= out, *end= out; - const char *p = *buf; - if (!out) return NULL; - p += strspn(p, WHITESPACES); - - while(*p && !strspn(p, term)) { - char c = *p++; - if(c == '\\' && *p){ - *out++ = *p++; - end= out; - }else if(c == '\''){ - while(*p && *p != '\'') - *out++ = *p++; - if(*p){ - p++; - end= out; - } - }else{ - *out++ = c; - } - } - - do{ - *out-- = 0; - }while(out >= end && strspn(out, WHITESPACES)); - - *buf = p; - - return ret; -} - typedef struct { const char *name; ///< a string representing the name of the color uint8_t rgb_color[3]; ///< RGB values for the color @@ -287,149 +251,14 @@ return 0; } -/** - * Store the value in the field in ctx that is named like key. - * ctx must be an AVClass context, storing is done using AVOptions. - * - * @param buf the string to parse, buf will be updated to point at the - * separator just after the parsed key/value pair - * @param key_val_sep a 0-terminated list of characters used to - * separate key from value - * @param pairs_sep a 0-terminated list of characters used to separate - * two pairs from each other - * @return 0 if the key/value pair has been successfully parsed and - * set, or a negative value corresponding to an AVERROR code in case - * of error: - * AVERROR(EINVAL) if the key/value pair cannot be parsed, - * the error code issued by av_set_string3() if the key/value pair - * cannot be set - */ -static int parse_key_value_pair(void *ctx, const char **buf, - const char *key_val_sep, const char *pairs_sep) -{ - char *key = av_get_token(buf, key_val_sep); - char *val; - int ret; - - if (*key && strspn(*buf, key_val_sep)) { - (*buf)++; - val = av_get_token(buf, pairs_sep); - } else { - av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key); - av_free(key); - return AVERROR(EINVAL); - } - - av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key); - - ret = av_set_string3(ctx, key, val, 1, NULL); - if (ret == AVERROR(ENOENT)) - av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key); - - av_free(key); - av_free(val); - return ret; -} - -int av_set_options_string(void *ctx, const char *opts, - const char *key_val_sep, const char *pairs_sep) -{ - int ret, count = 0; - - while (*opts) { - if ((ret = parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep)) < 0) - return ret; - count++; - - if (*opts) - opts++; - } - - return count; -} - #ifdef TEST #undef printf -typedef struct TestContext -{ - const AVClass *class; - int num; - int toggle; - char *string; - int flags; - AVRational rational; -} TestContext; - -#define OFFSET(x) offsetof(TestContext, x) - -#define TEST_FLAG_COOL 01 -#define TEST_FLAG_LAME 02 -#define TEST_FLAG_MU 04 - -static const AVOption test_options[]= { -{"num", "set num", OFFSET(num), FF_OPT_TYPE_INT, 0, 0, 100 }, -{"toggle", "set toggle", OFFSET(toggle), FF_OPT_TYPE_INT, 0, 0, 1 }, -{"rational", "set rational", OFFSET(rational), FF_OPT_TYPE_RATIONAL, 0, 0, 10 }, -{"string", "set string", OFFSET(string), FF_OPT_TYPE_STRING, 0, CHAR_MIN, CHAR_MAX }, -{"flags", "set flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, 0, 0, INT_MAX, 0, "flags" }, -{"cool", "set cool flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_COOL, INT_MIN, INT_MAX, 0, "flags" }, -{"lame", "set lame flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_LAME, INT_MIN, INT_MAX, 0, "flags" }, -{"mu", "set mu flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_MU, INT_MIN, INT_MAX, 0, "flags" }, -{NULL}, -}; - -static const char *test_get_name(void *ctx) -{ - return "test"; -} - -static const AVClass test_class = { - "TestContext", - test_get_name, - test_options -}; - int main(void) { int i; - const char *strings[] = { - "''", - "", - ":", - "\\", - "'", - " '' :", - " '' '' :", - "foo '' :", - "'foo'", - "foo ", - "foo\\", - "foo': blah:blah", - "foo\\: blah:blah", - "foo\'", - "'foo : ' :blahblah", - "\\ :blah", - " foo", - " foo ", - " foo \\ ", - "foo ':blah", - " foo bar : blahblah", - "\\f\\o\\o", - "'foo : \\ \\ ' : blahblah", - "'\\fo\\o:': blahblah", - "\\'fo\\o\\:': foo ' :blahblah" - }; - - for (i=0; i < FF_ARRAY_ELEMS(strings); i++) { - const char *p= strings[i]; - printf("|%s|", p); - printf(" -> |%s|", av_get_token(&p, ":")); - printf(" + |%s|\n", p); - } - printf("\nTesting av_parse_color()\n"); { uint8_t rgba[4]; @@ -476,45 +305,6 @@ } } - printf("\nTesting av_set_options_string()\n"); - { - TestContext test_ctx; - const char *options[] = { - "", - ":", - "=", - "foo=:", - ":=foo", - "=foo", - "foo=", - "foo", - "foo=val", - "foo==val", - "toggle=:", - "string=:", - "toggle=1 : foo", - "toggle=100", - "toggle==1", - "flags=+mu-lame : num=42: toggle=0", - "num=42 : string=blahblah", - "rational=0 : rational=1/2 : rational=1/-1", - "rational=-1/0", - }; - - test_ctx.class = &test_class; - av_opt_set_defaults2(&test_ctx, 0, 0); - test_ctx.string = av_strdup("default"); - - av_log_set_level(AV_LOG_DEBUG); - - for (i=0; i < FF_ARRAY_ELEMS(options); i++) { - av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]); - if (av_set_options_string(&test_ctx, options[i], "=", ":") < 0) - av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]); - printf("\n"); - } - } - return 0; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/parseutils.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/parseutils.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/parseutils.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/parseutils.h 2010-11-06 17:21:29.000000000 +0000 @@ -25,22 +25,7 @@ #ifndef AVFILTER_PARSEUTILS_H #define AVFILTER_PARSEUTILS_H -#include "libavcodec/opt.h" - -/** - * Unescape the given string until a non escaped terminating char, - * and return the token corresponding to the unescaped string. - * - * The normal \ and ' escaping is supported. Leading and trailing - * whitespaces are removed. - * - * @param buf the buffer to parse, buf will be updated to point to the - * terminating char - * @param term a 0-terminated list of terminating chars - * @return the malloced unescaped string, which must be av_freed by - * the user, NULL in case of allocation failure - */ -char *av_get_token(const char **buf, const char *term); +#include "libavutil/opt.h" /** * Put the RGBA values that correspond to color_string in rgba_color. @@ -61,23 +46,4 @@ */ int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx); -/** - * Parse the key/value pairs list in opts. For each key/value pair - * found, stores the value in the field in ctx that is named like the - * key. ctx must be an AVClass context, storing is done using - * AVOptions. - * - * @param key_val_sep a 0-terminated list of characters used to - * separate key from value - * @param pairs_sep a 0-terminated list of characters used to separate - * two pairs from each other - * @return the number of successfully set key/value pairs, or a negative - * value corresponding to an AVERROR code in case of error: - * AVERROR(EINVAL) if opts cannot be parsed, - * the error code issued by av_set_string3() if a key/value pair - * cannot be set - */ -int av_set_options_string(void *ctx, const char *opts, - const char *key_val_sep, const char *pairs_sep); - #endif /* AVFILTER_PARSEUTILS_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_aspect.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_aspect.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_aspect.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_aspect.c 2010-11-06 17:21:29.000000000 +0000 @@ -60,7 +60,7 @@ { AspectContext *aspect = link->dst->priv; - picref->pixel_aspect = aspect->aspect; + picref->video->pixel_aspect = aspect->aspect; avfilter_start_frame(link->dst->outputs[0], picref); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_blackframe.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_blackframe.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_blackframe.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_blackframe.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2010 Stefano Sabatini + * Copyright (C) 2006 Ivo van Poorten + * Copyright (C) 2006 Julian Hall + * Copyright (C) 2002-2003 Brian J. Murrell + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + * @file + * Search for black frames to detect scene transitions. + * Ported from MPlayer libmpcodecs/vf_blackframe.c. + */ + +#include "avfilter.h" + +typedef struct { + unsigned int bamount; ///< black amount + unsigned int bthresh; ///< black threshold + unsigned int frame; ///< frame number + unsigned int nblack; ///< number of black pixels counted so far +} BlackFrameContext; + +static int query_formats(AVFilterContext *ctx) +{ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_YUV410P, PIX_FMT_YUV420P, PIX_FMT_GRAY8, PIX_FMT_NV12, + PIX_FMT_NV21, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, + PIX_FMT_NONE + }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + BlackFrameContext *blackframe = ctx->priv; + + blackframe->bamount = 98; + blackframe->bthresh = 32; + blackframe->nblack = 0; + blackframe->frame = 0; + + if (args) + sscanf(args, "%u:%u", &blackframe->bamount, &blackframe->bthresh); + + av_log(ctx, AV_LOG_INFO, "bamount:%u bthresh:%u\n", + blackframe->bamount, blackframe->bthresh); + + if (blackframe->bamount > 100 || blackframe->bthresh > 255) { + av_log(ctx, AV_LOG_ERROR, "Too big value for bamount (max is 100) or bthresh (max is 255)\n"); + return AVERROR(EINVAL); + } + + return 0; +} + +static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) +{ + AVFilterContext *ctx = inlink->dst; + BlackFrameContext *blackframe = ctx->priv; + AVFilterBufferRef *picref = inlink->cur_buf; + int x, i; + uint8_t *p = picref->data[0] + y * picref->linesize[0]; + + for (i = 0; i < h; i++) { + for (x = 0; x < inlink->w; x++) + blackframe->nblack += p[x] < blackframe->bthresh; + p += picref->linesize[0]; + } + + avfilter_draw_slice(ctx->outputs[0], y, h, slice_dir); +} + +static void end_frame(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->dst; + BlackFrameContext *blackframe = ctx->priv; + AVFilterBufferRef *picref = inlink->cur_buf; + int pblack = 0; + + pblack = blackframe->nblack * 100 / (inlink->w * inlink->h); + if (pblack >= blackframe->bamount) + av_log(ctx, AV_LOG_INFO, "frame:%u pblack:%u pos:%"PRId64" pts:%"PRId64" t:%f\n", + blackframe->frame, pblack, picref->pos, picref->pts, + picref->pts == AV_NOPTS_VALUE ? -1 : picref->pts * av_q2d(inlink->time_base)); + + blackframe->frame++; + blackframe->nblack = 0; + avfilter_end_frame(inlink->dst->outputs[0]); +} + +AVFilter avfilter_vf_blackframe = { + .name = "blackframe", + .description = NULL_IF_CONFIG_SMALL("Detect frames that are (almost) black."), + + .priv_size = sizeof(BlackFrameContext), + .init = init, + + .query_formats = query_formats, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .draw_slice = draw_slice, + .get_video_buffer = avfilter_null_get_video_buffer, + .start_frame = avfilter_null_start_frame, + .end_frame = end_frame, }, + { .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_crop.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_crop.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_crop.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_crop.c 2010-11-06 17:21:29.000000000 +0000 @@ -24,7 +24,42 @@ */ #include "avfilter.h" -#include "libavutil/pixdesc.h" +#include "libavutil/eval.h" +#include "libavutil/avstring.h" +#include "libavutil/libm.h" +#include "libavcore/imgutils.h" + +static const char *var_names[] = { + "E", + "PHI", + "PI", + "in_w", "iw", ///< width of the input video + "in_h", "ih", ///< height of the input video + "out_w", "ow", ///< width of the cropped video + "out_h", "oh", ///< height of the cropped video + "x", + "y", + "n", ///< number of frame + "pos", ///< position in the file + "t", ///< timestamp expressed in seconds + NULL +}; + +enum var_name { + VAR_E, + VAR_PHI, + VAR_PI, + VAR_IN_W, VAR_IW, + VAR_IN_H, VAR_IH, + VAR_OUT_W, VAR_OW, + VAR_OUT_H, VAR_OH, + VAR_X, + VAR_Y, + VAR_N, + VAR_POS, + VAR_T, + VAR_VARS_NB +}; typedef struct { int x; ///< x offset of the non-cropped area with respect to the input area @@ -34,6 +69,9 @@ int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes int hsub, vsub; ///< chroma subsampling + char x_expr[256], y_expr[256], ow_expr[256], oh_expr[256]; + AVExpr *x_pexpr, *y_pexpr; /* parsed expressions for x and y */ + double var_values[VAR_VARS_NB]; } CropContext; static int query_formats(AVFilterContext *ctx) @@ -72,51 +110,114 @@ { CropContext *crop = ctx->priv; + av_strlcpy(crop->ow_expr, "iw", sizeof(crop->ow_expr)); + av_strlcpy(crop->oh_expr, "ih", sizeof(crop->oh_expr)); + av_strlcpy(crop->x_expr, "(in_w-out_w)/2", sizeof(crop->x_expr)); + av_strlcpy(crop->y_expr, "(in_h-out_h)/2", sizeof(crop->y_expr)); + if (args) - sscanf(args, "%d:%d:%d:%d", &crop->x, &crop->y, &crop->w, &crop->h); + sscanf(args, "%255[^:]:%255[^:]:%255[^:]:%255[^:]", crop->ow_expr, crop->oh_expr, crop->x_expr, crop->y_expr); return 0; } +static av_cold void uninit(AVFilterContext *ctx) +{ + CropContext *crop = ctx->priv; + + av_free_expr(crop->x_pexpr); crop->x_pexpr = NULL; + av_free_expr(crop->y_pexpr); crop->y_pexpr = NULL; +} + +static inline int normalize_double(int *n, double d) +{ + int ret = 0; + + if (isnan(d)) { + ret = AVERROR(EINVAL); + } else if (d > INT_MAX || d < INT_MIN) { + *n = d > INT_MAX ? INT_MAX : INT_MIN; + ret = AVERROR(EINVAL); + } else + *n = round(d); + + return ret; +} + static int config_input(AVFilterLink *link) { AVFilterContext *ctx = link->dst; CropContext *crop = ctx->priv; const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[link->format]; - int i; - - memset(crop->max_step, 0, sizeof(crop->max_step)); - for (i = 0; i < 4; i++) { - const AVComponentDescriptor *comp = &(pix_desc->comp[i]); - if ((comp->step_minus1+1) > crop->max_step[comp->plane]) - crop->max_step[comp->plane] = comp->step_minus1+1; - } + int ret; + const char *expr; + double res; + + crop->var_values[VAR_E] = M_E; + crop->var_values[VAR_PHI] = M_PHI; + crop->var_values[VAR_PI] = M_PI; + crop->var_values[VAR_IN_W] = crop->var_values[VAR_IW] = ctx->inputs[0]->w; + crop->var_values[VAR_IN_H] = crop->var_values[VAR_IH] = ctx->inputs[0]->h; + crop->var_values[VAR_X] = NAN; + crop->var_values[VAR_Y] = NAN; + crop->var_values[VAR_OUT_W] = crop->var_values[VAR_OW] = NAN; + crop->var_values[VAR_OUT_H] = crop->var_values[VAR_OH] = NAN; + crop->var_values[VAR_N] = 0; + crop->var_values[VAR_T] = NAN; + crop->var_values[VAR_POS] = NAN; + av_image_fill_max_pixsteps(crop->max_step, NULL, pix_desc); crop->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w; crop->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; - if (crop->w == 0) - crop->w = link->w - crop->x; - if (crop->h == 0) - crop->h = link->h - crop->y; - - crop->x &= ~((1 << crop->hsub) - 1); - crop->y &= ~((1 << crop->vsub) - 1); + if ((ret = av_parse_and_eval_expr(&res, (expr = crop->ow_expr), + var_names, crop->var_values, + NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) goto fail_expr; + crop->var_values[VAR_OUT_W] = crop->var_values[VAR_OW] = res; + if ((ret = av_parse_and_eval_expr(&res, (expr = crop->oh_expr), + var_names, crop->var_values, + NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) goto fail_expr; + crop->var_values[VAR_OUT_H] = crop->var_values[VAR_OH] = res; + /* evaluate again ow as it may depend on oh */ + if ((ret = av_parse_and_eval_expr(&res, (expr = crop->ow_expr), + var_names, crop->var_values, + NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) goto fail_expr; + crop->var_values[VAR_OUT_W] = crop->var_values[VAR_OW] = res; + if (normalize_double(&crop->w, crop->var_values[VAR_OUT_W]) < 0 || + normalize_double(&crop->h, crop->var_values[VAR_OUT_H]) < 0) { + av_log(ctx, AV_LOG_ERROR, + "Too big value or invalid expression for out_w/ow or out_h/oh. " + "Maybe the expression for out_w:'%s' or for out_h:'%s' is self-referencing.\n", + crop->ow_expr, crop->oh_expr); + return AVERROR(EINVAL); + } + crop->w &= ~((1 << crop->hsub) - 1); + crop->h &= ~((1 << crop->vsub) - 1); - av_log(link->dst, AV_LOG_INFO, "x:%d y:%d w:%d h:%d\n", - crop->x, crop->y, crop->w, crop->h); + if ((ret = av_parse_expr(&crop->x_pexpr, crop->x_expr, var_names, + NULL, NULL, NULL, NULL, 0, ctx)) < 0 || + (ret = av_parse_expr(&crop->y_pexpr, crop->y_expr, var_names, + NULL, NULL, NULL, NULL, 0, ctx)) < 0) + return AVERROR(EINVAL); - if (crop->x < 0 || crop->y < 0 || - crop->w <= 0 || crop->h <= 0 || - (unsigned)crop->x + (unsigned)crop->w > link->w || - (unsigned)crop->y + (unsigned)crop->h > link->h) { + if (crop->w <= 0 || crop->h <= 0 || + crop->w > link->w || crop->h > link->h) { av_log(ctx, AV_LOG_ERROR, - "Output area %d:%d:%d:%d not within the input area 0:0:%d:%d or zero-sized\n", - crop->x, crop->y, crop->w, crop->h, link->w, link->h); + "Invalid too big or non positive size for width '%d' or height '%d'\n", + crop->w, crop->h); return AVERROR(EINVAL); } + /* set default, required in the case the first computed value for x/y is NAN */ + crop->x = (link->w - crop->w) / 2; + crop->y = (link->h - crop->h) / 2; + crop->x &= ~((1 << crop->hsub) - 1); + crop->y &= ~((1 << crop->vsub) - 1); return 0; + +fail_expr: + av_log(NULL, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", expr); + return ret; } static int config_output(AVFilterLink *link) @@ -131,15 +232,37 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) { - CropContext *crop = link->dst->priv; + AVFilterContext *ctx = link->dst; + CropContext *crop = ctx->priv; AVFilterBufferRef *ref2 = avfilter_ref_buffer(picref, ~0); int i; - ref2->w = crop->w; - ref2->h = crop->h; + picref->video->w = crop->w; + picref->video->h = crop->h; + + crop->var_values[VAR_T] = picref->pts == AV_NOPTS_VALUE ? + NAN : picref->pts * av_q2d(link->time_base); + crop->var_values[VAR_POS] = picref->pos == -1 ? NAN : picref->pos; + crop->var_values[VAR_X] = av_eval_expr(crop->x_pexpr, crop->var_values, NULL); + crop->var_values[VAR_Y] = av_eval_expr(crop->y_pexpr, crop->var_values, NULL); + crop->var_values[VAR_X] = av_eval_expr(crop->x_pexpr, crop->var_values, NULL); + + normalize_double(&crop->x, crop->var_values[VAR_X]); + normalize_double(&crop->y, crop->var_values[VAR_Y]); + + if (crop->x < 0) crop->x = 0; + if (crop->y < 0) crop->y = 0; + if ((unsigned)crop->x + (unsigned)crop->w > link->w) crop->x = link->w - crop->w; + if ((unsigned)crop->y + (unsigned)crop->h > link->h) crop->y = link->h - crop->h; + crop->x &= ~((1 << crop->hsub) - 1); + crop->y &= ~((1 << crop->vsub) - 1); + + av_log(ctx, AV_LOG_DEBUG, + "n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n", + (int)crop->var_values[VAR_N], crop->var_values[VAR_T], crop->x, crop->y, crop->x+crop->w, crop->y+crop->h); ref2->data[0] += crop->y * ref2->linesize[0]; - ref2->data[0] += (crop->x * crop->max_step[0]); + ref2->data[0] += crop->x * crop->max_step[0]; if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL)) { for (i = 1; i < 3; i ++) { @@ -153,7 +276,7 @@ /* alpha plane */ if (ref2->data[3]) { ref2->data[3] += crop->y * ref2->linesize[3]; - ref2->data[3] += (crop->x * crop->max_step[3]); + ref2->data[3] += crop->x * crop->max_step[3]; } avfilter_start_frame(link->dst->outputs[0], ref2); @@ -177,19 +300,30 @@ avfilter_draw_slice(ctx->outputs[0], y - crop->y, h, slice_dir); } +static void end_frame(AVFilterLink *link) +{ + CropContext *crop = link->dst->priv; + + crop->var_values[VAR_N] += 1.0; + avfilter_unref_buffer(link->cur_buf); + avfilter_end_frame(link->dst->outputs[0]); +} + AVFilter avfilter_vf_crop = { .name = "crop", - .description = NULL_IF_CONFIG_SMALL("Crop the input video to x:y:width:height."), + .description = NULL_IF_CONFIG_SMALL("Crop the input video to width:height:x:y."), .priv_size = sizeof(CropContext), .query_formats = query_formats, .init = init, + .uninit = uninit, .inputs = (AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .start_frame = start_frame, .draw_slice = draw_slice, + .end_frame = end_frame, .get_video_buffer = avfilter_null_get_video_buffer, .config_props = config_input, }, { .name = NULL}}, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_cropdetect.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_cropdetect.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_cropdetect.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_cropdetect.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,214 @@ +/* + * Copyright (C) 2002 A'rpi + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + * @file + * border detection filter + * Ported from MPlayer libmpcodecs/vf_cropdetect.c. + */ + +#include "libavcore/imgutils.h" +#include "avfilter.h" + +typedef struct { + int x1, y1, x2, y2; + int limit; + int round; + int reset_count; + int frame_nb; + int max_pixsteps[4]; +} CropDetectContext; + +static int query_formats(AVFilterContext *ctx) +{ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_YUV420P, PIX_FMT_YUVJ420P, + PIX_FMT_YUV422P, PIX_FMT_YUVJ422P, + PIX_FMT_YUV444P, PIX_FMT_YUVJ444P, + PIX_FMT_YUV411P, PIX_FMT_GRAY8, + PIX_FMT_NV12, PIX_FMT_NV21, + PIX_FMT_NONE + }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int checkline(void *ctx, const unsigned char *src, int stride, int len, int bpp) +{ + int total = 0; + int div = len; + + switch (bpp) { + case 1: + while (--len >= 0) { + total += src[0]; + src += stride; + } + break; + case 3: + case 4: + while (--len >= 0) { + total += src[0] + src[1] + src[2]; + src += stride; + } + div *= 3; + break; + } + total /= div; + + av_log(ctx, AV_LOG_DEBUG, "total:%d\n", total); + return total; +} + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + CropDetectContext *cd = ctx->priv; + + cd->limit = 24; + cd->round = 0; + cd->reset_count = 0; + cd->frame_nb = -2; + + if (args) + sscanf(args, "%d:%d:%d", &cd->limit, &cd->round, &cd->reset_count); + + av_log(ctx, AV_LOG_INFO, "limit:%d round:%d reset_count:%d\n", + cd->limit, cd->round, cd->reset_count); + + return 0; +} + +static int config_input(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->dst; + CropDetectContext *cd = ctx->priv; + + av_image_fill_max_pixsteps(cd->max_pixsteps, NULL, + &av_pix_fmt_descriptors[inlink->format]); + + cd->x1 = inlink->w - 1; + cd->y1 = inlink->h - 1; + cd->x2 = 0; + cd->y2 = 0; + + return 0; +} + +static void end_frame(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->dst; + CropDetectContext *cd = ctx->priv; + AVFilterBufferRef *picref = inlink->cur_buf; + int bpp = cd->max_pixsteps[0]; + int w, h, x, y, shrink_by; + + // ignore first 2 frames - they may be empty + if (++cd->frame_nb > 0) { + // Reset the crop area every reset_count frames, if reset_count is > 0 + if (cd->reset_count > 0 && cd->frame_nb > cd->reset_count) { + cd->x1 = picref->video->w-1; + cd->y1 = picref->video->h-1; + cd->x2 = 0; + cd->y2 = 0; + cd->frame_nb = 1; + } + + for (y = 0; y < cd->y1; y++) { + if (checkline(ctx, picref->data[0] + picref->linesize[0] * y, bpp, picref->video->w, bpp) > cd->limit) { + cd->y1 = y; + break; + } + } + + for (y = picref->video->h-1; y > cd->y2; y--) { + if (checkline(ctx, picref->data[0] + picref->linesize[0] * y, bpp, picref->video->w, bpp) > cd->limit) { + cd->y2 = y; + break; + } + } + + for (y = 0; y < cd->x1; y++) { + if (checkline(ctx, picref->data[0] + bpp*y, picref->linesize[0], picref->video->h, bpp) > cd->limit) { + cd->x1 = y; + break; + } + } + + for (y = picref->video->w-1; y > cd->x2; y--) { + if (checkline(ctx, picref->data[0] + bpp*y, picref->linesize[0], picref->video->h, bpp) > cd->limit) { + cd->x2 = y; + break; + } + } + + // round x and y (up), important for yuv colorspaces + // make sure they stay rounded! + x = (cd->x1+1) & ~1; + y = (cd->y1+1) & ~1; + + w = cd->x2 - x + 1; + h = cd->y2 - y + 1; + + // w and h must be divisible by 2 as well because of yuv + // colorspace problems. + if (cd->round <= 1) + cd->round = 16; + if (cd->round % 2) + cd->round *= 2; + + shrink_by = w % cd->round; + w -= shrink_by; + x += (shrink_by/2 + 1) & ~1; + + shrink_by = h % cd->round; + h -= shrink_by; + y += (shrink_by/2 + 1) & ~1; + + av_log(ctx, AV_LOG_INFO, + "x1:%d x2:%d y1:%d y2:%d w:%d h:%d x:%d y:%d pos:%"PRId64" pts:%"PRId64" t:%f crop=%d:%d:%d:%d\n", + cd->x1, cd->x2, cd->y1, cd->y2, w, h, x, y, picref->pos, picref->pts, + picref->pts == AV_NOPTS_VALUE ? -1 : picref->pts * av_q2d(inlink->time_base), + w, h, x, y); + } + + avfilter_end_frame(inlink->dst->outputs[0]); +} + +AVFilter avfilter_vf_cropdetect = { + .name = "cropdetect", + .description = NULL_IF_CONFIG_SMALL("Auto-detect crop size."), + + .priv_size = sizeof(CropDetectContext), + .init = init, + + .query_formats = query_formats, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = config_input, + .get_video_buffer = avfilter_null_get_video_buffer, + .start_frame = avfilter_null_start_frame, + .end_frame = end_frame, }, + { .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_drawbox.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_drawbox.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_drawbox.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_drawbox.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2008 Affine Systems, Inc (Michael Sullivan, Bobby Impollonia) + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Box drawing filter. Also a nice template for a filter that needs to + * write in the input frame. + */ + +#include "libavutil/colorspace.h" +#include "libavutil/pixdesc.h" +#include "avfilter.h" +#include "parseutils.h" + +enum { Y, U, V, A }; + +typedef struct { + int x, y, w, h; + unsigned char yuv_color[4]; + int vsub, hsub; //< chroma subsampling +} DrawBoxContext; + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + DrawBoxContext *drawbox= ctx->priv; + char color_str[1024] = "black"; + uint8_t rgba_color[4]; + + drawbox->x = drawbox->y = drawbox->w = drawbox->h = 0; + + if (args) + sscanf(args, "%d:%d:%d:%d:%s", + &drawbox->x, &drawbox->y, &drawbox->w, &drawbox->h, color_str); + + if (av_parse_color(rgba_color, color_str, ctx) < 0) + return AVERROR(EINVAL); + + drawbox->yuv_color[Y] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]); + drawbox->yuv_color[U] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); + drawbox->yuv_color[V] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); + drawbox->yuv_color[A] = rgba_color[3]; + + return 0; +} + +static int query_formats(AVFilterContext *ctx) +{ + enum PixelFormat pix_fmts[] = { + PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, + PIX_FMT_YUV411P, PIX_FMT_YUV410P, + PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P, + PIX_FMT_YUV440P, PIX_FMT_YUVJ440P, + PIX_FMT_NONE + }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int config_input(AVFilterLink *inlink) +{ + DrawBoxContext *drawbox = inlink->dst->priv; + + drawbox->hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w; + drawbox->vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h; + + if (drawbox->w == 0) drawbox->w = inlink->w; + if (drawbox->h == 0) drawbox->h = inlink->h; + + av_log(inlink->dst, AV_LOG_INFO, "x:%d y:%d w:%d h:%d color:0x%02X%02X%02X%02X\n", + drawbox->w, drawbox->y, drawbox->w, drawbox->h, + drawbox->yuv_color[Y], drawbox->yuv_color[U], drawbox->yuv_color[V], drawbox->yuv_color[A]); + + return 0; +} + +static void draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir) +{ + DrawBoxContext *drawbox = inlink->dst->priv; + int plane, x, y, xb = drawbox->x, yb = drawbox->y; + unsigned char *row[4]; + AVFilterBufferRef *picref = inlink->cur_buf; + + for (y = FFMAX(yb, y0); y < (y0 + h) && y < (yb + drawbox->h); y++) { + row[0] = picref->data[0] + y * picref->linesize[0]; + + for (plane = 1; plane < 3; plane++) + row[plane] = picref->data[plane] + + picref->linesize[plane] * (y >> drawbox->vsub); + + for (x = FFMAX(xb, 0); x < (xb + drawbox->w) && x < picref->video->w; x++) { + double alpha = (double)drawbox->yuv_color[A] / 255; + + if ((y - yb < 3) || (yb + drawbox->h - y < 4) || + (x - xb < 3) || (xb + drawbox->w - x < 4)) { + row[0][x ] = (1 - alpha) * row[0][x ] + alpha * drawbox->yuv_color[Y]; + row[1][x >> drawbox->hsub] = (1 - alpha) * row[1][x >> drawbox->hsub] + alpha * drawbox->yuv_color[U]; + row[2][x >> drawbox->hsub] = (1 - alpha) * row[2][x >> drawbox->hsub] + alpha * drawbox->yuv_color[V]; + } + } + } + + avfilter_draw_slice(inlink->dst->outputs[0], y0, h, 1); +} + +AVFilter avfilter_vf_drawbox = { + .name = "drawbox", + .description = NULL_IF_CONFIG_SMALL("Draw a colored box on the input video."), + .priv_size = sizeof(DrawBoxContext), + .init = init, + + .query_formats = query_formats, + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = config_input, + .get_video_buffer = avfilter_null_get_video_buffer, + .start_frame = avfilter_null_start_frame, + .draw_slice = draw_slice, + .end_frame = avfilter_null_end_frame, + .min_perms = AV_PERM_WRITE | AV_PERM_READ, + .rej_perms = AV_PERM_PRESERVE }, + { .name = NULL}}, + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_fifo.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_fifo.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_fifo.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_fifo.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,119 @@ +/* + * copyright (c) 2007 Bobby Bingham + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * FIFO buffering video filter + */ + +#include "avfilter.h" + +typedef struct BufPic { + AVFilterBufferRef *picref; + struct BufPic *next; +} BufPic; + +typedef struct { + BufPic root; + BufPic *last; ///< last buffered picture +} FifoContext; + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + FifoContext *fifo = ctx->priv; + fifo->last = &fifo->root; + + av_log(ctx, AV_LOG_INFO, "\n"); + return 0; +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + FifoContext *fifo = ctx->priv; + BufPic *pic, *tmp; + + for (pic = fifo->root.next; pic; pic = tmp) { + tmp = pic->next; + avfilter_unref_buffer(pic->picref); + av_free(pic); + } +} + +static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) +{ + FifoContext *fifo = inlink->dst->priv; + + fifo->last->next = av_mallocz(sizeof(BufPic)); + fifo->last = fifo->last->next; + fifo->last->picref = picref; +} + +static void end_frame(AVFilterLink *inlink) { } + +static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { } + +static int request_frame(AVFilterLink *outlink) +{ + FifoContext *fifo = outlink->src->priv; + BufPic *tmp; + int ret; + + if (!fifo->root.next) { + if ((ret = avfilter_request_frame(outlink->src->inputs[0]) < 0)) + return ret; + } + + /* by doing this, we give ownership of the reference to the next filter, + * so we don't have to worry about dereferencing it ourselves. */ + avfilter_start_frame(outlink, fifo->root.next->picref); + avfilter_draw_slice (outlink, 0, outlink->h, 1); + avfilter_end_frame (outlink); + + if (fifo->last == fifo->root.next) + fifo->last = &fifo->root; + tmp = fifo->root.next->next; + av_free(fifo->root.next); + fifo->root.next = tmp; + + return 0; +} + +AVFilter avfilter_vf_fifo = { + .name = "fifo", + .description = NULL_IF_CONFIG_SMALL("Buffer input images and send them when they are requested."), + + .init = init, + .uninit = uninit, + + .priv_size = sizeof(FifoContext), + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .get_video_buffer= avfilter_null_get_video_buffer, + .start_frame = start_frame, + .draw_slice = draw_slice, + .end_frame = end_frame, + .rej_perms = AV_PERM_REUSE2, }, + { .name = NULL}}, + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .request_frame = request_frame, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_format.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_format.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_format.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_format.c 2010-11-06 17:21:29.000000000 +0000 @@ -94,7 +94,7 @@ AVFilter avfilter_vf_format = { .name = "format", - .description = "Convert the input video to one of the specified pixel formats.", + .description = NULL_IF_CONFIG_SMALL("Convert the input video to one of the specified pixel formats."), .init = init, @@ -124,7 +124,7 @@ AVFilter avfilter_vf_noformat = { .name = "noformat", - .description = "Force libavfilter not to use any of the specified pixel formats for the input to the next filter.", + .description = NULL_IF_CONFIG_SMALL("Force libavfilter not to use any of the specified pixel formats for the input to the next filter."), .init = init, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_frei0r.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_frei0r.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_frei0r.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_frei0r.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,363 @@ +/* + * copyright (c) 2010 Stefano Sabatini + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * frei0r wrapper + */ + +/* #define DEBUG */ + +#include +#include +#include "libavutil/avstring.h" +#include "avfilter.h" +#include "parseutils.h" + +typedef f0r_instance_t (*f0r_construct_f)(unsigned int width, unsigned int height); +typedef void (*f0r_destruct_f)(f0r_instance_t instance); +typedef void (*f0r_deinit_f)(void); +typedef int (*f0r_init_f)(void); +typedef void (*f0r_get_plugin_info_f)(f0r_plugin_info_t *info); +typedef void (*f0r_get_param_info_f)(f0r_param_info_t *info, int param_index); +typedef void (*f0r_update_f)(f0r_instance_t instance, double time, const uint32_t *inframe, uint32_t *outframe); +typedef void (*f0r_update2_f)(f0r_instance_t instance, double time, const uint32_t *inframe1, const uint32_t *inframe2, const uint32_t *inframe3, uint32_t *outframe); +typedef void (*f0r_set_param_value_f)(f0r_instance_t instance, f0r_param_t param, int param_index); +typedef void (*f0r_get_param_value_f)(f0r_instance_t instance, f0r_param_t param, int param_index); + +typedef struct Frei0rContext { + f0r_update_f update; + void *dl_handle; /* dynamic library handle */ + f0r_instance_t instance; + f0r_plugin_info_t plugin_info; + + f0r_get_param_info_f get_param_info; + f0r_get_param_value_f get_param_value; + f0r_set_param_value_f set_param_value; + f0r_construct_f construct; + f0r_destruct_f destruct; + f0r_deinit_f deinit; + char params[256]; +} Frei0rContext; + +static void *load_sym(AVFilterContext *ctx, const char *sym_name) +{ + Frei0rContext *frei0r = ctx->priv; + void *sym = dlsym(frei0r->dl_handle, sym_name); + if (!sym) + av_log(ctx, AV_LOG_ERROR, "Could not find symbol '%s' in loaded module\n", sym_name); + return sym; +} + +static int set_param(AVFilterContext *ctx, f0r_param_info_t info, int index, char *param) +{ + Frei0rContext *frei0r = ctx->priv; + union { + double d; + f0r_param_color_t col; + f0r_param_position_t pos; + } val; + char *tail; + uint8_t rgba[4]; + + switch (info.type) { + case F0R_PARAM_BOOL: + if (!strcmp(param, "y")) val.d = 1.0; + else if (!strcmp(param, "n")) val.d = 0.0; + else goto fail; + break; + + case F0R_PARAM_DOUBLE: + val.d = strtod(param, &tail); + if (*tail || val.d == HUGE_VAL) + goto fail; + break; + + case F0R_PARAM_COLOR: + if (sscanf(param, "%f/%f/%f", &val.col.r, &val.col.g, &val.col.b) != 3) { + if (av_parse_color(rgba, param, ctx) < 0) + goto fail; + val.col.r = rgba[0] / 255.0; + val.col.g = rgba[1] / 255.0; + val.col.b = rgba[2] / 255.0; + } + break; + + case F0R_PARAM_POSITION: + if (sscanf(param, "%lf/%lf", &val.pos.x, &val.pos.y) != 2) + goto fail; + break; + } + + frei0r->set_param_value(frei0r->instance, &val, index); + return 0; + +fail: + av_log(ctx, AV_LOG_ERROR, "Invalid value '%s' for parameter '%s'\n", + param, info.name); + return AVERROR(EINVAL); +} + +static int set_params(AVFilterContext *ctx, const char *params) +{ + Frei0rContext *frei0r = ctx->priv; + int i; + + for (i = 0; i < frei0r->plugin_info.num_params; i++) { + f0r_param_info_t info; + char *param; + int ret; + + frei0r->get_param_info(&info, i); + + if (*params) { + if (!(param = av_get_token(¶ms, ":"))) + return AVERROR(ENOMEM); + params++; /* skip ':' */ + ret = set_param(ctx, info, i, param); + av_free(param); + if (ret < 0) + return ret; + } + + av_log(ctx, AV_LOG_INFO, + "idx:%d name:'%s' type:%s explanation:'%s' ", + i, info.name, + info.type == F0R_PARAM_BOOL ? "bool" : + info.type == F0R_PARAM_DOUBLE ? "double" : + info.type == F0R_PARAM_COLOR ? "color" : + info.type == F0R_PARAM_POSITION ? "position" : + info.type == F0R_PARAM_STRING ? "string" : "unknown", + info.explanation); + +#ifdef DEBUG + av_log(ctx, AV_LOG_INFO, "value:"); + switch (info.type) { + void *v; + double d; + char s[128]; + f0r_param_color_t col; + f0r_param_position_t pos; + + case F0R_PARAM_BOOL: + v = &d; + frei0r->get_param_value(frei0r->instance, v, i); + av_log(ctx, AV_LOG_INFO, "%s", d >= 0.5 && d <= 1.0 ? "y" : "n"); + break; + case F0R_PARAM_DOUBLE: + v = &d; + frei0r->get_param_value(frei0r->instance, v, i); + av_log(ctx, AV_LOG_INFO, "%f", d); + break; + case F0R_PARAM_COLOR: + v = &col; + frei0r->get_param_value(frei0r->instance, v, i); + av_log(ctx, AV_LOG_INFO, "%f/%f/%f", col.r, col.g, col.b); + break; + case F0R_PARAM_POSITION: + v = &pos; + frei0r->get_param_value(frei0r->instance, v, i); + av_log(ctx, AV_LOG_INFO, "%lf/%lf", pos.x, pos.y); + break; + default: /* F0R_PARAM_STRING */ + v = s; + frei0r->get_param_value(frei0r->instance, v, i); + av_log(ctx, AV_LOG_INFO, "'%s'\n", s); + break; + } +#endif + av_log(ctx, AV_LOG_INFO, "\n"); + } + + return 0; +} + +static void *load_path(AVFilterContext *ctx, const char *prefix, const char *name) +{ + char path[1024]; + + snprintf(path, sizeof(path), "%s%s%s", prefix, name, SLIBSUF); + av_log(ctx, AV_LOG_DEBUG, "Looking for frei0r effect in '%s'\n", path); + return dlopen(path, RTLD_NOW|RTLD_LOCAL); +} + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + Frei0rContext *frei0r = ctx->priv; + f0r_init_f f0r_init; + f0r_get_plugin_info_f f0r_get_plugin_info; + f0r_plugin_info_t *pi; + char dl_name[1024], *path; + + *frei0r->params = 0; + + if (args) + sscanf(args, "%1023[^:]:%255c", dl_name, frei0r->params); + + /* see: http://piksel.org/frei0r/1.2/spec/1.2/spec/group__pluglocations.html */ + if ((path = av_strdup(getenv("FREI0R_PATH")))) { + char *p, *ptr = NULL; + for (p = path; p = strtok_r(p, ":", &ptr); p = NULL) + if (frei0r->dl_handle = load_path(ctx, p, dl_name)) + break; + av_free(path); + } + if (!frei0r->dl_handle && (path = getenv("HOME"))) { + char prefix[1024]; + snprintf(prefix, sizeof(prefix), "%s/.frei0r-1/lib/", path); + frei0r->dl_handle = load_path(ctx, prefix, dl_name); + } + if (!frei0r->dl_handle) + frei0r->dl_handle = load_path(ctx, "/usr/local/lib/frei0r-1/", dl_name); + if (!frei0r->dl_handle) + frei0r->dl_handle = load_path(ctx, "/usr/lib/frei0r-1/", dl_name); + if (!frei0r->dl_handle) { + av_log(ctx, AV_LOG_ERROR, "Could not find module '%s'\n", dl_name); + return AVERROR(EINVAL); + } + + if (!(f0r_init = load_sym(ctx, "f0r_init" )) || + !(f0r_get_plugin_info = load_sym(ctx, "f0r_get_plugin_info")) || + !(frei0r->get_param_info = load_sym(ctx, "f0r_get_param_info" )) || + !(frei0r->get_param_value = load_sym(ctx, "f0r_get_param_value")) || + !(frei0r->set_param_value = load_sym(ctx, "f0r_set_param_value")) || + !(frei0r->update = load_sym(ctx, "f0r_update" )) || + !(frei0r->construct = load_sym(ctx, "f0r_construct" )) || + !(frei0r->destruct = load_sym(ctx, "f0r_destruct" )) || + !(frei0r->deinit = load_sym(ctx, "f0r_deinit" ))) + return AVERROR(EINVAL); + + if (f0r_init() < 0) { + av_log(ctx, AV_LOG_ERROR, "Could not init the frei0r module"); + return AVERROR(EINVAL); + } + + f0r_get_plugin_info(&frei0r->plugin_info); + pi = &frei0r->plugin_info; + if (pi->plugin_type != F0R_PLUGIN_TYPE_FILTER) { + av_log(ctx, AV_LOG_ERROR, + "Invalid type '%s' for the plugin, a filter plugin was expected\n", + pi->plugin_type == F0R_PLUGIN_TYPE_SOURCE ? "source" : + pi->plugin_type == F0R_PLUGIN_TYPE_MIXER2 ? "mixer2" : + pi->plugin_type == F0R_PLUGIN_TYPE_MIXER3 ? "mixer3" : "unknown"); + return AVERROR(EINVAL); + } + + av_log(ctx, AV_LOG_INFO, + "name:%s author:'%s' explanation:'%s' color_model:%s " + "frei0r_version:%d version:%d.%d num_params:%d\n", + pi->name, pi->author, pi->explanation, + pi->color_model == F0R_COLOR_MODEL_BGRA8888 ? "bgra8888" : + pi->color_model == F0R_COLOR_MODEL_RGBA8888 ? "rgba8888" : + pi->color_model == F0R_COLOR_MODEL_PACKED32 ? "packed32" : "unknown", + pi->frei0r_version, pi->major_version, pi->minor_version, pi->num_params); + + return 0; +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + Frei0rContext *frei0r = ctx->priv; + + if (frei0r->destruct) + frei0r->destruct(frei0r->instance); + if (frei0r->deinit) + frei0r->deinit(); + if (frei0r->dl_handle) + dlclose(frei0r->dl_handle); + + memset(frei0r, 0, sizeof(*frei0r)); +} + +static int config_input_props(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->dst; + Frei0rContext *frei0r = ctx->priv; + + if (!(frei0r->instance = frei0r->construct(inlink->w, inlink->h))) { + av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance"); + return AVERROR(EINVAL); + } + + return set_params(ctx, frei0r->params); +} + +static int query_formats(AVFilterContext *ctx) +{ + Frei0rContext *frei0r = ctx->priv; + AVFilterFormats *formats = NULL; + + if (frei0r->plugin_info.color_model == F0R_COLOR_MODEL_BGRA8888) { + avfilter_add_format(&formats, PIX_FMT_BGRA); + } else if (frei0r->plugin_info.color_model == F0R_COLOR_MODEL_RGBA8888) { + avfilter_add_format(&formats, PIX_FMT_RGBA); + } else { /* F0R_COLOR_MODEL_PACKED32 */ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_BGRA, PIX_FMT_ARGB, PIX_FMT_ABGR, PIX_FMT_ARGB, PIX_FMT_NONE + }; + formats = avfilter_make_format_list(pix_fmts); + } + + if (!formats) + return AVERROR(ENOMEM); + + avfilter_set_common_formats(ctx, formats); + return 0; +} + +static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { } + +static void end_frame(AVFilterLink *inlink) +{ + Frei0rContext *frei0r = inlink->dst->priv; + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFilterBufferRef *inpicref = inlink->cur_buf; + AVFilterBufferRef *outpicref = outlink->out_buf; + + frei0r->update(frei0r->instance, inpicref->pts * av_q2d(inlink->time_base) * 1000, + (const uint32_t *)inpicref->data[0], + (uint32_t *)outpicref->data[0]); + avfilter_unref_buffer(inpicref); + avfilter_draw_slice(outlink, 0, outlink->h, 1); + avfilter_end_frame(outlink); + avfilter_unref_buffer(outpicref); +} + +AVFilter avfilter_vf_frei0r = { + .name = "frei0r", + .description = NULL_IF_CONFIG_SMALL("Apply a frei0r effect."), + + .query_formats = query_formats, + .init = init, + .uninit = uninit, + + .priv_size = sizeof(Frei0rContext), + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .draw_slice = null_draw_slice, + .config_props = config_input_props, + .end_frame = end_frame, + .min_perms = AV_PERM_READ }, + { .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_hflip.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_hflip.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_hflip.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_hflip.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2007 Benoit Fouet + * Copyright (c) 2010 Stefano Sabatini + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * horizontal flip filter + */ + +#include "avfilter.h" +#include "libavutil/pixdesc.h" +#include "libavutil/intreadwrite.h" +#include "libavcore/imgutils.h" + +typedef struct { + int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes + int hsub, vsub; ///< chroma subsampling +} FlipContext; + +static int query_formats(AVFilterContext *ctx) +{ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_RGB48BE, PIX_FMT_RGB48LE, + PIX_FMT_ARGB, PIX_FMT_RGBA, + PIX_FMT_ABGR, PIX_FMT_BGRA, + PIX_FMT_RGB24, PIX_FMT_BGR24, + PIX_FMT_RGB565BE, PIX_FMT_RGB565LE, + PIX_FMT_RGB555BE, PIX_FMT_RGB555LE, + PIX_FMT_BGR565BE, PIX_FMT_BGR565LE, + PIX_FMT_BGR555BE, PIX_FMT_BGR555LE, + PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE, + PIX_FMT_YUV420P16LE, PIX_FMT_YUV420P16BE, + PIX_FMT_YUV422P16LE, PIX_FMT_YUV422P16BE, + PIX_FMT_YUV444P16LE, PIX_FMT_YUV444P16BE, + PIX_FMT_YUV444P, PIX_FMT_YUV422P, + PIX_FMT_YUV420P, PIX_FMT_YUV411P, + PIX_FMT_YUV410P, PIX_FMT_YUV440P, + PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, + PIX_FMT_YUVJ420P, PIX_FMT_YUVJ440P, + PIX_FMT_YUVA420P, + PIX_FMT_RGB8, PIX_FMT_BGR8, + PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, + PIX_FMT_PAL8, PIX_FMT_GRAY8, + PIX_FMT_NONE + }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int config_props(AVFilterLink *inlink) +{ + FlipContext *flip = inlink->dst->priv; + const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format]; + + av_image_fill_max_pixsteps(flip->max_step, NULL, pix_desc); + flip->hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w; + flip->vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h; + + return 0; +} + +static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) +{ + FlipContext *flip = inlink->dst->priv; + AVFilterBufferRef *inpic = inlink->cur_buf; + AVFilterBufferRef *outpic = inlink->dst->outputs[0]->out_buf; + uint8_t *inrow, *outrow; + int i, j, plane, step, hsub, vsub; + + for (plane = 0; plane < 4 && inpic->data[plane]; plane++) { + step = flip->max_step[plane]; + hsub = (plane == 1 || plane == 2) ? flip->hsub : 0; + vsub = (plane == 1 || plane == 2) ? flip->vsub : 0; + + outrow = outpic->data[plane] + (y>>vsub) * outpic->linesize[plane]; + inrow = inpic ->data[plane] + (y>>vsub) * inpic ->linesize[plane] + ((inlink->w >> hsub) - 1) * step; + for (i = 0; i < h>>vsub; i++) { + switch (step) { + case 1: + { + for (j = 0; j < (inlink->w >> hsub); j++) + outrow[j] = inrow[-j]; + } + break; + + case 2: + { + uint16_t *outrow16 = (uint16_t *)outrow; + uint16_t * inrow16 = (uint16_t *) inrow; + for (j = 0; j < (inlink->w >> hsub); j++) + outrow16[j] = inrow16[-j]; + } + break; + + case 3: + { + uint8_t *in = inrow; + uint8_t *out = outrow; + for (j = 0; j < (inlink->w >> hsub); j++, out += 3, in -= 3) { + int32_t v = AV_RB24(in); + AV_WB24(out, v); + } + } + break; + + case 4: + { + uint32_t *outrow32 = (uint32_t *)outrow; + uint32_t * inrow32 = (uint32_t *) inrow; + for (j = 0; j < (inlink->w >> hsub); j++) + outrow32[j] = inrow32[-j]; + } + break; + + default: + for (j = 0; j < (inlink->w >> hsub); j++) + memcpy(outrow + j*step, inrow - j*step, step); + } + + inrow += inpic ->linesize[plane]; + outrow += outpic->linesize[plane]; + } + } + + avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir); +} + +AVFilter avfilter_vf_hflip = { + .name = "hflip", + .description = NULL_IF_CONFIG_SMALL("Horizontally flip the input video."), + .priv_size = sizeof(FlipContext), + .query_formats = query_formats, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .draw_slice = draw_slice, + .config_props = config_props, + .min_perms = AV_PERM_READ, }, + { .name = NULL}}, + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_libopencv.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_libopencv.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_libopencv.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_libopencv.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,156 @@ +/* + * copyright (c) 2010 Stefano Sabatini + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * libopencv wrapper functions + */ + +#include +#include +#include "avfilter.h" + +static void fill_iplimage_from_picref(IplImage *img, const AVFilterBufferRef *picref, enum PixelFormat pixfmt) +{ + IplImage *tmpimg; + int depth, channels_nb; + + if (pixfmt == PIX_FMT_GRAY8) { depth = IPL_DEPTH_8U; channels_nb = 1; } + else if (pixfmt == PIX_FMT_BGRA) { depth = IPL_DEPTH_8U; channels_nb = 4; } + else if (pixfmt == PIX_FMT_BGR24) { depth = IPL_DEPTH_8U; channels_nb = 3; } + else return; + + tmpimg = cvCreateImageHeader((CvSize){picref->video->w, picref->video->h}, depth, channels_nb); + *img = *tmpimg; + img->imageData = img->imageDataOrigin = picref->data[0]; + img->dataOrder = IPL_DATA_ORDER_PIXEL; + img->origin = IPL_ORIGIN_TL; + img->widthStep = picref->linesize[0]; +} + +static void fill_picref_from_iplimage(AVFilterBufferRef *picref, const IplImage *img, enum PixelFormat pixfmt) +{ + picref->linesize[0] = img->widthStep; + picref->data[0] = img->imageData; +} + +static int query_formats(AVFilterContext *ctx) +{ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_BGR24, PIX_FMT_BGRA, PIX_FMT_GRAY8, PIX_FMT_NONE + }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { } + +#if CONFIG_OCV_SMOOTH_FILTER + +typedef struct { + int type; + int param1, param2; + double param3, param4; +} SmoothContext; + +static av_cold int smooth_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + SmoothContext *smooth = ctx->priv; + char type_str[128] = "gaussian"; + + smooth->param1 = 3; + smooth->param2 = 0; + smooth->param3 = 0.0; + smooth->param4 = 0.0; + + if (args) + sscanf(args, "%127[^:]:%d:%d:%lf:%lf", type_str, &smooth->param1, &smooth->param2, &smooth->param3, &smooth->param4); + + if (!strcmp(type_str, "blur" )) smooth->type = CV_BLUR; + else if (!strcmp(type_str, "blur_no_scale")) smooth->type = CV_BLUR_NO_SCALE; + else if (!strcmp(type_str, "median" )) smooth->type = CV_MEDIAN; + else if (!strcmp(type_str, "gaussian" )) smooth->type = CV_GAUSSIAN; + else if (!strcmp(type_str, "bilateral" )) smooth->type = CV_BILATERAL; + else { + av_log(ctx, AV_LOG_ERROR, "Smoothing type '%s' unknown\n.", type_str); + return AVERROR(EINVAL); + } + + if (smooth->param1 < 0 || !(smooth->param1%2)) { + av_log(ctx, AV_LOG_ERROR, + "Invalid value '%d' for param1, it has to be a positive odd number\n", + smooth->param1); + return AVERROR(EINVAL); + } + if ((smooth->type == CV_BLUR || smooth->type == CV_BLUR_NO_SCALE || smooth->type == CV_GAUSSIAN) && + (smooth->param2 < 0 || (smooth->param2 && !(smooth->param2%2)))) { + av_log(ctx, AV_LOG_ERROR, + "Invalid value '%d' for param2, it has to be zero or a positive odd number\n", + smooth->param2); + return AVERROR(EINVAL); + } + + av_log(ctx, AV_LOG_INFO, "type:%s param1:%d param2:%d param3:%f param4:%f\n", + type_str, smooth->param1, smooth->param2, smooth->param3, smooth->param4); + return 0; +} + +static void smooth_end_frame(AVFilterLink *inlink) +{ + SmoothContext *smooth = inlink->dst->priv; + AVFilterLink *outlink = inlink->dst->outputs[0]; + AVFilterBufferRef *inpicref = inlink ->cur_buf; + AVFilterBufferRef *outpicref = outlink->out_buf; + IplImage inimg, outimg; + + fill_iplimage_from_picref(&inimg , inpicref , inlink->format); + fill_iplimage_from_picref(&outimg, outpicref, inlink->format); + cvSmooth(&inimg, &outimg, smooth->type, smooth->param1, smooth->param2, smooth->param3, smooth->param4); + fill_picref_from_iplimage(outpicref, &outimg, inlink->format); + + avfilter_unref_buffer(inpicref); + avfilter_draw_slice(outlink, 0, outlink->h, 1); + avfilter_end_frame(outlink); + avfilter_unref_buffer(outpicref); +} + +AVFilter avfilter_vf_ocv_smooth = { + .name = "ocv_smooth", + .description = NULL_IF_CONFIG_SMALL("Apply smooth transform using libopencv."), + + .priv_size = sizeof(SmoothContext), + + .query_formats = query_formats, + .init = smooth_init, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .draw_slice = null_draw_slice, + .end_frame = smooth_end_frame, + .min_perms = AV_PERM_READ }, + { .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, }, + { .name = NULL}}, +}; + +#endif /* CONFIG_OCV_SMOOTH_FILTER */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_pad.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_pad.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_pad.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_pad.c 2010-11-06 17:21:29.000000000 +0000 @@ -407,7 +407,7 @@ color->w &= ~((1 << color->hsub) - 1); color->h &= ~((1 << color->vsub) - 1); - if (av_check_image_size(color->w, color->h, 0, ctx) < 0) + if (av_image_check_size(color->w, color->h, 0, ctx) < 0) return AVERROR(EINVAL); memcpy(rgba_color, color->color, sizeof(rgba_color)); @@ -428,9 +428,9 @@ { ColorContext *color = link->src->priv; AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); - picref->pixel_aspect = (AVRational) {1, 1}; - picref->pts = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q); - picref->pos = 0; + picref->video->pixel_aspect = (AVRational) {1, 1}; + picref->pts = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q); + picref->pos = 0; avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); draw_rectangle(picref, @@ -456,7 +456,7 @@ .inputs = (AVFilterPad[]) {{ .name = NULL}}, .outputs = (AVFilterPad[]) {{ .name = "default", - .type = CODEC_TYPE_VIDEO, + .type = AVMEDIA_TYPE_VIDEO, .request_frame = color_request_frame, .config_props = color_config_props }, { .name = NULL}}, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_pixdesctest.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_pixdesctest.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_pixdesctest.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_pixdesctest.c 2010-11-06 17:21:29.000000000 +0000 @@ -109,7 +109,7 @@ AVFilter avfilter_vf_pixdesctest = { .name = "pixdesctest", - .description = "Test pixel format definitions.", + .description = NULL_IF_CONFIG_SMALL("Test pixel format definitions."), .priv_size = sizeof(PixdescTestContext), .uninit = uninit, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_scale.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_scale.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_scale.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_scale.c 2010-11-06 17:21:29.000000000 +0000 @@ -49,16 +49,16 @@ const char *p; scale->flags = SWS_BILINEAR; - if (args){ + if (args) { sscanf(args, "%d:%d", &scale->w, &scale->h); - p= strstr(args,"flags="); - if(p) scale->flags= strtoul(p+6, NULL, 0); + p = strstr(args,"flags="); + if (p) scale->flags = strtoul(p+6, NULL, 0); } /* sanity check params */ if (scale->w < -1 || scale->h < -1) { av_log(ctx, AV_LOG_ERROR, "Size values less than -1 are not acceptable.\n"); - return -1; + return AVERROR(EINVAL); } if (scale->w == -1 && scale->h == -1) scale->w = scale->h = 0; @@ -153,12 +153,14 @@ outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); avfilter_copy_buffer_ref_props(outpicref, picref); + outpicref->video->w = outlink->w; + outpicref->video->h = outlink->h; outlink->out_buf = outpicref; - av_reduce(&outpicref->pixel_aspect.num, &outpicref->pixel_aspect.den, - (int64_t)picref->pixel_aspect.num * outlink->h * link->w, - (int64_t)picref->pixel_aspect.den * outlink->w * link->h, + av_reduce(&outpicref->video->pixel_aspect.num, &outpicref->video->pixel_aspect.den, + (int64_t)picref->video->pixel_aspect.num * outlink->h * link->w, + (int64_t)picref->video->pixel_aspect.den * outlink->w * link->h, INT_MAX); scale->slice_y = 0; @@ -195,7 +197,7 @@ AVFilter avfilter_vf_scale = { .name = "scale", - .description = "Scale the input video to width:height size and/or convert the image format.", + .description = NULL_IF_CONFIG_SMALL("Scale the input video to width:height size and/or convert the image format."), .init = init, .uninit = uninit, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_setpts.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_setpts.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_setpts.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_setpts.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2010 Stefano Sabatini + * Copyright (c) 2008 Victor Paesa + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * video presentation timestamp (PTS) modification filter + */ + +/* #define DEBUG */ + +#include "libavutil/eval.h" +#include "avfilter.h" + +static const char *var_names[] = { + "E", ///< Euler number + "INTERLACED", ///< tell if the current frame is interlaced + "N", ///< frame number (starting at zero) + "PHI", ///< golden ratio + "PI", ///< greek pi + "POS", ///< original position in the file of the frame + "PREV_INPTS", ///< previous input PTS + "PREV_OUTPTS", ///< previous output PTS + "PTS", ///< original pts in the file of the frame + "STARTPTS", ///< PTS at start of movie + "TB", ///< timebase + NULL +}; + +enum var_name { + VAR_E, + VAR_INTERLACED, + VAR_N, + VAR_PHI, + VAR_PI, + VAR_POS, + VAR_PREV_INPTS, + VAR_PREV_OUTPTS, + VAR_PTS, + VAR_STARTPTS, + VAR_TB, + VAR_VARS_NB +}; + +typedef struct { + AVExpr *expr; + double var_values[VAR_VARS_NB]; +} SetPTSContext; + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + SetPTSContext *setpts = ctx->priv; + int ret; + + if ((ret = av_parse_expr(&setpts->expr, args ? args : "PTS", + var_names, NULL, NULL, NULL, NULL, 0, ctx)) < 0) { + av_log(ctx, AV_LOG_ERROR, "Error while parsing expression '%s'\n", args); + return ret; + } + + setpts->var_values[VAR_E ] = M_E; + setpts->var_values[VAR_N ] = 0.0; + setpts->var_values[VAR_PHI ] = M_PHI; + setpts->var_values[VAR_PI ] = M_PI; + setpts->var_values[VAR_PREV_INPTS ] = NAN; + setpts->var_values[VAR_PREV_OUTPTS] = NAN; + setpts->var_values[VAR_STARTPTS ] = NAN; + return 0; +} + +static int config_input(AVFilterLink *inlink) +{ + SetPTSContext *setpts = inlink->dst->priv; + + setpts->var_values[VAR_TB] = av_q2d(inlink->time_base); + + av_log(inlink->src, AV_LOG_INFO, "TB:%f\n", setpts->var_values[VAR_TB]); + return 0; +} + +#define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d)) +#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) + +static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) +{ + SetPTSContext *setpts = inlink->dst->priv; + double d; + AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0); + + if (isnan(setpts->var_values[VAR_STARTPTS])) + setpts->var_values[VAR_STARTPTS] = TS2D(inpicref->pts); + + setpts->var_values[VAR_INTERLACED] = inpicref->video->interlaced; + setpts->var_values[VAR_PTS ] = TS2D(inpicref->pts); + setpts->var_values[VAR_POS ] = inpicref->pos == -1 ? NAN : inpicref->pos; + + d = av_eval_expr(setpts->expr, setpts->var_values, NULL); + outpicref->pts = D2TS(d); + +#ifdef DEBUG + av_log(inlink->dst, AV_LOG_DEBUG, + "n:%"PRId64" interlaced:%d pos:%d pts:%"PRId64" t:%f -> pts:%"PRId64" t:%f\n", + (int64_t)setpts->var_values[VAR_N], + (int)setpts->var_values[VAR_INTERLACED], + (int)setpts->var_values[VAR_POS], + inpicref ->pts, inpicref ->pts * av_q2d(inlink->time_base), + outpicref->pts, outpicref->pts * av_q2d(inlink->time_base)); +#endif + + setpts->var_values[VAR_N] += 1.0; + setpts->var_values[VAR_PREV_INPTS ] = TS2D(inpicref ->pts); + setpts->var_values[VAR_PREV_OUTPTS] = TS2D(outpicref->pts); + avfilter_start_frame(inlink->dst->outputs[0], outpicref); +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + SetPTSContext *setpts = ctx->priv; + av_free_expr(setpts->expr); + setpts->expr = NULL; +} + +AVFilter avfilter_vf_setpts = { + .name = "setpts", + .description = NULL_IF_CONFIG_SMALL("Set PTS for the output video frame."), + .init = init, + .uninit = uninit, + + .priv_size = sizeof(SetPTSContext), + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .get_video_buffer = avfilter_null_get_video_buffer, + .config_props = config_input, + .start_frame = start_frame, }, + { .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_settb.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_settb.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_settb.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_settb.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2010 Stefano Sabatini + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Set timebase for the output link. + */ + +#include "libavutil/avstring.h" +#include "libavutil/eval.h" +#include "libavutil/rational.h" +#include "avfilter.h" +#include "internal.h" + +static const char *var_names[] = { + "E", + "PHI", + "PI", + "AVTB", /* default timebase 1/AV_TIME_BASE */ + "intb", /* input timebase */ + NULL +}; + +enum var_name { + VAR_E, + VAR_PHI, + VAR_PI, + VAR_AVTB, + VAR_INTB, + VAR_VARS_NB +}; + +typedef struct { + char tb_expr[256]; + double var_values[VAR_VARS_NB]; +} SetTBContext; + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + SetTBContext *settb = ctx->priv; + av_strlcpy(settb->tb_expr, "intb", sizeof(settb->tb_expr)); + + if (args) + sscanf(args, "%255[^:]", settb->tb_expr); + + return 0; +} + +static int config_output_props(AVFilterLink *outlink) +{ + AVFilterContext *ctx = outlink->src; + SetTBContext *settb = ctx->priv; + AVFilterLink *inlink = ctx->inputs[0]; + AVRational time_base; + int ret; + double res; + + settb->var_values[VAR_E] = M_E; + settb->var_values[VAR_PHI] = M_PHI; + settb->var_values[VAR_PI] = M_PI; + settb->var_values[VAR_AVTB] = av_q2d(AV_TIME_BASE_Q); + settb->var_values[VAR_INTB] = av_q2d(inlink->time_base); + + outlink->w = inlink->w; + outlink->h = inlink->h; + + if ((ret = av_parse_and_eval_expr(&res, settb->tb_expr, var_names, settb->var_values, + NULL, NULL, NULL, NULL, NULL, 0, NULL)) < 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid expression '%s' for timebase.\n", settb->tb_expr); + return ret; + } + time_base = av_d2q(res, INT_MAX); + if (time_base.num <= 0 || time_base.den <= 0) { + av_log(ctx, AV_LOG_ERROR, + "Invalid non-positive values for the timebase num:%d or den:%d.\n", + time_base.num, time_base.den); + return AVERROR(EINVAL); + } + + outlink->time_base = time_base; + av_log(outlink->src, AV_LOG_INFO, "tb:%d/%d -> tb:%d/%d\n", + inlink ->time_base.num, inlink ->time_base.den, + outlink->time_base.num, outlink->time_base.den); + + return 0; +} + +static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) +{ + AVFilterContext *ctx = inlink->dst; + AVFilterLink *outlink = ctx->outputs[0]; + AVFilterBufferRef *picref2 = picref; + + if (av_cmp_q(inlink->time_base, outlink->time_base)) { + picref2 = avfilter_ref_buffer(picref, ~0); + picref2->pts = av_rescale_q(picref->pts, inlink->time_base, outlink->time_base); + av_log(ctx, AV_LOG_DEBUG, "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n", + inlink ->time_base.num, inlink ->time_base.den, picref ->pts, + outlink->time_base.num, outlink->time_base.den, picref2->pts); + avfilter_unref_buffer(picref); + } + + avfilter_start_frame(outlink, picref2); +} + +AVFilter avfilter_vf_settb = { + .name = "settb", + .description = NULL_IF_CONFIG_SMALL("Set timebase for the output link."), + .init = init, + + .priv_size = sizeof(SetTBContext), + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .get_video_buffer = avfilter_null_get_video_buffer, + .start_frame = start_frame, + .end_frame = avfilter_null_end_frame }, + { .name = NULL }}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = config_output_props, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_slicify.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_slicify.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_slicify.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_slicify.c 2010-11-06 17:21:29.000000000 +0000 @@ -97,7 +97,7 @@ AVFilter avfilter_vf_slicify = { .name = "slicify", - .description = "Pass the images of input video on to next video filter as multiple slices.", + .description = NULL_IF_CONFIG_SMALL("Pass the images of input video on to next video filter as multiple slices."), .init = init, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_transpose.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_transpose.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_transpose.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_transpose.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2010 Stefano Sabatini + * Copyright (C) 2008 Vitor Sessak + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * transposition filter + * Based on MPlayer libmpcodecs/vf_rotate.c. + */ + +#include "libavutil/intreadwrite.h" +#include "libavutil/pixdesc.h" +#include "libavcore/imgutils.h" +#include "avfilter.h" + +typedef struct { + int hsub, vsub; + int pixsteps[4]; + + /* 0 Rotate by 90 degrees counterclockwise and vflip. */ + /* 1 Rotate by 90 degrees clockwise. */ + /* 2 Rotate by 90 degrees counterclockwise. */ + /* 3 Rotate by 90 degrees clockwise and vflip. */ + int dir; +} TransContext; + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + TransContext *trans = ctx->priv; + trans->dir = 0; + + if (args) + sscanf(args, "%d", &trans->dir); + + if (trans->dir < 0 || trans->dir > 3) { + av_log(ctx, AV_LOG_ERROR, "Invalid value %d not between 0 and 3.\n", + trans->dir); + return AVERROR(EINVAL); + } + return 0; +} + +static int query_formats(AVFilterContext *ctx) +{ + enum PixelFormat pix_fmts[] = { + PIX_FMT_ARGB, PIX_FMT_RGBA, + PIX_FMT_ABGR, PIX_FMT_BGRA, + PIX_FMT_RGB24, PIX_FMT_BGR24, + PIX_FMT_RGB565BE, PIX_FMT_RGB565LE, + PIX_FMT_RGB555BE, PIX_FMT_RGB555LE, + PIX_FMT_BGR565BE, PIX_FMT_BGR565LE, + PIX_FMT_BGR555BE, PIX_FMT_BGR555LE, + PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE, + PIX_FMT_YUV420P16LE, PIX_FMT_YUV420P16BE, + PIX_FMT_YUV422P16LE, PIX_FMT_YUV422P16BE, + PIX_FMT_YUV444P16LE, PIX_FMT_YUV444P16BE, + PIX_FMT_NV12, PIX_FMT_NV21, + PIX_FMT_RGB8, PIX_FMT_BGR8, + PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, + PIX_FMT_YUV444P, PIX_FMT_YUV422P, + PIX_FMT_YUV420P, PIX_FMT_YUVJ420P, + PIX_FMT_YUV411P, PIX_FMT_YUV410P, + PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, + PIX_FMT_YUV440P, PIX_FMT_YUVJ440P, + PIX_FMT_YUVA420P, PIX_FMT_GRAY8, + PIX_FMT_NONE + }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int config_props_output(AVFilterLink *outlink) +{ + AVFilterContext *ctx = outlink->src; + TransContext *trans = ctx->priv; + AVFilterLink *inlink = ctx->inputs[0]; + const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[outlink->format]; + + trans->hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w; + trans->vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h; + + av_image_fill_max_pixsteps(trans->pixsteps, NULL, pixdesc); + + outlink->w = inlink->h; + outlink->h = inlink->w; + + av_log(ctx, AV_LOG_INFO, "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n", + inlink->w, inlink->h, trans->dir, outlink->w, outlink->h, + trans->dir == 1 || trans->dir == 3 ? "clockwise" : "counterclockwise", + trans->dir == 0 || trans->dir == 3); + return 0; +} + +static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) +{ + AVFilterLink *outlink = inlink->dst->outputs[0]; + + outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, + outlink->w, outlink->h); + outlink->out_buf->pts = picref->pts; + + if (picref->video->pixel_aspect.num == 0) { + outlink->out_buf->video->pixel_aspect = picref->video->pixel_aspect; + } else { + outlink->out_buf->video->pixel_aspect.num = picref->video->pixel_aspect.den; + outlink->out_buf->video->pixel_aspect.den = picref->video->pixel_aspect.num; + } + + avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0)); +} + +static void end_frame(AVFilterLink *inlink) +{ + TransContext *trans = inlink->dst->priv; + AVFilterBufferRef *inpic = inlink->cur_buf; + AVFilterBufferRef *outpic = inlink->dst->outputs[0]->out_buf; + AVFilterLink *outlink = inlink->dst->outputs[0]; + int plane; + + for (plane = 0; outpic->data[plane]; plane++) { + int hsub = plane == 1 || plane == 2 ? trans->hsub : 0; + int vsub = plane == 1 || plane == 2 ? trans->vsub : 0; + int pixstep = trans->pixsteps[plane]; + int inh = inpic->video->h>>vsub; + int outw = outpic->video->w>>hsub; + int outh = outpic->video->h>>vsub; + uint8_t *out, *in; + int outlinesize, inlinesize; + int x, y; + + out = outpic->data[plane]; outlinesize = outpic->linesize[plane]; + in = inpic ->data[plane]; inlinesize = inpic ->linesize[plane]; + + if (trans->dir&1) { + in += inpic->linesize[plane] * (inh-1); + inlinesize *= -1; + } + + if (trans->dir&2) { + out += outpic->linesize[plane] * (outh-1); + outlinesize *= -1; + } + + for (y = 0; y < outh; y++) { + switch (pixstep) { + case 1: + for (x = 0; x < outw; x++) + out[x] = in[x*inlinesize + y]; + break; + case 2: + for (x = 0; x < outw; x++) + *((uint16_t *)(out + 2*x)) = *((uint16_t *)(in + x*inlinesize + y*2)); + break; + case 3: + for (x = 0; x < outw; x++) { + int32_t v = AV_RB24(in + x*inlinesize + y*3); + AV_WB24(out + 3*x, v); + } + break; + case 4: + for (x = 0; x < outw; x++) + *((uint32_t *)(out + 4*x)) = *((uint32_t *)(in + x*inlinesize + y*4)); + break; + } + out += outlinesize; + } + } + + avfilter_unref_buffer(inpic); + avfilter_draw_slice(outlink, 0, outpic->video->h, 1); + avfilter_end_frame(outlink); + avfilter_unref_buffer(outpic); +} + +AVFilter avfilter_vf_transpose = { + .name = "transpose", + .description = NULL_IF_CONFIG_SMALL("Transpose input video."), + + .init = init, + .priv_size = sizeof(TransContext), + + .query_formats = query_formats, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .start_frame = start_frame, + .end_frame = end_frame, + .min_perms = AV_PERM_READ, }, + { .name = NULL}}, + .outputs = (AVFilterPad[]) {{ .name = "default", + .config_props = config_props_output, + .type = AVMEDIA_TYPE_VIDEO, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_unsharp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_unsharp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_unsharp.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_unsharp.c 2010-11-06 17:21:29.000000000 +0000 @@ -133,6 +133,14 @@ sscanf(args, "%d:%d:%lf:%d:%d:%lf", &lmsize_x, &lmsize_y, &lamount, &cmsize_x, &cmsize_y, &camount); + if ((lamount && (lmsize_x < 2 || lmsize_y < 2)) || + (camount && (cmsize_x < 2 || cmsize_y < 2))) { + av_log(ctx, AV_LOG_ERROR, + "Invalid value <2 for lmsize_x:%d or lmsize_y:%d or cmsize_x:%d or cmsize_y:%d\n", + lmsize_x, lmsize_y, cmsize_x, cmsize_y); + return AVERROR(EINVAL); + } + set_filter_param(&unsharp->luma, lmsize_x, lmsize_y, lamount); set_filter_param(&unsharp->chroma, cmsize_x, cmsize_y, camount); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_yadif.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_yadif.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vf_yadif.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vf_yadif.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,329 @@ +/* + * Copyright (C) 2006-2010 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "libavutil/cpu.h" +#include "libavutil/common.h" +#include "avfilter.h" +#include "yadif.h" + +#undef NDEBUG +#include + +typedef struct { + /** + * 0: send 1 frame for each frame + * 1: send 1 frame for each field + * 2: like 0 but skips spatial interlacing check + * 3: like 1 but skips spatial interlacing check + */ + int mode; + + /** + * 0: bottom field first + * 1: top field first + * -1: auto-detection + */ + int parity; + + int frame_pending; + + AVFilterBufferRef *cur; + AVFilterBufferRef *next; + AVFilterBufferRef *prev; + AVFilterBufferRef *out; + void (*filter_line)(uint8_t *dst, + uint8_t *prev, uint8_t *cur, uint8_t *next, + int w, int refs, int parity, int mode); +} YADIFContext; + +static void filter_line_c(uint8_t *dst, + uint8_t *prev, uint8_t *cur, uint8_t *next, + int w, int refs, int parity, int mode) +{ + int x; + uint8_t *prev2 = parity ? prev : cur ; + uint8_t *next2 = parity ? cur : next; + for (x = 0; x < w; x++) { + int c = cur[-refs]; + int d = (prev2[0] + next2[0])>>1; + int e = cur[+refs]; + int temporal_diff0 = FFABS(prev2[0] - next2[0]); + int temporal_diff1 =(FFABS(prev[-refs] - c) + FFABS(prev[+refs] - e) )>>1; + int temporal_diff2 =(FFABS(next[-refs] - c) + FFABS(next[+refs] - e) )>>1; + int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2); + int spatial_pred = (c+e)>>1; + int spatial_score = FFABS(cur[-refs-1] - cur[+refs-1]) + FFABS(c-e) + + FFABS(cur[-refs+1] - cur[+refs+1]) - 1; + +#define CHECK(j)\ + { int score = FFABS(cur[-refs-1+j] - cur[+refs-1-j])\ + + FFABS(cur[-refs +j] - cur[+refs -j])\ + + FFABS(cur[-refs+1+j] - cur[+refs+1-j]);\ + if (score < spatial_score) {\ + spatial_score= score;\ + spatial_pred= (cur[-refs +j] + cur[+refs -j])>>1;\ + + CHECK(-1) CHECK(-2) }} }} + CHECK( 1) CHECK( 2) }} }} + + if (mode < 2) { + int b = (prev2[-2*refs] + next2[-2*refs])>>1; + int f = (prev2[+2*refs] + next2[+2*refs])>>1; +#if 0 + int a = cur[-3*refs]; + int g = cur[+3*refs]; + int max = FFMAX3(d-e, d-c, FFMIN3(FFMAX(b-c,f-e),FFMAX(b-c,b-a),FFMAX(f-g,f-e)) ); + int min = FFMIN3(d-e, d-c, FFMAX3(FFMIN(b-c,f-e),FFMIN(b-c,b-a),FFMIN(f-g,f-e)) ); +#else + int max = FFMAX3(d-e, d-c, FFMIN(b-c, f-e)); + int min = FFMIN3(d-e, d-c, FFMAX(b-c, f-e)); +#endif + + diff = FFMAX3(diff, min, -max); + } + + if (spatial_pred > d + diff) + spatial_pred = d + diff; + else if (spatial_pred < d - diff) + spatial_pred = d - diff; + + dst[0] = spatial_pred; + + dst++; + cur++; + prev++; + next++; + prev2++; + next2++; + } +} + +static void filter(AVFilterContext *ctx, AVFilterBufferRef *dstpic, + int parity, int tff) +{ + YADIFContext *yadif = ctx->priv; + int y, i; + + for (i = 0; i < 3; i++) { + int is_chroma = !!i; + int w = dstpic->video->w >> is_chroma; + int h = dstpic->video->h >> is_chroma; + int refs = yadif->cur->linesize[i]; + + for (y = 0; y < h; y++) { + if ((y ^ parity) & 1) { + uint8_t *prev = &yadif->prev->data[i][y*refs]; + uint8_t *cur = &yadif->cur ->data[i][y*refs]; + uint8_t *next = &yadif->next->data[i][y*refs]; + uint8_t *dst = &dstpic->data[i][y*dstpic->linesize[i]]; + yadif->filter_line(dst, prev, cur, next, w, refs, parity ^ tff, yadif->mode); + } else { + memcpy(&dstpic->data[i][y*dstpic->linesize[i]], + &yadif->cur->data[i][y*refs], w); + } + } + } +#if HAVE_MMX + __asm__ volatile("emms \n\t" : : : "memory"); +#endif +} + +static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, int w, int h) +{ + AVFilterBufferRef *picref; + int width = FFALIGN(w, 32); + int height= FFALIGN(h+6, 32); + int i; + + picref = avfilter_default_get_video_buffer(link, perms, width, height); + + picref->video->w = w; + picref->video->h = h; + + for (i = 0; i < 3; i++) + picref->data[i] += 3 * picref->linesize[i]; + + return picref; +} + +static void return_frame(AVFilterContext *ctx, int is_second) +{ + YADIFContext *yadif = ctx->priv; + AVFilterLink *link= ctx->outputs[0]; + int tff = yadif->parity == -1 ? yadif->cur->video->top_field_first : (yadif->parity^1); + + if (is_second) + yadif->out = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE | + AV_PERM_REUSE, link->w, link->h); + + filter(ctx, yadif->out, tff ^ !is_second, tff); + + if (is_second) + avfilter_start_frame(ctx->outputs[0], yadif->out); + avfilter_draw_slice(ctx->outputs[0], 0, link->h, 1); + avfilter_end_frame(ctx->outputs[0]); + + yadif->frame_pending = (yadif->mode&1) && !is_second; +} + +static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) +{ + AVFilterContext *ctx = link->dst; + YADIFContext *yadif = ctx->priv; + + if (yadif->frame_pending) + return_frame(ctx, 1); + + if (yadif->prev) + avfilter_unref_buffer(yadif->prev); + yadif->prev = yadif->cur; + yadif->cur = yadif->next; + yadif->next = picref; + + if (!yadif->cur) + return; + + if (!yadif->prev) + yadif->prev = avfilter_ref_buffer(yadif->cur, AV_PERM_READ); + + yadif->out = avfilter_get_video_buffer(ctx->outputs[0], AV_PERM_WRITE | AV_PERM_PRESERVE | + AV_PERM_REUSE, link->w, link->h); + + yadif->out->pts = yadif->cur->pts; + avfilter_start_frame(ctx->outputs[0], yadif->out); +} + +static void end_frame(AVFilterLink *link) +{ + AVFilterContext *ctx = link->dst; + YADIFContext *yadif = ctx->priv; + + if (!yadif->out) + return; + + return_frame(ctx, 0); +} + +static int request_frame(AVFilterLink *link) +{ + AVFilterContext *ctx = link->src; + YADIFContext *yadif = ctx->priv; + + if (yadif->frame_pending) { + return_frame(ctx, 1); + return 0; + } + + do { + int ret; + + if ((ret = avfilter_request_frame(link->src->inputs[0]))) + return ret; + } while (!yadif->cur); + + return 0; +} + +static int poll_frame(AVFilterLink *link) +{ + YADIFContext *yadif = link->src->priv; + int ret, val; + + if (yadif->frame_pending) + return 1; + + val = avfilter_poll_frame(link->src->inputs[0]); + + if (val==1 && !yadif->next) { //FIXME change API to not requre this red tape + if ((ret = avfilter_request_frame(link->src->inputs[0])) < 0) + return ret; + val = avfilter_poll_frame(link->src->inputs[0]); + } + assert(yadif->next); + + return val * ((yadif->mode&1)+1); +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + YADIFContext *yadif = ctx->priv; + + if (yadif->prev) avfilter_unref_buffer(yadif->prev); + if (yadif->cur ) avfilter_unref_buffer(yadif->cur ); + if (yadif->next) avfilter_unref_buffer(yadif->next); +} + +static int query_formats(AVFilterContext *ctx) +{ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_YUV420P, + PIX_FMT_GRAY8, + PIX_FMT_NONE + }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + + return 0; +} + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + YADIFContext *yadif = ctx->priv; + av_unused int cpu_flags = av_get_cpu_flags(); + + yadif->mode = 0; + yadif->parity = -1; + + if (args) sscanf(args, "%d:%d", &yadif->mode, &yadif->parity); + + yadif->filter_line = filter_line_c; + if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) + yadif->filter_line = ff_yadif_filter_line_mmx; + + av_log(ctx, AV_LOG_INFO, "mode:%d parity:%d\n", yadif->mode, yadif->parity); + + return 0; +} + +static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { } + +AVFilter avfilter_vf_yadif = { + .name = "yadif", + .description = NULL_IF_CONFIG_SMALL("Deinterlace the input image"), + + .priv_size = sizeof(YADIFContext), + .init = init, + .uninit = uninit, + .query_formats = query_formats, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .start_frame = start_frame, + .get_video_buffer = get_video_buffer, + .draw_slice = null_draw_slice, + .end_frame = end_frame, }, + { .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .poll_frame = poll_frame, + .request_frame = request_frame, }, + { .name = NULL}}, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vsink_nullsink.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vsink_nullsink.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vsink_nullsink.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vsink_nullsink.c 2010-11-06 17:21:29.000000000 +0000 @@ -28,7 +28,7 @@ AVFilter avfilter_vsink_nullsink = { .name = "nullsink", - .description = "Do absolutely nothing with the input video.", + .description = NULL_IF_CONFIG_SMALL("Do absolutely nothing with the input video."), .priv_size = 0, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vsrc_buffer.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vsrc_buffer.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vsrc_buffer.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vsrc_buffer.c 2010-11-06 17:21:29.000000000 +0000 @@ -25,7 +25,7 @@ #include "avfilter.h" #include "vsrc_buffer.h" -#include "libavutil/pixdesc.h" +#include "libavcore/imgutils.h" typedef struct { int64_t pts; @@ -33,6 +33,7 @@ int has_frame; int h, w; enum PixelFormat pix_fmt; + AVRational time_base; ///< time_base to set in the output link AVRational pixel_aspect; } BufferSourceContext; @@ -66,8 +67,9 @@ char pix_fmt_str[128]; int n = 0; - if (!args || (n = sscanf(args, "%d:%d:%127s", &c->w, &c->h, pix_fmt_str)) != 3) { - av_log(ctx, AV_LOG_ERROR, "Expected 3 arguments, but only %d found in '%s'\n", n, args ? args : ""); + if (!args || + (n = sscanf(args, "%d:%d:%127[^:]:%d:%d", &c->w, &c->h, pix_fmt_str, &c->time_base.num, &c->time_base.den)) != 5) { + av_log(ctx, AV_LOG_ERROR, "Expected 5 arguments, but only %d found in '%s'\n", n, args); return AVERROR(EINVAL); } if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) { @@ -98,6 +100,7 @@ link->w = c->w; link->h = c->h; + link->time_base = c->time_base; return 0; } @@ -119,13 +122,14 @@ AV_PERM_REUSE2, link->w, link->h); - av_picture_copy((AVPicture *)&picref->data, (AVPicture *)&c->frame, - picref->format, link->w, link->h); - - picref->pts = c->pts; - picref->pixel_aspect = c->pixel_aspect; - picref->interlaced = c->frame.interlaced_frame; - picref->top_field_first = c->frame.top_field_first; + av_image_copy(picref->data, picref->linesize, + c->frame.data, c->frame.linesize, + picref->format, link->w, link->h); + + picref->pts = c->pts; + picref->video->pixel_aspect = c->pixel_aspect; + picref->video->interlaced = c->frame.interlaced_frame; + picref->video->top_field_first = c->frame.top_field_first; avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); avfilter_draw_slice(link, 0, link->h, 1); avfilter_end_frame(link); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vsrc_nullsrc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vsrc_nullsrc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/vsrc_nullsrc.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/vsrc_nullsrc.c 2010-11-06 17:21:29.000000000 +0000 @@ -21,10 +21,31 @@ * null video source */ +#include "libavutil/avstring.h" +#include "libavutil/eval.h" +#include "libavcore/parseutils.h" #include "avfilter.h" +static const char *var_names[] = { + "E", + "PHI", + "PI", + "AVTB", /* default timebase 1/AV_TIME_BASE */ + NULL +}; + +enum var_name { + VAR_E, + VAR_PHI, + VAR_PI, + VAR_AVTB, + VAR_VARS_NB +}; + typedef struct { int w, h; + char tb_expr[256]; + double var_values[VAR_VARS_NB]; } NullContext; static int init(AVFilterContext *ctx, const char *args, void *opaque) @@ -33,13 +54,14 @@ priv->w = 352; priv->h = 288; + av_strlcpy(priv->tb_expr, "AVTB", sizeof(priv->tb_expr)); if (args) - sscanf(args, "%d:%d", &priv->w, &priv->h); + sscanf(args, "%d:%d:%255[^:]", &priv->w, &priv->h, priv->tb_expr); if (priv->w <= 0 || priv->h <= 0) { av_log(ctx, AV_LOG_ERROR, "Non-positive size values are not acceptable.\n"); - return -1; + return AVERROR(EINVAL); } return 0; @@ -47,12 +69,36 @@ static int config_props(AVFilterLink *outlink) { - NullContext *priv = outlink->src->priv; + AVFilterContext *ctx = outlink->src; + NullContext *priv = ctx->priv; + AVRational tb; + int ret; + double res; + + priv->var_values[VAR_E] = M_E; + priv->var_values[VAR_PHI] = M_PHI; + priv->var_values[VAR_PI] = M_PI; + priv->var_values[VAR_AVTB] = av_q2d(AV_TIME_BASE_Q); + + if ((ret = av_parse_and_eval_expr(&res, priv->tb_expr, var_names, priv->var_values, + NULL, NULL, NULL, NULL, NULL, 0, NULL)) < 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid expression '%s' for timebase.\n", priv->tb_expr); + return ret; + } + tb = av_d2q(res, INT_MAX); + if (tb.num <= 0 || tb.den <= 0) { + av_log(ctx, AV_LOG_ERROR, + "Invalid non-positive value for the timebase %d/%d.\n", + tb.num, tb.den); + return AVERROR(EINVAL); + } outlink->w = priv->w; outlink->h = priv->h; + outlink->time_base = tb; - av_log(outlink->src, AV_LOG_INFO, "w:%d h:%d\n", priv->w, priv->h); + av_log(outlink->src, AV_LOG_INFO, "w:%d h:%d tb:%d/%d\n", priv->w, priv->h, + tb.num, tb.den); return 0; } @@ -64,7 +110,7 @@ AVFilter avfilter_vsrc_nullsrc = { .name = "nullsrc", - .description = "Null video source, never return images.", + .description = NULL_IF_CONFIG_SMALL("Null video source, never return images."), .init = init, .priv_size = sizeof(NullContext), diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/x86/Makefile chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/x86/Makefile --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/x86/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/x86/Makefile 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1 @@ +MMX-OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif.o diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/x86/yadif.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/x86/yadif.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/x86/yadif.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/x86/yadif.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,235 @@ +/* + * Copyright (C) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "libavutil/cpu.h" +#include "libavutil/x86_cpu.h" +#include "libavfilter/yadif.h" + +#define LOAD4(mem,dst) \ + "movd "mem", "#dst" \n\t"\ + "punpcklbw %%mm7, "#dst" \n\t" + +#define PABS(tmp,dst) \ + "pxor "#tmp", "#tmp" \n\t"\ + "psubw "#dst", "#tmp" \n\t"\ + "pmaxsw "#tmp", "#dst" \n\t" + +#define CHECK(pj,mj) \ + "movq "#pj"(%[cur],%[mrefs]), %%mm2 \n\t" /* cur[x-refs-1+j] */\ + "movq "#mj"(%[cur],%[prefs]), %%mm3 \n\t" /* cur[x+refs-1-j] */\ + "movq %%mm2, %%mm4 \n\t"\ + "movq %%mm2, %%mm5 \n\t"\ + "pxor %%mm3, %%mm4 \n\t"\ + "pavgb %%mm3, %%mm5 \n\t"\ + "pand "MANGLE(pb_1)", %%mm4 \n\t"\ + "psubusb %%mm4, %%mm5 \n\t"\ + "psrlq $8, %%mm5 \n\t"\ + "punpcklbw %%mm7, %%mm5 \n\t" /* (cur[x-refs+j] + cur[x+refs-j])>>1 */\ + "movq %%mm2, %%mm4 \n\t"\ + "psubusb %%mm3, %%mm2 \n\t"\ + "psubusb %%mm4, %%mm3 \n\t"\ + "pmaxub %%mm3, %%mm2 \n\t"\ + "movq %%mm2, %%mm3 \n\t"\ + "movq %%mm2, %%mm4 \n\t" /* ABS(cur[x-refs-1+j] - cur[x+refs-1-j]) */\ + "psrlq $8, %%mm3 \n\t" /* ABS(cur[x-refs +j] - cur[x+refs -j]) */\ + "psrlq $16, %%mm4 \n\t" /* ABS(cur[x-refs+1+j] - cur[x+refs+1-j]) */\ + "punpcklbw %%mm7, %%mm2 \n\t"\ + "punpcklbw %%mm7, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm4 \n\t"\ + "paddw %%mm3, %%mm2 \n\t"\ + "paddw %%mm4, %%mm2 \n\t" /* score */ + +#define CHECK1 \ + "movq %%mm0, %%mm3 \n\t"\ + "pcmpgtw %%mm2, %%mm3 \n\t" /* if(score < spatial_score) */\ + "pminsw %%mm2, %%mm0 \n\t" /* spatial_score= score; */\ + "movq %%mm3, %%mm6 \n\t"\ + "pand %%mm3, %%mm5 \n\t"\ + "pandn %%mm1, %%mm3 \n\t"\ + "por %%mm5, %%mm3 \n\t"\ + "movq %%mm3, %%mm1 \n\t" /* spatial_pred= (cur[x-refs+j] + cur[x+refs-j])>>1; */ + +#define CHECK2 /* pretend not to have checked dir=2 if dir=1 was bad.\ + hurts both quality and speed, but matches the C version. */\ + "paddw "MANGLE(pw_1)", %%mm6 \n\t"\ + "psllw $14, %%mm6 \n\t"\ + "paddsw %%mm6, %%mm2 \n\t"\ + "movq %%mm0, %%mm3 \n\t"\ + "pcmpgtw %%mm2, %%mm3 \n\t"\ + "pminsw %%mm2, %%mm0 \n\t"\ + "pand %%mm3, %%mm5 \n\t"\ + "pandn %%mm1, %%mm3 \n\t"\ + "por %%mm5, %%mm3 \n\t"\ + "movq %%mm3, %%mm1 \n\t" + +DECLARE_ASM_CONST(16, uint64_t, pw_1) = 0x0001000100010001ULL; +DECLARE_ASM_CONST(16, uint64_t, pb_1) = 0x0101010101010101ULL; + +void ff_yadif_filter_line_mmx(uint8_t *dst, + uint8_t *prev, uint8_t *cur, uint8_t *next, + int w, int refs, int parity, int mode) +{ + uint64_t tmp0, tmp1, tmp2, tmp3; + int x; + +#define FILTER\ + for(x=0; x>1 */\ + "movq %%mm0, %[tmp0] \n\t" /* c */\ + "movq %%mm3, %[tmp1] \n\t" /* d */\ + "movq %%mm1, %[tmp2] \n\t" /* e */\ + "psubw %%mm4, %%mm2 \n\t"\ + PABS( %%mm4, %%mm2) /* temporal_diff0 */\ + LOAD4("(%[prev],%[mrefs])", %%mm3) /* prev[x-refs] */\ + LOAD4("(%[prev],%[prefs])", %%mm4) /* prev[x+refs] */\ + "psubw %%mm0, %%mm3 \n\t"\ + "psubw %%mm1, %%mm4 \n\t"\ + PABS( %%mm5, %%mm3)\ + PABS( %%mm5, %%mm4)\ + "paddw %%mm4, %%mm3 \n\t" /* temporal_diff1 */\ + "psrlw $1, %%mm2 \n\t"\ + "psrlw $1, %%mm3 \n\t"\ + "pmaxsw %%mm3, %%mm2 \n\t"\ + LOAD4("(%[next],%[mrefs])", %%mm3) /* next[x-refs] */\ + LOAD4("(%[next],%[prefs])", %%mm4) /* next[x+refs] */\ + "psubw %%mm0, %%mm3 \n\t"\ + "psubw %%mm1, %%mm4 \n\t"\ + PABS( %%mm5, %%mm3)\ + PABS( %%mm5, %%mm4)\ + "paddw %%mm4, %%mm3 \n\t" /* temporal_diff2 */\ + "psrlw $1, %%mm3 \n\t"\ + "pmaxsw %%mm3, %%mm2 \n\t"\ + "movq %%mm2, %[tmp3] \n\t" /* diff */\ +\ + "paddw %%mm0, %%mm1 \n\t"\ + "paddw %%mm0, %%mm0 \n\t"\ + "psubw %%mm1, %%mm0 \n\t"\ + "psrlw $1, %%mm1 \n\t" /* spatial_pred */\ + PABS( %%mm2, %%mm0) /* ABS(c-e) */\ +\ + "movq -1(%[cur],%[mrefs]), %%mm2 \n\t" /* cur[x-refs-1] */\ + "movq -1(%[cur],%[prefs]), %%mm3 \n\t" /* cur[x+refs-1] */\ + "movq %%mm2, %%mm4 \n\t"\ + "psubusb %%mm3, %%mm2 \n\t"\ + "psubusb %%mm4, %%mm3 \n\t"\ + "pmaxub %%mm3, %%mm2 \n\t"\ + "pshufw $9,%%mm2, %%mm3 \n\t"\ + "punpcklbw %%mm7, %%mm2 \n\t" /* ABS(cur[x-refs-1] - cur[x+refs-1]) */\ + "punpcklbw %%mm7, %%mm3 \n\t" /* ABS(cur[x-refs+1] - cur[x+refs+1]) */\ + "paddw %%mm2, %%mm0 \n\t"\ + "paddw %%mm3, %%mm0 \n\t"\ + "psubw "MANGLE(pw_1)", %%mm0 \n\t" /* spatial_score */\ +\ + CHECK(-2,0)\ + CHECK1\ + CHECK(-3,1)\ + CHECK2\ + CHECK(0,-2)\ + CHECK1\ + CHECK(1,-3)\ + CHECK2\ +\ + /* if(p->mode<2) ... */\ + "movq %[tmp3], %%mm6 \n\t" /* diff */\ + "cmpl $2, %[mode] \n\t"\ + "jge 1f \n\t"\ + LOAD4("(%["prev2"],%[mrefs],2)", %%mm2) /* prev2[x-2*refs] */\ + LOAD4("(%["next2"],%[mrefs],2)", %%mm4) /* next2[x-2*refs] */\ + LOAD4("(%["prev2"],%[prefs],2)", %%mm3) /* prev2[x+2*refs] */\ + LOAD4("(%["next2"],%[prefs],2)", %%mm5) /* next2[x+2*refs] */\ + "paddw %%mm4, %%mm2 \n\t"\ + "paddw %%mm5, %%mm3 \n\t"\ + "psrlw $1, %%mm2 \n\t" /* b */\ + "psrlw $1, %%mm3 \n\t" /* f */\ + "movq %[tmp0], %%mm4 \n\t" /* c */\ + "movq %[tmp1], %%mm5 \n\t" /* d */\ + "movq %[tmp2], %%mm7 \n\t" /* e */\ + "psubw %%mm4, %%mm2 \n\t" /* b-c */\ + "psubw %%mm7, %%mm3 \n\t" /* f-e */\ + "movq %%mm5, %%mm0 \n\t"\ + "psubw %%mm4, %%mm5 \n\t" /* d-c */\ + "psubw %%mm7, %%mm0 \n\t" /* d-e */\ + "movq %%mm2, %%mm4 \n\t"\ + "pminsw %%mm3, %%mm2 \n\t"\ + "pmaxsw %%mm4, %%mm3 \n\t"\ + "pmaxsw %%mm5, %%mm2 \n\t"\ + "pminsw %%mm5, %%mm3 \n\t"\ + "pmaxsw %%mm0, %%mm2 \n\t" /* max */\ + "pminsw %%mm0, %%mm3 \n\t" /* min */\ + "pxor %%mm4, %%mm4 \n\t"\ + "pmaxsw %%mm3, %%mm6 \n\t"\ + "psubw %%mm2, %%mm4 \n\t" /* -max */\ + "pmaxsw %%mm4, %%mm6 \n\t" /* diff= MAX3(diff, min, -max); */\ + "1: \n\t"\ +\ + "movq %[tmp1], %%mm2 \n\t" /* d */\ + "movq %%mm2, %%mm3 \n\t"\ + "psubw %%mm6, %%mm2 \n\t" /* d-diff */\ + "paddw %%mm6, %%mm3 \n\t" /* d+diff */\ + "pmaxsw %%mm2, %%mm1 \n\t"\ + "pminsw %%mm3, %%mm1 \n\t" /* d = clip(spatial_pred, d-diff, d+diff); */\ + "packuswb %%mm1, %%mm1 \n\t"\ +\ + :[tmp0]"=m"(tmp0),\ + [tmp1]"=m"(tmp1),\ + [tmp2]"=m"(tmp2),\ + [tmp3]"=m"(tmp3)\ + :[prev] "r"(prev),\ + [cur] "r"(cur),\ + [next] "r"(next),\ + [prefs]"r"((x86_reg)refs),\ + [mrefs]"r"((x86_reg)-refs),\ + [mode] "g"(mode)\ + );\ + __asm__ volatile("movd %%mm1, %0" :"=m"(*dst));\ + dst += 4;\ + prev+= 4;\ + cur += 4;\ + next+= 4;\ + } + + if (parity) { +#define prev2 "prev" +#define next2 "cur" + FILTER +#undef prev2 +#undef next2 + } else { +#define prev2 "cur" +#define next2 "next" + FILTER +#undef prev2 +#undef next2 + } +} +#undef LOAD4 +#undef PABS +#undef CHECK +#undef CHECK1 +#undef CHECK2 +#undef FILTER diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/yadif.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/yadif.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavfilter/yadif.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavfilter/yadif.h 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,28 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef AVFILTER_YADIF_H +#define AVFILTER_YADIF_H + +#include "avfilter.h" + +void ff_yadif_filter_line_mmx(uint8_t *dst, + uint8_t *prev, uint8_t *cur, uint8_t *next, + int w, int refs, int parity, int mode); + +#endif /* AVFILTER_YADIF_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/a64.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/a64.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/a64.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/a64.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,177 @@ +/* + * a64 muxer + * Copyright (c) 2009 Tobias Bindhammer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/avcodec.h" +#include "libavcodec/a64enc.h" +#include "libavcodec/bytestream.h" +#include "avformat.h" + +typedef struct A64MuxerContext { + int interleaved; + AVPacket prev_pkt; + int prev_frame_count; +} A64MuxerContext; + +static int a64_write_header(struct AVFormatContext *s) +{ + AVCodecContext *avctx = s->streams[0]->codec; + A64MuxerContext *c = s->priv_data; + uint8_t header[5] = { + 0x00, //load + 0x40, //address + 0x00, //mode + 0x00, //charset_lifetime (multi only) + 0x00 //fps in 50/fps; + }; + c->interleaved = 0; + switch (avctx->codec->id) { + case CODEC_ID_A64_MULTI: + header[2] = 0x00; + header[3] = AV_RB32(avctx->extradata+0); + header[4] = 2; + break; + case CODEC_ID_A64_MULTI5: + header[2] = 0x01; + header[3] = AV_RB32(avctx->extradata+0); + header[4] = 3; + break; + default: + return AVERROR(EINVAL); + break; + } + put_buffer(s->pb, header, 2); + c->prev_pkt.size = 0; + c->prev_frame_count = 0; + return 0; +} + +static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt) +{ + AVCodecContext *avctx = s->streams[0]->codec; + A64MuxerContext *c = s->priv_data; + int i, j; + int ch_chunksize; + int lifetime; + int frame_count; + int charset_size; + int frame_size; + int num_frames; + + /* fetch values from extradata */ + switch (avctx->codec->id) { + case CODEC_ID_A64_MULTI: + case CODEC_ID_A64_MULTI5: + if(c->interleaved) { + /* Write interleaved, means we insert chunks of the future charset before each current frame. + * Reason: if we load 1 charset + corresponding frames in one block on c64, we need to store + * them first and then display frame by frame to keep in sync. Thus we would read and write + * the data for colram from/to ram first and waste too much time. If we interleave and send the + * charset beforehand, we assemble a new charset chunk by chunk, write current screen data to + * screen-ram to be displayed and decode the colram directly to colram-location $d800 during + * the overscan, while reading directly from source. + * This is the only way so far, to achieve 25fps on c64 */ + if(avctx->extradata) { + /* fetch values from extradata */ + lifetime = AV_RB32(avctx->extradata + 0); + frame_count = AV_RB32(avctx->extradata + 4); + charset_size = AV_RB32(avctx->extradata + 8); + frame_size = AV_RB32(avctx->extradata + 12); + + /* TODO: sanity checks? */ + } else { + av_log(avctx, AV_LOG_ERROR, "extradata not set\n"); + return AVERROR(EINVAL); + } + + ch_chunksize=charset_size/lifetime; + /* TODO: check if charset/size is % lifetime, but maybe check in codec */ + + if(pkt->data) num_frames = lifetime; + else num_frames = c->prev_frame_count; + + for(i = 0; i < num_frames; i++) { + if(pkt->data) { + /* if available, put newest charset chunk into buffer */ + put_buffer(s->pb, pkt->data + ch_chunksize * i, ch_chunksize); + } else { + /* a bit ugly, but is there an alternative to put many zeros? */ + for(j = 0; j < ch_chunksize; j++) put_byte(s->pb, 0); + } + + if(c->prev_pkt.data) { + /* put frame (screen + colram) from last packet into buffer */ + put_buffer(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size); + } else { + /* a bit ugly, but is there an alternative to put many zeros? */ + for(j = 0; j < frame_size; j++) put_byte(s->pb, 0); + } + } + + /* backup current packet for next turn */ + if(pkt->data) { + /* no backup packet yet? create one! */ + if(!c->prev_pkt.data) av_new_packet(&c->prev_pkt, pkt->size); + /* we have a packet and data is big enough, reuse it */ + if(c->prev_pkt.data && c->prev_pkt.size >= pkt->size) { + memcpy(c->prev_pkt.data, pkt->data, pkt->size); + c->prev_pkt.size = pkt->size; + } else { + av_log(avctx, AV_LOG_ERROR, "Too less memory for prev_pkt.\n"); + return AVERROR(ENOMEM); + } + } + + c->prev_frame_count = frame_count; + break; + } + default: + /* Write things as is. Nice for self-contained frames from non-multicolor modes or if played + * directly from ram and not from a streaming device (rrnet/mmc) */ + if(pkt) put_buffer(s->pb, pkt->data, pkt->size); + break; + } + + put_flush_packet(s->pb); + return 0; +} + +static int a64_write_trailer(struct AVFormatContext *s) +{ + A64MuxerContext *c = s->priv_data; + AVPacket pkt = {0}; + /* need to flush last packet? */ + if(c->interleaved) a64_write_packet(s, &pkt); + /* discard backed up packet */ + if(c->prev_pkt.data) av_destruct_packet(&c->prev_pkt); + return 0; +} + +AVOutputFormat a64_muxer = { + .name = "a64", + .long_name = NULL_IF_CONFIG_SMALL("a64 - video for Commodore 64"), + .mime_type = NULL, + .extensions = "a64, A64", + .priv_data_size = sizeof (A64Context), + .video_codec = CODEC_ID_A64_MULTI, + a64_write_header, + a64_write_packet, + a64_write_trailer +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/aacdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/aacdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/aacdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/aacdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * raw ADTS AAC demuxer + * Copyright (c) 2008 Michael Niedermayer + * Copyright (c) 2009 Robert Swain ( rob opendot cl ) + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/intreadwrite.h" +#include "avformat.h" +#include "rawdec.h" +#include "id3v1.h" + + +static int adts_aac_probe(AVProbeData *p) +{ + int max_frames = 0, first_frames = 0; + int fsize, frames; + uint8_t *buf0 = p->buf; + uint8_t *buf2; + uint8_t *buf; + uint8_t *end = buf0 + p->buf_size - 7; + + buf = buf0; + + for(; buf < end; buf= buf2+1) { + buf2 = buf; + + for(frames = 0; buf2 < end; frames++) { + uint32_t header = AV_RB16(buf2); + if((header&0xFFF6) != 0xFFF0) + break; + fsize = (AV_RB32(buf2+3)>>13) & 0x8FFF; + if(fsize < 7) + break; + buf2 += fsize; + } + max_frames = FFMAX(max_frames, frames); + if(buf == buf0) + first_frames= frames; + } + if (first_frames>=3) return AVPROBE_SCORE_MAX/2+1; + else if(max_frames>500)return AVPROBE_SCORE_MAX/2; + else if(max_frames>=3) return AVPROBE_SCORE_MAX/4; + else if(max_frames>=1) return 1; + else return 0; +} + +static int adts_aac_read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + AVStream *st; + + st = av_new_stream(s, 0); + if (!st) + return AVERROR(ENOMEM); + + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + st->codec->codec_id = s->iformat->value; + st->need_parsing = AVSTREAM_PARSE_FULL; + + ff_id3v1_read(s); + + //LCM of all possible ADTS sample rates + av_set_pts_info(st, 64, 1, 28224000); + + return 0; +} + +AVInputFormat aac_demuxer = { + "aac", + NULL_IF_CONFIG_SMALL("raw ADTS AAC"), + 0, + adts_aac_probe, + adts_aac_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "aac", + .value = CODEC_ID_AAC, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/ac3dec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/ac3dec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/ac3dec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/ac3dec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,103 @@ +/* + * RAW AC-3 and E-AC-3 demuxer + * Copyright (c) 2007 Justin Ruggles + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/crc.h" +#include "libavcodec/ac3_parser.h" +#include "avformat.h" +#include "rawdec.h" + +static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id) +{ + int max_frames, first_frames = 0, frames; + uint8_t *buf, *buf2, *end; + AC3HeaderInfo hdr; + GetBitContext gbc; + enum CodecID codec_id = CODEC_ID_AC3; + + max_frames = 0; + buf = p->buf; + end = buf + p->buf_size; + + for(; buf < end; buf++) { + buf2 = buf; + + for(frames = 0; buf2 < end; frames++) { + init_get_bits(&gbc, buf2, 54); + if(ff_ac3_parse_header(&gbc, &hdr) < 0) + break; + if(buf2 + hdr.frame_size > end || + av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2)) + break; + if (hdr.bitstream_id > 10) + codec_id = CODEC_ID_EAC3; + buf2 += hdr.frame_size; + } + max_frames = FFMAX(max_frames, frames); + if(buf == p->buf) + first_frames = frames; + } + if(codec_id != expected_codec_id) return 0; + // keep this in sync with mp3 probe, both need to avoid + // issues with MPEG-files! + if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1; + else if(max_frames>500)return AVPROBE_SCORE_MAX/2; + else if(max_frames>=4) return AVPROBE_SCORE_MAX/4; + else if(max_frames>=1) return 1; + else return 0; +} + +#if CONFIG_AC3_DEMUXER +static int ac3_probe(AVProbeData *p) +{ + return ac3_eac3_probe(p, CODEC_ID_AC3); +} + +AVInputFormat ac3_demuxer = { + "ac3", + NULL_IF_CONFIG_SMALL("raw AC-3"), + 0, + ac3_probe, + ff_raw_audio_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "ac3", + .value = CODEC_ID_AC3, +}; +#endif + +#if CONFIG_EAC3_DEMUXER +static int eac3_probe(AVProbeData *p) +{ + return ac3_eac3_probe(p, CODEC_ID_EAC3); +} + +AVInputFormat eac3_demuxer = { + "eac3", + NULL_IF_CONFIG_SMALL("raw E-AC-3"), + 0, + eac3_probe, + ff_raw_audio_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "eac3", + .value = CODEC_ID_EAC3, +}; +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/aea.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/aea.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/aea.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/aea.c 2010-11-06 17:21:29.000000000 +0000 @@ -21,7 +21,7 @@ */ #include "avformat.h" -#include "raw.h" +#include "pcm.h" #include "libavutil/intreadwrite.h" #define AT1_SU_SIZE 212 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/aiffdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/aiffdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/aiffdec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/aiffdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -21,7 +21,7 @@ #include "libavutil/intfloat_readwrite.h" #include "avformat.h" -#include "raw.h" +#include "pcm.h" #include "aiff.h" #define AIFF 0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/allformats.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/allformats.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/allformats.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/allformats.c 2010-11-06 17:21:29.000000000 +0000 @@ -47,6 +47,7 @@ avcodec_register_all(); /* (de)muxers */ + REGISTER_MUXER (A64, a64); REGISTER_DEMUXER (AAC, aac); REGISTER_MUXDEMUX (AC3, ac3); REGISTER_MUXER (ADTS, adts); @@ -56,6 +57,7 @@ REGISTER_DEMUXER (ANM, anm); REGISTER_DEMUXER (APC, apc); REGISTER_DEMUXER (APE, ape); + REGISTER_DEMUXER (APPLEHTTP, applehttp); REGISTER_MUXDEMUX (ASF, asf); REGISTER_MUXDEMUX (ASS, ass); REGISTER_MUXER (ASF_STREAM, asf_stream); @@ -90,6 +92,7 @@ REGISTER_DEMUXER (FOURXM, fourxm); REGISTER_MUXER (FRAMECRC, framecrc); REGISTER_MUXER (FRAMEMD5, framemd5); + REGISTER_MUXDEMUX (G722, g722); REGISTER_MUXER (GIF, gif); REGISTER_DEMUXER (GSM, gsm); REGISTER_MUXDEMUX (GXF, gxf); @@ -107,6 +110,7 @@ REGISTER_DEMUXER (IV8, iv8); REGISTER_DEMUXER (IVF, ivf); REGISTER_DEMUXER (LMLM4, lmlm4); + REGISTER_DEMUXER (LXF, lxf); REGISTER_MUXDEMUX (M4V, m4v); REGISTER_MUXER (MD5, md5); REGISTER_MUXDEMUX (MATROSKA, matroska); @@ -175,10 +179,11 @@ REGISTER_MUXDEMUX (ROQ, roq); REGISTER_DEMUXER (RPL, rpl); REGISTER_MUXDEMUX (RSO, rso); - REGISTER_MUXER (RTP, rtp); + REGISTER_MUXDEMUX (RTP, rtp); REGISTER_MUXDEMUX (RTSP, rtsp); + REGISTER_MUXDEMUX (SAP, sap); REGISTER_DEMUXER (SDP, sdp); -#if CONFIG_SDP_DEMUXER +#if CONFIG_RTPDEC av_register_rtp_dynamic_payload_handlers(); av_register_rdt_dynamic_payload_handlers(); #endif @@ -225,6 +230,7 @@ REGISTER_PROTOCOL (FILE, file); REGISTER_PROTOCOL (GOPHER, gopher); REGISTER_PROTOCOL (HTTP, http); + REGISTER_PROTOCOL (MMSH, mmsh); REGISTER_PROTOCOL (MMST, mmst); REGISTER_PROTOCOL (MD5, md5); REGISTER_PROTOCOL (PIPE, pipe); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/amr.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/amr.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/amr.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/amr.c 2010-11-06 17:21:29.000000000 +0000 @@ -100,12 +100,14 @@ st->codec->codec_tag = MKTAG('s', 'a', 'w', 'b'); st->codec->codec_id = CODEC_ID_AMR_WB; st->codec->sample_rate = 16000; + st->codec->frame_size = 320; } else { st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r'); st->codec->codec_id = CODEC_ID_AMR_NB; st->codec->sample_rate = 8000; + st->codec->frame_size = 160; } st->codec->channels = 1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/applehttp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/applehttp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/applehttp.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/applehttp.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,591 @@ +/* + * Apple HTTP Live Streaming demuxer + * Copyright (c) 2010 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Apple HTTP Live Streaming demuxer + * http://tools.ietf.org/html/draft-pantos-http-live-streaming + */ + +#define _XOPEN_SOURCE 600 +#include "libavutil/avstring.h" +#include "avformat.h" +#include "internal.h" +#include + +/* + * An apple http stream consists of a playlist with media segment files, + * played sequentially. There may be several playlists with the same + * video content, in different bandwidth variants, that are played in + * parallel (preferrably only one bandwidth variant at a time). In this case, + * the user supplied the url to a main playlist that only lists the variant + * playlists. + * + * If the main playlist doesn't point at any variants, we still create + * one anonymous toplevel variant for this, to maintain the structure. + */ + +struct segment { + int duration; + char url[MAX_URL_SIZE]; +}; + +/* + * Each variant has its own demuxer. If it currently is active, + * it has an open ByteIOContext too, and potentially an AVPacket + * containing the next packet from this stream. + */ +struct variant { + int bandwidth; + char url[MAX_URL_SIZE]; + ByteIOContext *pb; + AVFormatContext *ctx; + AVPacket pkt; + int stream_offset; + + int start_seq_no; + int n_segments; + struct segment **segments; + int needed; +}; + +typedef struct AppleHTTPContext { + int target_duration; + int finished; + int n_variants; + struct variant **variants; + int cur_seq_no; + int64_t last_load_time; + int64_t last_packet_dts; + int max_start_seq, min_end_seq; +} AppleHTTPContext; + +static int read_chomp_line(ByteIOContext *s, char *buf, int maxlen) +{ + int len = ff_get_line(s, buf, maxlen); + while (len > 0 && isspace(buf[len - 1])) + buf[--len] = '\0'; + return len; +} + +static void make_absolute_url(char *buf, int size, const char *base, + const char *rel) +{ + char *sep; + /* If rel actually is an absolute url, just copy it */ + if (!base || strstr(rel, "://") || rel[0] == '/') { + av_strlcpy(buf, rel, size); + return; + } + if (base != buf) + av_strlcpy(buf, base, size); + /* Remove the file name from the base url */ + sep = strrchr(buf, '/'); + if (sep) + sep[1] = '\0'; + else + buf[0] = '\0'; + while (av_strstart(rel, "../", NULL) && sep) { + /* Remove the path delimiter at the end */ + sep[0] = '\0'; + sep = strrchr(buf, '/'); + /* If the next directory name to pop off is "..", break here */ + if (!strcmp(sep ? &sep[1] : buf, "..")) { + /* Readd the slash we just removed */ + av_strlcat(buf, "/", size); + break; + } + /* Cut off the directory name */ + if (sep) + sep[1] = '\0'; + else + buf[0] = '\0'; + rel += 3; + } + av_strlcat(buf, rel, size); +} + +static void free_segment_list(struct variant *var) +{ + int i; + for (i = 0; i < var->n_segments; i++) + av_free(var->segments[i]); + av_freep(&var->segments); + var->n_segments = 0; +} + +static void free_variant_list(AppleHTTPContext *c) +{ + int i; + for (i = 0; i < c->n_variants; i++) { + struct variant *var = c->variants[i]; + free_segment_list(var); + av_free_packet(&var->pkt); + if (var->pb) + url_fclose(var->pb); + if (var->ctx) { + var->ctx->pb = NULL; + av_close_input_file(var->ctx); + } + av_free(var); + } + av_freep(&c->variants); + c->n_variants = 0; +} + +/* + * Used to reset a statically allocated AVPacket to a clean slate, + * containing no data. + */ +static void reset_packet(AVPacket *pkt) +{ + av_init_packet(pkt); + pkt->data = NULL; +} + +static struct variant *new_variant(AppleHTTPContext *c, int bandwidth, + const char *url, const char *base) +{ + struct variant *var = av_mallocz(sizeof(struct variant)); + if (!var) + return NULL; + reset_packet(&var->pkt); + var->bandwidth = bandwidth; + make_absolute_url(var->url, sizeof(var->url), base, url); + dynarray_add(&c->variants, &c->n_variants, var); + return var; +} + +struct variant_info { + char bandwidth[20]; +}; + +static void handle_variant_args(struct variant_info *info, const char *key, + int key_len, char **dest, int *dest_len) +{ + if (strncmp(key, "BANDWIDTH", key_len)) { + *dest = info->bandwidth; + *dest_len = sizeof(info->bandwidth); + } +} + +static int parse_playlist(AppleHTTPContext *c, const char *url, + struct variant *var, ByteIOContext *in) +{ + int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0; + char line[1024]; + const char *ptr; + int close_in = 0; + + if (!in) { + close_in = 1; + if ((ret = url_fopen(&in, url, URL_RDONLY)) < 0) + return ret; + } + + read_chomp_line(in, line, sizeof(line)); + if (strcmp(line, "#EXTM3U")) { + ret = AVERROR_INVALIDDATA; + goto fail; + } + + if (var) + free_segment_list(var); + c->finished = 0; + while (!url_feof(in)) { + read_chomp_line(in, line, sizeof(line)); + if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) { + struct variant_info info = {{0}}; + is_variant = 1; + ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args, + &info); + bandwidth = atoi(info.bandwidth); + } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) { + c->target_duration = atoi(ptr); + } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) { + if (!var) { + var = new_variant(c, 0, url, NULL); + if (!var) { + ret = AVERROR(ENOMEM); + goto fail; + } + } + var->start_seq_no = atoi(ptr); + } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) { + c->finished = 1; + } else if (av_strstart(line, "#EXTINF:", &ptr)) { + is_segment = 1; + duration = atoi(ptr); + } else if (av_strstart(line, "#", NULL)) { + continue; + } else if (line[0]) { + if (is_variant) { + if (!new_variant(c, bandwidth, line, url)) { + ret = AVERROR(ENOMEM); + goto fail; + } + is_variant = 0; + bandwidth = 0; + } + if (is_segment) { + struct segment *seg; + if (!var) { + var = new_variant(c, 0, url, NULL); + if (!var) { + ret = AVERROR(ENOMEM); + goto fail; + } + } + seg = av_malloc(sizeof(struct segment)); + if (!seg) { + ret = AVERROR(ENOMEM); + goto fail; + } + seg->duration = duration; + make_absolute_url(seg->url, sizeof(seg->url), url, line); + dynarray_add(&var->segments, &var->n_segments, seg); + is_segment = 0; + } + } + } + c->last_load_time = av_gettime(); + +fail: + if (close_in) + url_fclose(in); + return ret; +} + +static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) +{ + AppleHTTPContext *c = s->priv_data; + int ret = 0, i, j, stream_offset = 0; + + if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0) + goto fail; + + if (c->n_variants == 0) { + av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); + ret = AVERROR_EOF; + goto fail; + } + /* If the playlist only contained variants, parse each individual + * variant playlist. */ + if (c->n_variants > 1 || c->variants[0]->n_segments == 0) { + for (i = 0; i < c->n_variants; i++) { + struct variant *v = c->variants[i]; + if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) + goto fail; + } + } + + if (c->variants[0]->n_segments == 0) { + av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); + ret = AVERROR_EOF; + goto fail; + } + + /* If this isn't a live stream, calculate the total duration of the + * stream. */ + if (c->finished) { + int duration = 0; + for (i = 0; i < c->variants[0]->n_segments; i++) + duration += c->variants[0]->segments[i]->duration; + s->duration = duration * AV_TIME_BASE; + } + + c->min_end_seq = INT_MAX; + /* Open the demuxer for each variant */ + for (i = 0; i < c->n_variants; i++) { + struct variant *v = c->variants[i]; + if (v->n_segments == 0) + continue; + c->max_start_seq = FFMAX(c->max_start_seq, v->start_seq_no); + c->min_end_seq = FFMIN(c->min_end_seq, v->start_seq_no + + v->n_segments); + ret = av_open_input_file(&v->ctx, v->segments[0]->url, NULL, 0, NULL); + if (ret < 0) + goto fail; + url_fclose(v->ctx->pb); + v->ctx->pb = NULL; + v->stream_offset = stream_offset; + /* Create new AVStreams for each stream in this variant */ + for (j = 0; j < v->ctx->nb_streams; j++) { + AVStream *st = av_new_stream(s, i); + if (!st) { + ret = AVERROR(ENOMEM); + goto fail; + } + avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); + } + stream_offset += v->ctx->nb_streams; + } + c->last_packet_dts = AV_NOPTS_VALUE; + + c->cur_seq_no = c->max_start_seq; + /* If this is a live stream with more than 3 segments, start at the + * third last segment. */ + if (!c->finished && c->min_end_seq - c->max_start_seq > 3) + c->cur_seq_no = c->min_end_seq - 2; + + return 0; +fail: + free_variant_list(c); + return ret; +} + +static int open_variant(AppleHTTPContext *c, struct variant *var, int skip) +{ + int ret; + + if (c->cur_seq_no < var->start_seq_no) { + av_log(NULL, AV_LOG_WARNING, + "seq %d not available in variant %s, skipping\n", + var->start_seq_no, var->url); + return 0; + } + if (c->cur_seq_no - var->start_seq_no >= var->n_segments) + return c->finished ? AVERROR_EOF : 0; + ret = url_fopen(&var->pb, + var->segments[c->cur_seq_no - var->start_seq_no]->url, + URL_RDONLY); + if (ret < 0) + return ret; + var->ctx->pb = var->pb; + /* If this is a new segment in parallel with another one already opened, + * skip ahead so they're all at the same dts. */ + if (skip && c->last_packet_dts != AV_NOPTS_VALUE) { + while (1) { + ret = av_read_frame(var->ctx, &var->pkt); + if (ret < 0) { + if (ret == AVERROR_EOF) { + reset_packet(&var->pkt); + return 0; + } + return ret; + } + if (var->pkt.dts >= c->last_packet_dts) + break; + av_free_packet(&var->pkt); + } + } + return 0; +} + +static int applehttp_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + AppleHTTPContext *c = s->priv_data; + int ret, i, minvariant = -1, first = 1, needed = 0, changed = 0, + variants = 0; + + /* Recheck the discard flags - which streams are desired at the moment */ + for (i = 0; i < c->n_variants; i++) + c->variants[i]->needed = 0; + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + struct variant *var = c->variants[s->streams[i]->id]; + if (st->discard < AVDISCARD_ALL) { + var->needed = 1; + needed++; + } + /* Copy the discard flag to the chained demuxer, to indicate which + * streams are desired. */ + var->ctx->streams[i - var->stream_offset]->discard = st->discard; + } + if (!needed) + return AVERROR_EOF; +start: + for (i = 0; i < c->n_variants; i++) { + struct variant *var = c->variants[i]; + /* Close unneeded streams, open newly requested streams */ + if (var->pb && !var->needed) { + av_log(s, AV_LOG_DEBUG, + "Closing variant stream %d, no longer needed\n", i); + av_free_packet(&var->pkt); + reset_packet(&var->pkt); + url_fclose(var->pb); + var->pb = NULL; + changed = 1; + } else if (!var->pb && var->needed) { + if (first) + av_log(s, AV_LOG_DEBUG, "Opening variant stream %d\n", i); + if (first && !c->finished) + if ((ret = parse_playlist(c, var->url, var, NULL)) < 0) + return ret; + ret = open_variant(c, var, first); + if (ret < 0) + return ret; + changed = 1; + } + /* Count the number of open variants */ + if (var->pb) + variants++; + /* Make sure we've got one buffered packet from each open variant + * stream */ + if (var->pb && !var->pkt.data) { + ret = av_read_frame(var->ctx, &var->pkt); + if (ret < 0) { + if (!url_feof(var->pb)) + return ret; + reset_packet(&var->pkt); + } + } + /* Check if this stream has the packet with the lowest dts */ + if (var->pkt.data) { + if (minvariant < 0 || + var->pkt.dts < c->variants[minvariant]->pkt.dts) + minvariant = i; + } + } + if (first && changed) + av_log(s, AV_LOG_INFO, "Receiving %d variant streams\n", variants); + /* If we got a packet, return it */ + if (minvariant >= 0) { + *pkt = c->variants[minvariant]->pkt; + pkt->stream_index += c->variants[minvariant]->stream_offset; + reset_packet(&c->variants[minvariant]->pkt); + c->last_packet_dts = pkt->dts; + return 0; + } + /* No more packets - eof reached in all variant streams, close the + * current segments. */ + for (i = 0; i < c->n_variants; i++) { + struct variant *var = c->variants[i]; + if (var->pb) { + url_fclose(var->pb); + var->pb = NULL; + } + } + /* Indicate that we're opening the next segment, not opening a new + * variant stream in parallel, so we shouldn't try to skip ahead. */ + first = 0; + c->cur_seq_no++; +reload: + if (!c->finished) { + /* If this is a live stream and target_duration has elapsed since + * the last playlist reload, reload the variant playlists now. */ + int64_t now = av_gettime(); + if (now - c->last_load_time >= c->target_duration*1000000) { + c->max_start_seq = 0; + c->min_end_seq = INT_MAX; + for (i = 0; i < c->n_variants; i++) { + struct variant *var = c->variants[i]; + if (var->needed) { + if ((ret = parse_playlist(c, var->url, var, NULL)) < 0) + return ret; + c->max_start_seq = FFMAX(c->max_start_seq, + var->start_seq_no); + c->min_end_seq = FFMIN(c->min_end_seq, + var->start_seq_no + var->n_segments); + } + } + } + } + if (c->cur_seq_no < c->max_start_seq) { + av_log(NULL, AV_LOG_WARNING, + "skipping %d segments ahead, expired from playlists\n", + c->max_start_seq - c->cur_seq_no); + c->cur_seq_no = c->max_start_seq; + } + /* If more segments exit, open the next one */ + if (c->cur_seq_no < c->min_end_seq) + goto start; + /* We've reached the end of the playlists - return eof if this is a + * non-live stream, wait until the next playlist reload if it is live. */ + if (c->finished) + return AVERROR_EOF; + while (av_gettime() - c->last_load_time < c->target_duration*1000000) { + if (url_interrupt_cb()) + return AVERROR(EINTR); + usleep(100*1000); + } + /* Enough time has elapsed since the last reload */ + goto reload; +} + +static int applehttp_close(AVFormatContext *s) +{ + AppleHTTPContext *c = s->priv_data; + + free_variant_list(c); + return 0; +} + +static int applehttp_read_seek(AVFormatContext *s, int stream_index, + int64_t timestamp, int flags) +{ + AppleHTTPContext *c = s->priv_data; + int pos = 0, i; + struct variant *var = c->variants[0]; + + if ((flags & AVSEEK_FLAG_BYTE) || !c->finished) + return AVERROR(ENOSYS); + + /* Reset the variants */ + c->last_packet_dts = AV_NOPTS_VALUE; + for (i = 0; i < c->n_variants; i++) { + struct variant *var = c->variants[i]; + if (var->pb) { + url_fclose(var->pb); + var->pb = NULL; + } + av_free_packet(&var->pkt); + reset_packet(&var->pkt); + } + + timestamp = av_rescale_rnd(timestamp, 1, stream_index >= 0 ? + s->streams[stream_index]->time_base.den : + AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ? + AV_ROUND_DOWN : AV_ROUND_UP); + /* Locate the segment that contains the target timestamp */ + for (i = 0; i < var->n_segments; i++) { + if (timestamp >= pos && timestamp < pos + var->segments[i]->duration) { + c->cur_seq_no = var->start_seq_no + i; + return 0; + } + pos += var->segments[i]->duration; + } + return AVERROR(EIO); +} + +static int applehttp_probe(AVProbeData *p) +{ + /* Require #EXTM3U at the start, and either one of the ones below + * somewhere for a proper match. */ + if (strncmp(p->buf, "#EXTM3U", 7)) + return 0; + if (strstr(p->buf, "#EXT-X-STREAM-INF:") || + strstr(p->buf, "#EXT-X-TARGETDURATION:") || + strstr(p->buf, "#EXT-X-MEDIA-SEQUENCE:")) + return AVPROBE_SCORE_MAX; + return 0; +} + +AVInputFormat applehttp_demuxer = { + "applehttp", + NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming format"), + sizeof(AppleHTTPContext), + applehttp_probe, + applehttp_read_header, + applehttp_read_packet, + applehttp_close, + applehttp_read_seek, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/asfcrypt.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/asfcrypt.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/asfcrypt.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/asfcrypt.c 2010-11-06 17:21:29.000000000 +0000 @@ -139,7 +139,7 @@ struct AVDES des; struct AVRC4 rc4; int num_qwords = len >> 3; - uint64_t *qwords = (uint64_t *)data; + uint8_t *qwords = data; uint64_t rc4buff[8]; uint64_t packetkey; uint32_t ms_keys[12]; @@ -156,7 +156,7 @@ av_rc4_crypt(&rc4, (uint8_t *)rc4buff, NULL, sizeof(rc4buff), NULL, 1); multiswap_init((uint8_t *)rc4buff, ms_keys); - packetkey = qwords[num_qwords - 1]; + packetkey = AV_RN64(&qwords[num_qwords*8 - 8]); packetkey ^= rc4buff[7]; av_des_init(&des, key + 12, 64, 1); av_des_crypt(&des, (uint8_t *)&packetkey, (uint8_t *)&packetkey, 1, NULL, 1); @@ -166,7 +166,7 @@ av_rc4_crypt(&rc4, data, data, len, NULL, 1); ms_state = 0; - for (i = 0; i < num_qwords - 1; i++, qwords++) + for (i = 0; i < num_qwords - 1; i++, qwords += 8) ms_state = multiswap_enc(ms_keys, ms_state, AV_RL64(qwords)); multiswap_invert_keys(ms_keys); packetkey = (packetkey << 32) | (packetkey >> 32); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/asfdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/asfdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/asfdec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/asfdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -467,7 +467,16 @@ value_len = get_le16(pb); if (!value_type && value_len%2) value_len += 1; - get_tag(s, name, value_type, value_len); + /** + * My sample has that stream set to 0 maybe that mean the container. + * Asf stream count start at 1. I am using 0 to the container value since it's unused + */ + if (!strcmp(name, "AspectRatioX")){ + dar[0].num= get_value(s->pb, value_type); + } else if(!strcmp(name, "AspectRatioY")){ + dar[0].den= get_value(s->pb, value_type); + } else + get_tag(s, name, value_type, value_len); } } else if (!guidcmp(&g, &ff_asf_metadata_header)) { int n, stream_num, name_len, value_len, value_type, value_num; @@ -626,11 +635,16 @@ AVStream *st = s->streams[stream_num]; if (!st->codec->bit_rate) st->codec->bit_rate = bitrate[i]; - if (dar[i].num > 0 && dar[i].den > 0) + if (dar[i].num > 0 && dar[i].den > 0){ av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, dar[i].num, dar[i].den, INT_MAX); -//av_log(s, AV_LOG_ERROR, "dar %d:%d sar=%d:%d\n", dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); + } else if ((dar[0].num > 0) && (dar[0].den > 0) && (st->codec->codec_type==AVMEDIA_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set. + av_reduce(&st->sample_aspect_ratio.num, + &st->sample_aspect_ratio.den, + dar[0].num, dar[0].den, INT_MAX); + +//av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); // copy and convert language codes to the frontend if (asf->streams[i].stream_language_index < 128) { @@ -645,6 +659,8 @@ } } + ff_metadata_conv(&s->metadata, NULL, ff_asf_metadata_conv); + return 0; } @@ -1221,5 +1237,4 @@ asf_read_close, asf_read_seek, asf_read_pts, - .metadata_conv = ff_asf_metadata_conv, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/asfenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/asfenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/asfenc.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/asfenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -279,6 +279,8 @@ int bit_rate; int64_t duration; + ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL); + tags[0] = av_metadata_get(s->metadata, "title" , NULL, 0); tags[1] = av_metadata_get(s->metadata, "author" , NULL, 0); tags[2] = av_metadata_get(s->metadata, "copyright", NULL, 0); @@ -870,7 +872,6 @@ asf_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag= (const AVCodecTag* const []){codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0}, - .metadata_conv = ff_asf_metadata_conv, }; #endif @@ -892,6 +893,5 @@ asf_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag= (const AVCodecTag* const []){codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0}, - .metadata_conv = ff_asf_metadata_conv, }; #endif //CONFIG_ASF_STREAM_MUXER diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/au.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/au.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/au.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/au.c 2010-11-06 17:21:29.000000000 +0000 @@ -28,7 +28,7 @@ */ #include "avformat.h" -#include "raw.h" +#include "pcm.h" #include "riff.h" /* if we don't know the size in advance */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avformat.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avformat.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avformat.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avformat.h 2010-11-06 17:21:29.000000000 +0000 @@ -22,8 +22,8 @@ #define AVFORMAT_AVFORMAT_H #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 78 -#define LIBAVFORMAT_VERSION_MICRO 1 +#define LIBAVFORMAT_VERSION_MINOR 84 +#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ @@ -36,6 +36,56 @@ #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) /** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_MAX_STREAMS +#define FF_API_MAX_STREAMS (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_OLD_METADATA +#define FF_API_OLD_METADATA (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_URL_CLASS +#define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) +#endif +#ifndef FF_API_URL_RESETBUF +#define FF_API_URL_RESETBUF (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_REGISTER_PROTOCOL +#define FF_API_REGISTER_PROTOCOL (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_GUESS_FORMAT +#define FF_API_GUESS_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_UDP_GET_FILE +#define FF_API_UDP_GET_FILE (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_URL_SPLIT +#define FF_API_URL_SPLIT (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_ALLOC_FORMAT_CONTEXT +#define FF_API_ALLOC_FORMAT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_PARSE_FRAME_PARAM +#define FF_API_PARSE_FRAME_PARAM (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_READ_SEEK +#define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_LAVF_UNUSED +#define FF_API_LAVF_UNUSED (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_PARAMETERS_CODEC_ID +#define FF_API_PARAMETERS_CODEC_ID (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_FIRST_FORMAT +#define FF_API_FIRST_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_SYMVER +#define FF_API_SYMVER (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif + +/** * I return the LIBAVFORMAT_VERSION_INT constant. You got * a fucking problem with that, douchebag? */ @@ -87,10 +137,9 @@ * sorting will have '-sort' appended. E.g. artist="The Beatles", * artist-sort="Beatles, The". * - * 4. Tag names are normally exported exactly as stored in the container to - * allow lossless remuxing to the same format. For container-independent - * handling of metadata, av_metadata_conv() can convert it to ffmpeg generic - * format. Follows a list of generic tag names: + * 4. Demuxers attempt to export metadata in a generic format, however tags + * with no generic equivalents are left as they are stored in the container. + * Follows a list of generic tag names: * * album -- name of the set this work belongs to * album_artist -- main creator of the set/album, if different from artist. @@ -127,10 +176,13 @@ }AVMetadataTag; typedef struct AVMetadata AVMetadata; +#if FF_API_OLD_METADATA typedef struct AVMetadataConv AVMetadataConv; +#endif /** * Get a metadata element with matching key. + * * @param prev Set to the previous matching element to find the next. * If set to NULL the first matching element is returned. * @param flags Allows case as well as suffix-insensitive comparisons. @@ -139,11 +191,14 @@ AVMetadataTag * av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags); -#if LIBAVFORMAT_VERSION_MAJOR == 52 +#if FF_API_OLD_METADATA /** - * Set the given tag in m, overwriting an existing tag. - * @param key tag key to add to m (will be av_strduped) - * @param value tag value to add to m (will be av_strduped) + * Set the given tag in *pm, overwriting an existing tag. + * + * @param pm pointer to a pointer to a metadata struct. If *pm is NULL + * a metadata struct is allocated and put in *pm. + * @param key tag key to add to *pm (will be av_strduped) + * @param value tag value to add to *pm (will be av_strduped) * @return >= 0 on success otherwise an error code <0 * @deprecated Use av_metadata_set2() instead. */ @@ -151,23 +206,24 @@ #endif /** - * Set the given tag in m, overwriting an existing tag. - * @param key tag key to add to m (will be av_strduped depending on flags) - * @param value tag value to add to m (will be av_strduped depending on flags). + * Set the given tag in *pm, overwriting an existing tag. + * + * @param pm pointer to a pointer to a metadata struct. If *pm is NULL + * a metadata struct is allocated and put in *pm. + * @param key tag key to add to *pm (will be av_strduped depending on flags) + * @param value tag value to add to *pm (will be av_strduped depending on flags). * Passing a NULL value will cause an existing tag to be deleted. * @return >= 0 on success otherwise an error code <0 */ int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags); +#if FF_API_OLD_METADATA /** - * Convert all the metadata sets from ctx according to the source and - * destination conversion tables. If one of the tables is NULL, then - * tags are converted to/from ffmpeg generic tag names. - * @param d_conv destination tags format conversion table - * @param s_conv source tags format conversion table + * This function is provided for compatibility reason and currently does nothing. */ -void av_metadata_conv(struct AVFormatContext *ctx,const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv); +attribute_deprecated void av_metadata_conv(struct AVFormatContext *ctx, const AVMetadataConv *d_conv, + const AVMetadataConv *s_conv); +#endif /** * Free all the memory allocated for an AVMetadata struct. @@ -233,9 +289,9 @@ unsigned int initial_pause:1; /**< Do not begin to play the stream immediately (RTSP only). */ unsigned int prealloced_context:1; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - enum CodecID video_codec_id; - enum CodecID audio_codec_id; +#if FF_API_PARAMETERS_CODEC_ID + attribute_deprecated enum CodecID video_codec_id; + attribute_deprecated enum CodecID audio_codec_id; #endif } AVFormatParameters; @@ -291,7 +347,9 @@ enum CodecID subtitle_codec; /**< default subtitle codec */ +#if FF_API_OLD_METADATA const AVMetadataConv *metadata_conv; +#endif /* private fields */ struct AVOutputFormat *next; @@ -335,7 +393,8 @@ /** * Read one packet and put it in 'pkt'. pts and flags are also * set. 'av_new_stream' can be called only if the flag - * AVFMTCTX_NOHEADER is used. + * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a + * background thread). * @return 0 on success, < 0 on error. * When returning an error, pkt must not have been allocated * or must be freed before returning @@ -348,7 +407,7 @@ */ int (*read_close)(struct AVFormatContext *); -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_READ_SEEK /** * Seek to a given timestamp relative to the frames in * stream component stream_index. @@ -357,8 +416,8 @@ * match is available. * @return >= 0 on success (but not necessarily the new offset) */ - int (*read_seek)(struct AVFormatContext *, - int stream_index, int64_t timestamp, int flags); + attribute_deprecated int (*read_seek)(struct AVFormatContext *, + int stream_index, int64_t timestamp, int flags); #endif /** * Gets the next timestamp in stream[stream_index].time_base units. @@ -406,7 +465,9 @@ */ int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); +#if FF_API_OLD_METADATA const AVMetadataConv *metadata_conv; +#endif /* private fields */ struct AVInputFormat *next; @@ -508,8 +569,8 @@ */ int64_t duration; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char language[4]; /**< ISO 639-2/B 3-letter language code (empty string if undefined) */ +#if FF_API_OLD_METADATA + attribute_deprecated char language[4]; /**< ISO 639-2/B 3-letter language code (empty string if undefined) */ #endif /* av_read_frame() support */ @@ -527,10 +588,12 @@ int64_t nb_frames; ///< number of frames in this stream if known or 0 -#if LIBAVFORMAT_VERSION_INT < (53<<16) - int64_t unused[4+1]; +#if FF_API_LAVF_UNUSED + attribute_deprecated int64_t unused[4+1]; +#endif - char *filename; /**< source filename of the stream */ +#if FF_API_OLD_METADATA + attribute_deprecated char *filename; /**< source filename of the stream */ #endif int disposition; /**< AV_DISPOSITION_* bit field */ @@ -586,6 +649,18 @@ * Number of frames that have been demuxed during av_find_stream_info() */ int codec_info_nb_frames; + + /** + * Stream informations used internally by av_find_stream_info() + */ +#define MAX_STD_TIMEBASES (60*12+5) + struct { + int64_t last_dts; + int64_t duration_gcd; + int duration_count; + double duration_error[MAX_STD_TIMEBASES]; + int64_t codec_info_duration; + } *info; } AVStream; #define AV_PROGRAM_RUNNING 1 @@ -598,9 +673,9 @@ */ typedef struct AVProgram { int id; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char *provider_name; ///< network name for DVB streams - char *name; ///< service name for DVB streams +#if FF_API_OLD_METADATA + attribute_deprecated char *provider_name; ///< network name for DVB streams + attribute_deprecated char *name; ///< service name for DVB streams #endif int flags; enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller @@ -616,13 +691,13 @@ int id; ///< unique ID to identify the chapter AVRational time_base; ///< time base in which the start/end timestamps are specified int64_t start, end; ///< chapter start/end time in time_base units -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char *title; ///< chapter title +#if FF_API_OLD_METADATA + attribute_deprecated char *title; ///< chapter title #endif AVMetadata *metadata; } AVChapter; -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_MAX_STREAMS #define MAX_STREAMS 20 #endif @@ -641,19 +716,23 @@ void *priv_data; ByteIOContext *pb; unsigned int nb_streams; +#if FF_API_MAX_STREAMS AVStream *streams[MAX_STREAMS]; +#else + AVStream **streams; +#endif char filename[1024]; /**< input or output filename */ /* stream info */ int64_t timestamp; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char title[512]; - char author[512]; - char copyright[512]; - char comment[512]; - char album[512]; - int year; /**< ID3 year, 0 if none */ - int track; /**< track number, 0 if none */ - char genre[32]; /**< ID3 genre */ +#if FF_API_OLD_METADATA + attribute_deprecated char title[512]; + attribute_deprecated char author[512]; + attribute_deprecated char copyright[512]; + attribute_deprecated char comment[512]; + attribute_deprecated char album[512]; + attribute_deprecated int year; /**< ID3 year, 0 if none */ + attribute_deprecated int track; /**< track number, 0 if none */ + attribute_deprecated char genre[32]; /**< ID3 genre */ #endif int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ @@ -694,7 +773,7 @@ /* av_read_frame() support */ AVStream *cur_st; -#if LIBAVFORMAT_VERSION_INT < (53<<16) +#if FF_API_LAVF_UNUSED const uint8_t *cur_ptr_deprecated; int cur_len_deprecated; AVPacket cur_pkt_deprecated; @@ -824,9 +903,9 @@ struct AVPacketList *next; } AVPacketList; -#if LIBAVFORMAT_VERSION_INT < (53<<16) -extern AVInputFormat *first_iformat; -extern AVOutputFormat *first_oformat; +#if FF_API_FIRST_FORMAT +attribute_deprecated extern AVInputFormat *first_iformat; +attribute_deprecated extern AVOutputFormat *first_oformat; #endif /** @@ -851,7 +930,7 @@ /* utils.c */ void av_register_input_format(AVInputFormat *format); void av_register_output_format(AVOutputFormat *format); -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_GUESS_FORMAT attribute_deprecated AVOutputFormat *guess_stream_format(const char *short_name, const char *filename, const char *mime_type); @@ -1015,7 +1094,7 @@ int buf_size, AVFormatParameters *ap); -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_ALLOC_FORMAT_CONTEXT /** * @deprecated Use avformat_alloc_context() instead. */ @@ -1058,6 +1137,11 @@ /** * Return the next frame of a stream. + * This function returns what is stored in the file, and does not validate + * that what is there are valid frames for the decoder. It will split what is + * stored in the file into frames and return one for each call. It will not + * omit invalid data between valid frames so as to give the decoder the maximum + * information possible for decoding. * * The returned packet is valid * until the next av_read_frame() or until av_close_input_file() and @@ -1361,7 +1445,7 @@ const char *url, int is_output); -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_PARSE_FRAME_PARAM /** * Parse width and height out of string str. * @deprecated Use av_parse_video_frame_size instead. diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avidec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avidec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avidec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avidec.c 2010-11-06 17:21:29.000000000 +0000 @@ -693,6 +693,8 @@ clean_index(s); } + ff_metadata_conv_ctx(s, NULL, ff_avi_metadata_conv); + return 0; } @@ -759,7 +761,7 @@ for (i=0; inb_streams; i++) { st = s->streams[i]; ast = st->priv_data; - if (st->discard < AVDISCARD_ALL && ast->sub_pkt.data) { + if (st->discard < AVDISCARD_ALL && ast && ast->sub_pkt.data) { ts = av_rescale_q(ast->sub_pkt.dts, st->time_base, AV_TIME_BASE_Q); if (ts <= next_ts && ts < ts_min) { ts_min = ts; @@ -1294,12 +1296,14 @@ AVStream *st = s->streams[i]; AVIStream *ast = st->priv_data; av_free(st->codec->palctrl); - if (ast->sub_ctx) { - av_freep(&ast->sub_ctx->pb); - av_close_input_stream(ast->sub_ctx); + if (ast) { + if (ast->sub_ctx) { + av_freep(&ast->sub_ctx->pb); + av_close_input_stream(ast->sub_ctx); + } + av_free(ast->sub_buffer); + av_free_packet(&ast->sub_pkt); } - av_free(ast->sub_buffer); - av_free_packet(&ast->sub_pkt); } if (avi->dv_demux) @@ -1330,5 +1334,4 @@ avi_read_packet, avi_read_close, avi_read_seek, - .metadata_conv = ff_avi_metadata_conv, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avienc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avienc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avienc.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avienc.c 2010-11-06 17:21:29.000000000 +0000 @@ -290,12 +290,7 @@ return -1; } ff_end_tag(pb, strf); - if ((t = av_metadata_get(s->streams[i]->metadata, "strn", NULL, 0))) { - avi_write_info_tag(s->pb, t->key, t->value); - t = NULL; - } - //FIXME a limitation of metadata conversion system - else if ((t = av_metadata_get(s->streams[i]->metadata, "INAM", NULL, 0))) { + if ((t = av_metadata_get(s->streams[i]->metadata, "title", NULL, 0))) { avi_write_info_tag(s->pb, "strn", t->value); t = NULL; } @@ -375,6 +370,7 @@ list2 = ff_start_tag(pb, "LIST"); put_tag(pb, "INFO"); + ff_metadata_conv(&s->metadata, ff_avi_metadata_conv, NULL); for (i = 0; *ff_avi_tags[i]; i++) { if ((t = av_metadata_get(s->metadata, ff_avi_tags[i], NULL, AV_METADATA_MATCH_CASE))) avi_write_info_tag(s->pb, t->key, t->value); @@ -647,5 +643,4 @@ avi_write_trailer, .codec_tag= (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0}, .flags= AVFMT_VARIABLE_FPS, - .metadata_conv = ff_avi_metadata_conv, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/aviobuf.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/aviobuf.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/aviobuf.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/aviobuf.c 2010-11-06 17:21:29.000000000 +0000 @@ -36,7 +36,7 @@ #define SHORT_SEEK_THRESHOLD 4096 static void fill_buffer(ByteIOContext *s); -#if LIBAVFORMAT_VERSION_MAJOR >= 53 +#if !FF_API_URL_RESETBUF static int url_resetbuf(ByteIOContext *s, int flags); #endif @@ -632,13 +632,13 @@ return 0; } -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_URL_RESETBUF int url_resetbuf(ByteIOContext *s, int flags) #else static int url_resetbuf(ByteIOContext *s, int flags) #endif { -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_URL_RESETBUF if (flags & URL_RDWR) return AVERROR(EINVAL); #else diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avio.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avio.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avio.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avio.c 2010-11-06 17:21:29.000000000 +0000 @@ -23,14 +23,14 @@ #define _XOPEN_SOURCE 600 #include #include "libavutil/avstring.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" #include "os_support.h" #include "avformat.h" #if CONFIG_NETWORK #include "network.h" #endif -#if LIBAVFORMAT_VERSION_MAJOR >= 53 +#if FF_API_URL_CLASS /** @name Logging context. */ /*@{*/ static const char *urlcontext_to_name(void *ptr) @@ -71,7 +71,7 @@ return 0; } -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_REGISTER_PROTOCOL /* The layout of URLProtocol as of when major was bumped to 52 */ struct URLProtocol_compat { const char *name; @@ -90,7 +90,7 @@ int register_protocol(URLProtocol *protocol) { - return av_register_protocol(protocol); + return av_register_protocol2(protocol, sizeof(struct URLProtocol_compat)); } #endif @@ -109,7 +109,7 @@ err = AVERROR(ENOMEM); goto fail; } -#if LIBAVFORMAT_VERSION_MAJOR >= 53 +#if FF_API_URL_CLASS uc->av_class = &urlcontext_class; #endif uc->filename = (char *) &uc[1]; @@ -215,14 +215,15 @@ return ret; } -int url_read_complete(URLContext *h, unsigned char *buf, int size) +static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, + int (*transfer_func)(URLContext *h, unsigned char *buf, int size)) { int ret, len; int fast_retries = 5; len = 0; while (len < size) { - ret = url_read(h, buf+len, size-len); + ret = transfer_func(h, buf+len, size-len); if (ret == AVERROR(EAGAIN)) { ret = 0; if (fast_retries) @@ -238,16 +239,20 @@ return len; } +int url_read_complete(URLContext *h, unsigned char *buf, int size) +{ + return retry_transfer_wrapper(h, buf, size, url_read); +} + int url_write(URLContext *h, const unsigned char *buf, int size) { - int ret; if (!(h->flags & (URL_WRONLY | URL_RDWR))) return AVERROR(EIO); /* avoid sending too big packets */ if (h->max_packet_size && size > h->max_packet_size) return AVERROR(EIO); - ret = h->prot->url_write(h, buf, size); - return ret; + + return retry_transfer_wrapper(h, buf, size, h->prot->url_write); } int64_t url_seek(URLContext *h, int64_t pos, int whence) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avio.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avio.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/avio.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/avio.h 2010-11-06 17:21:29.000000000 +0000 @@ -43,7 +43,7 @@ * sizeof(URLContext) must not be used outside libav*. */ typedef struct URLContext { -#if LIBAVFORMAT_VERSION_MAJOR >= 53 +#if FF_API_URL_CLASS const AVClass *av_class; ///< information for av_log(). Set by url_open(). #endif struct URLProtocol *prot; @@ -132,9 +132,23 @@ * certain there was either an error or the end of file was reached. */ int url_read_complete(URLContext *h, unsigned char *buf, int size); + +/** + * Write size bytes from buf to the resource accessed by h. + * + * @return the number of bytes actually written, or a negative value + * corresponding to an AVERROR code in case of failure + */ int url_write(URLContext *h, const unsigned char *buf, int size); /** + * Passing this as the "whence" parameter to a seek function causes it to + * return the filesize without seeking anywhere. Supporting this is optional. + * If it is not supported then the seek function will return <0. + */ +#define AVSEEK_SIZE 0x10000 + +/** * Change the position that will be used by the next read/write * operation on the resource accessed by h. * @@ -165,12 +179,16 @@ */ int url_exist(const char *url); +/** + * Return the filesize of the resource accessed by h, AVERROR(ENOSYS) + * if the operation is not supported by h, or another negative value + * corresponding to an AVERROR error code in case of failure. + */ int64_t url_filesize(URLContext *h); /** * Return the file descriptor associated with this URL. For RTP, this * will return only the RTP file descriptor, not the RTCP file descriptor. - * To get both, use rtp_get_file_handles(). * * @return the file descriptor associated with this URL, or <0 on error. */ @@ -185,6 +203,12 @@ * @return maximum packet size in bytes */ int url_get_max_packet_size(URLContext *h); + +/** + * Copy the filename of the resource accessed by h to buf. + * + * @param buf_size size in bytes of buf + */ void url_get_filename(URLContext *h, char *buf, int buf_size); /** @@ -226,13 +250,6 @@ int64_t timestamp, int flags); /** - * Passing this as the "whence" parameter to a seek function causes it to - * return the filesize without seeking anywhere. Supporting this is optional. - * If it is not supported then the seek function will return <0. - */ -#define AVSEEK_SIZE 0x10000 - -/** * Oring this flag as into the "whence" parameter to a seek function causes it to * seek by any means (like reopening and linear reading) or other normally unreasonble * means that can be extreemly slow. @@ -256,7 +273,7 @@ const AVClass *priv_data_class; } URLProtocol; -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_REGISTER_PROTOCOL extern URLProtocol *first_protocol; #endif @@ -269,7 +286,7 @@ */ URLProtocol *av_protocol_next(URLProtocol *p); -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_REGISTER_PROTOCOL /** * @deprecated Use av_register_protocol() instead. */ @@ -454,7 +471,7 @@ /** @warning must be called before any I/O */ int url_setbufsize(ByteIOContext *s, int buf_size); -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_URL_RESETBUF /** Reset the buffer for reading or writing. * @note Will drop any data currently in the buffer without transmitting it. * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY @@ -551,7 +568,7 @@ /* udp.c */ int udp_set_remote_url(URLContext *h, const char *uri); int udp_get_local_port(URLContext *h); -#if (LIBAVFORMAT_VERSION_MAJOR <= 52) +#if FF_API_UDP_GET_FILE int udp_get_file_handle(URLContext *h); #endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/cafdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/cafdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/cafdec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/cafdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -115,6 +115,21 @@ return AVERROR_INVALIDDATA; } url_fskip(pb, skip); + } else if (st->codec->codec_id == CODEC_ID_ALAC) { +#define ALAC_PREAMBLE 12 +#define ALAC_HEADER 36 + if (size < ALAC_PREAMBLE + ALAC_HEADER) { + av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n"); + url_fskip(pb, size); + return AVERROR_INVALIDDATA; + } + url_fskip(pb, ALAC_PREAMBLE); + st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE); + if (!st->codec->extradata) + return AVERROR(ENOMEM); + get_buffer(pb, st->codec->extradata, ALAC_HEADER); + st->codec->extradata_size = ALAC_HEADER; + url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER); } else { st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/cavsvideodec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/cavsvideodec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/cavsvideodec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/cavsvideodec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,77 @@ +/* + * RAW Chinese AVS video demuxer + * Copyright (c) 2009 Stefan Gehrer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawdec.h" + +#define CAVS_SEQ_START_CODE 0x000001b0 +#define CAVS_PIC_I_START_CODE 0x000001b3 +#define CAVS_UNDEF_START_CODE 0x000001b4 +#define CAVS_PIC_PB_START_CODE 0x000001b6 +#define CAVS_VIDEO_EDIT_CODE 0x000001b7 +#define CAVS_PROFILE_JIZHUN 0x20 + +static int cavsvideo_probe(AVProbeData *p) +{ + uint32_t code= -1; + int pic=0, seq=0, slice_pos = 0; + int i; + + for(i=0; ibuf_size; i++){ + code = (code<<8) + p->buf[i]; + if ((code & 0xffffff00) == 0x100) { + if(code < CAVS_SEQ_START_CODE) { + /* slices have to be consecutive */ + if(code < slice_pos) + return 0; + slice_pos = code; + } else { + slice_pos = 0; + } + if (code == CAVS_SEQ_START_CODE) { + seq++; + /* check for the only currently supported profile */ + if(p->buf[i+1] != CAVS_PROFILE_JIZHUN) + return 0; + } else if ((code == CAVS_PIC_I_START_CODE) || + (code == CAVS_PIC_PB_START_CODE)) { + pic++; + } else if ((code == CAVS_UNDEF_START_CODE) || + (code > CAVS_VIDEO_EDIT_CODE)) { + return 0; + } + } + } + if(seq && seq*9<=pic*10) + return AVPROBE_SCORE_MAX/2; + return 0; +} + +AVInputFormat cavsvideo_demuxer = { + "cavsvideo", + NULL_IF_CONFIG_SMALL("raw Chinese AVS video"), + 0, + cavsvideo_probe, + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .value = CODEC_ID_CAVS, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/cutils.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/cutils.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/cutils.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/cutils.c 2010-11-06 17:21:29.000000000 +0000 @@ -24,6 +24,7 @@ /* add one element to a dynamic array */ void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem) { + /* see similar ffmpeg.c:grow_array() */ int nb, nb_alloc; intptr_t *tab; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/diracdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/diracdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/diracdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/diracdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * RAW Dirac demuxer + * Copyright (c) 2007 Marco Gerards + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/intreadwrite.h" +#include "avformat.h" +#include "rawdec.h" + +static int dirac_probe(AVProbeData *p) +{ + if (AV_RL32(p->buf) == MKTAG('B', 'B', 'C', 'D')) + return AVPROBE_SCORE_MAX; + else + return 0; +} + +AVInputFormat dirac_demuxer = { + "dirac", + NULL_IF_CONFIG_SMALL("raw Dirac"), + 0, + dirac_probe, + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .value = CODEC_ID_DIRAC, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/dnxhddec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/dnxhddec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/dnxhddec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/dnxhddec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,54 @@ +/* + * RAW DNxHD (SMPTE VC-3) demuxer + * Copyright (c) 2008 Baptiste Coudurier + * Copyright (c) 2009 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/intreadwrite.h" +#include "avformat.h" +#include "rawdec.h" + +static int dnxhd_probe(AVProbeData *p) +{ + static const uint8_t header[] = {0x00,0x00,0x02,0x80,0x01}; + int w, h, compression_id; + if (p->buf_size < 0x2c) + return 0; + if (memcmp(p->buf, header, 5)) + return 0; + h = AV_RB16(p->buf + 0x18); + w = AV_RB16(p->buf + 0x1a); + if (!w || !h) + return 0; + compression_id = AV_RB32(p->buf + 0x28); + if (compression_id < 1237 || compression_id > 1253) + return 0; + return AVPROBE_SCORE_MAX; +} + +AVInputFormat dnxhd_demuxer = { + "dnxhd", + NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"), + 0, + dnxhd_probe, + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .value = CODEC_ID_DNXHD, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/dtsdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/dtsdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/dtsdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/dtsdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,78 @@ +/* + * RAW DTS demuxer + * Copyright (c) 2008 Benjamin Larsson + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/bytestream.h" +#include "avformat.h" +#include "rawdec.h" + +#define DCA_MARKER_14B_BE 0x1FFFE800 +#define DCA_MARKER_14B_LE 0xFF1F00E8 +#define DCA_MARKER_RAW_BE 0x7FFE8001 +#define DCA_MARKER_RAW_LE 0xFE7F0180 + +static int dts_probe(AVProbeData *p) +{ + const uint8_t *buf, *bufp; + uint32_t state = -1; + int markers[3] = {0}; + int sum, max; + + buf = p->buf; + + for(; buf < (p->buf+p->buf_size)-2; buf+=2) { + bufp = buf; + state = (state << 16) | bytestream_get_be16(&bufp); + + /* regular bitstream */ + if (state == DCA_MARKER_RAW_BE || state == DCA_MARKER_RAW_LE) + markers[0]++; + + /* 14 bits big-endian bitstream */ + if (state == DCA_MARKER_14B_BE) + if ((bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0) + markers[1]++; + + /* 14 bits little-endian bitstream */ + if (state == DCA_MARKER_14B_LE) + if ((bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007) + markers[2]++; + } + sum = markers[0] + markers[1] + markers[2]; + max = markers[1] > markers[0]; + max = markers[2] > markers[max] ? 2 : max; + if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 && + markers[max] * 4 > sum * 3) + return AVPROBE_SCORE_MAX/2+1; + + return 0; +} + +AVInputFormat dts_demuxer = { + "dts", + NULL_IF_CONFIG_SMALL("raw DTS"), + 0, + dts_probe, + ff_raw_audio_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "dts", + .value = CODEC_ID_DTS, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flacdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flacdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flacdec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flacdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -21,15 +21,13 @@ #include "libavcodec/flac.h" #include "avformat.h" -#include "raw.h" -#include "id3v2.h" +#include "rawdec.h" #include "oggdec.h" #include "vorbiscomment.h" static int flac_read_header(AVFormatContext *s, AVFormatParameters *ap) { - uint8_t buf[ID3v2_HEADER_SIZE]; int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0; uint8_t header[4]; uint8_t *buffer=NULL; @@ -41,15 +39,6 @@ st->need_parsing = AVSTREAM_PARSE_FULL; /* the parameters will be extracted from the compressed bitstream */ - /* skip ID3v2 header if found */ - ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); - if (ret == ID3v2_HEADER_SIZE && ff_id3v2_match(buf, ID3v2_DEFAULT_MAGIC)) { - int len = ff_id3v2_tag_len(buf); - url_fseek(s->pb, len - ID3v2_HEADER_SIZE, SEEK_CUR); - } else { - url_fseek(s->pb, 0, SEEK_SET); - } - /* if fLaC marker is not found, assume there is no header */ if (get_le32(s->pb) != MKTAG('f','L','a','C')) { url_fseek(s->pb, -4, SEEK_CUR); @@ -130,9 +119,6 @@ uint8_t *bufptr = p->buf; uint8_t *end = p->buf + p->buf_size; - if(ff_id3v2_match(bufptr, ID3v2_DEFAULT_MAGIC)) - bufptr += ff_id3v2_tag_len(bufptr); - if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0; else return AVPROBE_SCORE_MAX/2; } @@ -147,5 +133,4 @@ .flags= AVFMT_GENERIC_INDEX, .extensions = "flac", .value = CODEC_ID_FLAC, - .metadata_conv = ff_vorbiscomment_metadata_conv, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flacenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flacenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flacenc.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flacenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -39,14 +39,16 @@ return 0; } -static int flac_write_block_comment(ByteIOContext *pb, AVMetadata *m, +static int flac_write_block_comment(ByteIOContext *pb, AVMetadata **m, int last_block, int bitexact) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; unsigned int len, count; uint8_t *p, *p0; - len = ff_vorbiscomment_length(m, vendor, &count); + ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL); + + len = ff_vorbiscomment_length(*m, vendor, &count); p0 = av_malloc(len+4); if (!p0) return AVERROR(ENOMEM); @@ -72,7 +74,7 @@ if (ret) return ret; - ret = flac_write_block_comment(s->pb, s->metadata, 0, + ret = flac_write_block_comment(s->pb, &s->metadata, 0, codec->flags & CODEC_FLAG_BITEXACT); if (ret) return ret; @@ -128,5 +130,4 @@ flac_write_packet, flac_write_trailer, .flags= AVFMT_NOTIMESTAMPS, - .metadata_conv = ff_vorbiscomment_metadata_conv, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flic.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flic.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flic.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flic.c 2010-11-06 17:21:29.000000000 +0000 @@ -152,7 +152,7 @@ /* all audio frames are the same size, so use the size of the first chunk for block_align */ ast->codec->block_align = AV_RL32(&preamble[0]); - ast->codec->codec_type = CODEC_TYPE_AUDIO; + ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_id = CODEC_ID_PCM_U8; ast->codec->codec_tag = 0; ast->codec->sample_rate = FLIC_TFTD_SAMPLE_RATE; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flvdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flvdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flvdec.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flvdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -68,6 +68,12 @@ case FLV_CODECID_MP3 : acodec->codec_id = CODEC_ID_MP3 ; astream->need_parsing = AVSTREAM_PARSE_FULL; break; case FLV_CODECID_NELLYMOSER_8KHZ_MONO: acodec->sample_rate = 8000; //in case metadata does not otherwise declare samplerate + acodec->codec_id = CODEC_ID_NELLYMOSER; + break; + case FLV_CODECID_NELLYMOSER_16KHZ_MONO: + acodec->sample_rate = 16000; + acodec->codec_id = CODEC_ID_NELLYMOSER; + break; case FLV_CODECID_NELLYMOSER: acodec->codec_id = CODEC_ID_NELLYMOSER; break; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flvenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flvenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flvenc.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flvenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -22,6 +22,7 @@ #include "flv.h" #include "internal.h" #include "avc.h" +#include "metadata.h" #undef NDEBUG #include @@ -54,6 +55,7 @@ int64_t filesize_offset; int64_t duration; int delay; ///< first dts delay for AVC + int64_t last_video_ts; } FLVContext; static int get_audio_flags(AVCodecContext *enc){ @@ -144,6 +146,18 @@ put_buffer(pb, str, len); } +static void put_avc_eos_tag(ByteIOContext *pb, unsigned ts) { + put_byte(pb, FLV_TAG_TYPE_VIDEO); + put_be24(pb, 5); /* Tag Data Size */ + put_be24(pb, ts); /* lower 24 bits of timestamp in ms*/ + put_byte(pb, (ts >> 24) & 0x7F); /* MSB of ts in ms*/ + put_be24(pb, 0); /* StreamId = 0 */ + put_byte(pb, 23); /* ub[4] FrameType = 1, ub[4] CodecId = 7 */ + put_byte(pb, 2); /* AVC end of sequence */ + put_be24(pb, 0); /* Always 0 for AVC EOS. */ + put_be32(pb, 16); /* Size of FLV tag */ +} + static void put_amf_double(ByteIOContext *pb, double d) { put_byte(pb, AMF_DATA_TYPE_NUMBER); @@ -163,6 +177,7 @@ int i; double framerate = 0.0; int metadata_size_pos, data_size; + AVMetadataTag *tag = NULL; for(i=0; inb_streams; i++){ AVCodecContext *enc = s->streams[i]->codec; @@ -202,6 +217,8 @@ } } + flv->last_video_ts = -1; + /* write meta_tag */ put_byte(pb, 18); // tag type META metadata_size_pos= url_ftell(pb); @@ -257,6 +274,12 @@ put_amf_double(pb, audio_enc->codec_tag); } + while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) { + put_amf_string(pb, tag->key); + put_byte(pb, AMF_DATA_TYPE_STRING); + put_amf_string(pb, tag->value); + } + put_amf_string(pb, "filesize"); flv->filesize_offset= url_ftell(pb); put_amf_double(pb, 0); // delayed write @@ -309,6 +332,16 @@ ByteIOContext *pb = s->pb; FLVContext *flv = s->priv_data; + int i; + + /* Add EOS tag */ + for (i = 0; i < s->nb_streams; i++) { + AVCodecContext *enc = s->streams[i]->codec; + if (enc->codec_type == AVMEDIA_TYPE_VIDEO && + enc->codec_id == CODEC_ID_H264) { + put_avc_eos_tag(pb, flv->last_video_ts); + } + } file_size = url_ftell(pb); @@ -372,6 +405,10 @@ } ts = pkt->dts + flv->delay; // add delay to force positive dts + if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { + if (flv->last_video_ts < ts) + flv->last_video_ts = ts; + } put_be24(pb,size + flags_size); put_be24(pb,ts); put_byte(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flv.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flv.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/flv.h 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/flv.h 2010-11-06 17:21:29.000000000 +0000 @@ -75,6 +75,7 @@ FLV_CODECID_ADPCM = 1 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_MP3 = 2 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_PCM_LE = 3 << FLV_AUDIO_CODECID_OFFSET, + FLV_CODECID_NELLYMOSER_16KHZ_MONO = 4 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_NELLYMOSER_8KHZ_MONO = 5 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_NELLYMOSER = 6 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_AAC = 10<< FLV_AUDIO_CODECID_OFFSET, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/gxfenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/gxfenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/gxfenc.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/gxfenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -190,7 +190,7 @@ "Pix 0\nCf %d\nCg %d\nSl %d\nnl16 %d\nVi 1\nf1 1\n", (float)st->codec->bit_rate, sc->p_per_gop, sc->b_per_i_or_p, st->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, sc->first_gop_closed == 1, - starting_line, st->codec->height / 16); + starting_line, (st->codec->height + 15) / 16); put_byte(pb, TRACK_MPG_AUX); put_byte(pb, size + 1); put_buffer(pb, (uint8_t *)buffer, size + 1); @@ -365,7 +365,7 @@ ByteIOContext *pb = s->pb; int64_t pos = url_ftell(pb); int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1; - int flt_entries = gxf->nb_fields / fields_per_flt - 1; + int flt_entries = gxf->nb_fields / fields_per_flt; int i = 0; gxf_write_packet_header(pb, PKT_FLT); @@ -564,6 +564,7 @@ else { AVStream *st = s->streams[i]; switch (st->codec->codec_id) { + case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: gxf_write_umf_media_mpeg(pb, st); break; @@ -678,12 +679,16 @@ sc->sample_rate = 60; gxf->flags |= 0x00000080; gxf->time_base = (AVRational){ 1001, 60000 }; - } else { /* assume PAL */ + } else if (st->codec->height == 576 || st->codec->height == 608) { /* PAL or PAL+VBI */ sc->frame_rate_index = 6; sc->media_type++; sc->sample_rate = 50; gxf->flags |= 0x00000040; gxf->time_base = (AVRational){ 1, 50 }; + } else { + av_log(s, AV_LOG_ERROR, "unsupported video resolution, " + "gxf muxer only accepts PAL or NTSC resolutions currently\n"); + return -1; } av_set_pts_info(st, 64, gxf->time_base.num, gxf->time_base.den); if (gxf_find_lines_index(st) < 0) @@ -855,6 +860,7 @@ AVStream *st = s->streams[pkt->stream_index]; int64_t pos = url_ftell(pb); int padding = 0; + int packet_start_offset = url_ftell(pb) / 1024; gxf_write_packet_header(pb, PKT_MEDIA); if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO && pkt->size % 4) /* MPEG-2 frames must be padded */ @@ -874,7 +880,7 @@ return -1; } } - gxf->flt_entries[gxf->flt_entries_nb++] = url_ftell(pb) / 1024; + gxf->flt_entries[gxf->flt_entries_nb++] = packet_start_offset; gxf->nb_fields += 2; // count fields } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/h261dec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/h261dec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/h261dec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/h261dec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,75 @@ +/* + * RAW H.261 video demuxer + * Copyright (c) 2009 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/get_bits.h" +#include "avformat.h" +#include "rawdec.h" + +static int h261_probe(AVProbeData *p) +{ + uint32_t code= -1; + int i; + int valid_psc=0; + int invalid_psc=0; + int next_gn=0; + int src_fmt=0; + GetBitContext gb; + + init_get_bits(&gb, p->buf, p->buf_size*8); + + for(i=0; ibuf_size*8; i++){ + if ((code & 0x01ff0000) || !(code & 0xff00)) { + code = (code<<8) + get_bits(&gb, 8); + i += 7; + } else + code = (code<<1) + get_bits1(&gb); + if ((code & 0xffff0000) == 0x10000) { + int gn= (code>>12)&0xf; + if(!gn) + src_fmt= code&8; + if(gn != next_gn) invalid_psc++; + else valid_psc++; + + if(src_fmt){ // CIF + next_gn= (gn+1 )%13; + }else{ //QCIF + next_gn= (gn+1+!!gn)% 7; + } + } + } + if(valid_psc > 2*invalid_psc + 6){ + return 50; + }else if(valid_psc > 2*invalid_psc + 2) + return 25; + return 0; +} + +AVInputFormat h261_demuxer = { + "h261", + NULL_IF_CONFIG_SMALL("raw H.261"), + 0, + h261_probe, + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "h261", + .value = CODEC_ID_H261, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/h263dec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/h263dec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/h263dec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/h263dec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,77 @@ +/* + * RAW H.263 video demuxer + * Copyright (c) 2009 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawdec.h" + +static int h263_probe(AVProbeData *p) +{ + uint64_t code= -1; + int i; + int valid_psc=0; + int invalid_psc=0; + int res_change=0; + int src_fmt, last_src_fmt=-1; + int last_gn=0; + + for(i=0; ibuf_size; i++){ + code = (code<<8) + p->buf[i]; + if ((code & 0xfffffc0000) == 0x800000) { + src_fmt= (code>>2)&3; + if( src_fmt != last_src_fmt + && last_src_fmt>0 && last_src_fmt<6 + && src_fmt<6) + res_change++; + + if((code&0x300)==0x200 && src_fmt){ + valid_psc++; + last_gn=0; + }else + invalid_psc++; + last_src_fmt= src_fmt; + } else if((code & 0xffff800000) == 0x800000) { + int gn= (code>>(23-5)) & 0x1F; + if(gn 2*invalid_psc + 2*res_change + 3){ + return 50; + }else if(valid_psc > 2*invalid_psc) + return 25; + return 0; +} + +AVInputFormat h263_demuxer = { + "h263", + NULL_IF_CONFIG_SMALL("raw H.263"), + 0, + h263_probe, + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, +// .extensions = "h263", //FIXME remove after writing mpeg4_probe + .value = CODEC_ID_H263, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/h264dec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/h264dec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/h264dec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/h264dec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * RAW H.264 video demuxer + * Copyright (c) 2008 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawdec.h" + +static int h264_probe(AVProbeData *p) +{ + uint32_t code= -1; + int sps=0, pps=0, idr=0, res=0, sli=0; + int i; + + for(i=0; ibuf_size; i++){ + code = (code<<8) + p->buf[i]; + if ((code & 0xffffff00) == 0x100) { + int ref_idc= (code>>5)&3; + int type = code & 0x1F; + static const int8_t ref_zero[32]={ + 2, 0, 0, 0, 0,-1, 1,-1, + -1, 1, 1, 1, 1,-1, 2, 2, + 2, 2, 2, 0, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2 + }; + + if(code & 0x80) //forbidden bit + return 0; + + if(ref_zero[type] == 1 && ref_idc) + return 0; + if(ref_zero[type] ==-1 && !ref_idc) + return 0; + if(ref_zero[type] == 2) + res++; + + switch(type){ + case 1: sli++; break; + case 5: idr++; break; + case 7: + if(p->buf[i+2]&0x0F) + return 0; + sps++; + break; + case 8: pps++; break; + } + } + } + if(sps && pps && (idr||sli>3) && res<(sps+pps+idr)) + return AVPROBE_SCORE_MAX/2+1; // +1 for .mpg + return 0; +} + +AVInputFormat h264_demuxer = { + "h264", + NULL_IF_CONFIG_SMALL("raw H.264 video format"), + 0, + h264_probe, + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "h26l,h264,264", //FIXME remove after writing mpeg4_probe + .value = CODEC_ID_H264, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/httpauth.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/httpauth.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/httpauth.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/httpauth.c 2010-11-06 17:21:29.000000000 +0000 @@ -28,62 +28,6 @@ #include "avformat.h" #include -static void parse_key_value(const char *params, - void (*callback_get_buf)(HTTPAuthState *state, - const char *key, int key_len, - char **dest, int *dest_len), HTTPAuthState *state) -{ - const char *ptr = params; - - /* Parse key=value pairs. */ - for (;;) { - const char *key; - char *dest = NULL, *dest_end; - int key_len, dest_len = 0; - - /* Skip whitespace and potential commas. */ - while (*ptr && (isspace(*ptr) || *ptr == ',')) - ptr++; - if (!*ptr) - break; - - key = ptr; - - if (!(ptr = strchr(key, '='))) - break; - ptr++; - key_len = ptr - key; - - callback_get_buf(state, key, key_len, &dest, &dest_len); - dest_end = dest + dest_len - 1; - - if (*ptr == '\"') { - ptr++; - while (*ptr && *ptr != '\"') { - if (*ptr == '\\') { - if (!ptr[1]) - break; - if (dest && dest < dest_end) - *dest++ = ptr[1]; - ptr += 2; - } else { - if (dest && dest < dest_end) - *dest++ = *ptr; - ptr++; - } - } - if (*ptr == '\"') - ptr++; - } else { - for (; *ptr && !(isspace(*ptr) || *ptr == ','); ptr++) - if (dest && dest < dest_end) - *dest++ = *ptr; - } - if (dest) - *dest = 0; - } -} - static void handle_basic_params(HTTPAuthState *state, const char *key, int key_len, char **dest, int *dest_len) { @@ -149,18 +93,21 @@ state->auth_type <= HTTP_AUTH_BASIC) { state->auth_type = HTTP_AUTH_BASIC; state->realm[0] = 0; - parse_key_value(p, handle_basic_params, state); + ff_parse_key_value(p, (ff_parse_key_val_cb) handle_basic_params, + state); } else if (av_stristart(value, "Digest ", &p) && state->auth_type <= HTTP_AUTH_DIGEST) { state->auth_type = HTTP_AUTH_DIGEST; memset(&state->digest_params, 0, sizeof(DigestParams)); state->realm[0] = 0; - parse_key_value(p, handle_digest_params, state); + ff_parse_key_value(p, (ff_parse_key_val_cb) handle_digest_params, + state); choose_qop(state->digest_params.qop, sizeof(state->digest_params.qop)); } } else if (!strcmp(key, "Authentication-Info")) { - parse_key_value(value, handle_digest_update, state); + ff_parse_key_value(value, (ff_parse_key_val_cb) handle_digest_update, + state); } } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/http.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/http.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/http.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/http.c 2010-11-06 17:21:29.000000000 +0000 @@ -28,14 +28,13 @@ #include "http.h" #include "os_support.h" #include "httpauth.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" /* XXX: POST protocol is not completely implemented because ffmpeg uses only a subset of it. */ /* used for protocol handling */ #define BUFFER_SIZE 1024 -#define URL_SIZE 4096 #define MAX_REDIRECTS 8 typedef struct { @@ -46,7 +45,7 @@ int http_code; int64_t chunksize; /**< Used if "Transfer-Encoding: chunked" otherwise -1. */ int64_t off, filesize; - char location[URL_SIZE]; + char location[MAX_URL_SIZE]; HTTPAuthState auth_state; unsigned char headers[BUFFER_SIZE]; int willclose; /**< Set if the server correctly handles Connection: close and will close the connection after feeding us the content. */ @@ -139,7 +138,8 @@ } else goto fail; } - if ((s->http_code == 302 || s->http_code == 303) && location_changed == 1) { + if ((s->http_code == 301 || s->http_code == 302 || s->http_code == 303 || s->http_code == 307) + && location_changed == 1) { /* url moved, get next */ url_close(hd); if (redirects++ >= MAX_REDIRECTS) @@ -162,7 +162,7 @@ h->is_streamed = 1; s->filesize = -1; - av_strlcpy(s->location, uri, URL_SIZE); + av_strlcpy(s->location, uri, sizeof(s->location)); return http_open_cnx(h); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/id3v2.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/id3v2.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/id3v2.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/id3v2.c 2010-11-06 17:21:29.000000000 +0000 @@ -23,6 +23,7 @@ #include "id3v1.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" +#include "metadata.h" int ff_id3v2_match(const uint8_t *buf, const char * magic) { @@ -53,20 +54,27 @@ { int len, ret; uint8_t buf[ID3v2_HEADER_SIZE]; + int found_header; + int64_t off; - ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); - if (ret != ID3v2_HEADER_SIZE) - return; - if (ff_id3v2_match(buf, magic)) { - /* parse ID3v2 header */ - len = ((buf[6] & 0x7f) << 21) | - ((buf[7] & 0x7f) << 14) | - ((buf[8] & 0x7f) << 7) | - (buf[9] & 0x7f); - ff_id3v2_parse(s, len, buf[3], buf[5]); - } else { - url_fseek(s->pb, 0, SEEK_SET); - } + do { + /* save the current offset in case there's nothing to read/skip */ + off = url_ftell(s->pb); + ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); + if (ret != ID3v2_HEADER_SIZE) + return; + found_header = ff_id3v2_match(buf, magic); + if (found_header) { + /* parse ID3v2 header */ + len = ((buf[6] & 0x7f) << 21) | + ((buf[7] & 0x7f) << 14) | + ((buf[8] & 0x7f) << 7) | + (buf[9] & 0x7f); + ff_id3v2_parse(s, len, buf[3], buf[5]); + } else { + url_fseek(s->pb, off, SEEK_SET); + } + } while (found_header); } static unsigned int get_size(ByteIOContext *s, int len) @@ -77,7 +85,7 @@ return v; } -static void read_ttag(AVFormatContext *s, int taglen, const char *key) +static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const char *key) { char *q, dst[512]; const char *val = NULL; @@ -91,20 +99,20 @@ taglen--; /* account for encoding type byte */ - switch (get_byte(s->pb)) { /* encoding type */ + switch (get_byte(pb)) { /* encoding type */ case 0: /* ISO-8859-1 (0 - 255 maps directly into unicode) */ q = dst; while (taglen-- && q - dst < dstlen - 7) { uint8_t tmp; - PUT_UTF8(get_byte(s->pb), tmp, *q++ = tmp;) + PUT_UTF8(get_byte(pb), tmp, *q++ = tmp;) } *q = 0; break; case 1: /* UTF-16 with BOM */ taglen -= 2; - switch (get_be16(s->pb)) { + switch (get_be16(pb)) { case 0xfffe: get = get_le16; case 0xfeff: @@ -121,7 +129,7 @@ uint32_t ch; uint8_t tmp; - GET_UTF16(ch, ((taglen -= 2) >= 0 ? get(s->pb) : 0), break;) + GET_UTF16(ch, ((taglen -= 2) >= 0 ? get(pb) : 0), break;) PUT_UTF8(ch, tmp, *q++ = tmp;) } *q = 0; @@ -129,7 +137,7 @@ case 3: /* UTF-8 */ len = FFMIN(taglen, dstlen); - get_buffer(s->pb, dst, len); + get_buffer(pb, dst, len); dst[len] = 0; break; default: @@ -156,11 +164,14 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) { - int isv34, tlen; + int isv34, tlen, unsync; char tag[5]; int64_t next; int taghdrlen; const char *reason; + ByteIOContext pb; + unsigned char *buffer = NULL; + int buffer_size = 0; switch (version) { case 2: @@ -183,15 +194,15 @@ goto error; } - if (flags & 0x80) { - reason = "unsynchronization"; - goto error; - } + unsync = flags & 0x80; if (isv34 && flags & 0x40) /* Extended header present, just skip over it */ url_fskip(s->pb, get_size(s->pb, 4)); while (len >= taghdrlen) { + unsigned int tflags; + int tunsync = 0; + if (isv34) { get_buffer(s->pb, tag, 4); tag[4] = 0; @@ -199,7 +210,8 @@ tlen = get_be32(s->pb); }else tlen = get_size(s->pb, 4); - get_be16(s->pb); /* flags */ + tflags = get_be16(s->pb); + tunsync = tflags & 0x02; } else { get_buffer(s->pb, tag, 3); tag[3] = 0; @@ -212,8 +224,23 @@ next = url_ftell(s->pb) + tlen; - if (tag[0] == 'T') - read_ttag(s, tlen, tag); + if (tag[0] == 'T') { + if (unsync || tunsync) { + int i, j; + av_fast_malloc(&buffer, &buffer_size, tlen); + for (i = 0, j = 0; i < tlen; i++, j++) { + buffer[j] = get_byte(s->pb); + if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) { + /* Unsynchronised byte, skip it */ + j--; + } + } + init_put_byte(&pb, buffer, j, 0, NULL, NULL, NULL, NULL); + read_ttag(s, &pb, j, tag); + } else { + read_ttag(s, s->pb, tlen, tag); + } + } else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); @@ -223,6 +250,7 @@ /* Skip to end of tag */ url_fseek(s->pb, next, SEEK_SET); } + ff_metadata_conv(&s->metadata, NULL, ff_id3v2_metadata_conv); if (len > 0) { /* Skip padding */ @@ -230,11 +258,14 @@ } if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */ url_fskip(s->pb, 10); + + av_free(buffer); return; error: av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); url_fskip(s->pb, len); + av_free(buffer); } const AVMetadataConv ff_id3v2_metadata_conv[] = { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/idroq.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/idroq.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/idroq.c 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/idroq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,226 +0,0 @@ -/* - * id RoQ (.roq) File Demuxer - * Copyright (c) 2003 The ffmpeg Project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * id RoQ format file demuxer - * by Mike Melanson (melanson@pcisys.net) - * for more information on the .roq file format, visit: - * http://www.csse.monash.edu.au/~timf/ - */ - -#include "libavutil/intreadwrite.h" -#include "avformat.h" - -#define RoQ_MAGIC_NUMBER 0x1084 -#define RoQ_CHUNK_PREAMBLE_SIZE 8 -#define RoQ_AUDIO_SAMPLE_RATE 22050 -#define RoQ_CHUNKS_TO_SCAN 30 - -#define RoQ_INFO 0x1001 -#define RoQ_QUAD_CODEBOOK 0x1002 -#define RoQ_QUAD_VQ 0x1011 -#define RoQ_SOUND_MONO 0x1020 -#define RoQ_SOUND_STEREO 0x1021 - -typedef struct RoqDemuxContext { - - int width; - int height; - int audio_channels; - - int video_stream_index; - int audio_stream_index; - - int64_t video_pts; - unsigned int audio_frame_count; - -} RoqDemuxContext; - -static int roq_probe(AVProbeData *p) -{ - if ((AV_RL16(&p->buf[0]) != RoQ_MAGIC_NUMBER) || - (AV_RL32(&p->buf[2]) != 0xFFFFFFFF)) - return 0; - - return AVPROBE_SCORE_MAX; -} - -static int roq_read_header(AVFormatContext *s, - AVFormatParameters *ap) -{ - RoqDemuxContext *roq = s->priv_data; - ByteIOContext *pb = s->pb; - int framerate; - AVStream *st; - unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; - - /* get the main header */ - if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != - RoQ_CHUNK_PREAMBLE_SIZE) - return AVERROR(EIO); - framerate = AV_RL16(&preamble[6]); - - /* init private context parameters */ - roq->width = roq->height = roq->audio_channels = roq->video_pts = - roq->audio_frame_count = 0; - roq->audio_stream_index = -1; - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - av_set_pts_info(st, 63, 1, framerate); - roq->video_stream_index = st->index; - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = CODEC_ID_ROQ; - st->codec->codec_tag = 0; /* no fourcc */ - - return 0; -} - -static int roq_read_packet(AVFormatContext *s, - AVPacket *pkt) -{ - RoqDemuxContext *roq = s->priv_data; - ByteIOContext *pb = s->pb; - int ret = 0; - unsigned int chunk_size; - unsigned int chunk_type; - unsigned int codebook_size; - unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; - int packet_read = 0; - int64_t codebook_offset; - - while (!packet_read) { - - if (url_feof(s->pb)) - return AVERROR(EIO); - - /* get the next chunk preamble */ - if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != - RoQ_CHUNK_PREAMBLE_SIZE) - return AVERROR(EIO); - - chunk_type = AV_RL16(&preamble[0]); - chunk_size = AV_RL32(&preamble[2]); - if(chunk_size > INT_MAX) - return AVERROR_INVALIDDATA; - - switch (chunk_type) { - - case RoQ_INFO: - if (!roq->width || !roq->height) { - AVStream *st = s->streams[roq->video_stream_index]; - if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) - return AVERROR(EIO); - st->codec->width = roq->width = AV_RL16(preamble); - st->codec->height = roq->height = AV_RL16(preamble + 2); - break; - } - /* don't care about this chunk anymore */ - url_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR); - break; - - case RoQ_QUAD_CODEBOOK: - /* packet needs to contain both this codebook and next VQ chunk */ - codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; - codebook_size = chunk_size; - url_fseek(pb, codebook_size, SEEK_CUR); - if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != - RoQ_CHUNK_PREAMBLE_SIZE) - return AVERROR(EIO); - chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 + - codebook_size; - - /* rewind */ - url_fseek(pb, codebook_offset, SEEK_SET); - - /* load up the packet */ - ret= av_get_packet(pb, pkt, chunk_size); - if (ret != chunk_size) - return AVERROR(EIO); - pkt->stream_index = roq->video_stream_index; - pkt->pts = roq->video_pts++; - - packet_read = 1; - break; - - case RoQ_SOUND_MONO: - case RoQ_SOUND_STEREO: - if (roq->audio_stream_index == -1) { - AVStream *st = av_new_stream(s, 1); - if (!st) - return AVERROR(ENOMEM); - av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE); - roq->audio_stream_index = st->index; - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = CODEC_ID_ROQ_DPCM; - st->codec->codec_tag = 0; /* no tag */ - st->codec->channels = roq->audio_channels = chunk_type == RoQ_SOUND_STEREO ? 2 : 1; - st->codec->sample_rate = RoQ_AUDIO_SAMPLE_RATE; - st->codec->bits_per_coded_sample = 16; - st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * - st->codec->bits_per_coded_sample; - st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample; - } - case RoQ_QUAD_VQ: - /* load up the packet */ - if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE)) - return AVERROR(EIO); - /* copy over preamble */ - memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE); - - if (chunk_type == RoQ_QUAD_VQ) { - pkt->stream_index = roq->video_stream_index; - pkt->pts = roq->video_pts++; - } else { - pkt->stream_index = roq->audio_stream_index; - pkt->pts = roq->audio_frame_count; - roq->audio_frame_count += (chunk_size / roq->audio_channels); - } - - pkt->pos= url_ftell(pb); - ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, - chunk_size); - if (ret != chunk_size) - ret = AVERROR(EIO); - - packet_read = 1; - break; - - default: - av_log(s, AV_LOG_ERROR, " unknown RoQ chunk (%04X)\n", chunk_type); - return AVERROR_INVALIDDATA; - break; - } - } - - return ret; -} - -AVInputFormat roq_demuxer = { - "RoQ", - NULL_IF_CONFIG_SMALL("id RoQ format"), - sizeof(RoqDemuxContext), - roq_probe, - roq_read_header, - roq_read_packet, -}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/idroqdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/idroqdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/idroqdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/idroqdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,226 @@ +/* + * id RoQ (.roq) File Demuxer + * Copyright (c) 2003 The ffmpeg Project + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * id RoQ format file demuxer + * by Mike Melanson (melanson@pcisys.net) + * for more information on the .roq file format, visit: + * http://www.csse.monash.edu.au/~timf/ + */ + +#include "libavutil/intreadwrite.h" +#include "avformat.h" + +#define RoQ_MAGIC_NUMBER 0x1084 +#define RoQ_CHUNK_PREAMBLE_SIZE 8 +#define RoQ_AUDIO_SAMPLE_RATE 22050 +#define RoQ_CHUNKS_TO_SCAN 30 + +#define RoQ_INFO 0x1001 +#define RoQ_QUAD_CODEBOOK 0x1002 +#define RoQ_QUAD_VQ 0x1011 +#define RoQ_SOUND_MONO 0x1020 +#define RoQ_SOUND_STEREO 0x1021 + +typedef struct RoqDemuxContext { + + int width; + int height; + int audio_channels; + + int video_stream_index; + int audio_stream_index; + + int64_t video_pts; + unsigned int audio_frame_count; + +} RoqDemuxContext; + +static int roq_probe(AVProbeData *p) +{ + if ((AV_RL16(&p->buf[0]) != RoQ_MAGIC_NUMBER) || + (AV_RL32(&p->buf[2]) != 0xFFFFFFFF)) + return 0; + + return AVPROBE_SCORE_MAX; +} + +static int roq_read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + RoqDemuxContext *roq = s->priv_data; + ByteIOContext *pb = s->pb; + int framerate; + AVStream *st; + unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; + + /* get the main header */ + if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != + RoQ_CHUNK_PREAMBLE_SIZE) + return AVERROR(EIO); + framerate = AV_RL16(&preamble[6]); + + /* init private context parameters */ + roq->width = roq->height = roq->audio_channels = roq->video_pts = + roq->audio_frame_count = 0; + roq->audio_stream_index = -1; + + st = av_new_stream(s, 0); + if (!st) + return AVERROR(ENOMEM); + av_set_pts_info(st, 63, 1, framerate); + roq->video_stream_index = st->index; + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_ROQ; + st->codec->codec_tag = 0; /* no fourcc */ + + return 0; +} + +static int roq_read_packet(AVFormatContext *s, + AVPacket *pkt) +{ + RoqDemuxContext *roq = s->priv_data; + ByteIOContext *pb = s->pb; + int ret = 0; + unsigned int chunk_size; + unsigned int chunk_type; + unsigned int codebook_size; + unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; + int packet_read = 0; + int64_t codebook_offset; + + while (!packet_read) { + + if (url_feof(s->pb)) + return AVERROR(EIO); + + /* get the next chunk preamble */ + if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != + RoQ_CHUNK_PREAMBLE_SIZE) + return AVERROR(EIO); + + chunk_type = AV_RL16(&preamble[0]); + chunk_size = AV_RL32(&preamble[2]); + if(chunk_size > INT_MAX) + return AVERROR_INVALIDDATA; + + switch (chunk_type) { + + case RoQ_INFO: + if (!roq->width || !roq->height) { + AVStream *st = s->streams[roq->video_stream_index]; + if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) + return AVERROR(EIO); + st->codec->width = roq->width = AV_RL16(preamble); + st->codec->height = roq->height = AV_RL16(preamble + 2); + break; + } + /* don't care about this chunk anymore */ + url_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR); + break; + + case RoQ_QUAD_CODEBOOK: + /* packet needs to contain both this codebook and next VQ chunk */ + codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; + codebook_size = chunk_size; + url_fseek(pb, codebook_size, SEEK_CUR); + if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != + RoQ_CHUNK_PREAMBLE_SIZE) + return AVERROR(EIO); + chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 + + codebook_size; + + /* rewind */ + url_fseek(pb, codebook_offset, SEEK_SET); + + /* load up the packet */ + ret= av_get_packet(pb, pkt, chunk_size); + if (ret != chunk_size) + return AVERROR(EIO); + pkt->stream_index = roq->video_stream_index; + pkt->pts = roq->video_pts++; + + packet_read = 1; + break; + + case RoQ_SOUND_MONO: + case RoQ_SOUND_STEREO: + if (roq->audio_stream_index == -1) { + AVStream *st = av_new_stream(s, 1); + if (!st) + return AVERROR(ENOMEM); + av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE); + roq->audio_stream_index = st->index; + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_ROQ_DPCM; + st->codec->codec_tag = 0; /* no tag */ + st->codec->channels = roq->audio_channels = chunk_type == RoQ_SOUND_STEREO ? 2 : 1; + st->codec->sample_rate = RoQ_AUDIO_SAMPLE_RATE; + st->codec->bits_per_coded_sample = 16; + st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * + st->codec->bits_per_coded_sample; + st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample; + } + case RoQ_QUAD_VQ: + /* load up the packet */ + if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE)) + return AVERROR(EIO); + /* copy over preamble */ + memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE); + + if (chunk_type == RoQ_QUAD_VQ) { + pkt->stream_index = roq->video_stream_index; + pkt->pts = roq->video_pts++; + } else { + pkt->stream_index = roq->audio_stream_index; + pkt->pts = roq->audio_frame_count; + roq->audio_frame_count += (chunk_size / roq->audio_channels); + } + + pkt->pos= url_ftell(pb); + ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, + chunk_size); + if (ret != chunk_size) + ret = AVERROR(EIO); + + packet_read = 1; + break; + + default: + av_log(s, AV_LOG_ERROR, " unknown RoQ chunk (%04X)\n", chunk_type); + return AVERROR_INVALIDDATA; + break; + } + } + + return ret; +} + +AVInputFormat roq_demuxer = { + "RoQ", + NULL_IF_CONFIG_SMALL("id RoQ format"), + sizeof(RoqDemuxContext), + roq_probe, + roq_read_header, + roq_read_packet, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/idroqenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/idroqenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/idroqenc.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/idroqenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * id RoQ (.roq) File muxer + * Copyright (c) 2007 Vitor Sessak + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawenc.h" + + +static int roq_write_header(struct AVFormatContext *s) +{ + static const uint8_t header[] = { + 0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00 + }; + + put_buffer(s->pb, header, 8); + put_flush_packet(s->pb); + + return 0; +} + +AVOutputFormat roq_muxer = +{ + "RoQ", + NULL_IF_CONFIG_SMALL("raw id RoQ format"), + NULL, + "roq", + 0, + CODEC_ID_ROQ_DPCM, + CODEC_ID_ROQ, + roq_write_header, + ff_raw_write_packet, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/img2.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/img2.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/img2.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/img2.c 2010-11-06 17:21:29.000000000 +0000 @@ -171,7 +171,7 @@ } -static int image_probe(AVProbeData *p) +static int read_probe(AVProbeData *p) { if (p->filename && av_str2id(img_tags, p->filename)) { if (av_filename_number_test(p->filename)) @@ -186,7 +186,7 @@ return av_str2id(img_tags, filename); } -static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) +static int read_header(AVFormatContext *s1, AVFormatParameters *ap) { VideoData *s = s1->priv_data; int first_index, last_index; @@ -249,7 +249,7 @@ return 0; } -static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) +static int read_packet(AVFormatContext *s1, AVPacket *pkt) { VideoData *s = s1->priv_data; char filename[1024]; @@ -320,7 +320,7 @@ /******************************************************/ /* image output */ -static int img_write_header(AVFormatContext *s) +static int write_header(AVFormatContext *s) { VideoData *img = s->priv_data; @@ -336,7 +336,7 @@ return 0; } -static int img_write_packet(AVFormatContext *s, AVPacket *pkt) +static int write_packet(AVFormatContext *s, AVPacket *pkt) { VideoData *img = s->priv_data; ByteIOContext *pb[3]; @@ -413,56 +413,47 @@ /* input */ #if CONFIG_IMAGE2_DEMUXER AVInputFormat image2_demuxer = { - "image2", - NULL_IF_CONFIG_SMALL("image2 sequence"), - sizeof(VideoData), - image_probe, - img_read_header, - img_read_packet, - NULL, - NULL, - NULL, - AVFMT_NOFILE, + .name = "image2", + .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"), + .priv_data_size = sizeof(VideoData), + .read_probe = read_probe, + .read_header = read_header, + .read_packet = read_packet, + .flags = AVFMT_NOFILE, }; #endif #if CONFIG_IMAGE2PIPE_DEMUXER AVInputFormat image2pipe_demuxer = { - "image2pipe", - NULL_IF_CONFIG_SMALL("piped image2 sequence"), - sizeof(VideoData), - NULL, /* no probe */ - img_read_header, - img_read_packet, + .name = "image2pipe", + .long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"), + .priv_data_size = sizeof(VideoData), + .read_header = read_header, + .read_packet = read_packet, }; #endif /* output */ #if CONFIG_IMAGE2_MUXER AVOutputFormat image2_muxer = { - "image2", - NULL_IF_CONFIG_SMALL("image2 sequence"), - "", - "bmp,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png,ppm,sgi,tga,tif,tiff,jp2", - sizeof(VideoData), - CODEC_ID_NONE, - CODEC_ID_MJPEG, - img_write_header, - img_write_packet, - NULL, - .flags= AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE + .name = "image2", + .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"), + .extensions = "bmp,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png," + "ppm,sgi,tga,tif,tiff,jp2", + .priv_data_size = sizeof(VideoData), + .video_codec = CODEC_ID_MJPEG, + .write_header = write_header, + .write_packet = write_packet, + .flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE }; #endif #if CONFIG_IMAGE2PIPE_MUXER AVOutputFormat image2pipe_muxer = { - "image2pipe", - NULL_IF_CONFIG_SMALL("piped image2 sequence"), - "", - "", - sizeof(VideoData), - CODEC_ID_NONE, - CODEC_ID_MJPEG, - img_write_header, - img_write_packet, - .flags= AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS + .name = "image2pipe", + .long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"), + .priv_data_size = sizeof(VideoData), + .video_codec = CODEC_ID_MJPEG, + .write_header = write_header, + .write_packet = write_packet, + .flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS }; #endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/ingenientdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/ingenientdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/ingenientdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/ingenientdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,71 @@ +/* + * RAW Ingenient MJPEG demuxer + * Copyright (c) 2005 Alex Beregszaszi + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawdec.h" + +// http://www.artificis.hu/files/texts/ingenient.txt +static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + int ret, size, w, h, unk1, unk2; + + if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G')) + return AVERROR(EIO); // FIXME + + size = get_le32(s->pb); + + w = get_le16(s->pb); + h = get_le16(s->pb); + + url_fskip(s->pb, 8); // zero + size (padded?) + url_fskip(s->pb, 2); + unk1 = get_le16(s->pb); + unk2 = get_le16(s->pb); + url_fskip(s->pb, 22); // ASCII timestamp + + av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n", + size, w, h, unk1, unk2); + + if (av_new_packet(pkt, size) < 0) + return AVERROR(ENOMEM); + + pkt->pos = url_ftell(s->pb); + pkt->stream_index = 0; + ret = get_buffer(s->pb, pkt->data, size); + if (ret < 0) { + av_free_packet(pkt); + return ret; + } + pkt->size = ret; + return ret; +} + +AVInputFormat ingenient_demuxer = { + "ingenient", + NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"), + 0, + NULL, + ff_raw_video_read_header, + ingenient_read_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "cgi", // FIXME + .value = CODEC_ID_MJPEG, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/internal.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/internal.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/internal.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/internal.h 2010-11-06 17:21:29.000000000 +0000 @@ -24,6 +24,8 @@ #include #include "avformat.h" +#define MAX_URL_SIZE 4096 + typedef struct AVCodecTag { enum CodecID id; unsigned int tag; @@ -53,6 +55,16 @@ char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); +/** + * Parse a string of hexadecimal strings. Any space between the hexadecimal + * digits is ignored. + * + * @param data if non-null, the parsed data is written to this pointer + * @param p the string to parse + * @return the number of bytes written (or to be written, if data is null) + */ +int ff_hex_to_data(uint8_t *data, const char *p); + void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx); /** @@ -89,7 +101,7 @@ const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size); -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_URL_SPLIT /** * @deprecated use av_url_split() instead */ @@ -137,11 +149,13 @@ * @param size the size of the buff buffer * @param c the AVCodecContext of the media to describe * @param dest_addr the destination address of the media stream, may be NULL + * @param dest_type the destination address type, may be NULL * @param port the destination port of the media stream, 0 if unknown * @param ttl the time to live of the stream, 0 if not multicast */ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, - const char *dest_addr, int port, int ttl); + const char *dest_addr, const char *dest_type, + int port, int ttl); /** * Write a packet to another muxer than the one the user originally @@ -182,4 +196,28 @@ #define SPACE_CHARS " \t\r\n" +/** + * Callback function type for ff_parse_key_value. + * + * @param key a pointer to the key + * @param key_len the number of bytes that belong to the key, including the '=' + * char + * @param dest return the destination pointer for the value in *dest, may + * be null to ignore the value + * @param dest_len the length of the *dest buffer + */ +typedef void (*ff_parse_key_val_cb)(void *context, const char *key, + int key_len, char **dest, int *dest_len); +/** + * Parse a string with comma-separated key=value pairs. The value strings + * may be quoted and may contain escaped characters within quoted strings. + * + * @param str the string to parse + * @param callback_get_buf function that returns where to store the + * unescaped value string. + * @param context the opaque context pointer to pass to callback_get_buf + */ +void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, + void *context); + #endif /* AVFORMAT_INTERNAL_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/isom.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/isom.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/isom.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/isom.c 2010-11-06 17:21:29.000000000 +0000 @@ -77,6 +77,7 @@ { CODEC_ID_RAWVIDEO, MKTAG('b', '1', '6', 'g') }, { CODEC_ID_RAWVIDEO, MKTAG('b', '4', '8', 'r') }, + { CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') }, /* UNCOMPRESSED 10BIT RGB */ { CODEC_ID_R210, MKTAG('r', '2', '1', '0') }, /* UNCOMPRESSED 10BIT RGB */ { CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, /* UNCOMPRESSED 10BIT 4:2:2 */ @@ -129,8 +130,9 @@ { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */ + { CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */ { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */ - { CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, + { CODEC_ID_MPEG2VIDEO, MKTAG('m', '2', 'v', '1') }, /* Apple MPEG-2 Camcorder */ { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '1') }, /* MPEG2 HDV 720p30 */ { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '2') }, /* MPEG2 HDV 1080i60 */ { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '3') }, /* MPEG2 HDV 1080i50 */ @@ -144,6 +146,7 @@ { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '4', 'p') }, /* MPEG2 IMX PAL 625/50 40mb/s produced by FCP */ { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'n') }, /* MPEG2 IMX NTSC 525/60 30mb/s produced by FCP */ { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'p') }, /* MPEG2 IMX PAL 625/50 30mb/s produced by FCP */ + { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '4') }, /* XDCAM HD422 720p24 CBR */ { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '9') }, /* XDCAM HD422 720p60 CBR */ { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'a') }, /* XDCAM HD422 720p50 CBR */ { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'b') }, /* XDCAM HD422 1080i60 CBR */ @@ -167,7 +170,6 @@ { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'e') }, /* XDCAM EX 1080p25 VBR */ { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'f') }, /* XDCAM EX 1080p30 VBR */ { CODEC_ID_MPEG2VIDEO, MKTAG('A', 'V', 'm', 'p') }, /* AVID IMX PAL */ - { CODEC_ID_MPEG2VIDEO, MKTAG('m', '2', 'v', '1') }, { CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') }, /* JPEG 2000 produced by FCP */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/isom.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/isom.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/isom.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/isom.h 2010-11-06 17:21:29.000000000 +0000 @@ -145,4 +145,6 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom); enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags); +int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries); + #endif /* AVFORMAT_ISOM_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/lxfdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/lxfdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/lxfdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/lxfdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,348 @@ +/* + * LXF demuxer + * Copyright (c) 2010 Tomas Härdin + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/intreadwrite.h" +#include "avformat.h" +#include "riff.h" + +#define LXF_PACKET_HEADER_SIZE 60 +#define LXF_HEADER_DATA_SIZE 120 +#define LXF_IDENT "LEITCH\0" +#define LXF_IDENT_LENGTH 8 +#define LXF_SAMPLERATE 48000 +#define LXF_MAX_AUDIO_PACKET (8008*15*4) ///< 15-channel 32-bit NTSC audio frame + +static const AVCodecTag lxf_tags[] = { + { CODEC_ID_MJPEG, 0 }, + { CODEC_ID_MPEG1VIDEO, 1 }, + { CODEC_ID_MPEG2VIDEO, 2 }, //MpMl, 4:2:0 + { CODEC_ID_MPEG2VIDEO, 3 }, //MpPl, 4:2:2 + { CODEC_ID_DVVIDEO, 4 }, //DV25 + { CODEC_ID_DVVIDEO, 5 }, //DVCPRO + { CODEC_ID_DVVIDEO, 6 }, //DVCPRO50 + { CODEC_ID_RAWVIDEO, 7 }, //PIX_FMT_ARGB, where alpha is used for chroma keying + { CODEC_ID_RAWVIDEO, 8 }, //16-bit chroma key + { CODEC_ID_MPEG2VIDEO, 9 }, //4:2:2 CBP ("Constrained Bytes per Gop") + { CODEC_ID_NONE, 0 }, +}; + +typedef struct { + int channels; ///< number of audio channels. zero means no audio + uint8_t temp[LXF_MAX_AUDIO_PACKET]; ///< temp buffer for de-planarizing the audio data + int frame_number; ///< current video frame +} LXFDemuxContext; + +static int lxf_probe(AVProbeData *p) +{ + if (!memcmp(p->buf, LXF_IDENT, LXF_IDENT_LENGTH)) + return AVPROBE_SCORE_MAX; + + return 0; +} + +/** + * Verify the checksum of an LXF packet header + * + * @param[in] header the packet header to check + * @return zero if the checksum is OK, non-zero otherwise + */ +static int check_checksum(const uint8_t *header) +{ + int x; + uint32_t sum = 0; + + for (x = 0; x < LXF_PACKET_HEADER_SIZE; x += 4) + sum += AV_RL32(&header[x]); + + return sum; +} + +/** + * Read input until we find the next ident. If found, copy it to the header buffer + * + * @param[out] header where to copy the ident to + * @return 0 if an ident was found, < 0 on I/O error + */ +static int sync(AVFormatContext *s, uint8_t *header) +{ + uint8_t buf[LXF_IDENT_LENGTH]; + int ret; + + if ((ret = get_buffer(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH) + return ret < 0 ? ret : AVERROR_EOF; + + while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) { + if (url_feof(s->pb)) + return AVERROR_EOF; + + memmove(buf, &buf[1], LXF_IDENT_LENGTH-1); + buf[LXF_IDENT_LENGTH-1] = get_byte(s->pb); + } + + memcpy(header, LXF_IDENT, LXF_IDENT_LENGTH); + + return 0; +} + +/** + * Read and checksum the next packet header + * + * @param[out] header the read packet header + * @param[out] format context dependent format information + * @return the size of the payload following the header or < 0 on failure + */ +static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *format) +{ + ByteIOContext *pb = s->pb; + int track_size, samples, ret; + AVStream *st; + + //find and read the ident + if ((ret = sync(s, header)) < 0) + return ret; + + //read the rest of the packet header + if ((ret = get_buffer(pb, header + LXF_IDENT_LENGTH, + LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH)) != + LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH) { + return ret < 0 ? ret : AVERROR_EOF; + } + + if (check_checksum(header)) + av_log(s, AV_LOG_ERROR, "checksum error\n"); + + *format = AV_RL32(&header[32]); + ret = AV_RL32(&header[36]); + + //type + switch (AV_RL32(&header[16])) { + case 0: + //video + //skip VBI data and metadata + url_fskip(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) + + (int64_t)(uint32_t)AV_RL32(&header[52])); + break; + case 1: + //audio + if (!(st = s->streams[1])) { + av_log(s, AV_LOG_INFO, "got audio packet, but no audio stream present\n"); + break; + } + + //set codec based on specified audio bitdepth + //we only support tightly packed 16-, 20-, 24- and 32-bit PCM at the moment + *format = AV_RL32(&header[40]); + st->codec->bits_per_coded_sample = (*format >> 6) & 0x3F; + + if (st->codec->bits_per_coded_sample != (*format & 0x3F)) { + av_log(s, AV_LOG_WARNING, "only tightly packed PCM currently supported\n"); + return AVERROR_PATCHWELCOME; + } + + switch (st->codec->bits_per_coded_sample) { + case 16: st->codec->codec_id = CODEC_ID_PCM_S16LE; break; + case 20: st->codec->codec_id = CODEC_ID_PCM_LXF; break; + case 24: st->codec->codec_id = CODEC_ID_PCM_S24LE; break; + case 32: st->codec->codec_id = CODEC_ID_PCM_S32LE; break; + default: + av_log(s, AV_LOG_WARNING, + "only 16-, 20-, 24- and 32-bit PCM currently supported\n"); + return AVERROR_PATCHWELCOME; + } + + track_size = AV_RL32(&header[48]); + samples = track_size * 8 / st->codec->bits_per_coded_sample; + + //use audio packet size to determine video standard + //for NTSC we have one 8008-sample audio frame per five video frames + if (samples == LXF_SAMPLERATE * 5005 / 30000) { + av_set_pts_info(s->streams[0], 64, 1001, 30000); + } else { + //assume PAL, but warn if we don't have 1920 samples + if (samples != LXF_SAMPLERATE / 25) + av_log(s, AV_LOG_WARNING, + "video doesn't seem to be PAL or NTSC. guessing PAL\n"); + + av_set_pts_info(s->streams[0], 64, 1, 25); + } + + //TODO: warning if track mask != (1 << channels) - 1? + ret = av_popcount(AV_RL32(&header[44])) * track_size; + + break; + default: + break; + } + + return ret; +} + +static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) +{ + LXFDemuxContext *lxf = s->priv_data; + ByteIOContext *pb = s->pb; + uint8_t header[LXF_PACKET_HEADER_SIZE], header_data[LXF_HEADER_DATA_SIZE]; + int ret; + AVStream *st; + uint32_t format, video_params, disk_params; + uint16_t record_date, expiration_date; + + if ((ret = get_packet_header(s, header, &format)) < 0) + return ret; + + if (ret != LXF_HEADER_DATA_SIZE) { + av_log(s, AV_LOG_ERROR, "expected %d B size header, got %d\n", + LXF_HEADER_DATA_SIZE, ret); + return AVERROR_INVALIDDATA; + } + + if ((ret = get_buffer(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE) + return ret < 0 ? ret : AVERROR_EOF; + + if (!(st = av_new_stream(s, 0))) + return AVERROR_NOMEM; + + st->duration = AV_RL32(&header_data[32]); + video_params = AV_RL32(&header_data[40]); + record_date = AV_RL16(&header_data[56]); + expiration_date = AV_RL16(&header_data[58]); + disk_params = AV_RL32(&header_data[116]); + + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; + st->codec->bit_rate = 1000000 * ((video_params >> 14) & 0xFF); + st->codec->codec_tag = video_params & 0xF; + st->codec->codec_id = ff_codec_get_id(lxf_tags, st->codec->codec_tag); + + av_log(s, AV_LOG_DEBUG, "record: %x = %i-%02i-%02i\n", + record_date, 1900 + (record_date & 0x7F), (record_date >> 7) & 0xF, + (record_date >> 11) & 0x1F); + + av_log(s, AV_LOG_DEBUG, "expire: %x = %i-%02i-%02i\n", + expiration_date, 1900 + (expiration_date & 0x7F), (expiration_date >> 7) & 0xF, + (expiration_date >> 11) & 0x1F); + + if ((video_params >> 22) & 1) + av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n"); + + if ((lxf->channels = (disk_params >> 2) & 0xF)) { + if (!(st = av_new_stream(s, 1))) + return AVERROR_NOMEM; + + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + st->codec->sample_rate = LXF_SAMPLERATE; + st->codec->channels = lxf->channels; + + av_set_pts_info(st, 64, 1, st->codec->sample_rate); + } + + if (format == 1) { + //skip extended field data + url_fskip(s->pb, (uint32_t)AV_RL32(&header[40])); + } + + return 0; +} + +/** + * De-planerize the PCM data in lxf->temp + * FIXME: remove this once support for planar audio is added to libavcodec + * + * @param[out] out where to write the de-planerized data to + * @param[in] bytes the total size of the PCM data + */ +static void deplanarize(LXFDemuxContext *lxf, AVStream *ast, uint8_t *out, int bytes) +{ + int x, y, z, i, bytes_per_sample = ast->codec->bits_per_coded_sample >> 3; + + for (z = i = 0; z < lxf->channels; z++) + for (y = 0; y < bytes / bytes_per_sample / lxf->channels; y++) + for (x = 0; x < bytes_per_sample; x++, i++) + out[x + bytes_per_sample*(z + y*lxf->channels)] = lxf->temp[i]; +} + +static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + LXFDemuxContext *lxf = s->priv_data; + ByteIOContext *pb = s->pb; + uint8_t header[LXF_PACKET_HEADER_SIZE], *buf; + AVStream *ast = NULL; + uint32_t stream, format; + int ret, ret2; + + if ((ret = get_packet_header(s, header, &format)) < 0) + return ret; + + stream = AV_RL32(&header[16]); + + if (stream > 1) { + av_log(s, AV_LOG_WARNING, "got packet with illegal stream index %u\n", stream); + return AVERROR(EAGAIN); + } + + if (stream == 1 && !(ast = s->streams[1])) { + av_log(s, AV_LOG_ERROR, "got audio packet without having an audio stream\n"); + return AVERROR_INVALIDDATA; + } + + //make sure the data fits in the de-planerization buffer + if (ast && ret > LXF_MAX_AUDIO_PACKET) { + av_log(s, AV_LOG_ERROR, "audio packet too large (%i > %i)\n", + ret, LXF_MAX_AUDIO_PACKET); + return AVERROR_INVALIDDATA; + } + + if ((ret2 = av_new_packet(pkt, ret)) < 0) + return ret2; + + //read non-20-bit audio data into lxf->temp so we can deplanarize it + buf = ast && ast->codec->codec_id != CODEC_ID_PCM_LXF ? lxf->temp : pkt->data; + + if ((ret2 = get_buffer(pb, buf, ret)) != ret) { + av_free_packet(pkt); + return ret2 < 0 ? ret2 : AVERROR_EOF; + } + + pkt->stream_index = stream; + + if (ast) { + if(ast->codec->codec_id != CODEC_ID_PCM_LXF) + deplanarize(lxf, ast, pkt->data, ret); + } else { + //picture type (0 = closed I, 1 = open I, 2 = P, 3 = B) + if (((format >> 22) & 0x3) < 2) + pkt->flags |= AV_PKT_FLAG_KEY; + + pkt->dts = lxf->frame_number++; + } + + return ret; +} + +AVInputFormat lxf_demuxer = { + .name = "lxf", + .long_name = NULL_IF_CONFIG_SMALL("VR native stream format (LXF)"), + .priv_data_size = sizeof(LXFDemuxContext), + .read_probe = lxf_probe, + .read_header = lxf_read_header, + .read_packet = lxf_read_packet, + .codec_tag = (const AVCodecTag* const []){lxf_tags, 0}, +}; + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/m4vdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/m4vdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/m4vdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/m4vdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,62 @@ +/* + * RAW MPEG-4 video demuxer + * Copyright (c) 2006 Thijs Vermeir + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawdec.h" + +#define VISUAL_OBJECT_START_CODE 0x000001b5 +#define VOP_START_CODE 0x000001b6 + +static int mpeg4video_probe(AVProbeData *probe_packet) +{ + uint32_t temp_buffer= -1; + int VO=0, VOL=0, VOP = 0, VISO = 0, res=0; + int i; + + for(i=0; ibuf_size; i++){ + temp_buffer = (temp_buffer<<8) + probe_packet->buf[i]; + if ((temp_buffer & 0xffffff00) != 0x100) + continue; + + if (temp_buffer == VOP_START_CODE) VOP++; + else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++; + else if (temp_buffer < 0x120) VO++; + else if (temp_buffer < 0x130) VOL++; + else if ( !(0x1AF < temp_buffer && temp_buffer < 0x1B7) + && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++; + } + + if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0) + return AVPROBE_SCORE_MAX/2; + return 0; +} + +AVInputFormat m4v_demuxer = { + "m4v", + NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"), + 0, + mpeg4video_probe, /** probing for MPEG-4 data */ + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "m4v", + .value = CODEC_ID_MPEG4, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/Makefile chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/Makefile --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/Makefile 2010-08-11 17:40:55.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/Makefile 2010-11-06 17:21:29.000000000 +0000 @@ -7,6 +7,8 @@ OBJS = allformats.o \ cutils.o \ + id3v1.o \ + id3v2.o \ metadata.o \ metadata_compat.o \ options.o \ @@ -16,24 +18,26 @@ utils.o \ # muxers/demuxers -OBJS-$(CONFIG_AAC_DEMUXER) += raw.o id3v1.o id3v2.o -OBJS-$(CONFIG_AC3_DEMUXER) += raw.o -OBJS-$(CONFIG_AC3_MUXER) += raw.o +OBJS-$(CONFIG_A64_MUXER) += a64.o +OBJS-$(CONFIG_AAC_DEMUXER) += aacdec.o rawdec.o +OBJS-$(CONFIG_AC3_DEMUXER) += ac3dec.o rawdec.o +OBJS-$(CONFIG_AC3_MUXER) += rawenc.o OBJS-$(CONFIG_ADTS_MUXER) += adtsenc.o -OBJS-$(CONFIG_AEA_DEMUXER) += aea.o raw.o -OBJS-$(CONFIG_AIFF_DEMUXER) += aiffdec.o riff.o raw.o +OBJS-$(CONFIG_AEA_DEMUXER) += aea.o pcm.o +OBJS-$(CONFIG_AIFF_DEMUXER) += aiffdec.o riff.o pcm.o OBJS-$(CONFIG_AIFF_MUXER) += aiffenc.o riff.o OBJS-$(CONFIG_AMR_DEMUXER) += amr.o OBJS-$(CONFIG_AMR_MUXER) += amr.o OBJS-$(CONFIG_ANM_DEMUXER) += anm.o OBJS-$(CONFIG_APC_DEMUXER) += apc.o OBJS-$(CONFIG_APE_DEMUXER) += ape.o apetag.o +OBJS-$(CONFIG_APPLEHTTP_DEMUXER) += applehttp.o OBJS-$(CONFIG_ASF_DEMUXER) += asfdec.o asf.o asfcrypt.o \ riff.o avlanguage.o OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o riff.o OBJS-$(CONFIG_ASS_DEMUXER) += assdec.o OBJS-$(CONFIG_ASS_MUXER) += assenc.o -OBJS-$(CONFIG_AU_DEMUXER) += au.o raw.o +OBJS-$(CONFIG_AU_DEMUXER) += au.o pcm.o OBJS-$(CONFIG_AU_MUXER) += au.o OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o riff.o avi.o OBJS-$(CONFIG_AVI_MUXER) += avienc.o riff.o avi.o @@ -45,31 +49,31 @@ OBJS-$(CONFIG_BINK_DEMUXER) += bink.o OBJS-$(CONFIG_C93_DEMUXER) += c93.o vocdec.o voc.o OBJS-$(CONFIG_CAF_DEMUXER) += cafdec.o caf.o mov.o riff.o isom.o -OBJS-$(CONFIG_CAVSVIDEO_DEMUXER) += raw.o +OBJS-$(CONFIG_CAVSVIDEO_DEMUXER) += cavsvideodec.o rawdec.o OBJS-$(CONFIG_CDG_DEMUXER) += cdg.o OBJS-$(CONFIG_CRC_MUXER) += crcenc.o OBJS-$(CONFIG_DAUD_DEMUXER) += daud.o OBJS-$(CONFIG_DAUD_MUXER) += daud.o -OBJS-$(CONFIG_DIRAC_DEMUXER) += raw.o -OBJS-$(CONFIG_DIRAC_MUXER) += raw.o -OBJS-$(CONFIG_DNXHD_DEMUXER) += raw.o -OBJS-$(CONFIG_DNXHD_MUXER) += raw.o +OBJS-$(CONFIG_DIRAC_DEMUXER) += diracdec.o rawdec.o +OBJS-$(CONFIG_DIRAC_MUXER) += rawenc.o +OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddec.o rawdec.o +OBJS-$(CONFIG_DNXHD_MUXER) += rawenc.o OBJS-$(CONFIG_DSICIN_DEMUXER) += dsicin.o -OBJS-$(CONFIG_DTS_DEMUXER) += raw.o -OBJS-$(CONFIG_DTS_MUXER) += raw.o +OBJS-$(CONFIG_DTS_DEMUXER) += dtsdec.o rawdec.o +OBJS-$(CONFIG_DTS_MUXER) += rawenc.o OBJS-$(CONFIG_DV_DEMUXER) += dv.o OBJS-$(CONFIG_DV_MUXER) += dvenc.o OBJS-$(CONFIG_DXA_DEMUXER) += dxa.o riff.o OBJS-$(CONFIG_EA_CDATA_DEMUXER) += eacdata.o OBJS-$(CONFIG_EA_DEMUXER) += electronicarts.o -OBJS-$(CONFIG_EAC3_DEMUXER) += raw.o -OBJS-$(CONFIG_EAC3_MUXER) += raw.o +OBJS-$(CONFIG_EAC3_DEMUXER) += ac3dec.o rawdec.o +OBJS-$(CONFIG_EAC3_MUXER) += rawenc.o OBJS-$(CONFIG_FFM_DEMUXER) += ffmdec.o OBJS-$(CONFIG_FFM_MUXER) += ffmenc.o OBJS-$(CONFIG_FILMSTRIP_DEMUXER) += filmstripdec.o OBJS-$(CONFIG_FILMSTRIP_MUXER) += filmstripenc.o -OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o raw.o id3v1.o \ - id3v2.o oggparsevorbis.o \ +OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o rawdec.o \ + oggparsevorbis.o \ vorbiscomment.o OBJS-$(CONFIG_FLAC_MUXER) += flacenc.o flacenc_header.o \ vorbiscomment.o @@ -80,60 +84,63 @@ OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o OBJS-$(CONFIG_FRAMEMD5_MUXER) += md5enc.o OBJS-$(CONFIG_GIF_MUXER) += gif.o -OBJS-$(CONFIG_GSM_DEMUXER) += raw.o +OBJS-$(CONFIG_GSM_DEMUXER) += rawdec.o OBJS-$(CONFIG_GXF_DEMUXER) += gxf.o OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o audiointerleave.o -OBJS-$(CONFIG_H261_DEMUXER) += raw.o -OBJS-$(CONFIG_H261_MUXER) += raw.o -OBJS-$(CONFIG_H263_DEMUXER) += raw.o -OBJS-$(CONFIG_H263_MUXER) += raw.o -OBJS-$(CONFIG_H264_DEMUXER) += raw.o -OBJS-$(CONFIG_H264_MUXER) += raw.o +OBJS-$(CONFIG_G722_DEMUXER) += rawdec.o +OBJS-$(CONFIG_G722_MUXER) += rawenc.o +OBJS-$(CONFIG_H261_DEMUXER) += h261dec.o rawdec.o +OBJS-$(CONFIG_H261_MUXER) += rawenc.o +OBJS-$(CONFIG_H263_DEMUXER) += h263dec.o rawdec.o +OBJS-$(CONFIG_H263_MUXER) += rawenc.o +OBJS-$(CONFIG_H264_DEMUXER) += h264dec.o rawdec.o +OBJS-$(CONFIG_H264_MUXER) += rawenc.o OBJS-$(CONFIG_IDCIN_DEMUXER) += idcin.o OBJS-$(CONFIG_IFF_DEMUXER) += iff.o OBJS-$(CONFIG_IMAGE2_DEMUXER) += img2.o OBJS-$(CONFIG_IMAGE2_MUXER) += img2.o OBJS-$(CONFIG_IMAGE2PIPE_DEMUXER) += img2.o OBJS-$(CONFIG_IMAGE2PIPE_MUXER) += img2.o -OBJS-$(CONFIG_INGENIENT_DEMUXER) += raw.o +OBJS-$(CONFIG_INGENIENT_DEMUXER) += ingenientdec.o rawdec.o OBJS-$(CONFIG_IPMOVIE_DEMUXER) += ipmovie.o OBJS-$(CONFIG_ISS_DEMUXER) += iss.o OBJS-$(CONFIG_IV8_DEMUXER) += iv8.o OBJS-$(CONFIG_IVF_DEMUXER) += ivfdec.o riff.o OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o -OBJS-$(CONFIG_M4V_DEMUXER) += raw.o -OBJS-$(CONFIG_M4V_MUXER) += raw.o +OBJS-$(CONFIG_LXF_DEMUXER) += lxfdec.o +OBJS-$(CONFIG_M4V_DEMUXER) += m4vdec.o rawdec.o +OBJS-$(CONFIG_M4V_MUXER) += rawenc.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \ riff.o isom.o rmdec.o rm.o OBJS-$(CONFIG_MATROSKA_MUXER) += matroskaenc.o matroska.o \ riff.o isom.o avc.o \ flacenc_header.o OBJS-$(CONFIG_MD5_MUXER) += md5enc.o -OBJS-$(CONFIG_MJPEG_DEMUXER) += raw.o -OBJS-$(CONFIG_MJPEG_MUXER) += raw.o -OBJS-$(CONFIG_MLP_DEMUXER) += raw.o -OBJS-$(CONFIG_MLP_MUXER) += raw.o +OBJS-$(CONFIG_MJPEG_DEMUXER) += rawdec.o +OBJS-$(CONFIG_MJPEG_MUXER) += rawenc.o +OBJS-$(CONFIG_MLP_DEMUXER) += rawdec.o +OBJS-$(CONFIG_MLP_MUXER) += rawenc.o OBJS-$(CONFIG_MM_DEMUXER) += mm.o -OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o raw.o +OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o pcm.o OBJS-$(CONFIG_MMF_MUXER) += mmf.o riff.o OBJS-$(CONFIG_MOV_DEMUXER) += mov.o riff.o isom.o OBJS-$(CONFIG_MOV_MUXER) += movenc.o riff.o isom.o avc.o movenchint.o -OBJS-$(CONFIG_MP2_MUXER) += mp3.o id3v1.o id3v2.o -OBJS-$(CONFIG_MP3_DEMUXER) += mp3.o id3v1.o id3v2.o -OBJS-$(CONFIG_MP3_MUXER) += mp3.o id3v1.o id3v2.o -OBJS-$(CONFIG_MPC_DEMUXER) += mpc.o id3v1.o id3v2.o apetag.o +OBJS-$(CONFIG_MP2_MUXER) += mp3.o +OBJS-$(CONFIG_MP3_DEMUXER) += mp3.o +OBJS-$(CONFIG_MP3_MUXER) += mp3.o +OBJS-$(CONFIG_MPC_DEMUXER) += mpc.o apetag.o OBJS-$(CONFIG_MPC8_DEMUXER) += mpc8.o OBJS-$(CONFIG_MPEG1SYSTEM_MUXER) += mpegenc.o OBJS-$(CONFIG_MPEG1VCD_MUXER) += mpegenc.o OBJS-$(CONFIG_MPEG2DVD_MUXER) += mpegenc.o OBJS-$(CONFIG_MPEG2VOB_MUXER) += mpegenc.o OBJS-$(CONFIG_MPEG2SVCD_MUXER) += mpegenc.o -OBJS-$(CONFIG_MPEG1VIDEO_MUXER) += raw.o -OBJS-$(CONFIG_MPEG2VIDEO_MUXER) += raw.o +OBJS-$(CONFIG_MPEG1VIDEO_MUXER) += rawenc.o +OBJS-$(CONFIG_MPEG2VIDEO_MUXER) += rawenc.o OBJS-$(CONFIG_MPEGPS_DEMUXER) += mpeg.o OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpegts.o OBJS-$(CONFIG_MPEGTS_MUXER) += mpegtsenc.o adtsenc.o -OBJS-$(CONFIG_MPEGVIDEO_DEMUXER) += raw.o +OBJS-$(CONFIG_MPEGVIDEO_DEMUXER) += mpegvideodec.o rawdec.o OBJS-$(CONFIG_MPJPEG_MUXER) += mpjpeg.o OBJS-$(CONFIG_MSNWC_TCP_DEMUXER) += msnwc_tcp.o OBJS-$(CONFIG_MTV_DEMUXER) += mtv.o @@ -142,7 +149,7 @@ OBJS-$(CONFIG_MXF_MUXER) += mxfenc.o mxf.o audiointerleave.o OBJS-$(CONFIG_NC_DEMUXER) += ncdec.o OBJS-$(CONFIG_NSV_DEMUXER) += nsvdec.o -OBJS-$(CONFIG_NULL_MUXER) += raw.o +OBJS-$(CONFIG_NULL_MUXER) += nullenc.o OBJS-$(CONFIG_NUT_DEMUXER) += nutdec.o nut.o riff.o OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o riff.o OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o riff.o @@ -158,58 +165,58 @@ vorbiscomment.o OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \ vorbiscomment.o -OBJS-$(CONFIG_OMA_DEMUXER) += oma.o raw.o id3v2.o id3v1.o -OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_ALAW_MUXER) += raw.o -OBJS-$(CONFIG_PCM_F32BE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_F32BE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_F32LE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_F32LE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_F64BE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_F64BE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_F64LE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_F64LE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_MULAW_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_MULAW_MUXER) += raw.o -OBJS-$(CONFIG_PCM_S16BE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_S16BE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_S16LE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_S16LE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_S24BE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_S24BE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_S24LE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_S24LE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_S32BE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_S32BE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_S32LE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_S32LE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_S8_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_S8_MUXER) += raw.o -OBJS-$(CONFIG_PCM_U16BE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_U16BE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_U16LE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_U16LE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_U24BE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_U24BE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_U24LE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_U24LE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_U32BE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_U32BE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_U32LE_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_U32LE_MUXER) += raw.o -OBJS-$(CONFIG_PCM_U8_DEMUXER) += raw.o -OBJS-$(CONFIG_PCM_U8_MUXER) += raw.o +OBJS-$(CONFIG_OMA_DEMUXER) += oma.o pcm.o +OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_ALAW_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_F32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_F32BE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_F32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_F32LE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_F64BE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_F64BE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_F64LE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_F64LE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_MULAW_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_MULAW_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_S16BE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_S16BE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_S16LE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_S16LE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_S24BE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_S24BE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_S24LE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_S24LE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_S32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_S32BE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_S32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_S32LE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_S8_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_S8_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_U16BE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_U16BE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_U16LE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_U16LE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_U24BE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_U24BE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_U24LE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_U24LE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_U32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_U32BE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_U32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_U32LE_MUXER) += pcmenc.o rawenc.o +OBJS-$(CONFIG_PCM_U8_DEMUXER) += pcmdec.o pcm.o rawdec.o +OBJS-$(CONFIG_PCM_U8_MUXER) += pcmenc.o rawenc.o OBJS-$(CONFIG_PVA_DEMUXER) += pva.o OBJS-$(CONFIG_QCP_DEMUXER) += qcp.o OBJS-$(CONFIG_R3D_DEMUXER) += r3d.o -OBJS-$(CONFIG_RAWVIDEO_DEMUXER) += raw.o -OBJS-$(CONFIG_RAWVIDEO_MUXER) += raw.o +OBJS-$(CONFIG_RAWVIDEO_DEMUXER) += rawvideodec.o rawdec.o +OBJS-$(CONFIG_RAWVIDEO_MUXER) += rawenc.o OBJS-$(CONFIG_RL2_DEMUXER) += rl2.o OBJS-$(CONFIG_RM_DEMUXER) += rmdec.o rm.o OBJS-$(CONFIG_RM_MUXER) += rmenc.o rm.o -OBJS-$(CONFIG_ROQ_DEMUXER) += idroq.o -OBJS-$(CONFIG_ROQ_MUXER) += raw.o -OBJS-$(CONFIG_RSO_DEMUXER) += rsodec.o rso.o raw.o +OBJS-$(CONFIG_ROQ_DEMUXER) += idroqdec.o +OBJS-$(CONFIG_ROQ_MUXER) += idroqenc.o rawenc.o +OBJS-$(CONFIG_RSO_DEMUXER) += rsodec.o rso.o pcm.o OBJS-$(CONFIG_RSO_MUXER) += rsoenc.o rso.o OBJS-$(CONFIG_RPL_DEMUXER) += rpl.o OBJS-$(CONFIG_RTP_MUXER) += rtp.o \ @@ -219,52 +226,59 @@ rtpenc_mpv.o \ rtpenc.o \ rtpenc_h264.o \ + rtpenc_vp8.o \ rtpenc_xiph.o \ avc.o -OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o httpauth.o -OBJS-$(CONFIG_RTSP_MUXER) += rtsp.o rtspenc.o httpauth.o -OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o \ - rdt.o \ +OBJS-$(CONFIG_RTPDEC) += rdt.o \ rtp.o \ rtpdec.o \ rtpdec_amr.o \ rtpdec_asf.o \ rtpdec_h263.o \ rtpdec_h264.o \ + rtpdec_latm.o \ rtpdec_mpeg4.o \ rtpdec_qdm2.o \ + rtpdec_qt.o \ rtpdec_svq3.o \ + rtpdec_vp8.o \ rtpdec_xiph.o +OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o rtspdec.o httpauth.o +OBJS-$(CONFIG_RTSP_MUXER) += rtsp.o rtspenc.o httpauth.o \ + rtpenc_chain.o +OBJS-$(CONFIG_SAP_DEMUXER) += sapdec.o +OBJS-$(CONFIG_SAP_MUXER) += sapenc.o rtpenc_chain.o +OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o OBJS-$(CONFIG_SEGAFILM_DEMUXER) += segafilm.o -OBJS-$(CONFIG_SHORTEN_DEMUXER) += raw.o +OBJS-$(CONFIG_SHORTEN_DEMUXER) += rawdec.o OBJS-$(CONFIG_SIFF_DEMUXER) += siff.o OBJS-$(CONFIG_SMACKER_DEMUXER) += smacker.o -OBJS-$(CONFIG_SOL_DEMUXER) += sol.o raw.o -OBJS-$(CONFIG_SOX_DEMUXER) += soxdec.o raw.o +OBJS-$(CONFIG_SOL_DEMUXER) += sol.o pcm.o +OBJS-$(CONFIG_SOX_DEMUXER) += soxdec.o pcm.o OBJS-$(CONFIG_SOX_MUXER) += soxenc.o OBJS-$(CONFIG_SPDIF_MUXER) += spdif.o OBJS-$(CONFIG_SRT_DEMUXER) += srtdec.o -OBJS-$(CONFIG_SRT_MUXER) += raw.o +OBJS-$(CONFIG_SRT_MUXER) += rawenc.o OBJS-$(CONFIG_STR_DEMUXER) += psxstr.o OBJS-$(CONFIG_SWF_DEMUXER) += swfdec.o OBJS-$(CONFIG_SWF_MUXER) += swfenc.o OBJS-$(CONFIG_THP_DEMUXER) += thp.o OBJS-$(CONFIG_TIERTEXSEQ_DEMUXER) += tiertexseq.o OBJS-$(CONFIG_TMV_DEMUXER) += tmv.o -OBJS-$(CONFIG_TRUEHD_DEMUXER) += raw.o -OBJS-$(CONFIG_TRUEHD_MUXER) += raw.o -OBJS-$(CONFIG_TTA_DEMUXER) += tta.o id3v1.o id3v2.o +OBJS-$(CONFIG_TRUEHD_DEMUXER) += rawdec.o +OBJS-$(CONFIG_TRUEHD_MUXER) += rawenc.o +OBJS-$(CONFIG_TTA_DEMUXER) += tta.o OBJS-$(CONFIG_TTY_DEMUXER) += tty.o sauce.o OBJS-$(CONFIG_TXD_DEMUXER) += txd.o -OBJS-$(CONFIG_VC1_DEMUXER) += raw.o +OBJS-$(CONFIG_VC1_DEMUXER) += rawdec.o OBJS-$(CONFIG_VC1T_DEMUXER) += vc1test.o OBJS-$(CONFIG_VC1T_MUXER) += vc1testenc.o OBJS-$(CONFIG_VMD_DEMUXER) += sierravmd.o OBJS-$(CONFIG_VOC_DEMUXER) += vocdec.o voc.o OBJS-$(CONFIG_VOC_MUXER) += vocenc.o voc.o OBJS-$(CONFIG_VQF_DEMUXER) += vqf.o -OBJS-$(CONFIG_W64_DEMUXER) += wav.o riff.o raw.o -OBJS-$(CONFIG_WAV_DEMUXER) += wav.o riff.o raw.o +OBJS-$(CONFIG_W64_DEMUXER) += wav.o riff.o pcm.o +OBJS-$(CONFIG_WAV_DEMUXER) += wav.o riff.o pcm.o OBJS-$(CONFIG_WAV_MUXER) += wav.o riff.o OBJS-$(CONFIG_WC3_DEMUXER) += wc3movie.o OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ @@ -272,7 +286,7 @@ flacenc_header.o OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o -OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o id3v1.o +OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o OBJS-$(CONFIG_XA_DEMUXER) += xa.o OBJS-$(CONFIG_YOP_DEMUXER) += yop.o OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg.o @@ -285,10 +299,12 @@ # protocols I/O OBJS+= avio.o aviobuf.o +OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o OBJS-$(CONFIG_FILE_PROTOCOL) += file.o OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o -OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o asf.o +OBJS-$(CONFIG_MMSH_PROTOCOL) += mmsh.o mms.o asf.o +OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o mms.o asf.o OBJS-$(CONFIG_MD5_PROTOCOL) += md5proto.o OBJS-$(CONFIG_PIPE_PROTOCOL) += file.o @@ -300,7 +316,6 @@ OBJS-$(CONFIG_RTP_PROTOCOL) += rtpproto.o OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o -OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o # libavdevice dependencies OBJS-$(CONFIG_JACK_INDEV) += timefilter.o diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/matroskadec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/matroskadec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/matroskadec.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/matroskadec.c 2010-11-06 17:21:29.000000000 +0000 @@ -538,8 +538,8 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb, int max_size, uint64_t *number) { - int len_mask = 0x80, read = 1, n = 1; - int64_t total = 0; + int read = 1, n = 1; + uint64_t total = 0; /* The first byte tells us the length in bytes - get_byte() can normally * return 0, but since that's not a valid first ebmlID byte, we can @@ -556,10 +556,7 @@ } /* get the length of the EBML number */ - while (read <= max_size && !(total & len_mask)) { - read++; - len_mask >>= 1; - } + read = 8 - ff_log2_tab[total]; if (read > max_size) { int64_t pos = url_ftell(pb) - 1; av_log(matroska->ctx, AV_LOG_ERROR, @@ -569,7 +566,7 @@ } /* read out length */ - total &= ~len_mask; + total ^= 1 << ff_log2_tab[total]; while (n++ < read) total = (total << 8) | get_byte(pb); @@ -578,6 +575,20 @@ return read; } +/** + * Read a EBML length value. + * This needs special handling for the "unknown length" case which has multiple + * encodings. + */ +static int ebml_read_length(MatroskaDemuxContext *matroska, ByteIOContext *pb, + uint64_t *number) +{ + int res = ebml_read_num(matroska, pb, 8, number); + if (res > 0 && *number + 1 == 1ULL << (7 * res)) + *number = 0xffffffffffffffULL; + return res; +} + /* * Read the next element as an unsigned int. * 0 is success, < 0 is failure. @@ -586,7 +597,7 @@ { int n = 0; - if (size < 1 || size > 8) + if (size > 8) return AVERROR_INVALIDDATA; /* big-endian ordering; build up number */ @@ -603,7 +614,9 @@ */ static int ebml_read_float(ByteIOContext *pb, int size, double *num) { - if (size == 4) { + if (size == 0) { + *num = 0; + } else if (size == 4) { *num= av_int2flt(get_be32(pb)); } else if(size==8){ *num= av_int2dbl(get_be64(pb)); @@ -783,7 +796,7 @@ if (syntax->type != EBML_PASS && syntax->type != EBML_STOP) { matroska->current_id = 0; - if ((res = ebml_read_num(matroska, pb, 8, &length)) < 0) + if ((res = ebml_read_length(matroska, pb, &length)) < 0) return res; } @@ -901,6 +914,9 @@ int result = 0; int olen; + if (pkt_size >= 10000000) + return -1; + switch (encodings[0].compression.algo) { case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: return encodings[0].compression.settings.size; @@ -1017,6 +1033,11 @@ for (i=0; i < list->nb_elem; i++) { const char *lang = strcmp(tags[i].lang, "und") ? tags[i].lang : NULL; + + if (!tags[i].name) { + av_log(s, AV_LOG_WARNING, "Skipping invalid tag with no TagName.\n"); + continue; + } if (prefix) snprintf(key, sizeof(key), "%s/%s", prefix, tags[i].name); else av_strlcpy(key, tags[i].name, sizeof(key)); if (tags[i].def || !lang) { @@ -1032,6 +1053,7 @@ matroska_convert_tag(s, &tags[i].sub, metadata, key); } } + ff_metadata_conv(metadata, NULL, ff_mkv_metadata_conv); } static void matroska_convert_tags(AVFormatContext *s) @@ -1731,7 +1753,7 @@ int offset = 0, pkt_size = lace_size[n]; uint8_t *pkt_data = data; - if (lace_size[n] > size) { + if (pkt_size > size) { av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n"); break; } @@ -1907,5 +1929,4 @@ matroska_read_packet, matroska_read_close, matroska_read_seek, - .metadata_conv = ff_mkv_metadata_conv, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/matroskaenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/matroskaenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/matroskaenc.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/matroskaenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -25,6 +25,8 @@ #include "matroska.h" #include "avc.h" #include "flacenc.h" +#include "avlanguage.h" +#include "libavcore/samplefmt.h" #include "libavutil/intreadwrite.h" #include "libavutil/random_seed.h" #include "libavutil/lfg.h" @@ -539,7 +541,7 @@ AVMetadataTag *tag; if (!bit_depth) - bit_depth = av_get_bits_per_sample_format(codec->sample_fmt); + bit_depth = av_get_bits_per_sample_fmt(codec->sample_fmt); if (codec->codec_id == CODEC_ID_AAC) get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate); @@ -688,6 +690,101 @@ return 0; } +static void mkv_write_simpletag(ByteIOContext *pb, AVMetadataTag *t) +{ + uint8_t *key = av_strdup(t->key); + uint8_t *p = key; + const uint8_t *lang = NULL; + ebml_master tag; + + if ((p = strrchr(p, '-')) && + (lang = av_convert_lang_to(p + 1, AV_LANG_ISO639_2_BIBL))) + *p = 0; + + p = key; + while (*p) { + if (*p == ' ') + *p = '_'; + else if (*p >= 'a' && *p <= 'z') + *p -= 'a' - 'A'; + p++; + } + + tag = start_ebml_master(pb, MATROSKA_ID_SIMPLETAG, 0); + put_ebml_string(pb, MATROSKA_ID_TAGNAME, key); + if (lang) + put_ebml_string(pb, MATROSKA_ID_TAGLANG, lang); + put_ebml_string(pb, MATROSKA_ID_TAGSTRING, t->value); + end_ebml_master(pb, tag); + + av_freep(&key); +} + +static int mkv_write_tag(AVFormatContext *s, AVMetadata *m, unsigned int elementid, + unsigned int uid, ebml_master *tags) +{ + MatroskaMuxContext *mkv = s->priv_data; + ebml_master tag, targets; + AVMetadataTag *t = NULL; + int ret; + + if (!tags->pos) { + ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, url_ftell(s->pb)); + if (ret < 0) return ret; + + *tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0); + } + + tag = start_ebml_master(s->pb, MATROSKA_ID_TAG, 0); + targets = start_ebml_master(s->pb, MATROSKA_ID_TAGTARGETS, 0); + if (elementid) + put_ebml_uint(s->pb, elementid, uid); + end_ebml_master(s->pb, targets); + + while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) + mkv_write_simpletag(s->pb, t); + + end_ebml_master(s->pb, tag); + return 0; +} + +static int mkv_write_tags(AVFormatContext *s) +{ + ebml_master tags = {0}; + int i, ret; + + ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL); + + if (av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) { + ret = mkv_write_tag(s, s->metadata, 0, 0, &tags); + if (ret < 0) return ret; + } + + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + + if (!av_metadata_get(st->metadata, "", 0, AV_METADATA_IGNORE_SUFFIX)) + continue; + + ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &tags); + if (ret < 0) return ret; + } + + for (i = 0; i < s->nb_chapters; i++) { + AVChapter *ch = s->chapters[i]; + + if (!av_metadata_get(ch->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) + continue; + + ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id, &tags); + if (ret < 0) return ret; + } + + if (tags.pos) + end_ebml_master(s->pb, tags); + return 0; +} + static int mkv_write_header(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; @@ -758,6 +855,9 @@ if (mkv->mode != MODE_WEBM) { ret = mkv_write_chapters(s); if (ret < 0) return ret; + + ret = mkv_write_tags(s); + if (ret < 0) return ret; } if (url_is_streamed(s->pb)) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/metadata.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/metadata.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/metadata.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/metadata.c 2010-11-06 17:21:29.000000000 +0000 @@ -49,7 +49,7 @@ int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags) { AVMetadata *m= *pm; - AVMetadataTag *tag= av_metadata_get(m, key, NULL, AV_METADATA_MATCH_CASE); + AVMetadataTag *tag= av_metadata_get(m, key, NULL, flags); if(!m) m=*pm= av_mallocz(sizeof(*m)); @@ -86,11 +86,17 @@ return 0; } -#if LIBAVFORMAT_VERSION_MAJOR == 52 +#if FF_API_OLD_METADATA int av_metadata_set(AVMetadata **pm, const char *key, const char *value) { return av_metadata_set2(pm, key, value, 0); } + +void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv, + const AVMetadataConv *s_conv) +{ + return; +} #endif void av_metadata_free(AVMetadata **pm) @@ -107,8 +113,8 @@ av_freep(pm); } -void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv) +void ff_metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, + const AVMetadataConv *s_conv) { /* TODO: use binary search to look up the two conversion tables if the tables are getting big enough that it would matter speed wise */ @@ -140,15 +146,15 @@ *pm = dst; } -void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv) +void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, + const AVMetadataConv *s_conv) { int i; - metadata_conv(&ctx->metadata, d_conv, s_conv); + ff_metadata_conv(&ctx->metadata, d_conv, s_conv); for (i=0; inb_streams ; i++) - metadata_conv(&ctx->streams [i]->metadata, d_conv, s_conv); + ff_metadata_conv(&ctx->streams [i]->metadata, d_conv, s_conv); for (i=0; inb_chapters; i++) - metadata_conv(&ctx->chapters[i]->metadata, d_conv, s_conv); + ff_metadata_conv(&ctx->chapters[i]->metadata, d_conv, s_conv); for (i=0; inb_programs; i++) - metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv); + ff_metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/metadata_compat.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/metadata_compat.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/metadata_compat.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/metadata_compat.c 2010-11-06 17:21:29.000000000 +0000 @@ -23,7 +23,7 @@ #include "metadata.h" #include "libavutil/avstring.h" -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_OLD_METADATA #define SIZE_OFFSET(x) sizeof(((AVFormatContext*)0)->x),offsetof(AVFormatContext,x) @@ -145,4 +145,4 @@ } } -#endif /* LIBAVFORMAT_VERSION_MAJOR < 53 */ +#endif /* FF_API_OLD_METADATA */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/metadata.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/metadata.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/metadata.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/metadata.h 2010-11-06 17:21:29.000000000 +0000 @@ -39,13 +39,18 @@ const char *native; const char *generic; }; +#if !FF_API_OLD_METADATA +typedef struct AVMetadataConv AVMetadataConv; +#endif -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_OLD_METADATA void ff_metadata_demux_compat(AVFormatContext *s); void ff_metadata_mux_compat(AVFormatContext *s); #endif -void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv); +void ff_metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, + const AVMetadataConv *s_conv); +void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, + const AVMetadataConv *s_conv); #endif /* AVFORMAT_METADATA_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mmf.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mmf.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mmf.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mmf.c 2010-11-06 17:21:29.000000000 +0000 @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" -#include "raw.h" +#include "pcm.h" #include "riff.h" typedef struct { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mms.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mms.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mms.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mms.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,125 @@ +/* + * MMS protocol common definitions. + * Copyright (c) 2006,2007 Ryan Martell + * Copyright (c) 2007 Björn Axelsson + * Copyright (c) 2010 Zhentan Feng + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include "mms.h" +#include "asf.h" +#include "libavutil/intreadwrite.h" + +#if FF_API_MAX_STREAMS +#define MMS_MAX_STREAMS MAX_STREAMS +#else +#define MMS_MAX_STREAMS 256 /**< arbitrary sanity check value */ +#endif + +int ff_mms_read_header(MMSContext *mms, uint8_t *buf, const int size) +{ + char *pos; + int size_to_copy; + int remaining_size = mms->asf_header_size - mms->asf_header_read_size; + size_to_copy = FFMIN(size, remaining_size); + pos = mms->asf_header + mms->asf_header_read_size; + memcpy(buf, pos, size_to_copy); + if (mms->asf_header_read_size == mms->asf_header_size) { + av_freep(&mms->asf_header); // which contains asf header + } + mms->asf_header_read_size += size_to_copy; + return size_to_copy; +} + +int ff_mms_read_data(MMSContext *mms, uint8_t *buf, const int size) +{ + int read_size; + read_size = FFMIN(size, mms->remaining_in_len); + memcpy(buf, mms->read_in_ptr, read_size); + mms->remaining_in_len -= read_size; + mms->read_in_ptr += read_size; + return read_size; +} + +int ff_mms_asf_header_parser(MMSContext *mms) +{ + uint8_t *p = mms->asf_header; + uint8_t *end; + int flags, stream_id; + mms->stream_num = 0; + + if (mms->asf_header_size < sizeof(ff_asf_guid) * 2 + 22 || + memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (invalid ASF header, size=%d)\n", + mms->asf_header_size); + return AVERROR_INVALIDDATA; + } + + end = mms->asf_header + mms->asf_header_size; + + p += sizeof(ff_asf_guid) + 14; + while(end - p >= sizeof(ff_asf_guid) + 8) { + uint64_t chunksize; + if (!memcmp(p, ff_asf_data_header, sizeof(ff_asf_guid))) { + chunksize = 50; // see Reference [2] section 5.1 + } else { + chunksize = AV_RL64(p + sizeof(ff_asf_guid)); + } + if (!chunksize || chunksize > end - p) { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (header chunksize %"PRId64" is invalid)\n", + chunksize); + return AVERROR_INVALIDDATA; + } + if (!memcmp(p, ff_asf_file_header, sizeof(ff_asf_guid))) { + /* read packet size */ + if (end - p > sizeof(ff_asf_guid) * 2 + 68) { + mms->asf_packet_len = AV_RL32(p + sizeof(ff_asf_guid) * 2 + 64); + if (mms->asf_packet_len <= 0 || mms->asf_packet_len > sizeof(mms->in_buffer)) { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (too large pkt_len %d)\n", + mms->asf_packet_len); + return AVERROR_INVALIDDATA; + } + } + } else if (!memcmp(p, ff_asf_stream_header, sizeof(ff_asf_guid))) { + flags = AV_RL16(p + sizeof(ff_asf_guid)*3 + 24); + stream_id = flags & 0x7F; + //The second condition is for checking CS_PKT_STREAM_ID_REQUEST packet size, + //we can calcuate the packet size by stream_num. + //Please see function send_stream_selection_request(). + if (mms->stream_num < MMS_MAX_STREAMS && + 46 + mms->stream_num * 6 < sizeof(mms->out_buffer)) { + mms->streams = av_fast_realloc(mms->streams, + &mms->nb_streams_allocated, + (mms->stream_num + 1) * sizeof(MMSStream)); + mms->streams[mms->stream_num].id = stream_id; + mms->stream_num++; + } else { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (too many A/V streams)\n"); + return AVERROR_INVALIDDATA; + } + } else if (!memcmp(p, ff_asf_head1_guid, sizeof(ff_asf_guid))) { + chunksize = 46; // see references [2] section 3.4. This should be set 46. + } + p += chunksize; + } + + return 0; +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mms.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mms.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mms.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mms.h 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,63 @@ +/* + * MMS protocol common definitions. + * Copyright (c) 2010 Zhentan Feng + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef AVFORMAT_MMS_H +#define AVFORMAT_MMS_H + +#include "avformat.h" + +typedef struct { + int id; +}MMSStream; + +typedef struct { + URLContext *mms_hd; ///< TCP connection handle + MMSStream *streams; + + /** Buffer for outgoing packets. */ + /*@{*/ + uint8_t *write_out_ptr; ///< Pointer for writting the buffer. + uint8_t out_buffer[512]; ///< Buffer for outgoing packet. + /*@}*/ + + /** Buffer for incoming packets. */ + /*@{*/ + uint8_t in_buffer[8192]; ///< Buffer for incoming packets. + uint8_t *read_in_ptr; ///< Pointer for reading from incoming buffer. + int remaining_in_len; ///< Reading length from incoming buffer. + /*@}*/ + + /** Internal handling of the ASF header */ + /*@{*/ + uint8_t *asf_header; ///< Stored ASF header. + int asf_header_size; ///< Size of stored ASF header. + int header_parsed; ///< The header has been received and parsed. + int asf_packet_len; + int asf_header_read_size; + /*@}*/ + + int stream_num; ///< stream numbers. + unsigned int nb_streams_allocated; ///< allocated size of streams +} MMSContext; + +int ff_mms_asf_header_parser(MMSContext * mms); +int ff_mms_read_data(MMSContext *mms, uint8_t *buf, const int size); +int ff_mms_read_header(MMSContext * mms, uint8_t * buf, const int size); +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mmsh.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mmsh.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mmsh.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mmsh.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,369 @@ +/* + * MMS protocol over HTTP + * Copyright (c) 2010 Zhentan Feng + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * Reference + * Windows Media HTTP Streaming Protocol. + * http://msdn.microsoft.com/en-us/library/cc251059(PROT.10).aspx + */ + +#include +#include "libavutil/intreadwrite.h" +#include "libavutil/avstring.h" +#include "libavformat/internal.h" +#include "mms.h" +#include "asf.h" +#include "http.h" + +#define CHUNK_HEADER_LENGTH 4 // 2bytes chunk type and 2bytes chunk length. +#define EXT_HEADER_LENGTH 8 // 4bytes sequence, 2bytes useless and 2bytes chunk length. + +// see Ref 2.2.1.8 +#define USERAGENT "User-Agent: NSPlayer/4.1.0.3856\r\n" +// see Ref 2.2.1.4.33 +// the guid value can be changed to any valid value. +#define CLIENTGUID "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}\r\n" + +// see Ref 2.2.3 for packet type define: +// chunk type contains 2 fields: Frame and PacketID. +// Frame is 0x24 or 0xA4(rarely), different PacketID indicates different packet type. +typedef enum { + CHUNK_TYPE_DATA = 0x4424, + CHUNK_TYPE_ASF_HEADER = 0x4824, + CHUNK_TYPE_END = 0x4524, + CHUNK_TYPE_STREAM_CHANGE = 0x4324, +} ChunkType; + +typedef struct { + MMSContext mms; + int request_seq; ///< request packet sequence + int chunk_seq; ///< data packet sequence +} MMSHContext; + +static int mmsh_close(URLContext *h) +{ + MMSHContext *mmsh = (MMSHContext *)h->priv_data; + MMSContext *mms = &mmsh->mms; + if (mms->mms_hd) + url_close(mms->mms_hd); + av_free(mms->streams); + av_free(mms->asf_header); + av_freep(&h->priv_data); + return 0; +} + +static ChunkType get_chunk_header(MMSHContext *mmsh, int *len) +{ + MMSContext *mms = &mmsh->mms; + uint8_t chunk_header[CHUNK_HEADER_LENGTH]; + uint8_t ext_header[EXT_HEADER_LENGTH]; + ChunkType chunk_type; + int chunk_len, res, ext_header_len; + + res = url_read_complete(mms->mms_hd, chunk_header, CHUNK_HEADER_LENGTH); + if (res != CHUNK_HEADER_LENGTH) { + av_log(NULL, AV_LOG_ERROR, "Read data packet header failed!\n"); + return AVERROR(EIO); + } + chunk_type = AV_RL16(chunk_header); + chunk_len = AV_RL16(chunk_header + 2); + + switch (chunk_type) { + case CHUNK_TYPE_END: + case CHUNK_TYPE_STREAM_CHANGE: + ext_header_len = 4; + break; + case CHUNK_TYPE_ASF_HEADER: + case CHUNK_TYPE_DATA: + ext_header_len = 8; + break; + default: + av_log(NULL, AV_LOG_ERROR, "Strange chunk type %d\n", chunk_type); + return AVERROR_INVALIDDATA; + } + + res = url_read_complete(mms->mms_hd, ext_header, ext_header_len); + if (res != ext_header_len) { + av_log(NULL, AV_LOG_ERROR, "Read ext header failed!\n"); + return AVERROR(EIO); + } + *len = chunk_len - ext_header_len; + if (chunk_type == CHUNK_TYPE_END || chunk_type == CHUNK_TYPE_DATA) + mmsh->chunk_seq = AV_RL32(ext_header); + return chunk_type; +} + +static int read_data_packet(MMSHContext *mmsh, const int len) +{ + MMSContext *mms = &mmsh->mms; + int res; + if (len > sizeof(mms->in_buffer)) { + av_log(NULL, AV_LOG_ERROR, + "Data packet length %d exceeds the in_buffer size %zu\n", + len, sizeof(mms->in_buffer)); + return AVERROR(EIO); + } + res = url_read_complete(mms->mms_hd, mms->in_buffer, len); + dprintf(NULL, "Data packet len = %d\n", len); + if (res != len) { + av_log(NULL, AV_LOG_ERROR, "Read data packet failed!\n"); + return AVERROR(EIO); + } + if (len > mms->asf_packet_len) { + av_log(NULL, AV_LOG_ERROR, + "Chunk length %d exceed packet length %d\n",len, mms->asf_packet_len); + return AVERROR_INVALIDDATA; + } else { + memset(mms->in_buffer + len, 0, mms->asf_packet_len - len); // padding + } + mms->read_in_ptr = mms->in_buffer; + mms->remaining_in_len = mms->asf_packet_len; + return 0; +} + +static int get_http_header_data(MMSHContext *mmsh) +{ + MMSContext *mms = &mmsh->mms; + int res, len; + ChunkType chunk_type; + + for (;;) { + len = 0; + res = chunk_type = get_chunk_header(mmsh, &len); + if (res < 0) { + return res; + } else if (chunk_type == CHUNK_TYPE_ASF_HEADER){ + // get asf header and stored it + if (!mms->header_parsed) { + if (mms->asf_header) { + if (len != mms->asf_header_size) { + mms->asf_header_size = len; + dprintf(NULL, "Header len changed from %d to %d\n", + mms->asf_header_size, len); + av_freep(&mms->asf_header); + } + } + mms->asf_header = av_mallocz(len); + if (!mms->asf_header) { + return AVERROR(ENOMEM); + } + mms->asf_header_size = len; + } + if (len > mms->asf_header_size) { + av_log(NULL, AV_LOG_ERROR, + "Asf header packet len = %d exceed the asf header buf size %d\n", + len, mms->asf_header_size); + return AVERROR(EIO); + } + res = url_read_complete(mms->mms_hd, mms->asf_header, len); + if (res != len) { + av_log(NULL, AV_LOG_ERROR, + "Recv asf header data len %d != expected len %d\n", res, len); + return AVERROR(EIO); + } + mms->asf_header_size = len; + if (!mms->header_parsed) { + res = ff_mms_asf_header_parser(mms); + mms->header_parsed = 1; + return res; + } + } else if (chunk_type == CHUNK_TYPE_DATA) { + // read data packet and do padding + return read_data_packet(mmsh, len); + } else { + if (len) { + if (len > sizeof(mms->in_buffer)) { + av_log(NULL, AV_LOG_ERROR, + "Other packet len = %d exceed the in_buffer size %zu\n", + len, sizeof(mms->in_buffer)); + return AVERROR(EIO); + } + res = url_read_complete(mms->mms_hd, mms->in_buffer, len); + if (res != len) { + av_log(NULL, AV_LOG_ERROR, "Read other chunk type data failed!\n"); + return AVERROR(EIO); + } else { + dprintf(NULL, "Skip chunk type %d \n", chunk_type); + continue; + } + } + } + } + return 0; +} + +static int mmsh_open(URLContext *h, const char *uri, int flags) +{ + int i, port, err; + char httpname[256], path[256], host[128], location[1024]; + char *stream_selection = NULL; + char headers[1024]; + MMSHContext *mmsh; + MMSContext *mms; + + mmsh = h->priv_data = av_mallocz(sizeof(MMSHContext)); + if (!h->priv_data) + return AVERROR(ENOMEM); + mmsh->request_seq = h->is_streamed = 1; + mms = &mmsh->mms; + av_strlcpy(location, uri, sizeof(location)); + + av_url_split(NULL, 0, NULL, 0, + host, sizeof(host), &port, path, sizeof(path), location); + if (port<0) + port = 80; // default mmsh protocol port + ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, path); + + if (url_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) { + return AVERROR(EIO); + } + + snprintf(headers, sizeof(headers), + "Accept: */*\r\n" + USERAGENT + "Host: %s:%d\r\n" + "Pragma: no-cache,rate=1.000000,stream-time=0," + "stream-offset=0:0,request-context=%u,max-duration=0\r\n" + CLIENTGUID + "Connection: Close\r\n\r\n", + host, port, mmsh->request_seq++); + ff_http_set_headers(mms->mms_hd, headers); + + err = url_connect(mms->mms_hd); + if (err) { + goto fail; + } + err = get_http_header_data(mmsh); + if (err) { + av_log(NULL, AV_LOG_ERROR, "Get http header data failed!\n"); + goto fail; + } + + // close the socket and then reopen it for sending the second play request. + url_close(mms->mms_hd); + memset(headers, 0, sizeof(headers)); + if (url_alloc(&mms->mms_hd, httpname, URL_RDONLY) < 0) { + return AVERROR(EIO); + } + stream_selection = av_mallocz(mms->stream_num * 19 + 1); + if (!stream_selection) + return AVERROR(ENOMEM); + for (i = 0; i < mms->stream_num; i++) { + char tmp[20]; + err = snprintf(tmp, sizeof(tmp), "ffff:%d:0 ", mms->streams[i].id); + if (err < 0) + goto fail; + av_strlcat(stream_selection, tmp, mms->stream_num * 19 + 1); + } + // send play request + err = snprintf(headers, sizeof(headers), + "Accept: */*\r\n" + USERAGENT + "Host: %s:%d\r\n" + "Pragma: no-cache,rate=1.000000,request-context=%u\r\n" + "Pragma: xPlayStrm=1\r\n" + CLIENTGUID + "Pragma: stream-switch-count=%d\r\n" + "Pragma: stream-switch-entry=%s\r\n" + "Connection: Close\r\n\r\n", + host, port, mmsh->request_seq++, mms->stream_num, stream_selection); + av_freep(&stream_selection); + if (err < 0) { + av_log(NULL, AV_LOG_ERROR, "Build play request failed!\n"); + goto fail; + } + dprintf(NULL, "out_buffer is %s", headers); + ff_http_set_headers(mms->mms_hd, headers); + + err = url_connect(mms->mms_hd); + if (err) { + goto fail; + } + + err = get_http_header_data(mmsh); + if (err) { + av_log(NULL, AV_LOG_ERROR, "Get http header data failed!\n"); + goto fail; + } + + dprintf(NULL, "Connection successfully open\n"); + return 0; +fail: + av_freep(&stream_selection); + mmsh_close(h); + dprintf(NULL, "Connection failed with error %d\n", err); + return err; +} + +static int handle_chunk_type(MMSHContext *mmsh) +{ + MMSContext *mms = &mmsh->mms; + int res, len = 0; + ChunkType chunk_type; + chunk_type = get_chunk_header(mmsh, &len); + + switch (chunk_type) { + case CHUNK_TYPE_END: + mmsh->chunk_seq = 0; + av_log(NULL, AV_LOG_ERROR, "Stream ended!\n"); + return AVERROR(EIO); + case CHUNK_TYPE_STREAM_CHANGE: + mms->header_parsed = 0; + if (res = get_http_header_data(mmsh)) { + av_log(NULL, AV_LOG_ERROR,"Stream changed! Failed to get new header!\n"); + return res; + } + break; + case CHUNK_TYPE_DATA: + return read_data_packet(mmsh, len); + default: + av_log(NULL, AV_LOG_ERROR, "Recv other type packet %d\n", chunk_type); + return AVERROR_INVALIDDATA; + } + return 0; +} + +static int mmsh_read(URLContext *h, uint8_t *buf, int size) +{ + int res = 0; + MMSHContext *mmsh = h->priv_data; + MMSContext *mms = &mmsh->mms; + do { + if (mms->asf_header_read_size < mms->asf_header_size) { + // copy asf header into buffer + res = ff_mms_read_header(mms, buf, size); + } else { + if (!mms->remaining_in_len && (res = handle_chunk_type(mmsh))) + return res; + res = ff_mms_read_data(mms, buf, size); + } + } while (!res); + return res; +} + +URLProtocol mmsh_protocol = { + .name = "mmsh", + .url_open = mmsh_open, + .url_read = mmsh_read, + .url_write = NULL, + .url_seek = NULL, + .url_close = mmsh_close, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mmst.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mmst.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mmst.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mmst.c 2010-11-06 17:21:29.000000000 +0000 @@ -29,6 +29,7 @@ */ #include "avformat.h" +#include "mms.h" #include "internal.h" #include "libavutil/intreadwrite.h" #include "libavcodec/bytestream.h" @@ -84,51 +85,20 @@ } MMSSCPacketType; typedef struct { - int id; -}MMSStream; - -typedef struct { + MMSContext mms; int outgoing_packet_seq; ///< Outgoing packet sequence number. char path[256]; ///< Path of the resource being asked for. char host[128]; ///< Host of the resources. - - URLContext *mms_hd; ///< TCP connection handle - MMSStream streams[MAX_STREAMS]; - - /** Buffer for outgoing packets. */ - /*@{*/ - uint8_t *write_out_ptr; ///< Pointer for writting the buffer. - uint8_t out_buffer[512]; ///< Buffer for outgoing packet. - /*@}*/ - - /** Buffer for incoming packets. */ - /*@{*/ - uint8_t in_buffer[8192]; ///< Buffer for incoming packets. - uint8_t *read_in_ptr; ///< Pointer for reading from incoming buffer. - int remaining_in_len; ///< Reading length from incoming buffer. - /*@}*/ - int incoming_packet_seq; ///< Incoming packet sequence number. int incoming_flags; ///< Incoming packet flags. - int packet_id; ///< Identifier for packets in the current stream. unsigned int header_packet_id; ///< default is 2. - - /** Internal handling of the ASF header */ - /*@{*/ - uint8_t *asf_header; ///< Stored ASF header. - int asf_header_size; ///< Size of stored ASF header. - int header_parsed; ///< The header has been received and parsed. - int asf_packet_len; - int asf_header_read_size; - /*@}*/ - - int stream_num; ///< stream numbers. -} MMSContext; +} MMSTContext; /** Create MMST command packet header */ -static void start_command_packet(MMSContext *mms, MMSCSPacketType packet_type) +static void start_command_packet(MMSTContext *mmst, MMSCSPacketType packet_type) { + MMSContext *mms = &mmst->mms; mms->write_out_ptr = mms->out_buffer; bytestream_put_le32(&mms->write_out_ptr, 1); // start sequence @@ -136,7 +106,7 @@ bytestream_put_le32(&mms->write_out_ptr, 0); // Length starts from after the protocol type bytes bytestream_put_le32(&mms->write_out_ptr, MKTAG('M','M','S',' ')); bytestream_put_le32(&mms->write_out_ptr, 0); - bytestream_put_le32(&mms->write_out_ptr, mms->outgoing_packet_seq++); + bytestream_put_le32(&mms->write_out_ptr, mmst->outgoing_packet_seq++); bytestream_put_le64(&mms->write_out_ptr, 0); // timestamp bytestream_put_le32(&mms->write_out_ptr, 0); bytestream_put_le16(&mms->write_out_ptr, packet_type); @@ -152,10 +122,11 @@ } /** Send a prepared MMST command packet. */ -static int send_command_packet(MMSContext *mms) +static int send_command_packet(MMSTContext *mmst) { + MMSContext *mms = &mmst->mms; int len= mms->write_out_ptr - mms->out_buffer; - int exact_length = (len + 7) & ~7; + int exact_length = FFALIGN(len, 8); int first_length= exact_length - 16; int len8= first_length/8; int write_result; @@ -192,18 +163,19 @@ mms->write_out_ptr += len; } -static int send_time_test_data(MMSContext *mms) +static int send_time_test_data(MMSTContext *mmst) { - start_command_packet(mms, CS_PKT_TIMING_DATA_REQUEST); - insert_command_prefixes(mms, 0xf0f0f0f1, 0x0004000b); - return send_command_packet(mms); + start_command_packet(mmst, CS_PKT_TIMING_DATA_REQUEST); + insert_command_prefixes(&mmst->mms, 0x00f0f0f0, 0x0004000b); + return send_command_packet(mmst); } -static int send_protocol_select(MMSContext *mms) +static int send_protocol_select(MMSTContext *mmst) { char data_string[256]; + MMSContext *mms = &mmst->mms; - start_command_packet(mms, CS_PKT_PROTOCOL_SELECT); + start_command_packet(mmst, CS_PKT_PROTOCOL_SELECT); insert_command_prefixes(mms, 0, 0xffffffff); bytestream_put_le32(&mms->write_out_ptr, 0); // maxFunnelBytes bytestream_put_le32(&mms->write_out_ptr, 0x00989680); // maxbitRate @@ -217,35 +189,37 @@ LOCAL_PORT); mms_put_utf16(mms, data_string); - return send_command_packet(mms); + return send_command_packet(mmst); } -static int send_media_file_request(MMSContext *mms) +static int send_media_file_request(MMSTContext *mmst) { - start_command_packet(mms, CS_PKT_MEDIA_FILE_REQUEST); + MMSContext *mms = &mmst->mms; + start_command_packet(mmst, CS_PKT_MEDIA_FILE_REQUEST); insert_command_prefixes(mms, 1, 0xffffffff); bytestream_put_le32(&mms->write_out_ptr, 0); bytestream_put_le32(&mms->write_out_ptr, 0); - mms_put_utf16(mms, mms->path + 1); // +1 for skip "/" + mms_put_utf16(mms, mmst->path + 1); // +1 for skip "/" - return send_command_packet(mms); + return send_command_packet(mmst); } -static void handle_packet_stream_changing_type(MMSContext *mms) +static void handle_packet_stream_changing_type(MMSTContext *mmst) { + MMSContext *mms = &mmst->mms; dprintf(NULL, "Stream changing!\n"); // 40 is the packet header size, 7 is the prefix size. - mms->header_packet_id= AV_RL32(mms->in_buffer + 40 + 7); - dprintf(NULL, "Changed header prefix to 0x%x", mms->header_packet_id); + mmst->header_packet_id= AV_RL32(mms->in_buffer + 40 + 7); + dprintf(NULL, "Changed header prefix to 0x%x", mmst->header_packet_id); } -static int send_keepalive_packet(MMSContext *mms) +static int send_keepalive_packet(MMSTContext *mmst) { // respond to a keepalive with a keepalive... - start_command_packet(mms, CS_PKT_KEEPALIVE); - insert_command_prefixes(mms, 1, 0x100FFFF); - return send_command_packet(mms); + start_command_packet(mmst, CS_PKT_KEEPALIVE); + insert_command_prefixes(&mmst->mms, 1, 0x100FFFF); + return send_command_packet(mmst); } /** Pad media packets smaller than max_packet_size and/or adjust read position @@ -260,11 +234,11 @@ } /** Read incoming MMST media, header or command packet. */ -static MMSSCPacketType get_tcp_server_response(MMSContext *mms) +static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) { int read_result; MMSSCPacketType packet_type= -1; - + MMSContext *mms = &mmst->mms; for(;;) { read_result = url_read_complete(mms->mms_hd, mms->in_buffer, 8); if (read_result != 8) { @@ -285,7 +259,7 @@ if(AV_RL32(mms->in_buffer + 4)==0xb00bface) { int length_remaining, hr; - mms->incoming_flags= mms->in_buffer[3]; + mmst->incoming_flags= mms->in_buffer[3]; read_result= url_read_complete(mms->mms_hd, mms->in_buffer+8, 4); if(read_result != 4) { av_log(NULL, AV_LOG_ERROR, @@ -332,9 +306,9 @@ // then fill up the buffer with the others tmp = AV_RL16(mms->in_buffer + 6); length_remaining = (tmp - 8) & 0xffff; - mms->incoming_packet_seq = AV_RL32(mms->in_buffer); + mmst->incoming_packet_seq = AV_RL32(mms->in_buffer); packet_id_type = mms->in_buffer[4]; - mms->incoming_flags = mms->in_buffer[5]; + mmst->incoming_flags = mms->in_buffer[5]; if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 8) { @@ -356,7 +330,7 @@ } // if we successfully read everything. - if(packet_id_type == mms->header_packet_id) { + if(packet_id_type == mmst->header_packet_id) { packet_type = SC_PKT_ASF_HEADER; // Store the asf header if(!mms->header_parsed) { @@ -372,9 +346,9 @@ mms->asf_header_size += mms->remaining_in_len; } // 0x04 means asf header is sent in multiple packets. - if (mms->incoming_flags == 0x04) + if (mmst->incoming_flags == 0x04) continue; - } else if(packet_id_type == mms->packet_id) { + } else if(packet_id_type == mmst->packet_id) { packet_type = SC_PKT_ASF_MEDIA; } else { dprintf(NULL, "packet id type %d is old.", packet_id_type); @@ -384,10 +358,10 @@ // preprocess some packet type if(packet_type == SC_PKT_KEEPALIVE) { - send_keepalive_packet(mms); + send_keepalive_packet(mmst); continue; } else if(packet_type == SC_PKT_STREAM_CHANGING) { - handle_packet_stream_changing_type(mms); + handle_packet_stream_changing_type(mmst); } else if(packet_type == SC_PKT_ASF_MEDIA) { pad_media_packet(mms); } @@ -395,20 +369,20 @@ } } -static int mms_safe_send_recv(MMSContext *mms, - int (*send_fun)(MMSContext *mms), +static int mms_safe_send_recv(MMSTContext *mmst, + int (*send_fun)(MMSTContext *mmst), const MMSSCPacketType expect_type) { MMSSCPacketType type; if(send_fun) { - int ret = send_fun(mms); + int ret = send_fun(mmst); if (ret < 0) { dprintf(NULL, "Send Packet error before expecting recv packet %d\n", expect_type); return ret; } } - if ((type = get_tcp_server_response(mms)) != expect_type) { + if ((type = get_tcp_server_response(mmst)) != expect_type) { av_log(NULL, AV_LOG_ERROR, "Corrupt stream (unexpected packet type 0x%x, expected 0x%x)\n", type, expect_type); @@ -418,9 +392,10 @@ } } -static int send_media_header_request(MMSContext *mms) +static int send_media_header_request(MMSTContext *mmst) { - start_command_packet(mms, CS_PKT_MEDIA_HEADER_REQUEST); + MMSContext *mms = &mmst->mms; + start_command_packet(mmst, CS_PKT_MEDIA_HEADER_REQUEST); insert_command_prefixes(mms, 1, 0); bytestream_put_le32(&mms->write_out_ptr, 0); bytestream_put_le32(&mms->write_out_ptr, 0x00800000); @@ -435,143 +410,75 @@ bytestream_put_le32(&mms->write_out_ptr, 2); bytestream_put_le32(&mms->write_out_ptr, 0); - return send_command_packet(mms); + return send_command_packet(mmst); } /** Send the initial handshake. */ -static int send_startup_packet(MMSContext *mms) +static int send_startup_packet(MMSTContext *mmst) { char data_string[256]; + MMSContext *mms = &mmst->mms; // SubscriberName is defined in MS specification linked below. // The guid value can be any valid value. // http://download.microsoft.com/ // download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/%5BMS-WMSP%5D.pdf snprintf(data_string, sizeof(data_string), "NSPlayer/7.0.0.1956; {%s}; Host: %s", - "7E667F5D-A661-495E-A512-F55686DDA178", mms->host); + "7E667F5D-A661-495E-A512-F55686DDA178", mmst->host); - start_command_packet(mms, CS_PKT_INITIAL); + start_command_packet(mmst, CS_PKT_INITIAL); insert_command_prefixes(mms, 0, 0x0004000b); bytestream_put_le32(&mms->write_out_ptr, 0x0003001c); mms_put_utf16(mms, data_string); - return send_command_packet(mms); -} - -static int asf_header_parser(MMSContext *mms) -{ - uint8_t *p = mms->asf_header; - uint8_t *end; - int flags, stream_id; - mms->stream_num = 0; - - if (mms->asf_header_size < sizeof(ff_asf_guid) * 2 + 22 || - memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) { - av_log(NULL, AV_LOG_ERROR, - "Corrupt stream (invalid ASF header, size=%d)\n", - mms->asf_header_size); - return AVERROR_INVALIDDATA; - } - - end = mms->asf_header + mms->asf_header_size; - - p += sizeof(ff_asf_guid) + 14; - while(end - p >= sizeof(ff_asf_guid) + 8) { - uint64_t chunksize = AV_RL64(p + sizeof(ff_asf_guid)); - if (!chunksize || chunksize > end - p) { - av_log(NULL, AV_LOG_ERROR, - "Corrupt stream (header chunksize %"PRId64" is invalid)\n", - chunksize); - return AVERROR_INVALIDDATA; - } - if (!memcmp(p, ff_asf_file_header, sizeof(ff_asf_guid))) { - /* read packet size */ - if (end - p > sizeof(ff_asf_guid) * 2 + 68) { - mms->asf_packet_len = AV_RL32(p + sizeof(ff_asf_guid) * 2 + 64); - if (mms->asf_packet_len <= 0 || mms->asf_packet_len > sizeof(mms->in_buffer)) { - av_log(NULL, AV_LOG_ERROR, - "Corrupt stream (too large pkt_len %d)\n", - mms->asf_packet_len); - return AVERROR_INVALIDDATA; - } - } - } else if (!memcmp(p, ff_asf_stream_header, sizeof(ff_asf_guid))) { - flags = AV_RL16(p + sizeof(ff_asf_guid)*3 + 24); - stream_id = flags & 0x7F; - //The second condition is for checking CS_PKT_STREAM_ID_REQUEST packet size, - //we can calcuate the packet size by stream_num. - //Please see function send_stream_selection_request(). - if (mms->stream_num < MAX_STREAMS && - 46 + mms->stream_num * 6 < sizeof(mms->out_buffer)) { - mms->streams[mms->stream_num].id = stream_id; - mms->stream_num++; - } else { - av_log(NULL, AV_LOG_ERROR, - "Corrupt stream (too many A/V streams)\n"); - return AVERROR_INVALIDDATA; - } - } else if (!memcmp(p, ff_asf_head1_guid, sizeof(ff_asf_guid))) { - chunksize = 46; // see references [2] section 3.4. This should be set 46. - } - p += chunksize; - } - - return 0; + return send_command_packet(mmst); } /** Send MMST stream selection command based on the AVStream->discard values. */ -static int send_stream_selection_request(MMSContext *mms) +static int send_stream_selection_request(MMSTContext *mmst) { int i; - + MMSContext *mms = &mmst->mms; // send the streams we want back... - start_command_packet(mms, CS_PKT_STREAM_ID_REQUEST); + start_command_packet(mmst, CS_PKT_STREAM_ID_REQUEST); bytestream_put_le32(&mms->write_out_ptr, mms->stream_num); // stream nums for(i= 0; istream_num; i++) { bytestream_put_le16(&mms->write_out_ptr, 0xffff); // flags bytestream_put_le16(&mms->write_out_ptr, mms->streams[i].id); // stream id bytestream_put_le16(&mms->write_out_ptr, 0); // selection } - return send_command_packet(mms); + return send_command_packet(mmst); } -static int read_data(MMSContext *mms, uint8_t *buf, const int buf_size) +static int send_close_packet(MMSTContext *mmst) { - int read_size; - read_size = FFMIN(buf_size, mms->remaining_in_len); - memcpy(buf, mms->read_in_ptr, read_size); - mms->remaining_in_len -= read_size; - mms->read_in_ptr += read_size; - return read_size; -} + start_command_packet(mmst, CS_PKT_STREAM_CLOSE); + insert_command_prefixes(&mmst->mms, 1, 1); -static int send_close_packet(MMSContext *mms) -{ - start_command_packet(mms, CS_PKT_STREAM_CLOSE); - insert_command_prefixes(mms, 1, 1); - - return send_command_packet(mms); + return send_command_packet(mmst); } /** Close the MMSH/MMST connection */ static int mms_close(URLContext *h) { - MMSContext *mms = (MMSContext *)h->priv_data; - + MMSTContext *mmst = (MMSTContext *)h->priv_data; + MMSContext *mms = &mmst->mms; if(mms->mms_hd) { - send_close_packet(mms); + send_close_packet(mmst); url_close(mms->mms_hd); } /* free all separately allocated pointers in mms */ + av_free(mms->streams); av_free(mms->asf_header); av_freep(&h->priv_data); return 0; } -static int send_media_packet_request(MMSContext *mms) +static int send_media_packet_request(MMSTContext *mmst) { - start_command_packet(mms, CS_PKT_START_FROM_PKT_ID); + MMSContext *mms = &mmst->mms; + start_command_packet(mmst, CS_PKT_START_FROM_PKT_ID); insert_command_prefixes(mms, 1, 0x0001FFFF); bytestream_put_le64(&mms->write_out_ptr, 0); // seek timestamp bytestream_put_le32(&mms->write_out_ptr, 0xffffffff); // unknown @@ -581,9 +488,9 @@ bytestream_put_byte(&mms->write_out_ptr, 0xff); // max stream time limit bytestream_put_byte(&mms->write_out_ptr, 0x00); // stream time limit flag - mms->packet_id++; // new packet_id - bytestream_put_le32(&mms->write_out_ptr, mms->packet_id); - return send_command_packet(mms); + mmst->packet_id++; // new packet_id + bytestream_put_le32(&mms->write_out_ptr, mmst->packet_id); + return send_command_packet(mmst); } @@ -595,52 +502,58 @@ static int mms_open(URLContext *h, const char *uri, int flags) { + MMSTContext *mmst; MMSContext *mms; int port, err; char tcpname[256]; h->is_streamed = 1; - mms = h->priv_data = av_mallocz(sizeof(MMSContext)); + mmst = h->priv_data = av_mallocz(sizeof(MMSTContext)); if (!h->priv_data) return AVERROR(ENOMEM); + mms = &mmst->mms; // only for MMS over TCP, so set proto = NULL av_url_split(NULL, 0, NULL, 0, - mms->host, sizeof(mms->host), &port, mms->path, - sizeof(mms->path), uri); + mmst->host, sizeof(mmst->host), &port, mmst->path, + sizeof(mmst->path), uri); if(port<0) port = 1755; // defaut mms protocol port // establish tcp connection. - ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, mms->host, port, NULL); + ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, mmst->host, port, NULL); err = url_open(&mms->mms_hd, tcpname, URL_RDWR); if (err) goto fail; - mms->packet_id = 3; // default, initial value. - mms->header_packet_id = 2; // default, initial value. - err = mms_safe_send_recv(mms, send_startup_packet, SC_PKT_CLIENT_ACCEPTED); + mmst->packet_id = 3; // default, initial value. + mmst->header_packet_id = 2; // default, initial value. + err = mms_safe_send_recv(mmst, send_startup_packet, SC_PKT_CLIENT_ACCEPTED); if (err) goto fail; - err = mms_safe_send_recv(mms, send_time_test_data, SC_PKT_TIMING_TEST_REPLY); + err = mms_safe_send_recv(mmst, send_time_test_data, SC_PKT_TIMING_TEST_REPLY); if (err) goto fail; - err = mms_safe_send_recv(mms, send_protocol_select, SC_PKT_PROTOCOL_ACCEPTED); + err = mms_safe_send_recv(mmst, send_protocol_select, SC_PKT_PROTOCOL_ACCEPTED); if (err) goto fail; - err = mms_safe_send_recv(mms, send_media_file_request, SC_PKT_MEDIA_FILE_DETAILS); + err = mms_safe_send_recv(mmst, send_media_file_request, SC_PKT_MEDIA_FILE_DETAILS); if (err) goto fail; - err = mms_safe_send_recv(mms, send_media_header_request, SC_PKT_HEADER_REQUEST_ACCEPTED); + err = mms_safe_send_recv(mmst, send_media_header_request, SC_PKT_HEADER_REQUEST_ACCEPTED); if (err) goto fail; - err = mms_safe_send_recv(mms, NULL, SC_PKT_ASF_HEADER); + err = mms_safe_send_recv(mmst, NULL, SC_PKT_ASF_HEADER); if (err) goto fail; - if((mms->incoming_flags != 0X08) && (mms->incoming_flags != 0X0C)) + if((mmst->incoming_flags != 0X08) && (mmst->incoming_flags != 0X0C)) { + av_log(NULL, AV_LOG_ERROR, + "The server does not support MMST (try MMSH or RTSP)\n"); + err = AVERROR_NOFMT; goto fail; - err = asf_header_parser(mms); + } + err = ff_mms_asf_header_parser(mms); if (err) { dprintf(NULL, "asf header parsed failed!\n"); goto fail; @@ -651,11 +564,11 @@ goto fail; clear_stream_buffers(mms); - err = mms_safe_send_recv(mms, send_stream_selection_request, SC_PKT_STREAM_ID_ACCEPTED); + err = mms_safe_send_recv(mmst, send_stream_selection_request, SC_PKT_STREAM_ID_ACCEPTED); if (err) goto fail; // send media packet request - err = mms_safe_send_recv(mms, send_media_packet_request, SC_PKT_MEDIA_PKT_FOLLOWS); + err = mms_safe_send_recv(mmst, send_media_packet_request, SC_PKT_MEDIA_PKT_FOLLOWS); if (err) { goto fail; } @@ -671,30 +584,21 @@ static int mms_read(URLContext *h, uint8_t *buf, int size) { /* TODO: see tcp.c:tcp_read() about a possible timeout scheme */ - MMSContext *mms = h->priv_data; + MMSTContext *mmst = h->priv_data; + MMSContext *mms = &mmst->mms; int result = 0; - int size_to_copy; do { if(mms->asf_header_read_size < mms->asf_header_size) { /* Read from ASF header buffer */ - size_to_copy= FFMIN(size, - mms->asf_header_size - mms->asf_header_read_size); - memcpy(buf, mms->asf_header + mms->asf_header_read_size, size_to_copy); - mms->asf_header_read_size += size_to_copy; - result += size_to_copy; - dprintf(NULL, "Copied %d bytes from stored header. left: %d\n", - size_to_copy, mms->asf_header_size - mms->asf_header_read_size); - if (mms->asf_header_size == mms->asf_header_read_size) { - av_freep(&mms->asf_header); - } + result = ff_mms_read_header(mms, buf, size); } else if(mms->remaining_in_len) { /* Read remaining packet data to buffer. * the result can not be zero because remaining_in_len is positive.*/ - result = read_data(mms, buf, size); + result = ff_mms_read_data(mms, buf, size); } else { /* Read from network */ - int err = mms_safe_send_recv(mms, NULL, SC_PKT_ASF_MEDIA); + int err = mms_safe_send_recv(mmst, NULL, SC_PKT_ASF_MEDIA); if (err == 0) { if(mms->remaining_in_len>mms->asf_packet_len) { av_log(NULL, AV_LOG_ERROR, @@ -703,7 +607,7 @@ result= AVERROR_IO; } else { // copy the data to the packet buffer. - result = read_data(mms, buf, size); + result = ff_mms_read_data(mms, buf, size); if (result == 0) { dprintf(NULL, "read asf media paket size is zero!\n"); break; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mov.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mov.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mov.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mov.c 2010-11-06 17:21:29.000000000 +0000 @@ -345,6 +345,9 @@ uint32_t size = get_be32(pb); int64_t next = url_ftell(pb) + size - 4; + if (size < 12) + return -1; + dref->type = get_le32(pb); get_be32(pb); // version + flags dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); @@ -525,6 +528,7 @@ dprintf(fc, "Specific MPEG4 header len=%d\n", len); if((uint64_t)len > (1<<30)) return -1; + av_free(st->codec->extradata); st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); @@ -559,6 +563,23 @@ return ff_mov_read_esds(c->fc, pb, atom); } +static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +{ + AVStream *st; + int ac3info, acmod, lfeon; + + if (c->fc->nb_streams < 1) + return 0; + st = c->fc->streams[c->fc->nb_streams-1]; + + ac3info = get_be24(pb); + acmod = (ac3info >> 11) & 0x7; + lfeon = (ac3info >> 10) & 0x1; + st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon; + + return 0; +} + static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { const int num = get_be32(pb); @@ -569,12 +590,13 @@ return 0; st = c->fc->streams[c->fc->nb_streams-1]; - if (den != 0) { - if ((st->sample_aspect_ratio.den != 1 || st->sample_aspect_ratio.num) && // default - (den != st->sample_aspect_ratio.den || num != st->sample_aspect_ratio.num)) - av_log(c->fc, AV_LOG_WARNING, - "sample aspect ratio already set to %d:%d, overriding by 'pasp' atom\n", - st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); + if ((st->sample_aspect_ratio.den != 1 || st->sample_aspect_ratio.num) && // default + (den != st->sample_aspect_ratio.den || num != st->sample_aspect_ratio.num)) { + av_log(c->fc, AV_LOG_WARNING, + "sample aspect ratio already set to %d:%d, ignoring 'pasp' atom (%d:%d)\n", + st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, + num, den); + } else if (den != 0) { st->sample_aspect_ratio.num = num; st->sample_aspect_ratio.den = den; } @@ -944,22 +966,17 @@ return CODEC_ID_NONE; } -static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) { AVStream *st; MOVStreamContext *sc; - int j, entries, pseudo_stream_id; + int j, pseudo_stream_id; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ - - entries = get_be32(pb); - for(pseudo_stream_id=0; pseudo_stream_idenc->sample_aspect_ratio.num); - put_be32(pb, track->enc->sample_aspect_ratio.den); + put_be32(pb, sar.num); + put_be32(pb, sar.den); return 16; } @@ -1263,7 +1263,7 @@ char buf[1000] = ""; int len; - ff_sdp_write_media(buf, sizeof(buf), ctx, NULL, 0, 0); + ff_sdp_write_media(buf, sizeof(buf), ctx, NULL, NULL, 0, 0); av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index); len = strlen(buf); @@ -1610,11 +1610,12 @@ mov_write_3gp_udta_tag(pb_buf, s, "cprt", "copyright"); mov_write_3gp_udta_tag(pb_buf, s, "yrrc", "date"); } else if (mov->mode == MODE_MOV) { // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4 + mov_write_string_metadata(s, pb_buf, "\251ART", "artist" , 0); mov_write_string_metadata(s, pb_buf, "\251nam", "title" , 0); mov_write_string_metadata(s, pb_buf, "\251aut", "author" , 0); mov_write_string_metadata(s, pb_buf, "\251alb", "album" , 0); mov_write_string_metadata(s, pb_buf, "\251day", "date" , 0); - mov_write_string_tag(pb_buf, "\251enc", LIBAVFORMAT_IDENT, 0, 0); + mov_write_string_metadata(s, pb_buf, "\251swr", "encoder" , 0); mov_write_string_metadata(s, pb_buf, "\251des", "comment" , 0); mov_write_string_metadata(s, pb_buf, "\251gen", "genre" , 0); mov_write_string_metadata(s, pb_buf, "\251cpy", "copyright" , 0); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mp3.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mp3.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mp3.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mp3.c 2010-11-06 17:21:29.000000000 +0000 @@ -42,9 +42,6 @@ AVCodecContext avctx; buf0 = p->buf; - if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC)) { - buf0 += ff_id3v2_tag_len(buf0); - } end = p->buf + p->buf_size - sizeof(uint32_t); while(buf0 < end && !*buf0) buf0++; @@ -156,7 +153,6 @@ // lcm of all mp3 sample rates av_set_pts_info(st, 64, 1, 14112000); - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC); off = url_ftell(s->pb); if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) @@ -199,7 +195,6 @@ mp3_read_packet, .flags= AVFMT_GENERIC_INDEX, .extensions = "mp2,mp3,m2a", /* XXX: use probe */ - .metadata_conv = ff_id3v2_metadata_conv, }; #endif @@ -298,7 +293,6 @@ NULL, mp3_write_packet, mp3_write_trailer, - .metadata_conv = ff_id3v2_metadata_conv, }; #endif @@ -321,6 +315,7 @@ size_pos = url_ftell(s->pb); put_be32(s->pb, 0); + ff_metadata_conv(&s->metadata, ff_id3v2_metadata_conv, NULL); while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) { uint32_t tag = 0; @@ -370,6 +365,5 @@ mp3_write_packet, mp3_write_trailer, AVFMT_NOTIMESTAMPS, - .metadata_conv = ff_id3v2_metadata_conv, }; #endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpc.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpc.c 2010-11-06 17:21:29.000000000 +0000 @@ -21,7 +21,6 @@ #include "libavcodec/get_bits.h" #include "avformat.h" -#include "id3v2.h" #include "apetag.h" #define MPC_FRAMESIZE 1152 @@ -45,10 +44,6 @@ static int mpc_probe(AVProbeData *p) { const uint8_t *d = p->buf; - if (ff_id3v2_match(d, ID3v2_DEFAULT_MAGIC)) { - d += ff_id3v2_tag_len(d); - } - if (d+3 < p->buf+p->buf_size) if (d[0] == 'M' && d[1] == 'P' && d[2] == '+' && (d[3] == 0x17 || d[3] == 0x7)) return AVPROBE_SCORE_MAX; return 0; @@ -58,32 +53,10 @@ { MPCContext *c = s->priv_data; AVStream *st; - int t, ret; - int64_t pos = url_ftell(s->pb); - t = get_le24(s->pb); - if(t != MKTAG('M', 'P', '+', 0)){ - uint8_t buf[ID3v2_HEADER_SIZE]; - if (url_fseek(s->pb, pos, SEEK_SET) < 0) - return -1; - ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); - if (ret != ID3v2_HEADER_SIZE || !ff_id3v2_match(buf, ID3v2_DEFAULT_MAGIC)) { - av_log(s, AV_LOG_ERROR, "Not a Musepack file\n"); - return -1; - } - /* skip ID3 tags and try again */ - t = ff_id3v2_tag_len(buf) - ID3v2_HEADER_SIZE; - av_log(s, AV_LOG_DEBUG, "Skipping %d(%X) bytes of ID3 data\n", t, t); - url_fskip(s->pb, t); - if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){ - av_log(s, AV_LOG_ERROR, "Not a Musepack file\n"); - return -1; - } - /* read ID3 tags */ - if (url_fseek(s->pb, pos, SEEK_SET) < 0) - return -1; - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC); - get_le24(s->pb); + if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){ + av_log(s, AV_LOG_ERROR, "Not a Musepack file\n"); + return -1; } c->ver = get_byte(s->pb); if(c->ver != 0x07 && c->ver != 0x17){ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpegenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpegenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpegenc.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpegenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -367,8 +367,10 @@ stream->id = mpv_id++; if (st->codec->rc_buffer_size) stream->max_buffer_size = 6*1024 + st->codec->rc_buffer_size/8; - else + else { + av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n"); stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default + } #if 0 /* see VCD standard, p. IV-7*/ stream->max_buffer_size = 46 * 1024; @@ -1161,8 +1163,12 @@ pts= pkt->pts; dts= pkt->dts; - if(pts != AV_NOPTS_VALUE) pts += preload; - if(dts != AV_NOPTS_VALUE) dts += preload; + if(pts != AV_NOPTS_VALUE) pts += 2*preload; + if(dts != AV_NOPTS_VALUE){ + if(!s->last_scr) + s->last_scr= dts + preload; + dts += 2*preload; + } //av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE); if (!stream->premux_packet) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpegts.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpegts.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpegts.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpegts.c 2010-11-06 17:21:29.000000000 +0000 @@ -497,7 +497,7 @@ { 0x04, AVMEDIA_TYPE_AUDIO, CODEC_ID_MP3 }, { 0x0f, AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC }, { 0x10, AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG4 }, - //{ 0x11, AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC }, /* LATM syntax */ + { 0x11, AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC_LATM }, /* LATM syntax */ { 0x1b, AVMEDIA_TYPE_VIDEO, CODEC_ID_H264 }, { 0xd1, AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC }, { 0xea, AVMEDIA_TYPE_VIDEO, CODEC_ID_VC1 }, @@ -594,9 +594,6 @@ sub_pes->sub_st = pes->sub_st = sub_st; } } - if (pes->stream_type == 0x11) - av_log(pes->stream, AV_LOG_WARNING, - "AAC LATM not currently supported, patch welcome\n"); if (st->codec->codec_id == CODEC_ID_NONE) mpegts_find_stream_type(st, pes->stream_type, MISC_types); @@ -682,11 +679,15 @@ code = pes->header[3] | 0x100; dprintf(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code); - if ((!pes->st && pes->stream->nb_streams == MAX_STREAMS) || - (pes->st && pes->st->discard == AVDISCARD_ALL) || + if ((pes->st && pes->st->discard == AVDISCARD_ALL) || code == 0x1be) /* padding_stream */ goto skip; +#if FF_API_MAX_STREAMS + if (!pes->st && pes->stream->nb_streams == MAX_STREAMS) + goto skip; +#endif + /* stream not present in PMT */ if (!pes->st) { pes->st = av_new_stream(ts->stream, pes->pid); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpegtsenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpegtsenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpegtsenc.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpegtsenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -276,8 +276,13 @@ *q++ = language[1]; *q++ = language[2]; *q++ = 0x10; /* normal subtitles (0x20 = if hearing pb) */ - put16(&q, 1); /* page id */ - put16(&q, 1); /* ancillary page id */ + if(st->codec->extradata_size == 4) { + memcpy(q, st->codec->extradata, 4); + q += 4; + } else { + put16(&q, 1); /* page id */ + put16(&q, 1); /* ancillary page id */ + } } break; case AVMEDIA_TYPE_VIDEO: diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpegvideodec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpegvideodec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/mpegvideodec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/mpegvideodec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * RAW MPEG video demuxer + * Copyright (c) 2002-2003 Fabrice Bellard + * Copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawdec.h" + +#define SEQ_START_CODE 0x000001b3 +#define GOP_START_CODE 0x000001b8 +#define PICTURE_START_CODE 0x00000100 +#define SLICE_START_CODE 0x00000101 +#define PACK_START_CODE 0x000001ba +#define VIDEO_ID 0x000001e0 +#define AUDIO_ID 0x000001c0 + +static int mpegvideo_probe(AVProbeData *p) +{ + uint32_t code= -1; + int pic=0, seq=0, slice=0, pspack=0, pes=0; + int i; + + for(i=0; ibuf_size; i++){ + code = (code<<8) + p->buf[i]; + if ((code & 0xffffff00) == 0x100) { + switch(code){ + case SEQ_START_CODE: seq++; break; + case PICTURE_START_CODE: pic++; break; + case SLICE_START_CODE: slice++; break; + case PACK_START_CODE: pspack++; break; + } + if ((code & 0x1f0) == VIDEO_ID) pes++; + else if((code & 0x1e0) == AUDIO_ID) pes++; + } + } + if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !pes) + return pic>1 ? AVPROBE_SCORE_MAX/2+1 : AVPROBE_SCORE_MAX/4; // +1 for .mpg + return 0; +} + +AVInputFormat mpegvideo_demuxer = { + "mpegvideo", + NULL_IF_CONFIG_SMALL("raw MPEG video"), + 0, + mpegvideo_probe, + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .value = CODEC_ID_MPEG1VIDEO, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/network.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/network.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/network.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/network.h 2010-11-06 17:21:29.000000000 +0000 @@ -151,4 +151,29 @@ #define gai_strerror ff_gai_strerror #endif +#ifndef INET6_ADDRSTRLEN +#define INET6_ADDRSTRLEN INET_ADDRSTRLEN +#endif + +#ifndef IN_MULTICAST +#define IN_MULTICAST(a) ((((uint32_t)(a)) & 0xf0000000) == 0xe0000000) +#endif +#ifndef IN6_IS_ADDR_MULTICAST +#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff) +#endif + +static inline int ff_is_multicast_address(struct sockaddr *addr) +{ + if (addr->sa_family == AF_INET) { + return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr)); + } +#if HAVE_STRUCT_SOCKADDR_IN6 + if (addr->sa_family == AF_INET6) { + return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr); + } +#endif + + return 0; +} + #endif /* AVFORMAT_NETWORK_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/nullenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/nullenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/nullenc.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/nullenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,40 @@ +/* + * RAW null muxer + * Copyright (c) 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" + +static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt) +{ + return 0; +} + +AVOutputFormat null_muxer = { + "null", + NULL_IF_CONFIG_SMALL("raw null video format"), + NULL, + NULL, + 0, + AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE), + CODEC_ID_RAWVIDEO, + NULL, + null_write_packet, + .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE | AVFMT_NOTIMESTAMPS, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/nutdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/nutdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/nutdec.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/nutdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -29,6 +29,12 @@ #undef NDEBUG #include +#if FF_API_MAX_STREAMS +#define NUT_MAX_STREAMS MAX_STREAMS +#else +#define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */ +#endif + static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){ unsigned int len= ff_get_v(bc); @@ -193,7 +199,7 @@ end += url_ftell(bc); GET_V(tmp , tmp >=2 && tmp <= 3) - GET_V(stream_count , tmp > 0 && tmp <=MAX_STREAMS) + GET_V(stream_count , tmp > 0 && tmp <= NUT_MAX_STREAMS) nut->max_distance = ff_get_v(bc); if(nut->max_distance > 65536){ @@ -400,6 +406,7 @@ const char *type; AVChapter *chapter= NULL; AVStream *st= NULL; + AVMetadata **metadata = NULL; end= get_packetheader(nut, bc, 1, INFO_STARTCODE); end += url_ftell(bc); @@ -415,8 +422,12 @@ chapter= ff_new_chapter(s, chapter_id, nut->time_base[chapter_start % nut->time_base_count], start, start + chapter_len, NULL); - } else if(stream_id_plus1) + metadata = &chapter->metadata; + } else if(stream_id_plus1) { st= s->streams[stream_id_plus1 - 1]; + metadata = &st->metadata; + } else + metadata = &s->metadata; for(i=0; imetadata; - else if(stream_id_plus1) metadata= &st->metadata; - else metadata= &s->metadata; + continue; + } if(metadata && strcasecmp(name,"Uses") && strcasecmp(name,"Depends") && strcasecmp(name,"Replaces")) av_metadata_set2(metadata, name, str_value, 0); @@ -650,6 +659,8 @@ } assert(nut->next_startcode == SYNCPOINT_STARTCODE); + ff_metadata_conv_ctx(s, NULL, ff_nut_metadata_conv); + return 0; } @@ -925,7 +936,6 @@ nut_read_close, read_seek, .extensions = "nut", - .metadata_conv = ff_nut_metadata_conv, .codec_tag = (const AVCodecTag * const []) { ff_codec_bmp_tags, ff_nut_video_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0 }, }; #endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/nutenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/nutenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/nutenc.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/nutenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -491,6 +491,8 @@ ByteIOContext *dyn_bc; int i, ret; + ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL); + ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; @@ -561,11 +563,11 @@ if(j==nut->time_base_count) nut->time_base_count++; - if(av_q2d(time_base) >= 0.001) + if(INT64_C(1000) * time_base.num >= time_base.den) nut->stream[i].msb_pts_shift = 7; else nut->stream[i].msb_pts_shift = 14; - nut->stream[i].max_pts_distance= FFMAX(1/av_q2d(time_base), 1); + nut->stream[i].max_pts_distance= FFMAX(time_base.den, time_base.num) / time_base.num; } nut->max_distance = MAX_DISTANCE; @@ -810,5 +812,4 @@ write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, .codec_tag = (const AVCodecTag * const []){ ff_codec_bmp_tags, ff_nut_video_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0 }, - .metadata_conv = ff_nut_metadata_conv, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/oggdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/oggdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/oggdec.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/oggdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -641,6 +641,5 @@ ogg_read_seek, ogg_read_timestamp, .extensions = "ogg", - .metadata_conv = ff_vorbiscomment_metadata_conv, .flags = AVFMT_GENERIC_INDEX, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/oggenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/oggenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/oggenc.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/oggenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -206,14 +206,16 @@ } static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact, - int *header_len, AVMetadata *m) + int *header_len, AVMetadata **m, int framing_bit) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; int size; uint8_t *p, *p0; unsigned int count; - size = offset + ff_vorbiscomment_length(m, vendor, &count); + ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL); + + size = offset + ff_vorbiscomment_length(*m, vendor, &count) + framing_bit; p = av_mallocz(size); if (!p) return NULL; @@ -221,6 +223,8 @@ p += offset; ff_vorbiscomment_write(&p, m, vendor, count); + if (framing_bit) + bytestream_put_byte(&p, 1); *header_len = size; return p0; @@ -228,7 +232,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, OGGStreamContext *oggstream, int bitexact, - AVMetadata *m) + AVMetadata **m) { enum FLACExtradataFormat format; uint8_t *streaminfo; @@ -254,7 +258,7 @@ bytestream_put_buffer(&p, streaminfo, FLAC_STREAMINFO_SIZE); // second packet: VorbisComment - p = ogg_write_vorbiscomment(4, bitexact, &oggstream->header_len[1], m); + p = ogg_write_vorbiscomment(4, bitexact, &oggstream->header_len[1], m, 0); if (!p) return AVERROR(ENOMEM); oggstream->header[1] = p; @@ -268,7 +272,7 @@ static int ogg_build_speex_headers(AVCodecContext *avctx, OGGStreamContext *oggstream, int bitexact, - AVMetadata *m) + AVMetadata **m) { uint8_t *p; @@ -285,7 +289,7 @@ AV_WL32(&oggstream->header[0][68], 0); // set extra_headers to 0 // second packet: VorbisComment - p = ogg_write_vorbiscomment(0, bitexact, &oggstream->header_len[1], m); + p = ogg_write_vorbiscomment(0, bitexact, &oggstream->header_len[1], m, 0); if (!p) return AVERROR(ENOMEM); oggstream->header[1] = p; @@ -336,7 +340,7 @@ if (st->codec->codec_id == CODEC_ID_FLAC) { int err = ogg_build_flac_headers(st->codec, oggstream, st->codec->flags & CODEC_FLAG_BITEXACT, - s->metadata); + &s->metadata); if (err) { av_log(s, AV_LOG_ERROR, "Error writing FLAC headers\n"); av_freep(&st->priv_data); @@ -345,13 +349,18 @@ } else if (st->codec->codec_id == CODEC_ID_SPEEX) { int err = ogg_build_speex_headers(st->codec, oggstream, st->codec->flags & CODEC_FLAG_BITEXACT, - s->metadata); + &s->metadata); if (err) { av_log(s, AV_LOG_ERROR, "Error writing Speex headers\n"); av_freep(&st->priv_data); return err; } } else { + uint8_t *p; + const char *cstr = st->codec->codec_id == CODEC_ID_VORBIS ? "vorbis" : "theora"; + int header_type = st->codec->codec_id == CODEC_ID_VORBIS ? 3 : 0x81; + int framing_bit = st->codec->codec_id == CODEC_ID_VORBIS ? 1 : 0; + if (ff_split_xiph_headers(st->codec->extradata, st->codec->extradata_size, st->codec->codec_id == CODEC_ID_VORBIS ? 30 : 42, oggstream->header, oggstream->header_len) < 0) { @@ -359,6 +368,17 @@ av_freep(&st->priv_data); return -1; } + + p = ogg_write_vorbiscomment(7, st->codec->flags & CODEC_FLAG_BITEXACT, + &oggstream->header_len[1], &s->metadata, + framing_bit); + if (!p) + return AVERROR(ENOMEM); + + oggstream->header[1] = p; + bytestream_put_byte(&p, header_type); + bytestream_put_buffer(&p, cstr, 6); + if (st->codec->codec_id == CODEC_ID_THEORA) { /** KFGSHIFT is the width of the less significant section of the granule position The less significant section is the frame count since the last keyframe */ @@ -477,5 +497,4 @@ ogg_write_header, ogg_write_packet, ogg_write_trailer, - .metadata_conv = ff_vorbiscomment_metadata_conv, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/oggparsevorbis.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/oggparsevorbis.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/oggparsevorbis.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/oggparsevorbis.c 2010-11-06 17:21:29.000000000 +0000 @@ -29,6 +29,7 @@ #include "libavcodec/bytestream.h" #include "avformat.h" #include "oggdec.h" +#include "vorbiscomment.h" static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) { @@ -137,6 +138,8 @@ av_log(as, AV_LOG_INFO, "truncated comment header, %i comments not found\n", n); + ff_metadata_conv(m, NULL, ff_vorbiscomment_metadata_conv); + return 0; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/oma.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/oma.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/oma.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/oma.c 2010-11-06 17:21:29.000000000 +0000 @@ -45,7 +45,7 @@ #include "avformat.h" #include "libavutil/intreadwrite.h" -#include "raw.h" +#include "pcm.h" #include "riff.h" #include "id3v2.h" @@ -201,6 +201,5 @@ .flags= AVFMT_GENERIC_INDEX, .extensions = "oma,aa3", .codec_tag= (const AVCodecTag* const []){codec_oma_tags, 0}, - .metadata_conv = ff_id3v2_metadata_conv, }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/options.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/options.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/options.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/options.c 2010-11-06 17:21:29.000000000 +0000 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" /** * @file @@ -50,7 +50,7 @@ {"noparse", "disable AVParsers, this needs nofillin too", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOPARSE, INT_MIN, INT_MAX, D, "fflags"}, {"igndts", "ignore dts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNDTS, INT_MIN, INT_MAX, D, "fflags"}, {"rtphint", "add rtp hinting", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_RTP_HINT, INT_MIN, INT_MAX, E, "fflags"}, -#if LIBAVFORMAT_VERSION_INT < (53<<16) +#if FF_API_OLD_METADATA {"track", " set the track number", OFFSET(track), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E}, {"year", "set the year", OFFSET(year), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, E}, #endif @@ -60,6 +60,7 @@ {"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), FF_OPT_TYPE_INT, 3041280, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */ {"fdebug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, 0, INT_MAX, E|D, "fdebug"}, {"ts", NULL, 0, FF_OPT_TYPE_CONST, FF_FDEBUG_TS, INT_MIN, INT_MAX, E|D, "fdebug"}, +{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E|D}, {NULL}, }; @@ -88,7 +89,7 @@ return ic; } -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_ALLOC_FORMAT_CONTEXT AVFormatContext *av_alloc_format_context(void) { return avformat_alloc_context(); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/pcm.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/pcm.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/pcm.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/pcm.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,55 @@ +/* + * PCM common functions + * Copyright (c) 2003 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "pcm.h" + +int pcm_read_seek(AVFormatContext *s, + int stream_index, int64_t timestamp, int flags) +{ + AVStream *st; + int block_align, byte_rate; + int64_t pos, ret; + + st = s->streams[0]; + + block_align = st->codec->block_align ? st->codec->block_align : + (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3; + byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 : + block_align * st->codec->sample_rate; + + if (block_align <= 0 || byte_rate <= 0) + return -1; + if (timestamp < 0) timestamp = 0; + + /* compute the position by aligning it to block_align */ + pos = av_rescale_rnd(timestamp * byte_rate, + st->time_base.num, + st->time_base.den * (int64_t)block_align, + (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); + pos *= block_align; + + /* recompute exact position */ + st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); + if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0) + return ret; + return 0; +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/pcmdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/pcmdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/pcmdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/pcmdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,122 @@ +/* + * RAW PCM demuxers + * Copyright (c) 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawdec.h" +#include "pcm.h" + +#define RAW_SAMPLES 1024 + +static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + int ret, size, bps; + // AVStream *st = s->streams[0]; + + size= RAW_SAMPLES*s->streams[0]->codec->block_align; + + ret= av_get_packet(s->pb, pkt, size); + + pkt->stream_index = 0; + if (ret < 0) + return ret; + + bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id); + assert(bps); // if false there IS a bug elsewhere (NOT in this function) + pkt->dts= + pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels); + + return ret; +} + +#define PCMDEF(name, long_name, ext, codec) \ +AVInputFormat pcm_ ## name ## _demuxer = {\ + #name,\ + NULL_IF_CONFIG_SMALL(long_name),\ + 0,\ + NULL,\ + ff_raw_read_header,\ + raw_read_packet,\ + NULL,\ + pcm_read_seek,\ + .flags= AVFMT_GENERIC_INDEX,\ + .extensions = ext,\ + .value = codec,\ +}; + +PCMDEF(f64be, "PCM 64 bit floating-point big-endian format", + NULL, CODEC_ID_PCM_F64BE) + +PCMDEF(f64le, "PCM 64 bit floating-point little-endian format", + NULL, CODEC_ID_PCM_F64LE) + +PCMDEF(f32be, "PCM 32 bit floating-point big-endian format", + NULL, CODEC_ID_PCM_F32BE) + +PCMDEF(f32le, "PCM 32 bit floating-point little-endian format", + NULL, CODEC_ID_PCM_F32LE) + +PCMDEF(s32be, "PCM signed 32 bit big-endian format", + NULL, CODEC_ID_PCM_S32BE) + +PCMDEF(s32le, "PCM signed 32 bit little-endian format", + NULL, CODEC_ID_PCM_S32LE) + +PCMDEF(s24be, "PCM signed 24 bit big-endian format", + NULL, CODEC_ID_PCM_S24BE) + +PCMDEF(s24le, "PCM signed 24 bit little-endian format", + NULL, CODEC_ID_PCM_S24LE) + +PCMDEF(s16be, "PCM signed 16 bit big-endian format", + AV_NE("sw", NULL), CODEC_ID_PCM_S16BE) + +PCMDEF(s16le, "PCM signed 16 bit little-endian format", + AV_NE(NULL, "sw"), CODEC_ID_PCM_S16LE) + +PCMDEF(s8, "PCM signed 8 bit format", + "sb", CODEC_ID_PCM_S8) + +PCMDEF(u32be, "PCM unsigned 32 bit big-endian format", + NULL, CODEC_ID_PCM_U32BE) + +PCMDEF(u32le, "PCM unsigned 32 bit little-endian format", + NULL, CODEC_ID_PCM_U32LE) + +PCMDEF(u24be, "PCM unsigned 24 bit big-endian format", + NULL, CODEC_ID_PCM_U24BE) + +PCMDEF(u24le, "PCM unsigned 24 bit little-endian format", + NULL, CODEC_ID_PCM_U24LE) + +PCMDEF(u16be, "PCM unsigned 16 bit big-endian format", + AV_NE("uw", NULL), CODEC_ID_PCM_U16BE) + +PCMDEF(u16le, "PCM unsigned 16 bit little-endian format", + AV_NE(NULL, "uw"), CODEC_ID_PCM_U16LE) + +PCMDEF(u8, "PCM unsigned 8 bit format", + "ub", CODEC_ID_PCM_U8) + +PCMDEF(alaw, "PCM A-law format", + "al", CODEC_ID_PCM_ALAW) + +PCMDEF(mulaw, "PCM mu-law format", + "ul", CODEC_ID_PCM_MULAW) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/pcmenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/pcmenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/pcmenc.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/pcmenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,97 @@ +/* + * RAW PCM muxers + * Copyright (c) 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawenc.h" + +#define PCMDEF(name, long_name, ext, codec) \ +AVOutputFormat pcm_ ## name ## _muxer = {\ + #name,\ + NULL_IF_CONFIG_SMALL(long_name),\ + NULL,\ + ext,\ + 0,\ + codec,\ + CODEC_ID_NONE,\ + NULL,\ + ff_raw_write_packet,\ + .flags= AVFMT_NOTIMESTAMPS,\ +}; + +PCMDEF(f64be, "PCM 64 bit floating-point big-endian format", + NULL, CODEC_ID_PCM_F64BE) + +PCMDEF(f64le, "PCM 64 bit floating-point little-endian format", + NULL, CODEC_ID_PCM_F64LE) + +PCMDEF(f32be, "PCM 32 bit floating-point big-endian format", + NULL, CODEC_ID_PCM_F32BE) + +PCMDEF(f32le, "PCM 32 bit floating-point little-endian format", + NULL, CODEC_ID_PCM_F32LE) + +PCMDEF(s32be, "PCM signed 32 bit big-endian format", + NULL, CODEC_ID_PCM_S32BE) + +PCMDEF(s32le, "PCM signed 32 bit little-endian format", + NULL, CODEC_ID_PCM_S32LE) + +PCMDEF(s24be, "PCM signed 24 bit big-endian format", + NULL, CODEC_ID_PCM_S24BE) + +PCMDEF(s24le, "PCM signed 24 bit little-endian format", + NULL, CODEC_ID_PCM_S24LE) + +PCMDEF(s16be, "PCM signed 16 bit big-endian format", + AV_NE("sw", NULL), CODEC_ID_PCM_S16BE) + +PCMDEF(s16le, "PCM signed 16 bit little-endian format", + AV_NE(NULL, "sw"), CODEC_ID_PCM_S16LE) + +PCMDEF(s8, "PCM signed 8 bit format", + "sb", CODEC_ID_PCM_S8) + +PCMDEF(u32be, "PCM unsigned 32 bit big-endian format", + NULL, CODEC_ID_PCM_U32BE) + +PCMDEF(u32le, "PCM unsigned 32 bit little-endian format", + NULL, CODEC_ID_PCM_U32LE) + +PCMDEF(u24be, "PCM unsigned 24 bit big-endian format", + NULL, CODEC_ID_PCM_U24BE) + +PCMDEF(u24le, "PCM unsigned 24 bit little-endian format", + NULL, CODEC_ID_PCM_U24LE) + +PCMDEF(u16be, "PCM unsigned 16 bit big-endian format", + AV_NE("uw", NULL), CODEC_ID_PCM_U16BE) + +PCMDEF(u16le, "PCM unsigned 16 bit little-endian format", + AV_NE(NULL, "uw"), CODEC_ID_PCM_U16LE) + +PCMDEF(u8, "PCM unsigned 8 bit format", + "ub", CODEC_ID_PCM_U8) + +PCMDEF(alaw, "PCM A-law format", + "al", CODEC_ID_PCM_ALAW) + +PCMDEF(mulaw, "PCM mu-law format", + "ul", CODEC_ID_PCM_MULAW) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/pcm.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/pcm.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/pcm.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/pcm.h 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,30 @@ +/* + * PCM common functions + * Copyright (C) 2007 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_PCM_H +#define AVFORMAT_PCM_H + +#include "avformat.h" + +int pcm_read_seek(AVFormatContext *s, + int stream_index, int64_t timestamp, int flags); + +#endif /* AVFORMAT_PCM_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/raw.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/raw.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/raw.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/raw.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1399 +0,0 @@ -/* - * RAW muxer and demuxer - * Copyright (c) 2001 Fabrice Bellard - * Copyright (c) 2005 Alex Beregszaszi - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/crc.h" -#include "libavcodec/ac3_parser.h" -#include "libavcodec/get_bits.h" -#include "libavcodec/bytestream.h" -#include "avformat.h" -#include "raw.h" -#include "id3v2.h" -#include "id3v1.h" - -/* simple formats */ - -#if CONFIG_ROQ_MUXER -static int roq_write_header(struct AVFormatContext *s) -{ - static const uint8_t header[] = { - 0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00 - }; - - put_buffer(s->pb, header, 8); - put_flush_packet(s->pb); - - return 0; -} -#endif - -#if CONFIG_NULL_MUXER -static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt) -{ - return 0; -} -#endif - -#if CONFIG_MUXERS -static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt) -{ - put_buffer(s->pb, pkt->data, pkt->size); - put_flush_packet(s->pb); - return 0; -} -#endif - -#if CONFIG_DEMUXERS -/* raw input */ -static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap) -{ - AVStream *st; - enum CodecID id; - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - - id = s->iformat->value; - if (id == CODEC_ID_RAWVIDEO) { - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - } else { - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - } - st->codec->codec_id = id; - - switch(st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - st->codec->sample_rate = ap->sample_rate; - if(ap->channels) st->codec->channels = ap->channels; - else st->codec->channels = 1; - st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id); - assert(st->codec->bits_per_coded_sample > 0); - st->codec->block_align = st->codec->bits_per_coded_sample*st->codec->channels/8; - av_set_pts_info(st, 64, 1, st->codec->sample_rate); - break; - case AVMEDIA_TYPE_VIDEO: - if(ap->time_base.num) - av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den); - else - av_set_pts_info(st, 64, 1, 25); - st->codec->width = ap->width; - st->codec->height = ap->height; - st->codec->pix_fmt = ap->pix_fmt; - if(st->codec->pix_fmt == PIX_FMT_NONE) - st->codec->pix_fmt= PIX_FMT_YUV420P; - break; - default: - return -1; - } - return 0; -} - -#define RAW_PACKET_SIZE 1024 -#define RAW_SAMPLES 1024 - -static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - int ret, size, bps; - // AVStream *st = s->streams[0]; - - size= RAW_SAMPLES*s->streams[0]->codec->block_align; - - ret= av_get_packet(s->pb, pkt, size); - - pkt->stream_index = 0; - if (ret < 0) - return ret; - - bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id); - assert(bps); // if false there IS a bug elsewhere (NOT in this function) - pkt->dts= - pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels); - - return ret; -} - -int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) -{ - int ret, size; - - size = RAW_PACKET_SIZE; - - if (av_new_packet(pkt, size) < 0) - return AVERROR(ENOMEM); - - pkt->pos= url_ftell(s->pb); - pkt->stream_index = 0; - ret = get_partial_buffer(s->pb, pkt->data, size); - if (ret < 0) { - av_free_packet(pkt); - return ret; - } - pkt->size = ret; - return ret; -} -#endif - -#if CONFIG_RAWVIDEO_DEMUXER -static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - int packet_size, ret, width, height; - AVStream *st = s->streams[0]; - - width = st->codec->width; - height = st->codec->height; - - packet_size = avpicture_get_size(st->codec->pix_fmt, width, height); - if (packet_size < 0) - return -1; - - ret= av_get_packet(s->pb, pkt, packet_size); - pkt->pts= - pkt->dts= pkt->pos / packet_size; - - pkt->stream_index = 0; - if (ret < 0) - return ret; - return 0; -} -#endif - -#if CONFIG_INGENIENT_DEMUXER -// http://www.artificis.hu/files/texts/ingenient.txt -static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - int ret, size, w, h, unk1, unk2; - - if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G')) - return AVERROR(EIO); // FIXME - - size = get_le32(s->pb); - - w = get_le16(s->pb); - h = get_le16(s->pb); - - url_fskip(s->pb, 8); // zero + size (padded?) - url_fskip(s->pb, 2); - unk1 = get_le16(s->pb); - unk2 = get_le16(s->pb); - url_fskip(s->pb, 22); // ASCII timestamp - - av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n", - size, w, h, unk1, unk2); - - if (av_new_packet(pkt, size) < 0) - return AVERROR(ENOMEM); - - pkt->pos = url_ftell(s->pb); - pkt->stream_index = 0; - ret = get_buffer(s->pb, pkt->data, size); - if (ret < 0) { - av_free_packet(pkt); - return ret; - } - pkt->size = ret; - return ret; -} -#endif - -#if CONFIG_DEMUXERS -int pcm_read_seek(AVFormatContext *s, - int stream_index, int64_t timestamp, int flags) -{ - AVStream *st; - int block_align, byte_rate; - int64_t pos, ret; - - st = s->streams[0]; - - block_align = st->codec->block_align ? st->codec->block_align : - (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3; - byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 : - block_align * st->codec->sample_rate; - - if (block_align <= 0 || byte_rate <= 0) - return -1; - if (timestamp < 0) timestamp = 0; - - /* compute the position by aligning it to block_align */ - pos = av_rescale_rnd(timestamp * byte_rate, - st->time_base.num, - st->time_base.den * (int64_t)block_align, - (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); - pos *= block_align; - - /* recompute exact position */ - st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); - if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0) - return ret; - return 0; -} - -static int audio_read_header(AVFormatContext *s, - AVFormatParameters *ap) -{ - AVStream *st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = s->iformat->value; - st->need_parsing = AVSTREAM_PARSE_FULL; - /* the parameters will be extracted from the compressed bitstream */ - - return 0; -} - -/* MPEG-1/H.263 input */ -static int video_read_header(AVFormatContext *s, - AVFormatParameters *ap) -{ - AVStream *st; - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = s->iformat->value; - st->need_parsing = AVSTREAM_PARSE_FULL; - - /* for MJPEG, specify frame rate */ - /* for MPEG-4 specify it, too (most MPEG-4 streams do not have the fixed_vop_rate set ...)*/ - if (ap->time_base.num) { - st->codec->time_base= ap->time_base; - } else if ( st->codec->codec_id == CODEC_ID_MJPEG || - st->codec->codec_id == CODEC_ID_MPEG4 || - st->codec->codec_id == CODEC_ID_DIRAC || - st->codec->codec_id == CODEC_ID_DNXHD || - st->codec->codec_id == CODEC_ID_VC1 || - st->codec->codec_id == CODEC_ID_H264) { - st->codec->time_base= (AVRational){1,25}; - } - av_set_pts_info(st, 64, 1, 1200000); - - return 0; -} -#endif - -#if CONFIG_MPEGVIDEO_DEMUXER -#define SEQ_START_CODE 0x000001b3 -#define GOP_START_CODE 0x000001b8 -#define PICTURE_START_CODE 0x00000100 -#define SLICE_START_CODE 0x00000101 -#define PACK_START_CODE 0x000001ba -#define VIDEO_ID 0x000001e0 -#define AUDIO_ID 0x000001c0 - -static int mpegvideo_probe(AVProbeData *p) -{ - uint32_t code= -1; - int pic=0, seq=0, slice=0, pspack=0, pes=0; - int i; - - for(i=0; ibuf_size; i++){ - code = (code<<8) + p->buf[i]; - if ((code & 0xffffff00) == 0x100) { - switch(code){ - case SEQ_START_CODE: seq++; break; - case PICTURE_START_CODE: pic++; break; - case SLICE_START_CODE: slice++; break; - case PACK_START_CODE: pspack++; break; - } - if ((code & 0x1f0) == VIDEO_ID) pes++; - else if((code & 0x1e0) == AUDIO_ID) pes++; - } - } - if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !pes) - return pic>1 ? AVPROBE_SCORE_MAX/2+1 : AVPROBE_SCORE_MAX/4; // +1 for .mpg - return 0; -} -#endif - -#if CONFIG_CAVSVIDEO_DEMUXER -#define CAVS_SEQ_START_CODE 0x000001b0 -#define CAVS_PIC_I_START_CODE 0x000001b3 -#define CAVS_UNDEF_START_CODE 0x000001b4 -#define CAVS_PIC_PB_START_CODE 0x000001b6 -#define CAVS_VIDEO_EDIT_CODE 0x000001b7 -#define CAVS_PROFILE_JIZHUN 0x20 - -static int cavsvideo_probe(AVProbeData *p) -{ - uint32_t code= -1; - int pic=0, seq=0, slice_pos = 0; - int i; - - for(i=0; ibuf_size; i++){ - code = (code<<8) + p->buf[i]; - if ((code & 0xffffff00) == 0x100) { - if(code < CAVS_SEQ_START_CODE) { - /* slices have to be consecutive */ - if(code < slice_pos) - return 0; - slice_pos = code; - } else { - slice_pos = 0; - } - if (code == CAVS_SEQ_START_CODE) { - seq++; - /* check for the only currently supported profile */ - if(p->buf[i+1] != CAVS_PROFILE_JIZHUN) - return 0; - } else if ((code == CAVS_PIC_I_START_CODE) || - (code == CAVS_PIC_PB_START_CODE)) { - pic++; - } else if ((code == CAVS_UNDEF_START_CODE) || - (code > CAVS_VIDEO_EDIT_CODE)) { - return 0; - } - } - } - if(seq && seq*9<=pic*10) - return AVPROBE_SCORE_MAX/2; - return 0; -} -#endif - -#if CONFIG_M4V_DEMUXER -#define VISUAL_OBJECT_START_CODE 0x000001b5 -#define VOP_START_CODE 0x000001b6 - -static int mpeg4video_probe(AVProbeData *probe_packet) -{ - uint32_t temp_buffer= -1; - int VO=0, VOL=0, VOP = 0, VISO = 0, res=0; - int i; - - for(i=0; ibuf_size; i++){ - temp_buffer = (temp_buffer<<8) + probe_packet->buf[i]; - if ((temp_buffer & 0xffffff00) != 0x100) - continue; - - if (temp_buffer == VOP_START_CODE) VOP++; - else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++; - else if (temp_buffer < 0x120) VO++; - else if (temp_buffer < 0x130) VOL++; - else if ( !(0x1AF < temp_buffer && temp_buffer < 0x1B7) - && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++; - } - - if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0) - return AVPROBE_SCORE_MAX/2; - return 0; -} -#endif - -#if CONFIG_H264_DEMUXER -static int h264_probe(AVProbeData *p) -{ - uint32_t code= -1; - int sps=0, pps=0, idr=0, res=0, sli=0; - int i; - - for(i=0; ibuf_size; i++){ - code = (code<<8) + p->buf[i]; - if ((code & 0xffffff00) == 0x100) { - int ref_idc= (code>>5)&3; - int type = code & 0x1F; - static const int8_t ref_zero[32]={ - 2, 0, 0, 0, 0,-1, 1,-1, - -1, 1, 1, 1, 1,-1, 2, 2, - 2, 2, 2, 0, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2 - }; - - if(code & 0x80) //forbidden bit - return 0; - - if(ref_zero[type] == 1 && ref_idc) - return 0; - if(ref_zero[type] ==-1 && !ref_idc) - return 0; - if(ref_zero[type] == 2) - res++; - - switch(type){ - case 1: sli++; break; - case 5: idr++; break; - case 7: - if(p->buf[i+2]&0x0F) - return 0; - sps++; - break; - case 8: pps++; break; - } - } - } - if(sps && pps && (idr||sli>3) && res<(sps+pps+idr)) - return AVPROBE_SCORE_MAX/2+1; // +1 for .mpg - return 0; -} -#endif - -#if CONFIG_H263_DEMUXER -static int h263_probe(AVProbeData *p) -{ - uint64_t code= -1; - int i; - int valid_psc=0; - int invalid_psc=0; - int res_change=0; - int src_fmt, last_src_fmt=-1; - int last_gn=0; - - for(i=0; ibuf_size; i++){ - code = (code<<8) + p->buf[i]; - if ((code & 0xfffffc0000) == 0x800000) { - src_fmt= (code>>2)&3; - if( src_fmt != last_src_fmt - && last_src_fmt>0 && last_src_fmt<6 - && src_fmt<6) - res_change++; - - if((code&0x300)==0x200 && src_fmt){ - valid_psc++; - last_gn=0; - }else - invalid_psc++; - last_src_fmt= src_fmt; - } else if((code & 0xffff800000) == 0x800000) { - int gn= (code>>(23-5)) & 0x1F; - if(gn 2*invalid_psc + 2*res_change + 3){ - return 50; - }else if(valid_psc > 2*invalid_psc) - return 25; - return 0; -} -#endif - -#if CONFIG_H261_DEMUXER -static int h261_probe(AVProbeData *p) -{ - uint32_t code= -1; - int i; - int valid_psc=0; - int invalid_psc=0; - int next_gn=0; - int src_fmt=0; - GetBitContext gb; - - init_get_bits(&gb, p->buf, p->buf_size*8); - - for(i=0; ibuf_size*8; i++){ - if ((code & 0x01ff0000) || !(code & 0xff00)) { - code = (code<<8) + get_bits(&gb, 8); - i += 7; - } else - code = (code<<1) + get_bits1(&gb); - if ((code & 0xffff0000) == 0x10000) { - int gn= (code>>12)&0xf; - if(!gn) - src_fmt= code&8; - if(gn != next_gn) invalid_psc++; - else valid_psc++; - - if(src_fmt){ // CIF - next_gn= (gn+1 )%13; - }else{ //QCIF - next_gn= (gn+1+!!gn)% 7; - } - } - } - if(valid_psc > 2*invalid_psc + 6){ - return 50; - }else if(valid_psc > 2*invalid_psc + 2) - return 25; - return 0; -} -#endif - -#if CONFIG_DTS_DEMUXER -#define DCA_MARKER_14B_BE 0x1FFFE800 -#define DCA_MARKER_14B_LE 0xFF1F00E8 -#define DCA_MARKER_RAW_BE 0x7FFE8001 -#define DCA_MARKER_RAW_LE 0xFE7F0180 -static int dts_probe(AVProbeData *p) -{ - const uint8_t *buf, *bufp; - uint32_t state = -1; - int markers[3] = {0}; - int sum, max; - - buf = p->buf; - - for(; buf < (p->buf+p->buf_size)-2; buf+=2) { - bufp = buf; - state = (state << 16) | bytestream_get_be16(&bufp); - - /* regular bitstream */ - if (state == DCA_MARKER_RAW_BE || state == DCA_MARKER_RAW_LE) - markers[0]++; - - /* 14 bits big-endian bitstream */ - if (state == DCA_MARKER_14B_BE) - if ((bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0) - markers[1]++; - - /* 14 bits little-endian bitstream */ - if (state == DCA_MARKER_14B_LE) - if ((bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007) - markers[2]++; - } - sum = markers[0] + markers[1] + markers[2]; - max = markers[1] > markers[0]; - max = markers[2] > markers[max] ? 2 : max; - if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 && - markers[max] * 4 > sum * 3) - return AVPROBE_SCORE_MAX/2+1; - - return 0; -} -#endif - -#if CONFIG_DIRAC_DEMUXER -static int dirac_probe(AVProbeData *p) -{ - if (AV_RL32(p->buf) == MKTAG('B', 'B', 'C', 'D')) - return AVPROBE_SCORE_MAX; - else - return 0; -} -#endif - -#if CONFIG_DNXHD_DEMUXER -static int dnxhd_probe(AVProbeData *p) -{ - static const uint8_t header[] = {0x00,0x00,0x02,0x80,0x01}; - int w, h, compression_id; - if (p->buf_size < 0x2c) - return 0; - if (memcmp(p->buf, header, 5)) - return 0; - h = AV_RB16(p->buf + 0x18); - w = AV_RB16(p->buf + 0x1a); - if (!w || !h) - return 0; - compression_id = AV_RB32(p->buf + 0x28); - if (compression_id < 1237 || compression_id > 1253) - return 0; - return AVPROBE_SCORE_MAX; -} -#endif - -#if CONFIG_AC3_DEMUXER || CONFIG_EAC3_DEMUXER -static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id) -{ - int max_frames, first_frames = 0, frames; - uint8_t *buf, *buf2, *end; - AC3HeaderInfo hdr; - GetBitContext gbc; - enum CodecID codec_id = CODEC_ID_AC3; - - max_frames = 0; - buf = p->buf; - end = buf + p->buf_size; - - for(; buf < end; buf++) { - buf2 = buf; - - for(frames = 0; buf2 < end; frames++) { - init_get_bits(&gbc, buf2, 54); - if(ff_ac3_parse_header(&gbc, &hdr) < 0) - break; - if(buf2 + hdr.frame_size > end || - av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2)) - break; - if (hdr.bitstream_id > 10) - codec_id = CODEC_ID_EAC3; - buf2 += hdr.frame_size; - } - max_frames = FFMAX(max_frames, frames); - if(buf == p->buf) - first_frames = frames; - } - if(codec_id != expected_codec_id) return 0; - // keep this in sync with mp3 probe, both need to avoid - // issues with MPEG-files! - if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1; - else if(max_frames>500)return AVPROBE_SCORE_MAX/2; - else if(max_frames>=4) return AVPROBE_SCORE_MAX/4; - else if(max_frames>=1) return 1; - else return 0; -} -#endif - -#if CONFIG_AC3_DEMUXER -static int ac3_probe(AVProbeData *p) -{ - return ac3_eac3_probe(p, CODEC_ID_AC3); -} -#endif - -#if CONFIG_EAC3_DEMUXER -static int eac3_probe(AVProbeData *p) -{ - return ac3_eac3_probe(p, CODEC_ID_EAC3); -} -#endif - -#if CONFIG_AAC_DEMUXER -static int adts_aac_probe(AVProbeData *p) -{ - int max_frames = 0, first_frames = 0; - int fsize, frames; - uint8_t *buf0 = p->buf; - uint8_t *buf2; - uint8_t *buf; - uint8_t *end = buf0 + p->buf_size - 7; - - if (ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC)) { - buf0 += ff_id3v2_tag_len(buf0); - } - buf = buf0; - - for(; buf < end; buf= buf2+1) { - buf2 = buf; - - for(frames = 0; buf2 < end; frames++) { - uint32_t header = AV_RB16(buf2); - if((header&0xFFF6) != 0xFFF0) - break; - fsize = (AV_RB32(buf2+3)>>13) & 0x8FFF; - if(fsize < 7) - break; - buf2 += fsize; - } - max_frames = FFMAX(max_frames, frames); - if(buf == buf0) - first_frames= frames; - } - if (first_frames>=3) return AVPROBE_SCORE_MAX/2+1; - else if(max_frames>500)return AVPROBE_SCORE_MAX/2; - else if(max_frames>=3) return AVPROBE_SCORE_MAX/4; - else if(max_frames>=1) return 1; - else return 0; -} - -static int adts_aac_read_header(AVFormatContext *s, - AVFormatParameters *ap) -{ - AVStream *st; - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = s->iformat->value; - st->need_parsing = AVSTREAM_PARSE_FULL; - - ff_id3v1_read(s); - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC); - - return 0; -} - -#endif - -/* Note: Do not forget to add new entries to the Makefile as well. */ - -#if CONFIG_AAC_DEMUXER -AVInputFormat aac_demuxer = { - "aac", - NULL_IF_CONFIG_SMALL("raw ADTS AAC"), - 0, - adts_aac_probe, - adts_aac_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "aac", - .value = CODEC_ID_AAC, -}; -#endif - -#if CONFIG_AC3_DEMUXER -AVInputFormat ac3_demuxer = { - "ac3", - NULL_IF_CONFIG_SMALL("raw AC-3"), - 0, - ac3_probe, - audio_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "ac3", - .value = CODEC_ID_AC3, -}; -#endif - -#if CONFIG_AC3_MUXER -AVOutputFormat ac3_muxer = { - "ac3", - NULL_IF_CONFIG_SMALL("raw AC-3"), - "audio/x-ac3", - "ac3", - 0, - CODEC_ID_AC3, - CODEC_ID_NONE, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_DIRAC_DEMUXER -AVInputFormat dirac_demuxer = { - "dirac", - NULL_IF_CONFIG_SMALL("raw Dirac"), - 0, - dirac_probe, - video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .value = CODEC_ID_DIRAC, -}; -#endif - -#if CONFIG_DIRAC_MUXER -AVOutputFormat dirac_muxer = { - "dirac", - NULL_IF_CONFIG_SMALL("raw Dirac"), - NULL, - "drc", - 0, - CODEC_ID_NONE, - CODEC_ID_DIRAC, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_DNXHD_DEMUXER -AVInputFormat dnxhd_demuxer = { - "dnxhd", - NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"), - 0, - dnxhd_probe, - video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .value = CODEC_ID_DNXHD, -}; -#endif - -#if CONFIG_DNXHD_MUXER -AVOutputFormat dnxhd_muxer = { - "dnxhd", - NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"), - NULL, - "dnxhd", - 0, - CODEC_ID_NONE, - CODEC_ID_DNXHD, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_DTS_DEMUXER -AVInputFormat dts_demuxer = { - "dts", - NULL_IF_CONFIG_SMALL("raw DTS"), - 0, - dts_probe, - audio_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "dts", - .value = CODEC_ID_DTS, -}; -#endif - -#if CONFIG_DTS_MUXER -AVOutputFormat dts_muxer = { - "dts", - NULL_IF_CONFIG_SMALL("raw DTS"), - "audio/x-dca", - "dts", - 0, - CODEC_ID_DTS, - CODEC_ID_NONE, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_EAC3_DEMUXER -AVInputFormat eac3_demuxer = { - "eac3", - NULL_IF_CONFIG_SMALL("raw E-AC-3"), - 0, - eac3_probe, - audio_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "eac3", - .value = CODEC_ID_EAC3, -}; -#endif - -#if CONFIG_EAC3_MUXER -AVOutputFormat eac3_muxer = { - "eac3", - NULL_IF_CONFIG_SMALL("raw E-AC-3"), - "audio/x-eac3", - "eac3", - 0, - CODEC_ID_EAC3, - CODEC_ID_NONE, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_GSM_DEMUXER -AVInputFormat gsm_demuxer = { - "gsm", - NULL_IF_CONFIG_SMALL("raw GSM"), - 0, - NULL, - audio_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "gsm", - .value = CODEC_ID_GSM, -}; -#endif - -#if CONFIG_H261_DEMUXER -AVInputFormat h261_demuxer = { - "h261", - NULL_IF_CONFIG_SMALL("raw H.261"), - 0, - h261_probe, - video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "h261", - .value = CODEC_ID_H261, -}; -#endif - -#if CONFIG_H261_MUXER -AVOutputFormat h261_muxer = { - "h261", - NULL_IF_CONFIG_SMALL("raw H.261"), - "video/x-h261", - "h261", - 0, - CODEC_ID_NONE, - CODEC_ID_H261, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_H263_DEMUXER -AVInputFormat h263_demuxer = { - "h263", - NULL_IF_CONFIG_SMALL("raw H.263"), - 0, - h263_probe, - video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, -// .extensions = "h263", //FIXME remove after writing mpeg4_probe - .value = CODEC_ID_H263, -}; -#endif - -#if CONFIG_H263_MUXER -AVOutputFormat h263_muxer = { - "h263", - NULL_IF_CONFIG_SMALL("raw H.263"), - "video/x-h263", - "h263", - 0, - CODEC_ID_NONE, - CODEC_ID_H263, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_H264_DEMUXER -AVInputFormat h264_demuxer = { - "h264", - NULL_IF_CONFIG_SMALL("raw H.264 video format"), - 0, - h264_probe, - video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "h26l,h264,264", //FIXME remove after writing mpeg4_probe - .value = CODEC_ID_H264, -}; -#endif - -#if CONFIG_H264_MUXER -AVOutputFormat h264_muxer = { - "h264", - NULL_IF_CONFIG_SMALL("raw H.264 video format"), - NULL, - "h264", - 0, - CODEC_ID_NONE, - CODEC_ID_H264, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_CAVSVIDEO_MUXER -AVOutputFormat cavsvideo_muxer = { - "cavsvideo", - NULL_IF_CONFIG_SMALL("raw Chinese AVS video"), - NULL, - "cavs", - 0, - CODEC_ID_NONE, - CODEC_ID_CAVS, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_INGENIENT_DEMUXER -AVInputFormat ingenient_demuxer = { - "ingenient", - NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"), - 0, - NULL, - video_read_header, - ingenient_read_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "cgi", // FIXME - .value = CODEC_ID_MJPEG, -}; -#endif - -#if CONFIG_M4V_DEMUXER -AVInputFormat m4v_demuxer = { - "m4v", - NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"), - 0, - mpeg4video_probe, /** probing for MPEG-4 data */ - video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "m4v", - .value = CODEC_ID_MPEG4, -}; -#endif - -#if CONFIG_M4V_MUXER -AVOutputFormat m4v_muxer = { - "m4v", - NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"), - NULL, - "m4v", - 0, - CODEC_ID_NONE, - CODEC_ID_MPEG4, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_MJPEG_DEMUXER -AVInputFormat mjpeg_demuxer = { - "mjpeg", - NULL_IF_CONFIG_SMALL("raw MJPEG video"), - 0, - NULL, - video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "mjpg,mjpeg", - .value = CODEC_ID_MJPEG, -}; -#endif - -#if CONFIG_MJPEG_MUXER -AVOutputFormat mjpeg_muxer = { - "mjpeg", - NULL_IF_CONFIG_SMALL("raw MJPEG video"), - "video/x-mjpeg", - "mjpg,mjpeg", - 0, - CODEC_ID_NONE, - CODEC_ID_MJPEG, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_MLP_DEMUXER -AVInputFormat mlp_demuxer = { - "mlp", - NULL_IF_CONFIG_SMALL("raw MLP"), - 0, - NULL, - audio_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "mlp", - .value = CODEC_ID_MLP, -}; -#endif - -#if CONFIG_MLP_MUXER -AVOutputFormat mlp_muxer = { - "mlp", - NULL_IF_CONFIG_SMALL("raw MLP"), - NULL, - "mlp", - 0, - CODEC_ID_MLP, - CODEC_ID_NONE, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_SRT_MUXER -AVOutputFormat srt_muxer = { - .name = "srt", - .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle format"), - .mime_type = "application/x-subrip", - .extensions = "srt", - .write_packet = raw_write_packet, - .flags = AVFMT_NOTIMESTAMPS, - .subtitle_codec = CODEC_ID_SRT, -}; -#endif - -#if CONFIG_TRUEHD_DEMUXER -AVInputFormat truehd_demuxer = { - "truehd", - NULL_IF_CONFIG_SMALL("raw TrueHD"), - 0, - NULL, - audio_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "thd", - .value = CODEC_ID_TRUEHD, -}; -#endif - -#if CONFIG_TRUEHD_MUXER -AVOutputFormat truehd_muxer = { - "truehd", - NULL_IF_CONFIG_SMALL("raw TrueHD"), - NULL, - "thd", - 0, - CODEC_ID_TRUEHD, - CODEC_ID_NONE, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_MPEG1VIDEO_MUXER -AVOutputFormat mpeg1video_muxer = { - "mpeg1video", - NULL_IF_CONFIG_SMALL("raw MPEG-1 video"), - "video/x-mpeg", - "mpg,mpeg,m1v", - 0, - CODEC_ID_NONE, - CODEC_ID_MPEG1VIDEO, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_MPEG2VIDEO_MUXER -AVOutputFormat mpeg2video_muxer = { - "mpeg2video", - NULL_IF_CONFIG_SMALL("raw MPEG-2 video"), - NULL, - "m2v", - 0, - CODEC_ID_NONE, - CODEC_ID_MPEG2VIDEO, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_MPEGVIDEO_DEMUXER -AVInputFormat mpegvideo_demuxer = { - "mpegvideo", - NULL_IF_CONFIG_SMALL("raw MPEG video"), - 0, - mpegvideo_probe, - video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .value = CODEC_ID_MPEG1VIDEO, -}; -#endif - -#if CONFIG_CAVSVIDEO_DEMUXER -AVInputFormat cavsvideo_demuxer = { - "cavsvideo", - NULL_IF_CONFIG_SMALL("raw Chinese AVS video"), - 0, - cavsvideo_probe, - video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .value = CODEC_ID_CAVS, -}; -#endif - -#if CONFIG_NULL_MUXER -AVOutputFormat null_muxer = { - "null", - NULL_IF_CONFIG_SMALL("raw null video format"), - NULL, - NULL, - 0, -#if HAVE_BIGENDIAN - CODEC_ID_PCM_S16BE, -#else - CODEC_ID_PCM_S16LE, -#endif - CODEC_ID_RAWVIDEO, - NULL, - null_write_packet, - .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE | AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_RAWVIDEO_DEMUXER -AVInputFormat rawvideo_demuxer = { - "rawvideo", - NULL_IF_CONFIG_SMALL("raw video format"), - 0, - NULL, - raw_read_header, - rawvideo_read_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "yuv,cif,qcif,rgb", - .value = CODEC_ID_RAWVIDEO, -}; -#endif - -#if CONFIG_RAWVIDEO_MUXER -AVOutputFormat rawvideo_muxer = { - "rawvideo", - NULL_IF_CONFIG_SMALL("raw video format"), - NULL, - "yuv,rgb", - 0, - CODEC_ID_NONE, - CODEC_ID_RAWVIDEO, - NULL, - raw_write_packet, - .flags= AVFMT_NOTIMESTAMPS, -}; -#endif - -#if CONFIG_ROQ_MUXER -AVOutputFormat roq_muxer = -{ - "RoQ", - NULL_IF_CONFIG_SMALL("raw id RoQ format"), - NULL, - "roq", - 0, - CODEC_ID_ROQ_DPCM, - CODEC_ID_ROQ, - roq_write_header, - raw_write_packet, -}; -#endif - -#if CONFIG_SHORTEN_DEMUXER -AVInputFormat shorten_demuxer = { - "shn", - NULL_IF_CONFIG_SMALL("raw Shorten"), - 0, - NULL, - audio_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "shn", - .value = CODEC_ID_SHORTEN, -}; -#endif - -#if CONFIG_VC1_DEMUXER -AVInputFormat vc1_demuxer = { - "vc1", - NULL_IF_CONFIG_SMALL("raw VC-1"), - 0, - NULL /* vc1_probe */, - video_read_header, - ff_raw_read_partial_packet, - .extensions = "vc1", - .value = CODEC_ID_VC1, -}; -#endif - -/* PCM formats */ - -#define PCMINPUTDEF(name, long_name, ext, codec) \ -AVInputFormat pcm_ ## name ## _demuxer = {\ - #name,\ - NULL_IF_CONFIG_SMALL(long_name),\ - 0,\ - NULL,\ - raw_read_header,\ - raw_read_packet,\ - NULL,\ - pcm_read_seek,\ - .flags= AVFMT_GENERIC_INDEX,\ - .extensions = ext,\ - .value = codec,\ -}; - -#define PCMOUTPUTDEF(name, long_name, ext, codec) \ -AVOutputFormat pcm_ ## name ## _muxer = {\ - #name,\ - NULL_IF_CONFIG_SMALL(long_name),\ - NULL,\ - ext,\ - 0,\ - codec,\ - CODEC_ID_NONE,\ - NULL,\ - raw_write_packet,\ - .flags= AVFMT_NOTIMESTAMPS,\ -}; - - -#if !CONFIG_MUXERS && CONFIG_DEMUXERS -#define PCMDEF(name, long_name, ext, codec) \ - PCMINPUTDEF(name, long_name, ext, codec) -#elif CONFIG_MUXERS && !CONFIG_DEMUXERS -#define PCMDEF(name, long_name, ext, codec) \ - PCMOUTPUTDEF(name, long_name, ext, codec) -#elif CONFIG_MUXERS && CONFIG_DEMUXERS -#define PCMDEF(name, long_name, ext, codec) \ - PCMINPUTDEF(name, long_name, ext, codec)\ - PCMOUTPUTDEF(name, long_name, ext, codec) -#else -#define PCMDEF(name, long_name, ext, codec) -#endif - -#if HAVE_BIGENDIAN -#define BE_DEF(s) s -#define LE_DEF(s) NULL -#else -#define BE_DEF(s) NULL -#define LE_DEF(s) s -#endif - -PCMDEF(f64be, "PCM 64 bit floating-point big-endian format", - NULL, CODEC_ID_PCM_F64BE) - -PCMDEF(f64le, "PCM 64 bit floating-point little-endian format", - NULL, CODEC_ID_PCM_F64LE) - -PCMDEF(f32be, "PCM 32 bit floating-point big-endian format", - NULL, CODEC_ID_PCM_F32BE) - -PCMDEF(f32le, "PCM 32 bit floating-point little-endian format", - NULL, CODEC_ID_PCM_F32LE) - -PCMDEF(s32be, "PCM signed 32 bit big-endian format", - NULL, CODEC_ID_PCM_S32BE) - -PCMDEF(s32le, "PCM signed 32 bit little-endian format", - NULL, CODEC_ID_PCM_S32LE) - -PCMDEF(s24be, "PCM signed 24 bit big-endian format", - NULL, CODEC_ID_PCM_S24BE) - -PCMDEF(s24le, "PCM signed 24 bit little-endian format", - NULL, CODEC_ID_PCM_S24LE) - -PCMDEF(s16be, "PCM signed 16 bit big-endian format", - BE_DEF("sw"), CODEC_ID_PCM_S16BE) - -PCMDEF(s16le, "PCM signed 16 bit little-endian format", - LE_DEF("sw"), CODEC_ID_PCM_S16LE) - -PCMDEF(s8, "PCM signed 8 bit format", - "sb", CODEC_ID_PCM_S8) - -PCMDEF(u32be, "PCM unsigned 32 bit big-endian format", - NULL, CODEC_ID_PCM_U32BE) - -PCMDEF(u32le, "PCM unsigned 32 bit little-endian format", - NULL, CODEC_ID_PCM_U32LE) - -PCMDEF(u24be, "PCM unsigned 24 bit big-endian format", - NULL, CODEC_ID_PCM_U24BE) - -PCMDEF(u24le, "PCM unsigned 24 bit little-endian format", - NULL, CODEC_ID_PCM_U24LE) - -PCMDEF(u16be, "PCM unsigned 16 bit big-endian format", - BE_DEF("uw"), CODEC_ID_PCM_U16BE) - -PCMDEF(u16le, "PCM unsigned 16 bit little-endian format", - LE_DEF("uw"), CODEC_ID_PCM_U16LE) - -PCMDEF(u8, "PCM unsigned 8 bit format", - "ub", CODEC_ID_PCM_U8) - -PCMDEF(alaw, "PCM A-law format", - "al", CODEC_ID_PCM_ALAW) - -PCMDEF(mulaw, "PCM mu-law format", - "ul", CODEC_ID_PCM_MULAW) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,235 @@ +/* + * RAW demuxers + * Copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2005 Alex Beregszaszi + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawdec.h" + +/* raw input */ +int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) +{ + AVStream *st; + enum CodecID id; + + st = av_new_stream(s, 0); + if (!st) + return AVERROR(ENOMEM); + + id = s->iformat->value; + if (id == CODEC_ID_RAWVIDEO) { + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; + } else { + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + } + st->codec->codec_id = id; + + switch(st->codec->codec_type) { + case AVMEDIA_TYPE_AUDIO: + st->codec->sample_rate = ap->sample_rate; + if(ap->channels) st->codec->channels = ap->channels; + else st->codec->channels = 1; + st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id); + assert(st->codec->bits_per_coded_sample > 0); + st->codec->block_align = st->codec->bits_per_coded_sample*st->codec->channels/8; + av_set_pts_info(st, 64, 1, st->codec->sample_rate); + break; + case AVMEDIA_TYPE_VIDEO: + if(ap->time_base.num) + av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den); + else + av_set_pts_info(st, 64, 1, 25); + st->codec->width = ap->width; + st->codec->height = ap->height; + st->codec->pix_fmt = ap->pix_fmt; + if(st->codec->pix_fmt == PIX_FMT_NONE) + st->codec->pix_fmt= PIX_FMT_YUV420P; + break; + default: + return -1; + } + return 0; +} + +#define RAW_PACKET_SIZE 1024 + +int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) +{ + int ret, size; + + size = RAW_PACKET_SIZE; + + if (av_new_packet(pkt, size) < 0) + return AVERROR(ENOMEM); + + pkt->pos= url_ftell(s->pb); + pkt->stream_index = 0; + ret = get_partial_buffer(s->pb, pkt->data, size); + if (ret < 0) { + av_free_packet(pkt); + return ret; + } + pkt->size = ret; + return ret; +} + +int ff_raw_audio_read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + AVStream *st = av_new_stream(s, 0); + if (!st) + return AVERROR(ENOMEM); + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + st->codec->codec_id = s->iformat->value; + st->need_parsing = AVSTREAM_PARSE_FULL; + /* the parameters will be extracted from the compressed bitstream */ + + return 0; +} + +/* MPEG-1/H.263 input */ +int ff_raw_video_read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + AVStream *st; + + st = av_new_stream(s, 0); + if (!st) + return AVERROR(ENOMEM); + + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; + st->codec->codec_id = s->iformat->value; + st->need_parsing = AVSTREAM_PARSE_FULL; + + /* for MJPEG, specify frame rate */ + /* for MPEG-4 specify it, too (most MPEG-4 streams do not have the fixed_vop_rate set ...)*/ + if (ap->time_base.num) { + st->codec->time_base= ap->time_base; + } else if ( st->codec->codec_id == CODEC_ID_MJPEG || + st->codec->codec_id == CODEC_ID_MPEG4 || + st->codec->codec_id == CODEC_ID_DIRAC || + st->codec->codec_id == CODEC_ID_DNXHD || + st->codec->codec_id == CODEC_ID_VC1 || + st->codec->codec_id == CODEC_ID_H264) { + st->codec->time_base= (AVRational){1,25}; + } + av_set_pts_info(st, 64, 1, 1200000); + + return 0; +} + +/* Note: Do not forget to add new entries to the Makefile as well. */ + +#if CONFIG_G722_DEMUXER +AVInputFormat g722_demuxer = { + "g722", + NULL_IF_CONFIG_SMALL("raw G.722"), + 0, + NULL, + ff_raw_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "g722,722", + .value = CODEC_ID_ADPCM_G722, +}; +#endif + +#if CONFIG_GSM_DEMUXER +AVInputFormat gsm_demuxer = { + "gsm", + NULL_IF_CONFIG_SMALL("raw GSM"), + 0, + NULL, + ff_raw_audio_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "gsm", + .value = CODEC_ID_GSM, +}; +#endif + +#if CONFIG_MJPEG_DEMUXER +AVInputFormat mjpeg_demuxer = { + "mjpeg", + NULL_IF_CONFIG_SMALL("raw MJPEG video"), + 0, + NULL, + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "mjpg,mjpeg", + .value = CODEC_ID_MJPEG, +}; +#endif + +#if CONFIG_MLP_DEMUXER +AVInputFormat mlp_demuxer = { + "mlp", + NULL_IF_CONFIG_SMALL("raw MLP"), + 0, + NULL, + ff_raw_audio_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "mlp", + .value = CODEC_ID_MLP, +}; +#endif + +#if CONFIG_TRUEHD_DEMUXER +AVInputFormat truehd_demuxer = { + "truehd", + NULL_IF_CONFIG_SMALL("raw TrueHD"), + 0, + NULL, + ff_raw_audio_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "thd", + .value = CODEC_ID_TRUEHD, +}; +#endif + +#if CONFIG_SHORTEN_DEMUXER +AVInputFormat shorten_demuxer = { + "shn", + NULL_IF_CONFIG_SMALL("raw Shorten"), + 0, + NULL, + ff_raw_audio_read_header, + ff_raw_read_partial_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "shn", + .value = CODEC_ID_SHORTEN, +}; +#endif + +#if CONFIG_VC1_DEMUXER +AVInputFormat vc1_demuxer = { + "vc1", + NULL_IF_CONFIG_SMALL("raw VC-1"), + 0, + NULL /* vc1_probe */, + ff_raw_video_read_header, + ff_raw_read_partial_packet, + .extensions = "vc1", + .value = CODEC_ID_VC1, +}; +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawdec.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawdec.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawdec.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawdec.h 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * RAW demuxers + * Copyright (C) 2007 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_RAWDEC_H +#define AVFORMAT_RAWDEC_H + +#include "avformat.h" + +int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap); + +int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt); + +int ff_raw_audio_read_header(AVFormatContext *s, AVFormatParameters *ap); + +int ff_raw_video_read_header(AVFormatContext *s, AVFormatParameters *ap); + +#endif /* AVFORMAT_RAWDEC_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawenc.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,300 @@ +/* + * RAW muxers + * Copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2005 Alex Beregszaszi + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawenc.h" + +int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt) +{ + put_buffer(s->pb, pkt->data, pkt->size); + put_flush_packet(s->pb); + return 0; +} + +/* Note: Do not forget to add new entries to the Makefile as well. */ + +#if CONFIG_AC3_MUXER +AVOutputFormat ac3_muxer = { + "ac3", + NULL_IF_CONFIG_SMALL("raw AC-3"), + "audio/x-ac3", + "ac3", + 0, + CODEC_ID_AC3, + CODEC_ID_NONE, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_DIRAC_MUXER +AVOutputFormat dirac_muxer = { + "dirac", + NULL_IF_CONFIG_SMALL("raw Dirac"), + NULL, + "drc", + 0, + CODEC_ID_NONE, + CODEC_ID_DIRAC, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_DNXHD_MUXER +AVOutputFormat dnxhd_muxer = { + "dnxhd", + NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"), + NULL, + "dnxhd", + 0, + CODEC_ID_NONE, + CODEC_ID_DNXHD, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_DTS_MUXER +AVOutputFormat dts_muxer = { + "dts", + NULL_IF_CONFIG_SMALL("raw DTS"), + "audio/x-dca", + "dts", + 0, + CODEC_ID_DTS, + CODEC_ID_NONE, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_EAC3_MUXER +AVOutputFormat eac3_muxer = { + "eac3", + NULL_IF_CONFIG_SMALL("raw E-AC-3"), + "audio/x-eac3", + "eac3", + 0, + CODEC_ID_EAC3, + CODEC_ID_NONE, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_G722_MUXER +AVOutputFormat g722_muxer = { + "g722", + NULL_IF_CONFIG_SMALL("raw G.722"), + "audio/G722", + "g722", + 0, + CODEC_ID_ADPCM_G722, + CODEC_ID_NONE, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_H261_MUXER +AVOutputFormat h261_muxer = { + "h261", + NULL_IF_CONFIG_SMALL("raw H.261"), + "video/x-h261", + "h261", + 0, + CODEC_ID_NONE, + CODEC_ID_H261, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_H263_MUXER +AVOutputFormat h263_muxer = { + "h263", + NULL_IF_CONFIG_SMALL("raw H.263"), + "video/x-h263", + "h263", + 0, + CODEC_ID_NONE, + CODEC_ID_H263, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_H264_MUXER +AVOutputFormat h264_muxer = { + "h264", + NULL_IF_CONFIG_SMALL("raw H.264 video format"), + NULL, + "h264", + 0, + CODEC_ID_NONE, + CODEC_ID_H264, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_CAVSVIDEO_MUXER +AVOutputFormat cavsvideo_muxer = { + "cavsvideo", + NULL_IF_CONFIG_SMALL("raw Chinese AVS video"), + NULL, + "cavs", + 0, + CODEC_ID_NONE, + CODEC_ID_CAVS, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_M4V_MUXER +AVOutputFormat m4v_muxer = { + "m4v", + NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"), + NULL, + "m4v", + 0, + CODEC_ID_NONE, + CODEC_ID_MPEG4, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_MJPEG_MUXER +AVOutputFormat mjpeg_muxer = { + "mjpeg", + NULL_IF_CONFIG_SMALL("raw MJPEG video"), + "video/x-mjpeg", + "mjpg,mjpeg", + 0, + CODEC_ID_NONE, + CODEC_ID_MJPEG, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_MLP_MUXER +AVOutputFormat mlp_muxer = { + "mlp", + NULL_IF_CONFIG_SMALL("raw MLP"), + NULL, + "mlp", + 0, + CODEC_ID_MLP, + CODEC_ID_NONE, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_SRT_MUXER +AVOutputFormat srt_muxer = { + .name = "srt", + .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle format"), + .mime_type = "application/x-subrip", + .extensions = "srt", + .write_packet = ff_raw_write_packet, + .flags = AVFMT_NOTIMESTAMPS, + .subtitle_codec = CODEC_ID_SRT, +}; +#endif + +#if CONFIG_TRUEHD_MUXER +AVOutputFormat truehd_muxer = { + "truehd", + NULL_IF_CONFIG_SMALL("raw TrueHD"), + NULL, + "thd", + 0, + CODEC_ID_TRUEHD, + CODEC_ID_NONE, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_MPEG1VIDEO_MUXER +AVOutputFormat mpeg1video_muxer = { + "mpeg1video", + NULL_IF_CONFIG_SMALL("raw MPEG-1 video"), + "video/x-mpeg", + "mpg,mpeg,m1v", + 0, + CODEC_ID_NONE, + CODEC_ID_MPEG1VIDEO, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_MPEG2VIDEO_MUXER +AVOutputFormat mpeg2video_muxer = { + "mpeg2video", + NULL_IF_CONFIG_SMALL("raw MPEG-2 video"), + NULL, + "m2v", + 0, + CODEC_ID_NONE, + CODEC_ID_MPEG2VIDEO, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif + +#if CONFIG_RAWVIDEO_MUXER +AVOutputFormat rawvideo_muxer = { + "rawvideo", + NULL_IF_CONFIG_SMALL("raw video format"), + NULL, + "yuv,rgb", + 0, + CODEC_ID_NONE, + CODEC_ID_RAWVIDEO, + NULL, + ff_raw_write_packet, + .flags= AVFMT_NOTIMESTAMPS, +}; +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawenc.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawenc.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawenc.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawenc.h 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,29 @@ +/* + * RAW muxers + * Copyright (C) 2007 Aurelien Jacobs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_RAWENC_H +#define AVFORMAT_RAWENC_H + +#include "avformat.h" + +int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt); + +#endif /* AVFORMAT_RAWENC_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/raw.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/raw.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/raw.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/raw.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - * RAW muxer and demuxer - * Copyright (C) 2007 Aurelien Jacobs - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_RAW_H -#define AVFORMAT_RAW_H - -#include "avformat.h" - -int pcm_read_seek(AVFormatContext *s, - int stream_index, int64_t timestamp, int flags); - -int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt); - -#endif /* AVFORMAT_RAW_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawvideodec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawvideodec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rawvideodec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rawvideodec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,57 @@ +/* + * RAW video demuxer + * Copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rawdec.h" + +static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + int packet_size, ret, width, height; + AVStream *st = s->streams[0]; + + width = st->codec->width; + height = st->codec->height; + + packet_size = avpicture_get_size(st->codec->pix_fmt, width, height); + if (packet_size < 0) + return -1; + + ret= av_get_packet(s->pb, pkt, packet_size); + pkt->pts= + pkt->dts= pkt->pos / packet_size; + + pkt->stream_index = 0; + if (ret < 0) + return ret; + return 0; +} + +AVInputFormat rawvideo_demuxer = { + "rawvideo", + NULL_IF_CONFIG_SMALL("raw video format"), + 0, + NULL, + ff_raw_read_header, + rawvideo_read_packet, + .flags= AVFMT_GENERIC_INDEX, + .extensions = "yuv,cif,qcif,rgb", + .value = CODEC_ID_RAWVIDEO, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rdt.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rdt.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rdt.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rdt.c 2010-11-06 17:21:29.000000000 +0000 @@ -86,7 +86,8 @@ struct PayloadContext { AVFormatContext *rmctx; - RMStream *rmst[MAX_STREAMS]; + int nb_rmst; + RMStream **rmst; uint8_t *mlti_data; unsigned int mlti_data_size; char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE]; @@ -336,8 +337,9 @@ int ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len) + uint8_t **bufptr, int len) { + uint8_t *buf = bufptr ? *bufptr : NULL; int seq_no, flags = 0, stream_id, set_id, is_keyframe; uint32_t timestamp; int rv= 0; @@ -421,7 +423,17 @@ for (n = 0; n < s->nb_streams; n++) if (s->streams[n]->priv_data == stream->priv_data) { + int count = s->streams[n]->index + 1; if (first == -1) first = n; + if (rdt->nb_rmst < count) { + RMStream **rmst= av_realloc(rdt->rmst, count*sizeof(*rmst)); + if (!rmst) + return AVERROR(ENOMEM); + memset(rmst + rdt->nb_rmst, 0, + (count - rdt->nb_rmst) * sizeof(*rmst)); + rdt->rmst = rmst; + rdt->nb_rmst = count; + } rdt->rmst[s->streams[n]->index] = ff_rm_alloc_rmstream(); rdt_load_mdpr(rdt, s->streams[n], (n - first) * 2); @@ -465,7 +477,7 @@ const char *p) { const char *end; - int n_rules, odd = 0; + int n_rules = 0, odd = 0; AVStream *st; /** @@ -483,7 +495,7 @@ * for multi-bitrate streams. */ if (*p == '\"') p++; - for (n_rules = 0; s->nb_streams < MAX_STREAMS;) { + while (1) { if (!(end = strchr(p, ';'))) break; if (!odd && end != p) { @@ -491,6 +503,8 @@ st = add_dstream(s, orig_st); else st = orig_st; + if (!st) + break; real_parse_asm_rule(st, p, end); n_rules++; } @@ -524,7 +538,7 @@ { int i; - for (i = 0; i < MAX_STREAMS; i++) + for (i = 0; i < rdt->nb_rmst; i++) if (rdt->rmst[i]) { ff_rm_free_rmstream(rdt->rmst[i]); av_freep(&rdt->rmst[i]); @@ -532,6 +546,7 @@ if (rdt->rmctx) av_close_input_stream(rdt->rmctx); av_freep(&rdt->mlti_data); + av_freep(&rdt->rmst); av_free(rdt); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rdt.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rdt.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rdt.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rdt.h 2010-11-06 17:21:29.000000000 +0000 @@ -96,7 +96,7 @@ * Usage similar to rtp_parse_packet(). */ int ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len); + uint8_t **buf, int len); /** * Parse a server-related SDP line. diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/riff.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/riff.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/riff.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/riff.c 2010-11-06 17:21:29.000000000 +0000 @@ -59,6 +59,7 @@ { CODEC_ID_MPEG4, MKTAG('S', 'E', 'D', 'G') }, { CODEC_ID_MPEG4, MKTAG('R', 'M', 'P', '4') }, { CODEC_ID_MPEG4, MKTAG('3', 'I', 'V', '2') }, + { CODEC_ID_MPEG4, MKTAG('W', 'A', 'W', 'V') }, /* WaWv MPEG-4 Video Codec */ { CODEC_ID_MPEG4, MKTAG('F', 'F', 'D', 'S') }, { CODEC_ID_MPEG4, MKTAG('F', 'V', 'F', 'W') }, { CODEC_ID_MPEG4, MKTAG('D', 'C', 'O', 'D') }, @@ -178,6 +179,7 @@ { CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'V', '9') }, { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') }, { CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') }, + { CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') }, { CODEC_ID_R210, MKTAG('r', '2', '1', '0') }, { CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') }, @@ -225,6 +227,7 @@ { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') }, { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') }, { CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') }, + { CODEC_ID_WMV3, MKTAG('W', 'M', 'V', 'P') }, { CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') }, { CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') }, { CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') }, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rsodec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rsodec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rsodec.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rsodec.c 2010-11-06 17:21:29.000000000 +0000 @@ -23,7 +23,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" #include "internal.h" -#include "raw.h" +#include "pcm.h" #include "riff.h" #include "rso.h" diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtmpproto.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtmpproto.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtmpproto.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtmpproto.c 2010-11-06 17:21:29.000000000 +0000 @@ -38,10 +38,10 @@ #include "rtmppkt.h" /* we can't use av_log() with URLContext yet... */ -#if LIBAVFORMAT_VERSION_MAJOR < 53 -#define LOG_CONTEXT NULL -#else +#if FF_API_URL_CLASS #define LOG_CONTEXT s +#else +#define LOG_CONTEXT NULL #endif //#define DEBUG diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtp.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtp.c 2010-11-06 17:21:29.000000000 +0000 @@ -48,7 +48,7 @@ {6, "DVI4", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 16000, 1}, {7, "LPC", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1}, {8, "PCMA", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_ALAW, 8000, 1}, - {9, "G722", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1}, + {9, "G722", AVMEDIA_TYPE_AUDIO, CODEC_ID_ADPCM_G722, 8000, 1}, {10, "L16", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_S16BE, 44100, 2}, {11, "L16", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_S16BE, 44100, 1}, {12, "QCELP", AVMEDIA_TYPE_AUDIO, CODEC_ID_QCELP, 8000, 1}, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_asf.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_asf.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_asf.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_asf.c 2010-11-06 17:21:29.000000000 +0000 @@ -230,7 +230,8 @@ int prev_len = out_len; out_len += cur_len; asf->buf = av_realloc(asf->buf, out_len); - memcpy(asf->buf + prev_len, buf + off, cur_len); + memcpy(asf->buf + prev_len, buf + off, + FFMIN(cur_len, len - off)); url_fskip(pb, cur_len); } } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -65,20 +65,45 @@ ff_register_dynamic_payload_handler(&ff_theora_dynamic_handler); ff_register_dynamic_payload_handler(&ff_qdm2_dynamic_handler); ff_register_dynamic_payload_handler(&ff_svq3_dynamic_handler); + ff_register_dynamic_payload_handler(&ff_mp4a_latm_dynamic_handler); + ff_register_dynamic_payload_handler(&ff_vp8_dynamic_handler); ff_register_dynamic_payload_handler(&ff_ms_rtp_asf_pfv_handler); ff_register_dynamic_payload_handler(&ff_ms_rtp_asf_pfa_handler); + + ff_register_dynamic_payload_handler(&ff_qt_rtp_aud_handler); + ff_register_dynamic_payload_handler(&ff_qt_rtp_vid_handler); + ff_register_dynamic_payload_handler(&ff_quicktime_rtp_aud_handler); + ff_register_dynamic_payload_handler(&ff_quicktime_rtp_vid_handler); } static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len) { - if (buf[1] != 200) - return -1; - s->last_rtcp_ntp_time = AV_RB64(buf + 8); - if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) - s->first_rtcp_ntp_time = s->last_rtcp_ntp_time; - s->last_rtcp_timestamp = AV_RB32(buf + 16); - return 0; + int payload_len; + while (len >= 2) { + switch (buf[1]) { + case RTCP_SR: + if (len < 16) { + av_log(NULL, AV_LOG_ERROR, "Invalid length for RTCP SR packet\n"); + return AVERROR_INVALIDDATA; + } + payload_len = (AV_RB16(buf + 2) + 1) * 4; + + s->last_rtcp_ntp_time = AV_RB64(buf + 8); + if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) + s->first_rtcp_ntp_time = s->last_rtcp_ntp_time; + s->last_rtcp_timestamp = AV_RB32(buf + 16); + + buf += payload_len; + len -= payload_len; + break; + case RTCP_BYE: + return -RTCP_BYE; + default: + return -1; + } + } + return -1; } #define RTP_SEQ_MOD (1<<16) @@ -207,10 +232,11 @@ // Receiver Report put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ - put_byte(pb, 201); + put_byte(pb, RTCP_RR); put_be16(pb, 7); /* length in words - 1 */ - put_be32(pb, s->ssrc); // our own SSRC - put_be32(pb, s->ssrc); // XXX: should be the server's here! + // our own SSRC: we use the server's SSRC + 1 to avoid conflicts + put_be32(pb, s->ssrc + 1); + put_be32(pb, s->ssrc); // server SSRC // some placeholders we should really fill... // RFC 1889/p64 extended_max= stats->cycles + stats->max_seq; @@ -245,7 +271,7 @@ // CNAME put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ - put_byte(pb, 202); + put_byte(pb, RTCP_SDES); len = strlen(s->hostname); put_be16(pb, (6 + len + 3) / 4); /* length in words - 1 */ put_be32(pb, s->ssrc); @@ -296,7 +322,7 @@ return; put_byte(pb, (RTP_VERSION << 6)); - put_byte(pb, 201); /* receiver report */ + put_byte(pb, RTCP_RR); /* receiver report */ put_be16(pb, 1); /* length in words - 1 */ put_be32(pb, 0); /* our own SSRC */ @@ -313,7 +339,7 @@ * MPEG2TS streams to indicate that they should be demuxed inside the * rtp demux (otherwise CODEC_ID_MPEG2TS packets are returned) */ -RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type) +RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size) { RTPDemuxContext *s; @@ -325,6 +351,7 @@ s->first_rtcp_ntp_time = AV_NOPTS_VALUE; s->ic = s1; s->st = st; + s->queue_size = queue_size; rtp_init_statistics(&s->statistics, 0); // do we know the initial sequence from sdp? if (!strcmp(ff_rtp_enc_name(payload_type), "MP2T")) { s->ts = ff_mpegts_parse_open(s->ic); @@ -344,6 +371,13 @@ case CODEC_ID_H264: st->need_parsing = AVSTREAM_PARSE_FULL; break; + case CODEC_ID_ADPCM_G722: + av_set_pts_info(st, 32, 1, st->codec->sample_rate); + /* According to RFC 3551, the stream clock rate is 8000 + * even if the sample rate is 16000. */ + if (st->codec->sample_rate == 8000) + st->codec->sample_rate = 16000; + break; default: if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { av_set_pts_info(st, 32, 1, st->codec->sample_rate); @@ -382,59 +416,17 @@ } } -/** - * Parse an RTP or RTCP packet directly sent as a buffer. - * @param s RTP parse context. - * @param pkt returned packet - * @param buf input buffer or NULL to read the next packets - * @param len buffer len - * @return 0 if a packet is returned, 1 if a packet is returned and more can follow - * (use buf as NULL to read the next). -1 if no packet (error or no more packet). - */ -int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len) +static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt, + const uint8_t *buf, int len) { unsigned int ssrc, h; int payload_type, seq, ret, flags = 0; + int ext; AVStream *st; uint32_t timestamp; int rv= 0; - if (!buf) { - /* return the next packets, if any */ - if(s->st && s->parse_packet) { - /* timestamp should be overwritten by parse_packet, if not, - * the packet is left with pts == AV_NOPTS_VALUE */ - timestamp = RTP_NOTS_VALUE; - rv= s->parse_packet(s->ic, s->dynamic_protocol_context, - s->st, pkt, ×tamp, NULL, 0, flags); - finalize_packet(s, pkt, timestamp); - return rv; - } else { - // TODO: Move to a dynamic packet handler (like above) - if (s->read_buf_index >= s->read_buf_size) - return -1; - ret = ff_mpegts_parse_packet(s->ts, pkt, s->buf + s->read_buf_index, - s->read_buf_size - s->read_buf_index); - if (ret < 0) - return -1; - s->read_buf_index += ret; - if (s->read_buf_index < s->read_buf_size) - return 1; - else - return 0; - } - } - - if (len < 12) - return -1; - - if ((buf[0] & 0xc0) != (RTP_VERSION << 6)) - return -1; - if (buf[1] >= 200 && buf[1] <= 204) { - rtcp_parse_packet(s, buf, len); - return -1; - } + ext = buf[0] & 0x10; payload_type = buf[1] & 0x7f; if (buf[1] & 0x80) flags |= RTP_FLAG_MARKER; @@ -461,11 +453,29 @@ len -= 12; buf += 12; + /* RFC 3550 Section 5.3.1 RTP Header Extension handling */ + if (ext) { + if (len < 4) + return -1; + /* calculate the header extension length (stored as number + * of 32-bit words) */ + ext = (AV_RB16(buf + 2) + 1) << 2; + + if (len < ext) + return -1; + // skip past RTP header extension + len -= ext; + buf += ext; + } + if (!st) { /* specific MPEG2TS demux support */ ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len); + /* The only error that can be returned from ff_mpegts_parse_packet + * is "no more data to return from the provided buffer", so return + * AVERROR(EAGAIN) for all errors */ if (ret < 0) - return -1; + return AVERROR(EAGAIN); if (ret < len) { s->read_buf_size = len - ret; memcpy(s->buf, buf + ret, s->read_buf_size); @@ -523,8 +533,178 @@ return rv; } +void ff_rtp_reset_packet_queue(RTPDemuxContext *s) +{ + while (s->queue) { + RTPPacket *next = s->queue->next; + av_free(s->queue->buf); + av_free(s->queue); + s->queue = next; + } + s->seq = 0; + s->queue_len = 0; + s->prev_ret = 0; +} + +static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len) +{ + uint16_t seq = AV_RB16(buf + 2); + RTPPacket *cur = s->queue, *prev = NULL, *packet; + + /* Find the correct place in the queue to insert the packet */ + while (cur) { + int16_t diff = seq - cur->seq; + if (diff < 0) + break; + prev = cur; + cur = cur->next; + } + + packet = av_mallocz(sizeof(*packet)); + if (!packet) + return; + packet->recvtime = av_gettime(); + packet->seq = seq; + packet->len = len; + packet->buf = buf; + packet->next = cur; + if (prev) + prev->next = packet; + else + s->queue = packet; + s->queue_len++; +} + +static int has_next_packet(RTPDemuxContext *s) +{ + return s->queue && s->queue->seq == (uint16_t) (s->seq + 1); +} + +int64_t ff_rtp_queued_packet_time(RTPDemuxContext *s) +{ + return s->queue ? s->queue->recvtime : 0; +} + +static int rtp_parse_queued_packet(RTPDemuxContext *s, AVPacket *pkt) +{ + int rv; + RTPPacket *next; + + if (s->queue_len <= 0) + return -1; + + if (!has_next_packet(s)) + av_log(s->st ? s->st->codec : NULL, AV_LOG_WARNING, + "RTP: missed %d packets\n", s->queue->seq - s->seq - 1); + + /* Parse the first packet in the queue, and dequeue it */ + rv = rtp_parse_packet_internal(s, pkt, s->queue->buf, s->queue->len); + next = s->queue->next; + av_free(s->queue->buf); + av_free(s->queue); + s->queue = next; + s->queue_len--; + return rv; +} + +static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt, + uint8_t **bufptr, int len) +{ + uint8_t* buf = bufptr ? *bufptr : NULL; + int ret, flags = 0; + uint32_t timestamp; + int rv= 0; + + if (!buf) { + /* If parsing of the previous packet actually returned 0 or an error, + * there's nothing more to be parsed from that packet, but we may have + * indicated that we can return the next enqueued packet. */ + if (s->prev_ret <= 0) + return rtp_parse_queued_packet(s, pkt); + /* return the next packets, if any */ + if(s->st && s->parse_packet) { + /* timestamp should be overwritten by parse_packet, if not, + * the packet is left with pts == AV_NOPTS_VALUE */ + timestamp = RTP_NOTS_VALUE; + rv= s->parse_packet(s->ic, s->dynamic_protocol_context, + s->st, pkt, ×tamp, NULL, 0, flags); + finalize_packet(s, pkt, timestamp); + return rv; + } else { + // TODO: Move to a dynamic packet handler (like above) + if (s->read_buf_index >= s->read_buf_size) + return AVERROR(EAGAIN); + ret = ff_mpegts_parse_packet(s->ts, pkt, s->buf + s->read_buf_index, + s->read_buf_size - s->read_buf_index); + if (ret < 0) + return AVERROR(EAGAIN); + s->read_buf_index += ret; + if (s->read_buf_index < s->read_buf_size) + return 1; + else + return 0; + } + } + + if (len < 12) + return -1; + + if ((buf[0] & 0xc0) != (RTP_VERSION << 6)) + return -1; + if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) { + return rtcp_parse_packet(s, buf, len); + } + + if ((s->seq == 0 && !s->queue) || s->queue_size <= 1) { + /* First packet, or no reordering */ + return rtp_parse_packet_internal(s, pkt, buf, len); + } else { + uint16_t seq = AV_RB16(buf + 2); + int16_t diff = seq - s->seq; + if (diff < 0) { + /* Packet older than the previously emitted one, drop */ + av_log(s->st ? s->st->codec : NULL, AV_LOG_WARNING, + "RTP: dropping old packet received too late\n"); + return -1; + } else if (diff <= 1) { + /* Correct packet */ + rv = rtp_parse_packet_internal(s, pkt, buf, len); + return rv; + } else { + /* Still missing some packet, enqueue this one. */ + enqueue_packet(s, buf, len); + *bufptr = NULL; + /* Return the first enqueued packet if the queue is full, + * even if we're missing something */ + if (s->queue_len >= s->queue_size) + return rtp_parse_queued_packet(s, pkt); + return -1; + } + } +} + +/** + * Parse an RTP or RTCP packet directly sent as a buffer. + * @param s RTP parse context. + * @param pkt returned packet + * @param bufptr pointer to the input buffer or NULL to read the next packets + * @param len buffer len + * @return 0 if a packet is returned, 1 if a packet is returned and more can follow + * (use buf as NULL to read the next). -1 if no packet (error or no more packet). + */ +int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, + uint8_t **bufptr, int len) +{ + int rv = rtp_parse_one_packet(s, pkt, bufptr, len); + s->prev_ret = rv; + while (rv == AVERROR(EAGAIN) && has_next_packet(s)) + rv = rtp_parse_queued_packet(s, pkt); + return rv ? rv : has_next_packet(s); +} + void rtp_parse_close(RTPDemuxContext *s) { + ff_rtp_reset_packet_queue(s); if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) { ff_mpegts_parse_close(s->ts); } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_formats.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_formats.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_formats.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_formats.h 2010-11-06 17:21:29.000000000 +0000 @@ -36,13 +36,19 @@ extern RTPDynamicProtocolHandler ff_h263_1998_dynamic_handler; extern RTPDynamicProtocolHandler ff_h263_2000_dynamic_handler; extern RTPDynamicProtocolHandler ff_h264_dynamic_handler; +extern RTPDynamicProtocolHandler ff_mp4a_latm_dynamic_handler; extern RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler; extern RTPDynamicProtocolHandler ff_mpeg4_generic_dynamic_handler; extern RTPDynamicProtocolHandler ff_ms_rtp_asf_pfa_handler; extern RTPDynamicProtocolHandler ff_ms_rtp_asf_pfv_handler; extern RTPDynamicProtocolHandler ff_qdm2_dynamic_handler; +extern RTPDynamicProtocolHandler ff_qt_rtp_aud_handler; +extern RTPDynamicProtocolHandler ff_qt_rtp_vid_handler; +extern RTPDynamicProtocolHandler ff_quicktime_rtp_aud_handler; +extern RTPDynamicProtocolHandler ff_quicktime_rtp_vid_handler; extern RTPDynamicProtocolHandler ff_svq3_dynamic_handler; extern RTPDynamicProtocolHandler ff_theora_dynamic_handler; extern RTPDynamicProtocolHandler ff_vorbis_dynamic_handler; +extern RTPDynamicProtocolHandler ff_vp8_dynamic_handler; #endif /* AVFORMAT_RTPDEC_FORMATS_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec.h 2010-11-06 17:21:29.000000000 +0000 @@ -32,25 +32,23 @@ #define RTP_MIN_PACKET_LENGTH 12 #define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */ +#define RTP_REORDER_QUEUE_DEFAULT_SIZE 10 + #define RTP_NOTS_VALUE ((uint32_t)-1) typedef struct RTPDemuxContext RTPDemuxContext; -RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type); +RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size); void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, RTPDynamicProtocolHandler *handler); int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len); + uint8_t **buf, int len); void rtp_parse_close(RTPDemuxContext *s); -#if (LIBAVFORMAT_VERSION_MAJOR <= 53) -int rtp_get_local_port(URLContext *h); -#endif +int64_t ff_rtp_queued_packet_time(RTPDemuxContext *s); +void ff_rtp_reset_packet_queue(RTPDemuxContext *s); int rtp_get_local_rtp_port(URLContext *h); int rtp_get_local_rtcp_port(URLContext *h); int rtp_set_remote_url(URLContext *h, const char *uri); -#if (LIBAVFORMAT_VERSION_MAJOR <= 52) -void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd); -#endif /** * Send a dummy packet on both port pairs to set up the connection @@ -72,6 +70,11 @@ */ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count); +/** + * Get the file handle for the RTCP socket. + */ +int rtp_get_rtcp_file_handle(URLContext *h); + // these statistics are used for rtcp receiver reports... typedef struct { uint16_t max_seq; ///< highest sequence number seen @@ -126,6 +129,14 @@ struct RTPDynamicProtocolHandler_s *next; }; +typedef struct RTPPacket { + uint16_t seq; + uint8_t *buf; + int len; + int64_t recvtime; + struct RTPPacket *next; +} RTPPacket; + // moved out of rtp.c, because the h264 decoder needs to know about this structure.. struct RTPDemuxContext { AVFormatContext *ic; @@ -147,6 +158,13 @@ RTPStatistics statistics; ///< Statistics for this stream (used by RTCP receiver reports) + /** Fields for packet reordering @{ */ + int prev_ret; ///< The return value of the actual parsing of the previous packet + RTPPacket* queue; ///< A sorted queue of buffered packets not yet returned + int queue_len; ///< The number of packets in queue + int queue_size; ///< The size of queue, or 0 if reordering is disabled + /*@}*/ + /* rtcp sender statistics receive */ int64_t last_rtcp_ntp_time; // TODO: move into statistics int64_t first_rtcp_ntp_time; // TODO: move into statistics diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_latm.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_latm.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_latm.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_latm.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,187 @@ +/** + * RTP Depacketization of MP4A-LATM, RFC 3016 + * Copyright (c) 2010 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "rtpdec_formats.h" +#include "internal.h" +#include "libavutil/avstring.h" +#include "libavcodec/get_bits.h" +#include + +struct PayloadContext { + ByteIOContext *dyn_buf; + uint8_t *buf; + int pos, len; + uint32_t timestamp; +}; + +static PayloadContext *latm_new_context(void) +{ + return av_mallocz(sizeof(PayloadContext)); +} + +static void latm_free_context(PayloadContext *data) +{ + if (!data) + return; + if (data->dyn_buf) { + uint8_t *p; + url_close_dyn_buf(data->dyn_buf, &p); + av_free(p); + } + av_free(data->buf); + av_free(data); +} + +static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data, + AVStream *st, AVPacket *pkt, uint32_t *timestamp, + const uint8_t *buf, int len, int flags) +{ + int ret, cur_len; + + if (buf) { + if (!data->dyn_buf || data->timestamp != *timestamp) { + av_freep(&data->buf); + if (data->dyn_buf) + url_close_dyn_buf(data->dyn_buf, &data->buf); + data->dyn_buf = NULL; + av_freep(&data->buf); + + data->timestamp = *timestamp; + if ((ret = url_open_dyn_buf(&data->dyn_buf)) < 0) + return ret; + } + put_buffer(data->dyn_buf, buf, len); + + if (!(flags & RTP_FLAG_MARKER)) + return AVERROR(EAGAIN); + av_free(data->buf); + data->len = url_close_dyn_buf(data->dyn_buf, &data->buf); + data->dyn_buf = NULL; + data->pos = 0; + } + + if (!data->buf) { + av_log(ctx, AV_LOG_ERROR, "No data available yet\n"); + return AVERROR(EIO); + } + + cur_len = 0; + while (data->pos < data->len) { + uint8_t val = data->buf[data->pos++]; + cur_len += val; + if (val != 0xff) + break; + } + if (data->pos + cur_len > data->len) { + av_log(ctx, AV_LOG_ERROR, "Malformed LATM packet\n"); + return AVERROR(EIO); + } + + if ((ret = av_new_packet(pkt, cur_len)) < 0) + return ret; + memcpy(pkt->data, data->buf + data->pos, cur_len); + data->pos += cur_len; + pkt->stream_index = st->index; + return data->pos < data->len; +} + +static int parse_fmtp_config(AVStream *st, char *value) +{ + int len = ff_hex_to_data(NULL, value), i, ret = 0; + GetBitContext gb; + uint8_t *config; + int audio_mux_version, same_time_framing, num_sub_frames, + num_programs, num_layers; + + /* Pad this buffer, too, to avoid out of bounds reads with get_bits below */ + config = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); + if (!config) + return AVERROR(ENOMEM); + ff_hex_to_data(config, value); + init_get_bits(&gb, config, len*8); + audio_mux_version = get_bits(&gb, 1); + same_time_framing = get_bits(&gb, 1); + num_sub_frames = get_bits(&gb, 6); + num_programs = get_bits(&gb, 4); + num_layers = get_bits(&gb, 3); + if (audio_mux_version != 0 || same_time_framing != 1 || num_programs != 0 || + num_layers != 0) { + av_log(NULL, AV_LOG_WARNING, "Unsupported LATM config (%d,%d,%d,%d)\n", + audio_mux_version, same_time_framing, + num_programs, num_layers); + ret = AVERROR_PATCHWELCOME; + goto end; + } + av_freep(&st->codec->extradata); + st->codec->extradata_size = (get_bits_left(&gb) + 7)/8; + st->codec->extradata = av_mallocz(st->codec->extradata_size + + FF_INPUT_BUFFER_PADDING_SIZE); + if (!st->codec->extradata) { + ret = AVERROR(ENOMEM); + goto end; + } + for (i = 0; i < st->codec->extradata_size; i++) + st->codec->extradata[i] = get_bits(&gb, 8); + +end: + av_free(config); + return ret; +} + +static int parse_fmtp(AVStream *stream, PayloadContext *data, + char *attr, char *value) +{ + int res; + + if (!strcmp(attr, "config")) { + res = parse_fmtp_config(stream, value); + if (res < 0) + return res; + } else if (!strcmp(attr, "cpresent")) { + int cpresent = atoi(value); + if (cpresent != 0) + av_log_missing_feature(NULL, "RTP MP4A-LATM with in-band " + "configuration", 1); + } + + return 0; +} + +static int latm_parse_sdp_line(AVFormatContext *s, int st_index, + PayloadContext *data, const char *line) +{ + const char *p; + + if (av_strstart(line, "fmtp:", &p)) + return ff_parse_fmtp(s->streams[st_index], data, p, parse_fmtp); + + return 0; +} + +RTPDynamicProtocolHandler ff_mp4a_latm_dynamic_handler = { + .enc_name = "MP4A-LATM", + .codec_type = AVMEDIA_TYPE_AUDIO, + .codec_id = CODEC_ID_AAC, + .parse_sdp_a_line = latm_parse_sdp_line, + .open = latm_new_context, + .close = latm_free_context, + .parse_packet = latm_parse_packet +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_mpeg4.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_mpeg4.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_mpeg4.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_mpeg4.c 2010-11-06 17:21:29.000000000 +0000 @@ -61,35 +61,6 @@ int cur_au_index; }; -/* return the length and optionally the data */ -static int hex_to_data(uint8_t *data, const char *p) -{ - int c, len, v; - - len = 0; - v = 1; - for (;;) { - p += strspn(p, SPACE_CHARS); - if (*p == '\0') - break; - c = toupper((unsigned char) *p++); - if (c >= '0' && c <= '9') - c = c - '0'; - else if (c >= 'A' && c <= 'F') - c = c - 'A' + 10; - else - break; - v = (v << 4) | c; - if (v & 0x100) { - if (data) - data[len] = v; - len++; - v = 1; - } - } - return len; -} - typedef struct { const char *str; uint16_t type; @@ -139,14 +110,14 @@ static int parse_fmtp_config(AVCodecContext * codec, char *value) { /* decode the hexa encoded parameter */ - int len = hex_to_data(NULL, value); + int len = ff_hex_to_data(NULL, value); if (codec->extradata) av_free(codec->extradata); codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) return AVERROR(ENOMEM); codec->extradata_size = len; - hex_to_data(codec->extradata, value); + ff_hex_to_data(codec->extradata, value); return 0; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_qdm2.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_qdm2.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_qdm2.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_qdm2.c 2010-11-06 17:21:29.000000000 +0000 @@ -307,7 +307,7 @@ RTPDynamicProtocolHandler ff_qdm2_dynamic_handler = { "X-QDM", - CODEC_TYPE_AUDIO, + AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, NULL, qdm2_extradata_new, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_qt.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_qt.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_qt.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_qt.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,255 @@ +/* + * RTP/Quicktime support. + * Copyright (c) 2009 Ronald S. Bultje + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @brief Quicktime-style RTP support + * @author Ronald S. Bultje + */ + +#include "avformat.h" +#include "rtp.h" +#include "rtpdec.h" +#include "isom.h" +#include "libavcodec/get_bits.h" + +struct PayloadContext { + AVPacket pkt; + int bytes_per_frame, remaining; + uint32_t timestamp; +}; + +static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, + AVStream *st, AVPacket *pkt, + uint32_t *timestamp, const uint8_t *buf, + int len, int flags) +{ + ByteIOContext pb; + GetBitContext gb; + int packing_scheme, has_payload_desc, has_packet_info, alen, + has_marker_bit = flags & RTP_FLAG_MARKER; + + if (qt->remaining) { + int num = qt->pkt.size / qt->bytes_per_frame; + + if (av_new_packet(pkt, qt->bytes_per_frame)) + return AVERROR(ENOMEM); + pkt->stream_index = st->index; + pkt->flags = qt->pkt.flags; + memcpy(pkt->data, + &qt->pkt.data[(num - qt->remaining) * qt->bytes_per_frame], + qt->bytes_per_frame); + if (--qt->remaining == 0) { + av_freep(&qt->pkt.data); + qt->pkt.size = 0; + } + return qt->remaining > 0; + } + + /** + * The RTP payload is described in: + * http://developer.apple.com/quicktime/icefloe/dispatch026.html + */ + init_get_bits(&gb, buf, len << 3); + init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL); + + if (len < 4) + return AVERROR_INVALIDDATA; + + skip_bits(&gb, 4); // version + if ((packing_scheme = get_bits(&gb, 2)) == 0) + return AVERROR_INVALIDDATA; + if (get_bits1(&gb)) + flags |= RTP_FLAG_KEY; + has_payload_desc = get_bits1(&gb); + has_packet_info = get_bits1(&gb); + skip_bits(&gb, 23); // reserved:7, cache payload info:1, payload ID:15 + + if (has_payload_desc) { + int data_len, pos, is_start, is_finish; + uint32_t tag; + + pos = get_bits_count(&gb) >> 3; + if (pos + 12 > len) + return AVERROR_INVALIDDATA; + + skip_bits(&gb, 2); // has non-I frames:1, is sparse:1 + is_start = get_bits1(&gb); + is_finish = get_bits1(&gb); + if (!is_start || !is_finish) { + av_log_missing_feature(s, "RTP-X-QT with payload description " + "split over several packets", 1); + return AVERROR_NOTSUPP; + } + skip_bits(&gb, 12); // reserved + data_len = get_bits(&gb, 16); + + url_fseek(&pb, pos + 4, SEEK_SET); + tag = get_le32(&pb); + if ((st->codec->codec_type == CODEC_TYPE_VIDEO && + tag != MKTAG('v','i','d','e')) || + (st->codec->codec_type == CODEC_TYPE_AUDIO && + tag != MKTAG('s','o','u','n'))) + return AVERROR_INVALIDDATA; + av_set_pts_info(st, 32, 1, get_be32(&pb)); + + if (pos + data_len > len) + return AVERROR_INVALIDDATA; + /* TLVs */ + while (url_ftell(&pb) + 4 < pos + data_len) { + int tlv_len = get_be16(&pb); + tag = get_le16(&pb); + if (url_ftell(&pb) + tlv_len > pos + data_len) + return AVERROR_INVALIDDATA; + +#define MKTAG16(a,b) MKTAG(a,b,0,0) + switch (tag) { + case MKTAG16('s','d'): { + MOVStreamContext *msc; + void *priv_data = st->priv_data; + int nb_streams = s->nb_streams; + MOVContext *mc = av_mallocz(sizeof(*mc)); + if (!mc) + return AVERROR(ENOMEM); + mc->fc = s; + st->priv_data = msc = av_mallocz(sizeof(MOVStreamContext)); + if (!msc) { + av_free(mc); + st->priv_data = priv_data; + return AVERROR(ENOMEM); + } + /* ff_mov_read_stsd_entries updates stream s->nb_streams-1, + * so set it temporarily to indicate which stream to update. */ + s->nb_streams = st->index + 1; + ff_mov_read_stsd_entries(mc, &pb, 1); + qt->bytes_per_frame = msc->bytes_per_frame; + av_free(msc); + av_free(mc); + st->priv_data = priv_data; + s->nb_streams = nb_streams; + break; + } + default: + url_fskip(&pb, tlv_len); + break; + } + } + + /* 32-bit alignment */ + url_fskip(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb)); + } else + url_fseek(&pb, 4, SEEK_SET); + + if (has_packet_info) { + av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1); + return AVERROR_NOTSUPP; + } + + alen = len - url_ftell(&pb); + if (alen <= 0) + return AVERROR_INVALIDDATA; + + switch (packing_scheme) { + case 3: /* one data packet spread over 1 or multiple RTP packets */ + if (qt->pkt.size > 0 && qt->timestamp == *timestamp) { + qt->pkt.data = av_realloc(qt->pkt.data, qt->pkt.size + alen + + FF_INPUT_BUFFER_PADDING_SIZE); + } else { + av_freep(&qt->pkt.data); + av_init_packet(&qt->pkt); + qt->pkt.data = av_malloc(alen + FF_INPUT_BUFFER_PADDING_SIZE); + qt->pkt.size = 0; + qt->timestamp = *timestamp; + } + if (!qt->pkt.data) + return AVERROR(ENOMEM); + memcpy(qt->pkt.data + qt->pkt.size, buf + url_ftell(&pb), alen); + qt->pkt.size += alen; + if (has_marker_bit) { + *pkt = qt->pkt; + qt->pkt.size = 0; + qt->pkt.data = NULL; + pkt->flags = flags & RTP_FLAG_KEY ? AV_PKT_FLAG_KEY : 0; + pkt->stream_index = st->index; + pkt->destruct = av_destruct_packet; + memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + return 0; + } + return AVERROR(EAGAIN); + + case 1: /* constant packet size, multiple packets per RTP packet */ + if (qt->bytes_per_frame == 0 || + alen % qt->bytes_per_frame != 0) + return AVERROR_INVALIDDATA; /* wrongly padded */ + qt->remaining = (alen / qt->bytes_per_frame) - 1; + if (av_new_packet(pkt, qt->bytes_per_frame)) + return AVERROR(ENOMEM); + memcpy(pkt->data, buf + url_ftell(&pb), qt->bytes_per_frame); + pkt->flags = flags & RTP_FLAG_KEY ? AV_PKT_FLAG_KEY : 0; + pkt->stream_index = st->index; + if (qt->remaining > 0) { + av_freep(&qt->pkt.data); + qt->pkt.data = av_malloc(qt->remaining * qt->bytes_per_frame); + if (!qt->pkt.data) { + av_free_packet(pkt); + return AVERROR(ENOMEM); + } + qt->pkt.size = qt->remaining * qt->bytes_per_frame; + memcpy(qt->pkt.data, + buf + url_ftell(&pb) + qt->bytes_per_frame, + qt->remaining * qt->bytes_per_frame); + qt->pkt.flags = pkt->flags; + return 1; + } + return 0; + + default: /* unimplemented */ + av_log_missing_feature(NULL, "RTP-X-QT with packing scheme 2", 1); + return AVERROR_NOTSUPP; + } +} + +static PayloadContext *qt_rtp_new(void) +{ + return av_mallocz(sizeof(PayloadContext)); +} + +static void qt_rtp_free(PayloadContext *qt) +{ + av_freep(&qt->pkt.data); + av_free(qt); +} + +#define RTP_QT_HANDLER(m, n, s, t) \ +RTPDynamicProtocolHandler ff_ ## m ## _rtp_ ## n ## _handler = { \ + s, \ + t, \ + CODEC_ID_NONE, \ + NULL, \ + qt_rtp_new, \ + qt_rtp_free, \ + qt_rtp_parse_packet, \ +}; + +RTP_QT_HANDLER(qt, vid, "X-QT", CODEC_TYPE_VIDEO); +RTP_QT_HANDLER(qt, aud, "X-QT", CODEC_TYPE_AUDIO); +RTP_QT_HANDLER(quicktime, vid, "X-QUICKTIME", CODEC_TYPE_VIDEO); +RTP_QT_HANDLER(quicktime, aud, "X-QUICKTIME", CODEC_TYPE_AUDIO); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_svq3.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_svq3.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_svq3.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_svq3.c 2010-11-06 17:21:29.000000000 +0000 @@ -35,7 +35,6 @@ struct PayloadContext { ByteIOContext *pktbuf; int64_t timestamp; - int is_keyframe; }; /** return 0 on packet, <0 on partial packet or error... */ @@ -90,7 +89,6 @@ if ((res = url_open_dyn_buf(&sv->pktbuf)) < 0) return res; sv->timestamp = *timestamp; - sv->is_keyframe = flags & RTP_FLAG_KEY; } if (!sv->pktbuf) @@ -102,7 +100,6 @@ av_init_packet(pkt); pkt->stream_index = st->index; *timestamp = sv->timestamp; - pkt->flags = sv->is_keyframe ? AV_PKT_FLAG_KEY : 0; pkt->size = url_close_dyn_buf(sv->pktbuf, &pkt->data); pkt->destruct = av_destruct_packet; sv->pktbuf = NULL; @@ -129,7 +126,7 @@ RTPDynamicProtocolHandler ff_svq3_dynamic_handler = { "X-SV3V-ES", - CODEC_TYPE_VIDEO, + AVMEDIA_TYPE_VIDEO, CODEC_ID_NONE, // see if (config_packet) above NULL, // parse sdp line svq3_extradata_new, diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_vp8.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_vp8.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpdec_vp8.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpdec_vp8.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,153 @@ +/* + * RTP VP8 Depacketizer + * Copyright (c) 2010 Josh Allmann + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @brief RTP support for the VP8 payload + * @author Josh Allmann + * ( http://www.webmproject.org/code/specs/rtp/ ) + */ + +#include "libavcodec/bytestream.h" + +#include "rtpdec_formats.h" + +struct PayloadContext { + ByteIOContext *data; + uint32_t timestamp; + int is_keyframe; +}; + +static void prepare_packet(AVPacket *pkt, PayloadContext *vp8, int stream) +{ + av_init_packet(pkt); + pkt->stream_index = stream; + pkt->flags = vp8->is_keyframe ? AV_PKT_FLAG_KEY : 0; + pkt->size = url_close_dyn_buf(vp8->data, &pkt->data); + pkt->destruct = av_destruct_packet; + vp8->data = NULL; +} + +static int vp8_handle_packet(AVFormatContext *ctx, + PayloadContext *vp8, + AVStream *st, + AVPacket *pkt, + uint32_t *timestamp, + const uint8_t *buf, + int len, int flags) +{ + int start_packet, end_packet, has_au, ret = AVERROR(EAGAIN); + + if (!buf) { + // only called when vp8_handle_packet returns 1 + if (!vp8->data) { + av_log(ctx, AV_LOG_ERROR, "Invalid VP8 data passed\n"); + return AVERROR_INVALIDDATA; + } + prepare_packet(pkt, vp8, st->index); + *timestamp = vp8->timestamp; + return 0; + } + + start_packet = *buf & 1; + end_packet = flags & RTP_FLAG_MARKER; + has_au = *buf & 2; + buf++; + len--; + + if (start_packet) { + int res; + uint32_t ts = *timestamp; + if (vp8->data) { + // missing end marker; return old frame anyway. untested + prepare_packet(pkt, vp8, st->index); + *timestamp = vp8->timestamp; // reset timestamp from old frame + + // if current frame fits into one rtp packet, need to hold + // that for the next av_get_packet call + ret = end_packet ? 1 : 0; + } + if ((res = url_open_dyn_buf(&vp8->data)) < 0) + return res; + vp8->is_keyframe = *buf & 1; + vp8->timestamp = ts; + } + + if (!vp8->data || vp8->timestamp != *timestamp && ret == AVERROR(EAGAIN)) { + av_log(ctx, AV_LOG_WARNING, + "Received no start marker; dropping frame\n"); + return AVERROR(EAGAIN); + } + + // cycle through VP8AU headers if needed + // not tested with actual VP8AUs + while (len) { + int au_len = len; + if (has_au && len > 2) { + au_len = AV_RB16(buf); + buf += 2; + len -= 2; + if (buf + au_len > buf + len) { + av_log(ctx, AV_LOG_ERROR, "Invalid VP8AU length\n"); + return AVERROR_INVALIDDATA; + } + } + + put_buffer(vp8->data, buf, au_len); + buf += au_len; + len -= au_len; + } + + if (ret != AVERROR(EAGAIN)) // did we miss a end marker? + return ret; + + if (end_packet) { + prepare_packet(pkt, vp8, st->index); + return 0; + } + + return AVERROR(EAGAIN); +} + +static PayloadContext *vp8_new_context(void) +{ + av_log(NULL, AV_LOG_WARNING, "RTP VP8 payload is still experimental\n"); + return av_mallocz(sizeof(PayloadContext)); +} + +static void vp8_free_context(PayloadContext *vp8) +{ + if (vp8->data) { + uint8_t *tmp; + url_close_dyn_buf(vp8->data, &tmp); + av_free(tmp); + } + av_free(vp8); +} + +RTPDynamicProtocolHandler ff_vp8_dynamic_handler = { + .enc_name = "VP8", + .codec_type = AVMEDIA_TYPE_VIDEO, + .codec_id = CODEC_ID_VP8, + .open = vp8_new_context, + .close = vp8_free_context, + .parse_packet = vp8_handle_packet, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -55,6 +55,8 @@ case CODEC_ID_AMR_WB: case CODEC_ID_VORBIS: case CODEC_ID_THEORA: + case CODEC_ID_VP8: + case CODEC_ID_ADPCM_G722: return 1; default: return 0; @@ -144,6 +146,14 @@ s->max_payload_size -= 6; // ident+frag+tdt/vdt+pkt_num+pkt_length s->num_frames = 0; goto defaultcase; + case CODEC_ID_VP8: + av_log(s1, AV_LOG_WARNING, "RTP VP8 payload is still experimental\n"); + break; + case CODEC_ID_ADPCM_G722: + /* Due to a historical error, the clock rate for G722 in RTP is + * 8000, even if the sample rate is 16000. See RFC 3551. */ + av_set_pts_info(st, 32, 1, 8000); + break; case CODEC_ID_AMR_NB: case CODEC_ID_AMR_WB: if (!s->max_frames_per_packet) @@ -187,7 +197,7 @@ rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1000000}, s1->streams[0]->time_base) + s->base_timestamp; put_byte(s1->pb, (RTP_VERSION << 6)); - put_byte(s1->pb, 200); + put_byte(s1->pb, RTCP_SR); put_be16(s1->pb, 6); /* length in words - 1 */ put_be32(s1->pb, s->ssrc); put_be32(s1->pb, ntp_time / 1000000); @@ -378,6 +388,12 @@ case CODEC_ID_PCM_S16LE: rtp_send_samples(s1, pkt->data, size, 2 * st->codec->channels); break; + case CODEC_ID_ADPCM_G722: + /* The actual sample size is half a byte per sample, but since the + * stream clock rate is 8000 Hz while the sample rate is 16000 Hz, + * the correct parameter for send_samples is 1 byte per stream clock. */ + rtp_send_samples(s1, pkt->data, size, 1 * st->codec->channels); + break; case CODEC_ID_MP2: case CODEC_ID_MP3: rtp_send_mpegaudio(s1, pkt->data, size); @@ -407,6 +423,9 @@ case CODEC_ID_THEORA: ff_rtp_send_xiph(s1, pkt->data, size); break; + case CODEC_ID_VP8: + ff_rtp_send_vp8(s1, pkt->data, size); + break; default: /* better than nothing : send the codec raw data */ rtp_send_raw(s1, pkt->data, size); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc_chain.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc_chain.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc_chain.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc_chain.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,82 @@ +/* + * RTP muxer chaining code + * Copyright (c) 2010 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "rtpenc_chain.h" + +AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, + URLContext *handle, int packet_size) +{ + AVFormatContext *rtpctx; + int ret; + AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); + + if (!rtp_format) + return NULL; + + /* Allocate an AVFormatContext for each output stream */ + rtpctx = avformat_alloc_context(); + if (!rtpctx) + return NULL; + + rtpctx->oformat = rtp_format; + if (!av_new_stream(rtpctx, 0)) { + av_free(rtpctx); + return NULL; + } + /* Copy the max delay setting; the rtp muxer reads this. */ + rtpctx->max_delay = s->max_delay; + /* Copy other stream parameters. */ + rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio; + + /* Set the synchronized start time. */ + rtpctx->start_time_realtime = s->start_time_realtime; + + /* Remove the local codec, link to the original codec + * context instead, to give the rtp muxer access to + * codec parameters. */ + av_free(rtpctx->streams[0]->codec); + rtpctx->streams[0]->codec = st->codec; + + if (handle) { + url_fdopen(&rtpctx->pb, handle); + } else + url_open_dyn_packet_buf(&rtpctx->pb, packet_size); + ret = av_write_header(rtpctx); + + if (ret) { + if (handle) { + url_fclose(rtpctx->pb); + } else { + uint8_t *ptr; + url_close_dyn_buf(rtpctx->pb, &ptr); + av_free(ptr); + } + av_free(rtpctx->streams[0]); + av_free(rtpctx); + return NULL; + } + + /* Copy the RTP AVStream timebase back to the original AVStream */ + st->time_base = rtpctx->streams[0]->time_base; + return rtpctx; +} + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc_chain.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc_chain.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc_chain.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc_chain.h 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,30 @@ +/* + * RTP muxer chaining code + * Copyright (c) 2010 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_RTPENC_CHAIN_H +#define AVFORMAT_RTPENC_CHAIN_H + +#include "avformat.h" + +AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, + URLContext *handle, int packet_size); + +#endif /* AVFORMAT_RTPENC_CHAIN_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc.h 2010-11-06 17:21:29.000000000 +0000 @@ -68,5 +68,6 @@ void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size); void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size); void ff_rtp_send_xiph(AVFormatContext *s1, const uint8_t *buff, int size); +void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buff, int size); #endif /* AVFORMAT_RTPENC_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc_vp8.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc_vp8.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc_vp8.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc_vp8.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * RTP VP8 Packetizer + * Copyright (c) 2010 Josh Allmann + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "rtpenc.h" + +/* Based on a draft spec for VP8 RTP. + * ( http://www.webmproject.org/code/specs/rtp/ ) */ +void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buf, int size) +{ + RTPMuxContext *s = s1->priv_data; + int len, max_packet_size; + + s->buf_ptr = s->buf; + s->timestamp = s->cur_timestamp; + max_packet_size = s->max_payload_size - 1; // minus one for header byte + + *s->buf_ptr++ = 1; // 0b1 indicates start of frame + while (size > 0) { + len = FFMIN(size, max_packet_size); + + memcpy(s->buf_ptr, buf, len); + ff_rtp_send_data(s1, s->buf, len+1, size == len); // marker bit is last packet in frame + + size -= len; + buf += len; + s->buf_ptr = s->buf; + *s->buf_ptr++ = 0; // payload descriptor + } +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc_xiph.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc_xiph.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpenc_xiph.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpenc_xiph.c 2010-11-06 17:21:29.000000000 +0000 @@ -52,13 +52,13 @@ break; } - // Set ident. Must match the one in sdp.c + // Set ident. // Probably need a non-fixed way of generating // this, but it has to be done in SDP and passed in from there. q = s->buf; - *q++ = 0xfe; - *q++ = 0xcd; - *q++ = 0xba; + *q++ = (RTP_XIPH_IDENT >> 16) & 0xff; + *q++ = (RTP_XIPH_IDENT >> 8) & 0xff; + *q++ = (RTP_XIPH_IDENT ) & 0xff; // set fragment // 0 - whole frame (possibly multiple frames) @@ -68,12 +68,13 @@ frag = size <= max_pkt_size ? 0 : 1; if (!frag && !xdt) { // do we have a whole frame of raw data? - unsigned end_ptr = (unsigned)s->buf + 6 + max_pkt_size; // what we're allowed to write - unsigned ptr = (unsigned)s->buf_ptr + 2 + size; // what we're going to write + uint8_t *end_ptr = s->buf + 6 + max_pkt_size; // what we're allowed to write + uint8_t *ptr = s->buf_ptr + 2 + size; // what we're going to write int remaining = end_ptr - ptr; + assert(s->num_frames <= s->max_frames_per_packet); if ((s->num_frames > 0 && remaining < 0) || - s->num_frames >= s->max_frames_per_packet) { + s->num_frames == s->max_frames_per_packet) { // send previous packets now; no room for new data ff_rtp_send_data(s1, s->buf, s->buf_ptr - s->buf, 0); s->num_frames = 0; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtp.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtp.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtp.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtp.h 2010-11-06 17:21:29.000000000 +0000 @@ -76,4 +76,19 @@ #define RTCP_TX_RATIO_NUM 5 #define RTCP_TX_RATIO_DEN 1000 +/* An arbitrary id value for RTP Xiph streams - only relevant to indicate + * the the configuration has changed within a stream (by changing the + * ident value sent). + */ +#define RTP_XIPH_IDENT 0xfecdba + +/* RTCP packet types */ +enum RTCPType { + RTCP_SR = 200, + RTCP_RR, // 201 + RTCP_SDES, // 202 + RTCP_BYE, // 203 + RTCP_APP // 204 +}; + #endif /* AVFORMAT_RTP_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpproto.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpproto.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtpproto.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtpproto.c 2010-11-06 17:21:29.000000000 +0000 @@ -210,7 +210,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) { RTPContext *s = h->priv_data; - struct sockaddr_in from; + struct sockaddr_storage from; socklen_t from_len; int len, fd_max, n; fd_set rfds; @@ -285,7 +285,7 @@ int ret; URLContext *hd; - if (buf[1] >= 200 && buf[1] <= 204) { + if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) { /* RTCP payload type */ hd = s->rtcp_hd; } else { @@ -328,18 +328,6 @@ } /** - * Return the local rtp port used by the RTP connection - * @param h media file context - * @return the local port number - */ - -int rtp_get_local_port(URLContext *h) -{ - RTPContext *s = h->priv_data; - return udp_get_local_port(s->rtp_hd); -} - -/** * Return the local rtcp port used by the RTP connection * @param h media file context * @return the local port number @@ -351,26 +339,15 @@ return udp_get_local_port(s->rtcp_hd); } -#if (LIBAVFORMAT_VERSION_MAJOR <= 52) -/** - * Return the rtp and rtcp file handles for select() usage to wait for - * several RTP streams at the same time. - * @param h media file context - */ - -void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd) +static int rtp_get_file_handle(URLContext *h) { RTPContext *s = h->priv_data; - - *prtp_fd = s->rtp_fd; - *prtcp_fd = s->rtcp_fd; + return s->rtp_fd; } -#endif -static int rtp_get_file_handle(URLContext *h) -{ +int rtp_get_rtcp_file_handle(URLContext *h) { RTPContext *s = h->priv_data; - return s->rtp_fd; + return s->rtcp_fd; } URLProtocol rtp_protocol = { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtsp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtsp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtsp.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtsp.c 2010-11-06 17:21:29.000000000 +0000 @@ -39,20 +39,18 @@ #include "rtpdec.h" #include "rdt.h" #include "rtpdec_formats.h" +#include "rtpenc_chain.h" //#define DEBUG //#define DEBUG_RTP_TCP -#if LIBAVFORMAT_VERSION_INT < (53 << 16) -int rtsp_default_protocols = (1 << RTSP_LOWER_TRANSPORT_UDP); -#endif - /* Timeout values for socket select, in ms, * and read_packet(), in seconds */ #define SELECT_TIMEOUT_MS 100 #define READ_PACKET_TIMEOUT_S 10 #define MAX_TIMEOUTS READ_PACKET_TIMEOUT_S * 1000 / SELECT_TIMEOUT_MS #define SDP_MAX_SIZE 16384 +#define RECVBUF_SIZE 10 * RTP_MAX_PACKET_LENGTH static void get_word_until_chars(char *buf, int buf_size, const char *sep, const char **pp) @@ -85,6 +83,45 @@ get_word_until_chars(buf, buf_size, SPACE_CHARS, pp); } +/** Parse a string p in the form of Range:npt=xx-xx, and determine the start + * and end time. + * Used for seeking in the rtp stream. + */ +static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end) +{ + char buf[256]; + + p += strspn(p, SPACE_CHARS); + if (!av_stristart(p, "npt=", &p)) + return; + + *start = AV_NOPTS_VALUE; + *end = AV_NOPTS_VALUE; + + get_word_sep(buf, sizeof(buf), "-", &p); + *start = parse_date(buf, 1); + if (*p == '-') { + p++; + get_word_sep(buf, sizeof(buf), "-", &p); + *end = parse_date(buf, 1); + } +// av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start); +// av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end); +} + +static int get_sockaddr(const char *buf, struct sockaddr_storage *sock) +{ + struct addrinfo hints, *ai = NULL; + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_NUMERICHOST; + if (getaddrinfo(buf, NULL, &hints, &ai)) + return -1; + memcpy(sock, ai->ai_addr, FFMIN(sizeof(*sock), ai->ai_addrlen)); + freeaddrinfo(ai); + return 0; +} + +#if CONFIG_RTPDEC /* parse the rtpmap description: /[/] */ static int sdp_parse_rtpmap(AVFormatContext *s, AVCodecContext *codec, RTSPStream *rtsp_st, @@ -114,6 +151,12 @@ break; } } + /* If no dynamic handler was found, check with the list of standard + * allocated types, if such a stream for some reason happens to + * use a private payload type. This isn't handled in rtpdec.c, since + * the format name from the rtpmap line never is passed into rtpdec. */ + if (!rtsp_st->dynamic_handler) + codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type); } else { /* We are in a standard case * (from http://www.iana.org/assignments/rtp-parameters). */ @@ -178,35 +221,9 @@ return 0; } -/** Parse a string p in the form of Range:npt=xx-xx, and determine the start - * and end time. - * Used for seeking in the rtp stream. - */ -static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end) -{ - char buf[256]; - - p += strspn(p, SPACE_CHARS); - if (!av_stristart(p, "npt=", &p)) - return; - - *start = AV_NOPTS_VALUE; - *end = AV_NOPTS_VALUE; - - get_word_sep(buf, sizeof(buf), "-", &p); - *start = parse_date(buf, 1); - if (*p == '-') { - p++; - get_word_sep(buf, sizeof(buf), "-", &p); - *end = parse_date(buf, 1); - } -// av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start); -// av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end); -} - typedef struct SDPParseState { /* SDP only */ - struct in_addr default_ip; + struct sockaddr_storage default_ip; int default_ttl; int skip_media; ///< set if an unknown m= line occurs } SDPParseState; @@ -221,7 +238,7 @@ int payload_type, i; AVStream *st; RTSPStream *rtsp_st; - struct in_addr sdp_ip; + struct sockaddr_storage sdp_ip; int ttl; dprintf(s, "sdp: %c='%s'\n", letter, buf); @@ -235,10 +252,10 @@ if (strcmp(buf1, "IN") != 0) return; get_word(buf1, sizeof(buf1), &p); - if (strcmp(buf1, "IP4") != 0) + if (strcmp(buf1, "IP4") && strcmp(buf1, "IP6")) return; get_word_sep(buf1, sizeof(buf1), "/", &p); - if (ff_inet_aton(buf1, &sdp_ip) == 0) + if (get_sockaddr(buf1, &sdp_ip)) return; ttl = 16; if (*p == '/') { @@ -394,7 +411,7 @@ } } -static int sdp_parse(AVFormatContext *s, const char *content) +int ff_sdp_parse(AVFormatContext *s, const char *content) { const char *p; int letter; @@ -437,6 +454,7 @@ } return 0; } +#endif /* CONFIG_RTPDEC */ /* close and free RTSP streams */ void ff_rtsp_close_streams(AVFormatContext *s) @@ -463,9 +481,9 @@ av_metadata_free(&rtpctx->metadata); av_free(rtpctx->streams[0]); av_free(rtpctx); - } else if (rt->transport == RTSP_TRANSPORT_RDT) + } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ff_rdt_parse_close(rtsp_st->transport_priv); - else + else if (CONFIG_RTPDEC) rtp_parse_close(rtsp_st->transport_priv); } if (rtsp_st->rtp_handle) @@ -480,65 +498,7 @@ av_close_input_stream (rt->asf_ctx); rt->asf_ctx = NULL; } -} - -static void *rtsp_rtp_mux_open(AVFormatContext *s, AVStream *st, - URLContext *handle) -{ - RTSPState *rt = s->priv_data; - AVFormatContext *rtpctx; - int ret; - AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); - - if (!rtp_format) - return NULL; - - /* Allocate an AVFormatContext for each output stream */ - rtpctx = avformat_alloc_context(); - if (!rtpctx) - return NULL; - - rtpctx->oformat = rtp_format; - if (!av_new_stream(rtpctx, 0)) { - av_free(rtpctx); - return NULL; - } - /* Copy the max delay setting; the rtp muxer reads this. */ - rtpctx->max_delay = s->max_delay; - /* Copy other stream parameters. */ - rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio; - - /* Set the synchronized start time. */ - rtpctx->start_time_realtime = rt->start_time; - - /* Remove the local codec, link to the original codec - * context instead, to give the rtp muxer access to - * codec parameters. */ - av_free(rtpctx->streams[0]->codec); - rtpctx->streams[0]->codec = st->codec; - - if (handle) { - url_fdopen(&rtpctx->pb, handle); - } else - url_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE); - ret = av_write_header(rtpctx); - - if (ret) { - if (handle) { - url_fclose(rtpctx->pb); - } else { - uint8_t *ptr; - url_close_dyn_buf(rtpctx->pb, &ptr); - av_free(ptr); - } - av_free(rtpctx->streams[0]); - av_free(rtpctx); - return NULL; - } - - /* Copy the RTP AVStream timebase back to the original AVStream */ - st->time_base = rtpctx->streams[0]->time_base; - return rtpctx; + av_free(rt->recvbuf); } static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) @@ -552,21 +512,25 @@ if (!st) s->ctx_flags |= AVFMTCTX_NOHEADER; - if (s->oformat) { - rtsp_st->transport_priv = rtsp_rtp_mux_open(s, st, rtsp_st->rtp_handle); + if (s->oformat && CONFIG_RTSP_MUXER) { + rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st, + rtsp_st->rtp_handle, + RTSP_TCP_MAX_PACKET_SIZE); /* Ownership of rtp_handle is passed to the rtp mux context */ rtsp_st->rtp_handle = NULL; - } else if (rt->transport == RTSP_TRANSPORT_RDT) + } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, rtsp_st->dynamic_protocol_context, rtsp_st->dynamic_handler); - else + else if (CONFIG_RTPDEC) rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle, - rtsp_st->sdp_payload_type); + rtsp_st->sdp_payload_type, + (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay) + ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE); if (!rtsp_st->transport_priv) { return AVERROR(ENOMEM); - } else if (rt->transport != RTSP_TRANSPORT_RDT) { + } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) { if (rtsp_st->dynamic_handler) { rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv, rtsp_st->dynamic_protocol_context, @@ -578,13 +542,6 @@ } #if CONFIG_RTSP_DEMUXER || CONFIG_RTSP_MUXER -static int rtsp_probe(AVProbeData *p) -{ - if (av_strstart(p->filename, "rtsp:", NULL)) - return AVPROBE_SCORE_MAX; - return 0; -} - static void rtsp_parse_range(int *min_ptr, int *max_ptr, const char **pp) { const char *p; @@ -684,15 +641,19 @@ th->ttl = strtol(p, (char **)&p, 10); } } else if (!strcmp(parameter, "destination")) { - struct in_addr ipaddr; - if (*p == '=') { p++; get_word_sep(buf, sizeof(buf), ";,", &p); - if (ff_inet_aton(buf, &ipaddr)) - th->destination = ntohl(ipaddr.s_addr); + get_sockaddr(buf, &th->destination); + } + } else if (!strcmp(parameter, "source")) { + if (*p == '=') { + p++; + get_word_sep(buf, sizeof(buf), ";,", &p); + av_strlcpy(th->source, buf, sizeof(th->source)); } } + while (*p != ';' && *p != '\0' && *p != ',') p++; if (*p == ';') @@ -797,7 +758,7 @@ dprintf(s, "ret=%d c=%02x [%c]\n", ret, ch, ch); #endif if (ret != 1) - return -1; + return AVERROR_EOF; if (ch == '\n') break; if (ch == '$') { @@ -1054,7 +1015,7 @@ #endif rtp_opened: - port = rtp_get_local_port(rtsp_st->rtp_handle); + port = rtp_get_local_rtp_port(rtsp_st->rtp_handle); have_port: snprintf(transport, sizeof(transport) - 1, "%s/UDP;", trans_pref); @@ -1098,7 +1059,7 @@ snprintf(cmd, sizeof(cmd), "Transport: %s\r\n", transport); - if (i == 0 && rt->server_type == RTSP_SERVER_REAL) { + if (i == 0 && rt->server_type == RTSP_SERVER_REAL && CONFIG_RTPDEC) { char real_res[41], real_csum[9]; ff_rdt_calc_response_and_checksum(real_res, real_csum, real_challenge); @@ -1145,9 +1106,15 @@ case RTSP_LOWER_TRANSPORT_UDP: { char url[1024]; - /* XXX: also use address if specified */ - ff_url_join(url, sizeof(url), "rtp", NULL, host, - reply->transports[0].server_port_min, NULL); + /* Use source address if specified */ + if (reply->transports[0].source[0]) { + ff_url_join(url, sizeof(url), "rtp", NULL, + reply->transports[0].source, + reply->transports[0].server_port_min, NULL); + } else { + ff_url_join(url, sizeof(url), "rtp", NULL, host, + reply->transports[0].server_port_min, NULL); + } if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) { err = AVERROR_INVALIDDATA; @@ -1157,25 +1124,28 @@ * potential NAT router by sending dummy packets. * RTP/RTCP dummy packets are used for RDT, too. */ - if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat) + if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat && + CONFIG_RTPDEC) rtp_send_punch_packets(rtsp_st->rtp_handle); break; } case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { - char url[1024]; - struct in_addr in; + char url[1024], namebuf[50]; + struct sockaddr_storage addr; int port, ttl; - if (reply->transports[0].destination) { - in.s_addr = htonl(reply->transports[0].destination); + if (reply->transports[0].destination.ss_family) { + addr = reply->transports[0].destination; port = reply->transports[0].port_min; ttl = reply->transports[0].ttl; } else { - in = rtsp_st->sdp_ip; + addr = rtsp_st->sdp_ip; port = rtsp_st->sdp_port; ttl = rtsp_st->sdp_ttl; } - ff_url_join(url, sizeof(url), "rtp", NULL, inet_ntoa(in), + getnameinfo((struct sockaddr*) &addr, sizeof(addr), + namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); + ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, port, "?ttl=%d", ttl); if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { err = AVERROR_INVALIDDATA; @@ -1207,150 +1177,6 @@ return err; } -static int rtsp_read_play(AVFormatContext *s) -{ - RTSPState *rt = s->priv_data; - RTSPMessageHeader reply1, *reply = &reply1; - int i; - char cmd[1024]; - - av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state); - - if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) { - if (rt->state == RTSP_STATE_PAUSED) { - cmd[0] = 0; - } else { - snprintf(cmd, sizeof(cmd), - "Range: npt=%0.3f-\r\n", - (double)rt->seek_timestamp / AV_TIME_BASE); - } - ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL); - if (reply->status_code != RTSP_STATUS_OK) { - return -1; - } - if (reply->range_start != AV_NOPTS_VALUE && - rt->transport == RTSP_TRANSPORT_RTP) { - for (i = 0; i < rt->nb_rtsp_streams; i++) { - RTSPStream *rtsp_st = rt->rtsp_streams[i]; - RTPDemuxContext *rtpctx = rtsp_st->transport_priv; - AVStream *st = NULL; - if (!rtpctx) - continue; - if (rtsp_st->stream_index >= 0) - st = s->streams[rtsp_st->stream_index]; - rtpctx->last_rtcp_ntp_time = AV_NOPTS_VALUE; - rtpctx->first_rtcp_ntp_time = AV_NOPTS_VALUE; - if (st) - rtpctx->range_start_offset = av_rescale_q(reply->range_start, - AV_TIME_BASE_Q, - st->time_base); - } - } - } - rt->state = RTSP_STATE_STREAMING; - return 0; -} - -static int rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply) -{ - RTSPState *rt = s->priv_data; - char cmd[1024]; - unsigned char *content = NULL; - int ret; - - /* describe the stream */ - snprintf(cmd, sizeof(cmd), - "Accept: application/sdp\r\n"); - if (rt->server_type == RTSP_SERVER_REAL) { - /** - * The Require: attribute is needed for proper streaming from - * Realmedia servers. - */ - av_strlcat(cmd, - "Require: com.real.retain-entity-for-setup\r\n", - sizeof(cmd)); - } - ff_rtsp_send_cmd(s, "DESCRIBE", rt->control_uri, cmd, reply, &content); - if (!content) - return AVERROR_INVALIDDATA; - if (reply->status_code != RTSP_STATUS_OK) { - av_freep(&content); - return AVERROR_INVALIDDATA; - } - - /* now we got the SDP description, we parse it */ - ret = sdp_parse(s, (const char *)content); - av_freep(&content); - if (ret < 0) - return AVERROR_INVALIDDATA; - - return 0; -} - -static int rtsp_setup_output_streams(AVFormatContext *s, const char *addr) -{ - RTSPState *rt = s->priv_data; - RTSPMessageHeader reply1, *reply = &reply1; - int i; - char *sdp; - AVFormatContext sdp_ctx, *ctx_array[1]; - - rt->start_time = av_gettime(); - - /* Announce the stream */ - sdp = av_mallocz(SDP_MAX_SIZE); - if (sdp == NULL) - return AVERROR(ENOMEM); - /* We create the SDP based on the RTSP AVFormatContext where we - * aren't allowed to change the filename field. (We create the SDP - * based on the RTSP context since the contexts for the RTP streams - * don't exist yet.) In order to specify a custom URL with the actual - * peer IP instead of the originally specified hostname, we create - * a temporary copy of the AVFormatContext, where the custom URL is set. - * - * FIXME: Create the SDP without copying the AVFormatContext. - * This either requires setting up the RTP stream AVFormatContexts - * already here (complicating things immensely) or getting a more - * flexible SDP creation interface. - */ - sdp_ctx = *s; - ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename), - "rtsp", NULL, addr, -1, NULL); - ctx_array[0] = &sdp_ctx; - if (avf_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) { - av_free(sdp); - return AVERROR_INVALIDDATA; - } - av_log(s, AV_LOG_INFO, "SDP:\n%s\n", sdp); - ff_rtsp_send_cmd_with_content(s, "ANNOUNCE", rt->control_uri, - "Content-Type: application/sdp\r\n", - reply, NULL, sdp, strlen(sdp)); - av_free(sdp); - if (reply->status_code != RTSP_STATUS_OK) - return AVERROR_INVALIDDATA; - - /* Set up the RTSPStreams for each AVStream */ - for (i = 0; i < s->nb_streams; i++) { - RTSPStream *rtsp_st; - AVStream *st = s->streams[i]; - - rtsp_st = av_mallocz(sizeof(RTSPStream)); - if (!rtsp_st) - return AVERROR(ENOMEM); - dynarray_add(&rt->rtsp_streams, &rt->nb_rtsp_streams, rtsp_st); - - st->priv_data = rtsp_st; - rtsp_st->stream_index = i; - - av_strlcpy(rtsp_st->control_url, rt->control_uri, sizeof(rtsp_st->control_url)); - /* Note, this must match the relative uri set in the sdp content */ - av_strlcatf(rtsp_st->control_url, sizeof(rtsp_st->control_url), - "/streamid=%d", i); - } - - return 0; -} - void ff_rtsp_close_connections(AVFormatContext *s) { RTSPState *rt = s->priv_data; @@ -1566,10 +1392,10 @@ break; } - if (s->iformat) - err = rtsp_setup_input_streams(s, reply); - else - err = rtsp_setup_output_streams(s, host); + if (s->iformat && CONFIG_RTSP_DEMUXER) + err = ff_rtsp_setup_input_streams(s, reply); + else if (CONFIG_RTSP_MUXER) + err = ff_rtsp_setup_output_streams(s, host); if (err) goto fail; @@ -1605,43 +1431,23 @@ ff_network_close(); return err; } -#endif - -#if CONFIG_RTSP_DEMUXER -static int rtsp_read_header(AVFormatContext *s, - AVFormatParameters *ap) -{ - int ret; - - ret = ff_rtsp_connect(s); - if (ret) - return ret; - - if (ap->initial_pause) { - /* do not start immediately */ - } else { - if (rtsp_read_play(s) < 0) { - ff_rtsp_close_streams(s); - ff_rtsp_close_connections(s); - return AVERROR_INVALIDDATA; - } - } - - return 0; -} +#endif /* CONFIG_RTSP_DEMUXER || CONFIG_RTSP_MUXER */ +#if CONFIG_RTPDEC static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, - uint8_t *buf, int buf_size) + uint8_t *buf, int buf_size, int64_t wait_end) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; fd_set rfds; - int fd, fd_max, n, i, ret, tcp_fd, timeout_cnt = 0; + int fd, fd_rtcp, fd_max, n, i, ret, tcp_fd, timeout_cnt = 0; struct timeval tv; for (;;) { if (url_interrupt_cb()) return AVERROR(EINTR); + if (wait_end && wait_end - av_gettime() < 0) + return AVERROR(EAGAIN); FD_ZERO(&rfds); if (rt->rtsp_hd) { tcp_fd = fd_max = url_get_file_handle(rt->rtsp_hd); @@ -1653,12 +1459,12 @@ for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { - /* currently, we cannot probe RTCP handle because of - * blocking restrictions */ fd = url_get_file_handle(rtsp_st->rtp_handle); - if (fd > fd_max) - fd_max = fd; + fd_rtcp = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle); + if (FFMAX(fd, fd_rtcp) > fd_max) + fd_max = FFMAX(fd, fd_rtcp); FD_SET(fd, &rfds); + FD_SET(fd_rtcp, &rfds); } } tv.tv_sec = 0; @@ -1670,7 +1476,8 @@ rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { fd = url_get_file_handle(rtsp_st->rtp_handle); - if (FD_ISSET(fd, &rfds)) { + fd_rtcp = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle); + if (FD_ISSET(fd_rtcp, &rfds) || FD_ISSET(fd, &rfds)) { ret = url_read(rtsp_st->rtp_handle, buf, buf_size); if (ret > 0) { *prtsp_st = rtsp_st; @@ -1698,66 +1505,15 @@ } } -static int tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, - uint8_t *buf, int buf_size) -{ - RTSPState *rt = s->priv_data; - int id, len, i, ret; - RTSPStream *rtsp_st; - -#ifdef DEBUG_RTP_TCP - dprintf(s, "tcp_read_packet:\n"); -#endif -redo: - for (;;) { - RTSPMessageHeader reply; - - ret = ff_rtsp_read_reply(s, &reply, NULL, 1); - if (ret == -1) - return -1; - if (ret == 1) /* received '$' */ - break; - /* XXX: parse message */ - if (rt->state != RTSP_STATE_STREAMING) - return 0; - } - ret = url_read_complete(rt->rtsp_hd, buf, 3); - if (ret != 3) - return -1; - id = buf[0]; - len = AV_RB16(buf + 1); -#ifdef DEBUG_RTP_TCP - dprintf(s, "id=%d len=%d\n", id, len); -#endif - if (len > buf_size || len < 12) - goto redo; - /* get the data */ - ret = url_read_complete(rt->rtsp_hd, buf, len); - if (ret != len) - return -1; - if (rt->transport == RTSP_TRANSPORT_RDT && - ff_rdt_parse_header(buf, len, &id, NULL, NULL, NULL, NULL) < 0) - return -1; - - /* find the matching stream */ - for (i = 0; i < rt->nb_rtsp_streams; i++) { - rtsp_st = rt->rtsp_streams[i]; - if (id >= rtsp_st->interleaved_min && - id <= rtsp_st->interleaved_max) - goto found; - } - goto redo; -found: - *prtsp_st = rtsp_st; - return len; -} - -static int rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) +int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) { RTSPState *rt = s->priv_data; int ret, len; - uint8_t buf[10 * RTP_MAX_PACKET_LENGTH]; - RTSPStream *rtsp_st; + RTSPStream *rtsp_st, *first_queue_st = NULL; + int64_t wait_end = 0; + + if (rt->nb_byes == rt->nb_rtsp_streams) + return AVERROR_EOF; /* get next frames from the same RTP packet */ if (rt->cur_transport_priv) { @@ -1774,30 +1530,58 @@ rt->cur_transport_priv = NULL; } + if (rt->transport == RTSP_TRANSPORT_RTP) { + int i; + int64_t first_queue_time = 0; + for (i = 0; i < rt->nb_rtsp_streams; i++) { + RTPDemuxContext *rtpctx = rt->rtsp_streams[i]->transport_priv; + int64_t queue_time = ff_rtp_queued_packet_time(rtpctx); + if (queue_time && (queue_time - first_queue_time < 0 || + !first_queue_time)) { + first_queue_time = queue_time; + first_queue_st = rt->rtsp_streams[i]; + } + } + if (first_queue_time) + wait_end = first_queue_time + s->max_delay; + } + /* read next RTP packet */ redo: + if (!rt->recvbuf) { + rt->recvbuf = av_malloc(RECVBUF_SIZE); + if (!rt->recvbuf) + return AVERROR(ENOMEM); + } + switch(rt->lower_transport) { default: #if CONFIG_RTSP_DEMUXER case RTSP_LOWER_TRANSPORT_TCP: - len = tcp_read_packet(s, &rtsp_st, buf, sizeof(buf)); + len = ff_rtsp_tcp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE); break; #endif case RTSP_LOWER_TRANSPORT_UDP: case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: - len = udp_read_packet(s, &rtsp_st, buf, sizeof(buf)); + len = udp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE, wait_end); if (len >=0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP) rtp_check_and_send_back_rr(rtsp_st->transport_priv, len); break; } + if (len == AVERROR(EAGAIN) && first_queue_st && + rt->transport == RTSP_TRANSPORT_RTP) { + rtsp_st = first_queue_st; + ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, NULL, 0); + goto end; + } if (len < 0) return len; if (len == 0) return AVERROR_EOF; if (rt->transport == RTSP_TRANSPORT_RDT) { - ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, buf, len); + ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); } else { - ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, buf, len); + ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); if (ret < 0) { /* Either bad packet, or a RTCP packet. Check if the * first_rtcp_ntp_time field was initialized. */ @@ -1809,14 +1593,24 @@ * as this one. */ int i; for (i = 0; i < rt->nb_rtsp_streams; i++) { - RTPDemuxContext *rtpctx2 = rtsp_st->transport_priv; + RTPDemuxContext *rtpctx2 = rt->rtsp_streams[i]->transport_priv; if (rtpctx2 && rtpctx2->first_rtcp_ntp_time == AV_NOPTS_VALUE) rtpctx2->first_rtcp_ntp_time = rtpctx->first_rtcp_ntp_time; } } + if (ret == -RTCP_BYE) { + rt->nb_byes++; + + av_log(s, AV_LOG_DEBUG, "Received BYE for stream %d (%d/%d)\n", + rtsp_st->stream_index, rt->nb_byes, rt->nb_rtsp_streams); + + if (rt->nb_byes == rt->nb_rtsp_streams) + return AVERROR_EOF; + } } } +end: if (ret < 0) goto redo; if (ret == 1) @@ -1825,176 +1619,17 @@ return ret; } +#endif /* CONFIG_RTPDEC */ -static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - RTSPState *rt = s->priv_data; - int ret; - RTSPMessageHeader reply1, *reply = &reply1; - char cmd[1024]; - - if (rt->server_type == RTSP_SERVER_REAL) { - int i; - enum AVDiscard cache[MAX_STREAMS]; - - for (i = 0; i < s->nb_streams; i++) - cache[i] = s->streams[i]->discard; - - if (!rt->need_subscription) { - if (memcmp (cache, rt->real_setup_cache, - sizeof(enum AVDiscard) * s->nb_streams)) { - snprintf(cmd, sizeof(cmd), - "Unsubscribe: %s\r\n", - rt->last_subscription); - ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri, - cmd, reply, NULL); - if (reply->status_code != RTSP_STATUS_OK) - return AVERROR_INVALIDDATA; - rt->need_subscription = 1; - } - } - - if (rt->need_subscription) { - int r, rule_nr, first = 1; - - memcpy(rt->real_setup_cache, cache, - sizeof(enum AVDiscard) * s->nb_streams); - rt->last_subscription[0] = 0; - - snprintf(cmd, sizeof(cmd), - "Subscribe: "); - for (i = 0; i < rt->nb_rtsp_streams; i++) { - rule_nr = 0; - for (r = 0; r < s->nb_streams; r++) { - if (s->streams[r]->priv_data == rt->rtsp_streams[i]) { - if (s->streams[r]->discard != AVDISCARD_ALL) { - if (!first) - av_strlcat(rt->last_subscription, ",", - sizeof(rt->last_subscription)); - ff_rdt_subscribe_rule( - rt->last_subscription, - sizeof(rt->last_subscription), i, rule_nr); - first = 0; - } - rule_nr++; - } - } - } - av_strlcatf(cmd, sizeof(cmd), "%s\r\n", rt->last_subscription); - ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri, - cmd, reply, NULL); - if (reply->status_code != RTSP_STATUS_OK) - return AVERROR_INVALIDDATA; - rt->need_subscription = 0; - - if (rt->state == RTSP_STATE_STREAMING) - rtsp_read_play (s); - } - } - - ret = rtsp_fetch_packet(s, pkt); - if (ret < 0) - return ret; - - /* send dummy request to keep TCP connection alive */ - if ((rt->server_type == RTSP_SERVER_WMS || - rt->server_type == RTSP_SERVER_REAL) && - (av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) { - if (rt->server_type == RTSP_SERVER_WMS) { - ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL); - } else { - ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL); - } - } - - return 0; -} - -/* pause the stream */ -static int rtsp_read_pause(AVFormatContext *s) -{ - RTSPState *rt = s->priv_data; - RTSPMessageHeader reply1, *reply = &reply1; - - if (rt->state != RTSP_STATE_STREAMING) - return 0; - else if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) { - ff_rtsp_send_cmd(s, "PAUSE", rt->control_uri, NULL, reply, NULL); - if (reply->status_code != RTSP_STATUS_OK) { - return -1; - } - } - rt->state = RTSP_STATE_PAUSED; - return 0; -} - -static int rtsp_read_seek(AVFormatContext *s, int stream_index, - int64_t timestamp, int flags) -{ - RTSPState *rt = s->priv_data; - - rt->seek_timestamp = av_rescale_q(timestamp, - s->streams[stream_index]->time_base, - AV_TIME_BASE_Q); - switch(rt->state) { - default: - case RTSP_STATE_IDLE: - break; - case RTSP_STATE_STREAMING: - if (rtsp_read_pause(s) != 0) - return -1; - rt->state = RTSP_STATE_SEEKING; - if (rtsp_read_play(s) != 0) - return -1; - break; - case RTSP_STATE_PAUSED: - rt->state = RTSP_STATE_IDLE; - break; - } - return 0; -} - -static int rtsp_read_close(AVFormatContext *s) -{ - RTSPState *rt = s->priv_data; - -#if 0 - /* NOTE: it is valid to flush the buffer here */ - if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) { - url_fclose(&rt->rtsp_gb); - } -#endif - ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL); - - ff_rtsp_close_streams(s); - ff_rtsp_close_connections(s); - ff_network_close(); - return 0; -} - -AVInputFormat rtsp_demuxer = { - "rtsp", - NULL_IF_CONFIG_SMALL("RTSP input format"), - sizeof(RTSPState), - rtsp_probe, - rtsp_read_header, - rtsp_read_packet, - rtsp_read_close, - rtsp_read_seek, - .flags = AVFMT_NOFILE, - .read_play = rtsp_read_play, - .read_pause = rtsp_read_pause, -}; -#endif - +#if CONFIG_SDP_DEMUXER static int sdp_probe(AVProbeData *p1) { const char *p = p1->buf, *p_end = p1->buf + p1->buf_size; - /* we look for a line beginning "c=IN IP4" */ + /* we look for a line beginning "c=IN IP" */ while (p < p_end && *p != '\0') { - if (p + sizeof("c=IN IP4") - 1 < p_end && - av_strstart(p, "c=IN IP4", NULL)) + if (p + sizeof("c=IN IP") - 1 < p_end && + av_strstart(p, "c=IN IP", NULL)) return AVPROBE_SCORE_MAX / 2; while (p < p_end - 1 && *p != '\n') p++; @@ -2027,15 +1662,18 @@ } content[size] ='\0'; - sdp_parse(s, content); + ff_sdp_parse(s, content); av_free(content); /* open each RTP stream */ for (i = 0; i < rt->nb_rtsp_streams; i++) { + char namebuf[50]; rtsp_st = rt->rtsp_streams[i]; + getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip), + namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, - inet_ntoa(rtsp_st->sdp_ip), rtsp_st->sdp_port, + namebuf, rtsp_st->sdp_port, "?localport=%d&ttl=%d", rtsp_st->sdp_port, rtsp_st->sdp_ttl); if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) { @@ -2065,6 +1703,113 @@ sizeof(RTSPState), sdp_probe, sdp_read_header, - rtsp_fetch_packet, + ff_rtsp_fetch_packet, + sdp_read_close, +}; +#endif /* CONFIG_SDP_DEMUXER */ + +#if CONFIG_RTP_DEMUXER +static int rtp_probe(AVProbeData *p) +{ + if (av_strstart(p->filename, "rtp:", NULL)) + return AVPROBE_SCORE_MAX; + return 0; +} + +static int rtp_read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + uint8_t recvbuf[1500]; + char host[500], sdp[500]; + int ret, port; + URLContext* in = NULL; + int payload_type; + AVCodecContext codec; + struct sockaddr_storage addr; + ByteIOContext pb; + socklen_t addrlen = sizeof(addr); + + if (!ff_network_init()) + return AVERROR(EIO); + + ret = url_open(&in, s->filename, URL_RDONLY); + if (ret) + goto fail; + + while (1) { + ret = url_read(in, recvbuf, sizeof(recvbuf)); + if (ret == AVERROR(EAGAIN)) + continue; + if (ret < 0) + goto fail; + if (ret < 12) { + av_log(s, AV_LOG_WARNING, "Received too short packet\n"); + continue; + } + + if ((recvbuf[0] & 0xc0) != 0x80) { + av_log(s, AV_LOG_WARNING, "Unsupported RTP version packet " + "received\n"); + continue; + } + + payload_type = recvbuf[1] & 0x7f; + break; + } + getsockname(url_get_file_handle(in), (struct sockaddr*) &addr, &addrlen); + url_close(in); + in = NULL; + + memset(&codec, 0, sizeof(codec)); + if (ff_rtp_get_codec_info(&codec, payload_type)) { + av_log(s, AV_LOG_ERROR, "Unable to receive RTP payload type %d " + "without an SDP file describing it\n", + payload_type); + goto fail; + } + if (codec.codec_type != AVMEDIA_TYPE_DATA) { + av_log(s, AV_LOG_WARNING, "Guessing on RTP content - if not received " + "properly you need an SDP file " + "describing it\n"); + } + + av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, + NULL, 0, s->filename); + + snprintf(sdp, sizeof(sdp), + "v=0\r\nc=IN IP%d %s\r\nm=%s %d RTP/AVP %d\r\n", + addr.ss_family == AF_INET ? 4 : 6, host, + codec.codec_type == AVMEDIA_TYPE_DATA ? "application" : + codec.codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio", + port, payload_type); + av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", sdp); + + init_put_byte(&pb, sdp, strlen(sdp), 0, NULL, NULL, NULL, NULL); + s->pb = &pb; + + /* sdp_read_header initializes this again */ + ff_network_close(); + + ret = sdp_read_header(s, ap); + s->pb = NULL; + return ret; + +fail: + if (in) + url_close(in); + ff_network_close(); + return ret; +} + +AVInputFormat rtp_demuxer = { + "rtp", + NULL_IF_CONFIG_SMALL("RTP input format"), + sizeof(RTSPState), + rtp_probe, + rtp_read_header, + ff_rtsp_fetch_packet, sdp_read_close, + .flags = AVFMT_NOFILE, }; +#endif /* CONFIG_RTP_DEMUXER */ + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtspdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtspdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtspdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtspdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,364 @@ +/* + * RTSP demuxer + * Copyright (c) 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/avstring.h" +#include "libavutil/intreadwrite.h" +#include "avformat.h" + +#include "internal.h" +#include "network.h" +#include "os_support.h" +#include "rtsp.h" +#include "rdt.h" + +//#define DEBUG +//#define DEBUG_RTP_TCP + +static int rtsp_read_play(AVFormatContext *s) +{ + RTSPState *rt = s->priv_data; + RTSPMessageHeader reply1, *reply = &reply1; + int i; + char cmd[1024]; + + av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state); + rt->nb_byes = 0; + + if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) { + if (rt->state == RTSP_STATE_PAUSED) { + cmd[0] = 0; + } else { + snprintf(cmd, sizeof(cmd), + "Range: npt=%0.3f-\r\n", + (double)rt->seek_timestamp / AV_TIME_BASE); + } + ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL); + if (reply->status_code != RTSP_STATUS_OK) { + return -1; + } + if (rt->transport == RTSP_TRANSPORT_RTP) { + for (i = 0; i < rt->nb_rtsp_streams; i++) { + RTSPStream *rtsp_st = rt->rtsp_streams[i]; + RTPDemuxContext *rtpctx = rtsp_st->transport_priv; + AVStream *st = NULL; + if (!rtpctx) + continue; + if (rtsp_st->stream_index >= 0) + st = s->streams[rtsp_st->stream_index]; + ff_rtp_reset_packet_queue(rtpctx); + if (reply->range_start != AV_NOPTS_VALUE) { + rtpctx->last_rtcp_ntp_time = AV_NOPTS_VALUE; + rtpctx->first_rtcp_ntp_time = AV_NOPTS_VALUE; + if (st) + rtpctx->range_start_offset = + av_rescale_q(reply->range_start, AV_TIME_BASE_Q, + st->time_base); + } + } + } + } + rt->state = RTSP_STATE_STREAMING; + return 0; +} + +int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply) +{ + RTSPState *rt = s->priv_data; + char cmd[1024]; + unsigned char *content = NULL; + int ret; + + /* describe the stream */ + snprintf(cmd, sizeof(cmd), + "Accept: application/sdp\r\n"); + if (rt->server_type == RTSP_SERVER_REAL) { + /** + * The Require: attribute is needed for proper streaming from + * Realmedia servers. + */ + av_strlcat(cmd, + "Require: com.real.retain-entity-for-setup\r\n", + sizeof(cmd)); + } + ff_rtsp_send_cmd(s, "DESCRIBE", rt->control_uri, cmd, reply, &content); + if (!content) + return AVERROR_INVALIDDATA; + if (reply->status_code != RTSP_STATUS_OK) { + av_freep(&content); + return AVERROR_INVALIDDATA; + } + + av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", content); + /* now we got the SDP description, we parse it */ + ret = ff_sdp_parse(s, (const char *)content); + av_freep(&content); + if (ret < 0) + return AVERROR_INVALIDDATA; + + return 0; +} + +static int rtsp_probe(AVProbeData *p) +{ + if (av_strstart(p->filename, "rtsp:", NULL)) + return AVPROBE_SCORE_MAX; + return 0; +} + +static int rtsp_read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + RTSPState *rt = s->priv_data; + int ret; + + ret = ff_rtsp_connect(s); + if (ret) + return ret; + + rt->real_setup_cache = av_mallocz(2 * s->nb_streams * sizeof(*rt->real_setup_cache)); + if (!rt->real_setup_cache) + return AVERROR(ENOMEM); + rt->real_setup = rt->real_setup_cache + s->nb_streams * sizeof(*rt->real_setup); + + if (ap->initial_pause) { + /* do not start immediately */ + } else { + if (rtsp_read_play(s) < 0) { + ff_rtsp_close_streams(s); + ff_rtsp_close_connections(s); + return AVERROR_INVALIDDATA; + } + } + + return 0; +} + +int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, + uint8_t *buf, int buf_size) +{ + RTSPState *rt = s->priv_data; + int id, len, i, ret; + RTSPStream *rtsp_st; + +#ifdef DEBUG_RTP_TCP + dprintf(s, "tcp_read_packet:\n"); +#endif +redo: + for (;;) { + RTSPMessageHeader reply; + + ret = ff_rtsp_read_reply(s, &reply, NULL, 1); + if (ret < 0) + return ret; + if (ret == 1) /* received '$' */ + break; + /* XXX: parse message */ + if (rt->state != RTSP_STATE_STREAMING) + return 0; + } + ret = url_read_complete(rt->rtsp_hd, buf, 3); + if (ret != 3) + return -1; + id = buf[0]; + len = AV_RB16(buf + 1); +#ifdef DEBUG_RTP_TCP + dprintf(s, "id=%d len=%d\n", id, len); +#endif + if (len > buf_size || len < 12) + goto redo; + /* get the data */ + ret = url_read_complete(rt->rtsp_hd, buf, len); + if (ret != len) + return -1; + if (rt->transport == RTSP_TRANSPORT_RDT && + ff_rdt_parse_header(buf, len, &id, NULL, NULL, NULL, NULL) < 0) + return -1; + + /* find the matching stream */ + for (i = 0; i < rt->nb_rtsp_streams; i++) { + rtsp_st = rt->rtsp_streams[i]; + if (id >= rtsp_st->interleaved_min && + id <= rtsp_st->interleaved_max) + goto found; + } + goto redo; +found: + *prtsp_st = rtsp_st; + return len; +} +static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + RTSPState *rt = s->priv_data; + int ret; + RTSPMessageHeader reply1, *reply = &reply1; + char cmd[1024]; + + if (rt->server_type == RTSP_SERVER_REAL) { + int i; + + for (i = 0; i < s->nb_streams; i++) + rt->real_setup[i] = s->streams[i]->discard; + + if (!rt->need_subscription) { + if (memcmp (rt->real_setup, rt->real_setup_cache, + sizeof(enum AVDiscard) * s->nb_streams)) { + snprintf(cmd, sizeof(cmd), + "Unsubscribe: %s\r\n", + rt->last_subscription); + ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri, + cmd, reply, NULL); + if (reply->status_code != RTSP_STATUS_OK) + return AVERROR_INVALIDDATA; + rt->need_subscription = 1; + } + } + + if (rt->need_subscription) { + int r, rule_nr, first = 1; + + memcpy(rt->real_setup_cache, rt->real_setup, + sizeof(enum AVDiscard) * s->nb_streams); + rt->last_subscription[0] = 0; + + snprintf(cmd, sizeof(cmd), + "Subscribe: "); + for (i = 0; i < rt->nb_rtsp_streams; i++) { + rule_nr = 0; + for (r = 0; r < s->nb_streams; r++) { + if (s->streams[r]->priv_data == rt->rtsp_streams[i]) { + if (s->streams[r]->discard != AVDISCARD_ALL) { + if (!first) + av_strlcat(rt->last_subscription, ",", + sizeof(rt->last_subscription)); + ff_rdt_subscribe_rule( + rt->last_subscription, + sizeof(rt->last_subscription), i, rule_nr); + first = 0; + } + rule_nr++; + } + } + } + av_strlcatf(cmd, sizeof(cmd), "%s\r\n", rt->last_subscription); + ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri, + cmd, reply, NULL); + if (reply->status_code != RTSP_STATUS_OK) + return AVERROR_INVALIDDATA; + rt->need_subscription = 0; + + if (rt->state == RTSP_STATE_STREAMING) + rtsp_read_play (s); + } + } + + ret = ff_rtsp_fetch_packet(s, pkt); + if (ret < 0) + return ret; + + /* send dummy request to keep TCP connection alive */ + if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) { + if (rt->server_type == RTSP_SERVER_WMS) { + ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL); + } else { + ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL); + } + } + + return 0; +} + +/* pause the stream */ +static int rtsp_read_pause(AVFormatContext *s) +{ + RTSPState *rt = s->priv_data; + RTSPMessageHeader reply1, *reply = &reply1; + + if (rt->state != RTSP_STATE_STREAMING) + return 0; + else if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) { + ff_rtsp_send_cmd(s, "PAUSE", rt->control_uri, NULL, reply, NULL); + if (reply->status_code != RTSP_STATUS_OK) { + return -1; + } + } + rt->state = RTSP_STATE_PAUSED; + return 0; +} + +static int rtsp_read_seek(AVFormatContext *s, int stream_index, + int64_t timestamp, int flags) +{ + RTSPState *rt = s->priv_data; + + rt->seek_timestamp = av_rescale_q(timestamp, + s->streams[stream_index]->time_base, + AV_TIME_BASE_Q); + switch(rt->state) { + default: + case RTSP_STATE_IDLE: + break; + case RTSP_STATE_STREAMING: + if (rtsp_read_pause(s) != 0) + return -1; + rt->state = RTSP_STATE_SEEKING; + if (rtsp_read_play(s) != 0) + return -1; + break; + case RTSP_STATE_PAUSED: + rt->state = RTSP_STATE_IDLE; + break; + } + return 0; +} + +static int rtsp_read_close(AVFormatContext *s) +{ + RTSPState *rt = s->priv_data; + +#if 0 + /* NOTE: it is valid to flush the buffer here */ + if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) { + url_fclose(&rt->rtsp_gb); + } +#endif + ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL); + + ff_rtsp_close_streams(s); + ff_rtsp_close_connections(s); + ff_network_close(); + rt->real_setup = NULL; + av_freep(&rt->real_setup_cache); + return 0; +} + +AVInputFormat rtsp_demuxer = { + "rtsp", + NULL_IF_CONFIG_SMALL("RTSP input format"), + sizeof(RTSPState), + rtsp_probe, + rtsp_read_header, + rtsp_read_packet, + rtsp_read_close, + rtsp_read_seek, + .flags = AVFMT_NOFILE, + .read_play = rtsp_read_play, + .read_pause = rtsp_read_pause, +}; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtspenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtspenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtspenc.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtspenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -29,6 +29,73 @@ #include "rtsp.h" #include "internal.h" #include "libavutil/intreadwrite.h" +#include "libavutil/avstring.h" + +#define SDP_MAX_SIZE 16384 + +int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) +{ + RTSPState *rt = s->priv_data; + RTSPMessageHeader reply1, *reply = &reply1; + int i; + char *sdp; + AVFormatContext sdp_ctx, *ctx_array[1]; + + s->start_time_realtime = av_gettime(); + + /* Announce the stream */ + sdp = av_mallocz(SDP_MAX_SIZE); + if (sdp == NULL) + return AVERROR(ENOMEM); + /* We create the SDP based on the RTSP AVFormatContext where we + * aren't allowed to change the filename field. (We create the SDP + * based on the RTSP context since the contexts for the RTP streams + * don't exist yet.) In order to specify a custom URL with the actual + * peer IP instead of the originally specified hostname, we create + * a temporary copy of the AVFormatContext, where the custom URL is set. + * + * FIXME: Create the SDP without copying the AVFormatContext. + * This either requires setting up the RTP stream AVFormatContexts + * already here (complicating things immensely) or getting a more + * flexible SDP creation interface. + */ + sdp_ctx = *s; + ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename), + "rtsp", NULL, addr, -1, NULL); + ctx_array[0] = &sdp_ctx; + if (avf_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) { + av_free(sdp); + return AVERROR_INVALIDDATA; + } + av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", sdp); + ff_rtsp_send_cmd_with_content(s, "ANNOUNCE", rt->control_uri, + "Content-Type: application/sdp\r\n", + reply, NULL, sdp, strlen(sdp)); + av_free(sdp); + if (reply->status_code != RTSP_STATUS_OK) + return AVERROR_INVALIDDATA; + + /* Set up the RTSPStreams for each AVStream */ + for (i = 0; i < s->nb_streams; i++) { + RTSPStream *rtsp_st; + AVStream *st = s->streams[i]; + + rtsp_st = av_mallocz(sizeof(RTSPStream)); + if (!rtsp_st) + return AVERROR(ENOMEM); + dynarray_add(&rt->rtsp_streams, &rt->nb_rtsp_streams, rtsp_st); + + st->priv_data = rtsp_st; + rtsp_st->stream_index = i; + + av_strlcpy(rtsp_st->control_url, rt->control_uri, sizeof(rtsp_st->control_url)); + /* Note, this must match the relative uri set in the sdp content */ + av_strlcatf(rtsp_st->control_url, sizeof(rtsp_st->control_url), + "/streamid=%d", i); + } + + return 0; +} static int rtsp_write_record(AVFormatContext *s) { @@ -85,7 +152,7 @@ size -= 4; if (packet_len > size || packet_len < 2) break; - if (ptr[1] >= 200 && ptr[1] <= 204) + if (ptr[1] >= RTCP_SR && ptr[1] <= RTCP_APP) id = rtsp_st->interleaved_max; /* RTCP */ else id = rtsp_st->interleaved_min; /* RTP */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtsp.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtsp.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/rtsp.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/rtsp.h 2010-11-06 17:21:29.000000000 +0000 @@ -96,7 +96,8 @@ * packets will be allowed to make before being discarded. */ int ttl; - uint32_t destination; /**< destination IP address */ + struct sockaddr_storage destination; /**< destination IP address */ + char source[INET6_ADDRSTRLEN + 1]; /**< source IP address */ /** data/packet transport protocol; e.g. RTP or RDT */ enum RTSPTransport transport; @@ -267,7 +268,11 @@ /** stream setup during the last frame read. This is used to detect if * we need to subscribe or unsubscribe to any new streams. */ - enum AVDiscard real_setup_cache[MAX_STREAMS]; + enum AVDiscard *real_setup_cache; + + /** current stream setup. This is a temporary buffer used to compare + * current setup to previous frame setup. */ + enum AVDiscard *real_setup; /** the last value of the "SET_PARAMETER Subscribe:" RTSP command. * this is used to send the same "Unsubscribe:" if stream setup changed, @@ -290,15 +295,20 @@ * other cases, this is a copy of AVFormatContext->filename. */ char control_uri[1024]; - /** The synchronized start time of the output streams. */ - int64_t start_time; - /** Additional output handle, used when input and output are done * separately, eg for HTTP tunneling. */ URLContext *rtsp_hd_out; /** RTSP transport mode, such as plain or tunneled. */ enum RTSPControlTransport control_transport; + + /* Number of RTCP BYE packets the RTSP session has received. + * An EOF is propagated back if nb_byes == nb_streams. + * This is reset after a seek. */ + int nb_byes; + + /** Reusable buffer for receiving packets */ + uint8_t* recvbuf; } RTSPState; /** @@ -323,7 +333,7 @@ /** The following are used only in SDP, not RTSP */ //@{ int sdp_port; /**< port (from SDP content) */ - struct in_addr sdp_ip; /**< IP address (from SDP content) */ + struct sockaddr_storage sdp_ip; /**< IP address (from SDP content) */ int sdp_ttl; /**< IP Time-To-Live (from SDP content) */ int sdp_payload_type; /**< payload type */ //@} @@ -341,9 +351,6 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf, HTTPAuthState *auth_state); -#if LIBAVFORMAT_VERSION_INT < (53 << 16) -extern int rtsp_default_protocols; -#endif extern int rtsp_rtp_port_min; extern int rtsp_rtp_port_max; @@ -461,4 +468,34 @@ */ void ff_rtsp_close_connections(AVFormatContext *rt); +/** + * Get the description of the stream and set up the RTSPStream child + * objects. + */ +int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply); + +/** + * Announce the stream to the server and set up the RTSPStream child + * objects for each media stream. + */ +int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr); + +/** + * Parse a SDP description of streams by populating an RTSPState struct + * within the AVFormatContext. + */ +int ff_sdp_parse(AVFormatContext *s, const char *content); + +/** + * Receive one RTP packet from an TCP interleaved RTSP stream. + */ +int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, + uint8_t *buf, int buf_size); + +/** + * Receive one packet from the RTSPStreams set up in the AVFormatContext + * (which should contain a RTSPState struct as priv_data). + */ +int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt); + #endif /* AVFORMAT_RTSP_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/sapdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/sapdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/sapdec.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/sapdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,239 @@ +/* + * Session Announcement Protocol (RFC 2974) demuxer + * Copyright (c) 2010 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "libavutil/avstring.h" +#include "libavutil/intreadwrite.h" +#include "network.h" +#include "os_support.h" +#include "internal.h" +#if HAVE_SYS_SELECT_H +#include +#endif +#include + +struct SAPState { + URLContext *ann_fd; + AVFormatContext *sdp_ctx; + ByteIOContext sdp_pb; + uint16_t hash; + char *sdp; + int eof; +}; + +static int sap_probe(AVProbeData *p) +{ + if (av_strstart(p->filename, "sap:", NULL)) + return AVPROBE_SCORE_MAX; + return 0; +} + +static int sap_read_close(AVFormatContext *s) +{ + struct SAPState *sap = s->priv_data; + if (sap->sdp_ctx) + av_close_input_stream(sap->sdp_ctx); + if (sap->ann_fd) + url_close(sap->ann_fd); + av_freep(&sap->sdp); + ff_network_close(); + return 0; +} + +static int sap_read_header(AVFormatContext *s, + AVFormatParameters *ap) +{ + struct SAPState *sap = s->priv_data; + char host[1024], path[1024], url[1024]; + uint8_t recvbuf[1500]; + int port; + int ret, i; + AVInputFormat* infmt; + + if (!ff_network_init()) + return AVERROR(EIO); + + av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, + path, sizeof(path), s->filename); + if (port < 0) + port = 9875; + + if (!host[0]) { + /* Listen for announcements on sap.mcast.net if no host was specified */ + av_strlcpy(host, "224.2.127.254", sizeof(host)); + } + + ff_url_join(url, sizeof(url), "udp", NULL, host, port, "?localport=%d", + port); + ret = url_open(&sap->ann_fd, url, URL_RDONLY); + if (ret) + goto fail; + + while (1) { + int addr_type, auth_len; + int pos; + + ret = url_read(sap->ann_fd, recvbuf, sizeof(recvbuf) - 1); + if (ret == AVERROR(EAGAIN)) + continue; + if (ret < 0) + goto fail; + recvbuf[ret] = '\0'; /* Null terminate for easier parsing */ + if (ret < 8) { + av_log(s, AV_LOG_WARNING, "Received too short packet\n"); + continue; + } + + if ((recvbuf[0] & 0xe0) != 0x20) { + av_log(s, AV_LOG_WARNING, "Unsupported SAP version packet " + "received\n"); + continue; + } + + if (recvbuf[0] & 0x04) { + av_log(s, AV_LOG_WARNING, "Received stream deletion " + "announcement\n"); + continue; + } + addr_type = recvbuf[0] & 0x10; + auth_len = recvbuf[1]; + sap->hash = AV_RB16(&recvbuf[2]); + pos = 4; + if (addr_type) + pos += 16; /* IPv6 */ + else + pos += 4; /* IPv4 */ + pos += auth_len * 4; + if (pos + 4 >= ret) { + av_log(s, AV_LOG_WARNING, "Received too short packet\n"); + continue; + } +#define MIME "application/sdp" + if (strcmp(&recvbuf[pos], MIME) == 0) { + pos += strlen(MIME) + 1; + } else if (strncmp(&recvbuf[pos], "v=0\r\n", 5) == 0) { + // Direct SDP without a mime type + } else { + av_log(s, AV_LOG_WARNING, "Unsupported mime type %s\n", + &recvbuf[pos]); + continue; + } + + sap->sdp = av_strdup(&recvbuf[pos]); + break; + } + + av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", sap->sdp); + init_put_byte(&sap->sdp_pb, sap->sdp, strlen(sap->sdp), 0, NULL, NULL, + NULL, NULL); + + infmt = av_find_input_format("sdp"); + if (!infmt) + goto fail; + sap->sdp_ctx = avformat_alloc_context(); + if (!sap->sdp_ctx) { + ret = AVERROR(ENOMEM); + goto fail; + } + sap->sdp_ctx->max_delay = s->max_delay; + ap->prealloced_context = 1; + ret = av_open_input_stream(&sap->sdp_ctx, &sap->sdp_pb, "temp.sdp", + infmt, ap); + if (ret < 0) + goto fail; + if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER) + s->ctx_flags |= AVFMTCTX_NOHEADER; + for (i = 0; i < sap->sdp_ctx->nb_streams; i++) { + AVStream *st = av_new_stream(s, i); + if (!st) { + ret = AVERROR(ENOMEM); + goto fail; + } + avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); + st->time_base = sap->sdp_ctx->streams[i]->time_base; + } + + return 0; + +fail: + sap_read_close(s); + return ret; +} + +static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt) +{ + struct SAPState *sap = s->priv_data; + int fd = url_get_file_handle(sap->ann_fd); + int n, ret; + fd_set rfds; + struct timeval tv; + uint8_t recvbuf[1500]; + + if (sap->eof) + return AVERROR_EOF; + + while (1) { + FD_ZERO(&rfds); + FD_SET(fd, &rfds); + tv.tv_sec = tv.tv_usec = 0; + n = select(fd + 1, &rfds, NULL, NULL, &tv); + if (n <= 0 || !FD_ISSET(fd, &rfds)) + break; + ret = url_read(sap->ann_fd, recvbuf, sizeof(recvbuf)); + if (ret >= 8) { + uint16_t hash = AV_RB16(&recvbuf[2]); + /* Should ideally check the source IP address, too */ + if (recvbuf[0] & 0x04 && hash == sap->hash) { + /* Stream deletion */ + sap->eof = 1; + return AVERROR_EOF; + } + } + } + ret = av_read_frame(sap->sdp_ctx, pkt); + if (ret < 0) + return ret; + if (s->ctx_flags & AVFMTCTX_NOHEADER) { + while (sap->sdp_ctx->nb_streams > s->nb_streams) { + int i = s->nb_streams; + AVStream *st = av_new_stream(s, i); + if (!st) { + av_free_packet(pkt); + return AVERROR(ENOMEM); + } + avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); + st->time_base = sap->sdp_ctx->streams[i]->time_base; + } + } + return ret; +} + +AVInputFormat sap_demuxer = { + "sap", + NULL_IF_CONFIG_SMALL("SAP input format"), + sizeof(struct SAPState), + sap_probe, + sap_read_header, + sap_fetch_packet, + sap_read_close, + .flags = AVFMT_NOFILE, +}; + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/sapenc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/sapenc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/sapenc.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/sapenc.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,266 @@ +/* + * Session Announcement Protocol (RFC 2974) muxer + * Copyright (c) 2010 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "libavutil/random_seed.h" +#include "libavutil/avstring.h" +#include "libavutil/intreadwrite.h" +#include "internal.h" +#include "network.h" +#include "os_support.h" +#include "rtpenc_chain.h" + +struct SAPState { + uint8_t *ann; + int ann_size; + URLContext *ann_fd; + int64_t last_time; +}; + +static int sap_write_close(AVFormatContext *s) +{ + struct SAPState *sap = s->priv_data; + int i; + + for (i = 0; i < s->nb_streams; i++) { + AVFormatContext *rtpctx = s->streams[i]->priv_data; + if (!rtpctx) + continue; + av_write_trailer(rtpctx); + url_fclose(rtpctx->pb); + av_metadata_free(&rtpctx->streams[0]->metadata); + av_metadata_free(&rtpctx->metadata); + av_free(rtpctx->streams[0]); + av_free(rtpctx); + s->streams[i]->priv_data = NULL; + } + + if (sap->last_time && sap->ann && sap->ann_fd) { + sap->ann[0] |= 4; /* Session deletion*/ + url_write(sap->ann_fd, sap->ann, sap->ann_size); + } + + av_freep(&sap->ann); + if (sap->ann_fd) + url_close(sap->ann_fd); + ff_network_close(); + return 0; +} + +static int sap_write_header(AVFormatContext *s) +{ + struct SAPState *sap = s->priv_data; + char host[1024], path[1024], url[1024], announce_addr[50] = ""; + char *option_list; + int port = 9875, base_port = 5004, i, pos = 0, same_port = 0, ttl = 255; + AVFormatContext **contexts = NULL; + int ret = 0; + struct sockaddr_storage localaddr; + socklen_t addrlen = sizeof(localaddr); + int udp_fd; + + if (!ff_network_init()) + return AVERROR(EIO); + + /* extract hostname and port */ + av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &base_port, + path, sizeof(path), s->filename); + if (base_port < 0) + base_port = 5004; + + /* search for options */ + option_list = strrchr(path, '?'); + if (option_list) { + char buf[50]; + if (find_info_tag(buf, sizeof(buf), "announce_port", option_list)) { + port = strtol(buf, NULL, 10); + } + if (find_info_tag(buf, sizeof(buf), "same_port", option_list)) { + same_port = strtol(buf, NULL, 10); + } + if (find_info_tag(buf, sizeof(buf), "ttl", option_list)) { + ttl = strtol(buf, NULL, 10); + } + if (find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) { + av_strlcpy(announce_addr, buf, sizeof(announce_addr)); + } + } + + if (!announce_addr[0]) { + struct addrinfo hints, *ai = NULL; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + if (getaddrinfo(host, NULL, &hints, &ai)) { + av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host); + ret = AVERROR(EIO); + goto fail; + } + if (ai->ai_family == AF_INET) { + /* Also known as sap.mcast.net */ + av_strlcpy(announce_addr, "224.2.127.254", sizeof(announce_addr)); +#if HAVE_STRUCT_SOCKADDR_IN6 + } else if (ai->ai_family == AF_INET6) { + /* With IPv6, you can use the same destination in many different + * multicast subnets, to choose how far you want it routed. + * This one is intended to be routed globally. */ + av_strlcpy(announce_addr, "ff0e::2:7ffe", sizeof(announce_addr)); +#endif + } else { + freeaddrinfo(ai); + av_log(s, AV_LOG_ERROR, "Host %s resolved to unsupported " + "address family\n", host); + ret = AVERROR(EIO); + goto fail; + } + freeaddrinfo(ai); + } + + contexts = av_mallocz(sizeof(AVFormatContext*) * s->nb_streams); + if (!contexts) { + ret = AVERROR(ENOMEM); + goto fail; + } + + s->start_time_realtime = av_gettime(); + for (i = 0; i < s->nb_streams; i++) { + URLContext *fd; + + ff_url_join(url, sizeof(url), "rtp", NULL, host, base_port, + "?ttl=%d", ttl); + if (!same_port) + base_port += 2; + ret = url_open(&fd, url, URL_WRONLY); + if (ret) { + ret = AVERROR(EIO); + goto fail; + } + s->streams[i]->priv_data = contexts[i] = + ff_rtp_chain_mux_open(s, s->streams[i], fd, 0); + av_strlcpy(contexts[i]->filename, url, sizeof(contexts[i]->filename)); + } + + ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port, + "?ttl=%d&connect=1", ttl); + ret = url_open(&sap->ann_fd, url, URL_WRONLY); + if (ret) { + ret = AVERROR(EIO); + goto fail; + } + + udp_fd = url_get_file_handle(sap->ann_fd); + if (getsockname(udp_fd, (struct sockaddr*) &localaddr, &addrlen)) { + ret = AVERROR(EIO); + goto fail; + } + if (localaddr.ss_family != AF_INET +#if HAVE_STRUCT_SOCKADDR_IN6 + && localaddr.ss_family != AF_INET6 +#endif + ) { + av_log(s, AV_LOG_ERROR, "Unsupported protocol family\n"); + ret = AVERROR(EIO); + goto fail; + } + sap->ann_size = 8192; + sap->ann = av_mallocz(sap->ann_size); + if (!sap->ann) { + ret = AVERROR(EIO); + goto fail; + } + sap->ann[pos] = (1 << 5); +#if HAVE_STRUCT_SOCKADDR_IN6 + if (localaddr.ss_family == AF_INET6) + sap->ann[pos] |= 0x10; +#endif + pos++; + sap->ann[pos++] = 0; /* Authentication length */ + AV_WB16(&sap->ann[pos], av_get_random_seed()); + pos += 2; + if (localaddr.ss_family == AF_INET) { + memcpy(&sap->ann[pos], &((struct sockaddr_in*)&localaddr)->sin_addr, + sizeof(struct in_addr)); + pos += sizeof(struct in_addr); +#if HAVE_STRUCT_SOCKADDR_IN6 + } else { + memcpy(&sap->ann[pos], &((struct sockaddr_in6*)&localaddr)->sin6_addr, + sizeof(struct in6_addr)); + pos += sizeof(struct in6_addr); +#endif + } + + av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos); + pos += strlen(&sap->ann[pos]) + 1; + + if (avf_sdp_create(contexts, s->nb_streams, &sap->ann[pos], + sap->ann_size - pos)) { + ret = AVERROR_INVALIDDATA; + goto fail; + } + av_freep(&contexts); + av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", &sap->ann[pos]); + pos += strlen(&sap->ann[pos]); + sap->ann_size = pos; + + if (sap->ann_size > url_get_max_packet_size(sap->ann_fd)) { + av_log(s, AV_LOG_ERROR, "Announcement too large to send in one " + "packet\n"); + goto fail; + } + + return 0; + +fail: + av_free(contexts); + sap_write_close(s); + return ret; +} + +static int sap_write_packet(AVFormatContext *s, AVPacket *pkt) +{ + AVFormatContext *rtpctx; + struct SAPState *sap = s->priv_data; + int64_t now = av_gettime(); + + if (!sap->last_time || now - sap->last_time > 5000000) { + int ret = url_write(sap->ann_fd, sap->ann, sap->ann_size); + /* Don't abort even if we get "Destination unreachable" */ + if (ret < 0 && ret != FF_NETERROR(ECONNREFUSED)) + return ret; + sap->last_time = now; + } + rtpctx = s->streams[pkt->stream_index]->priv_data; + return ff_write_chained(rtpctx, 0, pkt, s); +} + +AVOutputFormat sap_muxer = { + "sap", + NULL_IF_CONFIG_SMALL("SAP output format"), + NULL, + NULL, + sizeof(struct SAPState), + CODEC_ID_AAC, + CODEC_ID_MPEG4, + sap_write_header, + sap_write_packet, + sap_write_close, + .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER, +}; + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/sdp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/sdp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/sdp.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/sdp.c 2010-11-06 17:21:29.000000000 +0000 @@ -44,17 +44,24 @@ int ttl; /**< TTL, in case of multicast stream */ const char *user; /**< username of the session's creator */ const char *src_addr; /**< IP address of the machine from which the session was created */ + const char *src_type; /**< address type of src_addr */ const char *dst_addr; /**< destination IP address (can be multicast) */ + const char *dst_type; /**< destination IP address type */ const char *name; /**< session name (can be an empty string) */ }; -static void sdp_write_address(char *buff, int size, const char *dest_addr, int ttl) +static void sdp_write_address(char *buff, int size, const char *dest_addr, + const char *dest_type, int ttl) { if (dest_addr) { - if (ttl > 0) { - av_strlcatf(buff, size, "c=IN IP4 %s/%d\r\n", dest_addr, ttl); + if (!dest_type) + dest_type = "IP4"; + if (ttl > 0 && !strcmp(dest_type, "IP4")) { + /* The TTL should only be specified for IPv4 multicast addresses, + * not for IPv6. */ + av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type, dest_addr, ttl); } else { - av_strlcatf(buff, size, "c=IN IP4 %s\r\n", dest_addr); + av_strlcatf(buff, size, "c=IN %s %s\r\n", dest_type, dest_addr); } } } @@ -62,45 +69,49 @@ static void sdp_write_header(char *buff, int size, struct sdp_session_level *s) { av_strlcatf(buff, size, "v=%d\r\n" - "o=- %d %d IN IP4 %s\r\n" + "o=- %d %d IN %s %s\r\n" "s=%s\r\n", s->sdp_version, - s->id, s->version, s->src_addr, + s->id, s->version, s->src_type, s->src_addr, s->name); - sdp_write_address(buff, size, s->dst_addr, s->ttl); + sdp_write_address(buff, size, s->dst_addr, s->dst_type, s->ttl); av_strlcatf(buff, size, "t=%d %d\r\n" "a=tool:libavformat " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\r\n", s->start_time, s->end_time); } #if CONFIG_NETWORK -static void resolve_destination(char *dest_addr, int size) +static int resolve_destination(char *dest_addr, int size, char *type, + int type_size) { - struct addrinfo hints, *ai, *cur; + struct addrinfo hints, *ai; + int is_multicast; + av_strlcpy(type, "IP4", type_size); if (!dest_addr[0]) - return; + return 0; /* Resolve the destination, since it must be written * as a numeric IP address in the SDP. */ memset(&hints, 0, sizeof(hints)); - /* We only support IPv4 addresses in the SDP at the moment. */ - hints.ai_family = AF_INET; if (getaddrinfo(dest_addr, NULL, &hints, &ai)) - return; - for (cur = ai; cur; cur = cur->ai_next) { - if (cur->ai_family == AF_INET) { - getnameinfo(cur->ai_addr, cur->ai_addrlen, dest_addr, size, - NULL, 0, NI_NUMERICHOST); - break; - } - } + return 0; + getnameinfo(ai->ai_addr, ai->ai_addrlen, dest_addr, size, + NULL, 0, NI_NUMERICHOST); +#ifdef AF_INET6 + if (ai->ai_family == AF_INET6) + av_strlcpy(type, "IP6", type_size); +#endif + is_multicast = ff_is_multicast_address(ai->ai_addr); freeaddrinfo(ai); + return is_multicast; } #else -static void resolve_destination(char *dest_addr, int size) +static int resolve_destination(char *dest_addr, int size, char *type, + int type_size) { + return 0; } #endif @@ -124,14 +135,11 @@ p = strchr(url, '?'); if (p) { char buff[64]; - int is_multicast = find_info_tag(buff, sizeof(buff), "multicast", p); - if (is_multicast) { - if (find_info_tag(buff, sizeof(buff), "ttl", p)) { - *ttl = strtol(buff, NULL, 10); - } else { - *ttl = 5; - } + if (find_info_tag(buff, sizeof(buff), "ttl", p)) { + *ttl = strtol(buff, NULL, 10); + } else { + *ttl = 5; } } @@ -267,9 +275,9 @@ config[0] = config[1] = config[2] = 0; config[3] = 1; - config[4] = 0xfe; // ident must match the one in rtpenc_xiph.c - config[5] = 0xcd; - config[6] = 0xba; + config[4] = (RTP_XIPH_IDENT >> 16) & 0xff; + config[5] = (RTP_XIPH_IDENT >> 8) & 0xff; + config[6] = (RTP_XIPH_IDENT ) & 0xff; config[7] = (headers_len >> 8) & 0xff; config[8] = headers_len & 0xff; config[9] = 2; @@ -412,6 +420,16 @@ c->width, c->height, pix_fmt, config); break; } + case CODEC_ID_VP8: + av_strlcatf(buff, size, "a=rtpmap:%d VP8/90000\r\n", + payload_type); + break; + case CODEC_ID_ADPCM_G722: + if (payload_type >= RTP_PT_PRIVATE) + av_strlcatf(buff, size, "a=rtpmap:%d G722/%d/%d\r\n", + payload_type, + 8000, c->channels); + break; default: /* Nothing special to do here... */ break; @@ -422,7 +440,7 @@ return buff; } -void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, int port, int ttl) +void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl) { const char *type; int payload_type; @@ -440,7 +458,7 @@ } av_strlcatf(buff, size, "m=%s %d RTP/AVP %d\r\n", type, port, payload_type); - sdp_write_address(buff, size, dest_addr, ttl); + sdp_write_address(buff, size, dest_addr, dest_type, ttl); if (c->bit_rate) { av_strlcatf(buff, size, "b=AS:%d\r\n", c->bit_rate / 1000); } @@ -452,23 +470,32 @@ { AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0); struct sdp_session_level s; - int i, j, port, ttl; - char dst[32]; + int i, j, port, ttl, is_multicast; + char dst[32], dst_type[5]; memset(buff, 0, size); memset(&s, 0, sizeof(struct sdp_session_level)); s.user = "-"; s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */ + s.src_type = "IP4"; s.name = title ? title->value : "No Name"; port = 0; ttl = 0; if (n_files == 1) { port = sdp_get_address(dst, sizeof(dst), &ttl, ac[0]->filename); - resolve_destination(dst, sizeof(dst)); + is_multicast = resolve_destination(dst, sizeof(dst), dst_type, + sizeof(dst_type)); + if (!is_multicast) + ttl = 0; if (dst[0]) { s.dst_addr = dst; + s.dst_type = dst_type; s.ttl = ttl; + if (!strcmp(dst_type, "IP6")) { + s.src_addr = "::1"; + s.src_type = "IP6"; + } } } sdp_write_header(buff, size, &s); @@ -477,12 +504,15 @@ for (i = 0; i < n_files; i++) { if (n_files != 1) { port = sdp_get_address(dst, sizeof(dst), &ttl, ac[i]->filename); - resolve_destination(dst, sizeof(dst)); + is_multicast = resolve_destination(dst, sizeof(dst), dst_type, + sizeof(dst_type)); + if (!is_multicast) + ttl = 0; } for (j = 0; j < ac[i]->nb_streams; j++) { ff_sdp_write_media(buff, size, ac[i]->streams[j]->codec, dst[0] ? dst : NULL, - (port > 0) ? port + j * 2 : 0, ttl); + dst_type, (port > 0) ? port + j * 2 : 0, ttl); if (port <= 0) { av_strlcatf(buff, size, "a=control:streamid=%d\r\n", i + j); @@ -498,8 +528,7 @@ return AVERROR(ENOSYS); } -void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, - const char *dest_addr, int port, int ttl) +void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl) { } #endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/sol.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/sol.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/sol.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/sol.c 2010-11-06 17:21:29.000000000 +0000 @@ -25,7 +25,7 @@ #include "libavutil/bswap.h" #include "avformat.h" -#include "raw.h" +#include "pcm.h" /* if we don't know the size in advance */ #define AU_UNKNOWN_SIZE ((uint32_t)(~0)) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/soxdec.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/soxdec.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/soxdec.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/soxdec.c 2010-11-06 17:21:29.000000000 +0000 @@ -31,7 +31,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" -#include "raw.h" +#include "pcm.h" #include "sox.h" static int sox_probe(AVProbeData *p) diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/tcp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/tcp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/tcp.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/tcp.c 2010-11-06 17:21:29.000000000 +0000 @@ -38,7 +38,7 @@ struct addrinfo hints, *ai, *cur_ai; int port, fd = -1; TCPContext *s = NULL; - fd_set wfds; + fd_set wfds, efds; int fd_max, ret; struct timeval tv; socklen_t optlen; @@ -54,8 +54,13 @@ hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; snprintf(portstr, sizeof(portstr), "%d", port); - if (getaddrinfo(hostname, portstr, &hints, &ai)) + ret = getaddrinfo(hostname, portstr, &hints, &ai); + if (ret) { + av_log(NULL, AV_LOG_ERROR, + "Failed to resolve hostname %s: %s\n", + hostname, gai_strerror(ret)); return AVERROR(EIO); + } cur_ai = ai; @@ -82,19 +87,25 @@ } fd_max = fd; FD_ZERO(&wfds); + FD_ZERO(&efds); FD_SET(fd, &wfds); + FD_SET(fd, &efds); tv.tv_sec = 0; tv.tv_usec = 100 * 1000; - ret = select(fd_max + 1, NULL, &wfds, NULL, &tv); - if (ret > 0 && FD_ISSET(fd, &wfds)) + ret = select(fd_max + 1, NULL, &wfds, &efds, &tv); + if (ret > 0 && (FD_ISSET(fd, &wfds) || FD_ISSET(fd, &efds))) break; } /* test error */ optlen = sizeof(ret); getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen); - if (ret != 0) + if (ret != 0) { + av_log(NULL, AV_LOG_ERROR, + "TCP connection to %s:%d failed: %s\n", + hostname, port, strerror(ret)); goto fail; + } } s = av_malloc(sizeof(TCPContext)); if (!s) { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/tta.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/tta.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/tta.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/tta.c 2010-11-06 17:21:29.000000000 +0000 @@ -21,7 +21,6 @@ #include "libavcodec/get_bits.h" #include "avformat.h" -#include "id3v2.h" #include "id3v1.h" typedef struct { @@ -32,12 +31,6 @@ { const uint8_t *d = p->buf; - if (ff_id3v2_match(d, ID3v2_DEFAULT_MAGIC)) - d += ff_id3v2_tag_len(d); - - if (d - p->buf >= p->buf_size) - return 0; - if (d[0] == 'T' && d[1] == 'T' && d[2] == 'A' && d[3] == '1') return 80; return 0; @@ -50,7 +43,6 @@ int i, channels, bps, samplerate, datalen, framelen; uint64_t framepos, start_offset; - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC); if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/tty.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/tty.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/tty.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/tty.c 2010-11-06 17:21:29.000000000 +0000 @@ -75,7 +75,7 @@ if (!st) return AVERROR(ENOMEM); st->codec->codec_tag = 0; - st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_ANSI; if (ap->width) st->codec->width = ap->width; if (ap->height) st->codec->height = ap->height; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/udp.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/udp.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/udp.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/udp.c 2010-11-06 17:21:29.000000000 +0000 @@ -25,6 +25,7 @@ */ #define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */ +#define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */ #include "avformat.h" #include #include "internal.h" @@ -39,12 +40,6 @@ #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP #endif -#ifndef IN_MULTICAST -#define IN_MULTICAST(a) ((((uint32_t)(a)) & 0xf0000000) == 0xe0000000) -#endif -#ifndef IN6_IS_ADDR_MULTICAST -#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff) -#endif typedef struct { int udp_fd; @@ -55,6 +50,7 @@ int reuse_socket; struct sockaddr_storage dest_addr; int dest_addr_len; + int is_connected; } UDPContext; #define UDP_TX_BUF_SIZE 32768 @@ -96,7 +92,7 @@ } } #endif -#if HAVE_STRUCT_IPV6_MREQ +#if HAVE_STRUCT_IPV6_MREQ && defined(IPPROTO_IPV6) if (addr->sa_family == AF_INET6) { struct ipv6_mreq mreq6; @@ -125,7 +121,7 @@ } } #endif -#if HAVE_STRUCT_IPV6_MREQ +#if HAVE_STRUCT_IPV6_MREQ && defined(IPPROTO_IPV6) if (addr->sa_family == AF_INET6) { struct ipv6_mreq mreq6; @@ -182,20 +178,6 @@ return addr_len; } -static int is_multicast_address(struct sockaddr_storage *addr) -{ - if (addr->ss_family == AF_INET) { - return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr)); - } -#if HAVE_STRUCT_SOCKADDR_IN6 - if (addr->ss_family == AF_INET6) { - return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr); - } -#endif - - return 0; -} - static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr, int *addr_len) { @@ -273,7 +255,7 @@ if (s->dest_addr_len < 0) { return AVERROR(EIO); } - s->is_multicast = is_multicast_address(&s->dest_addr); + s->is_multicast = ff_is_multicast_address((struct sockaddr*) &s->dest_addr); return 0; } @@ -294,7 +276,7 @@ * streams at the same time. * @param h media file context */ -#if (LIBAVFORMAT_VERSION_MAJOR >= 53) +#if !FF_API_UDP_GET_FILE static #endif int udp_get_file_handle(URLContext *h) @@ -344,6 +326,9 @@ if (find_info_tag(buf, sizeof(buf), "buffer_size", p)) { s->buffer_size = strtol(buf, NULL, 10); } + if (find_info_tag(buf, sizeof(buf), "connect", p)) { + s->is_connected = strtol(buf, NULL, 10); + } } /* fill the dest addr */ @@ -412,6 +397,12 @@ /* make the socket non-blocking */ ff_socket_nonblock(udp_fd, 1); } + if (s->is_connected) { + if (connect(udp_fd, (struct sockaddr *) &s->dest_addr, s->dest_addr_len)) { + av_log(NULL, AV_LOG_ERROR, "connect: %s\n", strerror(errno)); + goto fail; + } + } s->udp_fd = udp_fd; return 0; @@ -463,13 +454,16 @@ int ret; for(;;) { - ret = sendto (s->udp_fd, buf, size, 0, - (struct sockaddr *) &s->dest_addr, - s->dest_addr_len); + if (!s->is_connected) { + ret = sendto (s->udp_fd, buf, size, 0, + (struct sockaddr *) &s->dest_addr, + s->dest_addr_len); + } else + ret = send(s->udp_fd, buf, size, 0); if (ret < 0) { if (ff_neterrno() != FF_NETERROR(EINTR) && ff_neterrno() != FF_NETERROR(EAGAIN)) - return AVERROR(EIO); + return ff_neterrno(); } else { break; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/utils.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/utils.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/utils.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/utils.c 2010-11-06 17:21:29.000000000 +0000 @@ -21,8 +21,9 @@ #include "avformat.h" #include "internal.h" #include "libavcodec/internal.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" #include "metadata.h" +#include "id3v2.h" #include "libavutil/avstring.h" #include "riff.h" #include "audiointerleave.h" @@ -109,8 +110,14 @@ } /** head of registered input format linked list */ +#if !FF_API_FIRST_FORMAT +static +#endif AVInputFormat *first_iformat = NULL; /** head of registered output format linked list */ +#if !FF_API_FIRST_FORMAT +static +#endif AVOutputFormat *first_oformat = NULL; AVInputFormat *av_iformat_next(AVInputFormat *f) @@ -188,7 +195,7 @@ return !strcasecmp(name, names); } -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_GUESS_FORMAT AVOutputFormat *guess_format(const char *short_name, const char *filename, const char *mime_type) { @@ -233,7 +240,7 @@ return fmt_found; } -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_GUESS_FORMAT AVOutputFormat *guess_stream_format(const char *short_name, const char *filename, const char *mime_type) { @@ -283,7 +290,7 @@ return NULL; } -#if LIBAVFORMAT_VERSION_MAJOR < 53 && CONFIG_SHARED && HAVE_SYMVER +#if FF_API_SYMVER && CONFIG_SHARED && HAVE_SYMVER FF_SYMVER(void, av_destruct_packet_nofree, (AVPacket *pkt), "LIBAVFORMAT_52") { av_destruct_packet_nofree(pkt); @@ -343,18 +350,27 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max) { + AVProbeData lpd = *pd; AVInputFormat *fmt1, *fmt; int score; + if (lpd.buf_size > 10 && ff_id3v2_match(lpd.buf, ID3v2_DEFAULT_MAGIC)) { + int id3len = ff_id3v2_tag_len(lpd.buf); + if (lpd.buf_size > id3len + 16) { + lpd.buf += id3len; + lpd.buf_size -= id3len; + } + } + fmt = NULL; for(fmt1 = first_iformat; fmt1 != NULL; fmt1 = fmt1->next) { if (!is_opened == !(fmt1->flags & AVFMT_NOFILE)) continue; score = 0; if (fmt1->read_probe) { - score = fmt1->read_probe(pd); + score = fmt1->read_probe(&lpd); } else if (fmt1->extensions) { - if (av_match_ext(pd->filename, fmt1->extensions)) { + if (av_match_ext(lpd.filename, fmt1->extensions)) { score = 50; } } @@ -448,6 +464,10 @@ ic->priv_data = NULL; } + // e.g. AVFMT_NOFILE formats will not have a ByteIOContext + if (ic->pb) + ff_id3v2_read(ic, ID3v2_DEFAULT_MAGIC); + if (ic->iformat->read_header) { err = ic->iformat->read_header(ic, ap); if (err < 0) @@ -457,7 +477,7 @@ if (pb && !ic->data_offset) ic->data_offset = url_ftell(ic->pb); -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_OLD_METADATA ff_metadata_demux_compat(ic); #endif @@ -474,6 +494,8 @@ if (st) { av_free(st->priv_data); av_free(st->codec->extradata); + av_free(st->codec); + av_free(st->info); } av_free(st); } @@ -1163,10 +1185,6 @@ }else if(st->need_parsing == AVSTREAM_PARSE_FULL_ONCE){ st->parser->flags |= PARSER_FLAG_ONCE; } - if(st->parser && (s->iformat->flags & AVFMT_GENERIC_INDEX)){ - st->parser->next_frame_offset= - st->parser->cur_offset= st->cur_pkt.pos; - } } } } @@ -1876,7 +1894,7 @@ AVPacket pkt1, *pkt = &pkt1; AVStream *st; int read_size, i, ret; - int64_t end_time, start_time[MAX_STREAMS]; + int64_t end_time; int64_t filesize, offset, duration; int retry=0; @@ -1885,13 +1903,9 @@ /* flush packet queue */ flush_packet_queue(ic); - for(i=0;inb_streams;i++) { + for (i=0; inb_streams; i++) { st = ic->streams[i]; - if(st->start_time != AV_NOPTS_VALUE){ - start_time[i]= st->start_time; - }else if(st->first_dts != AV_NOPTS_VALUE){ - start_time[i]= st->first_dts; - }else + if (st->start_time == AV_NOPTS_VALUE && st->first_dts == AV_NOPTS_VALUE) av_log(st->codec, AV_LOG_WARNING, "start time is not set in av_estimate_timings_from_pts\n"); if (st->parser) { @@ -1924,9 +1938,11 @@ read_size += pkt->size; st = ic->streams[pkt->stream_index]; if (pkt->pts != AV_NOPTS_VALUE && - start_time[pkt->stream_index] != AV_NOPTS_VALUE) { - end_time = pkt->pts; - duration = end_time - start_time[pkt->stream_index]; + (st->start_time != AV_NOPTS_VALUE || + st->first_dts != AV_NOPTS_VALUE)) { + duration = end_time = pkt->pts; + if (st->start_time != AV_NOPTS_VALUE) duration -= st->start_time; + else duration -= st->first_dts; if (duration < 0) duration += 1LL<pts_wrap_bits; if (duration > 0) { @@ -1944,7 +1960,7 @@ fill_all_stream_timings(ic); url_fseek(ic->pb, old_offset, SEEK_SET); - for(i=0; inb_streams; i++){ + for (i=0; inb_streams; i++) { st= ic->streams[i]; st->cur_dts= st->first_dts; st->last_IP_pts = AV_NOPTS_VALUE; @@ -2134,7 +2150,6 @@ } } -#define MAX_STD_TIMEBASES (60*12+5) static int get_std_framerate(int i){ if(i<60*12) return i*1001; else return ((const int[]){24,30,60,12,15})[i-60*12]*1000*12; @@ -2165,17 +2180,10 @@ int i, count, ret, read_size, j; AVStream *st; AVPacket pkt1, *pkt; - int64_t last_dts[MAX_STREAMS]; - int64_t duration_gcd[MAX_STREAMS]={0}; - int duration_count[MAX_STREAMS]={0}; - double (*duration_error)[MAX_STD_TIMEBASES]; int64_t old_offset = url_ftell(ic->pb); - int64_t codec_info_duration[MAX_STREAMS]={0}; - - duration_error = av_mallocz(MAX_STREAMS * sizeof(*duration_error)); - if (!duration_error) return AVERROR(ENOMEM); for(i=0;inb_streams;i++) { + AVCodec *codec; st = ic->streams[i]; if (st->codec->codec_id == CODEC_ID_AAC) { st->codec->sample_rate = 0; @@ -2196,16 +2204,24 @@ } } assert(!st->codec->codec); + codec = avcodec_find_decoder(st->codec->codec_id); + + /* Force decoding of at least one frame of codec data + * this makes sure the codec initializes the channel configuration + * and does not trust the values from the container. + */ + if (codec && codec->capabilities & CODEC_CAP_CHANNEL_CONF) + st->codec->channels = 0; + //try to just open decoders, in case this is enough to get parameters if(!has_codec_parameters(st->codec)){ - AVCodec *codec = avcodec_find_decoder(st->codec->codec_id); if (codec) avcodec_open(st->codec, codec); } } - for(i=0;inb_streams; i++) { + ic->streams[i]->info->last_dts = AV_NOPTS_VALUE; } count = 0; @@ -2224,7 +2240,7 @@ break; /* variable fps and no guess at the real fps */ if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num) - && duration_count[i]<20 && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) + && st->info->duration_count<20 && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) break; if(st->parser && st->parser->parser->split && !st->codec->extradata) break; @@ -2252,9 +2268,7 @@ /* NOTE: a new stream can be added there if no header in file (AVFMTCTX_NOHEADER) */ ret = av_read_frame_internal(ic, &pkt1); - if(ret == AVERROR(EAGAIN)) - continue; - if (ret < 0) { + if (ret < 0 && ret != AVERROR(EAGAIN)) { /* EOF or error */ ret = -1; /* we could not have all the codec parameters before EOF */ for(i=0;inb_streams;i++) { @@ -2270,25 +2284,25 @@ break; } + if (ret == AVERROR(EAGAIN)) + continue; + pkt= add_to_pktbuf(&ic->packet_buffer, &pkt1, &ic->packet_buffer_end); - if(av_dup_packet(pkt) < 0) { - av_free(duration_error); - return AVERROR(ENOMEM); - } + if ((ret = av_dup_packet(pkt)) < 0) + goto find_stream_info_err; read_size += pkt->size; st = ic->streams[pkt->stream_index]; - if(st->codec_info_nb_frames>1) { - if (st->time_base.den > 0 && av_rescale_q(codec_info_duration[st->index], st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration){ + if (st->codec_info_nb_frames>1) { + if (st->time_base.den > 0 && av_rescale_q(st->info->codec_info_duration, st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration) { av_log(ic, AV_LOG_WARNING, "max_analyze_duration reached\n"); break; } - codec_info_duration[st->index] += pkt->duration; + st->info->codec_info_duration += pkt->duration; } { - int index= pkt->stream_index; - int64_t last= last_dts[index]; + int64_t last = st->info->last_dts; int64_t duration= pkt->dts - last; if(pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && duration>0){ @@ -2296,21 +2310,21 @@ // if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO) // av_log(NULL, AV_LOG_ERROR, "%f\n", dur); - if(duration_count[index] < 2) - memset(duration_error[index], 0, sizeof(*duration_error)); - for(i=1; iinfo->duration_count < 2) + memset(st->info->duration_error, 0, sizeof(st->info->duration_error)); + for (i=1; iinfo->duration_error); i++) { int framerate= get_std_framerate(i); int ticks= lrintf(dur*framerate/(1001*12)); double error= dur - ticks*1001*12/(double)framerate; - duration_error[index][i] += error*error; + st->info->duration_error[i] += error*error; } - duration_count[index]++; + st->info->duration_count++; // ignore the first 4 values, they might have some random jitter - if (duration_count[index] > 3) - duration_gcd[index] = av_gcd(duration_gcd[index], duration); + if (st->info->duration_count > 3) + st->info->duration_gcd = av_gcd(st->info->duration_gcd, duration); } - if(last == AV_NOPTS_VALUE || duration_count[index]<=1) - last_dts[pkt->stream_index]= pkt->dts; + if (last == AV_NOPTS_VALUE || st->info->duration_count <= 1) + st->info->last_dts = pkt->dts; } if(st->parser && st->parser->parser->split && !st->codec->extradata){ int i= st->parser->parser->split(st->codec, pkt->data, pkt->size); @@ -2341,10 +2355,10 @@ } for(i=0;inb_streams;i++) { st = ic->streams[i]; - if(st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && codec_info_duration[i]) + if (st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && st->info->codec_info_duration) av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, (st->codec_info_nb_frames-2)*(int64_t)st->time_base.den, - codec_info_duration[i] *(int64_t)st->time_base.num, 60000); + st->info->codec_info_duration*(int64_t)st->time_base.num, 60000); if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample) st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); @@ -2352,18 +2366,18 @@ // the check for tb_unreliable() is not completely correct, since this is not about handling // a unreliable/inexact time base, but a time base that is finer than necessary, as e.g. // ipmovie.c produces. - if (tb_unreliable(st->codec) && duration_count[i] > 15 && duration_gcd[i] > 1 && !st->r_frame_rate.num) - av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * duration_gcd[i], INT_MAX); - if(duration_count[i] && !st->r_frame_rate.num + if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > 1 && !st->r_frame_rate.num) + av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX); + if (st->info->duration_count && !st->r_frame_rate.num && tb_unreliable(st->codec) /*&& //FIXME we should not special-case MPEG-2, but this needs testing with non-MPEG-2 ... - st->time_base.num*duration_sum[i]/duration_count[i]*101LL > st->time_base.den*/){ + st->time_base.num*duration_sum[i]/st->info->duration_count*101LL > st->time_base.den*/){ int num = 0; double best_error= 2*av_q2d(st->time_base); - best_error= best_error*best_error*duration_count[i]*1000*12*30; + best_error = best_error*best_error*st->info->duration_count*1000*12*30; - for(j=1; jinfo->duration_error); j++) { + double error = st->info->duration_error[j] * get_std_framerate(j); // if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO) // av_log(NULL, AV_LOG_ERROR, "%f %f\n", get_std_framerate(j) / 12.0/1001, error); if(error < best_error){ @@ -2421,8 +2435,9 @@ } #endif - av_free(duration_error); - + find_stream_info_err: + for (i=0; i < ic->nb_streams; i++) + av_freep(&ic->streams[i]->info); return ret; } @@ -2464,14 +2479,15 @@ av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec); -#if LIBAVFORMAT_VERSION_INT < (53<<16) +#if FF_API_OLD_METADATA av_free(st->filename); #endif av_free(st->priv_data); + av_free(st->info); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { -#if LIBAVFORMAT_VERSION_INT < (53<<16) +#if FF_API_OLD_METADATA av_freep(&s->programs[i]->provider_name); av_freep(&s->programs[i]->name); #endif @@ -2483,7 +2499,7 @@ flush_packet_queue(s); av_freep(&s->priv_data); while(s->nb_chapters--) { -#if LIBAVFORMAT_VERSION_INT < (53<<16) +#if FF_API_OLD_METADATA av_free(s->chapters[s->nb_chapters]->title); #endif av_metadata_free(&s->chapters[s->nb_chapters]->metadata); @@ -2491,6 +2507,7 @@ } av_freep(&s->chapters); av_metadata_free(&s->metadata); + av_freep(&s->key); av_free(s); } @@ -2507,14 +2524,29 @@ AVStream *st; int i; +#if FF_API_MAX_STREAMS if (s->nb_streams >= MAX_STREAMS){ av_log(s, AV_LOG_ERROR, "Too many streams\n"); return NULL; } +#else + AVStream **streams; + + if (s->nb_streams >= INT_MAX/sizeof(*streams)) + return NULL; + streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); + if (!streams) + return NULL; + s->streams = streams; +#endif st = av_mallocz(sizeof(AVStream)); if (!st) return NULL; + if (!(st->info = av_mallocz(sizeof(*st->info)))) { + av_free(st); + return NULL; + } st->codec= avcodec_alloc_context(); if (s->iformat) { @@ -2586,7 +2618,7 @@ return NULL; dynarray_add(&s->chapters, &s->nb_chapters, chapter); } -#if LIBAVFORMAT_VERSION_INT < (53<<16) +#if FF_API_OLD_METADATA av_free(chapter->title); #endif av_metadata_set2(&chapter->metadata, "title", title, 0); @@ -2703,8 +2735,8 @@ char tagbuf[32]; av_get_codec_tag_string(tagbuf, sizeof(tagbuf), st->codec->codec_tag); av_log(s, AV_LOG_ERROR, - "Tag %s/0x%08x incompatible with output codec '%s'\n", - tagbuf, st->codec->codec_tag, st->codec->codec->name); + "Tag %s/0x%08x incompatible with output codec id '%d'\n", + tagbuf, st->codec->codec_tag, st->codec->codec_id); return AVERROR_INVALIDDATA; } }else @@ -2722,22 +2754,13 @@ return AVERROR(ENOMEM); } -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_OLD_METADATA ff_metadata_mux_compat(s); #endif /* set muxer identification string */ if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { - AVMetadata *m; - AVMetadataTag *t; - - if (!(m = av_mallocz(sizeof(AVMetadata)))) - return AVERROR(ENOMEM); - av_metadata_set2(&m, "encoder", LIBAVFORMAT_IDENT, 0); - metadata_conv(&m, s->oformat->metadata_conv, NULL); - if ((t = av_metadata_get(m, "", NULL, AV_METADATA_IGNORE_SUFFIX))) - av_metadata_set2(&s->metadata, t->key, t->value, 0); - av_metadata_free(&m); + av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); } if(s->oformat->write_header){ @@ -3142,7 +3165,7 @@ int secs, us; av_log(NULL, AV_LOG_INFO, ", start: "); secs = ic->start_time / AV_TIME_BASE; - us = ic->start_time % AV_TIME_BASE; + us = abs(ic->start_time % AV_TIME_BASE); av_log(NULL, AV_LOG_INFO, "%d.%06d", secs, (int)av_rescale(us, 1000000, AV_TIME_BASE)); } @@ -3186,7 +3209,7 @@ av_free(printed); } -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_PARSE_FRAME_PARAM #include "libavcore/parseutils.h" int parse_image_size(int *width_ptr, int *height_ptr, const char *str) @@ -3363,8 +3386,8 @@ } p++; } - *q = '\0'; } + *q = '\0'; if (!strcmp(tag, tag1)) return 1; if (*p != '&') @@ -3505,7 +3528,7 @@ pkt_dump_internal(avcl, NULL, level, pkt, dump_payload); } -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_URL_SPLIT attribute_deprecated void ff_url_split(char *proto, int proto_size, char *authorization, int authorization_size, @@ -3605,6 +3628,34 @@ return buff; } +int ff_hex_to_data(uint8_t *data, const char *p) +{ + int c, len, v; + + len = 0; + v = 1; + for (;;) { + p += strspn(p, SPACE_CHARS); + if (*p == '\0') + break; + c = toupper((unsigned char) *p++); + if (c >= '0' && c <= '9') + c = c - '0'; + else if (c >= 'A' && c <= 'F') + c = c - 'A' + 10; + else + break; + v = (v << 4) | c; + if (v & 0x100) { + if (data) + data[len] = v; + len++; + v = 1; + } + } + return len; +} + void av_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den) { @@ -3683,3 +3734,57 @@ return av_write_frame(dst, &local_pkt); } +void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, + void *context) +{ + const char *ptr = str; + + /* Parse key=value pairs. */ + for (;;) { + const char *key; + char *dest = NULL, *dest_end; + int key_len, dest_len = 0; + + /* Skip whitespace and potential commas. */ + while (*ptr && (isspace(*ptr) || *ptr == ',')) + ptr++; + if (!*ptr) + break; + + key = ptr; + + if (!(ptr = strchr(key, '='))) + break; + ptr++; + key_len = ptr - key; + + callback_get_buf(context, key, key_len, &dest, &dest_len); + dest_end = dest + dest_len - 1; + + if (*ptr == '\"') { + ptr++; + while (*ptr && *ptr != '\"') { + if (*ptr == '\\') { + if (!ptr[1]) + break; + if (dest && dest < dest_end) + *dest++ = ptr[1]; + ptr += 2; + } else { + if (dest && dest < dest_end) + *dest++ = *ptr; + ptr++; + } + } + if (*ptr == '\"') + ptr++; + } else { + for (; *ptr && !(isspace(*ptr) || *ptr == ','); ptr++) + if (dest && dest < dest_end) + *dest++ = *ptr; + } + if (dest) + *dest = 0; + } +} + diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/vorbiscomment.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/vorbiscomment.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/vorbiscomment.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/vorbiscomment.c 2010-11-06 17:21:29.000000000 +0000 @@ -32,6 +32,7 @@ const AVMetadataConv ff_vorbiscomment_metadata_conv[] = { { "ALBUMARTIST", "album_artist"}, { "TRACKNUMBER", "track" }, + { "DISCNUMBER", "disc" }, { 0 } }; @@ -43,7 +44,7 @@ *count = 0; if (m) { AVMetadataTag *tag = NULL; - while ( (tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX) ) ) { + while ((tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) { len += 4 +strlen(tag->key) + 1 + strlen(tag->value); (*count)++; } @@ -51,15 +52,15 @@ return len; } -int ff_vorbiscomment_write(uint8_t **p, AVMetadata *m, +int ff_vorbiscomment_write(uint8_t **p, AVMetadata **m, const char *vendor_string, const unsigned count) { bytestream_put_le32(p, strlen(vendor_string)); bytestream_put_buffer(p, vendor_string, strlen(vendor_string)); - if (m) { + if (*m) { AVMetadataTag *tag = NULL; bytestream_put_le32(p, count); - while ( (tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX) ) ) { + while ((tag = av_metadata_get(*m, "", tag, AV_METADATA_IGNORE_SUFFIX))) { unsigned int len1 = strlen(tag->key); unsigned int len2 = strlen(tag->value); bytestream_put_le32(p, len1+1+len2); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/vorbiscomment.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/vorbiscomment.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/vorbiscomment.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/vorbiscomment.h 2010-11-06 17:21:29.000000000 +0000 @@ -49,7 +49,7 @@ * @param vendor_string The vendor string to write. * @param count The number of tags in m because m->count is "not allowed" */ -int ff_vorbiscomment_write(uint8_t **p, AVMetadata *m, +int ff_vorbiscomment_write(uint8_t **p, AVMetadata **m, const char *vendor_string, const unsigned count); extern const AVMetadataConv ff_vorbiscomment_metadata_conv[]; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/wav.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/wav.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavformat/wav.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavformat/wav.c 2010-11-06 17:21:29.000000000 +0000 @@ -23,7 +23,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" -#include "raw.h" +#include "pcm.h" #include "riff.h" typedef struct { diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/arm/cpu.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/arm/cpu.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/arm/cpu.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/arm/cpu.c 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,25 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/cpu.h" +#include "config.h" + +int ff_get_cpu_flags_arm(void) +{ + return HAVE_IWMMXT * AV_CPU_FLAG_IWMMXT; +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/arm/intreadwrite.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/arm/intreadwrite.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/arm/intreadwrite.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/arm/intreadwrite.h 2010-11-06 17:21:29.000000000 +0000 @@ -25,9 +25,9 @@ #if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM #define AV_RN16 AV_RN16 -static av_always_inline uint16_t AV_RN16(const void *p) +static av_always_inline unsigned AV_RN16(const void *p) { - uint16_t v; + unsigned v; __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)p)); return v; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/avassert.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/avassert.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/avassert.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/avassert.h 2010-11-06 17:21:29.000000000 +0000 @@ -0,0 +1,66 @@ +/* + * copyright (c) 2010 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple assert() macros that are a bit more flexible than ISO C assert(). + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_AVASSERT_H +#define AVUTIL_AVASSERT_H + +#include +#include "avutil.h" +#include "log.h" + +/** + * assert() equivalent, that is always enabled. + */ +#define av_assert0(cond) do { \ + if (!(cond)) { \ + av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \ + AV_STRINGIFY(cond), __FILE__, __LINE__); \ + abort(); \ + } \ +} while (0) + + +/** + * assert() equivalent, that does not lie in speed critical code. + * These asserts() thus can be enabled without fearing speedloss. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 +#define av_assert1(cond) av_assert0(cond) +#else +#define av_assert1(cond) ((void)0) +#endif + + +/** + * assert() equivalent, that does lie in speed critical code. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2(cond) av_assert0(cond) +#else +#define av_assert2(cond) ((void)0) +#endif + +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/avstring.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/avstring.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/avstring.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/avstring.c 2010-11-06 17:21:30.000000000 +0000 @@ -97,3 +97,91 @@ if(str) snprintf(str, 16, "%f", d); return str; } + +#define WHITESPACES " \n\t" + +char *av_get_token(const char **buf, const char *term) +{ + char *out = av_malloc(strlen(*buf) + 1); + char *ret= out, *end= out; + const char *p = *buf; + if (!out) return NULL; + p += strspn(p, WHITESPACES); + + while(*p && !strspn(p, term)) { + char c = *p++; + if(c == '\\' && *p){ + *out++ = *p++; + end= out; + }else if(c == '\''){ + while(*p && *p != '\'') + *out++ = *p++; + if(*p){ + p++; + end= out; + } + }else{ + *out++ = c; + } + } + + do{ + *out-- = 0; + }while(out >= end && strspn(out, WHITESPACES)); + + *buf = p; + + return ret; +} + +#ifdef TEST + +#undef printf + +int main(void) +{ + int i; + + printf("Testing av_get_token()\n"); + { + const char *strings[] = { + "''", + "", + ":", + "\\", + "'", + " '' :", + " '' '' :", + "foo '' :", + "'foo'", + "foo ", + " ' foo ' ", + "foo\\", + "foo': blah:blah", + "foo\\: blah:blah", + "foo\'", + "'foo : ' :blahblah", + "\\ :blah", + " foo", + " foo ", + " foo \\ ", + "foo ':blah", + " foo bar : blahblah", + "\\f\\o\\o", + "'foo : \\ \\ ' : blahblah", + "'\\fo\\o:': blahblah", + "\\'fo\\o\\:': foo ' :blahblah" + }; + + for (i=0; i < FF_ARRAY_ELEMS(strings); i++) { + const char *p= strings[i]; + printf("|%s|", p); + printf(" -> |%s|", av_get_token(&p, ":")); + printf(" + |%s|\n", p); + } + } + + return 0; +} + +#endif /* TEST */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/avstring.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/avstring.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/avstring.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/avstring.h 2010-11-06 17:21:30.000000000 +0000 @@ -114,4 +114,20 @@ */ char *av_d2str(double d); +/** + * Unescape the given string until a non escaped terminating char, + * and return the token corresponding to the unescaped string. + * + * The normal \ and ' escaping is supported. Leading and trailing + * whitespaces are removed, unless they are escaped with '\' or are + * enclosed between ''. + * + * @param buf the buffer to parse, buf will be updated to point to the + * terminating char + * @param term a 0-terminated list of terminating chars + * @return the malloced unescaped string, which must be av_freed by + * the user, NULL in case of allocation failure + */ +char *av_get_token(const char **buf, const char *term); + #endif /* AVUTIL_AVSTRING_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/avutil.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/avutil.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/avutil.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/avutil.h 2010-11-06 17:21:30.000000000 +0000 @@ -40,8 +40,8 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 50 -#define LIBAVUTIL_VERSION_MINOR 23 -#define LIBAVUTIL_VERSION_MICRO 0 +#define LIBAVUTIL_VERSION_MINOR 32 +#define LIBAVUTIL_VERSION_MICRO 6 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ @@ -78,6 +78,13 @@ AVMEDIA_TYPE_NB }; +#define FF_LAMBDA_SHIFT 7 +#define FF_LAMBDA_SCALE (1< #include #include "attributes.h" +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif //rounded division & shift #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) @@ -185,6 +192,20 @@ return av_log2((x - 1) << 1); } +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static inline av_const int av_popcount_c(uint32_t x) +{ + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0F0F0F0F; + x += x >> 8; + return (x + (x >> 16)) & 0x3F; +} + #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24)) #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((a) << 24)) @@ -344,3 +365,6 @@ #ifndef av_clipf # define av_clipf av_clipf_c #endif +#ifndef av_popcount +# define av_popcount av_popcount_c +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/cpu.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/cpu.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/cpu.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/cpu.c 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "cpu.h" +#include "config.h" + +int av_get_cpu_flags(void) +{ + static int flags, checked; + + if (checked) + return flags; + + if (ARCH_ARM) flags = ff_get_cpu_flags_arm(); + if (ARCH_PPC) flags = ff_get_cpu_flags_ppc(); + if (ARCH_X86) flags = ff_get_cpu_flags_x86(); + + checked = 1; + return flags; +} + +#ifdef TEST + +#undef printf + +int main(void) +{ + int cpu_flags = av_get_cpu_flags(); + + printf("cpu_flags = 0x%08X\n", cpu_flags); + printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s\n", +#if ARCH_ARM + cpu_flags & AV_CPU_FLAG_IWMMXT ? "IWMMXT " : "", +#elif ARCH_PPC + cpu_flags & AV_CPU_FLAG_ALTIVEC ? "ALTIVEC " : "", +#elif ARCH_X86 + cpu_flags & AV_CPU_FLAG_MMX ? "MMX " : "", + cpu_flags & AV_CPU_FLAG_MMX2 ? "MMX2 " : "", + cpu_flags & AV_CPU_FLAG_SSE ? "SSE " : "", + cpu_flags & AV_CPU_FLAG_SSE2 ? "SSE2 " : "", + cpu_flags & AV_CPU_FLAG_SSE2SLOW ? "SSE2(slow) " : "", + cpu_flags & AV_CPU_FLAG_SSE3 ? "SSE3 " : "", + cpu_flags & AV_CPU_FLAG_SSE3SLOW ? "SSE3(slow) " : "", + cpu_flags & AV_CPU_FLAG_SSSE3 ? "SSSE3 " : "", + cpu_flags & AV_CPU_FLAG_SSE4 ? "SSE4.1 " : "", + cpu_flags & AV_CPU_FLAG_SSE42 ? "SSE4.2 " : "", + cpu_flags & AV_CPU_FLAG_3DNOW ? "3DNow " : "", + cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt " : ""); +#endif + return 0; +} + +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/cpu.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/cpu.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/cpu.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/cpu.h 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CPU_H +#define AVUTIL_CPU_H + +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ + + /* lower 16 bits - CPU features */ +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_IWMMXT 0x0100 ///< XScale IWMMXT +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard + +/** + * Return the flags which specify extensions supported by the CPU. + */ +int av_get_cpu_flags(void); + +/* The following CPU-specific functions shall not be called directly. */ +int ff_get_cpu_flags_arm(void); +int ff_get_cpu_flags_ppc(void); +int ff_get_cpu_flags_x86(void); + +#endif /* AVUTIL_CPU_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/eval.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/eval.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/eval.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/eval.c 2010-11-06 17:21:30.000000000 +0000 @@ -103,19 +103,22 @@ return d; } +#define IS_IDENTIFIER_CHAR(c) ((c) - '0' <= 9U || (c) - 'a' <= 25U || (c) - 'A' <= 25U || (c) == '_') + static int strmatch(const char *s, const char *prefix) { int i; for (i=0; prefix[i]; i++) { if (prefix[i] != s[i]) return 0; } - return 1; + /* return 1 only if the s identifier is terminated */ + return !IS_IDENTIFIER_CHAR(s[i]); } struct AVExpr { enum { e_value, e_const, e_func0, e_func1, e_func2, - e_squish, e_gauss, e_ld, + e_squish, e_gauss, e_ld, e_isnan, e_mod, e_max, e_min, e_eq, e_gt, e_gte, e_pow, e_mul, e_div, e_add, e_last, e_st, e_while, @@ -141,6 +144,7 @@ case e_squish: return 1/(1+exp(4*eval_expr(p, e->param[0]))); case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); } case e_ld: return e->value * p->var[av_clip(eval_expr(p, e->param[0]), 0, VARS-1)]; + case e_isnan: return e->value * !!isnan(eval_expr(p, e->param[0])); case e_while: { double d = NAN; while (eval_expr(p, e->param[0])) @@ -269,6 +273,7 @@ else if (strmatch(next, "lte" )) { AVExpr *tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gt; } else if (strmatch(next, "lt" )) { AVExpr *tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gte; } else if (strmatch(next, "ld" )) d->type = e_ld; + else if (strmatch(next, "isnan" )) d->type = e_isnan; else if (strmatch(next, "st" )) d->type = e_st; else if (strmatch(next, "while" )) d->type = e_while; else { @@ -404,12 +409,12 @@ if ((ret = parse_subexpr(&e0, p)) < 0) return ret; while (*p->s == ';') { + p->s++; e1 = e0; if ((ret = parse_subexpr(&e2, p)) < 0) { av_free_expr(e1); return ret; } - p->s++; e0 = new_eval_expr(e_last, 1, e1, e2); if (!e0) { av_free_expr(e1); @@ -433,7 +438,8 @@ case e_func1: case e_squish: case e_ld: - case e_gauss: return verify_expr(e->param[0]); + case e_gauss: + case e_isnan: return verify_expr(e->param[0]); default: return verify_expr(e->param[0]) && verify_expr(e->param[1]); } } @@ -534,6 +540,10 @@ double d; const char **expr, *exprs[] = { "", + "1;2", + "-20", + "-PI", + "+PI", "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", "80G/80Gi" "1k", @@ -559,6 +569,16 @@ "13k + 12f - foo(1, 2)", "1gi", "1Gi", + "st(0, 123)", + "st(1, 123); ld(1)", + /* compute 1+2+...+N */ + "st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)", + /* compute Fib(N) */ + "st(1, 1); st(2, 2); st(0, 1); while(lte(ld(0),10), st(3, ld(1)+ld(2)); st(1, ld(2)); st(2, ld(3)); st(0, ld(0)+1)); ld(3)", + "while(0, 10)", + "st(0, 1); while(lte(ld(0),100), st(1, ld(1)+ld(0)); st(0, ld(0)+1))", + "isnan(1)", + "isnan(NAN)", NULL }; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/log.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/log.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/log.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/log.c 2010-11-06 17:21:30.000000000 +0000 @@ -33,6 +33,7 @@ static #endif int av_log_level = AV_LOG_INFO; +static int flags; #if defined(_WIN32) && !defined(__MINGW32CE__) #include @@ -85,6 +86,7 @@ static int print_prefix=1; static int count; static char line[1024], prev[1024]; + static int is_atty; AVClass* avc= ptr ? *(AVClass**)ptr : NULL; if(level>av_log_level) return; @@ -103,9 +105,15 @@ vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl); print_prefix= line[strlen(line)-1] == '\n'; - if(print_prefix && !strcmp(line, prev)){ + +#if HAVE_ISATTY + if(!is_atty) is_atty= isatty(2) ? 1 : -1; +#endif + + if(print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){ count++; - fprintf(stderr, " Last message repeated %d times\r", count); + if(is_atty==1) + fprintf(stderr, " Last message repeated %d times\r", count); return; } if(count>0){ @@ -144,6 +152,11 @@ av_log_level = level; } +void av_log_set_flags(int arg) +{ + flags= arg; +} + void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) { av_log_callback = callback; diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/log.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/log.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/log.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/log.h 2010-11-06 17:21:30.000000000 +0000 @@ -135,4 +135,15 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); const char* av_default_item_name(void* ctx); +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 +void av_log_set_flags(int arg); + #endif /* AVUTIL_LOG_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/Makefile chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/Makefile --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/Makefile 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/Makefile 2010-11-06 17:21:29.000000000 +0000 @@ -4,11 +4,13 @@ HEADERS = adler32.h \ attributes.h \ + avassert.h \ avstring.h \ avutil.h \ base64.h \ bswap.h \ common.h \ + cpu.h \ crc.h \ error.h \ eval.h \ @@ -21,6 +23,7 @@ mathematics.h \ md5.h \ mem.h \ + opt.h \ pixdesc.h \ pixfmt.h \ random_seed.h \ @@ -33,6 +36,7 @@ aes.o \ avstring.o \ base64.o \ + cpu.o \ crc.o \ des.o \ error.o \ @@ -47,6 +51,7 @@ mathematics.o \ md5.o \ mem.o \ + opt.o \ pixdesc.o \ random_seed.o \ rational.o \ @@ -55,7 +60,11 @@ tree.o \ utils.o \ -TESTPROGS = adler32 aes base64 crc des lls md5 pca sha softfloat tree +OBJS-$(ARCH_ARM) += arm/cpu.o +OBJS-$(ARCH_PPC) += ppc/cpu.o +OBJS-$(ARCH_X86) += x86/cpu.o + +TESTPROGS = adler32 aes base64 cpu crc des lls md5 pca sha softfloat tree TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo DIRS = arm bfin sh4 x86 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/opt.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/opt.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/opt.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/opt.c 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,607 @@ +/* + * AVOptions + * Copyright (c) 2005 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * AVOptions + * @author Michael Niedermayer + */ + +#include "avutil.h" +#include "avstring.h" +#include "opt.h" +#include "eval.h" + +//FIXME order them and do a bin search +const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags) +{ + AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass + const AVOption *o= c->option; + + for (; o && o->name; o++) { + if (!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) && (o->flags & mask) == flags) + return o; + } + return NULL; +} + +const AVOption *av_next_option(void *obj, const AVOption *last) +{ + if (last && last[1].name) return ++last; + else if (last) return NULL; + else return (*(AVClass**)obj)->option; +} + +static int av_set_number2(void *obj, const char *name, double num, int den, int64_t intnum, const AVOption **o_out) +{ + const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); + void *dst; + if (o_out) + *o_out= o; + if (!o || o->offset<=0) + return AVERROR(ENOENT); + + if (o->max*den < num*intnum || o->min*den > num*intnum) { + av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name); + return AVERROR(ERANGE); + } + + dst= ((uint8_t*)obj) + o->offset; + + switch (o->type) { + case FF_OPT_TYPE_FLAGS: + case FF_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break; + case FF_OPT_TYPE_INT64: *(int64_t *)dst= llrint(num/den)*intnum; break; + case FF_OPT_TYPE_FLOAT: *(float *)dst= num*intnum/den; break; + case FF_OPT_TYPE_DOUBLE:*(double *)dst= num*intnum/den; break; + case FF_OPT_TYPE_RATIONAL: + if ((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den}; + else *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24); + break; + default: + return AVERROR(EINVAL); + } + return 0; +} + +static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum) +{ + const AVOption *o = NULL; + if (av_set_number2(obj, name, num, den, intnum, &o) < 0) + return NULL; + else + return o; +} + +static const double const_values[] = { + M_PI, + M_E, + FF_QP2LAMBDA, + 0 +}; + +static const char * const const_names[] = { + "PI", + "E", + "QP2LAMBDA", + 0 +}; + +static int hexchar2int(char c) { + if (c >= '0' && c <= '9') return c - '0'; + if (c >= 'a' && c <= 'f') return c - 'a' + 10; + if (c >= 'A' && c <= 'F') return c - 'A' + 10; + return -1; +} + +int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out) +{ + int ret; + const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); + if (o_out) + *o_out = o; + if (!o) + return AVERROR(ENOENT); + if (!val || o->offset<=0) + return AVERROR(EINVAL); + + if (o->type == FF_OPT_TYPE_BINARY) { + uint8_t **dst = (uint8_t **)(((uint8_t*)obj) + o->offset); + int *lendst = (int *)(dst + 1); + uint8_t *bin, *ptr; + int len = strlen(val); + av_freep(dst); + *lendst = 0; + if (len & 1) return AVERROR(EINVAL); + len /= 2; + ptr = bin = av_malloc(len); + while (*val) { + int a = hexchar2int(*val++); + int b = hexchar2int(*val++); + if (a < 0 || b < 0) { + av_free(bin); + return AVERROR(EINVAL); + } + *ptr++ = (a << 4) | b; + } + *dst = bin; + *lendst = len; + return 0; + } + if (o->type != FF_OPT_TYPE_STRING) { + int notfirst=0; + for (;;) { + int i; + char buf[256]; + int cmd=0; + double d; + + if (*val == '+' || *val == '-') + cmd= *(val++); + + for (i=0; iunit, 0, 0); + if (o_named && o_named->type == FF_OPT_TYPE_CONST) + d= o_named->default_val; + else if (!strcmp(buf, "default")) d= o->default_val; + else if (!strcmp(buf, "max" )) d= o->max; + else if (!strcmp(buf, "min" )) d= o->min; + else if (!strcmp(buf, "none" )) d= 0; + else if (!strcmp(buf, "all" )) d= ~0; + else { + int res = av_parse_and_eval_expr(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj); + if (res < 0) { + av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val); + return res; + } + } + } + if (o->type == FF_OPT_TYPE_FLAGS) { + if (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d; + else if (cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d; + } else { + if (cmd=='+') d= notfirst*av_get_double(obj, name, NULL) + d; + else if (cmd=='-') d= notfirst*av_get_double(obj, name, NULL) - d; + } + + if ((ret = av_set_number2(obj, name, d, 1, 1, o_out)) < 0) + return ret; + val+= i; + if (!*val) + return 0; + notfirst=1; + } + return AVERROR(EINVAL); + } + + if (alloc) { + av_free(*(void**)(((uint8_t*)obj) + o->offset)); + val= av_strdup(val); + } + + memcpy(((uint8_t*)obj) + o->offset, &val, sizeof(val)); + return 0; +} + +const AVOption *av_set_double(void *obj, const char *name, double n) +{ + return av_set_number(obj, name, n, 1, 1); +} + +const AVOption *av_set_q(void *obj, const char *name, AVRational n) +{ + return av_set_number(obj, name, n.num, n.den, 1); +} + +const AVOption *av_set_int(void *obj, const char *name, int64_t n) +{ + return av_set_number(obj, name, 1, 1, n); +} + +/** + * + * @param buf a buffer which is used for returning non string values as strings, can be NULL + * @param buf_len allocated length in bytes of buf + */ +const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len) +{ + const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); + void *dst; + uint8_t *bin; + int len, i; + if (!o || o->offset<=0) + return NULL; + if (o->type != FF_OPT_TYPE_STRING && (!buf || !buf_len)) + return NULL; + + dst= ((uint8_t*)obj) + o->offset; + if (o_out) *o_out= o; + + switch (o->type) { + case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; + case FF_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; + case FF_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; + case FF_OPT_TYPE_FLOAT: snprintf(buf, buf_len, "%f" , *(float *)dst);break; + case FF_OPT_TYPE_DOUBLE: snprintf(buf, buf_len, "%f" , *(double *)dst);break; + case FF_OPT_TYPE_RATIONAL: snprintf(buf, buf_len, "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; + case FF_OPT_TYPE_STRING: return *(void**)dst; + case FF_OPT_TYPE_BINARY: + len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); + if (len >= (buf_len + 1)/2) return NULL; + bin = *(uint8_t**)dst; + for (i = 0; i < len; i++) snprintf(buf + i*2, 3, "%02X", bin[i]); + break; + default: return NULL; + } + return buf; +} + +static int av_get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum) +{ + const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); + void *dst; + if (!o || o->offset<=0) + goto error; + + dst= ((uint8_t*)obj) + o->offset; + + if (o_out) *o_out= o; + + switch (o->type) { + case FF_OPT_TYPE_FLAGS: *intnum= *(unsigned int*)dst;return 0; + case FF_OPT_TYPE_INT: *intnum= *(int *)dst;return 0; + case FF_OPT_TYPE_INT64: *intnum= *(int64_t*)dst;return 0; + case FF_OPT_TYPE_FLOAT: *num= *(float *)dst;return 0; + case FF_OPT_TYPE_DOUBLE: *num= *(double *)dst;return 0; + case FF_OPT_TYPE_RATIONAL: *intnum= ((AVRational*)dst)->num; + *den = ((AVRational*)dst)->den; + return 0; + } +error: + *den=*intnum=0; + return -1; +} + +double av_get_double(void *obj, const char *name, const AVOption **o_out) +{ + int64_t intnum=1; + double num=1; + int den=1; + + av_get_number(obj, name, o_out, &num, &den, &intnum); + return num*intnum/den; +} + +AVRational av_get_q(void *obj, const char *name, const AVOption **o_out) +{ + int64_t intnum=1; + double num=1; + int den=1; + + av_get_number(obj, name, o_out, &num, &den, &intnum); + if (num == 1.0 && (int)intnum == intnum) + return (AVRational){intnum, den}; + else + return av_d2q(num*intnum/den, 1<<24); +} + +int64_t av_get_int(void *obj, const char *name, const AVOption **o_out) +{ + int64_t intnum=1; + double num=1; + int den=1; + + av_get_number(obj, name, o_out, &num, &den, &intnum); + return num*intnum/den; +} + +static void opt_list(void *obj, void *av_log_obj, const char *unit, + int req_flags, int rej_flags) +{ + const AVOption *opt=NULL; + + while ((opt= av_next_option(obj, opt))) { + if (!(opt->flags & req_flags) || (opt->flags & rej_flags)) + continue; + + /* Don't print CONST's on level one. + * Don't print anything but CONST's on level two. + * Only print items from the requested unit. + */ + if (!unit && opt->type==FF_OPT_TYPE_CONST) + continue; + else if (unit && opt->type!=FF_OPT_TYPE_CONST) + continue; + else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit)) + continue; + else if (unit && opt->type == FF_OPT_TYPE_CONST) + av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name); + else + av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name); + + switch (opt->type) { + case FF_OPT_TYPE_FLAGS: + av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); + break; + case FF_OPT_TYPE_INT: + av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); + break; + case FF_OPT_TYPE_INT64: + av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); + break; + case FF_OPT_TYPE_DOUBLE: + av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); + break; + case FF_OPT_TYPE_FLOAT: + av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); + break; + case FF_OPT_TYPE_STRING: + av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); + break; + case FF_OPT_TYPE_RATIONAL: + av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); + break; + case FF_OPT_TYPE_BINARY: + av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); + break; + case FF_OPT_TYPE_CONST: + default: + av_log(av_log_obj, AV_LOG_INFO, "%-7s ", ""); + break; + } + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.'); + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.'); + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.'); + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.'); + av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.'); + + if (opt->help) + av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help); + av_log(av_log_obj, AV_LOG_INFO, "\n"); + if (opt->unit && opt->type != FF_OPT_TYPE_CONST) { + opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags); + } + } +} + +int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags) +{ + if (!obj) + return -1; + + av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name); + + opt_list(obj, av_log_obj, NULL, req_flags, rej_flags); + + return 0; +} + +/** Set the values of the AVCodecContext or AVFormatContext structure. + * They are set to the defaults specified in the according AVOption options + * array default_val field. + * + * @param s AVCodecContext or AVFormatContext for which the defaults will be set + */ +void av_opt_set_defaults2(void *s, int mask, int flags) +{ + const AVOption *opt = NULL; + while ((opt = av_next_option(s, opt)) != NULL) { + if ((opt->flags & mask) != flags) + continue; + switch (opt->type) { + case FF_OPT_TYPE_CONST: + /* Nothing to be done here */ + break; + case FF_OPT_TYPE_FLAGS: + case FF_OPT_TYPE_INT: { + int val; + val = opt->default_val; + av_set_int(s, opt->name, val); + } + break; + case FF_OPT_TYPE_INT64: + if ((double)(opt->default_val+0.6) == opt->default_val) + av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name); + av_set_int(s, opt->name, opt->default_val); + break; + case FF_OPT_TYPE_DOUBLE: + case FF_OPT_TYPE_FLOAT: { + double val; + val = opt->default_val; + av_set_double(s, opt->name, val); + } + break; + case FF_OPT_TYPE_RATIONAL: { + AVRational val; + val = av_d2q(opt->default_val, INT_MAX); + av_set_q(s, opt->name, val); + } + break; + case FF_OPT_TYPE_STRING: + case FF_OPT_TYPE_BINARY: + /* Cannot set default for string as default_val is of type * double */ + break; + default: + av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name); + } + } +} + +void av_opt_set_defaults(void *s) +{ + av_opt_set_defaults2(s, 0, 0); +} + +/** + * Store the value in the field in ctx that is named like key. + * ctx must be an AVClass context, storing is done using AVOptions. + * + * @param buf the string to parse, buf will be updated to point at the + * separator just after the parsed key/value pair + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return 0 if the key/value pair has been successfully parsed and + * set, or a negative value corresponding to an AVERROR code in case + * of error: + * AVERROR(EINVAL) if the key/value pair cannot be parsed, + * the error code issued by av_set_string3() if the key/value pair + * cannot be set + */ +static int parse_key_value_pair(void *ctx, const char **buf, + const char *key_val_sep, const char *pairs_sep) +{ + char *key = av_get_token(buf, key_val_sep); + char *val; + int ret; + + if (*key && strspn(*buf, key_val_sep)) { + (*buf)++; + val = av_get_token(buf, pairs_sep); + } else { + av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key); + av_free(key); + return AVERROR(EINVAL); + } + + av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key); + + ret = av_set_string3(ctx, key, val, 1, NULL); + if (ret == AVERROR(ENOENT)) + av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key); + + av_free(key); + av_free(val); + return ret; +} + +int av_set_options_string(void *ctx, const char *opts, + const char *key_val_sep, const char *pairs_sep) +{ + int ret, count = 0; + + while (*opts) { + if ((ret = parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep)) < 0) + return ret; + count++; + + if (*opts) + opts++; + } + + return count; +} + +#ifdef TEST + +#undef printf + +typedef struct TestContext +{ + const AVClass *class; + int num; + int toggle; + char *string; + int flags; + AVRational rational; +} TestContext; + +#define OFFSET(x) offsetof(TestContext, x) + +#define TEST_FLAG_COOL 01 +#define TEST_FLAG_LAME 02 +#define TEST_FLAG_MU 04 + +static const AVOption test_options[]= { +{"num", "set num", OFFSET(num), FF_OPT_TYPE_INT, 0, 0, 100 }, +{"toggle", "set toggle", OFFSET(toggle), FF_OPT_TYPE_INT, 0, 0, 1 }, +{"rational", "set rational", OFFSET(rational), FF_OPT_TYPE_RATIONAL, 0, 0, 10 }, +{"string", "set string", OFFSET(string), FF_OPT_TYPE_STRING, 0, CHAR_MIN, CHAR_MAX }, +{"flags", "set flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, 0, 0, INT_MAX, 0, "flags" }, +{"cool", "set cool flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_COOL, INT_MIN, INT_MAX, 0, "flags" }, +{"lame", "set lame flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_LAME, INT_MIN, INT_MAX, 0, "flags" }, +{"mu", "set mu flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_MU, INT_MIN, INT_MAX, 0, "flags" }, +{NULL}, +}; + +static const char *test_get_name(void *ctx) +{ + return "test"; +} + +static const AVClass test_class = { + "TestContext", + test_get_name, + test_options +}; + +int main(void) +{ + int i; + + printf("\nTesting av_set_options_string()\n"); + { + TestContext test_ctx; + const char *options[] = { + "", + ":", + "=", + "foo=:", + ":=foo", + "=foo", + "foo=", + "foo", + "foo=val", + "foo==val", + "toggle=:", + "string=:", + "toggle=1 : foo", + "toggle=100", + "toggle==1", + "flags=+mu-lame : num=42: toggle=0", + "num=42 : string=blahblah", + "rational=0 : rational=1/2 : rational=1/-1", + "rational=-1/0", + }; + + test_ctx.class = &test_class; + av_opt_set_defaults2(&test_ctx, 0, 0); + test_ctx.string = av_strdup("default"); + + av_log_set_level(AV_LOG_DEBUG); + + for (i=0; i < FF_ARRAY_ELEMS(options); i++) { + av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]); + if (av_set_options_string(&test_ctx, options[i], "=", ":") < 0) + av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]); + printf("\n"); + } + } + + return 0; +} + +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/opt.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/opt.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/opt.h 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/opt.h 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,226 @@ +/* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OPT_H +#define AVUTIL_OPT_H + +/** + * @file + * AVOptions + */ + +#include "rational.h" +#include "avutil.h" + +enum AVOptionType{ + FF_OPT_TYPE_FLAGS, + FF_OPT_TYPE_INT, + FF_OPT_TYPE_INT64, + FF_OPT_TYPE_DOUBLE, + FF_OPT_TYPE_FLOAT, + FF_OPT_TYPE_STRING, + FF_OPT_TYPE_RATIONAL, + FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + FF_OPT_TYPE_CONST=128, +}; + +/** + * AVOption + */ +typedef struct AVOption { + const char *name; + + /** + * short English help text + * @todo What about other languages? + */ + const char *help; + + /** + * The offset relative to the context structure where the option + * value is stored. It should be 0 for named constants. + */ + int offset; + enum AVOptionType type; + + /** + * the default value for scalar options + */ + double default_val; + double min; ///< minimum valid value for the option + double max; ///< maximum valid value for the option + + int flags; +#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding +#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding +#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... +#define AV_OPT_FLAG_AUDIO_PARAM 8 +#define AV_OPT_FLAG_VIDEO_PARAM 16 +#define AV_OPT_FLAG_SUBTITLE_PARAM 32 +//FIXME think about enc-audio, ... style flags + + /** + * The logical unit to which the option belongs. Non-constant + * options and corresponding named constants share the same + * unit. May be NULL. + */ + const char *unit; +} AVOption; + +/** + * AVOption2. + * THIS IS NOT PART OF THE API/ABI YET! + * This is identical to AVOption except that default_val was replaced by + * an union, it should be compatible with AVOption on normal platforms. + */ +typedef struct AVOption2 { + const char *name; + + /** + * short English help text + * @todo What about other languages? + */ + const char *help; + + /** + * The offset relative to the context structure where the option + * value is stored. It should be 0 for named constants. + */ + int offset; + enum AVOptionType type; + + /** + * the default value for scalar options + */ + union { + double dbl; + const char *str; + } default_val; + + double min; ///< minimum valid value for the option + double max; ///< maximum valid value for the option + + int flags; +/* +#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding +#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding +#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... +#define AV_OPT_FLAG_AUDIO_PARAM 8 +#define AV_OPT_FLAG_VIDEO_PARAM 16 +#define AV_OPT_FLAG_SUBTITLE_PARAM 32 +*/ +//FIXME think about enc-audio, ... style flags + + /** + * The logical unit to which the option belongs. Non-constant + * options and corresponding named constants share the same + * unit. May be NULL. + */ + const char *unit; +} AVOption2; + + +/** + * Look for an option in obj. Look only for the options which + * have the flags set as specified in mask and flags (that is, + * for which it is the case that opt->flags & mask == flags). + * + * @param[in] obj a pointer to a struct whose first element is a + * pointer to an AVClass + * @param[in] name the name of the option to look for + * @param[in] unit the unit of the option to look for, or any if NULL + * @return a pointer to the option found, or NULL if no option + * has been found + */ +const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); + +/** + * Set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an + * AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. If the field is not of a string + * type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param[out] o_out if non-NULL put here a pointer to the AVOption + * found + * @param alloc when 1 then the old value will be av_freed() and the + * new av_strduped() + * when 0 then no av_free() nor av_strdup() will be used + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR(ENOENT) if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + */ +int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); + +const AVOption *av_set_double(void *obj, const char *name, double n); +const AVOption *av_set_q(void *obj, const char *name, AVRational n); +const AVOption *av_set_int(void *obj, const char *name, int64_t n); +double av_get_double(void *obj, const char *name, const AVOption **o_out); +AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); +int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); +const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); +const AVOption *av_next_option(void *obj, const AVOption *last); + +/** + * Show the obj options. + * + * @param req_flags requested flags for the options to show. Show only the + * options for which it is opt->flags & req_flags. + * @param rej_flags rejected flags for the options to show. Show only the + * options for which it is !(opt->flags & req_flags). + * @param av_log_obj log context to use for showing the options + */ +int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); + +void av_opt_set_defaults(void *s); +void av_opt_set_defaults2(void *s, int mask, int flags); + +/** + * Parse the key/value pairs list in opts. For each key/value pair + * found, stores the value in the field in ctx that is named like the + * key. ctx must be an AVClass context, storing is done using + * AVOptions. + * + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return the number of successfully set key/value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_set_string3() if a key/value pair + * cannot be set + */ +int av_set_options_string(void *ctx, const char *opts, + const char *key_val_sep, const char *pairs_sep); + +#endif /* AVUTIL_OPT_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/pixdesc.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/pixdesc.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/pixdesc.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/pixdesc.c 2010-11-06 17:21:30.000000000 +0000 @@ -53,11 +53,14 @@ } } else { const uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1; + int is_8bit = shift + depth <= 8; + + if (is_8bit) + p += !!(flags & PIX_FMT_BE); while(w--){ - int val; - if(flags & PIX_FMT_BE) val= AV_RB16(p); - else val= AV_RL16(p); + int val = is_8bit ? *p : + flags & PIX_FMT_BE ? AV_RB16(p) : AV_RL16(p); val = (val>>shift) & mask; if(read_pal_component) val= data[1][4*val + c]; @@ -91,15 +94,23 @@ int shift = comp.shift; uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1; - while (w--) { - if (flags & PIX_FMT_BE) { - uint16_t val = AV_RB16(p) | (*src++< +#elif defined(__OpenBSD__) +#include +#include +#include +#elif defined(__AMIGAOS4__) +#include +#include +#include +#endif /* __APPLE__ */ + +#include "libavutil/cpu.h" +#include "config.h" + +/** + * This function MAY rely on signal() or fork() in order to make sure AltiVec + * is present. + */ +int ff_get_cpu_flags_ppc(void) +{ +#if HAVE_ALTIVEC +#ifdef __AMIGAOS4__ + ULONG result = 0; + extern struct ExecIFace *IExec; + + IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); + if (result == VECTORTYPE_ALTIVEC) + return AV_CPU_FLAG_ALTIVEC; + return 0; +#elif defined(__APPLE__) || defined(__OpenBSD__) +#ifdef __OpenBSD__ + int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC}; +#else + int sels[2] = {CTL_HW, HW_VECTORUNIT}; +#endif + int has_vu = 0; + size_t len = sizeof(has_vu); + int err; + + err = sysctl(sels, 2, &has_vu, &len, NULL, 0); + + if (err == 0) + return has_vu ? AV_CPU_FLAG_ALTIVEC : 0; + return 0; +#elif CONFIG_RUNTIME_CPUDETECT + int proc_ver; + // Support of mfspr PVR emulation added in Linux 2.6.17. + __asm__ volatile("mfspr %0, 287" : "=r" (proc_ver)); + proc_ver >>= 16; + if (proc_ver & 0x8000 || + proc_ver == 0x000c || + proc_ver == 0x0039 || proc_ver == 0x003c || + proc_ver == 0x0044 || proc_ver == 0x0045 || + proc_ver == 0x0070) + return AV_CPU_FLAG_ALTIVEC; + return 0; +#else + // Since we were compiled for AltiVec, just assume we have it + // until someone comes up with a proper way (not involving signal hacks). + return AV_CPU_FLAG_ALTIVEC; +#endif /* __AMIGAOS4__ */ +#endif /* HAVE_ALTIVEC */ + return 0; +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/rational.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/rational.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/rational.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/rational.c 2010-11-06 17:21:30.000000000 +0000 @@ -25,7 +25,7 @@ * @author Michael Niedermayer */ -#include +#include "avassert.h" //#include #include @@ -67,7 +67,7 @@ num= den; den= next_den; } - assert(av_gcd(a1.num, a1.den) <= 1U); + av_assert2(av_gcd(a1.num, a1.den) <= 1U); *dst_num = sign ? -a1.num : a1.num; *dst_den = a1.den; @@ -96,10 +96,14 @@ AVRational av_d2q(double d, int max){ AVRational a; #define LOG2 0.69314718055994530941723212145817656807550013436025 - int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); - int64_t den= 1LL << (61 - exponent); + int exponent; + int64_t den; if (isnan(d)) return (AVRational){0,0}; + if (isinf(d)) + return (AVRational){ d<0 ? -1:1, 0 }; + exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); + den = 1LL << (61 - exponent); av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max); return a; @@ -129,3 +133,23 @@ return nearest_q_idx; } + +#ifdef TEST +main(){ + AVRational a,b; + for(a.num=-2; a.num<=2; a.num++){ + for(a.den=-2; a.den<=2; a.den++){ + for(b.num=-2; b.num<=2; b.num++){ + for(b.den=-2; b.den<=2; b.den++){ + int c= av_cmp_q(a,b); + double d= av_q2d(a) == av_q2d(b) ? 0 : (av_q2d(a) - av_q2d(b)); + if(d>0) d=1; + else if(d<0) d=-1; + else if(d != d) d= INT_MIN; + if(c!=d) av_log(0, AV_LOG_ERROR, "%d/%d %d/%d, %d %f\n", a.num, a.den, b.num, b.den, c,d); + } + } + } + } +} +#endif diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/rational.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/rational.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/rational.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/rational.h 2010-11-06 17:21:30.000000000 +0000 @@ -29,6 +29,7 @@ #define AVUTIL_RATIONAL_H #include +#include #include "attributes.h" /** @@ -43,13 +44,16 @@ * Compare two rationals. * @param a first rational * @param b second rational - * @return 0 if a==b, 1 if a>b and -1 if ab, -1 if a>63)|1; - else return 0; + if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; } /** @@ -107,6 +111,8 @@ /** * Convert a double precision floating point number to a rational. + * inf is expressed as {1,0} or {-1,0} depending on the sign. + * * @param d double to convert * @param max the maximum allowed numerator and denominator * @return (AVRational) d diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/x86/cpu.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/x86/cpu.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/x86/cpu.c 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/x86/cpu.c 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,124 @@ +/* + * CPU detection code, extracted from mmx.h + * (c)1997-99 by H. Dietz and R. Fisher + * Converted to C and improved by Fabrice Bellard. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "libavutil/x86_cpu.h" +#include "libavutil/cpu.h" + +/* ebx saving is necessary for PIC. gcc seems unable to see it alone */ +#define cpuid(index,eax,ebx,ecx,edx)\ + __asm__ volatile\ + ("mov %%"REG_b", %%"REG_S"\n\t"\ + "cpuid\n\t"\ + "xchg %%"REG_b", %%"REG_S\ + : "=a" (eax), "=S" (ebx),\ + "=c" (ecx), "=d" (edx)\ + : "0" (index)); + +/* Function to test if multimedia instructions are supported... */ +int ff_get_cpu_flags_x86(void) +{ + int rval = 0; + int eax, ebx, ecx, edx; + int max_std_level, max_ext_level, std_caps=0, ext_caps=0; + int family=0, model=0; + union { int i[3]; char c[12]; } vendor; + +#if ARCH_X86_32 + x86_reg a, c; + __asm__ volatile ( + /* See if CPUID instruction is supported ... */ + /* ... Get copies of EFLAGS into eax and ecx */ + "pushfl\n\t" + "pop %0\n\t" + "mov %0, %1\n\t" + + /* ... Toggle the ID bit in one copy and store */ + /* to the EFLAGS reg */ + "xor $0x200000, %0\n\t" + "push %0\n\t" + "popfl\n\t" + + /* ... Get the (hopefully modified) EFLAGS */ + "pushfl\n\t" + "pop %0\n\t" + : "=a" (a), "=c" (c) + : + : "cc" + ); + + if (a == c) + return 0; /* CPUID not supported */ +#endif + + cpuid(0, max_std_level, vendor.i[0], vendor.i[2], vendor.i[1]); + + if(max_std_level >= 1){ + cpuid(1, eax, ebx, ecx, std_caps); + family = ((eax>>8)&0xf) + ((eax>>20)&0xff); + model = ((eax>>4)&0xf) + ((eax>>12)&0xf0); + if (std_caps & (1<<23)) + rval |= AV_CPU_FLAG_MMX; + if (std_caps & (1<<25)) + rval |= AV_CPU_FLAG_MMX2 +#if HAVE_SSE + | AV_CPU_FLAG_SSE; + if (std_caps & (1<<26)) + rval |= AV_CPU_FLAG_SSE2; + if (ecx & 1) + rval |= AV_CPU_FLAG_SSE3; + if (ecx & 0x00000200 ) + rval |= AV_CPU_FLAG_SSSE3; + if (ecx & 0x00080000 ) + rval |= AV_CPU_FLAG_SSE4; + if (ecx & 0x00100000 ) + rval |= AV_CPU_FLAG_SSE42; +#endif + ; + } + + cpuid(0x80000000, max_ext_level, ebx, ecx, edx); + + if(max_ext_level >= 0x80000001){ + cpuid(0x80000001, eax, ebx, ecx, ext_caps); + if (ext_caps & (1<<31)) + rval |= AV_CPU_FLAG_3DNOW; + if (ext_caps & (1<<30)) + rval |= AV_CPU_FLAG_3DNOWEXT; + if (ext_caps & (1<<23)) + rval |= AV_CPU_FLAG_MMX; + if (ext_caps & (1<<22)) + rval |= AV_CPU_FLAG_MMX2; + } + + if (!strncmp(vendor.c, "GenuineIntel", 12) && + family == 6 && (model == 9 || model == 13 || model == 14)) { + /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and 6/14 (core1 "yonah") + * theoretically support sse2, but it's usually slower than mmx, + * so let's just pretend they don't. */ + if (rval & AV_CPU_FLAG_SSE2) rval ^= AV_CPU_FLAG_SSE2SLOW|AV_CPU_FLAG_SSE2; + if (rval & AV_CPU_FLAG_SSE3) rval ^= AV_CPU_FLAG_SSE3SLOW|AV_CPU_FLAG_SSE3; + } + + return rval; +} diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/x86_cpu.h chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/x86_cpu.h --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/libavutil/x86_cpu.h 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/libavutil/x86_cpu.h 2010-11-06 17:21:30.000000000 +0000 @@ -25,6 +25,7 @@ #include "config.h" #if ARCH_X86_64 +# define OPSIZE "q" # define REG_a "rax" # define REG_b "rbx" # define REG_c "rcx" @@ -45,6 +46,7 @@ #elif ARCH_X86_32 +# define OPSIZE "l" # define REG_a "eax" # define REG_b "ebx" # define REG_c "ecx" @@ -73,4 +75,24 @@ # define BROKEN_RELOCATIONS 1 #endif +/* + * If gcc is not set to support sse (-msse) it will not accept xmm registers + * in the clobber list for inline asm. XMM_CLOBBERS takes a list of xmm + * registers to be marked as clobbered and evaluates to nothing if they are + * not supported, or to the list itself if they are supported. Since a clobber + * list may not be empty, XMM_CLOBBERS_ONLY should be used if the xmm + * registers are the only in the clobber list. + * For example a list with "eax" and "xmm0" as clobbers should become: + * : XMM_CLOBBERS("xmm0",) "eax" + * and a list with only "xmm0" should become: + * XMM_CLOBBERS_ONLY("xmm0") + */ +#if HAVE_XMM_CLOBBERS +# define XMM_CLOBBERS(...) __VA_ARGS__ +# define XMM_CLOBBERS_ONLY(...) : __VA_ARGS__ +#else +# define XMM_CLOBBERS(...) +# define XMM_CLOBBERS_ONLY(...) +#endif + #endif /* AVUTIL_X86_CPU_H */ diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/LICENSE chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/LICENSE --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/LICENSE 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/LICENSE 2010-11-06 17:21:26.000000000 +0000 @@ -15,8 +15,6 @@ - libpostproc - optional x86 optimizations in the files - libavcodec/x86/h264_deblock_sse2.asm - libavcodec/x86/h264_idct_sse2.asm libavcodec/x86/idct_mmx.c - the X11 grabber in libavdevice/x11grab.c diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/MAINTAINERS chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/MAINTAINERS --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/MAINTAINERS 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/MAINTAINERS 2010-11-06 17:21:26.000000000 +0000 @@ -176,6 +176,7 @@ nellymoserdec.c Benjamin Larsson nuv.c Reimar Doeffinger pcx.c Ivo van Poorten + pgssubdec.c Reimar Doeffinger ptx.c Ivo van Poorten qcelp* Reynaldo H. Verdejo Pinochet qdm2.c, qdm2data.h Roberto Togni, Benjamin Larsson @@ -261,6 +262,7 @@ ape.c Kostya Shishkov avi* Michael Niedermayer bink.c Peter Ross + caf* Peter Ross crc.c Michael Niedermayer daud.c Reimar Doeffinger dv.c Roman Shaposhnik @@ -273,19 +275,19 @@ gxf.c Reimar Doeffinger gxfenc.c Baptiste Coudurier idcin.c Mike Melanson - idroq.c Mike Melanson + idroqdec.c Mike Melanson iff.c Jaikrishnan Menon ipmovie.c Mike Melanson img2.c Michael Niedermayer iss.c Stefan Gehrer libnut.c Oded Shimon lmlm4.c Ivo van Poorten + lxfdec.c Tomas Härdin matroska.c Aurelien Jacobs matroskadec.c Aurelien Jacobs matroskaenc.c David Conrad metadata* Aurelien Jacobs mm.c Peter Ross - mmst.c Ronald S. Bultje mov.c Michael Niedermayer, Baptiste Coudurier movenc.c Michael Niedermayer, Baptiste Coudurier mpc.c Kostya Shishkov @@ -310,11 +312,11 @@ rl2.c Sascha Sommer rmdec.c, rmenc.c Ronald S. Bultje, Kostya Shishkov rtmp* Kostya Shishkov - rtp.c, rtpenc.c Luca Abeni + rtp.c, rtpenc.c Martin Storsjo rtpdec_asf.* Ronald S. Bultje - rtpenc_mpv.*, rtpenc_aac.* Luca Abeni + rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo rtsp.c Luca Barbato - sdp.c Luca Abeni + sdp.c Martin Storsjo segafilm.c Mike Melanson siff.c Kostya Shishkov smacker.c Kostya Shishkov @@ -329,6 +331,7 @@ Protocols: http.c Ronald S. Bultje + mms*.c Ronald S. Bultje udp.c Luca Abeni @@ -358,6 +361,7 @@ Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7 Diego Biurrun 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5 Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368 +Justin Ruggles 3136 ECC0 C10D 6C04 5F43 CA29 FCBE CD2A 3787 1EBF Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE Luca Barbato 6677 4209 213C 8843 5B67 29E7 E84C 78C2 84E9 0E34 Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB @@ -368,3 +372,4 @@ Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C Stefano Sabatini 9A43 10F8 D32C D33C 48E7 C52C 5DF2 8E4D B2EE 066B +Tomas Härdin D133 29CA 4EEC 9DB4 7076 F697 B04B 7403 3313 41FD diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/Makefile chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/Makefile --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/Makefile 2010-08-11 17:40:53.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/Makefile 2010-11-06 17:21:26.000000000 +0000 @@ -92,7 +92,7 @@ tools/%.o: tools/%.c $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $< -ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS) +ffplay.o: CFLAGS += $(SDL_CFLAGS) VERSION_SH = $(SRC_PATH_BARE)/version.sh GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD @@ -115,8 +115,8 @@ $(HTMLPAGES) $(MANPAGES): doc/fftools-common-opts.texi -doc/ffmpeg.pod doc/ffmpeg-doc.html: doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi -doc/ffplay.pod doc/ffplay-doc.html: doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi +doc/ffmpeg.pod doc/ffmpeg-doc.html: doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi +doc/ffplay.pod doc/ffplay-doc.html: doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi doc/ffprobe.pod doc/ffprobe-doc.html: doc/indevs.texi doc/protocols.texi doc/%.html: TAG = HTML @@ -236,11 +236,10 @@ include $(SRC_PATH_BARE)/tests/fate/als.mak include $(SRC_PATH_BARE)/tests/fate/fft.mak include $(SRC_PATH_BARE)/tests/fate/h264.mak +include $(SRC_PATH_BARE)/tests/fate/mp3.mak include $(SRC_PATH_BARE)/tests/fate/vorbis.mak include $(SRC_PATH_BARE)/tests/fate/vp8.mak -FATE_TESTS += $(FATE2_TESTS) - FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%) FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%) FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%) @@ -278,17 +277,19 @@ ifdef SAMPLES FATE += $(FATE_TESTS) else -fate2 $(FATE_TESTS): +$(FATE_TESTS): @echo "SAMPLES not specified, cannot run FATE" endif FATE_UTILS = base64 tiny_psnr fate: $(FATE) -fate2: $(FATE2_TESTS) $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) @echo "TEST $(@:fate-%=%)" $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' +fate-list: + @printf '%s\n' $(sort $(FATE)) + .PHONY: documentation *test regtest-* alltools check config diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/mt-work/test.sh chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/mt-work/test.sh --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/mt-work/test.sh 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/mt-work/test.sh 2010-11-06 17:21:30.000000000 +0000 @@ -2,7 +2,12 @@ fn=`basename "$1"` for th in 1 2 3 4; do - time ./ffmpeg_g -threads $th -vsync 0 -y -t 30 -i "$1" -an -f framecrc "crc/$fn-$th.txt" >/dev/null 2>&1 + time ./ffmpeg_g -threads $th -flags2 +fast -vsync 0 -y -t 30 -i "$1" -an -f framecrc "crc/$fn-$th.txt" >/dev/null 2>&1 done -md5 "crc/$fn"* \ No newline at end of file +./ffmpeg_g -threads 1 -y -t 10 -i "$1" -an -f framecrc "crc/$fn-1-vsync.txt" >/dev/null 2>&1 +./ffmpeg_g -threads 3 -y -t 10 -i "$1" -an -f framecrc "crc/$fn-3-vsync.txt" >/dev/null 2>&1 + +md5 "crc/$fn-"[1234].txt +echo +md5 "crc/$fn-"*vsync.txt diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/mt-work/todo.txt chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/mt-work/todo.txt --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/mt-work/todo.txt 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/mt-work/todo.txt 2010-11-06 17:21:30.000000000 +0000 @@ -1,5 +1,14 @@ Todo +-- For other people +- Multithread vp8 or vc1. +- Multithread an intra codec like mjpeg. +- Fix mpeg1 (see below). +- Try the first two items under Optimization. +- Fix h264 (see below). +- Fix mpeg4 (check mplayer too). +- Try fixing mpeg2. + -- Bug fixes Prove correct: @@ -11,14 +20,16 @@ - MPV_lowest_referenced_row() and co in mpegvideo.c - Same in vp3. +mpeg*: +- ARM asm depends on specific offsets into MpegEncContext +which are different here. + h264: - Files split at the wrong NAL unit don't (and can't) be decoded with threads (e.g. TS split so PPS is after the frame, PAFF with two fields in a packet). Scan the packet at the start of decode and don't finish_thread_setup until all PPS/SPS have been encountered. -- Some files with harmless header errors decode -differently. mpeg4: - Packed B-frames need to be explicitly split up @@ -31,19 +42,16 @@ with threads on. Currently disabled for this reason. other: -- ffmpeg with -vsync != 0 breaks A/V sync because -it can't handle more than 1 frame of decoder delay. -This can be seen with H.264 on mainline. -- Decoding single-frame files with 3+ threads never -outputs anything in ffmpeg. It should stop the initial -delay and just return a frame immediately if one of the -first N frames is an EOF packet. +- Keep track of and export the DTS of delayed frames, so that +clients can still use DTS for accurate a/v sync with threads. +This is required for e.g. packed B-frames to sync properly. - Error resilience has to run before ff_report_frame_progress() -is called. -- 'make test' must pass. This means pthread emulation -must work the same way without --enable-pthreads. -There also seems to be some problem related to +is called. Otherwise it will be unpredictable. (This might already +work.) In general testing error paths should be done more. +- 'make test' must pass with/without --disable-pthreads. +There seems to be some problem related to draw_edges and the mpeg4 encoder. +- Add more comments to pthread.c. Rewrite the new files in doc/. -- Optimization @@ -58,11 +66,6 @@ sure they only copy what they need to. - Support frame+slice threading. --- Style - -- See if AVCodec init_thread_copy and update_thread_context -can be merged cleanly. - -- Features - Support streams with width/height changing. This @@ -79,6 +82,7 @@ http://astrange.ithinksw.net/ffmpeg/mt-samples/ See yuvcmp.c in this directory to compare decoded samples. -Try commenting out ff_thread_finish_setup calls so -only one thread runs at once, and then binary search+ -scattering printfs to look for differences in codec contexts. + +For debugging, try commenting out ff_thread_finish_setup calls so +that only one thread runs at once, and then binary search+ +scatter printfs to look for differences in codec contexts. diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/audiogen.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/audiogen.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/audiogen.c 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/audiogen.c 2010-11-06 17:21:30.000000000 +0000 @@ -24,8 +24,7 @@ #include #include -#define NB_CHANNELS 2 -#define FE 44100 +#define MAX_CHANNELS 8 static unsigned int myrnd(unsigned int *seed_ptr, int n) { @@ -104,15 +103,34 @@ { int i, a, v, j, f, amp, ampa; unsigned int seed = 1; - int tabf1[NB_CHANNELS], tabf2[NB_CHANNELS]; - int taba[NB_CHANNELS]; - - if (argc != 2) { - printf("usage: %s file\n" - "generate a test raw 16 bit stereo audio stream\n", argv[0]); + int tabf1[MAX_CHANNELS], tabf2[MAX_CHANNELS]; + int taba[MAX_CHANNELS]; + int sample_rate = 44100; + int nb_channels = 2; + + if (argc < 2 || argc > 4) { + printf("usage: %s file [ []]\n" + "generate a test raw 16 bit audio stream\n" + "default: 44100 Hz stereo\n", argv[0]); exit(1); } + if (argc > 2) { + sample_rate = atoi(argv[2]); + if (sample_rate <= 0) { + fprintf(stderr, "invalid sample rate: %d\n", sample_rate); + return 1; + } + } + + if (argc > 3) { + nb_channels = atoi(argv[3]); + if (nb_channels < 1 || nb_channels > MAX_CHANNELS) { + fprintf(stderr, "invalid number of channels: %d\n", nb_channels); + return 1; + } + } + outfile = fopen(argv[1], "wb"); if (!outfile) { perror(argv[1]); @@ -121,64 +139,64 @@ /* 1 second of single freq sinus at 1000 Hz */ a = 0; - for(i=0;i<1 * FE;i++) { + for(i=0;i<1 * sample_rate;i++) { v = (int_cos(a) * 10000) >> FRAC_BITS; - for(j=0;j> FRAC_BITS; - for(j=0;j> FRAC_BITS; put_sample(v); - f = tabf1[j] + (((tabf2[j] - tabf1[j]) * i) / FE); - taba[j] += (f * FRAC_ONE) / FE; + f = tabf1[j] + (((tabf2[j] - tabf1[j]) * i) / sample_rate); + taba[j] += (f * FRAC_ONE) / sample_rate; } } - /* stereo 500 Hz with varying volume */ + /* 2 seconds of 500 Hz with varying volume */ a = 0; ampa = 0; - for(i=0;i<2 * FE;i++) { - for(j=0;j> FRAC_BITS; if (j & 1) amp = 10000 - amp; v = (int_cos(a) * amp) >> FRAC_BITS; put_sample(v); - a += (500 * FRAC_ONE) / FE; - ampa += (2 * FRAC_ONE) / FE; + a += (500 * FRAC_ONE) / sample_rate; + ampa += (2 * FRAC_ONE) / sample_rate; } } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/codec-regression.sh chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/codec-regression.sh --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/codec-regression.sh 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/codec-regression.sh 2010-11-06 17:21:30.000000000 +0000 @@ -248,6 +248,11 @@ do_video_decoding "" "-pix_fmt yuv420p" fi +if [ -n "$do_qtrle" ] ; then +do_video_encoding qtrle.mov "" "" +do_video_decoding "" "" +fi + if [ -n "$do_rgb" ] ; then do_video_encoding rgb.avi "" "-an -vcodec rawvideo -pix_fmt bgr24" do_video_decoding "" "-pix_fmt yuv420p" diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate/mp3.mak chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate/mp3.mak --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate/mp3.mak 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate/mp3.mak 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,39 @@ +FATE_MP3 += fate-mp3-float-conf-compl +fate-mp3-float-conf-compl: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/compl.bit +fate-mp3-float-conf-compl: CMP = stddev +fate-mp3-float-conf-compl: REF = $(SAMPLES)/mp3-conformance/compl.pcm + +FATE_MP3 += fate-mp3-float-conf-he_32khz +fate-mp3-float-conf-he_32khz: CMD = pcm -acodec mp3float -fs 343296 -i $(SAMPLES)/mp3-conformance/he_32khz.bit +fate-mp3-float-conf-he_32khz: CMP = stddev +fate-mp3-float-conf-he_32khz: REF = $(SAMPLES)/mp3-conformance/he_32khz.pcm + +FATE_MP3 += fate-mp3-float-conf-he_44khz +fate-mp3-float-conf-he_44khz: CMD = pcm -acodec mp3float -fs 942336 -i $(SAMPLES)/mp3-conformance/he_44khz.bit +fate-mp3-float-conf-he_44khz: CMP = stddev +fate-mp3-float-conf-he_44khz: REF = $(SAMPLES)/mp3-conformance/he_44khz.pcm + +FATE_MP3 += fate-mp3-float-conf-he_48khz +fate-mp3-float-conf-he_48khz: CMD = pcm -acodec mp3float -fs 343296 -i $(SAMPLES)/mp3-conformance/he_48khz.bit +fate-mp3-float-conf-he_48khz: CMP = stddev +fate-mp3-float-conf-he_48khz: REF = $(SAMPLES)/mp3-conformance/he_48khz.pcm + +FATE_MP3 += fate-mp3-float-conf-hecommon +fate-mp3-float-conf-hecommon: CMD = pcm -acodec mp3float -fs 133632 -i $(SAMPLES)/mp3-conformance/hecommon.bit +fate-mp3-float-conf-hecommon: CMP = stddev +fate-mp3-float-conf-hecommon: REF = $(SAMPLES)/mp3-conformance/hecommon.pcm + +FATE_MP3 += fate-mp3-float-conf-si +fate-mp3-float-conf-si: CMD = pcm -acodec mp3float -fs 269568 -i $(SAMPLES)/mp3-conformance/si.bit +fate-mp3-float-conf-si: CMP = stddev +fate-mp3-float-conf-si: REF = $(SAMPLES)/mp3-conformance/si.pcm + +FATE_MP3 += fate-mp3-float-conf-si_block +fate-mp3-float-conf-si_block: CMD = pcm -acodec mp3float -fs 145152 -i $(SAMPLES)/mp3-conformance/si_block.bit +fate-mp3-float-conf-si_block: CMP = stddev +fate-mp3-float-conf-si_block: REF = $(SAMPLES)/mp3-conformance/si_block.pcm + +FATE_TESTS += $(FATE_MP3) +fate-mp3: $(FATE_MP3) +$(FATE_MP3): CMP = stddev +$(FATE_MP3): FUZZ = 0.07 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate2.mak chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate2.mak --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate2.mak 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate2.mak 2010-11-06 17:21:30.000000000 +0000 @@ -1,159 +1,214 @@ -FATE2_TESTS += fate-twinvq +FATE_TESTS += fate-twinvq fate-twinvq: CMD = pcm -i $(SAMPLES)/vqf/achterba.vqf fate-twinvq: CMP = oneoff fate-twinvq: REF = $(SAMPLES)/vqf/achterba.pcm -FATE2_TESTS += fate-sipr-16k +FATE_TESTS += fate-sipr-16k fate-sipr-16k: CMD = pcm -i $(SAMPLES)/sipr/sipr_16k.rm fate-sipr-16k: CMP = oneoff fate-sipr-16k: REF = $(SAMPLES)/sipr/sipr_16k.pcm -FATE2_TESTS += fate-sipr-8k5 +FATE_TESTS += fate-sipr-8k5 fate-sipr-8k5: CMD = pcm -i $(SAMPLES)/sipr/sipr_8k5.rm fate-sipr-8k5: CMP = oneoff fate-sipr-8k5: REF = $(SAMPLES)/sipr/sipr_8k5.pcm -FATE2_TESTS += fate-sipr-6k5 +FATE_TESTS += fate-sipr-6k5 fate-sipr-6k5: CMD = pcm -i $(SAMPLES)/sipr/sipr_6k5.rm fate-sipr-6k5: CMP = oneoff fate-sipr-6k5: REF = $(SAMPLES)/sipr/sipr_6k5.pcm -FATE2_TESTS += fate-sipr-5k0 +FATE_TESTS += fate-sipr-5k0 fate-sipr-5k0: CMD = pcm -i $(SAMPLES)/sipr/sipr_5k0.rm fate-sipr-5k0: CMP = oneoff fate-sipr-5k0: REF = $(SAMPLES)/sipr/sipr_5k0.pcm -FATE2_TESTS += fate-ra-288 +FATE_TESTS += fate-ra-288 fate-ra-288: CMD = pcm -i $(SAMPLES)/real/ra_288.rm fate-ra-288: CMP = oneoff fate-ra-288: REF = $(SAMPLES)/real/ra_288.pcm fate-ra-288: FUZZ = 2 -FATE2_TESTS += fate-ra-cook +FATE_TESTS += fate-ra-cook fate-ra-cook: CMD = pcm -i $(SAMPLES)/real/ra_cook.rm fate-ra-cook: CMP = oneoff fate-ra-cook: REF = $(SAMPLES)/real/ra_cook.pcm -FATE2_TESTS += fate-mpeg2-field-enc +FATE_TESTS += fate-mpeg2-field-enc fate-mpeg2-field-enc: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -an -FATE2_TESTS += fate-qcelp +FATE_TESTS += fate-qcelp fate-qcelp: CMD = pcm -i $(SAMPLES)/qcp/0036580847.QCP fate-qcelp: CMP = oneoff fate-qcelp: REF = $(SAMPLES)/qcp/0036580847.pcm -FATE2_TESTS += fate-qdm2 +FATE_TESTS += fate-qdm2 fate-qdm2: CMD = pcm -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.mov fate-qdm2: CMP = oneoff fate-qdm2: REF = $(SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.pcm fate-qdm2: FUZZ = 2 -FATE2_TESTS += fate-imc +FATE_TESTS += fate-imc fate-imc: CMD = pcm -i $(SAMPLES)/imc/imc.avi fate-imc: CMP = oneoff fate-imc: REF = $(SAMPLES)/imc/imc.pcm -FATE2_TESTS += fate-yop +FATE_TESTS += fate-yop fate-yop: CMD = framecrc -i $(SAMPLES)/yop/test1.yop -pix_fmt rgb24 -an -FATE2_TESTS += fate-pictor +FATE_TESTS += fate-pictor fate-pictor: CMD = framecrc -i $(SAMPLES)/pictor/MFISH.PIC -pix_fmt rgb24 -an -FATE2_TESTS += fate-dts +FATE_TESTS += fate-dts fate-dts: CMD = pcm -i $(SAMPLES)/dts/dts.ts fate-dts: CMP = oneoff fate-dts: REF = $(SAMPLES)/dts/dts.pcm -FATE2_TESTS += fate-nellymoser +FATE_TESTS += fate-nellymoser fate-nellymoser: CMD = pcm -i $(SAMPLES)/nellymoser/nellymoser.flv fate-nellymoser: CMP = oneoff fate-nellymoser: REF = $(SAMPLES)/nellymoser/nellymoser.pcm -FATE2_TESTS += fate-truespeech +FATE_TESTS += fate-truespeech fate-truespeech: CMD = pcm -i $(SAMPLES)/truespeech/a6.wav fate-truespeech: CMP = oneoff fate-truespeech: REF = $(SAMPLES)/truespeech/a6.pcm -FATE2_TESTS += fate-ac3-2.0 +FATE_TESTS += fate-ac3-2.0 fate-ac3-2.0: CMD = pcm -i $(SAMPLES)/ac3/monsters_inc_2.0_192_small.ac3 fate-ac3-2.0: CMP = oneoff fate-ac3-2.0: REF = $(SAMPLES)/ac3/monsters_inc_2.0_192_small.pcm -FATE2_TESTS += fate-ac3-5.1 +FATE_TESTS += fate-ac3-5.1 fate-ac3-5.1: CMD = pcm -i $(SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3 fate-ac3-5.1: CMP = oneoff fate-ac3-5.1: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small.pcm -FATE2_TESTS += fate-eac3-1 +FATE_TESTS += fate-eac3-1 fate-eac3-1: CMD = pcm -i $(SAMPLES)/eac3/csi_miami_5.1_256_spx_small.eac3 fate-eac3-1: CMP = oneoff fate-eac3-1: REF = $(SAMPLES)/eac3/csi_miami_5.1_256_spx_small.pcm -FATE2_TESTS += fate-eac3-2 +FATE_TESTS += fate-eac3-2 fate-eac3-2: CMD = pcm -i $(SAMPLES)/eac3/csi_miami_stereo_128_spx_small.eac3 fate-eac3-2: CMP = oneoff fate-eac3-2: REF = $(SAMPLES)/eac3/csi_miami_stereo_128_spx_small.pcm -FATE2_TESTS += fate-eac3-3 +FATE_TESTS += fate-eac3-3 fate-eac3-3: CMD = pcm -i $(SAMPLES)/eac3/matrix2_commentary1_stereo_192_small.eac3 fate-eac3-3: CMP = oneoff fate-eac3-3: REF = $(SAMPLES)/eac3/matrix2_commentary1_stereo_192_small.pcm -FATE2_TESTS += fate-eac3-4 +FATE_TESTS += fate-eac3-4 fate-eac3-4: CMD = pcm -i $(SAMPLES)/eac3/serenity_english_5.1_1536_small.eac3 fate-eac3-4: CMP = oneoff fate-eac3-4: REF = $(SAMPLES)/eac3/serenity_english_5.1_1536_small.pcm -FATE2_TESTS += fate-atrac1 +FATE_TESTS += fate-atrac1 fate-atrac1: CMD = pcm -i $(SAMPLES)/atrac1/test_tones_small.aea fate-atrac1: CMP = oneoff fate-atrac1: REF = $(SAMPLES)/atrac1/test_tones_small.pcm -FATE2_TESTS += fate-atrac3-1 +FATE_TESTS += fate-atrac3-1 fate-atrac3-1: CMD = pcm -i $(SAMPLES)/atrac3/mc_sich_at3_066_small.wav fate-atrac3-1: CMP = oneoff fate-atrac3-1: REF = $(SAMPLES)/atrac3/mc_sich_at3_066_small.pcm -FATE2_TESTS += fate-atrac3-2 +FATE_TESTS += fate-atrac3-2 fate-atrac3-2: CMD = pcm -i $(SAMPLES)/atrac3/mc_sich_at3_105_small.wav fate-atrac3-2: CMP = oneoff fate-atrac3-2: REF = $(SAMPLES)/atrac3/mc_sich_at3_105_small.pcm -FATE2_TESTS += fate-atrac3-3 +FATE_TESTS += fate-atrac3-3 fate-atrac3-3: CMD = pcm -i $(SAMPLES)/atrac3/mc_sich_at3_132_small.wav fate-atrac3-3: CMP = oneoff fate-atrac3-3: REF = $(SAMPLES)/atrac3/mc_sich_at3_132_small.pcm -FATE2_TESTS += fate-gsm -fate-gsm: CMD = framecrc -i $(SAMPLES)/gsm/ciao.wav +FATE_TESTS += fate-gsm +fate-gsm: CMD = framecrc -t 10 -i $(SAMPLES)/gsm/sample-gsm-8000.mov -FATE2_TESTS += fate-msmpeg4v1 +FATE_TESTS += fate-gsm-ms +fate-gsm-ms: CMD = framecrc -i $(SAMPLES)/gsm/ciao.wav + +FATE_TESTS += fate-g722dec-1 +fate-g722dec-1: CMD = framecrc -ar 16000 -i $(SAMPLES)/g722/conf-adminmenu-162.g722 + +FATE_TESTS += fate-msmpeg4v1 fate-msmpeg4v1: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/msmpeg4v1/mpg4.avi -an -FATE2_TESTS += fate-wmavoice-7k +FATE_TESTS += fate-wmavoice-7k fate-wmavoice-7k: CMD = pcm -i $(SAMPLES)/wmavoice/streaming_CBR-7K.wma fate-wmavoice-7k: CMP = stddev fate-wmavoice-7k: REF = $(SAMPLES)/wmavoice/streaming_CBR-7K.pcm fate-wmavoice-7k: FUZZ = 3 -FATE2_TESTS += fate-wmavoice-11k +FATE_TESTS += fate-wmavoice-11k fate-wmavoice-11k: CMD = pcm -i $(SAMPLES)/wmavoice/streaming_CBR-11K.wma fate-wmavoice-11k: CMP = stddev fate-wmavoice-11k: REF = $(SAMPLES)/wmavoice/streaming_CBR-11K.pcm fate-wmavoice-11k: FUZZ = 3 -FATE2_TESTS += fate-wmavoice-19k +FATE_TESTS += fate-wmavoice-19k fate-wmavoice-19k: CMD = pcm -i $(SAMPLES)/wmavoice/streaming_CBR-19K.wma fate-wmavoice-19k: CMP = stddev fate-wmavoice-19k: REF = $(SAMPLES)/wmavoice/streaming_CBR-19K.pcm fate-wmavoice-19k: FUZZ = 3 -FATE2_TESTS += fate-wmapro-5.1 +FATE_TESTS += fate-wmapro-5.1 fate-wmapro-5.1: CMD = pcm -i $(SAMPLES)/wmapro/latin_192_mulitchannel_cut.wma fate-wmapro-5.1: CMP = oneoff fate-wmapro-5.1: REF = $(SAMPLES)/wmapro/latin_192_mulitchannel_cut.pcm -FATE2_TESTS += fate-wmapro-2ch +FATE_TESTS += fate-wmapro-2ch fate-wmapro-2ch: CMD = pcm -i $(SAMPLES)/wmapro/Beethovens_9th-1_small.wma fate-wmapro-2ch: CMP = oneoff fate-wmapro-2ch: REF = $(SAMPLES)/wmapro/Beethovens_9th-1_small.pcm + +FATE_TESTS += fate-ansi +fate-ansi: CMD = framecrc -i $(SAMPLES)/ansi/TRE-IOM5.ANS -pix_fmt rgb24 + +FATE_TESTS += fate-wmv8-drm +fate-wmv8-drm: CMD = framecrc -cryptokey 137381538c84c068111902a59c5cf6c340247c39 -i $(SAMPLES)/wmv8/wmv_drm.wmv -an + +FATE_TESTS += fate-binkaudio-dct +fate-binkaudio-dct: CMD = pcm -i $(SAMPLES)/bink/binkaudio_dct.bik +fate-binkaudio-dct: CMP = oneoff +fate-binkaudio-dct: REF = $(SAMPLES)/bink/binkaudio_dct.pcm +fate-binkaudio-dct: FUZZ = 2 + +FATE_TESTS += fate-binkaudio-rdft +fate-binkaudio-rdft: CMD = pcm -i $(SAMPLES)/bink/binkaudio_rdft.bik +fate-binkaudio-rdft: CMP = oneoff +fate-binkaudio-rdft: REF = $(SAMPLES)/bink/binkaudio_rdft.pcm +fate-binkaudio-rdft: FUZZ = 2 + +FATE_TESTS += fate-txd-pal8 +fate-txd-pal8: CMD = framecrc -i $(SAMPLES)/txd/outro.txd -pix_fmt rgb24 -an + +FATE_TESTS += fate-txd-16bpp +fate-txd-16bpp: CMD = framecrc -i $(SAMPLES)/txd/misc.txd -pix_fmt bgra -an + +FATE_TESTS += fate-vp3 +fate-vp3: CMD = framecrc -i $(SAMPLES)/vp3/vp31.avi + +FATE_TESTS += fate-fax-g3 +fate-fax-g3: CMD = framecrc -i $(SAMPLES)/CCITT_fax/G31D.TIF + +FATE_TESTS += fate-fax-g3s +fate-fax-g3s: CMD = framecrc -i $(SAMPLES)/CCITT_fax/G31DS.TIF + +FATE_TESTS += fate-ws_snd +fate-ws_snd: CMD = md5 -i $(SAMPLES)/vqa/ws_snd.vqa -f s16le + +FATE_TESTS += fate-dxa-scummvm +fate-dxa-scummvm: CMD = framecrc -i $(SAMPLES)/dxa/scummvm.dxa -pix_fmt rgb24 + +FATE_TESTS += fate-mjpegb +fate-mjpegb: CMD = framecrc -idct simple -flags +bitexact -i $(SAMPLES)/mjpegb/mjpegb_part.mov -an + +FATE_TESTS += fate-rv30 +fate-rv30: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/real/rv30.rm -an + +FATE_TESTS += fate-sha +fate-sha: libavutil/sha-test$(EXESUF) +fate-sha: CMD = run libavutil/sha-test diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate.mak chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate.mak --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate.mak 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate.mak 2010-11-06 17:21:30.000000000 +0000 @@ -302,6 +302,10 @@ fate-tiertex-seq: CMD = framecrc -i $(SAMPLES)/tiertex-seq/Gameover.seq -pix_fmt rgb24 FATE_TESTS += fate-tmv fate-tmv: CMD = framecrc -i $(SAMPLES)/tmv/pop-partial.tmv -pix_fmt rgb24 +FATE_TESTS += fate-truemotion1-15 +fate-truemotion1-15: CMD = framecrc -i $(SAMPLES)/duck/phant2-940.duk -pix_fmt rgb24 +FATE_TESTS += fate-truemotion1-24 +fate-truemotion1-24: CMD = framecrc -i $(SAMPLES)/duck/sonic3dblast_intro-partial.avi -pix_fmt rgb24 FATE_TESTS += fate-tscc-15bit fate-tscc-15bit: CMD = framecrc -i $(SAMPLES)/tscc/oneminute.avi -t 15 -pix_fmt rgb24 FATE_TESTS += fate-tscc-32bit diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate-run.sh chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate-run.sh --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate-run.sh 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate-run.sh 2010-11-06 17:21:30.000000000 +0000 @@ -1,5 +1,7 @@ #! /bin/sh +export LC_ALL=C + base=$(dirname $0) . "${base}/md5.sh" @@ -41,11 +43,12 @@ } run(){ + test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3 $target_exec $target_path/"$@" } ffmpeg(){ - $target_exec $target_path/ffmpeg "$@" + run ffmpeg -v 0 "$@" } framecrc(){ @@ -107,6 +110,7 @@ mkdir -p "$outdir" +exec 3>&2 $command > "$outfile" 2>$errfile err=$? diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate.sh chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate.sh --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/fate.sh 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/fate.sh 2010-11-06 17:21:30.000000000 +0000 @@ -9,7 +9,7 @@ test -r "$config" || die "usage: fate.sh " -workdir=$(dirname $config) +workdir=$(cd $(dirname $config) && pwd) make=make tar='tar c' @@ -46,6 +46,7 @@ ${src}/configure \ --prefix="${inst}" \ --samples="${samples}" \ + --enable-gpl \ ${arch:+--arch=$arch} \ ${cpu:+--cpu="$cpu"} \ ${cross_prefix:+--cross-prefix="$cross_prefix"} \ @@ -94,17 +95,16 @@ src=${workdir}/src build=${workdir}/build inst=${workdir}/install -report=tests/data/fate/report test -d "$src" && update || checkout || die "Error fetching source" cd ${workdir} version=$(${src}/version.sh ${src}) -test "$version" = "$(cat version 2>/dev/null)" && exit 0 -echo ${version} >version +test "$version" = "$(cat version-$slot 2>/dev/null)" && exit 0 +echo ${version} >version-$slot -rm -rf "${build}" +rm -rf "${build}" *.log mkdir -p ${build} configure >configure.log 2>&1 || fail $? "error configuring" diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/lavfi-regression.sh chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/lavfi-regression.sh --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/lavfi-regression.sh 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/lavfi-regression.sh 2010-11-06 17:21:30.000000000 +0000 @@ -22,15 +22,15 @@ fi } -do_lavfi "crop" "crop=100:100" -do_lavfi "crop_scale" "crop=100:100,scale=400:-1" -do_lavfi "crop_scale_vflip" "null,null,crop=200:200,crop=20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=100:100,vflip,scale=200:200,null,vflip,crop=100:100,null" -do_lavfi "crop_vflip" "crop=100:100,vflip" +do_lavfi "crop" "crop=iw-100:ih-100:100:100" +do_lavfi "crop_scale" "crop=iw-100:ih-100:100:100,scale=400:-1" +do_lavfi "crop_scale_vflip" "null,null,crop=iw-200:ih-200:200:200,crop=iw-20:ih-20:20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=iw-100:ih-100:100:100,vflip,scale=200:200,null,vflip,crop=iw-100:ih-100:100:100,null" +do_lavfi "crop_vflip" "crop=iw-100:ih-100:100:100,vflip" do_lavfi "null" "null" do_lavfi "scale200" "scale=200:200" do_lavfi "scale500" "scale=500:500" do_lavfi "vflip" "vflip" -do_lavfi "vflip_crop" "vflip,crop=100:100" +do_lavfi "vflip_crop" "vflip,crop=iw-100:ih-100:100:100" do_lavfi "vflip_vflip" "vflip,vflip" do_lavfi_pixfmts(){ @@ -59,6 +59,7 @@ # all these filters have exactly one input and exactly one output do_lavfi_pixfmts "crop" "100:100:100:100" +do_lavfi_pixfmts "hflip" "" do_lavfi_pixfmts "null" "" do_lavfi_pixfmts "pad" "500:400:20:20" do_lavfi_pixfmts "scale" "200:100" diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/lavf-regression.sh chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/lavf-regression.sh --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/lavf-regression.sh 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/lavf-regression.sh 2010-11-06 17:21:30.000000000 +0000 @@ -129,7 +129,7 @@ if [ -n "$do_gif" ] ; then file=${outfile}lavf.gif do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -pix_fmt rgb24 -#do_ffmpeg_crc $file -i $target_path/$file +do_ffmpeg_crc $file -i $target_path/$file -pix_fmt rgb24 fi if [ -n "$do_yuv4mpeg" ] ; then @@ -148,6 +148,10 @@ do_image_formats ppm fi +if [ -n "$do_png" ] ; then +do_image_formats png +fi + if [ -n "$do_bmp" ] ; then do_image_formats bmp fi diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/acodec/g726 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/acodec/g726 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/acodec/g726 2010-08-11 17:40:56.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/acodec/g726 2010-11-06 17:21:30.000000000 +0000 @@ -1,4 +1,4 @@ -5d8cce28f83dd33c3c7eaf43a5db5294 *./tests/data/acodec/g726.wav -24082 ./tests/data/acodec/g726.wav -4f1ba1af75dee64625a1c852e6cd01d3 *./tests/data/g726.acodec.out.wav -stddev: 8504.69 PSNR: 17.74 MAXDIFF:31645 bytes: 96104/ 1058400 +fd090ddf05cc3401cc75c4a5ace1d05a *./tests/data/acodec/g726.wav +24052 ./tests/data/acodec/g726.wav +74abea06027375111eeac1b2f8c7d3af *./tests/data/g726.acodec.out.wav +stddev: 8554.55 PSNR: 17.69 MAXDIFF:29353 bytes: 95984/ 1058400 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/ansi chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/ansi --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/ansi 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/ansi 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,17 @@ +0, 0, 768000, 0x3032d0de +0, 3600, 768000, 0xc3be5922 +0, 7200, 768000, 0xf530c476 +0, 10800, 768000, 0x11c1fb8e +0, 14400, 768000, 0x72d12da9 +0, 18000, 768000, 0x39c7a70d +0, 21600, 768000, 0x94bd32a4 +0, 25200, 768000, 0x06dd5ba1 +0, 28800, 768000, 0x9616ec95 +0, 32400, 768000, 0x6df5b9e2 +0, 36000, 768000, 0x7be7f60a +0, 39600, 768000, 0x2abc8623 +0, 43200, 768000, 0x5678bfff +0, 46800, 768000, 0x24a03042 +0, 50400, 768000, 0xfb011b23 +0, 54000, 768000, 0x925ff5e9 +0, 57600, 768000, 0x890e2a56 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/dxa-scummvm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/dxa-scummvm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/dxa-scummvm 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/dxa-scummvm 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,12 @@ +0, 0, 384000, 0xef37f34b +0, 7500, 384000, 0xef37f34b +0, 14999, 384000, 0xfca3cd8b +0, 22499, 384000, 0xfca3cd8b +0, 29999, 384000, 0x6dd34bb7 +0, 37499, 384000, 0x6dd34bb7 +0, 44998, 384000, 0xfd518717 +0, 52498, 384000, 0xfd518717 +0, 59998, 384000, 0x82db5c7b +0, 67497, 384000, 0x82db5c7b +0, 74997, 384000, 0xe280a5a6 +0, 82497, 384000, 0xe280a5a6 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/fax-g3 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/fax-g3 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/fax-g3 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/fax-g3 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1 @@ +0, 0, 1000384, 0xb758eb8b diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/fax-g3s chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/fax-g3s --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/fax-g3s 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/fax-g3s 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1 @@ +0, 0, 1000384, 0xb758eb8b diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/g722dec-1 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/g722dec-1 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/g722dec-1 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/g722dec-1 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,167 @@ +0, 0, 4096, 0xde68394d +0, 11520, 4096, 0xa5c28cb7 +0, 23040, 4096, 0x2e3c2f23 +0, 34560, 4096, 0xd7757825 +0, 46080, 4096, 0xafd1fd61 +0, 57600, 4096, 0x686afcbe +0, 69120, 4096, 0x2290e848 +0, 80640, 4096, 0xddd484ad +0, 92160, 4096, 0x148811a6 +0, 103680, 4096, 0x8b965613 +0, 115200, 4096, 0x8b095d51 +0, 126720, 4096, 0xf7625485 +0, 138240, 4096, 0x982a688c +0, 149760, 4096, 0xc290dcfc +0, 161280, 4096, 0x8bdef225 +0, 172800, 4096, 0xfca27fdc +0, 184320, 4096, 0x95eff313 +0, 195840, 4096, 0x691ed4f7 +0, 207360, 4096, 0xd7e7b492 +0, 218880, 4096, 0xb0416bfe +0, 230400, 4096, 0xf94b3ebd +0, 241920, 4096, 0x7f73ca12 +0, 253440, 4096, 0xe91da4a3 +0, 264960, 4096, 0x1f74dc0e +0, 276480, 4096, 0xd95b35e8 +0, 288000, 4096, 0x6dcdde1a +0, 299520, 4096, 0x614fd4e4 +0, 311040, 4096, 0xe38d0fd5 +0, 322560, 4096, 0xfeba2999 +0, 334080, 4096, 0x1bf541e1 +0, 345600, 4096, 0x689f50d8 +0, 357120, 4096, 0x0aa60f5f +0, 368640, 4096, 0x60ac3116 +0, 380160, 4096, 0xfa60e5e6 +0, 391680, 4096, 0xc7207c5b +0, 403200, 4096, 0x01196277 +0, 414720, 4096, 0x609ca46c +0, 426240, 4096, 0xfb799142 +0, 437760, 4096, 0x720910df +0, 449280, 4096, 0xe21a8662 +0, 460800, 4096, 0x07105120 +0, 472320, 4096, 0x593f627e +0, 483840, 4096, 0x28ddc80c +0, 495360, 4096, 0xc69ef356 +0, 506880, 4096, 0x2defc5bd +0, 518400, 4096, 0x82a4f418 +0, 529920, 4096, 0x424cb997 +0, 541440, 4096, 0x167a49b7 +0, 552960, 4096, 0x32a3e0d4 +0, 564480, 4096, 0x08a353ae +0, 576000, 4096, 0x9543577b +0, 587520, 4096, 0x2ed137cf +0, 599040, 4096, 0xd80b0538 +0, 610560, 4096, 0x2ad31bef +0, 622080, 4096, 0x1060cff8 +0, 633600, 4096, 0x76ab5ab8 +0, 645120, 4096, 0x8eedb68d +0, 656640, 4096, 0xf4e2dc46 +0, 668160, 4096, 0xc52d3326 +0, 679680, 4096, 0x25201a26 +0, 691200, 4096, 0x16419378 +0, 702720, 4096, 0x97061f3c +0, 714240, 4096, 0xd54edecd +0, 725760, 4096, 0xc830b07b +0, 737280, 4096, 0x804bae00 +0, 748800, 4096, 0xbb279150 +0, 760320, 4096, 0x95c4d5aa +0, 771840, 4096, 0xc51d5259 +0, 783360, 4096, 0x856e1ab0 +0, 794880, 4096, 0x9e6ccb12 +0, 806400, 4096, 0xa2e5c1bb +0, 817920, 4096, 0xe62fb62f +0, 829440, 4096, 0xf10e3df0 +0, 840960, 4096, 0x76def18b +0, 852480, 4096, 0xc9c3a26d +0, 864000, 4096, 0x8ec0e061 +0, 875520, 4096, 0x3d4e8512 +0, 887040, 4096, 0xec45cd46 +0, 898560, 4096, 0xa34f3ddf +0, 910080, 4096, 0x52b81c53 +0, 921600, 4096, 0xd0f0397a +0, 933120, 4096, 0x7c0de231 +0, 944640, 4096, 0xfe86c032 +0, 956160, 4096, 0x67cdb848 +0, 967680, 4096, 0x90532cc0 +0, 979200, 4096, 0x03bca9e9 +0, 990720, 4096, 0x73169fd1 +0, 1002240, 4096, 0x0b93967d +0, 1013760, 4096, 0x6486d8be +0, 1025280, 4096, 0x555cc2ac +0, 1036800, 4096, 0x07c1912e +0, 1048320, 4096, 0xe0423c66 +0, 1059840, 4096, 0xc12d0fa1 +0, 1071360, 4096, 0xdf497c2f +0, 1082880, 4096, 0x9298d1ba +0, 1094400, 4096, 0x691a4e15 +0, 1105920, 4096, 0x725adc6e +0, 1117440, 4096, 0xf68e88de +0, 1128960, 4096, 0x37a234aa +0, 1140480, 4096, 0x43fb0558 +0, 1152000, 4096, 0x653e4320 +0, 1163520, 4096, 0x651e2f13 +0, 1175040, 4096, 0x179049f9 +0, 1186560, 4096, 0xe02fbb9d +0, 1198080, 4096, 0xb7e9f2a0 +0, 1209600, 4096, 0x94ee81df +0, 1221120, 4096, 0x398a98de +0, 1232640, 4096, 0x1267594a +0, 1244160, 4096, 0x715adbaf +0, 1255680, 4096, 0x28ce1a20 +0, 1267200, 4096, 0x4f8073d0 +0, 1278720, 4096, 0x536846d3 +0, 1290240, 4096, 0x7dc7defe +0, 1301760, 4096, 0x08a28e2a +0, 1313280, 4096, 0xd717c5cd +0, 1324800, 4096, 0x5d6e1efd +0, 1336320, 4096, 0x4d0eea27 +0, 1347840, 4096, 0x70fff90c +0, 1359360, 4096, 0xd5cc8207 +0, 1370880, 4096, 0xf87cae0e +0, 1382400, 4096, 0x26814ab5 +0, 1393920, 4096, 0x9569fb8d +0, 1405440, 4096, 0x7835122e +0, 1416960, 4096, 0xa38840dd +0, 1428480, 4096, 0xfc499ba3 +0, 1440000, 4096, 0x0aa60cb0 +0, 1451520, 4096, 0x530ef56e +0, 1463040, 4096, 0xead968db +0, 1474560, 4096, 0x64484214 +0, 1486080, 4096, 0xfd0cc89e +0, 1497600, 4096, 0x0d452a5d +0, 1509120, 4096, 0x36ef8482 +0, 1520640, 4096, 0x462b641b +0, 1532160, 4096, 0x2a5c1c0c +0, 1543680, 4096, 0x8837ff80 +0, 1555200, 4096, 0x27a3de22 +0, 1566720, 4096, 0xf88d28c1 +0, 1578240, 4096, 0xed85ea97 +0, 1589760, 4096, 0x50c3e7db +0, 1601280, 4096, 0x82bcb480 +0, 1612800, 4096, 0xc50ee536 +0, 1624320, 4096, 0x086280ee +0, 1635840, 4096, 0x6f18f2b2 +0, 1647360, 4096, 0x1c7c0856 +0, 1658880, 4096, 0xc576268a +0, 1670400, 4096, 0x7a9af56d +0, 1681920, 4096, 0x6d058fc5 +0, 1693440, 4096, 0x8fb1107b +0, 1704960, 4096, 0x807588d1 +0, 1716480, 4096, 0x56178443 +0, 1728000, 4096, 0xf2460763 +0, 1739520, 4096, 0x284255f2 +0, 1751040, 4096, 0xb29d17fb +0, 1762560, 4096, 0x5e7e4633 +0, 1774080, 4096, 0x57704db1 +0, 1785600, 4096, 0xd87dcc1d +0, 1797120, 4096, 0x28d4bb93 +0, 1808640, 4096, 0x3a2e5c6c +0, 1820160, 4096, 0xf3581656 +0, 1831680, 4096, 0x42f1942f +0, 1843200, 4096, 0xe75c5092 +0, 1854720, 4096, 0x3fae7f6d +0, 1866240, 4096, 0xf99ad73e +0, 1877760, 4096, 0x80564e3e +0, 1889280, 4096, 0x8ff6ebe5 +0, 1900800, 4096, 0x436d5e69 +0, 1912320, 1368, 0xe0ebeda3 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/gsm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/gsm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/gsm 2010-08-11 17:40:57.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/gsm 2010-11-06 17:21:30.000000000 +0000 @@ -1,89 +1,500 @@ -0, 0, 640, 0xf79c59ee -0, 3600, 640, 0x6e6248be -0, 7200, 640, 0x2a5b3aed -0, 10800, 640, 0xf7012e06 -0, 14400, 640, 0x626645cd -0, 18000, 640, 0x9f482b66 -0, 21600, 640, 0xea443886 -0, 25200, 640, 0xa79b3dc0 -0, 28800, 640, 0x0161263f -0, 32400, 640, 0x61b33154 -0, 36000, 640, 0xf7fa388c -0, 39600, 640, 0xb63038e9 -0, 43200, 640, 0x61b03506 -0, 46800, 640, 0xed4e2eac -0, 50400, 640, 0x9b8127f1 -0, 54000, 640, 0xe50627be -0, 57600, 640, 0x6b5038f9 -0, 61200, 640, 0x8e794c10 -0, 64800, 640, 0x426d2c93 -0, 68400, 640, 0x9a373111 -0, 72000, 640, 0x94132ccb -0, 75600, 640, 0x610b3788 -0, 79200, 640, 0x27204206 -0, 82800, 640, 0xbdf82268 -0, 86400, 640, 0x2e653066 -0, 90000, 640, 0xccfd2328 -0, 93600, 640, 0xf2431e04 -0, 97200, 640, 0x7b412094 -0, 100800, 640, 0x5c2635fa -0, 104400, 640, 0xdcbd2c60 -0, 108000, 640, 0x65173699 -0, 111600, 640, 0xbcff19ed -0, 115200, 640, 0xf5b2206c -0, 118800, 640, 0x587e460c -0, 122400, 640, 0x2418382d -0, 126000, 640, 0xbfad2f9b -0, 129600, 640, 0x87d92d6c -0, 133200, 640, 0xdc582c69 -0, 136800, 640, 0xcfe52ebf -0, 140400, 640, 0xe0032e70 -0, 144000, 640, 0xf8a61b57 -0, 147600, 640, 0xa9ef2ee5 -0, 151200, 640, 0x7f513313 -0, 154800, 640, 0x93731177 -0, 158400, 640, 0xed2c2340 -0, 162000, 640, 0x85b02913 -0, 165600, 640, 0xa5a92f3e -0, 169200, 640, 0x72472490 -0, 172800, 640, 0x856231fc -0, 176400, 640, 0xda2e3c22 -0, 180000, 640, 0xcce84c36 -0, 183600, 640, 0x39312c78 -0, 187200, 640, 0xf1aa2365 -0, 190800, 640, 0x1dba3f7e -0, 194400, 640, 0x21953579 -0, 198000, 640, 0xbbd52c22 -0, 201600, 640, 0x45c71537 -0, 205200, 640, 0x26051cec -0, 208800, 640, 0x27ae223e -0, 212400, 640, 0x223c0bb8 -0, 216000, 640, 0xc5b72796 -0, 219600, 640, 0xe7fd294d -0, 223200, 640, 0x19042293 -0, 226800, 640, 0xa6572c6b -0, 230400, 640, 0x58ac1d16 -0, 234000, 640, 0xd0631bd6 -0, 237600, 640, 0xe74f276c -0, 241200, 640, 0x87d0295f -0, 244800, 640, 0x054e3dc8 -0, 248400, 640, 0x0ca51c2d -0, 252000, 640, 0x17a02616 -0, 255600, 640, 0x56b2235d -0, 259200, 640, 0x1cd93302 -0, 262800, 640, 0xe3672352 -0, 266400, 640, 0xc99f2e45 -0, 270000, 640, 0x36a43e9d -0, 273600, 640, 0xfcd73e87 -0, 277200, 640, 0x813b2e20 -0, 280800, 640, 0x8f7a4cac -0, 284400, 640, 0xcf3e4106 -0, 288000, 640, 0x8a752b07 -0, 291600, 640, 0xe5013dcd -0, 295200, 640, 0xda4a3d03 -0, 298800, 640, 0x05ce2c64 -0, 302400, 640, 0x1e0f42b5 -0, 306000, 640, 0xe4bd326a -0, 309600, 640, 0x701c28de -0, 313200, 640, 0xd0b02f97 -0, 316800, 640, 0x7950419b +0, 0, 320, 0x4c32ab06 +0, 1800, 320, 0x2052a4e7 +0, 3600, 320, 0xe9aeafca +0, 5400, 320, 0xde83b450 +0, 7200, 320, 0x06a6a80e +0, 9000, 320, 0xf6aeb1e2 +0, 10800, 320, 0x2623b40c +0, 12600, 320, 0x8ec69f25 +0, 14400, 320, 0xddaaac88 +0, 16200, 320, 0x9e60b713 +0, 18000, 320, 0xb738ab30 +0, 19800, 320, 0xdb4bbb92 +0, 21600, 320, 0x0370ae8b +0, 23400, 320, 0xb611a3fb +0, 25200, 320, 0x07ee8e3b +0, 27000, 320, 0xdb1ec628 +0, 28800, 320, 0xd5f1bda2 +0, 30600, 320, 0xcabb9a9c +0, 32400, 320, 0x16c8ad61 +0, 34200, 320, 0xf76fc25e +0, 36000, 320, 0x7118a10d +0, 37800, 320, 0x29f9a0db +0, 39600, 320, 0x41f2a4ef +0, 41400, 320, 0x36dfb231 +0, 43200, 320, 0xc5399eda +0, 45000, 320, 0x17d4b9e0 +0, 46800, 320, 0x2b5797ac +0, 48600, 320, 0x0128c5e7 +0, 50400, 320, 0xf4f38037 +0, 52200, 320, 0x77d6b5f2 +0, 54000, 320, 0xd94a93e0 +0, 55800, 320, 0x968daae3 +0, 57600, 320, 0xda5ba0ec +0, 59400, 320, 0x316da1ec +0, 61200, 320, 0x3a35b2d2 +0, 63000, 320, 0xca0b988f +0, 64800, 320, 0x1295b0b1 +0, 66600, 320, 0xe121ae72 +0, 68400, 320, 0x7da7ad43 +0, 70200, 320, 0x96a49cfe +0, 72000, 320, 0x70c2b1de +0, 73800, 320, 0x668d88c0 +0, 75600, 320, 0x5460b5a8 +0, 77400, 320, 0x6ac78eab +0, 79200, 320, 0x0d8dab87 +0, 81000, 320, 0xe2be94af +0, 82800, 320, 0x3487acdc +0, 84600, 320, 0x5048955a +0, 86400, 320, 0x2ef4ae0d +0, 88200, 320, 0xc765b773 +0, 90000, 320, 0xad96a486 +0, 91800, 320, 0xb9fdbf1f +0, 93600, 320, 0xf26c9ecf +0, 95400, 320, 0xbcadb535 +0, 97200, 320, 0xa8c897bc +0, 99000, 320, 0xaa58b520 +0, 100800, 320, 0xcb48a716 +0, 102600, 320, 0x4d5da564 +0, 104400, 320, 0x9809ae28 +0, 106200, 320, 0x5baeb1e4 +0, 108000, 320, 0x6a719b63 +0, 109800, 320, 0xc27d92f0 +0, 111600, 320, 0x0e9b9fe9 +0, 113400, 320, 0xbf9d9bf7 +0, 115200, 320, 0xf35aa64d +0, 117000, 320, 0x26449ce8 +0, 118800, 320, 0x58f4a997 +0, 120600, 320, 0x155da289 +0, 122400, 320, 0x63b19a5c +0, 124200, 320, 0xe01aad38 +0, 126000, 320, 0x4e0f9c43 +0, 127800, 320, 0x9447a284 +0, 129600, 320, 0xdb36a433 +0, 131400, 320, 0x799a9b2c +0, 133200, 320, 0x1526a162 +0, 135000, 320, 0x0a4ea140 +0, 136800, 320, 0xb08f9ed7 +0, 138600, 320, 0x221bab76 +0, 140400, 320, 0x4befacf0 +0, 142200, 320, 0xac489509 +0, 144000, 320, 0x57a1a5b4 +0, 145800, 320, 0x81e8ab97 +0, 147600, 320, 0xc6ada4d6 +0, 149400, 320, 0x12489975 +0, 151200, 320, 0x1da59ba9 +0, 153000, 320, 0xf225ac62 +0, 154800, 320, 0x8c8e9eab +0, 156600, 320, 0x10599dec +0, 158400, 320, 0x06c39fa5 +0, 160200, 320, 0xb0efa3c4 +0, 162000, 320, 0x72caadab +0, 163800, 320, 0xe4619ff0 +0, 165600, 320, 0x49bca017 +0, 167400, 320, 0x413f9fbe +0, 169200, 320, 0x6eaed0ee +0, 171000, 320, 0x27e4b1eb +0, 172800, 320, 0x8c42a30f +0, 174600, 320, 0x0afaa0f4 +0, 176400, 320, 0x0f74b76b +0, 178200, 320, 0xa9a2b9d5 +0, 180000, 320, 0xde2a8712 +0, 181800, 320, 0xcfc8b3a2 +0, 183600, 320, 0x768cadce +0, 185400, 320, 0x3a8a97f1 +0, 187200, 320, 0x502fa59b +0, 189000, 320, 0x4c3e9b0f +0, 190800, 320, 0x1cd2b111 +0, 192600, 320, 0xa845a5a3 +0, 194400, 320, 0xa6b8b982 +0, 196200, 320, 0x4d5caab9 +0, 198000, 320, 0x7993b604 +0, 199800, 320, 0x8d19b37b +0, 201600, 320, 0xbe48adb6 +0, 203400, 320, 0x7d68ab8e +0, 205200, 320, 0xbfffb0e2 +0, 207000, 320, 0x90b5b7e3 +0, 208800, 320, 0x9fa1b016 +0, 210600, 320, 0x70abafc9 +0, 212400, 320, 0x82cfad9c +0, 214200, 320, 0x05f6aa2c +0, 216000, 320, 0x511cbb5b +0, 217800, 320, 0xd27caaa6 +0, 219600, 320, 0x781ca481 +0, 221400, 320, 0x12e9ad1a +0, 223200, 320, 0xe46b989d +0, 225000, 320, 0x76dbb0a7 +0, 226800, 320, 0x10eba486 +0, 228600, 320, 0x2269a7c8 +0, 230400, 320, 0x084a9c7e +0, 232200, 320, 0x84eda891 +0, 234000, 320, 0x2ef9a639 +0, 235800, 320, 0x8bb2a0dd +0, 237600, 320, 0x47e5a169 +0, 239400, 320, 0x98faae42 +0, 241200, 320, 0x81d2aba4 +0, 243000, 320, 0x5af8bb33 +0, 244800, 320, 0x331e8d9f +0, 246600, 320, 0xd9b0c09a +0, 248400, 320, 0xbaf9bfcf +0, 250200, 320, 0x54e89ab5 +0, 252000, 320, 0x1d62c1d2 +0, 253800, 320, 0xead6b436 +0, 255600, 320, 0x465f98bc +0, 257400, 320, 0xe707a346 +0, 259200, 320, 0xf66cb1c2 +0, 261000, 320, 0xcfc89ae6 +0, 262800, 320, 0x0b10b796 +0, 264600, 320, 0xb29caf2c +0, 266400, 320, 0x0284a9d1 +0, 268200, 320, 0xb966b5fc +0, 270000, 320, 0x2defa630 +0, 271800, 320, 0xcdcd8ef3 +0, 273600, 320, 0xa81bba2b +0, 275400, 320, 0x6bc0aeb1 +0, 277200, 320, 0x38d8ac82 +0, 279000, 320, 0xeb66a865 +0, 280800, 320, 0x4fff9cd9 +0, 282600, 320, 0x6819a19b +0, 284400, 320, 0xfd7c93ce +0, 286200, 320, 0xa7419f63 +0, 288000, 320, 0x572caacb +0, 289800, 320, 0x918fb1de +0, 291600, 320, 0x0088a675 +0, 293400, 320, 0x19229cf7 +0, 295200, 320, 0x827ea812 +0, 297000, 320, 0x6c258ef7 +0, 298800, 320, 0x6a89b8fe +0, 300600, 320, 0x166c9ce0 +0, 302400, 320, 0x68b39db7 +0, 304200, 320, 0x3d5aa8ec +0, 306000, 320, 0x25e09ff3 +0, 307800, 320, 0x759aa4ce +0, 309600, 320, 0xe5aab0ea +0, 311400, 320, 0xf0359e9a +0, 313200, 320, 0x51199fff +0, 315000, 320, 0xb04aa236 +0, 316800, 320, 0xe09da0e3 +0, 318600, 320, 0x144f98a9 +0, 320400, 320, 0x0b4e9f8d +0, 322200, 320, 0xbb69a090 +0, 324000, 320, 0xec6e9b5b +0, 325800, 320, 0x4f86a477 +0, 327600, 320, 0x4a179d04 +0, 329400, 320, 0x9682a375 +0, 331200, 320, 0x3c6ba55e +0, 333000, 320, 0x50c0ab50 +0, 334800, 320, 0xe58ea907 +0, 336600, 320, 0xc5eaa021 +0, 338400, 320, 0x38859f01 +0, 340200, 320, 0x73f8a540 +0, 342000, 320, 0x395da234 +0, 343800, 320, 0x7f50b144 +0, 345600, 320, 0x45568ceb +0, 347400, 320, 0xd0508dec +0, 349200, 320, 0x60aba7e4 +0, 351000, 320, 0x4b24b15f +0, 352800, 320, 0xbfc9afd6 +0, 354600, 320, 0xf0f2ad49 +0, 356400, 320, 0xeea0a426 +0, 358200, 320, 0xff07a7c9 +0, 360000, 320, 0xce1fc788 +0, 361800, 320, 0xc074ae9b +0, 363600, 320, 0x51649696 +0, 365400, 320, 0x24399744 +0, 367200, 320, 0xfb0eb920 +0, 369000, 320, 0x3bf8af5c +0, 370800, 320, 0xeab69ee0 +0, 372600, 320, 0x182696bb +0, 374400, 320, 0x36e6af72 +0, 376200, 320, 0x48cc9ecc +0, 378000, 320, 0xfb3ca7b8 +0, 379800, 320, 0xe01aa4b4 +0, 381600, 320, 0x5c6dac8c +0, 383400, 320, 0x072fbd93 +0, 385200, 320, 0xc8899ccc +0, 387000, 320, 0xdcc990ac +0, 388800, 320, 0x28e0a9d0 +0, 390600, 320, 0x0cdbaa11 +0, 392400, 320, 0x8f4ca093 +0, 394200, 320, 0x7ee79ea9 +0, 396000, 320, 0xa762b695 +0, 397800, 320, 0x9af0b5da +0, 399600, 320, 0x1f2cb0e7 +0, 401400, 320, 0x6029b8bb +0, 403200, 320, 0xf2f7acec +0, 405000, 320, 0xb3e5b5be +0, 406800, 320, 0x266ba8a6 +0, 408600, 320, 0x4ff59296 +0, 410400, 320, 0x11d1b9ac +0, 412200, 320, 0x749197f7 +0, 414000, 320, 0x8192b517 +0, 415800, 320, 0xde129dbe +0, 417600, 320, 0x85e4a096 +0, 419400, 320, 0xdebf9182 +0, 421200, 320, 0x7a4ba0bf +0, 423000, 320, 0x55fe9fcd +0, 424800, 320, 0xd242adec +0, 426600, 320, 0xeaf5b159 +0, 428400, 320, 0xfcb1a571 +0, 430200, 320, 0x62fabda0 +0, 432000, 320, 0x45a9abcc +0, 433800, 320, 0x07af974b +0, 435600, 320, 0xc2a0b4fd +0, 437400, 320, 0xc30abccd +0, 439200, 320, 0xd33ca61c +0, 441000, 320, 0x3c33d11a +0, 442800, 320, 0x9c2ca0ac +0, 444600, 320, 0xa5d69777 +0, 446400, 320, 0xb7d2c6b8 +0, 448200, 320, 0x34bbaab9 +0, 450000, 320, 0x3e7baccb +0, 451800, 320, 0x92c6b7e6 +0, 453600, 320, 0xc810a18a +0, 455400, 320, 0x06a09f56 +0, 457200, 320, 0x8804a504 +0, 459000, 320, 0x783ba7d5 +0, 460800, 320, 0x24dcada6 +0, 462600, 320, 0x4af796be +0, 464400, 320, 0x1454b19c +0, 466200, 320, 0x0ad0a56e +0, 468000, 320, 0x8944a44e +0, 469800, 320, 0x31069ebd +0, 471600, 320, 0x19cb9812 +0, 473400, 320, 0xac75abe2 +0, 475200, 320, 0x0162a200 +0, 477000, 320, 0xa2d7a4b2 +0, 478800, 320, 0x078ca611 +0, 480600, 320, 0x0ec39b40 +0, 482400, 320, 0xe8f794b2 +0, 484200, 320, 0xc2cfb258 +0, 486000, 320, 0xe4759061 +0, 487800, 320, 0xb1b6aea4 +0, 489600, 320, 0x9bfb96df +0, 491400, 320, 0xcc61b5d3 +0, 493200, 320, 0xd14e8df9 +0, 495000, 320, 0xd9d5bbf5 +0, 496800, 320, 0x4d9fa9b0 +0, 498600, 320, 0xf606abfc +0, 500400, 320, 0x720baa19 +0, 502200, 320, 0x7f7cac49 +0, 504000, 320, 0xceab9b54 +0, 505800, 320, 0x645fa70a +0, 507600, 320, 0xa081a40f +0, 509400, 320, 0x21d78f8c +0, 511200, 320, 0xedf3abc6 +0, 513000, 320, 0x17679637 +0, 514800, 320, 0x1cb1ae04 +0, 516600, 320, 0x17cd9f62 +0, 518400, 320, 0xf4bca3ab +0, 520200, 320, 0xb3bd9152 +0, 522000, 320, 0x4e1e9825 +0, 523800, 320, 0x037e9a56 +0, 525600, 320, 0xd7589fcc +0, 527400, 320, 0x5f949e90 +0, 529200, 320, 0xe133a495 +0, 531000, 320, 0x7cb7a52c +0, 532800, 320, 0xb8b29d95 +0, 534600, 320, 0x01bca472 +0, 536400, 320, 0xbcc69895 +0, 538200, 320, 0xabffa0ee +0, 540000, 320, 0xe6629eca +0, 541800, 320, 0x572da7cd +0, 543600, 320, 0x3017972d +0, 545400, 320, 0xac4e9c78 +0, 547200, 320, 0x112f9c45 +0, 549000, 320, 0x05e9a64d +0, 550800, 320, 0x8f7394d4 +0, 552600, 320, 0xbaeea07e +0, 554400, 320, 0xd757c00e +0, 556200, 320, 0x8aa09783 +0, 558000, 320, 0x31d4ae7a +0, 559800, 320, 0x221493e8 +0, 561600, 320, 0x92f4a3a7 +0, 563400, 320, 0xbd5bafd9 +0, 565200, 320, 0x1895b760 +0, 567000, 320, 0x7a4eacdd +0, 568800, 320, 0xc9f7a1c3 +0, 570600, 320, 0xd750be06 +0, 572400, 320, 0x641d9a6f +0, 574200, 320, 0x70d6b6ff +0, 576000, 320, 0x1fd3a546 +0, 577800, 320, 0x72cfaabe +0, 579600, 320, 0x2e61b6ce +0, 581400, 320, 0x4813a091 +0, 583200, 320, 0xbfe7bc0f +0, 585000, 320, 0x8c759c1f +0, 586800, 320, 0xf4c1c952 +0, 588600, 320, 0x00fdaa79 +0, 590400, 320, 0x2ffda252 +0, 592200, 320, 0x841aa523 +0, 594000, 320, 0x8c079e5e +0, 595800, 320, 0x96e9a83f +0, 597600, 320, 0x5926a639 +0, 599400, 320, 0x02e1a07b +0, 601200, 320, 0x2972a999 +0, 603000, 320, 0x30c89c62 +0, 604800, 320, 0x83f5a263 +0, 606600, 320, 0xa3909667 +0, 608400, 320, 0xd5309fd4 +0, 610200, 320, 0x3154a571 +0, 612000, 320, 0x51039a5e +0, 613800, 320, 0xf167a344 +0, 615600, 320, 0x8e709d7d +0, 617400, 320, 0x936fa0fd +0, 619200, 320, 0x024b9e3c +0, 621000, 320, 0x2ea1aa75 +0, 622800, 320, 0x33f0a2bb +0, 624600, 320, 0xbf079d2d +0, 626400, 320, 0x847ba2c8 +0, 628200, 320, 0x37e1a767 +0, 630000, 320, 0xb607acbb +0, 631800, 320, 0x1288ac6d +0, 633600, 320, 0xf60e98b3 +0, 635400, 320, 0xc6b5abdd +0, 637200, 320, 0x7feaa710 +0, 639000, 320, 0x77329fcd +0, 640800, 320, 0x91a6a715 +0, 642600, 320, 0xd0e99f24 +0, 644400, 320, 0x07089f61 +0, 646200, 320, 0x2bbda900 +0, 648000, 320, 0xad3da0d5 +0, 649800, 320, 0x997ba6d2 +0, 651600, 320, 0xb15b9dcb +0, 653400, 320, 0x17cea82f +0, 655200, 320, 0xab51a73e +0, 657000, 320, 0x77a1abd6 +0, 658800, 320, 0x0bddacad +0, 660600, 320, 0x43b3bdc4 +0, 662400, 320, 0xefe0a9ba +0, 664200, 320, 0x8eb4bc2f +0, 666000, 320, 0x39cdc190 +0, 667800, 320, 0x1ef3baff +0, 669600, 320, 0x1a6ab7e2 +0, 671400, 320, 0x444ccc69 +0, 673200, 320, 0x05ebb598 +0, 675000, 320, 0x4ac5b0ad +0, 676800, 320, 0x0ee5ba52 +0, 678600, 320, 0x501d9fa0 +0, 680400, 320, 0x2038a9f4 +0, 682200, 320, 0xa61cb8b3 +0, 684000, 320, 0xdd009777 +0, 685800, 320, 0x2a2db86d +0, 687600, 320, 0xe9bab3bc +0, 689400, 320, 0xf7f8a056 +0, 691200, 320, 0x514caf14 +0, 693000, 320, 0xa220b149 +0, 694800, 320, 0xbf7ea183 +0, 696600, 320, 0x1d8dc5c6 +0, 698400, 320, 0x9182a8ea +0, 700200, 320, 0x31eba026 +0, 702000, 320, 0xcfbcc3df +0, 703800, 320, 0x3d8cb7ae +0, 705600, 320, 0xbe39aec0 +0, 707400, 320, 0xd236bf71 +0, 709200, 320, 0x9377b0b2 +0, 711000, 320, 0xb5e6b2df +0, 712800, 320, 0xa3b9bbce +0, 714600, 320, 0xa7bda251 +0, 716400, 320, 0xbf9ab162 +0, 718200, 320, 0x6928b9cb +0, 720000, 320, 0xf5cca209 +0, 721800, 320, 0xfdf4afad +0, 723600, 320, 0xe7e7c216 +0, 725400, 320, 0x0c5797c6 +0, 727200, 320, 0x66c1a9ca +0, 729000, 320, 0x6b5ca48d +0, 730800, 320, 0xec04968a +0, 732600, 320, 0xaaada691 +0, 734400, 320, 0x77c3a624 +0, 736200, 320, 0xaed9a5d5 +0, 738000, 320, 0x360fac41 +0, 739800, 320, 0xa05ea727 +0, 741600, 320, 0x9f7b9f83 +0, 743400, 320, 0x474bc4c2 +0, 745200, 320, 0xb6078d3b +0, 747000, 320, 0x8e15a8f9 +0, 748800, 320, 0x7dc7d4a8 +0, 750600, 320, 0x55ceab6b +0, 752400, 320, 0x982cc94f +0, 754200, 320, 0x6153948f +0, 756000, 320, 0x5338c621 +0, 757800, 320, 0x2e2db6e8 +0, 759600, 320, 0x28e3a9c3 +0, 761400, 320, 0x74d7b435 +0, 763200, 320, 0xcf17a10c +0, 765000, 320, 0xf1f9ac8c +0, 766800, 320, 0x35e0b480 +0, 768600, 320, 0x5e60b3a4 +0, 770400, 320, 0x20579b26 +0, 772200, 320, 0x3e27b89b +0, 774000, 320, 0x02e4af94 +0, 775800, 320, 0x6d6897f1 +0, 777600, 320, 0x1582b267 +0, 779400, 320, 0x33ba9eb3 +0, 781200, 320, 0xb6acad7d +0, 783000, 320, 0x1969a6c2 +0, 784800, 320, 0x363fa350 +0, 786600, 320, 0xae50bf65 +0, 788400, 320, 0x0877a50f +0, 790200, 320, 0x66e2a42f +0, 792000, 320, 0x0b0abcb3 +0, 793800, 320, 0x23a9afaa +0, 795600, 320, 0xc3729b40 +0, 797400, 320, 0xdd3fc7e2 +0, 799200, 320, 0x7e0494af +0, 801000, 320, 0xcbd096fb +0, 802800, 320, 0x5d71b303 +0, 804600, 320, 0xeedca04a +0, 806400, 320, 0x2836a47d +0, 808200, 320, 0x7237c2a0 +0, 810000, 320, 0x7c009bc0 +0, 811800, 320, 0xc9dcb366 +0, 813600, 320, 0x4993aac8 +0, 815400, 320, 0x05ec9954 +0, 817200, 320, 0xa955bd5c +0, 819000, 320, 0x9018aea3 +0, 820800, 320, 0x780cca52 +0, 822600, 320, 0x9b8f95f6 +0, 824400, 320, 0xcd7bb178 +0, 826200, 320, 0xfec6b443 +0, 828000, 320, 0xe214abb6 +0, 829800, 320, 0xdcbebb38 +0, 831600, 320, 0xe683a30d +0, 833400, 320, 0xe4cdb197 +0, 835200, 320, 0xa426c432 +0, 837000, 320, 0x761ba6cc +0, 838800, 320, 0xcc9aa6aa +0, 840600, 320, 0x742bd03d +0, 842400, 320, 0x61d9a511 +0, 844200, 320, 0x3021a4dd +0, 846000, 320, 0x6970bbc0 +0, 847800, 320, 0x76f5a037 +0, 849600, 320, 0x758d91f2 +0, 851400, 320, 0xe854a2f1 +0, 853200, 320, 0xf994a6f8 +0, 855000, 320, 0x31ebaf40 +0, 856800, 320, 0x24699970 +0, 858600, 320, 0x37dda53e +0, 860400, 320, 0xa857a752 +0, 862200, 320, 0xc483ad1d +0, 864000, 320, 0x5966add9 +0, 865800, 320, 0x4dbab89c +0, 867600, 320, 0x2f0bb0e6 +0, 869400, 320, 0x913aaa88 +0, 871200, 320, 0x245dc1c3 +0, 873000, 320, 0xb085c5ad +0, 874800, 320, 0x9cf1b0fa +0, 876600, 320, 0x6887b543 +0, 878400, 320, 0xcad69feb +0, 880200, 320, 0xc12a8ddb +0, 882000, 320, 0x01d1bc5a +0, 883800, 320, 0x3018b7e8 +0, 885600, 320, 0x6431b0ef +0, 887400, 320, 0x3a53998e +0, 889200, 320, 0x1c80a6c6 +0, 891000, 320, 0x6639adc5 +0, 892800, 320, 0x92489f9a +0, 894600, 320, 0x8cafad00 +0, 896400, 320, 0xca0392e1 +0, 898200, 320, 0x30a9ae88 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/gsm-ms chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/gsm-ms --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/gsm-ms 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/gsm-ms 2010-11-06 17:21:30.000000000 +0000 @@ -0,0 +1,89 @@ +0, 0, 640, 0xf79c59ee +0, 3600, 640, 0x6e6248be +0, 7200, 640, 0x2a5b3aed +0, 10800, 640, 0xf7012e06 +0, 14400, 640, 0x626645cd +0, 18000, 640, 0x9f482b66 +0, 21600, 640, 0xea443886 +0, 25200, 640, 0xa79b3dc0 +0, 28800, 640, 0x0161263f +0, 32400, 640, 0x61b33154 +0, 36000, 640, 0xf7fa388c +0, 39600, 640, 0xb63038e9 +0, 43200, 640, 0x61b03506 +0, 46800, 640, 0xed4e2eac +0, 50400, 640, 0x9b8127f1 +0, 54000, 640, 0xe50627be +0, 57600, 640, 0x6b5038f9 +0, 61200, 640, 0x8e794c10 +0, 64800, 640, 0x426d2c93 +0, 68400, 640, 0x9a373111 +0, 72000, 640, 0x94132ccb +0, 75600, 640, 0x610b3788 +0, 79200, 640, 0x27204206 +0, 82800, 640, 0xbdf82268 +0, 86400, 640, 0x2e653066 +0, 90000, 640, 0xccfd2328 +0, 93600, 640, 0xf2431e04 +0, 97200, 640, 0x7b412094 +0, 100800, 640, 0x5c2635fa +0, 104400, 640, 0xdcbd2c60 +0, 108000, 640, 0x65173699 +0, 111600, 640, 0xbcff19ed +0, 115200, 640, 0xf5b2206c +0, 118800, 640, 0x587e460c +0, 122400, 640, 0x2418382d +0, 126000, 640, 0xbfad2f9b +0, 129600, 640, 0x87d92d6c +0, 133200, 640, 0xdc582c69 +0, 136800, 640, 0xcfe52ebf +0, 140400, 640, 0xe0032e70 +0, 144000, 640, 0xf8a61b57 +0, 147600, 640, 0xa9ef2ee5 +0, 151200, 640, 0x7f513313 +0, 154800, 640, 0x93731177 +0, 158400, 640, 0xed2c2340 +0, 162000, 640, 0x85b02913 +0, 165600, 640, 0xa5a92f3e +0, 169200, 640, 0x72472490 +0, 172800, 640, 0x856231fc +0, 176400, 640, 0xda2e3c22 +0, 180000, 640, 0xcce84c36 +0, 183600, 640, 0x39312c78 +0, 187200, 640, 0xf1aa2365 +0, 190800, 640, 0x1dba3f7e +0, 194400, 640, 0x21953579 +0, 198000, 640, 0xbbd52c22 +0, 201600, 640, 0x45c71537 +0, 205200, 640, 0x26051cec +0, 208800, 640, 0x27ae223e +0, 212400, 640, 0x223c0bb8 +0, 216000, 640, 0xc5b72796 +0, 219600, 640, 0xe7fd294d +0, 223200, 640, 0x19042293 +0, 226800, 640, 0xa6572c6b +0, 230400, 640, 0x58ac1d16 +0, 234000, 640, 0xd0631bd6 +0, 237600, 640, 0xe74f276c +0, 241200, 640, 0x87d0295f +0, 244800, 640, 0x054e3dc8 +0, 248400, 640, 0x0ca51c2d +0, 252000, 640, 0x17a02616 +0, 255600, 640, 0x56b2235d +0, 259200, 640, 0x1cd93302 +0, 262800, 640, 0xe3672352 +0, 266400, 640, 0xc99f2e45 +0, 270000, 640, 0x36a43e9d +0, 273600, 640, 0xfcd73e87 +0, 277200, 640, 0x813b2e20 +0, 280800, 640, 0x8f7a4cac +0, 284400, 640, 0xcf3e4106 +0, 288000, 640, 0x8a752b07 +0, 291600, 640, 0xe5013dcd +0, 295200, 640, 0xda4a3d03 +0, 298800, 640, 0x05ce2c64 +0, 302400, 640, 0x1e0f42b5 +0, 306000, 640, 0xe4bd326a +0, 309600, 640, 0x701c28de +0, 313200, 640, 0xd0b02f97 +0, 316800, 640, 0x7950419b diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/mjpegb chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/mjpegb --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/mjpegb 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/mjpegb 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,10 @@ +0, 0, 38400, 0x45311080 +0, 7500, 38400, 0x9474f731 +0, 15000, 38400, 0x429ebb12 +0, 22500, 38400, 0x472c199a +0, 30000, 38400, 0xefd49dae +0, 37500, 38400, 0x78627fa9 +0, 45000, 38400, 0x2a8d9148 +0, 52500, 38400, 0x21cc6738 +0, 60000, 38400, 0x0bc4703f +0, 67500, 38400, 0x1ddcc035 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/rv30 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/rv30 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/rv30 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/rv30 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,46 @@ +0, 0, 126720, 0xcefaec47 +0, 7500, 126720, 0xa416ece5 +0, 15000, 126720, 0xa416ece5 +0, 22500, 126720, 0xa416ece5 +0, 30000, 126720, 0xcc10f4b7 +0, 37500, 126720, 0xeb6fb8d7 +0, 45000, 126720, 0xda71b917 +0, 52500, 126720, 0xbb1abbb7 +0, 60000, 126720, 0x273fbc37 +0, 67500, 126720, 0x16eebbd7 +0, 75000, 126720, 0x105eb927 +0, 82500, 126720, 0x7fa3ae27 +0, 90000, 126720, 0xd115a757 +0, 97500, 126720, 0x04e7897c +0, 105000, 126720, 0x68cfda2b +0, 112500, 126720, 0xe572dfc9 +0, 120000, 126720, 0xbc3cc34f +0, 127500, 126720, 0xcf8cb0e2 +0, 135000, 126720, 0x6d1c630d +0, 142500, 126720, 0x4338e469 +0, 150000, 126720, 0x9d82ea38 +0, 157500, 126720, 0x55e0b559 +0, 165000, 126720, 0x5eefb5ef +0, 172500, 126720, 0x4b10b746 +0, 180000, 126720, 0x8b07a1db +0, 187500, 126720, 0x8c639b34 +0, 195000, 126720, 0x63eb0b9f +0, 202500, 126720, 0x31c80c83 +0, 210000, 126720, 0x78495352 +0, 217500, 126720, 0x63d609c4 +0, 225000, 126720, 0xcd2a62d8 +0, 232500, 126720, 0x4aea732d +0, 240000, 126720, 0xe3bb352c +0, 247500, 126720, 0x4b9036ad +0, 255000, 126720, 0x88b66e2d +0, 262500, 126720, 0x4a8a1b16 +0, 270000, 126720, 0x2e014eac +0, 277500, 126720, 0x83212c67 +0, 285000, 126720, 0x4937e897 +0, 292500, 126720, 0x2d38babe +0, 300000, 126720, 0xbcb43c09 +0, 307500, 126720, 0x955ffaf4 +0, 315000, 126720, 0x3337d4a2 +0, 322500, 126720, 0xe8f58c33 +0, 330000, 126720, 0x3a7f771f +0, 337500, 126720, 0xb67c39b9 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/sha chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/sha --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/sha 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/sha 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,21 @@ +Testing SHA-160 +A9993E364706816ABA3E25717850C26C9CD0D89D +84983E441C3BD26EBAAE4AA1F95129E5E54670F1 +34AA973CD4C4DAA4F61EEB2BDBAD27316534016F +A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D +84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 +34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F +Testing SHA-224 +23097D223405D8228642A477BDA255B32AADBCE4BDA0B3F7E36C9DA7 +75388B16512776CC5DBA5DA1FD890150B0C6455CB4F58B1952522525 +20794655980C91D8BBB4C1EA97618A4BF03F42581948B2EE4EE7AD67 +23097d22 3405d822 8642a477 bda255b3 2aadbce4 bda0b3f7 e36c9da7 +75388b16 512776cc 5dba5da1 fd890150 b0c6455c b4f58b19 52522525 +20794655 980c91d8 bbb4c1ea 97618a4b f03f4258 1948b2ee 4ee7ad67 +Testing SHA-256 +BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD +248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1 +CDC76E5C9914FB9281A1C7E284D73E67F1809A48A497200E046D39CCC7112CD0 +ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad +248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4 19db06c1 +cdc76e5c 9914fb92 81a1c7e2 84d73e67 f1809a48 a497200e 046d39cc c7112cd0 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/truemotion1-15 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/truemotion1-15 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/truemotion1-15 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/truemotion1-15 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,218 @@ +1, 0, 10832, 0xe1a811fa +0, 0, 161280, 0x7041748d +1, 5527, 10832, 0xb47841f9 +0, 6000, 161280, 0x3cc4dfb5 +1, 11053, 10832, 0x839eedf1 +0, 12000, 161280, 0xca3af22d +1, 16580, 10832, 0xb48b1f60 +0, 18000, 161280, 0x23ad1d85 +1, 22106, 10832, 0x743936c0 +0, 24000, 161280, 0x9c9cf364 +1, 27633, 10832, 0xe1f039fb +0, 30000, 161280, 0x1551d6a8 +1, 33159, 10832, 0xef00751a +0, 36000, 161280, 0xc39f6b95 +1, 38686, 10832, 0x401ed099 +0, 42000, 161280, 0x3b036dcc +1, 44212, 10832, 0x432a53bd +0, 48000, 161280, 0xa6fac1db +1, 49739, 10832, 0xc4276bfd +0, 54000, 161280, 0x67656b62 +1, 55265, 10832, 0x51f0fa8c +0, 60000, 161280, 0xb41f47d1 +1, 60792, 10832, 0xcebae622 +0, 66000, 161280, 0xc207249e +1, 66318, 10832, 0xe9f6dc1f +1, 71845, 10832, 0xda087fee +0, 72000, 161280, 0xbee8f843 +1, 77371, 10832, 0x67a621bb +0, 78000, 161280, 0x092acf46 +1, 82898, 10832, 0xd7be207f +0, 84000, 161280, 0x8d9e2680 +1, 88424, 10832, 0x19d32507 +0, 90000, 161280, 0x8becc20c +1, 93951, 10832, 0xe1a3fbfa +0, 96000, 161280, 0x655e444e +1, 99478, 10832, 0xd10df779 +0, 102000, 161280, 0x5c112da0 +1, 105004, 10832, 0x4428e1a7 +0, 108000, 161280, 0x232fa9eb +1, 110531, 10832, 0x7ea9b33d +0, 114000, 161280, 0x9721745d +1, 116057, 10832, 0x6852a5a5 +0, 120000, 161280, 0x92f1d880 +1, 121584, 10832, 0xfeb78863 +0, 126000, 161280, 0x16233978 +1, 127110, 10832, 0xf157f928 +0, 132000, 161280, 0x19a27e69 +1, 132637, 10832, 0x86414b3e +0, 138000, 161280, 0x7b6ad73a +1, 138163, 10832, 0x2e28cdf6 +1, 143690, 10832, 0x00212e44 +0, 144000, 161280, 0xa7a674aa +1, 149216, 10832, 0x2d7f9378 +0, 150000, 161280, 0x4e434abb +1, 154743, 10832, 0x84cb25d7 +0, 156000, 161280, 0xb96eea14 +1, 160269, 10832, 0x3aca41fa +0, 162000, 161280, 0x1350188c +1, 165796, 10832, 0x27ad34b9 +0, 168000, 161280, 0x79c6f305 +1, 171322, 10832, 0xe665144a +0, 174000, 161280, 0xa9c7782d +1, 176849, 10832, 0xf9546626 +0, 180000, 161280, 0x40a4f456 +1, 182376, 10832, 0xe71c4f22 +0, 186000, 161280, 0xaf291ed6 +1, 187902, 10832, 0x5e61869c +0, 192000, 161280, 0xab29b4e1 +1, 193429, 10832, 0x571d2c10 +0, 198000, 161280, 0xbfcd2712 +1, 198955, 10832, 0xf0e08cd5 +0, 204000, 161280, 0xff22a0d7 +1, 204482, 10832, 0x66650e49 +0, 210000, 161280, 0xb0ae88a9 +1, 210008, 10832, 0x4024deaf +1, 215535, 10832, 0xda7bdb14 +0, 216000, 161280, 0x811d1259 +1, 221061, 10832, 0xc27a342f +0, 222000, 161280, 0x593c39a1 +1, 226588, 10832, 0x574fe679 +0, 228000, 161280, 0x5a5a97f8 +1, 232114, 10832, 0x37db464e +0, 234000, 161280, 0xa5639ecf +1, 237641, 10832, 0xb1fa2a83 +0, 240000, 161280, 0x543920c6 +1, 243167, 10832, 0x3d98d9b7 +0, 246000, 161280, 0xb41689ee +1, 248694, 10832, 0xb7c908e2 +0, 252000, 161280, 0xc0ad83de +1, 254220, 10832, 0x9f7e44d8 +0, 258000, 161280, 0x9e9e7456 +1, 259747, 10832, 0xae9b8774 +0, 264000, 161280, 0x777ccbfe +1, 265273, 10832, 0x36916e3f +0, 270000, 161280, 0x9c2df916 +1, 270800, 10832, 0xd785f5ef +0, 276000, 161280, 0xe0c13b35 +1, 276327, 10832, 0x2a3a5673 +1, 281853, 10832, 0x7320e379 +0, 282000, 161280, 0x39bfa5a5 +1, 287380, 10832, 0xec787be5 +0, 288000, 161280, 0x35dfb264 +1, 292906, 10832, 0xd0d13aa0 +0, 294000, 161280, 0x43018613 +1, 298433, 10832, 0x34dfcb17 +0, 300000, 161280, 0x43584b8a +1, 303959, 10832, 0x1a9c29f1 +0, 306000, 161280, 0xa5cd230a +1, 309486, 10832, 0x3e73dcc1 +0, 312000, 161280, 0x6fe2cfb3 +1, 315012, 10832, 0x7855b053 +0, 318000, 161280, 0x88a7c0db +1, 320539, 10832, 0x5588df8f +0, 324000, 161280, 0x476f1cd2 +1, 326065, 10832, 0x6f621299 +0, 330000, 161280, 0x96401d49 +1, 331592, 10832, 0xce7f39c2 +0, 336000, 161280, 0x7d932919 +1, 337118, 10832, 0xd88e6552 +0, 342000, 161280, 0x06465481 +1, 342645, 10832, 0xddc63597 +0, 348000, 161280, 0x39631520 +1, 348171, 10832, 0xe3071865 +1, 353698, 10832, 0x2a44a123 +0, 354000, 161280, 0xc3fff780 +1, 359224, 10832, 0x08d85d45 +0, 360000, 161280, 0xa81faf28 +1, 364751, 10832, 0x4dc5f83a +0, 366000, 161280, 0x7a311f4f +1, 370278, 10832, 0x89497812 +0, 372000, 161280, 0x52f9b931 +1, 375804, 10832, 0x9ee1db54 +0, 378000, 161280, 0x938cf016 +1, 381331, 10832, 0x5277d611 +0, 384000, 161280, 0xf8f6e19c +1, 386857, 10832, 0x570a619c +0, 390000, 161280, 0xca90561b +1, 392384, 10832, 0xa217d70f +0, 396000, 161280, 0x8594d06b +1, 397910, 10832, 0x6f0ecbf4 +0, 402000, 161280, 0xea32bf3b +1, 403437, 10832, 0x2704b114 +0, 408000, 161280, 0x4646111a +1, 408963, 10832, 0xf24e679f +0, 414000, 161280, 0xee891162 +1, 414490, 10832, 0x05572099 +0, 420000, 161280, 0xcfc32082 +1, 420016, 10832, 0x33942d0c +1, 425543, 10832, 0xa77ea674 +0, 426000, 161280, 0x863c281a +1, 431069, 10832, 0xeba663bc +0, 432000, 161280, 0x01b591aa +1, 436596, 10832, 0x1338524a +0, 438000, 161280, 0x211fbc62 +1, 442122, 10832, 0x6182b0b3 +0, 444000, 161280, 0xae2bafe2 +1, 447649, 10832, 0xa410a364 +0, 450000, 161280, 0xcfe46dca +1, 453176, 10832, 0x2f4374b0 +0, 456000, 161280, 0xcf8fe8a3 +1, 458702, 10832, 0xf41f3a07 +0, 462000, 161280, 0x3f8474eb +1, 464229, 10832, 0x2b1c50c6 +0, 468000, 161280, 0x06da345a +1, 469755, 10832, 0x3692ac89 +0, 474000, 161280, 0xbd4d3280 +1, 475282, 10832, 0x5d6bc87e +0, 480000, 161280, 0xb5e70fea +1, 480808, 10832, 0x1b1cda0c +0, 486000, 161280, 0x0c99c804 +1, 486335, 10832, 0x11eaa15f +1, 491861, 10832, 0x73c7d7ef +0, 492000, 161280, 0x19841ed4 +1, 497388, 10832, 0x65d7e3be +0, 498000, 161280, 0xf81dea50 +1, 502914, 10832, 0xb9c00688 +0, 504000, 161280, 0x7777d81c +1, 508441, 10832, 0x0b98c125 +0, 510000, 161280, 0x0497cfd8 +1, 513967, 10832, 0x331ed413 +0, 516000, 161280, 0x50b6eb64 +1, 519494, 10832, 0x9b68f485 +0, 522000, 161280, 0x5071fc07 +1, 525020, 10832, 0x1b865c55 +0, 528000, 161280, 0xbb7527fb +1, 530547, 10832, 0x68cef565 +0, 534000, 161280, 0x13054f1f +1, 536073, 10832, 0x3a605f15 +0, 540000, 161280, 0x4b78fb27 +1, 541600, 10832, 0xd72ff22e +0, 546000, 161280, 0xf504968f +1, 547127, 10832, 0x1c672b67 +0, 552000, 161280, 0x555b10b7 +1, 552653, 10832, 0xfd1a7e7e +0, 558000, 161280, 0xcc0dde40 +1, 558180, 10832, 0x9bf20ead +1, 563706, 10832, 0x00000000 +0, 564000, 161280, 0xcc0dde40 +1, 569233, 10832, 0x00000000 +0, 570000, 161280, 0x367f60c8 +1, 574759, 10832, 0x00000000 +0, 576000, 161280, 0x367f60c8 +1, 580286, 10832, 0x00000000 +0, 582000, 161280, 0x367f60c8 +1, 585812, 10832, 0x00000000 +0, 588000, 161280, 0x367f60c8 +1, 591339, 10832, 0x00000000 +0, 594000, 161280, 0x367f60c8 +1, 596865, 10832, 0x00000000 +0, 600000, 161280, 0x367f60c8 +1, 602392, 10832, 0x00000000 +0, 606000, 161280, 0x367f60c8 +1, 607918, 10832, 0x00000000 +0, 612000, 161280, 0x367f60c8 +1, 613445, 10832, 0x00000000 +0, 618000, 161280, 0x367f60c8 +1, 618971, 10832, 0x00000000 +0, 624000, 161280, 0x367f60c8 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/truemotion1-24 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/truemotion1-24 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/truemotion1-24 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/truemotion1-24 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,43 @@ +1, 0, 10832, 0x1597b4c8 +0, 0, 69120, 0x68beb30f +1, 5527, 10832, 0xf9479f8b +0, 6000, 69120, 0x3976f5cf +1, 11053, 10832, 0x8db50e74 +0, 12000, 69120, 0xf815bc3c +1, 16580, 10832, 0x2b33ecbb +0, 18000, 69120, 0xa7cc0ae6 +1, 22106, 10832, 0x8d0f537b +0, 24000, 69120, 0xd85ac282 +1, 27633, 10832, 0x922081c7 +0, 30000, 69120, 0xf7fd7edb +1, 33159, 10832, 0x40291f19 +0, 36000, 69120, 0x433bb6f6 +1, 38686, 10832, 0x88f5271a +0, 42000, 69120, 0xdbac8bee +1, 44212, 10832, 0x55c6bbe5 +0, 48000, 69120, 0x88e2a799 +1, 49739, 10832, 0x9b51ae82 +0, 54000, 69120, 0x49617b26 +1, 55265, 10832, 0xcdf2409b +0, 60000, 69120, 0xeb44ca01 +1, 60792, 10832, 0x0933b1a4 +0, 66000, 69120, 0x6fea37e8 +1, 66318, 10832, 0x24b77006 +1, 71845, 10832, 0xf612fa8a +0, 72000, 69120, 0xf55d74c7 +1, 77371, 10832, 0x99884b06 +0, 78000, 69120, 0xb5082ca7 +1, 82898, 10832, 0x3c746fbe +0, 84000, 69120, 0x5876d758 +1, 88424, 10832, 0x05f3b08a +1, 93951, 10832, 0xa6560483 +1, 99478, 10832, 0xd98a8e19 +1, 105004, 10832, 0xf98a0b2e +1, 110531, 10832, 0xb1039582 +1, 116057, 10832, 0x85dd5c3f +1, 121584, 10832, 0x19fc801a +1, 127110, 10832, 0x95805089 +1, 132637, 10832, 0x576fdec3 +1, 138163, 10832, 0x704a0905 +1, 143690, 10832, 0xf87ce1fa +1, 149216, 10832, 0xfc0076b9 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/txd-16bpp chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/txd-16bpp --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/txd-16bpp 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/txd-16bpp 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,11 @@ +0, 0, 16384, 0x213f9ea8 +0, 18000, 16384, 0x8185fdb1 +0, 36000, 16384, 0xf03581d1 +0, 54000, 16384, 0x629cd573 +0, 72000, 16384, 0xfe7a5b63 +0, 90000, 16384, 0x4afc05b2 +0, 108000, 16384, 0x074b8515 +0, 126000, 16384, 0x17fde900 +0, 144000, 16384, 0x831bac76 +0, 162000, 16384, 0x2fb579f3 +0, 180000, 16384, 0x68762bed diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/txd-pal8 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/txd-pal8 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/txd-pal8 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/txd-pal8 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1 @@ +0, 0, 786432, 0x56654d61 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/vp3 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/vp3 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/vp3 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/vp3 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,114 @@ +0, 0, 261120, 0xc50dec2b +0, 3600, 261120, 0xaa8d4441 +0, 7200, 261120, 0x932b0d44 +0, 10800, 261120, 0x125e1af7 +0, 14400, 261120, 0x09a763a5 +0, 18000, 261120, 0x56939852 +0, 21600, 261120, 0x0eda6d35 +0, 25200, 261120, 0x2f0d3869 +0, 28800, 261120, 0xe177c34c +0, 32400, 261120, 0x5d4e833a +0, 36000, 261120, 0x42e26e7a +0, 39600, 261120, 0xf5a60b4c +0, 43200, 261120, 0x29938341 +0, 46800, 261120, 0x0a9ebb80 +0, 50400, 261120, 0xd18c6a11 +0, 54000, 261120, 0x4b8212ac +0, 57600, 261120, 0x7902aabc +0, 61200, 261120, 0x4babac44 +0, 64800, 261120, 0xf33efa46 +0, 68400, 261120, 0x110dd40a +0, 72000, 261120, 0xae327a8a +0, 75600, 261120, 0xab757d75 +0, 79200, 261120, 0xfbd1402d +0, 82800, 261120, 0x4f2c5d31 +0, 86400, 261120, 0xc7ea2149 +0, 90000, 261120, 0x86072cf7 +0, 93600, 261120, 0x37c2f2ed +0, 97200, 261120, 0x1d51ee83 +0, 100800, 261120, 0x72291b8b +0, 104400, 261120, 0xe9c8ffaf +0, 108000, 261120, 0x657a1615 +0, 111600, 261120, 0x6f832019 +0, 115200, 261120, 0xf4445a22 +0, 118800, 261120, 0x105306f0 +0, 122400, 261120, 0x34c0c36b +0, 126000, 261120, 0x7767be18 +0, 129600, 261120, 0x88a7eaeb +0, 133200, 261120, 0x797e69e4 +0, 136800, 261120, 0x78901f02 +0, 140400, 261120, 0xbc91758e +0, 144000, 261120, 0x35d47b24 +0, 147600, 261120, 0xaf0ebc82 +0, 151200, 261120, 0x40e63004 +0, 154800, 261120, 0x70d1c5c1 +0, 158400, 261120, 0x8aea2b70 +0, 162000, 261120, 0x51f3cd81 +0, 165600, 261120, 0x8f8584b7 +0, 169200, 261120, 0x921541fb +0, 172800, 261120, 0xddd3f1ea +0, 176400, 261120, 0x6be2e960 +0, 180000, 261120, 0x72997a1f +0, 183600, 261120, 0xe70fc009 +0, 187200, 261120, 0x816a0687 +0, 190800, 261120, 0x2aa79e82 +0, 194400, 261120, 0x85f2fe5c +0, 198000, 261120, 0x000dd8b6 +0, 201600, 261120, 0x1be19dd4 +0, 205200, 261120, 0xadea80e5 +0, 208800, 261120, 0x0cc2204f +0, 212400, 261120, 0xd62968a8 +0, 216000, 261120, 0x0afc75c2 +0, 219600, 261120, 0x82341f09 +0, 223200, 261120, 0xbf7e66cd +0, 226800, 261120, 0x8f3491df +0, 230400, 261120, 0xc316d383 +0, 234000, 261120, 0x3de7f632 +0, 237600, 261120, 0xda55cfb0 +0, 241200, 261120, 0xbd88bb46 +0, 244800, 261120, 0x75444b17 +0, 248400, 261120, 0x798cc498 +0, 252000, 261120, 0xf9a60fa6 +0, 255600, 261120, 0xbd8debd7 +0, 259200, 261120, 0x7c890029 +0, 262800, 261120, 0x7a75e44a +0, 266400, 261120, 0x1f04611c +0, 270000, 261120, 0x96b3ee93 +0, 273600, 261120, 0x7fc11f39 +0, 277200, 261120, 0xe87d6864 +0, 280800, 261120, 0x6797d904 +0, 284400, 261120, 0x9e3e7bde +0, 288000, 261120, 0xc31a8039 +0, 291600, 261120, 0xe3ef4cf7 +0, 295200, 261120, 0x83c56fc9 +0, 298800, 261120, 0xb304f7aa +0, 302400, 261120, 0x039a7080 +0, 306000, 261120, 0xffb08224 +0, 309600, 261120, 0xa7be783a +0, 313200, 261120, 0x572beff3 +0, 316800, 261120, 0x1bc59ae8 +0, 320400, 261120, 0x11c8feb4 +0, 324000, 261120, 0xe2398651 +0, 327600, 261120, 0x37c3efba +0, 331200, 261120, 0xb32f0dd4 +0, 334800, 261120, 0x66880c50 +0, 338400, 261120, 0x4f7392c8 +0, 342000, 261120, 0x3d5c08f6 +0, 345600, 261120, 0xfd129211 +0, 349200, 261120, 0x9b396ebe +0, 352800, 261120, 0x75ab9a4a +0, 356400, 261120, 0xf8c4e7ea +0, 360000, 261120, 0xdd48c7c3 +0, 363600, 261120, 0xdebf20e6 +0, 367200, 261120, 0x35c32091 +0, 370800, 261120, 0xce5a49c7 +0, 374400, 261120, 0x69fc8e0d +0, 378000, 261120, 0x43a08b41 +0, 381600, 261120, 0x01a0513c +0, 385200, 261120, 0x1d3f490a +0, 388800, 261120, 0xb44df252 +0, 392400, 261120, 0x1259753e +0, 396000, 261120, 0x4a1538d6 +0, 399600, 261120, 0xd5ed4bd5 +0, 403200, 261120, 0xa21590b5 +0, 406800, 261120, 0xfb2de1f7 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/wmv8-drm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/wmv8-drm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/wmv8-drm 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/wmv8-drm 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,162 @@ +0, 0, 84480, 0x7760a00b +0, 3750, 84480, 0xfe39a1db +0, 7500, 84480, 0xfe39a1db +0, 11250, 84480, 0xfe39a1db +0, 15000, 84480, 0xfe39a1db +0, 18750, 84480, 0xfe39a1db +0, 22500, 84480, 0xfe39a1db +0, 26250, 84480, 0xfe39a1db +0, 30000, 84480, 0xfe39a1db +0, 33750, 84480, 0xfe39a1db +0, 37500, 84480, 0xfe39a1db +0, 41250, 84480, 0xfe39a1db +0, 45000, 84480, 0xfe39a1db +0, 48750, 84480, 0xfe39a1db +0, 52500, 84480, 0xfe39a1db +0, 56250, 84480, 0xfe39a1db +0, 60000, 84480, 0xfe39a1db +0, 63750, 84480, 0xfe39a1db +0, 67500, 84480, 0xfe39a1db +0, 71250, 84480, 0xfe39a1db +0, 75000, 84480, 0xfe39a1db +0, 78750, 84480, 0xfe39a1db +0, 82500, 84480, 0xfe39a1db +0, 86250, 84480, 0xfe39a1db +0, 90000, 84480, 0xfe39a1db +0, 93750, 84480, 0xfe39a1db +0, 97500, 84480, 0xfe39a1db +0, 101250, 84480, 0xfe39a1db +0, 105000, 84480, 0xfe39a1db +0, 108750, 84480, 0xd71961b4 +0, 112500, 84480, 0xc80dedba +0, 116250, 84480, 0x34d8b538 +0, 120000, 84480, 0x1a86b8e5 +0, 123750, 84480, 0xabf7c25d +0, 127500, 84480, 0x912600ee +0, 131250, 84480, 0x7ee7c70b +0, 135000, 84480, 0xe212b0d1 +0, 138750, 84480, 0xd4fa6c16 +0, 142500, 84480, 0xd10fa126 +0, 146250, 84480, 0xda91d3aa +0, 150000, 84480, 0xd90be940 +0, 153750, 84480, 0x908a009b +0, 157500, 84480, 0xdd26d6e9 +0, 161250, 84480, 0xfeda8de9 +0, 165000, 84480, 0x96d66505 +0, 168750, 84480, 0xf43b4b1b +0, 172500, 84480, 0xd44122c2 +0, 176250, 84480, 0xc65da7a9 +0, 180000, 84480, 0xbf4178f2 +0, 183750, 84480, 0x96be846a +0, 187500, 84480, 0x73e6459e +0, 191250, 84480, 0x70086917 +0, 195000, 84480, 0x9b12571d +0, 198750, 84480, 0xe4ce7bce +0, 202500, 84480, 0x845672e5 +0, 206250, 84480, 0x1c17e189 +0, 210000, 84480, 0x12a877d0 +0, 213750, 84480, 0xca62e8ed +0, 217500, 84480, 0x87beb28f +0, 221250, 84480, 0x1ba915a4 +0, 225000, 84480, 0x159fc9c4 +0, 228750, 84480, 0xcec3e3ef +0, 232500, 84480, 0x96a42f48 +0, 236250, 84480, 0xcd17decf +0, 240000, 84480, 0x4cf95d6c +0, 243750, 84480, 0xa258400e +0, 247500, 84480, 0xb9c566d8 +0, 251250, 84480, 0xc39f6dab +0, 255000, 84480, 0xd08a0880 +0, 258750, 84480, 0x41e3a70f +0, 262500, 84480, 0x0ded83d9 +0, 266250, 84480, 0x74a915ea +0, 270000, 84480, 0x00c2c849 +0, 273750, 84480, 0x709a9b07 +0, 277500, 84480, 0xfb276daa +0, 281250, 84480, 0x89ca744b +0, 285000, 84480, 0x457ba569 +0, 288750, 84480, 0xc37c8d57 +0, 292500, 84480, 0x1890a97e +0, 296250, 84480, 0xe455b8d0 +0, 300000, 84480, 0x1f6bdbce +0, 303750, 84480, 0x9df90ed1 +0, 307500, 84480, 0xff80328c +0, 311250, 84480, 0x0e115940 +0, 315000, 84480, 0x09ddc11d +0, 318750, 84480, 0xeef241e9 +0, 322500, 84480, 0xbe3578b4 +0, 326250, 84480, 0x2a83f0f3 +0, 330000, 84480, 0xb41d01c2 +0, 333750, 84480, 0x630efd97 +0, 337500, 84480, 0xd592140d +0, 341250, 84480, 0x7110f627 +0, 345000, 84480, 0x2dbaa590 +0, 348750, 84480, 0x13d80be5 +0, 352500, 84480, 0xb8f3740d +0, 356250, 84480, 0xd9a6fcef +0, 360000, 84480, 0x56bfa4e3 +0, 363750, 84480, 0x49364550 +0, 367500, 84480, 0x0a2f1690 +0, 371250, 84480, 0xb87fccbf +0, 375000, 84480, 0xb2aa69f7 +0, 378750, 84480, 0x176bf378 +0, 382500, 84480, 0xe7a6de45 +0, 386250, 84480, 0x8e3900a6 +0, 390000, 84480, 0x24a72099 +0, 393750, 84480, 0x5394df95 +0, 397500, 84480, 0xd648c92e +0, 401250, 84480, 0xab95fb62 +0, 405000, 84480, 0xe3239cb0 +0, 408750, 84480, 0xb4f93467 +0, 412500, 84480, 0x94d0d01d +0, 416250, 84480, 0x6316a25e +0, 420000, 84480, 0x6316a25e +0, 423750, 84480, 0x6316a25e +0, 427500, 84480, 0x6316a25e +0, 431250, 84480, 0x6316a25e +0, 435000, 84480, 0x6316a25e +0, 438750, 84480, 0x6316a25e +0, 442500, 84480, 0xae1c8854 +0, 446250, 84480, 0x30fe68bf +0, 450000, 84480, 0xfd1435c8 +0, 453750, 84480, 0xddf57fab +0, 457500, 84480, 0xc3553a51 +0, 461250, 84480, 0xd9ce7ae8 +0, 465000, 84480, 0x671765cb +0, 468750, 84480, 0x78336eab +0, 472500, 84480, 0xb66b659c +0, 476250, 84480, 0x0e1f68bb +0, 480000, 84480, 0x8f4669dc +0, 483750, 84480, 0x60c47360 +0, 487500, 84480, 0x93037246 +0, 491250, 84480, 0xdebe620d +0, 495000, 84480, 0x7555161e +0, 498750, 84480, 0xcbaf4311 +0, 502500, 84480, 0x8e3783a0 +0, 506250, 84480, 0x3888008f +0, 510000, 84480, 0x8a4fa114 +0, 513750, 84480, 0xac0bf10b +0, 517500, 84480, 0xb485ff7f +0, 521250, 84480, 0xeaec2133 +0, 525000, 84480, 0x105827cd +0, 528750, 84480, 0x55ff4b2d +0, 532500, 84480, 0x78c64a49 +0, 536250, 84480, 0x3897731d +0, 540000, 84480, 0x9ca891aa +0, 543750, 84480, 0x24a6ab0a +0, 547500, 84480, 0x88fdc6fb +0, 551250, 84480, 0x05afea61 +0, 555000, 84480, 0xe703e2cf +0, 558750, 84480, 0x9eb0e64a +0, 562500, 84480, 0x92a7f0ab +0, 566250, 84480, 0xec2bfbfb +0, 570000, 84480, 0x7db600ad +0, 573750, 84480, 0x4abd6393 +0, 577500, 84480, 0x54ce06b5 +0, 581250, 84480, 0x7cb6f150 +0, 585000, 84480, 0x099d4aeb +0, 588750, 84480, 0x0bcfdc31 +0, 592500, 84480, 0xe4e72d1f +0, 596250, 84480, 0xbce22331 +0, 600000, 84480, 0x020545d7 +0, 603750, 84480, 0x71869e48 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/ws_snd chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/ws_snd --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/fate/ws_snd 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/fate/ws_snd 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1 @@ +023317c7876aa5271f086f753d84561b diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavf/gif chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavf/gif --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavf/gif 2010-08-11 17:40:57.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavf/gif 2010-11-06 17:21:31.000000000 +0000 @@ -1,2 +1,3 @@ 98968ceb210ab260a6a7af36767b94d3 *./tests/data/lavf/lavf.gif 2906382 ./tests/data/lavf/lavf.gif +./tests/data/lavf/lavf.gif CRC=0xe5605ff6 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavf/gxf chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavf/gxf --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavf/gxf 2010-08-11 17:40:57.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavf/gxf 2010-11-06 17:21:31.000000000 +0000 @@ -1,3 +1,3 @@ -5b9c8da067585aeb04e5fb31e021cbfd *./tests/data/lavf/lavf.gxf +346d38d330ab5cb0caa6b5537167bc0d *./tests/data/lavf/lavf.gxf 796392 ./tests/data/lavf/lavf.gxf ./tests/data/lavf/lavf.gxf CRC=0xad9e86eb diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavf/mpg chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavf/mpg --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavf/mpg 2010-08-11 17:40:57.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavf/mpg 2010-11-06 17:21:31.000000000 +0000 @@ -1,3 +1,3 @@ -e36a005ecca9add8bda6e0655d03716f *./tests/data/lavf/lavf.mpg +dd60652c2193670abffb8c2a123a820e *./tests/data/lavf/lavf.mpg 372736 ./tests/data/lavf/lavf.mpg ./tests/data/lavf/lavf.mpg CRC=0x2b39ed74 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavf/png chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavf/png --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavf/png 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavf/png 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,3 @@ +c162094e51dc1a3203de43e496086dfd *./tests/data/images/png/02.png +./tests/data/images/png/%02d.png CRC=0x6da01946 +248612 ./tests/data/images/png/02.png diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavfi/pixfmts_hflip_le chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavfi/pixfmts_hflip_le --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/lavfi/pixfmts_hflip_le 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/lavfi/pixfmts_hflip_le 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,72 @@ +49468c6c9ceee5d52b08b1270a909323 *./tests/data/lavfi/pixfmts_hflip_le-abgr.nut +20276703 ./tests/data/lavfi/pixfmts_hflip_le-abgr.nut +50ba9f16c6475530602f2983278b82d0 *./tests/data/lavfi/pixfmts_hflip_le-argb.nut +20276703 ./tests/data/lavfi/pixfmts_hflip_le-argb.nut +cc53d2011d097972db0d22756c3699e3 *./tests/data/lavfi/pixfmts_hflip_le-bgr24.nut +15207903 ./tests/data/lavfi/pixfmts_hflip_le-bgr24.nut +aac987e7d1a6a96477cfc0b48a4285de *./tests/data/lavfi/pixfmts_hflip_le-bgr4_byte.nut +5070254 ./tests/data/lavfi/pixfmts_hflip_le-bgr4_byte.nut +ccee08679bac84a1f960c6c9070c5538 *./tests/data/lavfi/pixfmts_hflip_le-bgr555le.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-bgr555le.nut +3703466e19e1b52e03a34fd244a8e8e4 *./tests/data/lavfi/pixfmts_hflip_le-bgr565le.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-bgr565le.nut +50b505a889f0428242305acb642da107 *./tests/data/lavfi/pixfmts_hflip_le-bgr8.nut +5070254 ./tests/data/lavfi/pixfmts_hflip_le-bgr8.nut +01ca21e7e6a8d1281b4553bde8e8a404 *./tests/data/lavfi/pixfmts_hflip_le-bgra.nut +20276703 ./tests/data/lavfi/pixfmts_hflip_le-bgra.nut +03efcb4ab52a24c0af0e03cfd26c9377 *./tests/data/lavfi/pixfmts_hflip_le-gray.nut +5070254 ./tests/data/lavfi/pixfmts_hflip_le-gray.nut +9bcbca979601ddc4869f846f08f3d1dd *./tests/data/lavfi/pixfmts_hflip_le-gray16be.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-gray16be.nut +c1b8965adcc7f847ee343149ff507073 *./tests/data/lavfi/pixfmts_hflip_le-gray16le.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-gray16le.nut +754f1722fc738590cc407ac65749bfe8 *./tests/data/lavfi/pixfmts_hflip_le-rgb24.nut +15207903 ./tests/data/lavfi/pixfmts_hflip_le-rgb24.nut +10743e1577dc3198dbbc7c0b3b8f429e *./tests/data/lavfi/pixfmts_hflip_le-rgb48be.nut +30414303 ./tests/data/lavfi/pixfmts_hflip_le-rgb48be.nut +dd945a44f39119221407bf7a04f1bc49 *./tests/data/lavfi/pixfmts_hflip_le-rgb48le.nut +30414303 ./tests/data/lavfi/pixfmts_hflip_le-rgb48le.nut +c8a3f995fcf3e0919239ea2c413ddc29 *./tests/data/lavfi/pixfmts_hflip_le-rgb4_byte.nut +5070254 ./tests/data/lavfi/pixfmts_hflip_le-rgb4_byte.nut +8778ee0cf58ce9ad1d99a1eca9f95e87 *./tests/data/lavfi/pixfmts_hflip_le-rgb555le.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-rgb555le.nut +2cb690eb3fcb72da3771ad6a48931158 *./tests/data/lavfi/pixfmts_hflip_le-rgb565le.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-rgb565le.nut +9e462b811b9b6173397b9cfc1f6b2f17 *./tests/data/lavfi/pixfmts_hflip_le-rgb8.nut +5070254 ./tests/data/lavfi/pixfmts_hflip_le-rgb8.nut +d3d0dc1ecef3ed72f26a2986d0efc204 *./tests/data/lavfi/pixfmts_hflip_le-rgba.nut +20276703 ./tests/data/lavfi/pixfmts_hflip_le-rgba.nut +acb543ebbbf63eefe533e6faffc006da *./tests/data/lavfi/pixfmts_hflip_le-yuv410p.nut +5703854 ./tests/data/lavfi/pixfmts_hflip_le-yuv410p.nut +c626cf6d191139b4ca7efc0155f957f1 *./tests/data/lavfi/pixfmts_hflip_le-yuv411p.nut +7604654 ./tests/data/lavfi/pixfmts_hflip_le-yuv411p.nut +2d5c80f9ba2ddd85b2aeda3564cc7d64 *./tests/data/lavfi/pixfmts_hflip_le-yuv420p.nut +7604654 ./tests/data/lavfi/pixfmts_hflip_le-yuv420p.nut +758b0c1e2113b15e7afde48da4e4d024 *./tests/data/lavfi/pixfmts_hflip_le-yuv420p16be.nut +15207903 ./tests/data/lavfi/pixfmts_hflip_le-yuv420p16be.nut +480ccd951dcb806bc875d307e02e50a0 *./tests/data/lavfi/pixfmts_hflip_le-yuv420p16le.nut +15207903 ./tests/data/lavfi/pixfmts_hflip_le-yuv420p16le.nut +6e728f4eb9eae287c224f396d84be6ea *./tests/data/lavfi/pixfmts_hflip_le-yuv422p.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-yuv422p.nut +a05d43cd62b790087bd37083174557de *./tests/data/lavfi/pixfmts_hflip_le-yuv422p16be.nut +20276703 ./tests/data/lavfi/pixfmts_hflip_le-yuv422p16be.nut +6954abebcbc62d81068d58d0c62bdd5b *./tests/data/lavfi/pixfmts_hflip_le-yuv422p16le.nut +20276703 ./tests/data/lavfi/pixfmts_hflip_le-yuv422p16le.nut +a99e2b57ed601f39852715c9d675d0d3 *./tests/data/lavfi/pixfmts_hflip_le-yuv440p.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-yuv440p.nut +947e47f7bb5fdccc659d19b7df2b6fc3 *./tests/data/lavfi/pixfmts_hflip_le-yuv444p.nut +15207903 ./tests/data/lavfi/pixfmts_hflip_le-yuv444p.nut +e5ef45bc3d2f5b0b2542d5151340c382 *./tests/data/lavfi/pixfmts_hflip_le-yuv444p16be.nut +30414303 ./tests/data/lavfi/pixfmts_hflip_le-yuv444p16be.nut +70793e3d66d0c23a0cdedabe9c24c2a7 *./tests/data/lavfi/pixfmts_hflip_le-yuv444p16le.nut +30414303 ./tests/data/lavfi/pixfmts_hflip_le-yuv444p16le.nut +d83ec0c01498189f179ec574918185f1 *./tests/data/lavfi/pixfmts_hflip_le-yuva420p.nut +12673454 ./tests/data/lavfi/pixfmts_hflip_le-yuva420p.nut +df3aaaec3bb157c3bde5f0365af30f4f *./tests/data/lavfi/pixfmts_hflip_le-yuvj420p.nut +7604654 ./tests/data/lavfi/pixfmts_hflip_le-yuvj420p.nut +d113871528d510a192797af59df9c05c *./tests/data/lavfi/pixfmts_hflip_le-yuvj422p.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-yuvj422p.nut +e8f7ed76e57c892a1e9e27a3f29452db *./tests/data/lavfi/pixfmts_hflip_le-yuvj440p.nut +10139054 ./tests/data/lavfi/pixfmts_hflip_le-yuvj440p.nut +2c3ae369607608c6dcb0d830f00f971a *./tests/data/lavfi/pixfmts_hflip_le-yuvj444p.nut +15207903 ./tests/data/lavfi/pixfmts_hflip_le-yuvj444p.nut diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/seek/lavf_mpg chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/seek/lavf_mpg --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/seek/lavf_mpg 2010-08-11 17:40:57.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/seek/lavf_mpg 2010-11-06 17:21:31.000000000 +0000 @@ -1,53 +1,53 @@ -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681 +ret: 0 st: 0 flags:0 dts: 1.880000 pts: 1.920000 pos: 327680 size: 12894 ret: 0 st: 0 flags:0 ts: 0.788333 -ret: 0 st: 1 flags:1 dts: 0.761222 pts: 0.761222 pos: 145408 size: 261 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st: 0 flags:1 ts:-0.317500 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st: 1 flags:0 ts: 2.576667 -ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235 +ret: 0 st: 1 flags:1 dts: 2.018778 pts: 2.018778 pos: 370700 size: 235 ret: 0 st: 1 flags:1 ts: 1.470833 -ret: 0 st: 1 flags:1 dts: 1.283678 pts: 1.283678 pos: 368652 size: 379 +ret: 0 st: 1 flags:1 dts: 1.261222 pts: 1.261222 pos: 145408 size: 261 ret: 0 st:-1 flags:0 ts: 0.365002 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st:-1 flags:1 ts:-0.740831 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st: 0 flags:0 ts: 2.153333 -ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681 ret: 0 st: 0 flags:1 ts: 1.047500 -ret: 0 st: 0 flags:0 dts: 1.020000 pts: 1.060000 pos: 212992 size: 16484 +ret: 0 st: 0 flags:0 dts: 1.040000 pts: 1.080000 pos: 40960 size: 16073 ret: 0 st: 1 flags:0 ts:-0.058333 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st: 1 flags:1 ts: 2.835833 -ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235 +ret: 0 st: 1 flags:1 dts: 2.018778 pts: 2.018778 pos: 370700 size: 235 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681 +ret: 0 st: 0 flags:0 dts: 1.760000 pts: 1.800000 pos: 292864 size: 13170 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:0 dts: 0.620000 pts: 0.660000 pos: 67584 size: 15804 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st: 0 flags:0 ts:-0.481667 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st: 0 flags:1 ts: 2.412500 -ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681 ret: 0 st: 1 flags:0 ts: 1.306667 -ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235 +ret: 0 st: 1 flags:1 dts: 1.522444 pts: 1.522444 pos: 342028 size: 314 ret: 0 st: 1 flags:1 ts: 0.200844 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st:-1 flags:0 ts:-0.904994 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st:-1 flags:1 ts: 1.989173 -ret: 0 st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size: 681 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681 ret: 0 st: 0 flags:0 ts: 0.883344 -ret: 0 st: 0 flags:0 dts: 0.900000 pts: 0.940000 pos: 159744 size: 12809 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st: 0 flags:1 ts:-0.222489 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st: 1 flags:0 ts: 2.671678 -ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235 +ret: 0 st: 1 flags:1 dts: 2.018778 pts: 2.018778 pos: 370700 size: 235 ret: 0 st: 1 flags:1 ts: 1.565844 -ret: 0 st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size: 235 +ret: 0 st: 1 flags:1 dts: 1.522444 pts: 1.522444 pos: 342028 size: 314 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:0 dts: 0.500000 pts: 0.540000 pos: 26624 size: 16303 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos: 2048 size: 208 +ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/seek/rv20_rm chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/seek/rv20_rm --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/seek/rv20_rm 2010-08-11 17:40:58.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/seek/rv20_rm 2010-11-06 17:21:31.000000000 +0000 @@ -2,52 +2,52 @@ ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 239 size: 9361 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 84320 size: 11344 +ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 98158 size: 11344 ret: 0 st: 0 flags:0 ts: 0.788000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 53061 size: 10166 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 61133 size: 10166 ret: 0 st: 0 flags:1 ts:-0.317000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 239 size: 9361 ret: 0 st:-1 flags:0 ts: 2.576668 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139145 size: 11803 ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 84320 size: 11344 +ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 98158 size: 11344 ret: 0 st: 0 flags:0 ts: 0.365000 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 25990 size: 9101 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 30753 size: 9101 ret: 0 st: 0 flags:1 ts:-0.741000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 239 size: 9361 ret: 0 st:-1 flags:0 ts: 2.153336 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139145 size: 11803 ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 53061 size: 10166 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 61133 size: 10166 ret: 0 st: 0 flags:0 ts:-0.058000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 239 size: 9361 ret: 0 st: 0 flags:1 ts: 2.836000 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139145 size: 11803 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139145 size: 11803 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 25990 size: 9101 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 30753 size: 9101 ret: 0 st: 0 flags:0 ts:-0.482000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 239 size: 9361 ret: 0 st: 0 flags:1 ts: 2.413000 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139145 size: 11803 ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 84320 size: 11344 +ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 98158 size: 11344 ret: 0 st:-1 flags:1 ts: 0.200839 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 239 size: 9361 ret: 0 st: 0 flags:0 ts:-0.905000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 239 size: 9361 ret: 0 st: 0 flags:1 ts: 1.989000 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139145 size: 11803 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 53061 size: 10166 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 61133 size: 10166 ret: 0 st:-1 flags:1 ts:-0.222493 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 239 size: 9361 ret: 0 st: 0 flags:0 ts: 2.672000 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139145 size: 11803 ret: 0 st: 0 flags:1 ts: 1.566000 -ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 84320 size: 11344 +ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 98158 size: 11344 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 25990 size: 9101 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 30753 size: 9101 ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 239 size: 9361 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/vsynth1/qtrle chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/vsynth1/qtrle --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/vsynth1/qtrle 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/vsynth1/qtrle 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,4 @@ +3f070779d7deb54626515ac7f7002e63 *./tests/data/vsynth1/qtrle.mov +387772 ./tests/data/vsynth1/qtrle.mov +a3c2610e2c069c3ad22ec03da83f774f *./tests/data/qtrle.vsynth1.out.yuv +stddev: 15.14 PSNR: 24.53 MAXDIFF: 174 bytes: 7603200/ 7603200 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/vsynth1/rv20 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/vsynth1/rv20 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/vsynth1/rv20 2010-08-11 17:40:58.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/vsynth1/rv20 2010-11-06 17:21:31.000000000 +0000 @@ -1,4 +1,4 @@ -49f656b3a84bd7173ca219fae310750c *./tests/data/vsynth1/rv20.rm -627450 ./tests/data/vsynth1/rv20.rm -a94d2babdc506b95951977cb55642981 *./tests/data/rv20.vsynth1.out.yuv -stddev: 8.24 PSNR: 29.81 MAXDIFF: 108 bytes: 7603200/ 7603200 +81868601e602eee5b6d80f5ece4aaa98 *./tests/data/vsynth1/rv20.rm +646016 ./tests/data/vsynth1/rv20.rm +b45fdb0201b06f7649f44050e262c54c *./tests/data/rv20.vsynth1.out.yuv +stddev: 8.26 PSNR: 29.79 MAXDIFF: 103 bytes: 7603200/ 7603200 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/vsynth2/qtrle chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/vsynth2/qtrle --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/vsynth2/qtrle 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/vsynth2/qtrle 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,4 @@ +5346bba8e03e7de72b482efbcf712a2e *./tests/data/vsynth2/qtrle.mov +141533 ./tests/data/vsynth2/qtrle.mov +f967b290c7e6d015c0e78175db828249 *./tests/data/qtrle.vsynth2.out.yuv +stddev: 5.75 PSNR: 32.93 MAXDIFF: 92 bytes: 7603200/ 7603200 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/vsynth2/rv20 chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/vsynth2/rv20 --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/ref/vsynth2/rv20 2010-08-11 17:40:58.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/ref/vsynth2/rv20 2010-11-06 17:21:31.000000000 +0000 @@ -1,4 +1,4 @@ -d864475aa16d84dd99de13e65003672a *./tests/data/vsynth2/rv20.rm -132734 ./tests/data/vsynth2/rv20.rm -c66afdcc0daac2f1b4167b9811968877 *./tests/data/rv20.vsynth2.out.yuv -stddev: 5.42 PSNR: 33.45 MAXDIFF: 81 bytes: 7603200/ 7603200 +96acb098850b9bf309f89e48b08fe96f *./tests/data/vsynth2/rv20.rm +153302 ./tests/data/vsynth2/rv20.rm +46f314e70d9bac2e7d82cfc230534977 *./tests/data/rv20.vsynth2.out.yuv +stddev: 5.48 PSNR: 33.35 MAXDIFF: 81 bytes: 7603200/ 7603200 diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/regression-funcs.sh chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/regression-funcs.sh --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tests/regression-funcs.sh 2010-08-11 17:40:58.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tests/regression-funcs.sh 2010-11-06 17:21:31.000000000 +0000 @@ -41,9 +41,15 @@ mkdir -p "$outfile" mkdir -p "$logdir" -[ "${V-0}" -gt 0 ] && echov=echo || echov=: +(exec >&3) 2>/dev/null || exec 3>&2 + +[ "${V-0}" -gt 0 ] && echov=echov || echov=: [ "${V-0}" -gt 1 ] || exec 2>$errfile +echov(){ + echo "$@" >&3 +} + . $(dirname $0)/md5.sh FFMPEG_OPTS="-v 0 -y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact" diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/graph2dot.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/graph2dot.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/graph2dot.c 2010-08-11 17:40:58.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/graph2dot.c 2010-11-06 17:21:31.000000000 +0000 @@ -67,8 +67,9 @@ dst_filter_ctx->filter->name); fprintf(outfile, "\"%s\" -> \"%s\"", filter_ctx_label, dst_filter_ctx_label); - fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d\"];\n", - av_pix_fmt_descriptors[link->format].name, link->w, link->h); + fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ];\n", + av_pix_fmt_descriptors[link->format].name, link->w, link->h, + link->time_base.num, link->time_base.den); } } } @@ -151,9 +152,7 @@ return 1; } - if (avfilter_graph_check_validity(graph, NULL) || - avfilter_graph_config_formats(graph, NULL) || - avfilter_graph_config_links (graph, NULL)) + if (avfilter_graph_config(graph, NULL) < 0) return 1; print_digraph(outfile, graph); diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/jauche_sortierer.sh chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/jauche_sortierer.sh --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/jauche_sortierer.sh 1970-01-01 00:00:00.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/jauche_sortierer.sh 2010-11-06 17:21:31.000000000 +0000 @@ -0,0 +1,21 @@ +#!/bin/sh +#GPL +#TODO +#add pixelformat/sampleformat into the path of the codecs + +FFP=../ffprobe +TMP=$(mktemp) || exit 1 +TARGET=$1 +shift + +for v do + BASE=$(basename $v) + echo $v | egrep -i '(public|private)' >/dev/null && echo Warning $v may be private + $FFP $v 2> $TMP + FORM=$((grep 'Input #0, ' -m1 $TMP || echo 'Input #0, unknown') | sed 's/Input #0, \([a-zA-Z0-9_]*\).*/\1/' ) + mkdir -p $TARGET/container/$FORM + ln -s $v $TARGET/container/$FORM/$BASE + eval $(grep 'Stream #0\.[^:]*: [a-zA-Z0-9][^:]*: [a-zA-Z0-9]' $TMP | sed 's#[^:]*: \([a-zA-Z0-9]*\)[^:]*: \([a-zA-Z0-9]*\).*#mkdir -p '$TARGET'/\1/\2 ; ln -s '$v' '$TARGET'/\1/\2/'$BASE' ; #') +done + +rm $TMP diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/lavfi-showfiltfmts.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/lavfi-showfiltfmts.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/lavfi-showfiltfmts.c 2010-08-11 17:40:58.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/lavfi-showfiltfmts.c 2010-11-06 17:21:31.000000000 +0000 @@ -49,7 +49,7 @@ return 1; } - if (!(filter_ctx = avfilter_open(filter, NULL))) { + if (avfilter_open(&filter_ctx, filter, NULL) < 0) { fprintf(stderr, "Inpossible to open filter with name '%s'\n", filter_name); return 1; } @@ -66,7 +66,7 @@ } for (i = 0; i < filter_ctx->output_count; i++) { AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); - link->type = filter_ctx->filter->inputs[i].type; + link->type = filter_ctx->filter->outputs[i].type; filter_ctx->outputs[i] = link; } diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/patcheck chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/patcheck --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/patcheck 2010-08-11 17:40:58.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/patcheck 2010-11-06 17:21:31.000000000 +0000 @@ -95,6 +95,9 @@ hiegrep2 "$ERE_TYPES" '(static|av_|ff_|typedef|:\+[^a-zA-Z_])' 'Non static with no ff_/av_ prefix' $* hiegrep ':\+[^}#]*else' 'missing } prior to else' $* +hiegrep '(if|while|for)\(' 'missing whitespace between keyword and ( (feel free to ignore)' $* +hiegrep '(else|do){' 'missing whitespace between keyword and { (feel free to ignore)' $* +hiegrep '}(else|while)' 'missing whitespace between } and keyword (feel free to ignore)' $* #FIXME this should print the previous statement maybe hiegrep ':\+ *{ *$' '{ should be on the same line as the related previous statement' $* diff -Nru chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/probetest.c chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/probetest.c --- chromium-codecs-ffmpeg-0.6+svn20100904r58574+58998/=unpacked-tar1=/tools/probetest.c 2010-08-11 17:40:58.000000000 +0000 +++ chromium-codecs-ffmpeg-0.6+svn20101129r67548+69665/=unpacked-tar1=/tools/probetest.c 2010-11-06 17:21:31.000000000 +0000 @@ -30,9 +30,9 @@ static void probe(AVProbeData *pd, int type, int p, int size) { int i = 0; - AVInputFormat *fmt; + AVInputFormat *fmt = NULL; - for (fmt = first_iformat; fmt != NULL; fmt = fmt->next) { + while ((fmt = av_iformat_next(fmt))) { if (fmt->flags & AVFMT_NOFILE) continue; if (fmt->read_probe) {