From 09a5c2452cab8931f70ecb51705114682c962f98 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 7 Oct 2010 00:44:52 +0100 Subject: [PATCH 001/528] configure: fix mktemp test and fallback function --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 123de515b5..895b855859 100755 --- a/configure +++ b/configure @@ -1792,11 +1792,11 @@ HOSTEXESUF=$(exesuf $host_os) : ${TMPDIR:=$TMP} : ${TMPDIR:=/tmp} -if ! check_cmd type mktemp; then +if ! check_cmd mktemp -u; then # simple replacement for missing mktemp # NOT SAFE FOR GENERAL USE mktemp(){ - echo "${2%XXX*}.${HOSTNAME}.${UID}.$$" + echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$" } fi From a4f5af13fb00d7f55946470bb0f52e1dbf5f3c6a Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 18 Jan 2011 17:58:49 +0000 Subject: [PATCH 002/528] Add regression test for stereo s16le in voc. Signed-off-by: Mans Rullgard --- tests/lavf-regression.sh | 6 +++++- tests/ref/lavf/voc_s16 | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/ref/lavf/voc_s16 diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh index 736629bb67..b14a58efcd 100755 --- a/tests/lavf-regression.sh +++ b/tests/lavf-regression.sh @@ -40,7 +40,7 @@ do_image_formats() do_audio_only() { file=${outfile}lavf.$1 - do_ffmpeg $file -t 1 -qscale 10 -f s16le -i $pcm_src + do_ffmpeg $file -t 1 -qscale 10 $2 -f s16le -i $pcm_src $3 do_ffmpeg_crc $file -i $target_path/$file } @@ -206,6 +206,10 @@ if [ -n "$do_voc" ] ; then do_audio_only voc fi +if [ -n "$do_voc_s16" ] ; then +do_audio_only s16.voc "-ac 2" "-acodec pcm_s16le" +fi + if [ -n "$do_ogg" ] ; then do_audio_only ogg fi diff --git a/tests/ref/lavf/voc_s16 b/tests/ref/lavf/voc_s16 new file mode 100644 index 0000000000..425d9655ad --- /dev/null +++ b/tests/ref/lavf/voc_s16 @@ -0,0 +1,3 @@ +b20728bf036d2e23508869acbad4e576 *./tests/data/lavf/lavf.s16.voc +163840 ./tests/data/lavf/lavf.s16.voc +./tests/data/lavf/lavf.s16.voc CRC=0xfa9b6c39 From c3897d7690fffe016de8ed56fdbdb9d685dbcce2 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 19 Jan 2011 20:02:05 +0000 Subject: [PATCH 003/528] Fix use of sstep/dstep in ff_iir_filter(). Signed-off-by: Mans Rullgard --- libavcodec/iirfilter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 90af43190e..65d9f89386 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -158,7 +158,7 @@ void ff_iir_filter(const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s *dst = av_clip_int16(lrintf(res)); s->x[c->order - 1] = in; src += sstep; - dst += sstep; + dst += dstep; } } } From b9c7f66e6da8ac77eaa0c3fb6d476e6fc929b3c9 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 19 Jan 2011 20:30:18 -0500 Subject: [PATCH 004/528] Fix horizontal/horizontal_up 8x8l intra prediction x86/simd functions. The original functions did not work correctly for edge pixels, e.g. when CODEC_FLAG_EMU_EDGE is set, leading to corrupt output in e.g. VLC. Based on a patch by Daniel Kang . Signed-off-by: Ronald S. Bultje --- libavcodec/x86/h264_intrapred.asm | 32 ++++++++++--------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm index afe6426a3f..dbe6b8ad61 100644 --- a/libavcodec/x86/h264_intrapred.asm +++ b/libavcodec/x86/h264_intrapred.asm @@ -1249,7 +1249,10 @@ cglobal pred8x8l_horizontal_%1, 4,4 sub r0, r3 lea r2, [r0+r3*2] movq mm0, [r0+r3*1-8] - punpckhbw mm0, [r0+r3*0-8] + test r1, r1 + lea r1, [r0+r3] + cmovnz r1, r0 + punpckhbw mm0, [r1+r3*0-8] movq mm1, [r2+r3*1-8] punpckhbw mm1, [r0+r3*2-8] mov r2, r0 @@ -1264,21 +1267,12 @@ cglobal pred8x8l_horizontal_%1, 4,4 punpckhdq mm3, mm1 lea r0, [r0+r3*2] movq mm0, [r0+r3*0-8] - movq mm1, [r2] + movq mm1, [r1+r3*0-8] mov r0, r2 movq mm4, mm3 movq mm2, mm3 PALIGNR mm4, mm0, 7, mm0 PALIGNR mm1, mm2, 1, mm2 - test r1, r1 ; top_left - jnz .do_left -.fix_lt_1: - movq mm5, mm3 - pxor mm5, mm4 - psrlq mm5, 56 - psllq mm5, 48 - pxor mm1, mm5 -.do_left: movq mm0, mm4 PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5 movq mm4, mm0 @@ -2153,7 +2147,10 @@ cglobal pred8x8l_horizontal_up_%1, 4,4 sub r0, r3 lea r2, [r0+r3*2] movq mm0, [r0+r3*1-8] - punpckhbw mm0, [r0+r3*0-8] + test r1, r1 + lea r1, [r0+r3] + cmovnz r1, r0 + punpckhbw mm0, [r1+r3*0-8] movq mm1, [r2+r3*1-8] punpckhbw mm1, [r0+r3*2-8] mov r2, r0 @@ -2168,21 +2165,12 @@ cglobal pred8x8l_horizontal_up_%1, 4,4 punpckhdq mm3, mm1 lea r0, [r0+r3*2] movq mm0, [r0+r3*0-8] - movq mm1, [r2] + movq mm1, [r1+r3*0-8] mov r0, r2 movq mm4, mm3 movq mm2, mm3 PALIGNR mm4, mm0, 7, mm0 PALIGNR mm1, mm2, 1, mm2 - test r1, r1 - jnz .do_left -.fix_lt_1: - movq mm5, mm3 - pxor mm5, mm4 - psrlq mm5, 56 - psllq mm5, 48 - pxor mm1, mm5 -.do_left: movq mm0, mm4 PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5 movq mm4, mm0 From 69688e71bc4c4318209e8d4e3861c47186caebda Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Thu, 20 Jan 2011 09:26:40 +0200 Subject: [PATCH 005/528] Add service_provider and service_name metadata This patch adds support in mpegts muxer for using service_provider and service_name metadata to set service_provider_name and service_name fields in SDT. Example usage: ffmpeg -i file.ts -f mpegts -re -acodec copy -vcodec copy -f mpegts \ -metadata service_provider="Some provider" \ -metadata service_name="Some Channel" \ "udp://239.0.70.2:5000?pkt_size=1316&ttl=1" Signed-off-by: Mans Rullgard --- libavformat/avformat.h | 2 ++ libavformat/mpegtsenc.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index b484649693..c72c58f0fe 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -161,6 +161,8 @@ struct AVFormatContext; * E.g for "Also sprach Zarathustra", artist would be "Richard * Strauss" and performer "London Philharmonic Orchestra". * publisher -- name of the label/publisher. + * service_name -- name of the service in broadcasting (channel name). + * service_provider -- name of the service provider in broadcasting. * title -- name of the work. * track -- number of this work in the set, can be in form current/total. */ diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index bfd21db139..14bbd62ab4 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -391,18 +391,22 @@ static int mpegts_write_header(AVFormatContext *s) MpegTSWriteStream *ts_st; MpegTSService *service; AVStream *st, *pcr_st = NULL; - AVMetadataTag *title; + AVMetadataTag *title, *provider; int i, j; const char *service_name; + const char *provider_name; int *pids; ts->tsid = DEFAULT_TSID; ts->onid = DEFAULT_ONID; /* allocate a single DVB service */ title = av_metadata_get(s->metadata, "title", NULL, 0); + if (!title) + title = av_metadata_get(s->metadata, "service_name", NULL, 0); service_name = title ? title->value : DEFAULT_SERVICE_NAME; - service = mpegts_add_service(ts, DEFAULT_SID, - DEFAULT_PROVIDER_NAME, service_name); + provider = av_metadata_get(s->metadata, "service_provider", NULL, 0); + provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME; + service = mpegts_add_service(ts, DEFAULT_SID, provider_name, service_name); service->pmt.write_packet = section_write_packet; service->pmt.opaque = s; service->pmt.cc = 15; From c0dd5653043ca57848dfa480d02d581c7eb1d710 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Thu, 20 Jan 2011 10:04:45 +0200 Subject: [PATCH 006/528] libavcodec minor version is > 99 so fix the formating libavcodec minor version is > 99 so when printing the library versions the output is a little bit broken: libavutil 50. 36. 0 / 50.36. 0 libavcore 0. 16. 1 / 0.16. 1 libavcodec 52.108. 0 / 52.108. 0 libavformat 52. 94. 0 / 52.94. 0 libavdevice 52. 2. 3 / 52. 2. 3 libavfilter 1. 74. 0 / 1.74. 0 libswscale 0. 12. 0 / 0.12. 0 Change the formating to look like this: libavutil 50. 36. 0 / 50. 36. 0 libavcore 0. 16. 1 / 0. 16. 1 libavcodec 52.108. 0 / 52.108. 0 libavformat 52. 94. 0 / 52. 94. 0 libavdevice 52. 2. 3 / 52. 2. 3 libavfilter 1. 74. 0 / 1. 74. 0 libswscale 0. 12. 0 / 0. 12. 0 Signed-off-by: Mans Rullgard --- cmdutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdutils.c b/cmdutils.c index a77e6e67b8..295d10798a 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -378,7 +378,7 @@ static int warned_cfg = 0; const char *indent = flags & INDENT? " " : ""; \ if (flags & SHOW_VERSION) { \ unsigned int version = libname##_version(); \ - fprintf(outstream, "%slib%-10s %2d.%2d.%2d / %2d.%2d.%2d\n", \ + fprintf(outstream, "%slib%-9s %2d.%3d.%2d / %2d.%3d.%2d\n", \ indent, #libname, \ LIB##LIBNAME##_VERSION_MAJOR, \ LIB##LIBNAME##_VERSION_MINOR, \ From 46a2da7698634214eed6d269fc72d284e3d3700f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 20 Jan 2011 08:35:58 +0000 Subject: [PATCH 007/528] id3v2: make ff_id3v2_parse static Signed-off-by: Mans Rullgard --- libavformat/id3v2.c | 56 ++++++++++++++++++++++----------------------- libavformat/id3v2.h | 6 ----- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index b32ca7d94f..9cfff27210 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -50,33 +50,6 @@ int ff_id3v2_tag_len(const uint8_t * buf) return len; } -void ff_id3v2_read(AVFormatContext *s, const char *magic) -{ - int len, ret; - uint8_t buf[ID3v2_HEADER_SIZE]; - int found_header; - int64_t off; - - 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) { int v = 0; @@ -162,7 +135,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c av_metadata_set2(&s->metadata, key, val, 0); } -void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) +static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) { int isv34, tlen, unsync; char tag[5]; @@ -276,6 +249,33 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) av_free(buffer); } +void ff_id3v2_read(AVFormatContext *s, const char *magic) +{ + int len, ret; + uint8_t buf[ID3v2_HEADER_SIZE]; + int found_header; + int64_t off; + + 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); +} + const AVMetadataConv ff_id3v2_metadata_conv[] = { { "TALB", "album"}, { "TAL", "album"}, diff --git a/libavformat/id3v2.h b/libavformat/id3v2.h index 4c3041fa3c..25ee53e9b8 100644 --- a/libavformat/id3v2.h +++ b/libavformat/id3v2.h @@ -53,12 +53,6 @@ int ff_id3v2_match(const uint8_t *buf, const char *magic); */ int ff_id3v2_tag_len(const uint8_t *buf); -/** - * ID3v2 parser - * Handles ID3v2.2, 2.3 and 2.4. - */ -void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags); - /** * Read an ID3v2 tag */ From f7fcd6a2549b58a69c02622503676a8b142e4c43 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 20 Jan 2011 08:35:59 +0000 Subject: [PATCH 008/528] id3v2: convert metadata after all the tags were read Signed-off-by: Mans Rullgard --- libavformat/id3v2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 9cfff27210..4da7ec66d1 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -231,7 +231,6 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t /* 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 */ @@ -261,7 +260,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) off = url_ftell(s->pb); ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); if (ret != ID3v2_HEADER_SIZE) - return; + break; found_header = ff_id3v2_match(buf, magic); if (found_header) { /* parse ID3v2 header */ @@ -274,6 +273,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) url_fseek(s->pb, off, SEEK_SET); } } while (found_header); + ff_metadata_conv(&s->metadata, NULL, ff_id3v2_metadata_conv); } const AVMetadataConv ff_id3v2_metadata_conv[] = { From 75aded8328e35c9391e25a1c857eb6e3b801a8d8 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 20 Jan 2011 09:06:58 +0100 Subject: [PATCH 009/528] id3v2: don't overwrite existing tags Apparently some broken taggers prepend a new ID3v2 tag leaving the existing one intact. Our parser currently reads all tags and overwrites existing values with supposedly outdated ones. fixes issue2419 Signed-off-by: Mans Rullgard --- libavformat/id3v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 4da7ec66d1..95ec0b05cb 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -132,7 +132,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c val = dst; if (val) - av_metadata_set2(&s->metadata, key, val, 0); + av_metadata_set2(&s->metadata, key, val, AV_METADATA_DONT_OVERWRITE); } static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) From e8315e78814f92d6d031bd3a909d896351a416f8 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Thu, 20 Jan 2011 15:24:53 +0200 Subject: [PATCH 010/528] Set service_provider and service_name in mpegts demuxer Set service_provider and service_name in mpegts demuxer, previously name and provider_name were set but since the muxer uses service_provider and service_name use them. Signed-off-by: Mans Rullgard --- libavformat/mpegts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 01b69a70c2..959be31577 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1211,8 +1211,8 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (name) { AVProgram *program = av_new_program(ts->stream, sid); if(program) { - av_metadata_set2(&program->metadata, "name", name, 0); - av_metadata_set2(&program->metadata, "provider_name", provider_name, 0); + av_metadata_set2(&program->metadata, "service_name", name, 0); + av_metadata_set2(&program->metadata, "service_provider", provider_name, 0); } } av_free(name); From e5fe65512bfc824b9827ed29909a54122582ef2a Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Thu, 20 Jan 2011 15:03:47 +0100 Subject: [PATCH 011/528] mpegtsenc: prefer metadata keyed with "service_name" title metadata is only used as fallback if no service_name is available. Signed-off-by: Janne Grunau --- libavformat/mpegtsenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 14bbd62ab4..f33b6c6b73 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -400,9 +400,9 @@ static int mpegts_write_header(AVFormatContext *s) ts->tsid = DEFAULT_TSID; ts->onid = DEFAULT_ONID; /* allocate a single DVB service */ - title = av_metadata_get(s->metadata, "title", NULL, 0); + title = av_metadata_get(s->metadata, "service_name", NULL, 0); if (!title) - title = av_metadata_get(s->metadata, "service_name", NULL, 0); + title = av_metadata_get(s->metadata, "title", NULL, 0); service_name = title ? title->value : DEFAULT_SERVICE_NAME; provider = av_metadata_get(s->metadata, "service_provider", NULL, 0); provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME; From 0a3d7697b4fcb62305cd4a893b621a406a029ff0 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 20 Jan 2011 17:24:06 +0000 Subject: [PATCH 012/528] Add function ff_iir_filter_flt() to accept floating-point input and output. Signed-off-by: Mans Rullgard --- libavcodec/iirfilter.c | 102 ++++++++++++++++++++++++++--------------- libavcodec/iirfilter.h | 17 ++++++- 2 files changed, 80 insertions(+), 39 deletions(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 65d9f89386..e37fd810d6 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -118,48 +118,74 @@ av_cold struct FFIIRFilterState* ff_iir_filter_init_state(int order) return s; } -#define FILTER(i0, i1, i2, i3) \ - in = *src * c->gain \ - + c->cy[0]*s->x[i0] + c->cy[1]*s->x[i1] \ - + c->cy[2]*s->x[i2] + c->cy[3]*s->x[i3]; \ - res = (s->x[i0] + in )*1 \ - + (s->x[i1] + s->x[i3])*4 \ - + s->x[i2] *6; \ - *dst = av_clip_int16(lrintf(res)); \ - s->x[i0] = in; \ - src += sstep; \ - dst += dstep; \ +#define CONV_S16(dest, source) dest = av_clip_int16(lrintf(source)); + +#define CONV_FLT(dest, source) dest = source; + +#define FILTER_BW_O4_1(i0, i1, i2, i3, fmt) \ + in = *src0 * c->gain \ + + c->cy[0]*s->x[i0] + c->cy[1]*s->x[i1] \ + + c->cy[2]*s->x[i2] + c->cy[3]*s->x[i3]; \ + res = (s->x[i0] + in )*1 \ + + (s->x[i1] + s->x[i3])*4 \ + + s->x[i2] *6; \ + CONV_##fmt(*dst0, res) \ + s->x[i0] = in; \ + src0 += sstep; \ + dst0 += dstep; + +#define FILTER_BW_O4(type, fmt) { \ + int i; \ + const type *src0 = src; \ + type *dst0 = dst; \ + for (i = 0; i < size; i += 4) { \ + float in, res; \ + FILTER_BW_O4_1(0, 1, 2, 3, fmt); \ + FILTER_BW_O4_1(1, 2, 3, 0, fmt); \ + FILTER_BW_O4_1(2, 3, 0, 1, fmt); \ + FILTER_BW_O4_1(3, 0, 1, 2, fmt); \ + } \ +} + +#define FILTER_DIRECT_FORM_II(type, fmt) { \ + int i; \ + const type *src0 = src; \ + type *dst0 = dst; \ + for (i = 0; i < size; i++) { \ + int j; \ + float in, res; \ + in = *src0 * c->gain; \ + for(j = 0; j < c->order; j++) \ + in += c->cy[j] * s->x[j]; \ + res = s->x[0] + in + s->x[c->order >> 1] * c->cx[c->order >> 1]; \ + for(j = 1; j < c->order >> 1; j++) \ + res += (s->x[j] + s->x[c->order - j]) * c->cx[j]; \ + for(j = 0; j < c->order - 1; j++) \ + s->x[j] = s->x[j + 1]; \ + CONV_##fmt(*dst0, res) \ + s->x[c->order - 1] = in; \ + src0 += sstep; \ + dst0 += dstep; \ + } \ +} void ff_iir_filter(const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const int16_t *src, int sstep, int16_t *dst, int dstep) { - int i; + if (c->order == 4) { + FILTER_BW_O4(int16_t, S16) + } else { + FILTER_DIRECT_FORM_II(int16_t, S16) + } +} - if(c->order == 4){ - for(i = 0; i < size; i += 4){ - float in, res; - - FILTER(0, 1, 2, 3); - FILTER(1, 2, 3, 0); - FILTER(2, 3, 0, 1); - FILTER(3, 0, 1, 2); - } - }else{ - for(i = 0; i < size; i++){ - int j; - float in, res; - in = *src * c->gain; - for(j = 0; j < c->order; j++) - in += c->cy[j] * s->x[j]; - res = s->x[0] + in + s->x[c->order >> 1] * c->cx[c->order >> 1]; - for(j = 1; j < c->order >> 1; j++) - res += (s->x[j] + s->x[c->order - j]) * c->cx[j]; - for(j = 0; j < c->order - 1; j++) - s->x[j] = s->x[j + 1]; - *dst = av_clip_int16(lrintf(res)); - s->x[c->order - 1] = in; - src += sstep; - dst += dstep; - } +void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *c, + struct FFIIRFilterState *s, int size, + const float *src, int sstep, void *dst, int dstep) +{ + if (c->order == 4) { + FILTER_BW_O4(float, FLT) + } else { + FILTER_DIRECT_FORM_II(float, FLT) } } diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h index f660955403..fd26166862 100644 --- a/libavcodec/iirfilter.h +++ b/libavcodec/iirfilter.h @@ -87,7 +87,7 @@ void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs); void ff_iir_filter_free_state(struct FFIIRFilterState *state); /** - * Perform lowpass filtering on input samples. + * Perform IIR filtering on signed 16-bit input samples. * * @param coeffs pointer to filter coefficients * @param state pointer to filter state @@ -100,4 +100,19 @@ void ff_iir_filter_free_state(struct FFIIRFilterState *state); void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, int size, const int16_t *src, int sstep, int16_t *dst, int dstep); +/** + * Perform IIR filtering on floating-point input samples. + * + * @param coeffs pointer to filter coefficients + * @param state pointer to filter state + * @param size input length + * @param src source samples + * @param sstep source stride + * @param dst filtered samples (destination may be the same as input) + * @param dstep destination stride + */ +void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *coeffs, + struct FFIIRFilterState *state, int size, + const float *src, int sstep, void *dst, int dstep); + #endif /* AVCODEC_IIRFILTER_H */ From ebb230279aa0ecc2fda4c617860eb354531d4b63 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 20 Jan 2011 17:04:58 +0000 Subject: [PATCH 013/528] cosmetics: wrap long line Signed-off-by: Mans Rullgard --- libavcodec/iirfilter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index e37fd810d6..60313f1abe 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -169,7 +169,9 @@ av_cold struct FFIIRFilterState* ff_iir_filter_init_state(int order) } \ } -void ff_iir_filter(const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const int16_t *src, int sstep, int16_t *dst, int dstep) +void ff_iir_filter(const struct FFIIRFilterCoeffs *c, + struct FFIIRFilterState *s, int size, + const int16_t *src, int sstep, int16_t *dst, int dstep) { if (c->order == 4) { FILTER_BW_O4(int16_t, S16) From f0f54c297f1283025d423c4aed817ae31ba549cb Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 20 Jan 2011 17:52:13 +0000 Subject: [PATCH 014/528] Make PNG test depend on PNG codec Signed-off-by: Mans Rullgard --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 895b855859..441d77eeed 100755 --- a/configure +++ b/configure @@ -1486,6 +1486,7 @@ test_deps _encoder _decoder \ pbm=pbmpipe \ pcx \ pgm="pgm pgmpipe" \ + png \ ppm="ppm ppmpipe" \ rawvideo="rgb yuv" \ roq \ From d42dc217ed2b0f886ffc50b26c2bbff1fee5feca Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 20 Jan 2011 18:28:16 +0000 Subject: [PATCH 015/528] Add memory allocation failure checks to ff_iir_filter_init_coeffs(). Signed-off-by: Mans Rullgard --- libavcodec/iirfilter.c | 16 ++++++++++++---- libavcodec/iirfilter.h | 5 ++++- libavcodec/psymodel.c | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 60313f1abe..afa299f64f 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -47,7 +47,8 @@ typedef struct FFIIRFilterState{ /// maximum supported filter order #define MAXORDER 30 -av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type, +av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, + enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband, float ripple) @@ -62,9 +63,12 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType f if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0) return NULL; - c = av_malloc(sizeof(FFIIRFilterCoeffs)); - c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1)); - c->cy = av_malloc(sizeof(c->cy[0]) * order); + FF_ALLOCZ_OR_GOTO(avc, c, sizeof(FFIIRFilterCoeffs), + init_fail); + FF_ALLOC_OR_GOTO (avc, c->cx, sizeof(c->cx[0]) * ((order >> 1) + 1), + init_fail); + FF_ALLOC_OR_GOTO (avc, c->cy, sizeof(c->cy[0]) * order, + init_fail); c->order = order; wa = 2 * tan(M_PI * 0.5 * cutoff_ratio); @@ -110,6 +114,10 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType f c->gain /= 1 << order; return c; + +init_fail: + ff_iir_filter_free_coeffs(c); + return NULL; } av_cold struct FFIIRFilterState* ff_iir_filter_init_state(int order) diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h index fd26166862..f7b71f3567 100644 --- a/libavcodec/iirfilter.h +++ b/libavcodec/iirfilter.h @@ -49,6 +49,8 @@ enum IIRFilterMode{ /** * Initialize filter coefficients. * + * @param avc a pointer to an arbitrary struct of which the first + * field is a pointer to an AVClass struct * @param filt_type filter type (e.g. Butterworth) * @param filt_mode filter mode (e.g. lowpass) * @param order filter order @@ -58,7 +60,8 @@ enum IIRFilterMode{ * * @return pointer to filter coefficients structure or NULL if filter cannot be created */ -struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type, +struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, + enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband, float ripple); diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c index a2e469c5d7..fb869e7d44 100644 --- a/libavcodec/psymodel.c +++ b/libavcodec/psymodel.c @@ -88,7 +88,7 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate; if (cutoff_coeff) - ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, + ctx->fcoeffs = ff_iir_filter_init_coeffs(avctx, FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, FILT_ORDER, cutoff_coeff, 0.0, 0.0); if (ctx->fcoeffs) { ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels); From 75b98610a7ce7acf34f583a04aaccd8c619947fe Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 20 Jan 2011 18:28:17 +0000 Subject: [PATCH 016/528] cosmetics: vertical alignment and line wrap Signed-off-by: Mans Rullgard --- libavcodec/iirfilter.c | 6 +++--- libavcodec/iirfilter.h | 6 +++--- libavcodec/psymodel.c | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index afa299f64f..38c0808b90 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -49,9 +49,9 @@ typedef struct FFIIRFilterState{ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, enum IIRFilterType filt_type, - enum IIRFilterMode filt_mode, - int order, float cutoff_ratio, - float stopband, float ripple) + enum IIRFilterMode filt_mode, + int order, float cutoff_ratio, + float stopband, float ripple) { int i, j; FFIIRFilterCoeffs *c; diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h index f7b71f3567..13e1598e39 100644 --- a/libavcodec/iirfilter.h +++ b/libavcodec/iirfilter.h @@ -62,9 +62,9 @@ enum IIRFilterMode{ */ struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, enum IIRFilterType filt_type, - enum IIRFilterMode filt_mode, - int order, float cutoff_ratio, - float stopband, float ripple); + enum IIRFilterMode filt_mode, + int order, float cutoff_ratio, + float stopband, float ripple); /** * Create new filter state. diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c index fb869e7d44..8bd5b8bdd8 100644 --- a/libavcodec/psymodel.c +++ b/libavcodec/psymodel.c @@ -88,8 +88,9 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate; if (cutoff_coeff) - ctx->fcoeffs = ff_iir_filter_init_coeffs(avctx, FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, - FILT_ORDER, cutoff_coeff, 0.0, 0.0); + ctx->fcoeffs = ff_iir_filter_init_coeffs(avctx, FF_FILTER_TYPE_BUTTERWORTH, + FF_FILTER_MODE_LOWPASS, FILT_ORDER, + cutoff_coeff, 0.0, 0.0); if (ctx->fcoeffs) { ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels); for (i = 0; i < avctx->channels; i++) From 30112adadf06fe2f9500e4da365eb8a58095c940 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 20 Jan 2011 19:06:15 +0000 Subject: [PATCH 017/528] Split out Butterworth filter coeff init to a separate function. Signed-off-by: Mans Rullgard --- libavcodec/iirfilter.c | 64 ++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 38c0808b90..c0ac947289 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -47,29 +47,25 @@ typedef struct FFIIRFilterState{ /// maximum supported filter order #define MAXORDER 30 -av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, - enum IIRFilterType filt_type, - enum IIRFilterMode filt_mode, - int order, float cutoff_ratio, - float stopband, float ripple) +static int butterworth_init_coeffs(void *avc, struct FFIIRFilterCoeffs *c, + enum IIRFilterMode filt_mode, + int order, float cutoff_ratio, + float stopband) { int i, j; - FFIIRFilterCoeffs *c; double wa; double p[MAXORDER + 1][2]; - if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS) - return NULL; - if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0) - return NULL; - - FF_ALLOCZ_OR_GOTO(avc, c, sizeof(FFIIRFilterCoeffs), - init_fail); - FF_ALLOC_OR_GOTO (avc, c->cx, sizeof(c->cx[0]) * ((order >> 1) + 1), - init_fail); - FF_ALLOC_OR_GOTO (avc, c->cy, sizeof(c->cy[0]) * order, - init_fail); - c->order = order; + if (filt_mode != FF_FILTER_MODE_LOWPASS) { + av_log(avc, AV_LOG_ERROR, "Butterworth filter currently only supports " + "low-pass filter mode\n"); + return -1; + } + if (order & 1) { + av_log(avc, AV_LOG_ERROR, "Butterworth filter currently only supports " + "even filter orders\n"); + return -1; + } wa = 2 * tan(M_PI * 0.5 * cutoff_ratio); @@ -113,6 +109,38 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, } c->gain /= 1 << order; + return 0; +} + +av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, + enum IIRFilterType filt_type, + enum IIRFilterMode filt_mode, + int order, float cutoff_ratio, + float stopband, float ripple) +{ + FFIIRFilterCoeffs *c; + + if (order <= 0 || order > MAXORDER || cutoff_ratio >= 1.0) + return NULL; + + FF_ALLOCZ_OR_GOTO(avc, c, sizeof(FFIIRFilterCoeffs), + init_fail); + FF_ALLOC_OR_GOTO (avc, c->cx, sizeof(c->cx[0]) * ((order >> 1) + 1), + init_fail); + FF_ALLOC_OR_GOTO (avc, c->cy, sizeof(c->cy[0]) * order, + init_fail); + c->order = order; + + if (filt_type == FF_FILTER_TYPE_BUTTERWORTH) { + if (butterworth_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, + stopband)) { + goto init_fail; + } + } else { + av_log(avc, AV_LOG_ERROR, "filter type is not currently implemented\n"); + goto init_fail; + } + return c; init_fail: From 8bcfe7f7fd71e5d548c2cd96d33295ff06a5f6c8 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 20 Jan 2011 14:00:34 -0500 Subject: [PATCH 018/528] Set gray (128) U/V planes for chroma-less samples. Fixes two fate samples when played with -flags emu_edge. --- libavcodec/h264_cabac.c | 2 ++ libavcodec/h264_cavlc.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index 5aad4d7f58..efc2b71087 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -1373,6 +1373,8 @@ decode_intra_mb: pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode ); if( pred_mode < 0 ) return -1; h->chroma_pred_mode= pred_mode; + } else { + h->chroma_pred_mode= DC_128_PRED8x8; } } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index 55ff02294b..c9d28d0f9b 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -665,6 +665,8 @@ decode_intra_mb: if(pred_mode < 0) return -1; h->chroma_pred_mode= pred_mode; + } else { + h->chroma_pred_mode = DC_128_PRED8x8; } }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; From 66c6b5e2a5e6376c4a5c65b1d96fd7a1580bdfcf Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 20 Jan 2011 17:24:19 -0500 Subject: [PATCH 019/528] Revert 2a1f431d38ea9c05abb215d70c7dc09cdb6888ab, it broke H264 lossless. --- libavcodec/dsputil.h | 1 - libavcodec/h264.c | 97 ++++++++++++++++++++++++++++++++++++++--- libavcodec/h264.h | 1 - libavcodec/h264_cabac.c | 3 +- libavcodec/h264_cavlc.c | 3 +- libavcodec/h264data.h | 3 +- libavcodec/h264dsp.c | 1 - libavcodec/h264dsp.h | 1 - libavcodec/h264idct.c | 22 ---------- libavcodec/svq3.c | 9 ++-- 10 files changed, 99 insertions(+), 42 deletions(-) diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 157149113e..0efbad918a 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -66,7 +66,6 @@ void ff_h264_idct_add8_c(uint8_t **dest, const int *blockoffset, DCTELEM *block, void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul); void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp); -void ff_chroma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul); void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, diff --git a/libavcodec/h264.c b/libavcodec/h264.c index d0ee4744c8..40dc276dd6 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -246,6 +246,93 @@ int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){ return 0; } +#if 0 +/** + * DCT transforms the 16 dc values. + * @param qp quantization parameter ??? FIXME + */ +static void h264_luma_dc_dct_c(DCTELEM *block/*, int qp*/){ +// const int qmul= dequant_coeff[qp][0]; + int i; + int temp[16]; //FIXME check if this is a good idea + static const int x_offset[4]={0, 1*stride, 4* stride, 5*stride}; + static const int y_offset[4]={0, 2*stride, 8* stride, 10*stride}; + + for(i=0; i<4; i++){ + const int offset= y_offset[i]; + const int z0= block[offset+stride*0] + block[offset+stride*4]; + const int z1= block[offset+stride*0] - block[offset+stride*4]; + const int z2= block[offset+stride*1] - block[offset+stride*5]; + const int z3= block[offset+stride*1] + block[offset+stride*5]; + + temp[4*i+0]= z0+z3; + temp[4*i+1]= z1+z2; + temp[4*i+2]= z1-z2; + temp[4*i+3]= z0-z3; + } + + for(i=0; i<4; i++){ + const int offset= x_offset[i]; + const int z0= temp[4*0+i] + temp[4*2+i]; + const int z1= temp[4*0+i] - temp[4*2+i]; + const int z2= temp[4*1+i] - temp[4*3+i]; + const int z3= temp[4*1+i] + temp[4*3+i]; + + block[stride*0 +offset]= (z0 + z3)>>1; + block[stride*2 +offset]= (z1 + z2)>>1; + block[stride*8 +offset]= (z1 - z2)>>1; + block[stride*10+offset]= (z0 - z3)>>1; + } +} +#endif + +#undef xStride +#undef stride + +static void chroma_dc_dequant_idct_c(DCTELEM *block, int qmul){ + const int stride= 16*2; + const int xStride= 16; + int a,b,c,d,e; + + a= block[stride*0 + xStride*0]; + b= block[stride*0 + xStride*1]; + c= block[stride*1 + xStride*0]; + d= block[stride*1 + xStride*1]; + + e= a-b; + a= a+b; + b= c-d; + c= c+d; + + block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7; + block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7; + block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7; + block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7; +} + +#if 0 +static void chroma_dc_dct_c(DCTELEM *block){ + const int stride= 16*2; + const int xStride= 16; + int a,b,c,d,e; + + a= block[stride*0 + xStride*0]; + b= block[stride*0 + xStride*1]; + c= block[stride*1 + xStride*0]; + d= block[stride*1 + xStride*1]; + + e= a-b; + a= a+b; + b= c-d; + c= c+d; + + block[stride*0 + xStride*0]= (a+c); + block[stride*0 + xStride*1]= (e+b); + block[stride*1 + xStride*0]= (a-c); + block[stride*1 + xStride*1]= (e-b); +} +#endif + static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, int chroma_height, int delta, int list, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int src_x_offset, int src_y_offset, @@ -1196,19 +1283,17 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){ } } }else{ - int chroma_qpu = h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]; - int chroma_qpv = h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]; if(is_h264){ if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+0] ]) - h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+0*16, &h->mb_chroma_dc[0], chroma_qpu ); + chroma_dc_dequant_idct_c(h->mb + 16*16 , h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]); if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+1] ]) - h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, &h->mb_chroma_dc[1], chroma_qpv ); + chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]); h->h264dsp.h264_idct_add8(dest, block_offset, h->mb, uvlinesize, h->non_zero_count_cache); }else{ - h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+0*16, &h->mb_chroma_dc[0], chroma_qpu ); - h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16+4*16, &h->mb_chroma_dc[1], chroma_qpv ); + chroma_dc_dequant_idct_c(h->mb + 16*16 , 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->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]); for(i=16; i<16+8; i++){ if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i]; diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 4436f6f467..17fd680369 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -407,7 +407,6 @@ typedef struct H264Context{ DECLARE_ALIGNED(16, DCTELEM, mb)[16*24]; DECLARE_ALIGNED(16, DCTELEM, mb_luma_dc)[16]; - DECLARE_ALIGNED(16, DCTELEM, mb_chroma_dc)[2][4]; DCTELEM mb_padding[256]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb /** diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index efc2b71087..c83a7c7678 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -1689,10 +1689,9 @@ decode_intra_mb: if( cbp&0x30 ){ int c; - AV_ZERO128(h->mb_chroma_dc); for( c = 0; c < 2; c++ ) { //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c ); - decode_cabac_residual_dc(h, h->mb_chroma_dc[c], 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4); + decode_cabac_residual_dc(h, h->mb + 256 + 16*4*c, 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4); } } diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index c9d28d0f9b..63d2b3ca34 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -989,9 +989,8 @@ decode_intra_mb: } if(cbp&0x30){ - AV_ZERO128(h->mb_chroma_dc); for(chroma_idx=0; chroma_idx<2; chroma_idx++) - if( decode_residual(h, gb, h->mb_chroma_dc[chroma_idx], CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){ + if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){ return -1; } } diff --git a/libavcodec/h264data.h b/libavcodec/h264data.h index 73fcc5ce38..b3631da93b 100644 --- a/libavcodec/h264data.h +++ b/libavcodec/h264data.h @@ -79,7 +79,8 @@ static const uint8_t luma_dc_field_scan[16]={ }; static const uint8_t chroma_dc_scan[4]={ - 0,1,2,3 + (0+0*2)*16, (1+0*2)*16, + (0+1*2)*16, (1+1*2)*16, //FIXME }; // zigzag_scan8x8_cavlc[i] = zigzag_scan8x8[(i/4) + 16*(i%4)] diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c index acb458faa1..c3ee06d9df 100644 --- a/libavcodec/h264dsp.c +++ b/libavcodec/h264dsp.c @@ -283,7 +283,6 @@ void ff_h264dsp_init(H264DSPContext *c) c->h264_idct_add8 = ff_h264_idct_add8_c; c->h264_idct_add16intra= ff_h264_idct_add16intra_c; c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_c; - c->h264_chroma_dc_dequant_idct= ff_chroma_dc_dequant_idct_c; c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c; c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c; diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h index c790f4aa4d..2491c90bbb 100644 --- a/libavcodec/h264dsp.h +++ b/libavcodec/h264dsp.h @@ -68,7 +68,6 @@ typedef struct H264DSPContext{ void (*h264_idct_add8)(uint8_t **dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]); void (*h264_idct_add16intra)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]); void (*h264_luma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input/*align 16*/, int qmul); - void (*h264_chroma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input/*align 16*/, int qmul); }H264DSPContext; void ff_h264dsp_init(H264DSPContext *c); diff --git a/libavcodec/h264idct.c b/libavcodec/h264idct.c index 53e70a22df..f5b05ac24f 100644 --- a/libavcodec/h264idct.c +++ b/libavcodec/h264idct.c @@ -250,26 +250,4 @@ void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul){ output[stride* 4+offset]= ((((z1 - z2)*qmul + 128 ) >> 8)); output[stride* 5+offset]= ((((z0 - z3)*qmul + 128 ) >> 8)); } -#undef stride -} - -void ff_chroma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul){ - const int stride= 16*2; - const int xStride= 16; - int a,b,c,d,e; - - a= input[0]; - b= input[1]; - c= input[2]; - d= input[3]; - - e= a-b; - a= a+b; - b= c-d; - c= c+d; - - output[stride*0 + xStride*0]= ((a+c)*qmul) >> 7; - output[stride*0 + xStride*1]= ((e+b)*qmul) >> 7; - output[stride*1 + xStride*0]= ((a-c)*qmul) >> 7; - output[stride*1 + xStride*1]= ((e-b)*qmul) >> 7; } diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index 62a20911a3..a52744228e 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -671,12 +671,11 @@ static int svq3_decode_mb(H264Context *h, unsigned int mb_type) } if ((cbp & 0x30)) { - AV_ZERO128(h->mb_chroma_dc); for (i = 0; i < 2; ++i) { - if (svq3_decode_block(&s->gb, h->mb_chroma_dc[i], 0, 3)){ - av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n"); - return -1; - } + if (svq3_decode_block(&s->gb, &h->mb[16*(16 + 4*i)], 0, 3)){ + av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n"); + return -1; + } } if ((cbp & 0x20)) { From fcdf0a43cd267c1d4193aa172b024f35903c286e Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 20 Jan 2011 21:26:47 +0000 Subject: [PATCH 020/528] Add biquad high-pass and low-pass IIR filters. Signed-off-by: Mans Rullgard --- libavcodec/iirfilter.c | 50 ++++++++++++++++++++++++++++++++++++++++++ libavcodec/iirfilter.h | 1 + 2 files changed, 51 insertions(+) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index c0ac947289..085482032b 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -112,6 +112,51 @@ static int butterworth_init_coeffs(void *avc, struct FFIIRFilterCoeffs *c, return 0; } +static int biquad_init_coeffs(void *avc, struct FFIIRFilterCoeffs *c, + enum IIRFilterMode filt_mode, int order, + float cutoff_ratio, float stopband) +{ + double cos_w0, sin_w0; + double a0, x0, x1; + + if (filt_mode != FF_FILTER_MODE_HIGHPASS && + filt_mode != FF_FILTER_MODE_LOWPASS) { + av_log(avc, AV_LOG_ERROR, "Biquad filter currently only supports " + "high-pass and low-pass filter modes\n"); + return -1; + } + if (order != 2) { + av_log(avc, AV_LOG_ERROR, "Biquad filter must have order of 2\n"); + return -1; + } + + cos_w0 = cos(M_PI * cutoff_ratio); + sin_w0 = sin(M_PI * cutoff_ratio); + + a0 = 1.0 + (sin_w0 / 2.0); + + if (filt_mode == FF_FILTER_MODE_HIGHPASS) { + c->gain = ((1.0 + cos_w0) / 2.0) / a0; + x0 = (-(1.0 + cos_w0)) / a0; + x1 = ((1.0 + cos_w0) / 2.0) / a0; + } else { // FF_FILTER_MODE_LOWPASS + c->gain = ((1.0 - cos_w0) / 2.0) / a0; + x0 = (1.0 - cos_w0) / a0; + x1 = ((1.0 - cos_w0) / 2.0) / a0; + } + c->cy[0] = (2.0 * cos_w0) / a0; + c->cy[1] = (-1.0 + (sin_w0 / 2.0)) / a0; + + // divide by gain to make the x coeffs integers. + // during filtering, the delay state will include the gain multiplication + c->cx[0] = lrintf(x0 / c->gain); + c->cx[1] = lrintf(x1 / c->gain); + c->cy[0] /= c->gain; + c->cy[1] /= c->gain; + + return 0; +} + av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, @@ -136,6 +181,11 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, stopband)) { goto init_fail; } + } else if (filt_type == FF_FILTER_TYPE_BIQUAD) { + if (biquad_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, + stopband)) { + goto init_fail; + } } else { av_log(avc, AV_LOG_ERROR, "filter type is not currently implemented\n"); goto init_fail; diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h index 13e1598e39..c2484e23d3 100644 --- a/libavcodec/iirfilter.h +++ b/libavcodec/iirfilter.h @@ -34,6 +34,7 @@ struct FFIIRFilterState; enum IIRFilterType{ FF_FILTER_TYPE_BESSEL, + FF_FILTER_TYPE_BIQUAD, FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_TYPE_CHEBYSHEV, FF_FILTER_TYPE_ELLIPTIC, From 0361d13cf3956dcf38f31b9df97aca9301cdc86a Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 20 Jan 2011 21:59:23 +0000 Subject: [PATCH 021/528] iir: change filter type if/else to a switch. Simplifies error handling and makes it easier to add additional filter types. Signed-off-by: Mans Rullgard --- libavcodec/iirfilter.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 085482032b..6133a54055 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -164,6 +164,7 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, float stopband, float ripple) { FFIIRFilterCoeffs *c; + int ret = 0; if (order <= 0 || order > MAXORDER || cutoff_ratio >= 1.0) return NULL; @@ -176,22 +177,22 @@ av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(void *avc, init_fail); c->order = order; - if (filt_type == FF_FILTER_TYPE_BUTTERWORTH) { - if (butterworth_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, - stopband)) { - goto init_fail; - } - } else if (filt_type == FF_FILTER_TYPE_BIQUAD) { - if (biquad_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, - stopband)) { - goto init_fail; - } - } else { + switch (filt_type) { + case FF_FILTER_TYPE_BUTTERWORTH: + ret = butterworth_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, + stopband); + break; + case FF_FILTER_TYPE_BIQUAD: + ret = biquad_init_coeffs(avc, c, filt_mode, order, cutoff_ratio, + stopband); + break; + default: av_log(avc, AV_LOG_ERROR, "filter type is not currently implemented\n"); goto init_fail; } - return c; + if (!ret) + return c; init_fail: ff_iir_filter_free_coeffs(c); From 2611e52088b923601c83d331e8047d6e572abb82 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 21 Jan 2011 00:09:31 +0000 Subject: [PATCH 022/528] dca: pretty-print some tables Signed-off-by: Mans Rullgard --- libavcodec/dcadata.h | 12288 ++++++++++++++++++++--------------------- 1 file changed, 6144 insertions(+), 6144 deletions(-) diff --git a/libavcodec/dcadata.h b/libavcodec/dcadata.h index fbd22ab211..e8a31fd0a1 100644 --- a/libavcodec/dcadata.h +++ b/libavcodec/dcadata.h @@ -60,4102 +60,4102 @@ static const uint8_t dca_bits_per_sample[7] = /* 16bits signed fractional Q13 binary codes */ static const int16_t adpcm_vb[4096][4] = { - { 9928, -2618, -1093, -1263 }, - { 11077, -2876, -1747, -308 }, - { 10503, -1082, -1426, -1167 }, - { 9337, -2403, -1495, 274 }, - { 10698, -2529, -532, -1122 }, - { 10368, -3974, -1264, -750 }, - { 10070, -3667, 346, 863 }, - { 10278, -3093, 311, -576 }, - { 9894, -1330, -1428, -860 }, - { 10544, -1923, -1058, -971 }, - { 10996, -1632, -841, -1404 }, - { 11832, -3465, 1658, -1990 }, - { 10852, -688, -2658, -499 }, - { 10546, -1749, -147, -1733 }, - { 10801, -1004, -708, -1453 }, - { 10588, -441, -2113, -952 }, - { 10141, -3331, -582, -1432 }, - { 9608, -2590, 383, 258 }, - { 11422, -3265, 229, -1544 }, - { 10460, -1338, -713, -1568 }, - { 10306, -1721, -1660, -603 }, - { 9580, -1812, -1235, -1061 }, - { 11471, -2285, -1617, -607 }, - { 10081, -2225, -1408, -868 }, - { 10715, -2624, -1367, -704 }, - { 10616, -1871, -2770, -35 }, - { 9352, -2340, -1024, -1566 }, - { 11065, -1458, -1926, -735 }, - { 11334, -2056, -1041, -1144 }, - { 9825, -2048, -794, -1536 }, - { 11850, -2695, -1123, -867 }, - { 10654, -2226, -1891, -373 }, - { 10024, -1557, -808, -1069 }, - { 11142, -1266, -3238, 128 }, - { 11729, -3282, -514, -1011 }, - { 11402, -2094, -2335, -189 }, - { 10195, -3658, 181, -1875 }, - { 11431, -2626, -404, -1377 }, - { 11001, -3868, -619, -1077 }, - { 10894, -2559, 274, -1758 }, - { 9633, -1482, -2253, -773 }, - { 11245, -3321, 830, -1972 }, - { 9768, -2701, -199, -1859 }, - { 10500, -2042, 525, -2043 }, - { 11669, -4069, 293, -1468 }, - { 9192, -1991, -583, -61 }, - { 10057, -3220, -2015, -473 }, - { 9497, -2315, -2490, -467 }, - { 10455, -3069, -1194, -1007 }, - { 9994, -1936, -60, -1225 }, - { 9295, -2156, -1761, -1134 }, - { 10085, -3748, -1026, 197 }, - { 9334, -2360, 804, -351 }, - { 11561, -2553, 1352, -2313 }, - { 12837, -3998, 1195, -1958 }, - { 10114, -1100, -2414, -394 }, - { 9341, -2530, 315, 755 }, - { 10131, -3164, 1411, -674 }, - { 9535, -905, -1551, 579 }, - { 11717, -1519, -3051, 91 }, - { 9824, -2911, -2775, 192 }, - { 9662, -2934, -561, 1450 }, - { 11085, -3392, -1298, -659 }, - { 8955, -2102, -1899, 703 }, - { 8607, -1742, -4348, 814 }, - { 7640, -2063, -3617, 52 }, - { 7074, -826, -4325, 4375 }, - { 7714, 584, -4238, 1927 }, - { 6355, -952, -4912, 3127 }, - { 7069, -660, -6413, 4087 }, - { 8313, -132, -2964, -876 }, - { 6952, -1422, -3962, -24 }, - { 9299, -734, -3088, -263 }, - { 9484, -574, -4513, 466 }, - { 7246, -91, -3735, -704 }, - { 8325, -1417, -3090, -530 }, - { 6469, -1226, -4757, 829 }, - { 6652, -368, -5682, 1393 }, - { 7971, -1278, -2284, 1205 }, - { 7229, -699, -3556, 1840 }, - { 7994, 1284, -2729, 732 }, - { 9005, -698, -4522, 2189 }, - { 6963, 197, -2727, 380 }, - { 8527, 135, -3991, -213 }, - { 8840, 934, -3014, -567 }, - { 10125, 418, -3284, -371 }, - { 6367, 361, -2318, 2554 }, - { 7892, 172, -5247, 4673 }, - { 6674, 387, -5424, 4398 }, - { 6240, 684, -4047, 1219 }, - { 11170, -794, -5081, 1195 }, - { 11765, -648, -6265, 2052 }, - { 10845, -775, -3837, 366 }, - { 12496, -689, -8260, 3562 }, - { 7893, -1166, -4972, 988 }, - { 8592, 1052, -5986, 3087 }, - { 7277, 1874, -5685, 3579 }, - { 6900, 2016, -4809, 3491 }, - { 8530, -2405, -3250, 1986 }, - { 9426, 494, -7067, 5038 }, - { 10285, 564, -8210, 5370 }, - { 8749, -2207, -3980, 2852 }, - { 9653, -2686, -4300, 1400 }, - { 9770, -2286, -5663, 4233 }, - { 8490, -4, -7048, 4496 }, - { 7697, -1209, -5328, 3183 }, - { 6451, 801, -4324, -554 }, - { 7387, 1806, -5265, 545 }, - { 7450, -2302, -4445, 1418 }, - { 8817, -1370, -5827, 2168 }, - { 10324, -2406, -5629, 2579 }, - { 8863, -2578, -3537, 467 }, - { 6901, -1624, -3169, 3392 }, - { 7846, 156, -6948, 3381 }, - { 7928, -1115, -5972, 4816 }, - { 6089, -599, -4368, -320 }, - { 7833, 1246, -3960, -621 }, - { 8931, 2521, -6768, 2052 }, - { 8900, 1944, -4126, 40 }, - { 7661, -34, -2855, 2480 }, - { 5873, 474, -3262, 3712 }, - { 7535, -234, -4699, 216 }, - { 5856, 143, -5142, 73 }, - { 8944, -106, -5874, 3663 }, - { 7134, 426, -5879, 2895 }, - { 10199, 1011, -4762, 369 }, - { 8454, 264, -5971, 1291 }, - { 7822, -2449, -4333, 4540 }, - { 6200, -2758, -2632, 1497 }, - { 6070, -4315, -2699, 414 }, - { 7047, -3739, -3210, 1060 }, - { 5675, -3801, -2717, -407 }, - { 4789, -4063, -2628, -744 }, - { 4023, -3366, -3133, -726 }, - { 4296, -2407, -3381, -513 }, - { 4388, -2931, -2820, 1512 }, - { 4559, -4233, -1941, 1976 }, - { 6702, -3208, -1755, 1680 }, - { 4416, -3521, -1052, 2984 }, - { 7154, -4266, -1203, 3732 }, - { 3625, -4242, -3244, 1395 }, - { 6518, -2856, -1304, 2887 }, - { 6170, -1949, -3014, 3973 }, - { 5189, -2451, -4020, 3477 }, - { 6218, -2988, -1921, 3844 }, - { 4827, -3688, -1928, 3343 }, - { 6668, -3991, -2805, 3095 }, - { 5297, -3115, -3684, 2390 }, - { 5354, -4614, -2662, 1504 }, - { 4196, -3091, -4147, 1135 }, - { 3540, -2893, -4007, 100 }, - { 5569, -1602, -4007, 1909 }, - { 4341, -2091, -4272, 252 }, - { 5559, -2878, -3832, 498 }, - { 4548, -4479, -2898, -27 }, - { 5176, -2494, -4635, 1476 }, - { 3294, -3485, -3738, 716 }, - { 4920, -1229, -4195, -365 }, - { 3257, -3518, -3349, 2862 }, - { 5286, -1948, -3485, -778 }, - { 6502, -3051, -152, 2854 }, - { 5864, -4192, -1076, 3451 }, - { 4656, -3122, -3448, 179 }, - { 5907, -754, -1596, 3116 }, - { 7229, -3680, -1590, 2892 }, - { 5107, -3888, -3364, 806 }, - { 6764, -2635, -3450, 134 }, - { 5258, -2827, -2844, -1052 }, - { 5798, -1725, -4305, 205 }, - { 5404, -1213, -3362, 449 }, - { 6224, -2738, -3046, -581 }, - { 4223, -2438, -2725, 3745 }, - { 4751, -3411, -2123, 116 }, - { 3868, -3000, -3954, 2297 }, - { 6819, -2899, -4277, 2825 }, - { 4207, -4754, -2808, 865 }, - { 4804, -1494, -1997, 4688 }, - { 5282, -2213, -548, 3559 }, - { 5580, -1912, -566, 4370 }, - { 6168, -2857, -672, 4053 }, - { 6583, -4515, -2850, 1670 }, - { 6511, -3093, -3988, 1421 }, - { 4646, -1790, -1443, 3650 }, - { 5915, -924, -2020, 896 }, - { 7814, -4181, -3152, 2007 }, - { 6190, -2238, -4817, 2279 }, - { 4737, -4034, -3288, 1835 }, - { 8161, -3633, -3423, 3137 }, - { 7415, -2351, -2088, 4290 }, - { 4106, -2517, -62, 2905 }, - { 4909, -3145, -614, 4112 }, - { 4938, -3281, -397, 1100 }, - { -173, 919, 1589, -5363 }, - { -13, 796, -295, -6655 }, - { -1860, -829, 1141, -4555 }, - { 2298, -838, -664, -5005 }, - { -884, -1097, 2074, -4613 }, - { -101, 281, 2846, -4535 }, - { 1166, 453, 2429, -5910 }, - { 879, -664, 2370, -5452 }, - { 1415, -370, -1699, -4727 }, - { -1413, 1277, -669, -6649 }, - { 2133, 304, -968, -4624 }, - { 380, 586, -2087, -4892 }, - { 1336, 275, -82, -5789 }, - { -2459, 1057, -34, -5416 }, - { 2278, -1758, 866, -5653 }, - { 1945, -2295, -149, -5302 }, - { 1287, -3525, 996, -5255 }, - { 2297, 803, 1177, -6067 }, - { 187, -180, -619, -6202 }, - { -793, -2537, 1554, -5057 }, - { -2703, -204, -629, -5853 }, - { -1007, -146, 313, -5582 }, - { 830, 357, 869, -6363 }, - { -228, -575, -3177, -4433 }, - { -1001, -1553, -142, -5708 }, - { -1644, 1683, 1721, -4533 }, - { 893, 1924, -15, -5791 }, - { 2195, 2061, -262, -5471 }, - { 3031, 270, 311, -5096 }, - { 1912, 1638, -1523, -4677 }, - { -3142, -55, 253, -4914 }, - { 356, -1680, 343, -6123 }, - { -2241, -1734, -976, -5939 }, - { -2196, -2893, 547, -4938 }, - { -1245, 126, -1916, -5419 }, - { -249, -3755, -1422, -5594 }, - { 575, -2683, -1926, -4566 }, - { -762, 1885, 192, -5880 }, - { -811, -2562, -1068, -6013 }, - { -2264, -3086, -976, -4775 }, - { 70, -1215, 2880, -4410 }, - { 714, -3760, 2916, -4691 }, - { -244, -3404, 1740, -4493 }, - { 684, -5137, -328, -5608 }, - { -529, -3825, -1786, -4535 }, - { -713, -4743, -1118, -5546 }, - { 2718, -3788, 1798, -5708 }, - { -1639, -3679, -1564, -6095 }, - { 1693, -2642, -1389, -4539 }, - { 505, -1573, -1651, -4878 }, - { -835, -2256, -1941, -5352 }, - { 1464, -411, 1993, -6441 }, - { 493, -3184, -145, -6148 }, - { -1413, 499, -1617, -6479 }, - { -294, 1722, -1419, -5725 }, - { -2937, -1528, -175, -4624 }, - { -594, -5911, -56, -6146 }, - { -300, -4275, 1156, -5947 }, - { 552, -2643, 2669, -3959 }, - { 905, -4158, 1789, -5809 }, - { 1336, -2009, 2108, -5903 }, - { 1555, -3600, 1110, -6759 }, - { -1294, -3464, 77, -6084 }, - { -1139, -4006, -1270, -4181 }, - { -5094, -3296, 1092, -2847 }, - { -5503, -2883, 1984, -2067 }, - { -4671, -4218, -1417, -4132 }, - { -3763, -3818, 1262, -3082 }, - { -5132, -3430, 2928, -728 }, - { -5957, -2877, 1251, -2446 }, - { -4425, -2319, -212, -4276 }, - { -6201, -1993, 1774, -2182 }, - { -5500, -3836, 2201, -1396 }, - { -6934, -2334, 2366, -1293 }, - { -6124, -4140, 1337, -1977 }, - { -6553, -4186, 1756, -1325 }, - { -5126, -1258, 744, -3656 }, - { -5167, -1390, 1581, -2895 }, - { -4525, -3398, 2429, -1865 }, - { -4076, -3183, 2027, -2510 }, - { -6191, -3274, 1838, -1814 }, - { -4454, -2753, 2723, -1185 }, - { -6655, -4797, 251, -2595 }, - { -6332, -2232, 1832, 217 }, - { -5869, -1698, 134, 340 }, - { -6614, -1045, 2126, -1932 }, - { -4859, -2107, 2010, -2435 }, - { -6274, -1622, 2808, -1374 }, - { -3119, -3209, 521, -3988 }, - { -5676, -2082, -420, -2711 }, - { -7073, -3623, 696, -2343 }, - { -5986, -4224, 572, -2454 }, - { -4340, -4521, 882, -2771 }, - { -6178, -1933, 535, -1444 }, - { -4923, -4163, 1744, -2066 }, - { -6410, -1519, 1058, -2683 }, - { -5077, -1185, 856, -2216 }, - { -7091, -2444, 687, -2597 }, - { -5284, -2165, 3239, -993 }, - { -4763, -1497, 197, -3179 }, - { -4128, -4958, -396, -3578 }, - { -5054, -3878, -647, -2672 }, - { -7005, -3348, 1679, -1579 }, - { -5767, -1017, 2582, -1915 }, - { -7069, -2787, 1331, -2070 }, - { -5532, -2296, 706, -2950 }, - { -5059, -3543, -821, -3637 }, - { -6639, -1835, 1016, -696 }, - { -5611, -5220, -694, -3371 }, - { -5994, -2803, 2933, -729 }, - { -5948, -619, 1596, -2676 }, - { -5486, -4419, 153, -3265 }, - { -4329, -3440, 1646, -1439 }, - { -4083, -3978, 177, -3569 }, - { -4289, -2599, 1224, -3075 }, - { -5707, -3253, 1912, -759 }, - { -6606, -3437, 2562, -571 }, - { -5254, -2444, 769, -352 }, - { -6545, -3154, 582, -1103 }, - { -5328, -2241, 2566, -1775 }, - { -7216, -1936, 1538, -1983 }, - { -3730, -2451, 426, -3869 }, - { -5110, -1385, 2031, -1169 }, - { -6470, -2715, 269, -3123 }, - { -5806, -2480, -97, -3832 }, - { -3683, -4916, -490, -4330 }, - { -6341, -2083, -669, -115 }, - { -4913, -4079, -837, -4673 }, - { -3274, -2497, 2334, -2652 }, - { -1286, -1731, 2550, -3756 }, - { -3375, -877, 926, -3977 }, - { -2525, -2079, 2879, -2625 }, - { -5308, -504, 3111, -1607 }, - { -4904, 460, 4093, -1232 }, - { -1993, 1616, 4656, -1913 }, - { -3481, -1176, 3119, -2236 }, - { -4132, -1502, 2339, -2545 }, - { -2542, 1151, 3569, -2550 }, - { -4381, 430, 3147, -2082 }, - { -3888, 867, 3899, -1657 }, - { -2861, 1290, 4202, -1979 }, - { -3893, -253, 2363, -2764 }, - { -1705, 688, 3827, -2923 }, - { -2223, 2312, 3700, -3148 }, - { -1986, -720, 5021, -795 }, - { -3177, 242, 1952, -3352 }, - { -1854, 1509, 2528, -3815 }, - { -3173, 97, 5019, -706 }, - { -2689, -145, 1375, -3915 }, - { -4838, -385, 2488, -2427 }, - { -4557, -355, 1603, -3060 }, - { -3522, 1832, 3292, -2674 }, - { -3769, 780, 2378, -2704 }, - { -4323, -1932, 3414, -1169 }, - { -2740, 1158, 2729, -3273 }, - { -3647, 210, 1464, -2892 }, - { -2342, -2097, 1513, -3727 }, - { -4422, -1242, 3130, -1833 }, - { -1308, -1039, 4290, -1875 }, - { -1754, -2535, 3298, -2314 }, - { -4102, -186, 4037, -1094 }, - { -1008, 1570, 3290, 171 }, - { -3322, -2621, 2791, -1536 }, - { -2539, -2597, 3442, -1672 }, - { -3411, -2015, 3670, -1174 }, - { -2097, 730, 5581, -1399 }, - { -1510, -74, 4820, -2004 }, - { -4086, -868, 4425, -771 }, - { -956, -986, 3640, -2925 }, - { -2087, -1250, 3464, -2458 }, - { -3308, -2411, 1334, -3667 }, - { -2264, -389, 4004, -1854 }, - { -680, 239, 4058, -3388 }, - { -1357, 30, 2993, -3658 }, - { -3601, -552, 1177, -1136 }, - { -2641, 442, 4374, -1625 }, - { -2525, 770, 1640, -3895 }, - { -3172, -891, 3893, -1608 }, - { -2996, 13, 3277, -2414 }, - { -899, 1055, 4470, -2501 }, - { -422, -584, 3475, -3787 }, - { -1978, -593, 2566, -3415 }, - { -3150, -1280, 2362, -3047 }, - { -3592, 224, 1026, -3932 }, - { -4840, -1189, 3633, -879 }, - { -3952, -2255, 2916, -1826 }, - { -1695, 28, 1810, -349 }, - { -745, -2484, 3308, -3293 }, - { -1016, 1563, 5365, -1823 }, - { -2172, -1787, 4266, -1287 }, - { -1241, -1951, 3982, -2413 }, - { -2009, -2639, 2330, -3480 }, - { 5105, -1618, -2588, -2015 }, - { 6497, -1523, -3218, -910 }, - { 6526, -2305, -2029, -1790 }, - { 5289, -99, -3436, -400 }, - { 5781, -1623, -1577, -2617 }, - { 5259, -670, -3125, -1700 }, - { 6343, -1256, -331, -3222 }, - { 7967, -678, -2195, -1462 }, - { 6119, -695, -2988, -1538 }, - { 6108, 494, -3359, -1548 }, - { 5067, 969, -2328, -2707 }, - { 7595, -435, -1497, -2056 }, - { 6929, -719, -2420, -1665 }, - { 5190, 584, -2982, -2103 }, - { 6106, -444, -1411, -2739 }, - { 5584, 289, -1804, -2803 }, - { 5276, 227, -1180, -3361 }, - { 7544, -1525, -1834, -1725 }, - { 5986, -1470, -2606, -1701 }, - { 5096, -765, -1712, -3006 }, - { 5423, -149, -3933, -1157 }, - { 7651, 26, -2445, -1507 }, - { 4745, -464, -1735, -2362 }, - { 5352, -1011, -1094, -1999 }, - { 6300, -672, -542, -1950 }, - { 6675, -1020, -1318, -1059 }, - { 7218, -2036, -603, -2462 }, - { 7755, -1514, -2430, -1229 }, - { 5041, 449, -1056, -2405 }, - { 6710, -2277, -1344, -2284 }, - { 6824, -1347, -2254, 251 }, - { 6068, -1857, -983, -1316 }, - { 5603, -2177, -2730, -1477 }, - { 5838, -1059, -3604, -970 }, - { 5076, -789, -335, -2413 }, - { 6191, -1634, -2000, -2129 }, - { 5092, -1292, -2543, -1034 }, - { 5305, 435, -1710, -1850 }, - { 6140, 561, -2176, -2380 }, - { 6752, 348, -2496, -1890 }, - { 6405, 273, -1098, -2778 }, - { 6942, -1340, -496, -1381 }, - { 5238, -687, -2454, -2349 }, - { 6959, -882, -1833, -2061 }, - { 6292, -253, -2125, -2199 }, - { 5838, -574, -759, -3215 }, - { 6954, -1484, -640, -2771 }, - { 7498, -1706, -1210, -2154 }, - { 6772, -1003, -1235, -2532 }, - { 6014, 228, -2154, -1108 }, - { 6943, -2178, -2644, -1122 }, - { 7262, -763, -3056, -1090 }, - { 6273, -1478, -1072, 177 }, - { 4734, 425, -2912, 357 }, - { 7129, 168, -1537, -2327 }, - { 7204, -434, -746, -2660 }, - { 6879, 57, -3087, -1310 }, - { 4623, -610, -718, -3459 }, - { 6565, -543, -1998, -339 }, - { 4752, -277, -2066, -1405 }, - { 7435, -1416, -1904, -505 }, - { 4076, 150, -1222, -3556 }, - { 7082, -28, -1456, -1174 }, - { 5941, -446, -1326, -1158 }, - { 3870, -1648, -2474, -2589 }, - { 858, 37, -3387, -3721 }, - { 3557, -1503, -1664, -3383 }, - { 3336, -1972, -3079, -2216 }, - { 3186, 60, -4185, -863 }, - { 3456, -773, -3066, -2457 }, - { 4131, -913, -2060, -2601 }, - { 4431, -691, -4114, -972 }, - { 3461, -334, -3680, -1751 }, - { 2006, -459, -2214, -3827 }, - { 1322, 32, -2816, -3203 }, - { 4425, -1897, -2791, -1946 }, - { 4504, 23, -3421, -1909 }, - { 3090, -885, -2366, -3264 }, - { 3209, -2363, -3730, -834 }, - { 3312, -1471, -3641, -1579 }, - { 4184, -1669, -3323, -1248 }, - { 2190, -931, -3302, -2944 }, - { 2947, -229, -4791, -1195 }, - { 2020, -1626, -2700, -3125 }, - { 2214, -326, -4352, -1683 }, - { 3286, -2619, -2412, -2458 }, - { 1000, -2571, -4129, -2158 }, - { 2496, -2627, -3611, -1433 }, - { 2043, -2191, -2167, -3827 }, - { 2571, -2544, -1915, -3222 }, - { 2022, -1501, -3856, -2165 }, - { 2685, -1180, -1461, -4038 }, - { 1610, -2313, -4391, -1173 }, - { 2340, -2490, -4215, -516 }, - { 1742, -2615, -3632, -2146 }, - { 523, -1293, -4246, -2442 }, - { 3725, -2723, -3014, -1576 }, - { 3554, -1381, -4200, -824 }, - { 1291, -1594, -4777, -1430 }, - { 1452, 515, -2960, -3830 }, - { 4264, -894, -3305, -1826 }, - { 2606, -1452, -4522, -966 }, - { 1196, -830, -4807, -1816 }, - { 1054, -775, -2616, -4071 }, - { 4206, 415, -4344, -1132 }, - { 3044, 491, -4126, -1934 }, - { 988, -901, -3353, -3443 }, - { 1729, -3063, -2267, -3370 }, - { 3915, 912, -2989, -2387 }, - { 3781, 300, -2457, -3050 }, - { 2712, 924, -1350, -1206 }, - { 4230, 405, -2343, 665 }, - { 1878, -873, -225, -29 }, - { 3510, 56, -1334, -3420 }, - { 2850, 1447, -2651, -3150 }, - { 1510, -706, -4125, -2483 }, - { 3115, 793, -1692, -3894 }, - { 2667, 213, -2973, -2786 }, - { 1184, -2384, -3051, -3173 }, - { 2139, 796, -2079, -3697 }, - { 1464, -1483, -3726, -2754 }, - { 2407, -1148, -3915, -1569 }, - { 2612, -1779, -3217, -2271 }, - { 2406, -2870, -2937, -2496 }, - { 2140, 126, -3646, -2758 }, - { 2952, -1036, 268, -1423 }, - { 93, -1931, -3841, -3535 }, - { 389, -2953, -3383, -3343 }, - { 8652, -5511, -1662, 565 }, - { 7427, -2791, -2535, -842 }, - { 8541, -4253, -1407, -988 }, - { 8018, -3203, -2998, 105 }, - { 7231, -3926, -958, 1308 }, - { 7331, -3690, -363, 2586 }, - { 6803, -3646, -2226, -903 }, - { 8163, -2811, -477, -2235 }, - { 9356, -3818, -1685, -684 }, - { 8466, -2854, -302, -698 }, - { 8458, -3224, 517, 279 }, - { 8074, -2619, -1326, 2596 }, - { 8779, -2761, -2527, -441 }, - { 6533, -2887, -899, -696 }, - { 7394, -2305, -1642, -120 }, - { 8281, -3780, -22, 1305 }, - { 9158, -4413, -779, 901 }, - { 9031, -5240, -1109, 1678 }, - { 8717, -3650, 410, -1075 }, - { 7317, -3197, -818, -2264 }, - { 7934, -2385, -1214, -1886 }, - { 8256, -4441, -291, -587 }, - { 7358, -3395, 1090, -270 }, - { 9446, -4910, -1343, -473 }, - { 8187, -4726, -808, 1166 }, - { 7504, -3845, -47, 267 }, - { 8029, -2146, -1283, -383 }, - { 7461, -2705, -853, 783 }, - { 9367, -3636, -645, -354 }, - { 8955, -3473, -308, -1947 }, - { 8676, -2683, -2099, 1485 }, - { 7481, -3003, -871, -444 }, - { 8015, -2839, -1673, 1175 }, - { 6947, -4643, -1527, -1047 }, - { 7622, -2575, -137, -960 }, - { 9388, -4279, -707, -1322 }, - { 8382, -5259, -1283, -565 }, - { 6856, -4138, -1030, 630 }, - { 8659, -2571, -1124, -1666 }, - { 8763, -3807, -537, 2543 }, - { 8049, -3578, -2186, -604 }, - { 8272, -2351, -1985, -1214 }, - { 6855, -3796, -1527, -1631 }, - { 7178, -2896, -1600, -1756 }, - { 7040, -2888, -89, -1586 }, - { 6261, -3403, -264, 998 }, - { 7756, -4699, -1543, -834 }, - { 7682, -4622, -758, -1721 }, - { 8839, -4232, -2932, 1959 }, - { 9363, -4679, -1956, 39 }, - { 7883, -3616, -1414, -1432 }, - { 8828, -3188, -1356, -1312 }, - { 7746, -3987, -121, -2424 }, - { 9262, -3256, -693, 818 }, - { 7670, -3420, -148, 3504 }, - { 7344, -3183, 608, 1595 }, - { 8976, -4139, -1848, 1304 }, - { 6708, -4131, 33, -852 }, - { 7840, -4429, -2275, 79 }, - { 8980, -3858, -2838, 453 }, - { 7815, -4604, -2563, 944 }, - { 8372, -4422, -1783, 3071 }, - { 8623, -5128, -1754, 2888 }, - { 7462, -3281, 889, 920 }, - { 8416, -59, -1320, -1825 }, - { 7928, -1488, -414, -2499 }, - { 8110, -977, -1047, -2042 }, - { 8278, -687, -1597, -1550 }, - { 7988, -174, -977, -2106 }, - { 8609, -1547, -1628, -1527 }, - { 9000, -1798, -946, -1761 }, - { 8954, -872, -1404, -1594 }, - { 8939, 466, -748, -1212 }, - { 9549, -329, -177, -1360 }, - { 9411, -18, -1126, -1568 }, - { 8859, -782, -488, -1338 }, - { 8955, -218, -43, -1209 }, - { 9131, -69, -453, -1001 }, - { 9069, -1519, -1091, -1199 }, - { 9247, -1309, -566, -1146 }, - { 8528, -1617, -287, -1313 }, - { 7763, -745, -149, -2040 }, - { 8294, -343, 257, -2633 }, - { 10149, -893, -552, -1649 }, - { 9398, -915, 218, -2042 }, - { 9703, -1194, -675, -1592 }, - { 9586, -700, -427, -1710 }, - { 8930, 497, -1445, -1218 }, - { 9285, -1323, -163, -1552 }, - { 8431, -1289, -985, -1404 }, - { 8965, -655, 653, -1483 }, - { 9542, -1001, -951, -1128 }, - { 9205, -647, -37, -882 }, - { 8603, -56, 514, -1793 }, - { 9300, -12, -1324, -567 }, - { 8773, 238, -184, -1456 }, - { 9941, -1306, -69, -1792 }, - { 9360, 279, -376, -1919 }, - { 9180, -285, 95, -2170 }, - { 9922, -501, -970, -1570 }, - { 8341, -1493, -856, -2092 }, - { 8780, -981, -850, -1014 }, - { 9721, -548, -1504, -1094 }, - { 9973, -1493, 482, -2105 }, - { 8707, -333, -1027, -1087 }, - { 9098, -469, -315, -1723 }, - { 8879, -1050, -661, -2020 }, - { 8857, 602, -866, -1918 }, - { 8945, -1025, -2154, -1071 }, - { 8484, -1930, -468, -2179 }, - { 9177, -1903, -224, -2112 }, - { 8652, -137, -2097, -1214 }, - { 9063, -973, -1405, -772 }, - { 9328, -456, 662, -2469 }, - { 10101, -697, 127, -2113 }, - { 9685, 811, -2359, -1024 }, - { 8586, -94, -460, -1982 }, - { 7924, -141, -509, -2513 }, - { 7773, -669, -107, -2835 }, - { 8636, -1064, -46, -2409 }, - { 9748, 596, -1815, -1349 }, - { 8924, 304, 547, -2614 }, - { 9442, 746, -1153, -1679 }, - { 9454, -278, -529, -1976 }, - { 8488, 561, -32, -2160 }, - { 10083, -63, -1544, -1364 }, - { 9390, -1278, 568, -1131 }, - { 9740, -49, -2253, -910 }, - { 3636, -2391, -1115, -3614 }, - { 6014, -3204, -1902, -1808 }, - { 5787, -3497, -1116, -2590 }, - { 4365, -3046, -1632, -2668 }, - { 4733, -2192, -2029, -2468 }, - { 5412, -2753, -1633, -2464 }, - { 4455, -3375, -767, -3399 }, - { 4456, -1644, -983, -2841 }, - { 4039, -2523, 38, -3967 }, - { 3406, -2662, 72, -4757 }, - { 4279, -2005, 1055, -4399 }, - { 4321, -1377, -860, -3786 }, - { 3743, -5739, -651, -3047 }, - { 3528, -5510, 361, -4060 }, - { 6496, -4886, -136, -2689 }, - { 4513, -5254, 551, -4010 }, - { 6557, -3413, -92, -3063 }, - { 4186, -2059, 187, 47 }, - { 6210, -4117, -1256, -1985 }, - { 6038, -4343, 351, -2124 }, - { 4305, -4780, -2077, -1897 }, - { 4480, -3815, -2228, -1533 }, - { 5582, -3689, 1221, -3429 }, - { 5532, -4874, 1195, -2765 }, - { 6518, -2853, -905, -2568 }, - { 5467, -2192, 470, -4115 }, - { 4139, -1577, 240, -3493 }, - { 5281, -1926, -729, -3340 }, - { 5214, -2870, 1359, -4289 }, - { 3046, -3510, -1536, -3214 }, - { 5433, -2881, -1230, -1184 }, - { 4861, -3932, -1071, -2791 }, - { 5693, -4234, -1906, -1502 }, - { 4004, -3935, -1804, -2383 }, - { 3728, -3792, 681, -4773 }, - { 3621, -3030, -1951, -2598 }, - { 5133, -3903, 44, -3700 }, - { 3561, -3451, 1183, -5301 }, - { 5026, -2762, -2341, -1780 }, - { 5841, -2492, -467, -3210 }, - { 5591, -1791, 497, -2472 }, - { 5054, -3898, -1822, -2097 }, - { 5813, -2792, 83, -1469 }, - { 4432, -4497, 1670, -5193 }, - { 5338, -4653, -1109, -2200 }, - { 3239, -4401, -648, -3655 }, - { 2147, -3598, -1200, -4242 }, - { 4417, -2271, -1552, -3210 }, - { 6494, -4360, 852, -3565 }, - { 2393, -6358, -856, -4524 }, - { 4959, -4196, -847, -1403 }, - { 4924, -5438, -226, -3026 }, - { 4254, -5303, -1306, -2424 }, - { 4121, -3126, -2334, -1981 }, - { 3437, -4443, -1464, -2953 }, - { 3203, -3459, -529, -4339 }, - { 5896, -5945, 543, -3246 }, - { 1987, -4733, -220, -4863 }, - { 4358, -4431, -514, -3081 }, - { 4583, -2416, -492, -2287 }, - { 2943, -5035, 419, -4927 }, - { 5358, -5129, 987, -4309 }, - { 4460, -3392, 1752, -5634 }, - { 3415, -4633, 1507, -5945 }, - { 811, -4692, -445, 2333 }, - { 1009, -5613, -1857, 1360 }, - { 1338, -2712, -2720, 3036 }, - { 1002, -3754, -2582, 2344 }, - { 750, -4608, -2334, 714 }, - { 2043, -3207, -2822, 2173 }, - { -140, -4654, -2953, 357 }, - { -54, -4026, -2376, 2695 }, - { 1858, -5022, -717, 2287 }, - { 2064, -3894, -722, 3255 }, - { 2727, -4558, -332, 2603 }, - { 1810, -5378, 283, 1826 }, - { 3935, -4326, 762, 3383 }, - { -767, -4697, -2510, 1922 }, - { 2146, -4312, -3090, 1641 }, - { 54, -5881, -2114, 921 }, - { 1992, -5766, -640, 1574 }, - { 1200, -5371, -1114, 1828 }, - { 2973, -5337, 34, 2266 }, - { 1531, -5018, -2817, 1192 }, - { 3078, -4570, 117, 1990 }, - { 924, -4286, -1388, 2713 }, - { 142, -5058, -2848, 1487 }, - { -106, -6180, -881, 842 }, - { 673, -5433, -229, 1596 }, - { 783, -5710, -2784, 562 }, - { 1935, -5729, -2009, 856 }, - { -410, -3375, -3326, 2734 }, - { 234, -3000, -2628, 3260 }, - { 733, -3405, -3806, 1589 }, - { 771, -4285, -3544, 1314 }, - { 1192, -3563, -3960, 2178 }, - { 206, -5555, -1250, 1546 }, - { -130, -3815, -1210, 3041 }, - { 646, -3940, -393, 2992 }, - { -184, -4931, -1767, 1925 }, - { 2746, -5120, -2275, 1464 }, - { 2440, -3731, -3352, 2729 }, - { -490, -4942, -3779, 997 }, - { 68, -2636, -4167, 3778 }, - { 48, -3986, -4118, 2106 }, - { -978, -5486, -1336, 1390 }, - { 1126, -5297, -855, 640 }, - { -472, -3975, -3622, 1557 }, - { 2456, -5344, -1523, 1648 }, - { -774, -5652, -2417, 1147 }, - { 995, -6122, -812, 1132 }, - { 3282, -4571, -1763, 2175 }, - { 3655, -3862, -676, 3568 }, - { 3038, -3647, -1672, 3381 }, - { 2595, -2964, -2772, 3263 }, - { 4176, -3353, -1148, 4354 }, - { 1603, -3442, -1500, 3444 }, - { 828, -6226, -1783, 678 }, - { 1421, -3333, -3080, 3403 }, - { 1121, -4727, -1924, 1984 }, - { -186, -5083, -682, 1796 }, - { 819, -2778, -3488, 530 }, - { 421, -2873, -3832, 2596 }, - { 2164, -4263, -1605, 2282 }, - { 585, -4437, -682, -491 }, - { -644, -4452, -1157, 2325 }, - { 1991, -4299, 210, 2834 }, - { 2135, -3632, -2113, 665 }, - { -7482, -2724, -2662, -1380 }, - { -6983, -2166, -3756, -3509 }, - { -7085, -1439, -2397, -3112 }, - { -7760, -3049, -3319, -2822 }, - { -8413, -2760, -4406, -3298 }, - { -5995, -3943, -1260, -3750 }, - { -7879, -1554, -3464, -2606 }, - { -6314, -2034, -3878, -1681 }, - { -8849, -2084, -1399, -1231 }, - { -7153, -2602, -1384, -817 }, - { -8041, -2571, -407, -2785 }, - { -7246, -2233, -1578, 260 }, - { -7336, -3883, -4061, -1342 }, - { -7619, -3908, -2342, 382 }, - { -8684, -3724, -1662, -727 }, - { -7850, -2922, -1770, -3449 }, - { -6766, -2034, -1293, -1988 }, - { -6895, -2116, -968, -3744 }, - { -7136, -5147, -2618, -2809 }, - { -8224, -3724, -2519, -1589 }, - { -6711, -2750, -3021, -219 }, - { -8059, -1638, -1102, -3175 }, - { -8710, -4839, -3963, -3143 }, - { -9363, -4965, -3257, -1002 }, - { -6099, -1751, -3157, -395 }, - { -6453, -3216, -4597, -483 }, - { -7879, -5477, -839, -2638 }, - { -7202, -4038, -526, -2856 }, - { -8022, -1228, -1910, -1646 }, - { -9117, -1393, -1582, -2535 }, - { -9095, -2693, -636, -2605 }, - { -9076, -2580, -3481, -2519 }, - { -8327, -4859, -2422, 83 }, - { -8368, -2129, -2324, -2173 }, - { -8554, -4563, -3842, -2007 }, - { -10462, -4261, -1934, -2084 }, - { -9717, -3187, -2294, -1896 }, - { -9625, -3889, -3020, -3224 }, - { -9857, -4955, -4239, -2184 }, - { -9752, -2351, -2277, -3129 }, - { -7219, -1302, -2639, -1603 }, - { -7477, -4360, -3718, -559 }, - { -5680, -2033, -2326, -3078 }, - { -10190, -5548, -4643, -3601 }, - { -9431, -4121, -879, -2479 }, - { -8365, -5450, -2020, -1439 }, - { -6289, -5178, -1605, -3845 }, - { -8319, -3866, -687, -2792 }, - { -8131, -1031, -3608, -3947 }, - { -10510, -2560, -1199, -2082 }, - { -11015, -3640, -2748, -3041 }, - { -8762, -5022, -5231, -1162 }, - { -10153, -2715, -4648, -4859 }, - { -7930, -5205, -1900, -3600 }, - { -9561, -3548, -4812, -3722 }, - { -7663, -4709, -1180, -1475 }, - { -9073, -5707, -1815, -2980 }, - { -8602, -2363, -2675, -3770 }, - { -9967, -5614, -3575, -3838 }, - { -8324, -1005, -2131, -3254 }, - { -10331, -5737, -2550, -2940 }, - { -8234, -3354, -3361, -4479 }, - { -8140, -1951, -4526, -4545 }, - { -6679, -2662, -2284, -4182 }, - { -1122, -1514, -6427, -212 }, - { 54, -1660, -5424, -1404 }, - { 254, -2778, -5222, 846 }, - { -267, -1661, -6577, 814 }, - { -305, -2021, -5759, 1484 }, - { -1791, -2446, -6867, -86 }, - { -2929, -3158, -6603, -1799 }, - { -1391, -3189, -5557, -1053 }, - { -1602, -884, -6767, -1213 }, - { -361, -318, -6219, -44 }, - { -4078, -2635, -5523, -433 }, - { -956, 478, -4382, 1470 }, - { -3300, -2462, -6021, -2721 }, - { 708, -2434, -5085, -540 }, - { -2435, -3607, -5647, -2110 }, - { -491, -1134, -4681, -2886 }, - { 87, -3435, -4641, -1194 }, - { -586, -2927, -4784, 366 }, - { -1394, -2326, -6021, 350 }, - { 97, -2519, -4678, -2120 }, - { -1547, -1907, -5069, -2993 }, - { 268, -3724, -4719, 127 }, - { -827, -1190, -5912, 1144 }, - { -3959, -2322, -6898, -1974 }, - { -2728, -2228, -6426, -562 }, - { -456, -666, -5785, -1609 }, - { 531, -1096, -5731, -656 }, - { -3569, -688, -3915, 110 }, - { -4752, -1725, -4393, -377 }, - { -3210, -3315, -6960, -840 }, - { -688, -3416, -4971, 1221 }, - { -1833, 77, -6491, -2434 }, - { -239, -255, -6850, -886 }, - { -2112, -1490, -6291, -2689 }, - { -1544, -4579, -5198, -1261 }, - { -2771, -4014, -5520, 683 }, - { -1635, -2829, -5512, 1214 }, - { -958, -2582, -4823, 2360 }, - { -2077, -4566, -4642, 365 }, - { -3112, -4214, -5960, -823 }, - { -2467, -2510, -4858, 1467 }, - { -1561, -3399, -5822, 211 }, - { -775, -1081, -4424, 2636 }, - { -1263, 25, -6378, -1392 }, - { -3476, -366, -5417, -1393 }, - { -3176, -1476, -4149, 1466 }, - { -2479, 518, -4448, -257 }, - { -2992, 158, -4660, -1279 }, - { -1320, -3872, -4479, 1147 }, - { -1475, -312, -5318, 539 }, - { -3527, -1679, -5860, -1681 }, - { -3397, -3438, -5593, 1866 }, - { -4089, -2439, -4763, 1275 }, - { -748, -4513, -4687, -48 }, - { -2166, -4531, -4691, -2856 }, - { -2385, -853, -6035, -627 }, - { -1194, -4091, -4472, -1963 }, - { -682, -3234, -4084, -3033 }, - { -3255, -5015, -5328, -12 }, - { -2313, -3436, -4601, -155 }, - { -2792, -1038, -6947, -2019 }, - { -1244, -1526, -5771, -1882 }, - { -4679, -3731, -5506, 283 }, - { -3062, -66, -3558, -758 }, - { -4895, -1187, 4751, 3728 }, - { -7600, -2752, 3320, 4613 }, - { -5703, -2975, 3944, 2659 }, - { -4972, -1257, -246, 2952 }, - { -4221, -2487, 1702, 4295 }, - { -2900, -1529, 2458, 4935 }, - { -5061, 407, 2416, 4050 }, - { -6931, -3478, 2761, 2213 }, - { -6037, -3921, 3192, 1866 }, - { -6113, -811, 2407, 3782 }, - { -5878, -1716, 1207, 3478 }, - { -5953, -2853, 2207, 2712 }, - { -6807, -3223, 2749, 3595 }, - { -3272, -3157, 1389, 3788 }, - { -5368, -1904, 1980, 5077 }, - { -7235, -1398, 3075, 4548 }, - { -4765, -3487, 2755, 2796 }, - { -7658, -4435, 2694, 2582 }, - { -6997, -4282, 456, 3832 }, - { -5563, -3115, -63, 3713 }, - { -4244, -4220, 1450, 2767 }, - { -3801, -2194, 190, 4303 }, - { -5458, -4119, 1958, 2274 }, - { -7300, -3469, 3514, 3193 }, - { -4594, -2067, 775, 4752 }, - { -3389, -1654, 1464, 5412 }, - { -4845, -3483, 964, 3437 }, - { -6007, -2818, 1666, 4659 }, - { -8709, -5007, 1757, 3287 }, - { -5833, -4389, 1025, 3171 }, - { -5788, -1780, 3944, 3661 }, - { -4430, -920, 1938, 4753 }, - { -7066, -1857, 4591, 4538 }, - { -3549, -513, 1427, 5317 }, - { -7517, -1220, 2883, 3049 }, - { -7605, -2687, 1874, 2735 }, - { -8718, -4035, 2676, 3730 }, - { -7990, -3907, 1185, 2607 }, - { -6058, -1744, 3349, 5157 }, - { -5954, 565, 3161, 3250 }, - { -6478, -612, 1930, 2271 }, - { -6535, -1445, -2, 1618 }, - { -8963, -4151, 1192, 4044 }, - { -7227, -3570, 1600, 4234 }, - { -4674, 79, 595, 3015 }, - { -3974, 430, 2727, 5137 }, - { -5299, 9, 3714, 4779 }, - { -6779, -2699, -8, 2436 }, - { -7016, -1145, 1293, 2310 }, - { -6955, -3312, 1534, 1801 }, - { -4025, 740, 1850, 4054 }, - { -9589, -3460, 4154, 5270 }, - { -4404, -1181, 4298, 5173 }, - { -7356, -4583, -18, 2644 }, - { -6516, -1235, 4439, 6234 }, - { -3453, -301, 4344, 4464 }, - { -4643, 1530, 3315, 4340 }, - { -4575, -2557, 3754, 3682 }, - { -3643, -3501, 2051, 2997 }, - { -5412, -2475, 2301, 1579 }, - { -5846, 259, 1360, 2348 }, - { -5258, -1358, 1050, 838 }, - { -5542, -219, 6377, 5750 }, - { -5713, -2952, 922, 899 }, - { -2049, -1135, 5206, 1033 }, - { -1693, -1886, 4835, -106 }, - { -2344, -3504, 4232, -13 }, - { -2475, -2334, 5043, 1126 }, - { -787, -2549, 3880, 2138 }, - { -3159, -2341, 4830, 2887 }, - { -1780, -1009, 6240, 2061 }, - { -4327, -3363, 2818, 886 }, - { -3376, -2743, 4104, 207 }, - { -3250, -4640, 2718, 1498 }, - { -382, -1075, 4382, 3460 }, - { -2416, -4168, 3530, 816 }, - { -1756, -2708, 4861, 622 }, - { -1879, -2097, 5156, 2889 }, - { -2496, -2418, 3722, 2671 }, - { -2717, -3252, 3341, 1944 }, - { -4063, -4091, 3306, 267 }, - { -3549, -3808, 3747, 842 }, - { -2635, 546, 5794, 1894 }, - { -1857, -1121, 4383, 3964 }, - { -2226, -2166, 3489, 3678 }, - { -3492, -660, 5323, 1063 }, - { -3033, -3130, 4382, 1828 }, - { -2703, -625, 6369, 2851 }, - { -1656, -2842, 4584, -528 }, - { -4781, -2622, 4390, 2097 }, - { -413, -2045, 5081, 3035 }, - { -3810, -2662, 4532, 1095 }, - { -3144, -1858, 5215, 1880 }, - { -3562, -1795, 4928, 670 }, - { -4800, -1509, 5189, 1859 }, - { -1085, -3832, 4169, 900 }, - { -1969, -3270, 2857, 2878 }, - { -4267, -4140, 3176, 1805 }, - { -5145, -3727, 3524, 1168 }, - { -1346, -1876, 5501, 1748 }, - { -4998, -2945, 3699, 338 }, - { -3458, -3096, 3406, -635 }, - { -1751, -3209, 3508, 395 }, - { -2507, 170, 5987, 705 }, - { -3756, -1072, 5647, 3536 }, - { -2870, -1439, 5026, 3212 }, - { -3913, -3225, 3669, 2144 }, - { -3739, 226, 5747, 764 }, - { -2052, -820, 5266, 3093 }, - { -3214, -3820, 2409, 2391 }, - { -4398, -2588, 3501, -218 }, - { -4484, -1763, 4180, -198 }, - { -3368, -1525, 4362, -134 }, - { -2407, 224, 4905, 3533 }, - { -1369, -2937, 4728, 1788 }, - { -4848, -1707, 4159, 851 }, - { -3454, -1749, 4281, 3230 }, - { -1990, -3853, 3487, 1735 }, - { -3117, 92, 6155, 4075 }, - { -2676, -2472, 4078, -589 }, - { -1547, -2012, 2626, 1835 }, - { -4275, -588, 4824, 725 }, - { -601, -2249, 3736, 3548 }, - { -4060, -61, 5333, 3097 }, - { -4303, 7, 6551, 3054 }, - { -5003, -1029, 5786, 3319 }, - { -2810, -728, 5392, 199 }, - { -1232, -200, 5228, 3121 }, - { 2621, 165, -6255, 298 }, - { 3669, 537, -6844, 1564 }, - { 1598, -1190, -6235, 2523 }, - { 2164, -32, -6894, 1383 }, - { 853, -1597, -6069, 1449 }, - { 1377, -1661, -5266, 108 }, - { 2660, 48, -5172, -517 }, - { 1903, -391, -5677, 1010 }, - { 3792, 206, -5274, -11 }, - { 1239, 2776, -2929, 2721 }, - { 4071, 149, -7259, 3125 }, - { 1436, -480, -6156, -196 }, - { 1373, -1960, -5005, 3122 }, - { 3413, -1271, -5176, 3283 }, - { 3060, -68, -6495, 2238 }, - { 2700, -2075, -4681, 91 }, - { 2928, -1728, -5168, 1858 }, - { 4424, 828, -4471, 88 }, - { 2672, -2604, -4038, 2753 }, - { 5223, -123, -6749, 2295 }, - { 4237, -420, -5538, 1353 }, - { 4744, -1281, -4097, 4708 }, - { 1103, -2764, -4751, 2024 }, - { 3747, -1913, -3911, 3960 }, - { 2470, -1416, -5542, 615 }, - { 4847, -1354, -5334, 1733 }, - { 5336, 88, -7593, 4007 }, - { 2388, -2880, -4807, 1037 }, - { 4495, 1391, -5685, -139 }, - { 5253, 1637, -6450, 1533 }, - { 1199, 795, -5515, 1261 }, - { 1397, -1259, -4252, 3838 }, - { 746, 70, -6640, 604 }, - { 1584, 166, -4972, 3072 }, - { 380, -999, -5397, 2267 }, - { 2974, 1707, -3242, 5360 }, - { 5202, -403, -5453, 2832 }, - { 3718, -1731, -4760, 714 }, - { 4150, -975, -4792, 61 }, - { 2925, -818, -4841, 15 }, - { 5301, 577, -4006, 3259 }, - { 5265, 1986, -5679, 3028 }, - { 3752, 1928, -4509, 3729 }, - { 3278, 1925, -6370, 1247 }, - { 5107, 1721, -4853, 3127 }, - { 3279, 2982, -2515, 4005 }, - { 4622, 668, -6204, 759 }, - { 6034, 317, -5763, 4818 }, - { -558, 57, -3785, 2817 }, - { 4476, 1616, -3965, 4536 }, - { 5953, 2056, -8215, 2715 }, - { 4387, 2613, -7463, 868 }, - { 5834, 1088, -4736, 4924 }, - { 6473, -856, -6991, 4172 }, - { 4959, -293, -5162, 76 }, - { 2731, -843, -6119, 3847 }, - { 3245, 1202, -6833, 616 }, - { 2553, 1383, -3829, 3859 }, - { 4332, 2099, -3480, 3622 }, - { 2110, 2683, -2728, 3990 }, - { 876, 1167, -3290, 3466 }, - { 3991, 1709, -2410, 4077 }, - { 5105, 939, -2584, 3256 }, - { 4719, 688, -1566, 3040 }, - { -3632, 4335, 1266, -3303 }, - { -4956, 3207, 1312, -2806 }, - { -4669, 2627, 2663, -2435 }, - { -4282, 3708, 2303, -3038 }, - { -4536, 2297, -175, -3350 }, - { -5234, 2503, -139, -880 }, - { -3978, 1512, 1092, -3619 }, - { -4519, 4649, 1363, -2455 }, - { -5118, 3132, 1961, -1577 }, - { -5196, 3379, -182, -1378 }, - { -6420, 4486, 2397, -1993 }, - { -5030, 5046, 1292, -1118 }, - { -4559, 2573, -927, -1406 }, - { -3501, 3730, 691, -4930 }, - { -4364, 2758, 1007, -3909 }, - { -4026, 2839, -1559, -2340 }, - { -5037, 4053, 836, -1571 }, - { -4727, 5136, 1110, -3588 }, - { -5245, 2799, -999, -2164 }, - { -4954, 1501, 422, -3963 }, - { -5994, 2726, 1462, -2833 }, - { -5621, 5159, 2038, -2512 }, - { -4991, 2291, 1917, -3151 }, - { -5469, 4382, -148, -2978 }, - { -5858, 1983, 807, -2720 }, - { -4709, 3556, 952, -467 }, - { -2489, 2362, 1714, -4230 }, - { -4717, 5004, -1180, -3672 }, - { -5914, 3653, 1359, -1317 }, - { -5506, 2995, 780, -1059 }, - { -5287, 3945, 2480, -2293 }, - { -3849, 4358, 322, -1770 }, - { -3911, 3570, 252, -3185 }, - { -3660, 5128, 158, -3719 }, - { -4599, 3277, -503, -2727 }, - { -3673, 3760, -1252, -3339 }, - { -5161, 2337, 388, -1943 }, - { -3529, 2216, 2156, -3080 }, - { -4309, 4331, 1808, -1460 }, - { -4782, 3820, 480, -2504 }, - { -4166, 3544, -378, -1567 }, - { -5572, 2466, -418, -2909 }, - { -6096, 2930, 119, -1878 }, - { -5963, 3554, 1011, -2233 }, - { -6433, 4335, 935, -2930 }, - { -5004, 3314, -1352, -3430 }, - { -6042, 3463, -1008, -3940 }, - { -4671, 2214, -640, -5040 }, - { -2795, 3759, 1412, -3803 }, - { -3647, 4436, 729, -515 }, - { -3594, 1033, 56, -4148 }, - { -2908, 3027, 2889, -3485 }, - { -3338, 2234, 313, -4285 }, - { -3825, 4497, -561, -2634 }, - { -6167, 3012, -48, -3149 }, - { -4828, 3515, -969, -4475 }, - { -5789, 2757, -539, -4173 }, - { -2452, 3067, 564, -4249 }, - { -4921, 1358, 1331, -2889 }, - { -3127, 4239, -1045, -1523 }, - { -4780, 2326, -1118, -3446 }, - { -3908, 5546, 152, -2622 }, - { -6972, 2976, 337, -2809 }, - { -4839, 4613, -35, -4077 }, - { -1408, 4822, -1149, -4997 }, - { -981, 4979, -912, -6304 }, - { -2098, 5689, -888, -2878 }, - { -3343, 4814, -657, -4434 }, - { -2461, 3601, -967, -4869 }, - { -2652, 3944, 87, -5520 }, - { -1104, 6076, 174, -6407 }, - { 355, 5370, -1721, -5869 }, - { 1242, 4497, -1107, -5091 }, - { -89, 4002, -1491, -5182 }, - { 1059, 5693, -1591, -4905 }, - { 1323, 4682, -2078, -4768 }, - { 818, 3996, -549, -5468 }, - { -287, 4529, 929, -5543 }, - { -919, 5519, -2791, -2844 }, - { -1407, 5679, -3289, -3974 }, - { -189, 6530, -3547, -4002 }, - { -900, 7039, -3371, -4855 }, - { -2983, 7211, -363, -4835 }, - { -814, 6503, -104, -5106 }, - { -2386, 6896, 809, -4919 }, - { 845, 4492, 352, -6621 }, - { -1998, 7237, -1646, -4231 }, - { -3380, 6251, 471, -4577 }, - { -1908, 7059, 84, -5726 }, - { -340, 6346, -803, -6265 }, - { -2279, 5834, -47, -4633 }, - { -1532, 5286, -1748, -1901 }, - { -2757, 6188, -453, -3415 }, - { -1255, 6405, -2043, -6357 }, - { 918, 5581, -121, -5667 }, - { 1840, 5336, -821, -5034 }, - { -2475, 4992, -1825, -3104 }, - { -2413, 5606, -1789, -4298 }, - { 132, 5128, -2389, -4442 }, - { 223, 6400, -2653, -4742 }, - { -673, 5012, 680, -4582 }, - { -1657, 6624, -349, -3596 }, - { -755, 6289, -1860, -3978 }, - { -572, 6894, -1946, -5207 }, - { -1141, 4756, -2665, -5586 }, - { -1073, 4269, -431, -4030 }, - { 186, 5761, 916, -5868 }, - { -1907, 4836, 1017, -5106 }, - { -963, 3363, -1248, -6348 }, - { -3262, 4774, -1818, -5858 }, - { 847, 3812, -2538, -4302 }, - { -1223, 5903, 1360, -5479 }, - { -1094, 6923, -1244, -2381 }, - { 267, 6276, -709, -2846 }, - { -157, 5840, 1124, -4266 }, - { 889, 3206, -910, -5305 }, - { -1736, 3344, 582, -4838 }, - { -2357, 5676, -2695, -6277 }, - { -1916, 6901, -986, -5397 }, - { -3062, 6028, -695, -5687 }, - { 1836, 3566, -1357, -5226 }, - { -2176, 4938, 646, -3872 }, - { -2199, 3055, -208, -6124 }, - { -236, 3032, -821, -5325 }, - { -3989, 7277, -565, -3899 }, - { -595, 4362, 74, -5975 }, - { 684, 5874, -841, -4424 }, - { -2731, 6305, -2389, -5465 }, - { -5775, 1325, -56, -2528 }, - { -7029, -534, -1890, -3278 }, - { -5798, -15, -2734, -2210 }, - { -5504, -1198, -353, -3659 }, - { -5079, 960, -894, -4336 }, - { -6073, -36, -133, -3014 }, - { -5782, -259, -1025, -3986 }, - { -6843, 1262, -807, -1639 }, - { -5263, -918, -3290, -579 }, - { -4840, 461, -2158, -533 }, - { -6014, -50, -620, 504 }, - { -5843, 241, -1359, -282 }, - { -5898, 577, 769, -3271 }, - { -6833, -946, -466, -3347 }, - { -6026, 1459, -512, -729 }, - { -7361, 747, -388, -1110 }, - { -6391, 2142, -1160, -2513 }, - { -6995, 304, 498, -2673 }, - { -6757, 679, -386, -433 }, - { -5222, 1688, -1093, -1032 }, - { -5019, 575, 184, -3627 }, - { -4237, 628, -3507, -1243 }, - { -7479, -456, -1722, -1486 }, - { -6464, 713, -1273, -1153 }, - { -6255, 1682, -606, -3607 }, - { -7033, 1497, -71, -1955 }, - { -6694, 1556, -1721, -3214 }, - { -6114, -356, 813, -2575 }, - { -5308, 632, -1851, -1636 }, - { -5742, -911, -1733, 383 }, - { -6083, -387, -2313, -879 }, - { -6535, -530, -1505, -2083 }, - { -4896, 1223, -2750, -1816 }, - { -6392, -463, -3247, -2093 }, - { -5373, 1264, -2706, -3042 }, - { -3894, -1390, -1020, -891 }, - { -6179, 1168, -1966, -1922 }, - { -5162, 1668, -1617, -1916 }, - { -6453, 920, -1169, -2432 }, - { -6130, 2005, -536, -1519 }, - { -6552, -98, -518, -1938 }, - { -7528, 355, -1101, -1772 }, - { -5745, 610, -247, -1360 }, - { -7003, 177, -2064, -1958 }, - { -6956, -570, -2220, -4225 }, - { -7830, 791, -1394, -2774 }, - { -7634, 480, -3171, -4224 }, - { -7913, 1154, -350, -2381 }, - { -5063, 1704, -1804, -2977 }, - { -4887, -524, -2703, 188 }, - { -5551, 406, -1620, -3063 }, - { -7109, 1342, 381, -3021 }, - { -6846, 631, -458, -3398 }, - { -4606, -605, 11, -3930 }, - { -8134, -225, -1738, -2648 }, - { -7043, 402, -2734, -3059 }, - { -7417, 1825, -2545, -4389 }, - { -6971, -236, -1031, -665 }, - { -5752, 2111, -1632, -3808 }, - { -7660, -78, -624, -3135 }, - { -6358, 619, -1951, -3911 }, - { -8134, 408, -1935, -3695 }, - { -6335, 1911, -2368, -4505 }, - { -7116, 2163, -344, -2753 }, - { 2357, 4488, 2220, -5682 }, - { 1385, 3206, 2300, -5305 }, - { 1419, 2557, 5203, -3516 }, - { 262, 4315, 3920, -1847 }, - { 3316, 3187, 1612, -5609 }, - { 1729, 2350, 1673, -6068 }, - { 1603, 6126, 1467, -2839 }, - { -1339, 3316, 3691, -3530 }, - { -563, 4618, 3180, -4548 }, - { 463, 4624, 3111, -5614 }, - { 1246, 5455, 3356, -5720 }, - { 480, 2149, 5422, -2893 }, - { 1768, 4827, 913, -5579 }, - { -149, 5381, 4366, -3297 }, - { 985, 3672, 2644, -92 }, - { -258, 2911, 5817, -2213 }, - { 3428, 3289, 3351, -3541 }, - { -666, 3295, 4727, -2869 }, - { 35, 6641, 4160, -4052 }, - { 623, 6787, 3156, -4560 }, - { 2654, 4360, 4676, -4632 }, - { 1386, 5246, 4834, -4497 }, - { 3488, 4574, 3856, -5946 }, - { 383, 4481, 4168, -4110 }, - { 1753, 3652, 4288, -3326 }, - { 1344, 4905, 2508, -4660 }, - { 1580, 4106, 3104, -2224 }, - { 2027, 5038, 1683, -1554 }, - { 446, 3699, 5872, -3013 }, - { 4637, 4087, 3578, -5018 }, - { 2629, 3560, 5331, -4900 }, - { 1527, 6674, 2523, -4131 }, - { -1437, 2804, 2528, -4464 }, - { -229, 3355, 2016, -5537 }, - { 3666, 3418, 4374, -4581 }, - { 1192, 3799, 923, -6596 }, - { 2040, 2956, 448, -5322 }, - { 2468, 5768, 4029, -5869 }, - { 3438, 6516, 3529, -6667 }, - { 2737, 5495, 680, -5535 }, - { 3896, 5727, 1801, -4958 }, - { 4988, 4957, 3592, -6518 }, - { -542, 4416, 5794, -2787 }, - { 4136, 4354, 2064, -4696 }, - { 3067, 5936, 1207, -3396 }, - { 2789, 4966, 2405, -3854 }, - { 1731, 3270, 3251, -1063 }, - { 1767, 5537, 2084, -2349 }, - { 465, 3116, 4532, -837 }, - { 1499, 2627, 4610, -2212 }, - { 122, 3095, 3642, -3552 }, - { 2542, 2866, 2705, -6402 }, - { 3134, 4323, 698, -4785 }, - { 731, 1859, 3112, -5242 }, - { 2553, 2980, 3241, -4846 }, - { 1329, 5310, 1607, -6624 }, - { 2468, 1858, 3476, -1034 }, - { -172, 4996, 2000, -5562 }, - { 2621, 4220, 1574, -3386 }, - { -333, 1832, 3362, -4117 }, - { 2169, 6762, 3065, -6225 }, - { 2844, 5528, 3223, -4765 }, - { 526, 5175, 1644, -4267 }, - { 2922, 4426, 2414, -2610 }, - { 452, 1399, -4516, -2636 }, - { 2872, 1720, -4667, -1435 }, - { 1279, 702, -5424, -1984 }, - { 2187, 870, -5021, -1341 }, - { 583, -144, -4628, -2464 }, - { 3, 2237, -5284, -2827 }, - { -19, 1005, -5460, -1819 }, - { 2897, 2084, -5885, -515 }, - { -400, 3370, -5527, -2947 }, - { 1505, 2593, -5518, -1802 }, - { 1341, 4534, -5094, -1899 }, - { 3241, 3670, -5493, -1252 }, - { -1287, 921, -5994, -1675 }, - { 627, 408, -6652, -364 }, - { -260, 1127, -4849, -3247 }, - { 371, 3400, -5976, -2285 }, - { 1533, 1566, -6373, -610 }, - { 2462, 4274, -6184, -1254 }, - { 1782, 3363, -6222, -1381 }, - { 572, 4650, -5673, -2754 }, - { 2674, 3414, -4460, -2154 }, - { 3614, 3820, -6883, -398 }, - { 1136, -1, -5511, -1112 }, - { -1773, 1137, -5647, -2377 }, - { -753, 2104, -6085, -2565 }, - { -204, 3025, -4731, -1418 }, - { -1486, 1438, -4380, -216 }, - { 302, 858, -5786, -264 }, - { 3486, 1495, -5234, -783 }, - { 888, 2327, -3423, -3720 }, - { -259, 772, -6596, -1311 }, - { -1197, 2073, -5174, -1826 }, - { 1500, 3470, -4462, -2645 }, - { 3072, 1960, -3277, -2264 }, - { 1841, 952, -4324, -2340 }, - { 1994, 2200, -3940, -2923 }, - { -1782, 1699, -4667, -1075 }, - { -1464, 2906, -3468, -375 }, - { 366, 2380, -3747, 1467 }, - { -545, 1645, -4619, 376 }, - { 1724, 2350, -2374, -3512 }, - { 3184, 2628, -2996, -3275 }, - { 734, 2010, -6239, -1479 }, - { 524, 3756, -4496, -3263 }, - { 1492, 3570, -3494, -3600 }, - { -932, 618, -5389, -2894 }, - { -133, 2161, -4083, -3267 }, - { 786, 774, -3279, -3731 }, - { 1078, 803, -3843, -3007 }, - { -332, 3405, -3347, 40 }, - { -17, 6, -4005, -3690 }, - { -189, 4372, -4488, -2561 }, - { -450, 3846, -3790, -1370 }, - { 362, 2212, -5272, -15 }, - { -1529, 791, -6802, -2296 }, - { 2145, 4241, -4474, 376 }, - { 1813, 2426, -2932, -2726 }, - { -542, 4557, -3140, -1080 }, - { 1192, 3784, -4371, -20 }, - { 2784, 5188, -6399, -1394 }, - { 431, 4561, -3673, -1398 }, - { 1382, 3096, -4083, 1253 }, - { 1209, 4224, -2930, 1500 }, - { 2798, 2684, -6676, -606 }, - { -2396, 1510, -5381, -2713 }, - { -2625, 2542, -4032, -2880 }, - { -1231, 3967, -4098, -2886 }, - { -1393, 2374, -3862, -4525 }, - { -2495, 1665, -1637, -5445 }, - { -3854, 1759, -1750, -4944 }, - { -2373, 1668, -2856, -6251 }, - { -2668, 1981, -886, -4557 }, - { -2927, 4427, -3451, -6172 }, - { -1925, 2596, -4696, -2527 }, - { -3202, 2847, -3928, -5896 }, - { -3332, 1665, -5025, -3412 }, - { -3212, 3115, -4155, -4062 }, - { -1013, 3205, -5133, -3751 }, - { -2022, 4595, -3947, -5611 }, - { -3556, 1755, -3715, -2300 }, - { -1784, 4114, -2723, -1773 }, - { -3586, 4081, -2733, -4942 }, - { -1608, 3685, -4154, -4573 }, - { -3368, 4042, -4452, -6227 }, - { -1407, 3881, -5729, -3719 }, - { -2751, 3281, -5077, -4999 }, - { -3791, 2410, -4906, -5288 }, - { -730, 2303, -4217, -3755 }, - { -1812, 2311, -5492, -3709 }, - { -610, 4336, -3915, -3783 }, - { -2841, 4337, -4278, -4430 }, - { -1662, 4666, -4661, -3964 }, - { -589, 5209, -4923, -3682 }, - { -4155, 2234, -4076, -4218 }, - { -3951, 2770, -2665, -2805 }, - { -2302, 3228, -3717, -1908 }, - { -3129, 4373, -2264, -2851 }, - { -447, 1363, -3578, -4323 }, - { -2648, 4237, -3159, -3071 }, - { -4072, 3241, -3541, -4605 }, - { -4507, 3458, -2339, -3838 }, - { -1646, 997, -4926, -3970 }, - { -3025, 1614, -3940, -1242 }, - { -1337, 1756, -3163, -5529 }, - { -3203, 1865, -3282, -4354 }, - { -1646, 2118, -2203, -6018 }, - { 174, 1871, -2707, -4639 }, - { -2607, 1485, -4778, -4750 }, - { -2199, 3991, -3134, -4879 }, - { -2962, 3323, -2816, -2419 }, - { -5286, 2495, -4548, -5395 }, - { -2810, 3710, -2274, -4211 }, - { -330, 3006, -2993, -4678 }, - { -1187, 2411, -2743, -5196 }, - { -664, 4033, -3101, -5641 }, - { -1458, 3602, -2816, -5371 }, - { -4116, 4923, -3321, -5630 }, - { -4165, 2528, -2592, -4798 }, - { -2759, 3080, -2333, -5719 }, - { -5157, 3011, -5526, -6348 }, - { -3095, 2126, -5881, -4234 }, - { -4377, 3849, -3600, -6099 }, - { -1994, 4947, -5235, -4753 }, - { -1067, 600, -3258, -5133 }, - { -4992, 3302, -2208, -5051 }, - { -3377, 2981, -1655, -4815 }, - { -3325, 2446, -1787, -6116 }, - { -2341, 2737, -3240, -6347 }, - { -2258, -3732, 3710, -1235 }, - { -1558, -3849, 2694, -3012 }, - { -599, -4837, 3050, -2951 }, - { -2246, -5433, 2798, -1910 }, - { -2255, -4989, 3260, 270 }, - { -3026, -5353, 2693, -1036 }, - { -1151, -6097, 1097, -3782 }, - { -3391, -6012, 2130, -1303 }, - { -2850, -4422, 3375, -480 }, - { -1138, -3779, 1491, -4162 }, - { -551, -3892, 3787, -2082 }, - { -3221, -3676, 3144, -1202 }, - { -3023, -5196, 2650, 605 }, - { -1756, -5729, 2646, 321 }, - { -2693, -4409, 494, -4797 }, - { -1913, -4573, 3372, -1730 }, - { -1277, -3604, 4061, -993 }, - { -420, -4993, 1351, -4796 }, - { -3052, -5333, 1435, -1242 }, - { -602, -5034, 3869, -1141 }, - { -2436, -4680, 1665, -3019 }, - { -2657, -3658, 1459, -3391 }, - { -1220, -6246, 2749, -525 }, - { -3838, -4844, 2265, -1735 }, - { -1247, -5679, 3356, -1417 }, - { -917, -5448, 3342, 105 }, - { -1756, -6839, 2276, -2350 }, - { -412, -5206, 1764, -3539 }, - { -1439, -6915, 1442, -3750 }, - { -1381, -4439, 3863, -282 }, - { -3482, -4953, 2726, -336 }, - { -1376, -5931, 1714, -1987 }, - { -1716, -4405, 2608, 105 }, - { -1590, -5191, 2652, -2704 }, - { -2149, -6442, 2453, -1263 }, - { -3426, -3832, 2334, -1829 }, - { -2747, -5948, 2362, -173 }, - { -2435, -3267, 2966, -1710 }, - { -3979, -4282, 2705, -775 }, - { -356, -4238, 2544, -4343 }, - { -1363, -6471, 2817, -1836 }, - { -2878, -5117, 218, -3149 }, - { -3539, -5196, 1710, -2356 }, - { -2888, -4537, 2746, -1701 }, - { -1870, -4439, 1496, -4121 }, - { -1486, -3388, 3349, -2145 }, - { -3333, -4138, 1467, -2876 }, - { -345, -5340, 1012, -1190 }, - { -1672, -4992, 2289, -1029 }, - { -2146, -5528, 3038, -635 }, - { -316, -3656, 3426, -3152 }, - { -2695, -5812, 2336, -2050 }, - { -2067, -6052, 737, -3258 }, - { -2664, -4205, -350, -1266 }, - { -617, -5406, 80, -4853 }, - { -2418, -3825, 1853, -1326 }, - { -1961, -4339, 583, -4315 }, - { -1495, -5141, -133, -5205 }, - { -3208, -6440, 1691, -2069 }, - { -2632, -3633, 2325, -2761 }, - { -2624, -5670, 1252, -3676 }, - { -3687, -5608, 687, -2833 }, - { -3320, -5707, 16, -3877 }, - { -2738, -6112, 84, -5135 }, - { 2277, -5661, 3076, 843 }, - { 1555, -5769, 2821, -5236 }, - { 536, -6381, 603, -4910 }, - { 734, -4609, 3314, -4092 }, - { 1836, -4547, 3267, -4322 }, - { -13, -5976, 3752, -1607 }, - { 1423, -6318, 2336, 398 }, - { 365, -7779, 1498, -534 }, - { 2104, -8366, 2946, -1345 }, - { 143, -5545, 1898, -3756 }, - { 655, -6852, 1430, 148 }, - { 4, -6653, 2397, -59 }, - { 2346, -5996, 4562, -934 }, - { 1229, -7104, 2963, -598 }, - { -528, -7048, 2887, -1790 }, - { 1451, -6857, 3900, -1637 }, - { 554, -6018, 3336, 9 }, - { 3278, -5758, 4034, 129 }, - { 3541, -7145, 4905, -1575 }, - { 2339, -6907, 3464, -301 }, - { 2775, -7301, 1667, -3894 }, - { 539, -7887, 991, -4156 }, - { 2115, -7421, 3131, -3075 }, - { 2803, -8546, 2564, -5836 }, - { 2869, -5833, 1620, -4561 }, - { 2591, -7281, 3215, -4719 }, - { -1228, -8477, 706, -4782 }, - { 1967, -5243, 4813, -1940 }, - { 701, -7010, 2273, -3893 }, - { 915, -8470, 1918, -5620 }, - { -94, -6715, 156, -3873 }, - { 1074, -5607, 4389, -1017 }, - { 2739, -6551, 1227, -3521 }, - { 725, -7835, 2701, -1291 }, - { -493, -7475, 2263, -1075 }, - { -412, -6508, 2984, -744 }, - { 665, -5451, 3725, -2692 }, - { 1499, -8129, 3564, -2072 }, - { 2870, -6333, 4487, -2108 }, - { 706, -5007, 3911, -152 }, - { -482, -8660, 1483, -2900 }, - { 2481, -6596, 2518, -1715 }, - { 1403, -6414, 1398, -5387 }, - { 652, -6267, 583, -5942 }, - { 694, -7540, 646, -6272 }, - { 2275, -7614, 256, -5015 }, - { 1416, -9727, 1900, -3153 }, - { 2760, -6433, 3875, -3771 }, - { 2325, -11196, 2182, -5155 }, - { 1223, -11061, 1377, -5097 }, - { 108, -10603, 307, -4952 }, - { -118, -8268, 1650, -1572 }, - { 1839, -7943, 1755, -612 }, - { 2501, -9056, 981, -2969 }, - { 2902, -8476, 1491, -5780 }, - { 1995, -11175, 1585, -3643 }, - { 696, -8212, 828, -2474 }, - { 1526, -8649, 1380, -1210 }, - { 461, -7253, 3222, -2229 }, - { 2966, -8641, 4121, -3271 }, - { 833, -6039, 2361, -1086 }, - { 3565, -7312, 1980, -5427 }, - { 2850, -8671, 3760, -1846 }, - { 2643, -7281, 2163, -173 }, - { 3463, -3706, -3132, -923 }, - { 1315, -3825, -3443, 2 }, - { 2594, -4083, -3815, 670 }, - { 1826, -4291, -2741, -155 }, - { 868, -3749, -4175, -298 }, - { 2008, -4237, -3897, -517 }, - { 1242, -3493, -4335, -1335 }, - { -88, -4142, -3390, -1529 }, - { 2176, -3488, -3822, -975 }, - { 1706, -5188, -3415, -637 }, - { 2717, -6159, -2333, -882 }, - { 1276, -3978, -4361, 537 }, - { 2471, -5556, -2866, -208 }, - { 799, -4673, -4086, 56 }, - { 1901, -4786, -3533, 270 }, - { 3036, -3902, -3606, -333 }, - { 2249, -3317, -4319, -144 }, - { 2594, -4207, -2105, -2930 }, - { 4008, -4774, -2626, -902 }, - { 1038, -3659, -3496, -2454 }, - { 2725, -3597, -3298, -1535 }, - { 1662, -5803, -2813, 175 }, - { 705, -3757, -3441, -1484 }, - { 1860, -5987, -2821, -886 }, - { 3786, -4918, -2199, -1929 }, - { 3683, -4235, -2547, -1287 }, - { 2531, -4896, -2956, -1593 }, - { 1005, -5585, -3324, -180 }, - { 1625, -5229, -1756, -3642 }, - { 1494, -5041, -2989, -2685 }, - { 2718, -4655, -3224, -867 }, - { 2374, -6640, -1745, -2975 }, - { 2133, -6436, -2477, -1499 }, - { 1833, -4418, -3523, -1512 }, - { 1128, -4910, -2658, -1106 }, - { 689, -4777, -2831, -2085 }, - { 3593, -5280, -2627, -315 }, - { 3264, -3771, -2673, -1861 }, - { 3202, -5602, -2409, 402 }, - { 552, -4618, -2221, -3002 }, - { 3095, -5356, -2666, -1083 }, - { 3401, -4609, -3146, 45 }, - { 3051, -4662, -2192, -2232 }, - { 2798, -5552, -2462, -1941 }, - { 2354, -5815, -2223, -2619 }, - { 192, -3708, -2807, -2658 }, - { 1886, -4226, -1862, -3529 }, - { 2526, -3976, -2819, -2332 }, - { 1577, -3870, -2711, -2806 }, - { 1288, -5588, -3382, -1403 }, - { 2711, -5399, -1564, -3253 }, - { 1459, -5492, -2222, -322 }, - { 2823, -5091, -2886, 776 }, - { 3559, -5821, -2109, -1360 }, - { 1587, -6331, -2760, -1909 }, - { 2139, -5213, -2874, -2120 }, - { 1318, -4337, -3695, -2098 }, - { 821, -4471, -1849, -565 }, - { 3329, -4782, -1725, -89 }, - { 582, -4914, -4105, -1119 }, - { 417, -4144, -4072, -2529 }, - { -199, -3803, -2765, -4042 }, - { 2731, -4283, -2143, 1 }, - { 2911, -6187, -1951, -2116 }, - { 1573, -6094, -493, -2838 }, - { 2081, -6927, -864, -3211 }, - { 1058, -7826, 79, -364 }, - { 3147, -5570, -684, -978 }, - { 3572, -5856, 1060, 1824 }, - { 1143, -6702, -1478, 338 }, - { 2341, -7220, -88, 260 }, - { 3639, -6861, 668, 815 }, - { 2227, -6268, -1706, 446 }, - { 3390, -6082, -353, 1302 }, - { 1123, -7556, -1237, -430 }, - { 1729, -7742, 729, -218 }, - { 1457, -6774, 587, 579 }, - { 505, -6919, -569, 371 }, - { 1106, -7245, 78, 158 }, - { 2755, -6745, -1122, 338 }, - { 3069, -6040, -1415, 986 }, - { 2174, -7064, -1430, -283 }, - { 1390, -8626, -446, -3031 }, - { 3534, -6890, -431, 547 }, - { 2267, -9618, 475, -2994 }, - { 3672, -7673, 75, -115 }, - { 2131, -7560, -1206, -750 }, - { 2972, -7477, -685, -262 }, - { 1604, -6637, -672, 699 }, - { 1666, -7577, -577, -240 }, - { 1591, -6554, -2158, -94 }, - { 2348, -6286, -353, 1123 }, - { 2017, -8810, -412, -1805 }, - { 2892, -6713, -1765, -554 }, - { 2500, -6828, -1995, -1197 }, - { 3877, -6639, -224, -1655 }, - { 2392, -7872, -91, -333 }, - { 3562, -7370, -532, -2836 }, - { 2552, -7614, 164, -1805 }, - { 990, -6104, 218, 438 }, - { 910, -7861, 312, -1195 }, - { 1472, -6327, 372, -640 }, - { 1576, -7143, -1983, -843 }, - { 422, -7625, -457, -278 }, - { 1797, -8532, 405, -1011 }, - { 1088, -7396, -238, -2277 }, - { 3209, -6753, -1431, -2072 }, - { 2617, -6839, 100, -2573 }, - { 2575, -8573, -387, -3188 }, - { 3618, -6971, -1190, -321 }, - { 2205, -7361, -1695, -2008 }, - { 2985, -6297, 1464, 1179 }, - { 2804, -7310, 1053, 338 }, - { 1362, -6074, -1163, -840 }, - { 3336, -6325, -1794, 21 }, - { 2836, -8109, 818, -329 }, - { 2791, -5879, 560, 1546 }, - { 2392, -6064, 135, 100 }, - { 1838, -6194, 596, 1085 }, - { 1926, -7515, -414, -4901 }, - { 3225, -7298, -1202, -1189 }, - { 3960, -7558, -659, -719 }, - { 3442, -6647, -1692, -1095 }, - { 3381, -6441, 262, -886 }, - { 1431, -8150, -1186, -1406 }, - { 340, -8498, -150, -899 }, - { 3004, -8149, -260, -953 }, - { 2749, -6611, 563, 873 }, - { -6647, -1325, -4517, -4691 }, - { -6005, -1657, -4089, -3797 }, - { -3157, 588, -5213, -3068 }, - { -3311, -1425, -6329, -3726 }, - { -5866, -819, -3857, -2744 }, - { -5001, -1799, -1075, -4621 }, - { -5330, -2650, -2672, -4664 }, - { -4930, -539, -2363, -4010 }, - { -2984, 10, -3863, -5749 }, - { -1055, -2106, -3713, -4267 }, - { -5476, -502, -4279, -6504 }, - { -5231, -1543, -5018, -6425 }, - { -5134, -363, -3165, -5109 }, - { -3953, -771, -4107, -6393 }, - { -2159, -563, -3652, -5342 }, - { -3888, -2321, -919, -5057 }, - { -1236, -597, -4235, -4193 }, - { -4053, 675, -3083, -6174 }, - { -2793, -1089, -5396, -3460 }, - { -3000, -44, -2209, -6575 }, - { -3336, -1531, -4313, -5160 }, - { -2127, 128, -4851, -3692 }, - { -3321, 136, -2067, -5660 }, - { -5215, 1404, -4374, -4356 }, - { -2747, 400, -6340, -3691 }, - { -3926, -599, -5361, -5006 }, - { -2875, -2592, -5143, -4092 }, - { -4991, -1958, -5322, -4891 }, - { -4965, -1318, -6652, -5333 }, - { -4920, -1691, -3388, -5561 }, - { -3644, -3354, -2688, -5982 }, - { -5076, -919, -4563, -2984 }, - { -6114, 250, -3884, -3915 }, - { -4014, 744, -3973, -1924 }, - { -5543, -1041, -5557, -3847 }, - { -4711, -1352, -5649, -2603 }, - { -3362, 775, -5305, -4879 }, - { -5001, 107, -3554, -2888 }, - { -6258, -1651, -6356, -6566 }, - { -4529, 407, -5003, -3865 }, - { -5154, 550, -5278, -5465 }, - { -4195, -467, -1894, -3129 }, - { -5022, 1127, -3349, -3314 }, - { -6075, 1250, -4313, -5641 }, - { -2677, -2283, -2312, -5903 }, - { -4113, 193, -1195, -4833 }, - { -3940, -1048, -1389, -5079 }, - { -3703, 917, -4043, -4451 }, - { -3366, -4231, -1534, -5488 }, - { -3326, -3583, -2091, -4903 }, - { -5144, 1254, -2532, -4949 }, - { -5982, -870, -2545, -4555 }, - { -3925, -157, -5367, -2281 }, - { -6419, -746, -5668, -4371 }, - { -5787, 518, -7096, -5805 }, - { -4258, 954, -6453, -4321 }, - { -4771, -695, -4158, -1639 }, - { -7078, -760, -5195, -5877 }, - { -7348, 83, -4101, -4586 }, - { -2430, 184, -2874, -1679 }, - { -2284, -3943, -2924, -5034 }, - { -1804, -1785, -3002, -4710 }, - { -4399, -2772, -1815, -4637 }, - { -6340, -2626, -2824, -5191 }, - { -4998, -5168, -3480, 1905 }, - { -3958, -5492, -1599, 1579 }, - { -2471, -3755, -276, 3182 }, - { -3033, -5779, -1063, 1554 }, - { -2936, -4829, -1290, 2386 }, - { -1835, -5073, -3051, 1299 }, - { -1724, -3771, -3935, 2324 }, - { -5070, -2550, -3692, 768 }, - { -4326, -5333, -297, 1878 }, - { -3472, -5619, -3094, 992 }, - { -3027, -4384, -3038, 2265 }, - { -3201, -5332, 67, 2200 }, - { -1681, -4373, -1947, 2461 }, - { -3221, -3329, -4238, 2564 }, - { -1262, -2968, -2915, 3227 }, - { -3419, -1878, -3373, 2110 }, - { -2244, -5583, -2012, 1288 }, - { -1971, -5266, -990, 1812 }, - { -2975, -2778, -452, 4063 }, - { -2198, -1165, -3298, 2965 }, - { -4782, -4894, -4767, 664 }, - { -6002, -3950, -2806, 2025 }, - { -3142, -3162, -2859, 3295 }, - { -3262, -3340, -4123, 1596 }, - { -4014, -3918, -1955, 3361 }, - { -1700, -3463, -1346, 3449 }, - { -4245, -4445, -4743, 1644 }, - { -4180, -3969, -401, 3281 }, - { -2782, -5240, -4117, 1156 }, - { -5744, -4040, -1439, 3470 }, - { -5063, -4663, -323, 3172 }, - { -4531, -3319, -844, 3988 }, - { -6226, -5125, -2064, 2976 }, - { -3115, -3267, -1531, 3898 }, - { -4628, -4421, -2864, 2808 }, - { -4559, -2989, -3442, 2024 }, - { -1775, -4487, -656, 2477 }, - { -2664, -1865, -1884, 4081 }, - { -1828, -2575, -3894, 3378 }, - { -6441, -3677, -2025, 1677 }, - { -4141, -2156, -1191, 3474 }, - { -4802, -1623, -1727, 2160 }, - { -5474, -2745, -1475, 2498 }, - { -3664, -1056, -1975, 2491 }, - { -4672, -3062, -2235, 2933 }, - { -4205, -5960, -2849, 1517 }, - { -4995, -5708, -1739, 1805 }, - { -4892, -6080, -4793, 872 }, - { -4270, -4172, -4263, 2185 }, - { -4687, -1470, -2905, 1023 }, - { -6446, -5017, -3919, 1000 }, - { -6046, -5538, -3943, 2006 }, - { -6028, -3750, -3953, 771 }, - { -5959, -4582, -5024, 824 }, - { -5818, -2576, -2249, 1326 }, - { -5659, -5345, -1119, 2500 }, - { -3346, -4155, 606, 2749 }, - { -5680, -4827, -2501, 1838 }, - { -6193, -2543, -1295, 840 }, - { -6871, -4925, -3512, 1801 }, - { -5605, -1788, -1895, 779 }, - { -3922, -5712, -4644, 510 }, - { -4745, -3869, -4533, 99 }, - { -2984, -4907, -399, 1497 }, - { 1847, -478, 3061, -5812 }, - { 4450, -1116, 3609, -6570 }, - { 3139, 99, 3007, -5532 }, - { 2590, -3782, 3138, -4770 }, - { 1881, 1204, 5778, -3404 }, - { 3631, 2060, 5566, -5038 }, - { 3461, 1961, 5167, -3800 }, - { 2947, 273, 4536, -4389 }, - { 4453, -1730, 5788, -4370 }, - { 4032, 1805, 2666, -4534 }, - { 3487, -944, 2313, -6028 }, - { 1313, 34, 4210, -4067 }, - { 5632, -1502, 5825, -5855 }, - { 7736, -547, 4879, -5476 }, - { 4906, -1512, 4760, -5760 }, - { 3843, 447, 1091, -4958 }, - { 2982, -1135, 5442, -4386 }, - { 3579, 271, 3031, -6770 }, - { 3932, -211, 4688, -5507 }, - { 4411, 1720, 2387, -5584 }, - { 5379, -479, 4575, -6280 }, - { 3613, -362, 2012, -4885 }, - { 3744, -2013, 4493, -5073 }, - { 5693, 109, 4379, -3362 }, - { 5475, -621, 5317, -3985 }, - { 6411, -673, 5708, -4752 }, - { 4933, -796, 7262, -4290 }, - { 2804, 444, 6276, -3655 }, - { 4120, -517, 6078, -4531 }, - { 5119, 841, 3486, -3910 }, - { 4738, 1539, 3525, -2970 }, - { 5086, 370, 5895, -5640 }, - { 4235, 2716, 4589, -5044 }, - { 3691, 682, 6199, -4700 }, - { 6111, -570, 6271, -6528 }, - { 2611, 1277, 3756, -4802 }, - { 4395, 970, 3807, -5879 }, - { 5225, 2299, 3242, -4333 }, - { 5144, 1778, 4946, -5545 }, - { 2989, -3016, 3247, -5495 }, - { 2983, 920, 2071, -6059 }, - { 5270, -903, 4434, -2350 }, - { 6415, -585, 3970, -3554 }, - { 3866, -197, 5216, -2884 }, - { 3767, -1298, 6702, -3315 }, - { 6299, 2620, 5284, -6824 }, - { 6654, 646, 3653, -4927 }, - { 4770, 3047, 5160, -6287 }, - { 5364, 434, 2919, -5207 }, - { 2998, 1344, 4801, -2456 }, - { 3896, 1013, 3773, -1864 }, - { 2115, 655, 2999, -6344 }, - { 5170, -981, 2849, -4464 }, - { 2735, -2159, 2717, -5776 }, - { 2430, -1952, 4392, -4559 }, - { 6143, -1180, 3659, -4746 }, - { 4978, -1483, 1726, -4875 }, - { 3486, -2383, 3306, -4301 }, - { 1434, -1372, 4171, -4770 }, - { 3354, -2627, 1525, -5093 }, - { 6790, 2386, 3995, -5909 }, - { 1475, -2674, 3451, -4204 }, - { 1999, -3494, 3693, -5556 }, - { 4764, -2848, 2856, -5589 }, - { -3677, 5131, 2827, -2934 }, - { -2844, 7078, 2852, -3580 }, - { -3902, 6434, 4118, -1911 }, - { -1769, 7530, 3492, -3541 }, - { -1937, 5679, -447, -1127 }, - { -2456, 4680, 4196, -2407 }, - { -2778, 8241, 1698, -4288 }, - { -2876, 6104, 5182, -2387 }, - { -2802, 7341, 4463, -2938 }, - { -1025, 6267, 4752, -3201 }, - { -2349, 5413, 2041, -3794 }, - { -2252, 8225, 2856, -4269 }, - { -1465, 4967, 4976, -2500 }, - { -636, 7565, 3517, -4233 }, - { -1905, 5618, 3904, -2942 }, - { -302, 6816, 3343, -3316 }, - { -2210, 4156, 2817, -3511 }, - { -717, 6568, 1863, -2951 }, - { -3873, 5682, 2164, -575 }, - { -2878, 5835, 440, -2597 }, - { -3228, 7701, 2610, -2514 }, - { -3608, 8888, 3377, -2468 }, - { -2582, 9717, 2519, -3126 }, - { -5238, 6202, 2866, -2831 }, - { -3428, 7370, 3056, -335 }, - { -1681, 8836, 1210, -2010 }, - { -3276, 6724, 1156, -3930 }, - { -894, 8149, 827, -1258 }, - { -2965, 8631, 2549, -1320 }, - { -3961, 6902, 3581, 55 }, - { -1894, 7745, 1750, -841 }, - { -821, 6844, 850, -676 }, - { -608, 6948, -4, -1376 }, - { 615, 6524, 1089, -1147 }, - { -2972, 5668, 1091, -489 }, - { -157, 4649, 2904, -413 }, - { 673, 5121, 1498, -66 }, - { -390, 5902, 1611, -245 }, - { -2349, 5478, 4772, -1320 }, - { 88, 6798, 1972, -1859 }, - { -1213, 5120, 2991, 200 }, - { -2347, 6040, 2839, 376 }, - { -578, 5976, 3364, -1796 }, - { -1391, 5872, 3002, -965 }, - { -564, 4496, 3946, -1186 }, - { -2299, 6386, 3135, -2176 }, - { -2131, 5641, 2011, 1223 }, - { -772, 5807, 1124, 895 }, - { -2837, 6758, 2297, -740 }, - { -3091, 6298, 1415, -2126 }, - { -4197, 6036, 1843, -3022 }, - { -41, 6459, 92, 344 }, - { -2241, 6860, 2095, -4396 }, - { -1931, 7088, 2117, -2135 }, - { -2375, 4422, 1688, -3169 }, - { -1742, 6674, 1538, -119 }, - { -4818, 7749, 4192, -1577 }, - { -2004, 5672, 193, -430 }, - { -3825, 6042, 2128, -1898 }, - { -1108, 8033, 2119, -3013 }, - { -2370, 5453, 1721, 266 }, - { -1570, 7134, 614, -2638 }, - { -1519, 8752, 3503, -4330 }, - { -2050, 3845, 2907, -1126 }, - { 5085, 4412, -335, -1923 }, - { 3618, 1423, -613, -4012 }, - { 4481, 3729, 589, -4631 }, - { 4270, 3216, -1763, -3168 }, - { 4241, 1796, -1701, -2796 }, - { 4787, 2338, -487, -3639 }, - { 2915, 3429, -621, -4753 }, - { 5175, 1660, -1265, -3223 }, - { 4280, 4057, -684, -4079 }, - { 4980, 4419, -1455, -2719 }, - { 5436, 2464, 387, -4197 }, - { 4507, 4018, 1121, -3314 }, - { 6020, 2401, -413, -3201 }, - { 4200, 3789, -333, -2813 }, - { 5229, 2493, -1194, -1878 }, - { 5851, 2695, -492, -2292 }, - { 5743, 3288, -697, -1221 }, - { 5692, 2612, 979, -2227 }, - { 5085, 2067, 1046, -1214 }, - { 3163, 2240, -2098, -3435 }, - { 5228, 1898, 145, -2397 }, - { 5860, 3976, -418, -2872 }, - { 6008, 3399, 1027, -3506 }, - { 4126, 2035, 1865, -893 }, - { 5375, 3596, 511, -2362 }, - { 1937, 1493, -852, -122 }, - { 3473, 4849, 547, -2603 }, - { 4631, 2977, 1141, -1768 }, - { 6149, 3050, -71, -1886 }, - { 4069, 4353, -289, -1429 }, - { 2884, 1225, -1388, 365 }, - { 5485, 2518, -235, -571 }, - { 1216, 4375, 1443, 398 }, - { 4988, 3106, 107, -1435 }, - { 4511, 2801, 307, -444 }, - { 3235, 4386, 327, -676 }, - { 2055, 3708, 1657, -305 }, - { 5839, 2374, 290, -1385 }, - { 5110, 3305, 1936, -4206 }, - { 6416, 2920, 338, -2736 }, - { 3350, 2824, -1269, -3881 }, - { 4840, 1815, 464, 186 }, - { 2399, 3332, 238, 1238 }, - { 3516, 1363, 1582, 688 }, - { 3582, 1874, 154, -4770 }, - { 3261, 2878, 886, 283 }, - { 3877, 2658, -327, 884 }, - { 4151, 3436, 2173, -2923 }, - { 3592, 3674, 1281, -1295 }, - { 4561, 3730, -1114, -1747 }, - { 4595, 3625, -558, -575 }, - { 2577, 2348, 2267, 120 }, - { 5242, 3299, 32, -3412 }, - { 4264, 3637, 709, -2320 }, - { 6556, 3570, -838, -2472 }, - { 5745, 4014, -940, -1973 }, - { 5629, 4475, 477, -3328 }, - { 5269, 3199, 1682, -3085 }, - { 4432, 2416, 1145, -3299 }, - { 4465, 2505, 2162, -2186 }, - { 4643, 4941, -88, -2885 }, - { 4568, 5231, 552, -3915 }, - { 5667, 3075, -1406, -2963 }, - { 5418, 5259, -771, -2818 }, - { -256, -7875, 511, -471 }, - { -1813, -7971, -424, -396 }, - { -306, -7006, 862, 282 }, - { -2306, -6422, -1440, 508 }, - { -245, -6787, 375, -100 }, - { -1309, -6065, -20, 779 }, - { -1656, -6047, -641, 1307 }, - { -1496, -6522, 964, 726 }, - { -2291, -6588, -202, 795 }, - { -762, -7522, 1454, -558 }, - { -2270, -7004, -834, -580 }, - { -1139, -7078, 259, 362 }, - { -2535, -7568, -1040, 49 }, - { -3786, -7280, 934, -476 }, - { -3336, -6368, 606, 1056 }, - { -3602, -6924, 52, 714 }, - { -2278, -6550, 1674, 204 }, - { -2855, -5765, 930, 1530 }, - { -2889, -7325, -215, 305 }, - { -2749, -6080, -237, 1452 }, - { -985, -6667, 1577, 400 }, - { -2036, -6083, 380, 1267 }, - { -2077, -7460, 380, -30 }, - { -1775, -7175, 1540, -386 }, - { -3065, -6927, 989, 168 }, - { -2836, -7602, 117, -3392 }, - { -1058, -6396, 593, -3078 }, - { -844, -6062, 999, -236 }, - { -3261, -6951, 1491, -720 }, - { -2186, -8484, 75, -1287 }, - { -2882, -7756, 456, -510 }, - { -1800, -6879, 960, -1183 }, - { -2554, -7241, 1614, -1474 }, - { -2608, -5305, 392, 851 }, - { -2973, -6562, -859, 858 }, - { -2640, -5989, 1031, -416 }, - { -977, -8366, 705, -1434 }, - { -1213, -7409, -77, -1390 }, - { -1335, -6657, 2125, -123 }, - { -2544, -6862, 1852, -737 }, - { -3235, -6422, 1752, -103 }, - { -1300, -7557, 939, -348 }, - { -3476, -7579, 202, -109 }, - { -2482, -6572, 753, 619 }, - { -2554, -8136, -648, -429 }, - { -1012, -7870, -3, -421 }, - { -3604, -6247, 32, -3102 }, - { -1486, -7271, 2013, -1021 }, - { -578, -6799, -523, 405 }, - { -2841, -5948, 1644, 911 }, - { -2411, -7473, 1084, -484 }, - { -2238, -6033, 294, -1059 }, - { -3459, -6470, -201, -790 }, - { -2027, -6009, 1833, 805 }, - { -1433, -8047, 1531, -1754 }, - { -3258, -7884, 763, -1422 }, - { -1544, -6928, -729, 478 }, - { -2314, -8415, 74, -3757 }, - { -3201, -5684, 95, -2214 }, - { -2423, -8694, 725, -3631 }, - { -3545, -7071, 1162, -1798 }, - { -294, -9662, 403, -2274 }, - { -2290, -5460, 1196, 402 }, - { -1603, -6713, 903, -2363 }, - { 4121, 2491, -3142, -2482 }, - { 4500, 3305, -3671, -1567 }, - { 5973, 3172, -1348, -534 }, - { 4830, 3379, -1549, 643 }, - { 5214, 3938, -2641, -2302 }, - { 4639, 4826, -5532, -847 }, - { 5639, 2731, -2170, -963 }, - { 6084, 3487, -3525, -1346 }, - { 5971, 3154, -2190, -2316 }, - { 5618, 4865, -6927, 116 }, - { 5345, 3568, -7391, 709 }, - { 5429, 5078, -3811, -1524 }, - { 6960, 2037, -3515, -1096 }, - { 7092, 2531, -4557, -588 }, - { 6061, 4247, -5651, -478 }, - { 4595, 3684, -4907, -827 }, - { 7497, 3213, -3048, -424 }, - { 5996, 2137, -3098, -1745 }, - { 6198, 5199, -2223, -2274 }, - { 6888, 2851, -2768, -1675 }, - { 6114, 4210, -2316, -954 }, - { 7127, 4242, -3041, -1408 }, - { 6126, 3668, -1517, -1427 }, - { 6245, 6129, -4225, -1186 }, - { 6816, 3213, -2101, -964 }, - { 5345, 5276, -2643, -847 }, - { 6592, 4665, -4338, 484 }, - { 6746, 3751, -3443, 124 }, - { 5453, 1980, -2738, 2606 }, - { 4662, 2179, -4226, -1059 }, - { 5571, 3208, -3554, 174 }, - { 5256, 4447, -1815, -1481 }, - { 5400, 2570, -1210, 235 }, - { 7056, 2549, -2674, 318 }, - { 4574, 4340, -2892, -130 }, - { 6203, 4587, -3273, -305 }, - { 5103, 1925, -2715, -2137 }, - { 3905, 4296, -1700, 247 }, - { 4421, 4605, -3299, 811 }, - { 5671, 1273, -3870, -924 }, - { 5486, 1805, -4901, 133 }, - { 6437, 2578, -1828, -106 }, - { 5530, 5253, -5058, 1223 }, - { 4816, 2025, -1215, 1443 }, - { 3457, 3525, -2456, 3217 }, - { 3316, 2595, -1108, 2459 }, - { 3068, 3810, -2207, 1926 }, - { 6351, 5436, -6470, 600 }, - { 6324, 4240, -5365, 2416 }, - { 4851, 4774, -4075, 1878 }, - { 4900, 3679, -5198, 1078 }, - { 8347, 3633, -4565, -171 }, - { 5244, 5718, -3853, 173 }, - { 3960, 3492, -2939, 2105 }, - { 6070, 3473, -2351, 161 }, - { 8228, 3034, -3360, -901 }, - { 7006, 3985, -1940, -1926 }, - { 7123, 4681, -4301, -878 }, - { 5122, 4097, -1851, -449 }, - { 6200, 2060, -2251, 1049 }, - { 7106, 3844, -7209, 2625 }, - { 7108, 3370, -6734, 533 }, - { 6859, 2849, -3992, 1360 }, - { 5458, 2278, -3253, 1131 }, - { -1072, -2109, 4783, -1073 }, - { -319, -2604, 4257, -2418 }, - { 2466, 1300, 3476, -314 }, - { 2847, -1502, 5296, -141 }, - { 1667, -1273, 5559, -2725 }, - { 2877, -3402, 6434, 204 }, - { 53, -2637, 5275, -1181 }, - { 1091, -2215, 5803, -1549 }, - { 2397, -922, 4327, 1182 }, - { 219, -3747, 4647, -1564 }, - { -29, -2705, 4812, 1277 }, - { 1499, -2608, 5648, 1407 }, - { 2139, -2399, 4202, 2791 }, - { -426, -2064, 5528, 151 }, - { 2560, -2803, 6179, -2806 }, - { 4537, -2479, 3797, 1095 }, - { 888, -3357, 5341, -415 }, - { 4460, -1814, 5388, -1227 }, - { 3920, -3268, 6364, -703 }, - { 3343, -4698, 4410, 784 }, - { 309, -1897, 6306, 1223 }, - { 958, -3318, 4254, -3167 }, - { -99, 1596, 6018, -1983 }, - { -429, -853, 6407, 878 }, - { 1170, -1322, 6290, -417 }, - { 2288, -505, 6303, -1999 }, - { 3312, -1674, 6749, -2494 }, - { -415, -3401, 4721, -371 }, - { -189, -1210, 4844, -2002 }, - { 888, -4142, 4377, 130 }, - { 2469, -4381, 5398, -2492 }, - { 2879, -2912, 5094, -2598 }, - { -717, -617, 5650, -685 }, - { 1470, -3863, 5352, -1684 }, - { 3935, -96, 3823, -730 }, - { 3769, -430, 3168, 694 }, - { 2556, 385, 3539, 512 }, - { 77, -1415, 5111, 2655 }, - { 2724, -2158, 6715, -822 }, - { 1832, 1001, 5385, -1900 }, - { 900, 2198, 4464, -559 }, - { 441, 69, 5921, -1743 }, - { -1161, 738, 6732, -308 }, - { 257, 2035, 4091, 736 }, - { 1607, 1288, 4355, -23 }, - { -13, 1316, 4180, 1672 }, - { 1511, 1336, 3057, 1435 }, - { 2189, -3813, 4530, 939 }, - { 3632, -706, 2646, 1375 }, - { 4266, -3761, 4241, 1077 }, - { 3101, -427, 5273, -1202 }, - { 2293, 276, 4810, -313 }, - { 3430, -1851, 3101, 2045 }, - { 3453, -2979, 5142, 942 }, - { 1683, -3281, 4802, 2002 }, - { 3954, -4715, 5611, 578 }, - { 1272, -155, 5085, 454 }, - { 128, -194, 5095, 1409 }, - { 820, 880, 5797, -2658 }, - { -1095, 656, 5774, 1095 }, - { 813, -1669, 4320, -3251 }, - { -119, 518, 6372, -651 }, - { 2922, -4299, 6115, -877 }, - { 4205, -4273, 4004, 2642 }, - { -1211, -3892, 224, 3127 }, - { -34, -4371, 1321, 2318 }, - { 77, -6326, 1201, 828 }, - { 3995, -3775, 1958, 3233 }, - { 178, -3301, 1985, 3318 }, - { 2330, -3801, 1033, 3195 }, - { 1413, -5536, 826, 1709 }, - { 2468, -3499, 3653, 3631 }, - { 741, -4617, 1723, 2008 }, - { 1246, -3043, 2978, 3949 }, - { -343, -4308, 2258, 2189 }, - { -682, -4640, 454, 2272 }, - { 1236, -4829, 2491, 1642 }, - { -512, -3766, 1182, 3052 }, - { 119, -3939, 3712, 971 }, - { -1145, -4624, 1360, 2281 }, - { 101, -4746, 2866, 1255 }, - { -1500, -5455, 539, 1637 }, - { -969, -5909, 1414, 1128 }, - { -1261, -4939, -231, 2022 }, - { -226, -5345, 1207, 705 }, - { 2712, -5109, 3205, 1866 }, - { -476, -5913, 273, 1208 }, - { -2039, -4464, 624, 2545 }, - { -2351, -3930, 2019, 2673 }, - { -2675, -4849, 1522, 1990 }, - { -1524, -3461, 1446, 3204 }, - { 477, -5314, 1710, 1577 }, - { 656, -3729, 2346, 2511 }, - { 550, -5917, 1975, 1040 }, - { 1728, -4704, 3067, 1058 }, - { -9, -5247, 506, 1760 }, - { -574, -5135, 1675, 1672 }, - { 2129, -3781, 3444, 2313 }, - { 1144, -4439, 2214, 2529 }, - { 1292, -4160, 3185, 1833 }, - { 2445, -3262, 2534, 3227 }, - { 2266, -4401, 2023, 2400 }, - { -587, -3602, 3408, 2067 }, - { -885, -4951, 3228, 1174 }, - { -728, -2711, 2807, 3552 }, - { 1019, -3043, 3195, 2954 }, - { 1888, -4615, 1140, 2454 }, - { 660, -5616, 754, 800 }, - { -1975, -5371, 1649, 1585 }, - { -1544, -5436, 2422, 1081 }, - { -422, -5882, 2390, 750 }, - { 1336, -5557, 2441, 1230 }, - { 136, -4001, 267, 2854 }, - { -522, -3289, 2226, 2728 }, - { -971, -4580, 2471, 708 }, - { 704, -5306, 3300, 1001 }, - { 325, -3464, 3555, 2398 }, - { 794, -3686, 848, 3169 }, - { 660, -3017, 4584, 3242 }, - { -1486, -3978, 2170, 1644 }, - { -1615, -4650, 2688, 1844 }, - { 750, -4578, 538, 2239 }, - { 1668, -5849, 1455, 1031 }, - { 3486, -4681, 2030, 2183 }, - { 2642, -5429, 1696, 1761 }, - { 4491, -4502, 3538, 2767 }, - { 3545, -4528, 3514, 2982 }, - { 3269, -3676, 2758, 3966 }, - { 5572, 1146, 209, -3379 }, - { 7459, 1053, 593, -1896 }, - { 4480, 200, -310, -4259 }, - { 5577, -939, 242, -3992 }, - { 8142, 442, 1257, -3083 }, - { 5442, 1261, 1424, -3236 }, - { 6260, -183, 3125, -2532 }, - { 7179, 889, 1618, -2548 }, - { 6416, 932, 2379, -2487 }, - { 7094, 2560, 961, -3392 }, - { 7322, 463, 2732, -3735 }, - { 6632, 1577, 1912, -3272 }, - { 6312, 1349, 3028, -3460 }, - { 6105, 386, 1213, -977 }, - { 5478, 1158, 1114, -486 }, - { 6493, 410, 1686, -2180 }, - { 6378, 1881, 1333, -2240 }, - { 5711, 812, 1958, -1300 }, - { 6844, 877, 730, -1189 }, - { 6824, -245, 2249, -2000 }, - { 7515, 1521, 1251, -3058 }, - { 6697, 1051, 1300, -1749 }, - { 6476, 1425, 811, -2773 }, - { 7350, 465, -76, -2849 }, - { 6975, 2095, 567, -2492 }, - { 4691, 1736, 2660, -2289 }, - { 7837, 1456, 340, -2767 }, - { 7930, 507, 838, -2074 }, - { 6106, 1502, 766, -1110 }, - { 4891, -659, 835, -3954 }, - { 7250, 141, 1369, -1523 }, - { 7651, 67, 1651, -2298 }, - { 7364, -305, 601, -3132 }, - { 7179, 193, 2491, -2871 }, - { 6504, -272, 2167, -1322 }, - { 4456, 983, 2300, -421 }, - { 4817, 457, 1695, 371 }, - { 6914, 555, 850, -3159 }, - { 5904, 1030, 202, -1959 }, - { 6258, 880, 2233, -4503 }, - { 6029, 10, 2130, -3600 }, - { 6449, 985, 1129, -3963 }, - { 6616, -18, -111, -3285 }, - { 4496, 775, 817, -4276 }, - { 6134, 2338, 1470, -2973 }, - { 6911, 152, 430, -1946 }, - { 4053, 991, 3218, -1193 }, - { 5435, 1285, 3124, -2412 }, - { 5507, 1836, 1935, -1988 }, - { 5240, 689, 2189, -2670 }, - { 6638, 1719, 606, -1799 }, - { 5556, -180, 129, -2595 }, - { 5644, 1918, 1281, -4316 }, - { 6410, 1088, -282, -3117 }, - { 6503, 1841, 312, -3514 }, - { 6947, 20, 1358, -3886 }, - { 5464, 2109, 2398, -3194 }, - { 5616, -407, 2140, -498 }, - { 6121, 2707, 2379, -4096 }, - { 7303, 1846, 2266, -4095 }, - { 5444, 470, 2718, -1553 }, - { 5817, -645, 3285, -1349 }, - { 5625, 1427, 1103, -1991 }, - { 6041, -806, 1196, -2943 }, - { 3050, -5722, 4070, -5460 }, - { 3420, -4386, 4078, -5155 }, - { 6020, -3982, 7268, -2689 }, - { 7502, -4317, 7894, -3973 }, - { 4156, -3558, 5247, -4316 }, - { 4725, -4401, 7290, -1540 }, - { 6688, -5122, 8216, -3210 }, - { 9176, -6576, 9276, -4963 }, - { 8706, -5708, 7987, -4621 }, - { 7060, -3535, 6532, -3308 }, - { 5600, -2719, 5363, -1568 }, - { 4661, -2803, 6263, -4716 }, - { 3673, -3636, 6147, -3433 }, - { 5305, -2585, 6073, -2638 }, - { 7614, -1962, 6079, -5266 }, - { 6760, -3366, 7382, -4322 }, - { 6385, -3883, 4797, -1353 }, - { 8182, -5120, 4298, -4641 }, - { 9130, -6198, 4975, -3063 }, - { 7421, -5436, 5576, -3713 }, - { 3483, -4898, 5443, -2745 }, - { 4907, -5643, 6390, -4105 }, - { 8119, -7008, 7992, -6764 }, - { 6528, -6122, 6967, -5590 }, - { 5890, -4190, 6624, -5688 }, - { 6815, -7934, 7275, -5456 }, - { 5434, -4306, 5169, -5378 }, - { 4364, -6436, 5376, -2604 }, - { 8152, -3404, 5913, -5048 }, - { 7983, -4863, 4262, -2461 }, - { 8023, -6188, 6238, -5062 }, - { 6753, -3692, 3935, -3723 }, - { 6826, -4760, 3284, -4051 }, - { 7224, -7423, 4492, -3875 }, - { 6904, -2590, 6587, -6248 }, - { 6106, -1944, 7345, -5506 }, - { 4956, -2990, 7808, -3146 }, - { 6908, -6885, 5949, -1288 }, - { 7162, -6058, 3419, -3401 }, - { 7015, -7080, 6907, -3018 }, - { 6971, -6832, 5646, -3273 }, - { 8014, -5546, 5471, -1544 }, - { 6792, -2220, 5105, -2879 }, - { 8494, -3974, 4408, -3999 }, - { 9591, -4866, 6027, -4558 }, - { 5264, -5161, 6101, -738 }, - { 5803, -6141, 5197, -5231 }, - { 4657, -6822, 3232, -5189 }, - { 4791, -5135, 3809, -4665 }, - { 6108, -5103, 2379, -3873 }, - { 4680, -3909, 3234, -5093 }, - { 5802, -3853, 3795, -4984 }, - { 4360, -7483, 4802, -3877 }, - { 5429, -7517, 5911, -3717 }, - { 6866, -2280, 4880, -4634 }, - { 10131, -4628, 4414, -4092 }, - { 10811, -5189, 7746, -5337 }, - { 5663, -8941, 5287, -5680 }, - { 8023, -5991, 7403, -2796 }, - { 9669, -6919, 6525, -4932 }, - { 7275, -3796, 4962, -2547 }, - { 8848, -4806, 5677, -3080 }, - { 8128, -4308, 7749, -6569 }, - { 4032, -5196, 2282, -6239 }, - { 6593, 700, -229, 304 }, - { 8260, 539, -66, -1259 }, - { 6605, 176, -814, -109 }, - { 8057, 0, -1, -136 }, - { 7382, -38, -484, -1129 }, - { 8373, -929, 682, -454 }, - { 7674, 690, -1278, 546 }, - { 7326, -517, 406, -1283 }, - { 7612, -1715, -1167, 1175 }, - { 8590, 441, -782, -710 }, - { 8572, -1202, -291, 260 }, - { 7308, -147, -1785, 414 }, - { 6787, -353, -672, 934 }, - { 5177, -133, 179, 82 }, - { 4161, -34, 447, 1497 }, - { 5997, -902, 1533, -121 }, - { 5727, -871, -1370, 945 }, - { 8386, -252, 293, -823 }, - { 6573, -1354, 682, 616 }, - { 7650, -2096, 725, 457 }, - { 8122, 78, 636, -1400 }, - { 8421, 428, -1620, 131 }, - { 7341, -1292, -717, 186 }, - { 7998, -49, -720, 266 }, - { 5987, -351, 669, 844 }, - { 7314, -1620, 250, -603 }, - { 7219, -1562, -572, 1994 }, - { 8682, -358, -290, -388 }, - { 5810, 155, -178, 1199 }, - { 7246, -12, 1042, -786 }, - { 7357, -923, 1468, -475 }, - { 7801, 621, -212, -724 }, - { 5346, -514, 1210, 1356 }, - { 8459, 36, -127, -779 }, - { 6878, -2429, 854, 1750 }, - { 7280, -1401, -1353, 2845 }, - { 7579, -2148, -1463, 2087 }, - { 6637, 946, -872, 750 }, - { 4807, -1100, 1289, 2602 }, - { 4495, 219, 1551, 1128 }, - { 7639, 506, 446, -1107 }, - { 6359, 188, 1009, -115 }, - { 6641, -1820, 1655, 723 }, - { 5394, -2382, 1604, 2542 }, - { 6021, -2644, 2396, 1407 }, - { 4698, 882, 245, 1525 }, - { 8103, 573, -798, -349 }, - { 8045, -519, 997, -1092 }, - { 7571, -122, 227, -338 }, - { 5347, -1200, 630, 1718 }, - { 7070, 790, 218, -544 }, - { 7440, 728, -527, -20 }, - { 6402, -355, 197, -736 }, - { 4031, 771, 866, 1895 }, - { 6009, 896, 445, -31 }, - { 5160, 1098, -856, 1784 }, - { 7980, -886, -1293, 1396 }, - { 6318, -1361, 2423, 252 }, - { 7547, -699, 133, 506 }, - { 8562, -2344, 940, 264 }, - { 5890, 1187, -1425, 2194 }, - { 6558, -645, -1311, 2621 }, - { 4634, -1671, 2075, 1623 }, - { 5614, 105, -816, 2376 }, - { 6646, 1558, -1365, 630 }, - { 6998, 1150, -2117, -990 }, - { 6555, 2311, -1093, -1783 }, - { 6682, 1430, -2391, -1940 }, - { 7861, 1555, -2977, -1188 }, - { 6745, 1723, -459, -2085 }, - { 7504, 1229, -1666, -2060 }, - { 7937, 671, -2128, -1529 }, - { 7139, 991, -735, -2632 }, - { 6867, 1592, -1303, -2324 }, - { 6401, 2230, -1732, -2508 }, - { 7201, 2184, -2169, -1988 }, - { 6636, 2190, -995, -2840 }, - { 7620, 2306, -2089, -651 }, - { 7584, 1875, -1438, -631 }, - { 9214, 1561, -2464, -1139 }, - { 6154, 1318, -1237, -2917 }, - { 7917, 2847, -1797, -1599 }, - { 8309, 2029, -2555, -465 }, - { 8204, 1282, -584, -2405 }, - { 8440, 1035, -1147, -1137 }, - { 7107, 1858, -60, -1568 }, - { 6781, 2912, -873, -1463 }, - { 7603, 1316, -319, -1249 }, - { 7833, 1335, -78, -1849 }, - { 7930, 1141, -1016, -695 }, - { 7883, 1610, -1017, -1314 }, - { 8069, 1409, -1811, -196 }, - { 8319, 1031, -582, -1590 }, - { 5948, 1537, -2153, -2373 }, - { 8684, 1171, -1871, -850 }, - { 8357, 2484, -2411, -1292 }, - { 6516, 2092, -193, -1167 }, - { 6112, 1697, 22, -525 }, - { 7161, 703, -602, -1879 }, - { 6047, 2351, -807, -219 }, - { 8072, 1854, -1817, -1553 }, - { 6956, 1304, 76, -1011 }, - { 6607, 1481, -544, -162 }, - { 6958, 2541, -265, -1938 }, - { 6416, 2514, -777, -850 }, - { 7272, 2110, -899, -1171 }, - { 7741, 2153, -283, -2614 }, - { 6482, 2041, -1758, -1221 }, - { 6762, 940, -1862, -2281 }, - { 5610, 1194, -1691, -1561 }, - { 7833, 2164, -823, -1952 }, - { 5460, 1438, -848, 1189 }, - { 6011, 1377, -771, -1557 }, - { 7679, 544, -1134, -2214 }, - { 7209, 1292, -2714, -1564 }, - { 5567, 1200, -404, -169 }, - { 5853, 1461, -1465, -518 }, - { 6782, 689, -844, -860 }, - { 7330, 1337, -1152, -71 }, - { 7189, 1506, -653, -685 }, - { 6860, 2116, -1403, -240 }, - { 8804, 1516, -1391, -1760 }, - { 7210, 2689, -1498, -989 }, - { 7030, 3022, -1441, -2083 }, - { 5649, 1836, -407, 525 }, - { 7451, 3099, -717, -2464 }, - { 7384, 1656, -2007, 398 }, - { 6504, 707, -1919, -134 }, - { -1851, 3639, -2279, -695 }, - { -4037, 1644, -77, 1329 }, - { -4025, 1960, -1565, -567 }, - { -3430, 2495, -795, 368 }, - { -4771, 2480, 993, 756 }, - { -3431, 2058, -2539, -971 }, - { -3802, 3418, 380, 217 }, - { -3074, 3350, -1652, -1056 }, - { -3705, 326, -1650, 1535 }, - { -3122, 1281, -1192, 1607 }, - { -4601, 1367, -968, 53 }, - { -3808, 958, 44, 2560 }, - { -2079, 2530, -1485, 1166 }, - { -3707, 343, -2889, 180 }, - { -5249, 1431, -31, 688 }, - { -4990, 125, -704, 1270 }, - { -2771, 1334, -2446, 746 }, - { -2292, 994, -1527, 2630 }, - { -1261, 3070, -2519, 268 }, - { -2544, 3890, -1057, -552 }, - { -4421, 255, -1980, 530 }, - { -2951, 454, -13, 3643 }, - { -2262, 1815, -370, 2880 }, - { -2383, 3657, -649, 576 }, - { -3541, -161, -1389, 2550 }, - { -4241, 1575, 1325, 2561 }, - { -2767, 4037, 1221, 1578 }, - { -3748, 2697, 1148, 1801 }, - { -4686, 2385, -220, 0 }, - { -1531, 1645, -2751, 1327 }, - { -45, 4032, -799, 2298 }, - { -2915, 2280, 709, 2495 }, - { -1199, 3278, -406, 2346 }, - { -2471, 116, -2706, 2060 }, - { -2440, 2173, -2894, -344 }, - { -3375, 2287, 1781, 3226 }, - { -2153, 3568, 1827, 2918 }, - { -862, 2267, -1626, 2527 }, - { -2698, 1135, 301, 4239 }, - { -2364, 2123, 1010, 3710 }, - { -2447, 3281, -81, 1408 }, - { -2660, 4735, 472, 258 }, - { -1053, 3097, 2682, 2398 }, - { -3366, -1037, -1152, -868 }, - { -643, 4242, 2212, 1259 }, - { 971, 3991, 934, 643 }, - { -1617, 2002, 2139, 2195 }, - { -4897, 972, 784, 1719 }, - { -1275, 2992, 1039, 3821 }, - { -392, 4973, -209, 1821 }, - { -1028, 4718, -1479, -137 }, - { 50, 3914, 553, 2210 }, - { 678, 4364, 359, 1303 }, - { -582, 4911, 514, 1671 }, - { 1276, 3914, -1252, 2934 }, - { -1496, 3984, 857, 2330 }, - { 772, 4744, -655, 2332 }, - { -799, 5283, -439, 624 }, - { 1341, 2937, 650, 2027 }, - { -1739, 4892, 1275, 1702 }, - { -892, 2596, -151, 3951 }, - { -3532, 1090, 1292, 32 }, - { 321, 3146, 2647, 1475 }, - { 264, 4199, -1591, 1317 }, - { -452, -2357, 2266, 4192 }, - { 3022, -1033, -2389, 5678 }, - { -1162, -1342, 3543, 4990 }, - { -474, -1477, -1223, 5016 }, - { -699, -2857, 900, 3835 }, - { -461, -2255, -117, 4626 }, - { 1204, -2062, -1211, 4403 }, - { 2192, -3035, -337, 3966 }, - { 108, -831, 279, 5643 }, - { 1457, -620, -2908, 5276 }, - { -2527, -78, 1085, 5460 }, - { -1978, -1918, -949, 4733 }, - { 32, 367, -1904, 5166 }, - { 1890, -1665, 440, 4752 }, - { -518, -348, 2816, 4891 }, - { 3695, -2490, -1374, 4603 }, - { 246, -1965, 3549, 3969 }, - { 1100, -3111, 656, 3737 }, - { -1379, 870, -414, 4575 }, - { 628, -357, -1227, 6179 }, - { -1129, -1318, -2457, 4576 }, - { -425, -98, -73, 6336 }, - { 367, -887, 2990, 4207 }, - { 2091, -1251, 2444, 3557 }, - { -1759, -1610, 2046, 5273 }, - { 3210, 1414, -20, 2616 }, - { 3303, -2636, 1005, 4237 }, - { -327, -3107, -640, 3687 }, - { -197, 764, 572, 5486 }, - { 646, -767, 1388, 5464 }, - { 104, 2742, -228, 3907 }, - { -236, 1829, -579, 4585 }, - { -2150, -474, -1525, 4006 }, - { -23, -2632, -2400, 3892 }, - { -12, -1739, -2910, 4867 }, - { -2310, -368, -102, 4583 }, - { -1991, -2061, 533, 4531 }, - { 3884, -1446, -153, 4393 }, - { 1568, 14, -289, 5268 }, - { -1376, -253, -2797, 3417 }, - { 3193, -2577, 2475, 3566 }, - { 3418, 617, 1350, 1857 }, - { 3792, -24, -272, 3370 }, - { 153, 1159, 2906, 2877 }, - { 511, 2162, 1548, 2741 }, - { 262, 819, -2791, 3734 }, - { 4232, -2015, 1486, 3477 }, - { 2943, -1110, -1014, 5480 }, - { 2842, 369, 703, 3476 }, - { 3011, 1634, -933, 3553 }, - { 4412, -1548, -942, 5021 }, - { -1405, 593, 2372, 5267 }, - { 2093, 2129, 896, 2365 }, - { 4845, -1980, 0, 3823 }, - { -2140, 81, 3278, 5637 }, - { 1484, 2665, -324, 3653 }, - { 10, 192, 1620, 5291 }, - { 2152, 738, -2269, 5000 }, - { 2102, 2748, -1652, 4707 }, - { 2855, -2131, -387, 5188 }, - { 1173, 676, 1338, 3277 }, - { 2340, -2329, -2064, 4095 }, - { 861, -2024, 1296, 5055 }, - { 2189, 3225, -695, 2626 }, - { 6196, -7079, 1943, -822 }, - { 4547, -4813, 3261, 1856 }, - { 4243, -6904, 3443, 448 }, - { 4581, -7503, 946, 506 }, - { 6626, -7754, 3427, 470 }, - { 3407, -9088, 3269, -1496 }, - { 4079, -6464, 2304, 777 }, - { 5621, -9336, 2684, -768 }, - { 5351, -6464, 5238, -214 }, - { 5961, -8007, 1724, -3091 }, - { 4213, -8067, 603, -246 }, - { 7208, -7403, 3168, -1738 }, - { 6098, -7700, 329, -1379 }, - { 6525, -6735, 4248, -1072 }, - { 6073, -6241, 2167, -2378 }, - { 4609, -9218, 3051, -1033 }, - { 6813, -7283, 1581, -1897 }, - { 6126, -6275, 2789, 681 }, - { 4423, -6538, 1621, -1692 }, - { 6272, -8298, 3167, -1855 }, - { 6172, -8558, 4498, -1169 }, - { 4844, -8588, 1647, -366 }, - { 6209, -8807, 1581, -369 }, - { 5389, -8059, 550, -192 }, - { 6654, -9775, 2504, -1063 }, - { 7103, -7998, 806, 530 }, - { 5662, -6736, 1565, -3620 }, - { 4165, -9564, 4191, -2131 }, - { 4526, -7181, 576, -2875 }, - { 4633, -8623, 2807, -4742 }, - { 3709, -7794, 1815, 34 }, - { 3634, -8622, 2313, -826 }, - { 6991, -8447, 2063, -3198 }, - { 7757, -9486, 2255, -558 }, - { 4149, -7778, 4728, -1696 }, - { 5767, -7427, 1113, 707 }, - { 4592, -6261, 2329, 1864 }, - { 3159, -10498, 1677, -4273 }, - { 3534, -9010, 2437, -3565 }, - { 4479, -10821, 2715, -4942 }, - { 3207, -9805, 3054, -3886 }, - { 4627, -8189, 3018, -2354 }, - { 5527, -10566, 3244, -2749 }, - { 4346, -10127, 3335, -3084 }, - { 6132, -10085, 3316, -1308 }, - { 5629, -9704, 2178, -3058 }, - { 3603, -8538, 1246, -624 }, - { 3737, -8488, 395, -3167 }, - { 5465, -11414, 2810, -4640 }, - { 5306, -7745, 2721, -3988 }, - { 7000, -9111, 1695, -1409 }, - { 6663, -7741, 2466, -4079 }, - { 4083, -7175, 1836, -4831 }, - { 3613, -9926, 1342, -3455 }, - { 6588, -8033, 457, -258 }, - { 4720, -8102, 17, -1209 }, - { 7414, -8709, 1294, -344 }, - { 5437, -10030, 4043, -1704 }, - { 4862, -9281, 1558, -1431 }, - { 6800, -6403, 5113, 862 }, - { 4623, -8242, 2667, -228 }, - { 5919, -5083, 3348, 2135 }, - { 5985, -8889, 2733, -5105 }, - { 5029, -5767, 4407, 719 }, - { 354, -6158, -838, -3001 }, - { 351, -5943, -2104, -1534 }, - { -633, -7190, -25, -4798 }, - { -1595, -7235, -3812, -1400 }, - { 103, -6197, -2933, -78 }, - { -1722, -5020, -3441, -4333 }, - { -1963, -5644, -4365, -270 }, - { -846, -5743, -3477, 196 }, - { -191, -5348, -4054, -469 }, - { -2515, -7754, -3495, -818 }, - { -2090, -6710, -2701, 117 }, - { -546, -7036, -1398, 163 }, - { -278, -7091, -2662, -536 }, - { -622, -7962, -2731, -1464 }, - { -1555, -8118, -3612, -2057 }, - { -1094, -6280, -2314, 505 }, - { -2556, -8538, -4024, -2247 }, - { 109, -7134, -3107, -1823 }, - { -900, -6954, -3340, -717 }, - { -605, -7113, -3656, -2154 }, - { 837, -6263, -3211, -2177 }, - { -417, -5810, -3871, -1469 }, - { -1318, -5649, -4207, -3198 }, - { 413, -6765, -2082, -33 }, - { -3101, -6450, -4362, -766 }, - { 755, -6489, -2967, -846 }, - { 1117, -7106, -2452, -1352 }, - { -1202, -8387, -3072, -2897 }, - { -365, -4894, -3561, -2937 }, - { -2372, -8776, -265, -4441 }, - { -1224, -8678, -896, -5074 }, - { -755, -10096, -600, -6623 }, - { 300, -8206, -225, -4568 }, - { -1176, -6824, -2633, -3527 }, - { -2006, -5443, -1526, -5849 }, - { -1115, -5540, -2363, -4785 }, - { 1059, -6812, -2543, -2654 }, - { -1976, -6861, -3062, -5508 }, - { -379, -5328, -2321, -3624 }, - { -2108, -5860, -4518, -1915 }, - { -379, -7885, -1329, -594 }, - { 774, -5389, -581, -5213 }, - { -2601, -5083, -1849, -4921 }, - { -176, -5580, 74, -5075 }, - { -204, -6780, -190, -6232 }, - { 418, -7594, -1987, -820 }, - { -1873, -8529, -2926, -1609 }, - { 1340, -6362, -919, -4975 }, - { 577, -7990, -2044, -1873 }, - { -2572, -7413, -1745, -2224 }, - { -2037, -7030, -1461, -7138 }, - { -2559, -8756, -2039, -5836 }, - { -2079, -6764, -1209, -5669 }, - { -1613, -7801, -2006, -685 }, - { -1865, -6583, -722, -3529 }, - { -589, -6358, -1377, -1003 }, - { -540, -7514, -1331, -3542 }, - { 419, -6192, -1677, -4927 }, - { -2786, -8763, -2966, -5065 }, - { -2172, -8411, -1726, -4675 }, - { -3382, -9833, -3497, -5722 }, - { -2433, -10169, -2077, -5775 }, - { -424, -9451, -1096, -3658 }, - { -537, -8522, -910, -1897 }, - { -5550, 2807, 1683, -693 }, - { -6395, 635, 3573, -1246 }, - { -7544, 2280, 2140, 44 }, - { -8751, 1136, 2951, -794 }, - { -5605, 2709, 2052, 916 }, - { -7650, 654, 869, 135 }, - { -6939, 967, 1409, 870 }, - { -7834, 2123, 3310, 974 }, - { -6935, 2818, 1274, -1678 }, - { -5605, 2233, 1013, 471 }, - { -7095, 1849, 1648, 198 }, - { -6636, 1634, 712, -37 }, - { -7279, 978, 296, -315 }, - { -7664, 3504, 3292, -216 }, - { -7836, 1209, 1221, -257 }, - { -7913, 2201, 1765, -1529 }, - { -7077, 3783, 2632, -1407 }, - { -5565, 1645, 1410, -622 }, - { -6494, 2879, 1181, -759 }, - { -7073, 3137, 3010, 550 }, - { -7249, 1839, 847, -805 }, - { -6630, 2197, 282, -1096 }, - { -8836, 1573, 1988, -1090 }, - { -7809, 1274, 836, -1198 }, - { -7895, 2970, 3511, -1097 }, - { -6960, 1664, 1356, -2442 }, - { -6582, 2866, 2273, 307 }, - { -7221, 821, 2851, -1435 }, - { -6015, 1703, 2001, -2367 }, - { -8082, 1034, 2103, 239 }, - { -5952, 1912, 301, -465 }, - { -6099, 841, 379, 567 }, - { -6343, 50, 494, 658 }, - { -6586, 983, 591, -893 }, - { -5500, 869, 2187, -2479 }, - { -6482, 60, 1545, -979 }, - { -6705, 515, 1974, -53 }, - { -6460, 1755, 1325, -1275 }, - { -6093, 2617, 2465, -623 }, - { -7330, 2161, 594, -2115 }, - { -7324, 762, 1593, -2004 }, - { -6385, 679, 1510, -2514 }, - { -6159, 241, 2976, -1631 }, - { -8583, 3030, 4045, -162 }, - { -6299, 66, 2209, -2103 }, - { -5428, 1279, 3267, -1846 }, - { -6438, 1335, 2728, -1631 }, - { -8012, 1070, 2428, -1151 }, - { -6201, 2781, 2349, -1918 }, - { -5918, 1139, 3121, -148 }, - { -6314, 2481, 3137, -1808 }, - { -7180, 1722, 2435, -1602 }, - { -6750, 1829, 3763, -1145 }, - { -6713, 1777, 2221, 1212 }, - { -7479, 1835, 3627, -479 }, - { -7299, 10, 2406, -1593 }, - { -8249, 3129, 996, -2870 }, - { -8374, 1534, 1333, -1882 }, - { -7507, 3353, 1598, -2299 }, - { -7379, 2701, 2326, -1167 }, - { -8440, 2276, 2796, -542 }, - { -10348, 1527, 2649, -1165 }, - { -8184, 3614, 2574, -1738 }, - { -5539, 1574, 1733, 1138 }, - { 9404, -7652, 67, 79 }, - { 8654, -3972, 1358, -60 }, - { 8617, -4794, 117, 2318 }, - { 7886, -4505, 1784, 1200 }, - { 8636, -6125, 3879, -1003 }, - { 9654, -6836, 1816, 205 }, - { 9374, -6553, 913, 1875 }, - { 8020, -6150, 1134, 2390 }, - { 7786, -4970, 2078, -1857 }, - { 8691, -6119, 711, 708 }, - { 9039, -5568, 2944, -1902 }, - { 9955, -5048, 1433, -601 }, - { 8089, -6927, 3093, -2846 }, - { 8487, -7024, 2415, 19 }, - { 9388, -5287, 3577, -2655 }, - { 8591, -7371, 2300, -996 }, - { 9104, -4763, 1453, -2558 }, - { 7615, -5457, 596, 164 }, - { 9860, -7047, 3433, -614 }, - { 8756, -4404, 2235, -964 }, - { 9462, -4660, 299, -1822 }, - { 10119, -5550, 2689, -1273 }, - { 10915, -7471, 2705, -1007 }, - { 11433, -7090, 1410, -1198 }, - { 9882, -7431, 2965, -1895 }, - { 7628, -5219, 769, -2661 }, - { 8169, -5318, 2262, 70 }, - { 8846, -6320, 1939, -754 }, - { 7147, -5593, 1248, -971 }, - { 10652, -5485, 935, 137 }, - { 7778, -6533, 2564, -1932 }, - { 8878, -5173, 1214, -361 }, - { 9828, -4943, 282, 510 }, - { 10042, -6134, 3895, -1914 }, - { 7965, -6630, 3566, -433 }, - { 8573, -4502, 3574, -1209 }, - { 8398, -4801, 1031, -1347 }, - { 10136, -7772, 2612, 1547 }, - { 9890, -7280, 1768, -1083 }, - { 8407, -6585, -706, -58 }, - { 7976, -7582, 229, -131 }, - { 10481, -8866, 1166, -147 }, - { 10914, -4342, 3189, -2412 }, - { 10440, -5198, -104, -1109 }, - { 11227, -6530, 2381, -2449 }, - { 8487, -8064, 1086, 230 }, - { 9975, -6123, -857, -134 }, - { 8339, -6498, 1232, -2337 }, - { 11042, -4506, 1119, -2098 }, - { 12563, -5592, 1837, -2062 }, - { 11801, -5590, 632, -1296 }, - { 10152, -5617, 1511, -1917 }, - { 7800, -6473, 51, -1337 }, - { 7941, -5560, 2438, -3270 }, - { 6554, -3834, 2100, 1476 }, - { 9065, -5520, -226, -1120 }, - { 10794, -7120, -243, 122 }, - { 10429, -6968, 272, -806 }, - { 8942, -8914, 1442, -392 }, - { 9969, -5051, 2033, -2953 }, - { 7275, -4152, 3058, -64 }, - { 11127, -5488, 4589, -3227 }, - { 9626, -6666, 2739, -2958 }, - { 6943, -5362, 4470, 1008 }, - { -7456, -967, 2936, -1002 }, - { -8622, -333, 6962, 2606 }, - { -7486, -3392, 3668, 1287 }, - { -8053, -827, 5148, 1097 }, - { -6610, 454, 4952, 96 }, - { -7701, -1982, 3161, -468 }, - { -7307, -1132, 4071, -36 }, - { -8125, -271, 5199, 3862 }, - { -9182, -1950, 2813, 1878 }, - { -9855, -952, 4794, 3010 }, - { -7241, 1431, 4202, 2468 }, - { -9646, 157, 4766, 1046 }, - { -9371, 1230, 6009, 2958 }, - { -11514, -64, 8630, 5248 }, - { -6766, 565, 2766, 2140 }, - { -8426, -9, 2852, 1271 }, - { -11291, -1113, 5087, 2937 }, - { -8297, 2092, 4495, 1264 }, - { -9983, 735, 3809, -51 }, - { -9048, -1000, 3191, -308 }, - { -7331, -1987, 2655, 1391 }, - { -7144, -21, 4333, 2161 }, - { -6032, -1540, 3543, 896 }, - { -7987, -1036, 1985, 1529 }, - { -9264, 2004, 5194, 290 }, - { -11308, -840, 5754, 1654 }, - { -9130, -2398, 4292, 2973 }, - { -6248, 838, 3563, 1223 }, - { -6819, -2760, 3511, 119 }, - { -7213, -2006, 4364, 762 }, - { -5431, -1047, 4533, 166 }, - { -7098, -641, 2021, 639 }, - { -8628, -2249, 3588, 399 }, - { -6352, -1498, 3560, -648 }, - { -7033, -2190, 4870, 2562 }, - { -7405, -46, 3772, -581 }, - { -6104, 796, 5143, 1965 }, - { -5787, 943, 5784, 3030 }, - { -8367, 1465, 7192, 4097 }, - { -8259, 789, 5694, 1963 }, - { -10614, -1899, 5748, 2645 }, - { -8258, -805, 3698, 2275 }, - { -6877, -972, 6431, 3160 }, - { -6483, 363, 7018, 3129 }, - { -6283, -1358, 5191, 1524 }, - { -8853, -3157, 4119, 1741 }, - { -6086, -267, 3883, -835 }, - { -7254, 1032, 6613, 4017 }, - { -11470, -3350, 4649, 3426 }, - { -6743, 481, 6148, 1239 }, - { -5394, -166, 5309, 3165 }, - { -7958, 1068, 4268, -240 }, - { -10520, 2256, 7916, 2828 }, - { -5132, -4, 5739, 1176 }, - { -8643, 120, 3255, -629 }, - { -9631, 1974, 8870, 4362 }, - { -10663, -1221, 3733, 589 }, - { -8224, -1843, 5806, 2655 }, - { -8282, 1255, 8647, 3478 }, - { -12311, -1505, 9043, 6256 }, - { -11312, -856, 7136, 4681 }, - { -11944, -722, 7941, 3309 }, - { -7868, -463, 6846, 4196 }, - { -8679, -241, 7410, 5347 }, - { 6759, -4680, -508, 1220 }, - { 5176, -6111, 944, 121 }, - { 6843, -5667, -1368, -533 }, - { 5616, -5884, -1471, -695 }, - { 6030, -5089, -1808, -940 }, - { 7444, -5463, -52, 1881 }, - { 4207, -6079, -506, 1571 }, - { 6785, -4410, -649, 3084 }, - { 4838, -5214, 2026, 2998 }, - { 4201, -5790, 645, 1811 }, - { 6930, -5129, -1940, 1698 }, - { 6332, -4627, 692, 3027 }, - { 6285, -4314, -106, 3644 }, - { 6255, -5450, -1975, 742 }, - { 4199, -4676, -459, 1796 }, - { 5592, -5500, 1345, 1300 }, - { 4358, -5556, -2236, 114 }, - { 4620, -5875, -1563, 888 }, - { 4892, -7550, -327, -419 }, - { 4734, -7085, 7, 613 }, - { 3883, -5562, -1969, 1080 }, - { 5610, -4990, -204, 834 }, - { 4117, -6482, -1271, 341 }, - { 6585, -5107, 892, 1169 }, - { 6632, -3683, 302, 3002 }, - { 6326, -5351, -983, -1250 }, - { 4382, -7192, -730, -158 }, - { 5227, -6540, -451, 1123 }, - { 5468, -6472, -870, -1471 }, - { 5191, -6402, -1365, -127 }, - { 7407, -6317, -973, -336 }, - { 4611, -6530, -820, -1980 }, - { 4963, -5159, -2050, -966 }, - { 4414, -5691, -211, -998 }, - { 5954, -5873, 750, -1749 }, - { 4394, -4796, -1268, 254 }, - { 7161, -6214, -1010, 689 }, - { 4965, -3598, 2372, 1711 }, - { 6248, -6180, 981, 864 }, - { 6473, -5336, 525, -600 }, - { 4591, -6864, -1131, -900 }, - { 6314, -6440, -1021, -375 }, - { 5838, -6209, -1199, 944 }, - { 5308, -5283, -2100, 1267 }, - { 4342, -5860, -1637, -1356 }, - { 5680, -4388, -1227, -104 }, - { 4900, -4098, 1449, 4046 }, - { 4677, -4284, -106, 3190 }, - { 7574, -6173, -848, 1859 }, - { 6493, -7207, -131, 726 }, - { 5513, -5261, -2117, 4 }, - { 6191, -7352, -193, -505 }, - { 5885, -4333, 324, -134 }, - { 6162, -6081, -312, -2044 }, - { 4216, -6200, -1810, -572 }, - { 5652, -7035, -696, -197 }, - { 7131, -7189, -366, -60 }, - { 5032, -4803, -1514, 2832 }, - { 7386, -4610, -606, 3489 }, - { 4211, -5031, 1221, 3047 }, - { 4050, -4653, 1584, 1469 }, - { 6852, -5302, -1861, 206 }, - { 7736, -4816, -1794, 3359 }, - { 6290, -3439, 1522, 2454 }, - { 1768, 5990, -5560, -2594 }, - { 3903, 5326, -1530, -1501 }, - { 2472, 3738, -2117, -4240 }, - { 3260, 5448, -904, -4733 }, - { 1435, 7297, -3676, -4102 }, - { 4096, 5951, -656, -3312 }, - { 2178, 6009, -3146, -3724 }, - { 3787, 5493, -5473, -1633 }, - { 2998, 7286, -3334, -3571 }, - { 2894, 6576, -4708, -2804 }, - { 830, 6163, -4286, -3348 }, - { 4755, 5569, -1730, -2739 }, - { 4604, 6065, -3562, -2605 }, - { 2749, 5141, -3986, -2775 }, - { 3942, 4875, -2143, -3340 }, - { 2819, 8517, -2004, -2724 }, - { 2146, 6298, -689, -3093 }, - { 5196, 6504, -3393, -1475 }, - { 1851, 8386, -1748, -1420 }, - { 3474, 8572, -3534, -2688 }, - { 4503, 7560, -3561, -2245 }, - { 4433, 6219, -2393, -1575 }, - { 3506, 7248, -2275, -1977 }, - { 3490, 7409, -3147, -604 }, - { 4214, 6447, -3520, 516 }, - { 619, 7034, -829, -1705 }, - { 1732, 7395, -356, -2208 }, - { 1226, 5204, -3294, -3732 }, - { 2027, 5619, -1813, -4146 }, - { 3078, 5877, 47, -2651 }, - { 1654, 5458, 424, -682 }, - { 3163, 5464, -2026, -270 }, - { 2884, 5375, -685, -530 }, - { 2950, 7286, -35, -2967 }, - { 1986, 5066, -597, 482 }, - { 3459, 4308, -3845, -2333 }, - { 3155, 7037, -1346, -4345 }, - { 2193, 6696, -717, -1319 }, - { 3677, 5089, -3892, -487 }, - { 2186, 5136, -4186, -1492 }, - { 773, 5796, -917, 817 }, - { 2489, 6546, -3570, -2117 }, - { 1223, 6469, -1362, -33 }, - { 271, 6061, -1466, -1725 }, - { 2540, 5171, -1847, 1032 }, - { 2548, 5251, -2697, 1677 }, - { 771, 7600, -768, -632 }, - { 4710, 6647, -4736, -1275 }, - { 1369, 5917, -2971, -1056 }, - { 163, 5239, -3499, -2275 }, - { 2104, 4285, -3211, -3286 }, - { 1107, 7411, -1972, -1671 }, - { 2196, 7262, -2310, -1926 }, - { -244, 6439, -1745, -839 }, - { 3293, 3832, -2890, -3000 }, - { 419, 6443, -379, -407 }, - { 3077, 4930, -1156, -2869 }, - { 2131, 5874, -2330, 224 }, - { 690, 6538, -2212, -2841 }, - { 1602, 4421, -2515, 1542 }, - { 3318, 9373, -3032, -3477 }, - { 5646, 7462, -5153, -1463 }, - { 4139, 7137, -1539, -3321 }, - { 3481, 9077, -1645, -3653 }, - { -7747, 375, -106, -543 }, - { -8587, -1379, -586, -461 }, - { -10146, -892, 2094, 694 }, - { -8103, 382, 504, -325 }, - { -8548, -92, 94, -656 }, - { -7460, 38, 152, 388 }, - { -8266, -271, -459, -883 }, - { -7935, -664, -1026, -802 }, - { -8341, -109, 853, 161 }, - { -8802, -1355, 1099, 630 }, - { -8957, -6, 1108, -669 }, - { -7260, -1520, -43, -407 }, - { -7555, -174, 668, -2562 }, - { -9014, -126, 227, -1191 }, - { -8184, 769, 290, -1375 }, - { -9476, 55, 962, -1528 }, - { -8679, 541, 755, -1030 }, - { -9842, -1626, 838, -1588 }, - { -8513, -702, 788, -1998 }, - { -10101, -1558, -366, -1841 }, - { -8135, 78, 1479, -1813 }, - { -9128, -454, 313, -1786 }, - { -7554, -1084, 831, -2442 }, - { -7576, -701, 2068, -1665 }, - { -7791, -1481, 1587, -1808 }, - { -6701, -596, -97, 802 }, - { -7418, -15, 684, -963 }, - { -7127, -477, -139, -426 }, - { -8097, -110, -36, -264 }, - { -7620, -1922, -590, -101 }, - { -7647, -1201, 279, 660 }, - { -7856, -1974, 758, -2271 }, - { -8496, -167, 2232, -1143 }, - { -8506, -1359, 624, -740 }, - { -7274, -1052, 1062, -139 }, - { -7800, -217, 91, -1794 }, - { -7030, -1694, -955, 615 }, - { -9020, -1864, 101, -2182 }, - { -9400, -740, 598, -667 }, - { -8448, -1184, 2024, -1272 }, - { -8812, -570, -897, -2384 }, - { -10559, -1286, 538, -1536 }, - { -8728, -888, -1089, -1397 }, - { -7080, -1185, 636, -1252 }, - { -9880, 233, 2344, -782 }, - { -7952, -1326, -378, -1947 }, - { -7207, -378, 1408, -2237 }, - { -8467, -1545, 902, -1987 }, - { -9163, -1474, 924, -1739 }, - { -8159, -992, -77, -2744 }, - { -8343, 148, -423, -1573 }, - { -9105, -649, -254, -1214 }, - { -8939, 456, 281, -1905 }, - { -8837, 179, -394, -2634 }, - { -9145, 757, 1547, -1319 }, - { -9775, -723, 441, -1680 }, - { -8910, -686, 1529, -1525 }, - { -9492, -1134, 2064, -938 }, - { -6111, -943, 677, -31 }, - { -7411, -613, -814, 46 }, - { -9479, -922, -430, -2061 }, - { -11298, -1268, 1318, -1117 }, - { -8190, 832, 671, -2214 }, - { -10453, -550, 1672, -886 }, - { 1044, 9353, -1651, -5423 }, - { 1034, 8149, -455, -6166 }, - { 761, 8293, -3214, -4838 }, - { 938, 8077, 164, -5130 }, - { 1295, 8673, 2582, -5490 }, - { -314, 7973, -2395, -5231 }, - { -507, 9012, -2497, -5775 }, - { 2396, 8314, -1022, -4673 }, - { -1516, 8501, 1950, -4969 }, - { -308, 7401, 1549, -4866 }, - { -112, 8340, 3003, -4920 }, - { -50, 9315, 1371, -5666 }, - { -659, 9449, 2496, -5547 }, - { 2573, 9148, -2270, -4783 }, - { 830, 7104, -438, -3907 }, - { 522, 10672, -677, -6483 }, - { -1190, 10108, -510, -6518 }, - { -427, 8271, -579, -6315 }, - { 1602, 8113, -1927, -4418 }, - { -2266, 8180, 448, -5190 }, - { -1633, 8816, -226, -5771 }, - { 759, 9481, -105, -5813 }, - { 2254, 6679, -466, -5662 }, - { -88, 6946, 895, -5958 }, - { -1705, 10009, 1394, -5574 }, - { 748, 7943, 540, -6692 }, - { 1411, 7009, 232, -6145 }, - { 697, 7290, -1221, -5342 }, - { -1764, 10580, 1944, -3981 }, - { -1334, 9124, 1195, -3903 }, - { -905, 10067, 635, -5039 }, - { 664, 10680, 49, -4625 }, - { 1374, 9536, -777, -3591 }, - { 252, 9698, -597, -2931 }, - { 824, 9164, -1014, -2144 }, - { 2438, 10569, -2289, -4424 }, - { 2101, 7102, 507, -3614 }, - { 294, 8051, -432, -1518 }, - { -665, 10337, 547, -2852 }, - { 1168, 11989, -492, -5427 }, - { 1344, 6416, 302, -5061 }, - { -1727, 12264, 1507, -4543 }, - { 674, 10889, -902, -3605 }, - { -582, 9504, 300, -3618 }, - { 641, 7654, 689, -2109 }, - { 2065, 9243, 508, -4367 }, - { 1055, 8373, 688, -3144 }, - { -641, 8185, 986, -3307 }, - { 1120, 7426, 1785, -3757 }, - { 1660, 8070, -593, -3104 }, - { 2002, 9467, -1722, -3475 }, - { 2361, 8368, 100, -3709 }, - { -772, 7845, -613, -4988 }, - { 1485, 7430, 1896, -6127 }, - { -432, 7823, -947, -2882 }, - { 313, 11122, -760, -4871 }, - { 412, 8412, -283, -4231 }, - { 1585, 10402, -1884, -3267 }, - { 321, 6952, 773, -3016 }, - { -105, 9014, 121, -2249 }, - { 1585, 10313, -977, -4812 }, - { 1619, 11869, 1306, -6876 }, - { -1168, 8886, -81, -2500 }, - { -395, 10886, 733, -6490 }, - { -4949, 4274, 3992, -1054 }, - { -4241, 5299, 4262, -1584 }, - { -2710, 3862, 4552, -1673 }, - { -4608, 2472, 3672, -1715 }, - { -2843, 2816, 4003, -2326 }, - { -5229, 2964, 5636, 90 }, - { -4924, 3442, 5015, -1096 }, - { -1281, 3313, 5537, -2066 }, - { -3808, 1939, 4351, -919 }, - { -1915, 2585, 4939, -1614 }, - { -3470, 1843, 5562, -682 }, - { -3800, 870, 5827, 144 }, - { -4985, 1452, 4728, -709 }, - { -3745, 2750, 7220, 259 }, - { -1875, 1900, 6514, -826 }, - { -4329, 1574, 7192, 1304 }, - { -5408, 1444, 6208, 631 }, - { -3327, 5312, 5707, -1541 }, - { -6966, 3334, 4034, 1028 }, - { -7484, 4245, 4218, -212 }, - { -6567, 5839, 4539, -512 }, - { -5715, 5935, 3747, -1186 }, - { -6410, 4881, 3356, -1610 }, - { -5146, 2590, 2850, 2172 }, - { -5196, 4095, 2569, -373 }, - { -5043, 6025, 4318, 692 }, - { -5525, 4884, 3513, 370 }, - { -6804, 7533, 5812, -488 }, - { -5657, 2480, 4061, 1234 }, - { -3155, 1472, 6071, 1188 }, - { -3427, 5217, 3442, 858 }, - { -4698, 3013, 5517, 2586 }, - { -4449, 2226, 5418, 3580 }, - { -6395, 3547, 5487, 2028 }, - { -3500, 5019, 4787, 1 }, - { -4038, 2578, 3073, 3151 }, - { -2750, 1955, 4469, 3856 }, - { -5696, 1659, 6118, 2469 }, - { -4350, 1241, 6840, 3126 }, - { -5565, 5058, 5196, 1314 }, - { -1642, 4190, 3948, 607 }, - { -1233, 4108, 4850, -640 }, - { -997, 3428, 3239, 1378 }, - { -6488, 2741, 6926, 2792 }, - { -4188, 3763, 4235, 2018 }, - { -3210, 3224, 5646, 1427 }, - { -5526, 6909, 5070, -627 }, - { -2815, 3994, 3425, 1903 }, - { -2163, 2734, 5423, 145 }, - { -4149, 4247, 2355, 734 }, - { -410, 2521, 4138, -16 }, - { -2411, 2385, 4927, 2105 }, - { -6077, 3591, 3114, 594 }, - { -4186, 4834, 5926, -1004 }, - { -7315, 3369, 5966, 448 }, - { -7042, 5721, 5771, 238 }, - { -4466, 3907, 3535, -1751 }, - { -2116, 3970, 6163, -1392 }, - { -7239, 2143, 8407, 3630 }, - { -5431, 4486, 6486, -42 }, - { -1874, 1617, 6333, 519 }, - { -6478, 2629, 4634, -505 }, - { -7784, 2342, 7216, 1365 }, - { -1154, 1432, 4831, 1544 }, - { -4964, -5801, 1797, 506 }, - { -4436, -6905, 1059, -1237 }, - { -5400, -6886, 884, -290 }, - { -6259, -7103, 523, -227 }, - { -4819, -6450, 1412, -450 }, - { -4056, -6213, 1725, -943 }, - { -5642, -6091, 1357, 605 }, - { -4196, -5678, 2187, -173 }, - { -4726, -5126, 2470, 321 }, - { -6642, -5091, 1507, -1005 }, - { -5304, -5250, 1944, 1579 }, - { -7179, -5520, 1468, -425 }, - { -6033, -4895, 1876, -955 }, - { -6595, -5143, 2207, 1291 }, - { -4224, -4943, 1846, 1792 }, - { -7128, -6950, 539, 724 }, - { -4369, -4901, 2590, 1103 }, - { -7413, -5696, 1712, 1440 }, - { -5885, -6821, 418, 871 }, - { -6828, -5599, 710, -1563 }, - { -6123, -5817, 1358, 1631 }, - { -5291, -5622, 578, 2138 }, - { -7171, -6004, 347, 2208 }, - { -6083, -5251, 2132, 425 }, - { -4329, -5721, 407, -2993 }, - { -5326, -5056, 1119, -1837 }, - { -5485, -5856, 185, -2389 }, - { -6529, -5178, 403, -697 }, - { -6719, -4412, 2726, 871 }, - { -5126, -5629, 1835, -771 }, - { -5622, -4361, 2973, 858 }, - { -5282, -5895, 45, -335 }, - { -4357, -5656, 1696, -1558 }, - { -7139, -6659, 627, -409 }, - { -4415, -6328, 35, 1306 }, - { -7639, -6110, 1134, 197 }, - { -3626, -5592, 2019, 901 }, - { -3547, -5064, 1176, 1738 }, - { -5075, -3899, 2087, 266 }, - { -4086, -6311, 1479, 360 }, - { -6210, -5220, -199, -1477 }, - { -3910, -5063, 1356, -15 }, - { -7616, -4977, 461, 2401 }, - { -6118, -6131, 1258, -563 }, - { -6127, -4968, 1286, -27 }, - { -4121, -5852, 1113, 1476 }, - { -5157, -4881, 1162, -662 }, - { -4637, -5031, 1179, 709 }, - { -5509, -5452, -397, 1224 }, - { -4597, -6861, 646, 467 }, - { -6247, -4043, 468, 278 }, - { -5336, -6465, 874, -1472 }, - { -6998, -6346, 78, -1798 }, - { -4915, -4530, 2756, -203 }, - { -6048, -4373, 1468, 1052 }, - { -4273, -7100, 942, -323 }, - { -6552, -4287, 2351, 69 }, - { -6954, -4613, 722, 1521 }, - { -4201, -5361, 763, -1562 }, - { -6881, -5596, -748, 669 }, - { -6695, -3547, -34, 1299 }, - { -3981, -5728, 84, 111 }, - { -4663, -4809, 2173, -1031 }, - { -6599, -6077, 1303, 256 }, - { -7596, -4265, -5791, -4140 }, - { -6610, -2758, -5288, -3936 }, - { -5880, -3865, -6563, -3088 }, - { -7228, -5510, -7677, -3912 }, - { -8854, -6553, -8318, -5361 }, - { -9362, -5249, -6413, -4319 }, - { -4418, -3110, -6368, -4358 }, - { -5544, -4203, -6863, -5013 }, - { -3056, -4316, -5567, -3181 }, - { -3078, -5999, -5051, -2657 }, - { -5884, -6292, -5756, -4013 }, - { -4825, -4549, -5535, -4053 }, - { -4443, -6126, -5316, -1368 }, - { -3972, -6341, -6098, -2686 }, - { -5751, -2781, -5398, -6230 }, - { -4466, -6135, -5570, -3679 }, - { -4291, -5992, -3564, -5189 }, - { -7189, -4429, -7279, -6082 }, - { -5076, -4433, -2748, -5366 }, - { -6225, -2825, -6833, -5663 }, - { -2989, -4792, -3960, -4492 }, - { -7836, -7773, -7722, -5741 }, - { -6559, -5703, -5844, -5589 }, - { -7612, -5438, -4136, -3774 }, - { -4218, -4176, -6591, -2333 }, - { -4837, -5063, -6581, 322 }, - { -6590, -5990, -2980, -3847 }, - { -5558, -2971, -5489, -1932 }, - { -7001, -5323, -4975, -1697 }, - { -4694, -2688, -6904, -3044 }, - { -8511, -5379, -5767, -2549 }, - { -7548, -5412, -6522, -2572 }, - { -6597, -4973, -6423, -1274 }, - { -6415, -4022, -5168, -1072 }, - { -5528, -5530, -7218, -2345 }, - { -4845, -4805, -5943, -1227 }, - { -6049, -7150, -6744, -2161 }, - { -9061, -7299, -8542, -4375 }, - { -5010, -5546, -5416, -82 }, - { -4135, -4205, -5109, -3373 }, - { -3311, -5869, -4007, -5061 }, - { -5993, -6472, -3962, -4718 }, - { -2966, -5832, -2821, -6305 }, - { -4851, -5152, -2067, -3930 }, - { -3620, -4441, -3362, -5836 }, - { -4469, -5221, -4534, -5592 }, - { -4022, -6335, -4321, -6107 }, - { -4899, -4503, -3084, -3725 }, - { -4490, -8276, -4620, -6236 }, - { -6591, -4342, -7365, -4063 }, - { -6498, -5057, -5553, 485 }, - { -6060, -2714, -7093, -4144 }, - { -6199, -7774, -7094, -4057 }, - { -7536, -6424, -6415, -4265 }, - { -7439, -2454, -6348, -4827 }, - { -5333, -7565, -4417, -4639 }, - { -4353, -7103, -4197, -2689 }, - { -5229, -6549, -5129, -6804 }, - { -6129, -7701, -5236, -4836 }, - { -6797, -3983, -3884, -4406 }, - { -6624, -4467, -4745, -5052 }, - { -3324, -7596, -2720, -6553 }, - { -5473, -6284, -1704, -4511 }, - { -4131, -7263, -3180, -5196 }, - { -7116, -5565, -3469, 685 }, - { -6002, -6021, -3858, 576 }, - { -3144, -8203, -1291, -434 }, - { -6096, -7027, -4004, 1353 }, - { -3943, -7709, -2344, -36 }, - { -4510, -6767, -2642, 631 }, - { -3657, -11541, -2570, -3984 }, - { -5959, -8854, -1333, -867 }, - { -6699, -8866, -1606, -344 }, - { -3836, -7961, -2334, -2028 }, - { -3430, -8045, -3037, -672 }, - { -3868, -9184, -3635, -1819 }, - { -4258, -9060, -2621, -1008 }, - { -3595, -8693, -2022, -752 }, - { -4573, -8048, -3166, -2622 }, - { -4852, -7903, -1405, 256 }, - { -4591, -7057, -1560, 965 }, - { -6963, -7655, -980, 808 }, - { -5179, -6641, -3356, 1196 }, - { -7102, -6941, -2798, 2123 }, - { -6867, -5834, -3320, -770 }, - { -5977, -7369, -2500, -778 }, - { -6160, -6400, -934, -2543 }, - { -6741, -7608, -355, -1289 }, - { -6856, -6466, -1433, -1643 }, - { -4786, -6292, -4970, 376 }, - { -5407, -8866, -2255, -400 }, - { -3814, -6506, -1387, -3620 }, - { -4998, -6137, -1200, -4092 }, - { -5123, -9557, -2849, -1306 }, - { -4259, -6444, -4395, -338 }, - { -5221, -6810, -883, 1225 }, - { -6137, -6215, -2165, 554 }, - { -3895, -6557, -3176, -1829 }, - { -3886, -8188, -87, -954 }, - { -7243, -6707, -2216, -316 }, - { -5592, -7606, 85, -432 }, - { -3957, -7945, -504, -144 }, - { -4617, -7624, 218, -312 }, - { -4797, -8737, -844, -1051 }, - { -4478, -8516, -1401, -454 }, - { -4557, -7058, -302, -2332 }, - { -6623, -7736, -271, -50 }, - { -3157, -7532, -1111, -2207 }, - { -3590, -7300, -1271, 517 }, - { -4442, -7306, -507, 590 }, - { -6458, -7524, -2807, 666 }, - { -4991, -8466, -3363, -785 }, - { -7474, -7541, -1056, -1839 }, - { -7501, -8316, -938, -180 }, - { -5329, -7739, -579, -2341 }, - { -4549, -7063, -176, -3539 }, - { -5191, -8612, -1504, -4250 }, - { -3083, -7058, -2251, 32 }, - { -4003, -7043, -1093, -791 }, - { -5523, -8093, -678, -114 }, - { -3022, -10265, -2070, -3109 }, - { -3905, -6274, -182, -3652 }, - { -3269, -9217, -551, -2650 }, - { -3138, -9314, -1726, -1704 }, - { -4420, -10339, -1744, -3459 }, - { -4163, -8609, -2298, -4113 }, - { -5566, -6505, -1241, -463 }, - { -3130, -9746, -2352, -4884 }, - { -7825, -3439, 1451, -1468 }, - { -8451, -3318, 2360, -435 }, - { -8462, -4130, 1438, -1024 }, - { -9425, -4564, 1328, -689 }, - { -11014, -3202, 2278, 2080 }, - { -8269, -2761, -146, -440 }, - { -7497, -2618, -166, 413 }, - { -8250, -3060, 522, -2133 }, - { -8365, -5366, 1347, -451 }, - { -8589, -3979, 2943, 714 }, - { -8111, -2572, 1272, -1748 }, - { -7830, -5193, 605, -1484 }, - { -8119, -4736, 2141, 256 }, - { -7724, -4769, 1463, -812 }, - { -7363, -3911, 2540, 4 }, - { -7974, -3397, 2363, 1366 }, - { -7359, -4204, 1752, -958 }, - { -7622, -3505, 660, 916 }, - { -9934, -3665, 3165, 828 }, - { -8721, -4162, 62, 1718 }, - { -9433, -4768, 2722, 1234 }, - { -7960, -4496, 138, 1528 }, - { -8198, -3454, -443, 631 }, - { -7756, -2246, 655, 1137 }, - { -8841, -3145, 1113, 829 }, - { -7817, -3298, 1251, 230 }, - { -9413, -2733, 323, -1862 }, - { -9408, -4168, 1270, 1549 }, - { -9037, -3892, -942, 283 }, - { -8255, -3849, 1301, 1762 }, - { -9057, -3987, -41, -682 }, - { -9441, -4187, 2019, -111 }, - { -9740, -3178, 1602, -871 }, - { -8344, -2474, 1461, 1506 }, - { -9752, -2925, 1996, 1243 }, - { -9199, -3796, 180, 537 }, - { -9060, -2405, 1140, -1562 }, - { -9348, -2376, 309, -162 }, - { -10786, -3182, -5, -1500 }, - { -8142, -4540, -434, -826 }, - { -7528, -2341, 1104, -73 }, - { -9360, -2658, 3062, 56 }, - { -8267, -2335, 2000, -1193 }, - { -12169, -3154, 1287, -640 }, - { -11398, -2120, 946, -1163 }, - { -8940, -4559, 328, -1696 }, - { -11025, -4213, 2813, 840 }, - { -9224, -3581, 2224, 2039 }, - { -8943, -3337, 1248, -1298 }, - { -7900, -4042, 485, -2080 }, - { -9221, -1947, 2191, -880 }, - { -10762, -1800, 2516, -324 }, - { -10095, -2238, 981, -1335 }, - { -11908, -2808, 3255, 645 }, - { -10640, -4105, 1283, -595 }, - { -7663, -2863, 2467, -797 }, - { -10712, -3854, 3710, 1538 }, - { -10823, -2893, 1408, -801 }, - { -9874, -3832, 256, -1638 }, - { -10394, -3391, 2315, -94 }, - { -11525, -4079, 4153, 2122 }, - { -9546, -2088, 1541, 481 }, - { -8731, -2433, 1042, 2160 }, - { -7852, -3977, -1370, 1677 }, - { 7072, -3420, 1398, -1741 }, - { 6180, -1976, 1280, -3557 }, - { 7692, -1793, 2844, -1700 }, - { 8363, -1773, 3104, -2679 }, - { 9213, -3266, 3756, -3542 }, - { 9650, -2644, 1426, -1318 }, - { 7712, -2796, 3686, -1975 }, - { 7316, -3517, 2821, -622 }, - { 7434, -2594, 2305, -2264 }, - { 7237, -1797, 255, -3114 }, - { 8663, -1983, 1338, -3056 }, - { 6616, -952, 4059, -2652 }, - { 8823, -1327, 1362, -1356 }, - { 9938, -1722, 1287, -2362 }, - { 7207, -1057, 1913, -1315 }, - { 7508, -1585, 870, -1982 }, - { 8217, -3680, 1417, -3170 }, - { 8329, -2541, 1684, -585 }, - { 8062, -2335, 252, -2800 }, - { 8204, -4108, 3097, -2569 }, - { 7701, -3367, 576, -3008 }, - { 7350, -786, 2414, -2129 }, - { 6948, -2568, 1607, -225 }, - { 7684, -2387, 1308, -3449 }, - { 8306, -3458, 2394, -1454 }, - { 8438, -2781, 1043, -1362 }, - { 9175, -2076, 2144, -1987 }, - { 8347, -2709, 3489, -4301 }, - { 5696, -2377, 2870, 851 }, - { 8825, -1243, 2219, -2603 }, - { 8801, -1614, 584, -2513 }, - { 8413, -384, 1421, -2244 }, - { 9228, -3050, 3279, -2164 }, - { 6342, -2698, 3547, -107 }, - { 10053, -2476, 2837, -3168 }, - { 7439, -604, 3177, -3991 }, - { 7749, -1064, 4329, -4855 }, - { 8655, -2177, 2252, -3519 }, - { 8490, -228, 1958, -3233 }, - { 10513, -2968, 1911, -2340 }, - { 8146, -862, 1884, -1723 }, - { 7788, -666, 3004, -2891 }, - { 7785, -1620, 4133, -3417 }, - { 10262, -3731, 3455, -2971 }, - { 8570, -905, 4519, -4649 }, - { 9129, -2562, 463, -2465 }, - { 9451, -3587, 1904, -3056 }, - { 6549, -2236, 3010, -4523 }, - { 7175, -2684, 2967, -3458 }, - { 9872, -3278, 1054, -2472 }, - { 9153, -931, 1217, -2565 }, - { 8789, -3469, 753, -2568 }, - { 6683, -3791, 1797, -3968 }, - { 6801, -1977, 2311, -452 }, - { 6336, -1572, 2612, -3264 }, - { 7996, -1008, 730, -2964 }, - { 7521, -1059, 1573, -3694 }, - { 8148, -3973, 2600, -3572 }, - { 7765, -1532, 2528, -3856 }, - { 7404, -3918, 4472, -143 }, - { 8894, -1398, 3299, -3685 }, - { 5768, -2041, 1487, -637 }, - { 5131, -2865, 2463, -811 }, - { 6439, -1568, 3500, -1550 }, - { -8878, -6798, -5319, -1452 }, - { -6332, -9713, -3112, -990 }, - { -8444, -6316, -3694, -687 }, - { -6123, -10840, -3637, -4358 }, - { -4784, -9580, -4577, -2581 }, - { -6108, -10515, -4859, -2524 }, - { -7605, -7518, -2327, -2797 }, - { -9662, -8775, -2467, -2010 }, - { -6494, -7523, -4715, -118 }, - { -8290, -8982, -1672, -317 }, - { -8798, -11051, -3888, -1426 }, - { -6273, -6623, -6791, -142 }, - { -8313, -7668, -2141, -1275 }, - { -6453, -8412, -3589, -4102 }, - { -6747, -7750, -5690, -2498 }, - { -7814, -6693, -3174, -2446 }, - { -10383, -10130, -3931, -2364 }, - { -10606, -8467, -5539, -2772 }, - { -9475, -6671, -3305, -2271 }, - { -8982, -9457, -5635, -4005 }, - { -10111, -7965, -6515, -4180 }, - { -7301, -6479, -5364, 720 }, - { -9543, -8999, -7921, -912 }, - { -9534, -8562, -3469, -384 }, - { -7601, -10344, -3205, -1127 }, - { -8088, -8620, -4954, -2888 }, - { -8202, -8406, -7038, -3775 }, - { -7312, -8324, -3334, -1775 }, - { -8566, -9262, -8071, -4174 }, - { -7068, -11300, -5573, -2907 }, - { -8295, -8952, -4366, -1544 }, - { -11104, -10210, -2285, -384 }, - { -5213, -7520, -5008, -1339 }, - { -5889, -7940, -5987, -1385 }, - { -10816, -8201, -4153, -1485 }, - { -10277, -8919, -6315, -1652 }, - { -5888, -10320, -3821, -1733 }, - { -10497, -7181, -6083, -3032 }, - { -7721, -9724, -6591, -5336 }, - { -5688, -7894, -3486, -2552 }, - { -10014, -10500, -3247, -820 }, - { -6301, -8765, -4506, -2923 }, - { -8261, -7847, -6213, -1552 }, - { -10212, -7481, -8113, -3954 }, - { -6938, -10874, -6074, -4703 }, - { -7183, -10968, -4446, -1773 }, - { -7120, -9193, -1966, -2509 }, - { -6234, -9263, -2313, -4284 }, - { -8503, -9857, -2429, -608 }, - { -9372, -7844, -8391, -2120 }, - { -7951, -7157, -6535, -11 }, - { -7256, -9473, -2172, -660 }, - { -10063, -9612, -2515, -15 }, - { -6684, -9134, -6109, -4206 }, - { -8204, -11932, -5220, -2306 }, - { -9710, -6706, -4115, -3275 }, - { -6855, -7078, -2409, -4447 }, - { -7344, -7673, -4479, -4116 }, - { -8851, -6842, -4927, -2948 }, - { -8927, -10452, -5633, -2194 }, - { -8627, -9002, -7176, -1575 }, - { -8209, -9722, -7021, -3324 }, - { -3770, -10249, -3623, -4816 }, - { -8183, -7465, -4090, 646 }, - { -8163, -7149, 200, 498 }, - { -8289, -6266, 686, -206 }, - { -10030, -6241, -1032, -1864 }, - { -8793, -8327, -773, -169 }, - { -9149, -6215, 969, -15 }, - { -8303, -5859, -7, 2006 }, - { -9682, -7283, 255, 1322 }, - { -9293, -7227, 71, -231 }, - { -8525, -6215, 287, -837 }, - { -10477, -5379, 1159, 1449 }, - { -10726, -7856, -130, 102 }, - { -8694, -7461, -1210, 690 }, - { -9367, -5324, 1103, 3170 }, - { -10686, -8055, -831, 1633 }, - { -9201, -6873, -2704, 2258 }, - { -8421, -5358, -1405, 226 }, - { -9066, -5830, -307, -1571 }, - { -11150, -7381, -2746, -900 }, - { -9978, -5925, -2006, -437 }, - { -9464, -4741, -273, 1061 }, - { -10543, -6684, -1113, 1660 }, - { -10073, -5576, 1083, -269 }, - { -8826, -5763, 1600, 1486 }, - { -10445, -9071, -1253, -64 }, - { -12085, -5799, 2, 769 }, - { -12939, -6663, 1650, 1437 }, - { -10932, -6434, -1252, -649 }, - { -11650, -7826, -2053, 710 }, - { -12122, -6733, -1889, -731 }, - { -9093, -6095, -2463, -842 }, - { -10977, -4364, 469, 420 }, - { -11488, -6908, -521, 893 }, - { -9669, -5478, -842, 337 }, - { -10606, -5203, -632, -1361 }, - { -10198, -6284, 1662, 1277 }, - { -10135, -5292, 2435, 3493 }, - { -11027, -6561, 655, 56 }, - { -10977, -5030, 1127, -358 }, - { -12766, -3986, 1348, -335 }, - { -14244, -7731, 264, 317 }, - { -15124, -10309, -508, 1447 }, - { -12821, -8638, -608, 137 }, - { -13076, -8693, -2852, -431 }, - { -11156, -5546, -2252, -1600 }, - { -8692, -7366, -819, -1223 }, - { -12507, -9816, -1714, -121 }, - { -10712, -6666, 544, 3349 }, - { -12462, -5890, -2491, -2318 }, - { -12468, -7226, 437, 232 }, - { -11300, -5226, 2068, 687 }, - { -11994, -8320, -626, 2728 }, - { -12222, -5476, 1142, 18 }, - { -10277, -8122, -2418, 2003 }, - { -13418, -6115, -3563, -2802 }, - { -14759, -9834, -1243, 21 }, - { -13699, -5665, 1525, 507 }, - { -16269, -9476, -701, 163 }, - { -12677, -5437, -247, -1019 }, - { -11827, -4295, -181, -1243 }, - { -12847, -4496, 2984, 1123 }, - { -13860, -7915, -1166, -547 }, - { -12276, -8145, -2290, -1527 }, - { -11417, -4830, 2983, 1854 }, - { -11793, -6002, 1163, 1940 }, - { 11443, -4920, -3235, 3151 }, - { 11300, -6616, -1506, 1175 }, - { 9198, -4628, -2060, 2390 }, - { 10532, -4027, -643, 912 }, - { 9902, -3573, -1606, 1327 }, - { 9653, -3536, -2240, 1869 }, - { 9948, -5171, -423, 2662 }, - { 12316, -4004, -1989, 281 }, - { 12125, -4800, -1265, -163 }, - { 10650, -2617, -2337, 1462 }, - { 9909, -4968, -2376, 916 }, - { 12944, -4647, -1958, 460 }, - { 12988, -5283, -1141, 41 }, - { 12321, -2915, -3621, 1025 }, - { 11449, -2894, -2728, 351 }, - { 12087, -3041, -2002, -32 }, - { 11558, -4031, -1343, -399 }, - { 12983, -3740, -3516, 1245 }, - { 12099, -2515, -2752, 225 }, - { 12515, -3465, -2701, 550 }, - { 14683, -5022, -5272, 2996 }, - { 12260, -3383, -1215, -528 }, - { 13810, -5422, -2443, 1166 }, - { 13421, -5378, -1886, 721 }, - { 12961, -4259, -2594, 796 }, - { 12266, -2104, -4768, 1591 }, - { 13523, -4710, -3045, 1342 }, - { 12437, -2099, -5610, 2117 }, - { 11850, -2183, -3497, 661 }, - { 12275, -3936, -597, -697 }, - { 12459, -5253, -517, -544 }, - { 12835, -4094, -1322, -168 }, - { 14360, -5677, -3305, 1859 }, - { 13905, -4552, -4309, 2117 }, - { 11559, -3412, -1847, -81 }, - { 13379, -3167, -5764, 2746 }, - { 11910, -1634, -4342, 1052 }, - { 12662, -4742, 71, -974 }, - { 13057, -3254, -4424, 1705 }, - { 15046, -5706, -4851, 3019 }, - { 14162, -4142, -5514, 2843 }, - { 12764, -1845, -6684, 2888 }, - { 13714, -2374, -7838, 3857 }, - { 13295, -1663, -8293, 4073 }, - { 10032, -4152, -3403, 1421 }, - { 10942, -5386, -2222, 950 }, - { 10532, -6385, -1750, 1925 }, - { 10273, -5972, -1534, 643 }, - { 10605, -4782, -1695, 27 }, - { 10988, -5153, -1123, -341 }, - { 11629, -5884, -1060, 48 }, - { 10441, -4045, -2431, 311 }, - { 10788, -3595, -4171, 1807 }, - { 12110, -5686, -2127, 976 }, - { 11746, -4773, -2639, 891 }, - { 11541, -5299, -3031, 1732 }, - { 11416, -2559, -5359, 2198 }, - { 11583, -5376, -704, 677 }, - { 10416, -3214, -3516, 872 }, - { 9651, -5435, -1618, 3255 }, - { 9973, -5133, -996, 3923 }, - { 11707, -4643, -430, -796 }, - { 10994, -2709, -3587, 2302 }, - { 10716, -5118, -645, 270 }, - { 14100, -10314, 1095, 1531 }, - { 12944, -8049, 1105, -741 }, - { 13276, -7035, -511, 274 }, - { 14008, -7254, -283, 139 }, - { 11594, -6536, -91, 1671 }, - { 11732, -8645, 746, 15 }, - { 14613, -7085, -1578, 1183 }, - { 13083, -6224, -750, -4 }, - { 13988, -6256, -1592, 820 }, - { 14678, -8683, 441, 126 }, - { 15571, -8872, -521, 1139 }, - { 15642, -9533, 341, 697 }, - { 15960, -9586, -168, 1121 }, - { 15464, -10239, 1433, -1 }, - { 14934, -7887, -1046, 1080 }, - { 15252, -7630, -1899, 1628 }, - { 15485, -8384, -1234, 1484 }, - { 15962, -8638, -1815, 1931 }, - { 16501, -10664, 398, 1167 }, - { 16146, -10145, 411, 918 }, - { 14573, -7475, -697, 601 }, - { 14302, -7996, 28, 257 }, - { 14769, -6792, -2286, 1574 }, - { 14144, -6137, -2169, 1257 }, - { 14770, -6271, -3111, 1933 }, - { 14110, -8312, 1083, -531 }, - { 15235, -6991, -2993, 2174 }, - { 13222, -5805, 547, -891 }, - { 14796, -8762, 1254, -246 }, - { 16040, -9181, -1005, 1551 }, - { 16487, -10086, -373, 1420 }, - { 15077, -9479, 966, 51 }, - { 13026, -6468, 932, -1080 }, - { 12703, -6152, -33, -573 }, - { 15641, -6810, -4128, 2874 }, - { 13282, -7673, 1583, -1283 }, - { 12373, -7150, 1512, -917 }, - { 12992, -7751, -678, 783 }, - { 10907, -6858, -313, 2597 }, - { 13026, -8963, 125, 2152 }, - { 12770, -9946, 1957, -505 }, - { 12482, -6849, -1268, 833 }, - { 13790, -6181, -138, -279 }, - { 12709, -8382, 2044, 227 }, - { 12244, -6630, 203, -457 }, - { 14209, -6816, -1032, 632 }, - { 15134, -8267, -288, 640 }, - { 13619, -6157, -1090, 356 }, - { 14044, -7413, 725, -484 }, - { 12958, -7753, 2585, -1980 }, - { 13188, -8396, 2306, -1558 }, - { 14379, -9980, 2132, -688 }, - { 14275, -9857, 1162, 179 }, - { 13690, -8648, 1621, -889 }, - { 11770, -6829, -746, 278 }, - { 12732, -8202, 286, 90 }, - { 13630, -10146, 1867, -207 }, - { 12072, -8740, 1299, -645 }, - { 12852, -9492, 1226, 62 }, - { 11792, -7382, -54, -116 }, - { 13779, -9014, 487, 351 }, - { 11951, -7729, 121, 834 }, - { 11970, -9781, 2276, -4 }, - { 12680, -7984, 2787, -787 }, - { 13300, -14488, 6408, -1927 }, - { 13635, -15355, 9153, -3073 }, - { 12804, -13566, 5517, -1625 }, - { 16624, -10854, 1690, 28 }, - { 20387, -18532, 6162, -261 }, - { 16515, -12642, 3392, -519 }, - { 15800, -11095, 2151, -202 }, - { 16824, -11790, 1651, 599 }, - { 17604, -13213, 2563, 538 }, - { 17892, -14177, 3562, 147 }, - { 16987, -11399, 869, 1052 }, - { 17003, -12456, 2442, 265 }, - { 21657, -21806, 9198, -1250 }, - { 16825, -13341, 3980, -686 }, - { 17525, -12714, 1887, 805 }, - { 16419, -11034, 1216, 617 }, - { 20931, -19939, 7469, -684 }, - { 18452, -15390, 4573, -191 }, - { 14778, -10077, 2841, -1209 }, - { 17402, -13319, 3042, 160 }, - { 19365, -17922, 7087, -1061 }, - { 16298, -11941, 2810, -351 }, - { 19087, -16176, 4775, -84 }, - { 17666, -12289, 938, 1224 }, - { 18581, -15894, 5132, -430 }, - { 19823, -16717, 4142, 545 }, - { 19960, -19423, 8400, -1492 }, - { 18973, -16817, 5906, -594 }, - { 19079, -15431, 3528, 503 }, - { 16667, -12485, 4467, -1302 }, - { 19791, -17797, 6196, -529 }, - { 20005, -17606, 5354, -20 }, - { 20123, -18599, 6886, -728 }, - { 19068, -14805, 2394, 1105 }, - { 14443, -13723, 5631, -2029 }, - { 14730, -14231, 5631, -1450 }, - { 16089, -15959, 7271, -2029 }, - { 13473, -11200, 3236, -924 }, - { 14413, -10902, 2347, -267 }, - { 17666, -18662, 11381, -3496 }, - { 14749, -11042, 3305, -275 }, - { 15304, -10486, 1869, -240 }, - { 14809, -12126, 3369, -616 }, - { 16896, -16561, 7307, -1845 }, - { 15782, -14336, 5380, -1264 }, - { 16395, -15520, 6415, -1588 }, - { 13681, -11114, 2584, -320 }, - { 14244, -12326, 4480, -1632 }, - { 15247, -13119, 4265, -898 }, - { 13987, -12091, 3469, -597 }, - { 13941, -12770, 4240, -839 }, - { 13771, -13627, 5252, -1384 }, - { 15010, -16074, 7592, -2249 }, - { 15852, -17226, 8619, -2655 }, - { 18921, -16916, 6875, -1501 }, - { 14909, -11678, 2768, -295 }, - { 18988, -18353, 8424, -2070 }, - { 15457, -15080, 6218, -1513 }, - { 14916, -15512, 6949, -1883 }, - { 18108, -14702, 4681, -701 }, - { 17600, -15733, 5616, -775 }, - { 14070, -13683, 6472, -2626 }, - { 13832, -11914, 5201, -2232 }, - { 18846, -19009, 9192, -1961 }, - { -11981, -10994, -6324, -2264 }, - { -10976, -9047, -6546, -3828 }, - { -11288, -10532, -7014, -4191 }, - { -10139, -10189, -7799, -2688 }, - { -10555, -9988, -9181, -2040 }, - { -11596, -11339, -10022, -2707 }, - { -13400, -13395, -11306, -4206 }, - { -9774, -12281, -7466, -4133 }, - { -10842, -13125, -8777, -4956 }, - { -11964, -15082, -9779, -5095 }, - { -9382, -10188, -9053, -4927 }, - { -11562, -11296, -3651, -985 }, - { -9287, -10083, -7918, -4069 }, - { -12821, -16556, -11410, -6195 }, - { -12628, -8959, -4521, -1113 }, - { -13845, -11581, -3649, -681 }, - { -12685, -10269, -5483, -1275 }, - { -14988, -12874, -5107, -1189 }, - { -13761, -11367, -6202, -1804 }, - { -13225, -11249, -7820, -3354 }, - { -14809, -11992, -3202, -312 }, - { -15620, -15519, -10210, -3433 }, - { -12954, -10200, -3139, -611 }, - { -11536, -9981, -5284, -923 }, - { -13034, -12417, -4612, -1098 }, - { -16911, -15505, -6123, -1352 }, - { -17396, -17685, -8330, -2171 }, - { -14120, -10764, -2265, -99 }, - { -12598, -7367, -5406, -3530 }, - { -14143, -12793, -10909, -5226 }, - { -14692, -16871, -11626, -5554 }, - { -12581, -11197, -9194, -3837 }, - { -16752, -16726, -9746, -2808 }, - { -10600, -10358, -6560, -1227 }, - { -14573, -13312, -8957, -3393 }, - { -10172, -8463, -8579, -3387 }, - { -11418, -12421, -5522, -1842 }, - { -11855, -14204, -6669, -2625 }, - { -13308, -8191, -3941, -2194 }, - { -10007, -12266, -5022, -1811 }, - { -13532, -15771, -9497, -3175 }, - { -11760, -11148, -10339, -5529 }, - { -12149, -12763, -11198, -3697 }, - { -12029, -12119, -8555, -1792 }, - { -16995, -19957, -11447, -3471 }, - { -13144, -14504, -9988, -3191 }, - { -9938, -11064, -6139, -3162 }, - { -8873, -11550, -8294, -6550 }, - { -9303, -13010, -6150, -2711 }, - { -15463, -10469, -1766, -170 }, - { -15985, -11693, -3007, -650 }, - { -17142, -10671, -1434, 47 }, - { -16063, -13858, -4817, -1058 }, - { -19446, -19599, -9594, -2464 }, - { -20076, -18744, -8313, -1889 }, - { -15047, -16085, -7590, -2250 }, - { -13481, -16195, -8552, -2998 }, - { -13829, -14869, -6704, -1932 }, - { -16357, -18484, -9802, -2959 }, - { -10551, -8393, -9303, -5070 }, - { -11345, -9156, -5641, -3107 }, - { -13217, -13449, -9270, -4541 }, - { -11988, -13732, -9995, -6374 }, - { -11007, -9519, -5168, -4107 }, - { 9930, -7858, 8061, -4375 }, - { 8274, -7867, 5992, -2096 }, - { 9692, -9675, 7621, -3670 }, - { 9589, -8110, 6509, -3010 }, - { 12617, -11976, 10122, -5360 }, - { 11867, -8895, 7948, -5323 }, - { 10388, -10482, 9234, -4324 }, - { 8188, -8220, 7810, -2737 }, - { 10407, -8787, 4806, -1930 }, - { 10348, -8845, 9233, -6614 }, - { 9422, -7091, 4820, -2878 }, - { 9758, -9796, 5584, -2256 }, - { 10188, -7994, 5347, -3343 }, - { 11133, -7455, 4015, -2306 }, - { 10676, -10744, 6093, -2629 }, - { 11522, -12184, 7848, -3375 }, - { 8805, -9883, 5317, -3071 }, - { 9498, -9654, 6555, -3592 }, - { 10488, -8008, 4066, -1252 }, - { 11261, -8930, 6068, -2738 }, - { 12180, -10397, 5027, -1531 }, - { 9138, -8531, 3601, -1959 }, - { 8107, -8380, 4970, -2061 }, - { 9737, -13248, 6438, -2617 }, - { 11178, -10423, 2622, -522 }, - { 9572, -12372, 5199, -2019 }, - { 12057, -12144, 4147, -1099 }, - { 9047, -9925, 2516, -665 }, - { 10790, -8030, 5882, -4386 }, - { 7199, -8426, 6337, -2841 }, - { 7778, -8285, 3529, -3442 }, - { 7559, -10569, 3484, -1332 }, - { 9404, -8115, 7484, -5541 }, - { 7792, -11976, 5546, -2573 }, - { 9313, -10264, 7661, -5195 }, - { 6701, -10725, 4370, -1784 }, - { 4918, -11361, 4507, -4527 }, - { 5147, -12305, 3978, -5556 }, - { 6525, -9899, 4481, -3129 }, - { 7538, -12855, 6060, -4826 }, - { 8659, -12111, 7159, -4430 }, - { 8440, -11304, 4547, -1747 }, - { 9216, -10918, 3507, -1195 }, - { 6165, -9254, 4771, -4677 }, - { 9163, -11019, 5637, -4935 }, - { 13441, -11509, 6676, -2434 }, - { 7912, -9398, 6663, -4048 }, - { 11723, -13745, 8131, -4148 }, - { 6065, -10257, 5005, -6327 }, - { 11618, -12417, 5336, -1894 }, - { 8891, -13924, 8407, -6131 }, - { 9622, -12563, 7908, -5109 }, - { 11479, -10315, 8349, -3991 }, - { 11676, -14103, 6611, -2330 }, - { 11951, -8953, 3829, -1550 }, - { 10486, -8044, 10493, -5920 }, - { 11801, -10769, 9763, -5305 }, - { 6109, -8676, 5827, -1346 }, - { 7030, -9611, 5624, -5761 }, - { 12808, -12886, 8683, -4148 }, - { 13213, -10464, 6381, -3189 }, - { 11796, -13681, 10703, -6075 }, - { 9639, -7949, 9625, -3944 }, - { 8538, -6997, 5309, 453 } + { 9928, -2618, -1093, -1263 }, + { 11077, -2876, -1747, -308 }, + { 10503, -1082, -1426, -1167 }, + { 9337, -2403, -1495, 274 }, + { 10698, -2529, -532, -1122 }, + { 10368, -3974, -1264, -750 }, + { 10070, -3667, 346, 863 }, + { 10278, -3093, 311, -576 }, + { 9894, -1330, -1428, -860 }, + { 10544, -1923, -1058, -971 }, + { 10996, -1632, -841, -1404 }, + { 11832, -3465, 1658, -1990 }, + { 10852, -688, -2658, -499 }, + { 10546, -1749, -147, -1733 }, + { 10801, -1004, -708, -1453 }, + { 10588, -441, -2113, -952 }, + { 10141, -3331, -582, -1432 }, + { 9608, -2590, 383, 258 }, + { 11422, -3265, 229, -1544 }, + { 10460, -1338, -713, -1568 }, + { 10306, -1721, -1660, -603 }, + { 9580, -1812, -1235, -1061 }, + { 11471, -2285, -1617, -607 }, + { 10081, -2225, -1408, -868 }, + { 10715, -2624, -1367, -704 }, + { 10616, -1871, -2770, -35 }, + { 9352, -2340, -1024, -1566 }, + { 11065, -1458, -1926, -735 }, + { 11334, -2056, -1041, -1144 }, + { 9825, -2048, -794, -1536 }, + { 11850, -2695, -1123, -867 }, + { 10654, -2226, -1891, -373 }, + { 10024, -1557, -808, -1069 }, + { 11142, -1266, -3238, 128 }, + { 11729, -3282, -514, -1011 }, + { 11402, -2094, -2335, -189 }, + { 10195, -3658, 181, -1875 }, + { 11431, -2626, -404, -1377 }, + { 11001, -3868, -619, -1077 }, + { 10894, -2559, 274, -1758 }, + { 9633, -1482, -2253, -773 }, + { 11245, -3321, 830, -1972 }, + { 9768, -2701, -199, -1859 }, + { 10500, -2042, 525, -2043 }, + { 11669, -4069, 293, -1468 }, + { 9192, -1991, -583, -61 }, + { 10057, -3220, -2015, -473 }, + { 9497, -2315, -2490, -467 }, + { 10455, -3069, -1194, -1007 }, + { 9994, -1936, -60, -1225 }, + { 9295, -2156, -1761, -1134 }, + { 10085, -3748, -1026, 197 }, + { 9334, -2360, 804, -351 }, + { 11561, -2553, 1352, -2313 }, + { 12837, -3998, 1195, -1958 }, + { 10114, -1100, -2414, -394 }, + { 9341, -2530, 315, 755 }, + { 10131, -3164, 1411, -674 }, + { 9535, -905, -1551, 579 }, + { 11717, -1519, -3051, 91 }, + { 9824, -2911, -2775, 192 }, + { 9662, -2934, -561, 1450 }, + { 11085, -3392, -1298, -659 }, + { 8955, -2102, -1899, 703 }, + { 8607, -1742, -4348, 814 }, + { 7640, -2063, -3617, 52 }, + { 7074, -826, -4325, 4375 }, + { 7714, 584, -4238, 1927 }, + { 6355, -952, -4912, 3127 }, + { 7069, -660, -6413, 4087 }, + { 8313, -132, -2964, -876 }, + { 6952, -1422, -3962, -24 }, + { 9299, -734, -3088, -263 }, + { 9484, -574, -4513, 466 }, + { 7246, -91, -3735, -704 }, + { 8325, -1417, -3090, -530 }, + { 6469, -1226, -4757, 829 }, + { 6652, -368, -5682, 1393 }, + { 7971, -1278, -2284, 1205 }, + { 7229, -699, -3556, 1840 }, + { 7994, 1284, -2729, 732 }, + { 9005, -698, -4522, 2189 }, + { 6963, 197, -2727, 380 }, + { 8527, 135, -3991, -213 }, + { 8840, 934, -3014, -567 }, + { 10125, 418, -3284, -371 }, + { 6367, 361, -2318, 2554 }, + { 7892, 172, -5247, 4673 }, + { 6674, 387, -5424, 4398 }, + { 6240, 684, -4047, 1219 }, + { 11170, -794, -5081, 1195 }, + { 11765, -648, -6265, 2052 }, + { 10845, -775, -3837, 366 }, + { 12496, -689, -8260, 3562 }, + { 7893, -1166, -4972, 988 }, + { 8592, 1052, -5986, 3087 }, + { 7277, 1874, -5685, 3579 }, + { 6900, 2016, -4809, 3491 }, + { 8530, -2405, -3250, 1986 }, + { 9426, 494, -7067, 5038 }, + { 10285, 564, -8210, 5370 }, + { 8749, -2207, -3980, 2852 }, + { 9653, -2686, -4300, 1400 }, + { 9770, -2286, -5663, 4233 }, + { 8490, -4, -7048, 4496 }, + { 7697, -1209, -5328, 3183 }, + { 6451, 801, -4324, -554 }, + { 7387, 1806, -5265, 545 }, + { 7450, -2302, -4445, 1418 }, + { 8817, -1370, -5827, 2168 }, + { 10324, -2406, -5629, 2579 }, + { 8863, -2578, -3537, 467 }, + { 6901, -1624, -3169, 3392 }, + { 7846, 156, -6948, 3381 }, + { 7928, -1115, -5972, 4816 }, + { 6089, -599, -4368, -320 }, + { 7833, 1246, -3960, -621 }, + { 8931, 2521, -6768, 2052 }, + { 8900, 1944, -4126, 40 }, + { 7661, -34, -2855, 2480 }, + { 5873, 474, -3262, 3712 }, + { 7535, -234, -4699, 216 }, + { 5856, 143, -5142, 73 }, + { 8944, -106, -5874, 3663 }, + { 7134, 426, -5879, 2895 }, + { 10199, 1011, -4762, 369 }, + { 8454, 264, -5971, 1291 }, + { 7822, -2449, -4333, 4540 }, + { 6200, -2758, -2632, 1497 }, + { 6070, -4315, -2699, 414 }, + { 7047, -3739, -3210, 1060 }, + { 5675, -3801, -2717, -407 }, + { 4789, -4063, -2628, -744 }, + { 4023, -3366, -3133, -726 }, + { 4296, -2407, -3381, -513 }, + { 4388, -2931, -2820, 1512 }, + { 4559, -4233, -1941, 1976 }, + { 6702, -3208, -1755, 1680 }, + { 4416, -3521, -1052, 2984 }, + { 7154, -4266, -1203, 3732 }, + { 3625, -4242, -3244, 1395 }, + { 6518, -2856, -1304, 2887 }, + { 6170, -1949, -3014, 3973 }, + { 5189, -2451, -4020, 3477 }, + { 6218, -2988, -1921, 3844 }, + { 4827, -3688, -1928, 3343 }, + { 6668, -3991, -2805, 3095 }, + { 5297, -3115, -3684, 2390 }, + { 5354, -4614, -2662, 1504 }, + { 4196, -3091, -4147, 1135 }, + { 3540, -2893, -4007, 100 }, + { 5569, -1602, -4007, 1909 }, + { 4341, -2091, -4272, 252 }, + { 5559, -2878, -3832, 498 }, + { 4548, -4479, -2898, -27 }, + { 5176, -2494, -4635, 1476 }, + { 3294, -3485, -3738, 716 }, + { 4920, -1229, -4195, -365 }, + { 3257, -3518, -3349, 2862 }, + { 5286, -1948, -3485, -778 }, + { 6502, -3051, -152, 2854 }, + { 5864, -4192, -1076, 3451 }, + { 4656, -3122, -3448, 179 }, + { 5907, -754, -1596, 3116 }, + { 7229, -3680, -1590, 2892 }, + { 5107, -3888, -3364, 806 }, + { 6764, -2635, -3450, 134 }, + { 5258, -2827, -2844, -1052 }, + { 5798, -1725, -4305, 205 }, + { 5404, -1213, -3362, 449 }, + { 6224, -2738, -3046, -581 }, + { 4223, -2438, -2725, 3745 }, + { 4751, -3411, -2123, 116 }, + { 3868, -3000, -3954, 2297 }, + { 6819, -2899, -4277, 2825 }, + { 4207, -4754, -2808, 865 }, + { 4804, -1494, -1997, 4688 }, + { 5282, -2213, -548, 3559 }, + { 5580, -1912, -566, 4370 }, + { 6168, -2857, -672, 4053 }, + { 6583, -4515, -2850, 1670 }, + { 6511, -3093, -3988, 1421 }, + { 4646, -1790, -1443, 3650 }, + { 5915, -924, -2020, 896 }, + { 7814, -4181, -3152, 2007 }, + { 6190, -2238, -4817, 2279 }, + { 4737, -4034, -3288, 1835 }, + { 8161, -3633, -3423, 3137 }, + { 7415, -2351, -2088, 4290 }, + { 4106, -2517, -62, 2905 }, + { 4909, -3145, -614, 4112 }, + { 4938, -3281, -397, 1100 }, + { -173, 919, 1589, -5363 }, + { -13, 796, -295, -6655 }, + { -1860, -829, 1141, -4555 }, + { 2298, -838, -664, -5005 }, + { -884, -1097, 2074, -4613 }, + { -101, 281, 2846, -4535 }, + { 1166, 453, 2429, -5910 }, + { 879, -664, 2370, -5452 }, + { 1415, -370, -1699, -4727 }, + { -1413, 1277, -669, -6649 }, + { 2133, 304, -968, -4624 }, + { 380, 586, -2087, -4892 }, + { 1336, 275, -82, -5789 }, + { -2459, 1057, -34, -5416 }, + { 2278, -1758, 866, -5653 }, + { 1945, -2295, -149, -5302 }, + { 1287, -3525, 996, -5255 }, + { 2297, 803, 1177, -6067 }, + { 187, -180, -619, -6202 }, + { -793, -2537, 1554, -5057 }, + { -2703, -204, -629, -5853 }, + { -1007, -146, 313, -5582 }, + { 830, 357, 869, -6363 }, + { -228, -575, -3177, -4433 }, + { -1001, -1553, -142, -5708 }, + { -1644, 1683, 1721, -4533 }, + { 893, 1924, -15, -5791 }, + { 2195, 2061, -262, -5471 }, + { 3031, 270, 311, -5096 }, + { 1912, 1638, -1523, -4677 }, + { -3142, -55, 253, -4914 }, + { 356, -1680, 343, -6123 }, + { -2241, -1734, -976, -5939 }, + { -2196, -2893, 547, -4938 }, + { -1245, 126, -1916, -5419 }, + { -249, -3755, -1422, -5594 }, + { 575, -2683, -1926, -4566 }, + { -762, 1885, 192, -5880 }, + { -811, -2562, -1068, -6013 }, + { -2264, -3086, -976, -4775 }, + { 70, -1215, 2880, -4410 }, + { 714, -3760, 2916, -4691 }, + { -244, -3404, 1740, -4493 }, + { 684, -5137, -328, -5608 }, + { -529, -3825, -1786, -4535 }, + { -713, -4743, -1118, -5546 }, + { 2718, -3788, 1798, -5708 }, + { -1639, -3679, -1564, -6095 }, + { 1693, -2642, -1389, -4539 }, + { 505, -1573, -1651, -4878 }, + { -835, -2256, -1941, -5352 }, + { 1464, -411, 1993, -6441 }, + { 493, -3184, -145, -6148 }, + { -1413, 499, -1617, -6479 }, + { -294, 1722, -1419, -5725 }, + { -2937, -1528, -175, -4624 }, + { -594, -5911, -56, -6146 }, + { -300, -4275, 1156, -5947 }, + { 552, -2643, 2669, -3959 }, + { 905, -4158, 1789, -5809 }, + { 1336, -2009, 2108, -5903 }, + { 1555, -3600, 1110, -6759 }, + { -1294, -3464, 77, -6084 }, + { -1139, -4006, -1270, -4181 }, + { -5094, -3296, 1092, -2847 }, + { -5503, -2883, 1984, -2067 }, + { -4671, -4218, -1417, -4132 }, + { -3763, -3818, 1262, -3082 }, + { -5132, -3430, 2928, -728 }, + { -5957, -2877, 1251, -2446 }, + { -4425, -2319, -212, -4276 }, + { -6201, -1993, 1774, -2182 }, + { -5500, -3836, 2201, -1396 }, + { -6934, -2334, 2366, -1293 }, + { -6124, -4140, 1337, -1977 }, + { -6553, -4186, 1756, -1325 }, + { -5126, -1258, 744, -3656 }, + { -5167, -1390, 1581, -2895 }, + { -4525, -3398, 2429, -1865 }, + { -4076, -3183, 2027, -2510 }, + { -6191, -3274, 1838, -1814 }, + { -4454, -2753, 2723, -1185 }, + { -6655, -4797, 251, -2595 }, + { -6332, -2232, 1832, 217 }, + { -5869, -1698, 134, 340 }, + { -6614, -1045, 2126, -1932 }, + { -4859, -2107, 2010, -2435 }, + { -6274, -1622, 2808, -1374 }, + { -3119, -3209, 521, -3988 }, + { -5676, -2082, -420, -2711 }, + { -7073, -3623, 696, -2343 }, + { -5986, -4224, 572, -2454 }, + { -4340, -4521, 882, -2771 }, + { -6178, -1933, 535, -1444 }, + { -4923, -4163, 1744, -2066 }, + { -6410, -1519, 1058, -2683 }, + { -5077, -1185, 856, -2216 }, + { -7091, -2444, 687, -2597 }, + { -5284, -2165, 3239, -993 }, + { -4763, -1497, 197, -3179 }, + { -4128, -4958, -396, -3578 }, + { -5054, -3878, -647, -2672 }, + { -7005, -3348, 1679, -1579 }, + { -5767, -1017, 2582, -1915 }, + { -7069, -2787, 1331, -2070 }, + { -5532, -2296, 706, -2950 }, + { -5059, -3543, -821, -3637 }, + { -6639, -1835, 1016, -696 }, + { -5611, -5220, -694, -3371 }, + { -5994, -2803, 2933, -729 }, + { -5948, -619, 1596, -2676 }, + { -5486, -4419, 153, -3265 }, + { -4329, -3440, 1646, -1439 }, + { -4083, -3978, 177, -3569 }, + { -4289, -2599, 1224, -3075 }, + { -5707, -3253, 1912, -759 }, + { -6606, -3437, 2562, -571 }, + { -5254, -2444, 769, -352 }, + { -6545, -3154, 582, -1103 }, + { -5328, -2241, 2566, -1775 }, + { -7216, -1936, 1538, -1983 }, + { -3730, -2451, 426, -3869 }, + { -5110, -1385, 2031, -1169 }, + { -6470, -2715, 269, -3123 }, + { -5806, -2480, -97, -3832 }, + { -3683, -4916, -490, -4330 }, + { -6341, -2083, -669, -115 }, + { -4913, -4079, -837, -4673 }, + { -3274, -2497, 2334, -2652 }, + { -1286, -1731, 2550, -3756 }, + { -3375, -877, 926, -3977 }, + { -2525, -2079, 2879, -2625 }, + { -5308, -504, 3111, -1607 }, + { -4904, 460, 4093, -1232 }, + { -1993, 1616, 4656, -1913 }, + { -3481, -1176, 3119, -2236 }, + { -4132, -1502, 2339, -2545 }, + { -2542, 1151, 3569, -2550 }, + { -4381, 430, 3147, -2082 }, + { -3888, 867, 3899, -1657 }, + { -2861, 1290, 4202, -1979 }, + { -3893, -253, 2363, -2764 }, + { -1705, 688, 3827, -2923 }, + { -2223, 2312, 3700, -3148 }, + { -1986, -720, 5021, -795 }, + { -3177, 242, 1952, -3352 }, + { -1854, 1509, 2528, -3815 }, + { -3173, 97, 5019, -706 }, + { -2689, -145, 1375, -3915 }, + { -4838, -385, 2488, -2427 }, + { -4557, -355, 1603, -3060 }, + { -3522, 1832, 3292, -2674 }, + { -3769, 780, 2378, -2704 }, + { -4323, -1932, 3414, -1169 }, + { -2740, 1158, 2729, -3273 }, + { -3647, 210, 1464, -2892 }, + { -2342, -2097, 1513, -3727 }, + { -4422, -1242, 3130, -1833 }, + { -1308, -1039, 4290, -1875 }, + { -1754, -2535, 3298, -2314 }, + { -4102, -186, 4037, -1094 }, + { -1008, 1570, 3290, 171 }, + { -3322, -2621, 2791, -1536 }, + { -2539, -2597, 3442, -1672 }, + { -3411, -2015, 3670, -1174 }, + { -2097, 730, 5581, -1399 }, + { -1510, -74, 4820, -2004 }, + { -4086, -868, 4425, -771 }, + { -956, -986, 3640, -2925 }, + { -2087, -1250, 3464, -2458 }, + { -3308, -2411, 1334, -3667 }, + { -2264, -389, 4004, -1854 }, + { -680, 239, 4058, -3388 }, + { -1357, 30, 2993, -3658 }, + { -3601, -552, 1177, -1136 }, + { -2641, 442, 4374, -1625 }, + { -2525, 770, 1640, -3895 }, + { -3172, -891, 3893, -1608 }, + { -2996, 13, 3277, -2414 }, + { -899, 1055, 4470, -2501 }, + { -422, -584, 3475, -3787 }, + { -1978, -593, 2566, -3415 }, + { -3150, -1280, 2362, -3047 }, + { -3592, 224, 1026, -3932 }, + { -4840, -1189, 3633, -879 }, + { -3952, -2255, 2916, -1826 }, + { -1695, 28, 1810, -349 }, + { -745, -2484, 3308, -3293 }, + { -1016, 1563, 5365, -1823 }, + { -2172, -1787, 4266, -1287 }, + { -1241, -1951, 3982, -2413 }, + { -2009, -2639, 2330, -3480 }, + { 5105, -1618, -2588, -2015 }, + { 6497, -1523, -3218, -910 }, + { 6526, -2305, -2029, -1790 }, + { 5289, -99, -3436, -400 }, + { 5781, -1623, -1577, -2617 }, + { 5259, -670, -3125, -1700 }, + { 6343, -1256, -331, -3222 }, + { 7967, -678, -2195, -1462 }, + { 6119, -695, -2988, -1538 }, + { 6108, 494, -3359, -1548 }, + { 5067, 969, -2328, -2707 }, + { 7595, -435, -1497, -2056 }, + { 6929, -719, -2420, -1665 }, + { 5190, 584, -2982, -2103 }, + { 6106, -444, -1411, -2739 }, + { 5584, 289, -1804, -2803 }, + { 5276, 227, -1180, -3361 }, + { 7544, -1525, -1834, -1725 }, + { 5986, -1470, -2606, -1701 }, + { 5096, -765, -1712, -3006 }, + { 5423, -149, -3933, -1157 }, + { 7651, 26, -2445, -1507 }, + { 4745, -464, -1735, -2362 }, + { 5352, -1011, -1094, -1999 }, + { 6300, -672, -542, -1950 }, + { 6675, -1020, -1318, -1059 }, + { 7218, -2036, -603, -2462 }, + { 7755, -1514, -2430, -1229 }, + { 5041, 449, -1056, -2405 }, + { 6710, -2277, -1344, -2284 }, + { 6824, -1347, -2254, 251 }, + { 6068, -1857, -983, -1316 }, + { 5603, -2177, -2730, -1477 }, + { 5838, -1059, -3604, -970 }, + { 5076, -789, -335, -2413 }, + { 6191, -1634, -2000, -2129 }, + { 5092, -1292, -2543, -1034 }, + { 5305, 435, -1710, -1850 }, + { 6140, 561, -2176, -2380 }, + { 6752, 348, -2496, -1890 }, + { 6405, 273, -1098, -2778 }, + { 6942, -1340, -496, -1381 }, + { 5238, -687, -2454, -2349 }, + { 6959, -882, -1833, -2061 }, + { 6292, -253, -2125, -2199 }, + { 5838, -574, -759, -3215 }, + { 6954, -1484, -640, -2771 }, + { 7498, -1706, -1210, -2154 }, + { 6772, -1003, -1235, -2532 }, + { 6014, 228, -2154, -1108 }, + { 6943, -2178, -2644, -1122 }, + { 7262, -763, -3056, -1090 }, + { 6273, -1478, -1072, 177 }, + { 4734, 425, -2912, 357 }, + { 7129, 168, -1537, -2327 }, + { 7204, -434, -746, -2660 }, + { 6879, 57, -3087, -1310 }, + { 4623, -610, -718, -3459 }, + { 6565, -543, -1998, -339 }, + { 4752, -277, -2066, -1405 }, + { 7435, -1416, -1904, -505 }, + { 4076, 150, -1222, -3556 }, + { 7082, -28, -1456, -1174 }, + { 5941, -446, -1326, -1158 }, + { 3870, -1648, -2474, -2589 }, + { 858, 37, -3387, -3721 }, + { 3557, -1503, -1664, -3383 }, + { 3336, -1972, -3079, -2216 }, + { 3186, 60, -4185, -863 }, + { 3456, -773, -3066, -2457 }, + { 4131, -913, -2060, -2601 }, + { 4431, -691, -4114, -972 }, + { 3461, -334, -3680, -1751 }, + { 2006, -459, -2214, -3827 }, + { 1322, 32, -2816, -3203 }, + { 4425, -1897, -2791, -1946 }, + { 4504, 23, -3421, -1909 }, + { 3090, -885, -2366, -3264 }, + { 3209, -2363, -3730, -834 }, + { 3312, -1471, -3641, -1579 }, + { 4184, -1669, -3323, -1248 }, + { 2190, -931, -3302, -2944 }, + { 2947, -229, -4791, -1195 }, + { 2020, -1626, -2700, -3125 }, + { 2214, -326, -4352, -1683 }, + { 3286, -2619, -2412, -2458 }, + { 1000, -2571, -4129, -2158 }, + { 2496, -2627, -3611, -1433 }, + { 2043, -2191, -2167, -3827 }, + { 2571, -2544, -1915, -3222 }, + { 2022, -1501, -3856, -2165 }, + { 2685, -1180, -1461, -4038 }, + { 1610, -2313, -4391, -1173 }, + { 2340, -2490, -4215, -516 }, + { 1742, -2615, -3632, -2146 }, + { 523, -1293, -4246, -2442 }, + { 3725, -2723, -3014, -1576 }, + { 3554, -1381, -4200, -824 }, + { 1291, -1594, -4777, -1430 }, + { 1452, 515, -2960, -3830 }, + { 4264, -894, -3305, -1826 }, + { 2606, -1452, -4522, -966 }, + { 1196, -830, -4807, -1816 }, + { 1054, -775, -2616, -4071 }, + { 4206, 415, -4344, -1132 }, + { 3044, 491, -4126, -1934 }, + { 988, -901, -3353, -3443 }, + { 1729, -3063, -2267, -3370 }, + { 3915, 912, -2989, -2387 }, + { 3781, 300, -2457, -3050 }, + { 2712, 924, -1350, -1206 }, + { 4230, 405, -2343, 665 }, + { 1878, -873, -225, -29 }, + { 3510, 56, -1334, -3420 }, + { 2850, 1447, -2651, -3150 }, + { 1510, -706, -4125, -2483 }, + { 3115, 793, -1692, -3894 }, + { 2667, 213, -2973, -2786 }, + { 1184, -2384, -3051, -3173 }, + { 2139, 796, -2079, -3697 }, + { 1464, -1483, -3726, -2754 }, + { 2407, -1148, -3915, -1569 }, + { 2612, -1779, -3217, -2271 }, + { 2406, -2870, -2937, -2496 }, + { 2140, 126, -3646, -2758 }, + { 2952, -1036, 268, -1423 }, + { 93, -1931, -3841, -3535 }, + { 389, -2953, -3383, -3343 }, + { 8652, -5511, -1662, 565 }, + { 7427, -2791, -2535, -842 }, + { 8541, -4253, -1407, -988 }, + { 8018, -3203, -2998, 105 }, + { 7231, -3926, -958, 1308 }, + { 7331, -3690, -363, 2586 }, + { 6803, -3646, -2226, -903 }, + { 8163, -2811, -477, -2235 }, + { 9356, -3818, -1685, -684 }, + { 8466, -2854, -302, -698 }, + { 8458, -3224, 517, 279 }, + { 8074, -2619, -1326, 2596 }, + { 8779, -2761, -2527, -441 }, + { 6533, -2887, -899, -696 }, + { 7394, -2305, -1642, -120 }, + { 8281, -3780, -22, 1305 }, + { 9158, -4413, -779, 901 }, + { 9031, -5240, -1109, 1678 }, + { 8717, -3650, 410, -1075 }, + { 7317, -3197, -818, -2264 }, + { 7934, -2385, -1214, -1886 }, + { 8256, -4441, -291, -587 }, + { 7358, -3395, 1090, -270 }, + { 9446, -4910, -1343, -473 }, + { 8187, -4726, -808, 1166 }, + { 7504, -3845, -47, 267 }, + { 8029, -2146, -1283, -383 }, + { 7461, -2705, -853, 783 }, + { 9367, -3636, -645, -354 }, + { 8955, -3473, -308, -1947 }, + { 8676, -2683, -2099, 1485 }, + { 7481, -3003, -871, -444 }, + { 8015, -2839, -1673, 1175 }, + { 6947, -4643, -1527, -1047 }, + { 7622, -2575, -137, -960 }, + { 9388, -4279, -707, -1322 }, + { 8382, -5259, -1283, -565 }, + { 6856, -4138, -1030, 630 }, + { 8659, -2571, -1124, -1666 }, + { 8763, -3807, -537, 2543 }, + { 8049, -3578, -2186, -604 }, + { 8272, -2351, -1985, -1214 }, + { 6855, -3796, -1527, -1631 }, + { 7178, -2896, -1600, -1756 }, + { 7040, -2888, -89, -1586 }, + { 6261, -3403, -264, 998 }, + { 7756, -4699, -1543, -834 }, + { 7682, -4622, -758, -1721 }, + { 8839, -4232, -2932, 1959 }, + { 9363, -4679, -1956, 39 }, + { 7883, -3616, -1414, -1432 }, + { 8828, -3188, -1356, -1312 }, + { 7746, -3987, -121, -2424 }, + { 9262, -3256, -693, 818 }, + { 7670, -3420, -148, 3504 }, + { 7344, -3183, 608, 1595 }, + { 8976, -4139, -1848, 1304 }, + { 6708, -4131, 33, -852 }, + { 7840, -4429, -2275, 79 }, + { 8980, -3858, -2838, 453 }, + { 7815, -4604, -2563, 944 }, + { 8372, -4422, -1783, 3071 }, + { 8623, -5128, -1754, 2888 }, + { 7462, -3281, 889, 920 }, + { 8416, -59, -1320, -1825 }, + { 7928, -1488, -414, -2499 }, + { 8110, -977, -1047, -2042 }, + { 8278, -687, -1597, -1550 }, + { 7988, -174, -977, -2106 }, + { 8609, -1547, -1628, -1527 }, + { 9000, -1798, -946, -1761 }, + { 8954, -872, -1404, -1594 }, + { 8939, 466, -748, -1212 }, + { 9549, -329, -177, -1360 }, + { 9411, -18, -1126, -1568 }, + { 8859, -782, -488, -1338 }, + { 8955, -218, -43, -1209 }, + { 9131, -69, -453, -1001 }, + { 9069, -1519, -1091, -1199 }, + { 9247, -1309, -566, -1146 }, + { 8528, -1617, -287, -1313 }, + { 7763, -745, -149, -2040 }, + { 8294, -343, 257, -2633 }, + { 10149, -893, -552, -1649 }, + { 9398, -915, 218, -2042 }, + { 9703, -1194, -675, -1592 }, + { 9586, -700, -427, -1710 }, + { 8930, 497, -1445, -1218 }, + { 9285, -1323, -163, -1552 }, + { 8431, -1289, -985, -1404 }, + { 8965, -655, 653, -1483 }, + { 9542, -1001, -951, -1128 }, + { 9205, -647, -37, -882 }, + { 8603, -56, 514, -1793 }, + { 9300, -12, -1324, -567 }, + { 8773, 238, -184, -1456 }, + { 9941, -1306, -69, -1792 }, + { 9360, 279, -376, -1919 }, + { 9180, -285, 95, -2170 }, + { 9922, -501, -970, -1570 }, + { 8341, -1493, -856, -2092 }, + { 8780, -981, -850, -1014 }, + { 9721, -548, -1504, -1094 }, + { 9973, -1493, 482, -2105 }, + { 8707, -333, -1027, -1087 }, + { 9098, -469, -315, -1723 }, + { 8879, -1050, -661, -2020 }, + { 8857, 602, -866, -1918 }, + { 8945, -1025, -2154, -1071 }, + { 8484, -1930, -468, -2179 }, + { 9177, -1903, -224, -2112 }, + { 8652, -137, -2097, -1214 }, + { 9063, -973, -1405, -772 }, + { 9328, -456, 662, -2469 }, + { 10101, -697, 127, -2113 }, + { 9685, 811, -2359, -1024 }, + { 8586, -94, -460, -1982 }, + { 7924, -141, -509, -2513 }, + { 7773, -669, -107, -2835 }, + { 8636, -1064, -46, -2409 }, + { 9748, 596, -1815, -1349 }, + { 8924, 304, 547, -2614 }, + { 9442, 746, -1153, -1679 }, + { 9454, -278, -529, -1976 }, + { 8488, 561, -32, -2160 }, + { 10083, -63, -1544, -1364 }, + { 9390, -1278, 568, -1131 }, + { 9740, -49, -2253, -910 }, + { 3636, -2391, -1115, -3614 }, + { 6014, -3204, -1902, -1808 }, + { 5787, -3497, -1116, -2590 }, + { 4365, -3046, -1632, -2668 }, + { 4733, -2192, -2029, -2468 }, + { 5412, -2753, -1633, -2464 }, + { 4455, -3375, -767, -3399 }, + { 4456, -1644, -983, -2841 }, + { 4039, -2523, 38, -3967 }, + { 3406, -2662, 72, -4757 }, + { 4279, -2005, 1055, -4399 }, + { 4321, -1377, -860, -3786 }, + { 3743, -5739, -651, -3047 }, + { 3528, -5510, 361, -4060 }, + { 6496, -4886, -136, -2689 }, + { 4513, -5254, 551, -4010 }, + { 6557, -3413, -92, -3063 }, + { 4186, -2059, 187, 47 }, + { 6210, -4117, -1256, -1985 }, + { 6038, -4343, 351, -2124 }, + { 4305, -4780, -2077, -1897 }, + { 4480, -3815, -2228, -1533 }, + { 5582, -3689, 1221, -3429 }, + { 5532, -4874, 1195, -2765 }, + { 6518, -2853, -905, -2568 }, + { 5467, -2192, 470, -4115 }, + { 4139, -1577, 240, -3493 }, + { 5281, -1926, -729, -3340 }, + { 5214, -2870, 1359, -4289 }, + { 3046, -3510, -1536, -3214 }, + { 5433, -2881, -1230, -1184 }, + { 4861, -3932, -1071, -2791 }, + { 5693, -4234, -1906, -1502 }, + { 4004, -3935, -1804, -2383 }, + { 3728, -3792, 681, -4773 }, + { 3621, -3030, -1951, -2598 }, + { 5133, -3903, 44, -3700 }, + { 3561, -3451, 1183, -5301 }, + { 5026, -2762, -2341, -1780 }, + { 5841, -2492, -467, -3210 }, + { 5591, -1791, 497, -2472 }, + { 5054, -3898, -1822, -2097 }, + { 5813, -2792, 83, -1469 }, + { 4432, -4497, 1670, -5193 }, + { 5338, -4653, -1109, -2200 }, + { 3239, -4401, -648, -3655 }, + { 2147, -3598, -1200, -4242 }, + { 4417, -2271, -1552, -3210 }, + { 6494, -4360, 852, -3565 }, + { 2393, -6358, -856, -4524 }, + { 4959, -4196, -847, -1403 }, + { 4924, -5438, -226, -3026 }, + { 4254, -5303, -1306, -2424 }, + { 4121, -3126, -2334, -1981 }, + { 3437, -4443, -1464, -2953 }, + { 3203, -3459, -529, -4339 }, + { 5896, -5945, 543, -3246 }, + { 1987, -4733, -220, -4863 }, + { 4358, -4431, -514, -3081 }, + { 4583, -2416, -492, -2287 }, + { 2943, -5035, 419, -4927 }, + { 5358, -5129, 987, -4309 }, + { 4460, -3392, 1752, -5634 }, + { 3415, -4633, 1507, -5945 }, + { 811, -4692, -445, 2333 }, + { 1009, -5613, -1857, 1360 }, + { 1338, -2712, -2720, 3036 }, + { 1002, -3754, -2582, 2344 }, + { 750, -4608, -2334, 714 }, + { 2043, -3207, -2822, 2173 }, + { -140, -4654, -2953, 357 }, + { -54, -4026, -2376, 2695 }, + { 1858, -5022, -717, 2287 }, + { 2064, -3894, -722, 3255 }, + { 2727, -4558, -332, 2603 }, + { 1810, -5378, 283, 1826 }, + { 3935, -4326, 762, 3383 }, + { -767, -4697, -2510, 1922 }, + { 2146, -4312, -3090, 1641 }, + { 54, -5881, -2114, 921 }, + { 1992, -5766, -640, 1574 }, + { 1200, -5371, -1114, 1828 }, + { 2973, -5337, 34, 2266 }, + { 1531, -5018, -2817, 1192 }, + { 3078, -4570, 117, 1990 }, + { 924, -4286, -1388, 2713 }, + { 142, -5058, -2848, 1487 }, + { -106, -6180, -881, 842 }, + { 673, -5433, -229, 1596 }, + { 783, -5710, -2784, 562 }, + { 1935, -5729, -2009, 856 }, + { -410, -3375, -3326, 2734 }, + { 234, -3000, -2628, 3260 }, + { 733, -3405, -3806, 1589 }, + { 771, -4285, -3544, 1314 }, + { 1192, -3563, -3960, 2178 }, + { 206, -5555, -1250, 1546 }, + { -130, -3815, -1210, 3041 }, + { 646, -3940, -393, 2992 }, + { -184, -4931, -1767, 1925 }, + { 2746, -5120, -2275, 1464 }, + { 2440, -3731, -3352, 2729 }, + { -490, -4942, -3779, 997 }, + { 68, -2636, -4167, 3778 }, + { 48, -3986, -4118, 2106 }, + { -978, -5486, -1336, 1390 }, + { 1126, -5297, -855, 640 }, + { -472, -3975, -3622, 1557 }, + { 2456, -5344, -1523, 1648 }, + { -774, -5652, -2417, 1147 }, + { 995, -6122, -812, 1132 }, + { 3282, -4571, -1763, 2175 }, + { 3655, -3862, -676, 3568 }, + { 3038, -3647, -1672, 3381 }, + { 2595, -2964, -2772, 3263 }, + { 4176, -3353, -1148, 4354 }, + { 1603, -3442, -1500, 3444 }, + { 828, -6226, -1783, 678 }, + { 1421, -3333, -3080, 3403 }, + { 1121, -4727, -1924, 1984 }, + { -186, -5083, -682, 1796 }, + { 819, -2778, -3488, 530 }, + { 421, -2873, -3832, 2596 }, + { 2164, -4263, -1605, 2282 }, + { 585, -4437, -682, -491 }, + { -644, -4452, -1157, 2325 }, + { 1991, -4299, 210, 2834 }, + { 2135, -3632, -2113, 665 }, + { -7482, -2724, -2662, -1380 }, + { -6983, -2166, -3756, -3509 }, + { -7085, -1439, -2397, -3112 }, + { -7760, -3049, -3319, -2822 }, + { -8413, -2760, -4406, -3298 }, + { -5995, -3943, -1260, -3750 }, + { -7879, -1554, -3464, -2606 }, + { -6314, -2034, -3878, -1681 }, + { -8849, -2084, -1399, -1231 }, + { -7153, -2602, -1384, -817 }, + { -8041, -2571, -407, -2785 }, + { -7246, -2233, -1578, 260 }, + { -7336, -3883, -4061, -1342 }, + { -7619, -3908, -2342, 382 }, + { -8684, -3724, -1662, -727 }, + { -7850, -2922, -1770, -3449 }, + { -6766, -2034, -1293, -1988 }, + { -6895, -2116, -968, -3744 }, + { -7136, -5147, -2618, -2809 }, + { -8224, -3724, -2519, -1589 }, + { -6711, -2750, -3021, -219 }, + { -8059, -1638, -1102, -3175 }, + { -8710, -4839, -3963, -3143 }, + { -9363, -4965, -3257, -1002 }, + { -6099, -1751, -3157, -395 }, + { -6453, -3216, -4597, -483 }, + { -7879, -5477, -839, -2638 }, + { -7202, -4038, -526, -2856 }, + { -8022, -1228, -1910, -1646 }, + { -9117, -1393, -1582, -2535 }, + { -9095, -2693, -636, -2605 }, + { -9076, -2580, -3481, -2519 }, + { -8327, -4859, -2422, 83 }, + { -8368, -2129, -2324, -2173 }, + { -8554, -4563, -3842, -2007 }, + { -10462, -4261, -1934, -2084 }, + { -9717, -3187, -2294, -1896 }, + { -9625, -3889, -3020, -3224 }, + { -9857, -4955, -4239, -2184 }, + { -9752, -2351, -2277, -3129 }, + { -7219, -1302, -2639, -1603 }, + { -7477, -4360, -3718, -559 }, + { -5680, -2033, -2326, -3078 }, + { -10190, -5548, -4643, -3601 }, + { -9431, -4121, -879, -2479 }, + { -8365, -5450, -2020, -1439 }, + { -6289, -5178, -1605, -3845 }, + { -8319, -3866, -687, -2792 }, + { -8131, -1031, -3608, -3947 }, + { -10510, -2560, -1199, -2082 }, + { -11015, -3640, -2748, -3041 }, + { -8762, -5022, -5231, -1162 }, + { -10153, -2715, -4648, -4859 }, + { -7930, -5205, -1900, -3600 }, + { -9561, -3548, -4812, -3722 }, + { -7663, -4709, -1180, -1475 }, + { -9073, -5707, -1815, -2980 }, + { -8602, -2363, -2675, -3770 }, + { -9967, -5614, -3575, -3838 }, + { -8324, -1005, -2131, -3254 }, + { -10331, -5737, -2550, -2940 }, + { -8234, -3354, -3361, -4479 }, + { -8140, -1951, -4526, -4545 }, + { -6679, -2662, -2284, -4182 }, + { -1122, -1514, -6427, -212 }, + { 54, -1660, -5424, -1404 }, + { 254, -2778, -5222, 846 }, + { -267, -1661, -6577, 814 }, + { -305, -2021, -5759, 1484 }, + { -1791, -2446, -6867, -86 }, + { -2929, -3158, -6603, -1799 }, + { -1391, -3189, -5557, -1053 }, + { -1602, -884, -6767, -1213 }, + { -361, -318, -6219, -44 }, + { -4078, -2635, -5523, -433 }, + { -956, 478, -4382, 1470 }, + { -3300, -2462, -6021, -2721 }, + { 708, -2434, -5085, -540 }, + { -2435, -3607, -5647, -2110 }, + { -491, -1134, -4681, -2886 }, + { 87, -3435, -4641, -1194 }, + { -586, -2927, -4784, 366 }, + { -1394, -2326, -6021, 350 }, + { 97, -2519, -4678, -2120 }, + { -1547, -1907, -5069, -2993 }, + { 268, -3724, -4719, 127 }, + { -827, -1190, -5912, 1144 }, + { -3959, -2322, -6898, -1974 }, + { -2728, -2228, -6426, -562 }, + { -456, -666, -5785, -1609 }, + { 531, -1096, -5731, -656 }, + { -3569, -688, -3915, 110 }, + { -4752, -1725, -4393, -377 }, + { -3210, -3315, -6960, -840 }, + { -688, -3416, -4971, 1221 }, + { -1833, 77, -6491, -2434 }, + { -239, -255, -6850, -886 }, + { -2112, -1490, -6291, -2689 }, + { -1544, -4579, -5198, -1261 }, + { -2771, -4014, -5520, 683 }, + { -1635, -2829, -5512, 1214 }, + { -958, -2582, -4823, 2360 }, + { -2077, -4566, -4642, 365 }, + { -3112, -4214, -5960, -823 }, + { -2467, -2510, -4858, 1467 }, + { -1561, -3399, -5822, 211 }, + { -775, -1081, -4424, 2636 }, + { -1263, 25, -6378, -1392 }, + { -3476, -366, -5417, -1393 }, + { -3176, -1476, -4149, 1466 }, + { -2479, 518, -4448, -257 }, + { -2992, 158, -4660, -1279 }, + { -1320, -3872, -4479, 1147 }, + { -1475, -312, -5318, 539 }, + { -3527, -1679, -5860, -1681 }, + { -3397, -3438, -5593, 1866 }, + { -4089, -2439, -4763, 1275 }, + { -748, -4513, -4687, -48 }, + { -2166, -4531, -4691, -2856 }, + { -2385, -853, -6035, -627 }, + { -1194, -4091, -4472, -1963 }, + { -682, -3234, -4084, -3033 }, + { -3255, -5015, -5328, -12 }, + { -2313, -3436, -4601, -155 }, + { -2792, -1038, -6947, -2019 }, + { -1244, -1526, -5771, -1882 }, + { -4679, -3731, -5506, 283 }, + { -3062, -66, -3558, -758 }, + { -4895, -1187, 4751, 3728 }, + { -7600, -2752, 3320, 4613 }, + { -5703, -2975, 3944, 2659 }, + { -4972, -1257, -246, 2952 }, + { -4221, -2487, 1702, 4295 }, + { -2900, -1529, 2458, 4935 }, + { -5061, 407, 2416, 4050 }, + { -6931, -3478, 2761, 2213 }, + { -6037, -3921, 3192, 1866 }, + { -6113, -811, 2407, 3782 }, + { -5878, -1716, 1207, 3478 }, + { -5953, -2853, 2207, 2712 }, + { -6807, -3223, 2749, 3595 }, + { -3272, -3157, 1389, 3788 }, + { -5368, -1904, 1980, 5077 }, + { -7235, -1398, 3075, 4548 }, + { -4765, -3487, 2755, 2796 }, + { -7658, -4435, 2694, 2582 }, + { -6997, -4282, 456, 3832 }, + { -5563, -3115, -63, 3713 }, + { -4244, -4220, 1450, 2767 }, + { -3801, -2194, 190, 4303 }, + { -5458, -4119, 1958, 2274 }, + { -7300, -3469, 3514, 3193 }, + { -4594, -2067, 775, 4752 }, + { -3389, -1654, 1464, 5412 }, + { -4845, -3483, 964, 3437 }, + { -6007, -2818, 1666, 4659 }, + { -8709, -5007, 1757, 3287 }, + { -5833, -4389, 1025, 3171 }, + { -5788, -1780, 3944, 3661 }, + { -4430, -920, 1938, 4753 }, + { -7066, -1857, 4591, 4538 }, + { -3549, -513, 1427, 5317 }, + { -7517, -1220, 2883, 3049 }, + { -7605, -2687, 1874, 2735 }, + { -8718, -4035, 2676, 3730 }, + { -7990, -3907, 1185, 2607 }, + { -6058, -1744, 3349, 5157 }, + { -5954, 565, 3161, 3250 }, + { -6478, -612, 1930, 2271 }, + { -6535, -1445, -2, 1618 }, + { -8963, -4151, 1192, 4044 }, + { -7227, -3570, 1600, 4234 }, + { -4674, 79, 595, 3015 }, + { -3974, 430, 2727, 5137 }, + { -5299, 9, 3714, 4779 }, + { -6779, -2699, -8, 2436 }, + { -7016, -1145, 1293, 2310 }, + { -6955, -3312, 1534, 1801 }, + { -4025, 740, 1850, 4054 }, + { -9589, -3460, 4154, 5270 }, + { -4404, -1181, 4298, 5173 }, + { -7356, -4583, -18, 2644 }, + { -6516, -1235, 4439, 6234 }, + { -3453, -301, 4344, 4464 }, + { -4643, 1530, 3315, 4340 }, + { -4575, -2557, 3754, 3682 }, + { -3643, -3501, 2051, 2997 }, + { -5412, -2475, 2301, 1579 }, + { -5846, 259, 1360, 2348 }, + { -5258, -1358, 1050, 838 }, + { -5542, -219, 6377, 5750 }, + { -5713, -2952, 922, 899 }, + { -2049, -1135, 5206, 1033 }, + { -1693, -1886, 4835, -106 }, + { -2344, -3504, 4232, -13 }, + { -2475, -2334, 5043, 1126 }, + { -787, -2549, 3880, 2138 }, + { -3159, -2341, 4830, 2887 }, + { -1780, -1009, 6240, 2061 }, + { -4327, -3363, 2818, 886 }, + { -3376, -2743, 4104, 207 }, + { -3250, -4640, 2718, 1498 }, + { -382, -1075, 4382, 3460 }, + { -2416, -4168, 3530, 816 }, + { -1756, -2708, 4861, 622 }, + { -1879, -2097, 5156, 2889 }, + { -2496, -2418, 3722, 2671 }, + { -2717, -3252, 3341, 1944 }, + { -4063, -4091, 3306, 267 }, + { -3549, -3808, 3747, 842 }, + { -2635, 546, 5794, 1894 }, + { -1857, -1121, 4383, 3964 }, + { -2226, -2166, 3489, 3678 }, + { -3492, -660, 5323, 1063 }, + { -3033, -3130, 4382, 1828 }, + { -2703, -625, 6369, 2851 }, + { -1656, -2842, 4584, -528 }, + { -4781, -2622, 4390, 2097 }, + { -413, -2045, 5081, 3035 }, + { -3810, -2662, 4532, 1095 }, + { -3144, -1858, 5215, 1880 }, + { -3562, -1795, 4928, 670 }, + { -4800, -1509, 5189, 1859 }, + { -1085, -3832, 4169, 900 }, + { -1969, -3270, 2857, 2878 }, + { -4267, -4140, 3176, 1805 }, + { -5145, -3727, 3524, 1168 }, + { -1346, -1876, 5501, 1748 }, + { -4998, -2945, 3699, 338 }, + { -3458, -3096, 3406, -635 }, + { -1751, -3209, 3508, 395 }, + { -2507, 170, 5987, 705 }, + { -3756, -1072, 5647, 3536 }, + { -2870, -1439, 5026, 3212 }, + { -3913, -3225, 3669, 2144 }, + { -3739, 226, 5747, 764 }, + { -2052, -820, 5266, 3093 }, + { -3214, -3820, 2409, 2391 }, + { -4398, -2588, 3501, -218 }, + { -4484, -1763, 4180, -198 }, + { -3368, -1525, 4362, -134 }, + { -2407, 224, 4905, 3533 }, + { -1369, -2937, 4728, 1788 }, + { -4848, -1707, 4159, 851 }, + { -3454, -1749, 4281, 3230 }, + { -1990, -3853, 3487, 1735 }, + { -3117, 92, 6155, 4075 }, + { -2676, -2472, 4078, -589 }, + { -1547, -2012, 2626, 1835 }, + { -4275, -588, 4824, 725 }, + { -601, -2249, 3736, 3548 }, + { -4060, -61, 5333, 3097 }, + { -4303, 7, 6551, 3054 }, + { -5003, -1029, 5786, 3319 }, + { -2810, -728, 5392, 199 }, + { -1232, -200, 5228, 3121 }, + { 2621, 165, -6255, 298 }, + { 3669, 537, -6844, 1564 }, + { 1598, -1190, -6235, 2523 }, + { 2164, -32, -6894, 1383 }, + { 853, -1597, -6069, 1449 }, + { 1377, -1661, -5266, 108 }, + { 2660, 48, -5172, -517 }, + { 1903, -391, -5677, 1010 }, + { 3792, 206, -5274, -11 }, + { 1239, 2776, -2929, 2721 }, + { 4071, 149, -7259, 3125 }, + { 1436, -480, -6156, -196 }, + { 1373, -1960, -5005, 3122 }, + { 3413, -1271, -5176, 3283 }, + { 3060, -68, -6495, 2238 }, + { 2700, -2075, -4681, 91 }, + { 2928, -1728, -5168, 1858 }, + { 4424, 828, -4471, 88 }, + { 2672, -2604, -4038, 2753 }, + { 5223, -123, -6749, 2295 }, + { 4237, -420, -5538, 1353 }, + { 4744, -1281, -4097, 4708 }, + { 1103, -2764, -4751, 2024 }, + { 3747, -1913, -3911, 3960 }, + { 2470, -1416, -5542, 615 }, + { 4847, -1354, -5334, 1733 }, + { 5336, 88, -7593, 4007 }, + { 2388, -2880, -4807, 1037 }, + { 4495, 1391, -5685, -139 }, + { 5253, 1637, -6450, 1533 }, + { 1199, 795, -5515, 1261 }, + { 1397, -1259, -4252, 3838 }, + { 746, 70, -6640, 604 }, + { 1584, 166, -4972, 3072 }, + { 380, -999, -5397, 2267 }, + { 2974, 1707, -3242, 5360 }, + { 5202, -403, -5453, 2832 }, + { 3718, -1731, -4760, 714 }, + { 4150, -975, -4792, 61 }, + { 2925, -818, -4841, 15 }, + { 5301, 577, -4006, 3259 }, + { 5265, 1986, -5679, 3028 }, + { 3752, 1928, -4509, 3729 }, + { 3278, 1925, -6370, 1247 }, + { 5107, 1721, -4853, 3127 }, + { 3279, 2982, -2515, 4005 }, + { 4622, 668, -6204, 759 }, + { 6034, 317, -5763, 4818 }, + { -558, 57, -3785, 2817 }, + { 4476, 1616, -3965, 4536 }, + { 5953, 2056, -8215, 2715 }, + { 4387, 2613, -7463, 868 }, + { 5834, 1088, -4736, 4924 }, + { 6473, -856, -6991, 4172 }, + { 4959, -293, -5162, 76 }, + { 2731, -843, -6119, 3847 }, + { 3245, 1202, -6833, 616 }, + { 2553, 1383, -3829, 3859 }, + { 4332, 2099, -3480, 3622 }, + { 2110, 2683, -2728, 3990 }, + { 876, 1167, -3290, 3466 }, + { 3991, 1709, -2410, 4077 }, + { 5105, 939, -2584, 3256 }, + { 4719, 688, -1566, 3040 }, + { -3632, 4335, 1266, -3303 }, + { -4956, 3207, 1312, -2806 }, + { -4669, 2627, 2663, -2435 }, + { -4282, 3708, 2303, -3038 }, + { -4536, 2297, -175, -3350 }, + { -5234, 2503, -139, -880 }, + { -3978, 1512, 1092, -3619 }, + { -4519, 4649, 1363, -2455 }, + { -5118, 3132, 1961, -1577 }, + { -5196, 3379, -182, -1378 }, + { -6420, 4486, 2397, -1993 }, + { -5030, 5046, 1292, -1118 }, + { -4559, 2573, -927, -1406 }, + { -3501, 3730, 691, -4930 }, + { -4364, 2758, 1007, -3909 }, + { -4026, 2839, -1559, -2340 }, + { -5037, 4053, 836, -1571 }, + { -4727, 5136, 1110, -3588 }, + { -5245, 2799, -999, -2164 }, + { -4954, 1501, 422, -3963 }, + { -5994, 2726, 1462, -2833 }, + { -5621, 5159, 2038, -2512 }, + { -4991, 2291, 1917, -3151 }, + { -5469, 4382, -148, -2978 }, + { -5858, 1983, 807, -2720 }, + { -4709, 3556, 952, -467 }, + { -2489, 2362, 1714, -4230 }, + { -4717, 5004, -1180, -3672 }, + { -5914, 3653, 1359, -1317 }, + { -5506, 2995, 780, -1059 }, + { -5287, 3945, 2480, -2293 }, + { -3849, 4358, 322, -1770 }, + { -3911, 3570, 252, -3185 }, + { -3660, 5128, 158, -3719 }, + { -4599, 3277, -503, -2727 }, + { -3673, 3760, -1252, -3339 }, + { -5161, 2337, 388, -1943 }, + { -3529, 2216, 2156, -3080 }, + { -4309, 4331, 1808, -1460 }, + { -4782, 3820, 480, -2504 }, + { -4166, 3544, -378, -1567 }, + { -5572, 2466, -418, -2909 }, + { -6096, 2930, 119, -1878 }, + { -5963, 3554, 1011, -2233 }, + { -6433, 4335, 935, -2930 }, + { -5004, 3314, -1352, -3430 }, + { -6042, 3463, -1008, -3940 }, + { -4671, 2214, -640, -5040 }, + { -2795, 3759, 1412, -3803 }, + { -3647, 4436, 729, -515 }, + { -3594, 1033, 56, -4148 }, + { -2908, 3027, 2889, -3485 }, + { -3338, 2234, 313, -4285 }, + { -3825, 4497, -561, -2634 }, + { -6167, 3012, -48, -3149 }, + { -4828, 3515, -969, -4475 }, + { -5789, 2757, -539, -4173 }, + { -2452, 3067, 564, -4249 }, + { -4921, 1358, 1331, -2889 }, + { -3127, 4239, -1045, -1523 }, + { -4780, 2326, -1118, -3446 }, + { -3908, 5546, 152, -2622 }, + { -6972, 2976, 337, -2809 }, + { -4839, 4613, -35, -4077 }, + { -1408, 4822, -1149, -4997 }, + { -981, 4979, -912, -6304 }, + { -2098, 5689, -888, -2878 }, + { -3343, 4814, -657, -4434 }, + { -2461, 3601, -967, -4869 }, + { -2652, 3944, 87, -5520 }, + { -1104, 6076, 174, -6407 }, + { 355, 5370, -1721, -5869 }, + { 1242, 4497, -1107, -5091 }, + { -89, 4002, -1491, -5182 }, + { 1059, 5693, -1591, -4905 }, + { 1323, 4682, -2078, -4768 }, + { 818, 3996, -549, -5468 }, + { -287, 4529, 929, -5543 }, + { -919, 5519, -2791, -2844 }, + { -1407, 5679, -3289, -3974 }, + { -189, 6530, -3547, -4002 }, + { -900, 7039, -3371, -4855 }, + { -2983, 7211, -363, -4835 }, + { -814, 6503, -104, -5106 }, + { -2386, 6896, 809, -4919 }, + { 845, 4492, 352, -6621 }, + { -1998, 7237, -1646, -4231 }, + { -3380, 6251, 471, -4577 }, + { -1908, 7059, 84, -5726 }, + { -340, 6346, -803, -6265 }, + { -2279, 5834, -47, -4633 }, + { -1532, 5286, -1748, -1901 }, + { -2757, 6188, -453, -3415 }, + { -1255, 6405, -2043, -6357 }, + { 918, 5581, -121, -5667 }, + { 1840, 5336, -821, -5034 }, + { -2475, 4992, -1825, -3104 }, + { -2413, 5606, -1789, -4298 }, + { 132, 5128, -2389, -4442 }, + { 223, 6400, -2653, -4742 }, + { -673, 5012, 680, -4582 }, + { -1657, 6624, -349, -3596 }, + { -755, 6289, -1860, -3978 }, + { -572, 6894, -1946, -5207 }, + { -1141, 4756, -2665, -5586 }, + { -1073, 4269, -431, -4030 }, + { 186, 5761, 916, -5868 }, + { -1907, 4836, 1017, -5106 }, + { -963, 3363, -1248, -6348 }, + { -3262, 4774, -1818, -5858 }, + { 847, 3812, -2538, -4302 }, + { -1223, 5903, 1360, -5479 }, + { -1094, 6923, -1244, -2381 }, + { 267, 6276, -709, -2846 }, + { -157, 5840, 1124, -4266 }, + { 889, 3206, -910, -5305 }, + { -1736, 3344, 582, -4838 }, + { -2357, 5676, -2695, -6277 }, + { -1916, 6901, -986, -5397 }, + { -3062, 6028, -695, -5687 }, + { 1836, 3566, -1357, -5226 }, + { -2176, 4938, 646, -3872 }, + { -2199, 3055, -208, -6124 }, + { -236, 3032, -821, -5325 }, + { -3989, 7277, -565, -3899 }, + { -595, 4362, 74, -5975 }, + { 684, 5874, -841, -4424 }, + { -2731, 6305, -2389, -5465 }, + { -5775, 1325, -56, -2528 }, + { -7029, -534, -1890, -3278 }, + { -5798, -15, -2734, -2210 }, + { -5504, -1198, -353, -3659 }, + { -5079, 960, -894, -4336 }, + { -6073, -36, -133, -3014 }, + { -5782, -259, -1025, -3986 }, + { -6843, 1262, -807, -1639 }, + { -5263, -918, -3290, -579 }, + { -4840, 461, -2158, -533 }, + { -6014, -50, -620, 504 }, + { -5843, 241, -1359, -282 }, + { -5898, 577, 769, -3271 }, + { -6833, -946, -466, -3347 }, + { -6026, 1459, -512, -729 }, + { -7361, 747, -388, -1110 }, + { -6391, 2142, -1160, -2513 }, + { -6995, 304, 498, -2673 }, + { -6757, 679, -386, -433 }, + { -5222, 1688, -1093, -1032 }, + { -5019, 575, 184, -3627 }, + { -4237, 628, -3507, -1243 }, + { -7479, -456, -1722, -1486 }, + { -6464, 713, -1273, -1153 }, + { -6255, 1682, -606, -3607 }, + { -7033, 1497, -71, -1955 }, + { -6694, 1556, -1721, -3214 }, + { -6114, -356, 813, -2575 }, + { -5308, 632, -1851, -1636 }, + { -5742, -911, -1733, 383 }, + { -6083, -387, -2313, -879 }, + { -6535, -530, -1505, -2083 }, + { -4896, 1223, -2750, -1816 }, + { -6392, -463, -3247, -2093 }, + { -5373, 1264, -2706, -3042 }, + { -3894, -1390, -1020, -891 }, + { -6179, 1168, -1966, -1922 }, + { -5162, 1668, -1617, -1916 }, + { -6453, 920, -1169, -2432 }, + { -6130, 2005, -536, -1519 }, + { -6552, -98, -518, -1938 }, + { -7528, 355, -1101, -1772 }, + { -5745, 610, -247, -1360 }, + { -7003, 177, -2064, -1958 }, + { -6956, -570, -2220, -4225 }, + { -7830, 791, -1394, -2774 }, + { -7634, 480, -3171, -4224 }, + { -7913, 1154, -350, -2381 }, + { -5063, 1704, -1804, -2977 }, + { -4887, -524, -2703, 188 }, + { -5551, 406, -1620, -3063 }, + { -7109, 1342, 381, -3021 }, + { -6846, 631, -458, -3398 }, + { -4606, -605, 11, -3930 }, + { -8134, -225, -1738, -2648 }, + { -7043, 402, -2734, -3059 }, + { -7417, 1825, -2545, -4389 }, + { -6971, -236, -1031, -665 }, + { -5752, 2111, -1632, -3808 }, + { -7660, -78, -624, -3135 }, + { -6358, 619, -1951, -3911 }, + { -8134, 408, -1935, -3695 }, + { -6335, 1911, -2368, -4505 }, + { -7116, 2163, -344, -2753 }, + { 2357, 4488, 2220, -5682 }, + { 1385, 3206, 2300, -5305 }, + { 1419, 2557, 5203, -3516 }, + { 262, 4315, 3920, -1847 }, + { 3316, 3187, 1612, -5609 }, + { 1729, 2350, 1673, -6068 }, + { 1603, 6126, 1467, -2839 }, + { -1339, 3316, 3691, -3530 }, + { -563, 4618, 3180, -4548 }, + { 463, 4624, 3111, -5614 }, + { 1246, 5455, 3356, -5720 }, + { 480, 2149, 5422, -2893 }, + { 1768, 4827, 913, -5579 }, + { -149, 5381, 4366, -3297 }, + { 985, 3672, 2644, -92 }, + { -258, 2911, 5817, -2213 }, + { 3428, 3289, 3351, -3541 }, + { -666, 3295, 4727, -2869 }, + { 35, 6641, 4160, -4052 }, + { 623, 6787, 3156, -4560 }, + { 2654, 4360, 4676, -4632 }, + { 1386, 5246, 4834, -4497 }, + { 3488, 4574, 3856, -5946 }, + { 383, 4481, 4168, -4110 }, + { 1753, 3652, 4288, -3326 }, + { 1344, 4905, 2508, -4660 }, + { 1580, 4106, 3104, -2224 }, + { 2027, 5038, 1683, -1554 }, + { 446, 3699, 5872, -3013 }, + { 4637, 4087, 3578, -5018 }, + { 2629, 3560, 5331, -4900 }, + { 1527, 6674, 2523, -4131 }, + { -1437, 2804, 2528, -4464 }, + { -229, 3355, 2016, -5537 }, + { 3666, 3418, 4374, -4581 }, + { 1192, 3799, 923, -6596 }, + { 2040, 2956, 448, -5322 }, + { 2468, 5768, 4029, -5869 }, + { 3438, 6516, 3529, -6667 }, + { 2737, 5495, 680, -5535 }, + { 3896, 5727, 1801, -4958 }, + { 4988, 4957, 3592, -6518 }, + { -542, 4416, 5794, -2787 }, + { 4136, 4354, 2064, -4696 }, + { 3067, 5936, 1207, -3396 }, + { 2789, 4966, 2405, -3854 }, + { 1731, 3270, 3251, -1063 }, + { 1767, 5537, 2084, -2349 }, + { 465, 3116, 4532, -837 }, + { 1499, 2627, 4610, -2212 }, + { 122, 3095, 3642, -3552 }, + { 2542, 2866, 2705, -6402 }, + { 3134, 4323, 698, -4785 }, + { 731, 1859, 3112, -5242 }, + { 2553, 2980, 3241, -4846 }, + { 1329, 5310, 1607, -6624 }, + { 2468, 1858, 3476, -1034 }, + { -172, 4996, 2000, -5562 }, + { 2621, 4220, 1574, -3386 }, + { -333, 1832, 3362, -4117 }, + { 2169, 6762, 3065, -6225 }, + { 2844, 5528, 3223, -4765 }, + { 526, 5175, 1644, -4267 }, + { 2922, 4426, 2414, -2610 }, + { 452, 1399, -4516, -2636 }, + { 2872, 1720, -4667, -1435 }, + { 1279, 702, -5424, -1984 }, + { 2187, 870, -5021, -1341 }, + { 583, -144, -4628, -2464 }, + { 3, 2237, -5284, -2827 }, + { -19, 1005, -5460, -1819 }, + { 2897, 2084, -5885, -515 }, + { -400, 3370, -5527, -2947 }, + { 1505, 2593, -5518, -1802 }, + { 1341, 4534, -5094, -1899 }, + { 3241, 3670, -5493, -1252 }, + { -1287, 921, -5994, -1675 }, + { 627, 408, -6652, -364 }, + { -260, 1127, -4849, -3247 }, + { 371, 3400, -5976, -2285 }, + { 1533, 1566, -6373, -610 }, + { 2462, 4274, -6184, -1254 }, + { 1782, 3363, -6222, -1381 }, + { 572, 4650, -5673, -2754 }, + { 2674, 3414, -4460, -2154 }, + { 3614, 3820, -6883, -398 }, + { 1136, -1, -5511, -1112 }, + { -1773, 1137, -5647, -2377 }, + { -753, 2104, -6085, -2565 }, + { -204, 3025, -4731, -1418 }, + { -1486, 1438, -4380, -216 }, + { 302, 858, -5786, -264 }, + { 3486, 1495, -5234, -783 }, + { 888, 2327, -3423, -3720 }, + { -259, 772, -6596, -1311 }, + { -1197, 2073, -5174, -1826 }, + { 1500, 3470, -4462, -2645 }, + { 3072, 1960, -3277, -2264 }, + { 1841, 952, -4324, -2340 }, + { 1994, 2200, -3940, -2923 }, + { -1782, 1699, -4667, -1075 }, + { -1464, 2906, -3468, -375 }, + { 366, 2380, -3747, 1467 }, + { -545, 1645, -4619, 376 }, + { 1724, 2350, -2374, -3512 }, + { 3184, 2628, -2996, -3275 }, + { 734, 2010, -6239, -1479 }, + { 524, 3756, -4496, -3263 }, + { 1492, 3570, -3494, -3600 }, + { -932, 618, -5389, -2894 }, + { -133, 2161, -4083, -3267 }, + { 786, 774, -3279, -3731 }, + { 1078, 803, -3843, -3007 }, + { -332, 3405, -3347, 40 }, + { -17, 6, -4005, -3690 }, + { -189, 4372, -4488, -2561 }, + { -450, 3846, -3790, -1370 }, + { 362, 2212, -5272, -15 }, + { -1529, 791, -6802, -2296 }, + { 2145, 4241, -4474, 376 }, + { 1813, 2426, -2932, -2726 }, + { -542, 4557, -3140, -1080 }, + { 1192, 3784, -4371, -20 }, + { 2784, 5188, -6399, -1394 }, + { 431, 4561, -3673, -1398 }, + { 1382, 3096, -4083, 1253 }, + { 1209, 4224, -2930, 1500 }, + { 2798, 2684, -6676, -606 }, + { -2396, 1510, -5381, -2713 }, + { -2625, 2542, -4032, -2880 }, + { -1231, 3967, -4098, -2886 }, + { -1393, 2374, -3862, -4525 }, + { -2495, 1665, -1637, -5445 }, + { -3854, 1759, -1750, -4944 }, + { -2373, 1668, -2856, -6251 }, + { -2668, 1981, -886, -4557 }, + { -2927, 4427, -3451, -6172 }, + { -1925, 2596, -4696, -2527 }, + { -3202, 2847, -3928, -5896 }, + { -3332, 1665, -5025, -3412 }, + { -3212, 3115, -4155, -4062 }, + { -1013, 3205, -5133, -3751 }, + { -2022, 4595, -3947, -5611 }, + { -3556, 1755, -3715, -2300 }, + { -1784, 4114, -2723, -1773 }, + { -3586, 4081, -2733, -4942 }, + { -1608, 3685, -4154, -4573 }, + { -3368, 4042, -4452, -6227 }, + { -1407, 3881, -5729, -3719 }, + { -2751, 3281, -5077, -4999 }, + { -3791, 2410, -4906, -5288 }, + { -730, 2303, -4217, -3755 }, + { -1812, 2311, -5492, -3709 }, + { -610, 4336, -3915, -3783 }, + { -2841, 4337, -4278, -4430 }, + { -1662, 4666, -4661, -3964 }, + { -589, 5209, -4923, -3682 }, + { -4155, 2234, -4076, -4218 }, + { -3951, 2770, -2665, -2805 }, + { -2302, 3228, -3717, -1908 }, + { -3129, 4373, -2264, -2851 }, + { -447, 1363, -3578, -4323 }, + { -2648, 4237, -3159, -3071 }, + { -4072, 3241, -3541, -4605 }, + { -4507, 3458, -2339, -3838 }, + { -1646, 997, -4926, -3970 }, + { -3025, 1614, -3940, -1242 }, + { -1337, 1756, -3163, -5529 }, + { -3203, 1865, -3282, -4354 }, + { -1646, 2118, -2203, -6018 }, + { 174, 1871, -2707, -4639 }, + { -2607, 1485, -4778, -4750 }, + { -2199, 3991, -3134, -4879 }, + { -2962, 3323, -2816, -2419 }, + { -5286, 2495, -4548, -5395 }, + { -2810, 3710, -2274, -4211 }, + { -330, 3006, -2993, -4678 }, + { -1187, 2411, -2743, -5196 }, + { -664, 4033, -3101, -5641 }, + { -1458, 3602, -2816, -5371 }, + { -4116, 4923, -3321, -5630 }, + { -4165, 2528, -2592, -4798 }, + { -2759, 3080, -2333, -5719 }, + { -5157, 3011, -5526, -6348 }, + { -3095, 2126, -5881, -4234 }, + { -4377, 3849, -3600, -6099 }, + { -1994, 4947, -5235, -4753 }, + { -1067, 600, -3258, -5133 }, + { -4992, 3302, -2208, -5051 }, + { -3377, 2981, -1655, -4815 }, + { -3325, 2446, -1787, -6116 }, + { -2341, 2737, -3240, -6347 }, + { -2258, -3732, 3710, -1235 }, + { -1558, -3849, 2694, -3012 }, + { -599, -4837, 3050, -2951 }, + { -2246, -5433, 2798, -1910 }, + { -2255, -4989, 3260, 270 }, + { -3026, -5353, 2693, -1036 }, + { -1151, -6097, 1097, -3782 }, + { -3391, -6012, 2130, -1303 }, + { -2850, -4422, 3375, -480 }, + { -1138, -3779, 1491, -4162 }, + { -551, -3892, 3787, -2082 }, + { -3221, -3676, 3144, -1202 }, + { -3023, -5196, 2650, 605 }, + { -1756, -5729, 2646, 321 }, + { -2693, -4409, 494, -4797 }, + { -1913, -4573, 3372, -1730 }, + { -1277, -3604, 4061, -993 }, + { -420, -4993, 1351, -4796 }, + { -3052, -5333, 1435, -1242 }, + { -602, -5034, 3869, -1141 }, + { -2436, -4680, 1665, -3019 }, + { -2657, -3658, 1459, -3391 }, + { -1220, -6246, 2749, -525 }, + { -3838, -4844, 2265, -1735 }, + { -1247, -5679, 3356, -1417 }, + { -917, -5448, 3342, 105 }, + { -1756, -6839, 2276, -2350 }, + { -412, -5206, 1764, -3539 }, + { -1439, -6915, 1442, -3750 }, + { -1381, -4439, 3863, -282 }, + { -3482, -4953, 2726, -336 }, + { -1376, -5931, 1714, -1987 }, + { -1716, -4405, 2608, 105 }, + { -1590, -5191, 2652, -2704 }, + { -2149, -6442, 2453, -1263 }, + { -3426, -3832, 2334, -1829 }, + { -2747, -5948, 2362, -173 }, + { -2435, -3267, 2966, -1710 }, + { -3979, -4282, 2705, -775 }, + { -356, -4238, 2544, -4343 }, + { -1363, -6471, 2817, -1836 }, + { -2878, -5117, 218, -3149 }, + { -3539, -5196, 1710, -2356 }, + { -2888, -4537, 2746, -1701 }, + { -1870, -4439, 1496, -4121 }, + { -1486, -3388, 3349, -2145 }, + { -3333, -4138, 1467, -2876 }, + { -345, -5340, 1012, -1190 }, + { -1672, -4992, 2289, -1029 }, + { -2146, -5528, 3038, -635 }, + { -316, -3656, 3426, -3152 }, + { -2695, -5812, 2336, -2050 }, + { -2067, -6052, 737, -3258 }, + { -2664, -4205, -350, -1266 }, + { -617, -5406, 80, -4853 }, + { -2418, -3825, 1853, -1326 }, + { -1961, -4339, 583, -4315 }, + { -1495, -5141, -133, -5205 }, + { -3208, -6440, 1691, -2069 }, + { -2632, -3633, 2325, -2761 }, + { -2624, -5670, 1252, -3676 }, + { -3687, -5608, 687, -2833 }, + { -3320, -5707, 16, -3877 }, + { -2738, -6112, 84, -5135 }, + { 2277, -5661, 3076, 843 }, + { 1555, -5769, 2821, -5236 }, + { 536, -6381, 603, -4910 }, + { 734, -4609, 3314, -4092 }, + { 1836, -4547, 3267, -4322 }, + { -13, -5976, 3752, -1607 }, + { 1423, -6318, 2336, 398 }, + { 365, -7779, 1498, -534 }, + { 2104, -8366, 2946, -1345 }, + { 143, -5545, 1898, -3756 }, + { 655, -6852, 1430, 148 }, + { 4, -6653, 2397, -59 }, + { 2346, -5996, 4562, -934 }, + { 1229, -7104, 2963, -598 }, + { -528, -7048, 2887, -1790 }, + { 1451, -6857, 3900, -1637 }, + { 554, -6018, 3336, 9 }, + { 3278, -5758, 4034, 129 }, + { 3541, -7145, 4905, -1575 }, + { 2339, -6907, 3464, -301 }, + { 2775, -7301, 1667, -3894 }, + { 539, -7887, 991, -4156 }, + { 2115, -7421, 3131, -3075 }, + { 2803, -8546, 2564, -5836 }, + { 2869, -5833, 1620, -4561 }, + { 2591, -7281, 3215, -4719 }, + { -1228, -8477, 706, -4782 }, + { 1967, -5243, 4813, -1940 }, + { 701, -7010, 2273, -3893 }, + { 915, -8470, 1918, -5620 }, + { -94, -6715, 156, -3873 }, + { 1074, -5607, 4389, -1017 }, + { 2739, -6551, 1227, -3521 }, + { 725, -7835, 2701, -1291 }, + { -493, -7475, 2263, -1075 }, + { -412, -6508, 2984, -744 }, + { 665, -5451, 3725, -2692 }, + { 1499, -8129, 3564, -2072 }, + { 2870, -6333, 4487, -2108 }, + { 706, -5007, 3911, -152 }, + { -482, -8660, 1483, -2900 }, + { 2481, -6596, 2518, -1715 }, + { 1403, -6414, 1398, -5387 }, + { 652, -6267, 583, -5942 }, + { 694, -7540, 646, -6272 }, + { 2275, -7614, 256, -5015 }, + { 1416, -9727, 1900, -3153 }, + { 2760, -6433, 3875, -3771 }, + { 2325, -11196, 2182, -5155 }, + { 1223, -11061, 1377, -5097 }, + { 108, -10603, 307, -4952 }, + { -118, -8268, 1650, -1572 }, + { 1839, -7943, 1755, -612 }, + { 2501, -9056, 981, -2969 }, + { 2902, -8476, 1491, -5780 }, + { 1995, -11175, 1585, -3643 }, + { 696, -8212, 828, -2474 }, + { 1526, -8649, 1380, -1210 }, + { 461, -7253, 3222, -2229 }, + { 2966, -8641, 4121, -3271 }, + { 833, -6039, 2361, -1086 }, + { 3565, -7312, 1980, -5427 }, + { 2850, -8671, 3760, -1846 }, + { 2643, -7281, 2163, -173 }, + { 3463, -3706, -3132, -923 }, + { 1315, -3825, -3443, 2 }, + { 2594, -4083, -3815, 670 }, + { 1826, -4291, -2741, -155 }, + { 868, -3749, -4175, -298 }, + { 2008, -4237, -3897, -517 }, + { 1242, -3493, -4335, -1335 }, + { -88, -4142, -3390, -1529 }, + { 2176, -3488, -3822, -975 }, + { 1706, -5188, -3415, -637 }, + { 2717, -6159, -2333, -882 }, + { 1276, -3978, -4361, 537 }, + { 2471, -5556, -2866, -208 }, + { 799, -4673, -4086, 56 }, + { 1901, -4786, -3533, 270 }, + { 3036, -3902, -3606, -333 }, + { 2249, -3317, -4319, -144 }, + { 2594, -4207, -2105, -2930 }, + { 4008, -4774, -2626, -902 }, + { 1038, -3659, -3496, -2454 }, + { 2725, -3597, -3298, -1535 }, + { 1662, -5803, -2813, 175 }, + { 705, -3757, -3441, -1484 }, + { 1860, -5987, -2821, -886 }, + { 3786, -4918, -2199, -1929 }, + { 3683, -4235, -2547, -1287 }, + { 2531, -4896, -2956, -1593 }, + { 1005, -5585, -3324, -180 }, + { 1625, -5229, -1756, -3642 }, + { 1494, -5041, -2989, -2685 }, + { 2718, -4655, -3224, -867 }, + { 2374, -6640, -1745, -2975 }, + { 2133, -6436, -2477, -1499 }, + { 1833, -4418, -3523, -1512 }, + { 1128, -4910, -2658, -1106 }, + { 689, -4777, -2831, -2085 }, + { 3593, -5280, -2627, -315 }, + { 3264, -3771, -2673, -1861 }, + { 3202, -5602, -2409, 402 }, + { 552, -4618, -2221, -3002 }, + { 3095, -5356, -2666, -1083 }, + { 3401, -4609, -3146, 45 }, + { 3051, -4662, -2192, -2232 }, + { 2798, -5552, -2462, -1941 }, + { 2354, -5815, -2223, -2619 }, + { 192, -3708, -2807, -2658 }, + { 1886, -4226, -1862, -3529 }, + { 2526, -3976, -2819, -2332 }, + { 1577, -3870, -2711, -2806 }, + { 1288, -5588, -3382, -1403 }, + { 2711, -5399, -1564, -3253 }, + { 1459, -5492, -2222, -322 }, + { 2823, -5091, -2886, 776 }, + { 3559, -5821, -2109, -1360 }, + { 1587, -6331, -2760, -1909 }, + { 2139, -5213, -2874, -2120 }, + { 1318, -4337, -3695, -2098 }, + { 821, -4471, -1849, -565 }, + { 3329, -4782, -1725, -89 }, + { 582, -4914, -4105, -1119 }, + { 417, -4144, -4072, -2529 }, + { -199, -3803, -2765, -4042 }, + { 2731, -4283, -2143, 1 }, + { 2911, -6187, -1951, -2116 }, + { 1573, -6094, -493, -2838 }, + { 2081, -6927, -864, -3211 }, + { 1058, -7826, 79, -364 }, + { 3147, -5570, -684, -978 }, + { 3572, -5856, 1060, 1824 }, + { 1143, -6702, -1478, 338 }, + { 2341, -7220, -88, 260 }, + { 3639, -6861, 668, 815 }, + { 2227, -6268, -1706, 446 }, + { 3390, -6082, -353, 1302 }, + { 1123, -7556, -1237, -430 }, + { 1729, -7742, 729, -218 }, + { 1457, -6774, 587, 579 }, + { 505, -6919, -569, 371 }, + { 1106, -7245, 78, 158 }, + { 2755, -6745, -1122, 338 }, + { 3069, -6040, -1415, 986 }, + { 2174, -7064, -1430, -283 }, + { 1390, -8626, -446, -3031 }, + { 3534, -6890, -431, 547 }, + { 2267, -9618, 475, -2994 }, + { 3672, -7673, 75, -115 }, + { 2131, -7560, -1206, -750 }, + { 2972, -7477, -685, -262 }, + { 1604, -6637, -672, 699 }, + { 1666, -7577, -577, -240 }, + { 1591, -6554, -2158, -94 }, + { 2348, -6286, -353, 1123 }, + { 2017, -8810, -412, -1805 }, + { 2892, -6713, -1765, -554 }, + { 2500, -6828, -1995, -1197 }, + { 3877, -6639, -224, -1655 }, + { 2392, -7872, -91, -333 }, + { 3562, -7370, -532, -2836 }, + { 2552, -7614, 164, -1805 }, + { 990, -6104, 218, 438 }, + { 910, -7861, 312, -1195 }, + { 1472, -6327, 372, -640 }, + { 1576, -7143, -1983, -843 }, + { 422, -7625, -457, -278 }, + { 1797, -8532, 405, -1011 }, + { 1088, -7396, -238, -2277 }, + { 3209, -6753, -1431, -2072 }, + { 2617, -6839, 100, -2573 }, + { 2575, -8573, -387, -3188 }, + { 3618, -6971, -1190, -321 }, + { 2205, -7361, -1695, -2008 }, + { 2985, -6297, 1464, 1179 }, + { 2804, -7310, 1053, 338 }, + { 1362, -6074, -1163, -840 }, + { 3336, -6325, -1794, 21 }, + { 2836, -8109, 818, -329 }, + { 2791, -5879, 560, 1546 }, + { 2392, -6064, 135, 100 }, + { 1838, -6194, 596, 1085 }, + { 1926, -7515, -414, -4901 }, + { 3225, -7298, -1202, -1189 }, + { 3960, -7558, -659, -719 }, + { 3442, -6647, -1692, -1095 }, + { 3381, -6441, 262, -886 }, + { 1431, -8150, -1186, -1406 }, + { 340, -8498, -150, -899 }, + { 3004, -8149, -260, -953 }, + { 2749, -6611, 563, 873 }, + { -6647, -1325, -4517, -4691 }, + { -6005, -1657, -4089, -3797 }, + { -3157, 588, -5213, -3068 }, + { -3311, -1425, -6329, -3726 }, + { -5866, -819, -3857, -2744 }, + { -5001, -1799, -1075, -4621 }, + { -5330, -2650, -2672, -4664 }, + { -4930, -539, -2363, -4010 }, + { -2984, 10, -3863, -5749 }, + { -1055, -2106, -3713, -4267 }, + { -5476, -502, -4279, -6504 }, + { -5231, -1543, -5018, -6425 }, + { -5134, -363, -3165, -5109 }, + { -3953, -771, -4107, -6393 }, + { -2159, -563, -3652, -5342 }, + { -3888, -2321, -919, -5057 }, + { -1236, -597, -4235, -4193 }, + { -4053, 675, -3083, -6174 }, + { -2793, -1089, -5396, -3460 }, + { -3000, -44, -2209, -6575 }, + { -3336, -1531, -4313, -5160 }, + { -2127, 128, -4851, -3692 }, + { -3321, 136, -2067, -5660 }, + { -5215, 1404, -4374, -4356 }, + { -2747, 400, -6340, -3691 }, + { -3926, -599, -5361, -5006 }, + { -2875, -2592, -5143, -4092 }, + { -4991, -1958, -5322, -4891 }, + { -4965, -1318, -6652, -5333 }, + { -4920, -1691, -3388, -5561 }, + { -3644, -3354, -2688, -5982 }, + { -5076, -919, -4563, -2984 }, + { -6114, 250, -3884, -3915 }, + { -4014, 744, -3973, -1924 }, + { -5543, -1041, -5557, -3847 }, + { -4711, -1352, -5649, -2603 }, + { -3362, 775, -5305, -4879 }, + { -5001, 107, -3554, -2888 }, + { -6258, -1651, -6356, -6566 }, + { -4529, 407, -5003, -3865 }, + { -5154, 550, -5278, -5465 }, + { -4195, -467, -1894, -3129 }, + { -5022, 1127, -3349, -3314 }, + { -6075, 1250, -4313, -5641 }, + { -2677, -2283, -2312, -5903 }, + { -4113, 193, -1195, -4833 }, + { -3940, -1048, -1389, -5079 }, + { -3703, 917, -4043, -4451 }, + { -3366, -4231, -1534, -5488 }, + { -3326, -3583, -2091, -4903 }, + { -5144, 1254, -2532, -4949 }, + { -5982, -870, -2545, -4555 }, + { -3925, -157, -5367, -2281 }, + { -6419, -746, -5668, -4371 }, + { -5787, 518, -7096, -5805 }, + { -4258, 954, -6453, -4321 }, + { -4771, -695, -4158, -1639 }, + { -7078, -760, -5195, -5877 }, + { -7348, 83, -4101, -4586 }, + { -2430, 184, -2874, -1679 }, + { -2284, -3943, -2924, -5034 }, + { -1804, -1785, -3002, -4710 }, + { -4399, -2772, -1815, -4637 }, + { -6340, -2626, -2824, -5191 }, + { -4998, -5168, -3480, 1905 }, + { -3958, -5492, -1599, 1579 }, + { -2471, -3755, -276, 3182 }, + { -3033, -5779, -1063, 1554 }, + { -2936, -4829, -1290, 2386 }, + { -1835, -5073, -3051, 1299 }, + { -1724, -3771, -3935, 2324 }, + { -5070, -2550, -3692, 768 }, + { -4326, -5333, -297, 1878 }, + { -3472, -5619, -3094, 992 }, + { -3027, -4384, -3038, 2265 }, + { -3201, -5332, 67, 2200 }, + { -1681, -4373, -1947, 2461 }, + { -3221, -3329, -4238, 2564 }, + { -1262, -2968, -2915, 3227 }, + { -3419, -1878, -3373, 2110 }, + { -2244, -5583, -2012, 1288 }, + { -1971, -5266, -990, 1812 }, + { -2975, -2778, -452, 4063 }, + { -2198, -1165, -3298, 2965 }, + { -4782, -4894, -4767, 664 }, + { -6002, -3950, -2806, 2025 }, + { -3142, -3162, -2859, 3295 }, + { -3262, -3340, -4123, 1596 }, + { -4014, -3918, -1955, 3361 }, + { -1700, -3463, -1346, 3449 }, + { -4245, -4445, -4743, 1644 }, + { -4180, -3969, -401, 3281 }, + { -2782, -5240, -4117, 1156 }, + { -5744, -4040, -1439, 3470 }, + { -5063, -4663, -323, 3172 }, + { -4531, -3319, -844, 3988 }, + { -6226, -5125, -2064, 2976 }, + { -3115, -3267, -1531, 3898 }, + { -4628, -4421, -2864, 2808 }, + { -4559, -2989, -3442, 2024 }, + { -1775, -4487, -656, 2477 }, + { -2664, -1865, -1884, 4081 }, + { -1828, -2575, -3894, 3378 }, + { -6441, -3677, -2025, 1677 }, + { -4141, -2156, -1191, 3474 }, + { -4802, -1623, -1727, 2160 }, + { -5474, -2745, -1475, 2498 }, + { -3664, -1056, -1975, 2491 }, + { -4672, -3062, -2235, 2933 }, + { -4205, -5960, -2849, 1517 }, + { -4995, -5708, -1739, 1805 }, + { -4892, -6080, -4793, 872 }, + { -4270, -4172, -4263, 2185 }, + { -4687, -1470, -2905, 1023 }, + { -6446, -5017, -3919, 1000 }, + { -6046, -5538, -3943, 2006 }, + { -6028, -3750, -3953, 771 }, + { -5959, -4582, -5024, 824 }, + { -5818, -2576, -2249, 1326 }, + { -5659, -5345, -1119, 2500 }, + { -3346, -4155, 606, 2749 }, + { -5680, -4827, -2501, 1838 }, + { -6193, -2543, -1295, 840 }, + { -6871, -4925, -3512, 1801 }, + { -5605, -1788, -1895, 779 }, + { -3922, -5712, -4644, 510 }, + { -4745, -3869, -4533, 99 }, + { -2984, -4907, -399, 1497 }, + { 1847, -478, 3061, -5812 }, + { 4450, -1116, 3609, -6570 }, + { 3139, 99, 3007, -5532 }, + { 2590, -3782, 3138, -4770 }, + { 1881, 1204, 5778, -3404 }, + { 3631, 2060, 5566, -5038 }, + { 3461, 1961, 5167, -3800 }, + { 2947, 273, 4536, -4389 }, + { 4453, -1730, 5788, -4370 }, + { 4032, 1805, 2666, -4534 }, + { 3487, -944, 2313, -6028 }, + { 1313, 34, 4210, -4067 }, + { 5632, -1502, 5825, -5855 }, + { 7736, -547, 4879, -5476 }, + { 4906, -1512, 4760, -5760 }, + { 3843, 447, 1091, -4958 }, + { 2982, -1135, 5442, -4386 }, + { 3579, 271, 3031, -6770 }, + { 3932, -211, 4688, -5507 }, + { 4411, 1720, 2387, -5584 }, + { 5379, -479, 4575, -6280 }, + { 3613, -362, 2012, -4885 }, + { 3744, -2013, 4493, -5073 }, + { 5693, 109, 4379, -3362 }, + { 5475, -621, 5317, -3985 }, + { 6411, -673, 5708, -4752 }, + { 4933, -796, 7262, -4290 }, + { 2804, 444, 6276, -3655 }, + { 4120, -517, 6078, -4531 }, + { 5119, 841, 3486, -3910 }, + { 4738, 1539, 3525, -2970 }, + { 5086, 370, 5895, -5640 }, + { 4235, 2716, 4589, -5044 }, + { 3691, 682, 6199, -4700 }, + { 6111, -570, 6271, -6528 }, + { 2611, 1277, 3756, -4802 }, + { 4395, 970, 3807, -5879 }, + { 5225, 2299, 3242, -4333 }, + { 5144, 1778, 4946, -5545 }, + { 2989, -3016, 3247, -5495 }, + { 2983, 920, 2071, -6059 }, + { 5270, -903, 4434, -2350 }, + { 6415, -585, 3970, -3554 }, + { 3866, -197, 5216, -2884 }, + { 3767, -1298, 6702, -3315 }, + { 6299, 2620, 5284, -6824 }, + { 6654, 646, 3653, -4927 }, + { 4770, 3047, 5160, -6287 }, + { 5364, 434, 2919, -5207 }, + { 2998, 1344, 4801, -2456 }, + { 3896, 1013, 3773, -1864 }, + { 2115, 655, 2999, -6344 }, + { 5170, -981, 2849, -4464 }, + { 2735, -2159, 2717, -5776 }, + { 2430, -1952, 4392, -4559 }, + { 6143, -1180, 3659, -4746 }, + { 4978, -1483, 1726, -4875 }, + { 3486, -2383, 3306, -4301 }, + { 1434, -1372, 4171, -4770 }, + { 3354, -2627, 1525, -5093 }, + { 6790, 2386, 3995, -5909 }, + { 1475, -2674, 3451, -4204 }, + { 1999, -3494, 3693, -5556 }, + { 4764, -2848, 2856, -5589 }, + { -3677, 5131, 2827, -2934 }, + { -2844, 7078, 2852, -3580 }, + { -3902, 6434, 4118, -1911 }, + { -1769, 7530, 3492, -3541 }, + { -1937, 5679, -447, -1127 }, + { -2456, 4680, 4196, -2407 }, + { -2778, 8241, 1698, -4288 }, + { -2876, 6104, 5182, -2387 }, + { -2802, 7341, 4463, -2938 }, + { -1025, 6267, 4752, -3201 }, + { -2349, 5413, 2041, -3794 }, + { -2252, 8225, 2856, -4269 }, + { -1465, 4967, 4976, -2500 }, + { -636, 7565, 3517, -4233 }, + { -1905, 5618, 3904, -2942 }, + { -302, 6816, 3343, -3316 }, + { -2210, 4156, 2817, -3511 }, + { -717, 6568, 1863, -2951 }, + { -3873, 5682, 2164, -575 }, + { -2878, 5835, 440, -2597 }, + { -3228, 7701, 2610, -2514 }, + { -3608, 8888, 3377, -2468 }, + { -2582, 9717, 2519, -3126 }, + { -5238, 6202, 2866, -2831 }, + { -3428, 7370, 3056, -335 }, + { -1681, 8836, 1210, -2010 }, + { -3276, 6724, 1156, -3930 }, + { -894, 8149, 827, -1258 }, + { -2965, 8631, 2549, -1320 }, + { -3961, 6902, 3581, 55 }, + { -1894, 7745, 1750, -841 }, + { -821, 6844, 850, -676 }, + { -608, 6948, -4, -1376 }, + { 615, 6524, 1089, -1147 }, + { -2972, 5668, 1091, -489 }, + { -157, 4649, 2904, -413 }, + { 673, 5121, 1498, -66 }, + { -390, 5902, 1611, -245 }, + { -2349, 5478, 4772, -1320 }, + { 88, 6798, 1972, -1859 }, + { -1213, 5120, 2991, 200 }, + { -2347, 6040, 2839, 376 }, + { -578, 5976, 3364, -1796 }, + { -1391, 5872, 3002, -965 }, + { -564, 4496, 3946, -1186 }, + { -2299, 6386, 3135, -2176 }, + { -2131, 5641, 2011, 1223 }, + { -772, 5807, 1124, 895 }, + { -2837, 6758, 2297, -740 }, + { -3091, 6298, 1415, -2126 }, + { -4197, 6036, 1843, -3022 }, + { -41, 6459, 92, 344 }, + { -2241, 6860, 2095, -4396 }, + { -1931, 7088, 2117, -2135 }, + { -2375, 4422, 1688, -3169 }, + { -1742, 6674, 1538, -119 }, + { -4818, 7749, 4192, -1577 }, + { -2004, 5672, 193, -430 }, + { -3825, 6042, 2128, -1898 }, + { -1108, 8033, 2119, -3013 }, + { -2370, 5453, 1721, 266 }, + { -1570, 7134, 614, -2638 }, + { -1519, 8752, 3503, -4330 }, + { -2050, 3845, 2907, -1126 }, + { 5085, 4412, -335, -1923 }, + { 3618, 1423, -613, -4012 }, + { 4481, 3729, 589, -4631 }, + { 4270, 3216, -1763, -3168 }, + { 4241, 1796, -1701, -2796 }, + { 4787, 2338, -487, -3639 }, + { 2915, 3429, -621, -4753 }, + { 5175, 1660, -1265, -3223 }, + { 4280, 4057, -684, -4079 }, + { 4980, 4419, -1455, -2719 }, + { 5436, 2464, 387, -4197 }, + { 4507, 4018, 1121, -3314 }, + { 6020, 2401, -413, -3201 }, + { 4200, 3789, -333, -2813 }, + { 5229, 2493, -1194, -1878 }, + { 5851, 2695, -492, -2292 }, + { 5743, 3288, -697, -1221 }, + { 5692, 2612, 979, -2227 }, + { 5085, 2067, 1046, -1214 }, + { 3163, 2240, -2098, -3435 }, + { 5228, 1898, 145, -2397 }, + { 5860, 3976, -418, -2872 }, + { 6008, 3399, 1027, -3506 }, + { 4126, 2035, 1865, -893 }, + { 5375, 3596, 511, -2362 }, + { 1937, 1493, -852, -122 }, + { 3473, 4849, 547, -2603 }, + { 4631, 2977, 1141, -1768 }, + { 6149, 3050, -71, -1886 }, + { 4069, 4353, -289, -1429 }, + { 2884, 1225, -1388, 365 }, + { 5485, 2518, -235, -571 }, + { 1216, 4375, 1443, 398 }, + { 4988, 3106, 107, -1435 }, + { 4511, 2801, 307, -444 }, + { 3235, 4386, 327, -676 }, + { 2055, 3708, 1657, -305 }, + { 5839, 2374, 290, -1385 }, + { 5110, 3305, 1936, -4206 }, + { 6416, 2920, 338, -2736 }, + { 3350, 2824, -1269, -3881 }, + { 4840, 1815, 464, 186 }, + { 2399, 3332, 238, 1238 }, + { 3516, 1363, 1582, 688 }, + { 3582, 1874, 154, -4770 }, + { 3261, 2878, 886, 283 }, + { 3877, 2658, -327, 884 }, + { 4151, 3436, 2173, -2923 }, + { 3592, 3674, 1281, -1295 }, + { 4561, 3730, -1114, -1747 }, + { 4595, 3625, -558, -575 }, + { 2577, 2348, 2267, 120 }, + { 5242, 3299, 32, -3412 }, + { 4264, 3637, 709, -2320 }, + { 6556, 3570, -838, -2472 }, + { 5745, 4014, -940, -1973 }, + { 5629, 4475, 477, -3328 }, + { 5269, 3199, 1682, -3085 }, + { 4432, 2416, 1145, -3299 }, + { 4465, 2505, 2162, -2186 }, + { 4643, 4941, -88, -2885 }, + { 4568, 5231, 552, -3915 }, + { 5667, 3075, -1406, -2963 }, + { 5418, 5259, -771, -2818 }, + { -256, -7875, 511, -471 }, + { -1813, -7971, -424, -396 }, + { -306, -7006, 862, 282 }, + { -2306, -6422, -1440, 508 }, + { -245, -6787, 375, -100 }, + { -1309, -6065, -20, 779 }, + { -1656, -6047, -641, 1307 }, + { -1496, -6522, 964, 726 }, + { -2291, -6588, -202, 795 }, + { -762, -7522, 1454, -558 }, + { -2270, -7004, -834, -580 }, + { -1139, -7078, 259, 362 }, + { -2535, -7568, -1040, 49 }, + { -3786, -7280, 934, -476 }, + { -3336, -6368, 606, 1056 }, + { -3602, -6924, 52, 714 }, + { -2278, -6550, 1674, 204 }, + { -2855, -5765, 930, 1530 }, + { -2889, -7325, -215, 305 }, + { -2749, -6080, -237, 1452 }, + { -985, -6667, 1577, 400 }, + { -2036, -6083, 380, 1267 }, + { -2077, -7460, 380, -30 }, + { -1775, -7175, 1540, -386 }, + { -3065, -6927, 989, 168 }, + { -2836, -7602, 117, -3392 }, + { -1058, -6396, 593, -3078 }, + { -844, -6062, 999, -236 }, + { -3261, -6951, 1491, -720 }, + { -2186, -8484, 75, -1287 }, + { -2882, -7756, 456, -510 }, + { -1800, -6879, 960, -1183 }, + { -2554, -7241, 1614, -1474 }, + { -2608, -5305, 392, 851 }, + { -2973, -6562, -859, 858 }, + { -2640, -5989, 1031, -416 }, + { -977, -8366, 705, -1434 }, + { -1213, -7409, -77, -1390 }, + { -1335, -6657, 2125, -123 }, + { -2544, -6862, 1852, -737 }, + { -3235, -6422, 1752, -103 }, + { -1300, -7557, 939, -348 }, + { -3476, -7579, 202, -109 }, + { -2482, -6572, 753, 619 }, + { -2554, -8136, -648, -429 }, + { -1012, -7870, -3, -421 }, + { -3604, -6247, 32, -3102 }, + { -1486, -7271, 2013, -1021 }, + { -578, -6799, -523, 405 }, + { -2841, -5948, 1644, 911 }, + { -2411, -7473, 1084, -484 }, + { -2238, -6033, 294, -1059 }, + { -3459, -6470, -201, -790 }, + { -2027, -6009, 1833, 805 }, + { -1433, -8047, 1531, -1754 }, + { -3258, -7884, 763, -1422 }, + { -1544, -6928, -729, 478 }, + { -2314, -8415, 74, -3757 }, + { -3201, -5684, 95, -2214 }, + { -2423, -8694, 725, -3631 }, + { -3545, -7071, 1162, -1798 }, + { -294, -9662, 403, -2274 }, + { -2290, -5460, 1196, 402 }, + { -1603, -6713, 903, -2363 }, + { 4121, 2491, -3142, -2482 }, + { 4500, 3305, -3671, -1567 }, + { 5973, 3172, -1348, -534 }, + { 4830, 3379, -1549, 643 }, + { 5214, 3938, -2641, -2302 }, + { 4639, 4826, -5532, -847 }, + { 5639, 2731, -2170, -963 }, + { 6084, 3487, -3525, -1346 }, + { 5971, 3154, -2190, -2316 }, + { 5618, 4865, -6927, 116 }, + { 5345, 3568, -7391, 709 }, + { 5429, 5078, -3811, -1524 }, + { 6960, 2037, -3515, -1096 }, + { 7092, 2531, -4557, -588 }, + { 6061, 4247, -5651, -478 }, + { 4595, 3684, -4907, -827 }, + { 7497, 3213, -3048, -424 }, + { 5996, 2137, -3098, -1745 }, + { 6198, 5199, -2223, -2274 }, + { 6888, 2851, -2768, -1675 }, + { 6114, 4210, -2316, -954 }, + { 7127, 4242, -3041, -1408 }, + { 6126, 3668, -1517, -1427 }, + { 6245, 6129, -4225, -1186 }, + { 6816, 3213, -2101, -964 }, + { 5345, 5276, -2643, -847 }, + { 6592, 4665, -4338, 484 }, + { 6746, 3751, -3443, 124 }, + { 5453, 1980, -2738, 2606 }, + { 4662, 2179, -4226, -1059 }, + { 5571, 3208, -3554, 174 }, + { 5256, 4447, -1815, -1481 }, + { 5400, 2570, -1210, 235 }, + { 7056, 2549, -2674, 318 }, + { 4574, 4340, -2892, -130 }, + { 6203, 4587, -3273, -305 }, + { 5103, 1925, -2715, -2137 }, + { 3905, 4296, -1700, 247 }, + { 4421, 4605, -3299, 811 }, + { 5671, 1273, -3870, -924 }, + { 5486, 1805, -4901, 133 }, + { 6437, 2578, -1828, -106 }, + { 5530, 5253, -5058, 1223 }, + { 4816, 2025, -1215, 1443 }, + { 3457, 3525, -2456, 3217 }, + { 3316, 2595, -1108, 2459 }, + { 3068, 3810, -2207, 1926 }, + { 6351, 5436, -6470, 600 }, + { 6324, 4240, -5365, 2416 }, + { 4851, 4774, -4075, 1878 }, + { 4900, 3679, -5198, 1078 }, + { 8347, 3633, -4565, -171 }, + { 5244, 5718, -3853, 173 }, + { 3960, 3492, -2939, 2105 }, + { 6070, 3473, -2351, 161 }, + { 8228, 3034, -3360, -901 }, + { 7006, 3985, -1940, -1926 }, + { 7123, 4681, -4301, -878 }, + { 5122, 4097, -1851, -449 }, + { 6200, 2060, -2251, 1049 }, + { 7106, 3844, -7209, 2625 }, + { 7108, 3370, -6734, 533 }, + { 6859, 2849, -3992, 1360 }, + { 5458, 2278, -3253, 1131 }, + { -1072, -2109, 4783, -1073 }, + { -319, -2604, 4257, -2418 }, + { 2466, 1300, 3476, -314 }, + { 2847, -1502, 5296, -141 }, + { 1667, -1273, 5559, -2725 }, + { 2877, -3402, 6434, 204 }, + { 53, -2637, 5275, -1181 }, + { 1091, -2215, 5803, -1549 }, + { 2397, -922, 4327, 1182 }, + { 219, -3747, 4647, -1564 }, + { -29, -2705, 4812, 1277 }, + { 1499, -2608, 5648, 1407 }, + { 2139, -2399, 4202, 2791 }, + { -426, -2064, 5528, 151 }, + { 2560, -2803, 6179, -2806 }, + { 4537, -2479, 3797, 1095 }, + { 888, -3357, 5341, -415 }, + { 4460, -1814, 5388, -1227 }, + { 3920, -3268, 6364, -703 }, + { 3343, -4698, 4410, 784 }, + { 309, -1897, 6306, 1223 }, + { 958, -3318, 4254, -3167 }, + { -99, 1596, 6018, -1983 }, + { -429, -853, 6407, 878 }, + { 1170, -1322, 6290, -417 }, + { 2288, -505, 6303, -1999 }, + { 3312, -1674, 6749, -2494 }, + { -415, -3401, 4721, -371 }, + { -189, -1210, 4844, -2002 }, + { 888, -4142, 4377, 130 }, + { 2469, -4381, 5398, -2492 }, + { 2879, -2912, 5094, -2598 }, + { -717, -617, 5650, -685 }, + { 1470, -3863, 5352, -1684 }, + { 3935, -96, 3823, -730 }, + { 3769, -430, 3168, 694 }, + { 2556, 385, 3539, 512 }, + { 77, -1415, 5111, 2655 }, + { 2724, -2158, 6715, -822 }, + { 1832, 1001, 5385, -1900 }, + { 900, 2198, 4464, -559 }, + { 441, 69, 5921, -1743 }, + { -1161, 738, 6732, -308 }, + { 257, 2035, 4091, 736 }, + { 1607, 1288, 4355, -23 }, + { -13, 1316, 4180, 1672 }, + { 1511, 1336, 3057, 1435 }, + { 2189, -3813, 4530, 939 }, + { 3632, -706, 2646, 1375 }, + { 4266, -3761, 4241, 1077 }, + { 3101, -427, 5273, -1202 }, + { 2293, 276, 4810, -313 }, + { 3430, -1851, 3101, 2045 }, + { 3453, -2979, 5142, 942 }, + { 1683, -3281, 4802, 2002 }, + { 3954, -4715, 5611, 578 }, + { 1272, -155, 5085, 454 }, + { 128, -194, 5095, 1409 }, + { 820, 880, 5797, -2658 }, + { -1095, 656, 5774, 1095 }, + { 813, -1669, 4320, -3251 }, + { -119, 518, 6372, -651 }, + { 2922, -4299, 6115, -877 }, + { 4205, -4273, 4004, 2642 }, + { -1211, -3892, 224, 3127 }, + { -34, -4371, 1321, 2318 }, + { 77, -6326, 1201, 828 }, + { 3995, -3775, 1958, 3233 }, + { 178, -3301, 1985, 3318 }, + { 2330, -3801, 1033, 3195 }, + { 1413, -5536, 826, 1709 }, + { 2468, -3499, 3653, 3631 }, + { 741, -4617, 1723, 2008 }, + { 1246, -3043, 2978, 3949 }, + { -343, -4308, 2258, 2189 }, + { -682, -4640, 454, 2272 }, + { 1236, -4829, 2491, 1642 }, + { -512, -3766, 1182, 3052 }, + { 119, -3939, 3712, 971 }, + { -1145, -4624, 1360, 2281 }, + { 101, -4746, 2866, 1255 }, + { -1500, -5455, 539, 1637 }, + { -969, -5909, 1414, 1128 }, + { -1261, -4939, -231, 2022 }, + { -226, -5345, 1207, 705 }, + { 2712, -5109, 3205, 1866 }, + { -476, -5913, 273, 1208 }, + { -2039, -4464, 624, 2545 }, + { -2351, -3930, 2019, 2673 }, + { -2675, -4849, 1522, 1990 }, + { -1524, -3461, 1446, 3204 }, + { 477, -5314, 1710, 1577 }, + { 656, -3729, 2346, 2511 }, + { 550, -5917, 1975, 1040 }, + { 1728, -4704, 3067, 1058 }, + { -9, -5247, 506, 1760 }, + { -574, -5135, 1675, 1672 }, + { 2129, -3781, 3444, 2313 }, + { 1144, -4439, 2214, 2529 }, + { 1292, -4160, 3185, 1833 }, + { 2445, -3262, 2534, 3227 }, + { 2266, -4401, 2023, 2400 }, + { -587, -3602, 3408, 2067 }, + { -885, -4951, 3228, 1174 }, + { -728, -2711, 2807, 3552 }, + { 1019, -3043, 3195, 2954 }, + { 1888, -4615, 1140, 2454 }, + { 660, -5616, 754, 800 }, + { -1975, -5371, 1649, 1585 }, + { -1544, -5436, 2422, 1081 }, + { -422, -5882, 2390, 750 }, + { 1336, -5557, 2441, 1230 }, + { 136, -4001, 267, 2854 }, + { -522, -3289, 2226, 2728 }, + { -971, -4580, 2471, 708 }, + { 704, -5306, 3300, 1001 }, + { 325, -3464, 3555, 2398 }, + { 794, -3686, 848, 3169 }, + { 660, -3017, 4584, 3242 }, + { -1486, -3978, 2170, 1644 }, + { -1615, -4650, 2688, 1844 }, + { 750, -4578, 538, 2239 }, + { 1668, -5849, 1455, 1031 }, + { 3486, -4681, 2030, 2183 }, + { 2642, -5429, 1696, 1761 }, + { 4491, -4502, 3538, 2767 }, + { 3545, -4528, 3514, 2982 }, + { 3269, -3676, 2758, 3966 }, + { 5572, 1146, 209, -3379 }, + { 7459, 1053, 593, -1896 }, + { 4480, 200, -310, -4259 }, + { 5577, -939, 242, -3992 }, + { 8142, 442, 1257, -3083 }, + { 5442, 1261, 1424, -3236 }, + { 6260, -183, 3125, -2532 }, + { 7179, 889, 1618, -2548 }, + { 6416, 932, 2379, -2487 }, + { 7094, 2560, 961, -3392 }, + { 7322, 463, 2732, -3735 }, + { 6632, 1577, 1912, -3272 }, + { 6312, 1349, 3028, -3460 }, + { 6105, 386, 1213, -977 }, + { 5478, 1158, 1114, -486 }, + { 6493, 410, 1686, -2180 }, + { 6378, 1881, 1333, -2240 }, + { 5711, 812, 1958, -1300 }, + { 6844, 877, 730, -1189 }, + { 6824, -245, 2249, -2000 }, + { 7515, 1521, 1251, -3058 }, + { 6697, 1051, 1300, -1749 }, + { 6476, 1425, 811, -2773 }, + { 7350, 465, -76, -2849 }, + { 6975, 2095, 567, -2492 }, + { 4691, 1736, 2660, -2289 }, + { 7837, 1456, 340, -2767 }, + { 7930, 507, 838, -2074 }, + { 6106, 1502, 766, -1110 }, + { 4891, -659, 835, -3954 }, + { 7250, 141, 1369, -1523 }, + { 7651, 67, 1651, -2298 }, + { 7364, -305, 601, -3132 }, + { 7179, 193, 2491, -2871 }, + { 6504, -272, 2167, -1322 }, + { 4456, 983, 2300, -421 }, + { 4817, 457, 1695, 371 }, + { 6914, 555, 850, -3159 }, + { 5904, 1030, 202, -1959 }, + { 6258, 880, 2233, -4503 }, + { 6029, 10, 2130, -3600 }, + { 6449, 985, 1129, -3963 }, + { 6616, -18, -111, -3285 }, + { 4496, 775, 817, -4276 }, + { 6134, 2338, 1470, -2973 }, + { 6911, 152, 430, -1946 }, + { 4053, 991, 3218, -1193 }, + { 5435, 1285, 3124, -2412 }, + { 5507, 1836, 1935, -1988 }, + { 5240, 689, 2189, -2670 }, + { 6638, 1719, 606, -1799 }, + { 5556, -180, 129, -2595 }, + { 5644, 1918, 1281, -4316 }, + { 6410, 1088, -282, -3117 }, + { 6503, 1841, 312, -3514 }, + { 6947, 20, 1358, -3886 }, + { 5464, 2109, 2398, -3194 }, + { 5616, -407, 2140, -498 }, + { 6121, 2707, 2379, -4096 }, + { 7303, 1846, 2266, -4095 }, + { 5444, 470, 2718, -1553 }, + { 5817, -645, 3285, -1349 }, + { 5625, 1427, 1103, -1991 }, + { 6041, -806, 1196, -2943 }, + { 3050, -5722, 4070, -5460 }, + { 3420, -4386, 4078, -5155 }, + { 6020, -3982, 7268, -2689 }, + { 7502, -4317, 7894, -3973 }, + { 4156, -3558, 5247, -4316 }, + { 4725, -4401, 7290, -1540 }, + { 6688, -5122, 8216, -3210 }, + { 9176, -6576, 9276, -4963 }, + { 8706, -5708, 7987, -4621 }, + { 7060, -3535, 6532, -3308 }, + { 5600, -2719, 5363, -1568 }, + { 4661, -2803, 6263, -4716 }, + { 3673, -3636, 6147, -3433 }, + { 5305, -2585, 6073, -2638 }, + { 7614, -1962, 6079, -5266 }, + { 6760, -3366, 7382, -4322 }, + { 6385, -3883, 4797, -1353 }, + { 8182, -5120, 4298, -4641 }, + { 9130, -6198, 4975, -3063 }, + { 7421, -5436, 5576, -3713 }, + { 3483, -4898, 5443, -2745 }, + { 4907, -5643, 6390, -4105 }, + { 8119, -7008, 7992, -6764 }, + { 6528, -6122, 6967, -5590 }, + { 5890, -4190, 6624, -5688 }, + { 6815, -7934, 7275, -5456 }, + { 5434, -4306, 5169, -5378 }, + { 4364, -6436, 5376, -2604 }, + { 8152, -3404, 5913, -5048 }, + { 7983, -4863, 4262, -2461 }, + { 8023, -6188, 6238, -5062 }, + { 6753, -3692, 3935, -3723 }, + { 6826, -4760, 3284, -4051 }, + { 7224, -7423, 4492, -3875 }, + { 6904, -2590, 6587, -6248 }, + { 6106, -1944, 7345, -5506 }, + { 4956, -2990, 7808, -3146 }, + { 6908, -6885, 5949, -1288 }, + { 7162, -6058, 3419, -3401 }, + { 7015, -7080, 6907, -3018 }, + { 6971, -6832, 5646, -3273 }, + { 8014, -5546, 5471, -1544 }, + { 6792, -2220, 5105, -2879 }, + { 8494, -3974, 4408, -3999 }, + { 9591, -4866, 6027, -4558 }, + { 5264, -5161, 6101, -738 }, + { 5803, -6141, 5197, -5231 }, + { 4657, -6822, 3232, -5189 }, + { 4791, -5135, 3809, -4665 }, + { 6108, -5103, 2379, -3873 }, + { 4680, -3909, 3234, -5093 }, + { 5802, -3853, 3795, -4984 }, + { 4360, -7483, 4802, -3877 }, + { 5429, -7517, 5911, -3717 }, + { 6866, -2280, 4880, -4634 }, + { 10131, -4628, 4414, -4092 }, + { 10811, -5189, 7746, -5337 }, + { 5663, -8941, 5287, -5680 }, + { 8023, -5991, 7403, -2796 }, + { 9669, -6919, 6525, -4932 }, + { 7275, -3796, 4962, -2547 }, + { 8848, -4806, 5677, -3080 }, + { 8128, -4308, 7749, -6569 }, + { 4032, -5196, 2282, -6239 }, + { 6593, 700, -229, 304 }, + { 8260, 539, -66, -1259 }, + { 6605, 176, -814, -109 }, + { 8057, 0, -1, -136 }, + { 7382, -38, -484, -1129 }, + { 8373, -929, 682, -454 }, + { 7674, 690, -1278, 546 }, + { 7326, -517, 406, -1283 }, + { 7612, -1715, -1167, 1175 }, + { 8590, 441, -782, -710 }, + { 8572, -1202, -291, 260 }, + { 7308, -147, -1785, 414 }, + { 6787, -353, -672, 934 }, + { 5177, -133, 179, 82 }, + { 4161, -34, 447, 1497 }, + { 5997, -902, 1533, -121 }, + { 5727, -871, -1370, 945 }, + { 8386, -252, 293, -823 }, + { 6573, -1354, 682, 616 }, + { 7650, -2096, 725, 457 }, + { 8122, 78, 636, -1400 }, + { 8421, 428, -1620, 131 }, + { 7341, -1292, -717, 186 }, + { 7998, -49, -720, 266 }, + { 5987, -351, 669, 844 }, + { 7314, -1620, 250, -603 }, + { 7219, -1562, -572, 1994 }, + { 8682, -358, -290, -388 }, + { 5810, 155, -178, 1199 }, + { 7246, -12, 1042, -786 }, + { 7357, -923, 1468, -475 }, + { 7801, 621, -212, -724 }, + { 5346, -514, 1210, 1356 }, + { 8459, 36, -127, -779 }, + { 6878, -2429, 854, 1750 }, + { 7280, -1401, -1353, 2845 }, + { 7579, -2148, -1463, 2087 }, + { 6637, 946, -872, 750 }, + { 4807, -1100, 1289, 2602 }, + { 4495, 219, 1551, 1128 }, + { 7639, 506, 446, -1107 }, + { 6359, 188, 1009, -115 }, + { 6641, -1820, 1655, 723 }, + { 5394, -2382, 1604, 2542 }, + { 6021, -2644, 2396, 1407 }, + { 4698, 882, 245, 1525 }, + { 8103, 573, -798, -349 }, + { 8045, -519, 997, -1092 }, + { 7571, -122, 227, -338 }, + { 5347, -1200, 630, 1718 }, + { 7070, 790, 218, -544 }, + { 7440, 728, -527, -20 }, + { 6402, -355, 197, -736 }, + { 4031, 771, 866, 1895 }, + { 6009, 896, 445, -31 }, + { 5160, 1098, -856, 1784 }, + { 7980, -886, -1293, 1396 }, + { 6318, -1361, 2423, 252 }, + { 7547, -699, 133, 506 }, + { 8562, -2344, 940, 264 }, + { 5890, 1187, -1425, 2194 }, + { 6558, -645, -1311, 2621 }, + { 4634, -1671, 2075, 1623 }, + { 5614, 105, -816, 2376 }, + { 6646, 1558, -1365, 630 }, + { 6998, 1150, -2117, -990 }, + { 6555, 2311, -1093, -1783 }, + { 6682, 1430, -2391, -1940 }, + { 7861, 1555, -2977, -1188 }, + { 6745, 1723, -459, -2085 }, + { 7504, 1229, -1666, -2060 }, + { 7937, 671, -2128, -1529 }, + { 7139, 991, -735, -2632 }, + { 6867, 1592, -1303, -2324 }, + { 6401, 2230, -1732, -2508 }, + { 7201, 2184, -2169, -1988 }, + { 6636, 2190, -995, -2840 }, + { 7620, 2306, -2089, -651 }, + { 7584, 1875, -1438, -631 }, + { 9214, 1561, -2464, -1139 }, + { 6154, 1318, -1237, -2917 }, + { 7917, 2847, -1797, -1599 }, + { 8309, 2029, -2555, -465 }, + { 8204, 1282, -584, -2405 }, + { 8440, 1035, -1147, -1137 }, + { 7107, 1858, -60, -1568 }, + { 6781, 2912, -873, -1463 }, + { 7603, 1316, -319, -1249 }, + { 7833, 1335, -78, -1849 }, + { 7930, 1141, -1016, -695 }, + { 7883, 1610, -1017, -1314 }, + { 8069, 1409, -1811, -196 }, + { 8319, 1031, -582, -1590 }, + { 5948, 1537, -2153, -2373 }, + { 8684, 1171, -1871, -850 }, + { 8357, 2484, -2411, -1292 }, + { 6516, 2092, -193, -1167 }, + { 6112, 1697, 22, -525 }, + { 7161, 703, -602, -1879 }, + { 6047, 2351, -807, -219 }, + { 8072, 1854, -1817, -1553 }, + { 6956, 1304, 76, -1011 }, + { 6607, 1481, -544, -162 }, + { 6958, 2541, -265, -1938 }, + { 6416, 2514, -777, -850 }, + { 7272, 2110, -899, -1171 }, + { 7741, 2153, -283, -2614 }, + { 6482, 2041, -1758, -1221 }, + { 6762, 940, -1862, -2281 }, + { 5610, 1194, -1691, -1561 }, + { 7833, 2164, -823, -1952 }, + { 5460, 1438, -848, 1189 }, + { 6011, 1377, -771, -1557 }, + { 7679, 544, -1134, -2214 }, + { 7209, 1292, -2714, -1564 }, + { 5567, 1200, -404, -169 }, + { 5853, 1461, -1465, -518 }, + { 6782, 689, -844, -860 }, + { 7330, 1337, -1152, -71 }, + { 7189, 1506, -653, -685 }, + { 6860, 2116, -1403, -240 }, + { 8804, 1516, -1391, -1760 }, + { 7210, 2689, -1498, -989 }, + { 7030, 3022, -1441, -2083 }, + { 5649, 1836, -407, 525 }, + { 7451, 3099, -717, -2464 }, + { 7384, 1656, -2007, 398 }, + { 6504, 707, -1919, -134 }, + { -1851, 3639, -2279, -695 }, + { -4037, 1644, -77, 1329 }, + { -4025, 1960, -1565, -567 }, + { -3430, 2495, -795, 368 }, + { -4771, 2480, 993, 756 }, + { -3431, 2058, -2539, -971 }, + { -3802, 3418, 380, 217 }, + { -3074, 3350, -1652, -1056 }, + { -3705, 326, -1650, 1535 }, + { -3122, 1281, -1192, 1607 }, + { -4601, 1367, -968, 53 }, + { -3808, 958, 44, 2560 }, + { -2079, 2530, -1485, 1166 }, + { -3707, 343, -2889, 180 }, + { -5249, 1431, -31, 688 }, + { -4990, 125, -704, 1270 }, + { -2771, 1334, -2446, 746 }, + { -2292, 994, -1527, 2630 }, + { -1261, 3070, -2519, 268 }, + { -2544, 3890, -1057, -552 }, + { -4421, 255, -1980, 530 }, + { -2951, 454, -13, 3643 }, + { -2262, 1815, -370, 2880 }, + { -2383, 3657, -649, 576 }, + { -3541, -161, -1389, 2550 }, + { -4241, 1575, 1325, 2561 }, + { -2767, 4037, 1221, 1578 }, + { -3748, 2697, 1148, 1801 }, + { -4686, 2385, -220, 0 }, + { -1531, 1645, -2751, 1327 }, + { -45, 4032, -799, 2298 }, + { -2915, 2280, 709, 2495 }, + { -1199, 3278, -406, 2346 }, + { -2471, 116, -2706, 2060 }, + { -2440, 2173, -2894, -344 }, + { -3375, 2287, 1781, 3226 }, + { -2153, 3568, 1827, 2918 }, + { -862, 2267, -1626, 2527 }, + { -2698, 1135, 301, 4239 }, + { -2364, 2123, 1010, 3710 }, + { -2447, 3281, -81, 1408 }, + { -2660, 4735, 472, 258 }, + { -1053, 3097, 2682, 2398 }, + { -3366, -1037, -1152, -868 }, + { -643, 4242, 2212, 1259 }, + { 971, 3991, 934, 643 }, + { -1617, 2002, 2139, 2195 }, + { -4897, 972, 784, 1719 }, + { -1275, 2992, 1039, 3821 }, + { -392, 4973, -209, 1821 }, + { -1028, 4718, -1479, -137 }, + { 50, 3914, 553, 2210 }, + { 678, 4364, 359, 1303 }, + { -582, 4911, 514, 1671 }, + { 1276, 3914, -1252, 2934 }, + { -1496, 3984, 857, 2330 }, + { 772, 4744, -655, 2332 }, + { -799, 5283, -439, 624 }, + { 1341, 2937, 650, 2027 }, + { -1739, 4892, 1275, 1702 }, + { -892, 2596, -151, 3951 }, + { -3532, 1090, 1292, 32 }, + { 321, 3146, 2647, 1475 }, + { 264, 4199, -1591, 1317 }, + { -452, -2357, 2266, 4192 }, + { 3022, -1033, -2389, 5678 }, + { -1162, -1342, 3543, 4990 }, + { -474, -1477, -1223, 5016 }, + { -699, -2857, 900, 3835 }, + { -461, -2255, -117, 4626 }, + { 1204, -2062, -1211, 4403 }, + { 2192, -3035, -337, 3966 }, + { 108, -831, 279, 5643 }, + { 1457, -620, -2908, 5276 }, + { -2527, -78, 1085, 5460 }, + { -1978, -1918, -949, 4733 }, + { 32, 367, -1904, 5166 }, + { 1890, -1665, 440, 4752 }, + { -518, -348, 2816, 4891 }, + { 3695, -2490, -1374, 4603 }, + { 246, -1965, 3549, 3969 }, + { 1100, -3111, 656, 3737 }, + { -1379, 870, -414, 4575 }, + { 628, -357, -1227, 6179 }, + { -1129, -1318, -2457, 4576 }, + { -425, -98, -73, 6336 }, + { 367, -887, 2990, 4207 }, + { 2091, -1251, 2444, 3557 }, + { -1759, -1610, 2046, 5273 }, + { 3210, 1414, -20, 2616 }, + { 3303, -2636, 1005, 4237 }, + { -327, -3107, -640, 3687 }, + { -197, 764, 572, 5486 }, + { 646, -767, 1388, 5464 }, + { 104, 2742, -228, 3907 }, + { -236, 1829, -579, 4585 }, + { -2150, -474, -1525, 4006 }, + { -23, -2632, -2400, 3892 }, + { -12, -1739, -2910, 4867 }, + { -2310, -368, -102, 4583 }, + { -1991, -2061, 533, 4531 }, + { 3884, -1446, -153, 4393 }, + { 1568, 14, -289, 5268 }, + { -1376, -253, -2797, 3417 }, + { 3193, -2577, 2475, 3566 }, + { 3418, 617, 1350, 1857 }, + { 3792, -24, -272, 3370 }, + { 153, 1159, 2906, 2877 }, + { 511, 2162, 1548, 2741 }, + { 262, 819, -2791, 3734 }, + { 4232, -2015, 1486, 3477 }, + { 2943, -1110, -1014, 5480 }, + { 2842, 369, 703, 3476 }, + { 3011, 1634, -933, 3553 }, + { 4412, -1548, -942, 5021 }, + { -1405, 593, 2372, 5267 }, + { 2093, 2129, 896, 2365 }, + { 4845, -1980, 0, 3823 }, + { -2140, 81, 3278, 5637 }, + { 1484, 2665, -324, 3653 }, + { 10, 192, 1620, 5291 }, + { 2152, 738, -2269, 5000 }, + { 2102, 2748, -1652, 4707 }, + { 2855, -2131, -387, 5188 }, + { 1173, 676, 1338, 3277 }, + { 2340, -2329, -2064, 4095 }, + { 861, -2024, 1296, 5055 }, + { 2189, 3225, -695, 2626 }, + { 6196, -7079, 1943, -822 }, + { 4547, -4813, 3261, 1856 }, + { 4243, -6904, 3443, 448 }, + { 4581, -7503, 946, 506 }, + { 6626, -7754, 3427, 470 }, + { 3407, -9088, 3269, -1496 }, + { 4079, -6464, 2304, 777 }, + { 5621, -9336, 2684, -768 }, + { 5351, -6464, 5238, -214 }, + { 5961, -8007, 1724, -3091 }, + { 4213, -8067, 603, -246 }, + { 7208, -7403, 3168, -1738 }, + { 6098, -7700, 329, -1379 }, + { 6525, -6735, 4248, -1072 }, + { 6073, -6241, 2167, -2378 }, + { 4609, -9218, 3051, -1033 }, + { 6813, -7283, 1581, -1897 }, + { 6126, -6275, 2789, 681 }, + { 4423, -6538, 1621, -1692 }, + { 6272, -8298, 3167, -1855 }, + { 6172, -8558, 4498, -1169 }, + { 4844, -8588, 1647, -366 }, + { 6209, -8807, 1581, -369 }, + { 5389, -8059, 550, -192 }, + { 6654, -9775, 2504, -1063 }, + { 7103, -7998, 806, 530 }, + { 5662, -6736, 1565, -3620 }, + { 4165, -9564, 4191, -2131 }, + { 4526, -7181, 576, -2875 }, + { 4633, -8623, 2807, -4742 }, + { 3709, -7794, 1815, 34 }, + { 3634, -8622, 2313, -826 }, + { 6991, -8447, 2063, -3198 }, + { 7757, -9486, 2255, -558 }, + { 4149, -7778, 4728, -1696 }, + { 5767, -7427, 1113, 707 }, + { 4592, -6261, 2329, 1864 }, + { 3159, -10498, 1677, -4273 }, + { 3534, -9010, 2437, -3565 }, + { 4479, -10821, 2715, -4942 }, + { 3207, -9805, 3054, -3886 }, + { 4627, -8189, 3018, -2354 }, + { 5527, -10566, 3244, -2749 }, + { 4346, -10127, 3335, -3084 }, + { 6132, -10085, 3316, -1308 }, + { 5629, -9704, 2178, -3058 }, + { 3603, -8538, 1246, -624 }, + { 3737, -8488, 395, -3167 }, + { 5465, -11414, 2810, -4640 }, + { 5306, -7745, 2721, -3988 }, + { 7000, -9111, 1695, -1409 }, + { 6663, -7741, 2466, -4079 }, + { 4083, -7175, 1836, -4831 }, + { 3613, -9926, 1342, -3455 }, + { 6588, -8033, 457, -258 }, + { 4720, -8102, 17, -1209 }, + { 7414, -8709, 1294, -344 }, + { 5437, -10030, 4043, -1704 }, + { 4862, -9281, 1558, -1431 }, + { 6800, -6403, 5113, 862 }, + { 4623, -8242, 2667, -228 }, + { 5919, -5083, 3348, 2135 }, + { 5985, -8889, 2733, -5105 }, + { 5029, -5767, 4407, 719 }, + { 354, -6158, -838, -3001 }, + { 351, -5943, -2104, -1534 }, + { -633, -7190, -25, -4798 }, + { -1595, -7235, -3812, -1400 }, + { 103, -6197, -2933, -78 }, + { -1722, -5020, -3441, -4333 }, + { -1963, -5644, -4365, -270 }, + { -846, -5743, -3477, 196 }, + { -191, -5348, -4054, -469 }, + { -2515, -7754, -3495, -818 }, + { -2090, -6710, -2701, 117 }, + { -546, -7036, -1398, 163 }, + { -278, -7091, -2662, -536 }, + { -622, -7962, -2731, -1464 }, + { -1555, -8118, -3612, -2057 }, + { -1094, -6280, -2314, 505 }, + { -2556, -8538, -4024, -2247 }, + { 109, -7134, -3107, -1823 }, + { -900, -6954, -3340, -717 }, + { -605, -7113, -3656, -2154 }, + { 837, -6263, -3211, -2177 }, + { -417, -5810, -3871, -1469 }, + { -1318, -5649, -4207, -3198 }, + { 413, -6765, -2082, -33 }, + { -3101, -6450, -4362, -766 }, + { 755, -6489, -2967, -846 }, + { 1117, -7106, -2452, -1352 }, + { -1202, -8387, -3072, -2897 }, + { -365, -4894, -3561, -2937 }, + { -2372, -8776, -265, -4441 }, + { -1224, -8678, -896, -5074 }, + { -755, -10096, -600, -6623 }, + { 300, -8206, -225, -4568 }, + { -1176, -6824, -2633, -3527 }, + { -2006, -5443, -1526, -5849 }, + { -1115, -5540, -2363, -4785 }, + { 1059, -6812, -2543, -2654 }, + { -1976, -6861, -3062, -5508 }, + { -379, -5328, -2321, -3624 }, + { -2108, -5860, -4518, -1915 }, + { -379, -7885, -1329, -594 }, + { 774, -5389, -581, -5213 }, + { -2601, -5083, -1849, -4921 }, + { -176, -5580, 74, -5075 }, + { -204, -6780, -190, -6232 }, + { 418, -7594, -1987, -820 }, + { -1873, -8529, -2926, -1609 }, + { 1340, -6362, -919, -4975 }, + { 577, -7990, -2044, -1873 }, + { -2572, -7413, -1745, -2224 }, + { -2037, -7030, -1461, -7138 }, + { -2559, -8756, -2039, -5836 }, + { -2079, -6764, -1209, -5669 }, + { -1613, -7801, -2006, -685 }, + { -1865, -6583, -722, -3529 }, + { -589, -6358, -1377, -1003 }, + { -540, -7514, -1331, -3542 }, + { 419, -6192, -1677, -4927 }, + { -2786, -8763, -2966, -5065 }, + { -2172, -8411, -1726, -4675 }, + { -3382, -9833, -3497, -5722 }, + { -2433, -10169, -2077, -5775 }, + { -424, -9451, -1096, -3658 }, + { -537, -8522, -910, -1897 }, + { -5550, 2807, 1683, -693 }, + { -6395, 635, 3573, -1246 }, + { -7544, 2280, 2140, 44 }, + { -8751, 1136, 2951, -794 }, + { -5605, 2709, 2052, 916 }, + { -7650, 654, 869, 135 }, + { -6939, 967, 1409, 870 }, + { -7834, 2123, 3310, 974 }, + { -6935, 2818, 1274, -1678 }, + { -5605, 2233, 1013, 471 }, + { -7095, 1849, 1648, 198 }, + { -6636, 1634, 712, -37 }, + { -7279, 978, 296, -315 }, + { -7664, 3504, 3292, -216 }, + { -7836, 1209, 1221, -257 }, + { -7913, 2201, 1765, -1529 }, + { -7077, 3783, 2632, -1407 }, + { -5565, 1645, 1410, -622 }, + { -6494, 2879, 1181, -759 }, + { -7073, 3137, 3010, 550 }, + { -7249, 1839, 847, -805 }, + { -6630, 2197, 282, -1096 }, + { -8836, 1573, 1988, -1090 }, + { -7809, 1274, 836, -1198 }, + { -7895, 2970, 3511, -1097 }, + { -6960, 1664, 1356, -2442 }, + { -6582, 2866, 2273, 307 }, + { -7221, 821, 2851, -1435 }, + { -6015, 1703, 2001, -2367 }, + { -8082, 1034, 2103, 239 }, + { -5952, 1912, 301, -465 }, + { -6099, 841, 379, 567 }, + { -6343, 50, 494, 658 }, + { -6586, 983, 591, -893 }, + { -5500, 869, 2187, -2479 }, + { -6482, 60, 1545, -979 }, + { -6705, 515, 1974, -53 }, + { -6460, 1755, 1325, -1275 }, + { -6093, 2617, 2465, -623 }, + { -7330, 2161, 594, -2115 }, + { -7324, 762, 1593, -2004 }, + { -6385, 679, 1510, -2514 }, + { -6159, 241, 2976, -1631 }, + { -8583, 3030, 4045, -162 }, + { -6299, 66, 2209, -2103 }, + { -5428, 1279, 3267, -1846 }, + { -6438, 1335, 2728, -1631 }, + { -8012, 1070, 2428, -1151 }, + { -6201, 2781, 2349, -1918 }, + { -5918, 1139, 3121, -148 }, + { -6314, 2481, 3137, -1808 }, + { -7180, 1722, 2435, -1602 }, + { -6750, 1829, 3763, -1145 }, + { -6713, 1777, 2221, 1212 }, + { -7479, 1835, 3627, -479 }, + { -7299, 10, 2406, -1593 }, + { -8249, 3129, 996, -2870 }, + { -8374, 1534, 1333, -1882 }, + { -7507, 3353, 1598, -2299 }, + { -7379, 2701, 2326, -1167 }, + { -8440, 2276, 2796, -542 }, + { -10348, 1527, 2649, -1165 }, + { -8184, 3614, 2574, -1738 }, + { -5539, 1574, 1733, 1138 }, + { 9404, -7652, 67, 79 }, + { 8654, -3972, 1358, -60 }, + { 8617, -4794, 117, 2318 }, + { 7886, -4505, 1784, 1200 }, + { 8636, -6125, 3879, -1003 }, + { 9654, -6836, 1816, 205 }, + { 9374, -6553, 913, 1875 }, + { 8020, -6150, 1134, 2390 }, + { 7786, -4970, 2078, -1857 }, + { 8691, -6119, 711, 708 }, + { 9039, -5568, 2944, -1902 }, + { 9955, -5048, 1433, -601 }, + { 8089, -6927, 3093, -2846 }, + { 8487, -7024, 2415, 19 }, + { 9388, -5287, 3577, -2655 }, + { 8591, -7371, 2300, -996 }, + { 9104, -4763, 1453, -2558 }, + { 7615, -5457, 596, 164 }, + { 9860, -7047, 3433, -614 }, + { 8756, -4404, 2235, -964 }, + { 9462, -4660, 299, -1822 }, + { 10119, -5550, 2689, -1273 }, + { 10915, -7471, 2705, -1007 }, + { 11433, -7090, 1410, -1198 }, + { 9882, -7431, 2965, -1895 }, + { 7628, -5219, 769, -2661 }, + { 8169, -5318, 2262, 70 }, + { 8846, -6320, 1939, -754 }, + { 7147, -5593, 1248, -971 }, + { 10652, -5485, 935, 137 }, + { 7778, -6533, 2564, -1932 }, + { 8878, -5173, 1214, -361 }, + { 9828, -4943, 282, 510 }, + { 10042, -6134, 3895, -1914 }, + { 7965, -6630, 3566, -433 }, + { 8573, -4502, 3574, -1209 }, + { 8398, -4801, 1031, -1347 }, + { 10136, -7772, 2612, 1547 }, + { 9890, -7280, 1768, -1083 }, + { 8407, -6585, -706, -58 }, + { 7976, -7582, 229, -131 }, + { 10481, -8866, 1166, -147 }, + { 10914, -4342, 3189, -2412 }, + { 10440, -5198, -104, -1109 }, + { 11227, -6530, 2381, -2449 }, + { 8487, -8064, 1086, 230 }, + { 9975, -6123, -857, -134 }, + { 8339, -6498, 1232, -2337 }, + { 11042, -4506, 1119, -2098 }, + { 12563, -5592, 1837, -2062 }, + { 11801, -5590, 632, -1296 }, + { 10152, -5617, 1511, -1917 }, + { 7800, -6473, 51, -1337 }, + { 7941, -5560, 2438, -3270 }, + { 6554, -3834, 2100, 1476 }, + { 9065, -5520, -226, -1120 }, + { 10794, -7120, -243, 122 }, + { 10429, -6968, 272, -806 }, + { 8942, -8914, 1442, -392 }, + { 9969, -5051, 2033, -2953 }, + { 7275, -4152, 3058, -64 }, + { 11127, -5488, 4589, -3227 }, + { 9626, -6666, 2739, -2958 }, + { 6943, -5362, 4470, 1008 }, + { -7456, -967, 2936, -1002 }, + { -8622, -333, 6962, 2606 }, + { -7486, -3392, 3668, 1287 }, + { -8053, -827, 5148, 1097 }, + { -6610, 454, 4952, 96 }, + { -7701, -1982, 3161, -468 }, + { -7307, -1132, 4071, -36 }, + { -8125, -271, 5199, 3862 }, + { -9182, -1950, 2813, 1878 }, + { -9855, -952, 4794, 3010 }, + { -7241, 1431, 4202, 2468 }, + { -9646, 157, 4766, 1046 }, + { -9371, 1230, 6009, 2958 }, + { -11514, -64, 8630, 5248 }, + { -6766, 565, 2766, 2140 }, + { -8426, -9, 2852, 1271 }, + { -11291, -1113, 5087, 2937 }, + { -8297, 2092, 4495, 1264 }, + { -9983, 735, 3809, -51 }, + { -9048, -1000, 3191, -308 }, + { -7331, -1987, 2655, 1391 }, + { -7144, -21, 4333, 2161 }, + { -6032, -1540, 3543, 896 }, + { -7987, -1036, 1985, 1529 }, + { -9264, 2004, 5194, 290 }, + { -11308, -840, 5754, 1654 }, + { -9130, -2398, 4292, 2973 }, + { -6248, 838, 3563, 1223 }, + { -6819, -2760, 3511, 119 }, + { -7213, -2006, 4364, 762 }, + { -5431, -1047, 4533, 166 }, + { -7098, -641, 2021, 639 }, + { -8628, -2249, 3588, 399 }, + { -6352, -1498, 3560, -648 }, + { -7033, -2190, 4870, 2562 }, + { -7405, -46, 3772, -581 }, + { -6104, 796, 5143, 1965 }, + { -5787, 943, 5784, 3030 }, + { -8367, 1465, 7192, 4097 }, + { -8259, 789, 5694, 1963 }, + { -10614, -1899, 5748, 2645 }, + { -8258, -805, 3698, 2275 }, + { -6877, -972, 6431, 3160 }, + { -6483, 363, 7018, 3129 }, + { -6283, -1358, 5191, 1524 }, + { -8853, -3157, 4119, 1741 }, + { -6086, -267, 3883, -835 }, + { -7254, 1032, 6613, 4017 }, + { -11470, -3350, 4649, 3426 }, + { -6743, 481, 6148, 1239 }, + { -5394, -166, 5309, 3165 }, + { -7958, 1068, 4268, -240 }, + { -10520, 2256, 7916, 2828 }, + { -5132, -4, 5739, 1176 }, + { -8643, 120, 3255, -629 }, + { -9631, 1974, 8870, 4362 }, + { -10663, -1221, 3733, 589 }, + { -8224, -1843, 5806, 2655 }, + { -8282, 1255, 8647, 3478 }, + { -12311, -1505, 9043, 6256 }, + { -11312, -856, 7136, 4681 }, + { -11944, -722, 7941, 3309 }, + { -7868, -463, 6846, 4196 }, + { -8679, -241, 7410, 5347 }, + { 6759, -4680, -508, 1220 }, + { 5176, -6111, 944, 121 }, + { 6843, -5667, -1368, -533 }, + { 5616, -5884, -1471, -695 }, + { 6030, -5089, -1808, -940 }, + { 7444, -5463, -52, 1881 }, + { 4207, -6079, -506, 1571 }, + { 6785, -4410, -649, 3084 }, + { 4838, -5214, 2026, 2998 }, + { 4201, -5790, 645, 1811 }, + { 6930, -5129, -1940, 1698 }, + { 6332, -4627, 692, 3027 }, + { 6285, -4314, -106, 3644 }, + { 6255, -5450, -1975, 742 }, + { 4199, -4676, -459, 1796 }, + { 5592, -5500, 1345, 1300 }, + { 4358, -5556, -2236, 114 }, + { 4620, -5875, -1563, 888 }, + { 4892, -7550, -327, -419 }, + { 4734, -7085, 7, 613 }, + { 3883, -5562, -1969, 1080 }, + { 5610, -4990, -204, 834 }, + { 4117, -6482, -1271, 341 }, + { 6585, -5107, 892, 1169 }, + { 6632, -3683, 302, 3002 }, + { 6326, -5351, -983, -1250 }, + { 4382, -7192, -730, -158 }, + { 5227, -6540, -451, 1123 }, + { 5468, -6472, -870, -1471 }, + { 5191, -6402, -1365, -127 }, + { 7407, -6317, -973, -336 }, + { 4611, -6530, -820, -1980 }, + { 4963, -5159, -2050, -966 }, + { 4414, -5691, -211, -998 }, + { 5954, -5873, 750, -1749 }, + { 4394, -4796, -1268, 254 }, + { 7161, -6214, -1010, 689 }, + { 4965, -3598, 2372, 1711 }, + { 6248, -6180, 981, 864 }, + { 6473, -5336, 525, -600 }, + { 4591, -6864, -1131, -900 }, + { 6314, -6440, -1021, -375 }, + { 5838, -6209, -1199, 944 }, + { 5308, -5283, -2100, 1267 }, + { 4342, -5860, -1637, -1356 }, + { 5680, -4388, -1227, -104 }, + { 4900, -4098, 1449, 4046 }, + { 4677, -4284, -106, 3190 }, + { 7574, -6173, -848, 1859 }, + { 6493, -7207, -131, 726 }, + { 5513, -5261, -2117, 4 }, + { 6191, -7352, -193, -505 }, + { 5885, -4333, 324, -134 }, + { 6162, -6081, -312, -2044 }, + { 4216, -6200, -1810, -572 }, + { 5652, -7035, -696, -197 }, + { 7131, -7189, -366, -60 }, + { 5032, -4803, -1514, 2832 }, + { 7386, -4610, -606, 3489 }, + { 4211, -5031, 1221, 3047 }, + { 4050, -4653, 1584, 1469 }, + { 6852, -5302, -1861, 206 }, + { 7736, -4816, -1794, 3359 }, + { 6290, -3439, 1522, 2454 }, + { 1768, 5990, -5560, -2594 }, + { 3903, 5326, -1530, -1501 }, + { 2472, 3738, -2117, -4240 }, + { 3260, 5448, -904, -4733 }, + { 1435, 7297, -3676, -4102 }, + { 4096, 5951, -656, -3312 }, + { 2178, 6009, -3146, -3724 }, + { 3787, 5493, -5473, -1633 }, + { 2998, 7286, -3334, -3571 }, + { 2894, 6576, -4708, -2804 }, + { 830, 6163, -4286, -3348 }, + { 4755, 5569, -1730, -2739 }, + { 4604, 6065, -3562, -2605 }, + { 2749, 5141, -3986, -2775 }, + { 3942, 4875, -2143, -3340 }, + { 2819, 8517, -2004, -2724 }, + { 2146, 6298, -689, -3093 }, + { 5196, 6504, -3393, -1475 }, + { 1851, 8386, -1748, -1420 }, + { 3474, 8572, -3534, -2688 }, + { 4503, 7560, -3561, -2245 }, + { 4433, 6219, -2393, -1575 }, + { 3506, 7248, -2275, -1977 }, + { 3490, 7409, -3147, -604 }, + { 4214, 6447, -3520, 516 }, + { 619, 7034, -829, -1705 }, + { 1732, 7395, -356, -2208 }, + { 1226, 5204, -3294, -3732 }, + { 2027, 5619, -1813, -4146 }, + { 3078, 5877, 47, -2651 }, + { 1654, 5458, 424, -682 }, + { 3163, 5464, -2026, -270 }, + { 2884, 5375, -685, -530 }, + { 2950, 7286, -35, -2967 }, + { 1986, 5066, -597, 482 }, + { 3459, 4308, -3845, -2333 }, + { 3155, 7037, -1346, -4345 }, + { 2193, 6696, -717, -1319 }, + { 3677, 5089, -3892, -487 }, + { 2186, 5136, -4186, -1492 }, + { 773, 5796, -917, 817 }, + { 2489, 6546, -3570, -2117 }, + { 1223, 6469, -1362, -33 }, + { 271, 6061, -1466, -1725 }, + { 2540, 5171, -1847, 1032 }, + { 2548, 5251, -2697, 1677 }, + { 771, 7600, -768, -632 }, + { 4710, 6647, -4736, -1275 }, + { 1369, 5917, -2971, -1056 }, + { 163, 5239, -3499, -2275 }, + { 2104, 4285, -3211, -3286 }, + { 1107, 7411, -1972, -1671 }, + { 2196, 7262, -2310, -1926 }, + { -244, 6439, -1745, -839 }, + { 3293, 3832, -2890, -3000 }, + { 419, 6443, -379, -407 }, + { 3077, 4930, -1156, -2869 }, + { 2131, 5874, -2330, 224 }, + { 690, 6538, -2212, -2841 }, + { 1602, 4421, -2515, 1542 }, + { 3318, 9373, -3032, -3477 }, + { 5646, 7462, -5153, -1463 }, + { 4139, 7137, -1539, -3321 }, + { 3481, 9077, -1645, -3653 }, + { -7747, 375, -106, -543 }, + { -8587, -1379, -586, -461 }, + { -10146, -892, 2094, 694 }, + { -8103, 382, 504, -325 }, + { -8548, -92, 94, -656 }, + { -7460, 38, 152, 388 }, + { -8266, -271, -459, -883 }, + { -7935, -664, -1026, -802 }, + { -8341, -109, 853, 161 }, + { -8802, -1355, 1099, 630 }, + { -8957, -6, 1108, -669 }, + { -7260, -1520, -43, -407 }, + { -7555, -174, 668, -2562 }, + { -9014, -126, 227, -1191 }, + { -8184, 769, 290, -1375 }, + { -9476, 55, 962, -1528 }, + { -8679, 541, 755, -1030 }, + { -9842, -1626, 838, -1588 }, + { -8513, -702, 788, -1998 }, + { -10101, -1558, -366, -1841 }, + { -8135, 78, 1479, -1813 }, + { -9128, -454, 313, -1786 }, + { -7554, -1084, 831, -2442 }, + { -7576, -701, 2068, -1665 }, + { -7791, -1481, 1587, -1808 }, + { -6701, -596, -97, 802 }, + { -7418, -15, 684, -963 }, + { -7127, -477, -139, -426 }, + { -8097, -110, -36, -264 }, + { -7620, -1922, -590, -101 }, + { -7647, -1201, 279, 660 }, + { -7856, -1974, 758, -2271 }, + { -8496, -167, 2232, -1143 }, + { -8506, -1359, 624, -740 }, + { -7274, -1052, 1062, -139 }, + { -7800, -217, 91, -1794 }, + { -7030, -1694, -955, 615 }, + { -9020, -1864, 101, -2182 }, + { -9400, -740, 598, -667 }, + { -8448, -1184, 2024, -1272 }, + { -8812, -570, -897, -2384 }, + { -10559, -1286, 538, -1536 }, + { -8728, -888, -1089, -1397 }, + { -7080, -1185, 636, -1252 }, + { -9880, 233, 2344, -782 }, + { -7952, -1326, -378, -1947 }, + { -7207, -378, 1408, -2237 }, + { -8467, -1545, 902, -1987 }, + { -9163, -1474, 924, -1739 }, + { -8159, -992, -77, -2744 }, + { -8343, 148, -423, -1573 }, + { -9105, -649, -254, -1214 }, + { -8939, 456, 281, -1905 }, + { -8837, 179, -394, -2634 }, + { -9145, 757, 1547, -1319 }, + { -9775, -723, 441, -1680 }, + { -8910, -686, 1529, -1525 }, + { -9492, -1134, 2064, -938 }, + { -6111, -943, 677, -31 }, + { -7411, -613, -814, 46 }, + { -9479, -922, -430, -2061 }, + { -11298, -1268, 1318, -1117 }, + { -8190, 832, 671, -2214 }, + { -10453, -550, 1672, -886 }, + { 1044, 9353, -1651, -5423 }, + { 1034, 8149, -455, -6166 }, + { 761, 8293, -3214, -4838 }, + { 938, 8077, 164, -5130 }, + { 1295, 8673, 2582, -5490 }, + { -314, 7973, -2395, -5231 }, + { -507, 9012, -2497, -5775 }, + { 2396, 8314, -1022, -4673 }, + { -1516, 8501, 1950, -4969 }, + { -308, 7401, 1549, -4866 }, + { -112, 8340, 3003, -4920 }, + { -50, 9315, 1371, -5666 }, + { -659, 9449, 2496, -5547 }, + { 2573, 9148, -2270, -4783 }, + { 830, 7104, -438, -3907 }, + { 522, 10672, -677, -6483 }, + { -1190, 10108, -510, -6518 }, + { -427, 8271, -579, -6315 }, + { 1602, 8113, -1927, -4418 }, + { -2266, 8180, 448, -5190 }, + { -1633, 8816, -226, -5771 }, + { 759, 9481, -105, -5813 }, + { 2254, 6679, -466, -5662 }, + { -88, 6946, 895, -5958 }, + { -1705, 10009, 1394, -5574 }, + { 748, 7943, 540, -6692 }, + { 1411, 7009, 232, -6145 }, + { 697, 7290, -1221, -5342 }, + { -1764, 10580, 1944, -3981 }, + { -1334, 9124, 1195, -3903 }, + { -905, 10067, 635, -5039 }, + { 664, 10680, 49, -4625 }, + { 1374, 9536, -777, -3591 }, + { 252, 9698, -597, -2931 }, + { 824, 9164, -1014, -2144 }, + { 2438, 10569, -2289, -4424 }, + { 2101, 7102, 507, -3614 }, + { 294, 8051, -432, -1518 }, + { -665, 10337, 547, -2852 }, + { 1168, 11989, -492, -5427 }, + { 1344, 6416, 302, -5061 }, + { -1727, 12264, 1507, -4543 }, + { 674, 10889, -902, -3605 }, + { -582, 9504, 300, -3618 }, + { 641, 7654, 689, -2109 }, + { 2065, 9243, 508, -4367 }, + { 1055, 8373, 688, -3144 }, + { -641, 8185, 986, -3307 }, + { 1120, 7426, 1785, -3757 }, + { 1660, 8070, -593, -3104 }, + { 2002, 9467, -1722, -3475 }, + { 2361, 8368, 100, -3709 }, + { -772, 7845, -613, -4988 }, + { 1485, 7430, 1896, -6127 }, + { -432, 7823, -947, -2882 }, + { 313, 11122, -760, -4871 }, + { 412, 8412, -283, -4231 }, + { 1585, 10402, -1884, -3267 }, + { 321, 6952, 773, -3016 }, + { -105, 9014, 121, -2249 }, + { 1585, 10313, -977, -4812 }, + { 1619, 11869, 1306, -6876 }, + { -1168, 8886, -81, -2500 }, + { -395, 10886, 733, -6490 }, + { -4949, 4274, 3992, -1054 }, + { -4241, 5299, 4262, -1584 }, + { -2710, 3862, 4552, -1673 }, + { -4608, 2472, 3672, -1715 }, + { -2843, 2816, 4003, -2326 }, + { -5229, 2964, 5636, 90 }, + { -4924, 3442, 5015, -1096 }, + { -1281, 3313, 5537, -2066 }, + { -3808, 1939, 4351, -919 }, + { -1915, 2585, 4939, -1614 }, + { -3470, 1843, 5562, -682 }, + { -3800, 870, 5827, 144 }, + { -4985, 1452, 4728, -709 }, + { -3745, 2750, 7220, 259 }, + { -1875, 1900, 6514, -826 }, + { -4329, 1574, 7192, 1304 }, + { -5408, 1444, 6208, 631 }, + { -3327, 5312, 5707, -1541 }, + { -6966, 3334, 4034, 1028 }, + { -7484, 4245, 4218, -212 }, + { -6567, 5839, 4539, -512 }, + { -5715, 5935, 3747, -1186 }, + { -6410, 4881, 3356, -1610 }, + { -5146, 2590, 2850, 2172 }, + { -5196, 4095, 2569, -373 }, + { -5043, 6025, 4318, 692 }, + { -5525, 4884, 3513, 370 }, + { -6804, 7533, 5812, -488 }, + { -5657, 2480, 4061, 1234 }, + { -3155, 1472, 6071, 1188 }, + { -3427, 5217, 3442, 858 }, + { -4698, 3013, 5517, 2586 }, + { -4449, 2226, 5418, 3580 }, + { -6395, 3547, 5487, 2028 }, + { -3500, 5019, 4787, 1 }, + { -4038, 2578, 3073, 3151 }, + { -2750, 1955, 4469, 3856 }, + { -5696, 1659, 6118, 2469 }, + { -4350, 1241, 6840, 3126 }, + { -5565, 5058, 5196, 1314 }, + { -1642, 4190, 3948, 607 }, + { -1233, 4108, 4850, -640 }, + { -997, 3428, 3239, 1378 }, + { -6488, 2741, 6926, 2792 }, + { -4188, 3763, 4235, 2018 }, + { -3210, 3224, 5646, 1427 }, + { -5526, 6909, 5070, -627 }, + { -2815, 3994, 3425, 1903 }, + { -2163, 2734, 5423, 145 }, + { -4149, 4247, 2355, 734 }, + { -410, 2521, 4138, -16 }, + { -2411, 2385, 4927, 2105 }, + { -6077, 3591, 3114, 594 }, + { -4186, 4834, 5926, -1004 }, + { -7315, 3369, 5966, 448 }, + { -7042, 5721, 5771, 238 }, + { -4466, 3907, 3535, -1751 }, + { -2116, 3970, 6163, -1392 }, + { -7239, 2143, 8407, 3630 }, + { -5431, 4486, 6486, -42 }, + { -1874, 1617, 6333, 519 }, + { -6478, 2629, 4634, -505 }, + { -7784, 2342, 7216, 1365 }, + { -1154, 1432, 4831, 1544 }, + { -4964, -5801, 1797, 506 }, + { -4436, -6905, 1059, -1237 }, + { -5400, -6886, 884, -290 }, + { -6259, -7103, 523, -227 }, + { -4819, -6450, 1412, -450 }, + { -4056, -6213, 1725, -943 }, + { -5642, -6091, 1357, 605 }, + { -4196, -5678, 2187, -173 }, + { -4726, -5126, 2470, 321 }, + { -6642, -5091, 1507, -1005 }, + { -5304, -5250, 1944, 1579 }, + { -7179, -5520, 1468, -425 }, + { -6033, -4895, 1876, -955 }, + { -6595, -5143, 2207, 1291 }, + { -4224, -4943, 1846, 1792 }, + { -7128, -6950, 539, 724 }, + { -4369, -4901, 2590, 1103 }, + { -7413, -5696, 1712, 1440 }, + { -5885, -6821, 418, 871 }, + { -6828, -5599, 710, -1563 }, + { -6123, -5817, 1358, 1631 }, + { -5291, -5622, 578, 2138 }, + { -7171, -6004, 347, 2208 }, + { -6083, -5251, 2132, 425 }, + { -4329, -5721, 407, -2993 }, + { -5326, -5056, 1119, -1837 }, + { -5485, -5856, 185, -2389 }, + { -6529, -5178, 403, -697 }, + { -6719, -4412, 2726, 871 }, + { -5126, -5629, 1835, -771 }, + { -5622, -4361, 2973, 858 }, + { -5282, -5895, 45, -335 }, + { -4357, -5656, 1696, -1558 }, + { -7139, -6659, 627, -409 }, + { -4415, -6328, 35, 1306 }, + { -7639, -6110, 1134, 197 }, + { -3626, -5592, 2019, 901 }, + { -3547, -5064, 1176, 1738 }, + { -5075, -3899, 2087, 266 }, + { -4086, -6311, 1479, 360 }, + { -6210, -5220, -199, -1477 }, + { -3910, -5063, 1356, -15 }, + { -7616, -4977, 461, 2401 }, + { -6118, -6131, 1258, -563 }, + { -6127, -4968, 1286, -27 }, + { -4121, -5852, 1113, 1476 }, + { -5157, -4881, 1162, -662 }, + { -4637, -5031, 1179, 709 }, + { -5509, -5452, -397, 1224 }, + { -4597, -6861, 646, 467 }, + { -6247, -4043, 468, 278 }, + { -5336, -6465, 874, -1472 }, + { -6998, -6346, 78, -1798 }, + { -4915, -4530, 2756, -203 }, + { -6048, -4373, 1468, 1052 }, + { -4273, -7100, 942, -323 }, + { -6552, -4287, 2351, 69 }, + { -6954, -4613, 722, 1521 }, + { -4201, -5361, 763, -1562 }, + { -6881, -5596, -748, 669 }, + { -6695, -3547, -34, 1299 }, + { -3981, -5728, 84, 111 }, + { -4663, -4809, 2173, -1031 }, + { -6599, -6077, 1303, 256 }, + { -7596, -4265, -5791, -4140 }, + { -6610, -2758, -5288, -3936 }, + { -5880, -3865, -6563, -3088 }, + { -7228, -5510, -7677, -3912 }, + { -8854, -6553, -8318, -5361 }, + { -9362, -5249, -6413, -4319 }, + { -4418, -3110, -6368, -4358 }, + { -5544, -4203, -6863, -5013 }, + { -3056, -4316, -5567, -3181 }, + { -3078, -5999, -5051, -2657 }, + { -5884, -6292, -5756, -4013 }, + { -4825, -4549, -5535, -4053 }, + { -4443, -6126, -5316, -1368 }, + { -3972, -6341, -6098, -2686 }, + { -5751, -2781, -5398, -6230 }, + { -4466, -6135, -5570, -3679 }, + { -4291, -5992, -3564, -5189 }, + { -7189, -4429, -7279, -6082 }, + { -5076, -4433, -2748, -5366 }, + { -6225, -2825, -6833, -5663 }, + { -2989, -4792, -3960, -4492 }, + { -7836, -7773, -7722, -5741 }, + { -6559, -5703, -5844, -5589 }, + { -7612, -5438, -4136, -3774 }, + { -4218, -4176, -6591, -2333 }, + { -4837, -5063, -6581, 322 }, + { -6590, -5990, -2980, -3847 }, + { -5558, -2971, -5489, -1932 }, + { -7001, -5323, -4975, -1697 }, + { -4694, -2688, -6904, -3044 }, + { -8511, -5379, -5767, -2549 }, + { -7548, -5412, -6522, -2572 }, + { -6597, -4973, -6423, -1274 }, + { -6415, -4022, -5168, -1072 }, + { -5528, -5530, -7218, -2345 }, + { -4845, -4805, -5943, -1227 }, + { -6049, -7150, -6744, -2161 }, + { -9061, -7299, -8542, -4375 }, + { -5010, -5546, -5416, -82 }, + { -4135, -4205, -5109, -3373 }, + { -3311, -5869, -4007, -5061 }, + { -5993, -6472, -3962, -4718 }, + { -2966, -5832, -2821, -6305 }, + { -4851, -5152, -2067, -3930 }, + { -3620, -4441, -3362, -5836 }, + { -4469, -5221, -4534, -5592 }, + { -4022, -6335, -4321, -6107 }, + { -4899, -4503, -3084, -3725 }, + { -4490, -8276, -4620, -6236 }, + { -6591, -4342, -7365, -4063 }, + { -6498, -5057, -5553, 485 }, + { -6060, -2714, -7093, -4144 }, + { -6199, -7774, -7094, -4057 }, + { -7536, -6424, -6415, -4265 }, + { -7439, -2454, -6348, -4827 }, + { -5333, -7565, -4417, -4639 }, + { -4353, -7103, -4197, -2689 }, + { -5229, -6549, -5129, -6804 }, + { -6129, -7701, -5236, -4836 }, + { -6797, -3983, -3884, -4406 }, + { -6624, -4467, -4745, -5052 }, + { -3324, -7596, -2720, -6553 }, + { -5473, -6284, -1704, -4511 }, + { -4131, -7263, -3180, -5196 }, + { -7116, -5565, -3469, 685 }, + { -6002, -6021, -3858, 576 }, + { -3144, -8203, -1291, -434 }, + { -6096, -7027, -4004, 1353 }, + { -3943, -7709, -2344, -36 }, + { -4510, -6767, -2642, 631 }, + { -3657, -11541, -2570, -3984 }, + { -5959, -8854, -1333, -867 }, + { -6699, -8866, -1606, -344 }, + { -3836, -7961, -2334, -2028 }, + { -3430, -8045, -3037, -672 }, + { -3868, -9184, -3635, -1819 }, + { -4258, -9060, -2621, -1008 }, + { -3595, -8693, -2022, -752 }, + { -4573, -8048, -3166, -2622 }, + { -4852, -7903, -1405, 256 }, + { -4591, -7057, -1560, 965 }, + { -6963, -7655, -980, 808 }, + { -5179, -6641, -3356, 1196 }, + { -7102, -6941, -2798, 2123 }, + { -6867, -5834, -3320, -770 }, + { -5977, -7369, -2500, -778 }, + { -6160, -6400, -934, -2543 }, + { -6741, -7608, -355, -1289 }, + { -6856, -6466, -1433, -1643 }, + { -4786, -6292, -4970, 376 }, + { -5407, -8866, -2255, -400 }, + { -3814, -6506, -1387, -3620 }, + { -4998, -6137, -1200, -4092 }, + { -5123, -9557, -2849, -1306 }, + { -4259, -6444, -4395, -338 }, + { -5221, -6810, -883, 1225 }, + { -6137, -6215, -2165, 554 }, + { -3895, -6557, -3176, -1829 }, + { -3886, -8188, -87, -954 }, + { -7243, -6707, -2216, -316 }, + { -5592, -7606, 85, -432 }, + { -3957, -7945, -504, -144 }, + { -4617, -7624, 218, -312 }, + { -4797, -8737, -844, -1051 }, + { -4478, -8516, -1401, -454 }, + { -4557, -7058, -302, -2332 }, + { -6623, -7736, -271, -50 }, + { -3157, -7532, -1111, -2207 }, + { -3590, -7300, -1271, 517 }, + { -4442, -7306, -507, 590 }, + { -6458, -7524, -2807, 666 }, + { -4991, -8466, -3363, -785 }, + { -7474, -7541, -1056, -1839 }, + { -7501, -8316, -938, -180 }, + { -5329, -7739, -579, -2341 }, + { -4549, -7063, -176, -3539 }, + { -5191, -8612, -1504, -4250 }, + { -3083, -7058, -2251, 32 }, + { -4003, -7043, -1093, -791 }, + { -5523, -8093, -678, -114 }, + { -3022, -10265, -2070, -3109 }, + { -3905, -6274, -182, -3652 }, + { -3269, -9217, -551, -2650 }, + { -3138, -9314, -1726, -1704 }, + { -4420, -10339, -1744, -3459 }, + { -4163, -8609, -2298, -4113 }, + { -5566, -6505, -1241, -463 }, + { -3130, -9746, -2352, -4884 }, + { -7825, -3439, 1451, -1468 }, + { -8451, -3318, 2360, -435 }, + { -8462, -4130, 1438, -1024 }, + { -9425, -4564, 1328, -689 }, + { -11014, -3202, 2278, 2080 }, + { -8269, -2761, -146, -440 }, + { -7497, -2618, -166, 413 }, + { -8250, -3060, 522, -2133 }, + { -8365, -5366, 1347, -451 }, + { -8589, -3979, 2943, 714 }, + { -8111, -2572, 1272, -1748 }, + { -7830, -5193, 605, -1484 }, + { -8119, -4736, 2141, 256 }, + { -7724, -4769, 1463, -812 }, + { -7363, -3911, 2540, 4 }, + { -7974, -3397, 2363, 1366 }, + { -7359, -4204, 1752, -958 }, + { -7622, -3505, 660, 916 }, + { -9934, -3665, 3165, 828 }, + { -8721, -4162, 62, 1718 }, + { -9433, -4768, 2722, 1234 }, + { -7960, -4496, 138, 1528 }, + { -8198, -3454, -443, 631 }, + { -7756, -2246, 655, 1137 }, + { -8841, -3145, 1113, 829 }, + { -7817, -3298, 1251, 230 }, + { -9413, -2733, 323, -1862 }, + { -9408, -4168, 1270, 1549 }, + { -9037, -3892, -942, 283 }, + { -8255, -3849, 1301, 1762 }, + { -9057, -3987, -41, -682 }, + { -9441, -4187, 2019, -111 }, + { -9740, -3178, 1602, -871 }, + { -8344, -2474, 1461, 1506 }, + { -9752, -2925, 1996, 1243 }, + { -9199, -3796, 180, 537 }, + { -9060, -2405, 1140, -1562 }, + { -9348, -2376, 309, -162 }, + { -10786, -3182, -5, -1500 }, + { -8142, -4540, -434, -826 }, + { -7528, -2341, 1104, -73 }, + { -9360, -2658, 3062, 56 }, + { -8267, -2335, 2000, -1193 }, + { -12169, -3154, 1287, -640 }, + { -11398, -2120, 946, -1163 }, + { -8940, -4559, 328, -1696 }, + { -11025, -4213, 2813, 840 }, + { -9224, -3581, 2224, 2039 }, + { -8943, -3337, 1248, -1298 }, + { -7900, -4042, 485, -2080 }, + { -9221, -1947, 2191, -880 }, + { -10762, -1800, 2516, -324 }, + { -10095, -2238, 981, -1335 }, + { -11908, -2808, 3255, 645 }, + { -10640, -4105, 1283, -595 }, + { -7663, -2863, 2467, -797 }, + { -10712, -3854, 3710, 1538 }, + { -10823, -2893, 1408, -801 }, + { -9874, -3832, 256, -1638 }, + { -10394, -3391, 2315, -94 }, + { -11525, -4079, 4153, 2122 }, + { -9546, -2088, 1541, 481 }, + { -8731, -2433, 1042, 2160 }, + { -7852, -3977, -1370, 1677 }, + { 7072, -3420, 1398, -1741 }, + { 6180, -1976, 1280, -3557 }, + { 7692, -1793, 2844, -1700 }, + { 8363, -1773, 3104, -2679 }, + { 9213, -3266, 3756, -3542 }, + { 9650, -2644, 1426, -1318 }, + { 7712, -2796, 3686, -1975 }, + { 7316, -3517, 2821, -622 }, + { 7434, -2594, 2305, -2264 }, + { 7237, -1797, 255, -3114 }, + { 8663, -1983, 1338, -3056 }, + { 6616, -952, 4059, -2652 }, + { 8823, -1327, 1362, -1356 }, + { 9938, -1722, 1287, -2362 }, + { 7207, -1057, 1913, -1315 }, + { 7508, -1585, 870, -1982 }, + { 8217, -3680, 1417, -3170 }, + { 8329, -2541, 1684, -585 }, + { 8062, -2335, 252, -2800 }, + { 8204, -4108, 3097, -2569 }, + { 7701, -3367, 576, -3008 }, + { 7350, -786, 2414, -2129 }, + { 6948, -2568, 1607, -225 }, + { 7684, -2387, 1308, -3449 }, + { 8306, -3458, 2394, -1454 }, + { 8438, -2781, 1043, -1362 }, + { 9175, -2076, 2144, -1987 }, + { 8347, -2709, 3489, -4301 }, + { 5696, -2377, 2870, 851 }, + { 8825, -1243, 2219, -2603 }, + { 8801, -1614, 584, -2513 }, + { 8413, -384, 1421, -2244 }, + { 9228, -3050, 3279, -2164 }, + { 6342, -2698, 3547, -107 }, + { 10053, -2476, 2837, -3168 }, + { 7439, -604, 3177, -3991 }, + { 7749, -1064, 4329, -4855 }, + { 8655, -2177, 2252, -3519 }, + { 8490, -228, 1958, -3233 }, + { 10513, -2968, 1911, -2340 }, + { 8146, -862, 1884, -1723 }, + { 7788, -666, 3004, -2891 }, + { 7785, -1620, 4133, -3417 }, + { 10262, -3731, 3455, -2971 }, + { 8570, -905, 4519, -4649 }, + { 9129, -2562, 463, -2465 }, + { 9451, -3587, 1904, -3056 }, + { 6549, -2236, 3010, -4523 }, + { 7175, -2684, 2967, -3458 }, + { 9872, -3278, 1054, -2472 }, + { 9153, -931, 1217, -2565 }, + { 8789, -3469, 753, -2568 }, + { 6683, -3791, 1797, -3968 }, + { 6801, -1977, 2311, -452 }, + { 6336, -1572, 2612, -3264 }, + { 7996, -1008, 730, -2964 }, + { 7521, -1059, 1573, -3694 }, + { 8148, -3973, 2600, -3572 }, + { 7765, -1532, 2528, -3856 }, + { 7404, -3918, 4472, -143 }, + { 8894, -1398, 3299, -3685 }, + { 5768, -2041, 1487, -637 }, + { 5131, -2865, 2463, -811 }, + { 6439, -1568, 3500, -1550 }, + { -8878, -6798, -5319, -1452 }, + { -6332, -9713, -3112, -990 }, + { -8444, -6316, -3694, -687 }, + { -6123, -10840, -3637, -4358 }, + { -4784, -9580, -4577, -2581 }, + { -6108, -10515, -4859, -2524 }, + { -7605, -7518, -2327, -2797 }, + { -9662, -8775, -2467, -2010 }, + { -6494, -7523, -4715, -118 }, + { -8290, -8982, -1672, -317 }, + { -8798, -11051, -3888, -1426 }, + { -6273, -6623, -6791, -142 }, + { -8313, -7668, -2141, -1275 }, + { -6453, -8412, -3589, -4102 }, + { -6747, -7750, -5690, -2498 }, + { -7814, -6693, -3174, -2446 }, + { -10383, -10130, -3931, -2364 }, + { -10606, -8467, -5539, -2772 }, + { -9475, -6671, -3305, -2271 }, + { -8982, -9457, -5635, -4005 }, + { -10111, -7965, -6515, -4180 }, + { -7301, -6479, -5364, 720 }, + { -9543, -8999, -7921, -912 }, + { -9534, -8562, -3469, -384 }, + { -7601, -10344, -3205, -1127 }, + { -8088, -8620, -4954, -2888 }, + { -8202, -8406, -7038, -3775 }, + { -7312, -8324, -3334, -1775 }, + { -8566, -9262, -8071, -4174 }, + { -7068, -11300, -5573, -2907 }, + { -8295, -8952, -4366, -1544 }, + { -11104, -10210, -2285, -384 }, + { -5213, -7520, -5008, -1339 }, + { -5889, -7940, -5987, -1385 }, + { -10816, -8201, -4153, -1485 }, + { -10277, -8919, -6315, -1652 }, + { -5888, -10320, -3821, -1733 }, + { -10497, -7181, -6083, -3032 }, + { -7721, -9724, -6591, -5336 }, + { -5688, -7894, -3486, -2552 }, + { -10014, -10500, -3247, -820 }, + { -6301, -8765, -4506, -2923 }, + { -8261, -7847, -6213, -1552 }, + { -10212, -7481, -8113, -3954 }, + { -6938, -10874, -6074, -4703 }, + { -7183, -10968, -4446, -1773 }, + { -7120, -9193, -1966, -2509 }, + { -6234, -9263, -2313, -4284 }, + { -8503, -9857, -2429, -608 }, + { -9372, -7844, -8391, -2120 }, + { -7951, -7157, -6535, -11 }, + { -7256, -9473, -2172, -660 }, + { -10063, -9612, -2515, -15 }, + { -6684, -9134, -6109, -4206 }, + { -8204, -11932, -5220, -2306 }, + { -9710, -6706, -4115, -3275 }, + { -6855, -7078, -2409, -4447 }, + { -7344, -7673, -4479, -4116 }, + { -8851, -6842, -4927, -2948 }, + { -8927, -10452, -5633, -2194 }, + { -8627, -9002, -7176, -1575 }, + { -8209, -9722, -7021, -3324 }, + { -3770, -10249, -3623, -4816 }, + { -8183, -7465, -4090, 646 }, + { -8163, -7149, 200, 498 }, + { -8289, -6266, 686, -206 }, + { -10030, -6241, -1032, -1864 }, + { -8793, -8327, -773, -169 }, + { -9149, -6215, 969, -15 }, + { -8303, -5859, -7, 2006 }, + { -9682, -7283, 255, 1322 }, + { -9293, -7227, 71, -231 }, + { -8525, -6215, 287, -837 }, + { -10477, -5379, 1159, 1449 }, + { -10726, -7856, -130, 102 }, + { -8694, -7461, -1210, 690 }, + { -9367, -5324, 1103, 3170 }, + { -10686, -8055, -831, 1633 }, + { -9201, -6873, -2704, 2258 }, + { -8421, -5358, -1405, 226 }, + { -9066, -5830, -307, -1571 }, + { -11150, -7381, -2746, -900 }, + { -9978, -5925, -2006, -437 }, + { -9464, -4741, -273, 1061 }, + { -10543, -6684, -1113, 1660 }, + { -10073, -5576, 1083, -269 }, + { -8826, -5763, 1600, 1486 }, + { -10445, -9071, -1253, -64 }, + { -12085, -5799, 2, 769 }, + { -12939, -6663, 1650, 1437 }, + { -10932, -6434, -1252, -649 }, + { -11650, -7826, -2053, 710 }, + { -12122, -6733, -1889, -731 }, + { -9093, -6095, -2463, -842 }, + { -10977, -4364, 469, 420 }, + { -11488, -6908, -521, 893 }, + { -9669, -5478, -842, 337 }, + { -10606, -5203, -632, -1361 }, + { -10198, -6284, 1662, 1277 }, + { -10135, -5292, 2435, 3493 }, + { -11027, -6561, 655, 56 }, + { -10977, -5030, 1127, -358 }, + { -12766, -3986, 1348, -335 }, + { -14244, -7731, 264, 317 }, + { -15124, -10309, -508, 1447 }, + { -12821, -8638, -608, 137 }, + { -13076, -8693, -2852, -431 }, + { -11156, -5546, -2252, -1600 }, + { -8692, -7366, -819, -1223 }, + { -12507, -9816, -1714, -121 }, + { -10712, -6666, 544, 3349 }, + { -12462, -5890, -2491, -2318 }, + { -12468, -7226, 437, 232 }, + { -11300, -5226, 2068, 687 }, + { -11994, -8320, -626, 2728 }, + { -12222, -5476, 1142, 18 }, + { -10277, -8122, -2418, 2003 }, + { -13418, -6115, -3563, -2802 }, + { -14759, -9834, -1243, 21 }, + { -13699, -5665, 1525, 507 }, + { -16269, -9476, -701, 163 }, + { -12677, -5437, -247, -1019 }, + { -11827, -4295, -181, -1243 }, + { -12847, -4496, 2984, 1123 }, + { -13860, -7915, -1166, -547 }, + { -12276, -8145, -2290, -1527 }, + { -11417, -4830, 2983, 1854 }, + { -11793, -6002, 1163, 1940 }, + { 11443, -4920, -3235, 3151 }, + { 11300, -6616, -1506, 1175 }, + { 9198, -4628, -2060, 2390 }, + { 10532, -4027, -643, 912 }, + { 9902, -3573, -1606, 1327 }, + { 9653, -3536, -2240, 1869 }, + { 9948, -5171, -423, 2662 }, + { 12316, -4004, -1989, 281 }, + { 12125, -4800, -1265, -163 }, + { 10650, -2617, -2337, 1462 }, + { 9909, -4968, -2376, 916 }, + { 12944, -4647, -1958, 460 }, + { 12988, -5283, -1141, 41 }, + { 12321, -2915, -3621, 1025 }, + { 11449, -2894, -2728, 351 }, + { 12087, -3041, -2002, -32 }, + { 11558, -4031, -1343, -399 }, + { 12983, -3740, -3516, 1245 }, + { 12099, -2515, -2752, 225 }, + { 12515, -3465, -2701, 550 }, + { 14683, -5022, -5272, 2996 }, + { 12260, -3383, -1215, -528 }, + { 13810, -5422, -2443, 1166 }, + { 13421, -5378, -1886, 721 }, + { 12961, -4259, -2594, 796 }, + { 12266, -2104, -4768, 1591 }, + { 13523, -4710, -3045, 1342 }, + { 12437, -2099, -5610, 2117 }, + { 11850, -2183, -3497, 661 }, + { 12275, -3936, -597, -697 }, + { 12459, -5253, -517, -544 }, + { 12835, -4094, -1322, -168 }, + { 14360, -5677, -3305, 1859 }, + { 13905, -4552, -4309, 2117 }, + { 11559, -3412, -1847, -81 }, + { 13379, -3167, -5764, 2746 }, + { 11910, -1634, -4342, 1052 }, + { 12662, -4742, 71, -974 }, + { 13057, -3254, -4424, 1705 }, + { 15046, -5706, -4851, 3019 }, + { 14162, -4142, -5514, 2843 }, + { 12764, -1845, -6684, 2888 }, + { 13714, -2374, -7838, 3857 }, + { 13295, -1663, -8293, 4073 }, + { 10032, -4152, -3403, 1421 }, + { 10942, -5386, -2222, 950 }, + { 10532, -6385, -1750, 1925 }, + { 10273, -5972, -1534, 643 }, + { 10605, -4782, -1695, 27 }, + { 10988, -5153, -1123, -341 }, + { 11629, -5884, -1060, 48 }, + { 10441, -4045, -2431, 311 }, + { 10788, -3595, -4171, 1807 }, + { 12110, -5686, -2127, 976 }, + { 11746, -4773, -2639, 891 }, + { 11541, -5299, -3031, 1732 }, + { 11416, -2559, -5359, 2198 }, + { 11583, -5376, -704, 677 }, + { 10416, -3214, -3516, 872 }, + { 9651, -5435, -1618, 3255 }, + { 9973, -5133, -996, 3923 }, + { 11707, -4643, -430, -796 }, + { 10994, -2709, -3587, 2302 }, + { 10716, -5118, -645, 270 }, + { 14100, -10314, 1095, 1531 }, + { 12944, -8049, 1105, -741 }, + { 13276, -7035, -511, 274 }, + { 14008, -7254, -283, 139 }, + { 11594, -6536, -91, 1671 }, + { 11732, -8645, 746, 15 }, + { 14613, -7085, -1578, 1183 }, + { 13083, -6224, -750, -4 }, + { 13988, -6256, -1592, 820 }, + { 14678, -8683, 441, 126 }, + { 15571, -8872, -521, 1139 }, + { 15642, -9533, 341, 697 }, + { 15960, -9586, -168, 1121 }, + { 15464, -10239, 1433, -1 }, + { 14934, -7887, -1046, 1080 }, + { 15252, -7630, -1899, 1628 }, + { 15485, -8384, -1234, 1484 }, + { 15962, -8638, -1815, 1931 }, + { 16501, -10664, 398, 1167 }, + { 16146, -10145, 411, 918 }, + { 14573, -7475, -697, 601 }, + { 14302, -7996, 28, 257 }, + { 14769, -6792, -2286, 1574 }, + { 14144, -6137, -2169, 1257 }, + { 14770, -6271, -3111, 1933 }, + { 14110, -8312, 1083, -531 }, + { 15235, -6991, -2993, 2174 }, + { 13222, -5805, 547, -891 }, + { 14796, -8762, 1254, -246 }, + { 16040, -9181, -1005, 1551 }, + { 16487, -10086, -373, 1420 }, + { 15077, -9479, 966, 51 }, + { 13026, -6468, 932, -1080 }, + { 12703, -6152, -33, -573 }, + { 15641, -6810, -4128, 2874 }, + { 13282, -7673, 1583, -1283 }, + { 12373, -7150, 1512, -917 }, + { 12992, -7751, -678, 783 }, + { 10907, -6858, -313, 2597 }, + { 13026, -8963, 125, 2152 }, + { 12770, -9946, 1957, -505 }, + { 12482, -6849, -1268, 833 }, + { 13790, -6181, -138, -279 }, + { 12709, -8382, 2044, 227 }, + { 12244, -6630, 203, -457 }, + { 14209, -6816, -1032, 632 }, + { 15134, -8267, -288, 640 }, + { 13619, -6157, -1090, 356 }, + { 14044, -7413, 725, -484 }, + { 12958, -7753, 2585, -1980 }, + { 13188, -8396, 2306, -1558 }, + { 14379, -9980, 2132, -688 }, + { 14275, -9857, 1162, 179 }, + { 13690, -8648, 1621, -889 }, + { 11770, -6829, -746, 278 }, + { 12732, -8202, 286, 90 }, + { 13630, -10146, 1867, -207 }, + { 12072, -8740, 1299, -645 }, + { 12852, -9492, 1226, 62 }, + { 11792, -7382, -54, -116 }, + { 13779, -9014, 487, 351 }, + { 11951, -7729, 121, 834 }, + { 11970, -9781, 2276, -4 }, + { 12680, -7984, 2787, -787 }, + { 13300, -14488, 6408, -1927 }, + { 13635, -15355, 9153, -3073 }, + { 12804, -13566, 5517, -1625 }, + { 16624, -10854, 1690, 28 }, + { 20387, -18532, 6162, -261 }, + { 16515, -12642, 3392, -519 }, + { 15800, -11095, 2151, -202 }, + { 16824, -11790, 1651, 599 }, + { 17604, -13213, 2563, 538 }, + { 17892, -14177, 3562, 147 }, + { 16987, -11399, 869, 1052 }, + { 17003, -12456, 2442, 265 }, + { 21657, -21806, 9198, -1250 }, + { 16825, -13341, 3980, -686 }, + { 17525, -12714, 1887, 805 }, + { 16419, -11034, 1216, 617 }, + { 20931, -19939, 7469, -684 }, + { 18452, -15390, 4573, -191 }, + { 14778, -10077, 2841, -1209 }, + { 17402, -13319, 3042, 160 }, + { 19365, -17922, 7087, -1061 }, + { 16298, -11941, 2810, -351 }, + { 19087, -16176, 4775, -84 }, + { 17666, -12289, 938, 1224 }, + { 18581, -15894, 5132, -430 }, + { 19823, -16717, 4142, 545 }, + { 19960, -19423, 8400, -1492 }, + { 18973, -16817, 5906, -594 }, + { 19079, -15431, 3528, 503 }, + { 16667, -12485, 4467, -1302 }, + { 19791, -17797, 6196, -529 }, + { 20005, -17606, 5354, -20 }, + { 20123, -18599, 6886, -728 }, + { 19068, -14805, 2394, 1105 }, + { 14443, -13723, 5631, -2029 }, + { 14730, -14231, 5631, -1450 }, + { 16089, -15959, 7271, -2029 }, + { 13473, -11200, 3236, -924 }, + { 14413, -10902, 2347, -267 }, + { 17666, -18662, 11381, -3496 }, + { 14749, -11042, 3305, -275 }, + { 15304, -10486, 1869, -240 }, + { 14809, -12126, 3369, -616 }, + { 16896, -16561, 7307, -1845 }, + { 15782, -14336, 5380, -1264 }, + { 16395, -15520, 6415, -1588 }, + { 13681, -11114, 2584, -320 }, + { 14244, -12326, 4480, -1632 }, + { 15247, -13119, 4265, -898 }, + { 13987, -12091, 3469, -597 }, + { 13941, -12770, 4240, -839 }, + { 13771, -13627, 5252, -1384 }, + { 15010, -16074, 7592, -2249 }, + { 15852, -17226, 8619, -2655 }, + { 18921, -16916, 6875, -1501 }, + { 14909, -11678, 2768, -295 }, + { 18988, -18353, 8424, -2070 }, + { 15457, -15080, 6218, -1513 }, + { 14916, -15512, 6949, -1883 }, + { 18108, -14702, 4681, -701 }, + { 17600, -15733, 5616, -775 }, + { 14070, -13683, 6472, -2626 }, + { 13832, -11914, 5201, -2232 }, + { 18846, -19009, 9192, -1961 }, + { -11981, -10994, -6324, -2264 }, + { -10976, -9047, -6546, -3828 }, + { -11288, -10532, -7014, -4191 }, + { -10139, -10189, -7799, -2688 }, + { -10555, -9988, -9181, -2040 }, + { -11596, -11339, -10022, -2707 }, + { -13400, -13395, -11306, -4206 }, + { -9774, -12281, -7466, -4133 }, + { -10842, -13125, -8777, -4956 }, + { -11964, -15082, -9779, -5095 }, + { -9382, -10188, -9053, -4927 }, + { -11562, -11296, -3651, -985 }, + { -9287, -10083, -7918, -4069 }, + { -12821, -16556, -11410, -6195 }, + { -12628, -8959, -4521, -1113 }, + { -13845, -11581, -3649, -681 }, + { -12685, -10269, -5483, -1275 }, + { -14988, -12874, -5107, -1189 }, + { -13761, -11367, -6202, -1804 }, + { -13225, -11249, -7820, -3354 }, + { -14809, -11992, -3202, -312 }, + { -15620, -15519, -10210, -3433 }, + { -12954, -10200, -3139, -611 }, + { -11536, -9981, -5284, -923 }, + { -13034, -12417, -4612, -1098 }, + { -16911, -15505, -6123, -1352 }, + { -17396, -17685, -8330, -2171 }, + { -14120, -10764, -2265, -99 }, + { -12598, -7367, -5406, -3530 }, + { -14143, -12793, -10909, -5226 }, + { -14692, -16871, -11626, -5554 }, + { -12581, -11197, -9194, -3837 }, + { -16752, -16726, -9746, -2808 }, + { -10600, -10358, -6560, -1227 }, + { -14573, -13312, -8957, -3393 }, + { -10172, -8463, -8579, -3387 }, + { -11418, -12421, -5522, -1842 }, + { -11855, -14204, -6669, -2625 }, + { -13308, -8191, -3941, -2194 }, + { -10007, -12266, -5022, -1811 }, + { -13532, -15771, -9497, -3175 }, + { -11760, -11148, -10339, -5529 }, + { -12149, -12763, -11198, -3697 }, + { -12029, -12119, -8555, -1792 }, + { -16995, -19957, -11447, -3471 }, + { -13144, -14504, -9988, -3191 }, + { -9938, -11064, -6139, -3162 }, + { -8873, -11550, -8294, -6550 }, + { -9303, -13010, -6150, -2711 }, + { -15463, -10469, -1766, -170 }, + { -15985, -11693, -3007, -650 }, + { -17142, -10671, -1434, 47 }, + { -16063, -13858, -4817, -1058 }, + { -19446, -19599, -9594, -2464 }, + { -20076, -18744, -8313, -1889 }, + { -15047, -16085, -7590, -2250 }, + { -13481, -16195, -8552, -2998 }, + { -13829, -14869, -6704, -1932 }, + { -16357, -18484, -9802, -2959 }, + { -10551, -8393, -9303, -5070 }, + { -11345, -9156, -5641, -3107 }, + { -13217, -13449, -9270, -4541 }, + { -11988, -13732, -9995, -6374 }, + { -11007, -9519, -5168, -4107 }, + { 9930, -7858, 8061, -4375 }, + { 8274, -7867, 5992, -2096 }, + { 9692, -9675, 7621, -3670 }, + { 9589, -8110, 6509, -3010 }, + { 12617, -11976, 10122, -5360 }, + { 11867, -8895, 7948, -5323 }, + { 10388, -10482, 9234, -4324 }, + { 8188, -8220, 7810, -2737 }, + { 10407, -8787, 4806, -1930 }, + { 10348, -8845, 9233, -6614 }, + { 9422, -7091, 4820, -2878 }, + { 9758, -9796, 5584, -2256 }, + { 10188, -7994, 5347, -3343 }, + { 11133, -7455, 4015, -2306 }, + { 10676, -10744, 6093, -2629 }, + { 11522, -12184, 7848, -3375 }, + { 8805, -9883, 5317, -3071 }, + { 9498, -9654, 6555, -3592 }, + { 10488, -8008, 4066, -1252 }, + { 11261, -8930, 6068, -2738 }, + { 12180, -10397, 5027, -1531 }, + { 9138, -8531, 3601, -1959 }, + { 8107, -8380, 4970, -2061 }, + { 9737, -13248, 6438, -2617 }, + { 11178, -10423, 2622, -522 }, + { 9572, -12372, 5199, -2019 }, + { 12057, -12144, 4147, -1099 }, + { 9047, -9925, 2516, -665 }, + { 10790, -8030, 5882, -4386 }, + { 7199, -8426, 6337, -2841 }, + { 7778, -8285, 3529, -3442 }, + { 7559, -10569, 3484, -1332 }, + { 9404, -8115, 7484, -5541 }, + { 7792, -11976, 5546, -2573 }, + { 9313, -10264, 7661, -5195 }, + { 6701, -10725, 4370, -1784 }, + { 4918, -11361, 4507, -4527 }, + { 5147, -12305, 3978, -5556 }, + { 6525, -9899, 4481, -3129 }, + { 7538, -12855, 6060, -4826 }, + { 8659, -12111, 7159, -4430 }, + { 8440, -11304, 4547, -1747 }, + { 9216, -10918, 3507, -1195 }, + { 6165, -9254, 4771, -4677 }, + { 9163, -11019, 5637, -4935 }, + { 13441, -11509, 6676, -2434 }, + { 7912, -9398, 6663, -4048 }, + { 11723, -13745, 8131, -4148 }, + { 6065, -10257, 5005, -6327 }, + { 11618, -12417, 5336, -1894 }, + { 8891, -13924, 8407, -6131 }, + { 9622, -12563, 7908, -5109 }, + { 11479, -10315, 8349, -3991 }, + { 11676, -14103, 6611, -2330 }, + { 11951, -8953, 3829, -1550 }, + { 10486, -8044, 10493, -5920 }, + { 11801, -10769, 9763, -5305 }, + { 6109, -8676, 5827, -1346 }, + { 7030, -9611, 5624, -5761 }, + { 12808, -12886, 8683, -4148 }, + { 13213, -10464, 6381, -3189 }, + { 11796, -13681, 10703, -6075 }, + { 9639, -7949, 9625, -3944 }, + { 8538, -6997, 5309, 453 } }; /* quantization tables */ @@ -4226,2054 +4226,2054 @@ static const float lossless_quant_d[32] = { static const int8_t high_freq_vq[1024][32] = { - { 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 }, - { -4, -2, 2, 1, -16, -10, 1, 3, 1, 0, 6, 1, -3, 7, 1, -22, - 2, -4, -3, 11, 14, 6, -1, 1, -13, 29, -28, 10, 10, -8, 0, -9 }, - { -8, 8, -7, 10, -3, -12, -5, -8, 1, -2, 9, -2, -5, -18, 1, 9, - -8, -8, 3, 41, 7, -9, -9, 22, -42, -29, 14, -18, -14, -32, 1, -15 }, - { -16, 8, 15, 16, -16, 5, 2, 7, -6, -16, -7, 1, 1, -3, -2, 0, - 8, 20, -26, -11, 2, -17, 0, -3, -34, -37, 10, 44, -2, 22, 2, -4 }, - { 7, 14, 5, 6, 15, -1, 3, -3, -9, -23, -5, -14, 8, -1, -14, -6, - -5, -8, 54, 31, -6, 18, 2, -19, -2, -11, -30, -6, -19, 2, -2, -14 }, - { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1, - 3, 7, -5, -4, -3, -12, 3, -2, -3, 12, -53, -51, 6, -1, 6, 8 }, - { 0, -1, 5, 1, -6, -8, 7, 5, -18, -4, -1, 1, 0, -3, -3, -14, - -1, -6, 0, -14, -1, -1, 5, -3, -11, 1, -20, 10, 2, 19, -2, -2 }, - { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3, - -7, 0, -34, 4, -43, 17, 0, -53, -13, -7, 24, 14, 5, -18, 9, -20 }, - { 1, 0, -3, 2, 3, -5, -2, 7, -21, 5, -25, 23, 11, -28, 2, 1, - -11, 9, 13, -6, -12, 5, 7, 2, 4, -11, -6, -1, 8, 0, 1, -2 }, - { 2, -4, -6, -4, 0, -5, -29, 13, -6, -22, -3, -43, 12, -41, 5, 24, - 18, -9, -36, -6, 4, -7, -4, 13, 4, -15, -1, -5, 1, 2, -5, 4 }, - { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19, -22, 31, -27, 4, -15, - -6, 15, 9, -13, 1, -9, 10, -17, 4, -1, -1, 4, 2, 0, -3, -5 }, - { -7, 3, -8, 13, 19, -12, 8, -19, -3, -2, -24, 31, 14, 0, 7, -13, - -18, 0, 3, 6, 13, -2, 1, -12, -21, 9, -2, 30, 21, -14, 2, -14 }, - { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1, -10, 30, 4, - -10, 12, 5, 6, -13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2 }, - { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4, -16, -13, 3, 23, -27, - 18, 46, -38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3 }, - { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4, -11, 40, -7, - -3, -13, -14, -7, -10, 14, 7, 5, -14, 11, -5, 7, 21, -2, 9, -3 }, - { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2, - -1, 1, -3, -1, -15, -2, -63, -27, -21, -47, -14, 1, -14, 10, 0, 2 }, - { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7, -15, 6, - -7, -6, 3, 7, -15, -5, 23, -13, -6, 12, -8, 9, 2, -3, 3, 4 }, - { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4, -22, -15, - -46, -66, 10, 20, 2, -17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2 }, - { -1, 0, 0, 1, 0, -4, 0, 1, -10, -3, -8, 5, 7, -11, 2, -11, - 29, -25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2 }, - { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1, - -14, -7, 3, -30, -15, -14, 3, -4, -1, 3, -13, -1, -3, 1, 2, 3 }, - { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10, - -57, 3, 22, -50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2 }, - { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4, - 24, -35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0 }, - { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0, - 0, -1, -2, -1, -5, -2, -43, -3, 46, -52, -10, 7, -8, 11, -2, -1 }, - { 0, 0, -1, 0, -1, 2, -41, 33, -44, -48, -15, -26, -9, 6, 3, 3, - -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1 }, - { -4, 1, 6, 1, -6, -1, -2, 1, -14, -4, 0, -5, -2, 2, -2, 0, - -6, 1, 0, 8, -21, 32, -3, -36, -6, -2, -1, -7, 3, 0, 1, -6 }, - { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3, - 13, 0, -12, -1, 25, -20, -2, -23, -15, 7, -3, -11, -3, 6, -1, 0 }, - { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3, - -2, 3, 3, -7, -6, -5, 0, -4, -60, -16, -6, 38, 5, 6, -5, 0 }, - { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1, - 0, 0, -1, 0, -8, 2, -9, 10, 40, 31, -56, -21, 4, 20, -4, 7 }, - { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5, - 1, -2, 14, 5, 4, 5, 5, 5, -5, 9, -66, 0, -20, -2, -8, 4 }, - { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2, - 45, 31, -17, -16, -2, -2, -1, -22, 1, -1, -3, 3, 5, -3, 5, -1 }, - { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7, -11, -3, -8, 17, -4, - 34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7 }, - { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38, - 15, -1, 16, -11, 5, 8, 4, -10, 3, -10, -17, 5, 3, 3, 3, 1 }, - { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1, - 2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33 }, - { -5, 2, -3, -7, 2, -8, -4, 10, 17, -18, -7, 4, -4, -7, -6, -6, - -5, 5, -12, 2, 0, 6, 8, -2, 1, 4, -11, 2, 1, 8, 31, 19 }, - { 6, 9, 16, -6, -6, -1, -2, -3, -11, -2, 7, 7, 17, 3, 4, 10, - 2, 5, -13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6 }, - { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10, - -16, 12, 1, -6, 3, 8, -1, 10, -13, -6, -12, -23, 12, -3, 30, 14 }, - { -2, -15, 0, 8, 3, -19, 5, -3, 2, 3, 13, 7, 14, -3, -10, 0, - 8, 5, -6, -16, -8, -8, 14, 2, -1, 1, -9, -11, 11, -5, 27, 9 }, - { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4, -15, 1, 9, 0, - 8, 4, 1, -17, 11, -2, -19, -1, -6, -8, 3, -12, 3, -17, 33, -10 }, - { -3, -1, 2, 7, 7, -2, 9, 8, -18, -1, -13, -10, -3, -3, 11, 8, - -2, -12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10 }, - { -3, -10, 8, -1, -5, -11, 7, -5, 3, 6, 1, 4, -16, 10, 5, -4, - -2, -10, -1, 13, 6, -5, -7, 12, 7, -3, -17, 1, 12, -4, 29, 8 }, - { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2, - -2, -8, -6, -11, 14, -13, 27, 3, -2, -12, 5, -16, 2, -26, 20, 15 }, - { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1, - 0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8, -25, -8, -4, 34, 23 }, - { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1, - 0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68, -16 }, - { 10, 0, -8, 14, -6, 1, -12, 0, 0, -3, -5, -11, -6, 12, 9, -10, - -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4 }, - { -12, 13, -5, 7, -11, -2, -1, 1, -4, -14, -21, 3, -3, -3, -4, -7, - -9, -4, 3, -17, -2, -13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10 }, - { -10, 6, 5, 6, 4, -7, 10, 0, -28, -3, 0, -11, -1, -5, 16, -10, - -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5, -10, 7, -9, 20, 4 }, - { 1, -7, -2, -7, 4, -3, -2, -7, -1, -14, 6, -16, 4, -5, -4, -6, - -5, 0, -2, 2, -6, 9, -5, 4, -18, 8, -10, 8, 15, 0, 32, 1 }, - { -5, 7, -3, 7, 15, -4, 0, -16, 9, 5, -5, 5, 4, -3, -12, -9, - -18, 10, 2, 2, -3, 7, 3, -1, 6, -9, -10, 3, 15, -4, 35, -7 }, - { -1, -10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1, -14, -11, 3, - -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14 }, - { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1, - -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4, -12, 21, -39, 24, -2 }, - { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2, -11, -8, -1, 4, 2, 2, - -4, -10, 12, -5, -11, 1, -15, -34, -11, -7, -11, -1, 7, -14, 38, -1 }, - { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11, -15, 20, -1, - -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11, -12, 27, -4 }, - { 0, 8, -4, 3, -11, 6, -11, 2, 3, 0, 5, -8, -7, -6, -9, -21, - 4, -11, -1, -16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3 }, - { 1, 3, 4, 11, -11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4, - 0, 4, -8, 13, -6, -13, -1, -5, -1, 4, 0, 0, 9, -22, 24, 18 }, - { -7, 3, 10, -13, -6, 6, -6, 6, 22, 1, 0, -14, 2, 3, 7, -1, - 8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4 }, - { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2, - 5, 2, -11, 4, 0, -1, 12, 0, -3, -13, 15, 8, -6, -27, 34, 0 }, - { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1, - 3, -6, -7, -6, -5, 4, -19, -6, -8, -34, -4, -8, 10, -7, 23, 10 }, - { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7, - -6, 1, -12, -12, -1, -16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15 }, - { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1, -11, 6, -5, 0, 2, -6, - -3, -6, 4, -1, 5, -5, -12, -6, 7, -5, 9, 3, 6, -7, 29, 1 }, - { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5, - -1, 0, 4, 2, 11, 6, 2, -3, 13, -9, -19, 18, -15, -10, 36, 21 }, - { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0, - -2, 0, -2, 6, -19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28, -10 }, - { -5, 1, -3, -7, -12, -4, 1, 1, -1, 13, -10, -1, -9, -5, -13, 6, - 13, 3, -4, 2, 3, 11, 2, 6, -25, -16, -6, 0, 14, -1, 27, 16 }, - { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8, -12, -6, 5, - -6, 5, 3, -9, 1, 4, -7, -10, -9, -7, -17, -5, -15, -23, 25, 3 }, - { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1, - -7, -4, -5, -16, 3, -6, 18, -13, -9, 16, -15, 8, 15, -10, 24, 5 }, - { 1, -38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7, - -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1 }, - { 1, -22, 15, 18, -2, 10, -16, -9, -8, -11, 8, 4, 0, 7, -14, -5, - -1, -7, 12, 17, 9, 5, -7, -4, -12, -6, 7, 0, 7, 2, -2, 1 }, - { -11, -29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7, -14, 8, - -3, -11, -13, 0, -7, -23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5 }, - { -24, -27, -11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3, - 4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3 }, - { -9, -24, 11, 13, -10, -12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9, - -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9 }, - { -8, -15, 7, 14, -4, -5, 2, -18, -19, -2, 2, 17, 16, 6, -10, 10, - -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5, -12, 3, 2 }, - { -10, -37, 13, 1, 3, -14, 0, -20, 4, -3, 8, 2, -2, -3, -9, -5, - -3, -17, -1, 13, -11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4 }, - { -2, -22, -5, 46, -8, 5, 9, -11, 8, 7, 7, -1, -1, -2, -7, 2, - -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6 }, - { -16, -27, 15, 16, -4, 14, -7, -26, 2, -2, 6, 5, -3, 11, 0, 2, - 3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0 }, - { -3, -22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1, -21, -4, 5, - 3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7 }, - { -9, -25, 3, 18, 9, -6, -11, 0, -5, -12, 9, -8, -7, -6, -6, 22, - 2, -6, -3, 15, 3, 2, -2, 9, 14, -10, -7, 15, 13, 6, -2, 11 }, - { 5, -20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2, - 6, 10, 9, -9, -18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1 }, - { -8, -30, 7, 12, 10, 8, 7, -13, -16, 0, 1, -1, -6, -11, -15, 4, - 1, -2, 10, -15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7, -18 }, - { -10, -32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5, -15, - -11, 6, 20, 4, 0, -12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1 }, - { 1, -25, -14, 12, -11, 9, 9, -16, -24, -17, 22, -9, 11, -30, -3, -4, - 6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8 }, - { -14, -26, -6, 9, 8, 17, -11, -24, -7, -4, -8, -2, 10, 2, 2, -1, - 2, 13, 12, -7, 4, -6, -10, 6, 6, -13, -11, -7, -16, 0, -2, 5 }, - { -4, -30, -13, 12, 16, -6, 12, -16, -13, 5, 15, -2, -2, -10, -7, 7, - 11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4 }, - { -4, -21, 20, 22, 2, 20, -8, 1, -12, -5, -9, 4, -10, -17, -3, -8, - -3, 3, -12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5 }, - { -12, -20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17, -13, -2, -10, - -17, -1, -18, 2, 0, 14, -6, 1, 0, 3, 2, -10, 1, -5, -2, 5 }, - { 16, -37, -1, 26, -2, -14, 1, -5, -14, 2, 2, 3, 6, 1, 1, 4, - 0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0 }, - { -9, -24, -12, 5, 5, 3, -17, -14, 4, 3, 2, -4, 10, -22, -8, -3, - 6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5 }, - { -14, -33, -2, 20, -13, -10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8, - 0, -2, 10, 7, -2, -13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7 }, - { -10, -23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15, -14, - 13, 14, 2, 5, -13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5 }, - { -13, -25, -10, 13, -17, -24, -7, -13, -6, -10, -8, 2, 0, -13, -10, -4, - -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2 }, - { -12, -23, 1, 18, -11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2, - -2, 11, -13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1 }, - { -5, -18, 16, 22, 2, 0, 8, -6, -9, -7, 10, -16, 23, 10, -11, -1, - 7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4 }, - { -3, -26, 14, 11, 2, -9, 17, -2, -1, -5, -16, -9, -5, 10, -13, 1, - 6, 12, 10, 11, 0, 0, -3, -14, 6, -2, 0, 4, -5, -1, -7, -1 }, - { -10, -33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2, -10, -5, - -6, 12, -11, 5, -10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16, -17 }, - { -14, -37, 7, 7, -2, 5, -8, -11, 2, -13, 4, -19, 1, 8, 8, 4, - -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2 }, - { -6, -30, 18, 17, 1, -22, -3, 4, -7, -10, 7, 0, -8, 8, -1, 4, - 2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5 }, - { -17, -18, -3, 22, -8, 1, 9, -2, -17, 20, -5, -5, -12, -5, 4, -5, - -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3 }, - { -9, -23, 3, 10, 4, 4, -3, -2, -2, -2, 1, -22, 11, 0, -2, 5, - -2, 14, -9, -11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6 }, - { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1, - -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5, -69, -19 }, - { -3, -5, -8, -12, 4, -3, -19, -11, -5, 0, -14, 7, 18, -6, 7, 22, - 8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3, -26, -11 }, - { -1, -6, 4, -4, -5, -16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3, - -4, -33, -4, 4, -7, 0, 1, 6, -11, -2, -13, -2, -18, 20, -25, -16 }, - { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11, -10, 4, -10, 7, 16, 2, - 16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0, -33, -2 }, - { -3, -15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4, - 12, 13, -13, -14, 10, -6, 9, 22, -27, 23, -1, 5, -24, 2, -30, 5 }, - { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1, - 1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4, -37, 9 }, - { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7, -10, -10, -1, -4, 11, -3, - 7, -6, 4, -12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3, -40, 13 }, - { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1, - 0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1, -32, -7 }, - { -16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15, -13, -11, 11, 9, 4, - 3, -8, -10, 12, 12, 0, 0, -16, -9, 13, 2, 9, 4, -13, -33, 3 }, - { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2, -11, -1, -15, -11, -1, 1, - 11, -3, -2, 24, -4, -6, -25, -10, -15, -8, 0, 0, -5, 4, -30, 2 }, - { 10, -3, -6, 1, -9, -5, 6, 9, -10, -3, 8, -1, 4, -1, 11, -11, - 3, 9, 11, -3, 6, -17, 5, -8, -33, 9, -13, 19, -2, 9, -25, 2 }, - { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2, - 0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0, -15, 12, -63, 27 }, - { -2, 14, 9, -1, 3, 0, 1, 1, -19, 15, 3, 4, 0, -10, 1, -5, - 3, 0, -5, -10, 2, -16, -4, 8, -12, -6, 7, -5, -10, -1, -33, -4 }, - { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1, -12, 3, 8, - -10, 6, -1, 1, 13, -5, -5, 2, -4, 13, -18, -10, -7, -9, -33, 10 }, - { -6, -3, -12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2, - 1, 8, -10, 7, -1, -3, 3, 0, 13, 1, 6, 7, -16, -7, -39, 8 }, - { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2, - -3, 13, -11, 1, 7, 5, 19, -5, -3, -15, -1, 7, -1, 6, -33, 8 }, - { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6, - -2, 1, 7, 0, 1, 1, -5, 2, -2, 0, -13, -2, -31, -14, -39, -12 }, - { -10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7, - 18, -8, -2, -19, -7, -7, -12, -14, -11, -1, -9, -13, -7, -12, -31, -9 }, - { -3, -16, 10, 9, 1, -10, -12, 2, -2, 2, 7, -3, -3, 1, -4, -5, - -9, 5, 7, 3, -1, 4, -11, -8, 4, 13, -10, 13, 10, -4, -36, 1 }, - { -7, -12, 4, -20, -7, -7, 2, 11, -1, -2, 3, -12, 1, 0, -6, -7, - 6, 4, 13, 3, -3, 4, 3, -6, -12, 5, -5, -22, -13, -8, -37, -6 }, - { -7, 5, 3, 5, 7, 9, -14, -3, 10, 17, -1, 1, -12, 5, -6, 0, - -4, -9, 0, -11, -14, 3, 13, 6, -25, -8, -12, 4, -10, 18, -30, -1 }, - { -10, 6, -10, 6, 6, 1, -10, 0, -7, 5, -2, 17, -18, -4, 0, -3, - -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0, -32, -11 }, - { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4, - -6, 0, 2, -3, -1, 5, 10, 0, 12, -10, -18, -3, -1, 14, -33, 2 }, - { 4, -8, -18, -4, -5, -11, 4, -10, -4, 9, 13, -12, 1, -6, 1, 2, - 4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0, -30, 1 }, - { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3, - -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2, -33, -8 }, - { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8, - 7, -11, -4, 6, -10, 7, -1, -1, -2, -1, 16, 32, -7, 20, -33, -6 }, - { -18, 2, 6, 13, 9, 9, -1, 3, -17, 24, -2, -6, 28, 8, -2, 6, - 3, -10, -34, -16, -13, -4, -15, -11, -12, -3, -10, 4, -8, 4, -31, -4 }, - { -11, 0, 18, 2, -16, -9, -13, -2, -2, -12, -3, -22, 30, 0, 8, 3, - 9, -4, -16, 1, 0, -11, 15, -2, -4, 6, -5, 6, 1, 2, -25, -12 }, - { 14, -1, 5, 7, 3, -15, -8, 1, 5, -2, 12, 13, 11, -25, 3, 1, - 0, -2, -4, -16, -23, 0, -5, -17, 7, 5, -9, 6, -5, 2, -32, -7 }, - { 3, -1, 6, 14, 2, -12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2, - 4, 5, -2, 8, 8, -6, 0, 10, -20, -1, 3, -1, 8, 23, -33, -5 }, - { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1, - 8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1, -12, 0, -34, 18 }, - { -17, 13, 0, 1, 9, -4, -11, 0, 7, 0, -10, -4, -1, 6, -6, 4, - 1, 6, -9, 3, -5, -6, -11, 2, -4, 14, 23, -3, 2, 5, -30, 12 }, - { -14, 5, -27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5, - 8, -10, 48, -11, 12, 33, 6, 8, -15, 20, -2, -5, 32, 5, -19, 10 }, - { -16, -4, -12, -7, -2, 0, 8, -6, -20, -18, 16, -3, 0, 31, -2, 11, - 2, -9, 49, -19, -12, -23, 10, 26, 16, -2, 4, -21, -14, 13, -11, -9 }, - { -5, -9, -1, 3, -5, -21, 2, 10, 0, 0, 10, -21, -7, 7, -26, -9, - 22, 32, 58, 11, -3, 11, -5, -8, -13, 6, -5, -9, 1, 10, 14, -8 }, - { 7, 7, 10, 3, -2, -1, -11, -11, -6, -43, -3, 14, -19, -18, 19, 18, - -32, 10, 45, -6, 6, 21, -20, -12, 2, 4, 6, 6, -4, 3, 3, 1 }, - { 21, 22, -3, -2, -11, -6, -1, -2, 8, 8, 32, -21, 7, 28, -4, -6, - -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4, -17, 27, 6 }, - { 13, 7, 2, -6, -12, 2, -10, -5, -17, 11, 4, 17, -12, -2, 5, -17, - 37, -16, 48, -14, -18, 29, 8, 24, 11, -5, -9, 11, -1, 1, -13, -3 }, - { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6, - 2, 10, 54, -25, 7, 54, -5, -6, -1, -15, 9, 13, -24, -15, -12, 3 }, - { 21, 5, 8, 3, -3, -4, -2, -4, 3, -11, -5, -8, 9, 16, 8, -9, - -10, -3, 46, -46, 2, 1, -10, 10, 17, 11, -20, -36, 10, 14, 0, -5 }, - { 7, -13, -6, -9, -24, 45, 2, 8, 8, 0, 17, 20, 12, -24, 1, -7, - -15, -3, 46, -13, -2, 20, 1, -13, -11, -13, 2, 15, 1, 10, -1, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1, - -16, -9, 31, -69, -34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, - -5, -20, 18, -82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1, - 15, -5, 62, -36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0 }, - { 3, -19, 19, -20, 13, -4, -11, 8, 8, -16, 10, 1, -14, 30, 1, -33, - 10, -11, 45, -30, 3, -4, -3, -13, 7, 12, 3, -22, 3, -2, -4, -2 }, - { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, - 11, 8, 70, 48, -10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 2, -1, 80, 2, -15, -36, -10, -5, -2, 8, -2, 2, 0, 0, 0, 0 }, - { 10, 8, -8, -8, -24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12, -10, - -2, -13, 35, -43, 44, 15, -10, -25, 4, 10, -3, -5, -5, 7, -1, 3 }, - { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1, - -18, 9, 49, -72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1 }, - { -1, 4, -3, 10, 19, 4, 3, 20, 6, -24, 6, 9, 8, 15, 18, 18, - -36, 19, 57, -11, 4, -3, 8, 7, 2, -3, -2, -9, -15, -2, 12, -4 }, - { 20, 3, 11, -9, -4, 22, 42, -25, 1, 5, -10, -19, 0, 9, -16, 5, - 2, 10, 44, -29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1 }, - { -7, 16, -11, 12, 6, 33, -15, 14, -23, 2, -26, 8, 2, 10, 0, -5, - 8, -8, 38, -38, -4, 5, 5, 5, 1, 22, -15, 7, 6, 0, 4, 28 }, - { -1, -12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18, - 4, 1, 27, -39, 31, 17, 2, 2, 22, -23, 13, 16, 1, -7, -4, -5 }, - { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0, -14, 0, - -7, -11, 49, -22, -4, 19, 17, -39, 4, -29, 10, 2, 36, -4, 23, -1 }, - { -2, -2, -2, -2, 1, 15, -5, -7, -16, -8, -19, 16, -3, -20, 36, -9, - -3, 20, 39, -20, 0, 2, 27, -16, 10, 10, -14, -22, -16, -3, 13, -8 }, - { 5, -9, 6, -25, 7, 37, 13, -10, -5, 3, -5, 7, 18, -22, -7, 9, - -5, -4, 50, -11, -4, -5, -5, 8, -4, -2, -4, -27, 14, 20, 7, -9 }, - { 0, -14, -10, -27, -14, -17, -6, 26, 10, 2, 14, -12, -5, 0, 8, 9, - 0, -28, 55, -7, -12, -7, 4, -10, 10, 7, -12, 11, 3, 5, 9, -8 }, - { 2, 23, 4, -2, -1, -20, -2, 14, 10, -9, -9, -24, 10, 0, 11, -12, - 12, 11, 49, -25, -2, 29, 7, -13, 21, -10, 11, -17, 3, 1, -8, 5 }, - { 3, 0, -14, -6, 18, -2, 17, -9, -19, 9, -5, 9, 14, 6, 19, -3, - 27, 1, 41, -21, 20, -15, 33, 0, 26, 14, 7, 10, 3, 20, -3, -12 }, - { -1, 16, 15, -8, 3, -8, -8, 21, -5, -16, -29, 4, 1, -6, -4, -28, - 2, 31, 37, -26, -2, 13, 24, 8, -9, -6, -29, 10, 7, 2, 7, 8 }, - { -10, -10, 11, 13, -32, 2, 16, 9, 14, 23, -15, -13, 24, 13, 4, -27, - 14, 12, 31, -18, 17, 23, -2, -7, -14, 9, -17, -6, -10, 20, 9, 6 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, - 4, -7, 64, -50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0 }, - { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1, - 6, -2, 50, -35, -7, 43, 7, -7, -5, -26, 24, 21, 3, -15, 5, 6 }, - { -8, 21, -19, 33, -8, 22, -11, 17, 3, 0, 0, -2, 1, -3, 6, -1, - 10, -8, 4, -11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4 }, - { -7, 5, -20, 9, -22, 3, -14, 1, 6, 13, 23, -2, -4, -7, 2, 0, - 11, 4, 6, 3, -7, -11, -7, 4, 5, 5, -12, 8, 2, 4, 7, -3 }, - { -7, 6, -4, 20, -20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3, - -9, -4, 1, 2, 5, 2, 1, -9, -2, -17, -4, 6, -10, 7, -7, -6 }, - { -9, 18, -17, 12, -24, 1, -1, 4, 14, 9, 4, 3, 2, 8, -12, -14, - 4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8 }, - { -25, 2, -11, 6, -5, 24, -28, -5, 8, 12, -2, 6, 8, -3, 8, -9, - -1, -5, -1, -5, 6, -1, -1, -1, -4, 8, -12, -2, -13, 7, 2, 1 }, - { -14, 14, -18, 20, -10, 12, -2, 9, 1, 0, 12, -2, 15, -10, 26, -17, - 16, -11, 10, -10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1 }, - { -18, 12, -18, 21, -6, 12, -6, 13, -25, 18, 1, 11, -9, -5, 0, 10, - -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8 }, - { -4, 16, 1, 18, -30, 9, 1, 6, -8, 13, 13, -12, -6, -1, 13, 7, - 6, 2, -15, -3, 5, 5, 1, -6, 1, -5, 0, 2, -16, 0, 3, -4 }, - { -21, 1, -2, 6, -43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3, - 0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2 }, - { -23, 10, 4, 7, -32, -11, -18, 2, -2, -7, -6, -3, -3, -12, 19, 3, - -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8, -15, -11, 2, 10 }, - { -8, 2, -13, 2, -29, 24, -20, 19, 1, 10, -4, 10, 1, 2, -9, 11, - -1, -2, 9, -5, 19, -7, 16, -9, -2, -18, 11, 1, 1, 0, 7, -3 }, - { -6, 3, 4, 13, -26, 10, -10, 28, -7, 28, 1, 7, 0, -14, 5, 7, - 4, -4, 3, -2, 3, 3, -11, 7, 6, 4, 0, -1, 2, -1, -3, 2 }, - { -6, 16, -31, 13, -10, 17, -6, 4, -14, 4, 4, -1, -10, 12, -5, 1, - -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7, -20, 7, 4, 11, -5 }, - { -19, 3, -17, 14, -12, 16, -22, 18, 14, 8, -2, 4, 10, 12, -14, 4, - -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1 }, - { -9, -7, -11, 24, -36, -9, -11, 5, 7, -12, -13, 18, -2, 20, 1, -4, - -1, -10, 15, -6, 14, 1, 0, 2, 1, 2, -9, -16, -11, 7, 13, 0 }, - { -24, 24, -18, 18, -22, 14, -11, 13, -12, 11, -10, 11, -7, 11, -5, -4, - -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6 }, - { -6, 18, -22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15, - -6, -18, 0, -33, -9, -12, -1, 6, 5, 2, 5, 5, -5, -17, -3, -3 }, - { 1, 11, -16, 9, -18, 11, -4, 18, 20, 26, -10, 8, 1, -11, 8, -4, - 0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1 }, - { -10, 6, -1, 18, -17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7, - -12, -1, -7, -6, -1, 8, 3, -15, 8, 9, 3, -7, 4, -1, 1, -1 }, - { -14, 6, -16, 22, 2, 5, 0, 5, -18, 11, 6, -3, 22, -20, -9, -3, - 6, -6, -7, -15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2 }, - { -21, 5, -19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3, -22, -13, -6, - -1, -3, -2, -14, 6, -3, 1, -8, -7, -5, -6, 11, -3, -10, -5, 2 }, - { -1, 9, -12, 15, -6, 6, -19, 14, -9, 11, 3, 12, -17, -3, 8, -4, - -3, -4, 1, -5, 4, 5, -7, -15, -7, 15, -6, -5, 1, -5, -3, 1 }, - { -12, 20, -15, 20, -14, 3, -14, 9, -6, 33, -13, 6, -2, 8, -6, 7, - -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2 }, - { -7, 12, -18, 12, -18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3, - 6, -12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4 }, - { -18, 12, -10, 11, -22, 0, -15, 5, -2, 2, -3, 6, -4, -4, -3, -15, - -2, -3, 21, 6, -12, -11, 19, 3, 3, -14, 7, 0, -11, -22, -10, 0 }, - { -15, 2, -30, 15, -17, 13, -16, 8, -7, 10, -8, 2, 11, 3, 10, -7, - 7, -22, 12, -10, 3, -12, 6, -10, 12, -10, 7, -8, 5, 2, 9, 1 }, - { -9, 11, -14, 6, -10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1, - -1, 4, 2, -20, -18, -1, -14, 3, -1, 4, -7, 10, 1, 11, 4, -4 }, - { -22, 8, -30, 13, -21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4, -13, - -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0 }, - { -6, -4, -35, 16, -13, 15, -11, 14, -7, 9, -1, 11, 7, 0, 13, 10, - -1, 8, 1, 1, -2, 8, -1, 2, 2, 3, -10, -1, 7, -13, -3, -7 }, - { -15, 7, -16, 14, -18, 17, -6, 14, 3, 4, 7, -3, 10, -22, 5, -15, - 4, -4, -11, 15, -15, 11, -11, 20, 1, 0, 2, 1, 11, -3, 11, -7 }, - { -12, 3, 5, 16, -37, -1, 15, 15, -15, 10, 3, -10, 1, 15, 7, -15, - -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5 }, - { -16, 26, -4, 14, -22, 26, 6, -3, -8, 4, 21, 6, 16, -4, -11, 7, - -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1 }, - { -7, -10, 4, 3, 2, -4, -12, -10, -4, -5, 16, 19, -16, 1, 2, -9, - -10, 0, 9, 7, -8, 3, 12, 8, -6, -11, -13, -1, -3, -20, 6, -5 }, - { -14, -17, 3, -5, 14, -12, -12, 8, -6, -25, 21, 21, 10, -8, -12, 4, - 10, -4, 3, -9, 11, 9, 0, 4, 2, -15, 1, -14, 4, 1, 0, -4 }, - { -4, -9, -3, -1, 6, 3, -6, 6, -10, -4, 14, 8, 2, -3, -12, -19, - 0, 11, -20, 1, 6, -2, -27, -6, 10, -17, -14, -17, -9, 8, -8, 3 }, - { -12, -13, 16, -4, -2, 12, -7, -11, 2, -13, 3, 7, -16, -18, -1, -12, - -2, 1, -12, -9, -2, -6, 2, 9, -22, -3, -4, -14, -7, 7, -1, 2 }, - { -7, -8, -8, 15, 15, 18, 15, 16, -4, -37, 11, 15, -12, -1, -3, 3, - 6, 6, 0, -5, -3, -5, 9, 1, 1, -11, -1, -8, -6, 2, 3, 0 }, - { -6, 7, -5, -12, 13, 10, -18, -4, -3, -21, 6, 16, -15, -7, -12, -9, - 1, -12, -1, 10, -2, -1, -3, 4, -4, 1, -16, -1, 12, -9, 5, 9 }, - { -14, -5, 9, 3, 4, 26, -28, 3, -6, -24, 4, 5, 3, 13, 5, -1, - 3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0 }, - { -4, 2, -10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7, - 5, 14, 9, -1, 0, -12, 4, -4, -10, 1, -3, 3, -2, -2, -6, -1 }, - { -10, 8, -15, -10, 19, 17, -8, 0, -3, -7, 7, 5, -13, -1, 7, -7, - 1, 13, -12, -13, 17, -12, 1, 26, -18, -3, -5, -6, 4, 5, 8, 1 }, - { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5, - 4, -1, -11, -8, -4, 0, -13, 2, -47, -23, -8, -11, -4, 4, -2, -3 }, - { -18, -4, 4, 5, -1, 17, -12, -8, 1, -12, 7, 20, -12, 3, -2, -11, - 16, 12, -6, 1, -13, -16, -6, -3, -3, -5, 4, -12, -5, -9, 10, 1 }, - { -11, 0, 4, 7, 7, 8, 3, -1, 3, -19, 32, 8, -19, -8, 2, 4, - -12, 15, -16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8 }, - { 3, -1, 4, -2, 14, 32, -9, -23, -10, -12, 22, 15, -1, -2, 10, 0, - 4, 6, -8, 4, -15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1 }, - { -17, -12, 6, -8, 16, 13, -20, -8, -1, -16, 10, 21, -19, 11, -9, -5, - 7, 18, -6, 7, -7, -18, 13, 2, -2, 8, -12, -9, 2, 4, -5, 16 }, - { 4, 0, 17, -11, 12, 7, -12, 5, -1, -25, 30, -8, -7, -6, -4, -7, - 9, 8, 7, 3, 3, -16, 8, 0, -2, -2, -18, -3, -4, -5, 1, 4 }, - { -3, -6, 6, -16, 17, 6, -3, 2, -9, -17, 12, 11, 11, 2, -20, 8, - 1, 1, 0, 2, -2, -6, -21, -13, -9, -15, -1, -8, -6, -8, 0, -2 }, - { -11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26, -10, -3, 4, 0, - 2, 2, -4, 4, -2, -12, 12, 10, -11, 0, -10, -16, 3, 0, 0, -10 }, - { -5, -16, 10, -6, 27, 13, -3, 4, -2, -13, 15, 5, 2, 5, 3, -4, - 13, 12, -11, -7, 0, 1, 11, 12, 2, 13, -15, -8, 9, -2, 3, 8 }, - { -5, -8, 4, 3, 9, 3, -11, 10, 14, -25, 14, 8, -2, 5, -12, -21, - 2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1, -16, 2, 8 }, - { -1, 5, 1, -11, 5, 9, -7, 8, -13, -12, 4, 12, -4, 1, -1, -1, - 27, 29, 10, 15, 2, -6, -3, 4, -21, 10, -9, -11, -6, -1, -9, -3 }, - { -6, -3, -1, -6, 11, -5, 0, -2, -5, -31, 11, 3, -1, 5, -3, 4, - 5, 7, -10, 5, -10, -13, 4, 12, -15, -2, 2, -7, 1, -9, -3, -10 }, - { -3, -7, 17, -8, -5, 36, 8, -7, -8, -20, 12, 8, 1, -1, 3, 0, - 1, 4, -10, 3, 1, 4, -2, -3, -2, -3, -10, 4, -1, -7, 3, 2 }, - { -13, -3, -5, 9, 22, 6, -23, 3, -10, -7, 17, 17, 18, -14, -8, -8, - 2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0, -12, -3 }, - { -3, -10, -15, -3, 9, 3, -23, -9, -13, -18, 12, 13, -2, 0, 1, 8, - -1, 2, -7, -12, -5, 14, 2, 1, -22, 6, -10, -8, -9, 28, -7, -14 }, - { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2, - 2, 1, -10, -2, -2, -22, -2, -7, -10, -5, -11, -27, -12, -16, 4, -7 }, - { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15, -10, -4, -2, 2, - -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1 }, - { 10, -1, 0, 5, 21, 7, -14, 6, -3, -16, 15, 17, -16, 13, 3, -6, - -4, 6, -12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4 }, - { -6, -2, -8, -11, 15, 10, 0, 8, -6, -15, 33, 8, -2, 18, -15, -11, - 5, -1, 0, 15, -15, -4, -4, -1, 10, 7, -13, 4, -4, 0, 8, 3 }, - { -7, -2, 0, -2, 0, -2, -4, -5, -14, -16, 12, 38, 7, 12, 6, -4, - 0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1 }, - { -8, -4, 18, 1, 14, 5, -12, -3, 20, -17, 5, 19, -11, -8, 11, -3, - 3, 9, -7, -8, 9, -17, 2, 15, -10, -11, 5, -5, 7, 15, -6, -2 }, - { -7, 2, 38, 5, 19, 16, -5, 4, -13, -20, 0, 4, -4, 6, 4, 2, - -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0 }, - { -11, -12, 8, -15, -3, 14, -7, -22, -11, 2, 22, 14, -19, 2, -19, -6, - 1, 3, -18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1 }, - { 8, 7, 25, -21, 12, -6, -5, -4, -10, 6, 0, 10, 1, -12, 18, -5, - -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0 }, - { 9, 10, 32, -15, 8, 2, 11, -7, -18, -8, 2, -6, -9, -16, -3, 3, - -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3, -11, 1, 5, 0, 0 }, - { 14, 0, 23, -25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0, - 3, 2, 3, -10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2 }, - { 12, 0, 25, -18, -5, -4, 13, -10, 3, -6, 7, 21, 0, -16, 3, -10, - -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4 }, - { 31, 15, 27, -20, 10, -7, 15, -10, 9, -8, 4, -5, 3, -3, 5, 6, - 11, -2, -12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2 }, - { 12, -4, 13, -23, 12, -6, 2, 4, -3, 13, 6, -7, 5, -19, -7, 18, - 1, -7, 7, 1, 16, -7, 3, 0, 3, 0, -12, 8, -11, 9, 4, 7 }, - { 29, 1, 3, -22, -5, 6, 0, 12, -14, 11, 1, 6, -3, 4, 6, -2, - 4, -13, 12, 1, 1, 3, -11, 9, -10, -1, -7, 16, -11, -1, 3, 9 }, - { 4, 4, 36, -23, -5, -8, -15, 1, -6, 3, 13, -1, -5, -7, 4, 9, - 2, -11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2 }, - { 19, 10, 6, -17, 2, -4, -2, -4, -3, 13, 2, 2, -13, -7, -3, -11, - 9, -6, 1, -9, -5, 4, -5, -9, -18, -7, -11, 9, 4, -11, 8, 4 }, - { 16, -3, 9, -16, 18, -2, -12, -16, -11, 11, -18, 16, -13, 6, 2, 8, - 3, 8, -4, -16, 10, -11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3 }, - { 14, 15, 3, -23, -5, 7, -8, -6, 2, 17, 2, 12, -8, -12, 13, -1, - -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3 }, - { 32, 5, -10, -47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4, - 6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4 }, - { 20, 8, 10, -21, -7, -9, -16, 12, 1, 4, 6, -5, 9, -11, -7, 4, - -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5 }, - { 38, 3, 23, -25, -6, -18, 3, -10, -8, 6, -10, 1, -10, 2, 2, 0, - -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0 }, - { 20, 5, 16, -22, 24, -18, 2, -12, -14, -7, -3, 10, 2, 7, -10, 2, - -8, 1, 8, -1, 4, 1, 4, -2, 5, -9, -18, -8, -13, 5, -11, 10 }, - { 14, 8, -12, -16, 9, -11, -3, -6, -25, -7, 6, 5, -7, -16, 10, 2, - -7, -1, -9, -3, 16, 4, 3, 3, -3, -3, -15, 13, -3, 4, 13, -7 }, - { 16, -9, 19, -23, 7, -19, -3, -5, -15, 11, -21, 21, -16, 18, -1, 6, - 10, -10, 18, -14, 16, -15, 6, -5, -9, 5, -17, 13, -10, 13, 0, 10 }, - { 8, -4, 4, -24, 8, -21, -18, 9, -11, 4, -6, 17, 5, -9, -2, -2, - 2, 15, -2, -3, -2, 1, 7, -13, 15, -10, -8, -11, 3, 3, -1, -1 }, - { 14, 17, 6, -32, 5, -17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9, - -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2 }, - { 24, 6, 22, -12, 8, 3, -14, 4, -7, 8, 6, 5, 6, 1, 6, -12, - 15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3 }, - { 17, 12, 3, -23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17, - 11, 0, -2, -11, 7, 4, 0, -27, -7, 1, 2, -8, 9, 7, 5, 3 }, - { 12, 10, 12, -10, -4, 5, -1, 2, -24, 5, -8, 2, 6, -17, 19, 5, - 12, -2, 16, -7, -6, -14, 4, 1, -3, 13, -16, 5, -1, 4, 1, 1 }, - { 31, 9, 11, -17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4, - -5, -8, 1, 4, 15, -6, -28, 1, 8, 3, -6, 5, 17, -2, 2, -4 }, - { 11, 19, 16, -26, 0, -7, -7, 2, -13, -15, -12, 9, -3, 27, 8, 4, - -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1 }, - { 10, 18, 16, -32, 19, -9, -4, -3, -7, 8, 8, -3, -11, -2, -6, -16, - 13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6 }, - { 9, 4, 19, -33, 4, 7, -12, 36, -3, -1, 8, -2, 2, -8, -9, -4, - -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2 }, - { 25, 7, 15, -12, 2, -24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6, - 3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0 }, - { 19, 6, 8, -20, 9, -9, 5, -4, -13, 7, 11, -3, 5, -13, -9, 6, - -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1 }, - { 15, 6, 19, -23, -3, -9, 3, 16, -6, -4, 6, -5, -10, 1, 16, -14, - 2, 0, 2, -13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3 }, - { 14, 4, 16, -20, 1, 12, 0, 6, -3, 9, 4, 16, 10, -16, 5, 7, - 5, -4, -4, -18, -3, -11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7 }, - { 22, 3, -1, -30, 18, -3, -9, 9, -2, 11, -16, -2, -14, 12, 0, 4, - -5, 4, -1, 3, -20, 12, 4, -10, -2, -2, -12, -12, 10, 6, 11, -3 }, - { 15, 7, 2, -21, 5, 4, 9, -9, -33, 7, 7, 3, -6, -14, -8, 10, - 12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8 }, - { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14, -15, 2, -7, -31, -3, - 14, 0, 14, -15, -1, -4, -15, 10, 1, -3, 1, 2, 5, 2, -8, 1 }, - { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1, -19, 0, -11, 18, - 11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9 }, - { -9, 1, -5, 0, 0, -15, 8, 4, 8, 3, 8, 12, -13, -2, -39, -2, - 4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8 }, - { -9, 6, 6, -8, 12, -12, 23, -18, 4, -15, -5, 2, -20, 13, -7, 7, - 7, -12, 14, -12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6 }, - { -18, 13, 4, 3, -10, -30, -10, -6, -14, 1, -7, -4, -35, 5, -25, 11, - 9, 8, 19, -4, -7, -3, -18, -8, 1, 5, 10, -4, -14, -9, 3, -4 }, - { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7, -16, -17, -20, 11, - -6, -14, 1, 4, 19, 2, -8, 6, -15, 3, 6, -5, -14, 3, 7, 2 }, - { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16, -14, -2, -9, -4, - 13, -2, 18, 14, 14, 19, -13, 5, -10, 2, -3, 3, 5, 5, 1, -1 }, - { -1, -5, -6, -2, -11, -7, 5, -4, 5, -1, 0, 3, -3, 2, -19, 18, - 16, 4, 14, -22, -2, -11, -22, 1, -1, 11, 1, 2, 11, -10, 7, -12 }, - { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9, -24, 23, 1, 20, - 14, -11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11 }, - { -1, -1, 1, 7, -3, -4, 8, -16, 15, -1, -7, 9, -22, -11, -11, 10, - 16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7, -14, -7, 4 }, - { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5, -22, 17, - 7, -11, 15, -5, 1, 3, -19, 0, -15, -3, 16, 5, 5, -7, -11, 12 }, - { -2, -1, 13, 2, 4, -24, 37, -5, -2, -6, 12, 7, -2, -23, -4, 9, - 2, -3, 3, 2, 3, 3, -14, 11, 0, -4, -2, -2, 3, 10, -10, 4 }, - { 2, 9, 8, -6, -28, 14, 28, -11, 18, -11, 0, 2, -2, 4, -12, 3, - 6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9 }, - { -7, 14, 5, -10, -3, 7, 4, -5, 7, -8, -7, 4, -12, 14, -16, 25, - 3, 0, 1, -5, 12, -10, 0, -10, 0, 12, 12, 17, 12, 10, -1, 0 }, - { -4, -2, 5, -2, -17, -3, 5, -5, 7, -17, 1, 5, -4, 4, -20, 0, - 11, -15, 13, -8, 10, 1, 1, 5, -12, 9, -8, 0, 6, -1, -11, 4 }, - { -3, 12, 13, -15, -7, -7, 0, 5, 33, 3, 3, -6, -13, -7, -15, 10, - 3, 3, 3, -5, 2, 7, -1, 0, -12, 2, 11, -6, -9, 0, 5, 11 }, - { -8, 5, 10, -7, -14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21, - 8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0 }, - { -8, 8, -3, -8, 8, -11, 16, -16, 17, 0, 8, 16, -17, 10, -16, 10, - -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16 }, - { -6, 0, 6, 1, -8, -8, 8, -7, -5, -10, -11, 8, -19, 6, -7, 13, - 5, -3, 4, -8, 7, -1, -18, 9, 0, -5, 6, 26, 3, 8, 2, 4 }, - { -2, -2, 23, -2, -20, 2, 7, -7, -6, -15, 3, 9, -19, -2, -10, 7, - -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8 }, - { -6, 12, 10, -10, -7, 4, 17, 11, -6, 1, 12, 11, -18, 8, -12, 4, - 1, 13, 6, -13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4 }, - { 7, 1, 7, -17, -8, 8, -1, -7, 5, -6, 4, -3, -16, 9, -24, 18, - -3, 10, 13, -11, -6, -11, -4, 10, 0, 11, 8, 2, 6, -5, -11, 4 }, - { -4, 1, -5, -10, 0, -3, 9, -2, 4, -1, 1, 5, -41, -10, -7, 4, - -3, 3, 1, 0, -12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5 }, - { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0, -17, -3, -1, 11, - 4, 1, 27, -12, 0, -14, 2, -15, -3, -9, 0, -7, -3, 15, -8, 6 }, - { -6, 4, 9, 2, 4, 3, 7, -10, 28, 1, -2, 48, 7, 0, -10, 10, - 1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5 }, - { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39, -14, -12, 5, -19, 21, - 7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7 }, - { 4, 2, -29, 12, 5, -3, 16, -6, 15, -13, -4, -1, -13, 22, -16, 17, - 16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7, -13 }, - { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4, -13, -12, 16, - 23, -4, -12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15 }, - { -6, 4, -15, -9, -1, -19, 12, -30, -17, -4, 1, -13, -13, 4, -3, 26, - 5, -25, 11, -14, -6, -13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13 }, - { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2, -11, 4, - 32, 15, 15, -47, -8, 3, -12, 4, -5, 4, -1, 0, -5, 5, 1, -7 }, - { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51, - 4, -5, 4, -14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2 }, - { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3, -11, -8, -12, 8, - 11, 5, 19, 3, -24, 19, -14, 11, -5, -18, -8, -12, -5, -4, -1, 4 }, - { 16, 9, 10, 14, -18, -2, -18, -27, 10, -5, 12, 14, 4, 0, -2, -6, - -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7, -16, -3, -6, 6, 9 }, - { 7, 15, -9, 10, -19, 4, -5, -37, -2, -4, 8, 2, 4, -1, 1, 9, - -5, -5, -12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4 }, - { 13, 17, 3, 9, -7, -7, -15, -17, -8, -13, -4, -8, 19, 2, 16, 25, - 7, 15, 2, 16, -5, -6, -10, -9, -7, -6, -2, -7, 7, 2, 4, 5 }, - { 24, 7, 9, 8, -13, -2, 0, -4, 1, -13, 3, 6, 7, 10, -4, 15, - 5, 7, -4, 5, -5, 3, 13, -7, 5, 15, -11, -2, 7, 5, 8, 6 }, - { 17, 6, -15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8, - -15, 10, -9, 7, -1, -11, 2, -8, -4, 3, 4, -10, 4, 4, 11, 1 }, - { 21, 12, -3, 6, -8, 8, -11, -8, -5, -5, 3, 7, -1, -5, 12, 15, - -10, -11, 3, 15, 8, 4, 2, -15, 0, 14, 1, -8, -1, 3, 10, -7 }, - { 16, 12, 5, 13, -6, 15, -23, 0, -17, -9, 0, 4, -9, 13, 6, 18, - 0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0 }, - { 14, 16, -1, 12, -15, -9, -6, -20, 4, 6, 8, 9, 3, 1, -9, -4, - -1, -11, 9, 11, -12, 1, -14, -7, 2, -8, 11, 9, -4, 10, 4, -16 }, - { 13, 10, 3, 7, 0, -8, -33, -6, 4, -4, 19, -2, 14, 6, 5, 7, - 6, -3, -1, -10, -10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3 }, - { 11, 10, 25, 18, -1, -6, -21, -21, -11, -16, 6, 5, 14, 4, 8, 7, - 0, -10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9 }, - { 15, 9, 5, 22, -17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3, - -2, 6, 1, 17, 8, -14, 7, -3, 12, 9, 1, 0, 1, -5, 17, -18 }, - { 25, 19, -17, 12, -4, -10, 1, -13, -19, -7, -3, 9, 6, -2, 3, 1, - 4, -2, -11, -14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1 }, - { 20, 8, -3, -10, -24, 3, -6, -2, 0, -12, 14, 6, 7, 11, 4, 7, - -12, -5, -8, -10, 5, -1, -4, 4, 16, 7, -14, 6, -1, -2, -7, -11 }, - { 16, 18, 17, 1, -15, -6, -5, -3, -1, -19, 8, -2, 2, 8, 12, -19, - -12, 8, 0, -3, -1, -1, 4, -14, 9, -1, -12, -1, -7, 10, -3, 5 }, - { 18, 12, -7, 7, 0, -3, -13, 0, -1, -4, 9, -2, 6, -1, 0, 1, - 15, -21, 1, -8, 25, -19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1 }, - { 13, 16, -4, 9, -2, 2, -1, -19, -7, -4, 18, -6, 14, 18, -5, 4, - -6, -3, -19, -14, -1, -12, 10, 6, 7, 17, -12, -13, -10, -4, 5, 4 }, - { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14, -11, -7, 2, -3, -3, - -2, -3, -13, 12, 16, 1, -5, -9, -10, -11, -2, 3, -7, 5, 11, -7 }, - { 7, 17, -16, -2, -14, -28, -7, -8, 15, -10, 7, 15, 8, 17, 13, -1, - 4, -7, -12, -11, 0, 0, 2, 3, -3, 7, -6, 6, 1, -16, 1, -2 }, - { 23, 11, -9, 15, -23, -4, -6, -4, 2, -9, -7, 9, -8, 3, -13, -4, - 8, 18, -6, -2, 1, -5, 6, -14, -5, -2, -6, -5, -3, -2, 4, -5 }, - { 12, 13, 18, 18, -35, 2, 7, -17, 3, -11, 6, 9, -3, -2, 10, -4, - 3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1 }, - { 19, 11, 1, 20, -14, 4, -9, -13, -2, 11, 0, 17, -1, -1, -1, -1, - -5, -8, 0, 5, -1, -8, 5, -1, 3, 2, -12, 21, -2, -24, 5, 7 }, - { 15, 15, -15, 17, -14, -22, 3, -4, -11, -3, -7, 1, 18, 10, 1, 10, - -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4 }, - { 45, 13, 8, 17, -5, 2, -16, 2, 8, -2, 8, -15, 4, 5, -1, 7, - -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5 }, - { 1, 18, -8, 18, -12, -10, 3, 4, -22, -12, 20, 8, -3, 9, 2, 10, - -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3, -18 }, - { 9, 10, -5, 9, -35, -21, -18, -16, -1, -12, -6, -7, -15, -19, 12, 4, - 4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4 }, - { 31, 8, -17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3, - -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0 }, - { 18, 4, -8, 7, -8, -15, -1, -16, 12, 18, 3, 19, 2, 4, 8, 8, - 0, -5, -8, -12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6 }, - { 27, 15, -17, -10, -23, -22, -1, -14, -4, -7, 20, -2, -7, 6, 15, -5, - 32, 4, 9, -11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 }, - { 22, 4, -7, 2, -15, -11, -17, -10, 2, 0, 15, 11, 7, 12, -8, 6, - -10, -18, -6, -12, 7, 3, 22, 3, -7, 14, -5, -2, -13, -7, -1, -7 }, - { 18, 13, 9, 24, -4, -19, -9, -11, 13, 8, 2, 4, -1, 8, 14, 10, - -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9 }, - { 15, 19, -5, 1, -4, -10, -8, -27, 6, 8, 5, 10, 4, 11, 5, -5, - -11, 0, -11, -14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4 }, - { 18, 1, -13, 14, -14, 9, -15, -7, 12, 1, 13, -4, -20, 12, 10, 12, - -12, 7, 1, -13, 10, -6, 5, -3, 4, 8, 10, -13, -3, -6, 9, -3 }, - { 19, -14, 5, -8, -6, 2, -5, 5, -3, -1, -28, 11, 18, -6, -4, -2, - 11, 14, -43, -42, 9, 2, 20, -23, 6, 32, 0, 5, 0, 6, 9, 5 }, - { 8, 11, -14, -1, 7, 12, -7, 2, -16, 2, 10, -3, -1, -7, -7, -1, - 1, -10, -60, -23, -18, 42, -13, 9, 18, -11, 0, 1, 0, 2, -5, 1 }, - { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2, - -2, 3, -34, -15, 37, 47, 10, 20, 9, 1, 3, -21, -25, -33, -14, 8 }, - { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5, -13, 9, 3, - -17, -19, -2, -79, -12, -7, -8, -6, -2, -2, -1, -1, -7, -13, 6, -1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, - 0, 3, 4, -87, 6, -11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1 }, - { -5, 6, 2, -24, 5, -9, -7, 0, 7, 3, -3, 16, -14, -16, 0, 18, - 15, -9, -14, -28, -17, 53, 14, -6, -28, -1, -3, -10, -7, -14, 19, -15 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, - -13, 0, -53, 3, -22, 63, 19, 16, 1, -11, 0, -3, 0, -3, 0, 1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -1, -6, -43, -43, -2, 65, -13, -4, 9, 1, 1, 2, 1, 0, 0, 1 }, - { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1, - -23, 1, -61, -55, 3, -28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0 }, - { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4, - -48, -19, -52, -46, 11, -12, 5, -14, 0, -10, 0, 0, -1, -2, -1, 0 }, - { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0, - 3, -7, -61, -51, -4, -21, -16, -21, -11, 14, -7, 8, 3, -5, 1, 2 }, - { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3, - 56, -11, -6, -67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0 }, - { 14, 9, -2, 14, -10, -10, 9, -5, 1, -8, -23, 30, 8, -7, 23, 8, - 2, 10, -1, -27, -17, 57, 22, 4, -5, 2, -12, -6, 2, -7, -4, -9 }, - { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16, - -15, 29, -55, -29, -24, 29, 3, 10, 6, 13, 10, -5, 21, 11, -14, 5 }, - { 4, 2, 26, -6, 10, 11, -23, -10, -27, -20, 3, -24, -11, -10, -13, 25, - -10, 5, -9, -36, -7, 43, 3, -13, 6, 13, -2, 0, 1, 3, -3, -4 }, - { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1, - -12, 12, -26, -64, -15, 29, 37, -7, -3, -12, -5, 14, 8, -8, -10, -2 }, - { 19, -4, -11, -16, 8, 14, 5, 19, 3, 22, -11, -21, -1, -6, -11, 11, - 10, -24, -23, -40, -8, 20, 17, 5, 13, -6, 3, 14, -20, -8, 3, 28 }, - { 2, -12, 10, -14, -18, 26, -22, 4, -2, 5, -21, 8, 3, 1, 19, 0, - -12, 24, -14, -40, 15, 29, -15, 6, 15, 1, -19, 2, 4, 7, -12, -3 }, - { 0, 17, 13, 7, -5, -11, 2, -19, 3, 38, -21, -3, -6, -4, 7, 1, - 1, -5, -40, -10, -2, 35, 8, 8, -10, -8, -9, 33, 4, 4, 0, -2 }, - { -2, -12, 7, 29, -24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2, - -37, 15, -22, -40, -11, 33, 10, -1, 8, 10, 6, 8, 9, 0, -12, 2 }, - { 15, -8, -9, -2, 7, -17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11, - -15, 14, -13, -48, 5, 18, 0, -9, -36, -11, 2, 4, 5, 5, -15, -12 }, - { -12, 0, 3, 4, 7, -5, 5, -14, -24, -18, -6, -15, -8, -20, 1, -7, - -33, -28, -40, -38, -18, -10, -5, 17, -12, 4, 3, -5, 5, -13, 4, -7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 }, - { -8, 2, 1, 22, -31, -6, -25, -3, -3, 1, -15, -11, -2, -3, 4, -13, - -9, 15, -18, 37, -7, -37, 12, -13, -11, -25, -10, -11, -22, 7, 16, 7 }, - { 14, 10, 4, -10, -1, -5, -7, -3, 16, 13, -5, -15, 5, 11, -1, 8, - -27, 7, -12, 49, 17, -22, 9, -2, -9, -1, 2, -15, -1, 41, -18, -17 }, - { -4, -9, -15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17, -19, -7, - 36, -9, -38, 17, 1, -48, 11, -18, -13, -2, -8, 4, -10, -5, 21, 11 }, - { 15, -13, 4, 2, 1, -5, -2, 1, -10, 7, -1, 3, -6, 0, 11, -11, - 8, 20, -17, 51, -17, -41, 2, 15, 4, 8, -2, 16, -32, -1, 17, 6 }, - { -8, 8, -18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8, - 30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7, -11, 2 }, - { -8, -7, 9, -10, -13, 6, -11, -14, 13, 25, -26, 5, 2, -5, -5, 5, - -8, 4, 0, 33, 12, -38, -4, 6, 13, 6, 25, 34, -1, 25, -19, -5 }, - { 18, 3, -17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8, -35, 15, - 24, 43, -5, 51, 5, -12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 2, 10, 24, 76, -2, -22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0 }, - { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, - 24, 13, 32, 70, 26, 5, -21, -9, -6, -15, 2, -2, 2, 4, 1, 1 }, - { 5, -4, -11, 4, -4, 22, 10, -2, 13, -11, -4, -21, -17, 0, -7, 4, - 10, -34, 11, 52, 2, -46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7 }, - { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1, - -8, 9, -1, 64, -13, -61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1 }, - { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1, - 10, -2, -31, 79, -10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1 }, - { 3, 12, 10, 26, -19, 10, -9, 6, -4, -15, 10, 3, -16, 6, 11, -19, - 3, 10, 18, 44, 5, -30, 5, -9, 21, 4, 20, 10, 14, -25, 8, -17 }, - { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2, - 8, -8, 13, 69, 26, -19, -25, -17, 16, 6, -12, 22, 2, -6, 9, 5 }, - { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, - -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 }, - { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15, - -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 }, - { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25, - -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 }, - { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16, - 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, - { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19, - 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 }, - { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7, - -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7, - 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 }, - { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, - -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 }, - { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15, - -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 }, - { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25, - -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 }, - { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16, - 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, - { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19, - 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 }, - { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7, - -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7, - 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 }, - { 16, -18, 7, -4, 31, -15, -9, -13, 20, -12, -6, 0, 12, -6, -2, 4, - 3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1 }, - { 38, -5, -13, -4, 8, -15, 11, 1, 2, -4, -1, 9, 13, 4, -12, -7, - 0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1, -11, -2 }, - { 47, -22, 9, -26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4, - 3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2 }, - { 14, -16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7, -19, -14, -17, - -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1 }, - { 29, -11, 5, -3, 4, 11, 4, -10, 1, -22, -3, -10, 5, 4, 2, 8, - -2, -7, -12, -12, -8, -3, -18, -2, -9, -5, -1, -3, 2, -14, -14, 7 }, - { 28, -12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4, - 4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8 }, - { 31, -18, -22, 8, 15, -5, -10, -15, 1, 10, 6, 7, 6, -8, 2, -1, - 12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7, -10, -2, 4, -3, -4 }, - { 53, -30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1, - 0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0 }, - { 27, -18, -3, -2, 4, -8, 3, -2, -11, 2, 10, -8, -8, -4, 0, -2, - 8, 0, 9, 0, -16, 11, 1, -6, 13, -3, -10, -13, -15, 25, 1, 0 }, - { 35, -5, -1, -8, 23, 11, -14, -3, 2, -2, 8, -6, 17, -2, 7, 0, - -2, 10, -17, 13, -2, -2, 11, 11, -14, 2, -2, -3, -8, -1, -12, -5 }, - { 29, -9, 7, 3, 2, -10, 0, 3, 9, 0, -3, 5, 1, -10, 10, -5, - 3, 6, -20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0 }, - { 15, -16, 18, -19, 16, -15, 17, -18, 13, -16, 17, -14, 15, -9, 13, -17, - 9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9 }, - { 21, -10, 7, -2, 12, -7, 13, -17, 11, -2, 20, 3, 5, -11, -6, -6, - -15, 0, -9, 5, -11, 7, -1, 7, 8, -10, -9, 3, -5, 9, -8, -2 }, - { 23, -22, 15, -5, 16, -4, -3, -12, 9, 3, -1, -2, -8, 2, -2, -16, - 3, 4, -2, -6, -7, 12, -8, 2, -14, 2, -7, 11, -2, 6, -4, -1 }, - { 34, -17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1, -15, - 6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6 }, - { 18, -18, 2, -2, 10, 1, 18, -23, -3, -10, 0, 4, 20, -19, -3, -4, - 2, 8, 6, 1, -3, 1, 1, 3, 5, -1, -11, 3, -7, 5, -1, 1 }, - { 15, -14, 2, 3, 10, -8, 12, -13, 13, -15, 6, -8, -4, -10, 14, -9, - 24, 2, -7, -18, 13, -11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4 }, - { 20, -12, 13, 5, -1, -10, 15, -6, 8, -1, -3, -10, 17, 0, -6, -19, - 2, -1, 8, -3, -16, 0, -3, 2, -2, 0, 8, -9, 0, 1, -10, -9 }, - { 32, 0, -9, -5, -1, 5, 13, -11, 8, 3, 11, -11, 0, -8, -2, -14, - 7, 10, 6, -5, 1, 10, 2, 12, -10, 4, 4, 6, 4, 0, -7, -10 }, - { 16, -14, 10, -7, 11, -11, 11, -11, 18, -13, 8, -15, 16, -11, 13, -9, - 8, -7, 12, -11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3 }, - { 24, -27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9, -11, -13, -5, - 10, 0, -13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3, -17, -2 }, - { 23, -19, 15, 1, -10, -18, -12, -6, 8, -3, 12, 0, -12, -10, -4, -4, - 8, -10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11 }, - { 25, -12, 4, 2, 24, -3, 3, -6, 14, 11, 0, -21, -3, -3, 1, -8, - 7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9 }, - { 24, -8, -6, 7, 16, -12, 13, -1, 11, -21, 2, -6, 3, -12, 0, 9, - 4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4 }, - { 25, -21, 13, 14, 13, -18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12, - 7, 3, 5, -5, 2, -2, 3, -10, 2, -9, -15, 6, 1, 7, -5, 1 }, - { 23, -16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4, - -6, 2, 9, -1, 14, 12, -6, -1, -17, -2, -4, -9, -7, -6, -8, 3 }, - { 50, -8, 5, 2, -11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0, - 6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2 }, - { 28, -17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19, -27, 5, -12, - 7, -14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4 }, - { 22, -19, -6, -6, 3, -22, 3, 5, 20, -8, -14, -5, 1, 1, 20, 2, - 16, 6, 3, 14, 4, 3, 5, 1, 5, -7, -10, -6, 3, -6, 1, -14 }, - { 29, -14, -8, 13, 8, -10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11, - -7, 1, 2, -9, -11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1, -11 }, - { 18, -9, 4, 1, 7, -29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8, - -13, 5, 4, -13, -4, 2, -5, -7, -6, 14, -10, -34, -3, 1, -3, -13 }, - { 38, -9, 24, 8, 11, 4, -6, -11, -2, -12, 1, 1, -11, -8, -5, -2, - -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5 }, - { -20, 11, -4, 24, -11, 1, 15, 4, 0, -28, -10, -1, 10, 10, -6, 5, - -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2 }, - { -9, 10, -23, 27, -4, -17, 20, -6, 14, -17, 5, -1, 5, -9, -7, 5, - -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12 }, - { -10, 19, 4, 9, 1, -16, 17, -2, 9, -29, -16, -11, -4, 7, -5, 4, - -1, -3, 3, 2, 3, -4, 5, -12, -2, 6, 5, -4, 4, 1, 4, 10 }, - { -20, 10, -24, 14, -5, 11, 9, 0, 16, -20, 10, -5, -6, -6, -1, 2, - -4, 5, -16, 8, -2, 5, 5, -11, 9, -11, 4, -11, -1, -1, 4, 3 }, - { -9, 11, 3, 19, 24, 4, 5, -14, 30, -17, -4, -2, -17, 7, 2, 3, - 1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3, -12, -2, 3, -3, 10 }, - { -19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12, - -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4, -20, 0, 10, -9, -3 }, - { -21, 9, 20, 12, 0, -3, 5, -9, 15, -13, 5, -5, -6, 24, 2, 9, - -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0 }, - { -18, 16, 13, 15, 2, -10, 14, -11, 4, -11, 5, 12, 12, 20, 8, 30, - 2, 11, -9, 7, 0, -3, -16, -5, -6, 5, -4, -21, 0, 5, 6, 1 }, - { -26, 8, -13, 9, 6, -10, 2, -11, 7, -4, 6, -19, -11, -6, -12, 16, - 0, 5, -7, 8, 5, 6, 17, -9, 10, -10, 5, -3, -11, 2, 4, 10 }, - { -11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14, -27, 5, -7, -4, -5, - -10, 11, 1, 15, 1, 1, -6, -5, 10, -22, -7, -7, -15, 13, -4, 5 }, - { -17, 14, -7, 13, 3, 0, 13, -6, 9, -14, -22, -1, 1, 19, 14, -3, - 4, -13, -13, 2, -4, 8, -2, -2, 13, -12, 13, -12, -7, -5, -3, 6 }, - { -17, 17, -1, 33, 6, 3, 9, -16, 3, -14, -8, 6, -17, 8, 3, 13, - 8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13, -10, 4, -17, 0, -6 }, - { -20, 7, 7, 21, 1, -3, 7, -3, -2, -12, 9, -7, 2, -3, 14, 1, - -1, -7, 12, -10, 5, -20, 11, -2, 0, -24, -17, 6, 6, -4, 3, -1 }, - { -8, 10, 6, 7, -1, -6, 28, -6, 10, -33, 1, -20, 0, -12, 10, 1, - -6, 8, -3, -1, -10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4 }, - { -17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3, - -2, 12, -15, 3, 4, 1, 2, -9, 0, -16, -21, 2, -4, 16, -7, 4 }, - { -15, 20, 8, 17, 5, -14, 15, -11, 21, -11, 13, -13, 2, -15, -13, 1, - -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3 }, - { -21, 8, 2, 16, -1, 2, 15, -16, 13, -12, -12, -7, -8, 2, -7, 11, - -8, 5, 2, -7, 16, -4, 1, -7, 3, -15, 6, -5, -8, 2, -8, 5 }, - { -15, 17, -6, 3, -3, 3, 9, -7, 14, -23, 11, 1, -1, 4, 7, 6, - -1, -14, 7, 6, -8, 5, 1, -15, 10, -9, 2, -3, -1, 4, -10, -4 }, - { -10, 18, 3, 11, 1, 4, 14, -14, 7, -4, 15, -10, 10, -11, 10, -4, - 5, -14, 10, 4, 15, -12, 15, -13, 20, -15, 14, -15, 8, -11, 4, -6 }, - { -7, 23, 2, 20, 7, 8, 19, -5, 9, -16, -8, -17, -5, 1, 5, -6, - -8, 1, -6, -4, 10, 6, 6, 2, -11, -4, 0, 2, 4, 7, 9, -4 }, - { -15, 20, -5, 22, 11, -8, 9, -5, 10, -13, -8, 8, 2, -2, -3, 7, - 6, 10, 1, 2, -5, -9, 1, 10, 16, -22, -7, 0, 7, 7, 6, 1 }, - { -26, 19, -5, 3, 5, 25, 18, -5, 9, -14, -8, -6, -2, -6, 2, 3, - -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1 }, - { -20, 14, -10, 6, -3, 7, 8, -32, -2, -7, -2, -10, 16, -12, -9, 15, - -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3 }, - { -14, 16, 4, 11, -8, 1, 23, -4, 17, -13, -10, 1, 12, 9, 12, -4, - 7, -1, -1, 5, -8, -6, 3, 3, -6, -3, -18, 0, 18, 20, 4, -2 }, - { -33, 19, -10, 30, 15, 2, -3, -1, -4, -14, 7, -7, -1, 7, -8, 9, - -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4 }, - { -6, 20, 0, 5, 17, -10, 18, -17, 9, -16, 4, -13, -6, 2, -14, 14, - -28, 9, -12, 25, -4, 7, 7, -8, 6, -6, -2, -10, 2, -11, -1, 2 }, - { -12, 14, 12, 52, -3, 5, -5, 4, 8, -13, 2, -5, -4, 2, -2, -1, - -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0 }, - { -13, 6, 9, 24, 0, 8, 14, -15, 18, -9, -11, -8, 3, 15, -2, -4, - -9, 4, -3, 12, 14, -13, 11, -4, 2, -4, 0, -6, -6, -6, -14, -1 }, - { -10, 28, 3, 12, 9, 3, 11, -28, 6, -11, -7, 4, 0, 7, 8, -9, - 0, -6, 0, -16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3, -10, 6 }, - { -11, 14, -2, 19, -1, -1, 7, 9, -2, -27, 10, -14, 15, -4, 12, -4, - 2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3, -11, 5, -9, 3, -8 }, - { -18, 7, 13, 16, -4, 3, 9, -10, 10, -10, -3, -22, -4, -12, 3, -16, - 0, -3, -16, 8, -11, 1, 10, -7, 15, 3, 0, -1, -13, 8, 1, 6 }, - { -20, 10, -10, 10, 8, -1, 6, 0, 16, -12, 9, -10, -1, -5, -4, -13, - 13, 16, -8, 12, -2, 14, 18, 13, 0, -16, 2, -5, -5, -5, -4, 3 }, - { -14, 5, -7, -17, 5, -13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4, - -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5 }, - { -19, 3, -24, -28, -9, -7, 19, 3, 2, 19, 7, 5, -13, 8, -15, -17, - 3, -11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2 }, - { -17, 18, -30, -20, -2, -3, 1, 15, -1, -11, 6, -4, 11, 11, -4, -5, - -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1 }, - { -6, 1, -30, -25, -1, -8, -2, -9, -17, 16, 3, -1, -2, -9, -6, -7, - -3, 12, 6, -4, -10, 0, 10, -8, -6, -5, -3, -11, -4, 0, -1, -3 }, - { -1, -1, -34, -28, 1, -10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7, - -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6 }, - { -11, 14, 1, -31, -7, -24, 9, 7, 6, 5, -13, 1, -1, 3, 4, -1, - -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2 }, - { -25, 8, -11, -18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4, - -4, 5, 6, 8, -7, 6, 1, -11, -15, -13, 9, -4, -14, 10, 12, 7 }, - { -20, 11, -15, -25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7, - 16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7, -17, -6, -11, 6 }, - { -11, 18, -5, -20, -15, -3, 9, 11, -20, 12, 5, 5, 11, -3, 7, 1, - 10, -6, -3, -3, 3, 3, 14, -7, 10, -17, 9, -11, -2, -6, 7, -12 }, - { -20, 8, -14, -17, -9, -13, -3, 0, -27, -14, -3, -14, 4, 3, 6, -6, - 7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8, -11 }, - { -9, 14, 2, -37, -7, 13, 6, -11, -6, 9, 18, -11, -6, 2, 12, 4, - -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8 }, - { -29, 8, -1, -13, -2, 8, 23, 2, -10, 7, 13, -6, -5, 11, 13, 0, - -10, -13, 11, -12, -10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3 }, - { -18, 6, -10, -55, -4, -11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6, - 3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1 }, - { -14, 5, 3, -21, -8, -16, -4, -2, -11, 27, 15, -20, 3, 0, 1, 1, - 2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2, -11, -4, -3, 7 }, - { -17, -1, -9, -17, -8, -18, 12, -13, -9, 13, -3, 3, 3, -3, 1, -2, - 0, 16, -9, 6, 12, 9, 5, 11, 2, -15, 1, -4, -16, 7, -4, -12 }, - { -18, 8, -6, -11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15, - 18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2 }, - { -10, 7, -18, -29, 3, 12, 12, 9, 11, 4, -1, -15, 1, -1, 8, -2, - -2, 10, -15, -1, 0, 6, 12, -6, -1, 10, -6, -3, -11, -4, 9, -6 }, - { -14, 14, -9, -21, -12, -2, -1, -7, -5, -10, 5, -8, 0, 6, 9, -11, - 11, -3, -5, 3, 8, 15, -2, -4, -22, 4, -6, 12, 2, 13, 6, -7 }, - { -12, 11, -5, -29, -25, 4, 12, -13, -11, -7, 4, 2, 2, -5, 5, 8, - 7, -5, -5, 6, 3, -10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6 }, - { -15, 11, -5, -16, 0, -13, 26, -23, -6, -3, 5, -2, -2, 21, -6, -3, - -5, -1, 6, -1, 0, -13, 2, -3, -9, -1, -4, -3, 5, -4, 12, -16 }, - { -9, 9, -1, -17, -3, -6, 12, 6, -18, -2, 11, -14, -6, 3, 14, -12, - -11, -5, 14, 2, 5, -8, -4, -11, 2, -5, 16, 6, -7, -4, 8, 13 }, - { -13, 5, 3, -28, -14, 0, 6, 23, 5, 4, -1, -17, 1, -3, 0, 0, - 5, 4, 0, -18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0 }, - { -15, 4, -13, -16, -3, -12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14, - 9, 16, 4, 1, -12, -3, 4, -7, -15, -7, -10, -14, -6, -8, -1, -6 }, - { -7, 10, -5, -10, -3, -13, 16, -1, -12, 7, -3, -12, 2, 13, 13, 2, - 17, 15, -13, 1, -5, -2, 3, -1, 1, -3, 6, -3, -12, -16, 7, -7 }, - { -11, -5, -12, -30, -6, -22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6, - -2, 0, -22, -2, -9, 2, -13, 8, 6, -8, 4, -7, -1, -6, 4, 6 }, - { -14, 5, 1, -27, -4, 2, 1, 14, -11, -7, -8, -4, 1, 8, 0, -6, - -13, 11, -12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1 }, - { -10, 10, -25, -13, -20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2, - 3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1 }, - { -9, 15, -18, -17, 4, -11, 6, 7, -12, 8, -1, -11, 2, 3, 7, 16, - -3, -9, 7, -12, 23, 0, 6, 7, -14, -9, 8, 1, -2, 6, -2, -1 }, - { -6, 9, -16, -26, -14, -11, 9, -6, 5, -2, 13, 17, 21, 7, 18, -19, - 6, -23, -2, -15, -2, 2, -10, -8, 2, 1, -2, 4, -3, -4, -5, -4 }, - { 0, 6, -5, -28, -17, -32, 2, -10, 11, 3, -5, 9, 10, 3, 11, 11, - -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4 }, - { 0, -8, -18, -34, -9, -7, -4, -11, 10, 15, 11, -1, -8, 15, 6, -13, - 9, 2, -4, -12, 0, -1, 19, 12, 6, 5, 0, -3, -10, -12, 3, -5 }, - { -10, 6, -9, -17, -12, -11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2, - -6, 3, -12, -1, 0, 1, -5, -22, -2, -12, 0, 6, 17, 5, 5, 6 }, - { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2, -29, 11, - 5, -13, -73, 24, 12, 4, -14, -10, 5, 1, 0, -11, -7, -7, 7, 3 }, - { 10, -3, -1, -3, 4, -11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7, - 21, 17, -54, 47, -14, -10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2 }, - { -12, 4, -16, -12, 5, -9, -4, 19, -7, -22, -22, -17, 3, 0, -6, 8, - 23, -4, -55, -28, 2, -26, 2, 1, 4, 0, -13, 6, 0, 10, -7, -11 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, - 35, -1, -67, -35, -24, -24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0, - 41, -4, -73, -15, 18, 4, 17, 8, -1, -16, -1, -2, 1, 0, 0, 0 }, - { -4, -4, 4, 6, -1, 2, -16, -10, -15, -10, 21, -2, -6, -2, 14, -7, - 10, -5, -55, 34, -12, 11, -13, -2, 2, 28, -26, 0, 7, 4, 21, -7 }, - { 2, 1, 15, -22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6, -15, -7, - 23, 10, -60, 8, -4, 29, -22, 2, -13, 9, -10, 12, -1, -3, 4, 7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5, - -21, -11, -60, -27, -17, -39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3 }, - { 2, -5, 9, -17, -1, 2, -3, -6, 8, 12, 7, -6, -33, -11, -14, -40, - 10, 36, -46, 0, -19, 5, 0, -10, 3, 12, -6, -8, 6, -12, -7, 1 }, - { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0, - 4, -2, -87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1 }, - { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, - 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, - { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, - -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 }, - { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20, - -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 }, - { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, - 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 }, - { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8, - -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5, - 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 }, - { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, - 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, - { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11, - -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 }, - { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16, - 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, - -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, - -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, - 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, - { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, - -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 }, - { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20, - -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 }, - { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, - 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 }, - { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8, - -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5, - 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 }, - { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, - 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, - { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11, - -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 }, - { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16, - 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, - -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, - -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5, - 0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1 }, - { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7, - -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4, -12, -11 }, - { 15, 24, -14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5, - 9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3 }, - { 9, 36, -9, -8, 7, 7, 4, 3, -1, -16, -2, 7, -5, -6, 6, 12, - -11, -12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6 }, - { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2, -10, -5, 2, - -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0 }, - { 16, 27, -1, 0, -14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1, - -1, -19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6, -14, 14, -13, -15 }, - { 12, 23, -14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7, - -3, 0, 2, 8, -13, 7, 13, -6, -4, 6, -13, -16, 14, 11, -7, 5 }, - { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3, -12, 20, 8, 9, - 8, 23, 8, -13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1 }, - { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4, - -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2 }, - { 24, 21, 1, -11, -10, 17, -14, 14, 6, -1, -6, -1, 0, -13, -1, -12, - -2, -5, 6, -4, -12, 14, 5, -2, -8, -8, 15, -7, -30, -12, 4, 0 }, - { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10, -28, 10, -17, - -8, 1, 2, -7, -1, -6, -15, -1, 4, 5, -7, 9, 0, -5, -4, 4 }, - { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12, -11, 7, 11, 13, 2, - 0, 5, 9, -10, 16, 3, -3, 5, -9, -23, 2, -2, -1, 5, 2, 11 }, - { 35, 24, -20, 2, 4, -1, 5, 14, -10, -9, 8, -7, 0, 5, -7, -7, - 11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4 }, - { 9, 35, -1, 2, -1, -19, -3, 12, -1, 8, 8, -13, -1, -2, 2, 5, - -8, -1, 13, -2, 11, 1, 0, -10, 0, -3, -7, 2, 1, -12, 3, 12 }, - { 20, 27, -12, -12, 7, 4, -1, -13, -1, -9, 2, 13, -11, 5, 7, -9, - 9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9 }, - { 8, 37, -20, -5, 0, -21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2, - 0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2 }, - { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3, -17, 10, 5, - 5, -6, -6, 6, -10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4 }, - { 14, 29, -20, -4, -3, 1, -5, -1, 2, 12, -10, -3, 4, -18, 4, 14, - -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2, -14, -3, 4, -4, -7 }, - { 23, 23, -23, -11, 27, 4, 4, -1, 7, 0, -5, 9, 2, -11, 3, 7, - -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2 }, - { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0, -12, 9, -1, 0, - -17, -9, 30, -5, -15, -16, -13, 0, 10, -11, -7, -3, -1, 0, -11, -2 }, - { 12, 32, -4, -5, 10, 19, -10, 4, -12, 5, -6, 9, -12, -6, -6, -8, - 4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4 }, - { 46, 42, -3, -14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1, - 1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2 }, - { 9, 33, -13, 4, -11, 3, -8, 22, 12, -2, 4, 0, -16, 5, 4, -1, - 7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2 }, - { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1, - 8, 7, -6, -13, -10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1, -16 }, - { 9, 28, -11, -10, 9, -10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8, - -7, 2, -15, -23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15 }, - { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16, - 0, 0, -7, -2, -13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1 }, - { 11, 37, 7, -23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8, - -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2 }, - { 21, 33, 7, 20, 21, -10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4, - 10, 2, -2, -2, 0, -10, -6, -2, 0, -5, 3, -11, 3, -9, -3, 1 }, - { 6, 30, -15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6, - 8, 2, -2, 4, -2, 5, 11, -21, 3, -10, 16, -11, 24, 10, 14, -6 }, - { 15, 36, -3, -9, -20, 12, 0, -7, -18, -4, -8, -9, 9, -7, -3, -1, - 2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1 }, - { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3, - 3, -19, 1, 5, 4, -2, -6, -5, -10, -11, -8, -2, 2, -5, -8, -7 }, - { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10, -11, -4, -13, -12, -6, -4, - 0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7 }, - { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6, -13, -14, 8, -1, 1, 2, - -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1 }, - { 0, 6, 0, 0, 4, 13, -7, -16, -6, 15, -14, -21, -9, -10, -10, -6, - -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6, -10, -7, -18, 1, 4 }, - { -1, 3, 10, 1, -1, 15, 4, -7, -16, 3, 0, -22, 10, 2, -3, -2, - 13, 5, -8, 16, -5, 4, 0, -11, -10, -22, 0, -4, -17, 5, 2, 1 }, - { 12, 8, -4, -9, 14, 40, -21, 0, 1, -15, -10, -12, 12, 6, -10, 2, - 8, 6, -12, -10, -11, 1, 0, -11, 2, 1, 13, 0, 6, 3, 8, 4 }, - { -10, 3, 5, -4, -3, 3, 0, -9, 2, 8, -22, -23, 17, 8, -17, -3, - 14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1, -10, 0, -2 }, - { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2, -16, -15, 12, 21, -7, -4, - 7, -7, -11, -15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9 }, - { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13, -14, -20, -4, 11, 8, -4, - -1, 2, 0, -7, 5, -17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14 }, - { -2, 6, 2, 8, -2, 5, -4, -2, -10, 3, -45, -30, -3, -3, -12, -4, - -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1 }, - { -3, 14, -16, -10, 10, 0, -2, -40, -9, 12, 2, -19, 15, -4, 4, 3, - 3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0 }, - { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21, -10, -26, 7, 2, -9, -7, - -3, -16, 8, 5, 5, -6, 10, 4, -14, -6, 5, 3, -2, -2, -4, 1 }, - { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13, -16, -18, 20, 6, -5, 0, - -3, 2, 8, 4, -19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7, -11 }, - { 2, 5, 16, -4, 19, 15, 4, 0, -11, 7, -10, -10, -16, 18, -11, -12, - -9, -4, 7, -4, -4, -17, 1, 1, -8, -3, -3, 5, -2, -6, -11, -5 }, - { 2, 12, 0, -9, -10, 14, 6, 2, -3, 2, -12, -28, 12, 1, -1, 2, - 0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3, -12, 4, -17, -5 }, - { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6, -24, 23, -9, -15, 13, - -7, -9, -15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9, -10 }, - { 1, 5, 11, 3, 6, 12, -3, 8, -21, 5, -7, -20, 12, -2, -9, -3, - 17, -7, -8, -9, -14, 3, -13, 18, -8, 9, 2, -8, 4, -8, -5, -2 }, - { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1, -39, -6, 13, -13, 0, - -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0, -13 }, - { 2, 8, 5, -12, -13, 22, 8, -16, 11, 5, -2, -32, -2, -4, 11, 5, - 5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3 }, - { 13, 9, 5, -4, 9, 18, -11, 2, -1, 15, -10, -19, -2, 14, 0, -10, - 1, 1, -18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9, -13, -3, -2 }, - { -13, 11, 11, -9, -10, 13, -3, -18, 2, 10, 5, -21, 6, 15, -11, -21, - 3, 14, 0, -12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2 }, - { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6, -26, 2, 12, -3, -5, - 12, -2, 1, 8, -7, -17, -19, 5, 10, 7, -3, 2, -3, 0, 5, 0 }, - { 5, 0, 3, -3, -9, 5, -15, -5, -5, 17, -5, -31, 0, 13, 13, 5, - -1, -6, -14, 7, -8, 9, -14, -2, -16, -4, -4, -6, 6, -6, -10, 6 }, - { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8, -32, -1, -4, 0, 3, - -10, 7, 10, -10, 4, -1, 6, 2, -16, -9, 4, 3, 13, -23, -3, -4 }, - { 4, 11, -4, -9, 4, 11, -12, -12, -12, 6, 1, -28, -3, 14, 18, -2, - -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2, -13 }, - { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36, -10, -22, 3, 23, -3, -10, - -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1 }, - { -1, 1, 13, 1, -6, -1, -6, -9, -18, 17, -5, -37, -1, -1, -6, -4, - 1, -6, -15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5 }, - { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7, -16, -5, 23, -14, -13, - 8, -15, 11, 10, -11, -13, -33, -5, -2, 1, 6, 8, 0, -13, -9, 5 }, - { 11, 7, -2, -8, 9, 11, 25, -14, 7, 3, -1, -33, 14, 8, -6, -19, - 3, 3, 2, -1, -3, -1, -2, -10, -3, 1, 2, 1, 4, 2, -3, 4 }, - { -2, 8, 4, -2, 9, 13, -4, -2, -15, -3, 19, -37, 9, 25, -9, 2, - -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3 }, - { 10, 13, -1, -15, 4, 6, -18, -4, 25, 1, -23, -17, 15, 13, -8, -8, - 7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2 }, - { 1, 3, 9, -5, 27, 15, -9, -31, -1, 23, -2, -9, 1, 8, -1, -7, - -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3 }, - { -8, 7, 3, -6, 8, 3, -11, -2, 36, 14, 1, -30, 6, 10, -12, -6, - -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8 }, - { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6, -25, 11, -6, -9, -11, - -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8 }, - { -22, -21, -9, -19, -5, -7, -12, -15, -8, 9, -19, 14, -7, -4, 5, -8, - -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3 }, - { -32, -13, 3, -24, 3, -8, 4, 1, -10, 14, -15, 0, 4, 6, -1, 6, - 7, -1, 6, 4, -3, -17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4 }, - { -32, -11, 7, -8, -12, 13, -5, -22, -4, 12, -16, 2, 0, 4, 0, 1, - 0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4 }, - { -44, -33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1, - 1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1 }, - { -30, -18, -24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7, - 5, 7, -11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6 }, - { -22, -20, -13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1, - 2, -3, 6, -19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2 }, - { -27, -8, -1, 3, -1, -11, 24, 4, -1, 1, -8, 8, 5, -11, 15, -3, - -15, -1, -1, -13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6 }, - { -33, -16, -1, -8, 10, -23, 6, 13, -1, -3, -9, 0, 5, -7, -5, -12, - -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4 }, - { -22, -17, 11, -3, 3, 1, -1, -5, 17, 2, -15, -2, 10, -9, 6, 14, - -16, -12, 20, -1, -7, 6, -3, -12, 1, 10, -10, -1, 7, -3, -1, 10 }, - { -28, -13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10, -10, -3, 7, 2, - 4, 19, -1, -1, 10, 5, -8, 1, 11, -15, -4, -3, -5, 4, -13, 3 }, - { -22, -13, 42, -20, 5, -13, 7, -11, 1, 1, -1, 1, 6, 3, 6, -11, - 3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4 }, - { -26, -15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3, -10, 7, -8, -12, - -5, 12, -9, 3, -2, -3, 18, 1, -12, -15, -4, 5, -3, 0, 12, 7 }, - { -26, -16, 5, 6, 14, -3, 15, 6, 1, -7, -13, 16, -15, 5, 11, -2, - 9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12 }, - { -31, -17, -8, -30, 4, 14, 6, -6, 6, -11, 0, 3, -4, 0, 0, -4, - 0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5 }, - { -61, -10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2, - -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0 }, - { -28, -13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5, - -3, -2, -2, -12, -14, -9, -11, -15, -12, -5, -4, -12, 3, -3, 0, -5 }, - { -41, 0, 12, -24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9, - 9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4 }, - { -26, -19, -2, -15, 4, -14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5, - -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2, -10, 0 }, - { -29, -18, 9, -4, 1, -5, -14, -12, 5, -10, -5, 4, -5, 0, -1, -1, - 4, -5, 7, -16, -11, 2, 7, -15, 2, -4, 6, -4, -6, 7, -3, 7 }, - { -27, -16, 9, -14, 3, -8, 9, 0, 7, -4, -3, -7, 0, -10, -1, 2, - 1, -2, 15, -10, 14, 7, 6, 17, 3, -4, 3, -10, 8, -8, 3, 11 }, - { -21, -20, -8, -8, 4, 5, -3, -2, 0, -5, 14, -10, 11, -4, 13, 0, - 5, -11, 19, -18, 18, 3, -5, -3, -4, -8, 11, -10, 10, 3, 4, -9 }, - { -35, -15, 13, -12, 4, 0, -2, -4, -12, -3, -8, -24, -7, 1, 7, 8, - -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6 }, - { -19, -14, 13, -10, 9, -1, 1, 3, -12, 5, -16, 7, 13, 9, 4, -4, - 6, -5, 4, 9, -3, 17, -4, 12, -11, -6, -5, -6, 13, 2, 7, -9 }, - { -34, -8, -4, 1, 2, -1, 3, 6, -20, -11, 8, -1, 4, 2, -9, 4, - -4, -5, 16, 10, -4, 14, -13, 1, -6, 0, 2, -10, 0, -3, -3, 7 }, - { -36, -10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15, -11, - 0, 2, 3, -1, 4, 0, 8, -1, 0, 18, -11, -5, 15, -5, 13, -12 }, - { -22, -13, 14, -20, 15, 25, 16, 10, 8, -2, -10, -5, -1, -8, 11, 8, - -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2 }, - { -31, -22, 7, 6, -2, 5, -20, 14, -6, 7, 0, 14, 3, -7, 3, -6, - -2, 1, -3, -5, 1, -10, 1, -24, 6, -2, 3, -7, 1, -7, 8, 7 }, - { -25, -20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8, - 3, 5, 6, 5, -10, 10, -4, -15, -15, -2, -9, 2, 18, 1, 8, 12 }, - { -24, -19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6, - -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8, -11, 8, 4, 2 }, - { -26, -20, -12, -12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2, - 9, 22, 13, 4, -4, -1, -2, -14, 5, 15, -8, -5, -7, -11, -14, -6 }, - { -21, -18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3, - 1, 3, -5, -2, 2, 4, 0, -1, 10, 2, -19, -8, 8, 30, -7, 8 }, - { -25, -6, 26, 4, -8, 4, -2, 21, 5, -4, -16, 5, 13, 4, -10, -1, - -6, -2, 2, -10, -13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5 }, - { 0, -1, -2, 19, -12, -48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2, - -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5 }, - { -11, -8, -28, 18, 16, -24, -8, 19, 4, 8, -12, 9, -4, -2, 4, -7, - 6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1, -16 }, - { -9, -5, -26, 7, -3, -37, -16, -2, 2, -7, 4, -13, 0, -4, -6, -5, - -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4 }, - { 2, 9, -18, 7, 29, -24, -1, 7, 14, 10, 3, -3, -2, -5, 6, -10, - -6, -3, -8, 0, 5, 1, 4, 3, -12, 2, 6, 1, 3, 4, 1, -3 }, - { -20, 2, 8, 20, -9, -24, -4, 18, 3, 11, -1, -11, 6, 9, -1, -3, - 1, -1, -15, 3, 15, 9, 3, 2, -13, 2, -8, 8, 1, -1, 1, -8 }, - { -12, 5, -11, 6, 19, -26, -17, -6, 4, 14, 6, -8, 9, 5, -6, -5, - 2, -1, 20, 1, -11, -10, -18, 20, -7, 0, -3, 4, 2, 0, 10, 4 }, - { -15, 1, -2, 13, -8, -21, -22, 4, 4, 3, 3, -7, -31, 4, -10, -14, - 0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7 }, - { -13, -10, -9, 12, 19, -16, -3, -2, 9, 2, 11, -29, -1, 9, 4, -3, - 1, -10, -10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1 }, - { -17, -1, -5, 19, 12, -9, -21, -5, 2, 12, -7, -7, -3, 8, 7, -2, - 6, -9, -9, 1, -4, 1, 1, 3, -14, 2, -8, 0, 10, 1, -12, -6 }, - { -13, -5, 8, 15, 0, -20, -2, 20, 8, -8, 8, -19, 12, 10, 2, -11, - 0, 12, 1, -11, 0, -11, -15, 5, -11, 2, 4, -4, -11, 5, -4, -5 }, - { 3, -11, -7, 8, 0, -17, -26, 15, 19, -7, 10, -9, -5, -5, 14, -25, - 0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2 }, - { -12, 5, 5, 9, 14, -18, -19, 4, 2, 16, 14, -21, -15, -9, -1, 16, - 12, -11, -10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4 }, - { -10, -5, -1, 8, 7, -23, -10, 14, 6, 11, 10, -16, -3, 16, 6, 0, - 0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2, -10, 3, 0 }, - { -2, -14, 2, 16, 15, -17, -17, 6, 19, 4, -10, -15, -1, 15, 11, -14, - -8, 5, 8, 8, -2, -8, -11, 10, 10, -8, -14, 2, 13, 4, -2, -12 }, - { -10, 3, 6, 4, 19, -23, -19, 1, 4, -9, -30, 3, -6, 18, 0, 2, - 0, -11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6 }, - { 9, 5, -2, 21, 20, -33, -13, 7, -10, 8, 8, -15, -6, -4, 1, 5, - 3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3 }, - { -9, -3, 3, 15, -3, -30, -7, -7, -25, 6, 2, -6, 1, 19, 1, -12, - 1, -8, -13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4 }, - { -6, -12, -17, 25, 22, -13, -10, 9, 2, 11, -7, -16, 4, 6, 1, 0, - 0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0 }, - { -1, 0, -10, 8, 8, -27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0, - 6, 10, 6, 4, 2, -7, 9, -18, 3, 3, 3, -10, 17, 10, 9, -6 }, - { -3, -12, -6, 11, 20, -32, 5, 21, 3, -4, -9, 2, -10, 1, 7, -4, - 5, 0, 0, -1, -8, -9, -7, 4, -10, 5, 0, 2, -5, 4, 9, 1 }, - { -5, -1, -5, 1, 2, -19, -13, 1, 6, 12, 2, -16, -17, 11, 10, 13, - 16, -12, -11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5, -11, 3, -14 }, - { -19, 5, 10, 11, 2, -23, -9, 16, -2, 7, 0, -11, -7, 10, 6, -7, - 26, -15, -4, 8, 6, -4, 7, -9, -15, 1, 8, -4, 4, 2, -12, 16 }, - { -11, 1, 11, -4, 1, -31, -13, -1, 8, 5, 4, -2, 0, 13, 7, -17, - 7, -10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4 }, - { -3, 1, 10, -1, 0, -15, -22, 4, 40, -11, -4, -3, -14, 9, 11, -1, - 9, -1, -6, 6, 3, -6, 0, 0, -12, 7, -2, 0, 9, 3, 1, 3 }, - { -1, -1, -1, 14, 8, -24, -14, -8, 5, 8, 5, -12, -17, 8, 2, 7, - 10, -8, 0, 4, -6, -6, -10, 8, 4, -12, 3, -9, -12, 5, 4, -3 }, - { -5, 1, -11, 8, 9, -24, 0, 2, 2, 14, -12, -13, 1, 6, 7, 0, - 7, -6, 9, 26, 11, -14, 8, 10, 1, 9, 0, 11, -2, 6, 2, -10 }, - { -13, 1, 4, 34, 19, -17, -15, 0, 3, -2, -7, -1, 0, -3, -3, -1, - 1, -1, -10, 8, 5, 0, -8, 4, -17, 9, -2, 0, 0, 6, 2, -3 }, - { -6, -4, 1, 2, 2, -14, -29, 0, 9, 34, -3, -5, -14, 6, -10, -9, - -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3 }, - { -4, 6, 3, 14, 14, -8, -29, 31, 11, 14, -4, -5, -6, 10, 6, -9, - -1, -11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4 }, - { -4, -4, -2, 14, 6, -32, -6, -14, 14, -5, -11, 10, -18, -4, 6, -8, - 9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2, -10, -6, -17, 3, 17 }, - { -16, 9, 21, 19, 4, -20, -17, 14, 9, 15, -6, -17, -1, 1, 6, -3, - 1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2 }, - { -7, -5, 3, 19, 1, -20, -9, 14, 21, -7, -18, -9, 26, -7, -17, -7, - 12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1 }, - { -20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8, -17, 0, 5, - -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1 }, - { -35, 17, 6, 1, -9, -1, -16, 3, -20, -13, 8, 7, -4, -7, -4, -20, - 7, 12, -5, 5, -5, -11, 12, -1, 15, -9, -6, 16, -4, -9, -13, 4 }, - { -21, 36, -19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2, - -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3 }, - { -12, 33, -4, 1, -12, -9, 0, -13, -1, 2, -8, 4, -10, 6, -16, -7, - -1, -4, -10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7 }, - { -14, 32, 5, -7, -15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7, - 4, -10, -10, 10, -1, 2, 0, -2, -11, 5, -3, -4, 2, 2, 7, 4 }, - { -14, 34, 1, 20, -1, -12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7, - -9, -20, -7, -4, -13, 12, 1, 12, 5, -6, 2, -4, 0, -15, 1, 3 }, - { -21, 23, 7, -8, 3, -13, -3, 0, -6, -2, -7, 6, -12, 9, -6, -2, - -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6, -15, 3, -5 }, - { -27, 32, -1, -4, -2, 4, -10, 12, -3, 8, 13, 7, 0, -15, 4, -2, - 3, 5, 7, -4, 9, -12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6 }, - { -17, 29, 15, 0, -1, -4, -10, 13, 12, -1, -8, -10, -10, 4, 7, -2, - 6, -5, -13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4 }, - { -38, 27, 16, -15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6, - -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5 }, - { -33, 40, -4, 2, 1, 0, 0, -10, -14, 0, -7, 4, -1, 3, -2, 5, - 7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4 }, - { -20, 25, 12, -4, 16, -4, 2, 2, -14, -2, -3, 29, -1, 1, 3, 1, - 9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1 }, - { -10, 30, 17, 3, -5, -2, 0, -5, -22, 4, 5, 5, -3, -18, -6, 10, - -5, -7, 2, 8, 7, -7, -11, -2, 0, -3, 3, 2, 11, -4, 4, -4 }, - { -11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4, - -3, 10, 13, 14, 5, -5, 1, 1, -10, 2, 15, 4, 9, -1, -5, -3 }, - { -17, 32, 18, -18, -3, -5, 6, 10, 1, -15, -5, 9, 8, -12, -10, -6, - 11, 9, -5, -8, -7, 10, 5, -10, -14, -4, -3, 1, 9, -11, 2, 1 }, - { -13, 28, -11, -1, 2, -16, -2, 7, -24, 0, 3, 6, 3, -1, -8, -7, - -12, 2, 2, -20, 10, 4, 0, -13, -2, -2, 1, 8, -14, 0, 4, 1 }, - { -14, 23, 12, 8, 8, -26, 2, -4, -14, 13, -14, 15, 3, -9, -1, -13, - -10, -2, -10, 6, -16, 12, 8, 0, 9, -10, -7, -4, -4, 7, -8, 8 }, - { -20, 45, 10, -14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5, - -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1 }, - { -20, 26, -4, 1, 7, 4, -8, 1, -5, -13, 2, 13, -7, -3, 6, -6, - 22, 0, 5, 11, -4, -11, 8, -9, 2, -2, -4, -2, 2, -13, -4, -8 }, - { -28, 18, 17, 3, -8, -23, -16, -6, 5, -10, 14, 10, 5, -1, -8, 4, - -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4 }, - { -12, 32, -6, -16, 18, 12, -16, 0, 7, 13, -4, 5, -8, -1, -3, 4, - 6, -2, -1, -13, 4, -1, 3, 12, -3, -10, 1, 6, 8, -11, -2, 4 }, - { -18, 26, 2, 5, 0, -9, -17, 14, 5, 1, 7, -3, -8, -3, 11, 7, - -5, -12, -8, 7, 0, -7, 2, -12, -9, 13, -11, 9, 6, -11, -5, 11 }, - { -24, 22, -15, -9, 8, 1, -7, -12, -9, 3, 11, 15, 14, -11, 12, -15, - -5, 7, -2, 0, -8, 3, 3, -1, 2, 11, -11, 14, -6, 13, 1, -6 }, - { -20, 28, 18, -4, -6, -5, 12, 14, 2, 10, -13, -6, -8, -6, -13, -1, - -26, 22, -3, -14, 6, 0, 10, -15, -13, -9, 6, -7, 1, -5, -4, -1 }, - { -19, 26, -8, -3, -14, -6, -9, -4, -8, 15, -8, 3, -12, -4, -2, -7, - -5, 3, 13, -3, -4, -25, 4, -1, 5, -12, -1, -13, 5, 2, 0, 6 }, - { -18, 43, 14, -8, 1, -23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3, - -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9 }, - { -11, 30, 10, -14, 3, 1, 10, -11, 1, -7, -4, 14, 2, 1, -9, 1, - -11, -2, -7, 5, -11, 1, 3, 14, 1, -16, -8, 3, -5, 7, -4, 4 }, - { -18, 24, 6, 3, 8, 7, -22, -7, -7, 3, -8, 4, 23, 9, 3, -1, - 3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3 }, - { -15, 38, -7, -1, -11, 2, -17, -24, 24, 8, 7, -4, -5, 2, 2, -7, - 1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3 }, - { -14, 22, 1, -5, 9, -12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3, - -33, -16, -9, -1, 12, -11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4 }, - { -14, 20, 6, 4, -10, -4, -4, -4, 1, -7, 2, 6, 8, -12, 4, 1, - -1, 12, 10, 3, -14, -10, -3, 18, -2, 33, -5, -17, 17, -5, 9, 7 }, - { -12, 23, 13, 0, -11, -8, -11, 12, -5, -9, -16, 11, 6, 4, 12, -5, - 5, -13, 7, -12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11, -12, -3 }, - { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6, -20, -10, 4, 26, - -6, 13, 4, 3, 2, -11, 5, -7, -10, 4, 9, 1, 10, -4, 11, 4 }, - { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3, - -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2 }, - { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5, - 7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5 }, - { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7, -10, -8, -18, - 3, -2, 2, 7, -15, -11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5 }, - { 10, -6, 8, 11, 12, 20, 22, -11, -3, 15, -3, 15, -2, -2, 0, 2, - 5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7 }, - { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2, - 4, -9, -3, -14, -12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0 }, - { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3, - -10, -2, -7, 11, -11, -10, 17, -1, 3, -15, 2, 9, -15, -10, 16, 10 }, - { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6, -13, -1, 6, 5, - -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1 }, - { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2, - -15, -11, -10, -4, -13, -6, -17, -13, -6, -14, 1, -10, 6, 4, -1, -1 }, - { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3, - -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4 }, - { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8, -12, - 9, -10, -7, 1, -1, 19, 0, 2, -8, -11, -10, 9, 6, 11, 0, 3 }, - { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4, - 4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1 }, - { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3, -10, 7, 6, - -8, -7, 2, -13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0 }, - { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5, -14, 8, 0, 9, - 8, -10, 5, -15, -6, -9, 9, -1, 18, -16, 9, -21, -3, -13, -2, 8 }, - { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7, - 4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5, -10, 8, 4, -5 }, - { 9, 2, 16, 14, -5, 14, 1, 0, -21, 17, -1, 9, 12, -3, -3, 4, - -4, 14, 10, 3, 0, -10, 7, 4, 4, -11, 2, 4, -1, -3, 9, -1 }, - { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8, -18, -11, -3, - -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6 }, - { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4, -16, -2, 14, -2, - 1, 8, 12, 14, 3, -3, 8, 8, 12, -15, 3, -3, 3, -2, 14, 10 }, - { 22, -3, -11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2, - -2, 0, -5, -27, -10, 3, -1, 5, 8, -24, -3, -11, -3, 2, 11, -1 }, - { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14, -10, 1, -12, -10, - -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4 }, - { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9, -15, 15, 6, -8, - -10, -13, 5, -8, -20, -13, -6, -11, -1, -3, -6, -4, -1, 0, 13, 15 }, - { -2, -1, 9, 12, 2, 2, 13, 3, -23, 33, 15, 2, -4, -1, 3, 8, - 8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1 }, - { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1, -12, 3, - -13, -18, 2, -11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5 }, - { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5, - 5, -3, -2, -14, 0, -12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1 }, - { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15, - 2, 1, 2, -10, -10, 0, 2, -1, 0, 1, -12, -1, 21, 16, 9, -7 }, - { 11, -4, -5, 24, -7, 11, 20, 11, -15, 18, 5, -13, -15, 0, -5, 9, - 1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3 }, - { 20, 0, -12, -6, 9, 31, 9, 12, 8, 27, 15, 7, -16, 5, -3, -7, - -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2 }, - { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4, - 4, -6, 0, -4, -4, -3, 3, 6, 3, -13, -8, 5, -3, -7, 8, 5 }, - { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1, - 2, 0, -15, -9, -16, -2, 8, -17, -5, -22, -19, -5, -1, -10, 1, -2 }, - { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9, - 9, -11, -17, 0, -6, 16, 0, 1, 9, -24, 3, 3, -9, -3, 3, -2 }, - { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6, - 5, -2, 6, -2, -4, -3, 0, -3, 13, -50, 1, -2, 2, 4, 4, 3 }, - { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1, -15, -1, -15, - -11, -4, -17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12 }, - { 1, -2, 2, -1, -10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0, - 1, 1, 6, 0, 11, 13, 3, 4, 0, -12, 11, -5, 19, 20, 2, 5 }, - { 5, 3, -13, -2, 1, -12, 11, -7, -12, 7, 10, 0, 7, 0, -2, 4, - -6, -9, -11, -12, -23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12 }, - { 6, -3, 2, 5, 2, 2, -2, -5, -8, -11, -4, 3, -8, -4, 5, -3, - -16, -4, 3, -12, -4, 3, 32, 7, 2, 8, 32, -18, -1, 12, 1, 7 }, - { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4, -12, -1, 3, 0, 1, -18, - 8, 8, -14, -10, -11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6 }, - { 3, 5, -14, 7, 14, 8, 20, -13, -16, -10, -2, 17, -7, 4, -8, -9, - 14, -5, 3, -4, -12, 7, 14, -10, -19, -20, 35, 8, 13, 14, -2, 9 }, - { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2, - 3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14 }, - { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6, - -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1 }, - { -11, 1, -3, -3, -11, 3, -9, -25, -1, -16, 4, -8, 15, 1, -2, 7, - 8, 23, 2, 18, -13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4 }, - { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1, -13, 2, 2, 10, 6, 7, - 18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5 }, - { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5, - -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13 }, - { 2, 4, 3, -7, 5, 8, -11, 7, -5, 9, -10, 6, 8, -10, -3, 10, - 1, -29, -4, -26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0 }, - { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0, - 5, -1, -2, -2, -1, -4, -10, 8, 0, -6, 10, -4, 46, 12, 2, 28 }, - { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3, - 1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35, -11, 13, 53, -3, -1 }, - { -5, -2, 0, -13, -16, 5, -12, -11, 1, -30, 3, -18, -24, -8, -5, -19, - 1, -3, -8, 7, -7, -8, 15, -19, 4, 10, 30, 24, 6, 1, -9, 10 }, - { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2, - 22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18, -12, 18, 16, 4, 16 }, - { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6, - 10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11 }, - { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2, - -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0 }, - { 4, -3, -7, -5, -11, -5, -12, -10, -10, -12, -15, -12, -14, -14, 1, 1, - 10, -10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3 }, - { 7, -3, -2, 4, 6, -8, 2, -3, -12, -5, -9, -8, -10, 15, -2, -4, - 8, 9, 7, -13, -18, 34, -5, 7, 12, 22, 16, -11, 13, 25, -15, -11 }, - { -3, -2, 0, -4, 1, 0, -3, -13, -7, 13, 12, -7, -10, 13, 19, 6, - 16, 15, -12, -15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6 }, - { 3, -5, 0, -4, 0, 4, -11, 4, -7, -3, -1, -8, 3, -2, 2, 1, - 11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4 }, - { -1, -4, -9, 5, -8, -18, -4, -9, -20, -18, 7, -14, -16, 3, 8, -3, - 29, 11, -13, -13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5 }, - { -3, 8, -10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8, -14, 15, -5, - 16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13, -11, 1 }, - { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8, -10, - 0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12 }, - { -4, -7, -31, -2, -7, -1, 5, -5, -5, -12, 4, -7, -6, 3, 15, -2, - 5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24 }, - { -7, 0, -3, -6, 1, 3, -13, -6, -4, -4, -5, -9, -1, -10, -4, -8, - 2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6 }, - { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4, - 6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20, -27, 14, 1, 2, -3 }, - { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8, - -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17 }, - { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2, -10, 0, 7, 21, -1, - 0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14, -20, 15, 14, 4, 15 }, - { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9, -10, -2, - -5, 0, -3, -21, 9, 14, -11, 13, 29, 2, 25, 4, 22, -1, 2, -3 }, - { 2, 12, -11, 2, 16, 9, -4, 7, 1, -10, -15, 11, -4, 3, -2, 4, - 4, -5, -10, 1, 4, 19, -15, 6, -4, -2, 30, -7, 11, 21, -12, 5 }, - { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0, - 8, -7, -3, -2, 2, 14, 2, -3, -26, -1, 26, 22, 32, 1, -2, 6 }, - { 1, -38, -1, -20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10, - 6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1, -14, -1, -9, -5, -4 }, - { -5, -26, -7, -19, -10, -5, -11, 5, -11, -25, -8, -14, -9, -16, -8, -6, - -17, -14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3 }, - { 17, -49, -3, -23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4, - -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0 }, - { 4, -34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2, -16, 7, -3, - 8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4 }, - { 5, -29, 13, -2, -14, 3, 1, 18, -15, 4, -8, 8, -10, 8, 2, 1, - -8, 15, 3, -10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6 }, - { 13, -20, 3, -18, -17, 4, -14, 13, 28, 11, -8, -6, 16, 6, 0, 10, - 3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1 }, - { 3, -27, -5, -11, -21, -11, -12, 0, -5, 7, -22, 1, 3, 5, 0, -5, - 8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6 }, - { 31, -45, 0, -1, -12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3, - -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1 }, - { 9, -45, 6, 5, -1, -17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8, - -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7 }, - { 3, -26, -2, -12, -12, 2, -10, 16, -3, 12, 4, 5, 11, 8, -16, -17, - -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7 }, - { 8, -26, 32, -7, -5, 22, 2, 14, -10, -8, -7, 3, 3, 7, 0, -5, - 0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6 }, - { 4, -31, 2, -14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5, -10, - -2, -10, -2, -10, -3, 7, 1, 5, -8, 8, -14, -3, -15, 7, -10, -6 }, - { 16, -27, 13, -4, -23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23, -18, - 7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2 }, - { -1, -35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6, -10, 9, 6, - -3, -5, -6, -3, 9, 16, -16, -9, -20, 12, 3, 5, -3, 1, -9, 4 }, - { 2, -24, 1, -12, -16, 5, -4, 3, -4, -1, -11, -11, -8, -14, 14, 10, - -8, 20, 8, -3, -11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7 }, - { 9, -21, 2, -19, -7, -5, -8, 25, 3, 17, 5, -3, 9, -12, 8, 2, - -4, 3, 3, 1, 11, -9, -4, -3, 4, 3, -22, 6, 4, 6, 11, -5 }, - { 16, -23, 13, -17, -21, -12, 5, 9, -20, 7, 6, -6, 0, 2, -9, 6, - -6, -13, -7, -1, 5, -3, 5, -7, -10, 1, 0, 8, -9, 11, 0, -8 }, - { 10, -26, -9, -7, -19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1, - 6, -7, 1, -8, -11, 10, -14, 0, -16, 6, -3, 5, -1, 14, 12, 1 }, - { 8, -27, 12, -14, -1, -1, -19, 10, -11, 21, -14, 9, -8, -3, 8, -1, - 12, -13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1 }, - { 18, -20, -14, -14, -16, -3, -24, 6, -17, 2, -3, -11, 2, -3, 12, 10, - 10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0 }, - { 0, -30, 9, -16, -18, 15, 12, -3, 4, -4, -5, -11, -4, -12, -10, 0, - 2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7 }, - { 25, -24, -1, -6, -9, 6, -13, -2, 3, 15, -3, 11, 4, -8, -11, 2, - 0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1, -11, -15, -5, 0, 11 }, - { 0, -34, -7, -11, -7, 9, -3, 19, 4, -8, 3, -11, 11, -3, -9, 12, - 9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5 }, - { 6, -34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3, -26, -12, 8, -6, - -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1 }, - { 3, -30, 5, 6, -10, 3, -7, 6, 3, 3, -26, -19, -3, 1, 7, 5, - -4, -5, 6, 10, 13, -10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5 }, - { 4, -24, 9, -19, 2, -4, -5, 8, -3, 2, 0, -15, -1, 9, -4, 22, - 6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3 }, - { 8, -27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7, - 5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13 }, - { 17, -22, -15, -11, -8, 16, -14, 18, 2, -1, 14, -7, 14, -6, -6, -7, - -8, 17, 6, 4, 4, -7, -5, -9, -14, -6, -1, 9, -3, 1, 6, -5 }, - { 25, -30, 2, -12, -13, 18, -18, 16, 8, -3, 10, -8, -3, -1, -6, 3, - -5, -7, 4, 6, 7, 1, 1, -11, -5, 6, 2, -4, 9, -1, -5, -2 }, - { 7, -23, 7, -15, -1, -3, -1, 0, -10, 12, 2, 5, -4, 0, 4, 6, - -1, 5, -9, -1, -1, -7, 1, 17, 9, -17, -16, 8, 4, -14, 11, 14 }, - { 0, -31, 7, -13, 3, -11, -7, 6, 1, -11, 8, -7, 15, -3, 16, -11, - -1, -15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3 }, - { 13, -24, -2, -20, -10, 7, -3, -1, 15, 2, 6, -5, -7, -10, -20, 1, - -4, 14, 8, -2, 3, -13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4 }, - { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0, - -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7, -31, -50 }, - { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0, -20, -6, -3, 9, - -20, -22, -1, -1, 15, 9, -12, 10, -13, -20, 12, 3, 5, 6, -7, -26 }, - { 0, 4, -2, -14, -12, 6, -13, 11, -10, 3, 22, 6, 16, -2, -5, 1, - -3, -11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5, -27 }, - { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4, -15, 14, 1, 3, -10, 5, - 0, -2, 7, 3, -13, 6, 9, -6, 5, -14, -17, -1, 11, 14, -2, -26 }, - { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11, - 9, 19, -2, 14, -8, 7, -1, 3, -3, -3, -10, -2, 12, -2, -12, -29 }, - { -12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1, - 2, -2, -14, 0, -1, -5, 3, 8, -28, -26, 6, -6, 3, 8, -10, -27 }, - { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6, - -1, -4, -1, -5, 8, -1, 5, -5, -15, 11, -8, -5, 14, -6, -14, -29 }, - { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2, -10, 3, 4, - 3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28, -11, -31 }, - { 1, -4, -10, -9, -4, -3, -15, -6, 1, 5, -3, -6, 5, -6, -22, 27, - -13, 5, 3, -7, -4, 20, -7, -12, -1, -24, -4, -13, -8, -11, -15, -21 }, - { -6, -4, 19, -6, 2, 11, -6, 1, -3, -10, 9, -9, 12, -10, 2, 1, - -9, 1, 15, 7, -5, 5, -29, -35, 4, -30, 9, 9, 19, 17, 2, -17 }, - { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2, - -4, -1, 12, 0, 2, -8, -6, -4, 16, -1, -14, -2, 25, -6, -15, -36 }, - { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1, - -3, -13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1, -28 }, - { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2, - 16, -11, 11, 0, 1, 6, 1, 18, -10, -16, -1, -4, 5, -14, -15, -20 }, - { 1, -12, 5, 4, -7, 8, -1, -17, -2, -9, -14, -11, 6, -9, 5, -4, - 3, -2, 7, 18, -5, 5, 6, -1, -11, -2, -10, -3, 8, -3, -2, -32 }, - { -12, 5, 20, -5, -6, -11, -6, -6, -13, 4, -6, 19, -8, 2, 3, -9, - -4, -4, -1, 9, -1, 21, -1, 7, 15, -10, -1, -3, 9, -3, 2, -24 }, - { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8, - 0, -2, -6, 9, -4, 3, 2, -13, 1, -7, 23, -13, 4, -3, -15, -33 }, - { -7, 2, -15, 11, -10, 14, 0, -11, 3, -1, 12, -4, -4, 9, 11, -13, - -13, -3, -14, 1, 3, 6, -5, 8, 0, 5, 5, -10, 4, 5, -6, -30 }, - { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5, - -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3, -19, 37, 12, 10, -40 }, - { -7, 2, -7, -12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5, - 9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2, -24 }, - { -7, 6, 1, 3, 1, 0, 6, 0, 4, -12, -2, -2, 1, -9, 10, -2, - 11, -1, 21, -12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3, -29 }, - { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2, - 3, -5, 2, -1, 6, -4, 0, -3, 8, -11, 19, -8, 22, -34, 13, -35 }, - { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2, -12, -11, 18, - 9, -5, 1, -6, -9, 12, 1, -3, -3, -9, -14, 9, 9, 8, -6, -26 }, - { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4, - 1, 1, 18, 1, 7, -10, 3, -2, 12, -1, -15, 9, 12, -14, 13, -38 }, - { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1, - -7, -1, -4, 13, 7, 0, 1, 2, -1, -16, 0, -2, 1, 8, -8, -28 }, - { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28, -18, - -6, 2, 15, -10, -15, -10, -2, 0, -2, -2, 4, -3, 7, 11, 5, -30 }, - { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3, - -10, 4, 10, 5, 21, -4, 14, -18, 1, 3, -10, -2, 6, 14, -8, -26 }, - { -14, -1, 2, 3, -3, 7, 1, -22, -1, -1, 0, 1, 12, -14, 3, -5, - 0, 10, -3, 1, -5, 12, -3, 10, -8, -22, -11, -13, -7, -10, -13, -25 }, - { -2, -5, -4, -4, -9, -18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8, - 20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0, -17, -23 }, - { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6, - 8, 10, -1, 1, -5, 5, -14, -2, -11, 8, 6, 25, 7, -1, 0, -43 }, - { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2, -10, - -16, -9, 7, -12, 9, -8, 2, 5, -5, -10, -2, -11, -5, -1, -9, -30 }, - { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3, -17, 13, 9, - 0, 7, -6, -5, 9, 1, 5, 4, -10, -18, 0, 14, 11, -4, -16, -28 }, - { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1, - -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6, -70 }, - { 7, 3, -11, -1, 12, -4, -14, 4, 4, -4, 4, -2, 2, -12, -4, 15, - -17, -4, -3, 6, 8, -5, 22, -22, 5, -11, 15, -4, 4, -1, -21, -1 }, - { 10, -2, -13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10, - 8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8, -29, 13 }, - { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0, - 9, -2, 1, -2, 26, -19, 21, -10, 4, 1, -8, 5, 22, -10, -13, 15 }, - { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1, - -8, -5, -13, 13, -2, -3, -1, -9, -28, 4, 2, -11, 18, -20, -24, 9 }, - { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5, - 2, -13, -12, 2, 0, 5, 18, 15, -13, -7, 13, -20, 16, -10, -19, 6 }, - { 5, -8, -1, 5, 10, 2, -1, -10, -11, 23, 8, -5, -8, 4, -5, -4, - -5, -5, -11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17, -12, -22, 3 }, - { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7, - -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5, -24, 13, -20, -27, 14 }, - { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1, - -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24, -43, -13, 2 }, - { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1, - -7, 1, -1, 10, 0, 5, -1, -24, 25, -15, 7, 2, 22, -10, -21, 0 }, - { -5, 2, 6, -2, 13, 3, 5, -12, -11, 16, 6, 10, -5, 0, -3, 6, - 5, -5, -5, 10, 12, 10, 11, -7, 8, -14, 2, -15, 13, -14, -8, -3 }, - { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5, - -12, 3, -3, -6, 2, -1, -5, 14, 11, -20, -21, -25, 24, -1, -10, 6 }, - { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1, - -17, -18, -4, -13, 9, -1, 9, -7, -4, -8, 2, -3, 12, -31, -18, 5 }, - { -7, -11, 6, -8, 4, -3, -12, 0, -1, -6, -3, 0, 5, 9, 7, 2, - 1, -8, -6, 8, 2, -5, 7, -1, 16, -10, 16, -12, 18, -1, -25, -12 }, - { 3, -12, 1, 2, -2, -18, -8, -15, -10, -9, 2, -7, 11, -11, 2, -1, - -1, -1, -9, -6, 3, -14, -2, -1, 2, -13, -7, -9, 19, -5, -17, 2 }, - { 7, 1, -8, 7, 17, -13, -10, 5, 7, 1, -6, 4, 9, -4, 0, 3, - 8, 1, -14, -9, 4, 7, -9, 0, 6, -5, -12, -2, 25, -2, -19, 1 }, - { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5, -17, -4, 4, -1, - 0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2, -18, -2 }, - { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2, - -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0, -13, 4 }, - { 0, -13, -11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2, - 9, -2, -11, 15, 1, -21, 1, -1, 0, 4, -14, -4, 24, -16, -13, 1 }, - { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9, -12, 0, - -1, -14, -9, -14, 0, -2, 19, 4, 6, 4, 4, -11, 8, -17, -19, -5 }, - { -3, 1, 2, 12, -4, -18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12, - -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1, -25, 22, 2, -23, -5 }, - { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2, - 0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3, -25, 4 }, - { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3, -12, 12, 15, -9, -4, 2, - 9, -4, -12, 3, 14, 1, 7, -15, 15, 0, -6, -12, 0, -3, -20, 6 }, - { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1, -18, -4, -6, - -15, -5, 11, 5, -10, -1, 2, 7, 12, -19, -7, 8, 21, -4, -15, 4 }, - { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2, -14, -11, 6, - 2, 17, 8, -13, 26, -2, 5, -15, -4, -14, 12, -9, 13, -21, -23, -4 }, - { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1, - -17, -22, -3, 4, 3, -2, 1, -9, 1, -6, 11, -13, 14, 0, -15, 6 }, - { -16, -4, 17, -2, -20, -11, 11, 10, 5, -8, 16, 2, -17, -14, 11, 11, - -6, -11, -7, 12, 12, -10, -6, 5, 8, -4, -2, -5, 28, 3, -13, 4 }, - { 0, -3, 3, -7, 6, 8, -12, 20, -19, 18, -11, 10, -5, 0, -9, 11, - 3, 0, -2, 9, -7, -5, 18, 3, -2, -16, 1, 6, 12, -7, -16, 1 }, - { 4, 1, 5, -5, 15, 2, -8, 3, 5, -11, 15, -3, 8, -8, -1, 7, - 4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6, -18, 4, 0, -18, 11 }, - { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4, - -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4, -37, 19, 1, -15, -4 }, - { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4, - -10, 2, -6, 4, 4, 1, 27, -7, 17, -34, 5, -9, 15, -16, -7, -5 }, - { -2, 7, 7, -2, 9, -2, -15, 11, 11, 7, 5, 1, 15, 1, -9, 31, - 2, -15, 2, 4, 3, 4, -1, -8, 2, -7, 6, -17, 11, -14, -11, 2 }, - { 1, 1, -11, 9, 9, -6, -14, -11, -10, 8, -3, 11, 16, -9, -8, -13, - -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6, -17, 4 }, - { 14, 5, 4, -6, -12, 10, -7, 8, 21, -8, -30, 15, -2, 1, 11, -9, - -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1 }, - { -1, 2, 20, -17, -15, 3, 3, 7, 11, -17, -13, -6, -3, 18, 17, -15, - -4, -4, -5, 22, 14, -14, -2, -10, -7, 11, 8, -7, -3, 0, -7, 11 }, - { 7, -11, -7, -8, -14, 22, 5, 2, 6, 13, -12, -2, 10, 3, 0, -21, - -4, 20, 3, 10, 21, -10, -12, 8, 11, 2, -5, 2, 1, 3, -1, 15 }, - { -1, -2, -1, -2, -13, 8, -4, 0, 7, -2, -17, 8, 18, 5, 3, 8, - -8, -2, 3, -4, 14, -18, -13, 14, 15, -13, -1, -2, 4, 11, 1, 12 }, - { 13, -6, -4, -16, -17, 16, 21, -2, 5, -11, -9, 19, 21, -17, -3, -17, - 3, 12, 8, -12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4 }, - { 11, 5, 12, -20, -6, 10, 4, 12, 8, -5, -10, 15, 13, 14, 10, -15, - -13, 1, 6, 14, 15, -17, -13, 4, -5, 10, 7, -6, -8, -3, -4, 12 }, - { 25, -1, 7, -5, -7, 11, 1, 17, 13, -15, -14, -4, 5, 3, 8, -3, - -2, 2, 0, 6, 16, -12, -6, -4, 4, -3, 7, -10, -3, -7, -13, 7 }, - { -8, 10, -3, -13, 5, 2, 4, 9, 9, -17, -13, 2, 11, 1, 6, -4, - 8, -10, 4, 1, 19, -15, -4, 12, 31, 7, -5, -17, -4, 9, -2, 7 }, - { 14, -6, -6, -6, -14, 13, 17, -5, 4, -14, -9, 7, 7, -9, 3, -16, - -15, 11, 11, 6, 4, -11, -19, 3, 5, 8, 13, -14, -14, 3, -4, 12 }, - { -2, -4, 10, -4, -7, -1, 27, 5, 2, -16, -18, 4, 12, -2, -3, -2, - -1, 1, -8, -12, 3, -4, 8, 15, 2, 4, 9, -13, -14, 9, -7, 5 }, - { 4, 2, -10, -5, -7, 2, 1, 4, -1, -6, -15, 6, 1, 10, 5, -10, - -9, -1, 13, -3, 5, -21, -11, 8, 8, 5, 27, -21, -18, -5, -1, 15 }, - { 11, 1, -16, -8, -11, 0, 5, -8, -12, -13, -17, 22, 4, -6, -1, -18, - -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9, -17, -5, 4, 4, 10 }, - { 8, -6, -19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1, - 2, 4, 7, 9, 16, -16, -14, 9, -4, 3, 1, 0, -2, 10, -1, -1 }, - { 12, -8, 12, -9, 0, 25, 7, 9, 2, -31, -9, -4, 15, 4, -5, 1, - -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4, -10, -9, 6, 4, 5 }, - { 14, 6, -17, -2, 17, 12, -9, 2, 0, -25, -14, 5, 20, 14, 8, -20, - 5, 2, -2, -3, 9, -13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1 }, - { 8, 4, -15, -3, 10, 18, -4, 13, 8, -22, -10, 9, 19, -15, 7, -5, - -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11 }, - { 4, 1, 4, -5, -10, 18, 7, 2, -4, -9, -11, 0, 32, -7, 4, -16, - -1, 0, 6, 3, 6, -3, -14, 16, 9, -2, 7, -1, 0, -5, 5, -3 }, - { -3, 2, 3, -8, -6, 4, 6, 2, 4, -12, -15, 2, 8, 8, 9, -3, - -18, 6, 34, 11, 12, -15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3 }, - { 18, -6, -12, -8, -1, 15, 20, -4, -1, -11, -5, 6, 6, -11, -15, -7, - 3, 7, 10, 2, 8, -10, -5, 8, 15, -5, 5, -17, -13, 13, 11, 7 }, - { 8, -4, -6, -1, -14, -3, 6, -2, 1, -5, -1, 10, 10, -15, 5, 0, - -10, -4, -3, 7, -4, -19, -15, 27, 11, 18, 3, -19, -2, 6, 0, 12 }, - { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7, -11, 21, 29, 1, -2, 1, - -4, -11, -1, 13, 11, -20, -1, 4, 4, 4, -5, 6, -13, -2, 11, 9 }, - { 2, -7, -7, -3, -10, -1, 20, 12, 1, -19, -19, -1, 5, 4, -7, -25, - 14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1 }, - { 12, -8, 3, -12, -10, 10, 13, 0, 23, -14, -18, 10, 0, 15, 3, -12, - -3, -5, 5, -4, 2, -14, -10, 8, 2, 9, -1, -11, -3, 5, 13, 2 }, - { 9, -6, 7, -7, -30, 17, 6, 13, 1, -14, 0, -1, 6, -9, 8, 3, - -4, 0, -1, -7, -5, -13, -19, -3, -4, 4, -6, -2, -13, 1, -2, 3 }, - { 10, 1, 3, -18, -26, 17, 4, -16, 4, -3, -13, -4, -6, -11, -4, -21, - 7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2 }, - { -3, -1, 0, -2, -2, 0, -1, 3, 4, -14, -8, -9, 13, 2, 50, -23, - -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3 }, - { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5, - 5, 4, 4, -2, 10, -8, -40, -1, 21, 8, 3, -4, -1, 13, 4, 7 }, - { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12, -13, - -9, 0, 1, -12, 9, -43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2 }, - { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7, -23, -5, 23, -17, -6, -15, - -8, 7, 10, -1, 7, -16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4 }, - { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1, -45, - -6, -4, 4, 2, 1, -14, -10, 1, 1, 6, 2, -8, -1, -3, 3, 3 }, - { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6, - 5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0 }, - { -4, 1, -2, -1, -11, 11, 8, -3, -2, -10, 0, 4, 9, 9, -17, -17, - -34, -4, -5, -7, -3, -12, -3, 11, 18, 3, -2, -5, -18, -5, -3, 6 }, - { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3, -10, 12, -18, -5, - -10, 12, -9, 4, -6, 2, 0, 16, -17, 15, 14, -12, -10, -2, -9, -1 }, - { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4, -20, 1, - -25, 1, -8, 13, -10, 8, -19, -1, -8, 10, 6, -9, -1, 0, 12, 4 }, - { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4, - -25, 13, -23, 10, 14, 15, -11, 3, -18, 4, 16, -4, 1, -10, -10, 3 }, - { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1, -12, 14, -7, 11, -15, 6, - -6, 24, -4, 13, -1, 15, -13, 8, 3, 7, -5, 2, 2, 0, 3, -7 }, - { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2, -12, 4, 0, -2, -3, 5, - -6, 0, -8, 9, -10, 4, -28, 12, -20, 11, -13, 7, -18, 1, -11, 1 }, - { 1, -4, -15, 5, 0, -13, -5, 13, -11, 4, -4, -5, 5, -14, -16, 0, - -14, 5, -20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11 }, - { 13, -11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5, - -22, 5, -10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10 }, - { 18, -4, -13, 0, 1, -15, -1, -3, 2, 10, -1, 6, 1, -4, -20, -5, - -8, 6, -8, 17, -5, 5, -10, 8, -22, 6, -5, -2, 8, -17, 8, 2 }, - { 1, -2, -9, 6, -31, -8, -8, 8, 0, 5, -9, -4, 2, 3, -12, 11, - -18, 10, -5, 3, -11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11 }, - { -9, -6, 21, -8, -15, 4, -11, 12, -11, 17, -1, 2, -6, 0, -15, 13, - -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5, -10, -3, 0, 1 }, - { 4, -6, 5, -10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0, - -4, 3, -4, 1, -12, 6, -49, 16, -10, 13, 0, -2, 8, 6, 1, 8 }, - { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13, -14, 6, - -15, -6, -14, 16, 15, 1, -18, -4, -20, 20, -7, -1, -9, -2, -10, 10 }, - { -12, 4, 0, 10, 0, 3, 8, 4, -27, -1, -2, 19, -4, 2, -13, 3, - 1, 9, -12, 1, -22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7 }, - { 4, -5, 11, -6, 17, -17, 5, -4, -2, -6, 1, -5, 2, 4, -14, 6, - -20, 19, -20, 12, -21, 5, -14, 13, -2, 11, 4, -3, 0, -10, -4, -2 }, - { -2, -1, -3, 8, -9, -7, -22, -3, -24, 13, -2, 10, -15, 5, -9, 4, - -7, 0, -5, 15, -8, 11, -13, 6, -4, 19, -8, 12, -4, 6, 9, 7 }, - { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5, -12, 6, - -16, 14, -23, 10, -14, 17, -15, 16, -2, 9, -25, 9, -10, 16, 4, 9 }, - { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3, -11, 25, -10, -28, 27, - -9, 7, -13, 9, -2, 4, -12, -8, -14, 6, 7, -10, 3, 3, -3, 5 }, - { -8, -3, 1, -10, 8, -3, -9, -4, 13, 7, 2, 4, -10, 4, 3, 7, - -18, 2, -22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13 }, - { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0, - -2, -3, 1, 2, -1, 2, -8, -1, -24, 68, -3, 8, 3, 3, -1, -1 }, - { -15, -2, -9, -7, -1, 8, -14, 8, 3, 6, 0, -1, -8, 8, -23, 2, - -14, 17, -15, 8, -4, 7, -18, 0, -8, -3, -1, -4, -10, 4, -1, 4 }, - { 8, 0, 2, -7, 0, 5, 1, 3, -11, 4, -8, 14, 3, 20, 1, 26, - -11, 13, -13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10 }, - { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3, - -15, 7, -9, 22, -19, 8, -9, 4, -23, 13, -14, 6, -6, -14, -4, 7 }, - { 14, -5, -8, -10, 25, 3, -23, -7, -28, 0, -1, -9, 4, 1, -13, 20, - -8, 10, -16, 8, 12, -13, -21, 5, -13, 11, -2, 1, 12, -7, 2, -10 }, - { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2, -18, 7, - -15, 6, -3, 2, 8, 12, -30, 7, -4, 20, 2, 6, 13, -6, -4, 0 }, - { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16, -17, 14, -13, 15, -18, 14, - -15, 17, -12, 14, -13, 7, -16, 13, -9, 5, -11, 10, -9, 6, -12, 13 }, - { -10, -4, 5, 3, 1, 6, 8, -14, -5, 15, 7, 4, 8, 7, -22, 8, - -7, -8, -15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9 }, - { 8, -3, 2, 3, 3, 1, -2, -1, -11, 8, -4, 0, -6, -5, -1, 13, - -37, 9, 1, -6, -10, -2, -10, 11, 8, 13, -3, -2, -6, 8, -4, 13 }, - { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9, -20, 12, -19, 15, -18, 17, - -15, 7, -1, 20, -11, 6, -6, 3, 1, 9, 2, -14, -2, -2, 2, 1 }, - { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9, - -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1 }, - { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8, - -7, 4, 10, 11, -41, 27, -20, 3, -3, 8, 1, 11, -5, -8, 0, 4 }, - { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7, - -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2, -21, -12, -3, -1, 2 }, - { -4, 4, -2, -2, 6, -8, 2, 1, -10, 14, 8, 6, 5, 1, -2, 4, - -13, 4, 2, 5, 10, -2, -21, 32, -3, 18, 9, -6, -9, -9, 10, 2 }, - { 9, -16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19, - -24, -6, -6, -5, -8, -7, 8, -7, -1, -12, 5, -3, 0, 4, 2, -3 }, - { 10, 3, -16, -4, -1, 13, 4, 4, 1, -3, 1, -6, -14, 18, 3, 8, - -8, -28, -16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2 }, - { -5, -13, -22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1, - -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2 }, - { 5, -10, -18, 2, 20, 4, 13, -10, 8, -15, -11, -3, -1, 16, 10, 9, - -8, 6, 7, -5, 6, 11, 5, 17, -4, 7, -11, 5, -3, -6, 2, 1 }, - { 3, -5, -19, 1, 1, -3, -2, -25, -11, -17, 0, -13, -4, 10, 10, 2, - -5, 4, 0, 3, -3, -5, -10, -2, 13, -22, 0, 3, -11, -5, 7, -1 }, - { 12, -14, -29, 6, -1, 10, 7, -17, -12, 14, 3, 9, -9, 9, 7, 6, - -3, -13, 0, 5, 3, -1, -6, -1, 0, 2, 4, -12, -5, -1, 2, 11 }, - { 12, -15, -7, -2, -12, 17, 20, -16, -2, -12, -6, 15, -6, 12, 11, 9, - 7, -6, 7, -4, -19, 6, 2, 2, 3, -11, -10, -4, -5, -3, 3, 2 }, - { 11, -22, -6, 0, 8, 18, 3, -11, -4, -7, -15, -17, -12, 6, 16, 4, - -9, 4, -5, 3, 6, -16, 10, -7, -7, -3, 5, 0, 1, -15, -4, 5 }, - { 12, -22, -16, 5, -6, 8, 12, -4, -9, -17, -11, 3, 5, 8, -17, 0, - 11, -4, -13, -6, 2, -1, -1, 3, 3, -11, -12, -1, 1, 1, 12, -2 }, - { 8, -10, -33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6, -12, - -16, -8, 11, 8, -14, 7, 12, 11, 4, -14, -3, 6, -7, -5, -3, 3 }, - { 0, -8, -7, 2, -4, 24, 2, -9, -11, -3, -7, 11, -12, 17, 1, -1, - 3, -5, -7, 12, 4, 11, 0, 3, 2, -18, -3, 4, 7, -6, 3, 15 }, - { 10, -15, -16, -2, -4, -9, 7, -15, -6, 2, -16, 13, -8, 7, 19, -21, - -4, -12, -9, -3, -3, 6, 11, -3, -1, -19, 3, -7, -9, -4, 3, -6 }, - { -5, -10, -21, 0, -3, -7, 18, -21, 15, -5, -12, -4, -13, 2, 6, -9, - -9, -11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3 }, - { 15, -1, -27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9, - -11, -17, -2, 7, -9, 11, 10, 0, -8, 6, -16, -3, 2, -7, 3, 11 }, - { 4, -9, -39, 19, 6, -13, 13, -5, -5, -15, -2, 9, 0, 4, 14, 6, - -10, -4, -5, 2, -4, -2, 5, -11, 3, 3, -2, -2, -7, 9, 7, -10 }, - { 5, -11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1, - 18, -30, 4, 10, -4, -6, 2, -11, 9, -10, -8, 5, 0, 0, -7, 6 }, - { -1, -16, -10, 11, 0, 13, 12, -4, -4, -5, -21, 12, 4, 13, 14, -7, - 6, -16, -13, 8, 2, 9, 15, -12, 1, -9, -22, 10, -9, 9, 9, -7 }, - { 4, -12, -27, 1, -2, 11, 15, 3, 14, -14, -9, 0, -9, 16, 22, 10, - 16, -10, 5, -5, -9, 1, 1, 6, 6, -4, 2, -17, -5, -6, -15, -1 }, - { 7, -12, -17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17, - -7, -13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9 }, - { 7, -15, -15, -4, 10, 12, 3, -13, 6, 14, 9, -8, -15, 14, 23, -5, - -10, -5, 1, 15, -10, -7, 1, 9, 4, -13, -10, 10, 7, -3, 2, 3 }, - { 4, -10, -14, 0, 3, 4, 0, -9, -3, -4, -11, 2, -17, 8, 2, 15, - 6, -12, -12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10 }, - { -2, -18, -26, 10, -4, 10, 13, 4, -4, -16, -7, -17, -3, 5, -4, 2, - -15, -10, -1, -8, -7, -3, 2, 2, 8, -10, -7, 2, 2, -4, 4, -1 }, - { 4, -19, -5, -1, -1, -6, 2, -8, 10, -16, -28, -6, 8, -1, 11, 28, - 2, -10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1 }, - { -3, -6, -10, -5, 13, 18, 10, -15, -5, -3, -13, 5, 1, 2, 18, -5, - -10, -10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9, -17, 7, 7 }, - { 20, -12, -2, -4, 5, 14, 7, -11, -1, -16, -6, -4, -11, 17, 14, 0, - -8, -10, -8, 10, 3, 5, 10, -16, 3, -8, -14, 10, 3, 9, 0, 3 }, - { 12, -10, -36, 0, 7, 15, 2, -16, 2, -1, 0, -1, 5, 4, 5, -3, - 1, -10, 5, -1, -15, -3, -12, 12, 2, 5, -1, 5, 6, -3, -2, 2 }, - { 17, -15, -31, 23, -4, 15, -2, -3, 6, -7, -5, 1, -12, 4, 6, 8, - -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2 }, - { 6, -18, -5, 12, 10, 12, 14, -11, 15, 2, -9, -6, -5, -2, -9, 4, - -5, -28, -4, 14, 0, -16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4 }, - { -5, -14, -31, 8, 16, 7, 13, -13, 5, 6, -16, 10, -5, 2, -2, 2, - 14, -5, 8, -5, 7, -16, 6, -13, -5, 0, -5, 8, -3, -1, 4, 3 }, - { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28, - -12, -35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3 }, - { 2, -9, -22, 12, 3, 3, -7, -4, -19, -22, -14, -4, -1, 21, 9, -3, - -15, -16, -13, 1, -11, 4, -9, 1, -7, -1, -1, 0, -2, 9, -13, -3 }, - { -1, -3, -23, 0, 2, 12, 3, -9, -4, 7, 3, 9, -10, 1, 27, 28, - 0, 9, -15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6 }, - { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6, - -10, -12, 19, 1, -7, 9, -8, -9, -16, -11, -2, 12, 14, 4, 4, 34 }, - { 17, 7, -6, 1, 4, -10, -5, 4, -11, 3, -18, 4, 14, -13, -3, 1, - 0, 0, -11, 0, 7, -17, -4, 4, -11, -6, -8, 18, 0, 0, 0, 26 }, - { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3, - 7, 4, -12, -8, 0, -9, 8, -22, -5, 0, -6, 22, -2, 11, -13, 24 }, - { -3, 4, 0, 3, 9, 10, -1, 3, -9, -12, 1, -5, 18, 0, -3, 8, - 25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23 }, - { -5, 2, -9, -1, -3, 0, 3, -1, -10, -4, 0, -13, 16, 9, -1, -14, - 2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2, -14, 0, -9, 30 }, - { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7, -11, 14, 14, - 7, 34, -9, 0, -10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29 }, - { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1, -10, 1, - 6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7, -12, 0, -2, -10, 55 }, - { 5, 9, -1, 0, 4, 9, -21, -9, 4, 2, 6, -7, 11, -7, 1, -5, - 0, -4, 2, -3, -13, -8, 0, -9, -4, 2, 16, -2, -15, -7, -11, 31 }, - { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1, - 5, 2, 0, 0, 12, 20, -19, 1, 8, -12, -11, 0, 6, -5, 2, 31 }, - { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2, - -3, -12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30 }, - { -4, 0, -7, 17, 10, -12, -2, -10, -12, -3, 10, 0, 11, -4, -13, -3, - 5, 6, 10, 7, -8, 0, -7, -13, 1, 0, -2, 7, -12, 4, -3, 24 }, - { -13, 9, 4, -2, 2, -4, -14, -1, -3, -5, -10, 4, 13, -2, 5, 13, - 8, 3, -2, 1, 5, -6, 7, -18, -10, 1, -1, 5, 4, 1, 0, 25 }, - { -5, -1, 18, 12, 8, 8, -16, -1, 1, 1, 1, -4, -5, 3, 3, 4, - 4, -11, -12, -16, -6, 2, 12, -13, 0, 9, 7, 9, -9, 0, -10, 24 }, - { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1, - 1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69 }, - { 8, 5, 11, 0, -15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0, - 1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4, -11, -9, 41 }, - { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3, - -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3, -12, 16, 2, 27 }, - { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12, - -1, 10, -11, -11, -7, -4, -14, 7, -14, 13, 22, 18, -1, 0, 14, 28 }, - { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1, -15, 4, -9, - 22, -10, -9, -4, 1, 8, -4, 9, -15, 2, -6, -4, -16, 12, -10, 23 }, - { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1, - 13, -15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5, -11, -14, 23 }, - { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6, - 15, 3, -3, 18, -15, -2, -6, 3, 3, -20, 17, 11, -4, 2, 3, 29 }, - { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7, - -3, -2, -7, -2, -4, 5, 3, -5, -20, -13, -4, 10, -14, -29, 14, 37 }, - { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5, - -4, 4, -4, 4, 4, 3, 1, -4, -4, -9, -14, 20, -30, 3, -18, 33 }, - { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4, - 3, 2, -3, 0, -1, -1, -10, -7, 2, -4, -18, 2, -37, -1, 12, 40 }, - { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9, - 18, 0, 12, -17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26 }, - { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1, -15, 8, 7, -1, -17, -4, - 1, 5, 6, -11, -6, 14, 17, -5, -15, 11, 8, 0, -3, -15, -6, 28 }, - { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2, - 2, -1, -1, -7, 1, 2, -9, 0, -1, -4, -18, 7, -10, 49, -13, 32 }, - { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1, - 2, -5, 2, -7, 17, -2, 10, -5, 0, 2, -15, 3, -9, 7, -9, 30 }, - { -5, -1, 0, 2, 1, -1, 2, 5, -33, 3, -5, 14, 11, 7, 5, -3, - 2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27 }, - { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3, - 4, 2, 1, -7, -4, 1, -3, -4, -35, -25, 17, 10, -3, -26, -7, 32 }, - { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2, - -5, 2, 2, 4, 3, 5, -5, -16, -31, -12, -11, 2, -19, 20, -2, 21 }, - { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2, - 0, -3, 5, -11, -8, -3, -7, -7, 28, -11, -7, 0, -16, -11, -4, 29 }, - { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5, -12, 2, - -2, -5, -22, -2, -1, 11, 8, -7, -12, 0, -34, 6, -5, 11, -8, 19 }, - { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1, - 2, 8, 4, -5, -8, -2, 5, -18, 7, 12, 7, 19, -18, 2, -6, -13 }, - { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6, - -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10, -13, 0, -9, -19 }, - { 12, -10, 2, -2, -2, -1, -3, 6, -12, -5, -2, 14, -16, 4, 12, 12, - 17, 4, 7, -16, 7, -6, 11, 7, 7, 2, -25, 23, -24, 5, -7, -9 }, - { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0, - 1, 2, -4, 2, -3, -8, 0, -1, 9, 9, -10, -3, -29, 1, -1, -27 }, - { 2, 2, 0, 7, 9, -2, -10, -1, -1, 1, -9, -5, 8, 4, 1, 2, - -10, 1, 13, 12, -3, 15, -9, 2, -7, 1, -10, 23, -20, -18, -9, -15 }, - { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7, - -6, 3, -3, -9, 7, 9, -22, 1, 6, -4, 14, 27, -25, -14, 3, -5 }, - { 1, 3, 8, 4, 7, 6, 12, -17, -15, 1, -8, -10, 7, -14, -8, 6, - -2, -2, -11, -11, -7, 13, -2, -2, 4, 5, -5, 13, -23, -6, -17, -8 }, - { -5, 4, -14, -5, -4, -5, 6, 5, -8, -5, -2, -11, -7, -12, 3, -11, - 2, -6, 4, -10, -5, -7, 14, 5, 23, 11, 7, 12, -16, -6, -4, -16 }, - { 5, 6, 2, 5, -2, -5, -5, -6, -5, -19, -13, -1, -3, -13, 5, 0, - 6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17, -12, -27, 3, 0, -1 }, - { 7, -1, 9, -10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4, - 12, 5, 11, 14, -13, -1, 8, 1, 13, 9, 12, 12, -18, -14, -11, -16 }, - { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2, - 2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0, -36, -5, -9, -21 }, - { 14, -6, -9, 0, -1, -8, -8, -11, 2, 2, -9, -12, 12, -4, 5, 3, - -5, -9, 11, -1, -3, 12, -21, -3, 12, 5, 3, 11, -18, -15, 1, -2 }, - { -1, 3, -9, -3, 7, -7, -18, 2, 4, 12, -10, 2, 8, -3, -14, 13, - 17, -5, 5, -9, 13, -3, -7, -18, 17, -2, 5, 7, -20, -3, -6, -11 }, - { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3, -14, -6, -5, -8, 14, -6, - 7, -1, 5, 1, 15, -1, -7, -4, 6, -11, 9, -2, -37, 16, -7, -3 }, - { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12, -10, - 10, 13, 2, 7, -6, 2, -10, -10, 21, -5, 5, 5, -12, -23, 3, -14 }, - { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1, - 8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5, -20, -40, -4, -18, -14 }, - { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5, - 1, 2, -6, 4, -1, -2, -1, -15, 8, 3, 9, 46, -7, -18, 6, -11 }, - { 5, 5, 16, 21, 3, -11, -4, 11, -12, 2, 4, -12, -1, 11, 8, 1, - -4, 11, -11, -21, 1, 1, -11, 3, 13, 1, 5, 12, -25, 1, -3, -2 }, - { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9, -15, 3, -3, -14, 17, 4, - -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6, -29, -17, 8, 4 }, - { -7, -7, 4, 0, 13, 1, 0, 4, 4, -16, -10, -7, 5, 9, -15, -10, - -10, 8, -4, -1, -11, -1, -10, -15, 3, 3, 14, 10, -19, 2, -18, -12 }, - { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9, - 2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11, -24, -44, -9, -15 }, - { -1, -10, 6, 21, 11, 15, -7, 10, -14, -9, -8, -8, 4, 6, 19, 1, - -6, 1, -5, -17, -8, -10, 9, 5, 11, 18, -1, 10, -16, -7, -9, -8 }, - { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4, - -7, 7, 17, -20, 6, 4, 1, -6, -12, 31, 13, 19, -14, -10, -7, -2 }, - { -2, 6, -10, 3, 9, 6, -14, 15, 2, -5, 2, -11, 9, -8, 4, 6, - 20, -15, -3, -3, -1, 32, -21, 6, 1, 9, 11, 17, -19, 6, -1, -3 }, - { 8, 10, -2, 0, -8, -16, 7, 7, 6, 10, 4, -14, 7, -6, 21, -7, - 10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15, -20, -7, -11, 2 }, - { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5, -13, -1, 27, -9, - -6, -11, -7, 1, 11, -4, -4, -14, -2, 11, 6, 10, -19, -6, -15, 2 }, - { 0, 7, -1, 2, -7, -15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5, - -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7, -27, -4, -4, -12 }, - { 11, 1, -16, 6, -15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9, - 5, -3, 3, -2, -11, 3, 9, 6, 9, 3, -1, 12, -41, 8, -6, 9 }, - { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2, -13, 7, -1, -2, - -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1, -47, -21, 7, -6 }, - { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18, -13, 7, -13, -4, 8, 4, - 8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10, -25, -3, -12, -12 }, - { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3, - 2, -2, -17, -6, -4, 1, 33, -6, -20, -6, 8, 31, -26, -8, -1, -4 }, - { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15, - -10, -3, -15, -5, -3, -4, -6, -30, 17, -8, -2, 2, -20, 0, -8, -2 }, - { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4, - 1, 1, -3, 4, 4, -14, 3, 11, -5, 3, -3, 7, -3, 13, 23, -16 }, - { 2, -6, 1, -3, 5, 0, -6, -11, -7, -4, -1, 2, -7, -1, -1, 7, - 1, -2, 6, 12, -6, 8, -13, 17, 25, -23, -19, -7, -12, 9, 16, -17 }, - { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7, - 0, -5, 3, -19, -3, 5, 3, 9, -1, 9, -13, 13, -17, 4, 21, -26 }, - { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2, - -2, 0, 4, -6, 7, -2, 6, 5, -5, 2, -12, 1, -29, 29, 27, 12 }, - { 9, -10, -22, 6, -1, -1, 9, -14, -12, -2, 1, -1, 10, -11, -16, 0, - 3, 11, 13, -14, -9, -2, -1, 6, 4, -14, 0, -10, -2, 16, 17, -11 }, - { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4, - -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1, -47, -3, 50, -17 }, - { 8, -4, -11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2, - -14, 6, 6, 6, 0, 2, -1, 5, -20, 2, -1, 4, -5, 6, 21, -11 }, - { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7, - 4, 7, -12, -9, -2, 10, -6, 13, 6, 5, 20, 2, -15, 9, 28, -7 }, - { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2, - 6, 16, -14, 9, -14, -2, -8, -27, -3, 18, -1, -7, -3, 8, 23, -23 }, - { 1, 4, -9, -1, -5, 10, -2, 1, -11, 1, -9, 4, 7, 14, -9, -2, - -3, 2, -5, -1, -6, -10, -7, 11, 20, 2, 3, -19, 3, 15, 30, -9 }, - { 7, 2, -14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6, -11, - -14, 1, 10, -1, -7, -8, 1, 10, 3, -6, -15, -12, -17, 4, 30, -6 }, - { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4, - 4, -4, -2, -5, -2, 2, -1, -2, 0, -2, -11, -7, -3, 42, 24, -14 }, - { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4, - -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24, -13, -28, 20, 15, -22 }, - { -3, 7, 6, 3, -2, -5, -10, -2, -2, -1, -6, -6, -2, -14, -16, -6, - -5, 0, 18, 0, 9, 1, 7, -13, -5, -6, -9, 11, -15, 9, 22, -11 }, - { 9, -2, 6, 5, 2, 9, -10, 1, 1, 5, -4, 12, 2, 2, -10, -7, - -4, -6, 7, 9, 6, 15, 6, 6, -10, 10, 5, -13, -5, 6, 24, -12 }, - { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6, - -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22, -17 }, - { -2, -2, 3, 10, 9, 9, 12, -15, -1, -11, -13, 3, -2, 1, -3, -11, - 7, 9, 16, -3, -10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31, -12 }, - { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3, - -13, -6, 15, 20, -9, -3, -12, 1, -2, -16, 8, 8, -1, 16, 22, -5 }, - { 5, -3, -15, -2, 12, -8, 8, -5, 2, -8, 20, -18, 14, -4, 3, 3, - 7, -13, -16, 1, -10, 7, 16, 7, 4, -14, -4, -5, -9, 8, 23, -6 }, - { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6, -10, -2, 6, - 9, -17, -14, 11, 12, -3, -13, -7, 2, 18, 3, -25, -16, 18, 22, -5 }, - { 5, 6, -7, -20, -4, 2, 8, 4, -24, -4, 1, 4, -5, -2, 1, -10, - -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21, -11 }, - { 0, 7, -1, 14, -6, -4, -10, 5, 4, 4, 4, -5, 3, 4, -1, -7, - 8, -19, 0, 6, 2, 3, -18, -3, -6, 2, 8, 14, -26, 22, 27, -13 }, - { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14, - 6, -5, 6, -4, -7, 7, -21, 8, 1, 8, -9, -4, -3, 11, 25, -13 }, - { 4, 4, -1, -6, 4, 9, -8, 1, -3, -10, -2, 0, 15, -9, -16, 11, - 1, 1, 6, 3, -9, -5, 16, 26, 1, -14, 1, -3, -14, 7, 15, -9 }, - { -12, -2, -9, -13, 2, 6, 14, 0, 1, 0, -1, -13, 0, 10, -1, 6, - 9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7, -22, -2, 29, -7 }, - { 2, 4, 13, -12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10, - 15, -6, -1, -11, -30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25, -16 }, - { 7, -15, -7, -7, -1, -5, -5, -11, -20, 10, 3, -10, -3, 5, 20, -4, - 0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1, -12, -3, 15, 22, -16 }, - { 4, -1, 3, 4, -5, 0, -1, -5, -24, -29, 4, -9, 1, -3, 0, 0, - 0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5, -10, 3, 25, -10 }, - { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2, - 1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1, -11, 7, 46, -46 }, - { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4, -10, - 13, 1, 3, -6, 4, -4, 7, 2, -19, -25, -3, -16, -12, 16, 20, -1 }, - { 18, 6, 4, -12, 0, -14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2, - 7, 0, 2, 5, -11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8 }, - { 5, 0, -6, 5, 6, 3, 3, -10, -5, 1, -1, 4, 3, -11, -8, 5, - 4, -5, 5, -5, -7, -5, 11, 5, 20, -8, -16, 21, -4, 27, 23, -5 } + { 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 }, + { -4, -2, 2, 1,-16,-10, 1, 3, 1, 0, 6, 1, -3, 7, 1,-22, + 2, -4, -3, 11, 14, 6, -1, 1,-13, 29,-28, 10, 10, -8, 0, -9 }, + { -8, 8, -7, 10, -3,-12, -5, -8, 1, -2, 9, -2, -5,-18, 1, 9, + -8, -8, 3, 41, 7, -9, -9, 22,-42,-29, 14,-18,-14,-32, 1,-15 }, + {-16, 8, 15, 16,-16, 5, 2, 7, -6,-16, -7, 1, 1, -3, -2, 0, + 8, 20,-26,-11, 2,-17, 0, -3,-34,-37, 10, 44, -2, 22, 2, -4 }, + { 7, 14, 5, 6, 15, -1, 3, -3, -9,-23, -5,-14, 8, -1,-14, -6, + -5, -8, 54, 31, -6, 18, 2,-19, -2,-11,-30, -6,-19, 2, -2,-14 }, + { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1, + 3, 7, -5, -4, -3,-12, 3, -2, -3, 12,-53,-51, 6, -1, 6, 8 }, + { 0, -1, 5, 1, -6, -8, 7, 5,-18, -4, -1, 1, 0, -3, -3,-14, + -1, -6, 0,-14, -1, -1, 5, -3,-11, 1,-20, 10, 2, 19, -2, -2 }, + { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3, + -7, 0,-34, 4,-43, 17, 0,-53,-13, -7, 24, 14, 5,-18, 9,-20 }, + { 1, 0, -3, 2, 3, -5, -2, 7,-21, 5,-25, 23, 11,-28, 2, 1, + -11, 9, 13, -6,-12, 5, 7, 2, 4,-11, -6, -1, 8, 0, 1, -2 }, + { 2, -4, -6, -4, 0, -5,-29, 13, -6,-22, -3,-43, 12,-41, 5, 24, + 18, -9,-36, -6, 4, -7, -4, 13, 4,-15, -1, -5, 1, 2, -5, 4 }, + { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19,-22, 31,-27, 4,-15, + -6, 15, 9,-13, 1, -9, 10,-17, 4, -1, -1, 4, 2, 0, -3, -5 }, + { -7, 3, -8, 13, 19,-12, 8,-19, -3, -2,-24, 31, 14, 0, 7,-13, + -18, 0, 3, 6, 13, -2, 1,-12,-21, 9, -2, 30, 21,-14, 2,-14 }, + { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1,-10, 30, 4, + -10, 12, 5, 6,-13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2 }, + { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4,-16,-13, 3, 23,-27, + 18, 46,-38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3 }, + { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4,-11, 40, -7, + -3,-13,-14, -7,-10, 14, 7, 5,-14, 11, -5, 7, 21, -2, 9, -3 }, + { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2, + -1, 1, -3, -1,-15, -2,-63,-27,-21,-47,-14, 1,-14, 10, 0, 2 }, + { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7,-15, 6, + -7, -6, 3, 7,-15, -5, 23,-13, -6, 12, -8, 9, 2, -3, 3, 4 }, + { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4,-22,-15, + -46,-66, 10, 20, 2,-17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2 }, + { -1, 0, 0, 1, 0, -4, 0, 1,-10, -3, -8, 5, 7,-11, 2,-11, + 29,-25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2 }, + { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1, + -14, -7, 3,-30,-15,-14, 3, -4, -1, 3,-13, -1, -3, 1, 2, 3 }, + { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10, + -57, 3, 22,-50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2 }, + { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4, + 24,-35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0 }, + { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0, + 0, -1, -2, -1, -5, -2,-43, -3, 46,-52,-10, 7, -8, 11, -2, -1 }, + { 0, 0, -1, 0, -1, 2,-41, 33,-44,-48,-15,-26, -9, 6, 3, 3, + -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1 }, + { -4, 1, 6, 1, -6, -1, -2, 1,-14, -4, 0, -5, -2, 2, -2, 0, + -6, 1, 0, 8,-21, 32, -3,-36, -6, -2, -1, -7, 3, 0, 1, -6 }, + { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3, + 13, 0,-12, -1, 25,-20, -2,-23,-15, 7, -3,-11, -3, 6, -1, 0 }, + { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3, + -2, 3, 3, -7, -6, -5, 0, -4,-60,-16, -6, 38, 5, 6, -5, 0 }, + { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1, + 0, 0, -1, 0, -8, 2, -9, 10, 40, 31,-56,-21, 4, 20, -4, 7 }, + { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5, + 1, -2, 14, 5, 4, 5, 5, 5, -5, 9,-66, 0,-20, -2, -8, 4 }, + { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2, + 45, 31,-17,-16, -2, -2, -1,-22, 1, -1, -3, 3, 5, -3, 5, -1 }, + { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7,-11, -3, -8, 17, -4, + 34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7 }, + { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38, + 15, -1, 16,-11, 5, 8, 4,-10, 3,-10,-17, 5, 3, 3, 3, 1 }, + { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1, + 2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33 }, + { -5, 2, -3, -7, 2, -8, -4, 10, 17,-18, -7, 4, -4, -7, -6, -6, + -5, 5,-12, 2, 0, 6, 8, -2, 1, 4,-11, 2, 1, 8, 31, 19 }, + { 6, 9, 16, -6, -6, -1, -2, -3,-11, -2, 7, 7, 17, 3, 4, 10, + 2, 5,-13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6 }, + { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10, + -16, 12, 1, -6, 3, 8, -1, 10,-13, -6,-12,-23, 12, -3, 30, 14 }, + { -2,-15, 0, 8, 3,-19, 5, -3, 2, 3, 13, 7, 14, -3,-10, 0, + 8, 5, -6,-16, -8, -8, 14, 2, -1, 1, -9,-11, 11, -5, 27, 9 }, + { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4,-15, 1, 9, 0, + 8, 4, 1,-17, 11, -2,-19, -1, -6, -8, 3,-12, 3,-17, 33,-10 }, + { -3, -1, 2, 7, 7, -2, 9, 8,-18, -1,-13,-10, -3, -3, 11, 8, + -2,-12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10 }, + { -3,-10, 8, -1, -5,-11, 7, -5, 3, 6, 1, 4,-16, 10, 5, -4, + -2,-10, -1, 13, 6, -5, -7, 12, 7, -3,-17, 1, 12, -4, 29, 8 }, + { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2, + -2, -8, -6,-11, 14,-13, 27, 3, -2,-12, 5,-16, 2,-26, 20, 15 }, + { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1, + 0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8,-25, -8, -4, 34, 23 }, + { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1, + 0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68,-16 }, + { 10, 0, -8, 14, -6, 1,-12, 0, 0, -3, -5,-11, -6, 12, 9,-10, + -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4 }, + {-12, 13, -5, 7,-11, -2, -1, 1, -4,-14,-21, 3, -3, -3, -4, -7, + -9, -4, 3,-17, -2,-13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10 }, + {-10, 6, 5, 6, 4, -7, 10, 0,-28, -3, 0,-11, -1, -5, 16,-10, + -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5,-10, 7, -9, 20, 4 }, + { 1, -7, -2, -7, 4, -3, -2, -7, -1,-14, 6,-16, 4, -5, -4, -6, + -5, 0, -2, 2, -6, 9, -5, 4,-18, 8,-10, 8, 15, 0, 32, 1 }, + { -5, 7, -3, 7, 15, -4, 0,-16, 9, 5, -5, 5, 4, -3,-12, -9, + -18, 10, 2, 2, -3, 7, 3, -1, 6, -9,-10, 3, 15, -4, 35, -7 }, + { -1,-10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1,-14,-11, 3, + -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14 }, + { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1, + -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4,-12, 21,-39, 24, -2 }, + { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2,-11, -8, -1, 4, 2, 2, + -4,-10, 12, -5,-11, 1,-15,-34,-11, -7,-11, -1, 7,-14, 38, -1 }, + { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11,-15, 20, -1, + -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11,-12, 27, -4 }, + { 0, 8, -4, 3,-11, 6,-11, 2, 3, 0, 5, -8, -7, -6, -9,-21, + 4,-11, -1,-16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3 }, + { 1, 3, 4, 11,-11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4, + 0, 4, -8, 13, -6,-13, -1, -5, -1, 4, 0, 0, 9,-22, 24, 18 }, + { -7, 3, 10,-13, -6, 6, -6, 6, 22, 1, 0,-14, 2, 3, 7, -1, + 8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4 }, + { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2, + 5, 2,-11, 4, 0, -1, 12, 0, -3,-13, 15, 8, -6,-27, 34, 0 }, + { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1, + 3, -6, -7, -6, -5, 4,-19, -6, -8,-34, -4, -8, 10, -7, 23, 10 }, + { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7, + -6, 1,-12,-12, -1,-16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15 }, + { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1,-11, 6, -5, 0, 2, -6, + -3, -6, 4, -1, 5, -5,-12, -6, 7, -5, 9, 3, 6, -7, 29, 1 }, + { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5, + -1, 0, 4, 2, 11, 6, 2, -3, 13, -9,-19, 18,-15,-10, 36, 21 }, + { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0, + -2, 0, -2, 6,-19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28,-10 }, + { -5, 1, -3, -7,-12, -4, 1, 1, -1, 13,-10, -1, -9, -5,-13, 6, + 13, 3, -4, 2, 3, 11, 2, 6,-25,-16, -6, 0, 14, -1, 27, 16 }, + { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8,-12, -6, 5, + -6, 5, 3, -9, 1, 4, -7,-10, -9, -7,-17, -5,-15,-23, 25, 3 }, + { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1, + -7, -4, -5,-16, 3, -6, 18,-13, -9, 16,-15, 8, 15,-10, 24, 5 }, + { 1,-38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7, + -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1 }, + { 1,-22, 15, 18, -2, 10,-16, -9, -8,-11, 8, 4, 0, 7,-14, -5, + -1, -7, 12, 17, 9, 5, -7, -4,-12, -6, 7, 0, 7, 2, -2, 1 }, + {-11,-29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7,-14, 8, + -3,-11,-13, 0, -7,-23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5 }, + {-24,-27,-11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3, + 4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3 }, + { -9,-24, 11, 13,-10,-12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9, + -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9 }, + { -8,-15, 7, 14, -4, -5, 2,-18,-19, -2, 2, 17, 16, 6,-10, 10, + -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5,-12, 3, 2 }, + {-10,-37, 13, 1, 3,-14, 0,-20, 4, -3, 8, 2, -2, -3, -9, -5, + -3,-17, -1, 13,-11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4 }, + { -2,-22, -5, 46, -8, 5, 9,-11, 8, 7, 7, -1, -1, -2, -7, 2, + -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6 }, + {-16,-27, 15, 16, -4, 14, -7,-26, 2, -2, 6, 5, -3, 11, 0, 2, + 3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0 }, + { -3,-22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1,-21, -4, 5, + 3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7 }, + { -9,-25, 3, 18, 9, -6,-11, 0, -5,-12, 9, -8, -7, -6, -6, 22, + 2, -6, -3, 15, 3, 2, -2, 9, 14,-10, -7, 15, 13, 6, -2, 11 }, + { 5,-20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2, + 6, 10, 9, -9,-18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1 }, + { -8,-30, 7, 12, 10, 8, 7,-13,-16, 0, 1, -1, -6,-11,-15, 4, + 1, -2, 10,-15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7,-18 }, + {-10,-32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5,-15, + -11, 6, 20, 4, 0,-12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1 }, + { 1,-25,-14, 12,-11, 9, 9,-16,-24,-17, 22, -9, 11,-30, -3, -4, + 6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8 }, + {-14,-26, -6, 9, 8, 17,-11,-24, -7, -4, -8, -2, 10, 2, 2, -1, + 2, 13, 12, -7, 4, -6,-10, 6, 6,-13,-11, -7,-16, 0, -2, 5 }, + { -4,-30,-13, 12, 16, -6, 12,-16,-13, 5, 15, -2, -2,-10, -7, 7, + 11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4 }, + { -4,-21, 20, 22, 2, 20, -8, 1,-12, -5, -9, 4,-10,-17, -3, -8, + -3, 3,-12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5 }, + {-12,-20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17,-13, -2,-10, + -17, -1,-18, 2, 0, 14, -6, 1, 0, 3, 2,-10, 1, -5, -2, 5 }, + { 16,-37, -1, 26, -2,-14, 1, -5,-14, 2, 2, 3, 6, 1, 1, 4, + 0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0 }, + { -9,-24,-12, 5, 5, 3,-17,-14, 4, 3, 2, -4, 10,-22, -8, -3, + 6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5 }, + {-14,-33, -2, 20,-13,-10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8, + 0, -2, 10, 7, -2,-13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7 }, + {-10,-23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15,-14, + 13, 14, 2, 5,-13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5 }, + {-13,-25,-10, 13,-17,-24, -7,-13, -6,-10, -8, 2, 0,-13,-10, -4, + -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2 }, + {-12,-23, 1, 18,-11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2, + -2, 11,-13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1 }, + { -5,-18, 16, 22, 2, 0, 8, -6, -9, -7, 10,-16, 23, 10,-11, -1, + 7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4 }, + { -3,-26, 14, 11, 2, -9, 17, -2, -1, -5,-16, -9, -5, 10,-13, 1, + 6, 12, 10, 11, 0, 0, -3,-14, 6, -2, 0, 4, -5, -1, -7, -1 }, + {-10,-33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2,-10, -5, + -6, 12,-11, 5,-10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16,-17 }, + {-14,-37, 7, 7, -2, 5, -8,-11, 2,-13, 4,-19, 1, 8, 8, 4, + -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2 }, + { -6,-30, 18, 17, 1,-22, -3, 4, -7,-10, 7, 0, -8, 8, -1, 4, + 2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5 }, + {-17,-18, -3, 22, -8, 1, 9, -2,-17, 20, -5, -5,-12, -5, 4, -5, + -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3 }, + { -9,-23, 3, 10, 4, 4, -3, -2, -2, -2, 1,-22, 11, 0, -2, 5, + -2, 14, -9,-11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6 }, + { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1, + -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5,-69,-19 }, + { -3, -5, -8,-12, 4, -3,-19,-11, -5, 0,-14, 7, 18, -6, 7, 22, + 8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3,-26,-11 }, + { -1, -6, 4, -4, -5,-16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3, + -4,-33, -4, 4, -7, 0, 1, 6,-11, -2,-13, -2,-18, 20,-25,-16 }, + { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11,-10, 4,-10, 7, 16, 2, + 16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0,-33, -2 }, + { -3,-15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4, + 12, 13,-13,-14, 10, -6, 9, 22,-27, 23, -1, 5,-24, 2,-30, 5 }, + { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1, + 1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4,-37, 9 }, + { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7,-10,-10, -1, -4, 11, -3, + 7, -6, 4,-12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3,-40, 13 }, + { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1, + 0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1,-32, -7 }, + {-16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15,-13,-11, 11, 9, 4, + 3, -8,-10, 12, 12, 0, 0,-16, -9, 13, 2, 9, 4,-13,-33, 3 }, + { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2,-11, -1,-15,-11, -1, 1, + 11, -3, -2, 24, -4, -6,-25,-10,-15, -8, 0, 0, -5, 4,-30, 2 }, + { 10, -3, -6, 1, -9, -5, 6, 9,-10, -3, 8, -1, 4, -1, 11,-11, + 3, 9, 11, -3, 6,-17, 5, -8,-33, 9,-13, 19, -2, 9,-25, 2 }, + { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2, + 0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0,-15, 12,-63, 27 }, + { -2, 14, 9, -1, 3, 0, 1, 1,-19, 15, 3, 4, 0,-10, 1, -5, + 3, 0, -5,-10, 2,-16, -4, 8,-12, -6, 7, -5,-10, -1,-33, -4 }, + { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1,-12, 3, 8, + -10, 6, -1, 1, 13, -5, -5, 2, -4, 13,-18,-10, -7, -9,-33, 10 }, + { -6, -3,-12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2, + 1, 8,-10, 7, -1, -3, 3, 0, 13, 1, 6, 7,-16, -7,-39, 8 }, + { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2, + -3, 13,-11, 1, 7, 5, 19, -5, -3,-15, -1, 7, -1, 6,-33, 8 }, + { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6, + -2, 1, 7, 0, 1, 1, -5, 2, -2, 0,-13, -2,-31,-14,-39,-12 }, + {-10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7, + 18, -8, -2,-19, -7, -7,-12,-14,-11, -1, -9,-13, -7,-12,-31, -9 }, + { -3,-16, 10, 9, 1,-10,-12, 2, -2, 2, 7, -3, -3, 1, -4, -5, + -9, 5, 7, 3, -1, 4,-11, -8, 4, 13,-10, 13, 10, -4,-36, 1 }, + { -7,-12, 4,-20, -7, -7, 2, 11, -1, -2, 3,-12, 1, 0, -6, -7, + 6, 4, 13, 3, -3, 4, 3, -6,-12, 5, -5,-22,-13, -8,-37, -6 }, + { -7, 5, 3, 5, 7, 9,-14, -3, 10, 17, -1, 1,-12, 5, -6, 0, + -4, -9, 0,-11,-14, 3, 13, 6,-25, -8,-12, 4,-10, 18,-30, -1 }, + {-10, 6,-10, 6, 6, 1,-10, 0, -7, 5, -2, 17,-18, -4, 0, -3, + -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0,-32,-11 }, + { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4, + -6, 0, 2, -3, -1, 5, 10, 0, 12,-10,-18, -3, -1, 14,-33, 2 }, + { 4, -8,-18, -4, -5,-11, 4,-10, -4, 9, 13,-12, 1, -6, 1, 2, + 4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0,-30, 1 }, + { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3, + -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2,-33, -8 }, + { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8, + 7,-11, -4, 6,-10, 7, -1, -1, -2, -1, 16, 32, -7, 20,-33, -6 }, + {-18, 2, 6, 13, 9, 9, -1, 3,-17, 24, -2, -6, 28, 8, -2, 6, + 3,-10,-34,-16,-13, -4,-15,-11,-12, -3,-10, 4, -8, 4,-31, -4 }, + {-11, 0, 18, 2,-16, -9,-13, -2, -2,-12, -3,-22, 30, 0, 8, 3, + 9, -4,-16, 1, 0,-11, 15, -2, -4, 6, -5, 6, 1, 2,-25,-12 }, + { 14, -1, 5, 7, 3,-15, -8, 1, 5, -2, 12, 13, 11,-25, 3, 1, + 0, -2, -4,-16,-23, 0, -5,-17, 7, 5, -9, 6, -5, 2,-32, -7 }, + { 3, -1, 6, 14, 2,-12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2, + 4, 5, -2, 8, 8, -6, 0, 10,-20, -1, 3, -1, 8, 23,-33, -5 }, + { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1, + 8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1,-12, 0,-34, 18 }, + {-17, 13, 0, 1, 9, -4,-11, 0, 7, 0,-10, -4, -1, 6, -6, 4, + 1, 6, -9, 3, -5, -6,-11, 2, -4, 14, 23, -3, 2, 5,-30, 12 }, + {-14, 5,-27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5, + 8,-10, 48,-11, 12, 33, 6, 8,-15, 20, -2, -5, 32, 5,-19, 10 }, + {-16, -4,-12, -7, -2, 0, 8, -6,-20,-18, 16, -3, 0, 31, -2, 11, + 2, -9, 49,-19,-12,-23, 10, 26, 16, -2, 4,-21,-14, 13,-11, -9 }, + { -5, -9, -1, 3, -5,-21, 2, 10, 0, 0, 10,-21, -7, 7,-26, -9, + 22, 32, 58, 11, -3, 11, -5, -8,-13, 6, -5, -9, 1, 10, 14, -8 }, + { 7, 7, 10, 3, -2, -1,-11,-11, -6,-43, -3, 14,-19,-18, 19, 18, + -32, 10, 45, -6, 6, 21,-20,-12, 2, 4, 6, 6, -4, 3, 3, 1 }, + { 21, 22, -3, -2,-11, -6, -1, -2, 8, 8, 32,-21, 7, 28, -4, -6, + -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4,-17, 27, 6 }, + { 13, 7, 2, -6,-12, 2,-10, -5,-17, 11, 4, 17,-12, -2, 5,-17, + 37,-16, 48,-14,-18, 29, 8, 24, 11, -5, -9, 11, -1, 1,-13, -3 }, + { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6, + 2, 10, 54,-25, 7, 54, -5, -6, -1,-15, 9, 13,-24,-15,-12, 3 }, + { 21, 5, 8, 3, -3, -4, -2, -4, 3,-11, -5, -8, 9, 16, 8, -9, + -10, -3, 46,-46, 2, 1,-10, 10, 17, 11,-20,-36, 10, 14, 0, -5 }, + { 7,-13, -6, -9,-24, 45, 2, 8, 8, 0, 17, 20, 12,-24, 1, -7, + -15, -3, 46,-13, -2, 20, 1,-13,-11,-13, 2, 15, 1, 10, -1, 3 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1, + -16, -9, 31,-69,-34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, + -5,-20, 18,-82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1, + 15, -5, 62,-36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0 }, + { 3,-19, 19,-20, 13, -4,-11, 8, 8,-16, 10, 1,-14, 30, 1,-33, + 10,-11, 45,-30, 3, -4, -3,-13, 7, 12, 3,-22, 3, -2, -4, -2 }, + { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, + 11, 8, 70, 48,-10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, + 2, -1, 80, 2,-15,-36,-10, -5, -2, 8, -2, 2, 0, 0, 0, 0 }, + { 10, 8, -8, -8,-24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12,-10, + -2,-13, 35,-43, 44, 15,-10,-25, 4, 10, -3, -5, -5, 7, -1, 3 }, + { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1, + -18, 9, 49,-72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1 }, + { -1, 4, -3, 10, 19, 4, 3, 20, 6,-24, 6, 9, 8, 15, 18, 18, + -36, 19, 57,-11, 4, -3, 8, 7, 2, -3, -2, -9,-15, -2, 12, -4 }, + { 20, 3, 11, -9, -4, 22, 42,-25, 1, 5,-10,-19, 0, 9,-16, 5, + 2, 10, 44,-29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1 }, + { -7, 16,-11, 12, 6, 33,-15, 14,-23, 2,-26, 8, 2, 10, 0, -5, + 8, -8, 38,-38, -4, 5, 5, 5, 1, 22,-15, 7, 6, 0, 4, 28 }, + { -1,-12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18, + 4, 1, 27,-39, 31, 17, 2, 2, 22,-23, 13, 16, 1, -7, -4, -5 }, + { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0,-14, 0, + -7,-11, 49,-22, -4, 19, 17,-39, 4,-29, 10, 2, 36, -4, 23, -1 }, + { -2, -2, -2, -2, 1, 15, -5, -7,-16, -8,-19, 16, -3,-20, 36, -9, + -3, 20, 39,-20, 0, 2, 27,-16, 10, 10,-14,-22,-16, -3, 13, -8 }, + { 5, -9, 6,-25, 7, 37, 13,-10, -5, 3, -5, 7, 18,-22, -7, 9, + -5, -4, 50,-11, -4, -5, -5, 8, -4, -2, -4,-27, 14, 20, 7, -9 }, + { 0,-14,-10,-27,-14,-17, -6, 26, 10, 2, 14,-12, -5, 0, 8, 9, + 0,-28, 55, -7,-12, -7, 4,-10, 10, 7,-12, 11, 3, 5, 9, -8 }, + { 2, 23, 4, -2, -1,-20, -2, 14, 10, -9, -9,-24, 10, 0, 11,-12, + 12, 11, 49,-25, -2, 29, 7,-13, 21,-10, 11,-17, 3, 1, -8, 5 }, + { 3, 0,-14, -6, 18, -2, 17, -9,-19, 9, -5, 9, 14, 6, 19, -3, + 27, 1, 41,-21, 20,-15, 33, 0, 26, 14, 7, 10, 3, 20, -3,-12 }, + { -1, 16, 15, -8, 3, -8, -8, 21, -5,-16,-29, 4, 1, -6, -4,-28, + 2, 31, 37,-26, -2, 13, 24, 8, -9, -6,-29, 10, 7, 2, 7, 8 }, + {-10,-10, 11, 13,-32, 2, 16, 9, 14, 23,-15,-13, 24, 13, 4,-27, + 14, 12, 31,-18, 17, 23, -2, -7,-14, 9,-17, -6,-10, 20, 9, 6 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, + 5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, + 4, -7, 64,-50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0 }, + { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1, + 6, -2, 50,-35, -7, 43, 7, -7, -5,-26, 24, 21, 3,-15, 5, 6 }, + { -8, 21,-19, 33, -8, 22,-11, 17, 3, 0, 0, -2, 1, -3, 6, -1, + 10, -8, 4,-11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4 }, + { -7, 5,-20, 9,-22, 3,-14, 1, 6, 13, 23, -2, -4, -7, 2, 0, + 11, 4, 6, 3, -7,-11, -7, 4, 5, 5,-12, 8, 2, 4, 7, -3 }, + { -7, 6, -4, 20,-20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3, + -9, -4, 1, 2, 5, 2, 1, -9, -2,-17, -4, 6,-10, 7, -7, -6 }, + { -9, 18,-17, 12,-24, 1, -1, 4, 14, 9, 4, 3, 2, 8,-12,-14, + 4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8 }, + {-25, 2,-11, 6, -5, 24,-28, -5, 8, 12, -2, 6, 8, -3, 8, -9, + -1, -5, -1, -5, 6, -1, -1, -1, -4, 8,-12, -2,-13, 7, 2, 1 }, + {-14, 14,-18, 20,-10, 12, -2, 9, 1, 0, 12, -2, 15,-10, 26,-17, + 16,-11, 10,-10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1 }, + {-18, 12,-18, 21, -6, 12, -6, 13,-25, 18, 1, 11, -9, -5, 0, 10, + -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8 }, + { -4, 16, 1, 18,-30, 9, 1, 6, -8, 13, 13,-12, -6, -1, 13, 7, + 6, 2,-15, -3, 5, 5, 1, -6, 1, -5, 0, 2,-16, 0, 3, -4 }, + {-21, 1, -2, 6,-43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3, + 0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2 }, + {-23, 10, 4, 7,-32,-11,-18, 2, -2, -7, -6, -3, -3,-12, 19, 3, + -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8,-15,-11, 2, 10 }, + { -8, 2,-13, 2,-29, 24,-20, 19, 1, 10, -4, 10, 1, 2, -9, 11, + -1, -2, 9, -5, 19, -7, 16, -9, -2,-18, 11, 1, 1, 0, 7, -3 }, + { -6, 3, 4, 13,-26, 10,-10, 28, -7, 28, 1, 7, 0,-14, 5, 7, + 4, -4, 3, -2, 3, 3,-11, 7, 6, 4, 0, -1, 2, -1, -3, 2 }, + { -6, 16,-31, 13,-10, 17, -6, 4,-14, 4, 4, -1,-10, 12, -5, 1, + -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7,-20, 7, 4, 11, -5 }, + {-19, 3,-17, 14,-12, 16,-22, 18, 14, 8, -2, 4, 10, 12,-14, 4, + -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1 }, + { -9, -7,-11, 24,-36, -9,-11, 5, 7,-12,-13, 18, -2, 20, 1, -4, + -1,-10, 15, -6, 14, 1, 0, 2, 1, 2, -9,-16,-11, 7, 13, 0 }, + {-24, 24,-18, 18,-22, 14,-11, 13,-12, 11,-10, 11, -7, 11, -5, -4, + -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6 }, + { -6, 18,-22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15, + -6,-18, 0,-33, -9,-12, -1, 6, 5, 2, 5, 5, -5,-17, -3, -3 }, + { 1, 11,-16, 9,-18, 11, -4, 18, 20, 26,-10, 8, 1,-11, 8, -4, + 0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1 }, + {-10, 6, -1, 18,-17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7, + -12, -1, -7, -6, -1, 8, 3,-15, 8, 9, 3, -7, 4, -1, 1, -1 }, + {-14, 6,-16, 22, 2, 5, 0, 5,-18, 11, 6, -3, 22,-20, -9, -3, + 6, -6, -7,-15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2 }, + {-21, 5,-19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3,-22,-13, -6, + -1, -3, -2,-14, 6, -3, 1, -8, -7, -5, -6, 11, -3,-10, -5, 2 }, + { -1, 9,-12, 15, -6, 6,-19, 14, -9, 11, 3, 12,-17, -3, 8, -4, + -3, -4, 1, -5, 4, 5, -7,-15, -7, 15, -6, -5, 1, -5, -3, 1 }, + {-12, 20,-15, 20,-14, 3,-14, 9, -6, 33,-13, 6, -2, 8, -6, 7, + -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2 }, + { -7, 12,-18, 12,-18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3, + 6,-12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4 }, + {-18, 12,-10, 11,-22, 0,-15, 5, -2, 2, -3, 6, -4, -4, -3,-15, + -2, -3, 21, 6,-12,-11, 19, 3, 3,-14, 7, 0,-11,-22,-10, 0 }, + {-15, 2,-30, 15,-17, 13,-16, 8, -7, 10, -8, 2, 11, 3, 10, -7, + 7,-22, 12,-10, 3,-12, 6,-10, 12,-10, 7, -8, 5, 2, 9, 1 }, + { -9, 11,-14, 6,-10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1, + -1, 4, 2,-20,-18, -1,-14, 3, -1, 4, -7, 10, 1, 11, 4, -4 }, + {-22, 8,-30, 13,-21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4,-13, + -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0 }, + { -6, -4,-35, 16,-13, 15,-11, 14, -7, 9, -1, 11, 7, 0, 13, 10, + -1, 8, 1, 1, -2, 8, -1, 2, 2, 3,-10, -1, 7,-13, -3, -7 }, + {-15, 7,-16, 14,-18, 17, -6, 14, 3, 4, 7, -3, 10,-22, 5,-15, + 4, -4,-11, 15,-15, 11,-11, 20, 1, 0, 2, 1, 11, -3, 11, -7 }, + {-12, 3, 5, 16,-37, -1, 15, 15,-15, 10, 3,-10, 1, 15, 7,-15, + -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5 }, + {-16, 26, -4, 14,-22, 26, 6, -3, -8, 4, 21, 6, 16, -4,-11, 7, + -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1 }, + { -7,-10, 4, 3, 2, -4,-12,-10, -4, -5, 16, 19,-16, 1, 2, -9, + -10, 0, 9, 7, -8, 3, 12, 8, -6,-11,-13, -1, -3,-20, 6, -5 }, + {-14,-17, 3, -5, 14,-12,-12, 8, -6,-25, 21, 21, 10, -8,-12, 4, + 10, -4, 3, -9, 11, 9, 0, 4, 2,-15, 1,-14, 4, 1, 0, -4 }, + { -4, -9, -3, -1, 6, 3, -6, 6,-10, -4, 14, 8, 2, -3,-12,-19, + 0, 11,-20, 1, 6, -2,-27, -6, 10,-17,-14,-17, -9, 8, -8, 3 }, + {-12,-13, 16, -4, -2, 12, -7,-11, 2,-13, 3, 7,-16,-18, -1,-12, + -2, 1,-12, -9, -2, -6, 2, 9,-22, -3, -4,-14, -7, 7, -1, 2 }, + { -7, -8, -8, 15, 15, 18, 15, 16, -4,-37, 11, 15,-12, -1, -3, 3, + 6, 6, 0, -5, -3, -5, 9, 1, 1,-11, -1, -8, -6, 2, 3, 0 }, + { -6, 7, -5,-12, 13, 10,-18, -4, -3,-21, 6, 16,-15, -7,-12, -9, + 1,-12, -1, 10, -2, -1, -3, 4, -4, 1,-16, -1, 12, -9, 5, 9 }, + {-14, -5, 9, 3, 4, 26,-28, 3, -6,-24, 4, 5, 3, 13, 5, -1, + 3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0 }, + { -4, 2,-10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7, + 5, 14, 9, -1, 0,-12, 4, -4,-10, 1, -3, 3, -2, -2, -6, -1 }, + {-10, 8,-15,-10, 19, 17, -8, 0, -3, -7, 7, 5,-13, -1, 7, -7, + 1, 13,-12,-13, 17,-12, 1, 26,-18, -3, -5, -6, 4, 5, 8, 1 }, + { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5, + 4, -1,-11, -8, -4, 0,-13, 2,-47,-23, -8,-11, -4, 4, -2, -3 }, + {-18, -4, 4, 5, -1, 17,-12, -8, 1,-12, 7, 20,-12, 3, -2,-11, + 16, 12, -6, 1,-13,-16, -6, -3, -3, -5, 4,-12, -5, -9, 10, 1 }, + {-11, 0, 4, 7, 7, 8, 3, -1, 3,-19, 32, 8,-19, -8, 2, 4, + -12, 15,-16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8 }, + { 3, -1, 4, -2, 14, 32, -9,-23,-10,-12, 22, 15, -1, -2, 10, 0, + 4, 6, -8, 4,-15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1 }, + {-17,-12, 6, -8, 16, 13,-20, -8, -1,-16, 10, 21,-19, 11, -9, -5, + 7, 18, -6, 7, -7,-18, 13, 2, -2, 8,-12, -9, 2, 4, -5, 16 }, + { 4, 0, 17,-11, 12, 7,-12, 5, -1,-25, 30, -8, -7, -6, -4, -7, + 9, 8, 7, 3, 3,-16, 8, 0, -2, -2,-18, -3, -4, -5, 1, 4 }, + { -3, -6, 6,-16, 17, 6, -3, 2, -9,-17, 12, 11, 11, 2,-20, 8, + 1, 1, 0, 2, -2, -6,-21,-13, -9,-15, -1, -8, -6, -8, 0, -2 }, + {-11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26,-10, -3, 4, 0, + 2, 2, -4, 4, -2,-12, 12, 10,-11, 0,-10,-16, 3, 0, 0,-10 }, + { -5,-16, 10, -6, 27, 13, -3, 4, -2,-13, 15, 5, 2, 5, 3, -4, + 13, 12,-11, -7, 0, 1, 11, 12, 2, 13,-15, -8, 9, -2, 3, 8 }, + { -5, -8, 4, 3, 9, 3,-11, 10, 14,-25, 14, 8, -2, 5,-12,-21, + 2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1,-16, 2, 8 }, + { -1, 5, 1,-11, 5, 9, -7, 8,-13,-12, 4, 12, -4, 1, -1, -1, + 27, 29, 10, 15, 2, -6, -3, 4,-21, 10, -9,-11, -6, -1, -9, -3 }, + { -6, -3, -1, -6, 11, -5, 0, -2, -5,-31, 11, 3, -1, 5, -3, 4, + 5, 7,-10, 5,-10,-13, 4, 12,-15, -2, 2, -7, 1, -9, -3,-10 }, + { -3, -7, 17, -8, -5, 36, 8, -7, -8,-20, 12, 8, 1, -1, 3, 0, + 1, 4,-10, 3, 1, 4, -2, -3, -2, -3,-10, 4, -1, -7, 3, 2 }, + {-13, -3, -5, 9, 22, 6,-23, 3,-10, -7, 17, 17, 18,-14, -8, -8, + 2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0,-12, -3 }, + { -3,-10,-15, -3, 9, 3,-23, -9,-13,-18, 12, 13, -2, 0, 1, 8, + -1, 2, -7,-12, -5, 14, 2, 1,-22, 6,-10, -8, -9, 28, -7,-14 }, + { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2, + 2, 1,-10, -2, -2,-22, -2, -7,-10, -5,-11,-27,-12,-16, 4, -7 }, + { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15,-10, -4, -2, 2, + -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1 }, + { 10, -1, 0, 5, 21, 7,-14, 6, -3,-16, 15, 17,-16, 13, 3, -6, + -4, 6,-12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4 }, + { -6, -2, -8,-11, 15, 10, 0, 8, -6,-15, 33, 8, -2, 18,-15,-11, + 5, -1, 0, 15,-15, -4, -4, -1, 10, 7,-13, 4, -4, 0, 8, 3 }, + { -7, -2, 0, -2, 0, -2, -4, -5,-14,-16, 12, 38, 7, 12, 6, -4, + 0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1 }, + { -8, -4, 18, 1, 14, 5,-12, -3, 20,-17, 5, 19,-11, -8, 11, -3, + 3, 9, -7, -8, 9,-17, 2, 15,-10,-11, 5, -5, 7, 15, -6, -2 }, + { -7, 2, 38, 5, 19, 16, -5, 4,-13,-20, 0, 4, -4, 6, 4, 2, + -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0 }, + {-11,-12, 8,-15, -3, 14, -7,-22,-11, 2, 22, 14,-19, 2,-19, -6, + 1, 3,-18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1 }, + { 8, 7, 25,-21, 12, -6, -5, -4,-10, 6, 0, 10, 1,-12, 18, -5, + -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0 }, + { 9, 10, 32,-15, 8, 2, 11, -7,-18, -8, 2, -6, -9,-16, -3, 3, + -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3,-11, 1, 5, 0, 0 }, + { 14, 0, 23,-25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0, + 3, 2, 3,-10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2 }, + { 12, 0, 25,-18, -5, -4, 13,-10, 3, -6, 7, 21, 0,-16, 3,-10, + -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4 }, + { 31, 15, 27,-20, 10, -7, 15,-10, 9, -8, 4, -5, 3, -3, 5, 6, + 11, -2,-12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2 }, + { 12, -4, 13,-23, 12, -6, 2, 4, -3, 13, 6, -7, 5,-19, -7, 18, + 1, -7, 7, 1, 16, -7, 3, 0, 3, 0,-12, 8,-11, 9, 4, 7 }, + { 29, 1, 3,-22, -5, 6, 0, 12,-14, 11, 1, 6, -3, 4, 6, -2, + 4,-13, 12, 1, 1, 3,-11, 9,-10, -1, -7, 16,-11, -1, 3, 9 }, + { 4, 4, 36,-23, -5, -8,-15, 1, -6, 3, 13, -1, -5, -7, 4, 9, + 2,-11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2 }, + { 19, 10, 6,-17, 2, -4, -2, -4, -3, 13, 2, 2,-13, -7, -3,-11, + 9, -6, 1, -9, -5, 4, -5, -9,-18, -7,-11, 9, 4,-11, 8, 4 }, + { 16, -3, 9,-16, 18, -2,-12,-16,-11, 11,-18, 16,-13, 6, 2, 8, + 3, 8, -4,-16, 10,-11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3 }, + { 14, 15, 3,-23, -5, 7, -8, -6, 2, 17, 2, 12, -8,-12, 13, -1, + -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3 }, + { 32, 5,-10,-47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4, + 6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4 }, + { 20, 8, 10,-21, -7, -9,-16, 12, 1, 4, 6, -5, 9,-11, -7, 4, + -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5 }, + { 38, 3, 23,-25, -6,-18, 3,-10, -8, 6,-10, 1,-10, 2, 2, 0, + -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0 }, + { 20, 5, 16,-22, 24,-18, 2,-12,-14, -7, -3, 10, 2, 7,-10, 2, + -8, 1, 8, -1, 4, 1, 4, -2, 5, -9,-18, -8,-13, 5,-11, 10 }, + { 14, 8,-12,-16, 9,-11, -3, -6,-25, -7, 6, 5, -7,-16, 10, 2, + -7, -1, -9, -3, 16, 4, 3, 3, -3, -3,-15, 13, -3, 4, 13, -7 }, + { 16, -9, 19,-23, 7,-19, -3, -5,-15, 11,-21, 21,-16, 18, -1, 6, + 10,-10, 18,-14, 16,-15, 6, -5, -9, 5,-17, 13,-10, 13, 0, 10 }, + { 8, -4, 4,-24, 8,-21,-18, 9,-11, 4, -6, 17, 5, -9, -2, -2, + 2, 15, -2, -3, -2, 1, 7,-13, 15,-10, -8,-11, 3, 3, -1, -1 }, + { 14, 17, 6,-32, 5,-17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9, + -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2 }, + { 24, 6, 22,-12, 8, 3,-14, 4, -7, 8, 6, 5, 6, 1, 6,-12, + 15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3 }, + { 17, 12, 3,-23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17, + 11, 0, -2,-11, 7, 4, 0,-27, -7, 1, 2, -8, 9, 7, 5, 3 }, + { 12, 10, 12,-10, -4, 5, -1, 2,-24, 5, -8, 2, 6,-17, 19, 5, + 12, -2, 16, -7, -6,-14, 4, 1, -3, 13,-16, 5, -1, 4, 1, 1 }, + { 31, 9, 11,-17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4, + -5, -8, 1, 4, 15, -6,-28, 1, 8, 3, -6, 5, 17, -2, 2, -4 }, + { 11, 19, 16,-26, 0, -7, -7, 2,-13,-15,-12, 9, -3, 27, 8, 4, + -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1 }, + { 10, 18, 16,-32, 19, -9, -4, -3, -7, 8, 8, -3,-11, -2, -6,-16, + 13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6 }, + { 9, 4, 19,-33, 4, 7,-12, 36, -3, -1, 8, -2, 2, -8, -9, -4, + -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2 }, + { 25, 7, 15,-12, 2,-24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6, + 3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0 }, + { 19, 6, 8,-20, 9, -9, 5, -4,-13, 7, 11, -3, 5,-13, -9, 6, + -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1 }, + { 15, 6, 19,-23, -3, -9, 3, 16, -6, -4, 6, -5,-10, 1, 16,-14, + 2, 0, 2,-13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3 }, + { 14, 4, 16,-20, 1, 12, 0, 6, -3, 9, 4, 16, 10,-16, 5, 7, + 5, -4, -4,-18, -3,-11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7 }, + { 22, 3, -1,-30, 18, -3, -9, 9, -2, 11,-16, -2,-14, 12, 0, 4, + -5, 4, -1, 3,-20, 12, 4,-10, -2, -2,-12,-12, 10, 6, 11, -3 }, + { 15, 7, 2,-21, 5, 4, 9, -9,-33, 7, 7, 3, -6,-14, -8, 10, + 12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8 }, + { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14,-15, 2, -7,-31, -3, + 14, 0, 14,-15, -1, -4,-15, 10, 1, -3, 1, 2, 5, 2, -8, 1 }, + { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1,-19, 0,-11, 18, + 11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9 }, + { -9, 1, -5, 0, 0,-15, 8, 4, 8, 3, 8, 12,-13, -2,-39, -2, + 4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8 }, + { -9, 6, 6, -8, 12,-12, 23,-18, 4,-15, -5, 2,-20, 13, -7, 7, + 7,-12, 14,-12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6 }, + {-18, 13, 4, 3,-10,-30,-10, -6,-14, 1, -7, -4,-35, 5,-25, 11, + 9, 8, 19, -4, -7, -3,-18, -8, 1, 5, 10, -4,-14, -9, 3, -4 }, + { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7,-16,-17,-20, 11, + -6,-14, 1, 4, 19, 2, -8, 6,-15, 3, 6, -5,-14, 3, 7, 2 }, + { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16,-14, -2, -9, -4, + 13, -2, 18, 14, 14, 19,-13, 5,-10, 2, -3, 3, 5, 5, 1, -1 }, + { -1, -5, -6, -2,-11, -7, 5, -4, 5, -1, 0, 3, -3, 2,-19, 18, + 16, 4, 14,-22, -2,-11,-22, 1, -1, 11, 1, 2, 11,-10, 7,-12 }, + { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9,-24, 23, 1, 20, + 14,-11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11 }, + { -1, -1, 1, 7, -3, -4, 8,-16, 15, -1, -7, 9,-22,-11,-11, 10, + 16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7,-14, -7, 4 }, + { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5,-22, 17, + 7,-11, 15, -5, 1, 3,-19, 0,-15, -3, 16, 5, 5, -7,-11, 12 }, + { -2, -1, 13, 2, 4,-24, 37, -5, -2, -6, 12, 7, -2,-23, -4, 9, + 2, -3, 3, 2, 3, 3,-14, 11, 0, -4, -2, -2, 3, 10,-10, 4 }, + { 2, 9, 8, -6,-28, 14, 28,-11, 18,-11, 0, 2, -2, 4,-12, 3, + 6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9 }, + { -7, 14, 5,-10, -3, 7, 4, -5, 7, -8, -7, 4,-12, 14,-16, 25, + 3, 0, 1, -5, 12,-10, 0,-10, 0, 12, 12, 17, 12, 10, -1, 0 }, + { -4, -2, 5, -2,-17, -3, 5, -5, 7,-17, 1, 5, -4, 4,-20, 0, + 11,-15, 13, -8, 10, 1, 1, 5,-12, 9, -8, 0, 6, -1,-11, 4 }, + { -3, 12, 13,-15, -7, -7, 0, 5, 33, 3, 3, -6,-13, -7,-15, 10, + 3, 3, 3, -5, 2, 7, -1, 0,-12, 2, 11, -6, -9, 0, 5, 11 }, + { -8, 5, 10, -7,-14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21, + 8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0 }, + { -8, 8, -3, -8, 8,-11, 16,-16, 17, 0, 8, 16,-17, 10,-16, 10, + -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16 }, + { -6, 0, 6, 1, -8, -8, 8, -7, -5,-10,-11, 8,-19, 6, -7, 13, + 5, -3, 4, -8, 7, -1,-18, 9, 0, -5, 6, 26, 3, 8, 2, 4 }, + { -2, -2, 23, -2,-20, 2, 7, -7, -6,-15, 3, 9,-19, -2,-10, 7, + -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8 }, + { -6, 12, 10,-10, -7, 4, 17, 11, -6, 1, 12, 11,-18, 8,-12, 4, + 1, 13, 6,-13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4 }, + { 7, 1, 7,-17, -8, 8, -1, -7, 5, -6, 4, -3,-16, 9,-24, 18, + -3, 10, 13,-11, -6,-11, -4, 10, 0, 11, 8, 2, 6, -5,-11, 4 }, + { -4, 1, -5,-10, 0, -3, 9, -2, 4, -1, 1, 5,-41,-10, -7, 4, + -3, 3, 1, 0,-12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5 }, + { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0,-17, -3, -1, 11, + 4, 1, 27,-12, 0,-14, 2,-15, -3, -9, 0, -7, -3, 15, -8, 6 }, + { -6, 4, 9, 2, 4, 3, 7,-10, 28, 1, -2, 48, 7, 0,-10, 10, + 1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5 }, + { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39,-14,-12, 5,-19, 21, + 7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7 }, + { 4, 2,-29, 12, 5, -3, 16, -6, 15,-13, -4, -1,-13, 22,-16, 17, + 16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7,-13 }, + { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4,-13,-12, 16, + 23, -4,-12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15 }, + { -6, 4,-15, -9, -1,-19, 12,-30,-17, -4, 1,-13,-13, 4, -3, 26, + 5,-25, 11,-14, -6,-13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13 }, + { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2,-11, 4, + 32, 15, 15,-47, -8, 3,-12, 4, -5, 4, -1, 0, -5, 5, 1, -7 }, + { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51, + 4, -5, 4,-14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2 }, + { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3,-11, -8,-12, 8, + 11, 5, 19, 3,-24, 19,-14, 11, -5,-18, -8,-12, -5, -4, -1, 4 }, + { 16, 9, 10, 14,-18, -2,-18,-27, 10, -5, 12, 14, 4, 0, -2, -6, + -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7,-16, -3, -6, 6, 9 }, + { 7, 15, -9, 10,-19, 4, -5,-37, -2, -4, 8, 2, 4, -1, 1, 9, + -5, -5,-12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4 }, + { 13, 17, 3, 9, -7, -7,-15,-17, -8,-13, -4, -8, 19, 2, 16, 25, + 7, 15, 2, 16, -5, -6,-10, -9, -7, -6, -2, -7, 7, 2, 4, 5 }, + { 24, 7, 9, 8,-13, -2, 0, -4, 1,-13, 3, 6, 7, 10, -4, 15, + 5, 7, -4, 5, -5, 3, 13, -7, 5, 15,-11, -2, 7, 5, 8, 6 }, + { 17, 6,-15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8, + -15, 10, -9, 7, -1,-11, 2, -8, -4, 3, 4,-10, 4, 4, 11, 1 }, + { 21, 12, -3, 6, -8, 8,-11, -8, -5, -5, 3, 7, -1, -5, 12, 15, + -10,-11, 3, 15, 8, 4, 2,-15, 0, 14, 1, -8, -1, 3, 10, -7 }, + { 16, 12, 5, 13, -6, 15,-23, 0,-17, -9, 0, 4, -9, 13, 6, 18, + 0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0 }, + { 14, 16, -1, 12,-15, -9, -6,-20, 4, 6, 8, 9, 3, 1, -9, -4, + -1,-11, 9, 11,-12, 1,-14, -7, 2, -8, 11, 9, -4, 10, 4,-16 }, + { 13, 10, 3, 7, 0, -8,-33, -6, 4, -4, 19, -2, 14, 6, 5, 7, + 6, -3, -1,-10,-10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3 }, + { 11, 10, 25, 18, -1, -6,-21,-21,-11,-16, 6, 5, 14, 4, 8, 7, + 0,-10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9 }, + { 15, 9, 5, 22,-17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3, + -2, 6, 1, 17, 8,-14, 7, -3, 12, 9, 1, 0, 1, -5, 17,-18 }, + { 25, 19,-17, 12, -4,-10, 1,-13,-19, -7, -3, 9, 6, -2, 3, 1, + 4, -2,-11,-14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1 }, + { 20, 8, -3,-10,-24, 3, -6, -2, 0,-12, 14, 6, 7, 11, 4, 7, + -12, -5, -8,-10, 5, -1, -4, 4, 16, 7,-14, 6, -1, -2, -7,-11 }, + { 16, 18, 17, 1,-15, -6, -5, -3, -1,-19, 8, -2, 2, 8, 12,-19, + -12, 8, 0, -3, -1, -1, 4,-14, 9, -1,-12, -1, -7, 10, -3, 5 }, + { 18, 12, -7, 7, 0, -3,-13, 0, -1, -4, 9, -2, 6, -1, 0, 1, + 15,-21, 1, -8, 25,-19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1 }, + { 13, 16, -4, 9, -2, 2, -1,-19, -7, -4, 18, -6, 14, 18, -5, 4, + -6, -3,-19,-14, -1,-12, 10, 6, 7, 17,-12,-13,-10, -4, 5, 4 }, + { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14,-11, -7, 2, -3, -3, + -2, -3,-13, 12, 16, 1, -5, -9,-10,-11, -2, 3, -7, 5, 11, -7 }, + { 7, 17,-16, -2,-14,-28, -7, -8, 15,-10, 7, 15, 8, 17, 13, -1, + 4, -7,-12,-11, 0, 0, 2, 3, -3, 7, -6, 6, 1,-16, 1, -2 }, + { 23, 11, -9, 15,-23, -4, -6, -4, 2, -9, -7, 9, -8, 3,-13, -4, + 8, 18, -6, -2, 1, -5, 6,-14, -5, -2, -6, -5, -3, -2, 4, -5 }, + { 12, 13, 18, 18,-35, 2, 7,-17, 3,-11, 6, 9, -3, -2, 10, -4, + 3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1 }, + { 19, 11, 1, 20,-14, 4, -9,-13, -2, 11, 0, 17, -1, -1, -1, -1, + -5, -8, 0, 5, -1, -8, 5, -1, 3, 2,-12, 21, -2,-24, 5, 7 }, + { 15, 15,-15, 17,-14,-22, 3, -4,-11, -3, -7, 1, 18, 10, 1, 10, + -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4 }, + { 45, 13, 8, 17, -5, 2,-16, 2, 8, -2, 8,-15, 4, 5, -1, 7, + -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5 }, + { 1, 18, -8, 18,-12,-10, 3, 4,-22,-12, 20, 8, -3, 9, 2, 10, + -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3,-18 }, + { 9, 10, -5, 9,-35,-21,-18,-16, -1,-12, -6, -7,-15,-19, 12, 4, + 4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4 }, + { 31, 8,-17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3, + -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0 }, + { 18, 4, -8, 7, -8,-15, -1,-16, 12, 18, 3, 19, 2, 4, 8, 8, + 0, -5, -8,-12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6 }, + { 27, 15,-17,-10,-23,-22, -1,-14, -4, -7, 20, -2, -7, 6, 15, -5, + 32, 4, 9,-11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 }, + { 22, 4, -7, 2,-15,-11,-17,-10, 2, 0, 15, 11, 7, 12, -8, 6, + -10,-18, -6,-12, 7, 3, 22, 3, -7, 14, -5, -2,-13, -7, -1, -7 }, + { 18, 13, 9, 24, -4,-19, -9,-11, 13, 8, 2, 4, -1, 8, 14, 10, + -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9 }, + { 15, 19, -5, 1, -4,-10, -8,-27, 6, 8, 5, 10, 4, 11, 5, -5, + -11, 0,-11,-14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4 }, + { 18, 1,-13, 14,-14, 9,-15, -7, 12, 1, 13, -4,-20, 12, 10, 12, + -12, 7, 1,-13, 10, -6, 5, -3, 4, 8, 10,-13, -3, -6, 9, -3 }, + { 19,-14, 5, -8, -6, 2, -5, 5, -3, -1,-28, 11, 18, -6, -4, -2, + 11, 14,-43,-42, 9, 2, 20,-23, 6, 32, 0, 5, 0, 6, 9, 5 }, + { 8, 11,-14, -1, 7, 12, -7, 2,-16, 2, 10, -3, -1, -7, -7, -1, + 1,-10,-60,-23,-18, 42,-13, 9, 18,-11, 0, 1, 0, 2, -5, 1 }, + { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2, + -2, 3,-34,-15, 37, 47, 10, 20, 9, 1, 3,-21,-25,-33,-14, 8 }, + { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5,-13, 9, 3, + -17,-19, -2,-79,-12, -7, -8, -6, -2, -2, -1, -1, -7,-13, 6, -1 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, + 0, 3, 4,-87, 6,-11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1 }, + { -5, 6, 2,-24, 5, -9, -7, 0, 7, 3, -3, 16,-14,-16, 0, 18, + 15, -9,-14,-28,-17, 53, 14, -6,-28, -1, -3,-10, -7,-14, 19,-15 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, + -13, 0,-53, 3,-22, 63, 19, 16, 1,-11, 0, -3, 0, -3, 0, 1 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + -1, -6,-43,-43, -2, 65,-13, -4, 9, 1, 1, 2, 1, 0, 0, 1 }, + { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1, + -23, 1,-61,-55, 3,-28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0 }, + { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4, + -48,-19,-52,-46, 11,-12, 5,-14, 0,-10, 0, 0, -1, -2, -1, 0 }, + { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0, + 3, -7,-61,-51, -4,-21,-16,-21,-11, 14, -7, 8, 3, -5, 1, 2 }, + { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3, + 56,-11, -6,-67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0 }, + { 14, 9, -2, 14,-10,-10, 9, -5, 1, -8,-23, 30, 8, -7, 23, 8, + 2, 10, -1,-27,-17, 57, 22, 4, -5, 2,-12, -6, 2, -7, -4, -9 }, + { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16, + -15, 29,-55,-29,-24, 29, 3, 10, 6, 13, 10, -5, 21, 11,-14, 5 }, + { 4, 2, 26, -6, 10, 11,-23,-10,-27,-20, 3,-24,-11,-10,-13, 25, + -10, 5, -9,-36, -7, 43, 3,-13, 6, 13, -2, 0, 1, 3, -3, -4 }, + { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1, + -12, 12,-26,-64,-15, 29, 37, -7, -3,-12, -5, 14, 8, -8,-10, -2 }, + { 19, -4,-11,-16, 8, 14, 5, 19, 3, 22,-11,-21, -1, -6,-11, 11, + 10,-24,-23,-40, -8, 20, 17, 5, 13, -6, 3, 14,-20, -8, 3, 28 }, + { 2,-12, 10,-14,-18, 26,-22, 4, -2, 5,-21, 8, 3, 1, 19, 0, + -12, 24,-14,-40, 15, 29,-15, 6, 15, 1,-19, 2, 4, 7,-12, -3 }, + { 0, 17, 13, 7, -5,-11, 2,-19, 3, 38,-21, -3, -6, -4, 7, 1, + 1, -5,-40,-10, -2, 35, 8, 8,-10, -8, -9, 33, 4, 4, 0, -2 }, + { -2,-12, 7, 29,-24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2, + -37, 15,-22,-40,-11, 33, 10, -1, 8, 10, 6, 8, 9, 0,-12, 2 }, + { 15, -8, -9, -2, 7,-17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11, + -15, 14,-13,-48, 5, 18, 0, -9,-36,-11, 2, 4, 5, 5,-15,-12 }, + {-12, 0, 3, 4, 7, -5, 5,-14,-24,-18, -6,-15, -8,-20, 1, -7, + -33,-28,-40,-38,-18,-10, -5, 17,-12, 4, 3, -5, 5,-13, 4, -7 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + -3, -9,-49,-60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + -3, -9,-49,-60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, + 3, -2, 9,-29,-11, 55, 8, 32,-36,-13, -7, 37, 4, 11, 0, 3 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -1,-39, -4,-30, 63, 28,-17, -6, 10, 7,-14, -9, 11, 9, 7 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, + 13, -2,-50,-32, 22, 51, 4, 7, 6, 11,-20,-13, 9, -5, 21, -4 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + -3, -9,-49,-60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, + -3, -9,-49,-60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, + 3, -2, 9,-29,-11, 55, 8, 32,-36,-13, -7, 37, 4, 11, 0, 3 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -1,-39, -4,-30, 63, 28,-17, -6, 10, 7,-14, -9, 11, 9, 7 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, + 13, -2,-50,-32, 22, 51, 4, 7, 6, 11,-20,-13, 9, -5, 21, -4 }, + { -8, 2, 1, 22,-31, -6,-25, -3, -3, 1,-15,-11, -2, -3, 4,-13, + -9, 15,-18, 37, -7,-37, 12,-13,-11,-25,-10,-11,-22, 7, 16, 7 }, + { 14, 10, 4,-10, -1, -5, -7, -3, 16, 13, -5,-15, 5, 11, -1, 8, + -27, 7,-12, 49, 17,-22, 9, -2, -9, -1, 2,-15, -1, 41,-18,-17 }, + { -4, -9,-15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17,-19, -7, + 36, -9,-38, 17, 1,-48, 11,-18,-13, -2, -8, 4,-10, -5, 21, 11 }, + { 15,-13, 4, 2, 1, -5, -2, 1,-10, 7, -1, 3, -6, 0, 11,-11, + 8, 20,-17, 51,-17,-41, 2, 15, 4, 8, -2, 16,-32, -1, 17, 6 }, + { -8, 8,-18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8, + 30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7,-11, 2 }, + { -8, -7, 9,-10,-13, 6,-11,-14, 13, 25,-26, 5, 2, -5, -5, 5, + -8, 4, 0, 33, 12,-38, -4, 6, 13, 6, 25, 34, -1, 25,-19, -5 }, + { 18, 3,-17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8,-35, 15, + 24, 43, -5, 51, 5,-12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 2, 10, 24, 76, -2,-22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0 }, + { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, + 24, 13, 32, 70, 26, 5,-21, -9, -6,-15, 2, -2, 2, 4, 1, 1 }, + { 5, -4,-11, 4, -4, 22, 10, -2, 13,-11, -4,-21,-17, 0, -7, 4, + 10,-34, 11, 52, 2,-46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7 }, + { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1, + -8, 9, -1, 64,-13,-61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1 }, + { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1, + 10, -2,-31, 79,-10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1 }, + { 3, 12, 10, 26,-19, 10, -9, 6, -4,-15, 10, 3,-16, 6, 11,-19, + 3, 10, 18, 44, 5,-30, 5, -9, 21, 4, 20, 10, 14,-25, 8,-17 }, + { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2, + 8, -8, 13, 69, 26,-19,-25,-17, 16, 6,-12, 22, 2, -6, 9, 5 }, + { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, + -34,-15,-33, 56, 9,-42, 9, 10, 6, 9, -8,-11, 0, -6, 15, 5 }, + { 10, 2,-14, -3,-15,-35, -1, 7,-18, 14, 8, -1,-15,-26, 6,-15, + -18, 22, 9, 33, 0,-32, -9, 3,-11, 7, 4, -1, 5, 30, 9, 1 }, + { 4, 15, 0, 6, -5,-11, 9, 6, 6, 6, 14, 2, -1, 10,-24,-25, + -2, -4, -1, 37, 2,-29, 14, -9, 22, 17, -2, 33, 10,-25, 11,-11 }, + { 0, 5, 2, 18,-12, 21, 22, 33, -7, 21, -9, -7, 7,-15, -7, 16, + 7, 0,-14, 44, 10,-25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, + { 3, 13, 12, 12, 8, 25,-23, 8,-22, -3,-18, -8, 15, 12, 9, 19, + 0, 0, -9, 49,-27,-15, -9,-15, 12, -8,-16, -7, 13, 5, 13, 2 }, + { 12, -6, 7, -2, 20, -9,-14, 12, 13, -5,-17, 22, -8, -4, 2, 7, + -13, -2,-15, 43, -5,-30, 27, 4, 10,-27, 5, 27,-10,-10,-18, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + -1, 10,-18, 70, -2,-52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + -1, 10,-18, 70, -2,-52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 15,-13,-20, 16, 2, 13, 5,-11, -8, -5, -3, 2, 24,-23, 30, -7, + 11, 30,-15, 43, 5,-15, 15, -3,-14, 1,-23, 8, 3, 9, 4,-11 }, + { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, + -34,-15,-33, 56, 9,-42, 9, 10, 6, 9, -8,-11, 0, -6, 15, 5 }, + { 10, 2,-14, -3,-15,-35, -1, 7,-18, 14, 8, -1,-15,-26, 6,-15, + -18, 22, 9, 33, 0,-32, -9, 3,-11, 7, 4, -1, 5, 30, 9, 1 }, + { 4, 15, 0, 6, -5,-11, 9, 6, 6, 6, 14, 2, -1, 10,-24,-25, + -2, -4, -1, 37, 2,-29, 14, -9, 22, 17, -2, 33, 10,-25, 11,-11 }, + { 0, 5, 2, 18,-12, 21, 22, 33, -7, 21, -9, -7, 7,-15, -7, 16, + 7, 0,-14, 44, 10,-25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, + { 3, 13, 12, 12, 8, 25,-23, 8,-22, -3,-18, -8, 15, 12, 9, 19, + 0, 0, -9, 49,-27,-15, -9,-15, 12, -8,-16, -7, 13, 5, 13, 2 }, + { 12, -6, 7, -2, 20, -9,-14, 12, 13, -5,-17, 22, -8, -4, 2, 7, + -13, -2,-15, 43, -5,-30, 27, 4, 10,-27, 5, 27,-10,-10,-18, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + -1, 10,-18, 70, -2,-52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + -1, 10,-18, 70, -2,-52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 15,-13,-20, 16, 2, 13, 5,-11, -8, -5, -3, 2, 24,-23, 30, -7, + 11, 30,-15, 43, 5,-15, 15, -3,-14, 1,-23, 8, 3, 9, 4,-11 }, + { 16,-18, 7, -4, 31,-15, -9,-13, 20,-12, -6, 0, 12, -6, -2, 4, + 3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1 }, + { 38, -5,-13, -4, 8,-15, 11, 1, 2, -4, -1, 9, 13, 4,-12, -7, + 0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1,-11, -2 }, + { 47,-22, 9,-26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4, + 3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2 }, + { 14,-16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7,-19,-14,-17, + -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1 }, + { 29,-11, 5, -3, 4, 11, 4,-10, 1,-22, -3,-10, 5, 4, 2, 8, + -2, -7,-12,-12, -8, -3,-18, -2, -9, -5, -1, -3, 2,-14,-14, 7 }, + { 28,-12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4, + 4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8 }, + { 31,-18,-22, 8, 15, -5,-10,-15, 1, 10, 6, 7, 6, -8, 2, -1, + 12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7,-10, -2, 4, -3, -4 }, + { 53,-30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1, + 0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0 }, + { 27,-18, -3, -2, 4, -8, 3, -2,-11, 2, 10, -8, -8, -4, 0, -2, + 8, 0, 9, 0,-16, 11, 1, -6, 13, -3,-10,-13,-15, 25, 1, 0 }, + { 35, -5, -1, -8, 23, 11,-14, -3, 2, -2, 8, -6, 17, -2, 7, 0, + -2, 10,-17, 13, -2, -2, 11, 11,-14, 2, -2, -3, -8, -1,-12, -5 }, + { 29, -9, 7, 3, 2,-10, 0, 3, 9, 0, -3, 5, 1,-10, 10, -5, + 3, 6,-20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0 }, + { 15,-16, 18,-19, 16,-15, 17,-18, 13,-16, 17,-14, 15, -9, 13,-17, + 9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9 }, + { 21,-10, 7, -2, 12, -7, 13,-17, 11, -2, 20, 3, 5,-11, -6, -6, + -15, 0, -9, 5,-11, 7, -1, 7, 8,-10, -9, 3, -5, 9, -8, -2 }, + { 23,-22, 15, -5, 16, -4, -3,-12, 9, 3, -1, -2, -8, 2, -2,-16, + 3, 4, -2, -6, -7, 12, -8, 2,-14, 2, -7, 11, -2, 6, -4, -1 }, + { 34,-17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1,-15, + 6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6 }, + { 18,-18, 2, -2, 10, 1, 18,-23, -3,-10, 0, 4, 20,-19, -3, -4, + 2, 8, 6, 1, -3, 1, 1, 3, 5, -1,-11, 3, -7, 5, -1, 1 }, + { 15,-14, 2, 3, 10, -8, 12,-13, 13,-15, 6, -8, -4,-10, 14, -9, + 24, 2, -7,-18, 13,-11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4 }, + { 20,-12, 13, 5, -1,-10, 15, -6, 8, -1, -3,-10, 17, 0, -6,-19, + 2, -1, 8, -3,-16, 0, -3, 2, -2, 0, 8, -9, 0, 1,-10, -9 }, + { 32, 0, -9, -5, -1, 5, 13,-11, 8, 3, 11,-11, 0, -8, -2,-14, + 7, 10, 6, -5, 1, 10, 2, 12,-10, 4, 4, 6, 4, 0, -7,-10 }, + { 16,-14, 10, -7, 11,-11, 11,-11, 18,-13, 8,-15, 16,-11, 13, -9, + 8, -7, 12,-11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3 }, + { 24,-27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9,-11,-13, -5, + 10, 0,-13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3,-17, -2 }, + { 23,-19, 15, 1,-10,-18,-12, -6, 8, -3, 12, 0,-12,-10, -4, -4, + 8,-10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11 }, + { 25,-12, 4, 2, 24, -3, 3, -6, 14, 11, 0,-21, -3, -3, 1, -8, + 7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9 }, + { 24, -8, -6, 7, 16,-12, 13, -1, 11,-21, 2, -6, 3,-12, 0, 9, + 4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4 }, + { 25,-21, 13, 14, 13,-18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12, + 7, 3, 5, -5, 2, -2, 3,-10, 2, -9,-15, 6, 1, 7, -5, 1 }, + { 23,-16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4, + -6, 2, 9, -1, 14, 12, -6, -1,-17, -2, -4, -9, -7, -6, -8, 3 }, + { 50, -8, 5, 2,-11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0, + 6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2 }, + { 28,-17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19,-27, 5,-12, + 7,-14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4 }, + { 22,-19, -6, -6, 3,-22, 3, 5, 20, -8,-14, -5, 1, 1, 20, 2, + 16, 6, 3, 14, 4, 3, 5, 1, 5, -7,-10, -6, 3, -6, 1,-14 }, + { 29,-14, -8, 13, 8,-10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11, + -7, 1, 2, -9,-11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1,-11 }, + { 18, -9, 4, 1, 7,-29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8, + -13, 5, 4,-13, -4, 2, -5, -7, -6, 14,-10,-34, -3, 1, -3,-13 }, + { 38, -9, 24, 8, 11, 4, -6,-11, -2,-12, 1, 1,-11, -8, -5, -2, + -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5 }, + {-20, 11, -4, 24,-11, 1, 15, 4, 0,-28,-10, -1, 10, 10, -6, 5, + -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2 }, + { -9, 10,-23, 27, -4,-17, 20, -6, 14,-17, 5, -1, 5, -9, -7, 5, + -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12 }, + {-10, 19, 4, 9, 1,-16, 17, -2, 9,-29,-16,-11, -4, 7, -5, 4, + -1, -3, 3, 2, 3, -4, 5,-12, -2, 6, 5, -4, 4, 1, 4, 10 }, + {-20, 10,-24, 14, -5, 11, 9, 0, 16,-20, 10, -5, -6, -6, -1, 2, + -4, 5,-16, 8, -2, 5, 5,-11, 9,-11, 4,-11, -1, -1, 4, 3 }, + { -9, 11, 3, 19, 24, 4, 5,-14, 30,-17, -4, -2,-17, 7, 2, 3, + 1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3,-12, -2, 3, -3, 10 }, + {-19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12, + -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4,-20, 0, 10, -9, -3 }, + {-21, 9, 20, 12, 0, -3, 5, -9, 15,-13, 5, -5, -6, 24, 2, 9, + -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0 }, + {-18, 16, 13, 15, 2,-10, 14,-11, 4,-11, 5, 12, 12, 20, 8, 30, + 2, 11, -9, 7, 0, -3,-16, -5, -6, 5, -4,-21, 0, 5, 6, 1 }, + {-26, 8,-13, 9, 6,-10, 2,-11, 7, -4, 6,-19,-11, -6,-12, 16, + 0, 5, -7, 8, 5, 6, 17, -9, 10,-10, 5, -3,-11, 2, 4, 10 }, + {-11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14,-27, 5, -7, -4, -5, + -10, 11, 1, 15, 1, 1, -6, -5, 10,-22, -7, -7,-15, 13, -4, 5 }, + {-17, 14, -7, 13, 3, 0, 13, -6, 9,-14,-22, -1, 1, 19, 14, -3, + 4,-13,-13, 2, -4, 8, -2, -2, 13,-12, 13,-12, -7, -5, -3, 6 }, + {-17, 17, -1, 33, 6, 3, 9,-16, 3,-14, -8, 6,-17, 8, 3, 13, + 8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13,-10, 4,-17, 0, -6 }, + {-20, 7, 7, 21, 1, -3, 7, -3, -2,-12, 9, -7, 2, -3, 14, 1, + -1, -7, 12,-10, 5,-20, 11, -2, 0,-24,-17, 6, 6, -4, 3, -1 }, + { -8, 10, 6, 7, -1, -6, 28, -6, 10,-33, 1,-20, 0,-12, 10, 1, + -6, 8, -3, -1,-10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4 }, + {-17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3, + -2, 12,-15, 3, 4, 1, 2, -9, 0,-16,-21, 2, -4, 16, -7, 4 }, + {-15, 20, 8, 17, 5,-14, 15,-11, 21,-11, 13,-13, 2,-15,-13, 1, + -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3 }, + {-21, 8, 2, 16, -1, 2, 15,-16, 13,-12,-12, -7, -8, 2, -7, 11, + -8, 5, 2, -7, 16, -4, 1, -7, 3,-15, 6, -5, -8, 2, -8, 5 }, + {-15, 17, -6, 3, -3, 3, 9, -7, 14,-23, 11, 1, -1, 4, 7, 6, + -1,-14, 7, 6, -8, 5, 1,-15, 10, -9, 2, -3, -1, 4,-10, -4 }, + {-10, 18, 3, 11, 1, 4, 14,-14, 7, -4, 15,-10, 10,-11, 10, -4, + 5,-14, 10, 4, 15,-12, 15,-13, 20,-15, 14,-15, 8,-11, 4, -6 }, + { -7, 23, 2, 20, 7, 8, 19, -5, 9,-16, -8,-17, -5, 1, 5, -6, + -8, 1, -6, -4, 10, 6, 6, 2,-11, -4, 0, 2, 4, 7, 9, -4 }, + {-15, 20, -5, 22, 11, -8, 9, -5, 10,-13, -8, 8, 2, -2, -3, 7, + 6, 10, 1, 2, -5, -9, 1, 10, 16,-22, -7, 0, 7, 7, 6, 1 }, + {-26, 19, -5, 3, 5, 25, 18, -5, 9,-14, -8, -6, -2, -6, 2, 3, + -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1 }, + {-20, 14,-10, 6, -3, 7, 8,-32, -2, -7, -2,-10, 16,-12, -9, 15, + -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3 }, + {-14, 16, 4, 11, -8, 1, 23, -4, 17,-13,-10, 1, 12, 9, 12, -4, + 7, -1, -1, 5, -8, -6, 3, 3, -6, -3,-18, 0, 18, 20, 4, -2 }, + {-33, 19,-10, 30, 15, 2, -3, -1, -4,-14, 7, -7, -1, 7, -8, 9, + -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4 }, + { -6, 20, 0, 5, 17,-10, 18,-17, 9,-16, 4,-13, -6, 2,-14, 14, + -28, 9,-12, 25, -4, 7, 7, -8, 6, -6, -2,-10, 2,-11, -1, 2 }, + {-12, 14, 12, 52, -3, 5, -5, 4, 8,-13, 2, -5, -4, 2, -2, -1, + -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0 }, + {-13, 6, 9, 24, 0, 8, 14,-15, 18, -9,-11, -8, 3, 15, -2, -4, + -9, 4, -3, 12, 14,-13, 11, -4, 2, -4, 0, -6, -6, -6,-14, -1 }, + {-10, 28, 3, 12, 9, 3, 11,-28, 6,-11, -7, 4, 0, 7, 8, -9, + 0, -6, 0,-16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3,-10, 6 }, + {-11, 14, -2, 19, -1, -1, 7, 9, -2,-27, 10,-14, 15, -4, 12, -4, + 2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3,-11, 5, -9, 3, -8 }, + {-18, 7, 13, 16, -4, 3, 9,-10, 10,-10, -3,-22, -4,-12, 3,-16, + 0, -3,-16, 8,-11, 1, 10, -7, 15, 3, 0, -1,-13, 8, 1, 6 }, + {-20, 10,-10, 10, 8, -1, 6, 0, 16,-12, 9,-10, -1, -5, -4,-13, + 13, 16, -8, 12, -2, 14, 18, 13, 0,-16, 2, -5, -5, -5, -4, 3 }, + {-14, 5, -7,-17, 5,-13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4, + -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5 }, + {-19, 3,-24,-28, -9, -7, 19, 3, 2, 19, 7, 5,-13, 8,-15,-17, + 3,-11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2 }, + {-17, 18,-30,-20, -2, -3, 1, 15, -1,-11, 6, -4, 11, 11, -4, -5, + -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1 }, + { -6, 1,-30,-25, -1, -8, -2, -9,-17, 16, 3, -1, -2, -9, -6, -7, + -3, 12, 6, -4,-10, 0, 10, -8, -6, -5, -3,-11, -4, 0, -1, -3 }, + { -1, -1,-34,-28, 1,-10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7, + -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6 }, + {-11, 14, 1,-31, -7,-24, 9, 7, 6, 5,-13, 1, -1, 3, 4, -1, + -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2 }, + {-25, 8,-11,-18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4, + -4, 5, 6, 8, -7, 6, 1,-11,-15,-13, 9, -4,-14, 10, 12, 7 }, + {-20, 11,-15,-25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7, + 16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7,-17, -6,-11, 6 }, + {-11, 18, -5,-20,-15, -3, 9, 11,-20, 12, 5, 5, 11, -3, 7, 1, + 10, -6, -3, -3, 3, 3, 14, -7, 10,-17, 9,-11, -2, -6, 7,-12 }, + {-20, 8,-14,-17, -9,-13, -3, 0,-27,-14, -3,-14, 4, 3, 6, -6, + 7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8,-11 }, + { -9, 14, 2,-37, -7, 13, 6,-11, -6, 9, 18,-11, -6, 2, 12, 4, + -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8 }, + {-29, 8, -1,-13, -2, 8, 23, 2,-10, 7, 13, -6, -5, 11, 13, 0, + -10,-13, 11,-12,-10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3 }, + {-18, 6,-10,-55, -4,-11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6, + 3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1 }, + {-14, 5, 3,-21, -8,-16, -4, -2,-11, 27, 15,-20, 3, 0, 1, 1, + 2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2,-11, -4, -3, 7 }, + {-17, -1, -9,-17, -8,-18, 12,-13, -9, 13, -3, 3, 3, -3, 1, -2, + 0, 16, -9, 6, 12, 9, 5, 11, 2,-15, 1, -4,-16, 7, -4,-12 }, + {-18, 8, -6,-11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15, + 18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2 }, + {-10, 7,-18,-29, 3, 12, 12, 9, 11, 4, -1,-15, 1, -1, 8, -2, + -2, 10,-15, -1, 0, 6, 12, -6, -1, 10, -6, -3,-11, -4, 9, -6 }, + {-14, 14, -9,-21,-12, -2, -1, -7, -5,-10, 5, -8, 0, 6, 9,-11, + 11, -3, -5, 3, 8, 15, -2, -4,-22, 4, -6, 12, 2, 13, 6, -7 }, + {-12, 11, -5,-29,-25, 4, 12,-13,-11, -7, 4, 2, 2, -5, 5, 8, + 7, -5, -5, 6, 3,-10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6 }, + {-15, 11, -5,-16, 0,-13, 26,-23, -6, -3, 5, -2, -2, 21, -6, -3, + -5, -1, 6, -1, 0,-13, 2, -3, -9, -1, -4, -3, 5, -4, 12,-16 }, + { -9, 9, -1,-17, -3, -6, 12, 6,-18, -2, 11,-14, -6, 3, 14,-12, + -11, -5, 14, 2, 5, -8, -4,-11, 2, -5, 16, 6, -7, -4, 8, 13 }, + {-13, 5, 3,-28,-14, 0, 6, 23, 5, 4, -1,-17, 1, -3, 0, 0, + 5, 4, 0,-18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0 }, + {-15, 4,-13,-16, -3,-12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14, + 9, 16, 4, 1,-12, -3, 4, -7,-15, -7,-10,-14, -6, -8, -1, -6 }, + { -7, 10, -5,-10, -3,-13, 16, -1,-12, 7, -3,-12, 2, 13, 13, 2, + 17, 15,-13, 1, -5, -2, 3, -1, 1, -3, 6, -3,-12,-16, 7, -7 }, + {-11, -5,-12,-30, -6,-22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6, + -2, 0,-22, -2, -9, 2,-13, 8, 6, -8, 4, -7, -1, -6, 4, 6 }, + {-14, 5, 1,-27, -4, 2, 1, 14,-11, -7, -8, -4, 1, 8, 0, -6, + -13, 11,-12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1 }, + {-10, 10,-25,-13,-20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2, + 3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1 }, + { -9, 15,-18,-17, 4,-11, 6, 7,-12, 8, -1,-11, 2, 3, 7, 16, + -3, -9, 7,-12, 23, 0, 6, 7,-14, -9, 8, 1, -2, 6, -2, -1 }, + { -6, 9,-16,-26,-14,-11, 9, -6, 5, -2, 13, 17, 21, 7, 18,-19, + 6,-23, -2,-15, -2, 2,-10, -8, 2, 1, -2, 4, -3, -4, -5, -4 }, + { 0, 6, -5,-28,-17,-32, 2,-10, 11, 3, -5, 9, 10, 3, 11, 11, + -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4 }, + { 0, -8,-18,-34, -9, -7, -4,-11, 10, 15, 11, -1, -8, 15, 6,-13, + 9, 2, -4,-12, 0, -1, 19, 12, 6, 5, 0, -3,-10,-12, 3, -5 }, + {-10, 6, -9,-17,-12,-11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2, + -6, 3,-12, -1, 0, 1, -5,-22, -2,-12, 0, 6, 17, 5, 5, 6 }, + { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2,-29, 11, + 5,-13,-73, 24, 12, 4,-14,-10, 5, 1, 0,-11, -7, -7, 7, 3 }, + { 10, -3, -1, -3, 4,-11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7, + 21, 17,-54, 47,-14,-10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2 }, + {-12, 4,-16,-12, 5, -9, -4, 19, -7,-22,-22,-17, 3, 0, -6, 8, + 23, -4,-55,-28, 2,-26, 2, 1, 4, 0,-13, 6, 0, 10, -7,-11 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, + 35, -1,-67,-35,-24,-24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0, + 41, -4,-73,-15, 18, 4, 17, 8, -1,-16, -1, -2, 1, 0, 0, 0 }, + { -4, -4, 4, 6, -1, 2,-16,-10,-15,-10, 21, -2, -6, -2, 14, -7, + 10, -5,-55, 34,-12, 11,-13, -2, 2, 28,-26, 0, 7, 4, 21, -7 }, + { 2, 1, 15,-22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6,-15, -7, + 23, 10,-60, 8, -4, 29,-22, 2,-13, 9,-10, 12, -1, -3, 4, 7 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5, + -21,-11,-60,-27,-17,-39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3 }, + { 2, -5, 9,-17, -1, 2, -3, -6, 8, 12, 7, -6,-33,-11,-14,-40, + 10, 36,-46, 0,-19, 5, 0,-10, 3, 12, -6, -8, 6,-12, -7, 1 }, + { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0, + 4, -2,-87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1 }, + { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, + 1, 7,-76, 41, -7,-24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, + { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, + -32,-11,-64,-29, -9,-43, 2,-11, -1, -7, 0, -4, -2, -2, -2, 2 }, + { 10,-20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2,-20,-20, + -19, 3,-47,-18,-16, -6,-15,-42,-17, 14, -6, 8, 12,-10, 11,-12 }, + { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, + 10, 13,-68, -9, 26, 3, 5, 3,-21, 10,-15, 21,-22, 19, 11,-14 }, + { 1, 5, 18,-19,-29,-13, -2, 18,-10, 20, 2, 10,-10, 11, 1, 8, + -16,-17,-41, 10,-14,-25, 0,-14,-19, 17, 7,-12, 14,-11, 14, 5 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1,-43, 5, + 6,-12,-48, 19, 8,-38, -8, -3, 22,-21,-10, 15, 20, -9, -5, 8 }, + { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, + 22,-14,-71,-24, -2,-33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, + { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10,-11, + -17,-32,-58, 14,-14,-11, -2, 15, 2, -8, 12, 10, -9, 13,-33,-14 }, + { 15,-17,-19, 7, -8,-15,-32,-22, 7, 12, 18, 0, 0,-15, -4, 16, + 37, -2,-46, 11, 2, -8,-10, -8, 14, 9, -4, 5, 7,-17, 4, 3 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, + -5, 3,-85, 23, -9,-17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, + -5, 3,-85, 23, -9,-17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, + 1, 7,-76, 41, -7,-24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, + { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, + -32,-11,-64,-29, -9,-43, 2,-11, -1, -7, 0, -4, -2, -2, -2, 2 }, + { 10,-20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2,-20,-20, + -19, 3,-47,-18,-16, -6,-15,-42,-17, 14, -6, 8, 12,-10, 11,-12 }, + { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, + 10, 13,-68, -9, 26, 3, 5, 3,-21, 10,-15, 21,-22, 19, 11,-14 }, + { 1, 5, 18,-19,-29,-13, -2, 18,-10, 20, 2, 10,-10, 11, 1, 8, + -16,-17,-41, 10,-14,-25, 0,-14,-19, 17, 7,-12, 14,-11, 14, 5 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1,-43, 5, + 6,-12,-48, 19, 8,-38, -8, -3, 22,-21,-10, 15, 20, -9, -5, 8 }, + { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, + 22,-14,-71,-24, -2,-33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, + { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10,-11, + -17,-32,-58, 14,-14,-11, -2, 15, 2, -8, 12, 10, -9, 13,-33,-14 }, + { 15,-17,-19, 7, -8,-15,-32,-22, 7, 12, 18, 0, 0,-15, -4, 16, + 37, -2,-46, 11, 2, -8,-10, -8, 14, 9, -4, 5, 7,-17, 4, 3 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, + -5, 3,-85, 23, -9,-17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, + -5, 3,-85, 23, -9,-17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5, + 0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1 }, + { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7, + -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4,-12,-11 }, + { 15, 24,-14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5, + 9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3 }, + { 9, 36, -9, -8, 7, 7, 4, 3, -1,-16, -2, 7, -5, -6, 6, 12, + -11,-12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6 }, + { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2,-10, -5, 2, + -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0 }, + { 16, 27, -1, 0,-14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1, + -1,-19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6,-14, 14,-13,-15 }, + { 12, 23,-14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7, + -3, 0, 2, 8,-13, 7, 13, -6, -4, 6,-13,-16, 14, 11, -7, 5 }, + { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3,-12, 20, 8, 9, + 8, 23, 8,-13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1 }, + { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4, + -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2 }, + { 24, 21, 1,-11,-10, 17,-14, 14, 6, -1, -6, -1, 0,-13, -1,-12, + -2, -5, 6, -4,-12, 14, 5, -2, -8, -8, 15, -7,-30,-12, 4, 0 }, + { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10,-28, 10,-17, + -8, 1, 2, -7, -1, -6,-15, -1, 4, 5, -7, 9, 0, -5, -4, 4 }, + { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12,-11, 7, 11, 13, 2, + 0, 5, 9,-10, 16, 3, -3, 5, -9,-23, 2, -2, -1, 5, 2, 11 }, + { 35, 24,-20, 2, 4, -1, 5, 14,-10, -9, 8, -7, 0, 5, -7, -7, + 11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4 }, + { 9, 35, -1, 2, -1,-19, -3, 12, -1, 8, 8,-13, -1, -2, 2, 5, + -8, -1, 13, -2, 11, 1, 0,-10, 0, -3, -7, 2, 1,-12, 3, 12 }, + { 20, 27,-12,-12, 7, 4, -1,-13, -1, -9, 2, 13,-11, 5, 7, -9, + 9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9 }, + { 8, 37,-20, -5, 0,-21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2, + 0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2 }, + { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3,-17, 10, 5, + 5, -6, -6, 6,-10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4 }, + { 14, 29,-20, -4, -3, 1, -5, -1, 2, 12,-10, -3, 4,-18, 4, 14, + -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2,-14, -3, 4, -4, -7 }, + { 23, 23,-23,-11, 27, 4, 4, -1, 7, 0, -5, 9, 2,-11, 3, 7, + -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2 }, + { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0,-12, 9, -1, 0, + -17, -9, 30, -5,-15,-16,-13, 0, 10,-11, -7, -3, -1, 0,-11, -2 }, + { 12, 32, -4, -5, 10, 19,-10, 4,-12, 5, -6, 9,-12, -6, -6, -8, + 4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4 }, + { 46, 42, -3,-14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1, + 1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2 }, + { 9, 33,-13, 4,-11, 3, -8, 22, 12, -2, 4, 0,-16, 5, 4, -1, + 7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2 }, + { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1, + 8, 7, -6,-13,-10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1,-16 }, + { 9, 28,-11,-10, 9,-10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8, + -7, 2,-15,-23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15 }, + { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16, + 0, 0, -7, -2,-13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1 }, + { 11, 37, 7,-23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8, + -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2 }, + { 21, 33, 7, 20, 21,-10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4, + 10, 2, -2, -2, 0,-10, -6, -2, 0, -5, 3,-11, 3, -9, -3, 1 }, + { 6, 30,-15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6, + 8, 2, -2, 4, -2, 5, 11,-21, 3,-10, 16,-11, 24, 10, 14, -6 }, + { 15, 36, -3, -9,-20, 12, 0, -7,-18, -4, -8, -9, 9, -7, -3, -1, + 2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1 }, + { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3, + 3,-19, 1, 5, 4, -2, -6, -5,-10,-11, -8, -2, 2, -5, -8, -7 }, + { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10,-11, -4,-13,-12, -6, -4, + 0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7 }, + { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6,-13,-14, 8, -1, 1, 2, + -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1 }, + { 0, 6, 0, 0, 4, 13, -7,-16, -6, 15,-14,-21, -9,-10,-10, -6, + -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6,-10, -7,-18, 1, 4 }, + { -1, 3, 10, 1, -1, 15, 4, -7,-16, 3, 0,-22, 10, 2, -3, -2, + 13, 5, -8, 16, -5, 4, 0,-11,-10,-22, 0, -4,-17, 5, 2, 1 }, + { 12, 8, -4, -9, 14, 40,-21, 0, 1,-15,-10,-12, 12, 6,-10, 2, + 8, 6,-12,-10,-11, 1, 0,-11, 2, 1, 13, 0, 6, 3, 8, 4 }, + {-10, 3, 5, -4, -3, 3, 0, -9, 2, 8,-22,-23, 17, 8,-17, -3, + 14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1,-10, 0, -2 }, + { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2,-16,-15, 12, 21, -7, -4, + 7, -7,-11,-15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9 }, + { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13,-14,-20, -4, 11, 8, -4, + -1, 2, 0, -7, 5,-17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14 }, + { -2, 6, 2, 8, -2, 5, -4, -2,-10, 3,-45,-30, -3, -3,-12, -4, + -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1 }, + { -3, 14,-16,-10, 10, 0, -2,-40, -9, 12, 2,-19, 15, -4, 4, 3, + 3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0 }, + { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21,-10,-26, 7, 2, -9, -7, + -3,-16, 8, 5, 5, -6, 10, 4,-14, -6, 5, 3, -2, -2, -4, 1 }, + { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13,-16,-18, 20, 6, -5, 0, + -3, 2, 8, 4,-19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7,-11 }, + { 2, 5, 16, -4, 19, 15, 4, 0,-11, 7,-10,-10,-16, 18,-11,-12, + -9, -4, 7, -4, -4,-17, 1, 1, -8, -3, -3, 5, -2, -6,-11, -5 }, + { 2, 12, 0, -9,-10, 14, 6, 2, -3, 2,-12,-28, 12, 1, -1, 2, + 0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3,-12, 4,-17, -5 }, + { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6,-24, 23, -9,-15, 13, + -7, -9,-15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9,-10 }, + { 1, 5, 11, 3, 6, 12, -3, 8,-21, 5, -7,-20, 12, -2, -9, -3, + 17, -7, -8, -9,-14, 3,-13, 18, -8, 9, 2, -8, 4, -8, -5, -2 }, + { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1,-39, -6, 13,-13, 0, + -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0,-13 }, + { 2, 8, 5,-12,-13, 22, 8,-16, 11, 5, -2,-32, -2, -4, 11, 5, + 5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3 }, + { 13, 9, 5, -4, 9, 18,-11, 2, -1, 15,-10,-19, -2, 14, 0,-10, + 1, 1,-18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9,-13, -3, -2 }, + {-13, 11, 11, -9,-10, 13, -3,-18, 2, 10, 5,-21, 6, 15,-11,-21, + 3, 14, 0,-12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2 }, + { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6,-26, 2, 12, -3, -5, + 12, -2, 1, 8, -7,-17,-19, 5, 10, 7, -3, 2, -3, 0, 5, 0 }, + { 5, 0, 3, -3, -9, 5,-15, -5, -5, 17, -5,-31, 0, 13, 13, 5, + -1, -6,-14, 7, -8, 9,-14, -2,-16, -4, -4, -6, 6, -6,-10, 6 }, + { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8,-32, -1, -4, 0, 3, + -10, 7, 10,-10, 4, -1, 6, 2,-16, -9, 4, 3, 13,-23, -3, -4 }, + { 4, 11, -4, -9, 4, 11,-12,-12,-12, 6, 1,-28, -3, 14, 18, -2, + -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2,-13 }, + { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36,-10,-22, 3, 23, -3,-10, + -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1 }, + { -1, 1, 13, 1, -6, -1, -6, -9,-18, 17, -5,-37, -1, -1, -6, -4, + 1, -6,-15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5 }, + { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7,-16, -5, 23,-14,-13, + 8,-15, 11, 10,-11,-13,-33, -5, -2, 1, 6, 8, 0,-13, -9, 5 }, + { 11, 7, -2, -8, 9, 11, 25,-14, 7, 3, -1,-33, 14, 8, -6,-19, + 3, 3, 2, -1, -3, -1, -2,-10, -3, 1, 2, 1, 4, 2, -3, 4 }, + { -2, 8, 4, -2, 9, 13, -4, -2,-15, -3, 19,-37, 9, 25, -9, 2, + -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3 }, + { 10, 13, -1,-15, 4, 6,-18, -4, 25, 1,-23,-17, 15, 13, -8, -8, + 7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2 }, + { 1, 3, 9, -5, 27, 15, -9,-31, -1, 23, -2, -9, 1, 8, -1, -7, + -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3 }, + { -8, 7, 3, -6, 8, 3,-11, -2, 36, 14, 1,-30, 6, 10,-12, -6, + -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8 }, + { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6,-25, 11, -6, -9,-11, + -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8 }, + {-22,-21, -9,-19, -5, -7,-12,-15, -8, 9,-19, 14, -7, -4, 5, -8, + -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3 }, + {-32,-13, 3,-24, 3, -8, 4, 1,-10, 14,-15, 0, 4, 6, -1, 6, + 7, -1, 6, 4, -3,-17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4 }, + {-32,-11, 7, -8,-12, 13, -5,-22, -4, 12,-16, 2, 0, 4, 0, 1, + 0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4 }, + {-44,-33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1, + 1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1 }, + {-30,-18,-24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7, + 5, 7,-11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6 }, + {-22,-20,-13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1, + 2, -3, 6,-19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2 }, + {-27, -8, -1, 3, -1,-11, 24, 4, -1, 1, -8, 8, 5,-11, 15, -3, + -15, -1, -1,-13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6 }, + {-33,-16, -1, -8, 10,-23, 6, 13, -1, -3, -9, 0, 5, -7, -5,-12, + -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4 }, + {-22,-17, 11, -3, 3, 1, -1, -5, 17, 2,-15, -2, 10, -9, 6, 14, + -16,-12, 20, -1, -7, 6, -3,-12, 1, 10,-10, -1, 7, -3, -1, 10 }, + {-28,-13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10,-10, -3, 7, 2, + 4, 19, -1, -1, 10, 5, -8, 1, 11,-15, -4, -3, -5, 4,-13, 3 }, + {-22,-13, 42,-20, 5,-13, 7,-11, 1, 1, -1, 1, 6, 3, 6,-11, + 3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4 }, + {-26,-15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3,-10, 7, -8,-12, + -5, 12, -9, 3, -2, -3, 18, 1,-12,-15, -4, 5, -3, 0, 12, 7 }, + {-26,-16, 5, 6, 14, -3, 15, 6, 1, -7,-13, 16,-15, 5, 11, -2, + 9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12 }, + {-31,-17, -8,-30, 4, 14, 6, -6, 6,-11, 0, 3, -4, 0, 0, -4, + 0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5 }, + {-61,-10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2, + -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0 }, + {-28,-13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5, + -3, -2, -2,-12,-14, -9,-11,-15,-12, -5, -4,-12, 3, -3, 0, -5 }, + {-41, 0, 12,-24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9, + 9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4 }, + {-26,-19, -2,-15, 4,-14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5, + -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2,-10, 0 }, + {-29,-18, 9, -4, 1, -5,-14,-12, 5,-10, -5, 4, -5, 0, -1, -1, + 4, -5, 7,-16,-11, 2, 7,-15, 2, -4, 6, -4, -6, 7, -3, 7 }, + {-27,-16, 9,-14, 3, -8, 9, 0, 7, -4, -3, -7, 0,-10, -1, 2, + 1, -2, 15,-10, 14, 7, 6, 17, 3, -4, 3,-10, 8, -8, 3, 11 }, + {-21,-20, -8, -8, 4, 5, -3, -2, 0, -5, 14,-10, 11, -4, 13, 0, + 5,-11, 19,-18, 18, 3, -5, -3, -4, -8, 11,-10, 10, 3, 4, -9 }, + {-35,-15, 13,-12, 4, 0, -2, -4,-12, -3, -8,-24, -7, 1, 7, 8, + -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6 }, + {-19,-14, 13,-10, 9, -1, 1, 3,-12, 5,-16, 7, 13, 9, 4, -4, + 6, -5, 4, 9, -3, 17, -4, 12,-11, -6, -5, -6, 13, 2, 7, -9 }, + {-34, -8, -4, 1, 2, -1, 3, 6,-20,-11, 8, -1, 4, 2, -9, 4, + -4, -5, 16, 10, -4, 14,-13, 1, -6, 0, 2,-10, 0, -3, -3, 7 }, + {-36,-10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15,-11, + 0, 2, 3, -1, 4, 0, 8, -1, 0, 18,-11, -5, 15, -5, 13,-12 }, + {-22,-13, 14,-20, 15, 25, 16, 10, 8, -2,-10, -5, -1, -8, 11, 8, + -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2 }, + {-31,-22, 7, 6, -2, 5,-20, 14, -6, 7, 0, 14, 3, -7, 3, -6, + -2, 1, -3, -5, 1,-10, 1,-24, 6, -2, 3, -7, 1, -7, 8, 7 }, + {-25,-20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8, + 3, 5, 6, 5,-10, 10, -4,-15,-15, -2, -9, 2, 18, 1, 8, 12 }, + {-24,-19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6, + -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8,-11, 8, 4, 2 }, + {-26,-20,-12,-12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2, + 9, 22, 13, 4, -4, -1, -2,-14, 5, 15, -8, -5, -7,-11,-14, -6 }, + {-21,-18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3, + 1, 3, -5, -2, 2, 4, 0, -1, 10, 2,-19, -8, 8, 30, -7, 8 }, + {-25, -6, 26, 4, -8, 4, -2, 21, 5, -4,-16, 5, 13, 4,-10, -1, + -6, -2, 2,-10,-13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5 }, + { 0, -1, -2, 19,-12,-48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2, + -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5 }, + {-11, -8,-28, 18, 16,-24, -8, 19, 4, 8,-12, 9, -4, -2, 4, -7, + 6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1,-16 }, + { -9, -5,-26, 7, -3,-37,-16, -2, 2, -7, 4,-13, 0, -4, -6, -5, + -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4 }, + { 2, 9,-18, 7, 29,-24, -1, 7, 14, 10, 3, -3, -2, -5, 6,-10, + -6, -3, -8, 0, 5, 1, 4, 3,-12, 2, 6, 1, 3, 4, 1, -3 }, + {-20, 2, 8, 20, -9,-24, -4, 18, 3, 11, -1,-11, 6, 9, -1, -3, + 1, -1,-15, 3, 15, 9, 3, 2,-13, 2, -8, 8, 1, -1, 1, -8 }, + {-12, 5,-11, 6, 19,-26,-17, -6, 4, 14, 6, -8, 9, 5, -6, -5, + 2, -1, 20, 1,-11,-10,-18, 20, -7, 0, -3, 4, 2, 0, 10, 4 }, + {-15, 1, -2, 13, -8,-21,-22, 4, 4, 3, 3, -7,-31, 4,-10,-14, + 0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7 }, + {-13,-10, -9, 12, 19,-16, -3, -2, 9, 2, 11,-29, -1, 9, 4, -3, + 1,-10,-10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1 }, + {-17, -1, -5, 19, 12, -9,-21, -5, 2, 12, -7, -7, -3, 8, 7, -2, + 6, -9, -9, 1, -4, 1, 1, 3,-14, 2, -8, 0, 10, 1,-12, -6 }, + {-13, -5, 8, 15, 0,-20, -2, 20, 8, -8, 8,-19, 12, 10, 2,-11, + 0, 12, 1,-11, 0,-11,-15, 5,-11, 2, 4, -4,-11, 5, -4, -5 }, + { 3,-11, -7, 8, 0,-17,-26, 15, 19, -7, 10, -9, -5, -5, 14,-25, + 0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2 }, + {-12, 5, 5, 9, 14,-18,-19, 4, 2, 16, 14,-21,-15, -9, -1, 16, + 12,-11,-10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4 }, + {-10, -5, -1, 8, 7,-23,-10, 14, 6, 11, 10,-16, -3, 16, 6, 0, + 0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2,-10, 3, 0 }, + { -2,-14, 2, 16, 15,-17,-17, 6, 19, 4,-10,-15, -1, 15, 11,-14, + -8, 5, 8, 8, -2, -8,-11, 10, 10, -8,-14, 2, 13, 4, -2,-12 }, + {-10, 3, 6, 4, 19,-23,-19, 1, 4, -9,-30, 3, -6, 18, 0, 2, + 0,-11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6 }, + { 9, 5, -2, 21, 20,-33,-13, 7,-10, 8, 8,-15, -6, -4, 1, 5, + 3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3 }, + { -9, -3, 3, 15, -3,-30, -7, -7,-25, 6, 2, -6, 1, 19, 1,-12, + 1, -8,-13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4 }, + { -6,-12,-17, 25, 22,-13,-10, 9, 2, 11, -7,-16, 4, 6, 1, 0, + 0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0 }, + { -1, 0,-10, 8, 8,-27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0, + 6, 10, 6, 4, 2, -7, 9,-18, 3, 3, 3,-10, 17, 10, 9, -6 }, + { -3,-12, -6, 11, 20,-32, 5, 21, 3, -4, -9, 2,-10, 1, 7, -4, + 5, 0, 0, -1, -8, -9, -7, 4,-10, 5, 0, 2, -5, 4, 9, 1 }, + { -5, -1, -5, 1, 2,-19,-13, 1, 6, 12, 2,-16,-17, 11, 10, 13, + 16,-12,-11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5,-11, 3,-14 }, + {-19, 5, 10, 11, 2,-23, -9, 16, -2, 7, 0,-11, -7, 10, 6, -7, + 26,-15, -4, 8, 6, -4, 7, -9,-15, 1, 8, -4, 4, 2,-12, 16 }, + {-11, 1, 11, -4, 1,-31,-13, -1, 8, 5, 4, -2, 0, 13, 7,-17, + 7,-10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4 }, + { -3, 1, 10, -1, 0,-15,-22, 4, 40,-11, -4, -3,-14, 9, 11, -1, + 9, -1, -6, 6, 3, -6, 0, 0,-12, 7, -2, 0, 9, 3, 1, 3 }, + { -1, -1, -1, 14, 8,-24,-14, -8, 5, 8, 5,-12,-17, 8, 2, 7, + 10, -8, 0, 4, -6, -6,-10, 8, 4,-12, 3, -9,-12, 5, 4, -3 }, + { -5, 1,-11, 8, 9,-24, 0, 2, 2, 14,-12,-13, 1, 6, 7, 0, + 7, -6, 9, 26, 11,-14, 8, 10, 1, 9, 0, 11, -2, 6, 2,-10 }, + {-13, 1, 4, 34, 19,-17,-15, 0, 3, -2, -7, -1, 0, -3, -3, -1, + 1, -1,-10, 8, 5, 0, -8, 4,-17, 9, -2, 0, 0, 6, 2, -3 }, + { -6, -4, 1, 2, 2,-14,-29, 0, 9, 34, -3, -5,-14, 6,-10, -9, + -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3 }, + { -4, 6, 3, 14, 14, -8,-29, 31, 11, 14, -4, -5, -6, 10, 6, -9, + -1,-11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4 }, + { -4, -4, -2, 14, 6,-32, -6,-14, 14, -5,-11, 10,-18, -4, 6, -8, + 9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2,-10, -6,-17, 3, 17 }, + {-16, 9, 21, 19, 4,-20,-17, 14, 9, 15, -6,-17, -1, 1, 6, -3, + 1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2 }, + { -7, -5, 3, 19, 1,-20, -9, 14, 21, -7,-18, -9, 26, -7,-17, -7, + 12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1 }, + {-20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8,-17, 0, 5, + -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1 }, + {-35, 17, 6, 1, -9, -1,-16, 3,-20,-13, 8, 7, -4, -7, -4,-20, + 7, 12, -5, 5, -5,-11, 12, -1, 15, -9, -6, 16, -4, -9,-13, 4 }, + {-21, 36,-19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2, + -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3 }, + {-12, 33, -4, 1,-12, -9, 0,-13, -1, 2, -8, 4,-10, 6,-16, -7, + -1, -4,-10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7 }, + {-14, 32, 5, -7,-15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7, + 4,-10,-10, 10, -1, 2, 0, -2,-11, 5, -3, -4, 2, 2, 7, 4 }, + {-14, 34, 1, 20, -1,-12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7, + -9,-20, -7, -4,-13, 12, 1, 12, 5, -6, 2, -4, 0,-15, 1, 3 }, + {-21, 23, 7, -8, 3,-13, -3, 0, -6, -2, -7, 6,-12, 9, -6, -2, + -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6,-15, 3, -5 }, + {-27, 32, -1, -4, -2, 4,-10, 12, -3, 8, 13, 7, 0,-15, 4, -2, + 3, 5, 7, -4, 9,-12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6 }, + {-17, 29, 15, 0, -1, -4,-10, 13, 12, -1, -8,-10,-10, 4, 7, -2, + 6, -5,-13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4 }, + {-38, 27, 16,-15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6, + -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5 }, + {-33, 40, -4, 2, 1, 0, 0,-10,-14, 0, -7, 4, -1, 3, -2, 5, + 7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4 }, + {-20, 25, 12, -4, 16, -4, 2, 2,-14, -2, -3, 29, -1, 1, 3, 1, + 9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1 }, + {-10, 30, 17, 3, -5, -2, 0, -5,-22, 4, 5, 5, -3,-18, -6, 10, + -5, -7, 2, 8, 7, -7,-11, -2, 0, -3, 3, 2, 11, -4, 4, -4 }, + {-11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4, + -3, 10, 13, 14, 5, -5, 1, 1,-10, 2, 15, 4, 9, -1, -5, -3 }, + {-17, 32, 18,-18, -3, -5, 6, 10, 1,-15, -5, 9, 8,-12,-10, -6, + 11, 9, -5, -8, -7, 10, 5,-10,-14, -4, -3, 1, 9,-11, 2, 1 }, + {-13, 28,-11, -1, 2,-16, -2, 7,-24, 0, 3, 6, 3, -1, -8, -7, + -12, 2, 2,-20, 10, 4, 0,-13, -2, -2, 1, 8,-14, 0, 4, 1 }, + {-14, 23, 12, 8, 8,-26, 2, -4,-14, 13,-14, 15, 3, -9, -1,-13, + -10, -2,-10, 6,-16, 12, 8, 0, 9,-10, -7, -4, -4, 7, -8, 8 }, + {-20, 45, 10,-14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5, + -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1 }, + {-20, 26, -4, 1, 7, 4, -8, 1, -5,-13, 2, 13, -7, -3, 6, -6, + 22, 0, 5, 11, -4,-11, 8, -9, 2, -2, -4, -2, 2,-13, -4, -8 }, + {-28, 18, 17, 3, -8,-23,-16, -6, 5,-10, 14, 10, 5, -1, -8, 4, + -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4 }, + {-12, 32, -6,-16, 18, 12,-16, 0, 7, 13, -4, 5, -8, -1, -3, 4, + 6, -2, -1,-13, 4, -1, 3, 12, -3,-10, 1, 6, 8,-11, -2, 4 }, + {-18, 26, 2, 5, 0, -9,-17, 14, 5, 1, 7, -3, -8, -3, 11, 7, + -5,-12, -8, 7, 0, -7, 2,-12, -9, 13,-11, 9, 6,-11, -5, 11 }, + {-24, 22,-15, -9, 8, 1, -7,-12, -9, 3, 11, 15, 14,-11, 12,-15, + -5, 7, -2, 0, -8, 3, 3, -1, 2, 11,-11, 14, -6, 13, 1, -6 }, + {-20, 28, 18, -4, -6, -5, 12, 14, 2, 10,-13, -6, -8, -6,-13, -1, + -26, 22, -3,-14, 6, 0, 10,-15,-13, -9, 6, -7, 1, -5, -4, -1 }, + {-19, 26, -8, -3,-14, -6, -9, -4, -8, 15, -8, 3,-12, -4, -2, -7, + -5, 3, 13, -3, -4,-25, 4, -1, 5,-12, -1,-13, 5, 2, 0, 6 }, + {-18, 43, 14, -8, 1,-23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3, + -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9 }, + {-11, 30, 10,-14, 3, 1, 10,-11, 1, -7, -4, 14, 2, 1, -9, 1, + -11, -2, -7, 5,-11, 1, 3, 14, 1,-16, -8, 3, -5, 7, -4, 4 }, + {-18, 24, 6, 3, 8, 7,-22, -7, -7, 3, -8, 4, 23, 9, 3, -1, + 3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3 }, + {-15, 38, -7, -1,-11, 2,-17,-24, 24, 8, 7, -4, -5, 2, 2, -7, + 1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3 }, + {-14, 22, 1, -5, 9,-12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3, + -33,-16, -9, -1, 12,-11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4 }, + {-14, 20, 6, 4,-10, -4, -4, -4, 1, -7, 2, 6, 8,-12, 4, 1, + -1, 12, 10, 3,-14,-10, -3, 18, -2, 33, -5,-17, 17, -5, 9, 7 }, + {-12, 23, 13, 0,-11, -8,-11, 12, -5, -9,-16, 11, 6, 4, 12, -5, + 5,-13, 7,-12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11,-12, -3 }, + { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6,-20,-10, 4, 26, + -6, 13, 4, 3, 2,-11, 5, -7,-10, 4, 9, 1, 10, -4, 11, 4 }, + { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3, + -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2 }, + { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5, + 7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5 }, + { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7,-10, -8,-18, + 3, -2, 2, 7,-15,-11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5 }, + { 10, -6, 8, 11, 12, 20, 22,-11, -3, 15, -3, 15, -2, -2, 0, 2, + 5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7 }, + { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2, + 4, -9, -3,-14,-12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0 }, + { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3, + -10, -2, -7, 11,-11,-10, 17, -1, 3,-15, 2, 9,-15,-10, 16, 10 }, + { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6,-13, -1, 6, 5, + -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1 }, + { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2, + -15,-11,-10, -4,-13, -6,-17,-13, -6,-14, 1,-10, 6, 4, -1, -1 }, + { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3, + -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4 }, + { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8,-12, + 9,-10, -7, 1, -1, 19, 0, 2, -8,-11,-10, 9, 6, 11, 0, 3 }, + { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4, + 4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1 }, + { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3,-10, 7, 6, + -8, -7, 2,-13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0 }, + { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5,-14, 8, 0, 9, + 8,-10, 5,-15, -6, -9, 9, -1, 18,-16, 9,-21, -3,-13, -2, 8 }, + { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7, + 4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5,-10, 8, 4, -5 }, + { 9, 2, 16, 14, -5, 14, 1, 0,-21, 17, -1, 9, 12, -3, -3, 4, + -4, 14, 10, 3, 0,-10, 7, 4, 4,-11, 2, 4, -1, -3, 9, -1 }, + { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8,-18,-11, -3, + -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6 }, + { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4,-16, -2, 14, -2, + 1, 8, 12, 14, 3, -3, 8, 8, 12,-15, 3, -3, 3, -2, 14, 10 }, + { 22, -3,-11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2, + -2, 0, -5,-27,-10, 3, -1, 5, 8,-24, -3,-11, -3, 2, 11, -1 }, + { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14,-10, 1,-12,-10, + -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4 }, + { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9,-15, 15, 6, -8, + -10,-13, 5, -8,-20,-13, -6,-11, -1, -3, -6, -4, -1, 0, 13, 15 }, + { -2, -1, 9, 12, 2, 2, 13, 3,-23, 33, 15, 2, -4, -1, 3, 8, + 8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1 }, + { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1,-12, 3, + -13,-18, 2,-11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5 }, + { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5, + 5, -3, -2,-14, 0,-12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1 }, + { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15, + 2, 1, 2,-10,-10, 0, 2, -1, 0, 1,-12, -1, 21, 16, 9, -7 }, + { 11, -4, -5, 24, -7, 11, 20, 11,-15, 18, 5,-13,-15, 0, -5, 9, + 1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3 }, + { 20, 0,-12, -6, 9, 31, 9, 12, 8, 27, 15, 7,-16, 5, -3, -7, + -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2 }, + { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4, + 4, -6, 0, -4, -4, -3, 3, 6, 3,-13, -8, 5, -3, -7, 8, 5 }, + { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1, + 2, 0,-15, -9,-16, -2, 8,-17, -5,-22,-19, -5, -1,-10, 1, -2 }, + { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9, + 9,-11,-17, 0, -6, 16, 0, 1, 9,-24, 3, 3, -9, -3, 3, -2 }, + { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6, + 5, -2, 6, -2, -4, -3, 0, -3, 13,-50, 1, -2, 2, 4, 4, 3 }, + { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1,-15, -1,-15, + -11, -4,-17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12 }, + { 1, -2, 2, -1,-10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0, + 1, 1, 6, 0, 11, 13, 3, 4, 0,-12, 11, -5, 19, 20, 2, 5 }, + { 5, 3,-13, -2, 1,-12, 11, -7,-12, 7, 10, 0, 7, 0, -2, 4, + -6, -9,-11,-12,-23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12 }, + { 6, -3, 2, 5, 2, 2, -2, -5, -8,-11, -4, 3, -8, -4, 5, -3, + -16, -4, 3,-12, -4, 3, 32, 7, 2, 8, 32,-18, -1, 12, 1, 7 }, + { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4,-12, -1, 3, 0, 1,-18, + 8, 8,-14,-10,-11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6 }, + { 3, 5,-14, 7, 14, 8, 20,-13,-16,-10, -2, 17, -7, 4, -8, -9, + 14, -5, 3, -4,-12, 7, 14,-10,-19,-20, 35, 8, 13, 14, -2, 9 }, + { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2, + 3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14 }, + { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6, + -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1 }, + {-11, 1, -3, -3,-11, 3, -9,-25, -1,-16, 4, -8, 15, 1, -2, 7, + 8, 23, 2, 18,-13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4 }, + { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1,-13, 2, 2, 10, 6, 7, + 18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5 }, + { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5, + -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13 }, + { 2, 4, 3, -7, 5, 8,-11, 7, -5, 9,-10, 6, 8,-10, -3, 10, + 1,-29, -4,-26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0 }, + { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0, + 5, -1, -2, -2, -1, -4,-10, 8, 0, -6, 10, -4, 46, 12, 2, 28 }, + { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3, + 1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35,-11, 13, 53, -3, -1 }, + { -5, -2, 0,-13,-16, 5,-12,-11, 1,-30, 3,-18,-24, -8, -5,-19, + 1, -3, -8, 7, -7, -8, 15,-19, 4, 10, 30, 24, 6, 1, -9, 10 }, + { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2, + 22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18,-12, 18, 16, 4, 16 }, + { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6, + 10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11 }, + { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2, + -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0 }, + { 4, -3, -7, -5,-11, -5,-12,-10,-10,-12,-15,-12,-14,-14, 1, 1, + 10,-10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3 }, + { 7, -3, -2, 4, 6, -8, 2, -3,-12, -5, -9, -8,-10, 15, -2, -4, + 8, 9, 7,-13,-18, 34, -5, 7, 12, 22, 16,-11, 13, 25,-15,-11 }, + { -3, -2, 0, -4, 1, 0, -3,-13, -7, 13, 12, -7,-10, 13, 19, 6, + 16, 15,-12,-15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6 }, + { 3, -5, 0, -4, 0, 4,-11, 4, -7, -3, -1, -8, 3, -2, 2, 1, + 11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4 }, + { -1, -4, -9, 5, -8,-18, -4, -9,-20,-18, 7,-14,-16, 3, 8, -3, + 29, 11,-13,-13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5 }, + { -3, 8,-10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8,-14, 15, -5, + 16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13,-11, 1 }, + { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8,-10, + 0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12 }, + { -4, -7,-31, -2, -7, -1, 5, -5, -5,-12, 4, -7, -6, 3, 15, -2, + 5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24 }, + { -7, 0, -3, -6, 1, 3,-13, -6, -4, -4, -5, -9, -1,-10, -4, -8, + 2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6 }, + { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4, + 6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20,-27, 14, 1, 2, -3 }, + { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8, + -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17 }, + { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2,-10, 0, 7, 21, -1, + 0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14,-20, 15, 14, 4, 15 }, + { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9,-10, -2, + -5, 0, -3,-21, 9, 14,-11, 13, 29, 2, 25, 4, 22, -1, 2, -3 }, + { 2, 12,-11, 2, 16, 9, -4, 7, 1,-10,-15, 11, -4, 3, -2, 4, + 4, -5,-10, 1, 4, 19,-15, 6, -4, -2, 30, -7, 11, 21,-12, 5 }, + { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0, + 8, -7, -3, -2, 2, 14, 2, -3,-26, -1, 26, 22, 32, 1, -2, 6 }, + { 1,-38, -1,-20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10, + 6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1,-14, -1, -9, -5, -4 }, + { -5,-26, -7,-19,-10, -5,-11, 5,-11,-25, -8,-14, -9,-16, -8, -6, + -17,-14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3 }, + { 17,-49, -3,-23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4, + -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0 }, + { 4,-34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2,-16, 7, -3, + 8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4 }, + { 5,-29, 13, -2,-14, 3, 1, 18,-15, 4, -8, 8,-10, 8, 2, 1, + -8, 15, 3,-10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6 }, + { 13,-20, 3,-18,-17, 4,-14, 13, 28, 11, -8, -6, 16, 6, 0, 10, + 3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1 }, + { 3,-27, -5,-11,-21,-11,-12, 0, -5, 7,-22, 1, 3, 5, 0, -5, + 8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6 }, + { 31,-45, 0, -1,-12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3, + -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1 }, + { 9,-45, 6, 5, -1,-17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8, + -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7 }, + { 3,-26, -2,-12,-12, 2,-10, 16, -3, 12, 4, 5, 11, 8,-16,-17, + -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7 }, + { 8,-26, 32, -7, -5, 22, 2, 14,-10, -8, -7, 3, 3, 7, 0, -5, + 0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6 }, + { 4,-31, 2,-14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5,-10, + -2,-10, -2,-10, -3, 7, 1, 5, -8, 8,-14, -3,-15, 7,-10, -6 }, + { 16,-27, 13, -4,-23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23,-18, + 7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2 }, + { -1,-35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6,-10, 9, 6, + -3, -5, -6, -3, 9, 16,-16, -9,-20, 12, 3, 5, -3, 1, -9, 4 }, + { 2,-24, 1,-12,-16, 5, -4, 3, -4, -1,-11,-11, -8,-14, 14, 10, + -8, 20, 8, -3,-11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7 }, + { 9,-21, 2,-19, -7, -5, -8, 25, 3, 17, 5, -3, 9,-12, 8, 2, + -4, 3, 3, 1, 11, -9, -4, -3, 4, 3,-22, 6, 4, 6, 11, -5 }, + { 16,-23, 13,-17,-21,-12, 5, 9,-20, 7, 6, -6, 0, 2, -9, 6, + -6,-13, -7, -1, 5, -3, 5, -7,-10, 1, 0, 8, -9, 11, 0, -8 }, + { 10,-26, -9, -7,-19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1, + 6, -7, 1, -8,-11, 10,-14, 0,-16, 6, -3, 5, -1, 14, 12, 1 }, + { 8,-27, 12,-14, -1, -1,-19, 10,-11, 21,-14, 9, -8, -3, 8, -1, + 12,-13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1 }, + { 18,-20,-14,-14,-16, -3,-24, 6,-17, 2, -3,-11, 2, -3, 12, 10, + 10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0 }, + { 0,-30, 9,-16,-18, 15, 12, -3, 4, -4, -5,-11, -4,-12,-10, 0, + 2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7 }, + { 25,-24, -1, -6, -9, 6,-13, -2, 3, 15, -3, 11, 4, -8,-11, 2, + 0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1,-11,-15, -5, 0, 11 }, + { 0,-34, -7,-11, -7, 9, -3, 19, 4, -8, 3,-11, 11, -3, -9, 12, + 9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5 }, + { 6,-34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3,-26,-12, 8, -6, + -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1 }, + { 3,-30, 5, 6,-10, 3, -7, 6, 3, 3,-26,-19, -3, 1, 7, 5, + -4, -5, 6, 10, 13,-10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5 }, + { 4,-24, 9,-19, 2, -4, -5, 8, -3, 2, 0,-15, -1, 9, -4, 22, + 6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3 }, + { 8,-27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7, + 5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13 }, + { 17,-22,-15,-11, -8, 16,-14, 18, 2, -1, 14, -7, 14, -6, -6, -7, + -8, 17, 6, 4, 4, -7, -5, -9,-14, -6, -1, 9, -3, 1, 6, -5 }, + { 25,-30, 2,-12,-13, 18,-18, 16, 8, -3, 10, -8, -3, -1, -6, 3, + -5, -7, 4, 6, 7, 1, 1,-11, -5, 6, 2, -4, 9, -1, -5, -2 }, + { 7,-23, 7,-15, -1, -3, -1, 0,-10, 12, 2, 5, -4, 0, 4, 6, + -1, 5, -9, -1, -1, -7, 1, 17, 9,-17,-16, 8, 4,-14, 11, 14 }, + { 0,-31, 7,-13, 3,-11, -7, 6, 1,-11, 8, -7, 15, -3, 16,-11, + -1,-15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3 }, + { 13,-24, -2,-20,-10, 7, -3, -1, 15, 2, 6, -5, -7,-10,-20, 1, + -4, 14, 8, -2, 3,-13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4 }, + { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0, + -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7,-31,-50 }, + { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0,-20, -6, -3, 9, + -20,-22, -1, -1, 15, 9,-12, 10,-13,-20, 12, 3, 5, 6, -7,-26 }, + { 0, 4, -2,-14,-12, 6,-13, 11,-10, 3, 22, 6, 16, -2, -5, 1, + -3,-11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5,-27 }, + { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4,-15, 14, 1, 3,-10, 5, + 0, -2, 7, 3,-13, 6, 9, -6, 5,-14,-17, -1, 11, 14, -2,-26 }, + { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11, + 9, 19, -2, 14, -8, 7, -1, 3, -3, -3,-10, -2, 12, -2,-12,-29 }, + {-12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1, + 2, -2,-14, 0, -1, -5, 3, 8,-28,-26, 6, -6, 3, 8,-10,-27 }, + { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6, + -1, -4, -1, -5, 8, -1, 5, -5,-15, 11, -8, -5, 14, -6,-14,-29 }, + { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2,-10, 3, 4, + 3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28,-11,-31 }, + { 1, -4,-10, -9, -4, -3,-15, -6, 1, 5, -3, -6, 5, -6,-22, 27, + -13, 5, 3, -7, -4, 20, -7,-12, -1,-24, -4,-13, -8,-11,-15,-21 }, + { -6, -4, 19, -6, 2, 11, -6, 1, -3,-10, 9, -9, 12,-10, 2, 1, + -9, 1, 15, 7, -5, 5,-29,-35, 4,-30, 9, 9, 19, 17, 2,-17 }, + { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2, + -4, -1, 12, 0, 2, -8, -6, -4, 16, -1,-14, -2, 25, -6,-15,-36 }, + { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1, + -3,-13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1,-28 }, + { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2, + 16,-11, 11, 0, 1, 6, 1, 18,-10,-16, -1, -4, 5,-14,-15,-20 }, + { 1,-12, 5, 4, -7, 8, -1,-17, -2, -9,-14,-11, 6, -9, 5, -4, + 3, -2, 7, 18, -5, 5, 6, -1,-11, -2,-10, -3, 8, -3, -2,-32 }, + {-12, 5, 20, -5, -6,-11, -6, -6,-13, 4, -6, 19, -8, 2, 3, -9, + -4, -4, -1, 9, -1, 21, -1, 7, 15,-10, -1, -3, 9, -3, 2,-24 }, + { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8, + 0, -2, -6, 9, -4, 3, 2,-13, 1, -7, 23,-13, 4, -3,-15,-33 }, + { -7, 2,-15, 11,-10, 14, 0,-11, 3, -1, 12, -4, -4, 9, 11,-13, + -13, -3,-14, 1, 3, 6, -5, 8, 0, 5, 5,-10, 4, 5, -6,-30 }, + { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5, + -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3,-19, 37, 12, 10,-40 }, + { -7, 2, -7,-12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5, + 9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2,-24 }, + { -7, 6, 1, 3, 1, 0, 6, 0, 4,-12, -2, -2, 1, -9, 10, -2, + 11, -1, 21,-12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3,-29 }, + { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2, + 3, -5, 2, -1, 6, -4, 0, -3, 8,-11, 19, -8, 22,-34, 13,-35 }, + { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2,-12,-11, 18, + 9, -5, 1, -6, -9, 12, 1, -3, -3, -9,-14, 9, 9, 8, -6,-26 }, + { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4, + 1, 1, 18, 1, 7,-10, 3, -2, 12, -1,-15, 9, 12,-14, 13,-38 }, + { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1, + -7, -1, -4, 13, 7, 0, 1, 2, -1,-16, 0, -2, 1, 8, -8,-28 }, + { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28,-18, + -6, 2, 15,-10,-15,-10, -2, 0, -2, -2, 4, -3, 7, 11, 5,-30 }, + { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3, + -10, 4, 10, 5, 21, -4, 14,-18, 1, 3,-10, -2, 6, 14, -8,-26 }, + {-14, -1, 2, 3, -3, 7, 1,-22, -1, -1, 0, 1, 12,-14, 3, -5, + 0, 10, -3, 1, -5, 12, -3, 10, -8,-22,-11,-13, -7,-10,-13,-25 }, + { -2, -5, -4, -4, -9,-18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8, + 20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0,-17,-23 }, + { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6, + 8, 10, -1, 1, -5, 5,-14, -2,-11, 8, 6, 25, 7, -1, 0,-43 }, + { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2,-10, + -16, -9, 7,-12, 9, -8, 2, 5, -5,-10, -2,-11, -5, -1, -9,-30 }, + { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3,-17, 13, 9, + 0, 7, -6, -5, 9, 1, 5, 4,-10,-18, 0, 14, 11, -4,-16,-28 }, + { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1, + -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6,-70 }, + { 7, 3,-11, -1, 12, -4,-14, 4, 4, -4, 4, -2, 2,-12, -4, 15, + -17, -4, -3, 6, 8, -5, 22,-22, 5,-11, 15, -4, 4, -1,-21, -1 }, + { 10, -2,-13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10, + 8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8,-29, 13 }, + { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0, + 9, -2, 1, -2, 26,-19, 21,-10, 4, 1, -8, 5, 22,-10,-13, 15 }, + { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1, + -8, -5,-13, 13, -2, -3, -1, -9,-28, 4, 2,-11, 18,-20,-24, 9 }, + { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5, + 2,-13,-12, 2, 0, 5, 18, 15,-13, -7, 13,-20, 16,-10,-19, 6 }, + { 5, -8, -1, 5, 10, 2, -1,-10,-11, 23, 8, -5, -8, 4, -5, -4, + -5, -5,-11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17,-12,-22, 3 }, + { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7, + -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5,-24, 13,-20,-27, 14 }, + { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1, + -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24,-43,-13, 2 }, + { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1, + -7, 1, -1, 10, 0, 5, -1,-24, 25,-15, 7, 2, 22,-10,-21, 0 }, + { -5, 2, 6, -2, 13, 3, 5,-12,-11, 16, 6, 10, -5, 0, -3, 6, + 5, -5, -5, 10, 12, 10, 11, -7, 8,-14, 2,-15, 13,-14, -8, -3 }, + { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5, + -12, 3, -3, -6, 2, -1, -5, 14, 11,-20,-21,-25, 24, -1,-10, 6 }, + { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1, + -17,-18, -4,-13, 9, -1, 9, -7, -4, -8, 2, -3, 12,-31,-18, 5 }, + { -7,-11, 6, -8, 4, -3,-12, 0, -1, -6, -3, 0, 5, 9, 7, 2, + 1, -8, -6, 8, 2, -5, 7, -1, 16,-10, 16,-12, 18, -1,-25,-12 }, + { 3,-12, 1, 2, -2,-18, -8,-15,-10, -9, 2, -7, 11,-11, 2, -1, + -1, -1, -9, -6, 3,-14, -2, -1, 2,-13, -7, -9, 19, -5,-17, 2 }, + { 7, 1, -8, 7, 17,-13,-10, 5, 7, 1, -6, 4, 9, -4, 0, 3, + 8, 1,-14, -9, 4, 7, -9, 0, 6, -5,-12, -2, 25, -2,-19, 1 }, + { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5,-17, -4, 4, -1, + 0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2,-18, -2 }, + { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2, + -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0,-13, 4 }, + { 0,-13,-11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2, + 9, -2,-11, 15, 1,-21, 1, -1, 0, 4,-14, -4, 24,-16,-13, 1 }, + { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9,-12, 0, + -1,-14, -9,-14, 0, -2, 19, 4, 6, 4, 4,-11, 8,-17,-19, -5 }, + { -3, 1, 2, 12, -4,-18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12, + -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1,-25, 22, 2,-23, -5 }, + { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2, + 0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3,-25, 4 }, + { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3,-12, 12, 15, -9, -4, 2, + 9, -4,-12, 3, 14, 1, 7,-15, 15, 0, -6,-12, 0, -3,-20, 6 }, + { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1,-18, -4, -6, + -15, -5, 11, 5,-10, -1, 2, 7, 12,-19, -7, 8, 21, -4,-15, 4 }, + { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2,-14,-11, 6, + 2, 17, 8,-13, 26, -2, 5,-15, -4,-14, 12, -9, 13,-21,-23, -4 }, + { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1, + -17,-22, -3, 4, 3, -2, 1, -9, 1, -6, 11,-13, 14, 0,-15, 6 }, + {-16, -4, 17, -2,-20,-11, 11, 10, 5, -8, 16, 2,-17,-14, 11, 11, + -6,-11, -7, 12, 12,-10, -6, 5, 8, -4, -2, -5, 28, 3,-13, 4 }, + { 0, -3, 3, -7, 6, 8,-12, 20,-19, 18,-11, 10, -5, 0, -9, 11, + 3, 0, -2, 9, -7, -5, 18, 3, -2,-16, 1, 6, 12, -7,-16, 1 }, + { 4, 1, 5, -5, 15, 2, -8, 3, 5,-11, 15, -3, 8, -8, -1, 7, + 4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6,-18, 4, 0,-18, 11 }, + { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4, + -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4,-37, 19, 1,-15, -4 }, + { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4, + -10, 2, -6, 4, 4, 1, 27, -7, 17,-34, 5, -9, 15,-16, -7, -5 }, + { -2, 7, 7, -2, 9, -2,-15, 11, 11, 7, 5, 1, 15, 1, -9, 31, + 2,-15, 2, 4, 3, 4, -1, -8, 2, -7, 6,-17, 11,-14,-11, 2 }, + { 1, 1,-11, 9, 9, -6,-14,-11,-10, 8, -3, 11, 16, -9, -8,-13, + -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6,-17, 4 }, + { 14, 5, 4, -6,-12, 10, -7, 8, 21, -8,-30, 15, -2, 1, 11, -9, + -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1 }, + { -1, 2, 20,-17,-15, 3, 3, 7, 11,-17,-13, -6, -3, 18, 17,-15, + -4, -4, -5, 22, 14,-14, -2,-10, -7, 11, 8, -7, -3, 0, -7, 11 }, + { 7,-11, -7, -8,-14, 22, 5, 2, 6, 13,-12, -2, 10, 3, 0,-21, + -4, 20, 3, 10, 21,-10,-12, 8, 11, 2, -5, 2, 1, 3, -1, 15 }, + { -1, -2, -1, -2,-13, 8, -4, 0, 7, -2,-17, 8, 18, 5, 3, 8, + -8, -2, 3, -4, 14,-18,-13, 14, 15,-13, -1, -2, 4, 11, 1, 12 }, + { 13, -6, -4,-16,-17, 16, 21, -2, 5,-11, -9, 19, 21,-17, -3,-17, + 3, 12, 8,-12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4 }, + { 11, 5, 12,-20, -6, 10, 4, 12, 8, -5,-10, 15, 13, 14, 10,-15, + -13, 1, 6, 14, 15,-17,-13, 4, -5, 10, 7, -6, -8, -3, -4, 12 }, + { 25, -1, 7, -5, -7, 11, 1, 17, 13,-15,-14, -4, 5, 3, 8, -3, + -2, 2, 0, 6, 16,-12, -6, -4, 4, -3, 7,-10, -3, -7,-13, 7 }, + { -8, 10, -3,-13, 5, 2, 4, 9, 9,-17,-13, 2, 11, 1, 6, -4, + 8,-10, 4, 1, 19,-15, -4, 12, 31, 7, -5,-17, -4, 9, -2, 7 }, + { 14, -6, -6, -6,-14, 13, 17, -5, 4,-14, -9, 7, 7, -9, 3,-16, + -15, 11, 11, 6, 4,-11,-19, 3, 5, 8, 13,-14,-14, 3, -4, 12 }, + { -2, -4, 10, -4, -7, -1, 27, 5, 2,-16,-18, 4, 12, -2, -3, -2, + -1, 1, -8,-12, 3, -4, 8, 15, 2, 4, 9,-13,-14, 9, -7, 5 }, + { 4, 2,-10, -5, -7, 2, 1, 4, -1, -6,-15, 6, 1, 10, 5,-10, + -9, -1, 13, -3, 5,-21,-11, 8, 8, 5, 27,-21,-18, -5, -1, 15 }, + { 11, 1,-16, -8,-11, 0, 5, -8,-12,-13,-17, 22, 4, -6, -1,-18, + -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9,-17, -5, 4, 4, 10 }, + { 8, -6,-19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1, + 2, 4, 7, 9, 16,-16,-14, 9, -4, 3, 1, 0, -2, 10, -1, -1 }, + { 12, -8, 12, -9, 0, 25, 7, 9, 2,-31, -9, -4, 15, 4, -5, 1, + -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4,-10, -9, 6, 4, 5 }, + { 14, 6,-17, -2, 17, 12, -9, 2, 0,-25,-14, 5, 20, 14, 8,-20, + 5, 2, -2, -3, 9,-13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1 }, + { 8, 4,-15, -3, 10, 18, -4, 13, 8,-22,-10, 9, 19,-15, 7, -5, + -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11 }, + { 4, 1, 4, -5,-10, 18, 7, 2, -4, -9,-11, 0, 32, -7, 4,-16, + -1, 0, 6, 3, 6, -3,-14, 16, 9, -2, 7, -1, 0, -5, 5, -3 }, + { -3, 2, 3, -8, -6, 4, 6, 2, 4,-12,-15, 2, 8, 8, 9, -3, + -18, 6, 34, 11, 12,-15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3 }, + { 18, -6,-12, -8, -1, 15, 20, -4, -1,-11, -5, 6, 6,-11,-15, -7, + 3, 7, 10, 2, 8,-10, -5, 8, 15, -5, 5,-17,-13, 13, 11, 7 }, + { 8, -4, -6, -1,-14, -3, 6, -2, 1, -5, -1, 10, 10,-15, 5, 0, + -10, -4, -3, 7, -4,-19,-15, 27, 11, 18, 3,-19, -2, 6, 0, 12 }, + { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7,-11, 21, 29, 1, -2, 1, + -4,-11, -1, 13, 11,-20, -1, 4, 4, 4, -5, 6,-13, -2, 11, 9 }, + { 2, -7, -7, -3,-10, -1, 20, 12, 1,-19,-19, -1, 5, 4, -7,-25, + 14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1 }, + { 12, -8, 3,-12,-10, 10, 13, 0, 23,-14,-18, 10, 0, 15, 3,-12, + -3, -5, 5, -4, 2,-14,-10, 8, 2, 9, -1,-11, -3, 5, 13, 2 }, + { 9, -6, 7, -7,-30, 17, 6, 13, 1,-14, 0, -1, 6, -9, 8, 3, + -4, 0, -1, -7, -5,-13,-19, -3, -4, 4, -6, -2,-13, 1, -2, 3 }, + { 10, 1, 3,-18,-26, 17, 4,-16, 4, -3,-13, -4, -6,-11, -4,-21, + 7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2 }, + { -3, -1, 0, -2, -2, 0, -1, 3, 4,-14, -8, -9, 13, 2, 50,-23, + -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3 }, + { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5, + 5, 4, 4, -2, 10, -8,-40, -1, 21, 8, 3, -4, -1, 13, 4, 7 }, + { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12,-13, + -9, 0, 1,-12, 9,-43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2 }, + { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7,-23, -5, 23,-17, -6,-15, + -8, 7, 10, -1, 7,-16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4 }, + { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1,-45, + -6, -4, 4, 2, 1,-14,-10, 1, 1, 6, 2, -8, -1, -3, 3, 3 }, + { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6, + 5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0 }, + { -4, 1, -2, -1,-11, 11, 8, -3, -2,-10, 0, 4, 9, 9,-17,-17, + -34, -4, -5, -7, -3,-12, -3, 11, 18, 3, -2, -5,-18, -5, -3, 6 }, + { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3,-10, 12,-18, -5, + -10, 12, -9, 4, -6, 2, 0, 16,-17, 15, 14,-12,-10, -2, -9, -1 }, + { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4,-20, 1, + -25, 1, -8, 13,-10, 8,-19, -1, -8, 10, 6, -9, -1, 0, 12, 4 }, + { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4, + -25, 13,-23, 10, 14, 15,-11, 3,-18, 4, 16, -4, 1,-10,-10, 3 }, + { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1,-12, 14, -7, 11,-15, 6, + -6, 24, -4, 13, -1, 15,-13, 8, 3, 7, -5, 2, 2, 0, 3, -7 }, + { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2,-12, 4, 0, -2, -3, 5, + -6, 0, -8, 9,-10, 4,-28, 12,-20, 11,-13, 7,-18, 1,-11, 1 }, + { 1, -4,-15, 5, 0,-13, -5, 13,-11, 4, -4, -5, 5,-14,-16, 0, + -14, 5,-20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11 }, + { 13,-11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5, + -22, 5,-10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10 }, + { 18, -4,-13, 0, 1,-15, -1, -3, 2, 10, -1, 6, 1, -4,-20, -5, + -8, 6, -8, 17, -5, 5,-10, 8,-22, 6, -5, -2, 8,-17, 8, 2 }, + { 1, -2, -9, 6,-31, -8, -8, 8, 0, 5, -9, -4, 2, 3,-12, 11, + -18, 10, -5, 3,-11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11 }, + { -9, -6, 21, -8,-15, 4,-11, 12,-11, 17, -1, 2, -6, 0,-15, 13, + -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5,-10, -3, 0, 1 }, + { 4, -6, 5,-10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0, + -4, 3, -4, 1,-12, 6,-49, 16,-10, 13, 0, -2, 8, 6, 1, 8 }, + { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13,-14, 6, + -15, -6,-14, 16, 15, 1,-18, -4,-20, 20, -7, -1, -9, -2,-10, 10 }, + {-12, 4, 0, 10, 0, 3, 8, 4,-27, -1, -2, 19, -4, 2,-13, 3, + 1, 9,-12, 1,-22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7 }, + { 4, -5, 11, -6, 17,-17, 5, -4, -2, -6, 1, -5, 2, 4,-14, 6, + -20, 19,-20, 12,-21, 5,-14, 13, -2, 11, 4, -3, 0,-10, -4, -2 }, + { -2, -1, -3, 8, -9, -7,-22, -3,-24, 13, -2, 10,-15, 5, -9, 4, + -7, 0, -5, 15, -8, 11,-13, 6, -4, 19, -8, 12, -4, 6, 9, 7 }, + { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5,-12, 6, + -16, 14,-23, 10,-14, 17,-15, 16, -2, 9,-25, 9,-10, 16, 4, 9 }, + { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3,-11, 25,-10,-28, 27, + -9, 7,-13, 9, -2, 4,-12, -8,-14, 6, 7,-10, 3, 3, -3, 5 }, + { -8, -3, 1,-10, 8, -3, -9, -4, 13, 7, 2, 4,-10, 4, 3, 7, + -18, 2,-22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13 }, + { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0, + -2, -3, 1, 2, -1, 2, -8, -1,-24, 68, -3, 8, 3, 3, -1, -1 }, + {-15, -2, -9, -7, -1, 8,-14, 8, 3, 6, 0, -1, -8, 8,-23, 2, + -14, 17,-15, 8, -4, 7,-18, 0, -8, -3, -1, -4,-10, 4, -1, 4 }, + { 8, 0, 2, -7, 0, 5, 1, 3,-11, 4, -8, 14, 3, 20, 1, 26, + -11, 13,-13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10 }, + { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3, + -15, 7, -9, 22,-19, 8, -9, 4,-23, 13,-14, 6, -6,-14, -4, 7 }, + { 14, -5, -8,-10, 25, 3,-23, -7,-28, 0, -1, -9, 4, 1,-13, 20, + -8, 10,-16, 8, 12,-13,-21, 5,-13, 11, -2, 1, 12, -7, 2,-10 }, + { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2,-18, 7, + -15, 6, -3, 2, 8, 12,-30, 7, -4, 20, 2, 6, 13, -6, -4, 0 }, + { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16,-17, 14,-13, 15,-18, 14, + -15, 17,-12, 14,-13, 7,-16, 13, -9, 5,-11, 10, -9, 6,-12, 13 }, + {-10, -4, 5, 3, 1, 6, 8,-14, -5, 15, 7, 4, 8, 7,-22, 8, + -7, -8,-15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9 }, + { 8, -3, 2, 3, 3, 1, -2, -1,-11, 8, -4, 0, -6, -5, -1, 13, + -37, 9, 1, -6,-10, -2,-10, 11, 8, 13, -3, -2, -6, 8, -4, 13 }, + { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9,-20, 12,-19, 15,-18, 17, + -15, 7, -1, 20,-11, 6, -6, 3, 1, 9, 2,-14, -2, -2, 2, 1 }, + { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9, + -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1 }, + { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8, + -7, 4, 10, 11,-41, 27,-20, 3, -3, 8, 1, 11, -5, -8, 0, 4 }, + { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7, + -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2,-21,-12, -3, -1, 2 }, + { -4, 4, -2, -2, 6, -8, 2, 1,-10, 14, 8, 6, 5, 1, -2, 4, + -13, 4, 2, 5, 10, -2,-21, 32, -3, 18, 9, -6, -9, -9, 10, 2 }, + { 9,-16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19, + -24, -6, -6, -5, -8, -7, 8, -7, -1,-12, 5, -3, 0, 4, 2, -3 }, + { 10, 3,-16, -4, -1, 13, 4, 4, 1, -3, 1, -6,-14, 18, 3, 8, + -8,-28,-16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2 }, + { -5,-13,-22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1, + -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2 }, + { 5,-10,-18, 2, 20, 4, 13,-10, 8,-15,-11, -3, -1, 16, 10, 9, + -8, 6, 7, -5, 6, 11, 5, 17, -4, 7,-11, 5, -3, -6, 2, 1 }, + { 3, -5,-19, 1, 1, -3, -2,-25,-11,-17, 0,-13, -4, 10, 10, 2, + -5, 4, 0, 3, -3, -5,-10, -2, 13,-22, 0, 3,-11, -5, 7, -1 }, + { 12,-14,-29, 6, -1, 10, 7,-17,-12, 14, 3, 9, -9, 9, 7, 6, + -3,-13, 0, 5, 3, -1, -6, -1, 0, 2, 4,-12, -5, -1, 2, 11 }, + { 12,-15, -7, -2,-12, 17, 20,-16, -2,-12, -6, 15, -6, 12, 11, 9, + 7, -6, 7, -4,-19, 6, 2, 2, 3,-11,-10, -4, -5, -3, 3, 2 }, + { 11,-22, -6, 0, 8, 18, 3,-11, -4, -7,-15,-17,-12, 6, 16, 4, + -9, 4, -5, 3, 6,-16, 10, -7, -7, -3, 5, 0, 1,-15, -4, 5 }, + { 12,-22,-16, 5, -6, 8, 12, -4, -9,-17,-11, 3, 5, 8,-17, 0, + 11, -4,-13, -6, 2, -1, -1, 3, 3,-11,-12, -1, 1, 1, 12, -2 }, + { 8,-10,-33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6,-12, + -16, -8, 11, 8,-14, 7, 12, 11, 4,-14, -3, 6, -7, -5, -3, 3 }, + { 0, -8, -7, 2, -4, 24, 2, -9,-11, -3, -7, 11,-12, 17, 1, -1, + 3, -5, -7, 12, 4, 11, 0, 3, 2,-18, -3, 4, 7, -6, 3, 15 }, + { 10,-15,-16, -2, -4, -9, 7,-15, -6, 2,-16, 13, -8, 7, 19,-21, + -4,-12, -9, -3, -3, 6, 11, -3, -1,-19, 3, -7, -9, -4, 3, -6 }, + { -5,-10,-21, 0, -3, -7, 18,-21, 15, -5,-12, -4,-13, 2, 6, -9, + -9,-11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3 }, + { 15, -1,-27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9, + -11,-17, -2, 7, -9, 11, 10, 0, -8, 6,-16, -3, 2, -7, 3, 11 }, + { 4, -9,-39, 19, 6,-13, 13, -5, -5,-15, -2, 9, 0, 4, 14, 6, + -10, -4, -5, 2, -4, -2, 5,-11, 3, 3, -2, -2, -7, 9, 7,-10 }, + { 5,-11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1, + 18,-30, 4, 10, -4, -6, 2,-11, 9,-10, -8, 5, 0, 0, -7, 6 }, + { -1,-16,-10, 11, 0, 13, 12, -4, -4, -5,-21, 12, 4, 13, 14, -7, + 6,-16,-13, 8, 2, 9, 15,-12, 1, -9,-22, 10, -9, 9, 9, -7 }, + { 4,-12,-27, 1, -2, 11, 15, 3, 14,-14, -9, 0, -9, 16, 22, 10, + 16,-10, 5, -5, -9, 1, 1, 6, 6, -4, 2,-17, -5, -6,-15, -1 }, + { 7,-12,-17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17, + -7,-13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9 }, + { 7,-15,-15, -4, 10, 12, 3,-13, 6, 14, 9, -8,-15, 14, 23, -5, + -10, -5, 1, 15,-10, -7, 1, 9, 4,-13,-10, 10, 7, -3, 2, 3 }, + { 4,-10,-14, 0, 3, 4, 0, -9, -3, -4,-11, 2,-17, 8, 2, 15, + 6,-12,-12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10 }, + { -2,-18,-26, 10, -4, 10, 13, 4, -4,-16, -7,-17, -3, 5, -4, 2, + -15,-10, -1, -8, -7, -3, 2, 2, 8,-10, -7, 2, 2, -4, 4, -1 }, + { 4,-19, -5, -1, -1, -6, 2, -8, 10,-16,-28, -6, 8, -1, 11, 28, + 2,-10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1 }, + { -3, -6,-10, -5, 13, 18, 10,-15, -5, -3,-13, 5, 1, 2, 18, -5, + -10,-10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9,-17, 7, 7 }, + { 20,-12, -2, -4, 5, 14, 7,-11, -1,-16, -6, -4,-11, 17, 14, 0, + -8,-10, -8, 10, 3, 5, 10,-16, 3, -8,-14, 10, 3, 9, 0, 3 }, + { 12,-10,-36, 0, 7, 15, 2,-16, 2, -1, 0, -1, 5, 4, 5, -3, + 1,-10, 5, -1,-15, -3,-12, 12, 2, 5, -1, 5, 6, -3, -2, 2 }, + { 17,-15,-31, 23, -4, 15, -2, -3, 6, -7, -5, 1,-12, 4, 6, 8, + -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2 }, + { 6,-18, -5, 12, 10, 12, 14,-11, 15, 2, -9, -6, -5, -2, -9, 4, + -5,-28, -4, 14, 0,-16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4 }, + { -5,-14,-31, 8, 16, 7, 13,-13, 5, 6,-16, 10, -5, 2, -2, 2, + 14, -5, 8, -5, 7,-16, 6,-13, -5, 0, -5, 8, -3, -1, 4, 3 }, + { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28, + -12,-35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3 }, + { 2, -9,-22, 12, 3, 3, -7, -4,-19,-22,-14, -4, -1, 21, 9, -3, + -15,-16,-13, 1,-11, 4, -9, 1, -7, -1, -1, 0, -2, 9,-13, -3 }, + { -1, -3,-23, 0, 2, 12, 3, -9, -4, 7, 3, 9,-10, 1, 27, 28, + 0, 9,-15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6 }, + { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6, + -10,-12, 19, 1, -7, 9, -8, -9,-16,-11, -2, 12, 14, 4, 4, 34 }, + { 17, 7, -6, 1, 4,-10, -5, 4,-11, 3,-18, 4, 14,-13, -3, 1, + 0, 0,-11, 0, 7,-17, -4, 4,-11, -6, -8, 18, 0, 0, 0, 26 }, + { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3, + 7, 4,-12, -8, 0, -9, 8,-22, -5, 0, -6, 22, -2, 11,-13, 24 }, + { -3, 4, 0, 3, 9, 10, -1, 3, -9,-12, 1, -5, 18, 0, -3, 8, + 25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23 }, + { -5, 2, -9, -1, -3, 0, 3, -1,-10, -4, 0,-13, 16, 9, -1,-14, + 2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2,-14, 0, -9, 30 }, + { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7,-11, 14, 14, + 7, 34, -9, 0,-10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29 }, + { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1,-10, 1, + 6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7,-12, 0, -2,-10, 55 }, + { 5, 9, -1, 0, 4, 9,-21, -9, 4, 2, 6, -7, 11, -7, 1, -5, + 0, -4, 2, -3,-13, -8, 0, -9, -4, 2, 16, -2,-15, -7,-11, 31 }, + { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1, + 5, 2, 0, 0, 12, 20,-19, 1, 8,-12,-11, 0, 6, -5, 2, 31 }, + { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2, + -3,-12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30 }, + { -4, 0, -7, 17, 10,-12, -2,-10,-12, -3, 10, 0, 11, -4,-13, -3, + 5, 6, 10, 7, -8, 0, -7,-13, 1, 0, -2, 7,-12, 4, -3, 24 }, + {-13, 9, 4, -2, 2, -4,-14, -1, -3, -5,-10, 4, 13, -2, 5, 13, + 8, 3, -2, 1, 5, -6, 7,-18,-10, 1, -1, 5, 4, 1, 0, 25 }, + { -5, -1, 18, 12, 8, 8,-16, -1, 1, 1, 1, -4, -5, 3, 3, 4, + 4,-11,-12,-16, -6, 2, 12,-13, 0, 9, 7, 9, -9, 0,-10, 24 }, + { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1, + 1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69 }, + { 8, 5, 11, 0,-15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0, + 1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4,-11, -9, 41 }, + { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3, + -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3,-12, 16, 2, 27 }, + { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12, + -1, 10,-11,-11, -7, -4,-14, 7,-14, 13, 22, 18, -1, 0, 14, 28 }, + { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1,-15, 4, -9, + 22,-10, -9, -4, 1, 8, -4, 9,-15, 2, -6, -4,-16, 12,-10, 23 }, + { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1, + 13,-15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5,-11,-14, 23 }, + { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6, + 15, 3, -3, 18,-15, -2, -6, 3, 3,-20, 17, 11, -4, 2, 3, 29 }, + { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7, + -3, -2, -7, -2, -4, 5, 3, -5,-20,-13, -4, 10,-14,-29, 14, 37 }, + { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5, + -4, 4, -4, 4, 4, 3, 1, -4, -4, -9,-14, 20,-30, 3,-18, 33 }, + { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4, + 3, 2, -3, 0, -1, -1,-10, -7, 2, -4,-18, 2,-37, -1, 12, 40 }, + { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9, + 18, 0, 12,-17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26 }, + { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1,-15, 8, 7, -1,-17, -4, + 1, 5, 6,-11, -6, 14, 17, -5,-15, 11, 8, 0, -3,-15, -6, 28 }, + { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2, + 2, -1, -1, -7, 1, 2, -9, 0, -1, -4,-18, 7,-10, 49,-13, 32 }, + { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1, + 2, -5, 2, -7, 17, -2, 10, -5, 0, 2,-15, 3, -9, 7, -9, 30 }, + { -5, -1, 0, 2, 1, -1, 2, 5,-33, 3, -5, 14, 11, 7, 5, -3, + 2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27 }, + { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3, + 4, 2, 1, -7, -4, 1, -3, -4,-35,-25, 17, 10, -3,-26, -7, 32 }, + { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2, + -5, 2, 2, 4, 3, 5, -5,-16,-31,-12,-11, 2,-19, 20, -2, 21 }, + { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2, + 0, -3, 5,-11, -8, -3, -7, -7, 28,-11, -7, 0,-16,-11, -4, 29 }, + { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5,-12, 2, + -2, -5,-22, -2, -1, 11, 8, -7,-12, 0,-34, 6, -5, 11, -8, 19 }, + { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1, + 2, 8, 4, -5, -8, -2, 5,-18, 7, 12, 7, 19,-18, 2, -6,-13 }, + { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6, + -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10,-13, 0, -9,-19 }, + { 12,-10, 2, -2, -2, -1, -3, 6,-12, -5, -2, 14,-16, 4, 12, 12, + 17, 4, 7,-16, 7, -6, 11, 7, 7, 2,-25, 23,-24, 5, -7, -9 }, + { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0, + 1, 2, -4, 2, -3, -8, 0, -1, 9, 9,-10, -3,-29, 1, -1,-27 }, + { 2, 2, 0, 7, 9, -2,-10, -1, -1, 1, -9, -5, 8, 4, 1, 2, + -10, 1, 13, 12, -3, 15, -9, 2, -7, 1,-10, 23,-20,-18, -9,-15 }, + { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7, + -6, 3, -3, -9, 7, 9,-22, 1, 6, -4, 14, 27,-25,-14, 3, -5 }, + { 1, 3, 8, 4, 7, 6, 12,-17,-15, 1, -8,-10, 7,-14, -8, 6, + -2, -2,-11,-11, -7, 13, -2, -2, 4, 5, -5, 13,-23, -6,-17, -8 }, + { -5, 4,-14, -5, -4, -5, 6, 5, -8, -5, -2,-11, -7,-12, 3,-11, + 2, -6, 4,-10, -5, -7, 14, 5, 23, 11, 7, 12,-16, -6, -4,-16 }, + { 5, 6, 2, 5, -2, -5, -5, -6, -5,-19,-13, -1, -3,-13, 5, 0, + 6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17,-12,-27, 3, 0, -1 }, + { 7, -1, 9,-10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4, + 12, 5, 11, 14,-13, -1, 8, 1, 13, 9, 12, 12,-18,-14,-11,-16 }, + { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2, + 2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0,-36, -5, -9,-21 }, + { 14, -6, -9, 0, -1, -8, -8,-11, 2, 2, -9,-12, 12, -4, 5, 3, + -5, -9, 11, -1, -3, 12,-21, -3, 12, 5, 3, 11,-18,-15, 1, -2 }, + { -1, 3, -9, -3, 7, -7,-18, 2, 4, 12,-10, 2, 8, -3,-14, 13, + 17, -5, 5, -9, 13, -3, -7,-18, 17, -2, 5, 7,-20, -3, -6,-11 }, + { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3,-14, -6, -5, -8, 14, -6, + 7, -1, 5, 1, 15, -1, -7, -4, 6,-11, 9, -2,-37, 16, -7, -3 }, + { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12,-10, + 10, 13, 2, 7, -6, 2,-10,-10, 21, -5, 5, 5,-12,-23, 3,-14 }, + { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1, + 8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5,-20,-40, -4,-18,-14 }, + { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5, + 1, 2, -6, 4, -1, -2, -1,-15, 8, 3, 9, 46, -7,-18, 6,-11 }, + { 5, 5, 16, 21, 3,-11, -4, 11,-12, 2, 4,-12, -1, 11, 8, 1, + -4, 11,-11,-21, 1, 1,-11, 3, 13, 1, 5, 12,-25, 1, -3, -2 }, + { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9,-15, 3, -3,-14, 17, 4, + -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6,-29,-17, 8, 4 }, + { -7, -7, 4, 0, 13, 1, 0, 4, 4,-16,-10, -7, 5, 9,-15,-10, + -10, 8, -4, -1,-11, -1,-10,-15, 3, 3, 14, 10,-19, 2,-18,-12 }, + { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9, + 2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11,-24,-44, -9,-15 }, + { -1,-10, 6, 21, 11, 15, -7, 10,-14, -9, -8, -8, 4, 6, 19, 1, + -6, 1, -5,-17, -8,-10, 9, 5, 11, 18, -1, 10,-16, -7, -9, -8 }, + { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4, + -7, 7, 17,-20, 6, 4, 1, -6,-12, 31, 13, 19,-14,-10, -7, -2 }, + { -2, 6,-10, 3, 9, 6,-14, 15, 2, -5, 2,-11, 9, -8, 4, 6, + 20,-15, -3, -3, -1, 32,-21, 6, 1, 9, 11, 17,-19, 6, -1, -3 }, + { 8, 10, -2, 0, -8,-16, 7, 7, 6, 10, 4,-14, 7, -6, 21, -7, + 10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15,-20, -7,-11, 2 }, + { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5,-13, -1, 27, -9, + -6,-11, -7, 1, 11, -4, -4,-14, -2, 11, 6, 10,-19, -6,-15, 2 }, + { 0, 7, -1, 2, -7,-15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5, + -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7,-27, -4, -4,-12 }, + { 11, 1,-16, 6,-15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9, + 5, -3, 3, -2,-11, 3, 9, 6, 9, 3, -1, 12,-41, 8, -6, 9 }, + { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2,-13, 7, -1, -2, + -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1,-47,-21, 7, -6 }, + { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18,-13, 7,-13, -4, 8, 4, + 8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10,-25, -3,-12,-12 }, + { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3, + 2, -2,-17, -6, -4, 1, 33, -6,-20, -6, 8, 31,-26, -8, -1, -4 }, + { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15, + -10, -3,-15, -5, -3, -4, -6,-30, 17, -8, -2, 2,-20, 0, -8, -2 }, + { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4, + 1, 1, -3, 4, 4,-14, 3, 11, -5, 3, -3, 7, -3, 13, 23,-16 }, + { 2, -6, 1, -3, 5, 0, -6,-11, -7, -4, -1, 2, -7, -1, -1, 7, + 1, -2, 6, 12, -6, 8,-13, 17, 25,-23,-19, -7,-12, 9, 16,-17 }, + { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7, + 0, -5, 3,-19, -3, 5, 3, 9, -1, 9,-13, 13,-17, 4, 21,-26 }, + { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2, + -2, 0, 4, -6, 7, -2, 6, 5, -5, 2,-12, 1,-29, 29, 27, 12 }, + { 9,-10,-22, 6, -1, -1, 9,-14,-12, -2, 1, -1, 10,-11,-16, 0, + 3, 11, 13,-14, -9, -2, -1, 6, 4,-14, 0,-10, -2, 16, 17,-11 }, + { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4, + -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1,-47, -3, 50,-17 }, + { 8, -4,-11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2, + -14, 6, 6, 6, 0, 2, -1, 5,-20, 2, -1, 4, -5, 6, 21,-11 }, + { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7, + 4, 7,-12, -9, -2, 10, -6, 13, 6, 5, 20, 2,-15, 9, 28, -7 }, + { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2, + 6, 16,-14, 9,-14, -2, -8,-27, -3, 18, -1, -7, -3, 8, 23,-23 }, + { 1, 4, -9, -1, -5, 10, -2, 1,-11, 1, -9, 4, 7, 14, -9, -2, + -3, 2, -5, -1, -6,-10, -7, 11, 20, 2, 3,-19, 3, 15, 30, -9 }, + { 7, 2,-14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6,-11, + -14, 1, 10, -1, -7, -8, 1, 10, 3, -6,-15,-12,-17, 4, 30, -6 }, + { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4, + 4, -4, -2, -5, -2, 2, -1, -2, 0, -2,-11, -7, -3, 42, 24,-14 }, + { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4, + -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24,-13,-28, 20, 15,-22 }, + { -3, 7, 6, 3, -2, -5,-10, -2, -2, -1, -6, -6, -2,-14,-16, -6, + -5, 0, 18, 0, 9, 1, 7,-13, -5, -6, -9, 11,-15, 9, 22,-11 }, + { 9, -2, 6, 5, 2, 9,-10, 1, 1, 5, -4, 12, 2, 2,-10, -7, + -4, -6, 7, 9, 6, 15, 6, 6,-10, 10, 5,-13, -5, 6, 24,-12 }, + { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6, + -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22,-17 }, + { -2, -2, 3, 10, 9, 9, 12,-15, -1,-11,-13, 3, -2, 1, -3,-11, + 7, 9, 16, -3,-10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31,-12 }, + { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3, + -13, -6, 15, 20, -9, -3,-12, 1, -2,-16, 8, 8, -1, 16, 22, -5 }, + { 5, -3,-15, -2, 12, -8, 8, -5, 2, -8, 20,-18, 14, -4, 3, 3, + 7,-13,-16, 1,-10, 7, 16, 7, 4,-14, -4, -5, -9, 8, 23, -6 }, + { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6,-10, -2, 6, + 9,-17,-14, 11, 12, -3,-13, -7, 2, 18, 3,-25,-16, 18, 22, -5 }, + { 5, 6, -7,-20, -4, 2, 8, 4,-24, -4, 1, 4, -5, -2, 1,-10, + -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21,-11 }, + { 0, 7, -1, 14, -6, -4,-10, 5, 4, 4, 4, -5, 3, 4, -1, -7, + 8,-19, 0, 6, 2, 3,-18, -3, -6, 2, 8, 14,-26, 22, 27,-13 }, + { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14, + 6, -5, 6, -4, -7, 7,-21, 8, 1, 8, -9, -4, -3, 11, 25,-13 }, + { 4, 4, -1, -6, 4, 9, -8, 1, -3,-10, -2, 0, 15, -9,-16, 11, + 1, 1, 6, 3, -9, -5, 16, 26, 1,-14, 1, -3,-14, 7, 15, -9 }, + {-12, -2, -9,-13, 2, 6, 14, 0, 1, 0, -1,-13, 0, 10, -1, 6, + 9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7,-22, -2, 29, -7 }, + { 2, 4, 13,-12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10, + 15, -6, -1,-11,-30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25,-16 }, + { 7,-15, -7, -7, -1, -5, -5,-11,-20, 10, 3,-10, -3, 5, 20, -4, + 0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1,-12, -3, 15, 22,-16 }, + { 4, -1, 3, 4, -5, 0, -1, -5,-24,-29, 4, -9, 1, -3, 0, 0, + 0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5,-10, 3, 25,-10 }, + { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2, + 1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1,-11, 7, 46,-46 }, + { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4,-10, + 13, 1, 3, -6, 4, -4, 7, 2,-19,-25, -3,-16,-12, 16, 20, -1 }, + { 18, 6, 4,-12, 0,-14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2, + 7, 0, 2, 5,-11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8 }, + { 5, 0, -6, 5, 6, 3, 3,-10, -5, 1, -1, 4, 3,-11, -8, 5, + 4, -5, 5, -5, -7, -5, 11, 5, 20, -8,-16, 21, -4, 27, 23, -5 } }; From d08928bbea2b495596c2d3bc7df3cfb3e3b2b7e3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 21 Jan 2011 13:53:46 +0000 Subject: [PATCH 023/528] Split mp3 demuxer and muxer into separate files. Signed-off-by: Mans Rullgard --- libavformat/Makefile | 6 +- libavformat/{mp3.c => mp3dec.c} | 178 +---------------------------- libavformat/mp3enc.c | 194 ++++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+), 180 deletions(-) rename libavformat/{mp3.c => mp3dec.c} (53%) create mode 100644 libavformat/mp3enc.c diff --git a/libavformat/Makefile b/libavformat/Makefile index d3c849ab69..dd13bb45b2 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -129,9 +129,9 @@ 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_MP2_MUXER) += mp3enc.o +OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o +OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o OBJS-$(CONFIG_MPC_DEMUXER) += mpc.o apetag.o OBJS-$(CONFIG_MPC8_DEMUXER) += mpc8.o OBJS-$(CONFIG_MPEG1SYSTEM_MUXER) += mpegenc.o diff --git a/libavformat/mp3.c b/libavformat/mp3dec.c similarity index 53% rename from libavformat/mp3.c rename to libavformat/mp3dec.c index e70a120601..ab6aabe0b5 100644 --- a/libavformat/mp3.c +++ b/libavformat/mp3dec.c @@ -1,5 +1,5 @@ /* - * MP3 muxer and demuxer + * MP3 demuxer * Copyright (c) 2003 Fabrice Bellard * * This file is part of FFmpeg. @@ -19,16 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "avformat.h" #include "id3v2.h" #include "id3v1.h" - -#if CONFIG_MP3_DEMUXER - -#include "libavcodec/mpegaudio.h" #include "libavcodec/mpegaudiodecheader.h" /* mp3 read */ @@ -195,174 +190,3 @@ AVInputFormat mp3_demuxer = { .flags= AVFMT_GENERIC_INDEX, .extensions = "mp2,mp3,m2a", /* XXX: use probe */ }; -#endif - -#if CONFIG_MP2_MUXER || CONFIG_MP3_MUXER -static int id3v1_set_string(AVFormatContext *s, const char *key, - uint8_t *buf, int buf_size) -{ - AVMetadataTag *tag; - if ((tag = av_metadata_get(s->metadata, key, NULL, 0))) - strncpy(buf, tag->value, buf_size); - return !!tag; -} - -static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) -{ - AVMetadataTag *tag; - int i, count = 0; - - memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */ - buf[0] = 'T'; - buf[1] = 'A'; - buf[2] = 'G'; - count += id3v1_set_string(s, "TIT2", buf + 3, 30); //title - count += id3v1_set_string(s, "TPE1", buf + 33, 30); //author|artist - count += id3v1_set_string(s, "TALB", buf + 63, 30); //album - count += id3v1_set_string(s, "TDRL", buf + 93, 4); //date - count += id3v1_set_string(s, "comment", buf + 97, 30); - if ((tag = av_metadata_get(s->metadata, "TRCK", NULL, 0))) { //track - buf[125] = 0; - buf[126] = atoi(tag->value); - count++; - } - buf[127] = 0xFF; /* default to unknown genre */ - if ((tag = av_metadata_get(s->metadata, "TCON", NULL, 0))) { //genre - for(i = 0; i <= ID3v1_GENRE_MAX; i++) { - if (!strcasecmp(tag->value, ff_id3v1_genre_str[i])) { - buf[127] = i; - count++; - break; - } - } - } - return count; -} - -/* simple formats */ - -static void id3v2_put_size(AVFormatContext *s, int size) -{ - put_byte(s->pb, size >> 21 & 0x7f); - put_byte(s->pb, size >> 14 & 0x7f); - put_byte(s->pb, size >> 7 & 0x7f); - put_byte(s->pb, size & 0x7f); -} - -static void id3v2_put_ttag(AVFormatContext *s, const char *buf, int len, - uint32_t tag) -{ - put_be32(s->pb, tag); - id3v2_put_size(s, len + 1); - put_be16(s->pb, 0); - put_byte(s->pb, 3); /* UTF-8 */ - put_buffer(s->pb, buf, len); -} - - -static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt) -{ - put_buffer(s->pb, pkt->data, pkt->size); - put_flush_packet(s->pb); - return 0; -} - -static int mp3_write_trailer(struct AVFormatContext *s) -{ - uint8_t buf[ID3v1_TAG_SIZE]; - - /* write the id3v1 tag */ - if (id3v1_create_tag(s, buf) > 0) { - put_buffer(s->pb, buf, ID3v1_TAG_SIZE); - put_flush_packet(s->pb); - } - return 0; -} -#endif /* CONFIG_MP2_MUXER || CONFIG_MP3_MUXER */ - -#if CONFIG_MP2_MUXER -AVOutputFormat mp2_muxer = { - "mp2", - NULL_IF_CONFIG_SMALL("MPEG audio layer 2"), - "audio/x-mpeg", - "mp2,m2a", - 0, - CODEC_ID_MP2, - CODEC_ID_NONE, - NULL, - mp3_write_packet, - mp3_write_trailer, -}; -#endif - -#if CONFIG_MP3_MUXER -/** - * Write an ID3v2.4 header at beginning of stream - */ - -static int mp3_write_header(struct AVFormatContext *s) -{ - AVMetadataTag *t = NULL; - int totlen = 0; - int64_t size_pos, cur_pos; - - put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */ - put_byte(s->pb, 0); - put_byte(s->pb, 0); /* flags */ - - /* reserve space for size */ - 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; - - if (t->key[0] == 'T' && strlen(t->key) == 4) { - int i; - for (i = 0; *ff_id3v2_tags[i]; i++) - if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) { - int len = strlen(t->value); - tag = AV_RB32(t->key); - totlen += len + ID3v2_HEADER_SIZE + 2; - id3v2_put_ttag(s, t->value, len + 1, tag); - break; - } - } - - if (!tag) { /* unknown tag, write as TXXX frame */ - int len = strlen(t->key), len1 = strlen(t->value); - char *buf = av_malloc(len + len1 + 2); - if (!buf) - return AVERROR(ENOMEM); - tag = MKBETAG('T', 'X', 'X', 'X'); - strcpy(buf, t->key); - strcpy(buf + len + 1, t->value); - id3v2_put_ttag(s, buf, len + len1 + 2, tag); - totlen += len + len1 + ID3v2_HEADER_SIZE + 3; - av_free(buf); - } - } - - cur_pos = url_ftell(s->pb); - url_fseek(s->pb, size_pos, SEEK_SET); - id3v2_put_size(s, totlen); - url_fseek(s->pb, cur_pos, SEEK_SET); - - return 0; -} - -AVOutputFormat mp3_muxer = { - "mp3", - NULL_IF_CONFIG_SMALL("MPEG audio layer 3"), - "audio/x-mpeg", - "mp3", - 0, - CODEC_ID_MP3, - CODEC_ID_NONE, - mp3_write_header, - mp3_write_packet, - mp3_write_trailer, - AVFMT_NOTIMESTAMPS, -}; -#endif diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c new file mode 100644 index 0000000000..b4fb876814 --- /dev/null +++ b/libavformat/mp3enc.c @@ -0,0 +1,194 @@ +/* + * MP3 muxer + * 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 +#include "avformat.h" +#include "id3v1.h" +#include "id3v2.h" +#include "libavutil/intreadwrite.h" + +static int id3v1_set_string(AVFormatContext *s, const char *key, + uint8_t *buf, int buf_size) +{ + AVMetadataTag *tag; + if ((tag = av_metadata_get(s->metadata, key, NULL, 0))) + strncpy(buf, tag->value, buf_size); + return !!tag; +} + +static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) +{ + AVMetadataTag *tag; + int i, count = 0; + + memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */ + buf[0] = 'T'; + buf[1] = 'A'; + buf[2] = 'G'; + count += id3v1_set_string(s, "TIT2", buf + 3, 30); //title + count += id3v1_set_string(s, "TPE1", buf + 33, 30); //author|artist + count += id3v1_set_string(s, "TALB", buf + 63, 30); //album + count += id3v1_set_string(s, "TDRL", buf + 93, 4); //date + count += id3v1_set_string(s, "comment", buf + 97, 30); + if ((tag = av_metadata_get(s->metadata, "TRCK", NULL, 0))) { //track + buf[125] = 0; + buf[126] = atoi(tag->value); + count++; + } + buf[127] = 0xFF; /* default to unknown genre */ + if ((tag = av_metadata_get(s->metadata, "TCON", NULL, 0))) { //genre + for(i = 0; i <= ID3v1_GENRE_MAX; i++) { + if (!strcasecmp(tag->value, ff_id3v1_genre_str[i])) { + buf[127] = i; + count++; + break; + } + } + } + return count; +} + +/* simple formats */ + +static void id3v2_put_size(AVFormatContext *s, int size) +{ + put_byte(s->pb, size >> 21 & 0x7f); + put_byte(s->pb, size >> 14 & 0x7f); + put_byte(s->pb, size >> 7 & 0x7f); + put_byte(s->pb, size & 0x7f); +} + +static void id3v2_put_ttag(AVFormatContext *s, const char *buf, int len, + uint32_t tag) +{ + put_be32(s->pb, tag); + id3v2_put_size(s, len + 1); + put_be16(s->pb, 0); + put_byte(s->pb, 3); /* UTF-8 */ + put_buffer(s->pb, buf, len); +} + + +static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt) +{ + put_buffer(s->pb, pkt->data, pkt->size); + put_flush_packet(s->pb); + return 0; +} + +static int mp3_write_trailer(struct AVFormatContext *s) +{ + uint8_t buf[ID3v1_TAG_SIZE]; + + /* write the id3v1 tag */ + if (id3v1_create_tag(s, buf) > 0) { + put_buffer(s->pb, buf, ID3v1_TAG_SIZE); + put_flush_packet(s->pb); + } + return 0; +} + +#if CONFIG_MP2_MUXER +AVOutputFormat mp2_muxer = { + "mp2", + NULL_IF_CONFIG_SMALL("MPEG audio layer 2"), + "audio/x-mpeg", + "mp2,m2a", + 0, + CODEC_ID_MP2, + CODEC_ID_NONE, + NULL, + mp3_write_packet, + mp3_write_trailer, +}; +#endif + +#if CONFIG_MP3_MUXER +/** + * Write an ID3v2.4 header at beginning of stream + */ + +static int mp3_write_header(struct AVFormatContext *s) +{ + AVMetadataTag *t = NULL; + int totlen = 0; + int64_t size_pos, cur_pos; + + put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */ + put_byte(s->pb, 0); + put_byte(s->pb, 0); /* flags */ + + /* reserve space for size */ + 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; + + if (t->key[0] == 'T' && strlen(t->key) == 4) { + int i; + for (i = 0; *ff_id3v2_tags[i]; i++) + if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) { + int len = strlen(t->value); + tag = AV_RB32(t->key); + totlen += len + ID3v2_HEADER_SIZE + 2; + id3v2_put_ttag(s, t->value, len + 1, tag); + break; + } + } + + if (!tag) { /* unknown tag, write as TXXX frame */ + int len = strlen(t->key), len1 = strlen(t->value); + char *buf = av_malloc(len + len1 + 2); + if (!buf) + return AVERROR(ENOMEM); + tag = MKBETAG('T', 'X', 'X', 'X'); + strcpy(buf, t->key); + strcpy(buf + len + 1, t->value); + id3v2_put_ttag(s, buf, len + len1 + 2, tag); + totlen += len + len1 + ID3v2_HEADER_SIZE + 3; + av_free(buf); + } + } + + cur_pos = url_ftell(s->pb); + url_fseek(s->pb, size_pos, SEEK_SET); + id3v2_put_size(s, totlen); + url_fseek(s->pb, cur_pos, SEEK_SET); + + return 0; +} + +AVOutputFormat mp3_muxer = { + "mp3", + NULL_IF_CONFIG_SMALL("MPEG audio layer 3"), + "audio/x-mpeg", + "mp3", + 0, + CODEC_ID_MP3, + CODEC_ID_NONE, + mp3_write_header, + mp3_write_packet, + mp3_write_trailer, + AVFMT_NOTIMESTAMPS, +}; +#endif From 583fcb528cb13b271860529a464abc6304e063e3 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 20 Jan 2011 02:04:19 +0000 Subject: [PATCH 024/528] Makefile: simplify setting of some variables Signed-off-by: Mans Rullgard --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d158507b5f..98ec5f5b47 100644 --- a/Makefile +++ b/Makefile @@ -9,20 +9,20 @@ PROGS-$(CONFIG_FFPLAY) += ffplay PROGS-$(CONFIG_FFPROBE) += ffprobe PROGS-$(CONFIG_FFSERVER) += ffserver -PROGS := $(addsuffix $(EXESUF), $(PROGS-yes)) -PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes)) -OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o -MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes))) -PODPAGES = $(addprefix doc/, $(addsuffix .pod, $(PROGS-yes))) -HTMLPAGES = $(addprefix doc/, $(addsuffix .html, $(PROGS-yes))) +PROGS := $(PROGS-yes:%=%$(EXESUF)) +PROGS_G = $(PROGS-yes:%=%_g$(EXESUF)) +OBJS = $(PROGS-yes:%=%.o) cmdutils.o +MANPAGES = $(PROGS-yes:%=doc/%.1) +PODPAGES = $(PROGS-yes:%=doc/%.pod) +HTMLPAGES = $(PROGS-yes:%=doc/%.html) TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher)) HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr base64) BASENAMES = ffmpeg ffplay ffprobe ffserver -ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES)) -ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES)) -ALLMANPAGES = $(addsuffix .1, $(BASENAMES)) -ALLHTMLPAGES= $(addsuffix .html, $(BASENAMES)) +ALLPROGS = $(BASENAMES:%=%$(EXESUF)) +ALLPROGS_G = $(BASENAMES:%=_g$(EXESUF)) +ALLMANPAGES = $(BASENAMES:%=%.1) +ALLHTMLPAGES= $(BASENAMES:%=%.html) FFLIBS-$(CONFIG_AVDEVICE) += avdevice FFLIBS-$(CONFIG_AVFILTER) += avfilter From c2dd0e9eba1dfcba42c5c72654b7aac7f5935d3b Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 21 Jan 2011 18:12:17 +0000 Subject: [PATCH 025/528] Make demuxers auto-select parsers they need This makes configure --disable-everything --enable-demuxer=foo work as expected. Signed-off-by: Mans Rullgard --- configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 441d77eeed..aa05979791 100755 --- a/configure +++ b/configure @@ -1352,19 +1352,19 @@ libxavs_encoder_deps="libxavs" libxvid_encoder_deps="libxvid" # demuxers / muxers -ac3_demuxer_deps="ac3_parser" +ac3_demuxer_select="ac3_parser" asf_stream_muxer_select="asf_muxer" avisynth_demuxer_deps="avisynth" -dirac_demuxer_deps="dirac_parser" +dirac_demuxer_select="dirac_parser" eac3_demuxer_select="ac3_parser" -flac_demuxer_deps="flac_parser" +flac_demuxer_select="flac_parser" ipod_muxer_select="mov_muxer" libnut_demuxer_deps="libnut" libnut_muxer_deps="libnut" matroska_audio_muxer_select="matroska_muxer" matroska_demuxer_suggest="zlib bzlib" mov_demuxer_suggest="zlib" -mp3_demuxer_deps="mpegaudio_parser" +mp3_demuxer_select="mpegaudio_parser" mp4_muxer_select="mov_muxer" mpegtsraw_demuxer_select="mpegts_demuxer" mxf_d10_muxer_select="mxf_muxer" From d66eff36852975129ae499c56de4340e48b9b7b4 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 19 Jan 2011 10:13:25 +0100 Subject: [PATCH 026/528] id3v2: use an enum for encodings instead of magic numbers. Signed-off-by: Mans Rullgard --- libavformat/id3v2.c | 8 ++++---- libavformat/id3v2.h | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 95ec0b05cb..62eee15591 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -74,7 +74,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c switch (get_byte(pb)) { /* encoding type */ - case 0: /* ISO-8859-1 (0 - 255 maps directly into unicode) */ + case ID3v2_ENCODING_ISO8859: q = dst; while (taglen-- && q - dst < dstlen - 7) { uint8_t tmp; @@ -83,7 +83,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c *q = 0; break; - case 1: /* UTF-16 with BOM */ + case ID3v2_ENCODING_UTF16BOM: taglen -= 2; switch (get_be16(pb)) { case 0xfffe: @@ -96,7 +96,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c } // fall-through - case 2: /* UTF-16BE without BOM */ + case ID3v2_ENCODING_UTF16BE: q = dst; while (taglen > 1 && q - dst < dstlen - 7) { uint32_t ch; @@ -108,7 +108,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c *q = 0; break; - case 3: /* UTF-8 */ + case ID3v2_ENCODING_UTF8: len = FFMIN(taglen, dstlen); get_buffer(pb, dst, len); dst[len] = 0; diff --git a/libavformat/id3v2.h b/libavformat/id3v2.h index 25ee53e9b8..c2e1add849 100644 --- a/libavformat/id3v2.h +++ b/libavformat/id3v2.h @@ -38,6 +38,13 @@ #define ID3v2_FLAG_ENCRYPTION 0x0004 #define ID3v2_FLAG_COMPRESSION 0x0008 +enum ID3v2Encoding { + ID3v2_ENCODING_ISO8859 = 0, + ID3v2_ENCODING_UTF16BOM = 1, + ID3v2_ENCODING_UTF16BE = 2, + ID3v2_ENCODING_UTF8 = 3, +}; + /** * Detect ID3v2 Header. * @param buf must be ID3v2_HEADER_SIZE byte long From 50196a982bf7c8be9b41053fa0975473c217e709 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 21 Jan 2011 19:18:06 +0000 Subject: [PATCH 027/528] lavf: move the version macros to a new header Signed-off-by: Mans Rullgard --- libavformat/Makefile | 2 +- libavformat/avformat.h | 64 +----------------------------- libavformat/avio.h | 2 + libavformat/version.h | 90 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 64 deletions(-) create mode 100644 libavformat/version.h diff --git a/libavformat/Makefile b/libavformat/Makefile index dd13bb45b2..8f583e040d 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -3,7 +3,7 @@ include $(SUBDIR)../config.mak NAME = avformat FFLIBS = avcodec avcore avutil -HEADERS = avformat.h avio.h +HEADERS = avformat.h avio.h version.h OBJS = allformats.o \ cutils.o \ diff --git a/libavformat/avformat.h b/libavformat/avformat.h index c72c58f0fe..f9f9be5b02 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -21,69 +21,6 @@ #ifndef AVFORMAT_AVFORMAT_H #define AVFORMAT_AVFORMAT_H -#define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 94 -#define LIBAVFORMAT_VERSION_MICRO 0 - -#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ - LIBAVFORMAT_VERSION_MINOR, \ - LIBAVFORMAT_VERSION_MICRO) -#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ - LIBAVFORMAT_VERSION_MINOR, \ - LIBAVFORMAT_VERSION_MICRO) -#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT - -#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 @@ -106,6 +43,7 @@ const char *avformat_license(void); #include "libavcodec/avcodec.h" #include "avio.h" +#include "libavformat/version.h" struct AVFormatContext; diff --git a/libavformat/avio.h b/libavformat/avio.h index e65f712623..198507e4a8 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -33,6 +33,8 @@ #include "libavutil/common.h" #include "libavutil/log.h" +#include "libavformat/version.h" + /* unbuffered I/O */ /** diff --git a/libavformat/version.h b/libavformat/version.h new file mode 100644 index 0000000000..8cea555c61 --- /dev/null +++ b/libavformat/version.h @@ -0,0 +1,90 @@ +/* + * Version macros. + * + * 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_VERSION_H +#define AVFORMAT_VERSION_H + +#include "libavutil/avutil.h" + +#define LIBAVFORMAT_VERSION_MAJOR 52 +#define LIBAVFORMAT_VERSION_MINOR 94 +#define LIBAVFORMAT_VERSION_MICRO 0 + +#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT + +#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 + +#endif //AVFORMAT_VERSION_H From 56f8952b252f85281317ecd3e0b04c4cae93fd72 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 21 Jan 2011 00:11:44 +0000 Subject: [PATCH 028/528] Move lpc_compute_autocorr() from DSPContext to a new struct LPCContext. Signed-off-by: Mans Rullgard --- libavcodec/alacenc.c | 14 +++++++------- libavcodec/arm/asm-offsets.h | 12 ++++++------ libavcodec/dsputil.c | 4 ---- libavcodec/dsputil.h | 2 -- libavcodec/flacenc.c | 7 +++---- libavcodec/lpc.c | 13 ++++++++++--- libavcodec/lpc.h | 24 +++++++++++++++++++++--- libavcodec/ra144.h | 4 ++-- libavcodec/ra144enc.c | 5 ++--- libavcodec/x86/dsputil_mmx.h | 3 --- libavcodec/x86/dsputilenc_mmx.c | 4 ---- libavcodec/x86/lpc_mmx.c | 14 ++++++++++++-- 12 files changed, 63 insertions(+), 43 deletions(-) diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index d1369c4859..5706ae9f4d 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -51,11 +51,11 @@ typedef struct RiceContext { int rice_modifier; } RiceContext; -typedef struct LPCContext { +typedef struct AlacLPCContext { int lpc_order; int lpc_coeff[ALAC_MAX_LPC_ORDER+1]; int lpc_quant; -} LPCContext; +} AlacLPCContext; typedef struct AlacEncodeContext { int compression_level; @@ -69,8 +69,8 @@ typedef struct AlacEncodeContext { int interlacing_leftweight; PutBitContext pbctx; RiceContext rc; - LPCContext lpc[MAX_CHANNELS]; - DSPContext dspctx; + AlacLPCContext lpc[MAX_CHANNELS]; + LPCContext lpc_ctx; AVCodecContext *avctx; } AlacEncodeContext; @@ -141,7 +141,7 @@ static void calc_predictor_params(AlacEncodeContext *s, int ch) s->lpc[ch].lpc_coeff[4] = 80; s->lpc[ch].lpc_coeff[5] = -25; } else { - opt_order = ff_lpc_calc_coefs(&s->dspctx, s->sample_buf[ch], + opt_order = ff_lpc_calc_coefs(&s->lpc_ctx, s->sample_buf[ch], s->avctx->frame_size, s->min_prediction_order, s->max_prediction_order, @@ -237,7 +237,7 @@ static void alac_stereo_decorrelation(AlacEncodeContext *s) static void alac_linear_predictor(AlacEncodeContext *s, int ch) { int i; - LPCContext lpc = s->lpc[ch]; + AlacLPCContext lpc = s->lpc[ch]; if(lpc.lpc_order == 31) { s->predictor_buf[0] = s->sample_buf[ch][0]; @@ -455,7 +455,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx) avctx->coded_frame->key_frame = 1; s->avctx = avctx; - dsputil_init(&s->dspctx, avctx); + ff_lpc_init(&s->lpc_ctx); return 0; } diff --git a/libavcodec/arm/asm-offsets.h b/libavcodec/arm/asm-offsets.h index 174b5aadcb..f616f808f1 100644 --- a/libavcodec/arm/asm-offsets.h +++ b/libavcodec/arm/asm-offsets.h @@ -33,16 +33,16 @@ #define Y_DC_SCALE 0xab4 #define C_DC_SCALE 0xab8 #define AC_PRED 0xae0 -#define BLOCK_LAST_INDEX 0x21c0 -#define INTER_SCANTAB_RASTER_END 0x23c0 -#define H263_AIC 0x2670 +#define BLOCK_LAST_INDEX 0x21bc +#define INTER_SCANTAB_RASTER_END 0x23bc +#define H263_AIC 0x2668 #elif defined(__APPLE__) #define Y_DC_SCALE 0xa70 #define C_DC_SCALE 0xa74 #define AC_PRED 0xa9c -#define BLOCK_LAST_INDEX 0x217c -#define INTER_SCANTAB_RASTER_END 0x237c -#define H263_AIC 0x2620 +#define BLOCK_LAST_INDEX 0x2178 +#define INTER_SCANTAB_RASTER_END 0x2378 +#define H263_AIC 0x261c #endif #endif diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index cc60524107..57b2640686 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -36,7 +36,6 @@ #include "mathops.h" #include "mpegvideo.h" #include "config.h" -#include "lpc.h" #include "ac3dec.h" #include "vorbis.h" #include "png.h" @@ -4430,9 +4429,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) #endif #if CONFIG_AC3_DECODER c->ac3_downmix = ff_ac3_downmix_c; -#endif -#if CONFIG_LPC - c->lpc_compute_autocorr = ff_lpc_compute_autocorr; #endif c->vector_fmul = vector_fmul_c; c->vector_fmul_reverse = vector_fmul_reverse_c; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 0efbad918a..c619b78529 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -374,8 +374,6 @@ typedef struct DSPContext { /* 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); - /* no alignment needed */ - void (*lpc_compute_autocorr)(const int32_t *data, int len, int lag, double *autoc); /* assume len is a multiple of 8, and arrays are 16-byte aligned */ void (*vector_fmul)(float *dst, const float *src, int len); void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len); diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 272d446b29..d6f0f87376 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -23,7 +23,6 @@ #include "libavutil/md5.h" #include "avcodec.h" #include "get_bits.h" -#include "dsputil.h" #include "golomb.h" #include "lpc.h" #include "flac.h" @@ -95,7 +94,7 @@ typedef struct FlacEncodeContext { FlacFrame frame; CompressionOptions options; AVCodecContext *avctx; - DSPContext dsp; + LPCContext lpc_ctx; struct AVMD5 *md5ctx; } FlacEncodeContext; @@ -217,7 +216,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) s->avctx = avctx; - dsputil_init(&s->dsp, avctx); + ff_lpc_init(&s->lpc_ctx); if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) return -1; @@ -902,7 +901,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch) /* LPC */ sub->type = FLAC_SUBFRAME_LPC; - opt_order = ff_lpc_calc_coefs(&s->dsp, smp, n, min_order, max_order, + opt_order = ff_lpc_calc_coefs(&s->lpc_ctx, smp, n, min_order, max_order, s->options.lpc_coeff_precision, coefs, shift, s->options.lpc_type, s->options.lpc_passes, omethod, MAX_LPC_SHIFT, 0); diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index 112a78d4b9..3a93c9f673 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -20,7 +20,6 @@ */ #include "libavutil/lls.h" -#include "dsputil.h" #define LPC_USE_DOUBLE #include "lpc.h" @@ -55,7 +54,7 @@ static void apply_welch_window(const int32_t *data, int len, double *w_data) * Calculate autocorrelation data from audio samples * A Welch window function is applied before calculation. */ -void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag, +static void lpc_compute_autocorr_c(const int32_t *data, int len, int lag, double *autoc) { int i, j; @@ -162,7 +161,7 @@ static int estimate_best_order(double *ref, int min_order, int max_order) * 1 = LPC with coeffs determined by Levinson-Durbin recursion * 2+ = LPC with coeffs determined by Cholesky factorization using (use_lpc-1) passes. */ -int ff_lpc_calc_coefs(DSPContext *s, +int ff_lpc_calc_coefs(LPCContext *s, const int32_t *samples, int blocksize, int min_order, int max_order, int precision, int32_t coefs[][MAX_LPC_ORDER], int *shift, @@ -236,3 +235,11 @@ int ff_lpc_calc_coefs(DSPContext *s, return opt_order; } + +av_cold void ff_lpc_init(LPCContext *s) +{ + s->lpc_compute_autocorr = lpc_compute_autocorr_c; + + if (HAVE_MMX) + ff_lpc_init_x86(s); +} diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h index 1c595f6b9a..a307793374 100644 --- a/libavcodec/lpc.h +++ b/libavcodec/lpc.h @@ -36,18 +36,36 @@ #define MAX_LPC_ORDER 32 +typedef struct LPCContext { + /** + * Perform autocorrelation on input samples with delay of 0 to lag. + * @param data input samples. + * no alignment needed. + * @param len number of input samples to process + * @param lag maximum delay to calculate + * @param autoc output autocorrelation coefficients. + * constraints: array size must be at least lag+1. + */ + void (*lpc_compute_autocorr)(const int32_t *data, int len, int lag, + double *autoc); +} LPCContext; + + /** * Calculate LPC coefficients for multiple orders */ -int ff_lpc_calc_coefs(DSPContext *s, +int ff_lpc_calc_coefs(LPCContext *s, const int32_t *samples, int blocksize, int min_order, int max_order, int precision, int32_t coefs[][MAX_LPC_ORDER], int *shift, enum AVLPCType lpc_type, int lpc_passes, int omethod, int max_shift, int zero_shift); -void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag, - double *autoc); +/** + * Initialize LPCContext. + */ +void ff_lpc_init(LPCContext *s); +void ff_lpc_init_x86(LPCContext *s); #ifdef LPC_USE_DOUBLE #define LPC_TYPE double diff --git a/libavcodec/ra144.h b/libavcodec/ra144.h index 536b5bbe72..11c66a46e0 100644 --- a/libavcodec/ra144.h +++ b/libavcodec/ra144.h @@ -23,7 +23,7 @@ #define AVCODEC_RA144_H #include -#include "dsputil.h" +#include "lpc.h" #define NBLOCKS 4 ///< number of subblocks within a block #define BLOCKSIZE 40 ///< subblock size in 16-bit words @@ -34,7 +34,7 @@ typedef struct { AVCodecContext *avctx; - DSPContext dsp; + LPCContext lpc_ctx; unsigned int old_energy; ///< previous frame energy diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index 9865dc9c04..3f8694eb8f 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -29,7 +29,6 @@ #include "avcodec.h" #include "put_bits.h" -#include "lpc.h" #include "celp_filters.h" #include "ra144.h" @@ -53,7 +52,7 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx) ractx->lpc_coef[0] = ractx->lpc_tables[0]; ractx->lpc_coef[1] = ractx->lpc_tables[1]; ractx->avctx = avctx; - dsputil_init(&ractx->dsp, avctx); + ff_lpc_init(&ractx->lpc_ctx); return 0; } @@ -451,7 +450,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame, energy = ff_energy_tab[quantize(ff_t_sqrt(energy >> 5) >> 10, ff_energy_tab, 32)]; - ff_lpc_calc_coefs(&ractx->dsp, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER, + ff_lpc_calc_coefs(&ractx->lpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER, LPC_ORDER, 16, lpc_coefs, shift, AV_LPC_TYPE_LEVINSON, 0, ORDER_METHOD_EST, 12, 0); for (i = 0; i < LPC_ORDER; i++) diff --git a/libavcodec/x86/dsputil_mmx.h b/libavcodec/x86/dsputil_mmx.h index c57bbbf3a7..a095e1ef3d 100644 --- a/libavcodec/x86/dsputil_mmx.h +++ b/libavcodec/x86/dsputil_mmx.h @@ -200,9 +200,6 @@ void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx); void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd); void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd); -void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag, - double *autoc); - void ff_mmx_idct(DCTELEM *block); void ff_mmxext_idct(DCTELEM *block); diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c index cb8080aa0a..bd31205a6b 100644 --- a/libavcodec/x86/dsputilenc_mmx.c +++ b/libavcodec/x86/dsputilenc_mmx.c @@ -1166,10 +1166,6 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx) #endif } - 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 & AV_CPU_FLAG_SSSE3){ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ diff --git a/libavcodec/x86/lpc_mmx.c b/libavcodec/x86/lpc_mmx.c index 49eb569eea..19aad9860f 100644 --- a/libavcodec/x86/lpc_mmx.c +++ b/libavcodec/x86/lpc_mmx.c @@ -20,7 +20,8 @@ */ #include "libavutil/x86_cpu.h" -#include "dsputil_mmx.h" +#include "libavutil/cpu.h" +#include "libavcodec/lpc.h" static void apply_welch_window_sse2(const int32_t *data, int len, double *w_data) { @@ -68,7 +69,7 @@ static void apply_welch_window_sse2(const int32_t *data, int len, double *w_data #undef WELCH } -void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag, +static void lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag, double *autoc) { double tmp[len + lag + 2]; @@ -141,3 +142,12 @@ void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag, } } } + +av_cold void ff_lpc_init_x86(LPCContext *c) +{ + int mm_flags = av_get_cpu_flags(); + + if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) { + c->lpc_compute_autocorr = lpc_compute_autocorr_sse2; + } +} From 77a78e9bdcc589efac41da4f92a489f4523667c0 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 21 Jan 2011 00:12:03 +0000 Subject: [PATCH 029/528] Separate window function from autocorrelation. Signed-off-by: Mans Rullgard --- libavcodec/alacenc.c | 8 ++++-- libavcodec/flacenc.c | 10 ++++--- libavcodec/lpc.c | 57 +++++++++++++++++++++++++++++----------- libavcodec/lpc.h | 31 +++++++++++++++++++--- libavcodec/ra144enc.c | 13 ++++++++- libavcodec/x86/lpc_mmx.c | 19 +++++--------- 6 files changed, 99 insertions(+), 39 deletions(-) diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index 5706ae9f4d..d9ff2b8e0a 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -378,6 +378,7 @@ static void write_compressed_frame(AlacEncodeContext *s) static av_cold int alac_encode_init(AVCodecContext *avctx) { AlacEncodeContext *s = avctx->priv_data; + int ret; uint8_t *alac_extradata = av_mallocz(ALAC_EXTRADATA_SIZE+1); avctx->frame_size = DEFAULT_FRAME_SIZE; @@ -455,9 +456,10 @@ static av_cold int alac_encode_init(AVCodecContext *avctx) avctx->coded_frame->key_frame = 1; s->avctx = avctx; - ff_lpc_init(&s->lpc_ctx); + ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size, s->max_prediction_order, + AV_LPC_TYPE_LEVINSON); - return 0; + return ret; } static int alac_encode_frame(AVCodecContext *avctx, uint8_t *frame, @@ -513,6 +515,8 @@ verbatim: static av_cold int alac_encode_close(AVCodecContext *avctx) { + AlacEncodeContext *s = avctx->priv_data; + ff_lpc_end(&s->lpc_ctx); av_freep(&avctx->extradata); avctx->extradata_size = 0; av_freep(&avctx->coded_frame); diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index d6f0f87376..2bfe56e8eb 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -211,13 +211,11 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) int freq = avctx->sample_rate; int channels = avctx->channels; FlacEncodeContext *s = avctx->priv_data; - int i, level; + int i, level, ret; uint8_t *streaminfo; s->avctx = avctx; - ff_lpc_init(&s->lpc_ctx); - if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) return -1; @@ -438,9 +436,12 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) if (!avctx->coded_frame) return AVERROR(ENOMEM); + ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size, + s->options.max_prediction_order, AV_LPC_TYPE_LEVINSON); + dprint_compression_options(s); - return 0; + return ret; } @@ -1316,6 +1317,7 @@ static av_cold int flac_encode_close(AVCodecContext *avctx) if (avctx->priv_data) { FlacEncodeContext *s = avctx->priv_data; av_freep(&s->md5ctx); + ff_lpc_end(&s->lpc_ctx); } av_freep(&avctx->extradata); avctx->extradata_size = 0; diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index 3a93c9f673..fd51491716 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -28,7 +28,7 @@ /** * Apply Welch window function to audio block */ -static void apply_welch_window(const int32_t *data, int len, double *w_data) +static void apply_welch_window_c(const int32_t *data, int len, double *w_data) { int i, n2; double w; @@ -54,24 +54,16 @@ static void apply_welch_window(const int32_t *data, int len, double *w_data) * Calculate autocorrelation data from audio samples * A Welch window function is applied before calculation. */ -static void lpc_compute_autocorr_c(const int32_t *data, int len, int lag, +static void lpc_compute_autocorr_c(const double *data, int len, int lag, double *autoc) { int i, j; - double tmp[len + lag + 1]; - double *data1= tmp + lag; - - apply_welch_window(data, len, data1); - - for(j=0; j= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && lpc_type > AV_LPC_TYPE_FIXED); + /* reinit LPC context if parameters have changed */ + if (blocksize != s->blocksize || max_order != s->max_order || + lpc_type != s->lpc_type) { + ff_lpc_end(s); + ff_lpc_init(s, blocksize, max_order, lpc_type); + } + if (lpc_type == AV_LPC_TYPE_LEVINSON) { - s->lpc_compute_autocorr(samples, blocksize, max_order, autoc); + double *windowed_samples = s->windowed_samples + max_order; + + s->lpc_apply_welch_window(samples, blocksize, windowed_samples); + + s->lpc_compute_autocorr(windowed_samples, blocksize, max_order, autoc); compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); @@ -236,10 +239,32 @@ int ff_lpc_calc_coefs(LPCContext *s, return opt_order; } -av_cold void ff_lpc_init(LPCContext *s) +av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order, + enum AVLPCType lpc_type) { + s->blocksize = blocksize; + s->max_order = max_order; + s->lpc_type = lpc_type; + + if (lpc_type == AV_LPC_TYPE_LEVINSON) { + s->windowed_samples = av_mallocz((blocksize + max_order + 2) * + sizeof(*s->windowed_samples)); + if (!s->windowed_samples) + return AVERROR(ENOMEM); + } else { + s->windowed_samples = NULL; + } + + s->lpc_apply_welch_window = apply_welch_window_c; s->lpc_compute_autocorr = lpc_compute_autocorr_c; if (HAVE_MMX) ff_lpc_init_x86(s); + + return 0; +} + +av_cold void ff_lpc_end(LPCContext *s) +{ + av_freep(&s->windowed_samples); } diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h index a307793374..96b66df909 100644 --- a/libavcodec/lpc.h +++ b/libavcodec/lpc.h @@ -37,16 +37,35 @@ typedef struct LPCContext { + int blocksize; + int max_order; + enum AVLPCType lpc_type; + double *windowed_samples; + + /** + * Apply a Welch window to an array of input samples. + * The output samples have the same scale as the input, but are in double + * sample format. + * @param data input samples + * @param len number of input samples + * @param w_data output samples + */ + void (*lpc_apply_welch_window)(const int32_t *data, int len, + double *w_data); /** * Perform autocorrelation on input samples with delay of 0 to lag. * @param data input samples. - * no alignment needed. + * constraints: no alignment needed, but must have have at + * least lag*sizeof(double) valid bytes preceeding it, and + * size must be at least (len+1)*sizeof(double) if data is + * 16-byte aligned or (len+2)*sizeof(double) if data is + * unaligned. * @param len number of input samples to process * @param lag maximum delay to calculate * @param autoc output autocorrelation coefficients. * constraints: array size must be at least lag+1. */ - void (*lpc_compute_autocorr)(const int32_t *data, int len, int lag, + void (*lpc_compute_autocorr)(const double *data, int len, int lag, double *autoc); } LPCContext; @@ -64,9 +83,15 @@ int ff_lpc_calc_coefs(LPCContext *s, /** * Initialize LPCContext. */ -void ff_lpc_init(LPCContext *s); +int ff_lpc_init(LPCContext *s, int blocksize, int max_order, + enum AVLPCType lpc_type); void ff_lpc_init_x86(LPCContext *s); +/** + * Uninitialize LPCContext. + */ +void ff_lpc_end(LPCContext *s); + #ifdef LPC_USE_DOUBLE #define LPC_TYPE double #else diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index 3f8694eb8f..2c0a6b1fbd 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -36,6 +36,7 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx) { RA144Context *ractx; + int ret; if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) { av_log(avctx, AV_LOG_ERROR, "invalid sample format\n"); @@ -52,7 +53,16 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx) ractx->lpc_coef[0] = ractx->lpc_tables[0]; ractx->lpc_coef[1] = ractx->lpc_tables[1]; ractx->avctx = avctx; - ff_lpc_init(&ractx->lpc_ctx); + ret = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER, + AV_LPC_TYPE_LEVINSON); + return ret; +} + + +static av_cold int ra144_encode_close(AVCodecContext *avctx) +{ + RA144Context *ractx = avctx->priv_data; + ff_lpc_end(&ractx->lpc_ctx); return 0; } @@ -506,5 +516,6 @@ AVCodec ra_144_encoder = sizeof(RA144Context), ra144_encode_init, ra144_encode_frame, + ra144_encode_close, .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K) encoder"), }; diff --git a/libavcodec/x86/lpc_mmx.c b/libavcodec/x86/lpc_mmx.c index 19aad9860f..3a0a1f0f6f 100644 --- a/libavcodec/x86/lpc_mmx.c +++ b/libavcodec/x86/lpc_mmx.c @@ -69,21 +69,13 @@ static void apply_welch_window_sse2(const int32_t *data, int len, double *w_data #undef WELCH } -static void lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag, +static void lpc_compute_autocorr_sse2(const double *data, int len, int lag, double *autoc) { - double tmp[len + lag + 2]; - double *data1 = tmp + lag; int j; - if((x86_reg)data1 & 15) - data1++; - - apply_welch_window_sse2(data, len, data1); - - for(j=0; jlpc_apply_welch_window = apply_welch_window_sse2; c->lpc_compute_autocorr = lpc_compute_autocorr_sse2; } } From 1c189fc5334d4a687b15861d81d22c8ba2c9cd5e Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 21 Jan 2011 00:12:18 +0000 Subject: [PATCH 030/528] cosmetics related to LPC changes. Signed-off-by: Mans Rullgard --- libavcodec/lpc.c | 9 +++++---- libavcodec/x86/lpc_mmx.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c index fd51491716..6d7671c81f 100644 --- a/libavcodec/lpc.c +++ b/libavcodec/lpc.c @@ -28,7 +28,8 @@ /** * Apply Welch window function to audio block */ -static void apply_welch_window_c(const int32_t *data, int len, double *w_data) +static void lpc_apply_welch_window_c(const int32_t *data, int len, + double *w_data) { int i, n2; double w; @@ -55,7 +56,7 @@ static void apply_welch_window_c(const int32_t *data, int len, double *w_data) * A Welch window function is applied before calculation. */ static void lpc_compute_autocorr_c(const double *data, int len, int lag, - double *autoc) + double *autoc) { int i, j; @@ -255,8 +256,8 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order, s->windowed_samples = NULL; } - s->lpc_apply_welch_window = apply_welch_window_c; - s->lpc_compute_autocorr = lpc_compute_autocorr_c; + s->lpc_apply_welch_window = lpc_apply_welch_window_c; + s->lpc_compute_autocorr = lpc_compute_autocorr_c; if (HAVE_MMX) ff_lpc_init_x86(s); diff --git a/libavcodec/x86/lpc_mmx.c b/libavcodec/x86/lpc_mmx.c index 3a0a1f0f6f..1c202e2ccc 100644 --- a/libavcodec/x86/lpc_mmx.c +++ b/libavcodec/x86/lpc_mmx.c @@ -23,7 +23,8 @@ #include "libavutil/cpu.h" #include "libavcodec/lpc.h" -static void apply_welch_window_sse2(const int32_t *data, int len, double *w_data) +static void lpc_apply_welch_window_sse2(const int32_t *data, int len, + double *w_data) { double c = 2.0 / (len-1.0); int n2 = len>>1; @@ -70,7 +71,7 @@ static void apply_welch_window_sse2(const int32_t *data, int len, double *w_data } static void lpc_compute_autocorr_sse2(const double *data, int len, int lag, - double *autoc) + double *autoc) { int j; @@ -140,7 +141,7 @@ av_cold void ff_lpc_init_x86(LPCContext *c) int mm_flags = av_get_cpu_flags(); if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) { - c->lpc_apply_welch_window = apply_welch_window_sse2; - c->lpc_compute_autocorr = lpc_compute_autocorr_sse2; + c->lpc_apply_welch_window = lpc_apply_welch_window_sse2; + c->lpc_compute_autocorr = lpc_compute_autocorr_sse2; } } From 4efd5cf34b7a04f87805aa0f09913d1d122d300c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 21 Jan 2011 19:18:07 +0000 Subject: [PATCH 031/528] avio: add av_put_str and deprecate put_strz in favor of it Signed-off-by: Mans Rullgard --- libavformat/avienc.c | 2 +- libavformat/avio.h | 10 +++++++++- libavformat/aviobuf.c | 16 +++++++++++++--- libavformat/ffmenc.c | 2 +- libavformat/version.h | 3 +++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index c9476d5b9f..98b0ad713c 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -109,7 +109,7 @@ static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *s len++; put_tag(pb, tag); put_le32(pb, len); - put_strz(pb, str); + avio_put_str(pb, str); if (len & 1) put_byte(pb, 0); } diff --git a/libavformat/avio.h b/libavformat/avio.h index 198507e4a8..9f71c1921e 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -367,7 +367,15 @@ void put_le16(ByteIOContext *s, unsigned int val); void put_be16(ByteIOContext *s, unsigned int val); void put_tag(ByteIOContext *s, const char *tag); -void put_strz(ByteIOContext *s, const char *buf); +#if FF_API_OLD_AVIO +attribute_deprecated void put_strz(ByteIOContext *s, const char *buf); +#endif + +/** + * Write a NULL-terminated string. + * @return number of bytes written. + */ +int avio_put_str(ByteIOContext *s, const char *str); /** * fseek() equivalent for ByteIOContext. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index df76507866..4f0c16c308 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -265,12 +265,22 @@ void put_be32(ByteIOContext *s, unsigned int val) put_byte(s, val); } +#if FF_API_OLD_AVIO void put_strz(ByteIOContext *s, const char *str) { - if (str) - put_buffer(s, (const unsigned char *) str, strlen(str) + 1); - else + avio_put_str(s, str); +} +#endif + +int avio_put_str(ByteIOContext *s, const char *str) +{ + int len = 1; + if (str) { + len += strlen(str); + put_buffer(s, (const unsigned char *) str, len); + } else put_byte(s, 0); + return len; } int ff_get_v_length(uint64_t val){ diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index c5c59db711..10c0f118a7 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -132,7 +132,7 @@ static int ffm_write_header(AVFormatContext *s) put_be16(pb, (int) (codec->qcompress * 10000.0)); put_be16(pb, (int) (codec->qblur * 10000.0)); put_be32(pb, codec->bit_rate_tolerance); - put_strz(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp"); + avio_put_str(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp"); put_be32(pb, codec->rc_max_rate); put_be32(pb, codec->rc_min_rate); put_be32(pb, codec->rc_buffer_size); diff --git a/libavformat/version.h b/libavformat/version.h index 8cea555c61..9a902aa4b4 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -86,5 +86,8 @@ #ifndef FF_API_SYMVER #define FF_API_SYMVER (LIBAVFORMAT_VERSION_MAJOR < 53) #endif +#ifndef FF_API_OLD_AVIO +#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif #endif //AVFORMAT_VERSION_H From dccbd97d72991f4df63542e1ee03db2f8d7a0238 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 21 Jan 2011 19:18:08 +0000 Subject: [PATCH 032/528] lavf: move ff_put_str16_nolen from asf to avio and rename it It will be useful in the mp3 muxer. Signed-off-by: Mans Rullgard --- libavformat/asf.c | 17 ----------------- libavformat/asf.h | 1 - libavformat/asfenc.c | 6 +++--- libavformat/avio.h | 6 ++++++ libavformat/aviobuf.c | 17 +++++++++++++++++ libavformat/mmst.c | 3 +-- 6 files changed, 27 insertions(+), 23 deletions(-) diff --git a/libavformat/asf.c b/libavformat/asf.c index 58e17e9cef..e6659923d7 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -156,20 +156,3 @@ const AVMetadataConv ff_asf_metadata_conv[] = { // { "Year" , "date" }, TODO: conversion year<->date { 0 } }; - -int ff_put_str16_nolen(ByteIOContext *s, const char *tag) -{ - const uint8_t *q = tag; - int ret = 0; - - while (*q) { - uint32_t ch; - uint16_t tmp; - - GET_UTF8(ch, *q++, break;) - PUT_UTF16(ch, tmp, put_le16(s, tmp);ret += 2;) - } - put_le16(s, 0); - ret += 2; - return ret; -} diff --git a/libavformat/asf.h b/libavformat/asf.h index f3705e946a..8cf517dd14 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -230,7 +230,6 @@ extern const AVMetadataConv ff_asf_metadata_conv[]; #define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000 extern AVInputFormat asf_demuxer; -int ff_put_str16_nolen(ByteIOContext *s, const char *tag); int ff_guidcmp(const void *g1, const void *g2); void ff_get_guid(ByteIOContext *s, ff_asf_guid *g); diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index b964953b2b..0c2a6ae94a 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -211,7 +211,7 @@ static void put_str16(ByteIOContext *s, const char *tag) if (url_open_dyn_buf(&dyn_buf) < 0) return; - ff_put_str16_nolen(dyn_buf, tag); + avio_put_str16le(dyn_buf, tag); len = url_close_dyn_buf(dyn_buf, &pb); put_le16(s, len); put_buffer(s, pb, len); @@ -346,7 +346,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data hpos = put_header(pb, &ff_asf_comment_header); for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) { - len = tags[n] ? ff_put_str16_nolen(dyn_buf, tags[n]->value) : 0; + len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0; put_le16(pb, len); } len = url_close_dyn_buf(dyn_buf, &buf); @@ -474,7 +474,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data if ( url_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); - ff_put_str16_nolen(dyn_buf, desc); + avio_put_str16le(dyn_buf, desc); len = url_close_dyn_buf(dyn_buf, &buf); put_le16(pb, len / 2); // "number of characters" = length in bytes / 2 diff --git a/libavformat/avio.h b/libavformat/avio.h index 9f71c1921e..b35d4c716c 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -377,6 +377,12 @@ attribute_deprecated void put_strz(ByteIOContext *s, const char *buf); */ int avio_put_str(ByteIOContext *s, const char *str); +/** + * Convert an UTF-8 string to UTF-16LE and write it. + * @return number of bytes written. + */ +int avio_put_str16le(ByteIOContext *s, const char *str); + /** * fseek() equivalent for ByteIOContext. * @return new position or AVERROR. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 4f0c16c308..5aeced1b9f 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -283,6 +283,23 @@ int avio_put_str(ByteIOContext *s, const char *str) return len; } +int avio_put_str16le(ByteIOContext *s, const char *str) +{ + const uint8_t *q = str; + int ret = 0; + + while (*q) { + uint32_t ch; + uint16_t tmp; + + GET_UTF8(ch, *q++, break;) + PUT_UTF16(ch, tmp, put_le16(s, tmp);ret += 2;) + } + put_le16(s, 0); + ret += 2; + return ret; +} + int ff_get_v_length(uint64_t val){ int i=1; diff --git a/libavformat/mmst.c b/libavformat/mmst.c index 57cca5d0d4..08e3b3e660 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -34,7 +34,6 @@ #include "libavutil/intreadwrite.h" #include "libavcodec/bytestream.h" #include "network.h" -#include "asf.h" #define LOCAL_ADDRESS 0xc0a80081 // FIXME get and use correct local ip address. #define LOCAL_PORT 1037 // as above. @@ -159,7 +158,7 @@ static void mms_put_utf16(MMSContext *mms, uint8_t *src) init_put_byte(&bic, mms->write_out_ptr, sizeof(mms->out_buffer) - size, 1, NULL, NULL, NULL, NULL); - len = ff_put_str16_nolen(&bic, src); + len = avio_put_str16le(&bic, src); mms->write_out_ptr += len; } From 93bb9ff08e533e30ceec2fa53a25483faf63f633 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 21 Jan 2011 19:05:07 +0000 Subject: [PATCH 033/528] configure: simplify exit traps This does the same thing and also fixes the trapping in some (possibly broken) shells. Suggested by Michael Kostylev. Signed-off-by: Mans Rullgard --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index aa05979791..0f1c62d683 100755 --- a/configure +++ b/configure @@ -1810,7 +1810,6 @@ tmpfile(){ } trap 'rm -f -- $TMPFILES' EXIT -trap exit HUP INT TERM tmpfile TMPC .c tmpfile TMPE $EXESUF From a210bce298281aa08516893580089d102afb2e4d Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 21 Jan 2011 19:58:23 +0000 Subject: [PATCH 034/528] configure: better test for mktemp Some variants of mktemp require a template, so provide one when checking for the command. We already supply a template in the subsequent uses of mktemp. Thanks to Michael Kostylev. Signed-off-by: Mans Rullgard --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 0f1c62d683..76ea08d806 100755 --- a/configure +++ b/configure @@ -1793,7 +1793,7 @@ HOSTEXESUF=$(exesuf $host_os) : ${TMPDIR:=$TMP} : ${TMPDIR:=/tmp} -if ! check_cmd mktemp -u; then +if ! check_cmd mktemp -u XXXXXX; then # simple replacement for missing mktemp # NOT SAFE FOR GENERAL USE mktemp(){ From 4ad66441c9fdd2d33d59e36a897a45828f3062f3 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 21 Jan 2011 21:35:08 +0000 Subject: [PATCH 035/528] Fix libavformat version extraction in configure This fixes shared library builds broken by 50196a982bf7c8be9b41053fa0975473c217e709 Signed-off-by: Mans Rullgard --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 76ea08d806..63eadca383 100755 --- a/configure +++ b/configure @@ -3241,7 +3241,7 @@ get_version LIBPOSTPROC libpostproc/postprocess.h get_version LIBAVCODEC libavcodec/avcodec.h get_version LIBAVCORE libavcore/avcore.h get_version LIBAVDEVICE libavdevice/avdevice.h -get_version LIBAVFORMAT libavformat/avformat.h +get_version LIBAVFORMAT libavformat/version.h get_version LIBAVUTIL libavutil/avutil.h get_version LIBAVFILTER libavfilter/avfilter.h From 187e23478bc5c066ff8eef562925471ac179644e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 21 Jan 2011 18:18:09 +0000 Subject: [PATCH 036/528] mp3enc: add support for writing UTF-16 tags Also it gets rid of some mysterious magic numbers in code. Signed-off-by: Mans Rullgard --- libavformat/mp3enc.c | 48 ++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index b4fb876814..e6dcf6aefc 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -76,14 +76,38 @@ static void id3v2_put_size(AVFormatContext *s, int size) put_byte(s->pb, size & 0x7f); } -static void id3v2_put_ttag(AVFormatContext *s, const char *buf, int len, - uint32_t tag) +/** + * Write a text frame with one (normal frames) or two (TXXX frames) strings + * according to encoding (only UTF-8 or UTF-16+BOM supported). + * @return number of bytes written. + */ +static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2, + uint32_t tag, enum ID3v2Encoding enc) { + int len; + uint8_t *pb; + void (*put)(ByteIOContext*, const char*) = avio_put_str; + ByteIOContext *dyn_buf; + if (url_open_dyn_buf(&dyn_buf) < 0) + return 0; + + put_byte(dyn_buf, enc); + if (enc == ID3v2_ENCODING_UTF16BOM) { + put_le16(dyn_buf, 0xFEFF); /* BOM */ + put = avio_put_str16le; + } + put(dyn_buf, str1); + if (str2) + put(dyn_buf, str2); + len = url_close_dyn_buf(dyn_buf, &pb); + put_be32(s->pb, tag); - id3v2_put_size(s, len + 1); + id3v2_put_size(s, len); put_be16(s->pb, 0); - put_byte(s->pb, 3); /* UTF-8 */ - put_buffer(s->pb, buf, len); + put_buffer(s->pb, pb, len); + + av_freep(&pb); + return len + ID3v2_HEADER_SIZE; } @@ -148,25 +172,15 @@ static int mp3_write_header(struct AVFormatContext *s) int i; for (i = 0; *ff_id3v2_tags[i]; i++) if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) { - int len = strlen(t->value); tag = AV_RB32(t->key); - totlen += len + ID3v2_HEADER_SIZE + 2; - id3v2_put_ttag(s, t->value, len + 1, tag); + totlen += id3v2_put_ttag(s, t->value, NULL, tag, ID3v2_ENCODING_UTF8); break; } } if (!tag) { /* unknown tag, write as TXXX frame */ - int len = strlen(t->key), len1 = strlen(t->value); - char *buf = av_malloc(len + len1 + 2); - if (!buf) - return AVERROR(ENOMEM); tag = MKBETAG('T', 'X', 'X', 'X'); - strcpy(buf, t->key); - strcpy(buf + len + 1, t->value); - id3v2_put_ttag(s, buf, len + len1 + 2, tag); - totlen += len + len1 + ID3v2_HEADER_SIZE + 3; - av_free(buf); + totlen += id3v2_put_ttag(s, t->key, t->value, tag, ID3v2_ENCODING_UTF8); } } From 8f4a5d225c6cd65c5f306a200da991f8a59a439a Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Fri, 21 Jan 2011 20:00:40 +0000 Subject: [PATCH 037/528] dca: consider a stream with XXCh/X96 in ExSS as DTS-HD HRA DTS-HD HRA streams do not always have an XBR extension in the extension substream. Instead they can have only XXCh and X96 extensions in there and still be considered DTS-HD HRA. This is also confirmed with Onkyo TX-SR607 receiver which recognizes such a stream as HiRes Audio. Signed-off-by: Mans Rullgard --- libavcodec/dca.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavcodec/dca.c b/libavcodec/dca.c index bc099e1376..64a81d577c 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1501,12 +1501,9 @@ static int dca_exss_parse_asset_header(DCAContext *s) if (extensions_mask & DCA_EXT_EXSS_XLL) s->profile = FF_PROFILE_DTS_HD_MA; - else if (extensions_mask & DCA_EXT_EXSS_XBR) + else if (extensions_mask & (DCA_EXT_EXSS_XBR | DCA_EXT_EXSS_X96 | + DCA_EXT_EXSS_XXCH)) s->profile = FF_PROFILE_DTS_HD_HRA; - else if (extensions_mask & DCA_EXT_EXSS_X96) - s->profile = FF_PROFILE_DTS_96_24; - else if (extensions_mask & DCA_EXT_EXSS_XXCH) - s->profile = FFMAX(s->profile, FF_PROFILE_DTS_ES); if (!(extensions_mask & DCA_EXT_CORE)) av_log(s->avctx, AV_LOG_WARNING, "DTS core detection mismatch.\n"); From 69915b48d6a787e569826eecb6c3b34ec19aeccd Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 21 Jan 2011 21:59:19 +0000 Subject: [PATCH 038/528] iir: Change dst param to float* in ff_iir_filter_flt(). Signed-off-by: Mans Rullgard --- libavcodec/iirfilter.c | 2 +- libavcodec/iirfilter.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 6133a54055..832559cfea 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -269,7 +269,7 @@ void ff_iir_filter(const struct FFIIRFilterCoeffs *c, void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, - const float *src, int sstep, void *dst, int dstep) + const float *src, int sstep, float *dst, int dstep) { if (c->order == 4) { FILTER_BW_O4(float, FLT) diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h index c2484e23d3..b29e035811 100644 --- a/libavcodec/iirfilter.h +++ b/libavcodec/iirfilter.h @@ -117,6 +117,6 @@ void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterSta */ void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, int size, - const float *src, int sstep, void *dst, int dstep); + const float *src, int sstep, float *dst, int dstep); #endif /* AVCODEC_IIRFILTER_H */ From f4096bf6eeddc605457192476dbbf110d4cc6140 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Fri, 21 Jan 2011 22:58:55 +0000 Subject: [PATCH 039/528] dca: add profile names Signed-off-by: Mans Rullgard --- libavcodec/dca.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 64a81d577c..1e05561f25 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1866,6 +1866,15 @@ static av_cold int dca_decode_end(AVCodecContext * avctx) return 0; } +static const AVProfile profiles[] = { + { FF_PROFILE_DTS, "DTS" }, + { FF_PROFILE_DTS_ES, "DTS-ES" }, + { FF_PROFILE_DTS_96_24, "DTS 96/24" }, + { FF_PROFILE_DTS_HD_HRA, "DTS-HD HRA" }, + { FF_PROFILE_DTS_HD_MA, "DTS-HD MA" }, + { FF_PROFILE_UNKNOWN }, +}; + AVCodec dca_decoder = { .name = "dca", .type = AVMEDIA_TYPE_AUDIO, @@ -1876,4 +1885,5 @@ AVCodec dca_decoder = { .close = dca_decode_end, .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), .capabilities = CODEC_CAP_CHANNEL_CONF, + .profiles = NULL_IF_CONFIG_SMALL(profiles), }; From f4b1e21a6304cda58ac36401d8f8dec7ff61d056 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 21 Jan 2011 21:31:21 +0000 Subject: [PATCH 040/528] fate: make lavfi tests output only md5 Instead of saving huge raw files, use the md5: output pseudo-protocol to calculate the checksum of the file directly. This is especially useful when testing on remote targets as it avoids transferring 3.6GB over the network. --- tests/lavfi-regression.sh | 21 +++--- tests/ref/lavfi/crop | 3 +- tests/ref/lavfi/crop_scale | 3 +- tests/ref/lavfi/crop_scale_vflip | 3 +- tests/ref/lavfi/crop_vflip | 3 +- tests/ref/lavfi/null | 3 +- tests/ref/lavfi/pixdesc_be | 126 +++++++++++-------------------- tests/ref/lavfi/pixdesc_le | 126 +++++++++++-------------------- tests/ref/lavfi/pixfmts_copy_le | 126 +++++++++++-------------------- tests/ref/lavfi/pixfmts_crop_le | 108 +++++++++----------------- tests/ref/lavfi/pixfmts_hflip_le | 108 +++++++++----------------- tests/ref/lavfi/pixfmts_null_le | 126 +++++++++++-------------------- tests/ref/lavfi/pixfmts_pad_le | 51 +++++-------- tests/ref/lavfi/pixfmts_scale_le | 126 +++++++++++-------------------- tests/ref/lavfi/pixfmts_vflip_le | 126 +++++++++++-------------------- tests/ref/lavfi/scale200 | 3 +- tests/ref/lavfi/scale500 | 3 +- tests/ref/lavfi/vflip | 3 +- tests/ref/lavfi/vflip_crop | 3 +- tests/ref/lavfi/vflip_vflip | 3 +- tests/regression-funcs.sh | 6 ++ 21 files changed, 369 insertions(+), 711 deletions(-) diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh index f9f9f7c0a8..ed13f7050a 100755 --- a/tests/lavfi-regression.sh +++ b/tests/lavfi-regression.sh @@ -14,11 +14,20 @@ eval do_$test=y rm -f "$logfile" rm -f "$benchfile" +do_video_filter() { + label=$1 + filters=$2 + shift 2 + printf '%-20s' $label >>$logfile + run_ffmpeg -f image2 -vcodec pgmyuv -i $raw_src \ + -vf "$filters" -vcodec rawvideo $* -f nut md5: >>$logfile +} + do_lavfi() { vfilters="slicify=random,$2" if [ $test = $1 ] ; then - do_video_encoding ${test}.nut "" "-vcodec rawvideo -vf $vfilters" + do_video_filter $test "$vfilters" fi } @@ -48,10 +57,7 @@ do_lavfi_pixfmts(){ pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts) for pix_fmt in $pix_fmts; do - output=${test}-${pix_fmt}.nut - do_video_encoding $output "" \ - "-vf slicify=random,format=$pix_fmt,$filter=$filter_args -vcodec rawvideo -pix_fmt $pix_fmt" - rm ${outfile}${output} + do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt done rm $exclude_fmts $out_fmts @@ -69,10 +75,7 @@ do_lavfi_pixfmts "vflip" "" if [ -n "$do_pixdesc_be" ] || [ -n "$do_pixdesc_le" ]; then pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2 | sort)" for pix_fmt in $pix_fmts; do - output=lavfi_pixdesc-${pix_fmt}.nut - do_video_encoding $output "" \ - "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt" - rm ${outfile}${output} + do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,pixdesctest" -pix_fmt $pix_fmt done fi diff --git a/tests/ref/lavfi/crop b/tests/ref/lavfi/crop index 75c39f7117..32041c2184 100644 --- a/tests/ref/lavfi/crop +++ b/tests/ref/lavfi/crop @@ -1,2 +1 @@ -3d163f156eaddf41d2be20736f973539 *./tests/data/lavfi/crop.nut -3554654 ./tests/data/lavfi/crop.nut +crop 3d163f156eaddf41d2be20736f973539 diff --git a/tests/ref/lavfi/crop_scale b/tests/ref/lavfi/crop_scale index b7ad1a9751..82e5394496 100644 --- a/tests/ref/lavfi/crop_scale +++ b/tests/ref/lavfi/crop_scale @@ -1,2 +1 @@ -0a3d45d58b805b8c47416b9239535f94 *./tests/data/lavfi/crop_scale.nut -8941454 ./tests/data/lavfi/crop_scale.nut +crop_scale 0a3d45d58b805b8c47416b9239535f94 diff --git a/tests/ref/lavfi/crop_scale_vflip b/tests/ref/lavfi/crop_scale_vflip index bd573a34ad..07c729af0d 100644 --- a/tests/ref/lavfi/crop_scale_vflip +++ b/tests/ref/lavfi/crop_scale_vflip @@ -1,2 +1 @@ -e88a4dfb960d0bb28ee875567bedde5d *./tests/data/lavfi/crop_scale_vflip.nut -750727 ./tests/data/lavfi/crop_scale_vflip.nut +crop_scale_vflip e88a4dfb960d0bb28ee875567bedde5d diff --git a/tests/ref/lavfi/crop_vflip b/tests/ref/lavfi/crop_vflip index 96fc9bd045..a3f8200222 100644 --- a/tests/ref/lavfi/crop_vflip +++ b/tests/ref/lavfi/crop_vflip @@ -1,2 +1 @@ -628542e17b6900ee79b1429183ae01b0 *./tests/data/lavfi/crop_vflip.nut -3554654 ./tests/data/lavfi/crop_vflip.nut +crop_vflip 628542e17b6900ee79b1429183ae01b0 diff --git a/tests/ref/lavfi/null b/tests/ref/lavfi/null index b4d006e28c..3c3b7b742d 100644 --- a/tests/ref/lavfi/null +++ b/tests/ref/lavfi/null @@ -1,2 +1 @@ -eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/null.nut -7604654 ./tests/data/lavfi/null.nut +null eba2f135a08829387e2f698ff72a2939 diff --git a/tests/ref/lavfi/pixdesc_be b/tests/ref/lavfi/pixdesc_be index df0981fb9f..03abcd5872 100644 --- a/tests/ref/lavfi/pixdesc_be +++ b/tests/ref/lavfi/pixdesc_be @@ -1,84 +1,42 @@ -037bf9df6a765520ad6d490066bf4b89 *./tests/data/lavfi/lavfi_pixdesc-abgr.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-abgr.nut -c442a8261c2265a07212ef0f72e35f5a *./tests/data/lavfi/lavfi_pixdesc-argb.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-argb.nut -0d0cb38ab3fa0b2ec0865c14f78b217b *./tests/data/lavfi/lavfi_pixdesc-bgr24.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-bgr24.nut -50d23cc82d9dcef2fd12adb81fb9b806 *./tests/data/lavfi/lavfi_pixdesc-bgr4_byte.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-bgr4_byte.nut -49f01b1f1f0c84fd9e776dd34cc3c280 *./tests/data/lavfi/lavfi_pixdesc-bgr555be.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-bgr555be.nut -257cf78afa35dc31e9696f139c916715 *./tests/data/lavfi/lavfi_pixdesc-bgr565be.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-bgr565be.nut -24bd566170343d06fec6fccfff5abc54 *./tests/data/lavfi/lavfi_pixdesc-bgr8.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-bgr8.nut -76a18a5151242fa137133f604cd624d2 *./tests/data/lavfi/lavfi_pixdesc-bgra.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-bgra.nut -db08f7f0751900347e6b8649e4164d21 *./tests/data/lavfi/lavfi_pixdesc-gray.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-gray.nut -7becf34ae825a3df3969bf4c6bfeb5e2 *./tests/data/lavfi/lavfi_pixdesc-gray16be.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-gray16be.nut -10bd87059b5c189f3caef2837f4f2b5c *./tests/data/lavfi/lavfi_pixdesc-gray16le.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-gray16le.nut -668ebe8b8103b9046b251b2fa8a1d88f *./tests/data/lavfi/lavfi_pixdesc-monob.nut -634329 ./tests/data/lavfi/lavfi_pixdesc-monob.nut -9251497f3b0634f1165d12d5a289d943 *./tests/data/lavfi/lavfi_pixdesc-monow.nut -634329 ./tests/data/lavfi/lavfi_pixdesc-monow.nut -e0af357888584d36eec5aa0f673793ef *./tests/data/lavfi/lavfi_pixdesc-nv12.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-nv12.nut -9a3297f3b34baa038b1f37cb202b512f *./tests/data/lavfi/lavfi_pixdesc-nv21.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-nv21.nut -b41eba9651e1b5fe386289b506188105 *./tests/data/lavfi/lavfi_pixdesc-rgb24.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-rgb24.nut -460b6de89b156290a12d3941db8bd731 *./tests/data/lavfi/lavfi_pixdesc-rgb48be.nut -30414303 ./tests/data/lavfi/lavfi_pixdesc-rgb48be.nut -cd93cb34d15996987367dabda3a10128 *./tests/data/lavfi/lavfi_pixdesc-rgb48le.nut -30414303 ./tests/data/lavfi/lavfi_pixdesc-rgb48le.nut -c93ba89b74c504e7f5ae9d9ab1546c73 *./tests/data/lavfi/lavfi_pixdesc-rgb4_byte.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-rgb4_byte.nut -912a62c5e53bfcbac2a0340e10973cf2 *./tests/data/lavfi/lavfi_pixdesc-rgb555be.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-rgb555be.nut -9cadf742e05ddc23a3b5b270f89aad3c *./tests/data/lavfi/lavfi_pixdesc-rgb565be.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-rgb565be.nut -4a9d8e4f2f154e83a7e1735be6300700 *./tests/data/lavfi/lavfi_pixdesc-rgb8.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-rgb8.nut -93a5b3712e6eb8c5b9a09ffc7b9fbc12 *./tests/data/lavfi/lavfi_pixdesc-rgba.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-rgba.nut -adcf64516a19fce44df77082bdb16291 *./tests/data/lavfi/lavfi_pixdesc-uyvy422.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-uyvy422.nut -2d9225153c83ee1132397d619d94d1b3 *./tests/data/lavfi/lavfi_pixdesc-yuv410p.nut -5703854 ./tests/data/lavfi/lavfi_pixdesc-yuv410p.nut -8b298af3e43348ca1b11eb8a3252ac6c *./tests/data/lavfi/lavfi_pixdesc-yuv411p.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-yuv411p.nut -eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/lavfi_pixdesc-yuv420p.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-yuv420p.nut -16c009a235cd52b74791a895423152a3 *./tests/data/lavfi/lavfi_pixdesc-yuv420p16be.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv420p16be.nut -2d59c4f1d0314a5a957a7cfc4b6fabcc *./tests/data/lavfi/lavfi_pixdesc-yuv420p16le.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv420p16le.nut -c9bba4529821d796a6ab09f6a5fd355a *./tests/data/lavfi/lavfi_pixdesc-yuv422p.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuv422p.nut -5499502e1c29534a158a1fe60e889f60 *./tests/data/lavfi/lavfi_pixdesc-yuv422p16be.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-yuv422p16be.nut -e3d61fde6978591596bc36b914386623 *./tests/data/lavfi/lavfi_pixdesc-yuv422p16le.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-yuv422p16le.nut -5a064afe2b453bb52cdb3f176b1aa1cf *./tests/data/lavfi/lavfi_pixdesc-yuv440p.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuv440p.nut -0a98447b78fd476aa39686da6a74fa2e *./tests/data/lavfi/lavfi_pixdesc-yuv444p.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv444p.nut -ea602a24b8e6969679265078bd8607b6 *./tests/data/lavfi/lavfi_pixdesc-yuv444p16be.nut -30414303 ./tests/data/lavfi/lavfi_pixdesc-yuv444p16be.nut -1262a0dc57ee147967fc896d04206313 *./tests/data/lavfi/lavfi_pixdesc-yuv444p16le.nut -30414303 ./tests/data/lavfi/lavfi_pixdesc-yuv444p16le.nut -a29884f3f3dfe1e00b961bc17bef3d47 *./tests/data/lavfi/lavfi_pixdesc-yuva420p.nut -12673454 ./tests/data/lavfi/lavfi_pixdesc-yuva420p.nut -32eec78ba51857b16ce9b813a49b7189 *./tests/data/lavfi/lavfi_pixdesc-yuvj420p.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-yuvj420p.nut -0dfa0ed434f73be51428758c69e082cb *./tests/data/lavfi/lavfi_pixdesc-yuvj422p.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuvj422p.nut -9c3a093ff64a83ac4cf0b1e65390e236 *./tests/data/lavfi/lavfi_pixdesc-yuvj440p.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuvj440p.nut -ede1e5882d5c5bba48ea33cf1209d231 *./tests/data/lavfi/lavfi_pixdesc-yuvj444p.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-yuvj444p.nut -f2569f2b5069a0ee0cecae33de0455e3 *./tests/data/lavfi/lavfi_pixdesc-yuyv422.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuyv422.nut +abgr 037bf9df6a765520ad6d490066bf4b89 +argb c442a8261c2265a07212ef0f72e35f5a +bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b +bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806 +bgr555be 49f01b1f1f0c84fd9e776dd34cc3c280 +bgr565be 257cf78afa35dc31e9696f139c916715 +bgr8 24bd566170343d06fec6fccfff5abc54 +bgra 76a18a5151242fa137133f604cd624d2 +gray db08f7f0751900347e6b8649e4164d21 +gray16be 7becf34ae825a3df3969bf4c6bfeb5e2 +gray16le 10bd87059b5c189f3caef2837f4f2b5c +monob 668ebe8b8103b9046b251b2fa8a1d88f +monow 9251497f3b0634f1165d12d5a289d943 +nv12 e0af357888584d36eec5aa0f673793ef +nv21 9a3297f3b34baa038b1f37cb202b512f +rgb24 b41eba9651e1b5fe386289b506188105 +rgb48be 460b6de89b156290a12d3941db8bd731 +rgb48le cd93cb34d15996987367dabda3a10128 +rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c73 +rgb555be 912a62c5e53bfcbac2a0340e10973cf2 +rgb565be 9cadf742e05ddc23a3b5b270f89aad3c +rgb8 4a9d8e4f2f154e83a7e1735be6300700 +rgba 93a5b3712e6eb8c5b9a09ffc7b9fbc12 +uyvy422 adcf64516a19fce44df77082bdb16291 +yuv410p 2d9225153c83ee1132397d619d94d1b3 +yuv411p 8b298af3e43348ca1b11eb8a3252ac6c +yuv420p eba2f135a08829387e2f698ff72a2939 +yuv420p16be 16c009a235cd52b74791a895423152a3 +yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc +yuv422p c9bba4529821d796a6ab09f6a5fd355a +yuv422p16be 5499502e1c29534a158a1fe60e889f60 +yuv422p16le e3d61fde6978591596bc36b914386623 +yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf +yuv444p 0a98447b78fd476aa39686da6a74fa2e +yuv444p16be ea602a24b8e6969679265078bd8607b6 +yuv444p16le 1262a0dc57ee147967fc896d04206313 +yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuvj420p 32eec78ba51857b16ce9b813a49b7189 +yuvj422p 0dfa0ed434f73be51428758c69e082cb +yuvj440p 9c3a093ff64a83ac4cf0b1e65390e236 +yuvj444p ede1e5882d5c5bba48ea33cf1209d231 +yuyv422 f2569f2b5069a0ee0cecae33de0455e3 diff --git a/tests/ref/lavfi/pixdesc_le b/tests/ref/lavfi/pixdesc_le index 3182fa9bf8..5832f89b01 100644 --- a/tests/ref/lavfi/pixdesc_le +++ b/tests/ref/lavfi/pixdesc_le @@ -1,84 +1,42 @@ -037bf9df6a765520ad6d490066bf4b89 *./tests/data/lavfi/lavfi_pixdesc-abgr.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-abgr.nut -c442a8261c2265a07212ef0f72e35f5a *./tests/data/lavfi/lavfi_pixdesc-argb.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-argb.nut -0d0cb38ab3fa0b2ec0865c14f78b217b *./tests/data/lavfi/lavfi_pixdesc-bgr24.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-bgr24.nut -50d23cc82d9dcef2fd12adb81fb9b806 *./tests/data/lavfi/lavfi_pixdesc-bgr4_byte.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-bgr4_byte.nut -378d6ac4223651a1adcbf94a3d0d807b *./tests/data/lavfi/lavfi_pixdesc-bgr555le.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-bgr555le.nut -1dfdd03995c287e3c754b164bf26a355 *./tests/data/lavfi/lavfi_pixdesc-bgr565le.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-bgr565le.nut -24bd566170343d06fec6fccfff5abc54 *./tests/data/lavfi/lavfi_pixdesc-bgr8.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-bgr8.nut -76a18a5151242fa137133f604cd624d2 *./tests/data/lavfi/lavfi_pixdesc-bgra.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-bgra.nut -db08f7f0751900347e6b8649e4164d21 *./tests/data/lavfi/lavfi_pixdesc-gray.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-gray.nut -7becf34ae825a3df3969bf4c6bfeb5e2 *./tests/data/lavfi/lavfi_pixdesc-gray16be.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-gray16be.nut -10bd87059b5c189f3caef2837f4f2b5c *./tests/data/lavfi/lavfi_pixdesc-gray16le.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-gray16le.nut -668ebe8b8103b9046b251b2fa8a1d88f *./tests/data/lavfi/lavfi_pixdesc-monob.nut -634329 ./tests/data/lavfi/lavfi_pixdesc-monob.nut -9251497f3b0634f1165d12d5a289d943 *./tests/data/lavfi/lavfi_pixdesc-monow.nut -634329 ./tests/data/lavfi/lavfi_pixdesc-monow.nut -e0af357888584d36eec5aa0f673793ef *./tests/data/lavfi/lavfi_pixdesc-nv12.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-nv12.nut -9a3297f3b34baa038b1f37cb202b512f *./tests/data/lavfi/lavfi_pixdesc-nv21.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-nv21.nut -b41eba9651e1b5fe386289b506188105 *./tests/data/lavfi/lavfi_pixdesc-rgb24.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-rgb24.nut -460b6de89b156290a12d3941db8bd731 *./tests/data/lavfi/lavfi_pixdesc-rgb48be.nut -30414303 ./tests/data/lavfi/lavfi_pixdesc-rgb48be.nut -cd93cb34d15996987367dabda3a10128 *./tests/data/lavfi/lavfi_pixdesc-rgb48le.nut -30414303 ./tests/data/lavfi/lavfi_pixdesc-rgb48le.nut -c93ba89b74c504e7f5ae9d9ab1546c73 *./tests/data/lavfi/lavfi_pixdesc-rgb4_byte.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-rgb4_byte.nut -a937a0fc764fb57dc1b3af87cba0273c *./tests/data/lavfi/lavfi_pixdesc-rgb555le.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-rgb555le.nut -d39aa298bb525e9be8860351c6f62dab *./tests/data/lavfi/lavfi_pixdesc-rgb565le.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-rgb565le.nut -4a9d8e4f2f154e83a7e1735be6300700 *./tests/data/lavfi/lavfi_pixdesc-rgb8.nut -5070254 ./tests/data/lavfi/lavfi_pixdesc-rgb8.nut -93a5b3712e6eb8c5b9a09ffc7b9fbc12 *./tests/data/lavfi/lavfi_pixdesc-rgba.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-rgba.nut -adcf64516a19fce44df77082bdb16291 *./tests/data/lavfi/lavfi_pixdesc-uyvy422.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-uyvy422.nut -2d9225153c83ee1132397d619d94d1b3 *./tests/data/lavfi/lavfi_pixdesc-yuv410p.nut -5703854 ./tests/data/lavfi/lavfi_pixdesc-yuv410p.nut -8b298af3e43348ca1b11eb8a3252ac6c *./tests/data/lavfi/lavfi_pixdesc-yuv411p.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-yuv411p.nut -eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/lavfi_pixdesc-yuv420p.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-yuv420p.nut -16c009a235cd52b74791a895423152a3 *./tests/data/lavfi/lavfi_pixdesc-yuv420p16be.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv420p16be.nut -2d59c4f1d0314a5a957a7cfc4b6fabcc *./tests/data/lavfi/lavfi_pixdesc-yuv420p16le.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv420p16le.nut -c9bba4529821d796a6ab09f6a5fd355a *./tests/data/lavfi/lavfi_pixdesc-yuv422p.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuv422p.nut -5499502e1c29534a158a1fe60e889f60 *./tests/data/lavfi/lavfi_pixdesc-yuv422p16be.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-yuv422p16be.nut -e3d61fde6978591596bc36b914386623 *./tests/data/lavfi/lavfi_pixdesc-yuv422p16le.nut -20276703 ./tests/data/lavfi/lavfi_pixdesc-yuv422p16le.nut -5a064afe2b453bb52cdb3f176b1aa1cf *./tests/data/lavfi/lavfi_pixdesc-yuv440p.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuv440p.nut -0a98447b78fd476aa39686da6a74fa2e *./tests/data/lavfi/lavfi_pixdesc-yuv444p.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-yuv444p.nut -ea602a24b8e6969679265078bd8607b6 *./tests/data/lavfi/lavfi_pixdesc-yuv444p16be.nut -30414303 ./tests/data/lavfi/lavfi_pixdesc-yuv444p16be.nut -1262a0dc57ee147967fc896d04206313 *./tests/data/lavfi/lavfi_pixdesc-yuv444p16le.nut -30414303 ./tests/data/lavfi/lavfi_pixdesc-yuv444p16le.nut -a29884f3f3dfe1e00b961bc17bef3d47 *./tests/data/lavfi/lavfi_pixdesc-yuva420p.nut -12673454 ./tests/data/lavfi/lavfi_pixdesc-yuva420p.nut -32eec78ba51857b16ce9b813a49b7189 *./tests/data/lavfi/lavfi_pixdesc-yuvj420p.nut -7604654 ./tests/data/lavfi/lavfi_pixdesc-yuvj420p.nut -0dfa0ed434f73be51428758c69e082cb *./tests/data/lavfi/lavfi_pixdesc-yuvj422p.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuvj422p.nut -9c3a093ff64a83ac4cf0b1e65390e236 *./tests/data/lavfi/lavfi_pixdesc-yuvj440p.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuvj440p.nut -ede1e5882d5c5bba48ea33cf1209d231 *./tests/data/lavfi/lavfi_pixdesc-yuvj444p.nut -15207903 ./tests/data/lavfi/lavfi_pixdesc-yuvj444p.nut -f2569f2b5069a0ee0cecae33de0455e3 *./tests/data/lavfi/lavfi_pixdesc-yuyv422.nut -10139054 ./tests/data/lavfi/lavfi_pixdesc-yuyv422.nut +abgr 037bf9df6a765520ad6d490066bf4b89 +argb c442a8261c2265a07212ef0f72e35f5a +bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b +bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806 +bgr555le 378d6ac4223651a1adcbf94a3d0d807b +bgr565le 1dfdd03995c287e3c754b164bf26a355 +bgr8 24bd566170343d06fec6fccfff5abc54 +bgra 76a18a5151242fa137133f604cd624d2 +gray db08f7f0751900347e6b8649e4164d21 +gray16be 7becf34ae825a3df3969bf4c6bfeb5e2 +gray16le 10bd87059b5c189f3caef2837f4f2b5c +monob 668ebe8b8103b9046b251b2fa8a1d88f +monow 9251497f3b0634f1165d12d5a289d943 +nv12 e0af357888584d36eec5aa0f673793ef +nv21 9a3297f3b34baa038b1f37cb202b512f +rgb24 b41eba9651e1b5fe386289b506188105 +rgb48be 460b6de89b156290a12d3941db8bd731 +rgb48le cd93cb34d15996987367dabda3a10128 +rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c73 +rgb555le a937a0fc764fb57dc1b3af87cba0273c +rgb565le d39aa298bb525e9be8860351c6f62dab +rgb8 4a9d8e4f2f154e83a7e1735be6300700 +rgba 93a5b3712e6eb8c5b9a09ffc7b9fbc12 +uyvy422 adcf64516a19fce44df77082bdb16291 +yuv410p 2d9225153c83ee1132397d619d94d1b3 +yuv411p 8b298af3e43348ca1b11eb8a3252ac6c +yuv420p eba2f135a08829387e2f698ff72a2939 +yuv420p16be 16c009a235cd52b74791a895423152a3 +yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc +yuv422p c9bba4529821d796a6ab09f6a5fd355a +yuv422p16be 5499502e1c29534a158a1fe60e889f60 +yuv422p16le e3d61fde6978591596bc36b914386623 +yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf +yuv444p 0a98447b78fd476aa39686da6a74fa2e +yuv444p16be ea602a24b8e6969679265078bd8607b6 +yuv444p16le 1262a0dc57ee147967fc896d04206313 +yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuvj420p 32eec78ba51857b16ce9b813a49b7189 +yuvj422p 0dfa0ed434f73be51428758c69e082cb +yuvj440p 9c3a093ff64a83ac4cf0b1e65390e236 +yuvj444p ede1e5882d5c5bba48ea33cf1209d231 +yuyv422 f2569f2b5069a0ee0cecae33de0455e3 diff --git a/tests/ref/lavfi/pixfmts_copy_le b/tests/ref/lavfi/pixfmts_copy_le index 4a3a738cb5..5832f89b01 100644 --- a/tests/ref/lavfi/pixfmts_copy_le +++ b/tests/ref/lavfi/pixfmts_copy_le @@ -1,84 +1,42 @@ -037bf9df6a765520ad6d490066bf4b89 *./tests/data/lavfi/pixfmts_copy_le-abgr.nut -20276703 ./tests/data/lavfi/pixfmts_copy_le-abgr.nut -c442a8261c2265a07212ef0f72e35f5a *./tests/data/lavfi/pixfmts_copy_le-argb.nut -20276703 ./tests/data/lavfi/pixfmts_copy_le-argb.nut -0d0cb38ab3fa0b2ec0865c14f78b217b *./tests/data/lavfi/pixfmts_copy_le-bgr24.nut -15207903 ./tests/data/lavfi/pixfmts_copy_le-bgr24.nut -50d23cc82d9dcef2fd12adb81fb9b806 *./tests/data/lavfi/pixfmts_copy_le-bgr4_byte.nut -5070254 ./tests/data/lavfi/pixfmts_copy_le-bgr4_byte.nut -378d6ac4223651a1adcbf94a3d0d807b *./tests/data/lavfi/pixfmts_copy_le-bgr555le.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-bgr555le.nut -1dfdd03995c287e3c754b164bf26a355 *./tests/data/lavfi/pixfmts_copy_le-bgr565le.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-bgr565le.nut -24bd566170343d06fec6fccfff5abc54 *./tests/data/lavfi/pixfmts_copy_le-bgr8.nut -5070254 ./tests/data/lavfi/pixfmts_copy_le-bgr8.nut -76a18a5151242fa137133f604cd624d2 *./tests/data/lavfi/pixfmts_copy_le-bgra.nut -20276703 ./tests/data/lavfi/pixfmts_copy_le-bgra.nut -db08f7f0751900347e6b8649e4164d21 *./tests/data/lavfi/pixfmts_copy_le-gray.nut -5070254 ./tests/data/lavfi/pixfmts_copy_le-gray.nut -7becf34ae825a3df3969bf4c6bfeb5e2 *./tests/data/lavfi/pixfmts_copy_le-gray16be.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-gray16be.nut -10bd87059b5c189f3caef2837f4f2b5c *./tests/data/lavfi/pixfmts_copy_le-gray16le.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-gray16le.nut -668ebe8b8103b9046b251b2fa8a1d88f *./tests/data/lavfi/pixfmts_copy_le-monob.nut -634329 ./tests/data/lavfi/pixfmts_copy_le-monob.nut -9251497f3b0634f1165d12d5a289d943 *./tests/data/lavfi/pixfmts_copy_le-monow.nut -634329 ./tests/data/lavfi/pixfmts_copy_le-monow.nut -e0af357888584d36eec5aa0f673793ef *./tests/data/lavfi/pixfmts_copy_le-nv12.nut -7604654 ./tests/data/lavfi/pixfmts_copy_le-nv12.nut -9a3297f3b34baa038b1f37cb202b512f *./tests/data/lavfi/pixfmts_copy_le-nv21.nut -7604654 ./tests/data/lavfi/pixfmts_copy_le-nv21.nut -b41eba9651e1b5fe386289b506188105 *./tests/data/lavfi/pixfmts_copy_le-rgb24.nut -15207903 ./tests/data/lavfi/pixfmts_copy_le-rgb24.nut -460b6de89b156290a12d3941db8bd731 *./tests/data/lavfi/pixfmts_copy_le-rgb48be.nut -30414303 ./tests/data/lavfi/pixfmts_copy_le-rgb48be.nut -cd93cb34d15996987367dabda3a10128 *./tests/data/lavfi/pixfmts_copy_le-rgb48le.nut -30414303 ./tests/data/lavfi/pixfmts_copy_le-rgb48le.nut -c93ba89b74c504e7f5ae9d9ab1546c73 *./tests/data/lavfi/pixfmts_copy_le-rgb4_byte.nut -5070254 ./tests/data/lavfi/pixfmts_copy_le-rgb4_byte.nut -a937a0fc764fb57dc1b3af87cba0273c *./tests/data/lavfi/pixfmts_copy_le-rgb555le.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-rgb555le.nut -d39aa298bb525e9be8860351c6f62dab *./tests/data/lavfi/pixfmts_copy_le-rgb565le.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-rgb565le.nut -4a9d8e4f2f154e83a7e1735be6300700 *./tests/data/lavfi/pixfmts_copy_le-rgb8.nut -5070254 ./tests/data/lavfi/pixfmts_copy_le-rgb8.nut -93a5b3712e6eb8c5b9a09ffc7b9fbc12 *./tests/data/lavfi/pixfmts_copy_le-rgba.nut -20276703 ./tests/data/lavfi/pixfmts_copy_le-rgba.nut -adcf64516a19fce44df77082bdb16291 *./tests/data/lavfi/pixfmts_copy_le-uyvy422.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-uyvy422.nut -2d9225153c83ee1132397d619d94d1b3 *./tests/data/lavfi/pixfmts_copy_le-yuv410p.nut -5703854 ./tests/data/lavfi/pixfmts_copy_le-yuv410p.nut -8b298af3e43348ca1b11eb8a3252ac6c *./tests/data/lavfi/pixfmts_copy_le-yuv411p.nut -7604654 ./tests/data/lavfi/pixfmts_copy_le-yuv411p.nut -eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/pixfmts_copy_le-yuv420p.nut -7604654 ./tests/data/lavfi/pixfmts_copy_le-yuv420p.nut -16c009a235cd52b74791a895423152a3 *./tests/data/lavfi/pixfmts_copy_le-yuv420p16be.nut -15207903 ./tests/data/lavfi/pixfmts_copy_le-yuv420p16be.nut -2d59c4f1d0314a5a957a7cfc4b6fabcc *./tests/data/lavfi/pixfmts_copy_le-yuv420p16le.nut -15207903 ./tests/data/lavfi/pixfmts_copy_le-yuv420p16le.nut -c9bba4529821d796a6ab09f6a5fd355a *./tests/data/lavfi/pixfmts_copy_le-yuv422p.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-yuv422p.nut -5499502e1c29534a158a1fe60e889f60 *./tests/data/lavfi/pixfmts_copy_le-yuv422p16be.nut -20276703 ./tests/data/lavfi/pixfmts_copy_le-yuv422p16be.nut -e3d61fde6978591596bc36b914386623 *./tests/data/lavfi/pixfmts_copy_le-yuv422p16le.nut -20276703 ./tests/data/lavfi/pixfmts_copy_le-yuv422p16le.nut -5a064afe2b453bb52cdb3f176b1aa1cf *./tests/data/lavfi/pixfmts_copy_le-yuv440p.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-yuv440p.nut -0a98447b78fd476aa39686da6a74fa2e *./tests/data/lavfi/pixfmts_copy_le-yuv444p.nut -15207903 ./tests/data/lavfi/pixfmts_copy_le-yuv444p.nut -ea602a24b8e6969679265078bd8607b6 *./tests/data/lavfi/pixfmts_copy_le-yuv444p16be.nut -30414303 ./tests/data/lavfi/pixfmts_copy_le-yuv444p16be.nut -1262a0dc57ee147967fc896d04206313 *./tests/data/lavfi/pixfmts_copy_le-yuv444p16le.nut -30414303 ./tests/data/lavfi/pixfmts_copy_le-yuv444p16le.nut -a29884f3f3dfe1e00b961bc17bef3d47 *./tests/data/lavfi/pixfmts_copy_le-yuva420p.nut -12673454 ./tests/data/lavfi/pixfmts_copy_le-yuva420p.nut -32eec78ba51857b16ce9b813a49b7189 *./tests/data/lavfi/pixfmts_copy_le-yuvj420p.nut -7604654 ./tests/data/lavfi/pixfmts_copy_le-yuvj420p.nut -0dfa0ed434f73be51428758c69e082cb *./tests/data/lavfi/pixfmts_copy_le-yuvj422p.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-yuvj422p.nut -9c3a093ff64a83ac4cf0b1e65390e236 *./tests/data/lavfi/pixfmts_copy_le-yuvj440p.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-yuvj440p.nut -ede1e5882d5c5bba48ea33cf1209d231 *./tests/data/lavfi/pixfmts_copy_le-yuvj444p.nut -15207903 ./tests/data/lavfi/pixfmts_copy_le-yuvj444p.nut -f2569f2b5069a0ee0cecae33de0455e3 *./tests/data/lavfi/pixfmts_copy_le-yuyv422.nut -10139054 ./tests/data/lavfi/pixfmts_copy_le-yuyv422.nut +abgr 037bf9df6a765520ad6d490066bf4b89 +argb c442a8261c2265a07212ef0f72e35f5a +bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b +bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806 +bgr555le 378d6ac4223651a1adcbf94a3d0d807b +bgr565le 1dfdd03995c287e3c754b164bf26a355 +bgr8 24bd566170343d06fec6fccfff5abc54 +bgra 76a18a5151242fa137133f604cd624d2 +gray db08f7f0751900347e6b8649e4164d21 +gray16be 7becf34ae825a3df3969bf4c6bfeb5e2 +gray16le 10bd87059b5c189f3caef2837f4f2b5c +monob 668ebe8b8103b9046b251b2fa8a1d88f +monow 9251497f3b0634f1165d12d5a289d943 +nv12 e0af357888584d36eec5aa0f673793ef +nv21 9a3297f3b34baa038b1f37cb202b512f +rgb24 b41eba9651e1b5fe386289b506188105 +rgb48be 460b6de89b156290a12d3941db8bd731 +rgb48le cd93cb34d15996987367dabda3a10128 +rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c73 +rgb555le a937a0fc764fb57dc1b3af87cba0273c +rgb565le d39aa298bb525e9be8860351c6f62dab +rgb8 4a9d8e4f2f154e83a7e1735be6300700 +rgba 93a5b3712e6eb8c5b9a09ffc7b9fbc12 +uyvy422 adcf64516a19fce44df77082bdb16291 +yuv410p 2d9225153c83ee1132397d619d94d1b3 +yuv411p 8b298af3e43348ca1b11eb8a3252ac6c +yuv420p eba2f135a08829387e2f698ff72a2939 +yuv420p16be 16c009a235cd52b74791a895423152a3 +yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc +yuv422p c9bba4529821d796a6ab09f6a5fd355a +yuv422p16be 5499502e1c29534a158a1fe60e889f60 +yuv422p16le e3d61fde6978591596bc36b914386623 +yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf +yuv444p 0a98447b78fd476aa39686da6a74fa2e +yuv444p16be ea602a24b8e6969679265078bd8607b6 +yuv444p16le 1262a0dc57ee147967fc896d04206313 +yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuvj420p 32eec78ba51857b16ce9b813a49b7189 +yuvj422p 0dfa0ed434f73be51428758c69e082cb +yuvj440p 9c3a093ff64a83ac4cf0b1e65390e236 +yuvj444p ede1e5882d5c5bba48ea33cf1209d231 +yuyv422 f2569f2b5069a0ee0cecae33de0455e3 diff --git a/tests/ref/lavfi/pixfmts_crop_le b/tests/ref/lavfi/pixfmts_crop_le index 3a867cd252..3016a7ffc4 100644 --- a/tests/ref/lavfi/pixfmts_crop_le +++ b/tests/ref/lavfi/pixfmts_crop_le @@ -1,72 +1,36 @@ -cd761690872843d1b7ab0c695393c751 *./tests/data/lavfi/pixfmts_crop_le-abgr.nut -2001202 ./tests/data/lavfi/pixfmts_crop_le-abgr.nut -2ec6ef18769bcd651c2e8904d5a3ee67 *./tests/data/lavfi/pixfmts_crop_le-argb.nut -2001202 ./tests/data/lavfi/pixfmts_crop_le-argb.nut -3450fd00cf1493d1ded75544d82ba3ec *./tests/data/lavfi/pixfmts_crop_le-bgr24.nut -1501202 ./tests/data/lavfi/pixfmts_crop_le-bgr24.nut -2f6ac3cdd4676ab4e2982bdf0664945b *./tests/data/lavfi/pixfmts_crop_le-bgr4_byte.nut -500591 ./tests/data/lavfi/pixfmts_crop_le-bgr4_byte.nut -d22442fc13b464f9ba455b08df4e981f *./tests/data/lavfi/pixfmts_crop_le-bgr555le.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-bgr555le.nut -891664e5a54ae5968901347da92bc5e9 *./tests/data/lavfi/pixfmts_crop_le-bgr565le.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-bgr565le.nut -4b7159e05765bd4703180072d86423c8 *./tests/data/lavfi/pixfmts_crop_le-bgr8.nut -500591 ./tests/data/lavfi/pixfmts_crop_le-bgr8.nut -395c9f706fccda721471acaa5c96c16c *./tests/data/lavfi/pixfmts_crop_le-bgra.nut -2001202 ./tests/data/lavfi/pixfmts_crop_le-bgra.nut -8c4850e66562a587a292dc728a65ea4a *./tests/data/lavfi/pixfmts_crop_le-gray.nut -500591 ./tests/data/lavfi/pixfmts_crop_le-gray.nut -daa5a6b98fb4a280c57c57bff1a2ab5a *./tests/data/lavfi/pixfmts_crop_le-gray16be.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-gray16be.nut -84f5ea7259073edcb893113b42213c8e *./tests/data/lavfi/pixfmts_crop_le-gray16le.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-gray16le.nut -3b90ed64b687d3dc186c6ef521dc71a8 *./tests/data/lavfi/pixfmts_crop_le-rgb24.nut -1501202 ./tests/data/lavfi/pixfmts_crop_le-rgb24.nut -a808128041a1962deaa8620c7448feba *./tests/data/lavfi/pixfmts_crop_le-rgb48be.nut -3001202 ./tests/data/lavfi/pixfmts_crop_le-rgb48be.nut -ce92d02cc322608d5be377cb1940677b *./tests/data/lavfi/pixfmts_crop_le-rgb48le.nut -3001202 ./tests/data/lavfi/pixfmts_crop_le-rgb48le.nut -6958029f73c6cdfed4f71020d816f027 *./tests/data/lavfi/pixfmts_crop_le-rgb4_byte.nut -500591 ./tests/data/lavfi/pixfmts_crop_le-rgb4_byte.nut -eeb78f8ce6186fba55c941469e60ba67 *./tests/data/lavfi/pixfmts_crop_le-rgb555le.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-rgb555le.nut -6a49700680be9a0d434411825a769556 *./tests/data/lavfi/pixfmts_crop_le-rgb565le.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-rgb565le.nut -88b0398c265d1ed7a837dc084fa0917c *./tests/data/lavfi/pixfmts_crop_le-rgb8.nut -500591 ./tests/data/lavfi/pixfmts_crop_le-rgb8.nut -fd00b24c7597268c32759a84a1de2de4 *./tests/data/lavfi/pixfmts_crop_le-rgba.nut -2001202 ./tests/data/lavfi/pixfmts_crop_le-rgba.nut -a9f2eaa747bf988b7bebe4f442b9c67a *./tests/data/lavfi/pixfmts_crop_le-yuv410p.nut -563227 ./tests/data/lavfi/pixfmts_crop_le-yuv410p.nut -3334d3aef8dba238658090ac172375d1 *./tests/data/lavfi/pixfmts_crop_le-yuv411p.nut -750727 ./tests/data/lavfi/pixfmts_crop_le-yuv411p.nut -bfea0188ddd4889787c403caae119cc7 *./tests/data/lavfi/pixfmts_crop_le-yuv420p.nut -750727 ./tests/data/lavfi/pixfmts_crop_le-yuv420p.nut -8365eff38b8c329aeb95fc605fa229bb *./tests/data/lavfi/pixfmts_crop_le-yuv420p16be.nut -1501202 ./tests/data/lavfi/pixfmts_crop_le-yuv420p16be.nut -5e8dd38d973d5854abe1ad4efad20cc1 *./tests/data/lavfi/pixfmts_crop_le-yuv420p16le.nut -1501202 ./tests/data/lavfi/pixfmts_crop_le-yuv420p16le.nut -f2f930a91fe00d4252c4720b5ecd8961 *./tests/data/lavfi/pixfmts_crop_le-yuv422p.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-yuv422p.nut -167e4338811a7d272925a4c6417d60da *./tests/data/lavfi/pixfmts_crop_le-yuv422p16be.nut -2001202 ./tests/data/lavfi/pixfmts_crop_le-yuv422p16be.nut -3359395d5875d581fa1e975013d30114 *./tests/data/lavfi/pixfmts_crop_le-yuv422p16le.nut -2001202 ./tests/data/lavfi/pixfmts_crop_le-yuv422p16le.nut -2472417d980e395ad6843cbb8b633b29 *./tests/data/lavfi/pixfmts_crop_le-yuv440p.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-yuv440p.nut -1f151980486848c96bc5585ced99003e *./tests/data/lavfi/pixfmts_crop_le-yuv444p.nut -1501202 ./tests/data/lavfi/pixfmts_crop_le-yuv444p.nut -d69280c2856865d2ea94bd5292aac1c6 *./tests/data/lavfi/pixfmts_crop_le-yuv444p16be.nut -3001202 ./tests/data/lavfi/pixfmts_crop_le-yuv444p16be.nut -33f43e030bedf9723be4f63c3e9fc80e *./tests/data/lavfi/pixfmts_crop_le-yuv444p16le.nut -3001202 ./tests/data/lavfi/pixfmts_crop_le-yuv444p16le.nut -7536753dfbc7932560fb50c921369a0e *./tests/data/lavfi/pixfmts_crop_le-yuva420p.nut -1251202 ./tests/data/lavfi/pixfmts_crop_le-yuva420p.nut -21f891093006d42d7683b0e1d773a657 *./tests/data/lavfi/pixfmts_crop_le-yuvj420p.nut -750727 ./tests/data/lavfi/pixfmts_crop_le-yuvj420p.nut -9a43d474c407590ad8f213880586b45e *./tests/data/lavfi/pixfmts_crop_le-yuvj422p.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-yuvj422p.nut -977351350450ebdbf7a9d20020c6b5a5 *./tests/data/lavfi/pixfmts_crop_le-yuvj440p.nut -1001202 ./tests/data/lavfi/pixfmts_crop_le-yuvj440p.nut -4a50ba26859dad91dcf7000de0d0efa1 *./tests/data/lavfi/pixfmts_crop_le-yuvj444p.nut -1501202 ./tests/data/lavfi/pixfmts_crop_le-yuvj444p.nut +abgr cd761690872843d1b7ab0c695393c751 +argb 2ec6ef18769bcd651c2e8904d5a3ee67 +bgr24 3450fd00cf1493d1ded75544d82ba3ec +bgr4_byte 2f6ac3cdd4676ab4e2982bdf0664945b +bgr555le d22442fc13b464f9ba455b08df4e981f +bgr565le 891664e5a54ae5968901347da92bc5e9 +bgr8 4b7159e05765bd4703180072d86423c8 +bgra 395c9f706fccda721471acaa5c96c16c +gray 8c4850e66562a587a292dc728a65ea4a +gray16be daa5a6b98fb4a280c57c57bff1a2ab5a +gray16le 84f5ea7259073edcb893113b42213c8e +rgb24 3b90ed64b687d3dc186c6ef521dc71a8 +rgb48be a808128041a1962deaa8620c7448feba +rgb48le ce92d02cc322608d5be377cb1940677b +rgb4_byte 6958029f73c6cdfed4f71020d816f027 +rgb555le eeb78f8ce6186fba55c941469e60ba67 +rgb565le 6a49700680be9a0d434411825a769556 +rgb8 88b0398c265d1ed7a837dc084fa0917c +rgba fd00b24c7597268c32759a84a1de2de4 +yuv410p a9f2eaa747bf988b7bebe4f442b9c67a +yuv411p 3334d3aef8dba238658090ac172375d1 +yuv420p bfea0188ddd4889787c403caae119cc7 +yuv420p16be 8365eff38b8c329aeb95fc605fa229bb +yuv420p16le 5e8dd38d973d5854abe1ad4efad20cc1 +yuv422p f2f930a91fe00d4252c4720b5ecd8961 +yuv422p16be 167e4338811a7d272925a4c6417d60da +yuv422p16le 3359395d5875d581fa1e975013d30114 +yuv440p 2472417d980e395ad6843cbb8b633b29 +yuv444p 1f151980486848c96bc5585ced99003e +yuv444p16be d69280c2856865d2ea94bd5292aac1c6 +yuv444p16le 33f43e030bedf9723be4f63c3e9fc80e +yuva420p 7536753dfbc7932560fb50c921369a0e +yuvj420p 21f891093006d42d7683b0e1d773a657 +yuvj422p 9a43d474c407590ad8f213880586b45e +yuvj440p 977351350450ebdbf7a9d20020c6b5a5 +yuvj444p 4a50ba26859dad91dcf7000de0d0efa1 diff --git a/tests/ref/lavfi/pixfmts_hflip_le b/tests/ref/lavfi/pixfmts_hflip_le index 50b831b04c..09976f28ca 100644 --- a/tests/ref/lavfi/pixfmts_hflip_le +++ b/tests/ref/lavfi/pixfmts_hflip_le @@ -1,72 +1,36 @@ -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 +abgr 49468c6c9ceee5d52b08b1270a909323 +argb 50ba9f16c6475530602f2983278b82d0 +bgr24 cc53d2011d097972db0d22756c3699e3 +bgr4_byte aac987e7d1a6a96477cfc0b48a4285de +bgr555le ccee08679bac84a1f960c6c9070c5538 +bgr565le 3703466e19e1b52e03a34fd244a8e8e4 +bgr8 50b505a889f0428242305acb642da107 +bgra 01ca21e7e6a8d1281b4553bde8e8a404 +gray 03efcb4ab52a24c0af0e03cfd26c9377 +gray16be 9bcbca979601ddc4869f846f08f3d1dd +gray16le c1b8965adcc7f847ee343149ff507073 +rgb24 754f1722fc738590cc407ac65749bfe8 +rgb48be 10743e1577dc3198dbbc7c0b3b8f429e +rgb48le dd945a44f39119221407bf7a04f1bc49 +rgb4_byte c8a3f995fcf3e0919239ea2c413ddc29 +rgb555le 8778ee0cf58ce9ad1d99a1eca9f95e87 +rgb565le 2cb690eb3fcb72da3771ad6a48931158 +rgb8 9e462b811b9b6173397b9cfc1f6b2f17 +rgba d3d0dc1ecef3ed72f26a2986d0efc204 +yuv410p acb543ebbbf63eefe533e6faffc006da +yuv411p c626cf6d191139b4ca7efc0155f957f1 +yuv420p 2d5c80f9ba2ddd85b2aeda3564cc7d64 +yuv420p16be 758b0c1e2113b15e7afde48da4e4d024 +yuv420p16le 480ccd951dcb806bc875d307e02e50a0 +yuv422p 6e728f4eb9eae287c224f396d84be6ea +yuv422p16be a05d43cd62b790087bd37083174557de +yuv422p16le 6954abebcbc62d81068d58d0c62bdd5b +yuv440p a99e2b57ed601f39852715c9d675d0d3 +yuv444p 947e47f7bb5fdccc659d19b7df2b6fc3 +yuv444p16be e5ef45bc3d2f5b0b2542d5151340c382 +yuv444p16le 70793e3d66d0c23a0cdedabe9c24c2a7 +yuva420p d83ec0c01498189f179ec574918185f1 +yuvj420p df3aaaec3bb157c3bde5f0365af30f4f +yuvj422p d113871528d510a192797af59df9c05c +yuvj440p e8f7ed76e57c892a1e9e27a3f29452db +yuvj444p 2c3ae369607608c6dcb0d830f00f971a diff --git a/tests/ref/lavfi/pixfmts_null_le b/tests/ref/lavfi/pixfmts_null_le index 31006245a2..5832f89b01 100644 --- a/tests/ref/lavfi/pixfmts_null_le +++ b/tests/ref/lavfi/pixfmts_null_le @@ -1,84 +1,42 @@ -037bf9df6a765520ad6d490066bf4b89 *./tests/data/lavfi/pixfmts_null_le-abgr.nut -20276703 ./tests/data/lavfi/pixfmts_null_le-abgr.nut -c442a8261c2265a07212ef0f72e35f5a *./tests/data/lavfi/pixfmts_null_le-argb.nut -20276703 ./tests/data/lavfi/pixfmts_null_le-argb.nut -0d0cb38ab3fa0b2ec0865c14f78b217b *./tests/data/lavfi/pixfmts_null_le-bgr24.nut -15207903 ./tests/data/lavfi/pixfmts_null_le-bgr24.nut -50d23cc82d9dcef2fd12adb81fb9b806 *./tests/data/lavfi/pixfmts_null_le-bgr4_byte.nut -5070254 ./tests/data/lavfi/pixfmts_null_le-bgr4_byte.nut -378d6ac4223651a1adcbf94a3d0d807b *./tests/data/lavfi/pixfmts_null_le-bgr555le.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-bgr555le.nut -1dfdd03995c287e3c754b164bf26a355 *./tests/data/lavfi/pixfmts_null_le-bgr565le.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-bgr565le.nut -24bd566170343d06fec6fccfff5abc54 *./tests/data/lavfi/pixfmts_null_le-bgr8.nut -5070254 ./tests/data/lavfi/pixfmts_null_le-bgr8.nut -76a18a5151242fa137133f604cd624d2 *./tests/data/lavfi/pixfmts_null_le-bgra.nut -20276703 ./tests/data/lavfi/pixfmts_null_le-bgra.nut -db08f7f0751900347e6b8649e4164d21 *./tests/data/lavfi/pixfmts_null_le-gray.nut -5070254 ./tests/data/lavfi/pixfmts_null_le-gray.nut -7becf34ae825a3df3969bf4c6bfeb5e2 *./tests/data/lavfi/pixfmts_null_le-gray16be.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-gray16be.nut -10bd87059b5c189f3caef2837f4f2b5c *./tests/data/lavfi/pixfmts_null_le-gray16le.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-gray16le.nut -668ebe8b8103b9046b251b2fa8a1d88f *./tests/data/lavfi/pixfmts_null_le-monob.nut -634329 ./tests/data/lavfi/pixfmts_null_le-monob.nut -9251497f3b0634f1165d12d5a289d943 *./tests/data/lavfi/pixfmts_null_le-monow.nut -634329 ./tests/data/lavfi/pixfmts_null_le-monow.nut -e0af357888584d36eec5aa0f673793ef *./tests/data/lavfi/pixfmts_null_le-nv12.nut -7604654 ./tests/data/lavfi/pixfmts_null_le-nv12.nut -9a3297f3b34baa038b1f37cb202b512f *./tests/data/lavfi/pixfmts_null_le-nv21.nut -7604654 ./tests/data/lavfi/pixfmts_null_le-nv21.nut -b41eba9651e1b5fe386289b506188105 *./tests/data/lavfi/pixfmts_null_le-rgb24.nut -15207903 ./tests/data/lavfi/pixfmts_null_le-rgb24.nut -460b6de89b156290a12d3941db8bd731 *./tests/data/lavfi/pixfmts_null_le-rgb48be.nut -30414303 ./tests/data/lavfi/pixfmts_null_le-rgb48be.nut -cd93cb34d15996987367dabda3a10128 *./tests/data/lavfi/pixfmts_null_le-rgb48le.nut -30414303 ./tests/data/lavfi/pixfmts_null_le-rgb48le.nut -c93ba89b74c504e7f5ae9d9ab1546c73 *./tests/data/lavfi/pixfmts_null_le-rgb4_byte.nut -5070254 ./tests/data/lavfi/pixfmts_null_le-rgb4_byte.nut -a937a0fc764fb57dc1b3af87cba0273c *./tests/data/lavfi/pixfmts_null_le-rgb555le.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-rgb555le.nut -d39aa298bb525e9be8860351c6f62dab *./tests/data/lavfi/pixfmts_null_le-rgb565le.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-rgb565le.nut -4a9d8e4f2f154e83a7e1735be6300700 *./tests/data/lavfi/pixfmts_null_le-rgb8.nut -5070254 ./tests/data/lavfi/pixfmts_null_le-rgb8.nut -93a5b3712e6eb8c5b9a09ffc7b9fbc12 *./tests/data/lavfi/pixfmts_null_le-rgba.nut -20276703 ./tests/data/lavfi/pixfmts_null_le-rgba.nut -adcf64516a19fce44df77082bdb16291 *./tests/data/lavfi/pixfmts_null_le-uyvy422.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-uyvy422.nut -2d9225153c83ee1132397d619d94d1b3 *./tests/data/lavfi/pixfmts_null_le-yuv410p.nut -5703854 ./tests/data/lavfi/pixfmts_null_le-yuv410p.nut -8b298af3e43348ca1b11eb8a3252ac6c *./tests/data/lavfi/pixfmts_null_le-yuv411p.nut -7604654 ./tests/data/lavfi/pixfmts_null_le-yuv411p.nut -eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/pixfmts_null_le-yuv420p.nut -7604654 ./tests/data/lavfi/pixfmts_null_le-yuv420p.nut -16c009a235cd52b74791a895423152a3 *./tests/data/lavfi/pixfmts_null_le-yuv420p16be.nut -15207903 ./tests/data/lavfi/pixfmts_null_le-yuv420p16be.nut -2d59c4f1d0314a5a957a7cfc4b6fabcc *./tests/data/lavfi/pixfmts_null_le-yuv420p16le.nut -15207903 ./tests/data/lavfi/pixfmts_null_le-yuv420p16le.nut -c9bba4529821d796a6ab09f6a5fd355a *./tests/data/lavfi/pixfmts_null_le-yuv422p.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-yuv422p.nut -5499502e1c29534a158a1fe60e889f60 *./tests/data/lavfi/pixfmts_null_le-yuv422p16be.nut -20276703 ./tests/data/lavfi/pixfmts_null_le-yuv422p16be.nut -e3d61fde6978591596bc36b914386623 *./tests/data/lavfi/pixfmts_null_le-yuv422p16le.nut -20276703 ./tests/data/lavfi/pixfmts_null_le-yuv422p16le.nut -5a064afe2b453bb52cdb3f176b1aa1cf *./tests/data/lavfi/pixfmts_null_le-yuv440p.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-yuv440p.nut -0a98447b78fd476aa39686da6a74fa2e *./tests/data/lavfi/pixfmts_null_le-yuv444p.nut -15207903 ./tests/data/lavfi/pixfmts_null_le-yuv444p.nut -ea602a24b8e6969679265078bd8607b6 *./tests/data/lavfi/pixfmts_null_le-yuv444p16be.nut -30414303 ./tests/data/lavfi/pixfmts_null_le-yuv444p16be.nut -1262a0dc57ee147967fc896d04206313 *./tests/data/lavfi/pixfmts_null_le-yuv444p16le.nut -30414303 ./tests/data/lavfi/pixfmts_null_le-yuv444p16le.nut -a29884f3f3dfe1e00b961bc17bef3d47 *./tests/data/lavfi/pixfmts_null_le-yuva420p.nut -12673454 ./tests/data/lavfi/pixfmts_null_le-yuva420p.nut -32eec78ba51857b16ce9b813a49b7189 *./tests/data/lavfi/pixfmts_null_le-yuvj420p.nut -7604654 ./tests/data/lavfi/pixfmts_null_le-yuvj420p.nut -0dfa0ed434f73be51428758c69e082cb *./tests/data/lavfi/pixfmts_null_le-yuvj422p.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-yuvj422p.nut -9c3a093ff64a83ac4cf0b1e65390e236 *./tests/data/lavfi/pixfmts_null_le-yuvj440p.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-yuvj440p.nut -ede1e5882d5c5bba48ea33cf1209d231 *./tests/data/lavfi/pixfmts_null_le-yuvj444p.nut -15207903 ./tests/data/lavfi/pixfmts_null_le-yuvj444p.nut -f2569f2b5069a0ee0cecae33de0455e3 *./tests/data/lavfi/pixfmts_null_le-yuyv422.nut -10139054 ./tests/data/lavfi/pixfmts_null_le-yuyv422.nut +abgr 037bf9df6a765520ad6d490066bf4b89 +argb c442a8261c2265a07212ef0f72e35f5a +bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b +bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806 +bgr555le 378d6ac4223651a1adcbf94a3d0d807b +bgr565le 1dfdd03995c287e3c754b164bf26a355 +bgr8 24bd566170343d06fec6fccfff5abc54 +bgra 76a18a5151242fa137133f604cd624d2 +gray db08f7f0751900347e6b8649e4164d21 +gray16be 7becf34ae825a3df3969bf4c6bfeb5e2 +gray16le 10bd87059b5c189f3caef2837f4f2b5c +monob 668ebe8b8103b9046b251b2fa8a1d88f +monow 9251497f3b0634f1165d12d5a289d943 +nv12 e0af357888584d36eec5aa0f673793ef +nv21 9a3297f3b34baa038b1f37cb202b512f +rgb24 b41eba9651e1b5fe386289b506188105 +rgb48be 460b6de89b156290a12d3941db8bd731 +rgb48le cd93cb34d15996987367dabda3a10128 +rgb4_byte c93ba89b74c504e7f5ae9d9ab1546c73 +rgb555le a937a0fc764fb57dc1b3af87cba0273c +rgb565le d39aa298bb525e9be8860351c6f62dab +rgb8 4a9d8e4f2f154e83a7e1735be6300700 +rgba 93a5b3712e6eb8c5b9a09ffc7b9fbc12 +uyvy422 adcf64516a19fce44df77082bdb16291 +yuv410p 2d9225153c83ee1132397d619d94d1b3 +yuv411p 8b298af3e43348ca1b11eb8a3252ac6c +yuv420p eba2f135a08829387e2f698ff72a2939 +yuv420p16be 16c009a235cd52b74791a895423152a3 +yuv420p16le 2d59c4f1d0314a5a957a7cfc4b6fabcc +yuv422p c9bba4529821d796a6ab09f6a5fd355a +yuv422p16be 5499502e1c29534a158a1fe60e889f60 +yuv422p16le e3d61fde6978591596bc36b914386623 +yuv440p 5a064afe2b453bb52cdb3f176b1aa1cf +yuv444p 0a98447b78fd476aa39686da6a74fa2e +yuv444p16be ea602a24b8e6969679265078bd8607b6 +yuv444p16le 1262a0dc57ee147967fc896d04206313 +yuva420p a29884f3f3dfe1e00b961bc17bef3d47 +yuvj420p 32eec78ba51857b16ce9b813a49b7189 +yuvj422p 0dfa0ed434f73be51428758c69e082cb +yuvj440p 9c3a093ff64a83ac4cf0b1e65390e236 +yuvj444p ede1e5882d5c5bba48ea33cf1209d231 +yuyv422 f2569f2b5069a0ee0cecae33de0455e3 diff --git a/tests/ref/lavfi/pixfmts_pad_le b/tests/ref/lavfi/pixfmts_pad_le index 243a500be3..73a44f627c 100644 --- a/tests/ref/lavfi/pixfmts_pad_le +++ b/tests/ref/lavfi/pixfmts_pad_le @@ -1,34 +1,17 @@ -e8e5e350c856c051d502cd435a2aa0bd *./tests/data/lavfi/pixfmts_pad_le-abgr.nut -40001503 ./tests/data/lavfi/pixfmts_pad_le-abgr.nut -a98e0a1213824ee4566d4891468bb614 *./tests/data/lavfi/pixfmts_pad_le-argb.nut -40001503 ./tests/data/lavfi/pixfmts_pad_le-argb.nut -ac7417cea8d6e799a31a3c9a39b8f202 *./tests/data/lavfi/pixfmts_pad_le-bgr24.nut -30001503 ./tests/data/lavfi/pixfmts_pad_le-bgr24.nut -6113a09a023cb2b08e9cad78eb1eb37a *./tests/data/lavfi/pixfmts_pad_le-bgra.nut -40001503 ./tests/data/lavfi/pixfmts_pad_le-bgra.nut -65eed443acc66c4f02bab6df4ebed515 *./tests/data/lavfi/pixfmts_pad_le-rgb24.nut -30001503 ./tests/data/lavfi/pixfmts_pad_le-rgb24.nut -74d4158ad0c626e9a7c6923b9ca73294 *./tests/data/lavfi/pixfmts_pad_le-rgba.nut -40001503 ./tests/data/lavfi/pixfmts_pad_le-rgba.nut -a5210eb6a9b10c3269899b935df9a2d6 *./tests/data/lavfi/pixfmts_pad_le-yuv410p.nut -11251454 ./tests/data/lavfi/pixfmts_pad_le-yuv410p.nut -a23380c9698e2d80c9fa8a8b6d4f6854 *./tests/data/lavfi/pixfmts_pad_le-yuv411p.nut -15001503 ./tests/data/lavfi/pixfmts_pad_le-yuv411p.nut -f8733600369adaea28aa445dbdf2ed4c *./tests/data/lavfi/pixfmts_pad_le-yuv420p.nut -15001503 ./tests/data/lavfi/pixfmts_pad_le-yuv420p.nut -3e0d822c11c716e7636387b1bf27c5ff *./tests/data/lavfi/pixfmts_pad_le-yuv422p.nut -20001503 ./tests/data/lavfi/pixfmts_pad_le-yuv422p.nut -225dd7fbc8cceb24c26b765187d43a9e *./tests/data/lavfi/pixfmts_pad_le-yuv440p.nut -20001503 ./tests/data/lavfi/pixfmts_pad_le-yuv440p.nut -45484f0411d336ce94636da0395f4692 *./tests/data/lavfi/pixfmts_pad_le-yuv444p.nut -30001503 ./tests/data/lavfi/pixfmts_pad_le-yuv444p.nut -919722724765dc3a716c38fa53b20580 *./tests/data/lavfi/pixfmts_pad_le-yuva420p.nut -25001503 ./tests/data/lavfi/pixfmts_pad_le-yuva420p.nut -4f20e2799966c21a9d9e0788b0956925 *./tests/data/lavfi/pixfmts_pad_le-yuvj420p.nut -15001503 ./tests/data/lavfi/pixfmts_pad_le-yuvj420p.nut -e4d84b0683f77a76f1c17d976eff127c *./tests/data/lavfi/pixfmts_pad_le-yuvj422p.nut -20001503 ./tests/data/lavfi/pixfmts_pad_le-yuvj422p.nut -9ccc1f03d8d9a00dc4a5888bd77093ad *./tests/data/lavfi/pixfmts_pad_le-yuvj440p.nut -20001503 ./tests/data/lavfi/pixfmts_pad_le-yuvj440p.nut -7d202babcedf836e9ae9776163ee9425 *./tests/data/lavfi/pixfmts_pad_le-yuvj444p.nut -30001503 ./tests/data/lavfi/pixfmts_pad_le-yuvj444p.nut +abgr e8e5e350c856c051d502cd435a2aa0bd +argb a98e0a1213824ee4566d4891468bb614 +bgr24 ac7417cea8d6e799a31a3c9a39b8f202 +bgra 6113a09a023cb2b08e9cad78eb1eb37a +rgb24 65eed443acc66c4f02bab6df4ebed515 +rgba 74d4158ad0c626e9a7c6923b9ca73294 +yuv410p a5210eb6a9b10c3269899b935df9a2d6 +yuv411p a23380c9698e2d80c9fa8a8b6d4f6854 +yuv420p f8733600369adaea28aa445dbdf2ed4c +yuv422p 3e0d822c11c716e7636387b1bf27c5ff +yuv440p 225dd7fbc8cceb24c26b765187d43a9e +yuv444p 45484f0411d336ce94636da0395f4692 +yuva420p 919722724765dc3a716c38fa53b20580 +yuvj420p 4f20e2799966c21a9d9e0788b0956925 +yuvj422p e4d84b0683f77a76f1c17d976eff127c +yuvj440p 9ccc1f03d8d9a00dc4a5888bd77093ad +yuvj444p 7d202babcedf836e9ae9776163ee9425 diff --git a/tests/ref/lavfi/pixfmts_scale_le b/tests/ref/lavfi/pixfmts_scale_le index 2363c8e721..3ecfed713b 100644 --- a/tests/ref/lavfi/pixfmts_scale_le +++ b/tests/ref/lavfi/pixfmts_scale_le @@ -1,84 +1,42 @@ -d894cb97f6c80eb21bdbe8a4eea62d86 *./tests/data/lavfi/pixfmts_scale_le-abgr.nut -4001453 ./tests/data/lavfi/pixfmts_scale_le-abgr.nut -54346f2b2eef10919e0f247241df3b24 *./tests/data/lavfi/pixfmts_scale_le-argb.nut -4001453 ./tests/data/lavfi/pixfmts_scale_le-argb.nut -570f8d6b51a838aed022ef67535f6bdc *./tests/data/lavfi/pixfmts_scale_le-bgr24.nut -3001203 ./tests/data/lavfi/pixfmts_scale_le-bgr24.nut -ee1d35a7baf8e9016891929a2f565c0b *./tests/data/lavfi/pixfmts_scale_le-bgr4_byte.nut -1001203 ./tests/data/lavfi/pixfmts_scale_le-bgr4_byte.nut -36b745067197f9ca8c1731cac51329c9 *./tests/data/lavfi/pixfmts_scale_le-bgr555le.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-bgr555le.nut -3a514a298c6161a071ddf9963c06509d *./tests/data/lavfi/pixfmts_scale_le-bgr565le.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-bgr565le.nut -7f007fa6c153a16e808a9c51605a4016 *./tests/data/lavfi/pixfmts_scale_le-bgr8.nut -1001203 ./tests/data/lavfi/pixfmts_scale_le-bgr8.nut -a5e7040f9a80cccd65e5acf2ca09ace5 *./tests/data/lavfi/pixfmts_scale_le-bgra.nut -4001453 ./tests/data/lavfi/pixfmts_scale_le-bgra.nut -d7786a7d9d99ac74230cc045cab5632c *./tests/data/lavfi/pixfmts_scale_le-gray.nut -1001203 ./tests/data/lavfi/pixfmts_scale_le-gray.nut -af39ce3a497f6734b157c8b94544f537 *./tests/data/lavfi/pixfmts_scale_le-gray16be.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-gray16be.nut -7ac1b788bcc472010df7a97e762485e0 *./tests/data/lavfi/pixfmts_scale_le-gray16le.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-gray16le.nut -88c4c050758e64d120f50c7eff694381 *./tests/data/lavfi/pixfmts_scale_le-monob.nut -125371 ./tests/data/lavfi/pixfmts_scale_le-monob.nut -d31772ebaa877fc2a78565937f7f9673 *./tests/data/lavfi/pixfmts_scale_le-monow.nut -125371 ./tests/data/lavfi/pixfmts_scale_le-monow.nut -4676d59db43d657dc12841f6bc3ab452 *./tests/data/lavfi/pixfmts_scale_le-nv12.nut -1501203 ./tests/data/lavfi/pixfmts_scale_le-nv12.nut -69c699510ff1fb777b118ebee1002f14 *./tests/data/lavfi/pixfmts_scale_le-nv21.nut -1501203 ./tests/data/lavfi/pixfmts_scale_le-nv21.nut -514692e28e8ff6860e415ce4fcf6eb8c *./tests/data/lavfi/pixfmts_scale_le-rgb24.nut -3001203 ./tests/data/lavfi/pixfmts_scale_le-rgb24.nut -1894cd30dabcd3180518e4d5f09f25e7 *./tests/data/lavfi/pixfmts_scale_le-rgb48be.nut -6001453 ./tests/data/lavfi/pixfmts_scale_le-rgb48be.nut -1354e6e27ce3c1d4d4989ee56030c94b *./tests/data/lavfi/pixfmts_scale_le-rgb48le.nut -6001453 ./tests/data/lavfi/pixfmts_scale_le-rgb48le.nut -d81ffd3add95842a618eec81024f0b5c *./tests/data/lavfi/pixfmts_scale_le-rgb4_byte.nut -1001203 ./tests/data/lavfi/pixfmts_scale_le-rgb4_byte.nut -a350ef1dc2c9688ed49e7ba018843795 *./tests/data/lavfi/pixfmts_scale_le-rgb555le.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-rgb555le.nut -6f4bb711238baa762d73305213f8d035 *./tests/data/lavfi/pixfmts_scale_le-rgb565le.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-rgb565le.nut -091d0170b354ef0e97312b95feb5483f *./tests/data/lavfi/pixfmts_scale_le-rgb8.nut -1001203 ./tests/data/lavfi/pixfmts_scale_le-rgb8.nut -a3d362f222098a00e63867f612018659 *./tests/data/lavfi/pixfmts_scale_le-rgba.nut -4001453 ./tests/data/lavfi/pixfmts_scale_le-rgba.nut -314bd486277111a95d9369b944fa0400 *./tests/data/lavfi/pixfmts_scale_le-uyvy422.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-uyvy422.nut -7df8f6d69b56a8dcb6c7ee908e5018b5 *./tests/data/lavfi/pixfmts_scale_le-yuv410p.nut -1126203 ./tests/data/lavfi/pixfmts_scale_le-yuv410p.nut -1143e7c5cc28fe0922b051b17733bc4c *./tests/data/lavfi/pixfmts_scale_le-yuv411p.nut -1501203 ./tests/data/lavfi/pixfmts_scale_le-yuv411p.nut -fdad2d8df8985e3d17e73c71f713cb14 *./tests/data/lavfi/pixfmts_scale_le-yuv420p.nut -1501203 ./tests/data/lavfi/pixfmts_scale_le-yuv420p.nut -29a0265764530070f5cd3251cc01f66a *./tests/data/lavfi/pixfmts_scale_le-yuv420p16be.nut -3001203 ./tests/data/lavfi/pixfmts_scale_le-yuv420p16be.nut -6f3a265b084a78baec229238d9f7945f *./tests/data/lavfi/pixfmts_scale_le-yuv420p16le.nut -3001203 ./tests/data/lavfi/pixfmts_scale_le-yuv420p16le.nut -918e37701ee7377d16a8a6c119c56a40 *./tests/data/lavfi/pixfmts_scale_le-yuv422p.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-yuv422p.nut -ef3e865fc1d0c68977c735323c50af6e *./tests/data/lavfi/pixfmts_scale_le-yuv422p16be.nut -4001453 ./tests/data/lavfi/pixfmts_scale_le-yuv422p16be.nut -428a9b96214c09cb5a983ce36d6961ff *./tests/data/lavfi/pixfmts_scale_le-yuv422p16le.nut -4001453 ./tests/data/lavfi/pixfmts_scale_le-yuv422p16le.nut -461503fdb9b90451020aa3b25ddf041c *./tests/data/lavfi/pixfmts_scale_le-yuv440p.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-yuv440p.nut -81b2eba962d12e8d64f003ac56f6faf2 *./tests/data/lavfi/pixfmts_scale_le-yuv444p.nut -3001203 ./tests/data/lavfi/pixfmts_scale_le-yuv444p.nut -99a3738c70c8fbdc5a0e4ad4bf50648d *./tests/data/lavfi/pixfmts_scale_le-yuv444p16be.nut -6001453 ./tests/data/lavfi/pixfmts_scale_le-yuv444p16be.nut -385d0cc5240d62da0871915be5d86f0a *./tests/data/lavfi/pixfmts_scale_le-yuv444p16le.nut -6001453 ./tests/data/lavfi/pixfmts_scale_le-yuv444p16le.nut -8673a9131fb47de69788863f93a50eb7 *./tests/data/lavfi/pixfmts_scale_le-yuva420p.nut -2501203 ./tests/data/lavfi/pixfmts_scale_le-yuva420p.nut -30427bd6caf5bda93a173dbebe759e09 *./tests/data/lavfi/pixfmts_scale_le-yuvj420p.nut -1501203 ./tests/data/lavfi/pixfmts_scale_le-yuvj420p.nut -fc8288f64fd149573f73cf8da05d8e6d *./tests/data/lavfi/pixfmts_scale_le-yuvj422p.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-yuvj422p.nut -26d0b4713a87ab9637a4062c22e6e70d *./tests/data/lavfi/pixfmts_scale_le-yuvj440p.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-yuvj440p.nut -894e6184d987a5ec4dc6f77bb75ef38c *./tests/data/lavfi/pixfmts_scale_le-yuvj444p.nut -3001203 ./tests/data/lavfi/pixfmts_scale_le-yuvj444p.nut -169e19ac91b257bd84ace0fdf56559ad *./tests/data/lavfi/pixfmts_scale_le-yuyv422.nut -2001203 ./tests/data/lavfi/pixfmts_scale_le-yuyv422.nut +abgr d894cb97f6c80eb21bdbe8a4eea62d86 +argb 54346f2b2eef10919e0f247241df3b24 +bgr24 570f8d6b51a838aed022ef67535f6bdc +bgr4_byte ee1d35a7baf8e9016891929a2f565c0b +bgr555le 36b745067197f9ca8c1731cac51329c9 +bgr565le 3a514a298c6161a071ddf9963c06509d +bgr8 7f007fa6c153a16e808a9c51605a4016 +bgra a5e7040f9a80cccd65e5acf2ca09ace5 +gray d7786a7d9d99ac74230cc045cab5632c +gray16be af39ce3a497f6734b157c8b94544f537 +gray16le 7ac1b788bcc472010df7a97e762485e0 +monob 88c4c050758e64d120f50c7eff694381 +monow d31772ebaa877fc2a78565937f7f9673 +nv12 4676d59db43d657dc12841f6bc3ab452 +nv21 69c699510ff1fb777b118ebee1002f14 +rgb24 514692e28e8ff6860e415ce4fcf6eb8c +rgb48be 1894cd30dabcd3180518e4d5f09f25e7 +rgb48le 1354e6e27ce3c1d4d4989ee56030c94b +rgb4_byte d81ffd3add95842a618eec81024f0b5c +rgb555le a350ef1dc2c9688ed49e7ba018843795 +rgb565le 6f4bb711238baa762d73305213f8d035 +rgb8 091d0170b354ef0e97312b95feb5483f +rgba a3d362f222098a00e63867f612018659 +uyvy422 314bd486277111a95d9369b944fa0400 +yuv410p 7df8f6d69b56a8dcb6c7ee908e5018b5 +yuv411p 1143e7c5cc28fe0922b051b17733bc4c +yuv420p fdad2d8df8985e3d17e73c71f713cb14 +yuv420p16be 29a0265764530070f5cd3251cc01f66a +yuv420p16le 6f3a265b084a78baec229238d9f7945f +yuv422p 918e37701ee7377d16a8a6c119c56a40 +yuv422p16be ef3e865fc1d0c68977c735323c50af6e +yuv422p16le 428a9b96214c09cb5a983ce36d6961ff +yuv440p 461503fdb9b90451020aa3b25ddf041c +yuv444p 81b2eba962d12e8d64f003ac56f6faf2 +yuv444p16be 99a3738c70c8fbdc5a0e4ad4bf50648d +yuv444p16le 385d0cc5240d62da0871915be5d86f0a +yuva420p 8673a9131fb47de69788863f93a50eb7 +yuvj420p 30427bd6caf5bda93a173dbebe759e09 +yuvj422p fc8288f64fd149573f73cf8da05d8e6d +yuvj440p 26d0b4713a87ab9637a4062c22e6e70d +yuvj444p 894e6184d987a5ec4dc6f77bb75ef38c +yuyv422 169e19ac91b257bd84ace0fdf56559ad diff --git a/tests/ref/lavfi/pixfmts_vflip_le b/tests/ref/lavfi/pixfmts_vflip_le index 15e899a2ba..3b140a2c13 100644 --- a/tests/ref/lavfi/pixfmts_vflip_le +++ b/tests/ref/lavfi/pixfmts_vflip_le @@ -1,84 +1,42 @@ -25e72e9dbd01ab00727c976d577f7be5 *./tests/data/lavfi/pixfmts_vflip_le-abgr.nut -20276703 ./tests/data/lavfi/pixfmts_vflip_le-abgr.nut -19869bf1a5ac0b6af4d8bbe2c104533c *./tests/data/lavfi/pixfmts_vflip_le-argb.nut -20276703 ./tests/data/lavfi/pixfmts_vflip_le-argb.nut -89108a4ba00201f79b75b9305c42352d *./tests/data/lavfi/pixfmts_vflip_le-bgr24.nut -15207903 ./tests/data/lavfi/pixfmts_vflip_le-bgr24.nut -407fcf564ed764c38e1d748f700ab921 *./tests/data/lavfi/pixfmts_vflip_le-bgr4_byte.nut -5070254 ./tests/data/lavfi/pixfmts_vflip_le-bgr4_byte.nut -bd7b3ec4d684dfad075d89a606cb8b74 *./tests/data/lavfi/pixfmts_vflip_le-bgr555le.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-bgr555le.nut -fdb617533e1e7ff512ea5b6b6233e738 *./tests/data/lavfi/pixfmts_vflip_le-bgr565le.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-bgr565le.nut -c60f93fd152c6903391d1fe9decd3547 *./tests/data/lavfi/pixfmts_vflip_le-bgr8.nut -5070254 ./tests/data/lavfi/pixfmts_vflip_le-bgr8.nut -7f9b799fb48544e49ce93e91d7f9fca8 *./tests/data/lavfi/pixfmts_vflip_le-bgra.nut -20276703 ./tests/data/lavfi/pixfmts_vflip_le-bgra.nut -30d9014a9d43b5f37e7aa64be3a3ecfc *./tests/data/lavfi/pixfmts_vflip_le-gray.nut -5070254 ./tests/data/lavfi/pixfmts_vflip_le-gray.nut -6b84b85d3326182fa1217e138249edc5 *./tests/data/lavfi/pixfmts_vflip_le-gray16be.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-gray16be.nut -66bb8faa09dc149734aca3c768a6d4e1 *./tests/data/lavfi/pixfmts_vflip_le-gray16le.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-gray16le.nut -d0cf8732677a5360b6160133043590d8 *./tests/data/lavfi/pixfmts_vflip_le-monob.nut -634329 ./tests/data/lavfi/pixfmts_vflip_le-monob.nut -ff9869d067ecb94eb9d90c9750c31fea *./tests/data/lavfi/pixfmts_vflip_le-monow.nut -634329 ./tests/data/lavfi/pixfmts_vflip_le-monow.nut -046f00f598ce14d9854a3534a5c99114 *./tests/data/lavfi/pixfmts_vflip_le-nv12.nut -7604654 ./tests/data/lavfi/pixfmts_vflip_le-nv12.nut -01ea369dd2d0d3ed7451dc5c8d61497f *./tests/data/lavfi/pixfmts_vflip_le-nv21.nut -7604654 ./tests/data/lavfi/pixfmts_vflip_le-nv21.nut -eaefabc168d0b14576bab45bc1e56e1e *./tests/data/lavfi/pixfmts_vflip_le-rgb24.nut -15207903 ./tests/data/lavfi/pixfmts_vflip_le-rgb24.nut -4e0c384163ebab06a08e74637beb02bc *./tests/data/lavfi/pixfmts_vflip_le-rgb48be.nut -30414303 ./tests/data/lavfi/pixfmts_vflip_le-rgb48be.nut -a77bfeefcd96750cf0e1917a2e2bf1e7 *./tests/data/lavfi/pixfmts_vflip_le-rgb48le.nut -30414303 ./tests/data/lavfi/pixfmts_vflip_le-rgb48le.nut -8c6ff02df0b06dd2d574836c3741b2a2 *./tests/data/lavfi/pixfmts_vflip_le-rgb4_byte.nut -5070254 ./tests/data/lavfi/pixfmts_vflip_le-rgb4_byte.nut -4f8eaad29a17e0f8e9d8ab743e76b999 *./tests/data/lavfi/pixfmts_vflip_le-rgb555le.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-rgb555le.nut -73f247a3315dceaea3022ac7c197c5ef *./tests/data/lavfi/pixfmts_vflip_le-rgb565le.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-rgb565le.nut -13a8d89ef78d8127297d899005456ff0 *./tests/data/lavfi/pixfmts_vflip_le-rgb8.nut -5070254 ./tests/data/lavfi/pixfmts_vflip_le-rgb8.nut -1fc6e920a42ec812aaa3b2aa02f37987 *./tests/data/lavfi/pixfmts_vflip_le-rgba.nut -20276703 ./tests/data/lavfi/pixfmts_vflip_le-rgba.nut -ffbd36720c77398d9a0d03ce2625928f *./tests/data/lavfi/pixfmts_vflip_le-uyvy422.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-uyvy422.nut -7bfb39d7afb49d6a6173e6b23ae321eb *./tests/data/lavfi/pixfmts_vflip_le-yuv410p.nut -5703854 ./tests/data/lavfi/pixfmts_vflip_le-yuv410p.nut -4a90048cc3a65fac150e53289700efe1 *./tests/data/lavfi/pixfmts_vflip_le-yuv411p.nut -7604654 ./tests/data/lavfi/pixfmts_vflip_le-yuv411p.nut -2e6d6062e8cad37fb3ab2c433b55f382 *./tests/data/lavfi/pixfmts_vflip_le-yuv420p.nut -7604654 ./tests/data/lavfi/pixfmts_vflip_le-yuv420p.nut -539076782902664a8acf381bf4f713e8 *./tests/data/lavfi/pixfmts_vflip_le-yuv420p16be.nut -15207903 ./tests/data/lavfi/pixfmts_vflip_le-yuv420p16be.nut -0f609e588e5a258644ef85170d70e030 *./tests/data/lavfi/pixfmts_vflip_le-yuv420p16le.nut -15207903 ./tests/data/lavfi/pixfmts_vflip_le-yuv420p16le.nut -d7f5cb44d9b0210d66d6a8762640ab34 *./tests/data/lavfi/pixfmts_vflip_le-yuv422p.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuv422p.nut -9bd8f8c961822b586fa4cf992be54acc *./tests/data/lavfi/pixfmts_vflip_le-yuv422p16be.nut -20276703 ./tests/data/lavfi/pixfmts_vflip_le-yuv422p16be.nut -9c4a1239605c7952b736ac3130163f14 *./tests/data/lavfi/pixfmts_vflip_le-yuv422p16le.nut -20276703 ./tests/data/lavfi/pixfmts_vflip_le-yuv422p16le.nut -876385e96165acf51271b20e5d85a416 *./tests/data/lavfi/pixfmts_vflip_le-yuv440p.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuv440p.nut -9c3c667d1613b72d15bc6d851c5eb8f7 *./tests/data/lavfi/pixfmts_vflip_le-yuv444p.nut -15207903 ./tests/data/lavfi/pixfmts_vflip_le-yuv444p.nut -0f4afa4a4aacf4bb6b87641abde71ea9 *./tests/data/lavfi/pixfmts_vflip_le-yuv444p16be.nut -30414303 ./tests/data/lavfi/pixfmts_vflip_le-yuv444p16be.nut -8f31557bc52adfe00ae8b40a9b8c23f8 *./tests/data/lavfi/pixfmts_vflip_le-yuv444p16le.nut -30414303 ./tests/data/lavfi/pixfmts_vflip_le-yuv444p16le.nut -c705d1cf061d8c6580ac690b55f92276 *./tests/data/lavfi/pixfmts_vflip_le-yuva420p.nut -12673454 ./tests/data/lavfi/pixfmts_vflip_le-yuva420p.nut -41fd02b204da0ab62452cd14b595e2e4 *./tests/data/lavfi/pixfmts_vflip_le-yuvj420p.nut -7604654 ./tests/data/lavfi/pixfmts_vflip_le-yuvj420p.nut -7f6ca9bc1812cde02036d7d29a7cce43 *./tests/data/lavfi/pixfmts_vflip_le-yuvj422p.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuvj422p.nut -40591908cca457f51dee30a86c3e8ffd *./tests/data/lavfi/pixfmts_vflip_le-yuvj440p.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuvj440p.nut -77e5e095881c52a04fd9f5abd1d7b5ac *./tests/data/lavfi/pixfmts_vflip_le-yuvj444p.nut -15207903 ./tests/data/lavfi/pixfmts_vflip_le-yuvj444p.nut -e944ff7316cd03c42c091717ce74f602 *./tests/data/lavfi/pixfmts_vflip_le-yuyv422.nut -10139054 ./tests/data/lavfi/pixfmts_vflip_le-yuyv422.nut +abgr 25e72e9dbd01ab00727c976d577f7be5 +argb 19869bf1a5ac0b6af4d8bbe2c104533c +bgr24 89108a4ba00201f79b75b9305c42352d +bgr4_byte 407fcf564ed764c38e1d748f700ab921 +bgr555le bd7b3ec4d684dfad075d89a606cb8b74 +bgr565le fdb617533e1e7ff512ea5b6b6233e738 +bgr8 c60f93fd152c6903391d1fe9decd3547 +bgra 7f9b799fb48544e49ce93e91d7f9fca8 +gray 30d9014a9d43b5f37e7aa64be3a3ecfc +gray16be 6b84b85d3326182fa1217e138249edc5 +gray16le 66bb8faa09dc149734aca3c768a6d4e1 +monob d0cf8732677a5360b6160133043590d8 +monow ff9869d067ecb94eb9d90c9750c31fea +nv12 046f00f598ce14d9854a3534a5c99114 +nv21 01ea369dd2d0d3ed7451dc5c8d61497f +rgb24 eaefabc168d0b14576bab45bc1e56e1e +rgb48be 4e0c384163ebab06a08e74637beb02bc +rgb48le a77bfeefcd96750cf0e1917a2e2bf1e7 +rgb4_byte 8c6ff02df0b06dd2d574836c3741b2a2 +rgb555le 4f8eaad29a17e0f8e9d8ab743e76b999 +rgb565le 73f247a3315dceaea3022ac7c197c5ef +rgb8 13a8d89ef78d8127297d899005456ff0 +rgba 1fc6e920a42ec812aaa3b2aa02f37987 +uyvy422 ffbd36720c77398d9a0d03ce2625928f +yuv410p 7bfb39d7afb49d6a6173e6b23ae321eb +yuv411p 4a90048cc3a65fac150e53289700efe1 +yuv420p 2e6d6062e8cad37fb3ab2c433b55f382 +yuv420p16be 539076782902664a8acf381bf4f713e8 +yuv420p16le 0f609e588e5a258644ef85170d70e030 +yuv422p d7f5cb44d9b0210d66d6a8762640ab34 +yuv422p16be 9bd8f8c961822b586fa4cf992be54acc +yuv422p16le 9c4a1239605c7952b736ac3130163f14 +yuv440p 876385e96165acf51271b20e5d85a416 +yuv444p 9c3c667d1613b72d15bc6d851c5eb8f7 +yuv444p16be 0f4afa4a4aacf4bb6b87641abde71ea9 +yuv444p16le 8f31557bc52adfe00ae8b40a9b8c23f8 +yuva420p c705d1cf061d8c6580ac690b55f92276 +yuvj420p 41fd02b204da0ab62452cd14b595e2e4 +yuvj422p 7f6ca9bc1812cde02036d7d29a7cce43 +yuvj440p 40591908cca457f51dee30a86c3e8ffd +yuvj444p 77e5e095881c52a04fd9f5abd1d7b5ac +yuyv422 e944ff7316cd03c42c091717ce74f602 diff --git a/tests/ref/lavfi/scale200 b/tests/ref/lavfi/scale200 index 6bbe88b314..17103a256d 100644 --- a/tests/ref/lavfi/scale200 +++ b/tests/ref/lavfi/scale200 @@ -1,2 +1 @@ -aebdc1c3e08da2a925ba7212b1fadee0 *./tests/data/lavfi/scale200.nut -3001204 ./tests/data/lavfi/scale200.nut +scale200 aebdc1c3e08da2a925ba7212b1fadee0 diff --git a/tests/ref/lavfi/scale500 b/tests/ref/lavfi/scale500 index 52e84955d9..93ba4f2485 100644 --- a/tests/ref/lavfi/scale500 +++ b/tests/ref/lavfi/scale500 @@ -1,2 +1 @@ -ef865c51156e55ce1ce38c8f90a709e6 *./tests/data/lavfi/scale500.nut -18751503 ./tests/data/lavfi/scale500.nut +scale500 ef865c51156e55ce1ce38c8f90a709e6 diff --git a/tests/ref/lavfi/vflip b/tests/ref/lavfi/vflip index 977f2d2558..66b873270a 100644 --- a/tests/ref/lavfi/vflip +++ b/tests/ref/lavfi/vflip @@ -1,2 +1 @@ -2e6d6062e8cad37fb3ab2c433b55f382 *./tests/data/lavfi/vflip.nut -7604654 ./tests/data/lavfi/vflip.nut +vflip 2e6d6062e8cad37fb3ab2c433b55f382 diff --git a/tests/ref/lavfi/vflip_crop b/tests/ref/lavfi/vflip_crop index bd198945fa..6bb832f4cc 100644 --- a/tests/ref/lavfi/vflip_crop +++ b/tests/ref/lavfi/vflip_crop @@ -1,2 +1 @@ -72ee0d0dfc8af0cd94a466760313654d *./tests/data/lavfi/vflip_crop.nut -3554654 ./tests/data/lavfi/vflip_crop.nut +vflip_crop 72ee0d0dfc8af0cd94a466760313654d diff --git a/tests/ref/lavfi/vflip_vflip b/tests/ref/lavfi/vflip_vflip index 55595dd5b6..b719745dc6 100644 --- a/tests/ref/lavfi/vflip_vflip +++ b/tests/ref/lavfi/vflip_vflip @@ -1,2 +1 @@ -eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/vflip_vflip.nut -7604654 ./tests/data/lavfi/vflip_vflip.nut +vflip_vflip eba2f135a08829387e2f698ff72a2939 diff --git a/tests/regression-funcs.sh b/tests/regression-funcs.sh index 28da0c1303..3ca3c9c77a 100755 --- a/tests/regression-funcs.sh +++ b/tests/regression-funcs.sh @@ -54,6 +54,12 @@ echov(){ FFMPEG_OPTS="-v 0 -y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact" +run_ffmpeg() +{ + $echov $ffmpeg $FFMPEG_OPTS $* + $ffmpeg $FFMPEG_OPTS $* +} + do_ffmpeg() { f="$1" From 045b80e52df7ba9c97084c946b4929000d5f5bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Fri, 21 Jan 2011 23:55:31 +0100 Subject: [PATCH 041/528] Move ID3v1 skip from decoder to demuxer Signed-off-by: Janne Grunau --- libavcodec/mpegaudiodec.c | 8 -------- libavformat/mp3dec.c | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 76fdffbafe..769be89913 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -27,7 +27,6 @@ #include "avcodec.h" #include "get_bits.h" #include "dsputil.h" -#include "libavformat/id3v1.h" /* * TODO: @@ -2044,13 +2043,6 @@ static int decode_frame(AVCodecContext * avctx, header = AV_RB32(buf); if(ff_mpa_check_header(header) < 0){ - - if (buf_size == ID3v1_TAG_SIZE - && buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G') { - *data_size = 0; - return ID3v1_TAG_SIZE; - } - av_log(avctx, AV_LOG_ERROR, "Header missing\n"); return -1; } diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index ab6aabe0b5..c06969b058 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -174,6 +174,11 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) if (ret <= 0) { return AVERROR(EIO); } + + if (ret > ID3v1_TAG_SIZE && + memcmp(&pkt->data[ret - ID3v1_TAG_SIZE], "TAG", 3) == 0) + ret -= ID3v1_TAG_SIZE; + /* note: we need to modify the packet size here to handle the last packet */ pkt->size = ret; From 8c3caf7fb1be2eb6eb4683b1a0383cba5c25ee19 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 22 Jan 2011 02:00:13 +0100 Subject: [PATCH 042/528] mp3enc: handle errors in id3v2_put_ttag make the initialization of put clearer this are the differences between [FFmpeg-devel] [PATCH 1/3] mp3enc: add support for writing UTF-16 tags and the already applied 187e23478bc5c066ff8eef562925471ac179644e Signed-off-by: Janne Grunau --- libavformat/mp3enc.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index e6dcf6aefc..db180d66e8 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -79,23 +79,25 @@ static void id3v2_put_size(AVFormatContext *s, int size) /** * Write a text frame with one (normal frames) or two (TXXX frames) strings * according to encoding (only UTF-8 or UTF-16+BOM supported). - * @return number of bytes written. + * @return number of bytes written or a negative error code. */ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2, - uint32_t tag, enum ID3v2Encoding enc) + uint32_t tag, enum ID3v2Encoding enc) { int len; uint8_t *pb; - void (*put)(ByteIOContext*, const char*) = avio_put_str; + int (*put)(ByteIOContext*, const char*); ByteIOContext *dyn_buf; if (url_open_dyn_buf(&dyn_buf) < 0) - return 0; + return AVERROR(ENOMEM); put_byte(dyn_buf, enc); if (enc == ID3v2_ENCODING_UTF16BOM) { put_le16(dyn_buf, 0xFEFF); /* BOM */ put = avio_put_str16le; - } + } else + put = avio_put_str; + put(dyn_buf, str1); if (str2) put(dyn_buf, str2); @@ -167,20 +169,25 @@ static int mp3_write_header(struct AVFormatContext *s) 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; + int ret; if (t->key[0] == 'T' && strlen(t->key) == 4) { int i; for (i = 0; *ff_id3v2_tags[i]; i++) if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) { tag = AV_RB32(t->key); - totlen += id3v2_put_ttag(s, t->value, NULL, tag, ID3v2_ENCODING_UTF8); + if ((ret = id3v2_put_ttag(s, t->value, NULL, tag, ID3v2_ENCODING_UTF8)) < 0) + return ret; + totlen += ret; break; } } if (!tag) { /* unknown tag, write as TXXX frame */ tag = MKBETAG('T', 'X', 'X', 'X'); - totlen += id3v2_put_ttag(s, t->key, t->value, tag, ID3v2_ENCODING_UTF8); + if ((ret = id3v2_put_ttag(s, t->key, t->value, tag, ID3v2_ENCODING_UTF8)) < 0) + return ret; + totlen += ret; } } From cb6bc57681b2ec5232e64db176f41fb2517de146 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 21 Jan 2011 19:54:34 +0000 Subject: [PATCH 043/528] id3v2: split tables for various ID3v2 versions This is needed for upcoming ID3v2.3 muxing support. Signed-off-by: Janne Grunau --- libavformat/id3v2.c | 63 +++++++++++++++++++++++++++++--------------- libavformat/id3v2.h | 17 ++++++++++-- libavformat/mp3enc.c | 46 +++++++++++++++++++------------- 3 files changed, 85 insertions(+), 41 deletions(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 62eee15591..7cedf6e698 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -273,46 +273,67 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) url_fseek(s->pb, off, SEEK_SET); } } while (found_header); - ff_metadata_conv(&s->metadata, NULL, ff_id3v2_metadata_conv); + ff_metadata_conv(&s->metadata, NULL, ff_id3v2_34_metadata_conv); + ff_metadata_conv(&s->metadata, NULL, ff_id3v2_2_metadata_conv); + ff_metadata_conv(&s->metadata, NULL, ff_id3v2_4_metadata_conv); } -const AVMetadataConv ff_id3v2_metadata_conv[] = { +const AVMetadataConv ff_id3v2_34_metadata_conv[] = { { "TALB", "album"}, - { "TAL", "album"}, { "TCOM", "composer"}, { "TCON", "genre"}, - { "TCO", "genre"}, { "TCOP", "copyright"}, - { "TDRL", "date"}, - { "TDRC", "date"}, - { "TDEN", "creation_time"}, { "TENC", "encoded_by"}, - { "TEN", "encoded_by"}, { "TIT2", "title"}, - { "TT2", "title"}, { "TLAN", "language"}, { "TPE1", "artist"}, - { "TP1", "artist"}, { "TPE2", "album_artist"}, - { "TP2", "album_artist"}, { "TPE3", "performer"}, - { "TP3", "performer"}, { "TPOS", "disc"}, { "TPUB", "publisher"}, { "TRCK", "track"}, - { "TRK", "track"}, - { "TSOA", "album-sort"}, - { "TSOP", "artist-sort"}, - { "TSOT", "title-sort"}, { "TSSE", "encoder"}, { 0 } }; +const AVMetadataConv ff_id3v2_4_metadata_conv[] = { + { "TDRL", "date"}, + { "TDRC", "date"}, + { "TDEN", "creation_time"}, + { "TSOA", "album-sort"}, + { "TSOP", "artist-sort"}, + { "TSOT", "title-sort"}, + { 0 } +}; + +const AVMetadataConv ff_id3v2_2_metadata_conv[] = { + { "TAL", "album"}, + { "TCO", "genre"}, + { "TT2", "title"}, + { "TEN", "encoded_by"}, + { "TP1", "artist"}, + { "TP2", "album_artist"}, + { "TP3", "performer"}, + { "TRK", "track"}, + { 0 } +}; + + const char ff_id3v2_tags[][4] = { - "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDEN", "TDLY", "TDOR", "TDRC", - "TDRL", "TDTG", "TENC", "TEXT", "TFLT", "TIPL", "TIT1", "TIT2", "TIT3", - "TKEY", "TLAN", "TLEN", "TMCL", "TMED", "TMOO", "TOAL", "TOFN", "TOLY", - "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", "TPE4", "TPOS", "TPRO", "TPUB", - "TRCK", "TRSN", "TRSO", "TSOA", "TSOP", "TSOT", "TSRC", "TSSE", "TSST", + "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDLY", "TENC", "TEXT", + "TFLT", "TIT1", "TIT2", "TIT3", "TKEY", "TLAN", "TLEN", "TMED", + "TOAL", "TOFN", "TOLY", "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", + "TPE4", "TPOS", "TPUB", "TRCK", "TRSN", "TRSO", "TSRC", "TSSE", + { 0 }, +}; + +const char ff_id3v2_4_tags[][4] = { + "TDEN", "TDOR", "TDRC", "TDRL", "TDTG", "TIPL", "TMCL", "TMOO", + "TPRO", "TSOA", "TSOP", "TSOT", "TSST", + { 0 }, +}; + +const char ff_id3v2_3_tags[][4] = { + "TDAT", "TIME", "TORY", "TRDA", "TSIZ", "TYER", { 0 }, }; diff --git a/libavformat/id3v2.h b/libavformat/id3v2.h index c2e1add849..e429001385 100644 --- a/libavformat/id3v2.h +++ b/libavformat/id3v2.h @@ -65,12 +65,25 @@ int ff_id3v2_tag_len(const uint8_t *buf); */ void ff_id3v2_read(AVFormatContext *s, const char *magic); -extern const AVMetadataConv ff_id3v2_metadata_conv[]; +extern const AVMetadataConv ff_id3v2_34_metadata_conv[]; +extern const AVMetadataConv ff_id3v2_4_metadata_conv[]; +extern const AVMetadataConv ff_id3v2_2_metadata_conv[]; /** - * A list of ID3v2.4 text information frames. + * A list of text information frames allowed in both ID3 v2.3 and v2.4 * http://www.id3.org/id3v2.4.0-frames + * http://www.id3.org/id3v2.4.0-changes */ extern const char ff_id3v2_tags[][4]; +/** + * ID3v2.4-only text information frames. + */ +extern const char ff_id3v2_4_tags[][4]; + +/** + * ID3v2.3-only text information frames. + */ +extern const char ff_id3v2_3_tags[][4]; + #endif /* AVFORMAT_ID3V2_H */ diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index db180d66e8..f55e12319c 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -148,6 +148,20 @@ AVOutputFormat mp2_muxer = { #endif #if CONFIG_MP3_MUXER +static int id3v2_check_write_tag(AVFormatContext *s, AVMetadataTag *t, const char table[][4]) +{ + uint32_t tag; + int i; + + if (t->key[0] != 'T' || strlen(t->key) != 4) + return -1; + tag = AV_RB32(t->key); + for (i = 0; *table[i]; i++) + if (tag == AV_RB32(table[i])) + return id3v2_put_ttag(s, t->value, NULL, tag, ID3v2_ENCODING_UTF8); + return -1; +} + /** * Write an ID3v2.4 header at beginning of stream */ @@ -166,29 +180,25 @@ static int mp3_write_header(struct AVFormatContext *s) size_pos = url_ftell(s->pb); put_be32(s->pb, 0); - ff_metadata_conv(&s->metadata, ff_id3v2_metadata_conv, NULL); + ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL); + ff_metadata_conv(&s->metadata, ff_id3v2_4_metadata_conv, NULL); while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) { - uint32_t tag = 0; int ret; - if (t->key[0] == 'T' && strlen(t->key) == 4) { - int i; - for (i = 0; *ff_id3v2_tags[i]; i++) - if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) { - tag = AV_RB32(t->key); - if ((ret = id3v2_put_ttag(s, t->value, NULL, tag, ID3v2_ENCODING_UTF8)) < 0) - return ret; - totlen += ret; - break; - } + if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_tags)) > 0) { + totlen += ret; + continue; + } + if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_4_tags)) > 0) { + totlen += ret; + continue; } - if (!tag) { /* unknown tag, write as TXXX frame */ - tag = MKBETAG('T', 'X', 'X', 'X'); - if ((ret = id3v2_put_ttag(s, t->key, t->value, tag, ID3v2_ENCODING_UTF8)) < 0) - return ret; - totlen += ret; - } + /* unknown tag, write as TXXX frame */ + if ((ret = id3v2_put_ttag(s, t->key, t->value, MKBETAG('T', 'X', 'X', 'X'), + ID3v2_ENCODING_UTF8)) < 0) + return ret; + totlen += ret; } cur_pos = url_ftell(s->pb); From 22272f61bb0b164b53c132ba0804842b66b871e0 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 21 Jan 2011 19:54:35 +0000 Subject: [PATCH 044/528] mp3enc: support for id3v2.3 tags using a per-muxer AVOption fixes issue2562. Signed-off-by: Janne Grunau --- libavformat/mp3enc.c | 47 +++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index f55e12319c..139f2d414a 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -24,6 +24,7 @@ #include "id3v1.h" #include "id3v2.h" #include "libavutil/intreadwrite.h" +#include "libavutil/opt.h" static int id3v1_set_string(AVFormatContext *s, const char *key, uint8_t *buf, int buf_size) @@ -148,7 +149,26 @@ AVOutputFormat mp2_muxer = { #endif #if CONFIG_MP3_MUXER -static int id3v2_check_write_tag(AVFormatContext *s, AVMetadataTag *t, const char table[][4]) +typedef struct MP3Context { + const AVClass *class; + int id3v2_version; +} MP3Context; + +static const AVOption options[] = { + { "id3v2_version", "Select ID3v2 version to write. Currently 3 and 4 are supported.", + offsetof(MP3Context, id3v2_version), FF_OPT_TYPE_INT, 4, 3, 4, AV_OPT_FLAG_ENCODING_PARAM}, + { NULL }, +}; + +static const AVClass mp3_muxer_class = { + "MP3 muxer", + av_default_item_name, + options, + LIBAVUTIL_VERSION_INT, +}; + +static int id3v2_check_write_tag(AVFormatContext *s, AVMetadataTag *t, const char table[][4], + enum ID3v2Encoding enc) { uint32_t tag; int i; @@ -158,21 +178,23 @@ static int id3v2_check_write_tag(AVFormatContext *s, AVMetadataTag *t, const cha tag = AV_RB32(t->key); for (i = 0; *table[i]; i++) if (tag == AV_RB32(table[i])) - return id3v2_put_ttag(s, t->value, NULL, tag, ID3v2_ENCODING_UTF8); + return id3v2_put_ttag(s, t->value, NULL, tag, enc); return -1; } /** - * Write an ID3v2.4 header at beginning of stream + * Write an ID3v2 header at beginning of stream */ static int mp3_write_header(struct AVFormatContext *s) { + MP3Context *mp3 = s->priv_data; AVMetadataTag *t = NULL; - int totlen = 0; + int totlen = 0, enc = mp3->id3v2_version == 3 ? ID3v2_ENCODING_UTF16BOM : + ID3v2_ENCODING_UTF8; int64_t size_pos, cur_pos; - put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */ + put_be32(s->pb, MKBETAG('I', 'D', '3', mp3->id3v2_version)); put_byte(s->pb, 0); put_byte(s->pb, 0); /* flags */ @@ -181,22 +203,24 @@ static int mp3_write_header(struct AVFormatContext *s) put_be32(s->pb, 0); ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL); - ff_metadata_conv(&s->metadata, ff_id3v2_4_metadata_conv, NULL); + if (mp3->id3v2_version == 4) + ff_metadata_conv(&s->metadata, ff_id3v2_4_metadata_conv, NULL); + while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) { int ret; - if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_tags)) > 0) { + if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_tags, enc)) > 0) { totlen += ret; continue; } - if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_4_tags)) > 0) { + if ((ret = id3v2_check_write_tag(s, t, mp3->id3v2_version == 3 ? + ff_id3v2_3_tags : ff_id3v2_4_tags, enc)) > 0) { totlen += ret; continue; } /* unknown tag, write as TXXX frame */ - if ((ret = id3v2_put_ttag(s, t->key, t->value, MKBETAG('T', 'X', 'X', 'X'), - ID3v2_ENCODING_UTF8)) < 0) + if ((ret = id3v2_put_ttag(s, t->key, t->value, MKBETAG('T', 'X', 'X', 'X'), enc)) < 0) return ret; totlen += ret; } @@ -214,12 +238,13 @@ AVOutputFormat mp3_muxer = { NULL_IF_CONFIG_SMALL("MPEG audio layer 3"), "audio/x-mpeg", "mp3", - 0, + sizeof(MP3Context), CODEC_ID_MP3, CODEC_ID_NONE, mp3_write_header, mp3_write_packet, mp3_write_trailer, AVFMT_NOTIMESTAMPS, + .priv_class = &mp3_muxer_class, }; #endif From b92f76e209b6912fb36ea2e588474c48ca231dea Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Fri, 21 Jan 2011 21:58:54 +0000 Subject: [PATCH 045/528] libfaac: add recognized profiles array Signed-off-by: Janne Grunau --- libavcodec/libfaac.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index b220b1714e..e0425377aa 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -145,6 +145,14 @@ static av_cold int Faac_encode_close(AVCodecContext *avctx) return 0; } +static const AVProfile profiles[] = { + { FF_PROFILE_AAC_MAIN, "Main" }, + { FF_PROFILE_AAC_LOW, "LC" }, + { FF_PROFILE_AAC_SSR, "SSR" }, + { FF_PROFILE_AAC_LTP, "LTP" }, + { FF_PROFILE_UNKNOWN }, +}; + AVCodec libfaac_encoder = { "libfaac", AVMEDIA_TYPE_AUDIO, @@ -155,4 +163,5 @@ AVCodec libfaac_encoder = { Faac_encode_close, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"), + .profiles = NULL_IF_CONFIG_SMALL(profiles), }; From 76edf2c1377fdb35609f79a6702081de4d93e331 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 20 Jan 2011 22:20:39 +0000 Subject: [PATCH 046/528] fate: add lossless h264 test Signed-off-by: Mans Rullgard --- tests/fate/h264.mak | 6 +++++- tests/ref/fate/h264-lossless | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/h264-lossless diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak index b4bec536a1..25517feee2 100644 --- a/tests/fate/h264.mak +++ b/tests/fate/h264.mak @@ -164,7 +164,10 @@ FATE_H264 = aud_mw_e \ sva_nl1_b \ sva_nl2_e \ -FATE_H264 := $(FATE_H264:%=fate-h264-conformance-%) fate-h264-interlace-crop +FATE_H264 := $(FATE_H264:%=fate-h264-conformance-%) \ + fate-h264-interlace-crop \ + fate-h264-lossless \ + FATE_TESTS += $(FATE_H264) fate-h264: $(FATE_H264) @@ -335,3 +338,4 @@ fate-h264-conformance-sva_nl1_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/ fate-h264-conformance-sva_nl2_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/SVA_NL2_E.264 fate-h264-interlace-crop: CMD = framecrc -vframes 3 -i $(SAMPLES)/h264/interlaced_crop.mp4 +fate-h264-lossless: CMD = framecrc -i $(SAMPLES)/h264/lossless.h264 diff --git a/tests/ref/fate/h264-lossless b/tests/ref/fate/h264-lossless new file mode 100644 index 0000000000..c6659ca830 --- /dev/null +++ b/tests/ref/fate/h264-lossless @@ -0,0 +1,10 @@ +0, 0, 460800, 0x7731dd2f +0, 1500, 460800, 0x944b8c64 +0, 3000, 460800, 0xbe833041 +0, 4500, 460800, 0xbe95d96a +0, 6000, 460800, 0xfe7ea5e6 +0, 7500, 460800, 0x381743c7 +0, 9000, 460800, 0x63fcc2e9 +0, 10500, 460800, 0x79574960 +0, 12000, 460800, 0xdab9e18a +0, 13500, 460800, 0xd88e8fe8 From 20ac9de3df9b129a4a312d626fed0e2bbb760200 Mon Sep 17 00:00:00 2001 From: Mike Scheutzow Date: Sat, 15 Jan 2011 16:11:55 +0000 Subject: [PATCH 047/528] streamid does not work with newaudio, newvideo, newsubtitle fixes issue2465. The problem is that the ffmpeg (the app) -streamid option did not work with -newaudio/-newvideo/-newsubtitle. The cause was a conflict between the feature where streamid values were reset to default for each output filename, and the implementation of -new*, which requires that the -new* option be specified after the target filename. My patch changes the ffmpeg behavior so that user-specified streamid values apply to all the following output files on the command line (rather than just the next output filename.) Signed-off-by: Janne Grunau --- doc/ffmpeg.texi | 6 ++++-- ffmpeg.c | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index c2fff7cb72..1732c9b4bf 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -712,8 +712,10 @@ Set the maximum demux-decode delay. @item -muxpreload @var{seconds} Set the initial demux-decode delay. @item -streamid @var{output-stream-index}:@var{new-value} -Assign a new value to a stream's stream-id field in the next output file. -All stream-id fields are reset to default for each output file. +Assign a new stream-id value to an output stream. This option should be +specified prior to the output filename to which it applies. +For the situation where multiple output files exist, a streamid +may be reassigned to a different value. For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for an output mpegts file: diff --git a/ffmpeg.c b/ffmpeg.c index 7cce343547..0b2bab2cec 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3816,7 +3816,6 @@ static void opt_output_file(const char *filename) set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL); - nb_streamid_map = 0; av_freep(&forced_key_frames); } From 98cfadd648bfb2ab48e4c18d832e946a1ba050c8 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 21 Jan 2011 20:59:20 +0000 Subject: [PATCH 048/528] 10l: reverse the biquad coefficients. I did not notice that the filter implementation uses a reversed history state. Signed-off-by: Janne Grunau --- libavcodec/iirfilter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 832559cfea..46b4973f85 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -137,15 +137,15 @@ static int biquad_init_coeffs(void *avc, struct FFIIRFilterCoeffs *c, if (filt_mode == FF_FILTER_MODE_HIGHPASS) { c->gain = ((1.0 + cos_w0) / 2.0) / a0; - x0 = (-(1.0 + cos_w0)) / a0; - x1 = ((1.0 + cos_w0) / 2.0) / a0; + x0 = ((1.0 + cos_w0) / 2.0) / a0; + x1 = (-(1.0 + cos_w0)) / a0; } else { // FF_FILTER_MODE_LOWPASS c->gain = ((1.0 - cos_w0) / 2.0) / a0; - x0 = (1.0 - cos_w0) / a0; - x1 = ((1.0 - cos_w0) / 2.0) / a0; + x0 = ((1.0 - cos_w0) / 2.0) / a0; + x1 = (1.0 - cos_w0) / a0; } - c->cy[0] = (2.0 * cos_w0) / a0; - c->cy[1] = (-1.0 + (sin_w0 / 2.0)) / a0; + c->cy[0] = (-1.0 + (sin_w0 / 2.0)) / a0; + c->cy[1] = (2.0 * cos_w0) / a0; // divide by gain to make the x coeffs integers. // during filtering, the delay state will include the gain multiplication From db2ddd38859b26c0a4e4bf92619625cd7e0e7f42 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 22 Jan 2011 11:07:03 +0000 Subject: [PATCH 049/528] Remove outdated and confusing comment. Signed-off-by: Mans Rullgard --- ffplay.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ffplay.c b/ffplay.c index 2a2e8239e3..840df66687 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1569,8 +1569,6 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke return 0; } - /* NOTE: ipts is the PTS of the _first_ picture beginning in - this packet, if any */ is->video_st->codec->reordered_opaque = pkt->pts; len1 = avcodec_decode_video2(is->video_st->codec, frame, &got_picture, From 10ed96c78fde80da9d5bac9b267369861a4f33ba Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Fri, 21 Jan 2011 13:54:14 +0100 Subject: [PATCH 050/528] Amend documentation for the image2 demuxer, to better reflect the current behavior. Signed-off-by: Mans Rullgard --- doc/demuxers.texi | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 5fcaf4ff84..05316ce5cd 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -24,20 +24,18 @@ Image file demuxer. This demuxer reads from a list of image files specified by a pattern. -The filename of each file to read must contain a sequential number, -which specifies the position of the file in the sequence. - -The pattern must contain the string "%d" or "%0@var{N}d", which -specifies the position of the characters representing the seqential +The pattern may contain the string "%d" or "%0@var{N}d", which +specifies the position of the characters representing a sequential number in each filename matched by the pattern. If the form "%d0@var{N}d" is used, the string representing the number in each filename is 0-padded and @var{N} is the total number of 0-padded digits representing the number. The literal character '%' can be specified in the pattern with the string "%%". -The first filename of the file sequence specified by the pattern must -contain a number inclusively contained between 0 and 4, all the -following numbers must be sequential. +If the pattern contains "%d" or "%0@var{N}d", the first filename of +the file list specified by the pattern must contain a number +inclusively contained between 0 and 4, all the following numbers must +be sequential. This limitation may be hopefully fixed. The pattern may contain a suffix which is used to automatically determine the format of the images contained in the files. @@ -59,4 +57,11 @@ second: ffmpeg -r 10 -f image2 -i 'img-%03d.jpeg' out.avi @end example +Note that the pattern must not necessarily contain "%d" or +"%0@var{N}d", for example to convert a single image file +@file{img.jpeg} you can employ the command: +@example +ffmpeg -f image2 -i img.jpeg img.png +@end example + @c man end INPUT DEVICES From 8ae0fa243e1f7a03cb5f23e2d9a32d3cc88b4def Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Sat, 22 Jan 2011 05:23:43 +0000 Subject: [PATCH 051/528] aacenc: mark SBR absent Use backwards compatible explicit signalling to denote the absence of SBR. Signed-off-by: Janne Grunau --- libavcodec/aacenc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index c52ffa0c45..f8f0eb45f6 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -149,6 +149,11 @@ static void put_audio_specific_config(AVCodecContext *avctx) put_bits(&pb, 1, 0); //frame length - 1024 samples put_bits(&pb, 1, 0); //does not depend on core coder put_bits(&pb, 1, 0); //is not extension + + //Explicitly Mark SBR absent + put_bits(&pb, 11, 0x27b); //sync extension + put_bits(&pb, 5, AOT_SBR); + put_bits(&pb, 1, 0); flush_put_bits(&pb); } @@ -193,8 +198,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0])); s->cpe = av_mallocz(sizeof(ChannelElement) * aac_chan_configs[avctx->channels-1][0]); - avctx->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE); - avctx->extradata_size = 2; + avctx->extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE); + avctx->extradata_size = 5; put_audio_specific_config(avctx); sizes[0] = swb_size_1024[i]; From ff3d43104fa5df0a3f4b52ff9b989ce2d11ad35d Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Sat, 22 Jan 2011 03:49:55 +0000 Subject: [PATCH 052/528] Remove H.264 encoder fragments It's incomplete, no one is working on it, and when someone asks about working on it we advise them not to. Signed-off-by: Mans Rullgard --- libavcodec/Makefile | 1 - libavcodec/h264.c | 2 +- libavcodec/h264dspenc.c | 78 ------------ libavcodec/h264enc.c | 260 ---------------------------------------- 4 files changed, 1 insertion(+), 340 deletions(-) delete mode 100644 libavcodec/h264dspenc.c delete mode 100644 libavcodec/h264enc.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 90f07d6247..de1bde0737 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -167,7 +167,6 @@ OBJS-$(CONFIG_H264_DECODER) += h264.o \ h264_refs.o h264_cavlc.o h264_cabac.o\ mpegvideo.o error_resilience.o OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o -OBJS-$(CONFIG_H264_ENCODER) += h264enc.o h264dspenc.o OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 40dc276dd6..52a161bde7 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1,5 +1,5 @@ /* - * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder + * H.26L/H.264/AVC/JVT/14496-10/... decoder * Copyright (c) 2003 Michael Niedermayer * * This file is part of FFmpeg. diff --git a/libavcodec/h264dspenc.c b/libavcodec/h264dspenc.c deleted file mode 100644 index b65a2cc4a2..0000000000 --- a/libavcodec/h264dspenc.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * H.264/MPEG-4 Part 10 (Base profile) encoder. - * - * DSP functions - * - * Copyright (c) 2006 Expertisecentrum Digitale Media, UHasselt - * - * 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 - * H.264 encoder related DSP utils - * - */ - -#include "dsputil.h" - -#define H264_DCT_PART1(X) \ - a = block[0][X]+block[3][X]; \ - c = block[0][X]-block[3][X]; \ - b = block[1][X]+block[2][X]; \ - d = block[1][X]-block[2][X]; \ - pieces[0][X] = a+b; \ - pieces[2][X] = a-b; \ - pieces[1][X] = (c<<1)+d; \ - pieces[3][X] = c-(d<<1); - -#define H264_DCT_PART2(X) \ - a = pieces[X][0]+pieces[X][3]; \ - c = pieces[X][0]-pieces[X][3]; \ - b = pieces[X][1]+pieces[X][2]; \ - d = pieces[X][1]-pieces[X][2]; \ - block[0][X] = a+b; \ - block[2][X] = a-b; \ - block[1][X] = (c<<1)+d; \ - block[3][X] = c-(d<<1); - -/** - * Transform the provided matrix using the H.264 modified DCT. - * @note - * we'll always work with transposed input blocks, to avoid having to make a - * distinction between C and mmx implementations. - * - * @param block transposed input block - */ -static void h264_dct_c(DCTELEM block[4][4]) -{ - DCTELEM pieces[4][4]; - DCTELEM a, b, c, d; - - H264_DCT_PART1(0); - H264_DCT_PART1(1); - H264_DCT_PART1(2); - H264_DCT_PART1(3); - H264_DCT_PART2(0); - H264_DCT_PART2(1); - H264_DCT_PART2(2); - H264_DCT_PART2(3); -} - -av_cold void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx) -{ - c->h264_dct = h264_dct_c; -} - diff --git a/libavcodec/h264enc.c b/libavcodec/h264enc.c deleted file mode 100644 index ad874f3624..0000000000 --- a/libavcodec/h264enc.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * H.264 encoder - * - * 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/common.h" -#include "get_bits.h" -#include "mpegvideo.h" -#include "h264data.h" - -/** - * Write out the provided data into a NAL unit. - * @param nal_ref_idc NAL reference IDC - * @param nal_unit_type NAL unit payload type - * @param dest the target buffer, dst+1 == src is allowed as a special case - * @param destsize the length of the dst array - * @param b2 the data which should be escaped - * @return pointer to current position in the output buffer or NULL if an error occurred - */ -static uint8_t *h264_write_nal_unit(int nal_ref_idc, int nal_unit_type, uint8_t *dest, int *destsize, - PutBitContext *b2) -{ - PutBitContext b; - int i, destpos, rbsplen, escape_count; - uint8_t *rbsp; - - if (nal_unit_type != NAL_END_STREAM) - put_bits(b2,1,1); // rbsp_stop_bit - - // Align b2 on a byte boundary - align_put_bits(b2); - rbsplen = put_bits_count(b2)/8; - flush_put_bits(b2); - rbsp = b2->buf; - - init_put_bits(&b,dest,*destsize); - - put_bits(&b,16,0); - put_bits(&b,16,0x01); - - put_bits(&b,1,0); // forbidden zero bit - put_bits(&b,2,nal_ref_idc); // nal_ref_idc - put_bits(&b,5,nal_unit_type); // nal_unit_type - - flush_put_bits(&b); - - destpos = 5; - escape_count= 0; - - for (i=0; i0 && rbsp[i-1]==0) - i--; - if (i+2 *destsize) - { - av_log(NULL, AV_LOG_ERROR, "Destination buffer too small!\n"); - return NULL; - } - - // this should be damn rare (hopefully) - for (i = 0 ; i < rbsplen ; i++) - { - if (i + 2 < rbsplen && (rbsp[i] == 0 && rbsp[i+1] == 0 && rbsp[i+2] < 4)) - { - dest[destpos++] = rbsp[i++]; - dest[destpos++] = rbsp[i]; - dest[destpos++] = 0x03; // emulation prevention byte - } - else - dest[destpos++] = rbsp[i]; - } - *destsize -= destpos; - return dest+destpos; -} - -static const uint8_t pict_type_to_golomb[7] = {-1, 2, 0, 1, -1, 4, 3}; - -static const uint8_t intra4x4_cbp_to_golomb[48] = { - 3, 29, 30, 17, 31, 18, 37, 8, 32, 38, 19, 9, 20, 10, 11, 2, - 16, 33, 34, 21, 35, 22, 39, 4, 36, 40, 23, 5, 24, 6, 7, 1, - 41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15, 0 -}; - -static const uint8_t inter_cbp_to_golomb[48] = { - 0, 2, 3, 7, 4, 8, 17, 13, 5, 18, 9, 14, 10, 15, 16, 11, - 1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19, - 6, 24, 25, 20, 26, 21, 46, 28, 27, 47, 22, 29, 23, 30, 31, 12 -}; - -#define QUANT_SHIFT 22 - -static const int quant_coeff[52][16] = { - { 419430, 258111, 419430, 258111, 258111, 167772, 258111, 167772, 419430, 258111, 419430, 258111, 258111, 167772, 258111, 167772,}, - { 381300, 239675, 381300, 239675, 239675, 149131, 239675, 149131, 381300, 239675, 381300, 239675, 239675, 149131, 239675, 149131,}, - { 322639, 209715, 322639, 209715, 209715, 134218, 209715, 134218, 322639, 209715, 322639, 209715, 209715, 134218, 209715, 134218,}, - { 299593, 186414, 299593, 186414, 186414, 116711, 186414, 116711, 299593, 186414, 299593, 186414, 186414, 116711, 186414, 116711,}, - { 262144, 167772, 262144, 167772, 167772, 107374, 167772, 107374, 262144, 167772, 262144, 167772, 167772, 107374, 167772, 107374,}, - { 233017, 145889, 233017, 145889, 145889, 92564, 145889, 92564, 233017, 145889, 233017, 145889, 145889, 92564, 145889, 92564,}, - { 209715, 129056, 209715, 129056, 129056, 83886, 129056, 83886, 209715, 129056, 209715, 129056, 129056, 83886, 129056, 83886,}, - { 190650, 119837, 190650, 119837, 119837, 74565, 119837, 74565, 190650, 119837, 190650, 119837, 119837, 74565, 119837, 74565,}, - { 161319, 104858, 161319, 104858, 104858, 67109, 104858, 67109, 161319, 104858, 161319, 104858, 104858, 67109, 104858, 67109,}, - { 149797, 93207, 149797, 93207, 93207, 58356, 93207, 58356, 149797, 93207, 149797, 93207, 93207, 58356, 93207, 58356,}, - { 131072, 83886, 131072, 83886, 83886, 53687, 83886, 53687, 131072, 83886, 131072, 83886, 83886, 53687, 83886, 53687,}, - { 116508, 72944, 116508, 72944, 72944, 46282, 72944, 46282, 116508, 72944, 116508, 72944, 72944, 46282, 72944, 46282,}, - { 104858, 64528, 104858, 64528, 64528, 41943, 64528, 41943, 104858, 64528, 104858, 64528, 64528, 41943, 64528, 41943,}, - { 95325, 59919, 95325, 59919, 59919, 37283, 59919, 37283, 95325, 59919, 95325, 59919, 59919, 37283, 59919, 37283,}, - { 80660, 52429, 80660, 52429, 52429, 33554, 52429, 33554, 80660, 52429, 80660, 52429, 52429, 33554, 52429, 33554,}, - { 74898, 46603, 74898, 46603, 46603, 29178, 46603, 29178, 74898, 46603, 74898, 46603, 46603, 29178, 46603, 29178,}, - { 65536, 41943, 65536, 41943, 41943, 26844, 41943, 26844, 65536, 41943, 65536, 41943, 41943, 26844, 41943, 26844,}, - { 58254, 36472, 58254, 36472, 36472, 23141, 36472, 23141, 58254, 36472, 58254, 36472, 36472, 23141, 36472, 23141,}, - { 52429, 32264, 52429, 32264, 32264, 20972, 32264, 20972, 52429, 32264, 52429, 32264, 32264, 20972, 32264, 20972,}, - { 47663, 29959, 47663, 29959, 29959, 18641, 29959, 18641, 47663, 29959, 47663, 29959, 29959, 18641, 29959, 18641,}, - { 40330, 26214, 40330, 26214, 26214, 16777, 26214, 16777, 40330, 26214, 40330, 26214, 26214, 16777, 26214, 16777,}, - { 37449, 23302, 37449, 23302, 23302, 14589, 23302, 14589, 37449, 23302, 37449, 23302, 23302, 14589, 23302, 14589,}, - { 32768, 20972, 32768, 20972, 20972, 13422, 20972, 13422, 32768, 20972, 32768, 20972, 20972, 13422, 20972, 13422,}, - { 29127, 18236, 29127, 18236, 18236, 11570, 18236, 11570, 29127, 18236, 29127, 18236, 18236, 11570, 18236, 11570,}, - { 26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486, 26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486,}, - { 23831, 14980, 23831, 14980, 14980, 9321, 14980, 9321, 23831, 14980, 23831, 14980, 14980, 9321, 14980, 9321,}, - { 20165, 13107, 20165, 13107, 13107, 8389, 13107, 8389, 20165, 13107, 20165, 13107, 13107, 8389, 13107, 8389,}, - { 18725, 11651, 18725, 11651, 11651, 7294, 11651, 7294, 18725, 11651, 18725, 11651, 11651, 7294, 11651, 7294,}, - { 16384, 10486, 16384, 10486, 10486, 6711, 10486, 6711, 16384, 10486, 16384, 10486, 10486, 6711, 10486, 6711,}, - { 14564, 9118, 14564, 9118, 9118, 5785, 9118, 5785, 14564, 9118, 14564, 9118, 9118, 5785, 9118, 5785,}, - { 13107, 8066, 13107, 8066, 8066, 5243, 8066, 5243, 13107, 8066, 13107, 8066, 8066, 5243, 8066, 5243,}, - { 11916, 7490, 11916, 7490, 7490, 4660, 7490, 4660, 11916, 7490, 11916, 7490, 7490, 4660, 7490, 4660,}, - { 10082, 6554, 10082, 6554, 6554, 4194, 6554, 4194, 10082, 6554, 10082, 6554, 6554, 4194, 6554, 4194,}, - { 9362, 5825, 9362, 5825, 5825, 3647, 5825, 3647, 9362, 5825, 9362, 5825, 5825, 3647, 5825, 3647,}, - { 8192, 5243, 8192, 5243, 5243, 3355, 5243, 3355, 8192, 5243, 8192, 5243, 5243, 3355, 5243, 3355,}, - { 7282, 4559, 7282, 4559, 4559, 2893, 4559, 2893, 7282, 4559, 7282, 4559, 4559, 2893, 4559, 2893,}, - { 6554, 4033, 6554, 4033, 4033, 2621, 4033, 2621, 6554, 4033, 6554, 4033, 4033, 2621, 4033, 2621,}, - { 5958, 3745, 5958, 3745, 3745, 2330, 3745, 2330, 5958, 3745, 5958, 3745, 3745, 2330, 3745, 2330,}, - { 5041, 3277, 5041, 3277, 3277, 2097, 3277, 2097, 5041, 3277, 5041, 3277, 3277, 2097, 3277, 2097,}, - { 4681, 2913, 4681, 2913, 2913, 1824, 2913, 1824, 4681, 2913, 4681, 2913, 2913, 1824, 2913, 1824,}, - { 4096, 2621, 4096, 2621, 2621, 1678, 2621, 1678, 4096, 2621, 4096, 2621, 2621, 1678, 2621, 1678,}, - { 3641, 2280, 3641, 2280, 2280, 1446, 2280, 1446, 3641, 2280, 3641, 2280, 2280, 1446, 2280, 1446,}, - { 3277, 2016, 3277, 2016, 2016, 1311, 2016, 1311, 3277, 2016, 3277, 2016, 2016, 1311, 2016, 1311,}, - { 2979, 1872, 2979, 1872, 1872, 1165, 1872, 1165, 2979, 1872, 2979, 1872, 1872, 1165, 1872, 1165,}, - { 2521, 1638, 2521, 1638, 1638, 1049, 1638, 1049, 2521, 1638, 2521, 1638, 1638, 1049, 1638, 1049,}, - { 2341, 1456, 2341, 1456, 1456, 912, 1456, 912, 2341, 1456, 2341, 1456, 1456, 912, 1456, 912,}, - { 2048, 1311, 2048, 1311, 1311, 839, 1311, 839, 2048, 1311, 2048, 1311, 1311, 839, 1311, 839,}, - { 1820, 1140, 1820, 1140, 1140, 723, 1140, 723, 1820, 1140, 1820, 1140, 1140, 723, 1140, 723,}, - { 1638, 1008, 1638, 1008, 1008, 655, 1008, 655, 1638, 1008, 1638, 1008, 1008, 655, 1008, 655,}, - { 1489, 936, 1489, 936, 936, 583, 936, 583, 1489, 936, 1489, 936, 936, 583, 936, 583,}, - { 1260, 819, 1260, 819, 819, 524, 819, 524, 1260, 819, 1260, 819, 819, 524, 819, 524,}, - { 1170, 728, 1170, 728, 728, 456, 728, 456, 1170, 728, 1170, 728, 728, 456, 728, 456,}, -}; - -//FIXME need to check that this does not overflow signed 32 bit for low qp, I am not sure, it's very close -//FIXME check that gcc inlines this (and optimizes intra & separate_dc stuff away) -static inline int quantize_c(DCTELEM *block, uint8_t *scantable, int qscale, - int intra, int separate_dc) -{ - int i; - const int * const quant_table = quant_coeff[qscale]; - const int bias = intra ? (1 << QUANT_SHIFT) / 3 : (1 << QUANT_SHIFT) / 6; - const unsigned int threshold1 = (1 << QUANT_SHIFT) - bias - 1; - const unsigned int threshold2 = (threshold1 << 1); - int last_non_zero; - - if (separate_dc) { - if (qscale <= 18) { - //avoid overflows - const int dc_bias = intra ? (1 << (QUANT_SHIFT - 2)) / 3 : (1 << (QUANT_SHIFT - 2)) / 6; - const unsigned int dc_threshold1 = (1 << (QUANT_SHIFT - 2)) - dc_bias - 1; - const unsigned int dc_threshold2 = (dc_threshold1 << 1); - - int level = block[0]*quant_coeff[qscale+18][0]; - if (((unsigned)(level + dc_threshold1)) > dc_threshold2) { - if (level > 0) { - level = (dc_bias + level) >> (QUANT_SHIFT - 2); - block[0] = level; - } else { - level = (dc_bias - level) >> (QUANT_SHIFT - 2); - block[0] = -level; - } -// last_non_zero = i; - } else { - block[0] = 0; - } - } else { - const int dc_bias = intra ? (1 << (QUANT_SHIFT + 1)) / 3 : (1 << (QUANT_SHIFT + 1)) / 6; - const unsigned int dc_threshold1 = (1 << (QUANT_SHIFT + 1)) - dc_bias - 1; - const unsigned int dc_threshold2 = (dc_threshold1 << 1); - - int level = block[0]*quant_table[0]; - if (((unsigned)(level + dc_threshold1)) > dc_threshold2) { - if (level > 0) { - level = (dc_bias + level) >> (QUANT_SHIFT + 1); - block[0] = level; - } else { - level = (dc_bias - level) >> (QUANT_SHIFT + 1); - block[0] = -level; - } -// last_non_zero = i; - } else { - block[0] = 0; - } - } - last_non_zero = 0; - i = 1; - } else { - last_non_zero = -1; - i = 0; - } - - for (; i < 16; i++) { - const int j = scantable[i]; - int level = block[j]*quant_table[j]; - -// if ( bias+level >= (1 << (QMAT_SHIFT - 3)) -// || bias-level >= (1 << (QMAT_SHIFT - 3))) { - if (((unsigned)(level + threshold1)) > threshold2) { - if (level > 0) { - level = (bias + level) >> QUANT_SHIFT; - block[j] = level; - } else { - level = (bias - level) >> QUANT_SHIFT; - block[j] = -level; - } - last_non_zero = i; - } else { - block[j] = 0; - } - } - - return last_non_zero; -} From 96aad41e8157b7c6b577803054e20a0771857424 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 20 Jan 2011 02:04:54 +0000 Subject: [PATCH 053/528] Make LOCAL_ALIGNED macro fully C99 compatible C99 variadic macros require more arguments than there are named parameters in the definition. This means we must use an extra indirection to avoid having two different macros for arrays with one resp more than one dimension. Signed-off-by: Mans Rullgard --- libavcodec/dsputil.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index c619b78529..842d72746d 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -661,20 +661,24 @@ static inline void emms(void) # define STRIDE_ALIGN 8 #endif -#define LOCAL_ALIGNED(a, t, v, s, ...) \ - uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)]; \ - t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a) +#define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \ + uint8_t la_##v[sizeof(t s o) + (a)]; \ + t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a) + +#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) DECLARE_ALIGNED(a, t, v) s o + +#define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,) #if HAVE_LOCAL_ALIGNED_8 -# define LOCAL_ALIGNED_8(t, v, s, ...) DECLARE_ALIGNED(8, t, v) s __VA_ARGS__ +# define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,) #else -# define LOCAL_ALIGNED_8(t, v, s, ...) LOCAL_ALIGNED(8, t, v, s, __VA_ARGS__) +# define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__) #endif #if HAVE_LOCAL_ALIGNED_16 -# define LOCAL_ALIGNED_16(t, v, s, ...) DECLARE_ALIGNED(16, t, v) s __VA_ARGS__ +# define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,) #else -# define LOCAL_ALIGNED_16(t, v, s, ...) LOCAL_ALIGNED(16, t, v, s, __VA_ARGS__) +# define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__) #endif /* PSNR */ From 9107892624c8f9978489ab5b4c0ef2fc5637fb62 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 22 Jan 2011 14:42:56 +0000 Subject: [PATCH 054/528] Fix crash on resolution change (issue 2393). Don't free RBSP tables (containing decoded NAL units) on resolution change, because we actually need this data to decode the frame after reiniting (with new resolution). Fixed issue 2393. Signed-off-by: Janne Grunau --- libavcodec/h264.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 52a161bde7..1990d5d6c5 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -614,7 +614,7 @@ static void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t } -static void free_tables(H264Context *h){ +static void free_tables(H264Context *h, int free_rbsp){ int i; H264Context *hx; av_freep(&h->intra4x4_pred_mode); @@ -637,10 +637,12 @@ static void free_tables(H264Context *h){ av_freep(&hx->top_borders[1]); av_freep(&hx->top_borders[0]); av_freep(&hx->s.obmc_scratchpad); + if (free_rbsp){ av_freep(&hx->rbsp_buffer[1]); av_freep(&hx->rbsp_buffer[0]); hx->rbsp_buffer_size[0] = 0; hx->rbsp_buffer_size[1] = 0; + } if (i) av_freep(&h->thread_context[i]); } } @@ -748,7 +750,7 @@ int ff_h264_alloc_tables(H264Context *h){ return 0; fail: - free_tables(h); + free_tables(h, 1); return -1; } @@ -1776,7 +1778,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ || av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) { if(h != h0) return -1; // width / height changed during parallelized decoding - free_tables(h); + free_tables(h, 0); flush_dpb(s->avctx); MPV_common_end(s); } @@ -3331,7 +3333,7 @@ av_cold void ff_h264_free_context(H264Context *h) { int i; - free_tables(h); //FIXME cleanup init stuff perhaps + free_tables(h, 1); //FIXME cleanup init stuff perhaps for(i = 0; i < MAX_SPS_COUNT; i++) av_freep(h->sps_buffers + i); From fcb7e535dd9ad142c079af62af9c1d0f4b001057 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 22 Jan 2011 14:42:57 +0000 Subject: [PATCH 055/528] Reindent. Signed-off-by: Janne Grunau --- libavcodec/h264.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 1990d5d6c5..d56c29331e 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -638,10 +638,10 @@ static void free_tables(H264Context *h, int free_rbsp){ av_freep(&hx->top_borders[0]); av_freep(&hx->s.obmc_scratchpad); if (free_rbsp){ - av_freep(&hx->rbsp_buffer[1]); - av_freep(&hx->rbsp_buffer[0]); - hx->rbsp_buffer_size[0] = 0; - hx->rbsp_buffer_size[1] = 0; + av_freep(&hx->rbsp_buffer[1]); + av_freep(&hx->rbsp_buffer[0]); + hx->rbsp_buffer_size[0] = 0; + hx->rbsp_buffer_size[1] = 0; } if (i) av_freep(&h->thread_context[i]); } From 6eabb0d3ad42b91c1b4c298718c29961f7c1653a Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 13 Jan 2011 15:28:06 -0500 Subject: [PATCH 056/528] Change DSPContext.vector_fmul() from dst=dst*src to dest=src0*src1. Signed-off-by: Mans Rullgard --- libavcodec/aacenc.c | 2 +- libavcodec/arm/dsputil_init_neon.c | 2 +- libavcodec/arm/dsputil_init_vfp.c | 3 +- libavcodec/arm/dsputil_neon.S | 45 +++++++++++++++--------------- libavcodec/arm/dsputil_vfp.S | 29 ++++++++++--------- libavcodec/atrac3.c | 2 +- libavcodec/dsputil.c | 4 +-- libavcodec/dsputil.h | 2 +- libavcodec/nellymoserenc.c | 6 ++-- libavcodec/ppc/float_altivec.c | 10 +++---- libavcodec/twinvq.c | 4 +-- libavcodec/vorbis_dec.c | 2 +- libavcodec/x86/dsputil_mmx.c | 24 ++++++++-------- 13 files changed, 67 insertions(+), 68 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index f8f0eb45f6..6a113ef30b 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -256,7 +256,7 @@ static void apply_window_and_mdct(AVCodecContext *avctx, AACEncContext *s, s->output[i - 448 - k] = (i < 1024) ? sce->saved[i] : audio[(i-1024)*chans]; - s->dsp.vector_fmul (s->output, k ? swindow : pwindow, 128); + s->dsp.vector_fmul (s->output, s->output, k ? swindow : pwindow, 128); s->dsp.vector_fmul_reverse(s->output+128, s->output+128, swindow, 128); ff_mdct_calc(&s->mdct128, sce->coeffs + k, s->output); } diff --git a/libavcodec/arm/dsputil_init_neon.c b/libavcodec/arm/dsputil_init_neon.c index 04ebb00576..221183cef8 100644 --- a/libavcodec/arm/dsputil_init_neon.c +++ b/libavcodec/arm/dsputil_init_neon.c @@ -138,7 +138,7 @@ void ff_avg_h264_chroma_mc2_neon(uint8_t *, uint8_t *, int, int, int, int); void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *); void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *); -void ff_vector_fmul_neon(float *dst, const float *src, int len); +void ff_vector_fmul_neon(float *dst, const float *src0, const float *src1, int len); void ff_vector_fmul_window_neon(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len); diff --git a/libavcodec/arm/dsputil_init_vfp.c b/libavcodec/arm/dsputil_init_vfp.c index 9f8c1b7840..76ef6b4171 100644 --- a/libavcodec/arm/dsputil_init_vfp.c +++ b/libavcodec/arm/dsputil_init_vfp.c @@ -21,7 +21,8 @@ #include "libavcodec/dsputil.h" #include "dsputil_arm.h" -void ff_vector_fmul_vfp(float *dst, const float *src, int len); +void ff_vector_fmul_vfp(float *dst, const float *src0, + const float *src1, int len); void ff_vector_fmul_reverse_vfp(float *dst, const float *src0, const float *src1, int len); void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); diff --git a/libavcodec/arm/dsputil_neon.S b/libavcodec/arm/dsputil_neon.S index 2bcdb397f9..42fb38de52 100644 --- a/libavcodec/arm/dsputil_neon.S +++ b/libavcodec/arm/dsputil_neon.S @@ -738,42 +738,41 @@ function ff_float_to_int16_interleave_neon, export=1 endfunc function ff_vector_fmul_neon, export=1 - mov r3, r0 - subs r2, r2, #8 - vld1.64 {d0-d3}, [r0,:128]! - vld1.64 {d4-d7}, [r1,:128]! + subs r3, r3, #8 + vld1.64 {d0-d3}, [r1,:128]! + vld1.64 {d4-d7}, [r2,:128]! vmul.f32 q8, q0, q2 vmul.f32 q9, q1, q3 beq 3f - bics ip, r2, #15 + bics ip, r3, #15 beq 2f 1: subs ip, ip, #16 - vld1.64 {d0-d1}, [r0,:128]! - vld1.64 {d4-d5}, [r1,:128]! + vld1.64 {d0-d1}, [r1,:128]! + vld1.64 {d4-d5}, [r2,:128]! vmul.f32 q10, q0, q2 - vld1.64 {d2-d3}, [r0,:128]! - vld1.64 {d6-d7}, [r1,:128]! + vld1.64 {d2-d3}, [r1,:128]! + vld1.64 {d6-d7}, [r2,:128]! vmul.f32 q11, q1, q3 - vst1.64 {d16-d19},[r3,:128]! - vld1.64 {d0-d1}, [r0,:128]! - vld1.64 {d4-d5}, [r1,:128]! + vst1.64 {d16-d19},[r0,:128]! + vld1.64 {d0-d1}, [r1,:128]! + vld1.64 {d4-d5}, [r2,:128]! vmul.f32 q8, q0, q2 - vld1.64 {d2-d3}, [r0,:128]! - vld1.64 {d6-d7}, [r1,:128]! + vld1.64 {d2-d3}, [r1,:128]! + vld1.64 {d6-d7}, [r2,:128]! vmul.f32 q9, q1, q3 - vst1.64 {d20-d23},[r3,:128]! + vst1.64 {d20-d23},[r0,:128]! bne 1b - ands r2, r2, #15 + ands r3, r3, #15 beq 3f -2: vld1.64 {d0-d1}, [r0,:128]! - vld1.64 {d4-d5}, [r1,:128]! - vst1.64 {d16-d17},[r3,:128]! +2: vld1.64 {d0-d1}, [r1,:128]! + vld1.64 {d4-d5}, [r2,:128]! + vst1.64 {d16-d17},[r0,:128]! vmul.f32 q8, q0, q2 - vld1.64 {d2-d3}, [r0,:128]! - vld1.64 {d6-d7}, [r1,:128]! - vst1.64 {d18-d19},[r3,:128]! + vld1.64 {d2-d3}, [r1,:128]! + vld1.64 {d6-d7}, [r2,:128]! + vst1.64 {d18-d19},[r0,:128]! vmul.f32 q9, q1, q3 -3: vst1.64 {d16-d19},[r3,:128]! +3: vst1.64 {d16-d19},[r0,:128]! bx lr endfunc diff --git a/libavcodec/arm/dsputil_vfp.S b/libavcodec/arm/dsputil_vfp.S index b704ba9144..a65b69e20a 100644 --- a/libavcodec/arm/dsputil_vfp.S +++ b/libavcodec/arm/dsputil_vfp.S @@ -41,34 +41,33 @@ * ARM VFP optimized implementation of 'vector_fmul_c' function. * Assume that len is a positive number and is multiple of 8 */ -@ void ff_vector_fmul_vfp(float *dst, const float *src, int len) +@ void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1, int len) function ff_vector_fmul_vfp, export=1 vpush {d8-d15} - mov r3, r0 fmrx r12, fpscr orr r12, r12, #(3 << 16) /* set vector size to 4 */ fmxr fpscr, r12 - vldmia r3!, {s0-s3} - vldmia r1!, {s8-s11} - vldmia r3!, {s4-s7} - vldmia r1!, {s12-s15} + vldmia r1!, {s0-s3} + vldmia r2!, {s8-s11} + vldmia r1!, {s4-s7} + vldmia r2!, {s12-s15} vmul.f32 s8, s0, s8 1: - subs r2, r2, #16 + subs r3, r3, #16 vmul.f32 s12, s4, s12 - vldmiage r3!, {s16-s19} - vldmiage r1!, {s24-s27} - vldmiage r3!, {s20-s23} - vldmiage r1!, {s28-s31} + vldmiage r1!, {s16-s19} + vldmiage r2!, {s24-s27} + vldmiage r1!, {s20-s23} + vldmiage r2!, {s28-s31} vmulge.f32 s24, s16, s24 vstmia r0!, {s8-s11} vstmia r0!, {s12-s15} vmulge.f32 s28, s20, s28 - vldmiagt r3!, {s0-s3} - vldmiagt r1!, {s8-s11} - vldmiagt r3!, {s4-s7} - vldmiagt r1!, {s12-s15} + vldmiagt r1!, {s0-s3} + vldmiagt r2!, {s8-s11} + vldmiagt r1!, {s4-s7} + vldmiagt r2!, {s12-s15} vmulge.f32 s8, s0, s8 vstmiage r0!, {s24-s27} vstmiage r0!, {s28-s31} diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 797e1f1992..cc13b730ab 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -159,7 +159,7 @@ static void IMLT(ATRAC3Context *q, float *pInput, float *pOutput, int odd_band) ff_imdct_calc(&q->mdct_ctx,pOutput,pInput); /* Perform windowing on the output. */ - dsp.vector_fmul(pOutput,mdct_window,512); + dsp.vector_fmul(pOutput, pOutput, mdct_window, 512); } diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 57b2640686..2ed0052977 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3750,10 +3750,10 @@ WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c) WRAPPER8_16_SQ(rd8x8_c, rd16_c) WRAPPER8_16_SQ(bit8x8_c, bit16_c) -static void vector_fmul_c(float *dst, const float *src, int len){ +static void vector_fmul_c(float *dst, const float *src0, const float *src1, int len){ int i; for(i=0; iin_buff, s->buf[s->bufsel], NELLY_BUF_LEN * sizeof(float)); - s->dsp.vector_fmul(s->in_buff, ff_sine_128, NELLY_BUF_LEN); + s->dsp.vector_fmul(s->in_buff, s->buf[s->bufsel], ff_sine_128, NELLY_BUF_LEN); s->dsp.vector_fmul_reverse(s->in_buff + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128, NELLY_BUF_LEN); ff_mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff); - s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128, NELLY_BUF_LEN); + s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN, + ff_sine_128, NELLY_BUF_LEN); s->dsp.vector_fmul_reverse(s->buf[s->bufsel] + 2 * NELLY_BUF_LEN, s->buf[1 - s->bufsel], ff_sine_128, NELLY_BUF_LEN); ff_mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN); diff --git a/libavcodec/ppc/float_altivec.c b/libavcodec/ppc/float_altivec.c index d1f9f1ade3..188e03ea2d 100644 --- a/libavcodec/ppc/float_altivec.c +++ b/libavcodec/ppc/float_altivec.c @@ -23,16 +23,16 @@ #include "dsputil_altivec.h" #include "util_altivec.h" -static void vector_fmul_altivec(float *dst, const float *src, int len) +static void vector_fmul_altivec(float *dst, const float *src0, const float *src1, int len) { int i; vector float d0, d1, s, zero = (vector float)vec_splat_u32(0); for(i=0; itmp_buf, gain[sub*i+j], ftype); - tctx->dsp.vector_fmul(chunk + block_size*j, tctx->tmp_buf, + tctx->dsp.vector_fmul(chunk + block_size*j, chunk + block_size*j, tctx->tmp_buf, block_size); } @@ -805,7 +805,7 @@ static void read_and_decode_spectrum(TwinContext *tctx, GetBitContext *gb, dec_lpc_spectrum_inv(tctx, lsp, ftype, tctx->tmp_buf); for (j = 0; j < mtab->fmode[ftype].sub; j++) { - tctx->dsp.vector_fmul(chunk, tctx->tmp_buf, block_size); + tctx->dsp.vector_fmul(chunk, chunk, tctx->tmp_buf, block_size); chunk += block_size; } } diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index 4e16c4a7bc..8f15a2100c 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -1578,7 +1578,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) for (j = vc->audio_channels-1;j >= 0; j--) { ch_floor_ptr = vc->channel_floors + j * blocksize / 2; ch_res_ptr = vc->channel_residues + res_chan[j] * blocksize / 2; - vc->dsp.vector_fmul(ch_floor_ptr, ch_res_ptr, blocksize / 2); + vc->dsp.vector_fmul(ch_floor_ptr, ch_floor_ptr, ch_res_ptr, blocksize / 2); ff_imdct_half(&vc->mdct[blockflag], ch_res_ptr, ch_floor_ptr); } diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 825149e4a5..5ddfecae24 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2074,38 +2074,38 @@ static void ac3_downmix_sse(float (*samples)[256], float (*matrix)[2], int out_c } } -static void vector_fmul_3dnow(float *dst, const float *src, int len){ +static void vector_fmul_3dnow(float *dst, const float *src0, const float *src1, int len){ x86_reg i = (len-4)*4; __asm__ volatile( "1: \n\t" - "movq (%1,%0), %%mm0 \n\t" - "movq 8(%1,%0), %%mm1 \n\t" - "pfmul (%2,%0), %%mm0 \n\t" - "pfmul 8(%2,%0), %%mm1 \n\t" + "movq (%2,%0), %%mm0 \n\t" + "movq 8(%2,%0), %%mm1 \n\t" + "pfmul (%3,%0), %%mm0 \n\t" + "pfmul 8(%3,%0), %%mm1 \n\t" "movq %%mm0, (%1,%0) \n\t" "movq %%mm1, 8(%1,%0) \n\t" "sub $16, %0 \n\t" "jge 1b \n\t" "femms \n\t" :"+r"(i) - :"r"(dst), "r"(src) + :"r"(dst), "r"(src0), "r"(src1) :"memory" ); } -static void vector_fmul_sse(float *dst, const float *src, int len){ +static void vector_fmul_sse(float *dst, const float *src0, const float *src1, int len){ x86_reg i = (len-8)*4; __asm__ volatile( "1: \n\t" - "movaps (%1,%0), %%xmm0 \n\t" - "movaps 16(%1,%0), %%xmm1 \n\t" - "mulps (%2,%0), %%xmm0 \n\t" - "mulps 16(%2,%0), %%xmm1 \n\t" + "movaps (%2,%0), %%xmm0 \n\t" + "movaps 16(%2,%0), %%xmm1 \n\t" + "mulps (%3,%0), %%xmm0 \n\t" + "mulps 16(%3,%0), %%xmm1 \n\t" "movaps %%xmm0, (%1,%0) \n\t" "movaps %%xmm1, 16(%1,%0) \n\t" "sub $32, %0 \n\t" "jge 1b \n\t" :"+r"(i) - :"r"(dst), "r"(src) + :"r"(dst), "r"(src0), "r"(src1) :"memory" ); } From 3b924294ea0ab891cf28fb30f26962a7960f7f37 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 13 Jan 2011 15:28:06 -0500 Subject: [PATCH 057/528] ac3enc: use dsputil functions in apply_window() Signed-off-by: Mans Rullgard --- libavcodec/ac3enc.c | 4 ++-- libavcodec/ac3enc_fixed.c | 2 +- libavcodec/ac3enc_float.c | 16 ++++++---------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index e59916cc6f..f058d79882 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -161,7 +161,7 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct, static void mdct512(AC3MDCTContext *mdct, CoefType *out, SampleType *in); -static void apply_window(SampleType *output, const SampleType *input, +static void apply_window(DSPContext *dsp, SampleType *output, const SampleType *input, const SampleType *window, int n); static int normalize_samples(AC3EncodeContext *s); @@ -262,7 +262,7 @@ static void apply_mdct(AC3EncodeContext *s) AC3Block *block = &s->blocks[blk]; const SampleType *input_samples = &s->planar_samples[ch][blk * AC3_BLOCK_SIZE]; - apply_window(s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE); + apply_window(&s->dsp, s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE); block->exp_shift[ch] = normalize_samples(s); diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index 3723b08b96..dfd218ec72 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -251,7 +251,7 @@ static void mdct512(AC3MDCTContext *mdct, int32_t *out, int16_t *in) /** * Apply KBD window to input samples prior to MDCT. */ -static void apply_window(int16_t *output, const int16_t *input, +static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input, const int16_t *window, int n) { int i; diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c index f3246362e7..33e8294fbf 100644 --- a/libavcodec/ac3enc_float.c +++ b/libavcodec/ac3enc_float.c @@ -48,17 +48,19 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct, int nbits) { float *window; - int n, n2; + int i, n, n2; n = 1 << nbits; n2 = n >> 1; - window = av_malloc(n2 * sizeof(*window)); + window = av_malloc(n * sizeof(*window)); if (!window) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate memory.\n"); return AVERROR(ENOMEM); } ff_kbd_window_init(window, 5.0, n2); + for (i = 0; i < n2; i++) + window[n-1-i] = window[i]; mdct->window = window; return ff_mdct_init(&mdct->fft, nbits, 0, -2.0 / n); @@ -79,16 +81,10 @@ static void mdct512(AC3MDCTContext *mdct, float *out, float *in) /** * Apply KBD window to input samples prior to MDCT. */ -static void apply_window(float *output, const float *input, +static void apply_window(DSPContext *dsp, float *output, const float *input, const float *window, int n) { - int i; - int n2 = n >> 1; - - for (i = 0; i < n2; i++) { - output[i] = input[i] * window[i]; - output[n-i-1] = input[n-i-1] * window[i]; - } + dsp->vector_fmul(output, input, window, n); } From 305ca590cfdbb8ffbe32c6ed26825489a640ff05 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Sun, 23 Jan 2011 08:53:40 +0100 Subject: [PATCH 058/528] ffserver: cleanup remove the trivial function do_switch_stream as it doesn't help to make the code easier to understand. --- ffserver.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/ffserver.c b/ffserver.c index 89e8e9582d..94a239ca5d 100644 --- a/ffserver.c +++ b/ffserver.c @@ -1192,19 +1192,6 @@ static int modify_current_stream(HTTPContext *c, char *rates) return action_required; } - -static void do_switch_stream(HTTPContext *c, int i) -{ - if (c->switch_feed_streams[i] >= 0) { -#ifdef PHILIP - c->feed_streams[i] = c->switch_feed_streams[i]; -#endif - - /* Now update the stream */ - } - c->switch_feed_streams[i] = -1; -} - /* XXX: factorize in utils.c ? */ /* XXX: take care with different space meaning */ static void skip_spaces(const char **pp) @@ -1578,7 +1565,7 @@ static int http_parse_request(HTTPContext *c) if (modify_current_stream(c, ratebuf)) { for (i = 0; i < FF_ARRAY_ELEMS(c->feed_streams); i++) { if (c->switch_feed_streams[i] >= 0) - do_switch_stream(c, i); + c->switch_feed_streams[i] = -1; } } } @@ -2349,7 +2336,7 @@ static int http_prepare_data(HTTPContext *c) for(i=0;istream->nb_streams;i++) { if (c->switch_feed_streams[i] == pkt.stream_index) if (pkt.flags & AV_PKT_FLAG_KEY) - do_switch_stream(c, i); + c->switch_feed_streams[i] = -1; if (c->switch_feed_streams[i] >= 0) c->switch_pending = 1; } From 2b39962eb616bdb848673485d7b9feed48d39e36 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 20 Jan 2011 02:07:55 +0000 Subject: [PATCH 059/528] Makefile: simplify test tools handling Signed-off-by: Mans Rullgard --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 98ec5f5b47..a1fd7b4e42 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,8 @@ MANPAGES = $(PROGS-yes:%=doc/%.1) PODPAGES = $(PROGS-yes:%=doc/%.pod) HTMLPAGES = $(PROGS-yes:%=doc/%.html) TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher)) -HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr base64) +TESTPROGS = audiogen videogen rotozoom tiny_psnr base64 +HOSTPROGS := $(TESTPROGS:%=tests/%) BASENAMES = ffmpeg ffplay ffprobe ffserver ALLPROGS = $(BASENAMES:%=%$(EXESUF)) @@ -162,7 +163,7 @@ testclean: $(RM) -r tests/vsynth1 tests/vsynth2 tests/data $(RM) $(addprefix tests/,$(CLEANSUFFIXES)) $(RM) tests/seek_test$(EXESUF) tests/seek_test.o - $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr base64)) + $(RM) $(TESTPROGS:%=tests/%$(HOSTEXESUF)) clean:: testclean $(RM) $(ALLPROGS) $(ALLPROGS_G) From 938f72e19957e9ee3f4ae2bee2fb53ded359009f Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 23 Jan 2011 01:18:13 +0000 Subject: [PATCH 060/528] Remove "libmpeg2" bitstream reader Using the libmpeg2 reader causes errors in a multitude of places, including MPEG and H264 codecs. As the advantage of this reader is questionable, removing it seems the sensible course of action, especially considering the simplifications this allows elsewhere with the bit cache size increasing from 17 to 25 bits as minimum. Signed-off-by: Mans Rullgard --- libavcodec/get_bits.h | 77 ++----------------------------------------- 1 file changed, 3 insertions(+), 74 deletions(-) diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index f4b3646e69..9471243316 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -39,12 +39,11 @@ # define ALT_BITSTREAM_READER #endif -#if !defined(LIBMPEG2_BITSTREAM_READER) && !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER) +#if !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER) # if ARCH_ARM && !HAVE_FAST_UNALIGNED # define A32_BITSTREAM_READER # else # define ALT_BITSTREAM_READER -//#define LIBMPEG2_BITSTREAM_READER //#define A32_BITSTREAM_READER # endif #endif @@ -55,10 +54,6 @@ typedef struct GetBitContext { const uint8_t *buffer, *buffer_end; #ifdef ALT_BITSTREAM_READER int index; -#elif defined LIBMPEG2_BITSTREAM_READER - uint8_t *buffer_ptr; - uint32_t cache; - int bit_count; #elif defined A32_BITSTREAM_READER uint32_t *buffer_ptr; uint32_t cache0; @@ -189,66 +184,6 @@ static inline void skip_bits_long(GetBitContext *s, int n){ s->index += n; } -#elif defined LIBMPEG2_BITSTREAM_READER -//libmpeg2 like reader - -# define MIN_CACHE_BITS 17 - -# define OPEN_READER(name, gb)\ - int name##_bit_count=(gb)->bit_count;\ - int name##_cache= (gb)->cache;\ - uint8_t * name##_buffer_ptr=(gb)->buffer_ptr;\ - -# define CLOSE_READER(name, gb)\ - (gb)->bit_count= name##_bit_count;\ - (gb)->cache= name##_cache;\ - (gb)->buffer_ptr= name##_buffer_ptr;\ - -# define UPDATE_CACHE(name, gb)\ - if(name##_bit_count >= 0){\ - name##_cache+= AV_RB16(name##_buffer_ptr) << name##_bit_count; \ - name##_buffer_ptr+=2;\ - name##_bit_count-= 16;\ - }\ - -# define SKIP_CACHE(name, gb, num)\ - name##_cache <<= (num);\ - -# define SKIP_COUNTER(name, gb, num)\ - name##_bit_count += (num);\ - -# define SKIP_BITS(name, gb, num)\ - {\ - SKIP_CACHE(name, gb, num)\ - SKIP_COUNTER(name, gb, num)\ - }\ - -# define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num) -# define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num) - -# define SHOW_UBITS(name, gb, num)\ - NEG_USR32(name##_cache, num) - -# define SHOW_SBITS(name, gb, num)\ - NEG_SSR32(name##_cache, num) - -# define GET_CACHE(name, gb)\ - ((uint32_t)name##_cache) - -static inline int get_bits_count(const GetBitContext *s){ - return (s->buffer_ptr - s->buffer)*8 - 16 + s->bit_count; -} - -static inline void skip_bits_long(GetBitContext *s, int n){ - OPEN_READER(re, s) - re_bit_count += n; - re_buffer_ptr += 2*(re_bit_count>>4); - re_bit_count &= 15; - re_cache = ((re_buffer_ptr[-2]<<8) + re_buffer_ptr[-1]) << (16+re_bit_count); - UPDATE_CACHE(re, s) - CLOSE_READER(re, s) -} - #elif defined A32_BITSTREAM_READER # define MIN_CACHE_BITS 32 @@ -356,8 +291,7 @@ static inline int get_sbits(GetBitContext *s, int n){ } /** - * reads 1-17 bits. - * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't + * Read 1-25 bits. */ static inline unsigned int get_bits(GetBitContext *s, int n){ register int tmp; @@ -370,8 +304,7 @@ static inline unsigned int get_bits(GetBitContext *s, int n){ } /** - * shows 1-17 bits. - * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't + * Shows 1-25 bits. */ static inline unsigned int show_bits(GetBitContext *s, int n){ register int tmp; @@ -484,10 +417,6 @@ static inline void init_get_bits(GetBitContext *s, s->buffer_end= buffer + buffer_size; #ifdef ALT_BITSTREAM_READER s->index=0; -#elif defined LIBMPEG2_BITSTREAM_READER - s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1)); - s->bit_count = 16 + 8*((intptr_t)buffer&1); - skip_bits_long(s, 0); #elif defined A32_BITSTREAM_READER s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3)); s->bit_count = 32 + 8*((intptr_t)buffer&3); From bf5f9b528b4117596afc57578a36e7b5728b15d3 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 23 Jan 2011 01:24:46 +0000 Subject: [PATCH 061/528] Sanitise get_bits macros, part 1 Some of the macros in get_bits.h include a final semicolon, some do not. This removes these or adds do {} while(0) around the macros as appropriate and adds semicolons where needed in calling code. Signed-off-by: Mans Rullgard --- libavcodec/get_bits.h | 127 +++++++++++++++++++++--------------------- libavcodec/mjpegdec.c | 24 ++++---- 2 files changed, 77 insertions(+), 74 deletions(-) diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index 9471243316..4fbfbb9452 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -127,37 +127,37 @@ for examples see get_bits, show_bits, skip_bits, get_vlc # define OPEN_READER(name, gb)\ unsigned int name##_index= (gb)->index;\ - int name##_cache= 0;\ + int name##_cache= 0 # define CLOSE_READER(name, gb)\ - (gb)->index= name##_index;\ + (gb)->index= name##_index # ifdef ALT_BITSTREAM_READER_LE # define UPDATE_CACHE(name, gb)\ - name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07);\ + name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07) # define SKIP_CACHE(name, gb, num)\ - name##_cache >>= (num); + name##_cache >>= (num) # else # define UPDATE_CACHE(name, gb)\ - name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\ + name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07) # define SKIP_CACHE(name, gb, num)\ - name##_cache <<= (num); + name##_cache <<= (num) # endif // FIXME name? # define SKIP_COUNTER(name, gb, num)\ - name##_index += (num);\ + name##_index += (num) # define SKIP_BITS(name, gb, num)\ - {\ - SKIP_CACHE(name, gb, num)\ - SKIP_COUNTER(name, gb, num)\ - }\ + do {\ + SKIP_CACHE(name, gb, num);\ + SKIP_COUNTER(name, gb, num);\ + } while (0) # define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num) -# define LAST_SKIP_CACHE(name, gb, num) ; +# define LAST_SKIP_CACHE(name, gb, num) # ifdef ALT_BITSTREAM_READER_LE # define SHOW_UBITS(name, gb, num)\ @@ -192,15 +192,16 @@ static inline void skip_bits_long(GetBitContext *s, int n){ int name##_bit_count=(gb)->bit_count;\ uint32_t name##_cache0= (gb)->cache0;\ uint32_t name##_cache1= (gb)->cache1;\ - uint32_t * name##_buffer_ptr=(gb)->buffer_ptr;\ + uint32_t * name##_buffer_ptr=(gb)->buffer_ptr -# define CLOSE_READER(name, gb)\ +# define CLOSE_READER(name, gb) do {\ (gb)->bit_count= name##_bit_count;\ (gb)->cache0= name##_cache0;\ (gb)->cache1= name##_cache1;\ (gb)->buffer_ptr= name##_buffer_ptr;\ + } while (0) -# define UPDATE_CACHE(name, gb)\ +# define UPDATE_CACHE(name, gb) do {\ if(name##_bit_count > 0){\ const uint32_t next= av_be2ne32( *name##_buffer_ptr );\ name##_cache0 |= NEG_USR32(next,name##_bit_count);\ @@ -208,6 +209,7 @@ static inline void skip_bits_long(GetBitContext *s, int n){ name##_buffer_ptr++;\ name##_bit_count-= 32;\ }\ +} while (0) #if ARCH_X86 # define SKIP_CACHE(name, gb, num)\ @@ -216,22 +218,23 @@ static inline void skip_bits_long(GetBitContext *s, int n){ "shll %2, %1 \n\t"\ : "+r" (name##_cache0), "+r" (name##_cache1)\ : "Ic" ((uint8_t)(num))\ - ); + ) #else -# define SKIP_CACHE(name, gb, num)\ +# define SKIP_CACHE(name, gb, num) do {\ name##_cache0 <<= (num);\ name##_cache0 |= NEG_USR32(name##_cache1,num);\ - name##_cache1 <<= (num); + name##_cache1 <<= (num);\ + } while (0) #endif # define SKIP_COUNTER(name, gb, num)\ - name##_bit_count += (num);\ + name##_bit_count += (num) # define SKIP_BITS(name, gb, num)\ - {\ - SKIP_CACHE(name, gb, num)\ - SKIP_COUNTER(name, gb, num)\ - }\ + do {\ + SKIP_CACHE(name, gb, num);\ + SKIP_COUNTER(name, gb, num);\ + } while (0) # define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num) # define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num) @@ -250,14 +253,14 @@ static inline int get_bits_count(const GetBitContext *s){ } static inline void skip_bits_long(GetBitContext *s, int n){ - OPEN_READER(re, s) + OPEN_READER(re, s); re_bit_count += n; re_buffer_ptr += re_bit_count>>5; re_bit_count &= 31; re_cache0 = av_be2ne32( re_buffer_ptr[-1] ) << re_bit_count; re_cache1 = 0; - UPDATE_CACHE(re, s) - CLOSE_READER(re, s) + UPDATE_CACHE(re, s); + CLOSE_READER(re, s); } #endif @@ -271,22 +274,22 @@ static inline void skip_bits_long(GetBitContext *s, int n){ static inline int get_xbits(GetBitContext *s, int n){ register int sign; register int32_t cache; - OPEN_READER(re, s) - UPDATE_CACHE(re, s) + OPEN_READER(re, s); + UPDATE_CACHE(re, s); cache = GET_CACHE(re,s); sign=(~cache)>>31; - LAST_SKIP_BITS(re, s, n) - CLOSE_READER(re, s) + LAST_SKIP_BITS(re, s, n); + CLOSE_READER(re, s); return (NEG_USR32(sign ^ cache, n) ^ sign) - sign; } static inline int get_sbits(GetBitContext *s, int n){ register int tmp; - OPEN_READER(re, s) - UPDATE_CACHE(re, s) + OPEN_READER(re, s); + UPDATE_CACHE(re, s); tmp= SHOW_SBITS(re, s, n); - LAST_SKIP_BITS(re, s, n) - CLOSE_READER(re, s) + LAST_SKIP_BITS(re, s, n); + CLOSE_READER(re, s); return tmp; } @@ -295,11 +298,11 @@ static inline int get_sbits(GetBitContext *s, int n){ */ static inline unsigned int get_bits(GetBitContext *s, int n){ register int tmp; - OPEN_READER(re, s) - UPDATE_CACHE(re, s) + OPEN_READER(re, s); + UPDATE_CACHE(re, s); tmp= SHOW_UBITS(re, s, n); - LAST_SKIP_BITS(re, s, n) - CLOSE_READER(re, s) + LAST_SKIP_BITS(re, s, n); + CLOSE_READER(re, s); return tmp; } @@ -308,8 +311,8 @@ static inline unsigned int get_bits(GetBitContext *s, int n){ */ static inline unsigned int show_bits(GetBitContext *s, int n){ register int tmp; - OPEN_READER(re, s) - UPDATE_CACHE(re, s) + OPEN_READER(re, s); + UPDATE_CACHE(re, s); tmp= SHOW_UBITS(re, s, n); // CLOSE_READER(re, s) return tmp; @@ -317,10 +320,10 @@ static inline unsigned int show_bits(GetBitContext *s, int n){ static inline void skip_bits(GetBitContext *s, int n){ //Note gcc seems to optimize this to s->index+=n for the ALT_READER :)) - OPEN_READER(re, s) - UPDATE_CACHE(re, s) - LAST_SKIP_BITS(re, s, n) - CLOSE_READER(re, s) + OPEN_READER(re, s); + UPDATE_CACHE(re, s); + LAST_SKIP_BITS(re, s, n); + CLOSE_READER(re, s); } static inline unsigned int get_bits1(GetBitContext *s){ @@ -449,12 +452,12 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, void free_vlc(VLC *vlc); #define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size)\ -{\ +do {\ static VLC_TYPE table[static_size][2];\ (vlc)->table= table;\ (vlc)->table_allocated= static_size;\ init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC);\ -} +} while (0) /** @@ -464,7 +467,7 @@ void free_vlc(VLC *vlc); * is undefined. */ #define GET_VLC(code, name, gb, table, bits, max_depth)\ -{\ +do {\ int n, nb_bits;\ unsigned int index;\ \ @@ -473,8 +476,8 @@ void free_vlc(VLC *vlc); n = table[index][1];\ \ if(max_depth > 1 && n < 0){\ - LAST_SKIP_BITS(name, gb, bits)\ - UPDATE_CACHE(name, gb)\ + LAST_SKIP_BITS(name, gb, bits);\ + UPDATE_CACHE(name, gb);\ \ nb_bits = -n;\ \ @@ -482,8 +485,8 @@ void free_vlc(VLC *vlc); code = table[index][0];\ n = table[index][1];\ if(max_depth > 2 && n < 0){\ - LAST_SKIP_BITS(name, gb, nb_bits)\ - UPDATE_CACHE(name, gb)\ + LAST_SKIP_BITS(name, gb, nb_bits);\ + UPDATE_CACHE(name, gb);\ \ nb_bits = -n;\ \ @@ -492,11 +495,11 @@ void free_vlc(VLC *vlc); n = table[index][1];\ }\ }\ - SKIP_BITS(name, gb, n)\ -} + SKIP_BITS(name, gb, n);\ +} while (0) #define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\ -{\ +do {\ int n, nb_bits;\ unsigned int index;\ \ @@ -505,9 +508,9 @@ void free_vlc(VLC *vlc); n = table[index].len;\ \ if(max_depth > 1 && n < 0){\ - SKIP_BITS(name, gb, bits)\ + SKIP_BITS(name, gb, bits);\ if(need_update){\ - UPDATE_CACHE(name, gb)\ + UPDATE_CACHE(name, gb);\ }\ \ nb_bits = -n;\ @@ -517,8 +520,8 @@ void free_vlc(VLC *vlc); n = table[index].len;\ }\ run= table[index].run;\ - SKIP_BITS(name, gb, n)\ -} + SKIP_BITS(name, gb, n);\ +} while (0) /** @@ -534,12 +537,12 @@ static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], { int code; - OPEN_READER(re, s) - UPDATE_CACHE(re, s) + OPEN_READER(re, s); + UPDATE_CACHE(re, s); - GET_VLC(code, re, s, table, bits, max_depth) + GET_VLC(code, re, s, table, bits, max_depth); - CLOSE_READER(re, s) + CLOSE_READER(re, s); return code; } diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 19bd2f7a96..3386cc07d3 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -416,16 +416,16 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block, block[0] = val; /* AC coefs */ i = 0; - {OPEN_READER(re, &s->gb) + {OPEN_READER(re, &s->gb); do { UPDATE_CACHE(re, &s->gb); - GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) + GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2); i += ((unsigned)code) >> 4; code &= 0xf; if(code){ if(code > MIN_CACHE_BITS - 16){ - UPDATE_CACHE(re, &s->gb) + UPDATE_CACHE(re, &s->gb); } { int cache=GET_CACHE(re,&s->gb); @@ -433,7 +433,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block, level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; } - LAST_SKIP_BITS(re, &s->gb, code) + LAST_SKIP_BITS(re, &s->gb, code); if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); @@ -443,7 +443,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block, block[j] = level * quant_matrix[j]; } }while(i<63); - CLOSE_READER(re, &s->gb)} + CLOSE_READER(re, &s->gb);} return 0; } @@ -475,17 +475,17 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8 (*EOBRUN)--; return 0; } - {OPEN_READER(re, &s->gb) + {OPEN_READER(re, &s->gb); for(i=ss;;i++) { UPDATE_CACHE(re, &s->gb); - GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2) + 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) + UPDATE_CACHE(re, &s->gb); } { int cache=GET_CACHE(re,&s->gb); @@ -493,7 +493,7 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8 level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; } - LAST_SKIP_BITS(re, &s->gb, code) + LAST_SKIP_BITS(re, &s->gb, code); if (i >= se) { if(i == se){ @@ -525,7 +525,7 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8 } } } - CLOSE_READER(re, &s->gb)} + CLOSE_READER(re, &s->gb);} if(i > *last_nnz) *last_nnz = i; return 0; @@ -569,7 +569,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_ else { for(;;i++) { UPDATE_CACHE(re, &s->gb); - GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2) + GET_VLC(code, re, &s->gb, s->vlcs[2][ac_index].table, 9, 2); if(code & 0xF) { run = ((unsigned) code) >> 4; @@ -583,7 +583,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_ if(i == se) { if(i > *last_nnz) *last_nnz = i; - CLOSE_READER(re, &s->gb) + CLOSE_READER(re, &s->gb); return 0; } }else{ From fb5c841d5f05ae54b699ba6ef28356a6563751eb Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 23 Jan 2011 01:56:27 +0000 Subject: [PATCH 062/528] Sanitise get_bits macros, part 2 These whitespace changes improve the readability of the get_bits macros. Signed-off-by: Mans Rullgard --- libavcodec/get_bits.h | 374 ++++++++++++++++++++---------------------- 1 file changed, 180 insertions(+), 194 deletions(-) diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index 4fbfbb9452..88d2bbf80b 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -125,56 +125,46 @@ for examples see get_bits, show_bits, skip_bits, get_vlc #ifdef ALT_BITSTREAM_READER # define MIN_CACHE_BITS 25 -# define OPEN_READER(name, gb)\ - unsigned int name##_index= (gb)->index;\ - int name##_cache= 0 +# define OPEN_READER(name, gb) \ + unsigned int name##_index = (gb)->index; \ + int name##_cache = 0 -# define CLOSE_READER(name, gb)\ - (gb)->index= name##_index +# define CLOSE_READER(name, gb) (gb)->index = name##_index # ifdef ALT_BITSTREAM_READER_LE -# define UPDATE_CACHE(name, gb)\ - name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07) +# define UPDATE_CACHE(name, gb) \ + name##_cache = AV_RL32(((const uint8_t *)(gb)->buffer)+(name##_index>>3)) >> (name##_index&0x07) -# define SKIP_CACHE(name, gb, num)\ - name##_cache >>= (num) +# define SKIP_CACHE(name, gb, num) name##_cache >>= (num) # else -# define UPDATE_CACHE(name, gb)\ - name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07) +# define UPDATE_CACHE(name, gb) \ + name##_cache = AV_RB32(((const uint8_t *)(gb)->buffer)+(name##_index>>3)) << (name##_index&0x07) -# define SKIP_CACHE(name, gb, num)\ - name##_cache <<= (num) +# define SKIP_CACHE(name, gb, num) name##_cache <<= (num) # endif // FIXME name? -# define SKIP_COUNTER(name, gb, num)\ - name##_index += (num) +# define SKIP_COUNTER(name, gb, num) name##_index += (num) -# define SKIP_BITS(name, gb, num)\ - do {\ - SKIP_CACHE(name, gb, num);\ - SKIP_COUNTER(name, gb, num);\ - } while (0) +# define SKIP_BITS(name, gb, num) do { \ + SKIP_CACHE(name, gb, num); \ + SKIP_COUNTER(name, gb, num); \ + } while (0) # define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num) # define LAST_SKIP_CACHE(name, gb, num) # ifdef ALT_BITSTREAM_READER_LE -# define SHOW_UBITS(name, gb, num)\ - zero_extend(name##_cache, num) +# define SHOW_UBITS(name, gb, num) zero_extend(name##_cache, num) -# define SHOW_SBITS(name, gb, num)\ - sign_extend(name##_cache, num) +# define SHOW_SBITS(name, gb, num) sign_extend(name##_cache, num) # else -# define SHOW_UBITS(name, gb, num)\ - NEG_USR32(name##_cache, num) +# define SHOW_UBITS(name, gb, num) NEG_USR32(name##_cache, num) -# define SHOW_SBITS(name, gb, num)\ - NEG_SSR32(name##_cache, num) +# define SHOW_SBITS(name, gb, num) NEG_SSR32(name##_cache, num) # endif -# define GET_CACHE(name, gb)\ - ((uint32_t)name##_cache) +# define GET_CACHE(name, gb) ((uint32_t)name##_cache) static inline int get_bits_count(const GetBitContext *s){ return s->index; @@ -188,67 +178,60 @@ static inline void skip_bits_long(GetBitContext *s, int n){ # define MIN_CACHE_BITS 32 -# define OPEN_READER(name, gb)\ - int name##_bit_count=(gb)->bit_count;\ - uint32_t name##_cache0= (gb)->cache0;\ - uint32_t name##_cache1= (gb)->cache1;\ - uint32_t * name##_buffer_ptr=(gb)->buffer_ptr +# define OPEN_READER(name, gb) \ + int name##_bit_count = (gb)->bit_count; \ + uint32_t name##_cache0 = (gb)->cache0; \ + uint32_t name##_cache1 = (gb)->cache1; \ + uint32_t *name##_buffer_ptr = (gb)->buffer_ptr -# define CLOSE_READER(name, gb) do {\ - (gb)->bit_count= name##_bit_count;\ - (gb)->cache0= name##_cache0;\ - (gb)->cache1= name##_cache1;\ - (gb)->buffer_ptr= name##_buffer_ptr;\ +# define CLOSE_READER(name, gb) do { \ + (gb)->bit_count = name##_bit_count; \ + (gb)->cache0 = name##_cache0; \ + (gb)->cache1 = name##_cache1; \ + (gb)->buffer_ptr = name##_buffer_ptr; \ } while (0) -# define UPDATE_CACHE(name, gb) do {\ - if(name##_bit_count > 0){\ - const uint32_t next= av_be2ne32( *name##_buffer_ptr );\ - name##_cache0 |= NEG_USR32(next,name##_bit_count);\ - name##_cache1 |= next< 0){ \ + const uint32_t next = av_be2ne32(*name##_buffer_ptr); \ + name##_cache0 |= NEG_USR32(next, name##_bit_count); \ + name##_cache1 |= next << name##_bit_count; \ + name##_buffer_ptr++; \ + name##_bit_count -= 32; \ + } \ + } while (0) #if ARCH_X86 -# define SKIP_CACHE(name, gb, num)\ - __asm__(\ - "shldl %2, %1, %0 \n\t"\ - "shll %2, %1 \n\t"\ - : "+r" (name##_cache0), "+r" (name##_cache1)\ - : "Ic" ((uint8_t)(num))\ - ) +# define SKIP_CACHE(name, gb, num) \ + __asm__("shldl %2, %1, %0 \n\t" \ + "shll %2, %1 \n\t" \ + : "+r" (name##_cache0), "+r" (name##_cache1) \ + : "Ic" ((uint8_t)(num))) #else -# define SKIP_CACHE(name, gb, num) do {\ - name##_cache0 <<= (num);\ - name##_cache0 |= NEG_USR32(name##_cache1,num);\ - name##_cache1 <<= (num);\ +# define SKIP_CACHE(name, gb, num) do { \ + name##_cache0 <<= (num); \ + name##_cache0 |= NEG_USR32(name##_cache1,num); \ + name##_cache1 <<= (num); \ } while (0) #endif -# define SKIP_COUNTER(name, gb, num)\ - name##_bit_count += (num) +# define SKIP_COUNTER(name, gb, num) name##_bit_count += (num) -# define SKIP_BITS(name, gb, num)\ - do {\ - SKIP_CACHE(name, gb, num);\ - SKIP_COUNTER(name, gb, num);\ - } while (0) +# define SKIP_BITS(name, gb, num) do { \ + SKIP_CACHE(name, gb, num); \ + SKIP_COUNTER(name, gb, num); \ + } while (0) -# define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num) +# define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num) # define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num) -# define SHOW_UBITS(name, gb, num)\ - NEG_USR32(name##_cache0, num) +# define SHOW_UBITS(name, gb, num) NEG_USR32(name##_cache0, num) -# define SHOW_SBITS(name, gb, num)\ - NEG_SSR32(name##_cache0, num) +# define SHOW_SBITS(name, gb, num) NEG_SSR32(name##_cache0, num) -# define GET_CACHE(name, gb)\ - (name##_cache0) +# define GET_CACHE(name, gb) name##_cache0 -static inline int get_bits_count(const GetBitContext *s){ +static inline int get_bits_count(const GetBitContext *s) { return ((uint8_t*)s->buffer_ptr - s->buffer)*8 - 32 + s->bit_count; } @@ -257,7 +240,7 @@ static inline void skip_bits_long(GetBitContext *s, int n){ re_bit_count += n; re_buffer_ptr += re_bit_count>>5; re_bit_count &= 31; - re_cache0 = av_be2ne32( re_buffer_ptr[-1] ) << re_bit_count; + re_cache0 = av_be2ne32(re_buffer_ptr[-1]) << re_bit_count; re_cache1 = 0; UPDATE_CACHE(re, s); CLOSE_READER(re, s); @@ -276,8 +259,8 @@ static inline int get_xbits(GetBitContext *s, int n){ register int32_t cache; OPEN_READER(re, s); UPDATE_CACHE(re, s); - cache = GET_CACHE(re,s); - sign=(~cache)>>31; + cache = GET_CACHE(re, s); + sign = ~cache >> 31; LAST_SKIP_BITS(re, s, n); CLOSE_READER(re, s); return (NEG_USR32(sign ^ cache, n) ^ sign) - sign; @@ -287,7 +270,7 @@ static inline int get_sbits(GetBitContext *s, int n){ register int tmp; OPEN_READER(re, s); UPDATE_CACHE(re, s); - tmp= SHOW_SBITS(re, s, n); + tmp = SHOW_SBITS(re, s, n); LAST_SKIP_BITS(re, s, n); CLOSE_READER(re, s); return tmp; @@ -300,7 +283,7 @@ static inline unsigned int get_bits(GetBitContext *s, int n){ register int tmp; OPEN_READER(re, s); UPDATE_CACHE(re, s); - tmp= SHOW_UBITS(re, s, n); + tmp = SHOW_UBITS(re, s, n); LAST_SKIP_BITS(re, s, n); CLOSE_READER(re, s); return tmp; @@ -313,8 +296,7 @@ static inline unsigned int show_bits(GetBitContext *s, int n){ register int tmp; OPEN_READER(re, s); UPDATE_CACHE(re, s); - tmp= SHOW_UBITS(re, s, n); -// CLOSE_READER(re, s) + tmp = SHOW_UBITS(re, s, n); return tmp; } @@ -328,17 +310,17 @@ static inline void skip_bits(GetBitContext *s, int n){ static inline unsigned int get_bits1(GetBitContext *s){ #ifdef ALT_BITSTREAM_READER - unsigned int index= s->index; - uint8_t result= s->buffer[ index>>3 ]; + unsigned int index = s->index; + uint8_t result = s->buffer[index>>3]; #ifdef ALT_BITSTREAM_READER_LE - result>>= (index&0x07); - result&= 1; + result >>= index & 7; + result &= 1; #else - result<<= (index&0x07); - result>>= 8 - 1; + result <<= index & 7; + result >>= 8 - 1; #endif index++; - s->index= index; + s->index = index; return result; #else @@ -358,13 +340,13 @@ static inline void skip_bits1(GetBitContext *s){ * reads 0-32 bits. */ static inline unsigned int get_bits_long(GetBitContext *s, int n){ - if(n<=MIN_CACHE_BITS) return get_bits(s, n); - else{ + if (n <= MIN_CACHE_BITS) return get_bits(s, n); + else { #ifdef ALT_BITSTREAM_READER_LE - int ret= get_bits(s, 16); + int ret = get_bits(s, 16); return ret | (get_bits(s, n-16) << 16); #else - int ret= get_bits(s, 16) << (n-16); + int ret = get_bits(s, 16) << (n-16); return ret | get_bits(s, n-16); #endif } @@ -381,17 +363,17 @@ static inline int get_sbits_long(GetBitContext *s, int n) { * shows 0-32 bits. */ static inline unsigned int show_bits_long(GetBitContext *s, int n){ - if(n<=MIN_CACHE_BITS) return show_bits(s, n); - else{ - GetBitContext gb= *s; + if (n <= MIN_CACHE_BITS) return show_bits(s, n); + else { + GetBitContext gb = *s; return get_bits_long(&gb, n); } } static inline int check_marker(GetBitContext *s, const char *msg) { - int bit= get_bits1(s); - if(!bit) + int bit = get_bits1(s); + if (!bit) av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg); return bit; @@ -409,38 +391,38 @@ static inline int check_marker(GetBitContext *s, const char *msg) static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size) { - int buffer_size= (bit_size+7)>>3; - if(buffer_size < 0 || bit_size < 0) { + int buffer_size = (bit_size+7)>>3; + if (buffer_size < 0 || bit_size < 0) { buffer_size = bit_size = 0; buffer = NULL; } - s->buffer= buffer; - s->size_in_bits= bit_size; - s->buffer_end= buffer + buffer_size; + s->buffer = buffer; + s->size_in_bits = bit_size; + s->buffer_end = buffer + buffer_size; #ifdef ALT_BITSTREAM_READER - s->index=0; + s->index = 0; #elif defined A32_BITSTREAM_READER - s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3)); - s->bit_count = 32 + 8*((intptr_t)buffer&3); + s->buffer_ptr = (uint32_t*)((intptr_t)buffer & ~3); + s->bit_count = 32 + 8*((intptr_t)buffer & 3); skip_bits_long(s, 0); #endif } static inline void align_get_bits(GetBitContext *s) { - int n= (-get_bits_count(s)) & 7; - if(n) skip_bits(s, n); + int n = -get_bits_count(s) & 7; + if (n) skip_bits(s, n); } -#define init_vlc(vlc, nb_bits, nb_codes,\ - bits, bits_wrap, bits_size,\ - codes, codes_wrap, codes_size,\ - flags)\ - init_vlc_sparse(vlc, nb_bits, nb_codes,\ - bits, bits_wrap, bits_size,\ - codes, codes_wrap, codes_size,\ - NULL, 0, 0, flags) +#define init_vlc(vlc, nb_bits, nb_codes, \ + bits, bits_wrap, bits_size, \ + codes, codes_wrap, codes_size, \ + flags) \ + init_vlc_sparse(vlc, nb_bits, nb_codes, \ + bits, bits_wrap, bits_size, \ + codes, codes_wrap, codes_size, \ + NULL, 0, 0, flags) int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, @@ -451,13 +433,12 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, #define INIT_VLC_USE_NEW_STATIC 4 void free_vlc(VLC *vlc); -#define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size)\ -do {\ - static VLC_TYPE table[static_size][2];\ - (vlc)->table= table;\ - (vlc)->table_allocated= static_size;\ - init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC);\ -} while (0) +#define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size) do { \ + static VLC_TYPE table[static_size][2]; \ + (vlc)->table = table; \ + (vlc)->table_allocated = static_size; \ + init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC); \ + } while (0) /** @@ -466,62 +447,60 @@ do {\ * If the vlc code is invalid and max_depth>1, then the number of bits removed * is undefined. */ -#define GET_VLC(code, name, gb, table, bits, max_depth)\ -do {\ - int n, nb_bits;\ - unsigned int index;\ -\ - index= SHOW_UBITS(name, gb, bits);\ - code = table[index][0];\ - n = table[index][1];\ -\ - if(max_depth > 1 && n < 0){\ - LAST_SKIP_BITS(name, gb, bits);\ - UPDATE_CACHE(name, gb);\ -\ - nb_bits = -n;\ -\ - index= SHOW_UBITS(name, gb, nb_bits) + code;\ - code = table[index][0];\ - n = table[index][1];\ - if(max_depth > 2 && n < 0){\ - LAST_SKIP_BITS(name, gb, nb_bits);\ - UPDATE_CACHE(name, gb);\ -\ - nb_bits = -n;\ -\ - index= SHOW_UBITS(name, gb, nb_bits) + code;\ - code = table[index][0];\ - n = table[index][1];\ - }\ - }\ - SKIP_BITS(name, gb, n);\ -} while (0) +#define GET_VLC(code, name, gb, table, bits, max_depth) do { \ + int n, nb_bits; \ + unsigned int index; \ + \ + index = SHOW_UBITS(name, gb, bits); \ + code = table[index][0]; \ + n = table[index][1]; \ + \ + if (max_depth > 1 && n < 0) { \ + LAST_SKIP_BITS(name, gb, bits); \ + UPDATE_CACHE(name, gb); \ + \ + nb_bits = -n; \ + \ + index = SHOW_UBITS(name, gb, nb_bits) + code; \ + code = table[index][0]; \ + n = table[index][1]; \ + if (max_depth > 2 && n < 0) { \ + LAST_SKIP_BITS(name, gb, nb_bits); \ + UPDATE_CACHE(name, gb); \ + \ + nb_bits = -n; \ + \ + index = SHOW_UBITS(name, gb, nb_bits) + code; \ + code = table[index][0]; \ + n = table[index][1]; \ + } \ + } \ + SKIP_BITS(name, gb, n); \ + } while (0) -#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\ -do {\ - int n, nb_bits;\ - unsigned int index;\ -\ - index= SHOW_UBITS(name, gb, bits);\ - level = table[index].level;\ - n = table[index].len;\ -\ - if(max_depth > 1 && n < 0){\ - SKIP_BITS(name, gb, bits);\ - if(need_update){\ - UPDATE_CACHE(name, gb);\ - }\ -\ - nb_bits = -n;\ -\ - index= SHOW_UBITS(name, gb, nb_bits) + level;\ - level = table[index].level;\ - n = table[index].len;\ - }\ - run= table[index].run;\ - SKIP_BITS(name, gb, n);\ -} while (0) +#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update) do { \ + int n, nb_bits; \ + unsigned int index; \ + \ + index = SHOW_UBITS(name, gb, bits); \ + level = table[index].level; \ + n = table[index].len; \ + \ + if (max_depth > 1 && n < 0) { \ + SKIP_BITS(name, gb, bits); \ + if (need_update) { \ + UPDATE_CACHE(name, gb); \ + } \ + \ + nb_bits = -n; \ + \ + index = SHOW_UBITS(name, gb, nb_bits) + level; \ + level = table[index].level; \ + n = table[index].len; \ + } \ + run = table[index].run; \ + SKIP_BITS(name, gb, n); \ + } while (0) /** @@ -552,38 +531,45 @@ static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], static inline void print_bin(int bits, int n){ int i; - for(i=n-1; i>=0; i--){ + for (i = n-1; i >= 0; i--) { av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1); } - for(i=n; i<24; i++) + for (i = n; i < 24; i++) av_log(NULL, AV_LOG_DEBUG, " "); } -static inline int get_bits_trace(GetBitContext *s, int n, char *file, const char *func, int line){ - int r= get_bits(s, n); +static inline int get_bits_trace(GetBitContext *s, int n, char *file, + const char *func, int line){ + int r = get_bits(s, n); print_bin(r, n); - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line); + av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", + r, n, r, get_bits_count(s)-n, file, func, line); return r; } -static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth, char *file, const char *func, int line){ - int show= show_bits(s, 24); - int pos= get_bits_count(s); - int r= get_vlc2(s, table, bits, max_depth); - int len= get_bits_count(s) - pos; - int bits2= show>>(24-len); +static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], + int bits, int max_depth, char *file, + const char *func, int line){ + int show = show_bits(s, 24); + int pos = get_bits_count(s); + int r = get_vlc2(s, table, bits, max_depth); + int len = get_bits_count(s) - pos; + int bits2 = show >> (24-len); print_bin(bits2, len); - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line); + av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", + bits2, len, r, pos, file, func, line); return r; } -static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const char *func, int line){ - int show= show_bits(s, n); - int r= get_xbits(s, n); +static inline int get_xbits_trace(GetBitContext *s, int n, char *file, + const char *func, int line){ + int show = show_bits(s, n); + int r = get_xbits(s, n); print_bin(show, n); - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line); + av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", + show, n, r, get_bits_count(s)-n, file, func, line); return r; } From 611a6f59ce91947b25033bb8d0f9311b5c542b05 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 23 Jan 2011 14:01:43 +0000 Subject: [PATCH 063/528] get_bits: move tracing macros to end of file Signed-off-by: Mans Rullgard --- libavcodec/get_bits.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index 88d2bbf80b..210ccc7ca6 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -525,6 +525,27 @@ static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], return code; } +static inline int decode012(GetBitContext *gb){ + int n; + n = get_bits1(gb); + if (n == 0) + return 0; + else + return get_bits1(gb) + 1; +} + +static inline int decode210(GetBitContext *gb){ + if (get_bits1(gb)) + return 0; + else + return 2 - get_bits1(gb); +} + +static inline int get_bits_left(GetBitContext *gb) +{ + return gb->size_in_bits - get_bits_count(gb); +} + //#define TRACE #ifdef TRACE @@ -585,25 +606,4 @@ static inline int get_xbits_trace(GetBitContext *s, int n, char *file, #define tprintf(p, ...) {} #endif -static inline int decode012(GetBitContext *gb){ - int n; - n = get_bits1(gb); - if (n == 0) - return 0; - else - return get_bits1(gb) + 1; -} - -static inline int decode210(GetBitContext *gb){ - if (get_bits1(gb)) - return 0; - else - return 2 - get_bits1(gb); -} - -static inline int get_bits_left(GetBitContext *gb) -{ - return gb->size_in_bits - get_bits_count(gb); -} - #endif /* AVCODEC_GET_BITS_H */ From f162e988aa0dc8df93079b5ebf452ec281ab8793 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 23 Jan 2011 02:22:34 +0000 Subject: [PATCH 064/528] Remove redundant checks against MIN_CACHE_BITS With the removal of the libmpeg2 bitstream reader, MIN_CACHE_BITS is always >= 25, so tests against smaller values can be removed. Signed-off-by: Mans Rullgard --- libavcodec/aacdec.c | 8 -------- libavcodec/mpeg12.c | 32 -------------------------------- libavcodec/mpeg4videodec.c | 10 ---------- libavcodec/msmpeg4.c | 10 ---------- 4 files changed, 60 deletions(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index fa527da37c..e6d32f4a73 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -1062,9 +1062,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024], UPDATE_CACHE(re, gb); GET_VLC(code, re, gb, vlc_tab, 8, 2); -#if MIN_CACHE_BITS < 20 - UPDATE_CACHE(re, gb); -#endif cb_idx = cb_vector_idx[code]; nnz = cb_idx >> 8 & 15; bits = SHOW_UBITS(re, gb, nnz) << (32-nnz); @@ -1157,12 +1154,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024], return -1; } -#if MIN_CACHE_BITS < 21 - LAST_SKIP_BITS(re, gb, b + 1); - UPDATE_CACHE(re, gb); -#else SKIP_BITS(re, gb, b + 1); -#endif b += 4; n = (1 << b) + SHOW_UBITS(re, gb, b); LAST_SKIP_BITS(re, gb, b); diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index d93474fe29..4aaa40290a 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -718,9 +718,6 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s, if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) goto end; } -#if MIN_CACHE_BITS < 19 - UPDATE_CACHE(re, &s->gb); -#endif /* now quantify & encode AC coefficients */ for(;;) { GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); @@ -760,14 +757,9 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s, } block[j] = level; -#if MIN_CACHE_BITS < 19 - UPDATE_CACHE(re, &s->gb); -#endif if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) break; -#if MIN_CACHE_BITS >= 19 UPDATE_CACHE(re, &s->gb); -#endif } end: LAST_SKIP_BITS(re, &s->gb, 2); @@ -800,9 +792,6 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *bloc if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) goto end; } -#if MIN_CACHE_BITS < 19 - UPDATE_CACHE(re, &s->gb); -#endif /* now quantify & encode AC coefficients */ for(;;) { @@ -839,14 +828,9 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *bloc } block[j] = level; -#if MIN_CACHE_BITS < 19 - UPDATE_CACHE(re, &s->gb); -#endif if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) break; -#if MIN_CACHE_BITS >= 19 UPDATE_CACHE(re, &s->gb); -#endif } end: LAST_SKIP_BITS(re, &s->gb, 2); @@ -891,9 +875,6 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) goto end; } -#if MIN_CACHE_BITS < 19 - UPDATE_CACHE(re, &s->gb); -#endif /* now quantify & encode AC coefficients */ for(;;) { @@ -927,14 +908,9 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, mismatch ^= level; block[j] = level; -#if MIN_CACHE_BITS < 19 - UPDATE_CACHE(re, &s->gb); -#endif if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) break; -#if MIN_CACHE_BITS >= 19 UPDATE_CACHE(re, &s->gb); -#endif } end: LAST_SKIP_BITS(re, &s->gb, 2); @@ -969,9 +945,6 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) goto end; } -#if MIN_CACHE_BITS < 19 - UPDATE_CACHE(re, &s->gb); -#endif /* now quantify & encode AC coefficients */ for(;;) { @@ -1000,14 +973,9 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, } block[j] = level; -#if MIN_CACHE_BITS < 19 - UPDATE_CACHE(re, &s->gb); -#endif if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF) break; -#if MIN_CACHE_BITS >=19 UPDATE_CACHE(re, &s->gb); -#endif } end: LAST_SKIP_BITS(re, &s->gb, 2); diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index c0d9f8fe3c..d331f0ded0 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1023,12 +1023,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, if(last) i+=192; } else { /* second escape */ -#if MIN_CACHE_BITS < 20 - LAST_SKIP_BITS(re, &s->gb, 2); - UPDATE_CACHE(re, &s->gb); -#else SKIP_BITS(re, &s->gb, 2); -#endif GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run + rl->max_run[run>>7][level/qmul] +1; //FIXME opt indexing level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); @@ -1036,12 +1031,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, } } else { /* first escape */ -#if MIN_CACHE_BITS < 19 - LAST_SKIP_BITS(re, &s->gb, 1); - UPDATE_CACHE(re, &s->gb); -#else SKIP_BITS(re, &s->gb, 1); -#endif GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run; level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index c54df7afa8..79a96e4a6c 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -1797,12 +1797,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, #endif } else { /* second escape */ -#if MIN_CACHE_BITS < 23 - LAST_SKIP_BITS(re, &s->gb, 2); - UPDATE_CACHE(re, &s->gb); -#else SKIP_BITS(re, &s->gb, 2); -#endif GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); @@ -1816,12 +1811,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, } } else { /* first escape */ -#if MIN_CACHE_BITS < 22 - LAST_SKIP_BITS(re, &s->gb, 1); - UPDATE_CACHE(re, &s->gb); -#else SKIP_BITS(re, &s->gb, 1); -#endif GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run; level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing From 2fd9035ddc4f6b9313023891a16b6e9820d958ed Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sun, 23 Jan 2011 15:45:19 +0100 Subject: [PATCH 065/528] aacenc: fix typo in sync extension constant in 8ae0fa2 --- libavcodec/aacenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 6a113ef30b..120f873342 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -151,7 +151,7 @@ static void put_audio_specific_config(AVCodecContext *avctx) put_bits(&pb, 1, 0); //is not extension //Explicitly Mark SBR absent - put_bits(&pb, 11, 0x27b); //sync extension + put_bits(&pb, 11, 0x2b7); //sync extension put_bits(&pb, 5, AOT_SBR); put_bits(&pb, 1, 0); flush_put_bits(&pb); From 7a5a168abe36c91087e58d89262a3658d21ea2cc Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 7 Oct 2010 01:25:31 +0100 Subject: [PATCH 066/528] MIPS: use inline asm only when supported by compiler --- libavcodec/mips/mathops.h | 4 ++++ libavutil/mips/intreadwrite.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/libavcodec/mips/mathops.h b/libavcodec/mips/mathops.h index a1b04ed951..b58361f74d 100644 --- a/libavcodec/mips/mathops.h +++ b/libavcodec/mips/mathops.h @@ -25,6 +25,8 @@ #include "config.h" #include "libavutil/common.h" +#if HAVE_INLINE_ASM + #if HAVE_LOONGSON static inline av_const int64_t MAC64(int64_t d, int a, int b) @@ -73,4 +75,6 @@ static inline av_const int64_t MLS64(int64_t d, int a, int b) #endif +#endif /* HAVE_INLINE_ASM */ + #endif /* AVCODEC_MIPS_MATHOPS_H */ diff --git a/libavutil/mips/intreadwrite.h b/libavutil/mips/intreadwrite.h index b7479d3446..cd4a9a9a67 100644 --- a/libavutil/mips/intreadwrite.h +++ b/libavutil/mips/intreadwrite.h @@ -24,6 +24,8 @@ #include #include "config.h" +#if HAVE_INLINE_ASM + #define AV_RN32 AV_RN32 static av_always_inline uint32_t AV_RN32(const void *p) { @@ -91,4 +93,6 @@ static av_always_inline void AV_WN64(void *p, uint64_t v) #endif /* ARCH_MIPS64 */ +#endif /* HAVE_INLINE_ASM */ + #endif /* AVUTIL_MIPS_INTREADWRITE_H */ From a1e4b3f6d322f61fc8ccae6ecd2586e04ceb7026 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 23 Jan 2011 20:48:51 +0000 Subject: [PATCH 067/528] Disable symbol versioning on some BSDs Dragonfly, NetBSD, and OpenBSD do not support symbol versioning although our link test passes. Disable it explicitly for these systems. Signed-off-by: Mans Rullgard --- configure | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 63eadca383..4c24152745 100755 --- a/configure +++ b/configure @@ -2306,6 +2306,7 @@ case $target_os in nm_opts='-P -g' ;; netbsd) + disable symver oss_indev_extralibs="-lossaudio" oss_outdev_extralibs="-lossaudio" add_cppflags -D_XOPEN_SOURCE=600 @@ -2318,11 +2319,16 @@ case $target_os in # (simply quits with exit-code 1, no crash, no output). # Thus explicitly enable PIC here. enable pic + disable symver SHFLAGS='-shared' oss_indev_extralibs="-lossaudio" oss_outdev_extralibs="-lossaudio" ;; - freebsd|dragonfly) + dragonfly) + enable malloc_aligned + disable symver + ;; + freebsd) enable malloc_aligned ;; bsd/os) From 5f3b8314a4a9120e0c6d6f153168c37eb849dbe8 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 23 Jan 2011 23:13:33 +0000 Subject: [PATCH 068/528] Add CFLAGS needed by PathScale compiler The PathScale compiler miscompiles wrapping arithmetic without these flags. Signed-off-by: Mans Rullgard --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 4c24152745..785465931d 100755 --- a/configure +++ b/configure @@ -2987,6 +2987,8 @@ elif enabled armcc; then add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat elif enabled tms470; then add_cflags -pds=824 -pds=837 +elif enabled pathscale; then + add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF fi enabled_any $THREADS_LIST && enable threads From 78f318be59a8e6174f21c2d7c3403ef325c73011 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 23 Jan 2011 20:41:59 +0000 Subject: [PATCH 069/528] ARM: NEON: fix overflow in h264 16x16 planar pred Signed-off-by: Mans Rullgard --- libavcodec/arm/h264pred_neon.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/arm/h264pred_neon.S b/libavcodec/arm/h264pred_neon.S index e2c69e1054..63c96ee725 100644 --- a/libavcodec/arm/h264pred_neon.S +++ b/libavcodec/arm/h264pred_neon.S @@ -131,8 +131,8 @@ function ff_pred16x16_plane_neon, export=1 vadd.i16 d5, d6, d7 vpadd.i16 d4, d4, d5 vpadd.i16 d4, d4, d4 - vshl.i16 d5, d4, #2 - vaddl.s16 q2, d4, d5 + vshll.s16 q3, d4, #2 + vaddw.s16 q2, q3, d4 vrshrn.s32 d4, q2, #6 mov r3, #0 vtrn.16 d4, d5 From 07b48f8c7adaaf4020514816ec9b8d14cc8c5fbd Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 23 Jan 2011 02:06:59 +0100 Subject: [PATCH 070/528] Do not set audio_resample to 0 if audio_sync_method is > 1. If audio_sync_method is >1 the resampler is used for audio drift compensation, and do_audio_out() was causing an assert failure because audio_resample was not set. Fix issue 2516, which was introduced by SVN r25939. Signed-off-by: Mans Rullgard --- ffmpeg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index 0b2bab2cec..56b2dbed5e 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -825,7 +825,9 @@ need_realloc: if (ost->resample) audio_resample_close(ost->resample); } - if (ost->resample_sample_fmt == enc->sample_fmt && + /* if audio_sync_method is >1 the resampler is needed for audio drift compensation */ + if (audio_sync_method <= 1 && + ost->resample_sample_fmt == enc->sample_fmt && ost->resample_channels == enc->channels && ost->resample_sample_rate == enc->sample_rate) { ost->resample = NULL; From 3bdc886c22710d3207b1bd75f8d2d65ec77cace5 Mon Sep 17 00:00:00 2001 From: Kostya Date: Sat, 22 Jan 2011 13:43:15 +0000 Subject: [PATCH 071/528] Extend WavPack demuxer and decoder to support >2 channel audio Signed-off-by: Janne Grunau --- libavcodec/wavpack.c | 266 +++++++++++++++++++++++++++++++++++-------- libavformat/wv.c | 124 +++++++++++++++++--- 2 files changed, 324 insertions(+), 66 deletions(-) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index f78492c924..866cc59879 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -1,6 +1,6 @@ /* * WavPack lossless audio decoder - * Copyright (c) 2006 Konstantin Shishkov + * Copyright (c) 2006,2011 Konstantin Shishkov * * This file is part of FFmpeg. * @@ -91,7 +91,7 @@ typedef struct WvChannel { int bitrate_acc, bitrate_delta; } WvChannel; -typedef struct WavpackContext { +typedef struct WavpackFrameContext { AVCodecContext *avctx; int frame_flags; int stereo, stereo_in; @@ -118,6 +118,22 @@ typedef struct WavpackContext { int max_samples; int pos; SavedContext sc, extra_sc; +} WavpackFrameContext; + +#define WV_MAX_FRAME_DECODERS 14 + +typedef struct WavpackContext { + AVCodecContext *avctx; + + WavpackFrameContext *fdec[WV_MAX_FRAME_DECODERS]; + int fdec_num; + + int multichannel; + int mkv_mode; + int block; + int samples; + int samples_left; + int ch_offset; } WavpackContext; // exponent table copied from WavPack source @@ -224,7 +240,7 @@ static av_always_inline int get_tail(GetBitContext *gb, int k) return res; } -static void update_error_limit(WavpackContext *ctx) +static void update_error_limit(WavpackFrameContext *ctx) { int i, br[2], sl[2]; @@ -258,7 +274,7 @@ static void update_error_limit(WavpackContext *ctx) } } -static int wv_get_value(WavpackContext *ctx, GetBitContext *gb, int channel, int *last) +static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel, int *last) { int t, t2; int sign, base, add, ret; @@ -361,7 +377,7 @@ static int wv_get_value(WavpackContext *ctx, GetBitContext *gb, int channel, int return sign ? ~ret : ret; } -static inline int wv_get_value_integer(WavpackContext *s, uint32_t *crc, int S) +static inline int wv_get_value_integer(WavpackFrameContext *s, uint32_t *crc, int S) { int bit; @@ -377,7 +393,7 @@ static inline int wv_get_value_integer(WavpackContext *s, uint32_t *crc, int S) return (((S + bit) << s->shift) - bit) << s->post_shift; } -static float wv_get_value_float(WavpackContext *s, uint32_t *crc, int S) +static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S) { union { float f; @@ -450,13 +466,13 @@ static float wv_get_value_float(WavpackContext *s, uint32_t *crc, int S) return value.f; } -static void wv_reset_saved_context(WavpackContext *s) +static void wv_reset_saved_context(WavpackFrameContext *s) { s->pos = 0; s->sc.crc = s->extra_sc.crc = 0xFFFFFFFF; } -static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *dst, const int type) +static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, void *dst, const int type) { int i, j, count = 0; int last, t; @@ -467,6 +483,7 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d int16_t *dst16 = dst; int32_t *dst32 = dst; float *dstfl = dst; + const int channel_pad = s->avctx->channels - 2; if(s->samples_left == s->samples) s->one = s->zero = s->zeroes = 0; @@ -549,12 +566,15 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d if(type == AV_SAMPLE_FMT_FLT){ *dstfl++ = wv_get_value_float(s, &crc_extra_bits, L); *dstfl++ = wv_get_value_float(s, &crc_extra_bits, R); + dstfl += channel_pad; } else if(type == AV_SAMPLE_FMT_S32){ *dst32++ = wv_get_value_integer(s, &crc_extra_bits, L); *dst32++ = wv_get_value_integer(s, &crc_extra_bits, R); + dst32 += channel_pad; } else { *dst16++ = wv_get_value_integer(s, &crc_extra_bits, L); *dst16++ = wv_get_value_integer(s, &crc_extra_bits, R); + dst16 += channel_pad; } count++; }while(!last && count < s->max_samples); @@ -582,7 +602,7 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d return count * 2; } -static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst, const int type) +static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, void *dst, const int type) { int i, j, count = 0; int last, t; @@ -593,6 +613,7 @@ static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst int16_t *dst16 = dst; int32_t *dst32 = dst; float *dstfl = dst; + const int channel_stride = s->avctx->channels; if(s->samples_left == s->samples) s->one = s->zero = s->zeroes = 0; @@ -623,12 +644,16 @@ static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst pos = (pos + 1) & 7; crc = crc * 3 + S; - if(type == AV_SAMPLE_FMT_FLT) - *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S); - else if(type == AV_SAMPLE_FMT_S32) - *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S); - else - *dst16++ = wv_get_value_integer(s, &crc_extra_bits, S); + if(type == AV_SAMPLE_FMT_FLT){ + *dstfl = wv_get_value_float(s, &crc_extra_bits, S); + dstfl += channel_stride; + }else if(type == AV_SAMPLE_FMT_S32){ + *dst32 = wv_get_value_integer(s, &crc_extra_bits, S); + dst32 += channel_stride; + }else{ + *dst16 = wv_get_value_integer(s, &crc_extra_bits, S); + dst16 += channel_stride; + } count++; }while(!last && count < s->max_samples); @@ -655,47 +680,92 @@ static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst return count; } +static av_cold int wv_alloc_frame_context(WavpackContext *c) +{ + + if(c->fdec_num == WV_MAX_FRAME_DECODERS) + return -1; + + c->fdec[c->fdec_num] = av_mallocz(sizeof(**c->fdec)); + if(!c->fdec[c->fdec_num]) + return -1; + c->fdec_num++; + c->fdec[c->fdec_num - 1]->avctx = c->avctx; + wv_reset_saved_context(c->fdec[c->fdec_num - 1]); + + return 0; +} + static av_cold int wavpack_decode_init(AVCodecContext *avctx) { WavpackContext *s = avctx->priv_data; s->avctx = avctx; - if (avctx->channels > 2) { - av_log(avctx, AV_LOG_ERROR, "Multichannel WavPack is not supported yet.\n"); - return -1; - } - s->stereo = (avctx->channels == 2); if(avctx->bits_per_coded_sample <= 16) avctx->sample_fmt = AV_SAMPLE_FMT_S16; else avctx->sample_fmt = AV_SAMPLE_FMT_S32; + if(avctx->channels <= 2 && !avctx->channel_layout) avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; - wv_reset_saved_context(s); + s->multichannel = avctx->channels > 2; + /* lavf demuxer does not provide extradata, Matroska stores 0x403 + there, use this to detect decoding mode for multichannel */ + s->mkv_mode = 0; + if(s->multichannel && avctx->extradata && avctx->extradata_size == 2){ + int ver = AV_RL16(avctx->extradata); + if(ver >= 0x402 && ver <= 0x410) + s->mkv_mode = 1; + } + + s->fdec_num = 0; return 0; } -static int wavpack_decode_frame(AVCodecContext *avctx, - void *data, int *data_size, - AVPacket *avpkt) +static av_cold int wavpack_decode_end(AVCodecContext *avctx) { - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; WavpackContext *s = avctx->priv_data; + int i; + + for(i = 0; i < s->fdec_num; i++) + av_freep(&s->fdec[i]); + s->fdec_num = 0; + + return 0; +} + +static int wavpack_decode_block(AVCodecContext *avctx, int block_no, + void *data, int *data_size, + const uint8_t *buf, int buf_size) +{ + WavpackContext *wc = avctx->priv_data; + WavpackFrameContext *s; void *samples = data; int samplecount; int got_terms = 0, got_weights = 0, got_samples = 0, got_entropy = 0, got_bs = 0, got_float = 0; int got_hybrid = 0; + const uint8_t* orig_buf = buf; const uint8_t* buf_end = buf + buf_size; int i, j, id, size, ssize, weights, t; - int bpp; + int bpp, chan, chmask; if (buf_size == 0){ *data_size = 0; return 0; } + if(block_no >= wc->fdec_num && wv_alloc_frame_context(wc) < 0){ + av_log(avctx, AV_LOG_ERROR, "Error creating frame decode context\n"); + return -1; + } + + s = wc->fdec[block_no]; + if(!s){ + av_log(avctx, AV_LOG_ERROR, "Context for block %d is not present\n", block_no); + return -1; + } + if(!s->samples_left){ memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr)); memset(s->ch, 0, sizeof(s->ch)); @@ -704,11 +774,15 @@ static int wavpack_decode_frame(AVCodecContext *avctx, s->got_extra_bits = 0; } + if(!wc->mkv_mode){ s->samples = AV_RL32(buf); buf += 4; if(!s->samples){ *data_size = 0; return buf_size; } + }else{ + s->samples = wc->samples; + } s->frame_flags = AV_RL32(buf); buf += 4; if(s->frame_flags&0x80){ bpp = sizeof(float); @@ -720,12 +794,19 @@ static int wavpack_decode_frame(AVCodecContext *avctx, bpp = 4; avctx->sample_fmt = AV_SAMPLE_FMT_S32; } + samples = (uint8_t*)samples + bpp * wc->ch_offset; + + s->stereo = !(s->frame_flags & WV_MONO); s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo; s->joint = s->frame_flags & WV_JOINT_STEREO; s->hybrid = s->frame_flags & WV_HYBRID_MODE; s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE; s->post_shift = 8 * (bpp-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f); s->CRC = AV_RL32(buf); buf += 4; + if(wc->mkv_mode) + buf += 4; //skip block size; + + wc->ch_offset += 1 + s->stereo; s->max_samples = *data_size / (bpp * avctx->channels); s->max_samples = FFMIN(s->max_samples, s->samples); @@ -899,7 +980,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, got_float = 1; break; case WP_ID_DATA: - s->sc.offset = buf - avpkt->data; + s->sc.offset = buf - orig_buf; s->sc.size = size * 8; init_get_bits(&s->gb, buf, size * 8); s->data_size = size * 8; @@ -912,13 +993,50 @@ static int wavpack_decode_frame(AVCodecContext *avctx, buf += size; continue; } - s->extra_sc.offset = buf - avpkt->data; + s->extra_sc.offset = buf - orig_buf; s->extra_sc.size = size * 8; init_get_bits(&s->gb_extra_bits, buf, size * 8); s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32); buf += size; s->got_extra_bits = 1; break; + case WP_ID_CHANINFO: + if(size <= 1){ + av_log(avctx, AV_LOG_ERROR, "Insufficient channel information\n"); + return -1; + } + chan = *buf++; + switch(size - 2){ + case 0: + chmask = *buf; + break; + case 1: + chmask = AV_RL16(buf); + break; + case 2: + chmask = AV_RL24(buf); + break; + case 3: + chmask = AV_RL32(buf); + break; + case 5: + chan |= (buf[1] & 0xF) << 8; + chmask = AV_RL24(buf + 2); + break; + default: + av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size); + chan = avctx->channels; + chmask = avctx->channel_layout; + } + if(chan != avctx->channels){ + av_log(avctx, AV_LOG_ERROR, "Block reports total %d channels, decoder believes it's %d channels\n", + chan, avctx->channels); + return -1; + } + if(!avctx->channel_layout) + avctx->channel_layout = chmask; + buf += size - 1; + break; default: buf += size; } @@ -963,10 +1081,10 @@ static int wavpack_decode_frame(AVCodecContext *avctx, } s->samples_left = s->samples; }else{ - init_get_bits(&s->gb, avpkt->data + s->sc.offset, s->sc.size); + init_get_bits(&s->gb, orig_buf + s->sc.offset, s->sc.size); skip_bits_long(&s->gb, s->sc.bits_used); if(s->got_extra_bits){ - init_get_bits(&s->gb_extra_bits, avpkt->data + s->extra_sc.offset, + init_get_bits(&s->gb_extra_bits, orig_buf + s->extra_sc.offset, s->extra_sc.size); skip_bits_long(&s->gb_extra_bits, s->extra_sc.bits_used); } @@ -979,8 +1097,10 @@ static int wavpack_decode_frame(AVCodecContext *avctx, samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_S32); else samplecount = wv_unpack_stereo(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); - + samplecount >>= 1; }else{ + const int channel_stride = avctx->channels; + if(avctx->sample_fmt == AV_SAMPLE_FMT_S16) samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_S16); else if(avctx->sample_fmt == AV_SAMPLE_FMT_S32) @@ -989,37 +1109,83 @@ static int wavpack_decode_frame(AVCodecContext *avctx, samplecount = wv_unpack_mono(s, &s->gb, samples, AV_SAMPLE_FMT_FLT); if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S16){ - int16_t *dst = (int16_t*)samples + samplecount * 2; - int16_t *src = (int16_t*)samples + samplecount; + int16_t *dst = (int16_t*)samples + 1; + int16_t *src = (int16_t*)samples; int cnt = samplecount; while(cnt--){ - *--dst = *--src; - *--dst = *src; + *dst = *src; + src += channel_stride; + dst += channel_stride; } - samplecount *= 2; }else if(s->stereo && avctx->sample_fmt == AV_SAMPLE_FMT_S32){ - int32_t *dst = (int32_t*)samples + samplecount * 2; - int32_t *src = (int32_t*)samples + samplecount; + int32_t *dst = (int32_t*)samples + 1; + int32_t *src = (int32_t*)samples; int cnt = samplecount; while(cnt--){ - *--dst = *--src; - *--dst = *src; + *dst = *src; + src += channel_stride; + dst += channel_stride; } - samplecount *= 2; }else if(s->stereo){ - float *dst = (float*)samples + samplecount * 2; - float *src = (float*)samples + samplecount; + float *dst = (float*)samples + 1; + float *src = (float*)samples; int cnt = samplecount; while(cnt--){ - *--dst = *--src; - *--dst = *src; + *dst = *src; + src += channel_stride; + dst += channel_stride; } - samplecount *= 2; } } - *data_size = samplecount * bpp; - return s->samples_left > 0 ? 0 : buf_size; + wc->samples_left = s->samples_left; + + return samplecount * bpp; +} + +static int wavpack_decode_frame(AVCodecContext *avctx, + void *data, int *data_size, + AVPacket *avpkt) +{ + WavpackContext *s = avctx->priv_data; + const uint8_t *buf = avpkt->data; + int buf_size = avpkt->size; + int frame_size; + int samplecount = 0; + + s->block = 0; + s->samples_left = 0; + s->ch_offset = 0; + + if(s->mkv_mode){ + s->samples = AV_RL32(buf); buf += 4; + } + while(buf_size > 0){ + if(!s->multichannel){ + frame_size = buf_size; + }else{ + if(!s->mkv_mode){ + frame_size = AV_RL32(buf) - 12; buf += 4; buf_size -= 4; + }else{ + if(buf_size < 12) //MKV files can have zero flags after last block + break; + frame_size = AV_RL32(buf + 8) + 12; + } + } + if(frame_size < 0 || frame_size > buf_size){ + av_log(avctx, AV_LOG_ERROR, "Block %d has invalid size (size %d vs. %d bytes left)\n", + s->block, frame_size, buf_size); + return -1; + } + if((samplecount = wavpack_decode_block(avctx, s->block, data, + data_size, buf, frame_size)) < 0) + return -1; + s->block++; + buf += frame_size; buf_size -= frame_size; + } + *data_size = samplecount * avctx->channels; + + return s->samples_left > 0 ? 0 : avpkt->size; } AVCodec wavpack_decoder = { @@ -1029,7 +1195,7 @@ AVCodec wavpack_decoder = { sizeof(WavpackContext), wavpack_decode_init, NULL, - NULL, + wavpack_decode_end, wavpack_decode_frame, .capabilities = CODEC_CAP_SUBFRAMES, .long_name = NULL_IF_CONFIG_SMALL("WavPack"), diff --git a/libavformat/wv.c b/libavformat/wv.c index 5692230e8a..d04e00a90a 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -1,6 +1,6 @@ /* * WavPack demuxer - * Copyright (c) 2006 Konstantin Shishkov + * Copyright (c) 2006,2011 Konstantin Shishkov * * This file is part of FFmpeg. * @@ -29,6 +29,10 @@ #define WV_EXTRA_SIZE 12 +#define WV_START_BLOCK 0x0800 +#define WV_END_BLOCK 0x1000 +#define WV_SINGLE_BLOCK (WV_START_BLOCK | WV_END_BLOCK) + enum WV_FLAGS{ WV_MONO = 0x0004, WV_HYBRID = 0x0008, @@ -51,7 +55,9 @@ static const int wv_rates[16] = { typedef struct{ uint32_t blksize, flags; int rate, chan, bpp; + uint32_t chmask; uint32_t samples, soff; + int multichannel; int block_parsed; uint8_t extra[WV_EXTRA_SIZE]; int64_t pos; @@ -69,14 +75,16 @@ static int wv_probe(AVProbeData *p) return 0; } -static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb) +static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int append) { WVContext *wc = ctx->priv_data; uint32_t tag, ver; int size; int rate, bpp, chan; + uint32_t chmask; wc->pos = url_ftell(pb); + if(!append){ tag = get_le32(pb); if (tag != MKTAG('w', 'v', 'p', 'k')) return -1; @@ -96,19 +104,24 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb) wc->samples = get_le32(pb); // total samples in file wc->soff = get_le32(pb); // offset in samples of current block get_buffer(pb, wc->extra, WV_EXTRA_SIZE); + }else{ + size = wc->blksize; + } wc->flags = AV_RL32(wc->extra + 4); //parse flags bpp = ((wc->flags & 3) + 1) << 3; chan = 1 + !(wc->flags & WV_MONO); + chmask = wc->flags & WV_MONO ? CH_LAYOUT_MONO : CH_LAYOUT_STEREO; rate = wv_rates[(wc->flags >> 23) & 0xF]; - if((wc->flags & 0x1800) != 0x1800){ - av_log(ctx, AV_LOG_ERROR, "Multichannel WavPack is not supported yet.\n"); - return -1; + wc->multichannel = !!((wc->flags & WV_SINGLE_BLOCK) != WV_SINGLE_BLOCK); + if(wc->multichannel){ + chan = wc->chan; + chmask = wc->chmask; } - if(rate == -1 && !wc->block_parsed){ + if((rate == -1 || !chan) && !wc->block_parsed){ int64_t block_end = url_ftell(pb) + wc->blksize - 24; if(url_is_streamed(pb)){ - av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); + av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n"); return -1; } while(url_ftell(pb) < block_end){ @@ -118,12 +131,44 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb) size <<= 1; if(id&0x40) size--; - if((id&0x3F) == 0x27){ + switch(id&0x3F){ + case 0xD: + if(size <= 1){ + av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n"); + return -1; + } + chan = get_byte(pb); + switch(size - 2){ + case 0: + chmask = get_byte(pb); + break; + case 1: + chmask = get_le16(pb); + break; + case 2: + chmask = get_le24(pb); + break; + case 3: + chmask = get_le32(pb); + break; + case 5: + url_fskip(pb, 1); + chan |= (get_byte(pb) & 0xF) << 8; + chmask = get_le24(pb); + break; + default: + av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size); + return -1; + } + break; + case 0x27: rate = get_le24(pb); break; - }else{ + default: url_fskip(pb, size); } + if(id&0x40) + url_fskip(pb, 1); } if(rate == -1){ av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); @@ -133,13 +178,14 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb) } if(!wc->bpp) wc->bpp = bpp; if(!wc->chan) wc->chan = chan; + if(!wc->chmask) wc->chmask = chmask; if(!wc->rate) wc->rate = rate; if(wc->flags && bpp != wc->bpp){ av_log(ctx, AV_LOG_ERROR, "Bits per sample differ, this block: %i, header block: %i\n", bpp, wc->bpp); return -1; } - if(wc->flags && chan != wc->chan){ + if(wc->flags && !wc->multichannel && chan != wc->chan){ av_log(ctx, AV_LOG_ERROR, "Channels differ, this block: %i, header block: %i\n", chan, wc->chan); return -1; } @@ -159,7 +205,7 @@ static int wv_read_header(AVFormatContext *s, AVStream *st; wc->block_parsed = 0; - if(wv_read_block_header(s, pb) < 0) + if(wv_read_block_header(s, pb, 0) < 0) return -1; /* now we are ready: build format streams */ @@ -169,6 +215,7 @@ static int wv_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_WAVPACK; st->codec->channels = wc->chan; + st->codec->channel_layout = wc->chmask; st->codec->sample_rate = wc->rate; st->codec->bits_per_coded_sample = wc->bpp; av_set_pts_info(st, 64, 1, wc->rate); @@ -191,25 +238,70 @@ static int wv_read_packet(AVFormatContext *s, { WVContext *wc = s->priv_data; int ret; + int size, ver, off; if (url_feof(s->pb)) return AVERROR(EIO); if(wc->block_parsed){ - if(wv_read_block_header(s, s->pb) < 0) + if(wv_read_block_header(s, s->pb, 0) < 0) return -1; } - if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0) + off = wc->multichannel ? 4 : 0; + if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE + off) < 0) return AVERROR(ENOMEM); - memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE); - ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize); + if(wc->multichannel) + AV_WL32(pkt->data, wc->blksize + WV_EXTRA_SIZE + 12); + memcpy(pkt->data + off, wc->extra, WV_EXTRA_SIZE); + ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize); if(ret != wc->blksize){ av_free_packet(pkt); return AVERROR(EIO); } + while(!(wc->flags & WV_END_BLOCK)){ + if(get_le32(s->pb) != MKTAG('w', 'v', 'p', 'k')){ + av_free_packet(pkt); + return -1; + } + if((ret = av_append_packet(s->pb, pkt, 4)) < 0){ + av_free_packet(pkt); + return ret; + } + size = AV_RL32(pkt->data + pkt->size - 4); + if(size < 24 || size > WV_BLOCK_LIMIT){ + av_free_packet(pkt); + av_log(s, AV_LOG_ERROR, "Incorrect block size %d\n", size); + return -1; + } + wc->blksize = size; + ver = get_le16(s->pb); + if(ver < 0x402 || ver > 0x410){ + av_free_packet(pkt); + av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver); + return -1; + } + get_byte(s->pb); // track no + get_byte(s->pb); // track sub index + wc->samples = get_le32(s->pb); // total samples in file + wc->soff = get_le32(s->pb); // offset in samples of current block + if((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0){ + av_free_packet(pkt); + return ret; + } + memcpy(wc->extra, pkt->data + pkt->size - WV_EXTRA_SIZE, WV_EXTRA_SIZE); + + if(wv_read_block_header(s, s->pb, 1) < 0){ + av_free_packet(pkt); + return -1; + } + ret = av_append_packet(s->pb, pkt, wc->blksize); + if(ret < 0){ + av_free_packet(pkt); + return ret; + } + } pkt->stream_index = 0; wc->block_parsed = 1; - pkt->size = ret + WV_EXTRA_SIZE; pkt->pts = wc->soff; av_add_index_entry(s->streams[0], wc->pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME); return 0; From dacbcd170a329dda2014159ca9fc9d11d887625c Mon Sep 17 00:00:00 2001 From: Kostya Date: Sat, 22 Jan 2011 13:44:10 +0000 Subject: [PATCH 072/528] reindent after last commit Signed-off-by: Janne Grunau --- libavcodec/wavpack.c | 12 ++++++------ libavformat/wv.c | 38 +++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 866cc59879..d7bd265de0 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -706,7 +706,7 @@ static av_cold int wavpack_decode_init(AVCodecContext *avctx) else avctx->sample_fmt = AV_SAMPLE_FMT_S32; if(avctx->channels <= 2 && !avctx->channel_layout) - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; s->multichannel = avctx->channels > 2; /* lavf demuxer does not provide extradata, Matroska stores 0x403 @@ -775,11 +775,11 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no, } if(!wc->mkv_mode){ - s->samples = AV_RL32(buf); buf += 4; - if(!s->samples){ - *data_size = 0; - return buf_size; - } + s->samples = AV_RL32(buf); buf += 4; + if(!s->samples){ + *data_size = 0; + return buf_size; + } }else{ s->samples = wc->samples; } diff --git a/libavformat/wv.c b/libavformat/wv.c index d04e00a90a..367ce45423 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -85,25 +85,25 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app wc->pos = url_ftell(pb); if(!append){ - tag = get_le32(pb); - if (tag != MKTAG('w', 'v', 'p', 'k')) - return -1; - size = get_le32(pb); - if(size < 24 || size > WV_BLOCK_LIMIT){ - av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size); - return -1; - } - wc->blksize = size; - ver = get_le16(pb); - if(ver < 0x402 || ver > 0x410){ - av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver); - return -1; - } - get_byte(pb); // track no - get_byte(pb); // track sub index - wc->samples = get_le32(pb); // total samples in file - wc->soff = get_le32(pb); // offset in samples of current block - get_buffer(pb, wc->extra, WV_EXTRA_SIZE); + tag = get_le32(pb); + if (tag != MKTAG('w', 'v', 'p', 'k')) + return -1; + size = get_le32(pb); + if(size < 24 || size > WV_BLOCK_LIMIT){ + av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size); + return -1; + } + wc->blksize = size; + ver = get_le16(pb); + if(ver < 0x402 || ver > 0x410){ + av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver); + return -1; + } + get_byte(pb); // track no + get_byte(pb); // track sub index + wc->samples = get_le32(pb); // total samples in file + wc->soff = get_le32(pb); // offset in samples of current block + get_buffer(pb, wc->extra, WV_EXTRA_SIZE); }else{ size = wc->blksize; } From 2b0decf60ba6dd5eec16e88d4b816e56108a2935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sun, 23 Jan 2011 23:39:02 +0200 Subject: [PATCH 073/528] applehttp: Fix the key check in handle_variant_args The key string is supposed to contain the equals character, too. Since the checked string was wrong, and the return value check was wrong too, it incorrectly seemed to work right before. Signed-off-by: Mans Rullgard --- libavformat/applehttp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index b73adcc841..6f03548566 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -181,7 +181,7 @@ struct variant_info { 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)) { + if (!strncmp(key, "BANDWIDTH=", key_len)) { *dest = info->bandwidth; *dest_len = sizeof(info->bandwidth); } From 032f4068646d6d29f4657eeb69425ec349dcaa7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Mon, 24 Jan 2011 18:51:00 +0100 Subject: [PATCH 074/528] Handle input or output len of 0 properly in lzo decoder. (cherry picked from commit 7d5082600ee63d879c2a325974ea09c8ace05019) --- libavutil/lzo.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavutil/lzo.c b/libavutil/lzo.c index a876fc7776..40a41a424d 100644 --- a/libavutil/lzo.c +++ b/libavutil/lzo.c @@ -175,6 +175,14 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) { int state= 0; int x; LZOContext c; + if (!*outlen || !*inlen) { + int res = 0; + if (!*outlen) + res |= AV_LZO_OUTPUT_FULL; + if (!*inlen) + res |= AV_LZO_INPUT_DEPLETED; + return res; + } c.in = in; c.in_end = (const uint8_t *)in + *inlen; c.out = c.out_start = out; From 4be170c9371dfd3ae07a348b449002fc1d2b70e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Mon, 24 Jan 2011 19:35:20 +0100 Subject: [PATCH 075/528] Use av_fast_malloc instead of av_realloc. This should be faster, is less code and fixes issue 2524 (allocation error would lead to crash). (cherry picked from commit e7b95918fca1c3d057d35f77ba58ee2d00d03151) --- libavcodec/nuv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c index 26dcfd0d22..d65799ee1e 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -116,8 +116,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit return 0; avctx->width = c->width = width; avctx->height = c->height = height; - c->decomp_size = c->height * c->width * 3 / 2; - c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING); + av_fast_malloc(&c->decomp_buf, &c->decomp_size, c->height * c->width * 3 / 2); if (!c->decomp_buf) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return 0; From fef5649a820b30432578e1440776e7a71bd523cc Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 24 Jan 2011 09:49:01 +0000 Subject: [PATCH 076/528] rtsp: Make make_setup_request a nonstatic function Signed-off-by: Janne Grunau --- libavformat/rtsp.c | 4 ++-- libavformat/rtsp.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 2b61b89972..feb61937fb 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1017,7 +1017,7 @@ retry: /** * @return 0 on success, <0 on error, 1 if protocol is unavailable. */ -static int make_setup_request(AVFormatContext *s, const char *host, int port, +int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) { RTSPState *rt = s->priv_data; @@ -1493,7 +1493,7 @@ redirect: int lower_transport = ff_log2_tab[lower_transport_mask & ~(lower_transport_mask - 1)]; - err = make_setup_request(s, host, port, lower_transport, + err = ff_rtsp_make_setup_request(s, host, port, lower_transport, rt->server_type == RTSP_SERVER_REAL ? real_challenge : NULL); if (err < 0) diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index eee07ac0e7..2ef68db18b 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -504,4 +504,11 @@ int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, */ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt); +/** + * Do the SETUP requests for each stream for the chosen + * lower transport mode. + */ +int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, + int lower_transport, const char *real_challenge); + #endif /* AVFORMAT_RTSP_H */ From 93e7490ee0c456d7e0fa43e3bf2cb4a8eed19194 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 24 Jan 2011 09:49:02 +0000 Subject: [PATCH 077/528] rtsp: Split out a function undoing the setup made by ff_rtsp_make_setup_request Signed-off-by: Janne Grunau --- libavformat/rtsp.c | 59 +++++++++++++++++++++++++++++----------------- libavformat/rtsp.h | 6 +++++ 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index feb61937fb..dcceb68a25 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -474,6 +474,42 @@ int ff_sdp_parse(AVFormatContext *s, const char *content) } #endif /* CONFIG_RTPDEC */ +void ff_rtsp_undo_setup(AVFormatContext *s) +{ + RTSPState *rt = s->priv_data; + int i; + + for (i = 0; i < rt->nb_rtsp_streams; i++) { + RTSPStream *rtsp_st = rt->rtsp_streams[i]; + if (!rtsp_st) + continue; + if (rtsp_st->transport_priv) { + if (s->oformat) { + AVFormatContext *rtpctx = rtsp_st->transport_priv; + av_write_trailer(rtpctx); + if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) { + uint8_t *ptr; + url_close_dyn_buf(rtpctx->pb, &ptr); + av_free(ptr); + } else { + url_fclose(rtpctx->pb); + } + av_metadata_free(&rtpctx->streams[0]->metadata); + av_metadata_free(&rtpctx->metadata); + av_free(rtpctx->streams[0]); + av_free(rtpctx); + } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) + ff_rdt_parse_close(rtsp_st->transport_priv); + else if (CONFIG_RTPDEC) + rtp_parse_close(rtsp_st->transport_priv); + } + rtsp_st->transport_priv = NULL; + if (rtsp_st->rtp_handle) + url_close(rtsp_st->rtp_handle); + rtsp_st->rtp_handle = NULL; + } +} + /* close and free RTSP streams */ void ff_rtsp_close_streams(AVFormatContext *s) { @@ -481,31 +517,10 @@ void ff_rtsp_close_streams(AVFormatContext *s) int i; RTSPStream *rtsp_st; + ff_rtsp_undo_setup(s); for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st) { - if (rtsp_st->transport_priv) { - if (s->oformat) { - AVFormatContext *rtpctx = rtsp_st->transport_priv; - av_write_trailer(rtpctx); - if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) { - uint8_t *ptr; - url_close_dyn_buf(rtpctx->pb, &ptr); - av_free(ptr); - } else { - url_fclose(rtpctx->pb); - } - av_metadata_free(&rtpctx->streams[0]->metadata); - av_metadata_free(&rtpctx->metadata); - av_free(rtpctx->streams[0]); - av_free(rtpctx); - } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) - ff_rdt_parse_close(rtsp_st->transport_priv); - else if (CONFIG_RTPDEC) - rtp_parse_close(rtsp_st->transport_priv); - } - if (rtsp_st->rtp_handle) - url_close(rtsp_st->rtp_handle); if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) rtsp_st->dynamic_handler->close( rtsp_st->dynamic_protocol_context); diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 2ef68db18b..6dc64b19ae 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -511,4 +511,10 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt); int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge); +/** + * Undo the effect of ff_rtsp_make_setup_request, close the + * transport_priv and rtp_handle fields. + */ +void ff_rtsp_undo_setup(AVFormatContext *s); + #endif /* AVFORMAT_RTSP_H */ From aeb2de1c82f95b74e184992a10523606f4b341fa Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 24 Jan 2011 09:49:03 +0000 Subject: [PATCH 078/528] rtsp: Use ff_rtsp_undo_setup in the cleanup code in ff_rtsp_make_request Signed-off-by: Janne Grunau --- libavformat/rtsp.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index dcceb68a25..dddaaf4237 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1271,12 +1271,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, return 0; fail: - for (i = 0; i < rt->nb_rtsp_streams; i++) { - if (rt->rtsp_streams[i]->rtp_handle) { - url_close(rt->rtsp_streams[i]->rtp_handle); - rt->rtsp_streams[i]->rtp_handle = NULL; - } - } + ff_rtsp_undo_setup(s); return err; } From e836b1b0859798488d8ba45a837dc27bac2ee99f Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 24 Jan 2011 09:49:04 +0000 Subject: [PATCH 079/528] rtspdec: Move rtsp_read_pause up, next to rtsp_read_play Signed-off-by: Janne Grunau --- libavformat/rtspdec.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index eb7de3b663..b910d4cdb9 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -86,6 +86,24 @@ static int rtsp_read_play(AVFormatContext *s) 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; +} + int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply) { RTSPState *rt = s->priv_data; @@ -292,24 +310,6 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt) 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) { From 2762a7a28b261a505a9002b92d4f7c04eeaacc1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 10 Jan 2011 12:45:24 +0200 Subject: [PATCH 080/528] rtspdec: Retry with TCP if UDP failed Signed-off-by: Janne Grunau --- libavformat/rtsp.c | 4 +++- libavformat/rtsp.h | 13 +++++++++++++ libavformat/rtspdec.c | 41 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index dddaaf4237..ca9ce7cf21 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1291,7 +1291,7 @@ int ff_rtsp_connect(AVFormatContext *s) int port, err, tcp_fd; RTSPMessageHeader reply1 = {0}, *reply = &reply1; int lower_transport_mask = 0; - char real_challenge[64]; + char real_challenge[64] = ""; struct sockaddr_storage peer; socklen_t peer_len = sizeof(peer); @@ -1515,6 +1515,8 @@ redirect: } } while (err); + rt->lower_transport_mask = lower_transport_mask; + av_strlcpy(rt->real_challenge, real_challenge, sizeof(rt->real_challenge)); rt->state = RTSP_STATE_IDLE; rt->seek_timestamp = 0; /* default is to start stream at position zero */ return 0; diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 6dc64b19ae..62bd3a2ecc 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -248,6 +248,9 @@ typedef struct RTSPState { * of RTSPMessageHeader->real_challenge */ enum RTSPServerType server_type; + /** the "RealChallenge1:" field from the server */ + char real_challenge[64]; + /** plaintext authorization line (username:password) */ char auth[128]; @@ -313,6 +316,16 @@ typedef struct RTSPState { /** Filter incoming UDP packets - receive packets only from the right * source address and port. */ int filter_source; + + /** + * A mask with all requested transport methods + */ + int lower_transport_mask; + + /** + * The number of returned packets + */ + uint64_t packets; } RTSPState; /** diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index b910d4cdb9..6a4b4af2b3 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -229,6 +229,20 @@ found: *prtsp_st = rtsp_st; return len; } + +static int resetup_tcp(AVFormatContext *s) +{ + RTSPState *rt = s->priv_data; + char host[1024]; + int port; + + av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, NULL, 0, + s->filename); + ff_rtsp_undo_setup(s); + return ff_rtsp_make_setup_request(s, host, port, RTSP_LOWER_TRANSPORT_TCP, + rt->real_challenge); +} + static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt) { RTSPState *rt = s->priv_data; @@ -236,6 +250,7 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt) RTSPMessageHeader reply1, *reply = &reply1; char cmd[1024]; +retry: if (rt->server_type == RTSP_SERVER_REAL) { int i; @@ -295,8 +310,32 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt) } ret = ff_rtsp_fetch_packet(s, pkt); - if (ret < 0) + if (ret < 0) { + if (ret == FF_NETERROR(ETIMEDOUT) && !rt->packets) { + if (rt->lower_transport == RTSP_LOWER_TRANSPORT_UDP && + rt->lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_TCP)) { + RTSPMessageHeader reply1, *reply = &reply1; + av_log(s, AV_LOG_WARNING, "UDP timeout, retrying with TCP\n"); + if (rtsp_read_pause(s) != 0) + return -1; + // TEARDOWN is required on Real-RTSP, but might make + // other servers close the connection. + if (rt->server_type == RTSP_SERVER_REAL) + ff_rtsp_send_cmd(s, "TEARDOWN", rt->control_uri, NULL, + reply, NULL); + rt->session_id[0] = '\0'; + if (resetup_tcp(s) == 0) { + rt->state = RTSP_STATE_IDLE; + rt->need_subscription = 1; + if (rtsp_read_play(s) != 0) + return -1; + goto retry; + } + } + } return ret; + } + rt->packets++; /* send dummy request to keep TCP connection alive */ if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) { From efa6ce9982ffde33b7303498ff28fcf39ff68b8d Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 16 Oct 2010 20:56:32 +0100 Subject: [PATCH 081/528] ffserver: put gcc attribute under proper ifdef --- ffserver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ffserver.c b/ffserver.c index 94a239ca5d..9a3240808b 100644 --- a/ffserver.c +++ b/ffserver.c @@ -384,7 +384,10 @@ static void http_vlog(const char *fmt, va_list vargs) } } -static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...) +#ifdef __GNUC__ +__attribute__ ((format (printf, 1, 2))) +#endif +static void http_log(const char *fmt, ...) { va_list vargs; va_start(vargs, fmt); From e63dd5fb04ab831ca8f17fa824cfd703e317c1a1 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 23 Jan 2011 20:33:18 +0000 Subject: [PATCH 082/528] fate: add h264 test for extreme cases in planar prediction Signed-off-by: Mans Rullgard --- tests/fate/h264.mak | 2 + tests/ref/fate/h264-extreme-plane-pred | 100 +++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 tests/ref/fate/h264-extreme-plane-pred diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak index 25517feee2..259e1e0ea0 100644 --- a/tests/fate/h264.mak +++ b/tests/fate/h264.mak @@ -167,6 +167,7 @@ FATE_H264 = aud_mw_e \ FATE_H264 := $(FATE_H264:%=fate-h264-conformance-%) \ fate-h264-interlace-crop \ fate-h264-lossless \ + fate-h264-extreme-plane-pred \ FATE_TESTS += $(FATE_H264) fate-h264: $(FATE_H264) @@ -339,3 +340,4 @@ fate-h264-conformance-sva_nl2_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/ fate-h264-interlace-crop: CMD = framecrc -vframes 3 -i $(SAMPLES)/h264/interlaced_crop.mp4 fate-h264-lossless: CMD = framecrc -i $(SAMPLES)/h264/lossless.h264 +fate-h264-extreme-plane-pred: CMD = framemd5 -strict 1 -vsync 0 -i $(SAMPLES)/h264/extreme-plane-pred.h264 diff --git a/tests/ref/fate/h264-extreme-plane-pred b/tests/ref/fate/h264-extreme-plane-pred new file mode 100644 index 0000000000..d8bee85b6b --- /dev/null +++ b/tests/ref/fate/h264-extreme-plane-pred @@ -0,0 +1,100 @@ +0, 0, 152064, 1e857d2dfeea75297e090ffe9e37a249 +0, 3600, 152064, 29d8336b4e9b77298025074dbad641d1 +0, 7200, 152064, 3f1a87d2088a7708f4ed06890c8cd018 +0, 10800, 152064, 56b8b8d9fefbd501c4f7918f21f9b015 +0, 14400, 152064, 597392c162ea79af1e5d3dd552ffeb47 +0, 18000, 152064, 064fdd170aa24463409b1cb0ddc7f5b6 +0, 21600, 152064, 9924da4026b10110fa644039e73f92c1 +0, 25200, 152064, afdb77f4a4c87faaf35988bf2d1d7c18 +0, 28800, 152064, 80714dc3bf376f38c00f8c67fc534fae +0, 32400, 152064, fb0ab4028e1e9879b0bf0e414c0ccb33 +0, 36000, 152064, 03c694f4b9e6116214078131f3edff91 +0, 39600, 152064, 22d2de0d8f9e5477230b50c50ec46269 +0, 43200, 152064, 470e9a6c5bbb15e151afbfd6b2f254a3 +0, 46800, 152064, b585555552169640b1a896094335b624 +0, 50400, 152064, e261e0f650e6d649a35773520e7f5bff +0, 54000, 152064, 2d1bf889eef057016e473a041fbceac0 +0, 57600, 152064, b1a3f8ebf1de26bc8c32d47a4a53c862 +0, 61200, 152064, d5cdb80386dbb996ca007a0e210a9905 +0, 64800, 152064, 05a200df7b8baa19d2a0309476727dd7 +0, 68400, 152064, 890d62163f4aa70a2055d50de0395a35 +0, 72000, 152064, c00bdd1c5f0d69bae66ba46a897ad0ad +0, 75600, 152064, 65f76c6d453822eb48b180ac630cbdce +0, 79200, 152064, d6b85fc02c6d8efa53a9f0f148a0520e +0, 82800, 152064, adcb1621c5100b8e201592328bcd11be +0, 86400, 152064, bad7da936734cf4304c1564d6d3e74b9 +0, 90000, 152064, a98d1232d0c22e6967415700d980c67f +0, 93600, 152064, 3fa1110c3ada7d37f0495a26774a58fb +0, 97200, 152064, 37613c65cfd3d77e8dda3b5b913e467f +0, 100800, 152064, 42a5cf583a82e722e04c04b10fd36542 +0, 104400, 152064, 41c2870e102e3584780cd0243baa1900 +0, 108000, 152064, da389397c874f5fd974c57278bd1e327 +0, 111600, 152064, 238c265971ef9144d3fe6bc95a2ea060 +0, 115200, 152064, 085c83a54aa9327e1e3ee76ffa337538 +0, 118800, 152064, f462966f59018b39c10f9a65a80a41f8 +0, 122400, 152064, 6e9697b7c8193b38551af4ef56861b7a +0, 126000, 152064, e68113abf3e81a28cafd95d91871886e +0, 129600, 152064, 35a78df5ac1ff6ee469626b750241c9b +0, 133200, 152064, b3302a87e334634a9f92ce51acf96ab3 +0, 136800, 152064, 52198528552cefe90004a2b045b33e8f +0, 140400, 152064, 12d9ad991d4bb7935342c8b6474d1726 +0, 144000, 152064, 2e6a508aba965f292c7b2e82bd0debbe +0, 147600, 152064, 8daff69112bb5fbc0158cbbf7fbe057e +0, 151200, 152064, 5495a0bb6c88a115957d98b272b0d643 +0, 154800, 152064, 955db92ab0c482381200247a207e12bc +0, 158400, 152064, c0f81c5f95fd658c153798a514fedd22 +0, 162000, 152064, 3cfc7b9c2d73621cdb04d7e7e8bc2b3b +0, 165600, 152064, e8b6d1d526d6443cba2e64ccd5393a4f +0, 169200, 152064, 7722e2420db0279c9eb7c6f7dfa89c07 +0, 172800, 152064, 41b908a50b97a2e927f2e6e285e27592 +0, 176400, 152064, e05f0ddd08debc2a0578893662c33ce0 +0, 180000, 152064, 1edcedca921dbb68c0ce53371abddd8f +0, 183600, 152064, cdbf0c89feb336e58472f0163e43b02b +0, 187200, 152064, 39c4d20ecfeee09800feae5ad783e0bd +0, 190800, 152064, f60d05d20b3f338aa5917490d2b58f77 +0, 194400, 152064, 76e5eae7a5205f6f6aaf8099197dbb1f +0, 198000, 152064, f7c4c80e79b691826915b7810ab7c2a6 +0, 201600, 152064, afbc098dcaa8c2a3f41dfc3e846e8e7b +0, 205200, 152064, 6582805bbe4ab9a9138a23deb2ca45a8 +0, 208800, 152064, 54444ce52dd1ce7bc24e9cbaba89dc59 +0, 212400, 152064, c81193469c0cd5a50c451d869e07a786 +0, 216000, 152064, 89f2295b63db3adce2961630569749a5 +0, 219600, 152064, 3f4d6dd4dd819168a358384d6b134d00 +0, 223200, 152064, 45d3b5c72609a15c1be5a45f790a24c4 +0, 226800, 152064, f2283a8bf9599754d2e251c5f0861199 +0, 230400, 152064, 06a9ccf8132c494884954bb4cc148c11 +0, 234000, 152064, e20e0143fc840db46a88a8556d887ea2 +0, 237600, 152064, bcb1ca471f70109293a15b7e1b0f3a7f +0, 241200, 152064, 0c5f59f091b3fd5ced9bb626e5b66ec8 +0, 244800, 152064, 4dd6cf80daf74390afe0423f726c2fb6 +0, 248400, 152064, fd52e6d570960cf100ac7c973dbd222e +0, 252000, 152064, 684758faa9b5517b2e5dbbabccc6125b +0, 255600, 152064, e538a3bcb2125c8ac324a5be49470960 +0, 259200, 152064, 0c91795b7f52e942a1c28b4c6510c6fa +0, 262800, 152064, b33315c61d714bd70d2adce3309633fe +0, 266400, 152064, af2554b6b1d3f215641f85494a78ad3d +0, 270000, 152064, e59b20b3b2c5ec215ea34ab4850f940e +0, 273600, 152064, fb543e874bdd9749aaa710d1551e0ebd +0, 277200, 152064, 4383abaf938da0282fecabed153bca0e +0, 280800, 152064, 4ce40ffa75b42320593e40596c34862a +0, 284400, 152064, f337d0cc81b5c1b1b92c3f367ed5f9cd +0, 288000, 152064, 0f5a8c41fb7334811a485239d9126808 +0, 291600, 152064, 0daf3d981474940bdf10a93148d69353 +0, 295200, 152064, 21a51f1686071a6af7973df92361964b +0, 298800, 152064, 1f0d471c7b1fa86f236c2dee32822464 +0, 302400, 152064, cedc6fd29d67976f899a6a8afba6b38d +0, 306000, 152064, 4af936d3d3b456953c7beb551476824a +0, 309600, 152064, bcaf539953adb1952fefc2cdec6c2f60 +0, 313200, 152064, d1dfeafa0939fddc256986c2b00f73c7 +0, 316800, 152064, 99c9a2c7b198e2c8cfe007ff4330f036 +0, 320400, 152064, 4db6a7edfc44389536983aeeb15edb66 +0, 324000, 152064, 8d840674b90e3b488a34e04645430ee7 +0, 327600, 152064, ad7b3e55a2eb62fc5102cc5af49301aa +0, 331200, 152064, f24484a975ec64acb50df3e9f9e8eddd +0, 334800, 152064, 5794617c7e40bfcb7f024bda2f2a991d +0, 338400, 152064, ae1c22fcfa7f3b3b62dd2ace4e4b4dc7 +0, 342000, 152064, ad9d13345ae5322a578e43653e9a9c16 +0, 345600, 152064, be1b86ee130ea9255d9640117559818d +0, 349200, 152064, 81ed195d2831e62fc2cd4fa886de8e20 +0, 352800, 152064, 8dde0af730b03ea8b3acd14d42daba04 +0, 356400, 152064, c8ffbd5ba1af8b881daf511e4d8c26f3 From 80944df720da98d6e5ee0e355db5814735914ec9 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 24 Jan 2011 23:24:28 +0000 Subject: [PATCH 083/528] x86: fix overflow in h264 8x8 planar prediction Signed-off-by: Mans Rullgard --- libavcodec/x86/h264_intrapred.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm index dbe6b8ad61..28c2f399c3 100644 --- a/libavcodec/x86/h264_intrapred.asm +++ b/libavcodec/x86/h264_intrapred.asm @@ -637,10 +637,6 @@ cglobal pred8x8_plane_%1, 2, 7, %2 %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 @@ -694,6 +690,10 @@ cglobal pred8x8_plane_%1, 2, 7, %2 shl r3, 4 movd r1d, m0 movsx r1d, r1w + imul r1d, 17 + add r1d, 16 + sar r1d, 5 + movd m0, r1d add r1d, r5d sub r3d, r1d add r1d, r1d From 53493f9a8176009fc514c386ee31cafcafc8539a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 00:36:09 +0100 Subject: [PATCH 084/528] Mark qmf_window table static to atrac.c unit. The table is not used anywhere else on libavcodec. Signed-off-by: Mans Rullgard --- libavcodec/atrac.c | 2 +- libavcodec/atrac.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index e398cee7b8..1f7a69e2f8 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -33,7 +33,7 @@ #include "atrac.h" float sf_table[64]; -float qmf_window[48]; +static float qmf_window[48]; static const float qmf_48tap_half[24] = { -0.00001461907, -0.00009205479,-0.000056157569,0.00030117269, diff --git a/libavcodec/atrac.h b/libavcodec/atrac.h index 0732da0740..acaa4ce041 100644 --- a/libavcodec/atrac.h +++ b/libavcodec/atrac.h @@ -30,7 +30,6 @@ extern float sf_table[64]; -extern float qmf_window[48]; void atrac_generate_tables(void); void atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp); From 82e1f217f276b4b3fda1f89a836126275a97ca9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 24 Jan 2011 23:36:10 +0000 Subject: [PATCH 085/528] Rename sf_table in atrac.c unit to ff_atrac_sf_table. This ensures a locally-unique name as well as marks the symbol as FFmpeg-private at least by declaration. Signed-off-by: Mans Rullgard --- libavcodec/atrac.c | 6 +++--- libavcodec/atrac.h | 3 +-- libavcodec/atrac1.c | 2 +- libavcodec/atrac3.c | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index 1f7a69e2f8..6c1b1f19ce 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -32,7 +32,7 @@ #include "dsputil.h" #include "atrac.h" -float sf_table[64]; +float ff_atrac_sf_table[64]; static float qmf_window[48]; static const float qmf_48tap_half[24] = { @@ -54,9 +54,9 @@ void atrac_generate_tables(void) float s; /* Generate scale factors */ - if (!sf_table[63]) + if (!ff_atrac_sf_table[63]) for (i=0 ; i<64 ; i++) - sf_table[i] = pow(2.0, (i - 15) / 3.0); + ff_atrac_sf_table[i] = pow(2.0, (i - 15) / 3.0); /* Generate the QMF window. */ if (!qmf_window[47]) diff --git a/libavcodec/atrac.h b/libavcodec/atrac.h index acaa4ce041..e126935e12 100644 --- a/libavcodec/atrac.h +++ b/libavcodec/atrac.h @@ -28,8 +28,7 @@ #ifndef AVCODEC_ATRAC_H #define AVCODEC_ATRAC_H - -extern float sf_table[64]; +extern float ff_atrac_sf_table[64]; void atrac_generate_tables(void); void atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp); diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index 513ecc7d8b..c4404f6817 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -223,7 +223,7 @@ static int at1_unpack_dequant(GetBitContext* gb, AT1SUCtx* su, int num_specs = specs_per_bfu[bfu_num]; int word_len = !!idwls[bfu_num] + idwls[bfu_num]; - float scale_factor = sf_table[idsfs[bfu_num]]; + float scale_factor = ff_atrac_sf_table[idsfs[bfu_num]]; bits_used += word_len * num_specs; /* add number of bits consumed by current BFU */ /* check for bitstream overflow */ diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index cc13b730ab..214cec7faa 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -327,7 +327,7 @@ static int decodeSpectrum (GetBitContext *gb, float *pOut) readQuantSpectralCoeffs (gb, subband_vlc_index[cnt], codingMode, mantissas, subbWidth); /* Decode the scale factor for this subband. */ - SF = sf_table[SF_idxs[cnt]] * iMaxQuant[subband_vlc_index[cnt]]; + SF = ff_atrac_sf_table[SF_idxs[cnt]] * iMaxQuant[subband_vlc_index[cnt]]; /* Inverse quantize the coefficients. */ for (pIn=mantissas ; first Date: Mon, 24 Jan 2011 23:36:12 +0000 Subject: [PATCH 086/528] Make this_year static to cmdutils.c Signed-off-by: Mans Rullgard --- cmdutils.c | 2 +- cmdutils.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index 295d10798a..58fe85cfda 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -55,7 +55,7 @@ AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; AVFormatContext *avformat_opts; struct SwsContext *sws_opts; -const int this_year = 2011; +static const int this_year = 2011; void init_opts(void) { diff --git a/cmdutils.h b/cmdutils.h index 9fb7845971..c3d8a42453 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -37,8 +37,6 @@ extern const char program_name[]; */ extern const int program_birth_year; -extern const int this_year; - extern const char **opt_names; extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; extern AVFormatContext *avformat_opts; From bb875b75bab4d1713f8251746b01785c19965a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 24 Jan 2011 23:36:13 +0000 Subject: [PATCH 087/528] Make the ff_lockmgr_cb function pointer static to utils.c Signed-off-by: Mans Rullgard --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 02b9fd6904..53a0674323 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -45,7 +45,7 @@ #include static int volatile entangled_thread_counter=0; -int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op); +static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op); static void *codec_mutex; void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size) From 1d4da6a460d5b78026e3b854fdd6f469957a054c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 24 Jan 2011 23:36:15 +0000 Subject: [PATCH 088/528] Make denoise_dct_c and dct_quantize_trellis_c static. Signed-off-by: Mans Rullgard --- libavcodec/mpegvideo_common.h | 2 -- libavcodec/mpegvideo_enc.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_common.h b/libavcodec/mpegvideo_common.h index 8e46e692f9..135bd1f557 100644 --- a/libavcodec/mpegvideo_common.h +++ b/libavcodec/mpegvideo_common.h @@ -40,8 +40,6 @@ #include int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); -int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); -void denoise_dct_c(MpegEncContext *s, DCTELEM *block); /** * allocates a Picture diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 0f7142bee5..0018ad50f4 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -48,6 +48,8 @@ static int encode_picture(MpegEncContext *s, int picture_number); static int dct_quantize_refine(MpegEncContext *s, DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale); static int sse_mb(MpegEncContext *s); +static void denoise_dct_c(MpegEncContext *s, DCTELEM *block); +static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); /* enable all paranoid tests for rounding, overflows, etc... */ //#define PARANOID From f0a8676958c8e11c49cf9dd1127cb8937d2a7108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 24 Jan 2011 23:36:16 +0000 Subject: [PATCH 089/528] Make dvenc.c functions static to the unit. Also drop some CONFIG_DV_MUXER #ifdefs probably vestigial from before the split of dvenc and dvdec. Signed-off-by: Mans Rullgard --- libavformat/dv.h | 3 --- libavformat/dvenc.c | 10 ++++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/libavformat/dv.h b/libavformat/dv.h index ae16befd57..b8b43f1444 100644 --- a/libavformat/dv.h +++ b/libavformat/dv.h @@ -37,8 +37,5 @@ int dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int); void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset); typedef struct DVMuxContext DVMuxContext; -DVMuxContext* dv_init_mux(AVFormatContext* s); -int dv_assemble_frame(DVMuxContext *c, AVStream*, uint8_t*, int, uint8_t**); -void dv_delete_mux(DVMuxContext*); #endif /* AVFORMAT_DV_H */ diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 0176ac9767..e48d8d09d4 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -232,8 +232,8 @@ static void dv_inject_metadata(DVMuxContext *c, uint8_t* frame) * The following 3 functions constitute our interface to the world */ -int dv_assemble_frame(DVMuxContext *c, AVStream* st, - uint8_t* data, int data_size, uint8_t** frame) +static int dv_assemble_frame(DVMuxContext *c, AVStream* st, + uint8_t* data, int data_size, uint8_t** frame) { int i, reqasize; @@ -285,7 +285,7 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st, return 0; } -DVMuxContext* dv_init_mux(AVFormatContext* s) +static DVMuxContext* dv_init_mux(AVFormatContext* s) { DVMuxContext *c = s->priv_data; AVStream *vst = NULL; @@ -354,14 +354,13 @@ bail_out: return NULL; } -void dv_delete_mux(DVMuxContext *c) +static void dv_delete_mux(DVMuxContext *c) { int i; for (i=0; i < c->n_ast; i++) av_fifo_free(c->audio_data[i]); } -#if CONFIG_DV_MUXER static int dv_write_header(AVFormatContext *s) { if (!dv_init_mux(s)) { @@ -412,4 +411,3 @@ AVOutputFormat dv_muxer = { dv_write_packet, dv_write_trailer, }; -#endif /* CONFIG_DV_MUXER */ From a6d1bd05c906fc7ad34fae1029a45ec3cbcc4fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 24 Jan 2011 23:36:17 +0000 Subject: [PATCH 090/528] Make local variables static. Signed-off-by: Mans Rullgard --- ffmpeg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 56b2dbed5e..691b73e159 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -172,7 +172,7 @@ static int loop_output = AVFMT_NOOUTPUTLOOP; static int qp_hist = 0; #if CONFIG_AVFILTER static char *vfilters = NULL; -AVFilterGraph *graph = NULL; +static AVFilterGraph *graph = NULL; #endif static int intra_only = 0; @@ -251,7 +251,7 @@ static int64_t timer_start; static uint8_t *audio_buf; static uint8_t *audio_out; -unsigned int allocated_audio_out_size, allocated_audio_buf_size; +static unsigned int allocated_audio_out_size, allocated_audio_buf_size; static short *samples; From 73a0b19ba39a4aca79a768feeacd83307a62836e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 00:16:36 +0000 Subject: [PATCH 091/528] Don't check for DEBUG before using dprintf. The dprintf macro is no-op when DEBUG is unset, so there is no need to put it conditional to DEBUG. Signed-off-by: Mans Rullgard --- libavcodec/gifdec.c | 22 ++++++++++------------ libavformat/mxf.h | 4 ---- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index 4cc80017e8..9820a063fc 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -76,9 +76,8 @@ static int gif_read_image(GifState *s) is_interleaved = flags & 0x40; has_local_palette = flags & 0x80; bits_per_pixel = (flags & 0x07) + 1; -#ifdef DEBUG + dprintf(s->avctx, "gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height); -#endif if (has_local_palette) { bytestream_get_buffer(&s->bytestream, s->local_palette, 3 * (1 << bits_per_pixel)); @@ -163,9 +162,9 @@ static int gif_read_extension(GifState *s) /* extension */ ext_code = bytestream_get_byte(&s->bytestream); ext_len = bytestream_get_byte(&s->bytestream); -#ifdef DEBUG + dprintf(s->avctx, "gif: ext_code=0x%x len=%d\n", ext_code, ext_len); -#endif + switch(ext_code) { case 0xf9: if (ext_len != 4) @@ -179,11 +178,11 @@ static int gif_read_extension(GifState *s) else s->transparent_color_index = -1; s->gce_disposal = (gce_flags >> 2) & 0x7; -#ifdef DEBUG + dprintf(s->avctx, "gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n", gce_flags, s->gce_delay, s->transparent_color_index, s->gce_disposal); -#endif + ext_len = bytestream_get_byte(&s->bytestream); break; } @@ -194,9 +193,8 @@ static int gif_read_extension(GifState *s) for (i = 0; i < ext_len; i++) bytestream_get_byte(&s->bytestream); ext_len = bytestream_get_byte(&s->bytestream); -#ifdef DEBUG + dprintf(s->avctx, "gif: ext_len1=%d\n", ext_len); -#endif } return 0; } @@ -232,11 +230,11 @@ static int gif_read_header1(GifState *s) s->bits_per_pixel = (v & 0x07) + 1; s->background_color_index = bytestream_get_byte(&s->bytestream); bytestream_get_byte(&s->bytestream); /* ignored */ -#ifdef DEBUG + dprintf(s->avctx, "gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n", s->screen_width, s->screen_height, s->bits_per_pixel, has_global_palette); -#endif + if (has_global_palette) { n = 1 << s->bits_per_pixel; if (s->bytestream_end < s->bytestream + n * 3) @@ -250,9 +248,9 @@ static int gif_parse_next_image(GifState *s) { while (s->bytestream < s->bytestream_end) { int code = bytestream_get_byte(&s->bytestream); -#ifdef DEBUG + dprintf(s->avctx, "gif: code=%02x '%c'\n", code, code); -#endif + switch (code) { case ',': return gif_read_image(s); diff --git a/libavformat/mxf.h b/libavformat/mxf.h index 26832c27be..11bd8772a8 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -70,11 +70,7 @@ extern const MXFPixelLayout ff_mxf_pixel_layouts[]; int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum PixelFormat *pix_fmt); -#ifdef DEBUG #define PRINT_KEY(pc, s, x) dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \ (x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], (x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15]) -#else -#define PRINT_KEY(pc, s, x) -#endif #endif /* AVFORMAT_MXF_H */ From 5b5083b5fed1e0b0d8f3c6f2c21bdc915b1226f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 00:41:24 +0000 Subject: [PATCH 092/528] Don't declare a pcm_dvd encoder. The PCM_DVD encoder would be left unused, as allcodecs.c properly declared it as being decoder-only, but it would still be built into the object file. Since there is no block of code to properly encode this PCM format, it's not a full codec. Signed-off-by: Mans Rullgard --- libavcodec/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 533e834a54..3e985ce04f 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -508,7 +508,7 @@ AVCodec name_ ## _decoder = { \ /* Note: Do not forget to add new entries to the Makefile as well. */ PCM_CODEC (CODEC_ID_PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law"); -PCM_CODEC (CODEC_ID_PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian"); +PCM_DECODER(CODEC_ID_PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian"); PCM_CODEC (CODEC_ID_PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian"); PCM_CODEC (CODEC_ID_PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian"); PCM_CODEC (CODEC_ID_PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian"); From aa61e39eac85e26bff0f296b1ec86d4533664adc Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 25 Jan 2011 01:02:19 +0000 Subject: [PATCH 093/528] Make denoise_dct_c() and dct_quantize_trellis_c() static in definitions 1d4da6a460d5b78026e3b854fdd6f469957a054c added static to the prototypes for these fuctions. Adding it to the definitions as well. Signed-off-by: Mans Rullgard --- libavcodec/mpegvideo_enc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 0018ad50f4..ef830affd7 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -2984,7 +2984,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) return 0; } -void denoise_dct_c(MpegEncContext *s, DCTELEM *block){ +static void denoise_dct_c(MpegEncContext *s, DCTELEM *block){ const int intra= s->mb_intra; int i; @@ -3008,9 +3008,9 @@ void denoise_dct_c(MpegEncContext *s, DCTELEM *block){ } } -int dct_quantize_trellis_c(MpegEncContext *s, - DCTELEM *block, int n, - int qscale, int *overflow){ +static int dct_quantize_trellis_c(MpegEncContext *s, + DCTELEM *block, int n, + int qscale, int *overflow){ const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; From 69ad22c7a7c2d961b413f96b437de267261311e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 01:29:35 +0000 Subject: [PATCH 094/528] Make ff_realmedia_mp3_dynamic_handler static. Signed-off-by: Mans Rullgard --- libavformat/rtpdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 03abb1dcff..f9016d0eda 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -44,7 +44,7 @@ 'url_open_dyn_packet_buf') */ -RTPDynamicProtocolHandler ff_realmedia_mp3_dynamic_handler = { +static RTPDynamicProtocolHandler ff_realmedia_mp3_dynamic_handler = { .enc_name = "X-MP3-draft-00", .codec_type = AVMEDIA_TYPE_AUDIO, .codec_id = CODEC_ID_MP3ADU, From 119cc033fc88f4a7d6cc4ef6ee02097476e8f2a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 24 Jan 2011 23:36:18 +0000 Subject: [PATCH 095/528] Make RTPFirstDynamicPayloadHandler static to rtpdec.c Signed-off-by: Mans Rullgard --- libavformat/rtpdec.c | 2 +- libavformat/rtpdec.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index f9016d0eda..4f0ade167d 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -51,7 +51,7 @@ static RTPDynamicProtocolHandler ff_realmedia_mp3_dynamic_handler = { }; /* statistics functions */ -RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler= NULL; +static RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler= NULL; void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler) { diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index c5a521760d..a27f743023 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -189,7 +189,6 @@ struct RTPDemuxContext { int max_frames_per_packet; }; -extern RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler; void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler); RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, enum AVMediaType codec_type); From 6081f8c4e283bf1b33e4cf4b2ca44217219f9210 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 25 Jan 2011 02:24:43 +0000 Subject: [PATCH 096/528] avidec: make print_tag() a macro and remove related ifdefs The dprintf macro is a no-op if DEBUG is not defined, so there is no need to guard it here. Signed-off-by: Mans Rullgard --- libavformat/avidec.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 15f48e8ac7..d02e188ca6 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -84,17 +84,13 @@ static const char avi_headers[][8] = { static int avi_load_index(AVFormatContext *s); static int guess_ni_flag(AVFormatContext *s); -#ifdef DEBUG -static void print_tag(const char *str, unsigned int tag, int size) -{ - dprintf(NULL, "%s: tag=%c%c%c%c size=0x%x\n", - str, tag & 0xff, - (tag >> 8) & 0xff, - (tag >> 16) & 0xff, - (tag >> 24) & 0xff, - size); -} -#endif +#define print_tag(str, tag, size) \ + dprintf(NULL, "%s: tag=%c%c%c%c size=0x%x\n", \ + str, tag & 0xff, \ + (tag >> 8) & 0xff, \ + (tag >> 16) & 0xff, \ + (tag >> 24) & 0xff, \ + size) static inline int get_duration(AVIStream *ast, int len){ if(ast->sample_size){ @@ -369,18 +365,17 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) goto fail; tag = get_le32(pb); size = get_le32(pb); -#ifdef DEBUG + print_tag("tag", tag, size); -#endif switch(tag) { case MKTAG('L', 'I', 'S', 'T'): list_end = url_ftell(pb) + size; /* Ignored, except at start of video packets. */ tag1 = get_le32(pb); -#ifdef DEBUG + print_tag("list", tag1, 0); -#endif + if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = url_ftell(pb) - 4; if(size) avi->movi_end = avi->movi_list + size + (size & 1); @@ -447,9 +442,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if(amv_file_format) tag1 = stream_index ? MKTAG('a','u','d','s') : MKTAG('v','i','d','s'); -#ifdef DEBUG print_tag("strh", tag1, -1); -#endif + if(tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')){ int64_t dv_dur; @@ -607,9 +601,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->palctrl->palette_changed = 1; } -#ifdef DEBUG print_tag("video", tag1, 0); -#endif + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_tag = tag1; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); From e153e9a53a6fbfba974b8263bca70f7bba02952c Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 25 Jan 2011 03:31:01 +0000 Subject: [PATCH 097/528] latm: remove superflous #includes Signed-off-by: Mans Rullgard --- libavcodec/latm_parser.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libavcodec/latm_parser.c b/libavcodec/latm_parser.c index b8b67ef546..e3134be567 100644 --- a/libavcodec/latm_parser.c +++ b/libavcodec/latm_parser.c @@ -23,12 +23,7 @@ * AAC LATM parser */ -#include -#include -#include -#include -#include - +#include #include "parser.h" #define LATM_HEADER 0x56e000 // 0x2b7 (11 bits) From 3adbe49f2b1a25d2fd44080167b6519c4ce4e30e Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 25 Jan 2011 07:58:18 +0000 Subject: [PATCH 098/528] Fix ALLPROGS_G so that *_g binaries get cleaned properly Signed-off-by: Mans Rullgard --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a1fd7b4e42..2fe605ae66 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ HOSTPROGS := $(TESTPROGS:%=tests/%) BASENAMES = ffmpeg ffplay ffprobe ffserver ALLPROGS = $(BASENAMES:%=%$(EXESUF)) -ALLPROGS_G = $(BASENAMES:%=_g$(EXESUF)) +ALLPROGS_G = $(BASENAMES:%=%_g$(EXESUF)) ALLMANPAGES = $(BASENAMES:%=%.1) ALLHTMLPAGES= $(BASENAMES:%=%.html) From 6e78c8ee9420cc8e8899462b59e2305b4c056081 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Tue, 25 Jan 2011 12:58:31 +0200 Subject: [PATCH 099/528] mpegtsenc: remove unused variables Remove two variables that were not used and caused the following warnings: CC libavformat/mpegtsenc.o libavformat/mpegtsenc.c: In function 'mpegts_write_section': libavformat/mpegtsenc.c:72:18: warning: unused variable 'ts' libavformat/mpegtsenc.c: In function 'mpegts_insert_null_packet': libavformat/mpegtsenc.c:586:18: warning: unused variable 'ts' Signed-off-by: Mans Rullgard --- libavformat/mpegtsenc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index f33b6c6b73..f621646c52 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -69,7 +69,6 @@ typedef struct MpegTSWrite { /* NOTE: 4 bytes must be left at the end for the crc32 */ static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len) { - MpegTSWrite *ts = ((AVFormatContext*)s->opaque)->priv_data; unsigned int crc; unsigned char packet[TS_PACKET_SIZE]; const unsigned char *buf_ptr; @@ -583,7 +582,6 @@ static uint8_t* write_pcr_bits(uint8_t *buf, int64_t pcr) /* Write a single null transport stream packet */ static void mpegts_insert_null_packet(AVFormatContext *s) { - MpegTSWrite *ts = s->priv_data; uint8_t *q; uint8_t buf[TS_PACKET_SIZE]; From 54fe299b885109556c72538977f9eefb969a0d87 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 25 Jan 2011 09:28:01 +0000 Subject: [PATCH 100/528] configure: move network tests before results are needed This moves network_extralibs setup before use so that the link tests for network functions work correctly. Signed-off-by: Mans Rullgard --- configure | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/configure b/configure index 785465931d..70b18b3b05 100755 --- a/configure +++ b/configure @@ -2682,6 +2682,32 @@ elif check_func dlopen -ldl; then ldl=-ldl fi +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" -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 + # Prefer arpa/inet.h over winsock2 + if check_header arpa/inet.h ; then + check_func closesocket + elif check_header winsock2.h ; then + check_func_headers winsock2.h closesocket -lws2 && \ + network_extralibs="-lws2" || \ + { check_func_headers winsock2.h closesocket -lws2_32 && \ + network_extralibs="-lws2_32"; } + check_type ws2tcpip.h socklen_t + check_type ws2tcpip.h "struct addrinfo" + check_type ws2tcpip.h "struct ipv6_mreq" + check_type ws2tcpip.h "struct sockaddr_in6" + check_type ws2tcpip.h "struct sockaddr_storage" + check_struct winsock2.h "struct sockaddr" sa_len + else + disable network + fi +fi + # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; } @@ -2827,32 +2853,6 @@ fi texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html -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" -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 - # Prefer arpa/inet.h over winsock2 - if check_header arpa/inet.h ; then - check_func closesocket - elif check_header winsock2.h ; then - check_func_headers winsock2.h closesocket -lws2 && \ - network_extralibs="-lws2" || \ - { check_func_headers winsock2.h closesocket -lws2_32 && \ - network_extralibs="-lws2_32"; } - check_type ws2tcpip.h socklen_t - check_type ws2tcpip.h "struct addrinfo" - check_type ws2tcpip.h "struct ipv6_mreq" - check_type ws2tcpip.h "struct sockaddr_in6" - check_type ws2tcpip.h "struct sockaddr_storage" - check_struct winsock2.h "struct sockaddr" sa_len - else - disable network - fi -fi - check_header linux/videodev.h check_header linux/videodev2.h check_header sys/videoio.h From 3d157bf31f33cf413a6fb04ba69a4015ca0625cb Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 25 Jan 2011 13:25:18 +0000 Subject: [PATCH 101/528] Makefile: fix cleaning of tools in tests directory The variable TESTPROGS is reset by the library makefiles, use another name. Signed-off-by: Mans Rullgard --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2fe605ae66..c5e74f062c 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ MANPAGES = $(PROGS-yes:%=doc/%.1) PODPAGES = $(PROGS-yes:%=doc/%.pod) HTMLPAGES = $(PROGS-yes:%=doc/%.html) TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher)) -TESTPROGS = audiogen videogen rotozoom tiny_psnr base64 -HOSTPROGS := $(TESTPROGS:%=tests/%) +TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 +HOSTPROGS := $(TESTTOOLS:%=tests/%) BASENAMES = ffmpeg ffplay ffprobe ffserver ALLPROGS = $(BASENAMES:%=%$(EXESUF)) @@ -163,7 +163,7 @@ testclean: $(RM) -r tests/vsynth1 tests/vsynth2 tests/data $(RM) $(addprefix tests/,$(CLEANSUFFIXES)) $(RM) tests/seek_test$(EXESUF) tests/seek_test.o - $(RM) $(TESTPROGS:%=tests/%$(HOSTEXESUF)) + $(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF)) clean:: testclean $(RM) $(ALLPROGS) $(ALLPROGS_G) From 362bfe29971b3bb8497d2b341337697be15a257c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 24 Jan 2011 23:36:14 +0000 Subject: [PATCH 102/528] Remove unused ac3_parametric_bit_allocation function. Signed-off-by: Mans Rullgard --- libavcodec/ac3.c | 23 ----------------------- libavcodec/ac3.h | 7 ------- 2 files changed, 30 deletions(-) diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index 4ab77b84a1..0f442fa487 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -237,29 +237,6 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, } while (end > band_start_tab[band++]); } -/* AC-3 bit allocation. The algorithm is the one described in the AC-3 - spec. */ -void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, - int8_t *exp, int start, int end, - int snr_offset, int fast_gain, int is_lfe, - int dba_mode, int dba_nsegs, - uint8_t *dba_offsets, uint8_t *dba_lengths, - uint8_t *dba_values) -{ - int16_t psd[AC3_MAX_COEFS]; /* scaled exponents */ - int16_t band_psd[AC3_CRITICAL_BANDS]; /* interpolated exponents */ - int16_t mask[AC3_CRITICAL_BANDS]; /* masking value */ - - ff_ac3_bit_alloc_calc_psd(exp, start, end, psd, band_psd); - - ff_ac3_bit_alloc_calc_mask(s, band_psd, start, end, fast_gain, is_lfe, - dba_mode, dba_nsegs, dba_offsets, dba_lengths, - dba_values, mask); - - ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor, - ff_ac3_bap_tab, bap); -} - /** * Initialize some tables. * note: This function must remain thread safe because it is called by the diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h index 89a88b65b6..283b134329 100644 --- a/libavcodec/ac3.h +++ b/libavcodec/ac3.h @@ -181,11 +181,4 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, int snr_offset, int floor, const uint8_t *bap_tab, uint8_t *bap); -void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, - int8_t *exp, int start, int end, - int snr_offset, int fast_gain, int is_lfe, - int dba_mode, int dba_nsegs, - uint8_t *dba_offsets, uint8_t *dba_lengths, - uint8_t *dba_values); - #endif /* AVCODEC_AC3_H */ From 6ed3b504f984dc6cefde8d57a57726f9d30e5033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 01:59:36 +0000 Subject: [PATCH 103/528] Move ff_ac3_critical_band_size_tab in ac3.c for non-hardcoded tables. This symbol is only ever used to calculate the non-hardcoded tables, so only enable it in that case, and static to the source unit that uses it. Signed-off-by: Mans Rullgard --- libavcodec/ac3.c | 6 ++++++ libavcodec/ac3tab.c | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index 0f442fa487..a8b4e0b268 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -70,6 +70,12 @@ static const uint8_t bin_to_band_tab[253] = { }; #else /* CONFIG_HARDCODED_TABLES */ +static const uint8_t ff_ac3_critical_band_size_tab[AC3_CRITICAL_BANDS]={ + 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, 3, 3, 3, 3, 3, 3, + 3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24 +}; + static uint8_t band_start_tab[51]; static uint8_t bin_to_band_tab[253]; #endif diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c index 4fc0824a46..7c0ebcdcd3 100644 --- a/libavcodec/ac3tab.c +++ b/libavcodec/ac3tab.c @@ -292,11 +292,6 @@ const uint16_t ff_ac3_fast_gain_tab[8]= { 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400, }; -const uint8_t ff_ac3_critical_band_size_tab[AC3_CRITICAL_BANDS]={ - 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, 3, 3, 3, 3, 3, 3, - 3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24 -}; /** * Default channel map for a dependent substream defined by acmod */ From 21c900129c268587fa2df774242bfd8af72ff890 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 25 Jan 2011 15:48:46 +0000 Subject: [PATCH 104/528] ac3: remove ff_ac3_critical_band_size_tab[] external declaration This fixes compilation broken by 6ed3b504f984dc6cefde8d57a57726f9d30e5033 Signed-off-by: Mans Rullgard --- libavcodec/ac3tab.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h index dd8cabfcfd..36355d0a86 100644 --- a/libavcodec/ac3tab.h +++ b/libavcodec/ac3tab.h @@ -43,7 +43,6 @@ extern const uint16_t ff_ac3_slow_gain_tab[4]; extern const uint16_t ff_ac3_db_per_bit_tab[4]; extern const int16_t ff_ac3_floor_tab[8]; extern const uint16_t ff_ac3_fast_gain_tab[8]; -extern const uint8_t ff_ac3_critical_band_size_tab[AC3_CRITICAL_BANDS]; extern const uint16_t ff_eac3_default_chmap[8]; /** Custom channel map locations bitmask From 1e48cdaac32e42a5c87a8f203b5827bdcc46db93 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 25 Jan 2011 03:31:45 +0000 Subject: [PATCH 105/528] tty: remove superflous #include Signed-off-by: Mans Rullgard --- libavformat/tty.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/tty.c b/libavformat/tty.c index 6aa6fa2c27..78db4ee041 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -28,7 +28,6 @@ #include "libavutil/avstring.h" #include "avformat.h" #include "sauce.h" -#include #define LINE_RATE 6000 /* characters per second */ From e781c4e6ff0b93db1ebc0ebe6983b38490117a98 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 25 Jan 2011 03:33:43 +0000 Subject: [PATCH 106/528] intfloat_readwrite: include "mathematics.h" for fallback macros This allows this file to build on systems lacking NAN or INFINITY in math.h. Signed-off-by: Mans Rullgard --- libavutil/intfloat_readwrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/intfloat_readwrite.c b/libavutil/intfloat_readwrite.c index d9b3752bb1..f51d8ddd4f 100644 --- a/libavutil/intfloat_readwrite.c +++ b/libavutil/intfloat_readwrite.c @@ -26,7 +26,7 @@ */ #include -#include +#include "mathematics.h" #include "intfloat_readwrite.h" double av_int2dbl(int64_t v){ From c0ae5152d19790e8719c8d1d2bf9b761491dbda6 Mon Sep 17 00:00:00 2001 From: Jai Menon Date: Mon, 24 Jan 2011 22:55:43 -0600 Subject: [PATCH 107/528] ffmetaenc: Use correct format specifiers. Use printf format macros from inttypes.h. Additionally, this fixes a warning when building with clang. --- libavformat/ffmetaenc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index f42a2b3f99..785b537332 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "avformat.h" #include "ffmeta.h" @@ -72,8 +74,8 @@ static int write_trailer(AVFormatContext *s) put_tag(s->pb, ID_CHAPTER); put_byte(s->pb, '\n'); url_fprintf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den); - url_fprintf(s->pb, "START=%lld\n", ch->start); - url_fprintf(s->pb, "END=%lld\n", ch->end); + url_fprintf(s->pb, "START=%"PRId64"\n", ch->start); + url_fprintf(s->pb, "END=%"PRId64"\n", ch->end); write_tags(s->pb, ch->metadata); } From 44002d8323023c35f51d523a7d305e45103ba7a1 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 25 Jan 2011 12:25:07 -0500 Subject: [PATCH 108/528] Don't do edge emulation unless the edge pixels will be used in MC. Do not emulate larger edges than we will actually use for this round of MC. Decoding goes from avg+SE 29.972+/-0.023sec to 29.856+/-0.023, i.e. 0.12sec or ~0.4% faster. --- libavcodec/vp8.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 80d30e8046..52a3f90ba0 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1218,21 +1218,26 @@ void vp8_mc(VP8Context *s, int luma, vp8_mc_func mc_func[3][3]) { if (AV_RN32A(mv)) { - static const uint8_t idx[8] = { 0, 1, 2, 1, 2, 1, 2, 1 }; - int mx = (mv->x << luma)&7, mx_idx = idx[mx]; - int my = (mv->y << luma)&7, my_idx = idx[my]; + static const uint8_t idx[3][8] = { + { 0, 1, 2, 1, 2, 1, 2, 1 }, // nr. of left extra pixels, + // also function pointer index + { 0, 3, 5, 3, 5, 3, 5, 3 }, // nr. of extra pixels required + { 0, 2, 3, 2, 3, 2, 3, 2 }, // nr. of right extra pixels + }; + int mx = (mv->x << luma)&7, mx_idx = idx[0][mx]; + int my = (mv->y << luma)&7, my_idx = idx[0][my]; x_off += mv->x >> (3 - luma); y_off += mv->y >> (3 - luma); // edge emulation src += y_off * linesize + x_off; - if (x_off < 2 || x_off >= width - block_w - 3 || - y_off < 2 || y_off >= height - block_h - 3) { - ff_emulated_edge_mc(s->edge_emu_buffer, src - 2 * linesize - 2, linesize, - block_w + 5, block_h + 5, - x_off - 2, y_off - 2, width, height); - src = s->edge_emu_buffer + 2 + linesize * 2; + if (x_off < mx_idx || x_off >= width - block_w - idx[2][mx] || + y_off < my_idx || y_off >= height - block_h - idx[2][my]) { + ff_emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize, + block_w + idx[1][mx], block_h + idx[1][my], + x_off - mx_idx, y_off - my_idx, width, height); + src = s->edge_emu_buffer + mx_idx + linesize * my_idx; } mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my); } else From 9d201b260627aacdb00e4a54622849aca11d85ee Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 25 Jan 2011 14:44:07 +0000 Subject: [PATCH 109/528] configure: add filter_out() function This adds a function to filter out words matching a pattern from a list. Signed-off-by: Mans Rullgard --- configure | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure b/configure index 70b18b3b05..51e1172775 100755 --- a/configure +++ b/configure @@ -321,6 +321,14 @@ filter(){ done } +filter_out(){ + pat=$1 + shift + for v; do + eval "case $v in $pat) ;; *) echo $v ;; esac" + done +} + map(){ m=$1 shift From d0f0f6287c7fd29474e58fe1b86db2885f20c457 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 25 Jan 2011 14:45:20 +0000 Subject: [PATCH 110/528] armcc: filter out non-gcc options from ASFLAGS This allows passing armcc-specific flags with --extra-cflags without choking the assembler. Signed-off-by: Mans Rullgard --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 51e1172775..94993d7e86 100755 --- a/configure +++ b/configure @@ -1912,6 +1912,7 @@ elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then AS_DEPFLAGS='-MMD' speed_cflags='-O3' size_cflags='-Os' + filter_asflags="filter_out -W${armcc_opt}*" elif $cc -version 2>/dev/null | grep -q TMS470; then cc_type=tms470 cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)" From 93b78d12106112d7c5d9cfdcf96fc3dce9dc5f82 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 23 Jan 2011 12:38:27 +0100 Subject: [PATCH 111/528] lavf: make a variant of ff_get_str16_nolen public It will be useful in mp3 demuxer and hopeful some other places. Signed-off-by: Janne Grunau --- libavformat/asfdec.c | 30 ++++++++++-------------------- libavformat/avio.h | 9 +++++++++ libavformat/aviobuf.c | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 6ae4e99326..3ce37dc59e 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -121,21 +121,6 @@ static void get_str16(ByteIOContext *pb, char *buf, int buf_size) } #endif -static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size) -{ - char* q = buf; - while (len > 1) { - uint8_t tmp; - uint32_t ch; - - GET_UTF16(ch, (len -= 2) >= 0 ? get_le16(pb) : 0, break;) - PUT_UTF8(ch, tmp, if (q - buf < buf_size - 1) *q++ = tmp;) - } - if (len > 0) - url_fskip(pb, len); - *q = '\0'; -} - static int asf_probe(AVProbeData *pd) { /* check file header */ @@ -167,7 +152,7 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len) return; if (type == 0) { // UTF16-LE - get_str16_nolen(s->pb, len, value, 2*len + 1); + avio_get_str16le(s->pb, len, value, 2*len + 1); } else if (type > 1 && type <= 5) { // boolean or DWORD or QWORD or WORD uint64_t num = get_value(s->pb, type); snprintf(value, len, "%"PRIu64, num); @@ -206,6 +191,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid)); for(;;) { uint64_t gpos= url_ftell(pb); + int ret; ff_get_guid(pb, &g); gsize = get_le64(pb); dprintf(s, "%08"PRIx64": ", gpos); @@ -447,7 +433,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) for(j = 0; j < stream_count; j++) { char lang[6]; unsigned int lang_len = get_byte(pb); - get_str16_nolen(pb, lang_len, lang, sizeof(lang)); + if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len) + url_fskip(pb, lang_len - ret); if (j < 128) av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages)); } @@ -462,7 +449,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) name_len = get_le16(pb); if (name_len%2) // must be even, broken lavf versions wrote len-1 name_len += 1; - get_str16_nolen(pb, name_len, name, sizeof(name)); + if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) + url_fskip(pb, name_len - ret); value_type = get_le16(pb); value_len = get_le16(pb); if (!value_type && value_len%2) @@ -491,7 +479,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) value_type= get_le16(pb); value_len= get_le32(pb); - get_str16_nolen(pb, name_len, name, sizeof(name)); + if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) + url_fskip(pb, name_len - ret); //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name); value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere url_fskip(pb, value_len - 2); @@ -574,7 +563,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) get_le32(pb); // send time get_le32(pb); // flags name_len = get_le32(pb); // name length - get_str16_nolen(pb, name_len * 2, name, sizeof(name)); + if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len) + url_fskip(pb, name_len - ret); ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name ); } #if 0 diff --git a/libavformat/avio.h b/libavformat/avio.h index b35d4c716c..a606f7cb97 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -460,6 +460,15 @@ unsigned int get_le32(ByteIOContext *s); uint64_t get_le64(ByteIOContext *s); unsigned int get_le16(ByteIOContext *s); +/** + * Read a UTF-16 string from pb and convert it to UTF-8. + * The reading will terminate when either a null or invalid character was + * encountered or maxlen bytes have been read. + * @return number of bytes read (is always <= maxlen) + */ +int avio_get_str16le(ByteIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16be(ByteIOContext *pb, int maxlen, char *buf, int buflen); + char *get_strz(ByteIOContext *s, char *buf, int maxlen); unsigned int get_be16(ByteIOContext *s); unsigned int get_be24(ByteIOContext *s); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 5aeced1b9f..acea8111d9 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -602,6 +602,28 @@ int ff_get_line(ByteIOContext *s, char *buf, int maxlen) return i; } +#define GET_STR16(type, read) \ + int avio_get_str16 ##type(ByteIOContext *pb, int maxlen, char *buf, int buflen)\ +{\ + char* q = buf;\ + int ret = 0;\ + while (ret + 1 < maxlen) {\ + uint8_t tmp;\ + uint32_t ch;\ + GET_UTF16(ch, (ret += 2) <= maxlen ? read(pb) : 0, break;)\ + if (!ch)\ + break;\ + PUT_UTF8(ch, tmp, if (q - buf < buflen - 1) *q++ = tmp;)\ + }\ + *q = 0;\ + return ret;\ +}\ + +GET_STR16(le, get_le16) +GET_STR16(be, get_be16) + +#undef GET_STR16 + uint64_t get_be64(ByteIOContext *s) { uint64_t val; From 2934cd9dbf390962ec008182f9eddd4296cf5527 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 23 Jan 2011 12:38:29 +0100 Subject: [PATCH 112/528] asfdec: remove some commented-out cruft Signed-off-by: Janne Grunau --- libavformat/asfdec.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 3ce37dc59e..36690ae568 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -103,24 +103,6 @@ void ff_get_guid(ByteIOContext *s, ff_asf_guid *g) get_buffer(s, *g, sizeof(*g)); } -#if 0 -static void get_str16(ByteIOContext *pb, char *buf, int buf_size) -{ - int len, c; - char *q; - - len = get_le16(pb); - q = buf; - while (len > 0) { - c = get_le16(pb); - if ((q - buf) < buf_size - 1) - *q++ = c; - len--; - } - *q = '\0'; -} -#endif - static int asf_probe(AVProbeData *pd) { /* check file header */ @@ -567,31 +549,6 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) url_fskip(pb, name_len - ret); ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name ); } -#if 0 - } else if (!ff_guidcmp(&g, &ff_asf_codec_comment_header)) { - int len, v1, n, num; - char str[256], *q; - char tag[16]; - - ff_get_guid(pb, &g); - print_guid(&g); - - n = get_le32(pb); - for(i=0;i 0) { - v1 = get_byte(pb); - if ((q - tag) < sizeof(tag) - 1) - *q++ = v1; - len--; - } - *q = '\0'; - } -#endif } else if (url_feof(pb)) { return -1; } else { From c34461b35b68ff1f3d04540e0279383c51be8cee Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 23 Jan 2011 12:38:30 +0100 Subject: [PATCH 113/528] mov: simplify mov_read_chapters() by using avio_get_str16be It probably also fixes a memleak or two. Signed-off-by: Janne Grunau --- libavformat/mov.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 4370b48bc5..40666c167e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2283,8 +2283,7 @@ static void mov_read_chapters(AVFormatContext *s) AVStream *st = NULL; MOVStreamContext *sc; int64_t cur_pos; - uint8_t *title = NULL; - int i, len, i8, i16; + int i; for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->id == mov->chapter_track) { @@ -2303,43 +2302,33 @@ static void mov_read_chapters(AVFormatContext *s) for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; + uint8_t title[512]; + uint16_t ch; + int len; if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); goto finish; } - title = av_malloc(sample->size+2); - get_buffer(sc->pb, title, sample->size); - // the first two bytes are the length of the title - len = AV_RB16(title); + len = get_be16(sc->pb); if (len > sample->size-2) continue; // The samples could theoretically be in any encoding if there's an encd // atom following, but in practice are only utf-8 or utf-16, distinguished // instead by the presence of a BOM - if (AV_RB16(title+2) == 0xfeff) { - uint8_t *utf8 = av_malloc(2*len+3); - - i8 = i16 = 0; - while (i16 < len) { - uint32_t ch; - uint8_t tmp; - GET_UTF16(ch, i16 < len ? AV_RB16(title + (i16+=2)) : 0, break;) - PUT_UTF8(ch, tmp, if (i8 < 2*len) utf8[2+i8++] = tmp;) - } - utf8[2+i8] = 0; - av_freep(&title); - title = utf8; + if ((ch = get_be16(sc->pb)) == 0xfeff) + avio_get_str16be(sc->pb, len, title, sizeof(title)); + else { + AV_WB16(title, ch); + get_buffer(sc->pb, title + sizeof(ch), sizeof(title) - sizeof(ch)); } - ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title+2); - av_freep(&title); + ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title); } finish: - av_free(title); url_fseek(sc->pb, cur_pos, SEEK_SET); } From 101e1f6ff90c3365bfde05469ae26d2ee7f71f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 02:29:36 +0100 Subject: [PATCH 114/528] Make ff_interleave_compare_dts static to utils.c. Signed-off-by: Janne Grunau --- libavformat/audiointerleave.h | 1 - libavformat/utils.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/audiointerleave.h b/libavformat/audiointerleave.h index c948c366fb..b37c8aefbd 100644 --- a/libavformat/audiointerleave.h +++ b/libavformat/audiointerleave.h @@ -39,7 +39,6 @@ typedef struct { int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base); void ff_audio_interleave_close(AVFormatContext *s); -int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt); /** * Rechunk audio PCM packets per AudioInterleaveContext->samples_per_frame * and interleave them correctly. diff --git a/libavformat/utils.c b/libavformat/utils.c index c208bd994f..4f51c26697 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3000,7 +3000,7 @@ next_non_null: *next_point= this_pktl; } -int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt) +static int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt) { AVStream *st = s->streams[ pkt ->stream_index]; AVStream *st2= s->streams[ next->stream_index]; From 8529731961d79fc0e747b16152df3d470b530537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 02:29:42 +0100 Subject: [PATCH 115/528] Make ff_h264_decode_rbsp_trailing static to h264.c Signed-off-by: Janne Grunau --- libavcodec/h264.c | 6 +++++- libavcodec/h264.h | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index d56c29331e..25417f7c4a 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -233,7 +233,11 @@ nsc: return dst; } -int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){ +/** + * Identify the exact end of the bitstream + * @return the length of the trailing, or 0 if damaged + */ +static int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){ int v= *src; int r; diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 17fd680369..f4f9b25739 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -625,12 +625,6 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length); */ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length); -/** - * Identify the exact end of the bitstream - * @return the length of the trailing, or 0 if damaged - */ -int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src); - /** * Free any data that may have been allocated in the H264 context like SPS, PPS etc. */ From a3dffc0627dfd85f8b1a72b9b637938dfa197208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 02:29:37 +0100 Subject: [PATCH 116/528] Make ff_mxf_pixel_layouts static to mxf.c. Also make it an anonymous structure as never it is accessed by name. Signed-off-by: Janne Grunau --- libavformat/mxf.c | 5 ++++- libavformat/mxf.h | 7 ------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/libavformat/mxf.c b/libavformat/mxf.c index c7423b0b62..643a95243a 100644 --- a/libavformat/mxf.c +++ b/libavformat/mxf.c @@ -52,7 +52,10 @@ const MXFCodecUL ff_mxf_codec_uls[] = { { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, CODEC_ID_NONE }, }; -const MXFPixelLayout ff_mxf_pixel_layouts[] = { +static const struct { + enum PixelFormat pix_fmt; + const char data[16]; +} ff_mxf_pixel_layouts[] = { /** * See SMPTE 377M E.2.46 * diff --git a/libavformat/mxf.h b/libavformat/mxf.h index 11bd8772a8..9190da6e04 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -61,13 +61,6 @@ typedef struct { extern const MXFCodecUL ff_mxf_data_definition_uls[]; extern const MXFCodecUL ff_mxf_codec_uls[]; -typedef struct { - enum PixelFormat pix_fmt; - const char data[16]; -} MXFPixelLayout; - -extern const MXFPixelLayout ff_mxf_pixel_layouts[]; - int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum PixelFormat *pix_fmt); #define PRINT_KEY(pc, s, x) dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \ From 676f1f533e2c2960d81784188592a066b9ff1c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 02:29:40 +0100 Subject: [PATCH 117/528] Remove unused ff_ac3_parse_header_full function. Signed-off-by: Janne Grunau --- libavcodec/ac3_parser.c | 29 ----------------------------- libavcodec/ac3_parser.h | 11 ----------- 2 files changed, 40 deletions(-) diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index b844ec36c3..00aa372437 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -128,35 +128,6 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) return 0; } -int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr){ - int ret, i; - ret = ff_ac3_parse_header(gbc, hdr); - if(!ret){ - if(hdr->bitstream_id>10){ - /* Enhanced AC-3 */ - skip_bits(gbc, 5); // skip bitstream id - - /* skip dialog normalization and compression gain */ - for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) { - skip_bits(gbc, 5); // skip dialog normalization - if (get_bits1(gbc)) { - skip_bits(gbc, 8); //skip Compression gain word - } - } - /* dependent stream channel map */ - if (hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(gbc)) { - hdr->channel_map = get_bits(gbc, 16); //custom channel map - return 0; - } - } - //default channel map based on acmod and lfeon - hdr->channel_map = ff_eac3_default_chmap[hdr->channel_mode]; - if(hdr->lfe_on) - hdr->channel_map |= AC3_CHMAP_LFE; - } - return ret; -} - static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info, int *need_next_header, int *new_frame_start) { diff --git a/libavcodec/ac3_parser.h b/libavcodec/ac3_parser.h index 2f4a2eeea5..50b70b08e5 100644 --- a/libavcodec/ac3_parser.h +++ b/libavcodec/ac3_parser.h @@ -38,15 +38,4 @@ */ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr); -/** - * Parse AC-3 frame header and sets channel_map - * Parse the header up to the lfeon (channel_map in E-AC-3) - * element, which is the first 52, 54 or 104 bits depending - * on the audio coding mode. - * @param[in] gbc BitContext containing the first 54 bits of the frame. - * @param[out] hdr Pointer to struct where header info is written. - * @return value returned by ff_ac3_parse_header - */ -int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr); - #endif /* AVCODEC_AC3_PARSER_H */ From f2e246f576cd53e75b3696e1db418be98fbda76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 02:29:41 +0100 Subject: [PATCH 118/528] Make ff_png_pass_xmin and ff_png_pass_xshift static to png.c. Signed-off-by: Janne Grunau --- libavcodec/png.c | 4 ++-- libavcodec/png.h | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/libavcodec/png.c b/libavcodec/png.c index 534dc68bf1..d7898c0a41 100644 --- a/libavcodec/png.c +++ b/libavcodec/png.c @@ -31,12 +31,12 @@ const uint8_t ff_png_pass_ymask[NB_PASSES] = { }; /* minimum x value */ -const uint8_t ff_png_pass_xmin[NB_PASSES] = { +static const uint8_t ff_png_pass_xmin[NB_PASSES] = { 0, 4, 0, 2, 0, 1, 0 }; /* x shift to get row width */ -const uint8_t ff_png_pass_xshift[NB_PASSES] = { +static const uint8_t ff_png_pass_xshift[NB_PASSES] = { 3, 3, 2, 2, 1, 1, 0 }; diff --git a/libavcodec/png.h b/libavcodec/png.h index 7c0ab9f6c6..bab5224851 100644 --- a/libavcodec/png.h +++ b/libavcodec/png.h @@ -55,12 +55,6 @@ extern const uint8_t ff_mngsig[8]; /* Mask to determine which y pixels are valid in a pass */ extern const uint8_t ff_png_pass_ymask[NB_PASSES]; -/* minimum x value */ -extern const uint8_t ff_png_pass_xmin[NB_PASSES]; - -/* x shift to get row width */ -extern const uint8_t ff_png_pass_xshift[NB_PASSES]; - /* Mask to determine which pixels are valid in a pass */ extern const uint8_t ff_png_pass_mask[NB_PASSES]; From ebb06d96ed3f6e1c16f2d40e55c151b5b5522918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 02:59:28 +0100 Subject: [PATCH 119/528] Make ff_spatial_idwt_{init, slice} static to dwt.c Both functions seem to be commanded by the ff_spatial_idwt function instead. Signed-off-by: Janne Grunau --- libavcodec/dwt.c | 4 ++-- libavcodec/dwt.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/dwt.c b/libavcodec/dwt.c index 2ecb04a4ee..d9d58de8b2 100644 --- a/libavcodec/dwt.c +++ b/libavcodec/dwt.c @@ -697,7 +697,7 @@ void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffe } } -void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){ +static void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){ int level; for(level=decomposition_count-1; level>=0; level--){ switch(type){ @@ -707,7 +707,7 @@ void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int heigh } } -void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y){ +static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y){ const int support = type==1 ? 3 : 5; int level; if(type==2) return; diff --git a/libavcodec/dwt.h b/libavcodec/dwt.h index 8c3aa204d6..b10e4f5596 100644 --- a/libavcodec/dwt.h +++ b/libavcodec/dwt.h @@ -146,8 +146,6 @@ void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type, in void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count); void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y); -void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count); -void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y); void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count); void ff_dwt_init(DWTContext *c); From d625a32d6ba0405e6da061991dfd90f6da2a3b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 02:59:29 +0100 Subject: [PATCH 120/528] Make ff_sin_tabs constant to rdft.c Signed-off-by: Janne Grunau --- libavcodec/rdft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rdft.c b/libavcodec/rdft.c index f37263b7c2..59b4624716 100644 --- a/libavcodec/rdft.c +++ b/libavcodec/rdft.c @@ -44,7 +44,7 @@ SINTABLE(16384); SINTABLE(32768); SINTABLE(65536); #endif -SINTABLE_CONST FFTSample * const ff_sin_tabs[] = { +static SINTABLE_CONST FFTSample * const ff_sin_tabs[] = { NULL, NULL, NULL, NULL, ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024, ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536, From cf1d794a490444e710dc16606fa57c0db96d5f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 02:59:31 +0100 Subject: [PATCH 121/528] Make ff_ass_subtitle_header static to ass.c Signed-off-by: Janne Grunau --- libavcodec/ass.c | 25 ++++++++++++++++++++----- libavcodec/ass.h | 21 --------------------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/libavcodec/ass.c b/libavcodec/ass.c index 7553bf0778..0662b8dfdf 100644 --- a/libavcodec/ass.c +++ b/libavcodec/ass.c @@ -22,11 +22,26 @@ #include "avcodec.h" #include "ass.h" -int ff_ass_subtitle_header(AVCodecContext *avctx, - const char *font, int font_size, - int color, int back_color, - int bold, int italic, int underline, - int alignment) +/** + * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS. + * + * @param avctx pointer to the AVCodecContext + * @param font name of the default font face to use + * @param font_size default font size to use + * @param color default text color to use (ABGR) + * @param back_color default background color to use (ABGR) + * @param bold 1 for bold text, 0 for normal text + * @param italic 1 for italic text, 0 for normal text + * @param underline 1 for underline text, 0 for normal text + * @param alignment position of the text (left, center, top...), defined after + * the layout of the numpad (1-3 sub, 4-6 mid, 7-9 top) + * @return >= 0 on success otherwise an error code <0 + */ +static int ff_ass_subtitle_header(AVCodecContext *avctx, + const char *font, int font_size, + int color, int back_color, + int bold, int italic, int underline, + int alignment) { char header[512]; diff --git a/libavcodec/ass.h b/libavcodec/ass.h index e04b4cc747..f29a7c4697 100644 --- a/libavcodec/ass.h +++ b/libavcodec/ass.h @@ -39,27 +39,6 @@ #define ASS_DEFAULT_ALIGNMENT 2 /** @} */ -/** - * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS. - * - * @param avctx pointer to the AVCodecContext - * @param font name of the default font face to use - * @param font_size default font size to use - * @param color default text color to use (ABGR) - * @param back_color default background color to use (ABGR) - * @param bold 1 for bold text, 0 for normal text - * @param italic 1 for italic text, 0 for normal text - * @param underline 1 for underline text, 0 for normal text - * @param alignment position of the text (left, center, top...), defined after - * the layout of the numpad (1-3 sub, 4-6 mid, 7-9 top) - * @return >= 0 on success otherwise an error code <0 - */ -int ff_ass_subtitle_header(AVCodecContext *avctx, - const char *font, int font_size, - int color, int back_color, - int bold, int italic, int underline, - int alignment); - /** * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS * with default style. From 13eb6b90977768116c937c5d6b2e074679a3ad21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 00:59:30 +0000 Subject: [PATCH 122/528] Make ff_h264_find_frame_end static to h264.c; delete h264_parser.h The header is empty after making the function static, so delete it and drop its usage. Signed-off-by: Janne Grunau --- libavcodec/h264.c | 1 - libavcodec/h264_parser.c | 3 +-- libavcodec/h264_parser.h | 39 --------------------------------------- 3 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 libavcodec/h264_parser.h diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 25417f7c4a..be46315b5e 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -33,7 +33,6 @@ #include "h264.h" #include "h264data.h" #include "h264_mvpred.h" -#include "h264_parser.h" #include "golomb.h" #include "mathops.h" #include "rectangle.h" diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 70d08f4254..89523b5ca2 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -26,14 +26,13 @@ */ #include "parser.h" -#include "h264_parser.h" #include "h264data.h" #include "golomb.h" #include -int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size) +static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size) { int i; uint32_t state; diff --git a/libavcodec/h264_parser.h b/libavcodec/h264_parser.h deleted file mode 100644 index 149f49a386..0000000000 --- a/libavcodec/h264_parser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * H.26L/H.264/AVC/JVT/14496-10/... parser - * Copyright (c) 2003 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 - * H.264 / AVC / MPEG4 part10 parser. - * @author Michael Niedermayer - */ - -#ifndef AVCODEC_H264_PARSER_H -#define AVCODEC_H264_PARSER_H - -#include "h264.h" - -/** - * finds the end of the current frame in the bitstream. - * @return the position of the first byte of the next frame, or -1 - */ -int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size); - -#endif /* AVCODEC_H264_PARSER_H */ From 57c4d01ec9286b3b9f9a0101654f7bc8a00edb63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 00:29:38 +0000 Subject: [PATCH 123/528] Make ff_rtsp_send_cmd_with_content_async static to rtsp.c. Signed-off-by: Janne Grunau --- libavformat/rtsp.c | 23 ++++++++++++++++++----- libavformat/rtsp.h | 18 ------------------ 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index ca9ce7cf21..8ff4de7e1e 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -924,11 +924,24 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, return 0; } -int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s, - const char *method, const char *url, - const char *headers, - const unsigned char *send_content, - int send_content_length) +/** + * Send a command to the RTSP server without waiting for the reply. + * + * @param s RTSP (de)muxer context + * @param method the method for the request + * @param url the target url for the request + * @param headers extra header lines to include in the request + * @param send_content if non-null, the data to send as request body content + * @param send_content_length the length of the send_content data, or 0 if + * send_content is null + * + * @return zero if success, nonzero otherwise + */ +static int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s, + const char *method, const char *url, + const char *headers, + const unsigned char *send_content, + int send_content_length) { RTSPState *rt = s->priv_data; char buf[4096], *out_buf; diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 62bd3a2ecc..f0ead10da5 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -371,24 +371,6 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf, extern int rtsp_rtp_port_min; extern int rtsp_rtp_port_max; -/** - * Send a command to the RTSP server without waiting for the reply. - * - * @param s RTSP (de)muxer context - * @param method the method for the request - * @param url the target url for the request - * @param headers extra header lines to include in the request - * @param send_content if non-null, the data to send as request body content - * @param send_content_length the length of the send_content data, or 0 if - * send_content is null - * - * @return zero if success, nonzero otherwise - */ -int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s, - const char *method, const char *url, - const char *headers, - const unsigned char *send_content, - int send_content_length); /** * Send a command to the RTSP server without waiting for the reply. * From 1a8867486215abe3b705f7d189723d528cea2b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 02:59:35 +0100 Subject: [PATCH 124/528] Make ff_add_wav static to ra144.c Signed-off-by: Janne Grunau --- libavcodec/ra144.c | 4 ++-- libavcodec/ra144.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c index 35b7921ec4..9baa06850f 100644 --- a/libavcodec/ra144.c +++ b/libavcodec/ra144.c @@ -1503,8 +1503,8 @@ const int16_t * const ff_lpc_refl_cb[10]={ lpc_refl_cb6, lpc_refl_cb7, lpc_refl_cb8, lpc_refl_cb9, lpc_refl_cb10 }; -void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1, - const int8_t *s2, const int8_t *s3) +static void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1, + const int8_t *s2, const int8_t *s3) { int i; int v[3]; diff --git a/libavcodec/ra144.h b/libavcodec/ra144.h index 11c66a46e0..722b42e68a 100644 --- a/libavcodec/ra144.h +++ b/libavcodec/ra144.h @@ -56,8 +56,6 @@ typedef struct { uint16_t adapt_cb[146+2]; } RA144Context; -void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1, - const int8_t *s2, const int8_t *s3); void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset); int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx); void ff_eval_coefs(int *coefs, const int *refl); From 535638b55f83ad47e4680883e87b97e69d0847e5 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Tue, 25 Jan 2011 11:20:03 +0000 Subject: [PATCH 125/528] mpegtsenc: set reserved bits to 1 in PCR field The reserved bits between PCR base and extension fields must be set to 1. Signed-off-by: Mans Rullgard --- libavformat/mpegtsenc.c | 2 +- tests/ref/lavf/ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index f621646c52..147faaed0d 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -573,7 +573,7 @@ static uint8_t* write_pcr_bits(uint8_t *buf, int64_t pcr) *buf++ = pcr_high >> 17; *buf++ = pcr_high >> 9; *buf++ = pcr_high >> 1; - *buf++ = ((pcr_high & 1) << 7) | (pcr_low >> 8); + *buf++ = pcr_high << 7 | pcr_low >> 8 | 0x7e; *buf++ = pcr_low; return buf; diff --git a/tests/ref/lavf/ts b/tests/ref/lavf/ts index 5b046fb23d..e054141664 100644 --- a/tests/ref/lavf/ts +++ b/tests/ref/lavf/ts @@ -1,3 +1,3 @@ -e0c183639709d6e75bc553a3ed1333dd *./tests/data/lavf/lavf.ts +90e770ba5ec0506bd66cd44511e173a3 *./tests/data/lavf/lavf.ts 406644 ./tests/data/lavf/lavf.ts ./tests/data/lavf/lavf.ts CRC=0x133216c1 From b09f5482854f9b4a139b1401d196b26db11dd10f Mon Sep 17 00:00:00 2001 From: Marco Gittler Date: Tue, 25 Jan 2011 18:07:34 -0800 Subject: [PATCH 126/528] Pass field order flag to libx264 Signed-off-by: Jason Garrett-Glaser --- libavcodec/libx264.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 0dad5cd567..85ef38c6b0 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -105,6 +105,10 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf, frame->pict_type == FF_P_TYPE ? X264_TYPE_P : frame->pict_type == FF_B_TYPE ? X264_TYPE_B : X264_TYPE_AUTO; + if (x4->params.b_tff != frame->top_field_first) { + x4->params.b_tff = frame->top_field_first; + x264_encoder_reconfig(x4->enc, &x4->params); + } } do { From 7767d8d361ca104d74c8390b72db21aa4d7fc322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 00:29:43 +0000 Subject: [PATCH 127/528] Mark C base versions of FFT functions static to fft.c Signed-off-by: Mans Rullgard --- libavcodec/fft.c | 7 +++++-- libavcodec/fft.h | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/fft.c b/libavcodec/fft.c index 81765510e3..3fd4d279cb 100644 --- a/libavcodec/fft.c +++ b/libavcodec/fft.c @@ -53,6 +53,9 @@ COSTABLE_CONST FFTSample * const ff_cos_tabs[] = { ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536, }; +static void ff_fft_permute_c(FFTContext *s, FFTComplex *z); +static void ff_fft_calc_c(FFTContext *s, FFTComplex *z); + static int split_radix_permutation(int i, int n, int inverse) { int m; @@ -120,7 +123,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) return -1; } -void ff_fft_permute_c(FFTContext *s, FFTComplex *z) +static void ff_fft_permute_c(FFTContext *s, FFTComplex *z) { int j, np; const uint16_t *revtab = s->revtab; @@ -289,7 +292,7 @@ static void (* const fft_dispatch[])(FFTComplex*) = { fft2048, fft4096, fft8192, fft16384, fft32768, fft65536, }; -void ff_fft_calc_c(FFTContext *s, FFTComplex *z) +static void ff_fft_calc_c(FFTContext *s, FFTComplex *z) { fft_dispatch[s->nbits-2](z); } diff --git a/libavcodec/fft.h b/libavcodec/fft.h index eb6714fe95..37cbfbf6a1 100644 --- a/libavcodec/fft.h +++ b/libavcodec/fft.h @@ -106,8 +106,6 @@ extern SINTABLE(65536); * @param inverse if 0 perform the forward transform, if 1 perform the inverse */ int ff_fft_init(FFTContext *s, int nbits, int inverse); -void ff_fft_permute_c(FFTContext *s, FFTComplex *z); -void ff_fft_calc_c(FFTContext *s, FFTComplex *z); void ff_fft_init_altivec(FFTContext *s); void ff_fft_init_mmx(FFTContext *s); From eb7ccf8f3369f9e15029ce65370a114206b39fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 00:29:34 +0000 Subject: [PATCH 128/528] Make the avfilter debug functions and macros static to avfilter.c This removes ff_get_ref_perms_string, ff_dprintf_ref and ff_dprintf_link fro the interface of libavfilter. Signed-off-by: Mans Rullgard --- libavfilter/avfilter.c | 8 +++++--- libavfilter/internal.h | 8 -------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 456ac9ccf1..3d8d08ac37 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -205,7 +205,7 @@ int avfilter_config_links(AVFilterContext *filter) return 0; } -char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) +static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) { snprintf(buf, buf_size, "%s%s%s%s%s%s", perms & AV_PERM_READ ? "r" : "", @@ -217,7 +217,7 @@ char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) return buf; } -void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) +static void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) { av_unused char buf[16]; dprintf(ctx, @@ -245,7 +245,7 @@ void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) dprintf(ctx, "]%s", end ? "\n" : ""); } -void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) +static void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) { if (link->type == AVMEDIA_TYPE_VIDEO) { dprintf(ctx, @@ -269,6 +269,8 @@ void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) } } +#define FF_DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func) + AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBufferRef *ret = NULL; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 8f352ef775..188da87099 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -27,14 +27,6 @@ #include "avfilter.h" #include "avfiltergraph.h" -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); - -#define FF_DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func) - /** * Check for the validity of graph. * From 24e3ad3031fa26e12d4b939f0ff0dd6e12f05ef5 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 25 Jan 2011 20:07:06 +0000 Subject: [PATCH 129/528] ac3: Remove ff_ac3_critical_band_size_tab. It is only used to generate band_start_tab, which about the same size, at runtime, so it's simpler just to always hardcode band_start_tab. Signed-off-by: Mans Rullgard --- libavcodec/ac3.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index a8b4e0b268..8fa60e67d5 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -28,8 +28,6 @@ #include "ac3.h" #include "get_bits.h" -#if CONFIG_HARDCODED_TABLES - /** * Starting frequency coefficient bin for each critical band. */ @@ -41,6 +39,8 @@ static const uint8_t band_start_tab[AC3_CRITICAL_BANDS+1] = { 79, 85, 97, 109, 121, 133, 157, 181, 205, 229, 253 }; +#if CONFIG_HARDCODED_TABLES + /** * Map each frequency coefficient bin to the critical band that contains it. */ @@ -70,13 +70,6 @@ static const uint8_t bin_to_band_tab[253] = { }; #else /* CONFIG_HARDCODED_TABLES */ -static const uint8_t ff_ac3_critical_band_size_tab[AC3_CRITICAL_BANDS]={ - 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, 3, 3, 3, 3, 3, 3, - 3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24 -}; - -static uint8_t band_start_tab[51]; static uint8_t bin_to_band_tab[253]; #endif @@ -251,14 +244,12 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, av_cold void ac3_common_init(void) { #if !CONFIG_HARDCODED_TABLES - /* compute bndtab and masktab from bandsz */ + /* compute bin_to_band_tab from band_start_tab */ int bin = 0, band; for (band = 0; band < AC3_CRITICAL_BANDS; band++) { - int band_end = bin + ff_ac3_critical_band_size_tab[band]; - band_start_tab[band] = bin; + int band_end = band_start_tab[band+1]; while (bin < band_end) bin_to_band_tab[bin++] = band; } - band_start_tab[AC3_CRITICAL_BANDS] = bin; #endif /* !CONFIG_HARDCODED_TABLES */ } From 4c57cde942b3d28074d0bb06e2ca200bc1098f22 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 25 Jan 2011 20:07:07 +0000 Subject: [PATCH 130/528] Add ff_ prefix to ac3_common_init(). Signed-off-by: Mans Rullgard --- libavcodec/ac3.c | 2 +- libavcodec/ac3.h | 2 +- libavcodec/ac3dec.c | 2 +- libavcodec/ac3enc.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index 8fa60e67d5..23eee52661 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -241,7 +241,7 @@ void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, * note: This function must remain thread safe because it is called by the * AVParser init code. */ -av_cold void ac3_common_init(void) +av_cold void ff_ac3_common_init(void) { #if !CONFIG_HARDCODED_TABLES /* compute bin_to_band_tab from band_start_tab */ diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h index 283b134329..405e3cd0a3 100644 --- a/libavcodec/ac3.h +++ b/libavcodec/ac3.h @@ -115,7 +115,7 @@ typedef enum { EAC3_FRAME_TYPE_RESERVED } EAC3FrameType; -void ac3_common_init(void); +void ff_ac3_common_init(void); /** * Calculate the log power-spectral density of the input signal. diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 32172dc906..33c5f742e5 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -187,7 +187,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) AC3DecodeContext *s = avctx->priv_data; s->avctx = avctx; - ac3_common_init(); + ff_ac3_common_init(); ac3_tables_init(); ff_mdct_init(&s->imdct_256, 8, 1, 1.0); ff_mdct_init(&s->imdct_512, 9, 1, 1.0); diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index f058d79882..ed7a171ac7 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1815,7 +1815,7 @@ static av_cold int ac3_encode_init(AVCodecContext *avctx) avctx->frame_size = AC3_FRAME_SIZE; - ac3_common_init(); + ff_ac3_common_init(); ret = validate_options(avctx, s); if (ret) From 2d162e3825a35b6ac42a27d27c4a3ebbd141828d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 00:29:44 +0000 Subject: [PATCH 131/528] Make ff_cmap_read_palette static to libavcodec/iff.c. Delete iff.h. The iff.h header only declared one function that is now static, the libavformat/iff.c source file wasn't using it before. Drop the file entirely. Signed-off-by: Mans Rullgard --- libavcodec/iff.c | 3 +-- libavcodec/iff.h | 30 ------------------------------ libavformat/iff.c | 1 - 3 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 libavcodec/iff.h diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 19f4172154..aeff0b5ba5 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -29,7 +29,6 @@ #include "bytestream.h" #include "avcodec.h" #include "get_bits.h" -#include "iff.h" typedef struct { AVFrame frame; @@ -120,7 +119,7 @@ static av_always_inline uint32_t gray2rgb(const uint32_t x) { /** * Convert CMAP buffer (stored in extradata) to lavc palette format */ -int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal) +static int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal) { int count, i; diff --git a/libavcodec/iff.h b/libavcodec/iff.h deleted file mode 100644 index 76db10b884..0000000000 --- a/libavcodec/iff.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * IFF PBM/ILBM bitmap decoder - * Copyright (c) 2010 Peter Ross - * - * 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_IFF_H -#define AVCODEC_IFF_H - -#include -#include "avcodec.h" - -int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal); - -#endif /* AVCODEC_IFF_H */ diff --git a/libavformat/iff.c b/libavformat/iff.c index e1afefbff3..e87195654f 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -30,7 +30,6 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcodec/iff.h" #include "avformat.h" #define ID_8SVX MKTAG('8','S','V','X') From d36beb3f6902b1217beda576aa18abf7eb72b03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 21:40:11 +0000 Subject: [PATCH 132/528] Add ff_ prefix to data symbols of encoders, decoders, hwaccel, parsers, bsf. None of these symbols should be accessed directly, so declare them as hidden. Signed-off-by: Mans Rullgard --- libavcodec/4xm.c | 2 +- libavcodec/8bps.c | 2 +- libavcodec/8svx.c | 4 ++-- libavcodec/a64multienc.c | 4 ++-- libavcodec/aac_adtstoasc_bsf.c | 2 +- libavcodec/aac_parser.c | 2 +- libavcodec/aacdec.c | 4 ++-- libavcodec/aacenc.c | 2 +- libavcodec/aasc.c | 2 +- libavcodec/ac3_parser.c | 2 +- libavcodec/ac3dec.c | 4 ++-- libavcodec/ac3enc_fixed.c | 2 +- libavcodec/ac3enc_float.c | 2 +- libavcodec/adpcm.c | 4 ++-- libavcodec/adxdec.c | 2 +- libavcodec/adxenc.c | 2 +- libavcodec/alac.c | 2 +- libavcodec/alacenc.c | 2 +- libavcodec/allcodecs.c | 20 ++++++++++---------- libavcodec/alsdec.c | 2 +- libavcodec/amrnbdec.c | 2 +- libavcodec/amrwbdec.c | 2 +- libavcodec/anm.c | 2 +- libavcodec/ansi.c | 2 +- libavcodec/apedec.c | 2 +- libavcodec/assdec.c | 2 +- libavcodec/assenc.c | 2 +- libavcodec/asv1.c | 8 ++++---- libavcodec/atrac1.c | 2 +- libavcodec/atrac3.c | 2 +- libavcodec/aura.c | 2 +- libavcodec/avs.c | 2 +- libavcodec/bethsoftvideo.c | 2 +- libavcodec/bfi.c | 2 +- libavcodec/bink.c | 2 +- libavcodec/binkaudio.c | 4 ++-- libavcodec/bmp.c | 2 +- libavcodec/bmpenc.c | 2 +- libavcodec/c93.c | 2 +- libavcodec/cavs_parser.c | 2 +- libavcodec/cavsdec.c | 2 +- libavcodec/cdgraphics.c | 2 +- libavcodec/chomp_bsf.c | 2 +- libavcodec/cinepak.c | 2 +- libavcodec/cljr.c | 4 ++-- libavcodec/cook.c | 2 +- libavcodec/cscd.c | 2 +- libavcodec/cyuv.c | 4 ++-- libavcodec/dca.c | 2 +- libavcodec/dca_parser.c | 2 +- libavcodec/dirac_parser.c | 2 +- libavcodec/dnxhd_parser.c | 2 +- libavcodec/dnxhddec.c | 2 +- libavcodec/dnxhdenc.c | 2 +- libavcodec/dpcm.c | 2 +- libavcodec/dpx.c | 2 +- libavcodec/dsicinav.c | 4 ++-- libavcodec/dump_extradata_bsf.c | 2 +- libavcodec/dv.c | 4 ++-- libavcodec/dvbsub.c | 2 +- libavcodec/dvbsub_parser.c | 2 +- libavcodec/dvbsubdec.c | 2 +- libavcodec/dvdsub_parser.c | 2 +- libavcodec/dvdsubdec.c | 2 +- libavcodec/dvdsubenc.c | 2 +- libavcodec/dxa.c | 2 +- libavcodec/eacmv.c | 2 +- libavcodec/eamad.c | 2 +- libavcodec/eatgq.c | 2 +- libavcodec/eatgv.c | 2 +- libavcodec/eatqi.c | 2 +- libavcodec/escape124.c | 2 +- libavcodec/ffv1.c | 4 ++-- libavcodec/flac_parser.c | 2 +- libavcodec/flacdec.c | 2 +- libavcodec/flacenc.c | 2 +- libavcodec/flashsv.c | 2 +- libavcodec/flashsvenc.c | 2 +- libavcodec/flicvideo.c | 2 +- libavcodec/flvdec.c | 2 +- libavcodec/flvenc.c | 2 +- libavcodec/fraps.c | 2 +- libavcodec/frwu.c | 2 +- libavcodec/g722.c | 4 ++-- libavcodec/g726.c | 4 ++-- libavcodec/g729dec.c | 2 +- libavcodec/gif.c | 2 +- libavcodec/gifdec.c | 2 +- libavcodec/gsmdec.c | 4 ++-- libavcodec/h261_parser.c | 2 +- libavcodec/h261dec.c | 2 +- libavcodec/h261enc.c | 2 +- libavcodec/h263_parser.c | 2 +- libavcodec/h263dec.c | 2 +- libavcodec/h264.c | 4 ++-- libavcodec/h264_mp4toannexb_bsf.c | 2 +- libavcodec/h264_parser.c | 2 +- libavcodec/huffyuv.c | 8 ++++---- libavcodec/idcinvideo.c | 2 +- libavcodec/iff.c | 4 ++-- libavcodec/imc.c | 2 +- libavcodec/imx_dump_header_bsf.c | 2 +- libavcodec/indeo2.c | 2 +- libavcodec/indeo3.c | 2 +- libavcodec/indeo5.c | 2 +- libavcodec/intelh263dec.c | 2 +- libavcodec/interplayvideo.c | 2 +- libavcodec/jpeglsdec.c | 2 +- libavcodec/jpeglsenc.c | 2 +- libavcodec/kgv1dec.c | 2 +- libavcodec/kmvc.c | 2 +- libavcodec/lagarith.c | 2 +- libavcodec/latm_parser.c | 2 +- libavcodec/lcldec.c | 4 ++-- libavcodec/lclenc.c | 2 +- libavcodec/libdiracdec.c | 2 +- libavcodec/libdiracenc.c | 2 +- libavcodec/libfaac.c | 2 +- libavcodec/libgsm.c | 8 ++++---- libavcodec/libmp3lame.c | 2 +- libavcodec/libopencore-amr.c | 6 +++--- libavcodec/libopenjpeg.c | 2 +- libavcodec/libschroedingerdec.c | 2 +- libavcodec/libschroedingerenc.c | 2 +- libavcodec/libspeexdec.c | 2 +- libavcodec/libtheoraenc.c | 2 +- libavcodec/libvorbis.c | 2 +- libavcodec/libvpxdec.c | 2 +- libavcodec/libvpxenc.c | 2 +- libavcodec/libx264.c | 2 +- libavcodec/libxavs.c | 2 +- libavcodec/libxvidff.c | 2 +- libavcodec/ljpegenc.c | 2 +- libavcodec/loco.c | 2 +- libavcodec/mace.c | 4 ++-- libavcodec/mdec.c | 2 +- libavcodec/mimic.c | 2 +- libavcodec/mjpeg2jpeg_bsf.c | 2 +- libavcodec/mjpeg_parser.c | 2 +- libavcodec/mjpega_dump_header_bsf.c | 2 +- libavcodec/mjpegbdec.c | 2 +- libavcodec/mjpegdec.c | 4 ++-- libavcodec/mjpegenc.c | 2 +- libavcodec/mlp_parser.c | 2 +- libavcodec/mlpdec.c | 4 ++-- libavcodec/mmvideo.c | 2 +- libavcodec/motionpixels.c | 2 +- libavcodec/movsub_bsf.c | 4 ++-- libavcodec/mp3_header_compress_bsf.c | 2 +- libavcodec/mp3_header_decompress_bsf.c | 2 +- libavcodec/mpc7.c | 2 +- libavcodec/mpc8.c | 2 +- libavcodec/mpeg12.c | 12 ++++++------ libavcodec/mpeg12enc.c | 4 ++-- libavcodec/mpeg4video_parser.c | 2 +- libavcodec/mpeg4videodec.c | 4 ++-- libavcodec/mpeg4videoenc.c | 2 +- libavcodec/mpegaudio_parser.c | 2 +- libavcodec/mpegaudiodec.c | 10 +++++----- libavcodec/mpegaudiodec_float.c | 10 +++++----- libavcodec/mpegaudioenc.c | 2 +- libavcodec/mpegvideo_enc.c | 12 ++++++------ libavcodec/mpegvideo_parser.c | 2 +- libavcodec/msmpeg4.c | 8 ++++---- libavcodec/msrle.c | 2 +- libavcodec/msvideo1.c | 2 +- libavcodec/nellymoserdec.c | 2 +- libavcodec/nellymoserenc.c | 2 +- libavcodec/noise_bsf.c | 2 +- libavcodec/nuv.c | 2 +- libavcodec/pamenc.c | 2 +- libavcodec/pcm-mpeg.c | 2 +- libavcodec/pcm.c | 4 ++-- libavcodec/pcx.c | 2 +- libavcodec/pcxenc.c | 2 +- libavcodec/pgssubdec.c | 2 +- libavcodec/pictordec.c | 2 +- libavcodec/pngdec.c | 2 +- libavcodec/pngenc.c | 2 +- libavcodec/pnm_parser.c | 2 +- libavcodec/pnmdec.c | 10 +++++----- libavcodec/pnmenc.c | 8 ++++---- libavcodec/ptx.c | 2 +- libavcodec/qcelpdec.c | 2 +- libavcodec/qdm2.c | 2 +- libavcodec/qdrw.c | 2 +- libavcodec/qpeg.c | 2 +- libavcodec/qtrle.c | 2 +- libavcodec/qtrleenc.c | 2 +- libavcodec/r210dec.c | 4 ++-- libavcodec/ra144dec.c | 2 +- libavcodec/ra144enc.c | 2 +- libavcodec/ra288.c | 2 +- libavcodec/rawdec.c | 2 +- libavcodec/rawenc.c | 2 +- libavcodec/remove_extradata_bsf.c | 2 +- libavcodec/rl2.c | 2 +- libavcodec/roqaudioenc.c | 2 +- libavcodec/roqvideodec.c | 2 +- libavcodec/roqvideoenc.c | 2 +- libavcodec/rpza.c | 2 +- libavcodec/rv10.c | 4 ++-- libavcodec/rv10enc.c | 2 +- libavcodec/rv20enc.c | 2 +- libavcodec/rv30.c | 2 +- libavcodec/rv40.c | 2 +- libavcodec/sgidec.c | 2 +- libavcodec/sgienc.c | 2 +- libavcodec/shorten.c | 2 +- libavcodec/sipr.c | 2 +- libavcodec/smacker.c | 4 ++-- libavcodec/smc.c | 2 +- libavcodec/snow.c | 4 ++-- libavcodec/sonic.c | 6 +++--- libavcodec/sp5xdec.c | 4 ++-- libavcodec/srtdec.c | 2 +- libavcodec/sunrast.c | 2 +- libavcodec/svq1dec.c | 2 +- libavcodec/svq1enc.c | 2 +- libavcodec/svq3.c | 2 +- libavcodec/targa.c | 2 +- libavcodec/targaenc.c | 2 +- libavcodec/tiertexseqv.c | 2 +- libavcodec/tiff.c | 2 +- libavcodec/tiffenc.c | 2 +- libavcodec/tmv.c | 2 +- libavcodec/truemotion1.c | 2 +- libavcodec/truemotion2.c | 2 +- libavcodec/truespeech.c | 2 +- libavcodec/tscc.c | 2 +- libavcodec/tta.c | 2 +- libavcodec/twinvq.c | 2 +- libavcodec/txd.c | 2 +- libavcodec/ulti.c | 2 +- libavcodec/v210dec.c | 2 +- libavcodec/v210enc.c | 2 +- libavcodec/v210x.c | 2 +- libavcodec/vb.c | 2 +- libavcodec/vc1_parser.c | 2 +- libavcodec/vc1dec.c | 8 ++++---- libavcodec/vcr1.c | 4 ++-- libavcodec/vmdav.c | 4 ++-- libavcodec/vmnc.c | 2 +- libavcodec/vorbis_dec.c | 2 +- libavcodec/vorbis_enc.c | 2 +- libavcodec/vp3.c | 4 ++-- libavcodec/vp3_parser.c | 2 +- libavcodec/vp5.c | 2 +- libavcodec/vp6.c | 6 +++--- libavcodec/vp8.c | 2 +- libavcodec/vp8_parser.c | 2 +- libavcodec/vqavideo.c | 2 +- libavcodec/wavpack.c | 2 +- libavcodec/wmadec.c | 4 ++-- libavcodec/wmaenc.c | 4 ++-- libavcodec/wmaprodec.c | 2 +- libavcodec/wmavoice.c | 2 +- libavcodec/wmv2dec.c | 2 +- libavcodec/wmv2enc.c | 2 +- libavcodec/wnv1.c | 2 +- libavcodec/ws-snd1.c | 2 +- libavcodec/xan.c | 4 ++-- libavcodec/xl.c | 2 +- libavcodec/xsubdec.c | 2 +- libavcodec/xsubenc.c | 2 +- libavcodec/yop.c | 2 +- libavcodec/zmbv.c | 2 +- libavcodec/zmbvenc.c | 2 +- 268 files changed, 358 insertions(+), 358 deletions(-) diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 30c4c5919f..97436ce187 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -865,7 +865,7 @@ static av_cold int decode_end(AVCodecContext *avctx){ return 0; } -AVCodec fourxm_decoder = { +AVCodec ff_fourxm_decoder = { "4xm", AVMEDIA_TYPE_VIDEO, CODEC_ID_4XM, diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index 292c739c11..4757057876 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -219,7 +219,7 @@ static av_cold int decode_end(AVCodecContext *avctx) -AVCodec eightbps_decoder = { +AVCodec ff_eightbps_decoder = { "8bps", AVMEDIA_TYPE_VIDEO, CODEC_ID_8BPS, diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index 66820be1ad..3f7d3efc76 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -92,7 +92,7 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx) return 0; } -AVCodec eightsvx_fib_decoder = { +AVCodec ff_eightsvx_fib_decoder = { .name = "8svx_fib", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_8SVX_FIB, @@ -102,7 +102,7 @@ AVCodec eightsvx_fib_decoder = { .long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"), }; -AVCodec eightsvx_exp_decoder = { +AVCodec ff_eightsvx_exp_decoder = { .name = "8svx_exp", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_8SVX_EXP, diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c index fa1209e5c5..aed28ad280 100644 --- a/libavcodec/a64multienc.c +++ b/libavcodec/a64multienc.c @@ -362,7 +362,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf, return 0; } -AVCodec a64multi_encoder = { +AVCodec ff_a64multi_encoder = { .name = "a64multi", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_A64_MULTI, @@ -375,7 +375,7 @@ AVCodec a64multi_encoder = { .capabilities = CODEC_CAP_DELAY, }; -AVCodec a64multi5_encoder = { +AVCodec ff_a64multi5_encoder = { .name = "a64multi5", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_A64_MULTI5, diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c index 9b615e65d3..6558c0280f 100644 --- a/libavcodec/aac_adtstoasc_bsf.c +++ b/libavcodec/aac_adtstoasc_bsf.c @@ -107,7 +107,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, return 0; } -AVBitStreamFilter aac_adtstoasc_bsf = { +AVBitStreamFilter ff_aac_adtstoasc_bsf = { "aac_adtstoasc", sizeof(AACBSFContext), aac_adtstoasc_filter, diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c index 3ad4610e95..9165178d15 100644 --- a/libavcodec/aac_parser.c +++ b/libavcodec/aac_parser.c @@ -60,7 +60,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1) } -AVCodecParser aac_parser = { +AVCodecParser ff_aac_parser = { { CODEC_ID_AAC }, sizeof(AACAC3ParseContext), aac_parse_init, diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index e6d32f4a73..fd65b1c3ba 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -2351,7 +2351,7 @@ av_cold static int latm_decode_init(AVCodecContext *avctx) } -AVCodec aac_decoder = { +AVCodec ff_aac_decoder = { "aac", AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC, @@ -2372,7 +2372,7 @@ AVCodec aac_decoder = { 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 = { +AVCodec ff_aac_latm_decoder = { .name = "aac_latm", .type = CODEC_TYPE_AUDIO, .id = CODEC_ID_AAC_LATM, diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 120f873342..50dab1cffd 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -641,7 +641,7 @@ static av_cold int aac_encode_end(AVCodecContext *avctx) return 0; } -AVCodec aac_encoder = { +AVCodec ff_aac_encoder = { "aac", AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC, diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c index 82bd2bfd3d..44bdcb0b63 100644 --- a/libavcodec/aasc.c +++ b/libavcodec/aasc.c @@ -109,7 +109,7 @@ static av_cold int aasc_decode_end(AVCodecContext *avctx) return 0; } -AVCodec aasc_decoder = { +AVCodec ff_aasc_decoder = { "aasc", AVMEDIA_TYPE_VIDEO, CODEC_ID_AASC, diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index 00aa372437..4737d6f868 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -169,7 +169,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1) } -AVCodecParser ac3_parser = { +AVCodecParser ff_ac3_parser = { { CODEC_ID_AC3, CODEC_ID_EAC3 }, sizeof(AACAC3ParseContext), ac3_parse_init, diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 33c5f742e5..a1e731dcf9 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1437,7 +1437,7 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx) return 0; } -AVCodec ac3_decoder = { +AVCodec ff_ac3_decoder = { .name = "ac3", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_AC3, @@ -1449,7 +1449,7 @@ AVCodec ac3_decoder = { }; #if CONFIG_EAC3_DECODER -AVCodec eac3_decoder = { +AVCodec ff_eac3_decoder = { .name = "eac3", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_EAC3, diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index dfd218ec72..90e148b949 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -425,7 +425,7 @@ int main(void) #endif /* TEST */ -AVCodec ac3_fixed_encoder = { +AVCodec ff_ac3_fixed_encoder = { "ac3_fixed", AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3, diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c index 33e8294fbf..8668b2e033 100644 --- a/libavcodec/ac3enc_float.c +++ b/libavcodec/ac3enc_float.c @@ -109,7 +109,7 @@ static void scale_coefficients(AC3EncodeContext *s) } -AVCodec ac3_encoder = { +AVCodec ff_ac3_encoder = { "ac3", AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3, diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index ee2ce54ff1..fb5bdc7faa 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1708,7 +1708,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, #if CONFIG_ENCODERS #define ADPCM_ENCODER(id,name,long_name_) \ -AVCodec name ## _encoder = { \ +AVCodec ff_ ## name ## _encoder = { \ #name, \ AVMEDIA_TYPE_AUDIO, \ id, \ @@ -1726,7 +1726,7 @@ AVCodec name ## _encoder = { \ #if CONFIG_DECODERS #define ADPCM_DECODER(id,name,long_name_) \ -AVCodec name ## _decoder = { \ +AVCodec ff_ ## name ## _decoder = { \ #name, \ AVMEDIA_TYPE_AUDIO, \ id, \ diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c index 030f2d781a..991528a7d2 100644 --- a/libavcodec/adxdec.c +++ b/libavcodec/adxdec.c @@ -166,7 +166,7 @@ static int adx_decode_frame(AVCodecContext *avctx, return buf-buf0; } -AVCodec adpcm_adx_decoder = { +AVCodec ff_adpcm_adx_decoder = { "adpcm_adx", AVMEDIA_TYPE_AUDIO, CODEC_ID_ADPCM_ADX, diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c index 2200f5c6c8..ca48f94b71 100644 --- a/libavcodec/adxenc.c +++ b/libavcodec/adxenc.c @@ -183,7 +183,7 @@ static int adx_encode_frame(AVCodecContext *avctx, return dst-frame; } -AVCodec adpcm_adx_encoder = { +AVCodec ff_adpcm_adx_encoder = { "adpcm_adx", AVMEDIA_TYPE_AUDIO, CODEC_ID_ADPCM_ADX, diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 3a255781a2..96c15fffc9 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -691,7 +691,7 @@ static av_cold int alac_decode_close(AVCodecContext *avctx) return 0; } -AVCodec alac_decoder = { +AVCodec ff_alac_decoder = { "alac", AVMEDIA_TYPE_AUDIO, CODEC_ID_ALAC, diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index d9ff2b8e0a..9d2865d51e 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -523,7 +523,7 @@ static av_cold int alac_encode_close(AVCodecContext *avctx) return 0; } -AVCodec alac_encoder = { +AVCodec ff_alac_encoder = { "alac", AVMEDIA_TYPE_AUDIO, CODEC_ID_ALAC, diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 94da5c04c1..04c5c6aad4 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -27,23 +27,23 @@ #include "avcodec.h" #define REGISTER_HWACCEL(X,x) { \ - extern AVHWAccel x##_hwaccel; \ - if(CONFIG_##X##_HWACCEL) av_register_hwaccel(&x##_hwaccel); } + extern AVHWAccel ff_##x##_hwaccel; \ + if(CONFIG_##X##_HWACCEL) av_register_hwaccel(&ff_##x##_hwaccel); } #define REGISTER_ENCODER(X,x) { \ - extern AVCodec x##_encoder; \ - if(CONFIG_##X##_ENCODER) avcodec_register(&x##_encoder); } + extern AVCodec ff_##x##_encoder; \ + if(CONFIG_##X##_ENCODER) avcodec_register(&ff_##x##_encoder); } #define REGISTER_DECODER(X,x) { \ - extern AVCodec x##_decoder; \ - if(CONFIG_##X##_DECODER) avcodec_register(&x##_decoder); } + extern AVCodec ff_##x##_decoder; \ + if(CONFIG_##X##_DECODER) avcodec_register(&ff_##x##_decoder); } #define REGISTER_ENCDEC(X,x) REGISTER_ENCODER(X,x); REGISTER_DECODER(X,x) #define REGISTER_PARSER(X,x) { \ - extern AVCodecParser x##_parser; \ - if(CONFIG_##X##_PARSER) av_register_codec_parser(&x##_parser); } + extern AVCodecParser ff_##x##_parser; \ + if(CONFIG_##X##_PARSER) av_register_codec_parser(&ff_##x##_parser); } #define REGISTER_BSF(X,x) { \ - extern AVBitStreamFilter x##_bsf; \ - if(CONFIG_##X##_BSF) av_register_bitstream_filter(&x##_bsf); } + extern AVBitStreamFilter ff_##x##_bsf; \ + if(CONFIG_##X##_BSF) av_register_bitstream_filter(&ff_##x##_bsf); } void avcodec_register_all(void) { diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 116e5e2f82..3e415c0855 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1737,7 +1737,7 @@ static av_cold void flush(AVCodecContext *avctx) } -AVCodec als_decoder = { +AVCodec ff_als_decoder = { "als", AVMEDIA_TYPE_AUDIO, CODEC_ID_MP4ALS, diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index a7d9fc52c0..ec896c7dfb 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -1036,7 +1036,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, int *data_size, } -AVCodec amrnb_decoder = { +AVCodec ff_amrnb_decoder = { .name = "amrnb", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_AMR_NB, diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 941d065127..8bf02a2b10 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -1225,7 +1225,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size, return expected_fr_size; } -AVCodec amrwb_decoder = { +AVCodec ff_amrwb_decoder = { .name = "amrwb", .type = CODEC_TYPE_AUDIO, .id = CODEC_ID_AMR_WB, diff --git a/libavcodec/anm.c b/libavcodec/anm.c index f38486188c..5b2b9df8ea 100644 --- a/libavcodec/anm.c +++ b/libavcodec/anm.c @@ -183,7 +183,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec anm_decoder = { +AVCodec ff_anm_decoder = { "anm", AVMEDIA_TYPE_VIDEO, CODEC_ID_ANM, diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c index 8e7171c6c1..9d6dc9d3d2 100644 --- a/libavcodec/ansi.c +++ b/libavcodec/ansi.c @@ -422,7 +422,7 @@ static av_cold int decode_close(AVCodecContext *avctx) return 0; } -AVCodec ansi_decoder = { +AVCodec ff_ansi_decoder = { .name = "ansi", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_ANSI, diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 497595463b..b6d6f9d9cc 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -883,7 +883,7 @@ static void ape_flush(AVCodecContext *avctx) s->samples= 0; } -AVCodec ape_decoder = { +AVCodec ff_ape_decoder = { "ape", AVMEDIA_TYPE_AUDIO, CODEC_ID_APE, diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c index 0a7fd4821d..c1ad0c4af4 100644 --- a/libavcodec/assdec.c +++ b/libavcodec/assdec.c @@ -52,7 +52,7 @@ static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, return avpkt->size; } -AVCodec ass_decoder = { +AVCodec ff_ass_decoder = { .name = "ass", .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"), .type = AVMEDIA_TYPE_SUBTITLE, diff --git a/libavcodec/assenc.c b/libavcodec/assenc.c index c6f017ce5d..103f2ff276 100644 --- a/libavcodec/assenc.c +++ b/libavcodec/assenc.c @@ -57,7 +57,7 @@ static int ass_encode_frame(AVCodecContext *avctx, return total_len; } -AVCodec ass_encoder = { +AVCodec ff_ass_encoder = { .name = "ass", .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"), .type = AVMEDIA_TYPE_SUBTITLE, diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c index 6b1a0935ae..d2005fff60 100644 --- a/libavcodec/asv1.c +++ b/libavcodec/asv1.c @@ -613,7 +613,7 @@ static av_cold int decode_end(AVCodecContext *avctx){ return 0; } -AVCodec asv1_decoder = { +AVCodec ff_asv1_decoder = { "asv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_ASV1, @@ -626,7 +626,7 @@ AVCodec asv1_decoder = { .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"), }; -AVCodec asv2_decoder = { +AVCodec ff_asv2_decoder = { "asv2", AVMEDIA_TYPE_VIDEO, CODEC_ID_ASV2, @@ -640,7 +640,7 @@ AVCodec asv2_decoder = { }; #if CONFIG_ASV1_ENCODER -AVCodec asv1_encoder = { +AVCodec ff_asv1_encoder = { "asv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_ASV1, @@ -654,7 +654,7 @@ AVCodec asv1_encoder = { #endif #if CONFIG_ASV2_ENCODER -AVCodec asv2_encoder = { +AVCodec ff_asv2_encoder = { "asv2", AVMEDIA_TYPE_VIDEO, CODEC_ID_ASV2, diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index c4404f6817..4de1dcea04 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -365,7 +365,7 @@ static av_cold int atrac1_decode_end(AVCodecContext * avctx) { } -AVCodec atrac1_decoder = { +AVCodec ff_atrac1_decoder = { .name = "atrac1", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_ATRAC1, diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 214cec7faa..3d1f990164 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -1019,7 +1019,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) } -AVCodec atrac3_decoder = +AVCodec ff_atrac3_decoder = { .name = "atrac3", .type = AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/aura.c b/libavcodec/aura.c index 8942cdd576..9041c7cb68 100644 --- a/libavcodec/aura.c +++ b/libavcodec/aura.c @@ -122,7 +122,7 @@ static av_cold int aura_decode_end(AVCodecContext *avctx) return 0; } -AVCodec aura2_decoder = { +AVCodec ff_aura2_decoder = { "aura2", AVMEDIA_TYPE_VIDEO, CODEC_ID_AURA2, diff --git a/libavcodec/avs.c b/libavcodec/avs.c index f65a25a8e3..e1a66a9930 100644 --- a/libavcodec/avs.c +++ b/libavcodec/avs.c @@ -150,7 +150,7 @@ static av_cold int avs_decode_init(AVCodecContext * avctx) return 0; } -AVCodec avs_decoder = { +AVCodec ff_avs_decoder = { "avs", AVMEDIA_TYPE_VIDEO, CODEC_ID_AVS, diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c index 0ba39e63a5..5b06e5f12e 100644 --- a/libavcodec/bethsoftvideo.c +++ b/libavcodec/bethsoftvideo.c @@ -130,7 +130,7 @@ static av_cold int bethsoftvid_decode_end(AVCodecContext *avctx) return 0; } -AVCodec bethsoftvid_decoder = { +AVCodec ff_bethsoftvid_decoder = { .name = "bethsoftvid", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_BETHSOFTVID, diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c index ca72c1fd46..ff74233df9 100644 --- a/libavcodec/bfi.c +++ b/libavcodec/bfi.c @@ -180,7 +180,7 @@ static av_cold int bfi_decode_close(AVCodecContext * avctx) return 0; } -AVCodec bfi_decoder = { +AVCodec ff_bfi_decoder = { .name = "bfi", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_BFI, diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 01294030bd..64a10b71e5 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1000,7 +1000,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec bink_decoder = { +AVCodec ff_bink_decoder = { "binkvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_BINKVIDEO, diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 62ff17035e..7f579822db 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -286,7 +286,7 @@ static int decode_frame(AVCodecContext *avctx, return buf_size; } -AVCodec binkaudio_rdft_decoder = { +AVCodec ff_binkaudio_rdft_decoder = { "binkaudio_rdft", AVMEDIA_TYPE_AUDIO, CODEC_ID_BINKAUDIO_RDFT, @@ -298,7 +298,7 @@ AVCodec binkaudio_rdft_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)") }; -AVCodec binkaudio_dct_decoder = { +AVCodec ff_binkaudio_dct_decoder = { "binkaudio_dct", AVMEDIA_TYPE_AUDIO, CODEC_ID_BINKAUDIO_DCT, diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index 0c9e97310d..c02aac6cb7 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -335,7 +335,7 @@ static av_cold int bmp_decode_end(AVCodecContext *avctx) return 0; } -AVCodec bmp_decoder = { +AVCodec ff_bmp_decoder = { "bmp", AVMEDIA_TYPE_VIDEO, CODEC_ID_BMP, diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c index 12cb6de404..d424662b5c 100644 --- a/libavcodec/bmpenc.c +++ b/libavcodec/bmpenc.c @@ -149,7 +149,7 @@ static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s return n_bytes; } -AVCodec bmp_encoder = { +AVCodec ff_bmp_encoder = { "bmp", AVMEDIA_TYPE_VIDEO, CODEC_ID_BMP, diff --git a/libavcodec/c93.c b/libavcodec/c93.c index d713ff8e26..ed6e91d831 100644 --- a/libavcodec/c93.c +++ b/libavcodec/c93.c @@ -242,7 +242,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, return buf_size; } -AVCodec c93_decoder = { +AVCodec ff_c93_decoder = { "c93", AVMEDIA_TYPE_VIDEO, CODEC_ID_C93, diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c index 8e9c35b7a7..be32345af8 100644 --- a/libavcodec/cavs_parser.c +++ b/libavcodec/cavs_parser.c @@ -97,7 +97,7 @@ static int cavsvideo_parse(AVCodecParserContext *s, return next; } -AVCodecParser cavsvideo_parser = { +AVCodecParser ff_cavsvideo_parser = { { CODEC_ID_CAVS }, sizeof(ParseContext1), NULL, diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index 9845fb47fc..7ff1a57eb5 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -709,7 +709,7 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size, } } -AVCodec cavs_decoder = { +AVCodec ff_cavs_decoder = { "cavs", AVMEDIA_TYPE_VIDEO, CODEC_ID_CAVS, diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index 8afbb27aad..68f556b3f3 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -367,7 +367,7 @@ static av_cold int cdg_decode_end(AVCodecContext *avctx) return 0; } -AVCodec cdgraphics_decoder = { +AVCodec ff_cdgraphics_decoder = { "cdgraphics", AVMEDIA_TYPE_VIDEO, CODEC_ID_CDGRAPHICS, diff --git a/libavcodec/chomp_bsf.c b/libavcodec/chomp_bsf.c index e9ac8e8e29..eaefaaa539 100644 --- a/libavcodec/chomp_bsf.c +++ b/libavcodec/chomp_bsf.c @@ -40,7 +40,7 @@ static int chomp_filter(AVBitStreamFilterContext *bsfc, /** * This filter removes a string of NULL bytes from the end of a packet. */ -AVBitStreamFilter chomp_bsf = { +AVBitStreamFilter ff_chomp_bsf = { "chomp", 0, chomp_filter, diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index 8e7aa5aa99..52fde64813 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -455,7 +455,7 @@ static av_cold int cinepak_decode_end(AVCodecContext *avctx) return 0; } -AVCodec cinepak_decoder = { +AVCodec ff_cinepak_decoder = { "cinepak", AVMEDIA_TYPE_VIDEO, CODEC_ID_CINEPAK, diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c index 96c9bdf08a..36b6cbbb94 100644 --- a/libavcodec/cljr.c +++ b/libavcodec/cljr.c @@ -140,7 +140,7 @@ static av_cold int encode_init(AVCodecContext *avctx){ } #endif -AVCodec cljr_decoder = { +AVCodec ff_cljr_decoder = { "cljr", AVMEDIA_TYPE_VIDEO, CODEC_ID_CLJR, @@ -154,7 +154,7 @@ AVCodec cljr_decoder = { }; #if CONFIG_CLJR_ENCODER -AVCodec cljr_encoder = { +AVCodec ff_cljr_encoder = { "cljr", AVMEDIA_TYPE_VIDEO, CODEC_ID_CLJR, diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 2cbad5fc7a..6b70560546 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1283,7 +1283,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) } -AVCodec cook_decoder = +AVCodec ff_cook_decoder = { .name = "cook", .type = AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c index 00867a17cf..82a44defc7 100644 --- a/libavcodec/cscd.c +++ b/libavcodec/cscd.c @@ -254,7 +254,7 @@ static av_cold int decode_end(AVCodecContext *avctx) { return 0; } -AVCodec cscd_decoder = { +AVCodec ff_cscd_decoder = { "camstudio", AVMEDIA_TYPE_VIDEO, CODEC_ID_CSCD, diff --git a/libavcodec/cyuv.c b/libavcodec/cyuv.c index db7e690be7..79a84412e7 100644 --- a/libavcodec/cyuv.c +++ b/libavcodec/cyuv.c @@ -178,7 +178,7 @@ static av_cold int cyuv_decode_end(AVCodecContext *avctx) } #if CONFIG_AURA_DECODER -AVCodec aura_decoder = { +AVCodec ff_aura_decoder = { "aura", AVMEDIA_TYPE_VIDEO, CODEC_ID_AURA, @@ -194,7 +194,7 @@ AVCodec aura_decoder = { #endif #if CONFIG_CYUV_DECODER -AVCodec cyuv_decoder = { +AVCodec ff_cyuv_decoder = { "cyuv", AVMEDIA_TYPE_VIDEO, CODEC_ID_CYUV, diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 1e05561f25..c1c70cde1b 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1875,7 +1875,7 @@ static const AVProfile profiles[] = { { FF_PROFILE_UNKNOWN }, }; -AVCodec dca_decoder = { +AVCodec ff_dca_decoder = { .name = "dca", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_DTS, diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c index 01c559709a..a956e7506b 100644 --- a/libavcodec/dca_parser.c +++ b/libavcodec/dca_parser.c @@ -125,7 +125,7 @@ static int dca_parse(AVCodecParserContext * s, return next; } -AVCodecParser dca_parser = { +AVCodecParser ff_dca_parser = { {CODEC_ID_DTS}, sizeof(DCAParseContext), dca_parse_init, diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c index e5b9599c7f..0a1135542f 100644 --- a/libavcodec/dirac_parser.c +++ b/libavcodec/dirac_parser.c @@ -247,7 +247,7 @@ static void dirac_parse_close(AVCodecParserContext *s) av_free(pc->buffer); } -AVCodecParser dirac_parser = { +AVCodecParser ff_dirac_parser = { { CODEC_ID_DIRAC }, sizeof(DiracParseContext), NULL, diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c index 6149a2daab..e5a5aa09f5 100644 --- a/libavcodec/dnxhd_parser.c +++ b/libavcodec/dnxhd_parser.c @@ -86,7 +86,7 @@ static int dnxhd_parse(AVCodecParserContext *s, return next; } -AVCodecParser dnxhd_parser = { +AVCodecParser ff_dnxhd_parser = { { CODEC_ID_DNXHD }, sizeof(ParseContext), NULL, diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 67dd7fc60d..d977e88046 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -346,7 +346,7 @@ static av_cold int dnxhd_decode_close(AVCodecContext *avctx) return 0; } -AVCodec dnxhd_decoder = { +AVCodec ff_dnxhd_decoder = { "dnxhd", AVMEDIA_TYPE_VIDEO, CODEC_ID_DNXHD, diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 8cf54c5dc7..9f191e8703 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -848,7 +848,7 @@ static int dnxhd_encode_end(AVCodecContext *avctx) return 0; } -AVCodec dnxhd_encoder = { +AVCodec ff_dnxhd_encoder = { "dnxhd", AVMEDIA_TYPE_VIDEO, CODEC_ID_DNXHD, diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index 334f25dfdc..6053a14550 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -299,7 +299,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, } #define DPCM_DECODER(id, name, long_name_) \ -AVCodec name ## _decoder = { \ +AVCodec ff_ ## name ## _decoder = { \ #name, \ AVMEDIA_TYPE_AUDIO, \ id, \ diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index e49c969c6f..55ae4e7248 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -220,7 +220,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec dpx_decoder = { +AVCodec ff_dpx_decoder = { "dpx", AVMEDIA_TYPE_VIDEO, CODEC_ID_DPX, diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c index 4eddaac5a6..b4e0579a7b 100644 --- a/libavcodec/dsicinav.c +++ b/libavcodec/dsicinav.c @@ -343,7 +343,7 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, } -AVCodec dsicinvideo_decoder = { +AVCodec ff_dsicinvideo_decoder = { "dsicinvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_DSICINVIDEO, @@ -356,7 +356,7 @@ AVCodec dsicinvideo_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"), }; -AVCodec dsicinaudio_decoder = { +AVCodec ff_dsicinaudio_decoder = { "dsicinaudio", AVMEDIA_TYPE_AUDIO, CODEC_ID_DSICINAUDIO, diff --git a/libavcodec/dump_extradata_bsf.c b/libavcodec/dump_extradata_bsf.c index db263490a3..9499d6d8d8 100644 --- a/libavcodec/dump_extradata_bsf.c +++ b/libavcodec/dump_extradata_bsf.c @@ -43,7 +43,7 @@ static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, return 0; } -AVBitStreamFilter dump_extradata_bsf={ +AVBitStreamFilter ff_dump_extradata_bsf={ "dump_extra", 0, dump_extradata, diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 564ccb3103..6a4914768d 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -1290,7 +1290,7 @@ static int dvvideo_close(AVCodecContext *c) #if CONFIG_DVVIDEO_ENCODER -AVCodec dvvideo_encoder = { +AVCodec ff_dvvideo_encoder = { "dvvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_DVVIDEO, @@ -1303,7 +1303,7 @@ AVCodec dvvideo_encoder = { #endif // CONFIG_DVVIDEO_ENCODER #if CONFIG_DVVIDEO_DECODER -AVCodec dvvideo_decoder = { +AVCodec ff_dvvideo_decoder = { "dvvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_DVVIDEO, diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c index ea55cae317..c2a129864f 100644 --- a/libavcodec/dvbsub.c +++ b/libavcodec/dvbsub.c @@ -402,7 +402,7 @@ static int dvbsub_encode(AVCodecContext *avctx, return ret; } -AVCodec dvbsub_encoder = { +AVCodec ff_dvbsub_encoder = { "dvbsub", AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVB_SUBTITLE, diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c index c9ccfd0d9c..e98e185381 100644 --- a/libavcodec/dvbsub_parser.c +++ b/libavcodec/dvbsub_parser.c @@ -179,7 +179,7 @@ static av_cold void dvbsub_parse_close(AVCodecParserContext *s) av_freep(&pc->packet_buf); } -AVCodecParser dvbsub_parser = { +AVCodecParser ff_dvbsub_parser = { { CODEC_ID_DVB_SUBTITLE }, sizeof(DVBSubParseContext), dvbsub_parse_init, diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 3e06260398..aff12c85f2 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1479,7 +1479,7 @@ static int dvbsub_decode(AVCodecContext *avctx, } -AVCodec dvbsub_decoder = { +AVCodec ff_dvbsub_decoder = { "dvbsub", AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVB_SUBTITLE, diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c index 8f1b8d08e3..3bbf0dcb8b 100644 --- a/libavcodec/dvdsub_parser.c +++ b/libavcodec/dvdsub_parser.c @@ -76,7 +76,7 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s) av_freep(&pc->packet); } -AVCodecParser dvdsub_parser = { +AVCodecParser ff_dvdsub_parser = { { CODEC_ID_DVD_SUBTITLE }, sizeof(DVDSubParseContext), dvdsub_parse_init, diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index ea7467fdf5..8d08591ee4 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -486,7 +486,7 @@ static int dvdsub_decode(AVCodecContext *avctx, return buf_size; } -AVCodec dvdsub_decoder = { +AVCodec ff_dvdsub_decoder = { "dvdsub", AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVD_SUBTITLE, diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index 4ee0f37c9d..d09ac269ed 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -215,7 +215,7 @@ static int dvdsub_encode(AVCodecContext *avctx, return ret; } -AVCodec dvdsub_encoder = { +AVCodec ff_dvdsub_encoder = { "dvdsub", AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVD_SUBTITLE, diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c index 62e4e0ae82..00156292c9 100644 --- a/libavcodec/dxa.c +++ b/libavcodec/dxa.c @@ -317,7 +317,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec dxa_decoder = { +AVCodec ff_dxa_decoder = { "dxa", AVMEDIA_TYPE_VIDEO, CODEC_ID_DXA, diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c index 4a2d7c06a0..6770cd195e 100644 --- a/libavcodec/eacmv.c +++ b/libavcodec/eacmv.c @@ -205,7 +205,7 @@ static av_cold int cmv_decode_end(AVCodecContext *avctx){ return 0; } -AVCodec eacmv_decoder = { +AVCodec ff_eacmv_decoder = { "eacmv", AVMEDIA_TYPE_VIDEO, CODEC_ID_CMV, diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index db92d6b69d..1dd3b79755 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -306,7 +306,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec eamad_decoder = { +AVCodec ff_eamad_decoder = { "eamad", AVMEDIA_TYPE_VIDEO, CODEC_ID_MAD, diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c index 7a985050c5..6f35a1513b 100644 --- a/libavcodec/eatgq.c +++ b/libavcodec/eatgq.c @@ -243,7 +243,7 @@ static av_cold int tgq_decode_end(AVCodecContext *avctx){ return 0; } -AVCodec eatgq_decoder = { +AVCodec ff_eatgq_decoder = { "eatgq", AVMEDIA_TYPE_VIDEO, CODEC_ID_TGQ, diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index 45c6644c56..075405a907 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -334,7 +334,7 @@ static av_cold int tgv_decode_end(AVCodecContext *avctx) return 0; } -AVCodec eatgv_decoder = { +AVCodec ff_eatgv_decoder = { "eatgv", AVMEDIA_TYPE_VIDEO, CODEC_ID_TGV, diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c index 7f1901d309..44792f0483 100644 --- a/libavcodec/eatqi.c +++ b/libavcodec/eatqi.c @@ -154,7 +154,7 @@ static av_cold int tqi_decode_end(AVCodecContext *avctx) return 0; } -AVCodec eatqi_decoder = { +AVCodec ff_eatqi_decoder = { "eatqi", AVMEDIA_TYPE_VIDEO, CODEC_ID_TQI, diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c index af14e0d7e5..5a6769d342 100644 --- a/libavcodec/escape124.c +++ b/libavcodec/escape124.c @@ -363,7 +363,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, } -AVCodec escape124_decoder = { +AVCodec ff_escape124_decoder = { "escape124", AVMEDIA_TYPE_VIDEO, CODEC_ID_ESCAPE124, diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 83292b3869..4219d62e1f 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1786,7 +1786,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac return buf_size; } -AVCodec ffv1_decoder = { +AVCodec ff_ffv1_decoder = { "ffv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_FFV1, @@ -1801,7 +1801,7 @@ AVCodec ffv1_decoder = { }; #if CONFIG_FFV1_ENCODER -AVCodec ffv1_encoder = { +AVCodec ff_ffv1_encoder = { "ffv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_FFV1, diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c index 4ba3203180..50ad72b7c0 100644 --- a/libavcodec/flac_parser.c +++ b/libavcodec/flac_parser.c @@ -673,7 +673,7 @@ static void flac_parse_close(AVCodecParserContext *c) av_free(fpc->wrap_buf); } -AVCodecParser flac_parser = { +AVCodecParser ff_flac_parser = { { CODEC_ID_FLAC }, sizeof(FLACParseContext), flac_parse_init, diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 18ea0acd9a..ece095cf09 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -653,7 +653,7 @@ static av_cold int flac_decode_close(AVCodecContext *avctx) return 0; } -AVCodec flac_decoder = { +AVCodec ff_flac_decoder = { "flac", AVMEDIA_TYPE_AUDIO, CODEC_ID_FLAC, diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 2bfe56e8eb..7c814700b1 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -1326,7 +1326,7 @@ static av_cold int flac_encode_close(AVCodecContext *avctx) } -AVCodec flac_encoder = { +AVCodec ff_flac_encoder = { "flac", AVMEDIA_TYPE_AUDIO, CODEC_ID_FLAC, diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 394ac0f82a..08748c65d1 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -250,7 +250,7 @@ static av_cold int flashsv_decode_end(AVCodecContext *avctx) } -AVCodec flashsv_decoder = { +AVCodec ff_flashsv_decoder = { "flashsv", AVMEDIA_TYPE_VIDEO, CODEC_ID_FLASHSV, diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c index ff917e9370..9093969cfe 100644 --- a/libavcodec/flashsvenc.c +++ b/libavcodec/flashsvenc.c @@ -280,7 +280,7 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx) return 0; } -AVCodec flashsv_encoder = { +AVCodec ff_flashsv_encoder = { "flashsv", AVMEDIA_TYPE_VIDEO, CODEC_ID_FLASHSV, diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index b63d7d4498..913617d120 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -742,7 +742,7 @@ static av_cold int flic_decode_end(AVCodecContext *avctx) return 0; } -AVCodec flic_decoder = { +AVCodec ff_flic_decoder = { "flic", AVMEDIA_TYPE_VIDEO, CODEC_ID_FLIC, diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c index f53291de42..b1a7578173 100644 --- a/libavcodec/flvdec.c +++ b/libavcodec/flvdec.c @@ -118,7 +118,7 @@ int ff_flv_decode_picture_header(MpegEncContext *s) return 0; } -AVCodec flv_decoder = { +AVCodec ff_flv_decoder = { "flv", AVMEDIA_TYPE_VIDEO, CODEC_ID_FLV1, diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c index bf320f2ffe..5e81dcb15d 100644 --- a/libavcodec/flvenc.c +++ b/libavcodec/flvenc.c @@ -84,7 +84,7 @@ void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run, in } } -AVCodec flv_encoder = { +AVCodec ff_flv_encoder = { "flv", AVMEDIA_TYPE_VIDEO, CODEC_ID_FLV1, diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 9786fd0da2..0938ccd630 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -355,7 +355,7 @@ static av_cold int decode_end(AVCodecContext *avctx) } -AVCodec fraps_decoder = { +AVCodec ff_fraps_decoder = { "fraps", AVMEDIA_TYPE_VIDEO, CODEC_ID_FRAPS, diff --git a/libavcodec/frwu.c b/libavcodec/frwu.c index b685248b5f..306166bdc5 100644 --- a/libavcodec/frwu.c +++ b/libavcodec/frwu.c @@ -109,7 +109,7 @@ static av_cold int decode_close(AVCodecContext *avctx) return 0; } -AVCodec frwu_decoder = { +AVCodec ff_frwu_decoder = { "FRWU", AVMEDIA_TYPE_VIDEO, CODEC_ID_FRWU, diff --git a/libavcodec/g722.c b/libavcodec/g722.c index 96a2bd6535..0efc390afc 100644 --- a/libavcodec/g722.c +++ b/libavcodec/g722.c @@ -328,7 +328,7 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data, return avpkt->size; } -AVCodec adpcm_g722_decoder = { +AVCodec ff_adpcm_g722_decoder = { .name = "g722", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_ADPCM_G722, @@ -568,7 +568,7 @@ static int g722_encode_frame(AVCodecContext *avctx, return i; } -AVCodec adpcm_g722_encoder = { +AVCodec ff_adpcm_g722_encoder = { .name = "g722", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_ADPCM_G722, diff --git a/libavcodec/g726.c b/libavcodec/g726.c index 52ebda6e49..30bd96fcc9 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -391,7 +391,7 @@ static int g726_decode_frame(AVCodecContext *avctx, } #if CONFIG_ADPCM_G726_ENCODER -AVCodec adpcm_g726_encoder = { +AVCodec ff_adpcm_g726_encoder = { "g726", AVMEDIA_TYPE_AUDIO, CODEC_ID_ADPCM_G726, @@ -406,7 +406,7 @@ AVCodec adpcm_g726_encoder = { }; #endif -AVCodec adpcm_g726_decoder = { +AVCodec ff_adpcm_g726_decoder = { "g726", AVMEDIA_TYPE_AUDIO, CODEC_ID_ADPCM_G726, diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index 3a6fb0fb7a..8a35bdc83c 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -312,7 +312,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, return buf_size; } -AVCodec g729_decoder = +AVCodec ff_g729_decoder = { "g729", AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/gif.c b/libavcodec/gif.c index a52f140b42..218b80babb 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -166,7 +166,7 @@ static int gif_encode_close(AVCodecContext *avctx) return 0; } -AVCodec gif_encoder = { +AVCodec ff_gif_encoder = { "gif", AVMEDIA_TYPE_VIDEO, CODEC_ID_GIF, diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index 9820a063fc..5a5e5623f2 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -325,7 +325,7 @@ static av_cold int gif_decode_close(AVCodecContext *avctx) return 0; } -AVCodec gif_decoder = { +AVCodec ff_gif_decoder = { "gif", AVMEDIA_TYPE_VIDEO, CODEC_ID_GIF, diff --git a/libavcodec/gsmdec.c b/libavcodec/gsmdec.c index b316810c4d..4ce36b48bc 100644 --- a/libavcodec/gsmdec.c +++ b/libavcodec/gsmdec.c @@ -84,7 +84,7 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data, return avctx->block_align; } -AVCodec gsm_decoder = { +AVCodec ff_gsm_decoder = { "gsm", AVMEDIA_TYPE_AUDIO, CODEC_ID_GSM, @@ -96,7 +96,7 @@ AVCodec gsm_decoder = { .long_name = NULL_IF_CONFIG_SMALL("GSM"), }; -AVCodec gsm_ms_decoder = { +AVCodec ff_gsm_ms_decoder = { "gsm_ms", AVMEDIA_TYPE_AUDIO, CODEC_ID_GSM_MS, diff --git a/libavcodec/h261_parser.c b/libavcodec/h261_parser.c index c32300d6ed..defc1cb46f 100644 --- a/libavcodec/h261_parser.c +++ b/libavcodec/h261_parser.c @@ -81,7 +81,7 @@ static int h261_parse(AVCodecParserContext *s, return next; } -AVCodecParser h261_parser = { +AVCodecParser ff_h261_parser = { { CODEC_ID_H261 }, sizeof(ParseContext), NULL, diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 3809a0179c..3cc10306f4 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -641,7 +641,7 @@ static av_cold int h261_decode_end(AVCodecContext *avctx) return 0; } -AVCodec h261_decoder = { +AVCodec ff_h261_decoder = { "h261", AVMEDIA_TYPE_VIDEO, CODEC_ID_H261, diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c index c85ee8bb05..cd282fba75 100644 --- a/libavcodec/h261enc.c +++ b/libavcodec/h261enc.c @@ -321,7 +321,7 @@ static void h261_encode_block(H261Context * h, DCTELEM * block, int n){ } } -AVCodec h261_encoder = { +AVCodec ff_h261_encoder = { "h261", AVMEDIA_TYPE_VIDEO, CODEC_ID_H261, diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c index 16c5ea5055..e08198324b 100644 --- a/libavcodec/h263_parser.c +++ b/libavcodec/h263_parser.c @@ -83,7 +83,7 @@ static int h263_parse(AVCodecParserContext *s, return next; } -AVCodecParser h263_parser = { +AVCodecParser ff_h263_parser = { { CODEC_ID_H263 }, sizeof(ParseContext), NULL, diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 04417c256d..1c73d93405 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -735,7 +735,7 @@ av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time); return get_consumed_bytes(s, buf_size); } -AVCodec h263_decoder = { +AVCodec ff_h263_decoder = { "h263", AVMEDIA_TYPE_VIDEO, CODEC_ID_H263, diff --git a/libavcodec/h264.c b/libavcodec/h264.c index be46315b5e..8ef9b76f44 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3360,7 +3360,7 @@ av_cold int ff_h264_decode_end(AVCodecContext *avctx) } -AVCodec h264_decoder = { +AVCodec ff_h264_decoder = { "h264", AVMEDIA_TYPE_VIDEO, CODEC_ID_H264, @@ -3375,7 +3375,7 @@ AVCodec h264_decoder = { }; #if CONFIG_H264_VDPAU_DECODER -AVCodec h264_vdpau_decoder = { +AVCodec ff_h264_vdpau_decoder = { "h264_vdpau", AVMEDIA_TYPE_VIDEO, CODEC_ID_H264, diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index e2ee10a030..d4a7f31937 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -169,7 +169,7 @@ fail: return AVERROR(EINVAL); } -AVBitStreamFilter h264_mp4toannexb_bsf = { +AVBitStreamFilter ff_h264_mp4toannexb_bsf = { "h264_mp4toannexb", sizeof(H264BSFContext), h264_mp4toannexb_filter, diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 89523b5ca2..51760dcf68 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -332,7 +332,7 @@ static int init(AVCodecParserContext *s) return 0; } -AVCodecParser h264_parser = { +AVCodecParser ff_h264_parser = { { CODEC_ID_H264 }, sizeof(H264Context), init, diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 7541785cb2..2eb5864c47 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -1416,7 +1416,7 @@ static av_cold int encode_end(AVCodecContext *avctx) #endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */ #if CONFIG_HUFFYUV_DECODER -AVCodec huffyuv_decoder = { +AVCodec ff_huffyuv_decoder = { "huffyuv", AVMEDIA_TYPE_VIDEO, CODEC_ID_HUFFYUV, @@ -1432,7 +1432,7 @@ AVCodec huffyuv_decoder = { #endif #if CONFIG_FFVHUFF_DECODER -AVCodec ffvhuff_decoder = { +AVCodec ff_ffvhuff_decoder = { "ffvhuff", AVMEDIA_TYPE_VIDEO, CODEC_ID_FFVHUFF, @@ -1448,7 +1448,7 @@ AVCodec ffvhuff_decoder = { #endif #if CONFIG_HUFFYUV_ENCODER -AVCodec huffyuv_encoder = { +AVCodec ff_huffyuv_encoder = { "huffyuv", AVMEDIA_TYPE_VIDEO, CODEC_ID_HUFFYUV, @@ -1462,7 +1462,7 @@ AVCodec huffyuv_encoder = { #endif #if CONFIG_FFVHUFF_ENCODER -AVCodec ffvhuff_encoder = { +AVCodec ff_ffvhuff_encoder = { "ffvhuff", AVMEDIA_TYPE_VIDEO, CODEC_ID_FFVHUFF, diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c index cc79ef0a4f..64421db19a 100644 --- a/libavcodec/idcinvideo.c +++ b/libavcodec/idcinvideo.c @@ -253,7 +253,7 @@ static av_cold int idcin_decode_end(AVCodecContext *avctx) return 0; } -AVCodec idcin_decoder = { +AVCodec ff_idcin_decoder = { "idcinvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_IDCIN, diff --git a/libavcodec/iff.c b/libavcodec/iff.c index aeff0b5ba5..18ad7004d9 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -367,7 +367,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec iff_ilbm_decoder = { +AVCodec ff_iff_ilbm_decoder = { "iff_ilbm", AVMEDIA_TYPE_VIDEO, CODEC_ID_IFF_ILBM, @@ -380,7 +380,7 @@ AVCodec iff_ilbm_decoder = { .long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"), }; -AVCodec iff_byterun1_decoder = { +AVCodec ff_iff_byterun1_decoder = { "iff_byterun1", AVMEDIA_TYPE_VIDEO, CODEC_ID_IFF_BYTERUN1, diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 272e4ee76e..4d7fbd1db6 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -821,7 +821,7 @@ static av_cold int imc_decode_close(AVCodecContext * avctx) } -AVCodec imc_decoder = { +AVCodec ff_imc_decoder = { .name = "imc", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_IMC, diff --git a/libavcodec/imx_dump_header_bsf.c b/libavcodec/imx_dump_header_bsf.c index 2310185b8e..8119809faa 100644 --- a/libavcodec/imx_dump_header_bsf.c +++ b/libavcodec/imx_dump_header_bsf.c @@ -52,7 +52,7 @@ static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx return 1; } -AVBitStreamFilter imx_dump_header_bsf = { +AVBitStreamFilter ff_imx_dump_header_bsf = { "imxdump", 0, imx_dump_header, diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c index a3d6c80081..68c6246f89 100644 --- a/libavcodec/indeo2.c +++ b/libavcodec/indeo2.c @@ -224,7 +224,7 @@ static av_cold int ir2_decode_end(AVCodecContext *avctx){ return 0; } -AVCodec indeo2_decoder = { +AVCodec ff_indeo2_decoder = { "indeo2", AVMEDIA_TYPE_VIDEO, CODEC_ID_INDEO2, diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 66ea987c38..5c4cd0564a 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -1137,7 +1137,7 @@ static av_cold int indeo3_decode_end(AVCodecContext *avctx) return 0; } -AVCodec indeo3_decoder = { +AVCodec ff_indeo3_decoder = { "indeo3", AVMEDIA_TYPE_VIDEO, CODEC_ID_INDEO3, diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c index d8aab20579..d96b31032f 100644 --- a/libavcodec/indeo5.c +++ b/libavcodec/indeo5.c @@ -818,7 +818,7 @@ static av_cold int decode_close(AVCodecContext *avctx) } -AVCodec indeo5_decoder = { +AVCodec ff_indeo5_decoder = { .name = "indeo5", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_INDEO5, diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c index 5e451294da..00b15ce327 100644 --- a/libavcodec/intelh263dec.c +++ b/libavcodec/intelh263dec.c @@ -115,7 +115,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s) return 0; } -AVCodec h263i_decoder = { +AVCodec ff_h263i_decoder = { "h263i", AVMEDIA_TYPE_VIDEO, CODEC_ID_H263I, diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c index 34f055743d..18702b21d0 100644 --- a/libavcodec/interplayvideo.c +++ b/libavcodec/interplayvideo.c @@ -1097,7 +1097,7 @@ static av_cold int ipvideo_decode_end(AVCodecContext *avctx) return 0; } -AVCodec interplay_video_decoder = { +AVCodec ff_interplay_video_decoder = { "interplayvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_INTERPLAY_VIDEO, diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index 6b7dd94647..7278e020da 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -363,7 +363,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor } -AVCodec jpegls_decoder = { +AVCodec ff_jpegls_decoder = { "jpegls", AVMEDIA_TYPE_VIDEO, CODEC_ID_JPEGLS, diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c index 08ef71f716..ce6dc10f39 100644 --- a/libavcodec/jpeglsenc.c +++ b/libavcodec/jpeglsenc.c @@ -382,7 +382,7 @@ static av_cold int encode_init_ls(AVCodecContext *ctx) { return 0; } -AVCodec jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them +AVCodec ff_jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them "jpegls", AVMEDIA_TYPE_VIDEO, CODEC_ID_JPEGLS, diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c index a41d312a60..efc477f37d 100644 --- a/libavcodec/kgv1dec.c +++ b/libavcodec/kgv1dec.c @@ -164,7 +164,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec kgv1_decoder = { +AVCodec ff_kgv1_decoder = { "kgv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_KGV1, diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index 3e8dccd363..bd628d85c0 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -401,7 +401,7 @@ static av_cold int decode_end(AVCodecContext * avctx) return 0; } -AVCodec kmvc_decoder = { +AVCodec ff_kmvc_decoder = { "kmvc", AVMEDIA_TYPE_VIDEO, CODEC_ID_KMVC, diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 1bf61bd23d..89580dc159 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -508,7 +508,7 @@ static av_cold int lag_decode_end(AVCodecContext *avctx) return 0; } -AVCodec lagarith_decoder = { +AVCodec ff_lagarith_decoder = { "lagarith", CODEC_TYPE_VIDEO, CODEC_ID_LAGARITH, diff --git a/libavcodec/latm_parser.c b/libavcodec/latm_parser.c index e3134be567..8e42c6ace9 100644 --- a/libavcodec/latm_parser.c +++ b/libavcodec/latm_parser.c @@ -105,7 +105,7 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx, return next; } -AVCodecParser aac_latm_parser = { +AVCodecParser ff_aac_latm_parser = { { CODEC_ID_AAC_LATM }, sizeof(LATMParseContext), NULL, diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index 23af511455..f2e5bb0c80 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -609,7 +609,7 @@ static av_cold int decode_end(AVCodecContext *avctx) } #if CONFIG_MSZH_DECODER -AVCodec mszh_decoder = { +AVCodec ff_mszh_decoder = { "mszh", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSZH, @@ -624,7 +624,7 @@ AVCodec mszh_decoder = { #endif #if CONFIG_ZLIB_DECODER -AVCodec zlib_decoder = { +AVCodec ff_zlib_decoder = { "zlib", AVMEDIA_TYPE_VIDEO, CODEC_ID_ZLIB, diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c index f50b5883b3..a90c1cf588 100644 --- a/libavcodec/lclenc.c +++ b/libavcodec/lclenc.c @@ -170,7 +170,7 @@ static av_cold int encode_end(AVCodecContext *avctx) return 0; } -AVCodec zlib_encoder = { +AVCodec ff_zlib_encoder = { "zlib", AVMEDIA_TYPE_VIDEO, CODEC_ID_ZLIB, diff --git a/libavcodec/libdiracdec.c b/libavcodec/libdiracdec.c index 0e8454e310..520ec3f03a 100644 --- a/libavcodec/libdiracdec.c +++ b/libavcodec/libdiracdec.c @@ -194,7 +194,7 @@ static void libdirac_flush(AVCodecContext *avccontext) -AVCodec libdirac_decoder = { +AVCodec ff_libdirac_decoder = { "libdirac", AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC, diff --git a/libavcodec/libdiracenc.c b/libavcodec/libdiracenc.c index d390aa8a7b..a9cc6803b9 100644 --- a/libavcodec/libdiracenc.c +++ b/libavcodec/libdiracenc.c @@ -391,7 +391,7 @@ static av_cold int libdirac_encode_close(AVCodecContext *avccontext) } -AVCodec libdirac_encoder = { +AVCodec ff_libdirac_encoder = { "libdirac", AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC, diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index e0425377aa..79ab729c13 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -153,7 +153,7 @@ static const AVProfile profiles[] = { { FF_PROFILE_UNKNOWN }, }; -AVCodec libfaac_encoder = { +AVCodec ff_libfaac_encoder = { "libfaac", AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC, diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index 77cc8914cc..1f76f82d55 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -112,7 +112,7 @@ static int libgsm_encode_frame(AVCodecContext *avctx, } -AVCodec libgsm_encoder = { +AVCodec ff_libgsm_encoder = { "libgsm", AVMEDIA_TYPE_AUDIO, CODEC_ID_GSM, @@ -124,7 +124,7 @@ AVCodec libgsm_encoder = { .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"), }; -AVCodec libgsm_ms_encoder = { +AVCodec ff_libgsm_ms_encoder = { "libgsm_ms", AVMEDIA_TYPE_AUDIO, CODEC_ID_GSM_MS, @@ -156,7 +156,7 @@ static int libgsm_decode_frame(AVCodecContext *avctx, return avctx->block_align; } -AVCodec libgsm_decoder = { +AVCodec ff_libgsm_decoder = { "libgsm", AVMEDIA_TYPE_AUDIO, CODEC_ID_GSM, @@ -168,7 +168,7 @@ AVCodec libgsm_decoder = { .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"), }; -AVCodec libgsm_ms_decoder = { +AVCodec ff_libgsm_ms_decoder = { "libgsm_ms", AVMEDIA_TYPE_AUDIO, CODEC_ID_GSM_MS, diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index 35c80547bd..db0bc8259c 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -213,7 +213,7 @@ static av_cold int MP3lame_encode_close(AVCodecContext *avctx) } -AVCodec libmp3lame_encoder = { +AVCodec ff_libmp3lame_encoder = { "libmp3lame", AVMEDIA_TYPE_AUDIO, CODEC_ID_MP3, diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index ab1f89aad7..b2e2f1632e 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -139,7 +139,7 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, return packet_size; } -AVCodec libopencore_amrnb_decoder = { +AVCodec ff_libopencore_amrnb_decoder = { "libopencore_amrnb", AVMEDIA_TYPE_AUDIO, CODEC_ID_AMR_NB, @@ -213,7 +213,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, return written; } -AVCodec libopencore_amrnb_encoder = { +AVCodec ff_libopencore_amrnb_encoder = { "libopencore_amrnb", AVMEDIA_TYPE_AUDIO, CODEC_ID_AMR_NB, @@ -310,7 +310,7 @@ static int amr_wb_decode_close(AVCodecContext *avctx) return 0; } -AVCodec libopencore_amrwb_decoder = { +AVCodec ff_libopencore_amrwb_decoder = { "libopencore_amrwb", AVMEDIA_TYPE_AUDIO, CODEC_ID_AMR_WB, diff --git a/libavcodec/libopenjpeg.c b/libavcodec/libopenjpeg.c index a23b17f12d..0a9ded896d 100644 --- a/libavcodec/libopenjpeg.c +++ b/libavcodec/libopenjpeg.c @@ -184,7 +184,7 @@ static av_cold int libopenjpeg_decode_close(AVCodecContext *avctx) } -AVCodec libopenjpeg_decoder = { +AVCodec ff_libopenjpeg_decoder = { "libopenjpeg", AVMEDIA_TYPE_VIDEO, CODEC_ID_JPEG2000, diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c index fc875bbf42..e733d9e34d 100644 --- a/libavcodec/libschroedingerdec.c +++ b/libavcodec/libschroedingerdec.c @@ -346,7 +346,7 @@ static void libschroedinger_flush(AVCodecContext *avccontext) p_schro_params->eos_signalled = 0; } -AVCodec libschroedinger_decoder = { +AVCodec ff_libschroedinger_decoder = { "libschroedinger", AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC, diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c index c4a0433043..4f42d28b3b 100644 --- a/libavcodec/libschroedingerenc.c +++ b/libavcodec/libschroedingerenc.c @@ -422,7 +422,7 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext) } -AVCodec libschroedinger_encoder = { +AVCodec ff_libschroedinger_encoder = { "libschroedinger", AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC, diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c index 204e52c10e..1caf738536 100644 --- a/libavcodec/libspeexdec.c +++ b/libavcodec/libspeexdec.c @@ -138,7 +138,7 @@ static av_cold int libspeex_decode_close(AVCodecContext *avctx) return 0; } -AVCodec libspeex_decoder = { +AVCodec ff_libspeex_decoder = { "libspeex", AVMEDIA_TYPE_AUDIO, CODEC_ID_SPEEX, diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index e4ca721166..87793adc72 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -357,7 +357,7 @@ static av_cold int encode_close(AVCodecContext* avc_context) } /** AVCodec struct exposed to libavcodec */ -AVCodec libtheora_encoder = { +AVCodec ff_libtheora_encoder = { .name = "libtheora", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_THEORA, diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c index ef56c25ac9..9324b28f45 100644 --- a/libavcodec/libvorbis.c +++ b/libavcodec/libvorbis.c @@ -243,7 +243,7 @@ static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext) { } -AVCodec libvorbis_encoder = { +AVCodec ff_libvorbis_encoder = { "libvorbis", AVMEDIA_TYPE_AUDIO, CODEC_ID_VORBIS, diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index 12efb9f00f..f912322c50 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -111,7 +111,7 @@ static av_cold int vp8_free(AVCodecContext *avctx) return 0; } -AVCodec libvpx_decoder = { +AVCodec ff_libvpx_decoder = { "libvpx", AVMEDIA_TYPE_VIDEO, CODEC_ID_VP8, diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index d0838baa6c..878c979deb 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -494,7 +494,7 @@ static int vp8_encode(AVCodecContext *avctx, uint8_t *buf, int buf_size, return coded_size; } -AVCodec libvpx_encoder = { +AVCodec ff_libvpx_encoder = { "libvpx", AVMEDIA_TYPE_VIDEO, CODEC_ID_VP8, diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 85ef38c6b0..84ecb2aecb 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -329,7 +329,7 @@ static av_cold int X264_init(AVCodecContext *avctx) return 0; } -AVCodec libx264_encoder = { +AVCodec ff_libx264_encoder = { .name = "libx264", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_H264, diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c index aa5dc23bc2..08b93f5895 100644 --- a/libavcodec/libxavs.c +++ b/libavcodec/libxavs.c @@ -336,7 +336,7 @@ static av_cold int XAVS_init(AVCodecContext *avctx) return 0; } -AVCodec libxavs_encoder = { +AVCodec ff_libxavs_encoder = { .name = "libxavs", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_CAVS, diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c index f5273548c5..d95ddee8d7 100644 --- a/libavcodec/libxvidff.c +++ b/libavcodec/libxvidff.c @@ -814,7 +814,7 @@ int xvid_ff_2pass(void *ref, int cmd, void *p1, void *p2) { /** * Xvid codec definition for libavcodec. */ -AVCodec libxvid_encoder = { +AVCodec ff_libxvid_encoder = { "libxvid", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG4, diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index 2ef07c3a32..56336cb3bf 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -186,7 +186,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in } -AVCodec ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them +AVCodec ff_ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them "ljpeg", AVMEDIA_TYPE_VIDEO, CODEC_ID_LJPEG, diff --git a/libavcodec/loco.c b/libavcodec/loco.c index d19a80cf34..48fa829914 100644 --- a/libavcodec/loco.c +++ b/libavcodec/loco.c @@ -285,7 +285,7 @@ static av_cold int decode_end(AVCodecContext *avctx){ return 0; } -AVCodec loco_decoder = { +AVCodec ff_loco_decoder = { "loco", AVMEDIA_TYPE_VIDEO, CODEC_ID_LOCO, diff --git a/libavcodec/mace.c b/libavcodec/mace.c index c4c43f6184..1b8c9d0836 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -279,7 +279,7 @@ static int mace_decode_frame(AVCodecContext *avctx, return buf_size; } -AVCodec mace3_decoder = { +AVCodec ff_mace3_decoder = { "mace3", AVMEDIA_TYPE_AUDIO, CODEC_ID_MACE3, @@ -291,7 +291,7 @@ AVCodec mace3_decoder = { .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 3:1"), }; -AVCodec mace6_decoder = { +AVCodec ff_mace6_decoder = { "mace6", AVMEDIA_TYPE_AUDIO, CODEC_ID_MACE6, diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 83e1f7ce9c..12d1751172 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -250,7 +250,7 @@ static av_cold int decode_end(AVCodecContext *avctx){ return 0; } -AVCodec mdec_decoder = { +AVCodec ff_mdec_decoder = { "mdec", AVMEDIA_TYPE_VIDEO, CODEC_ID_MDEC, diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index e5f7123e94..bcf125a262 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -378,7 +378,7 @@ static av_cold int mimic_decode_end(AVCodecContext *avctx) return 0; } -AVCodec mimic_decoder = { +AVCodec ff_mimic_decoder = { "mimic", AVMEDIA_TYPE_VIDEO, CODEC_ID_MIMIC, diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/mjpeg2jpeg_bsf.c index 36bb749c5a..855f24add3 100644 --- a/libavcodec/mjpeg2jpeg_bsf.c +++ b/libavcodec/mjpeg2jpeg_bsf.c @@ -106,7 +106,7 @@ static int mjpeg2jpeg_filter(AVBitStreamFilterContext *bsfc, return 1; } -AVBitStreamFilter mjpeg2jpeg_bsf = { +AVBitStreamFilter ff_mjpeg2jpeg_bsf = { .name = "mjpeg2jpeg", .priv_data_size = 0, .filter = mjpeg2jpeg_filter, diff --git a/libavcodec/mjpeg_parser.c b/libavcodec/mjpeg_parser.c index b1848fac51..0cc355db5c 100644 --- a/libavcodec/mjpeg_parser.c +++ b/libavcodec/mjpeg_parser.c @@ -96,7 +96,7 @@ static int jpeg_parse(AVCodecParserContext *s, } -AVCodecParser mjpeg_parser = { +AVCodecParser ff_mjpeg_parser = { { CODEC_ID_MJPEG }, sizeof(ParseContext), NULL, diff --git a/libavcodec/mjpega_dump_header_bsf.c b/libavcodec/mjpega_dump_header_bsf.c index bb7858e498..2e86fd4ef3 100644 --- a/libavcodec/mjpega_dump_header_bsf.c +++ b/libavcodec/mjpega_dump_header_bsf.c @@ -87,7 +87,7 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av return 0; } -AVBitStreamFilter mjpega_dump_header_bsf = { +AVBitStreamFilter ff_mjpega_dump_header_bsf = { "mjpegadump", 0, mjpega_dump_header, diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c index 907fa6f504..dc5a838d7a 100644 --- a/libavcodec/mjpegbdec.c +++ b/libavcodec/mjpegbdec.c @@ -145,7 +145,7 @@ read_header: return buf_ptr - buf; } -AVCodec mjpegb_decoder = { +AVCodec ff_mjpegb_decoder = { "mjpegb", AVMEDIA_TYPE_VIDEO, CODEC_ID_MJPEGB, diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 3386cc07d3..6c0dfeb7dd 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1536,7 +1536,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx) return 0; } -AVCodec mjpeg_decoder = { +AVCodec ff_mjpeg_decoder = { "mjpeg", AVMEDIA_TYPE_VIDEO, CODEC_ID_MJPEG, @@ -1551,7 +1551,7 @@ AVCodec mjpeg_decoder = { .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"), }; -AVCodec thp_decoder = { +AVCodec ff_thp_decoder = { "thp", AVMEDIA_TYPE_VIDEO, CODEC_ID_THP, diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index 05f0bed35d..15b588c793 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -445,7 +445,7 @@ void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64]) s->i_tex_bits += get_bits_diff(s); } -AVCodec mjpeg_encoder = { +AVCodec ff_mjpeg_encoder = { "mjpeg", AVMEDIA_TYPE_VIDEO, CODEC_ID_MJPEG, diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c index 36a296f98e..a6196f9abd 100644 --- a/libavcodec/mlp_parser.c +++ b/libavcodec/mlp_parser.c @@ -288,7 +288,7 @@ lost_sync: return 1; } -AVCodecParser mlp_parser = { +AVCodecParser ff_mlp_parser = { { CODEC_ID_MLP, CODEC_ID_TRUEHD }, sizeof(MLPParseContext), mlp_init, diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 2a04be5156..a655b3d4a9 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -1137,7 +1137,7 @@ error: return -1; } -AVCodec mlp_decoder = { +AVCodec ff_mlp_decoder = { "mlp", AVMEDIA_TYPE_AUDIO, CODEC_ID_MLP, @@ -1150,7 +1150,7 @@ AVCodec mlp_decoder = { }; #if CONFIG_TRUEHD_DECODER -AVCodec truehd_decoder = { +AVCodec ff_truehd_decoder = { "truehd", AVMEDIA_TYPE_AUDIO, CODEC_ID_TRUEHD, diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index 568a010154..60e00fbe29 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -212,7 +212,7 @@ static av_cold int mm_decode_end(AVCodecContext *avctx) return 0; } -AVCodec mmvideo_decoder = { +AVCodec ff_mmvideo_decoder = { "mmvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_MMVIDEO, diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 9bc5e2035d..ed0af4d90e 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -302,7 +302,7 @@ static av_cold int mp_decode_end(AVCodecContext *avctx) return 0; } -AVCodec motionpixels_decoder = { +AVCodec ff_motionpixels_decoder = { "motionpixels", AVMEDIA_TYPE_VIDEO, CODEC_ID_MOTIONPIXELS, diff --git a/libavcodec/movsub_bsf.c b/libavcodec/movsub_bsf.c index 2423f2db94..088c774001 100644 --- a/libavcodec/movsub_bsf.c +++ b/libavcodec/movsub_bsf.c @@ -33,7 +33,7 @@ static int text2movsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co return 1; } -AVBitStreamFilter text2movsub_bsf={ +AVBitStreamFilter ff_text2movsub_bsf={ "text2movsub", 0, text2movsub, @@ -49,7 +49,7 @@ static int mov2textsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co return 1; } -AVBitStreamFilter mov2textsub_bsf={ +AVBitStreamFilter ff_mov2textsub_bsf={ "mov2textsub", 0, mov2textsub, diff --git a/libavcodec/mp3_header_compress_bsf.c b/libavcodec/mp3_header_compress_bsf.c index f5c513834a..006a3679e9 100644 --- a/libavcodec/mp3_header_compress_bsf.c +++ b/libavcodec/mp3_header_compress_bsf.c @@ -79,7 +79,7 @@ output_unchanged: return 1; } -AVBitStreamFilter mp3_header_compress_bsf={ +AVBitStreamFilter ff_mp3_header_compress_bsf={ "mp3comp", 0, mp3_header_compress, diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c index d897ed9852..f096d5e4fd 100644 --- a/libavcodec/mp3_header_decompress_bsf.c +++ b/libavcodec/mp3_header_decompress_bsf.c @@ -89,7 +89,7 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext return 1; } -AVBitStreamFilter mp3_header_decompress_bsf={ +AVBitStreamFilter ff_mp3_header_decompress_bsf={ "mp3decomp", 0, mp3_header_decompress, diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 5ac25797bb..a77648f770 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -288,7 +288,7 @@ static void mpc7_decode_flush(AVCodecContext *avctx) c->frames_to_skip = 32; } -AVCodec mpc7_decoder = { +AVCodec ff_mpc7_decoder = { "mpc7", AVMEDIA_TYPE_AUDIO, CODEC_ID_MUSEPACK7, diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index d8d62edd9c..327a0c02f4 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -404,7 +404,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, return c->cur_frame ? c->last_bits_used >> 3 : buf_size; } -AVCodec mpc8_decoder = { +AVCodec ff_mpc8_decoder = { "mpc8", AVMEDIA_TYPE_AUDIO, CODEC_ID_MUSEPACK8, diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 4aaa40290a..0645cde512 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2471,7 +2471,7 @@ static int mpeg_decode_end(AVCodecContext *avctx) return 0; } -AVCodec mpeg1video_decoder = { +AVCodec ff_mpeg1video_decoder = { "mpeg1video", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG1VIDEO, @@ -2486,7 +2486,7 @@ AVCodec mpeg1video_decoder = { .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"), }; -AVCodec mpeg2video_decoder = { +AVCodec ff_mpeg2video_decoder = { "mpeg2video", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO, @@ -2502,7 +2502,7 @@ AVCodec mpeg2video_decoder = { }; //legacy decoder -AVCodec mpegvideo_decoder = { +AVCodec ff_mpegvideo_decoder = { "mpegvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO, @@ -2534,7 +2534,7 @@ static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx){ return 0; } -AVCodec mpeg_xvmc_decoder = { +AVCodec ff_mpeg_xvmc_decoder = { "mpegvideo_xvmc", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO_XVMC, @@ -2551,7 +2551,7 @@ AVCodec mpeg_xvmc_decoder = { #endif #if CONFIG_MPEG_VDPAU_DECODER -AVCodec mpeg_vdpau_decoder = { +AVCodec ff_mpeg_vdpau_decoder = { "mpegvideo_vdpau", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO, @@ -2567,7 +2567,7 @@ AVCodec mpeg_vdpau_decoder = { #endif #if CONFIG_MPEG1_VDPAU_DECODER -AVCodec mpeg1_vdpau_decoder = { +AVCodec ff_mpeg1_vdpau_decoder = { "mpeg1video_vdpau", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG1VIDEO, diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 6868e2a206..877ec04251 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -930,7 +930,7 @@ static void mpeg1_encode_block(MpegEncContext *s, put_bits(&s->pb, table_vlc[112][1], table_vlc[112][0]); } -AVCodec mpeg1video_encoder = { +AVCodec ff_mpeg1video_encoder = { "mpeg1video", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG1VIDEO, @@ -944,7 +944,7 @@ AVCodec mpeg1video_encoder = { .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"), }; -AVCodec mpeg2video_encoder = { +AVCodec ff_mpeg2video_encoder = { "mpeg2video", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO, diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c index 5dbda8ba80..5d0f47ec13 100644 --- a/libavcodec/mpeg4video_parser.c +++ b/libavcodec/mpeg4video_parser.c @@ -129,7 +129,7 @@ static int mpeg4video_parse(AVCodecParserContext *s, } -AVCodecParser mpeg4video_parser = { +AVCodecParser ff_mpeg4video_parser = { { CODEC_ID_MPEG4 }, sizeof(ParseContext1), mpeg4video_parse_init, diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index d331f0ded0..5303da3874 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2225,7 +2225,7 @@ static av_cold int decode_init(AVCodecContext *avctx) return 0; } -AVCodec mpeg4_decoder = { +AVCodec ff_mpeg4_decoder = { "mpeg4", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG4, @@ -2243,7 +2243,7 @@ AVCodec mpeg4_decoder = { #if CONFIG_MPEG4_VDPAU_DECODER -AVCodec mpeg4_vdpau_decoder = { +AVCodec ff_mpeg4_vdpau_decoder = { "mpeg4_vdpau", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG4, diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 856cfa777e..2af898b955 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -1338,7 +1338,7 @@ void ff_mpeg4_encode_video_packet_header(MpegEncContext *s) put_bits(&s->pb, 1, 0); /* no HEC */ } -AVCodec mpeg4_encoder = { +AVCodec ff_mpeg4_encoder = { "mpeg4", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG4, diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c index 6d7ab8a9c1..cfd92d42eb 100644 --- a/libavcodec/mpegaudio_parser.c +++ b/libavcodec/mpegaudio_parser.c @@ -140,7 +140,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, } -AVCodecParser mpegaudio_parser = { +AVCodecParser ff_mpegaudio_parser = { { CODEC_ID_MP1, CODEC_ID_MP2, CODEC_ID_MP3 }, sizeof(MpegAudioParseContext), NULL, diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 769be89913..c174c0f9ed 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -2308,7 +2308,7 @@ static int decode_frame_mp3on4(AVCodecContext * avctx, #if !CONFIG_FLOAT #if CONFIG_MP1_DECODER -AVCodec mp1_decoder = +AVCodec ff_mp1_decoder = { "mp1", AVMEDIA_TYPE_AUDIO, @@ -2324,7 +2324,7 @@ AVCodec mp1_decoder = }; #endif #if CONFIG_MP2_DECODER -AVCodec mp2_decoder = +AVCodec ff_mp2_decoder = { "mp2", AVMEDIA_TYPE_AUDIO, @@ -2340,7 +2340,7 @@ AVCodec mp2_decoder = }; #endif #if CONFIG_MP3_DECODER -AVCodec mp3_decoder = +AVCodec ff_mp3_decoder = { "mp3", AVMEDIA_TYPE_AUDIO, @@ -2356,7 +2356,7 @@ AVCodec mp3_decoder = }; #endif #if CONFIG_MP3ADU_DECODER -AVCodec mp3adu_decoder = +AVCodec ff_mp3adu_decoder = { "mp3adu", AVMEDIA_TYPE_AUDIO, @@ -2372,7 +2372,7 @@ AVCodec mp3adu_decoder = }; #endif #if CONFIG_MP3ON4_DECODER -AVCodec mp3on4_decoder = +AVCodec ff_mp3on4_decoder = { "mp3on4", AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/mpegaudiodec_float.c b/libavcodec/mpegaudiodec_float.c index 9150b33ba2..758ef83e05 100644 --- a/libavcodec/mpegaudiodec_float.c +++ b/libavcodec/mpegaudiodec_float.c @@ -88,7 +88,7 @@ static av_cold int decode_end(AVCodecContext * avctx) } #if CONFIG_MP1FLOAT_DECODER -AVCodec mp1float_decoder = +AVCodec ff_mp1float_decoder = { "mp1float", AVMEDIA_TYPE_AUDIO, @@ -104,7 +104,7 @@ AVCodec mp1float_decoder = }; #endif #if CONFIG_MP2FLOAT_DECODER -AVCodec mp2float_decoder = +AVCodec ff_mp2float_decoder = { "mp2float", AVMEDIA_TYPE_AUDIO, @@ -120,7 +120,7 @@ AVCodec mp2float_decoder = }; #endif #if CONFIG_MP3FLOAT_DECODER -AVCodec mp3float_decoder = +AVCodec ff_mp3float_decoder = { "mp3float", AVMEDIA_TYPE_AUDIO, @@ -136,7 +136,7 @@ AVCodec mp3float_decoder = }; #endif #if CONFIG_MP3ADUFLOAT_DECODER -AVCodec mp3adufloat_decoder = +AVCodec ff_mp3adufloat_decoder = { "mp3adufloat", AVMEDIA_TYPE_AUDIO, @@ -152,7 +152,7 @@ AVCodec mp3adufloat_decoder = }; #endif #if CONFIG_MP3ON4FLOAT_DECODER -AVCodec mp3on4float_decoder = +AVCodec ff_mp3on4float_decoder = { "mp3on4float", AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 736cbe1219..9458af5b37 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -783,7 +783,7 @@ static av_cold int MPA_encode_close(AVCodecContext *avctx) return 0; } -AVCodec mp2_encoder = { +AVCodec ff_mp2_encoder = { "mp2", AVMEDIA_TYPE_AUDIO, CODEC_ID_MP2, diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ef830affd7..fa285ca371 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -3779,7 +3779,7 @@ int dct_quantize_c(MpegEncContext *s, return last_non_zero; } -AVCodec h263_encoder = { +AVCodec ff_h263_encoder = { "h263", AVMEDIA_TYPE_VIDEO, CODEC_ID_H263, @@ -3791,7 +3791,7 @@ AVCodec h263_encoder = { .long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996"), }; -AVCodec h263p_encoder = { +AVCodec ff_h263p_encoder = { "h263p", AVMEDIA_TYPE_VIDEO, CODEC_ID_H263P, @@ -3803,7 +3803,7 @@ AVCodec h263p_encoder = { .long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"), }; -AVCodec msmpeg4v1_encoder = { +AVCodec ff_msmpeg4v1_encoder = { "msmpeg4v1", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSMPEG4V1, @@ -3815,7 +3815,7 @@ AVCodec msmpeg4v1_encoder = { .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"), }; -AVCodec msmpeg4v2_encoder = { +AVCodec ff_msmpeg4v2_encoder = { "msmpeg4v2", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSMPEG4V2, @@ -3827,7 +3827,7 @@ AVCodec msmpeg4v2_encoder = { .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"), }; -AVCodec msmpeg4v3_encoder = { +AVCodec ff_msmpeg4v3_encoder = { "msmpeg4", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSMPEG4V3, @@ -3839,7 +3839,7 @@ AVCodec msmpeg4v3_encoder = { .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"), }; -AVCodec wmv1_encoder = { +AVCodec ff_wmv1_encoder = { "wmv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_WMV1, diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 546c3bdad7..6369224d1a 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -176,7 +176,7 @@ static int mpegvideo_split(AVCodecContext *avctx, return 0; } -AVCodecParser mpegvideo_parser = { +AVCodecParser ff_mpegvideo_parser = { { CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO }, sizeof(ParseContext1), NULL, diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 79a96e4a6c..8b3b6a56b6 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -1908,7 +1908,7 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s, return 0; } -AVCodec msmpeg4v1_decoder = { +AVCodec ff_msmpeg4v1_decoder = { "msmpeg4v1", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSMPEG4V1, @@ -1923,7 +1923,7 @@ AVCodec msmpeg4v1_decoder = { .pix_fmts= ff_pixfmt_list_420, }; -AVCodec msmpeg4v2_decoder = { +AVCodec ff_msmpeg4v2_decoder = { "msmpeg4v2", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSMPEG4V2, @@ -1938,7 +1938,7 @@ AVCodec msmpeg4v2_decoder = { .pix_fmts= ff_pixfmt_list_420, }; -AVCodec msmpeg4v3_decoder = { +AVCodec ff_msmpeg4v3_decoder = { "msmpeg4", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSMPEG4V3, @@ -1953,7 +1953,7 @@ AVCodec msmpeg4v3_decoder = { .pix_fmts= ff_pixfmt_list_420, }; -AVCodec wmv1_decoder = { +AVCodec ff_wmv1_decoder = { "wmv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_WMV1, diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 28eb5d33f1..f1fa8f54ff 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -143,7 +143,7 @@ static av_cold int msrle_decode_end(AVCodecContext *avctx) return 0; } -AVCodec msrle_decoder = { +AVCodec ff_msrle_decoder = { "msrle", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSRLE, diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c index 30aca3954e..d40304df3a 100644 --- a/libavcodec/msvideo1.c +++ b/libavcodec/msvideo1.c @@ -331,7 +331,7 @@ static av_cold int msvideo1_decode_end(AVCodecContext *avctx) return 0; } -AVCodec msvideo1_decoder = { +AVCodec ff_msvideo1_decoder = { "msvideo1", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSVIDEO1, diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index c2cbe9562c..89dde91248 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -196,7 +196,7 @@ static av_cold int decode_end(AVCodecContext * avctx) { return 0; } -AVCodec nellymoser_decoder = { +AVCodec ff_nellymoser_decoder = { "nellymoser", AVMEDIA_TYPE_AUDIO, CODEC_ID_NELLYMOSER, diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index 03b647e297..9b792ff2ac 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -382,7 +382,7 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size, voi return 0; } -AVCodec nellymoser_encoder = { +AVCodec ff_nellymoser_encoder = { .name = "nellymoser", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_NELLYMOSER, diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c index c49dd1f9d9..491fbccc1d 100644 --- a/libavcodec/noise_bsf.c +++ b/libavcodec/noise_bsf.c @@ -39,7 +39,7 @@ static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const ch return 1; } -AVBitStreamFilter noise_bsf={ +AVBitStreamFilter ff_noise_bsf={ "noise", sizeof(int), noise, diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c index d65799ee1e..d53d4578ba 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -272,7 +272,7 @@ static av_cold int decode_end(AVCodecContext *avctx) { return 0; } -AVCodec nuv_decoder = { +AVCodec ff_nuv_decoder = { "nuv", AVMEDIA_TYPE_VIDEO, CODEC_ID_NUV, diff --git a/libavcodec/pamenc.c b/libavcodec/pamenc.c index ae0ea3a102..9f50d7fbfa 100644 --- a/libavcodec/pamenc.c +++ b/libavcodec/pamenc.c @@ -108,7 +108,7 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, } -AVCodec pam_encoder = { +AVCodec ff_pam_encoder = { "pam", AVMEDIA_TYPE_VIDEO, CODEC_ID_PAM, diff --git a/libavcodec/pcm-mpeg.c b/libavcodec/pcm-mpeg.c index cf2792b593..65ba4903b8 100644 --- a/libavcodec/pcm-mpeg.c +++ b/libavcodec/pcm-mpeg.c @@ -296,7 +296,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, return retval; } -AVCodec pcm_bluray_decoder = { +AVCodec ff_pcm_bluray_decoder = { "pcm_bluray", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_BLURAY, diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 3e985ce04f..0785a9d2ab 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -473,7 +473,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, #if CONFIG_ENCODERS #define PCM_ENCODER(id_,sample_fmt_,name_,long_name_) \ -AVCodec name_ ## _encoder = { \ +AVCodec ff_ ## name_ ## _encoder = { \ .name = #name_, \ .type = AVMEDIA_TYPE_AUDIO, \ .id = id_, \ @@ -489,7 +489,7 @@ AVCodec name_ ## _encoder = { \ #if CONFIG_DECODERS #define PCM_DECODER(id_,sample_fmt_,name_,long_name_) \ -AVCodec name_ ## _decoder = { \ +AVCodec ff_ ## name_ ## _decoder = { \ .name = #name_, \ .type = AVMEDIA_TYPE_AUDIO, \ .id = id_, \ diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index c1b67cdee9..cafade2d7d 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -247,7 +247,7 @@ static av_cold int pcx_end(AVCodecContext *avctx) { return 0; } -AVCodec pcx_decoder = { +AVCodec ff_pcx_decoder = { "pcx", AVMEDIA_TYPE_VIDEO, CODEC_ID_PCX, diff --git a/libavcodec/pcxenc.c b/libavcodec/pcxenc.c index e01727f3e7..124516b957 100644 --- a/libavcodec/pcxenc.c +++ b/libavcodec/pcxenc.c @@ -189,7 +189,7 @@ static int pcx_encode_frame(AVCodecContext *avctx, return buf - buf_start; } -AVCodec pcx_encoder = { +AVCodec ff_pcx_encoder = { "pcx", AVMEDIA_TYPE_VIDEO, CODEC_ID_PCX, diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 9ee1ded541..4e02dea167 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -473,7 +473,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, return buf_size; } -AVCodec pgssub_decoder = { +AVCodec ff_pgssub_decoder = { "pgssub", AVMEDIA_TYPE_SUBTITLE, CODEC_ID_HDMV_PGS_SUBTITLE, diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index 04667f61f2..59885ae383 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -237,7 +237,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec pictor_decoder = { +AVCodec ff_pictor_decoder = { "pictor", AVMEDIA_TYPE_VIDEO, CODEC_ID_PICTOR, diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index eb8989f160..03cd784bbf 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -657,7 +657,7 @@ static av_cold int png_dec_end(AVCodecContext *avctx) return 0; } -AVCodec png_decoder = { +AVCodec ff_png_decoder = { "png", AVMEDIA_TYPE_VIDEO, CODEC_ID_PNG, diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index d199b95da9..4cb56337e7 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -436,7 +436,7 @@ static av_cold int png_enc_init(AVCodecContext *avctx){ return 0; } -AVCodec png_encoder = { +AVCodec ff_png_encoder = { "png", AVMEDIA_TYPE_VIDEO, CODEC_ID_PNG, diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c index b8ba1a836c..17e8082609 100644 --- a/libavcodec/pnm_parser.c +++ b/libavcodec/pnm_parser.c @@ -83,7 +83,7 @@ retry: return next; } -AVCodecParser pnm_parser = { +AVCodecParser ff_pnm_parser = { { CODEC_ID_PGM, CODEC_ID_PGMYUV, CODEC_ID_PPM, CODEC_ID_PBM, CODEC_ID_PAM}, sizeof(ParseContext), NULL, diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c index 6bea93de02..39faab7be2 100644 --- a/libavcodec/pnmdec.c +++ b/libavcodec/pnmdec.c @@ -188,7 +188,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data, #if CONFIG_PGM_DECODER -AVCodec pgm_decoder = { +AVCodec ff_pgm_decoder = { "pgm", AVMEDIA_TYPE_VIDEO, CODEC_ID_PGM, @@ -205,7 +205,7 @@ AVCodec pgm_decoder = { #endif #if CONFIG_PGMYUV_DECODER -AVCodec pgmyuv_decoder = { +AVCodec ff_pgmyuv_decoder = { "pgmyuv", AVMEDIA_TYPE_VIDEO, CODEC_ID_PGMYUV, @@ -222,7 +222,7 @@ AVCodec pgmyuv_decoder = { #endif #if CONFIG_PPM_DECODER -AVCodec ppm_decoder = { +AVCodec ff_ppm_decoder = { "ppm", AVMEDIA_TYPE_VIDEO, CODEC_ID_PPM, @@ -239,7 +239,7 @@ AVCodec ppm_decoder = { #endif #if CONFIG_PBM_DECODER -AVCodec pbm_decoder = { +AVCodec ff_pbm_decoder = { "pbm", AVMEDIA_TYPE_VIDEO, CODEC_ID_PBM, @@ -256,7 +256,7 @@ AVCodec pbm_decoder = { #endif #if CONFIG_PAM_DECODER -AVCodec pam_decoder = { +AVCodec ff_pam_decoder = { "pam", AVMEDIA_TYPE_VIDEO, CODEC_ID_PAM, diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c index 1fbf665883..4dbd587e1a 100644 --- a/libavcodec/pnmenc.c +++ b/libavcodec/pnmenc.c @@ -113,7 +113,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, #if CONFIG_PGM_ENCODER -AVCodec pgm_encoder = { +AVCodec ff_pgm_encoder = { "pgm", AVMEDIA_TYPE_VIDEO, CODEC_ID_PGM, @@ -126,7 +126,7 @@ AVCodec pgm_encoder = { #endif #if CONFIG_PGMYUV_ENCODER -AVCodec pgmyuv_encoder = { +AVCodec ff_pgmyuv_encoder = { "pgmyuv", AVMEDIA_TYPE_VIDEO, CODEC_ID_PGMYUV, @@ -139,7 +139,7 @@ AVCodec pgmyuv_encoder = { #endif #if CONFIG_PPM_ENCODER -AVCodec ppm_encoder = { +AVCodec ff_ppm_encoder = { "ppm", AVMEDIA_TYPE_VIDEO, CODEC_ID_PPM, @@ -152,7 +152,7 @@ AVCodec ppm_encoder = { #endif #if CONFIG_PBM_ENCODER -AVCodec pbm_encoder = { +AVCodec ff_pbm_encoder = { "pbm", AVMEDIA_TYPE_VIDEO, CODEC_ID_PBM, diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index a0644259fc..86b06b4aaa 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -106,7 +106,7 @@ static av_cold int ptx_end(AVCodecContext *avctx) { return 0; } -AVCodec ptx_decoder = { +AVCodec ff_ptx_decoder = { "ptx", AVMEDIA_TYPE_VIDEO, CODEC_ID_PTX, diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c index 22b90ceb80..3ed821c81e 100644 --- a/libavcodec/qcelpdec.c +++ b/libavcodec/qcelpdec.c @@ -842,7 +842,7 @@ erasure: return *data_size; } -AVCodec qcelp_decoder = +AVCodec ff_qcelp_decoder = { .name = "qcelp", .type = AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index a5fa28dc9d..3779b8e3aa 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1974,7 +1974,7 @@ static int qdm2_decode_frame(AVCodecContext *avctx, return s->checksum_size; } -AVCodec qdm2_decoder = +AVCodec ff_qdm2_decoder = { .name = "qdm2", .type = AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index 57500580e2..be47b4228b 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -150,7 +150,7 @@ static av_cold int decode_end(AVCodecContext *avctx){ return 0; } -AVCodec qdraw_decoder = { +AVCodec ff_qdraw_decoder = { "qdraw", AVMEDIA_TYPE_VIDEO, CODEC_ID_QDRAW, diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index e6a0b30aef..e4c2291f39 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -311,7 +311,7 @@ static av_cold int decode_end(AVCodecContext *avctx){ return 0; } -AVCodec qpeg_decoder = { +AVCodec ff_qpeg_decoder = { "qpeg", AVMEDIA_TYPE_VIDEO, CODEC_ID_QPEG, diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index 1fd9a803e4..8ad6778299 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -537,7 +537,7 @@ static av_cold int qtrle_decode_end(AVCodecContext *avctx) return 0; } -AVCodec qtrle_decoder = { +AVCodec ff_qtrle_decoder = { "qtrle", AVMEDIA_TYPE_VIDEO, CODEC_ID_QTRLE, diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c index aea0f68a64..78149e5ed8 100644 --- a/libavcodec/qtrleenc.c +++ b/libavcodec/qtrleenc.c @@ -321,7 +321,7 @@ static av_cold int qtrle_encode_end(AVCodecContext *avctx) return 0; } -AVCodec qtrle_encoder = { +AVCodec ff_qtrle_encoder = { "qtrle", AVMEDIA_TYPE_VIDEO, CODEC_ID_QTRLE, diff --git a/libavcodec/r210dec.c b/libavcodec/r210dec.c index b1fe62d725..a5222b17fc 100644 --- a/libavcodec/r210dec.c +++ b/libavcodec/r210dec.c @@ -97,7 +97,7 @@ static av_cold int decode_close(AVCodecContext *avctx) } #if CONFIG_R210_DECODER -AVCodec r210_decoder = { +AVCodec ff_r210_decoder = { "r210", AVMEDIA_TYPE_VIDEO, CODEC_ID_R210, @@ -111,7 +111,7 @@ AVCodec r210_decoder = { }; #endif #if CONFIG_R10K_DECODER -AVCodec r10k_decoder = { +AVCodec ff_r10k_decoder = { "r10k", AVMEDIA_TYPE_VIDEO, CODEC_ID_R10K, diff --git a/libavcodec/ra144dec.c b/libavcodec/ra144dec.c index 2c022b1417..53f529d6b4 100644 --- a/libavcodec/ra144dec.c +++ b/libavcodec/ra144dec.c @@ -114,7 +114,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *vdata, return 20; } -AVCodec ra_144_decoder = +AVCodec ff_ra_144_decoder = { "real_144", AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index 2c0a6b1fbd..a0912056d7 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -508,7 +508,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame, } -AVCodec ra_144_encoder = +AVCodec ff_ra_144_encoder = { "real_144", AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index 03cf18fff0..9445e7088e 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -203,7 +203,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data, return avctx->block_align; } -AVCodec ra_288_decoder = +AVCodec ff_ra_288_decoder = { "real_288", AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index c6642077f6..c2ca91d64f 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -195,7 +195,7 @@ static av_cold int raw_close_decoder(AVCodecContext *avctx) return 0; } -AVCodec rawvideo_decoder = { +AVCodec ff_rawvideo_decoder = { "rawvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_RAWVIDEO, diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c index 419970486b..630df0f723 100644 --- a/libavcodec/rawenc.c +++ b/libavcodec/rawenc.c @@ -55,7 +55,7 @@ static int raw_encode(AVCodecContext *avctx, return ret; } -AVCodec rawvideo_encoder = { +AVCodec ff_rawvideo_encoder = { "rawvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_RAWVIDEO, diff --git a/libavcodec/remove_extradata_bsf.c b/libavcodec/remove_extradata_bsf.c index 95bd98bef2..f0d9b4513a 100644 --- a/libavcodec/remove_extradata_bsf.c +++ b/libavcodec/remove_extradata_bsf.c @@ -48,7 +48,7 @@ static int remove_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avct return 0; } -AVBitStreamFilter remove_extradata_bsf={ +AVBitStreamFilter ff_remove_extradata_bsf={ "remove_extra", 0, remove_extradata, diff --git a/libavcodec/rl2.c b/libavcodec/rl2.c index ba99fb91b8..19104144a2 100644 --- a/libavcodec/rl2.c +++ b/libavcodec/rl2.c @@ -219,7 +219,7 @@ static av_cold int rl2_decode_end(AVCodecContext *avctx) } -AVCodec rl2_decoder = { +AVCodec ff_rl2_decoder = { "rl2", AVMEDIA_TYPE_VIDEO, CODEC_ID_RL2, diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c index 229b546649..f6bd726c4f 100644 --- a/libavcodec/roqaudioenc.c +++ b/libavcodec/roqaudioenc.c @@ -153,7 +153,7 @@ static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx) return 0; } -AVCodec roq_dpcm_encoder = { +AVCodec ff_roq_dpcm_encoder = { "roq_dpcm", AVMEDIA_TYPE_AUDIO, CODEC_ID_ROQ_DPCM, diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c index 7c6f5ff6fb..4959239ba7 100644 --- a/libavcodec/roqvideodec.c +++ b/libavcodec/roqvideodec.c @@ -210,7 +210,7 @@ static av_cold int roq_decode_end(AVCodecContext *avctx) return 0; } -AVCodec roq_decoder = { +AVCodec ff_roq_decoder = { "roqvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_ROQ, diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index 28fd9d8512..0efbca8742 100644 --- a/libavcodec/roqvideoenc.c +++ b/libavcodec/roqvideoenc.c @@ -1054,7 +1054,7 @@ static int roq_encode_end(AVCodecContext *avctx) return 0; } -AVCodec roq_encoder = +AVCodec ff_roq_encoder = { "roqvideo", AVMEDIA_TYPE_VIDEO, diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c index e103f525d2..6a79d97e86 100644 --- a/libavcodec/rpza.c +++ b/libavcodec/rpza.c @@ -275,7 +275,7 @@ static av_cold int rpza_decode_end(AVCodecContext *avctx) return 0; } -AVCodec rpza_decoder = { +AVCodec ff_rpza_decoder = { "rpza", AVMEDIA_TYPE_VIDEO, CODEC_ID_RPZA, diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index b6d87f4f09..cb304fb01c 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -707,7 +707,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, return buf_size; } -AVCodec rv10_decoder = { +AVCodec ff_rv10_decoder = { "rv10", AVMEDIA_TYPE_VIDEO, CODEC_ID_RV10, @@ -722,7 +722,7 @@ AVCodec rv10_decoder = { .pix_fmts= ff_pixfmt_list_420, }; -AVCodec rv20_decoder = { +AVCodec ff_rv20_decoder = { "rv20", AVMEDIA_TYPE_VIDEO, CODEC_ID_RV20, diff --git a/libavcodec/rv10enc.c b/libavcodec/rv10enc.c index 51ca69118a..206fe13225 100644 --- a/libavcodec/rv10enc.c +++ b/libavcodec/rv10enc.c @@ -56,7 +56,7 @@ void rv10_encode_picture_header(MpegEncContext *s, int picture_number) put_bits(&s->pb, 3, 0); /* ignored */ } -AVCodec rv10_encoder = { +AVCodec ff_rv10_encoder = { "rv10", AVMEDIA_TYPE_VIDEO, CODEC_ID_RV10, diff --git a/libavcodec/rv20enc.c b/libavcodec/rv20enc.c index a31a351a89..fe26dd486d 100644 --- a/libavcodec/rv20enc.c +++ b/libavcodec/rv20enc.c @@ -57,7 +57,7 @@ void rv20_encode_picture_header(MpegEncContext *s, int picture_number){ } } -AVCodec rv20_encoder = { +AVCodec ff_rv20_encoder = { "rv20", AVMEDIA_TYPE_VIDEO, CODEC_ID_RV20, diff --git a/libavcodec/rv30.c b/libavcodec/rv30.c index 22a5dd5b64..38b600af80 100644 --- a/libavcodec/rv30.c +++ b/libavcodec/rv30.c @@ -266,7 +266,7 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx) return 0; } -AVCodec rv30_decoder = { +AVCodec ff_rv30_decoder = { "rv30", AVMEDIA_TYPE_VIDEO, CODEC_ID_RV30, diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c index e236c8fa05..acebeb7da5 100644 --- a/libavcodec/rv40.c +++ b/libavcodec/rv40.c @@ -668,7 +668,7 @@ static av_cold int rv40_decode_init(AVCodecContext *avctx) return 0; } -AVCodec rv40_decoder = { +AVCodec ff_rv40_decoder = { "rv40", AVMEDIA_TYPE_VIDEO, CODEC_ID_RV40, diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index 3c199e215e..ac2adfe7ca 100644 --- a/libavcodec/sgidec.c +++ b/libavcodec/sgidec.c @@ -259,7 +259,7 @@ static av_cold int sgi_end(AVCodecContext *avctx) return 0; } -AVCodec sgi_decoder = { +AVCodec ff_sgi_decoder = { "sgi", AVMEDIA_TYPE_VIDEO, CODEC_ID_SGI, diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c index f9f3709788..eafb655b46 100644 --- a/libavcodec/sgienc.c +++ b/libavcodec/sgienc.c @@ -159,7 +159,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, return buf - orig_buf; } -AVCodec sgi_encoder = { +AVCodec ff_sgi_encoder = { "sgi", AVMEDIA_TYPE_VIDEO, CODEC_ID_SGI, diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index f61c2631e6..cff4cc886f 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -541,7 +541,7 @@ static void shorten_flush(AVCodecContext *avctx){ s->bitstream_index= 0; } -AVCodec shorten_decoder = { +AVCodec ff_shorten_decoder = { "shorten", AVMEDIA_TYPE_AUDIO, CODEC_ID_SHORTEN, diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c index 08224568aa..b96e3b9024 100644 --- a/libavcodec/sipr.c +++ b/libavcodec/sipr.c @@ -549,7 +549,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap, return mode_par->bits_per_frame >> 3; } -AVCodec sipr_decoder = { +AVCodec ff_sipr_decoder = { "sipr", AVMEDIA_TYPE_AUDIO, CODEC_ID_SIPR, diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 38ca61c9c7..2fcc33511f 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -689,7 +689,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, return buf_size; } -AVCodec smacker_decoder = { +AVCodec ff_smacker_decoder = { "smackvid", AVMEDIA_TYPE_VIDEO, CODEC_ID_SMACKVIDEO, @@ -702,7 +702,7 @@ AVCodec smacker_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Smacker video"), }; -AVCodec smackaud_decoder = { +AVCodec ff_smackaud_decoder = { "smackaud", AVMEDIA_TYPE_AUDIO, CODEC_ID_SMACKAUDIO, diff --git a/libavcodec/smc.c b/libavcodec/smc.c index 2e2dffdc86..f8b994c1d1 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -471,7 +471,7 @@ static av_cold int smc_decode_end(AVCodecContext *avctx) return 0; } -AVCodec smc_decoder = { +AVCodec ff_smc_decoder = { "smc", AVMEDIA_TYPE_VIDEO, CODEC_ID_SMC, diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 18039d2295..8a259af4dd 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -2234,7 +2234,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec snow_decoder = { +AVCodec ff_snow_decoder = { "snow", AVMEDIA_TYPE_VIDEO, CODEC_ID_SNOW, @@ -3985,7 +3985,7 @@ static av_cold int encode_end(AVCodecContext *avctx) return 0; } -AVCodec snow_encoder = { +AVCodec ff_snow_encoder = { "snow", AVMEDIA_TYPE_VIDEO, CODEC_ID_SNOW, diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index aff155d57f..8dfac1a6fa 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -935,7 +935,7 @@ static int sonic_decode_frame(AVCodecContext *avctx, return (get_bits_count(&gb)+7)/8; } -AVCodec sonic_decoder = { +AVCodec ff_sonic_decoder = { "sonic", AVMEDIA_TYPE_AUDIO, CODEC_ID_SONIC, @@ -949,7 +949,7 @@ AVCodec sonic_decoder = { #endif /* CONFIG_SONIC_DECODER */ #if CONFIG_SONIC_ENCODER -AVCodec sonic_encoder = { +AVCodec ff_sonic_encoder = { "sonic", AVMEDIA_TYPE_AUDIO, CODEC_ID_SONIC, @@ -963,7 +963,7 @@ AVCodec sonic_encoder = { #endif #if CONFIG_SONIC_LS_ENCODER -AVCodec sonic_ls_encoder = { +AVCodec ff_sonic_ls_encoder = { "sonicls", AVMEDIA_TYPE_AUDIO, CODEC_ID_SONIC_LS, diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c index 67fbaf462a..8bcdbe41b4 100644 --- a/libavcodec/sp5xdec.c +++ b/libavcodec/sp5xdec.c @@ -97,7 +97,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx, return i; } -AVCodec sp5x_decoder = { +AVCodec ff_sp5x_decoder = { "sp5x", AVMEDIA_TYPE_VIDEO, CODEC_ID_SP5X, @@ -112,7 +112,7 @@ AVCodec sp5x_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"), }; -AVCodec amv_decoder = { +AVCodec ff_amv_decoder = { "amv", AVMEDIA_TYPE_VIDEO, CODEC_ID_AMV, diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c index adbae514c7..30fdc12fe7 100644 --- a/libavcodec/srtdec.c +++ b/libavcodec/srtdec.c @@ -231,7 +231,7 @@ static int srt_decode_frame(AVCodecContext *avctx, return avpkt->size; } -AVCodec srt_decoder = { +AVCodec ff_srt_decoder = { .name = "srt", .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"), .type = AVMEDIA_TYPE_SUBTITLE, diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c index 0696a53f15..76b65b356c 100644 --- a/libavcodec/sunrast.c +++ b/libavcodec/sunrast.c @@ -184,7 +184,7 @@ static av_cold int sunrast_end(AVCodecContext *avctx) { return 0; } -AVCodec sunrast_decoder = { +AVCodec ff_sunrast_decoder = { "sunrast", AVMEDIA_TYPE_VIDEO, CODEC_ID_SUNRAST, diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c index 1d40f596ad..eb7100713e 100644 --- a/libavcodec/svq1dec.c +++ b/libavcodec/svq1dec.c @@ -833,7 +833,7 @@ static av_cold int svq1_decode_end(AVCodecContext *avctx) } -AVCodec svq1_decoder = { +AVCodec ff_svq1_decoder = { "svq1", AVMEDIA_TYPE_VIDEO, CODEC_ID_SVQ1, diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index c89be259d7..a415d843d2 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -572,7 +572,7 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx) } -AVCodec svq1_encoder = { +AVCodec ff_svq1_encoder = { "svq1", AVMEDIA_TYPE_VIDEO, CODEC_ID_SVQ1, diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index a52744228e..9d87710595 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -1062,7 +1062,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, } -AVCodec svq3_decoder = { +AVCodec ff_svq3_decoder = { "svq3", AVMEDIA_TYPE_VIDEO, CODEC_ID_SVQ3, diff --git a/libavcodec/targa.c b/libavcodec/targa.c index 7f8774ef54..e6e1ca6f21 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -235,7 +235,7 @@ static av_cold int targa_end(AVCodecContext *avctx){ return 0; } -AVCodec targa_decoder = { +AVCodec ff_targa_decoder = { "targa", AVMEDIA_TYPE_VIDEO, CODEC_ID_TARGA, diff --git a/libavcodec/targaenc.c b/libavcodec/targaenc.c index 09da7270bb..5c5fd008c1 100644 --- a/libavcodec/targaenc.c +++ b/libavcodec/targaenc.c @@ -158,7 +158,7 @@ static av_cold int targa_encode_init(AVCodecContext *avctx) return 0; } -AVCodec targa_encoder = { +AVCodec ff_targa_encoder = { .name = "targa", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_TARGA, diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c index c5f632e186..c8aa38cca9 100644 --- a/libavcodec/tiertexseqv.c +++ b/libavcodec/tiertexseqv.c @@ -219,7 +219,7 @@ static av_cold int seqvideo_decode_end(AVCodecContext *avctx) return 0; } -AVCodec tiertexseqvideo_decoder = { +AVCodec ff_tiertexseqvideo_decoder = { "tiertexseqvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_TIERTEXSEQVIDEO, diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index f5d922a980..b012baa994 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -600,7 +600,7 @@ static av_cold int tiff_end(AVCodecContext *avctx) return 0; } -AVCodec tiff_decoder = { +AVCodec ff_tiff_decoder = { "tiff", AVMEDIA_TYPE_VIDEO, CODEC_ID_TIFF, diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index 0905ceae19..293ec0ac65 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -442,7 +442,7 @@ fail: return ret; } -AVCodec tiff_encoder = { +AVCodec ff_tiff_encoder = { "tiff", AVMEDIA_TYPE_VIDEO, CODEC_ID_TIFF, diff --git a/libavcodec/tmv.c b/libavcodec/tmv.c index 7e0f9a1361..62b6e19de1 100644 --- a/libavcodec/tmv.c +++ b/libavcodec/tmv.c @@ -92,7 +92,7 @@ static av_cold int tmv_decode_close(AVCodecContext *avctx) return 0; } -AVCodec tmv_decoder = { +AVCodec ff_tmv_decoder = { .name = "tmv", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_TMV, diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index 338b4dcc19..448da84c57 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -891,7 +891,7 @@ static av_cold int truemotion1_decode_end(AVCodecContext *avctx) return 0; } -AVCodec truemotion1_decoder = { +AVCodec ff_truemotion1_decoder = { "truemotion1", AVMEDIA_TYPE_VIDEO, CODEC_ID_TRUEMOTION1, diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index f4e3074c28..d20ee94b29 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -881,7 +881,7 @@ static av_cold int decode_end(AVCodecContext *avctx){ return 0; } -AVCodec truemotion2_decoder = { +AVCodec ff_truemotion2_decoder = { "truemotion2", AVMEDIA_TYPE_VIDEO, CODEC_ID_TRUEMOTION2, diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c index 6bc1e7b1d8..d903a0119e 100644 --- a/libavcodec/truespeech.c +++ b/libavcodec/truespeech.c @@ -381,7 +381,7 @@ static int truespeech_decode_frame(AVCodecContext *avctx, return consumed; } -AVCodec truespeech_decoder = { +AVCodec ff_truespeech_decoder = { "truespeech", AVMEDIA_TYPE_AUDIO, CODEC_ID_TRUESPEECH, diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index 2b717c1481..9de53a7267 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -197,7 +197,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec tscc_decoder = { +AVCodec ff_tscc_decoder = { "camtasia", AVMEDIA_TYPE_VIDEO, CODEC_ID_TSCC, diff --git a/libavcodec/tta.c b/libavcodec/tta.c index dad9933b0e..936dff2333 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -456,7 +456,7 @@ static av_cold int tta_decode_close(AVCodecContext *avctx) { return 0; } -AVCodec tta_decoder = { +AVCodec ff_tta_decoder = { "tta", AVMEDIA_TYPE_AUDIO, CODEC_ID_TTA, diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index 15907aebcf..8334e83d7f 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -1119,7 +1119,7 @@ static av_cold int twin_decode_close(AVCodecContext *avctx) return 0; } -AVCodec twinvq_decoder = +AVCodec ff_twinvq_decoder = { "twinvq", AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/txd.c b/libavcodec/txd.c index e7d3379391..b394e1f5be 100644 --- a/libavcodec/txd.c +++ b/libavcodec/txd.c @@ -155,7 +155,7 @@ static av_cold int txd_end(AVCodecContext *avctx) { return 0; } -AVCodec txd_decoder = { +AVCodec ff_txd_decoder = { "txd", AVMEDIA_TYPE_VIDEO, CODEC_ID_TXD, diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c index 1d04c807fb..bb1270f055 100644 --- a/libavcodec/ulti.c +++ b/libavcodec/ulti.c @@ -404,7 +404,7 @@ static int ulti_decode_frame(AVCodecContext *avctx, return buf_size; } -AVCodec ulti_decoder = { +AVCodec ff_ulti_decoder = { "ultimotion", AVMEDIA_TYPE_VIDEO, CODEC_ID_ULTI, diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c index 61e9566c87..97ef594666 100644 --- a/libavcodec/v210dec.c +++ b/libavcodec/v210dec.c @@ -120,7 +120,7 @@ static av_cold int decode_close(AVCodecContext *avctx) return 0; } -AVCodec v210_decoder = { +AVCodec ff_v210_decoder = { "v210", AVMEDIA_TYPE_VIDEO, CODEC_ID_V210, diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c index 11e0e0eb7a..39f672d22b 100644 --- a/libavcodec/v210enc.c +++ b/libavcodec/v210enc.c @@ -117,7 +117,7 @@ static av_cold int encode_close(AVCodecContext *avctx) return 0; } -AVCodec v210_encoder = { +AVCodec ff_v210_encoder = { "v210", AVMEDIA_TYPE_VIDEO, CODEC_ID_V210, diff --git a/libavcodec/v210x.c b/libavcodec/v210x.c index 6b93a056f9..0d6a681b78 100644 --- a/libavcodec/v210x.c +++ b/libavcodec/v210x.c @@ -132,7 +132,7 @@ static av_cold int decode_close(AVCodecContext *avctx) return 0; } -AVCodec v210x_decoder = { +AVCodec ff_v210x_decoder = { "v210x", AVMEDIA_TYPE_VIDEO, CODEC_ID_V210X, diff --git a/libavcodec/vb.c b/libavcodec/vb.c index 13c4b0a8d9..fc79f5d586 100644 --- a/libavcodec/vb.c +++ b/libavcodec/vb.c @@ -287,7 +287,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec vb_decoder = { +AVCodec ff_vb_decoder = { "vb", AVMEDIA_TYPE_VIDEO, CODEC_ID_VB, diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c index 6e559dec9b..98caa2048d 100644 --- a/libavcodec/vc1_parser.c +++ b/libavcodec/vc1_parser.c @@ -169,7 +169,7 @@ static int vc1_split(AVCodecContext *avctx, return 0; } -AVCodecParser vc1_parser = { +AVCodecParser ff_vc1_parser = { { CODEC_ID_VC1 }, sizeof(VC1ParseContext), NULL, diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index c9a547b615..056b435055 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -3345,7 +3345,7 @@ static av_cold int vc1_decode_end(AVCodecContext *avctx) } -AVCodec vc1_decoder = { +AVCodec ff_vc1_decoder = { "vc1", AVMEDIA_TYPE_VIDEO, CODEC_ID_VC1, @@ -3361,7 +3361,7 @@ AVCodec vc1_decoder = { }; #if CONFIG_WMV3_DECODER -AVCodec wmv3_decoder = { +AVCodec ff_wmv3_decoder = { "wmv3", AVMEDIA_TYPE_VIDEO, CODEC_ID_WMV3, @@ -3378,7 +3378,7 @@ AVCodec wmv3_decoder = { #endif #if CONFIG_WMV3_VDPAU_DECODER -AVCodec wmv3_vdpau_decoder = { +AVCodec ff_wmv3_vdpau_decoder = { "wmv3_vdpau", AVMEDIA_TYPE_VIDEO, CODEC_ID_WMV3, @@ -3395,7 +3395,7 @@ AVCodec wmv3_vdpau_decoder = { #endif #if CONFIG_VC1_VDPAU_DECODER -AVCodec vc1_vdpau_decoder = { +AVCodec ff_vc1_vdpau_decoder = { "vc1_vdpau", AVMEDIA_TYPE_VIDEO, CODEC_ID_VC1, diff --git a/libavcodec/vcr1.c b/libavcodec/vcr1.c index 31da94f3d0..9a9c439881 100644 --- a/libavcodec/vcr1.c +++ b/libavcodec/vcr1.c @@ -176,7 +176,7 @@ static av_cold int encode_init(AVCodecContext *avctx){ } #endif -AVCodec vcr1_decoder = { +AVCodec ff_vcr1_decoder = { "vcr1", AVMEDIA_TYPE_VIDEO, CODEC_ID_VCR1, @@ -190,7 +190,7 @@ AVCodec vcr1_decoder = { }; #if CONFIG_VCR1_ENCODER -AVCodec vcr1_encoder = { +AVCodec ff_vcr1_encoder = { "vcr1", AVMEDIA_TYPE_VIDEO, CODEC_ID_VCR1, diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 9f44e31ed9..e396c0bc9e 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -565,7 +565,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, * Public Data Structures */ -AVCodec vmdvideo_decoder = { +AVCodec ff_vmdvideo_decoder = { "vmdvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_VMDVIDEO, @@ -578,7 +578,7 @@ AVCodec vmdvideo_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"), }; -AVCodec vmdaudio_decoder = { +AVCodec ff_vmdaudio_decoder = { "vmdaudio", AVMEDIA_TYPE_AUDIO, CODEC_ID_VMDAUDIO, diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c index 49aaeb2992..e13452dcc6 100644 --- a/libavcodec/vmnc.c +++ b/libavcodec/vmnc.c @@ -508,7 +508,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec vmnc_decoder = { +AVCodec ff_vmnc_decoder = { "vmnc", AVMEDIA_TYPE_VIDEO, CODEC_ID_VMNC, diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index 8f15a2100c..cdb485a9c9 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -1673,7 +1673,7 @@ static av_cold int vorbis_decode_close(AVCodecContext *avccontext) return 0 ; } -AVCodec vorbis_decoder = { +AVCodec ff_vorbis_decoder = { "vorbis", AVMEDIA_TYPE_AUDIO, CODEC_ID_VORBIS, diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index 0a9c80d6d2..93683ac422 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -1102,7 +1102,7 @@ static av_cold int vorbis_encode_close(AVCodecContext *avccontext) return 0 ; } -AVCodec vorbis_encoder = { +AVCodec ff_vorbis_encoder = { "vorbis", AVMEDIA_TYPE_AUDIO, CODEC_ID_VORBIS, diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index a2a3974b5d..7ba878eeff 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -2212,7 +2212,7 @@ static av_cold int theora_decode_init(AVCodecContext *avctx) return vp3_decode_init(avctx); } -AVCodec theora_decoder = { +AVCodec ff_theora_decoder = { "theora", AVMEDIA_TYPE_VIDEO, CODEC_ID_THEORA, @@ -2227,7 +2227,7 @@ AVCodec theora_decoder = { }; #endif -AVCodec vp3_decoder = { +AVCodec ff_vp3_decoder = { "vp3", AVMEDIA_TYPE_VIDEO, CODEC_ID_VP3, diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c index c22e6dd277..4453447aaf 100644 --- a/libavcodec/vp3_parser.c +++ b/libavcodec/vp3_parser.c @@ -35,7 +35,7 @@ static int parse(AVCodecParserContext *s, return buf_size; } -AVCodecParser vp3_parser = { +AVCodecParser ff_vp3_parser = { { CODEC_ID_THEORA, CODEC_ID_VP3, CODEC_ID_VP6, CODEC_ID_VP6F, CODEC_ID_VP6A }, 0, diff --git a/libavcodec/vp5.c b/libavcodec/vp5.c index 7b3a487f1b..e9de38e6dd 100644 --- a/libavcodec/vp5.c +++ b/libavcodec/vp5.c @@ -266,7 +266,7 @@ static av_cold int vp5_decode_init(AVCodecContext *avctx) return 0; } -AVCodec vp5_decoder = { +AVCodec ff_vp5_decoder = { "vp5", AVMEDIA_TYPE_VIDEO, CODEC_ID_VP5, diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c index d3a2f35faa..0a02ce58d6 100644 --- a/libavcodec/vp6.c +++ b/libavcodec/vp6.c @@ -606,7 +606,7 @@ static av_cold int vp6_decode_free(AVCodecContext *avctx) return 0; } -AVCodec vp6_decoder = { +AVCodec ff_vp6_decoder = { "vp6", AVMEDIA_TYPE_VIDEO, CODEC_ID_VP6, @@ -620,7 +620,7 @@ AVCodec vp6_decoder = { }; /* flash version, not flipped upside-down */ -AVCodec vp6f_decoder = { +AVCodec ff_vp6f_decoder = { "vp6f", AVMEDIA_TYPE_VIDEO, CODEC_ID_VP6F, @@ -634,7 +634,7 @@ AVCodec vp6f_decoder = { }; /* flash version, not flipped upside-down, with alpha channel */ -AVCodec vp6a_decoder = { +AVCodec ff_vp6a_decoder = { "vp6a", AVMEDIA_TYPE_VIDEO, CODEC_ID_VP6A, diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 52a3f90ba0..3691f15977 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1807,7 +1807,7 @@ static av_cold int vp8_decode_free(AVCodecContext *avctx) return 0; } -AVCodec vp8_decoder = { +AVCodec ff_vp8_decoder = { "vp8", AVMEDIA_TYPE_VIDEO, CODEC_ID_VP8, diff --git a/libavcodec/vp8_parser.c b/libavcodec/vp8_parser.c index 10e7c3b44b..e769e33abe 100644 --- a/libavcodec/vp8_parser.c +++ b/libavcodec/vp8_parser.c @@ -32,7 +32,7 @@ static int parse(AVCodecParserContext *s, return buf_size; } -AVCodecParser vp8_parser = { +AVCodecParser ff_vp8_parser = { { CODEC_ID_VP8 }, 0, NULL, diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index 97b8b50278..c3b5ba6556 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -609,7 +609,7 @@ static av_cold int vqa_decode_end(AVCodecContext *avctx) return 0; } -AVCodec vqa_decoder = { +AVCodec ff_vqa_decoder = { "vqavideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_WS_VQA, diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index d7bd265de0..e96981460b 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -1188,7 +1188,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, return s->samples_left > 0 ? 0 : avpkt->size; } -AVCodec wavpack_decoder = { +AVCodec ff_wavpack_decoder = { "wavpack", AVMEDIA_TYPE_AUDIO, CODEC_ID_WAVPACK, diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index 694b15d1fb..b720ea5098 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -939,7 +939,7 @@ static av_cold void flush(AVCodecContext *avctx) s->last_superframe_len= 0; } -AVCodec wmav1_decoder = +AVCodec ff_wmav1_decoder = { "wmav1", AVMEDIA_TYPE_AUDIO, @@ -953,7 +953,7 @@ AVCodec wmav1_decoder = .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), }; -AVCodec wmav2_decoder = +AVCodec ff_wmav2_decoder = { "wmav2", AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c index f96aa3a107..4e54a70161 100644 --- a/libavcodec/wmaenc.c +++ b/libavcodec/wmaenc.c @@ -383,7 +383,7 @@ static int encode_superframe(AVCodecContext *avctx, return put_bits_ptr(&s->pb) - s->pb.buf; } -AVCodec wmav1_encoder = +AVCodec ff_wmav1_encoder = { "wmav1", AVMEDIA_TYPE_AUDIO, @@ -396,7 +396,7 @@ AVCodec wmav1_encoder = .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), }; -AVCodec wmav2_encoder = +AVCodec ff_wmav2_encoder = { "wmav2", AVMEDIA_TYPE_AUDIO, diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 5941781676..e7799846bb 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1603,7 +1603,7 @@ static void flush(AVCodecContext *avctx) /** *@brief wmapro decoder */ -AVCodec wmapro_decoder = { +AVCodec ff_wmapro_decoder = { "wmapro", AVMEDIA_TYPE_AUDIO, CODEC_ID_WMAPRO, diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index aa3b2b8737..13011ec234 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -2018,7 +2018,7 @@ static av_cold void wmavoice_flush(AVCodecContext *ctx) } } -AVCodec wmavoice_decoder = { +AVCodec ff_wmavoice_decoder = { "wmavoice", AVMEDIA_TYPE_AUDIO, CODEC_ID_WMAVOICE, diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index 7dba7c57d6..768b819479 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -484,7 +484,7 @@ static av_cold int wmv2_decode_end(AVCodecContext *avctx) return ff_h263_decode_end(avctx); } -AVCodec wmv2_decoder = { +AVCodec ff_wmv2_decoder = { "wmv2", AVMEDIA_TYPE_VIDEO, CODEC_ID_WMV2, diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c index 7416f85233..f2ab55b7fb 100644 --- a/libavcodec/wmv2enc.c +++ b/libavcodec/wmv2enc.c @@ -211,7 +211,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s, } } -AVCodec wmv2_encoder = { +AVCodec ff_wmv2_encoder = { "wmv2", AVMEDIA_TYPE_VIDEO, CODEC_ID_WMV2, diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c index 56634d10ac..2f96039053 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -154,7 +154,7 @@ static av_cold int decode_end(AVCodecContext *avctx){ return 0; } -AVCodec wnv1_decoder = { +AVCodec ff_wnv1_decoder = { "wnv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_WNV1, diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c index c16c99a62a..d6a60d441f 100644 --- a/libavcodec/ws-snd1.c +++ b/libavcodec/ws-snd1.c @@ -146,7 +146,7 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, return buf_size; } -AVCodec ws_snd1_decoder = { +AVCodec ff_ws_snd1_decoder = { "ws_snd1", AVMEDIA_TYPE_AUDIO, CODEC_ID_WESTWOOD_SND1, diff --git a/libavcodec/xan.c b/libavcodec/xan.c index fbd383f39b..0ae84a6903 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -564,7 +564,7 @@ static av_cold int xan_decode_end(AVCodecContext *avctx) return 0; } -AVCodec xan_wc3_decoder = { +AVCodec ff_xan_wc3_decoder = { "xan_wc3", AVMEDIA_TYPE_VIDEO, CODEC_ID_XAN_WC3, @@ -578,7 +578,7 @@ AVCodec xan_wc3_decoder = { }; /* -AVCodec xan_wc4_decoder = { +AVCodec ff_xan_wc4_decoder = { "xan_wc4", AVMEDIA_TYPE_VIDEO, CODEC_ID_XAN_WC4, diff --git a/libavcodec/xl.c b/libavcodec/xl.c index f7d025eca4..7fbe626d58 100644 --- a/libavcodec/xl.c +++ b/libavcodec/xl.c @@ -138,7 +138,7 @@ static av_cold int decode_end(AVCodecContext *avctx){ return 0; } -AVCodec xl_decoder = { +AVCodec ff_xl_decoder = { "xl", AVMEDIA_TYPE_VIDEO, CODEC_ID_VIXL, diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c index 22f9898d61..872b227d64 100644 --- a/libavcodec/xsubdec.c +++ b/libavcodec/xsubdec.c @@ -131,7 +131,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, return buf_size; } -AVCodec xsub_decoder = { +AVCodec ff_xsub_decoder = { "xsub", AVMEDIA_TYPE_SUBTITLE, CODEC_ID_XSUB, diff --git a/libavcodec/xsubenc.c b/libavcodec/xsubenc.c index 60f4979edb..c448a2271c 100644 --- a/libavcodec/xsubenc.c +++ b/libavcodec/xsubenc.c @@ -210,7 +210,7 @@ static av_cold int xsub_encoder_init(AVCodecContext *avctx) return 0; } -AVCodec xsub_encoder = { +AVCodec ff_xsub_encoder = { "xsub", AVMEDIA_TYPE_SUBTITLE, CODEC_ID_XSUB, diff --git a/libavcodec/yop.c b/libavcodec/yop.c index 57d100c26d..6a75e74b7a 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -248,7 +248,7 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size, return avpkt->size; } -AVCodec yop_decoder = { +AVCodec ff_yop_decoder = { "yop", AVMEDIA_TYPE_VIDEO, CODEC_ID_YOP, diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index 6ac908919d..f660cd4693 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -650,7 +650,7 @@ static av_cold int decode_end(AVCodecContext *avctx) return 0; } -AVCodec zmbv_decoder = { +AVCodec ff_zmbv_decoder = { "zmbv", AVMEDIA_TYPE_VIDEO, CODEC_ID_ZMBV, diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c index 95f2906268..b830bb4a8e 100644 --- a/libavcodec/zmbvenc.c +++ b/libavcodec/zmbvenc.c @@ -323,7 +323,7 @@ static av_cold int encode_end(AVCodecContext *avctx) return 0; } -AVCodec zmbv_encoder = { +AVCodec ff_zmbv_encoder = { "zmbv", AVMEDIA_TYPE_VIDEO, CODEC_ID_ZMBV, From 22893e10ae8b72880838accc3df97785502ac6aa Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 26 Jan 2011 15:34:36 -0500 Subject: [PATCH 133/528] VP8: don't overread edges on fourtap MC. Fix C VP8 H+V MC functions which do two-dimensional 4/6-tap filters to not overread beyond their edges if the second filter is 4-tap, since the outer pixels aren't there anymore since 44002d8323023c35f51d523a7d305e45103ba7a1. --- libavcodec/vp8dsp.c | 76 ++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/libavcodec/vp8dsp.c b/libavcodec/vp8dsp.c index b8cf0b2f6c..30699cecbe 100644 --- a/libavcodec/vp8dsp.c +++ b/libavcodec/vp8dsp.c @@ -331,8 +331,8 @@ PUT_PIXELS(4) cm[(F[2]*src[x+0*stride] - F[1]*src[x-1*stride] + \ F[3]*src[x+1*stride] - F[4]*src[x+2*stride] + 64) >> 7] -#define VP8_EPEL_H(SIZE, FILTER, FILTERNAME) \ -static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \ +#define VP8_EPEL_H(SIZE, TAPS) \ +static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \ { \ const uint8_t *filter = subpel_filters[mx-1]; \ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \ @@ -340,13 +340,13 @@ static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dsts \ for (y = 0; y < h; y++) { \ for (x = 0; x < SIZE; x++) \ - dst[x] = FILTER(src, filter, 1); \ + dst[x] = FILTER_ ## TAPS ## TAP(src, filter, 1); \ dst += dststride; \ src += srcstride; \ } \ } -#define VP8_EPEL_V(SIZE, FILTER, FILTERNAME) \ -static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \ +#define VP8_EPEL_V(SIZE, TAPS) \ +static void put_vp8_epel ## SIZE ## _v ## TAPS ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \ { \ const uint8_t *filter = subpel_filters[my-1]; \ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \ @@ -354,63 +354,63 @@ static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dsts \ for (y = 0; y < h; y++) { \ for (x = 0; x < SIZE; x++) \ - dst[x] = FILTER(src, filter, srcstride); \ + dst[x] = FILTER_ ## TAPS ## TAP(src, filter, srcstride); \ dst += dststride; \ src += srcstride; \ } \ } -#define VP8_EPEL_HV(SIZE, FILTERX, FILTERY, FILTERNAME) \ -static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \ +#define VP8_EPEL_HV(SIZE, HTAPS, VTAPS) \ +static void put_vp8_epel ## SIZE ## _h ## HTAPS ## v ## VTAPS ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \ { \ const uint8_t *filter = subpel_filters[mx-1]; \ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \ int x, y; \ - uint8_t tmp_array[(2*SIZE+5)*SIZE]; \ + uint8_t tmp_array[(2*SIZE+VTAPS-1)*SIZE]; \ uint8_t *tmp = tmp_array; \ - src -= 2*srcstride; \ + src -= (2-(VTAPS==4))*srcstride; \ \ - for (y = 0; y < h+5; y++) { \ + for (y = 0; y < h+VTAPS-1; y++) { \ for (x = 0; x < SIZE; x++) \ - tmp[x] = FILTERX(src, filter, 1); \ + tmp[x] = FILTER_ ## HTAPS ## TAP(src, filter, 1); \ tmp += SIZE; \ src += srcstride; \ } \ \ - tmp = tmp_array + 2*SIZE; \ + tmp = tmp_array + (2-(VTAPS==4))*SIZE; \ filter = subpel_filters[my-1]; \ \ for (y = 0; y < h; y++) { \ for (x = 0; x < SIZE; x++) \ - dst[x] = FILTERY(tmp, filter, SIZE); \ + dst[x] = FILTER_ ## VTAPS ## TAP(tmp, filter, SIZE); \ dst += dststride; \ tmp += SIZE; \ } \ } -VP8_EPEL_H(16, FILTER_4TAP, h4) -VP8_EPEL_H(8, FILTER_4TAP, h4) -VP8_EPEL_H(4, FILTER_4TAP, h4) -VP8_EPEL_H(16, FILTER_6TAP, h6) -VP8_EPEL_H(8, FILTER_6TAP, h6) -VP8_EPEL_H(4, FILTER_6TAP, h6) -VP8_EPEL_V(16, FILTER_4TAP, v4) -VP8_EPEL_V(8, FILTER_4TAP, v4) -VP8_EPEL_V(4, FILTER_4TAP, v4) -VP8_EPEL_V(16, FILTER_6TAP, v6) -VP8_EPEL_V(8, FILTER_6TAP, v6) -VP8_EPEL_V(4, FILTER_6TAP, v6) -VP8_EPEL_HV(16, FILTER_4TAP, FILTER_4TAP, h4v4) -VP8_EPEL_HV(8, FILTER_4TAP, FILTER_4TAP, h4v4) -VP8_EPEL_HV(4, FILTER_4TAP, FILTER_4TAP, h4v4) -VP8_EPEL_HV(16, FILTER_4TAP, FILTER_6TAP, h4v6) -VP8_EPEL_HV(8, FILTER_4TAP, FILTER_6TAP, h4v6) -VP8_EPEL_HV(4, FILTER_4TAP, FILTER_6TAP, h4v6) -VP8_EPEL_HV(16, FILTER_6TAP, FILTER_4TAP, h6v4) -VP8_EPEL_HV(8, FILTER_6TAP, FILTER_4TAP, h6v4) -VP8_EPEL_HV(4, FILTER_6TAP, FILTER_4TAP, h6v4) -VP8_EPEL_HV(16, FILTER_6TAP, FILTER_6TAP, h6v6) -VP8_EPEL_HV(8, FILTER_6TAP, FILTER_6TAP, h6v6) -VP8_EPEL_HV(4, FILTER_6TAP, FILTER_6TAP, h6v6) +VP8_EPEL_H(16, 4) +VP8_EPEL_H(8, 4) +VP8_EPEL_H(4, 4) +VP8_EPEL_H(16, 6) +VP8_EPEL_H(8, 6) +VP8_EPEL_H(4, 6) +VP8_EPEL_V(16, 4) +VP8_EPEL_V(8, 4) +VP8_EPEL_V(4, 4) +VP8_EPEL_V(16, 6) +VP8_EPEL_V(8, 6) +VP8_EPEL_V(4, 6) +VP8_EPEL_HV(16, 4, 4) +VP8_EPEL_HV(8, 4, 4) +VP8_EPEL_HV(4, 4, 4) +VP8_EPEL_HV(16, 4, 6) +VP8_EPEL_HV(8, 4, 6) +VP8_EPEL_HV(4, 4, 6) +VP8_EPEL_HV(16, 6, 4) +VP8_EPEL_HV(8, 6, 4) +VP8_EPEL_HV(4, 6, 4) +VP8_EPEL_HV(16, 6, 6) +VP8_EPEL_HV(8, 6, 6) +VP8_EPEL_HV(4, 6, 6) #define VP8_BILINEAR(SIZE) \ static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \ From c4f8765ac55562fc6ab705e3d17275b69eb5f71d Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 26 Jan 2011 21:54:42 +0000 Subject: [PATCH 134/528] Revert "mov: simplify mov_read_chapters() by using avio_get_str16be" This reverts commit c34461b35b68ff1f3d04540e0279383c51be8cee. The wrong version of the patch was committed. --- libavformat/mov.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 40666c167e..4370b48bc5 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2283,7 +2283,8 @@ static void mov_read_chapters(AVFormatContext *s) AVStream *st = NULL; MOVStreamContext *sc; int64_t cur_pos; - int i; + uint8_t *title = NULL; + int i, len, i8, i16; for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->id == mov->chapter_track) { @@ -2302,33 +2303,43 @@ static void mov_read_chapters(AVFormatContext *s) for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; - uint8_t title[512]; - uint16_t ch; - int len; if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); goto finish; } + title = av_malloc(sample->size+2); + get_buffer(sc->pb, title, sample->size); + // the first two bytes are the length of the title - len = get_be16(sc->pb); + len = AV_RB16(title); if (len > sample->size-2) continue; // The samples could theoretically be in any encoding if there's an encd // atom following, but in practice are only utf-8 or utf-16, distinguished // instead by the presence of a BOM - if ((ch = get_be16(sc->pb)) == 0xfeff) - avio_get_str16be(sc->pb, len, title, sizeof(title)); - else { - AV_WB16(title, ch); - get_buffer(sc->pb, title + sizeof(ch), sizeof(title) - sizeof(ch)); + if (AV_RB16(title+2) == 0xfeff) { + uint8_t *utf8 = av_malloc(2*len+3); + + i8 = i16 = 0; + while (i16 < len) { + uint32_t ch; + uint8_t tmp; + GET_UTF16(ch, i16 < len ? AV_RB16(title + (i16+=2)) : 0, break;) + PUT_UTF8(ch, tmp, if (i8 < 2*len) utf8[2+i8++] = tmp;) + } + utf8[2+i8] = 0; + av_freep(&title); + title = utf8; } - ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title); + ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title+2); + av_freep(&title); } finish: + av_free(title); url_fseek(sc->pb, cur_pos, SEEK_SET); } From 225b6d7fdea370de3723420e6adc2f3192439b00 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 23 Jan 2011 12:35:23 +0100 Subject: [PATCH 135/528] mov: simplify mov_read_chapters() by using avio_get_str16be It probably also fixes a memleak or two. Signed-off-by: Mans Rullgard --- libavformat/mov.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 4370b48bc5..d52928ce41 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2283,8 +2283,7 @@ static void mov_read_chapters(AVFormatContext *s) AVStream *st = NULL; MOVStreamContext *sc; int64_t cur_pos; - uint8_t *title = NULL; - int i, len, i8, i16; + int i; for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->id == mov->chapter_track) { @@ -2303,43 +2302,38 @@ static void mov_read_chapters(AVFormatContext *s) for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; + uint8_t *title; + uint16_t ch; + int len, title_len; if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); goto finish; } - title = av_malloc(sample->size+2); - get_buffer(sc->pb, title, sample->size); - // the first two bytes are the length of the title - len = AV_RB16(title); + len = get_be16(sc->pb); if (len > sample->size-2) continue; + title_len = 2*len + 1; + if (!(title = av_mallocz(title_len))) + goto finish; // The samples could theoretically be in any encoding if there's an encd // atom following, but in practice are only utf-8 or utf-16, distinguished // instead by the presence of a BOM - if (AV_RB16(title+2) == 0xfeff) { - uint8_t *utf8 = av_malloc(2*len+3); - - i8 = i16 = 0; - while (i16 < len) { - uint32_t ch; - uint8_t tmp; - GET_UTF16(ch, i16 < len ? AV_RB16(title + (i16+=2)) : 0, break;) - PUT_UTF8(ch, tmp, if (i8 < 2*len) utf8[2+i8++] = tmp;) - } - utf8[2+i8] = 0; - av_freep(&title); - title = utf8; + ch = get_be16(sc->pb); + if (ch == 0xfeff) + avio_get_str16be(sc->pb, len, title, title_len); + else { + AV_WB16(title, ch); + get_strz(sc->pb, title + 2, len - 1); } - ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title+2); + ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title); av_freep(&title); } finish: - av_free(title); url_fseek(sc->pb, cur_pos, SEEK_SET); } From c6610a216ed2948885772154a2eed696e0cb4aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 22:03:28 +0000 Subject: [PATCH 136/528] Prefix all _demuxer, _muxer, _protocol from libavformat and libavdevice. This also lists the objects from those two libraries as internal (by adding the ff_ prefix) so that they can then be hidden via linker scripts. --- libavdevice/alldevices.c | 8 ++++---- libavdevice/alsa-audio-dec.c | 2 +- libavdevice/alsa-audio-enc.c | 2 +- libavdevice/bktr.c | 2 +- libavdevice/dv1394.c | 2 +- libavdevice/jack_audio.c | 2 +- libavdevice/libdc1394.c | 4 ++-- libavdevice/oss_audio.c | 4 ++-- libavdevice/v4l.c | 2 +- libavdevice/v4l2.c | 2 +- libavdevice/vfwcap.c | 2 +- libavdevice/x11grab.c | 2 +- libavformat/4xm.c | 2 +- libavformat/a64.c | 2 +- libavformat/aacdec.c | 2 +- libavformat/ac3dec.c | 4 ++-- libavformat/adtsenc.c | 2 +- libavformat/aea.c | 2 +- libavformat/aiffdec.c | 2 +- libavformat/aiffenc.c | 2 +- libavformat/allformats.c | 12 ++++++------ libavformat/amr.c | 4 ++-- libavformat/anm.c | 2 +- libavformat/apc.c | 2 +- libavformat/ape.c | 2 +- libavformat/applehttp.c | 2 +- libavformat/asf.h | 2 +- libavformat/asfdec.c | 2 +- libavformat/asfenc.c | 4 ++-- libavformat/assdec.c | 2 +- libavformat/assenc.c | 2 +- libavformat/au.c | 4 ++-- libavformat/avidec.c | 2 +- libavformat/avienc.c | 2 +- libavformat/avisynth.c | 2 +- libavformat/avs.c | 2 +- libavformat/bethsoftvid.c | 2 +- libavformat/bfi.c | 2 +- libavformat/bink.c | 2 +- libavformat/c93.c | 2 +- libavformat/cafdec.c | 2 +- libavformat/cavsvideodec.c | 2 +- libavformat/cdg.c | 2 +- libavformat/concat.c | 2 +- libavformat/crcenc.c | 2 +- libavformat/daud.c | 4 ++-- libavformat/diracdec.c | 2 +- libavformat/dnxhddec.c | 2 +- libavformat/dsicin.c | 2 +- libavformat/dtsdec.c | 2 +- libavformat/dv.c | 2 +- libavformat/dvenc.c | 2 +- libavformat/dxa.c | 2 +- libavformat/eacdata.c | 2 +- libavformat/electronicarts.c | 2 +- libavformat/ffmdec.c | 2 +- libavformat/ffmenc.c | 2 +- libavformat/ffmetadec.c | 2 +- libavformat/ffmetaenc.c | 2 +- libavformat/file.c | 4 ++-- libavformat/filmstripdec.c | 2 +- libavformat/filmstripenc.c | 2 +- libavformat/flacdec.c | 2 +- libavformat/flacenc.c | 2 +- libavformat/flic.c | 2 +- libavformat/flvdec.c | 2 +- libavformat/flvenc.c | 2 +- libavformat/framecrcenc.c | 2 +- libavformat/gif.c | 2 +- libavformat/gopher.c | 2 +- libavformat/gxf.c | 2 +- libavformat/gxfenc.c | 2 +- libavformat/h261dec.c | 2 +- libavformat/h263dec.c | 2 +- libavformat/h264dec.c | 2 +- libavformat/http.c | 2 +- libavformat/idcin.c | 2 +- libavformat/idroqdec.c | 2 +- libavformat/idroqenc.c | 2 +- libavformat/iff.c | 2 +- libavformat/img2.c | 8 ++++---- libavformat/ingenientdec.c | 2 +- libavformat/ipmovie.c | 2 +- libavformat/iss.c | 2 +- libavformat/iv8.c | 2 +- libavformat/ivfdec.c | 2 +- libavformat/ivfenc.c | 2 +- libavformat/libnut.c | 4 ++-- libavformat/librtmp.c | 10 +++++----- libavformat/lmlm4.c | 2 +- libavformat/lxfdec.c | 2 +- libavformat/m4vdec.c | 2 +- libavformat/matroskadec.c | 2 +- libavformat/matroskaenc.c | 6 +++--- libavformat/md5enc.c | 4 ++-- libavformat/md5proto.c | 2 +- libavformat/mm.c | 2 +- libavformat/mmf.c | 4 ++-- libavformat/mmsh.c | 2 +- libavformat/mmst.c | 2 +- libavformat/mov.c | 2 +- libavformat/movenc.c | 12 ++++++------ libavformat/mp3dec.c | 2 +- libavformat/mp3enc.c | 4 ++-- libavformat/mpc.c | 2 +- libavformat/mpc8.c | 2 +- libavformat/mpeg.c | 2 +- libavformat/mpegenc.c | 30 +++++++++++++++--------------- libavformat/mpegts.c | 8 ++++---- libavformat/mpegtsenc.c | 2 +- libavformat/mpegvideodec.c | 2 +- libavformat/mpjpeg.c | 2 +- libavformat/msnwc_tcp.c | 2 +- libavformat/mtv.c | 2 +- libavformat/mvi.c | 2 +- libavformat/mxfdec.c | 2 +- libavformat/mxfenc.c | 16 ++++++++-------- libavformat/mxg.c | 2 +- libavformat/ncdec.c | 2 +- libavformat/nsvdec.c | 2 +- libavformat/nullenc.c | 2 +- libavformat/nutdec.c | 2 +- libavformat/nutenc.c | 2 +- libavformat/nuv.c | 2 +- libavformat/oggdec.c | 2 +- libavformat/oggenc.c | 2 +- libavformat/oma.c | 2 +- libavformat/pcmdec.c | 2 +- libavformat/pcmenc.c | 2 +- libavformat/psxstr.c | 2 +- libavformat/pva.c | 2 +- libavformat/qcp.c | 2 +- libavformat/r3d.c | 2 +- libavformat/rawdec.c | 14 +++++++------- libavformat/rawenc.c | 36 ++++++++++++++++++------------------ libavformat/rawvideodec.c | 2 +- libavformat/rdt.c | 2 +- libavformat/rl2.c | 2 +- libavformat/rm.h | 2 +- libavformat/rmdec.c | 4 ++-- libavformat/rmenc.c | 2 +- libavformat/rpl.c | 2 +- libavformat/rsodec.c | 2 +- libavformat/rsoenc.c | 2 +- libavformat/rtmpproto.c | 2 +- libavformat/rtpdec_asf.c | 2 +- libavformat/rtpenc.c | 2 +- libavformat/rtpproto.c | 2 +- libavformat/rtsp.c | 4 ++-- libavformat/rtspdec.c | 2 +- libavformat/rtspenc.c | 2 +- libavformat/sapdec.c | 2 +- libavformat/sapenc.c | 2 +- libavformat/segafilm.c | 2 +- libavformat/sierravmd.c | 2 +- libavformat/siff.c | 2 +- libavformat/smacker.c | 2 +- libavformat/sol.c | 2 +- libavformat/soxdec.c | 2 +- libavformat/soxenc.c | 2 +- libavformat/spdifdec.c | 2 +- libavformat/spdifenc.c | 2 +- libavformat/srtdec.c | 2 +- libavformat/swfdec.c | 2 +- libavformat/swfenc.c | 4 ++-- libavformat/tcp.c | 2 +- libavformat/thp.c | 2 +- libavformat/tiertexseq.c | 2 +- libavformat/tmv.c | 2 +- libavformat/tta.c | 2 +- libavformat/tty.c | 2 +- libavformat/txd.c | 2 +- libavformat/udp.c | 2 +- libavformat/vc1test.c | 2 +- libavformat/vc1testenc.c | 2 +- libavformat/vocdec.c | 2 +- libavformat/vocenc.c | 2 +- libavformat/vqf.c | 2 +- libavformat/wav.c | 6 +++--- libavformat/wc3movie.c | 2 +- libavformat/westwood.c | 4 ++-- libavformat/wtv.c | 2 +- libavformat/wv.c | 2 +- libavformat/xa.c | 2 +- libavformat/yop.c | 2 +- libavformat/yuv4mpeg.c | 4 ++-- 186 files changed, 274 insertions(+), 274 deletions(-) diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index de3bc82396..ce06bf269c 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -23,11 +23,11 @@ #include "avdevice.h" #define REGISTER_OUTDEV(X,x) { \ - extern AVOutputFormat x##_muxer; \ - if(CONFIG_##X##_OUTDEV) av_register_output_format(&x##_muxer); } + extern AVOutputFormat ff_##x##_muxer; \ + if(CONFIG_##X##_OUTDEV) av_register_output_format(&ff_##x##_muxer); } #define REGISTER_INDEV(X,x) { \ - extern AVInputFormat x##_demuxer; \ - if(CONFIG_##X##_INDEV) av_register_input_format(&x##_demuxer); } + extern AVInputFormat ff_##x##_demuxer; \ + if(CONFIG_##X##_INDEV) av_register_input_format(&ff_##x##_demuxer); } #define REGISTER_INOUTDEV(X,x) REGISTER_OUTDEV(X,x); REGISTER_INDEV(X,x) void avdevice_register_all(void) diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index f1dd29bafc..8ee0e52642 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c @@ -163,7 +163,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) return 0; } -AVInputFormat alsa_demuxer = { +AVInputFormat ff_alsa_demuxer = { "alsa", NULL_IF_CONFIG_SMALL("ALSA audio input"), sizeof(AlsaData), diff --git a/libavdevice/alsa-audio-enc.c b/libavdevice/alsa-audio-enc.c index 7c07bf722e..83a179ecfe 100644 --- a/libavdevice/alsa-audio-enc.c +++ b/libavdevice/alsa-audio-enc.c @@ -93,7 +93,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt) return 0; } -AVOutputFormat alsa_muxer = { +AVOutputFormat ff_alsa_muxer = { "alsa", NULL_IF_CONFIG_SMALL("ALSA audio output"), "", diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index afb94b6c5d..cec79a4989 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -314,7 +314,7 @@ static int grab_read_close(AVFormatContext *s1) return 0; } -AVInputFormat bktr_demuxer = { +AVInputFormat ff_bktr_demuxer = { "bktr", NULL_IF_CONFIG_SMALL("video grab"), sizeof(VideoData), diff --git a/libavdevice/dv1394.c b/libavdevice/dv1394.c index a55fa97cef..588f35662b 100644 --- a/libavdevice/dv1394.c +++ b/libavdevice/dv1394.c @@ -227,7 +227,7 @@ static int dv1394_close(AVFormatContext * context) return 0; } -AVInputFormat dv1394_demuxer = { +AVInputFormat ff_dv1394_demuxer = { .name = "dv1394", .long_name = NULL_IF_CONFIG_SMALL("DV1394 A/V grab"), .priv_data_size = sizeof(struct dv1394_data), diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c index b41bbdf902..9062e7f2dd 100644 --- a/libavdevice/jack_audio.c +++ b/libavdevice/jack_audio.c @@ -314,7 +314,7 @@ static int audio_read_close(AVFormatContext *context) return 0; } -AVInputFormat jack_demuxer = { +AVInputFormat ff_jack_demuxer = { "jack", NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"), sizeof(JackData), diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index 1f35135a65..abd82dc981 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -348,7 +348,7 @@ static int dc1394_v2_close(AVFormatContext * context) return 0; } -AVInputFormat libdc1394_demuxer = { +AVInputFormat ff_libdc1394_demuxer = { .name = "libdc1394", .long_name = NULL_IF_CONFIG_SMALL("dc1394 v.2 A/V grab"), .priv_data_size = sizeof(struct dc1394_data), @@ -360,7 +360,7 @@ AVInputFormat libdc1394_demuxer = { #endif #if HAVE_LIBDC1394_1 -AVInputFormat libdc1394_demuxer = { +AVInputFormat ff_libdc1394_demuxer = { .name = "libdc1394", .long_name = NULL_IF_CONFIG_SMALL("dc1394 v.1 A/V grab"), .priv_data_size = sizeof(struct dc1394_data), diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c index 9d007108e6..d2ba601f7a 100644 --- a/libavdevice/oss_audio.c +++ b/libavdevice/oss_audio.c @@ -293,7 +293,7 @@ static int audio_read_close(AVFormatContext *s1) } #if CONFIG_OSS_INDEV -AVInputFormat oss_demuxer = { +AVInputFormat ff_oss_demuxer = { "oss", NULL_IF_CONFIG_SMALL("Open Sound System capture"), sizeof(AudioData), @@ -306,7 +306,7 @@ AVInputFormat oss_demuxer = { #endif #if CONFIG_OSS_OUTDEV -AVOutputFormat oss_muxer = { +AVOutputFormat ff_oss_muxer = { "oss", NULL_IF_CONFIG_SMALL("Open Sound System playback"), "", diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c index f640c769cd..c107684bff 100644 --- a/libavdevice/v4l.c +++ b/libavdevice/v4l.c @@ -339,7 +339,7 @@ static int grab_read_close(AVFormatContext *s1) return 0; } -AVInputFormat v4l_demuxer = { +AVInputFormat ff_v4l_demuxer = { "video4linux", NULL_IF_CONFIG_SMALL("Video4Linux device grab"), sizeof(VideoData), diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 1e41c44775..993e2adcec 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -680,7 +680,7 @@ static int v4l2_read_close(AVFormatContext *s1) return 0; } -AVInputFormat v4l2_demuxer = { +AVInputFormat ff_v4l2_demuxer = { "video4linux2", NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"), sizeof(struct video_data), diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index 7b54490fbb..2155db6ece 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -452,7 +452,7 @@ static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt) return pkt->size; } -AVInputFormat vfwcap_demuxer = { +AVInputFormat ff_vfwcap_demuxer = { "vfwcap", NULL_IF_CONFIG_SMALL("VFW video capture"), sizeof(struct vfw_ctx), diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c index ee3b8e901e..be0586a7db 100644 --- a/libavdevice/x11grab.c +++ b/libavdevice/x11grab.c @@ -442,7 +442,7 @@ x11grab_read_close(AVFormatContext *s1) } /** x11 grabber device demuxer declaration */ -AVInputFormat x11_grab_device_demuxer = +AVInputFormat ff_x11_grab_device_demuxer = { "x11grab", NULL_IF_CONFIG_SMALL("X11grab"), diff --git a/libavformat/4xm.c b/libavformat/4xm.c index dfbf0327f5..6f737e3428 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -343,7 +343,7 @@ static int fourxm_read_close(AVFormatContext *s) return 0; } -AVInputFormat fourxm_demuxer = { +AVInputFormat ff_fourxm_demuxer = { "4xm", NULL_IF_CONFIG_SMALL("4X Technologies format"), sizeof(FourxmDemuxContext), diff --git a/libavformat/a64.c b/libavformat/a64.c index 2dc475cd5f..46441b23d8 100644 --- a/libavformat/a64.c +++ b/libavformat/a64.c @@ -164,7 +164,7 @@ static int a64_write_trailer(struct AVFormatContext *s) return 0; } -AVOutputFormat a64_muxer = { +AVOutputFormat ff_a64_muxer = { .name = "a64", .long_name = NULL_IF_CONFIG_SMALL("a64 - video for Commodore 64"), .mime_type = NULL, diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c index 64ac3d13c6..47e9bf3a18 100644 --- a/libavformat/aacdec.c +++ b/libavformat/aacdec.c @@ -81,7 +81,7 @@ static int adts_aac_read_header(AVFormatContext *s, return 0; } -AVInputFormat aac_demuxer = { +AVInputFormat ff_aac_demuxer = { "aac", NULL_IF_CONFIG_SMALL("raw ADTS AAC"), 0, diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c index b8a2bdd4a0..fcf99363ee 100644 --- a/libavformat/ac3dec.c +++ b/libavformat/ac3dec.c @@ -70,7 +70,7 @@ static int ac3_probe(AVProbeData *p) return ac3_eac3_probe(p, CODEC_ID_AC3); } -AVInputFormat ac3_demuxer = { +AVInputFormat ff_ac3_demuxer = { "ac3", NULL_IF_CONFIG_SMALL("raw AC-3"), 0, @@ -89,7 +89,7 @@ static int eac3_probe(AVProbeData *p) return ac3_eac3_probe(p, CODEC_ID_EAC3); } -AVInputFormat eac3_demuxer = { +AVInputFormat ff_eac3_demuxer = { "eac3", NULL_IF_CONFIG_SMALL("raw E-AC-3"), 0, diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 232d322708..f309c896b3 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -137,7 +137,7 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVOutputFormat adts_muxer = { +AVOutputFormat ff_adts_muxer = { "adts", NULL_IF_CONFIG_SMALL("ADTS AAC"), "audio/aac", diff --git a/libavformat/aea.c b/libavformat/aea.c index 2c4f471b20..6816506e4e 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -93,7 +93,7 @@ static int aea_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat aea_demuxer = { +AVInputFormat ff_aea_demuxer = { "aea", NULL_IF_CONFIG_SMALL("MD STUDIO audio"), 0, diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 255caa3a5b..b841023701 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -311,7 +311,7 @@ static int aiff_read_packet(AVFormatContext *s, return 0; } -AVInputFormat aiff_demuxer = { +AVInputFormat ff_aiff_demuxer = { "aiff", NULL_IF_CONFIG_SMALL("Audio IFF"), sizeof(AIFFInputContext), diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index e3c6a0b1bf..6e473907b0 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -145,7 +145,7 @@ static int aiff_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat aiff_muxer = { +AVOutputFormat ff_aiff_muxer = { "aiff", NULL_IF_CONFIG_SMALL("Audio IFF"), "audio/aiff", diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 5fa97efa0b..0ff4b5aa8e 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -23,18 +23,18 @@ #include "rdt.h" #define REGISTER_MUXER(X,x) { \ - extern AVOutputFormat x##_muxer; \ - if(CONFIG_##X##_MUXER) av_register_output_format(&x##_muxer); } + extern AVOutputFormat ff_##x##_muxer; \ + if(CONFIG_##X##_MUXER) av_register_output_format(&ff_##x##_muxer); } #define REGISTER_DEMUXER(X,x) { \ - extern AVInputFormat x##_demuxer; \ - if(CONFIG_##X##_DEMUXER) av_register_input_format(&x##_demuxer); } + extern AVInputFormat ff_##x##_demuxer; \ + if(CONFIG_##X##_DEMUXER) av_register_input_format(&ff_##x##_demuxer); } #define REGISTER_MUXDEMUX(X,x) REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x) #define REGISTER_PROTOCOL(X,x) { \ - extern URLProtocol x##_protocol; \ - if(CONFIG_##X##_PROTOCOL) av_register_protocol2(&x##_protocol, sizeof(x##_protocol)); } + extern URLProtocol ff_##x##_protocol; \ + if(CONFIG_##X##_PROTOCOL) av_register_protocol2(&ff_##x##_protocol, sizeof(ff_##x##_protocol)); } void av_register_all(void) { diff --git a/libavformat/amr.c b/libavformat/amr.c index f78aacc216..11bb4e513c 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -169,7 +169,7 @@ static int amr_read_packet(AVFormatContext *s, } #if CONFIG_AMR_DEMUXER -AVInputFormat amr_demuxer = { +AVInputFormat ff_amr_demuxer = { "amr", NULL_IF_CONFIG_SMALL("3GPP AMR file format"), 0, /*priv_data_size*/ @@ -181,7 +181,7 @@ AVInputFormat amr_demuxer = { #endif #if CONFIG_AMR_MUXER -AVOutputFormat amr_muxer = { +AVOutputFormat ff_amr_muxer = { "amr", NULL_IF_CONFIG_SMALL("3GPP AMR file format"), "audio/amr", diff --git a/libavformat/anm.c b/libavformat/anm.c index 82430e5eb6..dbe1b68846 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -225,7 +225,7 @@ repeat: return 0; } -AVInputFormat anm_demuxer = { +AVInputFormat ff_anm_demuxer = { "anm", NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"), sizeof(AnmDemuxContext), diff --git a/libavformat/apc.c b/libavformat/apc.c index 9b4a8adc1d..942a4cf3ef 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -80,7 +80,7 @@ static int apc_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat apc_demuxer = { +AVInputFormat ff_apc_demuxer = { "apc", NULL_IF_CONFIG_SMALL("CRYO APC format"), 0, diff --git a/libavformat/ape.c b/libavformat/ape.c index 91acf7240d..327e1a9b20 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -391,7 +391,7 @@ static int ape_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp return 0; } -AVInputFormat ape_demuxer = { +AVInputFormat ff_ape_demuxer = { "ape", NULL_IF_CONFIG_SMALL("Monkey's Audio"), sizeof(APEContext), diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 6f03548566..50466faf82 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -579,7 +579,7 @@ static int applehttp_probe(AVProbeData *p) return 0; } -AVInputFormat applehttp_demuxer = { +AVInputFormat ff_applehttp_demuxer = { "applehttp", NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming format"), sizeof(AppleHTTPContext), diff --git a/libavformat/asf.h b/libavformat/asf.h index 8cf517dd14..f336c43fa3 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -229,7 +229,7 @@ extern const AVMetadataConv ff_asf_metadata_conv[]; #define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000 -extern AVInputFormat asf_demuxer; +extern AVInputFormat ff_asf_demuxer; int ff_guidcmp(const void *g1, const void *g2); void ff_get_guid(ByteIOContext *s, ff_asf_guid *g); diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 36690ae568..229f8ba51d 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -1203,7 +1203,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int return 0; } -AVInputFormat asf_demuxer = { +AVInputFormat ff_asf_demuxer = { "asf", NULL_IF_CONFIG_SMALL("ASF format"), sizeof(ASFContext), diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 0c2a6ae94a..b8f8635603 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -855,7 +855,7 @@ static int asf_write_trailer(AVFormatContext *s) } #if CONFIG_ASF_MUXER -AVOutputFormat asf_muxer = { +AVOutputFormat ff_asf_muxer = { "asf", NULL_IF_CONFIG_SMALL("ASF format"), "video/x-ms-asf", @@ -876,7 +876,7 @@ AVOutputFormat asf_muxer = { #endif #if CONFIG_ASF_STREAM_MUXER -AVOutputFormat asf_stream_muxer = { +AVOutputFormat ff_asf_stream_muxer = { "asf_stream", NULL_IF_CONFIG_SMALL("ASF format"), "video/x-ms-asf", diff --git a/libavformat/assdec.c b/libavformat/assdec.c index ffce157995..86f03390a7 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -202,7 +202,7 @@ static int read_seek2(AVFormatContext *s, int stream_index, return 0; } -AVInputFormat ass_demuxer = { +AVInputFormat ff_ass_demuxer = { .name = "ass", .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle format"), .priv_data_size = sizeof(ASSContext), diff --git a/libavformat/assenc.c b/libavformat/assenc.c index bc1d7de731..fdd5306028 100644 --- a/libavformat/assenc.c +++ b/libavformat/assenc.c @@ -77,7 +77,7 @@ static int write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat ass_muxer = { +AVOutputFormat ff_ass_muxer = { .name = "ass", .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle format"), .mime_type = "text/x-ssa", diff --git a/libavformat/au.c b/libavformat/au.c index cb1c31dc18..e18022dd79 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -183,7 +183,7 @@ static int au_read_packet(AVFormatContext *s, } #if CONFIG_AU_DEMUXER -AVInputFormat au_demuxer = { +AVInputFormat ff_au_demuxer = { "au", NULL_IF_CONFIG_SMALL("SUN AU format"), 0, @@ -197,7 +197,7 @@ AVInputFormat au_demuxer = { #endif #if CONFIG_AU_MUXER -AVOutputFormat au_muxer = { +AVOutputFormat ff_au_muxer = { "au", NULL_IF_CONFIG_SMALL("SUN AU format"), "audio/basic", diff --git a/libavformat/avidec.c b/libavformat/avidec.c index d02e188ca6..312bf76b76 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1373,7 +1373,7 @@ static int avi_probe(AVProbeData *p) return 0; } -AVInputFormat avi_demuxer = { +AVInputFormat ff_avi_demuxer = { "avi", NULL_IF_CONFIG_SMALL("AVI format"), sizeof(AVIContext), diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 98b0ad713c..3397657083 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -630,7 +630,7 @@ static int avi_write_trailer(AVFormatContext *s) return res; } -AVOutputFormat avi_muxer = { +AVOutputFormat ff_avi_muxer = { "avi", NULL_IF_CONFIG_SMALL("AVI format"), "video/x-msvideo", diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index e2a8a3cf5a..768459a38d 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -207,7 +207,7 @@ static int avisynth_read_seek(AVFormatContext *s, int stream_index, int64_t pts, return 0; } -AVInputFormat avisynth_demuxer = { +AVInputFormat ff_avisynth_demuxer = { "avs", NULL_IF_CONFIG_SMALL("AVISynth"), sizeof(AVISynthContext), diff --git a/libavformat/avs.c b/libavformat/avs.c index caf3a892bb..2e1b22439c 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -215,7 +215,7 @@ static int avs_read_close(AVFormatContext * s) return 0; } -AVInputFormat avs_demuxer = { +AVInputFormat ff_avs_demuxer = { "avs", NULL_IF_CONFIG_SMALL("AVS format"), sizeof(AvsFormat), diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 4f9d1c1b1a..97e8e7e0c2 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -224,7 +224,7 @@ static int vid_read_packet(AVFormatContext *s, return 0; } -AVInputFormat bethsoftvid_demuxer = { +AVInputFormat ff_bethsoftvid_demuxer = { "bethsoftvid", NULL_IF_CONFIG_SMALL("Bethesda Softworks VID format"), sizeof(BVID_DemuxContext), diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 94014a4912..3b1c9aa927 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -158,7 +158,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) return ret; } -AVInputFormat bfi_demuxer = { +AVInputFormat ff_bfi_demuxer = { "bfi", NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"), sizeof(BFIContext), diff --git a/libavformat/bink.c b/libavformat/bink.c index afa629f355..c134dd80fd 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -257,7 +257,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in return 0; } -AVInputFormat bink_demuxer = { +AVInputFormat ff_bink_demuxer = { "bink", NULL_IF_CONFIG_SMALL("Bink"), sizeof(BinkDemuxContext), diff --git a/libavformat/c93.c b/libavformat/c93.c index 033b36bd25..dbb2bf389e 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -192,7 +192,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat c93_demuxer = { +AVInputFormat ff_c93_demuxer = { "c93", NULL_IF_CONFIG_SMALL("Interplay C93"), sizeof(C93DemuxContext), diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 201c5f2e96..7b0c8717b1 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -381,7 +381,7 @@ static int read_seek(AVFormatContext *s, int stream_index, return 0; } -AVInputFormat caf_demuxer = { +AVInputFormat ff_caf_demuxer = { "caf", NULL_IF_CONFIG_SMALL("Apple Core Audio Format"), sizeof(CaffContext), diff --git a/libavformat/cavsvideodec.c b/libavformat/cavsvideodec.c index 51a75010d7..6db9ad9fcf 100644 --- a/libavformat/cavsvideodec.c +++ b/libavformat/cavsvideodec.c @@ -65,7 +65,7 @@ static int cavsvideo_probe(AVProbeData *p) return 0; } -AVInputFormat cavsvideo_demuxer = { +AVInputFormat ff_cavsvideo_demuxer = { "cavsvideo", NULL_IF_CONFIG_SMALL("raw Chinese AVS video"), 0, diff --git a/libavformat/cdg.c b/libavformat/cdg.c index 2f4fb2771d..ed3d78285b 100644 --- a/libavformat/cdg.c +++ b/libavformat/cdg.c @@ -55,7 +55,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat cdg_demuxer = { +AVInputFormat ff_cdg_demuxer = { "cdg", NULL_IF_CONFIG_SMALL("CD Graphics Format"), 0, diff --git a/libavformat/concat.c b/libavformat/concat.c index 3a19d0a2ff..365907912a 100644 --- a/libavformat/concat.c +++ b/libavformat/concat.c @@ -188,7 +188,7 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence) return result; } -URLProtocol concat_protocol = { +URLProtocol ff_concat_protocol = { "concat", concat_open, concat_read, diff --git a/libavformat/crcenc.c b/libavformat/crcenc.c index b343464c49..2f9a099a21 100644 --- a/libavformat/crcenc.c +++ b/libavformat/crcenc.c @@ -54,7 +54,7 @@ static int crc_write_trailer(struct AVFormatContext *s) return 0; } -AVOutputFormat crc_muxer = { +AVOutputFormat ff_crc_muxer = { "crc", NULL_IF_CONFIG_SMALL("CRC testing format"), NULL, diff --git a/libavformat/daud.c b/libavformat/daud.c index 9b0e008347..c8af2e4430 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -65,7 +65,7 @@ static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt) } #if CONFIG_DAUD_DEMUXER -AVInputFormat daud_demuxer = { +AVInputFormat ff_daud_demuxer = { "daud", NULL_IF_CONFIG_SMALL("D-Cinema audio format"), 0, @@ -79,7 +79,7 @@ AVInputFormat daud_demuxer = { #endif #if CONFIG_DAUD_MUXER -AVOutputFormat daud_muxer = +AVOutputFormat ff_daud_muxer = { "daud", NULL_IF_CONFIG_SMALL("D-Cinema audio format"), diff --git a/libavformat/diracdec.c b/libavformat/diracdec.c index aa887e736a..6c6896163b 100644 --- a/libavformat/diracdec.c +++ b/libavformat/diracdec.c @@ -31,7 +31,7 @@ static int dirac_probe(AVProbeData *p) return 0; } -AVInputFormat dirac_demuxer = { +AVInputFormat ff_dirac_demuxer = { "dirac", NULL_IF_CONFIG_SMALL("raw Dirac"), 0, diff --git a/libavformat/dnxhddec.c b/libavformat/dnxhddec.c index edd44fee76..035e1c4b30 100644 --- a/libavformat/dnxhddec.c +++ b/libavformat/dnxhddec.c @@ -42,7 +42,7 @@ static int dnxhd_probe(AVProbeData *p) return AVPROBE_SCORE_MAX; } -AVInputFormat dnxhd_demuxer = { +AVInputFormat ff_dnxhd_demuxer = { "dnxhd", NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"), 0, diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index af5e2d9472..10a2a9d24f 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -216,7 +216,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat dsicin_demuxer = { +AVInputFormat ff_dsicin_demuxer = { "dsicin", NULL_IF_CONFIG_SMALL("Delphine Software International CIN format"), sizeof(CinDemuxContext), diff --git a/libavformat/dtsdec.c b/libavformat/dtsdec.c index c132c086b1..b203597283 100644 --- a/libavformat/dtsdec.c +++ b/libavformat/dtsdec.c @@ -65,7 +65,7 @@ static int dts_probe(AVProbeData *p) return 0; } -AVInputFormat dts_demuxer = { +AVInputFormat ff_dts_demuxer = { "dts", NULL_IF_CONFIG_SMALL("raw DTS"), 0, diff --git a/libavformat/dv.c b/libavformat/dv.c index d7f54d6c55..1f05eb2d44 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -518,7 +518,7 @@ static int dv_probe(AVProbeData *p) } #if CONFIG_DV_DEMUXER -AVInputFormat dv_demuxer = { +AVInputFormat ff_dv_demuxer = { "dv", NULL_IF_CONFIG_SMALL("DV video format"), sizeof(RawDVContext), diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index e48d8d09d4..faaa529813 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -399,7 +399,7 @@ static int dv_write_trailer(struct AVFormatContext *s) return 0; } -AVOutputFormat dv_muxer = { +AVOutputFormat ff_dv_muxer = { "dv", NULL_IF_CONFIG_SMALL("DV video format"), NULL, diff --git a/libavformat/dxa.c b/libavformat/dxa.c index c00c917d0b..6ad4582e5e 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -209,7 +209,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EIO); } -AVInputFormat dxa_demuxer = { +AVInputFormat ff_dxa_demuxer = { "dxa", NULL_IF_CONFIG_SMALL("DXA"), sizeof(DXAContext), diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c index 32c3343320..809b190dd1 100644 --- a/libavformat/eacdata.c +++ b/libavformat/eacdata.c @@ -90,7 +90,7 @@ static int cdata_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat ea_cdata_demuxer = { +AVInputFormat ff_ea_cdata_demuxer = { "ea_cdata", NULL_IF_CONFIG_SMALL("Electronic Arts cdata"), sizeof(CdataDemuxContext), diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index b796edeb9c..5408a1f0de 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -568,7 +568,7 @@ get_video_packet: return ret; } -AVInputFormat ea_demuxer = { +AVInputFormat ff_ea_demuxer = { "ea", NULL_IF_CONFIG_SMALL("Electronic Arts Multimedia Format"), sizeof(EaDemuxContext), diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 050702e1be..b2fc0cd8b1 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -518,7 +518,7 @@ static int ffm_probe(AVProbeData *p) return 0; } -AVInputFormat ffm_demuxer = { +AVInputFormat ff_ffm_demuxer = { "ffm", NULL_IF_CONFIG_SMALL("FFM (FFserver live feed) format"), sizeof(FFMContext), diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index 10c0f118a7..f9e0782c4b 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -240,7 +240,7 @@ static int ffm_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat ffm_muxer = { +AVOutputFormat ff_ffm_muxer = { "ffm", NULL_IF_CONFIG_SMALL("FFM (FFserver live feed) format"), "", diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c index 66ad953a0d..ab35746efc 100644 --- a/libavformat/ffmetadec.c +++ b/libavformat/ffmetadec.c @@ -163,7 +163,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR_EOF; } -AVInputFormat ffmetadata_demuxer = { +AVInputFormat ff_ffmetadata_demuxer = { .name = "ffmetadata", .long_name = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text format"), .read_probe = probe, diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index 785b537332..b20abc9036 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -89,7 +89,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVOutputFormat ffmetadata_muxer = { +AVOutputFormat ff_ffmetadata_muxer = { .name = "ffmetadata", .long_name = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text format"), .extensions = "ffmeta", diff --git a/libavformat/file.c b/libavformat/file.c index 3c3f42f4df..4f14b9f6c6 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -94,7 +94,7 @@ static int file_close(URLContext *h) return close(fd); } -URLProtocol file_protocol = { +URLProtocol ff_file_protocol = { "file", file_open, file_read, @@ -130,7 +130,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags) return 0; } -URLProtocol pipe_protocol = { +URLProtocol ff_pipe_protocol = { "pipe", pipe_open, file_read, diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 0442fc370d..805ca991bc 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -98,7 +98,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in return 0; } -AVInputFormat filmstrip_demuxer = { +AVInputFormat ff_filmstrip_demuxer = { "filmstrip", NULL_IF_CONFIG_SMALL("Adobe Filmstrip"), sizeof(FilmstripDemuxContext), diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c index 4e10c28af2..6da575cc47 100644 --- a/libavformat/filmstripenc.c +++ b/libavformat/filmstripenc.c @@ -71,7 +71,7 @@ static int write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat filmstrip_muxer = { +AVOutputFormat ff_filmstrip_muxer = { "filmstrip", NULL_IF_CONFIG_SMALL("Adobe Filmstrip"), NULL, diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index d73486f4f4..f971d0997c 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -123,7 +123,7 @@ static int flac_probe(AVProbeData *p) else return AVPROBE_SCORE_MAX/2; } -AVInputFormat flac_demuxer = { +AVInputFormat ff_flac_demuxer = { "flac", NULL_IF_CONFIG_SMALL("raw FLAC"), 0, diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index 281d013430..5eee5bec09 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -118,7 +118,7 @@ static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt) return 0; } -AVOutputFormat flac_muxer = { +AVOutputFormat ff_flac_muxer = { "flac", NULL_IF_CONFIG_SMALL("raw FLAC"), "audio/x-flac", diff --git a/libavformat/flic.c b/libavformat/flic.c index 51320c9da3..bf93c5c9b6 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -259,7 +259,7 @@ static int flic_read_packet(AVFormatContext *s, return ret; } -AVInputFormat flic_demuxer = { +AVInputFormat ff_flic_demuxer = { "flic", NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation format"), sizeof(FlicDemuxContext), diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index b3592611e9..e442caca64 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -491,7 +491,7 @@ static int flv_read_seek2(AVFormatContext *s, int stream_index, } #endif -AVInputFormat flv_demuxer = { +AVInputFormat ff_flv_demuxer = { "flv", NULL_IF_CONFIG_SMALL("FLV format"), sizeof(FLVContext), diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index e138292109..b6e406bfa1 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -437,7 +437,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVOutputFormat flv_muxer = { +AVOutputFormat ff_flv_muxer = { "flv", NULL_IF_CONFIG_SMALL("FLV format"), "video/x-flv", diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c index f59a0c8c2d..f456ec6816 100644 --- a/libavformat/framecrcenc.c +++ b/libavformat/framecrcenc.c @@ -33,7 +33,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) return 0; } -AVOutputFormat framecrc_muxer = { +AVOutputFormat ff_framecrc_muxer = { "framecrc", NULL_IF_CONFIG_SMALL("framecrc testing format"), NULL, diff --git a/libavformat/gif.c b/libavformat/gif.c index 4741915bac..2388f9ba69 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -344,7 +344,7 @@ static int gif_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat gif_muxer = { +AVOutputFormat ff_gif_muxer = { "gif", NULL_IF_CONFIG_SMALL("GIF Animation"), "image/gif", diff --git a/libavformat/gopher.c b/libavformat/gopher.c index b528f9bbbf..767ec22a7c 100644 --- a/libavformat/gopher.c +++ b/libavformat/gopher.c @@ -119,7 +119,7 @@ static int gopher_read(URLContext *h, uint8_t *buf, int size) } -URLProtocol gopher_protocol = { +URLProtocol ff_gopher_protocol = { "gopher", gopher_open, gopher_read, diff --git a/libavformat/gxf.c b/libavformat/gxf.c index d37a1d80a2..1e08d826c1 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -515,7 +515,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, return res; } -AVInputFormat gxf_demuxer = { +AVInputFormat ff_gxf_demuxer = { "gxf", NULL_IF_CONFIG_SMALL("GXF format"), 0, diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 565a86580f..94976a3619 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -927,7 +927,7 @@ static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pk av_interleave_packet_per_dts, gxf_compare_field_nb); } -AVOutputFormat gxf_muxer = { +AVOutputFormat ff_gxf_muxer = { "gxf", NULL_IF_CONFIG_SMALL("GXF format"), NULL, diff --git a/libavformat/h261dec.c b/libavformat/h261dec.c index 13394a1c86..1478ed663f 100644 --- a/libavformat/h261dec.c +++ b/libavformat/h261dec.c @@ -62,7 +62,7 @@ static int h261_probe(AVProbeData *p) return 0; } -AVInputFormat h261_demuxer = { +AVInputFormat ff_h261_demuxer = { "h261", NULL_IF_CONFIG_SMALL("raw H.261"), 0, diff --git a/libavformat/h263dec.c b/libavformat/h263dec.c index e27c395dd2..634923d885 100644 --- a/libavformat/h263dec.c +++ b/libavformat/h263dec.c @@ -64,7 +64,7 @@ static int h263_probe(AVProbeData *p) return 0; } -AVInputFormat h263_demuxer = { +AVInputFormat ff_h263_demuxer = { "h263", NULL_IF_CONFIG_SMALL("raw H.263"), 0, diff --git a/libavformat/h264dec.c b/libavformat/h264dec.c index 10c239d439..3f5ed5eabb 100644 --- a/libavformat/h264dec.c +++ b/libavformat/h264dec.c @@ -67,7 +67,7 @@ static int h264_probe(AVProbeData *p) return 0; } -AVInputFormat h264_demuxer = { +AVInputFormat ff_h264_demuxer = { "h264", NULL_IF_CONFIG_SMALL("raw H.264 video format"), 0, diff --git a/libavformat/http.c b/libavformat/http.c index e9fab3b616..3d63a6d00c 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -503,7 +503,7 @@ http_get_file_handle(URLContext *h) return url_get_file_handle(s->hd); } -URLProtocol http_protocol = { +URLProtocol ff_http_protocol = { "http", http_open, http_read, diff --git a/libavformat/idcin.c b/libavformat/idcin.c index cd4ebf83fc..e40d725f0c 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -286,7 +286,7 @@ static int idcin_read_packet(AVFormatContext *s, return ret; } -AVInputFormat idcin_demuxer = { +AVInputFormat ff_idcin_demuxer = { "idcin", NULL_IF_CONFIG_SMALL("id Cinematic format"), sizeof(IdcinDemuxContext), diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 6b036d9c07..285a3e1ed2 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -216,7 +216,7 @@ static int roq_read_packet(AVFormatContext *s, return ret; } -AVInputFormat roq_demuxer = { +AVInputFormat ff_roq_demuxer = { "RoQ", NULL_IF_CONFIG_SMALL("id RoQ format"), sizeof(RoqDemuxContext), diff --git a/libavformat/idroqenc.c b/libavformat/idroqenc.c index fda899a18f..8859c98a93 100644 --- a/libavformat/idroqenc.c +++ b/libavformat/idroqenc.c @@ -35,7 +35,7 @@ static int roq_write_header(struct AVFormatContext *s) return 0; } -AVOutputFormat roq_muxer = +AVOutputFormat ff_roq_muxer = { "RoQ", NULL_IF_CONFIG_SMALL("raw id RoQ format"), diff --git a/libavformat/iff.c b/libavformat/iff.c index e87195654f..90a3ea9c2e 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -314,7 +314,7 @@ static int iff_read_packet(AVFormatContext *s, return ret; } -AVInputFormat iff_demuxer = { +AVInputFormat ff_iff_demuxer = { "IFF", NULL_IF_CONFIG_SMALL("IFF format"), sizeof(IffDemuxContext), diff --git a/libavformat/img2.c b/libavformat/img2.c index 71f1dd0a1b..4cf409e001 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -412,7 +412,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) /* input */ #if CONFIG_IMAGE2_DEMUXER -AVInputFormat image2_demuxer = { +AVInputFormat ff_image2_demuxer = { .name = "image2", .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"), .priv_data_size = sizeof(VideoData), @@ -423,7 +423,7 @@ AVInputFormat image2_demuxer = { }; #endif #if CONFIG_IMAGE2PIPE_DEMUXER -AVInputFormat image2pipe_demuxer = { +AVInputFormat ff_image2pipe_demuxer = { .name = "image2pipe", .long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"), .priv_data_size = sizeof(VideoData), @@ -434,7 +434,7 @@ AVInputFormat image2pipe_demuxer = { /* output */ #if CONFIG_IMAGE2_MUXER -AVOutputFormat image2_muxer = { +AVOutputFormat ff_image2_muxer = { .name = "image2", .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"), .extensions = "bmp,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png," @@ -447,7 +447,7 @@ AVOutputFormat image2_muxer = { }; #endif #if CONFIG_IMAGE2PIPE_MUXER -AVOutputFormat image2pipe_muxer = { +AVOutputFormat ff_image2pipe_muxer = { .name = "image2pipe", .long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"), .priv_data_size = sizeof(VideoData), diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c index 61d39e1d10..79587b5192 100644 --- a/libavformat/ingenientdec.c +++ b/libavformat/ingenientdec.c @@ -58,7 +58,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat ingenient_demuxer = { +AVInputFormat ff_ingenient_demuxer = { "ingenient", NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"), 0, diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 18077b5e65..6d84402cf8 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -620,7 +620,7 @@ static int ipmovie_read_packet(AVFormatContext *s, return ret; } -AVInputFormat ipmovie_demuxer = { +AVInputFormat ff_ipmovie_demuxer = { "ipmovie", NULL_IF_CONFIG_SMALL("Interplay MVE format"), sizeof(IPMVEContext), diff --git a/libavformat/iss.c b/libavformat/iss.c index 156af976ca..c47c8c8784 100644 --- a/libavformat/iss.c +++ b/libavformat/iss.c @@ -122,7 +122,7 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat iss_demuxer = { +AVInputFormat ff_iss_demuxer = { "ISS", NULL_IF_CONFIG_SMALL("Funcom ISS format"), sizeof(IssDemuxContext), diff --git a/libavformat/iv8.c b/libavformat/iv8.c index 00ddcd4f7a..07659cf8f5 100644 --- a/libavformat/iv8.c +++ b/libavformat/iv8.c @@ -84,7 +84,7 @@ retry: return ret; } -AVInputFormat iv8_demuxer = { +AVInputFormat ff_iv8_demuxer = { "iv8", NULL_IF_CONFIG_SMALL("A format generated by IndigoVision 8000 video server"), 0, diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index 9baa3ec20e..94b8b82a41 100644 --- a/libavformat/ivfdec.c +++ b/libavformat/ivfdec.c @@ -79,7 +79,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat ivf_demuxer = { +AVInputFormat ff_ivf_demuxer = { "ivf", NULL_IF_CONFIG_SMALL("On2 IVF"), 0, diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index c9e1782d80..b3b28419f1 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -58,7 +58,7 @@ static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVOutputFormat ivf_muxer = { +AVOutputFormat ff_ivf_muxer = { .name = "ivf", .long_name = NULL_IF_CONFIG_SMALL("On2 IVF"), .extensions = "ivf", diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 4543df7bd9..5630bf8c58 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -150,7 +150,7 @@ static int nut_write_trailer(AVFormatContext * avf) { return 0; } -AVOutputFormat libnut_muxer = { +AVOutputFormat ff_libnut_muxer = { "libnut", "nut format", "video/x-nut", @@ -297,7 +297,7 @@ static int nut_read_close(AVFormatContext *s) { return 0; } -AVInputFormat libnut_demuxer = { +AVInputFormat ff_libnut_demuxer = { "libnut", NULL_IF_CONFIG_SMALL("NUT format"), sizeof(NUTContext), diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c index 344f0f9088..632ac95dd3 100644 --- a/libavformat/librtmp.c +++ b/libavformat/librtmp.c @@ -157,7 +157,7 @@ static int rtmp_get_file_handle(URLContext *s) return RTMP_Socket(r); } -URLProtocol rtmp_protocol = { +URLProtocol ff_rtmp_protocol = { "rtmp", rtmp_open, rtmp_read, @@ -170,7 +170,7 @@ URLProtocol rtmp_protocol = { rtmp_get_file_handle }; -URLProtocol rtmpt_protocol = { +URLProtocol ff_rtmpt_protocol = { "rtmpt", rtmp_open, rtmp_read, @@ -183,7 +183,7 @@ URLProtocol rtmpt_protocol = { rtmp_get_file_handle }; -URLProtocol rtmpe_protocol = { +URLProtocol ff_rtmpe_protocol = { "rtmpe", rtmp_open, rtmp_read, @@ -196,7 +196,7 @@ URLProtocol rtmpe_protocol = { rtmp_get_file_handle }; -URLProtocol rtmpte_protocol = { +URLProtocol ff_rtmpte_protocol = { "rtmpte", rtmp_open, rtmp_read, @@ -209,7 +209,7 @@ URLProtocol rtmpte_protocol = { rtmp_get_file_handle }; -URLProtocol rtmps_protocol = { +URLProtocol ff_rtmps_protocol = { "rtmps", rtmp_open, rtmp_read, diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index c1397fbb45..5cb202e4e2 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -117,7 +117,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { return ret; } -AVInputFormat lmlm4_demuxer = { +AVInputFormat ff_lmlm4_demuxer = { "lmlm4", NULL_IF_CONFIG_SMALL("lmlm4 raw format"), 0, diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 2575f36914..1d4d269d86 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -336,7 +336,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat lxf_demuxer = { +AVInputFormat ff_lxf_demuxer = { .name = "lxf", .long_name = NULL_IF_CONFIG_SMALL("VR native stream format (LXF)"), .priv_data_size = sizeof(LXFDemuxContext), diff --git a/libavformat/m4vdec.c b/libavformat/m4vdec.c index fdd3a808c6..4b0154edcd 100644 --- a/libavformat/m4vdec.c +++ b/libavformat/m4vdec.c @@ -49,7 +49,7 @@ static int mpeg4video_probe(AVProbeData *probe_packet) return 0; } -AVInputFormat m4v_demuxer = { +AVInputFormat ff_m4v_demuxer = { "m4v", NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"), 0, diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 820140fb9e..1a87f4a0c6 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1920,7 +1920,7 @@ static int matroska_read_close(AVFormatContext *s) return 0; } -AVInputFormat matroska_demuxer = { +AVInputFormat ff_matroska_demuxer = { "matroska,webm", NULL_IF_CONFIG_SMALL("Matroska/WebM file format"), sizeof(MatroskaDemuxContext), diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index dc08c18f50..a288c7f85f 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1177,7 +1177,7 @@ static int mkv_write_trailer(AVFormatContext *s) } #if CONFIG_MATROSKA_MUXER -AVOutputFormat matroska_muxer = { +AVOutputFormat ff_matroska_muxer = { "matroska", NULL_IF_CONFIG_SMALL("Matroska file format"), "video/x-matroska", @@ -1195,7 +1195,7 @@ AVOutputFormat matroska_muxer = { #endif #if CONFIG_WEBM_MUXER -AVOutputFormat webm_muxer = { +AVOutputFormat ff_webm_muxer = { "webm", NULL_IF_CONFIG_SMALL("WebM file format"), "video/webm", @@ -1211,7 +1211,7 @@ AVOutputFormat webm_muxer = { #endif #if CONFIG_MATROSKA_AUDIO_MUXER -AVOutputFormat matroska_audio_muxer = { +AVOutputFormat ff_matroska_audio_muxer = { "matroska", NULL_IF_CONFIG_SMALL("Matroska file format"), "audio/x-matroska", diff --git a/libavformat/md5enc.c b/libavformat/md5enc.c index f9ab3d0933..dd2f7c03ae 100644 --- a/libavformat/md5enc.c +++ b/libavformat/md5enc.c @@ -65,7 +65,7 @@ static int write_trailer(struct AVFormatContext *s) return 0; } -AVOutputFormat md5_muxer = { +AVOutputFormat ff_md5_muxer = { "md5", NULL_IF_CONFIG_SMALL("MD5 testing format"), NULL, @@ -95,7 +95,7 @@ static int framemd5_write_packet(struct AVFormatContext *s, AVPacket *pkt) return 0; } -AVOutputFormat framemd5_muxer = { +AVOutputFormat ff_framemd5_muxer = { "framemd5", NULL_IF_CONFIG_SMALL("Per-frame MD5 testing format"), NULL, diff --git a/libavformat/md5proto.c b/libavformat/md5proto.c index 63e9fe4176..c391dffedf 100644 --- a/libavformat/md5proto.c +++ b/libavformat/md5proto.c @@ -82,7 +82,7 @@ static int md5_get_handle(URLContext *h) return (intptr_t)h->priv_data; } -URLProtocol md5_protocol = { +URLProtocol ff_md5_protocol = { .name = "md5", .url_open = md5_open, .url_write = md5_write, diff --git a/libavformat/mm.c b/libavformat/mm.c index cb0917a7ab..475930f84a 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -188,7 +188,7 @@ static int read_packet(AVFormatContext *s, return 0; } -AVInputFormat mm_demuxer = { +AVInputFormat ff_mm_demuxer = { "mm", NULL_IF_CONFIG_SMALL("American Laser Games MM format"), sizeof(MmDemuxContext), diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 85b23a3a6a..2b2af4df28 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -291,7 +291,7 @@ static int mmf_read_packet(AVFormatContext *s, } #if CONFIG_MMF_DEMUXER -AVInputFormat mmf_demuxer = { +AVInputFormat ff_mmf_demuxer = { "mmf", NULL_IF_CONFIG_SMALL("Yamaha SMAF"), sizeof(MMFContext), @@ -303,7 +303,7 @@ AVInputFormat mmf_demuxer = { }; #endif #if CONFIG_MMF_MUXER -AVOutputFormat mmf_muxer = { +AVOutputFormat ff_mmf_muxer = { "mmf", NULL_IF_CONFIG_SMALL("Yamaha SMAF"), "application/vnd.smaf", diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c index 3581431c25..b0acd1020f 100644 --- a/libavformat/mmsh.c +++ b/libavformat/mmsh.c @@ -359,7 +359,7 @@ static int mmsh_read(URLContext *h, uint8_t *buf, int size) return res; } -URLProtocol mmsh_protocol = { +URLProtocol ff_mmsh_protocol = { .name = "mmsh", .url_open = mmsh_open, .url_read = mmsh_read, diff --git a/libavformat/mmst.c b/libavformat/mmst.c index 08e3b3e660..d3417d1659 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -621,7 +621,7 @@ static int mms_read(URLContext *h, uint8_t *buf, int size) return result; } -URLProtocol mmst_protocol = { +URLProtocol ff_mmst_protocol = { "mmst", mms_open, mms_read, diff --git a/libavformat/mov.c b/libavformat/mov.c index d52928ce41..18a923835c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2561,7 +2561,7 @@ static int mov_read_close(AVFormatContext *s) return 0; } -AVInputFormat mov_demuxer = { +AVInputFormat ff_mov_demuxer = { "mov,mp4,m4a,3gp,3g2,mj2", NULL_IF_CONFIG_SMALL("QuickTime/MPEG-4/Motion JPEG 2000 format"), sizeof(MOVContext), diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 5230938872..5886dfeae6 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2205,7 +2205,7 @@ static int mov_write_trailer(AVFormatContext *s) } #if CONFIG_MOV_MUXER -AVOutputFormat mov_muxer = { +AVOutputFormat ff_mov_muxer = { "mov", NULL_IF_CONFIG_SMALL("MOV format"), NULL, @@ -2221,7 +2221,7 @@ AVOutputFormat mov_muxer = { }; #endif #if CONFIG_TGP_MUXER -AVOutputFormat tgp_muxer = { +AVOutputFormat ff_tgp_muxer = { "3gp", NULL_IF_CONFIG_SMALL("3GP format"), NULL, @@ -2237,7 +2237,7 @@ AVOutputFormat tgp_muxer = { }; #endif #if CONFIG_MP4_MUXER -AVOutputFormat mp4_muxer = { +AVOutputFormat ff_mp4_muxer = { "mp4", NULL_IF_CONFIG_SMALL("MP4 format"), "application/mp4", @@ -2253,7 +2253,7 @@ AVOutputFormat mp4_muxer = { }; #endif #if CONFIG_PSP_MUXER -AVOutputFormat psp_muxer = { +AVOutputFormat ff_psp_muxer = { "psp", NULL_IF_CONFIG_SMALL("PSP MP4 format"), NULL, @@ -2269,7 +2269,7 @@ AVOutputFormat psp_muxer = { }; #endif #if CONFIG_TG2_MUXER -AVOutputFormat tg2_muxer = { +AVOutputFormat ff_tg2_muxer = { "3g2", NULL_IF_CONFIG_SMALL("3GP2 format"), NULL, @@ -2285,7 +2285,7 @@ AVOutputFormat tg2_muxer = { }; #endif #if CONFIG_IPOD_MUXER -AVOutputFormat ipod_muxer = { +AVOutputFormat ff_ipod_muxer = { "ipod", NULL_IF_CONFIG_SMALL("iPod H.264 MP4 format"), "application/mp4", diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index c06969b058..5bc4ce64dc 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -185,7 +185,7 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat mp3_demuxer = { +AVInputFormat ff_mp3_demuxer = { "mp3", NULL_IF_CONFIG_SMALL("MPEG audio layer 2/3"), 0, diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 139f2d414a..b2c0a7e6f8 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -134,7 +134,7 @@ static int mp3_write_trailer(struct AVFormatContext *s) } #if CONFIG_MP2_MUXER -AVOutputFormat mp2_muxer = { +AVOutputFormat ff_mp2_muxer = { "mp2", NULL_IF_CONFIG_SMALL("MPEG audio layer 2"), "audio/x-mpeg", @@ -233,7 +233,7 @@ static int mp3_write_header(struct AVFormatContext *s) return 0; } -AVOutputFormat mp3_muxer = { +AVOutputFormat ff_mp3_muxer = { "mp3", NULL_IF_CONFIG_SMALL("MPEG audio layer 3"), "audio/x-mpeg", diff --git a/libavformat/mpc.c b/libavformat/mpc.c index ecc980980a..aa0572603f 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -212,7 +212,7 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp } -AVInputFormat mpc_demuxer = { +AVInputFormat ff_mpc_demuxer = { "mpc", NULL_IF_CONFIG_SMALL("Musepack"), sizeof(MPCContext), diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 92e996c29c..11173004f5 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -279,7 +279,7 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam } -AVInputFormat mpc8_demuxer = { +AVInputFormat ff_mpc8_demuxer = { "mpc8", NULL_IF_CONFIG_SMALL("Musepack SV8"), sizeof(MPCContext), diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 6fd0125f5d..135482b7c8 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -610,7 +610,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, return dts; } -AVInputFormat mpegps_demuxer = { +AVInputFormat ff_mpegps_demuxer = { "mpeg", NULL_IF_CONFIG_SMALL("MPEG-PS format"), sizeof(MpegDemuxContext), diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 5c090f63b0..eef385f06c 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -76,10 +76,10 @@ typedef struct { } MpegMuxContext; -extern AVOutputFormat mpeg1vcd_muxer; -extern AVOutputFormat mpeg2dvd_muxer; -extern AVOutputFormat mpeg2svcd_muxer; -extern AVOutputFormat mpeg2vob_muxer; +extern AVOutputFormat ff_mpeg1vcd_muxer; +extern AVOutputFormat ff_mpeg2dvd_muxer; +extern AVOutputFormat ff_mpeg2svcd_muxer; +extern AVOutputFormat ff_mpeg2vob_muxer; static int put_pack_header(AVFormatContext *ctx, uint8_t *buf, int64_t timestamp) @@ -297,12 +297,12 @@ static int mpeg_mux_init(AVFormatContext *ctx) int video_bitrate; s->packet_number = 0; - s->is_vcd = (CONFIG_MPEG1VCD_MUXER && ctx->oformat == &mpeg1vcd_muxer); - s->is_svcd = (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &mpeg2svcd_muxer); - s->is_mpeg2 = ((CONFIG_MPEG2VOB_MUXER && ctx->oformat == &mpeg2vob_muxer) || - (CONFIG_MPEG2DVD_MUXER && ctx->oformat == &mpeg2dvd_muxer) || - (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &mpeg2svcd_muxer)); - s->is_dvd = (CONFIG_MPEG2DVD_MUXER && ctx->oformat == &mpeg2dvd_muxer); + s->is_vcd = (CONFIG_MPEG1VCD_MUXER && ctx->oformat == &ff_mpeg1vcd_muxer); + s->is_svcd = (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &ff_mpeg2svcd_muxer); + s->is_mpeg2 = ((CONFIG_MPEG2VOB_MUXER && ctx->oformat == &ff_mpeg2vob_muxer) || + (CONFIG_MPEG2DVD_MUXER && ctx->oformat == &ff_mpeg2dvd_muxer) || + (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &ff_mpeg2svcd_muxer)); + s->is_dvd = (CONFIG_MPEG2DVD_MUXER && ctx->oformat == &ff_mpeg2dvd_muxer); if(ctx->packet_size) { if (ctx->packet_size < 20 || ctx->packet_size > (1 << 23) + 10) { @@ -1233,7 +1233,7 @@ static int mpeg_mux_end(AVFormatContext *ctx) } #if CONFIG_MPEG1SYSTEM_MUXER -AVOutputFormat mpeg1system_muxer = { +AVOutputFormat ff_mpeg1system_muxer = { "mpeg", NULL_IF_CONFIG_SMALL("MPEG-1 System format"), "video/mpeg", @@ -1247,7 +1247,7 @@ AVOutputFormat mpeg1system_muxer = { }; #endif #if CONFIG_MPEG1VCD_MUXER -AVOutputFormat mpeg1vcd_muxer = { +AVOutputFormat ff_mpeg1vcd_muxer = { "vcd", NULL_IF_CONFIG_SMALL("MPEG-1 System format (VCD)"), "video/mpeg", @@ -1261,7 +1261,7 @@ AVOutputFormat mpeg1vcd_muxer = { }; #endif #if CONFIG_MPEG2VOB_MUXER -AVOutputFormat mpeg2vob_muxer = { +AVOutputFormat ff_mpeg2vob_muxer = { "vob", NULL_IF_CONFIG_SMALL("MPEG-2 PS format (VOB)"), "video/mpeg", @@ -1277,7 +1277,7 @@ AVOutputFormat mpeg2vob_muxer = { /* Same as mpeg2vob_mux except that the pack size is 2324 */ #if CONFIG_MPEG2SVCD_MUXER -AVOutputFormat mpeg2svcd_muxer = { +AVOutputFormat ff_mpeg2svcd_muxer = { "svcd", NULL_IF_CONFIG_SMALL("MPEG-2 PS format (VOB)"), "video/mpeg", @@ -1293,7 +1293,7 @@ AVOutputFormat mpeg2svcd_muxer = { /* Same as mpeg2vob_mux except the 'is_dvd' flag is set to produce NAV pkts */ #if CONFIG_MPEG2DVD_MUXER -AVOutputFormat mpeg2dvd_muxer = { +AVOutputFormat ff_mpeg2dvd_muxer = { "dvd", NULL_IF_CONFIG_SMALL("MPEG-2 PS format (DVD VOB)"), "video/mpeg", diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 959be31577..e8f31d6d0b 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -158,7 +158,7 @@ typedef struct PESContext { uint8_t *buffer; } PESContext; -extern AVInputFormat mpegts_demuxer; +extern AVInputFormat ff_mpegts_demuxer; static void clear_program(MpegTSContext *ts, unsigned int programid) { @@ -1468,7 +1468,7 @@ static int mpegts_read_header(AVFormatContext *s, ts->stream = s; ts->auto_guess = 0; - if (s->iformat == &mpegts_demuxer) { + if (s->iformat == &ff_mpegts_demuxer) { /* normal demux */ /* first do a scaning to get all the services */ @@ -1845,7 +1845,7 @@ void ff_mpegts_parse_close(MpegTSContext *ts) av_free(ts); } -AVInputFormat mpegts_demuxer = { +AVInputFormat ff_mpegts_demuxer = { "mpegts", NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"), sizeof(MpegTSContext), @@ -1861,7 +1861,7 @@ AVInputFormat mpegts_demuxer = { #endif }; -AVInputFormat mpegtsraw_demuxer = { +AVInputFormat ff_mpegtsraw_demuxer = { "mpegtsraw", NULL_IF_CONFIG_SMALL("MPEG-2 raw transport stream format"), sizeof(MpegTSContext), diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 147faaed0d..3c56830d00 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -948,7 +948,7 @@ static int mpegts_write_end(AVFormatContext *s) return 0; } -AVOutputFormat mpegts_muxer = { +AVOutputFormat ff_mpegts_muxer = { "mpegts", NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"), "video/x-mpegts", diff --git a/libavformat/mpegvideodec.c b/libavformat/mpegvideodec.c index d0b9a2c658..d1ba1f8c2c 100644 --- a/libavformat/mpegvideodec.c +++ b/libavformat/mpegvideodec.c @@ -55,7 +55,7 @@ static int mpegvideo_probe(AVProbeData *p) return 0; } -AVInputFormat mpegvideo_demuxer = { +AVInputFormat ff_mpegvideo_demuxer = { "mpegvideo", NULL_IF_CONFIG_SMALL("raw MPEG video"), 0, diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c index 89738773c1..76f598598b 100644 --- a/libavformat/mpjpeg.c +++ b/libavformat/mpjpeg.c @@ -53,7 +53,7 @@ static int mpjpeg_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat mpjpeg_muxer = { +AVOutputFormat ff_mpjpeg_muxer = { "mpjpeg", NULL_IF_CONFIG_SMALL("MIME multipart JPEG format"), "multipart/x-mixed-replace;boundary=" BOUNDARY_TAG, diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index e5488718bc..f9cde02780 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -130,7 +130,7 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) return HEADER_SIZE + size; } -AVInputFormat msnwc_tcp_demuxer = { +AVInputFormat ff_msnwc_tcp_demuxer = { "msnwctcp", NULL_IF_CONFIG_SMALL("MSN TCP Webcam stream"), 0, diff --git a/libavformat/mtv.c b/libavformat/mtv.c index 9280455d25..acb21a99b8 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -196,7 +196,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat mtv_demuxer = { +AVInputFormat ff_mtv_demuxer = { "MTV", NULL_IF_CONFIG_SMALL("MTV format"), sizeof(MTVDemuxContext), diff --git a/libavformat/mvi.c b/libavformat/mvi.c index 506976df43..c982e6bc68 100644 --- a/libavformat/mvi.c +++ b/libavformat/mvi.c @@ -123,7 +123,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat mvi_demuxer = { +AVInputFormat ff_mvi_demuxer = { "mvi", NULL_IF_CONFIG_SMALL("Motion Pixels MVI format"), sizeof(MviDemuxContext), diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index ac5ea4bb36..5276c8b2fa 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1014,7 +1014,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti return 0; } -AVInputFormat mxf_demuxer = { +AVInputFormat ff_mxf_demuxer = { "mxf", NULL_IF_CONFIG_SMALL("Material eXchange Format"), sizeof(MXFContext), diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index c53849a769..8a8d7ddaa7 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -44,7 +44,7 @@ static const int NTSC_samples_per_frame[] = { 1602, 1601, 1602, 1601, 1602, 0 }; static const int PAL_samples_per_frame[] = { 1920, 0 }; -extern AVOutputFormat mxf_d10_muxer; +extern AVOutputFormat ff_mxf_d10_muxer; #define EDIT_UNITS_PER_BODY 250 #define KAG_SIZE 512 @@ -1371,7 +1371,7 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, } } } - if (s->oformat != &mxf_d10_muxer) + if (s->oformat != &ff_mxf_d10_muxer) sc->codec_ul = mxf_get_mpeg2_codec_ul(st->codec); return !!sc->codec_ul; } @@ -1436,7 +1436,7 @@ static int mxf_write_header(AVFormatContext *s) return -1; } av_set_pts_info(st, 64, mxf->time_base.num, mxf->time_base.den); - if (s->oformat == &mxf_d10_muxer) { + if (s->oformat == &ff_mxf_d10_muxer) { if (st->codec->bit_rate == 50000000) if (mxf->time_base.den == 25) sc->index = 3; else sc->index = 5; @@ -1464,7 +1464,7 @@ static int mxf_write_header(AVFormatContext *s) return -1; } av_set_pts_info(st, 64, 1, st->codec->sample_rate); - if (s->oformat == &mxf_d10_muxer) { + if (s->oformat == &ff_mxf_d10_muxer) { if (st->index != 1) { av_log(s, AV_LOG_ERROR, "MXF D-10 only support one audio track\n"); return -1; @@ -1498,7 +1498,7 @@ static int mxf_write_header(AVFormatContext *s) present[sc->index]++; } - if (s->oformat == &mxf_d10_muxer) { + if (s->oformat == &ff_mxf_d10_muxer) { mxf->essence_container_count = 1; } @@ -1720,7 +1720,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) mxf_write_klv_fill(s); put_buffer(pb, sc->track_essence_element_key, 16); // write key - if (s->oformat == &mxf_d10_muxer) { + if (s->oformat == &ff_mxf_d10_muxer) { if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) mxf_write_d10_video_packet(s, st, pkt); else @@ -1879,7 +1879,7 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int mxf_interleave_get_packet, mxf_compare_timestamps); } -AVOutputFormat mxf_muxer = { +AVOutputFormat ff_mxf_muxer = { "mxf", NULL_IF_CONFIG_SMALL("Material eXchange Format"), "application/mxf", @@ -1895,7 +1895,7 @@ AVOutputFormat mxf_muxer = { mxf_interleave, }; -AVOutputFormat mxf_d10_muxer = { +AVOutputFormat ff_mxf_d10_muxer = { "mxf_d10", NULL_IF_CONFIG_SMALL("Material eXchange Format, D-10 Mapping"), "application/mxf", diff --git a/libavformat/mxg.c b/libavformat/mxg.c index e7791e871b..9be97d0d58 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -240,7 +240,7 @@ static int mxg_close(struct AVFormatContext *s) return 0; } -AVInputFormat mxg_demuxer = { +AVInputFormat ff_mxg_demuxer = { .name = "mxg", .long_name = NULL_IF_CONFIG_SMALL("MxPEG clip file format"), .priv_data_size = sizeof(MXGContext), diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c index 6d99a049e6..1472d15ca4 100644 --- a/libavformat/ncdec.c +++ b/libavformat/ncdec.c @@ -90,7 +90,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) return size; } -AVInputFormat nc_demuxer = { +AVInputFormat ff_nc_demuxer = { "nc", NULL_IF_CONFIG_SMALL("NC camera feed format"), 0, diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 44e5097d59..e15d6e283a 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -774,7 +774,7 @@ static int nsv_probe(AVProbeData *p) return 0; } -AVInputFormat nsv_demuxer = { +AVInputFormat ff_nsv_demuxer = { "nsv", NULL_IF_CONFIG_SMALL("Nullsoft Streaming Video"), sizeof(NSVContext), diff --git a/libavformat/nullenc.c b/libavformat/nullenc.c index 0785b77dbd..1a7d42e924 100644 --- a/libavformat/nullenc.c +++ b/libavformat/nullenc.c @@ -26,7 +26,7 @@ static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt) return 0; } -AVOutputFormat null_muxer = { +AVOutputFormat ff_null_muxer = { "null", NULL_IF_CONFIG_SMALL("raw null video format"), NULL, diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index bf72555876..a57410802f 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -926,7 +926,7 @@ static int nut_read_close(AVFormatContext *s) } #if CONFIG_NUT_DEMUXER -AVInputFormat nut_demuxer = { +AVInputFormat ff_nut_demuxer = { "nut", NULL_IF_CONFIG_SMALL("NUT format"), sizeof(NUTContext), diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index a030fee55c..288e4bd4d8 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -793,7 +793,7 @@ static int write_trailer(AVFormatContext *s){ return 0; } -AVOutputFormat nut_muxer = { +AVOutputFormat ff_nut_muxer = { "nut", NULL_IF_CONFIG_SMALL("NUT format"), "video/x-nut", diff --git a/libavformat/nuv.c b/libavformat/nuv.c index f0eacd5f8a..58a00dfa1b 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -257,7 +257,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { return AVERROR(EIO); } -AVInputFormat nuv_demuxer = { +AVInputFormat ff_nuv_demuxer = { "nuv", NULL_IF_CONFIG_SMALL("NuppelVideo format"), sizeof(NUVContext), diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 4fcf8ad58c..1b4553c73b 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -648,7 +648,7 @@ static int ogg_probe(AVProbeData *p) return 0; } -AVInputFormat ogg_demuxer = { +AVInputFormat ff_ogg_demuxer = { "ogg", NULL_IF_CONFIG_SMALL("Ogg"), sizeof (struct ogg), diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index b72efc8e98..4c2a9d6a61 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -502,7 +502,7 @@ static int ogg_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat ogg_muxer = { +AVOutputFormat ff_ogg_muxer = { "ogg", NULL_IF_CONFIG_SMALL("Ogg"), "application/ogg", diff --git a/libavformat/oma.c b/libavformat/oma.c index 0f471dd91f..158ed117c3 100644 --- a/libavformat/oma.c +++ b/libavformat/oma.c @@ -189,7 +189,7 @@ static int oma_read_probe(AVProbeData *p) } -AVInputFormat oma_demuxer = { +AVInputFormat ff_oma_demuxer = { "oma", NULL_IF_CONFIG_SMALL("Sony OpenMG audio"), 0, diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c index 26be4f4b1e..6441d89c5c 100644 --- a/libavformat/pcmdec.c +++ b/libavformat/pcmdec.c @@ -47,7 +47,7 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) } #define PCMDEF(name, long_name, ext, codec) \ -AVInputFormat pcm_ ## name ## _demuxer = {\ +AVInputFormat ff_pcm_ ## name ## _demuxer = {\ #name,\ NULL_IF_CONFIG_SMALL(long_name),\ 0,\ diff --git a/libavformat/pcmenc.c b/libavformat/pcmenc.c index bda94c37b1..385425ce77 100644 --- a/libavformat/pcmenc.c +++ b/libavformat/pcmenc.c @@ -23,7 +23,7 @@ #include "rawenc.h" #define PCMDEF(name, long_name, ext, codec) \ -AVOutputFormat pcm_ ## name ## _muxer = {\ +AVOutputFormat ff_pcm_ ## name ## _muxer = {\ #name,\ NULL_IF_CONFIG_SMALL(long_name),\ NULL,\ diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index 347c26e401..4b3d0f3ae0 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -258,7 +258,7 @@ static int str_read_close(AVFormatContext *s) return 0; } -AVInputFormat str_demuxer = { +AVInputFormat ff_str_demuxer = { "psxstr", NULL_IF_CONFIG_SMALL("Sony Playstation STR format"), sizeof(StrDemuxContext), diff --git a/libavformat/pva.c b/libavformat/pva.c index abbc6f1c60..544fc7d0cf 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -200,7 +200,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, return res; } -AVInputFormat pva_demuxer = { +AVInputFormat ff_pva_demuxer = { "pva", NULL_IF_CONFIG_SMALL("TechnoTrend PVA file and stream format"), sizeof(PVAContext), diff --git a/libavformat/qcp.c b/libavformat/qcp.c index 676e9c7c57..7bc32b97ce 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -187,7 +187,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR_EOF; } -AVInputFormat qcp_demuxer = { +AVInputFormat ff_qcp_demuxer = { .name = "qcp", .long_name = NULL_IF_CONFIG_SMALL("QCP format"), .priv_data_size = sizeof(QCPContext), diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 556a32b20e..62c64e0651 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -377,7 +377,7 @@ static int r3d_close(AVFormatContext *s) return 0; } -AVInputFormat r3d_demuxer = { +AVInputFormat ff_r3d_demuxer = { "r3d", NULL_IF_CONFIG_SMALL("REDCODE R3D format"), sizeof(R3DContext), diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index fe25014950..4f830e3c20 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -138,7 +138,7 @@ int ff_raw_video_read_header(AVFormatContext *s, /* Note: Do not forget to add new entries to the Makefile as well. */ #if CONFIG_G722_DEMUXER -AVInputFormat g722_demuxer = { +AVInputFormat ff_g722_demuxer = { "g722", NULL_IF_CONFIG_SMALL("raw G.722"), 0, @@ -152,7 +152,7 @@ AVInputFormat g722_demuxer = { #endif #if CONFIG_GSM_DEMUXER -AVInputFormat gsm_demuxer = { +AVInputFormat ff_gsm_demuxer = { "gsm", NULL_IF_CONFIG_SMALL("raw GSM"), 0, @@ -166,7 +166,7 @@ AVInputFormat gsm_demuxer = { #endif #if CONFIG_MJPEG_DEMUXER -AVInputFormat mjpeg_demuxer = { +AVInputFormat ff_mjpeg_demuxer = { "mjpeg", NULL_IF_CONFIG_SMALL("raw MJPEG video"), 0, @@ -180,7 +180,7 @@ AVInputFormat mjpeg_demuxer = { #endif #if CONFIG_MLP_DEMUXER -AVInputFormat mlp_demuxer = { +AVInputFormat ff_mlp_demuxer = { "mlp", NULL_IF_CONFIG_SMALL("raw MLP"), 0, @@ -194,7 +194,7 @@ AVInputFormat mlp_demuxer = { #endif #if CONFIG_TRUEHD_DEMUXER -AVInputFormat truehd_demuxer = { +AVInputFormat ff_truehd_demuxer = { "truehd", NULL_IF_CONFIG_SMALL("raw TrueHD"), 0, @@ -208,7 +208,7 @@ AVInputFormat truehd_demuxer = { #endif #if CONFIG_SHORTEN_DEMUXER -AVInputFormat shorten_demuxer = { +AVInputFormat ff_shorten_demuxer = { "shn", NULL_IF_CONFIG_SMALL("raw Shorten"), 0, @@ -222,7 +222,7 @@ AVInputFormat shorten_demuxer = { #endif #if CONFIG_VC1_DEMUXER -AVInputFormat vc1_demuxer = { +AVInputFormat ff_vc1_demuxer = { "vc1", NULL_IF_CONFIG_SMALL("raw VC-1"), 0, diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index 5a116b189e..6f9fdce4a1 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -33,7 +33,7 @@ int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt) /* Note: Do not forget to add new entries to the Makefile as well. */ #if CONFIG_AC3_MUXER -AVOutputFormat ac3_muxer = { +AVOutputFormat ff_ac3_muxer = { "ac3", NULL_IF_CONFIG_SMALL("raw AC-3"), "audio/x-ac3", @@ -48,7 +48,7 @@ AVOutputFormat ac3_muxer = { #endif #if CONFIG_DIRAC_MUXER -AVOutputFormat dirac_muxer = { +AVOutputFormat ff_dirac_muxer = { "dirac", NULL_IF_CONFIG_SMALL("raw Dirac"), NULL, @@ -63,7 +63,7 @@ AVOutputFormat dirac_muxer = { #endif #if CONFIG_DNXHD_MUXER -AVOutputFormat dnxhd_muxer = { +AVOutputFormat ff_dnxhd_muxer = { "dnxhd", NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"), NULL, @@ -78,7 +78,7 @@ AVOutputFormat dnxhd_muxer = { #endif #if CONFIG_DTS_MUXER -AVOutputFormat dts_muxer = { +AVOutputFormat ff_dts_muxer = { "dts", NULL_IF_CONFIG_SMALL("raw DTS"), "audio/x-dca", @@ -93,7 +93,7 @@ AVOutputFormat dts_muxer = { #endif #if CONFIG_EAC3_MUXER -AVOutputFormat eac3_muxer = { +AVOutputFormat ff_eac3_muxer = { "eac3", NULL_IF_CONFIG_SMALL("raw E-AC-3"), "audio/x-eac3", @@ -108,7 +108,7 @@ AVOutputFormat eac3_muxer = { #endif #if CONFIG_G722_MUXER -AVOutputFormat g722_muxer = { +AVOutputFormat ff_g722_muxer = { "g722", NULL_IF_CONFIG_SMALL("raw G.722"), "audio/G722", @@ -123,7 +123,7 @@ AVOutputFormat g722_muxer = { #endif #if CONFIG_H261_MUXER -AVOutputFormat h261_muxer = { +AVOutputFormat ff_h261_muxer = { "h261", NULL_IF_CONFIG_SMALL("raw H.261"), "video/x-h261", @@ -138,7 +138,7 @@ AVOutputFormat h261_muxer = { #endif #if CONFIG_H263_MUXER -AVOutputFormat h263_muxer = { +AVOutputFormat ff_h263_muxer = { "h263", NULL_IF_CONFIG_SMALL("raw H.263"), "video/x-h263", @@ -153,7 +153,7 @@ AVOutputFormat h263_muxer = { #endif #if CONFIG_H264_MUXER -AVOutputFormat h264_muxer = { +AVOutputFormat ff_h264_muxer = { "h264", NULL_IF_CONFIG_SMALL("raw H.264 video format"), NULL, @@ -168,7 +168,7 @@ AVOutputFormat h264_muxer = { #endif #if CONFIG_CAVSVIDEO_MUXER -AVOutputFormat cavsvideo_muxer = { +AVOutputFormat ff_cavsvideo_muxer = { "cavsvideo", NULL_IF_CONFIG_SMALL("raw Chinese AVS video"), NULL, @@ -183,7 +183,7 @@ AVOutputFormat cavsvideo_muxer = { #endif #if CONFIG_M4V_MUXER -AVOutputFormat m4v_muxer = { +AVOutputFormat ff_m4v_muxer = { "m4v", NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"), NULL, @@ -198,7 +198,7 @@ AVOutputFormat m4v_muxer = { #endif #if CONFIG_MJPEG_MUXER -AVOutputFormat mjpeg_muxer = { +AVOutputFormat ff_mjpeg_muxer = { "mjpeg", NULL_IF_CONFIG_SMALL("raw MJPEG video"), "video/x-mjpeg", @@ -213,7 +213,7 @@ AVOutputFormat mjpeg_muxer = { #endif #if CONFIG_MLP_MUXER -AVOutputFormat mlp_muxer = { +AVOutputFormat ff_mlp_muxer = { "mlp", NULL_IF_CONFIG_SMALL("raw MLP"), NULL, @@ -228,7 +228,7 @@ AVOutputFormat mlp_muxer = { #endif #if CONFIG_SRT_MUXER -AVOutputFormat srt_muxer = { +AVOutputFormat ff_srt_muxer = { .name = "srt", .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle format"), .mime_type = "application/x-subrip", @@ -240,7 +240,7 @@ AVOutputFormat srt_muxer = { #endif #if CONFIG_TRUEHD_MUXER -AVOutputFormat truehd_muxer = { +AVOutputFormat ff_truehd_muxer = { "truehd", NULL_IF_CONFIG_SMALL("raw TrueHD"), NULL, @@ -255,7 +255,7 @@ AVOutputFormat truehd_muxer = { #endif #if CONFIG_MPEG1VIDEO_MUXER -AVOutputFormat mpeg1video_muxer = { +AVOutputFormat ff_mpeg1video_muxer = { "mpeg1video", NULL_IF_CONFIG_SMALL("raw MPEG-1 video"), "video/x-mpeg", @@ -270,7 +270,7 @@ AVOutputFormat mpeg1video_muxer = { #endif #if CONFIG_MPEG2VIDEO_MUXER -AVOutputFormat mpeg2video_muxer = { +AVOutputFormat ff_mpeg2video_muxer = { "mpeg2video", NULL_IF_CONFIG_SMALL("raw MPEG-2 video"), NULL, @@ -285,7 +285,7 @@ AVOutputFormat mpeg2video_muxer = { #endif #if CONFIG_RAWVIDEO_MUXER -AVOutputFormat rawvideo_muxer = { +AVOutputFormat ff_rawvideo_muxer = { "rawvideo", NULL_IF_CONFIG_SMALL("raw video format"), NULL, diff --git a/libavformat/rawvideodec.c b/libavformat/rawvideodec.c index da613007bf..127119f18a 100644 --- a/libavformat/rawvideodec.c +++ b/libavformat/rawvideodec.c @@ -44,7 +44,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat rawvideo_demuxer = { +AVInputFormat ff_rawvideo_demuxer = { "rawvideo", NULL_IF_CONFIG_SMALL("raw video format"), 0, diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 303a2a8145..3428b4d3fe 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -528,7 +528,7 @@ rdt_new_context (void) { PayloadContext *rdt = av_mallocz(sizeof(PayloadContext)); - av_open_input_stream(&rdt->rmctx, NULL, "", &rdt_demuxer, NULL); + av_open_input_stream(&rdt->rmctx, NULL, "", &ff_rdt_demuxer, NULL); return rdt; } diff --git a/libavformat/rl2.c b/libavformat/rl2.c index bfffef3f62..ed1fb23296 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -287,7 +287,7 @@ static int rl2_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp return 0; } -AVInputFormat rl2_demuxer = { +AVInputFormat ff_rl2_demuxer = { "rl2", NULL_IF_CONFIG_SMALL("RL2 format"), sizeof(Rl2DemuxContext), diff --git a/libavformat/rm.h b/libavformat/rm.h index 182fddfcda..2d4656aa11 100644 --- a/libavformat/rm.h +++ b/libavformat/rm.h @@ -35,7 +35,7 @@ RMStream *ff_rm_alloc_rmstream (void); void ff_rm_free_rmstream (RMStream *rms); /*< input format for Realmedia-style RTSP streams */ -extern AVInputFormat rdt_demuxer; +extern AVInputFormat ff_rdt_demuxer; /** * Read the MDPR chunk, which contains stream-specific codec initialization diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 436a7e08f2..da7e6b23d4 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -935,7 +935,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, return dts; } -AVInputFormat rm_demuxer = { +AVInputFormat ff_rm_demuxer = { "rm", NULL_IF_CONFIG_SMALL("RealMedia format"), sizeof(RMDemuxContext), @@ -947,7 +947,7 @@ AVInputFormat rm_demuxer = { rm_read_dts, }; -AVInputFormat rdt_demuxer = { +AVInputFormat ff_rdt_demuxer = { "rdt", NULL_IF_CONFIG_SMALL("RDT demuxer"), sizeof(RMDemuxContext), diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 3b96d135c5..5670d95eb7 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -457,7 +457,7 @@ static int rm_write_trailer(AVFormatContext *s) } -AVOutputFormat rm_muxer = { +AVOutputFormat ff_rm_muxer = { "rm", NULL_IF_CONFIG_SMALL("RealMedia format"), "application/vnd.rn-realmedia", diff --git a/libavformat/rpl.c b/libavformat/rpl.c index f0fba3e66f..241b541b6a 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -349,7 +349,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat rpl_demuxer = { +AVInputFormat ff_rpl_demuxer = { "rpl", NULL_IF_CONFIG_SMALL("RPL/ARMovie format"), sizeof(RPLContext), diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c index e86b8e7d5f..698f82ed9e 100644 --- a/libavformat/rsodec.c +++ b/libavformat/rsodec.c @@ -88,7 +88,7 @@ static int rso_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat rso_demuxer = { +AVInputFormat ff_rso_demuxer = { .name = "rso", .long_name = NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO format"), .extensions = "rso", diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index 5e670f4316..7b13898697 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -100,7 +100,7 @@ static int rso_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat rso_muxer = { +AVOutputFormat ff_rso_muxer = { .name = "rso", .long_name = NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO format"), .extensions = "rso", diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index abe86759ad..3ad49d6234 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -989,7 +989,7 @@ static int rtmp_write(URLContext *h, const uint8_t *buf, int size) return size; } -URLProtocol rtmp_protocol = { +URLProtocol ff_rtmp_protocol = { "rtmp", rtmp_open, rtmp_read, diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index e31a825c2a..db09f8f3f7 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -109,7 +109,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) av_close_input_stream(rt->asf_ctx); rt->asf_ctx = NULL; } - ret = av_open_input_stream(&rt->asf_ctx, &pb, "", &asf_demuxer, NULL); + ret = av_open_input_stream(&rt->asf_ctx, &pb, "", &ff_asf_demuxer, NULL); if (ret < 0) return ret; av_metadata_copy(&s->metadata, rt->asf_ctx->metadata, 0); diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index d5f0b3835c..839a05c338 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -444,7 +444,7 @@ static int rtp_write_trailer(AVFormatContext *s1) return 0; } -AVOutputFormat rtp_muxer = { +AVOutputFormat ff_rtp_muxer = { "rtp", NULL_IF_CONFIG_SMALL("RTP output format"), NULL, diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 0e2abf556b..6ef67849f5 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -359,7 +359,7 @@ int rtp_get_rtcp_file_handle(URLContext *h) { return s->rtcp_fd; } -URLProtocol rtp_protocol = { +URLProtocol ff_rtp_protocol = { "rtp", rtp_open, rtp_read, diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 8ff4de7e1e..752f429f49 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1825,7 +1825,7 @@ static int sdp_read_close(AVFormatContext *s) return 0; } -AVInputFormat sdp_demuxer = { +AVInputFormat ff_sdp_demuxer = { "sdp", NULL_IF_CONFIG_SMALL("SDP"), sizeof(RTSPState), @@ -1929,7 +1929,7 @@ fail: return ret; } -AVInputFormat rtp_demuxer = { +AVInputFormat ff_rtp_demuxer = { "rtp", NULL_IF_CONFIG_SMALL("RTP input format"), sizeof(RTSPState), diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 6a4b4af2b3..55996e3631 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -395,7 +395,7 @@ static int rtsp_read_close(AVFormatContext *s) return 0; } -AVInputFormat rtsp_demuxer = { +AVInputFormat ff_rtsp_demuxer = { "rtsp", NULL_IF_CONFIG_SMALL("RTSP input format"), sizeof(RTSPState), diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index 3a0b2c7e44..dc8ecd80f2 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -233,7 +233,7 @@ static int rtsp_write_close(AVFormatContext *s) return 0; } -AVOutputFormat rtsp_muxer = { +AVOutputFormat ff_rtsp_muxer = { "rtsp", NULL_IF_CONFIG_SMALL("RTSP output format"), NULL, diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index 701eae2ea4..208591cd0c 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -226,7 +226,7 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat sap_demuxer = { +AVInputFormat ff_sap_demuxer = { "sap", NULL_IF_CONFIG_SMALL("SAP input format"), sizeof(struct SAPState), diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 581cec6237..b14c511cea 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -250,7 +250,7 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt) return ff_write_chained(rtpctx, 0, pkt, s); } -AVOutputFormat sap_muxer = { +AVOutputFormat ff_sap_muxer = { "sap", NULL_IF_CONFIG_SMALL("SAP output format"), NULL, diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 6274041892..4f3e5b9339 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -282,7 +282,7 @@ static int film_read_close(AVFormatContext *s) return 0; } -AVInputFormat segafilm_demuxer = { +AVInputFormat ff_segafilm_demuxer = { "film_cpk", NULL_IF_CONFIG_SMALL("Sega FILM/CPK format"), sizeof(FilmDemuxContext), diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index c239f5c66c..98fe95a559 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -280,7 +280,7 @@ static int vmd_read_close(AVFormatContext *s) return 0; } -AVInputFormat vmd_demuxer = { +AVInputFormat ff_vmd_demuxer = { "vmd", NULL_IF_CONFIG_SMALL("Sierra VMD format"), sizeof(VmdDemuxContext), diff --git a/libavformat/siff.c b/libavformat/siff.c index 3a0b9bb377..5219368f31 100644 --- a/libavformat/siff.c +++ b/libavformat/siff.c @@ -227,7 +227,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) return pkt->size; } -AVInputFormat siff_demuxer = { +AVInputFormat ff_siff_demuxer = { "siff", NULL_IF_CONFIG_SMALL("Beam Software SIFF"), sizeof(SIFFContext), diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 89e9e35df0..71a968eed7 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -344,7 +344,7 @@ static int smacker_read_close(AVFormatContext *s) return 0; } -AVInputFormat smacker_demuxer = { +AVInputFormat ff_smacker_demuxer = { "smk", NULL_IF_CONFIG_SMALL("Smacker video"), sizeof(SmackerContext), diff --git a/libavformat/sol.c b/libavformat/sol.c index 5573ddd68a..fd7eb662fc 100644 --- a/libavformat/sol.c +++ b/libavformat/sol.c @@ -141,7 +141,7 @@ static int sol_read_packet(AVFormatContext *s, return 0; } -AVInputFormat sol_demuxer = { +AVInputFormat ff_sol_demuxer = { "sol", NULL_IF_CONFIG_SMALL("Sierra SOL format"), 0, diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index 10c5bbe387..0a57f48918 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -140,7 +140,7 @@ static int sox_read_packet(AVFormatContext *s, return 0; } -AVInputFormat sox_demuxer = { +AVInputFormat ff_sox_demuxer = { "sox", NULL_IF_CONFIG_SMALL("SoX native format"), 0, diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index 918bfad9ec..413a53836a 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -112,7 +112,7 @@ static int sox_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat sox_muxer = { +AVOutputFormat ff_sox_muxer = { "sox", NULL_IF_CONFIG_SMALL("SoX native format"), NULL, diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index 05a9145318..5c4dba08d7 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -225,7 +225,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat spdif_demuxer = { +AVInputFormat ff_spdif_demuxer = { "spdif", NULL_IF_CONFIG_SMALL("IEC 61937 (compressed data in S/PDIF)"), 0, diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index d7a71e161b..3eea31e953 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -382,7 +382,7 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) return 0; } -AVOutputFormat spdif_muxer = { +AVOutputFormat ff_spdif_muxer = { "spdif", NULL_IF_CONFIG_SMALL("IEC 61937 (used on S/PDIF - IEC958)"), NULL, diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index 104031a422..17de8c91f5 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -92,7 +92,7 @@ static int srt_read_packet(AVFormatContext *s, AVPacket *pkt) return res; } -AVInputFormat srt_demuxer = { +AVInputFormat ff_srt_demuxer = { .name = "srt", .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle format"), .read_probe = srt_probe, diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 64f775f783..d2a84f0c7f 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -207,7 +207,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -AVInputFormat swf_demuxer = { +AVInputFormat ff_swf_demuxer = { "swf", NULL_IF_CONFIG_SMALL("Flash format"), sizeof(SWFContext), diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 1a1a9ab808..1ade1bf26e 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -506,7 +506,7 @@ static int swf_write_trailer(AVFormatContext *s) } #if CONFIG_SWF_MUXER -AVOutputFormat swf_muxer = { +AVOutputFormat ff_swf_muxer = { "swf", NULL_IF_CONFIG_SMALL("Flash format"), "application/x-shockwave-flash", @@ -520,7 +520,7 @@ AVOutputFormat swf_muxer = { }; #endif #if CONFIG_AVM2_MUXER -AVOutputFormat avm2_muxer = { +AVOutputFormat ff_avm2_muxer = { "avm2", NULL_IF_CONFIG_SMALL("Flash 9 (AVM2) format"), "application/x-shockwave-flash", diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 14b5e19cd9..5cb4b8f9c7 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -218,7 +218,7 @@ static int tcp_get_file_handle(URLContext *h) return s->fd; } -URLProtocol tcp_protocol = { +URLProtocol ff_tcp_protocol = { "tcp", tcp_open, tcp_read, diff --git a/libavformat/thp.c b/libavformat/thp.c index 82966dde7e..226f2fd249 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -187,7 +187,7 @@ static int thp_read_packet(AVFormatContext *s, return 0; } -AVInputFormat thp_demuxer = { +AVInputFormat ff_thp_demuxer = { "thp", NULL_IF_CONFIG_SMALL("THP"), sizeof(ThpDemuxContext), diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index 938eea59e5..2992fa1be2 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -302,7 +302,7 @@ static int seq_read_close(AVFormatContext *s) return 0; } -AVInputFormat tiertexseq_demuxer = { +AVInputFormat ff_tiertexseq_demuxer = { "tiertexseq", NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ format"), sizeof(SeqDemuxContext), diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 4be2f32568..72d0f29483 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -178,7 +178,7 @@ static int tmv_read_seek(AVFormatContext *s, int stream_index, return 0; } -AVInputFormat tmv_demuxer = { +AVInputFormat ff_tmv_demuxer = { "tmv", NULL_IF_CONFIG_SMALL("8088flex TMV"), sizeof(TMVContext), diff --git a/libavformat/tta.c b/libavformat/tta.c index 64ed4d819a..21b7538d26 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -143,7 +143,7 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp return 0; } -AVInputFormat tta_demuxer = { +AVInputFormat ff_tta_demuxer = { "tta", NULL_IF_CONFIG_SMALL("True Audio"), sizeof(TTAContext), diff --git a/libavformat/tty.c b/libavformat/tty.c index 78db4ee041..0adbaf1f11 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -124,7 +124,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) return 0; } -AVInputFormat tty_demuxer = { +AVInputFormat ff_tty_demuxer = { .name = "tty", .long_name = NULL_IF_CONFIG_SMALL("Tele-typewriter"), .priv_data_size = sizeof(TtyDemuxContext), diff --git a/libavformat/txd.c b/libavformat/txd.c index 38bdb1ba94..eb5e8b3396 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -90,7 +90,7 @@ next_chunk: return 0; } -AVInputFormat txd_demuxer = +AVInputFormat ff_txd_demuxer = { "txd", NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"), diff --git a/libavformat/udp.c b/libavformat/udp.c index 0b62c6da2d..8080c98045 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -498,7 +498,7 @@ static int udp_close(URLContext *h) return 0; } -URLProtocol udp_protocol = { +URLProtocol ff_udp_protocol = { "udp", udp_open, udp_read, diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 7a006f2b26..8dd735dac2 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -109,7 +109,7 @@ static int vc1t_read_packet(AVFormatContext *s, return pkt->size; } -AVInputFormat vc1t_demuxer = { +AVInputFormat ff_vc1t_demuxer = { "vc1test", NULL_IF_CONFIG_SMALL("VC-1 test bitstream format"), 0, diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c index b4b1e024dc..507b332a86 100644 --- a/libavformat/vc1testenc.c +++ b/libavformat/vc1testenc.c @@ -80,7 +80,7 @@ static int vc1test_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat vc1t_muxer = { +AVOutputFormat ff_vc1t_muxer = { "rcv", NULL_IF_CONFIG_SMALL("VC-1 test bitstream"), "", diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index 59c84b7056..7ef29d8db3 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -156,7 +156,7 @@ static int voc_read_packet(AVFormatContext *s, AVPacket *pkt) return voc_get_packet(s, pkt, s->streams[0], 0); } -AVInputFormat voc_demuxer = { +AVInputFormat ff_voc_demuxer = { "voc", NULL_IF_CONFIG_SMALL("Creative Voice file format"), sizeof(VocDecContext), diff --git a/libavformat/vocenc.c b/libavformat/vocenc.c index 2d3472e31f..8d181de7c3 100644 --- a/libavformat/vocenc.c +++ b/libavformat/vocenc.c @@ -89,7 +89,7 @@ static int voc_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat voc_muxer = { +AVOutputFormat ff_voc_muxer = { "voc", NULL_IF_CONFIG_SMALL("Creative Voice file format"), "audio/x-voc", diff --git a/libavformat/vqf.c b/libavformat/vqf.c index b0ec020511..9cf0c3a6ad 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -247,7 +247,7 @@ static int vqf_read_seek(AVFormatContext *s, return 0; } -AVInputFormat vqf_demuxer = { +AVInputFormat ff_vqf_demuxer = { "vqf", NULL_IF_CONFIG_SMALL("Nippon Telegraph and Telephone Corporation (NTT) TwinVQ"), sizeof(VqfContext), diff --git a/libavformat/wav.c b/libavformat/wav.c index 894c0c0f96..4cf138c754 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -123,7 +123,7 @@ static int wav_write_trailer(AVFormatContext *s) return 0; } -AVOutputFormat wav_muxer = { +AVOutputFormat ff_wav_muxer = { "wav", NULL_IF_CONFIG_SMALL("WAV format"), "audio/x-wav", @@ -340,7 +340,7 @@ static int wav_read_seek(AVFormatContext *s, return pcm_read_seek(s, stream_index, timestamp, flags); } -AVInputFormat wav_demuxer = { +AVInputFormat ff_wav_demuxer = { "wav", NULL_IF_CONFIG_SMALL("WAV format"), sizeof(WAVContext), @@ -426,7 +426,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) return 0; } -AVInputFormat w64_demuxer = { +AVInputFormat ff_w64_demuxer = { "w64", NULL_IF_CONFIG_SMALL("Sony Wave64 format"), sizeof(WAVContext), diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 03d79e5241..17571599df 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -291,7 +291,7 @@ static int wc3_read_close(AVFormatContext *s) return 0; } -AVInputFormat wc3_demuxer = { +AVInputFormat ff_wc3_demuxer = { "wc3movie", NULL_IF_CONFIG_SMALL("Wing Commander III movie format"), sizeof(Wc3DemuxContext), diff --git a/libavformat/westwood.c b/libavformat/westwood.c index 10d5798035..85d2056b58 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -367,7 +367,7 @@ static int wsvqa_read_packet(AVFormatContext *s, } #if CONFIG_WSAUD_DEMUXER -AVInputFormat wsaud_demuxer = { +AVInputFormat ff_wsaud_demuxer = { "wsaud", NULL_IF_CONFIG_SMALL("Westwood Studios audio format"), sizeof(WsAudDemuxContext), @@ -377,7 +377,7 @@ AVInputFormat wsaud_demuxer = { }; #endif #if CONFIG_WSVQA_DEMUXER -AVInputFormat wsvqa_demuxer = { +AVInputFormat ff_wsvqa_demuxer = { "wsvqa", NULL_IF_CONFIG_SMALL("Westwood Studios VQA format"), sizeof(WsVqaDemuxContext), diff --git a/libavformat/wtv.c b/libavformat/wtv.c index ad6463d241..816c4062cb 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -595,7 +595,7 @@ static int read_seek2(AVFormatContext *s, int stream_index, } } -AVInputFormat wtv_demuxer = { +AVInputFormat ff_wtv_demuxer = { .name = "wtv", .long_name = NULL_IF_CONFIG_SMALL("Windows Television (WTV)"), .priv_data_size = sizeof(WtvContext), diff --git a/libavformat/wv.c b/libavformat/wv.c index 367ce45423..667ae2e6b6 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -339,7 +339,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, return 0; } -AVInputFormat wv_demuxer = { +AVInputFormat ff_wv_demuxer = { "wv", NULL_IF_CONFIG_SMALL("WavPack"), sizeof(WVContext), diff --git a/libavformat/xa.c b/libavformat/xa.c index 3a866b992f..21a6b26e25 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -118,7 +118,7 @@ static int xa_read_packet(AVFormatContext *s, return ret; } -AVInputFormat xa_demuxer = { +AVInputFormat ff_xa_demuxer = { "xa", NULL_IF_CONFIG_SMALL("Maxis XA File Format"), sizeof(MaxisXADemuxContext), diff --git a/libavformat/yop.c b/libavformat/yop.c index 54d38454a1..ae909254c6 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -202,7 +202,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index, return 0; } -AVInputFormat yop_demuxer = { +AVInputFormat ff_yop_demuxer = { "yop", NULL_IF_CONFIG_SMALL("Psygnosis YOP Format"), sizeof(YopDecContext), diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index 3a488649f3..6c763986f3 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -169,7 +169,7 @@ static int yuv4_write_header(AVFormatContext *s) return 0; } -AVOutputFormat yuv4mpegpipe_muxer = { +AVOutputFormat ff_yuv4mpegpipe_muxer = { "yuv4mpegpipe", NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"), "", @@ -390,7 +390,7 @@ static int yuv4_probe(AVProbeData *pd) } #if CONFIG_YUV4MPEGPIPE_DEMUXER -AVInputFormat yuv4mpegpipe_demuxer = { +AVInputFormat ff_yuv4mpegpipe_demuxer = { "yuv4mpegpipe", NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"), sizeof(struct frame_attributes), From d1b6f33bf2ce56f013a1c5a013a19671c0f30ea0 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Thu, 27 Jan 2011 03:56:14 +0100 Subject: [PATCH 137/528] Add ff_ to AVHWAccel decoders That unbreaks compilation of vaapi and dxva2 Signed-off-by: Janne Grunau --- libavcodec/dxva2_h264.c | 2 +- libavcodec/dxva2_mpeg2.c | 2 +- libavcodec/dxva2_vc1.c | 4 ++-- libavcodec/vaapi_h264.c | 2 +- libavcodec/vaapi_mpeg2.c | 2 +- libavcodec/vaapi_mpeg4.c | 4 ++-- libavcodec/vaapi_vc1.c | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index bdb42df3f7..17fb2b55c3 100644 --- a/libavcodec/dxva2_h264.c +++ b/libavcodec/dxva2_h264.c @@ -423,7 +423,7 @@ static int end_frame(AVCodecContext *avctx) commit_bitstream_and_slice_buffer); } -AVHWAccel h264_dxva2_hwaccel = { +AVHWAccel ff_h264_dxva2_hwaccel = { .name = "h264_dxva2", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_H264, diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c index 3b75dae11c..780542a6c1 100644 --- a/libavcodec/dxva2_mpeg2.c +++ b/libavcodec/dxva2_mpeg2.c @@ -260,7 +260,7 @@ static int end_frame(AVCodecContext *avctx) commit_bitstream_and_slice_buffer); } -AVHWAccel mpeg2_dxva2_hwaccel = { +AVHWAccel ff_mpeg2_dxva2_hwaccel = { .name = "mpeg2_dxva2", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_MPEG2VIDEO, diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index a11121347a..2b9a690ebc 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -264,7 +264,7 @@ static int end_frame(AVCodecContext *avctx) } #if CONFIG_WMV3_DXVA2_HWACCEL -AVHWAccel wmv3_dxva2_hwaccel = { +AVHWAccel ff_wmv3_dxva2_hwaccel = { .name = "wmv3_dxva2", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_WMV3, @@ -277,7 +277,7 @@ AVHWAccel wmv3_dxva2_hwaccel = { }; #endif -AVHWAccel vc1_dxva2_hwaccel = { +AVHWAccel ff_vc1_dxva2_hwaccel = { .name = "vc1_dxva2", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_VC1, diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c index 29f3a81bac..229c0f9b24 100644 --- a/libavcodec/vaapi_h264.c +++ b/libavcodec/vaapi_h264.c @@ -334,7 +334,7 @@ static int decode_slice(AVCodecContext *avctx, return 0; } -AVHWAccel h264_vaapi_hwaccel = { +AVHWAccel ff_h264_vaapi_hwaccel = { .name = "h264_vaapi", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_H264, diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c index 2e870dcfa0..f56873c104 100644 --- a/libavcodec/vaapi_mpeg2.c +++ b/libavcodec/vaapi_mpeg2.c @@ -138,7 +138,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer return 0; } -AVHWAccel mpeg2_vaapi_hwaccel = { +AVHWAccel ff_mpeg2_vaapi_hwaccel = { .name = "mpeg2_vaapi", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_MPEG2VIDEO, diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index 8f02e91397..72822c370e 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -150,7 +150,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer } #if CONFIG_MPEG4_VAAPI_HWACCEL -AVHWAccel mpeg4_vaapi_hwaccel = { +AVHWAccel ff_mpeg4_vaapi_hwaccel = { .name = "mpeg4_vaapi", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_MPEG4, @@ -164,7 +164,7 @@ AVHWAccel mpeg4_vaapi_hwaccel = { #endif #if CONFIG_H263_VAAPI_HWACCEL -AVHWAccel h263_vaapi_hwaccel = { +AVHWAccel ff_h263_vaapi_hwaccel = { .name = "h263_vaapi", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_H263, diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index 2c24042ab5..d7bae009dc 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -326,7 +326,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, } #if CONFIG_WMV3_VAAPI_HWACCEL -AVHWAccel wmv3_vaapi_hwaccel = { +AVHWAccel ff_wmv3_vaapi_hwaccel = { .name = "wmv3_vaapi", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_WMV3, @@ -339,7 +339,7 @@ AVHWAccel wmv3_vaapi_hwaccel = { }; #endif -AVHWAccel vc1_vaapi_hwaccel = { +AVHWAccel ff_vc1_vaapi_hwaccel = { .name = "vc1_vaapi", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_VC1, From 37cb3eb53449ccefbbe8ea7dc5e66f9036aafe6e Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 27 Jan 2011 23:58:27 +0000 Subject: [PATCH 138/528] Add special case for 2nd-order IIR filter. 40% faster in ff_iir_filter_flt() when c->order == 2. --- libavcodec/iirfilter.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c index 46b4973f85..bc63c3991a 100644 --- a/libavcodec/iirfilter.c +++ b/libavcodec/iirfilter.c @@ -256,11 +256,29 @@ av_cold struct FFIIRFilterState* ff_iir_filter_init_state(int order) } \ } +#define FILTER_O2(type, fmt) { \ + int i; \ + const type *src0 = src; \ + type *dst0 = dst; \ + for (i = 0; i < size; i++) { \ + float in = *src0 * c->gain + \ + s->x[0] * c->cy[0] + \ + s->x[1] * c->cy[1]; \ + CONV_##fmt(*dst0, s->x[0] + in + s->x[1] * c->cx[1]) \ + s->x[0] = s->x[1]; \ + s->x[1] = in; \ + src0 += sstep; \ + dst0 += dstep; \ + } \ +} + void ff_iir_filter(const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const int16_t *src, int sstep, int16_t *dst, int dstep) { - if (c->order == 4) { + if (c->order == 2) { + FILTER_O2(int16_t, S16) + } else if (c->order == 4) { FILTER_BW_O4(int16_t, S16) } else { FILTER_DIRECT_FORM_II(int16_t, S16) @@ -271,7 +289,9 @@ void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const float *src, int sstep, float *dst, int dstep) { - if (c->order == 4) { + if (c->order == 2) { + FILTER_O2(float, FLT) + } else if (c->order == 4) { FILTER_BW_O4(float, FLT) } else { FILTER_DIRECT_FORM_II(float, FLT) From f2589642172d284a67e5bbd6c11c477a2aacda88 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Tue, 25 Jan 2011 15:08:20 +0000 Subject: [PATCH 139/528] In mov muxer, mux adpcm_ms and adpcm_ima_wav the way quicktime supports it In mov demuxer, set adpcm_ms and adpcm_ima_wav frame size to stsd samples per packet. Signed-off-by: Janne Grunau --- libavformat/mov.c | 1 + libavformat/movenc.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 18a923835c..ea9423ba7b 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1227,6 +1227,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) case CODEC_ID_GSM: case CODEC_ID_ADPCM_MS: case CODEC_ID_ADPCM_IMA_WAV: + st->codec->frame_size = sc->samples_per_frame; st->codec->block_align = sc->bytes_per_frame; break; case CODEC_ID_ALAC: diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 5886dfeae6..606170150c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -314,6 +314,16 @@ static int mov_pcm_le_gt16(enum CodecID codec_id) codec_id == CODEC_ID_PCM_F64LE; } +static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track) +{ + int64_t pos = url_ftell(pb); + put_be32(pb, 0); + put_le32(pb, track->tag); + track->enc->codec_tag = track->tag >> 16; + ff_put_wav_header(pb, track->enc); + return updateSize(pb, pos); +} + static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); @@ -339,6 +349,9 @@ static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track) mov_write_ac3_tag(pb, track); } else if (track->enc->codec_id == CODEC_ID_ALAC) { mov_write_extradata_tag(pb, track); + } else if (track->enc->codec_id == CODEC_ID_ADPCM_MS || + track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) { + mov_write_ms_tag(pb, track); } put_be32(pb, 8); /* size */ @@ -395,7 +408,9 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) if (mov_get_lpcm_flags(track->enc->codec_id)) tag = AV_RL32("lpcm"); version = 2; - } else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id)) { + } else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id) || + track->enc->codec_id == CODEC_ID_ADPCM_MS || + track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) { version = 1; } } @@ -457,6 +472,8 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) track->enc->codec_id == CODEC_ID_AC3 || track->enc->codec_id == CODEC_ID_AMR_NB || track->enc->codec_id == CODEC_ID_ALAC || + track->enc->codec_id == CODEC_ID_ADPCM_MS || + track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV || mov_pcm_le_gt16(track->enc->codec_id))) mov_write_wave_tag(pb, track); else if(track->tag == MKTAG('m','p','4','a')) @@ -1909,6 +1926,9 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_ERROR, "fatal error, input is not a single packet, implement a AVParser for it\n"); return -1; } + } else if (enc->codec_id == CODEC_ID_ADPCM_MS || + enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) { + samplesInChunk = enc->frame_size; } else if (trk->sampleSize) samplesInChunk = size/trk->sampleSize; else @@ -2108,6 +2128,13 @@ static int mov_write_header(AVFormatContext *s) if(!st->codec->frame_size && !av_get_bits_per_sample(st->codec->codec_id)) { av_log(s, AV_LOG_ERROR, "track %d: codec frame size is not set\n", i); goto error; + }else if(st->codec->codec_id == CODEC_ID_ADPCM_MS || + st->codec->codec_id == CODEC_ID_ADPCM_IMA_WAV){ + if (!st->codec->block_align) { + av_log(s, AV_LOG_ERROR, "track %d: codec block align is not set for adpcm\n", i); + goto error; + } + track->sampleSize = st->codec->block_align; }else if(st->codec->frame_size > 1){ /* assume compressed audio */ track->audio_vbr = 1; }else{ From 795ed278e6d702ad841c3043e2b878afc6f599f4 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Thu, 27 Jan 2011 17:26:20 +0100 Subject: [PATCH 140/528] movenc: byteswap codec_tag in mov_write_ms_tag based on Alex Converse's "Fix ADPCM MS in mov muxing" patch --- libavformat/movenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 606170150c..0949d29457 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -318,8 +318,8 @@ static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); - put_le32(pb, track->tag); - track->enc->codec_tag = track->tag >> 16; + put_le32(pb, track->tag); // store it byteswapped + track->enc->codec_tag = av_bswap16(track->tag >> 16); ff_put_wav_header(pb, track->enc); return updateSize(pb, pos); } From 97b04f5ed3ab3a62e57f0c16841fb8f10d0a174c Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Wed, 26 Jan 2011 05:15:49 +0000 Subject: [PATCH 141/528] mov: add support for little-endian utf16 chapter names Signed-off-by: Janne Grunau --- libavformat/mov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index ea9423ba7b..7ad920fcb1 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2326,6 +2326,8 @@ static void mov_read_chapters(AVFormatContext *s) ch = get_be16(sc->pb); if (ch == 0xfeff) avio_get_str16be(sc->pb, len, title, title_len); + else if (ch == 0xfffe) + avio_get_str16le(sc->pb, len, title, title_len); else { AV_WB16(title, ch); get_strz(sc->pb, title + 2, len - 1); From 9d06d7bce3babb82ed650c13ed13a57f6f626a71 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 27 Jan 2011 15:20:43 +0000 Subject: [PATCH 142/528] Remove the add bias hack for the C version of DSPContext.float_to_int16_*(). --- libavcodec/aac.h | 1 - libavcodec/aacdec.c | 42 +++++++++++++--------------------- libavcodec/aacsbr.c | 13 +++-------- libavcodec/ac3dec.c | 13 ++--------- libavcodec/ac3dec.h | 1 - libavcodec/binkaudio.c | 5 ---- libavcodec/dca.c | 47 +++++++++++++++----------------------- libavcodec/dsputil.c | 9 +------- libavcodec/dsputil.h | 3 +-- libavcodec/nellymoserdec.c | 9 +------- libavcodec/vorbis_dec.c | 38 ++++++++---------------------- libavcodec/wmadec.c | 21 ++--------------- 12 files changed, 54 insertions(+), 148 deletions(-) diff --git a/libavcodec/aac.h b/libavcodec/aac.h index b40d2c0003..714e314cba 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -276,7 +276,6 @@ typedef struct { * @{ */ float *output_data[MAX_CHANNELS]; ///< Points to each element's 'ret' buffer (PCM output). - float add_bias; ///< offset for dsp.float_to_int16 float sf_scale; ///< Pre-scale for correct IMDCT and dsp.float_to_int16. int sf_offset; ///< offset into pow2sf_tab as appropriate for dsp.float_to_int16 /** @} */ diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index fd65b1c3ba..fddec17fcc 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -566,18 +566,10 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) ac->random_state = 0x1f2e3d4c; // -1024 - Compensate wrong IMDCT method. - // 32768 - Required to scale values to the correct range for the bias method - // for float to int16 conversion. - - if (ac->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) { - ac->add_bias = 385.0f; - ac->sf_scale = 1. / (-1024. * 32768.); - ac->sf_offset = 0; - } else { - ac->add_bias = 0.0f; + // 60 - Required to scale values to the correct range [-32768,32767] + // for float to int16 conversion. (1 << (60 / 4)) == 32768 ac->sf_scale = 1. / -1024.; ac->sf_offset = 60; - } ff_aac_tableinit(); @@ -1701,7 +1693,7 @@ static void apply_tns(float coef[1024], TemporalNoiseShaping *tns, /** * Conduct IMDCT and windowing. */ -static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce, float bias) +static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) { IndividualChannelStream *ics = &sce->ics; float *in = sce->coeffs; @@ -1729,29 +1721,29 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce, float */ if ((ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) && (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) { - ac->dsp.vector_fmul_window( out, saved, buf, lwindow_prev, bias, 512); + ac->dsp.vector_fmul_window( out, saved, buf, lwindow_prev, 0, 512); } else { for (i = 0; i < 448; i++) - out[i] = saved[i] + bias; + out[i] = saved[i]; if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, bias, 64); - ac->dsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow, bias, 64); - ac->dsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow, bias, 64); - ac->dsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow, bias, 64); - ac->dsp.vector_fmul_window(temp, buf + 3*128 + 64, buf + 4*128, swindow, bias, 64); + ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, 0, 64); + ac->dsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow, 0, 64); + ac->dsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow, 0, 64); + ac->dsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow, 0, 64); + ac->dsp.vector_fmul_window(temp, buf + 3*128 + 64, buf + 4*128, swindow, 0, 64); memcpy( out + 448 + 4*128, temp, 64 * sizeof(float)); } else { - ac->dsp.vector_fmul_window(out + 448, saved + 448, buf, swindow_prev, bias, 64); + ac->dsp.vector_fmul_window(out + 448, saved + 448, buf, swindow_prev, 0, 64); for (i = 576; i < 1024; i++) - out[i] = buf[i-512] + bias; + out[i] = buf[i-512]; } } // buffer update if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { for (i = 0; i < 64; i++) - saved[i] = temp[64 + i] - bias; + saved[i] = temp[64 + i]; ac->dsp.vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128, swindow, 0, 64); ac->dsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 0, 64); ac->dsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 0, 64); @@ -1811,13 +1803,12 @@ static void apply_independent_coupling(AACContext *ac, { int i; const float gain = cce->coup.gain[index][0]; - const float bias = ac->add_bias; const float *src = cce->ch[0].ret; float *dest = target->ret; const int len = 1024 << (ac->m4ac.sbr == 1); for (i = 0; i < len; i++) - dest[i] += gain * (src[i] - bias); + dest[i] += gain * src[i]; } /** @@ -1861,7 +1852,6 @@ static void apply_channel_coupling(AACContext *ac, ChannelElement *cc, static void spectral_to_sample(AACContext *ac) { int i, type; - float imdct_bias = (ac->m4ac.sbr <= 0) ? ac->add_bias : 0.0f; for (type = 3; type >= 0; type--) { for (i = 0; i < MAX_ELEM_ID; i++) { ChannelElement *che = ac->che[type][i]; @@ -1875,9 +1865,9 @@ static void spectral_to_sample(AACContext *ac) if (type <= TYPE_CPE) apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, apply_dependent_coupling); if (type != TYPE_CCE || che->coup.coupling_point == AFTER_IMDCT) { - imdct_and_windowing(ac, &che->ch[0], imdct_bias); + imdct_and_windowing(ac, &che->ch[0]); if (type == TYPE_CPE) { - imdct_and_windowing(ac, &che->ch[1], imdct_bias); + imdct_and_windowing(ac, &che->ch[1]); } if (ac->m4ac.sbr > 0) { ff_sbr_apply(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret); diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 050305a3fe..9b10bf25fe 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -1175,12 +1175,10 @@ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct, float *out, float X[2][38][64], float mdct_buf[2][64], - float *v0, int *v_off, const unsigned int div, - float bias, float scale) + float *v0, int *v_off, const unsigned int div) { int i, n; const float *sbr_qmf_window = div ? sbr_qmf_window_ds : sbr_qmf_window_us; - int scale_and_bias = scale != 1.0f || bias != 0.0f; float *v; for (i = 0; i < 32; i++) { if (*v_off == 0) { @@ -1222,9 +1220,6 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct, dsp->vector_fmul_add(out, v + ( 960 >> div), sbr_qmf_window + (448 >> div), out , 64 >> div); dsp->vector_fmul_add(out, v + (1024 >> div), sbr_qmf_window + (512 >> div), out , 64 >> div); dsp->vector_fmul_add(out, v + (1216 >> div), sbr_qmf_window + (576 >> div), out , 64 >> div); - if (scale_and_bias) - for (n = 0; n < 64 >> div; n++) - out[n] = out[n] * scale + bias; out += 64 >> div; } } @@ -1760,12 +1755,10 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, L, sbr->X[0], sbr->qmf_filter_scratch, sbr->data[0].synthesis_filterbank_samples, &sbr->data[0].synthesis_filterbank_samples_offset, - downsampled, - ac->add_bias, -1024 * ac->sf_scale); + downsampled); if (nch == 2) sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, R, sbr->X[1], sbr->qmf_filter_scratch, sbr->data[1].synthesis_filterbank_samples, &sbr->data[1].synthesis_filterbank_samples_offset, - downsampled, - ac->add_bias, -1024 * ac->sf_scale); + downsampled); } diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index a1e731dcf9..2f9bc261bd 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -196,13 +196,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) av_lfg_init(&s->dith_state, 0); /* set bias values for float to int16 conversion */ - if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) { - s->add_bias = 385.0f; - s->mul_bias = 1.0f; - } else { - s->add_bias = 0.0f; s->mul_bias = 32767.0f; - } /* allow downmixing to stereo or mono */ if (avctx->channels > 0 && avctx->request_channels > 0 && @@ -626,9 +620,6 @@ static void do_rematrixing(AC3DecodeContext *s) static inline void do_imdct(AC3DecodeContext *s, int channels) { int ch; - float add_bias = s->add_bias; - if(s->out_channels==1 && channels>1) - add_bias *= LEVEL_MINUS_3DB; // compensate for the gain in downmix for (ch=1; ch<=channels; ch++) { if (s->block_switch[ch]) { @@ -637,13 +628,13 @@ static inline void do_imdct(AC3DecodeContext *s, int channels) for(i=0; i<128; i++) x[i] = s->transform_coeffs[ch][2*i]; ff_imdct_half(&s->imdct_256, s->tmp_output, x); - s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, add_bias, 128); + s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 0, 128); for(i=0; i<128; i++) x[i] = s->transform_coeffs[ch][2*i+1]; ff_imdct_half(&s->imdct_256, s->delay[ch-1], x); } else { ff_imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]); - s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, add_bias, 128); + s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 0, 128); memcpy(s->delay[ch-1], s->tmp_output+128, 128*sizeof(float)); } } diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index 0707769478..55520cdcee 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -190,7 +190,6 @@ typedef struct { ///@defgroup opt optimization DSPContext dsp; ///< for optimization - float add_bias; ///< offset for float_to_int16 conversion float mul_bias; ///< scaling for float_to_int16 conversion ///@} diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 7f579822db..ae2f6c88b0 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -222,11 +222,6 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) ff_rdft_calc(&s->trans.rdft, coeffs); } - if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) { - for (i = 0; i < s->channels; i++) - for (j = 0; j < s->frame_len; j++) - s->coeffs_ptr[i][j] = 385.0 + s->coeffs_ptr[i][j]*(1.0/32767.0); - } s->dsp.float_to_int16_interleave(out, (const float **)s->coeffs_ptr, s->frame_len, s->channels); if (!s->first) { diff --git a/libavcodec/dca.c b/libavcodec/dca.c index c1c70cde1b..aa71411efa 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -311,7 +311,6 @@ typedef struct { DECLARE_ALIGNED(16, float, raXin)[32]; int output; ///< type of output - float add_bias; ///< output bias float scale_bias; ///< output scale DECLARE_ALIGNED(16, float, subband_samples)[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8]; @@ -868,7 +867,7 @@ static int dca_subframe_header(DCAContext * s, int base_channel, int block_index static void qmf_32_subbands(DCAContext * s, int chans, float samples_in[32][8], float *samples_out, - float scale, float bias) + float scale) { const float *prCoeff; int i; @@ -897,7 +896,7 @@ static void qmf_32_subbands(DCAContext * s, int chans, s->synth.synth_filter_float(&s->imdct, s->subband_fir_hist[chans], &s->hist_index[chans], s->subband_fir_noidea[chans], prCoeff, - samples_out, s->raXin, scale, bias); + samples_out, s->raXin, scale, 0); samples_out+= 32; } @@ -905,8 +904,7 @@ static void qmf_32_subbands(DCAContext * s, int chans, static void lfe_interpolation_fir(DCAContext *s, int decimation_select, int num_deci_sample, float *samples_in, - float *samples_out, float scale, - float bias) + float *samples_out, float scale) { /* samples_in: An array holding decimated samples. * Samples in current subframe starts from samples_in[0], @@ -931,7 +929,7 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select, /* Interpolation */ for (deciindex = 0; deciindex < num_deci_sample; deciindex++) { s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor, - scale, bias); + scale, 0); samples_in++; samples_out += 2 * decifactor; } @@ -939,19 +937,19 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select, /* downmixing routines */ #define MIX_REAR1(samples, si1, rs, coef) \ - samples[i] += (samples[si1] - add_bias) * coef[rs][0]; \ - samples[i+256] += (samples[si1] - add_bias) * coef[rs][1]; + samples[i] += samples[si1] * coef[rs][0]; \ + samples[i+256] += samples[si1] * coef[rs][1]; #define MIX_REAR2(samples, si1, si2, rs, coef) \ - samples[i] += (samples[si1] - add_bias) * coef[rs][0] + (samples[si2] - add_bias) * coef[rs+1][0]; \ - samples[i+256] += (samples[si1] - add_bias) * coef[rs][1] + (samples[si2] - add_bias) * coef[rs+1][1]; + samples[i] += samples[si1] * coef[rs][0] + samples[si2] * coef[rs+1][0]; \ + samples[i+256] += samples[si1] * coef[rs][1] + samples[si2] * coef[rs+1][1]; #define MIX_FRONT3(samples, coef) \ - t = samples[i+c] - add_bias; \ - u = samples[i+l] - add_bias; \ - v = samples[i+r] - add_bias; \ - samples[i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0] + add_bias; \ - samples[i+256] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1] + add_bias; + t = samples[i+c]; \ + u = samples[i+l]; \ + v = samples[i+r]; \ + samples[i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0]; \ + samples[i+256] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1]; #define DOWNMIX_TO_STEREO(op1, op2) \ for (i = 0; i < 256; i++){ \ @@ -961,7 +959,7 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select, static void dca_downmix(float *samples, int srcfmt, int downmix_coef[DCA_PRIM_CHANNELS_MAX][2], - const int8_t *channel_mapping, float add_bias) + const int8_t *channel_mapping) { int c,l,r,sl,sr,s; int i; @@ -1193,13 +1191,12 @@ static int dca_filter_channels(DCAContext * s, int block_index) /* static float pcm_to_double[8] = {32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};*/ qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * s->channel_order_tab[k]], - M_SQRT1_2*s->scale_bias /*pcm_to_double[s->source_pcm_res] */ , - s->add_bias ); + M_SQRT1_2*s->scale_bias /*pcm_to_double[s->source_pcm_res] */ ); } /* Down mixing */ if (s->avctx->request_channels == 2 && s->prim_channels > 2) { - dca_downmix(s->samples, s->amode, s->downmix_coef, s->channel_order_tab, s->add_bias); + dca_downmix(s->samples, s->amode, s->downmix_coef, s->channel_order_tab); } /* Generate LFE samples for this subsubframe FIXME!!! */ @@ -1207,7 +1204,7 @@ static int dca_filter_channels(DCAContext * s, int block_index) lfe_interpolation_fir(s, s->lfe, 2 * s->lfe, s->lfe_data + 2 * s->lfe * (block_index + 4), &s->samples[256 * dca_lfe_index[s->amode]], - (1.0/256.0)*s->scale_bias, s->add_bias); + (1.0/256.0)*s->scale_bias); /* Outputs 20bits pcm samples */ } @@ -1798,8 +1795,8 @@ static int dca_decode_frame(AVCodecContext * avctx, float* rt_chan = s->samples + s->channel_order_tab[s->xch_base_channel - 1] * 256; int j; for(j = 0; j < 256; ++j) { - lt_chan[j] -= (back_chan[j] - s->add_bias) * M_SQRT1_2; - rt_chan[j] -= (back_chan[j] - s->add_bias) * M_SQRT1_2; + lt_chan[j] -= back_chan[j] * M_SQRT1_2; + rt_chan[j] -= back_chan[j] * M_SQRT1_2; } } @@ -1841,11 +1838,6 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) s->samples_chanptr[i] = s->samples + i * 256; avctx->sample_fmt = AV_SAMPLE_FMT_S16; - if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) { - s->add_bias = 385.0f; - s->scale_bias = 1.0 / 32768.0; - } else { - s->add_bias = 0.0f; s->scale_bias = 1.0; /* allow downmixing to stereo */ @@ -1853,7 +1845,6 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) avctx->request_channels == 2) { avctx->channels = avctx->request_channels; } - } return 0; diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 2ed0052977..03a5eeea45 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3910,14 +3910,7 @@ static void vector_clipf_c(float *dst, const float *src, float min, float max, i } static av_always_inline int float_to_int16_one(const float *src){ - int_fast32_t tmp = *(const int32_t*)src; - if(tmp & 0xf0000){ - tmp = (0x43c0ffff - tmp)>>31; - // is this faster on some gcc/cpu combinations? -// if(tmp > 0x43c0ffff) tmp = 0xFFFF; -// else tmp = 0; - } - return tmp - 0x8000; + return av_clip_int16(lrintf(*src)); } void ff_float_to_int16_c(int16_t *dst, const float *src, long len){ diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index baa68bebe7..eabecf0d48 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -435,8 +435,7 @@ typedef struct DSPContext { */ void (*butterflies_float)(float *restrict v1, float *restrict v2, int len); - /* C version: convert floats from the range [384.0,386.0] to ints in [-32768,32767] - * simd versions: convert floats from [-32768.0,32767.0] without rescaling and arrays are 16byte aligned */ + /* convert floats from [-32768.0,32767.0] without rescaling and arrays are 16byte aligned */ void (*float_to_int16)(int16_t *dst, const float *src, long len); void (*float_to_int16_interleave)(int16_t *dst, const float **src, long len, int channels); diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 89dde91248..e70d0622da 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -49,7 +49,6 @@ typedef struct NellyMoserDecodeContext { float state[128]; AVLFG random_state; GetBitContext gb; - int add_bias; float scale_bias; DSPContext dsp; FFTContext imdct_ctx; @@ -65,7 +64,7 @@ static void overlap_and_window(NellyMoserDecodeContext *s, float *state, float * while (bot < NELLY_BUF_LEN) { audio[bot] = a_in [bot]*ff_sine_128[bot] - +state[bot]*ff_sine_128[top] + s->add_bias; + +state[bot]*ff_sine_128[top]; bot++; top--; @@ -136,13 +135,7 @@ static av_cold int decode_init(AVCodecContext * avctx) { dsputil_init(&s->dsp, avctx); - if(s->dsp.float_to_int16 == ff_float_to_int16_c) { - s->add_bias = 385; - s->scale_bias = 1.0/(8*32768); - } else { - s->add_bias = 0; s->scale_bias = 1.0/(1*8); - } /* Generate overlap window */ if (!ff_sine_128[127]) diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index cdb485a9c9..69b784c668 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -153,8 +153,7 @@ typedef struct vorbis_context_s { float *channel_residues; float *channel_floors; float *saved; - uint_fast32_t add_bias; // for float->int conversion - uint_fast32_t exp_bias; + float scale_bias; // for float->int conversion } vorbis_context; /* Helper functions */ @@ -932,8 +931,8 @@ static int vorbis_parse_id_hdr(vorbis_context *vc) vc->saved = av_mallocz((vc->blocksize[1] / 4) * vc->audio_channels * sizeof(float)); vc->previous_window = 0; - ff_mdct_init(&vc->mdct[0], bl0, 1, vc->exp_bias ? -(1 << 15) : -1.0); - ff_mdct_init(&vc->mdct[1], bl1, 1, vc->exp_bias ? -(1 << 15) : -1.0); + ff_mdct_init(&vc->mdct[0], bl0, 1, -vc->scale_bias); + ff_mdct_init(&vc->mdct[1], bl1, 1, -vc->scale_bias); AV_DEBUG(" vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ", vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize[0], vc->blocksize[1]); @@ -963,13 +962,7 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext) vc->avccontext = avccontext; dsputil_init(&vc->dsp, avccontext); - if (vc->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) { - vc->add_bias = 385; - vc->exp_bias = 0; - } else { - vc->add_bias = 0; - vc->exp_bias = 15 << 23; - } + vc->scale_bias = 32768.0f; if (!headers_len) { av_log(avccontext, AV_LOG_ERROR, "Extradata missing.\n"); @@ -1453,18 +1446,6 @@ void vorbis_inverse_coupling(float *mag, float *ang, int blocksize) } } -static void copy_normalize(float *dst, float *src, int len, int exp_bias, - float add_bias) -{ - int i; - if (exp_bias) { - memcpy(dst, src, len * sizeof(float)); - } else { - for (i = 0; i < len; i++) - dst[i] = src[i] + add_bias; - } -} - // Decode the audio packet using the functions above static int vorbis_parse_audio_packet(vorbis_context *vc) @@ -1484,7 +1465,6 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) uint_fast8_t res_chan[255]; uint_fast8_t res_num = 0; int_fast16_t retlen = 0; - float fadd_bias = vc->add_bias; if (get_bits1(gb)) { av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n"); @@ -1595,13 +1575,13 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) const float *win = vc->win[blockflag & previous_window]; if (blockflag == previous_window) { - vc->dsp.vector_fmul_window(ret, saved, buf, win, fadd_bias, blocksize / 4); + vc->dsp.vector_fmul_window(ret, saved, buf, win, 0, blocksize / 4); } else if (blockflag > previous_window) { - vc->dsp.vector_fmul_window(ret, saved, buf, win, fadd_bias, bs0 / 4); - copy_normalize(ret+bs0/2, buf+bs0/4, (bs1-bs0)/4, vc->exp_bias, fadd_bias); + vc->dsp.vector_fmul_window(ret, saved, buf, win, 0, bs0 / 4); + memcpy(ret+bs0/2, buf+bs0/4, ((bs1-bs0)/4) * sizeof(float)); } else { - copy_normalize(ret, saved, (bs1 - bs0) / 4, vc->exp_bias, fadd_bias); - vc->dsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - bs0) / 4, buf, win, fadd_bias, bs0 / 4); + memcpy(ret, saved, ((bs1 - bs0) / 4) * sizeof(float)); + vc->dsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - bs0) / 4, buf, win, 0, bs0 / 4); } memcpy(saved, buf + blocksize / 4, blocksize / 4 * sizeof(float)); } diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index b720ea5098..03d7bd19fc 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -768,9 +768,8 @@ next: /* decode a frame of frame_len samples */ static int wma_decode_frame(WMACodecContext *s, int16_t *samples) { - int ret, i, n, ch, incr; - int16_t *ptr; - float *iptr; + int ret, n, ch, incr; + const float *output[MAX_CHANNELS]; #ifdef TRACE tprintf(s->avctx, "***decode_frame: %d size=%d\n", s->frame_count++, s->frame_len); @@ -790,21 +789,6 @@ static int wma_decode_frame(WMACodecContext *s, int16_t *samples) /* convert frame to integer */ n = s->frame_len; incr = s->nb_channels; - if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) { - for(ch = 0; ch < s->nb_channels; ch++) { - ptr = samples + ch; - iptr = s->frame_out[ch]; - - for(i=0;iframe_out[ch][0], &s->frame_out[ch][s->frame_len], - s->frame_len * sizeof(float)); - } - } else { - const float *output[MAX_CHANNELS]; for (ch = 0; ch < MAX_CHANNELS; ch++) output[ch] = s->frame_out[ch]; s->dsp.float_to_int16_interleave(samples, output, n, incr); @@ -812,7 +796,6 @@ static int wma_decode_frame(WMACodecContext *s, int16_t *samples) /* prepare for next block */ memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float)); } - } #ifdef TRACE dump_shorts(s, "samples", samples, n * s->nb_channels); From b5ec6383432c907bed175f20e39af1a99dc75cfb Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 27 Jan 2011 14:21:26 +0000 Subject: [PATCH 143/528] cosmetics: indentation and spacing --- libavcodec/aacdec.c | 4 ++-- libavcodec/ac3dec.c | 4 ++-- libavcodec/dca.c | 13 ++++++------- libavcodec/nellymoserdec.c | 2 +- libavcodec/wmadec.c | 14 +++++++------- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index fddec17fcc..2d5fb540a9 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -568,8 +568,8 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) // -1024 - Compensate wrong IMDCT method. // 60 - Required to scale values to the correct range [-32768,32767] // for float to int16 conversion. (1 << (60 / 4)) == 32768 - ac->sf_scale = 1. / -1024.; - ac->sf_offset = 60; + ac->sf_scale = 1. / -1024.; + ac->sf_offset = 60; ff_aac_tableinit(); diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 2f9bc261bd..ab738771b5 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -195,8 +195,8 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) dsputil_init(&s->dsp, avctx); av_lfg_init(&s->dith_state, 0); - /* set bias values for float to int16 conversion */ - s->mul_bias = 32767.0f; + /* set scale value for float to int16 conversion */ + s->mul_bias = 32767.0f; /* allow downmixing to stereo or mono */ if (avctx->channels > 0 && avctx->request_channels > 0 && diff --git a/libavcodec/dca.c b/libavcodec/dca.c index aa71411efa..fc5c0b5558 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1838,14 +1838,13 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) s->samples_chanptr[i] = s->samples + i * 256; avctx->sample_fmt = AV_SAMPLE_FMT_S16; - s->scale_bias = 1.0; - - /* allow downmixing to stereo */ - if (avctx->channels > 0 && avctx->request_channels < avctx->channels && - avctx->request_channels == 2) { - avctx->channels = avctx->request_channels; - } + s->scale_bias = 1.0; + /* allow downmixing to stereo */ + if (avctx->channels > 0 && avctx->request_channels < avctx->channels && + avctx->request_channels == 2) { + avctx->channels = avctx->request_channels; + } return 0; } diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index e70d0622da..8b13a5d894 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -135,7 +135,7 @@ static av_cold int decode_init(AVCodecContext * avctx) { dsputil_init(&s->dsp, avctx); - s->scale_bias = 1.0/(1*8); + s->scale_bias = 1.0/(1*8); /* Generate overlap window */ if (!ff_sine_128[127]) diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index 03d7bd19fc..d85d80d574 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -789,13 +789,13 @@ static int wma_decode_frame(WMACodecContext *s, int16_t *samples) /* convert frame to integer */ n = s->frame_len; incr = s->nb_channels; - for (ch = 0; ch < MAX_CHANNELS; ch++) - output[ch] = s->frame_out[ch]; - s->dsp.float_to_int16_interleave(samples, output, n, incr); - for(ch = 0; ch < incr; ch++) { - /* prepare for next block */ - memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float)); - } + for (ch = 0; ch < MAX_CHANNELS; ch++) + output[ch] = s->frame_out[ch]; + s->dsp.float_to_int16_interleave(samples, output, n, incr); + for (ch = 0; ch < incr; ch++) { + /* prepare for next block */ + memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float)); + } #ifdef TRACE dump_shorts(s, "samples", samples, n * s->nb_channels); From ac28ce5fac2f77891d70c9e49cda65ddb51818b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 21:40:12 +0000 Subject: [PATCH 144/528] Hide the now-prefixed decoders, encoders, parsers, bsf, hwaccel objects. This significantly reduces the size of the symbol table in the generated ELF shared object (as well as the other linked tables). Signed-off-by: Mans Rullgard --- libavcodec/libavcodec.v | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/libavcodec.v b/libavcodec/libavcodec.v index 561a42cd4f..65699038ab 100644 --- a/libavcodec/libavcodec.v +++ b/libavcodec/libavcodec.v @@ -1,3 +1,9 @@ LIBAVCODEC_$MAJOR { global: *; + local: + ff_*_bsf; + ff_*_decoder; + ff_*_encoder; + ff_*_hwaccel; + ff_*_parser; }; From e62886403355614f0579a1568a53f04037c90df8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 22:03:29 +0000 Subject: [PATCH 145/528] Hide demuxers', muxers' and protocols' objects via the ld version script. This reduces the symbols exported by libavformat from 699 to 451. Signed-off-by: Mans Rullgard --- libavformat/libavformat.v | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/libavformat.v b/libavformat/libavformat.v index da2311eb36..0ec1c3c4de 100644 --- a/libavformat/libavformat.v +++ b/libavformat/libavformat.v @@ -1,3 +1,7 @@ LIBAVFORMAT_$MAJOR { global: *; + local: + ff_*_demuxer; + ff_*_muxer; + ff_*_protocol; }; From 5ce5dbc5f3d0bce1f8d76fea1907c91469ebdd01 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Fri, 28 Jan 2011 06:13:49 +0000 Subject: [PATCH 146/528] Make ff_float_to_int16*_c() static. Signed-off-by: Mans Rullgard --- libavcodec/dsputil.c | 4 ++-- libavcodec/dsputil.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 03a5eeea45..84f91fc135 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3913,13 +3913,13 @@ static av_always_inline int float_to_int16_one(const float *src){ return av_clip_int16(lrintf(*src)); } -void ff_float_to_int16_c(int16_t *dst, const float *src, long len){ +static void ff_float_to_int16_c(int16_t *dst, const float *src, long len){ int i; for(i=0; i Date: Fri, 28 Jan 2011 03:12:21 +0100 Subject: [PATCH 147/528] os: replace select with poll Select has limitations on the fd values it could accept and silently breaks when it is reached. --- libavformat/os_support.c | 3 --- libavformat/rtpproto.c | 24 ++++++------------ libavformat/rtsp.c | 55 ++++++++++++++++++++++------------------ libavformat/rtsp.h | 5 ++++ libavformat/rtspenc.c | 19 +++++--------- libavformat/sapdec.c | 14 ++++------ libavformat/tcp.c | 48 ++++++++++------------------------- libavformat/udp.c | 15 ++++------- 8 files changed, 73 insertions(+), 110 deletions(-) diff --git a/libavformat/os_support.c b/libavformat/os_support.c index 83f0820662..70cca92c8d 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -236,7 +236,6 @@ int ff_socket_nonblock(int socket, int enable) } #endif /* CONFIG_NETWORK */ -#if CONFIG_FFSERVER #if !HAVE_POLL_H int poll(struct pollfd *fds, nfds_t numfds, int timeout) { @@ -305,5 +304,3 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout) return rc; } #endif /* HAVE_POLL_H */ -#endif /* CONFIG_FFSERVER */ - diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 6ef67849f5..aa2cc37776 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -34,8 +34,8 @@ #include "network.h" #include "os_support.h" #include -#if HAVE_SYS_SELECT_H -#include +#if HAVE_POLL_H +#include #endif #include @@ -221,9 +221,9 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) RTPContext *s = h->priv_data; struct sockaddr_storage from; socklen_t from_len; - int len, fd_max, n; - fd_set rfds; - struct timeval tv; + int len, n; + struct pollfd p[2] = {{s->rtp_fd, POLLIN, 0}, {s->rtcp_fd, POLLIN, 0}}; + #if 0 for(;;) { from_len = sizeof(from); @@ -242,18 +242,10 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) if (url_interrupt_cb()) return AVERROR(EINTR); /* build fdset to listen to RTP and RTCP packets */ - FD_ZERO(&rfds); - fd_max = s->rtp_fd; - FD_SET(s->rtp_fd, &rfds); - if (s->rtcp_fd > fd_max) - fd_max = s->rtcp_fd; - FD_SET(s->rtcp_fd, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 100 * 1000; - n = select(fd_max + 1, &rfds, NULL, NULL, &tv); + n = poll(p, 2, 100); if (n > 0) { /* first try RTCP */ - if (FD_ISSET(s->rtcp_fd, &rfds)) { + if (p[1].revents & POLLIN) { from_len = sizeof(from); len = recvfrom (s->rtcp_fd, buf, size, 0, (struct sockaddr *)&from, &from_len); @@ -266,7 +258,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) break; } /* then RTP */ - if (FD_ISSET(s->rtp_fd, &rfds)) { + if (p[0].revents & POLLIN) { from_len = sizeof(from); len = recvfrom (s->rtp_fd, buf, size, 0, (struct sockaddr *)&from, &from_len); diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 752f429f49..a56ff99547 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -26,8 +26,8 @@ #include "avformat.h" #include -#if HAVE_SYS_SELECT_H -#include +#if HAVE_POLL_H +#include #endif #include #include "internal.h" @@ -44,11 +44,11 @@ //#define DEBUG //#define DEBUG_RTP_TCP -/* Timeout values for socket select, in ms, +/* Timeout values for socket poll, in ms, * and read_packet(), in seconds */ -#define SELECT_TIMEOUT_MS 100 +#define POLL_TIMEOUT_MS 100 #define READ_PACKET_TIMEOUT_S 10 -#define MAX_TIMEOUTS READ_PACKET_TIMEOUT_S * 1000 / SELECT_TIMEOUT_MS +#define MAX_TIMEOUTS READ_PACKET_TIMEOUT_S * 1000 / POLL_TIMEOUT_MS #define SDP_MAX_SIZE 16384 #define RECVBUF_SIZE 10 * RTP_MAX_PACKET_LENGTH @@ -429,8 +429,14 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, } } +/** + * Parse the sdp description and allocate the rtp streams and the + * pollfd array used for udp ones. + */ + int ff_sdp_parse(AVFormatContext *s, const char *content) { + RTSPState *rt = s->priv_data; const char *p; int letter; /* Some SDP lines, particularly for Realmedia or ASF RTSP streams, @@ -470,6 +476,8 @@ int ff_sdp_parse(AVFormatContext *s, const char *content) if (*p == '\n') p++; } + rt->p = av_malloc(sizeof(struct pollfd)*2*(rt->nb_rtsp_streams+1)); + if (!rt->p) return AVERROR(ENOMEM); return 0; } #endif /* CONFIG_RTPDEC */ @@ -531,6 +539,7 @@ void ff_rtsp_close_streams(AVFormatContext *s) av_close_input_stream (rt->asf_ctx); rt->asf_ctx = NULL; } + av_free(rt->p); av_free(rt->recvbuf); } @@ -1554,55 +1563,51 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; - fd_set rfds; - int fd, fd_rtcp, fd_max, n, i, ret, tcp_fd, timeout_cnt = 0; - struct timeval tv; + int n, i, ret, tcp_fd, timeout_cnt = 0; + int max_p = 0; + struct pollfd *p = rt->p; for (;;) { if (url_interrupt_cb()) return AVERROR(EINTR); if (wait_end && wait_end - av_gettime() < 0) return AVERROR(EAGAIN); - FD_ZERO(&rfds); + max_p = 0; if (rt->rtsp_hd) { - tcp_fd = fd_max = url_get_file_handle(rt->rtsp_hd); - FD_SET(tcp_fd, &rfds); + tcp_fd = url_get_file_handle(rt->rtsp_hd); + p[max_p].fd = tcp_fd; + p[max_p++].events = POLLIN; } else { - fd_max = 0; tcp_fd = -1; } for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { - fd = url_get_file_handle(rtsp_st->rtp_handle); - 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); + p[max_p].fd = url_get_file_handle(rtsp_st->rtp_handle); + p[max_p++].events = POLLIN; + p[max_p].fd = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle); + p[max_p++].events = POLLIN; } } - tv.tv_sec = 0; - tv.tv_usec = SELECT_TIMEOUT_MS * 1000; - n = select(fd_max + 1, &rfds, NULL, NULL, &tv); + n = poll(p, max_p, POLL_TIMEOUT_MS); if (n > 0) { + int j = 1 - (tcp_fd == -1); timeout_cnt = 0; for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { - fd = url_get_file_handle(rtsp_st->rtp_handle); - fd_rtcp = rtp_get_rtcp_file_handle(rtsp_st->rtp_handle); - if (FD_ISSET(fd_rtcp, &rfds) || FD_ISSET(fd, &rfds)) { + if (p[j].revents & POLLIN || p[j+1].revents & POLLIN) { ret = url_read(rtsp_st->rtp_handle, buf, buf_size); if (ret > 0) { *prtsp_st = rtsp_st; return ret; } } + j+=2; } } #if CONFIG_RTSP_DEMUXER - if (tcp_fd != -1 && FD_ISSET(tcp_fd, &rfds)) { + if (tcp_fd != -1 && p[0].revents & POLLIN) { RTSPMessageHeader reply; ret = ff_rtsp_read_reply(s, &reply, NULL, 0, NULL); diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index f0ead10da5..14d3f41eb5 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -326,6 +326,11 @@ typedef struct RTSPState { * The number of returned packets */ uint64_t packets; + + /** + * Polling array for udp + */ + struct pollfd *p; } RTSPState; /** diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index dc8ecd80f2..88f093f5c1 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -22,8 +22,8 @@ #include "avformat.h" #include -#if HAVE_SYS_SELECT_H -#include +#if HAVE_POLL_H +#include #endif #include "network.h" #include "rtsp.h" @@ -172,23 +172,16 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; - fd_set rfds; - int n, tcp_fd; - struct timeval tv; + int n; + struct pollfd p = {url_get_file_handle(rt->rtsp_hd), POLLIN, 0}; AVFormatContext *rtpctx; int ret; - tcp_fd = url_get_file_handle(rt->rtsp_hd); - while (1) { - FD_ZERO(&rfds); - FD_SET(tcp_fd, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - n = select(tcp_fd + 1, &rfds, NULL, NULL, &tv); + n = poll(&p, 1, 0); if (n <= 0) break; - if (FD_ISSET(tcp_fd, &rfds)) { + if (p.revents & POLLIN) { RTSPMessageHeader reply; /* Don't let ff_rtsp_read_reply handle interleaved packets, diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index 208591cd0c..73525f5df8 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -25,8 +25,8 @@ #include "network.h" #include "os_support.h" #include "internal.h" -#if HAVE_SYS_SELECT_H -#include +#if HAVE_POLL_H +#include #endif #include @@ -183,19 +183,15 @@ 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; + struct pollfd p = {fd, POLLIN, 0}; 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)) + n = poll(&p, 1, 0); + if (n <= 0 || !(p.revents & POLLIN)) break; ret = url_read(sap->ann_fd, recvbuf, sizeof(recvbuf)); if (ret >= 8) { diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 5cb4b8f9c7..ac4e4b09db 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -23,8 +23,8 @@ #include "internal.h" #include "network.h" #include "os_support.h" -#if HAVE_SYS_SELECT_H -#include +#if HAVE_POLL_H +#include #endif #include @@ -38,9 +38,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) struct addrinfo hints, *ai, *cur_ai; int port, fd = -1; TCPContext *s = NULL; - fd_set wfds, efds; - int fd_max, ret; - struct timeval tv; + int ret; socklen_t optlen; char hostname[1024],proto[1024],path[1024]; char portstr[10]; @@ -73,6 +71,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) redo: ret = connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen); if (ret < 0) { + struct pollfd p = {fd, POLLOUT, 0}; if (ff_neterrno() == FF_NETERROR(EINTR)) { if (url_interrupt_cb()) goto fail1; @@ -88,15 +87,8 @@ static int tcp_open(URLContext *h, const char *uri, int flags) ret = AVERROR(EINTR); goto fail1; } - 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, &efds, &tv); - if (ret > 0 && (FD_ISSET(fd, &wfds) || FD_ISSET(fd, &efds))) + ret = poll(&p, 1, 100); + if (ret > 0) break; } @@ -140,20 +132,14 @@ static int tcp_open(URLContext *h, const char *uri, int flags) static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h->priv_data; - int len, fd_max, ret; - fd_set rfds; - struct timeval tv; + struct pollfd p = {s->fd, POLLIN, 0}; + int len, ret; for (;;) { if (url_interrupt_cb()) return AVERROR(EINTR); - fd_max = s->fd; - FD_ZERO(&rfds); - FD_SET(s->fd, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 100 * 1000; - ret = select(fd_max + 1, &rfds, NULL, NULL, &tv); - if (ret > 0 && FD_ISSET(s->fd, &rfds)) { + ret = poll(&p, 1, 100); + if (ret == 1 && p.revents & POLLIN) { len = recv(s->fd, buf, size, 0); if (len < 0) { if (ff_neterrno() != FF_NETERROR(EINTR) && @@ -171,21 +157,15 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size) static int tcp_write(URLContext *h, const uint8_t *buf, int size) { TCPContext *s = h->priv_data; - int ret, size1, fd_max, len; - fd_set wfds; - struct timeval tv; + int ret, size1, len; + struct pollfd p = {s->fd, POLLOUT, 0}; size1 = size; while (size > 0) { if (url_interrupt_cb()) return AVERROR(EINTR); - fd_max = s->fd; - FD_ZERO(&wfds); - FD_SET(s->fd, &wfds); - tv.tv_sec = 0; - tv.tv_usec = 100 * 1000; - ret = select(fd_max + 1, NULL, &wfds, NULL, &tv); - if (ret > 0 && FD_ISSET(s->fd, &wfds)) { + ret = poll(&p, 1, 100); + if (ret == 1 && p.revents & POLLOUT) { len = send(s->fd, buf, size, 0); if (len < 0) { if (ff_neterrno() != FF_NETERROR(EINTR) && diff --git a/libavformat/udp.c b/libavformat/udp.c index 8080c98045..aa17c979f3 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -31,8 +31,8 @@ #include "internal.h" #include "network.h" #include "os_support.h" -#if HAVE_SYS_SELECT_H -#include +#if HAVE_POLL_H +#include #endif #include @@ -432,25 +432,20 @@ static int udp_open(URLContext *h, const char *uri, int flags) static int udp_read(URLContext *h, uint8_t *buf, int size) { UDPContext *s = h->priv_data; + struct pollfd p = {s->udp_fd, POLLIN, 0}; int len; - fd_set rfds; int ret; - struct timeval tv; for(;;) { if (url_interrupt_cb()) return AVERROR(EINTR); - FD_ZERO(&rfds); - FD_SET(s->udp_fd, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 100 * 1000; - ret = select(s->udp_fd + 1, &rfds, NULL, NULL, &tv); + ret = poll(&p, 1, 100); if (ret < 0) { if (ff_neterrno() == FF_NETERROR(EINTR)) continue; return AVERROR(EIO); } - if (!(ret > 0 && FD_ISSET(s->udp_fd, &rfds))) + if (!(ret == 1 && p.revents & POLLIN)) continue; len = recv(s->udp_fd, buf, size, 0); if (len < 0) { From f81c7ac70a7e5e82b0ab0839faf8d22d555efb9d Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Fri, 28 Jan 2011 03:12:22 +0100 Subject: [PATCH 148/528] rtsp: make ff_sdp_parse return value forwarded the sdp demuxer did not forward it at all while the rtsp demuxer assumed a single kind of error --- libavformat/rtsp.c | 3 ++- libavformat/rtspdec.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index a56ff99547..dec6995c46 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1795,8 +1795,9 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) } content[size] ='\0'; - ff_sdp_parse(s, content); + err = ff_sdp_parse(s, content); av_free(content); + if (err) goto fail; /* open each RTP stream */ for (i = 0; i < rt->nb_rtsp_streams; i++) { diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 55996e3631..f95f7c3851 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -136,7 +136,7 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply) ret = ff_sdp_parse(s, (const char *)content); av_freep(&content); if (ret < 0) - return AVERROR_INVALIDDATA; + return ret; return 0; } From 9d4bdcb714f85b5d90ebf9704784a31c88dfb360 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Fri, 28 Jan 2011 09:51:34 -0500 Subject: [PATCH 149/528] Fix VP8 aliasing problems. Replace * (uint32_t *) buf accesses with AV_WN32A/AV_COPY32. --- libavcodec/vp8.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 3691f15977..66a7c4dec4 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1132,9 +1132,9 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, linesize = 8; if (!(mb_y + y)) { copy_dst[3] = 127U; - * (uint32_t *) (copy_dst + 4) = 127U * 0x01010101U; + AV_WN32A(copy_dst+4, 127U * 0x01010101U); } else { - * (uint32_t *) (copy_dst + 4) = * (uint32_t *) (ptr+4*x-s->linesize); + AV_COPY32(copy_dst+4, ptr+4*x-s->linesize); if (!(mb_x + x)) { copy_dst[3] = 129U; } else { @@ -1158,10 +1158,10 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, } s->hpc.pred4x4[mode](dst, topright, linesize); if (copy) { - * (uint32_t *) (ptr+4*x) = * (uint32_t *) (copy_dst + 12); - * (uint32_t *) (ptr+4*x+s->linesize) = * (uint32_t *) (copy_dst + 20); - * (uint32_t *) (ptr+4*x+s->linesize*2) = * (uint32_t *) (copy_dst + 28); - * (uint32_t *) (ptr+4*x+s->linesize*3) = * (uint32_t *) (copy_dst + 36); + AV_COPY32(ptr+4*x , copy_dst+12); + AV_COPY32(ptr+4*x+s->linesize , copy_dst+20); + AV_COPY32(ptr+4*x+s->linesize*2, copy_dst+28); + AV_COPY32(ptr+4*x+s->linesize*3, copy_dst+36); } nnz = s->non_zero_count_cache[y][x]; From 3e5bc7ff6a23014daf2eb0b9a22986753ae2ec4f Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 27 Jan 2011 01:01:34 +0100 Subject: [PATCH 150/528] In the start_frame() debug log, print the reference pos value rather than the evaluated value converted to int. That's required because -1 is evaluated as NAN, which converted back to int looks like a random number, this is especially annoying when debugging sources with undefined pos (as the video4linux2 device). Signed-off-by: Janne Grunau --- libavfilter/vf_setpts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_setpts.c b/libavfilter/vf_setpts.c index 0921df7c67..31fa1ef65f 100644 --- a/libavfilter/vf_setpts.c +++ b/libavfilter/vf_setpts.c @@ -116,10 +116,10 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) #ifdef DEBUG av_log(inlink->dst, AV_LOG_DEBUG, - "n:%"PRId64" interlaced:%d pos:%d pts:%"PRId64" t:%f -> pts:%"PRId64" t:%f\n", + "n:%"PRId64" interlaced:%d pos:%"PRId64" 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 ->pos, inpicref ->pts, inpicref ->pts * av_q2d(inlink->time_base), outpicref->pts, outpicref->pts * av_q2d(inlink->time_base)); #endif From 3c802cabba8e85e4f2949c57df947dd1823a15f5 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 27 Jan 2011 21:26:38 +0100 Subject: [PATCH 151/528] In the rawvideo decoder, set pkt_pts in the output frame. Signed-off-by: Janne Grunau --- libavcodec/rawdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index c2ca91d64f..29cc5e44d8 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -124,6 +124,7 @@ static int raw_decode(AVCodecContext *avctx, frame->interlaced_frame = avctx->coded_frame->interlaced_frame; frame->top_field_first = avctx->coded_frame->top_field_first; frame->reordered_opaque = avctx->reordered_opaque; + frame->pkt_pts = avctx->pkt->pts; //2bpp and 4bpp raw in avi and mov (yes this is ugly ...) if (context->buffer) { From a7827a17c6b3388322350456d445c94b3a82cd25 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Fri, 28 Jan 2011 18:28:20 +0200 Subject: [PATCH 152/528] In mpegts "reserved_future_use" field must be set to 1 in SDT table According to EN 300 468 section 3.1 (Definitions): Unless otherwise specified within the present document all "reserved_future_use" bits is set to "1". This was not the case for SDT generation so this patch fixes it. Signed-off-by: Janne Grunau --- libavformat/mpegtsenc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 3c56830d00..6f35d6fb44 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -128,6 +128,8 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id, { uint8_t section[1024], *q; unsigned int tot_len; + /* reserved_future_use field must be set to 1 for SDT */ + unsigned int flags = tid == SDT_TID ? 0xf000 : 0xb000; tot_len = 3 + 5 + len + 4; /* check if not too big */ @@ -136,7 +138,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id, q = section; *q++ = tid; - put16(&q, 0xb000 | (len + 5 + 4)); /* 5 byte header + 4 byte CRC */ + put16(&q, flags | (len + 5 + 4)); /* 5 byte header + 4 byte CRC */ put16(&q, id); *q++ = 0xc1 | (version << 1); /* current_next_indicator = 1 */ *q++ = sec_num; From 85466e1e5f7f1fe50933d2d967a06b45b9222b5b Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Wed, 26 Jan 2011 23:55:53 +0100 Subject: [PATCH 153/528] Add muxers.texi file. Signed-off-by: Janne Grunau --- doc/ffmpeg.texi | 1 + doc/ffplay.texi | 1 + doc/ffprobe.texi | 1 + doc/muxers.texi | 21 +++++++++++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 doc/muxers.texi diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 1732c9b4bf..98f2031f75 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -977,6 +977,7 @@ file to which you want to add them. @include eval.texi @include demuxers.texi +@include muxers.texi @include indevs.texi @include outdevs.texi @include protocols.texi diff --git a/doc/ffplay.texi b/doc/ffplay.texi index c9c38da189..c03905c3e0 100644 --- a/doc/ffplay.texi +++ b/doc/ffplay.texi @@ -155,6 +155,7 @@ Seek to percentage in file corresponding to fraction of width. @include eval.texi @include demuxers.texi +@include muxers.texi @include indevs.texi @include outdevs.texi @include protocols.texi diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi index 8f3a5a9772..bc96bd561e 100644 --- a/doc/ffprobe.texi +++ b/doc/ffprobe.texi @@ -110,6 +110,7 @@ with name "STREAM". @c man end @include demuxers.texi +@include muxers.texi @include protocols.texi @include indevs.texi diff --git a/doc/muxers.texi b/doc/muxers.texi new file mode 100644 index 0000000000..c3dcf1171c --- /dev/null +++ b/doc/muxers.texi @@ -0,0 +1,21 @@ +@chapter Muxers +@c man begin MUXERS + +Muxers are configured elements in FFmpeg which allow writing +multimedia streams to a particular type of file. + +When you configure your FFmpeg build, all the supported muxers +are enabled by default. You can list all available muxers using the +configure option @code{--list-muxers}. + +You can disable all the muxers with the configure option +@code{--disable-muxers} and selectively enable / disable single muxers +with the options @code{--enable-muxer=@var{MUXER}} / +@code{--disable-muxer=@var{MUXER}}. + +The option @code{-formats} of the ff* tools will display the list of +enabled muxers. + +A description of some of the currently available muxers follows. + +@c man end MUXERS From e5c82df80ef49957fe532d0992985012d6d97955 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Fri, 28 Jan 2011 06:13:50 +0000 Subject: [PATCH 154/528] aacdec: Convert some loop copies into memcpy()s. Signed-off-by: Mans Rullgard --- libavcodec/aacdec.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 2d5fb540a9..21270994da 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -1723,8 +1723,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) { ac->dsp.vector_fmul_window( out, saved, buf, lwindow_prev, 0, 512); } else { - for (i = 0; i < 448; i++) - out[i] = saved[i]; + memcpy( out, saved, 448 * sizeof(float)); if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, 0, 64); @@ -1735,15 +1734,13 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) memcpy( out + 448 + 4*128, temp, 64 * sizeof(float)); } else { ac->dsp.vector_fmul_window(out + 448, saved + 448, buf, swindow_prev, 0, 64); - for (i = 576; i < 1024; i++) - out[i] = buf[i-512]; + memcpy( out + 576, buf + 64, 448 * sizeof(float)); } } // buffer update if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - for (i = 0; i < 64; i++) - saved[i] = temp[64 + i]; + memcpy( saved, temp + 64, 64 * sizeof(float)); ac->dsp.vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128, swindow, 0, 64); ac->dsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 0, 64); ac->dsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 0, 64); From 79dca23dc262742b312161a5dec707eb7b9c8d97 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 28 Jan 2011 16:58:54 +0000 Subject: [PATCH 155/528] Update mpegts test reference The output was changed by a7827a17c6b3388322350456d445c94b3a82cd25. Signed-off-by: Mans Rullgard --- tests/ref/lavf/ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ref/lavf/ts b/tests/ref/lavf/ts index e054141664..e4bdb631df 100644 --- a/tests/ref/lavf/ts +++ b/tests/ref/lavf/ts @@ -1,3 +1,3 @@ -90e770ba5ec0506bd66cd44511e173a3 *./tests/data/lavf/lavf.ts +e8d609b8a5b5854a4485718434b287f7 *./tests/data/lavf/lavf.ts 406644 ./tests/data/lavf/lavf.ts ./tests/data/lavf/lavf.ts CRC=0x133216c1 From 4fc9ff0ad6f0f6b2c7443c6b4a3a1c817e97fdfd Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Wed, 26 Jan 2011 23:03:38 +0100 Subject: [PATCH 156/528] Make the image2 demuxer log more verbose Add an error message in case the user requests to write more than one file and the path does not contain a "%d" or "%0Nd" pattern. Signed-off-by: Janne Grunau --- libavformat/img2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/img2.c b/libavformat/img2.c index 4cf409e001..9583eea5df 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -347,7 +347,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) if (!img->is_pipe) { if (av_get_frame_filename(filename, sizeof(filename), img->path, img->img_number) < 0 && img->img_number>1) { - av_log(s, AV_LOG_ERROR, "Could not get frame filename from pattern\n"); + av_log(s, AV_LOG_ERROR, + "Could not get frame filename number %d from pattern '%s'\n", + img->img_number, img->path); return AVERROR(EIO); } for(i=0; i<3; i++){ From 362d8f7d9e6a3bca2ce89f767d153d3ab8bf5773 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 28 Jan 2011 17:16:15 +0000 Subject: [PATCH 157/528] os_support: make poll() fallbacks conditional on CONFIG_NETWORK poll() is only used by networking code, so the fallback should only be built if networking is enabled. Also remove CONFIG_FFSERVER condition from the declarations. This should fix building on systems without poll(), broken by a8475bbdb64e638bd8161df9647876fd23f8a29a. Signed-off-by: Mans Rullgard --- libavformat/os_support.c | 2 +- libavformat/os_support.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/os_support.c b/libavformat/os_support.c index 70cca92c8d..4f73011d65 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -234,7 +234,6 @@ int ff_socket_nonblock(int socket, int enable) return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK); #endif } -#endif /* CONFIG_NETWORK */ #if !HAVE_POLL_H int poll(struct pollfd *fds, nfds_t numfds, int timeout) @@ -304,3 +303,4 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout) return rc; } #endif /* HAVE_POLL_H */ +#endif /* CONFIG_NETWORK */ diff --git a/libavformat/os_support.h b/libavformat/os_support.h index 5c9e81b340..df321511ed 100644 --- a/libavformat/os_support.h +++ b/libavformat/os_support.h @@ -55,7 +55,6 @@ typedef int socklen_t; #define closesocket close #endif -#if CONFIG_FFSERVER #if !HAVE_POLL_H typedef unsigned long nfds_t; @@ -82,7 +81,6 @@ struct pollfd { int poll(struct pollfd *fds, nfds_t numfds, int timeout); #endif /* HAVE_POLL_H */ -#endif /* CONFIG_FFSERVER */ #endif /* CONFIG_NETWORK */ #endif /* AVFORMAT_OS_SUPPORT_H */ From 042950542d6ee70fde01e4edbb6e6da38ebbaf27 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 27 Jan 2011 10:41:49 +0100 Subject: [PATCH 158/528] asfdec: ensure that the whole tag is read. Signed-off-by: Janne Grunau --- libavformat/asfdec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 229f8ba51d..eafb71d956 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -125,13 +125,14 @@ static int get_value(ByteIOContext *pb, int type){ static void get_tag(AVFormatContext *s, const char *key, int type, int len) { char *value; + int64_t off = url_ftell(s->pb); if ((unsigned)len >= (UINT_MAX - 1)/2) return; value = av_malloc(2*len+1); if (!value) - return; + goto finish; if (type == 0) { // UTF16-LE avio_get_str16le(s->pb, len, value, 2*len + 1); @@ -139,13 +140,13 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len) uint64_t num = get_value(s->pb, type); snprintf(value, len, "%"PRIu64, num); } else { - url_fskip(s->pb, len); - av_freep(&value); av_log(s, AV_LOG_DEBUG, "Unsupported value type %d in tag %s.\n", type, key); - return; + goto finish; } av_metadata_set2(&s->metadata, key, value, 0); +finish: av_freep(&value); + url_fseek(s->pb, off + len, SEEK_SET); } static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) From a0788cc6273a7a33cc111f7248248c71fd009916 Mon Sep 17 00:00:00 2001 From: Dave Yeo Date: Fri, 28 Jan 2011 12:01:52 -0800 Subject: [PATCH 159/528] rtspenc: include os_support.h for system without HAVE_POLL_H fix compile on OS/2 Signed-off-by: Janne Grunau --- libavformat/rtspenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index 88f093f5c1..d54be1a5c2 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -26,6 +26,7 @@ #include #endif #include "network.h" +#include "os_support.h" #include "rtsp.h" #include "internal.h" #include "libavutil/intreadwrite.h" From 4d54df8e07dca3e30ebcaffd1a0e750a876700a2 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Fri, 28 Jan 2011 22:28:03 +0000 Subject: [PATCH 160/528] mpegtsenc: support CODEC_ID_AAC_LATM $subject. Have used this for loopback testing with mpegts.c. -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) [2. text/x-diff; 0001-mpegtsenc-support-CODEC_ID_AAC_LATM.patch] From 0f7f9db4b7da1793996af6dda84298507703759a Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 9 Jan 2011 09:45:50 +1100 Subject: [PATCH] mpegtsenc: support CODEC_ID_AAC_LATM Signed-off-by: Mans Rullgard --- libavformat/mpegts.h | 1 + libavformat/mpegtsenc.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h index 25f21079c6..e60329711b 100644 --- a/libavformat/mpegts.h +++ b/libavformat/mpegts.h @@ -48,6 +48,7 @@ #define STREAM_TYPE_PRIVATE_SECTION 0x05 #define STREAM_TYPE_PRIVATE_DATA 0x06 #define STREAM_TYPE_AUDIO_AAC 0x0f +#define STREAM_TYPE_AUDIO_AAC_LATM 0x11 #define STREAM_TYPE_VIDEO_MPEG4 0x10 #define STREAM_TYPE_VIDEO_H264 0x1b #define STREAM_TYPE_VIDEO_VC1 0xea diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 6f35d6fb44..b58e84be16 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -243,6 +243,9 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) case CODEC_ID_AAC: stream_type = STREAM_TYPE_AUDIO_AAC; break; + case CODEC_ID_AAC_LATM: + stream_type = STREAM_TYPE_AUDIO_AAC_LATM; + break; case CODEC_ID_AC3: stream_type = STREAM_TYPE_AUDIO_AC3; break; From e5262ec44a30a9132f0361f775c5b63d20e4e4d5 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 26 Jan 2011 22:37:50 -0500 Subject: [PATCH 161/528] Optimize C version of ff_emulated_edge_mc(). From ~780 cycles to 551 cycles, mostly just by using libc memcpy() instead of manually shuffling individual bytes around. --- libavcodec/dsputil.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 84f91fc135..fafe5f52d7 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -355,38 +355,45 @@ void ff_emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize, int blo start_x= FFMAX(0, -src_x); end_y= FFMIN(block_h, h-src_y); end_x= FFMIN(block_w, w-src_x); + assert(start_y < end_y && block_h); + assert(start_x < end_x && block_w); - // copy existing part - for(y=start_y; y Date: Wed, 26 Jan 2011 22:35:56 -0500 Subject: [PATCH 162/528] Move ff_emulated_edge_mc() into DSPContext. --- libavcodec/cavs.c | 6 +++--- libavcodec/dsputil.c | 1 + libavcodec/dsputil.h | 15 +++++++++++++++ libavcodec/h264.c | 6 +++--- libavcodec/mpegvideo.c | 12 ++++++------ libavcodec/mpegvideo_common.h | 26 +++++++++++++------------- libavcodec/mpegvideo_enc.c | 6 +++--- libavcodec/rv34.c | 6 +++--- libavcodec/snow.c | 2 +- libavcodec/svq3.c | 4 ++-- libavcodec/vc1dec.c | 18 +++++++++--------- libavcodec/vp3.c | 2 +- libavcodec/vp56.c | 2 +- libavcodec/vp8.c | 2 +- libavcodec/wmv2.c | 6 +++--- 15 files changed, 65 insertions(+), 49 deletions(-) diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c index 3958cf8093..db49ef3e67 100644 --- a/libavcodec/cavs.c +++ b/libavcodec/cavs.c @@ -353,7 +353,7 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square, || full_my < 0-extra_height || full_mx + 16/*FIXME*/ > pic_width + extra_width || full_my + 16/*FIXME*/ > pic_height + extra_height){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height); src_y= s->edge_emu_buffer + 2 + 2*h->l_stride; emu=1; @@ -365,14 +365,14 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square, } if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cb= s->edge_emu_buffer; } chroma_op(dest_cb, src_cb, h->c_stride, chroma_height, mx&7, my&7); if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cr= s->edge_emu_buffer; } diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index fafe5f52d7..f604f0e7f9 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -4218,6 +4218,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->add_pixels8 = add_pixels8_c; c->add_pixels4 = add_pixels4_c; c->sum_abs_dctelem = sum_abs_dctelem_c; + c->emulated_edge_mc = ff_emulated_edge_mc; c->gmc1 = gmc1_c; c->gmc = ff_gmc_c; c->clear_block = clear_block_c; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 74831cf41b..9a1172b1dc 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -215,6 +215,21 @@ typedef struct DSPContext { void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size); void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size); int (*sum_abs_dctelem)(DCTELEM *block/*align 16*/); + /** + * Motion estimation with emulated edge values. + * @param buf pointer to destination buffer (unaligned) + * @param src pointer to pixel source (unaligned) + * @param linesize width (in pixels) for src/buf + * @param block_w number of pixels (per row) to copy to buf + * @param block_h nummber of pixel rows to copy to buf + * @param src_x offset of src to start of row - this may be negative + * @param src_y offset of src to top of image - this may be negative + * @param w width of src in pixels + * @param h height of src in pixels + */ + void (*emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, + int block_w, int block_h, + int src_x, int src_y, int w, int h); /** * translational global motion compensation. */ diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 8ef9b76f44..2a3357b05c 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -361,7 +361,7 @@ static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, || full_my < 0-extra_height || full_mx + 16/*FIXME*/ > pic_width + extra_width || full_my + 16/*FIXME*/ > pic_height + extra_height){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->mb_linesize, h->mb_linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->mb_linesize, h->mb_linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height); src_y= s->edge_emu_buffer + 2 + 2*h->mb_linesize; emu=1; } @@ -382,13 +382,13 @@ static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->mb_uvlinesize; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cb= s->edge_emu_buffer; } chroma_op(dest_cb, src_cb, h->mb_uvlinesize, chroma_height, mx&7, my&7); if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cr= s->edge_emu_buffer; } chroma_op(dest_cr, src_cr, h->mb_uvlinesize, chroma_height, mx&7, my&7); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 65221f34f8..c8706bcf60 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1479,7 +1479,7 @@ static inline int hpel_motion_lowres(MpegEncContext *s, if( (unsigned)src_x > h_edge_pos - (!!sx) - w || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){ - ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<edge_emu_buffer; emu=1; @@ -1552,14 +1552,14 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, if( (unsigned)src_x > h_edge_pos - (!!sx) - 2*block_s || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, src_x, src_y<edge_emu_buffer; if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize; - ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, + s->dsp.emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<>1, v_edge_pos>>1); - ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based, + s->dsp.emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<>1, v_edge_pos>>1); ptr_cb= uvbuf; ptr_cr= uvbuf+16; @@ -1625,7 +1625,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > h_edge_pos - (!!sx) - block_s || (unsigned)src_y > v_edge_pos - (!!sy) - block_s){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); ptr= s->edge_emu_buffer; emu=1; } @@ -1636,7 +1636,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s, ptr = ref_picture[2] + offset; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); ptr= s->edge_emu_buffer; } pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy); diff --git a/libavcodec/mpegvideo_common.h b/libavcodec/mpegvideo_common.h index 135bd1f557..d607e45ae1 100644 --- a/libavcodec/mpegvideo_common.h +++ b/libavcodec/mpegvideo_common.h @@ -83,7 +83,7 @@ static inline void gmc1_motion(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= s->h_edge_pos - 17 || (unsigned)src_y >= s->v_edge_pos - 17){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } @@ -122,7 +122,7 @@ static inline void gmc1_motion(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= (s->h_edge_pos>>1) - 9 || (unsigned)src_y >= (s->v_edge_pos>>1) - 9){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; emu=1; } @@ -131,7 +131,7 @@ static inline void gmc1_motion(MpegEncContext *s, ptr = ref_picture[2] + offset; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; } s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding); @@ -223,7 +223,7 @@ static inline int hpel_motion(MpegEncContext *s, if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){ if( (unsigned)src_x > h_edge_pos - (motion_x&1) - w || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){ - ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<v_edge_pos); src= s->edge_emu_buffer; emu=1; @@ -315,19 +315,19 @@ if(s->quarter_sample) "MPEG motion vector out of boundary (%d %d)\n", src_x, src_y); return; } - ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, src_x, src_y<h_edge_pos, s->v_edge_pos); ptr_y = s->edge_emu_buffer; if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize; - ff_emulated_edge_mc(uvbuf , + s->dsp.emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<h_edge_pos>>1, s->v_edge_pos>>1); - ff_emulated_edge_mc(uvbuf+16, + s->dsp.emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y< s->h_edge_pos - (motion_x&3) - 16 || (unsigned)src_y > v_edge_pos - (motion_y&3) - h ){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, src_x, src_y<h_edge_pos, s->v_edge_pos); ptr_y= s->edge_emu_buffer; if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize; - ff_emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize, + s->dsp.emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y<h_edge_pos>>1, s->v_edge_pos>>1); - ff_emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, + s->dsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y<h_edge_pos>>1, s->v_edge_pos>>1); @@ -590,7 +590,7 @@ static inline void chroma_4mv_motion(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > (s->h_edge_pos>>1) - (dxy &1) - 8 || (unsigned)src_y > (s->v_edge_pos>>1) - (dxy>>1) - 8){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; @@ -601,7 +601,7 @@ static inline void chroma_4mv_motion(MpegEncContext *s, ptr = ref_picture[2] + offset; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; @@ -762,7 +762,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 8 || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->linesize, 9, 9, src_x, src_y, s->h_edge_pos, s->v_edge_pos); diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index fa285ca371..6167a9b20e 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1548,11 +1548,11 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){ uint8_t *ebuf= s->edge_emu_buffer + 32; - ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height); + s->dsp.emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height); ptr_y= ebuf; - ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); + s->dsp.emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cb= ebuf+18*wrap_y; - ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); + s->dsp.emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cr= ebuf+18*wrap_y+8; } diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index b586aa0b86..08fa8a90ff 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -718,12 +718,12 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, uint8_t *uvbuf= s->edge_emu_buffer + 22 * s->linesize; srcY -= 2 + 2*s->linesize; - ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+6, (height<<3)+6, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+6, (height<<3)+6, src_x - 2, src_y - 2, s->h_edge_pos, s->v_edge_pos); srcY = s->edge_emu_buffer + 2 + 2*s->linesize; - ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, (width<<2)+1, (height<<2)+1, + s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, (width<<2)+1, (height<<2)+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width<<2)+1, (height<<2)+1, + s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width<<2)+1, (height<<2)+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 8a259af4dd..9ab9fed71f 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -1171,7 +1171,7 @@ static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, i src += sx + sy*stride; if( (unsigned)sx >= w - b_w - (HTAPS_MAX-2) || (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){ - ff_emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h); + s->dsp.emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h); src= tmp + MB_SIZE; } // assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h); diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index 9d87710595..5162e99243 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -283,7 +283,7 @@ static inline void svq3_mc_dir_part(MpegEncContext *s, src = pic->data[0] + mx + my*s->linesize; if (emu) { - ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1), + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1), mx, my, s->h_edge_pos, s->v_edge_pos); src = s->edge_emu_buffer; } @@ -304,7 +304,7 @@ static inline void svq3_mc_dir_part(MpegEncContext *s, src = pic->data[i] + mx + my*s->uvlinesize; if (emu) { - ff_emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1), + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1), mx, my, (s->h_edge_pos >> 1), (s->v_edge_pos >> 1)); src = s->edge_emu_buffer; } diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 056b435055..3bd2cce297 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -288,12 +288,12 @@ static void vc1_mc_1mv(VC1Context *v, int dir) uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize; srcY -= s->mspel * (1 + s->linesize); - ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); srcY = s->edge_emu_buffer; - ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; @@ -403,7 +403,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n) || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel*2 || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel*2){ srcY -= s->mspel * (1 + s->linesize); - ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2, src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); srcY = s->edge_emu_buffer; /* if we deal with range reduction we need to scale source blocks */ @@ -537,9 +537,9 @@ static void vc1_mc_4mv_chroma(VC1Context *v) if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){ - ff_emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ff_emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); srcU = s->edge_emu_buffer; srcV = s->edge_emu_buffer + 16; @@ -872,12 +872,12 @@ static void vc1_interp_mc(VC1Context *v) uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize; srcY -= s->mspel * (1 + s->linesize); - ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); srcY = s->edge_emu_buffer; - ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 7ba878eeff..06f55f6d47 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1432,7 +1432,7 @@ static void render_slice(Vp3DecodeContext *s, int slice) if(stride<0) temp -= 9*stride; else temp += 9*stride; - ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height); + s->dsp.emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height); motion_source= temp; } } diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c index 2e5f2d664a..3412e3dce2 100644 --- a/libavcodec/vp56.c +++ b/libavcodec/vp56.c @@ -337,7 +337,7 @@ static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, if (x<0 || x+12>=s->plane_width[plane] || y<0 || y+12>=s->plane_height[plane]) { - ff_emulated_edge_mc(s->edge_emu_buffer, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src + s->block_offset[b] + (dy-2)*stride + (dx-2), stride, 12, 12, x, y, s->plane_width[plane], diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 66a7c4dec4..ef4e270f6c 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1234,7 +1234,7 @@ void vp8_mc(VP8Context *s, int luma, src += y_off * linesize + x_off; if (x_off < mx_idx || x_off >= width - block_w - idx[2][mx] || y_off < my_idx || y_off >= height - block_h - idx[2][my]) { - ff_emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize, block_w + idx[1][mx], block_h + idx[1][my], x_off - mx_idx, y_off - my_idx, width, height); src = s->edge_emu_buffer + mx_idx + linesize * my_idx; diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index e872b44f93..32aaa8f6df 100644 --- a/libavcodec/wmv2.c +++ b/libavcodec/wmv2.c @@ -102,7 +102,7 @@ void ff_mspel_motion(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if(src_x<1 || src_y<1 || src_x + 17 >= s->h_edge_pos || src_y + h+1 >= v_edge_pos){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19, src_x-1, src_y-1, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer + 1 + s->linesize; emu=1; @@ -143,7 +143,7 @@ void ff_mspel_motion(MpegEncContext *s, offset = (src_y * uvlinesize) + src_x; ptr = ref_picture[1] + offset; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; } @@ -151,7 +151,7 @@ void ff_mspel_motion(MpegEncContext *s, ptr = ref_picture[2] + offset; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; } From 0745116c10e5650952c39ea543c66b12fba854e6 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 29 Jan 2011 04:39:39 +0000 Subject: [PATCH 163/528] ARM: update MpegEncContext offsets --- libavcodec/arm/asm-offsets.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/arm/asm-offsets.h b/libavcodec/arm/asm-offsets.h index f616f808f1..174b5aadcb 100644 --- a/libavcodec/arm/asm-offsets.h +++ b/libavcodec/arm/asm-offsets.h @@ -33,16 +33,16 @@ #define Y_DC_SCALE 0xab4 #define C_DC_SCALE 0xab8 #define AC_PRED 0xae0 -#define BLOCK_LAST_INDEX 0x21bc -#define INTER_SCANTAB_RASTER_END 0x23bc -#define H263_AIC 0x2668 +#define BLOCK_LAST_INDEX 0x21c0 +#define INTER_SCANTAB_RASTER_END 0x23c0 +#define H263_AIC 0x2670 #elif defined(__APPLE__) #define Y_DC_SCALE 0xa70 #define C_DC_SCALE 0xa74 #define AC_PRED 0xa9c -#define BLOCK_LAST_INDEX 0x2178 -#define INTER_SCANTAB_RASTER_END 0x2378 -#define H263_AIC 0x261c +#define BLOCK_LAST_INDEX 0x217c +#define INTER_SCANTAB_RASTER_END 0x237c +#define H263_AIC 0x2620 #endif #endif From ce20edb7bd6c1768ef5f4d181d7ba27a0e7945bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Fri, 28 Jan 2011 23:52:50 +0000 Subject: [PATCH 164/528] Vorbis-in-Ogg: Do not set timebase to invalid values Avoids an assert when the sample rate is invalid and the timebase is thus set to e.g. 1/0. Sample file is http://samples.mplayerhq.hu/ogg/fuzzed-srate-crash.ogg This is a quick fix for a crash, not a final solution. Signed-off-by: Mans Rullgard --- libavformat/oggparsevorbis.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index cdb0266eee..d743d25e2d 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -221,6 +221,7 @@ vorbis_header (AVFormatContext * s, int idx) if (os->buf[os->pstart] == 1) { const uint8_t *p = os->buf + os->pstart + 7; /* skip "\001vorbis" tag */ unsigned blocksize, bs0, bs1; + int srate; if (os->psize != 30) return -1; @@ -229,7 +230,7 @@ vorbis_header (AVFormatContext * s, int idx) return -1; st->codec->channels = bytestream_get_byte(&p); - st->codec->sample_rate = bytestream_get_le32(&p); + srate = bytestream_get_le32(&p); p += 4; // skip maximum bitrate st->codec->bit_rate = bytestream_get_le32(&p); // nominal bitrate p += 4; // skip minimum bitrate @@ -249,8 +250,11 @@ vorbis_header (AVFormatContext * s, int idx) st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_VORBIS; - st->time_base.num = 1; - st->time_base.den = st->codec->sample_rate; + if (srate > 0) { + st->codec->sample_rate = srate; + st->time_base.num = 1; + st->time_base.den = srate; + } } else if (os->buf[os->pstart] == 3) { if (os->psize > 8) ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8); From 3af1fe829ee6db5eafe261947e74b8516ffe5188 Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Sat, 29 Jan 2011 14:14:32 +0000 Subject: [PATCH 165/528] Fix overread in altivec DSP function sad16 Signed-off-by: Mans Rullgard --- libavcodec/ppc/dsputil_altivec.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavcodec/ppc/dsputil_altivec.c b/libavcodec/ppc/dsputil_altivec.c index 163323264c..6779312c96 100644 --- a/libavcodec/ppc/dsputil_altivec.c +++ b/libavcodec/ppc/dsputil_altivec.c @@ -230,7 +230,7 @@ static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i int i; int s; const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0); - vector unsigned char perm1, perm2, *pix1v, *pix2v; + vector unsigned char perm1, perm2, pix1v_low, pix1v_high, pix2v_low, pix2v_high; vector unsigned char t1, t2, t3,t4, t5; vector unsigned int sad; vector signed int sumdiffs; @@ -241,11 +241,13 @@ static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i for (i = 0; i < h; i++) { /* Read potentially unaligned pixels into t1 and t2 */ perm1 = vec_lvsl(0, pix1); - pix1v = (vector unsigned char *) pix1; + pix1v_high = vec_ld( 0, pix1); + pix1v_low = vec_ld(15, pix1); perm2 = vec_lvsl(0, pix2); - pix2v = (vector unsigned char *) pix2; - t1 = vec_perm(pix1v[0], pix1v[1], perm1); - t2 = vec_perm(pix2v[0], pix2v[1], perm2); + pix2v_high = vec_ld( 0, pix2); + pix2v_low = vec_ld(15, pix2); + t1 = vec_perm(pix1v_high, pix1v_low, perm1); + t2 = vec_perm(pix2v_high, pix2v_low, perm2); /* Calculate a sum of abs differences vector */ t3 = vec_max(t1, t2); From a8f0814a742dee4783afaa5bedb01aa0c77b1fc4 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 29 Jan 2011 13:24:13 +0100 Subject: [PATCH 166/528] doc: modify style for texi2html 1.78+ The generated HTML files are similar to the ones generated with texi2html 1.56k used on the website. Tested with texi2html 1.78 and 5.0. 1.78 is the minimal recommended version. The removed @sp from the titlepage section were ignored until texi2html 5.0. If not removed the pages generated by 5.0 will have ugly empty space around the title. --- Makefile | 4 ++-- doc/developer.texi | 5 +++-- doc/faq.texi | 5 +++-- doc/ffmpeg.texi | 6 ++++-- doc/ffplay.texi | 6 ++++-- doc/ffprobe.texi | 6 ++++-- doc/ffserver.texi | 6 ++++-- doc/general.texi | 5 +++-- doc/libavfilter.texi | 5 +++-- doc/t2h.init | 24 ++++++++++++++++++++++++ 10 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 doc/t2h.init diff --git a/Makefile b/Makefile index c5e74f062c..2658a30dc5 100644 --- a/Makefile +++ b/Makefile @@ -123,8 +123,8 @@ doc/ffprobe.pod doc/ffprobe.html: doc/demuxers.texi doc/indevs.texi doc/protocol doc/libavfilter.html: doc/filters.texi doc/%.html: TAG = HTML -doc/%.html: doc/%.texi - $(M)cd doc && texi2html -monolithic -number $(<:doc/%=%) +doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init + $(M)cd doc && texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init $(<:doc/%=%) doc/%.pod: TAG = POD doc/%.pod: doc/%.texi diff --git a/doc/developer.texi b/doc/developer.texi index 89bc3392e4..b9e246f214 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -2,11 +2,12 @@ @settitle Developer Documentation @titlepage -@sp 7 @center @titlefont{Developer Documentation} -@sp 3 @end titlepage +@top + +@contents @chapter Developers Guide diff --git a/doc/faq.texi b/doc/faq.texi index c03a2e1efe..100adff312 100644 --- a/doc/faq.texi +++ b/doc/faq.texi @@ -2,11 +2,12 @@ @settitle FFmpeg FAQ @titlepage -@sp 7 @center @titlefont{FFmpeg FAQ} -@sp 3 @end titlepage +@top + +@contents @chapter General Questions diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 98f2031f75..047444ab62 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -2,11 +2,13 @@ @settitle FFmpeg Documentation @titlepage -@sp 7 @center @titlefont{FFmpeg Documentation} -@sp 3 @end titlepage +@top + +@contents + @chapter Synopsis The generic syntax is: diff --git a/doc/ffplay.texi b/doc/ffplay.texi index c03905c3e0..e0518b859e 100644 --- a/doc/ffplay.texi +++ b/doc/ffplay.texi @@ -2,11 +2,13 @@ @settitle FFplay Documentation @titlepage -@sp 7 @center @titlefont{FFplay Documentation} -@sp 3 @end titlepage +@top + +@contents + @chapter Synopsis @example diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi index bc96bd561e..de65eee664 100644 --- a/doc/ffprobe.texi +++ b/doc/ffprobe.texi @@ -2,11 +2,13 @@ @settitle FFprobe Documentation @titlepage -@sp 7 @center @titlefont{FFprobe Documentation} -@sp 3 @end titlepage +@top + +@contents + @chapter Synopsis The generic syntax is: diff --git a/doc/ffserver.texi b/doc/ffserver.texi index 77deb85317..0cab3c8a98 100644 --- a/doc/ffserver.texi +++ b/doc/ffserver.texi @@ -2,11 +2,13 @@ @settitle FFserver Documentation @titlepage -@sp 7 @center @titlefont{FFserver Documentation} -@sp 3 @end titlepage +@top + +@contents + @chapter Synopsys The generic syntax is: diff --git a/doc/general.texi b/doc/general.texi index c1fecef580..950159f1b3 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -2,11 +2,12 @@ @settitle General Documentation @titlepage -@sp 7 @center @titlefont{General Documentation} -@sp 3 @end titlepage +@top + +@contents @chapter external libraries diff --git a/doc/libavfilter.texi b/doc/libavfilter.texi index 8745928d40..f0b448259a 100644 --- a/doc/libavfilter.texi +++ b/doc/libavfilter.texi @@ -2,11 +2,12 @@ @settitle Libavfilter Documentation @titlepage -@sp 7 @center @titlefont{Libavfilter Documentation} -@sp 3 @end titlepage +@top + +@contents @chapter Introduction diff --git a/doc/t2h.init b/doc/t2h.init new file mode 100644 index 0000000000..cd38a3ec9e --- /dev/null +++ b/doc/t2h.init @@ -0,0 +1,24 @@ +# no horiz rules between sections +$end_section = \&FFMPEG_end_section; +sub FFMPEG_end_section($$) +{ +} + +$print_page_foot = \&FFMPEG_print_page_foot; +sub FFMPEG_print_page_foot($$) +{ + my $fh = shift; + print $fh "$SMALL_RULE\n"; + T2H_DEFAULT_print_page_foot($fh); +} + +# no navigation elements +$SECTION_NAVIGATION = 0; +# the same for texi2html 5.0 +$HEADERS = 0; + +# TOC and Chapter headings link +$TOC_LINKS = 1; + +# print the TOC where @contents is used +$INLINE_CONTENTS = 1; From d461a4731781e492d83ef254f9c0fbd0ce6e47eb Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 29 Jan 2011 17:14:29 +0000 Subject: [PATCH 167/528] Rearrange MpegEncContext to simplify access from asm This moves the fields needed by asm near the top, before any structs or other members which complicate the offset calculation. Modifying other structs will no longer require updating the offsets, and the asm code is slightly simpler due to the smaller offsets. Signed-off-by: Mans Rullgard --- libavcodec/arm/asm-offsets.h | 21 ++++++--------------- libavcodec/arm/mpegvideo_neon.S | 13 +++++-------- libavcodec/mpegvideo.h | 29 +++++++++++++++++------------ 3 files changed, 28 insertions(+), 35 deletions(-) diff --git a/libavcodec/arm/asm-offsets.h b/libavcodec/arm/asm-offsets.h index 174b5aadcb..7f73534834 100644 --- a/libavcodec/arm/asm-offsets.h +++ b/libavcodec/arm/asm-offsets.h @@ -29,20 +29,11 @@ #endif /* MpegEncContext */ -#if defined(__ARM_EABI__) || defined(__eabi__) -#define Y_DC_SCALE 0xab4 -#define C_DC_SCALE 0xab8 -#define AC_PRED 0xae0 -#define BLOCK_LAST_INDEX 0x21c0 -#define INTER_SCANTAB_RASTER_END 0x23c0 -#define H263_AIC 0x2670 -#elif defined(__APPLE__) -#define Y_DC_SCALE 0xa70 -#define C_DC_SCALE 0xa74 -#define AC_PRED 0xa9c -#define BLOCK_LAST_INDEX 0x217c -#define INTER_SCANTAB_RASTER_END 0x237c -#define H263_AIC 0x2620 -#endif +#define Y_DC_SCALE 0xb4 +#define C_DC_SCALE 0xb8 +#define AC_PRED 0xbc +#define BLOCK_LAST_INDEX 0xc0 +#define H263_AIC 0xf0 +#define INTER_SCANTAB_RASTER_END 0x138 #endif diff --git a/libavcodec/arm/mpegvideo_neon.S b/libavcodec/arm/mpegvideo_neon.S index b25ead4941..b695fb7c22 100644 --- a/libavcodec/arm/mpegvideo_neon.S +++ b/libavcodec/arm/mpegvideo_neon.S @@ -22,10 +22,9 @@ #include "asm-offsets.h" function ff_dct_unquantize_h263_inter_neon, export=1 - add r0, r0, #0x2200 - add r12, r0, #BLOCK_LAST_INDEX-0x2200 + add r12, r0, #BLOCK_LAST_INDEX ldr r12, [r12, r2, lsl #2] - add r0, r0, #INTER_SCANTAB_RASTER_END-0x2200 + add r0, r0, #INTER_SCANTAB_RASTER_END ldrb r12, [r0, r12] sub r2, r3, #1 lsl r0, r3, #1 @@ -75,17 +74,15 @@ endfunc function ff_dct_unquantize_h263_intra_neon, export=1 push {r4-r6,lr} + add r12, r0, #BLOCK_LAST_INDEX ldr r6, [r0, #AC_PRED] - add r5, r0, #0x2700 + add lr, r0, #INTER_SCANTAB_RASTER_END cmp r6, #0 movne r12, #63 bne 1f - add lr, r0, #0x2200 - add r12, lr, #BLOCK_LAST_INDEX-0x2200 - add lr, lr, #INTER_SCANTAB_RASTER_END-0x2200 ldr r12, [r12, r2, lsl #2] ldrb r12, [lr, r12] -1: ldr r5, [r5, #H263_AIC-0x2700] +1: ldr r5, [r0, #H263_AIC] ldrsh r4, [r1] cmp r5, #0 mov r5, r1 diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 8cd20b7036..53ab0f4a7f 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -224,9 +224,6 @@ typedef struct MpegEncContext { int stream_codec_tag; ///< internal stream_codec_tag upper case converted from avctx stream_codec_tag /* the following fields are managed internally by the encoder */ - /** bit output */ - PutBitContext pb; - /* sequence parameters */ int context_initialized; int input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else @@ -247,6 +244,23 @@ typedef struct MpegEncContext { Picture **input_picture; ///< next pictures on display order for encoding Picture **reordered_input_picture; ///< pointer to the next pictures in codedorder for encoding + int y_dc_scale, c_dc_scale; + int ac_pred; + int block_last_index[12]; ///< last non zero coefficient in block + int h263_aic; ///< Advanded INTRA Coding (AIC) + + /* scantables */ + ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage + ScanTable intra_scantable; + ScanTable intra_h_scantable; + ScanTable intra_v_scantable; + + /* WARNING: changes above this line require updates to hardcoded + * offsets used in asm. */ + + /** bit output */ + PutBitContext pb; + int start_mb_y; ///< start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) int end_mb_y; ///< end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) struct MpegEncContext *thread_context[MAX_THREADS]; @@ -283,7 +297,6 @@ typedef struct MpegEncContext { int16_t *dc_val_base; int16_t *dc_val[3]; ///< used for mpeg4 DC prediction, all 3 arrays must be continuous int16_t dc_cache[4*5]; - int y_dc_scale, c_dc_scale; const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table const uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table const uint8_t *chroma_qscale_table; ///< qscale -> chroma_qscale (h263) @@ -291,7 +304,6 @@ typedef struct MpegEncContext { uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1) int16_t (*ac_val_base)[16]; int16_t (*ac_val[3])[16]; ///< used for for mpeg4 AC prediction, all 3 arrays must be continuous - int ac_pred; uint8_t *prev_pict_types; ///< previous picture types in bitstream order, used for mb skip #define PREV_PICT_TYPES_BUFFER_SIZE 256 int mb_skipped; ///< MUST BE SET only during DECODING @@ -434,12 +446,6 @@ typedef struct MpegEncContext { /** identical to the above but for MMX & these are not permutated, second 64 entries are bias*/ uint16_t (*q_intra_matrix16)[2][64]; uint16_t (*q_inter_matrix16)[2][64]; - int block_last_index[12]; ///< last non zero coefficient in block - /* scantables */ - ScanTable intra_scantable; - ScanTable intra_h_scantable; - ScanTable intra_v_scantable; - ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage /* noise reduction */ int (*dct_error_sum)[64]; @@ -495,7 +501,6 @@ typedef struct MpegEncContext { /* H.263+ specific */ int umvplus; ///< == H263+ && unrestricted_mv - int h263_aic; ///< Advanded INTRA Coding (AIC) int h263_aic_dir; ///< AIC direction: 0 = left, 1 = top int h263_slice_structured; int alt_inter_vlc; ///< alternative inter vlc From e0eb963aaa55ddcc54bf80f3261f6a436edca4a3 Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Sat, 29 Jan 2011 15:39:09 +0100 Subject: [PATCH 168/528] Fix memory leak in ALS decoder in big endian systems Signed-off-by: Mans Rullgard --- libavcodec/alsdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 3e415c0855..e5b734cedf 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1564,6 +1564,7 @@ static av_cold int decode_end(AVCodecContext *avctx) av_freep(&ctx->chan_data); av_freep(&ctx->chan_data_buffer); av_freep(&ctx->reverted_channels); + av_freep(&ctx->crc_buffer); return 0; } From 243f8241dbf4a451e1197661ccd387c519ae3349 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sat, 29 Jan 2011 18:45:32 +0000 Subject: [PATCH 169/528] Flush final frames in libfaac encoder. Gives decoded output identical in length to faac commandline encoder. Fixes Issue 670. Signed-off-by: Mans Rullgard --- libavcodec/libfaac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index 79ab729c13..af85587272 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -124,10 +124,11 @@ static int Faac_encode_frame(AVCodecContext *avctx, { FaacAudioContext *s = avctx->priv_data; int bytes_written; + int num_samples = data ? avctx->frame_size : 0; bytes_written = faacEncEncode(s->faac_handle, data, - avctx->frame_size * avctx->channels, + num_samples * avctx->channels, frame, buf_size); @@ -161,6 +162,7 @@ AVCodec ff_libfaac_encoder = { Faac_encode_init, Faac_encode_frame, Faac_encode_close, + .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"), .profiles = NULL_IF_CONFIG_SMALL(profiles), From dfd2a005eb29e4b9f2fdb97036eb7d5c38ae4bd4 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 29 Jan 2011 17:46:18 +0100 Subject: [PATCH 170/528] Replace dprintf with av_dlog dprintf clashes with POSIX.1-2008 --- libavcodec/alsdec.c | 36 ++++++++--------- libavcodec/dnxhddec.c | 10 ++--- libavcodec/dnxhdenc.c | 8 ++-- libavcodec/dvbsub_parser.c | 8 ++-- libavcodec/dvbsubdec.c | 16 ++++---- libavcodec/dvdsubdec.c | 16 ++++---- libavcodec/gifdec.c | 12 +++--- libavcodec/h261dec.c | 4 +- libavcodec/ituh263dec.c | 8 ++-- libavcodec/mjpegdec.c | 2 +- libavcodec/mpeg12.c | 40 +++++++++--------- libavcodec/mpeg12enc.c | 2 +- libavcodec/mpegaudiodec.c | 22 +++++----- libavcodec/mpegaudiodecheader.c | 12 +++--- libavcodec/mpegaudioenc.c | 2 +- libavcodec/pcm-mpeg.c | 6 +-- libavcodec/pgssubdec.c | 10 ++--- libavcodec/pngdec.c | 6 +-- libavcodec/rv10.c | 10 ++--- libavcodec/shorten.c | 2 +- libavcodec/vaapi.c | 2 +- libavcodec/vaapi_h264.c | 6 +-- libavcodec/vaapi_mpeg2.c | 4 +- libavcodec/vaapi_mpeg4.c | 4 +- libavcodec/vaapi_vc1.c | 4 +- libavcodec/wma.c | 8 ++-- libavcodec/wmaprodec.c | 32 +++++++-------- libavfilter/avfilter.c | 30 +++++++------- libavformat/asfdec.c | 14 +++---- libavformat/avidec.c | 4 +- libavformat/ffmdec.c | 2 +- libavformat/flvdec.c | 2 +- libavformat/http.c | 6 +-- libavformat/isom.c | 8 ++-- libavformat/mmsh.c | 12 +++--- libavformat/mmst.c | 20 ++++----- libavformat/mov.c | 72 ++++++++++++++++----------------- libavformat/mpegts.c | 30 +++++++------- libavformat/mxf.h | 2 +- libavformat/mxfdec.c | 24 +++++------ libavformat/r3d.c | 60 +++++++++++++-------------- libavformat/rtpdec.c | 4 +- libavformat/rtpenc.c | 6 +-- libavformat/rtsp.c | 10 ++--- libavformat/rtspdec.c | 4 +- libavutil/internal.h | 7 ---- libavutil/log.h | 11 +++++ 47 files changed, 312 insertions(+), 308 deletions(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index e5b734cedf..bfc589d26d 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -253,24 +253,24 @@ static av_cold void dprint_specific_config(ALSDecContext *ctx) AVCodecContext *avctx = ctx->avctx; ALSSpecificConfig *sconf = &ctx->sconf; - dprintf(avctx, "resolution = %i\n", sconf->resolution); - dprintf(avctx, "floating = %i\n", sconf->floating); - dprintf(avctx, "frame_length = %i\n", sconf->frame_length); - dprintf(avctx, "ra_distance = %i\n", sconf->ra_distance); - dprintf(avctx, "ra_flag = %i\n", sconf->ra_flag); - dprintf(avctx, "adapt_order = %i\n", sconf->adapt_order); - dprintf(avctx, "coef_table = %i\n", sconf->coef_table); - dprintf(avctx, "long_term_prediction = %i\n", sconf->long_term_prediction); - dprintf(avctx, "max_order = %i\n", sconf->max_order); - dprintf(avctx, "block_switching = %i\n", sconf->block_switching); - dprintf(avctx, "bgmc = %i\n", sconf->bgmc); - dprintf(avctx, "sb_part = %i\n", sconf->sb_part); - dprintf(avctx, "joint_stereo = %i\n", sconf->joint_stereo); - dprintf(avctx, "mc_coding = %i\n", sconf->mc_coding); - dprintf(avctx, "chan_config = %i\n", sconf->chan_config); - dprintf(avctx, "chan_sort = %i\n", sconf->chan_sort); - dprintf(avctx, "RLSLMS = %i\n", sconf->rlslms); - dprintf(avctx, "chan_config_info = %i\n", sconf->chan_config_info); + av_dlog(avctx, "resolution = %i\n", sconf->resolution); + av_dlog(avctx, "floating = %i\n", sconf->floating); + av_dlog(avctx, "frame_length = %i\n", sconf->frame_length); + av_dlog(avctx, "ra_distance = %i\n", sconf->ra_distance); + av_dlog(avctx, "ra_flag = %i\n", sconf->ra_flag); + av_dlog(avctx, "adapt_order = %i\n", sconf->adapt_order); + av_dlog(avctx, "coef_table = %i\n", sconf->coef_table); + av_dlog(avctx, "long_term_prediction = %i\n", sconf->long_term_prediction); + av_dlog(avctx, "max_order = %i\n", sconf->max_order); + av_dlog(avctx, "block_switching = %i\n", sconf->block_switching); + av_dlog(avctx, "bgmc = %i\n", sconf->bgmc); + av_dlog(avctx, "sb_part = %i\n", sconf->sb_part); + av_dlog(avctx, "joint_stereo = %i\n", sconf->joint_stereo); + av_dlog(avctx, "mc_coding = %i\n", sconf->mc_coding); + av_dlog(avctx, "chan_config = %i\n", sconf->chan_config); + av_dlog(avctx, "chan_sort = %i\n", sconf->chan_sort); + av_dlog(avctx, "RLSLMS = %i\n", sconf->rlslms); + av_dlog(avctx, "chan_config_info = %i\n", sconf->chan_config_info); #endif } diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index d977e88046..58893acaf9 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -107,7 +107,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si ctx->height = AV_RB16(buf + 0x18); ctx->width = AV_RB16(buf + 0x1a); - dprintf(ctx->avctx, "width %d, heigth %d\n", ctx->width, ctx->height); + av_dlog(ctx->avctx, "width %d, heigth %d\n", ctx->width, ctx->height); if (buf[0x21] & 0x40) { av_log(ctx->avctx, AV_LOG_ERROR, "10 bit per component\n"); @@ -115,7 +115,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si } ctx->cid = AV_RB32(buf + 0x28); - dprintf(ctx->avctx, "compression id %d\n", ctx->cid); + av_dlog(ctx->avctx, "compression id %d\n", ctx->cid); if (dnxhd_init_vlc(ctx, ctx->cid) < 0) return -1; @@ -128,7 +128,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si ctx->mb_width = ctx->width>>4; ctx->mb_height = buf[0x16d]; - dprintf(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height); + av_dlog(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height); if ((ctx->height+15)>>4 == ctx->mb_height && ctx->picture.interlaced_frame) ctx->height <<= 1; @@ -141,7 +141,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si for (i = 0; i < ctx->mb_height; i++) { ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2)); - dprintf(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]); + av_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]); if (buf_size < ctx->mb_scan_index[i] + 0x280) { av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n"); return -1; @@ -293,7 +293,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVFrame *picture = data; int first_field = 1; - dprintf(avctx, "frame size %d\n", buf_size); + av_dlog(avctx, "frame size %d\n", buf_size); decode_coding_unit: if (dnxhd_decode_header(ctx, buf, buf_size, first_field) < 0) diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 9f191e8703..d6f8bd3cad 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -552,7 +552,7 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx) if (bits > ctx->frame_bits) break; } - //dprintf(ctx->m.avctx, "lambda %d, up %u, down %u, bits %d, frame %d\n", + //av_dlog(ctx->m.avctx, "lambda %d, up %u, down %u, bits %d, frame %d\n", // lambda, last_higher, last_lower, bits, ctx->frame_bits); if (end) { if (bits > ctx->frame_bits) @@ -582,7 +582,7 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx) down_step = 1<m.avctx, "out lambda %d\n", lambda); + //av_dlog(ctx->m.avctx, "out lambda %d\n", lambda); ctx->lambda = lambda; return 0; } @@ -610,7 +610,7 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx) if (bits > ctx->frame_bits) break; } - //dprintf(ctx->m.avctx, "%d, qscale %d, bits %d, frame %d, higher %d, lower %d\n", + //av_dlog(ctx->m.avctx, "%d, qscale %d, bits %d, frame %d, higher %d, lower %d\n", // ctx->m.avctx->frame_number, qscale, bits, ctx->frame_bits, last_higher, last_lower); if (bits < ctx->frame_bits) { if (qscale == 1) @@ -640,7 +640,7 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx) return -1; } } - //dprintf(ctx->m.avctx, "out qscale %d\n", qscale); + //av_dlog(ctx->m.avctx, "out qscale %d\n", qscale); ctx->qscale = qscale; return 0; } diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c index e98e185381..6ecd44af13 100644 --- a/libavcodec/dvbsub_parser.c +++ b/libavcodec/dvbsub_parser.c @@ -55,7 +55,7 @@ static int dvbsub_parse(AVCodecParserContext *s, uint8_t *p, *p_end; int len, buf_pos = 0; - dprintf(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n", + av_dlog(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n", s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]); #ifdef DEBUG_PACKET_CONTENTS @@ -82,7 +82,7 @@ static int dvbsub_parse(AVCodecParserContext *s, { if (pc->packet_index != pc->packet_start) { - dprintf(avctx, "Discarding %d bytes\n", + av_dlog(avctx, "Discarding %d bytes\n", pc->packet_index - pc->packet_start); } @@ -90,7 +90,7 @@ static int dvbsub_parse(AVCodecParserContext *s, pc->packet_index = 0; if (buf_size < 2 || buf[0] != 0x20 || buf[1] != 0x00) { - dprintf(avctx, "Bad packet header\n"); + av_dlog(avctx, "Bad packet header\n"); return -1; } @@ -147,7 +147,7 @@ static int dvbsub_parse(AVCodecParserContext *s, } else if (*p == 0xff) { if (p + 1 < p_end) { - dprintf(avctx, "Junk at end of packet\n"); + av_dlog(avctx, "Junk at end of packet\n"); } pc->packet_index = p - pc->packet_buf; pc->in_packet = 0; diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index aff12c85f2..0f1e004689 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -749,7 +749,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; uint8_t *map_table; - dprintf(avctx, "DVB pixel block size %d, %s field:\n", buf_size, + av_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size, top_bottom ? "bottom" : "top"); #ifdef DEBUG_PACKET_CONTENTS @@ -984,7 +984,7 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx, YUV_TO_RGB1_CCIR(cb, cr); YUV_TO_RGB2_CCIR(r, g, b, y); - dprintf(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); + av_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); if (depth & 0x80) clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); @@ -1060,11 +1060,11 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx, region->bgcolor = (((*buf++) >> 2) & 3); } - dprintf(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height); + av_dlog(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height); if (fill) { memset(region->pbuf, region->bgcolor, region->buf_size); - dprintf(avctx, "Fill region (%d)\n", region->bgcolor); + av_dlog(avctx, "Fill region (%d)\n", region->bgcolor); } delete_region_display_list(ctx, region); @@ -1125,7 +1125,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx, ctx->time_out = *buf++; page_state = ((*buf++) >> 2) & 3; - dprintf(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state); + av_dlog(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state); if (page_state == 2) { delete_state(ctx); @@ -1163,7 +1163,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx, ctx->display_list = display; ctx->display_list_size++; - dprintf(avctx, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos); + av_dlog(avctx, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos); } while (tmp_display_list) { @@ -1461,7 +1461,7 @@ static int dvbsub_decode(AVCodecContext *avctx, *data_size = dvbsub_display_end_segment(avctx, p, segment_length, sub); break; default: - dprintf(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n", + av_dlog(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n", segment_type, page_id, segment_length); break; } @@ -1471,7 +1471,7 @@ static int dvbsub_decode(AVCodecContext *avctx, } if (p != p_end) { - dprintf(avctx, "Junk at end of packet\n"); + av_dlog(avctx, "Junk at end of packet\n"); return -1; } diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 8d08591ee4..bea2646dfe 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -190,7 +190,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, while (cmd_pos > 0 && cmd_pos < buf_size - 2 - offset_size) { date = AV_RB16(buf + cmd_pos); next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2); - dprintf(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n", + av_dlog(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n", cmd_pos, next_cmd_pos, date); pos = cmd_pos + 2 + offset_size; offset1 = -1; @@ -198,7 +198,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, x1 = y1 = x2 = y2 = 0; while (pos < buf_size) { cmd = buf[pos++]; - dprintf(NULL, "cmd=%02x\n", cmd); + av_dlog(NULL, "cmd=%02x\n", cmd); switch(cmd) { case 0x00: /* menu subpicture */ @@ -231,7 +231,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, alpha[1] = buf[pos + 1] >> 4; alpha[0] = buf[pos + 1] & 0x0f; pos += 2; - dprintf(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]); + av_dlog(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]); break; case 0x05: case 0x85: @@ -243,7 +243,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5]; if (cmd & 0x80) is_8bit = 1; - dprintf(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2); + av_dlog(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2); pos += 6; break; case 0x06: @@ -251,7 +251,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, goto fail; offset1 = AV_RB16(buf + pos); offset2 = AV_RB16(buf + pos + 2); - dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); + av_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); pos += 4; break; case 0x86: @@ -259,7 +259,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, goto fail; offset1 = AV_RB32(buf + pos); offset2 = AV_RB32(buf + pos + 4); - dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); + av_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); pos += 8; break; @@ -282,7 +282,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, case 0xff: goto the_end; default: - dprintf(NULL, "unrecognised subpicture command 0x%x\n", cmd); + av_dlog(NULL, "unrecognised subpicture command 0x%x\n", cmd); goto the_end; } } @@ -475,7 +475,7 @@ static int dvdsub_decode(AVCodecContext *avctx, goto no_subtitle; #if defined(DEBUG) - dprintf(NULL, "start=%d ms end =%d ms\n", + av_dlog(NULL, "start=%d ms end =%d ms\n", sub->start_display_time, sub->end_display_time); ppm_save("/tmp/a.ppm", sub->rects[0]->pict.data[0], diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index 5a5e5623f2..7be284cb14 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -77,7 +77,7 @@ static int gif_read_image(GifState *s) has_local_palette = flags & 0x80; bits_per_pixel = (flags & 0x07) + 1; - dprintf(s->avctx, "gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height); + av_dlog(s->avctx, "gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height); if (has_local_palette) { bytestream_get_buffer(&s->bytestream, s->local_palette, 3 * (1 << bits_per_pixel)); @@ -163,7 +163,7 @@ static int gif_read_extension(GifState *s) ext_code = bytestream_get_byte(&s->bytestream); ext_len = bytestream_get_byte(&s->bytestream); - dprintf(s->avctx, "gif: ext_code=0x%x len=%d\n", ext_code, ext_len); + av_dlog(s->avctx, "gif: ext_code=0x%x len=%d\n", ext_code, ext_len); switch(ext_code) { case 0xf9: @@ -179,7 +179,7 @@ static int gif_read_extension(GifState *s) s->transparent_color_index = -1; s->gce_disposal = (gce_flags >> 2) & 0x7; - dprintf(s->avctx, "gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n", + av_dlog(s->avctx, "gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n", gce_flags, s->gce_delay, s->transparent_color_index, s->gce_disposal); @@ -194,7 +194,7 @@ static int gif_read_extension(GifState *s) bytestream_get_byte(&s->bytestream); ext_len = bytestream_get_byte(&s->bytestream); - dprintf(s->avctx, "gif: ext_len1=%d\n", ext_len); + av_dlog(s->avctx, "gif: ext_len1=%d\n", ext_len); } return 0; } @@ -231,7 +231,7 @@ static int gif_read_header1(GifState *s) s->background_color_index = bytestream_get_byte(&s->bytestream); bytestream_get_byte(&s->bytestream); /* ignored */ - dprintf(s->avctx, "gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n", + av_dlog(s->avctx, "gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n", s->screen_width, s->screen_height, s->bits_per_pixel, has_global_palette); @@ -249,7 +249,7 @@ static int gif_parse_next_image(GifState *s) while (s->bytestream < s->bytestream_end) { int code = bytestream_get_byte(&s->bytestream); - dprintf(s->avctx, "gif: code=%02x '%c'\n", code, code); + av_dlog(s->avctx, "gif: code=%02x '%c'\n", code, code); switch (code) { case ',': diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 3cc10306f4..9f18199b04 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -553,8 +553,8 @@ static int h261_decode_frame(AVCodecContext *avctx, int ret; AVFrame *pict = data; - dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); - dprintf(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); + av_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); + av_dlog(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); s->flags= avctx->flags; s->flags2= avctx->flags2; diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 8b5d9391b2..728019accc 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -325,7 +325,7 @@ static int h263p_decode_umotion(MpegEncContext * s, int pred) code >>= 1; code = (sign) ? (pred - code) : (pred + code); - dprintf(s->avctx,"H.263+ UMV Motion = %d\n", code); + av_dlog(s->avctx,"H.263+ UMV Motion = %d\n", code); return code; } @@ -951,7 +951,7 @@ int h263_decode_picture_header(MpegEncContext *s) if (ufep == 1) { /* OPPTYPE */ format = get_bits(&s->gb, 3); - dprintf(s->avctx, "ufep=1, format: %d\n", format); + av_dlog(s->avctx, "ufep=1, format: %d\n", format); s->custom_pcf= get_bits1(&s->gb); s->umvplus = get_bits1(&s->gb); /* Unrestricted Motion Vector */ if (get_bits1(&s->gb) != 0) { @@ -1002,7 +1002,7 @@ int h263_decode_picture_header(MpegEncContext *s) if (format == 6) { /* Custom Picture Format (CPFMT) */ s->aspect_ratio_info = get_bits(&s->gb, 4); - dprintf(s->avctx, "aspect: %d\n", s->aspect_ratio_info); + av_dlog(s->avctx, "aspect: %d\n", s->aspect_ratio_info); /* aspect ratios: 0 - forbidden 1 - 1:1 @@ -1015,7 +1015,7 @@ int h263_decode_picture_header(MpegEncContext *s) width = (get_bits(&s->gb, 9) + 1) * 4; skip_bits1(&s->gb); height = get_bits(&s->gb, 9) * 4; - dprintf(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height); + av_dlog(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height); if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) { /* aspected dimensions */ s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8); diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 6c0dfeb7dd..fbc637aa30 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1255,7 +1255,7 @@ static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end) } val = -1; found: - dprintf(NULL, "find_marker skipped %d bytes\n", skipped); + av_dlog(NULL, "find_marker skipped %d bytes\n", skipped); *pbuf_ptr = buf_ptr; return val; } diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 0645cde512..3c73627eeb 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -213,7 +213,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int i, j, k, cbp, val, mb_type, motion_type; const int mb_block_count = 4 + (1<< s->chroma_format); - dprintf(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y); + av_dlog(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y); assert(s->mb_skipped==0); @@ -272,7 +272,7 @@ static int mpeg_decode_mb(MpegEncContext *s, mb_type = btype2mb_type[ mb_type ]; break; } - dprintf(s->avctx, "mb_type=%x\n", mb_type); + av_dlog(s->avctx, "mb_type=%x\n", mb_type); // motion_type = 0; /* avoid warning */ if (IS_INTRA(mb_type)) { s->dsp.clear_blocks(s->block[0]); @@ -370,7 +370,7 @@ static int mpeg_decode_mb(MpegEncContext *s, /* motion vectors */ s->mv_dir= (mb_type>>13)&3; - dprintf(s->avctx, "motion_type=%d\n", motion_type); + av_dlog(s->avctx, "motion_type=%d\n", motion_type); switch(motion_type) { case MT_FRAME: /* or MT_16X8 */ if (s->picture_structure == PICT_FRAME) { @@ -421,12 +421,12 @@ static int mpeg_decode_mb(MpegEncContext *s, s->last_mv[i][j][0]); s->last_mv[i][j][0] = val; s->mv[i][j][0] = val; - dprintf(s->avctx, "fmx=%d\n", val); + av_dlog(s->avctx, "fmx=%d\n", val); val = mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][j][1] >> 1); s->last_mv[i][j][1] = val << 1; s->mv[i][j][1] = val; - dprintf(s->avctx, "fmy=%d\n", val); + av_dlog(s->avctx, "fmy=%d\n", val); } } } @@ -632,7 +632,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s, dc += diff; s->last_dc[component] = dc; block[0] = dc*quant_matrix[0]; - dprintf(s->avctx, "dc=%d diff=%d\n", dc, diff); + av_dlog(s->avctx, "dc=%d diff=%d\n", dc, diff); i = 0; { OPEN_READER(re, &s->gb); @@ -1012,7 +1012,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, dc += diff; s->last_dc[component] = dc; block[0] = dc << (3 - s->intra_dc_precision); - dprintf(s->avctx, "dc=%d\n", block[0]); + av_dlog(s->avctx, "dc=%d\n", block[0]); mismatch = block[0] ^ 1; i = 0; if (s->intra_vlc_format) @@ -1386,7 +1386,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1) s1->frame_rate_ext.num = get_bits(&s->gb, 2)+1; s1->frame_rate_ext.den = get_bits(&s->gb, 5)+1; - dprintf(s->avctx, "sequence extension\n"); + av_dlog(s->avctx, "sequence extension\n"); s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG2VIDEO; s->avctx->sub_id = 2; /* indicates MPEG-2 found */ @@ -1477,7 +1477,7 @@ static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], uint16_t matrix1 static void mpeg_decode_quant_matrix_extension(MpegEncContext *s) { - dprintf(s->avctx, "matrix extension\n"); + av_dlog(s->avctx, "matrix extension\n"); if(get_bits1(&s->gb)) load_matrix(s, s->chroma_intra_matrix, s->intra_matrix, 1); if(get_bits1(&s->gb)) load_matrix(s, s->chroma_inter_matrix, s->inter_matrix, 0); @@ -1551,15 +1551,15 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1) } /* composite display not parsed */ - dprintf(s->avctx, "intra_dc_precision=%d\n", s->intra_dc_precision); - dprintf(s->avctx, "picture_structure=%d\n", s->picture_structure); - dprintf(s->avctx, "top field first=%d\n", s->top_field_first); - dprintf(s->avctx, "repeat first field=%d\n", s->repeat_first_field); - dprintf(s->avctx, "conceal=%d\n", s->concealment_motion_vectors); - dprintf(s->avctx, "intra_vlc_format=%d\n", s->intra_vlc_format); - dprintf(s->avctx, "alternate_scan=%d\n", s->alternate_scan); - dprintf(s->avctx, "frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct); - dprintf(s->avctx, "progressive_frame=%d\n", s->progressive_frame); + av_dlog(s->avctx, "intra_dc_precision=%d\n", s->intra_dc_precision); + av_dlog(s->avctx, "picture_structure=%d\n", s->picture_structure); + av_dlog(s->avctx, "top field first=%d\n", s->top_field_first); + av_dlog(s->avctx, "repeat first field=%d\n", s->repeat_first_field); + av_dlog(s->avctx, "conceal=%d\n", s->concealment_motion_vectors); + av_dlog(s->avctx, "intra_vlc_format=%d\n", s->intra_vlc_format); + av_dlog(s->avctx, "alternate_scan=%d\n", s->alternate_scan); + av_dlog(s->avctx, "frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct); + av_dlog(s->avctx, "progressive_frame=%d\n", s->progressive_frame); } static void exchange_uv(MpegEncContext *s){ @@ -2200,7 +2200,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, Mpeg1Context *s = avctx->priv_data; AVFrame *picture = data; MpegEncContext *s2 = &s->mpeg_enc_ctx; - dprintf(avctx, "fill_buffer\n"); + av_dlog(avctx, "fill_buffer\n"); if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) { /* special case for last picture */ @@ -2524,7 +2524,7 @@ static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx){ if( !(avctx->slice_flags & SLICE_FLAG_CODED_ORDER) ) return -1; if( !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD) ){ - dprintf(avctx, "mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n"); + av_dlog(avctx, "mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n"); } mpeg_decode_init(avctx); diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 877ec04251..b2526f6b7a 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -890,7 +890,7 @@ static void mpeg1_encode_block(MpegEncContext *s, next_coef: #if 0 if (level != 0) - dprintf(s->avctx, "level[%d]=%d\n", i, level); + av_dlog(s->avctx, "level[%d]=%d\n", i, level); #endif /* encode using VLC */ if (level != 0) { diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index c174c0f9ed..0cd0b688c1 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -352,7 +352,7 @@ static av_cold int decode_init(AVCodecContext * avctx) scale_factor_mult[i][0] = MULLx(norm, FIXR(1.0 * 2.0), FRAC_BITS); scale_factor_mult[i][1] = MULLx(norm, FIXR(0.7937005259 * 2.0), FRAC_BITS); scale_factor_mult[i][2] = MULLx(norm, FIXR(0.6299605249 * 2.0), FRAC_BITS); - dprintf(avctx, "%d: norm=%x s=%x %x %x\n", + av_dlog(avctx, "%d: norm=%x s=%x %x %x\n", i, norm, scale_factor_mult[i][0], scale_factor_mult[i][1], @@ -457,7 +457,7 @@ static av_cold int decode_init(AVCodecContext * avctx) k = i & 1; is_table_lsf[j][k ^ 1][i] = FIXR(f); is_table_lsf[j][k][i] = FIXR(1.0); - dprintf(avctx, "is_table_lsf %d %d: %x %x\n", + av_dlog(avctx, "is_table_lsf %d %d: %x %x\n", i, j, is_table_lsf[j][0][i], is_table_lsf[j][1][i]); } } @@ -986,7 +986,7 @@ static int mp_decode_layer2(MPADecodeContext *s) else bound = sblimit; - dprintf(s->avctx, "bound=%d sblimit=%d\n", bound, sblimit); + av_dlog(s->avctx, "bound=%d sblimit=%d\n", bound, sblimit); /* sanity check */ if( bound > sblimit ) bound = sblimit; @@ -1309,7 +1309,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, exponent= exponents[s_index]; - dprintf(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n", + av_dlog(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n", i, g->region_size[i] - j, x, y, exponent); if(y&16){ x = y >> 5; @@ -1377,7 +1377,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, last_pos= pos; code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1); - dprintf(s->avctx, "t=%d code=%d\n", g->count1table_select, code); + av_dlog(s->avctx, "t=%d code=%d\n", g->count1table_select, code); g->sb_hybrid[s_index+0]= g->sb_hybrid[s_index+1]= g->sb_hybrid[s_index+2]= @@ -1735,7 +1735,7 @@ static int mp_decode_layer3(MPADecodeContext *s) for(gr=0;grnb_channels;ch++) { - dprintf(s->avctx, "gr=%d ch=%d: side_info\n", gr, ch); + av_dlog(s->avctx, "gr=%d ch=%d: side_info\n", gr, ch); g = &s->granules[ch][gr]; g->part2_3_length = get_bits(&s->gb, 12); g->big_values = get_bits(&s->gb, 9); @@ -1776,7 +1776,7 @@ static int mp_decode_layer3(MPADecodeContext *s) /* compute huffman coded region sizes */ region_address1 = get_bits(&s->gb, 4); region_address2 = get_bits(&s->gb, 3); - dprintf(s->avctx, "region1=%d region2=%d\n", + av_dlog(s->avctx, "region1=%d region2=%d\n", region_address1, region_address2); ff_init_long_region(s, g, region_address1, region_address2); } @@ -1788,7 +1788,7 @@ static int mp_decode_layer3(MPADecodeContext *s) g->preflag = get_bits1(&s->gb); g->scalefac_scale = get_bits1(&s->gb); g->count1table_select = get_bits1(&s->gb); - dprintf(s->avctx, "block_type=%d switch_point=%d\n", + av_dlog(s->avctx, "block_type=%d switch_point=%d\n", g->block_type, g->switch_point); } } @@ -1797,7 +1797,7 @@ static int mp_decode_layer3(MPADecodeContext *s) const uint8_t *ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3); assert((get_bits_count(&s->gb) & 7) == 0); /* now we get bits from the main_data_begin offset */ - dprintf(s->avctx, "seekback: %d\n", main_data_begin); + av_dlog(s->avctx, "seekback: %d\n", main_data_begin); //av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size); memcpy(s->last_buf + s->last_buf_size, ptr, EXTRABYTES); @@ -1831,7 +1831,7 @@ static int mp_decode_layer3(MPADecodeContext *s) /* MPEG1 scale factors */ slen1 = slen_table[0][g->scalefac_compress]; slen2 = slen_table[1][g->scalefac_compress]; - dprintf(s->avctx, "slen1=%d slen2=%d\n", slen1, slen2); + av_dlog(s->avctx, "slen1=%d slen2=%d\n", slen1, slen2); if (g->block_type == 2) { n = g->switch_point ? 17 : 18; j = 0; @@ -1964,7 +1964,7 @@ static int mp_decode_frame(MPADecodeContext *s, if (s->error_protection) skip_bits(&s->gb, 16); - dprintf(s->avctx, "frame %d:\n", s->frame_count); + av_dlog(s->avctx, "frame %d:\n", s->frame_count); switch(s->layer) { case 1: s->avctx->frame_size = 384; diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c index 67f882f566..0821dd43c1 100644 --- a/libavcodec/mpegaudiodecheader.c +++ b/libavcodec/mpegaudiodecheader.c @@ -91,20 +91,20 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) } #if defined(DEBUG) - dprintf(NULL, "layer%d, %d Hz, %d kbits/s, ", + av_dlog(NULL, "layer%d, %d Hz, %d kbits/s, ", s->layer, s->sample_rate, s->bit_rate); if (s->nb_channels == 2) { if (s->layer == 3) { if (s->mode_ext & MODE_EXT_MS_STEREO) - dprintf(NULL, "ms-"); + av_dlog(NULL, "ms-"); if (s->mode_ext & MODE_EXT_I_STEREO) - dprintf(NULL, "i-"); + av_dlog(NULL, "i-"); } - dprintf(NULL, "stereo"); + av_dlog(NULL, "stereo"); } else { - dprintf(NULL, "mono"); + av_dlog(NULL, "mono"); } - dprintf(NULL, "\n"); + av_dlog(NULL, "\n"); #endif return 0; } diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 9458af5b37..eef40d0fa1 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -122,7 +122,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) s->sblimit = ff_mpa_sblimit_table[table]; s->alloc_table = ff_mpa_alloc_tables[table]; - dprintf(avctx, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", + av_dlog(avctx, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", bitrate, freq, s->frame_size, table, s->frame_frac_incr); for(i=0;inb_channels;i++) diff --git a/libavcodec/pcm-mpeg.c b/libavcodec/pcm-mpeg.c index 65ba4903b8..189b2b5691 100644 --- a/libavcodec/pcm-mpeg.c +++ b/libavcodec/pcm-mpeg.c @@ -64,7 +64,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx, uint8_t channel_layout = header[2] >> 4; if (avctx->debug & FF_DEBUG_PICT_INFO) - dprintf(avctx, "pcm_bluray_parse_header: header = %02x%02x%02x%02x\n", + av_dlog(avctx, "pcm_bluray_parse_header: header = %02x%02x%02x%02x\n", header[0], header[1], header[2], header[3]); /* get the sample depth and derive the sample format from it */ @@ -112,7 +112,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx, avctx->bits_per_coded_sample; if (avctx->debug & FF_DEBUG_PICT_INFO) - dprintf(avctx, + av_dlog(avctx, "pcm_bluray_parse_header: %d channels, %d bits per sample, %d kHz, %d kbit\n", avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate, avctx->bit_rate); @@ -291,7 +291,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, retval = src - avpkt->data; if (avctx->debug & FF_DEBUG_BITSTREAM) - dprintf(avctx, "pcm_bluray_decode_frame: decoded %d -> %d bytes\n", + av_dlog(avctx, "pcm_bluray_decode_frame: decoded %d -> %d bytes\n", retval, *data_size); return retval; } diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 4e02dea167..1ed475787f 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -141,7 +141,7 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub, return -1; } - dprintf(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[0]->w * sub->rects[0]->h); + av_dlog(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[0]->w * sub->rects[0]->h); return 0; } @@ -253,7 +253,7 @@ static void parse_palette_segment(AVCodecContext *avctx, YUV_TO_RGB1(cb, cr); YUV_TO_RGB2(r, g, b, y); - dprintf(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha); + av_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha); /* Store color in palette */ ctx->clut[color_id] = RGBA(r,g,b,alpha); @@ -282,7 +282,7 @@ static void parse_presentation_segment(AVCodecContext *avctx, int w = bytestream_get_be16(&buf); int h = bytestream_get_be16(&buf); - dprintf(avctx, "Video Dimensions %dx%d\n", + av_dlog(avctx, "Video Dimensions %dx%d\n", w, h); if (av_image_check_size(w, h, 0, avctx) >= 0) avcodec_set_dimensions(avctx, w, h); @@ -317,7 +317,7 @@ static void parse_presentation_segment(AVCodecContext *avctx, /* TODO If cropping, cropping_x, cropping_y, cropping_width, cropping_height (all 2 bytes).*/ - dprintf(avctx, "Subtitle Placement x=%d, y=%d\n", x, y); + av_dlog(avctx, "Subtitle Placement x=%d, y=%d\n", x, y); 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", @@ -433,7 +433,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, segment_type = bytestream_get_byte(&buf); segment_length = bytestream_get_be16(&buf); - dprintf(avctx, "Segment Length %d, Segment Type %x\n", segment_length, segment_type); + av_dlog(avctx, "Segment Length %d, Segment Type %x\n", segment_length, segment_type); if (segment_type != DISPLAY_SEGMENT && segment_length > buf_end - buf) break; diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 03cd784bbf..4bc5c3705a 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -431,7 +431,7 @@ static int decode_frame(AVCodecContext *avctx, goto fail; tag32 = bytestream_get_be32(&s->bytestream); tag = av_bswap32(tag32); - dprintf(avctx, "png: tag=%c%c%c%c length=%u\n", + av_dlog(avctx, "png: tag=%c%c%c%c length=%u\n", (tag & 0xff), ((tag >> 8) & 0xff), ((tag >> 16) & 0xff), @@ -453,7 +453,7 @@ static int decode_frame(AVCodecContext *avctx, s->interlace_type = *s->bytestream++; crc = bytestream_get_be32(&s->bytestream); s->state |= PNG_IHDR; - dprintf(avctx, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n", + av_dlog(avctx, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n", s->width, s->height, s->bit_depth, s->color_type, s->compression_type, s->filter_type, s->interlace_type); break; @@ -517,7 +517,7 @@ static int decode_frame(AVCodecContext *avctx, s->width); s->crow_size = s->pass_row_size + 1; } - dprintf(avctx, "row_size=%d crow_size =%d\n", + av_dlog(avctx, "row_size=%d crow_size =%d\n", s->row_size, s->crow_size); s->image_buf = p->data[0]; s->image_linesize = p->linesize[0]; diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index cb304fb01c..f47540d8f1 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -246,7 +246,7 @@ static int rv10_decode_picture_header(MpegEncContext *s) if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n"); pb_frame = get_bits1(&s->gb); - dprintf(s->avctx, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame); + av_dlog(s->avctx, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame); if (pb_frame){ av_log(s->avctx, AV_LOG_ERROR, "pb frame not supported\n"); @@ -265,7 +265,7 @@ static int rv10_decode_picture_header(MpegEncContext *s) s->last_dc[0] = get_bits(&s->gb, 8); s->last_dc[1] = get_bits(&s->gb, 8); s->last_dc[2] = get_bits(&s->gb, 8); - dprintf(s->avctx, "DC:%d %d %d\n", s->last_dc[0], + av_dlog(s->avctx, "DC:%d %d %d\n", s->last_dc[0], s->last_dc[1], s->last_dc[2]); } } @@ -561,7 +561,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, ff_er_frame_start(s); } - dprintf(avctx, "qscale=%d\n", s->qscale); + av_dlog(avctx, "qscale=%d\n", s->qscale); /* default quantization values */ if(s->codec_id== CODEC_ID_RV10){ @@ -600,7 +600,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, for(s->mb_num_left= mb_count; s->mb_num_left>0; s->mb_num_left--) { int ret; ff_update_block_index(s); - dprintf(avctx, "**mb x=%d y=%d\n", s->mb_x, s->mb_y); + av_dlog(avctx, "**mb x=%d y=%d\n", s->mb_x, s->mb_y); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; @@ -655,7 +655,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, int slice_count; const uint8_t *slices_hdr = NULL; - dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); + av_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); /* no supplementary picture */ if (buf_size == 0) { diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index cff4cc886f..f50da4e87f 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -305,7 +305,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, s->bitstream_size= buf_size; if(buf_size < s->max_framesize){ - //dprintf(avctx, "wanna more data ... %d\n", buf_size); + //av_dlog(avctx, "wanna more data ... %d\n", buf_size); *data_size = 0; return input_buf_size; } diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c index 10f9054278..de028a0a7e 100644 --- a/libavcodec/vaapi.c +++ b/libavcodec/vaapi.c @@ -180,7 +180,7 @@ int ff_vaapi_common_end_frame(MpegEncContext *s) struct vaapi_context * const vactx = s->avctx->hwaccel_context; int ret = -1; - dprintf(s->avctx, "ff_vaapi_common_end_frame()\n"); + av_dlog(s->avctx, "ff_vaapi_common_end_frame()\n"); if (commit_slices(vactx) < 0) goto done; diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c index 229c0f9b24..cbe526b6e7 100644 --- a/libavcodec/vaapi_h264.c +++ b/libavcodec/vaapi_h264.c @@ -227,7 +227,7 @@ static int start_frame(AVCodecContext *avctx, VAPictureParameterBufferH264 *pic_param; VAIQMatrixBufferH264 *iq_matrix; - dprintf(avctx, "start_frame()\n"); + av_dlog(avctx, "start_frame()\n"); vactx->slice_param_size = sizeof(VASliceParameterBufferH264); @@ -289,7 +289,7 @@ static int end_frame(AVCodecContext *avctx) { H264Context * const h = avctx->priv_data; - dprintf(avctx, "end_frame()\n"); + av_dlog(avctx, "end_frame()\n"); return ff_vaapi_common_end_frame(&h->s); } @@ -302,7 +302,7 @@ static int decode_slice(AVCodecContext *avctx, MpegEncContext * const s = &h->s; VASliceParameterBufferH264 *slice_param; - dprintf(avctx, "decode_slice(): buffer %p, size %d\n", buffer, size); + av_dlog(avctx, "decode_slice(): buffer %p, size %d\n", buffer, size); /* Fill in VASliceParameterBufferH264. */ slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size); diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c index f56873c104..17d82b723f 100644 --- a/libavcodec/vaapi_mpeg2.c +++ b/libavcodec/vaapi_mpeg2.c @@ -44,7 +44,7 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_ VAIQMatrixBufferMPEG2 *iq_matrix; int i; - dprintf(avctx, "vaapi_mpeg2_start_frame()\n"); + av_dlog(avctx, "vaapi_mpeg2_start_frame()\n"); vactx->slice_param_size = sizeof(VASliceParameterBufferMPEG2); @@ -111,7 +111,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer GetBitContext gb; uint32_t start_code, quantiser_scale_code, intra_slice_flag, macroblock_offset; - dprintf(avctx, "vaapi_mpeg2_decode_slice(): buffer %p, size %d\n", buffer, size); + av_dlog(avctx, "vaapi_mpeg2_decode_slice(): buffer %p, size %d\n", buffer, size); /* Determine macroblock_offset */ init_get_bits(&gb, buffer, 8 * size); diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index 72822c370e..78e0d646cb 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -47,7 +47,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ VAIQMatrixBufferMPEG4 *iq_matrix; int i; - dprintf(avctx, "vaapi_mpeg4_start_frame()\n"); + av_dlog(avctx, "vaapi_mpeg4_start_frame()\n"); vactx->slice_param_size = sizeof(VASliceParameterBufferMPEG4); @@ -125,7 +125,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer MpegEncContext * const s = avctx->priv_data; VASliceParameterBufferMPEG4 *slice_param; - dprintf(avctx, "vaapi_mpeg4_decode_slice(): buffer %p, size %d\n", buffer, size); + av_dlog(avctx, "vaapi_mpeg4_decode_slice(): buffer %p, size %d\n", buffer, size); /* video_plane_with_short_video_header() contains all GOBs * in-order, and this is what VA API (Intel backend) expects: only diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index d7bae009dc..c61a5bd862 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -138,7 +138,7 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t struct vaapi_context * const vactx = avctx->hwaccel_context; VAPictureParameterBufferVC1 *pic_param; - dprintf(avctx, "vaapi_vc1_start_frame()\n"); + av_dlog(avctx, "vaapi_vc1_start_frame()\n"); vactx->slice_param_size = sizeof(VASliceParameterBufferVC1); @@ -308,7 +308,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, MpegEncContext * const s = &v->s; VASliceParameterBufferVC1 *slice_param; - dprintf(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size); + av_dlog(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size); /* Current bit buffer is beyond any marker for VC-1, so skip it */ if (avctx->codec_id == CODEC_ID_VC1 && IS_MARKER(AV_RB32(buffer))) { diff --git a/libavcodec/wma.c b/libavcodec/wma.c index e2d153b835..e0b9b68395 100644 --- a/libavcodec/wma.c +++ b/libavcodec/wma.c @@ -217,13 +217,13 @@ int ff_wma_init(AVCodecContext *avctx, int flags2) high_freq = high_freq * 0.5; } } - dprintf(s->avctx, "flags2=0x%x\n", flags2); - dprintf(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n", + av_dlog(s->avctx, "flags2=0x%x\n", flags2); + av_dlog(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n", s->version, s->nb_channels, s->sample_rate, s->bit_rate, s->block_align); - dprintf(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n", + av_dlog(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n", bps, bps1, high_freq, s->byte_offset_bits); - dprintf(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n", + av_dlog(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n", s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes); /* compute the scale factor band sizes for each MDCT block size */ diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index e7799846bb..bb1cd31146 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -288,8 +288,8 @@ static av_cold int decode_init(AVCodecContext *avctx) s->bits_per_sample = AV_RL16(edata_ptr); /** dump the extradata */ for (i = 0; i < avctx->extradata_size; i++) - dprintf(avctx, "[%x] ", avctx->extradata[i]); - dprintf(avctx, "\n"); + av_dlog(avctx, "[%x] ", avctx->extradata[i]); + av_dlog(avctx, "\n"); } else { av_log_ask_for_sample(avctx, "Unknown extradata size\n"); @@ -582,7 +582,7 @@ static int decode_tilehdr(WMAProDecodeCtx *s) int i; int offset = 0; for (i = 0; i < s->channel[c].num_subframes; i++) { - dprintf(s->avctx, "frame[%i] channel[%i] subframe[%i]" + av_dlog(s->avctx, "frame[%i] channel[%i] subframe[%i]" " len %i\n", s->frame_num, c, i, s->channel[c].subframe_len[i]); s->channel[c].subframe_offset[i] = offset; @@ -781,7 +781,7 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c) const uint16_t* run; const float* level; - dprintf(s->avctx, "decode coefficients for channel %i\n", c); + av_dlog(s->avctx, "decode coefficients for channel %i\n", c); vlctable = get_bits1(&s->gb); vlc = &coef_vlc[vlctable]; @@ -1066,7 +1066,7 @@ static int decode_subframe(WMAProDecodeCtx *s) } } - dprintf(s->avctx, + av_dlog(s->avctx, "processing subframe with offset %i len %i\n", offset, subframe_len); /** get a list of all channels that contain the estimated block */ @@ -1093,7 +1093,7 @@ static int decode_subframe(WMAProDecodeCtx *s) s->parsed_all_subframes = 1; - dprintf(s->avctx, "subframe is part of %i channels\n", + av_dlog(s->avctx, "subframe is part of %i channels\n", s->channels_for_cur_subframe); /** calculate number of scale factor bands and their offsets */ @@ -1204,7 +1204,7 @@ static int decode_subframe(WMAProDecodeCtx *s) return AVERROR_INVALIDDATA; } - dprintf(s->avctx, "BITSTREAM: subframe header length was %i\n", + av_dlog(s->avctx, "BITSTREAM: subframe header length was %i\n", get_bits_count(&s->gb) - s->subframe_offset); /** parse coefficients */ @@ -1218,7 +1218,7 @@ static int decode_subframe(WMAProDecodeCtx *s) sizeof(*s->channel[c].coeffs) * subframe_len); } - dprintf(s->avctx, "BITSTREAM: subframe length was %i\n", + av_dlog(s->avctx, "BITSTREAM: subframe length was %i\n", get_bits_count(&s->gb) - s->subframe_offset); if (transmit_coeffs) { @@ -1294,7 +1294,7 @@ static int decode_frame(WMAProDecodeCtx *s) if (s->len_prefix) len = get_bits(gb, s->log2_frame_size); - dprintf(s->avctx, "decoding frame with length %x\n", len); + av_dlog(s->avctx, "decoding frame with length %x\n", len); /** decode tile information */ if (decode_tilehdr(s)) { @@ -1313,7 +1313,7 @@ static int decode_frame(WMAProDecodeCtx *s) /** read drc info */ if (s->dynamic_range_compression) { s->drc_gain = get_bits(gb, 8); - dprintf(s->avctx, "drc_gain %i\n", s->drc_gain); + av_dlog(s->avctx, "drc_gain %i\n", s->drc_gain); } /** no idea what these are for, might be the number of samples @@ -1324,18 +1324,18 @@ static int decode_frame(WMAProDecodeCtx *s) /** usually true for the first frame */ if (get_bits1(gb)) { skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); - dprintf(s->avctx, "start skip: %i\n", skip); + av_dlog(s->avctx, "start skip: %i\n", skip); } /** sometimes true for the last frame */ if (get_bits1(gb)) { skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); - dprintf(s->avctx, "end skip: %i\n", skip); + av_dlog(s->avctx, "end skip: %i\n", skip); } } - dprintf(s->avctx, "BITSTREAM: frame header length was %i\n", + av_dlog(s->avctx, "BITSTREAM: frame header length was %i\n", get_bits_count(gb) - s->frame_offset); /** reset subframe states */ @@ -1505,7 +1505,7 @@ static int decode_packet(AVCodecContext *avctx, /** get number of bits that need to be added to the previous frame */ num_bits_prev_frame = get_bits(gb, s->log2_frame_size); - dprintf(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number, + av_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number, num_bits_prev_frame); /** check for packet loss */ @@ -1527,14 +1527,14 @@ static int decode_packet(AVCodecContext *avctx, /** append the previous frame data to the remaining data from the previous packet to create a full frame */ save_bits(s, gb, num_bits_prev_frame, 1); - dprintf(avctx, "accumulated %x bits of frame data\n", + av_dlog(avctx, "accumulated %x bits of frame data\n", s->num_saved_bits - s->frame_offset); /** decode the cross packet frame if it is valid */ if (!s->packet_loss) decode_frame(s); } else if (s->num_saved_bits - s->frame_offset) { - dprintf(avctx, "ignoring %x previously saved bits\n", + av_dlog(avctx, "ignoring %x previously saved bits\n", s->num_saved_bits - s->frame_offset); } diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 3d8d08ac37..6581af56af 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -217,24 +217,24 @@ static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) return buf; } -static void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) +static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) { av_unused char buf[16]; - dprintf(ctx, + av_dlog(ctx, "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", + av_dlog(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", + av_dlog(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d", ref->audio->channel_layout, ref->audio->nb_samples, ref->audio->size, @@ -242,13 +242,13 @@ static void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) ref->audio->planar); } - dprintf(ctx, "]%s", end ? "\n" : ""); + av_dlog(ctx, "]%s", end ? "\n" : ""); } -static void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) +static void ff_dlog_link(void *ctx, AVFilterLink *link, int end) { if (link->type == AVMEDIA_TYPE_VIDEO) { - dprintf(ctx, + av_dlog(ctx, "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", link, link->w, link->h, av_pix_fmt_descriptors[link->format].name, @@ -259,7 +259,7 @@ static void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) char buf[128]; av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout); - dprintf(ctx, + av_dlog(ctx, "link[%p r:%"PRId64" cl:%s fmt:%-16s %-16s->%-16s]%s", link, link->sample_rate, buf, av_get_sample_fmt_name(link->format), @@ -269,15 +269,15 @@ static void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) } } -#define FF_DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func) +#define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func) AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBufferRef *ret = NULL; 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); + FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); + av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); if (link->dstpad->get_video_buffer) ret = link->dstpad->get_video_buffer(link, perms, w, h); @@ -288,7 +288,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int 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); + FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1); return ret; } @@ -353,7 +353,7 @@ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, int avfilter_request_frame(AVFilterLink *link) { - FF_DPRINTF_START(NULL, request_frame); ff_dprintf_link(NULL, link, 1); + FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1); if (link->srcpad->request_frame) return link->srcpad->request_frame(link); @@ -388,7 +388,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) AVFilterPad *dst = link->dstpad; int perms = picref->perms; - FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_ref(NULL, picref, 1); + FF_DPRINTF_START(NULL, start_frame); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " "); ff_dlog_ref(NULL, picref, 1); if (!(start_frame = dst->start_frame)) start_frame = avfilter_default_start_frame; @@ -435,7 +435,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) int i, j, vsub; void (*draw_slice)(AVFilterLink *, int, int, int); - 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); + FF_DPRINTF_START(NULL, draw_slice); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir); /* copy the slice if needed for permission reasons */ if (link->src_buf) { diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index eafb71d956..35e892c439 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -57,7 +57,7 @@ int ff_guidcmp(const void *g1, const void *g2) #ifdef DEBUG #define PRINT_IF_GUID(g,cmp) \ if (!ff_guidcmp(g, &cmp)) \ - dprintf(NULL, "(GUID: %s) ", #cmp) + av_dlog(NULL, "(GUID: %s) ", #cmp) static void print_guid(const ff_asf_guid *g) { @@ -87,10 +87,10 @@ static void print_guid(const ff_asf_guid *g) else PRINT_IF_GUID(g, stream_bitrate_guid); else PRINT_IF_GUID(g, ff_asf_language_guid); else - dprintf(NULL, "(GUID: unknown) "); + av_dlog(NULL, "(GUID: unknown) "); for(i=0;i<16;i++) - dprintf(NULL, " 0x%02x,", (*g)[i]); - dprintf(NULL, "}\n"); + av_dlog(NULL, " 0x%02x,", (*g)[i]); + av_dlog(NULL, "}\n"); } #undef PRINT_IF_GUID #else @@ -177,9 +177,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) int ret; ff_get_guid(pb, &g); gsize = get_le64(pb); - dprintf(s, "%08"PRIx64": ", gpos); + av_dlog(s, "%08"PRIx64": ", gpos); print_guid(&g); - dprintf(s, " size=0x%"PRIx64"\n", gsize); + av_dlog(s, " size=0x%"PRIx64"\n", gsize); if (!ff_guidcmp(&g, &ff_asf_data_header)) { asf->data_object_offset = url_ftell(pb); // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. @@ -704,7 +704,7 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb) if (packet_length < asf->hdr.min_pktsize) padsize += asf->hdr.min_pktsize - packet_length; asf->packet_padsize = padsize; - dprintf(s, "packet: size=%d padsize=%d left=%d\n", s->packet_size, asf->packet_padsize, asf->packet_size_left); + av_dlog(s, "packet: size=%d padsize=%d left=%d\n", s->packet_size, asf->packet_padsize, asf->packet_size_left); return 0; } diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 312bf76b76..d8d4726ae9 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -85,7 +85,7 @@ static int avi_load_index(AVFormatContext *s); static int guess_ni_flag(AVFormatContext *s); #define print_tag(str, tag, size) \ - dprintf(NULL, "%s: tag=%c%c%c%c size=0x%x\n", \ + av_dlog(NULL, "%s: tag=%c%c%c%c size=0x%x\n", \ str, tag & 0xff, \ (tag >> 8) & 0xff, \ (tag >> 16) & 0xff, \ @@ -380,7 +380,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) avi->movi_list = url_ftell(pb) - 4; if(size) avi->movi_end = avi->movi_list + size + (size & 1); else avi->movi_end = url_fsize(pb); - dprintf(NULL, "movi end=%"PRIx64"\n", avi->movi_end); + av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); goto end_of_header; } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index b2fc0cd8b1..91da6504b6 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -408,7 +408,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) if ((ret = ffm_is_avail_data(s, FRAME_HEADER_SIZE+4)) < 0) return ret; - dprintf(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n", + av_dlog(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n", url_ftell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size); if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) != FRAME_HEADER_SIZE) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index e442caca64..e6081d9840 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -424,7 +424,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) st->codec->sample_rate = cfg.ext_sample_rate; else st->codec->sample_rate = cfg.sample_rate; - dprintf(s, "mp4a config channels %d sample rate %d\n", + av_dlog(s, "mp4a config channels %d sample rate %d\n", st->codec->channels, st->codec->sample_rate); } diff --git a/libavformat/http.c b/libavformat/http.c index 3d63a6d00c..b3499d143a 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -225,7 +225,7 @@ static int process_line(URLContext *h, char *line, int line_count, p++; s->http_code = strtol(p, &end, 10); - dprintf(NULL, "http_code=%d\n", s->http_code); + av_dlog(NULL, "http_code=%d\n", s->http_code); /* error codes are 4xx and 5xx, but regard 401 as a success, so we * don't abort until all headers have been parsed. */ @@ -356,7 +356,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr, if (http_get_line(s, line, sizeof(line)) < 0) return AVERROR(EIO); - dprintf(NULL, "header='%s'\n", line); + av_dlog(NULL, "header='%s'\n", line); err = process_line(h, line, s->line_count, new_location); if (err < 0) @@ -387,7 +387,7 @@ static int http_read(URLContext *h, uint8_t *buf, int size) s->chunksize = strtoll(line, NULL, 16); - dprintf(NULL, "Chunked encoding data size: %"PRId64"'\n", s->chunksize); + av_dlog(NULL, "Chunked encoding data size: %"PRId64"'\n", s->chunksize); if (!s->chunksize) return 0; diff --git a/libavformat/isom.c b/libavformat/isom.c index bf0140103a..23ef82a1ce 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -350,7 +350,7 @@ int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag) int len; *tag = get_byte(pb); len = ff_mp4_read_descr_len(pb); - dprintf(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len); + av_dlog(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len); return len; } @@ -373,10 +373,10 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContex get_be32(pb); /* avg bitrate */ st->codec->codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id); - dprintf(fc, "esds object type id 0x%02x\n", object_type_id); + av_dlog(fc, "esds object type id 0x%02x\n", object_type_id); len = ff_mp4_read_descr(fc, pb, &tag); if (tag == MP4DecSpecificDescrTag) { - dprintf(fc, "Specific MPEG4 header len=%d\n", len); + av_dlog(fc, "Specific MPEG4 header len=%d\n", len); if((uint64_t)len > (1<<30)) return -1; av_free(st->codec->extradata); @@ -396,7 +396,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContex st->codec->sample_rate = cfg.ext_sample_rate; else st->codec->sample_rate = cfg.sample_rate; - dprintf(fc, "mp4a config channels %d obj %d ext obj %d " + av_dlog(fc, "mp4a config channels %d obj %d ext obj %d " "sample rate %d ext sample rate %d\n", st->codec->channels, cfg.object_type, cfg.ext_object_type, cfg.sample_rate, cfg.ext_sample_rate); diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c index b0acd1020f..257b973225 100644 --- a/libavformat/mmsh.c +++ b/libavformat/mmsh.c @@ -122,7 +122,7 @@ static int read_data_packet(MMSHContext *mmsh, const int len) return AVERROR(EIO); } res = url_read_complete(mms->mms_hd, mms->in_buffer, len); - dprintf(NULL, "Data packet len = %d\n", len); + av_dlog(NULL, "Data packet len = %d\n", len); if (res != len) { av_log(NULL, AV_LOG_ERROR, "Read data packet failed!\n"); return AVERROR(EIO); @@ -156,7 +156,7 @@ static int get_http_header_data(MMSHContext *mmsh) 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", + av_dlog(NULL, "Header len changed from %d to %d\n", mms->asf_header_size, len); av_freep(&mms->asf_header); } @@ -201,7 +201,7 @@ static int get_http_header_data(MMSHContext *mmsh) 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); + av_dlog(NULL, "Skip chunk type %d \n", chunk_type); continue; } } @@ -290,7 +290,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags) av_log(NULL, AV_LOG_ERROR, "Build play request failed!\n"); goto fail; } - dprintf(NULL, "out_buffer is %s", headers); + av_dlog(NULL, "out_buffer is %s", headers); ff_http_set_headers(mms->mms_hd, headers); err = url_connect(mms->mms_hd); @@ -304,12 +304,12 @@ static int mmsh_open(URLContext *h, const char *uri, int flags) goto fail; } - dprintf(NULL, "Connection successfully open\n"); + av_dlog(NULL, "Connection successfully open\n"); return 0; fail: av_freep(&stream_selection); mmsh_close(h); - dprintf(NULL, "Connection failed with error %d\n", err); + av_dlog(NULL, "Connection failed with error %d\n", err); return err; } diff --git a/libavformat/mmst.c b/libavformat/mmst.c index d3417d1659..8464d3b3d1 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -206,11 +206,11 @@ static int send_media_file_request(MMSTContext *mmst) static void handle_packet_stream_changing_type(MMSTContext *mmst) { MMSContext *mms = &mmst->mms; - dprintf(NULL, "Stream changing!\n"); + av_dlog(NULL, "Stream changing!\n"); // 40 is the packet header size, 7 is the prefix size. mmst->header_packet_id= AV_RL32(mms->in_buffer + 40 + 7); - dprintf(NULL, "Changed header prefix to 0x%x", mmst->header_packet_id); + av_dlog(NULL, "Changed header prefix to 0x%x", mmst->header_packet_id); } static int send_keepalive_packet(MMSTContext *mmst) @@ -270,7 +270,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) } length_remaining= AV_RL32(mms->in_buffer+8) + 4; - dprintf(NULL, "Length remaining is %d\n", length_remaining); + av_dlog(NULL, "Length remaining is %d\n", length_remaining); // read the rest of the packet. if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 12) { @@ -350,7 +350,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) } 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); + av_dlog(NULL, "packet id type %d is old.", packet_id_type); continue; } } @@ -376,7 +376,7 @@ static int mms_safe_send_recv(MMSTContext *mmst, if(send_fun) { int ret = send_fun(mmst); if (ret < 0) { - dprintf(NULL, "Send Packet error before expecting recv packet %d\n", expect_type); + av_dlog(NULL, "Send Packet error before expecting recv packet %d\n", expect_type); return ret; } } @@ -554,7 +554,7 @@ static int mms_open(URLContext *h, const char *uri, int flags) } err = ff_mms_asf_header_parser(mms); if (err) { - dprintf(NULL, "asf header parsed failed!\n"); + av_dlog(NULL, "asf header parsed failed!\n"); goto fail; } mms->header_parsed = 1; @@ -571,11 +571,11 @@ static int mms_open(URLContext *h, const char *uri, int flags) if (err) { goto fail; } - dprintf(NULL, "Leaving open (success)\n"); + av_dlog(NULL, "Leaving open (success)\n"); return 0; fail: mms_close(h); - dprintf(NULL, "Leaving open (failure: %d)\n", err); + av_dlog(NULL, "Leaving open (failure: %d)\n", err); return err; } @@ -608,12 +608,12 @@ static int mms_read(URLContext *h, uint8_t *buf, int size) // copy the data to the packet buffer. result = ff_mms_read_data(mms, buf, size); if (result == 0) { - dprintf(NULL, "read asf media paket size is zero!\n"); + av_dlog(NULL, "read asf media paket size is zero!\n"); break; } } } else { - dprintf(NULL, "read packet error!\n"); + av_dlog(NULL, "read packet error!\n"); break; } } diff --git a/libavformat/mov.c b/libavformat/mov.c index 7ad920fcb1..a48000fe52 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -266,7 +266,7 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) a.size = get_be32(pb); a.type = get_le32(pb); } - dprintf(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", + av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size); total_size += 8; if (a.size == 1) { /* 64 bit extended size */ @@ -349,7 +349,7 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) dref->type = get_le32(pb); get_be32(pb); // version + flags - dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); + av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','i','s') && size > 150) { /* macintosh alias record */ @@ -441,8 +441,8 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom) ctype = get_le32(pb); type = get_le32(pb); /* component subtype */ - dprintf(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype); - dprintf(c->fc, "stype= %.4s\n", (char*)&type); + av_dlog(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype); + av_dlog(c->fc, "stype= %.4s\n", (char*)&type); if (type == MKTAG('v','i','d','e')) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; @@ -583,7 +583,7 @@ static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_moof(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { c->fragment.moof_offset = url_ftell(pb) - 8; - dprintf(c->fc, "moof offset %llx\n", c->fragment.moof_offset); + av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset); return mov_read_default(c, pb, atom); } @@ -655,7 +655,7 @@ static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) mov_metadata_creation_time(&c->fc->metadata, creation_time); c->time_scale = get_be32(pb); /* time scale */ - dprintf(c->fc, "time scale = %i\n", c->time_scale); + av_dlog(c->fc, "time scale = %i\n", c->time_scale); c->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */ get_be32(pb); /* preferred scale */ @@ -697,7 +697,7 @@ static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st->codec->extradata_size = 0x5a + atom.size; memcpy(st->codec->extradata, "SVQ3", 4); // fake get_buffer(pb, st->codec->extradata + 0x5a, atom.size); - dprintf(c->fc, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a); + av_dlog(c->fc, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a); return 0; } @@ -711,7 +711,7 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; little_endian = get_be16(pb); - dprintf(c->fc, "enda %d\n", little_endian); + av_dlog(c->fc, "enda %d\n", little_endian); if (little_endian == 1) { switch (st->codec->codec_id) { case CODEC_ID_PCM_S24BE: @@ -974,7 +974,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) } } - dprintf(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size, + av_dlog(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size, (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff, st->codec->codec_type); @@ -1009,7 +1009,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) st->codec->bits_per_coded_sample = get_be16(pb); /* depth */ st->codec->color_table_id = get_be16(pb); /* colortable id */ - dprintf(c->fc, "depth %d, ctab id %d\n", + av_dlog(c->fc, "depth %d, ctab id %d\n", st->codec->bits_per_coded_sample, st->codec->color_table_id); /* figure out the palette situation */ color_depth = st->codec->bits_per_coded_sample & 0x1F; @@ -1091,7 +1091,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) get_be32(pb); /* vendor */ st->codec->channels = get_be16(pb); /* channel count */ - dprintf(c->fc, "audio channels %d\n", st->codec->channels); + av_dlog(c->fc, "audio channels %d\n", st->codec->channels); st->codec->bits_per_coded_sample = get_be16(pb); /* sample size */ sc->audio_cid = get_be16(pb); @@ -1100,7 +1100,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) st->codec->sample_rate = ((get_be32(pb) >> 16)); //Read QT version 1 fields. In version 0 these do not exist. - dprintf(c->fc, "version =%d, isom =%d\n",version,c->isom); + av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom); if(!c->isom) { if(version==1) { sc->samples_per_frame = get_be32(pb); @@ -1271,7 +1271,7 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom) entries = get_be32(pb); - dprintf(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries); + av_dlog(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries); if(entries >= UINT_MAX / sizeof(*sc->stsc_data)) return -1; @@ -1311,7 +1311,7 @@ static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom) for (i = 0; i < entries; i++) { sc->stps_data[i] = get_be32(pb); - //dprintf(c->fc, "stps %d\n", sc->stps_data[i]); + //av_dlog(c->fc, "stps %d\n", sc->stps_data[i]); } return 0; @@ -1333,7 +1333,7 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) entries = get_be32(pb); - dprintf(c->fc, "keyframe_count = %d\n", entries); + av_dlog(c->fc, "keyframe_count = %d\n", entries); if(entries >= UINT_MAX / sizeof(int)) return -1; @@ -1344,7 +1344,7 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) for(i=0; ikeyframes[i] = get_be32(pb); - //dprintf(c->fc, "keyframes[]=%d\n", sc->keyframes[i]); + //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]); } return 0; } @@ -1377,7 +1377,7 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } entries = get_be32(pb); - dprintf(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); + av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); sc->sample_count = entries; if (sample_size) @@ -1434,7 +1434,7 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) get_be24(pb); /* flags */ entries = get_be32(pb); - dprintf(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries); + av_dlog(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries); if(entries >= UINT_MAX / sizeof(*sc->stts_data)) return -1; @@ -1452,7 +1452,7 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) sc->stts_data[i].count= sample_count; sc->stts_data[i].duration= sample_duration; - dprintf(c->fc, "sample_count=%d, sample_duration=%d\n",sample_count,sample_duration); + av_dlog(c->fc, "sample_count=%d, sample_duration=%d\n",sample_count,sample_duration); duration+=(int64_t)sample_duration*sample_count; total_sample_count+=sample_count; @@ -1479,7 +1479,7 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) get_be24(pb); /* flags */ entries = get_be32(pb); - dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); + av_dlog(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); if(entries >= UINT_MAX / sizeof(*sc->ctts_data)) return -1; @@ -1498,7 +1498,7 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) sc->dts_shift = FFMAX(sc->dts_shift, -duration); } - dprintf(c->fc, "dts shift %d\n", sc->dts_shift); + av_dlog(c->fc, "dts shift %d\n", sc->dts_shift); return 0; } @@ -1578,7 +1578,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) e->size = sample_size; e->min_distance = distance; e->flags = keyframe ? AVINDEX_KEYFRAME : 0; - dprintf(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " + av_dlog(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, current_sample, current_offset, current_dts, sample_size, distance, keyframe); } @@ -1626,7 +1626,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) total += chunk_count * count; } - dprintf(mov->fc, "chunk count %d\n", total); + av_dlog(mov->fc, "chunk count %d\n", total); if (total >= UINT_MAX / sizeof(*st->index_entries)) return; st->index_entries = av_malloc(total*sizeof(*st->index_entries)); @@ -1670,7 +1670,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) e->size = size; e->min_distance = 0; e->flags = AVINDEX_KEYFRAME; - dprintf(mov->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", " + av_dlog(mov->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", " "size %d, duration %d\n", st->index, i, current_offset, current_dts, size, samples); @@ -1764,7 +1764,7 @@ static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom) !st->codec->frame_size && sc->stts_count == 1) { st->codec->frame_size = av_rescale(sc->stts_data[0].duration, st->codec->sample_rate, sc->time_scale); - dprintf(c->fc, "frame size %d\n", st->codec->frame_size); + av_dlog(c->fc, "frame size %d\n", st->codec->frame_size); } mov_build_index(c, st); @@ -1961,7 +1961,7 @@ static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) frag->duration = flags & 0x08 ? get_be32(pb) : trex->duration; frag->size = flags & 0x10 ? get_be32(pb) : trex->size; frag->flags = flags & 0x20 ? get_be32(pb) : trex->flags; - dprintf(c->fc, "frag flags 0x%x\n", frag->flags); + av_dlog(c->fc, "frag flags 0x%x\n", frag->flags); return 0; } @@ -2019,7 +2019,7 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) get_byte(pb); /* version */ flags = get_be24(pb); entries = get_be32(pb); - dprintf(c->fc, "flags 0x%x entries %d\n", flags, entries); + av_dlog(c->fc, "flags 0x%x entries %d\n", flags, entries); if (flags & 0x001) data_offset = get_be32(pb); if (flags & 0x004) first_sample_flags = get_be32(pb); if (flags & 0x800) { @@ -2035,7 +2035,7 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) dts = st->duration; offset = frag->base_data_offset + data_offset; distance = 0; - dprintf(c->fc, "first sample flags 0x%x\n", first_sample_flags); + av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags); for (i = 0; i < entries; i++) { unsigned sample_size = frag->size; int sample_flags = i ? frag->flags : first_sample_flags; @@ -2055,7 +2055,7 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) distance = 0; av_add_index_entry(st, offset, dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0); - dprintf(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " + av_dlog(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i, offset, dts, sample_size, distance, keyframe); distance++; @@ -2172,7 +2172,7 @@ static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "multiple edit list entries, " "a/v desync might occur, patch welcome\n"); - dprintf(c->fc, "track[%i].edit_count = %i\n", c->fc->nb_streams-1, edit_count); + av_dlog(c->fc, "track[%i].edit_count = %i\n", c->fc->nb_streams-1, edit_count); return 0; } @@ -2363,7 +2363,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "moov atom not found\n"); return -1; } - dprintf(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb)); + av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb)); if (!url_is_streamed(pb) && mov->chapter_track > 0) mov_read_chapters(s); @@ -2382,7 +2382,7 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) if (msc->pb && msc->current_sample < avst->nb_index_entries) { AVIndexEntry *current_sample = &avst->index_entries[msc->current_sample]; int64_t dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, msc->time_scale); - dprintf(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts); + av_dlog(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts); if (!sample || (url_is_streamed(s->pb) && current_sample->pos < sample->pos) || (!url_is_streamed(s->pb) && ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && @@ -2412,7 +2412,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 || url_feof(s->pb)) return AVERROR_EOF; - dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb)); + av_dlog(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb)); goto retry; } sc = st->priv_data; @@ -2463,7 +2463,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) goto retry; pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0; pkt->pos = sample->pos; - dprintf(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n", + av_dlog(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n", pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration); return 0; } @@ -2475,13 +2475,13 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int i; sample = av_index_search_timestamp(st, timestamp, flags); - dprintf(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample); + av_dlog(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample); if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp) sample = 0; if (sample < 0) /* not sure what to do */ return -1; sc->current_sample = sample; - dprintf(s, "stream %d, found sample %d\n", st->index, sc->current_sample); + av_dlog(s, "stream %d, found sample %d\n", st->index, sc->current_sample); /* adjust ctts index */ if (sc->ctts_data) { time_sample = 0; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index e8f31d6d0b..f2b580a2ef 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -289,7 +289,7 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int MpegTSFilter *filter; MpegTSSectionFilter *sec; - dprintf(ts->stream, "Filter: pid=0x%x\n", pid); + av_dlog(ts->stream, "Filter: pid=0x%x\n", pid); if (pid >= NB_PID_MAX || ts->pids[pid]) return NULL; @@ -678,7 +678,7 @@ static int mpegts_push_data(MpegTSFilter *filter, pes->header[2] == 0x01) { /* it must be an mpeg2 PES stream */ code = pes->header[3] | 0x100; - dprintf(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code); + av_dlog(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code); if ((pes->st && pes->st->discard == AVDISCARD_ALL) || code == 0x1be) /* padding_stream */ @@ -714,7 +714,7 @@ static int mpegts_push_data(MpegTSFilter *filter, code != 0x1f8) { /* ITU-T Rec. H.222.1 type E stream */ pes->state = MPEGTS_PESHEADER; if (pes->st->codec->codec_id == CODEC_ID_NONE) { - dprintf(pes->stream, "pid=%x stream_type=%x probing\n", + av_dlog(pes->stream, "pid=%x stream_type=%x probing\n", pes->pid, pes->stream_type); pes->st->codec->codec_id = CODEC_ID_PROBE; } @@ -878,7 +878,7 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size, len = ff_mp4_read_descr(s, &pb, &tag); if (tag == MP4ESDescrTag) { *es_id = get_be16(&pb); /* ES_ID */ - dprintf(s, "ES_ID %#x\n", *es_id); + av_dlog(s, "ES_ID %#x\n", *es_id); get_byte(&pb); /* priority */ len = ff_mp4_read_descr(s, &pb, &tag); if (tag == MP4DecConfigDescrTag) { @@ -912,7 +912,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type if (desc_end > desc_list_end) return -1; - dprintf(fc, "tag: 0x%02x len=%d\n", desc_tag, desc_len); + av_dlog(fc, "tag: 0x%02x len=%d\n", desc_tag, desc_len); if (st->codec->codec_id == CODEC_ID_NONE && stream_type == STREAM_TYPE_PRIVATE_DATA) @@ -967,7 +967,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type break; case 0x05: /* registration descriptor */ st->codec->codec_tag = bytestream_get_le32(pp); - dprintf(fc, "reg_desc=%.4s\n", (char*)&st->codec->codec_tag); + av_dlog(fc, "reg_desc=%.4s\n", (char*)&st->codec->codec_tag); if (st->codec->codec_id == CODEC_ID_NONE && stream_type == STREAM_TYPE_PRIVATE_DATA) mpegts_find_stream_type(st, st->codec->codec_tag, REGD_types); @@ -994,7 +994,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len int mp4_es_id = 0; #ifdef DEBUG - dprintf(ts->stream, "PMT: len %i\n", section_len); + av_dlog(ts->stream, "PMT: len %i\n", section_len); av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len); #endif @@ -1003,7 +1003,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (parse_section_header(h, &p, p_end) < 0) return; - dprintf(ts->stream, "sid=0x%x sec_num=%d/%d\n", + av_dlog(ts->stream, "sid=0x%x sec_num=%d/%d\n", h->id, h->sec_num, h->last_sec_num); if (h->tid != PMT_TID) @@ -1015,7 +1015,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len return; add_pid_to_pmt(ts, h->id, pcr_pid); - dprintf(ts->stream, "pcr_pid=0x%x\n", pcr_pid); + av_dlog(ts->stream, "pcr_pid=0x%x\n", pcr_pid); program_info_length = get16(&p, p_end) & 0xfff; if (program_info_length < 0) @@ -1025,7 +1025,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len tag = get8(&p, p_end); len = get8(&p, p_end); - dprintf(ts->stream, "program tag: 0x%02x len=%d\n", tag, len); + av_dlog(ts->stream, "program tag: 0x%02x len=%d\n", tag, len); if(len > program_info_length - 2) //something else is broken, exit the program_descriptors_loop @@ -1114,7 +1114,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len int sid, pmt_pid; #ifdef DEBUG - dprintf(ts->stream, "PAT:\n"); + av_dlog(ts->stream, "PAT:\n"); av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len); #endif p_end = section + section_len - 4; @@ -1133,7 +1133,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (pmt_pid < 0) break; - dprintf(ts->stream, "sid=0x%x pid=0x%x\n", sid, pmt_pid); + av_dlog(ts->stream, "sid=0x%x pid=0x%x\n", sid, pmt_pid); if (sid == 0x0000) { /* NIT info */ @@ -1158,7 +1158,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len char *name, *provider_name; #ifdef DEBUG - dprintf(ts->stream, "SDT:\n"); + av_dlog(ts->stream, "SDT:\n"); av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len); #endif @@ -1196,7 +1196,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (desc_end > desc_list_end) break; - dprintf(ts->stream, "tag: 0x%02x len=%d\n", + av_dlog(ts->stream, "tag: 0x%02x len=%d\n", desc_tag, desc_len); switch(desc_tag) { @@ -1484,7 +1484,7 @@ static int mpegts_read_header(AVFormatContext *s, ts->auto_guess = 1; - dprintf(ts->stream, "tuning done\n"); + av_dlog(ts->stream, "tuning done\n"); s->ctx_flags |= AVFMTCTX_NOHEADER; } else { diff --git a/libavformat/mxf.h b/libavformat/mxf.h index 9190da6e04..4f5d4c0d95 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -63,7 +63,7 @@ extern const MXFCodecUL ff_mxf_codec_uls[]; int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum PixelFormat *pix_fmt); -#define PRINT_KEY(pc, s, x) dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \ +#define PRINT_KEY(pc, s, x) av_dlog(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \ (x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], (x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15]) #endif /* AVFORMAT_MXF_H */ diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 5276c8b2fa..9193561944 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -309,7 +309,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) if (klv_read_packet(&klv, s->pb) < 0) return -1; PRINT_KEY(s, "read packet", klv.key); - dprintf(s, "size %lld offset %#llx\n", klv.length, klv.offset); + av_dlog(s, "size %lld offset %#llx\n", klv.length, klv.offset); if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) { int res = mxf_decrypt_triplet(s, pkt, &klv); if (res < 0) { @@ -518,12 +518,12 @@ static int mxf_read_source_package(void *arg, ByteIOContext *pb, int tag, int si static int mxf_read_index_table_segment(void *arg, ByteIOContext *pb, int tag, int size, UID uid) { switch(tag) { - case 0x3F05: dprintf(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break; - case 0x3F06: dprintf(NULL, "IndexSID %d\n", get_be32(pb)); break; - case 0x3F07: dprintf(NULL, "BodySID %d\n", get_be32(pb)); break; - case 0x3F0B: dprintf(NULL, "IndexEditRate %d/%d\n", get_be32(pb), get_be32(pb)); break; - case 0x3F0C: dprintf(NULL, "IndexStartPosition %lld\n", get_be64(pb)); break; - case 0x3F0D: dprintf(NULL, "IndexDuration %lld\n", get_be64(pb)); break; + case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break; + case 0x3F06: av_dlog(NULL, "IndexSID %d\n", get_be32(pb)); break; + case 0x3F07: av_dlog(NULL, "BodySID %d\n", get_be32(pb)); break; + case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", get_be32(pb), get_be32(pb)); break; + case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", get_be64(pb)); break; + case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", get_be64(pb)); break; } return 0; } @@ -536,7 +536,7 @@ static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor) do { code = get_byte(pb); value = get_byte(pb); - dprintf(NULL, "pixel layout: code %#x\n", code); + av_dlog(NULL, "pixel layout: code %#x\n", code); if (ofs < 16) { layout[ofs++] = code; @@ -666,7 +666,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) MXFPackage *temp_package = NULL; int i, j, k; - dprintf(mxf->fc, "metadata sets count %d\n", mxf->metadata_sets_count); + av_dlog(mxf->fc, "metadata sets count %d\n", mxf->metadata_sets_count); /* TODO: handle multiple material packages (OP3x) */ for (i = 0; i < mxf->packages_count; i++) { material_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[i], MaterialPackage); @@ -876,7 +876,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF uint64_t next = url_ftell(pb) + size; UID uid = {0}; - dprintf(mxf->fc, "local tag %#04x size %d\n", tag, size); + av_dlog(mxf->fc, "local tag %#04x size %d\n", tag, size); if (!size) { /* ignore empty tag, needed for some files with empty UMID tag */ av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x with 0 size\n", tag); continue; @@ -887,7 +887,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF int local_tag = AV_RB16(mxf->local_tags+i*18); if (local_tag == tag) { memcpy(uid, mxf->local_tags+i*18+2, 16); - dprintf(mxf->fc, "local tag %#04x\n", local_tag); + av_dlog(mxf->fc, "local tag %#04x\n", local_tag); PRINT_KEY(mxf->fc, "uid", uid); } } @@ -920,7 +920,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (klv_read_packet(&klv, s->pb) < 0) return -1; PRINT_KEY(s, "read header", klv.key); - dprintf(s, "size %lld offset %#llx\n", klv.length, klv.offset); + av_dlog(s, "size %lld offset %#llx\n", klv.length, klv.offset); if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || IS_KLV_KEY(klv.key, mxf_essence_element_key)) { /* FIXME avoid seek */ diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 62c64e0651..9c9fa1bbcb 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -43,7 +43,7 @@ static int read_atom(AVFormatContext *s, Atom *atom) if (atom->size < 8) return -1; atom->tag = get_le32(s->pb); - dprintf(s, "atom %d %.4s offset %#llx\n", + av_dlog(s, "atom %d %.4s offset %#llx\n", atom->size, (char*)&atom->tag, atom->offset); return atom->size; } @@ -61,16 +61,16 @@ static int r3d_read_red1(AVFormatContext *s) tmp = get_byte(s->pb); // major version tmp2 = get_byte(s->pb); // minor version - dprintf(s, "version %d.%d\n", tmp, tmp2); + av_dlog(s, "version %d.%d\n", tmp, tmp2); tmp = get_be16(s->pb); // unknown - dprintf(s, "unknown1 %d\n", tmp); + av_dlog(s, "unknown1 %d\n", tmp); tmp = get_be32(s->pb); av_set_pts_info(st, 32, 1, tmp); tmp = get_be32(s->pb); // filenum - dprintf(s, "filenum %d\n", tmp); + av_dlog(s, "filenum %d\n", tmp); url_fskip(s->pb, 32); // unknown @@ -78,13 +78,13 @@ static int r3d_read_red1(AVFormatContext *s) st->codec->height = get_be32(s->pb); tmp = get_be16(s->pb); // unknown - dprintf(s, "unknown2 %d\n", tmp); + av_dlog(s, "unknown2 %d\n", tmp); st->codec->time_base.den = get_be16(s->pb); st->codec->time_base.num = get_be16(s->pb); tmp = get_byte(s->pb); // audio channels - dprintf(s, "audio channels %d\n", tmp); + av_dlog(s, "audio channels %d\n", tmp); if (tmp > 0) { AVStream *ast = av_new_stream(s, 1); if (!ast) @@ -99,10 +99,10 @@ static int r3d_read_red1(AVFormatContext *s) filename[sizeof(filename)-1] = 0; av_metadata_set2(&st->metadata, "filename", filename, 0); - dprintf(s, "filename %s\n", filename); - dprintf(s, "resolution %dx%d\n", st->codec->width, st->codec->height); - dprintf(s, "timescale %d\n", st->time_base.den); - dprintf(s, "frame rate %d/%d\n", + av_dlog(s, "filename %s\n", filename); + av_dlog(s, "resolution %dx%d\n", st->codec->width, st->codec->height); + av_dlog(s, "timescale %d\n", st->time_base.den); + av_dlog(s, "frame rate %d/%d\n", st->codec->time_base.num, st->codec->time_base.den); return 0; @@ -125,13 +125,13 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom) r3d->video_offsets_count = i; break; } - dprintf(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]); + av_dlog(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]); } if (st->codec->time_base.den) st->duration = (uint64_t)r3d->video_offsets_count* st->time_base.den*st->codec->time_base.num/st->codec->time_base.den; - dprintf(s, "duration %lld\n", st->duration); + av_dlog(s, "duration %lld\n", st->duration); return 0; } @@ -147,10 +147,10 @@ static void r3d_read_reos(AVFormatContext *s) get_be32(s->pb); // rdas offset tmp = get_be32(s->pb); - dprintf(s, "num video chunks %d\n", tmp); + av_dlog(s, "num video chunks %d\n", tmp); tmp = get_be32(s->pb); - dprintf(s, "num audio chunks %d\n", tmp); + av_dlog(s, "num audio chunks %d\n", tmp); url_fskip(s->pb, 6*4); } @@ -176,7 +176,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) } s->data_offset = url_ftell(s->pb); - dprintf(s, "data offset %#llx\n", s->data_offset); + av_dlog(s, "data offset %#llx\n", s->data_offset); if (url_is_streamed(s->pb)) return 0; // find REOB/REOF/REOS to load index @@ -217,29 +217,29 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) dts = get_be32(s->pb); tmp = get_be32(s->pb); - dprintf(s, "frame num %d\n", tmp); + av_dlog(s, "frame num %d\n", tmp); tmp = get_byte(s->pb); // major version tmp2 = get_byte(s->pb); // minor version - dprintf(s, "version %d.%d\n", tmp, tmp2); + av_dlog(s, "version %d.%d\n", tmp, tmp2); tmp = get_be16(s->pb); // unknown - dprintf(s, "unknown %d\n", tmp); + av_dlog(s, "unknown %d\n", tmp); if (tmp > 4) { tmp = get_be16(s->pb); // unknown - dprintf(s, "unknown %d\n", tmp); + av_dlog(s, "unknown %d\n", tmp); tmp = get_be16(s->pb); // unknown - dprintf(s, "unknown %d\n", tmp); + av_dlog(s, "unknown %d\n", tmp); tmp = get_be32(s->pb); - dprintf(s, "width %d\n", tmp); + av_dlog(s, "width %d\n", tmp); tmp = get_be32(s->pb); - dprintf(s, "height %d\n", tmp); + av_dlog(s, "height %d\n", tmp); tmp = get_be32(s->pb); - dprintf(s, "metadata len %d\n", tmp); + av_dlog(s, "metadata len %d\n", tmp); } tmp = atom->size - 8 - (url_ftell(s->pb) - pos); if (tmp < 0) @@ -255,7 +255,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) if (st->codec->time_base.den) pkt->duration = (uint64_t)st->time_base.den* st->codec->time_base.num/st->codec->time_base.den; - dprintf(s, "pkt dts %lld duration %d\n", pkt->dts, pkt->duration); + av_dlog(s, "pkt dts %lld duration %d\n", pkt->dts, pkt->duration); return 0; } @@ -275,17 +275,17 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) samples = get_be32(s->pb); tmp = get_be32(s->pb); - dprintf(s, "packet num %d\n", tmp); + av_dlog(s, "packet num %d\n", tmp); tmp = get_be16(s->pb); // unkown - dprintf(s, "unknown %d\n", tmp); + av_dlog(s, "unknown %d\n", tmp); tmp = get_byte(s->pb); // major version tmp2 = get_byte(s->pb); // minor version - dprintf(s, "version %d.%d\n", tmp, tmp2); + av_dlog(s, "version %d.%d\n", tmp, tmp2); tmp = get_be32(s->pb); // unknown - dprintf(s, "unknown %d\n", tmp); + av_dlog(s, "unknown %d\n", tmp); size = atom->size - 8 - (url_ftell(s->pb) - pos); if (size < 0) @@ -299,7 +299,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) pkt->stream_index = 1; pkt->dts = dts; pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate); - dprintf(s, "pkt dts %lld duration %d samples %d sample rate %d\n", + av_dlog(s, "pkt dts %lld duration %d samples %d sample rate %d\n", pkt->dts, pkt->duration, samples, st->codec->sample_rate); return 0; @@ -356,7 +356,7 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i frame_num = sample_time*st->codec->time_base.den/ ((int64_t)st->codec->time_base.num*st->time_base.den); - dprintf(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time); + av_dlog(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time); if (frame_num < r3d->video_offsets_count) { url_fseek(s->pb, r3d->video_offsets_count, SEEK_SET); diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 4f0ade167d..c81ba1cd02 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -324,9 +324,9 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) len = url_close_dyn_buf(pb, &buf); if ((len > 0) && buf) { int result; - dprintf(s->ic, "sending %d bytes of RR\n", len); + av_dlog(s->ic, "sending %d bytes of RR\n", len); result= url_write(s->rtp_ctx, buf, len); - dprintf(s->ic, "result from url_write: %d\n", result); + av_dlog(s->ic, "result from url_write: %d\n", result); av_free(buf); } return 0; diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 839a05c338..22e68bac97 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -192,7 +192,7 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time) RTPMuxContext *s = s1->priv_data; uint32_t rtp_ts; - dprintf(s1, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp); + av_dlog(s1, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp); s->last_rtcp_ntp_time = ntp_time; rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1000000}, @@ -215,7 +215,7 @@ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m) { RTPMuxContext *s = s1->priv_data; - dprintf(s1, "rtp_send_data size=%d\n", len); + av_dlog(s1, "rtp_send_data size=%d\n", len); /* build the RTP header */ put_byte(s1->pb, (RTP_VERSION << 6)); @@ -364,7 +364,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) int rtcp_bytes; int size= pkt->size; - dprintf(s1, "%d: write len=%d\n", pkt->stream_index, size); + av_dlog(s1, "%d: write len=%d\n", pkt->stream_index, size); rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) / RTCP_TX_RATIO_DEN; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index dec6995c46..9a6d6ad2b8 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -247,7 +247,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, struct sockaddr_storage sdp_ip; int ttl; - dprintf(s, "sdp: %c='%s'\n", letter, buf); + av_dlog(s, "sdp: %c='%s'\n", letter, buf); p = buf; if (s1->skip_media && letter != 'm') @@ -826,7 +826,7 @@ void ff_rtsp_skip_packet(AVFormatContext *s) return; len = AV_RB16(buf + 1); - dprintf(s, "skipping RTP packet len=%d\n", len); + av_dlog(s, "skipping RTP packet len=%d\n", len); /* skip payload */ while (len > 0) { @@ -860,7 +860,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, for (;;) { ret = url_read_complete(rt->rtsp_hd, &ch, 1); #ifdef DEBUG_RTP_TCP - dprintf(s, "ret=%d c=%02x [%c]\n", ret, ch, ch); + av_dlog(s, "ret=%d c=%02x [%c]\n", ret, ch, ch); #endif if (ret != 1) return AVERROR_EOF; @@ -879,7 +879,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, } *q = '\0'; - dprintf(s, "line='%s'\n", buf); + av_dlog(s, "line='%s'\n", buf); /* test if last line */ if (buf[0] == '\0') @@ -984,7 +984,7 @@ static int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s, out_buf = base64buf; } - dprintf(s, "Sending:\n%s--\n", buf); + av_dlog(s, "Sending:\n%s--\n", buf); url_write(rt->rtsp_hd_out, out_buf, strlen(out_buf)); if (send_content_length > 0 && send_content) { diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index f95f7c3851..45ed7bb9bb 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -184,7 +184,7 @@ int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, RTSPStream *rtsp_st; #ifdef DEBUG_RTP_TCP - dprintf(s, "tcp_read_packet:\n"); + av_dlog(s, "tcp_read_packet:\n"); #endif redo: for (;;) { @@ -205,7 +205,7 @@ redo: id = buf[0]; len = AV_RB16(buf + 1); #ifdef DEBUG_RTP_TCP - dprintf(s, "id=%d len=%d\n", id, len); + av_dlog(s, "id=%d len=%d\n", id, len); #endif if (len > buf_size || len < 12) goto redo; diff --git a/libavutil/internal.h b/libavutil/internal.h index 9c4ba7e60c..748a823ac4 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -114,13 +114,6 @@ /* debug stuff */ -/* dprintf macros */ -#ifdef DEBUG -# define dprintf(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) -#else -# define dprintf(pctx, ...) -#endif - #define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) /* math */ diff --git a/libavutil/log.h b/libavutil/log.h index 3b364bed24..0bcf2c4982 100644 --- a/libavutil/log.h +++ b/libavutil/log.h @@ -135,6 +135,17 @@ void av_log_set_callback(void (*)(void*, int, const char*, va_list)); void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); const char* av_default_item_name(void* ctx); +/** + * av_dlog macros + * Useful to print debug messages that shouldn't get compiled in normally. + */ + +#ifdef DEBUG +# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) +#else +# define av_dlog(pctx, ...) +#endif + /** * 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 From d33ed7b36762bf26694bdfa18e0d811e26c996f8 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 30 Jan 2011 01:05:39 +0000 Subject: [PATCH 171/528] Enable native build on QNX/x86 --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 94993d7e86..46f4e4415f 100755 --- a/configure +++ b/configure @@ -2109,7 +2109,7 @@ case "$arch" in arch="sparc" subarch="sparc64" ;; - i[3-6]86|i86pc|BePC|x86_64|amd64) + i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64) arch="x86" ;; esac @@ -2446,6 +2446,10 @@ case $target_os in ;; gnu) ;; + qnx) + add_cppflags -D_QNX_SOURCE + network_extralibs="-lsocket" + ;; none) ;; *) From 665132e6204766b1d43ce413d6b1cc2a1d34ea29 Mon Sep 17 00:00:00 2001 From: Vasyl' Vavrychuk Date: Sun, 30 Jan 2011 15:24:00 +0000 Subject: [PATCH 172/528] mpegts: remove get_pts duplicate of ff_parse_pes_pts. Signed-off-by: Vasyl' Vavrychuk Signed-off-by: Mans Rullgard --- libavformat/mpeg.h | 2 +- libavformat/mpegts.c | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/libavformat/mpeg.h b/libavformat/mpeg.h index d09b2e81bc..ca019c9eb2 100644 --- a/libavformat/mpeg.h +++ b/libavformat/mpeg.h @@ -63,7 +63,7 @@ static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 }; /** * Parse MPEG-PES five-byte timestamp */ -static inline int64_t ff_parse_pes_pts(uint8_t *buf) { +static inline int64_t ff_parse_pes_pts(const uint8_t *buf) { return (int64_t)(*buf & 0x0e) << 29 | (AV_RB16(buf+1) >> 1) << 15 | AV_RB16(buf+3) >> 1; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index f2b580a2ef..8467e85a04 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -30,6 +30,7 @@ #include "mpegts.h" #include "internal.h" #include "seek.h" +#include "mpeg.h" #include "isom.h" /* 1.0 second at 24Mbit/s */ @@ -601,14 +602,6 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, return 0; } -static int64_t get_pts(const uint8_t *p) -{ - int64_t pts = (int64_t)((p[0] >> 1) & 0x07) << 30; - pts |= (AV_RB16(p + 1) >> 1) << 15; - pts |= AV_RB16(p + 3) >> 1; - return pts; -} - static void new_pes_packet(PESContext *pes, AVPacket *pkt) { av_init_packet(pkt); @@ -767,12 +760,12 @@ static int mpegts_push_data(MpegTSFilter *filter, pes->pts = AV_NOPTS_VALUE; pes->dts = AV_NOPTS_VALUE; if ((flags & 0xc0) == 0x80) { - pes->dts = pes->pts = get_pts(r); + pes->dts = pes->pts = ff_parse_pes_pts(r); r += 5; } else if ((flags & 0xc0) == 0xc0) { - pes->pts = get_pts(r); + pes->pts = ff_parse_pes_pts(r); r += 5; - pes->dts = get_pts(r); + pes->dts = ff_parse_pes_pts(r); r += 5; } pes->extended_stream_id = -1; From 13156f40e1f17ec1d0c57e6bf7a2850f673600c0 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 22 Jan 2011 15:35:00 +0100 Subject: [PATCH 173/528] ffplay: in video_thread(), use av_dlog() for timestamp logging. Disable logging of rescaled timestamps if DEBUG is not enabled. Avoid debug log spamming with -loglevel debug. Signed-off-by: Mans Rullgard --- ffplay.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ffplay.c b/ffplay.c index 840df66687..edc609731b 100644 --- a/ffplay.c +++ b/ffplay.c @@ -58,6 +58,7 @@ const char program_name[] = "FFplay"; const int program_birth_year = 2003; +//#define DEBUG //#define DEBUG_SYNC #define MAX_QUEUE_SIZE (15 * 1024 * 1024) @@ -1853,12 +1854,12 @@ static int video_thread(void *arg) } if (av_cmp_q(tb, is->video_st->time_base)) { - int64_t pts1 = pts_int; + av_unused 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); + av_dlog(NULL, "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); From 2855080447a226aba7e88e943fd8a8779d6daa98 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 16 Jan 2011 18:39:34 +0100 Subject: [PATCH 174/528] In ffplay:get_video_frame(), use frame->pkt_pts rather than reordered_opaque. AVCodecContext.reordered_opaque is deprecated for this specific use. Signed-off-by: Mans Rullgard --- ffplay.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ffplay.c b/ffplay.c index edc609731b..1df382422f 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1570,16 +1570,15 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke return 0; } - is->video_st->codec->reordered_opaque = pkt->pts; len1 = avcodec_decode_video2(is->video_st->codec, frame, &got_picture, pkt); if (got_picture) { if (decoder_reorder_pts == -1) { - *pts = guess_correct_pts(&is->pts_ctx, frame->reordered_opaque, pkt->dts); + *pts = guess_correct_pts(&is->pts_ctx, frame->pkt_pts, pkt->dts); } else if (decoder_reorder_pts) { - *pts = frame->reordered_opaque; + *pts = frame->pkt_pts; } else { *pts = pkt->dts; } From 73be29b0c4297fd0e61e7fe5d925bec397d8fe4a Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Sat, 29 Jan 2011 21:09:33 -0800 Subject: [PATCH 175/528] Slightly simplify VP8 inter_predict Merge an if and a switch. --- libavcodec/vp8.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index ef4e270f6c..d2f55d90f3 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1307,10 +1307,11 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, AVFrame *ref = s->framep[mb->ref_frame]; VP56mv *bmv = mb->bmv; - if (mb->mode < VP8_MVMODE_SPLIT) { + switch (mb->partitioning) { + case VP8_SPLITMVMODE_NONE: vp8_mc_part(s, dst, ref, x_off, y_off, 0, 0, 16, 16, width, height, &mb->mv); - } else switch (mb->partitioning) { + break; case VP8_SPLITMVMODE_4x4: { int x, y; VP56mv uvmv; From fa34a3626cf1aa19acbe9f8c6fcddb6c3eb8eaa1 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Fri, 14 Jan 2011 15:50:55 +0100 Subject: [PATCH 176/528] Make ffmpeg warns the user when the selected sample format is ignored. Signed-off-by: Mans Rullgard --- ffmpeg.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index 691b73e159..df890185aa 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -600,8 +600,14 @@ static void choose_sample_fmt(AVStream *st, AVCodec *codec) if(*p == st->codec->sample_fmt) break; } - if(*p == -1) + if (*p == -1) { + av_log(NULL, AV_LOG_WARNING, + "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n", + av_get_sample_fmt_name(st->codec->sample_fmt), + codec->name, + av_get_sample_fmt_name(codec->sample_fmts[0])); st->codec->sample_fmt = codec->sample_fmts[0]; + } } } From 45430099438d7b4f70ebb23611a29d318ba49687 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 31 Jan 2011 08:58:14 -0500 Subject: [PATCH 177/528] asf/wtv: use service_provider and service_name metadata tags Signed-off-by: Ronald S. Bultje --- libavformat/asf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/asf.c b/libavformat/asf.c index e6659923d7..1f6af18b29 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -153,6 +153,8 @@ const AVMetadataConv ff_asf_metadata_conv[] = { { "WM/Tool" , "encoder" }, { "WM/TrackNumber" , "track" }, { "WM/Track" , "track" }, + { "WM/MediaStationCallSign", "service_provider" }, + { "WM/MediaStationName", "service_name" }, // { "Year" , "date" }, TODO: conversion year<->date { 0 } }; From 22e9277aa5e6e5abfd037420093439058d4a14df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sat, 29 Jan 2011 13:44:34 +0100 Subject: [PATCH 178/528] VC1testenc: convert pts values to correct time-base. Signed-off-by: Ronald S. Bultje --- libavformat/vc1testenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c index 507b332a86..567efb2d3a 100644 --- a/libavformat/vc1testenc.c +++ b/libavformat/vc1testenc.c @@ -47,6 +47,7 @@ static int vc1test_write_header(AVFormatContext *s) put_le32(pb, s->streams[0]->r_frame_rate.den); else put_le32(pb, 0xFFFFFFFF); //variable framerate + av_set_pts_info(s->streams[0], 32, 1, 1000); return 0; } From e771d2e3fef4d2bcfc08b9eb37296f0e0af1f607 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Wed, 26 Jan 2011 22:53:00 +0100 Subject: [PATCH 179/528] Add documentation for the image2 muxer. Signed-off-by: Ronald S. Bultje --- doc/muxers.texi | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/doc/muxers.texi b/doc/muxers.texi index c3dcf1171c..969051a082 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -18,4 +18,54 @@ enabled muxers. A description of some of the currently available muxers follows. +@section image2 + +Image file muxer. + +This muxer writes video frames to multiple image files specified by a +pattern. + +The pattern may contain the string "%d" or "%0@var{N}d", which +specifies the position of the characters representing a numbering in +the filenames. If the form "%d0@var{N}d" is used, the string +representing the number in each filename is 0-padded to @var{N} +digits. The literal character '%' can be specified in the pattern with +the string "%%". + +If the pattern contains "%d" or "%0@var{N}d", the first filename of +the file list specified will contain the number 1, all the following +numbers will be sequential. + +The pattern may contain a suffix which is used to automatically +determine the format of the image files to write. + +For example the pattern "img-%03d.bmp" will specify a sequence of +filenames of the form @file{img-001.bmp}, @file{img-002.bmp}, ..., +@file{img-010.bmp}, etc. +The pattern "img%%-%d.jpg" will specify a sequence of filenames of the +form @file{img%-1.jpg}, @file{img%-2.jpg}, ..., @file{img%-10.jpg}, +etc. + +The following example shows how to use @file{ffmpeg} for creating a +sequence of files @file{img-001.jpeg}, @file{img-002.jpeg}, ..., +taking one image every second from the input video: +@example +ffmpeg -i in.avi -r 1 -f image2 'img-%03d.jpeg' +@end example + +Note that with @file{ffmpeg}, if the format is not specified with the +@code{-f} option and the output filename specifies an image file +format, the image2 muxer is automatically selected, so the previous +command can be written as: +@example +ffmpeg -i in.avi -r 1 'img-%03d.jpeg' +@end example + +Note also that the pattern must not necessarily contain "%d" or +"%0@var{N}d", for example to create a single image file +@file{img.jpeg} from the input video you can employ the command: +@example +ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg +@end example + @c man end MUXERS From 445996aa51f4f1d9a26456a8511988291a720ba0 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Mon, 31 Jan 2011 13:19:51 +0200 Subject: [PATCH 180/528] Replace defines in libavformat/mpegtsenc.c with AVOptions Around 01/28/11 18:56, Ronald S. Bultje scribbled: > That patch is now merged, can you submit the update to muxers.texi? > Then we'll apply the whole thing. See attached. I hope the documentation is enough. -- Georgi Chorbadzhiyski http://georgi.unixsol.org/ From c236024b8254f5c2c45934c30fff390cb0e55a5e Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Tue, 25 Jan 2011 13:09:17 +0200 Subject: [PATCH] mpegts: Replace defines in with AVOptions This patch adds support for setting transport_stream_id, original_network_id, service_id, pmt_start_pid and start_pid in mpegts muxer. Signed-off-by: Ronald S. Bultje --- doc/muxers.texi | 41 +++++++++++++++++++++++++++++++++++ libavformat/mpegtsenc.c | 47 ++++++++++++++++++++++++++++++----------- 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 969051a082..d98abefda3 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -68,4 +68,45 @@ Note also that the pattern must not necessarily contain "%d" or ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg @end example +@section mpegts + +MPEG transport stream muxer. + +This muxer implements ISO 13818-1 and part of ETSI EN 300 468. + +The muxer options are: + +@table @option +@item -mpegts_original_network_id @var{number} +Set the original_network_id (default 0x0001). This is unique identifier +of a network in DVB. Its main use is in the unique identification of a +service through the path Original_Network_ID, Transport_Stream_ID. +@item -mpegts_transport_stream_id @var{number} +Set the transport_stream_id (default 0x0001). This identifies a +transponder in DVB. +@item -mpegts_service_id @var{number} +Set the service_id (default 0x0001) also known as program in DVB. +@item -mpegts_pmt_start_pid @var{number} +Set the first PID for PMT (default 0x1000, max 0x1f00). +@item -mpegts_start_pid @var{number} +Set the first PID for data packets (default 0x0100, max 0x0f00). +@end table + +The recognized metadata settings in mpegts muxer are @code{service_provider} +and @code{service_name}. If they are not set the default for +@code{service_provider} is "FFmpeg" and the default for +@code{service_name} is "Service01". + +@example +ffmpeg -i file.mpg -acodec copy -vcodec copy \ + -mpegts_original_network_id 0x1122 \ + -mpegts_transport_stream_id 0x3344 \ + -mpegts_service_id 0x5566 \ + -mpegts_pmt_start_pid 0x1500 \ + -mpegts_start_pid 0x150 \ + -metadata service_provider="Some provider" \ + -metadata service_name="Some Channel" \ + -y out.ts +@end example + @c man end MUXERS diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index b58e84be16..a1bd14ccb0 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -21,6 +21,7 @@ #include "libavutil/bswap.h" #include "libavutil/crc.h" +#include "libavutil/opt.h" #include "libavcodec/mpegvideo.h" #include "avformat.h" #include "internal.h" @@ -64,8 +65,36 @@ typedef struct MpegTSWrite { int tsid; int64_t first_pcr; int mux_rate; ///< set to 1 when VBR + + int transport_stream_id; + int original_network_id; + int service_id; + + int pmt_start_pid; + int start_pid; } MpegTSWrite; +static const AVOption options[] = { + { "mpegts_transport_stream_id", "Set transport_stream_id field.", + offsetof(MpegTSWrite, transport_stream_id), FF_OPT_TYPE_INT, 0x0001, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + { "mpegts_original_network_id", "Set original_network_id field.", + offsetof(MpegTSWrite, original_network_id), FF_OPT_TYPE_INT, 0x0001, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + { "mpegts_service_id", "Set service_id field.", + offsetof(MpegTSWrite, service_id), FF_OPT_TYPE_INT, 0x0001, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + { "mpegts_pmt_start_pid", "Set the first pid of the PMT.", + offsetof(MpegTSWrite, pmt_start_pid), FF_OPT_TYPE_INT, 0x1000, 0x1000, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM}, + { "mpegts_start_pid", "Set the first pid.", + offsetof(MpegTSWrite, start_pid), FF_OPT_TYPE_INT, 0x0100, 0x0100, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM}, + { NULL }, +}; + +static const AVClass mpegts_muxer_class = { + "MPEGTS muxer", + av_default_item_name, + options, + LIBAVUTIL_VERSION_INT, +}; + /* NOTE: 4 bytes must be left at the end for the crc32 */ static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len) { @@ -152,16 +181,9 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id, /*********************************************/ /* mpegts writer */ -#define DEFAULT_PMT_START_PID 0x1000 -#define DEFAULT_START_PID 0x0100 #define DEFAULT_PROVIDER_NAME "FFmpeg" #define DEFAULT_SERVICE_NAME "Service01" -/* default network id, transport stream and service identifiers */ -#define DEFAULT_ONID 0x0001 -#define DEFAULT_TSID 0x0001 -#define DEFAULT_SID 0x0001 - /* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */ #define DEFAULT_PES_HEADER_FREQ 16 #define DEFAULT_PES_PAYLOAD_SIZE ((DEFAULT_PES_HEADER_FREQ - 1) * 184 + 170) @@ -374,7 +396,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts, service = av_mallocz(sizeof(MpegTSService)); if (!service) return NULL; - service->pmt.pid = DEFAULT_PMT_START_PID + ts->nb_services - 1; + service->pmt.pid = ts->pmt_start_pid + ts->nb_services; service->sid = sid; service->provider_name = av_strdup(provider_name); service->name = av_strdup(name); @@ -401,8 +423,8 @@ static int mpegts_write_header(AVFormatContext *s) const char *provider_name; int *pids; - ts->tsid = DEFAULT_TSID; - ts->onid = DEFAULT_ONID; + ts->tsid = ts->transport_stream_id; + ts->onid = ts->original_network_id; /* allocate a single DVB service */ title = av_metadata_get(s->metadata, "service_name", NULL, 0); if (!title) @@ -410,7 +432,7 @@ static int mpegts_write_header(AVFormatContext *s) service_name = title ? title->value : DEFAULT_SERVICE_NAME; provider = av_metadata_get(s->metadata, "service_provider", NULL, 0); provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME; - service = mpegts_add_service(ts, DEFAULT_SID, provider_name, service_name); + service = mpegts_add_service(ts, ts->service_id, provider_name, service_name); service->pmt.write_packet = section_write_packet; service->pmt.opaque = s; service->pmt.cc = 15; @@ -440,7 +462,7 @@ static int mpegts_write_header(AVFormatContext *s) /* MPEG pid values < 16 are reserved. Applications which set st->id in * this range are assigned a calculated pid. */ if (st->id < 16) { - ts_st->pid = DEFAULT_START_PID + i; + ts_st->pid = ts->start_pid + i; } else if (st->id < 0x1FFF) { ts_st->pid = st->id; } else { @@ -964,4 +986,5 @@ AVOutputFormat ff_mpegts_muxer = { mpegts_write_header, mpegts_write_packet, mpegts_write_end, + .priv_class = &mpegts_muxer_class, }; From 365e3c7878e4e821d5dec922d2d51f92ce13f926 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 31 Jan 2011 02:19:30 +0000 Subject: [PATCH 181/528] Rename attribute_used to av_used and move it to attributes.h This is consistent with most of the other attribute macros. Signed-off-by: Mans Rullgard --- libavutil/attributes.h | 13 +++++++++++++ libavutil/internal.h | 14 -------------- libavutil/mem.h | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/libavutil/attributes.h b/libavutil/attributes.h index d93f46093c..65a9249cd5 100644 --- a/libavutil/attributes.h +++ b/libavutil/attributes.h @@ -96,6 +96,19 @@ #endif #endif +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#ifndef av_used +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_used __attribute__((used)) +#else +# define av_used +#endif +#endif + #ifndef av_alias #if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(3,3) # define av_alias __attribute__((may_alias)) diff --git a/libavutil/internal.h b/libavutil/internal.h index 748a823ac4..36d3e719f6 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -46,20 +46,6 @@ #endif #endif - -/** - * Mark a variable as used and prevent the compiler from optimizing it away. - * This is useful for asm that accesses varibles in ways that the compiler does not - * understand - */ -#ifndef attribute_used -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define attribute_used __attribute__((used)) -#else -# define attribute_used -#endif -#endif - #ifndef INT16_MIN #define INT16_MIN (-0x7fff - 1) #endif diff --git a/libavutil/mem.h b/libavutil/mem.h index ab73a3238d..33ab48f895 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -41,7 +41,7 @@ static const t __attribute__((aligned(n))) v #elif defined(__GNUC__) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v - #define DECLARE_ASM_CONST(n,t,v) static const t attribute_used __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v #elif defined(_MSC_VER) #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v From 740ad0d14d1eca7319a34866e896ad93cd65b9e9 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 31 Jan 2011 16:49:10 +0000 Subject: [PATCH 182/528] mpegtsenc: fix PMT PID calculation 445996aa51f4f1d9a26456a8511988291a720ba0 caused the PMT PID to be off by one. This corrects it. Signed-off-by: Mans Rullgard --- libavformat/mpegtsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index a1bd14ccb0..b1bccd1a8b 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -396,7 +396,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts, service = av_mallocz(sizeof(MpegTSService)); if (!service) return NULL; - service->pmt.pid = ts->pmt_start_pid + ts->nb_services; + service->pmt.pid = ts->pmt_start_pid + ts->nb_services - 1; service->sid = sid; service->provider_name = av_strdup(provider_name); service->name = av_strdup(name); From 8cb3c557a9f3b24bc55325e3f64a2150b983305c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Mon, 31 Jan 2011 19:16:38 +0000 Subject: [PATCH 183/528] Ogg: discard non-essential metadata from Vorbis header when creating extradata The first part of the metadata, the "vendor" string, is required by libvorbis, it will refuse to play when it is not available. Also we do not currently parse that part into metadata so it would also be lost if we removed it as well. Signed-off-by: Mans Rullgard --- libavformat/oggparsevorbis.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index d743d25e2d..34ae2fc4f0 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -256,8 +256,16 @@ vorbis_header (AVFormatContext * s, int idx) st->time_base.den = srate; } } else if (os->buf[os->pstart] == 3) { - if (os->psize > 8) - ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8); + if (os->psize > 8 && + ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8) >= 0) { + // drop all metadata we parsed and which is not required by libvorbis + unsigned new_len = 7 + 4 + AV_RL32(priv->packet[1] + 7) + 4 + 1; + if (new_len >= 16 && new_len < os->psize) { + AV_WL32(priv->packet[1] + new_len - 5, 0); + priv->packet[1][new_len - 1] = 1; + priv->len[1] = new_len; + } + } } else { st->codec->extradata_size = fixup_vorbis_headers(s, priv, &st->codec->extradata); From 80ba1ddb58b5923b9f36a6acd542affc4ca722eb Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 31 Jan 2011 19:26:02 +0000 Subject: [PATCH 184/528] Remove unneeded add bias from 3 functions. DSPContext.vector_fmul_window() DCADSPContext.lfe_fir() SynthFilterContext.synth_filter_float() Signed-off-by: Mans Rullgard --- libavcodec/aacdec.c | 20 ++++++++++---------- libavcodec/ac3dec.c | 4 ++-- libavcodec/arm/dcadsp_init_arm.c | 2 +- libavcodec/arm/dcadsp_neon.S | 5 ++--- libavcodec/arm/dsputil_init_neon.c | 3 +-- libavcodec/arm/dsputil_neon.S | 15 +++++---------- libavcodec/arm/fft_init_arm.c | 2 +- libavcodec/arm/synth_filter_neon.S | 8 +++----- libavcodec/atrac1.c | 2 +- libavcodec/dca.c | 4 ++-- libavcodec/dcadsp.c | 6 +++--- libavcodec/dcadsp.h | 2 +- libavcodec/dsputil.c | 10 ++++++---- libavcodec/dsputil.h | 5 +---- libavcodec/ppc/float_altivec.c | 14 ++++---------- libavcodec/synth_filter.c | 6 +++--- libavcodec/synth_filter.h | 2 +- libavcodec/twinvq.c | 1 - libavcodec/vorbis_dec.c | 6 +++--- libavcodec/wmaprodec.c | 2 +- libavcodec/x86/dsputil_mmx.c | 20 ++++++++------------ 21 files changed, 59 insertions(+), 80 deletions(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 21270994da..0ea7dc84a5 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -1721,19 +1721,19 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) */ if ((ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) && (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) { - ac->dsp.vector_fmul_window( out, saved, buf, lwindow_prev, 0, 512); + ac->dsp.vector_fmul_window( out, saved, buf, lwindow_prev, 512); } else { memcpy( out, saved, 448 * sizeof(float)); if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, 0, 64); - ac->dsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(temp, buf + 3*128 + 64, buf + 4*128, swindow, 0, 64); + ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, 64); + ac->dsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow, 64); + ac->dsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow, 64); + ac->dsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow, 64); + ac->dsp.vector_fmul_window(temp, buf + 3*128 + 64, buf + 4*128, swindow, 64); memcpy( out + 448 + 4*128, temp, 64 * sizeof(float)); } else { - ac->dsp.vector_fmul_window(out + 448, saved + 448, buf, swindow_prev, 0, 64); + ac->dsp.vector_fmul_window(out + 448, saved + 448, buf, swindow_prev, 64); memcpy( out + 576, buf + 64, 448 * sizeof(float)); } } @@ -1741,9 +1741,9 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) // buffer update if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { memcpy( saved, temp + 64, 64 * sizeof(float)); - ac->dsp.vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 0, 64); + ac->dsp.vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128, swindow, 64); + ac->dsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 64); + ac->dsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 64); memcpy( saved + 448, buf + 7*128 + 64, 64 * sizeof(float)); } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { memcpy( saved, buf + 512, 448 * sizeof(float)); diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index ab738771b5..8e40ce1ccc 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -628,13 +628,13 @@ static inline void do_imdct(AC3DecodeContext *s, int channels) for(i=0; i<128; i++) x[i] = s->transform_coeffs[ch][2*i]; ff_imdct_half(&s->imdct_256, s->tmp_output, x); - s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 0, 128); + s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 128); for(i=0; i<128; i++) x[i] = s->transform_coeffs[ch][2*i+1]; ff_imdct_half(&s->imdct_256, s->delay[ch-1], x); } else { ff_imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]); - s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 0, 128); + s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 128); memcpy(s->delay[ch-1], s->tmp_output+128, 128*sizeof(float)); } } diff --git a/libavcodec/arm/dcadsp_init_arm.c b/libavcodec/arm/dcadsp_init_arm.c index 816718d483..5663cd7fc2 100644 --- a/libavcodec/arm/dcadsp_init_arm.c +++ b/libavcodec/arm/dcadsp_init_arm.c @@ -23,7 +23,7 @@ #include "libavcodec/dcadsp.h" void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs, - int decifactor, float scale, float bias); + int decifactor, float scale); void av_cold ff_dcadsp_init_arm(DCADSPContext *s) { diff --git a/libavcodec/arm/dcadsp_neon.S b/libavcodec/arm/dcadsp_neon.S index 19960ab193..c3bddd3e41 100644 --- a/libavcodec/arm/dcadsp_neon.S +++ b/libavcodec/arm/dcadsp_neon.S @@ -29,7 +29,7 @@ function ff_dca_lfe_fir_neon, export=1 cmp r3, #32 moveq r6, #256/32 movne r6, #256/64 -NOVFP vldr d0, [sp, #16] @ scale, bias +NOVFP vldr s0, [sp, #16] @ scale mov lr, #-16 1: vmov.f32 q2, #0.0 @ v0 @@ -51,8 +51,7 @@ NOVFP vldr d0, [sp, #16] @ scale, bias vadd.f32 d4, d4, d5 vadd.f32 d6, d6, d7 vpadd.f32 d4, d4, d6 - vdup.32 d5, d0[1] - vmla.f32 d5, d4, d0[0] + vmul.f32 d5, d4, d0[0] vst1.32 {d5[0]}, [r0,:32]! vst1.32 {d5[1]}, [r4,:32]! bne 1b diff --git a/libavcodec/arm/dsputil_init_neon.c b/libavcodec/arm/dsputil_init_neon.c index 221183cef8..67982048f9 100644 --- a/libavcodec/arm/dsputil_init_neon.c +++ b/libavcodec/arm/dsputil_init_neon.c @@ -140,8 +140,7 @@ void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *); void ff_vector_fmul_neon(float *dst, const float *src0, const float *src1, int len); void ff_vector_fmul_window_neon(float *dst, const float *src0, - const float *src1, const float *win, - float add_bias, int len); + const float *src1, const float *win, int len); void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul, int len); void ff_vector_fmul_sv_scalar_2_neon(float *dst, const float *src, diff --git a/libavcodec/arm/dsputil_neon.S b/libavcodec/arm/dsputil_neon.S index 42fb38de52..8329f6cc57 100644 --- a/libavcodec/arm/dsputil_neon.S +++ b/libavcodec/arm/dsputil_neon.S @@ -777,11 +777,8 @@ function ff_vector_fmul_neon, export=1 endfunc function ff_vector_fmul_window_neon, export=1 -VFP vdup.32 q8, d0[0] -NOVFP vld1.32 {d16[],d17[]}, [sp,:32] push {r4,r5,lr} -VFP ldr lr, [sp, #12] -NOVFP ldr lr, [sp, #16] + ldr lr, [sp, #12] sub r2, r2, #8 sub r5, lr, #2 add r2, r2, r5, lsl #2 @@ -793,14 +790,12 @@ NOVFP ldr lr, [sp, #16] vld1.64 {d4,d5}, [r3,:128]! vld1.64 {d6,d7}, [r4,:128], r5 1: subs lr, lr, #4 - vmov q11, q8 - vmla.f32 d22, d0, d4 - vmov q10, q8 - vmla.f32 d23, d1, d5 + vmul.f32 d22, d0, d4 vrev64.32 q3, q3 - vmla.f32 d20, d0, d7 + vmul.f32 d23, d1, d5 vrev64.32 q1, q1 - vmla.f32 d21, d1, d6 + vmul.f32 d20, d0, d7 + vmul.f32 d21, d1, d6 beq 2f vmla.f32 d22, d3, d7 vld1.64 {d0,d1}, [r1,:128]! diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c index bde12400de..3f2d554413 100644 --- a/libavcodec/arm/fft_init_arm.c +++ b/libavcodec/arm/fft_init_arm.c @@ -34,7 +34,7 @@ void ff_synth_filter_float_neon(FFTContext *imdct, float *synth_buf_ptr, int *synth_buf_offset, float synth_buf2[32], const float window[512], float out[32], const float in[32], - float scale, float bias); + float scale); av_cold void ff_fft_init_arm(FFTContext *s) { diff --git a/libavcodec/arm/synth_filter_neon.S b/libavcodec/arm/synth_filter_neon.S index a7c23df02b..1464abe562 100644 --- a/libavcodec/arm/synth_filter_neon.S +++ b/libavcodec/arm/synth_filter_neon.S @@ -42,7 +42,7 @@ VFP vpop {d0} ldr r5, [sp, #9*4] @ window ldr r2, [sp, #10*4] @ out -NOVFP vldr d0, [sp, #12*4] @ scale, bias +NOVFP vldr s0, [sp, #12*4] @ scale add r8, r9, #12*4 mov lr, #64*4 @@ -90,10 +90,8 @@ NOVFP vldr d0, [sp, #12*4] @ scale, bias sub r11, r11, #512*4 b 2b 3: - vdup.32 q8, d0[1] - vdup.32 q9, d0[1] - vmla.f32 q8, q10, d0[0] - vmla.f32 q9, q1, d0[0] + vmul.f32 q8, q10, d0[0] + vmul.f32 q9, q1, d0[0] vst1.32 {q3}, [r3,:128] sub r3, r3, #16*4 vst1.32 {q2}, [r3,:128] diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index 4de1dcea04..be78445b8f 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -141,7 +141,7 @@ static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q) /* overlap and window */ q->dsp.vector_fmul_window(&q->bands[band_num][start_pos], prev_buf, - &su->spectrum[0][ref_pos + start_pos], ff_sine_32, 0, 16); + &su->spectrum[0][ref_pos + start_pos], ff_sine_32, 16); prev_buf = &su->spectrum[0][ref_pos+start_pos + 16]; start_pos += block_size; diff --git a/libavcodec/dca.c b/libavcodec/dca.c index fc5c0b5558..3861813556 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -896,7 +896,7 @@ static void qmf_32_subbands(DCAContext * s, int chans, s->synth.synth_filter_float(&s->imdct, s->subband_fir_hist[chans], &s->hist_index[chans], s->subband_fir_noidea[chans], prCoeff, - samples_out, s->raXin, scale, 0); + samples_out, s->raXin, scale); samples_out+= 32; } @@ -929,7 +929,7 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select, /* Interpolation */ for (deciindex = 0; deciindex < num_deci_sample; deciindex++) { s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor, - scale, 0); + scale); samples_in++; samples_out += 2 * decifactor; } diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c index af48e3ce42..dd4994d276 100644 --- a/libavcodec/dcadsp.c +++ b/libavcodec/dcadsp.c @@ -23,7 +23,7 @@ #include "dcadsp.h" static void dca_lfe_fir_c(float *out, const float *in, const float *coefs, - int decifactor, float scale, float bias) + int decifactor, float scale) { float *out2 = out + decifactor; const float *cf0 = coefs; @@ -39,8 +39,8 @@ static void dca_lfe_fir_c(float *out, const float *in, const float *coefs, v0 += s * *cf0++; v1 += s * *--cf1; } - *out++ = (v0 * scale) + bias; - *out2++ = (v1 * scale) + bias; + *out++ = v0 * scale; + *out2++ = v1 * scale; } } diff --git a/libavcodec/dcadsp.h b/libavcodec/dcadsp.h index 20020ae06c..bb157f7650 100644 --- a/libavcodec/dcadsp.h +++ b/libavcodec/dcadsp.h @@ -21,7 +21,7 @@ typedef struct DCADSPContext { void (*lfe_fir)(float *out, const float *in, const float *coefs, - int decifactor, float scale, float bias); + int decifactor, float scale); } DCADSPContext; void ff_dcadsp_init(DCADSPContext *s); diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index f604f0e7f9..2d4ec72026 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3776,7 +3776,9 @@ static void vector_fmul_add_c(float *dst, const float *src0, const float *src1, dst[i] = src0[i] * src1[i] + src2[i]; } -void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len){ +static void vector_fmul_window_c(float *dst, const float *src0, + const float *src1, const float *win, int len) +{ int i,j; dst += len; win += len; @@ -3786,8 +3788,8 @@ void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, c float s1 = src1[j]; float wi = win[i]; float wj = win[j]; - dst[i] = s0*wj - s1*wi + add_bias; - dst[j] = s0*wi + s1*wj + add_bias; + dst[i] = s0*wj - s1*wi; + dst[j] = s0*wi + s1*wj; } } @@ -4434,7 +4436,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->vector_fmul = vector_fmul_c; c->vector_fmul_reverse = vector_fmul_reverse_c; c->vector_fmul_add = vector_fmul_add_c; - c->vector_fmul_window = ff_vector_fmul_window_c; + c->vector_fmul_window = vector_fmul_window_c; c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c; c->vector_clipf = vector_clipf_c; c->float_to_int16 = ff_float_to_int16_c; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 9a1172b1dc..b942e66a37 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -68,9 +68,6 @@ void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul); void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp); void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); -void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, - const float *win, float add_bias, int len); - /* encoding scans */ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; @@ -393,7 +390,7 @@ typedef struct DSPContext { /* assume len is a multiple of 8, and src arrays are 16-byte aligned */ void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len); /* assume len is a multiple of 4, and arrays are 16-byte aligned */ - void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len); + void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len); /* assume len is a multiple of 8, and arrays are 16-byte aligned */ void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len); void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */); diff --git a/libavcodec/ppc/float_altivec.c b/libavcodec/ppc/float_altivec.c index 188e03ea2d..60bae9a757 100644 --- a/libavcodec/ppc/float_altivec.c +++ b/libavcodec/ppc/float_altivec.c @@ -90,13 +90,9 @@ static void vector_fmul_add_altivec(float *dst, const float *src0, } } -static void vector_fmul_window_altivec(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len) +static void vector_fmul_window_altivec(float *dst, const float *src0, const float *src1, const float *win, int len) { - union { - vector float v; - float s[4]; - } vadd; - vector float vadd_bias, zero, t0, t1, s0, s1, wi, wj; + vector float zero, t0, t1, s0, s1, wi, wj; const vector unsigned char reverse = vcprm(3,2,1,0); int i,j; @@ -104,8 +100,6 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa win += len; src0+= len; - vadd.s[0] = add_bias; - vadd_bias = vec_splat(vadd.v, 0); zero = (vector float)vec_splat_u32(0); for(i=-len*4, j=len*4-16; i<0; i+=16, j-=16) { @@ -117,9 +111,9 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa s1 = vec_perm(s1, s1, reverse); wj = vec_perm(wj, wj, reverse); - t0 = vec_madd(s0, wj, vadd_bias); + t0 = vec_madd(s0, wj, zero); t0 = vec_nmsub(s1, wi, t0); - t1 = vec_madd(s0, wi, vadd_bias); + t1 = vec_madd(s0, wi, zero); t1 = vec_madd(s1, wj, t1); t1 = vec_perm(t1, t1, reverse); diff --git a/libavcodec/synth_filter.c b/libavcodec/synth_filter.c index a0ae364d79..4af496d372 100644 --- a/libavcodec/synth_filter.c +++ b/libavcodec/synth_filter.c @@ -24,7 +24,7 @@ static void synth_filter_float(FFTContext *imdct, float *synth_buf_ptr, int *synth_buf_offset, float synth_buf2[32], const float window[512], - float out[32], const float in[32], float scale, float bias) + float out[32], const float in[32], float scale) { float *synth_buf= synth_buf_ptr + *synth_buf_offset; int i, j; @@ -48,8 +48,8 @@ static void synth_filter_float(FFTContext *imdct, c += window[i + j + 32]*( synth_buf[16 + i + j - 512]); d += window[i + j + 48]*( synth_buf[31 - i + j - 512]); } - out[i ] = a*scale + bias; - out[i + 16] = b*scale + bias; + out[i ] = a*scale; + out[i + 16] = b*scale; synth_buf2[i ] = c; synth_buf2[i + 16] = d; } diff --git a/libavcodec/synth_filter.h b/libavcodec/synth_filter.h index d6209d5dba..33edcc437f 100644 --- a/libavcodec/synth_filter.h +++ b/libavcodec/synth_filter.h @@ -28,7 +28,7 @@ typedef struct SynthFilterContext { float *synth_buf_ptr, int *synth_buf_offset, float synth_buf2[32], const float window[512], float out[32], const float in[32], - float scale, float bias); + float scale); } SynthFilterContext; void ff_synth_filter_init(SynthFilterContext *c); diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index 8334e83d7f..bd43104e6e 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -646,7 +646,6 @@ static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype, prev_buf + (bsize-wsize)/2, buf1 + bsize*j, ff_sine_windows[av_log2(wsize)], - 0.0, wsize/2); out2 += wsize; diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index 69b784c668..9fef5eb26f 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -1575,13 +1575,13 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) const float *win = vc->win[blockflag & previous_window]; if (blockflag == previous_window) { - vc->dsp.vector_fmul_window(ret, saved, buf, win, 0, blocksize / 4); + vc->dsp.vector_fmul_window(ret, saved, buf, win, blocksize / 4); } else if (blockflag > previous_window) { - vc->dsp.vector_fmul_window(ret, saved, buf, win, 0, bs0 / 4); + vc->dsp.vector_fmul_window(ret, saved, buf, win, bs0 / 4); memcpy(ret+bs0/2, buf+bs0/4, ((bs1-bs0)/4) * sizeof(float)); } else { memcpy(ret, saved, ((bs1 - bs0) / 4) * sizeof(float)); - vc->dsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - bs0) / 4, buf, win, 0, bs0 / 4); + vc->dsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - bs0) / 4, buf, win, bs0 / 4); } memcpy(saved, buf + blocksize / 4, blocksize / 4 * sizeof(float)); } diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index bb1cd31146..d248ae4ac0 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1031,7 +1031,7 @@ static void wmapro_window(WMAProDecodeCtx *s) winlen >>= 1; s->dsp.vector_fmul_window(start, start, start + winlen, - window, 0, winlen); + window, winlen); s->channel[c].prev_block_len = s->subframe_len; } diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 5ddfecae24..cd8d7471dd 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2190,10 +2190,9 @@ static void vector_fmul_add_sse(float *dst, const float *src0, const float *src1 ); } -static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1, - const float *win, float add_bias, int len){ #if HAVE_6REGS - if(add_bias == 0){ +static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1, + const float *win, int len){ x86_reg i = -len*4; x86_reg j = len*4-8; __asm__ volatile( @@ -2220,15 +2219,10 @@ static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float :"+r"(i), "+r"(j) :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) ); - }else -#endif - ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len); } static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1, - const float *win, float add_bias, int len){ -#if HAVE_6REGS - if(add_bias == 0){ + const float *win, int len){ x86_reg i = -len*4; x86_reg j = len*4-16; __asm__ volatile( @@ -2256,10 +2250,8 @@ static void vector_fmul_window_sse(float *dst, const float *src0, const float *s :"+r"(i), "+r"(j) :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) ); - }else -#endif - ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len); } +#endif /* HAVE_6REGS */ static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul, int len) { @@ -2882,7 +2874,9 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) } if(mm_flags & AV_CPU_FLAG_3DNOWEXT){ c->vector_fmul_reverse = vector_fmul_reverse_3dnow2; +#if HAVE_6REGS c->vector_fmul_window = vector_fmul_window_3dnow2; +#endif if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->float_to_int16_interleave = float_to_int16_interleave_3dn2; } @@ -2899,7 +2893,9 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->vector_fmul = vector_fmul_sse; c->vector_fmul_reverse = vector_fmul_reverse_sse; c->vector_fmul_add = vector_fmul_add_sse; +#if HAVE_6REGS c->vector_fmul_window = vector_fmul_window_sse; +#endif c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse; c->vector_clipf = vector_clipf_sse; c->float_to_int16 = float_to_int16_sse; From d19b744a36987e1dd0c3239a2e1baa1e71d07a77 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 31 Jan 2011 19:26:03 +0000 Subject: [PATCH 185/528] cosmetics: indentation Signed-off-by: Mans Rullgard --- libavcodec/x86/dsputil_mmx.c | 106 +++++++++++++++++------------------ 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index cd8d7471dd..8257b3fa8a 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2193,63 +2193,63 @@ static void vector_fmul_add_sse(float *dst, const float *src0, const float *src1 #if HAVE_6REGS static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1, const float *win, int len){ - x86_reg i = -len*4; - x86_reg j = len*4-8; - __asm__ volatile( - "1: \n" - "pswapd (%5,%1), %%mm1 \n" - "movq (%5,%0), %%mm0 \n" - "pswapd (%4,%1), %%mm5 \n" - "movq (%3,%0), %%mm4 \n" - "movq %%mm0, %%mm2 \n" - "movq %%mm1, %%mm3 \n" - "pfmul %%mm4, %%mm2 \n" // src0[len+i]*win[len+i] - "pfmul %%mm5, %%mm3 \n" // src1[ j]*win[len+j] - "pfmul %%mm4, %%mm1 \n" // src0[len+i]*win[len+j] - "pfmul %%mm5, %%mm0 \n" // src1[ j]*win[len+i] - "pfadd %%mm3, %%mm2 \n" - "pfsub %%mm0, %%mm1 \n" - "pswapd %%mm2, %%mm2 \n" - "movq %%mm1, (%2,%0) \n" - "movq %%mm2, (%2,%1) \n" - "sub $8, %1 \n" - "add $8, %0 \n" - "jl 1b \n" - "femms \n" - :"+r"(i), "+r"(j) - :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) - ); + x86_reg i = -len*4; + x86_reg j = len*4-8; + __asm__ volatile( + "1: \n" + "pswapd (%5,%1), %%mm1 \n" + "movq (%5,%0), %%mm0 \n" + "pswapd (%4,%1), %%mm5 \n" + "movq (%3,%0), %%mm4 \n" + "movq %%mm0, %%mm2 \n" + "movq %%mm1, %%mm3 \n" + "pfmul %%mm4, %%mm2 \n" // src0[len+i]*win[len+i] + "pfmul %%mm5, %%mm3 \n" // src1[ j]*win[len+j] + "pfmul %%mm4, %%mm1 \n" // src0[len+i]*win[len+j] + "pfmul %%mm5, %%mm0 \n" // src1[ j]*win[len+i] + "pfadd %%mm3, %%mm2 \n" + "pfsub %%mm0, %%mm1 \n" + "pswapd %%mm2, %%mm2 \n" + "movq %%mm1, (%2,%0) \n" + "movq %%mm2, (%2,%1) \n" + "sub $8, %1 \n" + "add $8, %0 \n" + "jl 1b \n" + "femms \n" + :"+r"(i), "+r"(j) + :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) + ); } static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1, const float *win, int len){ - x86_reg i = -len*4; - x86_reg j = len*4-16; - __asm__ volatile( - "1: \n" - "movaps (%5,%1), %%xmm1 \n" - "movaps (%5,%0), %%xmm0 \n" - "movaps (%4,%1), %%xmm5 \n" - "movaps (%3,%0), %%xmm4 \n" - "shufps $0x1b, %%xmm1, %%xmm1 \n" - "shufps $0x1b, %%xmm5, %%xmm5 \n" - "movaps %%xmm0, %%xmm2 \n" - "movaps %%xmm1, %%xmm3 \n" - "mulps %%xmm4, %%xmm2 \n" // src0[len+i]*win[len+i] - "mulps %%xmm5, %%xmm3 \n" // src1[ j]*win[len+j] - "mulps %%xmm4, %%xmm1 \n" // src0[len+i]*win[len+j] - "mulps %%xmm5, %%xmm0 \n" // src1[ j]*win[len+i] - "addps %%xmm3, %%xmm2 \n" - "subps %%xmm0, %%xmm1 \n" - "shufps $0x1b, %%xmm2, %%xmm2 \n" - "movaps %%xmm1, (%2,%0) \n" - "movaps %%xmm2, (%2,%1) \n" - "sub $16, %1 \n" - "add $16, %0 \n" - "jl 1b \n" - :"+r"(i), "+r"(j) - :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) - ); + x86_reg i = -len*4; + x86_reg j = len*4-16; + __asm__ volatile( + "1: \n" + "movaps (%5,%1), %%xmm1 \n" + "movaps (%5,%0), %%xmm0 \n" + "movaps (%4,%1), %%xmm5 \n" + "movaps (%3,%0), %%xmm4 \n" + "shufps $0x1b, %%xmm1, %%xmm1 \n" + "shufps $0x1b, %%xmm5, %%xmm5 \n" + "movaps %%xmm0, %%xmm2 \n" + "movaps %%xmm1, %%xmm3 \n" + "mulps %%xmm4, %%xmm2 \n" // src0[len+i]*win[len+i] + "mulps %%xmm5, %%xmm3 \n" // src1[ j]*win[len+j] + "mulps %%xmm4, %%xmm1 \n" // src0[len+i]*win[len+j] + "mulps %%xmm5, %%xmm0 \n" // src1[ j]*win[len+i] + "addps %%xmm3, %%xmm2 \n" + "subps %%xmm0, %%xmm1 \n" + "shufps $0x1b, %%xmm2, %%xmm2 \n" + "movaps %%xmm1, (%2,%0) \n" + "movaps %%xmm2, (%2,%1) \n" + "sub $16, %1 \n" + "add $16, %0 \n" + "jl 1b \n" + :"+r"(i), "+r"(j) + :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) + ); } #endif /* HAVE_6REGS */ From a0f9c8ce372c3943104672f8fd7ba2bcf9a5e157 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 31 Jan 2011 22:51:23 +0000 Subject: [PATCH 186/528] Auto-generate dependencies for documentation Signed-off-by: Mans Rullgard --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 2658a30dc5..fb9d8a494e 100644 --- a/Makefile +++ b/Makefile @@ -112,22 +112,22 @@ version.h .version: alltools: $(TOOLS) -documentation: $(addprefix doc/, developer.html faq.html general.html libavfilter.html \ - $(ALLHTMLPAGES) $(ALLMANPAGES)) +DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html $(ALLHTMLPAGES) $(ALLMANPAGES)) -$(HTMLPAGES) $(PODPAGES): doc/fftools-common-opts.texi +documentation: $(DOCS) -doc/ffmpeg.pod doc/ffmpeg.html: doc/demuxers.texi doc/bitstream_filters.texi doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi doc/metadata.texi -doc/ffplay.pod doc/ffplay.html: doc/demuxers.texi doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi -doc/ffprobe.pod doc/ffprobe.html: doc/demuxers.texi doc/indevs.texi doc/protocols.texi -doc/libavfilter.html: doc/filters.texi +-include $(wildcard $(DOCS:%=%.d)) + +TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d) doc/%.html: TAG = HTML doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init + $(Q)$(TEXIDEP) $(M)cd doc && texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init $(<:doc/%=%) doc/%.pod: TAG = POD doc/%.pod: doc/%.texi + $(Q)$(TEXIDEP) $(M)doc/texi2pod.pl $< $@ doc/%.1: TAG = MAN From 81f2a3f4ffcc6935b8b8ada4954700b3f333ae4f Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 31 Jan 2011 20:55:56 -0500 Subject: [PATCH 187/528] Implement a SIMD version of emulated_edge_mc() for x86. From ~550 cycles (C version) to 170 (SSE/x86-64), 206 (MMX/x86-32) and 196 (SSE2/x86-32) cycles. --- libavcodec/x86/dsputil_mmx.c | 110 ++++++- libavcodec/x86/dsputil_yasm.asm | 560 ++++++++++++++++++++++++++++++++ 2 files changed, 667 insertions(+), 3 deletions(-) diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 8257b3fa8a..2eb7d85f14 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -1664,8 +1664,80 @@ QPEL_2TAP(avg_, 8, 3dnow) static void just_return(void) { return; } #endif -static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height){ +#if HAVE_YASM +typedef void emu_edge_core_func (uint8_t *buf, const uint8_t *src, + x86_reg linesize, x86_reg start_y, + x86_reg end_y, x86_reg block_h, + x86_reg start_x, x86_reg end_x, + x86_reg block_w); +extern emu_edge_core_func ff_emu_edge_core_mmx; +extern emu_edge_core_func ff_emu_edge_core_sse; + +static av_always_inline +void emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize, + int block_w, int block_h, + int src_x, int src_y, int w, int h, + emu_edge_core_func *core_fn) +{ + int start_y, start_x, end_y, end_x, src_y_add=0; + + if(src_y>= h){ + src_y_add = h-1-src_y; + src_y=h-1; + }else if(src_y<=-block_h){ + src_y_add = 1-block_h-src_y; + src_y=1-block_h; + } + if(src_x>= w){ + src+= (w-1-src_x); + src_x=w-1; + }else if(src_x<=-block_w){ + src+= (1-block_w-src_x); + src_x=1-block_w; + } + + start_y= FFMAX(0, -src_y); + start_x= FFMAX(0, -src_x); + end_y= FFMIN(block_h, h-src_y); + end_x= FFMIN(block_w, w-src_x); + assert(start_x < end_x && block_w > 0); + assert(start_y < end_y && block_h > 0); + + // fill in the to-be-copied part plus all above/below + src += (src_y_add+start_y)*linesize + start_x; + buf += start_x; + core_fn(buf, src, linesize, start_y, end_y, block_h, start_x, end_x, block_w); +} + +#if ARCH_X86_32 +static av_noinline +void emulated_edge_mc_mmx(uint8_t *buf, const uint8_t *src, int linesize, + int block_w, int block_h, + int src_x, int src_y, int w, int h) +{ + emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y, + w, h, &ff_emu_edge_core_mmx); +} +#endif +static av_noinline +void emulated_edge_mc_sse(uint8_t *buf, const uint8_t *src, int linesize, + int block_w, int block_h, + int src_x, int src_y, int w, int h) +{ + emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y, + w, h, &ff_emu_edge_core_sse); +} +#endif /* HAVE_YASM */ + +typedef void emulated_edge_mc_func (uint8_t *dst, const uint8_t *src, + int linesize, int block_w, int block_h, + int src_x, int src_y, int w, int h); + +static av_always_inline +void gmc(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, + int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height, + emulated_edge_mc_func *emu_edge_fn) +{ const int w = 8; const int ix = ox>>(16+shift); const int iy = oy>>(16+shift); @@ -1701,7 +1773,7 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o if( (unsigned)ix >= width-w || (unsigned)iy >= height-h ) { - ff_emulated_edge_mc(edge_buf, src, stride, w+1, h+1, ix, iy, width, height); + emu_edge_fn(edge_buf, src, stride, w+1, h+1, ix, iy, width, height); src = edge_buf; } @@ -1782,6 +1854,30 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o } } +#if HAVE_YASM +#if ARCH_X86_32 +static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, + int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) +{ + gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, + width, height, &emulated_edge_mc_mmx); +} +#endif +static void gmc_sse(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, + int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) +{ + gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, + width, height, &emulated_edge_mc_sse); +} +#else +static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, + int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) +{ + gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, + width, height, &ff_emulated_edge_mc); +} +#endif + #define PREFETCH(name, op) \ static void name(void *mem, int stride, int h){\ const uint8_t *p= mem;\ @@ -2626,7 +2722,12 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) SET_HPEL_FUNCS(avg, 1, 8, mmx); SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx); +#if ARCH_X86_32 || !HAVE_YASM c->gmc= gmc_mmx; +#endif +#if ARCH_X86_32 && HAVE_YASM + c->emulated_edge_mc = emulated_edge_mc_mmx; +#endif c->add_bytes= add_bytes_mmx; c->add_bytes_l2= add_bytes_l2_mmx; @@ -2913,6 +3014,9 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #if HAVE_YASM c->scalarproduct_int16 = ff_scalarproduct_int16_sse2; c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2; + + c->emulated_edge_mc = emulated_edge_mc_sse; + c->gmc= gmc_sse; #endif } if((mm_flags & AV_CPU_FLAG_SSSE3) && !(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW)) && HAVE_YASM) // cachesplit diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm index bda04727db..099f0a80df 100644 --- a/libavcodec/x86/dsputil_yasm.asm +++ b/libavcodec/x86/dsputil_yasm.asm @@ -421,3 +421,563 @@ cglobal scalarproduct_float_sse, 3,3,2, v1, v2, offset fld dword r0m %endif RET + +; extern void ff_emu_edge_core(uint8_t *buf, const uint8_t *src, x86_reg linesize, +; x86_reg start_y, x86_reg end_y, x86_reg block_h, +; x86_reg start_x, x86_reg end_x, x86_reg block_w); +; +; The actual function itself is below. It basically wraps a very simple +; w = end_x - start_x +; if (w) { +; if (w > 22) { +; jump to the slow loop functions +; } else { +; jump to the fast loop functions +; } +; } +; +; ... and then the same for left/right extend also. See below for loop +; function implementations. Fast are fixed-width, slow is variable-width + +%macro EMU_EDGE_FUNC 1 +%ifdef ARCH_X86_64 +%define w_reg r10 +cglobal emu_edge_core_%1, 6, 7, 1 + mov r11, r5 ; save block_h +%else +%define w_reg r6 +cglobal emu_edge_core_%1, 2, 7, 0 + mov r4, r4m ; end_y + mov r5, r5m ; block_h +%endif + + ; start with vertical extend (top/bottom) and body pixel copy + mov w_reg, r7m + sub w_reg, r6m ; w = start_x - end_x + sub r5, r4 +%ifdef ARCH_X86_64 + sub r4, r3 +%else + sub r4, dword r3m +%endif + cmp w_reg, 22 + jg .slow_v_extend_loop +%ifdef ARCH_X86_32 + mov r2, r2m ; linesize +%endif + sal w_reg, 7 ; w * 128 +%ifdef PIC + lea rax, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)] + add w_reg, rax +%else + lea w_reg, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)+w_reg] +%endif + call w_reg ; fast top extend, body copy and bottom extend +.v_extend_end: + + ; horizontal extend (left/right) + mov w_reg, r6m ; start_x + sub r0, w_reg +%ifdef ARCH_X86_64 + mov r3, r0 ; backup of buf+block_h*linesize + mov r5, r11 +%else + mov r0m, r0 ; backup of buf+block_h*linesize + mov r5, r5m +%endif + test w_reg, w_reg + jz .right_extend + cmp w_reg, 22 + jg .slow_left_extend_loop + mov r1, w_reg + dec w_reg + ; FIXME we can do a if size == 1 here if that makes any speed difference, test me + sar w_reg, 1 + sal w_reg, 6 + ; r0=buf+block_h*linesize,r10(64)/r6(32)=start_x offset for funcs + ; r6(rax)/r3(ebx)=val,r2=linesize,r1=start_x,r5=block_h +%ifdef PIC + lea rax, [.emuedge_extend_left_2] + add w_reg, rax +%else + lea w_reg, [.emuedge_extend_left_2+w_reg] +%endif + call w_reg + + ; now r3(64)/r0(32)=buf,r2=linesize,r11/r5=block_h,r6/r3=val, r10/r6=end_x, r1=block_w +.right_extend: +%ifdef ARCH_X86_32 + mov r0, r0m + mov r5, r5m +%endif + mov w_reg, r7m ; end_x + mov r1, r8m ; block_w + mov r4, r1 + sub r1, w_reg + jz .h_extend_end ; if (end_x == block_w) goto h_extend_end + cmp r1, 22 + jg .slow_right_extend_loop + dec r1 + ; FIXME we can do a if size == 1 here if that makes any speed difference, test me + sar r1, 1 + sal r1, 6 +%ifdef PIC + lea rax, [.emuedge_extend_right_2] + add r1, rax +%else + lea r1, [.emuedge_extend_right_2+r1] +%endif + call r1 +.h_extend_end: + RET + +%ifdef ARCH_X86_64 +%define vall al +%define valh ah +%define valw ax +%define valw2 r10w +%define valw3 r3w +%define vald eax +%else +%define vall bl +%define valh bh +%define valw bx +%define valw2 r6w +%define valw3 valw2 +%define vald ebx +%define stack_offset 0x14 +%endif + +%endmacro + +; macro to read/write a horizontal number of pixels (%2) to/from registers +; on x86-64, - fills xmm0-15 for consecutive sets of 16 pixels +; - if (%2 & 15 == 8) fills the last 8 bytes into rax +; - else if (%2 & 8) fills 8 bytes into mm0 +; - if (%2 & 7 == 4) fills the last 4 bytes into rax +; - else if (%2 & 4) fills 4 bytes into mm0-1 +; - if (%2 & 3 == 3) fills 2 bytes into r10/r3, and 1 into eax +; (note that we're using r3 for body/bottom because it's a shorter +; opcode, and then the loop fits in 128 bytes) +; - else fills remaining bytes into rax +; on x86-32, - fills mm0-7 for consecutive sets of 8 pixels +; - if (%2 & 7 == 4) fills 4 bytes into ebx +; - else if (%2 & 4) fills 4 bytes into mm0-7 +; - if (%2 & 3 == 3) fills 2 bytes into r6, and 1 into ebx +; - else fills remaining bytes into ebx +; writing data out is in the same way +%macro READ_NUM_BYTES 3 +%assign %%src_off 0 ; offset in source buffer +%assign %%smidx 0 ; mmx register idx +%assign %%sxidx 0 ; xmm register idx + +%ifnidn %3, mmx +%rep %2/16 + movdqu xmm %+ %%sxidx, [r1+%%src_off] +%assign %%src_off %%src_off+16 +%assign %%sxidx %%sxidx+1 +%endrep ; %2/16 +%endif ; !mmx + +%ifdef ARCH_X86_64 +%if (%2-%%src_off) == 8 + mov rax, [r1+%%src_off] +%assign %%src_off %%src_off+8 +%endif ; (%2-%%src_off) == 8 +%endif ; x86-64 + +%rep (%2-%%src_off)/8 + movq mm %+ %%smidx, [r1+%%src_off] +%assign %%src_off %%src_off+8 +%assign %%smidx %%smidx+1 +%endrep ; (%2-%%dst_off)/8 + +%if (%2-%%src_off) == 4 + mov vald, [r1+%%src_off] +%elif (%2-%%src_off) & 4 + movd mm %+ %%smidx, [r1+%%src_off] +%assign %%src_off %%src_off+4 +%endif ; (%2-%%src_off) ==/& 4 + +%if (%2-%%src_off) == 1 + mov vall, [r1+%%src_off] +%elif (%2-%%src_off) == 2 + mov valw, [r1+%%src_off] +%elif (%2-%%src_off) == 3 +%ifidn %1, top + mov valw2, [r1+%%src_off] +%else ; %1 != top + mov valw3, [r1+%%src_off] +%endif ; %1 ==/!= top + mov vall, [r1+%%src_off+2] +%endif ; (%2-%%src_off) == 1/2/3 +%endmacro ; READ_NUM_BYTES + +%macro WRITE_NUM_BYTES 3 +%assign %%dst_off 0 ; offset in destination buffer +%assign %%dmidx 0 ; mmx register idx +%assign %%dxidx 0 ; xmm register idx + +%ifnidn %3, mmx +%rep %2/16 + movdqu [r0+%%dst_off], xmm %+ %%dxidx +%assign %%dst_off %%dst_off+16 +%assign %%dxidx %%dxidx+1 +%endrep ; %2/16 +%endif + +%ifdef ARCH_X86_64 +%if (%2-%%dst_off) == 8 + mov [r0+%%dst_off], rax +%assign %%dst_off %%dst_off+8 +%endif ; (%2-%%dst_off) == 8 +%endif ; x86-64 + +%rep (%2-%%dst_off)/8 + movq [r0+%%dst_off], mm %+ %%dmidx +%assign %%dst_off %%dst_off+8 +%assign %%dmidx %%dmidx+1 +%endrep ; (%2-%%dst_off)/8 + +%if (%2-%%dst_off) == 4 + mov [r0+%%dst_off], vald +%elif (%2-%%dst_off) & 4 + movd [r0+%%dst_off], mm %+ %%dmidx +%assign %%dst_off %%dst_off+4 +%endif ; (%2-%%dst_off) ==/& 4 + +%if (%2-%%dst_off) == 1 + mov [r0+%%dst_off], vall +%elif (%2-%%dst_off) == 2 + mov [r0+%%dst_off], valw +%elif (%2-%%dst_off) == 3 +%ifidn %1, top + mov [r0+%%dst_off], valw2 +%else ; %1 != top + mov [r0+%%dst_off], valw3 +%endif ; %1 ==/!= top + mov [r0+%%dst_off+2], vall +%endif ; (%2-%%dst_off) == 1/2/3 +%endmacro ; WRITE_NUM_BYTES + +; vertical top/bottom extend and body copy fast loops +; these are function pointers to set-width line copy functions, i.e. +; they read a fixed number of pixels into set registers, and write +; those out into the destination buffer +; r0=buf,r1=src,r2=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h +; r6(eax/64)/r3(ebx/32)=val_reg +%macro VERTICAL_EXTEND 1 +%assign %%n 1 +%rep 22 +ALIGN 128 +.emuedge_v_extend_ %+ %%n: + ; extend pixels above body +%ifdef ARCH_X86_64 + test r3 , r3 ; if (!start_y) + jz .emuedge_copy_body_ %+ %%n %+ _loop ; goto body +%else ; ARCH_X86_32 + cmp dword r3m, 0 + je .emuedge_copy_body_ %+ %%n %+ _loop +%endif ; ARCH_X86_64/32 + READ_NUM_BYTES top, %%n, %1 ; read bytes +.emuedge_extend_top_ %+ %%n %+ _loop: ; do { + WRITE_NUM_BYTES top, %%n, %1 ; write bytes + add r0 , r2 ; dst += linesize +%ifdef ARCH_X86_64 + dec r3 +%else ; ARCH_X86_32 + dec dword r3m +%endif ; ARCH_X86_64/32 + jnz .emuedge_extend_top_ %+ %%n %+ _loop ; } while (--start_y) + + ; copy body pixels +.emuedge_copy_body_ %+ %%n %+ _loop: ; do { + READ_NUM_BYTES body, %%n, %1 ; read bytes + WRITE_NUM_BYTES body, %%n, %1 ; write bytes + add r0 , r2 ; dst += linesize + add r1 , r2 ; src += linesize + dec r4 + jnz .emuedge_copy_body_ %+ %%n %+ _loop ; } while (--end_y) + + ; copy bottom pixels + test r5 , r5 ; if (!block_h) + jz .emuedge_v_extend_end_ %+ %%n ; goto end + sub r1 , r2 ; src -= linesize + READ_NUM_BYTES bottom, %%n, %1 ; read bytes +.emuedge_extend_bottom_ %+ %%n %+ _loop: ; do { + WRITE_NUM_BYTES bottom, %%n, %1 ; write bytes + add r0 , r2 ; dst += linesize + dec r5 + jnz .emuedge_extend_bottom_ %+ %%n %+ _loop ; } while (--block_h) + +.emuedge_v_extend_end_ %+ %%n: +%ifdef ARCH_X86_64 + ret +%else ; ARCH_X86_32 + rep ret +%endif ; ARCH_X86_64/32 +%assign %%n %%n+1 +%endrep +%endmacro VERTICAL_EXTEND + +; left/right (horizontal) fast extend functions +; these are essentially identical to the vertical extend ones above, +; just left/right separated because number of pixels to extend is +; obviously not the same on both sides. +; for reading, pixels are placed in eax (x86-64) or ebx (x86-64) in the +; lowest two bytes of the register (so val*0x0101), and are splatted +; into each byte of mm0 as well if n_pixels >= 8 + +%macro READ_V_PIXEL 3 + mov vall, %2 + mov valh, vall +%if %1 >= 8 + movd mm0, vald +%ifidn %3, mmx + punpcklwd mm0, mm0 + punpckldq mm0, mm0 +%else ; !mmx + pshufw mm0, mm0, 0 +%endif ; mmx +%endif ; %1 >= 8 +%endmacro + +%macro WRITE_V_PIXEL 2 +%assign %%dst_off 0 +%rep %1/8 + movq [%2+%%dst_off], mm0 +%assign %%dst_off %%dst_off+8 +%endrep +%if %1 & 4 +%if %1 >= 8 + movd [%2+%%dst_off], mm0 +%else ; %1 < 8 + mov [%2+%%dst_off] , valw + mov [%2+%%dst_off+2], valw +%endif ; %1 >=/< 8 +%assign %%dst_off %%dst_off+4 +%endif ; %1 & 4 +%if %1&2 + mov [%2+%%dst_off], valw +%endif ; %1 & 2 +%endmacro + +; r0=buf+block_h*linesize, r1=start_x, r2=linesize, r5=block_h, r6/r3=val +%macro LEFT_EXTEND 1 +%assign %%n 2 +%rep 11 +ALIGN 64 +.emuedge_extend_left_ %+ %%n: ; do { + sub r0, r2 ; dst -= linesize + READ_V_PIXEL %%n, [r0+r1], %1 ; read pixels + WRITE_V_PIXEL %%n, r0 ; write pixels + dec r5 + jnz .emuedge_extend_left_ %+ %%n ; } while (--block_h) +%ifdef ARCH_X86_64 + ret +%else ; ARCH_X86_32 + rep ret +%endif ; ARCH_X86_64/32 +%assign %%n %%n+2 +%endrep +%endmacro ; LEFT_EXTEND + +; r3/r0=buf+block_h*linesize, r2=linesize, r11/r5=block_h, r0/r6=end_x, r6/r3=val +%macro RIGHT_EXTEND 1 +%assign %%n 2 +%rep 11 +ALIGN 64 +.emuedge_extend_right_ %+ %%n: ; do { +%ifdef ARCH_X86_64 + sub r3, r2 ; dst -= linesize + READ_V_PIXEL %%n, [r3+w_reg-1], %1 ; read pixels + WRITE_V_PIXEL %%n, r3+r4-%%n ; write pixels + dec r11 +%else ; ARCH_X86_32 + sub r0, r2 ; dst -= linesize + READ_V_PIXEL %%n, [r0+w_reg-1], %1 ; read pixels + WRITE_V_PIXEL %%n, r0+r4-%%n ; write pixels + dec r5 +%endif ; ARCH_X86_64/32 + jnz .emuedge_extend_right_ %+ %%n ; } while (--block_h) +%ifdef ARCH_X86_64 + ret +%else ; ARCH_X86_32 + rep ret +%endif ; ARCH_X86_64/32 +%assign %%n %%n+2 +%endrep + +%ifdef ARCH_X86_32 +%define stack_offset 0x10 +%endif +%endmacro ; RIGHT_EXTEND + +; below follow the "slow" copy/extend functions, these act on a non-fixed +; width specified in a register, and run a loop to copy the full amount +; of bytes. They are optimized for copying of large amounts of pixels per +; line, so they unconditionally splat data into mm registers to copy 8 +; bytes per loop iteration. It could be considered to use xmm for x86-64 +; also, but I haven't optimized this as much (i.e. FIXME) +%macro V_COPY_NPX 4-5 +%if %0 == 4 + test w_reg, %4 + jz .%1_skip_%4_px +%else ; %0 == 5 +.%1_%4_px_loop: +%endif + %3 %2, [r1+cnt_reg] + %3 [r0+cnt_reg], %2 + add cnt_reg, %4 +%if %0 == 5 + sub w_reg, %4 + test w_reg, %5 + jnz .%1_%4_px_loop +%endif +.%1_skip_%4_px: +%endmacro + +%macro V_COPY_ROW 3 +%ifidn %1, bottom + sub r1, linesize +%endif +.%1_copy_loop: + xor cnt_reg, cnt_reg +%ifidn %3, mmx +%define linesize r2m + V_COPY_NPX %1, mm0, movq, 8, 0xFFFFFFF8 +%else ; !mmx + V_COPY_NPX %1, xmm0, movdqu, 16, 0xFFFFFFF0 +%ifdef ARCH_X86_64 +%define linesize r2 + V_COPY_NPX %1, rax , mov, 8 +%else ; ARCH_X86_32 +%define linesize r2m + V_COPY_NPX %1, mm0, movq, 8 +%endif ; ARCH_X86_64/32 +%endif ; mmx + V_COPY_NPX %1, vald, mov, 4 + V_COPY_NPX %1, valw, mov, 2 + V_COPY_NPX %1, vall, mov, 1 + mov w_reg, cnt_reg +%ifidn %1, body + add r1, linesize +%endif + add r0, linesize + dec %2 + jnz .%1_copy_loop +%endmacro + +%macro SLOW_V_EXTEND 1 +.slow_v_extend_loop: +; r0=buf,r1=src,r2(64)/r2m(32)=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h +; r11(64)/r3(later-64)/r2(32)=cnt_reg,r6(64)/r3(32)=val_reg,r10(64)/r6(32)=w=end_x-start_x +%ifdef ARCH_X86_64 + push r11 ; save old value of block_h + test r3, r3 +%define cnt_reg r11 + jz .do_body_copy ; if (!start_y) goto do_body_copy + V_COPY_ROW top, r3, %1 +%else + cmp dword r3m, 0 +%define cnt_reg r2 + je .do_body_copy ; if (!start_y) goto do_body_copy + V_COPY_ROW top, dword r3m, %1 +%endif + +.do_body_copy: + V_COPY_ROW body, r4, %1 + +%ifdef ARCH_X86_64 + pop r11 ; restore old value of block_h +%define cnt_reg r3 +%endif + test r5, r5 +%ifdef ARCH_X86_64 + jz .v_extend_end +%else + jz .skip_bottom_extend +%endif + V_COPY_ROW bottom, r5, %1 +%ifdef ARCH_X86_32 +.skip_bottom_extend: + mov r2, r2m +%endif + jmp .v_extend_end +%endmacro + +%macro SLOW_LEFT_EXTEND 1 +.slow_left_extend_loop: +; r0=buf+block_h*linesize,r2=linesize,r6(64)/r3(32)=val,r5=block_h,r4=cntr,r10/r6=start_x + mov r4, 8 + sub r0, linesize + READ_V_PIXEL 8, [r0+w_reg], %1 +.left_extend_8px_loop: + movq [r0+r4-8], mm0 + add r4, 8 + cmp r4, w_reg + jle .left_extend_8px_loop + sub r4, 8 + cmp r4, w_reg + jge .left_extend_loop_end +.left_extend_2px_loop: + mov [r0+r4], valw + add r4, 2 + cmp r4, w_reg + jl .left_extend_2px_loop +.left_extend_loop_end: + dec r5 + jnz .slow_left_extend_loop +%ifdef ARCH_X86_32 + mov r2, r2m +%endif + jmp .right_extend +%endmacro + +%macro SLOW_RIGHT_EXTEND 1 +.slow_right_extend_loop: +; r3(64)/r0(32)=buf+block_h*linesize,r2=linesize,r4=block_w,r11(64)/r5(32)=block_h, +; r10(64)/r6(32)=end_x,r6/r3=val,r1=cntr +%ifdef ARCH_X86_64 +%define buf_reg r3 +%define bh_reg r11 +%else +%define buf_reg r0 +%define bh_reg r5 +%endif + lea r1, [r4-8] + sub buf_reg, linesize + READ_V_PIXEL 8, [buf_reg+w_reg-1], %1 +.right_extend_8px_loop: + movq [buf_reg+r1], mm0 + sub r1, 8 + cmp r1, w_reg + jge .right_extend_8px_loop + add r1, 8 + cmp r1, w_reg + je .right_extend_loop_end +.right_extend_2px_loop: + sub r1, 2 + mov [buf_reg+r1], valw + cmp r1, w_reg + jg .right_extend_2px_loop +.right_extend_loop_end: + dec bh_reg + jnz .slow_right_extend_loop + jmp .h_extend_end +%endmacro + +%macro emu_edge 1 +EMU_EDGE_FUNC %1 +VERTICAL_EXTEND %1 +LEFT_EXTEND %1 +RIGHT_EXTEND %1 +SLOW_V_EXTEND %1 +SLOW_LEFT_EXTEND %1 +SLOW_RIGHT_EXTEND %1 +%endmacro + +emu_edge sse +%ifdef ARCH_X86_32 +emu_edge mmx +%endif From 64233e702a95df9167e3362e58aae4e82ce2ddf8 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Mon, 31 Jan 2011 19:04:29 -0800 Subject: [PATCH 188/528] VP8: merge chroma MC calls Adds some duplicated code, but avoids duplicate edge checks and similar. ~0.5% faster overall on Parkjoy test sample. --- libavcodec/vp8.c | 125 ++++++++++++++++++++++++++++++----------------- 1 file changed, 79 insertions(+), 46 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index d2f55d90f3..effeb4ed2f 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1193,6 +1193,13 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, s->filter.simple, 0); } +static const uint8_t subpel_idx[3][8] = { + { 0, 1, 2, 1, 2, 1, 2, 1 }, // nr. of left extra pixels, + // also function pointer index + { 0, 3, 5, 3, 5, 3, 5, 3 }, // nr. of extra pixels required + { 0, 2, 3, 2, 3, 2, 3, 2 }, // nr. of right extra pixels +}; + /** * Generic MC function. * @@ -1211,32 +1218,26 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, * @param mc_func motion compensation function pointers (bilinear or sixtap MC) */ static av_always_inline -void vp8_mc(VP8Context *s, int luma, - uint8_t *dst, uint8_t *src, const VP56mv *mv, - int x_off, int y_off, int block_w, int block_h, - int width, int height, int linesize, - vp8_mc_func mc_func[3][3]) +void vp8_mc_luma(VP8Context *s, uint8_t *dst, uint8_t *src, const VP56mv *mv, + int x_off, int y_off, int block_w, int block_h, + int width, int height, int linesize, + vp8_mc_func mc_func[3][3]) { if (AV_RN32A(mv)) { - static const uint8_t idx[3][8] = { - { 0, 1, 2, 1, 2, 1, 2, 1 }, // nr. of left extra pixels, - // also function pointer index - { 0, 3, 5, 3, 5, 3, 5, 3 }, // nr. of extra pixels required - { 0, 2, 3, 2, 3, 2, 3, 2 }, // nr. of right extra pixels - }; - int mx = (mv->x << luma)&7, mx_idx = idx[0][mx]; - int my = (mv->y << luma)&7, my_idx = idx[0][my]; - x_off += mv->x >> (3 - luma); - y_off += mv->y >> (3 - luma); + int mx = (mv->x << 1)&7, mx_idx = subpel_idx[0][mx]; + int my = (mv->y << 1)&7, my_idx = subpel_idx[0][my]; + + x_off += mv->x >> 2; + y_off += mv->y >> 2; // edge emulation src += y_off * linesize + x_off; - if (x_off < mx_idx || x_off >= width - block_w - idx[2][mx] || - y_off < my_idx || y_off >= height - block_h - idx[2][my]) { + if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] || + y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) { s->dsp.emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize, - block_w + idx[1][mx], block_h + idx[1][my], - x_off - mx_idx, y_off - my_idx, width, height); + block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my], + x_off - mx_idx, y_off - my_idx, width, height); src = s->edge_emu_buffer + mx_idx + linesize * my_idx; } mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my); @@ -1244,6 +1245,45 @@ void vp8_mc(VP8Context *s, int luma, mc_func[0][0](dst, linesize, src + y_off * linesize + x_off, linesize, block_h, 0, 0); } +static av_always_inline +void vp8_mc_chroma(VP8Context *s, uint8_t *dst1, uint8_t *dst2, uint8_t *src1, + uint8_t *src2, const VP56mv *mv, int x_off, int y_off, + int block_w, int block_h, int width, int height, int linesize, + vp8_mc_func mc_func[3][3]) +{ + if (AV_RN32A(mv)) { + int mx = mv->x&7, mx_idx = subpel_idx[0][mx]; + int my = mv->y&7, my_idx = subpel_idx[0][my]; + + x_off += mv->x >> 3; + y_off += mv->y >> 3; + + // edge emulation + src1 += y_off * linesize + x_off; + src2 += y_off * linesize + x_off; + if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] || + y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) { + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src1 - my_idx * linesize - mx_idx, linesize, + block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my], + x_off - mx_idx, y_off - my_idx, width, height); + src1 = s->edge_emu_buffer + mx_idx + linesize * my_idx; + mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my); + + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src2 - my_idx * linesize - mx_idx, linesize, + block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my], + x_off - mx_idx, y_off - my_idx, width, height); + src2 = s->edge_emu_buffer + mx_idx + linesize * my_idx; + mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my); + } else { + mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my); + mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my); + } + } else { + mc_func[0][0](dst1, linesize, src1 + y_off * linesize + x_off, linesize, block_h, 0, 0); + mc_func[0][0](dst2, linesize, src2 + y_off * linesize + x_off, linesize, block_h, 0, 0); + } +} + static av_always_inline void vp8_mc_part(VP8Context *s, uint8_t *dst[3], AVFrame *ref_frame, int x_off, int y_off, @@ -1254,10 +1294,10 @@ void vp8_mc_part(VP8Context *s, uint8_t *dst[3], VP56mv uvmv = *mv; /* Y */ - vp8_mc(s, 1, dst[0] + by_off * s->linesize + bx_off, - ref_frame->data[0], mv, x_off + bx_off, y_off + by_off, - block_w, block_h, width, height, s->linesize, - s->put_pixels_tab[block_w == 8]); + vp8_mc_luma(s, dst[0] + by_off * s->linesize + bx_off, + ref_frame->data[0], mv, x_off + bx_off, y_off + by_off, + block_w, block_h, width, height, s->linesize, + s->put_pixels_tab[block_w == 8]); /* U/V */ if (s->profile == 3) { @@ -1268,14 +1308,11 @@ void vp8_mc_part(VP8Context *s, uint8_t *dst[3], bx_off >>= 1; by_off >>= 1; width >>= 1; height >>= 1; block_w >>= 1; block_h >>= 1; - vp8_mc(s, 0, dst[1] + by_off * s->uvlinesize + bx_off, - ref_frame->data[1], &uvmv, x_off + bx_off, y_off + by_off, - block_w, block_h, width, height, s->uvlinesize, - s->put_pixels_tab[1 + (block_w == 4)]); - vp8_mc(s, 0, dst[2] + by_off * s->uvlinesize + bx_off, - ref_frame->data[2], &uvmv, x_off + bx_off, y_off + by_off, - block_w, block_h, width, height, s->uvlinesize, - s->put_pixels_tab[1 + (block_w == 4)]); + vp8_mc_chroma(s, dst[1] + by_off * s->uvlinesize + bx_off, + dst[2] + by_off * s->uvlinesize + bx_off, ref_frame->data[1], + ref_frame->data[2], &uvmv, x_off + bx_off, y_off + by_off, + block_w, block_h, width, height, s->uvlinesize, + s->put_pixels_tab[1 + (block_w == 4)]); } /* Fetch pixels for estimated mv 4 macroblocks ahead. @@ -1319,11 +1356,11 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, /* Y */ for (y = 0; y < 4; y++) { for (x = 0; x < 4; x++) { - vp8_mc(s, 1, dst[0] + 4*y*s->linesize + x*4, - ref->data[0], &bmv[4*y + x], - 4*x + x_off, 4*y + y_off, 4, 4, - width, height, s->linesize, - s->put_pixels_tab[2]); + vp8_mc_luma(s, dst[0] + 4*y*s->linesize + x*4, + ref->data[0], &bmv[4*y + x], + 4*x + x_off, 4*y + y_off, 4, 4, + width, height, s->linesize, + s->put_pixels_tab[2]); } } @@ -1345,16 +1382,12 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, uvmv.x &= ~7; uvmv.y &= ~7; } - vp8_mc(s, 0, dst[1] + 4*y*s->uvlinesize + x*4, - ref->data[1], &uvmv, - 4*x + x_off, 4*y + y_off, 4, 4, - width, height, s->uvlinesize, - s->put_pixels_tab[2]); - vp8_mc(s, 0, dst[2] + 4*y*s->uvlinesize + x*4, - ref->data[2], &uvmv, - 4*x + x_off, 4*y + y_off, 4, 4, - width, height, s->uvlinesize, - s->put_pixels_tab[2]); + vp8_mc_chroma(s, dst[1] + 4*y*s->uvlinesize + x*4, + dst[2] + 4*y*s->uvlinesize + x*4, + ref->data[1], ref->data[2], &uvmv, + 4*x + x_off, 4*y + y_off, 4, 4, + width, height, s->uvlinesize, + s->put_pixels_tab[2]); } } break; From 7f939f55bb79f962adc96b6b45e288dbb0069a67 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 1 Feb 2011 02:23:30 +0000 Subject: [PATCH 189/528] Makefile: build docs only for enabled tools; fix docs dependencies This makes "make documentation" build the man/html pages only for the tools enabled in the build. It also fixes the dependency tracking for the built man pages. Signed-off-by: Mans Rullgard --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fb9d8a494e..a2d90cae3e 100644 --- a/Makefile +++ b/Makefile @@ -112,7 +112,7 @@ version.h .version: alltools: $(TOOLS) -DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html $(ALLHTMLPAGES) $(ALLMANPAGES)) +DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES) documentation: $(DOCS) From f3619680a7b14415479376b2c35a481c8f43927e Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 1 Feb 2011 02:24:20 +0000 Subject: [PATCH 190/528] Makefile: remove unused variable ALLHTMLPAGES Signed-off-by: Mans Rullgard --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index a2d90cae3e..356ba29d6e 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,6 @@ BASENAMES = ffmpeg ffplay ffprobe ffserver ALLPROGS = $(BASENAMES:%=%$(EXESUF)) ALLPROGS_G = $(BASENAMES:%=%_g$(EXESUF)) ALLMANPAGES = $(BASENAMES:%=%.1) -ALLHTMLPAGES= $(BASENAMES:%=%.html) FFLIBS-$(CONFIG_AVDEVICE) += avdevice FFLIBS-$(CONFIG_AVFILTER) += avfilter From e86e858111501650bb9ce8e39282e20c57bac913 Mon Sep 17 00:00:00 2001 From: Gianluigi Tiesi Date: Tue, 1 Feb 2011 04:12:26 +0000 Subject: [PATCH 191/528] dca: avoid C99 declaration in for() expression Signed-off-by: Mans Rullgard --- libavcodec/dca.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 3861813556..3a3eb25d0b 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1354,7 +1354,9 @@ static int dca_exss_mask2count(int mask) */ static void dca_exss_skip_mix_coeffs(GetBitContext *gb, int channels, int out_ch) { - for (int i = 0; i < channels; i++) { + int i; + + for (i = 0; i < channels; i++) { int mix_map_mask = get_bits(gb, out_ch); int num_coeffs = av_popcount(mix_map_mask); skip_bits_long(gb, num_coeffs * 6); From fe9a3fbe42ebe5debd57550313ed4c3a065f1770 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Fri, 28 Jan 2011 22:15:47 +0100 Subject: [PATCH 192/528] h264: Add Intra and Constrained Baseline profiles to avctx.profile --- libavcodec/avcodec.h | 23 +++++++++++++++-------- libavcodec/h264.c | 29 ++++++++++++++++++++++++++++- libavcodec/h264.h | 6 ++++++ libavcodec/h264_parser.c | 2 +- libavcodec/h264_ps.c | 11 ++++++----- 5 files changed, 56 insertions(+), 15 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 601f8ed6bd..d0de6107d1 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2260,14 +2260,21 @@ typedef struct AVCodecContext { #define FF_PROFILE_DTS_HD_HRA 50 #define FF_PROFILE_DTS_HD_MA 60 -#define FF_PROFILE_H264_BASELINE 66 -#define FF_PROFILE_H264_MAIN 77 -#define FF_PROFILE_H264_EXTENDED 88 -#define FF_PROFILE_H264_HIGH 100 -#define FF_PROFILE_H264_HIGH_10 110 -#define FF_PROFILE_H264_HIGH_422 122 -#define FF_PROFILE_H264_HIGH_444 244 -#define FF_PROFILE_H264_CAVLC_444 44 +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag + +#define FF_PROFILE_H264_BASELINE 66 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) +#define FF_PROFILE_H264_MAIN 77 +#define FF_PROFILE_H264_EXTENDED 88 +#define FF_PROFILE_H264_HIGH 100 +#define FF_PROFILE_H264_HIGH_10 110 +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_422 122 +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_CAVLC_444 44 /** * level diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 2a3357b05c..774e97dae9 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1677,6 +1677,33 @@ static void clone_slice(H264Context *dst, H264Context *src) memcpy(dst->dequant8_coeff, src->dequant8_coeff, sizeof(src->dequant8_coeff)); } +/** + * computes profile from profile_idc and constraint_set?_flags + * + * @param sps SPS + * + * @return profile as defined by FF_PROFILE_H264_* + */ +int ff_h264_get_profile(SPS *sps) +{ + int profile = sps->profile_idc; + + switch(sps->profile_idc) { + case FF_PROFILE_H264_BASELINE: + // constraint_set1_flag set to 1 + profile |= (sps->constraint_set_flags & 1<<1) ? FF_PROFILE_H264_CONSTRAINED : 0; + break; + case FF_PROFILE_H264_HIGH_10: + case FF_PROFILE_H264_HIGH_422: + case FF_PROFILE_H264_HIGH_444_PREDICTIVE: + // constraint_set3_flag set to 1 + profile |= (sps->constraint_set_flags & 1<<3) ? FF_PROFILE_H264_INTRA : 0; + break; + } + + return profile; +} + /** * decodes a slice header. * This will also call MPV_common_init() and frame_start() as needed. @@ -1756,7 +1783,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ } h->sps = *h0->sps_buffers[h->pps.sps_id]; - s->avctx->profile = h->sps.profile_idc; + s->avctx->profile = ff_h264_get_profile(&h->sps); s->avctx->level = h->sps.level_idc; s->avctx->refs = h->sps.ref_frame_count; diff --git a/libavcodec/h264.h b/libavcodec/h264.h index f4f9b25739..b403968485 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -209,6 +209,7 @@ typedef struct SPS{ int bit_depth_luma; ///< bit_depth_luma_minus8 + 8 int bit_depth_chroma; ///< bit_depth_chroma_minus8 + 8 int residual_color_transform_flag; ///< residual_colour_transform_flag + int constraint_set_flags; ///< constraint_set[0-3]_flag }SPS; /** @@ -611,6 +612,11 @@ int ff_h264_decode_sei(H264Context *h); */ int ff_h264_decode_seq_parameter_set(H264Context *h); +/** + * compute profile from sps + */ +int ff_h264_get_profile(SPS *sps); + /** * Decode PPS */ diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 51760dcf68..c5728e2678 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -187,7 +187,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, h->sps = *h->sps_buffers[h->pps.sps_id]; h->frame_num = get_bits(&h->s.gb, h->sps.log2_max_frame_num); - avctx->profile = h->sps.profile_idc; + avctx->profile = ff_h264_get_profile(&h->sps); avctx->level = h->sps.level_idc; if(h->sps.frame_mbs_only_flag){ diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 876bcb2a43..3fe5815ea6 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -267,16 +267,16 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s int ff_h264_decode_seq_parameter_set(H264Context *h){ MpegEncContext * const s = &h->s; - int profile_idc, level_idc; + int profile_idc, level_idc, constraint_set_flags = 0; unsigned int sps_id; int i; SPS *sps; profile_idc= get_bits(&s->gb, 8); - get_bits1(&s->gb); //constraint_set0_flag - get_bits1(&s->gb); //constraint_set1_flag - get_bits1(&s->gb); //constraint_set2_flag - get_bits1(&s->gb); //constraint_set3_flag + constraint_set_flags |= get_bits1(&s->gb) << 0; //constraint_set0_flag + constraint_set_flags |= get_bits1(&s->gb) << 1; //constraint_set1_flag + constraint_set_flags |= get_bits1(&s->gb) << 2; //constraint_set2_flag + constraint_set_flags |= get_bits1(&s->gb) << 3; //constraint_set3_flag get_bits(&s->gb, 4); // reserved level_idc= get_bits(&s->gb, 8); sps_id= get_ue_golomb_31(&s->gb); @@ -291,6 +291,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ sps->time_offset_length = 24; sps->profile_idc= profile_idc; + sps->constraint_set_flags = constraint_set_flags; sps->level_idc= level_idc; memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4)); From 71e0bee9eabe8eea030e210f1ad74c380b8b250b Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sat, 22 Jan 2011 00:58:52 +0200 Subject: [PATCH 193/528] h264: add profile names for the existing defines Signed-off-by: Janne Grunau --- libavcodec/h264.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 774e97dae9..b84430a1d7 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3386,6 +3386,21 @@ av_cold int ff_h264_decode_end(AVCodecContext *avctx) return 0; } +static const AVProfile profiles[] = { + { FF_PROFILE_H264_BASELINE, "Baseline" }, + { FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline" }, + { FF_PROFILE_H264_MAIN, "Main" }, + { FF_PROFILE_H264_EXTENDED, "Extended" }, + { FF_PROFILE_H264_HIGH, "High" }, + { FF_PROFILE_H264_HIGH_10, "High 10" }, + { FF_PROFILE_H264_HIGH_10_INTRA, "High 10 Intra" }, + { FF_PROFILE_H264_HIGH_422, "High 4:2:2" }, + { FF_PROFILE_H264_HIGH_422_INTRA, "High 4:2:2 Intra" }, + { FF_PROFILE_H264_HIGH_444_PREDICTIVE, "High 4:4:4 Predictive" }, + { FF_PROFILE_H264_HIGH_444_INTRA, "High 4:4:4 Intra" }, + { FF_PROFILE_H264_CAVLC_444, "CAVLC 4:4:4" }, + { FF_PROFILE_UNKNOWN }, +}; AVCodec ff_h264_decoder = { "h264", @@ -3399,6 +3414,7 @@ AVCodec ff_h264_decoder = { /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY, .flush= flush_dpb, .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), + .profiles = NULL_IF_CONFIG_SMALL(profiles), }; #if CONFIG_H264_VDPAU_DECODER @@ -3415,5 +3431,6 @@ AVCodec ff_h264_vdpau_decoder = { .flush= flush_dpb, .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"), .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_H264, PIX_FMT_NONE}, + .profiles = NULL_IF_CONFIG_SMALL(profiles), }; #endif From ea7f080749d68a431226ce196014da38761a0d82 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 1 Feb 2011 20:09:24 +0100 Subject: [PATCH 194/528] Free the RTSPStreams in ff_rtsp_close_streams This plugs a small memory leak Signed-off-by: Janne Grunau --- libavformat/rtsp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 9a6d6ad2b8..09e2f1ec8a 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -532,6 +532,7 @@ void ff_rtsp_close_streams(AVFormatContext *s) if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) rtsp_st->dynamic_handler->close( rtsp_st->dynamic_protocol_context); + av_free(rtsp_st); } } av_free(rt->rtsp_streams); From 770c410fbb8e1b87ce8ad7f3d7eddaa55e2b8295 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Sun, 30 Jan 2011 01:04:41 -0800 Subject: [PATCH 195/528] Fix ff_imdct_calc_sse() on gcc-4.6 Gcc 4.6 only preserves the first value when using an array with an "m" constraint. Signed-off-by: Mans Rullgard --- libavcodec/x86/fft_sse.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/x86/fft_sse.c b/libavcodec/x86/fft_sse.c index 9f02816def..0d151bc446 100644 --- a/libavcodec/x86/fft_sse.c +++ b/libavcodec/x86/fft_sse.c @@ -23,7 +23,7 @@ #include "libavcodec/dsputil.h" #include "fft.h" -DECLARE_ALIGNED(16, static const int, m1m1m1m1)[4] = +DECLARE_ASM_CONST(16, int, ff_m1m1m1m1)[4] = { 1 << 31, 1 << 31, 1 << 31, 1 << 31 }; void ff_fft_dispatch_sse(FFTComplex *z, int nbits); @@ -82,7 +82,7 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input) j = -n; k = n-16; __asm__ volatile( - "movaps %4, %%xmm7 \n" + "movaps "MANGLE(ff_m1m1m1m1)", %%xmm7 \n" "1: \n" "movaps (%2,%1), %%xmm0 \n" "movaps (%3,%0), %%xmm1 \n" @@ -95,8 +95,7 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input) "add $16, %0 \n" "jl 1b \n" :"+r"(j), "+r"(k) - :"r"(output+n4), "r"(output+n4*3), - "m"(*m1m1m1m1) + :"r"(output+n4), "r"(output+n4*3) XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm7") ); } From c73d99e672329c8f2df290736ffc474c360ac4ae Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 30 Jan 2011 15:06:46 +0000 Subject: [PATCH 196/528] Separate format conversion DSP functions from DSPContext. This will be beneficial for use with the audio conversion API without requiring it to depend on all of dsputil. Signed-off-by: Mans Rullgard --- libavcodec/Makefile | 1 + libavcodec/aac.h | 2 + libavcodec/aacdec.c | 4 +- libavcodec/ac3dec.c | 5 +- libavcodec/ac3dec.h | 2 + libavcodec/arm/Makefile | 5 + libavcodec/arm/dsputil_init_neon.c | 10 - libavcodec/arm/dsputil_init_vfp.c | 4 - libavcodec/arm/dsputil_neon.S | 365 ------------------------- libavcodec/arm/dsputil_vfp.S | 55 ---- libavcodec/arm/fmtconvert_init_arm.c | 48 ++++ libavcodec/arm/fmtconvert_neon.S | 391 +++++++++++++++++++++++++++ libavcodec/arm/fmtconvert_vfp.S | 77 ++++++ libavcodec/binkaudio.c | 6 +- libavcodec/dca.c | 7 +- libavcodec/dsputil.c | 33 --- libavcodec/dsputil.h | 5 - libavcodec/fmtconvert.c | 68 +++++ libavcodec/fmtconvert.h | 79 ++++++ libavcodec/nellymoserdec.c | 5 +- libavcodec/ppc/Makefile | 1 + libavcodec/ppc/float_altivec.c | 112 -------- libavcodec/ppc/fmtconvert_altivec.c | 142 ++++++++++ libavcodec/vorbis_dec.c | 6 +- libavcodec/wma.c | 1 + libavcodec/wma.h | 2 + libavcodec/wmadec.c | 2 +- libavcodec/x86/Makefile | 2 + libavcodec/x86/dsputil_mmx.c | 220 --------------- libavcodec/x86/dsputil_yasm.asm | 69 ----- libavcodec/x86/fmtconvert.asm | 91 +++++++ libavcodec/x86/fmtconvert_mmx.c | 266 ++++++++++++++++++ 32 files changed, 1204 insertions(+), 882 deletions(-) create mode 100644 libavcodec/arm/fmtconvert_init_arm.c create mode 100644 libavcodec/arm/fmtconvert_neon.S create mode 100644 libavcodec/arm/fmtconvert_vfp.S create mode 100644 libavcodec/fmtconvert.c create mode 100644 libavcodec/fmtconvert.h create mode 100644 libavcodec/ppc/fmtconvert_altivec.c create mode 100644 libavcodec/x86/fmtconvert.asm create mode 100644 libavcodec/x86/fmtconvert_mmx.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index de1bde0737..6a0a05b870 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -12,6 +12,7 @@ OBJS = allcodecs.o \ bitstream_filter.o \ dsputil.o \ faanidct.o \ + fmtconvert.o \ imgconvert.o \ jrevdct.o \ opt.o \ diff --git a/libavcodec/aac.h b/libavcodec/aac.h index 714e314cba..cff476a6eb 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -35,6 +35,7 @@ #include "fft.h" #include "mpeg4audio.h" #include "sbr.h" +#include "fmtconvert.h" #include @@ -268,6 +269,7 @@ typedef struct { FFTContext mdct; FFTContext mdct_small; DSPContext dsp; + FmtConvertContext fmt_conv; int random_state; /** @} */ diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 0ea7dc84a5..411c1dfc1b 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -85,6 +85,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" #include "lpc.h" #include "aac.h" @@ -562,6 +563,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) ff_aac_sbr_init(); dsputil_init(&ac->dsp, avctx); + ff_fmt_convert_init(&ac->fmt_conv, avctx); ac->random_state = 0x1f2e3d4c; @@ -2032,7 +2034,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, *data_size = data_size_tmp; if (samples) - ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels); + ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels); if (ac->output_configured) ac->output_configured = OC_LOCKED; diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 8e40ce1ccc..5ebee1908d 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -193,6 +193,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) ff_mdct_init(&s->imdct_512, 9, 1, 1.0); ff_kbd_window_init(s->window, 5.0, 256); dsputil_init(&s->dsp, avctx); + ff_fmt_convert_init(&s->fmt_conv, avctx); av_lfg_init(&s->dith_state, 0); /* set scale value for float to int16 conversion */ @@ -1255,7 +1256,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) } else { gain *= s->dynamic_range[0]; } - s->dsp.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256); + s->fmt_conv.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256); } /* apply spectral extension to high frequency bins */ @@ -1407,7 +1408,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n"); err = 1; } - s->dsp.float_to_int16_interleave(out_samples, output, 256, s->out_channels); + s->fmt_conv.float_to_int16_interleave(out_samples, output, 256, s->out_channels); out_samples += 256 * s->out_channels; } *data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t); diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index 55520cdcee..147e5e59bc 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -55,6 +55,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" /* override ac3.h to include coupling channel */ #undef AC3_MAX_CHANNELS @@ -190,6 +191,7 @@ typedef struct { ///@defgroup opt optimization DSPContext dsp; ///< for optimization + FmtConvertContext fmt_conv; ///< optimized conversion functions float mul_bias; ///< scaling for float_to_int16 conversion ///@} diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile index 4c30e0ab9f..014456ee32 100644 --- a/libavcodec/arm/Makefile +++ b/libavcodec/arm/Makefile @@ -9,6 +9,7 @@ OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o OBJS += arm/dsputil_init_arm.o \ arm/dsputil_arm.o \ arm/fft_init_arm.o \ + arm/fmtconvert_init_arm.o \ arm/jrevdct_arm.o \ arm/mpegvideo_arm.o \ arm/simple_idct_arm.o \ @@ -22,8 +23,11 @@ OBJS-$(HAVE_ARMV6) += arm/dsputil_init_armv6.o \ arm/dsputil_armv6.o \ arm/simple_idct_armv6.o \ +VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \ + OBJS-$(HAVE_ARMVFP) += arm/dsputil_vfp.o \ arm/dsputil_init_vfp.o \ + $(VFP-OBJS-yes) OBJS-$(HAVE_IWMMXT) += arm/dsputil_iwmmxt.o \ arm/mpegvideo_iwmmxt.o \ @@ -52,6 +56,7 @@ NEON-OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_neon.o \ OBJS-$(HAVE_NEON) += arm/dsputil_init_neon.o \ arm/dsputil_neon.o \ + arm/fmtconvert_neon.o \ arm/int_neon.o \ arm/mpegvideo_neon.o \ arm/simple_idct_neon.o \ diff --git a/libavcodec/arm/dsputil_init_neon.c b/libavcodec/arm/dsputil_init_neon.c index 67982048f9..76ae632273 100644 --- a/libavcodec/arm/dsputil_init_neon.c +++ b/libavcodec/arm/dsputil_init_neon.c @@ -153,8 +153,6 @@ void ff_sv_fmul_scalar_4_neon(float *dst, const float **vp, float mul, int len); void ff_butterflies_float_neon(float *v1, float *v2, int len); float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len); -void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src, - float mul, int len); void ff_vector_fmul_reverse_neon(float *dst, const float *src0, const float *src1, int len); void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1, @@ -162,8 +160,6 @@ void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1, void ff_vector_clipf_neon(float *dst, const float *src, float min, float max, int len); -void ff_float_to_int16_neon(int16_t *, const float *, long); -void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int); void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, int blocksize); @@ -308,7 +304,6 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) c->vector_fmul_scalar = ff_vector_fmul_scalar_neon; c->butterflies_float = ff_butterflies_float_neon; c->scalarproduct_float = ff_scalarproduct_float_neon; - c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon; c->vector_fmul_reverse = ff_vector_fmul_reverse_neon; c->vector_fmul_add = ff_vector_fmul_add_neon; c->vector_clipf = ff_vector_clipf_neon; @@ -319,11 +314,6 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) c->sv_fmul_scalar[0] = ff_sv_fmul_scalar_2_neon; c->sv_fmul_scalar[1] = ff_sv_fmul_scalar_4_neon; - if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { - c->float_to_int16 = ff_float_to_int16_neon; - c->float_to_int16_interleave = ff_float_to_int16_interleave_neon; - } - if (CONFIG_VORBIS_DECODER) c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_neon; diff --git a/libavcodec/arm/dsputil_init_vfp.c b/libavcodec/arm/dsputil_init_vfp.c index 76ef6b4171..bd52315934 100644 --- a/libavcodec/arm/dsputil_init_vfp.c +++ b/libavcodec/arm/dsputil_init_vfp.c @@ -25,13 +25,9 @@ void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1, int len); void ff_vector_fmul_reverse_vfp(float *dst, const float *src0, const float *src1, int len); -void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx) { c->vector_fmul = ff_vector_fmul_vfp; c->vector_fmul_reverse = ff_vector_fmul_reverse_vfp; -#if HAVE_ARMV6 - c->float_to_int16 = ff_float_to_int16_vfp; -#endif } diff --git a/libavcodec/arm/dsputil_neon.S b/libavcodec/arm/dsputil_neon.S index 8329f6cc57..05a911502b 100644 --- a/libavcodec/arm/dsputil_neon.S +++ b/libavcodec/arm/dsputil_neon.S @@ -400,343 +400,6 @@ function ff_add_pixels_clamped_neon, export=1 bx lr endfunc -function ff_float_to_int16_neon, export=1 - subs r2, r2, #8 - vld1.64 {d0-d1}, [r1,:128]! - vcvt.s32.f32 q8, q0, #16 - vld1.64 {d2-d3}, [r1,:128]! - vcvt.s32.f32 q9, q1, #16 - beq 3f - bics ip, r2, #15 - beq 2f -1: subs ip, ip, #16 - vshrn.s32 d4, q8, #16 - vld1.64 {d0-d1}, [r1,:128]! - vcvt.s32.f32 q0, q0, #16 - vshrn.s32 d5, q9, #16 - vld1.64 {d2-d3}, [r1,:128]! - vcvt.s32.f32 q1, q1, #16 - vshrn.s32 d6, q0, #16 - vst1.64 {d4-d5}, [r0,:128]! - vshrn.s32 d7, q1, #16 - vld1.64 {d16-d17},[r1,:128]! - vcvt.s32.f32 q8, q8, #16 - vld1.64 {d18-d19},[r1,:128]! - vcvt.s32.f32 q9, q9, #16 - vst1.64 {d6-d7}, [r0,:128]! - bne 1b - ands r2, r2, #15 - beq 3f -2: vld1.64 {d0-d1}, [r1,:128]! - vshrn.s32 d4, q8, #16 - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r1,:128]! - vshrn.s32 d5, q9, #16 - vcvt.s32.f32 q1, q1, #16 - vshrn.s32 d6, q0, #16 - vst1.64 {d4-d5}, [r0,:128]! - vshrn.s32 d7, q1, #16 - vst1.64 {d6-d7}, [r0,:128]! - bx lr -3: vshrn.s32 d4, q8, #16 - vshrn.s32 d5, q9, #16 - vst1.64 {d4-d5}, [r0,:128]! - bx lr -endfunc - -function ff_float_to_int16_interleave_neon, export=1 - cmp r3, #2 - ldrlt r1, [r1] - blt ff_float_to_int16_neon - bne 4f - - ldr r3, [r1] - ldr r1, [r1, #4] - - subs r2, r2, #8 - vld1.64 {d0-d1}, [r3,:128]! - vcvt.s32.f32 q8, q0, #16 - vld1.64 {d2-d3}, [r3,:128]! - vcvt.s32.f32 q9, q1, #16 - vld1.64 {d20-d21},[r1,:128]! - vcvt.s32.f32 q10, q10, #16 - vld1.64 {d22-d23},[r1,:128]! - vcvt.s32.f32 q11, q11, #16 - beq 3f - bics ip, r2, #15 - beq 2f -1: subs ip, ip, #16 - vld1.64 {d0-d1}, [r3,:128]! - vcvt.s32.f32 q0, q0, #16 - vsri.32 q10, q8, #16 - vld1.64 {d2-d3}, [r3,:128]! - vcvt.s32.f32 q1, q1, #16 - vld1.64 {d24-d25},[r1,:128]! - vcvt.s32.f32 q12, q12, #16 - vld1.64 {d26-d27},[r1,:128]! - vsri.32 q11, q9, #16 - vst1.64 {d20-d21},[r0,:128]! - vcvt.s32.f32 q13, q13, #16 - vst1.64 {d22-d23},[r0,:128]! - vsri.32 q12, q0, #16 - vld1.64 {d16-d17},[r3,:128]! - vsri.32 q13, q1, #16 - vst1.64 {d24-d25},[r0,:128]! - vcvt.s32.f32 q8, q8, #16 - vld1.64 {d18-d19},[r3,:128]! - vcvt.s32.f32 q9, q9, #16 - vld1.64 {d20-d21},[r1,:128]! - vcvt.s32.f32 q10, q10, #16 - vld1.64 {d22-d23},[r1,:128]! - vcvt.s32.f32 q11, q11, #16 - vst1.64 {d26-d27},[r0,:128]! - bne 1b - ands r2, r2, #15 - beq 3f -2: vsri.32 q10, q8, #16 - vld1.64 {d0-d1}, [r3,:128]! - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r3,:128]! - vcvt.s32.f32 q1, q1, #16 - vld1.64 {d24-d25},[r1,:128]! - vcvt.s32.f32 q12, q12, #16 - vsri.32 q11, q9, #16 - vld1.64 {d26-d27},[r1,:128]! - vcvt.s32.f32 q13, q13, #16 - vst1.64 {d20-d21},[r0,:128]! - vsri.32 q12, q0, #16 - vst1.64 {d22-d23},[r0,:128]! - vsri.32 q13, q1, #16 - vst1.64 {d24-d27},[r0,:128]! - bx lr -3: vsri.32 q10, q8, #16 - vsri.32 q11, q9, #16 - vst1.64 {d20-d23},[r0,:128]! - bx lr - -4: push {r4-r8,lr} - cmp r3, #4 - lsl ip, r3, #1 - blt 4f - - @ 4 channels -5: ldmia r1!, {r4-r7} - mov lr, r2 - mov r8, r0 - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vld1.64 {d20-d21},[r6,:128]! - vcvt.s32.f32 q10, q10, #16 - vld1.64 {d22-d23},[r7,:128]! - vcvt.s32.f32 q11, q11, #16 -6: subs lr, lr, #8 - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vsri.32 q9, q8, #16 - vld1.64 {d2-d3}, [r5,:128]! - vcvt.s32.f32 q1, q1, #16 - vsri.32 q11, q10, #16 - vld1.64 {d4-d5}, [r6,:128]! - vcvt.s32.f32 q2, q2, #16 - vzip.32 d18, d22 - vld1.64 {d6-d7}, [r7,:128]! - vcvt.s32.f32 q3, q3, #16 - vzip.32 d19, d23 - vst1.64 {d18}, [r8], ip - vsri.32 q1, q0, #16 - vst1.64 {d22}, [r8], ip - vsri.32 q3, q2, #16 - vst1.64 {d19}, [r8], ip - vzip.32 d2, d6 - vst1.64 {d23}, [r8], ip - vzip.32 d3, d7 - beq 7f - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vst1.64 {d2}, [r8], ip - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vst1.64 {d6}, [r8], ip - vld1.64 {d20-d21},[r6,:128]! - vcvt.s32.f32 q10, q10, #16 - vst1.64 {d3}, [r8], ip - vld1.64 {d22-d23},[r7,:128]! - vcvt.s32.f32 q11, q11, #16 - vst1.64 {d7}, [r8], ip - b 6b -7: vst1.64 {d2}, [r8], ip - vst1.64 {d6}, [r8], ip - vst1.64 {d3}, [r8], ip - vst1.64 {d7}, [r8], ip - subs r3, r3, #4 - popeq {r4-r8,pc} - cmp r3, #4 - add r0, r0, #8 - bge 5b - - @ 2 channels -4: cmp r3, #2 - blt 4f - ldmia r1!, {r4-r5} - mov lr, r2 - mov r8, r0 - tst lr, #8 - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vld1.64 {d20-d21},[r4,:128]! - vcvt.s32.f32 q10, q10, #16 - vld1.64 {d22-d23},[r5,:128]! - vcvt.s32.f32 q11, q11, #16 - beq 6f - subs lr, lr, #8 - beq 7f - vsri.32 d18, d16, #16 - vsri.32 d19, d17, #16 - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vst1.32 {d18[0]}, [r8], ip - vsri.32 d22, d20, #16 - vst1.32 {d18[1]}, [r8], ip - vsri.32 d23, d21, #16 - vst1.32 {d19[0]}, [r8], ip - vst1.32 {d19[1]}, [r8], ip - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vst1.32 {d22[0]}, [r8], ip - vst1.32 {d22[1]}, [r8], ip - vld1.64 {d20-d21},[r4,:128]! - vcvt.s32.f32 q10, q10, #16 - vst1.32 {d23[0]}, [r8], ip - vst1.32 {d23[1]}, [r8], ip - vld1.64 {d22-d23},[r5,:128]! - vcvt.s32.f32 q11, q11, #16 -6: subs lr, lr, #16 - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vsri.32 d18, d16, #16 - vld1.64 {d2-d3}, [r5,:128]! - vcvt.s32.f32 q1, q1, #16 - vsri.32 d19, d17, #16 - vld1.64 {d4-d5}, [r4,:128]! - vcvt.s32.f32 q2, q2, #16 - vld1.64 {d6-d7}, [r5,:128]! - vcvt.s32.f32 q3, q3, #16 - vst1.32 {d18[0]}, [r8], ip - vsri.32 d22, d20, #16 - vst1.32 {d18[1]}, [r8], ip - vsri.32 d23, d21, #16 - vst1.32 {d19[0]}, [r8], ip - vsri.32 d2, d0, #16 - vst1.32 {d19[1]}, [r8], ip - vsri.32 d3, d1, #16 - vst1.32 {d22[0]}, [r8], ip - vsri.32 d6, d4, #16 - vst1.32 {d22[1]}, [r8], ip - vsri.32 d7, d5, #16 - vst1.32 {d23[0]}, [r8], ip - vst1.32 {d23[1]}, [r8], ip - beq 6f - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vst1.32 {d2[0]}, [r8], ip - vst1.32 {d2[1]}, [r8], ip - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vst1.32 {d3[0]}, [r8], ip - vst1.32 {d3[1]}, [r8], ip - vld1.64 {d20-d21},[r4,:128]! - vcvt.s32.f32 q10, q10, #16 - vst1.32 {d6[0]}, [r8], ip - vst1.32 {d6[1]}, [r8], ip - vld1.64 {d22-d23},[r5,:128]! - vcvt.s32.f32 q11, q11, #16 - vst1.32 {d7[0]}, [r8], ip - vst1.32 {d7[1]}, [r8], ip - bgt 6b -6: vst1.32 {d2[0]}, [r8], ip - vst1.32 {d2[1]}, [r8], ip - vst1.32 {d3[0]}, [r8], ip - vst1.32 {d3[1]}, [r8], ip - vst1.32 {d6[0]}, [r8], ip - vst1.32 {d6[1]}, [r8], ip - vst1.32 {d7[0]}, [r8], ip - vst1.32 {d7[1]}, [r8], ip - b 8f -7: vsri.32 d18, d16, #16 - vsri.32 d19, d17, #16 - vst1.32 {d18[0]}, [r8], ip - vsri.32 d22, d20, #16 - vst1.32 {d18[1]}, [r8], ip - vsri.32 d23, d21, #16 - vst1.32 {d19[0]}, [r8], ip - vst1.32 {d19[1]}, [r8], ip - vst1.32 {d22[0]}, [r8], ip - vst1.32 {d22[1]}, [r8], ip - vst1.32 {d23[0]}, [r8], ip - vst1.32 {d23[1]}, [r8], ip -8: subs r3, r3, #2 - add r0, r0, #4 - popeq {r4-r8,pc} - - @ 1 channel -4: ldr r4, [r1],#4 - tst r2, #8 - mov lr, r2 - mov r5, r0 - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r4,:128]! - vcvt.s32.f32 q1, q1, #16 - bne 8f -6: subs lr, lr, #16 - vld1.64 {d4-d5}, [r4,:128]! - vcvt.s32.f32 q2, q2, #16 - vld1.64 {d6-d7}, [r4,:128]! - vcvt.s32.f32 q3, q3, #16 - vst1.16 {d0[1]}, [r5,:16], ip - vst1.16 {d0[3]}, [r5,:16], ip - vst1.16 {d1[1]}, [r5,:16], ip - vst1.16 {d1[3]}, [r5,:16], ip - vst1.16 {d2[1]}, [r5,:16], ip - vst1.16 {d2[3]}, [r5,:16], ip - vst1.16 {d3[1]}, [r5,:16], ip - vst1.16 {d3[3]}, [r5,:16], ip - beq 7f - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r4,:128]! - vcvt.s32.f32 q1, q1, #16 -7: vst1.16 {d4[1]}, [r5,:16], ip - vst1.16 {d4[3]}, [r5,:16], ip - vst1.16 {d5[1]}, [r5,:16], ip - vst1.16 {d5[3]}, [r5,:16], ip - vst1.16 {d6[1]}, [r5,:16], ip - vst1.16 {d6[3]}, [r5,:16], ip - vst1.16 {d7[1]}, [r5,:16], ip - vst1.16 {d7[3]}, [r5,:16], ip - bgt 6b - pop {r4-r8,pc} -8: subs lr, lr, #8 - vst1.16 {d0[1]}, [r5,:16], ip - vst1.16 {d0[3]}, [r5,:16], ip - vst1.16 {d1[1]}, [r5,:16], ip - vst1.16 {d1[3]}, [r5,:16], ip - vst1.16 {d2[1]}, [r5,:16], ip - vst1.16 {d2[3]}, [r5,:16], ip - vst1.16 {d3[1]}, [r5,:16], ip - vst1.16 {d3[3]}, [r5,:16], ip - popeq {r4-r8,pc} - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r4,:128]! - vcvt.s32.f32 q1, q1, #16 - b 6b -endfunc - function ff_vector_fmul_neon, export=1 subs r3, r3, #8 vld1.64 {d0-d3}, [r1,:128]! @@ -1050,34 +713,6 @@ NOVFP vmov.32 r0, d0[0] bx lr endfunc -function ff_int32_to_float_fmul_scalar_neon, export=1 -VFP vdup.32 q0, d0[0] -VFP len .req r2 -NOVFP vdup.32 q0, r2 -NOVFP len .req r3 - - vld1.32 {q1},[r1,:128]! - vcvt.f32.s32 q3, q1 - vld1.32 {q2},[r1,:128]! - vcvt.f32.s32 q8, q2 -1: subs len, len, #8 - pld [r1, #16] - vmul.f32 q9, q3, q0 - vmul.f32 q10, q8, q0 - beq 2f - vld1.32 {q1},[r1,:128]! - vcvt.f32.s32 q3, q1 - vld1.32 {q2},[r1,:128]! - vcvt.f32.s32 q8, q2 - vst1.32 {q9}, [r0,:128]! - vst1.32 {q10},[r0,:128]! - b 1b -2: vst1.32 {q9}, [r0,:128]! - vst1.32 {q10},[r0,:128]! - bx lr - .unreq len -endfunc - function ff_vector_fmul_reverse_neon, export=1 add r2, r2, r3, lsl #2 sub r2, r2, #32 diff --git a/libavcodec/arm/dsputil_vfp.S b/libavcodec/arm/dsputil_vfp.S index a65b69e20a..197d500819 100644 --- a/libavcodec/arm/dsputil_vfp.S +++ b/libavcodec/arm/dsputil_vfp.S @@ -131,58 +131,3 @@ function ff_vector_fmul_reverse_vfp, export=1 vpop {d8-d15} bx lr endfunc - -#if HAVE_ARMV6 -/** - * ARM VFP optimized float to int16 conversion. - * Assume that len is a positive number and is multiple of 8, destination - * buffer is at least 4 bytes aligned (8 bytes alignment is better for - * performance), little endian byte sex - */ -@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len) -function ff_float_to_int16_vfp, export=1 - push {r4-r8,lr} - vpush {d8-d11} - vldmia r1!, {s16-s23} - vcvt.s32.f32 s0, s16 - vcvt.s32.f32 s1, s17 - vcvt.s32.f32 s2, s18 - vcvt.s32.f32 s3, s19 - vcvt.s32.f32 s4, s20 - vcvt.s32.f32 s5, s21 - vcvt.s32.f32 s6, s22 - vcvt.s32.f32 s7, s23 -1: - subs r2, r2, #8 - vmov r3, r4, s0, s1 - vmov r5, r6, s2, s3 - vmov r7, r8, s4, s5 - vmov ip, lr, s6, s7 - vldmiagt r1!, {s16-s23} - ssat r4, #16, r4 - ssat r3, #16, r3 - ssat r6, #16, r6 - ssat r5, #16, r5 - pkhbt r3, r3, r4, lsl #16 - pkhbt r4, r5, r6, lsl #16 - vcvtgt.s32.f32 s0, s16 - vcvtgt.s32.f32 s1, s17 - vcvtgt.s32.f32 s2, s18 - vcvtgt.s32.f32 s3, s19 - vcvtgt.s32.f32 s4, s20 - vcvtgt.s32.f32 s5, s21 - vcvtgt.s32.f32 s6, s22 - vcvtgt.s32.f32 s7, s23 - ssat r8, #16, r8 - ssat r7, #16, r7 - ssat lr, #16, lr - ssat ip, #16, ip - pkhbt r5, r7, r8, lsl #16 - pkhbt r6, ip, lr, lsl #16 - stmia r0!, {r3-r6} - bgt 1b - - vpop {d8-d11} - pop {r4-r8,pc} -endfunc -#endif diff --git a/libavcodec/arm/fmtconvert_init_arm.c b/libavcodec/arm/fmtconvert_init_arm.c new file mode 100644 index 0000000000..4b6e3939f5 --- /dev/null +++ b/libavcodec/arm/fmtconvert_init_arm.c @@ -0,0 +1,48 @@ +/* + * ARM optimized Format Conversion Utils + * + * 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 "libavcodec/avcodec.h" +#include "libavcodec/fmtconvert.h" + +void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src, + float mul, int len); + +void ff_float_to_int16_neon(int16_t *dst, const float *src, long len); +void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int); + +void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); + +void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx) +{ + if (HAVE_ARMVFP && HAVE_ARMV6) { + c->float_to_int16 = ff_float_to_int16_vfp; + } + + if (HAVE_NEON) { + c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon; + + if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { + c->float_to_int16 = ff_float_to_int16_neon; + c->float_to_int16_interleave = ff_float_to_int16_interleave_neon; + } + } +} diff --git a/libavcodec/arm/fmtconvert_neon.S b/libavcodec/arm/fmtconvert_neon.S new file mode 100644 index 0000000000..359e57e40b --- /dev/null +++ b/libavcodec/arm/fmtconvert_neon.S @@ -0,0 +1,391 @@ +/* + * ARM NEON optimised Format Conversion Utils + * Copyright (c) 2008 Mans Rullgard + * + * 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 "config.h" +#include "asm.S" + + preserve8 + .text + +function ff_float_to_int16_neon, export=1 + subs r2, r2, #8 + vld1.64 {d0-d1}, [r1,:128]! + vcvt.s32.f32 q8, q0, #16 + vld1.64 {d2-d3}, [r1,:128]! + vcvt.s32.f32 q9, q1, #16 + beq 3f + bics ip, r2, #15 + beq 2f +1: subs ip, ip, #16 + vshrn.s32 d4, q8, #16 + vld1.64 {d0-d1}, [r1,:128]! + vcvt.s32.f32 q0, q0, #16 + vshrn.s32 d5, q9, #16 + vld1.64 {d2-d3}, [r1,:128]! + vcvt.s32.f32 q1, q1, #16 + vshrn.s32 d6, q0, #16 + vst1.64 {d4-d5}, [r0,:128]! + vshrn.s32 d7, q1, #16 + vld1.64 {d16-d17},[r1,:128]! + vcvt.s32.f32 q8, q8, #16 + vld1.64 {d18-d19},[r1,:128]! + vcvt.s32.f32 q9, q9, #16 + vst1.64 {d6-d7}, [r0,:128]! + bne 1b + ands r2, r2, #15 + beq 3f +2: vld1.64 {d0-d1}, [r1,:128]! + vshrn.s32 d4, q8, #16 + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r1,:128]! + vshrn.s32 d5, q9, #16 + vcvt.s32.f32 q1, q1, #16 + vshrn.s32 d6, q0, #16 + vst1.64 {d4-d5}, [r0,:128]! + vshrn.s32 d7, q1, #16 + vst1.64 {d6-d7}, [r0,:128]! + bx lr +3: vshrn.s32 d4, q8, #16 + vshrn.s32 d5, q9, #16 + vst1.64 {d4-d5}, [r0,:128]! + bx lr +endfunc + +function ff_float_to_int16_interleave_neon, export=1 + cmp r3, #2 + ldrlt r1, [r1] + blt ff_float_to_int16_neon + bne 4f + + ldr r3, [r1] + ldr r1, [r1, #4] + + subs r2, r2, #8 + vld1.64 {d0-d1}, [r3,:128]! + vcvt.s32.f32 q8, q0, #16 + vld1.64 {d2-d3}, [r3,:128]! + vcvt.s32.f32 q9, q1, #16 + vld1.64 {d20-d21},[r1,:128]! + vcvt.s32.f32 q10, q10, #16 + vld1.64 {d22-d23},[r1,:128]! + vcvt.s32.f32 q11, q11, #16 + beq 3f + bics ip, r2, #15 + beq 2f +1: subs ip, ip, #16 + vld1.64 {d0-d1}, [r3,:128]! + vcvt.s32.f32 q0, q0, #16 + vsri.32 q10, q8, #16 + vld1.64 {d2-d3}, [r3,:128]! + vcvt.s32.f32 q1, q1, #16 + vld1.64 {d24-d25},[r1,:128]! + vcvt.s32.f32 q12, q12, #16 + vld1.64 {d26-d27},[r1,:128]! + vsri.32 q11, q9, #16 + vst1.64 {d20-d21},[r0,:128]! + vcvt.s32.f32 q13, q13, #16 + vst1.64 {d22-d23},[r0,:128]! + vsri.32 q12, q0, #16 + vld1.64 {d16-d17},[r3,:128]! + vsri.32 q13, q1, #16 + vst1.64 {d24-d25},[r0,:128]! + vcvt.s32.f32 q8, q8, #16 + vld1.64 {d18-d19},[r3,:128]! + vcvt.s32.f32 q9, q9, #16 + vld1.64 {d20-d21},[r1,:128]! + vcvt.s32.f32 q10, q10, #16 + vld1.64 {d22-d23},[r1,:128]! + vcvt.s32.f32 q11, q11, #16 + vst1.64 {d26-d27},[r0,:128]! + bne 1b + ands r2, r2, #15 + beq 3f +2: vsri.32 q10, q8, #16 + vld1.64 {d0-d1}, [r3,:128]! + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r3,:128]! + vcvt.s32.f32 q1, q1, #16 + vld1.64 {d24-d25},[r1,:128]! + vcvt.s32.f32 q12, q12, #16 + vsri.32 q11, q9, #16 + vld1.64 {d26-d27},[r1,:128]! + vcvt.s32.f32 q13, q13, #16 + vst1.64 {d20-d21},[r0,:128]! + vsri.32 q12, q0, #16 + vst1.64 {d22-d23},[r0,:128]! + vsri.32 q13, q1, #16 + vst1.64 {d24-d27},[r0,:128]! + bx lr +3: vsri.32 q10, q8, #16 + vsri.32 q11, q9, #16 + vst1.64 {d20-d23},[r0,:128]! + bx lr + +4: push {r4-r8,lr} + cmp r3, #4 + lsl ip, r3, #1 + blt 4f + + @ 4 channels +5: ldmia r1!, {r4-r7} + mov lr, r2 + mov r8, r0 + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vld1.64 {d20-d21},[r6,:128]! + vcvt.s32.f32 q10, q10, #16 + vld1.64 {d22-d23},[r7,:128]! + vcvt.s32.f32 q11, q11, #16 +6: subs lr, lr, #8 + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vsri.32 q9, q8, #16 + vld1.64 {d2-d3}, [r5,:128]! + vcvt.s32.f32 q1, q1, #16 + vsri.32 q11, q10, #16 + vld1.64 {d4-d5}, [r6,:128]! + vcvt.s32.f32 q2, q2, #16 + vzip.32 d18, d22 + vld1.64 {d6-d7}, [r7,:128]! + vcvt.s32.f32 q3, q3, #16 + vzip.32 d19, d23 + vst1.64 {d18}, [r8], ip + vsri.32 q1, q0, #16 + vst1.64 {d22}, [r8], ip + vsri.32 q3, q2, #16 + vst1.64 {d19}, [r8], ip + vzip.32 d2, d6 + vst1.64 {d23}, [r8], ip + vzip.32 d3, d7 + beq 7f + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vst1.64 {d2}, [r8], ip + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vst1.64 {d6}, [r8], ip + vld1.64 {d20-d21},[r6,:128]! + vcvt.s32.f32 q10, q10, #16 + vst1.64 {d3}, [r8], ip + vld1.64 {d22-d23},[r7,:128]! + vcvt.s32.f32 q11, q11, #16 + vst1.64 {d7}, [r8], ip + b 6b +7: vst1.64 {d2}, [r8], ip + vst1.64 {d6}, [r8], ip + vst1.64 {d3}, [r8], ip + vst1.64 {d7}, [r8], ip + subs r3, r3, #4 + popeq {r4-r8,pc} + cmp r3, #4 + add r0, r0, #8 + bge 5b + + @ 2 channels +4: cmp r3, #2 + blt 4f + ldmia r1!, {r4-r5} + mov lr, r2 + mov r8, r0 + tst lr, #8 + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vld1.64 {d20-d21},[r4,:128]! + vcvt.s32.f32 q10, q10, #16 + vld1.64 {d22-d23},[r5,:128]! + vcvt.s32.f32 q11, q11, #16 + beq 6f + subs lr, lr, #8 + beq 7f + vsri.32 d18, d16, #16 + vsri.32 d19, d17, #16 + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vst1.32 {d18[0]}, [r8], ip + vsri.32 d22, d20, #16 + vst1.32 {d18[1]}, [r8], ip + vsri.32 d23, d21, #16 + vst1.32 {d19[0]}, [r8], ip + vst1.32 {d19[1]}, [r8], ip + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vst1.32 {d22[0]}, [r8], ip + vst1.32 {d22[1]}, [r8], ip + vld1.64 {d20-d21},[r4,:128]! + vcvt.s32.f32 q10, q10, #16 + vst1.32 {d23[0]}, [r8], ip + vst1.32 {d23[1]}, [r8], ip + vld1.64 {d22-d23},[r5,:128]! + vcvt.s32.f32 q11, q11, #16 +6: subs lr, lr, #16 + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vsri.32 d18, d16, #16 + vld1.64 {d2-d3}, [r5,:128]! + vcvt.s32.f32 q1, q1, #16 + vsri.32 d19, d17, #16 + vld1.64 {d4-d5}, [r4,:128]! + vcvt.s32.f32 q2, q2, #16 + vld1.64 {d6-d7}, [r5,:128]! + vcvt.s32.f32 q3, q3, #16 + vst1.32 {d18[0]}, [r8], ip + vsri.32 d22, d20, #16 + vst1.32 {d18[1]}, [r8], ip + vsri.32 d23, d21, #16 + vst1.32 {d19[0]}, [r8], ip + vsri.32 d2, d0, #16 + vst1.32 {d19[1]}, [r8], ip + vsri.32 d3, d1, #16 + vst1.32 {d22[0]}, [r8], ip + vsri.32 d6, d4, #16 + vst1.32 {d22[1]}, [r8], ip + vsri.32 d7, d5, #16 + vst1.32 {d23[0]}, [r8], ip + vst1.32 {d23[1]}, [r8], ip + beq 6f + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vst1.32 {d2[0]}, [r8], ip + vst1.32 {d2[1]}, [r8], ip + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vst1.32 {d3[0]}, [r8], ip + vst1.32 {d3[1]}, [r8], ip + vld1.64 {d20-d21},[r4,:128]! + vcvt.s32.f32 q10, q10, #16 + vst1.32 {d6[0]}, [r8], ip + vst1.32 {d6[1]}, [r8], ip + vld1.64 {d22-d23},[r5,:128]! + vcvt.s32.f32 q11, q11, #16 + vst1.32 {d7[0]}, [r8], ip + vst1.32 {d7[1]}, [r8], ip + bgt 6b +6: vst1.32 {d2[0]}, [r8], ip + vst1.32 {d2[1]}, [r8], ip + vst1.32 {d3[0]}, [r8], ip + vst1.32 {d3[1]}, [r8], ip + vst1.32 {d6[0]}, [r8], ip + vst1.32 {d6[1]}, [r8], ip + vst1.32 {d7[0]}, [r8], ip + vst1.32 {d7[1]}, [r8], ip + b 8f +7: vsri.32 d18, d16, #16 + vsri.32 d19, d17, #16 + vst1.32 {d18[0]}, [r8], ip + vsri.32 d22, d20, #16 + vst1.32 {d18[1]}, [r8], ip + vsri.32 d23, d21, #16 + vst1.32 {d19[0]}, [r8], ip + vst1.32 {d19[1]}, [r8], ip + vst1.32 {d22[0]}, [r8], ip + vst1.32 {d22[1]}, [r8], ip + vst1.32 {d23[0]}, [r8], ip + vst1.32 {d23[1]}, [r8], ip +8: subs r3, r3, #2 + add r0, r0, #4 + popeq {r4-r8,pc} + + @ 1 channel +4: ldr r4, [r1],#4 + tst r2, #8 + mov lr, r2 + mov r5, r0 + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r4,:128]! + vcvt.s32.f32 q1, q1, #16 + bne 8f +6: subs lr, lr, #16 + vld1.64 {d4-d5}, [r4,:128]! + vcvt.s32.f32 q2, q2, #16 + vld1.64 {d6-d7}, [r4,:128]! + vcvt.s32.f32 q3, q3, #16 + vst1.16 {d0[1]}, [r5,:16], ip + vst1.16 {d0[3]}, [r5,:16], ip + vst1.16 {d1[1]}, [r5,:16], ip + vst1.16 {d1[3]}, [r5,:16], ip + vst1.16 {d2[1]}, [r5,:16], ip + vst1.16 {d2[3]}, [r5,:16], ip + vst1.16 {d3[1]}, [r5,:16], ip + vst1.16 {d3[3]}, [r5,:16], ip + beq 7f + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r4,:128]! + vcvt.s32.f32 q1, q1, #16 +7: vst1.16 {d4[1]}, [r5,:16], ip + vst1.16 {d4[3]}, [r5,:16], ip + vst1.16 {d5[1]}, [r5,:16], ip + vst1.16 {d5[3]}, [r5,:16], ip + vst1.16 {d6[1]}, [r5,:16], ip + vst1.16 {d6[3]}, [r5,:16], ip + vst1.16 {d7[1]}, [r5,:16], ip + vst1.16 {d7[3]}, [r5,:16], ip + bgt 6b + pop {r4-r8,pc} +8: subs lr, lr, #8 + vst1.16 {d0[1]}, [r5,:16], ip + vst1.16 {d0[3]}, [r5,:16], ip + vst1.16 {d1[1]}, [r5,:16], ip + vst1.16 {d1[3]}, [r5,:16], ip + vst1.16 {d2[1]}, [r5,:16], ip + vst1.16 {d2[3]}, [r5,:16], ip + vst1.16 {d3[1]}, [r5,:16], ip + vst1.16 {d3[3]}, [r5,:16], ip + popeq {r4-r8,pc} + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r4,:128]! + vcvt.s32.f32 q1, q1, #16 + b 6b +endfunc + +function ff_int32_to_float_fmul_scalar_neon, export=1 +VFP vdup.32 q0, d0[0] +VFP len .req r2 +NOVFP vdup.32 q0, r2 +NOVFP len .req r3 + + vld1.32 {q1},[r1,:128]! + vcvt.f32.s32 q3, q1 + vld1.32 {q2},[r1,:128]! + vcvt.f32.s32 q8, q2 +1: subs len, len, #8 + pld [r1, #16] + vmul.f32 q9, q3, q0 + vmul.f32 q10, q8, q0 + beq 2f + vld1.32 {q1},[r1,:128]! + vcvt.f32.s32 q3, q1 + vld1.32 {q2},[r1,:128]! + vcvt.f32.s32 q8, q2 + vst1.32 {q9}, [r0,:128]! + vst1.32 {q10},[r0,:128]! + b 1b +2: vst1.32 {q9}, [r0,:128]! + vst1.32 {q10},[r0,:128]! + bx lr + .unreq len +endfunc diff --git a/libavcodec/arm/fmtconvert_vfp.S b/libavcodec/arm/fmtconvert_vfp.S new file mode 100644 index 0000000000..1d19e7758b --- /dev/null +++ b/libavcodec/arm/fmtconvert_vfp.S @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2008 Siarhei Siamashka + * + * 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 "config.h" +#include "asm.S" + + .syntax unified + +/** + * ARM VFP optimized float to int16 conversion. + * Assume that len is a positive number and is multiple of 8, destination + * buffer is at least 4 bytes aligned (8 bytes alignment is better for + * performance), little endian byte sex + */ +@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len) +function ff_float_to_int16_vfp, export=1 + push {r4-r8,lr} + vpush {d8-d11} + vldmia r1!, {s16-s23} + vcvt.s32.f32 s0, s16 + vcvt.s32.f32 s1, s17 + vcvt.s32.f32 s2, s18 + vcvt.s32.f32 s3, s19 + vcvt.s32.f32 s4, s20 + vcvt.s32.f32 s5, s21 + vcvt.s32.f32 s6, s22 + vcvt.s32.f32 s7, s23 +1: + subs r2, r2, #8 + vmov r3, r4, s0, s1 + vmov r5, r6, s2, s3 + vmov r7, r8, s4, s5 + vmov ip, lr, s6, s7 + vldmiagt r1!, {s16-s23} + ssat r4, #16, r4 + ssat r3, #16, r3 + ssat r6, #16, r6 + ssat r5, #16, r5 + pkhbt r3, r3, r4, lsl #16 + pkhbt r4, r5, r6, lsl #16 + vcvtgt.s32.f32 s0, s16 + vcvtgt.s32.f32 s1, s17 + vcvtgt.s32.f32 s2, s18 + vcvtgt.s32.f32 s3, s19 + vcvtgt.s32.f32 s4, s20 + vcvtgt.s32.f32 s5, s21 + vcvtgt.s32.f32 s6, s22 + vcvtgt.s32.f32 s7, s23 + ssat r8, #16, r8 + ssat r7, #16, r7 + ssat lr, #16, lr + ssat ip, #16, ip + pkhbt r5, r7, r8, lsl #16 + pkhbt r6, ip, lr, lsl #16 + stmia r0!, {r3-r6} + bgt 1b + + vpop {d8-d11} + pop {r4-r8,pc} +endfunc diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index ae2f6c88b0..53484654db 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -33,6 +33,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" extern const uint16_t ff_wma_critical_freqs[25]; @@ -43,6 +44,7 @@ typedef struct { AVCodecContext *avctx; GetBitContext gb; DSPContext dsp; + FmtConvertContext fmt_conv; int first; int channels; int frame_len; ///< transform size (samples) @@ -71,6 +73,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s->avctx = avctx; dsputil_init(&s->dsp, avctx); + ff_fmt_convert_init(&s->fmt_conv, avctx); /* determine frame length */ if (avctx->sample_rate < 22050) { @@ -222,7 +225,8 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) ff_rdft_calc(&s->trans.rdft, coeffs); } - s->dsp.float_to_int16_interleave(out, (const float **)s->coeffs_ptr, s->frame_len, s->channels); + s->fmt_conv.float_to_int16_interleave(out, (const float **)s->coeffs_ptr, + s->frame_len, s->channels); if (!s->first) { int count = s->overlap_len * s->channels; diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 3a3eb25d0b..63ea32992e 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -40,6 +40,7 @@ #include "dca.h" #include "synth_filter.h" #include "dcadsp.h" +#include "fmtconvert.h" //#define TRACE @@ -347,6 +348,7 @@ typedef struct { FFTContext imdct; SynthFilterContext synth; DCADSPContext dcadsp; + FmtConvertContext fmt_conv; } DCAContext; static const uint16_t dca_vlc_offs[] = { @@ -1115,7 +1117,7 @@ static int dca_subsubframe(DCAContext * s, int base_channel, int block_index) block[m] = get_bitalloc(&s->gb, &dca_smpl_bitalloc[abits], sel); } - s->dsp.int32_to_float_fmul_scalar(subband_samples[k][l], + s->fmt_conv.int32_to_float_fmul_scalar(subband_samples[k][l], block, rscale, 8); } @@ -1802,7 +1804,7 @@ static int dca_decode_frame(AVCodecContext * avctx, } } - s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels); + s->fmt_conv.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels); samples += 256 * channels; } @@ -1835,6 +1837,7 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) ff_mdct_init(&s->imdct, 6, 1, 1.0); ff_synth_filter_init(&s->synth); ff_dcadsp_init(&s->dcadsp); + ff_fmt_convert_init(&s->fmt_conv, avctx); for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++) s->samples_chanptr[i] = s->samples + i * 256; diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 2d4ec72026..84714def41 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3867,12 +3867,6 @@ static float scalarproduct_float_c(const float *v1, const float *v2, int len) return p; } -static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){ - int i; - for(i=0; ivector_fmul_reverse = vector_fmul_reverse_c; c->vector_fmul_add = vector_fmul_add_c; c->vector_fmul_window = vector_fmul_window_c; - c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c; c->vector_clipf = vector_clipf_c; - c->float_to_int16 = ff_float_to_int16_c; - c->float_to_int16_interleave = ff_float_to_int16_interleave_c; c->scalarproduct_int16 = scalarproduct_int16_c; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c; c->scalarproduct_float = scalarproduct_float_c; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index b942e66a37..c8111866c2 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -392,7 +392,6 @@ typedef struct DSPContext { /* assume len is a multiple of 4, and arrays are 16-byte aligned */ void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len); /* assume len is a multiple of 8, and arrays are 16-byte aligned */ - void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len); void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */); /** * Multiply a vector of floats by a scalar float. Source and @@ -445,10 +444,6 @@ typedef struct DSPContext { */ void (*butterflies_float)(float *restrict v1, float *restrict v2, int len); - /* convert floats from [-32768.0,32767.0] without rescaling and arrays are 16byte aligned */ - void (*float_to_int16)(int16_t *dst, const float *src, long len); - void (*float_to_int16_interleave)(int16_t *dst, const float **src, long len, int channels); - /* (I)DCT */ void (*fdct)(DCTELEM *block/* align 16*/); void (*fdct248)(DCTELEM *block/* align 16*/); diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c new file mode 100644 index 0000000000..e26b8997ab --- /dev/null +++ b/libavcodec/fmtconvert.c @@ -0,0 +1,68 @@ +/* + * Format Conversion 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avcodec.h" +#include "fmtconvert.h" + +static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){ + int i; + for(i=0; iint32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c; + c->float_to_int16 = float_to_int16_c; + c->float_to_int16_interleave = float_to_int16_interleave_c; + + if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx); + if (ARCH_PPC) ff_fmt_convert_init_ppc(c, avctx); + if (HAVE_MMX) ff_fmt_convert_init_x86(c, avctx); +} diff --git a/libavcodec/fmtconvert.h b/libavcodec/fmtconvert.h new file mode 100644 index 0000000000..f2ee261f99 --- /dev/null +++ b/libavcodec/fmtconvert.h @@ -0,0 +1,79 @@ +/* + * Format Conversion 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_FMTCONVERT_H +#define AVCODEC_FMTCONVERT_H + +#include "avcodec.h" + +typedef struct FmtConvertContext { + /** + * Convert an array of int32_t to float and multiply by a float value. + * @param dst destination array of float. + * constraints: 16-byte aligned + * @param src source array of int32_t. + * constraints: 16-byte aligned + * @param len number of elements to convert. + * constraints: multiple of 8 + */ + void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len); + + /** + * Convert an array of float to an array of int16_t. + * + * Convert floats from in the range [-32768.0,32767.0] to ints + * without rescaling + * + * @param dst destination array of int16_t. + * constraints: 16-byte aligned + * @param src source array of float. + * constraints: 16-byte aligned + * @param len number of elements to convert. + * constraints: multiple of 8 + */ + void (*float_to_int16)(int16_t *dst, const float *src, long len); + + /** + * Convert multiple arrays of float to an interleaved array of int16_t. + * + * Convert floats from in the range [-32768.0,32767.0] to ints + * without rescaling + * + * @param dst destination array of interleaved int16_t. + * constraints: 16-byte aligned + * @param src source array of float arrays, one for each channel. + * constraints: 16-byte aligned + * @param len number of elements to convert. + * constraints: multiple of 8 + * @param channels number of channels + */ + void (*float_to_int16_interleave)(int16_t *dst, const float **src, + long len, int channels); +} FmtConvertContext; + +void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx); + +void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx); +void ff_fmt_convert_init_ppc(FmtConvertContext *c, AVCodecContext *avctx); +void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx); + +#endif /* AVCODEC_FMTCONVERT_H */ diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 8b13a5d894..80e04ee0a2 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -38,6 +38,7 @@ #include "avcodec.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" #define ALT_BITSTREAM_READER_LE #include "get_bits.h" @@ -52,6 +53,7 @@ typedef struct NellyMoserDecodeContext { float scale_bias; DSPContext dsp; FFTContext imdct_ctx; + FmtConvertContext fmt_conv; DECLARE_ALIGNED(16, float,imdct_out)[NELLY_BUF_LEN * 2]; } NellyMoserDecodeContext; @@ -134,6 +136,7 @@ static av_cold int decode_init(AVCodecContext * avctx) { ff_mdct_init(&s->imdct_ctx, 8, 1, 1.0); dsputil_init(&s->dsp, avctx); + ff_fmt_convert_init(&s->fmt_conv, avctx); s->scale_bias = 1.0/(1*8); @@ -175,7 +178,7 @@ static int decode_tag(AVCodecContext * avctx, for (i=0 ; ifloat_buf); - s->dsp.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES); + s->fmt_conv.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES); *data_size += NELLY_SAMPLES*sizeof(int16_t); } diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile index 9b2358d49c..35ea0c38f8 100644 --- a/libavcodec/ppc/Makefile +++ b/libavcodec/ppc/Makefile @@ -21,6 +21,7 @@ ALTIVEC-OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \ OBJS-$(HAVE_ALTIVEC) += ppc/dsputil_altivec.o \ ppc/fdct_altivec.o \ ppc/float_altivec.o \ + ppc/fmtconvert_altivec.o \ ppc/gmc_altivec.o \ ppc/idct_altivec.o \ ppc/int_altivec.o \ diff --git a/libavcodec/ppc/float_altivec.c b/libavcodec/ppc/float_altivec.c index 60bae9a757..ba97cbfd3b 100644 --- a/libavcodec/ppc/float_altivec.c +++ b/libavcodec/ppc/float_altivec.c @@ -122,124 +122,12 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa } } -static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len) -{ - union { - vector float v; - float s[4]; - } mul_u; - int i; - vector float src1, src2, dst1, dst2, mul_v, zero; - - zero = (vector float)vec_splat_u32(0); - mul_u.s[0] = mul; - mul_v = vec_splat(mul_u.v, 0); - - for(i=0; ivector_fmul = vector_fmul_altivec; c->vector_fmul_reverse = vector_fmul_reverse_altivec; c->vector_fmul_add = vector_fmul_add_altivec; - c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec; if(!(avctx->flags & CODEC_FLAG_BITEXACT)) { c->vector_fmul_window = vector_fmul_window_altivec; - c->float_to_int16 = float_to_int16_altivec; - c->float_to_int16_interleave = float_to_int16_interleave_altivec; } } diff --git a/libavcodec/ppc/fmtconvert_altivec.c b/libavcodec/ppc/fmtconvert_altivec.c new file mode 100644 index 0000000000..e5287c96c1 --- /dev/null +++ b/libavcodec/ppc/fmtconvert_altivec.c @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2006 Luca Barbato + * + * 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/fmtconvert.h" + +#include "dsputil_altivec.h" +#include "util_altivec.h" + +static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len) +{ + union { + vector float v; + float s[4]; + } mul_u; + int i; + vector float src1, src2, dst1, dst2, mul_v, zero; + + zero = (vector float)vec_splat_u32(0); + mul_u.s[0] = mul; + mul_v = vec_splat(mul_u.v, 0); + + for(i=0; iint32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec; + if(!(avctx->flags & CODEC_FLAG_BITEXACT)) { + c->float_to_int16 = float_to_int16_altivec; + c->float_to_int16_interleave = float_to_int16_interleave_altivec; + } +} diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index 9fef5eb26f..bca56ba663 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -31,6 +31,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" #include "vorbis.h" #include "xiph.h" @@ -127,6 +128,7 @@ typedef struct vorbis_context_s { AVCodecContext *avccontext; GetBitContext gb; DSPContext dsp; + FmtConvertContext fmt_conv; FFTContext mdct[2]; uint_fast8_t first_frame; @@ -961,6 +963,7 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext) vc->avccontext = avccontext; dsputil_init(&vc->dsp, avccontext); + ff_fmt_convert_init(&vc->fmt_conv, avccontext); vc->scale_bias = 32768.0f; @@ -1636,7 +1639,8 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, len * ff_vorbis_channel_layout_offsets[vc->audio_channels - 1][i]; } - vc->dsp.float_to_int16_interleave(data, channel_ptrs, len, vc->audio_channels); + vc->fmt_conv.float_to_int16_interleave(data, channel_ptrs, len, + vc->audio_channels); *data_size = len * 2 * vc->audio_channels; return buf_size ; diff --git a/libavcodec/wma.c b/libavcodec/wma.c index e0b9b68395..a7eacb8c78 100644 --- a/libavcodec/wma.c +++ b/libavcodec/wma.c @@ -126,6 +126,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2) s->block_align = avctx->block_align; dsputil_init(&s->dsp, avctx); + ff_fmt_convert_init(&s->fmt_conv, avctx); if (avctx->codec->id == CODEC_ID_WMAV1) { s->version = 1; diff --git a/libavcodec/wma.h b/libavcodec/wma.h index 11274ad970..a51b3e83cf 100644 --- a/libavcodec/wma.h +++ b/libavcodec/wma.h @@ -26,6 +26,7 @@ #include "put_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" /* size of blocks */ #define BLOCK_MIN_BITS 7 @@ -134,6 +135,7 @@ typedef struct WMACodecContext { float lsp_pow_m_table1[(1 << LSP_POW_BITS)]; float lsp_pow_m_table2[(1 << LSP_POW_BITS)]; DSPContext dsp; + FmtConvertContext fmt_conv; #ifdef TRACE int frame_count; diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index d85d80d574..83f8dea8bb 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -791,7 +791,7 @@ static int wma_decode_frame(WMACodecContext *s, int16_t *samples) incr = s->nb_channels; for (ch = 0; ch < MAX_CHANNELS; ch++) output[ch] = s->frame_out[ch]; - s->dsp.float_to_int16_interleave(samples, output, n, incr); + s->fmt_conv.float_to_int16_interleave(samples, output, n, incr); for (ch = 0; ch < incr; ch++) { /* prepare for next block */ memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float)); diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 943edcb0ec..83cec00442 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -39,6 +39,7 @@ 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/fmtconvert.o \ x86/h264_chromamc.o \ $(YASM-OBJS-yes) @@ -47,6 +48,7 @@ MMX-OBJS-$(CONFIG_FFT) += x86/fft.o OBJS-$(HAVE_MMX) += x86/dnxhd_mmx.o \ x86/dsputil_mmx.o \ x86/fdct_mmx.o \ + x86/fmtconvert_mmx.o \ x86/idct_mmx_xvid.o \ x86/idct_sse2_xvid.o \ x86/motion_est_mmx.o \ diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 2eb7d85f14..39bf3f2936 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2349,50 +2349,6 @@ static void vector_fmul_window_sse(float *dst, const float *src0, const float *s } #endif /* HAVE_6REGS */ -static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul, int len) -{ - x86_reg i = -4*len; - __asm__ volatile( - "movss %3, %%xmm4 \n" - "shufps $0, %%xmm4, %%xmm4 \n" - "1: \n" - "cvtpi2ps (%2,%0), %%xmm0 \n" - "cvtpi2ps 8(%2,%0), %%xmm1 \n" - "cvtpi2ps 16(%2,%0), %%xmm2 \n" - "cvtpi2ps 24(%2,%0), %%xmm3 \n" - "movlhps %%xmm1, %%xmm0 \n" - "movlhps %%xmm3, %%xmm2 \n" - "mulps %%xmm4, %%xmm0 \n" - "mulps %%xmm4, %%xmm2 \n" - "movaps %%xmm0, (%1,%0) \n" - "movaps %%xmm2, 16(%1,%0) \n" - "add $32, %0 \n" - "jl 1b \n" - :"+r"(i) - :"r"(dst+len), "r"(src+len), "m"(mul) - ); -} - -static void int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len) -{ - x86_reg i = -4*len; - __asm__ volatile( - "movss %3, %%xmm4 \n" - "shufps $0, %%xmm4, %%xmm4 \n" - "1: \n" - "cvtdq2ps (%2,%0), %%xmm0 \n" - "cvtdq2ps 16(%2,%0), %%xmm1 \n" - "mulps %%xmm4, %%xmm0 \n" - "mulps %%xmm4, %%xmm1 \n" - "movaps %%xmm0, (%1,%0) \n" - "movaps %%xmm1, 16(%1,%0) \n" - "add $32, %0 \n" - "jl 1b \n" - :"+r"(i) - :"r"(dst+len), "r"(src+len), "m"(mul) - ); -} - static void vector_clipf_sse(float *dst, const float *src, float min, float max, int len) { @@ -2427,70 +2383,6 @@ static void vector_clipf_sse(float *dst, const float *src, float min, float max, ); } -static void float_to_int16_3dnow(int16_t *dst, const float *src, long len){ - x86_reg reglen = len; - // not bit-exact: pf2id uses different rounding than C and SSE - __asm__ volatile( - "add %0 , %0 \n\t" - "lea (%2,%0,2) , %2 \n\t" - "add %0 , %1 \n\t" - "neg %0 \n\t" - "1: \n\t" - "pf2id (%2,%0,2) , %%mm0 \n\t" - "pf2id 8(%2,%0,2) , %%mm1 \n\t" - "pf2id 16(%2,%0,2) , %%mm2 \n\t" - "pf2id 24(%2,%0,2) , %%mm3 \n\t" - "packssdw %%mm1 , %%mm0 \n\t" - "packssdw %%mm3 , %%mm2 \n\t" - "movq %%mm0 , (%1,%0) \n\t" - "movq %%mm2 , 8(%1,%0) \n\t" - "add $16 , %0 \n\t" - " js 1b \n\t" - "femms \n\t" - :"+r"(reglen), "+r"(dst), "+r"(src) - ); -} -static void float_to_int16_sse(int16_t *dst, const float *src, long len){ - x86_reg reglen = len; - __asm__ volatile( - "add %0 , %0 \n\t" - "lea (%2,%0,2) , %2 \n\t" - "add %0 , %1 \n\t" - "neg %0 \n\t" - "1: \n\t" - "cvtps2pi (%2,%0,2) , %%mm0 \n\t" - "cvtps2pi 8(%2,%0,2) , %%mm1 \n\t" - "cvtps2pi 16(%2,%0,2) , %%mm2 \n\t" - "cvtps2pi 24(%2,%0,2) , %%mm3 \n\t" - "packssdw %%mm1 , %%mm0 \n\t" - "packssdw %%mm3 , %%mm2 \n\t" - "movq %%mm0 , (%1,%0) \n\t" - "movq %%mm2 , 8(%1,%0) \n\t" - "add $16 , %0 \n\t" - " js 1b \n\t" - "emms \n\t" - :"+r"(reglen), "+r"(dst), "+r"(src) - ); -} - -static void float_to_int16_sse2(int16_t *dst, const float *src, long len){ - x86_reg reglen = len; - __asm__ volatile( - "add %0 , %0 \n\t" - "lea (%2,%0,2) , %2 \n\t" - "add %0 , %1 \n\t" - "neg %0 \n\t" - "1: \n\t" - "cvtps2dq (%2,%0,2) , %%xmm0 \n\t" - "cvtps2dq 16(%2,%0,2) , %%xmm1 \n\t" - "packssdw %%xmm1 , %%xmm0 \n\t" - "movdqa %%xmm0 , (%1,%0) \n\t" - "add $16 , %0 \n\t" - " js 1b \n\t" - :"+r"(reglen), "+r"(dst), "+r"(src) - ); -} - 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); @@ -2504,9 +2396,6 @@ 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); int32_t ff_scalarproduct_int16_mmx2(const int16_t *v1, const int16_t *v2, int order, int shift); int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2, int order, int shift); int32_t ff_scalarproduct_and_madd_int16_mmx2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul); @@ -2516,102 +2405,6 @@ void ff_add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const 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); -#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) -#endif -#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse - -#define FLOAT_TO_INT16_INTERLEAVE(cpu, body) \ -/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\ -static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\ - DECLARE_ALIGNED(16, int16_t, tmp)[len];\ - int i,j,c;\ - for(c=0; cvorbis_inverse_coupling = vorbis_inverse_coupling_3dnow; c->vector_fmul = vector_fmul_3dnow; - if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ - c->float_to_int16 = float_to_int16_3dnow; - c->float_to_int16_interleave = float_to_int16_interleave_3dnow; - } } if(mm_flags & AV_CPU_FLAG_3DNOWEXT){ c->vector_fmul_reverse = vector_fmul_reverse_3dnow2; #if HAVE_6REGS c->vector_fmul_window = vector_fmul_window_3dnow2; #endif - if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ - c->float_to_int16_interleave = float_to_int16_interleave_3dn2; - } } if(mm_flags & AV_CPU_FLAG_MMX2){ #if HAVE_YASM @@ -2997,10 +2783,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #if HAVE_6REGS c->vector_fmul_window = vector_fmul_window_sse; #endif - c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse; c->vector_clipf = vector_clipf_sse; - c->float_to_int16 = float_to_int16_sse; - c->float_to_int16_interleave = float_to_int16_interleave_sse; #if HAVE_YASM c->scalarproduct_float = ff_scalarproduct_float_sse; #endif @@ -3008,9 +2791,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) if(mm_flags & AV_CPU_FLAG_3DNOW) c->vector_fmul_add = vector_fmul_add_3dnow; // faster than sse 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; #if HAVE_YASM c->scalarproduct_int16 = ff_scalarproduct_int16_sse2; c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2; diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm index 099f0a80df..b1b37e1fb9 100644 --- a/libavcodec/x86/dsputil_yasm.asm +++ b/libavcodec/x86/dsputil_yasm.asm @@ -30,75 +30,6 @@ pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13 section .text align=16 -%macro PSWAPD_SSE 2 - pshufw %1, %2, 0x4e -%endmacro -%macro PSWAPD_3DN1 2 - movq %1, %2 - psrlq %1, 32 - punpckldq %1, %2 -%endmacro - -%macro FLOAT_TO_INT16_INTERLEAVE6 1 -; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len) -cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5 -%ifdef ARCH_X86_64 - %define lend r10d - mov lend, r2d -%else - %define lend dword r2m -%endif - mov src1q, [srcq+1*gprsize] - mov src2q, [srcq+2*gprsize] - mov src3q, [srcq+3*gprsize] - mov src4q, [srcq+4*gprsize] - mov src5q, [srcq+5*gprsize] - mov srcq, [srcq] - sub src1q, srcq - sub src2q, srcq - sub src3q, srcq - sub src4q, srcq - sub src5q, srcq -.loop: - cvtps2pi mm0, [srcq] - cvtps2pi mm1, [srcq+src1q] - cvtps2pi mm2, [srcq+src2q] - cvtps2pi mm3, [srcq+src3q] - cvtps2pi mm4, [srcq+src4q] - cvtps2pi mm5, [srcq+src5q] - packssdw mm0, mm3 - packssdw mm1, mm4 - packssdw mm2, mm5 - pswapd mm3, mm0 - punpcklwd mm0, mm1 - punpckhwd mm1, mm2 - punpcklwd mm2, mm3 - pswapd mm3, mm0 - punpckldq mm0, mm2 - punpckhdq mm2, mm1 - punpckldq mm1, mm3 - movq [dstq ], mm0 - movq [dstq+16], mm2 - movq [dstq+ 8], mm1 - add srcq, 8 - add dstq, 24 - sub lend, 2 - jg .loop - emms - RET -%endmacro ; FLOAT_TO_INT16_INTERLEAVE6 - -%define pswapd PSWAPD_SSE -FLOAT_TO_INT16_INTERLEAVE6 sse -%define cvtps2pi pf2id -%define pswapd PSWAPD_3DN1 -FLOAT_TO_INT16_INTERLEAVE6 3dnow -%undef pswapd -FLOAT_TO_INT16_INTERLEAVE6 3dn2 -%undef cvtps2pi - - - %macro SCALARPRODUCT 1 ; int scalarproduct_int16(int16_t *v1, int16_t *v2, int order, int shift) cglobal scalarproduct_int16_%1, 3,3,4, v1, v2, order, shift diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm new file mode 100644 index 0000000000..6c744fc581 --- /dev/null +++ b/libavcodec/x86/fmtconvert.asm @@ -0,0 +1,91 @@ +;****************************************************************************** +;* x86 optimized Format Conversion Utils +;* 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 +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" + +section .text align=16 + +%macro PSWAPD_SSE 2 + pshufw %1, %2, 0x4e +%endmacro +%macro PSWAPD_3DN1 2 + movq %1, %2 + psrlq %1, 32 + punpckldq %1, %2 +%endmacro + +%macro FLOAT_TO_INT16_INTERLEAVE6 1 +; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len) +cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5 +%ifdef ARCH_X86_64 + %define lend r10d + mov lend, r2d +%else + %define lend dword r2m +%endif + mov src1q, [srcq+1*gprsize] + mov src2q, [srcq+2*gprsize] + mov src3q, [srcq+3*gprsize] + mov src4q, [srcq+4*gprsize] + mov src5q, [srcq+5*gprsize] + mov srcq, [srcq] + sub src1q, srcq + sub src2q, srcq + sub src3q, srcq + sub src4q, srcq + sub src5q, srcq +.loop: + cvtps2pi mm0, [srcq] + cvtps2pi mm1, [srcq+src1q] + cvtps2pi mm2, [srcq+src2q] + cvtps2pi mm3, [srcq+src3q] + cvtps2pi mm4, [srcq+src4q] + cvtps2pi mm5, [srcq+src5q] + packssdw mm0, mm3 + packssdw mm1, mm4 + packssdw mm2, mm5 + pswapd mm3, mm0 + punpcklwd mm0, mm1 + punpckhwd mm1, mm2 + punpcklwd mm2, mm3 + pswapd mm3, mm0 + punpckldq mm0, mm2 + punpckhdq mm2, mm1 + punpckldq mm1, mm3 + movq [dstq ], mm0 + movq [dstq+16], mm2 + movq [dstq+ 8], mm1 + add srcq, 8 + add dstq, 24 + sub lend, 2 + jg .loop + emms + RET +%endmacro ; FLOAT_TO_INT16_INTERLEAVE6 + +%define pswapd PSWAPD_SSE +FLOAT_TO_INT16_INTERLEAVE6 sse +%define cvtps2pi pf2id +%define pswapd PSWAPD_3DN1 +FLOAT_TO_INT16_INTERLEAVE6 3dnow +%undef pswapd +FLOAT_TO_INT16_INTERLEAVE6 3dn2 +%undef cvtps2pi diff --git a/libavcodec/x86/fmtconvert_mmx.c b/libavcodec/x86/fmtconvert_mmx.c new file mode 100644 index 0000000000..ea41f730e8 --- /dev/null +++ b/libavcodec/x86/fmtconvert_mmx.c @@ -0,0 +1,266 @@ +/* + * Format Conversion 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * MMX optimization by Nick Kurshev + */ + +#include "libavutil/cpu.h" +#include "libavutil/x86_cpu.h" +#include "libavcodec/fmtconvert.h" + +static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul, int len) +{ + x86_reg i = -4*len; + __asm__ volatile( + "movss %3, %%xmm4 \n" + "shufps $0, %%xmm4, %%xmm4 \n" + "1: \n" + "cvtpi2ps (%2,%0), %%xmm0 \n" + "cvtpi2ps 8(%2,%0), %%xmm1 \n" + "cvtpi2ps 16(%2,%0), %%xmm2 \n" + "cvtpi2ps 24(%2,%0), %%xmm3 \n" + "movlhps %%xmm1, %%xmm0 \n" + "movlhps %%xmm3, %%xmm2 \n" + "mulps %%xmm4, %%xmm0 \n" + "mulps %%xmm4, %%xmm2 \n" + "movaps %%xmm0, (%1,%0) \n" + "movaps %%xmm2, 16(%1,%0) \n" + "add $32, %0 \n" + "jl 1b \n" + :"+r"(i) + :"r"(dst+len), "r"(src+len), "m"(mul) + ); +} + +static void int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len) +{ + x86_reg i = -4*len; + __asm__ volatile( + "movss %3, %%xmm4 \n" + "shufps $0, %%xmm4, %%xmm4 \n" + "1: \n" + "cvtdq2ps (%2,%0), %%xmm0 \n" + "cvtdq2ps 16(%2,%0), %%xmm1 \n" + "mulps %%xmm4, %%xmm0 \n" + "mulps %%xmm4, %%xmm1 \n" + "movaps %%xmm0, (%1,%0) \n" + "movaps %%xmm1, 16(%1,%0) \n" + "add $32, %0 \n" + "jl 1b \n" + :"+r"(i) + :"r"(dst+len), "r"(src+len), "m"(mul) + ); +} + +static void float_to_int16_3dnow(int16_t *dst, const float *src, long len){ + x86_reg reglen = len; + // not bit-exact: pf2id uses different rounding than C and SSE + __asm__ volatile( + "add %0 , %0 \n\t" + "lea (%2,%0,2) , %2 \n\t" + "add %0 , %1 \n\t" + "neg %0 \n\t" + "1: \n\t" + "pf2id (%2,%0,2) , %%mm0 \n\t" + "pf2id 8(%2,%0,2) , %%mm1 \n\t" + "pf2id 16(%2,%0,2) , %%mm2 \n\t" + "pf2id 24(%2,%0,2) , %%mm3 \n\t" + "packssdw %%mm1 , %%mm0 \n\t" + "packssdw %%mm3 , %%mm2 \n\t" + "movq %%mm0 , (%1,%0) \n\t" + "movq %%mm2 , 8(%1,%0) \n\t" + "add $16 , %0 \n\t" + " js 1b \n\t" + "femms \n\t" + :"+r"(reglen), "+r"(dst), "+r"(src) + ); +} + +static void float_to_int16_sse(int16_t *dst, const float *src, long len){ + x86_reg reglen = len; + __asm__ volatile( + "add %0 , %0 \n\t" + "lea (%2,%0,2) , %2 \n\t" + "add %0 , %1 \n\t" + "neg %0 \n\t" + "1: \n\t" + "cvtps2pi (%2,%0,2) , %%mm0 \n\t" + "cvtps2pi 8(%2,%0,2) , %%mm1 \n\t" + "cvtps2pi 16(%2,%0,2) , %%mm2 \n\t" + "cvtps2pi 24(%2,%0,2) , %%mm3 \n\t" + "packssdw %%mm1 , %%mm0 \n\t" + "packssdw %%mm3 , %%mm2 \n\t" + "movq %%mm0 , (%1,%0) \n\t" + "movq %%mm2 , 8(%1,%0) \n\t" + "add $16 , %0 \n\t" + " js 1b \n\t" + "emms \n\t" + :"+r"(reglen), "+r"(dst), "+r"(src) + ); +} + +static void float_to_int16_sse2(int16_t *dst, const float *src, long len){ + x86_reg reglen = len; + __asm__ volatile( + "add %0 , %0 \n\t" + "lea (%2,%0,2) , %2 \n\t" + "add %0 , %1 \n\t" + "neg %0 \n\t" + "1: \n\t" + "cvtps2dq (%2,%0,2) , %%xmm0 \n\t" + "cvtps2dq 16(%2,%0,2) , %%xmm1 \n\t" + "packssdw %%xmm1 , %%xmm0 \n\t" + "movdqa %%xmm0 , (%1,%0) \n\t" + "add $16 , %0 \n\t" + " js 1b \n\t" + :"+r"(reglen), "+r"(dst), "+r"(src) + ); +} + +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); + +#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) +#endif +#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse + +#define FLOAT_TO_INT16_INTERLEAVE(cpu, body) \ +/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\ +static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\ + DECLARE_ALIGNED(16, int16_t, tmp)[len];\ + int i,j,c;\ + for(c=0; cflags & CODEC_FLAG_BITEXACT)){ + c->float_to_int16 = float_to_int16_3dnow; + c->float_to_int16_interleave = float_to_int16_interleave_3dnow; + } + } + if(mm_flags & AV_CPU_FLAG_3DNOWEXT){ + if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ + c->float_to_int16_interleave = float_to_int16_interleave_3dn2; + } + } + if(mm_flags & AV_CPU_FLAG_SSE){ + c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse; + c->float_to_int16 = float_to_int16_sse; + c->float_to_int16_interleave = float_to_int16_interleave_sse; + } + 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; + } + } +} From b9a639ddd6e102edbf94a26b5106386792e2e4c8 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 26 Jan 2011 22:26:51 +0000 Subject: [PATCH 197/528] ARM: add helper macro for declaring constant data Signed-off-by: Mans Rullgard --- libavcodec/arm/asm.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/arm/asm.S b/libavcodec/arm/asm.S index e0507834f2..cf73a77609 100644 --- a/libavcodec/arm/asm.S +++ b/libavcodec/arm/asm.S @@ -50,6 +50,16 @@ ELF .type \name, %function \name: .endm +.macro const name, align=2 + .macro endconst +ELF .size \name, . - \name + .purgem endconst + .endm + .section .rodata + .align \align +\name: +.endm + .macro mov32 rd, val #if HAVE_ARMV6T2 movw \rd, #(\val) & 0xffff From 75ea596de1145878a7603d5a3f269a9aac9ae30e Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 1 Feb 2011 18:28:09 +0000 Subject: [PATCH 198/528] ffplay: factorize code from video_thread() into configure_video_filters() Signed-off-by: Mans Rullgard --- ffplay.c | 51 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/ffplay.c b/ffplay.c index 1df382422f..1fb75027dc 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1782,30 +1782,20 @@ static AVFilter input_filter = { .name = NULL }}, }; -#endif /* CONFIG_AVFILTER */ - -static int video_thread(void *arg) +static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters) { - VideoState *is = arg; - AVFrame *frame= avcodec_alloc_frame(); - int64_t pts_int; - double pts; - int ret; - -#if CONFIG_AVFILTER - int64_t pos; char sws_flags_str[128]; + int ret; FFSinkContext ffsink_ctx = { .pix_fmt = PIX_FMT_YUV420P }; AVFilterContext *filt_src = NULL, *filt_out = NULL; - AVFilterGraph *graph = avfilter_graph_alloc(); snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); graph->scale_sws_opts = av_strdup(sws_flags_str); - if (avfilter_graph_create_filter(&filt_src, &input_filter, "src", - NULL, is, graph) < 0) + if ((ret = avfilter_graph_create_filter(&filt_src, &input_filter, "src", + NULL, is, graph)) < 0) goto the_end; - if (avfilter_graph_create_filter(&filt_out, &ffsink, "out", - NULL, &ffsink_ctx, graph) < 0) + if ((ret = avfilter_graph_create_filter(&filt_out, &ffsink, "out", + NULL, &ffsink_ctx, graph)) < 0) goto the_end; if(vfilters) { @@ -1822,17 +1812,40 @@ static int video_thread(void *arg) inputs->pad_idx = 0; inputs->next = NULL; - if (avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL) < 0) + if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0) goto the_end; av_freep(&vfilters); } else { - if(avfilter_link(filt_src, 0, filt_out, 0) < 0) goto the_end; + if ((ret = avfilter_link(filt_src, 0, filt_out, 0)) < 0) + goto the_end; } - if (avfilter_graph_config(graph, NULL) < 0) + if ((ret = avfilter_graph_config(graph, NULL)) < 0) goto the_end; is->out_video_filter = filt_out; +the_end: + return ret; +} + +#endif /* CONFIG_AVFILTER */ + +static int video_thread(void *arg) +{ + VideoState *is = arg; + AVFrame *frame= avcodec_alloc_frame(); + int64_t pts_int; + double pts; + int ret; + +#if CONFIG_AVFILTER + AVFilterGraph *graph = avfilter_graph_alloc(); + AVFilterContext *filt_out = NULL; + int64_t pos; + + if ((ret = configure_video_filters(graph, is, vfilters)) < 0) + goto the_end; + filt_out = is->out_video_filter; #endif for(;;) { From 5fce60c3a9fbb21e580bad9165bf19d86ee7d96f Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 1 Feb 2011 15:48:37 +0000 Subject: [PATCH 199/528] Log debug information in filter_samples(). Signed-off-by: Mans Rullgard --- libavfilter/avfilter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 6581af56af..554fbd4105 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -475,6 +475,8 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *); AVFilterPad *dst = link->dstpad; + FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1); + if (!(filter_samples = dst->filter_samples)) filter_samples = avfilter_default_filter_samples; From c3beafa0f14fd81ab43083f61872cbd5426647cf Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 2 Feb 2011 18:23:59 +0000 Subject: [PATCH 200/528] ac3enc: Change EXP_DIFF_THRESHOLD to 500. This patch changes the exponent difference threshold in the exponent strategy decision function of the AC-3 encoder. I tested lowering in increments of 100. From 1000 down to 500 generally increased in quality with each step, but 400 was generally much worse. Signed-off-by: Mans Rullgard --- libavcodec/ac3enc.c | 2 +- tests/ref/acodec/ac3_fixed | 2 +- tests/ref/lavf/rm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index ed7a171ac7..e41a0aec65 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -434,7 +434,7 @@ static void extract_exponents(AC3EncodeContext *s) * Exponent Difference Threshold. * New exponents are sent if their SAD exceed this number. */ -#define EXP_DIFF_THRESHOLD 1000 +#define EXP_DIFF_THRESHOLD 500 /** diff --git a/tests/ref/acodec/ac3_fixed b/tests/ref/acodec/ac3_fixed index 17159e18a7..5c75ecd074 100644 --- a/tests/ref/acodec/ac3_fixed +++ b/tests/ref/acodec/ac3_fixed @@ -1,2 +1,2 @@ -9823c8f74097eab5d148cf0536ae932e *./tests/data/acodec/ac3.rm +37e119c644ba0472c079d0e907bf78df *./tests/data/acodec/ac3.rm 98751 ./tests/data/acodec/ac3.rm diff --git a/tests/ref/lavf/rm b/tests/ref/lavf/rm index d9ec51e596..c26dd0a28c 100644 --- a/tests/ref/lavf/rm +++ b/tests/ref/lavf/rm @@ -1,2 +1,2 @@ -e1990def7b195a568340f2c1a89d6587 *./tests/data/lavf/lavf.rm +b97899ef2812cd1c8851dea550e042e4 *./tests/data/lavf/lavf.rm 346706 ./tests/data/lavf/lavf.rm From 4868bebe5bfd018e1f525c33ab2f180bf0ca1213 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 2 Feb 2011 15:51:27 +0100 Subject: [PATCH 201/528] Add forgotten minor API bumps and APIChanges entries The bumps are for adding version.h and avio_{get/put}_str functions in lavf and making av_dlog public in lavu. Signed-off-by: Janne Grunau --- doc/APIchanges | 9 +++++++++ libavformat/version.h | 2 +- libavutil/avutil.h | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index aa1221df45..76a95ec6d3 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,15 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-02 - lavf 52.95.0 + * 50196a9 - add a new installed header version.h. + * 4efd5cf, dccbd97, 93b78d1 - add several variants of public + avio_{put,get}_str* functions. Deprecate corresponding semi-public + {put,get}_str*. + +2011-02-02 - dfd2a00 - lavu 50.37.0 - log.h + Make av_dlog public. + 2011-01-15 - r26374 - lavfi 1.74.0 - AVFilterBufferRefAudioProps Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples. diff --git a/libavformat/version.h b/libavformat/version.h index 9a902aa4b4..4b95221b27 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 94 +#define LIBAVFORMAT_VERSION_MINOR 95 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 74c2b5ef83..d6338a7689 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -40,7 +40,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 50 -#define LIBAVUTIL_VERSION_MINOR 36 +#define LIBAVUTIL_VERSION_MINOR 37 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ From 87e4d9b252bc6fa3b982f7050013069c9dc3e05b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 2 Feb 2011 21:45:16 +0100 Subject: [PATCH 202/528] ffmpeg.c: rename map_meta_data option to map_metadata It's consistent with the -metadata option and easier to write. Signed-off-by: Janne Grunau --- doc/ffmpeg.texi | 7 +++++-- ffmpeg.c | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 047444ab62..8b8e42f1f6 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -628,7 +628,10 @@ 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{metadata}]:@var{infile}[,@var{metadata}] -Set meta data information of @var{outfile} from @var{infile}. Note that those +Deprecated, use @var{-map_metadata} instead. + +@item -map_metadata @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}] +Set metadata 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 @@ -644,7 +647,7 @@ file index can be used to create a dummy mapping that just disables automatic co 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 +ffmpeg -i in.ogg -map_metadata 0:0,s0 out.mp3 @end example @item -map_chapters @var{outfile}:@var{infile} Copy chapters from @var{infile} to @var{outfile}. If no chapter mapping is specified, diff --git a/ffmpeg.c b/ffmpeg.c index df890185aa..fac6063474 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3013,7 +3013,7 @@ static void parse_meta_type(char *arg, char *type, int *index, char **endptr) *type = 'g'; } -static void opt_map_meta_data(const char *arg) +static void opt_map_metadata(const char *arg) { AVMetaDataMap *m, *m1; char *p; @@ -3039,6 +3039,13 @@ static void opt_map_meta_data(const char *arg) metadata_chapters_autocopy = 0; } +static void opt_map_meta_data(const char *arg) +{ + fprintf(stderr, "-map_meta_data is deprecated and will be removed soon. " + "Use -map_metadata instead.\n"); + opt_map_metadata(arg); +} + static void opt_map_chapters(const char *arg) { AVChapterMap *c; @@ -4197,7 +4204,10 @@ static const OptionDef options[] = { { "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[,metadata]:infile[,metadata]" }, + { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "DEPRECATED set meta data information of outfile from infile", + "outfile[,metadata]:infile[,metadata]" }, + { "map_metadata", HAS_ARG | OPT_EXPERT, {(void*)opt_map_metadata}, "set metadata information of outfile from infile", + "outfile[,metadata]:infile[,metadata]" }, { "map_chapters", HAS_ARG | OPT_EXPERT, {(void*)opt_map_chapters}, "set chapters mapping", "outfile:infile" }, { "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" }, // From d9c0510e22821baa364306d867ffac45da0620c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 2 Feb 2011 11:08:01 +0200 Subject: [PATCH 203/528] rtsp: Don't store RTSPStream in AVStream->priv_data For mpegts in RTP, there isn't a direct mapping between RTSPStreams and AVStreams, and the RTSPStream isn't ever stored in AVStream->priv_data, which was earlier leaked. The fix for this leak, in ea7f080749d68a431226ce196014da38761a0d82, lead to double frees for other, normal RTP streams. This patch avoids storing RTSPStreams in AVStream->priv_data, thus avoiding the double free. The RTSPStreams are always available via RTSPState->rtsp_streams anyway. Tested with MS-RTSP, RealRTSP, DSS and mpegts/RTP. Signed-off-by: Luca Barbato --- libavformat/rtsp.c | 16 ++++++---------- libavformat/rtspenc.c | 2 -- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 09e2f1ec8a..e1d750324d 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -273,8 +273,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, s1->default_ip = sdp_ip; s1->default_ttl = ttl; } else { - st = s->streams[s->nb_streams - 1]; - rtsp_st = st->priv_data; + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; rtsp_st->sdp_ip = sdp_ip; rtsp_st->sdp_ttl = ttl; } @@ -326,7 +325,6 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, st = av_new_stream(s, 0); if (!st) return; - st->priv_data = rtsp_st; rtsp_st->stream_index = st->index; st->codec->codec_type = codec_type; if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) { @@ -355,8 +353,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, } else { char proto[32]; /* get the control url */ - st = s->streams[s->nb_streams - 1]; - rtsp_st = st->priv_data; + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; /* XXX: may need to add full url resolution */ av_url_split(proto, sizeof(proto), NULL, 0, NULL, 0, @@ -377,7 +374,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); st = s->streams[s->nb_streams - 1]; - rtsp_st = st->priv_data; + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; sdp_parse_rtpmap(s, st, rtsp_st, payload_type, p); } else if (av_strstart(p, "fmtp:", &p) || av_strstart(p, "framesize:", &p)) { @@ -385,9 +382,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, // let dynamic protocol handlers have a stab at the line. get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - rtsp_st = st->priv_data; + for (i = 0; i < rt->nb_rtsp_streams; i++) { + rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->sdp_payload_type == payload_type && rtsp_st->dynamic_handler && rtsp_st->dynamic_handler->parse_sdp_a_line) @@ -417,7 +413,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, if (rt->server_type == RTSP_SERVER_REAL) ff_real_parse_sdp_a_line(s, s->nb_streams - 1, p); - rtsp_st = s->streams[s->nb_streams - 1]->priv_data; + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; if (rtsp_st->dynamic_handler && rtsp_st->dynamic_handler->parse_sdp_a_line) rtsp_st->dynamic_handler->parse_sdp_a_line(s, diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index d54be1a5c2..34deeeb636 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -79,14 +79,12 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) /* 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)); From ce41c51b0c71c87f623914ba0786aef325d818fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 2 Feb 2011 10:57:26 +0200 Subject: [PATCH 204/528] Free AVStream->info in chained muxers This fixes memory leaks in the RTSP muxer and RTP hinting in the mov muxer present since SVN rev 25418. Signed-off-by: Luca Barbato --- libavformat/movenchint.c | 2 ++ libavformat/rtpenc_chain.c | 1 + libavformat/rtsp.c | 1 + 3 files changed, 4 insertions(+) diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index 2ebe8b808f..2aa0f17d54 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -86,6 +86,7 @@ fail: } if (track->rtp_ctx && track->rtp_ctx->streams[0]) { av_metadata_free(&track->rtp_ctx->streams[0]->metadata); + av_free(track->rtp_ctx->streams[0]->info); av_free(track->rtp_ctx->streams[0]); } if (track->rtp_ctx) { @@ -490,6 +491,7 @@ void ff_mov_close_hinting(MOVTrack *track) { } av_metadata_free(&rtp_ctx->streams[0]->metadata); av_metadata_free(&rtp_ctx->metadata); + av_free(rtp_ctx->streams[0]->info); av_free(rtp_ctx->streams[0]); av_freep(&rtp_ctx); } diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index 10d9df2065..19ea98f643 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -70,6 +70,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } + av_free(rtpctx->streams[0]->info); av_free(rtpctx->streams[0]); av_free(rtpctx); return NULL; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index e1d750324d..52c686c3e5 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -500,6 +500,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s) } av_metadata_free(&rtpctx->streams[0]->metadata); av_metadata_free(&rtpctx->metadata); + av_free(rtpctx->streams[0]->info); av_free(rtpctx->streams[0]); av_free(rtpctx); } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) From 62ecd3635a1329c49bc3b97ba84ad4d53d847163 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Wed, 2 Feb 2011 21:54:14 +0100 Subject: [PATCH 205/528] Set pkt_pts in avcodec_default_reget_buffer() This was missed when pkt_pts was first added. Signed-off-by: Nicolas George Signed-off-by: Mans Rullgard --- libavcodec/utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 53a0674323..e9db33e9d7 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -396,6 +396,8 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){ /* If internal buffer type return the same buffer */ if(pic->type == FF_BUFFER_TYPE_INTERNAL) { + if(s->pkt) pic->pkt_pts= s->pkt->pts; + else pic->pkt_pts= AV_NOPTS_VALUE; pic->reordered_opaque= s->reordered_opaque; return 0; } From dc75d6dbf2af3c03b33d3159e1dadccf22c076ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 3 Feb 2011 01:40:35 +0100 Subject: [PATCH 206/528] Avoid pointless check before calling free Signed-off-by: Mans Rullgard --- libavutil/mem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavutil/mem.c b/libavutil/mem.c index 18fe28b7ce..7ffd6cba9b 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -138,12 +138,11 @@ void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) void av_free(void *ptr) { - /* XXX: this test should not be needed on most libcs */ - if (ptr) #if CONFIG_MEMALIGN_HACK + if (ptr) free((char*)ptr - ((char*)ptr)[-1]); #else - free(ptr); + free(ptr); #endif } From 437fb1c87d7b4b0730db97d0858b4f39fffff2a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 3 Feb 2011 02:09:36 +0100 Subject: [PATCH 207/528] Remove a few if (p) av_free(p) forms Signed-off-by: Mans Rullgard --- libavcodec/dvbsubdec.c | 7 ++----- libavcodec/flashsv.c | 6 ++---- libavcodec/libxvidff.c | 9 +++------ libavcodec/mpegaudiodec.c | 3 +-- libavcodec/smacker.c | 9 +++------ libavcodec/truemotion2.c | 12 ++++-------- libavcodec/tta.c | 3 +-- libavformat/rtpdec_mpeg4.c | 3 +-- libavformat/smacker.c | 9 +++------ 9 files changed, 20 insertions(+), 41 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 0f1e004689..fe9879822f 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -332,9 +332,7 @@ static void delete_state(DVBSubContext *ctx) ctx->region_list = region->next; delete_region_display_list(ctx, region); - if (region->pbuf) - av_free(region->pbuf); - + av_free(region->pbuf); av_free(region); } @@ -1032,8 +1030,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx, buf += 2; if (region->width * region->height != region->buf_size) { - if (region->pbuf) - av_free(region->pbuf); + av_free(region->pbuf); region->buf_size = region->width * region->height; diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 08748c65d1..f5ffca08ac 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -133,8 +133,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, /* the block size could change between frames, make sure the buffer * is large enough, if not, get a larger one */ if(s->block_size < s->block_width*s->block_height) { - if (s->tmpblock != NULL) - av_free(s->tmpblock); + av_free(s->tmpblock); if ((s->tmpblock = av_malloc(3*s->block_width*s->block_height)) == NULL) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return -1; @@ -243,8 +242,7 @@ static av_cold int flashsv_decode_end(AVCodecContext *avctx) avctx->release_buffer(avctx, &s->frame); /* free the tmpblock */ - if (s->tmpblock != NULL) - av_free(s->tmpblock); + av_free(s->tmpblock); return 0; } diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c index d95ddee8d7..771fc2be64 100644 --- a/libavcodec/libxvidff.c +++ b/libavcodec/libxvidff.c @@ -533,12 +533,9 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) { av_free(x->twopassbuffer); av_free(x->old_twopassbuffer); } - if( x->twopassfile != NULL ) - av_free(x->twopassfile); - if( x->intra_matrix != NULL ) - av_free(x->intra_matrix); - if( x->inter_matrix != NULL ) - av_free(x->inter_matrix); + av_free(x->twopassfile); + av_free(x->intra_matrix); + av_free(x->inter_matrix); return 0; } diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 0cd0b688c1..7b296c4507 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -2227,8 +2227,7 @@ static av_cold int decode_close_mp3on4(AVCodecContext * avctx) int i; for (i = 0; i < s->frames; i++) - if (s->mp3decctx[i]) - av_free(s->mp3decctx[i]); + av_free(s->mp3decctx[i]); return 0; } diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 2fcc33511f..fa8b4e3a18 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -677,12 +677,9 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, for(i = 0; i < 4; i++) { if(vlc[i].table) free_vlc(&vlc[i]); - if(h[i].bits) - av_free(h[i].bits); - if(h[i].lengths) - av_free(h[i].lengths); - if(h[i].values) - av_free(h[i].values); + av_free(h[i].bits); + av_free(h[i].lengths); + av_free(h[i].values); } *data_size = unp_size; diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index d20ee94b29..86454ec291 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -185,8 +185,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code) static void tm2_free_codes(TM2Codes *code) { - if(code->recode) - av_free(code->recode); + av_free(code->recode); if(code->vlc.table) free_vlc(&code->vlc); } @@ -859,13 +858,10 @@ static av_cold int decode_end(AVCodecContext *avctx){ AVFrame *pic = &l->pic; int i; - if(l->last) - av_free(l->last); - if(l->clast) - av_free(l->clast); + av_free(l->last); + av_free(l->clast); for(i = 0; i < TM2_NUM_STREAMS; i++) - if(l->tokens[i]) - av_free(l->tokens[i]); + av_free(l->tokens[i]); if(l->Y1){ av_free(l->Y1); av_free(l->U1); diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 936dff2333..eb4d71ff85 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -449,8 +449,7 @@ static int tta_decode_frame(AVCodecContext *avctx, static av_cold int tta_decode_close(AVCodecContext *avctx) { TTAContext *s = avctx->priv_data; - if (s->decode_buffer) - av_free(s->decode_buffer); + av_free(s->decode_buffer); av_freep(&s->ch_ctx); return 0; diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c index 137dbd2613..5498d1c46b 100644 --- a/libavformat/rtpdec_mpeg4.c +++ b/libavformat/rtpdec_mpeg4.c @@ -111,8 +111,7 @@ static int parse_fmtp_config(AVCodecContext * codec, char *value) { /* decode the hexa encoded parameter */ int len = ff_hex_to_data(NULL, value); - if (codec->extradata) - av_free(codec->extradata); + av_free(codec->extradata); codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) return AVERROR(ENOMEM); diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 71a968eed7..92da91e81e 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -334,12 +334,9 @@ static int smacker_read_close(AVFormatContext *s) int i; for(i = 0; i < 7; i++) - if(smk->bufs[i]) - av_free(smk->bufs[i]); - if(smk->frm_size) - av_free(smk->frm_size); - if(smk->frm_flags) - av_free(smk->frm_flags); + av_free(smk->bufs[i]); + av_free(smk->frm_size); + av_free(smk->frm_flags); return 0; } From aa42cce57ddf34b4e2c365859206eb52e2415ff5 Mon Sep 17 00:00:00 2001 From: Benjamin Larsson Date: Wed, 2 Feb 2011 14:03:46 +0100 Subject: [PATCH 208/528] Add AVC-Intra identifiers used by Flip4Mac for mov files Signed-off-by: Mans Rullgard --- libavformat/isom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/isom.c b/libavformat/isom.c index 23ef82a1ce..71a97b37fc 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -134,6 +134,8 @@ const AVCodecTag codec_movvideo_tags[] = { { CODEC_ID_RAWVIDEO, MKTAG('W', 'R', 'A', 'W') }, { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', '5') }, /* Flip4Mac AVC Intra 50 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* Flip4Mac AVC Intra 100 */ { CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */ { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */ From f5b82f45dce8b734074a5e72e22ae42078ae9ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Thu, 3 Feb 2011 10:47:48 +0100 Subject: [PATCH 209/528] Add CODEC_ID_PRORES and bump lavc minor version Signed-off-by: Mans Rullgard --- libavcodec/avcodec.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index d0de6107d1..dbfb77795d 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -32,7 +32,7 @@ #include "libavutil/cpu.h" #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 108 +#define LIBAVCODEC_VERSION_MINOR 109 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -260,6 +260,7 @@ enum CodecID { CODEC_ID_R10K, CODEC_ID_MXPEG, CODEC_ID_LAGARITH, + CODEC_ID_PRORES, /* various PCM "codecs" */ CODEC_ID_PCM_S16LE= 0x10000, From 75fd0668df64c4b7140be5ac829dee4e327a3e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Thu, 3 Feb 2011 12:00:02 +0100 Subject: [PATCH 210/528] Add APIchanges entry for lavc 52.109.0 Signed-off-by: Mans Rullgard --- doc/APIchanges | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 76a95ec6d3..af3e2020f0 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-03 - f5b82f4 - lavc 52.109.0 - add CODEC_ID_PRORES + Add CODEC_ID_PRORES to avcodec.h. + 2011-02-02 - lavf 52.95.0 * 50196a9 - add a new installed header version.h. * 4efd5cf, dccbd97, 93b78d1 - add several variants of public From e65b1934bf4f2fbde611b75ea6c0c871daaf0b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Thu, 3 Feb 2011 10:50:50 +0100 Subject: [PATCH 211/528] Add ProRes FOURCCs to isom.c Signed-off-by: Mans Rullgard --- libavformat/isom.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/isom.c b/libavformat/isom.c index 71a97b37fc..89b352c75d 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -195,6 +195,12 @@ const AVCodecTag codec_movvideo_tags[] = { { CODEC_ID_SGI, MKTAG('s', 'g', 'i', ' ') }, /* SGI */ { CODEC_ID_DPX, MKTAG('d', 'p', 'x', ' ') }, /* DPX */ + { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'h') }, /* Apple ProRes 422 High Quality */ + { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'n') }, /* Apple ProRes 422 Standard Definition */ + { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 's') }, /* Apple ProRes 422 LT */ + { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'o') }, /* Apple ProRes 422 Proxy */ + { CODEC_ID_PRORES, MKTAG('a', 'p', '4', 'h') }, /* Apple ProRes 4444 */ + { CODEC_ID_NONE, 0 }, }; From 9ad4c65f6fa7ff6d3fb7d5ea02908bbd6adc583f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 11:17:35 +0000 Subject: [PATCH 212/528] rtmpproto: rename URLContext* argument in rtmp_write() Now the first argument is URLContext *h. However, the function logs to LOG_CONTEXT, which is #defined as 's' for new lavf major versions. Therefore, rename h -> s. Signed-off-by: Mans Rullgard --- libavformat/rtmpproto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 3ad49d6234..748aab33cc 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -923,9 +923,9 @@ static int rtmp_read(URLContext *s, uint8_t *buf, int size) return orig_size; } -static int rtmp_write(URLContext *h, const uint8_t *buf, int size) +static int rtmp_write(URLContext *s, const uint8_t *buf, int size) { - RTMPContext *rt = h->priv_data; + RTMPContext *rt = s->priv_data; int size_temp = size; int pktsize, pkttype; uint32_t ts; From 1f56f5ed6d68f6492e213944e145e04e4d4dca13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 3 Feb 2011 12:10:12 +0000 Subject: [PATCH 213/528] sapenc: Free AVStream->info on cleanup This fixes yet another memory leak, present since SVN rev 25418. Signed-off-by: Mans Rullgard --- libavformat/sapenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index b14c511cea..088f7bda01 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -48,6 +48,7 @@ static int sap_write_close(AVFormatContext *s) url_fclose(rtpctx->pb); av_metadata_free(&rtpctx->streams[0]->metadata); av_metadata_free(&rtpctx->metadata); + av_free(rtpctx->streams[0]->info); av_free(rtpctx->streams[0]); av_free(rtpctx); s->streams[i]->priv_data = NULL; From b2ed95ec48aceb21a9bb47af85d259ee52b8b7ea Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 13:34:00 +0000 Subject: [PATCH 214/528] Replace remaining occurrences of CODEC_TYPE_* with AVMEDIA_TYPE* Tested to compile with lavc major bump. Signed-off-by: Mans Rullgard --- libavcodec/aacdec.c | 2 +- libavcodec/amrwbdec.c | 2 +- libavcodec/lagarith.c | 2 +- libavformat/ivfenc.c | 2 +- libavformat/rtpdec_qt.c | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 411c1dfc1b..bc92f5662f 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -2363,7 +2363,7 @@ AVCodec ff_aac_decoder = { */ AVCodec ff_aac_latm_decoder = { .name = "aac_latm", - .type = CODEC_TYPE_AUDIO, + .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_AAC_LATM, .priv_data_size = sizeof(struct LATMContext), .init = latm_decode_init, diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 8bf02a2b10..1735c29ccc 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -1227,7 +1227,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVCodec ff_amrwb_decoder = { .name = "amrwb", - .type = CODEC_TYPE_AUDIO, + .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_AMR_WB, .priv_data_size = sizeof(AMRWBContext), .init = amrwb_decode_init, diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 89580dc159..d53cd05c6b 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -510,7 +510,7 @@ static av_cold int lag_decode_end(AVCodecContext *avctx) AVCodec ff_lagarith_decoder = { "lagarith", - CODEC_TYPE_VIDEO, + AVMEDIA_TYPE_VIDEO, CODEC_ID_LAGARITH, sizeof(LagarithContext), lag_decode_init, diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index b3b28419f1..021eb5163a 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -30,7 +30,7 @@ static int ivf_write_header(AVFormatContext *s) return AVERROR(EINVAL); } ctx = s->streams[0]->codec; - if (ctx->codec_type != CODEC_TYPE_VIDEO || ctx->codec_id != CODEC_ID_VP8) { + if (ctx->codec_type != AVMEDIA_TYPE_VIDEO || ctx->codec_id != CODEC_ID_VP8) { av_log(s, AV_LOG_ERROR, "Currently only VP8 is supported!\n"); return AVERROR(EINVAL); } diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 5cca076079..28460a7ad9 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -104,9 +104,9 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, url_fseek(&pb, pos + 4, SEEK_SET); tag = get_le32(&pb); - if ((st->codec->codec_type == CODEC_TYPE_VIDEO && + if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO && tag != MKTAG('v','i','d','e')) || - (st->codec->codec_type == CODEC_TYPE_AUDIO && + (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && tag != MKTAG('s','o','u','n'))) return AVERROR_INVALIDDATA; av_set_pts_info(st, 32, 1, get_be32(&pb)); @@ -248,7 +248,7 @@ RTPDynamicProtocolHandler ff_ ## m ## _rtp_ ## n ## _handler = { \ .parse_packet = 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); +RTP_QT_HANDLER(qt, vid, "X-QT", AVMEDIA_TYPE_VIDEO); +RTP_QT_HANDLER(qt, aud, "X-QT", AVMEDIA_TYPE_AUDIO); +RTP_QT_HANDLER(quicktime, vid, "X-QUICKTIME", AVMEDIA_TYPE_VIDEO); +RTP_QT_HANDLER(quicktime, aud, "X-QUICKTIME", AVMEDIA_TYPE_AUDIO); From 151595fe2e06969a83654564a15feb5b9e8aa2c4 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 13:34:01 +0000 Subject: [PATCH 215/528] Rename remaining occurrences of SAMPLE_FMT_* to AV_SAMPLE_FMT_* Signed-off-by: Mans Rullgard --- libavcodec/amrwbdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 1735c29ccc..90bf1d5fdf 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -89,7 +89,7 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx) AMRWBContext *ctx = avctx->priv_data; int i; - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; av_lfg_init(&ctx->prng, 1); @@ -1233,5 +1233,5 @@ AVCodec ff_amrwb_decoder = { .init = amrwb_decode_init, .decode = amrwb_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate WideBand"), - .sample_fmts = (enum AVSampleFormat[]){SAMPLE_FMT_FLT,SAMPLE_FMT_NONE}, + .sample_fmts = (enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE}, }; From a9d921cbad7ec7e88bdb81b046faa9c1c6ac6d3d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 13:34:02 +0000 Subject: [PATCH 216/528] tty.c: rename PKT_FLAG_KEY to AV_PKT_FLAG_KEY. Signed-off-by: Mans Rullgard --- libavformat/tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/tty.c b/libavformat/tty.c index 0adbaf1f11..1003157ee0 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -120,7 +120,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) pkt->size = av_get_packet(avctx->pb, pkt, n); if (pkt->size <= 0) return AVERROR(EIO); - pkt->flags |= PKT_FLAG_KEY; + pkt->flags |= AV_PKT_FLAG_KEY; return 0; } From f61dee2fe4bc6a614079f37c25af1f92e90bc35b Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 23 Jan 2011 12:58:59 +1100 Subject: [PATCH 217/528] wtv: filesystem implementation Signed-off-by: Ronald S. Bultje --- libavformat/wtv.c | 642 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 564 insertions(+), 78 deletions(-) diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 816c4062cb..3d182576bd 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -1,6 +1,6 @@ /* * Windows Television (WTV) demuxer - * Copyright (c) 2010 Peter Ross + * Copyright (c) 2010-2011 Peter Ross * * This file is part of FFmpeg. * @@ -26,6 +26,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/intfloat_readwrite.h" #include "avformat.h" #include "riff.h" #include "asf.h" @@ -37,21 +38,293 @@ #define ARG_GUID(g) \ g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15] +#define PRI_PRETTY_GUID \ + "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x" +#define ARG_PRETTY_GUID(g) \ + AV_RL32(g),AV_RL16(g+4),AV_RL16(g+6),g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15] +#define LEN_PRETTY_GUID 34 + +/* + * + * File system routines + * + */ + +#define WTV_SECTOR_BITS 12 +#define WTV_SECTOR_SIZE (1 << WTV_SECTOR_BITS) +#define WTV_BIGSECTOR_BITS 18 + +typedef struct { + ByteIOContext *pb_filesystem; /** file system (AVFormatContext->pb) */ + + int sector_bits; /** sector shift bits; used to convert sector number into pb_filesystem offset */ + uint32_t *sectors; /** file allocation table */ + int nb_sectors; /** number of sectors */ + + int error; + int64_t position; + int64_t length; +} WtvFile; + +/** + * @return bytes read, 0 on end of file, or <0 on error + */ +static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) +{ + WtvFile *wf = opaque; + ByteIOContext *pb = wf->pb_filesystem; + int nread = 0; + + if (wf->error || url_ferror(pb)) + return -1; + if (wf->position >= wf->length || url_feof(pb)) + return 0; + + buf_size = FFMIN(buf_size, wf->length - wf->position); + while(nread < buf_size) { + int n; + int remaining_in_sector = (1 << wf->sector_bits) - (wf->position & ((1 << wf->sector_bits) - 1)); + int read_request = FFMIN(buf_size - nread, remaining_in_sector); + + n = get_buffer(pb, buf, read_request); + if (n <= 0) + break; + nread += n; + buf += n; + wf->position += n; + if (n == remaining_in_sector) { + int i = wf->position >> wf->sector_bits; + if (i >= wf->nb_sectors || + (wf->sectors[i] != wf->sectors[i - 1] + (1 << (wf->sector_bits - WTV_SECTOR_BITS)) && + url_fseek(pb, (int64_t)wf->sectors[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)) { + wf->error = 1; + break; + } + } + } + return nread; +} + +/** + * @return position (or file length) + */ +static int64_t wtvfile_seek(void *opaque, int64_t offset, int whence) +{ + WtvFile *wf = opaque; + ByteIOContext *pb = wf->pb_filesystem; + + if (whence == AVSEEK_SIZE) + return wf->length; + else if (whence == SEEK_CUR) + offset = wf->position + offset; + else if (whence == SEEK_END) + offset = wf->length; + + wf->error = offset < 0 || offset >= wf->length || + url_fseek(pb, ((int64_t)wf->sectors[offset >> wf->sector_bits] << WTV_SECTOR_BITS) + + (offset & ((1 << wf->sector_bits) - 1)), SEEK_SET) < 0; + wf->position = offset; + return offset; +} + +/** + * read non-zero integers (le32) from input stream + * @param pb + * @param[out] data destination + * @param count maximum number of integers to read + * @return total number of integers read + */ +static int read_ints(ByteIOContext *pb, uint32_t *data, int count) +{ + int i, total = 0; + for (i = 0; i < count; i++) { + if ((data[total] = get_le32(pb))) + total++; + } + return total; +} + +/** + * Open file + * @param first_sector First sector + * @param length Length of file (bytes) + * @param depth File allocation table depth + * @return NULL on error + */ +static ByteIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s) +{ + ByteIOContext *pb; + WtvFile *wf; + uint8_t *buffer; + + if (url_fseek(s->pb, first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0) + return NULL; + + wf = av_mallocz(sizeof(WtvFile)); + if (!wf) + return NULL; + + if (depth == 0) { + wf->sectors = av_malloc(sizeof(uint32_t)); + if (!wf->sectors) { + av_free(wf); + return NULL; + } + wf->sectors[0] = first_sector; + wf->nb_sectors = 1; + wf->sector_bits = WTV_SECTOR_BITS; + } else if (depth == 1) { + wf->sectors = av_malloc(WTV_SECTOR_SIZE); + if (!wf->sectors) { + av_free(wf); + return NULL; + } + wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4); + wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS; + } else if (depth == 2) { + uint32_t sectors1[WTV_SECTOR_SIZE / 4]; + int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4); + int i; + + wf->sectors = av_malloc(nb_sectors1 << WTV_SECTOR_BITS); + if (!wf->sectors) { + av_free(wf); + return NULL; + } + wf->nb_sectors = 0; + for (i = 0; i < nb_sectors1; i++) { + if (url_fseek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0) + break; + wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4); + } + wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS; + } else { + av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", depth); + av_free(wf); + return NULL; + } + + if (!wf->nb_sectors) { + av_free(wf->sectors); + av_free(wf); + return NULL; + } + + /* check length */ + length &= 0xFFFFFFFFFFFF; + if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) { + av_log(s, AV_LOG_WARNING, "reported file length (0x%"PRIx64") exceeds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bits); + length = (int64_t)wf->nb_sectors << wf->sector_bits; + } + wf->length = length; + + /* seek to intial sector */ + wf->position = 0; + if (url_fseek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) { + av_free(wf->sectors); + av_free(wf); + return NULL; + } + + wf->pb_filesystem = s->pb; + buffer = av_malloc(1 << wf->sector_bits); + if (!buffer) { + av_free(wf->sectors); + av_free(wf); + return NULL; + } + + pb = av_alloc_put_byte(buffer, 1 << wf->sector_bits, 0, wf, + wtvfile_read_packet, NULL, wtvfile_seek); + if (!pb) { + av_free(buffer); + av_free(wf->sectors); + av_free(wf); + } + return pb; +} + +static const ff_asf_guid dir_entry_guid = + {0x92,0xB7,0x74,0x91,0x59,0x70,0x70,0x44,0x88,0xDF,0x06,0x3B,0x82,0xCC,0x21,0x3D}; + +/** + * Open file using filename + * @param[in] buf directory buffer + * @param buf_size directory buffer size + * @param[in] filename + * @param filename_size size of filename + * @return NULL on error + */ +static ByteIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int buf_size, const uint8_t *filename, int filename_size) +{ + const uint8_t *buf_end = buf + buf_size; + + while(buf + 48 <= buf_end) { + int dir_length, name_size, first_sector, depth; + uint64_t file_length; + const uint8_t *name; + if (ff_guidcmp(buf, dir_entry_guid)) { + av_log(s, AV_LOG_ERROR, "unknown guid "PRI_GUID", expected dir_entry_guid; " + "remaining directory entries ignored\n", ARG_GUID(buf)); + break; + } + dir_length = AV_RL16(buf + 16); + file_length = AV_RL64(buf + 24); + name_size = 2 * AV_RL32(buf + 32); + if (buf + 48 + name_size > buf_end) { + av_log(s, AV_LOG_ERROR, "filename exceeds buffer size; remaining directory entries ignored\n"); + break; + } + first_sector = AV_RL32(buf + 40 + name_size); + depth = AV_RL32(buf + 44 + name_size); + + /* compare file name; test optional null terminator */ + name = buf + 40; + if (name_size >= filename_size && + !memcmp(name, filename, filename_size) && + (name_size < filename_size + 2 || !AV_RN16(name + filename_size))) + return wtvfile_open_sector(first_sector, file_length, depth, s); + + buf += dir_length; + } + return 0; +} + +#define wtvfile_open(s, buf, buf_size, filename) \ + wtvfile_open2(s, buf, buf_size, filename, sizeof(filename)) + +/** + * Close file opened with wtvfile_open_sector(), or wtv_open() + */ +static void wtvfile_close(ByteIOContext *pb) +{ + WtvFile *wf = pb->opaque; + av_free(wf->sectors); + av_free(pb); +} + +/* + * + * Main demuxer + * + */ + typedef struct { int seen_data; } WtvStream; -typedef struct WtvContext { - uint64_t pts; -} WtvContext; +typedef struct { + ByteIOContext *pb; /** timeline file */ + int64_t epoch; + int64_t pts; /** pts for next data chunk */ + int64_t last_valid_pts; /** latest valid pts, used for interative seeking */ -static int is_zero(uint8_t *v, int n) -{ - int i; - for (i = 0; i < n; i++) - if (v[i]) return 0; - return 1; -} + /* maintain private seek index, as the AVIndexEntry->pos is relative to the + start of the 'timeline' file, not the file system (AVFormatContext->pb) */ + AVIndexEntry *index_entries; + int nb_index_entries; + unsigned int index_entries_allocated_size; +} WtvContext; typedef struct { enum CodecID id; @@ -71,7 +344,7 @@ static enum CodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid g /* WTV GUIDs */ static const ff_asf_guid wtv_guid = {0xB7,0xD8,0x00,0x20,0x37,0x49,0xDA,0x11,0xA6,0x4E,0x00,0x07,0xE9,0x5E,0xAD,0x8D}; -static const ff_asf_guid meta_guid = +static const ff_asf_guid metadata_guid = {0x5A,0xFE,0xD7,0x6D,0xC8,0x1D,0x8F,0x4A,0x99,0x22,0xFA,0xB1,0x1C,0x38,0x14,0x53}; static const ff_asf_guid timestamp_guid = {0x5B,0x05,0xE6,0x1B,0x97,0xA9,0x49,0x43,0x88,0x17,0x1A,0x65,0x5A,0x29,0x8A,0x97}; @@ -158,13 +431,152 @@ static int read_probe(AVProbeData *p) return ff_guidcmp(p->buf, wtv_guid) ? 0 : AVPROBE_SCORE_MAX; } +/** + * Convert win32 FILETIME to ISO-8601 string + */ +static void filetime_to_iso8601(char *buf, int buf_size, int64_t value) +{ + time_t t = (value / 10000000LL) - 11644473600LL; + strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); +} + +/** + * Convert crazy time (100ns since 1 Jan 0001) to ISO-8601 string + */ +static void crazytime_to_iso8601(char *buf, int buf_size, int64_t value) +{ + time_t t = (value / 10000000LL) - 719162LL*86400LL; + strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); +} + +/** + * Convert OLE DATE to ISO-8601 string + */ +static void oledate_to_iso8601(char *buf, int buf_size, int64_t value) +{ + time_t t = 631112400LL + 86400*av_int2dbl(value); + strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); +} + +static void get_attachment(AVFormatContext *s, ByteIOContext *pb, int length) +{ + char mime[1024]; + char description[1024]; + unsigned int filesize; + AVStream *st; + int64_t pos = url_ftell(pb); + + avio_get_str16le(pb, INT_MAX, mime, sizeof(mime)); + if (strcmp(mime, "image/jpeg")) + goto done; + + get_byte(pb); + avio_get_str16le(pb, INT_MAX, description, sizeof(description)); + filesize = get_le32(pb); + if (!filesize) + goto done; + + st = av_new_stream(s, 0); + if (!st) + goto done; + av_metadata_set2(&st->metadata, "title", description, 0); + st->codec->codec_id = CODEC_ID_MJPEG; + st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; + st->codec->extradata = av_mallocz(filesize); + if (!st->codec->extradata) + goto done; + st->codec->extradata_size = filesize; + get_buffer(pb, st->codec->extradata, filesize); +done: + url_fseek(pb, pos + length, SEEK_SET); +} + +static void get_tag(AVFormatContext *s, ByteIOContext *pb, const char *key, int type, int length) +{ + int buf_size = FFMAX(2*length, LEN_PRETTY_GUID) + 1; + char *buf = av_malloc(buf_size); + if (!buf) + return; + + if (type == 0 && length == 4) { + snprintf(buf, buf_size, "%"PRIi32, get_le32(pb)); + } else if (type == 1) { + avio_get_str16le(pb, length, buf, buf_size); + if (!strlen(buf)) { + av_free(buf); + return; + } + } else if (type == 3 && length == 4) { + strcpy(buf, get_le32(pb) ? "true" : "false"); + } else if (type == 4 && length == 8) { + int64_t num = get_le64(pb); + if (!strcmp(key, "WM/EncodingTime") || + !strcmp(key, "WM/MediaOriginalBroadcastDateTime")) + filetime_to_iso8601(buf, buf_size, num); + else if (!strcmp(key, "WM/WMRVEncodeTime") || + !strcmp(key, "WM/WMRVEndTime")) + crazytime_to_iso8601(buf, buf_size, num); + else if (!strcmp(key, "WM/WMRVExpirationDate")) + oledate_to_iso8601(buf, buf_size, num); + else if (!strcmp(key, "WM/WMRVBitrate")) + snprintf(buf, buf_size, "%f", av_int2dbl(num)); + else + snprintf(buf, buf_size, "%"PRIi64, num); + } else if (type == 5 && length == 2) { + snprintf(buf, buf_size, "%"PRIi16, get_le16(pb)); + } else if (type == 6 && length == 16) { + ff_asf_guid guid; + get_buffer(pb, guid, 16); + snprintf(buf, buf_size, PRI_PRETTY_GUID, ARG_PRETTY_GUID(guid)); + } else if (type == 2 && !strcmp(key, "WM/Picture")) { + get_attachment(s, pb, length); + av_freep(&buf); + return; + } else { + av_freep(&buf); + av_log(s, AV_LOG_WARNING, "unsupported metadata entry; key:%s, type:%d, length:0x%x\n", key, type, length); + url_fskip(pb, length); + return; + } + + av_metadata_set2(&s->metadata, key, buf, 0); + av_freep(&buf); +} + +/** + * Parse metadata entries + */ +static void parse_legacy_attrib(AVFormatContext *s, ByteIOContext *pb) +{ + ff_asf_guid guid; + int length, type; + while(!url_feof(pb)) { + char key[1024]; + ff_get_guid(pb, &guid); + type = get_le32(pb); + length = get_le32(pb); + if (!length) + break; + if (ff_guidcmp(&guid, metadata_guid)) { + av_log(s, AV_LOG_WARNING, "unknown guid "PRI_GUID", expected metadata_guid; " + "remaining metadata entries ignored\n", ARG_GUID(guid)); + break; + } + avio_get_str16le(pb, INT_MAX, key, sizeof(key)); + get_tag(s, pb, key, type, length); + } + + ff_metadata_conv(&s->metadata, NULL, ff_asf_metadata_conv); +} + /** * parse VIDEOINFOHEADER2 structure * @return bytes consumed */ static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st) { - ByteIOContext *pb = s->pb; + WtvContext *wtv = s->priv_data; + ByteIOContext *pb = wtv->pb; url_fskip(pb, 72); // picture aspect ratio is unreliable ff_get_bmp_header(pb, st); @@ -233,7 +645,8 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, ff_asf_guid mediatype, ff_asf_guid subtype, ff_asf_guid formattype, int size) { - ByteIOContext *pb = s->pb; + WtvContext *wtv = s->priv_data; + ByteIOContext *pb = wtv->pb; if (!ff_guidcmp(subtype, mediasubtype_cpfilters_processed) && !ff_guidcmp(formattype, format_cpfilters_processed)) { ff_asf_guid actual_subtype; @@ -339,32 +752,25 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, enum { SEEK_TO_DATA = 0, - SEEK_TO_BYTE, SEEK_TO_PTS, }; /** * Parse WTV chunks - * @param mode SEEK_TO_DATA, SEEK_TO_BYTE, SEEK_TO_PTS - * @param seekts either byte position or timestamp + * @param mode SEEK_TO_DATA or SEEK_TO_PTS + * @param seekts timestamp * @param[out] len Length of data chunk * @return stream index of data chunk, or <0 on error */ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_ptr) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = s->pb; + ByteIOContext *pb = wtv->pb; while (!url_feof(pb)) { ff_asf_guid g; int len, sid, consumed; - if (mode == SEEK_TO_BYTE && url_ftell(pb) >= seekts) - return 0; - ff_get_guid(pb, &g); - if (is_zero(g, sizeof(ff_asf_guid))) - return AVERROR_EOF; - len = get_le32(pb); if (len < 32) break; @@ -458,11 +864,16 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p consumed += 16; if (wtv->pts == -1) wtv->pts = AV_NOPTS_VALUE; + else { + wtv->last_valid_pts = wtv->pts; + if (wtv->epoch == AV_NOPTS_VALUE || wtv->pts < wtv->epoch) + wtv->epoch = wtv->pts; if (mode == SEEK_TO_PTS && wtv->pts >= seekts) { #define WTV_PAD8(x) (((x) + 7) & ~7) url_fskip(pb, WTV_PAD8(len) - consumed); return 0; } + } } } else if (!ff_guidcmp(g, data_guid)) { int stream_index = ff_find_stream_index(s, sid); @@ -472,8 +883,6 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (len_ptr) { *len_ptr = len; } - if (wtv->pts != AV_NOPTS_VALUE) - av_add_index_entry(s->streams[stream_index], url_ftell(pb) - consumed, wtv->pts, 0, 0, AVINDEX_KEYFRAME); return stream_index; } } else if ( @@ -505,26 +914,114 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p return AVERROR_EOF; } -#define WTV_CHUNK_START 0x40000 +/* declare utf16le strings */ +#define _ , 0, +static const uint8_t timeline_le16[] = + {'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e', 0}; +static const uint8_t table_0_entries_legacy_attrib_le16[] = + {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0}; +static const uint8_t table_0_entries_time_le16[] = + {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'t'_'i'_'m'_'e', 0}; +static const uint8_t timeline_table_0_entries_Events_le16[] = + {'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e'_'.'_'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'E'_'v'_'e'_'n'_'t'_'s', 0}; +#undef _ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + WtvContext *wtv = s->priv_data; + int root_sector, root_size; + uint8_t root[WTV_SECTOR_SIZE]; + ByteIOContext *pb; + int64_t timeline_pos; int ret; - url_fseek(pb, WTV_CHUNK_START, SEEK_SET); + wtv->epoch = + wtv->pts = + wtv->last_valid_pts = AV_NOPTS_VALUE; + + /* read root directory sector */ + url_fskip(s->pb, 0x30); + root_size = get_le32(s->pb); + if (root_size > sizeof(root)) { + av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n"); + return AVERROR_INVALIDDATA; + } + url_fskip(s->pb, 4); + root_sector = get_le32(s->pb); + + url_fseek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); + root_size = get_buffer(s->pb, root, root_size); + if (root_size < 0) + return AVERROR_INVALIDDATA; + + /* parse chunks up until first data chunk */ + wtv->pb = wtvfile_open(s, root, root_size, timeline_le16); + if (!wtv->pb) { + av_log(s, AV_LOG_ERROR, "timeline data missing\n"); + return AVERROR_INVALIDDATA; + } + ret = parse_chunks(s, SEEK_TO_DATA, 0, 0); if (ret < 0) return ret; + url_fseek(wtv->pb, -32, SEEK_CUR); - url_fseek(pb, -32, SEEK_CUR); + timeline_pos = url_ftell(s->pb); // save before opening another file + + /* read metadata */ + pb = wtvfile_open(s, root, root_size, table_0_entries_legacy_attrib_le16); + if (pb) { + parse_legacy_attrib(s, pb); + wtvfile_close(pb); + } + + /* read seek index */ + if (s->nb_streams) { + AVStream *st = s->streams[0]; + pb = wtvfile_open(s, root, root_size, table_0_entries_time_le16); + if (pb) { + while(1) { + uint64_t timestamp = get_le64(pb); + uint64_t frame_nb = get_le64(pb); + if (url_feof(pb)) + break; + ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size, + 0, timestamp, frame_nb, 0, AVINDEX_KEYFRAME); + } + wtvfile_close(pb); + + if (wtv->nb_index_entries) { + pb = wtvfile_open(s, root, root_size, timeline_table_0_entries_Events_le16); + if (pb) { + int i; + while (1) { + uint64_t frame_nb = get_le64(pb); + uint64_t position = get_le64(pb); + if (url_feof(pb)) + break; + for (i = wtv->nb_index_entries - 1; i >= 0; i--) { + AVIndexEntry *e = wtv->index_entries + i; + if (frame_nb > e->size) + break; + if (position > e->pos) + e->pos = position; + } + } + wtvfile_close(pb); + st->duration = wtv->index_entries[wtv->nb_index_entries - 1].timestamp; + } + } + } + } + + url_fseek(s->pb, timeline_pos, SEEK_SET); return 0; } static int read_packet(AVFormatContext *s, AVPacket *pkt) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = s->pb; + ByteIOContext *pb = wtv->pb; int stream_index, len, ret; stream_index = parse_chunks(s, SEEK_TO_DATA, 0, &len); @@ -540,59 +1037,47 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } -static int read_seek2(AVFormatContext *s, int stream_index, - int64_t min_ts, int64_t ts, int64_t max_ts, int flags) +static int read_seek(AVFormatContext *s, int stream_index, + int64_t ts, int flags) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = s->pb; - AVStream *st; + ByteIOContext *pb = wtv->pb; + AVStream *st = s->streams[0]; + int64_t ts_relative; int i; - if (stream_index < 0) { - stream_index = av_find_default_stream_index(s); - if (stream_index < 0) - return -1; - } - st = s->streams[stream_index]; - - if ((flags & AVSEEK_FLAG_FRAME)) { + if ((flags & AVSEEK_FLAG_FRAME) || (flags & AVSEEK_FLAG_BYTE)) return AVERROR_NOTSUPP; - } else if ((flags & AVSEEK_FLAG_BYTE)) { - if (ts < url_ftell(pb)) { - for (i = st->nb_index_entries - 1; i >= 0; i--) { - if (st->index_entries[i].pos <= ts) { - wtv->pts = st->index_entries[i].timestamp; - url_fseek(pb, st->index_entries[i].pos, SEEK_SET); - break; - } - } - if (i < 0) { - wtv->pts = 0; - url_fseek(pb, WTV_CHUNK_START, SEEK_SET); - } - } - if (parse_chunks(s, SEEK_TO_BYTE, ts, 0) < 0) + + /* timestamp adjustment is required because wtv->pts values are absolute, + * whereas AVIndexEntry->timestamp values are relative to epoch. */ + ts_relative = ts; + if (wtv->epoch != AV_NOPTS_VALUE) + ts_relative -= wtv->epoch; + + i = ff_index_search_timestamp(wtv->index_entries, wtv->nb_index_entries, ts_relative, flags); + if (i < 0) { + if (wtv->last_valid_pts == AV_NOPTS_VALUE || ts < wtv->last_valid_pts) + url_fseek(pb, 0, SEEK_SET); + else if (st->duration != AV_NOPTS_VALUE && ts_relative > st->duration && wtv->nb_index_entries) + url_fseek(pb, wtv->index_entries[wtv->nb_index_entries - 1].pos, SEEK_SET); + if (parse_chunks(s, SEEK_TO_PTS, ts, 0) < 0) return AVERROR(ERANGE); return 0; - } else { - ts *= 10; - i = av_index_search_timestamp(st, ts, flags); - if (i < 0) { - if (st->nb_index_entries > 0) { - wtv->pts = st->index_entries[st->nb_index_entries - 1].timestamp; - url_fseek(pb, st->index_entries[st->nb_index_entries - 1].pos, SEEK_SET); - } else { - wtv->pts = 0; - url_fseek(pb, WTV_CHUNK_START, SEEK_SET); - } - if (parse_chunks(s, SEEK_TO_PTS, ts, 0) < 0) - return AVERROR(ERANGE); - return 0; - } - wtv->pts = st->index_entries[i].timestamp; - url_fseek(pb, st->index_entries[i].pos, SEEK_SET); - return 0; } + wtv->pts = wtv->index_entries[i].timestamp; + if (wtv->epoch != AV_NOPTS_VALUE) + wtv->pts += wtv->epoch; + wtv->last_valid_pts = wtv->pts; + url_fseek(pb, wtv->index_entries[i].pos, SEEK_SET); + return 0; +} + +static int read_close(AVFormatContext *s) +{ + WtvContext *wtv = s->priv_data; + wtvfile_close(wtv->pb); + return 0; } AVInputFormat ff_wtv_demuxer = { @@ -602,6 +1087,7 @@ AVInputFormat ff_wtv_demuxer = { .read_probe = read_probe, .read_header = read_header, .read_packet = read_packet, - .read_seek2 = read_seek2, - .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT, + .read_seek = read_seek, + .read_close = read_close, + .flags = AVFMT_SHOW_IDS, }; From 51b317d2e921f489de7fb72a7f5f05d3039fa1cb Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Wed, 2 Feb 2011 18:45:44 +0100 Subject: [PATCH 218/528] TCP: factor the poll() call Signed-off-by: Nicolas George Signed-off-by: Ronald S. Bultje --- libavformat/tcp.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index ac4e4b09db..564d69f19d 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -129,17 +129,26 @@ static int tcp_open(URLContext *h, const char *uri, int flags) return ret; } +static int tcp_wait_fd(int fd, int write) +{ + int ev = write ? POLLOUT : POLLIN; + struct pollfd p = { .fd = fd, .events = ev, .revents = 0 }; + int ret; + + ret = poll(&p, 1, 100); + return ret < 0 ? ff_neterrno() : !!(p.revents & ev); +} + static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h->priv_data; - struct pollfd p = {s->fd, POLLIN, 0}; int len, ret; for (;;) { if (url_interrupt_cb()) return AVERROR(EINTR); - ret = poll(&p, 1, 100); - if (ret == 1 && p.revents & POLLIN) { + ret = tcp_wait_fd(s->fd, 0); + if (ret > 0) { len = recv(s->fd, buf, size, 0); if (len < 0) { if (ff_neterrno() != FF_NETERROR(EINTR) && @@ -147,9 +156,9 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size) return ff_neterrno(); } else return len; } else if (ret < 0) { - if (ff_neterrno() == FF_NETERROR(EINTR)) + if (ret == FF_NETERROR(EINTR)) continue; - return -1; + return ret; } } } @@ -158,14 +167,13 @@ static int tcp_write(URLContext *h, const uint8_t *buf, int size) { TCPContext *s = h->priv_data; int ret, size1, len; - struct pollfd p = {s->fd, POLLOUT, 0}; size1 = size; while (size > 0) { if (url_interrupt_cb()) return AVERROR(EINTR); - ret = poll(&p, 1, 100); - if (ret == 1 && p.revents & POLLOUT) { + ret = tcp_wait_fd(s->fd, 1); + if (ret > 0) { len = send(s->fd, buf, size, 0); if (len < 0) { if (ff_neterrno() != FF_NETERROR(EINTR) && @@ -176,9 +184,9 @@ static int tcp_write(URLContext *h, const uint8_t *buf, int size) size -= len; buf += len; } else if (ret < 0) { - if (ff_neterrno() == FF_NETERROR(EINTR)) + if (ret == FF_NETERROR(EINTR)) continue; - return -1; + return ret; } } return size1 - size; From e6fb5a4f78a67ed815e39ba8ac3893fd631b9b1a Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sat, 22 Jan 2011 20:03:22 +1100 Subject: [PATCH 219/528] add ff_index_search_timestamp and ff_add_index_entry Signed-off-by: Ronald S. Bultje --- libavformat/internal.h | 14 +++++++++++++ libavformat/utils.c | 45 ++++++++++++++++++++++++++++-------------- libavformat/wtv.c | 1 + 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index b401d352cf..e53da7d46d 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -226,4 +226,18 @@ void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, */ int ff_find_stream_index(AVFormatContext *s, int id); +/** + * Internal version of av_index_search_timestamp + */ +int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries, + int64_t wanted_timestamp, int flags); + +/** + * Internal version of av_add_index_entry + */ +int ff_add_index_entry(AVIndexEntry **index_entries, + int *nb_index_entries, + unsigned int *index_entries_allocated_size, + int64_t pos, int64_t timestamp, int size, int distance, int flags); + #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavformat/utils.c b/libavformat/utils.c index 4f51c26697..6a5c0f066d 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1370,28 +1370,30 @@ void ff_reduce_index(AVFormatContext *s, int stream_index) } } -int av_add_index_entry(AVStream *st, - int64_t pos, int64_t timestamp, int size, int distance, int flags) +int ff_add_index_entry(AVIndexEntry **index_entries, + int *nb_index_entries, + unsigned int *index_entries_allocated_size, + int64_t pos, int64_t timestamp, int size, int distance, int flags) { AVIndexEntry *entries, *ie; int index; - if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry)) + if((unsigned)*nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry)) return -1; - entries = av_fast_realloc(st->index_entries, - &st->index_entries_allocated_size, - (st->nb_index_entries + 1) * + entries = av_fast_realloc(*index_entries, + index_entries_allocated_size, + (*nb_index_entries + 1) * sizeof(AVIndexEntry)); if(!entries) return -1; - st->index_entries= entries; + *index_entries= entries; - index= av_index_search_timestamp(st, timestamp, AVSEEK_FLAG_ANY); + index= ff_index_search_timestamp(*index_entries, *nb_index_entries, timestamp, AVSEEK_FLAG_ANY); if(index<0){ - index= st->nb_index_entries++; + index= (*nb_index_entries)++; ie= &entries[index]; assert(index==0 || ie[-1].timestamp < timestamp); }else{ @@ -1399,8 +1401,8 @@ int av_add_index_entry(AVStream *st, if(ie->timestamp != timestamp){ if(ie->timestamp <= timestamp) return -1; - memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index)); - st->nb_index_entries++; + memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(*nb_index_entries - index)); + (*nb_index_entries)++; }else if(ie->pos == pos && distance < ie->min_distance) //do not reduce the distance distance= ie->min_distance; } @@ -1414,11 +1416,17 @@ int av_add_index_entry(AVStream *st, return index; } -int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, - int flags) +int av_add_index_entry(AVStream *st, + int64_t pos, int64_t timestamp, int size, int distance, int flags) +{ + return ff_add_index_entry(&st->index_entries, &st->nb_index_entries, + &st->index_entries_allocated_size, pos, + timestamp, size, distance, flags); +} + +int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries, + int64_t wanted_timestamp, int flags) { - AVIndexEntry *entries= st->index_entries; - int nb_entries= st->nb_index_entries; int a, b, m; int64_t timestamp; @@ -1450,6 +1458,13 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, return m; } +int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, + int flags) +{ + return ff_index_search_timestamp(st->index_entries, st->nb_index_entries, + wanted_timestamp, flags); +} + #define DEBUG_SEEK int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){ diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 3d182576bd..e0881d3bf5 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -28,6 +28,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/intfloat_readwrite.h" #include "avformat.h" +#include "internal.h" #include "riff.h" #include "asf.h" #include "mpegts.h" From e8e5dde779fca80d86e00baea26d1baca333f4c0 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 1 Feb 2011 21:52:07 +0100 Subject: [PATCH 220/528] Make avfilter_graph_parse() not free the input graph Make avfilter_graph_parse() only release the internal structures allocated during the parsing, and leave to free the graph itself to the calling code. This approach looks cleaner, as the graph is not allocated by the function. Signed-off-by: Mans Rullgard --- libavfilter/graphparser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index 7151e4febc..47179e5e54 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -393,7 +393,9 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, return 0; fail: - avfilter_graph_free(graph); + for (; graph->filter_count > 0; graph->filter_count--) + avfilter_free(graph->filters[graph->filter_count - 1]); + av_freep(&graph->filters); free_inout(open_inputs); free_inout(open_outputs); free_inout(curr_inputs); From 4359288c565705d1734f63d277f8918ee5af5e54 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 1 Feb 2011 20:02:17 +0100 Subject: [PATCH 221/528] Make avfilter_graph_free() free the graph. Make avfilter_graph_free() free not only the internal structures, but also the allocated graph, and set the graph pointer to NULL for increased safety. Simplify usage. Signed-off-by: Mans Rullgard --- ffmpeg.c | 5 +---- ffplay.c | 3 +-- libavfilter/avfiltergraph.c | 13 +++++++------ libavfilter/avfiltergraph.h | 5 +++-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index fac6063474..6d4c0f6ae5 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2698,10 +2698,7 @@ static int transcode(AVFormatContext **output_files, } } #if CONFIG_AVFILTER - if (graph) { - avfilter_graph_free(graph); - av_freep(&graph); - } + avfilter_graph_free(&graph); #endif /* finished ! */ diff --git a/ffplay.c b/ffplay.c index 1fb75027dc..21c7205b24 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1899,8 +1899,7 @@ static int video_thread(void *arg) } the_end: #if CONFIG_AVFILTER - avfilter_graph_free(graph); - av_freep(&graph); + avfilter_graph_free(&graph); #endif av_free(frame); return 0; diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index a62fe2f79d..bdf22b3df9 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -32,14 +32,15 @@ AVFilterGraph *avfilter_graph_alloc(void) return av_mallocz(sizeof(AVFilterGraph)); } -void avfilter_graph_free(AVFilterGraph *graph) +void avfilter_graph_free(AVFilterGraph **graph) { - if (!graph) + if (!*graph) return; - for (; graph->filter_count > 0; graph->filter_count --) - avfilter_free(graph->filters[graph->filter_count - 1]); - av_freep(&graph->scale_sws_opts); - av_freep(&graph->filters); + for (; (*graph)->filter_count > 0; (*graph)->filter_count--) + avfilter_free((*graph)->filters[(*graph)->filter_count - 1]); + av_freep(&(*graph)->scale_sws_opts); + av_freep(&(*graph)->filters); + av_freep(graph); } int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter) diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h index 1b0d242dc5..0140af0801 100644 --- a/libavfilter/avfiltergraph.h +++ b/libavfilter/avfiltergraph.h @@ -79,9 +79,10 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt, int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx); /** - * Free a graph and destroy its links, graph may be NULL. + * Free a graph, destroy its links, and set *graph to NULL. + * If *graph is NULL, do nothing. */ -void avfilter_graph_free(AVFilterGraph *graph); +void avfilter_graph_free(AVFilterGraph **graph); /** * A linked-list of the inputs/outputs of the filter chain. From dd18c9a050ac1f1437151ceb2d2afbc96c5602d8 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 3 Feb 2011 19:17:13 -0800 Subject: [PATCH 222/528] VP8: simplify lf_delta mb mode logic --- libavcodec/vp8.c | 36 +++++++++++------------------------- libavcodec/vp8data.h | 6 ++---- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index effeb4ed2f..bcf623790c 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -162,13 +162,14 @@ typedef struct { /** * filter strength adjustment for the following macroblock modes: - * [0] - i4x4 - * [1] - zero mv - * [2] - inter modes except for zero or split mv - * [3] - split mv + * [0-3] - i16x16 (always zero) + * [4] - i4x4 + * [5] - zero mv + * [6] - inter modes except for zero or split mv + * [7] - split mv * i16x16 modes never have any adjustment */ - int8_t mode[4]; + int8_t mode[VP8_MVMODE_SPLIT+1]; /** * filter strength adjustment for macroblocks that reference: @@ -278,7 +279,7 @@ static void update_lf_deltas(VP8Context *s) for (i = 0; i < 4; i++) s->lf_delta.ref[i] = vp8_rac_get_sint(c, 6); - for (i = 0; i < 4; i++) + for (i = MODE_I4x4; i <= VP8_MVMODE_SPLIT; i++) s->lf_delta.mode[i] = vp8_rac_get_sint(c, 6); } @@ -762,6 +763,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_ // motion vectors, 16.3 find_near_mvs(s, mb, near, &best, cnt); if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[0]][0])) { + mb->mode = VP8_MVMODE_MV; 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])) { if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[3]][3])) { @@ -769,19 +771,14 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_ clamp_mv(s, &mb->mv, &mb->mv, mb_x, mb_y); mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1]; } 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]); } - } else { - mb->mode = VP8_MVMODE_NEAR; + } else clamp_mv(s, &mb->mv, &near[1], mb_x, mb_y); - } - } else { - mb->mode = VP8_MVMODE_NEAREST; + } else clamp_mv(s, &mb->mv, &near[0], mb_x, mb_y); - } } else { mb->mode = VP8_MVMODE_ZERO; AV_ZERO32(&mb->mv); @@ -1481,18 +1478,7 @@ static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *m if (s->lf_delta.enabled) { filter_level += s->lf_delta.ref[mb->ref_frame]; - - if (mb->ref_frame == VP56_FRAME_CURRENT) { - if (mb->mode == MODE_I4x4) - filter_level += s->lf_delta.mode[0]; - } else { - if (mb->mode == VP8_MVMODE_ZERO) - filter_level += s->lf_delta.mode[1]; - else if (mb->mode == VP8_MVMODE_SPLIT) - filter_level += s->lf_delta.mode[3]; - else - filter_level += s->lf_delta.mode[2]; - } + filter_level += s->lf_delta.mode[mb->mode]; } filter_level = av_clip(filter_level, 0, 63); diff --git a/libavcodec/vp8data.h b/libavcodec/vp8data.h index 775472e8e8..5326e21c0c 100644 --- a/libavcodec/vp8data.h +++ b/libavcodec/vp8data.h @@ -48,10 +48,8 @@ enum dct_token { #define MODE_I4x4 4 enum inter_mvmode { - VP8_MVMODE_NEAREST = MODE_I4x4 + 1, - VP8_MVMODE_NEAR, - VP8_MVMODE_ZERO, - VP8_MVMODE_NEW, + VP8_MVMODE_ZERO = MODE_I4x4 + 1, + VP8_MVMODE_MV, VP8_MVMODE_SPLIT }; From a1b227bb533f173354795124e0b966277c251b56 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 3 Feb 2011 19:44:32 -0800 Subject: [PATCH 223/528] VP8: faster filter_level clip --- libavcodec/vp8.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index bcf623790c..1db57e49ac 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1480,7 +1480,10 @@ static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *m filter_level += s->lf_delta.ref[mb->ref_frame]; filter_level += s->lf_delta.mode[mb->mode]; } - filter_level = av_clip(filter_level, 0, 63); + +/* Like av_clip for inputs 0 and max, where max is equal to (2^n-1) */ +#define POW2CLIP(x,max) (((x) & ~max) ? (-(x))>>31 & max : (x)); + filter_level = POW2CLIP(filter_level, 63); interior_limit = filter_level; if (s->filter.sharpness) { From 523d9407d57e9210428b6d962f0ebf48aae55638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 3 Feb 2011 11:30:17 +0100 Subject: [PATCH 224/528] Remove a few if (p) av_freep(&p) forms Signed-off-by: Mans Rullgard --- libavcodec/libxvidff.c | 3 +-- libavutil/tree.h | 2 +- libswscale/swscale-test.c | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c index 771fc2be64..9008b848ca 100644 --- a/libavcodec/libxvidff.c +++ b/libavcodec/libxvidff.c @@ -527,8 +527,7 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) { xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL); - if( avctx->extradata != NULL ) - av_freep(&avctx->extradata); + av_freep(&avctx->extradata); if( x->twopassbuffer != NULL ) { av_free(x->twopassbuffer); av_free(x->old_twopassbuffer); diff --git a/libavutil/tree.h b/libavutil/tree.h index bf09fd0be5..8c7de2ffbf 100644 --- a/libavutil/tree.h +++ b/libavutil/tree.h @@ -67,7 +67,7 @@ void *av_tree_find(const struct AVTreeNode *root, void *key, int (*cmp)(void *ke * return av_tree_insert(rootp, key, cmp, next); * } * void *tree_remove(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b, AVTreeNode **next)){ - * if(*next) av_freep(next); + * av_freep(next); * return av_tree_insert(rootp, key, cmp, next); * } * @endcode diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c index ae5f8b70fa..bd24f3e006 100644 --- a/libswscale/swscale-test.c +++ b/libswscale/swscale-test.c @@ -104,8 +104,7 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, int p; for (p = 0; p < 4; p++) - if (src[p]) - av_freep(&src[p]); + av_freep(&src[p]); av_image_fill_linesizes(srcStride, srcFormat, srcW); for (p = 0; p < 4; p++) { From 290849e2a4e76484f1a34506782e8dbfe7bbe406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 3 Feb 2011 11:31:41 +0100 Subject: [PATCH 225/528] Remove forgotten if (p) av_free(p) forms Signed-off-by: Mans Rullgard --- libavfilter/defaults.c | 2 +- libavformat/avidec.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c index 98339b6f30..9f245c306f 100644 --- a/libavfilter/defaults.c +++ b/libavfilter/defaults.c @@ -126,7 +126,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per return ref; fail: - if (ref && ref->audio) + if (ref) av_free(ref->audio); av_free(ref); av_free(samples); diff --git a/libavformat/avidec.c b/libavformat/avidec.c index d8d4726ae9..27a9d1fbc3 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1354,8 +1354,7 @@ static int avi_read_close(AVFormatContext *s) } } - if (avi->dv_demux) - av_free(avi->dv_demux); + av_free(avi->dv_demux); return 0; } From 79dec1541bf83fb587aee9a002649ad1fe038990 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 3 Feb 2011 22:48:53 -0800 Subject: [PATCH 226/528] VP8: faster deblock strength calculation Convert hev_thresh logic to a LUT, simplify mbedge_lim calculation. --- libavcodec/vp8.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 1db57e49ac..dce090f3e0 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1505,23 +1505,24 @@ static av_always_inline void filter_mb(VP8Context *s, uint8_t *dst[3], VP8Filter int inner_filter = f->inner_filter; int linesize = s->linesize; int uvlinesize = s->uvlinesize; + static const uint8_t hev_thresh_lut[2][64] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2 } + }; if (!filter_level) return; - mbedge_lim = 2*(filter_level+2) + inner_limit; - bedge_lim = 2* filter_level + inner_limit; - hev_thresh = filter_level >= 15; + bedge_lim = 2*filter_level + inner_limit; + mbedge_lim = bedge_lim + 4; - if (s->keyframe) { - if (filter_level >= 40) - hev_thresh = 2; - } else { - if (filter_level >= 40) - hev_thresh = 3; - else if (filter_level >= 20) - hev_thresh = 2; - } + hev_thresh = hev_thresh_lut[s->keyframe][filter_level]; if (mb_x) { s->vp8dsp.vp8_h_loop_filter16y(dst[0], linesize, @@ -1577,8 +1578,8 @@ static av_always_inline void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8Fi if (!filter_level) return; - mbedge_lim = 2*(filter_level+2) + inner_limit; - bedge_lim = 2* filter_level + inner_limit; + bedge_lim = 2*filter_level + inner_limit; + mbedge_lim = bedge_lim + 4; if (mb_x) s->vp8dsp.vp8_h_loop_filter_simple(dst, linesize, mbedge_lim); From 8a2c99b48688008dd0a01c4826161ad4f7c25436 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 3 Feb 2011 23:37:30 -0800 Subject: [PATCH 227/528] VP8: slightly faster loopfilter sharpness logic --- libavcodec/vp8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index dce090f3e0..b10330af03 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1487,7 +1487,7 @@ static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *m interior_limit = filter_level; if (s->filter.sharpness) { - interior_limit >>= s->filter.sharpness > 4 ? 2 : 1; + interior_limit >>= (s->filter.sharpness + 3) >> 2; interior_limit = FFMIN(interior_limit, 9 - s->filter.sharpness); } interior_limit = FFMAX(interior_limit, 1); From 1338dc082354b87c0e26f7f2ab09df5964b7f993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 4 Feb 2011 12:04:15 +0200 Subject: [PATCH 228/528] libavformat: Use avcodec_copy_context for chained muxers This avoids having the chained AVStream->codec point to the same AVCodecContext owned by the outer AVStream. The downside is that changes to the AVCodecContext made after calling av_write_header cannot be detected automatically within the chained muxer. This avoids having to manually unlink the chained AVStream->codec by setting it to null before freeing the chained muxer via generic freeing functions. Signed-off-by: Ronald S. Bultje --- libavformat/movenchint.c | 9 +++++---- libavformat/rtpenc_chain.c | 8 +++----- libavformat/rtsp.c | 2 ++ libavformat/sapenc.c | 2 ++ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index 2aa0f17d54..6a9df076ce 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -57,10 +57,7 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index) track->rtp_ctx->streams[0]->sample_aspect_ratio = src_st->sample_aspect_ratio; - /* Remove the allocated codec context, link to the original one - * instead, to give the rtp muxer access to codec parameters. */ - av_free(track->rtp_ctx->streams[0]->codec); - track->rtp_ctx->streams[0]->codec = src_st->codec; + avcodec_copy_context(track->rtp_ctx->streams[0]->codec, src_st->codec); if ((ret = url_open_dyn_packet_buf(&track->rtp_ctx->pb, RTP_MAX_PACKET_SIZE)) < 0) @@ -86,6 +83,8 @@ fail: } if (track->rtp_ctx && track->rtp_ctx->streams[0]) { av_metadata_free(&track->rtp_ctx->streams[0]->metadata); + av_free(track->rtp_ctx->streams[0]->codec->extradata); + av_free(track->rtp_ctx->streams[0]->codec); av_free(track->rtp_ctx->streams[0]->info); av_free(track->rtp_ctx->streams[0]); } @@ -491,6 +490,8 @@ void ff_mov_close_hinting(MOVTrack *track) { } av_metadata_free(&rtp_ctx->streams[0]->metadata); av_metadata_free(&rtp_ctx->metadata); + av_free(rtp_ctx->streams[0]->codec->extradata); + av_free(rtp_ctx->streams[0]->codec); av_free(rtp_ctx->streams[0]->info); av_free(rtp_ctx->streams[0]); av_freep(&rtp_ctx); diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index 19ea98f643..09b4ebd7c3 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -50,11 +50,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, /* 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; + avcodec_copy_context(rtpctx->streams[0]->codec, st->codec); if (handle) { url_fdopen(&rtpctx->pb, handle); @@ -70,6 +66,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } + av_free(rtpctx->streams[0]->codec->extradata); + av_free(rtpctx->streams[0]->codec); av_free(rtpctx->streams[0]->info); av_free(rtpctx->streams[0]); av_free(rtpctx); diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 52c686c3e5..d31e8eeae4 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -500,6 +500,8 @@ void ff_rtsp_undo_setup(AVFormatContext *s) } av_metadata_free(&rtpctx->streams[0]->metadata); av_metadata_free(&rtpctx->metadata); + av_free(rtpctx->streams[0]->codec->extradata); + av_free(rtpctx->streams[0]->codec); av_free(rtpctx->streams[0]->info); av_free(rtpctx->streams[0]); av_free(rtpctx); diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 088f7bda01..634f033d50 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -48,6 +48,8 @@ static int sap_write_close(AVFormatContext *s) url_fclose(rtpctx->pb); av_metadata_free(&rtpctx->streams[0]->metadata); av_metadata_free(&rtpctx->metadata); + av_free(rtpctx->streams[0]->codec->extradata); + av_free(rtpctx->streams[0]->codec); av_free(rtpctx->streams[0]->info); av_free(rtpctx->streams[0]); av_free(rtpctx); From f124b087eea442b65d809582527dfb5092a3463c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 4 Feb 2011 12:04:16 +0200 Subject: [PATCH 229/528] libavformat: Add a function for freeing an AVFormatContext This function is useful for freeing data structures allocated by muxers, which currently have to be freed manually by the caller. Signed-off-by: Ronald S. Bultje --- libavformat/avformat.h | 10 ++++++++-- libavformat/utils.c | 11 ++++++++--- libavformat/version.h | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f9f9be5b02..83289e4604 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1072,8 +1072,8 @@ attribute_deprecated AVFormatContext *av_alloc_format_context(void); /** * Allocate an AVFormatContext. - * Can be freed with av_free() but do not forget to free everything you - * explicitly allocated as well! + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. */ AVFormatContext *avformat_alloc_context(void); @@ -1229,6 +1229,12 @@ void av_close_input_stream(AVFormatContext *s); */ void av_close_input_file(AVFormatContext *s); +/** + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + /** * Add a new stream to a media file. * diff --git a/libavformat/utils.c b/libavformat/utils.c index 6a5c0f066d..d12bbc26c6 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2556,12 +2556,17 @@ int av_read_pause(AVFormatContext *s) void av_close_input_stream(AVFormatContext *s) { - int i; - AVStream *st; - flush_packet_queue(s); if (s->iformat->read_close) s->iformat->read_close(s); + avformat_free_context(s); +} + +void avformat_free_context(AVFormatContext *s) +{ + int i; + AVStream *st; + for(i=0;inb_streams;i++) { /* free all data in a stream component */ st = s->streams[i]; diff --git a/libavformat/version.h b/libavformat/version.h index 4b95221b27..27f52e06e1 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 95 +#define LIBAVFORMAT_VERSION_MINOR 96 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From ff1974897778942180c1d4f95b0b7b45a4fbbc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 4 Feb 2011 12:04:17 +0200 Subject: [PATCH 230/528] Add an APIchanges entry for avformat_free_context Signed-off-by: Ronald S. Bultje --- doc/APIchanges | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index af3e2020f0..e182e322ea 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-04 - f124b08 - lavf 52.96.0 - avformat_free_context() + Add avformat_free_context() in avformat.h. + 2011-02-03 - f5b82f4 - lavc 52.109.0 - add CODEC_ID_PRORES Add CODEC_ID_PRORES to avcodec.h. From b22dbb291d41e9fb038884bcebad2394c501cbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 4 Feb 2011 12:04:18 +0200 Subject: [PATCH 231/528] Use avformat_free_context for cleaning up muxers Signed-off-by: Ronald S. Bultje --- ffmpeg.c | 16 +--------------- libavformat/movenchint.c | 20 +++----------------- libavformat/rtpenc_chain.c | 6 +----- libavformat/rtsp.c | 8 +------- libavformat/sapenc.c | 8 +------- 5 files changed, 7 insertions(+), 51 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 6d4c0f6ae5..b0d3320824 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -505,25 +505,11 @@ static int ffmpeg_exit(int ret) /* close files */ for(i=0;ioformat->flags & AVFMT_NOFILE) && s->pb) url_fclose(s->pb); - 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++) { - av_metadata_free(&s->programs[j]->metadata); - } - for(j=0;jnb_chapters;j++) { - av_metadata_free(&s->chapters[j]->metadata); - } - av_metadata_free(&s->metadata); - av_free(s); + avformat_free_context(s); av_free(output_streams_for_file[i]); } for(i=0;irtp_ctx->pb, &buf); av_free(buf); } - if (track->rtp_ctx && track->rtp_ctx->streams[0]) { - av_metadata_free(&track->rtp_ctx->streams[0]->metadata); - av_free(track->rtp_ctx->streams[0]->codec->extradata); - av_free(track->rtp_ctx->streams[0]->codec); - av_free(track->rtp_ctx->streams[0]->info); - av_free(track->rtp_ctx->streams[0]); - } if (track->rtp_ctx) { - av_metadata_free(&track->rtp_ctx->metadata); - av_free(track->rtp_ctx->priv_data); - av_freep(&track->rtp_ctx); + avformat_free_context(track->rtp_ctx); + track->rtp_ctx = NULL; } av_freep(&track->enc); /* Set a default timescale, to avoid crashes in dump_format */ @@ -488,12 +480,6 @@ void ff_mov_close_hinting(MOVTrack *track) { url_close_dyn_buf(rtp_ctx->pb, &ptr); av_free(ptr); } - av_metadata_free(&rtp_ctx->streams[0]->metadata); - av_metadata_free(&rtp_ctx->metadata); - av_free(rtp_ctx->streams[0]->codec->extradata); - av_free(rtp_ctx->streams[0]->codec); - av_free(rtp_ctx->streams[0]->info); - av_free(rtp_ctx->streams[0]); - av_freep(&rtp_ctx); + avformat_free_context(rtp_ctx); } diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index 09b4ebd7c3..e1f200ca08 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -66,11 +66,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } - av_free(rtpctx->streams[0]->codec->extradata); - av_free(rtpctx->streams[0]->codec); - av_free(rtpctx->streams[0]->info); - av_free(rtpctx->streams[0]); - av_free(rtpctx); + avformat_free_context(rtpctx); return NULL; } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index d31e8eeae4..d3e88e9a5c 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -498,13 +498,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s) } else { url_fclose(rtpctx->pb); } - av_metadata_free(&rtpctx->streams[0]->metadata); - av_metadata_free(&rtpctx->metadata); - av_free(rtpctx->streams[0]->codec->extradata); - av_free(rtpctx->streams[0]->codec); - av_free(rtpctx->streams[0]->info); - av_free(rtpctx->streams[0]); - av_free(rtpctx); + avformat_free_context(rtpctx); } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ff_rdt_parse_close(rtsp_st->transport_priv); else if (CONFIG_RTPDEC) diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 634f033d50..9bbacef680 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -46,13 +46,7 @@ static int sap_write_close(AVFormatContext *s) 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]->codec->extradata); - av_free(rtpctx->streams[0]->codec); - av_free(rtpctx->streams[0]->info); - av_free(rtpctx->streams[0]); - av_free(rtpctx); + avformat_free_context(rtpctx); s->streams[i]->priv_data = NULL; } From 397ffde115f4e0482a007b672f40457596cebfc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 4 Feb 2011 12:04:19 +0200 Subject: [PATCH 232/528] rtpenc_chain: Don't copy the time_base back to the caller If required, the caller can do this itself. ff_write_chained rescales timestamps as necessary, and all current callers of rtpenc_chain use ff_write_chained, making this timebase copy unnecessary. Signed-off-by: Ronald S. Bultje --- libavformat/rtpenc_chain.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index e1f200ca08..63918adf49 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -70,8 +70,6 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, return NULL; } - /* Copy the RTP AVStream timebase back to the original AVStream */ - st->time_base = rtpctx->streams[0]->time_base; return rtpctx; } From 5306bf41a619cb757ef0e0092ea4f6bc1087e687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 4 Feb 2011 12:04:20 +0200 Subject: [PATCH 233/528] movenchint: Use rtpenc_chain for setting up the chained RTP muxer Signed-off-by: Ronald S. Bultje --- libavformat/Makefile | 3 ++- libavformat/movenchint.c | 35 +++-------------------------------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 8f583e040d..1d4e75e75c 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -128,7 +128,8 @@ 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_MOV_MUXER) += movenc.o riff.o isom.o avc.o \ + movenchint.o rtpenc_chain.o OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index 10913dd904..5b07aa6d4b 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -22,6 +22,7 @@ #include "movenc.h" #include "libavutil/intreadwrite.h" #include "internal.h" +#include "rtpenc_chain.h" int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index) { @@ -30,41 +31,20 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index) MOVTrack *src_track = &mov->tracks[src_index]; AVStream *src_st = s->streams[src_index]; int ret = AVERROR(ENOMEM); - AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); track->tag = MKTAG('r','t','p',' '); track->src_track = src_index; - if (!rtp_format) { - ret = AVERROR(ENOENT); - goto fail; - } - track->enc = avcodec_alloc_context(); if (!track->enc) goto fail; track->enc->codec_type = AVMEDIA_TYPE_DATA; track->enc->codec_tag = track->tag; - track->rtp_ctx = avformat_alloc_context(); + track->rtp_ctx = ff_rtp_chain_mux_open(s, src_st, NULL, + RTP_MAX_PACKET_SIZE); if (!track->rtp_ctx) goto fail; - track->rtp_ctx->oformat = rtp_format; - if (!av_new_stream(track->rtp_ctx, 0)) - goto fail; - - /* Copy stream parameters */ - track->rtp_ctx->streams[0]->sample_aspect_ratio = - src_st->sample_aspect_ratio; - - avcodec_copy_context(track->rtp_ctx->streams[0]->codec, src_st->codec); - - if ((ret = url_open_dyn_packet_buf(&track->rtp_ctx->pb, - RTP_MAX_PACKET_SIZE)) < 0) - goto fail; - ret = av_write_header(track->rtp_ctx); - if (ret) - goto fail; /* Copy the RTP AVStream timebase back to the hint AVStream */ track->timescale = track->rtp_ctx->streams[0]->time_base.den; @@ -76,15 +56,6 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index) fail: av_log(s, AV_LOG_WARNING, "Unable to initialize hinting of stream %d\n", src_index); - if (track->rtp_ctx && track->rtp_ctx->pb) { - uint8_t *buf; - url_close_dyn_buf(track->rtp_ctx->pb, &buf); - av_free(buf); - } - if (track->rtp_ctx) { - avformat_free_context(track->rtp_ctx); - track->rtp_ctx = NULL; - } av_freep(&track->enc); /* Set a default timescale, to avoid crashes in dump_format */ track->timescale = 90000; From 185a155e5701cfaa0281bf91a5a140d498aa0a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 4 Feb 2011 11:09:48 +0200 Subject: [PATCH 234/528] applehttp: Handle absolute paths relative to the current server This fixes roundup issue 2583. Signed-off-by: Ronald S. Bultje --- libavformat/applehttp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 50466faf82..37a040cf34 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -90,6 +90,20 @@ static void make_absolute_url(char *buf, int size, const char *base, const char *rel) { char *sep; + /* Absolute path, relative to the current server */ + if (base && strstr(base, "://") && rel[0] == '/') { + if (base != buf) + av_strlcpy(buf, base, size); + sep = strstr(buf, "://"); + if (sep) { + sep += 3; + sep = strchr(sep, '/'); + if (sep) + *sep = '\0'; + } + av_strlcat(buf, rel, size); + return; + } /* If rel actually is an absolute url, just copy it */ if (!base || strstr(rel, "://") || rel[0] == '/') { av_strlcpy(buf, rel, size); From 6b474953975fd8ea64d1ed4d09c42b2d8e787c6f Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Sat, 5 Feb 2011 00:28:24 -0500 Subject: [PATCH 235/528] Adopt pkt_dts/pkt_pts in lavc clients No behavior change; this makes DTS reliable with the next patch. Signed-off-by: Ronald S. Bultje --- ffmpeg.c | 5 +++-- ffplay.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index b0d3320824..371ccd291e 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1539,7 +1539,8 @@ static int output_packet(AVInputStream *ist, int ist_index, 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; + avpkt.pts = pkt_pts; + avpkt.dts = ist->pts; pkt_pts = AV_NOPTS_VALUE; ret = avcodec_decode_video2(ist->st->codec, @@ -1551,7 +1552,7 @@ static int output_packet(AVInputStream *ist, int ist_index, /* no picture yet */ goto discard_packet; } - ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.reordered_opaque, ist->pts); + ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.pkt_pts, picture.pkt_dts); 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 * diff --git a/ffplay.c b/ffplay.c index 21c7205b24..dbb6268df1 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1576,11 +1576,11 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke if (got_picture) { if (decoder_reorder_pts == -1) { - *pts = guess_correct_pts(&is->pts_ctx, frame->pkt_pts, pkt->dts); + *pts = guess_correct_pts(&is->pts_ctx, frame->pkt_pts, frame->pkt_dts); } else if (decoder_reorder_pts) { *pts = frame->pkt_pts; } else { - *pts = pkt->dts; + *pts = frame->pkt_dts; } if (*pts == AV_NOPTS_VALUE) { From 3a6a9cdf5b8e4c4514e483484ef1f57b07ee16f2 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 4 Feb 2011 17:58:03 -0800 Subject: [PATCH 236/528] cmdutils: fix opt_values leak Add free to uninit_opts and relocate opt_names to same Signed-off-by: Ronald S. Bultje --- cmdutils.c | 2 ++ ffmpeg.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmdutils.c b/cmdutils.c index 58fe85cfda..99e4c38af1 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -78,6 +78,8 @@ void uninit_opts(void) #if CONFIG_SWSCALE av_freep(&sws_opts); #endif + av_freep(&opt_names); + av_freep(&opt_values); } void log_callback_help(void* ptr, int level, const char* fmt, va_list vl) diff --git a/ffmpeg.c b/ffmpeg.c index 371ccd291e..f78e658809 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -524,7 +524,6 @@ static int ffmpeg_exit(int ret) fclose(vstats_file); av_free(vstats_filename); - av_free(opt_names); av_free(streamid_map); av_free(input_codecs); av_free(output_codecs); From 60ff9de6ffa740e0df8c2a019c72e2d332b9788d Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 4 Feb 2011 18:29:46 -0800 Subject: [PATCH 237/528] cmdutils: fix codec-specific options from preset Using a preset file caused the address of a stack variable to be stored in opt_names/values. This change causes the strings to be dup'd then freed in uninit_opts. Signed-off-by: Ronald S. Bultje --- cmdutils.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index 99e4c38af1..c68f37fe20 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -78,6 +78,14 @@ void uninit_opts(void) #if CONFIG_SWSCALE av_freep(&sws_opts); #endif + for (i = 0; i < opt_name_count; i++) { + //opt_values are only stored for codec-specific options in which case + //both the name and value are dup'd + if (opt_values[i]) { + av_freep(&opt_names[i]); + av_freep(&opt_values[i]); + } + } av_freep(&opt_names); av_freep(&opt_values); } @@ -270,9 +278,9 @@ int opt_default(const char *opt, const char *arg){ //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_values[opt_name_count]= o ? NULL : av_strdup(arg); opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1)); - opt_names[opt_name_count++]= o ? o->name : opt; + opt_names[opt_name_count++]= o ? o->name : av_strdup(opt); if ((*avcodec_opts && avcodec_opts[0]->debug) || (avformat_opts && avformat_opts->debug)) av_log_set_level(AV_LOG_DEBUG); From e8dcd730583a0aa69c33a17fc27d65fa55f5effe Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Sat, 5 Feb 2011 00:28:27 -0500 Subject: [PATCH 238/528] vp3: Factor out expression Signed-off-by: Ronald S. Bultje --- libavcodec/vp3.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 06f55f6d47..292a4efd16 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1345,7 +1345,7 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y) */ 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; @@ -1390,8 +1390,9 @@ static void render_slice(Vp3DecodeContext *s, int slice) 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) @@ -1415,8 +1416,8 @@ static void render_slice(Vp3DecodeContext *s, int slice) 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; From edbb0c07081e78a4c7b6d999d641183bf30f1a2e Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Sat, 5 Feb 2011 00:28:28 -0500 Subject: [PATCH 239/528] vp3: Move table allocation code into a new function Signed-off-by: Ronald S. Bultje --- libavcodec/vp3.c | 56 ++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 292a4efd16..dbfacdc6f5 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1511,6 +1511,38 @@ static void render_slice(Vp3DecodeContext *s, int slice) vp3_draw_horiz_band(s, FFMIN((32 << s->chroma_y_shift) * (slice + 1) -16, s->height-16)); } +/// Allocate tables for per-frame data in Vp3DecodeContext +static av_cold int allocate_tables(AVCodecContext *avctx) +{ + Vp3DecodeContext *s = avctx->priv_data; + int y_fragment_count, c_fragment_count; + + y_fragment_count = s->fragment_width[0] * s->fragment_height[0]; + c_fragment_count = s->fragment_width[1] * s->fragment_height[1]; + + s->superblock_coding = av_malloc(s->superblock_count); + s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment)); + s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int)); + s->dct_tokens_base = av_malloc(64*s->fragment_count * sizeof(*s->dct_tokens_base)); + s->motion_val[0] = av_malloc(y_fragment_count * sizeof(*s->motion_val[0])); + s->motion_val[1] = av_malloc(c_fragment_count * sizeof(*s->motion_val[1])); + + /* work out the block mapping tables */ + s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int)); + s->macroblock_coding = av_malloc(s->macroblock_count + 1); + + if (!s->superblock_coding || !s->all_fragments || !s->dct_tokens_base || + !s->coded_fragment_list[0] || !s->superblock_fragments || !s->macroblock_coding || + !s->motion_val[0] || !s->motion_val[1]) { + vp3_decode_end(avctx); + return -1; + } + + init_block_mapping(s); + + return 0; +} + /* * This is the ffmpeg/libavcodec API init function. */ @@ -1560,7 +1592,6 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) s->superblock_count = s->y_superblock_count + (s->c_superblock_count * 2); s->u_superblock_start = s->y_superblock_count; s->v_superblock_start = s->u_superblock_start + s->c_superblock_count; - s->superblock_coding = av_malloc(s->superblock_count); s->macroblock_width = (s->width + 15) / 16; s->macroblock_height = (s->height + 15) / 16; @@ -1578,18 +1609,6 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) s->fragment_start[1] = y_fragment_count; s->fragment_start[2] = y_fragment_count + c_fragment_count; - s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment)); - s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int)); - s->dct_tokens_base = av_malloc(64*s->fragment_count * sizeof(*s->dct_tokens_base)); - s->motion_val[0] = av_malloc(y_fragment_count * sizeof(*s->motion_val[0])); - s->motion_val[1] = av_malloc(c_fragment_count * sizeof(*s->motion_val[1])); - - if (!s->superblock_coding || !s->all_fragments || !s->dct_tokens_base || - !s->coded_fragment_list[0] || !s->motion_val[0] || !s->motion_val[1]) { - vp3_decode_end(avctx); - return -1; - } - if (!s->theora_tables) { for (i = 0; i < 64; i++) { @@ -1689,22 +1708,13 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) &motion_vector_vlc_table[0][1], 2, 1, &motion_vector_vlc_table[0][0], 2, 1, 0); - /* work out the block mapping tables */ - s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int)); - s->macroblock_coding = av_malloc(s->macroblock_count + 1); - if (!s->superblock_fragments || !s->macroblock_coding) { - vp3_decode_end(avctx); - return -1; - } - init_block_mapping(s); - for (i = 0; i < 3; i++) { s->current_frame.data[i] = NULL; s->last_frame.data[i] = NULL; s->golden_frame.data[i] = NULL; } - return 0; + return allocate_tables(avctx); vlc_fail: av_log(avctx, AV_LOG_FATAL, "Invalid huffman table\n"); From e4f85b849913794395bb03dfc09546cd41b10882 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sat, 5 Feb 2011 12:10:10 +1100 Subject: [PATCH 240/528] wtv: do not use flag in stream_guid chunk to determine if stream is valid, as this method is unreliable This fixes roundup issue 2556. Signed-off-by: Ronald S. Bultje --- libavformat/wtv.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavformat/wtv.c b/libavformat/wtv.c index e0881d3bf5..c10d9ec3e7 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -783,18 +783,14 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (ff_find_stream_index(s, sid) < 0) { ff_asf_guid mediatype, subtype, formattype; int size; - consumed += 20; - url_fskip(pb, 16); - if (get_le32(pb)) { - url_fskip(pb, 8); + url_fskip(pb, 28); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); url_fskip(pb, 12); ff_get_guid(pb, &formattype); size = get_le32(pb); parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); - consumed += 72 + size; - } + consumed += 92 + size; } } else if (!ff_guidcmp(g, stream2_guid)) { int stream_index = ff_find_stream_index(s, sid); From 74571e333cc9abf3fe3fde3735698def1547db71 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sat, 5 Feb 2011 12:10:32 +1100 Subject: [PATCH 241/528] reindent after last commit Signed-off-by: Ronald S. Bultje --- libavformat/wtv.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavformat/wtv.c b/libavformat/wtv.c index c10d9ec3e7..0385e73f9e 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -783,14 +783,14 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (ff_find_stream_index(s, sid) < 0) { ff_asf_guid mediatype, subtype, formattype; int size; - url_fskip(pb, 28); - ff_get_guid(pb, &mediatype); - ff_get_guid(pb, &subtype); - url_fskip(pb, 12); - ff_get_guid(pb, &formattype); - size = get_le32(pb); - parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); - consumed += 92 + size; + url_fskip(pb, 28); + ff_get_guid(pb, &mediatype); + ff_get_guid(pb, &subtype); + url_fskip(pb, 12); + ff_get_guid(pb, &formattype); + size = get_le32(pb); + parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); + consumed += 92 + size; } } else if (!ff_guidcmp(g, stream2_guid)) { int stream_index = ff_find_stream_index(s, sid); From 5a6de4e7e8d81169be9b6909b71e42a9ece59a82 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 5 Feb 2011 22:20:13 +0100 Subject: [PATCH 242/528] mp3enc: write ISO8859-1 instead of UTF-16 when possible Signed-off-by: Ronald S. Bultje --- libavformat/mp3enc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index b2c0a7e6f8..5921dedad0 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -77,6 +77,12 @@ static void id3v2_put_size(AVFormatContext *s, int size) put_byte(s->pb, size & 0x7f); } +static int string_is_ascii(const uint8_t *str) +{ + while (*str && *str < 128) str++; + return !*str; +} + /** * Write a text frame with one (normal frames) or two (TXXX frames) strings * according to encoding (only UTF-8 or UTF-16+BOM supported). @@ -92,6 +98,12 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 if (url_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); + /* check if the strings are ASCII-only and use UTF16 only if + * they're not */ + if (enc == ID3v2_ENCODING_UTF16BOM && string_is_ascii(str1) && + (!str2 || string_is_ascii(str2))) + enc = ID3v2_ENCODING_ISO8859; + put_byte(dyn_buf, enc); if (enc == ID3v2_ENCODING_UTF16BOM) { put_le16(dyn_buf, 0xFEFF); /* BOM */ From f4a86bc981d6743778dd1037fea243d36229ede1 Mon Sep 17 00:00:00 2001 From: Kieran Kunhya Date: Sat, 5 Feb 2011 17:59:48 +0000 Subject: [PATCH 243/528] Set channel_layout for mpegaudio Signed-off-by: Ronald S. Bultje --- libavcodec/mpegaudiodec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 7b296c4507..aa31e46aca 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -2054,6 +2054,7 @@ static int decode_frame(AVCodecContext * avctx, } /* update codec info */ avctx->channels = s->nb_channels; + avctx->channel_layout = s->nb_channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; if (!avctx->bit_rate) avctx->bit_rate = s->bit_rate; avctx->sub_id = s->layer; From fe174fc8fc4bbdb050014a945de7eb9b28ba358e Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Fri, 4 Feb 2011 19:12:36 +0100 Subject: [PATCH 244/528] Non-blocking protocols: flag and documentation Signed-off-by: Nicolas George Signed-off-by: Ronald S. Bultje --- doc/APIchanges | 3 +++ libavformat/avio.h | 29 ++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index e182e322ea..9216d632d9 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-XX - XXXXXXX - lavf 52.XX.0 - avio.h + Add flag for non-blocking protocols: URL_FLAG_NONBLOCK + 2011-02-04 - f124b08 - lavf 52.96.0 - avformat_free_context() Add avformat_free_context() in avformat.h. diff --git a/libavformat/avio.h b/libavformat/avio.h index a606f7cb97..d05cab1810 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -63,9 +63,32 @@ typedef struct URLPollEntry { int revents; } URLPollEntry; -#define URL_RDONLY 0 -#define URL_WRONLY 1 -#define URL_RDWR 2 +/** + * @defgroup open_modes URL open modes + * The flags argument to url_open and cosins must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define URL_RDONLY 0 /**< read-only */ +#define URL_WRONLY 1 /**< write-only */ +#define URL_RDWR 2 /**< read-write */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define URL_FLAG_NONBLOCK 4 typedef int URLInterruptCB(void); From 90441276e4f661c6aec5e4d2c5718cde1ff1946d Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Fri, 4 Feb 2011 19:12:37 +0100 Subject: [PATCH 245/528] Non-blocking protocol: core wrapper functions Signed-off-by: Nicolas George Signed-off-by: Ronald S. Bultje --- libavformat/avio.c | 32 +++++++++++++++++++------------- libavformat/avio.h | 1 - 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index 9a4d7355c5..a19ec37cb1 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -206,24 +206,21 @@ int url_open(URLContext **puc, const char *filename, int flags) return ret; } -int url_read(URLContext *h, unsigned char *buf, int size) -{ - int ret; - if (h->flags & URL_WRONLY) - return AVERROR(EIO); - ret = h->prot->url_read(h, buf, size); - return ret; -} - -static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, +static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, int size_min, int (*transfer_func)(URLContext *h, unsigned char *buf, int size)) { int ret, len; int fast_retries = 5; len = 0; - while (len < size) { + while (len < size_min) { + if (url_interrupt_cb()) + return AVERROR(EINTR); ret = transfer_func(h, buf+len, size-len); + if (ret == AVERROR(EINTR)) + continue; + if (h->flags & URL_FLAG_NONBLOCK) + return ret; if (ret == AVERROR(EAGAIN)) { ret = 0; if (fast_retries) @@ -239,9 +236,18 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int return len; } +int url_read(URLContext *h, unsigned char *buf, int size) +{ + if (h->flags & URL_WRONLY) + return AVERROR(EIO); + return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read); +} + int url_read_complete(URLContext *h, unsigned char *buf, int size) { - return retry_transfer_wrapper(h, buf, size, url_read); + if (h->flags & URL_WRONLY) + return AVERROR(EIO); + return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); } int url_write(URLContext *h, const unsigned char *buf, int size) @@ -252,7 +258,7 @@ int url_write(URLContext *h, const unsigned char *buf, int size) if (h->max_packet_size && size > h->max_packet_size) return AVERROR(EIO); - return retry_transfer_wrapper(h, buf, size, h->prot->url_write); + return retry_transfer_wrapper(h, buf, size, size, h->prot->url_write); } int64_t url_seek(URLContext *h, int64_t pos, int whence) diff --git a/libavformat/avio.h b/libavformat/avio.h index d05cab1810..c899c0df0e 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -151,7 +151,6 @@ int url_read(URLContext *h, unsigned char *buf, int size); /** * Read as many bytes as possible (up to size), calling the * read function multiple times if necessary. - * Will also retry if the read function returns AVERROR(EAGAIN). * This makes special short-read handling in applications * unnecessary, if the return value is < size then it is * certain there was either an error or the end of file was reached. From ad3cffb68f9c77e140660a8ae7d43c8606208178 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Fri, 4 Feb 2011 19:12:38 +0100 Subject: [PATCH 246/528] Non-blocking protocol: TCP Signed-off-by: Nicolas George Signed-off-by: Ronald S. Bultje --- libavformat/tcp.c | 47 +++++++++++------------------------------------ 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 564d69f19d..29eb60abe9 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -136,60 +136,35 @@ static int tcp_wait_fd(int fd, int write) int ret; ret = poll(&p, 1, 100); - return ret < 0 ? ff_neterrno() : !!(p.revents & ev); + return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : FF_NETERROR(EAGAIN); } static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h->priv_data; - int len, ret; + int ret; - for (;;) { - if (url_interrupt_cb()) - return AVERROR(EINTR); + if (!(h->flags & URL_FLAG_NONBLOCK)) { ret = tcp_wait_fd(s->fd, 0); - if (ret > 0) { - len = recv(s->fd, buf, size, 0); - if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EINTR) && - ff_neterrno() != FF_NETERROR(EAGAIN)) - return ff_neterrno(); - } else return len; - } else if (ret < 0) { - if (ret == FF_NETERROR(EINTR)) - continue; + if (ret < 0) return ret; - } } + ret = recv(s->fd, buf, size, 0); + return ret < 0 ? ff_neterrno() : ret; } static int tcp_write(URLContext *h, const uint8_t *buf, int size) { TCPContext *s = h->priv_data; - int ret, size1, len; + int ret; - size1 = size; - while (size > 0) { - if (url_interrupt_cb()) - return AVERROR(EINTR); + if (!(h->flags & URL_FLAG_NONBLOCK)) { ret = tcp_wait_fd(s->fd, 1); - if (ret > 0) { - len = send(s->fd, buf, size, 0); - if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EINTR) && - ff_neterrno() != FF_NETERROR(EAGAIN)) - return ff_neterrno(); - continue; - } - size -= len; - buf += len; - } else if (ret < 0) { - if (ret == FF_NETERROR(EINTR)) - continue; + if (ret < 0) return ret; - } } - return size1 - size; + ret = send(s->fd, buf, size, 0); + return ret < 0 ? ff_neterrno() : ret; } static int tcp_close(URLContext *h) From c2fcd0a7a4d0bda1a3306e40b70ce281a987df60 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 14:26:09 +0100 Subject: [PATCH 247/528] Replace remaining occurrences of deprecated CH_* with AV_CH_* Signed-off-by: Ronald S. Bultje --- libavcodec/ac3_parser.c | 3 ++- libavcodec/apedec.c | 3 ++- libavcodec/audioconvert.h | 1 + libavcodec/cook.c | 3 ++- libavcodec/dca.c | 4 ++-- libavcodec/imc.c | 3 ++- libavcodec/mpc7.c | 3 ++- libavcodec/mpc8.c | 3 ++- libavcodec/smacker.c | 3 ++- libavcodec/vorbis_data.c | 17 +++++++++-------- libavcodec/wavpack.c | 3 ++- libavformat/aea.c | 3 ++- libavformat/flic.c | 3 ++- libavformat/wv.c | 3 ++- 14 files changed, 34 insertions(+), 21 deletions(-) diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index 4737d6f868..bab354d6b9 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -24,6 +24,7 @@ #include "ac3_parser.h" #include "aac_ac3_parser.h" #include "get_bits.h" +#include "libavcore/audioconvert.h" #define AC3_HEADER_SIZE 7 @@ -123,7 +124,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) } hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode]; if (hdr->lfe_on) - hdr->channel_layout |= CH_LOW_FREQUENCY; + hdr->channel_layout |= AV_CH_LOW_FREQUENCY; return 0; } diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index b6d6f9d9cc..e673b88bee 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -25,6 +25,7 @@ #include "dsputil.h" #include "get_bits.h" #include "bytestream.h" +#include "libavcore/audioconvert.h" /** * @file @@ -199,7 +200,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx) dsputil_init(&s->dsp, avctx); avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; return 0; } diff --git a/libavcodec/audioconvert.h b/libavcodec/audioconvert.h index be4867c22e..ae6016a611 100644 --- a/libavcodec/audioconvert.h +++ b/libavcodec/audioconvert.h @@ -31,6 +31,7 @@ #include "libavutil/cpu.h" #include "avcodec.h" +#include "libavcore/audioconvert.h" #if FF_API_OLD_SAMPLE_FMT /** diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 6b70560546..9d3d001297 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -53,6 +53,7 @@ #include "dsputil.h" #include "bytestream.h" #include "fft.h" +#include "libavcore/audioconvert.h" #include "cookdata.h" @@ -1274,7 +1275,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) if (channel_mask) avctx->channel_layout = channel_mask; else - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; #ifdef COOKDEBUG dump_cook_context(q); diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 63ea32992e..67195b1917 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -106,7 +106,7 @@ enum DCAExtensionMask { * L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead. * S -> side, when both rear and back are configured move one of them to the side channel * OV -> center back - * All 2 channel configurations -> CH_LAYOUT_STEREO + * All 2 channel configurations -> AV_CH_LAYOUT_STEREO */ static const int64_t dca_core_channel_layout[] = { @@ -117,7 +117,7 @@ static const int64_t dca_core_channel_layout[] = { AV_CH_LAYOUT_STEREO, ///< 2, LT +RT (left and right total) AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER, ///< 3, C+L+R AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER, ///< 3, L+R+S - AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|CH_BACK_CENTER, ///< 4, C + L + R+ S + AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER, ///< 4, C + L + R+ S AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, ///< 4, L + R +SL+ SR AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, ///< 5, C + L + R+ SL+SR AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 4d7fbd1db6..2b9de0b021 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -40,6 +40,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "libavcore/audioconvert.h" #include "imcdata.h" @@ -157,7 +158,7 @@ static av_cold int imc_decode_init(AVCodecContext * avctx) ff_fft_init(&q->fft, 7, 1); dsputil_init(&q->dsp, avctx); avctx->sample_fmt = AV_SAMPLE_FMT_FLT; - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; return 0; } diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index a77648f770..8bdb9e5813 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -30,6 +30,7 @@ #include "get_bits.h" #include "dsputil.h" #include "mpegaudio.h" +#include "libavcore/audioconvert.h" #include "mpc.h" #include "mpc7data.h" @@ -86,7 +87,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) c->frames_to_skip = 0; avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; if(vlc_initialized) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 327a0c02f4..865ffc1b98 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -30,6 +30,7 @@ #include "get_bits.h" #include "dsputil.h" #include "mpegaudio.h" +#include "libavcore/audioconvert.h" #include "mpc.h" #include "mpcdata.h" @@ -135,7 +136,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) c->frames = 1 << (get_bits(&gb, 3) * 2); avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; if(vlc_initialized) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index fa8b4e3a18..61f1604616 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -32,6 +32,7 @@ #include #include "avcodec.h" +#include "libavcore/audioconvert.h" #define ALT_BITSTREAM_READER_LE #include "get_bits.h" @@ -554,7 +555,7 @@ static av_cold int decode_end(AVCodecContext *avctx) static av_cold int smka_decode_init(AVCodecContext *avctx) { - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? AV_SAMPLE_FMT_U8 : AV_SAMPLE_FMT_S16; return 0; } diff --git a/libavcodec/vorbis_data.c b/libavcodec/vorbis_data.c index 24c9921fd1..783a5daa00 100644 --- a/libavcodec/vorbis_data.c +++ b/libavcodec/vorbis_data.c @@ -20,6 +20,7 @@ #include "dsputil.h" #include "vorbis.h" +#include "libavcore/audioconvert.h" const uint8_t ff_vorbis_channel_layout_offsets[8][8] = { { 0 }, @@ -44,14 +45,14 @@ const uint8_t ff_vorbis_encoding_channel_layout_offsets[8][8] = { }; const int64_t ff_vorbis_channel_layouts[9] = { - CH_LAYOUT_MONO, - CH_LAYOUT_STEREO, - CH_LAYOUT_SURROUND, - CH_LAYOUT_QUAD, - CH_LAYOUT_5POINT0_BACK, - CH_LAYOUT_5POINT1_BACK, - CH_LAYOUT_5POINT1|CH_BACK_CENTER, - CH_LAYOUT_7POINT1, + AV_CH_LAYOUT_MONO, + AV_CH_LAYOUT_STEREO, + AV_CH_LAYOUT_SURROUND, + AV_CH_LAYOUT_QUAD, + AV_CH_LAYOUT_5POINT0_BACK, + AV_CH_LAYOUT_5POINT1_BACK, + AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER, + AV_CH_LAYOUT_7POINT1, 0 }; diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index e96981460b..ffb5018c57 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -22,6 +22,7 @@ #include "avcodec.h" #include "get_bits.h" #include "unary.h" +#include "libavcore/audioconvert.h" /** * @file @@ -706,7 +707,7 @@ static av_cold int wavpack_decode_init(AVCodecContext *avctx) else avctx->sample_fmt = AV_SAMPLE_FMT_S32; if(avctx->channels <= 2 && !avctx->channel_layout) - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; s->multichannel = avctx->channels > 2; /* lavf demuxer does not provide extradata, Matroska stores 0x403 diff --git a/libavformat/aea.c b/libavformat/aea.c index 6816506e4e..8a508ec50a 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -23,6 +23,7 @@ #include "avformat.h" #include "pcm.h" #include "libavutil/intreadwrite.h" +#include "libavcore/audioconvert.h" #define AT1_SU_SIZE 212 @@ -76,7 +77,7 @@ static int aea_read_header(AVFormatContext *s, return -1; } - st->codec->channel_layout = (st->codec->channels == 1) ? CH_LAYOUT_MONO : CH_LAYOUT_STEREO; + st->codec->channel_layout = (st->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; st->codec->block_align = AT1_SU_SIZE * st->codec->channels; return 0; diff --git a/libavformat/flic.c b/libavformat/flic.c index bf93c5c9b6..2e03c3b3a1 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -33,6 +33,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" +#include "libavcore/audioconvert.h" #define FLIC_FILE_MAGIC_1 0xAF11 #define FLIC_FILE_MAGIC_2 0xAF12 @@ -160,7 +161,7 @@ static int flic_read_header(AVFormatContext *s, ast->codec->sample_fmt = AV_SAMPLE_FMT_U8; ast->codec->bit_rate = st->codec->sample_rate * 8; ast->codec->bits_per_coded_sample = 8; - ast->codec->channel_layout = CH_LAYOUT_MONO; + ast->codec->channel_layout = AV_CH_LAYOUT_MONO; ast->codec->extradata_size = 0; /* Since the header information is incorrect we have to figure out the diff --git a/libavformat/wv.c b/libavformat/wv.c index 667ae2e6b6..182f900f36 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -23,6 +23,7 @@ #include "avformat.h" #include "apetag.h" #include "id3v1.h" +#include "libavcore/audioconvert.h" // specs say that maximum block size is 1Mb #define WV_BLOCK_LIMIT 1047576 @@ -111,7 +112,7 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app //parse flags bpp = ((wc->flags & 3) + 1) << 3; chan = 1 + !(wc->flags & WV_MONO); - chmask = wc->flags & WV_MONO ? CH_LAYOUT_MONO : CH_LAYOUT_STEREO; + chmask = wc->flags & WV_MONO ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; rate = wv_rates[(wc->flags >> 23) & 0xF]; wc->multichannel = !!((wc->flags & WV_SINGLE_BLOCK) != WV_SINGLE_BLOCK); if(wc->multichannel){ From efdd67cb00ad770c16c47161c023121e1ae53ae9 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 6 Feb 2011 09:19:34 -0500 Subject: [PATCH 248/528] Update MINOR and set git rev for non-blocking flag API addition. --- doc/APIchanges | 2 +- libavformat/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 9216d632d9..b5f1848f75 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,7 +13,7 @@ libavutil: 2009-03-08 API changes, most recent first: -2011-02-XX - XXXXXXX - lavf 52.XX.0 - avio.h +2011-02-XX - fe174fc - lavf 52.97.0 - avio.h Add flag for non-blocking protocols: URL_FLAG_NONBLOCK 2011-02-04 - f124b08 - lavf 52.96.0 - avformat_free_context() diff --git a/libavformat/version.h b/libavformat/version.h index 27f52e06e1..603d7cfa3a 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 96 +#define LIBAVFORMAT_VERSION_MINOR 97 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From ae0f8a1a33158397c5014745424389ba1f543cfd Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 6 Feb 2011 09:46:32 -0500 Subject: [PATCH 249/528] Fill in missing date. --- doc/APIchanges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index b5f1848f75..ecc48742ac 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,7 +13,7 @@ libavutil: 2009-03-08 API changes, most recent first: -2011-02-XX - fe174fc - lavf 52.97.0 - avio.h +2011-02-06 - fe174fc - lavf 52.97.0 - avio.h Add flag for non-blocking protocols: URL_FLAG_NONBLOCK 2011-02-04 - f124b08 - lavf 52.96.0 - avformat_free_context() From 84ae8936f642042fe7ad3466ce3a26dec77016f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 25 Jan 2011 00:36:19 +0100 Subject: [PATCH 250/528] Make inter_rvlc and intra_rvlc static tables. Signed-off-by: Ronald S. Bultje --- libavcodec/mpeg4data.h | 4 ++-- libavcodec/mpeg4video.h | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libavcodec/mpeg4data.h b/libavcodec/mpeg4data.h index bef5f8804b..1f4e578ca1 100644 --- a/libavcodec/mpeg4data.h +++ b/libavcodec/mpeg4data.h @@ -115,7 +115,7 @@ RLTable ff_mpeg4_rl_intra = { }; /* Note this is identical to the intra rvlc except that it is reordered. */ -const uint16_t inter_rvlc[170][2]={ +static const uint16_t inter_rvlc[170][2]={ {0x0006, 3},{0x0001, 4},{0x0004, 5},{0x001C, 7}, {0x003C, 8},{0x003D, 8},{0x007C, 9},{0x00FC, 10}, {0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12}, @@ -219,7 +219,7 @@ RLTable rvlc_rl_inter = { inter_rvlc_level, }; -const uint16_t intra_rvlc[170][2]={ +static const uint16_t intra_rvlc[170][2]={ {0x0006, 3},{0x0007, 3},{0x000A, 4},{0x0009, 5}, {0x0014, 6},{0x0015, 6},{0x0034, 7},{0x0074, 8}, {0x0075, 8},{0x00DD, 9},{0x00EC, 9},{0x01EC, 10}, diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h index aab32364e5..96db36683e 100644 --- a/libavcodec/mpeg4video.h +++ b/libavcodec/mpeg4video.h @@ -66,10 +66,7 @@ extern const uint16_t ff_mpeg4_intra_vlc[103][2]; extern RLTable ff_mpeg4_rl_intra; /* Note this is identical to the intra rvlc except that it is reordered. */ -extern const uint16_t inter_rvlc[170][2]; extern RLTable rvlc_rl_inter; - -extern const uint16_t intra_rvlc[170][2]; extern RLTable rvlc_rl_intra; extern const uint16_t sprite_trajectory_tab[15][2]; From 48545a8f724247853c5b1d4e0a24e3ea3ee06515 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sun, 6 Feb 2011 07:58:02 +0200 Subject: [PATCH 251/528] configure: check yasm/nasm for working pextrd opcode NASM versions older than 2.08 fail to build ffmpeg with several "error: operation size not specified" errors but this is not caught in configure. Fix that by checking if "pextrd [eax], xmm0, 1" works in configure. Signed-off-by: Ronald S. Bultje --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 46f4e4415f..d67029569e 100755 --- a/configure +++ b/configure @@ -2671,7 +2671,7 @@ EOF elf*) enabled debug && append YASMFLAGS $yasm_debug ;; esac - check_yasm "pabsw xmm0, xmm0" && enable yasm || + check_yasm "pextrd [eax], xmm0, 1" && enable yasm || die "yasm not found, use --disable-yasm for a crippled build" fi From ed19fafd486d6ab0d6e1eba80ceaa482a740c556 Mon Sep 17 00:00:00 2001 From: Sascha Sommer Date: Sun, 6 Feb 2011 13:54:03 +0100 Subject: [PATCH 252/528] pass QDMC extradata to the decoder Makes playing QDMC files in MPlayer work when using the libavformat demuxer. Problem was that the extradata was not passed from demuxer to decoder. Signed-off-by: Ronald S. Bultje --- libavcodec/avcodec.h | 1 + libavformat/isom.c | 1 + libavformat/mov.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index dbfb77795d..fc29bbadb6 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -389,6 +389,7 @@ enum CodecID { CODEC_ID_BINKAUDIO_RDFT, CODEC_ID_BINKAUDIO_DCT, CODEC_ID_AAC_LATM, + CODEC_ID_QDMC, /* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= 0x17000, diff --git a/libavformat/isom.c b/libavformat/isom.c index 89b352c75d..88d68258b8 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -249,6 +249,7 @@ const AVCodecTag codec_movaudio_tags[] = { { CODEC_ID_QCELP, MKTAG('Q','c','l','q') }, { CODEC_ID_QCELP, MKTAG('s','q','c','p') }, /* ISO Media fourcc */ + { CODEC_ID_QDMC, MKTAG('Q', 'D', 'M', 'C') }, /* QDMC */ { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2') }, /* QDM2 */ { CODEC_ID_DVAUDIO, MKTAG('v', 'd', 'v', 'a') }, diff --git a/libavformat/mov.c b/libavformat/mov.c index a48000fe52..310a399d83 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -769,8 +769,8 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom) if((uint64_t)atom.size > (1<<30)) return -1; - if (st->codec->codec_id == CODEC_ID_QDM2) { - // pass all frma atom to codec, needed at least for QDM2 + if (st->codec->codec_id == CODEC_ID_QDM2 || st->codec->codec_id == CODEC_ID_QDMC) { + // pass all frma atom to codec, needed at least for QDMC and QDM2 av_free(st->codec->extradata); st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) From a351110eea8f8684642dfe7328e14c3755915091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sat, 5 Feb 2011 10:08:29 +0100 Subject: [PATCH 253/528] Always use av_set_pts_info to set the stream time base. Signed-off-by: Ronald S. Bultje --- libavformat/c93.c | 2 +- libavformat/oggparsedirac.c | 5 ++--- libavformat/oggparseflac.c | 3 +-- libavformat/oggparseogm.c | 5 ++--- libavformat/oggparseskeleton.c | 5 +++-- libavformat/oggparsespeex.c | 3 +-- libavformat/oggparsetheora.c | 2 +- libavformat/oggparsevorbis.c | 3 +-- 8 files changed, 12 insertions(+), 16 deletions(-) diff --git a/libavformat/c93.c b/libavformat/c93.c index dbb2bf389e..0c6e4e5f51 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -89,7 +89,7 @@ static int read_header(AVFormatContext *s, video->codec->height = 192; /* 4:3 320x200 with 8 empty lines */ video->sample_aspect_ratio = (AVRational) { 5, 6 }; - video->time_base = (AVRational) { 2, 25 }; + av_set_pts_info(video, 64, 2, 25); video->nb_frames = framecount; video->duration = framecount; video->start_time = 0; diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c index a7f0401f29..b8ce4fe291 100644 --- a/libavformat/oggparsedirac.c +++ b/libavformat/oggparsedirac.c @@ -42,7 +42,7 @@ static int dirac_header(AVFormatContext *s, int idx) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_DIRAC; // dirac in ogg always stores timestamps as though the video were interlaced - st->time_base = (AVRational){st->codec->time_base.num, 2*st->codec->time_base.den}; + av_set_pts_info(st, 64, st->codec->time_base.num, 2*st->codec->time_base.den); return 1; } @@ -79,8 +79,7 @@ static int old_dirac_header(AVFormatContext *s, int idx) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_DIRAC; - st->time_base.den = AV_RB32(buf+8); - st->time_base.num = AV_RB32(buf+12); + av_set_pts_info(st, 64, AV_RB32(buf+12), AV_RB32(buf+8)); return 1; } diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c index e5034af3a0..a51a85545c 100644 --- a/libavformat/oggparseflac.c +++ b/libavformat/oggparseflac.c @@ -65,8 +65,7 @@ flac_header (AVFormatContext * s, int idx) memcpy(st->codec->extradata, streaminfo_start, FLAC_STREAMINFO_SIZE); st->codec->extradata_size = FLAC_STREAMINFO_SIZE; - st->time_base.num = 1; - st->time_base.den = st->codec->sample_rate; + av_set_pts_info(st, 64, 1, st->codec->sample_rate); } else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT) { ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 4, os->psize - 4); } diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c index e1d046f28f..dda5be601a 100644 --- a/libavformat/oggparseogm.c +++ b/libavformat/oggparseogm.c @@ -83,14 +83,13 @@ ogm_header(AVFormatContext *s, int idx) st->codec->height = bytestream_get_le32(&p); st->codec->time_base.den = spu * 10000000; st->codec->time_base.num = time_unit; - st->time_base = st->codec->time_base; + av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den); } else { st->codec->channels = bytestream_get_le16(&p); p += 2; /* block_align */ st->codec->bit_rate = bytestream_get_le32(&p) * 8; st->codec->sample_rate = spu * 10000000 / time_unit; - st->time_base.num = 1; - st->time_base.den = st->codec->sample_rate; + av_set_pts_info(st, 64, 1, st->codec->sample_rate); } } else if (*p == 3) { if (os->psize > 8) diff --git a/libavformat/oggparseskeleton.c b/libavformat/oggparseskeleton.c index ad0dded0d7..f0e17f9cf5 100644 --- a/libavformat/oggparseskeleton.c +++ b/libavformat/oggparseskeleton.c @@ -60,8 +60,9 @@ static int skeleton_header(AVFormatContext *s, int idx) start_den = AV_RL64(buf+20); if (start_den) { - av_reduce(&start_time, &st->time_base.den, start_num, start_den, INT_MAX); - st->time_base.num = 1; + int64_t base_den; + av_reduce(&start_time, &base_den, start_num, start_den, INT_MAX); + av_set_pts_info(st, 64, 1, base_den); os->lastpts = st->start_time = start_time; } diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c index 936b37e952..80b2001ddf 100644 --- a/libavformat/oggparsespeex.c +++ b/libavformat/oggparsespeex.c @@ -72,8 +72,7 @@ static int speex_header(AVFormatContext *s, int idx) { + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(st->codec->extradata, p, st->codec->extradata_size); - st->time_base.num = 1; - st->time_base.den = st->codec->sample_rate; + av_set_pts_info(st, 64, 1, st->codec->sample_rate); } else ff_vorbis_comment(s, &st->metadata, p, os->psize); diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index 2299f5507c..d02781f2fa 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -91,7 +91,7 @@ theora_header (AVFormatContext * s, int idx) st->codec->time_base.num = 1; st->codec->time_base.den = 25; } - st->time_base = st->codec->time_base; + av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den); st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index 34ae2fc4f0..b915fffb03 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -252,8 +252,7 @@ vorbis_header (AVFormatContext * s, int idx) if (srate > 0) { st->codec->sample_rate = srate; - st->time_base.num = 1; - st->time_base.den = srate; + av_set_pts_info(st, 64, 1, srate); } } else if (os->buf[os->pstart] == 3) { if (os->psize > 8 && From b3190529dfefe3226302b23e76e16c631cde6649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 6 Feb 2011 15:27:30 +0100 Subject: [PATCH 254/528] Make av_set_pts_info keep previous time base if new one is invalid. Fixes issue 2475. Signed-off-by: Ronald S. Bultje --- libavformat/avformat.h | 3 ++- libavformat/utils.c | 17 ++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 83289e4604..fd0cdba6dc 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1265,7 +1265,8 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title); /** - * Set the pts for a given stream. + * Set the pts for a given stream. If the new values would be invalid + * (<= 0), it leaves the AVStream unchanged. * * @param s stream * @param pts_wrap_bits number of bits effectively used by the pts diff --git a/libavformat/utils.c b/libavformat/utils.c index d12bbc26c6..4f71f8c0a4 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3762,16 +3762,19 @@ int ff_hex_to_data(uint8_t *data, const char *p) void av_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den) { - s->pts_wrap_bits = pts_wrap_bits; - - if(av_reduce(&s->time_base.num, &s->time_base.den, pts_num, pts_den, INT_MAX)){ - if(s->time_base.num != pts_num) - av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, pts_num/s->time_base.num); + AVRational new_tb; + if(av_reduce(&new_tb.num, &new_tb.den, pts_num, pts_den, INT_MAX)){ + if(new_tb.num != pts_num) + av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, pts_num/new_tb.num); }else av_log(NULL, AV_LOG_WARNING, "st:%d has too large timebase, reducing\n", s->index); - if(!s->time_base.num || !s->time_base.den) - s->time_base.num= s->time_base.den= 0; + if(new_tb.num <= 0 || new_tb.den <= 0) { + av_log(NULL, AV_LOG_ERROR, "Ignoring attempt to set invalid timebase for st:%d\n", s->index); + return; + } + s->time_base = new_tb; + s->pts_wrap_bits = pts_wrap_bits; } int ff_url_join(char *str, int size, const char *proto, From 19711af5cdc364f9e02ea8103dd6e1e09dc288a4 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 6 Feb 2011 15:38:55 +0100 Subject: [PATCH 255/528] lavf: move internal functions from avformat.h to internal.h Signed-off-by: Ronald S. Bultje --- libavformat/avformat.h | 25 ------------------------- libavformat/ffmetadec.c | 1 + libavformat/internal.h | 21 +++++++++++++++++++++ libavformat/mpeg.c | 1 + libavformat/oggparsevorbis.c | 1 + 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index fd0cdba6dc..675c13c38f 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1248,22 +1248,6 @@ void avformat_free_context(AVFormatContext *s); AVStream *av_new_stream(AVFormatContext *s, int id); AVProgram *av_new_program(AVFormatContext *s, int id); -/** - * Add a new chapter. - * This function is NOT part of the public API - * and should ONLY be used by demuxers. - * - * @param s media file handle - * @param id unique ID for this chapter - * @param start chapter start time in time_base units - * @param end chapter end time in time_base units - * @param title chapter title - * - * @return AVChapter or NULL on error - */ -AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, - int64_t start, int64_t end, const char *title); - /** * Set the pts for a given stream. If the new values would be invalid * (<= 0), it leaves the AVStream unchanged. @@ -1294,15 +1278,6 @@ int av_find_default_stream_index(AVFormatContext *s); */ int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); -/** - * Ensure the index uses less memory than the maximum specified in - * AVFormatContext.max_index_size by discarding entries if it grows - * too large. - * This function is not part of the public API and should only be called - * by demuxers. - */ -void ff_reduce_index(AVFormatContext *s, int stream_index); - /** * Add an index entry into a sorted list. Update the entry if the list * already contains it. diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c index ab35746efc..cfeed7353c 100644 --- a/libavformat/ffmetadec.c +++ b/libavformat/ffmetadec.c @@ -21,6 +21,7 @@ #include "avformat.h" #include "ffmeta.h" +#include "internal.h" static int probe(AVProbeData *p) { diff --git a/libavformat/internal.h b/libavformat/internal.h index e53da7d46d..9e3302fa5f 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -240,4 +240,25 @@ int ff_add_index_entry(AVIndexEntry **index_entries, unsigned int *index_entries_allocated_size, int64_t pos, int64_t timestamp, int size, int distance, int flags); +/** + * Add a new chapter. + * + * @param s media file handle + * @param id unique ID for this chapter + * @param start chapter start time in time_base units + * @param end chapter end time in time_base units + * @param title chapter title + * + * @return AVChapter or NULL on error + */ +AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, + int64_t start, int64_t end, const char *title); + +/** + * Ensure the index uses less memory than the maximum specified in + * AVFormatContext.max_index_size by discarding entries if it grows + * too large. + */ +void ff_reduce_index(AVFormatContext *s, int stream_index); + #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 135482b7c8..2df7a154f8 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -20,6 +20,7 @@ */ #include "avformat.h" +#include "internal.h" #include "mpeg.h" //#define DEBUG_SEEK diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index b915fffb03..830f0bca37 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -28,6 +28,7 @@ #include "libavcodec/get_bits.h" #include "libavcodec/bytestream.h" #include "avformat.h" +#include "internal.h" #include "oggdec.h" #include "vorbiscomment.h" From 47fdf00a77e82a0e30422ed08d5b295e9ae8d506 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 6 Feb 2011 10:59:54 +0100 Subject: [PATCH 256/528] avidec: simplify read_gab2_sub Use avio functions instead of bytestream ones (also drops dependency on lavc and removes a bunch of warnings). Drop custom version of avio_get_str16 and use that instead. Tested on mewmew-ssa.avi sample. Signed-off-by: Ronald S. Bultje --- libavformat/avidec.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 27a9d1fbc3..931a17c441 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -25,7 +25,6 @@ #include #include "libavutil/intreadwrite.h" #include "libavutil/bswap.h" -#include "libavcodec/bytestream.h" #include "avformat.h" #include "avi.h" #include "dv.h" @@ -748,39 +747,32 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) static int read_gab2_sub(AVStream *st, AVPacket *pkt) { if (!strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data+5) == 2) { - uint8_t desc[256], *d = desc; - uint8_t *end, *ptr = pkt->data+7; - unsigned int size, desc_len = bytestream_get_le32(&ptr); - int score = AVPROBE_SCORE_MAX / 2; + uint8_t desc[256]; + int score = AVPROBE_SCORE_MAX / 2, ret; AVIStream *ast = st->priv_data; AVInputFormat *sub_demuxer; AVRational time_base; - ByteIOContext *pb; + ByteIOContext *pb = av_alloc_put_byte(pkt->data + 7, + pkt->size - 7, + 0, NULL, NULL, NULL, NULL); AVProbeData pd; + unsigned int desc_len = get_le32(pb); - if (desc_len > FFMAX(pkt->size-17, 0)) - return 0; + if (desc_len > pb->buf_end - pb->buf_ptr) + goto error; - end = ptr + desc_len; - while (ptr < end-1) { - uint8_t tmp; - uint32_t ch; - GET_UTF16(ch, ptr < end-1 ? bytestream_get_le16(&ptr) : 0, break;); - PUT_UTF8(ch, tmp, if(d-desc < sizeof(desc)-1) *d++ = tmp;); - } - *d = 0; + ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc)); + url_fskip(pb, desc_len - ret); if (*desc) av_metadata_set2(&st->metadata, "title", desc, 0); - ptr = end + 2; - size = bytestream_get_le32(&ptr); - size = FFMIN(size, pkt->size+pkt->data-ptr); + get_le16(pb); /* flags? */ + get_le32(pb); /* data size */ - pd = (AVProbeData) { .buf = ptr, .buf_size = size }; + pd = (AVProbeData) { .buf = pb->buf_ptr, .buf_size = pb->buf_end - pb->buf_ptr }; if (!(sub_demuxer = av_probe_input_format2(&pd, 1, &score))) - return 0; + goto error; - pb = av_alloc_put_byte(ptr, size, 0, NULL, NULL, NULL, NULL); if (!av_open_input_stream(&ast->sub_ctx, pb, "", sub_demuxer, NULL)) { av_read_packet(ast->sub_ctx, &ast->sub_pkt); *st->codec = *ast->sub_ctx->streams[0]->codec; @@ -791,6 +783,8 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { ast->sub_buffer = pkt->data; memset(pkt, 0, sizeof(*pkt)); return 1; +error: + av_freep(&pb); } return 0; } From 69ff14920429c9e128a8bcf65ce3f4b4aa93f3d1 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 6 Feb 2011 20:33:53 -0500 Subject: [PATCH 257/528] Fix compile warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change int64_t into a int, which caused this compiler warning: libavformat/oggparseskeleton.c:64: warning: passing argument 2 of ‘av_reduce’ from incompatible pointer type --- libavformat/oggparseskeleton.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/oggparseskeleton.c b/libavformat/oggparseskeleton.c index f0e17f9cf5..e318e9e718 100644 --- a/libavformat/oggparseskeleton.c +++ b/libavformat/oggparseskeleton.c @@ -60,7 +60,7 @@ static int skeleton_header(AVFormatContext *s, int idx) start_den = AV_RL64(buf+20); if (start_den) { - int64_t base_den; + int base_den; av_reduce(&start_time, &base_den, start_num, start_den, INT_MAX); av_set_pts_info(st, 64, 1, base_den); os->lastpts = From 95ec3d4cacd084e2448c3a1aba420e7d8f00e19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 6 Feb 2011 11:32:03 +0100 Subject: [PATCH 258/528] matroskadec: add generic element length validation. This validate the length of a mkv element directly after reading it. This has the advantage that it is easy to add new limits and makes it less likely to forget to add checks and also avoids issues like bits of the length value above the first 32 being ignored because the parsing functions only takes an int. Previously discussed in the "mkv 0-byte integer parsing" thread. Signed-off-by: Ronald S. Bultje --- libavformat/matroskadec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 1a87f4a0c6..9a670e86c8 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -58,6 +58,7 @@ typedef enum { EBML_NEST, EBML_PASS, EBML_STOP, + EBML_TYPE_COUNT } EbmlType; typedef const struct EbmlSyntax { @@ -780,6 +781,16 @@ static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, static int ebml_parse_elem(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, void *data) { + static const uint64_t max_lengths[EBML_TYPE_COUNT] = { + [EBML_UINT] = 8, + [EBML_FLOAT] = 8, + // max. 16 MB for strings + [EBML_STR] = 0x1000000, + [EBML_UTF8] = 0x1000000, + // max. 256 MB for binary data + [EBML_BIN] = 0x10000000, + // no limits for anything else + }; ByteIOContext *pb = matroska->ctx->pb; uint32_t id = syntax->id; uint64_t length; @@ -798,6 +809,12 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, matroska->current_id = 0; if ((res = ebml_read_length(matroska, pb, &length)) < 0) return res; + if (max_lengths[syntax->type] && length > max_lengths[syntax->type]) { + av_log(matroska->ctx, AV_LOG_ERROR, + "Invalid length 0x%"PRIx64" > 0x%"PRIx64" for syntax element %i\n", + length, max_lengths[syntax->type], syntax->type); + return AVERROR_INVALIDDATA; + } } switch (syntax->type) { From 44ddfd47d671d2587903d94c8b565f68f45bd4bc Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 4 Feb 2011 23:41:07 +0100 Subject: [PATCH 259/528] Xan4 decoder Signed-off-by: Ronald S. Bultje --- Changelog | 1 + doc/general.texi | 2 + libavcodec/Makefile | 2 +- libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 2 +- libavcodec/xxan.c | 429 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 435 insertions(+), 2 deletions(-) create mode 100644 libavcodec/xxan.c diff --git a/Changelog b/Changelog index 8b7efb6105..a85a9d3221 100644 --- a/Changelog +++ b/Changelog @@ -74,6 +74,7 @@ version : - Lagarith decoder - ffmpeg -copytb option added - IVF muxer added +- Wing Commander IV movies decoder added version 0.6: diff --git a/doc/general.texi b/doc/general.texi index 950159f1b3..ad34c70ef7 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -511,6 +511,8 @@ following image formats are supported: @tab not completely working @item Wing Commander III / Xan @tab @tab X @tab Used in Wing Commander III .MVE files. +@item Wing Commander IV / Xan @tab @tab X + @tab Used in Wing Commander IV. @item Winnov WNV1 @tab @tab X @item WMV7 @tab X @tab X @item YAMAHA SMAF @tab X @tab X diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 6a0a05b870..fa6c0bb9cd 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -415,7 +415,7 @@ OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o OBJS-$(CONFIG_WS_SND1_DECODER) += ws-snd1.o OBJS-$(CONFIG_XAN_DPCM_DECODER) += dpcm.o OBJS-$(CONFIG_XAN_WC3_DECODER) += xan.o -OBJS-$(CONFIG_XAN_WC4_DECODER) += xan.o +OBJS-$(CONFIG_XAN_WC4_DECODER) += xxan.o OBJS-$(CONFIG_XL_DECODER) += xl.o OBJS-$(CONFIG_XSUB_DECODER) += xsubdec.o OBJS-$(CONFIG_XSUB_ENCODER) += xsubenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 04c5c6aad4..108a3ab7c8 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -214,6 +214,7 @@ void avcodec_register_all(void) REGISTER_DECODER (WMV3_VDPAU, wmv3_vdpau); REGISTER_DECODER (WNV1, wnv1); REGISTER_DECODER (XAN_WC3, xan_wc3); + REGISTER_DECODER (XAN_WC4, xan_wc4); REGISTER_DECODER (XL, xl); REGISTER_DECODER (YOP, yop); REGISTER_ENCDEC (ZLIB, zlib); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index fc29bbadb6..e8d5f1a04f 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -32,7 +32,7 @@ #include "libavutil/cpu.h" #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 109 +#define LIBAVCODEC_VERSION_MINOR 110 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c new file mode 100644 index 0000000000..10ec53f467 --- /dev/null +++ b/libavcodec/xxan.c @@ -0,0 +1,429 @@ +/* + * Wing Commander/Xan Video Decoder + * Copyright (C) 2011 Konstantin Shishkov + * based on work by Mike Melanson + * + * 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 "libavutil/intreadwrite.h" +#include "bytestream.h" +#define ALT_BITSTREAM_READER_LE +#include "get_bits.h" +// for av_memcpy_backptr +#include "libavutil/lzo.h" + +typedef struct XanContext { + AVCodecContext *avctx; + AVFrame pic; + + uint8_t *y_buffer; + uint8_t *scratch_buffer; + int buffer_size; +} XanContext; + +static av_cold int xan_decode_init(AVCodecContext *avctx) +{ + XanContext *s = avctx->priv_data; + + s->avctx = avctx; + + avctx->pix_fmt = PIX_FMT_YUV420P; + + s->buffer_size = avctx->width * avctx->height; + s->y_buffer = av_malloc(s->buffer_size); + if (!s->y_buffer) + return AVERROR(ENOMEM); + s->scratch_buffer = av_malloc(s->buffer_size + 130); + if (!s->scratch_buffer) { + av_freep(&s->y_buffer); + return AVERROR(ENOMEM); + } + + return 0; +} + +static int xan_unpack_luma(const uint8_t *src, const int src_size, + uint8_t *dst, const int dst_size) +{ + int tree_size, eof; + const uint8_t *tree; + int bits, mask; + int tree_root, node; + const uint8_t *dst_end = dst + dst_size; + const uint8_t *src_end = src + src_size; + + tree_size = *src++; + eof = *src++; + tree = src - eof * 2 - 2; + tree_root = eof + tree_size; + src += tree_size * 2; + + node = tree_root; + bits = *src++; + mask = 0x80; + for (;;) { + int bit = !!(bits & mask); + mask >>= 1; + node = tree[node*2 + bit]; + if (node == eof) + break; + if (node < eof) { + *dst++ = node; + if (dst > dst_end) + break; + node = tree_root; + } + if (!mask) { + bits = *src++; + if (src > src_end) + break; + mask = 0x80; + } + } + return dst != dst_end; +} + +/* almost the same as in xan_wc3 decoder */ +static int xan_unpack(uint8_t *dest, const int dest_len, + const uint8_t *src, const int src_len) +{ + uint8_t opcode; + int size; + uint8_t *orig_dest = dest; + const uint8_t *src_end = src + src_len; + const uint8_t *dest_end = dest + dest_len; + + while (dest < dest_end) { + opcode = *src++; + + if (opcode < 0xe0) { + int size2, back; + if ((opcode & 0x80) == 0) { + size = opcode & 3; + back = ((opcode & 0x60) << 3) + *src++ + 1; + size2 = ((opcode & 0x1c) >> 2) + 3; + } else if ((opcode & 0x40) == 0) { + size = *src >> 6; + back = (bytestream_get_be16(&src) & 0x3fff) + 1; + size2 = (opcode & 0x3f) + 4; + } else { + size = opcode & 3; + back = ((opcode & 0x10) << 12) + bytestream_get_be16(&src) + 1; + size2 = ((opcode & 0x0c) << 6) + *src++ + 5; + if (size + size2 > dest_end - dest) + break; + } + if (src + size > src_end || dest + size + size2 > dest_end) + return -1; + bytestream_get_buffer(&src, dest, size); + dest += size; + av_memcpy_backptr(dest, back, size2); + dest += size2; + } else { + int finish = opcode >= 0xfc; + + size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4; + if (src + size > src_end || dest + size > dest_end) + return -1; + bytestream_get_buffer(&src, dest, size); + dest += size; + if (finish) + break; + } + } + return dest - orig_dest; +} + +static int xan_decode_chroma(AVCodecContext *avctx, AVPacket *avpkt) +{ + const uint8_t *buf = avpkt->data; + XanContext *s = avctx->priv_data; + uint8_t *U, *V; + unsigned chroma_off; + int val, uval, vval; + int i, j; + const uint8_t *src, *src_end; + const uint8_t *table; + int mode, offset, dec_size; + + chroma_off = AV_RL32(buf + 4); + if (!chroma_off) + return 0; + if (chroma_off + 10 >= avpkt->size) { + av_log(avctx, AV_LOG_ERROR, "Invalid chroma block position\n"); + return -1; + } + src = avpkt->data + 4 + chroma_off; + table = src + 2; + mode = bytestream_get_le16(&src); + offset = bytestream_get_le16(&src) * 2; + + if (src - avpkt->data >= avpkt->size - offset) { + av_log(avctx, AV_LOG_ERROR, "Invalid chroma block offset\n"); + return -1; + } + + memset(s->scratch_buffer, 0, s->buffer_size); + dec_size = xan_unpack(s->scratch_buffer, s->buffer_size, src + offset, + avpkt->size - offset - (src - avpkt->data)); + if (dec_size < 0) { + av_log(avctx, AV_LOG_ERROR, "Chroma unpacking failed\n"); + return -1; + } + + U = s->pic.data[1]; + V = s->pic.data[2]; + src = s->scratch_buffer; + src_end = src + dec_size; + if (mode) { + for (j = 0; j < avctx->height >> 1; j++) { + for (i = 0; i < avctx->width >> 1; i++) { + val = *src++; + if (val) { + val = AV_RL16(table + (val << 1)); + uval = (val >> 3) & 0xF8; + vval = (val >> 8) & 0xF8; + U[i] = uval | (uval >> 5); + V[i] = vval | (vval >> 5); + } + if (src == src_end) + return 0; + } + U += s->pic.linesize[1]; + V += s->pic.linesize[2]; + } + } else { + uint8_t *U2 = U + s->pic.linesize[1]; + uint8_t *V2 = V + s->pic.linesize[2]; + + for (j = 0; j < avctx->height >> 2; j++) { + for (i = 0; i < avctx->width >> 1; i += 2) { + val = *src++; + if (val) { + val = AV_RL16(table + (val << 1)); + uval = (val >> 3) & 0xF8; + vval = (val >> 8) & 0xF8; + U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5); + V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5); + } + } + U += s->pic.linesize[1] * 2; + V += s->pic.linesize[2] * 2; + U2 += s->pic.linesize[1] * 2; + V2 += s->pic.linesize[2] * 2; + } + } + + return 0; +} + +static int xan_decode_frame_type0(AVCodecContext *avctx, AVPacket *avpkt) +{ + const uint8_t *buf = avpkt->data; + XanContext *s = avctx->priv_data; + uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer; + unsigned chroma_off, corr_off; + int cur, last, size; + int i, j; + int ret; + + corr_off = AV_RL32(buf + 8); + chroma_off = AV_RL32(buf + 4); + + if ((ret = xan_decode_chroma(avctx, avpkt)) != 0) + return ret; + + size = avpkt->size - 4; + if (corr_off >= avpkt->size) { + av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n"); + corr_off = 0; + } + if (corr_off) + size = corr_off; + if (chroma_off) + size = FFMIN(size, chroma_off); + ret = xan_unpack_luma(buf + 12, size, src, s->buffer_size >> 1); + if (ret) { + av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); + return ret; + } + + ybuf = s->y_buffer; + last = *src++; + ybuf[0] = last << 1; + for (j = 1; j < avctx->width - 1; j += 2) { + cur = (last + *src++) & 0x1F; + ybuf[j] = last + cur; + ybuf[j+1] = cur << 1; + last = cur; + } + ybuf[j] = last << 1; + prev_buf = ybuf; + ybuf += avctx->width; + + for (i = 1; i < avctx->height; i++) { + last = ((prev_buf[0] >> 1) + *src++) & 0x1F; + ybuf[0] = last << 1; + for (j = 1; j < avctx->width - 1; j += 2) { + cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F; + ybuf[j] = last + cur; + ybuf[j+1] = cur << 1; + last = cur; + } + ybuf[j] = last << 1; + prev_buf = ybuf; + ybuf += avctx->width; + } + + if (corr_off) { + int corr_end, dec_size; + + corr_end = avpkt->size; + if (chroma_off > corr_off) + corr_end = chroma_off; + dec_size = xan_unpack(s->scratch_buffer, s->buffer_size, + avpkt->data + 8 + corr_off, + corr_end - corr_off); + if (dec_size < 0) + dec_size = 0; + for (i = 0; i < dec_size; i++) + s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F; + } + + src = s->y_buffer; + ybuf = s->pic.data[0]; + for (j = 0; j < avctx->height; j++) { + for (i = 0; i < avctx->width; i++) + ybuf[i] = (src[i] << 2) | (src[i] >> 3); + src += avctx->width; + ybuf += s->pic.linesize[0]; + } + + return 0; +} + +static int xan_decode_frame_type1(AVCodecContext *avctx, AVPacket *avpkt) +{ + const uint8_t *buf = avpkt->data; + XanContext *s = avctx->priv_data; + uint8_t *ybuf, *src = s->scratch_buffer; + int cur, last; + int i, j; + int ret; + + if ((ret = xan_decode_chroma(avctx, avpkt)) != 0) + return ret; + + ret = xan_unpack_luma(buf + 16, avpkt->size - 16, src, + s->buffer_size >> 1); + if (ret) { + av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); + return ret; + } + + ybuf = s->y_buffer; + for (i = 0; i < avctx->height; i++) { + last = (ybuf[0] + (*src++ << 1)) & 0x3F; + ybuf[0] = last; + for (j = 1; j < avctx->width - 1; j += 2) { + cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F; + ybuf[j] = (last + cur) >> 1; + ybuf[j+1] = cur; + last = cur; + } + ybuf[j] = last; + ybuf += avctx->width; + } + + src = s->y_buffer; + ybuf = s->pic.data[0]; + for (j = 0; j < avctx->height; j++) { + for (i = 0; i < avctx->width; i++) + ybuf[i] = (src[i] << 2) | (src[i] >> 3); + src += avctx->width; + ybuf += s->pic.linesize[0]; + } + + return 0; +} + +static int xan_decode_frame(AVCodecContext *avctx, + void *data, int *data_size, + AVPacket *avpkt) +{ + XanContext *s = avctx->priv_data; + int ftype; + int ret; + + s->pic.reference = 1; + s->pic.buffer_hints = FF_BUFFER_HINTS_VALID | + FF_BUFFER_HINTS_PRESERVE | + FF_BUFFER_HINTS_REUSABLE; + if ((ret = avctx->reget_buffer(avctx, &s->pic))) { + av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + return ret; + } + + ftype = AV_RL32(avpkt->data); + switch (ftype) { + case 0: + ret = xan_decode_frame_type0(avctx, avpkt); + break; + case 1: + ret = xan_decode_frame_type1(avctx, avpkt); + break; + default: + av_log(avctx, AV_LOG_ERROR, "Unknown frame type %d\n", ftype); + return -1; + } + if (ret) + return ret; + + *data_size = sizeof(AVFrame); + *(AVFrame*)data = s->pic; + + return avpkt->size; +} + +static av_cold int xan_decode_end(AVCodecContext *avctx) +{ + XanContext *s = avctx->priv_data; + + if (s->pic.data[0]) + avctx->release_buffer(avctx, &s->pic); + + av_freep(&s->y_buffer); + av_freep(&s->scratch_buffer); + + return 0; +} + +AVCodec ff_xan_wc4_decoder = { + "xan_wc4", + AVMEDIA_TYPE_VIDEO, + CODEC_ID_XAN_WC4, + sizeof(XanContext), + xan_decode_init, + NULL, + xan_decode_end, + xan_decode_frame, + CODEC_CAP_DR1, + .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"), +}; + From 90e8a9c34f641d0cb9137190c1912a3da3095e01 Mon Sep 17 00:00:00 2001 From: Kostya Date: Thu, 3 Feb 2011 10:06:12 +0100 Subject: [PATCH 260/528] Remove Xan WC4 cruft from xan.c Signed-off-by: Ronald S. Bultje --- libavcodec/xan.c | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 0ae84a6903..520331634c 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -358,9 +358,6 @@ static void xan_wc3_decode_frame(XanContext *s) { } } -static void xan_wc4_decode_frame(XanContext *s) { -} - #if RUNTIME_GAMMA static inline unsigned mul(unsigned a, unsigned b) { @@ -515,23 +512,12 @@ static int xan_decode_frame(AVCodecContext *avctx, if (!s->frame_size) s->frame_size = s->current_frame.linesize[0] * s->avctx->height; - if (avctx->codec->id == CODEC_ID_XAN_WC3) { - memcpy(s->current_frame.data[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE); - } else { - AVPaletteControl *palette_control = avctx->palctrl; - palette_control->palette_changed = 0; - memcpy(s->current_frame.data[1], palette_control->palette, - AVPALETTE_SIZE); - s->current_frame.palette_has_changed = 1; - } + memcpy(s->current_frame.data[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE); s->buf = buf; s->size = buf_size; - if (avctx->codec->id == CODEC_ID_XAN_WC3) - xan_wc3_decode_frame(s); - else if (avctx->codec->id == CODEC_ID_XAN_WC4) - xan_wc4_decode_frame(s); + xan_wc3_decode_frame(s); /* release the last frame if it is allocated */ if (s->last_frame.data[0]) @@ -577,17 +563,3 @@ AVCodec ff_xan_wc3_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"), }; -/* -AVCodec ff_xan_wc4_decoder = { - "xan_wc4", - AVMEDIA_TYPE_VIDEO, - CODEC_ID_XAN_WC4, - sizeof(XanContext), - xan_decode_init, - NULL, - xan_decode_end, - xan_decode_frame, - CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"), -}; -*/ From 5bea615dc383cf3617c5057db4fbc6832fc64137 Mon Sep 17 00:00:00 2001 From: Jindrich Makovicka Date: Sat, 5 Feb 2011 10:43:11 +0000 Subject: [PATCH 261/528] dvbsubdec: pass correct input buffer size In some places, dvbsubdec passes improper input buffer size to bitstream reading functions, not accounting for reading pointer updates. Fixed by using buffer_end - buffer pointer instead of fixed buffer length. Signed-off-by: Jindrich Makovicka Signed-off-by: Mans Rullgard --- libavcodec/dvbsubdec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index fe9879822f..8cc8d4fc83 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -792,7 +792,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis map_table = NULL; x_pos += dvbsub_read_2bit_string(pbuf + (y_pos * region->width) + x_pos, - region->width - x_pos, &buf, buf_size, + region->width - x_pos, &buf, buf_end - buf, non_mod, map_table); break; case 0x11: @@ -807,7 +807,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis map_table = NULL; x_pos += dvbsub_read_4bit_string(pbuf + (y_pos * region->width) + x_pos, - region->width - x_pos, &buf, buf_size, + region->width - x_pos, &buf, buf_end - buf, non_mod, map_table); break; case 0x12: @@ -817,7 +817,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis } x_pos += dvbsub_read_8bit_string(pbuf + (y_pos * region->width) + x_pos, - region->width - x_pos, &buf, buf_size, + region->width - x_pos, &buf, buf_end - buf, non_mod, NULL); break; From a1c1d3c003b0ec16fdb6574913781313fb2c7ab6 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 2 Feb 2011 16:26:20 +0000 Subject: [PATCH 262/528] VP8: ARM NEON optimisations for dsp functions This adds NEON optimised versions of all functions in VP8DSPContext. Based on initial work by Rob Clark. Signed-off-by: Mans Rullgard --- libavcodec/arm/Makefile | 3 + libavcodec/arm/vp8dsp_init_arm.c | 163 +++ libavcodec/arm/vp8dsp_neon.S | 1910 ++++++++++++++++++++++++++++++ libavcodec/vp8dsp.c | 2 + libavcodec/vp8dsp.h | 1 + 5 files changed, 2079 insertions(+) create mode 100644 libavcodec/arm/vp8dsp_init_arm.c create mode 100644 libavcodec/arm/vp8dsp_neon.S diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile index 014456ee32..15269ea676 100644 --- a/libavcodec/arm/Makefile +++ b/libavcodec/arm/Makefile @@ -2,6 +2,7 @@ OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \ OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_init_arm.o +OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_arm.o OBJS-$(CONFIG_H264DSP) += arm/h264dsp_init_arm.o OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o @@ -54,6 +55,8 @@ NEON-OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_neon.o \ NEON-OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_neon.o \ arm/vp3dsp_neon.o \ +NEON-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_neon.o + OBJS-$(HAVE_NEON) += arm/dsputil_init_neon.o \ arm/dsputil_neon.o \ arm/fmtconvert_neon.o \ diff --git a/libavcodec/arm/vp8dsp_init_arm.c b/libavcodec/arm/vp8dsp_init_arm.c new file mode 100644 index 0000000000..c970ca548c --- /dev/null +++ b/libavcodec/arm/vp8dsp_init_arm.c @@ -0,0 +1,163 @@ +/** + * 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 "libavcodec/vp8dsp.h" + +void ff_vp8_luma_dc_wht_neon(DCTELEM block[4][4][16], DCTELEM dc[16]); +void ff_vp8_luma_dc_wht_dc_neon(DCTELEM block[4][4][16], DCTELEM dc[16]); + +void ff_vp8_idct_add_neon(uint8_t *dst, DCTELEM block[16], int stride); +void ff_vp8_idct_dc_add_neon(uint8_t *dst, DCTELEM block[16], int stride); +void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, DCTELEM block[4][16], int stride); +void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, DCTELEM block[4][16], int stride); + +void ff_vp8_v_loop_filter16_neon(uint8_t *dst, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_h_loop_filter16_neon(uint8_t *dst, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_v_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_h_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride, + int flim_E, int flim_I, int hev_thresh); + +void ff_vp8_v_loop_filter16_inner_neon(uint8_t *dst, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_h_loop_filter16_inner_neon(uint8_t *dst, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_v_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV, + int stride, int flim_E, int flim_I, + int hev_thresh); +void ff_vp8_h_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV, + int stride, int flim_E, int flim_I, + int hev_thresh); + +void ff_vp8_v_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim); +void ff_vp8_h_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim); + + +#define VP8_MC(n) \ + void ff_put_vp8_##n##_neon(uint8_t *dst, int dststride, \ + uint8_t *src, int srcstride, \ + int h, int x, int y) + +#define VP8_EPEL(w) \ + VP8_MC(pixels ## w); \ + VP8_MC(epel ## w ## _h4); \ + VP8_MC(epel ## w ## _h6); \ + VP8_MC(epel ## w ## _v4); \ + VP8_MC(epel ## w ## _h4v4); \ + VP8_MC(epel ## w ## _h6v4); \ + VP8_MC(epel ## w ## _v6); \ + VP8_MC(epel ## w ## _h4v6); \ + VP8_MC(epel ## w ## _h6v6) + +VP8_EPEL(16); +VP8_EPEL(8); +VP8_EPEL(4); + +VP8_MC(bilin16_h); +VP8_MC(bilin16_v); +VP8_MC(bilin16_hv); +VP8_MC(bilin8_h); +VP8_MC(bilin8_v); +VP8_MC(bilin8_hv); +VP8_MC(bilin4_h); +VP8_MC(bilin4_v); +VP8_MC(bilin4_hv); + +av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp) +{ + if (HAVE_NEON) { + dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon; + dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_neon; + + dsp->vp8_idct_add = ff_vp8_idct_add_neon; + dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon; + dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon; + dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon; + + dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon; + dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon; + dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon; + dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon; + + dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon; + dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon; + dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon; + dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon; + + dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon; + dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon; + + dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon; + dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon; + dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon; + dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon; + dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon; + dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon; + + dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon; + dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon; + } +} diff --git a/libavcodec/arm/vp8dsp_neon.S b/libavcodec/arm/vp8dsp_neon.S new file mode 100644 index 0000000000..01c39593a0 --- /dev/null +++ b/libavcodec/arm/vp8dsp_neon.S @@ -0,0 +1,1910 @@ +/** + * VP8 NEON optimisations + * + * Copyright (c) 2010 Rob Clark + * Copyright (c) 2011 Mans Rullgard + * + * 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 "asm.S" + +function ff_vp8_luma_dc_wht_neon, export=1 + vld1.16 {q0-q1}, [r1,:128] + vmov.i16 q15, #0 + + vadd.i16 d4, d0, d3 + vadd.i16 d6, d1, d2 + vst1.16 {q15}, [r1,:128]! + vsub.i16 d7, d1, d2 + vsub.i16 d5, d0, d3 + vst1.16 {q15}, [r1,:128] + vadd.i16 q0, q2, q3 + vsub.i16 q1, q2, q3 + + vmov.i16 q8, #3 + + vtrn.32 d0, d2 + vtrn.32 d1, d3 + vtrn.16 d0, d1 + vtrn.16 d2, d3 + + vadd.i16 d0, d0, d16 + + vadd.i16 d4, d0, d3 + vadd.i16 d6, d1, d2 + vsub.i16 d7, d1, d2 + vsub.i16 d5, d0, d3 + vadd.i16 q0, q2, q3 + vsub.i16 q1, q2, q3 + + vshr.s16 q0, q0, #3 + vshr.s16 q1, q1, #3 + + mov r3, #32 + vst1.16 {d0[0]}, [r0,:16], r3 + vst1.16 {d1[0]}, [r0,:16], r3 + vst1.16 {d2[0]}, [r0,:16], r3 + vst1.16 {d3[0]}, [r0,:16], r3 + vst1.16 {d0[1]}, [r0,:16], r3 + vst1.16 {d1[1]}, [r0,:16], r3 + vst1.16 {d2[1]}, [r0,:16], r3 + vst1.16 {d3[1]}, [r0,:16], r3 + vst1.16 {d0[2]}, [r0,:16], r3 + vst1.16 {d1[2]}, [r0,:16], r3 + vst1.16 {d2[2]}, [r0,:16], r3 + vst1.16 {d3[2]}, [r0,:16], r3 + vst1.16 {d0[3]}, [r0,:16], r3 + vst1.16 {d1[3]}, [r0,:16], r3 + vst1.16 {d2[3]}, [r0,:16], r3 + vst1.16 {d3[3]}, [r0,:16], r3 + + bx lr +endfunc + +function ff_vp8_luma_dc_wht_dc_neon, export=1 + ldrsh r2, [r1] + mov r3, #0 + add r2, r2, #3 + strh r3, [r1] + asr r2, r2, #3 + .rept 16 + strh r2, [r0], #32 + .endr + bx lr +endfunc + +function ff_vp8_idct_add_neon, export=1 + vld1.16 {q0-q1}, [r1,:128] + movw r3, #20091 + movt r3, #35468/2 + vdup.32 d4, r3 + + vmull.s16 q12, d1, d4[0] + vmull.s16 q13, d3, d4[0] + vqdmulh.s16 d20, d1, d4[1] + vqdmulh.s16 d23, d3, d4[1] + vshrn.s32 d21, q12, #16 + vshrn.s32 d22, q13, #16 + vadd.s16 d21, d21, d1 + vadd.s16 d22, d22, d3 + + vadd.s16 d16, d0, d2 + vsub.s16 d17, d0, d2 + vadd.s16 d18, d21, d23 + vsub.s16 d19, d20, d22 + vadd.s16 q0, q8, q9 + vsub.s16 q1, q8, q9 + + vtrn.32 d0, d3 + vtrn.32 d1, d2 + vtrn.16 d0, d1 + vtrn.16 d3, d2 + + vmov.i16 q15, #0 + vmull.s16 q12, d1, d4[0] + vst1.16 {q15}, [r1,:128]! + vmull.s16 q13, d2, d4[0] + vst1.16 {q15}, [r1,:128] + vqdmulh.s16 d21, d1, d4[1] + vqdmulh.s16 d23, d2, d4[1] + vshrn.s32 d20, q12, #16 + vshrn.s32 d22, q13, #16 + vadd.i16 d20, d20, d1 + vadd.i16 d22, d22, d2 + + vadd.i16 d16, d0, d3 + vsub.i16 d17, d0, d3 + vadd.i16 d18, d20, d23 + vld1.32 {d20[]}, [r0,:32], r2 + vsub.i16 d19, d21, d22 + vld1.32 {d22[]}, [r0,:32], r2 + vadd.s16 q0, q8, q9 + vld1.32 {d23[]}, [r0,:32], r2 + vsub.s16 q1, q8, q9 + vld1.32 {d21[]}, [r0,:32], r2 + vrshr.s16 q0, q0, #3 + vtrn.32 q10, q11 + vrshr.s16 q1, q1, #3 + + sub r0, r0, r2, lsl #2 + + vtrn.32 d0, d3 + vtrn.32 d1, d2 + vtrn.16 d0, d1 + vtrn.16 d3, d2 + + vaddw.u8 q0, q0, d20 + vaddw.u8 q1, q1, d21 + vqmovun.s16 d0, q0 + vqmovun.s16 d1, q1 + + vst1.32 {d0[0]}, [r0,:32], r2 + vst1.32 {d0[1]}, [r0,:32], r2 + vst1.32 {d1[1]}, [r0,:32], r2 + vst1.32 {d1[0]}, [r0,:32], r2 + + bx lr +endfunc + +function ff_vp8_idct_dc_add_neon, export=1 + mov r3, #0 + ldrsh r12, [r1] + strh r3, [r1] + vdup.16 q1, r12 + vrshr.s16 q1, q1, #3 + vld1.32 {d0[]}, [r0,:32], r2 + vld1.32 {d1[]}, [r0,:32], r2 + vld1.32 {d0[1]}, [r0,:32], r2 + vld1.32 {d1[1]}, [r0,:32], r2 + vaddw.u8 q2, q1, d0 + vaddw.u8 q3, q1, d1 + sub r0, r0, r2, lsl #2 + vqmovun.s16 d0, q2 + vqmovun.s16 d1, q3 + vst1.32 {d0[0]}, [r0,:32], r2 + vst1.32 {d1[0]}, [r0,:32], r2 + vst1.32 {d0[1]}, [r0,:32], r2 + vst1.32 {d1[1]}, [r0,:32], r2 + bx lr +endfunc + +function ff_vp8_idct_dc_add4uv_neon, export=1 + vmov.i16 d0, #0 + mov r3, #32 + vld1.16 {d16[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d17[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d18[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d19[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + mov r3, r0 + vrshr.s16 q8, q8, #3 @ dc >>= 3 + vld1.8 {d0}, [r0,:64], r2 + vrshr.s16 q9, q9, #3 + vld1.8 {d1}, [r0,:64], r2 + vaddw.u8 q10, q8, d0 + vld1.8 {d2}, [r0,:64], r2 + vaddw.u8 q0, q8, d1 + vld1.8 {d3}, [r0,:64], r2 + vaddw.u8 q11, q8, d2 + vld1.8 {d4}, [r0,:64], r2 + vaddw.u8 q1, q8, d3 + vld1.8 {d5}, [r0,:64], r2 + vaddw.u8 q12, q9, d4 + vld1.8 {d6}, [r0,:64], r2 + vaddw.u8 q2, q9, d5 + vld1.8 {d7}, [r0,:64], r2 + vaddw.u8 q13, q9, d6 + vqmovun.s16 d20, q10 + vaddw.u8 q3, q9, d7 + vqmovun.s16 d21, q0 + vqmovun.s16 d22, q11 + vst1.8 {d20}, [r3,:64], r2 + vqmovun.s16 d23, q1 + vst1.8 {d21}, [r3,:64], r2 + vqmovun.s16 d24, q12 + vst1.8 {d22}, [r3,:64], r2 + vqmovun.s16 d25, q2 + vst1.8 {d23}, [r3,:64], r2 + vqmovun.s16 d26, q13 + vst1.8 {d24}, [r3,:64], r2 + vqmovun.s16 d27, q3 + vst1.8 {d25}, [r3,:64], r2 + vst1.8 {d26}, [r3,:64], r2 + vst1.8 {d27}, [r3,:64], r2 + + bx lr +endfunc + +function ff_vp8_idct_dc_add4y_neon, export=1 + vmov.i16 d0, #0 + mov r3, #32 + vld1.16 {d16[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d17[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d18[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d19[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vrshr.s16 q8, q8, #3 @ dc >>= 3 + vld1.8 {q0}, [r0,:128], r2 + vrshr.s16 q9, q9, #3 + vld1.8 {q1}, [r0,:128], r2 + vaddw.u8 q10, q8, d0 + vld1.8 {q2}, [r0,:128], r2 + vaddw.u8 q0, q9, d1 + vld1.8 {q3}, [r0,:128], r2 + vaddw.u8 q11, q8, d2 + vaddw.u8 q1, q9, d3 + vaddw.u8 q12, q8, d4 + vaddw.u8 q2, q9, d5 + vaddw.u8 q13, q8, d6 + vaddw.u8 q3, q9, d7 + sub r0, r0, r2, lsl #2 + vqmovun.s16 d20, q10 + vqmovun.s16 d21, q0 + vqmovun.s16 d22, q11 + vqmovun.s16 d23, q1 + vqmovun.s16 d24, q12 + vst1.8 {q10}, [r0,:128], r2 + vqmovun.s16 d25, q2 + vst1.8 {q11}, [r0,:128], r2 + vqmovun.s16 d26, q13 + vst1.8 {q12}, [r0,:128], r2 + vqmovun.s16 d27, q3 + vst1.8 {q13}, [r0,:128], r2 + + bx lr +endfunc + +@ Register layout: +@ P3..Q3 -> q0..q7 +@ flim_E -> q14 +@ flim_I -> q15 +@ hev_thresh -> r12 +@ +.macro vp8_loop_filter, inner=0, simple=0 + .if \simple + vabd.u8 q9, q3, q4 @ abs(P0-Q0) + vabd.u8 q15, q2, q5 @ abs(P1-Q1) + vqadd.u8 q9, q9, q9 @ abs(P0-Q0) * 2 + vshr.u8 q10, q15, #1 @ abs(P1-Q1) / 2 + vqadd.u8 q11, q9, q10 @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) + vmov.i8 q13, #0x80 + vcle.u8 q8, q11, q14 @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) <= flim + .else + @ calculate hev and normal_limit: + vabd.u8 q12, q2, q3 @ abs(P1-P0) + vabd.u8 q13, q5, q4 @ abs(Q1-Q0) + vabd.u8 q10, q0, q1 @ abs(P3-P2) + vabd.u8 q11, q1, q2 @ abs(P2-P1) + vcle.u8 q8, q12, q15 @ abs(P1-P0) <= flim_I + vcle.u8 q9, q13, q15 @ abs(Q1-Q0) <= flim_I + vcle.u8 q10, q10, q15 @ abs(P3-P2) <= flim_I + vcle.u8 q11, q11, q15 @ abs(P2-P1) <= flim_I + vand q8, q8, q9 + vabd.u8 q9, q7, q6 @ abs(Q3-Q2) + vand q8, q8, q11 + vabd.u8 q11, q6, q5 @ abs(Q2-Q1) + vand q8, q8, q10 + vcle.u8 q10, q9, q15 @ abs(Q3-Q2) <= flim_I + vcle.u8 q11, q11, q15 @ abs(Q2-Q1) <= flim_I + vabd.u8 q9, q3, q4 @ abs(P0-Q0) + vabd.u8 q15, q2, q5 @ abs(P1-Q1) + vand q8, q8, q10 + vqadd.u8 q9, q9, q9 @ abs(P0-Q0) * 2 + vand q8, q8, q11 + vshr.u8 q10, q15, #1 @ abs(P1-Q1) / 2 + vdup.8 q15, r12 @ hev_thresh + vqadd.u8 q11, q9, q10 @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) + vcgt.u8 q12, q12, q15 @ abs(P1-P0) > hev_thresh + vcle.u8 q11, q11, q14 @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) <= flim_E + vcgt.u8 q14, q13, q15 @ abs(Q1-Q0) > hev_thresh + vand q8, q8, q11 + vmov.i8 q13, #0x80 + vorr q9, q12, q14 + .endif + + @ at this point: + @ q8: normal_limit + @ q9: hev + + @ convert to signed value: + veor q3, q3, q13 @ PS0 = P0 ^ 0x80 + veor q4, q4, q13 @ QS0 = Q0 ^ 0x80 + + vmov.i16 q12, #3 + vsubl.s8 q10, d8, d6 @ QS0 - PS0 + vsubl.s8 q11, d9, d7 @ (widened to 16bit) + veor q2, q2, q13 @ PS1 = P1 ^ 0x80 + veor q5, q5, q13 @ QS1 = Q1 ^ 0x80 + vmul.i16 q10, q10, q12 @ w = 3 * (QS0 - PS0) + vmul.i16 q11, q11, q12 + + vqsub.s8 q12, q2, q5 @ clamp(PS1-QS1) + vmov.i8 q14, #4 + vmov.i8 q15, #3 + .if \inner + vand q12, q12, q9 @ if(hev) w += clamp(PS1-QS1) + .endif + vaddw.s8 q10, q10, d24 @ w += clamp(PS1-QS1) + vaddw.s8 q11, q11, d25 + vqmovn.s16 d20, q10 @ narrow result back into q10 + vqmovn.s16 d21, q11 + .if !\inner && !\simple + veor q1, q1, q13 @ PS2 = P2 ^ 0x80 + veor q6, q6, q13 @ QS2 = Q2 ^ 0x80 + .endif + vand q10, q10, q8 @ w &= normal_limit + + @ registers used at this point.. + @ q0 -> P3 (don't corrupt) + @ q1-q6 -> PS2-QS2 + @ q7 -> Q3 (don't corrupt) + @ q9 -> hev + @ q10 -> w + @ q13 -> #0x80 + @ q14 -> #4 + @ q15 -> #3 + @ q8, q11, q12 -> unused + + @ filter_common: is4tap==1 + @ c1 = clamp(w + 4) >> 3; + @ c2 = clamp(w + 3) >> 3; + @ Q0 = s2u(QS0 - c1); + @ P0 = s2u(PS0 + c2); + + .if \simple + vqadd.s8 q11, q10, q14 @ c1 = clamp((w&hev)+4) + vqadd.s8 q12, q10, q15 @ c2 = clamp((w&hev)+3) + vshr.s8 q11, q11, #3 @ c1 >>= 3 + vshr.s8 q12, q12, #3 @ c2 >>= 3 + vqsub.s8 q4, q4, q11 @ QS0 = clamp(QS0-c1) + vqadd.s8 q3, q3, q12 @ PS0 = clamp(PS0+c2) + veor q4, q4, q13 @ Q0 = QS0 ^ 0x80 + veor q3, q3, q13 @ P0 = PS0 ^ 0x80 + veor q5, q5, q13 @ Q1 = QS1 ^ 0x80 + veor q2, q2, q13 @ P1 = PS1 ^ 0x80 + .elseif \inner + @ the !is4tap case of filter_common, only used for inner blocks + @ c3 = ((c1&~hev) + 1) >> 1; + @ Q1 = s2u(QS1 - c3); + @ P1 = s2u(PS1 + c3); + vqadd.s8 q11, q10, q14 @ c1 = clamp((w&hev)+4) + vqadd.s8 q12, q10, q15 @ c2 = clamp((w&hev)+3) + vshr.s8 q11, q11, #3 @ c1 >>= 3 + vshr.s8 q12, q12, #3 @ c2 >>= 3 + vqsub.s8 q4, q4, q11 @ QS0 = clamp(QS0-c1) + vqadd.s8 q3, q3, q12 @ PS0 = clamp(PS0+c2) + vbic q11, q11, q9 @ c1 & ~hev + veor q4, q4, q13 @ Q0 = QS0 ^ 0x80 + vrshr.s8 q11, q11, #1 @ c3 >>= 1 + veor q3, q3, q13 @ P0 = PS0 ^ 0x80 + vqsub.s8 q5, q5, q11 @ QS1 = clamp(QS1-c3) + vqadd.s8 q2, q2, q11 @ PS1 = clamp(PS1+c3) + veor q5, q5, q13 @ Q1 = QS1 ^ 0x80 + veor q2, q2, q13 @ P1 = PS1 ^ 0x80 + .else + vand q12, q10, q9 @ w & hev + vqadd.s8 q11, q12, q14 @ c1 = clamp((w&hev)+4) + vqadd.s8 q12, q12, q15 @ c2 = clamp((w&hev)+3) + vshr.s8 q11, q11, #3 @ c1 >>= 3 + vshr.s8 q12, q12, #3 @ c2 >>= 3 + vbic q10, q10, q9 @ w &= ~hev + vqsub.s8 q4, q4, q11 @ QS0 = clamp(QS0-c1) + vqadd.s8 q3, q3, q12 @ PS0 = clamp(PS0+c2) + + @ filter_mbedge: + @ a = clamp((27*w + 63) >> 7); + @ Q0 = s2u(QS0 - a); + @ P0 = s2u(PS0 + a); + @ a = clamp((18*w + 63) >> 7); + @ Q1 = s2u(QS1 - a); + @ P1 = s2u(PS1 + a); + @ a = clamp((9*w + 63) >> 7); + @ Q2 = s2u(QS2 - a); + @ P2 = s2u(PS2 + a); + vmov.i16 q9, #63 + vshll.s8 q14, d20, #3 + vshll.s8 q15, d21, #3 + vaddw.s8 q14, q14, d20 + vaddw.s8 q15, q15, d21 + vadd.s16 q8, q9, q14 + vadd.s16 q9, q9, q15 @ 9*w + 63 + vadd.s16 q11, q8, q14 + vadd.s16 q12, q9, q15 @ 18*w + 63 + vadd.s16 q14, q11, q14 + vadd.s16 q15, q12, q15 @ 27*w + 63 + vqshrn.s16 d16, q8, #7 + vqshrn.s16 d17, q9, #7 @ clamp(( 9*w + 63)>>7) + vqshrn.s16 d22, q11, #7 + vqshrn.s16 d23, q12, #7 @ clamp((18*w + 63)>>7) + vqshrn.s16 d28, q14, #7 + vqshrn.s16 d29, q15, #7 @ clamp((27*w + 63)>>7) + vqadd.s8 q1, q1, q8 @ PS2 = clamp(PS2+a) + vqsub.s8 q6, q6, q8 @ QS2 = clamp(QS2-a) + vqadd.s8 q2, q2, q11 @ PS1 = clamp(PS1+a) + vqsub.s8 q5, q5, q11 @ QS1 = clamp(QS1-a) + vqadd.s8 q3, q3, q14 @ PS0 = clamp(PS0+a) + vqsub.s8 q4, q4, q14 @ QS0 = clamp(QS0-a) + veor q3, q3, q13 @ P0 = PS0 ^ 0x80 + veor q4, q4, q13 @ Q0 = QS0 ^ 0x80 + veor q2, q2, q13 @ P1 = PS1 ^ 0x80 + veor q5, q5, q13 @ Q1 = QS1 ^ 0x80 + veor q1, q1, q13 @ P2 = PS2 ^ 0x80 + veor q6, q6, q13 @ Q2 = QS2 ^ 0x80 + .endif +.endm + +.macro transpose8x16matrix + vtrn.32 q0, q4 + vtrn.32 q1, q5 + vtrn.32 q2, q6 + vtrn.32 q3, q7 + + vtrn.16 q0, q2 + vtrn.16 q1, q3 + vtrn.16 q4, q6 + vtrn.16 q5, q7 + + vtrn.8 q0, q1 + vtrn.8 q2, q3 + vtrn.8 q4, q5 + vtrn.8 q6, q7 +.endm + +.macro vp8_v_loop_filter16 name, inner=0, simple=0 +function ff_vp8_v_loop_filter16\name\()_neon, export=1 + vpush {q4-q7} + sub r0, r0, r1, lsl #1+!\simple + + @ Load pixels: + .if !\simple + ldr r12, [sp, #64] @ hev_thresh + vld1.8 {q0}, [r0,:128], r1 @ P3 + vld1.8 {q1}, [r0,:128], r1 @ P2 + .endif + vld1.8 {q2}, [r0,:128], r1 @ P1 + vld1.8 {q3}, [r0,:128], r1 @ P0 + vld1.8 {q4}, [r0,:128], r1 @ Q0 + vld1.8 {q5}, [r0,:128], r1 @ Q1 + .if !\simple + vld1.8 {q6}, [r0,:128], r1 @ Q2 + vld1.8 {q7}, [r0,:128] @ Q3 + vdup.8 q15, r3 @ flim_I + .endif + vdup.8 q14, r2 @ flim_E + + vp8_loop_filter inner=\inner, simple=\simple + + @ back up to P2: dst -= stride * 6 + sub r0, r0, r1, lsl #2 + .if !\simple + sub r0, r0, r1, lsl #1 + + @ Store pixels: + vst1.8 {q1}, [r0,:128], r1 @ P2 + .endif + vst1.8 {q2}, [r0,:128], r1 @ P1 + vst1.8 {q3}, [r0,:128], r1 @ P0 + vst1.8 {q4}, [r0,:128], r1 @ Q0 + vst1.8 {q5}, [r0,:128], r1 @ Q1 + .if !\simple + vst1.8 {q6}, [r0,:128] @ Q2 + .endif + + vpop {q4-q7} + bx lr +endfunc +.endm + +vp8_v_loop_filter16 +vp8_v_loop_filter16 _inner, inner=1 +vp8_v_loop_filter16 _simple, simple=1 + +.macro vp8_v_loop_filter8uv name, inner=0 +function ff_vp8_v_loop_filter8uv\name\()_neon, export=1 + vpush {q4-q7} + sub r0, r0, r2, lsl #2 + sub r1, r1, r2, lsl #2 + ldr r12, [sp, #64] @ flim_I + + @ Load pixels: + vld1.8 {d0}, [r0,:64], r2 @ P3 + vld1.8 {d1}, [r1,:64], r2 @ P3 + vld1.8 {d2}, [r0,:64], r2 @ P2 + vld1.8 {d3}, [r1,:64], r2 @ P2 + vld1.8 {d4}, [r0,:64], r2 @ P1 + vld1.8 {d5}, [r1,:64], r2 @ P1 + vld1.8 {d6}, [r0,:64], r2 @ P0 + vld1.8 {d7}, [r1,:64], r2 @ P0 + vld1.8 {d8}, [r0,:64], r2 @ Q0 + vld1.8 {d9}, [r1,:64], r2 @ Q0 + vld1.8 {d10}, [r0,:64], r2 @ Q1 + vld1.8 {d11}, [r1,:64], r2 @ Q1 + vld1.8 {d12}, [r0,:64], r2 @ Q2 + vld1.8 {d13}, [r1,:64], r2 @ Q2 + vld1.8 {d14}, [r0,:64] @ Q3 + vld1.8 {d15}, [r1,:64] @ Q3 + + vdup.8 q14, r3 @ flim_E + vdup.8 q15, r12 @ flim_I + ldr r12, [sp, #68] @ hev_thresh + + vp8_loop_filter inner=\inner + + @ back up to P2: u,v -= stride * 6 + sub r0, r0, r2, lsl #2 + sub r1, r1, r2, lsl #2 + sub r0, r0, r2, lsl #1 + sub r1, r1, r2, lsl #1 + + @ Store pixels: + vst1.8 {d2}, [r0,:64], r2 @ P2 + vst1.8 {d3}, [r1,:64], r2 @ P2 + vst1.8 {d4}, [r0,:64], r2 @ P1 + vst1.8 {d5}, [r1,:64], r2 @ P1 + vst1.8 {d6}, [r0,:64], r2 @ P0 + vst1.8 {d7}, [r1,:64], r2 @ P0 + vst1.8 {d8}, [r0,:64], r2 @ Q0 + vst1.8 {d9}, [r1,:64], r2 @ Q0 + vst1.8 {d10}, [r0,:64], r2 @ Q1 + vst1.8 {d11}, [r1,:64], r2 @ Q1 + vst1.8 {d12}, [r0,:64] @ Q2 + vst1.8 {d13}, [r1,:64] @ Q2 + + vpop {q4-q7} + bx lr +endfunc +.endm + +vp8_v_loop_filter8uv +vp8_v_loop_filter8uv _inner, inner=1 + +.macro vp8_h_loop_filter16 name, inner=0, simple=0 +function ff_vp8_h_loop_filter16\name\()_neon, export=1 + vpush {q4-q7} + sub r0, r0, #4 + .if !\simple + ldr r12, [sp, #64] @ hev_thresh + .endif + + @ Load pixels: + vld1.8 {d0}, [r0], r1 @ load first 8-line src data + vld1.8 {d2}, [r0], r1 + vld1.8 {d4}, [r0], r1 + vld1.8 {d6}, [r0], r1 + vld1.8 {d8}, [r0], r1 + vld1.8 {d10}, [r0], r1 + vld1.8 {d12}, [r0], r1 + vld1.8 {d14}, [r0], r1 + vld1.8 {d1}, [r0], r1 @ load second 8-line src data + vld1.8 {d3}, [r0], r1 + vld1.8 {d5}, [r0], r1 + vld1.8 {d7}, [r0], r1 + vld1.8 {d9}, [r0], r1 + vld1.8 {d11}, [r0], r1 + vld1.8 {d13}, [r0], r1 + vld1.8 {d15}, [r0], r1 + + transpose8x16matrix + + vdup.8 q14, r2 @ flim_E + .if !\simple + vdup.8 q15, r3 @ flim_I + .endif + + vp8_loop_filter inner=\inner, simple=\simple + + sub r0, r0, r1, lsl #4 @ backup 16 rows + + transpose8x16matrix + + @ Store pixels: + vst1.8 {d0}, [r0], r1 + vst1.8 {d2}, [r0], r1 + vst1.8 {d4}, [r0], r1 + vst1.8 {d6}, [r0], r1 + vst1.8 {d8}, [r0], r1 + vst1.8 {d10}, [r0], r1 + vst1.8 {d12}, [r0], r1 + vst1.8 {d14}, [r0], r1 + vst1.8 {d1}, [r0], r1 + vst1.8 {d3}, [r0], r1 + vst1.8 {d5}, [r0], r1 + vst1.8 {d7}, [r0], r1 + vst1.8 {d9}, [r0], r1 + vst1.8 {d11}, [r0], r1 + vst1.8 {d13}, [r0], r1 + vst1.8 {d15}, [r0] + + vpop {q4-q7} + bx lr +endfunc +.endm + +vp8_h_loop_filter16 +vp8_h_loop_filter16 _inner, inner=1 +vp8_h_loop_filter16 _simple, simple=1 + +.macro vp8_h_loop_filter8uv name, inner=0 +function ff_vp8_h_loop_filter8uv\name\()_neon, export=1 + vpush {q4-q7} + sub r0, r0, #4 + sub r1, r1, #4 + ldr r12, [sp, #64] @ flim_I + + @ Load pixels: + vld1.8 {d0}, [r0], r2 @ load u + vld1.8 {d1}, [r1], r2 @ load v + vld1.8 {d2}, [r0], r2 + vld1.8 {d3}, [r1], r2 + vld1.8 {d4}, [r0], r2 + vld1.8 {d5}, [r1], r2 + vld1.8 {d6}, [r0], r2 + vld1.8 {d7}, [r1], r2 + vld1.8 {d8}, [r0], r2 + vld1.8 {d9}, [r1], r2 + vld1.8 {d10}, [r0], r2 + vld1.8 {d11}, [r1], r2 + vld1.8 {d12}, [r0], r2 + vld1.8 {d13}, [r1], r2 + vld1.8 {d14}, [r0], r2 + vld1.8 {d15}, [r1], r2 + + transpose8x16matrix + + vdup.8 q14, r3 @ flim_E + vdup.8 q15, r12 @ flim_I + ldr r12, [sp, #68] @ hev_thresh + + vp8_loop_filter inner=\inner + + sub r0, r0, r2, lsl #3 @ backup u 8 rows + sub r1, r1, r2, lsl #3 @ backup v 8 rows + + transpose8x16matrix + + @ Store pixels: + vst1.8 {d0}, [r0], r2 + vst1.8 {d1}, [r1], r2 + vst1.8 {d2}, [r0], r2 + vst1.8 {d3}, [r1], r2 + vst1.8 {d4}, [r0], r2 + vst1.8 {d5}, [r1], r2 + vst1.8 {d6}, [r0], r2 + vst1.8 {d7}, [r1], r2 + vst1.8 {d8}, [r0], r2 + vst1.8 {d9}, [r1], r2 + vst1.8 {d10}, [r0], r2 + vst1.8 {d11}, [r1], r2 + vst1.8 {d12}, [r0], r2 + vst1.8 {d13}, [r1], r2 + vst1.8 {d14}, [r0] + vst1.8 {d15}, [r1] + + vpop {q4-q7} + bx lr +endfunc +.endm + +vp8_h_loop_filter8uv +vp8_h_loop_filter8uv _inner, inner=1 + +function ff_put_vp8_pixels16_neon, export=1 + ldr r12, [sp, #0] @ h +1: + subs r12, r12, #4 + vld1.8 {q0}, [r2], r3 + vld1.8 {q1}, [r2], r3 + vld1.8 {q2}, [r2], r3 + vld1.8 {q3}, [r2], r3 + vst1.8 {q0}, [r0,:128], r1 + vst1.8 {q1}, [r0,:128], r1 + vst1.8 {q2}, [r0,:128], r1 + vst1.8 {q3}, [r0,:128], r1 + bgt 1b + bx lr +endfunc + +function ff_put_vp8_pixels8_neon, export=1 + ldr r12, [sp, #0] @ h +1: + subs r12, r12, #4 + vld1.8 {d0}, [r2], r3 + vld1.8 {d1}, [r2], r3 + vld1.8 {d2}, [r2], r3 + vld1.8 {d3}, [r2], r3 + vst1.8 {d0}, [r0,:64], r1 + vst1.8 {d1}, [r0,:64], r1 + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + bgt 1b + bx lr +endfunc + +function ff_put_vp8_pixels4_neon, export=1 + ldr r12, [sp, #0] @ h + push {r4-r6,lr} +1: + subs r12, r12, #4 + ldr r4, [r2], r3 + ldr r5, [r2], r3 + ldr r6, [r2], r3 + ldr lr, [r2], r3 + str r4, [r0], r1 + str r5, [r0], r1 + str r6, [r0], r1 + str lr, [r0], r1 + bgt 1b + pop {r4-r6,pc} +endfunc + +/* 4/6-tap 8th-pel MC */ + +.macro vp8_epel8_h6 d, a, b + vext.8 d27, \a, \b, #1 + vmovl.u8 q8, \a + vext.8 d28, \a, \b, #2 + vmovl.u8 q9, d27 + vext.8 d29, \a, \b, #3 + vmovl.u8 q10, d28 + vext.8 d30, \a, \b, #4 + vmovl.u8 q11, d29 + vext.8 d31, \a, \b, #5 + vmovl.u8 q12, d30 + vmul.u16 q10, q10, d0[2] + vmovl.u8 q13, d31 + vmul.u16 q11, q11, d0[3] + vmls.u16 q10, q9, d0[1] + vmls.u16 q11, q12, d1[0] + vmla.u16 q10, q8, d0[0] + vmla.u16 q11, q13, d1[1] + vqadd.s16 q11, q10, q11 + vqrshrun.s16 \d, q11, #7 +.endm + +.macro vp8_epel16_h6 d0, d1, s0, s1, s2, q0, q1 + vext.8 q14, \q0, \q1, #3 + vext.8 q15, \q0, \q1, #4 + vmovl.u8 q11, d28 + vmovl.u8 q14, d29 + vext.8 q3, \q0, \q1, #2 + vmovl.u8 q12, d30 + vmovl.u8 q15, d31 + vext.8 q8, \q0, \q1, #1 + vmovl.u8 q10, d6 + vmovl.u8 q3, d7 + vext.8 q2, \q0, \q1, #5 + vmovl.u8 q13, d4 + vmovl.u8 q2, d5 + vmovl.u8 q9, d16 + vmovl.u8 q8, d17 + vmul.u16 q11, q11, d0[3] + vmul.u16 q10, q10, d0[2] + vmul.u16 q3, q3, d0[2] + vmul.u16 q14, q14, d0[3] + vmls.u16 q11, q12, d1[0] + vmovl.u8 q12, \s0 + vmovl.u8 q1, \s1 + vmls.u16 q10, q9, d0[1] + vmls.u16 q3, q8, d0[1] + vmls.u16 q14, q15, d1[0] + vmla.u16 q10, q12, d0[0] + vmla.u16 q11, q13, d1[1] + vmla.u16 q3, q1, d0[0] + vmla.u16 q14, q2, d1[1] + vqadd.s16 q11, q10, q11 + vqadd.s16 q14, q3, q14 + vqrshrun.s16 \d0, q11, #7 + vqrshrun.s16 \d1, q14, #7 +.endm + +.macro vp8_epel8_v6 d0, s0, s1, s2, s3, s4, s5 + vmovl.u8 q10, \s2 + vmovl.u8 q11, \s3 + vmovl.u8 q9, \s1 + vmovl.u8 q12, \s4 + vmovl.u8 q8, \s0 + vmovl.u8 q13, \s5 + vmul.u16 q10, q10, d0[2] + vmul.u16 q11, q11, d0[3] + vmls.u16 q10, q9, d0[1] + vmls.u16 q11, q12, d1[0] + vmla.u16 q10, q8, d0[0] + vmla.u16 q11, q13, d1[1] + vqadd.s16 q11, q10, q11 + vqrshrun.s16 \d0, q11, #7 +.endm + +.macro vp8_epel8_v6_y2 d0, d1, s0, s1, s2, s3, s4, s5, s6 + vmovl.u8 q10, \s0 + vmovl.u8 q11, \s3 + vmovl.u8 q14, \s6 + vmovl.u8 q9, \s1 + vmovl.u8 q12, \s4 + vmovl.u8 q8, \s2 + vmovl.u8 q13, \s5 + vmul.u16 q10, q10, d0[0] + vmul.u16 q15, q11, d0[3] + vmul.u16 q11, q11, d0[2] + vmul.u16 q14, q14, d1[1] + vmls.u16 q10, q9, d0[1] + vmls.u16 q15, q12, d1[0] + vmls.u16 q11, q8, d0[1] + vmls.u16 q14, q13, d1[0] + vmla.u16 q10, q8, d0[2] + vmla.u16 q15, q13, d1[1] + vmla.u16 q11, q9, d0[0] + vmla.u16 q14, q12, d0[3] + vqadd.s16 q15, q10, q15 + vqadd.s16 q14, q11, q14 + vqrshrun.s16 \d0, q15, #7 + vqrshrun.s16 \d1, q14, #7 +.endm + +.macro vp8_epel8_h4 d, a, b + vext.8 d28, \a, \b, #1 + vmovl.u8 q9, \a + vext.8 d29, \a, \b, #2 + vmovl.u8 q10, d28 + vext.8 d30, \a, \b, #3 + vmovl.u8 q11, d29 + vmovl.u8 q12, d30 + vmul.u16 q10, q10, d0[2] + vmul.u16 q11, q11, d0[3] + vmls.u16 q10, q9, d0[1] + vmls.u16 q11, q12, d1[0] + vqadd.s16 q11, q10, q11 + vqrshrun.s16 \d, q11, #7 +.endm + +.macro vp8_epel8_v4_y2 d0, d1, s0, s1, s2, s3, s4 + vmovl.u8 q9, \s0 + vmovl.u8 q10, \s1 + vmovl.u8 q11, \s2 + vmovl.u8 q12, \s3 + vmovl.u8 q13, \s4 + vmul.u16 q8, q10, d0[2] + vmul.u16 q14, q11, d0[3] + vmul.u16 q11, q11, d0[2] + vmul.u16 q15, q12, d0[3] + vmls.u16 q8, q9, d0[1] + vmls.u16 q14, q12, d1[0] + vmls.u16 q11, q10, d0[1] + vmls.u16 q15, q13, d1[0] + vqadd.s16 q8, q8, q14 + vqadd.s16 q11, q11, q15 + vqrshrun.s16 \d0, q8, #7 + vqrshrun.s16 \d1, q11, #7 +.endm + +function ff_put_vp8_epel16_v6_neon, export=1 + sub r2, r2, r3, lsl #1 + push {r4,lr} + vpush {d8-d15} + + ldr r4, [sp, #80] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #72] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2-d3}, [r2], r3 + vld1.8 {d4-d5}, [r2], r3 + vld1.8 {d6-d7}, [r2], r3 + vld1.8 {d8-d9}, [r2], r3 + vld1.8 {d10-d11},[r2], r3 + vld1.8 {d12-d13},[r2], r3 + vld1.8 {d14-d15},[r2] + sub r2, r2, r3, lsl #2 + + vp8_epel8_v6_y2 d2, d4, d2, d4, d6, d8, d10, d12, d14 + vp8_epel8_v6_y2 d3, d5, d3, d5, d7, d9, d11, d13, d15 + + vst1.8 {d2-d3}, [r0,:128], r1 + vst1.8 {d4-d5}, [r0,:128], r1 + subs r12, r12, #2 + bne 1b + + vpop {d8-d15} + pop {r4,pc} +endfunc + +function ff_put_vp8_epel16_h6_neon, export=1 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2-d4}, [r2], r3 + + vp8_epel16_h6 d2, d3, d2, d3, d4, q1, q2 + + vst1.8 {d2-d3}, [r0,:128], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel16_h6v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #2 + push {r4,lr} + vpush {d8-d9} + + @ first pass (horizontal): + ldr r4, [sp, #28] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #24] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #336+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {d2,d3,d4}, [r2], r3 + + vp8_epel16_h6 d2, d3, d2, d3, d4, q1, q2 + + vst1.8 {d2-d3}, [lr,:128]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #336+16+32] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #336+16+24] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6-d9}, [lr,:128]! + vld1.8 {d28-d31},[lr,:128] + sub lr, lr, #48 + + vp8_epel8_v6 d2, d2, d4, d6, d8, d28, d30 + vp8_epel8_v6 d3, d3, d5, d7, d9, d29, d31 + + vst1.8 {d2-d3}, [r0,:128], r1 + subs r12, r12, #1 + bne 2b + + add sp, sp, #336+16 + vpop {d8-d9} + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_v6_neon, export=1 + sub r2, r2, r3, lsl #1 + push {r4,lr} + + ldr r4, [sp, #16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2}, [r2], r3 + vld1.8 {d3}, [r2], r3 + vld1.8 {d4}, [r2], r3 + vld1.8 {d5}, [r2], r3 + vld1.8 {d6}, [r2], r3 + vld1.8 {d7}, [r2], r3 + vld1.8 {d28}, [r2] + + sub r2, r2, r3, lsl #2 + + vp8_epel8_v6_y2 d2, d3, d2, d3, d4, d5, d6, d7, d28 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h6_neon, export=1 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h6 d2, d2, d3 + + vst1.8 {d2}, [r0,:64], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h6v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #2 + push {r4,lr} + + @ first pass (horizontal): + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #168+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h6 d2, d2, d3 + + vst1.8 {d2}, [lr,:64]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #168+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #168+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6-d7}, [lr,:128]! + vld1.8 {d30}, [lr,:64] + sub lr, lr, #32 + + vp8_epel8_v6_y2 d2, d3, d2, d3, d4, d5, d6, d7, d30 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 2b + + add sp, sp, #168+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_v4_neon, export=1 + sub r2, r2, r3 + push {r4,lr} + + ldr r4, [sp, #16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2}, [r2], r3 + vld1.8 {d3}, [r2], r3 + vld1.8 {d4}, [r2], r3 + vld1.8 {d5}, [r2], r3 + vld1.8 {d6}, [r2] + sub r2, r2, r3, lsl #1 + + vp8_epel8_v4_y2 d2, d3, d2, d3, d4, d5, d6 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h4_neon, export=1 + sub r2, r2, #1 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h4 d2, d2, d3 + + vst1.8 {d2}, [r0,:64], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h4v4_neon, export=1 + sub r2, r2, r3 + sub r2, r2, #1 + push {r4,lr} + + @ first pass (horizontal): + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #168+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #3 + bic lr, lr, #15 +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h4 d2, d2, d3 + + vst1.8 {d2}, [lr,:64]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #168+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #168+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6}, [lr,:64] + sub lr, lr, #16 + + vp8_epel8_v4_y2 d2, d3, d2, d3, d4, d5, d6 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 2b + + add sp, sp, #168+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h6v4_neon, export=1 + sub r2, r2, r3 + sub r2, r2, #2 + push {r4,lr} + + @ first pass (horizontal): + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #168+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #3 + bic lr, lr, #15 +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h6 d2, d2, d3 + + vst1.8 {d2}, [lr,:64]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #168+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #168+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6}, [lr,:64] + sub lr, lr, #16 + + vp8_epel8_v4_y2 d2, d3, d2, d3, d4, d5, d6 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 2b + + add sp, sp, #168+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h4v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #1 + push {r4,lr} + + @ first pass (horizontal): + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #168+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h4 d2, d2, d3 + + vst1.8 {d2}, [lr,:64]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #168+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #168+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6-d7}, [lr,:128]! + vld1.8 {d30}, [lr,:64] + sub lr, lr, #32 + + vp8_epel8_v6_y2 d2, d3, d2, d3, d4, d5, d6, d7, d30 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 2b + + add sp, sp, #168+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_v6_neon, export=1 + sub r2, r2, r3, lsl #1 + push {r4,lr} + + ldr r4, [sp, #16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.32 {d2[]}, [r2], r3 + vld1.32 {d3[]}, [r2], r3 + vld1.32 {d4[]}, [r2], r3 + vld1.32 {d5[]}, [r2], r3 + vld1.32 {d6[]}, [r2], r3 + vld1.32 {d7[]}, [r2], r3 + vld1.32 {d28[]}, [r2] + sub r2, r2, r3, lsl #2 + vld1.32 {d2[1]}, [r2], r3 + vld1.32 {d3[1]}, [r2], r3 + vld1.32 {d4[1]}, [r2], r3 + vld1.32 {d5[1]}, [r2], r3 + vld1.32 {d6[1]}, [r2], r3 + vld1.32 {d7[1]}, [r2], r3 + vld1.32 {d28[1]}, [r2] + sub r2, r2, r3, lsl #2 + + vp8_epel8_v6_y2 d2, d3, d2, d3, d4, d5, d6, d7, d28 + + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h6_neon, export=1 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {q1}, [r2], r3 + vp8_epel8_h6 d2, d2, d3 + vst1.32 {d2[0]}, [r0,:32], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h6v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #52+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {q1}, [r2], r3 + vp8_epel8_h6 d2, d2, d3 + vst1.32 {d2[0]}, [lr,:32]! + subs r12, r12, #1 + bne 1b + + ldr r4, [sp, #52+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #52+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d3}, [lr,:128]! + vld1.8 {d6}, [lr,:64]! + vld1.32 {d28[]}, [lr,:32] + sub lr, lr, #16 + vld1.8 {d4-d5}, [lr]! + vld1.8 {d7}, [lr,:64]! + vld1.32 {d28[1]}, [lr,:32] + sub lr, lr, #16 + vtrn.32 q1, q2 + vtrn.32 d6, d7 + vp8_epel8_v6_y2 d2, d3, d2, d4, d3, d5, d6, d7, d28 + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 2b + + add sp, sp, #52+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h4v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #1 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #52+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {d2}, [r2], r3 + vp8_epel8_h4 d2, d2, d2 + vst1.32 {d2[0]}, [lr,:32]! + subs r12, r12, #1 + bne 1b + + ldr r4, [sp, #52+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #52+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d3}, [lr,:128]! + vld1.8 {d6}, [lr,:64]! + vld1.32 {d28[]}, [lr,:32] + sub lr, lr, #16 + vld1.8 {d4-d5}, [lr]! + vld1.8 {d7}, [lr,:64]! + vld1.32 {d28[1]}, [lr,:32] + sub lr, lr, #16 + vtrn.32 q1, q2 + vtrn.32 d6, d7 + vp8_epel8_v6_y2 d2, d3, d2, d4, d3, d5, d6, d7, d28 + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 2b + + add sp, sp, #52+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h6v4_neon, export=1 + sub r2, r2, r3 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #44+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #3 + bic lr, lr, #15 +1: + vld1.8 {q1}, [r2], r3 + vp8_epel8_h6 d2, d2, d3 + vst1.32 {d2[0]}, [lr,:32]! + subs r12, r12, #1 + bne 1b + + ldr r4, [sp, #44+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #44+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d3}, [lr,:128]! + vld1.32 {d6[]}, [lr,:32] + sub lr, lr, #8 + vld1.8 {d4-d5}, [lr]! + vld1.32 {d6[1]}, [lr,:32] + sub lr, lr, #8 + vtrn.32 q1, q2 + vp8_epel8_v4_y2 d2, d3, d2, d4, d3, d5, d6 + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 2b + + add sp, sp, #44+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h4_neon, export=1 + sub r2, r2, #1 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2}, [r2], r3 + vp8_epel8_h4 d2, d2, d2 + vst1.32 {d2[0]}, [r0,:32], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_v4_neon, export=1 + sub r2, r2, r3 + push {r4,lr} + + ldr r4, [sp, #16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.32 {d2[]}, [r2], r3 + vld1.32 {d3[]}, [r2], r3 + vld1.32 {d4[]}, [r2], r3 + vld1.32 {d5[]}, [r2], r3 + vld1.32 {d6[]}, [r2] + sub r2, r2, r3, lsl #1 + vld1.32 {d2[1]}, [r2], r3 + vld1.32 {d3[1]}, [r2], r3 + vld1.32 {d4[1]}, [r2], r3 + vld1.32 {d5[1]}, [r2], r3 + vld1.32 {d6[1]}, [r2] + sub r2, r2, r3, lsl #1 + + vp8_epel8_v4_y2 d2, d3, d2, d3, d4, d5, d6 + + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h4v4_neon, export=1 + sub r2, r2, r3 + sub r2, r2, #1 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #44+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #3 + bic lr, lr, #15 +1: + vld1.8 {d2}, [r2], r3 + vp8_epel8_h4 d2, d2, d3 + vst1.32 {d2[0]}, [lr,:32]! + subs r12, r12, #1 + bne 1b + + ldr r4, [sp, #44+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #44+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d3}, [lr,:128]! + vld1.32 {d6[]}, [lr,:32] + sub lr, lr, #8 + vld1.8 {d4-d5}, [lr]! + vld1.32 {d6[1]}, [lr,:32] + sub lr, lr, #8 + vtrn.32 q1, q2 + vp8_epel8_v4_y2 d2, d3, d2, d4, d3, d5, d6 + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 2b + + add sp, sp, #44+16 + pop {r4,pc} +endfunc + +@ note: worst case sum of all 6-tap filter values * 255 is 0x7f80 so 16 bit +@ arithmatic can be used to apply filters +const subpel_filters, align=4 + .short 0, 6, 123, 12, 1, 0, 0, 0 + .short 2, 11, 108, 36, 8, 1, 0, 0 + .short 0, 9, 93, 50, 6, 0, 0, 0 + .short 3, 16, 77, 77, 16, 3, 0, 0 + .short 0, 6, 50, 93, 9, 0, 0, 0 + .short 1, 8, 36, 108, 11, 2, 0, 0 + .short 0, 1, 12, 123, 6, 0, 0, 0 +endconst + +/* Bilinear MC */ + +function ff_put_vp8_bilin16_h_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h +1: + subs r12, r12, #2 + vld1.8 {d2-d4}, [r2], r1 + vext.8 q2, q1, q2, #1 + vmull.u8 q8, d2, d1 + vmlal.u8 q8, d4, d0 + vld1.8 {d18-d20},[r2], r1 + vmull.u8 q3, d3, d1 + vmlal.u8 q3, d5, d0 + vext.8 q10, q9, q10, #1 + vmull.u8 q11, d18, d1 + vmlal.u8 q11, d20, d0 + vmull.u8 q12, d19, d1 + vmlal.u8 q12, d21, d0 + vrshrn.u16 d4, q8, #3 + vrshrn.u16 d5, q3, #3 + vrshrn.u16 d6, q11, #3 + vrshrn.u16 d7, q12, #3 + vst1.8 {q2}, [r0,:128], r1 + vst1.8 {q3}, [r0,:128], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin16_v_neon, export=1 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h + vld1.8 {q1}, [r2], r1 +1: + subs r12, r12, #2 + vld1.8 {q2}, [r2], r1 + vmull.u8 q3, d2, d1 + vmlal.u8 q3, d4, d0 + vmull.u8 q8, d3, d1 + vmlal.u8 q8, d5, d0 + vld1.8 {q1}, [r2], r1 + vmull.u8 q9, d4, d1 + vmlal.u8 q9, d2, d0 + vmull.u8 q10, d5, d1 + vmlal.u8 q10, d3, d0 + vrshrn.u16 d4, q3, #3 + vrshrn.u16 d5, q8, #3 + vrshrn.u16 d6, q9, #3 + vrshrn.u16 d7, q10, #3 + vst1.8 {q2}, [r0,:128], r1 + vst1.8 {q3}, [r0,:128], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin16_hv_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d2, r3 + vdup.8 d3, r12 + ldr r12, [sp] @ h + + vld1.8 {d4-d6}, [r2], r1 + vext.8 q3, q2, q3, #1 + vmull.u8 q8, d4, d1 + vmlal.u8 q8, d6, d0 + vmull.u8 q9, d5, d1 + vmlal.u8 q9, d7, d0 + vrshrn.u16 d4, q8, #3 + vrshrn.u16 d5, q9, #3 +1: + subs r12, r12, #2 + vld1.8 {d18-d20},[r2], r1 + vext.8 q10, q9, q10, #1 + vmull.u8 q11, d18, d1 + vmlal.u8 q11, d20, d0 + vld1.8 {d26-d28},[r2], r1 + vmull.u8 q12, d19, d1 + vmlal.u8 q12, d21, d0 + vext.8 q14, q13, q14, #1 + vmull.u8 q8, d26, d1 + vmlal.u8 q8, d28, d0 + vmull.u8 q9, d27, d1 + vmlal.u8 q9, d29, d0 + vrshrn.u16 d6, q11, #3 + vrshrn.u16 d7, q12, #3 + vmull.u8 q12, d4, d3 + vmlal.u8 q12, d6, d2 + vmull.u8 q15, d5, d3 + vmlal.u8 q15, d7, d2 + vrshrn.u16 d4, q8, #3 + vrshrn.u16 d5, q9, #3 + vmull.u8 q10, d6, d3 + vmlal.u8 q10, d4, d2 + vmull.u8 q11, d7, d3 + vmlal.u8 q11, d5, d2 + vrshrn.u16 d24, q12, #3 + vrshrn.u16 d25, q15, #3 + vst1.8 {q12}, [r0,:128], r1 + vrshrn.u16 d20, q10, #3 + vrshrn.u16 d21, q11, #3 + vst1.8 {q10}, [r0,:128], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin8_h_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h +1: + subs r12, r12, #2 + vld1.8 {q1}, [r2], r1 + vext.8 d3, d2, d3, #1 + vmull.u8 q2, d2, d1 + vmlal.u8 q2, d3, d0 + vld1.8 {q3}, [r2], r1 + vext.8 d7, d6, d7, #1 + vmull.u8 q8, d6, d1 + vmlal.u8 q8, d7, d0 + vrshrn.u16 d4, q2, #3 + vrshrn.u16 d16, q8, #3 + vst1.8 {d4}, [r0,:64], r1 + vst1.8 {d16}, [r0,:64], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin8_v_neon, export=1 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h + vld1.8 {d2}, [r2], r1 +1: + subs r12, r12, #2 + vld1.8 {d3}, [r2], r1 + vmull.u8 q2, d2, d1 + vmlal.u8 q2, d3, d0 + vld1.8 {d2}, [r2], r1 + vmull.u8 q3, d3, d1 + vmlal.u8 q3, d2, d0 + vrshrn.u16 d4, q2, #3 + vrshrn.u16 d6, q3, #3 + vst1.8 {d4}, [r0,:64], r1 + vst1.8 {d6}, [r0,:64], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin8_hv_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d2, r3 + vdup.8 d3, r12 + ldr r12, [sp] @ h + + vld1.8 {q2}, [r2], r1 + vext.8 d5, d4, d5, #1 + vmull.u8 q9, d4, d1 + vmlal.u8 q9, d5, d0 + vrshrn.u16 d22, q9, #3 +1: + subs r12, r12, #2 + vld1.8 {q3}, [r2], r1 + vext.8 d7, d6, d7, #1 + vmull.u8 q8, d6, d1 + vmlal.u8 q8, d7, d0 + vld1.8 {q2}, [r2], r1 + vext.8 d5, d4, d5, #1 + vmull.u8 q9, d4, d1 + vmlal.u8 q9, d5, d0 + vrshrn.u16 d16, q8, #3 + vmull.u8 q10, d22, d3 + vmlal.u8 q10, d16, d2 + vrshrn.u16 d22, q9, #3 + vmull.u8 q12, d16, d3 + vmlal.u8 q12, d22, d2 + vrshrn.u16 d20, q10, #3 + vst1.8 {d20}, [r0,:64], r1 + vrshrn.u16 d23, q12, #3 + vst1.8 {d23}, [r0,:64], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin4_h_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h +1: + subs r12, r12, #2 + vld1.8 {d2}, [r2], r1 + vext.8 d3, d2, d3, #1 + vld1.8 {d6}, [r2], r1 + vext.8 d7, d6, d7, #1 + vtrn.32 q1, q3 + vmull.u8 q2, d2, d1 + vmlal.u8 q2, d3, d0 + vrshrn.u16 d4, q2, #3 + vst1.32 {d4[0]}, [r0,:32], r1 + vst1.32 {d4[1]}, [r0,:32], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin4_v_neon, export=1 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h + vld1.32 {d2[]}, [r2], r1 +1: + vld1.32 {d3[]}, [r2] + vld1.32 {d2[1]}, [r2], r1 + vld1.32 {d3[1]}, [r2], r1 + vmull.u8 q2, d2, d1 + vmlal.u8 q2, d3, d0 + vtrn.32 d3, d2 + vrshrn.u16 d4, q2, #3 + vst1.32 {d4[0]}, [r0,:32], r1 + vst1.32 {d4[1]}, [r0,:32], r1 + subs r12, r12, #2 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin4_hv_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d2, r3 + vdup.8 d3, r12 + ldr r12, [sp] @ h + + vld1.8 {d4}, [r2], r1 + vext.8 d5, d4, d4, #1 + vmull.u8 q9, d4, d1 + vmlal.u8 q9, d5, d0 + vrshrn.u16 d22, q9, #3 +1: + subs r12, r12, #2 + vld1.8 {d6}, [r2], r1 + vext.8 d7, d6, d6, #1 + vld1.8 {d4}, [r2], r1 + vext.8 d5, d4, d4, #1 + vtrn.32 q3, q2 + vmull.u8 q8, d6, d1 + vmlal.u8 q8, d7, d0 + vrshrn.u16 d16, q8, #3 + vmull.u8 q10, d16, d2 + vtrn.32 d22, d16 + vmlal.u8 q10, d22, d3 + vrev64.32 d22, d16 + vrshrn.u16 d20, q10, #3 + vst1.32 {d20[0]}, [r0,:32], r1 + vst1.32 {d20[1]}, [r0,:32], r1 + bgt 1b + + bx lr +endfunc diff --git a/libavcodec/vp8dsp.c b/libavcodec/vp8dsp.c index 30699cecbe..4391a7ebc7 100644 --- a/libavcodec/vp8dsp.c +++ b/libavcodec/vp8dsp.c @@ -523,4 +523,6 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) ff_vp8dsp_init_x86(dsp); if (HAVE_ALTIVEC) ff_vp8dsp_init_altivec(dsp); + if (ARCH_ARM) + ff_vp8dsp_init_arm(dsp); } diff --git a/libavcodec/vp8dsp.h b/libavcodec/vp8dsp.h index ee5c7ec0fb..e8757ab7d0 100644 --- a/libavcodec/vp8dsp.h +++ b/libavcodec/vp8dsp.h @@ -79,5 +79,6 @@ void ff_put_vp8_pixels4_c(uint8_t *dst, uint8_t *src, int stride, int h, int x, void ff_vp8dsp_init(VP8DSPContext *c); void ff_vp8dsp_init_x86(VP8DSPContext *c); void ff_vp8dsp_init_altivec(VP8DSPContext *c); +void ff_vp8dsp_init_arm(VP8DSPContext *c); #endif /* AVCODEC_VP8DSP_H */ From f4acb837eb4af74996b678f3f55eaa66c47a66ee Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 31 Jan 2011 15:01:46 +0100 Subject: [PATCH 263/528] Document null muxer. Signed-off-by: Janne Grunau --- doc/muxers.texi | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/muxers.texi b/doc/muxers.texi index d98abefda3..d661c9694d 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -109,4 +109,26 @@ ffmpeg -i file.mpg -acodec copy -vcodec copy \ -y out.ts @end example +@section null + +Null muxer. + +This muxer does not generate any output file, it is mainly useful for +testing or benchmarking purposes. + +For example to benchmark decoding with @file{ffmpeg} you can use the +command: +@example +ffmpeg -benchmark -i INPUT -f null out.null +@end example + +Note that the above command does not read or write the @file{out.null} +file, but specifying the output file is required by the @file{ffmpeg} +syntax. + +Alternatively you can write the command as: +@example +ffmpeg -benchmark -i INPUT -f null - +@end example + @c man end MUXERS From a4effe432f4aa59d52465b88589f92addf3afd3e Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 31 Jan 2011 15:20:09 +0100 Subject: [PATCH 264/528] Add documentation for the crc muxer. Signed-off-by: Janne Grunau --- doc/muxers.texi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/doc/muxers.texi b/doc/muxers.texi index d661c9694d..63aa95c317 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -18,6 +18,38 @@ enabled muxers. A description of some of the currently available muxers follows. +@section crc + +CRC (Cyclic Redundancy Check) testing format. + +This muxer computes and prints the Adler-32 CRC of all the input audio +and video frames. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +CRC. + +The output of the muxer consists of a single line of the form: +CRC=0x@var{CRC}, where @var{CRC} is a hexadecimal number 0-padded to +8 digits containing the CRC for all the decoded input frames. + +For example to compute the CRC of the input, and store it in the file +@file{out.crc}: +@example +ffmpeg -i INPUT -f crc out.crc +@end example + +You can print the CRC to stdout with the command: +@example +ffmpeg -i INPUT -f crc - +@end example + +You can select the output format of each frame with @file{ffmpeg} by +specifying the audio and video codec and format. For example to +compute the CRC of the input audio converted to PCM unsigned 8-bit +and the input video converted to MPEG-2 video, use the command: +@example +ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f crc - +@end example + @section image2 Image file muxer. From 77d4ed7a127b88f9b8ddd741c65e678198feb285 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 1 Feb 2011 01:03:48 +0100 Subject: [PATCH 265/528] Add documentation for the framecrc muxer. Signed-off-by: Janne Grunau --- doc/muxers.texi | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/doc/muxers.texi b/doc/muxers.texi index 63aa95c317..9e824bf289 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -18,6 +18,7 @@ enabled muxers. A description of some of the currently available muxers follows. +@anchor{crc} @section crc CRC (Cyclic Redundancy Check) testing format. @@ -50,6 +51,45 @@ and the input video converted to MPEG-2 video, use the command: ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f crc - @end example +See also the @code{framecrc} muxer (@pxref{framecrc}). + +@anchor{framecrc} +@section framecrc + +Per-frame CRC (Cyclic Redundancy Check) testing format. + +This muxer computes and prints the Adler-32 CRC for each decoded audio +and video frame. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +CRC. + +The output of the muxer consists of a line for each audio and video +frame of the form: @var{stream_index}, @var{frame_dts}, +@var{frame_size}, 0x@var{CRC}, where @var{CRC} is a hexadecimal +number 0-padded to 8 digits containing the CRC of the decoded frame. + +For example to compute the CRC of each decoded frame in the input, and +store it in the file @file{out.crc}: +@example +ffmpeg -i INPUT -f framecrc out.crc +@end example + +You can print the CRC of each decoded frame to stdout with the command: +@example +ffmpeg -i INPUT -f framecrc - +@end example + +You can select the output format of each frame with @file{ffmpeg} by +specifying the audio and video codec and format. For example, to +compute the CRC of each decoded input audio frame converted to PCM +unsigned 8-bit and of each decoded input video frame converted to +MPEG-2 video, use the command: +@example +ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f framecrc - +@end example + +See also the @code{crc} muxer (@pxref{crc}). + @section image2 Image file muxer. From 0cad24ce9b02037c9cdad84cae905f96b04d7d4c Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 3 Feb 2011 00:49:07 +0100 Subject: [PATCH 266/528] Apply misc fixes to the image2 muxer documentation. The fixes were pointed out by Diego. Signed-off-by: Janne Grunau --- doc/muxers.texi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 9e824bf289..e7cfc4a9bc 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -94,12 +94,13 @@ See also the @code{crc} muxer (@pxref{crc}). Image file muxer. -This muxer writes video frames to multiple image files specified by a -pattern. +The image file muxer writes video frames to image files. -The pattern may contain the string "%d" or "%0@var{N}d", which +The output filenames are specified by a pattern, which can be used to +produce sequentially numbered series of files. +The pattern may contain the string "%d" or "%0@var{N}d", this string specifies the position of the characters representing a numbering in -the filenames. If the form "%d0@var{N}d" is used, the string +the filenames. If the form "%0@var{N}d" is used, the string representing the number in each filename is 0-padded to @var{N} digits. The literal character '%' can be specified in the pattern with the string "%%". From 9409c3811c90975f2208216a0c5b820186e1e87b Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 29 Jan 2011 11:22:41 +0100 Subject: [PATCH 267/528] libavfilter: add video movie source See thread: Subject: [PATCH] movie video source Date: 2010-12-31 15:35:30 GMT Signed-off-by: Janne Grunau --- Changelog | 1 + doc/filters.texi | 55 +++++++ libavfilter/Makefile | 2 + libavfilter/allfilters.c | 1 + libavfilter/avfilter.h | 2 +- libavfilter/vsrc_movie.c | 311 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 371 insertions(+), 1 deletion(-) create mode 100644 libavfilter/vsrc_movie.c diff --git a/Changelog b/Changelog index a85a9d3221..202e34c494 100644 --- a/Changelog +++ b/Changelog @@ -75,6 +75,7 @@ version : - ffmpeg -copytb option added - IVF muxer added - Wing Commander IV movies decoder added +- movie source added version 0.6: diff --git a/doc/filters.texi b/doc/filters.texi index 3842886521..aa073a76dc 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1088,6 +1088,61 @@ to the pad with identifier "in". "color=red@@0.2:qcif:10 [color]; [in][color] overlay [out]" @end example +@section movie + +Read a video stream from a movie container. + +It accepts the syntax: @var{movie_name}[:@var{options}] where +@var{movie_name} is the name of the resource to read (not necessarily +a file but also a device or a stream accessed through some protocol), +and @var{options} is an optional sequence of @var{key}=@var{value} +pairs, separated by ":". + +The description of the accepted options follows. + +@table @option + +@item format_name, f +Specifies the format assumed for the movie to read, and can be either +the name of a container or an input device. If not specified the +format is guessed from @var{movie_name} or by probing. + +@item seek_point, sp +Specifies the seek point in seconds, the frames will be output +starting from this seek point, the parameter is evaluated with +@code{av_strtod} so the numerical value may be suffixed by an IS +postfix. Default value is "0". + +@item stream_index, si +Specifies the index of the video stream to read. If the value is -1, +the best suited video stream will be automatically selected. Default +value is "-1". + +@end table + +This filter allows to overlay a second video on top of main input of +a filtergraph as shown in this graph: +@example +input -----------> deltapts0 --> overlay --> output + ^ + | +movie --> scale--> deltapts1 -------+ +@end example + +Some examples follow: +@example +# skip 3.2 seconds from the start of the avi file in.avi, and overlay it +# on top of the input labelled as "in". +movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie]; +[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out] + +# read from a video4linux2 device, and overlay it on top of the input +# labelled as "in" +movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie]; +[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out] + +@end example + @section nullsrc Null video source, never return images. It is mainly useful as a diff --git a/libavfilter/Makefile b/libavfilter/Makefile index fdb181e052..ce1caa5bdc 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -2,6 +2,7 @@ include $(SUBDIR)../config.mak NAME = avfilter FFLIBS = avcore avutil +FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec FFLIBS-$(CONFIG_SCALE_FILTER) += swscale HEADERS = avfilter.h avfiltergraph.h @@ -50,6 +51,7 @@ OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o OBJS-$(CONFIG_BUFFER_FILTER) += vsrc_buffer.o OBJS-$(CONFIG_COLOR_FILTER) += vf_pad.o OBJS-$(CONFIG_FREI0R_SRC_FILTER) += vf_frei0r.o +OBJS-$(CONFIG_MOVIE_FILTER) += vsrc_movie.o OBJS-$(CONFIG_NULLSRC_FILTER) += vsrc_nullsrc.o OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 1dffb80473..cb29c2f112 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -71,6 +71,7 @@ void avfilter_register_all(void) REGISTER_FILTER (BUFFER, buffer, vsrc); REGISTER_FILTER (COLOR, color, vsrc); REGISTER_FILTER (FREI0R, frei0r_src, vsrc); + REGISTER_FILTER (MOVIE, movie, vsrc); REGISTER_FILTER (NULLSRC, nullsrc, vsrc); REGISTER_FILTER (NULLSINK, nullsink, vsink); diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index ad8b1e51a5..cc3dce7cb2 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -27,7 +27,7 @@ #include "libavcore/samplefmt.h" #define LIBAVFILTER_VERSION_MAJOR 1 -#define LIBAVFILTER_VERSION_MINOR 74 +#define LIBAVFILTER_VERSION_MINOR 75 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c new file mode 100644 index 0000000000..4fd56febad --- /dev/null +++ b/libavfilter/vsrc_movie.c @@ -0,0 +1,311 @@ +/* + * 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 + * movie video source + * + * @todo use direct rendering (no allocation of a new frame) + * @todo support a PTS correction mechanism + * @todo support more than one output stream + */ + +/* #define DEBUG */ + +#include +#include "libavutil/avstring.h" +#include "libavutil/opt.h" +#include "libavcore/imgutils.h" +#include "libavformat/avformat.h" +#include "avfilter.h" + +typedef struct { + const AVClass *class; + int64_t seek_point; ///< seekpoint in microseconds + double seek_point_d; + char *format_name; + char *file_name; + int stream_index; + + AVFormatContext *format_ctx; + AVCodecContext *codec_ctx; + int is_done; + AVFrame *frame; ///< video frame to store the decoded images in + + int w, h; + AVFilterBufferRef *picref; +} MovieContext; + +#define OFFSET(x) offsetof(MovieContext, x) + +static const AVOption movie_options[]= { +{"format_name", "set format name", OFFSET(format_name), FF_OPT_TYPE_STRING, 0, CHAR_MIN, CHAR_MAX }, +{"f", "set format name", OFFSET(format_name), FF_OPT_TYPE_STRING, 0, CHAR_MIN, CHAR_MAX }, +{"stream_index", "set stream index", OFFSET(stream_index), FF_OPT_TYPE_INT, -1, -1, INT_MAX }, +{"si", "set stream index", OFFSET(stream_index), FF_OPT_TYPE_INT, -1, -1, INT_MAX }, +{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, 0, 0, (INT64_MAX-1) / 1000000 }, +{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, 0, 0, (INT64_MAX-1) / 1000000 }, +{NULL}, +}; + +static const char *movie_get_name(void *ctx) +{ + return "movie"; +} + +static const AVClass movie_class = { + "MovieContext", + movie_get_name, + movie_options +}; + +static int movie_init(AVFilterContext *ctx) +{ + MovieContext *movie = ctx->priv; + AVInputFormat *iformat = NULL; + AVCodec *codec; + int ret; + int64_t timestamp; + + av_register_all(); + + // Try to find the movie format (container) + iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL; + + movie->format_ctx = NULL; + if ((ret = av_open_input_file(&movie->format_ctx, movie->file_name, iformat, 0, NULL)) < 0) { + av_log(ctx, AV_LOG_ERROR, + "Failed to av_open_input_file '%s'\n", movie->file_name); + return ret; + } + if ((ret = av_find_stream_info(movie->format_ctx)) < 0) + av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n"); + + // if seeking requested, we execute it + if (movie->seek_point > 0) { + timestamp = movie->seek_point; + // add the stream start time, should it exist + if (movie->format_ctx->start_time != AV_NOPTS_VALUE) { + if (timestamp > INT64_MAX - movie->format_ctx->start_time) { + av_log(ctx, AV_LOG_ERROR, + "%s: seek value overflow with start_time:%"PRId64" seek_point:%"PRId64"\n", + movie->file_name, movie->format_ctx->start_time, movie->seek_point); + return AVERROR(EINVAL); + } + timestamp += movie->format_ctx->start_time; + } + if ((ret = av_seek_frame(movie->format_ctx, -1, timestamp, AVSEEK_FLAG_BACKWARD)) < 0) { + av_log(ctx, AV_LOG_ERROR, "%s: could not seek to position %"PRId64"\n", + movie->file_name, timestamp); + return ret; + } + } + + /* select the video stream */ + if ((ret = av_find_best_stream(movie->format_ctx, AVMEDIA_TYPE_VIDEO, + movie->stream_index, -1, NULL, 0)) < 0) { + av_log(ctx, AV_LOG_ERROR, "No video stream with index '%d' found\n", + movie->stream_index); + return ret; + } + movie->stream_index = ret; + movie->codec_ctx = movie->format_ctx->streams[movie->stream_index]->codec; + + /* + * So now we've got a pointer to the so-called codec context for our video + * stream, but we still have to find the actual codec and open it. + */ + codec = avcodec_find_decoder(movie->codec_ctx->codec_id); + if (!codec) { + av_log(ctx, AV_LOG_ERROR, "Failed to find any codec\n"); + return AVERROR(EINVAL); + } + + if ((ret = avcodec_open(movie->codec_ctx, codec)) < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n"); + return ret; + } + + if (!(movie->frame = avcodec_alloc_frame()) ) { + av_log(ctx, AV_LOG_ERROR, "Failed to alloc frame\n"); + return AVERROR(ENOMEM); + } + + movie->w = movie->codec_ctx->width; + movie->h = movie->codec_ctx->height; + + av_log(ctx, AV_LOG_INFO, "seek_point:%lld format_name:%s file_name:%s stream_index:%d\n", + movie->seek_point, movie->format_name, movie->file_name, + movie->stream_index); + + return 0; +} + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + MovieContext *movie = ctx->priv; + int ret; + movie->class = &movie_class; + av_opt_set_defaults2(movie, 0, 0); + + if (args) + movie->file_name = av_get_token(&args, ":"); + if (!movie->file_name || !*movie->file_name) { + av_log(ctx, AV_LOG_ERROR, "No filename provided!\n"); + return AVERROR(EINVAL); + } + + if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0) { + av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); + return ret; + } + + movie->seek_point = movie->seek_point_d * 1000000 + 0.5; + + return movie_init(ctx); +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + MovieContext *movie = ctx->priv; + + av_free(movie->file_name); + av_free(movie->format_name); + if (movie->codec_ctx) + avcodec_close(movie->codec_ctx); + if (movie->format_ctx) + av_close_input_file(movie->format_ctx); + avfilter_unref_buffer(movie->picref); + av_freep(&movie->frame); +} + +static int query_formats(AVFilterContext *ctx) +{ + MovieContext *movie = ctx->priv; + enum PixelFormat pix_fmts[] = { movie->codec_ctx->pix_fmt, PIX_FMT_NONE }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int config_output_props(AVFilterLink *outlink) +{ + MovieContext *movie = outlink->src->priv; + + outlink->w = movie->w; + outlink->h = movie->h; + outlink->time_base = movie->format_ctx->streams[movie->stream_index]->time_base; + + return 0; +} + +static int movie_get_frame(AVFilterLink *outlink) +{ + MovieContext *movie = outlink->src->priv; + AVPacket pkt; + int ret, frame_decoded; + AVStream *st = movie->format_ctx->streams[movie->stream_index]; + + if (movie->is_done == 1) + return 0; + + while ((ret = av_read_frame(movie->format_ctx, &pkt)) >= 0) { + // Is this a packet from the video stream? + if (pkt.stream_index == movie->stream_index) { + movie->codec_ctx->reordered_opaque = pkt.pos; + avcodec_decode_video2(movie->codec_ctx, movie->frame, &frame_decoded, &pkt); + + if (frame_decoded) { + /* FIXME: avoid the memcpy */ + movie->picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE | AV_PERM_PRESERVE | + AV_PERM_REUSE2, outlink->w, outlink->h); + av_image_copy(movie->picref->data, movie->picref->linesize, + movie->frame->data, movie->frame->linesize, + movie->picref->format, outlink->w, outlink->h); + + /* FIXME: use a PTS correction mechanism as that in + * ffplay.c when some API will be available for that */ + /* use pkt_dts if pkt_pts is not available */ + movie->picref->pts = movie->frame->pkt_pts == AV_NOPTS_VALUE ? + movie->frame->pkt_dts : movie->frame->pkt_pts; + + movie->picref->pos = movie->frame->reordered_opaque; + movie->picref->video->pixel_aspect = st->sample_aspect_ratio.num ? + st->sample_aspect_ratio : movie->codec_ctx->sample_aspect_ratio; + movie->picref->video->interlaced = movie->frame->interlaced_frame; + movie->picref->video->top_field_first = movie->frame->top_field_first; + av_dlog(outlink->src, + "movie_get_frame(): file:'%s' pts:%"PRId64" time:%lf pos:%"PRId64" aspect:%d/%d\n", + movie->file_name, movie->picref->pts, + (double)movie->picref->pts * av_q2d(st->time_base), + movie->picref->pos, + movie->picref->video->pixel_aspect.num, movie->picref->video->pixel_aspect.den); + // We got it. Free the packet since we are returning + av_free_packet(&pkt); + + return 0; + } + } + // Free the packet that was allocated by av_read_frame + av_free_packet(&pkt); + } + + // On multi-frame source we should stop the mixing process when + // the movie source does not have more frames + if (ret == AVERROR_EOF) + movie->is_done = 1; + return ret; +} + +static int request_frame(AVFilterLink *outlink) +{ + AVFilterBufferRef *outpicref; + MovieContext *movie = outlink->src->priv; + int ret; + + if (movie->is_done) + return AVERROR_EOF; + if ((ret = movie_get_frame(outlink)) < 0) + return ret; + + outpicref = avfilter_ref_buffer(movie->picref, ~0); + avfilter_start_frame(outlink, outpicref); + avfilter_draw_slice(outlink, 0, outlink->h, 1); + avfilter_end_frame(outlink); + + return 0; +} + +AVFilter avfilter_vsrc_movie = { + .name = "movie", + .description = NULL_IF_CONFIG_SMALL("Read from a movie source."), + .priv_size = sizeof(MovieContext), + .init = init, + .uninit = uninit, + .query_formats = query_formats, + + .inputs = (AVFilterPad[]) {{ .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .request_frame = request_frame, + .config_props = config_output_props, }, + { .name = NULL}}, +}; From 440b61691db2166abac3f58e01da1d4722f1f1e4 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Tue, 1 Feb 2011 21:56:13 +0100 Subject: [PATCH 268/528] h264: define FF_PROFILE_H264_HIGH_444 to the correct value It was removed in fe9a3fb since it had the wrong value. Add profile name for it. --- libavcodec/avcodec.h | 1 + libavcodec/h264.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index e8d5f1a04f..c231804b34 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2274,6 +2274,7 @@ typedef struct AVCodecContext { #define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) #define FF_PROFILE_H264_HIGH_422 122 #define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_444 144 #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) #define FF_PROFILE_H264_CAVLC_444 44 diff --git a/libavcodec/h264.c b/libavcodec/h264.c index b84430a1d7..e6f9ec9b8d 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3396,6 +3396,7 @@ static const AVProfile profiles[] = { { FF_PROFILE_H264_HIGH_10_INTRA, "High 10 Intra" }, { FF_PROFILE_H264_HIGH_422, "High 4:2:2" }, { FF_PROFILE_H264_HIGH_422_INTRA, "High 4:2:2 Intra" }, + { FF_PROFILE_H264_HIGH_444, "High 4:4:4" }, { FF_PROFILE_H264_HIGH_444_PREDICTIVE, "High 4:4:4 Predictive" }, { FF_PROFILE_H264_HIGH_444_INTRA, "High 4:4:4 Intra" }, { FF_PROFILE_H264_CAVLC_444, "CAVLC 4:4:4" }, From 7ab8758baf743b3d525c07a770e13038b0885461 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Tue, 1 Feb 2011 22:09:12 +0100 Subject: [PATCH 269/528] add APIChanges entry for fe9a3fb --- doc/APIchanges | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index ecc48742ac..e294b35d9a 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -22,6 +22,9 @@ API changes, most recent first: 2011-02-03 - f5b82f4 - lavc 52.109.0 - add CODEC_ID_PRORES Add CODEC_ID_PRORES to avcodec.h. +2011-02-03 - fe9a3fb - lavc 52.109.0 - H.264 profile defines + Add defines for H.264 * Constrained Baseline and Intra profiles + 2011-02-02 - lavf 52.95.0 * 50196a9 - add a new installed header version.h. * 4efd5cf, dccbd97, 93b78d1 - add several variants of public From ae2104791ffa8466d3f6972ed0793b2a165daabe Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 8 Feb 2011 14:16:49 +0200 Subject: [PATCH 270/528] logging: downgrade recoverable errors to warnings In all 3 cases, the decoding continues and thus a warning would be sufficient. Helps application that catch them with own log handers to handle them accordingly. Signed-off-by: Mans Rullgard --- libavcodec/mpeg4videodec.c | 4 ++-- libavcodec/vc1.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 5303da3874..673c4e865c 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2071,7 +2071,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ /* detect buggy encoders which don't set the low_delay flag (divx4/xvid/opendivx)*/ // note we cannot detect divx5 without b-frames easily (although it's buggy too) if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==-1 && s->picture_number==0){ - av_log(s->avctx, AV_LOG_ERROR, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); + av_log(s->avctx, AV_LOG_WARNING, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); s->low_delay=1; } @@ -2110,7 +2110,7 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb) for(;;) { if(get_bits_count(gb) >= gb->size_in_bits){ if(gb->size_in_bits==8 && (s->divx_version>=0 || s->xvid_build>=0)){ - av_log(s->avctx, AV_LOG_ERROR, "frame skip %d\n", gb->size_in_bits); + av_log(s->avctx, AV_LOG_WARNING, "frame skip %d\n", gb->size_in_bits); return FRAME_SKIPPED; //divx bug }else return -1; //end of stream diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 86904cbffd..1f39878293 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -293,7 +293,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte v->profile = get_bits(gb, 2); if (v->profile == PROFILE_COMPLEX) { - av_log(avctx, AV_LOG_ERROR, "WMV3 Complex Profile is not fully supported\n"); + av_log(avctx, AV_LOG_WARNING, "WMV3 Complex Profile is not fully supported\n"); } if (v->profile == PROFILE_ADVANCED) From 87800dc2bf8f2724a99e51bb079ad7fb4b9dfd3b Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Mon, 7 Feb 2011 17:17:30 +0100 Subject: [PATCH 271/528] Documentation updates for the git migration This cleanup patch updates the developer documentation with respect to the migration to the git scm. --- doc/TODO | 2 +- doc/developer.texi | 6 +++--- doc/optimization.txt | 4 ++-- doc/soc.txt | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/TODO b/doc/TODO index 747eee4ab1..8ff8a6b388 100644 --- a/doc/TODO +++ b/doc/TODO @@ -69,7 +69,7 @@ unassigned TODO: (unordered) - JPEG2000 decoder & encoder - MPEG4 GMC encoding support - macroblock based pixel format (better cache locality, somewhat complex, one paper claimed it faster for high res) -- regression tests for codecs which do not have an encoder (I+P-frame bitstream in svn) +- regression tests for codecs which do not have an encoder (I+P-frame bitstream in the 'master' branch) - add support for using mplayers video filters to ffmpeg - H264 encoder - per MB ratecontrol (so VCD and such do work better) diff --git a/doc/developer.texi b/doc/developer.texi index b9e246f214..acffbe67e2 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -312,7 +312,7 @@ send a reminder by email. Your patch should eventually be dealt with. If it depends on a parser or a library, did you add that dependency in configure? @item - Did you "svn add" the appropriate files before commiting? + Did you "git add" the appropriate files before committing? @end enumerate @section patch submission checklist @@ -325,7 +325,7 @@ send a reminder by email. Your patch should eventually be dealt with. @item Is the patch a unified diff? @item - Is the patch against latest FFmpeg SVN? + Is the patch against latest FFmpeg git master branch? @item Are you subscribed to ffmpeg-dev? (the list is subscribers only due to spam) @@ -388,7 +388,7 @@ send a reminder by email. Your patch should eventually be dealt with. @section Patch review process All patches posted to ffmpeg-devel will be reviewed, unless they contain a -clear note that the patch is not for SVN. +clear note that the patch is not for the git master branch. Reviews and comments will be posted as replies to the patch on the mailing list. The patch submitter then has to take care of every comment, that can be by resubmitting a changed patch or by discussion. Resubmitted diff --git a/doc/optimization.txt b/doc/optimization.txt index 5d51235983..08954f9973 100644 --- a/doc/optimization.txt +++ b/doc/optimization.txt @@ -17,8 +17,8 @@ Understanding these overoptimized functions: As many functions tend to be a bit difficult to understand because of optimizations, it can be hard to optimize them further, or write architecture-specific versions. It is recommended to look at older -revisions of the interesting files (for a web frontend try ViewVC at -http://svn.ffmpeg.org/ffmpeg/trunk/). +revisions of the interesting files (web frontends for the various FFmpeg +branches are listed at http://ffmpeg.org/download.html). Alternatively, look into the other architecture-specific versions in the x86/, ppc/, alpha/ subdirectories. Even if you don't exactly comprehend the instructions, it could help understanding the functions diff --git a/doc/soc.txt b/doc/soc.txt index 8b4a86db80..79d77d1cd7 100644 --- a/doc/soc.txt +++ b/doc/soc.txt @@ -9,14 +9,14 @@ it's a little late for this year's soc (2006). The Goal: Our goal in respect to soc is and must be of course exactly one thing and that is to improve FFmpeg, to reach this goal, code must -* conform to the svn policy and patch submission guidelines +* conform to the development policy and patch submission guidelines * must improve FFmpeg somehow (faster, smaller, "better", more codecs supported, fewer bugs, cleaner, ...) for mentors and other developers to help students to reach that goal it is essential that changes to their codebase are publicly visible, clean and easy reviewable that again leads us to: -* use of a revision control system like svn +* use of a revision control system like git * separation of cosmetic from non-cosmetic changes (this is almost entirely ignored by mentors and students in soc 2006 which might lead to a suprise when the code will be reviewed at the end before a possible inclusion in From f59c4bd625839dbe1e099c6a8b38988108883623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 8 Feb 2011 21:09:44 +0000 Subject: [PATCH 272/528] Fix HOSTLIBS on Haiku MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Haiku does not have a separate libm, so do not try to link to it. Signed-off-by: François Revol Signed-off-by: Mans Rullgard --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index d67029569e..a3ca15d6d5 100755 --- a/configure +++ b/configure @@ -2305,6 +2305,7 @@ case $target_os in haiku) prefix_default="/boot/common" network_extralibs="-lnetwork" + host_libs= ;; sunos) FFSERVERLDFLAGS="" From 6bd69e6adadf645fd07e909bebc150eab4b9c3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sat, 5 Feb 2011 16:32:35 +0000 Subject: [PATCH 273/528] oggdec: Fix incorrect assumption about header/data interleaving Currently (since the data_offset fix) the ogg demuxer assumes that after the first non-header packets in any stream no more header packets will follow. This is not guaranteed, so change the code back again to wait until it has finished the headers for all streams before returning from ogg_get_headers. This fixes issue 2428. Signed-off-by: Mans Rullgard --- libavformat/oggdec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 1b4553c73b..be2f03a47b 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -374,20 +374,20 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo os->segp = segp; os->psize = psize; - // We have 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. + // We have reached the first non-header packet in this stream. + // Unfortunately more header packets may still follow for others, + // so we reset this later unless we are done with the headers + // for all streams. ogg->headers = 1; // Update the header state for all streams and // compute the data_offset. - s->data_offset = os->sync_pos; + if (!s->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; + ogg->headers = 0; // if we have a partial non-header packet, its start is // obviously at or after the data start From 4d016dd4e5b288b3c0c7396935326cb07a289ac2 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Tue, 8 Feb 2011 00:46:51 +0200 Subject: [PATCH 274/528] lavf: update ff_probe_input_buffer documentation It never reopens the bytestream anymore. Signed-off-by: Ronald S. Bultje --- libavformat/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index 9e3302fa5f..2482b6d02b 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -88,7 +88,7 @@ uint64_t ff_ntp_time(void); * attempt is made. When the maximum probe size is reached, the input format * with the highest score is returned. * - * @param pb the bytestream to probe, it may be closed and opened again + * @param pb the bytestream to probe * @param fmt the input format is put here * @param filename the filename of the stream * @param logctx the log context From aad216fd7e3209fe0a865d8751e680925f6654d3 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Tue, 8 Feb 2011 00:46:52 +0200 Subject: [PATCH 275/528] lavf: simplify pb parameter of ff_probe_input_buffer There is no need to pass the ByteIOContext via a pointer to a pointer anymore. Signed-off-by: Ronald S. Bultje --- libavformat/internal.h | 2 +- libavformat/utils.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index 2482b6d02b..fc4ee216c1 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -97,7 +97,7 @@ uint64_t ff_ntp_time(void); * @return 0 in case of success, a negative value corresponding to an * AVERROR code otherwise */ -int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, +int ff_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size); diff --git a/libavformat/utils.c b/libavformat/utils.c index 4f71f8c0a4..505c2db4cf 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -524,7 +524,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, #define PROBE_BUF_MIN 2048 #define PROBE_BUF_MAX (1<<20) -int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, +int ff_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { @@ -555,7 +555,7 @@ int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, /* read probe data */ buf = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE); - if ((ret = get_buffer(*pb, buf + buf_offset, probe_size - buf_offset)) < 0) { + if ((ret = get_buffer(pb, buf + buf_offset, probe_size - buf_offset)) < 0) { /* fail if error was not end of file, otherwise, lower score */ if (ret != AVERROR_EOF) { av_free(buf); @@ -585,7 +585,7 @@ int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, } /* rewind. reuse probe buffer to avoid seeking */ - if ((ret = ff_rewind_with_probe_data(*pb, buf, pd.buf_size)) < 0) + if ((ret = ff_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0) av_free(buf); return ret; @@ -622,7 +622,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, if (buf_size > 0) { url_setbufsize(pb, buf_size); } - if (!fmt && (err = ff_probe_input_buffer(&pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) { + if (!fmt && (err = ff_probe_input_buffer(pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) { goto fail; } } From 3940caad02fbc4f075e77bc605849b1d84ba1b8e Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Tue, 8 Feb 2011 00:46:53 +0200 Subject: [PATCH 276/528] lavf: rename ff_probe_input_buffer to make it public It is useful for applications that hand input data directly to lavf via a ByteIOContext. Signed-off-by: Ronald S. Bultje --- doc/APIchanges | 4 ++++ libavformat/avformat.h | 19 +++++++++++++++++++ libavformat/internal.h | 19 ------------------- libavformat/utils.c | 4 ++-- libavformat/version.h | 2 +- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index e294b35d9a..e459cfd1af 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,10 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-08 - xxxxxxx - lavf 52.98.0 - av_probe_input_buffer + Add av_probe_input_buffer() to avformat.h for probing format from a + ByteIOContext. + 2011-02-06 - fe174fc - lavf 52.97.0 - avio.h Add flag for non-blocking protocols: URL_FLAG_NONBLOCK diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 675c13c38f..bf6f96d2a4 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1038,6 +1038,25 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); */ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); +/** + * Probe a bytestream to determine the input format. Each time a probe returns + * with a score that is too low, the probe buffer size is increased and another + * attempt is made. When the maximum probe size is reached, the input format + * with the highest score is returned. + * + * @param pb the bytestream to probe + * @param fmt the input format is put here + * @param filename the filename of the stream + * @param logctx the log context + * @param offset the offset within the bytestream to probe from + * @param max_probe_size the maximum probe buffer size (zero for default) + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size); + /** * Allocate all the structures needed to read an input stream. * This does not open the needed codecs for decoding the stream[s]. diff --git a/libavformat/internal.h b/libavformat/internal.h index fc4ee216c1..2fdf61f938 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -82,25 +82,6 @@ void ff_read_frame_flush(AVFormatContext *s); /** Get the current time since NTP epoch in microseconds. */ uint64_t ff_ntp_time(void); -/** - * Probe a bytestream to determine the input format. Each time a probe returns - * with a score that is too low, the probe buffer size is increased and another - * attempt is made. When the maximum probe size is reached, the input format - * with the highest score is returned. - * - * @param pb the bytestream to probe - * @param fmt the input format is put here - * @param filename the filename of the stream - * @param logctx the log context - * @param offset the offset within the bytestream to probe from - * @param max_probe_size the maximum probe buffer size (zero for default) - * @return 0 in case of success, a negative value corresponding to an - * AVERROR code otherwise - */ -int ff_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, - const char *filename, void *logctx, - unsigned int offset, unsigned int max_probe_size); - #if FF_API_URL_SPLIT /** * @deprecated use av_url_split() instead diff --git a/libavformat/utils.c b/libavformat/utils.c index 505c2db4cf..8c3311f3bc 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -524,7 +524,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, #define PROBE_BUF_MIN 2048 #define PROBE_BUF_MAX (1<<20) -int ff_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, +int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { @@ -622,7 +622,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, if (buf_size > 0) { url_setbufsize(pb, buf_size); } - if (!fmt && (err = ff_probe_input_buffer(pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) { + if (!fmt && (err = av_probe_input_buffer(pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) { goto fail; } } diff --git a/libavformat/version.h b/libavformat/version.h index 603d7cfa3a..e1abaa7a8d 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 97 +#define LIBAVFORMAT_VERSION_MINOR 98 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From 17cf7c68ed26a4cb3c7adf7488a38c2e19118918 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 8 Feb 2011 15:56:32 -0500 Subject: [PATCH 277/528] Fix ff_emu_edge_core_sse() on Win64. Fix emu_edge_v_extend_15 to be <128 bytes on Win64, by being more strict on the size of registers and which registers are being used for operations where multiple are available. This fixes segfaults in emulated_edge() function calls on Win64. --- libavcodec/x86/dsputil_yasm.asm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm index b1b37e1fb9..53884a6b40 100644 --- a/libavcodec/x86/dsputil_yasm.asm +++ b/libavcodec/x86/dsputil_yasm.asm @@ -468,6 +468,11 @@ cglobal emu_edge_core_%1, 2, 7, 0 %define valw ax %define valw2 r10w %define valw3 r3w +%ifdef WIN64 +%define valw4 r4w +%else ; unix64 +%define valw4 r3w +%endif %define vald eax %else %define vall bl @@ -475,6 +480,7 @@ cglobal emu_edge_core_%1, 2, 7, 0 %define valw bx %define valw2 r6w %define valw3 valw2 +%define valw4 valw3 %define vald ebx %define stack_offset 0x14 %endif @@ -537,8 +543,10 @@ cglobal emu_edge_core_%1, 2, 7, 0 %elif (%2-%%src_off) == 3 %ifidn %1, top mov valw2, [r1+%%src_off] -%else ; %1 != top +%elifidn %1, body mov valw3, [r1+%%src_off] +%elifidn %1, bottom + mov valw4, [r1+%%src_off] %endif ; %1 ==/!= top mov vall, [r1+%%src_off+2] %endif ; (%2-%%src_off) == 1/2/3 @@ -584,8 +592,10 @@ cglobal emu_edge_core_%1, 2, 7, 0 %elif (%2-%%dst_off) == 3 %ifidn %1, top mov [r0+%%dst_off], valw2 -%else ; %1 != top +%elifidn %1, body mov [r0+%%dst_off], valw3 +%elifidn %1, bottom + mov [r0+%%dst_off], valw4 %endif ; %1 ==/!= top mov [r0+%%dst_off+2], vall %endif ; (%2-%%dst_off) == 1/2/3 @@ -615,7 +625,7 @@ ALIGN 128 WRITE_NUM_BYTES top, %%n, %1 ; write bytes add r0 , r2 ; dst += linesize %ifdef ARCH_X86_64 - dec r3 + dec r3d %else ; ARCH_X86_32 dec dword r3m %endif ; ARCH_X86_64/32 @@ -627,7 +637,7 @@ ALIGN 128 WRITE_NUM_BYTES body, %%n, %1 ; write bytes add r0 , r2 ; dst += linesize add r1 , r2 ; src += linesize - dec r4 + dec r4d jnz .emuedge_copy_body_ %+ %%n %+ _loop ; } while (--end_y) ; copy bottom pixels @@ -638,7 +648,7 @@ ALIGN 128 .emuedge_extend_bottom_ %+ %%n %+ _loop: ; do { WRITE_NUM_BYTES bottom, %%n, %1 ; write bytes add r0 , r2 ; dst += linesize - dec r5 + dec r5d jnz .emuedge_extend_bottom_ %+ %%n %+ _loop ; } while (--block_h) .emuedge_v_extend_end_ %+ %%n: From 62457f9052ea15123688455aad866cb070634f13 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Sat, 5 Feb 2011 21:19:52 -0800 Subject: [PATCH 278/528] VP8: idct_mb optimizations Currently uses AV_RL32 instead of AV_RL32A, as the latter doesn't exist yet. --- libavcodec/vp8.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index b10330af03..c078f2ec5c 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1421,17 +1421,17 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo if (mb->mode != MODE_I4x4) { uint8_t *y_dst = dst[0]; for (y = 0; y < 4; y++) { - uint32_t nnz4 = AV_RN32A(s->non_zero_count_cache[y]); + uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[y]); if (nnz4) { if (nnz4&~0x01010101) { for (x = 0; x < 4; x++) { - int nnz = s->non_zero_count_cache[y][x]; - if (nnz) { - if (nnz == 1) - s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, s->block[y][x], s->linesize); - else - s->vp8dsp.vp8_idct_add(y_dst+4*x, s->block[y][x], s->linesize); - } + if ((uint8_t)nnz4 == 1) + s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, s->block[y][x], s->linesize); + else if((uint8_t)nnz4 > 1) + s->vp8dsp.vp8_idct_add(y_dst+4*x, s->block[y][x], s->linesize); + nnz4 >>= 8; + if (!nnz4) + break; } } else { s->vp8dsp.vp8_idct_dc_add4y(y_dst, s->block[y], s->linesize); @@ -1442,19 +1442,19 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo } for (ch = 0; ch < 2; ch++) { - uint32_t nnz4 = AV_RN32A(s->non_zero_count_cache[4+ch]); + uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[4+ch]); if (nnz4) { uint8_t *ch_dst = dst[1+ch]; if (nnz4&~0x01010101) { for (y = 0; y < 2; y++) { for (x = 0; x < 2; x++) { - int nnz = s->non_zero_count_cache[4+ch][(y<<1)+x]; - if (nnz) { - if (nnz == 1) - s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize); - else - s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize); - } + if ((uint8_t)nnz4 == 1) + s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize); + else if((uint8_t)nnz4 > 1) + s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize); + nnz4 >>= 8; + if (!nnz4) + break; } ch_dst += 4*s->uvlinesize; } From f7f8120fb9a06b5d7fbf5add48a0d8464319a332 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Sun, 6 Feb 2011 05:10:15 -0800 Subject: [PATCH 279/528] Fix broken vbv_buffer_init handling in libx264.c Due to being pants-on-head retarded, libavcodec defaults this to zero, which results in broken output. This didn't affect ffmpeg.c, which sets it itself, but caused problems for other calling apps using VBV. --- libavcodec/libx264.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 84ecb2aecb..185287c1cf 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -277,12 +277,11 @@ static av_cold int X264_init(AVCodecContext *avctx) if (avctx->level > 0) x4->params.i_level_idc = avctx->level; - if ((avctx->rc_buffer_size != 0) && + if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy && (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) { x4->params.rc.f_vbv_buffer_init = (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size; - } else - x4->params.rc.f_vbv_buffer_init = 0.9; + } x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE); x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor); From c7ac200d15e3240972d269df768068f0e3bb9c2f Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Tue, 8 Feb 2011 15:51:15 -0800 Subject: [PATCH 280/528] Update qmin/qmax values for libx264 presets Also allow qmin/qmax to go up to 69 (the current max value for libx264). This will have to increase when we add 9/10-bit support. --- ffpresets/libx264-fast.ffpreset | 4 ++-- ffpresets/libx264-fast_firstpass.ffpreset | 4 ++-- ffpresets/libx264-faster.ffpreset | 4 ++-- ffpresets/libx264-faster_firstpass.ffpreset | 4 ++-- ffpresets/libx264-lossless_fast.ffpreset | 4 ++-- ffpresets/libx264-lossless_max.ffpreset | 4 ++-- ffpresets/libx264-lossless_medium.ffpreset | 4 ++-- ffpresets/libx264-lossless_slow.ffpreset | 4 ++-- ffpresets/libx264-lossless_slower.ffpreset | 4 ++-- ffpresets/libx264-lossless_ultrafast.ffpreset | 4 ++-- ffpresets/libx264-medium.ffpreset | 4 ++-- ffpresets/libx264-medium_firstpass.ffpreset | 4 ++-- ffpresets/libx264-placebo.ffpreset | 4 ++-- ffpresets/libx264-placebo_firstpass.ffpreset | 4 ++-- ffpresets/libx264-slow.ffpreset | 4 ++-- ffpresets/libx264-slow_firstpass.ffpreset | 4 ++-- ffpresets/libx264-slower.ffpreset | 4 ++-- ffpresets/libx264-slower_firstpass.ffpreset | 4 ++-- ffpresets/libx264-superfast.ffpreset | 4 ++-- ffpresets/libx264-superfast_firstpass.ffpreset | 4 ++-- ffpresets/libx264-ultrafast.ffpreset | 4 ++-- ffpresets/libx264-ultrafast_firstpass.ffpreset | 4 ++-- ffpresets/libx264-veryfast.ffpreset | 4 ++-- ffpresets/libx264-veryfast_firstpass.ffpreset | 4 ++-- ffpresets/libx264-veryslow.ffpreset | 4 ++-- ffpresets/libx264-veryslow_firstpass.ffpreset | 4 ++-- libavcodec/options.c | 4 ++-- 27 files changed, 54 insertions(+), 54 deletions(-) diff --git a/ffpresets/libx264-fast.ffpreset b/ffpresets/libx264-fast.ffpreset index cac6534e55..0fc1f22403 100644 --- a/ffpresets/libx264-fast.ffpreset +++ b/ffpresets/libx264-fast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=2 diff --git a/ffpresets/libx264-fast_firstpass.ffpreset b/ffpresets/libx264-fast_firstpass.ffpreset index 65ec0112e0..cdcbbbf227 100644 --- a/ffpresets/libx264-fast_firstpass.ffpreset +++ b/ffpresets/libx264-fast_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/ffpresets/libx264-faster.ffpreset b/ffpresets/libx264-faster.ffpreset index a32eed3cc5..3156cd8028 100644 --- a/ffpresets/libx264-faster.ffpreset +++ b/ffpresets/libx264-faster.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=2 diff --git a/ffpresets/libx264-faster_firstpass.ffpreset b/ffpresets/libx264-faster_firstpass.ffpreset index c777eb4e23..9bcf18ae9d 100644 --- a/ffpresets/libx264-faster_firstpass.ffpreset +++ b/ffpresets/libx264-faster_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/ffpresets/libx264-lossless_fast.ffpreset b/ffpresets/libx264-lossless_fast.ffpreset index ea08d3c00b..b7696b5bcb 100644 --- a/ffpresets/libx264-lossless_fast.ffpreset +++ b/ffpresets/libx264-lossless_fast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 directpred=1 flags2=+fastpskip diff --git a/ffpresets/libx264-lossless_max.ffpreset b/ffpresets/libx264-lossless_max.ffpreset index 8c049c9c93..75c387f162 100644 --- a/ffpresets/libx264-lossless_max.ffpreset +++ b/ffpresets/libx264-lossless_max.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 refs=16 directpred=1 diff --git a/ffpresets/libx264-lossless_medium.ffpreset b/ffpresets/libx264-lossless_medium.ffpreset index 558be6c931..116e3343ce 100644 --- a/ffpresets/libx264-lossless_medium.ffpreset +++ b/ffpresets/libx264-lossless_medium.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 directpred=1 flags2=+fastpskip diff --git a/ffpresets/libx264-lossless_slow.ffpreset b/ffpresets/libx264-lossless_slow.ffpreset index ff641cf40f..0d496f6e29 100644 --- a/ffpresets/libx264-lossless_slow.ffpreset +++ b/ffpresets/libx264-lossless_slow.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 refs=2 directpred=1 diff --git a/ffpresets/libx264-lossless_slower.ffpreset b/ffpresets/libx264-lossless_slower.ffpreset index 854f74b236..672e0cd637 100644 --- a/ffpresets/libx264-lossless_slower.ffpreset +++ b/ffpresets/libx264-lossless_slower.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 refs=4 directpred=1 diff --git a/ffpresets/libx264-lossless_ultrafast.ffpreset b/ffpresets/libx264-lossless_ultrafast.ffpreset index 1c429f21ff..a2eda65edf 100644 --- a/ffpresets/libx264-lossless_ultrafast.ffpreset +++ b/ffpresets/libx264-lossless_ultrafast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 directpred=1 flags2=+fastpskip diff --git a/ffpresets/libx264-medium.ffpreset b/ffpresets/libx264-medium.ffpreset index 039f1d603c..3c90ec5d62 100644 --- a/ffpresets/libx264-medium.ffpreset +++ b/ffpresets/libx264-medium.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=3 diff --git a/ffpresets/libx264-medium_firstpass.ffpreset b/ffpresets/libx264-medium_firstpass.ffpreset index e4159892d0..2ad0a9cc25 100644 --- a/ffpresets/libx264-medium_firstpass.ffpreset +++ b/ffpresets/libx264-medium_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/ffpresets/libx264-placebo.ffpreset b/ffpresets/libx264-placebo.ffpreset index fae2222da8..9f4719f71d 100644 --- a/ffpresets/libx264-placebo.ffpreset +++ b/ffpresets/libx264-placebo.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=16 refs=16 diff --git a/ffpresets/libx264-placebo_firstpass.ffpreset b/ffpresets/libx264-placebo_firstpass.ffpreset index fae2222da8..9f4719f71d 100644 --- a/ffpresets/libx264-placebo_firstpass.ffpreset +++ b/ffpresets/libx264-placebo_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=16 refs=16 diff --git a/ffpresets/libx264-slow.ffpreset b/ffpresets/libx264-slow.ffpreset index 0f3f4d4b41..dabe0ae14e 100644 --- a/ffpresets/libx264-slow.ffpreset +++ b/ffpresets/libx264-slow.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=5 diff --git a/ffpresets/libx264-slow_firstpass.ffpreset b/ffpresets/libx264-slow_firstpass.ffpreset index 89e74e45ca..4af64dbe32 100644 --- a/ffpresets/libx264-slow_firstpass.ffpreset +++ b/ffpresets/libx264-slow_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/ffpresets/libx264-slower.ffpreset b/ffpresets/libx264-slower.ffpreset index f3a412c03e..239ee68cb4 100644 --- a/ffpresets/libx264-slower.ffpreset +++ b/ffpresets/libx264-slower.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=8 diff --git a/ffpresets/libx264-slower_firstpass.ffpreset b/ffpresets/libx264-slower_firstpass.ffpreset index aa1eb1e963..4b5b420c29 100644 --- a/ffpresets/libx264-slower_firstpass.ffpreset +++ b/ffpresets/libx264-slower_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/ffpresets/libx264-superfast.ffpreset b/ffpresets/libx264-superfast.ffpreset index bcd459930e..fb2ab8c44f 100644 --- a/ffpresets/libx264-superfast.ffpreset +++ b/ffpresets/libx264-superfast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/ffpresets/libx264-superfast_firstpass.ffpreset b/ffpresets/libx264-superfast_firstpass.ffpreset index ef06b1d562..55ff9a2b7f 100644 --- a/ffpresets/libx264-superfast_firstpass.ffpreset +++ b/ffpresets/libx264-superfast_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/ffpresets/libx264-ultrafast.ffpreset b/ffpresets/libx264-ultrafast.ffpreset index b6d208080a..28dc0eb836 100644 --- a/ffpresets/libx264-ultrafast.ffpreset +++ b/ffpresets/libx264-ultrafast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=0 i_qfactor=0.71 b_strategy=0 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=0 refs=1 diff --git a/ffpresets/libx264-ultrafast_firstpass.ffpreset b/ffpresets/libx264-ultrafast_firstpass.ffpreset index b6d208080a..28dc0eb836 100644 --- a/ffpresets/libx264-ultrafast_firstpass.ffpreset +++ b/ffpresets/libx264-ultrafast_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=0 i_qfactor=0.71 b_strategy=0 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=0 refs=1 diff --git a/ffpresets/libx264-veryfast.ffpreset b/ffpresets/libx264-veryfast.ffpreset index 16ca594abe..bfa3d8fad2 100644 --- a/ffpresets/libx264-veryfast.ffpreset +++ b/ffpresets/libx264-veryfast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/ffpresets/libx264-veryfast_firstpass.ffpreset b/ffpresets/libx264-veryfast_firstpass.ffpreset index 39eaf3e24b..ac2332df44 100644 --- a/ffpresets/libx264-veryfast_firstpass.ffpreset +++ b/ffpresets/libx264-veryfast_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/ffpresets/libx264-veryslow.ffpreset b/ffpresets/libx264-veryslow.ffpreset index a0606255d3..e07aeb82fa 100644 --- a/ffpresets/libx264-veryslow.ffpreset +++ b/ffpresets/libx264-veryslow.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=8 refs=16 diff --git a/ffpresets/libx264-veryslow_firstpass.ffpreset b/ffpresets/libx264-veryslow_firstpass.ffpreset index 6e7079bbe0..e17c04b20b 100644 --- a/ffpresets/libx264-veryslow_firstpass.ffpreset +++ b/ffpresets/libx264-veryslow_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=8 refs=1 diff --git a/libavcodec/options.c b/libavcodec/options.c index 369ee5d334..ff4cc2dad1 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -117,8 +117,8 @@ static const AVOption options[]={ {"delay", NULL, OFFSET(delay), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), FF_OPT_TYPE_FLOAT, 0.5, -FLT_MAX, FLT_MAX, V|E}, {"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), FF_OPT_TYPE_FLOAT, 0.5, 0, FLT_MAX, V|E}, -{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, 2, 0, 63, V|E}, -{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, 31, 0, 63, V|E}, +{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, 2, 0, 69, V|E}, +{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, 31, 0, 69, V|E}, {"qdiff", "max difference between the quantizer scale (VBR)", OFFSET(max_qdiff), FF_OPT_TYPE_INT, 3, INT_MIN, INT_MAX, V|E}, {"bf", "use 'frames' B frames", OFFSET(max_b_frames), FF_OPT_TYPE_INT, DEFAULT, 0, FF_MAX_B_FRAMES, V|E}, {"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, 1.25, -FLT_MAX, FLT_MAX, V|E}, From e4e234fad77daa8628fc56155563248165d51ab4 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 9 Feb 2011 12:27:25 +0000 Subject: [PATCH 281/528] asf: make ff_guidcmp inline and move it to asf.h Signed-off-by: Mans Rullgard --- libavformat/asf.h | 7 ++++++- libavformat/asfdec.c | 5 ----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/asf.h b/libavformat/asf.h index f336c43fa3..2a817dddba 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -230,7 +230,12 @@ extern const AVMetadataConv ff_asf_metadata_conv[]; #define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000 extern AVInputFormat ff_asf_demuxer; -int ff_guidcmp(const void *g1, const void *g2); + +static av_always_inline int ff_guidcmp(const void *g1, const void *g2) +{ + return memcmp(g1, g2, sizeof(ff_asf_guid)); +} + void ff_get_guid(ByteIOContext *s, ff_asf_guid *g); #endif /* AVFORMAT_ASF_H */ diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 35e892c439..a73a347a51 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -49,11 +49,6 @@ static const ff_asf_guid stream_bitrate_guid = { /* (http://get.to/sdp) */ /**********************************/ /* decoding */ -int ff_guidcmp(const void *g1, const void *g2) -{ - return memcmp(g1, g2, sizeof(ff_asf_guid)); -} - #ifdef DEBUG #define PRINT_IF_GUID(g,cmp) \ if (!ff_guidcmp(g, &cmp)) \ From c2bd7578af069206831a9c25fa68c9bbd5004619 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 8 Feb 2011 21:09:47 -0500 Subject: [PATCH 282/528] Add missing git revision hask. --- doc/APIchanges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index e459cfd1af..c88d4d2db3 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,7 +13,7 @@ libavutil: 2009-03-08 API changes, most recent first: -2011-02-08 - xxxxxxx - lavf 52.98.0 - av_probe_input_buffer +2011-02-08 - 3940caa - lavf 52.98.0 - av_probe_input_buffer Add av_probe_input_buffer() to avformat.h for probing format from a ByteIOContext. From 37b00b47cbeecd66bb34c5c7c534d016d6e8da24 Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Mon, 7 Feb 2011 21:15:44 -0500 Subject: [PATCH 283/528] Frame-based multithreading framework using pthreads See doc/multithreading.txt for details on use in codecs. Signed-off-by: Ronald S. Bultje --- doc/APIchanges | 5 + doc/multithreading.txt | 65 ++++ ffplay.c | 1 + libavcodec/avcodec.h | 89 ++++- libavcodec/options.c | 4 + libavcodec/pthread.c | 722 ++++++++++++++++++++++++++++++++++++++++- libavcodec/thread.h | 111 +++++++ libavcodec/utils.c | 60 +++- libavcodec/w32thread.c | 6 + libavformat/utils.c | 6 + libavutil/internal.h | 11 + 11 files changed, 1068 insertions(+), 12 deletions(-) create mode 100644 doc/multithreading.txt create mode 100644 libavcodec/thread.h diff --git a/doc/APIchanges b/doc/APIchanges index c88d4d2db3..f14616e16c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,11 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-09 - XXXXXXX - lavc 52.111.0 - threading API + Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/ + release_buffer()/draw_horiz_band() callbacks for appropriate codecs. + Add thread_type and active_thread_type fields to AVCodecContext. + 2011-02-08 - 3940caa - lavf 52.98.0 - av_probe_input_buffer Add av_probe_input_buffer() to avformat.h for probing format from a ByteIOContext. diff --git a/doc/multithreading.txt b/doc/multithreading.txt new file mode 100644 index 0000000000..a1068425cd --- /dev/null +++ b/doc/multithreading.txt @@ -0,0 +1,65 @@ +FFmpeg multithreading methods +============================================== + +FFmpeg provides two methods for multithreading codecs. + +Slice threading decodes multiple parts of a frame at the same time, using +AVCodecContext execute() and execute2(). + +Frame threading decodes multiple frames at the same time. +It accepts N future frames and delays decoded pictures by N-1 frames. +The later frames are decoded in separate threads while the user is +displaying the current one. + +Restrictions on clients +============================================== + +Slice threading - +* The client's draw_horiz_band() must be thread-safe according to the comment + in avcodec.h. + +Frame threading - +* Restrictions with slice threading also apply. +* For best performance, the client should set thread_safe_callbacks if it + provides a thread-safe get_buffer() callback. +* There is one frame of delay added for every thread beyond the first one. + Clients must be able to handle this; the pkt_dts and pkt_pts fields in + AVFrame will work as usual. + +Restrictions on codec implementations +============================================== + +Slice threading - + None except that there must be something worth executing in parallel. + +Frame threading - +* Codecs can only accept entire pictures per packet. +* Codecs similar to ffv1, whose streams don't reset across frames, + will not work because their bitstreams cannot be decoded in parallel. + +* The contents of buffers must not be read before ff_thread_await_progress() + has been called on them. reget_buffer() and buffer age optimizations no longer work. +* The contents of buffers must not be written to after ff_thread_report_progress() + has been called on them. This includes draw_edges(). + +Porting codecs to frame threading +============================================== + +Find all context variables that are needed by the next frame. Move all +code changing them, as well as code calling get_buffer(), up to before +the decode process starts. Call ff_thread_finish_setup() afterwards. If +some code can't be moved, have update_thread_context() run it in the next +thread. + +If the codec allocates writable tables in its init(), add an init_thread_copy() +which re-allocates them for other threads. + +Add CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little +speed gain at this point but it should work. + +Call ff_thread_report_progress() after some part of the current picture has decoded. +A good place to put this is where draw_horiz_band() is called - add this if it isn't +called anywhere, as it's useful too and the implementation is trivial when you're +doing this. Note that draw_edges() needs to be called before reporting progress. + +Before accessing a reference frame or its MVs, call ff_thread_await_progress(). diff --git a/ffplay.c b/ffplay.c index dbb6268df1..157fd7f255 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1694,6 +1694,7 @@ static int input_init(AVFilterContext *ctx, const char *args, void *opaque) codec->get_buffer = input_get_buffer; codec->release_buffer = input_release_buffer; codec->reget_buffer = input_reget_buffer; + codec->thread_safe_callbacks = 1; } priv->frame = avcodec_alloc_frame(); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index c231804b34..9692288a16 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -32,7 +32,7 @@ #include "libavutil/cpu.h" #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 110 +#define LIBAVCODEC_VERSION_MINOR 111 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -728,6 +728,10 @@ typedef struct RcOverride{ * Codec is able to deal with negative linesizes */ #define CODEC_CAP_NEG_LINESIZES 0x0800 +/** + * Codec supports frame-level multithreading. + */ +#define CODEC_CAP_FRAME_THREADS 0x1000 //The following defines may change, don't expect compatibility if you use them. #define MB_TYPE_INTRA4x4 0x0001 @@ -1027,7 +1031,20 @@ typedef struct AVPanScan{ * - decoding: Read by user.\ */\ int64_t pkt_dts;\ - +\ + /**\ + * the AVCodecContext which ff_thread_get_buffer() was last called on\ + * - encoding: Set by libavcodec.\ + * - decoding: Set by libavcodec.\ + */\ + struct AVCodecContext *owner;\ +\ + /**\ + * used by multithreading to store frame-specific info\ + * - encoding: Set by libavcodec.\ + * - decoding: Set by libavcodec.\ + */\ + void *thread_opaque; #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 @@ -1239,6 +1256,10 @@ typedef struct AVCodecContext { * decoder to draw a horizontal band. It improves cache usage. Not * all codecs can do that. You must check the codec capabilities * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. * The function is also used by hardware acceleration APIs. * It is called at least once during frame decoding to pass * the data needed for hardware render. @@ -1492,6 +1513,9 @@ typedef struct AVCodecContext { * if CODEC_CAP_DR1 is not set then get_buffer() must call * avcodec_default_get_buffer() instead of providing buffers allocated by * some other means. + * If frame multithreading is used and thread_safe_callbacks is set, + * it may be called from a different thread, but not from more than one at once. + * Does not need to be reentrant. * - encoding: unused * - decoding: Set by libavcodec, user can override. */ @@ -1501,6 +1525,8 @@ typedef struct AVCodecContext { * Called to release buffers which were allocated with get_buffer. * A released buffer can be reused in get_buffer(). * pic.data[*] must be set to NULL. + * May be called from a different thread if frame multithreading is used, + * but not by more than one thread at once, so does not need to be reentrant. * - encoding: unused * - decoding: Set by libavcodec, user can override. */ @@ -1804,6 +1830,7 @@ typedef struct AVCodecContext { #define FF_DEBUG_VIS_QP 0x00002000 #define FF_DEBUG_VIS_MB_TYPE 0x00004000 #define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 /** * debug @@ -2827,6 +2854,44 @@ typedef struct AVCodecContext { * - encoding: unused */ AVPacket *pkt; + + /** + * Whether this is a copy of the context which had init() called on it. + * This is used by multithreading - shared tables and picture pointers + * should be freed from the original context only. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int is_copy; + + /** + * Which multithreading methods to use. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, + * so clients which cannot provide future frames should not use it. + * + * - encoding: Set by user, otherwise the default is used. + * - decoding: Set by user, otherwise the default is used. + */ + int thread_type; +#define FF_THREAD_FRAME 1 //< Decode more than one frame at once +#define FF_THREAD_SLICE 2 //< Decode more than one part of a single frame at once + + /** + * Which multithreading methods are in use by the codec. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int active_thread_type; + + /** + * Set by the client if its custom get_buffer() callback can be called + * from another thread, which allows faster multithreaded decoding. + * draw_horiz_band() will be called from other threads regardless of this setting. + * Ignored if the default get_buffer() is used. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_safe_callbacks; } AVCodecContext; /** @@ -2879,6 +2944,26 @@ typedef struct AVCodec { uint8_t max_lowres; ///< maximum value for lowres supported by the decoder AVClass *priv_class; ///< AVClass for the private context const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} + + /** + * @defgroup framethreading Frame-level threading support functions. + * @{ + */ + /** + * If defined, called on thread contexts when they are created. + * If the codec allocates writable tables in init(), re-allocate them here. + * priv_data will be set to a copy of the original. + */ + int (*init_thread_copy)(AVCodecContext *); + /** + * Copy necessary context variables from a previous thread context to the current one. + * If not defined, the next thread will start automatically; otherwise, the codec + * must call ff_thread_finish_setup(). + * + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. + */ + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); + /** @} */ } AVCodec; /** diff --git a/libavcodec/options.c b/libavcodec/options.c index ff4cc2dad1..57e0804ce5 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -250,6 +250,7 @@ static const AVOption options[]={ {"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_QP, INT_MIN, INT_MAX, V|D, "debug"}, {"vis_mb_type", "visualize block types", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"}, {"buffers", "picture buffer allocations", 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUFFERS, INT_MIN, INT_MAX, V|D, "debug"}, +{"thread_ops", "threading operations", 0, FF_OPT_TYPE_CONST, FF_DEBUG_THREADS, INT_MIN, INT_MAX, V|D, "debug"}, {"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|D, "debug_mv"}, {"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, {"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, @@ -431,6 +432,9 @@ static const AVOption options[]={ {"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"}, {NULL}, }; diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 1628b21a1f..00e419bf0c 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2004 Roman Shaposhnik + * Copyright (c) 2008 Alexander Strange (astrange@ithinksw.com) * * Many thanks to Steven M. Schultz for providing clever ideas and * to Michael Niedermayer for writing initial @@ -21,9 +22,17 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + * @file + * Multithreading support functions + * @see doc/multithreading.txt + */ + #include #include "avcodec.h" +#include "thread.h" typedef int (action_func)(AVCodecContext *c, void *arg); typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr); @@ -45,6 +54,78 @@ typedef struct ThreadContext { int done; } ThreadContext; +/// Max number of frame buffers that can be allocated when using frame threads. +#define MAX_BUFFERS 32 + +/** + * Context used by codec threads and stored in their AVCodecContext thread_opaque. + */ +typedef struct PerThreadContext { + struct FrameThreadContext *parent; + + pthread_t thread; + pthread_cond_t input_cond; ///< Used to wait for a new packet from the main thread. + pthread_cond_t progress_cond; ///< Used by child threads to wait for progress to change. + pthread_cond_t output_cond; ///< Used by the main thread to wait for frames to finish. + + pthread_mutex_t mutex; ///< Mutex used to protect the contents of the PerThreadContext. + pthread_mutex_t progress_mutex; ///< Mutex used to protect frame progress values and progress_cond. + + AVCodecContext *avctx; ///< Context used to decode packets passed to this thread. + + AVPacket avpkt; ///< Input packet (for decoding) or output (for encoding). + int allocated_buf_size; ///< Size allocated for avpkt.data + + AVFrame frame; ///< Output frame (for decoding) or input (for encoding). + int got_frame; ///< The output of got_picture_ptr from the last avcodec_decode_video() call. + int result; ///< The result of the last codec decode/encode() call. + + enum { + STATE_INPUT_READY, ///< Set when the thread is awaiting a packet. + STATE_SETTING_UP, ///< Set before the codec has called ff_thread_finish_setup(). + STATE_GET_BUFFER, /**< + * Set when the codec calls get_buffer(). + * State is returned to STATE_SETTING_UP afterwards. + */ + STATE_SETUP_FINISHED ///< Set after the codec has called ff_thread_finish_setup(). + } state; + + /** + * Array of frames passed to ff_thread_release_buffer(). + * Frames are released after all threads referencing them are finished. + */ + AVFrame released_buffers[MAX_BUFFERS]; + int num_released_buffers; + + /** + * Array of progress values used by ff_thread_get_buffer(). + */ + int progress[MAX_BUFFERS][2]; + uint8_t progress_used[MAX_BUFFERS]; + + AVFrame *requested_frame; ///< AVFrame the codec passed to get_buffer() +} PerThreadContext; + +/** + * Context stored in the client AVCodecContext thread_opaque. + */ +typedef struct FrameThreadContext { + PerThreadContext *threads; ///< The contexts for each thread. + PerThreadContext *prev_thread; ///< The last thread submit_packet() was called on. + + pthread_mutex_t buffer_mutex; ///< Mutex used to protect get/release_buffer(). + + int next_decoding; ///< The next context to submit a packet to. + int next_finished; ///< The next context to return output from. + + int delaying; /**< + * Set for the first N packets, where N is the number of threads. + * While it is set, ff_thread_en/decode_frame won't return any results. + */ + + int die; ///< Set when threads should exit. +} FrameThreadContext; + static void* attribute_align_arg worker(void *v) { AVCodecContext *avctx = v; @@ -84,7 +165,7 @@ static av_always_inline void avcodec_thread_park_workers(ThreadContext *c, int t pthread_mutex_unlock(&c->current_job_lock); } -void avcodec_thread_free(AVCodecContext *avctx) +static void thread_free(AVCodecContext *avctx) { ThreadContext *c = avctx->thread_opaque; int i; @@ -109,6 +190,9 @@ static int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void ThreadContext *c= avctx->thread_opaque; int dummy_ret; + if (!(avctx->active_thread_type&FF_THREAD_SLICE) || avctx->thread_count <= 1) + return avcodec_default_execute(avctx, func, arg, ret, job_count, job_size); + if (job_count <= 0) return 0; @@ -140,12 +224,11 @@ static int avcodec_thread_execute2(AVCodecContext *avctx, action_func2* func2, v return avcodec_thread_execute(avctx, NULL, arg, ret, job_count, 0); } -int avcodec_thread_init(AVCodecContext *avctx, int thread_count) +static int thread_init(AVCodecContext *avctx) { int i; ThreadContext *c; - - avctx->thread_count = thread_count; + int thread_count = avctx->thread_count; if (thread_count <= 1) return 0; @@ -184,3 +267,634 @@ int avcodec_thread_init(AVCodecContext *avctx, int thread_count) avctx->execute2 = avcodec_thread_execute2; return 0; } + +/** + * Codec worker thread. + * + * Automatically calls ff_thread_finish_setup() if the codec does + * not provide an update_thread_context method, or if the codec returns + * before calling it. + */ +static attribute_align_arg void *frame_worker_thread(void *arg) +{ + PerThreadContext *p = arg; + FrameThreadContext *fctx = p->parent; + AVCodecContext *avctx = p->avctx; + AVCodec *codec = avctx->codec; + + while (1) { + if (p->state == STATE_INPUT_READY && !fctx->die) { + pthread_mutex_lock(&p->mutex); + while (p->state == STATE_INPUT_READY && !fctx->die) + pthread_cond_wait(&p->input_cond, &p->mutex); + pthread_mutex_unlock(&p->mutex); + } + + if (fctx->die) break; + + if (!codec->update_thread_context) ff_thread_finish_setup(avctx); + + pthread_mutex_lock(&p->mutex); + avcodec_get_frame_defaults(&p->frame); + p->got_frame = 0; + p->result = codec->decode(avctx, &p->frame, &p->got_frame, &p->avpkt); + + if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx); + + p->state = STATE_INPUT_READY; + + pthread_mutex_lock(&p->progress_mutex); + pthread_cond_signal(&p->output_cond); + pthread_mutex_unlock(&p->progress_mutex); + + pthread_mutex_unlock(&p->mutex); + } + + return NULL; +} + +/** + * Updates the next thread's AVCodecContext with values from the reference thread's context. + * + * @param dst The destination context. + * @param src The source context. + * @param for_user 0 if the destination is a codec thread, 1 if the destination is the user's thread + */ +static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, int for_user) +{ + int err = 0; + + if (dst != src) { + dst->sub_id = src->sub_id; + dst->time_base = src->time_base; + dst->width = src->width; + dst->height = src->height; + dst->pix_fmt = src->pix_fmt; + + dst->has_b_frames = src->has_b_frames; + dst->idct_algo = src->idct_algo; + dst->slice_count = src->slice_count; + + dst->bits_per_coded_sample = src->bits_per_coded_sample; + dst->sample_aspect_ratio = src->sample_aspect_ratio; + dst->dtg_active_format = src->dtg_active_format; + + dst->profile = src->profile; + dst->level = src->level; + + dst->bits_per_raw_sample = src->bits_per_raw_sample; + dst->ticks_per_frame = src->ticks_per_frame; + dst->color_primaries = src->color_primaries; + + dst->color_trc = src->color_trc; + dst->colorspace = src->colorspace; + dst->color_range = src->color_range; + dst->chroma_sample_location = src->chroma_sample_location; + } + + if (for_user) { + dst->coded_frame = src->coded_frame; + dst->has_b_frames += src->thread_count - 1; + } else { + if (dst->codec->update_thread_context) + err = dst->codec->update_thread_context(dst, src); + } + + return err; +} + +/** + * Update the next thread's AVCodecContext with values set by the user. + * + * @param dst The destination context. + * @param src The source context. + */ +static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src) +{ +#define copy_fields(s, e) memcpy(&dst->s, &src->s, (char*)&dst->e - (char*)&dst->s); + dst->flags = src->flags; + + dst->draw_horiz_band= src->draw_horiz_band; + dst->get_buffer = src->get_buffer; + dst->release_buffer = src->release_buffer; + + dst->opaque = src->opaque; + dst->hurry_up = src->hurry_up; + dst->dsp_mask = src->dsp_mask; + dst->debug = src->debug; + dst->debug_mv = src->debug_mv; + + dst->slice_flags = src->slice_flags; + dst->flags2 = src->flags2; + + copy_fields(skip_loop_filter, bidir_refine); + + dst->frame_number = src->frame_number; + dst->reordered_opaque = src->reordered_opaque; +#undef copy_fields +} + +static void free_progress(AVFrame *f) +{ + PerThreadContext *p = f->owner->thread_opaque; + int *progress = f->thread_opaque; + + p->progress_used[(progress - p->progress[0]) / 2] = 0; +} + +/// Releases the buffers that this decoding thread was the last user of. +static void release_delayed_buffers(PerThreadContext *p) +{ + FrameThreadContext *fctx = p->parent; + + while (p->num_released_buffers > 0) { + AVFrame *f = &p->released_buffers[--p->num_released_buffers]; + + pthread_mutex_lock(&fctx->buffer_mutex); + free_progress(f); + f->thread_opaque = NULL; + + f->owner->release_buffer(f->owner, f); + pthread_mutex_unlock(&fctx->buffer_mutex); + } +} + +static int submit_packet(PerThreadContext *p, AVPacket *avpkt) +{ + FrameThreadContext *fctx = p->parent; + PerThreadContext *prev_thread = fctx->prev_thread; + AVCodec *codec = p->avctx->codec; + uint8_t *buf = p->avpkt.data; + + if (!avpkt->size && !(codec->capabilities & CODEC_CAP_DELAY)) return 0; + + pthread_mutex_lock(&p->mutex); + + release_delayed_buffers(p); + + if (prev_thread) { + int err; + if (prev_thread->state == STATE_SETTING_UP) { + pthread_mutex_lock(&prev_thread->progress_mutex); + while (prev_thread->state == STATE_SETTING_UP) + pthread_cond_wait(&prev_thread->progress_cond, &prev_thread->progress_mutex); + pthread_mutex_unlock(&prev_thread->progress_mutex); + } + + err = update_context_from_thread(p->avctx, prev_thread->avctx, 0); + if (err) { + pthread_mutex_unlock(&p->mutex); + return err; + } + } + + av_fast_malloc(&buf, &p->allocated_buf_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); + p->avpkt = *avpkt; + p->avpkt.data = buf; + memcpy(buf, avpkt->data, avpkt->size); + memset(buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + + p->state = STATE_SETTING_UP; + pthread_cond_signal(&p->input_cond); + pthread_mutex_unlock(&p->mutex); + + /* + * If the client doesn't have a thread-safe get_buffer(), + * then decoding threads call back to the main thread, + * and it calls back to the client here. + */ + + if (!p->avctx->thread_safe_callbacks && + p->avctx->get_buffer != avcodec_default_get_buffer) { + while (p->state != STATE_SETUP_FINISHED && p->state != STATE_INPUT_READY) { + pthread_mutex_lock(&p->progress_mutex); + while (p->state == STATE_SETTING_UP) + pthread_cond_wait(&p->progress_cond, &p->progress_mutex); + + if (p->state == STATE_GET_BUFFER) { + p->result = p->avctx->get_buffer(p->avctx, p->requested_frame); + p->state = STATE_SETTING_UP; + pthread_cond_signal(&p->progress_cond); + } + pthread_mutex_unlock(&p->progress_mutex); + } + } + + fctx->prev_thread = p; + + return 0; +} + +int ff_thread_decode_frame(AVCodecContext *avctx, + AVFrame *picture, int *got_picture_ptr, + AVPacket *avpkt) +{ + FrameThreadContext *fctx = avctx->thread_opaque; + int finished = fctx->next_finished; + PerThreadContext *p; + int err; + + /* + * Submit a packet to the next decoding thread. + */ + + p = &fctx->threads[fctx->next_decoding]; + update_context_from_user(p->avctx, avctx); + err = submit_packet(p, avpkt); + if (err) return err; + + fctx->next_decoding++; + + /* + * If we're still receiving the initial packets, don't return a frame. + */ + + if (fctx->delaying && avpkt->size) { + if (fctx->next_decoding >= (avctx->thread_count-1)) fctx->delaying = 0; + + *got_picture_ptr=0; + return 0; + } + + /* + * Return the next available frame from the oldest thread. + * If we're at the end of the stream, then we have to skip threads that + * didn't output a frame, because we don't want to accidentally signal + * EOF (avpkt->size == 0 && *got_picture_ptr == 0). + */ + + do { + p = &fctx->threads[finished++]; + + if (p->state != STATE_INPUT_READY) { + pthread_mutex_lock(&p->progress_mutex); + while (p->state != STATE_INPUT_READY) + pthread_cond_wait(&p->output_cond, &p->progress_mutex); + pthread_mutex_unlock(&p->progress_mutex); + } + + *picture = p->frame; + *got_picture_ptr = p->got_frame; + picture->pkt_dts = p->avpkt.dts; + + /* + * A later call with avkpt->size == 0 may loop over all threads, + * including this one, searching for a frame to return before being + * stopped by the "finished != fctx->next_finished" condition. + * Make sure we don't mistakenly return the same frame again. + */ + p->got_frame = 0; + + if (finished >= avctx->thread_count) finished = 0; + } while (!avpkt->size && !*got_picture_ptr && finished != fctx->next_finished); + + update_context_from_thread(avctx, p->avctx, 1); + + if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0; + + fctx->next_finished = finished; + + return p->result; +} + +void ff_thread_report_progress(AVFrame *f, int n, int field) +{ + PerThreadContext *p; + int *progress = f->thread_opaque; + + if (!progress || progress[field] >= n) return; + + p = f->owner->thread_opaque; + + if (f->owner->debug&FF_DEBUG_THREADS) + av_log(f->owner, AV_LOG_DEBUG, "%p finished %d field %d\n", progress, n, field); + + pthread_mutex_lock(&p->progress_mutex); + progress[field] = n; + pthread_cond_broadcast(&p->progress_cond); + pthread_mutex_unlock(&p->progress_mutex); +} + +void ff_thread_await_progress(AVFrame *f, int n, int field) +{ + PerThreadContext *p; + int *progress = f->thread_opaque; + + if (!progress || progress[field] >= n) return; + + p = f->owner->thread_opaque; + + if (f->owner->debug&FF_DEBUG_THREADS) + av_log(f->owner, AV_LOG_DEBUG, "thread awaiting %d field %d from %p\n", n, field, progress); + + pthread_mutex_lock(&p->progress_mutex); + while (progress[field] < n) + pthread_cond_wait(&p->progress_cond, &p->progress_mutex); + pthread_mutex_unlock(&p->progress_mutex); +} + +void ff_thread_finish_setup(AVCodecContext *avctx) { + PerThreadContext *p = avctx->thread_opaque; + + if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return; + + pthread_mutex_lock(&p->progress_mutex); + p->state = STATE_SETUP_FINISHED; + pthread_cond_broadcast(&p->progress_cond); + pthread_mutex_unlock(&p->progress_mutex); +} + +/// Waits for all threads to finish. +static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count) +{ + int i; + + for (i = 0; i < thread_count; i++) { + PerThreadContext *p = &fctx->threads[i]; + + if (p->state != STATE_INPUT_READY) { + pthread_mutex_lock(&p->progress_mutex); + while (p->state != STATE_INPUT_READY) + pthread_cond_wait(&p->output_cond, &p->progress_mutex); + pthread_mutex_unlock(&p->progress_mutex); + } + } +} + +static void frame_thread_free(AVCodecContext *avctx, int thread_count) +{ + FrameThreadContext *fctx = avctx->thread_opaque; + AVCodec *codec = avctx->codec; + int i; + + park_frame_worker_threads(fctx, thread_count); + + if (fctx->prev_thread) + update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0); + + fctx->die = 1; + + for (i = 0; i < thread_count; i++) { + PerThreadContext *p = &fctx->threads[i]; + + pthread_mutex_lock(&p->mutex); + pthread_cond_signal(&p->input_cond); + pthread_mutex_unlock(&p->mutex); + + pthread_join(p->thread, NULL); + + if (codec->close) + codec->close(p->avctx); + + avctx->codec = NULL; + + release_delayed_buffers(p); + } + + for (i = 0; i < thread_count; i++) { + PerThreadContext *p = &fctx->threads[i]; + + avcodec_default_free_buffers(p->avctx); + + pthread_mutex_destroy(&p->mutex); + pthread_mutex_destroy(&p->progress_mutex); + pthread_cond_destroy(&p->input_cond); + pthread_cond_destroy(&p->progress_cond); + pthread_cond_destroy(&p->output_cond); + av_freep(&p->avpkt.data); + + if (i) + av_freep(&p->avctx->priv_data); + + av_freep(&p->avctx); + } + + av_freep(&fctx->threads); + pthread_mutex_destroy(&fctx->buffer_mutex); + av_freep(&avctx->thread_opaque); +} + +static int frame_thread_init(AVCodecContext *avctx) +{ + int thread_count = avctx->thread_count; + AVCodec *codec = avctx->codec; + AVCodecContext *src = avctx; + FrameThreadContext *fctx; + int i, err = 0; + + avctx->thread_opaque = fctx = av_mallocz(sizeof(FrameThreadContext)); + + fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count); + pthread_mutex_init(&fctx->buffer_mutex, NULL); + fctx->delaying = 1; + + for (i = 0; i < thread_count; i++) { + AVCodecContext *copy = av_malloc(sizeof(AVCodecContext)); + PerThreadContext *p = &fctx->threads[i]; + + pthread_mutex_init(&p->mutex, NULL); + pthread_mutex_init(&p->progress_mutex, NULL); + pthread_cond_init(&p->input_cond, NULL); + pthread_cond_init(&p->progress_cond, NULL); + pthread_cond_init(&p->output_cond, NULL); + + p->parent = fctx; + p->avctx = copy; + + *copy = *src; + copy->thread_opaque = p; + copy->pkt = &p->avpkt; + + if (!i) { + src = copy; + + if (codec->init) + err = codec->init(copy); + + update_context_from_thread(avctx, copy, 1); + } else { + copy->is_copy = 1; + copy->priv_data = av_malloc(codec->priv_data_size); + memcpy(copy->priv_data, src->priv_data, codec->priv_data_size); + + if (codec->init_thread_copy) + err = codec->init_thread_copy(copy); + } + + if (err) goto error; + + pthread_create(&p->thread, NULL, frame_worker_thread, p); + } + + return 0; + +error: + frame_thread_free(avctx, i+1); + + return err; +} + +void ff_thread_flush(AVCodecContext *avctx) +{ + FrameThreadContext *fctx = avctx->thread_opaque; + + if (!avctx->thread_opaque) return; + + park_frame_worker_threads(fctx, avctx->thread_count); + + if (fctx->prev_thread) + update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0); + + fctx->next_decoding = fctx->next_finished = 0; + fctx->delaying = 1; + fctx->prev_thread = NULL; +} + +static int *allocate_progress(PerThreadContext *p) +{ + int i; + + for (i = 0; i < MAX_BUFFERS; i++) + if (!p->progress_used[i]) break; + + if (i == MAX_BUFFERS) { + av_log(p->avctx, AV_LOG_ERROR, "allocate_progress() overflow\n"); + return NULL; + } + + p->progress_used[i] = 1; + + return p->progress[i]; +} + +int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) +{ + PerThreadContext *p = avctx->thread_opaque; + int *progress, err; + + f->owner = avctx; + + if (!(avctx->active_thread_type&FF_THREAD_FRAME)) { + f->thread_opaque = NULL; + return avctx->get_buffer(avctx, f); + } + + if (p->state != STATE_SETTING_UP) { + av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); + return -1; + } + + pthread_mutex_lock(&p->parent->buffer_mutex); + f->thread_opaque = progress = allocate_progress(p); + + if (!progress) { + pthread_mutex_unlock(&p->parent->buffer_mutex); + return -1; + } + + progress[0] = + progress[1] = -1; + + if (avctx->thread_safe_callbacks || + avctx->get_buffer == avcodec_default_get_buffer) { + err = avctx->get_buffer(avctx, f); + } else { + p->requested_frame = f; + p->state = STATE_GET_BUFFER; + pthread_mutex_lock(&p->progress_mutex); + pthread_cond_signal(&p->progress_cond); + + while (p->state != STATE_SETTING_UP) + pthread_cond_wait(&p->progress_cond, &p->progress_mutex); + + err = p->result; + + pthread_mutex_unlock(&p->progress_mutex); + } + + pthread_mutex_unlock(&p->parent->buffer_mutex); + + /* + * Buffer age is difficult to keep track of between + * multiple threads, and the optimizations it allows + * are not worth the effort. It is disabled for now. + */ + f->age = INT_MAX; + + return err; +} + +void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f) +{ + PerThreadContext *p = avctx->thread_opaque; + + if (!(avctx->active_thread_type&FF_THREAD_FRAME)) { + avctx->release_buffer(avctx, f); + return; + } + + if (p->num_released_buffers >= MAX_BUFFERS) { + av_log(p->avctx, AV_LOG_ERROR, "too many thread_release_buffer calls!\n"); + return; + } + + if(avctx->debug & FF_DEBUG_BUFFERS) + av_log(avctx, AV_LOG_DEBUG, "thread_release_buffer called on pic %p, %d buffers used\n", + f, f->owner->internal_buffer_count); + + p->released_buffers[p->num_released_buffers++] = *f; + memset(f->data, 0, sizeof(f->data)); +} + +/** + * Set the threading algorithms used. + * + * Threading requires more than one thread. + * Frame threading requires entire frames to be passed to the codec, + * and introduces extra decoding delay, so is incompatible with low_delay. + * + * @param avctx The context. + */ +static void validate_thread_parameters(AVCodecContext *avctx) +{ + int frame_threading_supported = (avctx->codec->capabilities & CODEC_CAP_FRAME_THREADS) + && !(avctx->flags & CODEC_FLAG_TRUNCATED) + && !(avctx->flags & CODEC_FLAG_LOW_DELAY) + && !(avctx->flags2 & CODEC_FLAG2_CHUNKS); + if (avctx->thread_count == 1) { + avctx->active_thread_type = 0; + } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) { + avctx->active_thread_type = FF_THREAD_FRAME; + } else { + avctx->active_thread_type = FF_THREAD_SLICE; + } +} + +int avcodec_thread_init(AVCodecContext *avctx, int thread_count) +{ + if (avctx->thread_opaque) { + av_log(avctx, AV_LOG_ERROR, "avcodec_thread_init is ignored after avcodec_open\n"); + return -1; + } + + avctx->thread_count = FFMAX(1, thread_count); + + if (avctx->codec) { + validate_thread_parameters(avctx); + + if (avctx->active_thread_type&FF_THREAD_SLICE) + return thread_init(avctx); + else if (avctx->active_thread_type&FF_THREAD_FRAME) + return frame_thread_init(avctx); + } + + return 0; +} + +void avcodec_thread_free(AVCodecContext *avctx) +{ + if (avctx->active_thread_type&FF_THREAD_FRAME) + frame_thread_free(avctx, avctx->thread_count); + else + thread_free(avctx); +} diff --git a/libavcodec/thread.h b/libavcodec/thread.h new file mode 100644 index 0000000000..d9186d6850 --- /dev/null +++ b/libavcodec/thread.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2008 Alexander Strange + * + * 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 + * Multithreading support functions + * @author Alexander Strange + */ + +#ifndef AVCODEC_THREAD_H +#define AVCODEC_THREAD_H + +#include "config.h" +#include "avcodec.h" + +/** + * 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. + * 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); + +/** + * If the codec defines update_thread_context(), 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, or call ff_thread_get_buffer(). + * + * @param avctx The context. + */ +void ff_thread_finish_setup(AVCodecContext *avctx); + +/** + * Notifies later decoding threads when part of their reference picture + * is ready. + * Call this when some part of the picture is finished decoding. + * Later calls with lower values of progress have no effect. + * + * @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); + +/** + * Waits for earlier decoding threads to finish reference pictures + * Call this before accessing some part of a picture, with a given + * value for progress, and it will return after the responsible decoding + * thread calls ff_thread_report_progress() with the same or + * higher value for progress. + * + * @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); + +/** + * Wrapper around get_buffer() for frame-multithreaded codecs. + * Call this function instead of avctx->get_buffer(f). + * Cannot be called after the codec has called ff_thread_finish_setup(). + * + * @param avctx The current context. + * @param f The frame to write into. + */ +int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f); + +/** + * Wrapper around release_buffer() frame-for multithreaded codecs. + * Call this function instead of avctx->release_buffer(f). + * The AVFrame will be copied and the actual release_buffer() call + * will be performed later. The contents of data pointed to by the + * AVFrame should not be changed until ff_thread_get_buffer() is called + * on it. + * + * @param avctx The current context. + * @param f The picture being released. + */ +void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f); + +#endif /* AVCODEC_THREAD_H */ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e9db33e9d7..529369bd2a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -37,6 +37,7 @@ #include "dsputil.h" #include "libavutil/opt.h" #include "imgconvert.h" +#include "thread.h" #include "audioconvert.h" #include "internal.h" #include @@ -261,6 +262,11 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ (*picture_number)++; if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt)){ + if(s->active_thread_type&FF_THREAD_FRAME) { + av_log_missing_feature(s, "Width/height changing with frame threads is", 0); + return -1; + } + for(i=0; i<4; i++){ av_freep(&buf->base[i]); buf->data[i]= NULL; @@ -532,13 +538,21 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) goto free_and_end; } avctx->frame_number = 0; + + if (HAVE_THREADS && !avctx->thread_opaque) { + ret = avcodec_thread_init(avctx, avctx->thread_count); + if (ret < 0) { + 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; } - if(avctx->codec->init){ + if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ ret = avctx->codec->init(avctx); if (ret < 0) { goto free_and_end; @@ -636,14 +650,18 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi avctx->pkt = avpkt; - if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){ - ret = avctx->codec->decode(avctx, picture, got_picture_ptr, - avpkt); + if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type&FF_THREAD_FRAME)){ + if (HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME) + ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr, + avpkt); + else { + ret = avctx->codec->decode(avctx, picture, got_picture_ptr, + avpkt); + picture->pkt_dts= avpkt->dts; + } emms_c(); //needed to avoid an emms_c() call before every return; - picture->pkt_dts= avpkt->dts; - if (*got_picture_ptr) avctx->frame_number++; }else @@ -768,6 +786,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) if(avctx->codec && avctx->codec->encode) av_freep(&avctx->extradata); avctx->codec = NULL; + avctx->active_thread_type = 0; entangled_thread_counter--; /* Release any user-supplied mutex. */ @@ -1029,6 +1048,8 @@ void avcodec_init(void) void avcodec_flush_buffers(AVCodecContext *avctx) { + if(HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME) + ff_thread_flush(avctx); if(avctx->codec->flush) avctx->codec->flush(avctx); } @@ -1229,3 +1250,30 @@ unsigned int ff_toupper4(unsigned int x) + (toupper((x>>16)&0xFF)<<16) + (toupper((x>>24)&0xFF)<<24); } + +#if !HAVE_PTHREADS + +int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) +{ + f->owner = avctx; + return avctx->get_buffer(avctx, f); +} + +void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f) +{ + f->owner->release_buffer(f->owner, f); +} + +void ff_thread_finish_setup(AVCodecContext *avctx) +{ +} + +void ff_thread_report_progress(AVFrame *f, int progress, int field) +{ +} + +void ff_thread_await_progress(AVFrame *f, int progress, int field) +{ +} + +#endif diff --git a/libavcodec/w32thread.c b/libavcodec/w32thread.c index f7a1430647..007508e409 100644 --- a/libavcodec/w32thread.c +++ b/libavcodec/w32thread.c @@ -129,7 +129,13 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count){ ThreadContext *c; uint32_t threadid; + if(!(s->thread_type & FF_THREAD_SLICE)){ + av_log(s, AV_LOG_WARNING, "The requested thread algorithm is not supported with this thread library.\n"); + return 0; + } + s->thread_count= thread_count; + s->active_thread_type= FF_THREAD_SLICE; if (thread_count <= 1) return 0; diff --git a/libavformat/utils.c b/libavformat/utils.c index 8c3311f3bc..c21b922401 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -930,6 +930,12 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, /* do we have a video B-frame ? */ delay= st->codec->has_b_frames; presentation_delayed = 0; + + // ignore delay caused by frame threading so that the mpeg2-without-dts + // warning will not trigger + if (delay && st->codec->active_thread_type&FF_THREAD_FRAME) + delay -= st->codec->thread_count-1; + /* XXX: need has_b_frame, but cannot get it if the codec is not initialized */ if (delay && diff --git a/libavutil/internal.h b/libavutil/internal.h index 36d3e719f6..4c98a1299f 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -210,4 +210,15 @@ type ff_##name args #endif +/** + * Returns NULL if a threading library has not been enabled. + * Used to disable threading functions in AVCodec definitions + * when not needed. + */ +#if HAVE_THREADS +# define ONLY_IF_THREADS_ENABLED(x) x +#else +# define ONLY_IF_THREADS_ENABLED(x) NULL +#endif + #endif /* AVUTIL_INTERNAL_H */ From 8e8cc52be3b515bc91cd9452daca7a65feaea5ad Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 9 Feb 2011 07:49:49 -0500 Subject: [PATCH 284/528] Add missing git rev hash. --- doc/APIchanges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index f14616e16c..c9f4213ec0 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,7 +13,7 @@ libavutil: 2009-03-08 API changes, most recent first: -2011-02-09 - XXXXXXX - lavc 52.111.0 - threading API +2011-02-09 - 778b08a - lavc 52.111.0 - threading API Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/ release_buffer()/draw_horiz_band() callbacks for appropriate codecs. Add thread_type and active_thread_type fields to AVCodecContext. From c0b102ca03fe92250f1ce620aec3836f529fc1d6 Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Mon, 7 Feb 2011 21:15:45 -0500 Subject: [PATCH 285/528] Deprecate avcodec_thread_init() As a side effect of the last commit, avcodec_open() now calls it automatically, so there is no longer any need for clients to call it. Instead they should set AVCodecContext.thread_count. avcodec_thread_free() is deprecated, and will be removed from avcodec.h at the next MAJOR libavcodec bump. Rename the functions to ff_thread_init/free, since they are now internal. Wrappers are provided to maintain API compatibility. Signed-off-by: Ronald S. Bultje --- doc/APIchanges | 4 ++++ ffmpeg.c | 11 +++-------- ffplay.c | 2 +- libavcodec/avcodec.h | 8 +++++++- libavcodec/pthread.c | 6 +++--- libavcodec/thread.h | 3 +++ libavcodec/utils.c | 20 +++++++++++++++++--- libavcodec/w32thread.c | 8 ++++---- 8 files changed, 42 insertions(+), 20 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index c9f4213ec0..21b4de1ecb 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,10 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-09 - XXXXXXX - lavc 52.112.0 - avcodec_thread_init() + Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead + set thread_count before calling avcodec_open. + 2011-02-09 - 778b08a - lavc 52.111.0 - threading API Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/ release_buffer()/draw_horiz_band() callbacks for appropriate codecs. diff --git a/ffmpeg.c b/ffmpeg.c index f78e658809..85149a7935 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -698,11 +698,6 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) choose_pixel_fmt(st, codec); } - if(!st->codec->thread_count) - st->codec->thread_count = 1; - if(st->codec->thread_count>1) - avcodec_thread_init(st->codec, st->codec->thread_count); - if(st->codec->flags & CODEC_FLAG_BITEXACT) nopts = 1; @@ -3236,7 +3231,7 @@ static void opt_input_file(const char *filename) for(i=0;inb_streams;i++) { AVStream *st = ic->streams[i]; AVCodecContext *dec = st->codec; - avcodec_thread_init(dec, thread_count); + dec->thread_count = 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: @@ -3394,7 +3389,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) ost->bitstream_filters = video_bitstream_filters; video_bitstream_filters= NULL; - avcodec_thread_init(st->codec, thread_count); + st->codec->thread_count= thread_count; video_enc = st->codec; @@ -3541,7 +3536,7 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) ost->bitstream_filters = audio_bitstream_filters; audio_bitstream_filters= NULL; - avcodec_thread_init(st->codec, thread_count); + st->codec->thread_count= thread_count; audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/ffplay.c b/ffplay.c index 157fd7f255..170acfd42b 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2260,7 +2260,7 @@ static int stream_component_open(VideoState *is, int stream_index) avctx->skip_loop_filter= skip_loop_filter; avctx->error_recognition= error_recognition; avctx->error_concealment= error_concealment; - avcodec_thread_init(avctx, thread_count); + avctx->thread_count= thread_count; set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0, codec); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 9692288a16..3a107841fd 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -32,7 +32,7 @@ #include "libavutil/cpu.h" #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 111 +#define LIBAVCODEC_VERSION_MINOR 112 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -3637,8 +3637,14 @@ int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h); enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); +#if LIBAVCODEC_VERSION_MAJOR < 53 +/** + * @deprecated Set s->thread_count before calling avcodec_open() instead of calling this. + */ +attribute_deprecated int avcodec_thread_init(AVCodecContext *s, int thread_count); void avcodec_thread_free(AVCodecContext *s); +#endif int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 00e419bf0c..0e033d37c0 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -256,7 +256,7 @@ static int thread_init(AVCodecContext *avctx) if(pthread_create(&c->workers[i], NULL, worker, avctx)) { avctx->thread_count = i; pthread_mutex_unlock(&c->current_job_lock); - avcodec_thread_free(avctx); + ff_thread_free(avctx); return -1; } } @@ -870,7 +870,7 @@ static void validate_thread_parameters(AVCodecContext *avctx) } } -int avcodec_thread_init(AVCodecContext *avctx, int thread_count) +int ff_thread_init(AVCodecContext *avctx, int thread_count) { if (avctx->thread_opaque) { av_log(avctx, AV_LOG_ERROR, "avcodec_thread_init is ignored after avcodec_open\n"); @@ -891,7 +891,7 @@ int avcodec_thread_init(AVCodecContext *avctx, int thread_count) return 0; } -void avcodec_thread_free(AVCodecContext *avctx) +void ff_thread_free(AVCodecContext *avctx) { if (avctx->active_thread_type&FF_THREAD_FRAME) frame_thread_free(avctx, avctx->thread_count); diff --git a/libavcodec/thread.h b/libavcodec/thread.h index d9186d6850..485f4ec188 100644 --- a/libavcodec/thread.h +++ b/libavcodec/thread.h @@ -108,4 +108,7 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f); */ void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f); +int ff_thread_init(AVCodecContext *s, int thread_count); +void ff_thread_free(AVCodecContext *s); + #endif /* AVCODEC_THREAD_H */ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 529369bd2a..eede431e32 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -540,7 +540,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) avctx->frame_number = 0; if (HAVE_THREADS && !avctx->thread_opaque) { - ret = avcodec_thread_init(avctx, avctx->thread_count); + ret = ff_thread_init(avctx, avctx->thread_count); if (ret < 0) { goto free_and_end; } @@ -777,7 +777,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) } if (HAVE_THREADS && avctx->thread_opaque) - avcodec_thread_free(avctx); + ff_thread_free(avctx); if (avctx->codec && avctx->codec->close) avctx->codec->close(avctx); avcodec_default_free_buffers(avctx); @@ -1138,7 +1138,7 @@ int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt) { #endif #if !HAVE_THREADS -int avcodec_thread_init(AVCodecContext *s, int thread_count){ +int ff_thread_init(AVCodecContext *s, int thread_count){ s->thread_count = thread_count; return -1; } @@ -1277,3 +1277,17 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field) } #endif + +#if LIBAVCODEC_VERSION_MAJOR < 53 + +int avcodec_thread_init(AVCodecContext *s, int thread_count) +{ + return ff_thread_init(s, thread_count); +} + +void avcodec_thread_free(AVCodecContext *s) +{ + return ff_thread_free(s); +} + +#endif diff --git a/libavcodec/w32thread.c b/libavcodec/w32thread.c index 007508e409..1659fd3031 100644 --- a/libavcodec/w32thread.c +++ b/libavcodec/w32thread.c @@ -69,10 +69,10 @@ static unsigned WINAPI attribute_align_arg thread_func(void *v){ } /** - * Free what has been allocated by avcodec_thread_init(). + * Free what has been allocated by ff_thread_init(). * Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running. */ -void avcodec_thread_free(AVCodecContext *s){ +void ff_thread_free(AVCodecContext *s){ ThreadContext *c= s->thread_opaque; int i; @@ -124,7 +124,7 @@ static int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext avcodec_thread_execute(s, NULL, arg, ret, count, 0); } -int avcodec_thread_init(AVCodecContext *s, int thread_count){ +int ff_thread_init(AVCodecContext *s, int thread_count){ int i; ThreadContext *c; uint32_t threadid; @@ -169,6 +169,6 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count){ return 0; fail: - avcodec_thread_free(s); + ff_thread_free(s); return -1; } From f2146944fcd00a0a7918931c6f0f5c3f88cd6f1d Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 9 Feb 2011 07:53:06 -0500 Subject: [PATCH 286/528] Add missing git rev hash. --- doc/APIchanges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 21b4de1ecb..741ac55a42 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,7 +13,7 @@ libavutil: 2009-03-08 API changes, most recent first: -2011-02-09 - XXXXXXX - lavc 52.112.0 - avcodec_thread_init() +2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init() Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead set thread_count before calling avcodec_open. From d23845f311f04e98777612cae1b55e28923ccdc6 Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Mon, 7 Feb 2011 21:15:45 -0500 Subject: [PATCH 287/528] vp3: Frame-based multithreading support Decode times for big_buck_bunny_720p_stereo: 1 thread: real 1m14.227s user 1m13.104s sys 0m1.108s 2 threads: (33% faster) real 0m49.329s user 1m33.735s sys 0m1.834s 3 threads: (44% faster) real 0m41.593s user 1m44.884s sys 0m1.967s --- libavcodec/vp3.c | 154 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 131 insertions(+), 23 deletions(-) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index dbfacdc6f5..726f18cb92 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -40,6 +40,7 @@ #include "vp3data.h" #include "xiph.h" +#include "thread.h" #define FRAGMENT_PIXELS 8 @@ -1318,6 +1319,15 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y) int h, cy; int offset[4]; + if (HAVE_PTHREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) { + int y_flipped = s->flipped_image ? s->avctx->height-y : y; + + // 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; @@ -1339,6 +1349,28 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y) s->avctx->draw_horiz_band(s->avctx, &s->current_frame, offset, y, 3, h); } +/** + * 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 ref_row; + int border = motion_y&1; + + if (fragment->coding_method == MODE_USING_GOLDEN || + fragment->coding_method == MODE_GOLDEN_MV) + ref_frame = &s->golden_frame; + else + ref_frame = &s->last_frame; + + ref_row = y + (motion_y>>1); + ref_row = FFMAX(FFABS(ref_row), ref_row + 8 + border); + + ff_thread_await_progress(ref_frame, ref_row, 0); +} + /* * Perform the final rendering for a particular slice of data. * The slice number ranges from 0..(c_superblock_height - 1). @@ -1371,6 +1403,7 @@ static void render_slice(Vp3DecodeContext *s, int slice) 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)) @@ -1400,6 +1433,9 @@ static void render_slice(Vp3DecodeContext *s, int slice) first_pixel = 8*y*stride + 8*x; + 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) { if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) || @@ -1721,6 +1757,81 @@ vlc_fail: return -1; } +/// Release and shuffle frames after decode finishes +static void update_frames(AVCodecContext *avctx) +{ + Vp3DecodeContext *s = avctx->priv_data; + + /* release the last frame, if it is allocated and if it is not the + * golden frame */ + if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY) + ff_thread_release_buffer(avctx, &s->last_frame); + + /* shuffle frames (last = current) */ + s->last_frame= s->current_frame; + + if (s->keyframe) { + if (s->golden_frame.data[0]) + ff_thread_release_buffer(avctx, &s->golden_frame); + s->golden_frame = s->current_frame; + s->last_frame.type = FF_BUFFER_TYPE_COPY; + } + + s->current_frame.data[0]= NULL; /* ensure that we catch any access to this released frame */ +} + +static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *src) +{ + Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data; + int qps_changed = 0, i, err; + + if (!s1->current_frame.data[0] + ||s->width != s1->width + ||s->height!= s1->height) + return -1; + + if (s != s1) { + // init tables if the first frame hasn't been decoded + if (!s->current_frame.data[0]) { + int y_fragment_count, c_fragment_count; + s->avctx = dst; + err = allocate_tables(dst); + if (err) + return err; + y_fragment_count = s->fragment_width[0] * s->fragment_height[0]; + c_fragment_count = s->fragment_width[1] * s->fragment_height[1]; + memcpy(s->motion_val[0], s1->motion_val[0], y_fragment_count * sizeof(*s->motion_val[0])); + 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); + + // copy qscale data if necessary + for (i = 0; i < 3; i++) { + if (s->qps[i] != s1->qps[1]) { + qps_changed = 1; + memcpy(&s->qmat[i], &s1->qmat[i], sizeof(s->qmat[i])); + } + } + + if (s->qps[0] != s1->qps[0]) { + memcpy(&s->qscale_table, &s1->qscale_table, sizeof(s->qscale_table)); + memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array)); + } + + if (qps_changed) + copy_fields(s, s1, qps, superblock_count); +#undef copy_fields + } + + update_frames(dst); + + return 0; +} + /* * This is the ffmpeg/libavcodec API frame decode function. */ @@ -1776,7 +1887,7 @@ static int vp3_decode_frame(AVCodecContext *avctx, s->current_frame.reference = 3; s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE; - if (avctx->get_buffer(avctx, &s->current_frame) < 0) { + if (ff_thread_get_buffer(avctx, &s->current_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } @@ -1805,7 +1916,7 @@ static int vp3_decode_frame(AVCodecContext *avctx, s->golden_frame.reference = 3; s->golden_frame.pict_type = FF_I_TYPE; - if (avctx->get_buffer(avctx, &s->golden_frame) < 0) { + if (ff_thread_get_buffer(avctx, &s->golden_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } @@ -1818,6 +1929,7 @@ static int vp3_decode_frame(AVCodecContext *avctx, s->current_frame.qstride= 0; memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment)); + ff_thread_finish_setup(avctx); if (unpack_superblocks(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); @@ -1862,28 +1974,17 @@ static int vp3_decode_frame(AVCodecContext *avctx, *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; - /* release the last frame, if it is allocated and if it is not the - * golden frame */ - if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY) - avctx->release_buffer(avctx, &s->last_frame); - - /* shuffle frames (last = current) */ - s->last_frame= s->current_frame; - - if (s->keyframe) { - if (s->golden_frame.data[0]) - avctx->release_buffer(avctx, &s->golden_frame); - s->golden_frame = s->current_frame; - s->last_frame.type = FF_BUFFER_TYPE_COPY; - } - - s->current_frame.data[0]= NULL; /* ensure that we catch any access to this released frame */ + if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) + update_frames(avctx); return buf_size; error: - if (s->current_frame.data[0]) + ff_thread_report_progress(&s->current_frame, INT_MAX, 0); + + if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) avctx->release_buffer(avctx, &s->current_frame); + return -1; } @@ -1895,6 +1996,9 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) Vp3DecodeContext *s = avctx->priv_data; int i; + if (avctx->is_copy && !s->current_frame.data[0]) + return 0; + av_free(s->superblock_coding); av_free(s->all_fragments); av_free(s->coded_fragment_list[0]); @@ -1904,6 +2008,8 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) av_free(s->motion_val[0]); av_free(s->motion_val[1]); + if (avctx->is_copy) return 0; + for (i = 0; i < 16; i++) { free_vlc(&s->dc_vlc[i]); free_vlc(&s->ac_vlc_1[i]); @@ -1919,9 +2025,9 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) /* release all frames */ if (s->golden_frame.data[0]) - avctx->release_buffer(avctx, &s->golden_frame); + ff_thread_release_buffer(avctx, &s->golden_frame); if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY) - avctx->release_buffer(avctx, &s->last_frame); + ff_thread_release_buffer(avctx, &s->last_frame); /* no need to release the current_frame since it will always be pointing * to the same frame as either the golden or last frame */ @@ -2232,9 +2338,10 @@ AVCodec ff_theora_decoder = { NULL, vp3_decode_end, vp3_decode_frame, - CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND, + CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, NULL, .long_name = NULL_IF_CONFIG_SMALL("Theora"), + .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) }; #endif @@ -2247,7 +2354,8 @@ AVCodec ff_vp3_decoder = { NULL, vp3_decode_end, vp3_decode_frame, - CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND, + CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, NULL, .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"), + .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) }; From f4c79d1e0b2e797012304db57903e4091b0c2d7c Mon Sep 17 00:00:00 2001 From: Vladimir Pantelic Date: Wed, 9 Feb 2011 16:24:23 +0000 Subject: [PATCH 288/528] mpegts: remove unused macro MAX_SCAN_PACKETS Signed-off-by: Mans Rullgard --- libavformat/mpegts.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 8467e85a04..e8d82ac21c 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -33,9 +33,6 @@ #include "mpeg.h" #include "isom.h" -/* 1.0 second at 24Mbit/s */ -#define MAX_SCAN_PACKETS 32000 - /* maximum size in which we look for synchronisation if synchronisation is lost */ #define MAX_RESYNC_SIZE 65536 From 2cfa2d925808e6cc6fb7a7c133b7cb7622afd37e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Wed, 9 Feb 2011 10:52:33 -0500 Subject: [PATCH 289/528] check sample_fmt in avcodec_open check AVCodecContext->sample_fmt against AVCodec->sample_fmts[] to ensure that the encoder supports the specified sample format. Error out if it doesn't. Previously, it would continue and output garbage. Fixes issue 2587. --- libavcodec/utils.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index eede431e32..0816b39cda 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -551,6 +551,16 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) avctx->codec->max_lowres); goto free_and_end; } + if (avctx->codec->sample_fmts && avctx->codec->encode) { + int i; + for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) + if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) + break; + if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { + av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); + goto free_and_end; + } + } if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ ret = avctx->codec->init(avctx); From 4bc328a2bdf96d01afd3cf4532efb9db41f00985 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 8 Feb 2011 21:46:47 +0100 Subject: [PATCH 290/528] asf: split ASFContext into muxer and demuxer parts. Signed-off-by: Ronald S. Bultje --- libavformat/asf.h | 58 -------------------------------------------- libavformat/asfdec.c | 41 +++++++++++++++++++++++++++++++ libavformat/asfenc.c | 25 +++++++++++++++++++ 3 files changed, 66 insertions(+), 58 deletions(-) diff --git a/libavformat/asf.h b/libavformat/asf.h index 2a817dddba..e89bd28e92 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -79,64 +79,6 @@ typedef struct { uint16_t packet_count; } ASFIndex; - -typedef struct { - uint32_t seqno; - int is_streamed; - int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID - ASFStream streams[128]; ///< it's max number and it's not that big - uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming) - char stream_languages[128][6]; ///< max number of streams, language for each (RFC1766, e.g. en-US) - /* non streamed additonnal info */ - uint64_t nb_packets; ///< how many packets are there in the file, invalid if broadcasting - int64_t duration; ///< in 100ns units - /* packet filling */ - unsigned char multi_payloads_present; - int packet_size_left; - int packet_timestamp_start; - int packet_timestamp_end; - unsigned int packet_nb_payloads; - int packet_nb_frames; - uint8_t packet_buf[PACKET_SIZE]; - ByteIOContext pb; - /* only for reading */ - uint64_t data_offset; ///< beginning of the first data packet - uint64_t data_object_offset; ///< data object offset (excl. GUID & size) - uint64_t data_object_size; ///< size of the data object - int index_read; - - ASFMainHeader hdr; - - int packet_flags; - int packet_property; - int packet_timestamp; - int packet_segsizetype; - int packet_segments; - int packet_seq; - int packet_replic_size; - int packet_key_frame; - int packet_padsize; - unsigned int packet_frag_offset; - unsigned int packet_frag_size; - int64_t packet_frag_timestamp; - int packet_multi_size; - int packet_obj_size; - int packet_time_delta; - int packet_time_start; - int64_t packet_pos; - - int stream_index; - - - int64_t last_indexed_pts; - ASFIndex* index_ptr; - uint32_t nb_index_count; - uint32_t nb_index_memory_alloc; - uint16_t maximum_packet; - - ASFStream* asf_st; ///< currently decoded stream -} ASFContext; - extern const ff_asf_guid ff_asf_header; extern const ff_asf_guid ff_asf_file_header; extern const ff_asf_guid ff_asf_stream_header; diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index a73a347a51..039afdb707 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -32,6 +32,47 @@ void ff_mms_set_stream_selection(URLContext *h, AVFormatContext *format); +typedef struct { + int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID + ASFStream streams[128]; ///< it's max number and it's not that big + uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming) + char stream_languages[128][6]; ///< max number of streams, language for each (RFC1766, e.g. en-US) + /* non streamed additonnal info */ + uint64_t nb_packets; ///< how many packets are there in the file, invalid if broadcasting + /* packet filling */ + int packet_size_left; + int packet_nb_frames; + /* only for reading */ + uint64_t data_offset; ///< beginning of the first data packet + uint64_t data_object_offset; ///< data object offset (excl. GUID & size) + uint64_t data_object_size; ///< size of the data object + int index_read; + + ASFMainHeader hdr; + + int packet_flags; + int packet_property; + int packet_timestamp; + int packet_segsizetype; + int packet_segments; + int packet_seq; + int packet_replic_size; + int packet_key_frame; + int packet_padsize; + unsigned int packet_frag_offset; + unsigned int packet_frag_size; + int64_t packet_frag_timestamp; + int packet_multi_size; + int packet_obj_size; + int packet_time_delta; + int packet_time_start; + int64_t packet_pos; + + int stream_index; + + ASFStream* asf_st; ///< currently decoded stream +} ASFContext; + #undef NDEBUG #include diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index b8f8635603..709080fbbb 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -188,6 +188,31 @@ 2*PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS \ ) +typedef struct { + uint32_t seqno; + int is_streamed; + ASFStream streams[128]; ///< it's max number and it's not that big + /* non streamed additonnal info */ + uint64_t nb_packets; ///< how many packets are there in the file, invalid if broadcasting + int64_t duration; ///< in 100ns units + /* packet filling */ + unsigned char multi_payloads_present; + int packet_size_left; + int packet_timestamp_start; + int packet_timestamp_end; + unsigned int packet_nb_payloads; + uint8_t packet_buf[PACKET_SIZE]; + ByteIOContext pb; + /* only for reading */ + uint64_t data_offset; ///< beginning of the first data packet + + int64_t last_indexed_pts; + ASFIndex* index_ptr; + uint32_t nb_index_count; + uint32_t nb_index_memory_alloc; + uint16_t maximum_packet; +} ASFContext; + static const AVCodecTag codec_asf_bmp_tags[] = { { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') }, { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') }, From aef669cdfd984a737ad876b33ee1b160f87f5f9a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 9 Feb 2011 20:12:57 +0000 Subject: [PATCH 291/528] w32thread: add missing #include thread.h This should fix building with win32 threads. Signed-off-by: Mans Rullgard --- libavcodec/w32thread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/w32thread.c b/libavcodec/w32thread.c index 1659fd3031..f2b8f5b365 100644 --- a/libavcodec/w32thread.c +++ b/libavcodec/w32thread.c @@ -20,6 +20,7 @@ //#define DEBUG #include "avcodec.h" +#include "thread.h" #define WIN32_LEAN_AND_MEAN #include From 9a77a92c2b6855781d2a4cfab14c67ae4025760c Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 9 Feb 2011 20:15:25 +0000 Subject: [PATCH 292/528] Fix build with threading disabled The avcodec_thread_free() compatibility wrapper calls ff_thread_free(), which is not defined when threading is disabled. Make this call conditional. Signed-off-by: Mans Rullgard --- libavcodec/utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 0816b39cda..03018b894f 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1297,7 +1297,9 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count) void avcodec_thread_free(AVCodecContext *s) { +#if HAVE_THREADS return ff_thread_free(s); +#endif } #endif From 569ff02168dfe618599db5d5a327caf8b3051dd5 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 9 Feb 2011 20:55:51 +0000 Subject: [PATCH 293/528] asfdec: remove some write-only values from the context Signed-off-by: Mans Rullgard --- libavformat/asfdec.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 039afdb707..9f41793a70 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -38,10 +38,8 @@ typedef struct { uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming) char stream_languages[128][6]; ///< max number of streams, language for each (RFC1766, e.g. en-US) /* non streamed additonnal info */ - uint64_t nb_packets; ///< how many packets are there in the file, invalid if broadcasting /* packet filling */ int packet_size_left; - int packet_nb_frames; /* only for reading */ uint64_t data_offset; ///< beginning of the first data packet uint64_t data_object_offset; ///< data object offset (excl. GUID & size) @@ -232,7 +230,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) ff_get_guid(pb, &asf->hdr.guid); asf->hdr.file_size = get_le64(pb); asf->hdr.create_time = get_le64(pb); - asf->nb_packets = get_le64(pb); + get_le64(pb); /* number of packets */ asf->hdr.play_time = get_le64(pb); asf->hdr.send_time = get_le64(pb); asf->hdr.preroll = get_le32(pb); @@ -1037,7 +1035,6 @@ static void asf_reset_header(AVFormatContext *s) ASFStream *asf_st; int i; - asf->packet_nb_frames = 0; asf->packet_size_left = 0; asf->packet_segments = 0; asf->packet_flags = 0; From 00952be424ba7403d71c338933354d2172df8e67 Mon Sep 17 00:00:00 2001 From: David Fries Date: Mon, 7 Feb 2011 23:14:43 +0200 Subject: [PATCH 294/528] udp: Enable address reuse by default for multicast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep the original corner case behaviour, where reuse is enabled for the case where no argument is given to the reuse url option. Signed-off-by: Martin Storsjö Signed-off-by: Ronald S. Bultje --- libavformat/udp.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libavformat/udp.c b/libavformat/udp.c index aa17c979f3..4c4db2a589 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -313,6 +313,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) char buf[256]; struct sockaddr_storage my_addr; int len; + int reuse_specified = 0; h->is_streamed = 1; h->max_packet_size = 1472; @@ -329,7 +330,14 @@ static int udp_open(URLContext *h, const char *uri, int flags) p = strchr(uri, '?'); if (p) { - s->reuse_socket = find_info_tag(buf, sizeof(buf), "reuse", p); + if (find_info_tag(buf, sizeof(buf), "reuse", p)) { + const char *endptr=NULL; + s->reuse_socket = strtol(buf, &endptr, 10); + /* assume if no digits were found it is a request to enable it */ + if (buf == endptr) + s->reuse_socket = 1; + reuse_specified = 1; + } if (find_info_tag(buf, sizeof(buf), "ttl", p)) { s->ttl = strtol(buf, NULL, 10); } @@ -366,9 +374,14 @@ static int udp_open(URLContext *h, const char *uri, int flags) if (udp_fd < 0) goto fail; - if (s->reuse_socket) + /* Follow the requested reuse option, unless it's multicast in which + * case enable reuse unless explicitely disabled. + */ + if (s->reuse_socket || (s->is_multicast && !reuse_specified)) { + s->reuse_socket = 1; if (setsockopt (udp_fd, SOL_SOCKET, SO_REUSEADDR, &(s->reuse_socket), sizeof(s->reuse_socket)) != 0) goto fail; + } /* the bind is needed to give a port to the socket now */ /* if multicast, try the multicast address bind first */ From d42b09723ed154d5269b95efcc20cb1874f60816 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 9 Feb 2011 21:55:53 +0100 Subject: [PATCH 295/528] asfdec: move DAR list to ASFContext This will be useful for splitting asf_read_header() Signed-off-by: Ronald S. Bultje --- libavformat/asfdec.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 9f41793a70..ee9bf6226c 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -36,6 +36,7 @@ typedef struct { int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID ASFStream streams[128]; ///< it's max number and it's not that big uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming) + AVRational dar[128]; char stream_languages[128][6]; ///< max number of streams, language for each (RFC1766, e.g. en-US) /* non streamed additonnal info */ /* packet filling */ @@ -192,10 +193,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) ASFStream *asf_st; int size, i; int64_t gsize; - AVRational dar[128]; uint32_t bitrate[128]; - memset(dar, 0, sizeof(dar)); memset(bitrate, 0, sizeof(bitrate)); ff_get_guid(pb, &g); @@ -477,9 +476,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) * 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); + asf->dar[0].num= get_value(s->pb, value_type); } else if(!strcmp(name, "AspectRatioY")){ - dar[0].den= get_value(s->pb, value_type); + asf->dar[0].den= get_value(s->pb, value_type); } else get_tag(s, name, value_type, value_len); } @@ -503,8 +502,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) url_fskip(pb, value_len - 2); if(stream_num<128){ - if (!strcmp(name, "AspectRatioX")) dar[stream_num].num= value_num; - else if(!strcmp(name, "AspectRatioY")) dar[stream_num].den= value_num; + if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num; + else if(!strcmp(name, "AspectRatioY")) asf->dar[stream_num].den= value_num; } } } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_header)) { @@ -617,14 +616,14 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) 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 (asf->dar[i].num > 0 && asf->dar[i].den > 0){ av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, - dar[i].num, dar[i].den, INT_MAX); - } 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. + asf->dar[i].num, asf->dar[i].den, INT_MAX); + } else if ((asf->dar[0].num > 0) && (asf->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); + asf->dar[0].num, asf->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); From 7c7253802bbb4f7330ff9b32358bf05f9880cbdf Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 9 Feb 2011 21:55:54 +0100 Subject: [PATCH 296/528] asfdec: use an ASFContext array for storing stream bitrates This will be useful for splitting asf_read_header() Signed-off-by: Ronald S. Bultje --- libavformat/asfdec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index ee9bf6226c..8d79983037 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -193,9 +193,6 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) ASFStream *asf_st; int size, i; int64_t gsize; - uint32_t bitrate[128]; - - memset(bitrate, 0, sizeof(bitrate)); ff_get_guid(pb, &g); if (ff_guidcmp(&g, &ff_asf_header)) @@ -532,7 +529,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) payload_ext_ct = get_le16(pb); //payload-extension-system-count if (stream_num < 128) - bitrate[stream_num] = leak_rate; + asf->stream_bitrates[stream_num] = leak_rate; for (i=0; i=0){ AVStream *st = s->streams[stream_num]; if (!st->codec->bit_rate) - st->codec->bit_rate = bitrate[i]; + st->codec->bit_rate = asf->stream_bitrates[i]; if (asf->dar[i].num > 0 && asf->dar[i].den > 0){ av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, From d7a5106eb2dad33765b0e5f11fd8b1a87e5a9b4b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 9 Feb 2011 21:55:52 +0100 Subject: [PATCH 297/528] asfdec: skip the stream bitrate list Its contents aren't used for anything. Signed-off-by: Ronald S. Bultje --- libavformat/asfdec.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 8d79983037..41f849edfb 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -425,21 +425,6 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) get_tag(s, "copyright", 0, len3); get_tag(s, "comment" , 0, len4); url_fskip(pb, len5); - } else if (!ff_guidcmp(&g, &stream_bitrate_guid)) { - int stream_count = get_le16(pb); - int j; - -// av_log(s, AV_LOG_ERROR, "stream bitrate properties\n"); -// av_log(s, AV_LOG_ERROR, "streams %d\n", streams); - for(j = 0; j < stream_count; j++) { - int flags, bitrate, stream_id; - - flags= get_le16(pb); - bitrate= get_le32(pb); - stream_id= (flags & 0x7f); -// av_log(s, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate); - asf->stream_bitrates[stream_id]= bitrate; - } } else if (!ff_guidcmp(&g, &ff_asf_language_guid)) { int j; int stream_count = get_le16(pb); From 628b16f45f79aa5eb7514f11026d85e8aa34387f Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 10 Feb 2011 11:42:21 +0000 Subject: [PATCH 298/528] mov: remove stray semicolon Signed-off-by: Mans Rullgard --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 310a399d83..d4d7ac2185 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1723,7 +1723,7 @@ static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref) } return AVERROR(ENOENT); -}; +} static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { From dbb09ec23f16cb5e4ec3d4e0911dae0beb95869b Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 10 Feb 2011 12:04:52 +0000 Subject: [PATCH 299/528] ivi_dsp: remove semicolons after function definitions Signed-off-by: Mans Rullgard --- libavcodec/ivi_dsp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/ivi_dsp.c b/libavcodec/ivi_dsp.c index ccaffd45ce..913fdc31b2 100644 --- a/libavcodec/ivi_dsp.c +++ b/libavcodec/ivi_dsp.c @@ -461,7 +461,7 @@ void ff_ivi_mc_ ## size ##x## size ## suffix (int16_t *buf, const int16_t *ref_b #define OP_PUT(a, b) (a) = (b) #define OP_ADD(a, b) (a) += (b) -IVI_MC_TEMPLATE(8, _no_delta, OP_PUT); -IVI_MC_TEMPLATE(8, _delta, OP_ADD); -IVI_MC_TEMPLATE(4, _no_delta, OP_PUT); -IVI_MC_TEMPLATE(4, _delta, OP_ADD); +IVI_MC_TEMPLATE(8, _no_delta, OP_PUT) +IVI_MC_TEMPLATE(8, _delta, OP_ADD) +IVI_MC_TEMPLATE(4, _no_delta, OP_PUT) +IVI_MC_TEMPLATE(4, _delta, OP_ADD) From b4668274b944abae61759e796c5cc36ade510f24 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 10 Feb 2011 12:21:19 +0000 Subject: [PATCH 300/528] Remove incorrect return statement from avcodec_thread_free() The function return type is void, so a return statement with an expression is forbidden (and pointless). Signed-off-by: Mans Rullgard --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 03018b894f..c4bba376bb 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1298,7 +1298,7 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count) void avcodec_thread_free(AVCodecContext *s) { #if HAVE_THREADS - return ff_thread_free(s); + ff_thread_free(s); #endif } From dda3f0ef48aa5c3b03566b60b6bf63211e1fe579 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 10 Feb 2011 12:20:36 -0500 Subject: [PATCH 301/528] Add x86-optimized versions of exponent_min(). Signed-off-by: Ronald S. Bultje --- libavcodec/Makefile | 6 ++-- libavcodec/ac3dsp.c | 51 ++++++++++++++++++++++++++++ libavcodec/ac3dsp.h | 43 ++++++++++++++++++++++++ libavcodec/ac3enc.c | 33 ++++-------------- libavcodec/x86/Makefile | 4 +++ libavcodec/x86/ac3dsp.asm | 67 +++++++++++++++++++++++++++++++++++++ libavcodec/x86/ac3dsp_mmx.c | 45 +++++++++++++++++++++++++ libavcodec/x86/x86util.asm | 10 ++++++ 8 files changed, 230 insertions(+), 29 deletions(-) create mode 100644 libavcodec/ac3dsp.c create mode 100644 libavcodec/ac3dsp.h create mode 100644 libavcodec/x86/ac3dsp.asm create mode 100644 libavcodec/x86/ac3dsp_mmx.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index fa6c0bb9cd..682b626800 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -55,8 +55,10 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \ mpeg4audio.o OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o -OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3tab.o ac3.o -OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3tab.o ac3.o +OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3tab.o ac3.o \ + ac3dsp.o +OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3tab.o ac3.o \ + ac3dsp.o OBJS-$(CONFIG_ALAC_DECODER) += alac.o OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c new file mode 100644 index 0000000000..f688e6a72b --- /dev/null +++ b/libavcodec/ac3dsp.c @@ -0,0 +1,51 @@ +/* + * AC-3 DSP utils + * Copyright (c) 2011 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 "avcodec.h" +#include "ac3dsp.h" + +static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs) +{ + int blk, i; + + if (!num_reuse_blocks) + return; + + for (i = 0; i < nb_coefs; i++) { + uint8_t min_exp = *exp; + uint8_t *exp1 = exp + 256; + for (blk = 0; blk < num_reuse_blocks; blk++) { + uint8_t next_exp = *exp1; + if (next_exp < min_exp) + min_exp = next_exp; + exp1 += 256; + } + *exp++ = min_exp; + } +} + +av_cold void ff_ac3dsp_init(AC3DSPContext *c) +{ + c->ac3_exponent_min = ac3_exponent_min_c; + + if (HAVE_MMX) + ff_ac3dsp_init_x86(c); +} diff --git a/libavcodec/ac3dsp.h b/libavcodec/ac3dsp.h new file mode 100644 index 0000000000..7f13b11f3b --- /dev/null +++ b/libavcodec/ac3dsp.h @@ -0,0 +1,43 @@ +/* + * AC-3 DSP utils + * Copyright (c) 2011 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 + */ + +#ifndef AVCODEC_AC3DSP_H +#define AVCODEC_AC3DSP_H + +#include + +typedef struct AC3DSPContext { + /** + * Set each encoded exponent in a block to the minimum of itself and the + * exponents in the same frequency bin of up to 5 following blocks. + * @param exp pointer to the start of the current block of exponents. + * constraints: align 16 + * @param num_reuse_blocks number of blocks that will reuse exponents from the current block. + * constraints: range 0 to 5 + * @param nb_coefs number of frequency coefficients. + */ + void (*ac3_exponent_min)(uint8_t *exp, int num_reuse_blocks, int nb_coefs); +} AC3DSPContext; + +void ff_ac3dsp_init (AC3DSPContext *c); +void ff_ac3dsp_init_x86(AC3DSPContext *c); + +#endif /* AVCODEC_AC3DSP_H */ diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index e41a0aec65..851fdc9caf 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -33,6 +33,7 @@ #include "avcodec.h" #include "put_bits.h" #include "dsputil.h" +#include "ac3dsp.h" #include "ac3.h" #include "audioconvert.h" @@ -86,6 +87,7 @@ typedef struct AC3Block { typedef struct AC3EncodeContext { PutBitContext pb; ///< bitstream writer context DSPContext dsp; + AC3DSPContext ac3dsp; ///< AC-3 optimized functions AC3MDCTContext mdct; ///< MDCT context AC3Block blocks[AC3_MAX_BLOCKS]; ///< per-block info @@ -458,7 +460,6 @@ static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy, exp_strategy[blk] = EXP_REUSE; exp += AC3_MAX_COEFS; } - emms_c(); /* now select the encoding strategy type : if exponents are often recoded, we use a coarse encoding */ @@ -498,31 +499,6 @@ static void compute_exp_strategy(AC3EncodeContext *s) } -/** - * Set each encoded exponent in a block to the minimum of itself and the - * exponents in the same frequency bin of up to 5 following blocks. - */ -static void exponent_min(uint8_t *exp, int num_reuse_blocks, int nb_coefs) -{ - int blk, i; - - if (!num_reuse_blocks) - return; - - for (i = 0; i < nb_coefs; i++) { - uint8_t min_exp = *exp; - uint8_t *exp1 = exp + AC3_MAX_COEFS; - for (blk = 0; blk < num_reuse_blocks; blk++) { - uint8_t next_exp = *exp1; - if (next_exp < min_exp) - min_exp = next_exp; - exp1 += AC3_MAX_COEFS; - } - *exp++ = min_exp; - } -} - - /** * Update the exponents so that they are the ones the decoder will decode. */ @@ -616,7 +592,7 @@ static void encode_exponents(AC3EncodeContext *s) num_reuse_blocks = blk1 - blk - 1; /* for the EXP_REUSE case we select the min of the exponents */ - exponent_min(exp, num_reuse_blocks, nb_coefs); + s->ac3dsp.ac3_exponent_min(exp, num_reuse_blocks, nb_coefs); encode_exponents_blk_ch(exp, nb_coefs, exp_strategy[blk]); @@ -704,6 +680,8 @@ static void process_exponents(AC3EncodeContext *s) encode_exponents(s); group_exponents(s); + + emms_c(); } @@ -1856,6 +1834,7 @@ static av_cold int ac3_encode_init(AVCodecContext *avctx) avctx->coded_frame= avcodec_alloc_frame(); dsputil_init(&s->dsp, avctx); + ff_ac3dsp_init(&s->ac3dsp); return 0; init_fail: diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 83cec00442..1b58fa121f 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -17,6 +17,10 @@ MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_yasm.o +MMX-OBJS-$(CONFIG_AC3_ENCODER) += x86/ac3dsp_mmx.o +MMX-OBJS-$(CONFIG_AC3_FIXED_ENCODER) += x86/ac3dsp_mmx.o +YASM-OBJS-$(CONFIG_AC3_ENCODER) += x86/ac3dsp.o +YASM-OBJS-$(CONFIG_AC3_FIXED_ENCODER) += x86/ac3dsp.o MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o MMX-OBJS-$(CONFIG_MP1FLOAT_DECODER) += x86/mpegaudiodec_mmx.o MMX-OBJS-$(CONFIG_MP2FLOAT_DECODER) += x86/mpegaudiodec_mmx.o diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm new file mode 100644 index 0000000000..e71c51cf33 --- /dev/null +++ b/libavcodec/x86/ac3dsp.asm @@ -0,0 +1,67 @@ +;***************************************************************************** +;* x86-optimized AC-3 DSP utils +;* Copyright (c) 2011 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 +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" +%include "x86util.asm" + +SECTION .text + +;----------------------------------------------------------------------------- +; void ff_ac3_exponent_min(uint8_t *exp, int num_reuse_blocks, int nb_coefs) +;----------------------------------------------------------------------------- + +%macro AC3_EXPONENT_MIN 1 +cglobal ac3_exponent_min_%1, 3,4,2, exp, reuse_blks, expn, offset + shl reuse_blksq, 8 + jz .end + LOOP_ALIGN +.nextexp: + mov offsetq, reuse_blksq + mova m0, [expq+offsetq] + sub offsetq, 256 + LOOP_ALIGN +.nextblk: + PMINUB m0, [expq+offsetq], m1 + sub offsetq, 256 + jae .nextblk + mova [expq], m0 + add expq, mmsize + sub expnq, mmsize + jg .nextexp +.end: + REP_RET +%endmacro + +%define PMINUB PMINUB_MMX +%define LOOP_ALIGN +INIT_MMX +AC3_EXPONENT_MIN mmx +%ifdef HAVE_MMX2 +%define PMINUB PMINUB_MMXEXT +%define LOOP_ALIGN ALIGN 16 +AC3_EXPONENT_MIN mmxext +%endif +%ifdef HAVE_SSE +INIT_XMM +AC3_EXPONENT_MIN sse2 +%endif +%undef PMINUB +%undef LOOP_ALIGN diff --git a/libavcodec/x86/ac3dsp_mmx.c b/libavcodec/x86/ac3dsp_mmx.c new file mode 100644 index 0000000000..7ce3aa358d --- /dev/null +++ b/libavcodec/x86/ac3dsp_mmx.c @@ -0,0 +1,45 @@ +/* + * x86-optimized AC-3 DSP utils + * Copyright (c) 2011 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/x86_cpu.h" +#include "dsputil_mmx.h" +#include "libavcodec/ac3dsp.h" + +extern void ff_ac3_exponent_min_mmx (uint8_t *exp, int num_reuse_blocks, int nb_coefs); +extern void ff_ac3_exponent_min_mmxext(uint8_t *exp, int num_reuse_blocks, int nb_coefs); +extern void ff_ac3_exponent_min_sse2 (uint8_t *exp, int num_reuse_blocks, int nb_coefs); + +av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c) +{ + int mm_flags = av_get_cpu_flags(); + +#if HAVE_YASM + if (mm_flags & AV_CPU_FLAG_MMX) { + c->ac3_exponent_min = ff_ac3_exponent_min_mmx; + } + if (mm_flags & AV_CPU_FLAG_MMX2 && HAVE_MMX2) { + c->ac3_exponent_min = ff_ac3_exponent_min_mmxext; + } + if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { + c->ac3_exponent_min = ff_ac3_exponent_min_sse2; + } +#endif +} diff --git a/libavcodec/x86/x86util.asm b/libavcodec/x86/x86util.asm index 7cabc70b31..b28a6198f7 100644 --- a/libavcodec/x86/x86util.asm +++ b/libavcodec/x86/x86util.asm @@ -434,3 +434,13 @@ movh [%7], %3 movh [%7+%8], %4 %endmacro + +%macro PMINUB_MMX 3 ; dst, src, tmp + mova %3, %1 + psubusb %3, %2 + psubb %1, %3 +%endmacro + +%macro PMINUB_MMXEXT 3 ; dst, src, ignored + pminub %1, %2 +%endmacro From 4a72765a1c94b05bd3053b1f34f8457a3b71d714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Wed, 9 Feb 2011 19:32:07 +0100 Subject: [PATCH 302/528] Do not fail DVB sub decoding because of a few padding bytes Instead of returning an error when bytes are left over, just return the number of actually used bytes as other decoders do. Instead add a special case so an error will be returned when none of the data looks valid to avoid making debugging a pain. Signed-off-by: Janne Grunau --- libavcodec/dvbsubdec.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 8cc8d4fc83..401144f902 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1423,7 +1423,7 @@ static int dvbsub_decode(AVCodecContext *avctx, #endif - if (buf_size <= 2) + if (buf_size <= 2 || *buf != 0x0f) return -1; p = buf; @@ -1467,12 +1467,7 @@ static int dvbsub_decode(AVCodecContext *avctx, p += segment_length; } - if (p != p_end) { - av_dlog(avctx, "Junk at end of packet\n"); - return -1; - } - - return buf_size; + return p - buf; } From 493aa30adf88baf5bc734072592a22db586f0cfb Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Wed, 9 Feb 2011 23:23:22 +0100 Subject: [PATCH 303/528] dvbsubdec: check against buffer overreads Signed-off-by: Janne Grunau --- libavcodec/dvbsubdec.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 401144f902..457371361c 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1423,13 +1423,15 @@ static int dvbsub_decode(AVCodecContext *avctx, #endif - if (buf_size <= 2 || *buf != 0x0f) + if (buf_size <= 6 || *buf != 0x0f) { + av_dlog(avctx, "incomplete or broken packet"); return -1; + } p = buf; p_end = buf + buf_size; - while (p < p_end && *p == 0x0f) { + while (p_end - p >= 6 && *p == 0x0f) { p += 1; segment_type = *p++; page_id = AV_RB16(p); @@ -1437,6 +1439,11 @@ static int dvbsub_decode(AVCodecContext *avctx, segment_length = AV_RB16(p); p += 2; + if (p_end - p < segment_length) { + av_dlog(avctx, "incomplete or broken packet"); + return -1; + } + if (page_id == ctx->composition_id || page_id == ctx->ancillary_id || ctx->composition_id == -1 || ctx->ancillary_id == -1) { switch (segment_type) { From 5c19f64c600ece050a1deb27f53963e4416beb31 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Thu, 10 Feb 2011 09:57:18 +0100 Subject: [PATCH 304/528] document passing the fate samples location via make variable --- doc/build_system.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/build_system.txt b/doc/build_system.txt index b22ff8487d..8a200695a5 100644 --- a/doc/build_system.txt +++ b/doc/build_system.txt @@ -4,6 +4,8 @@ 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 +make SAMPLES= + specify the path to the fate samples at make time Useful standard make commands: @@ -31,4 +33,5 @@ fate 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 +pass --samples= to configure or pass the path with the +SAMPLES variable to make From df211c3ab73b36208ac4511a9cd7feb817f551fa Mon Sep 17 00:00:00 2001 From: Ronen Mizrahi Date: Thu, 10 Feb 2011 11:50:00 -0500 Subject: [PATCH 305/528] dvbsubenc: Fix placement of the object version Signed-off-by: Mans Rullgard --- libavcodec/dvbsub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c index c2a129864f..ed128234e8 100644 --- a/libavcodec/dvbsub.c +++ b/libavcodec/dvbsub.c @@ -223,7 +223,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s, else page_state = 2; /* mode change */ /* page_version = 0 + page_state */ - *q++ = s->object_version | (page_state << 2) | 3; + *q++ = (s->object_version << 4) | (page_state << 2) | 3; for (region_id = 0; region_id < h->num_rects; region_id++) { *q++ = region_id; From 44adbebe1744c68d66d7f811c38270fdcc89665a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 10 Feb 2011 12:04:25 +0000 Subject: [PATCH 306/528] Remove final semicolon from some macros This avoids double semicolons after macro expansion. Signed-off-by: Mans Rullgard --- libavcodec/adpcm.c | 6 +++--- libavcodec/dpcm.c | 2 +- libavcodec/pcm.c | 6 +++--- libavformat/rdt.c | 2 +- libavformat/rtpdec_asf.c | 2 +- libavformat/rtpdec_qt.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index fb5bdc7faa..826c588676 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1719,7 +1719,7 @@ AVCodec ff_ ## name ## _encoder = { \ NULL, \ .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} #else #define ADPCM_ENCODER(id,name,long_name_) #endif @@ -1736,13 +1736,13 @@ AVCodec ff_ ## name ## _decoder = { \ NULL, \ adpcm_decode_frame, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} #else #define ADPCM_DECODER(id,name,long_name_) #endif #define ADPCM_CODEC(id,name,long_name_) \ - ADPCM_ENCODER(id,name,long_name_) ADPCM_DECODER(id,name,long_name_) + ADPCM_ENCODER(id,name,long_name_); ADPCM_DECODER(id,name,long_name_) /* Note: Do not forget to add new entries to the Makefile as well. */ ADPCM_DECODER(CODEC_ID_ADPCM_4XM, adpcm_4xm, "ADPCM 4X Movie"); diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index 6053a14550..ee8eb6a722 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -309,7 +309,7 @@ AVCodec ff_ ## name ## _decoder = { \ NULL, \ dpcm_decode_frame, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} DPCM_DECODER(CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay"); DPCM_DECODER(CODEC_ID_ROQ_DPCM, roq_dpcm, "DPCM id RoQ"); diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 0785a9d2ab..cdc11f80d0 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -482,7 +482,7 @@ AVCodec ff_ ## name_ ## _encoder = { \ .close = pcm_encode_close, \ .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} #else #define PCM_ENCODER(id,sample_fmt_,name,long_name_) #endif @@ -498,13 +498,13 @@ AVCodec ff_ ## name_ ## _decoder = { \ .decode = pcm_decode_frame, \ .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} #else #define PCM_DECODER(id,sample_fmt_,name,long_name_) #endif #define PCM_CODEC(id, sample_fmt_, name, long_name_) \ - PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,sample_fmt_,name,long_name_) + PCM_ENCODER(id,sample_fmt_,name,long_name_); PCM_DECODER(id,sample_fmt_,name,long_name_) /* Note: Do not forget to add new entries to the Makefile as well. */ PCM_CODEC (CODEC_ID_PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law"); diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 3428b4d3fe..bb7f278163 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -559,7 +559,7 @@ static RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \ .open = rdt_new_context, \ .close = rdt_free_context, \ .parse_packet = rdt_parse_packet \ -}; +} RDT_HANDLER(live_video, "x-pn-multirate-realvideo-live", AVMEDIA_TYPE_VIDEO); RDT_HANDLER(live_audio, "x-pn-multirate-realaudio-live", AVMEDIA_TYPE_AUDIO); diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index db09f8f3f7..5d52765110 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -288,7 +288,7 @@ RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \ .open = asfrtp_new_context, \ .close = asfrtp_free_context, \ .parse_packet = asfrtp_parse_packet, \ -}; +} RTP_ASF_HANDLER(asf_pfv, "x-asf-pf", AVMEDIA_TYPE_VIDEO); RTP_ASF_HANDLER(asf_pfa, "x-asf-pf", AVMEDIA_TYPE_AUDIO); diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 28460a7ad9..a1853ef52f 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -246,7 +246,7 @@ RTPDynamicProtocolHandler ff_ ## m ## _rtp_ ## n ## _handler = { \ .open = qt_rtp_new, \ .close = qt_rtp_free, \ .parse_packet = qt_rtp_parse_packet, \ -}; +} RTP_QT_HANDLER(qt, vid, "X-QT", AVMEDIA_TYPE_VIDEO); RTP_QT_HANDLER(qt, aud, "X-QT", AVMEDIA_TYPE_AUDIO); From 12c14cd4a8bf844f6f3d16ae18999bdb47999324 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Thu, 10 Feb 2011 17:25:13 +1100 Subject: [PATCH 307/528] add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED Signed-off-by: Janne Grunau --- libavformat/avformat.h | 2 ++ libavformat/version.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index bf6f96d2a4..f676dc214b 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -472,6 +472,8 @@ typedef struct AVIndexEntry { * even when user did not explicitly ask for subtitles. */ #define AV_DISPOSITION_FORCED 0x0040 +#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ +#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ /** * Stream structure. diff --git a/libavformat/version.h b/libavformat/version.h index e1abaa7a8d..0c796e6de5 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 98 +#define LIBAVFORMAT_VERSION_MINOR 99 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From 52091491575f015c09a32a745de4f7f7592fe6d4 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Thu, 10 Feb 2011 17:25:40 +1100 Subject: [PATCH 308/528] make av_find_best_stream() ignore streams marked with AV_DISPOSITION_*_IMPAIRED Signed-off-by: Janne Grunau --- libavformat/utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index c21b922401..870a287f17 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2516,6 +2516,8 @@ int av_find_best_stream(AVFormatContext *ic, continue; if (wanted_stream_nb >= 0 && stream_number++ != wanted_stream_nb) continue; + if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED)) + continue; if (decoder_ret) { decoder = avcodec_find_decoder(ic->streams[i]->codec->codec_id); if (!decoder) { From 68137ba386933243a84fc65f0deb3ad0ce5ff0ea Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Thu, 10 Feb 2011 17:26:10 +1100 Subject: [PATCH 309/528] wtv: mark streams intended for hearing or visual impaired persons Signed-off-by: Janne Grunau --- libavformat/wtv.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 0385e73f9e..7a8e8f54dc 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -32,6 +32,7 @@ #include "riff.h" #include "asf.h" #include "mpegts.h" +#include /* Macros for formating GUIDs */ #define PRI_GUID \ @@ -371,6 +372,8 @@ static const ff_asf_guid EVENTID_StreamIDSpanningEvent = {0x68,0xAB,0xF1,0xCA,0x53,0xE1,0x41,0x4D,0xA6,0xB3,0xA7,0xC9,0x98,0xDB,0x75,0xEE}; static const ff_asf_guid EVENTID_TeletextSpanningEvent = {0x50,0xD9,0x99,0x95,0x33,0x5F,0x17,0x46,0xAF,0x7C,0x1E,0x54,0xB5,0x10,0xDA,0xA3}; +static const ff_asf_guid EVENTID_AudioTypeSpanningEvent = + {0xBE,0xBF,0x1C,0x50,0x49,0xB8,0xCE,0x42,0x9B,0xE9,0x3D,0xB8,0x69,0xFB,0x82,0xB3}; /* Windows media GUIDs */ @@ -832,6 +835,19 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p consumed += buf_size; ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, 0, 0, 0, 0); } + } else if (!ff_guidcmp(g, EVENTID_AudioTypeSpanningEvent)) { + int stream_index = ff_find_stream_index(s, sid); + if (stream_index >= 0) { + AVStream *st = s->streams[stream_index]; + int audio_type; + url_fskip(pb, 8); + audio_type = get_byte(pb); + if (audio_type == 2) + st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; + else if (audio_type == 3) + st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; + consumed += 9; + } } else if (!ff_guidcmp(g, EVENTID_DVBScramblingControlSpanningEvent)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { @@ -850,6 +866,8 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (language[0]) { language[3] = 0; av_metadata_set2(&st->metadata, "language", language, 0); + if (!strcmp(language, "nar") || !strcmp(language, "NAR")) + st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; } consumed += 15; } @@ -887,7 +905,6 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p !ff_guidcmp(g, /* DSATTRIB_PicSampleSeq */ (const ff_asf_guid){0x02,0xAE,0x5B,0x2F,0x8F,0x7B,0x60,0x4F,0x82,0xD6,0xE4,0xEA,0x2F,0x1F,0x4C,0x99}) || !ff_guidcmp(g, /* DSATTRIB_TRANSPORT_PROPERTIES */ (const ff_asf_guid){0x12,0xF6,0x22,0xB6,0xAD,0x47,0x71,0x46,0xAD,0x6C,0x05,0xA9,0x8E,0x65,0xDE,0x3A}) || !ff_guidcmp(g, /* dvr_ms_vid_frame_rep_data */ (const ff_asf_guid){0xCC,0x32,0x64,0xDD,0x29,0xE2,0xDB,0x40,0x80,0xF6,0xD2,0x63,0x28,0xD2,0x76,0x1F}) || - !ff_guidcmp(g, /* EVENTID_AudioTypeSpanningEvent */ (const ff_asf_guid){0xBE,0xBF,0x1C,0x50,0x49,0xB8,0xCE,0x42,0x9B,0xE9,0x3D,0xB8,0x69,0xFB,0x82,0xB3}) || !ff_guidcmp(g, /* EVENTID_ChannelChangeSpanningEvent */ (const ff_asf_guid){0xE5,0xC5,0x67,0x90,0x5C,0x4C,0x05,0x42,0x86,0xC8,0x7A,0xFE,0x20,0xFE,0x1E,0xFA}) || !ff_guidcmp(g, /* EVENTID_ChannelInfoSpanningEvent */ (const ff_asf_guid){0x80,0x6D,0xF3,0x41,0x32,0x41,0xC2,0x4C,0xB1,0x21,0x01,0xA4,0x32,0x19,0xD8,0x1B}) || !ff_guidcmp(g, /* EVENTID_ChannelTypeSpanningEvent */ (const ff_asf_guid){0x51,0x1D,0xAB,0x72,0xD2,0x87,0x9B,0x48,0xBA,0x11,0x0E,0x08,0xDC,0x21,0x02,0x43}) || From c1fea2307011ac7a7bb98af98010f81abc789732 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 9 Feb 2011 21:55:55 +0100 Subject: [PATCH 310/528] asfdec: split asf_read_header() Only trivial splits are done here -- i.e. copy/paste + reindent + missing variable declarations. Signed-off-by: Ronald S. Bultje --- libavformat/asfdec.c | 365 +++++++++++++++++++++++++------------------ 1 file changed, 214 insertions(+), 151 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 41f849edfb..cd051ad51a 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -184,6 +184,213 @@ finish: url_fseek(s->pb, off + len, SEEK_SET); } +static int asf_read_file_properties(AVFormatContext *s, int64_t size) +{ + ASFContext *asf = s->priv_data; + ByteIOContext *pb = s->pb; + + ff_get_guid(pb, &asf->hdr.guid); + asf->hdr.file_size = get_le64(pb); + asf->hdr.create_time = get_le64(pb); + get_le64(pb); /* number of packets */ + asf->hdr.play_time = get_le64(pb); + asf->hdr.send_time = get_le64(pb); + asf->hdr.preroll = get_le32(pb); + asf->hdr.ignore = get_le32(pb); + asf->hdr.flags = get_le32(pb); + asf->hdr.min_pktsize = get_le32(pb); + asf->hdr.max_pktsize = get_le32(pb); + asf->hdr.max_bitrate = get_le32(pb); + s->packet_size = asf->hdr.max_pktsize; + + return 0; +} + +static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) +{ + ASFContext *asf = s->priv_data; + ByteIOContext *pb = s->pb; + ff_asf_guid g; + int ext_len, payload_ext_ct, stream_ct, i; + uint32_t ext_d, leak_rate, stream_num; + unsigned int stream_languageid_index; + + get_le64(pb); // starttime + get_le64(pb); // endtime + leak_rate = get_le32(pb); // leak-datarate + get_le32(pb); // bucket-datasize + get_le32(pb); // init-bucket-fullness + get_le32(pb); // alt-leak-datarate + get_le32(pb); // alt-bucket-datasize + get_le32(pb); // alt-init-bucket-fullness + get_le32(pb); // max-object-size + get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved) + stream_num = get_le16(pb); // stream-num + + stream_languageid_index = get_le16(pb); // stream-language-id-index + if (stream_num < 128) + asf->streams[stream_num].stream_language_index = stream_languageid_index; + + get_le64(pb); // avg frametime in 100ns units + stream_ct = get_le16(pb); //stream-name-count + payload_ext_ct = get_le16(pb); //payload-extension-system-count + + if (stream_num < 128) + asf->stream_bitrates[stream_num] = leak_rate; + + for (i=0; ipb; + int len1, len2, len3, len4, len5; + + len1 = get_le16(pb); + len2 = get_le16(pb); + len3 = get_le16(pb); + len4 = get_le16(pb); + len5 = get_le16(pb); + get_tag(s, "title" , 0, len1); + get_tag(s, "author" , 0, len2); + get_tag(s, "copyright", 0, len3); + get_tag(s, "comment" , 0, len4); + url_fskip(pb, len5); + + return 0; +} + +static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) +{ + ByteIOContext *pb = s->pb; + ASFContext *asf = s->priv_data; + int desc_count, i, ret; + + desc_count = get_le16(pb); + for(i=0;idar[0].num= get_value(s->pb, value_type); + } else if(!strcmp(name, "AspectRatioY")){ + asf->dar[0].den= get_value(s->pb, value_type); + } else + get_tag(s, name, value_type, value_len); + } + + return 0; +} + +static int asf_read_language_list(AVFormatContext *s, int64_t size) +{ + ByteIOContext *pb = s->pb; + ASFContext *asf = s->priv_data; + int j, ret; + int stream_count = get_le16(pb); + for(j = 0; j < stream_count; j++) { + char lang[6]; + unsigned int lang_len = get_byte(pb); + if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len) + url_fskip(pb, lang_len - ret); + if (j < 128) + av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages)); + } + + return 0; +} + +static int asf_read_metadata(AVFormatContext *s, int64_t size) +{ + ByteIOContext *pb = s->pb; + ASFContext *asf = s->priv_data; + int n, stream_num, name_len, value_len, value_type, value_num; + int ret, i; + n = get_le16(pb); + + for(i=0;i\n", i, stream_num, name_len, value_type, value_len, name); + value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere + url_fskip(pb, value_len - 2); + + if(stream_num<128){ + if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num; + else if(!strcmp(name, "AspectRatioY")) asf->dar[stream_num].den= value_num; + } + } + + return 0; +} + +static int asf_read_marker(AVFormatContext *s, int64_t size) +{ + ByteIOContext *pb = s->pb; + int i, count, name_len, ret; + char name[1024]; + + get_le64(pb); // reserved 16 bytes + get_le64(pb); // ... + count = get_le32(pb); // markers count + get_le16(pb); // reserved 2 bytes + name_len = get_le16(pb); // name length + for(i=0;ipriv_data; @@ -204,7 +411,6 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid)); for(;;) { uint64_t gpos= url_ftell(pb); - int ret; ff_get_guid(pb, &g); gsize = get_le64(pb); av_dlog(s, "%08"PRIx64": ", gpos); @@ -223,19 +429,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (gsize < 24) return -1; if (!ff_guidcmp(&g, &ff_asf_file_header)) { - ff_get_guid(pb, &asf->hdr.guid); - asf->hdr.file_size = get_le64(pb); - asf->hdr.create_time = get_le64(pb); - get_le64(pb); /* number of packets */ - asf->hdr.play_time = get_le64(pb); - asf->hdr.send_time = get_le64(pb); - asf->hdr.preroll = get_le32(pb); - asf->hdr.ignore = get_le32(pb); - asf->hdr.flags = get_le32(pb); - asf->hdr.min_pktsize = get_le32(pb); - asf->hdr.max_pktsize = get_le32(pb); - asf->hdr.max_bitrate = get_le32(pb); - s->packet_size = asf->hdr.max_pktsize; + asf_read_file_properties(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_stream_header)) { enum AVMediaType type; int type_specific_size, sizeX; @@ -413,121 +607,15 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) pos2 = url_ftell(pb); url_fskip(pb, gsize - (pos2 - pos1 + 24)); } else if (!ff_guidcmp(&g, &ff_asf_comment_header)) { - int len1, len2, len3, len4, len5; - - len1 = get_le16(pb); - len2 = get_le16(pb); - len3 = get_le16(pb); - len4 = get_le16(pb); - len5 = get_le16(pb); - get_tag(s, "title" , 0, len1); - get_tag(s, "author" , 0, len2); - get_tag(s, "copyright", 0, len3); - get_tag(s, "comment" , 0, len4); - url_fskip(pb, len5); + asf_read_content_desc(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_language_guid)) { - int j; - int stream_count = get_le16(pb); - for(j = 0; j < stream_count; j++) { - char lang[6]; - unsigned int lang_len = get_byte(pb); - if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len) - url_fskip(pb, lang_len - ret); - if (j < 128) - av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages)); - } + asf_read_language_list(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_extended_content_header)) { - int desc_count, i; - - desc_count = get_le16(pb); - for(i=0;idar[0].num= get_value(s->pb, value_type); - } else if(!strcmp(name, "AspectRatioY")){ - asf->dar[0].den= get_value(s->pb, value_type); - } else - get_tag(s, name, value_type, value_len); - } + asf_read_ext_content_desc(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_metadata_header)) { - int n, stream_num, name_len, value_len, value_type, value_num; - n = get_le16(pb); - - for(i=0;i\n", i, stream_num, name_len, value_type, value_len, name); - value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere - url_fskip(pb, value_len - 2); - - if(stream_num<128){ - if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num; - else if(!strcmp(name, "AspectRatioY")) asf->dar[stream_num].den= value_num; - } - } + asf_read_metadata(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_header)) { - int ext_len, payload_ext_ct, stream_ct; - uint32_t ext_d, leak_rate, stream_num; - unsigned int stream_languageid_index; - - get_le64(pb); // starttime - get_le64(pb); // endtime - leak_rate = get_le32(pb); // leak-datarate - get_le32(pb); // bucket-datasize - get_le32(pb); // init-bucket-fullness - get_le32(pb); // alt-leak-datarate - get_le32(pb); // alt-bucket-datasize - get_le32(pb); // alt-init-bucket-fullness - get_le32(pb); // max-object-size - get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved) - stream_num = get_le16(pb); // stream-num - - stream_languageid_index = get_le16(pb); // stream-language-id-index - if (stream_num < 128) - asf->streams[stream_num].stream_language_index = stream_languageid_index; - - get_le64(pb); // avg frametime in 100ns units - stream_ct = get_le16(pb); //stream-name-count - payload_ext_ct = get_le16(pb); //payload-extension-system-count - - if (stream_num < 128) - asf->stream_bitrates[stream_num] = leak_rate; - - for (i=0; i Date: Wed, 9 Feb 2011 21:55:56 +0100 Subject: [PATCH 311/528] asfdec: deobfuscate reading video properties size This code will be later split out into a function which takes a 'size' argument, so I'm keeping the name 'sizeX' here. Signed-off-by: Ronald S. Bultje --- libavformat/asfdec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index cd051ad51a..0ee6667a27 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -398,7 +398,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) ByteIOContext *pb = s->pb; AVStream *st; ASFStream *asf_st; - int size, i; + int i; int64_t gsize; ff_get_guid(pb, &g); @@ -559,7 +559,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) get_le32(pb); get_le32(pb); get_byte(pb); - size = get_le16(pb); /* size */ + get_le16(pb); /* size */ sizeX= get_le32(pb); /* size */ st->codec->width = get_le32(pb); st->codec->height = get_le32(pb); @@ -569,9 +569,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) tag1 = get_le32(pb); url_fskip(pb, 20); // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); - size= sizeX; - if (size > 40) { - st->codec->extradata_size = size - 40; + if (sizeX > 40) { + st->codec->extradata_size = sizeX - 40; st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, st->codec->extradata, st->codec->extradata_size); } From d4582889eefeee4dd23face9e74b2829dbaaeae5 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 10 Feb 2011 21:15:01 +0000 Subject: [PATCH 312/528] ac3enc: remove right shifting from lshift_tab() and make lshift unsigned. Signed-off-by: Mans Rullgard --- libavcodec/ac3enc_fixed.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index 90e148b949..ff400b8aaf 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -286,19 +286,15 @@ static int log2_tab(int16_t *tab, int n) * Left-shift each value in an array by a specified amount. * @param tab input array * @param n number of values in the array - * @param lshift left shift amount. a negative value means right shift. + * @param lshift left shift amount */ -static void lshift_tab(int16_t *tab, int n, int lshift) +static void lshift_tab(int16_t *tab, int n, unsigned int lshift) { int i; if (lshift > 0) { for (i = 0; i < n; i++) tab[i] <<= lshift; - } else if (lshift < 0) { - lshift = -lshift; - for (i = 0; i < n; i++) - tab[i] >>= lshift; } } From 626264b11b5406c0c78c4056cabb63cb650e9bf2 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 10 Feb 2011 22:12:16 +0000 Subject: [PATCH 313/528] ac3enc: Remove unneeded clipping of shift amount. s->windowed_samples will always have a range of [-32767,32767] due to the window function, so the return value from log2_tab() will always be in the range [0,14]. Signed-off-by: Mans Rullgard --- libavcodec/ac3enc_fixed.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index ff400b8aaf..0db41dff2d 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -309,7 +309,6 @@ static void lshift_tab(int16_t *tab, int n, unsigned int lshift) static int normalize_samples(AC3EncodeContext *s) { int v = 14 - log2_tab(s->windowed_samples, AC3_WINDOW_SIZE); - v = FFMAX(0, v); lshift_tab(s->windowed_samples, AC3_WINDOW_SIZE, v); return v - 9; } From f3d09d44b70492022964e2ead5f439bb7c96eaa2 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 9 Feb 2011 22:43:25 -0800 Subject: [PATCH 314/528] VP8: optimized mv prediction and decoding Merge find_near_mvs and mv bitstream decoding: don't do prediction steps until absolutely necessary. --- libavcodec/vp8.c | 182 +++++++++++++++++++++++------------------------ 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index c078f2ec5c..8de8968d6e 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -528,68 +528,6 @@ void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src, int mb_x, int mb_y) ((s->mb_height - 1 - mb_y) << 6) + MARGIN); } -static av_always_inline -void find_near_mvs(VP8Context *s, VP8Macroblock *mb, - VP56mv near[2], VP56mv *best, uint8_t cnt[4]) -{ - VP8Macroblock *mb_edge[3] = { mb + 2 /* top */, - mb - 1 /* left */, - mb + 1 /* top-left */ }; - enum { EDGE_TOP, EDGE_LEFT, EDGE_TOPLEFT }; - VP56mv near_mv[4] = {{ 0 }}; - enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV }; - int idx = CNT_ZERO; - int best_idx = CNT_ZERO; - int cur_sign_bias = s->sign_bias[mb->ref_frame]; - int *sign_bias = s->sign_bias; - - /* Process MB on top, left and top-left */ - #define MV_EDGE_CHECK(n)\ - {\ - VP8Macroblock *edge = mb_edge[n];\ - int edge_ref = edge->ref_frame;\ - if (edge_ref != VP56_FRAME_CURRENT) {\ - uint32_t mv = AV_RN32A(&edge->mv);\ - if (mv) {\ - if (cur_sign_bias != sign_bias[edge_ref]) {\ - /* SWAR negate of the values in mv. */\ - mv = ~mv;\ - mv = ((mv&0x7fff7fff) + 0x00010001) ^ (mv&0x80008000);\ - }\ - if (!n || mv != AV_RN32A(&near_mv[idx]))\ - AV_WN32A(&near_mv[++idx], mv);\ - cnt[idx] += 1 + (n != 2);\ - } else\ - cnt[CNT_ZERO] += 1 + (n != 2);\ - }\ - } - MV_EDGE_CHECK(0) - MV_EDGE_CHECK(1) - MV_EDGE_CHECK(2) - - /* If we have three distinct MVs, merge first and last if they're the same */ - if (cnt[CNT_SPLITMV] && AV_RN32A(&near_mv[1+EDGE_TOP]) == AV_RN32A(&near_mv[1+EDGE_TOPLEFT])) - cnt[CNT_NEAREST] += 1; - - cnt[CNT_SPLITMV] = ((mb_edge[EDGE_LEFT]->mode == VP8_MVMODE_SPLIT) + - (mb_edge[EDGE_TOP]->mode == VP8_MVMODE_SPLIT)) * 2 + - (mb_edge[EDGE_TOPLEFT]->mode == VP8_MVMODE_SPLIT); - - /* Swap near and nearest if necessary */ - if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) { - FFSWAP(uint8_t, cnt[CNT_NEAREST], cnt[CNT_NEAR]); - FFSWAP( VP56mv, near_mv[CNT_NEAREST], near_mv[CNT_NEAR]); - } - - /* Choose the best mv out of 0,0 and the nearest mv */ - if (cnt[CNT_NEAREST] >= cnt[CNT_ZERO]) - best_idx = CNT_NEAREST; - - mb->mv = near_mv[best_idx]; - near[0] = near_mv[CNT_NEAREST]; - near[1] = near_mv[CNT_NEAR]; -} - /** * Motion vector coding, 17.1. */ @@ -699,6 +637,96 @@ int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb) return num; } +static av_always_inline +void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y) +{ + VP8Macroblock *mb_edge[3] = { mb + 2 /* top */, + mb - 1 /* left */, + mb + 1 /* top-left */ }; + enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV }; + enum { EDGE_TOP, EDGE_LEFT, EDGE_TOPLEFT }; + int idx = CNT_ZERO; + int cur_sign_bias = s->sign_bias[mb->ref_frame]; + int *sign_bias = s->sign_bias; + VP56mv near_mv[4]; + uint8_t cnt[4] = { 0 }; + VP56RangeCoder *c = &s->c; + + AV_ZERO32(&near_mv[0]); + AV_ZERO32(&near_mv[1]); + AV_ZERO32(&near_mv[2]); + + /* Process MB on top, left and top-left */ + #define MV_EDGE_CHECK(n)\ + {\ + VP8Macroblock *edge = mb_edge[n];\ + int edge_ref = edge->ref_frame;\ + if (edge_ref != VP56_FRAME_CURRENT) {\ + uint32_t mv = AV_RN32A(&edge->mv);\ + if (mv) {\ + if (cur_sign_bias != sign_bias[edge_ref]) {\ + /* SWAR negate of the values in mv. */\ + mv = ~mv;\ + mv = ((mv&0x7fff7fff) + 0x00010001) ^ (mv&0x80008000);\ + }\ + if (!n || mv != AV_RN32A(&near_mv[idx]))\ + AV_WN32A(&near_mv[++idx], mv);\ + cnt[idx] += 1 + (n != 2);\ + } else\ + cnt[CNT_ZERO] += 1 + (n != 2);\ + }\ + } + + MV_EDGE_CHECK(0) + MV_EDGE_CHECK(1) + MV_EDGE_CHECK(2) + + mb->partitioning = VP8_SPLITMVMODE_NONE; + if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_ZERO]][0])) { + mb->mode = VP8_MVMODE_MV; + + /* If we have three distinct MVs, merge first and last if they're the same */ + if (cnt[CNT_SPLITMV] && AV_RN32A(&near_mv[1+EDGE_TOP]) == AV_RN32A(&near_mv[1+EDGE_TOPLEFT])) + cnt[CNT_NEAREST] += 1; + + /* Swap near and nearest if necessary */ + if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) { + FFSWAP(uint8_t, cnt[CNT_NEAREST], cnt[CNT_NEAR]); + FFSWAP( VP56mv, near_mv[CNT_NEAREST], near_mv[CNT_NEAR]); + } + + if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAREST]][1])) { + if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAR]][2])) { + + /* Choose the best mv out of 0,0 and the nearest mv */ + clamp_mv(s, &mb->mv, &near_mv[CNT_ZERO + (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])], mb_x, mb_y); + cnt[CNT_SPLITMV] = ((mb_edge[EDGE_LEFT]->mode == VP8_MVMODE_SPLIT) + + (mb_edge[EDGE_TOP]->mode == VP8_MVMODE_SPLIT)) * 2 + + (mb_edge[EDGE_TOPLEFT]->mode == VP8_MVMODE_SPLIT); + + if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_SPLITMV]][3])) { + mb->mode = VP8_MVMODE_SPLIT; + mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1]; + } else { + mb->mv.y += read_mv_component(c, s->prob->mvc[0]); + mb->mv.x += read_mv_component(c, s->prob->mvc[1]); + mb->bmv[0] = mb->mv; + } + } else { + clamp_mv(s, &mb->mv, &near_mv[CNT_NEAR], mb_x, mb_y); + mb->bmv[0] = mb->mv; + } + } else { + clamp_mv(s, &mb->mv, &near_mv[CNT_NEAREST], mb_x, mb_y); + mb->bmv[0] = mb->mv; + } + } else { + mb->mode = VP8_MVMODE_ZERO; + AV_ZERO32(&mb->mv); + mb->bmv[0] = mb->mv; + } +} + static av_always_inline void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c, int mb_x, int keyframe) @@ -749,9 +777,6 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_ s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra); mb->ref_frame = VP56_FRAME_CURRENT; } else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) { - VP56mv near[2], best; - uint8_t cnt[4] = { 0 }; - // inter MB, 16.2 if (vp56_rac_get_prob_branchy(c, s->prob->last)) mb->ref_frame = vp56_rac_get_prob(c, s->prob->golden) ? @@ -761,32 +786,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_ s->ref_count[mb->ref_frame-1]++; // motion vectors, 16.3 - find_near_mvs(s, mb, near, &best, cnt); - if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[0]][0])) { - mb->mode = VP8_MVMODE_MV; - 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])) { - if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[3]][3])) { - mb->mode = VP8_MVMODE_SPLIT; - clamp_mv(s, &mb->mv, &mb->mv, mb_x, mb_y); - mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1]; - } else { - 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]); - } - } else - clamp_mv(s, &mb->mv, &near[1], mb_x, mb_y); - } else - clamp_mv(s, &mb->mv, &near[0], mb_x, mb_y); - } else { - mb->mode = VP8_MVMODE_ZERO; - AV_ZERO32(&mb->mv); - } - if (mb->mode != VP8_MVMODE_SPLIT) { - mb->partitioning = VP8_SPLITMVMODE_NONE; - mb->bmv[0] = mb->mv; - } + decode_mvs(s, mb, mb_x, mb_y); } else { // intra MB, 16.1 mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16); From 07f06540f6ea8de14a750ef7ef58498ccc3cc58e Mon Sep 17 00:00:00 2001 From: Alexander Strasser Date: Tue, 8 Feb 2011 00:07:47 +0100 Subject: [PATCH 315/528] vorbis dec: Delete useless scopes, and reindent after scope deletion Signed-off-by: Michael Niedermayer Signed-off-by: Ronald S. Bultje --- libavcodec/vorbis_dec.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index bca56ba663..578ffb84a6 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -594,16 +594,13 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) create_map(vc, i); - /* allocate mem for lsp coefficients */ - { - /* codebook dim is for padding if codebook dim doesn't * - * divide order+1 then we need to read more data */ - floor_setup->data.t0.lsp = - av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim) - * sizeof(float)); - if (!floor_setup->data.t0.lsp) - return -1; - } + /* codebook dim is for padding if codebook dim doesn't * + * divide order+1 then we need to read more data */ + floor_setup->data.t0.lsp = + av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim) + * sizeof(float)); + if (!floor_setup->data.t0.lsp) + return -1; #ifdef V_DEBUG /* debug output parsed headers */ AV_DEBUG("floor0 order: %u\n", floor_setup->data.t0.order); @@ -1110,11 +1107,9 @@ static int vorbis_floor0_decode(vorbis_context *vc, } /* calculate linear floor value */ - { - q = exp((((amplitude*vf->amplitude_offset) / - (((1 << vf->amplitude_bits) - 1) * sqrt(p + q))) - - vf->amplitude_offset) * .11512925f); - } + q = exp((((amplitude*vf->amplitude_offset) / + (((1 << vf->amplitude_bits) - 1) * sqrt(p + q))) + - vf->amplitude_offset) * .11512925f); /* fill vector */ do { From 97f5f971081d83e2d20f27d8569ce467feed42d0 Mon Sep 17 00:00:00 2001 From: Alexander Strasser Date: Tue, 8 Feb 2011 00:09:34 +0100 Subject: [PATCH 316/528] vorbis dec: cosmetics: Indent CPP cond properly Signed-off-by: Michael Niedermayer Signed-off-by: Ronald S. Bultje --- libavcodec/vorbis_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index 578ffb84a6..271f900931 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -799,12 +799,12 @@ static void create_map(vorbis_context *vc, uint_fast8_t floor_number) vf->map_size[blockflag] = n; } -# ifdef V_DEBUG +#ifdef V_DEBUG for (idx = 0; idx <= n; ++idx) { AV_DEBUG("floor0 map: map at pos %d is %d\n", idx, map[idx]); } -# endif +#endif } static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) From 4f03c5d793216eb5bff5961b88aceb2d4ee8b269 Mon Sep 17 00:00:00 2001 From: Alexander Strasser Date: Tue, 8 Feb 2011 00:09:01 +0100 Subject: [PATCH 317/528] vorbis dec: cosmetics: Indent consistently Signed-off-by: Michael Niedermayer Signed-off-by: Ronald S. Bultje --- libavcodec/vorbis_dec.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index 271f900931..df07d1bd17 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -568,9 +568,9 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) /* zero would result in a div by zero later * * 2^0 - 1 == 0 */ if (floor_setup->data.t0.amplitude_bits == 0) { - av_log(vc->avccontext, AV_LOG_ERROR, - "Floor 0 amplitude bits is 0.\n"); - return -1; + av_log(vc->avccontext, AV_LOG_ERROR, + "Floor 0 amplitude bits is 0.\n"); + return -1; } floor_setup->data.t0.amplitude_offset = get_bits(gb, 8); floor_setup->data.t0.num_books = get_bits(gb, 4) + 1; @@ -606,22 +606,22 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) AV_DEBUG("floor0 order: %u\n", floor_setup->data.t0.order); AV_DEBUG("floor0 rate: %u\n", floor_setup->data.t0.rate); AV_DEBUG("floor0 bark map size: %u\n", - floor_setup->data.t0.bark_map_size); + floor_setup->data.t0.bark_map_size); AV_DEBUG("floor0 amplitude bits: %u\n", - floor_setup->data.t0.amplitude_bits); + floor_setup->data.t0.amplitude_bits); AV_DEBUG("floor0 amplitude offset: %u\n", - floor_setup->data.t0.amplitude_offset); + floor_setup->data.t0.amplitude_offset); AV_DEBUG("floor0 number of books: %u\n", - floor_setup->data.t0.num_books); + floor_setup->data.t0.num_books); AV_DEBUG("floor0 book list pointer: %p\n", - floor_setup->data.t0.book_list); + floor_setup->data.t0.book_list); { - int idx; - for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) { - AV_DEBUG(" Book %d: %u\n", - idx+1, - floor_setup->data.t0.book_list[idx]); - } + int idx; + for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) { + AV_DEBUG(" Book %d: %u\n", + idx+1, + floor_setup->data.t0.book_list[idx]); + } } #endif } else { From 0605cb433263502db3b6a6d73e4d69ba5ceee8ef Mon Sep 17 00:00:00 2001 From: Alexander Strasser Date: Tue, 8 Feb 2011 00:09:48 +0100 Subject: [PATCH 318/528] vorbis dec: Remove obsolete comment Signed-off-by: Michael Niedermayer Signed-off-by: Ronald S. Bultje --- libavcodec/vorbis_dec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c index df07d1bd17..deaae7576b 100644 --- a/libavcodec/vorbis_dec.c +++ b/libavcodec/vorbis_dec.c @@ -1037,7 +1037,6 @@ static int vorbis_floor0_decode(vorbis_context *vc, av_log(vc->avccontext, AV_LOG_ERROR, "floor0 dec: booknumber too high!\n"); book_idx = 0; - //FIXME: look above } AV_DEBUG("floor0 dec: booknumber: %u\n", book_idx); codebook = vc->codebooks[vf->book_list[book_idx]]; From b0294c80d3a3981ec7ef9e4654962780e8566075 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 10 Feb 2011 09:36:44 +0100 Subject: [PATCH 319/528] lavf: deprecate AVFormatContext.index_built it's not touched anywhere in ffmpeg, the code setting it was removed over two years ago (e9b78eeba22b050810a507e69df1b652e56ab62b). Signed-off-by: Ronald S. Bultje --- libavformat/avformat.h | 4 +++- libavformat/version.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f676dc214b..11a45418ef 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -752,7 +752,9 @@ typedef struct AVFormatContext { /* av_seek_frame() support */ int64_t data_offset; /**< offset of the first packet */ - int index_built; +#if FF_API_INDEX_BUILT + attribute_deprecated int index_built; +#endif int mux_rate; unsigned int packet_size; diff --git a/libavformat/version.h b/libavformat/version.h index 0c796e6de5..d1a643aaac 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -89,5 +89,8 @@ #ifndef FF_API_OLD_AVIO #define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 53) #endif +#ifndef FF_API_INDEX_BUILT +#define FF_API_INDEX_BUILT (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif #endif //AVFORMAT_VERSION_H From e00f41d5742b3a0dc1877b030f4f6f58c19b7bbd Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Fri, 11 Feb 2011 23:31:32 +1100 Subject: [PATCH 320/528] Bink version 'b' video decoder Based on original patch by Kostya Shishkov Signed-off-by: Janne Grunau --- Changelog | 1 + doc/general.texi | 1 - libavcodec/avcodec.h | 2 +- libavcodec/bink.c | 346 +++++++++++++++++++++++++++++++++++++++--- libavcodec/binkdata.h | 41 +++++ 5 files changed, 371 insertions(+), 20 deletions(-) diff --git a/Changelog b/Changelog index 202e34c494..6053a28ee3 100644 --- a/Changelog +++ b/Changelog @@ -76,6 +76,7 @@ version : - IVF muxer added - Wing Commander IV movies decoder added - movie source added +- Bink version 'b' video decoder version 0.6: diff --git a/doc/general.texi b/doc/general.texi index ad34c70ef7..3fc4d00e26 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -352,7 +352,6 @@ following image formats are supported: @item Bethesda VID video @tab @tab X @tab Used in some games from Bethesda Softworks. @item Bink Video @tab @tab X - @tab Support for version 'b' is missing. @item Brute Force & Ignorance @tab @tab X @tab Used in the game Flash Traffic: City of Angels. @item C93 video @tab @tab X diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3a107841fd..ebad958ae7 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -33,7 +33,7 @@ #define LIBAVCODEC_VERSION_MAJOR 52 #define LIBAVCODEC_VERSION_MINOR 112 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 64a10b71e5..b0775284ae 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1,6 +1,7 @@ /* * Bink video decoder * Copyright (c) 2009 Konstantin Shishkov + * Copyright (C) 2011 Peter Ross * * This file is part of FFmpeg. * @@ -33,6 +34,35 @@ static VLC bink_trees[16]; +/** + * IDs for different data types used in old version of Bink video codec + */ +enum OldSources { + BINKB_SRC_BLOCK_TYPES = 0, ///< 8x8 block types + BINKB_SRC_COLORS, ///< pixel values used for different block types + BINKB_SRC_PATTERN, ///< 8-bit values for 2-colour pattern fill + BINKB_SRC_X_OFF, ///< X components of motion value + BINKB_SRC_Y_OFF, ///< Y components of motion value + BINKB_SRC_INTRA_DC, ///< DC values for intrablocks with DCT + BINKB_SRC_INTER_DC, ///< DC values for interblocks with DCT + BINKB_SRC_INTRA_Q, ///< quantizer values for intrablocks with DCT + BINKB_SRC_INTER_Q, ///< quantizer values for interblocks with DCT + BINKB_SRC_INTER_COEFS, ///< number of coefficients for residue blocks + + BINKB_NB_SRC +}; + +static const int binkb_bundle_sizes[BINKB_NB_SRC] = { + 4, 8, 8, 5, 5, 11, 11, 4, 4, 7 +}; + +static const int binkb_bundle_signed[BINKB_NB_SRC] = { + 0, 0, 0, 1, 1, 0, 1, 0, 0, 0 +}; + +static uint32_t binkb_intra_quant[16][64]; +static uint32_t binkb_inter_quant[16][64]; + /** * IDs for different data types used in Bink video codec */ @@ -85,7 +115,7 @@ typedef struct BinkContext { int swap_planes; ScanTable scantable; ///< permutated scantable for DCT coeffs decoding - Bundle bundle[BINK_NB_SRC]; ///< bundles for decoding all data types + Bundle bundle[BINKB_NB_SRC]; ///< bundles for decoding all data types Tree col_high[16]; ///< trees for decoding high nibble in "colours" data type int col_lastval; ///< value of last decoded high nibble in "colours" data type } BinkContext; @@ -145,7 +175,7 @@ static av_cold void init_bundles(BinkContext *c) bh = (c->avctx->height + 7) >> 3; blocks = bw * bh; - for (i = 0; i < BINK_NB_SRC; i++) { + for (i = 0; i < BINKB_NB_SRC; i++) { c->bundle[i].data = av_malloc(blocks * 64); c->bundle[i].data_end = c->bundle[i].data + blocks * 64; } @@ -159,7 +189,7 @@ static av_cold void init_bundles(BinkContext *c) static av_cold void free_bundles(BinkContext *c) { int i; - for (i = 0; i < BINK_NB_SRC; i++) + for (i = 0; i < BINKB_NB_SRC; i++) av_freep(&c->bundle[i].data); } @@ -470,7 +500,7 @@ static int read_dcs(AVCodecContext *avctx, GetBitContext *gb, Bundle *b, */ static inline int get_value(BinkContext *c, int bundle) { - int16_t ret; + int ret; if (bundle < BINK_SRC_X_OFF || bundle == BINK_SRC_RUN) return *c->bundle[bundle].cur_ptr++; @@ -481,17 +511,84 @@ static inline int get_value(BinkContext *c, int bundle) return ret; } +static void binkb_init_bundle(BinkContext *c, int bundle_num) +{ + c->bundle[bundle_num].cur_dec = + c->bundle[bundle_num].cur_ptr = c->bundle[bundle_num].data; + c->bundle[bundle_num].len = 13; +} + +static void binkb_init_bundles(BinkContext *c) +{ + int i; + for (i = 0; i < BINKB_NB_SRC; i++) + binkb_init_bundle(c, i); +} + +static int binkb_read_bundle(BinkContext *c, GetBitContext *gb, int bundle_num) +{ + const int bits = binkb_bundle_sizes[bundle_num]; + const int mask = 1 << (bits - 1); + const int issigned = binkb_bundle_signed[bundle_num]; + Bundle *b = &c->bundle[bundle_num]; + int i, len; + + CHECK_READ_VAL(gb, b, len); + if (bits <= 8) { + if (!issigned) { + for (i = 0; i < len; i++) + *b->cur_dec++ = get_bits(gb, bits); + } else { + for (i = 0; i < len; i++) + *b->cur_dec++ = get_bits(gb, bits) - mask; + } + } else { + int16_t *dst = (int16_t*)b->cur_dec; + + if (!issigned) { + for (i = 0; i < len; i++) + *dst++ = get_bits(gb, bits); + } else { + for (i = 0; i < len; i++) + *dst++ = get_bits(gb, bits) - mask; + } + b->cur_dec = (uint8_t*)dst; + } + return 0; +} + +static inline int binkb_get_value(BinkContext *c, int bundle_num) +{ + int16_t ret; + const int bits = binkb_bundle_sizes[bundle_num]; + + if (bits <= 8) { + int val = *c->bundle[bundle_num].cur_ptr++; + return binkb_bundle_signed[bundle_num] ? (int8_t)val : val; + } + ret = *(int16_t*)c->bundle[bundle_num].cur_ptr; + c->bundle[bundle_num].cur_ptr += 2; + return ret; +} + +typedef const uint32_t quant_matrices[16][64]; +static const quant_matrices * bink_quant_matrices[2][2] = { + { &bink_inter_quant, &bink_intra_quant }, + { &binkb_inter_quant, &binkb_intra_quant }, +}; + /** * Read 8x8 block of DCT coefficients. * * @param gb context for reading bits * @param block place for storing coefficients * @param scan scan order table + * @param is_binkb use version 'b' quantizer matrices * @param is_intra tells what set of quantizer matrices to use * @return 0 for success, negative value in other cases */ static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t *scan, - int is_intra) + int is_binkb, int is_intra, int q) { int coef_list[128]; int mode_list[128]; @@ -571,9 +668,14 @@ static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t * } } - quant_idx = get_bits(gb, 4); - quant = is_intra ? bink_intra_quant[quant_idx] - : bink_inter_quant[quant_idx]; + if (q == -1) { + quant_idx = get_bits(gb, 4); + } else { + quant_idx = q; + } + + quant = (*bink_quant_matrices[is_binkb][is_intra])[quant_idx]; + block[0] = (block[0] * quant[0]) >> 11; for (i = 0; i < coef_count; i++) { int idx = coef_idx[i]; @@ -673,6 +775,164 @@ static int read_residue(GetBitContext *gb, DCTELEM block[64], int masks_count) return 0; } +/** + * Copy 8x8 block from source to destination, where src and dst may be overlapped + */ +static inline void put_pixels8x8_overlapped(uint8_t *dst, uint8_t *src, int stride) +{ + uint8_t tmp[64]; + int i; + for (i = 0; i < 8; i++) + memcpy(tmp + i*8, src + i*stride, 8); + for (i = 0; i < 8; i++) + memcpy(dst + i*stride, tmp + i*8, 8); +} + +static int binkb_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, + int is_key, int is_chroma) +{ + int blk; + int i, j, bx, by; + uint8_t *dst, *ref, *ref_start, *ref_end; + int v, col[2]; + const uint8_t *scan; + int xoff, yoff; + DECLARE_ALIGNED(16, DCTELEM, block[64]); + int coordmap[64]; + int ybias = is_key ? -15 : 0; + int qp; + + const int stride = c->pic.linesize[plane_idx]; + int bw = is_chroma ? (c->avctx->width + 15) >> 4 : (c->avctx->width + 7) >> 3; + int bh = is_chroma ? (c->avctx->height + 15) >> 4 : (c->avctx->height + 7) >> 3; + + binkb_init_bundles(c); + ref_start = c->pic.data[plane_idx]; + ref_end = c->pic.data[plane_idx] + (bh * c->pic.linesize[plane_idx] + bw) * 8; + + for (i = 0; i < 64; i++) + coordmap[i] = (i & 7) + (i >> 3) * stride; + + for (by = 0; by < bh; by++) { + for (i = 0; i < BINKB_NB_SRC; i++) { + if (binkb_read_bundle(c, gb, i) < 0) + return -1; + } + + dst = c->pic.data[plane_idx] + 8*by*stride; + for (bx = 0; bx < bw; bx++, dst += 8) { + blk = binkb_get_value(c, BINKB_SRC_BLOCK_TYPES); + switch (blk) { + case 0: + break; + case 1: + scan = bink_patterns[get_bits(gb, 4)]; + i = 0; + do { + int mode, run; + + mode = get_bits1(gb); + run = get_bits(gb, binkb_runbits[i]) + 1; + + i += run; + if (i > 64) { + av_log(c->avctx, AV_LOG_ERROR, "Run went out of bounds\n"); + return -1; + } + if (mode) { + v = binkb_get_value(c, BINKB_SRC_COLORS); + for (j = 0; j < run; j++) + dst[coordmap[*scan++]] = v; + } else { + for (j = 0; j < run; j++) + dst[coordmap[*scan++]] = binkb_get_value(c, BINKB_SRC_COLORS); + } + } while (i < 63); + if (i == 63) + dst[coordmap[*scan++]] = binkb_get_value(c, BINKB_SRC_COLORS); + break; + case 2: + c->dsp.clear_block(block); + block[0] = binkb_get_value(c, BINKB_SRC_INTRA_DC); + qp = binkb_get_value(c, BINKB_SRC_INTRA_Q); + read_dct_coeffs(gb, block, c->scantable.permutated, 1, 1, qp); + c->dsp.idct_put(dst, stride, block); + break; + case 3: + xoff = binkb_get_value(c, BINKB_SRC_X_OFF); + yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias; + ref = dst + xoff + yoff * stride; + if (ref < ref_start || ref + 8*stride > ref_end) { + av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n"); + } else if (ref + 8*stride < dst || ref >= dst + 8*stride) { + c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); + } else { + put_pixels8x8_overlapped(dst, ref, stride); + } + c->dsp.clear_block(block); + v = binkb_get_value(c, BINKB_SRC_INTER_COEFS); + read_residue(gb, block, v); + c->dsp.add_pixels8(dst, block, stride); + break; + case 4: + xoff = binkb_get_value(c, BINKB_SRC_X_OFF); + yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias; + ref = dst + xoff + yoff * stride; + if (ref < ref_start || ref + 8 * stride > ref_end) { + av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n"); + } else if (ref + 8*stride < dst || ref >= dst + 8*stride) { + c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); + } else { + put_pixels8x8_overlapped(dst, ref, stride); + } + c->dsp.clear_block(block); + block[0] = binkb_get_value(c, BINKB_SRC_INTER_DC); + qp = binkb_get_value(c, BINKB_SRC_INTER_Q); + read_dct_coeffs(gb, block, c->scantable.permutated, 1, 0, qp); + c->dsp.idct_add(dst, stride, block); + break; + case 5: + v = binkb_get_value(c, BINKB_SRC_COLORS); + c->dsp.fill_block_tab[1](dst, v, stride, 8); + break; + case 6: + for (i = 0; i < 2; i++) + col[i] = binkb_get_value(c, BINKB_SRC_COLORS); + for (i = 0; i < 8; i++) { + v = binkb_get_value(c, BINKB_SRC_PATTERN); + for (j = 0; j < 8; j++, v >>= 1) + dst[i*stride + j] = col[v & 1]; + } + break; + case 7: + xoff = binkb_get_value(c, BINKB_SRC_X_OFF); + yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias; + ref = dst + xoff + yoff * stride; + if (ref < ref_start || ref + 8 * stride > ref_end) { + av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n"); + } else if (ref + 8*stride < dst || ref >= dst + 8*stride) { + c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); + } else { + put_pixels8x8_overlapped(dst, ref, stride); + } + break; + case 8: + for (i = 0; i < 8; i++) + memcpy(dst + i*stride, c->bundle[BINKB_SRC_COLORS].cur_ptr + i*8, 8); + c->bundle[BINKB_SRC_COLORS].cur_ptr += 64; + break; + default: + av_log(c->avctx, AV_LOG_ERROR, "Unknown block type %d\n", blk); + return -1; + } + } + } + if (get_bits_count(gb) & 0x1F) //next plane data starts at 32-bit boundary + skip_bits_long(gb, 32 - (get_bits_count(gb) & 0x1F)); + + return 0; +} + static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, int is_chroma) { @@ -768,7 +1028,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); - read_dct_coeffs(gb, block, c->scantable.permutated, 1); + read_dct_coeffs(gb, block, c->scantable.permutated, 0, 1, -1); c->dsp.idct(block); c->dsp.put_pixels_nonclamped(block, ublock, 8); break; @@ -852,7 +1112,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); - read_dct_coeffs(gb, block, c->scantable.permutated, 1); + read_dct_coeffs(gb, block, c->scantable.permutated, 0, 1, -1); c->dsp.idct_put(dst, stride, block); break; case FILL_BLOCK: @@ -866,7 +1126,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTER_DC); - read_dct_coeffs(gb, block, c->scantable.permutated, 0); + read_dct_coeffs(gb, block, c->scantable.permutated, 0, 0, -1); c->dsp.idct_add(dst, stride, block); break; case PATTERN_BLOCK: @@ -902,6 +1162,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac int plane, plane_idx; int bits_count = pkt->size << 3; + if (c->version > 'b') { if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); @@ -909,6 +1170,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } + } else { + if(avctx->reget_buffer(avctx, &c->pic) < 0){ + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + return -1; + } + } init_get_bits(&gb, pkt->data, bits_count); if (c->has_alpha) { @@ -923,8 +1190,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac for (plane = 0; plane < 3; plane++) { plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3); - if (bink_decode_plane(c, &gb, plane_idx, !!plane) < 0) - return -1; + if (c->version > 'b') { + if (bink_decode_plane(c, &gb, plane_idx, !!plane) < 0) + return -1; + } else { + if (binkb_decode_plane(c, &gb, plane_idx, !pkt->pts, !!plane) < 0) + return -1; + } if (get_bits_count(&gb) >= bits_count) break; } @@ -933,24 +1205,55 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; - FFSWAP(AVFrame, c->pic, c->last); + if (c->version > 'b') + FFSWAP(AVFrame, c->pic, c->last); /* always report that the buffer was completely consumed */ return pkt->size; } +/** + * Caclulate quantization tables for version b + */ +static av_cold void binkb_calc_quant() +{ + float s[64]; + int i, j; + + for (j = 0; j < 8; j++) { + for (i = 0; i < 8; i++) { + if (j && j != 4) + if (i && i != 4) + s[j*8 + i] = cos(j * M_PI/16.0f) * cos(i * M_PI/16.0f) * 2.0f; + else + s[j*8 + i] = cos(j * M_PI/16.0f) * sqrt(2.0f); + else + if (i && i != 4) + s[j*8 + i] = cos(i * M_PI/16.0f) * sqrt(2.0f); + else + s[j*8 + i] = 1.0f; + } + } + + for (j = 0; j < 16; j++) { + for (i = 0; i < 64; i++) { + binkb_intra_quant[j][i] = (1L << 12) * binkb_intra_seed[i] * s[i] * + binkb_num[j]/(float)binkb_den[j]; + binkb_inter_quant[j][i] = (1L << 12) * binkb_inter_seed[i] * s[i] * + binkb_num[j]/(float)binkb_den[j]; + } + } +} + static av_cold int decode_init(AVCodecContext *avctx) { BinkContext * const c = avctx->priv_data; static VLC_TYPE table[16 * 128][2]; + static int binkb_initialised = 0; int i; int flags; c->version = avctx->codec_tag >> 24; - if (c->version < 'c') { - av_log(avctx, AV_LOG_ERROR, "Too old version '%c'\n", c->version); - return -1; - } if (avctx->extradata_size < 4) { av_log(avctx, AV_LOG_ERROR, "Extradata missing or too short\n"); return -1; @@ -984,6 +1287,13 @@ static av_cold int decode_init(AVCodecContext *avctx) init_bundles(c); + if (c->version == 'b') { + if (!binkb_initialised) { + binkb_calc_quant(); + binkb_initialised = 1; + } + } + return 0; } diff --git a/libavcodec/binkdata.h b/libavcodec/binkdata.h index 1ca34a6843..2c20b4a4c1 100644 --- a/libavcodec/binkdata.h +++ b/libavcodec/binkdata.h @@ -611,4 +611,45 @@ static const uint32_t bink_inter_quant[16][64] = { }, }; +static const uint8_t binkb_runbits[64] = { + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 4, 4, 4, 4, 4, 4, 4, 4, + 3, 3, 3, 3, 2, 2, 1, 0, +}; + +static const uint8_t binkb_intra_seed[64] = { + 16, 16, 16, 19, 16, 19, 22, 22, + 22, 22, 26, 24, 26, 22, 22, 27, + 27, 27, 26, 26, 26, 29, 29, 29, + 27, 27, 27, 26, 34, 34, 34, 29, + 29, 29, 27, 27, 37, 34, 34, 32, + 32, 29, 29, 38, 37, 35, 35, 34, + 35, 40, 40, 40, 38, 38, 48, 48, + 46, 46, 58, 56, 56, 69, 69, 83, +}; + +static const uint8_t binkb_inter_seed[64] = { + 16, 17, 17, 18, 18, 18, 19, 19, + 19, 19, 20, 20, 20, 20, 20, 21, + 21, 21, 21, 21, 21, 22, 22, 22, + 22, 22, 22, 22, 23, 23, 23, 23, + 23, 23, 23, 23, 24, 24, 24, 25, + 24, 24, 24, 25, 26, 26, 26, 26, + 25, 27, 27, 27, 27, 27, 28, 28, + 28, 28, 30, 30, 30, 31, 31, 33, +}; + +static const uint8_t binkb_num[16] = { + 1, 4, 5, 2, 7, 8, 3, 7, 4, 9, 5, 6, 7, 8, 9, 10 +}; + +static const uint8_t binkb_den[16] = { + 1, 3, 3, 1, 3, 3, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1 +}; + #endif /* AVCODEC_BINKDATA_H */ From adb1ad0d8005dfcbae863bccdda8fdd26bb63f30 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Wed, 9 Feb 2011 23:05:19 +1100 Subject: [PATCH 321/528] bink: reindent after last commit Signed-off-by: Janne Grunau --- libavcodec/bink.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index b0775284ae..a6cfb71f0c 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1163,13 +1163,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac int bits_count = pkt->size << 3; if (c->version > 'b') { - if(c->pic.data[0]) - avctx->release_buffer(avctx, &c->pic); + if(c->pic.data[0]) + avctx->release_buffer(avctx, &c->pic); - if(avctx->get_buffer(avctx, &c->pic) < 0){ - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } + if(avctx->get_buffer(avctx, &c->pic) < 0){ + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return -1; + } } else { if(avctx->reget_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); From aa8ac53b51cd8b9446b50404660685041060fa4f Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Fri, 11 Feb 2011 13:39:31 +0000 Subject: [PATCH 322/528] Update overlay documentation after movie syntax update. Overlay documentation is still using the old unsupported syntax. Signed-off-by: Mans Rullgard --- doc/filters.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index aa073a76dc..042ea13245 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -657,13 +657,13 @@ Follow some examples: overlay=main_w-overlay_w-10:main_h-overlay_h-10 # insert a transparent PNG logo in the bottom left corner of the input -movie=0:png:logo.png [logo]; +movie=logo.png [logo]; [in][logo] overlay=10:main_h-overlay_h-10 [out] # insert 2 different transparent PNG logos (second logo on bottom # right corner): -movie=0:png:logo1.png [logo1]; -movie=0:png:logo2.png [logo2]; +movie=logo1.png [logo1]; +movie=logo2.png [logo2]; [in][logo1] overlay=10:H-h-10 [in+logo1]; [in+logo1][logo2] overlay=W-w-10:H-h-10 [out] From 7da48fd0111adf504cfcfc5ebda7fd0681968041 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 22 Dec 2010 12:57:53 +0000 Subject: [PATCH 323/528] ARM optimised vp56_rac_get_prob() Approximately 3% faster on Cortex-A8. Signed-off-by: Mans Rullgard --- libavcodec/arm/vp56_arith.h | 92 +++++++++++++++++++++++++++++++++++++ libavcodec/vp56.h | 6 ++- 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 libavcodec/arm/vp56_arith.h diff --git a/libavcodec/arm/vp56_arith.h b/libavcodec/arm/vp56_arith.h new file mode 100644 index 0000000000..9bcb466bdc --- /dev/null +++ b/libavcodec/arm/vp56_arith.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2010 Mans Rullgard + * + * 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_ARM_VP56_ARITH_H +#define AVCODEC_ARM_VP56_ARITH_H + +#if HAVE_ARMV6 && HAVE_INLINE_ASM + +#define vp56_rac_get_prob vp56_rac_get_prob_armv6 +static inline int vp56_rac_get_prob_armv6(VP56RangeCoder *c, int pr) +{ + unsigned shift = ff_vp56_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned bit; + + __asm__ volatile ("adds %3, %3, %0 \n" + "cmpcs %7, %4 \n" + "ldrcsh %2, [%4], #2 \n" + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + "rev16cs %2, %2 \n" + "orrcs %1, %1, %2, lsl %3 \n" + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "cmp %1, %0, lsl #16 \n" + "subge %1, %1, %0, lsl #16 \n" + "subge %0, %5, %0 \n" + "movge %2, #1 \n" + "movlt %2, #0 \n" + : "=&r"(c->high), "=&r"(c->code_word), "=&r"(bit), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), + "0"(shift), "1"(code_word)); + + return bit; +} + +#define vp56_rac_get_prob_branchy vp56_rac_get_prob_branchy_armv6 +static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr) +{ + unsigned shift = ff_vp56_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned low; + unsigned tmp; + + __asm__ volatile ("adds %3, %3, %0 \n" + "cmpcs %7, %4 \n" + "ldrcsh %2, [%4], #2 \n" + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + "rev16cs %2, %2 \n" + "orrcs %1, %1, %2, lsl %3 \n" + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "lsl %2, %0, #16 \n" + : "=&r"(low), "+&r"(code_word), "=&r"(tmp), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), "0"(shift)); + + if (code_word >= tmp) { + c->high = high - low; + c->code_word = code_word - tmp; + return 1; + } + + c->high = low; + c->code_word = code_word; + return 0; +} + +#endif + +#endif diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h index da6b1b64b8..d1735e5609 100644 --- a/libavcodec/vp56.h +++ b/libavcodec/vp56.h @@ -201,7 +201,9 @@ static av_always_inline unsigned int vp56_rac_renorm(VP56RangeCoder *c) return code_word; } -#if ARCH_X86 +#if ARCH_ARM +#include "arm/vp56_arith.h" +#elif ARCH_X86 #include "x86/vp56_arith.h" #endif @@ -221,6 +223,7 @@ static av_always_inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob) } #endif +#ifndef vp56_rac_get_prob_branchy // branchy variant, to be used where there's a branch based on the bit decoded static av_always_inline int vp56_rac_get_prob_branchy(VP56RangeCoder *c, int prob) { @@ -238,6 +241,7 @@ static av_always_inline int vp56_rac_get_prob_branchy(VP56RangeCoder *c, int pro c->code_word = code_word; return 0; } +#endif static av_always_inline int vp56_rac_get(VP56RangeCoder *c) { From a7878c9f73c12cfa685bd8af8f3afcca85f56a8b Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 1 Feb 2011 22:38:15 +0000 Subject: [PATCH 324/528] VP8: ARM optimised decode_block_coeffs_internal Approximately 5% faster on Cortex-A8. Signed-off-by: Mans Rullgard --- Makefile | 2 +- libavcodec/arm/Makefile | 2 + libavcodec/arm/vp8.h | 29 +++++ libavcodec/arm/vp8_armv6.S | 220 +++++++++++++++++++++++++++++++++++++ libavcodec/vp8.c | 8 +- libavcodec/vp8data.h | 2 +- 6 files changed, 260 insertions(+), 3 deletions(-) create mode 100644 libavcodec/arm/vp8.h create mode 100644 libavcodec/arm/vp8_armv6.S diff --git a/Makefile b/Makefile index 356ba29d6e..b05995534a 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ config.h: .config SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \ ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \ - HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS + HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS define RESET $(1) := diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile index 15269ea676..d223703cfe 100644 --- a/libavcodec/arm/Makefile +++ b/libavcodec/arm/Makefile @@ -3,6 +3,7 @@ OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \ OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_init_arm.o OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_arm.o +ARMV6-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8_armv6.o OBJS-$(CONFIG_H264DSP) += arm/h264dsp_init_arm.o OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o @@ -23,6 +24,7 @@ OBJS-$(HAVE_ARMV5TE) += arm/dsputil_init_armv5te.o \ OBJS-$(HAVE_ARMV6) += arm/dsputil_init_armv6.o \ arm/dsputil_armv6.o \ arm/simple_idct_armv6.o \ + $(ARMV6-OBJS-yes) VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \ diff --git a/libavcodec/arm/vp8.h b/libavcodec/arm/vp8.h new file mode 100644 index 0000000000..90e7344b62 --- /dev/null +++ b/libavcodec/arm/vp8.h @@ -0,0 +1,29 @@ +/** + * 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_ARM_VP8_H +#define AVCODEC_ARM_VP8_H + +#if HAVE_ARMV6 +#define decode_block_coeffs_internal ff_decode_block_coeffs_armv6 +int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, DCTELEM block[16], + uint8_t probs[8][3][NUM_DCT_TOKENS-1], + int i, uint8_t *token_prob, int16_t qmul[2]); +#endif + +#endif diff --git a/libavcodec/arm/vp8_armv6.S b/libavcodec/arm/vp8_armv6.S new file mode 100644 index 0000000000..54c036b82a --- /dev/null +++ b/libavcodec/arm/vp8_armv6.S @@ -0,0 +1,220 @@ +/** + * Copyright (C) 2010 Mans Rullgard + * + * 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 "asm.S" + + .syntax unified + +.macro rac_get_prob h, bs, buf, cw, pr, t0, t1 + adds \bs, \bs, \t0 + lsl \cw, \cw, \t0 + lsl \t0, \h, \t0 + rsb \h, \pr, #256 + ldrhcs \t1, [\buf], #2 + smlabb \h, \t0, \pr, \h + rev16cs \t1, \t1 + orrcs \cw, \cw, \t1, lsl \bs + subcs \bs, \bs, #16 + lsr \h, \h, #8 + cmp \cw, \h, lsl #16 + subge \cw, \cw, \h, lsl #16 + subge \h, \t0, \h +.endm + +.macro rac_get_128 h, bs, buf, cw, t0, t1 + adds \bs, \bs, \t0 + lsl \cw, \cw, \t0 + lsl \t0, \h, \t0 + ldrhcs \t1, [\buf], #2 + mov \h, #128 + rev16cs \t1, \t1 + add \h, \h, \t0, lsl #7 + orrcs \cw, \cw, \t1, lsl \bs + subcs \bs, \bs, #16 + lsr \h, \h, #8 + cmp \cw, \h, lsl #16 + subge \cw, \cw, \h, lsl #16 + subge \h, \t0, \h +.endm + +function ff_decode_block_coeffs_armv6, export=1 + push {r0,r1,r4-r11,lr} + movrel lr, ff_vp56_norm_shift + ldrd r4, r5, [sp, #44] @ token_prob, qmul + cmp r3, #0 + ldr r11, [r5] + ldm r0, {r5-r7} @ high, bits, buf + pkhtbne r11, r11, r11, asr #16 + ldr r8, [r0, #16] @ code_word +0: + ldrb r9, [lr, r5] + add r3, r3, #1 + ldrb r0, [r4, #1] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + blt 2f + + ldrb r9, [lr, r5] + ldrb r0, [r4, #2] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r9, [lr, r5] + bge 3f + + add r4, r3, r3, lsl #5 + sxth r12, r11 + add r4, r2, r4 + adds r6, r6, r9 + add r4, r4, #11 + lsl r8, r8, r9 + ldrhcs r10, [r7], #2 + lsl r9, r5, r9 + mov r5, #128 + rev16cs r10, r10 + add r5, r5, r9, lsl #7 + orrcs r8, r8, r10, lsl r6 + subcs r6, r6, #16 + lsr r5, r5, #8 + cmp r8, r5, lsl #16 + movrel r10, zigzag_scan-1 + subge r8, r8, r5, lsl #16 + subge r5, r9, r5 + ldrb r10, [r10, r3] + rsbge r12, r12, #0 + cmp r3, #16 + strh r12, [r1, r10] + bge 6f +5: + ldrb r9, [lr, r5] + ldrb r0, [r4] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + pkhtb r11, r11, r11, asr #16 + bge 0b + +6: + ldr r0, [sp] + ldr r9, [r0, #12] + cmp r7, r9 + movhi r7, r9 + stm r0, {r5-r7} @ high, bits, buf + str r8, [r0, #16] @ code_word + + add sp, sp, #8 + mov r0, r3 + pop {r4-r11,pc} +2: + add r4, r3, r3, lsl #5 + cmp r3, #16 + add r4, r2, r4 + pkhtb r11, r11, r11, asr #16 + bne 0b + b 6b +3: + ldrb r0, [r4, #3] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r9, [lr, r5] + bge 1f + + mov r12, #2 + ldrb r0, [r4, #4] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, #1 + ldrb r9, [lr, r5] + blt 4f + ldrb r0, [r4, #5] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, #1 + ldrb r9, [lr, r5] + b 4f +1: + ldrb r0, [r4, #6] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r9, [lr, r5] + bge 3f + + ldrb r0, [r4, #7] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r9, [lr, r5] + bge 2f + + mov r12, #5 + mov r0, #159 + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, r12, #1 + ldrb r9, [lr, r5] + b 4f +2: + mov r12, #7 + mov r0, #165 + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, r12, #2 + ldrb r9, [lr, r5] + mov r0, #145 + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, r12, #1 + ldrb r9, [lr, r5] + b 4f +3: + ldrb r0, [r4, #8] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r4, r4, #1 + ldrb r9, [lr, r5] + movge r12, #2 + movlt r12, #0 + ldrb r0, [r4, #9] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + mov r9, #8 + addge r12, r12, #1 + movrel r4, ff_vp8_dct_cat_prob + lsl r9, r9, r12 + ldr r4, [r4, r12, lsl #2] + add r12, r9, #3 + mov r1, #0 + ldrb r0, [r4], #1 +1: + ldrb r9, [lr, r5] + lsl r1, r1, #1 + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r0, [r4], #1 + addge r1, r1, #1 + cmp r0, #0 + bne 1b + ldrb r9, [lr, r5] + add r12, r12, r1 + ldr r1, [sp, #4] +4: + add r4, r3, r3, lsl #5 + add r4, r2, r4 + add r4, r4, #22 + rac_get_128 r5, r6, r7, r8, r9, r10 + rsbge r12, r12, #0 + smulbb r12, r12, r11 + movrel r9, zigzag_scan-1 + ldrb r9, [r9, r3] + cmp r3, #16 + strh r12, [r1, r9] + bge 6b + b 5b +endfunc + + .section .rodata +zigzag_scan: + .byte 0, 2, 8, 16 + .byte 10, 4, 6, 12 + .byte 18, 24, 26, 20 + .byte 14, 22, 28, 30 diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 8de8968d6e..3cd76249d0 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -30,6 +30,10 @@ #include "h264pred.h" #include "rectangle.h" +#if ARCH_ARM +# include "arm/vp8.h" +#endif + typedef struct { uint8_t filter_level; uint8_t inner_limit; @@ -801,6 +805,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_ } } +#ifndef decode_block_coeffs_internal /** * @param c arithmetic bitstream reader context * @param block destination for block coefficients @@ -854,7 +859,7 @@ skip_eob: int b = vp56_rac_get_prob(c, token_prob[9+a]); int cat = (a<<1) + b; coeff = 3 + (8< Date: Fri, 11 Feb 2011 18:28:12 +0000 Subject: [PATCH 325/528] configure: remove early check_deps $ARCH_EXT_LIST The early disabling of irrelevant arch extensions is no longer required, and removing it makes dependencies involving these work as expected. Signed-off-by: Mans Rullgard --- configure | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure b/configure index a3ca15d6d5..a310d257e4 100755 --- a/configure +++ b/configure @@ -2494,8 +2494,6 @@ die_license_disabled version3 libopencore_amrwb enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; } -check_deps $ARCH_EXT_LIST - disabled optimizations || check_cflags -fomit-frame-pointer enable_pic() { From 2a03e8733071f4a4051ba06a00e0af328082eed1 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 10 Feb 2011 21:35:21 -0500 Subject: [PATCH 326/528] Add missing terminating backslash --- libavcodec/avcodec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index ebad958ae7..e48033dca0 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1044,7 +1044,7 @@ typedef struct AVPanScan{ * - encoding: Set by libavcodec.\ * - decoding: Set by libavcodec.\ */\ - void *thread_opaque; + void *thread_opaque;\ #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 From 74b1f96859eb967222fcb3eb4c72d949b5165a89 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 11 Feb 2011 15:17:32 -0500 Subject: [PATCH 327/528] Add check for Athlon64 and similar AMD processors with slow SSE2. Signed-off-by: Ronald S. Bultje --- libavutil/x86/cpu.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index 4b6cb0df00..6fa4a46567 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -109,13 +109,28 @@ int ff_get_cpu_flags_x86(void) rval |= AV_CPU_FLAG_MMX; if (ext_caps & (1<<22)) rval |= AV_CPU_FLAG_MMX2; + + /* Allow for selectively disabling SSE2 functions on AMD processors + with SSE2 support but not SSE4a. This includes Athlon64, some + Opteron, and some Sempron processors. MMX, SSE, or 3DNow! are faster + than SSE2 often enough to utilize this special-case flag. + AV_CPU_FLAG_SSE2 and AV_CPU_FLAG_SSE2SLOW are both set in this case + so that SSE2 is used unless explicitly disabled by checking + AV_CPU_FLAG_SSE2SLOW. */ + if (!strncmp(vendor.c, "AuthenticAMD", 12) && + rval & AV_CPU_FLAG_SSE2 && !(ecx & 0x00000040)) { + rval |= AV_CPU_FLAG_SSE2SLOW; + } } 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. */ + * so let's just pretend they don't. AV_CPU_FLAG_SSE2 is disabled and + * AV_CPU_FLAG_SSE2SLOW is enabled so that SSE2 is not used unless + * explicitly enabled by checking AV_CPU_FLAG_SSE2SLOW. The same + * situation applies for AV_CPU_FLAG_SSE3 and AV_CPU_FLAG_SSE3SLOW. */ 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; } From b2dd842d21a0b441bb9f7092357f479beb6b6f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 11 Feb 2011 23:36:47 +0200 Subject: [PATCH 328/528] rtsp/rdt: Assign the RTSPStream index to AVStream->id This is used for mapping AVStreams back to their corresponding RTSPStream. Since d9c0510, the RTSPStream pointer isn't stored in AVStream->priv_data any longer, breaking this mapping from AVStreams to RTSPStreams. Also, we don't need to clear the priv_data in rdt cleanup any longer, since it isn't set to duplicate pointers. Signed-off-by: Ronald S. Bultje --- libavformat/rdt.c | 12 +++--------- libavformat/rtsp.c | 2 +- libavformat/rtspdec.c | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/libavformat/rdt.c b/libavformat/rdt.c index bb7f278163..a9bf476276 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -63,7 +63,7 @@ ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx, do { s->n_streams++; } while (first_stream_of_set_idx + s->n_streams < ic->nb_streams && - s->streams[s->n_streams]->priv_data == s->streams[0]->priv_data); + s->streams[s->n_streams]->id == s->streams[0]->id); s->prev_set_id = -1; s->prev_stream_id = -1; s->prev_timestamp = -1; @@ -76,11 +76,6 @@ ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx, void ff_rdt_parse_close(RDTDemuxContext *s) { - int i; - - for (i = 1; i < s->n_streams; i++) - s->streams[i]->priv_data = NULL; - av_free(s); } @@ -422,7 +417,7 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index, int n, first = -1; for (n = 0; n < s->nb_streams; n++) - if (s->streams[n]->priv_data == stream->priv_data) { + if (s->streams[n]->id == stream->id) { int count = s->streams[n]->index + 1; if (first == -1) first = n; if (rdt->nb_rmst < count) { @@ -463,10 +458,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st) { AVStream *st; - if (!(st = av_new_stream(s, 0))) + if (!(st = av_new_stream(s, orig_st->id))) return NULL; st->codec->codec_type = orig_st->codec->codec_type; - st->priv_data = orig_st->priv_data; st->first_dts = orig_st->first_dts; return st; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index d3e88e9a5c..41427ae08e 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -322,7 +322,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) { /* no corresponding stream */ } else { - st = av_new_stream(s, 0); + st = av_new_stream(s, rt->nb_rtsp_streams - 1); if (!st) return; rtsp_st->stream_index = st->index; diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 45ed7bb9bb..e484347896 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -283,7 +283,7 @@ retry: 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]->id == i) { if (s->streams[r]->discard != AVDISCARD_ALL) { if (!first) av_strlcat(rt->last_subscription, ",", From 646739a0a8368bd234ff077c093bbf01e9e7f44a Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Fri, 11 Feb 2011 23:20:10 +0000 Subject: [PATCH 329/528] Fix qtrle regression test, actually test qtrle. Signed-off-by: Mans Rullgard --- tests/codec-regression.sh | 4 ++-- tests/ref/vsynth1/qtrle | 8 ++++---- tests/ref/vsynth2/qtrle | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh index 71d50a1298..b705bc188d 100755 --- a/tests/codec-regression.sh +++ b/tests/codec-regression.sh @@ -249,8 +249,8 @@ do_video_decoding "" "-pix_fmt yuv420p" fi if [ -n "$do_qtrle" ] ; then -do_video_encoding qtrle.mov "" "" -do_video_decoding "" "" +do_video_encoding qtrle.mov "" "-an -vcodec qtrle" +do_video_decoding "" "-pix_fmt yuv420p" fi if [ -n "$do_rgb" ] ; then diff --git a/tests/ref/vsynth1/qtrle b/tests/ref/vsynth1/qtrle index 8aa578fcc3..9988897b91 100644 --- a/tests/ref/vsynth1/qtrle +++ b/tests/ref/vsynth1/qtrle @@ -1,4 +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 +d14041925ce5ec5001dc519276b1a1ab *./tests/data/vsynth1/qtrle.mov +15263232 ./tests/data/vsynth1/qtrle.mov +243325fb2cae1a9245efd49aff936327 *./tests/data/qtrle.vsynth1.out.yuv +stddev: 3.42 PSNR: 37.43 MAXDIFF: 48 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/qtrle b/tests/ref/vsynth2/qtrle index 756ed693a0..6b2a01168e 100644 --- a/tests/ref/vsynth2/qtrle +++ b/tests/ref/vsynth2/qtrle @@ -1,4 +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 +d8c1604dc46d9aa4ec0385e6722c6989 *./tests/data/vsynth2/qtrle.mov +14798419 ./tests/data/vsynth2/qtrle.mov +b2418e0e3a9a8619b31219cbcf24dc82 *./tests/data/qtrle.vsynth2.out.yuv +stddev: 1.26 PSNR: 46.06 MAXDIFF: 13 bytes: 7603200/ 7603200 From cd6a5a57b820c5fe008ea0f91a727861b7b2a331 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 12 Feb 2011 08:50:35 +0000 Subject: [PATCH 330/528] Add lavfi-showfiltfmts and graph2dot to $(TOOLS) Allow make clean to remove the corresponding binaries. Fix issue 2162. Signed-off-by: Mans Rullgard --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b05995534a..fbf4c76e09 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ OBJS = $(PROGS-yes:%=%.o) cmdutils.o MANPAGES = $(PROGS-yes:%=doc/%.1) PODPAGES = $(PROGS-yes:%=doc/%.pod) HTMLPAGES = $(PROGS-yes:%=doc/%.html) -TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher)) +TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher)) TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 HOSTPROGS := $(TESTTOOLS:%=tests/%) From 40321376d8aea3347bec9c4d09925e8c5b8edb55 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 12 Feb 2011 08:50:46 +0000 Subject: [PATCH 331/528] Allow "make clean" to clean files in tools Signed-off-by: Mans Rullgard --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index fbf4c76e09..99d264a446 100644 --- a/Makefile +++ b/Makefile @@ -169,6 +169,7 @@ clean:: testclean $(RM) $(CLEANSUFFIXES) $(RM) doc/*.html doc/*.pod doc/*.1 $(RM) $(TOOLS) + $(RM) $(CLEANSUFFIXES:%=tools/%) distclean:: $(RM) $(DISTCLEANSUFFIXES) From e063f5886b27a7374f5060b7c2c21385685b2cb0 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 12 Feb 2011 09:12:41 +0000 Subject: [PATCH 332/528] Fix script command in a FAQ entry In the FAQ section "How do I encode single pictures into movies?", use -s for generating symbolic links with the ln command. The script was generating hard links, which is not likely what it was supposed to do. Fix issue 2488. Signed-off-by: Mans Rullgard --- doc/faq.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/faq.texi b/doc/faq.texi index 100adff312..eeaf0df6a9 100644 --- a/doc/faq.texi +++ b/doc/faq.texi @@ -147,7 +147,7 @@ that match @code{*jpg} to the @file{/tmp} directory in the sequence of @file{img001.jpg}, @file{img002.jpg} and so on. @example - x=1; for i in *jpg; do counter=$(printf %03d $x); ln "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done + x=1; for i in *jpg; do counter=$(printf %03d $x); ln -s "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done @end example If you want to sequence them by oldest modified first, substitute From 47d62c965b7bcf4715127fbf9bffab7b4c5c88b7 Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Sat, 12 Feb 2011 10:15:58 +0100 Subject: [PATCH 333/528] Make tables generation insensitive to floating-point implementation Using doubles make the double -> int cast well defined for all the values used, with the exception of when s[i]==1.0, which is special-cased. Signed-off-by: Mans Rullgard --- libavcodec/bink.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index a6cfb71f0c..928bf53b3b 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1217,30 +1217,37 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac */ static av_cold void binkb_calc_quant() { - float s[64]; + double s[64]; int i, j; for (j = 0; j < 8; j++) { for (i = 0; i < 8; i++) { if (j && j != 4) if (i && i != 4) - s[j*8 + i] = cos(j * M_PI/16.0f) * cos(i * M_PI/16.0f) * 2.0f; + s[j*8 + i] = cos(j * M_PI/16.0) * cos(i * M_PI/16.0) * 2.0; else - s[j*8 + i] = cos(j * M_PI/16.0f) * sqrt(2.0f); + s[j*8 + i] = cos(j * M_PI/16.0) * sqrt(2.0); else if (i && i != 4) - s[j*8 + i] = cos(i * M_PI/16.0f) * sqrt(2.0f); + s[j*8 + i] = cos(i * M_PI/16.0) * sqrt(2.0); else - s[j*8 + i] = 1.0f; + s[j*8 + i] = 1.0; } } for (j = 0; j < 16; j++) { for (i = 0; i < 64; i++) { - binkb_intra_quant[j][i] = (1L << 12) * binkb_intra_seed[i] * s[i] * - binkb_num[j]/(float)binkb_den[j]; - binkb_inter_quant[j][i] = (1L << 12) * binkb_inter_seed[i] * s[i] * - binkb_num[j]/(float)binkb_den[j]; + if (s[i] == 1.0) { + binkb_intra_quant[j][i] = (1L << 12) * binkb_intra_seed[i] * + binkb_num[j]/binkb_den[j]; + binkb_inter_quant[j][i] = (1L << 12) * binkb_inter_seed[i] * + binkb_num[j]/binkb_den[j]; + } else { + binkb_intra_quant[j][i] = (1L << 12) * binkb_intra_seed[i] * s[i] * + binkb_num[j]/(double)binkb_den[j]; + binkb_inter_quant[j][i] = (1L << 12) * binkb_inter_seed[i] * s[i] * + binkb_num[j]/(double)binkb_den[j]; + } } } } From 44b11207248c6ca6edb7d3469c0fbdca45dbfa70 Mon Sep 17 00:00:00 2001 From: Takashi Mochizuki Date: Sun, 13 Feb 2011 09:18:45 +0900 Subject: [PATCH 334/528] movenc: Force first sample as SYNC Signed-off-by: Mans Rullgard --- libavformat/movenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0949d29457..5e6e3a6521 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1981,7 +1981,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) trk->cluster[trk->entry].cts = pkt->pts - pkt->dts; trk->cluster[trk->entry].flags = 0; if (pkt->flags & AV_PKT_FLAG_KEY) { - if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO) { + if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO && + trk->entry > 0) { // force sync sample for the first key frame mov_parse_mpeg2_frame(pkt, &trk->cluster[trk->entry].flags); if (trk->cluster[trk->entry].flags & MOV_PARTIAL_SYNC_SAMPLE) trk->flags |= MOV_TRACK_STPS; From f344903ca5ce28a833fdd656bc1ed5b16d97e7e9 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 13 Feb 2011 00:19:06 +0000 Subject: [PATCH 335/528] Fix MMX rgb24 to yuv conversion with gcc 4.6 When built with gcc 4.6, the MMX rgb24 to yuv conversion gives wrong output. The compiler produces this warning: libswscale/swscale_template.c:1885:5: warning: use of memory input without lvalue in asm operand 4 is deprecated Changing the memory operand to a register makes it work. Signed-off-by: Mans Rullgard --- libswscale/swscale_template.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 9da6b41f72..9863a7c92f 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -1883,7 +1883,7 @@ static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long w static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat) { __asm__ volatile( - "movq 24+%4, %%mm6 \n\t" + "movq 24(%4), %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" "pxor %%mm7, %%mm7 \n\t" "1: \n\t" @@ -1894,9 +1894,9 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin "punpcklbw %%mm7, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" - "pmaddwd %4, %%mm0 \n\t" - "pmaddwd 8+%4, %%mm1 \n\t" - "pmaddwd 16+%4, %%mm2 \n\t" + "pmaddwd (%4), %%mm0 \n\t" + "pmaddwd 8(%4), %%mm1 \n\t" + "pmaddwd 16(%4), %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" "paddd %%mm1, %%mm0 \n\t" "paddd %%mm3, %%mm2 \n\t" @@ -1908,9 +1908,9 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin "punpcklbw %%mm7, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" - "pmaddwd %4, %%mm1 \n\t" - "pmaddwd 8+%4, %%mm3 \n\t" - "pmaddwd 16+%4, %%mm4 \n\t" + "pmaddwd (%4), %%mm1 \n\t" + "pmaddwd 8(%4), %%mm3 \n\t" + "pmaddwd 16(%4), %%mm4 \n\t" "pmaddwd %%mm6, %%mm5 \n\t" "paddd %%mm3, %%mm1 \n\t" "paddd %%mm5, %%mm4 \n\t" @@ -1933,7 +1933,7 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin "add $4, %%"REG_a" \n\t" " js 1b \n\t" : "+r" (src) - : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0]) + : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "r"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24]) : "%"REG_a ); } From cb62510cab8b745e65eb966c72ab7e9b122d564b Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 13 Feb 2011 03:33:49 +0000 Subject: [PATCH 336/528] bink: simplify how quantization matrices are passed to read_dct_coeffs() Signed-off-by: Mans Rullgard --- libavcodec/bink.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 928bf53b3b..f13e1c7a1b 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -571,24 +571,17 @@ static inline int binkb_get_value(BinkContext *c, int bundle_num) return ret; } -typedef const uint32_t quant_matrices[16][64]; -static const quant_matrices * bink_quant_matrices[2][2] = { - { &bink_inter_quant, &bink_intra_quant }, - { &binkb_inter_quant, &binkb_intra_quant }, -}; - /** * Read 8x8 block of DCT coefficients. * * @param gb context for reading bits * @param block place for storing coefficients * @param scan scan order table - * @param is_binkb use version 'b' quantizer matrices - * @param is_intra tells what set of quantizer matrices to use + * @param quant_matrices quantization matrices * @return 0 for success, negative value in other cases */ static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t *scan, - int is_binkb, int is_intra, int q) + const uint32_t quant_matrices[16][64], int q) { int coef_list[128]; int mode_list[128]; @@ -674,7 +667,7 @@ static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t * quant_idx = q; } - quant = (*bink_quant_matrices[is_binkb][is_intra])[quant_idx]; + quant = quant_matrices[quant_idx]; block[0] = (block[0] * quant[0]) >> 11; for (i = 0; i < coef_count; i++) { @@ -855,7 +848,7 @@ static int binkb_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, c->dsp.clear_block(block); block[0] = binkb_get_value(c, BINKB_SRC_INTRA_DC); qp = binkb_get_value(c, BINKB_SRC_INTRA_Q); - read_dct_coeffs(gb, block, c->scantable.permutated, 1, 1, qp); + read_dct_coeffs(gb, block, c->scantable.permutated, binkb_intra_quant, qp); c->dsp.idct_put(dst, stride, block); break; case 3: @@ -888,7 +881,7 @@ static int binkb_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, c->dsp.clear_block(block); block[0] = binkb_get_value(c, BINKB_SRC_INTER_DC); qp = binkb_get_value(c, BINKB_SRC_INTER_Q); - read_dct_coeffs(gb, block, c->scantable.permutated, 1, 0, qp); + read_dct_coeffs(gb, block, c->scantable.permutated, binkb_inter_quant, qp); c->dsp.idct_add(dst, stride, block); break; case 5: @@ -1028,7 +1021,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); - read_dct_coeffs(gb, block, c->scantable.permutated, 0, 1, -1); + read_dct_coeffs(gb, block, c->scantable.permutated, bink_intra_quant, -1); c->dsp.idct(block); c->dsp.put_pixels_nonclamped(block, ublock, 8); break; @@ -1112,7 +1105,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); - read_dct_coeffs(gb, block, c->scantable.permutated, 0, 1, -1); + read_dct_coeffs(gb, block, c->scantable.permutated, bink_intra_quant, -1); c->dsp.idct_put(dst, stride, block); break; case FILL_BLOCK: @@ -1126,7 +1119,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTER_DC); - read_dct_coeffs(gb, block, c->scantable.permutated, 0, 0, -1); + read_dct_coeffs(gb, block, c->scantable.permutated, bink_inter_quant, -1); c->dsp.idct_add(dst, stride, block); break; case PATTERN_BLOCK: From 231539217431c32d4f22a16ee2834e24f54611f4 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 13 Feb 2011 09:36:29 +0000 Subject: [PATCH 337/528] bink: permute Bink version 'b' quant matrices by inverse scan order This fixes visual glitches in Bink version 'b' files, as the quantization tables were not being permuted. Signed-off-by: Mans Rullgard --- libavcodec/bink.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index f13e1c7a1b..95cfc92721 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1210,6 +1210,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac */ static av_cold void binkb_calc_quant() { + uint8_t inv_bink_scan[64]; double s[64]; int i, j; @@ -1228,17 +1229,21 @@ static av_cold void binkb_calc_quant() } } + for (i = 0; i < 64; i++) + inv_bink_scan[bink_scan[i]] = i; + for (j = 0; j < 16; j++) { for (i = 0; i < 64; i++) { + int k = inv_bink_scan[i]; if (s[i] == 1.0) { - binkb_intra_quant[j][i] = (1L << 12) * binkb_intra_seed[i] * + binkb_intra_quant[j][k] = (1L << 12) * binkb_intra_seed[i] * binkb_num[j]/binkb_den[j]; - binkb_inter_quant[j][i] = (1L << 12) * binkb_inter_seed[i] * + binkb_inter_quant[j][k] = (1L << 12) * binkb_inter_seed[i] * binkb_num[j]/binkb_den[j]; } else { - binkb_intra_quant[j][i] = (1L << 12) * binkb_intra_seed[i] * s[i] * + binkb_intra_quant[j][k] = (1L << 12) * binkb_intra_seed[i] * s[i] * binkb_num[j]/(double)binkb_den[j]; - binkb_inter_quant[j][i] = (1L << 12) * binkb_inter_seed[i] * s[i] * + binkb_inter_quant[j][k] = (1L << 12) * binkb_inter_seed[i] * s[i] * binkb_num[j]/(double)binkb_den[j]; } } From 482d98f69b2eb7a7b0b5054101a43db384e9432b Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sat, 29 Jan 2011 03:36:30 +0200 Subject: [PATCH 338/528] spdifenc: IEC 61937 encapsulation of DTS-HD for HDMI Signed-off-by: Janne Grunau --- Changelog | 2 +- libavformat/spdifenc.c | 148 +++++++++++++++++++++++++++++++++++++++++ libavformat/version.h | 2 +- 3 files changed, 150 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 6053a28ee3..3a9922f705 100644 --- a/Changelog +++ b/Changelog @@ -55,7 +55,7 @@ version : - Win64 support for optimized asm functions - MJPEG/AVI1 to JPEG/JFIF bitstream filter - ASS subtitle encoder and decoder -- IEC 61937 encapsulation for E-AC3 and TrueHD (for HDMI passthrough) +- IEC 61937 encapsulation for E-AC3, TrueHD, DTS-HD (for HDMI passthrough) - overlay filter added - rename aspect filter to setdar, and pixelaspect to setsar - IEC 61937 demuxer diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index 3eea31e953..3c6fd73dbe 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -48,9 +48,12 @@ #include "spdif.h" #include "libavcodec/ac3.h" #include "libavcodec/dca.h" +#include "libavcodec/dcadata.h" #include "libavcodec/aacadtsdec.h" +#include "libavutil/opt.h" typedef struct IEC61937Context { + const AVClass *av_class; enum IEC61937DataType data_type;///< burst info - reference to type of payload of the data-burst int length_code; ///< length code in bits or bytes, depending on data type int pkt_offset; ///< data burst repetition period in bytes @@ -68,11 +71,24 @@ typedef struct IEC61937Context { int hd_buf_count; ///< number of frames in the hd audio buffer int hd_buf_filled; ///< amount of bytes in the hd audio buffer + int dtshd_skip; ///< counter used for skipping DTS-HD frames + + /* AVOptions: */ + int dtshd_rate; + int dtshd_fallback; + /// function, which generates codec dependent header information. /// Sets data_type and pkt_offset, and length_code, out_bytes, out_buf if necessary int (*header_info) (AVFormatContext *s, AVPacket *pkt); } IEC61937Context; +static const AVOption options[] = { +{ "dtshd_rate", "mux complete DTS frames in HD mode at the specified IEC958 rate (in Hz, default 0=disabled)", offsetof(IEC61937Context, dtshd_rate), FF_OPT_TYPE_INT, 0, 0, 768000, AV_OPT_FLAG_ENCODING_PARAM }, +{ "dtshd_fallback_time", "min secs to strip HD for after an overflow (-1: till the end, default 60)", offsetof(IEC61937Context, dtshd_fallback), FF_OPT_TYPE_INT, 60, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, +{ NULL }, +}; + +static const AVClass class = { "spdif", av_default_item_name, options, LIBAVUTIL_VERSION_INT }; static int spdif_header_ac3(AVFormatContext *s, AVPacket *pkt) { @@ -115,15 +131,125 @@ static int spdif_header_eac3(AVFormatContext *s, AVPacket *pkt) return 0; } +/* + * DTS type IV (DTS-HD) can be transmitted with various frame repetition + * periods; longer repetition periods allow for longer packets and therefore + * higher bitrate. Longer repetition periods mean that the constant bitrate of + * the outputted IEC 61937 stream is higher. + * The repetition period is measured in IEC 60958 frames (4 bytes). + */ +enum { + DTS4_REP_PER_512 = 0x0, + DTS4_REP_PER_1024 = 0x1, + DTS4_REP_PER_2048 = 0x2, + DTS4_REP_PER_4096 = 0x3, + DTS4_REP_PER_8192 = 0x4, + DTS4_REP_PER_16384 = 0x5, +}; + +static int spdif_dts4_subtype(int period) +{ + switch (period) { + case 512: return DTS4_REP_PER_512; + case 1024: return DTS4_REP_PER_1024; + case 2048: return DTS4_REP_PER_2048; + case 4096: return DTS4_REP_PER_4096; + case 8192: return DTS4_REP_PER_8192; + case 16384: return DTS4_REP_PER_16384; + } + return -1; +} + +static int spdif_header_dts4(AVFormatContext *s, AVPacket *pkt, int core_size, + int sample_rate, int blocks) +{ + IEC61937Context *ctx = s->priv_data; + static const char dtshd_start_code[10] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe }; + int pkt_size = pkt->size; + int period; + int subtype; + + if (!core_size) { + av_log(s, AV_LOG_ERROR, "HD mode not supported for this format\n"); + return AVERROR(EINVAL); + } + + if (!sample_rate) { + av_log(s, AV_LOG_ERROR, "Unknown DTS sample rate for HD\n"); + return AVERROR_INVALIDDATA; + } + + period = ctx->dtshd_rate * (blocks << 5) / sample_rate; + subtype = spdif_dts4_subtype(period); + + if (subtype < 0) { + av_log(s, AV_LOG_ERROR, "Specified HD rate of %d Hz would require an " + "impossible repetition period of %d for the current DTS stream" + " (blocks = %d, sample rate = %d)\n", ctx->dtshd_rate, period, + blocks << 5, sample_rate); + return AVERROR(EINVAL); + } + + /* set pkt_offset and DTS IV subtype according to the requested output + * rate */ + ctx->pkt_offset = period * 4; + ctx->data_type = IEC61937_DTSHD | subtype << 8; + + /* If the bitrate is too high for transmitting at the selected + * repetition period setting, strip DTS-HD until a good amount + * of consecutive non-overflowing HD frames have been observed. + * This generally only happens if the caller is cramming a Master + * Audio stream into 192kHz IEC 60958 (which may or may not fit). */ + if (sizeof(dtshd_start_code) + 2 + pkt_size + > ctx->pkt_offset - BURST_HEADER_SIZE && core_size) { + if (!ctx->dtshd_skip) + av_log(s, AV_LOG_WARNING, "DTS-HD bitrate too high, " + "temporarily sending core only\n"); + if (ctx->dtshd_fallback > 0) + ctx->dtshd_skip = sample_rate * ctx->dtshd_fallback / (blocks << 5); + else + /* skip permanently (-1) or just once (0) */ + ctx->dtshd_skip = 1; + } + if (ctx->dtshd_skip && core_size) { + pkt_size = core_size; + if (ctx->dtshd_fallback >= 0) + --ctx->dtshd_skip; + } + + ctx->out_bytes = sizeof(dtshd_start_code) + 2 + pkt_size; + ctx->length_code = ctx->out_bytes; + + ctx->hd_buf = av_fast_realloc(ctx->hd_buf, &ctx->hd_buf_size, + ctx->out_bytes); + if (!ctx->hd_buf) + return AVERROR(ENOMEM); + + ctx->out_buf = ctx->hd_buf; + + memcpy(ctx->hd_buf, dtshd_start_code, sizeof(dtshd_start_code)); + AV_WB16(ctx->hd_buf + sizeof(dtshd_start_code), pkt_size); + memcpy(ctx->hd_buf + sizeof(dtshd_start_code) + 2, pkt->data, pkt_size); + + return 0; +} + static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) { IEC61937Context *ctx = s->priv_data; uint32_t syncword_dts = AV_RB32(pkt->data); int blocks; + int sample_rate = 0; + int core_size = 0; + + if (pkt->size < 9) + return AVERROR_INVALIDDATA; switch (syncword_dts) { case DCA_MARKER_RAW_BE: blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f; + core_size = ((AV_RB24(pkt->data + 5) >> 4) & 0x3fff) + 1; + sample_rate = dca_sample_rates[(pkt->data[8] >> 2) & 0x0f]; break; case DCA_MARKER_RAW_LE: blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f; @@ -138,11 +264,22 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) (((pkt->data[4] & 0x07) << 4) | ((pkt->data[7] & 0x3f) >> 2)); ctx->extra_bswap = 1; break; + case DCA_HD_MARKER: + /* We only handle HD frames that are paired with core. However, + sometimes DTS-HD streams with core have a stray HD frame without + core in the beginning of the stream. */ + av_log(s, AV_LOG_ERROR, "stray DTS-HD frame\n"); + return AVERROR_INVALIDDATA; default: av_log(s, AV_LOG_ERROR, "bad DTS syncword 0x%x\n", syncword_dts); return AVERROR_INVALIDDATA; } blocks++; + + if (ctx->dtshd_rate) + /* DTS type IV output requested */ + return spdif_header_dts4(s, pkt, core_size, sample_rate, blocks); + switch (blocks) { case 512 >> 5: ctx->data_type = IEC61937_DTS1; break; case 1024 >> 5: ctx->data_type = IEC61937_DTS2; break; @@ -152,6 +289,13 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) blocks << 5); return AVERROR(ENOSYS); } + + /* discard extraneous data by default */ + if (core_size && core_size < pkt->size) { + ctx->out_bytes = core_size; + ctx->length_code = core_size << 3; + } + ctx->pkt_offset = blocks << 7; if (ctx->out_bytes == ctx->pkt_offset) { @@ -159,6 +303,9 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) * preamble as it would not fit in there. This is the case for dts * discs and dts-in-wav. */ ctx->use_preamble = 0; + } else if (ctx->out_bytes > ctx->pkt_offset - BURST_HEADER_SIZE) { + av_log_ask_for_sample(s, "Unrecognized large DTS frame."); + /* This will fail with a "bitrate too high" in the caller */ } return 0; @@ -393,4 +540,5 @@ AVOutputFormat ff_spdif_muxer = { spdif_write_header, spdif_write_packet, spdif_write_trailer, + .priv_class = &class, }; diff --git a/libavformat/version.h b/libavformat/version.h index d1a643aaac..d13ec07799 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -25,7 +25,7 @@ #define LIBAVFORMAT_VERSION_MAJOR 52 #define LIBAVFORMAT_VERSION_MINOR 99 -#define LIBAVFORMAT_VERSION_MICRO 0 +#define LIBAVFORMAT_VERSION_MICRO 1 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ From 57f2c9aed9fecbb1e6798ec33613141afe74fd31 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sat, 12 Feb 2011 15:57:01 +0200 Subject: [PATCH 339/528] spdifenc: fix byte order on big-endian systems There is a check for HAVE_BIGENDIAN when outputting the IEC 61937 stream. On big-endian systems the payload data is not byteswapped, causing in effect the outputted payload data to be in a different byte order on big-endian than on little-endian systems. However, the IEC 61937 preamble (and the final odd byte if present) is always outputted in the same byte order. This means that on big-endian systems the headers have a different byte order than the payload, preventing useful use of the output. Fix that by outputting the data in a format suitable for sending to an audio device in S16LE format by default. Output as big-endian (S16BE) is added as an AVOption. This makes the muxer output the same on all archs by default. Signed-off-by: Janne Grunau --- libavformat/spdifenc.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index 3c6fd73dbe..adc245a331 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -76,6 +76,8 @@ typedef struct IEC61937Context { /* AVOptions: */ int dtshd_rate; int dtshd_fallback; +#define SPDIF_FLAG_BIGENDIAN 0x01 + int spdif_flags; /// function, which generates codec dependent header information. /// Sets data_type and pkt_offset, and length_code, out_bytes, out_buf if necessary @@ -83,6 +85,8 @@ typedef struct IEC61937Context { } IEC61937Context; static const AVOption options[] = { +{ "spdif_flags", "IEC 61937 encapsulation flags", offsetof(IEC61937Context, spdif_flags), FF_OPT_TYPE_FLAGS, 0, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" }, +{ "be", "output in big-endian format (for use as s16be)", 0, FF_OPT_TYPE_CONST, SPDIF_FLAG_BIGENDIAN, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" }, { "dtshd_rate", "mux complete DTS frames in HD mode at the specified IEC958 rate (in Hz, default 0=disabled)", offsetof(IEC61937Context, dtshd_rate), FF_OPT_TYPE_INT, 0, 0, 768000, AV_OPT_FLAG_ENCODING_PARAM }, { "dtshd_fallback_time", "min secs to strip HD for after an overflow (-1: till the end, default 60)", offsetof(IEC61937Context, dtshd_fallback), FF_OPT_TYPE_INT, 60, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, { NULL }, @@ -477,6 +481,15 @@ static int spdif_write_trailer(AVFormatContext *s) return 0; } +static av_always_inline void spdif_put_16(IEC61937Context *ctx, + ByteIOContext *pb, unsigned int val) +{ + if (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN) + put_be16(pb, val); + else + put_le16(pb, val); +} + static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) { IEC61937Context *ctx = s->priv_data; @@ -501,13 +514,13 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) } if (ctx->use_preamble) { - put_le16(s->pb, SYNCWORD1); //Pa - put_le16(s->pb, SYNCWORD2); //Pb - put_le16(s->pb, ctx->data_type); //Pc - put_le16(s->pb, ctx->length_code);//Pd + spdif_put_16(ctx, s->pb, SYNCWORD1); //Pa + spdif_put_16(ctx, s->pb, SYNCWORD2); //Pb + spdif_put_16(ctx, s->pb, ctx->data_type); //Pc + spdif_put_16(ctx, s->pb, ctx->length_code);//Pd } - if (HAVE_BIGENDIAN ^ ctx->extra_bswap) { + if (ctx->extra_bswap ^ (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN)) { put_buffer(s->pb, ctx->out_buf, ctx->out_bytes & ~1); } else { av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE); @@ -517,8 +530,9 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) put_buffer(s->pb, ctx->buffer, ctx->out_bytes & ~1); } + /* a final lone byte has to be MSB aligned */ if (ctx->out_bytes & 1) - put_be16(s->pb, ctx->out_buf[ctx->out_bytes - 1]); + spdif_put_16(ctx, s->pb, ctx->out_buf[ctx->out_bytes - 1] << 8); put_nbyte(s->pb, 0, padding); From 3c33c0e26325f189dbf7f212f8e9042feb83bfb0 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sat, 12 Feb 2011 20:11:11 +0200 Subject: [PATCH 340/528] lavf: print stream disposition in dump_stream_format Signed-off-by: Janne Grunau --- libavformat/utils.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 870a287f17..c0f971efd3 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3237,6 +3237,24 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out if(st->codec->time_base.den && st->codec->time_base.num) print_fps(1/av_q2d(st->codec->time_base), "tbc"); } + if (st->disposition & AV_DISPOSITION_DEFAULT) + av_log(NULL, AV_LOG_INFO, " (default)"); + if (st->disposition & AV_DISPOSITION_DUB) + av_log(NULL, AV_LOG_INFO, " (dub)"); + if (st->disposition & AV_DISPOSITION_ORIGINAL) + av_log(NULL, AV_LOG_INFO, " (original)"); + if (st->disposition & AV_DISPOSITION_COMMENT) + av_log(NULL, AV_LOG_INFO, " (comment)"); + if (st->disposition & AV_DISPOSITION_LYRICS) + av_log(NULL, AV_LOG_INFO, " (lyrics)"); + if (st->disposition & AV_DISPOSITION_KARAOKE) + av_log(NULL, AV_LOG_INFO, " (karaoke)"); + if (st->disposition & AV_DISPOSITION_FORCED) + av_log(NULL, AV_LOG_INFO, " (forced)"); + if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) + av_log(NULL, AV_LOG_INFO, " (hearing impaired)"); + if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) + av_log(NULL, AV_LOG_INFO, " (visual impaired)"); av_log(NULL, AV_LOG_INFO, "\n"); dump_metadata(NULL, st->metadata, " "); } From e6b1ed693ae4098e6b9eabf938fc31ec0b09b120 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Sat, 12 Feb 2011 11:48:16 +0000 Subject: [PATCH 341/528] FFT: factor a shuffle out of the inner loop and merge it into fft_permute. 6% faster SSE FFT on Conroe, 2.5% on Penryn. Signed-off-by: Janne Grunau --- libavcodec/arm/fft_init_arm.c | 2 +- libavcodec/fft.c | 9 +++-- libavcodec/fft.h | 5 ++- libavcodec/mdct.c | 4 +-- libavcodec/x86/fft.c | 1 + libavcodec/x86/fft_mmx.asm | 62 +++++++++++++++++------------------ 6 files changed, 45 insertions(+), 38 deletions(-) diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c index 3f2d554413..dff0689566 100644 --- a/libavcodec/arm/fft_init_arm.c +++ b/libavcodec/arm/fft_init_arm.c @@ -44,7 +44,7 @@ av_cold void ff_fft_init_arm(FFTContext *s) s->imdct_calc = ff_imdct_calc_neon; s->imdct_half = ff_imdct_half_neon; s->mdct_calc = ff_mdct_calc_neon; - s->permutation = FF_MDCT_PERM_INTERLEAVE; + s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; } } diff --git a/libavcodec/fft.c b/libavcodec/fft.c index 3fd4d279cb..eade76a516 100644 --- a/libavcodec/fft.c +++ b/libavcodec/fft.c @@ -97,6 +97,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) if (!s->tmp_buf) goto fail; s->inverse = inverse; + s->fft_permutation = FF_FFT_PERM_DEFAULT; s->fft_permute = ff_fft_permute_c; s->fft_calc = ff_fft_calc_c; @@ -113,8 +114,12 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) for(j=4; j<=nbits; j++) { ff_init_ff_cos_tabs(j); } - for(i=0; irevtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = i; + for(i=0; ifft_permutation == FF_FFT_PERM_SWAP_LSBS) + j = (j&~3) | ((j>>1)&1) | ((j<<1)&2); + s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = j; + } return 0; fail: diff --git a/libavcodec/fft.h b/libavcodec/fft.h index 37cbfbf6a1..58a7f30ad1 100644 --- a/libavcodec/fft.h +++ b/libavcodec/fft.h @@ -44,7 +44,10 @@ struct FFTContext { void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input); void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); - int permutation; + int fft_permutation; +#define FF_FFT_PERM_DEFAULT 0 +#define FF_FFT_PERM_SWAP_LSBS 1 + int mdct_permutation; #define FF_MDCT_PERM_NONE 0 #define FF_MDCT_PERM_INTERLEAVE 1 }; diff --git a/libavcodec/mdct.c b/libavcodec/mdct.c index c511188d22..819f618115 100644 --- a/libavcodec/mdct.c +++ b/libavcodec/mdct.c @@ -71,7 +71,7 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale) s->mdct_bits = nbits; s->mdct_size = n; n4 = n >> 2; - s->permutation = FF_MDCT_PERM_NONE; + s->mdct_permutation = FF_MDCT_PERM_NONE; if (ff_fft_init(s, s->mdct_bits - 2, inverse) < 0) goto fail; @@ -80,7 +80,7 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale) if (!s->tcos) goto fail; - switch (s->permutation) { + switch (s->mdct_permutation) { case FF_MDCT_PERM_NONE: s->tsin = s->tcos + n4; tstep = 1; diff --git a/libavcodec/x86/fft.c b/libavcodec/x86/fft.c index 771b1e6649..5ca341d5e4 100644 --- a/libavcodec/x86/fft.c +++ b/libavcodec/x86/fft.c @@ -30,6 +30,7 @@ av_cold void ff_fft_init_mmx(FFTContext *s) s->imdct_half = ff_imdct_half_sse; s->fft_permute = ff_fft_permute_sse; s->fft_calc = ff_fft_calc_sse; + s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; } else if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) { /* 3DNowEx for K7 */ s->imdct_calc = ff_imdct_calc_3dn2; diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm index 1dcd629184..68e20df3b0 100644 --- a/libavcodec/x86/fft_mmx.asm +++ b/libavcodec/x86/fft_mmx.asm @@ -51,6 +51,7 @@ SECTION_RODATA %define M_SQRT1_2 0.70710678118654752440 ps_root2: times 4 dd M_SQRT1_2 ps_root2mppm: dd -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2 +ps_p1p1m1p1: dd 0, 0, 1<<31, 0 ps_m1p1: dd 1<<31, 0 %assign i 16 @@ -95,54 +96,51 @@ section .text align=16 SWAP %3, %6 %endmacro -; in: %1={r0,i0,r1,i1} %2={r2,i2,r3,i3} +; in: %1={r0,i0,r2,i2} %2={r1,i1,r3,i3} ; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %macro T4_SSE 3 mova %3, %1 - shufps %1, %2, 0x64 ; {r0,i0,r3,i2} - shufps %3, %2, 0xce ; {r1,i1,r2,i3} + addps %1, %2 ; {t1,t2,t6,t5} + subps %3, %2 ; {t3,t4,-t8,t7} + xorps %3, [ps_p1p1m1p1] mova %2, %1 - addps %1, %3 ; {t1,t2,t6,t5} - subps %2, %3 ; {t3,t4,t8,t7} + shufps %1, %3, 0x44 ; {t1,t2,t3,t4} + shufps %2, %3, 0xbe ; {t6,t5,t7,t8} mova %3, %1 - shufps %1, %2, 0x44 ; {t1,t2,t3,t4} - shufps %3, %2, 0xbe ; {t6,t5,t7,t8} + addps %1, %2 ; {r0,i0,r1,i1} + subps %3, %2 ; {r2,i2,r3,i3} mova %2, %1 - addps %1, %3 ; {r0,i0,r1,i1} - subps %2, %3 ; {r2,i2,r3,i3} - mova %3, %1 - shufps %1, %2, 0x88 ; {r0,r1,r2,r3} - shufps %3, %2, 0xdd ; {i0,i1,i2,i3} - SWAP %2, %3 + shufps %1, %3, 0x88 ; {r0,r1,r2,r3} + shufps %2, %3, 0xdd ; {i0,i1,i2,i3} %endmacro -%macro T8_SSE 6 ; r0,i0,r1,i1,t0,t1 - mova %5, %3 - shufps %3, %4, 0x44 ; {r4,i4,r6,i6} - shufps %5, %4, 0xee ; {r5,i5,r7,i7} +; in: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %3={r4,i4,r6,i6} %4={r5,i5,r7,i7} +; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %1={r4,r5,r6,r7} %2={i4,i5,i6,i7} +%macro T8_SSE 6 mova %6, %3 - subps %3, %5 ; {r5,i5,r7,i7} - addps %6, %5 ; {t1,t2,t3,t4} - mova %5, %3 - shufps %5, %5, 0xb1 ; {i5,r5,i7,r7} + subps %3, %4 ; {r5,i5,r7,i7} + addps %6, %4 ; {t1,t2,t3,t4} + mova %4, %3 + shufps %4, %4, 0xb1 ; {i5,r5,i7,r7} mulps %3, [ps_root2mppm] ; {-r5,i5,r7,-i7} - mulps %5, [ps_root2] - addps %3, %5 ; {t8,t7,ta,t9} - mova %5, %6 + mulps %4, [ps_root2] + addps %3, %4 ; {t8,t7,ta,t9} + mova %4, %6 shufps %6, %3, 0x36 ; {t3,t2,t9,t8} - shufps %5, %3, 0x9c ; {t1,t4,t7,ta} + shufps %4, %3, 0x9c ; {t1,t4,t7,ta} mova %3, %6 - addps %6, %5 ; {t1,t2,t9,ta} - subps %3, %5 ; {t6,t5,tc,tb} - mova %5, %6 + addps %6, %4 ; {t1,t2,t9,ta} + subps %3, %4 ; {t6,t5,tc,tb} + mova %4, %6 shufps %6, %3, 0xd8 ; {t1,t9,t5,tb} - shufps %5, %3, 0x8d ; {t2,ta,t6,tc} + shufps %4, %3, 0x8d ; {t2,ta,t6,tc} mova %3, %1 - mova %4, %2 + mova %5, %2 addps %1, %6 ; {r0,r1,r2,r3} - addps %2, %5 ; {i0,i1,i2,i3} + addps %2, %4 ; {i0,i1,i2,i3} subps %3, %6 ; {r4,r5,r6,r7} - subps %4, %5 ; {i4,i5,i6,i7} + subps %5, %4 ; {i4,i5,i6,i7} + SWAP %4, %5 %endmacro ; scheduled for cpu-bound sizes From bb7a22b5840e56c034227ad596b1165c03f2da27 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 13 Feb 2011 13:06:53 +0000 Subject: [PATCH 342/528] configure: add cleanws() function This function removes leading and trailing spaces and collapses multiple spaces into one. Signed-off-by: Mans Rullgard --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index a310d257e4..01b092f37d 100755 --- a/configure +++ b/configure @@ -313,6 +313,10 @@ sh_quote(){ echo "$v" } +cleanws(){ + echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//' +} + filter(){ pat=$1 shift From 5d57846bba7010dc6ee65c3503dd06600e5441a5 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 13 Feb 2011 13:17:46 +0000 Subject: [PATCH 343/528] configure: report full gcc version string This makes the cc_ident value, which is used in FATE reports, include all interesting parts of the gcc version string. Signed-off-by: Mans Rullgard --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 01b092f37d..8cf6d4c796 100755 --- a/configure +++ b/configure @@ -1865,8 +1865,11 @@ if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then elif $cc -v 2>&1 | grep -qi ^gcc; then cc_type=gcc cc_version=__VERSION__ - gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)') - cc_ident="gcc $($cc -dumpversion) $gcc_extra_ver" + gcc_version=$($cc --version | head -n1) + gcc_basever=$($cc -dumpversion) + gcc_pkg_ver=$(expr "$gcc_version" : '^[^ ]* \(([^)]*)\)') + gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)") + cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver") if ! $cc -dumpversion | grep -q '^2\.'; then CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' From 7a4abe5912405474039198823d451b2a38361c48 Mon Sep 17 00:00:00 2001 From: Anatoly Nenashev Date: Thu, 10 Feb 2011 16:09:48 +0000 Subject: [PATCH 344/528] mpeg4video: ignore broken GOP headers Some MPEG4 cameras produce files with empty GOP headers. This patch makes the decoder ignore such broken headers and proceed with the following I-frame. Without this change, the following start code is missed resulting in the entire I-frame being skipped. Signed-off-by: Mans Rullgard --- libavcodec/mpeg4videodec.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 673c4e865c..617dcb9f18 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1494,16 +1494,17 @@ end: static int mpeg4_decode_gop_header(MpegEncContext * s, GetBitContext *gb){ int hours, minutes, seconds; + unsigned time_code = show_bits(gb, 18); - hours= get_bits(gb, 5); - minutes= get_bits(gb, 6); - skip_bits1(gb); - seconds= get_bits(gb, 6); - - s->time_base= seconds + 60*(minutes + 60*hours); - - skip_bits1(gb); - skip_bits1(gb); + if (time_code & 0x40) { /* marker_bit */ + hours = time_code >> 13; + minutes = time_code >> 7 & 0x3f; + seconds = time_code & 0x3f; + s->time_base = seconds + 60*(minutes + 60*hours); + skip_bits(gb, 20); /* time_code, closed_gov, broken_link */ + } else { + av_log(s->avctx, AV_LOG_WARNING, "GOP header missing marker_bit\n"); + } return 0; } From 3ad464bfc7df6d0f68c7df9c907089b84d92ab75 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 13 Feb 2011 21:00:03 +0000 Subject: [PATCH 345/528] configure: fix non-standard regex used with expr The colon operator of expr always anchors the pattern at the start of the string. An explicit ^ in the pattern has unspecified behaviour, so remove it. Signed-off-by: Mans Rullgard --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 8cf6d4c796..90eeaa0b66 100755 --- a/configure +++ b/configure @@ -1867,7 +1867,7 @@ elif $cc -v 2>&1 | grep -qi ^gcc; then cc_version=__VERSION__ gcc_version=$($cc --version | head -n1) gcc_basever=$($cc -dumpversion) - gcc_pkg_ver=$(expr "$gcc_version" : '^[^ ]* \(([^)]*)\)') + gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)') gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)") cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver") if ! $cc -dumpversion | grep -q '^2\.'; then From 70630e35a436d890f3e3fbbe73b70042a375f326 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Sat, 12 Feb 2011 11:17:20 +0100 Subject: [PATCH 346/528] mmst: print packet type with error status code message Signed-off-by: Francesco Cosoleto Signed-off-by: Ronald S. Bultje --- libavformat/mmst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mmst.c b/libavformat/mmst.c index 8464d3b3d1..ad87bbf250 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -293,7 +293,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) hr = AV_RL32(mms->in_buffer + 40); if (hr) { av_log(NULL, AV_LOG_ERROR, - "Server sent an error status code: 0x%08x\n", hr); + "Server sent a message with packet type 0x%x and error status code 0x%08x\n", packet_type, hr); return AVERROR_UNKNOWN; } } else { From 8bf6db1b29f3766732e2bb2bdd2681318fd8e215 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 9 Feb 2011 21:55:57 +0100 Subject: [PATCH 347/528] asfdec: split reading stream properties out of asf_read_header() This contains a rename from gsize->size Signed-off-by: Ronald S. Bultje --- libavformat/asfdec.c | 362 ++++++++++++++++++++++--------------------- 1 file changed, 186 insertions(+), 176 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 0ee6667a27..8e712a6c5b 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -206,6 +206,191 @@ static int asf_read_file_properties(AVFormatContext *s, int64_t size) return 0; } +static int asf_read_stream_properties(AVFormatContext *s, int64_t size) +{ + ASFContext *asf = s->priv_data; + ByteIOContext *pb = s->pb; + AVStream *st; + ASFStream *asf_st; + ff_asf_guid g; + enum AVMediaType type; + int type_specific_size, sizeX; + uint64_t total_size; + unsigned int tag1; + int64_t pos1, pos2, start_time; + int test_for_ext_stream_audio, is_dvr_ms_audio=0; + + if (s->nb_streams == ASF_MAX_STREAMS) { + av_log(s, AV_LOG_ERROR, "too many streams\n"); + return AVERROR(EINVAL); + } + + pos1 = url_ftell(pb); + + st = av_new_stream(s, 0); + if (!st) + return AVERROR(ENOMEM); + av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ + asf_st = av_mallocz(sizeof(ASFStream)); + if (!asf_st) + return AVERROR(ENOMEM); + st->priv_data = asf_st; + start_time = asf->hdr.preroll; + + asf_st->stream_language_index = 128; // invalid stream index means no language info + + if(!(asf->hdr.flags & 0x01)) { // if we aren't streaming... + st->duration = asf->hdr.play_time / + (10000000 / 1000) - start_time; + } + ff_get_guid(pb, &g); + + test_for_ext_stream_audio = 0; + if (!ff_guidcmp(&g, &ff_asf_audio_stream)) { + type = AVMEDIA_TYPE_AUDIO; + } else if (!ff_guidcmp(&g, &ff_asf_video_stream)) { + type = AVMEDIA_TYPE_VIDEO; + } else if (!ff_guidcmp(&g, &ff_asf_jfif_media)) { + type = AVMEDIA_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_MJPEG; + } else if (!ff_guidcmp(&g, &ff_asf_command_stream)) { + type = AVMEDIA_TYPE_DATA; + } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) { + test_for_ext_stream_audio = 1; + type = AVMEDIA_TYPE_UNKNOWN; + } else { + return -1; + } + ff_get_guid(pb, &g); + total_size = get_le64(pb); + type_specific_size = get_le32(pb); + get_le32(pb); + st->id = get_le16(pb) & 0x7f; /* stream id */ + // mapping of asf ID to AV stream ID; + asf->asfid2avid[st->id] = s->nb_streams - 1; + + get_le32(pb); + + if (test_for_ext_stream_audio) { + ff_get_guid(pb, &g); + if (!ff_guidcmp(&g, &ff_asf_ext_stream_audio_stream)) { + type = AVMEDIA_TYPE_AUDIO; + is_dvr_ms_audio=1; + ff_get_guid(pb, &g); + get_le32(pb); + get_le32(pb); + get_le32(pb); + ff_get_guid(pb, &g); + get_le32(pb); + } + } + + st->codec->codec_type = type; + if (type == AVMEDIA_TYPE_AUDIO) { + ff_get_wav_header(pb, st->codec, type_specific_size); + if (is_dvr_ms_audio) { + // codec_id and codec_tag are unreliable in dvr_ms + // files. Set them later by probing stream. + st->codec->codec_id = CODEC_ID_PROBE; + st->codec->codec_tag = 0; + } + if (st->codec->codec_id == CODEC_ID_AAC) { + st->need_parsing = AVSTREAM_PARSE_NONE; + } else { + st->need_parsing = AVSTREAM_PARSE_FULL; + } + /* We have to init the frame size at some point .... */ + pos2 = url_ftell(pb); + if (size >= (pos2 + 8 - pos1 + 24)) { + asf_st->ds_span = get_byte(pb); + asf_st->ds_packet_size = get_le16(pb); + asf_st->ds_chunk_size = get_le16(pb); + get_le16(pb); //ds_data_size + get_byte(pb); //ds_silence_data + } + //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", + // asf_st->ds_packet_size, asf_st->ds_chunk_size, + // asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data); + if (asf_st->ds_span > 1) { + if (!asf_st->ds_chunk_size + || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1) + || asf_st->ds_packet_size % asf_st->ds_chunk_size) + asf_st->ds_span = 0; // disable descrambling + } + switch (st->codec->codec_id) { + case CODEC_ID_MP3: + st->codec->frame_size = MPA_FRAME_SIZE; + break; + case CODEC_ID_PCM_S16LE: + case CODEC_ID_PCM_S16BE: + case CODEC_ID_PCM_U16LE: + case CODEC_ID_PCM_U16BE: + case CODEC_ID_PCM_S8: + case CODEC_ID_PCM_U8: + case CODEC_ID_PCM_ALAW: + case CODEC_ID_PCM_MULAW: + st->codec->frame_size = 1; + break; + default: + /* This is probably wrong, but it prevents a crash later */ + st->codec->frame_size = 1; + break; + } + } else if (type == AVMEDIA_TYPE_VIDEO && + size - (url_ftell(pb) - pos1 + 24) >= 51) { + get_le32(pb); + get_le32(pb); + get_byte(pb); + get_le16(pb); /* size */ + sizeX= get_le32(pb); /* size */ + st->codec->width = get_le32(pb); + st->codec->height = get_le32(pb); + /* not available for asf */ + get_le16(pb); /* panes */ + st->codec->bits_per_coded_sample = get_le16(pb); /* depth */ + tag1 = get_le32(pb); + url_fskip(pb, 20); + // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); + if (sizeX > 40) { + st->codec->extradata_size = sizeX - 40; + st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + get_buffer(pb, st->codec->extradata, st->codec->extradata_size); + } + + /* Extract palette from extradata if bpp <= 8 */ + /* This code assumes that extradata contains only palette */ + /* This is true for all paletted codecs implemented in ffmpeg */ + if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { + st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); +#if HAVE_BIGENDIAN + for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) + st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); +#else + memcpy(st->codec->palctrl->palette, st->codec->extradata, + FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); +#endif + st->codec->palctrl->palette_changed = 1; + } + + st->codec->codec_tag = tag1; + st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); + if(tag1 == MKTAG('D', 'V', 'R', ' ')){ + st->need_parsing = AVSTREAM_PARSE_FULL; + // issue658 containse wrong w/h and MS even puts a fake seq header with wrong w/h in extradata while a correct one is in te stream. maximum lameness + st->codec->width = + st->codec->height = 0; + av_freep(&st->codec->extradata); + st->codec->extradata_size=0; + } + if(st->codec->codec_id == CODEC_ID_H264) + st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; + } + pos2 = url_ftell(pb); + url_fskip(pb, size - (pos2 - pos1 + 24)); + + return 0; +} + static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) { ASFContext *asf = s->priv_data; @@ -396,8 +581,6 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) ASFContext *asf = s->priv_data; ff_asf_guid g; ByteIOContext *pb = s->pb; - AVStream *st; - ASFStream *asf_st; int i; int64_t gsize; @@ -431,180 +614,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!ff_guidcmp(&g, &ff_asf_file_header)) { asf_read_file_properties(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_stream_header)) { - enum AVMediaType type; - int type_specific_size, sizeX; - uint64_t total_size; - unsigned int tag1; - int64_t pos1, pos2, start_time; - int test_for_ext_stream_audio, is_dvr_ms_audio=0; - - if (s->nb_streams == ASF_MAX_STREAMS) { - av_log(s, AV_LOG_ERROR, "too many streams\n"); - return AVERROR(EINVAL); - } - - pos1 = url_ftell(pb); - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ - asf_st = av_mallocz(sizeof(ASFStream)); - if (!asf_st) - return AVERROR(ENOMEM); - st->priv_data = asf_st; - start_time = asf->hdr.preroll; - - asf_st->stream_language_index = 128; // invalid stream index means no language info - - if(!(asf->hdr.flags & 0x01)) { // if we aren't streaming... - st->duration = asf->hdr.play_time / - (10000000 / 1000) - start_time; - } - ff_get_guid(pb, &g); - - test_for_ext_stream_audio = 0; - if (!ff_guidcmp(&g, &ff_asf_audio_stream)) { - type = AVMEDIA_TYPE_AUDIO; - } else if (!ff_guidcmp(&g, &ff_asf_video_stream)) { - type = AVMEDIA_TYPE_VIDEO; - } else if (!ff_guidcmp(&g, &ff_asf_jfif_media)) { - type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = CODEC_ID_MJPEG; - } else if (!ff_guidcmp(&g, &ff_asf_command_stream)) { - type = AVMEDIA_TYPE_DATA; - } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) { - test_for_ext_stream_audio = 1; - type = AVMEDIA_TYPE_UNKNOWN; - } else { - return -1; - } - ff_get_guid(pb, &g); - total_size = get_le64(pb); - type_specific_size = get_le32(pb); - get_le32(pb); - st->id = get_le16(pb) & 0x7f; /* stream id */ - // mapping of asf ID to AV stream ID; - asf->asfid2avid[st->id] = s->nb_streams - 1; - - get_le32(pb); - - if (test_for_ext_stream_audio) { - ff_get_guid(pb, &g); - if (!ff_guidcmp(&g, &ff_asf_ext_stream_audio_stream)) { - type = AVMEDIA_TYPE_AUDIO; - is_dvr_ms_audio=1; - ff_get_guid(pb, &g); - get_le32(pb); - get_le32(pb); - get_le32(pb); - ff_get_guid(pb, &g); - get_le32(pb); - } - } - - st->codec->codec_type = type; - if (type == AVMEDIA_TYPE_AUDIO) { - ff_get_wav_header(pb, st->codec, type_specific_size); - if (is_dvr_ms_audio) { - // codec_id and codec_tag are unreliable in dvr_ms - // files. Set them later by probing stream. - st->codec->codec_id = CODEC_ID_PROBE; - st->codec->codec_tag = 0; - } - if (st->codec->codec_id == CODEC_ID_AAC) { - st->need_parsing = AVSTREAM_PARSE_NONE; - } else { - st->need_parsing = AVSTREAM_PARSE_FULL; - } - /* We have to init the frame size at some point .... */ - pos2 = url_ftell(pb); - if (gsize >= (pos2 + 8 - pos1 + 24)) { - asf_st->ds_span = get_byte(pb); - asf_st->ds_packet_size = get_le16(pb); - asf_st->ds_chunk_size = get_le16(pb); - get_le16(pb); //ds_data_size - get_byte(pb); //ds_silence_data - } - //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", - // asf_st->ds_packet_size, asf_st->ds_chunk_size, - // asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data); - if (asf_st->ds_span > 1) { - if (!asf_st->ds_chunk_size - || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1) - || asf_st->ds_packet_size % asf_st->ds_chunk_size) - asf_st->ds_span = 0; // disable descrambling - } - switch (st->codec->codec_id) { - case CODEC_ID_MP3: - st->codec->frame_size = MPA_FRAME_SIZE; - break; - case CODEC_ID_PCM_S16LE: - case CODEC_ID_PCM_S16BE: - case CODEC_ID_PCM_U16LE: - case CODEC_ID_PCM_U16BE: - case CODEC_ID_PCM_S8: - case CODEC_ID_PCM_U8: - case CODEC_ID_PCM_ALAW: - case CODEC_ID_PCM_MULAW: - st->codec->frame_size = 1; - break; - default: - /* This is probably wrong, but it prevents a crash later */ - st->codec->frame_size = 1; - break; - } - } else if (type == AVMEDIA_TYPE_VIDEO && - gsize - (url_ftell(pb) - pos1 + 24) >= 51) { - get_le32(pb); - get_le32(pb); - get_byte(pb); - get_le16(pb); /* size */ - sizeX= get_le32(pb); /* size */ - st->codec->width = get_le32(pb); - st->codec->height = get_le32(pb); - /* not available for asf */ - get_le16(pb); /* panes */ - st->codec->bits_per_coded_sample = get_le16(pb); /* depth */ - tag1 = get_le32(pb); - url_fskip(pb, 20); -// av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); - if (sizeX > 40) { - st->codec->extradata_size = sizeX - 40; - st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, st->codec->extradata, st->codec->extradata_size); - } - - /* Extract palette from extradata if bpp <= 8 */ - /* This code assumes that extradata contains only palette */ - /* This is true for all paletted codecs implemented in ffmpeg */ - if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { - st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); -#if HAVE_BIGENDIAN - for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) - st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); -#else - memcpy(st->codec->palctrl->palette, st->codec->extradata, - FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); -#endif - st->codec->palctrl->palette_changed = 1; - } - - st->codec->codec_tag = tag1; - st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); - if(tag1 == MKTAG('D', 'V', 'R', ' ')){ - st->need_parsing = AVSTREAM_PARSE_FULL; - // issue658 containse wrong w/h and MS even puts a fake seq header with wrong w/h in extradata while a correct one is in te stream. maximum lameness - st->codec->width = - st->codec->height = 0; - av_freep(&st->codec->extradata); - st->codec->extradata_size=0; - } - if(st->codec->codec_id == CODEC_ID_H264) - st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; - } - pos2 = url_ftell(pb); - url_fskip(pb, gsize - (pos2 - pos1 + 24)); + asf_read_stream_properties(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_comment_header)) { asf_read_content_desc(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_language_guid)) { From 5cbd3b5d915a76888b83af5c1fd3df31bd20a5be Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 9 Feb 2011 21:56:00 +0100 Subject: [PATCH 348/528] asfdec: don't export empty metadata Signed-off-by: Ronald S. Bultje --- libavformat/asfdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 8e712a6c5b..2d43ac2f54 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -178,7 +178,8 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len) av_log(s, AV_LOG_DEBUG, "Unsupported value type %d in tag %s.\n", type, key); goto finish; } - av_metadata_set2(&s->metadata, key, value, 0); + if (*value) + av_metadata_set2(&s->metadata, key, value, 0); finish: av_freep(&value); url_fseek(s->pb, off + len, SEEK_SET); From 1a973feb45826a1998b4286ecfe1fa7a602b8780 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 13 Feb 2011 14:42:49 +1100 Subject: [PATCH 349/528] wtv: ignore empty data_guid chunks Signed-off-by: Ronald S. Bultje --- libavformat/wtv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 7a8e8f54dc..b74a36cc80 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -892,7 +892,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } } else if (!ff_guidcmp(g, data_guid)) { int stream_index = ff_find_stream_index(s, sid); - if (mode == SEEK_TO_DATA && stream_index >= 0) { + if (mode == SEEK_TO_DATA && stream_index >= 0 && len > 32) { WtvStream *wst = s->streams[stream_index]->priv_data; wst->seen_data = 1; if (len_ptr) { From fbb6b49dabc3398440c6dfa838aa090a7a6ebc0d Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 13 Feb 2011 14:49:50 -0500 Subject: [PATCH 350/528] ac3enc: Add x86-optimized function to speed up log2_tab(). AC3DSPContext.ac3_max_msb_abs_int16() finds the maximum MSB of the absolute value of each element in an array of int16_t. Signed-off-by: Ronald S. Bultje --- libavcodec/ac3dsp.c | 9 +++++ libavcodec/ac3dsp.h | 11 ++++++ libavcodec/ac3enc_fixed.c | 11 ++---- libavcodec/x86/ac3dsp.asm | 69 +++++++++++++++++++++++++++++++++++++ libavcodec/x86/ac3dsp_mmx.c | 11 ++++++ 5 files changed, 103 insertions(+), 8 deletions(-) diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c index f688e6a72b..da3a123e9b 100644 --- a/libavcodec/ac3dsp.c +++ b/libavcodec/ac3dsp.c @@ -42,9 +42,18 @@ static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs) } } +static int ac3_max_msb_abs_int16_c(const int16_t *src, int len) +{ + int i, v = 0; + for (i = 0; i < len; i++) + v |= abs(src[i]); + return v; +} + av_cold void ff_ac3dsp_init(AC3DSPContext *c) { c->ac3_exponent_min = ac3_exponent_min_c; + c->ac3_max_msb_abs_int16 = ac3_max_msb_abs_int16_c; if (HAVE_MMX) ff_ac3dsp_init_x86(c); diff --git a/libavcodec/ac3dsp.h b/libavcodec/ac3dsp.h index 7f13b11f3b..a4f141f2f5 100644 --- a/libavcodec/ac3dsp.h +++ b/libavcodec/ac3dsp.h @@ -35,6 +35,17 @@ typedef struct AC3DSPContext { * @param nb_coefs number of frequency coefficients. */ void (*ac3_exponent_min)(uint8_t *exp, int num_reuse_blocks, int nb_coefs); + + /** + * Calculate the maximum MSB of the absolute value of each element in an + * array of int16_t. + * @param src input array + * constraints: align 16. values must be in range [-32767,32767] + * @param len number of values in the array + * constraints: multiple of 16 greater than 0 + * @return a value with the same MSB as max(abs(src[])) + */ + int (*ac3_max_msb_abs_int16)(const int16_t *src, int len); } AC3DSPContext; void ff_ac3dsp_init (AC3DSPContext *c); diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c index 0db41dff2d..3de00ee484 100644 --- a/libavcodec/ac3enc_fixed.c +++ b/libavcodec/ac3enc_fixed.c @@ -270,14 +270,9 @@ static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input, * @param n number of values in the array * @return log2(max(abs(tab[]))) */ -static int log2_tab(int16_t *tab, int n) +static int log2_tab(AC3EncodeContext *s, int16_t *src, int len) { - int i, v; - - v = 0; - for (i = 0; i < n; i++) - v |= abs(tab[i]); - + int v = s->ac3dsp.ac3_max_msb_abs_int16(src, len); return av_log2(v); } @@ -308,7 +303,7 @@ static void lshift_tab(int16_t *tab, int n, unsigned int lshift) */ static int normalize_samples(AC3EncodeContext *s) { - int v = 14 - log2_tab(s->windowed_samples, AC3_WINDOW_SIZE); + int v = 14 - log2_tab(s, s->windowed_samples, AC3_WINDOW_SIZE); lshift_tab(s->windowed_samples, AC3_WINDOW_SIZE, v); return v - 9; } diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm index e71c51cf33..dc71ccf91c 100644 --- a/libavcodec/x86/ac3dsp.asm +++ b/libavcodec/x86/ac3dsp.asm @@ -65,3 +65,72 @@ AC3_EXPONENT_MIN sse2 %endif %undef PMINUB %undef LOOP_ALIGN + +;----------------------------------------------------------------------------- +; int ff_ac3_max_msb_abs_int16(const int16_t *src, int len) +; +; This function uses 2 different methods to calculate a valid result. +; 1) logical 'or' of abs of each element +; This is used for ssse3 because of the pabsw instruction. +; It is also used for mmx because of the lack of min/max instructions. +; 2) calculate min/max for the array, then or(abs(min),abs(max)) +; This is used for mmxext and sse2 because they have pminsw/pmaxsw. +;----------------------------------------------------------------------------- + +%macro AC3_MAX_MSB_ABS_INT16 2 +cglobal ac3_max_msb_abs_int16_%1, 2,2,5, src, len + pxor m2, m2 + pxor m3, m3 +.loop: +%ifidn %2, min_max + mova m0, [srcq] + mova m1, [srcq+mmsize] + pminsw m2, m0 + pminsw m2, m1 + pmaxsw m3, m0 + pmaxsw m3, m1 +%else ; or_abs +%ifidn %1, mmx + mova m0, [srcq] + mova m1, [srcq+mmsize] + ABS2 m0, m1, m3, m4 +%else ; ssse3 + ; using memory args is faster for ssse3 + pabsw m0, [srcq] + pabsw m1, [srcq+mmsize] +%endif + por m2, m0 + por m2, m1 +%endif + add srcq, mmsize*2 + sub lend, mmsize + ja .loop +%ifidn %2, min_max + ABS2 m2, m3, m0, m1 + por m2, m3 +%endif +%ifidn mmsize, 16 + mova m0, m2 + punpckhqdq m0, m0 + por m2, m0 +%endif + PSHUFLW m0, m2, 0xe + por m2, m0 + PSHUFLW m0, m2, 0x1 + por m2, m0 + movd eax, m2 + and eax, 0xFFFF + RET +%endmacro + +INIT_MMX +%define ABS2 ABS2_MMX +%define PSHUFLW pshufw +AC3_MAX_MSB_ABS_INT16 mmx, or_abs +%define ABS2 ABS2_MMX2 +AC3_MAX_MSB_ABS_INT16 mmxext, min_max +INIT_XMM +%define PSHUFLW pshuflw +AC3_MAX_MSB_ABS_INT16 sse2, min_max +%define ABS2 ABS2_SSSE3 +AC3_MAX_MSB_ABS_INT16 ssse3, or_abs diff --git a/libavcodec/x86/ac3dsp_mmx.c b/libavcodec/x86/ac3dsp_mmx.c index 7ce3aa358d..d8af59ce8d 100644 --- a/libavcodec/x86/ac3dsp_mmx.c +++ b/libavcodec/x86/ac3dsp_mmx.c @@ -27,6 +27,11 @@ extern void ff_ac3_exponent_min_mmx (uint8_t *exp, int num_reuse_blocks, int n extern void ff_ac3_exponent_min_mmxext(uint8_t *exp, int num_reuse_blocks, int nb_coefs); extern void ff_ac3_exponent_min_sse2 (uint8_t *exp, int num_reuse_blocks, int nb_coefs); +extern int ff_ac3_max_msb_abs_int16_mmx (const int16_t *src, int len); +extern int ff_ac3_max_msb_abs_int16_mmxext(const int16_t *src, int len); +extern int ff_ac3_max_msb_abs_int16_sse2 (const int16_t *src, int len); +extern int ff_ac3_max_msb_abs_int16_ssse3 (const int16_t *src, int len); + av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c) { int mm_flags = av_get_cpu_flags(); @@ -34,12 +39,18 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c) #if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX) { c->ac3_exponent_min = ff_ac3_exponent_min_mmx; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx; } if (mm_flags & AV_CPU_FLAG_MMX2 && HAVE_MMX2) { c->ac3_exponent_min = ff_ac3_exponent_min_mmxext; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext; } if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { c->ac3_exponent_min = ff_ac3_exponent_min_sse2; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2; + } + if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) { + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3; } #endif } From aabc2682fcb70417abda0e78d27a425269a82fc8 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 13 Feb 2011 22:10:45 +0000 Subject: [PATCH 351/528] asfdec: fix build for big endian targets Signed-off-by: Mans Rullgard --- libavformat/asfdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 2d43ac2f54..8d413e415a 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -362,6 +362,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) /* This code assumes that extradata contains only palette */ /* This is true for all paletted codecs implemented in ffmpeg */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { + int av_unused i; st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); #if HAVE_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) From 916dee9f45dab85cfc20b6bf63ce8722746e6508 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Sun, 13 Feb 2011 16:42:38 -0800 Subject: [PATCH 352/528] aac: remove dead SBR input scaling It has been unused since 9d06d7bce3babb82ed650c13ed13a57f6f626a71 Signed-off-by: Mans Rullgard --- libavcodec/aacsbr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 9b10bf25fe..237d51a391 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -1134,16 +1134,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) * @param W array of complex-valued samples split into subbands */ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x, - float z[320], float W[2][32][32][2], - float scale) + float z[320], float W[2][32][32][2]) { int i, k; memcpy(W[0], W[1], sizeof(W[0])); memcpy(x , x+1024, (320-32)*sizeof(x[0])); - if (scale != 1.0f) - dsp->vector_fmul_scalar(x+288, in, scale, 1024); - else - memcpy(x+288, in, 1024*sizeof(*x)); + memcpy(x+288, in, 1024*sizeof(x[0])); for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames // are not supported dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320); @@ -1722,7 +1718,7 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, /* decode channel */ sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, ch ? R : L, sbr->data[ch].analysis_filterbank_samples, (float*)sbr->qmf_filter_scratch, - sbr->data[ch].W, 1/(-1024 * ac->sf_scale)); + sbr->data[ch].W); sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W); if (sbr->start) { sbr_hf_inverse_filter(sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]); From b7ec5cc4013242a9f30c429d2ce9c20ec01b03eb Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 12 Feb 2011 18:25:53 +0100 Subject: [PATCH 353/528] Remove disabled legacy code in ffplay. The code was setting aspect ratio from the DTG active format, and was present and disabled since the creation of ffplay. See thread: Subject: [FFmpeg-devel] [PATCH] Cosmetics: adopt compact notation in disabled code. Date: Sat, 12 Feb 2011 18:46:19 +0100 Signed-off-by: Mans Rullgard --- ffplay.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/ffplay.c b/ffplay.c index 170acfd42b..6b4f38ee35 100644 --- a/ffplay.c +++ b/ffplay.c @@ -712,40 +712,6 @@ static void video_image_display(VideoState *is) if (aspect_ratio <= 0.0) aspect_ratio = 1.0; aspect_ratio *= (float)vp->width / (float)vp->height; - /* if an active format is indicated, then it overrides the - mpeg format */ -#if 0 - if (is->video_st->codec->dtg_active_format != is->dtg_active_format) { - is->dtg_active_format = is->video_st->codec->dtg_active_format; - printf("dtg_active_format=%d\n", is->dtg_active_format); - } -#endif -#if 0 - switch(is->video_st->codec->dtg_active_format) { - case FF_DTG_AFD_SAME: - default: - /* nothing to do */ - break; - case FF_DTG_AFD_4_3: - aspect_ratio = 4.0 / 3.0; - break; - case FF_DTG_AFD_16_9: - aspect_ratio = 16.0 / 9.0; - break; - case FF_DTG_AFD_14_9: - aspect_ratio = 14.0 / 9.0; - break; - case FF_DTG_AFD_4_3_SP_14_9: - aspect_ratio = 14.0 / 9.0; - break; - case FF_DTG_AFD_16_9_SP_14_9: - aspect_ratio = 14.0 / 9.0; - break; - case FF_DTG_AFD_SP_4_3: - aspect_ratio = 4.0 / 3.0; - break; - } -#endif if (is->subtitle_st) { From 910b5b82e8429f2e478d8e2aaff5e522c8848b59 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 2 Feb 2011 19:39:56 +0000 Subject: [PATCH 354/528] Add sample_aspect_ratio to AVFilterLink Signed-off-by: Mans Rullgard --- libavfilter/avfilter.c | 4 ++++ libavfilter/avfilter.h | 5 +++-- libavfilter/vf_aspect.c | 14 ++++++++++++++ libavfilter/vf_transpose.c | 5 +++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 554fbd4105..872ca2384f 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -194,6 +194,10 @@ int avfilter_config_links(AVFilterContext *filter) link->time_base = link->src && link->src->input_count ? link->src->inputs[0]->time_base : AV_TIME_BASE_Q; + if (link->sample_aspect_ratio.num == 0 && link->sample_aspect_ratio.den == 0) + link->sample_aspect_ratio = link->src->input_count ? + link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1}; + if ((config_link = link->dstpad->config_props)) if ((ret = config_link(link)) < 0) return ret; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index cc3dce7cb2..451d0befff 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -27,7 +27,7 @@ #include "libavcore/samplefmt.h" #define LIBAVFILTER_VERSION_MAJOR 1 -#define LIBAVFILTER_VERSION_MINOR 75 +#define LIBAVFILTER_VERSION_MINOR 76 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ @@ -580,9 +580,10 @@ struct AVFilterLink { enum AVMediaType type; ///< filter media type - /* These two parameters apply only to video */ + /* These parameters apply only to video */ int w; ///< agreed upon image width int h; ///< agreed upon image height + AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio /* These two parameters apply only to audio */ int64_t channel_layout; ///< channel layout of current buffer (see libavcore/audioconvert.h) int64_t sample_rate; ///< samples per second diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c index 6f86bf2924..95bfb666ff 100644 --- a/libavfilter/vf_aspect.c +++ b/libavfilter/vf_aspect.c @@ -82,6 +82,9 @@ static int setdar_config_props(AVFilterLink *inlink) av_log(inlink->dst, AV_LOG_INFO, "w:%d h:%d -> dar:%d/%d par:%d/%d\n", inlink->w, inlink->h, dar.num, dar.den, aspect->aspect.num, aspect->aspect.den); + + inlink->sample_aspect_ratio = aspect->aspect; + return 0; } @@ -108,6 +111,16 @@ AVFilter avfilter_vf_setdar = { #endif /* CONFIG_SETDAR_FILTER */ #if CONFIG_SETSAR_FILTER +/* for setdar filter, convert from frame aspect ratio to pixel aspect ratio */ +static int setsar_config_props(AVFilterLink *inlink) +{ + AspectContext *aspect = inlink->dst->priv; + + inlink->sample_aspect_ratio = aspect->aspect; + + return 0; +} + AVFilter avfilter_vf_setsar = { .name = "setsar", .description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."), @@ -118,6 +131,7 @@ AVFilter avfilter_vf_setsar = { .inputs = (AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .config_props = setsar_config_props, .get_video_buffer = avfilter_null_get_video_buffer, .start_frame = start_frame, .end_frame = avfilter_null_end_frame }, diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index 970c38120d..272b17ff1a 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -102,6 +102,11 @@ static int config_props_output(AVFilterLink *outlink) outlink->w = inlink->h; outlink->h = inlink->w; + if (inlink->sample_aspect_ratio.num){ + outlink->sample_aspect_ratio = av_div_q((AVRational){1,1}, inlink->sample_aspect_ratio); + } else + outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; + 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", From 08a459f096106f13c03182eed4b7cb725dc4a0ae Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 14 Feb 2011 13:02:59 +0000 Subject: [PATCH 355/528] Update APIchanges for 910b5b8 Signed-off-by: Mans Rullgard --- doc/APIchanges | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 741ac55a42..95f83c7272 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-14 - 910b5b8 - lavfi 1.76.0 - AVFilterLink sample_aspect_ratio + Add sample_aspect_ratio field to AVFilterLink. + 2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init() Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead set thread_count before calling avcodec_open. From 275189a2bd71cf49d66374c44d3de2262d323460 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 14 Feb 2011 09:55:14 -0500 Subject: [PATCH 356/528] mmst: fix reading uninitialized data for ping packets. Fixes errors after a few minutes (first ping) when playing back mmst://wm.bbc.co.uk/wms/bbc7coyopa/bbc7_-_friday_0430.wma --- libavformat/mmst.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/mmst.c b/libavformat/mmst.c index ad87bbf250..a2b55b5c8e 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -290,8 +290,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) return read_result < 0 ? read_result : AVERROR_IO; } packet_type= AV_RL16(mms->in_buffer+36); - hr = AV_RL32(mms->in_buffer + 40); - if (hr) { + if (read_result >= 44 && (hr = AV_RL32(mms->in_buffer + 40))) { av_log(NULL, AV_LOG_ERROR, "Server sent a message with packet type 0x%x and error status code 0x%08x\n", packet_type, hr); return AVERROR_UNKNOWN; From b08f59dca493e7582ddfd08097c594bfb0ae6ff9 Mon Sep 17 00:00:00 2001 From: Tilman Brock Date: Mon, 14 Feb 2011 14:29:43 +0100 Subject: [PATCH 357/528] Fix spelling error. Signed-off-by: Ronald S. Bultje --- doc/faq.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/faq.texi b/doc/faq.texi index eeaf0df6a9..b8a13b79eb 100644 --- a/doc/faq.texi +++ b/doc/faq.texi @@ -423,7 +423,7 @@ read "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}). The build process creates ffmpeg_g, ffplay_g, etc. which contain full debug information. Those binaries are stripped to create ffmpeg, ffplay, etc. If -you need the debug information, used the *_g versions. +you need the debug information, use the *_g versions. @section I do not like the LGPL, can I contribute code under the GPL instead? From 70c275f8c335f9f8846af5cce65fef29247759b2 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 13 Feb 2011 22:59:55 +0100 Subject: [PATCH 358/528] Make avfilter_config_links() propagate audio information of the source link if it is not explicitely set by the filter. --- libavfilter/avfilter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 872ca2384f..4d183294cb 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -198,6 +198,12 @@ int avfilter_config_links(AVFilterContext *filter) link->sample_aspect_ratio = link->src->input_count ? link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1}; + if (link->sample_rate == 0 && link->src && link->src->input_count) + link->sample_rate = link->src->inputs[0]->sample_rate; + + if (link->channel_layout == 0 && link->src && link->src->input_count) + link->channel_layout = link->src->inputs[0]->channel_layout; + if ((config_link = link->dstpad->config_props)) if ((ret = config_link(link)) < 0) return ret; From 24a83bd10a1ed56cadd2c475b839887752f23183 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 14 Feb 2011 18:43:38 +0000 Subject: [PATCH 359/528] lavf: add AV_DISPOSITION_CLEAN_EFFECTS flag Signed-off-by: Mans Rullgard --- libavformat/avformat.h | 1 + libavformat/utils.c | 2 ++ libavformat/version.h | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 11a45418ef..8fb77f958c 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -474,6 +474,7 @@ typedef struct AVIndexEntry { #define AV_DISPOSITION_FORCED 0x0040 #define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ #define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ +#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ /** * Stream structure. diff --git a/libavformat/utils.c b/libavformat/utils.c index c0f971efd3..2303244d4c 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3255,6 +3255,8 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out av_log(NULL, AV_LOG_INFO, " (hearing impaired)"); if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) av_log(NULL, AV_LOG_INFO, " (visual impaired)"); + if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) + av_log(NULL, AV_LOG_INFO, " (clean effects)"); av_log(NULL, AV_LOG_INFO, "\n"); dump_metadata(NULL, st->metadata, " "); } diff --git a/libavformat/version.h b/libavformat/version.h index d13ec07799..4e26eaaebc 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 99 +#define LIBAVFORMAT_VERSION_MINOR 100 #define LIBAVFORMAT_VERSION_MICRO 1 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From 935ee1b9bba3d2fa1bf0d48eef278956307478cb Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 14 Feb 2011 23:17:18 +0000 Subject: [PATCH 360/528] apichanges: update for 24a83bd: add AV_DISPOSITION_CLEAN_EFFECTS flag Signed-off-by: Mans Rullgard --- doc/APIchanges | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 95f83c7272..0f328287f5 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-14 - 24a83bd - lavf 52.100.0 - AV_DISPOSITION_CLEAN_EFFECTS + Add AV_DISPOSITION_CLEAN_EFFECTS disposition flag. + 2011-02-14 - 910b5b8 - lavfi 1.76.0 - AVFilterLink sample_aspect_ratio Add sample_aspect_ratio field to AVFilterLink. From 60e7306643054e93dfc1962f89b24554bb76e18a Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 14 Feb 2011 18:55:04 +0000 Subject: [PATCH 361/528] mpegts: set st->disposition according to ISO 639 language descriptor Signed-off-by: Mans Rullgard --- libavformat/mpegts.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index e8d82ac21c..abb6f080f4 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -954,6 +954,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type language[2] = get8(pp, desc_end); language[3] = 0; av_metadata_set2(&st->metadata, "language", language, 0); + switch (get8(pp, desc_end)) { + case 0x01: st->disposition |= AV_DISPOSITION_CLEAN_EFFECTS; break; + case 0x02: st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; break; + case 0x03: st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; break; + } break; case 0x05: /* registration descriptor */ st->codec->codec_tag = bytestream_get_le32(pp); From 3f2d3a1904c1ccdfdc3bd03a6dd6567986f681d9 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 14 Feb 2011 18:43:41 +0000 Subject: [PATCH 362/528] mpegtsenc: set audio_type according to st->disposition Signed-off-by: Mans Rullgard --- libavformat/mpegtsenc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index b1bccd1a8b..6945b4b3ba 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -289,6 +289,13 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) *q++ = lang->value[0]; *q++ = lang->value[1]; *q++ = lang->value[2]; + if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) + *q++ = 0x01; + else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) + *q++ = 0x02; + else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) + *q++ = 0x03; + else *q++ = 0; /* undefined type */ } break; From 2dd1ee4bfe85f41b771bf8fe1c2cfa2d833b5de3 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 14 Feb 2011 23:14:25 +0000 Subject: [PATCH 363/528] mpegtsenc: whitespace cosmetics Signed-off-by: Mans Rullgard --- libavformat/mpegtsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 6945b4b3ba..89b88d7027 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -296,7 +296,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) *q++ = 0x03; else - *q++ = 0; /* undefined type */ + *q++ = 0; /* undefined type */ } break; case AVMEDIA_TYPE_SUBTITLE: From 77c330a046d668373cbd9542f3e1d4746916b02f Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 14 Feb 2011 17:50:08 +0000 Subject: [PATCH 364/528] APIchanges: update for 12c14cd Signed-off-by: Mans Rullgard --- doc/APIchanges | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 0f328287f5..74c642f2b2 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -19,6 +19,9 @@ API changes, most recent first: 2011-02-14 - 910b5b8 - lavfi 1.76.0 - AVFilterLink sample_aspect_ratio Add sample_aspect_ratio field to AVFilterLink. +2011-02-10 - 12c14cd - lavf 52.99.0 - AVStream.disposition + Add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED. + 2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init() Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead set thread_count before calling avcodec_open. From ead15f1dc196ad164d105e31c8c9025f8a4ee4e7 Mon Sep 17 00:00:00 2001 From: Young Han Lee Date: Mon, 14 Feb 2011 18:09:43 +0900 Subject: [PATCH 365/528] aacdec: Implement LTP support. Ported from gsoc svn. --- libavcodec/aac.h | 32 ++++++--- libavcodec/aacdec.c | 156 +++++++++++++++++++++++++++++++++++++--- libavcodec/aacdectab.h | 8 +++ libavcodec/mpeg4audio.h | 2 +- 4 files changed, 178 insertions(+), 20 deletions(-) diff --git a/libavcodec/aac.h b/libavcodec/aac.h index cff476a6eb..a2bf70b001 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -43,6 +43,7 @@ #define MAX_ELEM_ID 16 #define TNS_MAX_ORDER 20 +#define MAX_LTP_LONG_SFB 40 enum RawDataBlockType { TYPE_SCE, @@ -130,6 +131,16 @@ typedef struct { #define SCALE_MAX_DIFF 60 ///< maximum scalefactor difference allowed by standard #define SCALE_DIFF_ZERO 60 ///< codebook index corresponding to zero scalefactor indices difference +/** + * Long Term Prediction + */ +typedef struct { + int8_t present; + int16_t lag; + float coef; + int8_t used[MAX_LTP_LONG_SFB]; +} LongTermPrediction; + /** * Individual Channel Stream */ @@ -139,6 +150,7 @@ typedef struct { uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sinus window. int num_window_groups; uint8_t group_len[8]; + LongTermPrediction ltp; const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window const uint8_t *swb_sizes; ///< table of scalefactor band sizes for a particular window int num_swb; ///< number of scalefactor window bands @@ -206,14 +218,15 @@ typedef struct { IndividualChannelStream ics; TemporalNoiseShaping tns; Pulse pulse; - enum BandType band_type[128]; ///< band types - int band_type_run_end[120]; ///< band type run end points - float sf[120]; ///< scalefactors - int sf_idx[128]; ///< scalefactor indices (used by encoder) - uint8_t zeroes[128]; ///< band is not coded (used by encoder) - DECLARE_ALIGNED(16, float, coeffs)[1024]; ///< coefficients for IMDCT - DECLARE_ALIGNED(16, float, saved)[1024]; ///< overlap - DECLARE_ALIGNED(16, float, ret)[2048]; ///< PCM output + enum BandType band_type[128]; ///< band types + int band_type_run_end[120]; ///< band type run end points + float sf[120]; ///< scalefactors + int sf_idx[128]; ///< scalefactor indices (used by encoder) + uint8_t zeroes[128]; ///< band is not coded (used by encoder) + DECLARE_ALIGNED(16, float, coeffs)[1024]; ///< coefficients for IMDCT + DECLARE_ALIGNED(16, float, saved)[1024]; ///< overlap + DECLARE_ALIGNED(16, float, ret)[2048]; ///< PCM output + DECLARE_ALIGNED(16, int16_t, ltp_state)[3072]; ///< time signal for LTP PredictorState predictor_state[MAX_PREDICTORS]; } SingleChannelElement; @@ -259,7 +272,7 @@ typedef struct { * @defgroup temporary aligned temporary buffers (We do not want to have these on the stack.) * @{ */ - DECLARE_ALIGNED(16, float, buf_mdct)[1024]; + DECLARE_ALIGNED(16, float, buf_mdct)[2048]; /** @} */ /** @@ -268,6 +281,7 @@ typedef struct { */ FFTContext mdct; FFTContext mdct_small; + FFTContext mdct_ltp; DSPContext dsp; FmtConvertContext fmt_conv; int random_state; diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index bc92f5662f..ee5affebed 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -42,7 +42,7 @@ * Y filterbank - standard * N (code in SoC repo) filterbank - Scalable Sample Rate * Y Temporal Noise Shaping - * N (code in SoC repo) Long Term Prediction + * Y Long Term Prediction * Y intensity stereo * Y channel coupling * Y frequency domain prediction @@ -478,6 +478,7 @@ static int decode_audio_specific_config(AACContext *ac, switch (m4ac->object_type) { case AOT_AAC_MAIN: case AOT_AAC_LC: + case AOT_AAC_LTP: if (decode_ga_specific_config(ac, avctx, &gb, m4ac, m4ac->chan_config)) return -1; break; @@ -580,8 +581,9 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]), 352); - ff_mdct_init(&ac->mdct, 11, 1, 1.0); - ff_mdct_init(&ac->mdct_small, 8, 1, 1.0); + ff_mdct_init(&ac->mdct, 11, 1, 1.0); + ff_mdct_init(&ac->mdct_small, 8, 1, 1.0); + ff_mdct_init(&ac->mdct_ltp, 11, 0, 1.0); // window initialization ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); @@ -630,6 +632,20 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics, return 0; } +/** + * Decode Long Term Prediction data; reference: table 4.xx. + */ +static void decode_ltp(AACContext *ac, LongTermPrediction *ltp, + GetBitContext *gb, uint8_t max_sfb) +{ + int sfb; + + ltp->lag = get_bits(gb, 11); + ltp->coef = ltp_coef[get_bits(gb, 3)] * ac->sf_scale; + for (sfb = 0; sfb < FFMIN(max_sfb, MAX_LTP_LONG_SFB); sfb++) + ltp->used[sfb] = get_bits1(gb); +} + /** * Decode Individual Channel Stream info; reference: table 4.6. * @@ -684,9 +700,8 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, memset(ics, 0, sizeof(IndividualChannelStream)); return -1; } else { - av_log_missing_feature(ac->avctx, "Predictor bit set but LTP is", 1); - memset(ics, 0, sizeof(IndividualChannelStream)); - return -1; + if ((ics->ltp.present = get_bits(gb, 1))) + decode_ltp(ac, &ics->ltp, gb, ics->max_sfb); } } } @@ -1420,6 +1435,9 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe) i = cpe->ch[1].ics.use_kb_window[0]; cpe->ch[1].ics = cpe->ch[0].ics; cpe->ch[1].ics.use_kb_window[1] = i; + if (cpe->ch[1].ics.predictor_present && (ac->m4ac.object_type != AOT_AAC_MAIN)) + if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1))) + decode_ltp(ac, &cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb); ms_present = get_bits(gb, 2); if (ms_present == 3) { av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n"); @@ -1659,6 +1677,7 @@ static void apply_tns(float coef[1024], TemporalNoiseShaping *tns, int w, filt, m, i; int bottom, top, order, start, end, size, inc; float lpc[TNS_MAX_ORDER]; + float tmp[TNS_MAX_ORDER]; for (w = 0; w < ics->num_windows; w++) { bottom = ics->num_swb; @@ -1684,14 +1703,118 @@ static void apply_tns(float coef[1024], TemporalNoiseShaping *tns, } start += w * 128; - // ar filter - for (m = 0; m < size; m++, start += inc) - for (i = 1; i <= FFMIN(m, order); i++) - coef[start] -= coef[start - i * inc] * lpc[i - 1]; + if (decode) { + // ar filter + for (m = 0; m < size; m++, start += inc) + for (i = 1; i <= FFMIN(m, order); i++) + coef[start] -= coef[start - i * inc] * lpc[i - 1]; + } else { + // ma filter + for (m = 0; m < size; m++, start += inc) { + tmp[0] = coef[start]; + for (i = 1; i <= FFMIN(m, order); i++) + coef[start] += tmp[i] * lpc[i - 1]; + for (i = order; i > 0; i--) + tmp[i] = tmp[i - 1]; + } + } } } } +/** + * Apply windowing and MDCT to obtain the spectral + * coefficient from the predicted sample by LTP. + */ +static void windowing_and_mdct_ltp(AACContext *ac, float *out, + float *in, IndividualChannelStream *ics) +{ + const float *lwindow = ics->use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024; + const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; + const float *lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024; + const float *swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128; + + if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) { + ac->dsp.vector_fmul(in, in, lwindow_prev, 1024); + } else { + memset(in, 0, 448 * sizeof(float)); + ac->dsp.vector_fmul(in + 448, in + 448, swindow_prev, 128); + memcpy(in + 576, in + 576, 448 * sizeof(float)); + } + if (ics->window_sequence[0] != LONG_START_SEQUENCE) { + ac->dsp.vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024); + } else { + memcpy(in + 1024, in + 1024, 448 * sizeof(float)); + ac->dsp.vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128); + memset(in + 1024 + 576, 0, 448 * sizeof(float)); + } + ff_mdct_calc(&ac->mdct_ltp, out, in); +} + +/** + * Apply the long term prediction + */ +static void apply_ltp(AACContext *ac, SingleChannelElement *sce) +{ + const LongTermPrediction *ltp = &sce->ics.ltp; + const uint16_t *offsets = sce->ics.swb_offset; + int i, sfb; + + if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) { + float *predTime = ac->buf_mdct; + float *predFreq = sce->ret; + int16_t num_samples = 2048; + + if (ltp->lag < 1024) + num_samples = ltp->lag + 1024; + for (i = 0; i < num_samples; i++) + predTime[i] = sce->ltp_state[i + 2048 - ltp->lag] * ltp->coef; + memset(&predTime[i], 0, (2048 - i) * sizeof(float)); + + windowing_and_mdct_ltp(ac, predFreq, predTime, &sce->ics); + + if (sce->tns.present) + apply_tns(predFreq, &sce->tns, &sce->ics, 0); + + for (sfb = 0; sfb < FFMIN(sce->ics.max_sfb, MAX_LTP_LONG_SFB); sfb++) + if (ltp->used[sfb]) + for (i = offsets[sfb]; i < offsets[sfb + 1]; i++) + sce->coeffs[i] += predFreq[i]; + } +} + +/** + * Update the LTP buffer for next frame + */ +static void update_ltp(AACContext *ac, SingleChannelElement *sce) +{ + IndividualChannelStream *ics = &sce->ics; + float *saved = sce->saved; + float *saved_ltp = sce->coeffs; + const float *lwindow = ics->use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024; + const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; + int i; + + for (i = 0; i < 512; i++) + ac->buf_mdct[1535 - i] = ac->buf_mdct[512 + i]; + + if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { + memcpy(saved_ltp, saved, 512 * sizeof(float)); + memset(saved_ltp + 576, 0, 448 * sizeof(float)); + ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, swindow, 128); + } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { + memcpy(saved_ltp, ac->buf_mdct + 512, 448 * sizeof(float)); + memset(saved_ltp + 576, 0, 448 * sizeof(float)); + ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, swindow, 128); + } else { // LONG_STOP or ONLY_LONG + ac->dsp.vector_fmul_reverse(saved_ltp, ac->buf_mdct + 512, lwindow, 1024); + } + + memcpy(sce->ltp_state, &sce->ltp_state[1024], 1024 * sizeof(int16_t)); + ac->fmt_conv.float_to_int16(&(sce->ltp_state[1024]), sce->ret, 1024); + ac->fmt_conv.float_to_int16(&(sce->ltp_state[2048]), saved_ltp, 1024); +} + /** * Conduct IMDCT and windowing. */ @@ -1857,6 +1980,14 @@ static void spectral_to_sample(AACContext *ac) if (che) { if (type <= TYPE_CPE) apply_channel_coupling(ac, che, type, i, BEFORE_TNS, apply_dependent_coupling); + if (ac->m4ac.object_type == AOT_AAC_LTP) { + if (che->ch[0].ics.predictor_present) { + if (che->ch[0].ics.ltp.present) + apply_ltp(ac, &che->ch[0]); + if (che->ch[1].ics.ltp.present && type == TYPE_CPE) + apply_ltp(ac, &che->ch[1]); + } + } if (che->ch[0].tns.present) apply_tns(che->ch[0].coeffs, &che->ch[0].tns, &che->ch[0].ics, 1); if (che->ch[1].tns.present) @@ -1865,8 +1996,12 @@ static void spectral_to_sample(AACContext *ac) apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, apply_dependent_coupling); if (type != TYPE_CCE || che->coup.coupling_point == AFTER_IMDCT) { imdct_and_windowing(ac, &che->ch[0]); + if (ac->m4ac.object_type == AOT_AAC_LTP) + update_ltp(ac, &che->ch[0]); if (type == TYPE_CPE) { imdct_and_windowing(ac, &che->ch[1]); + if (ac->m4ac.object_type == AOT_AAC_LTP) + update_ltp(ac, &che->ch[1]); } if (ac->m4ac.sbr > 0) { ff_sbr_apply(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret); @@ -2080,6 +2215,7 @@ static av_cold int aac_decode_close(AVCodecContext *avctx) ff_mdct_end(&ac->mdct); ff_mdct_end(&ac->mdct_small); + ff_mdct_end(&ac->mdct_ltp); return 0; } diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h index b4307f133c..500e8f2ad0 100644 --- a/libavcodec/aacdectab.h +++ b/libavcodec/aacdectab.h @@ -35,6 +35,14 @@ #include +/* @name ltp_coef + * Table of the LTP coefficient (multiplied by 2) + */ +static const float ltp_coef[8] = { + 1.141658, 1.393232, 1.626008, 1.822608, + 1.969800, 2.135788, 2.2389202, 2.739066, +}; + /* @name tns_tmp2_map * Tables of the tmp2[] arrays of LPC coefficients used for TNS. * The suffix _M_N[] indicate the values of coef_compress and coef_res diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index b94185079d..174624e15d 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -57,7 +57,7 @@ enum AudioObjectType { AOT_AAC_MAIN, ///< Y Main AOT_AAC_LC, ///< Y Low Complexity AOT_AAC_SSR, ///< N (code in SoC repo) Scalable Sample Rate - AOT_AAC_LTP, ///< N (code in SoC repo) Long Term Prediction + AOT_AAC_LTP, ///< Y Long Term Prediction AOT_SBR, ///< Y Spectral Band Replication AOT_AAC_SCALABLE, ///< N Scalable AOT_TWINVQ, ///< N Twin Vector Quantizer From d06497f316ed819ea0ca0fad2535342ec42c79a5 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko Date: Tue, 15 Feb 2011 13:51:45 +0200 Subject: [PATCH 366/528] fix nsvdec.c compilation if DEBUG defined Signed-off-by: Ronald S. Bultje --- libavformat/nsvdec.c | 111 +++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 63 deletions(-) diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index e15d6e283a..9bf5636e5b 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -81,12 +81,6 @@ * - seek */ -#ifdef DEBUG -#define PRINT(_v) printf _v -#else -#define PRINT(_v) -#endif - #if 0 struct NSVf_header { uint32_t chunk_tag; /* 'NSVf' */ @@ -216,16 +210,12 @@ static const AVCodecTag nsv_codec_audio_tags[] = { //static int nsv_load_index(AVFormatContext *s); static int nsv_read_chunk(AVFormatContext *s, int fill_header); -#ifdef DEBUG -static void print_tag(const char *str, unsigned int tag, int size) -{ - printf("%s: tag=%c%c%c%c\n", - str, tag & 0xff, - (tag >> 8) & 0xff, - (tag >> 16) & 0xff, - (tag >> 24) & 0xff); -} -#endif +#define print_tag(str, tag, size) \ + av_dlog(NULL, "%s: tag=%c%c%c%c\n", \ + str, tag & 0xff, \ + (tag >> 8) & 0xff, \ + (tag >> 16) & 0xff, \ + (tag >> 24) & 0xff); /* try to find something we recognize, and set the state accordingly */ static int nsv_resync(AVFormatContext *s) @@ -235,43 +225,41 @@ static int nsv_resync(AVFormatContext *s) uint32_t v = 0; int i; - PRINT(("%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state)); + av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state); //nsv->state = NSV_UNSYNC; for (i = 0; i < NSV_MAX_RESYNC; i++) { if (url_feof(pb)) { - PRINT(("NSV EOF\n")); + av_dlog(s, "NSV EOF\n"); nsv->state = NSV_UNSYNC; return -1; } v <<= 8; v |= get_byte(pb); -/* if (i < 8) { - PRINT(("NSV resync: [%d] = %02x\n", i, v & 0x0FF)); + av_dlog(s, "NSV resync: [%d] = %02x\n", i, v & 0x0FF); } -*/ if ((v & 0x0000ffff) == 0xefbe) { /* BEEF */ - PRINT(("NSV resynced on BEEF after %d bytes\n", i+1)); + av_dlog(s, "NSV resynced on BEEF after %d bytes\n", i+1); nsv->state = NSV_FOUND_BEEF; return 0; } /* we read as big endian, thus the MK*BE* */ if (v == TB_NSVF) { /* NSVf */ - PRINT(("NSV resynced on NSVf after %d bytes\n", i+1)); + av_dlog(s, "NSV resynced on NSVf after %d bytes\n", i+1); nsv->state = NSV_FOUND_NSVF; return 0; } if (v == MKBETAG('N', 'S', 'V', 's')) { /* NSVs */ - PRINT(("NSV resynced on NSVs after %d bytes\n", i+1)); + av_dlog(s, "NSV resynced on NSVs after %d bytes\n", i+1); nsv->state = NSV_FOUND_NSVS; return 0; } } - PRINT(("NSV sync lost\n")); + av_dlog(s, "NSV sync lost\n"); return -1; } @@ -285,7 +273,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) int table_entries; int table_entries_used; - PRINT(("%s()\n", __FUNCTION__)); + av_dlog(s, "%s()\n", __FUNCTION__); nsv->state = NSV_UNSYNC; /* in case we fail */ @@ -296,22 +284,22 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) //s->file_size = (uint32_t)get_le32(pb); file_size = (uint32_t)get_le32(pb); - PRINT(("NSV NSVf chunk_size %u\n", size)); - PRINT(("NSV NSVf file_size %u\n", file_size)); + av_dlog(s, "NSV NSVf chunk_size %u\n", size); + av_dlog(s, "NSV NSVf file_size %u\n", file_size); nsv->duration = duration = get_le32(pb); /* in ms */ - PRINT(("NSV NSVf duration %"PRId64" ms\n", duration)); + av_dlog(s, "NSV NSVf duration %"PRId64" ms\n", duration); // XXX: store it in AVStreams strings_size = get_le32(pb); table_entries = get_le32(pb); table_entries_used = get_le32(pb); - PRINT(("NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", - strings_size, table_entries, table_entries_used)); + av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", + strings_size, table_entries, table_entries_used); if (url_feof(pb)) return -1; - PRINT(("NSV got header; filepos %"PRId64"\n", url_ftell(pb))); + av_dlog(s, "NSV got header; filepos %"PRId64"\n", url_ftell(pb)); if (strings_size > 0) { char *strings; /* last byte will be '\0' to play safe with str*() */ @@ -338,7 +326,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) if (!p || p >= endp) break; *p++ = '\0'; - PRINT(("NSV NSVf INFO: %s='%s'\n", token, value)); + av_dlog(s, "NSV NSVf INFO: %s='%s'\n", token, value); av_metadata_set2(&s->metadata, token, value, 0); } av_free(strings); @@ -346,7 +334,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) if (url_feof(pb)) return -1; - PRINT(("NSV got infos; filepos %"PRId64"\n", url_ftell(pb))); + av_dlog(s, "NSV got infos; filepos %"PRId64"\n", url_ftell(pb)); if (table_entries_used > 0) { int i; @@ -367,22 +355,22 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) } } - PRINT(("NSV got index; filepos %"PRId64"\n", url_ftell(pb))); + av_dlog(s, "NSV got index; filepos %"PRId64"\n", url_ftell(pb)); #ifdef DEBUG_DUMP_INDEX #define V(v) ((v<0x20 || v > 127)?'.':v) /* dump index */ - PRINT(("NSV %d INDEX ENTRIES:\n", table_entries)); - PRINT(("NSV [dataoffset][fileoffset]\n", table_entries)); + av_dlog(s, "NSV %d INDEX ENTRIES:\n", table_entries); + av_dlog(s, "NSV [dataoffset][fileoffset]\n", table_entries); for (i = 0; i < table_entries; i++) { unsigned char b[8]; url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); get_buffer(pb, b, 8); - PRINT(("NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x" + av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x" "%c%c%c%c%c%c%c%c\n", nsv->nsvs_file_offset[i], size + nsv->nsvs_file_offset[i], b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], - V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) )); + V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) ); } //url_fseek(pb, size, SEEK_SET); /* go back to end of header */ #undef V @@ -406,7 +394,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) int i; AVStream *st; NSVStream *nst; - PRINT(("%s()\n", __FUNCTION__)); + av_dlog(s, "%s()\n", __FUNCTION__); vtag = get_le32(pb); atag = get_le32(pb); @@ -414,7 +402,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) vheight = get_le16(pb); i = get_byte(pb); - PRINT(("NSV NSVs framerate code %2x\n", i)); + av_dlog(s, "NSV NSVs framerate code %2x\n", i); if(i&0x80) { /* odd way of giving native framerates from docs */ int t=(i & 0x7F)>>2; if(t<16) framerate = (AVRational){1, t+1}; @@ -434,11 +422,10 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) nsv->avsync = get_le16(pb); nsv->framerate = framerate; -#ifdef DEBUG + print_tag("NSV NSVs vtag", vtag, 0); print_tag("NSV NSVs atag", atag, 0); - PRINT(("NSV NSVs vsize %dx%d\n", vwidth, vheight)); -#endif + av_dlog(s, "NSV NSVs vsize %dx%d\n", vwidth, vheight); /* XXX change to ap != NULL ? */ if (s->nb_streams == 0) { /* streams not yet published, let's do that */ @@ -502,7 +489,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) #ifdef CHECK_SUBSEQUENT_NSVS } else { if (nsv->vtag != vtag || nsv->atag != atag || nsv->vwidth != vwidth || nsv->vheight != vwidth) { - PRINT(("NSV NSVs header values differ from the first one!!!\n")); + av_dlog(s, "NSV NSVs header values differ from the first one!!!\n"); //return -1; } #endif /* CHECK_SUBSEQUENT_NSVS */ @@ -521,8 +508,8 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap) NSVContext *nsv = s->priv_data; int i, err; - PRINT(("%s()\n", __FUNCTION__)); - PRINT(("filename '%s'\n", s->filename)); + av_dlog(s, "%s()\n", __FUNCTION__); + av_dlog(s, "filename '%s'\n", s->filename); nsv->state = NSV_UNSYNC; nsv->ahead[0].data = nsv->ahead[1].data = NULL; @@ -543,7 +530,7 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap) /* now read the first chunk, so we can attempt to decode more info */ err = nsv_read_chunk(s, 1); - PRINT(("parsed header\n")); + av_dlog(s, "parsed header\n"); return 0; } @@ -561,7 +548,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header) uint16_t auxsize; uint32_t auxtag; - PRINT(("%s(%d)\n", __FUNCTION__, fill_header)); + av_dlog(s, "%s(%d)\n", __FUNCTION__, fill_header); if (nsv->ahead[0].data || nsv->ahead[1].data) return 0; //-1; /* hey! eat what you've in your plate first! */ @@ -586,17 +573,17 @@ null_chunk_retry: asize = get_le16(pb); vsize = (vsize << 4) | (auxcount >> 4); auxcount &= 0x0f; - PRINT(("NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize)); + av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize); /* skip aux stuff */ for (i = 0; i < auxcount; i++) { auxsize = get_le16(pb); auxtag = get_le32(pb); - PRINT(("NSV aux data: '%c%c%c%c', %d bytes\n", + av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n", (auxtag & 0x0ff), ((auxtag >> 8) & 0x0ff), ((auxtag >> 16) & 0x0ff), ((auxtag >> 24) & 0x0ff), - auxsize)); + auxsize); url_fskip(pb, auxsize); vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */ } @@ -621,10 +608,8 @@ null_chunk_retry: pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO; pkt->dts = nst->frame_offset; pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */ -/* - for (i = 0; i < MIN(8, vsize); i++) - PRINT(("NSV video: [%d] = %02x\n", i, pkt->data[i])); -*/ + for (i = 0; i < FFMIN(8, vsize); i++) + av_dlog(s, "NSV video: [%d] = %02x\n", i, pkt->data[i]); } if(st[NSV_ST_VIDEO]) ((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset++; @@ -642,11 +627,11 @@ null_chunk_retry: channels = get_byte(pb); samplerate = get_le16(pb); asize-=4; - PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate)); + av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate); if (fill_header) { st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */ if (bps != 16) { - PRINT(("NSV AUDIO bit/sample != 16 (%d)!!!\n", bps)); + av_dlog(s, "NSV AUDIO bit/sample != 16 (%d)!!!\n", bps); } bps /= channels; // ??? if (bps == 8) @@ -655,7 +640,7 @@ null_chunk_retry: channels = 1; st[NSV_ST_AUDIO]->codec->channels = channels; st[NSV_ST_AUDIO]->codec->sample_rate = samplerate; - PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate)); + av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate); } } av_get_packet(pb, pkt, asize); @@ -666,7 +651,7 @@ null_chunk_retry: pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1); pkt->dts *= (int64_t)1000 * nsv->framerate.den; pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num; - PRINT(("NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts)); + av_dlog(s, "NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts); } nst->frame_offset++; } @@ -681,7 +666,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt) NSVContext *nsv = s->priv_data; int i, err = 0; - PRINT(("%s()\n", __FUNCTION__)); + av_dlog(s, "%s()\n", __FUNCTION__); /* in case we don't already have something to eat ... */ if (nsv->ahead[0].data == NULL && nsv->ahead[1].data == NULL) @@ -692,7 +677,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt) /* now pick one of the plates */ for (i = 0; i < 2; i++) { if (nsv->ahead[i].data) { - PRINT(("%s: using cached packet[%d]\n", __FUNCTION__, i)); + av_dlog(s, "%s: using cached packet[%d]\n", __FUNCTION__, i); /* avoid the cost of new_packet + memcpy(->data) */ memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket)); nsv->ahead[i].data = NULL; /* we ate that one */ @@ -752,7 +737,7 @@ static int nsv_read_close(AVFormatContext *s) static int nsv_probe(AVProbeData *p) { int i; -// PRINT(("nsv_probe(), buf_size %d\n", p->buf_size)); + av_dlog(s, "nsv_probe(), buf_size %d\n", p->buf_size); /* check file header */ /* streamed files might not have any header */ if (p->buf[0] == 'N' && p->buf[1] == 'S' && From 9806fbd5351fa84f99fa5b18fe06859acb514f34 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Tue, 15 Feb 2011 11:58:51 +0000 Subject: [PATCH 367/528] binkaudio: fix channel count check Perform validity check on AVFormatContext.channels instead of uninitialised field. This fixes issue 2001. Signed-off-by: Mans Rullgard --- libavcodec/binkaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 53484654db..ae3db5d6c7 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -85,8 +85,8 @@ static av_cold int decode_init(AVCodecContext *avctx) } s->frame_len = 1 << frame_len_bits; - if (s->channels > MAX_CHANNELS) { - av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels); + if (avctx->channels > MAX_CHANNELS) { + av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels); return -1; } From 71f88b1f3843fdb676d6f72181da0c8c460341d8 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Tue, 15 Feb 2011 11:59:45 +0000 Subject: [PATCH 368/528] binkaudio: remove unused copy of AVCodecContext* Signed-off-by: Mans Rullgard --- libavcodec/binkaudio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index ae3db5d6c7..39517f7eb4 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -41,7 +41,6 @@ extern const uint16_t ff_wma_critical_freqs[25]; #define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11) typedef struct { - AVCodecContext *avctx; GetBitContext gb; DSPContext dsp; FmtConvertContext fmt_conv; @@ -71,7 +70,6 @@ static av_cold int decode_init(AVCodecContext *avctx) int i; int frame_len_bits; - s->avctx = avctx; dsputil_init(&s->dsp, avctx); ff_fmt_convert_init(&s->fmt_conv, avctx); @@ -86,7 +84,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s->frame_len = 1 << frame_len_bits; if (avctx->channels > MAX_CHANNELS) { - av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels); + av_log(avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels); return -1; } From 55bad0c602c75a2c7e4dbfa466edacb0bad6a6eb Mon Sep 17 00:00:00 2001 From: Christophe Massiot Date: Thu, 10 Feb 2011 16:38:03 +0100 Subject: [PATCH 369/528] Pass VBV delay to the calling application via ctx VBV delay is useful for T-STD compliance in some TS muxers. It is certainly possible to retrieve it by parsing the output of FFmpeg, but getting it from the context makes it simpler and less error-prone. Signed-off-by: Mans Rullgard --- libavcodec/avcodec.h | 10 +++++++++- libavcodec/mpegvideo_enc.c | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index e48033dca0..9ed6f50856 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -32,7 +32,7 @@ #include "libavutil/cpu.h" #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 112 +#define LIBAVCODEC_VERSION_MINOR 113 #define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -2892,6 +2892,14 @@ typedef struct AVCodecContext { * - decoding: Set by user. */ int thread_safe_callbacks; + + /** + * VBV delay coded in the last frame (in periods of a 27 MHz clock). + * Used for compliant TS muxing. + * - encoding: Set by libavcodec. + * - decoding: unused. + */ + uint64_t vbv_delay; } AVCodecContext; /** diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 6167a9b20e..a7f16080f4 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1381,6 +1381,7 @@ vbv_retry: s->vbv_delay_ptr[1] = vbv_delay>>5; s->vbv_delay_ptr[2] &= 0x07; s->vbv_delay_ptr[2] |= vbv_delay<<3; + avctx->vbv_delay = vbv_delay*300; } s->total_bits += s->frame_bits; avctx->frame_bits = s->frame_bits; From 8ed4cc65a19b5a6cc7ae6ed5072be2d3836dbeb2 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 15 Feb 2011 14:18:49 +0000 Subject: [PATCH 370/528] APIchanges: update for 55bad0c: vbv_delay Signed-off-by: Mans Rullgard --- doc/APIchanges | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 74c642f2b2..ce61cfcf72 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-10 - 55bad0c - lavc 52.113.0 - vbv_delay + Add vbv_delay field to AVCodecContext + 2011-02-14 - 24a83bd - lavf 52.100.0 - AV_DISPOSITION_CLEAN_EFFECTS Add AV_DISPOSITION_CLEAN_EFFECTS disposition flag. From 737eb5976f6a37703923ce3c3d5e6ca8eeabb43a Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Mon, 7 Feb 2011 14:37:08 +0100 Subject: [PATCH 371/528] Merge libavcore into libavutil It is pretty hopeless that other considerable projects will adopt libavutil alone in other projects. Projects that need small footprint are better off with more specialized libraries such as gnulib or rather just copy the necessary parts that they need. With this in mind, nobody is helped by having libavutil and libavcore split. In order to ease maintenance inside and around FFmpeg and to reduce confusion where to put common code, avcore's functionality is merged (back) to avutil. Signed-off-by: Reinhard Tartler --- Makefile | 1 - cmdutils.c | 2 - common.mak | 2 +- configure | 13 ++--- doc/APIchanges | 4 +- doc/general.texi | 2 +- ffmpeg.c | 6 +-- ffplay.c | 6 +-- ffserver.c | 2 +- libavcodec/Makefile | 2 +- libavcodec/aacdectab.h | 2 +- libavcodec/ac3_parser.c | 2 +- libavcodec/ac3enc.c | 2 +- libavcodec/ac3tab.c | 2 +- libavcodec/alsdec.c | 2 +- libavcodec/apedec.c | 2 +- libavcodec/audioconvert.c | 2 +- libavcodec/audioconvert.h | 2 +- libavcodec/avcodec.h | 4 +- libavcodec/bink.c | 2 +- libavcodec/bmpenc.c | 2 +- libavcodec/cook.c | 2 +- libavcodec/dca.c | 2 +- libavcodec/dirac.c | 2 +- libavcodec/dnxhddec.c | 2 +- libavcodec/dpx.c | 2 +- libavcodec/dsputil.c | 2 +- libavcodec/eacmv.c | 2 +- libavcodec/eamad.c | 2 +- libavcodec/eatgv.c | 2 +- libavcodec/flvdec.c | 2 +- libavcodec/gifdec.c | 2 +- libavcodec/h264.c | 2 +- libavcodec/h264_ps.c | 2 +- libavcodec/iff.c | 2 +- libavcodec/imc.c | 2 +- libavcodec/imgconvert.c | 3 +- libavcodec/indeo3.c | 2 +- libavcodec/kgv1dec.c | 2 +- libavcodec/libdiracdec.c | 2 +- libavcodec/libopenjpeg.c | 2 +- libavcodec/libschroedingerdec.c | 2 +- libavcodec/libvpxdec.c | 2 +- libavcodec/mjpegdec.c | 2 +- libavcodec/mpc7.c | 2 +- libavcodec/mpc8.c | 2 +- libavcodec/mpegvideo.c | 2 +- libavcodec/nellymoserdec.c | 2 +- libavcodec/nuv.c | 2 +- libavcodec/pcm-mpeg.c | 2 +- libavcodec/pcx.c | 2 +- libavcodec/pgssubdec.c | 2 +- libavcodec/pictordec.c | 2 +- libavcodec/pngdec.c | 2 +- libavcodec/pnm.c | 2 +- libavcodec/ptx.c | 2 +- libavcodec/qtrleenc.c | 2 +- libavcodec/rawdec.c | 3 +- libavcodec/resample.c | 2 +- libavcodec/rv10.c | 2 +- libavcodec/rv40.c | 2 +- libavcodec/sgidec.c | 2 +- libavcodec/smacker.c | 2 +- libavcodec/srtdec.c | 2 +- libavcodec/sunrast.c | 2 +- libavcodec/targa.c | 2 +- libavcodec/tiff.c | 2 +- libavcodec/truemotion1.c | 2 +- libavcodec/txd.c | 2 +- libavcodec/utils.c | 9 ++-- libavcodec/vorbis_data.c | 2 +- libavcodec/vp3.c | 2 +- libavcodec/vp8.c | 2 +- libavcodec/vqavideo.c | 2 +- libavcodec/wavpack.c | 2 +- libavcodec/xsubdec.c | 2 +- libavcodec/yop.c | 2 +- libavcore/Makefile | 20 ------- libavcore/avcore.h | 70 ------------------------- libavcore/internal.h | 31 ----------- libavcore/libavcore.v | 4 -- libavcore/utils.c | 41 --------------- libavdevice/Makefile | 2 +- libavdevice/v4l.c | 2 +- libavdevice/v4l2.c | 2 +- libavfilter/Makefile | 2 +- libavfilter/asrc_anullsrc.c | 2 +- libavfilter/avfilter.c | 4 +- libavfilter/avfilter.h | 5 +- libavfilter/defaults.c | 6 +-- libavfilter/vf_crop.c | 2 +- libavfilter/vf_cropdetect.c | 2 +- libavfilter/vf_drawbox.c | 2 +- libavfilter/vf_frei0r.c | 4 +- libavfilter/vf_gradfun.c | 2 +- libavfilter/vf_hflip.c | 2 +- libavfilter/vf_overlay.c | 2 +- libavfilter/vf_pad.c | 4 +- libavfilter/vf_transpose.c | 2 +- libavfilter/vsrc_buffer.c | 2 +- libavfilter/vsrc_movie.c | 2 +- libavfilter/vsrc_nullsrc.c | 2 +- libavformat/Makefile | 2 +- libavformat/aea.c | 2 +- libavformat/flic.c | 2 +- libavformat/matroskaenc.c | 2 +- libavformat/utils.c | 2 +- libavformat/wv.c | 2 +- libavutil/Makefile | 8 +++ {libavcore => libavutil}/audioconvert.c | 1 + {libavcore => libavutil}/audioconvert.h | 10 ++-- libavutil/avutil.h | 14 ++++- {libavcore => libavutil}/imgutils.c | 0 {libavcore => libavutil}/imgutils.h | 10 ++-- {libavcore => libavutil}/parseutils.c | 2 +- {libavcore => libavutil}/parseutils.h | 8 +-- {libavcore => libavutil}/samplefmt.c | 5 +- {libavcore => libavutil}/samplefmt.h | 10 ++-- libswscale/Makefile | 1 - libswscale/swscale-test.c | 2 +- 120 files changed, 166 insertions(+), 321 deletions(-) delete mode 100644 libavcore/Makefile delete mode 100644 libavcore/avcore.h delete mode 100644 libavcore/internal.h delete mode 100644 libavcore/libavcore.v delete mode 100644 libavcore/utils.c rename {libavcore => libavutil}/audioconvert.c (99%) rename {libavcore => libavutil}/audioconvert.h (97%) rename {libavcore => libavutil}/imgutils.c (100%) rename {libavcore => libavutil}/imgutils.h (96%) rename {libavcore => libavutil}/parseutils.c (99%) rename {libavcore => libavutil}/parseutils.h (95%) rename {libavcore => libavutil}/samplefmt.c (97%) rename {libavcore => libavutil}/samplefmt.h (93%) diff --git a/Makefile b/Makefile index 99d264a446..4ed003b7a5 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,6 @@ FFLIBS-$(CONFIG_AVFORMAT) += avformat FFLIBS-$(CONFIG_AVCODEC) += avcodec FFLIBS-$(CONFIG_POSTPROC) += postproc FFLIBS-$(CONFIG_SWSCALE) += swscale -FFLIBS-$(CONFIG_AVCORE) += avcore FFLIBS := avutil diff --git a/cmdutils.c b/cmdutils.c index c68f37fe20..9809d2fe8a 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -38,7 +38,6 @@ #include "libavutil/pixdesc.h" #include "libavutil/eval.h" #include "libavcodec/opt.h" -#include "libavcore/avcore.h" #include "cmdutils.h" #include "version.h" #if CONFIG_NETWORK @@ -413,7 +412,6 @@ static int warned_cfg = 0; static void print_all_libs_info(FILE* outstream, int flags) { PRINT_LIB_INFO(outstream, avutil, AVUTIL, flags); - PRINT_LIB_INFO(outstream, avcore, AVCORE, flags); PRINT_LIB_INFO(outstream, avcodec, AVCODEC, flags); PRINT_LIB_INFO(outstream, avformat, AVFORMAT, flags); PRINT_LIB_INFO(outstream, avdevice, AVDEVICE, flags); diff --git a/common.mak b/common.mak index 110f5056c4..3d1a1293fb 100644 --- a/common.mak +++ b/common.mak @@ -31,7 +31,7 @@ $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR)))) $(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL)) endif -ALLFFLIBS = avcodec avcore avdevice avfilter avformat avutil postproc swscale +ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale IFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) CPPFLAGS := $(IFLAGS) $(CPPFLAGS) diff --git a/configure b/configure index 90eeaa0b66..ed2934d33f 100755 --- a/configure +++ b/configure @@ -86,7 +86,6 @@ Configuration options: --disable-ffserver disable ffserver build --disable-avdevice disable libavdevice build --disable-avcodec disable libavcodec build - --disable-avcore disable libavcore build --disable-avformat disable libavformat build --disable-swscale disable libswscale build --enable-postproc enable GPLed postprocessing support [no] @@ -871,7 +870,6 @@ CONFIG_LIST=" $COMPONENT_LIST aandct avcodec - avcore avdevice avfilter avformat @@ -1589,7 +1587,6 @@ host_os=$target_os_default # configurable options enable avcodec -enable avcore enable avdevice enable avfilter enable avformat @@ -2933,7 +2930,7 @@ enabled extra_warnings && check_cflags -Winline # add some linker flags check_ldflags -Wl,--warn-common check_ldflags -Wl,--as-needed -check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavcore -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil' +check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil' test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic echo "X{};" > $TMPV @@ -3143,7 +3140,6 @@ if enabled source_path_used; then doc libavcodec libavcodec/$arch - libavcore libavdevice libavfilter libavfilter/$arch @@ -3163,7 +3159,6 @@ if enabled source_path_used; then doc/texi2pod.pl libavcodec/Makefile libavcodec/${arch}/Makefile - libavcore/Makefile libavdevice/Makefile libavfilter/Makefile libavfilter/${arch}/Makefile @@ -3266,7 +3261,6 @@ get_version(){ get_version LIBSWSCALE libswscale/swscale.h get_version LIBPOSTPROC libpostproc/postprocess.h get_version LIBAVCODEC libavcodec/avcodec.h -get_version LIBAVCORE libavcore/avcore.h get_version LIBAVDEVICE libavdevice/avdevice.h get_version LIBAVFORMAT libavformat/version.h get_version LIBAVUTIL libavutil/avutil.h @@ -3394,10 +3388,9 @@ EOF } pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" -pkgconfig_generate libavcore "FFmpeg multimedia shared core utilities library" "$LIBAVCORE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION" -pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION" +pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION" pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION" -pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION" +pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION" pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION" diff --git a/doc/APIchanges b/doc/APIchanges index ce61cfcf72..421df01336 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,7 +2,6 @@ Never assume the API of libav* to be stable unless at least 1 week has passed si the last major version increase. The last version increases were: libavcodec: ? -libavcore: 2010-07-21 libavdevice: ? libavfilter: 2009-10-18 libavformat: ? @@ -13,6 +12,9 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-15 - lavu 52.38.0 - merge libavcore + libavcore is merged back completely into libavutil + 2011-02-10 - 55bad0c - lavc 52.113.0 - vbv_delay Add vbv_delay field to AVCodecContext diff --git a/doc/general.texi b/doc/general.texi index 3fc4d00e26..cd126f9868 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -986,7 +986,7 @@ 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 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{avcodec.lib}, @file{avformat.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}, diff --git a/ffmpeg.c b/ffmpeg.c index 85149a7935..1cad57d809 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -36,9 +36,9 @@ #include "libswscale/swscale.h" #include "libavcodec/opt.h" #include "libavcodec/audioconvert.h" -#include "libavcore/audioconvert.h" -#include "libavcore/parseutils.h" -#include "libavcore/samplefmt.h" +#include "libavutil/audioconvert.h" +#include "libavutil/parseutils.h" +#include "libavutil/samplefmt.h" #include "libavutil/colorspace.h" #include "libavutil/fifo.h" #include "libavutil/intreadwrite.h" diff --git a/ffplay.c b/ffplay.c index 6b4f38ee35..b6343287ac 100644 --- a/ffplay.c +++ b/ffplay.c @@ -28,9 +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 "libavutil/imgutils.h" +#include "libavutil/parseutils.h" +#include "libavutil/samplefmt.h" #include "libavformat/avformat.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" diff --git a/ffserver.c b/ffserver.c index 9a3240808b..cbf04aa4a5 100644 --- a/ffserver.c +++ b/ffserver.c @@ -36,7 +36,7 @@ #include "libavutil/avstring.h" #include "libavutil/lfg.h" #include "libavutil/random_seed.h" -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" #include "libavcodec/opt.h" #include #include diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 682b626800..930affbb7a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1,7 +1,7 @@ include $(SUBDIR)../config.mak NAME = avcodec -FFLIBS = avcore avutil +FFLIBS = avutil HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h xvmc.h diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h index 500e8f2ad0..0bccb84cb7 100644 --- a/libavcodec/aacdectab.h +++ b/libavcodec/aacdectab.h @@ -30,7 +30,7 @@ #ifndef AVCODEC_AACDECTAB_H #define AVCODEC_AACDECTAB_H -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "aac.h" #include diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index bab354d6b9..301aadcd84 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -24,7 +24,7 @@ #include "ac3_parser.h" #include "aac_ac3_parser.h" #include "get_bits.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #define AC3_HEADER_SIZE 7 diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 851fdc9caf..c15fd5109c 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -28,7 +28,7 @@ //#define DEBUG -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "libavutil/crc.h" #include "avcodec.h" #include "put_bits.h" diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c index 7c0ebcdcd3..f7b030209c 100644 --- a/libavcodec/ac3tab.c +++ b/libavcodec/ac3tab.c @@ -24,7 +24,7 @@ * tables taken directly from the AC-3 spec. */ -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "avcodec.h" #include "ac3tab.h" diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index bfc589d26d..41b3f0caf5 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -36,7 +36,7 @@ #include "bytestream.h" #include "bgmc.h" #include "dsputil.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #include "libavutil/crc.h" #include diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index e673b88bee..05498777b4 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -25,7 +25,7 @@ #include "dsputil.h" #include "get_bits.h" #include "bytestream.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" /** * @file diff --git a/libavcodec/audioconvert.c b/libavcodec/audioconvert.c index b29b030644..67cacbdcf1 100644 --- a/libavcodec/audioconvert.c +++ b/libavcodec/audioconvert.c @@ -27,7 +27,7 @@ #include "libavutil/avstring.h" #include "libavutil/libm.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #include "avcodec.h" #include "audioconvert.h" diff --git a/libavcodec/audioconvert.h b/libavcodec/audioconvert.h index ae6016a611..5f38cca513 100644 --- a/libavcodec/audioconvert.h +++ b/libavcodec/audioconvert.h @@ -31,7 +31,7 @@ #include "libavutil/cpu.h" #include "avcodec.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #if FF_API_OLD_SAMPLE_FMT /** diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 9ed6f50856..84c3b6fc79 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -27,7 +27,7 @@ */ #include -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #include "libavutil/avutil.h" #include "libavutil/cpu.h" @@ -437,7 +437,7 @@ enum CodecID { #endif #if FF_API_OLD_AUDIOCONVERT -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" /* Audio channel masks */ #define CH_FRONT_LEFT AV_CH_FRONT_LEFT diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 95cfc92721..b77e9db0f6 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "binkdata.h" diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c index d424662b5c..b8f9047c55 100644 --- a/libavcodec/bmpenc.c +++ b/libavcodec/bmpenc.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/internal.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "bmp.h" diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 9d3d001297..da31e9f520 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -53,7 +53,7 @@ #include "dsputil.h" #include "bytestream.h" #include "fft.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "cookdata.h" diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 67195b1917..bdbe018be2 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -29,7 +29,7 @@ #include "libavutil/common.h" #include "libavutil/intmath.h" #include "libavutil/intreadwrite.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "avcodec.h" #include "dsputil.h" #include "fft.h" diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c index bacd1f8e9f..c8dc7a0f62 100644 --- a/libavcodec/dirac.c +++ b/libavcodec/dirac.c @@ -25,7 +25,7 @@ * @author Marco Gerards */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "dirac.h" #include "avcodec.h" #include "golomb.h" diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 58893acaf9..9b37d1d632 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -22,7 +22,7 @@ //#define TRACE //#define DEBUG -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "get_bits.h" #include "dnxhddata.h" diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index 55ae4e7248..ade4e8cbc0 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -20,7 +20,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "bytestream.h" #include "avcodec.h" diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 84714def41..c89e58f529 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -27,7 +27,7 @@ * DSP utils */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "simple_idct.h" diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c index 6770cd195e..7f6c2a4577 100644 --- a/libavcodec/eacmv.c +++ b/libavcodec/eacmv.c @@ -29,7 +29,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" typedef struct CmvContext { diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index 1dd3b79755..d4881ab843 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -34,7 +34,7 @@ #include "aandcttab.h" #include "mpeg12.h" #include "mpeg12data.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #define EA_PREAMBLE_SIZE 8 #define MADk_TAG MKTAG('M', 'A', 'D', 'k') /* MAD i-frame */ diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index 075405a907..9ad083475b 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -32,7 +32,7 @@ #define ALT_BITSTREAM_READER_LE #include "get_bits.h" #include "libavutil/lzo.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #define EA_PREAMBLE_SIZE 8 #define kVGT_TAG MKTAG('k', 'V', 'G', 'T') diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c index b1a7578173..cf4dfe43bc 100644 --- a/libavcodec/flvdec.c +++ b/libavcodec/flvdec.c @@ -20,7 +20,7 @@ #include "mpegvideo.h" #include "h263.h" #include "flv.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last){ int is11 = get_bits1(gb); diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index 7be284cb14..39d0db9c24 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -22,7 +22,7 @@ //#define DEBUG -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "lzw.h" diff --git a/libavcodec/h264.c b/libavcodec/h264.c index e6f9ec9b8d..5ebf929ee9 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -25,7 +25,7 @@ * @author Michael Niedermayer */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "internal.h" #include "dsputil.h" #include "avcodec.h" diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 3fe5815ea6..469d3d8bd2 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -25,7 +25,7 @@ * @author Michael Niedermayer */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "internal.h" #include "dsputil.h" #include "avcodec.h" diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 18ad7004d9..e64ce1eeb6 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -25,7 +25,7 @@ * IFF PBM/ILBM bitmap decoder */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "bytestream.h" #include "avcodec.h" #include "get_bits.h" diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 2b9de0b021..4cbb287a57 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -40,7 +40,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "imcdata.h" diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 6b0c049e2a..b37c343b93 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -36,8 +36,7 @@ #include "imgconvert.h" #include "libavutil/colorspace.h" #include "libavutil/pixdesc.h" -#include "libavcore/imgutils.h" -#include "libavcore/internal.h" +#include "libavutil/imgutils.h" #if HAVE_MMX && HAVE_YASM #include "x86/dsputil_mmx.h" diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 5c4cd0564a..c9d8573692 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -23,7 +23,7 @@ #include #include -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "bytestream.h" diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c index efc477f37d..2f6a80c2c6 100644 --- a/libavcodec/kgv1dec.c +++ b/libavcodec/kgv1dec.c @@ -25,7 +25,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" typedef struct { diff --git a/libavcodec/libdiracdec.c b/libavcodec/libdiracdec.c index 520ec3f03a..fb6ff45f0a 100644 --- a/libavcodec/libdiracdec.c +++ b/libavcodec/libdiracdec.c @@ -28,7 +28,7 @@ * (http://dirac.sourceforge.net/specification.html). */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "libdirac.h" #undef NDEBUG diff --git a/libavcodec/libopenjpeg.c b/libavcodec/libopenjpeg.c index 0a9ded896d..1f8530c7c6 100644 --- a/libavcodec/libopenjpeg.c +++ b/libavcodec/libopenjpeg.c @@ -24,7 +24,7 @@ * JPEG 2000 decoder using libopenjpeg */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "libavutil/intreadwrite.h" #define OPJ_STATIC diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c index e733d9e34d..7603f7e15f 100644 --- a/libavcodec/libschroedingerdec.c +++ b/libavcodec/libschroedingerdec.c @@ -27,7 +27,7 @@ * (http://dirac.sourceforge.net/specification.html). */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "libdirac_libschro.h" #include "libschroedinger.h" diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index f912322c50..29b8eec43e 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -27,7 +27,7 @@ #include #include -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" typedef struct VP8DecoderContext { diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index fbc637aa30..69a1837472 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -33,7 +33,7 @@ //#define DEBUG #include -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "mjpeg.h" diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 8bdb9e5813..04657e5ff2 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -30,7 +30,7 @@ #include "get_bits.h" #include "dsputil.h" #include "mpegaudio.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "mpc.h" #include "mpc7data.h" diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 865ffc1b98..cf65ffe904 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -30,7 +30,7 @@ #include "get_bits.h" #include "dsputil.h" #include "mpegaudio.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "mpc.h" #include "mpcdata.h" diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index c8706bcf60..efb0365905 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -28,7 +28,7 @@ */ #include "libavutil/intmath.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "internal.h" diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 80e04ee0a2..fd8568d5ab 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -34,7 +34,7 @@ #include "nellymoser.h" #include "libavutil/lfg.h" #include "libavutil/random_seed.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "avcodec.h" #include "dsputil.h" #include "fft.h" diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c index d53d4578ba..84ee6af9b3 100644 --- a/libavcodec/nuv.c +++ b/libavcodec/nuv.c @@ -23,7 +23,7 @@ #include "libavutil/bswap.h" #include "libavutil/lzo.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "rtjpeg.h" diff --git a/libavcodec/pcm-mpeg.c b/libavcodec/pcm-mpeg.c index 189b2b5691..030507502d 100644 --- a/libavcodec/pcm-mpeg.c +++ b/libavcodec/pcm-mpeg.c @@ -24,7 +24,7 @@ * PCM codecs for encodings found in MPEG streams (DVD/Blu-ray) */ -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "avcodec.h" #include "bytestream.h" diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index cafade2d7d..d47417e3f7 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -22,7 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "get_bits.h" diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 1ed475787f..b7fe560953 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -28,7 +28,7 @@ #include "dsputil.h" #include "bytestream.h" #include "libavutil/colorspace.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" //#define DEBUG_PACKET_CONTENTS diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index 59885ae383..f1b3607082 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -24,7 +24,7 @@ * Pictor/PC Paint decoder */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "cga_data.h" diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 4bc5c3705a..2f9b343e5b 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -18,7 +18,7 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "png.h" diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c index c104e23427..2cbbdf60ea 100644 --- a/libavcodec/pnm.c +++ b/libavcodec/pnm.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "pnm.h" diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index 86b06b4aaa..28df0b6f2e 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -20,7 +20,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" typedef struct PTXContext { diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c index 78149e5ed8..8815736e87 100644 --- a/libavcodec/qtrleenc.c +++ b/libavcodec/qtrleenc.c @@ -22,7 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 29cc5e44d8..baffceb51b 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -28,8 +28,7 @@ #include "imgconvert.h" #include "raw.h" #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" -#include "libavcore/internal.h" +#include "libavutil/imgutils.h" typedef struct RawVideoContext { uint32_t palette[AVPALETTE_COUNT]; diff --git a/libavcodec/resample.c b/libavcodec/resample.c index 272831520d..45fba69f45 100644 --- a/libavcodec/resample.c +++ b/libavcodec/resample.c @@ -27,7 +27,7 @@ #include "avcodec.h" #include "audioconvert.h" #include "libavutil/opt.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" struct AVResampleContext; diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index f47540d8f1..e6e9afafb0 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -25,7 +25,7 @@ * RV10/RV20 decoder */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c index acebeb7da5..5d4aafc004 100644 --- a/libavcodec/rv40.c +++ b/libavcodec/rv40.c @@ -24,7 +24,7 @@ * RV40 decoder */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index ac2adfe7ca..96af5c6fc1 100644 --- a/libavcodec/sgidec.c +++ b/libavcodec/sgidec.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "sgi.h" diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 61f1604616..e3f00b8415 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -32,7 +32,7 @@ #include #include "avcodec.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #define ALT_BITSTREAM_READER_LE #include "get_bits.h" diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c index 30fdc12fe7..af03cc4d1c 100644 --- a/libavcodec/srtdec.c +++ b/libavcodec/srtdec.c @@ -20,7 +20,7 @@ */ #include "libavutil/avstring.h" -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" #include "avcodec.h" #include "ass.h" diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c index 76b65b356c..73e4b5b91c 100644 --- a/libavcodec/sunrast.c +++ b/libavcodec/sunrast.c @@ -20,7 +20,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #define RT_OLD 0 diff --git a/libavcodec/targa.c b/libavcodec/targa.c index e6e1ca6f21..ef6e92bddf 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -20,7 +20,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "targa.h" diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index b012baa994..8295a4b4c0 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -33,7 +33,7 @@ #include "faxcompr.h" #include "libavutil/common.h" #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" typedef struct TiffContext { AVCodecContext *avctx; diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index 448da84c57..c7d414a648 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -35,7 +35,7 @@ #include "avcodec.h" #include "dsputil.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "truemotion1data.h" diff --git a/libavcodec/txd.c b/libavcodec/txd.c index b394e1f5be..da1f5c1e20 100644 --- a/libavcodec/txd.c +++ b/libavcodec/txd.c @@ -22,7 +22,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "s3tc.h" diff --git a/libavcodec/utils.c b/libavcodec/utils.c index c4bba376bb..03fa7baeb5 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -29,10 +29,9 @@ #include "libavutil/integer.h" #include "libavutil/crc.h" #include "libavutil/pixdesc.h" -#include "libavcore/audioconvert.h" -#include "libavcore/imgutils.h" -#include "libavcore/internal.h" -#include "libavcore/samplefmt.h" +#include "libavutil/audioconvert.h" +#include "libavutil/imgutils.h" +#include "libavutil/samplefmt.h" #include "avcodec.h" #include "dsputil.h" #include "libavutil/opt.h" @@ -1169,7 +1168,7 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v) } #if LIBAVCODEC_VERSION_MAJOR < 53 -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str) { diff --git a/libavcodec/vorbis_data.c b/libavcodec/vorbis_data.c index 783a5daa00..8fa624168a 100644 --- a/libavcodec/vorbis_data.c +++ b/libavcodec/vorbis_data.c @@ -20,7 +20,7 @@ #include "dsputil.h" #include "vorbis.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" const uint8_t ff_vorbis_channel_layout_offsets[8][8] = { { 0 }, diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 726f18cb92..ee41846e74 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -33,7 +33,7 @@ #include #include -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "get_bits.h" diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 3cd76249d0..a66c10d655 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -22,7 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "vp56.h" #include "vp8data.h" diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index c3b5ba6556..f0ecda6217 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -68,7 +68,7 @@ #include #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #define PALETTE_COUNT 256 diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index ffb5018c57..d5102320fd 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -22,7 +22,7 @@ #include "avcodec.h" #include "get_bits.h" #include "unary.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" /** * @file diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c index 872b227d64..d24588b8d9 100644 --- a/libavcodec/xsubdec.c +++ b/libavcodec/xsubdec.c @@ -18,7 +18,7 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "get_bits.h" #include "bytestream.h" diff --git a/libavcodec/yop.c b/libavcodec/yop.c index 6a75e74b7a..a117e2d791 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -24,7 +24,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "get_bits.h" diff --git a/libavcore/Makefile b/libavcore/Makefile deleted file mode 100644 index f2e829702e..0000000000 --- a/libavcore/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include $(SUBDIR)../config.mak - -NAME = avcore -FFLIBS = avutil - -HEADERS = \ - audioconvert.h \ - avcore.h \ - imgutils.h \ - parseutils.h \ - samplefmt.h \ - -OBJS = \ - audioconvert.o \ - imgutils.o \ - parseutils.o \ - samplefmt.o \ - utils.o \ - -include $(SUBDIR)../subdir.mak diff --git a/libavcore/avcore.h b/libavcore/avcore.h deleted file mode 100644 index 9b02c3b58c..0000000000 --- a/libavcore/avcore.h +++ /dev/null @@ -1,70 +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 - */ - -#ifndef AVCORE_AVCORE_H -#define AVCORE_AVCORE_H - -/** - * @file - * shared media utilities for the libav* libraries - */ - -#include "libavutil/avutil.h" - -#define LIBAVCORE_VERSION_MAJOR 0 -#define LIBAVCORE_VERSION_MINOR 16 -#define LIBAVCORE_VERSION_MICRO 1 - -#define LIBAVCORE_VERSION_INT AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \ - LIBAVCORE_VERSION_MINOR, \ - LIBAVCORE_VERSION_MICRO) -#define LIBAVCORE_VERSION AV_VERSION(LIBAVCORE_VERSION_MAJOR, \ - LIBAVCORE_VERSION_MINOR, \ - LIBAVCORE_VERSION_MICRO) -#define LIBAVCORE_BUILD LIBAVCORE_VERSION_INT - -#define LIBAVCORE_IDENT "Lavcore" AV_STRINGIFY(LIBAVCORE_VERSION) - -/** - * Return the LIBAVCORE_VERSION_INT constant. - */ -unsigned avcore_version(void); - -/** - * Return the libavcore build-time configuration. - */ -const char *avcore_configuration(void); - -/** - * Return the libavcore license. - */ -const char *avcore_license(void); - -#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) -#define AV_TIME_BASE 1000000 -#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} - -/** - * 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 --git a/libavcore/internal.h b/libavcore/internal.h deleted file mode 100644 index 3960bd3986..0000000000 --- a/libavcore/internal.h +++ /dev/null @@ -1,31 +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 - */ - -#ifndef AVCORE_INTERNAL_H -#define AVCORE_INTERNAL_H - -/** - * @file - * internal functions - */ - -#include "avcore.h" - -int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt); - -#endif /* AVCORE_INTERNAL_H */ diff --git a/libavcore/libavcore.v b/libavcore/libavcore.v deleted file mode 100644 index dc84cc4965..0000000000 --- a/libavcore/libavcore.v +++ /dev/null @@ -1,4 +0,0 @@ -LIBAVCORE_$MAJOR { - global: av_*; ff_*; avcore*; - local: *; -}; diff --git a/libavcore/utils.c b/libavcore/utils.c deleted file mode 100644 index 8350a9bcad..0000000000 --- a/libavcore/utils.c +++ /dev/null @@ -1,41 +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 - */ - -#include "config.h" -#include "avcore.h" - -/** - * @file - * various utility functions - */ - -unsigned avcore_version(void) -{ - return LIBAVCORE_VERSION_INT; -} - -const char *avcore_configuration(void) -{ - return FFMPEG_CONFIGURATION; -} - -const char *avcore_license(void) -{ -#define LICENSE_PREFIX "libavcore license: " - return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1; -} diff --git a/libavdevice/Makefile b/libavdevice/Makefile index 1c0630b38c..be28f4a0ad 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -1,7 +1,7 @@ include $(SUBDIR)../config.mak NAME = avdevice -FFLIBS = avformat avcodec avcore avutil +FFLIBS = avformat avcodec avutil HEADERS = avdevice.h diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c index c107684bff..9a155f9df6 100644 --- a/libavdevice/v4l.c +++ b/libavdevice/v4l.c @@ -22,7 +22,7 @@ #undef __STRICT_ANSI__ //workaround due to broken kernel headers #include "config.h" #include "libavutil/rational.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "libavformat/avformat.h" #include "libavcodec/dsputil.h" #include diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 993e2adcec..1f1a4bcfb8 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -43,7 +43,7 @@ #endif #include #include -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" static const int desired_video_buffers = 256; diff --git a/libavfilter/Makefile b/libavfilter/Makefile index ce1caa5bdc..abb68c811d 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -1,7 +1,7 @@ include $(SUBDIR)../config.mak NAME = avfilter -FFLIBS = avcore avutil +FFLIBS = avutil FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec FFLIBS-$(CONFIG_SCALE_FILTER) += swscale diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c index 306e0a3d5a..4f49c3f186 100644 --- a/libavfilter/asrc_anullsrc.c +++ b/libavfilter/asrc_anullsrc.c @@ -22,7 +22,7 @@ */ #include "avfilter.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" typedef struct { int64_t channel_layout; diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 4d183294cb..039e04bf64 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -23,8 +23,8 @@ #include "libavutil/pixdesc.h" #include "libavutil/rational.h" -#include "libavcore/audioconvert.h" -#include "libavcore/imgutils.h" +#include "libavutil/audioconvert.h" +#include "libavutil/imgutils.h" #include "avfilter.h" #include "internal.h" diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 451d0befff..935214da68 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -23,8 +23,7 @@ #define AVFILTER_AVFILTER_H #include "libavutil/avutil.h" -#include "libavcore/avcore.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #define LIBAVFILTER_VERSION_MAJOR 1 #define LIBAVFILTER_VERSION_MINOR 76 @@ -585,7 +584,7 @@ struct AVFilterLink { int h; ///< agreed upon image height AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio /* These two parameters apply only to audio */ - int64_t channel_layout; ///< channel layout of current buffer (see libavcore/audioconvert.h) + int64_t channel_layout; ///< channel layout of current buffer (see libavutil/audioconvert.h) int64_t sample_rate; ///< samples per second int format; ///< agreed upon media format diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c index 9f245c306f..1da2630471 100644 --- a/libavfilter/defaults.c +++ b/libavfilter/defaults.c @@ -19,9 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/audioconvert.h" -#include "libavcore/imgutils.h" -#include "libavcore/samplefmt.h" +#include "libavutil/audioconvert.h" +#include "libavutil/imgutils.h" +#include "libavutil/samplefmt.h" #include "avfilter.h" #include "internal.h" diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c index e768fbb594..e02c24fe84 100644 --- a/libavfilter/vf_crop.c +++ b/libavfilter/vf_crop.c @@ -29,7 +29,7 @@ #include "libavutil/eval.h" #include "libavutil/avstring.h" #include "libavutil/libm.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" static const char *var_names[] = { "E", diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index 62c68640a3..000c8bb2c2 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -23,7 +23,7 @@ * Ported from MPlayer libmpcodecs/vf_cropdetect.c. */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avfilter.h" typedef struct { diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c index 40d5e16e1b..3785072920 100644 --- a/libavfilter/vf_drawbox.c +++ b/libavfilter/vf_drawbox.c @@ -26,7 +26,7 @@ #include "libavutil/colorspace.h" #include "libavutil/pixdesc.h" -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" #include "avfilter.h" enum { Y, U, V, A }; diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c index 03d4f28f2d..adccccb95b 100644 --- a/libavfilter/vf_frei0r.c +++ b/libavfilter/vf_frei0r.c @@ -27,8 +27,8 @@ #include #include #include "libavutil/avstring.h" -#include "libavcore/imgutils.h" -#include "libavcore/parseutils.h" +#include "libavutil/imgutils.h" +#include "libavutil/parseutils.h" #include "avfilter.h" typedef f0r_instance_t (*f0r_construct_f)(unsigned int width, unsigned int height); diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index 3a400a04eb..83ed3d79e4 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -32,7 +32,7 @@ * Dither it back to 8bit. */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "libavutil/cpu.h" #include "libavutil/pixdesc.h" #include "avfilter.h" diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c index 4deb14a53d..5250695f3f 100644 --- a/libavfilter/vf_hflip.c +++ b/libavfilter/vf_hflip.c @@ -27,7 +27,7 @@ #include "avfilter.h" #include "libavutil/pixdesc.h" #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" typedef struct { int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index a170e817a2..0eb24b9682 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -29,7 +29,7 @@ #include "libavutil/eval.h" #include "libavutil/avstring.h" #include "libavutil/pixdesc.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "internal.h" static const char *var_names[] = { diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 467db5bf68..7413071913 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -28,8 +28,8 @@ #include "libavutil/pixdesc.h" #include "libavutil/colorspace.h" #include "libavutil/avassert.h" -#include "libavcore/imgutils.h" -#include "libavcore/parseutils.h" +#include "libavutil/imgutils.h" +#include "libavutil/parseutils.h" enum { RED = 0, GREEN, BLUE, ALPHA }; diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index 272b17ff1a..ed91aaade5 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -27,7 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/pixdesc.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avfilter.h" typedef struct { diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c index 74d9bf6201..3c48a71c71 100644 --- a/libavfilter/vsrc_buffer.c +++ b/libavfilter/vsrc_buffer.c @@ -25,7 +25,7 @@ #include "avfilter.h" #include "vsrc_buffer.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" typedef struct { int64_t pts; diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c index 4fd56febad..fac30f9a2f 100644 --- a/libavfilter/vsrc_movie.c +++ b/libavfilter/vsrc_movie.c @@ -33,7 +33,7 @@ #include #include "libavutil/avstring.h" #include "libavutil/opt.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "libavformat/avformat.h" #include "avfilter.h" diff --git a/libavfilter/vsrc_nullsrc.c b/libavfilter/vsrc_nullsrc.c index 1cd06e13f3..487aa50069 100644 --- a/libavfilter/vsrc_nullsrc.c +++ b/libavfilter/vsrc_nullsrc.c @@ -23,7 +23,7 @@ #include "libavutil/avstring.h" #include "libavutil/eval.h" -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" #include "avfilter.h" static const char *var_names[] = { diff --git a/libavformat/Makefile b/libavformat/Makefile index 1d4e75e75c..f319031c26 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -1,7 +1,7 @@ include $(SUBDIR)../config.mak NAME = avformat -FFLIBS = avcodec avcore avutil +FFLIBS = avcodec avutil HEADERS = avformat.h avio.h version.h diff --git a/libavformat/aea.c b/libavformat/aea.c index 8a508ec50a..16a11c86af 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -23,7 +23,7 @@ #include "avformat.h" #include "pcm.h" #include "libavutil/intreadwrite.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #define AT1_SU_SIZE 212 diff --git a/libavformat/flic.c b/libavformat/flic.c index 2e03c3b3a1..5942f721dc 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -32,8 +32,8 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/audioconvert.h" #include "avformat.h" -#include "libavcore/audioconvert.h" #define FLIC_FILE_MAGIC_1 0xAF11 #define FLIC_FILE_MAGIC_2 0xAF12 diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index a288c7f85f..1d0dc38ca8 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -26,7 +26,7 @@ #include "avc.h" #include "flacenc.h" #include "avlanguage.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #include "libavutil/intreadwrite.h" #include "libavutil/random_seed.h" #include "libavutil/lfg.h" diff --git a/libavformat/utils.c b/libavformat/utils.c index 2303244d4c..225b9f22da 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3341,7 +3341,7 @@ void dump_format(AVFormatContext *ic, } #if FF_API_PARSE_FRAME_PARAM -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" int parse_image_size(int *width_ptr, int *height_ptr, const char *str) { diff --git a/libavformat/wv.c b/libavformat/wv.c index 182f900f36..c9a1f0ed9c 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -19,11 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/audioconvert.h" #include "libavutil/intreadwrite.h" #include "avformat.h" #include "apetag.h" #include "id3v1.h" -#include "libavcore/audioconvert.h" // specs say that maximum block size is 1Mb #define WV_BLOCK_LIMIT 1047576 diff --git a/libavutil/Makefile b/libavutil/Makefile index fe0302c3b4..300acb1896 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -4,6 +4,7 @@ NAME = avutil HEADERS = adler32.h \ attributes.h \ + audioconvert.h \ avassert.h \ avstring.h \ avutil.h \ @@ -16,6 +17,7 @@ HEADERS = adler32.h \ eval.h \ fifo.h \ file.h \ + imgutils.h \ intfloat_readwrite.h \ intreadwrite.h \ lfg.h \ @@ -25,16 +27,19 @@ HEADERS = adler32.h \ md5.h \ mem.h \ opt.h \ + parseutils.h \ pixdesc.h \ pixfmt.h \ random_seed.h \ rational.h \ + samplefmt.h \ sha1.h \ BUILT_HEADERS = avconfig.h OBJS = adler32.o \ aes.o \ + audioconvert.o \ avstring.o \ base64.o \ cpu.o \ @@ -44,6 +49,7 @@ OBJS = adler32.o \ eval.o \ fifo.o \ file.o \ + imgutils.o \ intfloat_readwrite.o \ inverse.o \ lfg.o \ @@ -54,10 +60,12 @@ OBJS = adler32.o \ md5.o \ mem.o \ opt.o \ + parseutils.o \ pixdesc.o \ random_seed.o \ rational.o \ rc4.o \ + samplefmt.o \ sha.o \ tree.o \ utils.o \ diff --git a/libavcore/audioconvert.c b/libavutil/audioconvert.c similarity index 99% rename from libavcore/audioconvert.c rename to libavutil/audioconvert.c index c7207338a4..8bc43f8936 100644 --- a/libavcore/audioconvert.c +++ b/libavutil/audioconvert.c @@ -23,6 +23,7 @@ * audio conversion routines */ +#include "libavutil/avutil.h" #include "libavutil/avstring.h" #include "audioconvert.h" diff --git a/libavcore/audioconvert.h b/libavutil/audioconvert.h similarity index 97% rename from libavcore/audioconvert.h rename to libavutil/audioconvert.h index 89e9c55d17..134c6107c9 100644 --- a/libavcore/audioconvert.h +++ b/libavutil/audioconvert.h @@ -19,16 +19,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCORE_AUDIOCONVERT_H -#define AVCORE_AUDIOCONVERT_H +#ifndef AVUTIL_AUDIOCONVERT_H +#define AVUTIL_AUDIOCONVERT_H + +#include /** * @file * audio conversion routines */ -#include "avcore.h" - /* Audio channel masks */ #define AV_CH_FRONT_LEFT 0x00000001 #define AV_CH_FRONT_RIGHT 0x00000002 @@ -92,4 +92,4 @@ void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int6 */ int av_get_channel_layout_nb_channels(int64_t channel_layout); -#endif /* AVCORE_AUDIOCONVERT_H */ +#endif /* AVUTIL_AUDIOCONVERT_H */ diff --git a/libavutil/avutil.h b/libavutil/avutil.h index d6338a7689..7d1d4ccd0f 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -40,7 +40,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 50 -#define LIBAVUTIL_VERSION_MINOR 37 +#define LIBAVUTIL_VERSION_MINOR 38 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -93,6 +93,18 @@ enum AVMediaType { #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove +#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) +#define AV_TIME_BASE 1000000 +#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} + +/** + * 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 (LIBAVUTIL_VERSION_MAJOR < 51) +#endif + #include "common.h" #include "error.h" #include "mathematics.h" diff --git a/libavcore/imgutils.c b/libavutil/imgutils.c similarity index 100% rename from libavcore/imgutils.c rename to libavutil/imgutils.c diff --git a/libavcore/imgutils.h b/libavutil/imgutils.h similarity index 96% rename from libavcore/imgutils.h rename to libavutil/imgutils.h index 6c39d53119..c181863579 100644 --- a/libavcore/imgutils.h +++ b/libavutil/imgutils.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCORE_IMGUTILS_H -#define AVCORE_IMGUTILS_H +#ifndef AVUTIL_IMGUTILS_H +#define AVUTIL_IMGUTILS_H /** * @file @@ -25,7 +25,7 @@ */ #include "libavutil/pixdesc.h" -#include "avcore.h" +#include "avutil.h" /** * Compute the max pixel step for each plane of an image with a @@ -125,6 +125,8 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], */ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); +int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt); + #if FF_API_OLD_IMAGE_NAMES attribute_deprecated void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], @@ -144,4 +146,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 */ +#endif /* AVUTIL_IMGUTILS_H */ diff --git a/libavcore/parseutils.c b/libavutil/parseutils.c similarity index 99% rename from libavcore/parseutils.c rename to libavutil/parseutils.c index abf0422ff4..09eebcf56f 100644 --- a/libavcore/parseutils.c +++ b/libavutil/parseutils.c @@ -18,7 +18,7 @@ /** * @file - * misc parsing utilities for libavcore + * misc parsing utilities */ #include diff --git a/libavcore/parseutils.h b/libavutil/parseutils.h similarity index 95% rename from libavcore/parseutils.h rename to libavutil/parseutils.h index 052427bbfd..2c99872289 100644 --- a/libavcore/parseutils.h +++ b/libavutil/parseutils.h @@ -16,14 +16,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCORE_PARSEUTILS_H -#define AVCORE_PARSEUTILS_H +#ifndef AVUTIL_PARSEUTILS_H +#define AVUTIL_PARSEUTILS_H #include "libavutil/rational.h" /** * @file - * misc parsing utilities for libavcore + * misc parsing utilities */ /** @@ -72,4 +72,4 @@ int av_parse_video_rate(AVRational *rate, const char *str); int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx); -#endif /* AVCORE_PARSEUTILS_H */ +#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/libavcore/samplefmt.c b/libavutil/samplefmt.c similarity index 97% rename from libavcore/samplefmt.c rename to libavutil/samplefmt.c index 532acd9507..c9ffd1ac55 100644 --- a/libavcore/samplefmt.c +++ b/libavutil/samplefmt.c @@ -16,9 +16,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcore.h" #include "samplefmt.h" +#include +#include +#include + typedef struct SampleFmtInfo { const char *name; int bits; diff --git a/libavcore/samplefmt.h b/libavutil/samplefmt.h similarity index 93% rename from libavcore/samplefmt.h rename to libavutil/samplefmt.h index 9701efe7be..0604580a7a 100644 --- a/libavcore/samplefmt.h +++ b/libavutil/samplefmt.h @@ -16,10 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCORE_SAMPLEFMT_H -#define AVCORE_SAMPLEFMT_H - -#include "avcore.h" +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H /** * all in native-endian format @@ -31,7 +29,7 @@ enum AVSampleFormat { 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 + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically }; /** @@ -69,4 +67,4 @@ char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat samp */ int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); -#endif /* AVCORE_SAMPLEFMT_H */ +#endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/libswscale/Makefile b/libswscale/Makefile index 8c5c4b9da4..6976079686 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -20,4 +20,3 @@ TESTPROGS = colorspace swscale DIRS = bfin mlib ppc sparc x86 include $(SUBDIR)../subdir.mak -$(SUBDIR)swscale-test$(EXESUF): ELIBS = -lavcore diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c index bd24f3e006..7f171ea725 100644 --- a/libswscale/swscale-test.c +++ b/libswscale/swscale-test.c @@ -25,7 +25,7 @@ #include #undef HAVE_AV_CONFIG_H -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "libavutil/mem.h" #include "libavutil/avutil.h" #include "libavutil/crc.h" From 9ac2085dbf1821b7995fe360038c1bf0f3940032 Mon Sep 17 00:00:00 2001 From: Max Shakhmetov Date: Tue, 15 Feb 2011 17:49:27 +0100 Subject: [PATCH 372/528] os_support: fix poll() implementation Our poll implementation does not iterate over the pollfd array properly while setting the revents. Signed-off-by: Luca Barbato --- libavformat/os_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/os_support.c b/libavformat/os_support.c index 4f73011d65..0b7b59e77d 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -292,7 +292,7 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout) if (rc < 0) return rc; - for(i = 0; i < (nfds_t) n; i++) { + for(i = 0; i < numfds; i++) { fds[i].revents = 0; if (FD_ISSET(fds[i].fd, &read_set)) fds[i].revents |= POLLIN; From 50d7140441b61809ad4ba4ea7b4ad8fe77bc6888 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 15 Feb 2011 18:46:56 +0000 Subject: [PATCH 373/528] ac3enc: change default floor code to 7. This is to match the value in every (E-)AC-3 file from commercial sources. It has a negligible effect on audio quality. Signed-off-by: Mans Rullgard --- libavcodec/ac3enc.c | 2 +- tests/ref/acodec/ac3_fixed | 2 +- tests/ref/lavf/rm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index c15fd5109c..72a6c89288 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -752,7 +752,7 @@ static void bit_alloc_init(AC3EncodeContext *s) s->fast_decay_code = 1; s->slow_gain_code = 1; s->db_per_bit_code = 3; - s->floor_code = 4; + s->floor_code = 7; for (ch = 0; ch < s->channels; ch++) s->fast_gain_code[ch] = 4; diff --git a/tests/ref/acodec/ac3_fixed b/tests/ref/acodec/ac3_fixed index 5c75ecd074..7923d7175a 100644 --- a/tests/ref/acodec/ac3_fixed +++ b/tests/ref/acodec/ac3_fixed @@ -1,2 +1,2 @@ -37e119c644ba0472c079d0e907bf78df *./tests/data/acodec/ac3.rm +f8eddf3c4e119bcb2aa89a76d7461259 *./tests/data/acodec/ac3.rm 98751 ./tests/data/acodec/ac3.rm diff --git a/tests/ref/lavf/rm b/tests/ref/lavf/rm index c26dd0a28c..b8bf220778 100644 --- a/tests/ref/lavf/rm +++ b/tests/ref/lavf/rm @@ -1,2 +1,2 @@ -b97899ef2812cd1c8851dea550e042e4 *./tests/data/lavf/lavf.rm +d149fc272dfd21fb8908ee21d7b1651b *./tests/data/lavf/lavf.rm 346706 ./tests/data/lavf/lavf.rm From ec25f83bd98e10c023e6c7b07da1dcfc4d80cefc Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sun, 13 Feb 2011 17:18:07 +0100 Subject: [PATCH 374/528] spdifenc: update 482d98f69b2eb7a7b0b5054101a43db384e9432b to the latest patch "spdifenc: IEC 61937 encapsulation of DTS-HD for HDMI" --- libavformat/spdifenc.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index adc245a331..da74dd8e8f 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -142,24 +142,15 @@ static int spdif_header_eac3(AVFormatContext *s, AVPacket *pkt) * the outputted IEC 61937 stream is higher. * The repetition period is measured in IEC 60958 frames (4 bytes). */ -enum { - DTS4_REP_PER_512 = 0x0, - DTS4_REP_PER_1024 = 0x1, - DTS4_REP_PER_2048 = 0x2, - DTS4_REP_PER_4096 = 0x3, - DTS4_REP_PER_8192 = 0x4, - DTS4_REP_PER_16384 = 0x5, -}; - static int spdif_dts4_subtype(int period) { switch (period) { - case 512: return DTS4_REP_PER_512; - case 1024: return DTS4_REP_PER_1024; - case 2048: return DTS4_REP_PER_2048; - case 4096: return DTS4_REP_PER_4096; - case 8192: return DTS4_REP_PER_8192; - case 16384: return DTS4_REP_PER_16384; + case 512: return 0x0; + case 1024: return 0x1; + case 2048: return 0x2; + case 4096: return 0x3; + case 8192: return 0x4; + case 16384: return 0x5; } return -1; } @@ -212,7 +203,8 @@ static int spdif_header_dts4(AVFormatContext *s, AVPacket *pkt, int core_size, if (ctx->dtshd_fallback > 0) ctx->dtshd_skip = sample_rate * ctx->dtshd_fallback / (blocks << 5); else - /* skip permanently (-1) or just once (0) */ + /* skip permanently (dtshd_fallback == -1) or just once + * (dtshd_fallback == 0) */ ctx->dtshd_skip = 1; } if (ctx->dtshd_skip && core_size) { @@ -224,8 +216,7 @@ static int spdif_header_dts4(AVFormatContext *s, AVPacket *pkt, int core_size, ctx->out_bytes = sizeof(dtshd_start_code) + 2 + pkt_size; ctx->length_code = ctx->out_bytes; - ctx->hd_buf = av_fast_realloc(ctx->hd_buf, &ctx->hd_buf_size, - ctx->out_bytes); + av_fast_malloc(&ctx->hd_buf, &ctx->hd_buf_size, ctx->out_bytes); if (!ctx->hd_buf) return AVERROR(ENOMEM); From 5d820db2f9c396373f2293e6b41944093a4766d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sat, 29 Jan 2011 13:53:14 +0100 Subject: [PATCH 375/528] Document that av_write_header sets stream time_base to a value of it chosing. Signed-off-by: Janne Grunau --- libavformat/avformat.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 8fb77f958c..afcf5b0d11 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -510,6 +510,8 @@ typedef struct AVStream { * This is the fundamental unit of time (in seconds) in terms * of which frame timestamps are represented. For fixed-fps content, * time base should be 1/framerate and timestamp increments should be 1. + * decoding: set by libavformat + * encoding: set by libavformat in av_write_header */ AVRational time_base; int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ @@ -1380,6 +1382,8 @@ void av_url_split(char *proto, int proto_size, /** * Allocate the stream private data and write the stream header to an * output media file. + * @note: this sets stream time-bases, if possible to stream->codec->time_base + * but for some formats it might also be some other time base * * @param s media file handle * @return 0 if OK, AVERROR_xxx on error From 54955283655f918db4e9c8ec5a254f06a10646a6 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 14 Feb 2011 10:59:14 +0100 Subject: [PATCH 376/528] Apply minor cosmetics fixes to the av_audio_resample_init() doxy. Signed-off-by: Michael Niedermayer Signed-off-by: Janne Grunau --- libavcodec/avcodec.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 84c3b6fc79..3cc212f7cd 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3222,8 +3222,9 @@ typedef struct ReSampleContext ReSampleContext; attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate); #endif + /** - * Initialize audio resampling context + * Initialize audio resampling context. * * @param output_channels number of output channels * @param input_channels number of input channels @@ -3231,9 +3232,9 @@ attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, i * @param input_rate input sample rate * @param sample_fmt_out requested output sample format * @param sample_fmt_in input sample format - * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency * @param log2_phase_count log2 of the number of entries in the polyphase filterbank - * @param linear If 1 then the used FIR filter will be linearly interpolated + * @param linear if 1 then the used FIR filter will be linearly interpolated between the 2 closest, if 0 the closest will be used * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate * @return allocated ReSampleContext, NULL if error occured From 938b62538a719785bce0f1d49d3065937b29e3aa Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 14 Feb 2011 10:59:25 +0100 Subject: [PATCH 377/528] Document audio_resample_close(). Signed-off-by: Janne Grunau --- libavcodec/avcodec.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3cc212f7cd..86519387a9 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3247,6 +3247,13 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int linear, double cutoff); int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); + +/** + * Free resample context. + * + * @param s a non-NULL pointer to a resample context previously + * created with av_audio_resample_init() + */ void audio_resample_close(ReSampleContext *s); From 22ec6b738f1608e4b959fb655cf37c3343ec7e9f Mon Sep 17 00:00:00 2001 From: Balint Marton Date: Wed, 16 Feb 2011 00:17:13 +0000 Subject: [PATCH 378/528] Fix av_find_best_stream when using a program The current implementation has a bug, it is returning the stream index in the found program, and not the stream index in the list of all streams. The attached patch fixes this issue. Signed-off-by: Mans Rullgard --- libavformat/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 225b9f22da..be4d6f78af 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2529,7 +2529,7 @@ int av_find_best_stream(AVFormatContext *ic, if (best_count >= st->codec_info_nb_frames) continue; best_count = st->codec_info_nb_frames; - ret = i; + ret = program ? program[i] : i; best_decoder = decoder; if (program && i == nb_streams - 1 && ret < 0) { program = NULL; From 41cdc1ff1e86f1bfb935e1bde53ccc9c645ff71e Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko Date: Wed, 16 Feb 2011 09:52:44 +0200 Subject: [PATCH 379/528] fix nsvdec.c compilation if DEBUG macro defined Signed-off-by: Ronald S. Bultje --- libavformat/nsvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 9bf5636e5b..d20b226f2e 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -737,7 +737,7 @@ static int nsv_read_close(AVFormatContext *s) static int nsv_probe(AVProbeData *p) { int i; - av_dlog(s, "nsv_probe(), buf_size %d\n", p->buf_size); + av_dlog(NULL, "nsv_probe(), buf_size %d\n", p->buf_size); /* check file header */ /* streamed files might not have any header */ if (p->buf[0] == 'N' && p->buf[1] == 'S' && From 1f004fc512babe8215e2aa31fa4770aa27812cab Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 16 Feb 2011 14:04:04 -0500 Subject: [PATCH 380/528] ac3dsp: Change punpckhqdq to movhlps in ac3_max_msb_abs_int16(). Signed-off-by: Ronald S. Bultje --- libavcodec/x86/ac3dsp.asm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm index dc71ccf91c..b1eeca9cd2 100644 --- a/libavcodec/x86/ac3dsp.asm +++ b/libavcodec/x86/ac3dsp.asm @@ -110,8 +110,7 @@ cglobal ac3_max_msb_abs_int16_%1, 2,2,5, src, len por m2, m3 %endif %ifidn mmsize, 16 - mova m0, m2 - punpckhqdq m0, m0 + movhlps m0, m2 por m2, m0 %endif PSHUFLW m0, m2, 0xe From 2e3c56a29f241c207123e0195a6e1ce549559947 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 12 Feb 2011 15:29:10 +0100 Subject: [PATCH 381/528] Set maximum lowres value for the MJPEG decoder to 3. While 4 works for some samples, 3 is the correct value since 8x8 DCT is used by (m)jpeg. Signed-off-by: Janne Grunau --- libavcodec/mjpegdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 69a1837472..d0fc524471 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1547,7 +1547,7 @@ AVCodec ff_mjpeg_decoder = { ff_mjpeg_decode_frame, CODEC_CAP_DR1, NULL, - .max_lowres = 4, + .max_lowres = 3, .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"), }; From 50a82c2c754ff9df7b918d2bad90e46d5a00063a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 16 Feb 2011 02:09:46 +0100 Subject: [PATCH 382/528] vbv_delay AVOption for ABI compatibility Signed-off-by: Michael Niedermayer Signed-off-by: Janne Grunau --- libavcodec/options.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/options.c b/libavcodec/options.c index 57e0804ce5..e4bc8a6226 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -435,6 +435,7 @@ 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"}, +{"vbv_delay", "initial buffer fill time in periods of 27Mhz clock", 0, FF_OPT_TYPE_INT64, 0, 0, INT64_MAX}, {NULL}, }; From 6c60fcf89afc84c9dc863669d78e611d7c72fe41 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 14 Feb 2011 19:19:30 +0200 Subject: [PATCH 383/528] spdifenc: set flag AVFMT_NOTIMESTAMPS There are no timestamps in IEC 61937. Signed-off-by: Janne Grunau --- libavformat/spdifenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index da74dd8e8f..7c6591ae48 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -545,5 +545,6 @@ AVOutputFormat ff_spdif_muxer = { spdif_write_header, spdif_write_packet, spdif_write_trailer, + .flags = AVFMT_NOTIMESTAMPS, .priv_class = &class, }; From 009026efb1e3b3a5f05fd9934019a6300b25f364 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 13 Feb 2011 22:50:47 +0100 Subject: [PATCH 384/528] In graph2dot, print more specific audio information for audio links. Signed-off-by: Janne Grunau --- tools/graph2dot.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/graph2dot.c b/tools/graph2dot.c index 5e0da9a516..b67e597098 100644 --- a/tools/graph2dot.c +++ b/tools/graph2dot.c @@ -22,6 +22,7 @@ #undef HAVE_AV_CONFIG_H #include "libavutil/pixdesc.h" +#include "libavutil/audioconvert.h" #include "libavfilter/avfiltergraph.h" static void usage(void) @@ -67,10 +68,18 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph) 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 tb:%d/%d\" ];\n", - link->type == AVMEDIA_TYPE_VIDEO ? av_pix_fmt_descriptors[link->format].name : - link->type == AVMEDIA_TYPE_AUDIO ? av_get_sample_fmt_name(link->format) : "unknown", - link->w, link->h, link->time_base.num, link->time_base.den); + if (link->type == AVMEDIA_TYPE_VIDEO) { + fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ]", + av_pix_fmt_descriptors[link->format].name, + link->w, link->h, link->time_base.num, link->time_base.den); + } else if (link->type == AVMEDIA_TYPE_AUDIO) { + char buf[255]; + av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout); + fprintf(outfile, " [ label= \"fmt:%s sr:%"PRId64" cl:%s\" ]", + av_get_sample_fmt_name(link->format), + link->sample_rate, buf); + } + fprintf(outfile, ";\n"); } } } From 0fa904c9d845d4a47372e619067e21991bb39b06 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 11 Feb 2011 16:02:45 -0800 Subject: [PATCH 385/528] documentation: add encoders chapter Signed-off-by: Janne Grunau --- doc/encoders.texi | 20 ++++++++++++++++++++ doc/ffmpeg.texi | 1 + 2 files changed, 21 insertions(+) create mode 100644 doc/encoders.texi diff --git a/doc/encoders.texi b/doc/encoders.texi new file mode 100644 index 0000000000..cab98fb0bd --- /dev/null +++ b/doc/encoders.texi @@ -0,0 +1,20 @@ +@chapter Encoders +@c man begin ENCODERS + +Encoders are configured elements in FFmpeg which allow the encoding of +multimedia streams. + +When you configure your FFmpeg build, all the supported native encoders +are enabled by default. Encoders requiring an external library must be enabled +manually via the corresponding @code{--enable-lib} option. You can list all +available encoders using the configure option @code{--list-encoders}. + +You can disable all the encoders with the configure option +@code{--disable-encoders} and selectively enable / disable single encoders +with the options @code{--enable-encoder=@var{ENCODER}} / +@code{--disable-encoder=@var{ENCODER}}. + +The option @code{-codecs} of the ff* tools will display the list of +enabled encoders. + +@c man end ENCODERS diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 8b8e42f1f6..f0f3b65084 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -981,6 +981,7 @@ file to which you want to add them. @c man end EXAMPLES @include eval.texi +@include encoders.texi @include demuxers.texi @include muxers.texi @include indevs.texi From 6741f7c9be4913e084ad067571f3f29853ec5d5a Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Wed, 16 Feb 2011 14:53:08 +0100 Subject: [PATCH 386/528] ffserver: set the sample aspect ratio Hi. It seems that ffserver sets sample_aspect_ratio to an invalid value and lavf rejects it. I am not sure what I am doing here, but the attached patch actually solves something: using the following config: CustomLog - NoDaemon RTSPPort 5454 Format rtp File "/tmp/test1-rtsp.mpg" it allows a somewhat old ffplay (unaffected by the content-base issue I spoke of in another thread) to play the stream. Without it, ffserver logs this and closes the stream: Wed Feb 16 14:52:14 2011 [rtp @ 0x1399de0]Aspect ratio mismatch between encoder and muxer layer Regards, -- Nicolas George From 1b89c3c2164335060e87567b27deb0d354e0a814 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Wed, 16 Feb 2011 14:44:31 +0100 Subject: [PATCH] ffserver: set the sample aspect ratio. Signed-off-by: Nicolas George --- ffserver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffserver.c b/ffserver.c index cbf04aa4a5..58d4112352 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3487,7 +3487,7 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop fst->priv_data = av_mallocz(sizeof(FeedData)); fst->index = stream->nb_streams; av_set_pts_info(fst, 33, 1, 90000); - fst->sample_aspect_ratio = (AVRational){0,1}; + fst->sample_aspect_ratio = codec->sample_aspect_ratio; stream->streams[stream->nb_streams++] = fst; return fst; } From 2c35a6bde95a382e2d48570255deb67a7633fa46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 16 Feb 2011 14:35:47 +0200 Subject: [PATCH 387/528] rtsp: udp_read_packet returning 0 doesn't mean success If udp_read_packet returns 0, rtsp_st isn't set and we shouldn't treat it as a successfully received packet (which is counted and possibly triggers a RTCP receiver report). This fixes issue 2612. --- libavformat/rtsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 41427ae08e..d828c8d09b 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1681,7 +1681,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) case RTSP_LOWER_TRANSPORT_UDP: case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: 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) + if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP) rtp_check_and_send_back_rr(rtsp_st->transport_priv, len); break; } From 610219a598095f938705f200dfe3946455ef871a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 16 Feb 2011 08:52:35 +0000 Subject: [PATCH 388/528] lavf: add av_ prefix to dump_format() Signed-off-by: Mans Rullgard --- ffmpeg.c | 10 +++++----- ffplay.c | 2 +- ffprobe.c | 2 +- libavformat/avformat.h | 15 +++++++++++---- libavformat/movenchint.c | 2 +- libavformat/output-example.c | 2 +- libavformat/utils.c | 10 ++++++++++ libavformat/version.h | 3 +++ 8 files changed, 33 insertions(+), 13 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 1cad57d809..185ca19a2b 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1977,7 +1977,7 @@ static int transcode(AVFormatContext **output_files, for(i=0;inb_streams && !(os->oformat->flags & AVFMT_NOSTREAMS)) { - dump_format(output_files[i], i, output_files[i]->filename, 1); + av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Output file #%d does not contain any stream\n", i); ret = AVERROR(EINVAL); goto fail; @@ -2028,7 +2028,7 @@ static int transcode(AVFormatContext **output_files, /* Sanity check that the stream types match */ if (ist_table[ost->source_index]->st->codec->codec_type != ost->st->codec->codec_type) { int i= ost->file_index; - dump_format(output_files[i], i, output_files[i]->filename, 1); + av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n", stream_maps[n].file_index, stream_maps[n].stream_index, ost->file_index, ost->index); @@ -2079,7 +2079,7 @@ static int transcode(AVFormatContext **output_files, } if (!found) { int i= ost->file_index; - dump_format(output_files[i], i, output_files[i]->filename, 1); + av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n", ost->file_index, ost->index); ffmpeg_exit(1); @@ -2459,7 +2459,7 @@ static int transcode(AVFormatContext **output_files, /* dump the file output parameters - cannot be done before in case of stream copy */ for(i=0;ifilename, 1); + av_dump_format(output_files[i], i, output_files[i]->filename, 1); } /* dump the stream mapping */ @@ -3309,7 +3309,7 @@ static void opt_input_file(const char *filename) input_files_ts_offset[nb_input_files] = input_ts_offset - (copy_ts ? 0 : timestamp); /* dump the file content */ if (verbose >= 0) - dump_format(ic, nb_input_files, filename, 0); + av_dump_format(ic, nb_input_files, filename, 0); nb_input_files++; diff --git a/ffplay.c b/ffplay.c index b6343287ac..e71c9c932d 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2464,7 +2464,7 @@ static int decode_thread(void *arg) st_index[AVMEDIA_TYPE_VIDEO]), NULL, 0); if (show_status) { - dump_format(ic, 0, is->filename, 0); + av_dump_format(ic, 0, is->filename, 0); } /* open the streams */ diff --git a/ffprobe.c b/ffprobe.c index 2c99e5a6b9..94b1d9b2cf 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -277,7 +277,7 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) return err; } - dump_format(fmt_ctx, 0, filename, 0); + av_dump_format(fmt_ctx, 0, filename, 0); /* bind a decoder to each input stream */ for (i = 0; i < fmt_ctx->nb_streams; i++) { diff --git a/libavformat/avformat.h b/libavformat/avformat.h index afcf5b0d11..8752f07e07 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1450,10 +1450,17 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, */ int av_write_trailer(AVFormatContext *s); -void dump_format(AVFormatContext *ic, - int index, - const char *url, - int is_output); +#if FF_API_DUMP_FORMAT +attribute_deprecated void dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); +#endif + +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); #if FF_API_PARSE_FRAME_PARAM /** diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index 5b07aa6d4b..cdfb276131 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -57,7 +57,7 @@ fail: av_log(s, AV_LOG_WARNING, "Unable to initialize hinting of stream %d\n", src_index); av_freep(&track->enc); - /* Set a default timescale, to avoid crashes in dump_format */ + /* Set a default timescale, to avoid crashes in av_dump_format */ track->timescale = 90000; return ret; } diff --git a/libavformat/output-example.c b/libavformat/output-example.c index 06207eddfc..edb5c87243 100644 --- a/libavformat/output-example.c +++ b/libavformat/output-example.c @@ -481,7 +481,7 @@ int main(int argc, char **argv) exit(1); } - dump_format(oc, 0, filename, 1); + av_dump_format(oc, 0, filename, 1); /* now that all the parameters are set, we can open the audio and video codecs and allocate the necessary encode buffers */ diff --git a/libavformat/utils.c b/libavformat/utils.c index be4d6f78af..b325d06276 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3261,10 +3261,20 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out dump_metadata(NULL, st->metadata, " "); } +#if FF_API_DUMP_FORMAT void dump_format(AVFormatContext *ic, int index, const char *url, int is_output) +{ + av_dump_format(ic, index, url, is_output); +} +#endif + +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output) { int i; uint8_t *printed = av_mallocz(ic->nb_streams); diff --git a/libavformat/version.h b/libavformat/version.h index 4e26eaaebc..922dd89f1c 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -92,5 +92,8 @@ #ifndef FF_API_INDEX_BUILT #define FF_API_INDEX_BUILT (LIBAVFORMAT_VERSION_MAJOR < 53) #endif +#ifndef FF_API_DUMP_FORMAT +#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif //AVFORMAT_VERSION_H From f6c7375a175ac649558aefab14f3895b2cb469aa Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Wed, 16 Feb 2011 08:52:36 +0000 Subject: [PATCH 389/528] Deprecate parse_date() in favor of av_parse_time(). The new av_parse_time() is created in libavutil/parseutils.h, all the internal functions used by parse_date are moved to libavutil/parseutils.c and made static. Signed-off-by: Mans Rullgard --- cmdutils.c | 5 +- libavformat/avformat.h | 29 ++--- libavformat/cutils.c | 110 ------------------- libavformat/internal.h | 3 - libavformat/utils.c | 124 ++------------------- libavformat/version.h | 3 + libavutil/parseutils.c | 237 +++++++++++++++++++++++++++++++++++++++++ libavutil/parseutils.h | 34 ++++++ 8 files changed, 291 insertions(+), 254 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index 9809d2fe8a..514ebadb6e 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -35,6 +35,7 @@ #include "libswscale/swscale.h" #include "libpostproc/postprocess.h" #include "libavutil/avstring.h" +#include "libavutil/parseutils.h" #include "libavutil/pixdesc.h" #include "libavutil/eval.h" #include "libavcodec/opt.h" @@ -113,8 +114,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration) { - int64_t us = parse_date(timestr, is_duration); - if (us == INT64_MIN) { + int64_t us; + if (av_parse_time(&us, timestr, is_duration) < 0) { fprintf(stderr, "Invalid %s specification for %s: %s\n", is_duration ? "duration" : "date", context, timestr); exit(1); diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 8752f07e07..7d69f510b0 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1478,34 +1478,17 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base, const char *arg); #endif +#if FF_API_PARSE_DATE /** * Parse datestr and return a corresponding number of microseconds. + * * @param datestr String representing a date or a duration. - * - If a date the syntax is: - * @code - * now|{[{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z|z]} - * @endcode - * If the value is "now" it takes the current time. - * Time is local time unless Z is appended, in which case it is - * interpreted as UTC. - * If the year-month-day part is not specified it takes the current - * year-month-day. - * @return the number of microseconds since 1st of January, 1970 up to - * the time of the parsed date or INT64_MIN if datestr cannot be - * successfully parsed. - * - If a duration the syntax is: - * @code - * [-]HH[:MM[:SS[.m...]]] - * [-]S+[.m...] - * @endcode - * @return the number of microseconds contained in a time interval - * with the specified duration or INT64_MIN if datestr cannot be - * successfully parsed. - * @param duration Flag which tells how to interpret datestr, if - * not zero datestr is interpreted as a duration, otherwise as a - * date. + * See av_parse_time() for the syntax of the provided string. + * @deprecated in favor of av_parse_time() */ +attribute_deprecated int64_t parse_date(const char *datestr, int duration); +#endif /** * Get the current time in microseconds. diff --git a/libavformat/cutils.c b/libavformat/cutils.c index c1b56139c0..e6578df2ce 100644 --- a/libavformat/cutils.c +++ b/libavformat/cutils.c @@ -42,25 +42,6 @@ void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem) *nb_ptr = nb; } -time_t mktimegm(struct tm *tm) -{ - time_t t; - - int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday; - - if (m < 3) { - m += 12; - y--; - } - - t = 86400 * - (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 719469); - - t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec; - - return t; -} - #define ISLEAP(y) (((y) % 4 == 0) && (((y) % 100) != 0 || ((y) % 400) == 0)) #define LEAPS_COUNT(y) ((y)/4 - (y)/100 + (y)/400) @@ -95,94 +76,3 @@ struct tm *brktimegm(time_t secs, struct tm *tm) return tm; } - -/* get a positive number between n_min and n_max, for a maximum length - of len_max. Return -1 if error. */ -static int date_get_num(const char **pp, - int n_min, int n_max, int len_max) -{ - int i, val, c; - const char *p; - - p = *pp; - val = 0; - for(i = 0; i < len_max; i++) { - c = *p; - if (!isdigit(c)) - break; - val = (val * 10) + c - '0'; - p++; - } - /* no number read ? */ - if (p == *pp) - return -1; - if (val < n_min || val > n_max) - return -1; - *pp = p; - return val; -} - -/* small strptime for ffmpeg */ -const char *small_strptime(const char *p, const char *fmt, - struct tm *dt) -{ - int c, val; - - for(;;) { - c = *fmt++; - if (c == '\0') { - return p; - } else if (c == '%') { - c = *fmt++; - switch(c) { - case 'H': - val = date_get_num(&p, 0, 23, 2); - if (val == -1) - return NULL; - dt->tm_hour = val; - break; - case 'M': - val = date_get_num(&p, 0, 59, 2); - if (val == -1) - return NULL; - dt->tm_min = val; - break; - case 'S': - val = date_get_num(&p, 0, 59, 2); - if (val == -1) - return NULL; - dt->tm_sec = val; - break; - case 'Y': - val = date_get_num(&p, 0, 9999, 4); - if (val == -1) - return NULL; - dt->tm_year = val - 1900; - break; - case 'm': - val = date_get_num(&p, 1, 12, 2); - if (val == -1) - return NULL; - dt->tm_mon = val - 1; - break; - case 'd': - val = date_get_num(&p, 1, 31, 2); - if (val == -1) - return NULL; - dt->tm_mday = val; - break; - case '%': - goto match; - default: - return NULL; - } - } else { - match: - if (c != *p) - return NULL; - p++; - } - } - return p; -} - diff --git a/libavformat/internal.h b/libavformat/internal.h index 2fdf61f938..16aa0af189 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -48,10 +48,7 @@ do {\ } while(0) #endif -time_t mktimegm(struct tm *tm); struct tm *brktimegm(time_t secs, struct tm *tm); -const char *small_strptime(const char *p, const char *fmt, - struct tm *dt); char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); diff --git a/libavformat/utils.c b/libavformat/utils.c index b325d06276..acac406bf6 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3380,124 +3380,16 @@ uint64_t ff_ntp_time(void) return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US; } -int64_t parse_date(const char *datestr, int duration) +#if FF_API_PARSE_DATE +#include "libavutil/parseutils.h" + +int64_t parse_date(const char *timestr, int duration) { - const char *p; - int64_t t; - struct tm dt; - int i; - static const char * const date_fmt[] = { - "%Y-%m-%d", - "%Y%m%d", - }; - static const char * const time_fmt[] = { - "%H:%M:%S", - "%H%M%S", - }; - const char *q; - int is_utc, len; - char lastch; - int negative = 0; - -#undef time - time_t now = time(0); - - len = strlen(datestr); - if (len > 0) - lastch = datestr[len - 1]; - else - lastch = '\0'; - is_utc = (lastch == 'z' || lastch == 'Z'); - - memset(&dt, 0, sizeof(dt)); - - p = datestr; - q = NULL; - if (!duration) { - if (!strncasecmp(datestr, "now", len)) - return (int64_t) now * 1000000; - - /* parse the year-month-day part */ - for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) { - q = small_strptime(p, date_fmt[i], &dt); - if (q) { - break; - } - } - - /* if the year-month-day part is missing, then take the - * current year-month-day time */ - if (!q) { - if (is_utc) { - dt = *gmtime(&now); - } else { - dt = *localtime(&now); - } - dt.tm_hour = dt.tm_min = dt.tm_sec = 0; - } else { - p = q; - } - - if (*p == 'T' || *p == 't' || *p == ' ') - p++; - - /* parse the hour-minute-second part */ - for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) { - q = small_strptime(p, time_fmt[i], &dt); - if (q) { - break; - } - } - } else { - /* parse datestr as a duration */ - if (p[0] == '-') { - negative = 1; - ++p; - } - /* parse datestr as HH:MM:SS */ - q = small_strptime(p, time_fmt[0], &dt); - if (!q) { - /* parse datestr as S+ */ - dt.tm_sec = strtol(p, (char **)&q, 10); - if (q == p) - /* the parsing didn't succeed */ - return INT64_MIN; - dt.tm_min = 0; - dt.tm_hour = 0; - } - } - - /* Now we have all the fields that we can get */ - if (!q) { - return INT64_MIN; - } - - if (duration) { - t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec; - } else { - dt.tm_isdst = -1; /* unknown */ - if (is_utc) { - t = mktimegm(&dt); - } else { - t = mktime(&dt); - } - } - - t *= 1000000; - - /* parse the .m... part */ - if (*q == '.') { - int val, n; - q++; - for (val = 0, n = 100000; n >= 1; n /= 10, q++) { - if (!isdigit(*q)) - break; - val += n * (*q - '0'); - } - t += val; - } - return negative ? -t : t; + int64_t timeval; + av_parse_time(&timeval, timestr, duration); + return timeval; } +#endif int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) { diff --git a/libavformat/version.h b/libavformat/version.h index 922dd89f1c..3663ec55b9 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -95,5 +95,8 @@ #ifndef FF_API_DUMP_FORMAT #define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_PARSE_DATE +#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif //AVFORMAT_VERSION_H diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index 09eebcf56f..8e09dade62 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -22,6 +22,8 @@ */ #include +#include +#include #include "parseutils.h" #include "libavutil/avutil.h" #include "libavutil/eval.h" @@ -371,6 +373,241 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, return 0; } +/* get a positive number between n_min and n_max, for a maximum length + of len_max. Return -1 if error. */ +static int date_get_num(const char **pp, + int n_min, int n_max, int len_max) +{ + int i, val, c; + const char *p; + + p = *pp; + val = 0; + for(i = 0; i < len_max; i++) { + c = *p; + if (!isdigit(c)) + break; + val = (val * 10) + c - '0'; + p++; + } + /* no number read ? */ + if (p == *pp) + return -1; + if (val < n_min || val > n_max) + return -1; + *pp = p; + return val; +} + +/* small strptime for ffmpeg */ +static +const char *small_strptime(const char *p, const char *fmt, + struct tm *dt) +{ + int c, val; + + for(;;) { + c = *fmt++; + if (c == '\0') { + return p; + } else if (c == '%') { + c = *fmt++; + switch(c) { + case 'H': + val = date_get_num(&p, 0, 23, 2); + if (val == -1) + return NULL; + dt->tm_hour = val; + break; + case 'M': + val = date_get_num(&p, 0, 59, 2); + if (val == -1) + return NULL; + dt->tm_min = val; + break; + case 'S': + val = date_get_num(&p, 0, 59, 2); + if (val == -1) + return NULL; + dt->tm_sec = val; + break; + case 'Y': + val = date_get_num(&p, 0, 9999, 4); + if (val == -1) + return NULL; + dt->tm_year = val - 1900; + break; + case 'm': + val = date_get_num(&p, 1, 12, 2); + if (val == -1) + return NULL; + dt->tm_mon = val - 1; + break; + case 'd': + val = date_get_num(&p, 1, 31, 2); + if (val == -1) + return NULL; + dt->tm_mday = val; + break; + case '%': + goto match; + default: + return NULL; + } + } else { + match: + if (c != *p) + return NULL; + p++; + } + } + return p; +} + +static time_t mktimegm(struct tm *tm) +{ + time_t t; + + int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday; + + if (m < 3) { + m += 12; + y--; + } + + t = 86400 * + (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 719469); + + t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec; + + return t; +} + +int av_parse_time(int64_t *timeval, const char *datestr, int duration) +{ + const char *p; + int64_t t; + struct tm dt; + int i; + static const char * const date_fmt[] = { + "%Y-%m-%d", + "%Y%m%d", + }; + static const char * const time_fmt[] = { + "%H:%M:%S", + "%H%M%S", + }; + const char *q; + int is_utc, len; + char lastch; + int negative = 0; + +#undef time + time_t now = time(0); + + len = strlen(datestr); + if (len > 0) + lastch = datestr[len - 1]; + else + lastch = '\0'; + is_utc = (lastch == 'z' || lastch == 'Z'); + + memset(&dt, 0, sizeof(dt)); + + p = datestr; + q = NULL; + if (!duration) { + if (!strncasecmp(datestr, "now", len)) { + *timeval = (int64_t) now * 1000000; + return 0; + } + + /* parse the year-month-day part */ + for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) { + q = small_strptime(p, date_fmt[i], &dt); + if (q) { + break; + } + } + + /* if the year-month-day part is missing, then take the + * current year-month-day time */ + if (!q) { + if (is_utc) { + dt = *gmtime(&now); + } else { + dt = *localtime(&now); + } + dt.tm_hour = dt.tm_min = dt.tm_sec = 0; + } else { + p = q; + } + + if (*p == 'T' || *p == 't' || *p == ' ') + p++; + + /* parse the hour-minute-second part */ + for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) { + q = small_strptime(p, time_fmt[i], &dt); + if (q) { + break; + } + } + } else { + /* parse datestr as a duration */ + if (p[0] == '-') { + negative = 1; + ++p; + } + /* parse datestr as HH:MM:SS */ + q = small_strptime(p, time_fmt[0], &dt); + if (!q) { + /* parse datestr as S+ */ + dt.tm_sec = strtol(p, (char **)&q, 10); + if (q == p) { + /* the parsing didn't succeed */ + *timeval = INT64_MIN; + return AVERROR(EINVAL); + } + dt.tm_min = 0; + dt.tm_hour = 0; + } + } + + /* Now we have all the fields that we can get */ + if (!q) { + *timeval = INT64_MIN; + return AVERROR(EINVAL); + } + + if (duration) { + t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec; + } else { + dt.tm_isdst = -1; /* unknown */ + if (is_utc) { + t = mktimegm(&dt); + } else { + t = mktime(&dt); + } + } + + t *= 1000000; + + /* parse the .m... part */ + if (*q == '.') { + int val, n; + q++; + for (val = 0, n = 100000; n >= 1; n /= 10, q++) { + if (!isdigit(*q)) + break; + val += n * (*q - '0'); + } + t += val; + } + *timeval = negative ? -t : t; + return 0; +} + #ifdef TEST #undef printf diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h index 2c99872289..517f125a63 100644 --- a/libavutil/parseutils.h +++ b/libavutil/parseutils.h @@ -72,4 +72,38 @@ int av_parse_video_rate(AVRational *rate, const char *str); int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx); +/** + * Parses timestr and returns in *time a corresponding number of + * microseconds. + * + * @param timeval puts here the number of microseconds corresponding + * to the string in timestr. If the string represents a duration, it + * is the number of microseconds contained in the time interval. If + * the string is a date, is the number of microseconds since 1st of + * January, 1970 up to the time of the parsed date. If timestr cannot + * be successfully parsed, set *time to INT64_MIN. + + * @param datestr a string representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z] + * now + * @endcode + * If the value is "now" it takes the current time. + * Time is local time unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part is not specified it takes the current + * year-month-day. + * - If a duration the syntax is: + * @code + * [-]HH[:MM[:SS[.m...]]] + * [-]S+[.m...] + * @endcode + * @param duration flag which tells how to interpret timestr, if not + * zero timestr is interpreted as a duration, otherwise as a date + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_parse_time(int64_t *timeval, const char *timestr, int duration); + #endif /* AVUTIL_PARSEUTILS_H */ From 9fcae9735e3b97366dcee9ca3c2f6cf4faf6756f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 16 Feb 2011 08:52:37 +0000 Subject: [PATCH 390/528] Replace remaining uses of parse_date with av_parse_time. Signed-off-by: Mans Rullgard --- ffserver.c | 10 ++++------ libavformat/rtsp.c | 5 +++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ffserver.c b/ffserver.c index 58d4112352..a2956d3df7 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2136,9 +2136,8 @@ static int open_input_stream(HTTPContext *c, const char *info) buf_size = FFM_PACKET_SIZE; /* compute position (absolute time) */ if (find_info_tag(buf, sizeof(buf), "date", info)) { - stream_pos = parse_date(buf, 0); - if (stream_pos == INT64_MIN) - return -1; + if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0) + return ret; } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) { int prebuffer = strtol(buf, 0, 10); stream_pos = av_gettime() - prebuffer * (int64_t)1000000; @@ -2149,9 +2148,8 @@ static int open_input_stream(HTTPContext *c, const char *info) buf_size = 0; /* compute position (relative time) */ if (find_info_tag(buf, sizeof(buf), "date", info)) { - stream_pos = parse_date(buf, 1); - if (stream_pos == INT64_MIN) - return -1; + if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0) + return ret; } else stream_pos = 0; } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index d828c8d09b..cee3d7e38b 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -22,6 +22,7 @@ #include "libavutil/base64.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" +#include "libavutil/parseutils.h" #include "libavutil/random_seed.h" #include "avformat.h" @@ -99,11 +100,11 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end) *end = AV_NOPTS_VALUE; get_word_sep(buf, sizeof(buf), "-", &p); - *start = parse_date(buf, 1); + av_parse_time(start, buf, 1); if (*p == '-') { p++; get_word_sep(buf, sizeof(buf), "-", &p); - *end = parse_date(buf, 1); + av_parse_time(end, buf, 1); } // av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start); // av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end); From 5b54d4b376fbd2c291b8a6dba7d425e28f654bcf Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 16 Feb 2011 00:30:24 +0000 Subject: [PATCH 391/528] ac3enc: fix bug in stereo rematrixing decision. The rematrixing strategy reuse flags are not reset between frames, so they need to be initialized for all blocks, not just block 0. Signed-off-by: Mans Rullgard --- libavcodec/ac3enc.c | 3 +-- tests/ref/acodec/ac3_fixed | 2 +- tests/ref/seek/ac3_rm | 30 ++++++++++++++++++++---------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 72a6c89288..02bc403f82 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -310,9 +310,9 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) nb_coefs = FFMIN(s->nb_coefs[0], s->nb_coefs[1]); - s->blocks[0].new_rematrixing_strategy = 1; for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { block = &s->blocks[blk]; + block->new_rematrixing_strategy = !blk; for (bnd = 0; bnd < 4; bnd++) { /* calculate calculate sum of squared coeffs for one band in one block */ int start = ff_ac3_rematrix_band_tab[bnd]; @@ -337,7 +337,6 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) /* determine if new rematrixing flags will be sent */ if (blk && - !block->new_rematrixing_strategy && block->rematrixing_flags[bnd] != block0->rematrixing_flags[bnd]) { block->new_rematrixing_strategy = 1; } diff --git a/tests/ref/acodec/ac3_fixed b/tests/ref/acodec/ac3_fixed index 7923d7175a..f32443d3fb 100644 --- a/tests/ref/acodec/ac3_fixed +++ b/tests/ref/acodec/ac3_fixed @@ -1,2 +1,2 @@ -f8eddf3c4e119bcb2aa89a76d7461259 *./tests/data/acodec/ac3.rm +07bd593823ebd721b3a32ef298bdfc20 *./tests/data/acodec/ac3.rm 98751 ./tests/data/acodec/ac3.rm diff --git a/tests/ref/seek/ac3_rm b/tests/ref/seek/ac3_rm index 7b7d5b0bf7..07fcfa1ec6 100644 --- a/tests/ref/seek/ac3_rm +++ b/tests/ref/seek/ac3_rm @@ -1,13 +1,17 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret:-1 st:-1 flags:1 ts: 1.894167 -ret:-1 st: 0 flags:0 ts: 0.788000 +ret: 0 st:-1 flags:1 ts: 1.894167 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 +ret: 0 st: 0 flags:0 ts: 0.788000 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret: 0 st: 0 flags:1 ts:-0.317000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret:-1 st:-1 flags:0 ts: 2.576668 +ret: 0 st:-1 flags:0 ts: 2.576668 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret:-1 st:-1 flags:1 ts: 1.470835 -ret:-1 st: 0 flags:0 ts: 0.365000 +ret: 0 st: 0 flags:0 ts: 0.365000 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret: 0 st: 0 flags:1 ts:-0.741000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st:-1 flags:0 ts: 2.153336 @@ -16,20 +20,26 @@ ret: 0 st: 0 flags:0 ts:-0.058000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st: 0 flags:1 ts: 2.836000 ret:-1 st:-1 flags:0 ts: 1.730004 -ret:-1 st:-1 flags:1 ts: 0.624171 +ret: 0 st:-1 flags:1 ts: 0.624171 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:0 ts:-0.482000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret:-1 st: 0 flags:1 ts: 2.413000 +ret: 0 st: 0 flags:1 ts: 2.413000 +ret: 0 st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos: 36705 size: 556 ret:-1 st:-1 flags:0 ts: 1.306672 -ret:-1 st:-1 flags:1 ts: 0.200839 +ret: 0 st:-1 flags:1 ts: 0.200839 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:0 ts:-0.905000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st: 0 flags:1 ts: 1.989000 -ret:-1 st:-1 flags:0 ts: 0.883340 +ret: 0 st:-1 flags:0 ts: 0.883340 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret: 0 st:-1 flags:1 ts:-0.222493 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret:-1 st: 0 flags:0 ts: 2.672000 +ret: 0 st: 0 flags:0 ts: 2.672000 +ret: 0 st: 0 flags:1 dts:6354.691000 pts:6354.691000 pos: 10783 size: 304 ret:-1 st: 0 flags:1 ts: 1.566000 -ret:-1 st:-1 flags:0 ts: 0.460008 +ret: 0 st:-1 flags:0 ts: 0.460008 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 From 979395bbbb9381b522b44c3448c24aef9c819ffc Mon Sep 17 00:00:00 2001 From: Young Han Lee Date: Thu, 17 Feb 2011 16:45:54 +0900 Subject: [PATCH 392/528] mdct: remove unnecessary multiplication 3*n4 was already calculated in n3. --- libavcodec/mdct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mdct.c b/libavcodec/mdct.c index 819f618115..31e2216dd3 100644 --- a/libavcodec/mdct.c +++ b/libavcodec/mdct.c @@ -202,7 +202,7 @@ void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input) /* pre rotation */ for(i=0;i Date: Wed, 16 Feb 2011 09:52:38 +0100 Subject: [PATCH 393/528] Move find_info_tag to lavu and add av_ prefix to it Signed-off-by: Janne Grunau --- ffserver.c | 6 +++--- libavformat/avformat.h | 9 ++++----- libavformat/rtpproto.c | 15 ++++++++------- libavformat/sapenc.c | 9 +++++---- libavformat/sdp.c | 3 ++- libavformat/udp.c | 15 ++++++++------- libavformat/utils.c | 40 +++++----------------------------------- libavformat/version.h | 3 +++ libavutil/parseutils.c | 39 +++++++++++++++++++++++++++++++++++++++ libavutil/parseutils.h | 8 ++++++++ 10 files changed, 85 insertions(+), 62 deletions(-) diff --git a/ffserver.c b/ffserver.c index a2956d3df7..20ba890e4d 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2135,10 +2135,10 @@ static int open_input_stream(HTTPContext *c, const char *info) strcpy(input_filename, c->stream->feed->feed_filename); buf_size = FFM_PACKET_SIZE; /* compute position (absolute time) */ - if (find_info_tag(buf, sizeof(buf), "date", info)) { + if (av_find_info_tag(buf, sizeof(buf), "date", info)) { if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0) return ret; - } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) { + } else if (av_find_info_tag(buf, sizeof(buf), "buffer", info)) { int prebuffer = strtol(buf, 0, 10); stream_pos = av_gettime() - prebuffer * (int64_t)1000000; } else @@ -2147,7 +2147,7 @@ static int open_input_stream(HTTPContext *c, const char *info) strcpy(input_filename, c->stream->feed_filename); buf_size = 0; /* compute position (relative time) */ - if (find_info_tag(buf, sizeof(buf), "date", info)) { + if (av_find_info_tag(buf, sizeof(buf), "date", info)) { if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0) return ret; } else diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 7d69f510b0..8511a0366e 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1501,13 +1501,12 @@ int64_t ffm_read_write_index(int fd); int ffm_write_write_index(int fd, int64_t pos); void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); +#if FF_API_FIND_INFO_TAG /** - * Attempt to find a specific tag in a URL. - * - * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. - * Return 1 if found. + * @deprecated use av_find_info_tag in libavutil instead. */ -int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); +attribute_deprecated int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); +#endif /** * Return in 'buf' the path with '%d' replaced by a number. diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index aa2cc37776..dd5bc71c0e 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -24,6 +24,7 @@ * RTP protocol */ +#include "libavutil/parseutils.h" #include "libavutil/avstring.h" #include "avformat.h" #include "rtpdec.h" @@ -161,25 +162,25 @@ static int rtp_open(URLContext *h, const char *uri, int flags) p = strchr(uri, '?'); if (p) { - if (find_info_tag(buf, sizeof(buf), "ttl", p)) { + if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) { ttl = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "rtcpport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "rtcpport", p)) { rtcp_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "localport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "localport", p)) { local_rtp_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "localrtpport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "localrtpport", p)) { local_rtp_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "localrtcpport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "localrtcpport", p)) { local_rtcp_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) { + if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) { max_packet_size = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "connect", p)) { + if (av_find_info_tag(buf, sizeof(buf), "connect", p)) { connect = strtol(buf, NULL, 10); } } diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 9bbacef680..91c1f628c7 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -20,6 +20,7 @@ */ #include "avformat.h" +#include "libavutil/parseutils.h" #include "libavutil/random_seed.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" @@ -87,16 +88,16 @@ static int sap_write_header(AVFormatContext *s) option_list = strrchr(path, '?'); if (option_list) { char buf[50]; - if (find_info_tag(buf, sizeof(buf), "announce_port", option_list)) { + if (av_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)) { + if (av_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)) { + if (av_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)) { + if (av_find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) { av_strlcpy(announce_addr, buf, sizeof(announce_addr)); } } diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 872e76c5ae..2a8821815a 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -21,6 +21,7 @@ #include #include "libavutil/avstring.h" #include "libavutil/base64.h" +#include "libavutil/parseutils.h" #include "libavcodec/xiph.h" #include "avformat.h" #include "internal.h" @@ -136,7 +137,7 @@ static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url) if (p) { char buff[64]; - if (find_info_tag(buff, sizeof(buff), "ttl", p)) { + if (av_find_info_tag(buff, sizeof(buff), "ttl", p)) { *ttl = strtol(buff, NULL, 10); } else { *ttl = 5; diff --git a/libavformat/udp.c b/libavformat/udp.c index 4c4db2a589..6c1b37b59d 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -27,6 +27,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 "libavutil/parseutils.h" #include #include "internal.h" #include "network.h" @@ -259,7 +260,7 @@ int udp_set_remote_url(URLContext *h, const char *uri) s->is_multicast = ff_is_multicast_address((struct sockaddr*) &s->dest_addr); p = strchr(uri, '?'); if (p) { - if (find_info_tag(buf, sizeof(buf), "connect", p)) { + if (av_find_info_tag(buf, sizeof(buf), "connect", p)) { int was_connected = s->is_connected; s->is_connected = strtol(buf, NULL, 10); if (s->is_connected && !was_connected) { @@ -330,7 +331,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) p = strchr(uri, '?'); if (p) { - if (find_info_tag(buf, sizeof(buf), "reuse", p)) { + if (av_find_info_tag(buf, sizeof(buf), "reuse", p)) { const char *endptr=NULL; s->reuse_socket = strtol(buf, &endptr, 10); /* assume if no digits were found it is a request to enable it */ @@ -338,19 +339,19 @@ static int udp_open(URLContext *h, const char *uri, int flags) s->reuse_socket = 1; reuse_specified = 1; } - if (find_info_tag(buf, sizeof(buf), "ttl", p)) { + if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) { s->ttl = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "localport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "localport", p)) { s->local_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) { + if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) { h->max_packet_size = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "buffer_size", p)) { + if (av_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)) { + if (av_find_info_tag(buf, sizeof(buf), "connect", p)) { s->is_connected = strtol(buf, NULL, 10); } } diff --git a/libavformat/utils.c b/libavformat/utils.c index acac406bf6..04062a0f00 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3391,44 +3391,14 @@ int64_t parse_date(const char *timestr, int duration) } #endif +#if FF_API_FIND_INFO_TAG +#include "libavutil/parseutils.h" + int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) { - const char *p; - char tag[128], *q; - - p = info; - if (*p == '?') - p++; - for(;;) { - q = tag; - while (*p != '\0' && *p != '=' && *p != '&') { - if ((q - tag) < sizeof(tag) - 1) - *q++ = *p; - p++; - } - *q = '\0'; - q = arg; - if (*p == '=') { - p++; - while (*p != '&' && *p != '\0') { - if ((q - arg) < arg_size - 1) { - if (*p == '+') - *q++ = ' '; - else - *q++ = *p; - } - p++; - } - } - *q = '\0'; - if (!strcmp(tag, tag1)) - return 1; - if (*p != '&') - break; - p++; - } - return 0; + return av_find_info_tag(arg, arg_size, tag1, info); } +#endif int av_get_frame_filename(char *buf, int buf_size, const char *path, int number) diff --git a/libavformat/version.h b/libavformat/version.h index 3663ec55b9..b4add73532 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -98,5 +98,8 @@ #ifndef FF_API_PARSE_DATE #define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_FIND_INFO_TAG +#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif //AVFORMAT_VERSION_H diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index 8e09dade62..d67d31bffe 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -608,6 +608,45 @@ int av_parse_time(int64_t *timeval, const char *datestr, int duration) return 0; } +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) +{ + const char *p; + char tag[128], *q; + + p = info; + if (*p == '?') + p++; + for(;;) { + q = tag; + while (*p != '\0' && *p != '=' && *p != '&') { + if ((q - tag) < sizeof(tag) - 1) + *q++ = *p; + p++; + } + *q = '\0'; + q = arg; + if (*p == '=') { + p++; + while (*p != '&' && *p != '\0') { + if ((q - arg) < arg_size - 1) { + if (*p == '+') + *q++ = ' '; + else + *q++ = *p; + } + p++; + } + } + *q = '\0'; + if (!strcmp(tag, tag1)) + return 1; + if (*p != '&') + break; + p++; + } + return 0; +} + #ifdef TEST #undef printf diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h index 517f125a63..c3986af20c 100644 --- a/libavutil/parseutils.h +++ b/libavutil/parseutils.h @@ -106,4 +106,12 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, */ int av_parse_time(int64_t *timeval, const char *timestr, int duration); +/** + * Attempt to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + */ +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); + #endif /* AVUTIL_PARSEUTILS_H */ From 09d171b98879f58be1a766d5f277e131b18e98a1 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 16 Feb 2011 09:52:39 +0100 Subject: [PATCH 394/528] lavf, lavu: bump minor versions and add an APIChanges entry for av_ prefixes Signed-off-by: Janne Grunau --- doc/APIchanges | 6 ++++++ libavformat/version.h | 4 ++-- libavutil/avutil.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 421df01336..adb85f831d 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,6 +12,12 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-16 - xxxxxxx - lavf 52.101.0 - avformat.h + lavu 52.39.0 - parseutils.h + Add av_ prefix to dump_format(). + Replace parse_date() in lavf with av_parse_time() in lavu. + Move find_info_tag from lavf to lavu and add av_prefix to it. + 2011-02-15 - lavu 52.38.0 - merge libavcore libavcore is merged back completely into libavutil diff --git a/libavformat/version.h b/libavformat/version.h index b4add73532..9a15fe4df6 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,8 +24,8 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 100 -#define LIBAVFORMAT_VERSION_MICRO 1 +#define LIBAVFORMAT_VERSION_MINOR 101 +#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 7d1d4ccd0f..e887c4d5bf 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -40,7 +40,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 50 -#define LIBAVUTIL_VERSION_MINOR 38 +#define LIBAVUTIL_VERSION_MINOR 39 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ From c3dbfa1afd7d989e3bba4c6bfc492a52c012e9b3 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Thu, 17 Feb 2011 21:49:08 +0100 Subject: [PATCH 395/528] Add SHA1s to APIChanges for av_dump_format, av_parse_time and av_find_info_tag Signed-off-by: Janne Grunau --- doc/APIchanges | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index adb85f831d..e73af3079d 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,11 +12,11 @@ libavutil: 2009-03-08 API changes, most recent first: -2011-02-16 - xxxxxxx - lavf 52.101.0 - avformat.h +2011-02-16 - 09d171b - lavf 52.101.0 - avformat.h lavu 52.39.0 - parseutils.h - Add av_ prefix to dump_format(). - Replace parse_date() in lavf with av_parse_time() in lavu. - Move find_info_tag from lavf to lavu and add av_prefix to it. + * 610219a - Add av_ prefix to dump_format(). + * f6c7375 - Replace parse_date() in lavf with av_parse_time() in lavu. + * ab0287f - Move find_info_tag from lavf to lavu and add av_prefix to it. 2011-02-15 - lavu 52.38.0 - merge libavcore libavcore is merged back completely into libavutil From c2ca851b234e169b50730ef357aeade8047491eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 16 Feb 2011 16:37:40 +0200 Subject: [PATCH 396/528] ffserver: Try matching the RTSP url without a trailing slash If the client sends PLAY/PAUSE requests with the same url as specified in Content-Base, these requests may have urls with trailing slashes. --- ffserver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ffserver.c b/ffserver.c index 20ba890e4d..74bce851b9 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3199,7 +3199,7 @@ static HTTPContext *find_rtp_session_with_url(const char *url, char path1[1024]; const char *path; char buf[1024]; - int s; + int s, len; rtp_c = find_rtp_session(session_id); if (!rtp_c) @@ -3219,6 +3219,10 @@ static HTTPContext *find_rtp_session_with_url(const char *url, return rtp_c; } } + len = strlen(path); + if (len > 0 && path[len - 1] == '/' && + !strncmp(path, rtp_c->stream->filename, len - 1)) + return rtp_c; return NULL; } From 1da6ea39542424ddb691dc6cf08d611a4c6db247 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 16 Feb 2011 14:18:21 -0500 Subject: [PATCH 397/528] VC1: transpose IDCT 8x8 coeffs while reading. --- libavcodec/ppc/vc1dsp_altivec.c | 1 - libavcodec/vc1.h | 1 + libavcodec/vc1dec.c | 95 +++++++++++++++++---------------- libavcodec/vc1dsp.c | 24 ++++----- 4 files changed, 63 insertions(+), 58 deletions(-) diff --git a/libavcodec/ppc/vc1dsp_altivec.c b/libavcodec/ppc/vc1dsp_altivec.c index a2f55f2db0..5ffe9a5479 100644 --- a/libavcodec/ppc/vc1dsp_altivec.c +++ b/libavcodec/ppc/vc1dsp_altivec.c @@ -154,7 +154,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) src6 = vec_ld( 96, block); src7 = vec_ld(112, block); - TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7); s0 = vec_unpackl(src0); s1 = vec_unpackl(src1); s2 = vec_unpackl(src2); diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index e5a9cbaec1..da0b6c16e7 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -215,6 +215,7 @@ typedef struct VC1Context{ int k_y; ///< Number of bits for MVs (depends on MV range) int range_x, range_y; ///< MV range uint8_t pq, altpq; ///< Current/alternate frame quantizer scale + uint8_t zz_8x8[4][64];///< Zigzag table for TT_8x8, permuted for IDCT const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode /** pquant parameters */ diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 3bd2cce297..169797ca75 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1499,11 +1499,11 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded if(v->s.ac_pred) { if(!dc_pred_dir) - zz_table = wmv1_scantable[2]; + zz_table = v->zz_8x8[2]; else - zz_table = wmv1_scantable[3]; + zz_table = v->zz_8x8[3]; } else - zz_table = wmv1_scantable[1]; + zz_table = v->zz_8x8[1]; ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; @@ -1524,16 +1524,16 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded if(s->ac_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k]; + block[k] += ac_val[k]; } else { //top for(k = 1; k < 8; k++) - block[k] += ac_val[k + 8]; + block[k << 3] += ac_val[k + 8]; } } /* save AC coeffs for further prediction */ for(k = 1; k < 8; k++) { - ac_val2[k] = block[k << 3]; - ac_val2[k + 8] = block[k]; + ac_val2[k] = block[k]; + ac_val2[k + 8] = block[k << 3]; } /* scale AC coeffs */ @@ -1570,15 +1570,15 @@ not_coded: if(s->ac_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k << 3] = ac_val[k] * scale; - if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq; + block[k] = ac_val[k] * scale; + if(!v->pquantizer && block[k]) + block[k] += (block[k] < 0) ? -v->pq : v->pq; } } else { //top for(k = 1; k < 8; k++) { - block[k] = ac_val[k + 8] * scale; - if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -v->pq : v->pq; + block[k << 3] = ac_val[k + 8] * scale; + if(!v->pquantizer && block[k << 3]) + block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq; } } i = 63; @@ -1682,11 +1682,11 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c if(v->s.ac_pred) { if(!dc_pred_dir) - zz_table = wmv1_scantable[2]; + zz_table = v->zz_8x8[2]; else - zz_table = wmv1_scantable[3]; + zz_table = v->zz_8x8[3]; } else - zz_table = wmv1_scantable[1]; + zz_table = v->zz_8x8[1]; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); @@ -1705,25 +1705,25 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { //top for(k = 1; k < 8; k++) - block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k]; + block[k] += ac_val[k]; } else { //top for(k = 1; k < 8; k++) - block[k] += ac_val[k + 8]; + block[k << 3] += ac_val[k + 8]; } } } /* save AC coeffs for further prediction */ for(k = 1; k < 8; k++) { - ac_val2[k] = block[k << 3]; - ac_val2[k + 8] = block[k]; + ac_val2[k] = block[k]; + ac_val2[k + 8] = block[k << 3]; } /* scale AC coeffs */ @@ -1765,15 +1765,15 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c if(use_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k << 3] = ac_val2[k] * scale; - if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; + block[k] = ac_val2[k] * scale; + if(!v->pquantizer && block[k]) + block[k] += (block[k] < 0) ? -mquant : mquant; } } else { //top for(k = 1; k < 8; k++) { - block[k] = ac_val2[k + 8] * scale; - if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -mquant : mquant; + block[k << 3] = ac_val2[k + 8] * scale; + if(!v->pquantizer && block[k << 3]) + block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; } } i = 63; @@ -1884,17 +1884,14 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(coded) { int last = 0, skip, value; - const uint8_t *zz_table; int k; - zz_table = wmv1_scantable[0]; - while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; if(i > 63) break; - block[zz_table[i++]] = value; + block[v->zz_8x8[0][i++]] = value; } /* apply AC prediction if needed */ @@ -1906,25 +1903,25 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { //top for(k = 1; k < 8; k++) - block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k]; + block[k] += ac_val[k]; } else { //top for(k = 1; k < 8; k++) - block[k] += ac_val[k + 8]; + block[k << 3] += ac_val[k + 8]; } } } /* save AC coeffs for further prediction */ for(k = 1; k < 8; k++) { - ac_val2[k] = block[k << 3]; - ac_val2[k + 8] = block[k]; + ac_val2[k] = block[k]; + ac_val2[k + 8] = block[k << 3]; } /* scale AC coeffs */ @@ -1966,15 +1963,15 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(use_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k << 3] = ac_val2[k] * scale; - if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; + block[k] = ac_val2[k] * scale; + if(!v->pquantizer && block[k]) + block[k] += (block[k] < 0) ? -mquant : mquant; } } else { //top for(k = 1; k < 8; k++) { - block[k] = ac_val2[k + 8] * scale; - if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -mquant : mquant; + block[k << 3] = ac_val2[k + 8] * scale; + if(!v->pquantizer && block[k << 3]) + block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; } } i = 63; @@ -2035,7 +2032,7 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan i += skip; if(i > 63) break; - idx = wmv1_scantable[0][i++]; + idx = v->zz_8x8[0][i++]; block[idx] = value * scale; if(!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; @@ -3007,6 +3004,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; GetBitContext gb; + int i; if (!avctx->extradata_size || !avctx->extradata) return -1; if (!(avctx->flags & CODEC_FLAG_GRAY)) @@ -3025,6 +3023,13 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) if(ff_msmpeg4_decode_init(avctx) < 0) return -1; if (vc1_init_common(v) < 0) return -1; + for (i = 0; i < 64; i++) { +#define transpose(x) ((x>>3) | ((x&7)<<3)) + v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]); + v->zz_8x8[1][i] = transpose(wmv1_scantable[1][i]); + v->zz_8x8[2][i] = transpose(wmv1_scantable[2][i]); + v->zz_8x8[3][i] = transpose(wmv1_scantable[3][i]); + } avctx->coded_width = avctx->width; avctx->coded_height = avctx->height; diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c index aab1694797..fd740e12d4 100644 --- a/libavcodec/vc1dsp.c +++ b/libavcodec/vc1dsp.c @@ -203,25 +203,25 @@ static void vc1_inv_trans_8x8_c(DCTELEM block[64]) { int i; register int t1,t2,t3,t4,t5,t6,t7,t8; - DCTELEM *src, *dst; + DCTELEM *src, *dst, temp[64]; src = block; - dst = block; + dst = temp; for(i = 0; i < 8; i++){ - t1 = 12 * (src[0] + src[4]) + 4; - t2 = 12 * (src[0] - src[4]) + 4; - t3 = 16 * src[2] + 6 * src[6]; - t4 = 6 * src[2] - 16 * src[6]; + t1 = 12 * (src[ 0] + src[32]) + 4; + t2 = 12 * (src[ 0] - src[32]) + 4; + t3 = 16 * src[16] + 6 * src[48]; + t4 = 6 * src[16] - 16 * src[48]; t5 = t1 + t3; t6 = t2 + t4; t7 = t2 - t4; t8 = t1 - t3; - t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7]; - t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7]; - t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7]; - t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7]; + t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56]; + t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56]; + t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; + t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; dst[0] = (t5 + t1) >> 3; dst[1] = (t6 + t2) >> 3; @@ -232,11 +232,11 @@ static void vc1_inv_trans_8x8_c(DCTELEM block[64]) dst[6] = (t6 - t2) >> 3; dst[7] = (t5 - t1) >> 3; - src += 8; + src += 1; dst += 8; } - src = block; + src = temp; dst = block; for(i = 0; i < 8; i++){ t1 = 12 * (src[ 0] + src[32]) + 64; From 0b16cdc3fa1d73056649abf43288be0a7624fdcc Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 17 Feb 2011 12:14:12 -0500 Subject: [PATCH 398/528] VC1: simplify a calculation in a loop. --- libavcodec/vc1dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 169797ca75..e254d1b0b8 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -199,7 +199,7 @@ static void vc1_put_block(VC1Context *v, DCTELEM block[6][64]) for(k = 0; k < 6; k++) for(j = 0; j < 8; j++) for(i = 0; i < 8; i++) - block[k][i + j*8] = ((block[k][i + j*8] - 128) << 1) + 128; + block[k][i + j*8] = (block[k][i + j*8] - 64) << 1; } ys = v->s.current_picture.linesize[0]; From 12802ec0601c3bd7b9c7a2503518e28fd5e7d744 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 17 Feb 2011 14:45:03 -0500 Subject: [PATCH 399/528] dsputil: move VC1-specific stuff into VC1DSPContext. --- libavcodec/dsputil.c | 53 ---------- libavcodec/dsputil.h | 27 ----- libavcodec/ppc/dsputil_altivec.h | 1 - libavcodec/ppc/dsputil_ppc.c | 2 - libavcodec/ppc/vc1dsp_altivec.c | 6 +- libavcodec/vc1.c | 16 +-- libavcodec/vc1.h | 2 + libavcodec/vc1dec.c | 174 ++++++++++++++++--------------- libavcodec/vc1dsp.c | 61 ++++++++++- libavcodec/vc1dsp.h | 67 ++++++++++++ libavcodec/x86/dsputil_mmx.c | 20 ---- libavcodec/x86/dsputil_mmx.h | 1 - libavcodec/x86/vc1dsp_mmx.c | 57 +++++++--- 13 files changed, 269 insertions(+), 218 deletions(-) create mode 100644 libavcodec/vc1dsp.h diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index c89e58f529..f7151b8815 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1600,54 +1600,6 @@ H264_CHROMA_MC(avg_ , op_avg) #undef op_avg #undef op_put -static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ - const int A=(8-x)*(8-y); - const int B=( x)*(8-y); - const int C=(8-x)*( y); - const int D=( x)*( y); - int i; - - assert(x<8 && y<8 && x>=0 && y>=0); - - for(i=0; i> 6; - dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6; - dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6; - dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6; - dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6; - dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6; - dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6; - dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6; - dst+= stride; - src+= stride; - } -} - -static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ - const int A=(8-x)*(8-y); - const int B=( x)*(8-y); - const int C=(8-x)*( y); - const int D=( x)*( y); - int i; - - assert(x<8 && y<8 && x>=0 && y>=0); - - for(i=0; i> 6)); - dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6)); - dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6)); - dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6)); - dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6)); - dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6)); - dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6)); - dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6)); - dst+= stride; - src+= stride; - } -} - #define QPEL_MC(r, OPNAME, RND, OP) \ static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ @@ -4301,17 +4253,12 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c; c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c; c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c; - c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c; - c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c; c->draw_edges = draw_edges_c; #if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER ff_mlp_init(c, avctx); #endif -#if CONFIG_VC1_DECODER - ff_vc1dsp_init(c,avctx); -#endif #if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER ff_intrax8dsp_init(c,avctx); #endif diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index c8111866c2..f97b2b5fef 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -341,9 +341,6 @@ typedef struct DSPContext { */ h264_chroma_mc_func put_h264_chroma_pixels_tab[3]; h264_chroma_mc_func avg_h264_chroma_pixels_tab[3]; - /* This is really one func used in VC-1 decoding */ - h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]; - h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3]; qpel_mc_func put_h264_qpel_pixels_tab[4][16]; qpel_mc_func avg_h264_qpel_pixels_tab[4][16]; @@ -503,29 +500,6 @@ typedef struct DSPContext { unsigned int filter_shift, int32_t mask, int blocksize, int32_t *sample_buffer); - /* vc1 functions */ - void (*vc1_inv_trans_8x8)(DCTELEM *b); - void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_8x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_v_overlap)(uint8_t* src, int stride); - void (*vc1_h_overlap)(uint8_t* src, int stride); - void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq); - void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq); - void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq); - void (*vc1_h_loop_filter8)(uint8_t *src, int stride, int pq); - void (*vc1_v_loop_filter16)(uint8_t *src, int stride, int pq); - void (*vc1_h_loop_filter16)(uint8_t *src, int stride, int pq); - /* put 8x8 block with bicubic interpolation and quarterpel precision - * last argument is actually round value instead of height - */ - op_pixels_func put_vc1_mspel_pixels_tab[16]; - op_pixels_func avg_vc1_mspel_pixels_tab[16]; - /* intrax8 functions */ void (*x8_spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize); void (*x8_setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize, @@ -629,7 +603,6 @@ void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); void ff_dsputil_init_dwt(DSPContext *c); void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx); void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx); -void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx); void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); void ff_mlp_init(DSPContext* c, AVCodecContext *avctx); void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx); diff --git a/libavcodec/ppc/dsputil_altivec.h b/libavcodec/ppc/dsputil_altivec.h index cd44f602b9..4147eec823 100644 --- a/libavcodec/ppc/dsputil_altivec.h +++ b/libavcodec/ppc/dsputil_altivec.h @@ -43,7 +43,6 @@ void ff_vp3_idct_add_altivec(uint8_t *dest, int line_size, DCTELEM *block); void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx); void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx); -void vc1dsp_init_altivec(DSPContext* c, AVCodecContext *avctx); void float_init_altivec(DSPContext* c, AVCodecContext *avctx); void int_init_altivec(DSPContext* c, AVCodecContext *avctx); diff --git a/libavcodec/ppc/dsputil_ppc.c b/libavcodec/ppc/dsputil_ppc.c index 9e4f1aa667..d13c1ce661 100644 --- a/libavcodec/ppc/dsputil_ppc.c +++ b/libavcodec/ppc/dsputil_ppc.c @@ -171,8 +171,6 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { dsputil_init_altivec(c, avctx); - if(CONFIG_VC1_DECODER) - vc1dsp_init_altivec(c, avctx); float_init_altivec(c, avctx); int_init_altivec(c, avctx); c->gmc1 = gmc1_altivec; diff --git a/libavcodec/ppc/vc1dsp_altivec.c b/libavcodec/ppc/vc1dsp_altivec.c index 5ffe9a5479..95774389a5 100644 --- a/libavcodec/ppc/vc1dsp_altivec.c +++ b/libavcodec/ppc/vc1dsp_altivec.c @@ -322,7 +322,11 @@ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block) } -void vc1dsp_init_altivec(DSPContext* dsp, AVCodecContext *avctx) { +void ff_vc1dsp_init_altivec(VC1DSPContext* dsp) +{ + if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) + return; + dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec; dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; } diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 1f39878293..8bd6647f13 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -337,14 +337,14 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte v->res_fasttx = get_bits1(gb); if (!v->res_fasttx) { - v->s.dsp.vc1_inv_trans_8x8 = ff_simple_idct; - v->s.dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; - v->s.dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; - v->s.dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; - v->s.dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add; - v->s.dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add; - v->s.dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add; - v->s.dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add; + v->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct; + v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; + v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; + v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; + v->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add; + v->vc1dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add; + v->vc1dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add; + v->vc1dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add; } v->fastuvmc = get_bits1(gb); //common diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index da0b6c16e7..d826c5a817 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -26,6 +26,7 @@ #include "avcodec.h" #include "mpegvideo.h" #include "intrax8.h" +#include "vc1dsp.h" /** Markers used in VC-1 AP frame data */ //@{ @@ -155,6 +156,7 @@ enum COTypes { typedef struct VC1Context{ MpegEncContext s; IntraX8Context x8; + VC1DSPContext vc1dsp; int bits; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index e254d1b0b8..6707cdec71 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -160,29 +160,30 @@ enum Imode { /** @} */ //Bitplane group -static void vc1_loop_filter_iblk(MpegEncContext *s, int pq) +static void vc1_loop_filter_iblk(VC1Context *v, int pq) { + MpegEncContext *s = &v->s; int j; if (!s->first_slice_line) { - s->dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq); + v->vc1dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq); if (s->mb_x) - s->dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize, s->linesize, pq); - s->dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize+8, s->linesize, pq); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize, s->linesize, pq); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize+8, s->linesize, pq); for(j = 0; j < 2; j++){ - s->dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq); if (s->mb_x) - s->dsp.vc1_h_loop_filter8(s->dest[j+1]-8*s->uvlinesize, s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1]-8*s->uvlinesize, s->uvlinesize, pq); } } - s->dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq); + v->vc1dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq); if (s->mb_y == s->mb_height-1) { if (s->mb_x) { - s->dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq); - s->dsp.vc1_h_loop_filter8(s->dest[1], s->uvlinesize, pq); - s->dsp.vc1_h_loop_filter8(s->dest[2], s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[1], s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[2], s->uvlinesize, pq); } - s->dsp.vc1_h_loop_filter16(s->dest[0] + 8, s->linesize, pq); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0] + 8, s->linesize, pq); } } @@ -342,11 +343,11 @@ static void vc1_mc_1mv(VC1Context *v, int dir) if(s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); srcY += s->linesize * 8; - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); @@ -364,8 +365,8 @@ static void vc1_mc_1mv(VC1Context *v, int dir) dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); }else{ - dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); - dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); } } @@ -433,7 +434,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n) if(s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd); } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); if(!v->rnd) @@ -583,8 +584,8 @@ static void vc1_mc_4mv_chroma(VC1Context *v) dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); }else{ - dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); - dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); } } @@ -906,11 +907,11 @@ static void vc1_interp_mc(VC1Context *v) if(s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); - dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); - dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); srcY += s->linesize * 8; - dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); - dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); } else { // hpel mc dxy = (my & 2) | ((mx & 2) >> 1); @@ -928,8 +929,8 @@ static void vc1_interp_mc(VC1Context *v) dsp->avg_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); }else{ - dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); - dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); } } @@ -2039,15 +2040,15 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan } if(!skip_block){ if(i==1) - s->dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); + v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); else{ - s->dsp.vc1_inv_trans_8x8(block); + v->vc1dsp.vc1_inv_trans_8x8(block); s->dsp.add_pixels_clamped(block, dst, linesize); } if(apply_filter && cbp_top & 0xC) - s->dsp.vc1_v_loop_filter8(dst, linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(dst, linesize, v->pq); if(apply_filter && cbp_left & 0xA) - s->dsp.vc1_h_loop_filter8(dst, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(dst, linesize, v->pq); } break; case TT_4X4: @@ -2068,13 +2069,13 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan } if(!(subblkpat & (1 << (3 - j))) && !skip_block){ if(i==1) - s->dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); else - s->dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); if(apply_filter && (j&2 ? pat & (1<<(j-2)) : (cbp_top & (1 << (j + 2))))) - s->dsp.vc1_v_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); if(apply_filter && (j&1 ? pat & (1<<(j-1)) : (cbp_left & (1 << (j + 1))))) - s->dsp.vc1_h_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); } } break; @@ -2096,13 +2097,13 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan } if(!(subblkpat & (1 << (1 - j))) && !skip_block){ if(i==1) - s->dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off); else - s->dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off); if(apply_filter && j ? pat & 0x3 : (cbp_top & 0xC)) - s->dsp.vc1_v_loop_filter8(dst + j*4*linesize, linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(dst + j*4*linesize, linesize, v->pq); if(apply_filter && cbp_left & (2 << j)) - s->dsp.vc1_h_loop_filter4(dst + j*4*linesize, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter4(dst + j*4*linesize, linesize, v->pq); } } break; @@ -2124,13 +2125,13 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan } if(!(subblkpat & (1 << (1 - j))) && !skip_block){ if(i==1) - s->dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off); + v->vc1dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off); else - s->dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off); + v->vc1dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off); if(apply_filter && cbp_top & (2 << j)) - s->dsp.vc1_v_loop_filter4(dst + j*4, linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter4(dst + j*4, linesize, v->pq); if(apply_filter && j ? pat & 0x5 : (cbp_left & 0xA)) - s->dsp.vc1_h_loop_filter8(dst + j*4, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(dst + j*4, linesize, v->pq); } } break; @@ -2232,14 +2233,14 @@ static int vc1_decode_p_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; - s->dsp.vc1_inv_trans_8x8(s->block[i]); + v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if(v->pq >= 9 && v->overlap) { if(v->c_avail) - s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if(v->a_avail) - s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){ int left_cbp, top_cbp; @@ -2251,9 +2252,9 @@ static int vc1_decode_p_mb(VC1Context *v) top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); } if(left_cbp & 0xC) - s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); if(top_cbp & 0xA) - s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); } block_cbp |= 0xF << (i << 2); } else if(val) { @@ -2268,9 +2269,9 @@ static int vc1_decode_p_mb(VC1Context *v) top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); } if(left_cbp & 0xC) - s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); if(top_cbp & 0xA) - s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); } pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp); block_cbp |= pat << (i << 2); @@ -2363,14 +2364,14 @@ static int vc1_decode_p_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; - s->dsp.vc1_inv_trans_8x8(s->block[i]); + v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); if(v->pq >= 9 && v->overlap) { if(v->c_avail) - s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if(v->a_avail) - s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){ int left_cbp, top_cbp; @@ -2382,9 +2383,9 @@ static int vc1_decode_p_mb(VC1Context *v) top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); } if(left_cbp & 0xC) - s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); if(top_cbp & 0xA) - s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); } block_cbp |= 0xF << (i << 2); } else if(is_coded[i]) { @@ -2399,9 +2400,9 @@ static int vc1_decode_p_mb(VC1Context *v) top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); } if(left_cbp & 0xC) - s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); if(top_cbp & 0xA) - s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); } pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp); block_cbp |= pat << (i << 2); @@ -2568,7 +2569,7 @@ static void vc1_decode_b_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; - s->dsp.vc1_inv_trans_8x8(s->block[i]); + v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } else if(val) { @@ -2650,7 +2651,7 @@ static void vc1_decode_i_blocks(VC1Context *v) vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); - s->dsp.vc1_inv_trans_8x8(s->block[k]); + v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); if(v->pq >= 9 && v->overlap) { for(j = 0; j < 64; j++) s->block[k][j] += 128; } @@ -2659,27 +2660,27 @@ static void vc1_decode_i_blocks(VC1Context *v) vc1_put_block(v, s->block); if(v->pq >= 9 && v->overlap) { if(s->mb_x) { - s->dsp.vc1_h_overlap(s->dest[0], s->linesize); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); - s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); + v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); + v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); if(!s->first_slice_line) { - s->dsp.vc1_v_overlap(s->dest[0], s->linesize); - s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); - s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); + v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); + v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); } - if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq); + if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); if(get_bits_count(&s->gb) > v->bits) { ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); @@ -2790,34 +2791,34 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); - s->dsp.vc1_inv_trans_8x8(s->block[k]); + v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); for(j = 0; j < 64; j++) s->block[k][j] += 128; } vc1_put_block(v, s->block); if(overlap) { if(s->mb_x) { - s->dsp.vc1_h_overlap(s->dest[0], s->linesize); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); - s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); + v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); + v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); if(!s->first_slice_line) { - s->dsp.vc1_v_overlap(s->dest[0], s->linesize); - s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); - s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); + v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); + v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); } - if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq); + if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); if(get_bits_count(&s->gb) > v->bits) { ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); @@ -2929,7 +2930,7 @@ static void vc1_decode_b_blocks(VC1Context *v) av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); return; } - if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq); + if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); } if (!v->s.loop_filter) ff_draw_horiz_band(s, s->mb_y * 16, 16); @@ -3023,6 +3024,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) if(ff_msmpeg4_decode_init(avctx) < 0) return -1; if (vc1_init_common(v) < 0) return -1; + ff_vc1dsp_init(&v->vc1dsp); for (i = 0; i < 64; i++) { #define transpose(x) ((x>>3) | ((x&7)<<3)) v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]); diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c index fd740e12d4..000dad7d26 100644 --- a/libavcodec/vc1dsp.c +++ b/libavcodec/vc1dsp.c @@ -25,7 +25,7 @@ * */ -#include "dsputil.h" +#include "vc1dsp.h" /** Apply overlap transform to horizontal edge @@ -612,7 +612,56 @@ PUT_VC1_MSPEL(1, 3) PUT_VC1_MSPEL(2, 3) PUT_VC1_MSPEL(3, 3) -av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) { +static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ + const int A=(8-x)*(8-y); + const int B=( x)*(8-y); + const int C=(8-x)*( y); + const int D=( x)*( y); + int i; + + assert(x<8 && y<8 && x>=0 && y>=0); + + for(i=0; i> 6; + dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6; + dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6; + dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6; + dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6; + dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6; + dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6; + dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6; + dst+= stride; + src+= stride; + } +} + +#define avg2(a,b) ((a+b+1)>>1) +static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ + const int A=(8-x)*(8-y); + const int B=( x)*(8-y); + const int C=(8-x)*( y); + const int D=( x)*( y); + int i; + + assert(x<8 && y<8 && x>=0 && y>=0); + + for(i=0; i> 6)); + dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6)); + dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6)); + dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6)); + dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6)); + dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6)); + dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6)); + dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6)); + dst+= stride; + src+= stride; + } +} + +av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c; dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c; dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c; @@ -663,4 +712,12 @@ av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) { dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_c; dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_c; dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_c; + + dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c; + + if (HAVE_ALTIVEC) + ff_vc1dsp_init_altivec(dsp); + if (HAVE_MMX) + ff_vc1dsp_init_mmx(dsp); } diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h new file mode 100644 index 0000000000..a1f3d90574 --- /dev/null +++ b/libavcodec/vc1dsp.h @@ -0,0 +1,67 @@ +/* + * VC-1 and WMV3 decoder - DSP functions + * Copyright (c) 2006 Konstantin Shishkov + * + * 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 + * VC-1 and WMV3 decoder + * + */ + +#ifndef AVCODEC_VC1DSP_H +#define AVCODEC_VC1DSP_H + +#include "dsputil.h" + +typedef struct VC1DSPContext { + /* vc1 functions */ + void (*vc1_inv_trans_8x8)(DCTELEM *b); + void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_8x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_v_overlap)(uint8_t* src, int stride); + void (*vc1_h_overlap)(uint8_t* src, int stride); + void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq); + void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq); + void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq); + void (*vc1_h_loop_filter8)(uint8_t *src, int stride, int pq); + void (*vc1_v_loop_filter16)(uint8_t *src, int stride, int pq); + void (*vc1_h_loop_filter16)(uint8_t *src, int stride, int pq); + + /* put 8x8 block with bicubic interpolation and quarterpel precision + * last argument is actually round value instead of height + */ + op_pixels_func put_vc1_mspel_pixels_tab[16]; + op_pixels_func avg_vc1_mspel_pixels_tab[16]; + + /* This is really one func used in VC-1 decoding */ + h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]; + h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3]; +} VC1DSPContext; + +void ff_vc1dsp_init(VC1DSPContext* c); +void ff_vc1dsp_init_altivec(VC1DSPContext* c); +void ff_vc1dsp_init_mmx(VC1DSPContext* dsp); + +#endif /* AVCODEC_VC1DSP_H */ diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 39bf3f2936..16ad965ec1 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -1894,20 +1894,14 @@ PREFETCH(prefetch_3dnow, prefetch) 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); @@ -1931,15 +1925,11 @@ void ff_avg_h264_chroma_mc2_mmx2 (uint8_t *dst, uint8_t *src, 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); @@ -2535,7 +2525,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #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; 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; @@ -2622,8 +2611,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) 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]= ff_avg_vc1_chroma_mc8_mmx2_nornd; - 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; @@ -2636,9 +2623,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov; #endif - if (CONFIG_VC1_DECODER) - ff_vc1dsp_init_mmx(c, avctx); - c->add_png_paeth_prediction= add_png_paeth_prediction_mmx2; } else if (mm_flags & AV_CPU_FLAG_3DNOW) { c->prefetch = prefetch_3dnow; @@ -2695,8 +2679,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) 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]= ff_avg_rv40_chroma_mc8_3dnow; c->avg_rv40_chroma_pixels_tab[1]= ff_avg_rv40_chroma_mc4_3dnow; #endif @@ -2745,8 +2727,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) H264_QPEL_FUNCS(3, 3, 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; diff --git a/libavcodec/x86/dsputil_mmx.h b/libavcodec/x86/dsputil_mmx.h index a095e1ef3d..59a9613609 100644 --- a/libavcodec/x86/dsputil_mmx.h +++ b/libavcodec/x86/dsputil_mmx.h @@ -196,7 +196,6 @@ void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); -void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx); void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd); void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd); diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c index 04b4abaad3..a525aeeeae 100644 --- a/libavcodec/x86/vc1dsp_mmx.c +++ b/libavcodec/x86/vc1dsp_mmx.c @@ -28,6 +28,7 @@ #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "dsputil_mmx.h" +#include "libavcodec/vc1dsp.h" #define OP_PUT(S,D) #define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t" @@ -712,30 +713,45 @@ static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq) ff_vc1_h_loop_filter8_sse4(src, stride, pq); ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq); } + #endif -void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) { +void ff_put_vc1_chroma_mc8_mmx_nornd (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_vc1_chroma_mc8_3dnow_nornd(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_avg_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); + +void ff_vc1dsp_init_mmx(VC1DSPContext *dsp) +{ 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; - dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx; - dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx; + if (mm_flags & AV_CPU_FLAG_MMX) { + 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; + dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx; + dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx; - dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx; - dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx; - dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx; - dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx; + dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx; + dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx; + dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx; + dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx; - dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx; - dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx; - dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx; - dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx; + dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx; + dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx; + dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx; + dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx; - dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx; - dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx; - dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx; - dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx; + dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx; + dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx; + 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 & AV_CPU_FLAG_MMX2){ dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2; @@ -775,11 +791,16 @@ void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) { #if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX) { ASSIGN_LF(mmx); + dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd; } return; if (mm_flags & AV_CPU_FLAG_MMX2) { ASSIGN_LF(mmx2); + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd; + } else if (mm_flags & AV_CPU_FLAG_3DNOW) { + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd; } + 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; @@ -788,6 +809,8 @@ void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) { } if (mm_flags & AV_CPU_FLAG_SSSE3) { ASSIGN_LF(ssse3); + dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd; } if (mm_flags & AV_CPU_FLAG_SSE4) { dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4; From 7634771e70575b2a5abaeb420c5b3c2f9948c693 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 16 Feb 2011 09:39:00 -0800 Subject: [PATCH 400/528] VP8: faster MV clipping --- libavcodec/vp8.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index a66c10d655..2d2a99d960 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -125,6 +125,8 @@ typedef struct { int chroma_pred_mode; ///< 8x8c pred mode of the current macroblock int segment; ///< segment of the current macroblock + VP56mv mv_min; + VP56mv mv_max; int mbskip_enabled; int sign_bias[4]; ///< one state [0, 1] per ref frame type @@ -522,14 +524,10 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) return 0; } -static av_always_inline -void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src, int mb_x, int mb_y) +static av_always_inline void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src) { -#define MARGIN (16 << 2) - dst->x = av_clip(src->x, -((mb_x << 6) + MARGIN), - ((s->mb_width - 1 - mb_x) << 6) + MARGIN); - dst->y = av_clip(src->y, -((mb_y << 6) + MARGIN), - ((s->mb_height - 1 - mb_y) << 6) + MARGIN); + dst->x = av_clip(src->x, s->mv_min.x, s->mv_max.x); + dst->y = av_clip(src->y, s->mv_min.y, s->mv_max.y); } /** @@ -703,7 +701,7 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y) if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAR]][2])) { /* Choose the best mv out of 0,0 and the nearest mv */ - clamp_mv(s, &mb->mv, &near_mv[CNT_ZERO + (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])], mb_x, mb_y); + clamp_mv(s, &mb->mv, &near_mv[CNT_ZERO + (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])]); cnt[CNT_SPLITMV] = ((mb_edge[EDGE_LEFT]->mode == VP8_MVMODE_SPLIT) + (mb_edge[EDGE_TOP]->mode == VP8_MVMODE_SPLIT)) * 2 + (mb_edge[EDGE_TOPLEFT]->mode == VP8_MVMODE_SPLIT); @@ -717,11 +715,11 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y) mb->bmv[0] = mb->mv; } } else { - clamp_mv(s, &mb->mv, &near_mv[CNT_NEAR], mb_x, mb_y); + clamp_mv(s, &mb->mv, &near_mv[CNT_NEAR]); mb->bmv[0] = mb->mv; } } else { - clamp_mv(s, &mb->mv, &near_mv[CNT_NEAREST], mb_x, mb_y); + clamp_mv(s, &mb->mv, &near_mv[CNT_NEAREST]); mb->bmv[0] = mb->mv; } } else { @@ -1707,6 +1705,10 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, if (s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4); + #define MARGIN (16 << 2) + s->mv_min.y = -MARGIN; + s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; + 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; @@ -1730,6 +1732,9 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129; } + s->mv_min.x = -MARGIN; + s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; + for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { /* Prefetch the current frame, 4 MBs ahead */ s->dsp.prefetch(dst[0] + (mb_x&3)*4*s->linesize + 64, s->linesize, 4); @@ -1770,6 +1775,8 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, dst[0] += 16; dst[1] += 8; dst[2] += 8; + s->mv_min.x -= 64; + s->mv_max.x -= 64; } if (s->deblock_filter) { if (s->filter.simple) @@ -1777,6 +1784,8 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, else filter_mb_row(s, mb_y); } + s->mv_min.y -= 64; + s->mv_max.y -= 64; } skip_decode: From bcf4568f183055331415ba230e82af6d59faac1c Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 16 Feb 2011 09:49:50 -0800 Subject: [PATCH 401/528] VP8: split out declarations to new header --- libavcodec/vp8.c | 177 +------------------------------ libavcodec/vp8.h | 242 +++++++++++++++++++++++++++++++++++++++++++ libavcodec/vp8data.h | 42 +------- 3 files changed, 248 insertions(+), 213 deletions(-) create mode 100644 libavcodec/vp8.h diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 2d2a99d960..566ec65380 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -24,189 +24,14 @@ #include "libavutil/imgutils.h" #include "avcodec.h" -#include "vp56.h" +#include "vp8.h" #include "vp8data.h" -#include "vp8dsp.h" -#include "h264pred.h" #include "rectangle.h" #if ARCH_ARM # include "arm/vp8.h" #endif -typedef struct { - uint8_t filter_level; - uint8_t inner_limit; - uint8_t inner_filter; -} VP8FilterStrength; - -typedef struct { - uint8_t skip; - // todo: make it possible to check for at least (i4x4 or split_mv) - // in one op. are others needed? - uint8_t mode; - uint8_t ref_frame; - uint8_t partitioning; - VP56mv mv; - VP56mv bmv[16]; -} VP8Macroblock; - -typedef struct { - AVCodecContext *avctx; - DSPContext dsp; - VP8DSPContext vp8dsp; - H264PredContext hpc; - vp8_mc_func put_pixels_tab[3][3][3]; - AVFrame frames[4]; - AVFrame *framep[4]; - uint8_t *edge_emu_buffer; - VP56RangeCoder c; ///< header context, includes mb modes and motion vectors - int profile; - - int mb_width; /* number of horizontal MB */ - int mb_height; /* number of vertical MB */ - int linesize; - int uvlinesize; - - int keyframe; - int invisible; - int update_last; ///< update VP56_FRAME_PREVIOUS with the current one - int update_golden; ///< VP56_FRAME_NONE if not updated, or which frame to copy if so - int update_altref; - int deblock_filter; - - /** - * If this flag is not set, all the probability updates - * are discarded after this frame is decoded. - */ - int update_probabilities; - - /** - * All coefficients are contained in separate arith coding contexts. - * There can be 1, 2, 4, or 8 of these after the header context. - */ - int num_coeff_partitions; - VP56RangeCoder coeff_partition[8]; - - VP8Macroblock *macroblocks; - VP8Macroblock *macroblocks_base; - VP8FilterStrength *filter_strength; - - uint8_t *intra4x4_pred_mode_top; - uint8_t intra4x4_pred_mode_left[4]; - uint8_t *segmentation_map; - - /** - * Cache of the top row needed for intra prediction - * 16 for luma, 8 for each chroma plane - */ - uint8_t (*top_border)[16+8+8]; - - /** - * For coeff decode, we need to know whether the above block had non-zero - * coefficients. This means for each macroblock, we need data for 4 luma - * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9 - * per macroblock. We keep the last row in top_nnz. - */ - uint8_t (*top_nnz)[9]; - DECLARE_ALIGNED(8, uint8_t, left_nnz)[9]; - - /** - * This is the index plus one of the last non-zero coeff - * for each of the blocks in the current macroblock. - * So, 0 -> no coeffs - * 1 -> dc-only (special transform) - * 2+-> full transform - */ - DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4]; - DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16]; - DECLARE_ALIGNED(16, DCTELEM, block_dc)[16]; - uint8_t intra4x4_pred_mode_mb[16]; - - int chroma_pred_mode; ///< 8x8c pred mode of the current macroblock - int segment; ///< segment of the current macroblock - VP56mv mv_min; - VP56mv mv_max; - - int mbskip_enabled; - int sign_bias[4]; ///< one state [0, 1] per ref frame type - int ref_count[3]; - - /** - * Base parameters for segmentation, i.e. per-macroblock parameters. - * These must be kept unchanged even if segmentation is not used for - * a frame, since the values persist between interframes. - */ - struct { - int enabled; - int absolute_vals; - int update_map; - int8_t base_quant[4]; - int8_t filter_level[4]; ///< base loop filter level - } segmentation; - - /** - * Macroblocks can have one of 4 different quants in a frame when - * segmentation is enabled. - * If segmentation is disabled, only the first segment's values are used. - */ - struct { - // [0] - DC qmul [1] - AC qmul - int16_t luma_qmul[2]; - int16_t luma_dc_qmul[2]; ///< luma dc-only block quant - int16_t chroma_qmul[2]; - } qmat[4]; - - struct { - int simple; - int level; - int sharpness; - } filter; - - struct { - int enabled; ///< whether each mb can have a different strength based on mode/ref - - /** - * filter strength adjustment for the following macroblock modes: - * [0-3] - i16x16 (always zero) - * [4] - i4x4 - * [5] - zero mv - * [6] - inter modes except for zero or split mv - * [7] - split mv - * i16x16 modes never have any adjustment - */ - int8_t mode[VP8_MVMODE_SPLIT+1]; - - /** - * filter strength adjustment for macroblocks that reference: - * [0] - intra / VP56_FRAME_CURRENT - * [1] - VP56_FRAME_PREVIOUS - * [2] - VP56_FRAME_GOLDEN - * [3] - altref / VP56_FRAME_GOLDEN2 - */ - int8_t ref[4]; - } lf_delta; - - /** - * These are all of the updatable probabilities for binary decisions. - * They are only implictly reset on keyframes, making it quite likely - * for an interframe to desync if a prior frame's header was corrupt - * or missing outright! - */ - struct { - uint8_t segmentid[3]; - uint8_t mbskip; - uint8_t intra; - uint8_t last; - uint8_t golden; - uint8_t pred16x16[4]; - uint8_t pred8x8c[3]; - /* Padded to allow overreads */ - uint8_t token[4][17][3][NUM_DCT_TOKENS-1]; - uint8_t mvc[2][19]; - } prob[2]; -} VP8Context; - static void vp8_decode_flush(AVCodecContext *avctx) { VP8Context *s = avctx->priv_data; diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h new file mode 100644 index 0000000000..d3b8705ea0 --- /dev/null +++ b/libavcodec/vp8.h @@ -0,0 +1,242 @@ +/** + * VP8 compatible video decoder + * + * Copyright (C) 2010 David Conrad + * Copyright (C) 2010 Ronald S. Bultje + * 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 + */ + +#ifndef AVCODEC_VP8_H +#define AVCODEC_VP8_H + +#include "vp56.h" +#include "vp56data.h" +#include "vp8dsp.h" +#include "h264pred.h" + +#define VP8_MAX_QUANT 127 + +enum dct_token { + DCT_0, + DCT_1, + DCT_2, + DCT_3, + DCT_4, + DCT_CAT1, + DCT_CAT2, + DCT_CAT3, + DCT_CAT4, + DCT_CAT5, + DCT_CAT6, + DCT_EOB, + + NUM_DCT_TOKENS +}; + +// used to signal 4x4 intra pred in luma MBs +#define MODE_I4x4 4 + +enum inter_mvmode { + VP8_MVMODE_ZERO = MODE_I4x4 + 1, + VP8_MVMODE_MV, + VP8_MVMODE_SPLIT +}; + +enum inter_splitmvmode { + VP8_SPLITMVMODE_16x8 = 0, ///< 2 16x8 blocks (vertical) + VP8_SPLITMVMODE_8x16, ///< 2 8x16 blocks (horizontal) + VP8_SPLITMVMODE_8x8, ///< 2x2 blocks of 8x8px each + VP8_SPLITMVMODE_4x4, ///< 4x4 blocks of 4x4px each + VP8_SPLITMVMODE_NONE, ///< (only used in prediction) no split MVs +}; + +typedef struct { + uint8_t filter_level; + uint8_t inner_limit; + uint8_t inner_filter; +} VP8FilterStrength; + +typedef struct { + uint8_t skip; + // todo: make it possible to check for at least (i4x4 or split_mv) + // in one op. are others needed? + uint8_t mode; + uint8_t ref_frame; + uint8_t partitioning; + VP56mv mv; + VP56mv bmv[16]; +} VP8Macroblock; + +typedef struct { + AVCodecContext *avctx; + DSPContext dsp; + VP8DSPContext vp8dsp; + H264PredContext hpc; + vp8_mc_func put_pixels_tab[3][3][3]; + AVFrame frames[4]; + AVFrame *framep[4]; + uint8_t *edge_emu_buffer; + VP56RangeCoder c; ///< header context, includes mb modes and motion vectors + int profile; + + int mb_width; /* number of horizontal MB */ + int mb_height; /* number of vertical MB */ + int linesize; + int uvlinesize; + + int keyframe; + int invisible; + int update_last; ///< update VP56_FRAME_PREVIOUS with the current one + int update_golden; ///< VP56_FRAME_NONE if not updated, or which frame to copy if so + int update_altref; + int deblock_filter; + + /** + * If this flag is not set, all the probability updates + * are discarded after this frame is decoded. + */ + int update_probabilities; + + /** + * All coefficients are contained in separate arith coding contexts. + * There can be 1, 2, 4, or 8 of these after the header context. + */ + int num_coeff_partitions; + VP56RangeCoder coeff_partition[8]; + + VP8Macroblock *macroblocks; + VP8Macroblock *macroblocks_base; + VP8FilterStrength *filter_strength; + + uint8_t *intra4x4_pred_mode_top; + uint8_t intra4x4_pred_mode_left[4]; + uint8_t *segmentation_map; + + /** + * Cache of the top row needed for intra prediction + * 16 for luma, 8 for each chroma plane + */ + uint8_t (*top_border)[16+8+8]; + + /** + * For coeff decode, we need to know whether the above block had non-zero + * coefficients. This means for each macroblock, we need data for 4 luma + * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9 + * per macroblock. We keep the last row in top_nnz. + */ + uint8_t (*top_nnz)[9]; + DECLARE_ALIGNED(8, uint8_t, left_nnz)[9]; + + /** + * This is the index plus one of the last non-zero coeff + * for each of the blocks in the current macroblock. + * So, 0 -> no coeffs + * 1 -> dc-only (special transform) + * 2+-> full transform + */ + DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4]; + DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16]; + DECLARE_ALIGNED(16, DCTELEM, block_dc)[16]; + uint8_t intra4x4_pred_mode_mb[16]; + + int chroma_pred_mode; ///< 8x8c pred mode of the current macroblock + int segment; ///< segment of the current macroblock + VP56mv mv_min; + VP56mv mv_max; + + int mbskip_enabled; + int sign_bias[4]; ///< one state [0, 1] per ref frame type + int ref_count[3]; + + /** + * Base parameters for segmentation, i.e. per-macroblock parameters. + * These must be kept unchanged even if segmentation is not used for + * a frame, since the values persist between interframes. + */ + struct { + int enabled; + int absolute_vals; + int update_map; + int8_t base_quant[4]; + int8_t filter_level[4]; ///< base loop filter level + } segmentation; + + /** + * Macroblocks can have one of 4 different quants in a frame when + * segmentation is enabled. + * If segmentation is disabled, only the first segment's values are used. + */ + struct { + // [0] - DC qmul [1] - AC qmul + int16_t luma_qmul[2]; + int16_t luma_dc_qmul[2]; ///< luma dc-only block quant + int16_t chroma_qmul[2]; + } qmat[4]; + + struct { + int simple; + int level; + int sharpness; + } filter; + + struct { + int enabled; ///< whether each mb can have a different strength based on mode/ref + + /** + * filter strength adjustment for the following macroblock modes: + * [0-3] - i16x16 (always zero) + * [4] - i4x4 + * [5] - zero mv + * [6] - inter modes except for zero or split mv + * [7] - split mv + * i16x16 modes never have any adjustment + */ + int8_t mode[VP8_MVMODE_SPLIT+1]; + + /** + * filter strength adjustment for macroblocks that reference: + * [0] - intra / VP56_FRAME_CURRENT + * [1] - VP56_FRAME_PREVIOUS + * [2] - VP56_FRAME_GOLDEN + * [3] - altref / VP56_FRAME_GOLDEN2 + */ + int8_t ref[4]; + } lf_delta; + + /** + * These are all of the updatable probabilities for binary decisions. + * They are only implictly reset on keyframes, making it quite likely + * for an interframe to desync if a prior frame's header was corrupt + * or missing outright! + */ + struct { + uint8_t segmentid[3]; + uint8_t mbskip; + uint8_t intra; + uint8_t last; + uint8_t golden; + uint8_t pred16x16[4]; + uint8_t pred8x8c[3]; + /* Padded to allow overreads */ + uint8_t token[4][17][3][NUM_DCT_TOKENS-1]; + uint8_t mvc[2][19]; + } prob[2]; +} VP8Context; + +#endif diff --git a/libavcodec/vp8data.h b/libavcodec/vp8data.h index 472b37aa47..af9b0d9188 100644 --- a/libavcodec/vp8data.h +++ b/libavcodec/vp8data.h @@ -21,46 +21,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -// TODO: move these #define and enum to a better header... - -#define VP8_MAX_QUANT 127 - -enum dct_token { - DCT_0, - DCT_1, - DCT_2, - DCT_3, - DCT_4, - DCT_CAT1, - DCT_CAT2, - DCT_CAT3, - DCT_CAT4, - DCT_CAT5, - DCT_CAT6, - DCT_EOB, - - NUM_DCT_TOKENS -}; +#ifndef AVCODEC_VP8DATA_H +#define AVCODEC_VP8DATA_H +#include "vp8.h" #include "h264pred.h" -// used to signal 4x4 intra pred in luma MBs -#define MODE_I4x4 4 - -enum inter_mvmode { - VP8_MVMODE_ZERO = MODE_I4x4 + 1, - VP8_MVMODE_MV, - VP8_MVMODE_SPLIT -}; - -enum inter_splitmvmode { - VP8_SPLITMVMODE_16x8 = 0, ///< 2 16x8 blocks (vertical) - VP8_SPLITMVMODE_8x16, ///< 2 8x16 blocks (horizontal) - VP8_SPLITMVMODE_8x8, ///< 2x2 blocks of 8x8px each - VP8_SPLITMVMODE_4x4, ///< 4x4 blocks of 4x4px each - VP8_SPLITMVMODE_NONE, ///< (only used in prediction) no split MVs -}; - static const uint8_t vp8_pred4x4_mode[] = { [DC_PRED8x8] = DC_PRED, @@ -718,3 +684,5 @@ static const uint8_t vp8_mv_default_prob[2][19] = { 204, 170, 119, 235, 140, 230, 228, 128, 130, 130, 74, 148, 180, 203, 236, 254, 254 } }; + +#endif From eb3755a5aa65da685d81399cfae4bd35e4a178b6 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 16 Feb 2011 10:20:54 -0800 Subject: [PATCH 402/528] Force inlining of avutil common routines On some versions of gcc, these weren't always getting inlined due to hitting the inline cap limit in some files. This is generally bad, as most of these functions are smaller inlined than not. --- libavutil/arm/intmath.h | 14 +++++++------- libavutil/common.h | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h index 2c0aa3b11c..8f03d4bf90 100644 --- a/libavutil/arm/intmath.h +++ b/libavutil/arm/intmath.h @@ -31,7 +31,7 @@ #if HAVE_ARMV6 #define FASTDIV FASTDIV -static inline av_const int FASTDIV(int a, int b) +static av_always_inline av_const int FASTDIV(int a, int b) { int r, t; __asm__ volatile("cmp %3, #2 \n\t" @@ -43,7 +43,7 @@ static inline av_const int FASTDIV(int a, int b) } #define av_clip_uint8 av_clip_uint8_arm -static inline av_const uint8_t av_clip_uint8_arm(int a) +static av_always_inline av_const uint8_t av_clip_uint8_arm(int a) { unsigned x; __asm__ volatile ("usat %0, #8, %1" : "=r"(x) : "r"(a)); @@ -51,7 +51,7 @@ static inline av_const uint8_t av_clip_uint8_arm(int a) } #define av_clip_int8 av_clip_int8_arm -static inline av_const uint8_t av_clip_int8_arm(int a) +static av_always_inline av_const uint8_t av_clip_int8_arm(int a) { unsigned x; __asm__ volatile ("ssat %0, #8, %1" : "=r"(x) : "r"(a)); @@ -59,7 +59,7 @@ static inline av_const uint8_t av_clip_int8_arm(int a) } #define av_clip_uint16 av_clip_uint16_arm -static inline av_const uint16_t av_clip_uint16_arm(int a) +static av_always_inline av_const uint16_t av_clip_uint16_arm(int a) { unsigned x; __asm__ volatile ("usat %0, #16, %1" : "=r"(x) : "r"(a)); @@ -67,7 +67,7 @@ static inline av_const uint16_t av_clip_uint16_arm(int a) } #define av_clip_int16 av_clip_int16_arm -static inline av_const int16_t av_clip_int16_arm(int a) +static av_always_inline av_const int16_t av_clip_int16_arm(int a) { int x; __asm__ volatile ("ssat %0, #16, %1" : "=r"(x) : "r"(a)); @@ -77,7 +77,7 @@ static inline av_const int16_t av_clip_int16_arm(int a) #else /* HAVE_ARMV6 */ #define FASTDIV FASTDIV -static inline av_const int FASTDIV(int a, int b) +static av_always_inline av_const int FASTDIV(int a, int b) { int r, t; __asm__ volatile("umull %1, %0, %2, %3" @@ -88,7 +88,7 @@ static inline av_const int FASTDIV(int a, int b) #endif /* HAVE_ARMV6 */ #define av_clipl_int32 av_clipl_int32_arm -static inline av_const int32_t av_clipl_int32_arm(int64_t a) +static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a) { int x, y; __asm__ volatile ("adds %1, %R2, %Q2, lsr #31 \n\t" diff --git a/libavutil/common.h b/libavutil/common.h index 6404076a13..5814297cf2 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -64,7 +64,7 @@ extern const uint8_t ff_log2_tab[256]; extern const uint8_t av_reverse[256]; -static inline av_const int av_log2_c(unsigned int v) +static av_always_inline av_const int av_log2_c(unsigned int v) { int n = 0; if (v & 0xffff0000) { @@ -80,7 +80,7 @@ static inline av_const int av_log2_c(unsigned int v) return n; } -static inline av_const int av_log2_16bit_c(unsigned int v) +static av_always_inline av_const int av_log2_16bit_c(unsigned int v) { int n = 0; if (v & 0xff00) { @@ -107,7 +107,7 @@ static inline av_const int av_log2_16bit_c(unsigned int v) * @param amax maximum value of the clip range * @return clipped value */ -static inline av_const int av_clip_c(int a, int amin, int amax) +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) { if (a < amin) return amin; else if (a > amax) return amax; @@ -119,7 +119,7 @@ static inline av_const int av_clip_c(int a, int amin, int amax) * @param a value to clip * @return clipped value */ -static inline av_const uint8_t av_clip_uint8_c(int a) +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) { if (a&(~0xFF)) return (-a)>>31; else return a; @@ -130,7 +130,7 @@ static inline av_const uint8_t av_clip_uint8_c(int a) * @param a value to clip * @return clipped value */ -static inline av_const int8_t av_clip_int8_c(int a) +static av_always_inline av_const int8_t av_clip_int8_c(int a) { if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; else return a; @@ -141,7 +141,7 @@ static inline av_const int8_t av_clip_int8_c(int a) * @param a value to clip * @return clipped value */ -static inline av_const uint16_t av_clip_uint16_c(int a) +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) { if (a&(~0xFFFF)) return (-a)>>31; else return a; @@ -152,7 +152,7 @@ static inline av_const uint16_t av_clip_uint16_c(int a) * @param a value to clip * @return clipped value */ -static inline av_const int16_t av_clip_int16_c(int a) +static av_always_inline av_const int16_t av_clip_int16_c(int a) { if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; else return a; @@ -163,7 +163,7 @@ static inline av_const int16_t av_clip_int16_c(int a) * @param a value to clip * @return clipped value */ -static inline av_const int32_t av_clipl_int32_c(int64_t a) +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) { if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; else return a; @@ -176,7 +176,7 @@ static inline av_const int32_t av_clipl_int32_c(int64_t a) * @param amax maximum value of the clip range * @return clipped value */ -static inline av_const float av_clipf_c(float a, float amin, float amax) +static av_always_inline av_const float av_clipf_c(float a, float amin, float amax) { if (a < amin) return amin; else if (a > amax) return amax; @@ -187,7 +187,7 @@ static inline av_const float av_clipf_c(float a, float amin, float amax) * @param x value used to compute ceil(log2(x)) * @return computed ceiling of log2(x) */ -static inline av_const int av_ceil_log2_c(int x) +static av_always_inline av_const int av_ceil_log2_c(int x) { return av_log2((x - 1) << 1); } @@ -197,7 +197,7 @@ static inline av_const int av_ceil_log2_c(int 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) +static av_always_inline av_const int av_popcount_c(uint32_t x) { x -= (x >> 1) & 0x55555555; x = (x & 0x33333333) + ((x >> 2) & 0x33333333); From 891b1f15a7e45a2a5f91cb4c27d11259ef8e012f Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 17 Feb 2011 13:56:26 -0800 Subject: [PATCH 403/528] VP8: init one less near_mv This one didn't actually need to be initialized. --- libavcodec/vp8.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 566ec65380..f71a7b7783 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -481,7 +481,6 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y) AV_ZERO32(&near_mv[0]); AV_ZERO32(&near_mv[1]); - AV_ZERO32(&near_mv[2]); /* Process MB on top, left and top-left */ #define MV_EDGE_CHECK(n)\ From ed040f35f298b39f1ddd45a133c82cb5d6d79dda Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 17 Feb 2011 19:33:33 -0500 Subject: [PATCH 404/528] Fix PPC build. --- libavcodec/ppc/h264_altivec.c | 6 ------ libavcodec/ppc/h264_template_altivec.c | 10 ++++++++++ libavcodec/ppc/vc1dsp_altivec.c | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/libavcodec/ppc/h264_altivec.c b/libavcodec/ppc/h264_altivec.c index aee2bc2d1a..ef95de1bec 100644 --- a/libavcodec/ppc/h264_altivec.c +++ b/libavcodec/ppc/h264_altivec.c @@ -32,7 +32,6 @@ #define OP_U8_ALTIVEC PUT_OP_U8_ALTIVEC #define PREFIX_h264_chroma_mc8_altivec put_h264_chroma_mc8_altivec -#define PREFIX_no_rnd_vc1_chroma_mc8_altivec put_no_rnd_vc1_chroma_mc8_altivec #define PREFIX_h264_chroma_mc8_num altivec_put_h264_chroma_mc8_num #define PREFIX_h264_qpel16_h_lowpass_altivec put_h264_qpel16_h_lowpass_altivec #define PREFIX_h264_qpel16_h_lowpass_num altivec_put_h264_qpel16_h_lowpass_num @@ -43,7 +42,6 @@ #include "h264_template_altivec.c" #undef OP_U8_ALTIVEC #undef PREFIX_h264_chroma_mc8_altivec -#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec #undef PREFIX_h264_chroma_mc8_num #undef PREFIX_h264_qpel16_h_lowpass_altivec #undef PREFIX_h264_qpel16_h_lowpass_num @@ -54,7 +52,6 @@ #define OP_U8_ALTIVEC AVG_OP_U8_ALTIVEC #define PREFIX_h264_chroma_mc8_altivec avg_h264_chroma_mc8_altivec -#define PREFIX_no_rnd_vc1_chroma_mc8_altivec avg_no_rnd_vc1_chroma_mc8_altivec #define PREFIX_h264_chroma_mc8_num altivec_avg_h264_chroma_mc8_num #define PREFIX_h264_qpel16_h_lowpass_altivec avg_h264_qpel16_h_lowpass_altivec #define PREFIX_h264_qpel16_h_lowpass_num altivec_avg_h264_qpel16_h_lowpass_num @@ -65,7 +62,6 @@ #include "h264_template_altivec.c" #undef OP_U8_ALTIVEC #undef PREFIX_h264_chroma_mc8_altivec -#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec #undef PREFIX_h264_chroma_mc8_num #undef PREFIX_h264_qpel16_h_lowpass_altivec #undef PREFIX_h264_qpel16_h_lowpass_num @@ -973,8 +969,6 @@ void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) { 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; - c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; #define dspfunc(PFX, IDX, NUM) \ c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \ diff --git a/libavcodec/ppc/h264_template_altivec.c b/libavcodec/ppc/h264_template_altivec.c index 8cf39c8be7..29e4d40d4f 100644 --- a/libavcodec/ppc/h264_template_altivec.c +++ b/libavcodec/ppc/h264_template_altivec.c @@ -75,6 +75,7 @@ #define noop(a) a #define add28(a) vec_add(v28ss, a) +#ifdef PREFIX_h264_chroma_mc8_altivec static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { DECLARE_ALIGNED(16, signed int, ABCD)[4] = @@ -201,8 +202,10 @@ static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, } } } +#endif /* this code assume that stride % 16 == 0 */ +#ifdef PREFIX_no_rnd_vc1_chroma_mc8_altivec static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { DECLARE_ALIGNED(16, signed int, ABCD)[4] = {((8 - x) * (8 - y)), @@ -284,12 +287,14 @@ static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, i } } } +#endif #undef noop #undef add28 #undef CHROMA_MC8_ALTIVEC_CORE /* this code assume stride % 16 == 0 */ +#ifdef PREFIX_h264_qpel16_h_lowpass_altivec static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) { register int i; @@ -427,8 +432,10 @@ static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, i dst += dstStride; } } +#endif /* this code assume stride % 16 == 0 */ +#ifdef PREFIX_h264_qpel16_v_lowpass_altivec static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) { register int i; @@ -533,8 +540,10 @@ static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, i dst += dstStride; } } +#endif /* this code assume stride % 16 == 0 *and* tmp is properly aligned */ +#ifdef PREFIX_h264_qpel16_hv_lowpass_altivec static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, uint8_t * src, int dstStride, int tmpStride, int srcStride) { register int i; LOAD_ZERO; @@ -765,3 +774,4 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, dst += dstStride; } } +#endif diff --git a/libavcodec/ppc/vc1dsp_altivec.c b/libavcodec/ppc/vc1dsp_altivec.c index 95774389a5..5a0dddbe1d 100644 --- a/libavcodec/ppc/vc1dsp_altivec.c +++ b/libavcodec/ppc/vc1dsp_altivec.c @@ -20,6 +20,7 @@ */ #include "libavcodec/dsputil.h" +#include "libavcodec/vc1dsp.h" #include "util_altivec.h" #include "dsputil_altivec.h" @@ -321,6 +322,20 @@ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block) ADD (dest, src3, perm1) } +#define PUT_OP_U8_ALTIVEC(d, s, dst) d = s +#define AVG_OP_U8_ALTIVEC(d, s, dst) d = vec_avg(dst, s) + +#define OP_U8_ALTIVEC PUT_OP_U8_ALTIVEC +#define PREFIX_no_rnd_vc1_chroma_mc8_altivec put_no_rnd_vc1_chroma_mc8_altivec +#include "h264_template_altivec.c" +#undef OP_U8_ALTIVEC +#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec + +#define OP_U8_ALTIVEC AVG_OP_U8_ALTIVEC +#define PREFIX_no_rnd_vc1_chroma_mc8_altivec avg_no_rnd_vc1_chroma_mc8_altivec +#include "h264_template_altivec.c" +#undef OP_U8_ALTIVEC +#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec void ff_vc1dsp_init_altivec(VC1DSPContext* dsp) { @@ -329,4 +344,6 @@ void ff_vc1dsp_init_altivec(VC1DSPContext* dsp) dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec; dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; + dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; } From 351423ae1f861da1c647d30c73503fde2b1f3dad Mon Sep 17 00:00:00 2001 From: Jean-Daniel Dupas Date: Fri, 18 Feb 2011 10:35:51 +0100 Subject: [PATCH 405/528] targa: fix potential buffer overreads Signed-off-by: Mans Rullgard --- libavcodec/targa.c | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/libavcodec/targa.c b/libavcodec/targa.c index ef6e92bddf..0892b6f0ed 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -33,22 +33,35 @@ typedef struct TargaContext { int compression_type; } TargaContext; -static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, uint8_t *dst, int w, int h, int stride, int bpp) +#define CHECK_BUFFER_SIZE(buf, buf_end, needed, where) \ + if(buf + needed > buf_end){ \ + av_log(avctx, AV_LOG_ERROR, "Problem: unexpected end of data while reading " where "\n"); \ + return -1; \ + } \ + +static int targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, int src_size, uint8_t *dst, int w, int h, int stride, int bpp) { int i, x, y; int depth = (bpp + 1) >> 3; int type, count; int diff; + const uint8_t *src_end = src + src_size; diff = stride - w * depth; x = y = 0; while(y < h){ + CHECK_BUFFER_SIZE(src, src_end, 1, "image type"); type = *src++; count = (type & 0x7F) + 1; type &= 0x80; if((x + count > w) && (x + count + 1 > (h - y) * w)){ av_log(avctx, AV_LOG_ERROR, "Packet went out of bounds: position (%i,%i) size %i\n", x, y, count); - return; + return -1; + } + if(type){ + CHECK_BUFFER_SIZE(src, src_end, depth, "image data"); + }else{ + CHECK_BUFFER_SIZE(src, src_end, count * depth, "image data"); } for(i = 0; i < count; i++){ switch(depth){ @@ -81,6 +94,7 @@ static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8 if(type) src += depth; } + return src_size; } static int decode_frame(AVCodecContext *avctx, @@ -88,7 +102,7 @@ static int decode_frame(AVCodecContext *avctx, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; + const uint8_t *buf_end = avpkt->data + avpkt->size; TargaContext * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p= (AVFrame*)&s->picture; @@ -98,6 +112,7 @@ static int decode_frame(AVCodecContext *avctx, int first_clr, colors, csize; /* parse image header */ + CHECK_BUFFER_SIZE(buf, buf_end, 18, "header"); idlen = *buf++; pal = *buf++; compr = *buf++; @@ -111,6 +126,7 @@ static int decode_frame(AVCodecContext *avctx, bpp = *buf++; flags = *buf++; //skip identifier if any + CHECK_BUFFER_SIZE(buf, buf_end, idlen, "identifiers"); buf += idlen; s->bpp = bpp; s->width = w; @@ -163,6 +179,7 @@ static int decode_frame(AVCodecContext *avctx, } } if(colors){ + size_t pal_size; if((colors + first_clr) > 256){ av_log(avctx, AV_LOG_ERROR, "Incorrect palette: %i colors with offset %i\n", colors, first_clr); return -1; @@ -171,8 +188,10 @@ static int decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "Palette entry size %i bits is not supported\n", csize); return -1; } + pal_size = colors * ((csize + 1) >> 3); + CHECK_BUFFER_SIZE(buf, buf_end, pal_size, "color table"); if(avctx->pix_fmt != PIX_FMT_PAL8)//should not occur but skip palette anyway - buf += colors * ((csize + 1) >> 3); + buf += pal_size; else{ int r, g, b, t; int32_t *pal = ((int32_t*)p->data[1]) + first_clr; @@ -188,9 +207,14 @@ static int decode_frame(AVCodecContext *avctx, if((compr & (~TGA_RLE)) == TGA_NODATA) memset(p->data[0], 0, p->linesize[0] * s->height); else{ - if(compr & TGA_RLE) - targa_decode_rle(avctx, s, buf, dst, avctx->width, avctx->height, stride, bpp); - else{ + if(compr & TGA_RLE){ + int res = targa_decode_rle(avctx, s, buf, buf_end - buf, dst, avctx->width, avctx->height, stride, bpp); + if (res < 0) + return -1; + buf += res; + }else{ + size_t img_size = s->width * ((s->bpp + 1) >> 3); + CHECK_BUFFER_SIZE(buf, buf_end, img_size, "image data"); for(y = 0; y < s->height; y++){ #if HAVE_BIGENDIAN if((s->bpp + 1) >> 3 == 2){ @@ -203,10 +227,10 @@ static int decode_frame(AVCodecContext *avctx, dst32[x] = AV_RL32(buf + x * 4); }else #endif - memcpy(dst, buf, s->width * ((s->bpp + 1) >> 3)); + memcpy(dst, buf, img_size); dst += stride; - buf += s->width * ((s->bpp + 1) >> 3); + buf += img_size; } } } @@ -214,7 +238,7 @@ static int decode_frame(AVCodecContext *avctx, *picture= *(AVFrame*)&s->picture; *data_size = sizeof(AVPicture); - return buf_size; + return avpkt->size; } static av_cold int targa_init(AVCodecContext *avctx){ From 902685b8abf4e2089802528a32a50f3c68033fda Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 17 Feb 2011 20:24:05 -0800 Subject: [PATCH 406/528] VP3: fix decoding of videos with stride > 2048 Also remove qscale_table code; this didn't make sense anyways as VP3 doesn't use an MPEG-like quantizer scale. --- libavcodec/vp3.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index ee41846e74..97051f7065 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -237,8 +237,7 @@ typedef struct Vp3DecodeContext { * is coded. */ unsigned char *macroblock_coding; - uint8_t edge_emu_buffer[9*2048]; //FIXME dynamic alloc - int8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16 + uint8_t *edge_emu_buffer; /* Huffman decode */ int hti; @@ -325,8 +324,6 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi) s->qmat[qpi][inter][plane][0] = s->qmat[0][inter][plane][0]; } } - - memset(s->qscale_table, (FFMAX(s->qmat[0][0][0][1], s->qmat[0][0][1][1])+8)/16, 512); //FIXME finetune } /* @@ -1409,10 +1406,6 @@ static void render_slice(Vp3DecodeContext *s, int slice) if (CONFIG_GRAY && plane && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; - - if(FFABS(stride) > 2048) - return; //various tables are fixed size - /* for each superblock row in the slice (both of them)... */ for (; sb_y < slice_height; sb_y++) { @@ -1817,10 +1810,8 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext * } } - if (s->qps[0] != s1->qps[0]) { - memcpy(&s->qscale_table, &s1->qscale_table, sizeof(s->qscale_table)); + if (s->qps[0] != s1->qps[0]) memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array)); - } if (qps_changed) copy_fields(s, s1, qps, superblock_count); @@ -1892,6 +1883,9 @@ static int vp3_decode_frame(AVCodecContext *avctx, goto error; } + if (!s->edge_emu_buffer) + s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0])); + if (s->keyframe) { if (!s->theora) { @@ -1925,9 +1919,6 @@ static int vp3_decode_frame(AVCodecContext *avctx, } } - s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame - s->current_frame.qstride= 0; - memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment)); ff_thread_finish_setup(avctx); @@ -2007,6 +1998,7 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) av_free(s->macroblock_coding); av_free(s->motion_val[0]); av_free(s->motion_val[1]); + av_free(s->edge_emu_buffer); if (avctx->is_copy) return 0; From 9707f84fa73c23352937fc7e4e0a85eaf3135cbc Mon Sep 17 00:00:00 2001 From: Young Han Lee Date: Sat, 19 Feb 2011 09:32:24 +0900 Subject: [PATCH 407/528] aacdec: dsputilize the scalar multiplication in intensity stereo --- libavcodec/aacdec.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index ee5affebed..a362d6ad4e 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -1386,13 +1386,13 @@ static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe) * [1] mask is decoded from bitstream; [2] mask is all 1s; * [3] reserved for scalable AAC */ -static void apply_intensity_stereo(ChannelElement *cpe, int ms_present) +static void apply_intensity_stereo(AACContext *ac, ChannelElement *cpe, int ms_present) { const IndividualChannelStream *ics = &cpe->ch[1].ics; SingleChannelElement *sce1 = &cpe->ch[1]; float *coef0 = cpe->ch[0].coeffs, *coef1 = cpe->ch[1].coeffs; const uint16_t *offsets = ics->swb_offset; - int g, group, i, k, idx = 0; + int g, group, i, idx = 0; int c; float scale; for (g = 0; g < ics->num_window_groups; g++) { @@ -1405,8 +1405,10 @@ static void apply_intensity_stereo(ChannelElement *cpe, int ms_present) c *= 1 - 2 * cpe->ms_mask[idx]; scale = c * sce1->sf[idx]; for (group = 0; group < ics->group_len[g]; group++) - for (k = offsets[i]; k < offsets[i + 1]; k++) - coef1[group * 128 + k] = scale * coef0[group * 128 + k]; + ac->dsp.vector_fmul_scalar(coef1 + group * 128 + offsets[i], + coef0 + group * 128 + offsets[i], + scale, + offsets[i + 1] - offsets[i]); } } else { int bt_run_end = sce1->band_type_run_end[idx]; @@ -1459,7 +1461,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe) } } - apply_intensity_stereo(cpe, ms_present); + apply_intensity_stereo(ac, cpe, ms_present); return 0; } From a89f4ca005efa5ee82089583c7b8bc00bcee816a Mon Sep 17 00:00:00 2001 From: David Conrad Date: Sat, 19 Feb 2011 01:41:51 -0800 Subject: [PATCH 408/528] Fix VP3 edge emulation With negative stride, the start of the edge_emu buffer should be pointing to the last line, not the end of the buffer. With positive stride, pointing to the end of the buffer was completely wrong. --- libavcodec/vp3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 97051f7065..3d4bfb4d91 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1459,8 +1459,7 @@ static void render_slice(Vp3DecodeContext *s, int slice) if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){ uint8_t *temp= s->edge_emu_buffer; - if(stride<0) temp -= 9*stride; - else temp += 9*stride; + if(stride<0) temp -= 8*stride; s->dsp.emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height); motion_source= temp; From 2bbec1eda46d907605772a8b6e8263caa4bc4c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sat, 19 Feb 2011 11:33:01 +0100 Subject: [PATCH 409/528] Fix invalid reads in VC1 decoder Patch discussed and taken from https://roundup.ffmpeg.org/issue2584 --- libavcodec/vc1dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 6707cdec71..7eb9576c69 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1376,7 +1376,7 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value, if (index != vc1_ac_sizes[codingset] - 1) { run = vc1_index_decode_table[codingset][index][0]; level = vc1_index_decode_table[codingset][index][1]; - lst = index >= vc1_last_decode_table[codingset]; + lst = index >= vc1_last_decode_table[codingset] || get_bits_left(gb) < 0; if(get_bits1(gb)) level = -level; } else { From bf6fa732459399fac215bdfa44dd39a6fb1d1e01 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 19 Feb 2011 08:50:37 -0500 Subject: [PATCH 410/528] dsputil_mmx.c: remove ff_vector128. Remove ff_vector128, it is identical to ff_pb_80. --- libavcodec/x86/dsputil_mmx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 16ad965ec1..a5b0b3ae61 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -286,9 +286,6 @@ void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_s :"memory"); } -DECLARE_ASM_CONST(8, uint8_t, ff_vector128)[8] = - { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; - #define put_signed_pixels_clamped_mmx_half(off) \ "movq "#off"(%2), %%mm1 \n\t"\ "movq 16+"#off"(%2), %%mm2 \n\t"\ @@ -313,7 +310,7 @@ void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int x86_reg line_skip3; __asm__ volatile ( - "movq "MANGLE(ff_vector128)", %%mm0 \n\t" + "movq "MANGLE(ff_pb_80)", %%mm0 \n\t" "lea (%3, %3, 2), %1 \n\t" put_signed_pixels_clamped_mmx_half(0) "lea (%0, %3, 4), %0 \n\t" From 74d6871d6244865b5863a01c3dab16a2f06a1706 Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Sat, 19 Feb 2011 17:33:15 +0100 Subject: [PATCH 411/528] MMS: also discover streams in extended stream properties object Allows playback of nonprimary audio streams in multiple bitrate sources, such as mmsh://wmscr1.dr.dk/e02ch03m Signed-off-by: Ronald S. Bultje --- libavformat/mms.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/libavformat/mms.c b/libavformat/mms.c index d995a43a0e..b541208e31 100644 --- a/libavformat/mms.c +++ b/libavformat/mms.c @@ -115,6 +115,34 @@ int ff_mms_asf_header_parser(MMSContext *mms) "Corrupt stream (too many A/V streams)\n"); return AVERROR_INVALIDDATA; } + } else if (!memcmp(p, ff_asf_ext_stream_header, sizeof(ff_asf_guid))) { + if (end - p >= 88) { + int stream_count = AV_RL16(p + 84), ext_len_count = AV_RL16(p + 86); + uint64_t skip_bytes = 88; + while (stream_count--) { + if (end - p < skip_bytes + 4) { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (next stream name length is not in the buffer)\n"); + return AVERROR_INVALIDDATA; + } + skip_bytes += 4 + AV_RL16(p + skip_bytes + 2); + } + while (ext_len_count--) { + if (end - p < skip_bytes + 22) { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (next extension system info length is not in the buffer)\n"); + return AVERROR_INVALIDDATA; + } + skip_bytes += 22 + AV_RL32(p + skip_bytes + 18); + } + if (end - p < skip_bytes) { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (the last extension system info length is invalid)\n"); + return AVERROR_INVALIDDATA; + } + if (chunksize - skip_bytes > 24) + chunksize = skip_bytes; + } } 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. } From 87f1355f9b4fc11414d0e6a91404203c2745f89f Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 16 Feb 2011 02:39:42 +0000 Subject: [PATCH 412/528] x86: check for AVX support This adds configure and runtime checks for AVX support on x86 CPUs. Signed-off-by: Mans Rullgard --- configure | 4 ++++ libavutil/cpu.c | 3 ++- libavutil/cpu.h | 1 + libavutil/x86/cpu.c | 12 ++++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure b/configure index ed2934d33f..50113875e3 100755 --- a/configure +++ b/configure @@ -222,6 +222,7 @@ Advanced options (experts only): --disable-mmx2 disable MMX2 optimizations --disable-sse disable SSE optimizations --disable-ssse3 disable SSSE3 optimizations + --disable-avx disable AVX optimizations --disable-armv5te disable armv5te optimizations --disable-armv6 disable armv6 optimizations --disable-armv6t2 disable armv6t2 optimizations @@ -975,6 +976,7 @@ ARCH_EXT_LIST=' armv6 armv6t2 armvfp + avx iwmmxt mmi mmx @@ -1183,6 +1185,7 @@ mmx_deps="x86" mmx2_deps="mmx" sse_deps="mmx" ssse3_deps="sse" +avx_deps="ssse3" aligned_stack_if_any="ppc x86" fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64" @@ -2676,6 +2679,7 @@ EOF check_yasm "pextrd [eax], xmm0, 1" && enable yasm || die "yasm not found, use --disable-yasm for a crippled build" + check_yasm "vpaddw xmm0, xmm0, xmm0" || disable avx fi case "$cpu" in diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 1e034914de..3459ce435d 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -44,7 +44,7 @@ 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", + printf("cpu_flags = %s%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 @@ -60,6 +60,7 @@ int main(void) 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_AVX ? "AVX " : "", cpu_flags & AV_CPU_FLAG_3DNOW ? "3DNow " : "", cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt " : ""); #endif diff --git a/libavutil/cpu.h b/libavutil/cpu.h index 71cc26529a..d60e062e19 100644 --- a/libavutil/cpu.h +++ b/libavutil/cpu.h @@ -36,6 +36,7 @@ #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_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used #define AV_CPU_FLAG_IWMMXT 0x0100 ///< XScale IWMMXT #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index 6fa4a46567..2caac2fb23 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -35,6 +35,9 @@ "=c" (ecx), "=d" (edx)\ : "0" (index)); +#define xgetbv(index,eax,edx) \ + __asm__ ("xgetbv" : "=a"(eax), "=d"(edx) : "c" (index)) + /* Function to test if multimedia instructions are supported... */ int ff_get_cpu_flags_x86(void) { @@ -93,6 +96,15 @@ int ff_get_cpu_flags_x86(void) rval |= AV_CPU_FLAG_SSE4; if (ecx & 0x00100000 ) rval |= AV_CPU_FLAG_SSE42; +#if HAVE_AVX + /* Check OXSAVE and AVX bits */ + if ((ecx & 0x18000000) == 0x18000000) { + /* Check for OS support */ + xgetbv(0, eax, edx); + if ((eax & 0x6) == 0x6) + rval |= AV_CPU_FLAG_AVX; + } +#endif #endif ; } From 70aa916e4630bcec14439a2d703074b6d4c890a8 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 19 Feb 2011 19:07:29 -0500 Subject: [PATCH 413/528] VC1: don't use vc1_put_block() in vc1_decode_i_blocks_adv(). Advanced profile never uses "range reduction", so vc1_put_block() quite literally just calls put_pixels_clamped() from vc1_decode_i_blocks_adv(). By inlining the function, we can prevent calling IDCT8x8 if CODEC_FLAG_GRAY is set, and we don't have to scale the coeffs in the [0,256] range, but can instead use put_signed_pixels_clamped(). --- libavcodec/vc1dec.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 7eb9576c69..aff851487b 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -2704,7 +2704,7 @@ static void vc1_decode_i_blocks(VC1Context *v) */ static void vc1_decode_i_blocks_adv(VC1Context *v) { - int k, j; + int k; MpegEncContext *s = &v->s; int cbp, val; uint8_t *coded_val; @@ -2747,7 +2747,14 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) s->mb_x = 0; ff_init_block_index(s); for(;s->mb_x < s->mb_width; s->mb_x++) { + uint8_t *dst[6]; ff_update_block_index(s); + dst[0] = s->dest[0]; + dst[1] = dst[0] + 8; + dst[2] = s->dest[0] + s->linesize * 8; + dst[3] = dst[2] + 8; + dst[4] = s->dest[1]; + dst[5] = s->dest[2]; s->dsp.clear_blocks(s->block[0]); mb_pos = s->mb_x + s->mb_y * s->mb_stride; s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; @@ -2791,11 +2798,12 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); + if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); - for(j = 0; j < 64; j++) s->block[k][j] += 128; + s->dsp.put_signed_pixels_clamped(s->block[k], dst[k], + k & 4 ? s->uvlinesize : s->linesize); } - vc1_put_block(v, s->block); if(overlap) { if(s->mb_x) { v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); From ae628ec1fd7f54c102bf9e667a3edd404b9b9128 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 20 Feb 2011 11:04:12 +0100 Subject: [PATCH 414/528] avio: rename ByteIOContext to AVIOContext. Signed-off-by: Ronald S. Bultje --- ffserver.c | 10 +- libavformat/4xm.c | 4 +- libavformat/adtsenc.c | 2 +- libavformat/aiffdec.c | 6 +- libavformat/aiffenc.c | 6 +- libavformat/amr.c | 4 +- libavformat/anm.c | 4 +- libavformat/apc.c | 2 +- libavformat/ape.c | 2 +- libavformat/apetag.c | 4 +- libavformat/applehttp.c | 8 +- libavformat/asf.h | 2 +- libavformat/asfdec.c | 28 +++--- libavformat/asfenc.c | 26 ++--- libavformat/assdec.c | 2 +- libavformat/au.c | 10 +- libavformat/avc.c | 6 +- libavformat/avc.h | 4 +- libavformat/avformat.h | 10 +- libavformat/avidec.c | 16 +-- libavformat/avienc.c | 16 +-- libavformat/avio.h | 188 ++++++++++++++++++----------------- libavformat/aviobuf.c | 140 +++++++++++++------------- libavformat/bethsoftvid.c | 6 +- libavformat/bfi.c | 4 +- libavformat/bink.c | 4 +- libavformat/c93.c | 4 +- libavformat/cafdec.c | 12 +-- libavformat/daud.c | 2 +- libavformat/dsicin.c | 8 +- libavformat/dxa.c | 2 +- libavformat/eacdata.c | 2 +- libavformat/electronicarts.c | 16 +-- libavformat/ffmdec.c | 10 +- libavformat/ffmenc.c | 6 +- libavformat/ffmetadec.c | 2 +- libavformat/ffmetaenc.c | 4 +- libavformat/filmstripdec.c | 2 +- libavformat/filmstripenc.c | 2 +- libavformat/flacenc.c | 6 +- libavformat/flacenc.h | 2 +- libavformat/flacenc_header.c | 2 +- libavformat/flic.c | 4 +- libavformat/flvdec.c | 6 +- libavformat/flvenc.c | 14 +-- libavformat/gif.c | 10 +- libavformat/gxf.c | 18 ++-- libavformat/gxfenc.c | 52 +++++----- libavformat/id3v2.c | 8 +- libavformat/idcin.c | 4 +- libavformat/idroqdec.c | 4 +- libavformat/iff.c | 4 +- libavformat/img2.c | 4 +- libavformat/internal.h | 8 +- libavformat/ipmovie.c | 8 +- libavformat/isom.c | 6 +- libavformat/isom.h | 12 +-- libavformat/iss.c | 4 +- libavformat/ivfenc.c | 4 +- libavformat/libnut.c | 12 +-- libavformat/lmlm4.c | 2 +- libavformat/lxfdec.c | 6 +- libavformat/matroskadec.c | 22 ++-- libavformat/matroskaenc.c | 56 +++++------ libavformat/mm.c | 4 +- libavformat/mmf.c | 12 +-- libavformat/mmst.c | 2 +- libavformat/mov.c | 98 +++++++++--------- libavformat/movenc.c | 136 ++++++++++++------------- libavformat/movenchint.c | 10 +- libavformat/mp3enc.c | 4 +- libavformat/mpc8.c | 6 +- libavformat/mpeg.c | 8 +- libavformat/mpegenc.c | 4 +- libavformat/mpegts.c | 10 +- libavformat/mpegtsenc.c | 2 +- libavformat/msnwc_tcp.c | 4 +- libavformat/mtv.c | 4 +- libavformat/mvi.c | 6 +- libavformat/mxfdec.c | 36 +++---- libavformat/mxfenc.c | 66 ++++++------ libavformat/nsvdec.c | 8 +- libavformat/nutdec.c | 40 ++++---- libavformat/nutenc.c | 36 +++---- libavformat/nuv.c | 6 +- libavformat/oggdec.c | 6 +- libavformat/oggenc.c | 4 +- libavformat/psxstr.c | 4 +- libavformat/pva.c | 6 +- libavformat/qcp.c | 4 +- libavformat/rdt.c | 4 +- libavformat/riff.c | 12 +-- libavformat/riff.h | 12 +-- libavformat/rl2.c | 4 +- libavformat/rm.h | 12 +-- libavformat/rmdec.c | 24 ++--- libavformat/rmenc.c | 14 +-- libavformat/rpl.c | 8 +- libavformat/rsodec.c | 2 +- libavformat/rsoenc.c | 4 +- libavformat/rtpdec.c | 4 +- libavformat/rtpdec_asf.c | 10 +- libavformat/rtpdec_latm.c | 2 +- libavformat/rtpdec_qt.c | 2 +- libavformat/rtpdec_svq3.c | 2 +- libavformat/rtpdec_vp8.c | 2 +- libavformat/rtpdec_xiph.c | 2 +- libavformat/rtsp.c | 2 +- libavformat/rtsp.h | 4 +- libavformat/sapdec.c | 2 +- libavformat/sauce.c | 2 +- libavformat/segafilm.c | 4 +- libavformat/sierravmd.c | 4 +- libavformat/siff.c | 6 +- libavformat/smacker.c | 2 +- libavformat/sol.c | 2 +- libavformat/soxdec.c | 2 +- libavformat/soxenc.c | 6 +- libavformat/spdifdec.c | 2 +- libavformat/spdifenc.c | 2 +- libavformat/swfdec.c | 6 +- libavformat/swfenc.c | 14 +-- libavformat/thp.c | 4 +- libavformat/tiertexseq.c | 10 +- libavformat/tmv.c | 4 +- libavformat/tty.c | 2 +- libavformat/txd.c | 2 +- libavformat/utils.c | 14 +-- libavformat/vc1test.c | 4 +- libavformat/vc1testenc.c | 6 +- libavformat/vocdec.c | 4 +- libavformat/vocenc.c | 4 +- libavformat/wav.c | 16 +-- libavformat/wc3movie.c | 4 +- libavformat/westwood.c | 8 +- libavformat/wtv.c | 36 +++---- libavformat/wv.c | 4 +- libavformat/xa.c | 4 +- libavformat/yop.c | 4 +- libavformat/yuv4mpeg.c | 4 +- 140 files changed, 854 insertions(+), 850 deletions(-) diff --git a/ffserver.c b/ffserver.c index 74bce851b9..ecc3f74d67 100644 --- a/ffserver.c +++ b/ffserver.c @@ -163,7 +163,7 @@ typedef struct HTTPContext { /* RTSP state specific */ uint8_t *pb_buffer; /* XXX: use that in all the code */ - ByteIOContext *pb; + AVIOContext *pb; int seq; /* RTSP sequence number */ /* RTP state specific */ @@ -1854,7 +1854,7 @@ static int http_parse_request(HTTPContext *c) return 0; } -static void fmt_bytecount(ByteIOContext *pb, int64_t count) +static void fmt_bytecount(AVIOContext *pb, int64_t count) { static const char *suffix = " kMGTP"; const char *s; @@ -1871,7 +1871,7 @@ static void compute_status(HTTPContext *c) char *p; time_t ti; int i, len; - ByteIOContext *pb; + AVIOContext *pb; if (url_open_dyn_buf(&pb) < 0) { /* XXX: return an error ? */ @@ -2491,7 +2491,7 @@ static int http_send_data(HTTPContext *c) if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP) { /* RTP packets are sent inside the RTSP TCP connection */ - ByteIOContext *pb; + AVIOContext *pb; int interleaved_index, size; uint8_t header[4]; HTTPContext *rtsp_c; @@ -2712,7 +2712,7 @@ static int http_receive_data(HTTPContext *c) } else { /* We have a header in our hands that contains useful data */ AVFormatContext *s = NULL; - ByteIOContext *pb; + AVIOContext *pb; AVInputFormat *fmt_in; int i; diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 6f737e3428..033c962fda 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -92,7 +92,7 @@ static int fourxm_probe(AVProbeData *p) static int fourxm_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; int header_size; @@ -244,7 +244,7 @@ static int fourxm_read_packet(AVFormatContext *s, AVPacket *pkt) { FourxmDemuxContext *fourxm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size, out_size; int ret = 0; diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index f309c896b3..c2cb16112c 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -118,7 +118,7 @@ int ff_adts_write_frame_header(ADTSContext *ctx, static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) { ADTSContext *adts = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t buf[ADTS_HEADER_SIZE]; if (!pkt->size) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index b841023701..712f85cda3 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -47,7 +47,7 @@ static enum CodecID aiff_codec_get_id(int bps) } /* returns the size of the found tag */ -static int get_tag(ByteIOContext *pb, uint32_t * tag) +static int get_tag(AVIOContext *pb, uint32_t * tag) { int size; @@ -83,7 +83,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) } /* Returns the number of sound data frames or negative on error */ -static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec, +static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec, int size, unsigned version) { AVExtFloat ext; @@ -177,7 +177,7 @@ static int aiff_read_header(AVFormatContext *s, int64_t offset = 0; uint32_t tag; unsigned version = AIFF_C_VERSION1; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream * st; AIFFInputContext *aiff = s->priv_data; diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index 6e473907b0..178bbec42a 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -31,7 +31,7 @@ typedef struct { static int aiff_write_header(AVFormatContext *s) { AIFFOutputContext *aiff = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; AVExtFloat sample_rate; int aifc = 0; @@ -104,14 +104,14 @@ static int aiff_write_header(AVFormatContext *s) static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; put_buffer(pb, pkt->data, pkt->size); return 0; } static int aiff_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AIFFOutputContext *aiff = s->priv_data; AVCodecContext *enc = s->streams[0]->codec; diff --git a/libavformat/amr.c b/libavformat/amr.c index 11bb4e513c..6ab8b3c668 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -33,7 +33,7 @@ static const char AMRWB_header [] = "#!AMR-WB\n"; #if CONFIG_AMR_MUXER static int amr_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; s->priv_data = NULL; @@ -78,7 +78,7 @@ static int amr_probe(AVProbeData *p) static int amr_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; uint8_t header[9]; diff --git a/libavformat/anm.c b/libavformat/anm.c index dbe1b68846..b754518113 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -79,7 +79,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { AnmDemuxContext *anm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int i, ret; @@ -177,7 +177,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { AnmDemuxContext *anm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; Page *p; int tmp, record_size; diff --git a/libavformat/apc.c b/libavformat/apc.c index 942a4cf3ef..7641d9f0d1 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -32,7 +32,7 @@ static int apc_probe(AVProbeData *p) static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; get_le32(pb); /* CRYO */ diff --git a/libavformat/ape.c b/libavformat/ape.c index 327e1a9b20..53b609fe4d 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -151,7 +151,7 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx) static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; APEContext *ape = s->priv_data; AVStream *st; uint32_t tag; diff --git a/libavformat/apetag.c b/libavformat/apetag.c index d30c13222a..3265646f78 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -33,7 +33,7 @@ static int ape_tag_read_field(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t key[1024], *value; uint32_t size, flags; int i, c; @@ -65,7 +65,7 @@ static int ape_tag_read_field(AVFormatContext *s) void ff_ape_parse_tag(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int file_size = url_fsize(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 37a040cf34..e35aaa8ac4 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -50,13 +50,13 @@ struct segment { /* * Each variant has its own demuxer. If it currently is active, - * it has an open ByteIOContext too, and potentially an AVPacket + * it has an open AVIOContext too, and potentially an AVPacket * containing the next packet from this stream. */ struct variant { int bandwidth; char url[MAX_URL_SIZE]; - ByteIOContext *pb; + AVIOContext *pb; AVFormatContext *ctx; AVPacket pkt; int stream_offset; @@ -78,7 +78,7 @@ typedef struct AppleHTTPContext { int max_start_seq, min_end_seq; } AppleHTTPContext; -static int read_chomp_line(ByteIOContext *s, char *buf, int maxlen) +static int read_chomp_line(AVIOContext *s, char *buf, int maxlen) { int len = ff_get_line(s, buf, maxlen); while (len > 0 && isspace(buf[len - 1])) @@ -202,7 +202,7 @@ static void handle_variant_args(struct variant_info *info, const char *key, } static int parse_playlist(AppleHTTPContext *c, const char *url, - struct variant *var, ByteIOContext *in) + struct variant *var, AVIOContext *in) { int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0; char line[1024]; diff --git a/libavformat/asf.h b/libavformat/asf.h index e89bd28e92..94c93d2c0f 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -178,6 +178,6 @@ static av_always_inline int ff_guidcmp(const void *g1, const void *g2) return memcmp(g1, g2, sizeof(ff_asf_guid)); } -void ff_get_guid(ByteIOContext *s, ff_asf_guid *g); +void ff_get_guid(AVIOContext *s, ff_asf_guid *g); #endif /* AVFORMAT_ASF_H */ diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 8d413e415a..f5f439a2df 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -132,7 +132,7 @@ static void print_guid(const ff_asf_guid *g) #define print_guid(g) #endif -void ff_get_guid(ByteIOContext *s, ff_asf_guid *g) +void ff_get_guid(AVIOContext *s, ff_asf_guid *g) { assert(sizeof(*g) == 16); get_buffer(s, *g, sizeof(*g)); @@ -147,7 +147,7 @@ static int asf_probe(AVProbeData *pd) return 0; } -static int get_value(ByteIOContext *pb, int type){ +static int get_value(AVIOContext *pb, int type){ switch(type){ case 2: return get_le32(pb); case 3: return get_le32(pb); @@ -188,7 +188,7 @@ finish: static int asf_read_file_properties(AVFormatContext *s, int64_t size) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ff_get_guid(pb, &asf->hdr.guid); asf->hdr.file_size = get_le64(pb); @@ -210,7 +210,7 @@ static int asf_read_file_properties(AVFormatContext *s, int64_t size) static int asf_read_stream_properties(AVFormatContext *s, int64_t size) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; ASFStream *asf_st; ff_asf_guid g; @@ -396,7 +396,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ff_asf_guid g; int ext_len, payload_ext_ct, stream_ct, i; uint32_t ext_d, leak_rate, stream_num; @@ -443,7 +443,7 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) static int asf_read_content_desc(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int len1, len2, len3, len4, len5; len1 = get_le16(pb); @@ -462,7 +462,7 @@ static int asf_read_content_desc(AVFormatContext *s, int64_t size) static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ASFContext *asf = s->priv_data; int desc_count, i, ret; @@ -497,7 +497,7 @@ static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) static int asf_read_language_list(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ASFContext *asf = s->priv_data; int j, ret; int stream_count = get_le16(pb); @@ -515,7 +515,7 @@ static int asf_read_language_list(AVFormatContext *s, int64_t size) static int asf_read_metadata(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ASFContext *asf = s->priv_data; int n, stream_num, name_len, value_len, value_type, value_num; int ret, i; @@ -547,7 +547,7 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size) static int asf_read_marker(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i, count, name_len, ret; char name[1024]; @@ -582,7 +582,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) { ASFContext *asf = s->priv_data; ff_asf_guid g; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; int64_t gsize; @@ -716,7 +716,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) * @param pb context to read data from * @return 0 on success, <0 on error */ -static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb) +static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) { ASFContext *asf = s->priv_data; uint32_t packet_length, padsize; @@ -801,7 +801,7 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb) * * @return <0 if error */ -static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){ +static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ ASFContext *asf = s->priv_data; int rsize = 1; int num = get_byte(pb); @@ -880,7 +880,7 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){ * @return 0 if data was stored in pkt, <0 on error or 1 if more ASF * packets need to be loaded (through asf_get_packet()) */ -static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) +static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) { ASFContext *asf = s->priv_data; ASFStream *asf_st = 0; diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 709080fbbb..4751665a56 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -202,7 +202,7 @@ typedef struct { int packet_timestamp_end; unsigned int packet_nb_payloads; uint8_t packet_buf[PACKET_SIZE]; - ByteIOContext pb; + AVIOContext pb; /* only for reading */ uint64_t data_offset; ///< beginning of the first data packet @@ -222,17 +222,17 @@ static const AVCodecTag codec_asf_bmp_tags[] = { #define PREROLL_TIME 3100 -static void put_guid(ByteIOContext *s, const ff_asf_guid *g) +static void put_guid(AVIOContext *s, const ff_asf_guid *g) { assert(sizeof(*g) == 16); put_buffer(s, *g, sizeof(*g)); } -static void put_str16(ByteIOContext *s, const char *tag) +static void put_str16(AVIOContext *s, const char *tag) { int len; uint8_t *pb; - ByteIOContext *dyn_buf; + AVIOContext *dyn_buf; if (url_open_dyn_buf(&dyn_buf) < 0) return; @@ -243,7 +243,7 @@ static void put_str16(ByteIOContext *s, const char *tag) av_freep(&pb); } -static int64_t put_header(ByteIOContext *pb, const ff_asf_guid *g) +static int64_t put_header(AVIOContext *pb, const ff_asf_guid *g) { int64_t pos; @@ -254,7 +254,7 @@ static int64_t put_header(ByteIOContext *pb, const ff_asf_guid *g) } /* update header size */ -static void end_header(ByteIOContext *pb, int64_t pos) +static void end_header(AVIOContext *pb, int64_t pos) { int64_t pos1; @@ -268,7 +268,7 @@ static void end_header(ByteIOContext *pb, int64_t pos) static void put_chunk(AVFormatContext *s, int type, int payload_length, int flags) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int length; length = payload_length + 8; @@ -294,7 +294,7 @@ static int64_t unix_to_file_time(int ti) static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVMetadataTag *tags[5]; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int has_title; @@ -363,7 +363,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data if (has_title) { int len; uint8_t *buf; - ByteIOContext *dyn_buf; + AVIOContext *dyn_buf; if (url_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); @@ -479,7 +479,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data const char *desc; int len; uint8_t *buf; - ByteIOContext *dyn_buf; + AVIOContext *dyn_buf; enc = s->streams[n]->codec; p = avcodec_find_encoder(enc->codec_id); @@ -602,7 +602,7 @@ static int put_payload_parsing_info( ) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ppi_size, i; int64_t start= url_ftell(pb); @@ -691,7 +691,7 @@ static void put_payload_header( ) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = &asf->pb; + AVIOContext *pb = &asf->pb; int val; val = stream->num; @@ -832,7 +832,7 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) // static int asf_write_index(AVFormatContext *s, ASFIndex *index, uint16_t max, uint32_t count) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; put_guid(pb, &ff_asf_simple_index_header); diff --git a/libavformat/assdec.c b/libavformat/assdec.c index 86f03390a7..e04d92ae65 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -76,7 +76,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { int i, len, header_remaining; ASSContext *ass = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int allocated[2]={0}; uint8_t *p, **dst[2]={0}; diff --git a/libavformat/au.c b/libavformat/au.c index e18022dd79..fbcbc5ba07 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -49,7 +49,7 @@ static const AVCodecTag codec_au_tags[] = { #if CONFIG_AU_MUXER /* AUDIO_FILE header */ -static int put_au_header(ByteIOContext *pb, AVCodecContext *enc) +static int put_au_header(AVIOContext *pb, AVCodecContext *enc) { if(!enc->codec_tag) return -1; @@ -64,7 +64,7 @@ static int put_au_header(ByteIOContext *pb, AVCodecContext *enc) static int au_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; s->priv_data = NULL; @@ -80,14 +80,14 @@ static int au_write_header(AVFormatContext *s) static int au_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; put_buffer(pb, pkt->data, pkt->size); return 0; } static int au_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t file_size; if (!url_is_streamed(s->pb)) { @@ -121,7 +121,7 @@ static int au_read_header(AVFormatContext *s, { int size; unsigned int tag; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int id, channels, rate; enum CodecID codec; AVStream *st; diff --git a/libavformat/avc.c b/libavformat/avc.c index 7c991961c9..79fdf1a1c2 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -67,7 +67,7 @@ const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end){ return out; } -int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size) +int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size) { const uint8_t *p = buf_in; const uint8_t *end = p + size; @@ -88,7 +88,7 @@ int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size) int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) { - ByteIOContext *pb; + AVIOContext *pb; int ret = url_open_dyn_buf(&pb); if(ret < 0) return ret; @@ -100,7 +100,7 @@ int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) return 0; } -int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len) +int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) { if (len > 6) { /* check for h264 start code */ diff --git a/libavformat/avc.h b/libavformat/avc.h index 2deb77df15..46e5e37a54 100644 --- a/libavformat/avc.h +++ b/libavformat/avc.h @@ -25,9 +25,9 @@ #include #include "avio.h" -int ff_avc_parse_nal_units(ByteIOContext *s, const uint8_t *buf, int size); +int ff_avc_parse_nal_units(AVIOContext *s, const uint8_t *buf, int size); int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size); -int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len); +int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len); const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end); #endif /* AVFORMAT_AVC_H */ diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 8511a0366e..3fd7f75075 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -193,7 +193,7 @@ void av_metadata_free(AVMetadata **m); * @param size desired payload size * @return >0 (read size) if OK, AVERROR_xxx otherwise */ -int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); /** @@ -209,7 +209,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data * will not be lost even if an error occurs. */ -int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size); +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); /*************************************************/ /* fractional numbers for exact pts handling */ @@ -688,7 +688,7 @@ typedef struct AVFormatContext { struct AVInputFormat *iformat; struct AVOutputFormat *oformat; void *priv_data; - ByteIOContext *pb; + AVIOContext *pb; unsigned int nb_streams; #if FF_API_MAX_STREAMS AVStream *streams[MAX_STREAMS]; @@ -1060,7 +1060,7 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score * @return 0 in case of success, a negative value corresponding to an * AVERROR code otherwise */ -int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size); @@ -1069,7 +1069,7 @@ int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, * This does not open the needed codecs for decoding the stream[s]. */ int av_open_input_stream(AVFormatContext **ic_ptr, - ByteIOContext *pb, const char *filename, + AVIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap); /** diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 931a17c441..c83d840189 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -100,7 +100,7 @@ static inline int get_duration(AVIStream *ast, int len){ return 1; } -static int get_riff(AVFormatContext *s, ByteIOContext *pb) +static int get_riff(AVFormatContext *s, AVIOContext *pb) { AVIContext *avi = s->priv_data; char header[8]; @@ -126,7 +126,7 @@ static int get_riff(AVFormatContext *s, ByteIOContext *pb) static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int longs_pre_entry= get_le16(pb); int index_sub_type = get_byte(pb); int index_type = get_byte(pb); @@ -246,7 +246,7 @@ static void clean_index(AVFormatContext *s){ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; char key[5] = {0}, *value; size += (size & 1); @@ -335,7 +335,7 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end) static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int tag, tag1, handler; int codec_type, stream_index, frame_period, bit_rate; unsigned int size; @@ -752,7 +752,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { AVIStream *ast = st->priv_data; AVInputFormat *sub_demuxer; AVRational time_base; - ByteIOContext *pb = av_alloc_put_byte(pkt->data + 7, + AVIOContext *pb = av_alloc_put_byte(pkt->data + 7, pkt->size - 7, 0, NULL, NULL, NULL, NULL); AVProbeData pd; @@ -834,7 +834,7 @@ static int get_stream_idx(int *d){ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int n, d[8]; unsigned int size; int64_t i, sync; @@ -1110,7 +1110,7 @@ resync: static int avi_read_idx1(AVFormatContext *s, int size) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int nb_index_entries, i; AVStream *st; AVIStream *ast; @@ -1192,7 +1192,7 @@ static int guess_ni_flag(AVFormatContext *s){ static int avi_load_index(AVFormatContext *s) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint32_t tag, size; int64_t pos= url_ftell(pb); int ret = -1; diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 3397657083..cf3b9fbce8 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -63,7 +63,7 @@ static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id) return &idx->cluster[cl][id]; } -static int64_t avi_start_new_riff(AVFormatContext *s, ByteIOContext *pb, +static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, const char* riff_tag, const char* list_tag) { AVIContext *avi= s->priv_data; @@ -102,7 +102,7 @@ static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type) return tag; } -static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *str) +static void avi_write_info_tag(AVIOContext *pb, const char *tag, const char *str) { int len = strlen(str); if (len > 0) { @@ -117,7 +117,7 @@ static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *s static int avi_write_counters(AVFormatContext* s, int riff_id) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVIContext *avi = s->priv_data; int n, au_byterate, au_ssize, au_scale, nb_frames = 0; int64_t file_size; @@ -152,7 +152,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) static int avi_write_header(AVFormatContext *s) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale; AVCodecContext *stream, *video_enc; int64_t list1, list2, strh, strf; @@ -393,7 +393,7 @@ static int avi_write_header(AVFormatContext *s) static int avi_write_ix(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVIContext *avi = s->priv_data; char tag[5]; char ix_tag[] = "ix00"; @@ -451,7 +451,7 @@ static int avi_write_ix(AVFormatContext *s) static int avi_write_idx1(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVIContext *avi = s->priv_data; int64_t idx_chunk; int i; @@ -503,7 +503,7 @@ static int avi_write_idx1(AVFormatContext *s) static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char tag[5]; unsigned int flags=0; const int stream_index= pkt->stream_index; @@ -578,7 +578,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) static int avi_write_trailer(AVFormatContext *s) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int res = 0; int i, j, n, nb_frames; int64_t file_size; diff --git a/libavformat/avio.h b/libavformat/avio.h index c899c0df0e..14d371f1ed 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -334,7 +334,7 @@ int av_register_protocol2(URLProtocol *protocol, int size); * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. - * sizeof(ByteIOContext) must not be used outside libav*. + * sizeof(AVIOContext) must not be used outside libav*. */ typedef struct { unsigned char *buffer; @@ -357,130 +357,134 @@ typedef struct { int (*read_pause)(void *opaque, int pause); int64_t (*read_seek)(void *opaque, int stream_index, int64_t timestamp, int flags); -} ByteIOContext; - -int init_put_byte(ByteIOContext *s, - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)); -ByteIOContext *av_alloc_put_byte( - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)); - -void put_byte(ByteIOContext *s, int b); -void put_nbyte(ByteIOContext *s, int b, int count); -void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); -void put_le64(ByteIOContext *s, uint64_t val); -void put_be64(ByteIOContext *s, uint64_t val); -void put_le32(ByteIOContext *s, unsigned int val); -void put_be32(ByteIOContext *s, unsigned int val); -void put_le24(ByteIOContext *s, unsigned int val); -void put_be24(ByteIOContext *s, unsigned int val); -void put_le16(ByteIOContext *s, unsigned int val); -void put_be16(ByteIOContext *s, unsigned int val); -void put_tag(ByteIOContext *s, const char *tag); +} AVIOContext; #if FF_API_OLD_AVIO -attribute_deprecated void put_strz(ByteIOContext *s, const char *buf); +typedef attribute_deprecated AVIOContext ByteIOContext; +#endif + +int init_put_byte(AVIOContext *s, + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); +AVIOContext *av_alloc_put_byte( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +void put_byte(AVIOContext *s, int b); +void put_nbyte(AVIOContext *s, int b, int count); +void put_buffer(AVIOContext *s, const unsigned char *buf, int size); +void put_le64(AVIOContext *s, uint64_t val); +void put_be64(AVIOContext *s, uint64_t val); +void put_le32(AVIOContext *s, unsigned int val); +void put_be32(AVIOContext *s, unsigned int val); +void put_le24(AVIOContext *s, unsigned int val); +void put_be24(AVIOContext *s, unsigned int val); +void put_le16(AVIOContext *s, unsigned int val); +void put_be16(AVIOContext *s, unsigned int val); +void put_tag(AVIOContext *s, const char *tag); + +#if FF_API_OLD_AVIO +attribute_deprecated void put_strz(AVIOContext *s, const char *buf); #endif /** * Write a NULL-terminated string. * @return number of bytes written. */ -int avio_put_str(ByteIOContext *s, const char *str); +int avio_put_str(AVIOContext *s, const char *str); /** * Convert an UTF-8 string to UTF-16LE and write it. * @return number of bytes written. */ -int avio_put_str16le(ByteIOContext *s, const char *str); +int avio_put_str16le(AVIOContext *s, const char *str); /** - * fseek() equivalent for ByteIOContext. + * fseek() equivalent for AVIOContext. * @return new position or AVERROR. */ -int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence); +int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); /** * Skip given number of bytes forward. * @param offset number of bytes * @return 0 on success, <0 on error */ -int url_fskip(ByteIOContext *s, int64_t offset); +int url_fskip(AVIOContext *s, int64_t offset); /** - * ftell() equivalent for ByteIOContext. + * ftell() equivalent for AVIOContext. * @return position or AVERROR. */ -int64_t url_ftell(ByteIOContext *s); +int64_t url_ftell(AVIOContext *s); /** * Get the filesize. * @return filesize or AVERROR */ -int64_t url_fsize(ByteIOContext *s); +int64_t url_fsize(AVIOContext *s); /** - * feof() equivalent for ByteIOContext. + * feof() equivalent for AVIOContext. * @return non zero if and only if end of file */ -int url_feof(ByteIOContext *s); +int url_feof(AVIOContext *s); -int url_ferror(ByteIOContext *s); +int url_ferror(AVIOContext *s); -int av_url_read_fpause(ByteIOContext *h, int pause); -int64_t av_url_read_fseek(ByteIOContext *h, int stream_index, +int av_url_read_fpause(AVIOContext *h, int pause); +int64_t av_url_read_fseek(AVIOContext *h, int stream_index, int64_t timestamp, int flags); #define URL_EOF (-1) /** @note return URL_EOF (-1) if EOF */ -int url_fgetc(ByteIOContext *s); +int url_fgetc(AVIOContext *s); /** @warning currently size is limited */ #ifdef __GNUC__ -int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); +int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); #else -int url_fprintf(ByteIOContext *s, const char *fmt, ...); +int url_fprintf(AVIOContext *s, const char *fmt, ...); #endif /** @note unlike fgets, the EOL character is not returned and a whole line is parsed. return NULL if first char read was EOF */ -char *url_fgets(ByteIOContext *s, char *buf, int buf_size); +char *url_fgets(AVIOContext *s, char *buf, int buf_size); -void put_flush_packet(ByteIOContext *s); +void put_flush_packet(AVIOContext *s); /** - * Read size bytes from ByteIOContext into buf. + * Read size bytes from AVIOContext into buf. * @return number of bytes read or AVERROR */ -int get_buffer(ByteIOContext *s, unsigned char *buf, int size); +int get_buffer(AVIOContext *s, unsigned char *buf, int size); /** - * Read size bytes from ByteIOContext into buf. + * Read size bytes from AVIOContext into buf. * This reads at most 1 packet. If that is not enough fewer bytes will be * returned. * @return number of bytes read or AVERROR */ -int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size); +int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); /** @note return 0 if EOF, so you cannot use it if EOF handling is necessary */ -int get_byte(ByteIOContext *s); -unsigned int get_le24(ByteIOContext *s); -unsigned int get_le32(ByteIOContext *s); -uint64_t get_le64(ByteIOContext *s); -unsigned int get_le16(ByteIOContext *s); +int get_byte(AVIOContext *s); +unsigned int get_le24(AVIOContext *s); +unsigned int get_le32(AVIOContext *s); +uint64_t get_le64(AVIOContext *s); +unsigned int get_le16(AVIOContext *s); /** * Read a UTF-16 string from pb and convert it to UTF-8. @@ -488,77 +492,77 @@ unsigned int get_le16(ByteIOContext *s); * encountered or maxlen bytes have been read. * @return number of bytes read (is always <= maxlen) */ -int avio_get_str16le(ByteIOContext *pb, int maxlen, char *buf, int buflen); -int avio_get_str16be(ByteIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); -char *get_strz(ByteIOContext *s, char *buf, int maxlen); -unsigned int get_be16(ByteIOContext *s); -unsigned int get_be24(ByteIOContext *s); -unsigned int get_be32(ByteIOContext *s); -uint64_t get_be64(ByteIOContext *s); +char *get_strz(AVIOContext *s, char *buf, int maxlen); +unsigned int get_be16(AVIOContext *s); +unsigned int get_be24(AVIOContext *s); +unsigned int get_be32(AVIOContext *s); +uint64_t get_be64(AVIOContext *s); -uint64_t ff_get_v(ByteIOContext *bc); +uint64_t ff_get_v(AVIOContext *bc); -static inline int url_is_streamed(ByteIOContext *s) +static inline int url_is_streamed(AVIOContext *s) { return s->is_streamed; } /** - * Create and initialize a ByteIOContext for accessing the + * Create and initialize a AVIOContext for accessing the * resource referenced by the URLContext h. * @note When the URLContext h has been opened in read+write mode, the - * ByteIOContext can be used only for writing. + * AVIOContext can be used only for writing. * - * @param s Used to return the pointer to the created ByteIOContext. + * @param s Used to return the pointer to the created AVIOContext. * In case of failure the pointed to value is set to NULL. * @return 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure */ -int url_fdopen(ByteIOContext **s, URLContext *h); +int url_fdopen(AVIOContext **s, URLContext *h); /** @warning must be called before any I/O */ -int url_setbufsize(ByteIOContext *s, int buf_size); +int url_setbufsize(AVIOContext *s, int buf_size); #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 * to set up the buffer for writing. */ -int url_resetbuf(ByteIOContext *s, int flags); +int url_resetbuf(AVIOContext *s, int flags); #endif /** - * Rewind the ByteIOContext using the specified buffer containing the first buf_size bytes of the file. + * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file. * Used after probing to avoid seeking. * Joins buf and s->buffer, taking any overlap into consideration. * @note s->buffer must overlap with buf or they can't be joined and the function fails * @note This function is NOT part of the public API * - * @param s The read-only ByteIOContext to rewind + * @param s The read-only AVIOContext to rewind * @param buf The probe buffer containing the first buf_size bytes of the file * @param buf_size The size of buf * @return 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure */ -int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size); +int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size); /** - * Create and initialize a ByteIOContext for accessing the + * Create and initialize a AVIOContext for accessing the * resource indicated by url. * @note When the resource indicated by url has been opened in - * read+write mode, the ByteIOContext can be used only for writing. + * read+write mode, the AVIOContext can be used only for writing. * - * @param s Used to return the pointer to the created ByteIOContext. + * @param s Used to return the pointer to the created AVIOContext. * In case of failure the pointed to value is set to NULL. * @param flags flags which control how the resource indicated by url * is to be opened * @return 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure */ -int url_fopen(ByteIOContext **s, const char *url, int flags); +int url_fopen(AVIOContext **s, const char *url, int flags); -int url_fclose(ByteIOContext *s); -URLContext *url_fileno(ByteIOContext *s); +int url_fclose(AVIOContext *s); +URLContext *url_fileno(AVIOContext *s); /** * Return the maximum packet size associated to packetized buffered file @@ -568,12 +572,12 @@ URLContext *url_fileno(ByteIOContext *s); * @param s buffered file handle * @return maximum packet size in bytes */ -int url_fget_max_packet_size(ByteIOContext *s); +int url_fget_max_packet_size(AVIOContext *s); -int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags); +int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); /** return the written or read size */ -int url_close_buf(ByteIOContext *s); +int url_close_buf(AVIOContext *s); /** * Open a write only memory stream. @@ -581,7 +585,7 @@ int url_close_buf(ByteIOContext *s); * @param s new IO context * @return zero if no error. */ -int url_open_dyn_buf(ByteIOContext **s); +int url_open_dyn_buf(AVIOContext **s); /** * Open a write only packetized memory stream with a maximum packet @@ -592,7 +596,7 @@ int url_open_dyn_buf(ByteIOContext **s); * @param max_packet_size maximum packet size (must be > 0) * @return zero if no error. */ -int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size); +int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); /** * Return the written size and a pointer to the buffer. The buffer @@ -604,12 +608,12 @@ int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size); * @param pbuffer pointer to a byte buffer * @return the length of the byte buffer */ -int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer); +int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len); -unsigned long get_checksum(ByteIOContext *s); -void init_checksum(ByteIOContext *s, +unsigned long get_checksum(AVIOContext *s); +void init_checksum(AVIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index acea8111d9..d5f55e0e11 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -35,12 +35,12 @@ */ #define SHORT_SEEK_THRESHOLD 4096 -static void fill_buffer(ByteIOContext *s); +static void fill_buffer(AVIOContext *s); #if !FF_API_URL_RESETBUF -static int url_resetbuf(ByteIOContext *s, int flags); +static int url_resetbuf(AVIOContext *s, int flags); #endif -int init_put_byte(ByteIOContext *s, +int init_put_byte(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, @@ -73,7 +73,7 @@ int init_put_byte(ByteIOContext *s, return 0; } -ByteIOContext *av_alloc_put_byte( +AVIOContext *av_alloc_put_byte( unsigned char *buffer, int buffer_size, int write_flag, @@ -82,13 +82,13 @@ ByteIOContext *av_alloc_put_byte( int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)) { - ByteIOContext *s = av_mallocz(sizeof(ByteIOContext)); + AVIOContext *s = av_mallocz(sizeof(AVIOContext)); init_put_byte(s, buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); return s; } -static void flush_buffer(ByteIOContext *s) +static void flush_buffer(AVIOContext *s) { if (s->buf_ptr > s->buffer) { if (s->write_packet && !s->error){ @@ -106,14 +106,14 @@ static void flush_buffer(ByteIOContext *s) s->buf_ptr = s->buffer; } -void put_byte(ByteIOContext *s, int b) +void put_byte(AVIOContext *s, int b) { *(s->buf_ptr)++ = b; if (s->buf_ptr >= s->buf_end) flush_buffer(s); } -void put_nbyte(ByteIOContext *s, int b, int count) +void put_nbyte(AVIOContext *s, int b, int count) { while (count > 0) { int len = FFMIN(s->buf_end - s->buf_ptr, count); @@ -127,7 +127,7 @@ void put_nbyte(ByteIOContext *s, int b, int count) } } -void put_buffer(ByteIOContext *s, const unsigned char *buf, int size) +void put_buffer(AVIOContext *s, const unsigned char *buf, int size) { while (size > 0) { int len = FFMIN(s->buf_end - s->buf_ptr, size); @@ -142,13 +142,13 @@ void put_buffer(ByteIOContext *s, const unsigned char *buf, int size) } } -void put_flush_packet(ByteIOContext *s) +void put_flush_packet(AVIOContext *s) { flush_buffer(s); s->must_flush = 0; } -int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) +int64_t url_fseek(AVIOContext *s, int64_t offset, int whence) { int64_t offset1; int64_t pos; @@ -205,18 +205,18 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) return offset; } -int url_fskip(ByteIOContext *s, int64_t offset) +int url_fskip(AVIOContext *s, int64_t offset) { int64_t ret = url_fseek(s, offset, SEEK_CUR); return ret < 0 ? ret : 0; } -int64_t url_ftell(ByteIOContext *s) +int64_t url_ftell(AVIOContext *s) { return url_fseek(s, 0, SEEK_CUR); } -int64_t url_fsize(ByteIOContext *s) +int64_t url_fsize(AVIOContext *s) { int64_t size; @@ -235,21 +235,21 @@ int64_t url_fsize(ByteIOContext *s) return size; } -int url_feof(ByteIOContext *s) +int url_feof(AVIOContext *s) { if(!s) return 0; return s->eof_reached; } -int url_ferror(ByteIOContext *s) +int url_ferror(AVIOContext *s) { if(!s) return 0; return s->error; } -void put_le32(ByteIOContext *s, unsigned int val) +void put_le32(AVIOContext *s, unsigned int val) { put_byte(s, val); put_byte(s, val >> 8); @@ -257,7 +257,7 @@ void put_le32(ByteIOContext *s, unsigned int val) put_byte(s, val >> 24); } -void put_be32(ByteIOContext *s, unsigned int val) +void put_be32(AVIOContext *s, unsigned int val) { put_byte(s, val >> 24); put_byte(s, val >> 16); @@ -266,13 +266,13 @@ void put_be32(ByteIOContext *s, unsigned int val) } #if FF_API_OLD_AVIO -void put_strz(ByteIOContext *s, const char *str) +void put_strz(AVIOContext *s, const char *str) { avio_put_str(s, str); } #endif -int avio_put_str(ByteIOContext *s, const char *str) +int avio_put_str(AVIOContext *s, const char *str) { int len = 1; if (str) { @@ -283,7 +283,7 @@ int avio_put_str(ByteIOContext *s, const char *str) return len; } -int avio_put_str16le(ByteIOContext *s, const char *str) +int avio_put_str16le(AVIOContext *s, const char *str) { const uint8_t *q = str; int ret = 0; @@ -309,7 +309,7 @@ int ff_get_v_length(uint64_t val){ return i; } -void ff_put_v(ByteIOContext *bc, uint64_t val){ +void ff_put_v(AVIOContext *bc, uint64_t val){ int i= ff_get_v_length(val); while(--i>0) @@ -318,43 +318,43 @@ void ff_put_v(ByteIOContext *bc, uint64_t val){ put_byte(bc, val&127); } -void put_le64(ByteIOContext *s, uint64_t val) +void put_le64(AVIOContext *s, uint64_t val) { put_le32(s, (uint32_t)(val & 0xffffffff)); put_le32(s, (uint32_t)(val >> 32)); } -void put_be64(ByteIOContext *s, uint64_t val) +void put_be64(AVIOContext *s, uint64_t val) { put_be32(s, (uint32_t)(val >> 32)); put_be32(s, (uint32_t)(val & 0xffffffff)); } -void put_le16(ByteIOContext *s, unsigned int val) +void put_le16(AVIOContext *s, unsigned int val) { put_byte(s, val); put_byte(s, val >> 8); } -void put_be16(ByteIOContext *s, unsigned int val) +void put_be16(AVIOContext *s, unsigned int val) { put_byte(s, val >> 8); put_byte(s, val); } -void put_le24(ByteIOContext *s, unsigned int val) +void put_le24(AVIOContext *s, unsigned int val) { put_le16(s, val & 0xffff); put_byte(s, val >> 16); } -void put_be24(ByteIOContext *s, unsigned int val) +void put_be24(AVIOContext *s, unsigned int val) { put_be16(s, val >> 8); put_byte(s, val); } -void put_tag(ByteIOContext *s, const char *tag) +void put_tag(AVIOContext *s, const char *tag) { while (*tag) { put_byte(s, *tag++); @@ -363,7 +363,7 @@ void put_tag(ByteIOContext *s, const char *tag) /* Input stream */ -static void fill_buffer(ByteIOContext *s) +static void fill_buffer(AVIOContext *s) { uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_ptr : s->buffer; int len= s->buffer_size - (dst - s->buffer); @@ -410,14 +410,14 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len); } -unsigned long get_checksum(ByteIOContext *s) +unsigned long get_checksum(AVIOContext *s) { s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr); s->update_checksum= NULL; return s->checksum; } -void init_checksum(ByteIOContext *s, +void init_checksum(AVIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum) { @@ -429,7 +429,7 @@ void init_checksum(ByteIOContext *s, } /* XXX: put an inline version */ -int get_byte(ByteIOContext *s) +int get_byte(AVIOContext *s) { if (s->buf_ptr >= s->buf_end) fill_buffer(s); @@ -438,7 +438,7 @@ int get_byte(ByteIOContext *s) return 0; } -int url_fgetc(ByteIOContext *s) +int url_fgetc(AVIOContext *s) { if (s->buf_ptr >= s->buf_end) fill_buffer(s); @@ -447,7 +447,7 @@ int url_fgetc(ByteIOContext *s) return URL_EOF; } -int get_buffer(ByteIOContext *s, unsigned char *buf, int size) +int get_buffer(AVIOContext *s, unsigned char *buf, int size) { int len, size1; @@ -494,7 +494,7 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size) return size1 - size; } -int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) +int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size) { int len; @@ -517,7 +517,7 @@ int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) return len; } -unsigned int get_le16(ByteIOContext *s) +unsigned int get_le16(AVIOContext *s) { unsigned int val; val = get_byte(s); @@ -525,7 +525,7 @@ unsigned int get_le16(ByteIOContext *s) return val; } -unsigned int get_le24(ByteIOContext *s) +unsigned int get_le24(AVIOContext *s) { unsigned int val; val = get_le16(s); @@ -533,7 +533,7 @@ unsigned int get_le24(ByteIOContext *s) return val; } -unsigned int get_le32(ByteIOContext *s) +unsigned int get_le32(AVIOContext *s) { unsigned int val; val = get_le16(s); @@ -541,7 +541,7 @@ unsigned int get_le32(ByteIOContext *s) return val; } -uint64_t get_le64(ByteIOContext *s) +uint64_t get_le64(AVIOContext *s) { uint64_t val; val = (uint64_t)get_le32(s); @@ -549,7 +549,7 @@ uint64_t get_le64(ByteIOContext *s) return val; } -unsigned int get_be16(ByteIOContext *s) +unsigned int get_be16(AVIOContext *s) { unsigned int val; val = get_byte(s) << 8; @@ -557,14 +557,14 @@ unsigned int get_be16(ByteIOContext *s) return val; } -unsigned int get_be24(ByteIOContext *s) +unsigned int get_be24(AVIOContext *s) { unsigned int val; val = get_be16(s) << 8; val |= get_byte(s); return val; } -unsigned int get_be32(ByteIOContext *s) +unsigned int get_be32(AVIOContext *s) { unsigned int val; val = get_be16(s) << 16; @@ -572,7 +572,7 @@ unsigned int get_be32(ByteIOContext *s) return val; } -char *get_strz(ByteIOContext *s, char *buf, int maxlen) +char *get_strz(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; @@ -587,7 +587,7 @@ char *get_strz(ByteIOContext *s, char *buf, int maxlen) return buf; } -int ff_get_line(ByteIOContext *s, char *buf, int maxlen) +int ff_get_line(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; @@ -603,7 +603,7 @@ int ff_get_line(ByteIOContext *s, char *buf, int maxlen) } #define GET_STR16(type, read) \ - int avio_get_str16 ##type(ByteIOContext *pb, int maxlen, char *buf, int buflen)\ + int avio_get_str16 ##type(AVIOContext *pb, int maxlen, char *buf, int buflen)\ {\ char* q = buf;\ int ret = 0;\ @@ -624,7 +624,7 @@ GET_STR16(be, get_be16) #undef GET_STR16 -uint64_t get_be64(ByteIOContext *s) +uint64_t get_be64(AVIOContext *s) { uint64_t val; val = (uint64_t)get_be32(s) << 32; @@ -632,7 +632,7 @@ uint64_t get_be64(ByteIOContext *s) return val; } -uint64_t ff_get_v(ByteIOContext *bc){ +uint64_t ff_get_v(AVIOContext *bc){ uint64_t val = 0; int tmp; @@ -643,7 +643,7 @@ uint64_t ff_get_v(ByteIOContext *bc){ return val; } -int url_fdopen(ByteIOContext **s, URLContext *h) +int url_fdopen(AVIOContext **s, URLContext *h) { uint8_t *buffer; int buffer_size, max_packet_size; @@ -658,7 +658,7 @@ int url_fdopen(ByteIOContext **s, URLContext *h) if (!buffer) return AVERROR(ENOMEM); - *s = av_mallocz(sizeof(ByteIOContext)); + *s = av_mallocz(sizeof(AVIOContext)); if(!*s) { av_free(buffer); return AVERROR(ENOMEM); @@ -680,7 +680,7 @@ int url_fdopen(ByteIOContext **s, URLContext *h) return 0; } -int url_setbufsize(ByteIOContext *s, int buf_size) +int url_setbufsize(AVIOContext *s, int buf_size) { uint8_t *buffer; buffer = av_malloc(buf_size); @@ -696,9 +696,9 @@ int url_setbufsize(ByteIOContext *s, int buf_size) } #if FF_API_URL_RESETBUF -int url_resetbuf(ByteIOContext *s, int flags) +int url_resetbuf(AVIOContext *s, int flags) #else -static int url_resetbuf(ByteIOContext *s, int flags) +static int url_resetbuf(AVIOContext *s, int flags) #endif { #if FF_API_URL_RESETBUF @@ -718,7 +718,7 @@ static int url_resetbuf(ByteIOContext *s, int flags) return 0; } -int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size) +int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size) { int64_t buffer_start; int buffer_size; @@ -757,7 +757,7 @@ int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size return 0; } -int url_fopen(ByteIOContext **s, const char *filename, int flags) +int url_fopen(AVIOContext **s, const char *filename, int flags) { URLContext *h; int err; @@ -773,7 +773,7 @@ int url_fopen(ByteIOContext **s, const char *filename, int flags) return 0; } -int url_fclose(ByteIOContext *s) +int url_fclose(AVIOContext *s) { URLContext *h = s->opaque; @@ -782,13 +782,13 @@ int url_fclose(ByteIOContext *s) return url_close(h); } -URLContext *url_fileno(ByteIOContext *s) +URLContext *url_fileno(AVIOContext *s) { return s->opaque; } #if CONFIG_MUXERS -int url_fprintf(ByteIOContext *s, const char *fmt, ...) +int url_fprintf(AVIOContext *s, const char *fmt, ...) { va_list ap; char buf[4096]; @@ -802,7 +802,7 @@ int url_fprintf(ByteIOContext *s, const char *fmt, ...) } #endif //CONFIG_MUXERS -char *url_fgets(ByteIOContext *s, char *buf, int buf_size) +char *url_fgets(AVIOContext *s, char *buf, int buf_size) { int c; char *q; @@ -823,19 +823,19 @@ char *url_fgets(ByteIOContext *s, char *buf, int buf_size) return buf; } -int url_fget_max_packet_size(ByteIOContext *s) +int url_fget_max_packet_size(AVIOContext *s) { return s->max_packet_size; } -int av_url_read_fpause(ByteIOContext *s, int pause) +int av_url_read_fpause(AVIOContext *s, int pause) { if (!s->read_pause) return AVERROR(ENOSYS); return s->read_pause(s->opaque, pause); } -int64_t av_url_read_fseek(ByteIOContext *s, int stream_index, +int64_t av_url_read_fseek(AVIOContext *s, int stream_index, int64_t timestamp, int flags) { URLContext *h = s->opaque; @@ -859,10 +859,10 @@ int64_t av_url_read_fseek(ByteIOContext *s, int stream_index, * back to the server even if CONFIG_MUXERS is false. */ #if CONFIG_MUXERS || CONFIG_NETWORK /* buffer handling */ -int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags) +int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) { int ret; - *s = av_mallocz(sizeof(ByteIOContext)); + *s = av_mallocz(sizeof(AVIOContext)); if(!*s) return AVERROR(ENOMEM); ret = init_put_byte(*s, buf, buf_size, @@ -873,7 +873,7 @@ int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags) return ret; } -int url_close_buf(ByteIOContext *s) +int url_close_buf(AVIOContext *s) { put_flush_packet(s); return s->buf_ptr - s->buffer; @@ -947,7 +947,7 @@ static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence) return 0; } -static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size) +static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size) { DynBuffer *d; int ret; @@ -958,7 +958,7 @@ static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size) d = av_mallocz(sizeof(DynBuffer) + io_buffer_size); if (!d) return AVERROR(ENOMEM); - *s = av_mallocz(sizeof(ByteIOContext)); + *s = av_mallocz(sizeof(AVIOContext)); if(!*s) { av_free(d); return AVERROR(ENOMEM); @@ -977,19 +977,19 @@ static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size) return ret; } -int url_open_dyn_buf(ByteIOContext **s) +int url_open_dyn_buf(AVIOContext **s) { return url_open_dyn_buf_internal(s, 0); } -int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size) +int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size) { if (max_packet_size <= 0) return -1; return url_open_dyn_buf_internal(s, max_packet_size); } -int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer) +int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) { DynBuffer *d = s->opaque; int size; diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 97e8e7e0c2..017a8a6050 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -60,7 +60,7 @@ static int vid_read_header(AVFormatContext *s, AVFormatParameters *ap) { BVID_DemuxContext *vid = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *stream; /* load main header. Contents: @@ -97,7 +97,7 @@ static int vid_read_header(AVFormatContext *s, } #define BUFFER_PADDING_SIZE 1000 -static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt, +static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, uint8_t block_type, AVFormatContext *s, int npixels) { uint8_t * vidbuf_start = NULL; @@ -174,7 +174,7 @@ static int vid_read_packet(AVFormatContext *s, AVPacket *pkt) { BVID_DemuxContext *vid = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char block_type; int audio_length; int ret_value; diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 3b1c9aa927..40724b336d 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -49,7 +49,7 @@ static int bfi_probe(AVProbeData * p) static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) { BFIContext *bfi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *vstream; AVStream *astream; int fps, chunk_header; @@ -107,7 +107,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) { BFIContext *bfi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret, audio_offset, video_offset, chunk_size, audio_size = 0; if (bfi->nframes == 0 || url_feof(pb)) { return AVERROR(EIO); diff --git a/libavformat/bink.c b/libavformat/bink.c index c134dd80fd..f19229faf7 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -70,7 +70,7 @@ static int probe(AVProbeData *p) static int read_header(AVFormatContext *s, AVFormatParameters *ap) { BinkDemuxContext *bink = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint32_t fps_num, fps_den; AVStream *vst, *ast; unsigned int i; @@ -177,7 +177,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) static int read_packet(AVFormatContext *s, AVPacket *pkt) { BinkDemuxContext *bink = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; if (bink->current_track < 0) { diff --git a/libavformat/c93.c b/libavformat/c93.c index 0c6e4e5f51..2beaebc356 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -60,7 +60,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *video; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; C93DemuxContext *c93 = s->priv_data; int i; int framecount = 0; @@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s, static int read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; C93DemuxContext *c93 = s->priv_data; C93BlockRecord *br = &c93->block_records[c93->current_block]; int datasize; diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 7b0c8717b1..27e29a2ea8 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -53,7 +53,7 @@ static int probe(AVProbeData *p) /** Read audio description chunk */ static int read_desc_chunk(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; CaffContext *caf = s->priv_data; AVStream *st; int flags; @@ -93,7 +93,7 @@ static int read_desc_chunk(AVFormatContext *s) /** Read magic cookie chunk */ static int read_kuki_chunk(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) @@ -144,7 +144,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) /** Read packet table chunk */ static int read_pakt_chunk(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; CaffContext *caf = s->priv_data; int64_t pos = 0, ccount; @@ -179,7 +179,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) /** Read information chunk */ static void read_info_chunk(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int i; unsigned int nb_entries = get_be32(pb); for (i = 0; i < nb_entries; i++) { @@ -194,7 +194,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size) static int read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; CaffContext *caf = s->priv_data; AVStream *st; uint32_t tag = 0; @@ -301,7 +301,7 @@ static int read_header(AVFormatContext *s, static int read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; CaffContext *caf = s->priv_data; int res, pkt_size = 0, pkt_frames = 0; diff --git a/libavformat/daud.c b/libavformat/daud.c index c8af2e4430..b59fad98e0 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -36,7 +36,7 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) { } static int daud_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret, size; if (url_feof(pb)) return AVERROR(EIO); diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index 10a2a9d24f..17807fb6d0 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -70,7 +70,7 @@ static int cin_probe(AVProbeData *p) return AVPROBE_SCORE_MAX; } -static int cin_read_file_header(CinDemuxContext *cin, ByteIOContext *pb) { +static int cin_read_file_header(CinDemuxContext *cin, AVIOContext *pb) { CinFileHeader *hdr = &cin->file_header; if (get_le32(pb) != 0x55AA0000) @@ -95,7 +95,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) int rc; CinDemuxContext *cin = s->priv_data; CinFileHeader *hdr = &cin->file_header; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; rc = cin_read_file_header(cin, pb); @@ -138,7 +138,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) return 0; } -static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) { +static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) { CinFrameHeader *hdr = &cin->frame_header; hdr->video_frame_type = get_byte(pb); @@ -159,7 +159,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) { static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) { CinDemuxContext *cin = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; CinFrameHeader *hdr = &cin->frame_header; int rc, palette_type, pkt_size; int ret; diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 6ad4582e5e..a10ece8c8b 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -52,7 +52,7 @@ static int dxa_probe(AVProbeData *p) static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; DXAContext *c = s->priv_data; AVStream *st, *ast; uint32_t tag; diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c index 809b190dd1..93ccf8acb2 100644 --- a/libavformat/eacdata.c +++ b/libavformat/eacdata.c @@ -47,7 +47,7 @@ static int cdata_probe(AVProbeData *p) static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) { CdataDemuxContext *cdata = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int sample_rate, header; AVStream *st; diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 5408a1f0de..0f4843d4e9 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -77,7 +77,7 @@ typedef struct EaDemuxContext { int num_samples; } EaDemuxContext; -static uint32_t read_arbitary(ByteIOContext *pb) { +static uint32_t read_arbitary(AVIOContext *pb) { uint8_t size, byte; int i; uint32_t word; @@ -102,7 +102,7 @@ static int process_audio_header_elements(AVFormatContext *s) { int inHeader = 1; EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int compression_type = -1, revision = -1, revision2 = -1; ea->bytes = 2; @@ -215,7 +215,7 @@ static int process_audio_header_elements(AVFormatContext *s) static int process_audio_header_eacs(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int compression_type; ea->sample_rate = ea->big_endian ? get_be32(pb) : get_le32(pb); @@ -247,7 +247,7 @@ static int process_audio_header_eacs(AVFormatContext *s) static int process_audio_header_sead(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ea->sample_rate = get_le32(pb); ea->bytes = get_le32(pb); /* 1=8-bit, 2=16-bit */ @@ -260,7 +260,7 @@ static int process_audio_header_sead(AVFormatContext *s) static int process_video_header_mdec(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; url_fskip(pb, 4); ea->width = get_le16(pb); ea->height = get_le16(pb); @@ -272,7 +272,7 @@ static int process_video_header_mdec(AVFormatContext *s) static int process_video_header_vp6(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; url_fskip(pb, 16); ea->time_base.den = get_le32(pb); @@ -289,7 +289,7 @@ static int process_video_header_vp6(AVFormatContext *s) static int process_ea_header(AVFormatContext *s) { uint32_t blockid, size = 0; EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) { @@ -459,7 +459,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret = 0; int packet_read = 0; unsigned int chunk_type, chunk_size; diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 91da6504b6..771209056b 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -105,7 +105,7 @@ static int ffm_read_data(AVFormatContext *s, uint8_t *buf, int size, int header) { FFMContext *ffm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int len, fill_size, size1, frame_offset, id; size1 = size; @@ -170,7 +170,7 @@ static int ffm_read_data(AVFormatContext *s, static void ffm_seek1(AVFormatContext *s, int64_t pos1) { FFMContext *ffm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE); @@ -183,7 +183,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1) static int64_t get_dts(AVFormatContext *s, int64_t pos) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t dts; ffm_seek1(s, pos); @@ -198,7 +198,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) static void adjust_write_index(AVFormatContext *s) { FFMContext *ffm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pts; //int64_t orig_write_index = ffm->write_index; int64_t pos_min, pos_max; @@ -267,7 +267,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) { FFMContext *ffm = s->priv_data; AVStream *st; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *codec; int i, nb_streams; uint32_t tag; diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index f9e0782c4b..858bd2ffc5 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -27,7 +27,7 @@ static void flush_packet(AVFormatContext *s) { FFMContext *ffm = s->priv_data; int fill_size, h; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; fill_size = ffm->packet_end - ffm->packet_ptr; memset(ffm->packet_ptr, 0, fill_size); @@ -84,7 +84,7 @@ static int ffm_write_header(AVFormatContext *s) { FFMContext *ffm = s->priv_data; AVStream *st; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *codec; int bit_rate, i; @@ -228,7 +228,7 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt) static int ffm_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; FFMContext *ffm = s->priv_data; /* flush packets */ diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c index cfeed7353c..a7ae72f632 100644 --- a/libavformat/ffmetadec.c +++ b/libavformat/ffmetadec.c @@ -30,7 +30,7 @@ static int probe(AVProbeData *p) return 0; } -static void get_line(ByteIOContext *s, uint8_t *buf, int size) +static void get_line(AVIOContext *s, uint8_t *buf, int size) { do { uint8_t c; diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index b20abc9036..68b22e9551 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -25,7 +25,7 @@ #include "ffmeta.h" -static void write_escape_str(ByteIOContext *s, const uint8_t *str) +static void write_escape_str(AVIOContext *s, const uint8_t *str) { const uint8_t *p = str; @@ -37,7 +37,7 @@ static void write_escape_str(ByteIOContext *s, const uint8_t *str) } } -static void write_tags(ByteIOContext *s, AVMetadata *m) +static void write_tags(AVIOContext *s, AVMetadata *m) { AVMetadataTag *t = NULL; while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) { diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 805ca991bc..262bb23390 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -37,7 +37,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { FilmstripDemuxContext *film = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; if (url_is_streamed(s->pb)) diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c index 6da575cc47..3fdfa4a36a 100644 --- a/libavformat/filmstripenc.c +++ b/libavformat/filmstripenc.c @@ -53,7 +53,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) static int write_trailer(AVFormatContext *s) { FilmstripMuxContext *film = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; int i; diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index 5eee5bec09..8f5f6c2128 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -27,7 +27,7 @@ #include "libavcodec/bytestream.h" -static int flac_write_block_padding(ByteIOContext *pb, unsigned int n_padding_bytes, +static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes, int last_block) { put_byte(pb, last_block ? 0x81 : 0x01); @@ -39,7 +39,7 @@ static int flac_write_block_padding(ByteIOContext *pb, unsigned int n_padding_by return 0; } -static int flac_write_block_comment(ByteIOContext *pb, AVMetadata **m, +static int flac_write_block_comment(AVIOContext *pb, AVMetadata **m, int last_block, int bitexact) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; @@ -90,7 +90,7 @@ static int flac_write_header(struct AVFormatContext *s) static int flac_write_trailer(struct AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t *streaminfo; enum FLACExtradataFormat format; int64_t file_size; diff --git a/libavformat/flacenc.h b/libavformat/flacenc.h index 8ad1c267ab..e83ee32aeb 100644 --- a/libavformat/flacenc.h +++ b/libavformat/flacenc.h @@ -26,7 +26,7 @@ #include "libavcodec/bytestream.h" #include "avformat.h" -int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec, +int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec, int last_block); #endif /* AVFORMAT_FLACENC_H */ diff --git a/libavformat/flacenc_header.c b/libavformat/flacenc_header.c index 92a129a7d6..fa7ed48241 100644 --- a/libavformat/flacenc_header.c +++ b/libavformat/flacenc_header.c @@ -24,7 +24,7 @@ #include "avformat.h" #include "flacenc.h" -int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec, +int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec, int last_block) { uint8_t header[8] = { diff --git a/libavformat/flic.c b/libavformat/flic.c index 5942f721dc..fca395b595 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -86,7 +86,7 @@ static int flic_read_header(AVFormatContext *s, AVFormatParameters *ap) { FlicDemuxContext *flic = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char header[FLIC_HEADER_SIZE]; AVStream *st, *ast; int speed; @@ -198,7 +198,7 @@ static int flic_read_packet(AVFormatContext *s, AVPacket *pkt) { FlicDemuxContext *flic = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int packet_read = 0; unsigned int size; int magic; diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index e6081d9840..ce743b1bcf 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -110,7 +110,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co return 0; } -static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) { +static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) { int length = get_be16(ioc); if(length >= buffsize) { url_fskip(ioc, length); @@ -126,7 +126,7 @@ static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) { static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth) { AVCodecContext *acodec, *vcodec; - ByteIOContext *ioc; + AVIOContext *ioc; AMFDataType amf_type; char str_val[256]; double num_val; @@ -213,7 +213,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { AMFDataType type; AVStream *stream, *astream, *vstream; - ByteIOContext *ioc; + AVIOContext *ioc; int i; char buffer[11]; //only needs to hold the string "onMetaData". Anything longer is something we don't want. diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index b6e406bfa1..a092c30c1e 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -139,14 +139,14 @@ static int get_audio_flags(AVCodecContext *enc){ return flags; } -static void put_amf_string(ByteIOContext *pb, const char *str) +static void put_amf_string(AVIOContext *pb, const char *str) { size_t len = strlen(str); put_be16(pb, len); put_buffer(pb, str, len); } -static void put_avc_eos_tag(ByteIOContext *pb, unsigned ts) { +static void put_avc_eos_tag(AVIOContext *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*/ @@ -158,20 +158,20 @@ static void put_avc_eos_tag(ByteIOContext *pb, unsigned ts) { put_be32(pb, 16); /* Size of FLV tag */ } -static void put_amf_double(ByteIOContext *pb, double d) +static void put_amf_double(AVIOContext *pb, double d) { put_byte(pb, AMF_DATA_TYPE_NUMBER); put_be64(pb, av_dbl2int(d)); } -static void put_amf_bool(ByteIOContext *pb, int b) { +static void put_amf_bool(AVIOContext *pb, int b) { put_byte(pb, AMF_DATA_TYPE_BOOL); put_byte(pb, !!b); } static int flv_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; FLVContext *flv = s->priv_data; AVCodecContext *audio_enc = NULL, *video_enc = NULL; int i; @@ -330,7 +330,7 @@ static int flv_write_trailer(AVFormatContext *s) { int64_t file_size; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; FLVContext *flv = s->priv_data; int i; @@ -357,7 +357,7 @@ static int flv_write_trailer(AVFormatContext *s) static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[pkt->stream_index]->codec; FLVContext *flv = s->priv_data; unsigned ts; diff --git a/libavformat/gif.c b/libavformat/gif.c index 2388f9ba69..2fdd5cdae0 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -107,7 +107,7 @@ static const rgb_triplet gif_clut[216] = { }; /* GIF header */ -static int gif_image_write_header(ByteIOContext *pb, +static int gif_image_write_header(AVIOContext *pb, int width, int height, int loop_count, uint32_t *palette) { @@ -179,7 +179,7 @@ static inline unsigned char gif_clut_index(uint8_t r, uint8_t g, uint8_t b) } -static int gif_image_write_image(ByteIOContext *pb, +static int gif_image_write_image(AVIOContext *pb, int x1, int y1, int width, int height, const uint8_t *buf, int linesize, int pix_fmt) { @@ -252,7 +252,7 @@ typedef struct { static int gif_write_header(AVFormatContext *s) { GIFContext *gif = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc, *video_enc; int i, width, height, loop_count /*, rate*/; @@ -294,7 +294,7 @@ static int gif_write_header(AVFormatContext *s) static int gif_write_video(AVFormatContext *s, AVCodecContext *enc, const uint8_t *buf, int size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GIFContext *gif = s->priv_data; int jiffies; int64_t delay; @@ -337,7 +337,7 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt) static int gif_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; put_byte(pb, 0x3b); put_flush_packet(s->pb); diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 1e08d826c1..3859630100 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -33,12 +33,12 @@ struct gxf_stream_info { /** * \brief parses a packet header, extracting type and length - * \param pb ByteIOContext to read header from + * \param pb AVIOContext to read header from * \param type detected packet type is stored here * \param length detected packet length, excluding header is stored here * \return 0 if header not found or contains invalid data, 1 otherwise */ -static int parse_packet_header(ByteIOContext *pb, GXFPktType *type, int *length) { +static int parse_packet_header(AVIOContext *pb, GXFPktType *type, int *length) { if (get_be32(pb)) return 0; if (get_byte(pb) != 1) @@ -157,7 +157,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) { * \param len length of tag section, will be adjusted to contain remaining bytes * \param si struct to store collected information into */ -static void gxf_material_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) { +static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si) { si->first_field = AV_NOPTS_VALUE; si->last_field = AV_NOPTS_VALUE; while (*len >= 2) { @@ -206,7 +206,7 @@ static AVRational fps_umf2avr(uint32_t flags) { * \param len length of tag section, will be adjusted to contain remaining bytes * \param si struct to store collected information into */ -static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) { +static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si) { si->frames_per_second = (AVRational){0, 0}; si->fields_per_frame = 0; while (*len >= 2) { @@ -231,7 +231,7 @@ static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info * * \brief read index from FLT packet into stream 0 av_index */ static void gxf_read_index(AVFormatContext *s, int pkt_len) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; uint32_t fields_per_map = get_le32(pb); uint32_t map_cnt = get_le32(pb); @@ -259,7 +259,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { } static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFPktType pkt_type; int map_len; int len; @@ -387,7 +387,7 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t int cur_track; int64_t cur_timestamp = AV_NOPTS_VALUE; int len; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFPktType type; tmp = get_be32(pb); start: @@ -419,7 +419,7 @@ out: } static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFPktType pkt_type; int pkt_len; while (!url_feof(pb)) { @@ -506,7 +506,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t res; if (url_fseek(pb, *pos, SEEK_SET) < 0) return AV_NOPTS_VALUE; diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 94976a3619..60db45d3e5 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -113,14 +113,14 @@ static int gxf_find_lines_index(AVStream *st) return -1; } -static void gxf_write_padding(ByteIOContext *pb, int64_t to_pad) +static void gxf_write_padding(AVIOContext *pb, int64_t to_pad) { for (; to_pad > 0; to_pad--) { put_byte(pb, 0); } } -static int64_t updatePacketSize(ByteIOContext *pb, int64_t pos) +static int64_t updatePacketSize(AVIOContext *pb, int64_t pos) { int64_t curpos; int size; @@ -137,7 +137,7 @@ static int64_t updatePacketSize(ByteIOContext *pb, int64_t pos) return curpos - pos; } -static int64_t updateSize(ByteIOContext *pb, int64_t pos) +static int64_t updateSize(AVIOContext *pb, int64_t pos) { int64_t curpos; @@ -148,7 +148,7 @@ static int64_t updateSize(ByteIOContext *pb, int64_t pos) return curpos - pos; } -static void gxf_write_packet_header(ByteIOContext *pb, GXFPktType type) +static void gxf_write_packet_header(AVIOContext *pb, GXFPktType type) { put_be32(pb, 0); /* packet leader for synchro */ put_byte(pb, 1); @@ -159,7 +159,7 @@ static void gxf_write_packet_header(ByteIOContext *pb, GXFPktType type) put_byte(pb, 0xE2); /* trailer 2 */ } -static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, AVStream *st) +static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st) { GXFStreamContext *sc = st->priv_data; char buffer[1024]; @@ -197,7 +197,7 @@ static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, AVStream *st) return size + 3; } -static int gxf_write_timecode_auxiliary(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFStreamContext *sc) { put_byte(pb, 0); /* fields */ put_byte(pb, 0); /* seconds */ @@ -210,7 +210,7 @@ static int gxf_write_timecode_auxiliary(ByteIOContext *pb, GXFStreamContext *sc) static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int mpeg = sc->track_type == 4 || sc->track_type == 9; @@ -267,7 +267,7 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, static int gxf_write_material_data_section(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; const char *filename = strrchr(s->filename, '/'); @@ -315,7 +315,7 @@ static int gxf_write_material_data_section(AVFormatContext *s) static int gxf_write_track_description_section(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int i; @@ -332,7 +332,7 @@ static int gxf_write_track_description_section(AVFormatContext *s) static int gxf_write_map_packet(AVFormatContext *s, int rewrite) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos = url_ftell(pb); if (!rewrite) { @@ -362,7 +362,7 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite) static int gxf_write_flt_packet(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *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; @@ -387,7 +387,7 @@ static int gxf_write_flt_packet(AVFormatContext *s) static int gxf_write_umf_material_description(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int timecode_base = gxf->time_base.den == 60000 ? 60 : 50; // XXX drop frame @@ -418,7 +418,7 @@ static int gxf_write_umf_material_description(AVFormatContext *s) static int gxf_write_umf_payload(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; put_le32(pb, gxf->umf_length); /* total length of the umf data */ put_le32(pb, 3); /* version */ @@ -437,7 +437,7 @@ static int gxf_write_umf_payload(AVFormatContext *s) static int gxf_write_umf_track_description(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFContext *gxf = s->priv_data; int64_t pos = url_ftell(pb); int i; @@ -455,7 +455,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s) return url_ftell(pb) - pos; } -static int gxf_write_umf_media_mpeg(ByteIOContext *pb, AVStream *st) +static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st) { GXFStreamContext *sc = st->priv_data; @@ -478,7 +478,7 @@ static int gxf_write_umf_media_mpeg(ByteIOContext *pb, AVStream *st) return 32; } -static int gxf_write_umf_media_timecode(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_umf_media_timecode(AVIOContext *pb, GXFStreamContext *sc) { put_le32(pb, 1); /* non drop frame */ put_le32(pb, 0); /* reserved */ @@ -491,7 +491,7 @@ static int gxf_write_umf_media_timecode(ByteIOContext *pb, GXFStreamContext *sc) return 32; } -static int gxf_write_umf_media_dv(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc) { int i; @@ -501,7 +501,7 @@ static int gxf_write_umf_media_dv(ByteIOContext *pb, GXFStreamContext *sc) return 32; } -static int gxf_write_umf_media_audio(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc) { put_le64(pb, av_dbl2int(1)); /* sound level to begin to */ put_le64(pb, av_dbl2int(1)); /* sound level to begin to */ @@ -513,7 +513,7 @@ static int gxf_write_umf_media_audio(ByteIOContext *pb, GXFStreamContext *sc) } #if 0 -static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_umf_media_mjpeg(AVIOContext *pb, GXFStreamContext *sc) { put_be64(pb, 0); /* FIXME FLOAT max chroma quant level */ put_be64(pb, 0); /* FIXME FLOAT max luma quant level */ @@ -526,7 +526,7 @@ static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *sc) static int gxf_write_umf_media_description(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int i, j; @@ -588,7 +588,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s) static int gxf_write_umf_packet(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos = url_ftell(pb); gxf_write_packet_header(pb, PKT_UMF); @@ -625,7 +625,7 @@ static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc) static int gxf_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFContext *gxf = s->priv_data; GXFStreamContext *vsc = NULL; uint8_t tracks[255] = {0}; @@ -754,7 +754,7 @@ static int gxf_write_header(AVFormatContext *s) return 0; } -static int gxf_write_eos_packet(ByteIOContext *pb) +static int gxf_write_eos_packet(AVIOContext *pb) { int64_t pos = url_ftell(pb); @@ -765,7 +765,7 @@ static int gxf_write_eos_packet(ByteIOContext *pb) static int gxf_write_trailer(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t end; int i; @@ -809,7 +809,7 @@ static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int si static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[pkt->stream_index]; GXFStreamContext *sc = st->priv_data; unsigned field_nb; @@ -856,7 +856,7 @@ static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size) static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[pkt->stream_index]; int64_t pos = url_ftell(pb); int padding = 0; diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 7cedf6e698..a5a96e20de 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -50,7 +50,7 @@ int ff_id3v2_tag_len(const uint8_t * buf) return len; } -static unsigned int get_size(ByteIOContext *s, int len) +static unsigned int get_size(AVIOContext *s, int len) { int v = 0; while (len--) @@ -58,13 +58,13 @@ static unsigned int get_size(ByteIOContext *s, int len) return v; } -static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const char *key) +static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const char *key) { char *q, dst[512]; const char *val = NULL; int len, dstlen = sizeof(dst) - 1; unsigned genre; - unsigned int (*get)(ByteIOContext*) = get_be16; + unsigned int (*get)(AVIOContext*) = get_be16; dst[0] = 0; if (taglen < 1) @@ -142,7 +142,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t int64_t next; int taghdrlen; const char *reason; - ByteIOContext pb; + AVIOContext pb; unsigned char *buffer = NULL; int buffer_size = 0; diff --git a/libavformat/idcin.c b/libavformat/idcin.c index e40d725f0c..986714ed11 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -142,7 +142,7 @@ static int idcin_probe(AVProbeData *p) static int idcin_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; IdcinDemuxContext *idcin = s->priv_data; AVStream *st; unsigned int width, height; @@ -221,7 +221,7 @@ static int idcin_read_packet(AVFormatContext *s, unsigned int command; unsigned int chunk_size; IdcinDemuxContext *idcin = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; int palette_scale; unsigned char r, g, b; diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 285a3e1ed2..dc0f0a694c 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -68,7 +68,7 @@ static int roq_read_header(AVFormatContext *s, AVFormatParameters *ap) { RoqDemuxContext *roq = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int framerate; AVStream *st; unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; @@ -100,7 +100,7 @@ static int roq_read_packet(AVFormatContext *s, AVPacket *pkt) { RoqDemuxContext *roq = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret = 0; unsigned int chunk_size; unsigned int chunk_type; diff --git a/libavformat/iff.c b/libavformat/iff.c index 90a3ea9c2e..8e3ddf11ab 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -124,7 +124,7 @@ static int iff_read_header(AVFormatContext *s, AVFormatParameters *ap) { IffDemuxContext *iff = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; uint32_t chunk_id, data_size; int compression = -1; @@ -276,7 +276,7 @@ static int iff_read_packet(AVFormatContext *s, AVPacket *pkt) { IffDemuxContext *iff = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; int ret; diff --git a/libavformat/img2.c b/libavformat/img2.c index 9583eea5df..95848053d2 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -255,7 +255,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) char filename[1024]; int i; int size[3]={0}, ret[3]={0}; - ByteIOContext *f[3]; + AVIOContext *f[3]; AVCodecContext *codec= s1->streams[0]->codec; if (!s->is_pipe) { @@ -339,7 +339,7 @@ static int write_header(AVFormatContext *s) static int write_packet(AVFormatContext *s, AVPacket *pkt) { VideoData *img = s->priv_data; - ByteIOContext *pb[3]; + AVIOContext *pb[3]; char filename[1024]; AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec; int i; diff --git a/libavformat/internal.h b/libavformat/internal.h index 16aa0af189..02a27e4724 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -157,20 +157,20 @@ int ff_get_v_length(uint64_t val); /** * Put val using a variable number of bytes. */ -void ff_put_v(ByteIOContext *bc, uint64_t val); +void ff_put_v(AVIOContext *bc, uint64_t val); /** - * Read a whole line of text from ByteIOContext. Stop reading after reaching + * Read a whole line of text from AVIOContext. Stop reading after reaching * either a \n, a \0 or EOF. The returned string is always \0 terminated, * and may be truncated if the buffer is too small. * - * @param s the read-only ByteIOContext + * @param s the read-only AVIOContext * @param buf buffer to store the read line * @param maxlen size of the buffer * @return the length of the string written in the buffer, not including the * final \0 */ -int ff_get_line(ByteIOContext *s, char *buf, int maxlen); +int ff_get_line(AVIOContext *s, char *buf, int maxlen); #define SPACE_CHARS " \t\r\n" diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 6d84402cf8..6015b99b3b 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -120,7 +120,7 @@ typedef struct IPMVEContext { } IPMVEContext; -static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb, +static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt) { int chunk_type; @@ -203,7 +203,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb, /* This function loads and processes a single chunk in an IP movie file. * It returns the type of chunk that was processed. */ -static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, +static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt) { unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE]; @@ -521,7 +521,7 @@ static int ipmovie_read_header(AVFormatContext *s, AVFormatParameters *ap) { IPMVEContext *ipmovie = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVPacket pkt; AVStream *st; unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE]; @@ -602,7 +602,7 @@ static int ipmovie_read_packet(AVFormatContext *s, AVPacket *pkt) { IPMVEContext *ipmovie = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; ret = process_ipmovie_chunk(ipmovie, pb, pkt); diff --git a/libavformat/isom.c b/libavformat/isom.c index 88d68258b8..6b1be10f25 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -341,7 +341,7 @@ int ff_mov_lang_to_iso639(unsigned code, char to[4]) return 1; } -int ff_mp4_read_descr_len(ByteIOContext *pb) +int ff_mp4_read_descr_len(AVIOContext *pb) { int len = 0; int count = 4; @@ -354,7 +354,7 @@ int ff_mp4_read_descr_len(ByteIOContext *pb) return len; } -int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag) +int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag) { int len; *tag = get_byte(pb); @@ -372,7 +372,7 @@ static const AVCodecTag mp4_audio_types[] = { { CODEC_ID_NONE, AOT_NULL }, }; -int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContext *pb) +int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb) { int len, tag; int object_type_id = get_byte(pb); diff --git a/libavformat/isom.h b/libavformat/isom.h index 2990c9ce82..1df666f1ff 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -88,7 +88,7 @@ typedef struct { } MOVTrackExt; typedef struct MOVStreamContext { - ByteIOContext *pb; + AVIOContext *pb; int ffindex; ///< AVStream index int next_chunk; unsigned int chunk_count; @@ -141,18 +141,18 @@ typedef struct MOVContext { int chapter_track; } MOVContext; -int ff_mp4_read_descr_len(ByteIOContext *pb); -int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag); -int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContext *pb); +int ff_mp4_read_descr_len(AVIOContext *pb); +int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag); +int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb); #define MP4IODescrTag 0x02 #define MP4ESDescrTag 0x03 #define MP4DecConfigDescrTag 0x04 #define MP4DecSpecificDescrTag 0x05 -int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom); +int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *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); +int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries); #endif /* AVFORMAT_ISOM_H */ diff --git a/libavformat/iss.c b/libavformat/iss.c index c47c8c8784..85b7e5fbdc 100644 --- a/libavformat/iss.c +++ b/libavformat/iss.c @@ -39,7 +39,7 @@ typedef struct { int sample_start_pos; } IssDemuxContext; -static void get_token(ByteIOContext *s, char *buf, int maxlen) +static void get_token(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; @@ -68,7 +68,7 @@ static int iss_probe(AVProbeData *p) static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap) { IssDemuxContext *iss = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; char token[MAX_TOKEN_SIZE]; int stereo, rate_divisor; diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index 021eb5163a..d7eed73e79 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -23,7 +23,7 @@ static int ivf_write_header(AVFormatContext *s) { AVCodecContext *ctx; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (s->nb_streams != 1) { av_log(s, AV_LOG_ERROR, "Format supports only exactly one video stream\n"); @@ -49,7 +49,7 @@ static int ivf_write_header(AVFormatContext *s) static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; put_le32(pb, pkt->size); put_le64(pb, pkt->pts); put_buffer(pb, pkt->data, pkt->size); diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 5630bf8c58..7c4378b6c0 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -46,7 +46,7 @@ static const AVCodecTag nut_tags[] = { #if CONFIG_LIBNUT_MUXER static int av_write(void * h, size_t len, const uint8_t * buf) { - ByteIOContext * bc = h; + AVIOContext * bc = h; put_buffer(bc, buf, len); //put_flush_packet(bc); return len; @@ -54,7 +54,7 @@ static int av_write(void * h, size_t len, const uint8_t * buf) { static int nut_write_header(AVFormatContext * avf) { NUTContext * priv = avf->priv_data; - ByteIOContext * bc = avf->pb; + AVIOContext * bc = avf->pb; nut_muxer_opts_tt mopts = { .output = { .priv = bc, @@ -137,7 +137,7 @@ static int nut_write_packet(AVFormatContext * avf, AVPacket * pkt) { } static int nut_write_trailer(AVFormatContext * avf) { - ByteIOContext * bc = avf->pb; + AVIOContext * bc = avf->pb; NUTContext * priv = avf->priv_data; int i; @@ -172,12 +172,12 @@ static int nut_probe(AVProbeData *p) { } static size_t av_read(void * h, size_t len, uint8_t * buf) { - ByteIOContext * bc = h; + AVIOContext * bc = h; return get_buffer(bc, buf, len); } static off_t av_seek(void * h, long long pos, int whence) { - ByteIOContext * bc = h; + AVIOContext * bc = h; if (whence == SEEK_END) { pos = url_fsize(bc) + pos; whence = SEEK_SET; @@ -187,7 +187,7 @@ static off_t av_seek(void * h, long long pos, int whence) { static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { NUTContext * priv = avf->priv_data; - ByteIOContext * bc = avf->pb; + AVIOContext * bc = avf->pb; nut_demuxer_opts_tt dopts = { .input = { .priv = bc, diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index 5cb202e4e2..7539e1f4ab 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -78,7 +78,7 @@ static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) { } static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; unsigned int frame_type, packet_size, padding, frame_size; diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 1d4d269d86..a4dc6d9c65 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -111,7 +111,7 @@ static int sync(AVFormatContext *s, uint8_t *header) */ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *format) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int track_size, samples, ret; AVStream *st; @@ -198,7 +198,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) { LXFDemuxContext *lxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t header[LXF_PACKET_HEADER_SIZE], header_data[LXF_HEADER_DATA_SIZE]; int ret; AVStream *st; @@ -281,7 +281,7 @@ static void deplanarize(LXFDemuxContext *lxf, AVStream *ast, uint8_t *out, int b static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) { LXFDemuxContext *lxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t header[LXF_PACKET_HEADER_SIZE], *buf; AVStream *ast = NULL; uint32_t stream, format; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 9a670e86c8..b3797047e5 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -515,7 +515,7 @@ static const char *matroska_doctypes[] = { "matroska", "webm" }; */ static int ebml_level_end(MatroskaDemuxContext *matroska) { - ByteIOContext *pb = matroska->ctx->pb; + AVIOContext *pb = matroska->ctx->pb; int64_t pos = url_ftell(pb); if (matroska->num_levels > 0) { @@ -536,7 +536,7 @@ static int ebml_level_end(MatroskaDemuxContext *matroska) * number. * Returns: number of bytes read, < 0 on error */ -static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb, +static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, int max_size, uint64_t *number) { int read = 1, n = 1; @@ -581,7 +581,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb, * This needs special handling for the "unknown length" case which has multiple * encodings. */ -static int ebml_read_length(MatroskaDemuxContext *matroska, ByteIOContext *pb, +static int ebml_read_length(MatroskaDemuxContext *matroska, AVIOContext *pb, uint64_t *number) { int res = ebml_read_num(matroska, pb, 8, number); @@ -594,7 +594,7 @@ static int ebml_read_length(MatroskaDemuxContext *matroska, ByteIOContext *pb, * Read the next element as an unsigned int. * 0 is success, < 0 is failure. */ -static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num) +static int ebml_read_uint(AVIOContext *pb, int size, uint64_t *num) { int n = 0; @@ -613,7 +613,7 @@ static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num) * Read the next element as a float. * 0 is success, < 0 is failure. */ -static int ebml_read_float(ByteIOContext *pb, int size, double *num) +static int ebml_read_float(AVIOContext *pb, int size, double *num) { if (size == 0) { *num = 0; @@ -631,7 +631,7 @@ static int ebml_read_float(ByteIOContext *pb, int size, double *num) * Read the next element as an ASCII string. * 0 is success, < 0 is failure. */ -static int ebml_read_ascii(ByteIOContext *pb, int size, char **str) +static int ebml_read_ascii(AVIOContext *pb, int size, char **str) { av_free(*str); /* EBML strings are usually not 0-terminated, so we allocate one @@ -651,7 +651,7 @@ static int ebml_read_ascii(ByteIOContext *pb, int size, char **str) * Read the next element as binary data. * 0 is success, < 0 is failure. */ -static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin) +static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) { av_free(bin->data); if (!(bin->data = av_malloc(length))) @@ -674,7 +674,7 @@ static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin) */ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length) { - ByteIOContext *pb = matroska->ctx->pb; + AVIOContext *pb = matroska->ctx->pb; MatroskaLevel *level; if (matroska->num_levels >= EBML_MAX_DEPTH) { @@ -697,7 +697,7 @@ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length) static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska, uint8_t *data, uint32_t size, uint64_t *num) { - ByteIOContext pb; + AVIOContext pb; init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL); return ebml_read_num(matroska, &pb, FFMIN(size, 8), num); } @@ -791,7 +791,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, [EBML_BIN] = 0x10000000, // no limits for anything else }; - ByteIOContext *pb = matroska->ctx->pb; + AVIOContext *pb = matroska->ctx->pb; uint32_t id = syntax->id; uint64_t length; int res; @@ -1242,7 +1242,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) uint8_t *extradata = NULL; int extradata_size = 0; int extradata_offset = 0; - ByteIOContext b; + AVIOContext b; /* Apply some sanity checks. */ if (track->type != MATROSKA_TRACK_TYPE_VIDEO && diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 1d0dc38ca8..fbaa8db4da 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -74,7 +74,7 @@ typedef struct { typedef struct MatroskaMuxContext { int mode; - ByteIOContext *dyn_bc; + AVIOContext *dyn_bc; ebml_master segment; int64_t segment_offset; ebml_master cluster; @@ -108,7 +108,7 @@ static int ebml_id_size(unsigned int id) return (av_log2(id+1)-1)/7+1; } -static void put_ebml_id(ByteIOContext *pb, unsigned int id) +static void put_ebml_id(AVIOContext *pb, unsigned int id) { int i = ebml_id_size(id); while (i--) @@ -120,7 +120,7 @@ static void put_ebml_id(ByteIOContext *pb, unsigned int id) * * @param bytes The number of bytes the size should occupy (maximum: 8). */ -static void put_ebml_size_unknown(ByteIOContext *pb, int bytes) +static void put_ebml_size_unknown(AVIOContext *pb, int bytes) { assert(bytes <= 8); put_byte(pb, 0x1ff >> bytes); @@ -144,7 +144,7 @@ static int ebml_num_size(uint64_t num) * @param bytes The number of bytes that need to be used to write the number. * If zero, any number of bytes can be used. */ -static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes) +static void put_ebml_num(AVIOContext *pb, uint64_t num, int bytes) { int i, needed_bytes = ebml_num_size(num); @@ -163,7 +163,7 @@ static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes) put_byte(pb, num >> i*8); } -static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val) +static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val) { int i, bytes = 1; uint64_t tmp = val; @@ -175,14 +175,14 @@ static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t va put_byte(pb, val >> i*8); } -static void put_ebml_float(ByteIOContext *pb, unsigned int elementid, double val) +static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val) { put_ebml_id(pb, elementid); put_ebml_num(pb, 8, 0); put_be64(pb, av_dbl2int(val)); } -static void put_ebml_binary(ByteIOContext *pb, unsigned int elementid, +static void put_ebml_binary(AVIOContext *pb, unsigned int elementid, const void *buf, int size) { put_ebml_id(pb, elementid); @@ -190,7 +190,7 @@ static void put_ebml_binary(ByteIOContext *pb, unsigned int elementid, put_buffer(pb, buf, size); } -static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const char *str) +static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char *str) { put_ebml_binary(pb, elementid, str, strlen(str)); } @@ -201,7 +201,7 @@ static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const cha * * @param size The number of bytes to reserve, which must be at least 2. */ -static void put_ebml_void(ByteIOContext *pb, uint64_t size) +static void put_ebml_void(AVIOContext *pb, uint64_t size) { int64_t currentpos = url_ftell(pb); @@ -219,7 +219,7 @@ static void put_ebml_void(ByteIOContext *pb, uint64_t size) put_byte(pb, 0); } -static ebml_master start_ebml_master(ByteIOContext *pb, unsigned int elementid, uint64_t expectedsize) +static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, uint64_t expectedsize) { int bytes = expectedsize ? ebml_num_size(expectedsize) : 8; put_ebml_id(pb, elementid); @@ -227,7 +227,7 @@ static ebml_master start_ebml_master(ByteIOContext *pb, unsigned int elementid, return (ebml_master){ url_ftell(pb), bytes }; } -static void end_ebml_master(ByteIOContext *pb, ebml_master master) +static void end_ebml_master(AVIOContext *pb, ebml_master master) { int64_t pos = url_ftell(pb); @@ -237,7 +237,7 @@ static void end_ebml_master(ByteIOContext *pb, ebml_master master) url_fseek(pb, pos, SEEK_SET); } -static void put_xiph_size(ByteIOContext *pb, int size) +static void put_xiph_size(AVIOContext *pb, int size) { int i; for (i = 0; i < size / 255; i++) @@ -256,7 +256,7 @@ static void put_xiph_size(ByteIOContext *pb, int size) * @param numelements The maximum number of elements that will be indexed * by this seek head, 0 if unlimited. */ -static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, int64_t segment_offset, int numelements) +static mkv_seekhead * mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset, int numelements) { mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead)); if (new_seekhead == NULL) @@ -304,7 +304,7 @@ static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid * @return The file offset where the seekhead was written, * -1 if an error occurred. */ -static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead) +static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) { ebml_master metaseek, seekentry; int64_t currentpos; @@ -373,7 +373,7 @@ static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t clus return 0; } -static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks) +static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks) { ebml_master cues_element; int64_t currentpos; @@ -408,7 +408,7 @@ static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks) return currentpos; } -static int put_xiph_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec) +static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec) { uint8_t *header_start[3]; int header_len[3]; @@ -463,9 +463,9 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int } } -static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec, int native_id, int qt_id) +static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec, int native_id, int qt_id) { - ByteIOContext *dyn_cp; + AVIOContext *dyn_cp; uint8_t *codecpriv; int ret, codecpriv_size; @@ -522,7 +522,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec static int mkv_write_tracks(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ebml_master tracks; int i, j, ret; @@ -650,7 +650,7 @@ static int mkv_write_tracks(AVFormatContext *s) static int mkv_write_chapters(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ebml_master chapters, editionentry; AVRational scale = {1, 1E9}; int i, ret; @@ -691,7 +691,7 @@ static int mkv_write_chapters(AVFormatContext *s) return 0; } -static void mkv_write_simpletag(ByteIOContext *pb, AVMetadataTag *t) +static void mkv_write_simpletag(AVIOContext *pb, AVMetadataTag *t) { uint8_t *key = av_strdup(t->key); uint8_t *p = key; @@ -790,7 +790,7 @@ static int mkv_write_tags(AVFormatContext *s) static int mkv_write_header(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ebml_master ebml_header, segment_info; AVMetadataTag *tag; int ret, i; @@ -901,7 +901,7 @@ static int ass_get_duration(const uint8_t *p) return end - start; } -static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) +static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) { MatroskaMuxContext *mkv = s->priv_data; int i, layer = 0, max_duration = 0, size, line_size, data_size = pkt->size; @@ -946,7 +946,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket return max_duration; } -static void mkv_write_block(AVFormatContext *s, ByteIOContext *pb, +static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, unsigned int blockid, AVPacket *pkt, int flags) { MatroskaMuxContext *mkv = s->priv_data; @@ -992,7 +992,7 @@ static int srt_get_duration(uint8_t **buf) return duration; } -static int mkv_write_srt_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) +static int mkv_write_srt_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) { ebml_master blockgroup; AVPacket pkt2 = *pkt; @@ -1026,7 +1026,7 @@ static void mkv_flush_dynbuf(AVFormatContext *s) static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *codec = s->streams[pkt->stream_index]->codec; int keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); int duration = pkt->duration; @@ -1090,7 +1090,7 @@ static int mkv_copy_packet(MatroskaMuxContext *mkv, const AVPacket *pkt) static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = url_is_streamed(s->pb) ? mkv->dyn_bc : s->pb; + AVIOContext *pb = url_is_streamed(s->pb) ? mkv->dyn_bc : s->pb; AVCodecContext *codec = s->streams[pkt->stream_index]->codec; int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; @@ -1132,7 +1132,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) static int mkv_write_trailer(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t currentpos, cuespos; int ret; diff --git a/libavformat/mm.c b/libavformat/mm.c index 475930f84a..53c3b49705 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -84,7 +84,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { MmDemuxContext *mm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned int type, length; @@ -137,7 +137,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { MmDemuxContext *mm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char preamble[MM_PREAMBLE_SIZE]; unsigned int type, length; diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 2b2af4df28..bf855cba8b 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -47,7 +47,7 @@ static int mmf_rate_code(int rate) } /* Copy of end_tag() from avienc.c, but for big-endian chunk size */ -static void end_tag_be(ByteIOContext *pb, int64_t start) +static void end_tag_be(AVIOContext *pb, int64_t start) { int64_t pos; @@ -60,7 +60,7 @@ static void end_tag_be(ByteIOContext *pb, int64_t start) static int mmf_write_header(AVFormatContext *s) { MMFContext *mmf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int rate; @@ -108,13 +108,13 @@ static int mmf_write_header(AVFormatContext *s) static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; put_buffer(pb, pkt->data, pkt->size); return 0; } /* Write a variable-length symbol */ -static void put_varlength(ByteIOContext *pb, int val) +static void put_varlength(AVIOContext *pb, int val) { if(val < 128) put_byte(pb, val); @@ -127,7 +127,7 @@ static void put_varlength(ByteIOContext *pb, int val) static int mmf_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; MMFContext *mmf = s->priv_data; int64_t pos, size; int gatetime; @@ -183,7 +183,7 @@ static int mmf_read_header(AVFormatContext *s, { MMFContext *mmf = s->priv_data; unsigned int tag; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int64_t file_size, size; int rate, params; diff --git a/libavformat/mmst.c b/libavformat/mmst.c index a2b55b5c8e..8d7ed059dc 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -152,7 +152,7 @@ static int send_command_packet(MMSTContext *mmst) static void mms_put_utf16(MMSContext *mms, uint8_t *src) { - ByteIOContext bic; + AVIOContext bic; int size = mms->write_out_ptr - mms->out_buffer; int len; init_put_byte(&bic, mms->write_out_ptr, diff --git a/libavformat/mov.c b/libavformat/mov.c index d4d7ac2185..22f84c1e72 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -73,12 +73,12 @@ /* links atom IDs to parse functions */ typedef struct MOVParseTableEntry { uint32_t type; - int (*parse)(MOVContext *ctx, ByteIOContext *pb, MOVAtom atom); + int (*parse)(MOVContext *ctx, AVIOContext *pb, MOVAtom atom); } MOVParseTableEntry; static const MOVParseTableEntry mov_default_parse_table[]; -static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len) +static int mov_metadata_trkn(MOVContext *c, AVIOContext *pb, unsigned len) { char buf[16]; @@ -110,7 +110,7 @@ static const uint32_t mac_to_unicode[128] = { 0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7, }; -static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len, +static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, char *dst, int dstlen) { char *p = dst; @@ -128,7 +128,7 @@ static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len, return p - dst; } -static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) { #ifdef MOV_EXPORT_ALL_METADATA char tmp_key[5]; @@ -137,7 +137,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) const char *key = NULL; uint16_t str_size, langcode = 0; uint32_t data_type = 0; - int (*parse)(MOVContext*, ByteIOContext*, unsigned) = NULL; + int (*parse)(MOVContext*, AVIOContext*, unsigned) = NULL; switch (atom.type) { case MKTAG(0xa9,'n','a','m'): key = "title"; break; @@ -218,7 +218,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t start; int i, nb_chapters, str_len, version; @@ -250,7 +250,7 @@ static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t total_size = 0; MOVAtom a; @@ -259,7 +259,7 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) if (atom.size < 0) atom.size = INT64_MAX; while (total_size + 8 < atom.size && !url_feof(pb)) { - int (*parse)(MOVContext*, ByteIOContext*, MOVAtom) = NULL; + int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL; a.size = atom.size; a.type=0; if(atom.size >= 8) { @@ -319,7 +319,7 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -423,7 +423,7 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; uint32_t type; @@ -460,7 +460,7 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom) +int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom) { AVStream *st; int tag, len; @@ -483,12 +483,12 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_esds(MOVContext *c, AVIOContext *pb, MOVAtom atom) { return ff_mov_read_esds(c->fc, pb, atom); } -static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; int ac3info, acmod, lfeon; @@ -505,7 +505,7 @@ static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom) { const int num = get_be32(pb); const int den = get_be32(pb); @@ -529,7 +529,7 @@ static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } /* this atom contains actual media data */ -static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_mdat(MOVContext *c, AVIOContext *pb, MOVAtom atom) { if(atom.size == 0) /* wrong one (MP4) */ return 0; @@ -538,7 +538,7 @@ static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } /* read major brand, minor version and compatible brands and store them as metadata */ -static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) { uint32_t minor_ver; int comp_brand_size; @@ -570,7 +570,7 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } /* this atom should contain all header atoms */ -static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom) { if (mov_read_default(c, pb, atom) < 0) return -1; @@ -580,7 +580,7 @@ static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; /* now go for mdat */ } -static int mov_read_moof(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) { c->fragment.moof_offset = url_ftell(pb) - 8; av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset); @@ -600,7 +600,7 @@ static void mov_metadata_creation_time(AVMetadata **metadata, time_t time) } } -static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -639,7 +639,7 @@ static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { time_t creation_time; int version = get_byte(pb); /* version */ @@ -677,7 +677,7 @@ static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -701,7 +701,7 @@ static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; int little_endian; @@ -734,7 +734,7 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */ -static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; uint64_t size; @@ -758,7 +758,7 @@ static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -789,7 +789,7 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom) * This function reads atom content and puts data in extradata without tag * nor size unlike mov_read_extradata. */ -static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -814,7 +814,7 @@ static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) * but can have extradata appended at the end after the 40 bytes belonging * to the struct. */ -static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -837,7 +837,7 @@ static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -908,7 +908,7 @@ enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags) return CODEC_ID_NONE; } -int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) +int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) { AVStream *st; MOVStreamContext *sc; @@ -1244,7 +1244,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) return 0; } -static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int entries; @@ -1255,7 +1255,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return ff_mov_read_stsd_entries(c, pb, entries); } -static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1288,7 +1288,7 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1317,7 +1317,7 @@ static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1349,7 +1349,7 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1417,7 +1417,7 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1464,7 +1464,7 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1682,7 +1682,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) } } -static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref) +static int mov_open_dref(AVIOContext **pb, char *src, MOVDref *ref) { /* try relative path, we do not try the absolute because it can leak information about our system to an attacker */ @@ -1725,7 +1725,7 @@ static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref) return AVERROR(ENOENT); } -static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1824,7 +1824,7 @@ static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int ret; c->itunes_metadata = 1; @@ -1833,7 +1833,7 @@ static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return ret; } -static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom) { while (atom.size > 8) { uint32_t tag = get_le32(pb); @@ -1847,7 +1847,7 @@ static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int i; int width; @@ -1930,7 +1930,7 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVFragment *frag = &c->fragment; MOVTrackExt *trex = NULL; @@ -1965,13 +1965,13 @@ static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_chap(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom) { c->chapter_track = get_be32(pb); return 0; } -static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVTrackExt *trex; @@ -1992,7 +1992,7 @@ static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVFragment *frag = &c->fragment; AVStream *st = NULL; @@ -2070,7 +2070,7 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) /* this atom should be null (from specs), but some buggy files put the 'moov' atom inside it... */ /* like the files created with Adobe Premiere 5.0, for samples see */ /* http://graphics.tudelft.nl/~wouter/publications/soundtests/ */ -static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int err; @@ -2090,10 +2090,10 @@ static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return err; } -static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) { #if CONFIG_ZLIB - ByteIOContext ctx; + AVIOContext ctx; uint8_t *cmov_data; uint8_t *moov_data; /* uncompressed data */ long cmov_len, moov_len; @@ -2142,7 +2142,7 @@ free_and_return: } /* edit list atom */ -static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVStreamContext *sc; int i, edit_count; @@ -2343,7 +2343,7 @@ finish: static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) { MOVContext *mov = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int err; MOVAtom atom = { AV_RL32("root") }; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 5e6e3a6521..097f4641f2 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -36,7 +36,7 @@ #include //FIXME support 64 bit variant with wide placeholders -static int64_t updateSize(ByteIOContext *pb, int64_t pos) +static int64_t updateSize(AVIOContext *pb, int64_t pos) { int64_t curpos = url_ftell(pb); url_fseek(pb, pos, SEEK_SET); @@ -47,7 +47,7 @@ static int64_t updateSize(ByteIOContext *pb, int64_t pos) } /* Chunk offset atom */ -static int mov_write_stco_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track) { int i; int mode64 = 0; // use 32 bit size variant if possible @@ -70,7 +70,7 @@ static int mov_write_stco_tag(ByteIOContext *pb, MOVTrack *track) } /* Sample size atom */ -static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) { int equalChunks = 1; int i, j, entries = 0, tst = -1, oldtst = -1; @@ -107,7 +107,7 @@ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track) } /* Sample to chunk atom */ -static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) { int index = 0, oldval = -1, i; int64_t entryPos, curpos; @@ -137,7 +137,7 @@ static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track) } /* Sync sample atom */ -static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track, uint32_t flag) +static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) { int64_t curpos, entryPos; int i, index = 0; @@ -160,7 +160,7 @@ static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track, uint32_t flag) return updateSize(pb, pos); } -static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track) { put_be32(pb, 0x11); /* size */ if (track->mode == MODE_MOV) put_tag(pb, "samr"); @@ -174,7 +174,7 @@ static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track) return 0x11; } -static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track) { GetBitContext gbc; PutBitContext pbc; @@ -222,13 +222,13 @@ static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track) * This function writes extradata "as is". * Extradata must be formated like a valid atom (with size and tag) */ -static int mov_write_extradata_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_extradata_tag(AVIOContext *pb, MOVTrack *track) { put_buffer(pb, track->enc->extradata, track->enc->extradata_size); return track->enc->extradata_size; } -static int mov_write_enda_tag(ByteIOContext *pb) +static int mov_write_enda_tag(AVIOContext *pb) { put_be32(pb, 10); put_tag(pb, "enda"); @@ -243,7 +243,7 @@ static unsigned int descrLength(unsigned int len) return len + 1 + i; } -static void putDescr(ByteIOContext *pb, int tag, unsigned int size) +static void putDescr(AVIOContext *pb, int tag, unsigned int size) { int i= descrLength(size) - size - 2; put_byte(pb, tag); @@ -252,7 +252,7 @@ static void putDescr(ByteIOContext *pb, int tag, unsigned int size) put_byte(pb, size & 0x7F); } -static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic +static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic { int64_t pos = url_ftell(pb); int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; @@ -314,7 +314,7 @@ static int mov_pcm_le_gt16(enum CodecID codec_id) codec_id == CODEC_ID_PCM_F64LE; } -static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); @@ -324,7 +324,7 @@ static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); @@ -360,7 +360,7 @@ static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_glbl_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track) { put_be32(pb, track->vosLen+8); put_tag(pb, "glbl"); @@ -397,7 +397,7 @@ static int mov_get_lpcm_flags(enum CodecID codec_id) } } -static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); int version = 0; @@ -490,7 +490,7 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_d263_tag(ByteIOContext *pb) +static int mov_write_d263_tag(AVIOContext *pb) { put_be32(pb, 0xf); /* size */ put_tag(pb, "d263"); @@ -503,7 +503,7 @@ static int mov_write_d263_tag(ByteIOContext *pb) } /* TODO: No idea about these values */ -static int mov_write_svq3_tag(ByteIOContext *pb) +static int mov_write_svq3_tag(AVIOContext *pb) { put_be32(pb, 0x15); put_tag(pb, "SMI "); @@ -515,7 +515,7 @@ static int mov_write_svq3_tag(ByteIOContext *pb) return 0x15; } -static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); @@ -526,7 +526,7 @@ static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track) } /* also used by all avid codecs (dv, imx, meridien) and their variants */ -static int mov_write_avid_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track) { int i; put_be32(pb, 24); /* size */ @@ -738,7 +738,7 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) * Needed to make file play in iPods running newest firmware * goes after avcC atom in moov.trak.mdia.minf.stbl.stsd.avc1 */ -static int mov_write_uuid_tag_ipod(ByteIOContext *pb) +static int mov_write_uuid_tag_ipod(AVIOContext *pb) { put_be32(pb, 28); put_tag(pb, "uuid"); @@ -750,7 +750,7 @@ static int mov_write_uuid_tag_ipod(ByteIOContext *pb) return 28; } -static int mov_write_subtitle_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ @@ -765,7 +765,7 @@ static int mov_write_subtitle_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_pasp_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) { AVRational sar; av_reduce(&sar.num, &sar.den, track->enc->sample_aspect_ratio.num, @@ -778,7 +778,7 @@ static int mov_write_pasp_tag(ByteIOContext *pb, MOVTrack *track) return 16; } -static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); char compressor_name[32]; @@ -848,7 +848,7 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_rtp_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ @@ -868,7 +868,7 @@ static int mov_write_rtp_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ @@ -886,7 +886,7 @@ static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) { MOVStts *ctts_entries; uint32_t entries = 0; @@ -920,7 +920,7 @@ static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track) } /* Time to sample atom */ -static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track) { MOVStts *stts_entries; uint32_t entries = -1; @@ -961,7 +961,7 @@ static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack *track) return atom_size; } -static int mov_write_dref_tag(ByteIOContext *pb) +static int mov_write_dref_tag(AVIOContext *pb) { put_be32(pb, 28); /* size */ put_tag(pb, "dref"); @@ -975,7 +975,7 @@ static int mov_write_dref_tag(ByteIOContext *pb) return 28; } -static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ @@ -997,7 +997,7 @@ static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_dinf_tag(ByteIOContext *pb) +static int mov_write_dinf_tag(AVIOContext *pb) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ @@ -1006,7 +1006,7 @@ static int mov_write_dinf_tag(ByteIOContext *pb) return updateSize(pb, pos); } -static int mov_write_nmhd_tag(ByteIOContext *pb) +static int mov_write_nmhd_tag(AVIOContext *pb) { put_be32(pb, 12); put_tag(pb, "nmhd"); @@ -1014,7 +1014,7 @@ static int mov_write_nmhd_tag(ByteIOContext *pb) return 12; } -static int mov_write_gmhd_tag(ByteIOContext *pb) +static int mov_write_gmhd_tag(AVIOContext *pb) { put_be32(pb, 0x20); /* size */ put_tag(pb, "gmhd"); @@ -1030,7 +1030,7 @@ static int mov_write_gmhd_tag(ByteIOContext *pb) return 0x20; } -static int mov_write_smhd_tag(ByteIOContext *pb) +static int mov_write_smhd_tag(AVIOContext *pb) { put_be32(pb, 16); /* size */ put_tag(pb, "smhd"); @@ -1040,7 +1040,7 @@ static int mov_write_smhd_tag(ByteIOContext *pb) return 16; } -static int mov_write_vmhd_tag(ByteIOContext *pb) +static int mov_write_vmhd_tag(AVIOContext *pb) { put_be32(pb, 0x14); /* size (always 0x14) */ put_tag(pb, "vmhd"); @@ -1049,7 +1049,7 @@ static int mov_write_vmhd_tag(ByteIOContext *pb) return 0x14; } -static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) { const char *hdlr, *descr = NULL, *hdlr_type = NULL; int64_t pos = url_ftell(pb); @@ -1092,7 +1092,7 @@ static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_hmhd_tag(ByteIOContext *pb) +static int mov_write_hmhd_tag(AVIOContext *pb) { /* This atom must be present, but leaving the values at zero * seems harmless. */ @@ -1107,7 +1107,7 @@ static int mov_write_hmhd_tag(ByteIOContext *pb) return 28; } -static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ @@ -1129,7 +1129,7 @@ static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) { int version = track->trackDuration < INT32_MAX ? 0 : 1; @@ -1159,7 +1159,7 @@ static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track) return 32; } -static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ @@ -1170,7 +1170,7 @@ static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) +static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) { int64_t duration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE, track->timescale, AV_ROUND_UP); @@ -1229,7 +1229,7 @@ static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) } // This box seems important for the psp playback ... without it the movie seems to hang -static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track) { put_be32(pb, 0x24); /* size */ put_tag(pb, "edts"); @@ -1247,7 +1247,7 @@ static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track) return 0x24; } -static int mov_write_tref_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track) { put_be32(pb, 20); // size put_tag(pb, "tref"); @@ -1258,7 +1258,7 @@ static int mov_write_tref_tag(ByteIOContext *pb, MOVTrack *track) } // goes at the end of each track! ... Critical for PSP playback ("Incompatible data" without it) -static int mov_write_uuid_tag_psp(ByteIOContext *pb, MOVTrack *mov) +static int mov_write_uuid_tag_psp(AVIOContext *pb, MOVTrack *mov) { put_be32(pb, 0x34); /* size ... reports as 28 in mp4box! */ put_tag(pb, "uuid"); @@ -1276,7 +1276,7 @@ static int mov_write_uuid_tag_psp(ByteIOContext *pb, MOVTrack *mov) return 0x34; } -static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index) +static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index) { char buf[1000] = ""; int len; @@ -1295,7 +1295,7 @@ static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index) return len + 24; } -static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) +static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ @@ -1315,7 +1315,7 @@ static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) #if 0 /* TODO: Not sorted out, but not necessary either */ -static int mov_write_iods_tag(ByteIOContext *pb, MOVMuxContext *mov) +static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov) { put_be32(pb, 0x15); /* size */ put_tag(pb, "iods"); @@ -1329,7 +1329,7 @@ static int mov_write_iods_tag(ByteIOContext *pb, MOVMuxContext *mov) } #endif -static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov) +static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov) { int maxTrackID = 1, i; int64_t maxTrackLenTemp, maxTrackLen = 0; @@ -1390,7 +1390,7 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov) return 0x6c; } -static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_itunes_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { put_be32(pb, 33); /* size */ @@ -1406,7 +1406,7 @@ static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov, } /* helper function to write a data tag with the specified string as data */ -static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int lang, int long_style) +static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang, int long_style) { if(long_style){ int size = 16 + strlen(data); @@ -1426,7 +1426,7 @@ static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int la } } -static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int lang, int long_style){ +static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){ int size = 0; if (value && value[0]) { int64_t pos = url_ftell(pb); @@ -1438,7 +1438,7 @@ static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char return size; } -static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb, +static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb, const char *name, const char *tag, int long_style) { @@ -1463,7 +1463,7 @@ static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb, } /* iTunes track number */ -static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0); @@ -1485,7 +1485,7 @@ static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov, } /* iTunes meta data list */ -static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int64_t pos = url_ftell(pb); @@ -1513,7 +1513,7 @@ static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov, } /* iTunes meta data tag */ -static int mov_write_meta_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int size = 0; @@ -1538,7 +1538,7 @@ static int utf8len(const uint8_t *b) return len; } -static int ascii_to_wc(ByteIOContext *pb, const uint8_t *b) +static int ascii_to_wc(AVIOContext *pb, const uint8_t *b) { int val; while(*b){ @@ -1554,7 +1554,7 @@ static uint16_t language_code(const char *str) return (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F); } -static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s, +static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, const char *tag, const char *str) { int64_t pos = url_ftell(pb); @@ -1576,7 +1576,7 @@ static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s, return updateSize(pb, pos); } -static int mov_write_chpl_tag(ByteIOContext *pb, AVFormatContext *s) +static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s) { int64_t pos = url_ftell(pb); int i, nb_chapters = FFMIN(s->nb_chapters, 255); @@ -1602,10 +1602,10 @@ static int mov_write_chpl_tag(ByteIOContext *pb, AVFormatContext *s) return updateSize(pb, pos); } -static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { - ByteIOContext *pb_buf; + AVIOContext *pb_buf; int i, ret, size; uint8_t *buf; @@ -1655,7 +1655,7 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov, return 0; } -static void mov_write_psp_udta_tag(ByteIOContext *pb, +static void mov_write_psp_udta_tag(AVIOContext *pb, const char *str, const char *lang, int type) { int len = utf8len(str)+1; @@ -1668,7 +1668,7 @@ static void mov_write_psp_udta_tag(ByteIOContext *pb, ascii_to_wc(pb, str); } -static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s) +static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) { AVMetadataTag *title = av_metadata_get(s->metadata, "title", NULL, 0); int64_t pos, pos2; @@ -1706,7 +1706,7 @@ static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s) return 0; } -static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int i; @@ -1750,7 +1750,7 @@ static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov, return updateSize(pb, pos); } -static int mov_write_mdat_tag(ByteIOContext *pb, MOVMuxContext *mov) +static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) { put_be32(pb, 8); // placeholder for extended size field (64 bit) put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free"); @@ -1762,7 +1762,7 @@ static int mov_write_mdat_tag(ByteIOContext *pb, MOVMuxContext *mov) } /* TODO: This needs to be more general */ -static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s) +static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; int64_t pos = url_ftell(pb); @@ -1818,7 +1818,7 @@ static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s) return updateSize(pb, pos); } -static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s) +static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s) { AVCodecContext *VideoCodec = s->streams[0]->codec; AVCodecContext *AudioCodec = s->streams[1]->codec; @@ -1903,7 +1903,7 @@ static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags) int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) { MOVMuxContext *mov = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; MOVTrack *trk = &mov->tracks[pkt->stream_index]; AVCodecContext *enc = trk->enc; unsigned int samplesInChunk = 0; @@ -2040,7 +2040,7 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum) static int mov_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; MOVMuxContext *mov = s->priv_data; int i, hint_track = 0; @@ -2192,7 +2192,7 @@ static int mov_write_header(AVFormatContext *s) static int mov_write_trailer(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int res = 0; int i; diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index cdfb276131..d9c1e44f05 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -245,7 +245,7 @@ static int find_sample_match(const uint8_t *data, int len, } static void output_immediate(const uint8_t *data, int size, - ByteIOContext *out, int *entries) + AVIOContext *out, int *entries) { while (size > 0) { int len = size; @@ -264,7 +264,7 @@ static void output_immediate(const uint8_t *data, int size, } } -static void output_match(ByteIOContext *out, int match_sample, +static void output_match(AVIOContext *out, int match_sample, int match_offset, int match_len, int *entries) { put_byte(out, 2); /* sample constructor */ @@ -278,7 +278,7 @@ static void output_match(ByteIOContext *out, int match_sample, } static void describe_payload(const uint8_t *data, int size, - ByteIOContext *out, int *entries, + AVIOContext *out, int *entries, HintSampleQueue *queue) { /* Describe the payload using different constructors */ @@ -309,7 +309,7 @@ static void describe_payload(const uint8_t *data, int size, * @param pts pointer where the timestamp for the written RTP hint is stored * @return the number of RTP packets in the written hint */ -static int write_hint_packets(ByteIOContext *out, const uint8_t *data, +static int write_hint_packets(AVIOContext *out, const uint8_t *data, int size, MOVTrack *trk, int64_t *pts) { int64_t curpos; @@ -392,7 +392,7 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt, AVFormatContext *rtp_ctx = trk->rtp_ctx; uint8_t *buf = NULL; int size; - ByteIOContext *hintbuf = NULL; + AVIOContext *hintbuf = NULL; AVPacket hint_pkt; int ret = 0, count; diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 5921dedad0..cdecda67c3 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -93,8 +93,8 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 { int len; uint8_t *pb; - int (*put)(ByteIOContext*, const char*); - ByteIOContext *dyn_buf; + int (*put)(AVIOContext*, const char*); + AVIOContext *dyn_buf; if (url_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 11173004f5..d40a602e83 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -117,7 +117,7 @@ static inline int64_t gb_get_v(GetBitContext *gb) return v; } -static void mpc8_get_chunk_header(ByteIOContext *pb, int *tag, int64_t *size) +static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size) { int64_t pos; pos = url_ftell(pb); @@ -171,7 +171,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos, off; switch(tag){ @@ -189,7 +189,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) { MPCContext *c = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int tag = 0; int64_t size, pos; diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 2df7a154f8..66e967c022 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -124,7 +124,7 @@ static int mpegps_read_header(AVFormatContext *s, return 0; } -static int64_t get_pts(ByteIOContext *pb, int c) +static int64_t get_pts(AVIOContext *pb, int c) { uint8_t buf[5]; @@ -134,7 +134,7 @@ static int64_t get_pts(ByteIOContext *pb, int c) return ff_parse_pes_pts(buf); } -static int find_next_start_code(ByteIOContext *pb, int *size_ptr, +static int find_next_start_code(AVIOContext *pb, int *size_ptr, int32_t *header_state) { unsigned int state, v; @@ -163,7 +163,7 @@ static int find_next_start_code(ByteIOContext *pb, int *size_ptr, #if 0 /* unused, remove? */ /* XXX: optimize */ -static int find_prev_start_code(ByteIOContext *pb, int *size_ptr) +static int find_prev_start_code(AVIOContext *pb, int *size_ptr) { int64_t pos, pos_start; int max_size, start_code; @@ -202,7 +202,7 @@ static int find_prev_start_code(ByteIOContext *pb, int *size_ptr) * * @return number of bytes occupied by PSM in the bitstream */ -static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb) +static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) { int psm_length, ps_info_length, es_map_length; diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index eef385f06c..e5ee32d276 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -491,7 +491,7 @@ static int mpeg_mux_init(AVFormatContext *ctx) return AVERROR(ENOMEM); } -static inline void put_timestamp(ByteIOContext *pb, int id, int64_t timestamp) +static inline void put_timestamp(AVIOContext *pb, int id, int64_t timestamp) { put_byte(pb, (id << 4) | @@ -613,7 +613,7 @@ static int get_packet_payload_size(AVFormatContext *ctx, int stream_index, #endif /* Write an MPEG padding packet header. */ -static void put_padding_packet(AVFormatContext *ctx, ByteIOContext *pb,int packet_bytes) +static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes) { MpegMuxContext *s = ctx->priv_data; int i; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index abb6f080f4..a97fd7a62d 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -851,7 +851,7 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size, int *es_id, uint8_t **dec_config_descr, int *dec_config_descr_size) { - ByteIOContext pb; + AVIOContext pb; int tag; unsigned len; @@ -913,7 +913,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type get16(pp, desc_end); if (st->codec->codec_id == CODEC_ID_AAC_LATM && mp4_dec_config_descr_len && mp4_es_id == pid) { - ByteIOContext pb; + AVIOContext pb; init_put_byte(&pb, mp4_dec_config_descr, mp4_dec_config_descr_len, 0, NULL, NULL, NULL, NULL); ff_mp4_read_dec_config_descr(fc, st, &pb); @@ -1307,7 +1307,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) get_packet_size() ?) */ static int mpegts_resync(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int c, i; for(i = 0;i < MAX_RESYNC_SIZE; i++) { @@ -1327,7 +1327,7 @@ static int mpegts_resync(AVFormatContext *s) /* return -1 if error or EOF. Return 0 if OK. */ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int skip, len; for(;;) { @@ -1439,7 +1439,7 @@ static int mpegts_read_header(AVFormatContext *s, AVFormatParameters *ap) { MpegTSContext *ts = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t buf[5*1024]; int len; int64_t pos; diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 89b88d7027..891d469ab3 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -593,7 +593,7 @@ static void retransmit_si_info(AVFormatContext *s) } } -static int64_t get_pcr(const MpegTSWrite *ts, ByteIOContext *pb) +static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb) { return av_rescale(url_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + ts->first_pcr; diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index f9cde02780..4408c18601 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -71,7 +71,7 @@ static int msnwc_tcp_probe(AVProbeData *p) static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) { - ByteIOContext *pb = ctx->pb; + AVIOContext *pb = ctx->pb; AVCodecContext *codec; AVStream *st; @@ -100,7 +100,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) { - ByteIOContext *pb = ctx->pb; + AVIOContext *pb = ctx->pb; uint16_t keyframe; uint32_t size, timestamp; diff --git a/libavformat/mtv.c b/libavformat/mtv.c index acb21a99b8..d6f8a2018b 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -79,7 +79,7 @@ static int mtv_probe(AVProbeData *p) static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) { MTVDemuxContext *mtv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned int audio_subsegments; @@ -156,7 +156,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) { MTVDemuxContext *mtv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; #if !HAVE_BIGENDIAN int i; diff --git a/libavformat/mvi.c b/libavformat/mvi.c index c982e6bc68..053de15a5a 100644 --- a/libavformat/mvi.c +++ b/libavformat/mvi.c @@ -27,7 +27,7 @@ #define MVI_VIDEO_STREAM_INDEX 1 typedef struct MviDemuxContext { - unsigned int (*get_int)(ByteIOContext *); + unsigned int (*get_int)(AVIOContext *); uint32_t audio_data_size; uint64_t audio_size_counter; uint64_t audio_frame_size; @@ -38,7 +38,7 @@ typedef struct MviDemuxContext { static int read_header(AVFormatContext *s, AVFormatParameters *ap) { MviDemuxContext *mvi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *ast, *vst; unsigned int version, frames_count, msecs_per_frame, player_version; @@ -100,7 +100,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, count; MviDemuxContext *mvi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (mvi->video_frame_size == 0) { mvi->video_frame_size = (mvi->get_int)(pb); diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 9193561944..6246fca0aa 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -140,7 +140,7 @@ enum MXFWrappingScheme { Clip, }; -typedef int MXFMetadataReadFunc(void *arg, ByteIOContext *pb, int tag, int size, UID uid); +typedef int MXFMetadataReadFunc(void *arg, AVIOContext *pb, int tag, int size, UID uid); typedef struct { const UID key; @@ -161,7 +161,7 @@ static const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x #define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y))) -static int64_t klv_decode_ber_length(ByteIOContext *pb) +static int64_t klv_decode_ber_length(AVIOContext *pb) { uint64_t size = get_byte(pb); if (size & 0x80) { /* long form */ @@ -176,7 +176,7 @@ static int64_t klv_decode_ber_length(ByteIOContext *pb) return size; } -static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size) +static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size) { int i, b; for (i = 0; i < size && !url_feof(pb); i++) { @@ -189,7 +189,7 @@ static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size) return i == size; } -static int klv_read_packet(KLVPacket *klv, ByteIOContext *pb) +static int klv_read_packet(KLVPacket *klv, AVIOContext *pb) { if (!mxf_read_sync(pb, mxf_klv_key, 4)) return -1; @@ -215,7 +215,7 @@ static int mxf_get_stream_index(AVFormatContext *s, KLVPacket *klv) } /* XXX: use AVBitStreamFilter */ -static int mxf_get_d10_aes3_packet(ByteIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length) +static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length) { const uint8_t *buf_ptr, *end_ptr; uint8_t *data_ptr; @@ -246,7 +246,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv { static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b}; MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t end = url_ftell(pb) + klv->length; uint64_t size; uint64_t orig_size; @@ -344,7 +344,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR_EOF; } -static int mxf_read_primer_pack(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFContext *mxf = arg; int item_num = get_be32(pb); @@ -376,7 +376,7 @@ static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set) return 0; } -static int mxf_read_cryptographic_context(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFCryptoContext *cryptocontext = arg; if (size != 16) @@ -386,7 +386,7 @@ static int mxf_read_cryptographic_context(void *arg, ByteIOContext *pb, int tag, return 0; } -static int mxf_read_content_storage(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFContext *mxf = arg; switch (tag) { @@ -404,7 +404,7 @@ static int mxf_read_content_storage(void *arg, ByteIOContext *pb, int tag, int s return 0; } -static int mxf_read_source_clip(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFStructuralComponent *source_clip = arg; switch(tag) { @@ -426,7 +426,7 @@ static int mxf_read_source_clip(void *arg, ByteIOContext *pb, int tag, int size, return 0; } -static int mxf_read_material_package(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFPackage *package = arg; switch(tag) { @@ -444,7 +444,7 @@ static int mxf_read_material_package(void *arg, ByteIOContext *pb, int tag, int return 0; } -static int mxf_read_track(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFTrack *track = arg; switch(tag) { @@ -465,7 +465,7 @@ static int mxf_read_track(void *arg, ByteIOContext *pb, int tag, int size, UID u return 0; } -static int mxf_read_sequence(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFSequence *sequence = arg; switch(tag) { @@ -489,7 +489,7 @@ static int mxf_read_sequence(void *arg, ByteIOContext *pb, int tag, int size, UI return 0; } -static int mxf_read_source_package(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFPackage *package = arg; switch(tag) { @@ -515,7 +515,7 @@ static int mxf_read_source_package(void *arg, ByteIOContext *pb, int tag, int si return 0; } -static int mxf_read_index_table_segment(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid) { switch(tag) { case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break; @@ -528,7 +528,7 @@ static int mxf_read_index_table_segment(void *arg, ByteIOContext *pb, int tag, i return 0; } -static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor) +static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor) { int code, value, ofs = 0; char layout[16] = {0}; @@ -547,7 +547,7 @@ static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor) ff_mxf_decode_pixel_layout(layout, &descriptor->pix_fmt); } -static int mxf_read_generic_descriptor(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFDescriptor *descriptor = arg; switch(tag) { @@ -864,7 +864,7 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = { static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type) { - ByteIOContext *pb = mxf->fc->pb; + AVIOContext *pb = mxf->fc->pb; MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf; uint64_t klv_end = url_ftell(pb) + klv->length; diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 8a8d7ddaa7..9f2e4fe08d 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -305,7 +305,7 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = { { 0x3D0A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x02,0x01,0x00,0x00,0x00}}, /* Block Align */ }; -static void mxf_write_uuid(ByteIOContext *pb, enum MXFMetadataSetType type, int value) +static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int value) { put_buffer(pb, uuid_base, 12); put_be16(pb, type); @@ -321,7 +321,7 @@ static void mxf_write_umid(AVFormatContext *s, int type) put_byte(s->pb, type); } -static void mxf_write_refs_count(ByteIOContext *pb, int ref_count) +static void mxf_write_refs_count(AVIOContext *pb, int ref_count) { put_be32(pb, ref_count); put_be32(pb, 16); @@ -335,7 +335,7 @@ static int klv_ber_length(uint64_t len) return (av_log2(len) >> 3) + 2; } -static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len) +static int klv_encode_ber_length(AVIOContext *pb, uint64_t len) { // Determine the best BER size int size; @@ -356,7 +356,7 @@ static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len) return 0; } -static void klv_encode_ber4_length(ByteIOContext *pb, int len) +static void klv_encode_ber4_length(AVIOContext *pb, int len) { put_byte(pb, 0x80 + 3); put_be24(pb, len); @@ -376,7 +376,7 @@ static int mxf_get_essence_container_ul_index(enum CodecID id) static void mxf_write_primer_pack(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int local_tag_number, i = 0; local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch); @@ -393,13 +393,13 @@ static void mxf_write_primer_pack(AVFormatContext *s) } } -static void mxf_write_local_tag(ByteIOContext *pb, int size, int tag) +static void mxf_write_local_tag(AVIOContext *pb, int size, int tag) { put_be16(pb, tag); put_be16(pb, size); } -static void mxf_write_metadata_key(ByteIOContext *pb, unsigned int value) +static void mxf_write_metadata_key(AVIOContext *pb, unsigned int value) { put_buffer(pb, header_metadata_key, 13); put_be24(pb, value); @@ -429,7 +429,7 @@ static const MXFCodecUL *mxf_get_data_definition_ul(int type) static void mxf_write_essence_container_refs(AVFormatContext *s) { MXFContext *c = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; mxf_write_refs_count(pb, c->essence_container_count); @@ -443,7 +443,7 @@ static void mxf_write_essence_container_refs(AVFormatContext *s) static void mxf_write_preface(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_metadata_key(pb, 0x012f00); PRINT_KEY(s, "preface key", pb->buf_ptr - 16); @@ -487,7 +487,7 @@ static void mxf_write_preface(AVFormatContext *s) /* * Write a local tag containing an ascii string as utf-16 */ -static void mxf_write_local_tag_utf16(ByteIOContext *pb, int tag, const char *value) +static void mxf_write_local_tag_utf16(AVIOContext *pb, int tag, const char *value) { int i, size = strlen(value); mxf_write_local_tag(pb, size*2, tag); @@ -498,7 +498,7 @@ static void mxf_write_local_tag_utf16(ByteIOContext *pb, int tag, const char *va static void mxf_write_identification(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; const char *company = "FFmpeg"; const char *product = "OP1a Muxer"; const char *version; @@ -536,7 +536,7 @@ static void mxf_write_identification(AVFormatContext *s) static void mxf_write_content_storage(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_metadata_key(pb, 0x011800); PRINT_KEY(s, "content storage key", pb->buf_ptr - 16); @@ -562,7 +562,7 @@ static void mxf_write_content_storage(AVFormatContext *s) static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; MXFStreamContext *sc = st->priv_data; mxf_write_metadata_key(pb, 0x013b00); @@ -603,7 +603,7 @@ static const uint8_t smpte_12m_timecode_track_data_ul[] = { 0x06,0x0E,0x2B,0x34, static void mxf_write_common_fields(AVFormatContext *s, AVStream *st) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; // find data define uls mxf_write_local_tag(pb, 16, 0x0201); @@ -622,7 +622,7 @@ static void mxf_write_common_fields(AVFormatContext *s, AVStream *st) static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; enum MXFMetadataSetType component; mxf_write_metadata_key(pb, 0x010f00); @@ -650,7 +650,7 @@ static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadat static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_metadata_key(pb, 0x011400); klv_encode_ber_length(pb, 75); @@ -677,7 +677,7 @@ static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; mxf_write_metadata_key(pb, 0x011100); @@ -714,7 +714,7 @@ static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enu static void mxf_write_multi_descriptor(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; const uint8_t *ul; int i; @@ -752,7 +752,7 @@ static void mxf_write_generic_desc(AVFormatContext *s, AVStream *st, const UID k { MXFContext *mxf = s->priv_data; MXFStreamContext *sc = st->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; put_buffer(pb, key, 16); klv_encode_ber4_length(pb, size+20+8+12+20); @@ -780,7 +780,7 @@ static const UID mxf_generic_sound_descriptor_key = { 0x06,0x0E,0x2B,0x34,0x02,0 static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) { MXFStreamContext *sc = st->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int stored_height = (st->codec->height+15)/16*16; int display_height; int f1, f2; @@ -856,7 +856,7 @@ static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st) static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int profile_and_level = (st->codec->profile<<4) | st->codec->level; mxf_write_cdci_common(s, st, mxf_mpegvideo_descriptor_key, 8+5); @@ -874,7 +874,7 @@ static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st) static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_generic_desc(s, st, key, size+5+12+8+8); @@ -896,7 +896,7 @@ static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con static void mxf_write_wav_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_generic_sound_common(s, st, key, size+6+8); @@ -926,7 +926,7 @@ static void mxf_write_generic_sound_desc(AVFormatContext *s, AVStream *st) static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i, track_count = s->nb_streams+1; if (type == MaterialPackage) { @@ -996,7 +996,7 @@ static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type) static int mxf_write_essence_container_data(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_metadata_key(pb, 0x012300); klv_encode_ber_length(pb, 72); @@ -1039,7 +1039,7 @@ static unsigned klv_fill_size(uint64_t size) static void mxf_write_index_table_segment(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i, j, temporal_reordering = 0; int key_index = mxf->last_key_index; @@ -1187,7 +1187,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, const uint8_t *key, int write_metadata) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t header_byte_count_offset; unsigned index_byte_count = 0; uint64_t partition_offset = url_ftell(pb); @@ -1557,7 +1557,7 @@ static uint32_t ff_framenum_to_12m_time_code(unsigned frame, int drop, int fps) static void mxf_write_system_item(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned frame; uint32_t time_code; @@ -1598,7 +1598,7 @@ static void mxf_write_system_item(AVFormatContext *s) static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int packet_size = (uint64_t)st->codec->bit_rate*mxf->time_base.num / (8*mxf->time_base.den); // frame size int pad; @@ -1628,7 +1628,7 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int frame_size = pkt->size / st->codec->block_align; uint8_t *samples = pkt->data; uint8_t *end = pkt->data + pkt->size; @@ -1660,7 +1660,7 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[pkt->stream_index]; MXFStreamContext *sc = st->priv_data; MXFIndexEntry ie = {0}; @@ -1739,7 +1739,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) static void mxf_write_random_index_pack(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint64_t pos = url_ftell(pb); int i; @@ -1766,7 +1766,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s) static int mxf_write_footer(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count; diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index d20b226f2e..53e3186a25 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -221,7 +221,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header); static int nsv_resync(AVFormatContext *s) { NSVContext *nsv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint32_t v = 0; int i; @@ -266,7 +266,7 @@ static int nsv_resync(AVFormatContext *s) static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) { NSVContext *nsv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int file_size, size; int64_t duration; int strings_size; @@ -387,7 +387,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) { NSVContext *nsv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint32_t vtag, atag; uint16_t vwidth, vheight; AVRational framerate; @@ -537,7 +537,7 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap) static int nsv_read_chunk(AVFormatContext *s, int fill_header) { NSVContext *nsv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st[2] = {NULL, NULL}; NSVStream *nst; AVPacket *pkt; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index a57410802f..86ad9af9f9 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -35,7 +35,7 @@ #define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */ #endif -static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){ +static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){ unsigned int len= ff_get_v(bc); if(len && maxlen) @@ -54,14 +54,14 @@ static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){ return 0; } -static int64_t get_s(ByteIOContext *bc){ +static int64_t get_s(AVIOContext *bc){ int64_t v = ff_get_v(bc) + 1; if (v&1) return -(v>>1); else return (v>>1); } -static uint64_t get_fourcc(ByteIOContext *bc){ +static uint64_t get_fourcc(AVIOContext *bc){ unsigned int len= ff_get_v(bc); if (len==2) return get_le16(bc); @@ -70,21 +70,21 @@ static uint64_t get_fourcc(ByteIOContext *bc){ } #ifdef TRACE -static inline uint64_t get_v_trace(ByteIOContext *bc, char *file, char *func, int line){ +static inline uint64_t get_v_trace(AVIOContext *bc, char *file, char *func, int line){ uint64_t v= ff_get_v(bc); av_log(NULL, AV_LOG_DEBUG, "get_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); return v; } -static inline int64_t get_s_trace(ByteIOContext *bc, char *file, char *func, int line){ +static inline int64_t get_s_trace(AVIOContext *bc, char *file, char *func, int line){ int64_t v= get_s(bc); av_log(NULL, AV_LOG_DEBUG, "get_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); return v; } -static inline uint64_t get_vb_trace(ByteIOContext *bc, char *file, char *func, int line){ +static inline uint64_t get_vb_trace(AVIOContext *bc, char *file, char *func, int line){ uint64_t v= get_vb(bc); av_log(NULL, AV_LOG_DEBUG, "get_vb %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); @@ -95,7 +95,7 @@ static inline uint64_t get_vb_trace(ByteIOContext *bc, char *file, char *func, i #define get_vb(bc) get_vb_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__) #endif -static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum, uint64_t startcode) +static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode) { int64_t size; // start= url_ftell(bc) - 8; @@ -115,7 +115,7 @@ static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_ch return size; } -static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){ +static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){ uint64_t state=0; if(pos >= 0) @@ -144,7 +144,7 @@ static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){ * @param pos the start position of the search, or -1 if the current position * @return the position of the startcode or -1 if not found */ -static int64_t find_startcode(ByteIOContext *bc, uint64_t code, int64_t pos){ +static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos){ for(;;){ uint64_t startcode= find_any_startcode(bc, pos); if(startcode == code) @@ -175,7 +175,7 @@ static int nut_probe(AVProbeData *p){ }\ dst= tmp; -static int skip_reserved(ByteIOContext *bc, int64_t pos){ +static int skip_reserved(AVIOContext *bc, int64_t pos){ pos -= url_ftell(bc); if(pos<0){ url_fseek(bc, pos, SEEK_CUR); @@ -189,7 +189,7 @@ static int skip_reserved(ByteIOContext *bc, int64_t pos){ static int decode_main_header(NUTContext *nut){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; uint64_t tmp, end; unsigned int stream_count; int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_idx; @@ -299,7 +299,7 @@ static int decode_main_header(NUTContext *nut){ static int decode_stream_header(NUTContext *nut){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; StreamContext *stc; int class, stream_id; uint64_t tmp, end; @@ -397,7 +397,7 @@ static void set_disposition_bits(AVFormatContext* avf, char* value, int stream_i static int decode_info_header(NUTContext *nut){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; uint64_t tmp, chapter_start, chapter_len; unsigned int stream_id_plus1, count; int chapter_id, i; @@ -477,7 +477,7 @@ static int decode_info_header(NUTContext *nut){ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int64_t end, tmp; nut->last_syncpoint_pos= url_ftell(bc)-8; @@ -505,7 +505,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ static int find_and_decode_index(NUTContext *nut){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; uint64_t tmp, end; int i, j, syncpoint_count; int64_t filesize= url_fsize(bc); @@ -603,7 +603,7 @@ fail: static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) { NUTContext *nut = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int64_t pos; int initialized_stream_count; @@ -666,7 +666,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; StreamContext *stc; int size, flags, size_mul, pts_delta, i, reserved_count; uint64_t tmp; @@ -736,7 +736,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int size, stream_id, discard; int64_t pts, last_IP_pts; StreamContext *stc; @@ -777,7 +777,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) { NUTContext *nut = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int i, frame_code=0, ret, skip; int64_t ts, back_ptr; @@ -833,7 +833,7 @@ av_log(s, AV_LOG_DEBUG, "sync\n"); static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit){ NUTContext *nut = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int64_t pos, pts, back_ptr; av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_index, *pos_arg, pos_limit); diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 288e4bd4d8..ce7d6522a9 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -241,7 +241,7 @@ static void build_frame_code(AVFormatContext *s){ nut->frame_code['N'].flags= FLAG_INVALID; } -static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){ +static void put_tt(NUTContext *nut, StreamContext *nus, AVIOContext *bc, uint64_t val){ val *= nut->time_base_count; val += nus->time_base - nut->time_base; ff_put_v(bc, val); @@ -250,25 +250,25 @@ static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint6 /** * Store a string as vb. */ -static void put_str(ByteIOContext *bc, const char *string){ +static void put_str(AVIOContext *bc, const char *string){ int len= strlen(string); ff_put_v(bc, len); put_buffer(bc, string, len); } -static void put_s(ByteIOContext *bc, int64_t val){ +static void put_s(AVIOContext *bc, int64_t val){ ff_put_v(bc, 2*FFABS(val) - (val>0)); } #ifdef TRACE -static inline void ff_put_v_trace(ByteIOContext *bc, uint64_t v, char *file, char *func, int line){ +static inline void ff_put_v_trace(AVIOContext *bc, uint64_t v, char *file, char *func, int line){ av_log(NULL, AV_LOG_DEBUG, "ff_put_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); ff_put_v(bc, v); } -static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *func, int line){ +static inline void put_s_trace(AVIOContext *bc, int64_t v, char *file, char *func, int line){ av_log(NULL, AV_LOG_DEBUG, "put_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); put_s(bc, v); @@ -278,7 +278,7 @@ static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *f #endif //FIXME remove calculate_checksum -static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){ +static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){ uint8_t *dyn_buf=NULL; int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); int forw_ptr= dyn_size + 4*calculate_checksum; @@ -299,7 +299,7 @@ static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc av_free(dyn_buf); } -static void write_mainheader(NUTContext *nut, ByteIOContext *bc){ +static void write_mainheader(NUTContext *nut, AVIOContext *bc){ int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx; int64_t tmp_match; @@ -370,7 +370,7 @@ static void write_mainheader(NUTContext *nut, ByteIOContext *bc){ } } -static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStream *st, int i){ +static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream *st, int i){ NUTContext *nut = avctx->priv_data; AVCodecContext *codec = st->codec; ff_put_v(bc, i); @@ -422,17 +422,17 @@ static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStrea return 0; } -static int add_info(ByteIOContext *bc, const char *type, const char *value){ +static int add_info(AVIOContext *bc, const char *type, const char *value){ put_str(bc, type); put_s(bc, -1); put_str(bc, value); return 1; } -static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){ +static int write_globalinfo(NUTContext *nut, AVIOContext *bc){ AVFormatContext *s= nut->avf; AVMetadataTag *t = NULL; - ByteIOContext *dyn_bc; + AVIOContext *dyn_bc; uint8_t *dyn_buf=NULL; int count=0, dyn_size; int ret = url_open_dyn_buf(&dyn_bc); @@ -455,10 +455,10 @@ static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){ return 0; } -static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){ +static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){ AVFormatContext *s= nut->avf; AVStream* st = s->streams[stream_id]; - ByteIOContext *dyn_bc; + AVIOContext *dyn_bc; uint8_t *dyn_buf=NULL; int count=0, dyn_size, i; int ret = url_open_dyn_buf(&dyn_bc); @@ -486,9 +486,9 @@ static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){ return count; } -static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){ +static int write_headers(AVFormatContext *avctx, AVIOContext *bc){ NUTContext *nut = avctx->priv_data; - ByteIOContext *dyn_bc; + AVIOContext *dyn_bc; int i, ret; ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL); @@ -537,7 +537,7 @@ static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){ static int write_header(AVFormatContext *s){ NUTContext *nut = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int i, j, ret; nut->avf= s; @@ -628,7 +628,7 @@ static int find_best_header_idx(NUTContext *nut, AVPacket *pkt){ static int write_packet(AVFormatContext *s, AVPacket *pkt){ NUTContext *nut = s->priv_data; StreamContext *nus= &nut->stream[pkt->stream_index]; - ByteIOContext *bc = s->pb, *dyn_bc; + AVIOContext *bc = s->pb, *dyn_bc; FrameCode *fc; int64_t coded_pts; int best_length, frame_code, flags, needed_flags, i, header_idx, best_header_idx; @@ -781,7 +781,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ static int write_trailer(AVFormatContext *s){ NUTContext *nut= s->priv_data; - ByteIOContext *bc= s->pb; + AVIOContext *bc= s->pb; while(nut->header_count<3) write_headers(s, bc); diff --git a/libavformat/nuv.c b/libavformat/nuv.c index 58a00dfa1b..055a6dce60 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -55,7 +55,7 @@ static int nuv_probe(AVProbeData *p) { * \param myth set if this is a MythTVVideo format file * \return 1 if all required codec data was found */ -static int get_codec_data(ByteIOContext *pb, AVStream *vst, +static int get_codec_data(AVIOContext *pb, AVStream *vst, AVStream *ast, int myth) { nuv_frametype frametype; if (!vst && !myth) @@ -122,7 +122,7 @@ static int get_codec_data(ByteIOContext *pb, AVStream *vst, static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { NUVContext *ctx = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; char id_string[12]; double aspect, fps; int is_mythtv, width, height, v_packs, a_packs; @@ -191,7 +191,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { NUVContext *ctx = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t hdr[HDRSIZE]; nuv_frametype frametype; int ret, size; diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index be2f03a47b..d508fe32d2 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -84,7 +84,7 @@ static int ogg_restore (AVFormatContext * s, int discard) { struct ogg *ogg = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; struct ogg_state *ost = ogg->state; int i; @@ -194,7 +194,7 @@ ogg_new_buf(struct ogg *ogg, int idx) static int ogg_read_page (AVFormatContext * s, int *str) { - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; struct ogg *ogg = s->priv_data; struct ogg_stream *os; int i = 0; @@ -601,7 +601,7 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg, { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + stream_index; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int64_t pts = AV_NOPTS_VALUE; int i; url_fseek(bc, *pos_arg, SEEK_SET); diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 4c2a9d6a61..79e4a8aa90 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -64,7 +64,7 @@ typedef struct { OGGPageList *page_list; } OGGContext; -static void ogg_update_checksum(AVFormatContext *s, ByteIOContext *pb, int64_t crc_offset) +static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset) { int64_t pos = url_ftell(pb); uint32_t checksum = get_checksum(pb); @@ -76,7 +76,7 @@ static void ogg_update_checksum(AVFormatContext *s, ByteIOContext *pb, int64_t c static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) { OGGStreamContext *oggstream = s->streams[page->stream_index]->priv_data; - ByteIOContext *pb; + AVIOContext *pb; int64_t crc_offset; int ret, size; uint8_t *buf; diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index 4b3d0f3ae0..bffb72c4d4 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -98,7 +98,7 @@ static int str_probe(AVProbeData *p) static int str_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; StrDemuxContext *str = s->priv_data; unsigned char sector[RAW_CD_SECTOR_SIZE]; int start; @@ -127,7 +127,7 @@ static int str_read_header(AVFormatContext *s, static int str_read_packet(AVFormatContext *s, AVPacket *ret_pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; StrDemuxContext *str = s->priv_data; unsigned char sector[RAW_CD_SECTOR_SIZE]; int channel; diff --git a/libavformat/pva.c b/libavformat/pva.c index 544fc7d0cf..9b370cea4d 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -67,7 +67,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { static int read_part_of_packet(AVFormatContext *s, int64_t *pts, int *len, int *strid, int read_packet) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; PVAContext *pvactx = s->priv_data; int syncword, streamid, reserved, flags, length, pts_flag; int64_t pva_pts = AV_NOPTS_VALUE, startpos; @@ -157,7 +157,7 @@ recover: } static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pva_pts; int ret, length, streamid; @@ -173,7 +173,7 @@ static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) { static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; PVAContext *pvactx = s->priv_data; int length, streamid; int64_t res = AV_NOPTS_VALUE; diff --git a/libavformat/qcp.c b/libavformat/qcp.c index 7bc32b97ce..48b5d64c2d 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -82,7 +82,7 @@ static int qcp_probe(AVProbeData *pd) static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; QCPContext *c = s->priv_data; AVStream *st = av_new_stream(s, 0); uint8_t buf[16]; @@ -136,7 +136,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; QCPContext *c = s->priv_data; unsigned int chunk_size, tag; diff --git a/libavformat/rdt.c b/libavformat/rdt.c index a9bf476276..4b0664fb44 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -130,7 +130,7 @@ ff_rdt_calc_response_and_checksum(char response[41], char chksum[9], static int rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) { - ByteIOContext pb; + AVIOContext pb; int size; uint32_t tag; @@ -295,7 +295,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, const uint8_t *buf, int len, int flags) { int seq = 1, res; - ByteIOContext pb; + AVIOContext pb; if (rdt->audio_pkt_cnt == 0) { int pos; diff --git a/libavformat/riff.c b/libavformat/riff.c index 4edccced99..9f7d949dce 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -319,14 +319,14 @@ const AVCodecTag ff_codec_wav_tags[] = { }; #if CONFIG_MUXERS -int64_t ff_start_tag(ByteIOContext *pb, const char *tag) +int64_t ff_start_tag(AVIOContext *pb, const char *tag) { put_tag(pb, tag); put_le32(pb, 0); return url_ftell(pb); } -void ff_end_tag(ByteIOContext *pb, int64_t start) +void ff_end_tag(AVIOContext *pb, int64_t start) { int64_t pos; @@ -338,7 +338,7 @@ void ff_end_tag(ByteIOContext *pb, int64_t start) /* WAVEFORMATEX header */ /* returns the size or -1 on error */ -int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc) +int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) { int bps, blkalign, bytespersec; int hdrsize = 18; @@ -445,7 +445,7 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc) } /* BITMAPINFOHEADER header */ -void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf) +void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf) { put_le32(pb, 40 + enc->extradata_size); /* size */ put_le32(pb, enc->width); @@ -477,7 +477,7 @@ void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag * WAVEFORMATEX adds 'WORD cbSize' and basically makes itself * an openended structure. */ -void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size) +void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) { int id; @@ -544,7 +544,7 @@ enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps) return id; } -int ff_get_bmp_header(ByteIOContext *pb, AVStream *st) +int ff_get_bmp_header(AVIOContext *pb, AVStream *st) { int tag1; get_le32(pb); /* size */ diff --git a/libavformat/riff.h b/libavformat/riff.h index 5045abcd31..5a45a38e68 100644 --- a/libavformat/riff.h +++ b/libavformat/riff.h @@ -32,20 +32,20 @@ #include "avio.h" #include "internal.h" -int64_t ff_start_tag(ByteIOContext *pb, const char *tag); -void ff_end_tag(ByteIOContext *pb, int64_t start); +int64_t ff_start_tag(AVIOContext *pb, const char *tag); +void ff_end_tag(AVIOContext *pb, int64_t start); /** * Read BITMAPINFOHEADER structure and set AVStream codec width, height and * bits_per_encoded_sample fields. Does not read extradata. * @return codec tag */ -int ff_get_bmp_header(ByteIOContext *pb, AVStream *st); +int ff_get_bmp_header(AVIOContext *pb, AVStream *st); -void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf); -int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc); +void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf); +int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc); enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps); -void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size); +void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size); extern const AVCodecTag ff_codec_bmp_tags[]; extern const AVCodecTag ff_codec_wav_tags[]; diff --git a/libavformat/rl2.c b/libavformat/rl2.c index ed1fb23296..d655d3e9f5 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -74,7 +74,7 @@ static int rl2_probe(AVProbeData *p) static av_cold int rl2_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned int frame_count; unsigned int audio_frame_counter = 0; @@ -214,7 +214,7 @@ static int rl2_read_packet(AVFormatContext *s, AVPacket *pkt) { Rl2DemuxContext *rl2 = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVIndexEntry *sample = NULL; int i; int ret = 0; diff --git a/libavformat/rm.h b/libavformat/rm.h index 2d4656aa11..6de10924ab 100644 --- a/libavformat/rm.h +++ b/libavformat/rm.h @@ -41,7 +41,7 @@ extern AVInputFormat ff_rdt_demuxer; * Read the MDPR chunk, which contains stream-specific codec initialization * parameters. * - * @param s context containing RMContext and ByteIOContext for stream reading + * @param s context containing RMContext and AVIOContext for stream reading * @param pb context to read the data from * @param st the stream that the MDPR chunk belongs to and where to store the * parameters read from the chunk into @@ -49,14 +49,14 @@ extern AVInputFormat ff_rdt_demuxer; * @param codec_data_size size of the MDPR chunk * @return 0 on success, errno codes on error */ -int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, +int ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, int codec_data_size); /** * Parse one rm-stream packet from the input bytestream. * - * @param s context containing RMContext and ByteIOContext for stream reading + * @param s context containing RMContext and AVIOContext for stream reading * @param pb context to read the data from * @param st stream to which the packet to be read belongs * @param rst Real-specific stream information @@ -70,7 +70,7 @@ int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, * value >0 means that no data was placed in pkt, but that cached * data is available by calling ff_rm_retrieve_cache(). */ -int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, +int ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, int len, AVPacket *pkt, int *seq, int flags, int64_t ts); @@ -82,7 +82,7 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, * a positive number, the amount of cached packets. Using this function, each * of those packets can be retrieved sequentially. * - * @param s context containing RMContext and ByteIOContext for stream reading + * @param s context containing RMContext and AVIOContext for stream reading * @param pb context to read the data from * @param st stream that this packet belongs to * @param rst Real-specific stream information @@ -90,7 +90,7 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, * @return the number of samples left for subsequent calls to this same * function, or 0 if all samples have been retrieved. */ -int ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, +int ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, AVPacket *pkt); /** diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index da7e6b23d4..7f94442aa7 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -64,7 +64,7 @@ static const unsigned char sipr_swaps[38][2] = { const unsigned char ff_sipr_subpk_size[4] = { 29, 19, 37, 20 }; -static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len) +static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) { int i; char *q, r; @@ -78,12 +78,12 @@ static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len) if (buf_size > 0) *q = '\0'; } -static void get_str8(ByteIOContext *pb, char *buf, int buf_size) +static void get_str8(AVIOContext *pb, char *buf, int buf_size) { get_strl(pb, buf, buf_size, get_byte(pb)); } -static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned size) +static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned size) { if (size >= 1<<24) return -1; @@ -120,7 +120,7 @@ void ff_rm_free_rmstream (RMStream *rms) av_free_packet(&rms->pkt); } -static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, +static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int read_all) { char buf[256]; @@ -264,7 +264,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, } int -ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, +ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, int codec_data_size) { unsigned int v; @@ -330,7 +330,7 @@ skip: * of the INDX chunk, and will bail out if not. */ static int rm_read_index(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int size, n_pkts, str_id, next_off, n, pos, pts; AVStream *st; @@ -387,7 +387,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) { RMDemuxContext *rm = s->priv_data; AVStream *st; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int tag; int tag_size; unsigned int start_time, duration; @@ -490,7 +490,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) return 0; } -static int get_num(ByteIOContext *pb, int *len) +static int get_num(AVIOContext *pb, int *len) { int n, n1; @@ -511,7 +511,7 @@ static int get_num(ByteIOContext *pb, int *len) static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){ RMDemuxContext *rm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; uint32_t state=0xFFFFFFFF; @@ -577,7 +577,7 @@ skip: return -1; } -static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb, +static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, RMDemuxContext *rm, RMStream *vst, AVPacket *pkt, int len, int *pseq) { @@ -700,7 +700,7 @@ void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize) } int -ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, +ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int len, AVPacket *pkt, int *seq, int flags, int64_t timestamp) { @@ -791,7 +791,7 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, } int -ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, +ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, AVPacket *pkt) { RMDemuxContext *rm = s->priv_data; diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 5670d95eb7..b60b8a20eb 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -44,7 +44,7 @@ typedef struct { #define BUFFER_DURATION 0 -static void put_str(ByteIOContext *s, const char *tag) +static void put_str(AVIOContext *s, const char *tag) { put_be16(s,strlen(tag)); while (*tag) { @@ -52,7 +52,7 @@ static void put_str(ByteIOContext *s, const char *tag) } } -static void put_str8(ByteIOContext *s, const char *tag) +static void put_str8(AVIOContext *s, const char *tag) { put_byte(s, strlen(tag)); while (*tag) { @@ -64,7 +64,7 @@ static int rv10_write_header(AVFormatContext *ctx, int data_size, int index_pos) { RMMuxContext *rm = ctx->priv_data; - ByteIOContext *s = ctx->pb; + AVIOContext *s = ctx->pb; StreamInfo *stream; unsigned char *data_offset_ptr, *start_ptr; const char *desc, *mimetype; @@ -283,7 +283,7 @@ static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream, int length, int key_frame) { int timestamp; - ByteIOContext *s = ctx->pb; + AVIOContext *s = ctx->pb; stream->nb_packets++; stream->packet_total_size += length; @@ -347,7 +347,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int { uint8_t *buf1; RMMuxContext *rm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; StreamInfo *stream = rm->audio_stream; int i; @@ -375,7 +375,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int flags) { RMMuxContext *rm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; StreamInfo *stream = rm->video_stream; int key_frame = !!(flags & AV_PKT_FLAG_KEY); @@ -430,7 +430,7 @@ static int rm_write_trailer(AVFormatContext *s) { RMMuxContext *rm = s->priv_data; int data_size, index_pos, i; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!url_is_streamed(s->pb)) { /* end of file: finish to write header */ diff --git a/libavformat/rpl.c b/libavformat/rpl.c index 241b541b6a..a8af5c8d07 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -47,7 +47,7 @@ typedef struct RPLContext { uint32_t frame_in_part; } RPLContext; -static int read_line(ByteIOContext * pb, char* line, int bufsize) +static int read_line(AVIOContext * pb, char* line, int bufsize) { int i; for (i = 0; i < bufsize - 1; i++) { @@ -76,7 +76,7 @@ static int32_t read_int(const char* line, const char** endptr, int* error) return result; } -static int32_t read_line_and_int(ByteIOContext * pb, int* error) +static int32_t read_line_and_int(AVIOContext * pb, int* error) { char line[RPL_LINE_LENGTH]; const char *endptr; @@ -110,7 +110,7 @@ static AVRational read_fps(const char* line, int* error) static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; RPLContext *rpl = s->priv_data; AVStream *vst = NULL, *ast = NULL; int total_audio_size; @@ -274,7 +274,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) { RPLContext *rpl = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream* stream; AVIndexEntry* index_entry; uint32_t ret; diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c index 698f82ed9e..da17cba8b8 100644 --- a/libavformat/rsodec.c +++ b/libavformat/rsodec.c @@ -29,7 +29,7 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int id, rate, bps; unsigned int size; enum CodecID codec; diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index 7b13898697..0093265772 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -27,7 +27,7 @@ static int rso_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (!enc->codec_tag) @@ -73,7 +73,7 @@ static int rso_write_packet(AVFormatContext *s, AVPacket *pkt) static int rso_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t file_size; uint16_t coded_file_size; diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index c81ba1cd02..3d40729d1c 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -237,7 +237,7 @@ static void rtcp_update_jitter(RTPStatistics *s, uint32_t sent_timestamp, uint32 int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) { - ByteIOContext *pb; + AVIOContext *pb; uint8_t *buf; int len; int rtcp_bytes; @@ -334,7 +334,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) void rtp_send_punch_packets(URLContext* rtp_handle) { - ByteIOContext *pb; + AVIOContext *pb; uint8_t *buf; int len; diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 5d52765110..e7893b3698 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -72,7 +72,7 @@ static int rtp_asf_fix_header(uint8_t *buf, int len) } /** - * The following code is basically a buffered ByteIOContext, + * The following code is basically a buffered AVIOContext, * with the added benefit of returning -EAGAIN (instead of 0) * on packet boundaries, such that the ASF demuxer can return * safely and resume business at the next packet. @@ -82,7 +82,7 @@ static int packetizer_read(void *opaque, uint8_t *buf, int buf_size) return AVERROR(EAGAIN); } -static void init_packetizer(ByteIOContext *pb, uint8_t *buf, int len) +static void init_packetizer(AVIOContext *pb, uint8_t *buf, int len) { init_put_byte(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL); @@ -95,7 +95,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) { int ret = 0; if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) { - ByteIOContext pb; + AVIOContext pb; RTSPState *rt = s->priv_data; int len = strlen(p) * 6 / 8; char *buf = av_mallocz(len); @@ -147,7 +147,7 @@ static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index, } struct PayloadContext { - ByteIOContext *pktbuf, pb; + AVIOContext *pktbuf, pb; uint8_t *buf; }; @@ -161,7 +161,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, uint32_t *timestamp, const uint8_t *buf, int len, int flags) { - ByteIOContext *pb = &asf->pb; + AVIOContext *pb = &asf->pb; int res, mflags, len_off; RTSPState *rt = s->priv_data; diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c index 8ed42a7a1e..255398df02 100644 --- a/libavformat/rtpdec_latm.c +++ b/libavformat/rtpdec_latm.c @@ -26,7 +26,7 @@ #include struct PayloadContext { - ByteIOContext *dyn_buf; + AVIOContext *dyn_buf; uint8_t *buf; int pos, len; uint32_t timestamp; diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index a1853ef52f..8a72cce3b5 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -42,7 +42,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, uint32_t *timestamp, const uint8_t *buf, int len, int flags) { - ByteIOContext pb; + AVIOContext pb; GetBitContext gb; int packing_scheme, has_payload_desc, has_packet_info, alen, has_marker_bit = flags & RTP_FLAG_MARKER; diff --git a/libavformat/rtpdec_svq3.c b/libavformat/rtpdec_svq3.c index 79a577584e..36271a3c15 100644 --- a/libavformat/rtpdec_svq3.c +++ b/libavformat/rtpdec_svq3.c @@ -33,7 +33,7 @@ #include "rtpdec_formats.h" struct PayloadContext { - ByteIOContext *pktbuf; + AVIOContext *pktbuf; int64_t timestamp; }; diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c index b18017b205..2431e6b32b 100644 --- a/libavformat/rtpdec_vp8.c +++ b/libavformat/rtpdec_vp8.c @@ -31,7 +31,7 @@ #include "rtpdec_formats.h" struct PayloadContext { - ByteIOContext *data; + AVIOContext *data; uint32_t timestamp; int is_keyframe; }; diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c index fe17a42ba4..17d81e7222 100644 --- a/libavformat/rtpdec_xiph.c +++ b/libavformat/rtpdec_xiph.c @@ -42,7 +42,7 @@ struct PayloadContext { unsigned ident; ///< 24-bit stream configuration identifier uint32_t timestamp; - ByteIOContext* fragment; ///< buffer for split payloads + AVIOContext* fragment; ///< buffer for split payloads uint8_t *split_buf; int split_pos, split_buf_len, split_buf_size; int split_pkts; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index cee3d7e38b..eae7ffcdac 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1855,7 +1855,7 @@ static int rtp_read_header(AVFormatContext *s, int payload_type; AVCodecContext codec; struct sockaddr_storage addr; - ByteIOContext pb; + AVIOContext pb; socklen_t addrlen = sizeof(addr); if (!ff_network_init()) diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 14d3f41eb5..0fec3cc991 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -193,7 +193,7 @@ enum RTSPServerType { /** * Private data for the RTSP demuxer. * - * @todo Use ByteIOContext instead of URLContext + * @todo Use AVIOContext instead of URLContext */ typedef struct RTSPState { URLContext *rtsp_hd; /* RTSP TCP connection handle */ @@ -218,7 +218,7 @@ typedef struct RTSPState { int64_t seek_timestamp; /* XXX: currently we use unbuffered input */ - // ByteIOContext rtsp_gb; + // AVIOContext rtsp_gb; int seq; /**< RTSP command sequence number */ diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index 73525f5df8..ef1ecc47d7 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -33,7 +33,7 @@ struct SAPState { URLContext *ann_fd; AVFormatContext *sdp_ctx; - ByteIOContext sdp_pb; + AVIOContext sdp_pb; uint16_t hash; char *sdp; int eof; diff --git a/libavformat/sauce.c b/libavformat/sauce.c index 4972d33942..32c026cd34 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -30,7 +30,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int get_height) { - ByteIOContext *pb = avctx->pb; + AVIOContext *pb = avctx->pb; char buf[36]; int datatype, filetype, t1, t2, nb_comments, flags; uint64_t start_pos = url_fsize(pb) - 128; diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 4f3e5b9339..ba75d43e1b 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -77,7 +77,7 @@ static int film_read_header(AVFormatContext *s, AVFormatParameters *ap) { FilmDemuxContext *film = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned char scratch[256]; int i; @@ -205,7 +205,7 @@ static int film_read_packet(AVFormatContext *s, AVPacket *pkt) { FilmDemuxContext *film = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; film_sample *sample; int ret = 0; int i; diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 98fe95a559..e30d42deb6 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -81,7 +81,7 @@ static int vmd_read_header(AVFormatContext *s, AVFormatParameters *ap) { VmdDemuxContext *vmd = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = NULL, *vst; unsigned int toc_offset; unsigned char *raw_frame_table; @@ -234,7 +234,7 @@ static int vmd_read_packet(AVFormatContext *s, AVPacket *pkt) { VmdDemuxContext *vmd = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret = 0; vmd_frame *frame; diff --git a/libavformat/siff.c b/libavformat/siff.c index 5219368f31..21ccf2dcd1 100644 --- a/libavformat/siff.c +++ b/libavformat/siff.c @@ -84,7 +84,7 @@ static int create_audio_stream(AVFormatContext *s, SIFFContext *c) return 0; } -static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb) +static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) { AVStream *st; int width, height; @@ -135,7 +135,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb return 0; } -static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb) +static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) { if (get_le32(pb) != TAG_SHDR){ av_log(s, AV_LOG_ERROR, "Header chunk is missing\n"); @@ -154,7 +154,7 @@ static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; SIFFContext *c = s->priv_data; uint32_t tag; diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 92da91e81e..8b375cf5d6 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -98,7 +98,7 @@ static int smacker_probe(AVProbeData *p) static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; SmackerContext *smk = s->priv_data; AVStream *st, *ast[7]; int i, ret; diff --git a/libavformat/sol.c b/libavformat/sol.c index fd7eb662fc..d688fde8b2 100644 --- a/libavformat/sol.c +++ b/libavformat/sol.c @@ -87,7 +87,7 @@ static int sol_read_header(AVFormatContext *s, { int size; unsigned int magic,tag; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int id, channels, rate, type; enum CodecID codec; AVStream *st; diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index 0a57f48918..ca48b4370f 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -44,7 +44,7 @@ static int sox_probe(AVProbeData *p) static int sox_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned header_size, comment_size; double sample_rate, sample_rate_frac; AVStream *st; diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index 413a53836a..6315efd7ef 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -40,7 +40,7 @@ typedef struct { static int sox_write_header(AVFormatContext *s) { SoXContext *sox = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; AVMetadataTag *comment; size_t comment_len = 0, comment_size; @@ -84,7 +84,7 @@ static int sox_write_header(AVFormatContext *s) static int sox_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; put_buffer(pb, pkt->data, pkt->size); return 0; } @@ -92,7 +92,7 @@ static int sox_write_packet(AVFormatContext *s, AVPacket *pkt) static int sox_write_trailer(AVFormatContext *s) { SoXContext *sox = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (!url_is_streamed(s->pb)) { diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index 5c4dba08d7..a1a62a116c 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -163,7 +163,7 @@ static int spdif_read_header(AVFormatContext *s, AVFormatParameters *ap) static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; enum IEC61937DataType data_type; enum CodecID codec_id; uint32_t state = 0; diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index 7c6591ae48..f959c96156 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -473,7 +473,7 @@ static int spdif_write_trailer(AVFormatContext *s) } static av_always_inline void spdif_put_16(IEC61937Context *ctx, - ByteIOContext *pb, unsigned int val) + AVIOContext *pb, unsigned int val) { if (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN) put_be16(pb, val); diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index d2a84f0c7f..002e15fab1 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -23,7 +23,7 @@ #include "libavutil/intreadwrite.h" #include "swf.h" -static int get_swf_tag(ByteIOContext *pb, int *len_ptr) +static int get_swf_tag(AVIOContext *pb, int *len_ptr) { int tag, len; @@ -55,7 +55,7 @@ static int swf_probe(AVProbeData *p) static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int nbits, len, tag; tag = get_be32(pb) & 0xffffff00; @@ -82,7 +82,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *vst = NULL, *ast = NULL, *st = 0; int tag, len, i, frame, v; diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 1ade1bf26e..956e595965 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -27,7 +27,7 @@ static void put_swf_tag(AVFormatContext *s, int tag) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; swf->tag_pos = url_ftell(pb); swf->tag = tag; @@ -43,7 +43,7 @@ static void put_swf_tag(AVFormatContext *s, int tag) static void put_swf_end_tag(AVFormatContext *s) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int tag_len, tag; @@ -78,7 +78,7 @@ static inline void max_nbits(int *nbits_ptr, int val) *nbits_ptr = n; } -static void put_swf_rect(ByteIOContext *pb, +static void put_swf_rect(AVIOContext *pb, int xmin, int xmax, int ymin, int ymax) { PutBitContext p; @@ -134,7 +134,7 @@ static void put_swf_line_edge(PutBitContext *pb, int dx, int dy) #define FRAC_BITS 16 -static void put_swf_matrix(ByteIOContext *pb, +static void put_swf_matrix(AVIOContext *pb, int a, int b, int c, int d, int tx, int ty) { PutBitContext p; @@ -173,7 +173,7 @@ static void put_swf_matrix(ByteIOContext *pb, static int swf_write_header(AVFormatContext *s) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; PutBitContext p; uint8_t buf1[256]; int i, width, height, rate, rate_base; @@ -334,7 +334,7 @@ static int swf_write_video(AVFormatContext *s, AVCodecContext *enc, const uint8_t *buf, int size) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; /* Flash Player limit */ if (swf->swf_frame_number == 16000) @@ -473,7 +473,7 @@ static int swf_write_packet(AVFormatContext *s, AVPacket *pkt) static int swf_write_trailer(AVFormatContext *s) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc, *video_enc; int file_size, i; diff --git a/libavformat/thp.c b/libavformat/thp.c index 226f2fd249..b6e7ae2f4a 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -57,7 +57,7 @@ static int thp_read_header(AVFormatContext *s, { ThpDemuxContext *thp = s->priv_data; AVStream *st; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; /* Read the file header. */ @@ -140,7 +140,7 @@ static int thp_read_packet(AVFormatContext *s, AVPacket *pkt) { ThpDemuxContext *thp = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int size; int ret; diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index 2992fa1be2..f85f99b8ba 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -78,7 +78,7 @@ static int seq_probe(AVProbeData *p) return AVPROBE_SCORE_MAX / 4; } -static int seq_init_frame_buffers(SeqDemuxContext *seq, ByteIOContext *pb) +static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb) { int i, sz; TiertexSeqFrameBuffer *seq_buffer; @@ -102,7 +102,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, ByteIOContext *pb) return 0; } -static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_num, unsigned int data_offs, int data_size) +static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num, unsigned int data_offs, int data_size) { TiertexSeqFrameBuffer *seq_buffer; @@ -121,7 +121,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_n return 0; } -static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb) +static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) { unsigned int offset_table[4], buffer_num[4]; TiertexSeqFrameBuffer *seq_buffer; @@ -184,7 +184,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) { int i, rc; SeqDemuxContext *seq = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; /* init internal buffers */ @@ -241,7 +241,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) { int rc; SeqDemuxContext *seq = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!seq->audio_buffer_full) { rc = seq_parse_frame_data(seq, pb); diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 72d0f29483..14450a2c51 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -65,7 +65,7 @@ static int tmv_probe(AVProbeData *p) static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) { TMVContext *tmv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *vst, *ast; AVRational fps; unsigned comp_method, char_cols, char_rows, features; @@ -142,7 +142,7 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt) { TMVContext *tmv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret, pkt_size = tmv->stream_index ? tmv->audio_chunk_size : tmv->video_chunk_size; diff --git a/libavformat/tty.c b/libavformat/tty.c index 1003157ee0..d576fd4338 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -42,7 +42,7 @@ typedef struct { static int efi_read(AVFormatContext *avctx, uint64_t start_pos) { TtyDemuxContext *s = avctx->priv_data; - ByteIOContext *pb = avctx->pb; + AVIOContext *pb = avctx->pb; char buf[37]; int len; diff --git a/libavformat/txd.c b/libavformat/txd.c index eb5e8b3396..76d68a8190 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -52,7 +52,7 @@ static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) { } static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int id, chunk_size, marker; int ret; diff --git a/libavformat/utils.c b/libavformat/utils.c index 04062a0f00..3cf914a748 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -323,7 +323,7 @@ FF_SYMVER(void, av_init_packet, (AVPacket *pkt), "LIBAVFORMAT_52") } #endif -int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size) +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size) { int ret= av_new_packet(pkt, size); @@ -341,7 +341,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size) return ret; } -int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size) +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size) { int ret; int old_size; @@ -442,7 +442,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, AVProbeDa * Open a media file from an IO stream. 'fmt' must be specified. */ int av_open_input_stream(AVFormatContext **ic_ptr, - ByteIOContext *pb, const char *filename, + AVIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap) { int err; @@ -479,7 +479,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, ic->priv_data = NULL; } - // e.g. AVFMT_NOFILE formats will not have a ByteIOContext + // e.g. AVFMT_NOFILE formats will not have a AVIOContext if (ic->pb) ff_id3v2_read(ic, ID3v2_DEFAULT_MAGIC); @@ -524,7 +524,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, #define PROBE_BUF_MIN 2048 #define PROBE_BUF_MAX (1<<20) -int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { @@ -598,7 +598,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, { int err; AVProbeData probe_data, *pd = &probe_data; - ByteIOContext *pb = NULL; + AVIOContext *pb = NULL; void *logctx= ap && ap->prealloced_context ? *ic_ptr : NULL; pd->filename = ""; @@ -2620,7 +2620,7 @@ void avformat_free_context(AVFormatContext *s) void av_close_input_file(AVFormatContext *s) { - ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; + AVIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; av_close_input_stream(s); if (pb) url_fclose(pb); diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 8dd735dac2..0be6ec3325 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -44,7 +44,7 @@ static int vc1t_probe(AVProbeData *p) static int vc1t_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int frames; uint32_t fps; @@ -87,7 +87,7 @@ static int vc1t_read_header(AVFormatContext *s, static int vc1t_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int frame_size; int keyframe = 0; uint32_t pts; diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c index 567efb2d3a..865a157dac 100644 --- a/libavformat/vc1testenc.c +++ b/libavformat/vc1testenc.c @@ -27,7 +27,7 @@ typedef struct RCVContext { static int vc1test_write_header(AVFormatContext *s) { AVCodecContext *avc = s->streams[0]->codec; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (avc->codec_id != CODEC_ID_WMV3) { av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n"); @@ -55,7 +55,7 @@ static int vc1test_write_header(AVFormatContext *s) static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt) { RCVContext *ctx = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!pkt->size) return 0; @@ -71,7 +71,7 @@ static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt) static int vc1test_write_trailer(AVFormatContext *s) { RCVContext *ctx = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!url_is_streamed(s->pb)) { url_fseek(pb, 0, SEEK_SET); diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index 7ef29d8db3..056a657ec2 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -41,7 +41,7 @@ static int voc_probe(AVProbeData *p) static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) { VocDecContext *voc = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int header_size; AVStream *st; @@ -66,7 +66,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) { VocDecContext *voc = s->priv_data; AVCodecContext *dec = st->codec; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; VocType type; int size, tmp_codec=-1; int sample_rate = 0; diff --git a/libavformat/vocenc.c b/libavformat/vocenc.c index 8d181de7c3..3a17eb4e64 100644 --- a/libavformat/vocenc.c +++ b/libavformat/vocenc.c @@ -29,7 +29,7 @@ typedef struct voc_enc_context { static int voc_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; const int header_size = 26; const int version = 0x0114; @@ -49,7 +49,7 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt) { VocEncContext *voc = s->priv_data; AVCodecContext *enc = s->streams[0]->codec; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!voc->param_written) { if (enc->codec_tag > 0xFF) { diff --git a/libavformat/wav.c b/libavformat/wav.c index 4cf138c754..47f0c2e37d 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -39,7 +39,7 @@ typedef struct { static int wav_write_header(AVFormatContext *s) { WAVContext *wav = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t fmt, fact; put_tag(pb, "RIFF"); @@ -77,7 +77,7 @@ static int wav_write_header(AVFormatContext *s) static int wav_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; WAVContext *wav = s->priv_data; put_buffer(pb, pkt->data, pkt->size); if(pkt->pts != AV_NOPTS_VALUE) { @@ -91,7 +91,7 @@ static int wav_write_packet(AVFormatContext *s, AVPacket *pkt) static int wav_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; WAVContext *wav = s->priv_data; int64_t file_size; @@ -141,14 +141,14 @@ AVOutputFormat ff_wav_muxer = { #if CONFIG_WAV_DEMUXER -static int64_t next_tag(ByteIOContext *pb, unsigned int *tag) +static int64_t next_tag(AVIOContext *pb, unsigned int *tag) { *tag = get_le32(pb); return get_le32(pb); } /* return the size of the found tag */ -static int64_t find_tag(ByteIOContext *pb, uint32_t tag1) +static int64_t find_tag(AVIOContext *pb, uint32_t tag1) { unsigned int tag; int64_t size; @@ -192,7 +192,7 @@ static int wav_read_header(AVFormatContext *s, int64_t sample_count=0; int rf64; unsigned int tag; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; WAVContext *wav = s->priv_data; @@ -263,7 +263,7 @@ static int wav_read_header(AVFormatContext *s, /** Find chunk with w64 GUID by skipping over other chunks * @return the size of the found chunk */ -static int64_t find_guid(ByteIOContext *pb, const uint8_t guid1[16]) +static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) { uint8_t guid[16]; int64_t size; @@ -379,7 +379,7 @@ static int w64_probe(AVProbeData *p) static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) { int64_t size; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; WAVContext *wav = s->priv_data; AVStream *st; uint8_t guid[16]; diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 17571599df..4d9ab28e3b 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -85,7 +85,7 @@ static int wc3_read_header(AVFormatContext *s, AVFormatParameters *ap) { Wc3DemuxContext *wc3 = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; AVStream *st; @@ -196,7 +196,7 @@ static int wc3_read_packet(AVFormatContext *s, AVPacket *pkt) { Wc3DemuxContext *wc3 = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; int packet_read = 0; diff --git a/libavformat/westwood.c b/libavformat/westwood.c index 85d2056b58..7666bd80b3 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -126,7 +126,7 @@ static int wsaud_read_header(AVFormatContext *s, AVFormatParameters *ap) { WsAudDemuxContext *wsaud = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned char header[AUD_HEADER_SIZE]; @@ -168,7 +168,7 @@ static int wsaud_read_packet(AVFormatContext *s, AVPacket *pkt) { WsAudDemuxContext *wsaud = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE]; unsigned int chunk_size; int ret = 0; @@ -213,7 +213,7 @@ static int wsvqa_read_header(AVFormatContext *s, AVFormatParameters *ap) { WsVqaDemuxContext *wsvqa = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned char *header; unsigned char scratch[VQA_PREAMBLE_SIZE]; @@ -313,7 +313,7 @@ static int wsvqa_read_packet(AVFormatContext *s, AVPacket *pkt) { WsVqaDemuxContext *wsvqa = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret = -1; unsigned char preamble[VQA_PREAMBLE_SIZE]; unsigned int chunk_type; diff --git a/libavformat/wtv.c b/libavformat/wtv.c index b74a36cc80..bdccdb3b09 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -57,7 +57,7 @@ #define WTV_BIGSECTOR_BITS 18 typedef struct { - ByteIOContext *pb_filesystem; /** file system (AVFormatContext->pb) */ + AVIOContext *pb_filesystem; /** file system (AVFormatContext->pb) */ int sector_bits; /** sector shift bits; used to convert sector number into pb_filesystem offset */ uint32_t *sectors; /** file allocation table */ @@ -74,7 +74,7 @@ typedef struct { static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) { WtvFile *wf = opaque; - ByteIOContext *pb = wf->pb_filesystem; + AVIOContext *pb = wf->pb_filesystem; int nread = 0; if (wf->error || url_ferror(pb)) @@ -113,7 +113,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) static int64_t wtvfile_seek(void *opaque, int64_t offset, int whence) { WtvFile *wf = opaque; - ByteIOContext *pb = wf->pb_filesystem; + AVIOContext *pb = wf->pb_filesystem; if (whence == AVSEEK_SIZE) return wf->length; @@ -136,7 +136,7 @@ static int64_t wtvfile_seek(void *opaque, int64_t offset, int whence) * @param count maximum number of integers to read * @return total number of integers read */ -static int read_ints(ByteIOContext *pb, uint32_t *data, int count) +static int read_ints(AVIOContext *pb, uint32_t *data, int count) { int i, total = 0; for (i = 0; i < count; i++) { @@ -153,9 +153,9 @@ static int read_ints(ByteIOContext *pb, uint32_t *data, int count) * @param depth File allocation table depth * @return NULL on error */ -static ByteIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s) +static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s) { - ByteIOContext *pb; + AVIOContext *pb; WtvFile *wf; uint8_t *buffer; @@ -257,7 +257,7 @@ static const ff_asf_guid dir_entry_guid = * @param filename_size size of filename * @return NULL on error */ -static ByteIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int buf_size, const uint8_t *filename, int filename_size) +static AVIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int buf_size, const uint8_t *filename, int filename_size) { const uint8_t *buf_end = buf + buf_size; @@ -298,7 +298,7 @@ static ByteIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int /** * Close file opened with wtvfile_open_sector(), or wtv_open() */ -static void wtvfile_close(ByteIOContext *pb) +static void wtvfile_close(AVIOContext *pb) { WtvFile *wf = pb->opaque; av_free(wf->sectors); @@ -316,7 +316,7 @@ typedef struct { } WtvStream; typedef struct { - ByteIOContext *pb; /** timeline file */ + AVIOContext *pb; /** timeline file */ int64_t epoch; int64_t pts; /** pts for next data chunk */ int64_t last_valid_pts; /** latest valid pts, used for interative seeking */ @@ -462,7 +462,7 @@ static void oledate_to_iso8601(char *buf, int buf_size, int64_t value) strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); } -static void get_attachment(AVFormatContext *s, ByteIOContext *pb, int length) +static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) { char mime[1024]; char description[1024]; @@ -495,7 +495,7 @@ done: url_fseek(pb, pos + length, SEEK_SET); } -static void get_tag(AVFormatContext *s, ByteIOContext *pb, const char *key, int type, int length) +static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int type, int length) { int buf_size = FFMAX(2*length, LEN_PRETTY_GUID) + 1; char *buf = av_malloc(buf_size); @@ -550,7 +550,7 @@ static void get_tag(AVFormatContext *s, ByteIOContext *pb, const char *key, int /** * Parse metadata entries */ -static void parse_legacy_attrib(AVFormatContext *s, ByteIOContext *pb) +static void parse_legacy_attrib(AVFormatContext *s, AVIOContext *pb) { ff_asf_guid guid; int length, type; @@ -580,7 +580,7 @@ static void parse_legacy_attrib(AVFormatContext *s, ByteIOContext *pb) static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = wtv->pb; + AVIOContext *pb = wtv->pb; url_fskip(pb, 72); // picture aspect ratio is unreliable ff_get_bmp_header(pb, st); @@ -650,7 +650,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, ff_asf_guid formattype, int size) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = wtv->pb; + AVIOContext *pb = wtv->pb; if (!ff_guidcmp(subtype, mediasubtype_cpfilters_processed) && !ff_guidcmp(formattype, format_cpfilters_processed)) { ff_asf_guid actual_subtype; @@ -769,7 +769,7 @@ enum { static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_ptr) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = wtv->pb; + AVIOContext *pb = wtv->pb; while (!url_feof(pb)) { ff_asf_guid g; int len, sid, consumed; @@ -945,7 +945,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) WtvContext *wtv = s->priv_data; int root_sector, root_size; uint8_t root[WTV_SECTOR_SIZE]; - ByteIOContext *pb; + AVIOContext *pb; int64_t timeline_pos; int ret; @@ -1035,7 +1035,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) static int read_packet(AVFormatContext *s, AVPacket *pkt) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = wtv->pb; + AVIOContext *pb = wtv->pb; int stream_index, len, ret; stream_index = parse_chunks(s, SEEK_TO_DATA, 0, &len); @@ -1055,7 +1055,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = wtv->pb; + AVIOContext *pb = wtv->pb; AVStream *st = s->streams[0]; int64_t ts_relative; int i; diff --git a/libavformat/wv.c b/libavformat/wv.c index c9a1f0ed9c..3ee59970c9 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -76,7 +76,7 @@ static int wv_probe(AVProbeData *p) return 0; } -static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int append) +static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int append) { WVContext *wc = ctx->priv_data; uint32_t tag, ver; @@ -201,7 +201,7 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app static int wv_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; WVContext *wc = s->priv_data; AVStream *st; diff --git a/libavformat/xa.c b/libavformat/xa.c index 21a6b26e25..504c9b20d6 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -66,7 +66,7 @@ static int xa_read_header(AVFormatContext *s, AVFormatParameters *ap) { MaxisXADemuxContext *xa = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; /*Set up the XA Audio Decoder*/ @@ -96,7 +96,7 @@ static int xa_read_packet(AVFormatContext *s, { MaxisXADemuxContext *xa = s->priv_data; AVStream *st = s->streams[0]; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int packet_size; int ret; diff --git a/libavformat/yop.c b/libavformat/yop.c index ae909254c6..9e7b8efe77 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -50,7 +50,7 @@ static int yop_probe(AVProbeData *probe_packet) static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) { YopDecContext *yop = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *audio_dec, *video_dec; AVStream *audio_stream, *video_stream; @@ -114,7 +114,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) { YopDecContext *yop = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; int actual_video_data_size = yop->frame_size - diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index 6c763986f3..ac3010e694 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -90,7 +90,7 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf) static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) { AVStream *st = s->streams[pkt->stream_index]; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVPicture *picture; int* first_pkt = s->priv_data; int width, height, h_chroma_shift, v_chroma_shift; @@ -192,7 +192,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) char header[MAX_YUV4_HEADER+10]; // Include headroom for the longest option char *tokstart,*tokend,*header_end; int i; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int width=-1, height=-1, raten=0, rated=0, aspectn=0, aspectd=0; enum PixelFormat pix_fmt=PIX_FMT_NONE,alt_pix_fmt=PIX_FMT_NONE; enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; From e731b8d8729e75bfb69f5540e6446d6118dac549 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 20 Feb 2011 11:04:13 +0100 Subject: [PATCH 415/528] avio: move init_put_byte() to a new private header and rename it init_put_byte should never be used outside of lavf, since sizeof(AVIOContext) isn't part of public ABI. Signed-off-by: Ronald S. Bultje --- libavformat/asfenc.c | 5 +++-- libavformat/avio.h | 4 ++-- libavformat/avio_internal.h | 35 +++++++++++++++++++++++++++++++++++ libavformat/aviobuf.c | 26 +++++++++++++++++++++----- libavformat/id3v2.c | 3 ++- libavformat/matroskadec.c | 9 +++++---- libavformat/mmst.c | 3 ++- libavformat/mov.c | 3 ++- libavformat/mpegts.c | 5 +++-- libavformat/rdt.c | 5 +++-- libavformat/rtpdec_asf.c | 5 +++-- libavformat/rtpdec_qt.c | 3 ++- libavformat/rtsp.c | 3 ++- libavformat/sapdec.c | 3 ++- 14 files changed, 87 insertions(+), 25 deletions(-) create mode 100644 libavformat/avio_internal.h diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 4751665a56..a529c1bbdf 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -22,6 +22,7 @@ #include "metadata.h" #include "riff.h" #include "asf.h" +#include "avio_internal.h" #undef NDEBUG #include @@ -578,7 +579,7 @@ static int asf_write_header(AVFormatContext *s) asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; asf->packet_timestamp_end = -1; - init_put_byte(&asf->pb, asf->packet_buf, s->packet_size, 1, + ffio_init_context(&asf->pb, asf->packet_buf, s->packet_size, 1, NULL, NULL, NULL, NULL); return 0; @@ -676,7 +677,7 @@ static void flush_packet(AVFormatContext *s) asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; asf->packet_timestamp_end = -1; - init_put_byte(&asf->pb, asf->packet_buf, s->packet_size, 1, + ffio_init_context(&asf->pb, asf->packet_buf, s->packet_size, 1, NULL, NULL, NULL, NULL); } diff --git a/libavformat/avio.h b/libavformat/avio.h index 14d371f1ed..060f06e6f2 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -361,9 +361,8 @@ typedef struct { #if FF_API_OLD_AVIO typedef attribute_deprecated AVIOContext ByteIOContext; -#endif -int init_put_byte(AVIOContext *s, +attribute_deprecated int init_put_byte(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, @@ -371,6 +370,7 @@ int init_put_byte(AVIOContext *s, int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)); +#endif AVIOContext *av_alloc_put_byte( unsigned char *buffer, int buffer_size, diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h new file mode 100644 index 0000000000..1cebcd72c8 --- /dev/null +++ b/libavformat/avio_internal.h @@ -0,0 +1,35 @@ +/* + * + * 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_AVIO_INTERNAL_H +#define AVFORMAT_AVIO_INTERNAL_H + +#include "avio.h" + +int ffio_init_context(AVIOContext *s, + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + + +#endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index d5f55e0e11..7b1f5ca1fd 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -23,6 +23,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" #include "avio.h" +#include "avio_internal.h" #include "internal.h" #include @@ -40,7 +41,7 @@ static void fill_buffer(AVIOContext *s); static int url_resetbuf(AVIOContext *s, int flags); #endif -int init_put_byte(AVIOContext *s, +int ffio_init_context(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, @@ -73,6 +74,21 @@ int init_put_byte(AVIOContext *s, return 0; } +#if FF_API_OLD_AVIO +int init_put_byte(AVIOContext *s, + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)) +{ + return ffio_init_context(s, buffer, buffer_size, write_flag, opaque, + read_packet, write_packet, seek); +} +#endif + AVIOContext *av_alloc_put_byte( unsigned char *buffer, int buffer_size, @@ -83,7 +99,7 @@ AVIOContext *av_alloc_put_byte( int64_t (*seek)(void *opaque, int64_t offset, int whence)) { AVIOContext *s = av_mallocz(sizeof(AVIOContext)); - init_put_byte(s, buffer, buffer_size, write_flag, opaque, + ffio_init_context(s, buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); return s; } @@ -664,7 +680,7 @@ int url_fdopen(AVIOContext **s, URLContext *h) return AVERROR(ENOMEM); } - if (init_put_byte(*s, buffer, buffer_size, + if (ffio_init_context(*s, buffer, buffer_size, (h->flags & URL_WRONLY || h->flags & URL_RDWR), h, url_read, url_write, url_seek) < 0) { av_free(buffer); @@ -865,7 +881,7 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) *s = av_mallocz(sizeof(AVIOContext)); if(!*s) return AVERROR(ENOMEM); - ret = init_put_byte(*s, buf, buf_size, + ret = ffio_init_context(*s, buf, buf_size, (flags & URL_WRONLY || flags & URL_RDWR), NULL, NULL, NULL, NULL); if(ret != 0) @@ -964,7 +980,7 @@ static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size) return AVERROR(ENOMEM); } d->io_buffer_size = io_buffer_size; - ret = init_put_byte(*s, d->io_buffer, io_buffer_size, + ret = ffio_init_context(*s, d->io_buffer, io_buffer_size, 1, d, NULL, max_packet_size ? dyn_packet_buf_write : dyn_buf_write, max_packet_size ? NULL : dyn_buf_seek); diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index a5a96e20de..f886b68288 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -24,6 +24,7 @@ #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "metadata.h" +#include "avio_internal.h" int ff_id3v2_match(const uint8_t *buf, const char * magic) { @@ -216,7 +217,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t j--; } } - init_put_byte(&pb, buffer, j, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb, buffer, j, 0, NULL, NULL, NULL, NULL); read_ttag(s, &pb, j, tag); } else { read_ttag(s, s->pb, tlen, tag); diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index b3797047e5..69f08c3142 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -31,6 +31,7 @@ #include #include "avformat.h" #include "internal.h" +#include "avio_internal.h" /* For ff_codec_get_id(). */ #include "riff.h" #include "isom.h" @@ -698,7 +699,7 @@ static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska, uint8_t *data, uint32_t size, uint64_t *num) { AVIOContext pb; - init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb, data, size, 0, NULL, NULL, NULL, NULL); return ebml_read_num(matroska, &pb, FFMIN(size, 8), num); } @@ -1328,7 +1329,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) } else if (!strcmp(track->codec_id, "A_MS/ACM") && track->codec_priv.size >= 14 && track->codec_priv.data != NULL) { - init_put_byte(&b, track->codec_priv.data, track->codec_priv.size, + ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, URL_RDONLY, NULL, NULL, NULL, NULL); ff_get_wav_header(&b, st->codec, track->codec_priv.size); codec_id = st->codec->codec_id; @@ -1373,7 +1374,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) extradata = av_mallocz(extradata_size); if (extradata == NULL) return AVERROR(ENOMEM); - init_put_byte(&b, extradata, extradata_size, 1, + ffio_init_context(&b, extradata, extradata_size, 1, NULL, NULL, NULL, NULL); put_buffer(&b, "TTA1", 4); put_le16(&b, 1); @@ -1390,7 +1391,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) } else if (codec_id == CODEC_ID_RA_288 || codec_id == CODEC_ID_COOK || codec_id == CODEC_ID_ATRAC3 || codec_id == CODEC_ID_SIPR) { int flavor; - init_put_byte(&b, track->codec_priv.data,track->codec_priv.size, + ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size, 0, NULL, NULL, NULL, NULL); url_fskip(&b, 22); flavor = get_be16(&b); diff --git a/libavformat/mmst.c b/libavformat/mmst.c index 8d7ed059dc..e3af4bfbc6 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -31,6 +31,7 @@ #include "avformat.h" #include "mms.h" #include "internal.h" +#include "avio_internal.h" #include "libavutil/intreadwrite.h" #include "libavcodec/bytestream.h" #include "network.h" @@ -155,7 +156,7 @@ static void mms_put_utf16(MMSContext *mms, uint8_t *src) AVIOContext bic; int size = mms->write_out_ptr - mms->out_buffer; int len; - init_put_byte(&bic, mms->write_out_ptr, + ffio_init_context(&bic, mms->write_out_ptr, sizeof(mms->out_buffer) - size, 1, NULL, NULL, NULL, NULL); len = avio_put_str16le(&bic, src); diff --git a/libavformat/mov.c b/libavformat/mov.c index 22f84c1e72..2c314e3a39 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -29,6 +29,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/avstring.h" #include "avformat.h" +#include "avio_internal.h" #include "riff.h" #include "isom.h" #include "libavcodec/get_bits.h" @@ -2123,7 +2124,7 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) get_buffer(pb, cmov_data, cmov_len); if(uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK) goto free_and_return; - if(init_put_byte(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0) + if(ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0) goto free_and_return; atom.type = MKTAG('m','o','o','v'); atom.size = moov_len; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index a97fd7a62d..fb45e60844 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -29,6 +29,7 @@ #include "avformat.h" #include "mpegts.h" #include "internal.h" +#include "avio_internal.h" #include "seek.h" #include "mpeg.h" #include "isom.h" @@ -855,7 +856,7 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size, int tag; unsigned len; - init_put_byte(&pb, buf, size, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb, buf, size, 0, NULL, NULL, NULL, NULL); len = ff_mp4_read_descr(s, &pb, &tag); if (tag == MP4IODescrTag) { @@ -914,7 +915,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type if (st->codec->codec_id == CODEC_ID_AAC_LATM && mp4_dec_config_descr_len && mp4_es_id == pid) { AVIOContext pb; - init_put_byte(&pb, mp4_dec_config_descr, + ffio_init_context(&pb, mp4_dec_config_descr, mp4_dec_config_descr_len, 0, NULL, NULL, NULL, NULL); ff_mp4_read_dec_config_descr(fc, st, &pb); if (st->codec->codec_id == CODEC_ID_AAC && diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 4b0664fb44..bbc3de923b 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -33,6 +33,7 @@ #include "libavutil/md5.h" #include "rm.h" #include "internal.h" +#include "avio_internal.h" #include "libavcodec/get_bits.h" struct RDTDemuxContext { @@ -150,7 +151,7 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) */ if (!rdt->mlti_data) return -1; - init_put_byte(&pb, rdt->mlti_data, rdt->mlti_data_size, 0, + ffio_init_context(&pb, rdt->mlti_data, rdt->mlti_data_size, 0, NULL, NULL, NULL, NULL); tag = get_le32(&pb); if (tag == MKTAG('M', 'L', 'T', 'I')) { @@ -300,7 +301,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, if (rdt->audio_pkt_cnt == 0) { int pos; - init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL); flags = (flags & RTP_FLAG_KEY) ? 2 : 0; res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt, &seq, flags, *timestamp); diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index e7893b3698..9708e906aa 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -32,6 +32,7 @@ #include "rtpdec_formats.h" #include "rtsp.h" #include "asf.h" +#include "avio_internal.h" /** * From MSDN 2.2.1.4, we learn that ASF data packets over RTP should not @@ -84,7 +85,7 @@ static int packetizer_read(void *opaque, uint8_t *buf, int buf_size) static void init_packetizer(AVIOContext *pb, uint8_t *buf, int len) { - init_put_byte(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL); + ffio_init_context(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL); /* this "fills" the buffer with its current content */ pb->pos = len; @@ -176,7 +177,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, av_freep(&asf->buf); - init_put_byte(pb, buf, len, 0, NULL, NULL, NULL, NULL); + ffio_init_context(pb, buf, len, 0, NULL, NULL, NULL, NULL); while (url_ftell(pb) + 4 < len) { int start_off = url_ftell(pb); diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 8a72cce3b5..781e5fff23 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -26,6 +26,7 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "rtp.h" #include "rtpdec.h" #include "isom.h" @@ -69,7 +70,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, * 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); + ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL); if (len < 4) return AVERROR_INVALIDDATA; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index eae7ffcdac..d09123a06f 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -25,6 +25,7 @@ #include "libavutil/parseutils.h" #include "libavutil/random_seed.h" #include "avformat.h" +#include "avio_internal.h" #include #if HAVE_POLL_H @@ -1913,7 +1914,7 @@ static int rtp_read_header(AVFormatContext *s, 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); + ffio_init_context(&pb, sdp, strlen(sdp), 0, NULL, NULL, NULL, NULL); s->pb = &pb; /* sdp_read_header initializes this again */ diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index ef1ecc47d7..e3cdcea6a6 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -25,6 +25,7 @@ #include "network.h" #include "os_support.h" #include "internal.h" +#include "avio_internal.h" #if HAVE_POLL_H #include #endif @@ -142,7 +143,7 @@ static int sap_read_header(AVFormatContext *s, } 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, + ffio_init_context(&sap->sdp_pb, sap->sdp, strlen(sap->sdp), 0, NULL, NULL, NULL, NULL); infmt = av_find_input_format("sdp"); From d2bbf82e65e4a128ab1f0bf48df5d1e43c43c698 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 20 Feb 2011 08:46:22 -0500 Subject: [PATCH 416/528] Update version and APIchanges. Update libavformat/version.h and doc/APIChanges after renaming init_put_byte() and ByteIOContext to ffio_init_context() (private) and AVIOContext, (public), and deprecating the originals. --- doc/APIchanges | 6 ++++++ libavformat/version.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index e73af3079d..3a8543edf3 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,6 +12,12 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-20 - e731b8d - lavf 52.102.0 - avio.h + * e731b8d - rename init_put_byte() to ffio_init_context(), deprecating the + original, and move it to a private header so it is no longer + part of our public API. Instead, use av_alloc_put_byte(). + * ae628ec - rename ByteIOContext to AVIOContext. + 2011-02-16 - 09d171b - lavf 52.101.0 - avformat.h lavu 52.39.0 - parseutils.h * 610219a - Add av_ prefix to dump_format(). diff --git a/libavformat/version.h b/libavformat/version.h index 9a15fe4df6..494cf11a25 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 101 +#define LIBAVFORMAT_VERSION_MINOR 102 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From ef6695387522fc783105ac187c84beaa284e7cff Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 20 Feb 2011 14:38:32 +0000 Subject: [PATCH 417/528] x86: use raw opcode for xgetbv instruction This allows the CPU detection to work with assemblers not supporting the xgetbv mnemonic. These include clang and some BSD versions. All AVX code will be written for yasm, where the main assembler is not involved. Signed-off-by: Mans Rullgard --- libavutil/x86/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index 2caac2fb23..14d0fe10c8 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -36,7 +36,7 @@ : "0" (index)); #define xgetbv(index,eax,edx) \ - __asm__ ("xgetbv" : "=a"(eax), "=d"(edx) : "c" (index)) + __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index)) /* Function to test if multimedia instructions are supported... */ int ff_get_cpu_flags_x86(void) From 1efa772e20be5869817b2370a557bb14e7ce2fff Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 20 Feb 2011 16:47:19 +0000 Subject: [PATCH 418/528] amrnb: use correct size when copying lsf_r array lsf_r is an array of int16_t, not float. Signed-off-by: Mans Rullgard --- libavcodec/amrnbdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index ec896c7dfb..2883b9c398 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -255,7 +255,7 @@ static void lsf2lsp_for_mode12k2(AMRContext *p, double lsp[LP_FILTER_ORDER], } if (update) - memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(float)); + memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r)); for (i = 0; i < LP_FILTER_ORDER; i++) lsf_q[i] = lsf_r[i] * (LSF_R_FAC / 8000.0) + lsf_no_r[i] * (1.0 / 8000.0); From 08df7f866663f83ba42398cea9f3eeff4681ea9a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 20 Feb 2011 17:16:42 +0000 Subject: [PATCH 419/528] Makefile: include deps from tools directory This ensures the tools are rebuilt when necessary. Specifically, lavfi-showfiltfmts was sometimes not rebuilt causing spurious test failures. Signed-off-by: Mans Rullgard --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 4ed003b7a5..ad1f737ebb 100644 --- a/Makefile +++ b/Makefile @@ -92,6 +92,8 @@ tools/%$(EXESUF): tools/%.o tools/%.o: tools/%.c $(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $< +-include $(wildcard tools/*.d) + ffplay.o: CFLAGS += $(SDL_CFLAGS) VERSION_SH = $(SRC_PATH_BARE)/version.sh From 5ad06110e01bbfdb35eaa3691b54ca4af1ac2210 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 20 Feb 2011 22:42:17 +0000 Subject: [PATCH 420/528] lavfi: add drawutils Add drawutils.h and drawutils.c, and use them in the pad filter. The new functions are going to be shared by other filters. Signed-off-by: Mans Rullgard --- libavfilter/Makefile | 1 + libavfilter/drawutils.c | 117 +++++++++++++++++++++++++++++++++++++ libavfilter/drawutils.h | 43 ++++++++++++++ libavfilter/vf_pad.c | 126 +++++++--------------------------------- 4 files changed, 182 insertions(+), 105 deletions(-) create mode 100644 libavfilter/drawutils.c create mode 100644 libavfilter/drawutils.h diff --git a/libavfilter/Makefile b/libavfilter/Makefile index abb68c811d..30c75bd2ae 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -11,6 +11,7 @@ OBJS = allfilters.o \ avfilter.o \ avfiltergraph.o \ defaults.o \ + drawutils.o \ formats.o \ graphparser.o \ diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c new file mode 100644 index 0000000000..dd9ceff117 --- /dev/null +++ b/libavfilter/drawutils.c @@ -0,0 +1,117 @@ +/* + * 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/avutil.h" +#include "libavutil/colorspace.h" +#include "libavutil/pixdesc.h" +#include "drawutils.h" + +enum { RED = 0, GREEN, BLUE, ALPHA }; + +int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4], + enum PixelFormat pix_fmt, uint8_t rgba_color[4], + int *is_packed_rgba, uint8_t rgba_map_ptr[4]) +{ + uint8_t rgba_map[4] = {0}; + int i; + const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt]; + int hsub = pix_desc->log2_chroma_w; + + *is_packed_rgba = 1; + switch (pix_fmt) { + case PIX_FMT_ARGB: rgba_map[ALPHA] = 0; rgba_map[RED ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break; + case PIX_FMT_ABGR: rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED ] = 3; break; + case PIX_FMT_RGBA: + case PIX_FMT_RGB24: rgba_map[RED ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break; + case PIX_FMT_BGRA: + case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED ] = 2; rgba_map[ALPHA] = 3; break; + default: + *is_packed_rgba = 0; + } + + if (*is_packed_rgba) { + pixel_step[0] = (av_get_bits_per_pixel(pix_desc))>>3; + for (i = 0; i < 4; i++) + dst_color[rgba_map[i]] = rgba_color[i]; + + line[0] = av_malloc(w * pixel_step[0]); + for (i = 0; i < w; i++) + memcpy(line[0] + i * pixel_step[0], dst_color, pixel_step[0]); + if (rgba_map_ptr) + memcpy(rgba_map_ptr, rgba_map, sizeof(rgba_map[0]) * 4); + } else { + int plane; + + dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]); + dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); + dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); + dst_color[3] = rgba_color[3]; + + for (plane = 0; plane < 4; plane++) { + int line_size; + int hsub1 = (plane == 1 || plane == 2) ? hsub : 0; + + pixel_step[plane] = 1; + line_size = (w >> hsub1) * pixel_step[plane]; + line[plane] = av_malloc(line_size); + memset(line[plane], dst_color[plane], line_size); + } + } + + return 0; +} + +void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4], + uint8_t *src[4], int pixelstep[4], + int hsub, int vsub, int x, int y, int w, int h) +{ + int i, plane; + uint8_t *p; + + for (plane = 0; plane < 4 && dst[plane]; plane++) { + int hsub1 = plane == 1 || plane == 2 ? hsub : 0; + int vsub1 = plane == 1 || plane == 2 ? vsub : 0; + + p = dst[plane] + (y >> vsub1) * dst_linesize[plane]; + for (i = 0; i < (h >> vsub1); i++) { + memcpy(p + (x >> hsub1) * pixelstep[plane], + src[plane], (w >> hsub1) * pixelstep[plane]); + p += dst_linesize[plane]; + } + } +} + +void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4], + uint8_t *src[4], int src_linesize[4], int pixelstep[4], + int hsub, int vsub, int x, int y, int y2, int w, int h) +{ + int i, plane; + uint8_t *p; + + for (plane = 0; plane < 4 && dst[plane]; plane++) { + int hsub1 = plane == 1 || plane == 2 ? hsub : 0; + int vsub1 = plane == 1 || plane == 2 ? vsub : 0; + + p = dst[plane] + (y >> vsub1) * dst_linesize[plane]; + for (i = 0; i < (h >> vsub1); i++) { + memcpy(p + (x >> hsub1) * pixelstep[plane], + src[plane] + src_linesize[plane]*(i+(y2>>vsub1)), (w >> hsub1) * pixelstep[plane]); + p += dst_linesize[plane]; + } + } +} diff --git a/libavfilter/drawutils.h b/libavfilter/drawutils.h new file mode 100644 index 0000000000..e838660579 --- /dev/null +++ b/libavfilter/drawutils.h @@ -0,0 +1,43 @@ +/* + * 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 AVFILTER_DRAWUTILS_H +#define AVFILTER_DRAWUTILS_H + +/** + * @file + * misc drawing utilities + */ + +#include +#include "libavutil/pixfmt.h" + +int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, + uint8_t dst_color[4], + enum PixelFormat pix_fmt, uint8_t rgba_color[4], + int *is_packed_rgba, uint8_t rgba_map[4]); + +void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4], + uint8_t *src[4], int pixelstep[4], + int hsub, int vsub, int x, int y, int w, int h); + +void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4], + uint8_t *src[4], int src_linesize[4], int pixelstep[4], + int hsub, int vsub, int x, int y, int y2, int w, int h); + +#endif /* AVFILTER_DRAWUTILS_H */ diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 7413071913..30ec5ba6e9 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -30,94 +30,7 @@ #include "libavutil/avassert.h" #include "libavutil/imgutils.h" #include "libavutil/parseutils.h" - -enum { RED = 0, GREEN, BLUE, ALPHA }; - -static int fill_line_with_color(uint8_t *line[4], int line_step[4], int w, uint8_t color[4], - enum PixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba) -{ - uint8_t rgba_map[4] = {0}; - int i; - const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt]; - int hsub = pix_desc->log2_chroma_w; - - *is_packed_rgba = 1; - switch (pix_fmt) { - case PIX_FMT_ARGB: rgba_map[ALPHA] = 0; rgba_map[RED ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break; - case PIX_FMT_ABGR: rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED ] = 3; break; - case PIX_FMT_RGBA: - case PIX_FMT_RGB24: rgba_map[RED ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break; - case PIX_FMT_BGRA: - case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED ] = 2; rgba_map[ALPHA] = 3; break; - default: - *is_packed_rgba = 0; - } - - if (*is_packed_rgba) { - line_step[0] = (av_get_bits_per_pixel(pix_desc))>>3; - for (i = 0; i < 4; i++) - color[rgba_map[i]] = rgba_color[i]; - - line[0] = av_malloc(w * line_step[0]); - for (i = 0; i < w; i++) - memcpy(line[0] + i * line_step[0], color, line_step[0]); - } else { - int plane; - - color[RED ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]); - color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); - color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); - color[ALPHA] = rgba_color[3]; - - for (plane = 0; plane < 4; plane++) { - int line_size; - int hsub1 = (plane == 1 || plane == 2) ? hsub : 0; - - line_step[plane] = 1; - line_size = (w >> hsub1) * line_step[plane]; - line[plane] = av_malloc(line_size); - memset(line[plane], color[plane], line_size); - } - } - - return 0; -} - -static void draw_rectangle(AVFilterBufferRef *outpic, uint8_t *line[4], int line_step[4], - int hsub, int vsub, int x, int y, int w, int h) -{ - int i, plane; - uint8_t *p; - - for (plane = 0; plane < 4 && outpic->data[plane]; plane++) { - int hsub1 = plane == 1 || plane == 2 ? hsub : 0; - int vsub1 = plane == 1 || plane == 2 ? vsub : 0; - - p = outpic->data[plane] + (y >> vsub1) * outpic->linesize[plane]; - for (i = 0; i < (h >> vsub1); i++) { - memcpy(p + (x >> hsub1) * line_step[plane], line[plane], (w >> hsub1) * line_step[plane]); - p += outpic->linesize[plane]; - } - } -} - -static void copy_rectangle(AVFilterBufferRef *outpic,uint8_t *line[4], int line_step[4], int linesize[4], - int hsub, int vsub, int x, int y, int y2, int w, int h) -{ - int i, plane; - uint8_t *p; - - for (plane = 0; plane < 4 && outpic->data[plane]; plane++) { - int hsub1 = plane == 1 || plane == 2 ? hsub : 0; - int vsub1 = plane == 1 || plane == 2 ? vsub : 0; - - p = outpic->data[plane] + (y >> vsub1) * outpic->linesize[plane]; - for (i = 0; i < (h >> vsub1); i++) { - memcpy(p + (x >> hsub1) * line_step[plane], line[plane] + linesize[plane]*(i+(y2>>vsub1)), (w >> hsub1) * line_step[plane]); - p += outpic->linesize[plane]; - } - } -} +#include "drawutils.h" static int query_formats(AVFilterContext *ctx) { @@ -210,8 +123,8 @@ static int config_input(AVFilterLink *inlink) pad->in_h = inlink->h & ~((1 << pad->vsub) - 1); memcpy(rgba_color, pad->color, sizeof(rgba_color)); - fill_line_with_color(pad->line, pad->line_step, pad->w, pad->color, - inlink->format, rgba_color, &is_packed_rgba); + ff_fill_line_with_color(pad->line, pad->line_step, pad->w, pad->color, + inlink->format, rgba_color, &is_packed_rgba, NULL); av_log(ctx, AV_LOG_INFO, "w:%d h:%d -> w:%d h:%d x:%d y:%d color:0x%02X%02X%02X%02X[%s]\n", inlink->w, inlink->h, pad->w, pad->h, pad->x, pad->y, @@ -351,9 +264,10 @@ static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, } if (bar_h) { - draw_rectangle(link->dst->outputs[0]->out_buf, - pad->line, pad->line_step, pad->hsub, pad->vsub, - 0, bar_y, pad->w, bar_h); + ff_draw_rectangle(link->dst->outputs[0]->out_buf->data, + link->dst->outputs[0]->out_buf->linesize, + pad->line, pad->line_step, pad->hsub, pad->vsub, + 0, bar_y, pad->w, bar_h); avfilter_draw_slice(link->dst->outputs[0], bar_y, bar_h, slice_dir); } } @@ -374,18 +288,20 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) draw_send_bar_slice(link, y, h, slice_dir, 1); /* left border */ - draw_rectangle(outpic, pad->line, pad->line_step, pad->hsub, pad->vsub, - 0, y, pad->x, h); + ff_draw_rectangle(outpic->data, outpic->linesize, pad->line, pad->line_step, + pad->hsub, pad->vsub, 0, y, pad->x, h); if(pad->needs_copy){ - copy_rectangle(outpic, - inpic->data, pad->line_step, inpic->linesize, pad->hsub, pad->vsub, - pad->x, y, y-pad->y, inpic->video->w, h); + ff_copy_rectangle(outpic->data, outpic->linesize, + inpic->data, inpic->linesize, pad->line_step, + pad->hsub, pad->vsub, + pad->x, y, y-pad->y, inpic->video->w, h); } /* right border */ - draw_rectangle(outpic, pad->line, pad->line_step, pad->hsub, pad->vsub, - pad->x + pad->in_w, y, pad->w - pad->x - pad->in_w, h); + ff_draw_rectangle(outpic->data, outpic->linesize, + pad->line, pad->line_step, pad->hsub, pad->vsub, + pad->x + pad->in_w, y, pad->w - pad->x - pad->in_w, h); avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir); draw_send_bar_slice(link, y, h, slice_dir, -1); @@ -488,8 +404,8 @@ static int color_config_props(AVFilterLink *inlink) return AVERROR(EINVAL); memcpy(rgba_color, color->color, sizeof(rgba_color)); - fill_line_with_color(color->line, color->line_step, color->w, color->color, - inlink->format, rgba_color, &is_packed_rgba); + ff_fill_line_with_color(color->line, color->line_step, color->w, color->color, + inlink->format, rgba_color, &is_packed_rgba, NULL); av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n", color->w, color->h, color->time_base.den, color->time_base.num, @@ -510,9 +426,9 @@ static int color_request_frame(AVFilterLink *link) picref->pos = 0; avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); - draw_rectangle(picref, - color->line, color->line_step, color->hsub, color->vsub, - 0, 0, color->w, color->h); + ff_draw_rectangle(picref->data, picref->linesize, + color->line, color->line_step, color->hsub, color->vsub, + 0, 0, color->w, color->h); avfilter_draw_slice(link, 0, color->h, 1); avfilter_end_frame(link); avfilter_unref_buffer(picref); From c8c0189d62f26569464c86231fa885f0b0c33f14 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 20 Feb 2011 22:42:24 +0000 Subject: [PATCH 421/528] lavfi: put color source in a dedicated file Move the color source code from vf_pad.c to vsrc_color.c. Signed-off-by: Mans Rullgard --- libavfilter/Makefile | 2 +- libavfilter/vf_pad.c | 128 ------------------------------ libavfilter/vsrc_color.c | 167 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 129 deletions(-) create mode 100644 libavfilter/vsrc_color.c diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 30c75bd2ae..bbd820238a 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -50,7 +50,7 @@ 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 +OBJS-$(CONFIG_COLOR_FILTER) += vsrc_color.o OBJS-$(CONFIG_FREI0R_SRC_FILTER) += vf_frei0r.o OBJS-$(CONFIG_MOVIE_FILTER) += vsrc_movie.o OBJS-$(CONFIG_NULLSRC_FILTER) += vsrc_nullsrc.o diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 30ec5ba6e9..492b08eb68 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -53,8 +53,6 @@ static int query_formats(AVFilterContext *ctx) return 0; } -#if CONFIG_PAD_FILTER - typedef struct { int w, h; ///< output dimensions, a value of 0 will result in the input size int x, y; ///< offsets of the input area with respect to the padded area @@ -330,129 +328,3 @@ AVFilter avfilter_vf_pad = { .config_props = config_output, }, { .name = NULL}}, }; - -#endif /* CONFIG_PAD_FILTER */ - -#if CONFIG_COLOR_FILTER - -typedef struct { - int w, h; - uint8_t color[4]; - AVRational time_base; - uint8_t *line[4]; - int line_step[4]; - int hsub, vsub; ///< chroma subsampling values - uint64_t pts; -} ColorContext; - -static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - ColorContext *color = ctx->priv; - char color_string[128] = "black"; - char frame_size [128] = "320x240"; - char frame_rate [128] = "25"; - AVRational frame_rate_q; - int ret; - - if (args) - sscanf(args, "%127[^:]:%127[^:]:%127s", color_string, frame_size, frame_rate); - - if (av_parse_video_size(&color->w, &color->h, frame_size) < 0) { - av_log(ctx, AV_LOG_ERROR, "Invalid frame size: %s\n", frame_size); - return AVERROR(EINVAL); - } - - if (av_parse_video_rate(&frame_rate_q, frame_rate) < 0 || - frame_rate_q.den <= 0 || frame_rate_q.num <= 0) { - av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", frame_rate); - return AVERROR(EINVAL); - } - color->time_base.num = frame_rate_q.den; - color->time_base.den = frame_rate_q.num; - - if ((ret = av_parse_color(color->color, color_string, -1, ctx)) < 0) - return ret; - - return 0; -} - -static av_cold void color_uninit(AVFilterContext *ctx) -{ - ColorContext *color = ctx->priv; - int i; - - for (i = 0; i < 4; i++) { - av_freep(&color->line[i]); - color->line_step[i] = 0; - } -} - -static int color_config_props(AVFilterLink *inlink) -{ - AVFilterContext *ctx = inlink->src; - ColorContext *color = ctx->priv; - uint8_t rgba_color[4]; - int is_packed_rgba; - const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format]; - - color->hsub = pix_desc->log2_chroma_w; - color->vsub = pix_desc->log2_chroma_h; - - color->w &= ~((1 << color->hsub) - 1); - color->h &= ~((1 << color->vsub) - 1); - if (av_image_check_size(color->w, color->h, 0, ctx) < 0) - return AVERROR(EINVAL); - - memcpy(rgba_color, color->color, sizeof(rgba_color)); - ff_fill_line_with_color(color->line, color->line_step, color->w, color->color, - inlink->format, rgba_color, &is_packed_rgba, NULL); - - av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n", - color->w, color->h, color->time_base.den, color->time_base.num, - color->color[0], color->color[1], color->color[2], color->color[3], - is_packed_rgba ? "rgba" : "yuva"); - inlink->w = color->w; - inlink->h = color->h; - - return 0; -} - -static int color_request_frame(AVFilterLink *link) -{ - ColorContext *color = link->src->priv; - AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); - 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)); - ff_draw_rectangle(picref->data, picref->linesize, - color->line, color->line_step, color->hsub, color->vsub, - 0, 0, color->w, color->h); - avfilter_draw_slice(link, 0, color->h, 1); - avfilter_end_frame(link); - avfilter_unref_buffer(picref); - - return 0; -} - -AVFilter avfilter_vsrc_color = { - .name = "color", - .description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input, syntax is: [color[:size[:rate]]]"), - - .priv_size = sizeof(ColorContext), - .init = color_init, - .uninit = color_uninit, - - .query_formats = query_formats, - - .inputs = (AVFilterPad[]) {{ .name = NULL}}, - - .outputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .request_frame = color_request_frame, - .config_props = color_config_props }, - { .name = NULL}}, -}; - -#endif /* CONFIG_COLOR_FILTER */ diff --git a/libavfilter/vsrc_color.c b/libavfilter/vsrc_color.c new file mode 100644 index 0000000000..3fab260a2f --- /dev/null +++ b/libavfilter/vsrc_color.c @@ -0,0 +1,167 @@ +/* + * 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 + */ + +#include "avfilter.h" +#include "libavutil/pixdesc.h" +#include "libavutil/colorspace.h" +#include "libavutil/imgutils.h" +#include "libavutil/parseutils.h" +#include "drawutils.h" + +typedef struct { + int w, h; + uint8_t color[4]; + AVRational time_base; + uint8_t *line[4]; + int line_step[4]; + int hsub, vsub; ///< chroma subsampling values + uint64_t pts; +} ColorContext; + +static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + ColorContext *color = ctx->priv; + char color_string[128] = "black"; + char frame_size [128] = "320x240"; + char frame_rate [128] = "25"; + AVRational frame_rate_q; + int ret; + + if (args) + sscanf(args, "%127[^:]:%127[^:]:%127s", color_string, frame_size, frame_rate); + + if (av_parse_video_size(&color->w, &color->h, frame_size) < 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid frame size: %s\n", frame_size); + return AVERROR(EINVAL); + } + + if (av_parse_video_rate(&frame_rate_q, frame_rate) < 0 || + frame_rate_q.den <= 0 || frame_rate_q.num <= 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", frame_rate); + return AVERROR(EINVAL); + } + color->time_base.num = frame_rate_q.den; + color->time_base.den = frame_rate_q.num; + + if ((ret = av_parse_color(color->color, color_string, -1, ctx)) < 0) + return ret; + + return 0; +} + +static av_cold void color_uninit(AVFilterContext *ctx) +{ + ColorContext *color = ctx->priv; + int i; + + for (i = 0; i < 4; i++) { + av_freep(&color->line[i]); + color->line_step[i] = 0; + } +} + +static int query_formats(AVFilterContext *ctx) +{ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_ARGB, PIX_FMT_RGBA, + PIX_FMT_ABGR, PIX_FMT_BGRA, + PIX_FMT_RGB24, PIX_FMT_BGR24, + + 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_NONE + }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int color_config_props(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->src; + ColorContext *color = ctx->priv; + uint8_t rgba_color[4]; + int is_packed_rgba; + const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format]; + + color->hsub = pix_desc->log2_chroma_w; + color->vsub = pix_desc->log2_chroma_h; + + color->w &= ~((1 << color->hsub) - 1); + color->h &= ~((1 << color->vsub) - 1); + if (av_image_check_size(color->w, color->h, 0, ctx) < 0) + return AVERROR(EINVAL); + + memcpy(rgba_color, color->color, sizeof(rgba_color)); + ff_fill_line_with_color(color->line, color->line_step, color->w, color->color, + inlink->format, rgba_color, &is_packed_rgba, NULL); + + av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n", + color->w, color->h, color->time_base.den, color->time_base.num, + color->color[0], color->color[1], color->color[2], color->color[3], + is_packed_rgba ? "rgba" : "yuva"); + inlink->w = color->w; + inlink->h = color->h; + + return 0; +} + +static int color_request_frame(AVFilterLink *link) +{ + ColorContext *color = link->src->priv; + AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); + 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)); + ff_draw_rectangle(picref->data, picref->linesize, + color->line, color->line_step, color->hsub, color->vsub, + 0, 0, color->w, color->h); + avfilter_draw_slice(link, 0, color->h, 1); + avfilter_end_frame(link); + avfilter_unref_buffer(picref); + + return 0; +} + +AVFilter avfilter_vsrc_color = { + .name = "color", + .description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input, syntax is: [color[:size[:rate]]]"), + + .priv_size = sizeof(ColorContext), + .init = color_init, + .uninit = color_uninit, + + .query_formats = query_formats, + + .inputs = (AVFilterPad[]) {{ .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .request_frame = color_request_frame, + .config_props = color_config_props }, + { .name = NULL}}, +}; From bbfd2e7ab4e2ae0b934657fe51afdbbbaead52b7 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 20 Feb 2011 10:46:55 -0500 Subject: [PATCH 422/528] VC1: inline vc1_put_block() in vc1_decode_i_blocks(). Advantage is that it allows us to combine several loops into a single one, and these can eventually be merged into the IDCT itself. Also, it allows us to remove vc1_put_block(), and makes CODEC_FLAG_GRAY faster. --- libavcodec/vc1dec.c | 48 ++++++++++++--------------------------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index aff851487b..a3db6fe70b 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -187,39 +187,6 @@ static void vc1_loop_filter_iblk(VC1Context *v, int pq) } } -/** Put block onto picture - */ -static void vc1_put_block(VC1Context *v, DCTELEM block[6][64]) -{ - uint8_t *Y; - int ys, us, vs; - DSPContext *dsp = &v->s.dsp; - - if(v->rangeredfrm) { - int i, j, k; - for(k = 0; k < 6; k++) - for(j = 0; j < 8; j++) - for(i = 0; i < 8; i++) - block[k][i + j*8] = (block[k][i + j*8] - 64) << 1; - - } - ys = v->s.current_picture.linesize[0]; - us = v->s.current_picture.linesize[1]; - vs = v->s.current_picture.linesize[2]; - Y = v->s.dest[0]; - - dsp->put_pixels_clamped(block[0], Y, ys); - dsp->put_pixels_clamped(block[1], Y + 8, ys); - Y += ys * 8; - dsp->put_pixels_clamped(block[2], Y, ys); - dsp->put_pixels_clamped(block[3], Y + 8, ys); - - if(!(v->s.flags & CODEC_FLAG_GRAY)) { - dsp->put_pixels_clamped(block[4], v->s.dest[1], us); - dsp->put_pixels_clamped(block[5], v->s.dest[2], vs); - } -} - /** Do motion compensation over 1 macroblock * Mostly adapted hpel_motion and qpel_motion from mpegvideo.c */ @@ -2627,7 +2594,14 @@ static void vc1_decode_i_blocks(VC1Context *v) s->mb_x = 0; ff_init_block_index(s); for(; s->mb_x < s->mb_width; s->mb_x++) { + uint8_t *dst[6]; ff_update_block_index(s); + dst[0] = s->dest[0]; + dst[1] = dst[0] + 8; + dst[2] = s->dest[0] + s->linesize * 8; + dst[3] = dst[2] + 8; + dst[4] = s->dest[1]; + dst[5] = s->dest[2]; s->dsp.clear_blocks(s->block[0]); mb_pos = s->mb_x + s->mb_y * s->mb_width; s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; @@ -2651,13 +2625,17 @@ static void vc1_decode_i_blocks(VC1Context *v) vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); + if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); if(v->pq >= 9 && v->overlap) { - for(j = 0; j < 64; j++) s->block[k][j] += 128; + if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] <<= 1; + s->dsp.put_signed_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); + } else { + if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] = (s->block[k][j] - 64) << 1; + s->dsp.put_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); } } - vc1_put_block(v, s->block); if(v->pq >= 9 && v->overlap) { if(s->mb_x) { v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); From 484a337cd7cd8bb180c4a1bd3321881f1c874a92 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 20 Feb 2011 17:31:33 -0500 Subject: [PATCH 423/528] dsputil: make {add/put/put_signed}_pixels_clamped() non-static. --- libavcodec/dsputil.c | 28 ++++++++++++++-------------- libavcodec/dsputil.h | 4 ++++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index f7151b8815..1f7bd4cbc0 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -437,8 +437,8 @@ static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1, } -static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, - int line_size) +void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, + int line_size) { int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; @@ -493,9 +493,9 @@ static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels } } -static void put_signed_pixels_clamped_c(const DCTELEM *block, - uint8_t *restrict pixels, - int line_size) +void ff_put_signed_pixels_clamped_c(const DCTELEM *block, + uint8_t *restrict pixels, + int line_size) { int i, j; @@ -535,8 +535,8 @@ static void put_pixels_nonclamped_c(const DCTELEM *block, uint8_t *restrict pixe } } -static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, - int line_size) +void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, + int line_size) { int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; @@ -3961,22 +3961,22 @@ void ff_wmv2_idct_c(short * block){ static void ff_wmv2_idct_put_c(uint8_t *dest, int line_size, DCTELEM *block) { ff_wmv2_idct_c(block); - put_pixels_clamped_c(block, dest, line_size); + ff_put_pixels_clamped_c(block, dest, line_size); } static void ff_wmv2_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block) { ff_wmv2_idct_c(block); - add_pixels_clamped_c(block, dest, line_size); + ff_add_pixels_clamped_c(block, dest, line_size); } static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block) { j_rev_dct (block); - put_pixels_clamped_c(block, dest, line_size); + ff_put_pixels_clamped_c(block, dest, line_size); } static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block) { j_rev_dct (block); - add_pixels_clamped_c(block, dest, line_size); + ff_add_pixels_clamped_c(block, dest, line_size); } static void ff_jref_idct4_put(uint8_t *dest, int line_size, DCTELEM *block) @@ -4135,10 +4135,10 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->get_pixels = get_pixels_c; c->diff_pixels = diff_pixels_c; - c->put_pixels_clamped = put_pixels_clamped_c; - c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; + c->put_pixels_clamped = ff_put_pixels_clamped_c; + c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c; c->put_pixels_nonclamped = put_pixels_nonclamped_c; - c->add_pixels_clamped = add_pixels_clamped_c; + c->add_pixels_clamped = ff_add_pixels_clamped_c; c->add_pixels8 = add_pixels8_c; c->add_pixels4 = add_pixels4_c; c->sum_abs_dctelem = sum_abs_dctelem_c; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index f97b2b5fef..3e55d1338d 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -198,6 +198,10 @@ void ff_emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize, int block_w, int block_h, int src_x, int src_y, int w, int h); +void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); +void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); +void ff_put_signed_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); + /** * DSPContext. */ From 8d9ac969cb4ac3e3e18f6425703af4d7aec6c513 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 20 Feb 2011 15:03:29 +0100 Subject: [PATCH 424/528] avio: rename av_alloc_put_byte -> avio_alloc_context for consistency Signed-off-by: Ronald S. Bultje --- libavformat/avidec.c | 2 +- libavformat/avio.h | 11 ++++++++++- libavformat/aviobuf.c | 14 +++++++++++++- libavformat/rdt.c | 2 +- libavformat/wtv.c | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index c83d840189..7eda500422 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -752,7 +752,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { AVIStream *ast = st->priv_data; AVInputFormat *sub_demuxer; AVRational time_base; - AVIOContext *pb = av_alloc_put_byte(pkt->data + 7, + AVIOContext *pb = avio_alloc_context( pkt->data + 7, pkt->size - 7, 0, NULL, NULL, NULL, NULL); AVProbeData pd; diff --git a/libavformat/avio.h b/libavformat/avio.h index 060f06e6f2..4fb701696e 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -370,8 +370,17 @@ attribute_deprecated int init_put_byte(AVIOContext *s, int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)); +attribute_deprecated AVIOContext *av_alloc_put_byte( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); #endif -AVIOContext *av_alloc_put_byte( + +AVIOContext *avio_alloc_context( unsigned char *buffer, int buffer_size, int write_flag, diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 7b1f5ca1fd..c3d69a185e 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -87,9 +87,21 @@ int init_put_byte(AVIOContext *s, return ffio_init_context(s, buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); } +AVIOContext *av_alloc_put_byte( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)) +{ + return avio_alloc_context(buffer, buffer_size, write_flag, opaque, + read_packet, write_packet, seek); +} #endif -AVIOContext *av_alloc_put_byte( +AVIOContext *avio_alloc_context( unsigned char *buffer, int buffer_size, int write_flag, diff --git a/libavformat/rdt.c b/libavformat/rdt.c index bbc3de923b..d846533724 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -311,7 +311,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, if (res > 0) { if (st->codec->codec_id == CODEC_ID_AAC) { memcpy (rdt->buffer, buf + pos, len - pos); - rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0, + rdt->rmctx->pb = avio_alloc_context (rdt->buffer, len - pos, 0, NULL, NULL, NULL, NULL); } goto get_cache; diff --git a/libavformat/wtv.c b/libavformat/wtv.c index bdccdb3b09..e8b6268db3 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -236,7 +236,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int return NULL; } - pb = av_alloc_put_byte(buffer, 1 << wf->sector_bits, 0, wf, + pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf, wtvfile_read_packet, NULL, wtvfile_seek); if (!pb) { av_free(buffer); From f8bed30d8b176fa030f6737765338bb4a2bcabc9 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 21 Feb 2011 09:07:13 -0500 Subject: [PATCH 425/528] VC1: merge idct8x8, coeff adjustments and put_pixels. Merging these functions allows merging some loops, which makes the results (particularly after SIMD optimizations) much faster. --- libavcodec/ppc/vc1dsp_altivec.c | 64 +++++++++++++++++++++++++++++++-- libavcodec/vc1.c | 28 ++++++++++++++- libavcodec/vc1dec.c | 58 +++++++++++++++++------------- libavcodec/vc1dsp.c | 54 ++++++++++++++++++++++------ libavcodec/vc1dsp.h | 6 +++- 5 files changed, 170 insertions(+), 40 deletions(-) diff --git a/libavcodec/ppc/vc1dsp_altivec.c b/libavcodec/ppc/vc1dsp_altivec.c index 5a0dddbe1d..b5cc71c3cf 100644 --- a/libavcodec/ppc/vc1dsp_altivec.c +++ b/libavcodec/ppc/vc1dsp_altivec.c @@ -130,7 +130,8 @@ do { \ /** Do inverse transform on 8x8 block */ -static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) +static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], + int sign, int rangered) { vector signed short src0, src1, src2, src3, src4, src5, src6, src7; vector signed int s0, s1, s2, s3, s4, s5, s6, s7; @@ -144,7 +145,9 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) const vector unsigned int vec_2 = vec_splat_u32(2); const vector signed int vec_1s = vec_splat_s32(1); const vector unsigned int vec_1 = vec_splat_u32(1); - + const vector unsigned short rangered_shift = vec_splat_u16(1); + const vector signed short signed_bias = vec_sl(vec_splat_u16(4), + vec_splat_u16(4)); src0 = vec_ld( 0, block); src1 = vec_ld( 16, block); @@ -214,6 +217,27 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) src6 = vec_pack(sE, s6); src7 = vec_pack(sF, s7); + if (rangered) { + if (!sign) { + vec_sub(src0, signed_bias); + vec_sub(src1, signed_bias); + vec_sub(src2, signed_bias); + vec_sub(src3, signed_bias); + vec_sub(src4, signed_bias); + vec_sub(src5, signed_bias); + vec_sub(src6, signed_bias); + vec_sub(src7, signed_bias); + } + vec_sl(src0, rangered_shift); + vec_sl(src1, rangered_shift); + vec_sl(src2, rangered_shift); + vec_sl(src3, rangered_shift); + vec_sl(src4, rangered_shift); + vec_sl(src5, rangered_shift); + vec_sl(src6, rangered_shift); + vec_sl(src7, rangered_shift); + } + vec_st(src0, 0, block); vec_st(src1, 16, block); vec_st(src2, 32, block); @@ -224,6 +248,36 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) vec_st(src7,112, block); } +static void vc1_inv_trans_8x8_add_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 0, 0); + ff_add_pixels_clamped_c(b, dest, stride); +} + +static void vc1_inv_trans_8x8_put_signed_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 1, 0); + ff_put_signed_pixels_clamped_c(b, dest, stride); +} + +static void vc1_inv_trans_8x8_put_signed_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 1, 1); + ff_put_signed_pixels_clamped_c(b, dest, stride); +} + +static void vc1_inv_trans_8x8_put_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 0, 0); + ff_put_pixels_clamped_c(b, dest, stride); +} + +static void vc1_inv_trans_8x8_put_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 0, 1); + ff_put_pixels_clamped_c(b, dest, stride); +} + /** Do inverse transform on 8x4 part of block */ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block) @@ -342,7 +396,11 @@ void ff_vc1dsp_init_altivec(VC1DSPContext* dsp) if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return; - dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec; + dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_altivec; + dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_altivec; + dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_altivec; + dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_altivec; + dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_altivec; dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 8bd6647f13..27cd0108a5 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -280,6 +280,28 @@ static int vop_dquant_decoding(VC1Context *v) static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb); +static void simple_idct_put_rangered(uint8_t *dest, int line_size, DCTELEM *block) +{ + int i; + ff_simple_idct(block); + for (i = 0; i < 64; i++) block[i] = (block[i] - 64) << 1; + ff_put_pixels_clamped_c(block, dest, line_size); +} + +static void simple_idct_put_signed(uint8_t *dest, int line_size, DCTELEM *block) +{ + ff_simple_idct(block); + ff_put_signed_pixels_clamped_c(block, dest, line_size); +} + +static void simple_idct_put_signed_rangered(uint8_t *dest, int line_size, DCTELEM *block) +{ + int i; + ff_simple_idct(block); + for (i = 0; i < 64; i++) block[i] <<= 1; + ff_put_signed_pixels_clamped_c(block, dest, line_size); +} + /** * Decode Simple/Main Profiles sequence header * @see Figure 7-8, p16-17 @@ -337,7 +359,11 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte v->res_fasttx = get_bits1(gb); if (!v->res_fasttx) { - v->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct; + v->vc1dsp.vc1_inv_trans_8x8_add = ff_simple_idct_add; + v->vc1dsp.vc1_inv_trans_8x8_put[0] = ff_simple_idct_put; + v->vc1dsp.vc1_inv_trans_8x8_put[1] = simple_idct_put_rangered; + v->vc1dsp.vc1_inv_trans_8x8_put_signed[0] = simple_idct_put_signed; + v->vc1dsp.vc1_inv_trans_8x8_put_signed[1] = simple_idct_put_signed_rangered; v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index a3db6fe70b..ed92d8cadd 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -2009,8 +2009,7 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan if(i==1) v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); else{ - v->vc1dsp.vc1_inv_trans_8x8(block); - s->dsp.add_pixels_clamped(block, dst, linesize); + v->vc1dsp.vc1_inv_trans_8x8_add(dst, linesize, block); } if(apply_filter && cbp_top & 0xC) v->vc1dsp.vc1_v_loop_filter8(dst, linesize, v->pq); @@ -2117,7 +2116,7 @@ static int vc1_decode_p_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; - int i, j; + int i; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp; /* cbp decoding stuff */ int mqdiff, mquant; /* MB quantization */ @@ -2149,6 +2148,8 @@ static int vc1_decode_p_mb(VC1Context *v) { if (!skipped) { + vc1_idct_func idct8x8_fn; + GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { @@ -2183,6 +2184,7 @@ static int vc1_decode_p_mb(VC1Context *v) VC1_TTMB_VLC_BITS, 2); if(!s->mb_intra) vc1_mc_1mv(v, 0); dst_idx = 0; + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; for (i=0; i<6; i++) { s->dc_val[0][s->block_index[i]] = 0; @@ -2200,9 +2202,9 @@ static int vc1_decode_p_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; - v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; - s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + idct8x8_fn(s->dest[dst_idx] + off, + i & 4 ? s->uvlinesize : s->linesize, + s->block[i]); if(v->pq >= 9 && v->overlap) { if(v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); @@ -2267,6 +2269,7 @@ static int vc1_decode_p_mb(VC1Context *v) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; + vc1_idct_func idct8x8_fn; /* Get CBPCY */ cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (i=0; i<6; i++) @@ -2316,6 +2319,7 @@ static int vc1_decode_p_mb(VC1Context *v) } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; for (i=0; i<6; i++) { dst_idx += i >> 2; @@ -2331,9 +2335,9 @@ static int vc1_decode_p_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; - v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; - s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); + idct8x8_fn(s->dest[dst_idx] + off, + (i&4)?s->uvlinesize:s->linesize, + s->block[i]); if(v->pq >= 9 && v->overlap) { if(v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); @@ -2409,7 +2413,7 @@ static void vc1_decode_b_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; - int i, j; + int i; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; /* cbp decoding stuff */ int mqdiff, mquant; /* MB quantization */ @@ -2422,6 +2426,7 @@ static void vc1_decode_b_mb(VC1Context *v) int skipped, direct; int dmv_x[2], dmv_y[2]; int bmvtype = BMV_TYPE_BACKWARD; + vc1_idct_func idct8x8_fn; mquant = v->pq; /* Loosy initialization */ s->mb_intra = 0; @@ -2519,6 +2524,7 @@ static void vc1_decode_b_mb(VC1Context *v) } } dst_idx = 0; + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; for (i=0; i<6; i++) { s->dc_val[0][s->block_index[i]] = 0; @@ -2536,9 +2542,9 @@ static void vc1_decode_b_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; - v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; - s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + idct8x8_fn(s->dest[dst_idx] + off, + i & 4 ? s->uvlinesize : s->linesize, + s->block[i]); } else if(val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), 0, 0, 0); if(!v->ttmbf && ttmb < 8) ttmb = -1; @@ -2551,11 +2557,12 @@ static void vc1_decode_b_mb(VC1Context *v) */ static void vc1_decode_i_blocks(VC1Context *v) { - int k, j; + int k; MpegEncContext *s = &v->s; int cbp, val; uint8_t *coded_val; int mb_pos; + vc1_idct_func idct8x8_fn; /* select codingmode used for VLC tables selection */ switch(v->y_ac_table_index){ @@ -2590,6 +2597,10 @@ static void vc1_decode_i_blocks(VC1Context *v) s->mb_x = s->mb_y = 0; s->mb_intra = 1; s->first_slice_line = 1; + if(v->pq >= 9 && v->overlap) { + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; + } else + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put[!!v->rangeredfrm]; for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); @@ -2626,14 +2637,9 @@ static void vc1_decode_i_blocks(VC1Context *v) vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; - v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); - if(v->pq >= 9 && v->overlap) { - if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] <<= 1; - s->dsp.put_signed_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); - } else { - if (v->rangeredfrm) for(j = 0; j < 64; j++) s->block[k][j] = (s->block[k][j] - 64) << 1; - s->dsp.put_pixels_clamped(s->block[k], dst[k], k & 4 ? s->uvlinesize : s->linesize); - } + idct8x8_fn(dst[k], + k & 4 ? s->uvlinesize : s->linesize, + s->block[k]); } if(v->pq >= 9 && v->overlap) { @@ -2691,6 +2697,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) int mqdiff; int overlap; GetBitContext *gb = &s->gb; + vc1_idct_func idct8x8_fn; /* select codingmode used for VLC tables selection */ switch(v->y_ac_table_index){ @@ -2721,6 +2728,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) s->mb_x = s->mb_y = 0; s->mb_intra = 1; s->first_slice_line = 1; + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[0]; for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); @@ -2777,9 +2785,9 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; - v->vc1dsp.vc1_inv_trans_8x8(s->block[k]); - s->dsp.put_signed_pixels_clamped(s->block[k], dst[k], - k & 4 ? s->uvlinesize : s->linesize); + idct8x8_fn(dst[k], + k & 4 ? s->uvlinesize : s->linesize, + s->block[k]); } if(overlap) { diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c index 000dad7d26..dbe2120829 100644 --- a/libavcodec/vc1dsp.c +++ b/libavcodec/vc1dsp.c @@ -199,7 +199,7 @@ static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block) } } -static void vc1_inv_trans_8x8_c(DCTELEM block[64]) +static av_always_inline void vc1_inv_trans_8x8_c(DCTELEM block[64], int shl, int sub) { int i; register int t1,t2,t3,t4,t5,t6,t7,t8; @@ -254,20 +254,50 @@ static void vc1_inv_trans_8x8_c(DCTELEM block[64]) t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; - dst[ 0] = (t5 + t1) >> 7; - dst[ 8] = (t6 + t2) >> 7; - dst[16] = (t7 + t3) >> 7; - dst[24] = (t8 + t4) >> 7; - dst[32] = (t8 - t4 + 1) >> 7; - dst[40] = (t7 - t3 + 1) >> 7; - dst[48] = (t6 - t2 + 1) >> 7; - dst[56] = (t5 - t1 + 1) >> 7; + dst[ 0] = (((t5 + t1 ) >> 7) - sub) << shl; + dst[ 8] = (((t6 + t2 ) >> 7) - sub) << shl; + dst[16] = (((t7 + t3 ) >> 7) - sub) << shl; + dst[24] = (((t8 + t4 ) >> 7) - sub) << shl; + dst[32] = (((t8 - t4 + 1) >> 7) - sub) << shl; + dst[40] = (((t7 - t3 + 1) >> 7) - sub) << shl; + dst[48] = (((t6 - t2 + 1) >> 7) - sub) << shl; + dst[56] = (((t5 - t1 + 1) >> 7) - sub) << shl; src++; dst++; } } +static void vc1_inv_trans_8x8_add_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 0, 0); + ff_add_pixels_clamped_c(block, dest, linesize); +} + +static void vc1_inv_trans_8x8_put_signed_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 0, 0); + ff_put_signed_pixels_clamped_c(block, dest, linesize); +} + +static void vc1_inv_trans_8x8_put_signed_rangered_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 1, 0); + ff_put_signed_pixels_clamped_c(block, dest, linesize); +} + +static void vc1_inv_trans_8x8_put_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 0, 0); + ff_put_pixels_clamped_c(block, dest, linesize); +} + +static void vc1_inv_trans_8x8_put_rangered_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 1, 64); + ff_put_pixels_clamped_c(block, dest, linesize); +} + /** Do inverse transform on 8x4 part of block */ static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block) @@ -662,7 +692,11 @@ static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*a } av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { - dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c; + dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_c; + dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_c; + dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_c; + dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_c; + dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_c; dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c; dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c; dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c; diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h index a1f3d90574..db9d892a23 100644 --- a/libavcodec/vc1dsp.h +++ b/libavcodec/vc1dsp.h @@ -30,9 +30,13 @@ #include "dsputil.h" +typedef void (*vc1_idct_func)(uint8_t *dest, int line_size, DCTELEM *block); + typedef struct VC1DSPContext { /* vc1 functions */ - void (*vc1_inv_trans_8x8)(DCTELEM *b); + vc1_idct_func vc1_inv_trans_8x8_add; + vc1_idct_func vc1_inv_trans_8x8_put_signed[2]; + vc1_idct_func vc1_inv_trans_8x8_put[2]; void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block); void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block); void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block); From b7effd4e8338f6ed5bda630ad7ed0809bf458648 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 21 Feb 2011 16:43:01 +0100 Subject: [PATCH 426/528] avio: avio_ prefixes for get_* functions In the name of consistency: get_byte -> avio_r8 get_ -> avio_r get_buffer -> avio_read get_partial_buffer will be made private later get_strz is left out becase I want to change it later to return something useful. Signed-off-by: Ronald S. Bultje --- libavformat/4xm.c | 18 +- libavformat/aea.c | 2 +- libavformat/aiffdec.c | 26 +- libavformat/amr.c | 8 +- libavformat/anm.c | 38 +-- libavformat/apc.c | 14 +- libavformat/ape.c | 60 ++--- libavformat/apetag.c | 18 +- libavformat/asfdec.c | 252 +++++++++---------- libavformat/au.c | 12 +- libavformat/avidec.c | 156 ++++++------ libavformat/avio.h | 39 ++- libavformat/aviobuf.c | 88 ++++--- libavformat/avs.c | 24 +- libavformat/bethsoftvid.c | 30 +-- libavformat/bfi.c | 32 +-- libavformat/bink.c | 30 +-- libavformat/c93.c | 18 +- libavformat/cafdec.c | 36 +-- libavformat/daud.c | 4 +- libavformat/dsicin.c | 30 +-- libavformat/dv.c | 10 +- libavformat/dxa.c | 30 +-- libavformat/eacdata.c | 4 +- libavformat/electronicarts.c | 44 ++-- libavformat/ffmdec.c | 144 +++++------ libavformat/ffmetadec.c | 4 +- libavformat/filmstripdec.c | 14 +- libavformat/flacdec.c | 6 +- libavformat/flic.c | 10 +- libavformat/flvdec.c | 52 ++-- libavformat/gxf.c | 70 +++--- libavformat/id3v1.c | 2 +- libavformat/id3v2.c | 30 +-- libavformat/idcin.c | 18 +- libavformat/idroqdec.c | 10 +- libavformat/iff.c | 30 +-- libavformat/img2.c | 2 +- libavformat/ingenientdec.c | 14 +- libavformat/ipmovie.c | 22 +- libavformat/isom.c | 16 +- libavformat/iss.c | 4 +- libavformat/iv8.c | 12 +- libavformat/ivfdec.c | 22 +- libavformat/libnut.c | 2 +- libavformat/lmlm4.c | 6 +- libavformat/lxfdec.c | 10 +- libavformat/matroskadec.c | 26 +- libavformat/mm.c | 18 +- libavformat/mmf.c | 26 +- libavformat/mov.c | 474 +++++++++++++++++------------------ libavformat/mp3dec.c | 18 +- libavformat/mpc.c | 14 +- libavformat/mpc8.c | 10 +- libavformat/mpeg.c | 78 +++--- libavformat/mpegts.c | 30 +-- libavformat/msnwc_tcp.c | 8 +- libavformat/mtv.c | 20 +- libavformat/mvi.c | 30 +-- libavformat/mxfdec.c | 122 ++++----- libavformat/mxg.c | 2 +- libavformat/ncdec.c | 6 +- libavformat/nsvdec.c | 54 ++-- libavformat/nutdec.c | 32 +-- libavformat/nuv.c | 52 ++-- libavformat/oggdec.c | 14 +- libavformat/oma.c | 2 +- libavformat/psxstr.c | 4 +- libavformat/pva.c | 26 +- libavformat/qcp.c | 28 +-- libavformat/r3d.c | 78 +++--- libavformat/rdt.c | 12 +- libavformat/riff.c | 44 ++-- libavformat/rl2.c | 26 +- libavformat/rmdec.c | 206 +++++++-------- libavformat/rpl.c | 6 +- libavformat/rsodec.c | 8 +- libavformat/rtpdec_asf.c | 4 +- libavformat/rtpdec_qt.c | 8 +- libavformat/rtsp.c | 2 +- libavformat/sauce.c | 20 +- libavformat/segafilm.c | 14 +- libavformat/sierravmd.c | 10 +- libavformat/siff.c | 40 +-- libavformat/smacker.c | 50 ++-- libavformat/sol.c | 12 +- libavformat/soxdec.c | 20 +- libavformat/spdifdec.c | 8 +- libavformat/swfdec.c | 44 ++-- libavformat/thp.c | 46 ++-- libavformat/tiertexseq.c | 14 +- libavformat/tmv.c | 14 +- libavformat/tta.c | 16 +- libavformat/tty.c | 6 +- libavformat/txd.c | 6 +- libavformat/utils.c | 6 +- libavformat/vc1test.c | 20 +- libavformat/vocdec.c | 24 +- libavformat/vqf.c | 16 +- libavformat/wav.c | 32 +-- libavformat/wc3movie.c | 20 +- libavformat/westwood.c | 12 +- libavformat/wtv.c | 56 ++--- libavformat/wv.c | 50 ++-- libavformat/xa.c | 12 +- libavformat/yop.c | 14 +- libavformat/yuv4mpeg.c | 4 +- 107 files changed, 1821 insertions(+), 1776 deletions(-) diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 033c962fda..bf2d7384b5 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -54,11 +54,11 @@ #define strk_SIZE 0x28 #define GET_LIST_HEADER() \ - fourcc_tag = get_le32(pb); \ - size = get_le32(pb); \ + fourcc_tag = avio_rl32(pb); \ + size = avio_rl32(pb); \ if (fourcc_tag != LIST_TAG) \ return AVERROR_INVALIDDATA; \ - fourcc_tag = get_le32(pb); + fourcc_tag = avio_rl32(pb); typedef struct AudioTrack { int sample_rate; @@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s, header = av_malloc(header_size); if (!header) return AVERROR(ENOMEM); - if (get_buffer(pb, header, header_size) != header_size){ + if (avio_read(pb, header, header_size) != header_size){ av_free(header); return AVERROR(EIO); } @@ -255,7 +255,7 @@ static int fourxm_read_packet(AVFormatContext *s, while (!packet_read) { - if ((ret = get_buffer(s->pb, header, 8)) < 0) + if ((ret = avio_read(s->pb, header, 8)) < 0) return ret; fourcc_tag = AV_RL32(&header[0]); size = AV_RL32(&header[4]); @@ -268,7 +268,7 @@ static int fourxm_read_packet(AVFormatContext *s, fourxm->video_pts ++; /* skip the LIST-* tag and move on to the next fourcc */ - get_le32(pb); + avio_rl32(pb); break; case ifrm_TAG: @@ -285,7 +285,7 @@ static int fourxm_read_packet(AVFormatContext *s, pkt->pts = fourxm->video_pts; pkt->pos = url_ftell(s->pb); memcpy(pkt->data, header, 8); - ret = get_buffer(s->pb, &pkt->data[8], size); + ret = avio_read(s->pb, &pkt->data[8], size); if (ret < 0){ av_free_packet(pkt); @@ -294,8 +294,8 @@ static int fourxm_read_packet(AVFormatContext *s, break; case snd__TAG: - track_number = get_le32(pb); - out_size= get_le32(pb); + track_number = avio_rl32(pb); + out_size= avio_rl32(pb); size-=8; if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) { diff --git a/libavformat/aea.c b/libavformat/aea.c index 16a11c86af..8316a7e162 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -63,7 +63,7 @@ static int aea_read_header(AVFormatContext *s, /* Parse the amount of channels and skip to pos 2048(0x800) */ url_fskip(s->pb, 264); - st->codec->channels = get_byte(s->pb); + st->codec->channels = avio_r8(s->pb); url_fskip(s->pb, 1783); diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 712f85cda3..7b3d1e7297 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -54,8 +54,8 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) if (url_feof(pb)) return AVERROR(EIO); - *tag = get_le32(pb); - size = get_be32(pb); + *tag = avio_rl32(pb); + size = avio_rb32(pb); if (size < 0) size = 0x7fffffff; @@ -74,7 +74,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) return; } - res = get_buffer(s->pb, str, size); + res = avio_read(s->pb, str, size); if (res < 0) return; @@ -93,18 +93,18 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec, if (size & 1) size++; codec->codec_type = AVMEDIA_TYPE_AUDIO; - codec->channels = get_be16(pb); - num_frames = get_be32(pb); - codec->bits_per_coded_sample = get_be16(pb); + codec->channels = avio_rb16(pb); + num_frames = avio_rb32(pb); + codec->bits_per_coded_sample = avio_rb16(pb); - get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */ + avio_read(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */ sample_rate = av_ext2dbl(ext); /* 80 bits BE IEEE extended float */ codec->sample_rate = sample_rate; size -= 18; /* Got an AIFF-C? */ if (version == AIFF_C_VERSION1) { - codec->codec_tag = get_le32(pb); + codec->codec_tag = avio_rl32(pb); codec->codec_id = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag); switch (codec->codec_id) { @@ -187,7 +187,7 @@ static int aiff_read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; /* AIFF data type */ - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag == MKTAG('A', 'I', 'F', 'F')) /* Got an AIFF file */ version = AIFF; else if (tag != MKTAG('A', 'I', 'F', 'C')) /* An AIFF-C file then */ @@ -217,7 +217,7 @@ static int aiff_read_header(AVFormatContext *s, goto got_sound; break; case MKTAG('F', 'V', 'E', 'R'): /* Version chunk */ - version = get_be32(pb); + version = avio_rb32(pb); break; case MKTAG('N', 'A', 'M', 'E'): /* Sample name chunk */ get_meta(s, "title" , size); @@ -233,8 +233,8 @@ static int aiff_read_header(AVFormatContext *s, break; case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */ aiff->data_end = url_ftell(pb) + size; - offset = get_be32(pb); /* Offset of sound data */ - get_be32(pb); /* BlockSize... don't care */ + offset = avio_rb32(pb); /* Offset of sound data */ + avio_rb32(pb); /* BlockSize... don't care */ offset += url_ftell(pb); /* Compute absolute data offset */ if (st->codec->block_align) /* Assume COMM already parsed */ goto got_sound; @@ -251,7 +251,7 @@ static int aiff_read_header(AVFormatContext *s, if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = size; - get_buffer(pb, st->codec->extradata, size); + avio_read(pb, st->codec->extradata, size); break; default: /* Jump */ if (size & 1) /* Always even aligned */ diff --git a/libavformat/amr.c b/libavformat/amr.c index 6ab8b3c668..9c64d35716 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -82,7 +82,7 @@ static int amr_read_header(AVFormatContext *s, AVStream *st; uint8_t header[9]; - get_buffer(pb, header, 6); + avio_read(pb, header, 6); st = av_new_stream(s, 0); if (!st) @@ -91,7 +91,7 @@ static int amr_read_header(AVFormatContext *s, } if(memcmp(header,AMR_header,6)!=0) { - get_buffer(pb, header+6, 3); + avio_read(pb, header+6, 3); if(memcmp(header,AMRWB_header,9)!=0) { return -1; @@ -128,7 +128,7 @@ static int amr_read_packet(AVFormatContext *s, } //FIXME this is wrong, this should rather be in a AVParset - toc=get_byte(s->pb); + toc=avio_r8(s->pb); mode = (toc >> 3) & 0x0F; if (enc->codec_id == CODEC_ID_AMR_NB) @@ -157,7 +157,7 @@ static int amr_read_packet(AVFormatContext *s, pkt->pos= url_ftell(s->pb); pkt->data[0]=toc; pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320; - read = get_buffer(s->pb, pkt->data+1, size-1); + read = avio_read(s->pb, pkt->data+1, size-1); if (read != size-1) { diff --git a/libavformat/anm.c b/libavformat/anm.c index b754518113..6bcb90db1a 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -84,16 +84,16 @@ static int read_header(AVFormatContext *s, int i, ret; url_fskip(pb, 4); /* magic number */ - if (get_le16(pb) != MAX_PAGES) { + if (avio_rl16(pb) != MAX_PAGES) { av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n"); return AVERROR_INVALIDDATA; } - anm->nb_pages = get_le16(pb); - anm->nb_records = get_le32(pb); + anm->nb_pages = avio_rl16(pb); + anm->nb_records = avio_rl32(pb); url_fskip(pb, 2); /* max records per page */ - anm->page_table_offset = get_le16(pb); - if (get_le32(pb) != ANIM_TAG) + anm->page_table_offset = avio_rl16(pb); + if (avio_rl32(pb) != ANIM_TAG) return AVERROR_INVALIDDATA; /* video stream */ @@ -103,32 +103,32 @@ static int read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_ANM; st->codec->codec_tag = 0; /* no fourcc */ - st->codec->width = get_le16(pb); - st->codec->height = get_le16(pb); - if (get_byte(pb) != 0) + st->codec->width = avio_rl16(pb); + st->codec->height = avio_rl16(pb); + if (avio_r8(pb) != 0) goto invalid; url_fskip(pb, 1); /* frame rate multiplier info */ /* ignore last delta record (used for looping) */ - if (get_byte(pb)) /* has_last_delta */ + if (avio_r8(pb)) /* has_last_delta */ anm->nb_records = FFMAX(anm->nb_records - 1, 0); url_fskip(pb, 1); /* last_delta_valid */ - if (get_byte(pb) != 0) + if (avio_r8(pb) != 0) goto invalid; - if (get_byte(pb) != 1) + if (avio_r8(pb) != 1) goto invalid; url_fskip(pb, 1); /* other recs per frame */ - if (get_byte(pb) != 1) + if (avio_r8(pb) != 1) goto invalid; url_fskip(pb, 32); /* record_types */ - st->nb_frames = get_le32(pb); - av_set_pts_info(st, 64, 1, get_le16(pb)); + st->nb_frames = avio_rl32(pb); + av_set_pts_info(st, 64, 1, avio_rl16(pb)); url_fskip(pb, 58); /* color cycling and palette data */ @@ -138,7 +138,7 @@ static int read_header(AVFormatContext *s, ret = AVERROR(ENOMEM); goto close_and_return; } - ret = get_buffer(pb, st->codec->extradata, st->codec->extradata_size); + ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size); if (ret < 0) goto close_and_return; @@ -149,9 +149,9 @@ static int read_header(AVFormatContext *s, for (i = 0; i < MAX_PAGES; i++) { Page *p = &anm->pt[i]; - p->base_record = get_le16(pb); - p->nb_records = get_le16(pb); - p->size = get_le16(pb); + p->base_record = avio_rl16(pb); + p->nb_records = avio_rl16(pb); + p->size = avio_rl16(pb); } /* find page of first frame */ @@ -211,7 +211,7 @@ repeat: tmp = url_ftell(pb); url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) + 8 + anm->record * 2, SEEK_SET); - record_size = get_le16(pb); + record_size = avio_rl16(pb); url_fseek(pb, tmp, SEEK_SET); /* fetch record */ diff --git a/libavformat/apc.c b/libavformat/apc.c index 7641d9f0d1..bf93fc1522 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -35,9 +35,9 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) AVIOContext *pb = s->pb; AVStream *st; - get_le32(pb); /* CRYO */ - get_le32(pb); /* _APC */ - get_le32(pb); /* 1.20 */ + avio_rl32(pb); /* CRYO */ + avio_rl32(pb); /* _APC */ + avio_rl32(pb); /* 1.20 */ st = av_new_stream(s, 0); if (!st) @@ -46,8 +46,8 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS; - get_le32(pb); /* number of samples */ - st->codec->sample_rate = get_le32(pb); + avio_rl32(pb); /* number of samples */ + st->codec->sample_rate = avio_rl32(pb); st->codec->extradata_size = 2 * 4; st->codec->extradata = av_malloc(st->codec->extradata_size + @@ -56,10 +56,10 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(ENOMEM); /* initial predictor values for adpcm decoder */ - get_buffer(pb, st->codec->extradata, 2 * 4); + avio_read(pb, st->codec->extradata, 2 * 4); st->codec->channels = 1; - if (get_le32(pb)) + if (avio_rl32(pb)) st->codec->channels = 2; st->codec->bits_per_coded_sample = 4; diff --git a/libavformat/ape.c b/libavformat/ape.c index 53b609fe4d..862ac1a482 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -162,11 +162,11 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* TODO: Skip any leading junk such as id3v2 tags */ ape->junklength = 0; - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('M', 'A', 'C', ' ')) return -1; - ape->fileversion = get_le16(pb); + ape->fileversion = avio_rl16(pb); if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10); @@ -174,15 +174,15 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) } if (ape->fileversion >= 3980) { - ape->padding1 = get_le16(pb); - ape->descriptorlength = get_le32(pb); - ape->headerlength = get_le32(pb); - ape->seektablelength = get_le32(pb); - ape->wavheaderlength = get_le32(pb); - ape->audiodatalength = get_le32(pb); - ape->audiodatalength_high = get_le32(pb); - ape->wavtaillength = get_le32(pb); - get_buffer(pb, ape->md5, 16); + ape->padding1 = avio_rl16(pb); + ape->descriptorlength = avio_rl32(pb); + ape->headerlength = avio_rl32(pb); + ape->seektablelength = avio_rl32(pb); + ape->wavheaderlength = avio_rl32(pb); + ape->audiodatalength = avio_rl32(pb); + ape->audiodatalength_high = avio_rl32(pb); + ape->wavtaillength = avio_rl32(pb); + avio_read(pb, ape->md5, 16); /* Skip any unknown bytes at the end of the descriptor. This is for future compatibility */ @@ -190,26 +190,26 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR); /* Read header data */ - ape->compressiontype = get_le16(pb); - ape->formatflags = get_le16(pb); - ape->blocksperframe = get_le32(pb); - ape->finalframeblocks = get_le32(pb); - ape->totalframes = get_le32(pb); - ape->bps = get_le16(pb); - ape->channels = get_le16(pb); - ape->samplerate = get_le32(pb); + ape->compressiontype = avio_rl16(pb); + ape->formatflags = avio_rl16(pb); + ape->blocksperframe = avio_rl32(pb); + ape->finalframeblocks = avio_rl32(pb); + ape->totalframes = avio_rl32(pb); + ape->bps = avio_rl16(pb); + ape->channels = avio_rl16(pb); + ape->samplerate = avio_rl32(pb); } else { ape->descriptorlength = 0; ape->headerlength = 32; - ape->compressiontype = get_le16(pb); - ape->formatflags = get_le16(pb); - ape->channels = get_le16(pb); - ape->samplerate = get_le32(pb); - ape->wavheaderlength = get_le32(pb); - ape->wavtaillength = get_le32(pb); - ape->totalframes = get_le32(pb); - ape->finalframeblocks = get_le32(pb); + ape->compressiontype = avio_rl16(pb); + ape->formatflags = avio_rl16(pb); + ape->channels = avio_rl16(pb); + ape->samplerate = avio_rl32(pb); + ape->wavheaderlength = avio_rl32(pb); + ape->wavtaillength = avio_rl32(pb); + ape->totalframes = avio_rl32(pb); + ape->finalframeblocks = avio_rl32(pb); if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */ @@ -217,7 +217,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) } if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) { - ape->seektablelength = get_le32(pb); + ape->seektablelength = avio_rl32(pb); ape->headerlength += 4; ape->seektablelength *= sizeof(int32_t); } else @@ -260,7 +260,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) if (ape->seektablelength > 0) { ape->seektable = av_malloc(ape->seektablelength); for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++) - ape->seektable[i] = get_le32(pb); + ape->seektable[i] = avio_rl32(pb); } ape->frames[0].pos = ape->firstframe; @@ -355,7 +355,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) AV_WL32(pkt->data , nblocks); AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip); - ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size); + ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size); pkt->pts = ape->frames[ape->currentframe].pts; pkt->stream_index = 0; diff --git a/libavformat/apetag.c b/libavformat/apetag.c index 3265646f78..7252fd2b2c 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -38,10 +38,10 @@ static int ape_tag_read_field(AVFormatContext *s) uint32_t size, flags; int i, c; - size = get_le32(pb); /* field size */ - flags = get_le32(pb); /* field flags */ + size = avio_rl32(pb); /* field size */ + flags = avio_rl32(pb); /* field flags */ for (i = 0; i < sizeof(key) - 1; i++) { - c = get_byte(pb); + c = avio_r8(pb); if (c < 0x20 || c > 0x7E) break; else @@ -57,7 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s) value = av_malloc(size+1); if (!value) return AVERROR(ENOMEM); - get_buffer(pb, value, size); + avio_read(pb, value, size); value[size] = 0; av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL); return 0; @@ -76,30 +76,30 @@ void ff_ape_parse_tag(AVFormatContext *s) url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); - get_buffer(pb, buf, 8); /* APETAGEX */ + avio_read(pb, buf, 8); /* APETAGEX */ if (strncmp(buf, "APETAGEX", 8)) { return; } - val = get_le32(pb); /* APE tag version */ + val = avio_rl32(pb); /* APE tag version */ if (val > APE_TAG_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); return; } - tag_bytes = get_le32(pb); /* tag size */ + tag_bytes = avio_rl32(pb); /* tag size */ if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); return; } - fields = get_le32(pb); /* number of fields */ + fields = avio_rl32(pb); /* number of fields */ if (fields > 65536) { av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); return; } - val = get_le32(pb); /* flags */ + val = avio_rl32(pb); /* flags */ if (val & APE_TAG_FLAG_IS_HEADER) { av_log(s, AV_LOG_ERROR, "APE Tag is a header\n"); return; diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index f5f439a2df..242f81cd6b 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -135,7 +135,7 @@ static void print_guid(const ff_asf_guid *g) void ff_get_guid(AVIOContext *s, ff_asf_guid *g) { assert(sizeof(*g) == 16); - get_buffer(s, *g, sizeof(*g)); + avio_read(s, *g, sizeof(*g)); } static int asf_probe(AVProbeData *pd) @@ -149,10 +149,10 @@ static int asf_probe(AVProbeData *pd) static int get_value(AVIOContext *pb, int type){ switch(type){ - case 2: return get_le32(pb); - case 3: return get_le32(pb); - case 4: return get_le64(pb); - case 5: return get_le16(pb); + case 2: return avio_rl32(pb); + case 3: return avio_rl32(pb); + case 4: return avio_rl64(pb); + case 5: return avio_rl16(pb); default:return INT_MIN; } } @@ -191,17 +191,17 @@ static int asf_read_file_properties(AVFormatContext *s, int64_t size) AVIOContext *pb = s->pb; ff_get_guid(pb, &asf->hdr.guid); - asf->hdr.file_size = get_le64(pb); - asf->hdr.create_time = get_le64(pb); - get_le64(pb); /* number of packets */ - asf->hdr.play_time = get_le64(pb); - asf->hdr.send_time = get_le64(pb); - asf->hdr.preroll = get_le32(pb); - asf->hdr.ignore = get_le32(pb); - asf->hdr.flags = get_le32(pb); - asf->hdr.min_pktsize = get_le32(pb); - asf->hdr.max_pktsize = get_le32(pb); - asf->hdr.max_bitrate = get_le32(pb); + asf->hdr.file_size = avio_rl64(pb); + asf->hdr.create_time = avio_rl64(pb); + avio_rl64(pb); /* number of packets */ + asf->hdr.play_time = avio_rl64(pb); + asf->hdr.send_time = avio_rl64(pb); + asf->hdr.preroll = avio_rl32(pb); + asf->hdr.ignore = avio_rl32(pb); + asf->hdr.flags = avio_rl32(pb); + asf->hdr.min_pktsize = avio_rl32(pb); + asf->hdr.max_pktsize = avio_rl32(pb); + asf->hdr.max_bitrate = avio_rl32(pb); s->packet_size = asf->hdr.max_pktsize; return 0; @@ -263,14 +263,14 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) return -1; } ff_get_guid(pb, &g); - total_size = get_le64(pb); - type_specific_size = get_le32(pb); - get_le32(pb); - st->id = get_le16(pb) & 0x7f; /* stream id */ + total_size = avio_rl64(pb); + type_specific_size = avio_rl32(pb); + avio_rl32(pb); + st->id = avio_rl16(pb) & 0x7f; /* stream id */ // mapping of asf ID to AV stream ID; asf->asfid2avid[st->id] = s->nb_streams - 1; - get_le32(pb); + avio_rl32(pb); if (test_for_ext_stream_audio) { ff_get_guid(pb, &g); @@ -278,11 +278,11 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) type = AVMEDIA_TYPE_AUDIO; is_dvr_ms_audio=1; ff_get_guid(pb, &g); - get_le32(pb); - get_le32(pb); - get_le32(pb); + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); ff_get_guid(pb, &g); - get_le32(pb); + avio_rl32(pb); } } @@ -303,11 +303,11 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) /* We have to init the frame size at some point .... */ pos2 = url_ftell(pb); if (size >= (pos2 + 8 - pos1 + 24)) { - asf_st->ds_span = get_byte(pb); - asf_st->ds_packet_size = get_le16(pb); - asf_st->ds_chunk_size = get_le16(pb); - get_le16(pb); //ds_data_size - get_byte(pb); //ds_silence_data + asf_st->ds_span = avio_r8(pb); + asf_st->ds_packet_size = avio_rl16(pb); + asf_st->ds_chunk_size = avio_rl16(pb); + avio_rl16(pb); //ds_data_size + avio_r8(pb); //ds_silence_data } //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", // asf_st->ds_packet_size, asf_st->ds_chunk_size, @@ -339,23 +339,23 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) } } else if (type == AVMEDIA_TYPE_VIDEO && size - (url_ftell(pb) - pos1 + 24) >= 51) { - get_le32(pb); - get_le32(pb); - get_byte(pb); - get_le16(pb); /* size */ - sizeX= get_le32(pb); /* size */ - st->codec->width = get_le32(pb); - st->codec->height = get_le32(pb); + avio_rl32(pb); + avio_rl32(pb); + avio_r8(pb); + avio_rl16(pb); /* size */ + sizeX= avio_rl32(pb); /* size */ + st->codec->width = avio_rl32(pb); + st->codec->height = avio_rl32(pb); /* not available for asf */ - get_le16(pb); /* panes */ - st->codec->bits_per_coded_sample = get_le16(pb); /* depth */ - tag1 = get_le32(pb); + avio_rl16(pb); /* panes */ + st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ + tag1 = avio_rl32(pb); url_fskip(pb, 20); // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); if (sizeX > 40) { st->codec->extradata_size = sizeX - 40; st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, st->codec->extradata, st->codec->extradata_size); + avio_read(pb, st->codec->extradata, st->codec->extradata_size); } /* Extract palette from extradata if bpp <= 8 */ @@ -402,39 +402,39 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) uint32_t ext_d, leak_rate, stream_num; unsigned int stream_languageid_index; - get_le64(pb); // starttime - get_le64(pb); // endtime - leak_rate = get_le32(pb); // leak-datarate - get_le32(pb); // bucket-datasize - get_le32(pb); // init-bucket-fullness - get_le32(pb); // alt-leak-datarate - get_le32(pb); // alt-bucket-datasize - get_le32(pb); // alt-init-bucket-fullness - get_le32(pb); // max-object-size - get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved) - stream_num = get_le16(pb); // stream-num + avio_rl64(pb); // starttime + avio_rl64(pb); // endtime + leak_rate = avio_rl32(pb); // leak-datarate + avio_rl32(pb); // bucket-datasize + avio_rl32(pb); // init-bucket-fullness + avio_rl32(pb); // alt-leak-datarate + avio_rl32(pb); // alt-bucket-datasize + avio_rl32(pb); // alt-init-bucket-fullness + avio_rl32(pb); // max-object-size + avio_rl32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved) + stream_num = avio_rl16(pb); // stream-num - stream_languageid_index = get_le16(pb); // stream-language-id-index + stream_languageid_index = avio_rl16(pb); // stream-language-id-index if (stream_num < 128) asf->streams[stream_num].stream_language_index = stream_languageid_index; - get_le64(pb); // avg frametime in 100ns units - stream_ct = get_le16(pb); //stream-name-count - payload_ext_ct = get_le16(pb); //payload-extension-system-count + avio_rl64(pb); // avg frametime in 100ns units + stream_ct = avio_rl16(pb); //stream-name-count + payload_ext_ct = avio_rl16(pb); //payload-extension-system-count if (stream_num < 128) asf->stream_bitrates[stream_num] = leak_rate; for (i=0; ipb; int len1, len2, len3, len4, len5; - len1 = get_le16(pb); - len2 = get_le16(pb); - len3 = get_le16(pb); - len4 = get_le16(pb); - len5 = get_le16(pb); + len1 = avio_rl16(pb); + len2 = avio_rl16(pb); + len3 = avio_rl16(pb); + len4 = avio_rl16(pb); + len5 = avio_rl16(pb); get_tag(s, "title" , 0, len1); get_tag(s, "author" , 0, len2); get_tag(s, "copyright", 0, len3); @@ -466,18 +466,18 @@ static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) ASFContext *asf = s->priv_data; int desc_count, i, ret; - desc_count = get_le16(pb); + desc_count = avio_rl16(pb); for(i=0;ipb; ASFContext *asf = s->priv_data; int j, ret; - int stream_count = get_le16(pb); + int stream_count = avio_rl16(pb); for(j = 0; j < stream_count; j++) { char lang[6]; - unsigned int lang_len = get_byte(pb); + unsigned int lang_len = avio_r8(pb); if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len) url_fskip(pb, lang_len - ret); if (j < 128) @@ -519,21 +519,21 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size) ASFContext *asf = s->priv_data; int n, stream_num, name_len, value_len, value_type, value_num; int ret, i; - n = get_le16(pb); + n = avio_rl16(pb); for(i=0;i\n", i, stream_num, name_len, value_type, value_len, name); - value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere + value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere url_fskip(pb, value_len - 2); if(stream_num<128){ @@ -551,25 +551,25 @@ static int asf_read_marker(AVFormatContext *s, int64_t size) int i, count, name_len, ret; char name[1024]; - get_le64(pb); // reserved 16 bytes - get_le64(pb); // ... - count = get_le32(pb); // markers count - get_le16(pb); // reserved 2 bytes - name_len = get_le16(pb); // name length + avio_rl64(pb); // reserved 16 bytes + avio_rl64(pb); // ... + count = avio_rl32(pb); // markers count + avio_rl16(pb); // reserved 2 bytes + name_len = avio_rl16(pb); // name length for(i=0;iasfid2avid, -1, sizeof(asf->asfid2avid)); for(;;) { uint64_t gpos= url_ftell(pb); ff_get_guid(pb, &g); - gsize = get_le64(pb); + gsize = avio_rl64(pb); av_dlog(s, "%08"PRIx64": ", gpos); print_guid(&g); av_dlog(s, " size=0x%"PRIx64"\n", gsize); @@ -634,8 +634,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) } else if (!ff_guidcmp(&g, &ff_asf_head1_guid)) { int v1, v2; ff_get_guid(pb, &g); - v1 = get_le32(pb); - v2 = get_le16(pb); + v1 = avio_rl32(pb); + v2 = avio_rl16(pb); continue; } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) { asf_read_marker(s, gsize); @@ -657,9 +657,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) url_fseek(pb, gpos + gsize, SEEK_SET); } ff_get_guid(pb, &g); - get_le64(pb); - get_byte(pb); - get_byte(pb); + avio_rl64(pb); + avio_r8(pb); + avio_r8(pb); if (url_feof(pb)) return -1; asf->data_offset = url_ftell(pb); @@ -704,9 +704,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) #define DO_2BITS(bits, var, defval) \ switch (bits & 3) \ { \ - case 3: var = get_le32(pb); rsize += 4; break; \ - case 2: var = get_le16(pb); rsize += 2; break; \ - case 1: var = get_byte(pb); rsize++; break; \ + case 3: var = avio_rl32(pb); rsize += 4; break; \ + case 2: var = avio_rl16(pb); rsize += 2; break; \ + case 1: var = avio_r8(pb); rsize++; break; \ default: var = defval; break; \ } @@ -731,7 +731,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) c=d=e=-1; while(off-- > 0){ c=d; d=e; - e= get_byte(pb); + e= avio_r8(pb); if(c == 0x82 && !d && !e) break; } @@ -754,8 +754,8 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n"); return -1; } - c= get_byte(pb); - d= get_byte(pb); + c= avio_r8(pb); + d= avio_r8(pb); rsize+=3; }else{ url_fseek(pb, -1, SEEK_CUR); //FIXME @@ -778,12 +778,12 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) return -1; } - asf->packet_timestamp = get_le32(pb); - get_le16(pb); /* duration */ + asf->packet_timestamp = avio_rl32(pb); + avio_rl16(pb); /* duration */ // rsize has at least 11 bytes which have to be present if (asf->packet_flags & 0x01) { - asf->packet_segsizetype = get_byte(pb); rsize++; + asf->packet_segsizetype = avio_r8(pb); rsize++; asf->packet_segments = asf->packet_segsizetype & 0x3f; } else { asf->packet_segments = 1; @@ -804,7 +804,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ ASFContext *asf = s->priv_data; int rsize = 1; - int num = get_byte(pb); + int num = avio_r8(pb); int64_t ts0, ts1; asf->packet_segments--; @@ -816,21 +816,21 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); //printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size); if (asf->packet_replic_size >= 8) { - asf->packet_obj_size = get_le32(pb); + asf->packet_obj_size = avio_rl32(pb); if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){ av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n"); return -1; } - asf->packet_frag_timestamp = get_le32(pb); // timestamp + asf->packet_frag_timestamp = avio_rl32(pb); // timestamp if(asf->packet_replic_size >= 8+38+4){ // for(i=0; ipacket_replic_size-8; i++) -// av_log(s, AV_LOG_DEBUG, "%02X ",get_byte(pb)); +// av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb)); // av_log(s, AV_LOG_DEBUG, "\n"); url_fskip(pb, 10); - ts0= get_le64(pb); - ts1= get_le64(pb); + ts0= avio_rl64(pb); + ts1= avio_rl64(pb); url_fskip(pb, 12); - get_le32(pb); + avio_rl32(pb); url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4); if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; else asf->packet_frag_timestamp= AV_NOPTS_VALUE; @@ -843,7 +843,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ asf->packet_frag_offset = 0; asf->packet_frag_timestamp = asf->packet_timestamp; - asf->packet_time_delta = get_byte(pb); + asf->packet_time_delta = avio_r8(pb); rsize++; }else if(asf->packet_replic_size!=0){ av_log(s, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", asf->packet_replic_size); @@ -928,7 +928,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk // frag_offset is here used as the beginning timestamp asf->packet_frag_timestamp = asf->packet_time_start; asf->packet_time_start += asf->packet_time_delta; - asf->packet_obj_size = asf->packet_frag_size = get_byte(pb); + asf->packet_obj_size = asf->packet_frag_size = avio_r8(pb); asf->packet_size_left--; asf->packet_multi_size--; if (asf->packet_multi_size < asf->packet_obj_size) @@ -988,7 +988,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk continue; } - ret = get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset, + ret = avio_read(pb, asf_st->pkt.data + asf->packet_frag_offset, asf->packet_frag_size); if (ret != asf->packet_frag_size) { if (ret < 0 || asf->packet_frag_offset + ret == 0) @@ -1194,7 +1194,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) /* the data object can be followed by other top-level objects, skip them until the simple index object is reached */ while (ff_guidcmp(&g, &index_guid)) { - int64_t gsize= get_le64(s->pb); + int64_t gsize= avio_rl64(s->pb); if (gsize < 24 || url_feof(s->pb)) { url_fseek(s->pb, current_pos, SEEK_SET); return; @@ -1206,16 +1206,16 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) { int64_t itime, last_pos=-1; int pct, ict; - int64_t av_unused gsize= get_le64(s->pb); + int64_t av_unused gsize= avio_rl64(s->pb); ff_get_guid(s->pb, &g); - itime=get_le64(s->pb); - pct=get_le32(s->pb); - ict=get_le32(s->pb); + itime=avio_rl64(s->pb); + pct=avio_rl32(s->pb); + ict=avio_rl32(s->pb); av_log(s, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict); for (i=0;ipb); - int pktct =get_le16(s->pb); + int pktnum=avio_rl32(s->pb); + int pktct =avio_rl16(s->pb); int64_t pos = s->data_offset + s->packet_size*(int64_t)pktnum; int64_t index_pts= av_rescale(itime, i, 10000); diff --git a/libavformat/au.c b/libavformat/au.c index fbcbc5ba07..16d53fec9d 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -127,15 +127,15 @@ static int au_read_header(AVFormatContext *s, AVStream *st; /* check ".snd" header */ - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('.', 's', 'n', 'd')) return -1; - size = get_be32(pb); /* header size */ - get_be32(pb); /* data size */ + size = avio_rb32(pb); /* header size */ + avio_rb32(pb); /* data size */ - id = get_be32(pb); - rate = get_be32(pb); - channels = get_be32(pb); + id = avio_rb32(pb); + rate = avio_rb32(pb); + channels = avio_rb32(pb); codec = ff_codec_get_id(codec_au_tags, id); diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 7eda500422..b2db2dc36d 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -107,10 +107,10 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) int i; /* check RIFF header */ - get_buffer(pb, header, 4); - avi->riff_end = get_le32(pb); /* RIFF chunk size */ + avio_read(pb, header, 4); + avi->riff_end = avio_rl32(pb); /* RIFF chunk size */ avi->riff_end += url_ftell(pb); /* RIFF chunk end */ - get_buffer(pb, header+4, 4); + avio_read(pb, header+4, 4); for(i=0; avi_headers[i][0]; i++) if(!memcmp(header, avi_headers[i], 8)) @@ -127,12 +127,12 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; - int longs_pre_entry= get_le16(pb); - int index_sub_type = get_byte(pb); - int index_type = get_byte(pb); - int entries_in_use = get_le32(pb); - int chunk_id = get_le32(pb); - int64_t base = get_le64(pb); + int longs_pre_entry= avio_rl16(pb); + int index_sub_type = avio_r8(pb); + int index_type = avio_r8(pb); + int entries_in_use = avio_rl32(pb); + int chunk_id = avio_rl32(pb); + int64_t base = avio_rl64(pb); int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0'); AVStream *st; AVIStream *ast; @@ -153,7 +153,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ if(index_sub_type) return -1; - get_le32(pb); + avio_rl32(pb); if(index_type && longs_pre_entry != 2) return -1; @@ -170,8 +170,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ for(i=0; i= 0; len &= 0x7FFFFFFF; @@ -191,9 +191,9 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ }else{ int64_t offset, pos; int duration; - offset = get_le64(pb); - get_le32(pb); /* size */ - duration = get_le32(pb); + offset = avio_rl64(pb); + avio_rl32(pb); /* size */ + duration = avio_rl32(pb); if(url_feof(pb)) return -1; @@ -256,7 +256,7 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t value = av_malloc(size+1); if (!value) return -1; - get_buffer(pb, value, size); + avio_read(pb, value, size); value[size]=0; AV_WL32(key, tag); @@ -268,8 +268,8 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t static void avi_read_info(AVFormatContext *s, uint64_t end) { while (url_ftell(s->pb) < end) { - uint32_t tag = get_le32(s->pb); - uint32_t size = get_le32(s->pb); + uint32_t tag = avio_rl32(s->pb); + uint32_t size = avio_rl32(s->pb); avi_read_tag(s, NULL, tag, size); } } @@ -299,17 +299,17 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date) static void avi_read_nikon(AVFormatContext *s, uint64_t end) { while (url_ftell(s->pb) < end) { - uint32_t tag = get_le32(s->pb); - uint32_t size = get_le32(s->pb); + uint32_t tag = avio_rl32(s->pb); + uint32_t size = avio_rl32(s->pb); switch (tag) { case MKTAG('n', 'c', 't', 'g'): { /* Nikon Tags */ uint64_t tag_end = url_ftell(s->pb) + size; while (url_ftell(s->pb) < tag_end) { - uint16_t tag = get_le16(s->pb); - uint16_t size = get_le16(s->pb); + uint16_t tag = avio_rl16(s->pb); + uint16_t size = avio_rl16(s->pb); const char *name = NULL; char buffer[64] = {0}; - size -= get_buffer(s->pb, buffer, + size -= avio_read(s->pb, buffer, FFMIN(size, sizeof(buffer)-1)); switch (tag) { case 0x03: name = "maker"; break; @@ -362,8 +362,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) for(;;) { if (url_feof(pb)) goto fail; - tag = get_le32(pb); - size = get_le32(pb); + tag = avio_rl32(pb); + size = avio_rl32(pb); print_tag("tag", tag, size); @@ -371,7 +371,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) case MKTAG('L', 'I', 'S', 'T'): list_end = url_ftell(pb) + size; /* Ignored, except at start of video packets. */ - tag1 = get_le32(pb); + tag1 = avio_rl32(pb); print_tag("list", tag1, 0); @@ -391,7 +391,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) case MKTAG('I', 'D', 'I', 'T'): { unsigned char date[64] = {0}; size += (size & 1); - size -= get_buffer(pb, date, FFMIN(size, sizeof(date)-1)); + size -= avio_read(pb, date, FFMIN(size, sizeof(date)-1)); url_fskip(pb, size); avi_metadata_creation_time(&s->metadata, date); break; @@ -405,24 +405,24 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) case MKTAG('a', 'v', 'i', 'h'): /* AVI header */ /* using frame_period is bad idea */ - frame_period = get_le32(pb); - bit_rate = get_le32(pb) * 8; - get_le32(pb); - avi->non_interleaved |= get_le32(pb) & AVIF_MUSTUSEINDEX; + frame_period = avio_rl32(pb); + bit_rate = avio_rl32(pb) * 8; + avio_rl32(pb); + avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; url_fskip(pb, 2 * 4); - get_le32(pb); - get_le32(pb); - avih_width=get_le32(pb); - avih_height=get_le32(pb); + avio_rl32(pb); + avio_rl32(pb); + avih_width=avio_rl32(pb); + avih_height=avio_rl32(pb); url_fskip(pb, size - 10 * 4); break; case MKTAG('s', 't', 'r', 'h'): /* stream header */ - tag1 = get_le32(pb); - handler = get_le32(pb); /* codec tag */ + tag1 = avio_rl32(pb); + handler = avio_rl32(pb); /* codec tag */ if(tag1 == MKTAG('p', 'a', 'd', 's')){ url_fskip(pb, size - 8); @@ -470,11 +470,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } s->streams[0]->priv_data = ast; url_fskip(pb, 3 * 4); - ast->scale = get_le32(pb); - ast->rate = get_le32(pb); + ast->scale = avio_rl32(pb); + ast->rate = avio_rl32(pb); url_fskip(pb, 4); /* start time */ - dv_dur = get_le32(pb); + dv_dur = avio_rl32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { dv_dur *= AV_TIME_BASE; s->duration = av_rescale(dv_dur, ast->scale, ast->rate); @@ -492,12 +492,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) assert(stream_index < s->nb_streams); st->codec->stream_codec_tag= handler; - get_le32(pb); /* flags */ - get_le16(pb); /* priority */ - get_le16(pb); /* language */ - get_le32(pb); /* initial frame */ - ast->scale = get_le32(pb); - ast->rate = get_le32(pb); + avio_rl32(pb); /* flags */ + avio_rl16(pb); /* priority */ + avio_rl16(pb); /* language */ + avio_rl32(pb); /* initial frame */ + ast->scale = avio_rl32(pb); + ast->rate = avio_rl32(pb); if(!(ast->scale && ast->rate)){ av_log(s, AV_LOG_WARNING, "scale/rate is %u/%u which is invalid. (This file has been generated by broken software.)\n", ast->scale, ast->rate); if(frame_period){ @@ -510,13 +510,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } av_set_pts_info(st, 64, ast->scale, ast->rate); - ast->cum_len=get_le32(pb); /* start */ - st->nb_frames = get_le32(pb); + ast->cum_len=avio_rl32(pb); /* start */ + st->nb_frames = avio_rl32(pb); st->start_time = 0; - get_le32(pb); /* buffer size */ - get_le32(pb); /* quality */ - ast->sample_size = get_le32(pb); /* sample ssize */ + avio_rl32(pb); /* buffer size */ + avio_rl32(pb); /* quality */ + ast->sample_size = avio_rl32(pb); /* sample ssize */ ast->cum_len *= FFMAX(1, ast->sample_size); // av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size); @@ -579,11 +579,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata_size= 0; return AVERROR(ENOMEM); } - get_buffer(pb, st->codec->extradata, st->codec->extradata_size); + avio_read(pb, st->codec->extradata, st->codec->extradata_size); } if(st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly - get_byte(pb); + avio_r8(pb); /* Extract palette from extradata if bpp <= 8. */ /* This code assumes that extradata contains only palette. */ @@ -675,17 +675,17 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) AVRational active, active_aspect; st = s->streams[stream_index]; - get_le32(pb); - get_le32(pb); - get_le32(pb); - get_le32(pb); - get_le32(pb); + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); - active_aspect.den= get_le16(pb); - active_aspect.num= get_le16(pb); - active.num = get_le32(pb); - active.den = get_le32(pb); - get_le32(pb); //nbFieldsPerFrame + active_aspect.den= avio_rl16(pb); + active_aspect.num= avio_rl16(pb); + active.num = avio_rl32(pb); + active.den = avio_rl32(pb); + avio_rl32(pb); //nbFieldsPerFrame if(active_aspect.num && active_aspect.den && active.num && active.den){ st->sample_aspect_ratio= av_div_q(active_aspect, active); @@ -756,7 +756,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { pkt->size - 7, 0, NULL, NULL, NULL, NULL); AVProbeData pd; - unsigned int desc_len = get_le32(pb); + unsigned int desc_len = avio_rl32(pb); if (desc_len > pb->buf_end - pb->buf_ptr) goto error; @@ -766,8 +766,8 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { if (*desc) av_metadata_set2(&st->metadata, "title", desc, 0); - get_le16(pb); /* flags? */ - get_le32(pb); /* data size */ + avio_rl16(pb); /* flags? */ + avio_rl32(pb); /* data size */ pd = (AVProbeData) { .buf = pb->buf_ptr, .buf_size = pb->buf_end - pb->buf_ptr }; if (!(sub_demuxer = av_probe_input_format2(&pd, 1, &score))) @@ -994,7 +994,7 @@ resync: for(j=0; j<7; j++) d[j]= d[j+1]; - d[7]= get_byte(pb); + d[7]= avio_r8(pb); size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); @@ -1065,13 +1065,13 @@ resync: } if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) { - int k = get_byte(pb); - int last = (k + get_byte(pb) - 1) & 0xFF; + int k = avio_r8(pb); + int last = (k + avio_r8(pb) - 1) & 0xFF; - get_le16(pb); //flags + avio_rl16(pb); //flags for (; k <= last; k++) - ast->pal[k] = get_be32(pb)>>8;// b + (g << 8) + (r << 16); + ast->pal[k] = avio_rb32(pb)>>8;// b + (g << 8) + (r << 16); ast->has_pal= 1; goto resync; } else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) || @@ -1123,10 +1123,10 @@ static int avi_read_idx1(AVFormatContext *s, int size) /* Read the entries and sort them in each stream component. */ for(i = 0; i < nb_index_entries; i++) { - tag = get_le32(pb); - flags = get_le32(pb); - pos = get_le32(pb); - len = get_le32(pb); + tag = avio_rl32(pb); + flags = avio_rl32(pb); + pos = avio_rl32(pb); + len = avio_rl32(pb); #if defined(DEBUG_SEEK) av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/", i, tag, flags, pos, len); @@ -1175,7 +1175,7 @@ static int guess_ni_flag(AVFormatContext *s){ if(n >= 2){ int64_t pos= st->index_entries[0].pos; url_fseek(s->pb, pos + 4, SEEK_SET); - size= get_le32(s->pb); + size= avio_rl32(s->pb); if(pos + size > st->index_entries[1].pos) last_start= INT64_MAX; } @@ -1205,8 +1205,8 @@ static int avi_load_index(AVFormatContext *s) for(;;) { if (url_feof(pb)) break; - tag = get_le32(pb); - size = get_le32(pb); + tag = avio_rl32(pb); + size = avio_rl32(pb); #ifdef DEBUG_SEEK printf("tag=%c%c%c%c size=0x%x\n", tag & 0xff, diff --git a/libavformat/avio.h b/libavformat/avio.h index 4fb701696e..fa71d20d59 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -378,6 +378,25 @@ attribute_deprecated AVIOContext *av_alloc_put_byte( int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +/** + * @defgroup old_avio_funcs Old put_/get_*() functions + * @deprecated use the avio_ -prefixed functions instead. + * @{ + */ +attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size); +attribute_deprecated int get_byte(AVIOContext *s); +attribute_deprecated unsigned int get_le16(AVIOContext *s); +attribute_deprecated unsigned int get_le24(AVIOContext *s); +attribute_deprecated unsigned int get_le32(AVIOContext *s); +attribute_deprecated uint64_t get_le64(AVIOContext *s); +attribute_deprecated unsigned int get_be16(AVIOContext *s); +attribute_deprecated unsigned int get_be24(AVIOContext *s); +attribute_deprecated unsigned int get_be32(AVIOContext *s); +attribute_deprecated uint64_t get_be64(AVIOContext *s); +/** + * @} + */ #endif AVIOContext *avio_alloc_context( @@ -477,7 +496,7 @@ void put_flush_packet(AVIOContext *s); * Read size bytes from AVIOContext into buf. * @return number of bytes read or AVERROR */ -int get_buffer(AVIOContext *s, unsigned char *buf, int size); +int avio_read(AVIOContext *s, unsigned char *buf, int size); /** * Read size bytes from AVIOContext into buf. @@ -489,11 +508,11 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); /** @note return 0 if EOF, so you cannot use it if EOF handling is necessary */ -int get_byte(AVIOContext *s); -unsigned int get_le24(AVIOContext *s); -unsigned int get_le32(AVIOContext *s); -uint64_t get_le64(AVIOContext *s); -unsigned int get_le16(AVIOContext *s); +int avio_r8 (AVIOContext *s); +unsigned int avio_rl16(AVIOContext *s); +unsigned int avio_rl24(AVIOContext *s); +unsigned int avio_rl32(AVIOContext *s); +uint64_t avio_rl64(AVIOContext *s); /** * Read a UTF-16 string from pb and convert it to UTF-8. @@ -505,10 +524,10 @@ int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); char *get_strz(AVIOContext *s, char *buf, int maxlen); -unsigned int get_be16(AVIOContext *s); -unsigned int get_be24(AVIOContext *s); -unsigned int get_be32(AVIOContext *s); -uint64_t get_be64(AVIOContext *s); +unsigned int avio_rb16(AVIOContext *s); +unsigned int avio_rb24(AVIOContext *s); +unsigned int avio_rb32(AVIOContext *s); +uint64_t avio_rb64(AVIOContext *s); uint64_t ff_get_v(AVIOContext *bc); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index c3d69a185e..28825506d5 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -298,6 +298,32 @@ void put_strz(AVIOContext *s, const char *str) { avio_put_str(s, str); } + +#define GET(name, type) \ + type get_be ##name(AVIOContext *s) \ +{\ + return avio_rb ##name(s);\ +}\ + type get_le ##name(AVIOContext *s) \ +{\ + return avio_rl ##name(s);\ +} + +GET(16, unsigned int) +GET(24, unsigned int) +GET(32, unsigned int) +GET(64, uint64_t) + +#undef GET + +int get_byte(AVIOContext *s) +{ + return avio_r8(s); +} +int get_buffer(AVIOContext *s, unsigned char *buf, int size) +{ + return avio_read(s, buf, size); +} #endif int avio_put_str(AVIOContext *s, const char *str) @@ -457,7 +483,7 @@ void init_checksum(AVIOContext *s, } /* XXX: put an inline version */ -int get_byte(AVIOContext *s) +int avio_r8(AVIOContext *s) { if (s->buf_ptr >= s->buf_end) fill_buffer(s); @@ -475,7 +501,7 @@ int url_fgetc(AVIOContext *s) return URL_EOF; } -int get_buffer(AVIOContext *s, unsigned char *buf, int size) +int avio_read(AVIOContext *s, unsigned char *buf, int size) { int len, size1; @@ -545,58 +571,58 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size) return len; } -unsigned int get_le16(AVIOContext *s) +unsigned int avio_rl16(AVIOContext *s) { unsigned int val; - val = get_byte(s); - val |= get_byte(s) << 8; + val = avio_r8(s); + val |= avio_r8(s) << 8; return val; } -unsigned int get_le24(AVIOContext *s) +unsigned int avio_rl24(AVIOContext *s) { unsigned int val; - val = get_le16(s); - val |= get_byte(s) << 16; + val = avio_rl16(s); + val |= avio_r8(s) << 16; return val; } -unsigned int get_le32(AVIOContext *s) +unsigned int avio_rl32(AVIOContext *s) { unsigned int val; - val = get_le16(s); - val |= get_le16(s) << 16; + val = avio_rl16(s); + val |= avio_rl16(s) << 16; return val; } -uint64_t get_le64(AVIOContext *s) +uint64_t avio_rl64(AVIOContext *s) { uint64_t val; - val = (uint64_t)get_le32(s); - val |= (uint64_t)get_le32(s) << 32; + val = (uint64_t)avio_rl32(s); + val |= (uint64_t)avio_rl32(s) << 32; return val; } -unsigned int get_be16(AVIOContext *s) +unsigned int avio_rb16(AVIOContext *s) { unsigned int val; - val = get_byte(s) << 8; - val |= get_byte(s); + val = avio_r8(s) << 8; + val |= avio_r8(s); return val; } -unsigned int get_be24(AVIOContext *s) +unsigned int avio_rb24(AVIOContext *s) { unsigned int val; - val = get_be16(s) << 8; - val |= get_byte(s); + val = avio_rb16(s) << 8; + val |= avio_r8(s); return val; } -unsigned int get_be32(AVIOContext *s) +unsigned int avio_rb32(AVIOContext *s) { unsigned int val; - val = get_be16(s) << 16; - val |= get_be16(s); + val = avio_rb16(s) << 16; + val |= avio_rb16(s); return val; } @@ -605,7 +631,7 @@ char *get_strz(AVIOContext *s, char *buf, int maxlen) int i = 0; char c; - while ((c = get_byte(s))) { + while ((c = avio_r8(s))) { if (i < maxlen-1) buf[i++] = c; } @@ -621,7 +647,7 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen) char c; do { - c = get_byte(s); + c = avio_r8(s); if (c && i < maxlen-1) buf[i++] = c; } while (c != '\n' && c); @@ -647,16 +673,16 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen) return ret;\ }\ -GET_STR16(le, get_le16) -GET_STR16(be, get_be16) +GET_STR16(le, avio_rl16) +GET_STR16(be, avio_rb16) #undef GET_STR16 -uint64_t get_be64(AVIOContext *s) +uint64_t avio_rb64(AVIOContext *s) { uint64_t val; - val = (uint64_t)get_be32(s) << 32; - val |= (uint64_t)get_be32(s); + val = (uint64_t)avio_rb32(s) << 32; + val |= (uint64_t)avio_rb32(s); return val; } @@ -665,7 +691,7 @@ uint64_t ff_get_v(AVIOContext *bc){ int tmp; do{ - tmp = get_byte(bc); + tmp = avio_r8(bc); val= (val<<7) + (tmp&127); }while(tmp&128); return val; diff --git a/libavformat/avs.c b/libavformat/avs.c index 2e1b22439c..0ba5cebfdf 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -62,11 +62,11 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap) s->ctx_flags |= AVFMTCTX_NOHEADER; url_fskip(s->pb, 4); - avs->width = get_le16(s->pb); - avs->height = get_le16(s->pb); - avs->bits_per_sample = get_le16(s->pb); - avs->fps = get_le16(s->pb); - avs->nb_frames = get_le32(s->pb); + avs->width = avio_rl16(s->pb); + avs->height = avio_rl16(s->pb); + avs->bits_per_sample = avio_rl16(s->pb); + avs->fps = avio_rl16(s->pb); + avs->nb_frames = avio_rl32(s->pb); avs->remaining_frame_size = 0; avs->remaining_audio_size = 0; @@ -104,7 +104,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt, pkt->data[palette_size + 1] = type; pkt->data[palette_size + 2] = size & 0xFF; pkt->data[palette_size + 3] = (size >> 8) & 0xFF; - ret = get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4; + ret = avio_read(s->pb, pkt->data + palette_size + 4, size - 4) + 4; if (ret < size) { av_free_packet(pkt); return AVERROR(EIO); @@ -154,20 +154,20 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) while (1) { if (avs->remaining_frame_size <= 0) { - if (!get_le16(s->pb)) /* found EOF */ + if (!avio_rl16(s->pb)) /* found EOF */ return AVERROR(EIO); - avs->remaining_frame_size = get_le16(s->pb) - 4; + avs->remaining_frame_size = avio_rl16(s->pb) - 4; } while (avs->remaining_frame_size > 0) { - sub_type = get_byte(s->pb); - type = get_byte(s->pb); - size = get_le16(s->pb); + sub_type = avio_r8(s->pb); + type = avio_r8(s->pb); + size = avio_rl16(s->pb); avs->remaining_frame_size -= size; switch (type) { case AVS_PALETTE: - ret = get_buffer(s->pb, palette, size - 4); + ret = avio_read(s->pb, palette, size - 4); if (ret < size - 4) return AVERROR(EIO); palette_size = size; diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 017a8a6050..40d0e6296a 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -68,7 +68,7 @@ static int vid_read_header(AVFormatContext *s, * int16s: always_512, nframes, width, height, delay, always_14 */ url_fseek(pb, 5, SEEK_CUR); - vid->nframes = get_le16(pb); + vid->nframes = avio_rl16(pb); stream = av_new_stream(s, 0); if (!stream) @@ -76,11 +76,11 @@ static int vid_read_header(AVFormatContext *s, av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps stream->codec->codec_type = AVMEDIA_TYPE_VIDEO; stream->codec->codec_id = CODEC_ID_BETHSOFTVID; - stream->codec->width = get_le16(pb); - stream->codec->height = get_le16(pb); + stream->codec->width = avio_rl16(pb); + stream->codec->height = avio_rl16(pb); stream->codec->pix_fmt = PIX_FMT_PAL8; - vid->bethsoft_global_delay = get_le16(pb); - get_le16(pb); + vid->bethsoft_global_delay = avio_rl16(pb); + avio_rl16(pb); // done with video codec, set up audio codec stream = av_new_stream(s, 0); @@ -117,11 +117,11 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, vidbuf_start[vidbuf_nbytes++] = block_type; // get the video delay (next int16), and set the presentation time - vid->video_pts += vid->bethsoft_global_delay + get_le16(pb); + vid->video_pts += vid->bethsoft_global_delay + avio_rl16(pb); // set the y offset if it exists (decoder header data should be in data section) if(block_type == VIDEO_YOFF_P_FRAME){ - if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2) + if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2) goto fail; vidbuf_nbytes += 2; } @@ -131,21 +131,21 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, if(!vidbuf_start) return AVERROR(ENOMEM); - code = get_byte(pb); + code = avio_r8(pb); vidbuf_start[vidbuf_nbytes++] = code; if(code >= 0x80){ // rle sequence if(block_type == VIDEO_I_FRAME) - vidbuf_start[vidbuf_nbytes++] = get_byte(pb); + vidbuf_start[vidbuf_nbytes++] = avio_r8(pb); } else if(code){ // plain sequence - if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code) + if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code) goto fail; vidbuf_nbytes += code; } bytes_copied += code & 0x7F; if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied // may contain a 0 byte even if read all pixels - if(get_byte(pb)) + if(avio_r8(pb)) url_fseek(pb, -1, SEEK_CUR); break; } @@ -182,7 +182,7 @@ static int vid_read_packet(AVFormatContext *s, if(vid->is_finished || url_feof(pb)) return AVERROR(EIO); - block_type = get_byte(pb); + block_type = avio_r8(pb); switch(block_type){ case PALETTE_BLOCK: url_fseek(pb, -1, SEEK_CUR); // include block type @@ -195,12 +195,12 @@ static int vid_read_packet(AVFormatContext *s, return ret_value; case FIRST_AUDIO_BLOCK: - get_le16(pb); + avio_rl16(pb); // soundblaster DAC used for sample rate, as on specification page (link above) - s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb)); + s->streams[1]->codec->sample_rate = 1000000 / (256 - avio_r8(pb)); s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample; case AUDIO_BLOCK: - audio_length = get_le16(pb); + audio_length = avio_rl16(pb); ret_value = av_get_packet(pb, pkt, audio_length); pkt->stream_index = 1; return ret_value != audio_length ? AVERROR(EIO) : ret_value; diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 40724b336d..7313e7b337 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -66,24 +66,24 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) /* Set the total number of frames. */ url_fskip(pb, 8); - chunk_header = get_le32(pb); - bfi->nframes = get_le32(pb); - get_le32(pb); - get_le32(pb); - get_le32(pb); - fps = get_le32(pb); + chunk_header = avio_rl32(pb); + bfi->nframes = avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + fps = avio_rl32(pb); url_fskip(pb, 12); - vstream->codec->width = get_le32(pb); - vstream->codec->height = get_le32(pb); + vstream->codec->width = avio_rl32(pb); + vstream->codec->height = avio_rl32(pb); /*Load the palette to extradata */ url_fskip(pb, 8); vstream->codec->extradata = av_malloc(768); vstream->codec->extradata_size = 768; - get_buffer(pb, vstream->codec->extradata, + avio_read(pb, vstream->codec->extradata, vstream->codec->extradata_size); - astream->codec->sample_rate = get_le32(pb); + astream->codec->sample_rate = avio_rl32(pb); /* Set up the video codec... */ av_set_pts_info(vstream, 32, 1, fps); @@ -119,14 +119,14 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) while(state != MKTAG('S','A','V','I')){ if (url_feof(pb)) return AVERROR(EIO); - state = 256*state + get_byte(pb); + state = 256*state + avio_r8(pb); } /* Now that the chunk's location is confirmed, we proceed... */ - chunk_size = get_le32(pb); - get_le32(pb); - audio_offset = get_le32(pb); - get_le32(pb); - video_offset = get_le32(pb); + chunk_size = avio_rl32(pb); + avio_rl32(pb); + audio_offset = avio_rl32(pb); + avio_rl32(pb); + video_offset = avio_rl32(pb); audio_size = video_offset - audio_offset; bfi->video_size = chunk_size - video_offset; diff --git a/libavformat/bink.c b/libavformat/bink.c index f19229faf7..0087320ab5 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -82,17 +82,17 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) if (!vst) return AVERROR(ENOMEM); - vst->codec->codec_tag = get_le32(pb); + vst->codec->codec_tag = avio_rl32(pb); - bink->file_size = get_le32(pb) + 8; - vst->duration = get_le32(pb); + bink->file_size = avio_rl32(pb) + 8; + vst->duration = avio_rl32(pb); if (vst->duration > 1000000) { av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n"); return AVERROR(EIO); } - if (get_le32(pb) > bink->file_size) { + if (avio_rl32(pb) > bink->file_size) { av_log(s, AV_LOG_ERROR, "invalid header: largest frame size greater than file size\n"); return AVERROR(EIO); @@ -100,11 +100,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) url_fskip(pb, 4); - vst->codec->width = get_le32(pb); - vst->codec->height = get_le32(pb); + vst->codec->width = avio_rl32(pb); + vst->codec->height = avio_rl32(pb); - fps_num = get_le32(pb); - fps_den = get_le32(pb); + fps_num = avio_rl32(pb); + fps_den = avio_rl32(pb); if (fps_num == 0 || fps_den == 0) { av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den); return AVERROR(EIO); @@ -115,9 +115,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) vst->codec->codec_id = CODEC_ID_BINKVIDEO; vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); vst->codec->extradata_size = 4; - get_buffer(pb, vst->codec->extradata, 4); + avio_read(pb, vst->codec->extradata, 4); - bink->num_audio_tracks = get_le32(pb); + bink->num_audio_tracks = avio_rl32(pb); if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) { av_log(s, AV_LOG_ERROR, @@ -135,9 +135,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_tag = 0; - ast->codec->sample_rate = get_le16(pb); + ast->codec->sample_rate = avio_rl16(pb); av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); - flags = get_le16(pb); + flags = avio_rl16(pb); ast->codec->codec_id = flags & BINK_AUD_USEDCT ? CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT; ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1; @@ -147,14 +147,14 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) } /* frame index table */ - next_pos = get_le32(pb); + next_pos = avio_rl32(pb); for (i = 0; i < vst->duration; i++) { pos = next_pos; if (i == vst->duration - 1) { next_pos = bink->file_size; keyframe = 0; } else { - next_pos = get_le32(pb); + next_pos = avio_rl32(pb); keyframe = pos & 1; } pos &= ~1; @@ -201,7 +201,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } while (bink->current_track < bink->num_audio_tracks) { - uint32_t audio_size = get_le32(pb); + uint32_t audio_size = avio_rl32(pb); if (audio_size > bink->remain_packet_size - 4) { av_log(s, AV_LOG_ERROR, "frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n", diff --git a/libavformat/c93.c b/libavformat/c93.c index 2beaebc356..3e3cd9cb0f 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -66,9 +66,9 @@ static int read_header(AVFormatContext *s, int framecount = 0; for (i = 0; i < 512; i++) { - c93->block_records[i].index = get_le16(pb); - c93->block_records[i].length = get_byte(pb); - c93->block_records[i].frames = get_byte(pb); + c93->block_records[i].index = avio_rl16(pb); + c93->block_records[i].length = avio_r8(pb); + c93->block_records[i].frames = avio_r8(pb); if (c93->block_records[i].frames > 32) { av_log(s, AV_LOG_ERROR, "too many frames in block\n"); return AVERROR_INVALIDDATA; @@ -114,7 +114,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) if (c93->next_pkt_is_audio) { c93->current_frame++; c93->next_pkt_is_audio = 0; - datasize = get_le16(pb); + datasize = avio_rl16(pb); if (datasize > 42) { if (!c93->audio) { c93->audio = av_new_stream(s, 1); @@ -142,13 +142,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) if (c93->current_frame == 0) { url_fseek(pb, br->index * 2048, SEEK_SET); for (i = 0; i < 32; i++) { - c93->frame_offsets[i] = get_le32(pb); + c93->frame_offsets[i] = avio_rl32(pb); } } url_fseek(pb,br->index * 2048 + c93->frame_offsets[c93->current_frame], SEEK_SET); - datasize = get_le16(pb); /* video frame size */ + datasize = avio_rl16(pb); /* video frame size */ ret = av_new_packet(pkt, datasize + 768 + 1); if (ret < 0) @@ -156,13 +156,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[0] = 0; pkt->size = datasize + 1; - ret = get_buffer(pb, pkt->data + 1, datasize); + ret = avio_read(pb, pkt->data + 1, datasize); if (ret < datasize) { ret = AVERROR(EIO); goto fail; } - datasize = get_le16(pb); /* palette size */ + datasize = avio_rl16(pb); /* palette size */ if (datasize) { if (datasize != 768) { av_log(s, AV_LOG_ERROR, "invalid palette size %u\n", datasize); @@ -170,7 +170,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) goto fail; } pkt->data[0] |= C93_HAS_PALETTE; - ret = get_buffer(pb, pkt->data + pkt->size, datasize); + ret = avio_read(pb, pkt->data + pkt->size, datasize); if (ret < datasize) { ret = AVERROR(EIO); goto fail; diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 27e29a2ea8..86f1005fdc 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -65,14 +65,14 @@ static int read_desc_chunk(AVFormatContext *s) /* parse format description */ st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->sample_rate = av_int2dbl(get_be64(pb)); - st->codec->codec_tag = get_be32(pb); - flags = get_be32(pb); - caf->bytes_per_packet = get_be32(pb); + st->codec->sample_rate = av_int2dbl(avio_rb64(pb)); + st->codec->codec_tag = avio_rb32(pb); + flags = avio_rb32(pb); + caf->bytes_per_packet = avio_rb32(pb); st->codec->block_align = caf->bytes_per_packet; - caf->frames_per_packet = get_be32(pb); - st->codec->channels = get_be32(pb); - st->codec->bits_per_coded_sample = get_be32(pb); + caf->frames_per_packet = avio_rb32(pb); + st->codec->channels = avio_rb32(pb); + st->codec->bits_per_coded_sample = avio_rb32(pb); /* calculate bit rate for constant size packets */ if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) { @@ -127,14 +127,14 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) 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); + avio_read(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) return AVERROR(ENOMEM); - get_buffer(pb, st->codec->extradata, size); + avio_read(pb, st->codec->extradata, size); st->codec->extradata_size = size; } @@ -152,13 +152,13 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) ccount = url_ftell(pb); - num_packets = get_be64(pb); + num_packets = avio_rb64(pb); if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets) return AVERROR_INVALIDDATA; - st->nb_frames = get_be64(pb); /* valid frames */ - st->nb_frames += get_be32(pb); /* priming frames */ - st->nb_frames += get_be32(pb); /* remainder frames */ + st->nb_frames = avio_rb64(pb); /* valid frames */ + st->nb_frames += avio_rb32(pb); /* priming frames */ + st->nb_frames += avio_rb32(pb); /* remainder frames */ st->duration = 0; for (i = 0; i < num_packets; i++) { @@ -181,7 +181,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size) { AVIOContext *pb = s->pb; unsigned int i; - unsigned int nb_entries = get_be32(pb); + unsigned int nb_entries = avio_rb32(pb); for (i = 0; i < nb_entries; i++) { char key[32]; char value[1024]; @@ -204,11 +204,11 @@ static int read_header(AVFormatContext *s, url_fskip(pb, 8); /* magic, version, file flags */ /* audio description chunk */ - if (get_be32(pb) != MKBETAG('d','e','s','c')) { + if (avio_rb32(pb) != MKBETAG('d','e','s','c')) { av_log(s, AV_LOG_ERROR, "desc chunk not present\n"); return AVERROR_INVALIDDATA; } - size = get_be64(pb); + size = avio_rb64(pb); if (size != 32) return AVERROR_INVALIDDATA; @@ -226,8 +226,8 @@ static int read_header(AVFormatContext *s, if (found_data && (caf->data_size < 0 || url_is_streamed(pb))) break; - tag = get_be32(pb); - size = get_be64(pb); + tag = avio_rb32(pb); + size = avio_rb64(pb); if (url_feof(pb)) break; diff --git a/libavformat/daud.c b/libavformat/daud.c index b59fad98e0..c4931961ec 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -40,8 +40,8 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) { int ret, size; if (url_feof(pb)) return AVERROR(EIO); - size = get_be16(pb); - get_be16(pb); // unknown + size = avio_rb16(pb); + avio_rb16(pb); // unknown ret = av_get_packet(pb, pkt, size); pkt->stream_index = 0; return ret; diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index 17807fb6d0..328f901463 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -73,16 +73,16 @@ static int cin_probe(AVProbeData *p) static int cin_read_file_header(CinDemuxContext *cin, AVIOContext *pb) { CinFileHeader *hdr = &cin->file_header; - if (get_le32(pb) != 0x55AA0000) + if (avio_rl32(pb) != 0x55AA0000) return AVERROR_INVALIDDATA; - hdr->video_frame_size = get_le32(pb); - hdr->video_frame_width = get_le16(pb); - hdr->video_frame_height = get_le16(pb); - hdr->audio_frequency = get_le32(pb); - hdr->audio_bits = get_byte(pb); - hdr->audio_stereo = get_byte(pb); - hdr->audio_frame_size = get_le16(pb); + hdr->video_frame_size = avio_rl32(pb); + hdr->video_frame_width = avio_rl16(pb); + hdr->video_frame_height = avio_rl16(pb); + hdr->audio_frequency = avio_rl32(pb); + hdr->audio_bits = avio_r8(pb); + hdr->audio_stereo = avio_r8(pb); + hdr->audio_frame_size = avio_rl16(pb); if (hdr->audio_frequency != 22050 || hdr->audio_bits != 16 || hdr->audio_stereo != 0) return AVERROR_INVALIDDATA; @@ -141,16 +141,16 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) { CinFrameHeader *hdr = &cin->frame_header; - hdr->video_frame_type = get_byte(pb); - hdr->audio_frame_type = get_byte(pb); - hdr->pal_colors_count = get_le16(pb); - hdr->video_frame_size = get_le32(pb); - hdr->audio_frame_size = get_le32(pb); + hdr->video_frame_type = avio_r8(pb); + hdr->audio_frame_type = avio_r8(pb); + hdr->pal_colors_count = avio_rl16(pb); + hdr->video_frame_size = avio_rl32(pb); + hdr->audio_frame_size = avio_rl32(pb); if (url_feof(pb) || url_ferror(pb)) return AVERROR(EIO); - if (get_le32(pb) != 0xAA55AA55) + if (avio_rl32(pb) != 0xAA55AA55) return AVERROR_INVALIDDATA; return 0; @@ -191,7 +191,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[2] = hdr->pal_colors_count >> 8; pkt->data[3] = hdr->video_frame_type; - ret = get_buffer(pb, &pkt->data[4], pkt_size); + ret = avio_read(pb, &pkt->data[4], pkt_size); if (ret < 0) { av_free_packet(pkt); return ret; diff --git a/libavformat/dv.c b/libavformat/dv.c index 1f05eb2d44..0598607ff4 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -410,7 +410,7 @@ static int dv_read_header(AVFormatContext *s, if (!c->dv_demux) return -1; - state = get_be32(s->pb); + state = avio_rb32(s->pb); while ((state & 0xffffff7f) != 0x1f07003f) { if (url_feof(s->pb)) { av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n"); @@ -420,14 +420,14 @@ static int dv_read_header(AVFormatContext *s, marker_pos = url_ftell(s->pb); if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) { url_fseek(s->pb, -163, SEEK_CUR); - state = get_be32(s->pb); + state = avio_rb32(s->pb); break; } - state = (state << 8) | get_byte(s->pb); + state = (state << 8) | avio_r8(s->pb); } AV_WB32(c->buf, state); - if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 || + if (avio_read(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 || url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) return AVERROR(EIO); @@ -455,7 +455,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) if (!c->dv_demux->sys) return AVERROR(EIO); size = c->dv_demux->sys->frame_size; - if (get_buffer(s->pb, c->buf, size) <= 0) + if (avio_read(s->pb, c->buf, size) <= 0) return AVERROR(EIO); size = dv_produce_packet(c->dv_demux, pkt, c->buf, size); diff --git a/libavformat/dxa.c b/libavformat/dxa.c index a10ece8c8b..188fc29d63 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -61,17 +61,17 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) int num, den; int flags; - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('D', 'E', 'X', 'A')) return -1; - flags = get_byte(pb); - c->frames = get_be16(pb); + flags = avio_r8(pb); + c->frames = avio_rb16(pb); if(!c->frames){ av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); return -1; } - fps = get_be32(pb); + fps = avio_rb32(pb); if(fps > 0){ den = 1000; num = fps; @@ -82,8 +82,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) den = 10; num = 1; } - w = get_be16(pb); - h = get_be16(pb); + w = avio_rb16(pb); + h = avio_rb16(pb); c->has_sound = 0; st = av_new_stream(s, 0); @@ -91,13 +91,13 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; // Parse WAV data header - if(get_le32(pb) == MKTAG('W', 'A', 'V', 'E')){ + if(avio_rl32(pb) == MKTAG('W', 'A', 'V', 'E')){ uint32_t size, fsize; c->has_sound = 1; - size = get_be32(pb); + size = avio_rb32(pb); c->vidpos = url_ftell(pb) + size; url_fskip(pb, 16); - fsize = get_le32(pb); + fsize = avio_rl32(pb); ast = av_new_stream(s, 0); if (!ast) @@ -105,8 +105,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) ff_get_wav_header(pb, ast->codec, fsize); // find 'data' chunk while(url_ftell(pb) < c->vidpos && !url_feof(pb)){ - tag = get_le32(pb); - fsize = get_le32(pb); + tag = avio_rl32(pb); + fsize = avio_rl32(pb); if(tag == MKTAG('d', 'a', 't', 'a')) break; url_fskip(pb, fsize); } @@ -163,7 +163,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) } url_fseek(s->pb, c->vidpos, SEEK_SET); while(!url_feof(s->pb) && c->frames){ - get_buffer(s->pb, buf, 4); + avio_read(s->pb, buf, 4); switch(AV_RL32(buf)){ case MKTAG('N', 'U', 'L', 'L'): if(av_new_packet(pkt, 4 + pal_size) < 0) @@ -178,10 +178,10 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) case MKTAG('C', 'M', 'A', 'P'): pal_size = 768+4; memcpy(pal, buf, 4); - get_buffer(s->pb, pal + 4, 768); + avio_read(s->pb, pal + 4, 768); break; case MKTAG('F', 'R', 'A', 'M'): - get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4); + avio_read(s->pb, buf + 4, DXA_EXTRA_SIZE - 4); size = AV_RB32(buf + 5); if(size > 0xFFFFFF){ av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size); @@ -190,7 +190,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0) return AVERROR(ENOMEM); memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE); - ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size); + ret = avio_read(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size); if(ret != size){ av_free_packet(pkt); return AVERROR(EIO); diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c index 93ccf8acb2..6f3564e397 100644 --- a/libavformat/eacdata.c +++ b/libavformat/eacdata.c @@ -51,7 +51,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) unsigned int sample_rate, header; AVStream *st; - header = get_be16(pb); + header = avio_rb16(pb); switch (header) { case 0x0400: cdata->channels = 1; break; case 0x0404: cdata->channels = 2; break; @@ -61,7 +61,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; }; - sample_rate = get_be16(pb); + sample_rate = avio_rb16(pb); url_fskip(pb, 12); st = av_new_stream(s, 0); diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 0f4843d4e9..6179d22e60 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -82,11 +82,11 @@ static uint32_t read_arbitary(AVIOContext *pb) { int i; uint32_t word; - size = get_byte(pb); + size = avio_r8(pb); word = 0; for (i = 0; i < size; i++) { - byte = get_byte(pb); + byte = avio_r8(pb); word <<= 8; word |= byte; } @@ -112,7 +112,7 @@ static int process_audio_header_elements(AVFormatContext *s) while (!url_feof(pb) && inHeader) { int inSubheader; uint8_t byte; - byte = get_byte(pb); + byte = avio_r8(pb); switch (byte) { case 0xFD: @@ -120,7 +120,7 @@ static int process_audio_header_elements(AVFormatContext *s) inSubheader = 1; while (!url_feof(pb) && inSubheader) { uint8_t subbyte; - subbyte = get_byte(pb); + subbyte = avio_r8(pb); switch (subbyte) { case 0x80: @@ -218,10 +218,10 @@ static int process_audio_header_eacs(AVFormatContext *s) AVIOContext *pb = s->pb; int compression_type; - ea->sample_rate = ea->big_endian ? get_be32(pb) : get_le32(pb); - ea->bytes = get_byte(pb); /* 1=8-bit, 2=16-bit */ - ea->num_channels = get_byte(pb); - compression_type = get_byte(pb); + ea->sample_rate = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb); + ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */ + ea->num_channels = avio_r8(pb); + compression_type = avio_r8(pb); url_fskip(pb, 13); switch (compression_type) { @@ -249,9 +249,9 @@ static int process_audio_header_sead(AVFormatContext *s) EaDemuxContext *ea = s->priv_data; AVIOContext *pb = s->pb; - ea->sample_rate = get_le32(pb); - ea->bytes = get_le32(pb); /* 1=8-bit, 2=16-bit */ - ea->num_channels = get_le32(pb); + ea->sample_rate = avio_rl32(pb); + ea->bytes = avio_rl32(pb); /* 1=8-bit, 2=16-bit */ + ea->num_channels = avio_rl32(pb); ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_SEAD; return 1; @@ -262,8 +262,8 @@ static int process_video_header_mdec(AVFormatContext *s) EaDemuxContext *ea = s->priv_data; AVIOContext *pb = s->pb; url_fskip(pb, 4); - ea->width = get_le16(pb); - ea->height = get_le16(pb); + ea->width = avio_rl16(pb); + ea->height = avio_rl16(pb); ea->time_base = (AVRational){1,15}; ea->video_codec = CODEC_ID_MDEC; return 1; @@ -275,8 +275,8 @@ static int process_video_header_vp6(AVFormatContext *s) AVIOContext *pb = s->pb; url_fskip(pb, 16); - ea->time_base.den = get_le32(pb); - ea->time_base.num = get_le32(pb); + ea->time_base.den = avio_rl32(pb); + ea->time_base.num = avio_rl32(pb); ea->video_codec = CODEC_ID_VP6; return 1; @@ -296,8 +296,8 @@ static int process_ea_header(AVFormatContext *s) { unsigned int startpos = url_ftell(pb); int err = 0; - blockid = get_le32(pb); - size = get_le32(pb); + blockid = avio_rl32(pb); + size = avio_rl32(pb); if (i == 0) ea->big_endian = size > 0x000FFFFF; if (ea->big_endian) @@ -305,7 +305,7 @@ static int process_ea_header(AVFormatContext *s) { switch (blockid) { case ISNh_TAG: - if (get_le32(pb) != EACS_TAG) { + if (avio_rl32(pb) != EACS_TAG) { av_log (s, AV_LOG_ERROR, "unknown 1SNh headerid\n"); return 0; } @@ -314,7 +314,7 @@ static int process_ea_header(AVFormatContext *s) { case SCHl_TAG : case SHEN_TAG : - blockid = get_le32(pb); + blockid = avio_rl32(pb); if (blockid == GSTR_TAG) { url_fskip(pb, 4); } else if ((blockid & 0xFFFF)!=PT00_TAG) { @@ -467,8 +467,8 @@ static int ea_read_packet(AVFormatContext *s, int av_uninit(num_samples); while (!packet_read) { - chunk_type = get_le32(pb); - chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8; + chunk_type = avio_rl32(pb); + chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)) - 8; switch (chunk_type) { /* audio data */ @@ -485,7 +485,7 @@ static int ea_read_packet(AVFormatContext *s, break; } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || ea->audio_codec == CODEC_ID_MP3) { - num_samples = get_le32(pb); + num_samples = avio_rl32(pb); url_fskip(pb, 8); chunk_size -= 12; } diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 771209056b..1ae1422ea2 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -95,7 +95,7 @@ static int ffm_resync(AVFormatContext *s, int state) av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n"); return -1; } - state = (state << 8) | get_byte(s->pb); + state = (state << 8) | avio_r8(s->pb); } return 0; } @@ -120,14 +120,14 @@ static int ffm_read_data(AVFormatContext *s, if (url_ftell(pb) == ffm->file_size) url_fseek(pb, ffm->packet_size, SEEK_SET); retry_read: - id = get_be16(pb); /* PACKET_ID */ + id = avio_rb16(pb); /* PACKET_ID */ if (id != PACKET_ID) if (ffm_resync(s, id) < 0) return -1; - fill_size = get_be16(pb); - ffm->dts = get_be64(pb); - frame_offset = get_be16(pb); - get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE); + fill_size = avio_rb16(pb); + ffm->dts = avio_rb64(pb); + frame_offset = avio_rb16(pb); + avio_read(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE); ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size); if (ffm->packet_end < ffm->packet || frame_offset < 0) return -1; @@ -188,7 +188,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) ffm_seek1(s, pos); url_fskip(pb, 4); - dts = get_be64(pb); + dts = avio_rb64(pb); #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0); #endif @@ -273,13 +273,13 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) uint32_t tag; /* header */ - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('F', 'F', 'M', '1')) goto fail; - ffm->packet_size = get_be32(pb); + ffm->packet_size = avio_rb32(pb); if (ffm->packet_size != FFM_PACKET_SIZE) goto fail; - ffm->write_index = get_be64(pb); + ffm->write_index = avio_rb64(pb); /* get also filesize */ if (!url_is_streamed(pb)) { ffm->file_size = url_fsize(pb); @@ -289,8 +289,8 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ffm->file_size = (UINT64_C(1) << 63) - 1; } - nb_streams = get_be32(pb); - get_be32(pb); /* total bitrate */ + nb_streams = avio_rb32(pb); + avio_rb32(pb); /* total bitrate */ /* read each stream */ for(i=0;icodec; /* generic info */ - codec->codec_id = get_be32(pb); - codec->codec_type = get_byte(pb); /* codec_type */ - codec->bit_rate = get_be32(pb); - st->quality = get_be32(pb); - codec->flags = get_be32(pb); - codec->flags2 = get_be32(pb); - codec->debug = get_be32(pb); + codec->codec_id = avio_rb32(pb); + codec->codec_type = avio_r8(pb); /* codec_type */ + codec->bit_rate = avio_rb32(pb); + st->quality = avio_rb32(pb); + codec->flags = avio_rb32(pb); + codec->flags2 = avio_rb32(pb); + codec->debug = avio_rb32(pb); /* specific info */ switch(codec->codec_type) { case AVMEDIA_TYPE_VIDEO: - codec->time_base.num = get_be32(pb); - codec->time_base.den = get_be32(pb); - codec->width = get_be16(pb); - codec->height = get_be16(pb); - codec->gop_size = get_be16(pb); - codec->pix_fmt = get_be32(pb); - codec->qmin = get_byte(pb); - codec->qmax = get_byte(pb); - codec->max_qdiff = get_byte(pb); - codec->qcompress = get_be16(pb) / 10000.0; - codec->qblur = get_be16(pb) / 10000.0; - codec->bit_rate_tolerance = get_be32(pb); + codec->time_base.num = avio_rb32(pb); + codec->time_base.den = avio_rb32(pb); + codec->width = avio_rb16(pb); + codec->height = avio_rb16(pb); + codec->gop_size = avio_rb16(pb); + codec->pix_fmt = avio_rb32(pb); + codec->qmin = avio_r8(pb); + codec->qmax = avio_r8(pb); + codec->max_qdiff = avio_r8(pb); + codec->qcompress = avio_rb16(pb) / 10000.0; + codec->qblur = avio_rb16(pb) / 10000.0; + codec->bit_rate_tolerance = avio_rb32(pb); codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf))); - codec->rc_max_rate = get_be32(pb); - codec->rc_min_rate = get_be32(pb); - codec->rc_buffer_size = get_be32(pb); - codec->i_quant_factor = av_int2dbl(get_be64(pb)); - codec->b_quant_factor = av_int2dbl(get_be64(pb)); - codec->i_quant_offset = av_int2dbl(get_be64(pb)); - codec->b_quant_offset = av_int2dbl(get_be64(pb)); - codec->dct_algo = get_be32(pb); - codec->strict_std_compliance = get_be32(pb); - codec->max_b_frames = get_be32(pb); - codec->luma_elim_threshold = get_be32(pb); - codec->chroma_elim_threshold = get_be32(pb); - codec->mpeg_quant = get_be32(pb); - codec->intra_dc_precision = get_be32(pb); - codec->me_method = get_be32(pb); - codec->mb_decision = get_be32(pb); - codec->nsse_weight = get_be32(pb); - codec->frame_skip_cmp = get_be32(pb); - codec->rc_buffer_aggressivity = av_int2dbl(get_be64(pb)); - codec->codec_tag = get_be32(pb); - codec->thread_count = get_byte(pb); - codec->coder_type = get_be32(pb); - codec->me_cmp = get_be32(pb); - codec->partitions = get_be32(pb); - codec->me_subpel_quality = get_be32(pb); - codec->me_range = get_be32(pb); - codec->keyint_min = get_be32(pb); - codec->scenechange_threshold = get_be32(pb); - codec->b_frame_strategy = get_be32(pb); - codec->qcompress = av_int2dbl(get_be64(pb)); - codec->qblur = av_int2dbl(get_be64(pb)); - codec->max_qdiff = get_be32(pb); - codec->refs = get_be32(pb); - codec->directpred = get_be32(pb); + codec->rc_max_rate = avio_rb32(pb); + codec->rc_min_rate = avio_rb32(pb); + codec->rc_buffer_size = avio_rb32(pb); + codec->i_quant_factor = av_int2dbl(avio_rb64(pb)); + codec->b_quant_factor = av_int2dbl(avio_rb64(pb)); + codec->i_quant_offset = av_int2dbl(avio_rb64(pb)); + codec->b_quant_offset = av_int2dbl(avio_rb64(pb)); + codec->dct_algo = avio_rb32(pb); + codec->strict_std_compliance = avio_rb32(pb); + codec->max_b_frames = avio_rb32(pb); + codec->luma_elim_threshold = avio_rb32(pb); + codec->chroma_elim_threshold = avio_rb32(pb); + codec->mpeg_quant = avio_rb32(pb); + codec->intra_dc_precision = avio_rb32(pb); + codec->me_method = avio_rb32(pb); + codec->mb_decision = avio_rb32(pb); + codec->nsse_weight = avio_rb32(pb); + codec->frame_skip_cmp = avio_rb32(pb); + codec->rc_buffer_aggressivity = av_int2dbl(avio_rb64(pb)); + codec->codec_tag = avio_rb32(pb); + codec->thread_count = avio_r8(pb); + codec->coder_type = avio_rb32(pb); + codec->me_cmp = avio_rb32(pb); + codec->partitions = avio_rb32(pb); + codec->me_subpel_quality = avio_rb32(pb); + codec->me_range = avio_rb32(pb); + codec->keyint_min = avio_rb32(pb); + codec->scenechange_threshold = avio_rb32(pb); + codec->b_frame_strategy = avio_rb32(pb); + codec->qcompress = av_int2dbl(avio_rb64(pb)); + codec->qblur = av_int2dbl(avio_rb64(pb)); + codec->max_qdiff = avio_rb32(pb); + codec->refs = avio_rb32(pb); + codec->directpred = avio_rb32(pb); break; case AVMEDIA_TYPE_AUDIO: - codec->sample_rate = get_be32(pb); - codec->channels = get_le16(pb); - codec->frame_size = get_le16(pb); - codec->sample_fmt = (int16_t) get_le16(pb); + codec->sample_rate = avio_rb32(pb); + codec->channels = avio_rl16(pb); + codec->frame_size = avio_rl16(pb); + codec->sample_fmt = (int16_t) avio_rl16(pb); break; default: goto fail; } if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) { - codec->extradata_size = get_be32(pb); + codec->extradata_size = avio_rb32(pb); codec->extradata = av_malloc(codec->extradata_size); if (!codec->extradata) return AVERROR(ENOMEM); - get_buffer(pb, codec->extradata, codec->extradata_size); + avio_read(pb, codec->extradata, codec->extradata_size); } } /* get until end of block reached */ while ((url_ftell(pb) % ffm->packet_size) != 0) - get_byte(pb); + avio_r8(pb); /* init packet demux */ ffm->packet_ptr = ffm->packet; diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c index a7ae72f632..cc7e1da48f 100644 --- a/libavformat/ffmetadec.c +++ b/libavformat/ffmetadec.c @@ -36,11 +36,11 @@ static void get_line(AVIOContext *s, uint8_t *buf, int size) uint8_t c; int i = 0; - while ((c = get_byte(s))) { + while ((c = avio_r8(s))) { if (c == '\\') { if (i < size - 1) buf[i++] = c; - c = get_byte(s); + c = avio_r8(s); } else if (c == '\n') break; diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 262bb23390..87219c83ff 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -44,7 +44,7 @@ static int read_header(AVFormatContext *s, return AVERROR(EIO); url_fseek(pb, url_fsize(pb) - 36, SEEK_SET); - if (get_be32(pb) != RAND_TAG) { + if (avio_rb32(pb) != RAND_TAG) { av_log(s, AV_LOG_ERROR, "magic number not found"); return AVERROR_INVALIDDATA; } @@ -53,8 +53,8 @@ static int read_header(AVFormatContext *s, if (!st) return AVERROR(ENOMEM); - st->nb_frames = get_be32(pb); - if (get_be16(pb) != 0) { + st->nb_frames = avio_rb32(pb); + if (avio_rb16(pb) != 0) { av_log_ask_for_sample(s, "unsupported packing method\n"); return AVERROR_INVALIDDATA; } @@ -64,10 +64,10 @@ static int read_header(AVFormatContext *s, st->codec->codec_id = CODEC_ID_RAWVIDEO; st->codec->pix_fmt = PIX_FMT_RGBA; st->codec->codec_tag = 0; /* no fourcc */ - st->codec->width = get_be16(pb); - st->codec->height = get_be16(pb); - film->leading = get_be16(pb); - av_set_pts_info(st, 64, 1, get_be16(pb)); + st->codec->width = avio_rb16(pb); + st->codec->height = avio_rb16(pb); + film->leading = avio_rb16(pb); + av_set_pts_info(st, 64, 1, avio_rb16(pb)); url_fseek(pb, 0, SEEK_SET); diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index f971d0997c..bed9863f9a 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -40,14 +40,14 @@ static int flac_read_header(AVFormatContext *s, /* the parameters will be extracted from the compressed bitstream */ /* if fLaC marker is not found, assume there is no header */ - if (get_le32(s->pb) != MKTAG('f','L','a','C')) { + if (avio_rl32(s->pb) != MKTAG('f','L','a','C')) { url_fseek(s->pb, -4, SEEK_CUR); return 0; } /* process metadata blocks */ while (!url_feof(s->pb) && !metadata_last) { - get_buffer(s->pb, header, 4); + avio_read(s->pb, header, 4); ff_flac_parse_block_header(header, &metadata_last, &metadata_type, &metadata_size); switch (metadata_type) { @@ -58,7 +58,7 @@ static int flac_read_header(AVFormatContext *s, if (!buffer) { return AVERROR(ENOMEM); } - if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) { + if (avio_read(s->pb, buffer, metadata_size) != metadata_size) { av_freep(&buffer); return AVERROR(EIO); } diff --git a/libavformat/flic.c b/libavformat/flic.c index fca395b595..2f6e218357 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -96,7 +96,7 @@ static int flic_read_header(AVFormatContext *s, flic->frame_number = 0; /* load the whole header and pull out the width and height */ - if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) + if (avio_read(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) return AVERROR(EIO); magic_number = AV_RL16(&header[4]); @@ -130,7 +130,7 @@ static int flic_read_header(AVFormatContext *s, memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE); /* peek at the preamble to detect TFTD videos - they seem to always start with an audio chunk */ - if (get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) { + if (avio_read(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) { av_log(s, AV_LOG_ERROR, "Failed to peek at preamble\n"); return AVERROR(EIO); } @@ -207,7 +207,7 @@ static int flic_read_packet(AVFormatContext *s, while (!packet_read) { - if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) != + if ((ret = avio_read(pb, preamble, FLIC_PREAMBLE_SIZE)) != FLIC_PREAMBLE_SIZE) { ret = AVERROR(EIO); break; @@ -225,7 +225,7 @@ static int flic_read_packet(AVFormatContext *s, pkt->pts = flic->frame_number++; pkt->pos = url_ftell(pb); memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE); - ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE, + ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE, size - FLIC_PREAMBLE_SIZE); if (ret != size - FLIC_PREAMBLE_SIZE) { av_free_packet(pkt); @@ -243,7 +243,7 @@ static int flic_read_packet(AVFormatContext *s, pkt->stream_index = flic->audio_stream_index; pkt->pos = url_ftell(pb); - ret = get_buffer(pb, pkt->data, size); + ret = avio_read(pb, pkt->data, size); if (ret != size) { av_free_packet(pkt); diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index ce743b1bcf..e42598d98e 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -97,7 +97,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co vcodec->extradata_size = 1; vcodec->extradata = av_malloc(1); } - vcodec->extradata[0] = get_byte(s->pb); + vcodec->extradata[0] = avio_r8(s->pb); return 1; // 1 byte body size adjustment for flv_read_packet() case FLV_CODECID_H264: vcodec->codec_id = CODEC_ID_H264; @@ -111,13 +111,13 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co } static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) { - int length = get_be16(ioc); + int length = avio_rb16(ioc); if(length >= buffsize) { url_fskip(ioc, length); return -1; } - get_buffer(ioc, buffer, length); + avio_read(ioc, buffer, length); buffer[length] = '\0'; @@ -134,13 +134,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst num_val = 0; ioc = s->pb; - amf_type = get_byte(ioc); + amf_type = avio_r8(ioc); switch(amf_type) { case AMF_DATA_TYPE_NUMBER: - num_val = av_int2dbl(get_be64(ioc)); break; + num_val = av_int2dbl(avio_rb64(ioc)); break; case AMF_DATA_TYPE_BOOL: - num_val = get_byte(ioc); break; + num_val = avio_r8(ioc); break; case AMF_DATA_TYPE_STRING: if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0) return -1; @@ -148,12 +148,12 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst case AMF_DATA_TYPE_OBJECT: { unsigned int keylen; - while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) { + while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) { url_fskip(ioc, keylen); //skip key string if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; //if we couldn't skip, bomb out. } - if(get_byte(ioc) != AMF_END_OF_OBJECT) + if(avio_r8(ioc) != AMF_END_OF_OBJECT) return -1; } break; @@ -168,13 +168,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) return -1; } - if(get_byte(ioc) != AMF_END_OF_OBJECT) + if(avio_r8(ioc) != AMF_END_OF_OBJECT) return -1; break; case AMF_DATA_TYPE_ARRAY: { unsigned int arraylen, i; - arraylen = get_be32(ioc); + arraylen = avio_rb32(ioc); for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) { if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; //if we couldn't skip, bomb out. @@ -222,7 +222,7 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { ioc = s->pb; //first object needs to be "onMetaData" string - type = get_byte(ioc); + type = avio_r8(ioc); if(type != AMF_DATA_TYPE_STRING || amf_get_string(ioc, buffer, sizeof(buffer)) < 0 || strcmp(buffer, "onMetaData")) return -1; @@ -255,7 +255,7 @@ static int flv_read_header(AVFormatContext *s, int offset, flags; url_fskip(s->pb, 4); - flags = get_byte(s->pb); + flags = avio_r8(s->pb); /* old flvtool cleared this field */ /* FIXME: better fix needed */ if (!flags) { @@ -276,7 +276,7 @@ static int flv_read_header(AVFormatContext *s, return AVERROR(ENOMEM); } - offset = get_be32(s->pb); + offset = avio_rb32(s->pb); url_fseek(s->pb, offset, SEEK_SET); url_fskip(s->pb, 4); @@ -292,7 +292,7 @@ static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size) if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = size; - get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size); + avio_read(s->pb, st->codec->extradata, st->codec->extradata_size); return 0; } @@ -306,10 +306,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ pos = url_ftell(s->pb); - type = get_byte(s->pb); - size = get_be24(s->pb); - dts = get_be24(s->pb); - dts |= get_byte(s->pb) << 24; + type = avio_r8(s->pb); + size = avio_rb24(s->pb); + dts = avio_rb24(s->pb); + dts |= avio_r8(s->pb) << 24; // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts); if (url_feof(s->pb)) return AVERROR_EOF; @@ -323,11 +323,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) if (type == FLV_TAG_TYPE_AUDIO) { is_audio=1; - flags = get_byte(s->pb); + flags = avio_r8(s->pb); size--; } else if (type == FLV_TAG_TYPE_VIDEO) { is_audio=0; - flags = get_byte(s->pb); + flags = avio_r8(s->pb); size--; if ((flags & 0xf0) == 0x50) /* video info / command frame */ goto skip; @@ -375,11 +375,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) const int64_t pos= url_ftell(s->pb); const int64_t fsize= url_fsize(s->pb); url_fseek(s->pb, fsize-4, SEEK_SET); - size= get_be32(s->pb); + size= avio_rb32(s->pb); url_fseek(s->pb, fsize-3-size, SEEK_SET); - if(size == get_be24(s->pb) + 11){ - uint32_t ts = get_be24(s->pb); - ts |= get_byte(s->pb) << 24; + if(size == avio_rb24(s->pb) + 11){ + uint32_t ts = avio_rb24(s->pb); + ts |= avio_r8(s->pb) << 24; s->duration = ts * (int64_t)AV_TIME_BASE / 1000; } url_fseek(s->pb, pos, SEEK_SET); @@ -400,10 +400,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) if (st->codec->codec_id == CODEC_ID_AAC || st->codec->codec_id == CODEC_ID_H264) { - int type = get_byte(s->pb); + int type = avio_r8(s->pb); size--; if (st->codec->codec_id == CODEC_ID_H264) { - int32_t cts = (get_be24(s->pb)+0xff800000)^0xff800000; // sign extension + int32_t cts = (avio_rb24(s->pb)+0xff800000)^0xff800000; // sign extension pts = dts + cts; if (cts < 0) { // dts are wrong flv->wrong_dts = 1; diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 3859630100..5b8b33c5f2 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -39,20 +39,20 @@ struct gxf_stream_info { * \return 0 if header not found or contains invalid data, 1 otherwise */ static int parse_packet_header(AVIOContext *pb, GXFPktType *type, int *length) { - if (get_be32(pb)) + if (avio_rb32(pb)) return 0; - if (get_byte(pb) != 1) + if (avio_r8(pb) != 1) return 0; - *type = get_byte(pb); - *length = get_be32(pb); + *type = avio_r8(pb); + *length = avio_rb32(pb); if ((*length >> 24) || *length < 16) return 0; *length -= 16; - if (get_be32(pb)) + if (avio_rb32(pb)) return 0; - if (get_byte(pb) != 0xe1) + if (avio_r8(pb) != 0xe1) return 0; - if (get_byte(pb) != 0xe2) + if (avio_r8(pb) != 0xe2) return 0; return 1; } @@ -161,14 +161,14 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info si->first_field = AV_NOPTS_VALUE; si->last_field = AV_NOPTS_VALUE; while (*len >= 2) { - GXFMatTag tag = get_byte(pb); - int tlen = get_byte(pb); + GXFMatTag tag = avio_r8(pb); + int tlen = avio_r8(pb); *len -= 2; if (tlen > *len) return; *len -= tlen; if (tlen == 4) { - uint32_t value = get_be32(pb); + uint32_t value = avio_rb32(pb); if (tag == MAT_FIRST_FIELD) si->first_field = value; else if (tag == MAT_LAST_FIELD) @@ -210,14 +210,14 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si si->frames_per_second = (AVRational){0, 0}; si->fields_per_frame = 0; while (*len >= 2) { - GXFTrackTag tag = get_byte(pb); - int tlen = get_byte(pb); + GXFTrackTag tag = avio_r8(pb); + int tlen = avio_r8(pb); *len -= 2; if (tlen > *len) return; *len -= tlen; if (tlen == 4) { - uint32_t value = get_be32(pb); + uint32_t value = avio_rb32(pb); if (tag == TRACK_FPS) si->frames_per_second = fps_tag2avr(value); else if (tag == TRACK_FPF && (value == 1 || value == 2)) @@ -233,8 +233,8 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si static void gxf_read_index(AVFormatContext *s, int pkt_len) { AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; - uint32_t fields_per_map = get_le32(pb); - uint32_t map_cnt = get_le32(pb); + uint32_t fields_per_map = avio_rl32(pb); + uint32_t map_cnt = avio_rl32(pb); int i; pkt_len -= 8; if (s->flags & AVFMT_FLAG_IGNIDX) { @@ -253,7 +253,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { pkt_len -= 4 * map_cnt; av_add_index_entry(st, 0, 0, 0, 0, 0); for (i = 0; i < map_cnt; i++) - av_add_index_entry(st, (uint64_t)get_le32(pb) * 1024, + av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024, i * (uint64_t)fields_per_map + 1, 0, 0, 0); url_fskip(pb, pkt_len); } @@ -271,12 +271,12 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { return 0; } map_len -= 2; - if (get_byte(pb) != 0x0e0 || get_byte(pb) != 0xff) { + if (avio_r8(pb) != 0x0e0 || avio_r8(pb) != 0xff) { av_log(s, AV_LOG_ERROR, "unknown version or invalid map preamble\n"); return 0; } map_len -= 2; - len = get_be16(pb); // length of material data section + len = avio_rb16(pb); // length of material data section if (len > map_len) { av_log(s, AV_LOG_ERROR, "material data longer than map data\n"); return 0; @@ -285,7 +285,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { gxf_material_tags(pb, &len, &si); url_fskip(pb, len); map_len -= 2; - len = get_be16(pb); // length of track description + len = avio_rb16(pb); // length of track description if (len > map_len) { av_log(s, AV_LOG_ERROR, "track description longer than map data\n"); return 0; @@ -296,9 +296,9 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; int idx; len -= 4; - track_type = get_byte(pb); - track_id = get_byte(pb); - track_len = get_be16(pb); + track_type = avio_r8(pb); + track_id = avio_r8(pb); + track_len = avio_rb16(pb); len -= track_len; gxf_track_tags(pb, &track_len, &si); url_fskip(pb, track_len); @@ -344,7 +344,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { len -= 0x39; url_fskip(pb, 5); // preamble url_fskip(pb, 0x30); // payload description - fps = fps_umf2avr(get_le32(pb)); + fps = fps_umf2avr(avio_rl32(pb)); if (!main_timebase.num || !main_timebase.den) { // this may not always be correct, but simply the best we can get main_timebase.num = fps.den; @@ -370,7 +370,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { { \ if (!max_interval-- || url_feof(pb)) \ goto out; \ - tmp = tmp << 8 | get_byte(pb); \ + tmp = tmp << 8 | avio_r8(pb); \ } /** @@ -389,7 +389,7 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t int len; AVIOContext *pb = s->pb; GXFPktType type; - tmp = get_be32(pb); + tmp = avio_rb32(pb); start: while (tmp) READ_ONE(); @@ -404,9 +404,9 @@ start: goto out; goto start; } - get_byte(pb); - cur_track = get_byte(pb); - cur_timestamp = get_be32(pb); + avio_r8(pb); + cur_track = avio_r8(pb); + cur_timestamp = avio_rb32(pb); last_found_pos = url_ftell(pb) - 16 - 6; if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) { if (url_fseek(pb, last_pos, SEEK_SET) >= 0) @@ -445,17 +445,17 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { continue; } pkt_len -= 16; - track_type = get_byte(pb); - track_id = get_byte(pb); + track_type = avio_r8(pb); + track_id = avio_r8(pb); stream_index = get_sindex(s, track_id, track_type); if (stream_index < 0) return stream_index; st = s->streams[stream_index]; - field_nr = get_be32(pb); - field_info = get_be32(pb); - get_be32(pb); // "timeline" field number - get_byte(pb); // flags - get_byte(pb); // reserved + field_nr = avio_rb32(pb); + field_info = avio_rb32(pb); + avio_rb32(pb); // "timeline" field number + avio_r8(pb); // flags + avio_r8(pb); // reserved if (st->codec->codec_id == CODEC_ID_PCM_S24LE || st->codec->codec_id == CODEC_ID_PCM_S16LE) { int first = field_info >> 16; diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c index 481db9735e..35199d89f8 100644 --- a/libavformat/id3v1.c +++ b/libavformat/id3v1.c @@ -233,7 +233,7 @@ void ff_id3v1_read(AVFormatContext *s) filesize = url_fsize(s->pb); if (filesize > 128) { url_fseek(s->pb, filesize - 128, SEEK_SET); - ret = get_buffer(s->pb, buf, ID3v1_TAG_SIZE); + ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE); if (ret == ID3v1_TAG_SIZE) { parse_tag(s, buf); } diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index f886b68288..a3e51407e9 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -55,7 +55,7 @@ static unsigned int get_size(AVIOContext *s, int len) { int v = 0; while (len--) - v = (v << 7) + (get_byte(s) & 0x7F); + v = (v << 7) + (avio_r8(s) & 0x7F); return v; } @@ -65,7 +65,7 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha const char *val = NULL; int len, dstlen = sizeof(dst) - 1; unsigned genre; - unsigned int (*get)(AVIOContext*) = get_be16; + unsigned int (*get)(AVIOContext*) = avio_rb16; dst[0] = 0; if (taglen < 1) @@ -73,22 +73,22 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha taglen--; /* account for encoding type byte */ - switch (get_byte(pb)) { /* encoding type */ + switch (avio_r8(pb)) { /* encoding type */ case ID3v2_ENCODING_ISO8859: q = dst; while (taglen-- && q - dst < dstlen - 7) { uint8_t tmp; - PUT_UTF8(get_byte(pb), tmp, *q++ = tmp;) + PUT_UTF8(avio_r8(pb), tmp, *q++ = tmp;) } *q = 0; break; case ID3v2_ENCODING_UTF16BOM: taglen -= 2; - switch (get_be16(pb)) { + switch (avio_rb16(pb)) { case 0xfffe: - get = get_le16; + get = avio_rl16; case 0xfeff: break; default: @@ -111,7 +111,7 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha case ID3v2_ENCODING_UTF8: len = FFMIN(taglen, dstlen); - get_buffer(pb, dst, len); + avio_read(pb, dst, len); dst[len] = 0; break; default: @@ -178,18 +178,18 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t int tunsync = 0; if (isv34) { - get_buffer(s->pb, tag, 4); + avio_read(s->pb, tag, 4); tag[4] = 0; if(version==3){ - tlen = get_be32(s->pb); + tlen = avio_rb32(s->pb); }else tlen = get_size(s->pb, 4); - tflags = get_be16(s->pb); + tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { - get_buffer(s->pb, tag, 3); + avio_read(s->pb, tag, 3); tag[3] = 0; - tlen = get_be24(s->pb); + tlen = avio_rb24(s->pb); } len -= taghdrlen + tlen; @@ -199,7 +199,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t next = url_ftell(s->pb) + tlen; if (tflags & ID3v2_FLAG_DATALEN) { - get_be32(s->pb); + avio_rb32(s->pb); tlen -= 4; } @@ -211,7 +211,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t 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); + buffer[j] = avio_r8(s->pb); if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) { /* Unsynchronised byte, skip it */ j--; @@ -259,7 +259,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) 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); + ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE); if (ret != ID3v2_HEADER_SIZE) break; found_header = ff_id3v2_match(buf, magic); diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 986714ed11..7421901a9b 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -149,11 +149,11 @@ static int idcin_read_header(AVFormatContext *s, unsigned int sample_rate, bytes_per_sample, channels; /* get the 5 header parameters */ - width = get_le32(pb); - height = get_le32(pb); - sample_rate = get_le32(pb); - bytes_per_sample = get_le32(pb); - channels = get_le32(pb); + width = avio_rl32(pb); + height = avio_rl32(pb); + sample_rate = avio_rl32(pb); + bytes_per_sample = avio_rl32(pb); + channels = avio_rl32(pb); st = av_new_stream(s, 0); if (!st) @@ -169,7 +169,7 @@ static int idcin_read_header(AVFormatContext *s, /* load up the Huffman tables into extradata */ st->codec->extradata_size = HUFFMAN_TABLE_SIZE; st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE); - if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != + if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE) return AVERROR(EIO); /* save a reference in order to transport the palette */ @@ -231,13 +231,13 @@ static int idcin_read_packet(AVFormatContext *s, return AVERROR(EIO); if (idcin->next_chunk_is_video) { - command = get_le32(pb); + command = avio_rl32(pb); if (command == 2) { return AVERROR(EIO); } else if (command == 1) { /* trigger a palette change */ idcin->palctrl.palette_changed = 1; - if (get_buffer(pb, palette_buffer, 768) != 768) + if (avio_read(pb, palette_buffer, 768) != 768) return AVERROR(EIO); /* scale the palette as necessary */ palette_scale = 2; @@ -255,7 +255,7 @@ static int idcin_read_packet(AVFormatContext *s, } } - chunk_size = get_le32(pb); + chunk_size = avio_rl32(pb); /* skip the number of decoded bytes (always equal to width * height) */ url_fseek(pb, 4, SEEK_CUR); chunk_size -= 4; diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index dc0f0a694c..5b18397532 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -74,7 +74,7 @@ static int roq_read_header(AVFormatContext *s, unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; /* get the main header */ - if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); framerate = AV_RL16(&preamble[6]); @@ -115,7 +115,7 @@ static int roq_read_packet(AVFormatContext *s, return AVERROR(EIO); /* get the next chunk preamble */ - if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != + if ((ret = avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); @@ -129,7 +129,7 @@ static int roq_read_packet(AVFormatContext *s, 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) + if (avio_read(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); @@ -144,7 +144,7 @@ static int roq_read_packet(AVFormatContext *s, 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) != + if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 + @@ -198,7 +198,7 @@ static int roq_read_packet(AVFormatContext *s, } pkt->pos= url_ftell(pb); - ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, + ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, chunk_size); if (ret != chunk_size) ret = AVERROR(EIO); diff --git a/libavformat/iff.c b/libavformat/iff.c index 8e3ddf11ab..15327c2421 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -101,7 +101,7 @@ static int get_metadata(AVFormatContext *s, if (!buf) return AVERROR(ENOMEM); - if (get_buffer(s->pb, buf, data_size) < 0) { + if (avio_read(s->pb, buf, data_size) < 0) { av_free(buf); return AVERROR(EIO); } @@ -136,14 +136,14 @@ static int iff_read_header(AVFormatContext *s, st->codec->channels = 1; url_fskip(pb, 8); // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content - st->codec->codec_tag = get_le32(pb); + st->codec->codec_tag = avio_rl32(pb); while(!url_feof(pb)) { uint64_t orig_pos; int res; const char *metadata_tag = NULL; - chunk_id = get_le32(pb); - data_size = get_be32(pb); + chunk_id = avio_rl32(pb); + data_size = avio_rb32(pb); orig_pos = url_ftell(pb); switch(chunk_id) { @@ -153,10 +153,10 @@ static int iff_read_header(AVFormatContext *s, if (data_size < 14) return AVERROR_INVALIDDATA; url_fskip(pb, 12); - st->codec->sample_rate = get_be16(pb); + st->codec->sample_rate = avio_rb16(pb); if (data_size >= 16) { url_fskip(pb, 1); - compression = get_byte(pb); + compression = avio_r8(pb); } break; @@ -168,7 +168,7 @@ static int iff_read_header(AVFormatContext *s, case ID_CHAN: if (data_size < 4) return AVERROR_INVALIDDATA; - st->codec->channels = (get_be32(pb) < 6) ? 1 : 2; + st->codec->channels = (avio_rb32(pb) < 6) ? 1 : 2; break; case ID_CMAP: @@ -176,7 +176,7 @@ static int iff_read_header(AVFormatContext *s, st->codec->extradata = av_malloc(data_size); if (!st->codec->extradata) return AVERROR(ENOMEM); - if (get_buffer(pb, st->codec->extradata, data_size) < 0) + if (avio_read(pb, st->codec->extradata, data_size) < 0) return AVERROR(EIO); break; @@ -184,18 +184,18 @@ static int iff_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_VIDEO; if (data_size <= 8) return AVERROR_INVALIDDATA; - st->codec->width = get_be16(pb); - st->codec->height = get_be16(pb); + st->codec->width = avio_rb16(pb); + st->codec->height = avio_rb16(pb); url_fskip(pb, 4); // x, y offset - st->codec->bits_per_coded_sample = get_byte(pb); + st->codec->bits_per_coded_sample = avio_r8(pb); if (data_size >= 11) { url_fskip(pb, 1); // masking - compression = get_byte(pb); + compression = avio_r8(pb); } if (data_size >= 16) { url_fskip(pb, 3); // paddding, transparent - st->sample_aspect_ratio.num = get_byte(pb); - st->sample_aspect_ratio.den = get_byte(pb); + st->sample_aspect_ratio.num = avio_r8(pb); + st->sample_aspect_ratio.den = avio_r8(pb); } break; @@ -286,7 +286,7 @@ static int iff_read_packet(AVFormatContext *s, if(st->codec->channels == 2) { uint8_t sample_buffer[PACKET_SIZE]; - ret = get_buffer(pb, sample_buffer, PACKET_SIZE); + ret = avio_read(pb, sample_buffer, PACKET_SIZE); if(av_new_packet(pkt, PACKET_SIZE) < 0) { av_log(s, AV_LOG_ERROR, "cannot allocate packet\n"); return AVERROR(ENOMEM); diff --git a/libavformat/img2.c b/libavformat/img2.c index 95848053d2..f2d40d16de 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -298,7 +298,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) pkt->size= 0; for(i=0; i<3; i++){ if(size[i]){ - ret[i]= get_buffer(f[i], pkt->data + pkt->size, size[i]); + ret[i]= avio_read(f[i], pkt->data + pkt->size, size[i]); if (!s->is_pipe) url_fclose(f[i]); if(ret[i]>0) diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c index 79587b5192..dbb3f3bfd2 100644 --- a/libavformat/ingenientdec.c +++ b/libavformat/ingenientdec.c @@ -27,18 +27,18 @@ 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')) + if (avio_rl32(s->pb) != MKTAG('M', 'J', 'P', 'G')) return AVERROR(EIO); // FIXME - size = get_le32(s->pb); + size = avio_rl32(s->pb); - w = get_le16(s->pb); - h = get_le16(s->pb); + w = avio_rl16(s->pb); + h = avio_rl16(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); + unk1 = avio_rl16(s->pb); + unk2 = avio_rl16(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", @@ -49,7 +49,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pos = url_ftell(s->pb); pkt->stream_index = 0; - ret = get_buffer(s->pb, pkt->data, size); + ret = avio_read(s->pb, pkt->data, size); if (ret < 0) { av_free_packet(pkt); return ret; diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 6015b99b3b..6514397a1e 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -166,7 +166,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET); s->decode_map_chunk_offset = 0; - if (get_buffer(pb, pkt->data, s->decode_map_chunk_size) != + if (avio_read(pb, pkt->data, s->decode_map_chunk_size) != s->decode_map_chunk_size) { av_free_packet(pkt); return CHUNK_EOF; @@ -175,7 +175,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, url_fseek(pb, s->video_chunk_offset, SEEK_SET); s->video_chunk_offset = 0; - if (get_buffer(pb, pkt->data + s->decode_map_chunk_size, + if (avio_read(pb, pkt->data + s->decode_map_chunk_size, s->video_chunk_size) != s->video_chunk_size) { av_free_packet(pkt); return CHUNK_EOF; @@ -227,7 +227,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* read the next chunk, wherever the file happens to be pointing */ if (url_feof(pb)) return CHUNK_EOF; - if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) return CHUNK_BAD; chunk_size = AV_RL16(&chunk_preamble[0]); @@ -275,7 +275,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, chunk_type = CHUNK_EOF; break; } - if (get_buffer(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) { chunk_type = CHUNK_BAD; break; @@ -314,7 +314,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, chunk_type = CHUNK_BAD; break; } - if (get_buffer(pb, scratch, opcode_size) != + if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; @@ -331,7 +331,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, chunk_type = CHUNK_BAD; break; } - if (get_buffer(pb, scratch, opcode_size) != + if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; @@ -369,7 +369,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, chunk_type = CHUNK_BAD; break; } - if (get_buffer(pb, scratch, opcode_size) != + if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; @@ -434,7 +434,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, chunk_type = CHUNK_BAD; break; } - if (get_buffer(pb, scratch, opcode_size) != opcode_size) { + if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } @@ -528,10 +528,10 @@ static int ipmovie_read_header(AVFormatContext *s, int chunk_type; uint8_t signature_buffer[sizeof(signature)]; - get_buffer(pb, signature_buffer, sizeof(signature_buffer)); + avio_read(pb, signature_buffer, sizeof(signature_buffer)); while (memcmp(signature_buffer, signature, sizeof(signature))) { memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1); - signature_buffer[sizeof(signature_buffer) - 1] = get_byte(pb); + signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb); if (url_feof(pb)) return AVERROR_EOF; } @@ -549,7 +549,7 @@ static int ipmovie_read_header(AVFormatContext *s, /* peek ahead to the next chunk-- if it is an init audio chunk, process * it; if it is the first video chunk, this is a silent file */ - if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); chunk_type = AV_RL16(&chunk_preamble[2]); diff --git a/libavformat/isom.c b/libavformat/isom.c index 6b1be10f25..8534cb8898 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -346,7 +346,7 @@ int ff_mp4_read_descr_len(AVIOContext *pb) int len = 0; int count = 4; while (count--) { - int c = get_byte(pb); + int c = avio_r8(pb); len = (len << 7) | (c & 0x7f); if (!(c & 0x80)) break; @@ -357,7 +357,7 @@ int ff_mp4_read_descr_len(AVIOContext *pb) int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag) { int len; - *tag = get_byte(pb); + *tag = avio_r8(pb); len = ff_mp4_read_descr_len(pb); av_dlog(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len); return len; @@ -375,11 +375,11 @@ static const AVCodecTag mp4_audio_types[] = { int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb) { int len, tag; - int object_type_id = get_byte(pb); - get_byte(pb); /* stream type */ - get_be24(pb); /* buffer size db */ - get_be32(pb); /* max bitrate */ - get_be32(pb); /* avg bitrate */ + int object_type_id = avio_r8(pb); + avio_r8(pb); /* stream type */ + avio_rb24(pb); /* buffer size db */ + avio_rb32(pb); /* max bitrate */ + avio_rb32(pb); /* avg bitrate */ st->codec->codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id); av_dlog(fc, "esds object type id 0x%02x\n", object_type_id); @@ -392,7 +392,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); - get_buffer(pb, st->codec->extradata, len); + avio_read(pb, st->codec->extradata, len); st->codec->extradata_size = len; if (st->codec->codec_id == CODEC_ID_AAC) { MPEG4AudioConfig cfg; diff --git a/libavformat/iss.c b/libavformat/iss.c index 85b7e5fbdc..04bb1c52d4 100644 --- a/libavformat/iss.c +++ b/libavformat/iss.c @@ -44,7 +44,7 @@ static void get_token(AVIOContext *s, char *buf, int maxlen) int i = 0; char c; - while ((c = get_byte(s))) { + while ((c = avio_r8(s))) { if(c == ' ') break; if (i < maxlen-1) @@ -52,7 +52,7 @@ static void get_token(AVIOContext *s, char *buf, int maxlen) } if(!c) - get_byte(s); + avio_r8(s); buf[i] = 0; /* Ensure null terminated, but may be truncated */ } diff --git a/libavformat/iv8.c b/libavformat/iv8.c index 07659cf8f5..d463350c5f 100644 --- a/libavformat/iv8.c +++ b/libavformat/iv8.c @@ -57,13 +57,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, size, pts, type; retry: - type= get_be16(s->pb); // 257 or 258 - size= get_be16(s->pb); + type= avio_rb16(s->pb); // 257 or 258 + size= avio_rb16(s->pb); - get_be16(s->pb); //some flags, 0x80 indicates end of frame - get_be16(s->pb); //packet number - pts=get_be32(s->pb); - get_be32(s->pb); //6A 13 E3 88 + avio_rb16(s->pb); //some flags, 0x80 indicates end of frame + avio_rb16(s->pb); //packet number + pts=avio_rb32(s->pb); + avio_rb32(s->pb); //6A 13 E3 88 size -= 12; if(size<1) diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index 94b8b82a41..af3fe19e22 100644 --- a/libavformat/ivfdec.c +++ b/libavformat/ivfdec.c @@ -36,9 +36,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st; AVRational time_base; - get_le32(s->pb); // DKIF - get_le16(s->pb); // version - get_le16(s->pb); // header size + avio_rl32(s->pb); // DKIF + avio_rl16(s->pb); // version + avio_rl16(s->pb); // header size st = av_new_stream(s, 0); if (!st) @@ -46,13 +46,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_tag = get_le32(s->pb); + st->codec->codec_tag = avio_rl32(s->pb); st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, st->codec->codec_tag); - st->codec->width = get_le16(s->pb); - st->codec->height = get_le16(s->pb); - time_base.den = get_le32(s->pb); - time_base.num = get_le32(s->pb); - st->duration = get_le64(s->pb); + st->codec->width = avio_rl16(s->pb); + st->codec->height = avio_rl16(s->pb); + time_base.den = avio_rl32(s->pb); + time_base.num = avio_rl32(s->pb); + st->duration = avio_rl64(s->pb); st->need_parsing = AVSTREAM_PARSE_HEADERS; @@ -68,8 +68,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) static int read_packet(AVFormatContext *s, AVPacket *pkt) { - int ret, size = get_le32(s->pb); - int64_t pts = get_le64(s->pb); + int ret, size = avio_rl32(s->pb); + int64_t pts = avio_rl64(s->pb); ret = av_get_packet(s->pb, pkt, size); pkt->stream_index = 0; diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 7c4378b6c0..30ada1bf2f 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -173,7 +173,7 @@ static int nut_probe(AVProbeData *p) { static size_t av_read(void * h, size_t len, uint8_t * buf) { AVIOContext * bc = h; - return get_buffer(bc, buf, len); + return avio_read(bc, buf, len); } static off_t av_seek(void * h, long long pos, int whence) { diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index 7539e1f4ab..2991b30710 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -82,9 +82,9 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret; unsigned int frame_type, packet_size, padding, frame_size; - get_be16(pb); /* channel number */ - frame_type = get_be16(pb); - packet_size = get_be32(pb); + avio_rb16(pb); /* channel number */ + frame_type = avio_rb16(pb); + packet_size = avio_rb32(pb); padding = -packet_size & 511; frame_size = packet_size - 8; diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index a4dc6d9c65..8692e628e5 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -86,7 +86,7 @@ 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) + if ((ret = avio_read(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH) return ret < 0 ? ret : AVERROR_EOF; while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) { @@ -94,7 +94,7 @@ static int sync(AVFormatContext *s, uint8_t *header) return AVERROR_EOF; memmove(buf, &buf[1], LXF_IDENT_LENGTH-1); - buf[LXF_IDENT_LENGTH-1] = get_byte(s->pb); + buf[LXF_IDENT_LENGTH-1] = avio_r8(s->pb); } memcpy(header, LXF_IDENT, LXF_IDENT_LENGTH); @@ -120,7 +120,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form return ret; //read the rest of the packet header - if ((ret = get_buffer(pb, header + LXF_IDENT_LENGTH, + if ((ret = avio_read(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; @@ -214,7 +214,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR_INVALIDDATA; } - if ((ret = get_buffer(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE) + if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE) return ret < 0 ? ret : AVERROR_EOF; if (!(st = av_new_stream(s, 0))) @@ -315,7 +315,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) //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) { + if ((ret2 = avio_read(pb, buf, ret)) != ret) { av_free_packet(pkt); return ret2 < 0 ? ret2 : AVERROR_EOF; } diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 69f08c3142..545c93895f 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -543,10 +543,10 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, int read = 1, n = 1; uint64_t total = 0; - /* The first byte tells us the length in bytes - get_byte() can normally + /* The first byte tells us the length in bytes - avio_r8() can normally * return 0, but since that's not a valid first ebmlID byte, we can * use it safely here to catch EOS. */ - if (!(total = get_byte(pb))) { + if (!(total = avio_r8(pb))) { /* we might encounter EOS here */ if (!url_feof(pb)) { int64_t pos = url_ftell(pb); @@ -570,7 +570,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, /* read out length */ total ^= 1 << ff_log2_tab[total]; while (n++ < read) - total = (total << 8) | get_byte(pb); + total = (total << 8) | avio_r8(pb); *number = total; @@ -605,7 +605,7 @@ static int ebml_read_uint(AVIOContext *pb, int size, uint64_t *num) /* big-endian ordering; build up number */ *num = 0; while (n++ < size) - *num = (*num << 8) | get_byte(pb); + *num = (*num << 8) | avio_r8(pb); return 0; } @@ -619,9 +619,9 @@ static int ebml_read_float(AVIOContext *pb, int size, double *num) if (size == 0) { *num = 0; } else if (size == 4) { - *num= av_int2flt(get_be32(pb)); + *num= av_int2flt(avio_rb32(pb)); } else if(size==8){ - *num= av_int2dbl(get_be64(pb)); + *num= av_int2dbl(avio_rb64(pb)); } else return AVERROR_INVALIDDATA; @@ -639,7 +639,7 @@ static int ebml_read_ascii(AVIOContext *pb, int size, char **str) * byte more, read the string and NULL-terminate it ourselves. */ if (!(*str = av_malloc(size + 1))) return AVERROR(ENOMEM); - if (get_buffer(pb, (uint8_t *) *str, size) != size) { + if (avio_read(pb, (uint8_t *) *str, size) != size) { av_freep(str); return AVERROR(EIO); } @@ -660,7 +660,7 @@ static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) bin->size = length; bin->pos = url_ftell(pb); - if (get_buffer(pb, bin->data, length) != length) { + if (avio_read(pb, bin->data, length) != length) { av_freep(&bin->data); return AVERROR(EIO); } @@ -1394,12 +1394,12 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size, 0, NULL, NULL, NULL, NULL); url_fskip(&b, 22); - flavor = get_be16(&b); - track->audio.coded_framesize = get_be32(&b); + flavor = avio_rb16(&b); + track->audio.coded_framesize = avio_rb32(&b); url_fskip(&b, 12); - track->audio.sub_packet_h = get_be16(&b); - track->audio.frame_size = get_be16(&b); - track->audio.sub_packet_size = get_be16(&b); + track->audio.sub_packet_h = avio_rb16(&b); + track->audio.frame_size = avio_rb16(&b); + track->audio.sub_packet_size = avio_rb16(&b); track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h); if (codec_id == CODEC_ID_RA_288) { st->codec->block_align = track->audio.coded_framesize; diff --git a/libavformat/mm.c b/libavformat/mm.c index 53c3b49705..2c0d215abf 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -90,18 +90,18 @@ static int read_header(AVFormatContext *s, unsigned int type, length; unsigned int frame_rate, width, height; - type = get_le16(pb); - length = get_le32(pb); + type = avio_rl16(pb); + length = avio_rl32(pb); if (type != MM_TYPE_HEADER) return AVERROR_INVALIDDATA; /* read header */ - get_le16(pb); /* total number of chunks */ - frame_rate = get_le16(pb); - get_le16(pb); /* ibm-pc video bios mode */ - width = get_le16(pb); - height = get_le16(pb); + avio_rl16(pb); /* total number of chunks */ + frame_rate = avio_rl16(pb); + avio_rl16(pb); /* ibm-pc video bios mode */ + width = avio_rl16(pb); + height = avio_rl16(pb); url_fseek(pb, length - 10, SEEK_CUR); /* unknown data */ /* video stream */ @@ -143,7 +143,7 @@ static int read_packet(AVFormatContext *s, while(1) { - if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) { + if (avio_read(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) { return AVERROR(EIO); } @@ -162,7 +162,7 @@ static int read_packet(AVFormatContext *s, if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE)) return AVERROR(ENOMEM); memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE); - if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length) + if (avio_read(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length) return AVERROR(EIO); pkt->size = length + MM_PREAMBLE_SIZE; pkt->stream_index = 0; diff --git a/libavformat/mmf.c b/libavformat/mmf.c index bf855cba8b..1a00908eba 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -188,15 +188,15 @@ static int mmf_read_header(AVFormatContext *s, int64_t file_size, size; int rate, params; - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('M', 'M', 'M', 'D')) return -1; - file_size = get_be32(pb); + file_size = avio_rb32(pb); /* Skip some unused chunks that may or may not be present */ for(;; url_fseek(pb, size, SEEK_CUR)) { - tag = get_le32(pb); - size = get_be32(pb); + tag = avio_rl32(pb); + size = avio_rb32(pb); if(tag == MKTAG('C','N','T','I')) continue; if(tag == MKTAG('O','P','D','A')) continue; break; @@ -212,22 +212,22 @@ static int mmf_read_header(AVFormatContext *s, return -1; } - get_byte(pb); /* format type */ - get_byte(pb); /* sequence type */ - params = get_byte(pb); /* (channel << 7) | (format << 4) | rate */ + avio_r8(pb); /* format type */ + avio_r8(pb); /* sequence type */ + params = avio_r8(pb); /* (channel << 7) | (format << 4) | rate */ rate = mmf_rate(params & 0x0f); if(rate < 0) { av_log(s, AV_LOG_ERROR, "Invalid sample rate\n"); return -1; } - get_byte(pb); /* wave base bit */ - get_byte(pb); /* time base d */ - get_byte(pb); /* time base g */ + avio_r8(pb); /* wave base bit */ + avio_r8(pb); /* time base d */ + avio_r8(pb); /* time base g */ /* Skip some unused chunks that may or may not be present */ for(;; url_fseek(pb, size, SEEK_CUR)) { - tag = get_le32(pb); - size = get_be32(pb); + tag = avio_rl32(pb); + size = avio_rb32(pb); if(tag == MKTAG('A','t','s','q')) continue; if(tag == MKTAG('A','s','p','I')) continue; break; @@ -280,7 +280,7 @@ static int mmf_read_packet(AVFormatContext *s, return AVERROR(EIO); pkt->stream_index = 0; - ret = get_buffer(s->pb, pkt->data, pkt->size); + ret = avio_read(s->pb, pkt->data, pkt->size); if (ret < 0) av_free_packet(pkt); diff --git a/libavformat/mov.c b/libavformat/mov.c index 2c314e3a39..eadb8f8988 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -83,11 +83,11 @@ static int mov_metadata_trkn(MOVContext *c, AVIOContext *pb, unsigned len) { char buf[16]; - get_be16(pb); // unknown - snprintf(buf, sizeof(buf), "%d", get_be16(pb)); + avio_rb16(pb); // unknown + snprintf(buf, sizeof(buf), "%d", avio_rb16(pb)); av_metadata_set2(&c->fc->metadata, "track", buf, 0); - get_be16(pb); // total tracks + avio_rb16(pb); // total tracks return 0; } @@ -119,7 +119,7 @@ static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, int i; for (i = 0; i < len; i++) { - uint8_t t, c = get_byte(pb); + uint8_t t, c = avio_r8(pb); if (c < 0x80 && p < end) *p++ = c; else @@ -165,17 +165,17 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) } if (c->itunes_metadata && atom.size > 8) { - int data_size = get_be32(pb); - int tag = get_le32(pb); + int data_size = avio_rb32(pb); + int tag = avio_rl32(pb); if (tag == MKTAG('d','a','t','a')) { - data_type = get_be32(pb); // type - get_be32(pb); // unknown + data_type = avio_rb32(pb); // type + avio_rb32(pb); // unknown str_size = data_size - 16; atom.size -= 16; } else return 0; } else if (atom.size > 4 && key && !c->itunes_metadata) { - str_size = get_be16(pb); // string length - langcode = get_be16(pb); + str_size = avio_rb16(pb); // string length + langcode = avio_rb16(pb); ff_mov_lang_to_iso639(langcode, language); atom.size -= 4; } else @@ -201,7 +201,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (data_type == 3 || (data_type == 0 && langcode < 0x800)) { // MAC Encoded mov_read_mac_string(c, pb, str_size, str, sizeof(str)); } else { - get_buffer(pb, str, str_size); + avio_read(pb, str, str_size); str[str_size] = 0; } av_metadata_set2(&c->fc->metadata, key, str, 0); @@ -228,23 +228,23 @@ static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom) if ((atom.size -= 5) < 0) return 0; - version = get_byte(pb); - get_be24(pb); + version = avio_r8(pb); + avio_rb24(pb); if (version) - get_be32(pb); // ??? - nb_chapters = get_byte(pb); + avio_rb32(pb); // ??? + nb_chapters = avio_r8(pb); for (i = 0; i < nb_chapters; i++) { if (atom.size < 9) return 0; - start = get_be64(pb); - str_len = get_byte(pb); + start = avio_rb64(pb); + str_len = avio_r8(pb); if ((atom.size -= 9+str_len) < 0) return 0; - get_buffer(pb, str, str_len); + avio_read(pb, str, str_len); str[str_len] = 0; ff_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str); } @@ -264,14 +264,14 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) a.size = atom.size; a.type=0; if(atom.size >= 8) { - a.size = get_be32(pb); - a.type = get_le32(pb); + a.size = avio_rb32(pb); + a.type = avio_rl32(pb); } av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size); total_size += 8; if (a.size == 1) { /* 64 bit extended size */ - a.size = get_be64(pb) - 8; + a.size = avio_rb64(pb) - 8; total_size += 8; } if (a.size == 0) { @@ -331,8 +331,8 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_be32(pb); // version + flags - entries = get_be32(pb); + avio_rb32(pb); // version + flags + entries = avio_rb32(pb); if (entries >= UINT_MAX / sizeof(*sc->drefs)) return -1; sc->drefs = av_mallocz(entries * sizeof(*sc->drefs)); @@ -342,14 +342,14 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < sc->drefs_count; i++) { MOVDref *dref = &sc->drefs[i]; - uint32_t size = get_be32(pb); + uint32_t size = avio_rb32(pb); int64_t next = url_ftell(pb) + size - 4; if (size < 12) return -1; - dref->type = get_le32(pb); - get_be32(pb); // version + flags + dref->type = avio_rl32(pb); + avio_rb32(pb); // version + flags av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','i','s') && size > 150) { @@ -359,33 +359,33 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) url_fskip(pb, 10); - volume_len = get_byte(pb); + volume_len = avio_r8(pb); volume_len = FFMIN(volume_len, 27); - get_buffer(pb, dref->volume, 27); + avio_read(pb, dref->volume, 27); dref->volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); url_fskip(pb, 12); - len = get_byte(pb); + len = avio_r8(pb); len = FFMIN(len, 63); - get_buffer(pb, dref->filename, 63); + avio_read(pb, dref->filename, 63); dref->filename[len] = 0; av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); url_fskip(pb, 16); /* read next level up_from_alias/down_to_target */ - dref->nlvl_from = get_be16(pb); - dref->nlvl_to = get_be16(pb); + dref->nlvl_from = avio_rb16(pb); + dref->nlvl_to = avio_rb16(pb); av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", dref->nlvl_from, dref->nlvl_to); url_fskip(pb, 16); for (type = 0; type != -1 && url_ftell(pb) < next; ) { - type = get_be16(pb); - len = get_be16(pb); + type = avio_rb16(pb); + len = avio_rb16(pb); av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; @@ -394,7 +394,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->path = av_mallocz(len+1); if (!dref->path) return AVERROR(ENOMEM); - get_buffer(pb, dref->path, len); + avio_read(pb, dref->path, len); if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); @@ -409,7 +409,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->dir = av_malloc(len+1); if (!dref->dir) return AVERROR(ENOMEM); - get_buffer(pb, dref->dir, len); + avio_read(pb, dref->dir, len); dref->dir[len] = 0; for (j = 0; j < len; j++) if (dref->dir[j] == ':') @@ -435,12 +435,12 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ /* component type */ - ctype = get_le32(pb); - type = get_le32(pb); /* component subtype */ + ctype = avio_rl32(pb); + type = avio_rl32(pb); /* component subtype */ av_dlog(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype); av_dlog(c->fc, "stype= %.4s\n", (char*)&type); @@ -454,9 +454,9 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) else if(type == MKTAG('s','u','b','p')) st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; - get_be32(pb); /* component manufacture */ - get_be32(pb); /* component flags */ - get_be32(pb); /* component flags mask */ + avio_rb32(pb); /* component manufacture */ + avio_rb32(pb); /* component flags */ + avio_rb32(pb); /* component flags mask */ return 0; } @@ -470,13 +470,13 @@ int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom) return 0; st = fc->streams[fc->nb_streams-1]; - get_be32(pb); /* version + flags */ + avio_rb32(pb); /* version + flags */ len = ff_mp4_read_descr(fc, pb, &tag); if (tag == MP4ESDescrTag) { - get_be16(pb); /* ID */ - get_byte(pb); /* priority */ + avio_rb16(pb); /* ID */ + avio_r8(pb); /* priority */ } else - get_be16(pb); /* ID */ + avio_rb16(pb); /* ID */ len = ff_mp4_read_descr(fc, pb, &tag); if (tag == MP4DecConfigDescrTag) @@ -498,7 +498,7 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; st = c->fc->streams[c->fc->nb_streams-1]; - ac3info = get_be24(pb); + ac3info = avio_rb24(pb); acmod = (ac3info >> 11) & 0x7; lfeon = (ac3info >> 10) & 0x1; st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon; @@ -508,8 +508,8 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom) { - const int num = get_be32(pb); - const int den = get_be32(pb); + const int num = avio_rb32(pb); + const int den = avio_rb32(pb); AVStream *st; if (c->fc->nb_streams < 1) @@ -547,12 +547,12 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) char* comp_brands_str; uint8_t type[5] = {0}; - get_buffer(pb, type, 4); + avio_read(pb, type, 4); if (strcmp(type, "qt ")) c->isom = 1; av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type); av_metadata_set2(&c->fc->metadata, "major_brand", type, 0); - minor_ver = get_be32(pb); /* minor version */ + minor_ver = avio_rb32(pb); /* minor version */ snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver); av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0); @@ -562,7 +562,7 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) comp_brands_str = av_malloc(comp_brand_size + 1); /* Add null terminator */ if (!comp_brands_str) return AVERROR(ENOMEM); - get_buffer(pb, comp_brands_str, comp_brand_size); + avio_read(pb, comp_brands_str, comp_brand_size); comp_brands_str[comp_brand_size] = 0; av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0); av_freep(&comp_brands_str); @@ -615,27 +615,27 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - version = get_byte(pb); + version = avio_r8(pb); if (version > 1) return -1; /* unsupported */ - get_be24(pb); /* flags */ + avio_rb24(pb); /* flags */ if (version == 1) { - creation_time = get_be64(pb); - get_be64(pb); + creation_time = avio_rb64(pb); + avio_rb64(pb); } else { - creation_time = get_be32(pb); - get_be32(pb); /* modification time */ + creation_time = avio_rb32(pb); + avio_rb32(pb); /* modification time */ } mov_metadata_creation_time(&st->metadata, creation_time); - sc->time_scale = get_be32(pb); - st->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */ + sc->time_scale = avio_rb32(pb); + st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ - lang = get_be16(pb); /* language */ + lang = avio_rb16(pb); /* language */ if (ff_mov_lang_to_iso639(lang, language)) av_metadata_set2(&st->metadata, "language", language, 0); - get_be16(pb); /* quality */ + avio_rb16(pb); /* quality */ return 0; } @@ -643,37 +643,37 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { time_t creation_time; - int version = get_byte(pb); /* version */ - get_be24(pb); /* flags */ + int version = avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ if (version == 1) { - creation_time = get_be64(pb); - get_be64(pb); + creation_time = avio_rb64(pb); + avio_rb64(pb); } else { - creation_time = get_be32(pb); - get_be32(pb); /* modification time */ + creation_time = avio_rb32(pb); + avio_rb32(pb); /* modification time */ } mov_metadata_creation_time(&c->fc->metadata, creation_time); - c->time_scale = get_be32(pb); /* time scale */ + c->time_scale = avio_rb32(pb); /* time scale */ av_dlog(c->fc, "time scale = %i\n", c->time_scale); - c->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */ - get_be32(pb); /* preferred scale */ + c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ + avio_rb32(pb); /* preferred scale */ - get_be16(pb); /* preferred volume */ + avio_rb16(pb); /* preferred volume */ url_fskip(pb, 10); /* reserved */ url_fskip(pb, 36); /* display matrix */ - get_be32(pb); /* preview time */ - get_be32(pb); /* preview duration */ - get_be32(pb); /* poster time */ - get_be32(pb); /* selection time */ - get_be32(pb); /* selection duration */ - get_be32(pb); /* current time */ - get_be32(pb); /* next track ID */ + avio_rb32(pb); /* preview time */ + avio_rb32(pb); /* preview duration */ + avio_rb32(pb); /* poster time */ + avio_rb32(pb); /* selection time */ + avio_rb32(pb); /* selection duration */ + avio_rb32(pb); /* current time */ + avio_rb32(pb); /* next track ID */ return 0; } @@ -697,7 +697,7 @@ static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + atom.size; memcpy(st->codec->extradata, "SVQ3", 4); // fake - get_buffer(pb, st->codec->extradata + 0x5a, atom.size); + avio_read(pb, st->codec->extradata + 0x5a, atom.size); av_dlog(c->fc, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a); return 0; } @@ -711,7 +711,7 @@ static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; st = c->fc->streams[c->fc->nb_streams-1]; - little_endian = get_be16(pb); + little_endian = avio_rb16(pb); av_dlog(c->fc, "enda %d\n", little_endian); if (little_endian == 1) { switch (st->codec->codec_id) { @@ -755,7 +755,7 @@ static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom) st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; AV_WB32( buf , atom.size + 8); AV_WL32( buf + 4, atom.type); - get_buffer(pb, buf + 8, atom.size); + avio_read(pb, buf + 8, atom.size); return 0; } @@ -777,7 +777,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size; - get_buffer(pb, st->codec->extradata, atom.size); + avio_read(pb, st->codec->extradata, atom.size); } else if (atom.size > 8) { /* to read frma, esds atoms */ if (mov_read_default(c, pb, atom) < 0) return -1; @@ -806,7 +806,7 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size; - get_buffer(pb, st->codec->extradata, atom.size); + avio_read(pb, st->codec->extradata, atom.size); return 0; } @@ -834,7 +834,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size - 40; url_fskip(pb, 40); - get_buffer(pb, st->codec->extradata, atom.size - 40); + avio_read(pb, st->codec->extradata, atom.size - 40); return 0; } @@ -849,10 +849,10 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ - entries = get_be32(pb); + entries = avio_rb32(pb); if(entries >= UINT_MAX/sizeof(int64_t)) return -1; @@ -864,10 +864,10 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (atom.type == MKTAG('s','t','c','o')) for(i=0; ichunk_offsets[i] = get_be32(pb); + sc->chunk_offsets[i] = avio_rb32(pb); else if (atom.type == MKTAG('c','o','6','4')) for(i=0; ichunk_offsets[i] = get_be64(pb); + sc->chunk_offsets[i] = avio_rb64(pb); else return -1; @@ -926,13 +926,13 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) int dref_id = 1; MOVAtom a = { AV_RL32("stsd") }; int64_t start_pos = url_ftell(pb); - int size = get_be32(pb); /* size */ - uint32_t format = get_le32(pb); /* data format */ + int size = avio_rb32(pb); /* size */ + uint32_t format = avio_rl32(pb); /* data format */ if (size >= 16) { - get_be32(pb); /* reserved */ - get_be16(pb); /* reserved */ - dref_id = get_be16(pb); + avio_rb32(pb); /* reserved */ + avio_rb16(pb); /* reserved */ + dref_id = avio_rb16(pb); } if (st->codec->codec_tag && @@ -984,21 +984,21 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) int color_greyscale; st->codec->codec_id = id; - get_be16(pb); /* version */ - get_be16(pb); /* revision level */ - get_be32(pb); /* vendor */ - get_be32(pb); /* temporal quality */ - get_be32(pb); /* spatial quality */ + avio_rb16(pb); /* version */ + avio_rb16(pb); /* revision level */ + avio_rb32(pb); /* vendor */ + avio_rb32(pb); /* temporal quality */ + avio_rb32(pb); /* spatial quality */ - st->codec->width = get_be16(pb); /* width */ - st->codec->height = get_be16(pb); /* height */ + st->codec->width = avio_rb16(pb); /* width */ + st->codec->height = avio_rb16(pb); /* height */ - get_be32(pb); /* horiz resolution */ - get_be32(pb); /* vert resolution */ - get_be32(pb); /* data size, always 0 */ - get_be16(pb); /* frames per samples */ + avio_rb32(pb); /* horiz resolution */ + avio_rb32(pb); /* vert resolution */ + avio_rb32(pb); /* data size, always 0 */ + avio_rb16(pb); /* frames per samples */ - len = get_byte(pb); /* codec name, pascal string */ + len = avio_r8(pb); /* codec name, pascal string */ if (len > 31) len = 31; mov_read_mac_string(c, pb, len, st->codec->codec_name, 32); @@ -1008,8 +1008,8 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) st->codec->codec_tag=MKTAG('I', '4', '2', '0'); - st->codec->bits_per_coded_sample = get_be16(pb); /* depth */ - st->codec->color_table_id = get_be16(pb); /* colortable id */ + st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */ + st->codec->color_table_id = avio_rb16(pb); /* colortable id */ av_dlog(c->fc, "depth %d, ctab id %d\n", st->codec->bits_per_coded_sample, st->codec->color_table_id); /* figure out the palette situation */ @@ -1059,23 +1059,23 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) } } else { /* load the palette from the file */ - color_start = get_be32(pb); - color_count = get_be16(pb); - color_end = get_be16(pb); + color_start = avio_rb32(pb); + color_count = avio_rb16(pb); + color_end = avio_rb16(pb); if ((color_start <= 255) && (color_end <= 255)) { for (j = color_start; j <= color_end; j++) { /* each R, G, or B component is 16 bits; * only use the top 8 bits; skip alpha bytes * up front */ - get_byte(pb); - get_byte(pb); - r = get_byte(pb); - get_byte(pb); - g = get_byte(pb); - get_byte(pb); - b = get_byte(pb); - get_byte(pb); + avio_r8(pb); + avio_r8(pb); + r = avio_r8(pb); + avio_r8(pb); + g = avio_r8(pb); + avio_r8(pb); + b = avio_r8(pb); + avio_r8(pb); st->codec->palctrl->palette[j] = (r << 16) | (g << 8) | (b); } @@ -1085,38 +1085,38 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) } } else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) { int bits_per_sample, flags; - uint16_t version = get_be16(pb); + uint16_t version = avio_rb16(pb); st->codec->codec_id = id; - get_be16(pb); /* revision level */ - get_be32(pb); /* vendor */ + avio_rb16(pb); /* revision level */ + avio_rb32(pb); /* vendor */ - st->codec->channels = get_be16(pb); /* channel count */ + st->codec->channels = avio_rb16(pb); /* channel count */ av_dlog(c->fc, "audio channels %d\n", st->codec->channels); - st->codec->bits_per_coded_sample = get_be16(pb); /* sample size */ + st->codec->bits_per_coded_sample = avio_rb16(pb); /* sample size */ - sc->audio_cid = get_be16(pb); - get_be16(pb); /* packet size = 0 */ + sc->audio_cid = avio_rb16(pb); + avio_rb16(pb); /* packet size = 0 */ - st->codec->sample_rate = ((get_be32(pb) >> 16)); + st->codec->sample_rate = ((avio_rb32(pb) >> 16)); //Read QT version 1 fields. In version 0 these do not exist. av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom); if(!c->isom) { if(version==1) { - sc->samples_per_frame = get_be32(pb); - get_be32(pb); /* bytes per packet */ - sc->bytes_per_frame = get_be32(pb); - get_be32(pb); /* bytes per sample */ + sc->samples_per_frame = avio_rb32(pb); + avio_rb32(pb); /* bytes per packet */ + sc->bytes_per_frame = avio_rb32(pb); + avio_rb32(pb); /* bytes per sample */ } else if(version==2) { - get_be32(pb); /* sizeof struct only */ - st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */ - st->codec->channels = get_be32(pb); - get_be32(pb); /* always 0x7F000000 */ - st->codec->bits_per_coded_sample = get_be32(pb); /* bits per channel if sound is uncompressed */ - flags = get_be32(pb); /* lpcm format specific flag */ - sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */ - sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */ + avio_rb32(pb); /* sizeof struct only */ + st->codec->sample_rate = av_int2dbl(avio_rb64(pb)); /* float 64 */ + st->codec->channels = avio_rb32(pb); + avio_rb32(pb); /* always 0x7F000000 */ + st->codec->bits_per_coded_sample = avio_rb32(pb); /* bits per channel if sound is uncompressed */ + flags = avio_rb32(pb); /* lpcm format specific flag */ + sc->bytes_per_frame = avio_rb32(pb); /* bytes per audio packet if constant */ + sc->samples_per_frame = avio_rb32(pb); /* lpcm frames per audio packet if constant */ if (format == MKTAG('l','p','c','m')) st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags); } @@ -1249,9 +1249,9 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int entries; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ - entries = get_be32(pb); + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + entries = avio_rb32(pb); return ff_mov_read_stsd_entries(c, pb, entries); } @@ -1267,10 +1267,10 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ - entries = get_be32(pb); + entries = avio_rb32(pb); av_dlog(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries); @@ -1282,9 +1282,9 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->stsc_count = entries; for(i=0; istsc_data[i].first = get_be32(pb); - sc->stsc_data[i].count = get_be32(pb); - sc->stsc_data[i].id = get_be32(pb); + sc->stsc_data[i].first = avio_rb32(pb); + sc->stsc_data[i].count = avio_rb32(pb); + sc->stsc_data[i].id = avio_rb32(pb); } return 0; } @@ -1300,9 +1300,9 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_be32(pb); // version + flags + avio_rb32(pb); // version + flags - entries = get_be32(pb); + entries = avio_rb32(pb); if (entries >= UINT_MAX / sizeof(*sc->stps_data)) return -1; sc->stps_data = av_malloc(entries * sizeof(*sc->stps_data)); @@ -1311,7 +1311,7 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->stps_count = entries; for (i = 0; i < entries; i++) { - sc->stps_data[i] = get_be32(pb); + sc->stps_data[i] = avio_rb32(pb); //av_dlog(c->fc, "stps %d\n", sc->stps_data[i]); } @@ -1329,10 +1329,10 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ - entries = get_be32(pb); + entries = avio_rb32(pb); av_dlog(c->fc, "keyframe_count = %d\n", entries); @@ -1344,7 +1344,7 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->keyframe_count = entries; for(i=0; ikeyframes[i] = get_be32(pb); + sc->keyframes[i] = avio_rb32(pb); //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]); } return 0; @@ -1363,20 +1363,20 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ if (atom.type == MKTAG('s','t','s','z')) { - sample_size = get_be32(pb); + sample_size = avio_rb32(pb); if (!sc->sample_size) /* do not overwrite value computed in stsd */ sc->sample_size = sample_size; field_size = 32; } else { sample_size = 0; - get_be24(pb); /* reserved */ - field_size = get_byte(pb); + avio_rb24(pb); /* reserved */ + field_size = avio_r8(pb); } - entries = get_be32(pb); + entries = avio_rb32(pb); av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); @@ -1403,7 +1403,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR(ENOMEM); } - if (get_buffer(pb, buf, num_bytes) < num_bytes) { + if (avio_read(pb, buf, num_bytes) < num_bytes) { av_freep(&sc->sample_sizes); av_free(buf); return -1; @@ -1431,9 +1431,9 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) 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); + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + entries = avio_rb32(pb); av_dlog(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries); @@ -1448,8 +1448,8 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) int sample_duration; int sample_count; - sample_count=get_be32(pb); - sample_duration = get_be32(pb); + sample_count=avio_rb32(pb); + sample_duration = avio_rb32(pb); sc->stts_data[i].count= sample_count; sc->stts_data[i].duration= sample_duration; @@ -1476,9 +1476,9 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) 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); + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + entries = avio_rb32(pb); av_dlog(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); @@ -1490,8 +1490,8 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->ctts_count = entries; for(i=0; ictts_data[i].count = count; sc->ctts_data[i].duration= duration; @@ -1837,7 +1837,7 @@ static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom) { while (atom.size > 8) { - uint32_t tag = get_le32(pb); + uint32_t tag = avio_rl32(pb); atom.size -= 4; if (tag == MKTAG('h','d','l','r')) { url_fseek(pb, -8, SEEK_CUR); @@ -1864,8 +1864,8 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - version = get_byte(pb); - get_be24(pb); /* flags */ + version = avio_r8(pb); + avio_rb24(pb); /* flags */ /* MOV_TRACK_ENABLED 0x0001 MOV_TRACK_IN_MOVIE 0x0002 @@ -1874,36 +1874,36 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) */ if (version == 1) { - get_be64(pb); - get_be64(pb); + avio_rb64(pb); + avio_rb64(pb); } else { - get_be32(pb); /* creation time */ - get_be32(pb); /* modification time */ + avio_rb32(pb); /* creation time */ + avio_rb32(pb); /* modification time */ } - st->id = (int)get_be32(pb); /* track id (NOT 0 !)*/ - get_be32(pb); /* reserved */ + st->id = (int)avio_rb32(pb); /* track id (NOT 0 !)*/ + avio_rb32(pb); /* reserved */ /* highlevel (considering edits) duration in movie timebase */ - (version == 1) ? get_be64(pb) : get_be32(pb); - get_be32(pb); /* reserved */ - get_be32(pb); /* reserved */ + (version == 1) ? avio_rb64(pb) : avio_rb32(pb); + avio_rb32(pb); /* reserved */ + avio_rb32(pb); /* reserved */ - get_be16(pb); /* layer */ - get_be16(pb); /* alternate group */ - get_be16(pb); /* volume */ - get_be16(pb); /* reserved */ + avio_rb16(pb); /* layer */ + avio_rb16(pb); /* alternate group */ + avio_rb16(pb); /* volume */ + avio_rb16(pb); /* reserved */ //read in the display matrix (outlined in ISO 14496-12, Section 6.2.2) // they're kept in fixed point format through all calculations // ignore u,v,z b/c we don't need the scale factor to calc aspect ratio for (i = 0; i < 3; i++) { - display_matrix[i][0] = get_be32(pb); // 16.16 fixed point - display_matrix[i][1] = get_be32(pb); // 16.16 fixed point - get_be32(pb); // 2.30 fixed point (not used) + display_matrix[i][0] = avio_rb32(pb); // 16.16 fixed point + display_matrix[i][1] = avio_rb32(pb); // 16.16 fixed point + avio_rb32(pb); // 2.30 fixed point (not used) } - width = get_be32(pb); // 16.16 fixed point track width - height = get_be32(pb); // 16.16 fixed point track height + width = avio_rb32(pb); // 16.16 fixed point track width + height = avio_rb32(pb); // 16.16 fixed point track height sc->width = width >> 16; sc->height = height >> 16; @@ -1937,10 +1937,10 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOVTrackExt *trex = NULL; int flags, track_id, i; - get_byte(pb); /* version */ - flags = get_be24(pb); + avio_r8(pb); /* version */ + flags = avio_rb24(pb); - track_id = get_be32(pb); + track_id = avio_rb32(pb); if (!track_id) return -1; frag->track_id = track_id; @@ -1954,21 +1954,21 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) return -1; } - if (flags & 0x01) frag->base_data_offset = get_be64(pb); + if (flags & 0x01) frag->base_data_offset = avio_rb64(pb); else frag->base_data_offset = frag->moof_offset; - if (flags & 0x02) frag->stsd_id = get_be32(pb); + if (flags & 0x02) frag->stsd_id = avio_rb32(pb); else frag->stsd_id = trex->stsd_id; - frag->duration = flags & 0x08 ? get_be32(pb) : trex->duration; - frag->size = flags & 0x10 ? get_be32(pb) : trex->size; - frag->flags = flags & 0x20 ? get_be32(pb) : trex->flags; + frag->duration = flags & 0x08 ? avio_rb32(pb) : trex->duration; + frag->size = flags & 0x10 ? avio_rb32(pb) : trex->size; + frag->flags = flags & 0x20 ? avio_rb32(pb) : trex->flags; av_dlog(c->fc, "frag flags 0x%x\n", frag->flags); return 0; } static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom) { - c->chapter_track = get_be32(pb); + c->chapter_track = avio_rb32(pb); return 0; } @@ -1983,13 +1983,13 @@ static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR(ENOMEM); c->trex_data = trex; trex = &c->trex_data[c->trex_count++]; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ - trex->track_id = get_be32(pb); - trex->stsd_id = get_be32(pb); - trex->duration = get_be32(pb); - trex->size = get_be32(pb); - trex->flags = get_be32(pb); + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + trex->track_id = avio_rb32(pb); + trex->stsd_id = avio_rb32(pb); + trex->duration = avio_rb32(pb); + trex->size = avio_rb32(pb); + trex->flags = avio_rb32(pb); return 0; } @@ -2017,12 +2017,12 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = st->priv_data; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; - get_byte(pb); /* version */ - flags = get_be24(pb); - entries = get_be32(pb); + avio_r8(pb); /* version */ + flags = avio_rb24(pb); + entries = avio_rb32(pb); av_dlog(c->fc, "flags 0x%x entries %d\n", flags, entries); - if (flags & 0x001) data_offset = get_be32(pb); - if (flags & 0x004) first_sample_flags = get_be32(pb); + if (flags & 0x001) data_offset = avio_rb32(pb); + if (flags & 0x004) first_sample_flags = avio_rb32(pb); if (flags & 0x800) { MOVStts *ctts_data; if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data)) @@ -2043,12 +2043,12 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) unsigned sample_duration = frag->duration; int keyframe; - if (flags & 0x100) sample_duration = get_be32(pb); - if (flags & 0x200) sample_size = get_be32(pb); - if (flags & 0x400) sample_flags = get_be32(pb); + if (flags & 0x100) sample_duration = avio_rb32(pb); + if (flags & 0x200) sample_size = avio_rb32(pb); + if (flags & 0x400) sample_flags = avio_rb32(pb); if (flags & 0x800) { sc->ctts_data[sc->ctts_count].count = 1; - sc->ctts_data[sc->ctts_count].duration = get_be32(pb); + sc->ctts_data[sc->ctts_count].duration = avio_rb32(pb); sc->ctts_count++; } if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO || @@ -2077,11 +2077,11 @@ static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (atom.size < 8) return 0; /* continue */ - if (get_be32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */ + if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */ url_fskip(pb, atom.size - 4); return 0; } - atom.type = get_le32(pb); + atom.type = avio_rl32(pb); atom.size -= 8; if (atom.type != MKTAG('m','d','a','t')) { url_fskip(pb, atom.size); @@ -2100,17 +2100,17 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) long cmov_len, moov_len; int ret = -1; - get_be32(pb); /* dcom atom */ - if (get_le32(pb) != MKTAG('d','c','o','m')) + avio_rb32(pb); /* dcom atom */ + if (avio_rl32(pb) != MKTAG('d','c','o','m')) return -1; - if (get_le32(pb) != MKTAG('z','l','i','b')) { + if (avio_rl32(pb) != MKTAG('z','l','i','b')) { av_log(c->fc, AV_LOG_ERROR, "unknown compression for cmov atom !"); return -1; } - get_be32(pb); /* cmvd atom */ - if (get_le32(pb) != MKTAG('c','m','v','d')) + avio_rb32(pb); /* cmvd atom */ + if (avio_rl32(pb) != MKTAG('c','m','v','d')) return -1; - moov_len = get_be32(pb); /* uncompressed size */ + moov_len = avio_rb32(pb); /* uncompressed size */ cmov_len = atom.size - 6 * 4; cmov_data = av_malloc(cmov_len); @@ -2121,7 +2121,7 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_free(cmov_data); return AVERROR(ENOMEM); } - get_buffer(pb, cmov_data, cmov_len); + avio_read(pb, cmov_data, cmov_len); if(uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK) goto free_and_return; if(ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0) @@ -2152,18 +2152,18 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; sc = c->fc->streams[c->fc->nb_streams-1]->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ - edit_count = get_be32(pb); /* entries */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + edit_count = avio_rb32(pb); /* entries */ if((uint64_t)edit_count*12+8 > atom.size) return -1; for(i=0; i= -1) { sc->time_offset = time != -1 ? time : -duration; } @@ -2314,7 +2314,7 @@ static void mov_read_chapters(AVFormatContext *s) } // the first two bytes are the length of the title - len = get_be16(sc->pb); + len = avio_rb16(sc->pb); if (len > sample->size-2) continue; title_len = 2*len + 1; @@ -2324,7 +2324,7 @@ static void mov_read_chapters(AVFormatContext *s) // The samples could theoretically be in any encoding if there's an encd // atom following, but in practice are only utf-8 or utf-16, distinguished // instead by the presence of a BOM - ch = get_be16(sc->pb); + ch = avio_rb16(sc->pb); if (ch == 0xfeff) avio_get_str16be(sc->pb, len, title, title_len); else if (ch == 0xfffe) diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 5bc4ce64dc..a71638ee13 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -80,7 +80,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) MPADecodeHeader c; int vbrtag_size = 0; - v = get_be32(s->pb); + v = avio_rb32(s->pb); if(ff_mpa_check_header(v) < 0) return -1; @@ -91,25 +91,25 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) /* Check for Xing / Info tag */ url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR); - v = get_be32(s->pb); + v = avio_rb32(s->pb); if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) { - v = get_be32(s->pb); + v = avio_rb32(s->pb); if(v & 0x1) - frames = get_be32(s->pb); + frames = avio_rb32(s->pb); if(v & 0x2) - size = get_be32(s->pb); + size = avio_rb32(s->pb); } /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */ url_fseek(s->pb, base + 4 + 32, SEEK_SET); - v = get_be32(s->pb); + v = avio_rb32(s->pb); if(v == MKBETAG('V', 'B', 'R', 'I')) { /* Check tag version */ - if(get_be16(s->pb) == 1) { + if(avio_rb16(s->pb) == 1) { /* skip delay and quality */ url_fseek(s->pb, 4, SEEK_CUR); - frames = get_be32(s->pb); - size = get_be32(s->pb); + frames = avio_rb32(s->pb); + size = avio_rb32(s->pb); } } diff --git a/libavformat/mpc.c b/libavformat/mpc.c index aa0572603f..73217a31ea 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -55,16 +55,16 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) MPCContext *c = s->priv_data; AVStream *st; - if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){ + if(avio_rl24(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); + c->ver = avio_r8(s->pb); if(c->ver != 0x07 && c->ver != 0x17){ av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver); return -1; } - c->fcount = get_le32(s->pb); + c->fcount = avio_rl32(s->pb); if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){ av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n"); return -1; @@ -85,7 +85,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata_size = 16; st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(s->pb, st->codec->extradata, 16); + avio_read(s->pb, st->codec->extradata, 16); st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3]; av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate); /* scan for seekpoints */ @@ -121,11 +121,11 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) c->curframe++; curbits = c->curbits; pos = url_ftell(s->pb); - tmp = get_le32(s->pb); + tmp = avio_rl32(s->pb); if(curbits <= 12){ size2 = (tmp >> (12 - curbits)) & 0xFFFFF; }else{ - tmp = (tmp << 32) | get_le32(s->pb); + tmp = (tmp << 32) | avio_rl32(s->pb); size2 = (tmp >> (44 - curbits)) & 0xFFFFF; } curbits += 20; @@ -151,7 +151,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->stream_index = 0; pkt->pts = cur; - ret = get_buffer(s->pb, pkt->data + 4, size); + ret = avio_read(s->pb, pkt->data + 4, size); if(c->curbits) url_fseek(s->pb, -4, SEEK_CUR); if(ret < size){ diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index d40a602e83..22439f94a0 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -121,7 +121,7 @@ static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size) { int64_t pos; pos = url_ftell(pb); - *tag = get_le16(pb); + *tag = avio_rl16(pb); *size = ff_get_v(pb); *size -= url_ftell(pb) - pos; } @@ -143,7 +143,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) } if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE))) return; - get_buffer(s->pb, buf, size); + avio_read(s->pb, buf, size); init_get_bits(&gb, buf, size * 8); size = gb_get_v(&gb); if(size > UINT_MAX/4 || size > c->samples/1152){ @@ -195,7 +195,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) int64_t size, pos; c->header_pos = url_ftell(pb); - if(get_le32(pb) != TAG_MPCK){ + if(avio_rl32(pb) != TAG_MPCK){ av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n"); return -1; } @@ -213,7 +213,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) } pos = url_ftell(pb); url_fskip(pb, 4); //CRC - c->ver = get_byte(pb); + c->ver = avio_r8(pb); if(c->ver != 8){ av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver); return -1; @@ -230,7 +230,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata_size = 2; st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, st->codec->extradata, st->codec->extradata_size); + avio_read(pb, st->codec->extradata, st->codec->extradata_size); st->codec->channels = (st->codec->extradata[1] >> 4) + 1; st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5]; diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 66e967c022..c5b6bfc727 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -113,7 +113,7 @@ static int mpegps_read_header(AVFormatContext *s, m->sofdec = -1; do { - v = get_byte(s->pb); + v = avio_r8(s->pb); m->header_state = m->header_state << 8 | v; m->sofdec++; } while (v == sofdec[i] && i++ < 6); @@ -128,8 +128,8 @@ static int64_t get_pts(AVIOContext *pb, int c) { uint8_t buf[5]; - buf[0] = c<0 ? get_byte(pb) : c; - get_buffer(pb, buf+1, 4); + buf[0] = c<0 ? avio_r8(pb) : c; + avio_read(pb, buf+1, 4); return ff_parse_pes_pts(buf); } @@ -145,7 +145,7 @@ static int find_next_start_code(AVIOContext *pb, int *size_ptr, while (n > 0) { if (url_feof(pb)) break; - v = get_byte(pb); + v = avio_r8(pb); n--; if (state == 0x000001) { state = ((state << 8) | v) & 0xffffff; @@ -176,7 +176,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) if (pos < 0) pos = 0; url_fseek(pb, pos, SEEK_SET); - get_byte(pb); + avio_r8(pb); pos = pos_start; for(;;) { @@ -186,7 +186,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) goto the_end; } url_fseek(pb, pos, SEEK_SET); - start_code = get_be32(pb); + start_code = avio_rb32(pb); if ((start_code & 0xffffff00) == 0x100) break; } @@ -206,27 +206,27 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) { int psm_length, ps_info_length, es_map_length; - psm_length = get_be16(pb); - get_byte(pb); - get_byte(pb); - ps_info_length = get_be16(pb); + psm_length = avio_rb16(pb); + avio_r8(pb); + avio_r8(pb); + ps_info_length = avio_rb16(pb); /* skip program_stream_info */ url_fskip(pb, ps_info_length); - es_map_length = get_be16(pb); + es_map_length = avio_rb16(pb); /* at least one es available? */ while (es_map_length >= 4){ - unsigned char type = get_byte(pb); - unsigned char es_id = get_byte(pb); - uint16_t es_info_length = get_be16(pb); + unsigned char type = avio_r8(pb); + unsigned char es_id = avio_r8(pb); + uint16_t es_info_length = avio_rb16(pb); /* remember mapping from stream id to stream type */ m->psm_es_type[es_id] = type; /* skip program_stream_info */ url_fskip(pb, es_info_length); es_map_length -= 4 + es_info_length; } - get_be32(pb); /* crc32 */ + avio_rb32(pb); /* crc32 */ return 2 + psm_length; } @@ -264,16 +264,16 @@ static int mpegps_read_pes_header(AVFormatContext *s, if (startcode == SYSTEM_HEADER_START_CODE) goto redo; if (startcode == PADDING_STREAM) { - url_fskip(s->pb, get_be16(s->pb)); + url_fskip(s->pb, avio_rb16(s->pb)); goto redo; } if (startcode == PRIVATE_STREAM_2) { - len = get_be16(s->pb); + len = avio_rb16(s->pb); if (!m->sofdec) { while (len-- >= 6) { - if (get_byte(s->pb) == 'S') { + if (avio_r8(s->pb) == 'S') { uint8_t buf[5]; - get_buffer(s->pb, buf, sizeof(buf)); + avio_read(s->pb, buf, sizeof(buf)); m->sofdec = !memcmp(buf, "ofdec", 5); len -= sizeof(buf); break; @@ -297,14 +297,14 @@ static int mpegps_read_pes_header(AVFormatContext *s, if (ppos) { *ppos = url_ftell(s->pb) - 4; } - len = get_be16(s->pb); + len = avio_rb16(s->pb); pts = dts = AV_NOPTS_VALUE; /* stuffing */ for(;;) { if (len < 1) goto error_redo; - c = get_byte(s->pb); + c = avio_r8(s->pb); len--; /* XXX: for mpeg1, should test only bit 7 */ if (c != 0xff) @@ -312,8 +312,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, } if ((c & 0xc0) == 0x40) { /* buffer scale & size */ - get_byte(s->pb); - c = get_byte(s->pb); + avio_r8(s->pb); + c = avio_r8(s->pb); len -= 2; } if ((c & 0xe0) == 0x20) { @@ -331,8 +331,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, goto redo; } #endif - flags = get_byte(s->pb); - header_len = get_byte(s->pb); + flags = avio_r8(s->pb); + header_len = avio_r8(s->pb); len -= 2; if (header_len > len) goto error_redo; @@ -350,7 +350,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n"); } if (flags & 0x01) { /* PES extension */ - pes_ext = get_byte(s->pb); + pes_ext = avio_r8(s->pb); header_len--; /* Skip PES private data, program packet sequence counter and P-STD buffer */ skip = (pes_ext >> 4) & 0xb; @@ -363,10 +363,10 @@ static int mpegps_read_pes_header(AVFormatContext *s, header_len -= skip; if (pes_ext & 0x01) { /* PES extension 2 */ - ext2_len = get_byte(s->pb); + ext2_len = avio_r8(s->pb); header_len--; if ((ext2_len & 0x7f) > 0) { - id_ext = get_byte(s->pb); + id_ext = avio_r8(s->pb); if ((id_ext & 0x80) == 0) startcode = ((startcode & 0xff) << 8) | id_ext; header_len--; @@ -381,17 +381,17 @@ static int mpegps_read_pes_header(AVFormatContext *s, goto redo; if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) { - startcode = get_byte(s->pb); + startcode = avio_r8(s->pb); len--; if (startcode >= 0x80 && startcode <= 0xcf) { /* audio: skip header */ - get_byte(s->pb); - get_byte(s->pb); - get_byte(s->pb); + avio_r8(s->pb); + avio_r8(s->pb); + avio_r8(s->pb); len -= 3; if (startcode >= 0xb0 && startcode <= 0xbf) { /* MLP/TrueHD audio has a 4-byte header */ - get_byte(s->pb); + avio_r8(s->pb); len--; } } @@ -432,7 +432,7 @@ static int mpegps_read_packet(AVFormatContext *s, return len; if(startcode == 0x1bd) { - dvdaudio_substream_type = get_byte(s->pb); + dvdaudio_substream_type = avio_r8(s->pb); url_fskip(s->pb, 3); len -= 4; } @@ -474,7 +474,7 @@ static int mpegps_read_packet(AVFormatContext *s, } else if (startcode >= 0x1e0 && startcode <= 0x1ef) { static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; unsigned char buf[8]; - get_buffer(s->pb, buf, 8); + avio_read(s->pb, buf, 8); url_fseek(s->pb, -8, SEEK_CUR); if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) codec_id = CODEC_ID_CAVS; @@ -547,9 +547,9 @@ static int mpegps_read_packet(AVFormatContext *s, audio data */ if (len <= 3) goto skip; - get_byte(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */ - b1 = get_byte(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */ - get_byte(s->pb); /* dynamic range control (0x80 = off) */ + avio_r8(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */ + b1 = avio_r8(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */ + avio_r8(s->pb); /* dynamic range control (0x80 = off) */ len -= 3; freq = (b1 >> 4) & 3; st->codec->sample_rate = lpcm_freq_tab[freq]; @@ -564,7 +564,7 @@ static int mpegps_read_packet(AVFormatContext *s, return AVERROR(EINVAL); } av_new_packet(pkt, len); - get_buffer(s->pb, pkt->data, pkt->size); + avio_read(s->pb, pkt->data, pkt->size); pkt->pts = pts; pkt->dts = dts; pkt->pos = dummy_pos; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index fb45e60844..3307685b41 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -860,24 +860,24 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size, len = ff_mp4_read_descr(s, &pb, &tag); if (tag == MP4IODescrTag) { - get_be16(&pb); // ID - get_byte(&pb); - get_byte(&pb); - get_byte(&pb); - get_byte(&pb); - get_byte(&pb); + avio_rb16(&pb); // ID + avio_r8(&pb); + avio_r8(&pb); + avio_r8(&pb); + avio_r8(&pb); + avio_r8(&pb); len = ff_mp4_read_descr(s, &pb, &tag); if (tag == MP4ESDescrTag) { - *es_id = get_be16(&pb); /* ES_ID */ + *es_id = avio_rb16(&pb); /* ES_ID */ av_dlog(s, "ES_ID %#x\n", *es_id); - get_byte(&pb); /* priority */ + avio_r8(&pb); /* priority */ len = ff_mp4_read_descr(s, &pb, &tag); if (tag == MP4DecConfigDescrTag) { *dec_config_descr = av_malloc(len); if (!*dec_config_descr) return AVERROR(ENOMEM); *dec_config_descr_size = len; - get_buffer(&pb, *dec_config_descr, len); + avio_read(&pb, *dec_config_descr, len); } } } @@ -1332,7 +1332,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) int skip, len; for(;;) { - len = get_buffer(pb, buf, TS_PACKET_SIZE); + len = avio_read(pb, buf, TS_PACKET_SIZE); if (len != TS_PACKET_SIZE) return AVERROR(EIO); /* check paquet sync byte */ @@ -1455,7 +1455,7 @@ static int mpegts_read_header(AVFormatContext *s, /* read the first 1024 bytes to get packet size */ pos = url_ftell(pb); - len = get_buffer(pb, buf, sizeof(buf)); + len = avio_read(pb, buf, sizeof(buf)); if (len != sizeof(buf)) goto fail; ts->raw_packet_size = get_packet_size(buf, sizeof(buf)); @@ -1565,7 +1565,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, pos = url_ftell(s->pb); for(i = 0; i < MAX_PACKET_READAHEAD; i++) { url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET); - get_buffer(s->pb, pcr_buf, 12); + avio_read(s->pb, pcr_buf, 12); if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) { /* XXX: not precise enough */ ts->pcr_incr = ((next_pcr_h - pcr_h) * 300 + (next_pcr_l - pcr_l)) / @@ -1650,7 +1650,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, if (find_next) { for(;;) { url_fseek(s->pb, pos, SEEK_SET); - if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) + if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && parse_pcr(×tamp, &pcr_l, buf) == 0) { @@ -1664,7 +1664,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, if (pos < 0) return AV_NOPTS_VALUE; url_fseek(s->pb, pos, SEEK_SET); - if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) + if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && parse_pcr(×tamp, &pcr_l, buf) == 0) { @@ -1775,7 +1775,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in for(;;) { url_fseek(s->pb, pos, SEEK_SET); - if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) + if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return -1; // pid = AV_RB16(buf + 1) & 0x1fff; if(buf[1] & 0x40) break; diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index 4408c18601..3033c23a91 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -88,7 +88,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) /* Some files start with "connected\r\n\r\n". * So skip until we find the first byte of struct size */ - while(get_byte(pb) != HEADER_SIZE && !url_feof(pb)); + while(avio_r8(pb) != HEADER_SIZE && !url_feof(pb)); if(url_feof(pb)) { av_log(ctx, AV_LOG_ERROR, "Could not find valid start."); @@ -107,11 +107,11 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) url_fskip(pb, 1); /* one byte has been read ahead */ url_fskip(pb, 2); url_fskip(pb, 2); - keyframe = get_le16(pb); - size = get_le32(pb); + keyframe = avio_rl16(pb); + size = avio_rl32(pb); url_fskip(pb, 4); url_fskip(pb, 4); - timestamp = get_le32(pb); + timestamp = avio_rl32(pb); if(!size || av_get_packet(pb, pkt, size) != size) return -1; diff --git a/libavformat/mtv.c b/libavformat/mtv.c index d6f8a2018b..94d8aff548 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -84,16 +84,16 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) unsigned int audio_subsegments; url_fskip(pb, 3); - mtv->file_size = get_le32(pb); - mtv->segments = get_le32(pb); + mtv->file_size = avio_rl32(pb); + mtv->segments = avio_rl32(pb); url_fskip(pb, 32); - mtv->audio_identifier = get_le24(pb); - mtv->audio_br = get_le16(pb); - mtv->img_colorfmt = get_le24(pb); - mtv->img_bpp = get_byte(pb); - mtv->img_width = get_le16(pb); - mtv->img_height = get_le16(pb); - mtv->img_segment_size = get_le16(pb); + mtv->audio_identifier = avio_rl24(pb); + mtv->audio_br = avio_rl16(pb); + mtv->img_colorfmt = avio_rl24(pb); + mtv->img_bpp = avio_r8(pb); + mtv->img_width = avio_rl16(pb); + mtv->img_height = avio_rl16(pb); + mtv->img_segment_size = avio_rl16(pb); /* Calculate width and height if missing from header */ @@ -106,7 +106,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) / mtv->img_width; url_fskip(pb, 4); - audio_subsegments = get_le16(pb); + audio_subsegments = avio_rl16(pb); mtv->full_segment_size = audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) + mtv->img_segment_size; diff --git a/libavformat/mvi.c b/libavformat/mvi.c index 053de15a5a..4784efae0d 100644 --- a/libavformat/mvi.c +++ b/libavformat/mvi.c @@ -53,20 +53,20 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) vst->codec->extradata_size = 2; vst->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE); - version = get_byte(pb); - vst->codec->extradata[0] = get_byte(pb); - vst->codec->extradata[1] = get_byte(pb); - frames_count = get_le32(pb); - msecs_per_frame = get_le32(pb); - vst->codec->width = get_le16(pb); - vst->codec->height = get_le16(pb); - get_byte(pb); - ast->codec->sample_rate = get_le16(pb); - mvi->audio_data_size = get_le32(pb); - get_byte(pb); - player_version = get_le32(pb); - get_le16(pb); - get_byte(pb); + version = avio_r8(pb); + vst->codec->extradata[0] = avio_r8(pb); + vst->codec->extradata[1] = avio_r8(pb); + frames_count = avio_rl32(pb); + msecs_per_frame = avio_rl32(pb); + vst->codec->width = avio_rl16(pb); + vst->codec->height = avio_rl16(pb); + avio_r8(pb); + ast->codec->sample_rate = avio_rl16(pb); + mvi->audio_data_size = avio_rl32(pb); + avio_r8(pb); + player_version = avio_rl32(pb); + avio_rl16(pb); + avio_r8(pb); if (frames_count == 0 || mvi->audio_data_size == 0) return AVERROR_INVALIDDATA; @@ -87,7 +87,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_MOTIONPIXELS; - mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? get_le16 : get_le24; + mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_rl16 : avio_rl24; mvi->audio_frame_size = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count; mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size; diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 6246fca0aa..9f694e30ff 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -163,7 +163,7 @@ static const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x static int64_t klv_decode_ber_length(AVIOContext *pb) { - uint64_t size = get_byte(pb); + uint64_t size = avio_r8(pb); if (size & 0x80) { /* long form */ int bytes_num = size & 0x7f; /* SMPTE 379M 5.3.4 guarantee that bytes_num must not exceed 8 bytes */ @@ -171,7 +171,7 @@ static int64_t klv_decode_ber_length(AVIOContext *pb) return -1; size = 0; while (bytes_num--) - size = size << 8 | get_byte(pb); + size = size << 8 | avio_r8(pb); } return size; } @@ -180,7 +180,7 @@ static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size) { int i, b; for (i = 0; i < size && !url_feof(pb); i++) { - b = get_byte(pb); + b = avio_r8(pb); if (b == key[0]) i = 0; else if (b != key[i]) @@ -195,7 +195,7 @@ static int klv_read_packet(KLVPacket *klv, AVIOContext *pb) return -1; klv->offset = url_ftell(pb) - 4; memcpy(klv->key, mxf_klv_key, 4); - get_buffer(pb, klv->key + 4, 12); + avio_read(pb, klv->key + 4, 12); klv->length = klv_decode_ber_length(pb); return klv->length == -1 ? -1 : 0; } @@ -224,7 +224,7 @@ static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, if (length > 61444) /* worst case PAL 1920 samples 8 channels */ return -1; av_new_packet(pkt, length); - get_buffer(pb, pkt->data, length); + avio_read(pb, pkt->data, length); data_ptr = pkt->data; end_ptr = pkt->data + length; buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */ @@ -265,10 +265,10 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv url_fskip(pb, klv_decode_ber_length(pb)); // plaintext offset klv_decode_ber_length(pb); - plaintext_size = get_be64(pb); + plaintext_size = avio_rb64(pb); // source klv key klv_decode_ber_length(pb); - get_buffer(pb, klv->key, 16); + avio_read(pb, klv->key, 16); if (!IS_KLV_KEY(klv, mxf_essence_element_key)) return -1; index = mxf_get_stream_index(s, klv); @@ -276,15 +276,15 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv return -1; // source size klv_decode_ber_length(pb); - orig_size = get_be64(pb); + orig_size = avio_rb64(pb); if (orig_size < plaintext_size) return -1; // enc. code size = klv_decode_ber_length(pb); if (size < 32 || size - 32 < orig_size) return -1; - get_buffer(pb, ivec, 16); - get_buffer(pb, tmpbuf, 16); + avio_read(pb, ivec, 16); + avio_read(pb, tmpbuf, 16); if (mxf->aesc) av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1); if (memcmp(tmpbuf, checkv, 16)) @@ -347,8 +347,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFContext *mxf = arg; - int item_num = get_be32(pb); - int item_len = get_be32(pb); + int item_num = avio_rb32(pb); + int item_len = avio_rb32(pb); if (item_len != 18) { av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); @@ -360,7 +360,7 @@ static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, U mxf->local_tags = av_malloc(item_num*item_len); if (!mxf->local_tags) return -1; - get_buffer(pb, mxf->local_tags, item_num*item_len); + avio_read(pb, mxf->local_tags, item_num*item_len); return 0; } @@ -382,7 +382,7 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i if (size != 16) return -1; if (IS_KLV_KEY(uid, mxf_crypto_source_container_ul)) - get_buffer(pb, cryptocontext->source_container_ul, 16); + avio_read(pb, cryptocontext->source_container_ul, 16); return 0; } @@ -391,14 +391,14 @@ static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int siz MXFContext *mxf = arg; switch (tag) { case 0x1901: - mxf->packages_count = get_be32(pb); + mxf->packages_count = avio_rb32(pb); if (mxf->packages_count >= UINT_MAX / sizeof(UID)) return -1; mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID)); if (!mxf->packages_refs) return -1; url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); + avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); break; } return 0; @@ -409,18 +409,18 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U MXFStructuralComponent *source_clip = arg; switch(tag) { case 0x0202: - source_clip->duration = get_be64(pb); + source_clip->duration = avio_rb64(pb); break; case 0x1201: - source_clip->start_position = get_be64(pb); + source_clip->start_position = avio_rb64(pb); break; case 0x1101: /* UMID, only get last 16 bytes */ url_fskip(pb, 16); - get_buffer(pb, source_clip->source_package_uid, 16); + avio_read(pb, source_clip->source_package_uid, 16); break; case 0x1102: - source_clip->source_track_id = get_be32(pb); + source_clip->source_track_id = avio_rb32(pb); break; } return 0; @@ -431,14 +431,14 @@ static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int si MXFPackage *package = arg; switch(tag) { case 0x4403: - package->tracks_count = get_be32(pb); + package->tracks_count = avio_rb32(pb); if (package->tracks_count >= UINT_MAX / sizeof(UID)) return -1; package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); if (!package->tracks_refs) return -1; url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); + avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; } return 0; @@ -449,17 +449,17 @@ static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid MXFTrack *track = arg; switch(tag) { case 0x4801: - track->track_id = get_be32(pb); + track->track_id = avio_rb32(pb); break; case 0x4804: - get_buffer(pb, track->track_number, 4); + avio_read(pb, track->track_number, 4); break; case 0x4B01: - track->edit_rate.den = get_be32(pb); - track->edit_rate.num = get_be32(pb); + track->edit_rate.den = avio_rb32(pb); + track->edit_rate.num = avio_rb32(pb); break; case 0x4803: - get_buffer(pb, track->sequence_ref, 16); + avio_read(pb, track->sequence_ref, 16); break; } return 0; @@ -470,20 +470,20 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID MXFSequence *sequence = arg; switch(tag) { case 0x0202: - sequence->duration = get_be64(pb); + sequence->duration = avio_rb64(pb); break; case 0x0201: - get_buffer(pb, sequence->data_definition_ul, 16); + avio_read(pb, sequence->data_definition_ul, 16); break; case 0x1001: - sequence->structural_components_count = get_be32(pb); + sequence->structural_components_count = avio_rb32(pb); if (sequence->structural_components_count >= UINT_MAX / sizeof(UID)) return -1; sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID)); if (!sequence->structural_components_refs) return -1; url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); + avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); break; } return 0; @@ -494,22 +494,22 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size MXFPackage *package = arg; switch(tag) { case 0x4403: - package->tracks_count = get_be32(pb); + package->tracks_count = avio_rb32(pb); if (package->tracks_count >= UINT_MAX / sizeof(UID)) return -1; package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); if (!package->tracks_refs) return -1; url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); + avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; case 0x4401: /* UMID, only get last 16 bytes */ url_fskip(pb, 16); - get_buffer(pb, package->package_uid, 16); + avio_read(pb, package->package_uid, 16); break; case 0x4701: - get_buffer(pb, package->descriptor_ref, 16); + avio_read(pb, package->descriptor_ref, 16); break; } return 0; @@ -518,12 +518,12 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid) { switch(tag) { - case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break; - case 0x3F06: av_dlog(NULL, "IndexSID %d\n", get_be32(pb)); break; - case 0x3F07: av_dlog(NULL, "BodySID %d\n", get_be32(pb)); break; - case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", get_be32(pb), get_be32(pb)); break; - case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", get_be64(pb)); break; - case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", get_be64(pb)); break; + case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", avio_rb32(pb)); break; + case 0x3F06: av_dlog(NULL, "IndexSID %d\n", avio_rb32(pb)); break; + case 0x3F07: av_dlog(NULL, "BodySID %d\n", avio_rb32(pb)); break; + case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", avio_rb32(pb), avio_rb32(pb)); break; + case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", avio_rb64(pb)); break; + case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", avio_rb64(pb)); break; } return 0; } @@ -534,8 +534,8 @@ static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor) char layout[16] = {0}; do { - code = get_byte(pb); - value = get_byte(pb); + code = avio_r8(pb); + value = avio_r8(pb); av_dlog(NULL, "pixel layout: code %#x\n", code); if (ofs < 16) { @@ -552,46 +552,46 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int MXFDescriptor *descriptor = arg; switch(tag) { case 0x3F01: - descriptor->sub_descriptors_count = get_be32(pb); + descriptor->sub_descriptors_count = avio_rb32(pb); if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID)) return -1; descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID)); if (!descriptor->sub_descriptors_refs) return -1; url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); + avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); break; case 0x3004: - get_buffer(pb, descriptor->essence_container_ul, 16); + avio_read(pb, descriptor->essence_container_ul, 16); break; case 0x3006: - descriptor->linked_track_id = get_be32(pb); + descriptor->linked_track_id = avio_rb32(pb); break; case 0x3201: /* PictureEssenceCoding */ - get_buffer(pb, descriptor->essence_codec_ul, 16); + avio_read(pb, descriptor->essence_codec_ul, 16); break; case 0x3203: - descriptor->width = get_be32(pb); + descriptor->width = avio_rb32(pb); break; case 0x3202: - descriptor->height = get_be32(pb); + descriptor->height = avio_rb32(pb); break; case 0x320E: - descriptor->aspect_ratio.num = get_be32(pb); - descriptor->aspect_ratio.den = get_be32(pb); + descriptor->aspect_ratio.num = avio_rb32(pb); + descriptor->aspect_ratio.den = avio_rb32(pb); break; case 0x3D03: - descriptor->sample_rate.num = get_be32(pb); - descriptor->sample_rate.den = get_be32(pb); + descriptor->sample_rate.num = avio_rb32(pb); + descriptor->sample_rate.den = avio_rb32(pb); break; case 0x3D06: /* SoundEssenceCompression */ - get_buffer(pb, descriptor->essence_codec_ul, 16); + avio_read(pb, descriptor->essence_codec_ul, 16); break; case 0x3D07: - descriptor->channels = get_be32(pb); + descriptor->channels = avio_rb32(pb); break; case 0x3D01: - descriptor->bits_per_sample = get_be32(pb); + descriptor->bits_per_sample = avio_rb32(pb); break; case 0x3401: mxf_read_pixel_layout(pb, descriptor); @@ -603,7 +603,7 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int if (!descriptor->extradata) return -1; descriptor->extradata_size = size; - get_buffer(pb, descriptor->extradata, size); + avio_read(pb, descriptor->extradata, size); } break; } @@ -871,8 +871,8 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF if (!ctx) return -1; while (url_ftell(pb) + 4 < klv_end) { - int tag = get_be16(pb); - int size = get_be16(pb); /* KLV specified by 0x53 */ + int tag = avio_rb16(pb); + int size = avio_rb16(pb); /* KLV specified by 0x53 */ uint64_t next = url_ftell(pb) + size; UID uid = {0}; @@ -893,7 +893,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF } } if (ctx_size && tag == 0x3C0A) - get_buffer(pb, ctx->uid, 16); + avio_read(pb, ctx->uid, 16); else if (read_child(ctx, pb, tag, size, uid) < 0) return -1; diff --git a/libavformat/mxg.c b/libavformat/mxg.c index 9be97d0d58..81ffec6971 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -115,7 +115,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) if (mxg->soi_ptr) mxg->soi_ptr = mxg->buffer + soi_pos; /* get data */ - ret = get_buffer(s->pb, mxg->buffer_ptr + mxg->cache_size, + ret = avio_read(s->pb, mxg->buffer_ptr + mxg->cache_size, cache_size - mxg->cache_size); if (ret < 0) return ret; diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c index 1472d15ca4..9f62f22ffb 100644 --- a/libavformat/ncdec.c +++ b/libavformat/ncdec.c @@ -68,11 +68,11 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) while (state != NC_VIDEO_FLAG) { if (url_feof(s->pb)) return AVERROR(EIO); - state = (state<<8) + get_byte(s->pb); + state = (state<<8) + avio_r8(s->pb); } - get_byte(s->pb); - size = get_le16(s->pb); + avio_r8(s->pb); + size = avio_rl16(s->pb); url_fskip(s->pb, 9); if (size == 0) { diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 53e3186a25..6ac8866144 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -236,7 +236,7 @@ static int nsv_resync(AVFormatContext *s) return -1; } v <<= 8; - v |= get_byte(pb); + v |= avio_r8(pb); if (i < 8) { av_dlog(s, "NSV resync: [%d] = %02x\n", i, v & 0x0FF); } @@ -277,23 +277,23 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) nsv->state = NSV_UNSYNC; /* in case we fail */ - size = get_le32(pb); + size = avio_rl32(pb); if (size < 28) return -1; nsv->NSVf_end = size; - //s->file_size = (uint32_t)get_le32(pb); - file_size = (uint32_t)get_le32(pb); + //s->file_size = (uint32_t)avio_rl32(pb); + file_size = (uint32_t)avio_rl32(pb); av_dlog(s, "NSV NSVf chunk_size %u\n", size); av_dlog(s, "NSV NSVf file_size %u\n", file_size); - nsv->duration = duration = get_le32(pb); /* in ms */ + nsv->duration = duration = avio_rl32(pb); /* in ms */ av_dlog(s, "NSV NSVf duration %"PRId64" ms\n", duration); // XXX: store it in AVStreams - strings_size = get_le32(pb); - table_entries = get_le32(pb); - table_entries_used = get_le32(pb); + strings_size = avio_rl32(pb); + table_entries = avio_rl32(pb); + table_entries_used = avio_rl32(pb); av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", strings_size, table_entries, table_entries_used); if (url_feof(pb)) @@ -309,7 +309,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) p = strings = av_mallocz(strings_size + 1); endp = strings + strings_size; - get_buffer(pb, strings, strings_size); + avio_read(pb, strings, strings_size); while (p < endp) { while (*p == ' ') p++; /* strip out spaces */ @@ -344,13 +344,13 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t)); for(i=0;insvs_file_offset[i] = get_le32(pb) + size; + nsv->nsvs_file_offset[i] = avio_rl32(pb) + size; if(table_entries > table_entries_used && - get_le32(pb) == MKTAG('T','O','C','2')) { + avio_rl32(pb) == MKTAG('T','O','C','2')) { nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t)); for(i=0;insvs_timestamps[i] = get_le32(pb); + nsv->nsvs_timestamps[i] = avio_rl32(pb); } } } @@ -365,7 +365,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) for (i = 0; i < table_entries; i++) { unsigned char b[8]; url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); - get_buffer(pb, b, 8); + avio_read(pb, b, 8); av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x" "%c%c%c%c%c%c%c%c\n", nsv->nsvs_file_offset[i], size + nsv->nsvs_file_offset[i], @@ -396,11 +396,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) NSVStream *nst; av_dlog(s, "%s()\n", __FUNCTION__); - vtag = get_le32(pb); - atag = get_le32(pb); - vwidth = get_le16(pb); - vheight = get_le16(pb); - i = get_byte(pb); + vtag = avio_rl32(pb); + atag = avio_rl32(pb); + vwidth = avio_rl16(pb); + vheight = avio_rl16(pb); + i = avio_r8(pb); av_dlog(s, "NSV NSVs framerate code %2x\n", i); if(i&0x80) { /* odd way of giving native framerates from docs */ @@ -420,7 +420,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) else framerate= (AVRational){i, 1}; - nsv->avsync = get_le16(pb); + nsv->avsync = avio_rl16(pb); nsv->framerate = framerate; print_tag("NSV NSVs vtag", vtag, 0); @@ -568,16 +568,16 @@ null_chunk_retry: if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF) return -1; - auxcount = get_byte(pb); - vsize = get_le16(pb); - asize = get_le16(pb); + auxcount = avio_r8(pb); + vsize = avio_rl16(pb); + asize = avio_rl16(pb); vsize = (vsize << 4) | (auxcount >> 4); auxcount &= 0x0f; av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize); /* skip aux stuff */ for (i = 0; i < auxcount; i++) { - auxsize = get_le16(pb); - auxtag = get_le32(pb); + auxsize = avio_rl16(pb); + auxtag = avio_rl32(pb); av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n", (auxtag & 0x0ff), ((auxtag >> 8) & 0x0ff), @@ -623,9 +623,9 @@ null_chunk_retry: uint8_t bps; uint8_t channels; uint16_t samplerate; - bps = get_byte(pb); - channels = get_byte(pb); - samplerate = get_le16(pb); + bps = avio_r8(pb); + channels = avio_r8(pb); + samplerate = avio_rl16(pb); asize-=4; av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate); if (fill_header) { diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 86ad9af9f9..a2e6ec17f1 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -39,9 +39,9 @@ static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){ unsigned int len= ff_get_v(bc); if(len && maxlen) - get_buffer(bc, string, FFMIN(len, maxlen)); + avio_read(bc, string, FFMIN(len, maxlen)); while(len > maxlen){ - get_byte(bc); + avio_r8(bc); len--; } @@ -64,8 +64,8 @@ static int64_t get_s(AVIOContext *bc){ static uint64_t get_fourcc(AVIOContext *bc){ unsigned int len= ff_get_v(bc); - if (len==2) return get_le16(bc); - else if(len==4) return get_le32(bc); + if (len==2) return avio_rl16(bc); + else if(len==4) return avio_rl32(bc); else return -1; } @@ -106,7 +106,7 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec init_checksum(bc, ff_crc04C11DB7_update, startcode); size= ff_get_v(bc); if(size > 4096) - get_be32(bc); + avio_rb32(bc); if(get_checksum(bc) && size > 4096) return -1; @@ -122,7 +122,7 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){ url_fseek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are while(!url_feof(bc)){ - state= (state<<8) | get_byte(bc); + state= (state<<8) | avio_r8(bc); if((state>>56) != 'N') continue; switch(state){ @@ -182,7 +182,7 @@ static int skip_reserved(AVIOContext *bc, int64_t pos){ return -1; }else{ while(pos--) - get_byte(bc); + avio_r8(bc); return 0; } } @@ -279,7 +279,7 @@ static int decode_main_header(NUTContext *nut){ return AVERROR_INVALIDDATA; } nut->header[i]= av_malloc(nut->header_len[i]); - get_buffer(bc, nut->header[i], nut->header_len[i]); + avio_read(bc, nut->header[i], nut->header_len[i]); } assert(nut->header_len[0]==0); } @@ -355,7 +355,7 @@ static int decode_stream_header(NUTContext *nut){ GET_V(st->codec->extradata_size, tmp < (1<<30)); if(st->codec->extradata_size){ st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(bc, st->codec->extradata, st->codec->extradata_size); + avio_read(bc, st->codec->extradata, st->codec->extradata_size); } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){ @@ -514,8 +514,8 @@ static int find_and_decode_index(NUTContext *nut){ int ret= -1; url_fseek(bc, filesize-12, SEEK_SET); - url_fseek(bc, filesize-get_be64(bc), SEEK_SET); - if(get_be64(bc) != INDEX_STARTCODE){ + url_fseek(bc, filesize-avio_rb64(bc), SEEK_SET); + if(avio_rb64(bc) != INDEX_STARTCODE){ av_log(s, AV_LOG_ERROR, "no index at the end\n"); return -1; } @@ -722,7 +722,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui size -= nut->header_len[*header_idx]; if(flags&FLAG_CHECKSUM){ - get_be32(bc); //FIXME check this + avio_rb32(bc); //FIXME check this }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){ av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n"); return AVERROR_INVALIDDATA; @@ -764,7 +764,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ av_new_packet(pkt, size + nut->header_len[header_idx]); memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]); pkt->pos= url_ftell(bc); //FIXME - get_buffer(bc, pkt->data + nut->header_len[header_idx], size); + avio_read(bc, pkt->data + nut->header_len[header_idx], size); pkt->stream_index = stream_id; if (stc->last_flags & FLAG_KEY) @@ -789,13 +789,13 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) if(tmp){ pos-=8; }else{ - frame_code = get_byte(bc); + frame_code = avio_r8(bc); if(url_feof(bc)) return -1; if(frame_code == 'N'){ tmp= frame_code; for(i=1; i<8; i++) - tmp = (tmp<<8) + get_byte(bc); + tmp = (tmp<<8) + avio_r8(bc); } } switch(tmp){ @@ -812,7 +812,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) case SYNCPOINT_STARTCODE: if(decode_syncpoint(nut, &ts, &back_ptr)<0) goto resync; - frame_code = get_byte(bc); + frame_code = avio_r8(bc); case 0: ret= decode_frame(nut, pkt, frame_code); if(ret==0) diff --git a/libavformat/nuv.c b/libavformat/nuv.c index 055a6dce60..e360a64cfb 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -62,16 +62,16 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, return 1; // no codec data needed while (!url_feof(pb)) { int size, subtype; - frametype = get_byte(pb); + frametype = avio_r8(pb); switch (frametype) { case NUV_EXTRADATA: - subtype = get_byte(pb); + subtype = avio_r8(pb); url_fskip(pb, 6); - size = PKTSIZE(get_le32(pb)); + size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { vst->codec->extradata_size = size; vst->codec->extradata = av_malloc(size); - get_buffer(pb, vst->codec->extradata, size); + avio_read(pb, vst->codec->extradata, size); size = 0; if (!myth) return 1; @@ -79,12 +79,12 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, break; case NUV_MYTHEXT: url_fskip(pb, 7); - size = PKTSIZE(get_le32(pb)); + size = PKTSIZE(avio_rl32(pb)); if (size != 128 * 4) break; - get_le32(pb); // version + avio_rl32(pb); // version if (vst) { - vst->codec->codec_tag = get_le32(pb); + vst->codec->codec_tag = avio_rl32(pb); vst->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag); if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G')) @@ -93,10 +93,10 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, url_fskip(pb, 4); if (ast) { - ast->codec->codec_tag = get_le32(pb); - ast->codec->sample_rate = get_le32(pb); - ast->codec->bits_per_coded_sample = get_le32(pb); - ast->codec->channels = get_le32(pb); + ast->codec->codec_tag = avio_rl32(pb); + ast->codec->sample_rate = avio_rl32(pb); + ast->codec->bits_per_coded_sample = avio_rl32(pb); + ast->codec->channels = avio_rl32(pb); ast->codec->codec_id = ff_wav_codec_get_id(ast->codec->codec_tag, ast->codec->bits_per_coded_sample); @@ -112,7 +112,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, break; default: url_fskip(pb, 7); - size = PKTSIZE(get_le32(pb)); + size = PKTSIZE(avio_rl32(pb)); break; } url_fskip(pb, size); @@ -128,27 +128,27 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { int is_mythtv, width, height, v_packs, a_packs; int stream_nr = 0; AVStream *vst = NULL, *ast = NULL; - get_buffer(pb, id_string, 12); + avio_read(pb, id_string, 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12); url_fskip(pb, 5); // version string url_fskip(pb, 3); // padding - width = get_le32(pb); - height = get_le32(pb); - get_le32(pb); // unused, "desiredwidth" - get_le32(pb); // unused, "desiredheight" - get_byte(pb); // 'P' == progressive, 'I' == interlaced + width = avio_rl32(pb); + height = avio_rl32(pb); + avio_rl32(pb); // unused, "desiredwidth" + avio_rl32(pb); // unused, "desiredheight" + avio_r8(pb); // 'P' == progressive, 'I' == interlaced url_fskip(pb, 3); // padding - aspect = av_int2dbl(get_le64(pb)); + aspect = av_int2dbl(avio_rl64(pb)); if (aspect > 0.9999 && aspect < 1.0001) aspect = 4.0 / 3.0; - fps = av_int2dbl(get_le64(pb)); + fps = av_int2dbl(avio_rl64(pb)); // number of packets per stream type, -1 means unknown, e.g. streaming - v_packs = get_le32(pb); - a_packs = get_le32(pb); - get_le32(pb); // text + v_packs = avio_rl32(pb); + a_packs = avio_rl32(pb); + avio_rl32(pb); // text - get_le32(pb); // keyframe distance (?) + avio_rl32(pb); // keyframe distance (?) if (v_packs) { ctx->v_id = stream_nr++; @@ -198,7 +198,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { while (!url_feof(pb)) { int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0; uint64_t pos = url_ftell(pb); - ret = get_buffer(pb, hdr, HDRSIZE); + ret = avio_read(pb, hdr, HDRSIZE); if (ret < HDRSIZE) return ret < 0 ? ret : AVERROR(EIO); frametype = hdr[0]; @@ -225,7 +225,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { pkt->pts = AV_RL32(&hdr[4]); pkt->stream_index = ctx->v_id; memcpy(pkt->data, hdr, copyhdrsize); - ret = get_buffer(pb, pkt->data + copyhdrsize, size); + ret = avio_read(pb, pkt->data + copyhdrsize, size); if (ret < 0) { av_free_packet(pkt); return ret; diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index d508fe32d2..a79cd3ef9d 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -207,7 +207,7 @@ ogg_read_page (AVFormatContext * s, int *str) uint8_t sync[4]; int sp = 0; - if (get_buffer (bc, sync, 4) < 4) + if (avio_read (bc, sync, 4) < 4) return -1; do{ @@ -233,10 +233,10 @@ ogg_read_page (AVFormatContext * s, int *str) return -1; flags = url_fgetc (bc); - gp = get_le64 (bc); - serial = get_le32 (bc); - seq = get_le32 (bc); - crc = get_le32 (bc); + gp = avio_rl64 (bc); + serial = avio_rl32 (bc); + seq = avio_rl32 (bc); + crc = avio_rl32 (bc); nsegs = url_fgetc (bc); idx = ogg_find_stream (ogg, serial); @@ -252,7 +252,7 @@ ogg_read_page (AVFormatContext * s, int *str) if(os->psize > 0) ogg_new_buf(ogg, idx); - if (get_buffer (bc, os->segments, nsegs) < nsegs) + if (avio_read (bc, os->segments, nsegs) < nsegs) return -1; os->nsegs = nsegs; @@ -284,7 +284,7 @@ ogg_read_page (AVFormatContext * s, int *str) os->buf = nb; } - if (get_buffer (bc, os->buf + os->bufpos, size) < size) + if (avio_read (bc, os->buf + os->bufpos, size) < size) return -1; os->bufpos += size; diff --git a/libavformat/oma.c b/libavformat/oma.c index 158ed117c3..03dc1e9d8b 100644 --- a/libavformat/oma.c +++ b/libavformat/oma.c @@ -79,7 +79,7 @@ static int oma_read_header(AVFormatContext *s, AVStream *st; ff_id3v2_read(s, ID3v2_EA3_MAGIC); - ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE); + ret = avio_read(s->pb, buf, EA3_HEADER_SIZE); if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) { av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n"); diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index bffb72c4d4..69013c5f58 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -105,7 +105,7 @@ static int str_read_header(AVFormatContext *s, int i; /* skip over any RIFF header */ - if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE) + if (avio_read(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE) return AVERROR(EIO); if (AV_RL32(§or[0]) == RIFF_TAG) start = RIFF_HEADER_SIZE; @@ -136,7 +136,7 @@ static int str_read_packet(AVFormatContext *s, while (1) { - if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE) + if (avio_read(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE) return AVERROR(EIO); channel = sector[0x11]; diff --git a/libavformat/pva.c b/libavformat/pva.c index 9b370cea4d..ea7db47c76 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -75,12 +75,12 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, recover: startpos = url_ftell(pb); - syncword = get_be16(pb); - streamid = get_byte(pb); - get_byte(pb); /* counter not used */ - reserved = get_byte(pb); - flags = get_byte(pb); - length = get_be16(pb); + syncword = avio_rb16(pb); + streamid = avio_r8(pb); + avio_r8(pb); /* counter not used */ + reserved = avio_r8(pb); + flags = avio_r8(pb); + length = avio_rb16(pb); pts_flag = flags & 0x10; @@ -101,7 +101,7 @@ recover: } if (streamid == PVA_VIDEO_PAYLOAD && pts_flag) { - pva_pts = get_be32(pb); + pva_pts = avio_rb32(pb); length -= 4; } else if (streamid == PVA_AUDIO_PAYLOAD) { /* PVA Audio Packets either start with a signaled PES packet or @@ -113,11 +113,11 @@ recover: pes_flags; unsigned char pes_header_data[256]; - pes_signal = get_be24(pb); - get_byte(pb); - pes_packet_length = get_be16(pb); - pes_flags = get_be16(pb); - pes_header_data_length = get_byte(pb); + pes_signal = avio_rb24(pb); + avio_r8(pb); + pes_packet_length = avio_rb16(pb); + pes_flags = avio_rb16(pb); + pes_header_data_length = avio_r8(pb); if (pes_signal != 1) { pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, " @@ -128,7 +128,7 @@ recover: goto recover; } - get_buffer(pb, pes_header_data, pes_header_data_length); + avio_read(pb, pes_header_data, pes_header_data_length); length -= 9 + pes_header_data_length; pes_packet_length -= 3 + pes_header_data_length; diff --git a/libavformat/qcp.c b/libavformat/qcp.c index 48b5d64c2d..2c1fa3c635 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -91,13 +91,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!st) return AVERROR(ENOMEM); - get_be32(pb); // "RIFF" - s->file_size = get_le32(pb) + 8; + avio_rb32(pb); // "RIFF" + s->file_size = avio_rl32(pb) + 8; url_fskip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->channels = 1; - get_buffer(pb, buf, 16); + avio_read(pb, buf, 16); if (is_qcelp_13k_guid(buf)) { st->codec->codec_id = CODEC_ID_QCELP; } else if (!memcmp(buf, guid_evrc, 16)) { @@ -111,19 +111,19 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR_INVALIDDATA; } url_fskip(pb, 2 + 80); // codec-version + codec-name - st->codec->bit_rate = get_le16(pb); + st->codec->bit_rate = avio_rl16(pb); - s->packet_size = get_le16(pb); + s->packet_size = avio_rl16(pb); url_fskip(pb, 2); // block-size - st->codec->sample_rate = get_le16(pb); + st->codec->sample_rate = avio_rl16(pb); url_fskip(pb, 2); // sample-size memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode)); - nb_rates = get_le32(pb); + nb_rates = avio_rl32(pb); nb_rates = FFMIN(nb_rates, 8); for (i=0; i QCP_MAX_MODE) { av_log(s, AV_LOG_WARNING, "Unknown entry %d=>%d in rate-map-table.\n ", mode, size); } else @@ -142,7 +142,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) while(!url_feof(pb)) { if (c->data_size) { - int pkt_size, ret, mode = get_byte(pb); + int pkt_size, ret, mode = avio_r8(pb); if (s->packet_size) { pkt_size = s->packet_size - 1; @@ -165,14 +165,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } - if (url_ftell(pb) & 1 && get_byte(pb)) + if (url_ftell(pb) & 1 && avio_r8(pb)) av_log(s, AV_LOG_WARNING, "Padding should be 0.\n"); - tag = get_le32(pb); - chunk_size = get_le32(pb); + tag = avio_rl32(pb); + chunk_size = avio_rl32(pb); switch (tag) { case MKTAG('v', 'r', 'a', 't'): - if (get_le32(pb)) // var-rate-flag + if (avio_rl32(pb)) // var-rate-flag s->packet_size = 0; url_fskip(pb, 4); // size-in-packets break; diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 9c9fa1bbcb..bb39e03e50 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -39,10 +39,10 @@ typedef struct { static int read_atom(AVFormatContext *s, Atom *atom) { atom->offset = url_ftell(s->pb); - atom->size = get_be32(s->pb); + atom->size = avio_rb32(s->pb); if (atom->size < 8) return -1; - atom->tag = get_le32(s->pb); + atom->tag = avio_rl32(s->pb); av_dlog(s, "atom %d %.4s offset %#llx\n", atom->size, (char*)&atom->tag, atom->offset); return atom->size; @@ -59,31 +59,31 @@ static int r3d_read_red1(AVFormatContext *s) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_JPEG2000; - tmp = get_byte(s->pb); // major version - tmp2 = get_byte(s->pb); // minor version + tmp = avio_r8(s->pb); // major version + tmp2 = avio_r8(s->pb); // minor version av_dlog(s, "version %d.%d\n", tmp, tmp2); - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown1 %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_set_pts_info(st, 32, 1, tmp); - tmp = get_be32(s->pb); // filenum + tmp = avio_rb32(s->pb); // filenum av_dlog(s, "filenum %d\n", tmp); url_fskip(s->pb, 32); // unknown - st->codec->width = get_be32(s->pb); - st->codec->height = get_be32(s->pb); + st->codec->width = avio_rb32(s->pb); + st->codec->height = avio_rb32(s->pb); - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown2 %d\n", tmp); - st->codec->time_base.den = get_be16(s->pb); - st->codec->time_base.num = get_be16(s->pb); + st->codec->time_base.den = avio_rb16(s->pb); + st->codec->time_base.num = avio_rb16(s->pb); - tmp = get_byte(s->pb); // audio channels + tmp = avio_r8(s->pb); // audio channels av_dlog(s, "audio channels %d\n", tmp); if (tmp > 0) { AVStream *ast = av_new_stream(s, 1); @@ -95,7 +95,7 @@ static int r3d_read_red1(AVFormatContext *s) av_set_pts_info(ast, 32, 1, st->time_base.den); } - get_buffer(s->pb, filename, 257); + avio_read(s->pb, filename, 257); filename[sizeof(filename)-1] = 0; av_metadata_set2(&st->metadata, "filename", filename, 0); @@ -120,7 +120,7 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom) return AVERROR(ENOMEM); for (i = 0; i < r3d->video_offsets_count; i++) { - r3d->video_offsets[i] = get_be32(s->pb); + r3d->video_offsets[i] = avio_rb32(s->pb); if (!r3d->video_offsets[i]) { r3d->video_offsets_count = i; break; @@ -141,15 +141,15 @@ static void r3d_read_reos(AVFormatContext *s) R3DContext *r3d = s->priv_data; int tmp; - r3d->rdvo_offset = get_be32(s->pb); - get_be32(s->pb); // rdvs offset - get_be32(s->pb); // rdao offset - get_be32(s->pb); // rdas offset + r3d->rdvo_offset = avio_rb32(s->pb); + avio_rb32(s->pb); // rdvs offset + avio_rb32(s->pb); // rdao offset + avio_rb32(s->pb); // rdas offset - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "num video chunks %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "num audio chunks %d\n", tmp); url_fskip(s->pb, 6*4); @@ -214,31 +214,31 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) unsigned dts; int ret; - dts = get_be32(s->pb); + dts = avio_rb32(s->pb); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "frame num %d\n", tmp); - tmp = get_byte(s->pb); // major version - tmp2 = get_byte(s->pb); // minor version + tmp = avio_r8(s->pb); // major version + tmp2 = avio_r8(s->pb); // minor version av_dlog(s, "version %d.%d\n", tmp, tmp2); - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown %d\n", tmp); if (tmp > 4) { - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown %d\n", tmp); - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "width %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "height %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "metadata len %d\n", tmp); } tmp = atom->size - 8 - (url_ftell(s->pb) - pos); @@ -268,23 +268,23 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) unsigned dts; int ret; - dts = get_be32(s->pb); + dts = avio_rb32(s->pb); - st->codec->sample_rate = get_be32(s->pb); + st->codec->sample_rate = avio_rb32(s->pb); - samples = get_be32(s->pb); + samples = avio_rb32(s->pb); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "packet num %d\n", tmp); - tmp = get_be16(s->pb); // unkown + tmp = avio_rb16(s->pb); // unkown av_dlog(s, "unknown %d\n", tmp); - tmp = get_byte(s->pb); // major version - tmp2 = get_byte(s->pb); // minor version + tmp = avio_r8(s->pb); // major version + tmp2 = avio_r8(s->pb); // minor version av_dlog(s, "version %d.%d\n", tmp, tmp2); - tmp = get_be32(s->pb); // unknown + tmp = avio_rb32(s->pb); // unknown av_dlog(s, "unknown %d\n", tmp); size = atom->size - 8 - (url_ftell(s->pb) - pos); diff --git a/libavformat/rdt.c b/libavformat/rdt.c index d846533724..ad84a6cbe5 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -153,25 +153,25 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) return -1; ffio_init_context(&pb, rdt->mlti_data, rdt->mlti_data_size, 0, NULL, NULL, NULL, NULL); - tag = get_le32(&pb); + tag = avio_rl32(&pb); if (tag == MKTAG('M', 'L', 'T', 'I')) { int num, chunk_nr; /* read index of MDPR chunk numbers */ - num = get_be16(&pb); + num = avio_rb16(&pb); if (rule_nr < 0 || rule_nr >= num) return -1; url_fskip(&pb, rule_nr * 2); - chunk_nr = get_be16(&pb); + chunk_nr = avio_rb16(&pb); url_fskip(&pb, (num - 1 - rule_nr) * 2); /* read MDPR chunks */ - num = get_be16(&pb); + num = avio_rb16(&pb); if (chunk_nr >= num) return -1; while (chunk_nr--) - url_fskip(&pb, get_be32(&pb)); - size = get_be32(&pb); + url_fskip(&pb, avio_rb32(&pb)); + size = avio_rb32(&pb); } else { size = rdt->mlti_data_size; url_fseek(&pb, 0, SEEK_SET); diff --git a/libavformat/riff.c b/libavformat/riff.c index 9f7d949dce..7111487f8c 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -481,25 +481,25 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) { int id; - id = get_le16(pb); + id = avio_rl16(pb); codec->codec_type = AVMEDIA_TYPE_AUDIO; codec->codec_tag = id; - codec->channels = get_le16(pb); - codec->sample_rate = get_le32(pb); - codec->bit_rate = get_le32(pb) * 8; - codec->block_align = get_le16(pb); + codec->channels = avio_rl16(pb); + codec->sample_rate = avio_rl32(pb); + codec->bit_rate = avio_rl32(pb) * 8; + codec->block_align = avio_rl16(pb); if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */ codec->bits_per_coded_sample = 8; }else - codec->bits_per_coded_sample = get_le16(pb); + codec->bits_per_coded_sample = avio_rl16(pb); if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */ - int cbSize = get_le16(pb); /* cbSize */ + int cbSize = avio_rl16(pb); /* cbSize */ size -= 18; cbSize = FFMIN(size, cbSize); if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */ - codec->bits_per_coded_sample = get_le16(pb); - codec->channel_layout = get_le32(pb); /* dwChannelMask */ - id = get_le32(pb); /* 4 first bytes of GUID */ + codec->bits_per_coded_sample = avio_rl16(pb); + codec->channel_layout = avio_rl32(pb); /* dwChannelMask */ + id = avio_rl32(pb); /* 4 first bytes of GUID */ url_fskip(pb, 12); /* skip end of GUID */ cbSize -= 22; size -= 22; @@ -507,7 +507,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) codec->extradata_size = cbSize; if (cbSize > 0) { codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, codec->extradata, codec->extradata_size); + avio_read(pb, codec->extradata, codec->extradata_size); size -= cbSize; } @@ -547,17 +547,17 @@ enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps) int ff_get_bmp_header(AVIOContext *pb, AVStream *st) { int tag1; - get_le32(pb); /* size */ - st->codec->width = get_le32(pb); - st->codec->height = (int32_t)get_le32(pb); - get_le16(pb); /* planes */ - st->codec->bits_per_coded_sample= get_le16(pb); /* depth */ - tag1 = get_le32(pb); - get_le32(pb); /* ImageSize */ - get_le32(pb); /* XPelsPerMeter */ - get_le32(pb); /* YPelsPerMeter */ - get_le32(pb); /* ClrUsed */ - get_le32(pb); /* ClrImportant */ + avio_rl32(pb); /* size */ + st->codec->width = avio_rl32(pb); + st->codec->height = (int32_t)avio_rl32(pb); + avio_rl16(pb); /* planes */ + st->codec->bits_per_coded_sample= avio_rl16(pb); /* depth */ + tag1 = avio_rl32(pb); + avio_rl32(pb); /* ImageSize */ + avio_rl32(pb); /* XPelsPerMeter */ + avio_rl32(pb); /* YPelsPerMeter */ + avio_rl32(pb); /* ClrUsed */ + avio_rl32(pb); /* ClrImportant */ return tag1; } #endif // CONFIG_DEMUXERS diff --git a/libavformat/rl2.c b/libavformat/rl2.c index d655d3e9f5..16e029f679 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -96,20 +96,20 @@ static av_cold int rl2_read_header(AVFormatContext *s, int ret = 0; url_fskip(pb,4); /* skip FORM tag */ - back_size = get_le32(pb); /**< get size of the background frame */ - signature = get_be32(pb); - data_size = get_be32(pb); - frame_count = get_le32(pb); + back_size = avio_rl32(pb); /**< get size of the background frame */ + signature = avio_rb32(pb); + data_size = avio_rb32(pb); + frame_count = avio_rl32(pb); /* disallow back_sizes and frame_counts that may lead to overflows later */ if(back_size > INT_MAX/2 || frame_count > INT_MAX / sizeof(uint32_t)) return AVERROR_INVALIDDATA; - encoding_method = get_le16(pb); - sound_rate = get_le16(pb); - rate = get_le16(pb); - channels = get_le16(pb); - def_sound_size = get_le16(pb); + encoding_method = avio_rl16(pb); + sound_rate = avio_rl16(pb); + rate = avio_rl16(pb); + channels = avio_rl16(pb); + def_sound_size = avio_rl16(pb); /** setup video stream */ st = av_new_stream(s, 0); @@ -133,7 +133,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, if(!st->codec->extradata) return AVERROR(ENOMEM); - if(get_buffer(pb,st->codec->extradata,st->codec->extradata_size) != + if(avio_read(pb,st->codec->extradata,st->codec->extradata_size) != st->codec->extradata_size) return AVERROR(EIO); @@ -173,11 +173,11 @@ static av_cold int rl2_read_header(AVFormatContext *s, /** read offset and size tables */ for(i=0; i < frame_count;i++) - chunk_size[i] = get_le32(pb); + chunk_size[i] = avio_rl32(pb); for(i=0; i < frame_count;i++) - chunk_offset[i] = get_le32(pb); + chunk_offset[i] = avio_rl32(pb); for(i=0; i < frame_count;i++) - audio_size[i] = get_le32(pb) & 0xFFFF; + audio_size[i] = avio_rl32(pb) & 0xFFFF; /** build the sample index */ for(i=0;iextradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); - avctx->extradata_size = get_buffer(pb, avctx->extradata, size); + avctx->extradata_size = avio_read(pb, avctx->extradata, size); memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); if (avctx->extradata_size != size) return AVERROR(EIO); @@ -102,7 +102,7 @@ static void rm_read_metadata(AVFormatContext *s, int wide) char buf[1024]; int i; for (i=0; ipb) : get_byte(s->pb); + int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb); get_strl(s->pb, buf, sizeof(buf), len); av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0); } @@ -128,15 +128,15 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, int ret; /* ra type header */ - version = get_be16(pb); /* version */ + version = avio_rb16(pb); /* version */ if (version == 3) { - int header_size = get_be16(pb); + int header_size = avio_rb16(pb); int64_t startpos = url_ftell(pb); url_fskip(pb, 14); rm_read_metadata(s, 0); if ((startpos + header_size) >= url_ftell(pb) + 2) { // fourcc (should always be "lpcJ") - get_byte(pb); + avio_r8(pb); get_str8(pb, buf, sizeof(buf)); } // Skip extra header crap (this should never happen) @@ -151,28 +151,28 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, int codecdata_length; /* old version (4) */ url_fskip(pb, 2); /* unused */ - get_be32(pb); /* .ra4 */ - get_be32(pb); /* data size */ - get_be16(pb); /* version2 */ - get_be32(pb); /* header size */ - flavor= get_be16(pb); /* add codec info / flavor */ - ast->coded_framesize = coded_framesize = get_be32(pb); /* coded frame size */ - get_be32(pb); /* ??? */ - get_be32(pb); /* ??? */ - get_be32(pb); /* ??? */ - ast->sub_packet_h = sub_packet_h = get_be16(pb); /* 1 */ - st->codec->block_align= get_be16(pb); /* frame size */ - ast->sub_packet_size = sub_packet_size = get_be16(pb); /* sub packet size */ - get_be16(pb); /* ??? */ + avio_rb32(pb); /* .ra4 */ + avio_rb32(pb); /* data size */ + avio_rb16(pb); /* version2 */ + avio_rb32(pb); /* header size */ + flavor= avio_rb16(pb); /* add codec info / flavor */ + ast->coded_framesize = coded_framesize = avio_rb32(pb); /* coded frame size */ + avio_rb32(pb); /* ??? */ + avio_rb32(pb); /* ??? */ + avio_rb32(pb); /* ??? */ + ast->sub_packet_h = sub_packet_h = avio_rb16(pb); /* 1 */ + st->codec->block_align= avio_rb16(pb); /* frame size */ + ast->sub_packet_size = sub_packet_size = avio_rb16(pb); /* sub packet size */ + avio_rb16(pb); /* ??? */ if (version == 5) { - get_be16(pb); get_be16(pb); get_be16(pb); + avio_rb16(pb); avio_rb16(pb); avio_rb16(pb); } - st->codec->sample_rate = get_be16(pb); - get_be32(pb); - st->codec->channels = get_be16(pb); + st->codec->sample_rate = avio_rb16(pb); + avio_rb32(pb); + st->codec->channels = avio_rb16(pb); if (version == 5) { - get_be32(pb); - get_buffer(pb, buf, 4); + avio_rb32(pb); + avio_read(pb, buf, 4); buf[4] = 0; } else { get_str8(pb, buf, sizeof(buf)); /* desc */ @@ -201,10 +201,10 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, case CODEC_ID_COOK: case CODEC_ID_ATRAC3: case CODEC_ID_SIPR: - get_be16(pb); get_byte(pb); + avio_rb16(pb); avio_r8(pb); if (version == 5) - get_byte(pb); - codecdata_length = get_be32(pb); + avio_r8(pb); + codecdata_length = avio_rb32(pb); if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); return -1; @@ -236,16 +236,16 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h); break; case CODEC_ID_AAC: - get_be16(pb); get_byte(pb); + avio_rb16(pb); avio_r8(pb); if (version == 5) - get_byte(pb); - codecdata_length = get_be32(pb); + avio_r8(pb); + codecdata_length = avio_rb32(pb); if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); return -1; } if (codecdata_length >= 1) { - get_byte(pb); + avio_r8(pb); if ((ret = rm_read_extradata(pb, st->codec, codecdata_length - 1)) < 0) return ret; } @@ -254,9 +254,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name)); } if (read_all) { - get_byte(pb); - get_byte(pb); - get_byte(pb); + avio_r8(pb); + avio_r8(pb); + avio_r8(pb); rm_read_metadata(s, 0); } } @@ -274,32 +274,32 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, av_set_pts_info(st, 64, 1, 1000); codec_pos = url_ftell(pb); - v = get_be32(pb); + v = avio_rb32(pb); if (v == MKTAG(0xfd, 'a', 'r', '.')) { /* ra type header */ if (rm_read_audio_stream_info(s, pb, st, rst, 0)) return -1; } else { int fps, fps2; - if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) { + if (avio_rl32(pb) != MKTAG('V', 'I', 'D', 'O')) { fail1: av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n"); goto skip; } - st->codec->codec_tag = get_le32(pb); + st->codec->codec_tag = avio_rl32(pb); st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags, st->codec->codec_tag); // av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); if (st->codec->codec_id == CODEC_ID_NONE) goto fail1; - st->codec->width = get_be16(pb); - st->codec->height = get_be16(pb); + st->codec->width = avio_rb16(pb); + st->codec->height = avio_rb16(pb); st->codec->time_base.num= 1; - fps= get_be16(pb); + fps= avio_rb16(pb); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - get_be32(pb); - fps2= get_be16(pb); - get_be16(pb); + avio_rb32(pb); + fps2= avio_rb16(pb); + avio_rb16(pb); if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0) return ret; @@ -335,15 +335,15 @@ static int rm_read_index(AVFormatContext *s) AVStream *st; do { - if (get_le32(pb) != MKTAG('I','N','D','X')) + if (avio_rl32(pb) != MKTAG('I','N','D','X')) return -1; - size = get_be32(pb); + size = avio_rb32(pb); if (size < 20) return -1; url_fskip(pb, 2); - n_pkts = get_be32(pb); - str_id = get_be16(pb); - next_off = get_be32(pb); + n_pkts = avio_rb32(pb); + str_id = avio_rb16(pb); + next_off = avio_rb32(pb); for (n = 0; n < s->nb_streams; n++) if (s->streams[n]->id == str_id) { st = s->streams[n]; @@ -354,8 +354,8 @@ static int rm_read_index(AVFormatContext *s) for (n = 0; n < n_pkts; n++) { url_fskip(pb, 2); - pts = get_be32(pb); - pos = get_be32(pb); + pts = avio_rb32(pb); + pos = avio_rb32(pb); url_fskip(pb, 4); /* packet no. */ av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME); @@ -395,7 +395,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) char buf[128]; int flags = 0; - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag == MKTAG('.', 'r', 'a', 0xfd)) { /* very old .ra format */ return rm_read_header_old(s, ap); @@ -403,17 +403,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(EIO); } - get_be32(pb); /* header size */ - get_be16(pb); - get_be32(pb); - get_be32(pb); /* number of headers */ + avio_rb32(pb); /* header size */ + avio_rb16(pb); + avio_rb32(pb); + avio_rb32(pb); /* number of headers */ for(;;) { if (url_feof(pb)) return -1; - tag = get_le32(pb); - tag_size = get_be32(pb); - get_be16(pb); + tag = avio_rl32(pb); + tag_size = avio_rb32(pb); + avio_rb16(pb); #if 0 printf("tag=%c%c%c%c (%08x) size=%d\n", (tag) & 0xff, @@ -428,17 +428,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) switch(tag) { case MKTAG('P', 'R', 'O', 'P'): /* file header */ - get_be32(pb); /* max bit rate */ - get_be32(pb); /* avg bit rate */ - get_be32(pb); /* max packet size */ - get_be32(pb); /* avg packet size */ - get_be32(pb); /* nb packets */ - get_be32(pb); /* duration */ - get_be32(pb); /* preroll */ - indx_off = get_be32(pb); /* index offset */ - data_off = get_be32(pb); /* data offset */ - get_be16(pb); /* nb streams */ - flags = get_be16(pb); /* flags */ + avio_rb32(pb); /* max bit rate */ + avio_rb32(pb); /* avg bit rate */ + avio_rb32(pb); /* max packet size */ + avio_rb32(pb); /* avg packet size */ + avio_rb32(pb); /* nb packets */ + avio_rb32(pb); /* duration */ + avio_rb32(pb); /* preroll */ + indx_off = avio_rb32(pb); /* index offset */ + data_off = avio_rb32(pb); /* data offset */ + avio_rb16(pb); /* nb streams */ + flags = avio_rb16(pb); /* flags */ break; case MKTAG('C', 'O', 'N', 'T'): rm_read_metadata(s, 1); @@ -447,14 +447,14 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); - st->id = get_be16(pb); - get_be32(pb); /* max bit rate */ - st->codec->bit_rate = get_be32(pb); /* bit rate */ - get_be32(pb); /* max packet size */ - get_be32(pb); /* avg packet size */ - start_time = get_be32(pb); /* start time */ - get_be32(pb); /* preroll */ - duration = get_be32(pb); /* duration */ + st->id = avio_rb16(pb); + avio_rb32(pb); /* max bit rate */ + st->codec->bit_rate = avio_rb32(pb); /* bit rate */ + avio_rb32(pb); /* max packet size */ + avio_rb32(pb); /* avg packet size */ + start_time = avio_rb32(pb); /* start time */ + avio_rb32(pb); /* preroll */ + duration = avio_rb32(pb); /* duration */ st->start_time = start_time; st->duration = duration; get_str8(pb, buf, sizeof(buf)); /* desc */ @@ -462,7 +462,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_DATA; st->priv_data = ff_rm_alloc_rmstream(); if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data, - get_be32(pb)) < 0) + avio_rb32(pb)) < 0) return -1; break; case MKTAG('D', 'A', 'T', 'A'): @@ -474,10 +474,10 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) } } header_end: - rm->nb_packets = get_be32(pb); /* number of packets */ + rm->nb_packets = avio_rb32(pb); /* number of packets */ if (!rm->nb_packets && (flags & 4)) rm->nb_packets = 3600 * 25; - get_be32(pb); /* next data header */ + avio_rb32(pb); /* next data header */ if (!data_off) data_off = url_ftell(pb) - 18; @@ -494,13 +494,13 @@ static int get_num(AVIOContext *pb, int *len) { int n, n1; - n = get_be16(pb); + n = avio_rb16(pb); (*len)-=2; n &= 0x7FFF; if (n >= 0x4000) { return n - 0x4000; } else { - n1 = get_be16(pb); + n1 = avio_rb16(pb); (*len)-=2; return (n << 16) | n1; } @@ -524,13 +524,13 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ *timestamp = AV_NOPTS_VALUE; *flags= 0; }else{ - state= (state<<8) + get_byte(pb); + state= (state<<8) + avio_r8(pb); if(state == MKBETAG('I', 'N', 'D', 'X')){ int n_pkts, expected_len; - len = get_be32(pb); + len = avio_rb32(pb); url_fskip(pb, 2); - n_pkts = get_be32(pb); + n_pkts = avio_rb32(pb); expected_len = 20 + n_pkts * 14; if (len == 20) /* some files don't add index entries to chunk size... */ @@ -553,10 +553,10 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ len=state - 12; state= 0xFFFFFFFF; - num = get_be16(pb); - *timestamp = get_be32(pb); - get_byte(pb); /* reserved */ - *flags = get_byte(pb); /* flags */ + num = avio_rb16(pb); + *timestamp = avio_rb32(pb); + avio_r8(pb); /* reserved */ + *flags = avio_r8(pb); /* flags */ } for(i=0;inb_streams;i++) { st = s->streams[i]; @@ -584,16 +584,16 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, int hdr, seq, pic_num, len2, pos; int type; - hdr = get_byte(pb); len--; + hdr = avio_r8(pb); len--; type = hdr >> 6; if(type != 3){ // not frame as a part of packet - seq = get_byte(pb); len--; + seq = avio_r8(pb); len--; } if(type != 1){ // not whole frame len2 = get_num(pb, &len); pos = get_num(pb, &len); - pic_num = get_byte(pb); len--; + pic_num = avio_r8(pb); len--; } if(len<0) return -1; @@ -609,7 +609,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, pkt->data[0] = 0; AV_WL32(pkt->data + 1, 1); AV_WL32(pkt->data + 5, 0); - get_buffer(pb, pkt->data + 9, len); + avio_read(pb, pkt->data + 9, len); return 0; } //now we have to deal with single slice @@ -635,7 +635,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1); if(vst->videobufpos + len > vst->videobufsize) return 1; - if (get_buffer(pb, vst->pkt.data + vst->videobufpos, len) != len) + if (avio_read(pb, vst->pkt.data + vst->videobufpos, len) != len) return AVERROR(EIO); vst->videobufpos += len; rm->remaining_len-= len; @@ -730,15 +730,15 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, switch(st->codec->codec_id) { case CODEC_ID_RA_288: for (x = 0; x < h/2; x++) - get_buffer(pb, ast->pkt.data+x*2*w+y*cfs, cfs); + avio_read(pb, ast->pkt.data+x*2*w+y*cfs, cfs); break; case CODEC_ID_ATRAC3: case CODEC_ID_COOK: for (x = 0; x < w/sps; x++) - get_buffer(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps); + avio_read(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps); break; case CODEC_ID_SIPR: - get_buffer(pb, ast->pkt.data + y * w, w); + avio_read(pb, ast->pkt.data + y * w, w); break; } @@ -753,10 +753,10 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, } else if (st->codec->codec_id == CODEC_ID_AAC) { int x; rm->audio_stream_num = st->index; - ast->sub_packet_cnt = (get_be16(pb) & 0xf0) >> 4; + ast->sub_packet_cnt = (avio_rb16(pb) & 0xf0) >> 4; if (ast->sub_packet_cnt) { for (x = 0; x < ast->sub_packet_cnt; x++) - ast->sub_packet_lengths[x] = get_be16(pb); + ast->sub_packet_lengths[x] = avio_rb16(pb); rm->audio_pkt_cnt = ast->sub_packet_cnt; ast->audiotimestamp = timestamp; } else @@ -916,9 +916,9 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, st = s->streams[stream_index2]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - h= get_byte(s->pb); len--; + h= avio_r8(s->pb); len--; if(!(h & 0x40)){ - seq = get_byte(s->pb); len--; + seq = avio_r8(s->pb); len--; } } diff --git a/libavformat/rpl.c b/libavformat/rpl.c index a8af5c8d07..5c0a21fe90 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -51,7 +51,7 @@ static int read_line(AVIOContext * pb, char* line, int bufsize) { int i; for (i = 0; i < bufsize - 1; i++) { - int b = get_byte(pb); + int b = avio_r8(pb); if (b == 0) break; if (b == '\n') { @@ -301,8 +301,8 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) // multiple frames per chunk in Escape 124 samples. uint32_t frame_size, frame_flags; - frame_flags = get_le32(pb); - frame_size = get_le32(pb); + frame_flags = avio_rl32(pb); + frame_size = avio_rl32(pb); if (url_fseek(pb, -8, SEEK_CUR) < 0) return AVERROR(EIO); diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c index da17cba8b8..a34be80c9d 100644 --- a/libavformat/rsodec.c +++ b/libavformat/rsodec.c @@ -35,10 +35,10 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap) enum CodecID codec; AVStream *st; - id = get_be16(pb); - size = get_be16(pb); - rate = get_be16(pb); - get_be16(pb); /* play mode ? (0x0000 = don't loop) */ + id = avio_rb16(pb); + size = avio_rb16(pb); + rate = avio_rb16(pb); + avio_rb16(pb); /* play mode ? (0x0000 = don't loop) */ codec = ff_codec_get_id(ff_codec_rso_tags, id); diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 9708e906aa..0f2393f5de 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -182,10 +182,10 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, while (url_ftell(pb) + 4 < len) { int start_off = url_ftell(pb); - mflags = get_byte(pb); + mflags = avio_r8(pb); if (mflags & 0x80) flags |= RTP_FLAG_KEY; - len_off = get_be24(pb); + len_off = avio_rb24(pb); if (mflags & 0x20) /**< relative timestamp */ url_fskip(pb, 4); if (mflags & 0x10) /**< has duration */ diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 781e5fff23..24052a2357 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -104,20 +104,20 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, data_len = get_bits(&gb, 16); url_fseek(&pb, pos + 4, SEEK_SET); - tag = get_le32(&pb); + tag = avio_rl32(&pb); if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO && tag != MKTAG('v','i','d','e')) || (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && tag != MKTAG('s','o','u','n'))) return AVERROR_INVALIDDATA; - av_set_pts_info(st, 32, 1, get_be32(&pb)); + av_set_pts_info(st, 32, 1, avio_rb32(&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); + int tlv_len = avio_rb16(&pb); + tag = avio_rl16(&pb); if (url_ftell(&pb) + tlv_len > pos + data_len) return AVERROR_INVALIDDATA; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index d09123a06f..bc8cd67c81 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1784,7 +1784,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) /* read the whole sdp file */ /* XXX: better loading */ content = av_malloc(SDP_MAX_SIZE); - size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1); + size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); if (size <= 0) { av_free(content); return AVERROR_INVALIDDATA; diff --git a/libavformat/sauce.c b/libavformat/sauce.c index 32c026cd34..e861b14e16 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -36,13 +36,13 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g uint64_t start_pos = url_fsize(pb) - 128; url_fseek(pb, start_pos, SEEK_SET); - if (get_buffer(pb, buf, 7) != 7) + if (avio_read(pb, buf, 7) != 7) return -1; if (memcmp(buf, "SAUCE00", 7)) return -1; #define GET_SAUCE_META(name,size) \ - if (get_buffer(pb, buf, size) == size && buf[0]) { \ + if (avio_read(pb, buf, size) == size && buf[0]) { \ buf[size] = 0; \ av_metadata_set2(&avctx->metadata, name, buf, 0); \ } @@ -52,12 +52,12 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g GET_SAUCE_META("publisher", 20) GET_SAUCE_META("date", 8) url_fskip(pb, 4); - datatype = get_byte(pb); - filetype = get_byte(pb); - t1 = get_le16(pb); - t2 = get_le16(pb); - nb_comments = get_byte(pb); - flags = get_byte(pb); + datatype = avio_r8(pb); + filetype = avio_r8(pb); + t1 = avio_rl16(pb); + t2 = avio_rl16(pb); + nb_comments = avio_r8(pb); + flags = avio_r8(pb); url_fskip(pb, 4); GET_SAUCE_META("encoder", 22); @@ -83,14 +83,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g if (nb_comments > 0) { url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET); - if (get_buffer(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) { + if (avio_read(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) { int i; char *str = av_malloc(65*nb_comments + 1); *fsize -= 64*nb_comments + 5; if (!str) return 0; for (i = 0; i < nb_comments; i++) { - if (get_buffer(pb, str + 65*i, 64) != 64) + if (avio_read(pb, str + 65*i, 64) != 64) break; str[65*i + 64] = '\n'; } diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index ba75d43e1b..906cb915ad 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -89,7 +89,7 @@ static int film_read_header(AVFormatContext *s, film->stereo_buffer_size = 0; /* load the main FILM header */ - if (get_buffer(pb, scratch, 16) != 16) + if (avio_read(pb, scratch, 16) != 16) return AVERROR(EIO); data_offset = AV_RB32(&scratch[4]); film->version = AV_RB32(&scratch[8]); @@ -97,7 +97,7 @@ static int film_read_header(AVFormatContext *s, /* load the FDSC chunk */ if (film->version == 0) { /* special case for Lemmings .film files; 20-byte header */ - if (get_buffer(pb, scratch, 20) != 20) + if (avio_read(pb, scratch, 20) != 20) return AVERROR(EIO); /* make some assumptions about the audio parameters */ film->audio_type = CODEC_ID_PCM_S8; @@ -106,7 +106,7 @@ static int film_read_header(AVFormatContext *s, film->audio_bits = 8; } else { /* normal Saturn .cpk files; 32-byte header */ - if (get_buffer(pb, scratch, 32) != 32) + if (avio_read(pb, scratch, 32) != 32) return AVERROR(EIO); film->audio_samplerate = AV_RB16(&scratch[24]); film->audio_channels = scratch[21]; @@ -158,7 +158,7 @@ static int film_read_header(AVFormatContext *s, } /* load the sample table */ - if (get_buffer(pb, scratch, 16) != 16) + if (avio_read(pb, scratch, 16) != 16) return AVERROR(EIO); if (AV_RB32(&scratch[0]) != STAB_TAG) return AVERROR_INVALIDDATA; @@ -174,7 +174,7 @@ static int film_read_header(AVFormatContext *s, audio_frame_counter = 0; for (i = 0; i < film->sample_count; i++) { /* load the next sample record and transfer it to an internal struct */ - if (get_buffer(pb, scratch, 16) != 16) { + if (avio_read(pb, scratch, 16) != 16) { av_free(film->sample_table); return AVERROR(EIO); } @@ -225,7 +225,7 @@ static int film_read_packet(AVFormatContext *s, pkt->pos= url_ftell(pb); if (av_new_packet(pkt, sample->sample_size)) return AVERROR(ENOMEM); - get_buffer(pb, pkt->data, sample->sample_size); + avio_read(pb, pkt->data, sample->sample_size); } else if ((sample->stream == film->audio_stream_index) && (film->audio_channels == 2)) { /* stereo PCM needs to be interleaved */ @@ -241,7 +241,7 @@ static int film_read_packet(AVFormatContext *s, } pkt->pos= url_ftell(pb); - ret = get_buffer(pb, film->stereo_buffer, sample->sample_size); + ret = avio_read(pb, film->stereo_buffer, sample->sample_size); if (ret != sample->sample_size) ret = AVERROR(EIO); diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index e30d42deb6..323938639c 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -96,7 +96,7 @@ static int vmd_read_header(AVFormatContext *s, /* fetch the main header, including the 2 header length bytes */ url_fseek(pb, 0, SEEK_SET); - if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE) + if (avio_read(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE) return AVERROR(EIO); if(vmd->vmd_header[16] == 'i' && vmd->vmd_header[17] == 'v' && vmd->vmd_header[18] == '3') @@ -172,7 +172,7 @@ static int vmd_read_header(AVFormatContext *s, av_free(vmd->frame_table); return AVERROR(ENOMEM); } - if (get_buffer(pb, raw_frame_table, raw_frame_table_size) != + if (avio_read(pb, raw_frame_table, raw_frame_table_size) != raw_frame_table_size) { av_free(raw_frame_table); av_free(vmd->frame_table); @@ -189,7 +189,7 @@ static int vmd_read_header(AVFormatContext *s, int type; uint32_t size; - get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD); + avio_read(pb, chunk, BYTES_PER_FRAME_RECORD); type = chunk[0]; size = AV_RL32(&chunk[2]); if(!size && type != 1) @@ -250,9 +250,9 @@ static int vmd_read_packet(AVFormatContext *s, pkt->pos= url_ftell(pb); memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD); if(vmd->is_indeo3) - ret = get_buffer(pb, pkt->data, frame->frame_size); + ret = avio_read(pb, pkt->data, frame->frame_size); else - ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD, + ret = avio_read(pb, pkt->data + BYTES_PER_FRAME_RECORD, frame->frame_size); if (ret != frame->frame_size) { diff --git a/libavformat/siff.c b/libavformat/siff.c index 21ccf2dcd1..1d24c6a504 100644 --- a/libavformat/siff.c +++ b/libavformat/siff.c @@ -89,28 +89,28 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) AVStream *st; int width, height; - if (get_le32(pb) != TAG_VBHD){ + if (avio_rl32(pb) != TAG_VBHD){ av_log(s, AV_LOG_ERROR, "Header chunk is missing\n"); return -1; } - if(get_be32(pb) != 32){ + if(avio_rb32(pb) != 32){ av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n"); return -1; } - if(get_le16(pb) != 1){ + if(avio_rl16(pb) != 1){ av_log(s, AV_LOG_ERROR, "Incorrect header version\n"); return -1; } - width = get_le16(pb); - height = get_le16(pb); + width = avio_rl16(pb); + height = avio_rl16(pb); url_fskip(pb, 4); - c->frames = get_le16(pb); + c->frames = avio_rl16(pb); if(!c->frames){ av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); return -1; } - c->bits = get_le16(pb); - c->rate = get_le16(pb); + c->bits = avio_rl16(pb); + c->rate = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); url_fskip(pb, 16); //zeroes @@ -137,17 +137,17 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) { - if (get_le32(pb) != TAG_SHDR){ + if (avio_rl32(pb) != TAG_SHDR){ av_log(s, AV_LOG_ERROR, "Header chunk is missing\n"); return -1; } - if(get_be32(pb) != 8){ + if(avio_rb32(pb) != 8){ av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n"); return -1; } url_fskip(pb, 4); //unknown value - c->rate = get_le16(pb); - c->bits = get_le16(pb); + c->rate = avio_rl16(pb); + c->bits = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); return create_audio_stream(s, c); } @@ -158,10 +158,10 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) SIFFContext *c = s->priv_data; uint32_t tag; - if (get_le32(pb) != TAG_SIFF) + if (avio_rl32(pb) != TAG_SIFF) return -1; url_fskip(pb, 4); //ignore size - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != TAG_VBV1 && tag != TAG_SOUN){ av_log(s, AV_LOG_ERROR, "Not a VBV file\n"); @@ -172,7 +172,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; if (tag == TAG_SOUN && siff_parse_soun(s, c, pb) < 0) return -1; - if (get_le32(pb) != MKTAG('B', 'O', 'D', 'Y')){ + if (avio_rl32(pb) != MKTAG('B', 'O', 'D', 'Y')){ av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n"); return -1; } @@ -190,12 +190,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) if (c->cur_frame >= c->frames) return AVERROR(EIO); if (c->curstrm == -1){ - c->pktsize = get_le32(s->pb) - 4; - c->flags = get_le16(s->pb); + c->pktsize = avio_rl32(s->pb) - 4; + c->flags = avio_rl16(s->pb); c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0; if (c->gmcsize) - get_buffer(s->pb, c->gmc, c->gmcsize); - c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0; + avio_read(s->pb, c->gmc, c->gmcsize); + c->sndsize = (c->flags & VB_HAS_AUDIO) ? avio_rl32(s->pb): 0; c->curstrm = !!(c->flags & VB_HAS_AUDIO); } @@ -206,7 +206,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) AV_WL16(pkt->data, c->flags); if (c->gmcsize) memcpy(pkt->data + 2, c->gmc, c->gmcsize); - get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2); + avio_read(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2); pkt->stream_index = 0; c->curstrm = -1; }else{ diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 8b375cf5d6..42d3672d79 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -105,19 +105,19 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) int tbase; /* read and check header */ - smk->magic = get_le32(pb); + smk->magic = avio_rl32(pb); if (smk->magic != MKTAG('S', 'M', 'K', '2') && smk->magic != MKTAG('S', 'M', 'K', '4')) return -1; - smk->width = get_le32(pb); - smk->height = get_le32(pb); - smk->frames = get_le32(pb); - smk->pts_inc = (int32_t)get_le32(pb); - smk->flags = get_le32(pb); + smk->width = avio_rl32(pb); + smk->height = avio_rl32(pb); + smk->frames = avio_rl32(pb); + smk->pts_inc = (int32_t)avio_rl32(pb); + smk->flags = avio_rl32(pb); if(smk->flags & SMACKER_FLAG_RING_FRAME) smk->frames++; for(i = 0; i < 7; i++) - smk->audio[i] = get_le32(pb); - smk->treesize = get_le32(pb); + smk->audio[i] = avio_rl32(pb); + smk->treesize = avio_rl32(pb); if(smk->treesize >= UINT_MAX/4){ // smk->treesize + 16 must not overflow (this check is probably redundant) av_log(s, AV_LOG_ERROR, "treesize too large\n"); @@ -125,13 +125,13 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) } //FIXME remove extradata "rebuilding" - smk->mmap_size = get_le32(pb); - smk->mclr_size = get_le32(pb); - smk->full_size = get_le32(pb); - smk->type_size = get_le32(pb); + smk->mmap_size = avio_rl32(pb); + smk->mclr_size = avio_rl32(pb); + smk->full_size = avio_rl32(pb); + smk->type_size = avio_rl32(pb); for(i = 0; i < 7; i++) - smk->rates[i] = get_le32(pb); - smk->pad = get_le32(pb); + smk->rates[i] = avio_rl32(pb); + smk->pad = avio_rl32(pb); /* setup data */ if(smk->frames > 0xFFFFFF) { av_log(s, AV_LOG_ERROR, "Too many frames: %i\n", smk->frames); @@ -144,10 +144,10 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) /* read frame info */ for(i = 0; i < smk->frames; i++) { - smk->frm_size[i] = get_le32(pb); + smk->frm_size[i] = avio_rl32(pb); } for(i = 0; i < smk->frames; i++) { - smk->frm_flags[i] = get_byte(pb); + smk->frm_flags[i] = avio_r8(pb); } /* init video codec */ @@ -207,7 +207,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) av_free(smk->frm_flags); return -1; } - ret = get_buffer(pb, st->codec->extradata + 16, st->codec->extradata_size - 16); + ret = avio_read(pb, st->codec->extradata + 16, st->codec->extradata_size - 16); if(ret != st->codec->extradata_size - 16){ av_free(smk->frm_size); av_free(smk->frm_flags); @@ -251,19 +251,19 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) uint8_t oldpal[768]; memcpy(oldpal, pal, 768); - size = get_byte(s->pb); + size = avio_r8(s->pb); size = size * 4 - 1; frame_size -= size; frame_size--; sz = 0; pos = url_ftell(s->pb) + size; while(sz < 256){ - t = get_byte(s->pb); + t = avio_r8(s->pb); if(t & 0x80){ /* skip palette entries */ sz += (t & 0x7F) + 1; pal += ((t & 0x7F) + 1) * 3; } else if(t & 0x40){ /* copy with offset */ - off = get_byte(s->pb) * 3; + off = avio_r8(s->pb) * 3; j = (t & 0x3F) + 1; while(j-- && sz < 256) { *pal++ = oldpal[off + 0]; @@ -274,8 +274,8 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) } } else { /* new entries */ *pal++ = smk_pal[t]; - *pal++ = smk_pal[get_byte(s->pb) & 0x3F]; - *pal++ = smk_pal[get_byte(s->pb) & 0x3F]; + *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; + *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; sz++; } } @@ -288,13 +288,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) for(i = 0; i < 7; i++) { if(flags & 1) { int size; - size = get_le32(s->pb) - 4; + size = avio_rl32(s->pb) - 4; frame_size -= size; frame_size -= 4; smk->curstream++; smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size); smk->buf_sizes[smk->curstream] = size; - ret = get_buffer(s->pb, smk->bufs[smk->curstream], size); + ret = avio_read(s->pb, smk->bufs[smk->curstream], size); if(ret != size) return AVERROR(EIO); smk->stream_id[smk->curstream] = smk->indexes[i]; @@ -307,7 +307,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) palchange |= 2; pkt->data[0] = palchange; memcpy(pkt->data + 1, smk->pal, 768); - ret = get_buffer(s->pb, pkt->data + 769, frame_size); + ret = avio_read(s->pb, pkt->data + 769, frame_size); if(ret != frame_size) return AVERROR(EIO); pkt->stream_index = smk->videoindex; diff --git a/libavformat/sol.c b/libavformat/sol.c index d688fde8b2..7ad894e304 100644 --- a/libavformat/sol.c +++ b/libavformat/sol.c @@ -93,15 +93,15 @@ static int sol_read_header(AVFormatContext *s, AVStream *st; /* check ".snd" header */ - magic = get_le16(pb); - tag = get_le32(pb); + magic = avio_rl16(pb); + tag = avio_rl32(pb); if (tag != MKTAG('S', 'O', 'L', 0)) return -1; - rate = get_le16(pb); - type = get_byte(pb); - size = get_le32(pb); + rate = avio_rl16(pb); + type = avio_r8(pb); + size = avio_rl32(pb); if (magic != 0x0B8D) - get_byte(pb); /* newer SOLs contain padding byte */ + avio_r8(pb); /* newer SOLs contain padding byte */ codec = sol_codec_id(magic, type); channels = sol_channels(magic, type); diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index ca48b4370f..b66883441b 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -55,20 +55,20 @@ static int sox_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - if (get_le32(pb) == SOX_TAG) { + if (avio_rl32(pb) == SOX_TAG) { st->codec->codec_id = CODEC_ID_PCM_S32LE; - header_size = get_le32(pb); + header_size = avio_rl32(pb); url_fskip(pb, 8); /* sample count */ - sample_rate = av_int2dbl(get_le64(pb)); - st->codec->channels = get_le32(pb); - comment_size = get_le32(pb); + sample_rate = av_int2dbl(avio_rl64(pb)); + st->codec->channels = avio_rl32(pb); + comment_size = avio_rl32(pb); } else { st->codec->codec_id = CODEC_ID_PCM_S32BE; - header_size = get_be32(pb); + header_size = avio_rb32(pb); url_fskip(pb, 8); /* sample count */ - sample_rate = av_int2dbl(get_be64(pb)); - st->codec->channels = get_be32(pb); - comment_size = get_be32(pb); + sample_rate = av_int2dbl(avio_rb64(pb)); + st->codec->channels = avio_rb32(pb); + comment_size = avio_rb32(pb); } if (comment_size > 0xFFFFFFFFU - SOX_FIXED_HDR - 4U) { @@ -95,7 +95,7 @@ static int sox_read_header(AVFormatContext *s, if (comment_size && comment_size < UINT_MAX) { char *comment = av_malloc(comment_size+1); - if (get_buffer(pb, comment, comment_size) != comment_size) { + if (avio_read(pb, comment, comment_size) != comment_size) { av_freep(&comment); return AVERROR(EIO); } diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index a1a62a116c..2fc567277f 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -170,13 +170,13 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) int pkt_size_bits, offset, ret; while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) { - state = (state << 8) | get_byte(pb); + state = (state << 8) | avio_r8(pb); if (url_feof(pb)) return AVERROR_EOF; } - data_type = get_le16(pb); - pkt_size_bits = get_le16(pb); + data_type = avio_rl16(pb); + pkt_size_bits = avio_rl16(pb); if (pkt_size_bits % 16) av_log_ask_for_sample(s, "Packet does not end to a 16-bit boundary."); @@ -187,7 +187,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE; - if (get_buffer(pb, pkt->data, pkt->size) < pkt->size) { + if (avio_read(pb, pkt->data, pkt->size) < pkt->size) { av_free_packet(pkt); return AVERROR_EOF; } diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 002e15fab1..c567f264f1 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -30,11 +30,11 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr) if (url_feof(pb)) return -1; - tag = get_le16(pb); + tag = avio_rl16(pb); len = tag & 0x3f; tag = tag >> 6; if (len == 0x3f) { - len = get_le32(pb); + len = avio_rl32(pb); } // av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len); *len_ptr = len; @@ -58,7 +58,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) AVIOContext *pb = s->pb; int nbits, len, tag; - tag = get_be32(pb) & 0xffffff00; + tag = avio_rb32(pb) & 0xffffff00; if (tag == MKBETAG('C', 'W', 'S', 0)) { av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n"); @@ -66,13 +66,13 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) } if (tag != MKBETAG('F', 'W', 'S', 0)) return AVERROR(EIO); - get_le32(pb); + avio_rl32(pb); /* skip rectangle size */ - nbits = get_byte(pb) >> 3; + nbits = avio_r8(pb) >> 3; len = (4 * nbits - 3 + 7) / 8; url_fskip(pb, len); - swf->frame_rate = get_le16(pb); /* 8.8 fixed */ - get_le16(pb); /* frame count */ + swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */ + avio_rl16(pb); /* frame count */ swf->samples_per_frame = 0; s->ctx_flags |= AVFMTCTX_NOHEADER; @@ -92,7 +92,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) if (tag < 0) return AVERROR(EIO); if (tag == TAG_VIDEOSTREAM) { - int ch_id = get_le16(pb); + int ch_id = avio_rl16(pb); len -= 2; for (i=0; inb_streams; i++) { @@ -101,16 +101,16 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) goto skip; } - get_le16(pb); - get_le16(pb); - get_le16(pb); - get_byte(pb); + avio_rl16(pb); + avio_rl16(pb); + avio_rl16(pb); + avio_r8(pb); /* Check for FLV1 */ vst = av_new_stream(s, ch_id); if (!vst) return -1; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; - vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, get_byte(pb)); + vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb)); av_set_pts_info(vst, 16, 256, swf->frame_rate); vst->codec->time_base = (AVRational){ 256, swf->frame_rate }; len -= 8; @@ -124,9 +124,9 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) goto skip; } - get_byte(pb); - v = get_byte(pb); - swf->samples_per_frame = get_le16(pb); + avio_r8(pb); + v = avio_r8(pb); + swf->samples_per_frame = avio_rl16(pb); ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */ if (!ast) return -1; @@ -141,12 +141,12 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); len -= 4; } else if (tag == TAG_VIDEOFRAME) { - int ch_id = get_le16(pb); + int ch_id = avio_rl16(pb); len -= 2; for(i=0; inb_streams; i++) { st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) { - frame = get_le16(pb); + frame = avio_rl16(pb); av_get_packet(pb, pkt, len-2); pkt->pos = pos; pkt->pts = frame; @@ -185,17 +185,17 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) vst->codec->time_base = (AVRational){ 256, swf->frame_rate }; st = vst; } - get_le16(pb); /* BITMAP_ID */ + avio_rl16(pb); /* BITMAP_ID */ av_new_packet(pkt, len-2); - get_buffer(pb, pkt->data, 4); + avio_read(pb, pkt->data, 4); if (AV_RB32(pkt->data) == 0xffd8ffd9 || AV_RB32(pkt->data) == 0xffd9ffd8) { /* old SWF files containing SOI/EOI as data start */ /* files created by swink have reversed tag */ pkt->size -= 4; - get_buffer(pb, pkt->data, pkt->size); + avio_read(pb, pkt->data, pkt->size); } else { - get_buffer(pb, pkt->data + 4, pkt->size - 4); + avio_read(pb, pkt->data + 4, pkt->size - 4); } pkt->pos = pos; pkt->stream_index = st->index; diff --git a/libavformat/thp.c b/libavformat/thp.c index b6e7ae2f4a..39a8bc2c35 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -61,31 +61,31 @@ static int thp_read_header(AVFormatContext *s, int i; /* Read the file header. */ - get_be32(pb); /* Skip Magic. */ - thp->version = get_be32(pb); + avio_rb32(pb); /* Skip Magic. */ + thp->version = avio_rb32(pb); - get_be32(pb); /* Max buf size. */ - get_be32(pb); /* Max samples. */ + avio_rb32(pb); /* Max buf size. */ + avio_rb32(pb); /* Max samples. */ - thp->fps = av_d2q(av_int2flt(get_be32(pb)), INT_MAX); - thp->framecnt = get_be32(pb); - thp->first_framesz = get_be32(pb); - get_be32(pb); /* Data size. */ + thp->fps = av_d2q(av_int2flt(avio_rb32(pb)), INT_MAX); + thp->framecnt = avio_rb32(pb); + thp->first_framesz = avio_rb32(pb); + avio_rb32(pb); /* Data size. */ - thp->compoff = get_be32(pb); - get_be32(pb); /* offsetDataOffset. */ - thp->first_frame = get_be32(pb); - thp->last_frame = get_be32(pb); + thp->compoff = avio_rb32(pb); + avio_rb32(pb); /* offsetDataOffset. */ + thp->first_frame = avio_rb32(pb); + thp->last_frame = avio_rb32(pb); thp->next_framesz = thp->first_framesz; thp->next_frame = thp->first_frame; /* Read the component structure. */ url_fseek (pb, thp->compoff, SEEK_SET); - thp->compcount = get_be32(pb); + thp->compcount = avio_rb32(pb); /* Read the list of component types. */ - get_buffer(pb, thp->components, 16); + avio_read(pb, thp->components, 16); for (i = 0; i < thp->compcount; i++) { if (thp->components[i] == 0) { @@ -103,14 +103,14 @@ static int thp_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_THP; st->codec->codec_tag = 0; /* no fourcc */ - st->codec->width = get_be32(pb); - st->codec->height = get_be32(pb); + st->codec->width = avio_rb32(pb); + st->codec->height = avio_rb32(pb); st->codec->sample_rate = av_q2d(thp->fps); thp->vst = st; thp->video_stream_index = st->index; if (thp->version == 0x11000) - get_be32(pb); /* Unknown. */ + avio_rb32(pb); /* Unknown. */ } else if (thp->components[i] == 1) { if (thp->has_audio != 0) break; @@ -123,8 +123,8 @@ static int thp_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_THP; st->codec->codec_tag = 0; /* no fourcc */ - st->codec->channels = get_be32(pb); /* numChannels. */ - st->codec->sample_rate = get_be32(pb); /* Frequency. */ + st->codec->channels = avio_rb32(pb); /* numChannels. */ + st->codec->sample_rate = avio_rb32(pb); /* Frequency. */ av_set_pts_info(st, 64, 1, st->codec->sample_rate); @@ -153,15 +153,15 @@ static int thp_read_packet(AVFormatContext *s, /* Locate the next frame and read out its size. */ thp->next_frame += thp->next_framesz; - thp->next_framesz = get_be32(pb); + thp->next_framesz = avio_rb32(pb); - get_be32(pb); /* Previous total size. */ - size = get_be32(pb); /* Total size of this frame. */ + avio_rb32(pb); /* Previous total size. */ + size = avio_rb32(pb); /* Total size of this frame. */ /* Store the audiosize so the next time this function is called, the audio can be read. */ if (thp->has_audio) - thp->audiosize = get_be32(pb); /* Audio size. */ + thp->audiosize = avio_rb32(pb); /* Audio size. */ else thp->frame++; diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index f85f99b8ba..e368b17959 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -86,7 +86,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb) url_fseek(pb, 256, SEEK_SET); for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) { - sz = get_le16(pb); + sz = avio_rl16(pb); if (sz == 0) break; else { @@ -114,7 +114,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num return AVERROR_INVALIDDATA; url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET); - if (get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size) + if (avio_read(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size) return AVERROR(EIO); seq_buffer->fill_size += data_size; @@ -131,7 +131,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) url_fseek(pb, seq->current_frame_offs, SEEK_SET); /* sound data */ - seq->current_audio_data_offs = get_le16(pb); + seq->current_audio_data_offs = avio_rl16(pb); if (seq->current_audio_data_offs) { seq->current_audio_data_size = SEQ_AUDIO_BUFFER_SIZE * 2; } else { @@ -139,7 +139,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) } /* palette data */ - seq->current_pal_data_offs = get_le16(pb); + seq->current_pal_data_offs = avio_rl16(pb); if (seq->current_pal_data_offs) { seq->current_pal_data_size = 768; } else { @@ -148,10 +148,10 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) /* video data */ for (i = 0; i < 4; i++) - buffer_num[i] = get_byte(pb); + buffer_num[i] = avio_r8(pb); for (i = 0; i < 4; i++) - offset_table[i] = get_le16(pb); + offset_table[i] = avio_rl16(pb); for (i = 0; i < 3; i++) { if (offset_table[i]) { @@ -257,7 +257,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) if (seq->current_pal_data_size) { pkt->data[0] |= 1; url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET); - if (get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size) + if (avio_read(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size) return AVERROR(EIO); } if (seq->current_video_data_size) { diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 14450a2c51..3fe9e65dcc 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -70,7 +70,7 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) AVRational fps; unsigned comp_method, char_cols, char_rows, features; - if (get_le32(pb) != TMV_TAG) + if (avio_rl32(pb) != TMV_TAG) return -1; if (!(vst = av_new_stream(s, 0))) @@ -79,30 +79,30 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!(ast = av_new_stream(s, 0))) return AVERROR(ENOMEM); - ast->codec->sample_rate = get_le16(pb); + ast->codec->sample_rate = avio_rl16(pb); if (!ast->codec->sample_rate) { av_log(s, AV_LOG_ERROR, "invalid sample rate\n"); return -1; } - tmv->audio_chunk_size = get_le16(pb); + tmv->audio_chunk_size = avio_rl16(pb); if (!tmv->audio_chunk_size) { av_log(s, AV_LOG_ERROR, "invalid audio chunk size\n"); return -1; } - comp_method = get_byte(pb); + comp_method = avio_r8(pb); if (comp_method) { av_log(s, AV_LOG_ERROR, "unsupported compression method %d\n", comp_method); return -1; } - char_cols = get_byte(pb); - char_rows = get_byte(pb); + char_cols = avio_r8(pb); + char_rows = avio_r8(pb); tmv->video_chunk_size = char_cols * char_rows * 2; - features = get_byte(pb); + features = avio_r8(pb); if (features & ~(TMV_PADDING | TMV_STEREO)) { av_log(s, AV_LOG_ERROR, "unsupported features 0x%02x\n", features & ~(TMV_PADDING | TMV_STEREO)); diff --git a/libavformat/tta.c b/libavformat/tta.c index 21b7538d26..61a41df90b 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -47,19 +47,19 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) ff_id3v1_read(s); start_offset = url_ftell(s->pb); - if (get_le32(s->pb) != AV_RL32("TTA1")) + if (avio_rl32(s->pb) != AV_RL32("TTA1")) return -1; // not tta file url_fskip(s->pb, 2); // FIXME: flags - channels = get_le16(s->pb); - bps = get_le16(s->pb); - samplerate = get_le32(s->pb); + channels = avio_rl16(s->pb); + bps = avio_rl16(s->pb); + samplerate = avio_rl32(s->pb); if(samplerate <= 0 || samplerate > 1000000){ av_log(s, AV_LOG_ERROR, "nonsense samplerate\n"); return -1; } - datalen = get_le32(s->pb); + datalen = avio_rl32(s->pb); if(datalen < 0){ av_log(s, AV_LOG_ERROR, "nonsense datalen\n"); return -1; @@ -87,7 +87,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) framepos = url_ftell(s->pb) + 4*c->totalframes + 4; for (i = 0; i < c->totalframes; i++) { - uint32_t size = get_le32(s->pb); + uint32_t size = avio_rl32(s->pb); av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME); framepos += size; } @@ -101,13 +101,13 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata_size = url_ftell(s->pb) - start_offset; if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){ - //this check is redundant as get_buffer should fail + //this check is redundant as avio_read should fail av_log(s, AV_LOG_ERROR, "extradata_size too large\n"); return -1; } st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); url_fseek(s->pb, start_offset, SEEK_SET); - get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size); + avio_read(s->pb, st->codec->extradata, st->codec->extradata_size); return 0; } diff --git a/libavformat/tty.c b/libavformat/tty.c index d576fd4338..767006b5a3 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -47,14 +47,14 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos) int len; url_fseek(pb, start_pos, SEEK_SET); - if (get_byte(pb) != 0x1A) + if (avio_r8(pb) != 0x1A) return -1; #define GET_EFI_META(name,size) \ - len = get_byte(pb); \ + len = avio_r8(pb); \ if (len < 1 || len > size) \ return -1; \ - if (get_buffer(pb, buf, size) == size) { \ + if (avio_read(pb, buf, size) == size) { \ buf[len] = 0; \ av_metadata_set2(&avctx->metadata, name, buf, 0); \ } diff --git a/libavformat/txd.c b/libavformat/txd.c index 76d68a8190..92a0c094aa 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -57,9 +57,9 @@ static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret; next_chunk: - id = get_le32(pb); - chunk_size = get_le32(pb); - marker = get_le32(pb); + id = avio_rl32(pb); + chunk_size = avio_rl32(pb); + marker = avio_rl32(pb); if (url_feof(s->pb)) return AVERROR_EOF; diff --git a/libavformat/utils.c b/libavformat/utils.c index 3cf914a748..f5d60a3bfc 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -332,7 +332,7 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size) pkt->pos= url_ftell(s); - ret= get_buffer(s, pkt->data, size); + ret= avio_read(s, pkt->data, size); if(ret<=0) av_free_packet(pkt); else @@ -351,7 +351,7 @@ int av_append_packet(AVIOContext *s, AVPacket *pkt, int size) ret = av_grow_packet(pkt, size); if (ret < 0) return ret; - ret = get_buffer(s, pkt->data + old_size, size); + ret = avio_read(s, pkt->data + old_size, size); av_shrink_packet(pkt, old_size + FFMAX(ret, 0)); return ret; } @@ -555,7 +555,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, /* read probe data */ buf = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE); - if ((ret = get_buffer(pb, buf + buf_offset, probe_size - buf_offset)) < 0) { + if ((ret = avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) { /* fail if error was not end of file, otherwise, lower score */ if (ret != AVERROR_EOF) { av_free(buf); diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 0be6ec3325..838dd43b5f 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -49,8 +49,8 @@ static int vc1t_read_header(AVFormatContext *s, int frames; uint32_t fps; - frames = get_le24(pb); - if(get_byte(pb) != 0xC5 || get_le32(pb) != 4) + frames = avio_rl24(pb); + if(avio_r8(pb) != 0xC5 || avio_rl32(pb) != 4) return -1; /* init video codec */ @@ -63,13 +63,13 @@ static int vc1t_read_header(AVFormatContext *s, st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE); st->codec->extradata_size = VC1_EXTRADATA_SIZE; - get_buffer(pb, st->codec->extradata, VC1_EXTRADATA_SIZE); - st->codec->height = get_le32(pb); - st->codec->width = get_le32(pb); - if(get_le32(pb) != 0xC) + avio_read(pb, st->codec->extradata, VC1_EXTRADATA_SIZE); + st->codec->height = avio_rl32(pb); + st->codec->width = avio_rl32(pb); + if(avio_rl32(pb) != 0xC) return -1; url_fskip(pb, 8); - fps = get_le32(pb); + fps = avio_rl32(pb); if(fps == 0xFFFFFFFF) av_set_pts_info(st, 32, 1, 1000); else{ @@ -95,10 +95,10 @@ static int vc1t_read_packet(AVFormatContext *s, if(url_feof(pb)) return AVERROR(EIO); - frame_size = get_le24(pb); - if(get_byte(pb) & 0x80) + frame_size = avio_rl24(pb); + if(avio_r8(pb) & 0x80) keyframe = 1; - pts = get_le32(pb); + pts = avio_rl32(pb); if(av_get_packet(pb, pkt, frame_size) < 0) return AVERROR(EIO); if(s->streams[0]->time_base.den == 1000) diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index 056a657ec2..01bbdb2c62 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -46,7 +46,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st; url_fskip(pb, 20); - header_size = get_le16(pb) - 22; + header_size = avio_rl16(pb) - 22; if (header_size != 4) { av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size); return AVERROR(ENOSYS); @@ -73,10 +73,10 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) int channels = 1; while (!voc->remaining_size) { - type = get_byte(pb); + type = avio_r8(pb); if (type == VOC_TYPE_EOF) return AVERROR(EIO); - voc->remaining_size = get_le24(pb); + voc->remaining_size = avio_rl24(pb); if (!voc->remaining_size) { if (url_is_streamed(s->pb)) return AVERROR(EIO); @@ -86,11 +86,11 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) switch (type) { case VOC_TYPE_VOICE_DATA: - dec->sample_rate = 1000000 / (256 - get_byte(pb)); + dec->sample_rate = 1000000 / (256 - avio_r8(pb)); if (sample_rate) dec->sample_rate = sample_rate; dec->channels = channels; - tmp_codec = get_byte(pb); + tmp_codec = avio_r8(pb); dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id); voc->remaining_size -= 2; max_size -= 2; @@ -101,19 +101,19 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) break; case VOC_TYPE_EXTENDED: - sample_rate = get_le16(pb); - get_byte(pb); - channels = get_byte(pb) + 1; + sample_rate = avio_rl16(pb); + avio_r8(pb); + channels = avio_r8(pb) + 1; sample_rate = 256000000 / (channels * (65536 - sample_rate)); voc->remaining_size = 0; max_size -= 4; break; case VOC_TYPE_NEW_VOICE_DATA: - dec->sample_rate = get_le32(pb); - dec->bits_per_coded_sample = get_byte(pb); - dec->channels = get_byte(pb); - tmp_codec = get_le16(pb); + dec->sample_rate = avio_rl32(pb); + dec->bits_per_coded_sample = avio_r8(pb); + dec->channels = avio_r8(pb); + tmp_codec = avio_rl16(pb); url_fskip(pb, 4); voc->remaining_size -= 12; max_size -= 12; diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 9cf0c3a6ad..8a3d170574 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -54,7 +54,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, buf = av_malloc(len+1); if (!buf) return; - get_buffer(s->pb, buf, len); + avio_read(s->pb, buf, len); buf[len] = 0; av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL); } @@ -74,7 +74,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) url_fskip(s->pb, 12); - header_size = get_be32(s->pb); + header_size = avio_rb32(s->pb); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_TWINVQ; @@ -82,12 +82,12 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) do { int len; - chunk_tag = get_le32(s->pb); + chunk_tag = avio_rl32(s->pb); if (chunk_tag == MKTAG('D','A','T','A')) break; - len = get_be32(s->pb); + len = avio_rb32(s->pb); if ((unsigned) len > INT_MAX/2) { av_log(s, AV_LOG_ERROR, "Malformed header\n"); @@ -98,9 +98,9 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) switch(chunk_tag){ case MKTAG('C','O','M','M'): - st->codec->channels = get_be32(s->pb) + 1; - read_bitrate = get_be32(s->pb); - rate_flag = get_be32(s->pb); + st->codec->channels = avio_rb32(s->pb) + 1; + read_bitrate = avio_rb32(s->pb); + rate_flag = avio_rb32(s->pb); url_fskip(s->pb, len-12); st->codec->bit_rate = read_bitrate*1000; @@ -208,7 +208,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip pkt->data[1] = c->last_frame_bits; - ret = get_buffer(s->pb, pkt->data+2, size); + ret = avio_read(s->pb, pkt->data+2, size); if (ret<=0) { av_free_packet(pkt); diff --git a/libavformat/wav.c b/libavformat/wav.c index 47f0c2e37d..9a6e7619b6 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -143,8 +143,8 @@ AVOutputFormat ff_wav_muxer = { static int64_t next_tag(AVIOContext *pb, unsigned int *tag) { - *tag = get_le32(pb); - return get_le32(pb); + *tag = avio_rl32(pb); + return avio_rl32(pb); } /* return the size of the found tag */ @@ -197,25 +197,25 @@ static int wav_read_header(AVFormatContext *s, WAVContext *wav = s->priv_data; /* check RIFF header */ - tag = get_le32(pb); + tag = avio_rl32(pb); rf64 = tag == MKTAG('R', 'F', '6', '4'); if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F')) return -1; - get_le32(pb); /* file size */ - tag = get_le32(pb); + avio_rl32(pb); /* file size */ + tag = avio_rl32(pb); if (tag != MKTAG('W', 'A', 'V', 'E')) return -1; if (rf64) { - if (get_le32(pb) != MKTAG('d', 's', '6', '4')) + if (avio_rl32(pb) != MKTAG('d', 's', '6', '4')) return -1; - size = get_le32(pb); + size = avio_rl32(pb); if (size < 16) return -1; - get_le64(pb); /* RIFF size */ - data_size = get_le64(pb); - sample_count = get_le64(pb); + avio_rl64(pb); /* RIFF size */ + data_size = avio_rl64(pb); + sample_count = avio_rl64(pb); url_fskip(pb, size - 16); /* skip rest of ds64 chunk */ } @@ -239,7 +239,7 @@ static int wav_read_header(AVFormatContext *s, if (tag == MKTAG('d', 'a', 't', 'a')){ break; }else if (tag == MKTAG('f','a','c','t') && !sample_count){ - sample_count = get_le32(pb); + sample_count = avio_rl32(pb); size -= 4; } url_fseek(pb, size, SEEK_CUR); @@ -269,8 +269,8 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) int64_t size; while (!url_feof(pb)) { - get_buffer(pb, guid, 16); - size = get_le64(pb); + avio_read(pb, guid, 16); + size = avio_rl64(pb); if (size <= 24) return -1; if (!memcmp(guid, guid1, 16)) @@ -384,14 +384,14 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st; uint8_t guid[16]; - get_buffer(pb, guid, 16); + avio_read(pb, guid, 16); if (memcmp(guid, guid_riff, 16)) return -1; - if (get_le64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */ + if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */ return -1; - get_buffer(pb, guid, 16); + avio_read(pb, guid, 16); if (memcmp(guid, guid_wave, 16)) { av_log(s, AV_LOG_ERROR, "could not find wave guid\n"); return -1; diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 4d9ab28e3b..478b46f913 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -105,8 +105,8 @@ static int wc3_read_header(AVFormatContext *s, /* traverse through the chunks and load the header information before * the first BRCH tag */ - fourcc_tag = get_le32(pb); - size = (get_be32(pb) + 1) & (~1); + fourcc_tag = avio_rl32(pb); + size = (avio_rb32(pb) + 1) & (~1); do { switch (fourcc_tag) { @@ -127,7 +127,7 @@ static int wc3_read_header(AVFormatContext *s, buffer = av_malloc(size+1); if (!buffer) return AVERROR(ENOMEM); - if ((ret = get_buffer(pb, buffer, size)) != size) + if ((ret = avio_read(pb, buffer, size)) != size) return AVERROR(EIO); buffer[size] = 0; av_metadata_set2(&s->metadata, "title", buffer, @@ -136,8 +136,8 @@ static int wc3_read_header(AVFormatContext *s, case SIZE_TAG: /* video resolution override */ - wc3->width = get_le32(pb); - wc3->height = get_le32(pb); + wc3->width = avio_rl32(pb); + wc3->height = avio_rl32(pb); break; case PALT_TAG: @@ -154,9 +154,9 @@ static int wc3_read_header(AVFormatContext *s, break; } - fourcc_tag = get_le32(pb); + fourcc_tag = avio_rl32(pb); /* chunk sizes are 16-bit aligned */ - size = (get_be32(pb) + 1) & (~1); + size = (avio_rb32(pb) + 1) & (~1); if (url_feof(pb)) return AVERROR(EIO); @@ -205,9 +205,9 @@ static int wc3_read_packet(AVFormatContext *s, while (!packet_read) { - fourcc_tag = get_le32(pb); + fourcc_tag = avio_rl32(pb); /* chunk sizes are 16-bit aligned */ - size = (get_be32(pb) + 1) & (~1); + size = (avio_rb32(pb) + 1) & (~1); if (url_feof(pb)) return AVERROR(EIO); @@ -242,7 +242,7 @@ static int wc3_read_packet(AVFormatContext *s, #if 0 url_fseek(pb, size, SEEK_CUR); #else - if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size) + if ((unsigned)size > sizeof(text) || (ret = avio_read(pb, text, size)) != size) ret = AVERROR(EIO); else { int i = 0; diff --git a/libavformat/westwood.c b/libavformat/westwood.c index 7666bd80b3..b923fef79c 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -130,7 +130,7 @@ static int wsaud_read_header(AVFormatContext *s, AVStream *st; unsigned char header[AUD_HEADER_SIZE]; - if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE) + if (avio_read(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE) return AVERROR(EIO); wsaud->audio_samplerate = AV_RL16(&header[0]); if (header[11] == 99) @@ -173,7 +173,7 @@ static int wsaud_read_packet(AVFormatContext *s, unsigned int chunk_size; int ret = 0; - if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) != AUD_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); @@ -237,7 +237,7 @@ static int wsvqa_read_header(AVFormatContext *s, st->codec->extradata_size = VQA_HEADER_SIZE; st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); header = (unsigned char *)st->codec->extradata; - if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) != + if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) != VQA_HEADER_SIZE) { av_free(st->codec->extradata); return AVERROR(EIO); @@ -277,7 +277,7 @@ static int wsvqa_read_header(AVFormatContext *s, /* there are 0 or more chunks before the FINF chunk; iterate until * FINF has been skipped and the file will be ready to be demuxed */ do { - if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) { + if (avio_read(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) { av_free(st->codec->extradata); return AVERROR(EIO); } @@ -320,7 +320,7 @@ static int wsvqa_read_packet(AVFormatContext *s, unsigned int chunk_size; int skip_byte; - while (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) { + while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) { chunk_type = AV_RB32(&preamble[0]); chunk_size = AV_RB32(&preamble[4]); skip_byte = chunk_size & 0x01; @@ -329,7 +329,7 @@ static int wsvqa_read_packet(AVFormatContext *s, if (av_new_packet(pkt, chunk_size)) return AVERROR(EIO); - ret = get_buffer(pb, pkt->data, chunk_size); + ret = avio_read(pb, pkt->data, chunk_size); if (ret != chunk_size) { av_free_packet(pkt); return AVERROR(EIO); diff --git a/libavformat/wtv.c b/libavformat/wtv.c index e8b6268db3..0ed06aaa58 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -88,7 +88,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) int remaining_in_sector = (1 << wf->sector_bits) - (wf->position & ((1 << wf->sector_bits) - 1)); int read_request = FFMIN(buf_size - nread, remaining_in_sector); - n = get_buffer(pb, buf, read_request); + n = avio_read(pb, buf, read_request); if (n <= 0) break; nread += n; @@ -140,7 +140,7 @@ static int read_ints(AVIOContext *pb, uint32_t *data, int count) { int i, total = 0; for (i = 0; i < count; i++) { - if ((data[total] = get_le32(pb))) + if ((data[total] = avio_rl32(pb))) total++; } return total; @@ -474,9 +474,9 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) if (strcmp(mime, "image/jpeg")) goto done; - get_byte(pb); + avio_r8(pb); avio_get_str16le(pb, INT_MAX, description, sizeof(description)); - filesize = get_le32(pb); + filesize = avio_rl32(pb); if (!filesize) goto done; @@ -490,7 +490,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) if (!st->codec->extradata) goto done; st->codec->extradata_size = filesize; - get_buffer(pb, st->codec->extradata, filesize); + avio_read(pb, st->codec->extradata, filesize); done: url_fseek(pb, pos + length, SEEK_SET); } @@ -503,7 +503,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty return; if (type == 0 && length == 4) { - snprintf(buf, buf_size, "%"PRIi32, get_le32(pb)); + snprintf(buf, buf_size, "%"PRIi32, avio_rl32(pb)); } else if (type == 1) { avio_get_str16le(pb, length, buf, buf_size); if (!strlen(buf)) { @@ -511,9 +511,9 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty return; } } else if (type == 3 && length == 4) { - strcpy(buf, get_le32(pb) ? "true" : "false"); + strcpy(buf, avio_rl32(pb) ? "true" : "false"); } else if (type == 4 && length == 8) { - int64_t num = get_le64(pb); + int64_t num = avio_rl64(pb); if (!strcmp(key, "WM/EncodingTime") || !strcmp(key, "WM/MediaOriginalBroadcastDateTime")) filetime_to_iso8601(buf, buf_size, num); @@ -527,10 +527,10 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty else snprintf(buf, buf_size, "%"PRIi64, num); } else if (type == 5 && length == 2) { - snprintf(buf, buf_size, "%"PRIi16, get_le16(pb)); + snprintf(buf, buf_size, "%"PRIi16, avio_rl16(pb)); } else if (type == 6 && length == 16) { ff_asf_guid guid; - get_buffer(pb, guid, 16); + avio_read(pb, guid, 16); snprintf(buf, buf_size, PRI_PRETTY_GUID, ARG_PRETTY_GUID(guid)); } else if (type == 2 && !strcmp(key, "WM/Picture")) { get_attachment(s, pb, length); @@ -557,8 +557,8 @@ static void parse_legacy_attrib(AVFormatContext *s, AVIOContext *pb) while(!url_feof(pb)) { char key[1024]; ff_get_guid(pb, &guid); - type = get_le32(pb); - length = get_le32(pb); + type = avio_rl32(pb); + length = avio_rl32(pb); if (!length) break; if (ff_guidcmp(&guid, metadata_guid)) { @@ -775,10 +775,10 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p int len, sid, consumed; ff_get_guid(pb, &g); - len = get_le32(pb); + len = avio_rl32(pb); if (len < 32) break; - sid = get_le32(pb) & 0x7FFF; + sid = avio_rl32(pb) & 0x7FFF; url_fskip(pb, 8); consumed = 32; @@ -791,7 +791,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p ff_get_guid(pb, &subtype); url_fskip(pb, 12); ff_get_guid(pb, &formattype); - size = get_le32(pb); + size = avio_rl32(pb); parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); consumed += 92 + size; } @@ -805,7 +805,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p ff_get_guid(pb, &subtype); url_fskip(pb, 12); ff_get_guid(pb, &formattype); - size = get_le32(pb); + size = avio_rl32(pb); parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size); consumed += 76 + size; } @@ -831,7 +831,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } buf_size = FFMIN(len - consumed, sizeof(buf)); - get_buffer(pb, buf, buf_size); + avio_read(pb, buf, buf_size); consumed += buf_size; ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, 0, 0, 0, 0); } @@ -841,7 +841,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p AVStream *st = s->streams[stream_index]; int audio_type; url_fskip(pb, 8); - audio_type = get_byte(pb); + audio_type = avio_r8(pb); if (audio_type == 2) st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; else if (audio_type == 3) @@ -852,7 +852,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { url_fskip(pb, 12); - if (get_le32(pb)) + if (avio_rl32(pb)) av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index); consumed += 16; } @@ -862,7 +862,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p AVStream *st = s->streams[stream_index]; uint8_t language[4]; url_fskip(pb, 12); - get_buffer(pb, language, 3); + avio_read(pb, language, 3); if (language[0]) { language[3] = 0; av_metadata_set2(&st->metadata, "language", language, 0); @@ -875,7 +875,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { url_fskip(pb, 8); - wtv->pts = get_le64(pb); + wtv->pts = avio_rl64(pb); consumed += 16; if (wtv->pts == -1) wtv->pts = AV_NOPTS_VALUE; @@ -955,16 +955,16 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) /* read root directory sector */ url_fskip(s->pb, 0x30); - root_size = get_le32(s->pb); + root_size = avio_rl32(s->pb); if (root_size > sizeof(root)) { av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n"); return AVERROR_INVALIDDATA; } url_fskip(s->pb, 4); - root_sector = get_le32(s->pb); + root_sector = avio_rl32(s->pb); url_fseek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); - root_size = get_buffer(s->pb, root, root_size); + root_size = avio_read(s->pb, root, root_size); if (root_size < 0) return AVERROR_INVALIDDATA; @@ -995,8 +995,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) pb = wtvfile_open(s, root, root_size, table_0_entries_time_le16); if (pb) { while(1) { - uint64_t timestamp = get_le64(pb); - uint64_t frame_nb = get_le64(pb); + uint64_t timestamp = avio_rl64(pb); + uint64_t frame_nb = avio_rl64(pb); if (url_feof(pb)) break; ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size, @@ -1009,8 +1009,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) if (pb) { int i; while (1) { - uint64_t frame_nb = get_le64(pb); - uint64_t position = get_le64(pb); + uint64_t frame_nb = avio_rl64(pb); + uint64_t position = avio_rl64(pb); if (url_feof(pb)) break; for (i = wtv->nb_index_entries - 1; i >= 0; i--) { diff --git a/libavformat/wv.c b/libavformat/wv.c index 3ee59970c9..fca35b818b 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -86,25 +86,25 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen wc->pos = url_ftell(pb); if(!append){ - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('w', 'v', 'p', 'k')) return -1; - size = get_le32(pb); + size = avio_rl32(pb); if(size < 24 || size > WV_BLOCK_LIMIT){ av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size); return -1; } wc->blksize = size; - ver = get_le16(pb); + ver = avio_rl16(pb); if(ver < 0x402 || ver > 0x410){ av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver); return -1; } - get_byte(pb); // track no - get_byte(pb); // track sub index - wc->samples = get_le32(pb); // total samples in file - wc->soff = get_le32(pb); // offset in samples of current block - get_buffer(pb, wc->extra, WV_EXTRA_SIZE); + avio_r8(pb); // track no + avio_r8(pb); // track sub index + wc->samples = avio_rl32(pb); // total samples in file + wc->soff = avio_rl32(pb); // offset in samples of current block + avio_read(pb, wc->extra, WV_EXTRA_SIZE); }else{ size = wc->blksize; } @@ -127,8 +127,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen } while(url_ftell(pb) < block_end){ int id, size; - id = get_byte(pb); - size = (id & 0x80) ? get_le24(pb) : get_byte(pb); + id = avio_r8(pb); + size = (id & 0x80) ? avio_rl24(pb) : avio_r8(pb); size <<= 1; if(id&0x40) size--; @@ -138,24 +138,24 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n"); return -1; } - chan = get_byte(pb); + chan = avio_r8(pb); switch(size - 2){ case 0: - chmask = get_byte(pb); + chmask = avio_r8(pb); break; case 1: - chmask = get_le16(pb); + chmask = avio_rl16(pb); break; case 2: - chmask = get_le24(pb); + chmask = avio_rl24(pb); break; case 3: - chmask = get_le32(pb); + chmask = avio_rl32(pb); break; case 5: url_fskip(pb, 1); - chan |= (get_byte(pb) & 0xF) << 8; - chmask = get_le24(pb); + chan |= (avio_r8(pb) & 0xF) << 8; + chmask = avio_rl24(pb); break; default: av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size); @@ -163,7 +163,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen } break; case 0x27: - rate = get_le24(pb); + rate = avio_rl24(pb); break; default: url_fskip(pb, size); @@ -254,13 +254,13 @@ static int wv_read_packet(AVFormatContext *s, if(wc->multichannel) AV_WL32(pkt->data, wc->blksize + WV_EXTRA_SIZE + 12); memcpy(pkt->data + off, wc->extra, WV_EXTRA_SIZE); - ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize); + ret = avio_read(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize); if(ret != wc->blksize){ av_free_packet(pkt); return AVERROR(EIO); } while(!(wc->flags & WV_END_BLOCK)){ - if(get_le32(s->pb) != MKTAG('w', 'v', 'p', 'k')){ + if(avio_rl32(s->pb) != MKTAG('w', 'v', 'p', 'k')){ av_free_packet(pkt); return -1; } @@ -275,16 +275,16 @@ static int wv_read_packet(AVFormatContext *s, return -1; } wc->blksize = size; - ver = get_le16(s->pb); + ver = avio_rl16(s->pb); if(ver < 0x402 || ver > 0x410){ av_free_packet(pkt); av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver); return -1; } - get_byte(s->pb); // track no - get_byte(s->pb); // track sub index - wc->samples = get_le32(s->pb); // total samples in file - wc->soff = get_le32(s->pb); // offset in samples of current block + avio_r8(s->pb); // track no + avio_r8(s->pb); // track sub index + wc->samples = avio_rl32(s->pb); // total samples in file + wc->soff = avio_rl32(s->pb); // offset in samples of current block if((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0){ av_free_packet(pkt); return ret; diff --git a/libavformat/xa.c b/libavformat/xa.c index 504c9b20d6..858a74201e 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -77,14 +77,14 @@ static int xa_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA; url_fskip(pb, 4); /* Skip the XA ID */ - xa->out_size = get_le32(pb); + xa->out_size = avio_rl32(pb); url_fskip(pb, 2); /* Skip the tag */ - st->codec->channels = get_le16(pb); - st->codec->sample_rate = get_le32(pb); + st->codec->channels = avio_rl16(pb); + st->codec->sample_rate = avio_rl32(pb); /* Value in file is average byte rate*/ - st->codec->bit_rate = get_le32(pb) * 8; - st->codec->block_align = get_le16(pb); - st->codec->bits_per_coded_sample = get_le16(pb); + st->codec->bit_rate = avio_rl32(pb) * 8; + st->codec->block_align = avio_rl16(pb); + st->codec->bits_per_coded_sample = avio_rl16(pb); av_set_pts_info(st, 64, 1, st->codec->sample_rate); diff --git a/libavformat/yop.c b/libavformat/yop.c index 9e7b8efe77..2e58cc660a 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -83,14 +83,14 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) url_fskip(pb, 6); - frame_rate = get_byte(pb); - yop->frame_size = get_byte(pb) * 2048; - video_dec->width = get_le16(pb); - video_dec->height = get_le16(pb); + frame_rate = avio_r8(pb); + yop->frame_size = avio_r8(pb) * 2048; + video_dec->width = avio_rl16(pb); + video_dec->height = avio_rl16(pb); video_stream->sample_aspect_ratio = (AVRational){1, 2}; - ret = get_buffer(pb, video_dec->extradata, 8); + ret = avio_read(pb, video_dec->extradata, 8); if (ret < 8) return ret < 0 ? ret : AVERROR_EOF; @@ -138,7 +138,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) yop->video_packet.pos = url_ftell(pb); - ret = get_buffer(pb, yop->video_packet.data, yop->palette_size); + ret = avio_read(pb, yop->video_packet.data, yop->palette_size); if (ret < 0) { goto err_out; }else if (ret < yop->palette_size) { @@ -155,7 +155,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) url_fskip(pb, yop->audio_block_length - ret); - ret = get_buffer(pb, yop->video_packet.data + yop->palette_size, + ret = avio_read(pb, yop->video_packet.data + yop->palette_size, actual_video_data_size); if (ret < 0) goto err_out; diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index ac3010e694..54b77370af 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -200,7 +200,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) struct frame_attributes *s1 = s->priv_data; for (i=0; ipriv_data; for (i=0; ipb); + header[i] = avio_r8(s->pb); if (header[i] == '\n') { header[i+1] = 0; break; From b3db9ceef13037f2b6963a84b7abf8871a1e0f8a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 21 Feb 2011 19:28:16 +0100 Subject: [PATCH 427/528] avio: make get_partial_buffer internal. Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 9 +-------- libavformat/avio_internal.h | 8 ++++++++ libavformat/aviobuf.c | 6 +++++- libavformat/rawdec.c | 3 ++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index fa71d20d59..43d94db790 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -385,6 +385,7 @@ attribute_deprecated AVIOContext *av_alloc_put_byte( * @{ */ attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size); +attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); attribute_deprecated int get_byte(AVIOContext *s); attribute_deprecated unsigned int get_le16(AVIOContext *s); attribute_deprecated unsigned int get_le24(AVIOContext *s); @@ -498,14 +499,6 @@ void put_flush_packet(AVIOContext *s); */ int avio_read(AVIOContext *s, unsigned char *buf, int size); -/** - * Read size bytes from AVIOContext into buf. - * This reads at most 1 packet. If that is not enough fewer bytes will be - * returned. - * @return number of bytes read or AVERROR - */ -int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); - /** @note return 0 if EOF, so you cannot use it if EOF handling is necessary */ int avio_r8 (AVIOContext *s); diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 1cebcd72c8..16715377b5 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -32,4 +32,12 @@ int ffio_init_context(AVIOContext *s, int64_t (*seek)(void *opaque, int64_t offset, int whence)); +/** + * Read size bytes from AVIOContext into buf. + * This reads at most 1 packet. If that is not enough fewer bytes will be + * returned. + * @return number of bytes read or AVERROR + */ +int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size); + #endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 28825506d5..fd1419893c 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -324,6 +324,10 @@ int get_buffer(AVIOContext *s, unsigned char *buf, int size) { return avio_read(s, buf, size); } +int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size) +{ + return ffio_read_partial(s, buf, size); +} #endif int avio_put_str(AVIOContext *s, const char *str) @@ -548,7 +552,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) return size1 - size; } -int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size) +int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size) { int len; diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 4f830e3c20..1c2f1211df 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -21,6 +21,7 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "rawdec.h" /* raw input */ @@ -81,7 +82,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) pkt->pos= url_ftell(s->pb); pkt->stream_index = 0; - ret = get_partial_buffer(s->pb, pkt->data, size); + ret = ffio_read_partial(s->pb, pkt->data, size); if (ret < 0) { av_free_packet(pkt); return ret; From 78e2380a6d09e7a8b2a74d090abfb0a922e046f6 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 21 Feb 2011 13:44:37 -0500 Subject: [PATCH 428/528] targa: prevent integer overflow in bufsize check. --- libavcodec/targa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/targa.c b/libavcodec/targa.c index 0892b6f0ed..3c220f4082 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -34,7 +34,7 @@ typedef struct TargaContext { } TargaContext; #define CHECK_BUFFER_SIZE(buf, buf_end, needed, where) \ - if(buf + needed > buf_end){ \ + if(needed > buf_end - buf){ \ av_log(avctx, AV_LOG_ERROR, "Problem: unexpected end of data while reading " where "\n"); \ return -1; \ } \ From 77eb5504d3b3e1047900382350e0bc5e0bfb16b5 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 21 Feb 2011 19:28:17 +0100 Subject: [PATCH 429/528] avio: avio: avio_ prefixes for put_* functions In the name of consistency: put_byte -> avio_w8 put_ -> avio_w put_buffer -> avio_write put_nbyte will be made private put_tag will be merged with avio_put_str Signed-off-by: Ronald S. Bultje --- ffserver.c | 6 +- libavformat/a64.c | 12 +- libavformat/adtsenc.c | 6 +- libavformat/aiffenc.c | 36 +- libavformat/amr.c | 2 +- libavformat/asfenc.c | 180 +++---- libavformat/assenc.c | 6 +- libavformat/au.c | 14 +- libavformat/avc.c | 28 +- libavformat/avienc.c | 184 ++++---- libavformat/avio.h | 31 +- libavformat/aviobuf.c | 102 ++-- libavformat/crcenc.c | 2 +- libavformat/daud.c | 6 +- libavformat/dvenc.c | 2 +- libavformat/ffmenc.c | 140 +++--- libavformat/ffmetaenc.c | 16 +- libavformat/filmstripenc.c | 20 +- libavformat/flacenc.c | 12 +- libavformat/flacenc_header.c | 4 +- libavformat/flvenc.c | 124 ++--- libavformat/framecrcenc.c | 2 +- libavformat/gif.c | 70 +-- libavformat/gxfenc.c | 322 ++++++------- libavformat/idroqenc.c | 2 +- libavformat/img2.c | 18 +- libavformat/ivfenc.c | 24 +- libavformat/libnut.c | 2 +- libavformat/matroskadec.c | 12 +- libavformat/matroskaenc.c | 46 +- libavformat/md5enc.c | 2 +- libavformat/mmf.c | 50 +- libavformat/movenc.c | 876 +++++++++++++++++------------------ libavformat/movenchint.c | 40 +- libavformat/mp3enc.c | 30 +- libavformat/mpegenc.c | 82 ++-- libavformat/mpegtsenc.c | 8 +- libavformat/mpjpeg.c | 8 +- libavformat/mxfenc.c | 332 ++++++------- libavformat/nutenc.c | 32 +- libavformat/oggenc.c | 22 +- libavformat/rawenc.c | 2 +- libavformat/riff.c | 64 +-- libavformat/rmenc.c | 192 ++++---- libavformat/rsoenc.c | 12 +- libavformat/rtpdec.c | 58 +-- libavformat/rtpdec_asf.c | 2 +- libavformat/rtpdec_latm.c | 2 +- libavformat/rtpdec_svq3.c | 2 +- libavformat/rtpdec_vp8.c | 2 +- libavformat/rtpdec_xiph.c | 4 +- libavformat/rtpenc.c | 30 +- libavformat/soxenc.c | 30 +- libavformat/spdifenc.c | 8 +- libavformat/swfenc.c | 108 ++--- libavformat/vc1testenc.c | 32 +- libavformat/vocenc.c | 48 +- libavformat/wav.c | 10 +- libavformat/yuv4mpeg.c | 10 +- 59 files changed, 1782 insertions(+), 1747 deletions(-) diff --git a/ffserver.c b/ffserver.c index ecc3f74d67..7bda96889a 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2514,10 +2514,10 @@ static int http_send_data(HTTPContext *c) header[1] = interleaved_index; header[2] = len >> 8; header[3] = len; - put_buffer(pb, header, 4); + avio_write(pb, header, 4); /* write RTP packet data */ c->buffer_ptr += 4; - put_buffer(pb, c->buffer_ptr, len); + avio_write(pb, c->buffer_ptr, len); size = url_close_dyn_buf(pb, &c->packet_buffer); /* prepare asynchronous TCP sending */ rtsp_c->packet_buffer_ptr = c->packet_buffer; @@ -3018,7 +3018,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url) url_fprintf(c->pb, "Content-Type: application/sdp\r\n"); url_fprintf(c->pb, "Content-Length: %d\r\n", content_length); url_fprintf(c->pb, "\r\n"); - put_buffer(c->pb, content, content_length); + avio_write(c->pb, content, content_length); av_free(content); } diff --git a/libavformat/a64.c b/libavformat/a64.c index 46441b23d8..17dcd96b5b 100644 --- a/libavformat/a64.c +++ b/libavformat/a64.c @@ -57,7 +57,7 @@ static int a64_write_header(struct AVFormatContext *s) return AVERROR(EINVAL); break; } - put_buffer(s->pb, header, 2); + avio_write(s->pb, header, 2); c->prev_pkt.size = 0; c->prev_frame_count = 0; return 0; @@ -110,18 +110,18 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt) 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); + avio_write(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); + for(j = 0; j < ch_chunksize; j++) avio_w8(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); + avio_write(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); + for(j = 0; j < frame_size; j++) avio_w8(s->pb, 0); } } @@ -145,7 +145,7 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt) 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); + if(pkt) avio_write(s->pb, pkt->data, pkt->size); break; } diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index c2cb16112c..1f5453dbaf 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -125,13 +125,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; if (adts->write_adts) { ff_adts_write_frame_header(adts, buf, pkt->size, adts->pce_size); - put_buffer(pb, buf, ADTS_HEADER_SIZE); + avio_write(pb, buf, ADTS_HEADER_SIZE); if (adts->pce_size) { - put_buffer(pb, adts->pce_data, adts->pce_size); + avio_write(pb, adts->pce_data, adts->pce_size); adts->pce_size = 0; } } - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); put_flush_packet(pb); return 0; diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index 178bbec42a..49aff8bd78 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -45,7 +45,7 @@ static int aiff_write_header(AVFormatContext *s) /* FORM AIFF header */ put_tag(pb, "FORM"); aiff->form = url_ftell(pb); - put_be32(pb, 0); /* file length */ + avio_wb32(pb, 0); /* file length */ put_tag(pb, aifc ? "AIFC" : "AIFF"); if (aifc) { // compressed audio @@ -56,17 +56,17 @@ static int aiff_write_header(AVFormatContext *s) } /* Version chunk */ put_tag(pb, "FVER"); - put_be32(pb, 4); - put_be32(pb, 0xA2805140); + avio_wb32(pb, 4); + avio_wb32(pb, 0xA2805140); } /* Common chunk */ put_tag(pb, "COMM"); - put_be32(pb, aifc ? 24 : 18); /* size */ - put_be16(pb, enc->channels); /* Number of channels */ + avio_wb32(pb, aifc ? 24 : 18); /* size */ + avio_wb16(pb, enc->channels); /* Number of channels */ aiff->frames = url_ftell(pb); - put_be32(pb, 0); /* Number of frames */ + avio_wb32(pb, 0); /* Number of frames */ if (!enc->bits_per_coded_sample) enc->bits_per_coded_sample = av_get_bits_per_sample(enc->codec_id); @@ -77,22 +77,22 @@ static int aiff_write_header(AVFormatContext *s) if (!enc->block_align) enc->block_align = (enc->bits_per_coded_sample * enc->channels) >> 3; - put_be16(pb, enc->bits_per_coded_sample); /* Sample size */ + avio_wb16(pb, enc->bits_per_coded_sample); /* Sample size */ sample_rate = av_dbl2ext((double)enc->sample_rate); - put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate)); + avio_write(pb, (uint8_t*)&sample_rate, sizeof(sample_rate)); if (aifc) { - put_le32(pb, enc->codec_tag); - put_be16(pb, 0); + avio_wl32(pb, enc->codec_tag); + avio_wb16(pb, 0); } /* Sound data chunk */ put_tag(pb, "SSND"); aiff->ssnd = url_ftell(pb); /* Sound chunk size */ - put_be32(pb, 0); /* Sound samples data size */ - put_be32(pb, 0); /* Data offset */ - put_be32(pb, 0); /* Block-size (block align) */ + avio_wb32(pb, 0); /* Sound samples data size */ + avio_wb32(pb, 0); /* Data offset */ + avio_wb32(pb, 0); /* Block-size (block align) */ av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); @@ -105,7 +105,7 @@ static int aiff_write_header(AVFormatContext *s) static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); return 0; } @@ -119,22 +119,22 @@ static int aiff_write_trailer(AVFormatContext *s) int64_t file_size, end_size; end_size = file_size = url_ftell(pb); if (file_size & 1) { - put_byte(pb, 0); + avio_w8(pb, 0); end_size++; } if (!url_is_streamed(s->pb)) { /* File length */ url_fseek(pb, aiff->form, SEEK_SET); - put_be32(pb, file_size - aiff->form - 4); + avio_wb32(pb, file_size - aiff->form - 4); /* Number of sample frames */ url_fseek(pb, aiff->frames, SEEK_SET); - put_be32(pb, (file_size-aiff->ssnd-12)/enc->block_align); + avio_wb32(pb, (file_size-aiff->ssnd-12)/enc->block_align); /* Sound Data chunk size */ url_fseek(pb, aiff->ssnd, SEEK_SET); - put_be32(pb, file_size - aiff->ssnd - 4); + avio_wb32(pb, file_size - aiff->ssnd - 4); /* return to the end */ url_fseek(pb, end_size, SEEK_SET); diff --git a/libavformat/amr.c b/libavformat/amr.c index 9c64d35716..3b78ba3659 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -56,7 +56,7 @@ static int amr_write_header(AVFormatContext *s) static int amr_write_packet(AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index a529c1bbdf..b181f2321e 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -226,7 +226,7 @@ static const AVCodecTag codec_asf_bmp_tags[] = { static void put_guid(AVIOContext *s, const ff_asf_guid *g) { assert(sizeof(*g) == 16); - put_buffer(s, *g, sizeof(*g)); + avio_write(s, *g, sizeof(*g)); } static void put_str16(AVIOContext *s, const char *tag) @@ -239,8 +239,8 @@ static void put_str16(AVIOContext *s, const char *tag) avio_put_str16le(dyn_buf, tag); len = url_close_dyn_buf(dyn_buf, &pb); - put_le16(s, len); - put_buffer(s, pb, len); + avio_wl16(s, len); + avio_write(s, pb, len); av_freep(&pb); } @@ -250,7 +250,7 @@ static int64_t put_header(AVIOContext *pb, const ff_asf_guid *g) pos = url_ftell(pb); put_guid(pb, g); - put_le64(pb, 24); + avio_wl64(pb, 24); return pos; } @@ -261,7 +261,7 @@ static void end_header(AVIOContext *pb, int64_t pos) pos1 = url_ftell(pb); url_fseek(pb, pos + 16, SEEK_SET); - put_le64(pb, pos1 - pos); + avio_wl64(pb, pos1 - pos); url_fseek(pb, pos1, SEEK_SET); } @@ -273,11 +273,11 @@ static void put_chunk(AVFormatContext *s, int type, int payload_length, int flag int length; length = payload_length + 8; - put_le16(pb, type); - put_le16(pb, length); //size - put_le32(pb, asf->seqno);//sequence number - put_le16(pb, flags); /* unknown bytes */ - put_le16(pb, length); //size_confirm + avio_wl16(pb, type); + avio_wl16(pb, length); //size + avio_wl32(pb, asf->seqno);//sequence number + avio_wl16(pb, flags); /* unknown bytes */ + avio_wl16(pb, length); //size_confirm asf->seqno++; } @@ -331,33 +331,33 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data } put_guid(pb, &ff_asf_header); - put_le64(pb, -1); /* header length, will be patched after */ - put_le32(pb, 3 + has_title + !!metadata_count + s->nb_streams); /* number of chunks in header */ - put_byte(pb, 1); /* ??? */ - put_byte(pb, 2); /* ??? */ + avio_wl64(pb, -1); /* header length, will be patched after */ + avio_wl32(pb, 3 + has_title + !!metadata_count + s->nb_streams); /* number of chunks in header */ + avio_w8(pb, 1); /* ??? */ + avio_w8(pb, 2); /* ??? */ /* file header */ header_offset = url_ftell(pb); hpos = put_header(pb, &ff_asf_file_header); put_guid(pb, &ff_asf_my_guid); - put_le64(pb, file_size); + avio_wl64(pb, file_size); file_time = 0; - put_le64(pb, unix_to_file_time(file_time)); - put_le64(pb, asf->nb_packets); /* number of packets */ - put_le64(pb, duration); /* end time stamp (in 100ns units) */ - put_le64(pb, asf->duration); /* duration (in 100ns units) */ - put_le64(pb, PREROLL_TIME); /* start time stamp */ - put_le32(pb, (asf->is_streamed || url_is_streamed(pb)) ? 3 : 2); /* ??? */ - put_le32(pb, s->packet_size); /* packet size */ - put_le32(pb, s->packet_size); /* packet size */ - put_le32(pb, bit_rate); /* Nominal data rate in bps */ + avio_wl64(pb, unix_to_file_time(file_time)); + avio_wl64(pb, asf->nb_packets); /* number of packets */ + avio_wl64(pb, duration); /* end time stamp (in 100ns units) */ + avio_wl64(pb, asf->duration); /* duration (in 100ns units) */ + avio_wl64(pb, PREROLL_TIME); /* start time stamp */ + avio_wl32(pb, (asf->is_streamed || url_is_streamed(pb)) ? 3 : 2); /* ??? */ + avio_wl32(pb, s->packet_size); /* packet size */ + avio_wl32(pb, s->packet_size); /* packet size */ + avio_wl32(pb, bit_rate); /* Nominal data rate in bps */ end_header(pb, hpos); /* unknown headers */ hpos = put_header(pb, &ff_asf_head1_guid); put_guid(pb, &ff_asf_head2_guid); - put_le32(pb, 6); - put_le16(pb, 0); + avio_wl32(pb, 6); + avio_wl16(pb, 0); end_header(pb, hpos); /* title and other infos */ @@ -373,20 +373,20 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) { len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0; - put_le16(pb, len); + avio_wl16(pb, len); } len = url_close_dyn_buf(dyn_buf, &buf); - put_buffer(pb, buf, len); + avio_write(pb, buf, len); av_freep(&buf); end_header(pb, hpos); } if (metadata_count) { AVMetadataTag *tag = NULL; hpos = put_header(pb, &ff_asf_extended_content_header); - put_le16(pb, metadata_count); + avio_wl16(pb, metadata_count); while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) { put_str16(pb, tag->key); - put_le16(pb, 0); + avio_wl16(pb, 0); put_str16(pb, tag->value); } end_header(pb, hpos); @@ -424,19 +424,19 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data put_guid(pb, &ff_asf_video_stream); put_guid(pb, &ff_asf_video_conceal_none); } - put_le64(pb, 0); /* ??? */ + avio_wl64(pb, 0); /* ??? */ es_pos = url_ftell(pb); - put_le32(pb, extra_size); /* wav header len */ - put_le32(pb, extra_size2); /* additional data len */ - put_le16(pb, n + 1); /* stream number */ - put_le32(pb, 0); /* ??? */ + avio_wl32(pb, extra_size); /* wav header len */ + avio_wl32(pb, extra_size2); /* additional data len */ + avio_wl16(pb, n + 1); /* stream number */ + avio_wl32(pb, 0); /* ??? */ if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { /* WAVEFORMATEX header */ int wavsize = ff_put_wav_header(pb, enc); if ((enc->codec_id != CODEC_ID_MP3) && (enc->codec_id != CODEC_ID_MP2) && (enc->codec_id != CODEC_ID_ADPCM_IMA_WAV) && (enc->extradata_size==0)) { wavsize += 2; - put_le16(pb, 0); + avio_wl16(pb, 0); } if (wavsize < 0) @@ -444,25 +444,25 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data if (wavsize != extra_size) { cur_pos = url_ftell(pb); url_fseek(pb, es_pos, SEEK_SET); - put_le32(pb, wavsize); /* wav header len */ + avio_wl32(pb, wavsize); /* wav header len */ url_fseek(pb, cur_pos, SEEK_SET); } /* ERROR Correction */ - put_byte(pb, 0x01); + avio_w8(pb, 0x01); if(enc->codec_id == CODEC_ID_ADPCM_G726 || !enc->block_align){ - put_le16(pb, 0x0190); - put_le16(pb, 0x0190); + avio_wl16(pb, 0x0190); + avio_wl16(pb, 0x0190); }else{ - put_le16(pb, enc->block_align); - put_le16(pb, enc->block_align); + avio_wl16(pb, enc->block_align); + avio_wl16(pb, enc->block_align); } - put_le16(pb, 0x01); - put_byte(pb, 0x00); + avio_wl16(pb, 0x01); + avio_w8(pb, 0x00); } else { - put_le32(pb, enc->width); - put_le32(pb, enc->height); - put_byte(pb, 2); /* ??? */ - put_le16(pb, 40 + enc->extradata_size); /* size */ + avio_wl32(pb, enc->width); + avio_wl32(pb, enc->height); + avio_w8(pb, 2); /* ??? */ + avio_wl16(pb, 40 + enc->extradata_size); /* size */ /* BITMAPINFOHEADER header */ ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 1); @@ -474,7 +474,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data hpos = put_header(pb, &ff_asf_codec_comment_header); put_guid(pb, &ff_asf_codec_comment1_header); - put_le32(pb, s->nb_streams); + avio_wl32(pb, s->nb_streams); for(n=0;nnb_streams;n++) { AVCodec *p; const char *desc; @@ -486,11 +486,11 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data p = avcodec_find_encoder(enc->codec_id); if(enc->codec_type == AVMEDIA_TYPE_AUDIO) - put_le16(pb, 2); + avio_wl16(pb, 2); else if(enc->codec_type == AVMEDIA_TYPE_VIDEO) - put_le16(pb, 1); + avio_wl16(pb, 1); else - put_le16(pb, -1); + avio_wl16(pb, -1); if(enc->codec_id == CODEC_ID_WMAV2) desc = "Windows Media Audio V8"; @@ -502,21 +502,21 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data avio_put_str16le(dyn_buf, desc); len = url_close_dyn_buf(dyn_buf, &buf); - put_le16(pb, len / 2); // "number of characters" = length in bytes / 2 + avio_wl16(pb, len / 2); // "number of characters" = length in bytes / 2 - put_buffer(pb, buf, len); + avio_write(pb, buf, len); av_freep(&buf); - put_le16(pb, 0); /* no parameters */ + avio_wl16(pb, 0); /* no parameters */ /* id */ if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { - put_le16(pb, 2); - put_le16(pb, enc->codec_tag); + avio_wl16(pb, 2); + avio_wl16(pb, enc->codec_tag); } else { - put_le16(pb, 4); - put_le32(pb, enc->codec_tag); + avio_wl16(pb, 4); + avio_wl32(pb, enc->codec_tag); } if(!enc->codec_tag) return -1; @@ -531,25 +531,25 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data header_size += 8 + 30 + 50; url_fseek(pb, header_offset - 10 - 30, SEEK_SET); - put_le16(pb, header_size); + avio_wl16(pb, header_size); url_fseek(pb, header_offset - 2 - 30, SEEK_SET); - put_le16(pb, header_size); + avio_wl16(pb, header_size); header_size -= 8 + 30 + 50; } header_size += 24 + 6; url_fseek(pb, header_offset - 14, SEEK_SET); - put_le64(pb, header_size); + avio_wl64(pb, header_size); url_fseek(pb, cur_pos, SEEK_SET); /* movie chunk, followed by packets of packet_size */ asf->data_offset = cur_pos; put_guid(pb, &ff_asf_data_header); - put_le64(pb, data_chunk_size); + avio_wl64(pb, data_chunk_size); put_guid(pb, &ff_asf_my_guid); - put_le64(pb, asf->nb_packets); /* nb packets */ - put_byte(pb, 1); /* ??? */ - put_byte(pb, 1); /* ??? */ + avio_wl64(pb, asf->nb_packets); /* nb packets */ + avio_w8(pb, 1); /* ??? */ + avio_w8(pb, 1); /* ??? */ return 0; } @@ -614,9 +614,9 @@ static int put_payload_parsing_info( padsize--; assert(padsize>=0); - put_byte(pb, ASF_PACKET_ERROR_CORRECTION_FLAGS); + avio_w8(pb, ASF_PACKET_ERROR_CORRECTION_FLAGS); for (i = 0; i < ASF_PACKET_ERROR_CORRECTION_DATA_SIZE; i++){ - put_byte(pb, 0x0); + avio_w8(pb, 0x0); } if (asf->multi_payloads_present) @@ -628,19 +628,19 @@ static int put_payload_parsing_info( else iLengthTypeFlags |= ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD; } - put_byte(pb, iLengthTypeFlags); + avio_w8(pb, iLengthTypeFlags); - put_byte(pb, ASF_PPI_PROPERTY_FLAGS); + avio_w8(pb, ASF_PPI_PROPERTY_FLAGS); if (iLengthTypeFlags & ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD) - put_le16(pb, padsize - 2); + avio_wl16(pb, padsize - 2); if (iLengthTypeFlags & ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE) - put_byte(pb, padsize - 1); + avio_w8(pb, padsize - 1); - put_le32(pb, sendtime); - put_le16(pb, duration); + avio_wl32(pb, sendtime); + avio_wl16(pb, duration); if (asf->multi_payloads_present) - put_byte(pb, nb_payloads | ASF_PAYLOAD_FLAGS); + avio_w8(pb, nb_payloads | ASF_PAYLOAD_FLAGS); ppi_size = url_ftell(pb) - start; @@ -670,7 +670,7 @@ static void flush_packet(AVFormatContext *s) assert(packet_hdr_size <= asf->packet_size_left); memset(asf->packet_buf + packet_filled_size, 0, asf->packet_size_left); - put_buffer(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size); + avio_write(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size); put_flush_packet(s->pb); asf->nb_packets++; @@ -698,23 +698,23 @@ static void put_payload_header( val = stream->num; if (flags & AV_PKT_FLAG_KEY) val |= ASF_PL_FLAG_KEY_FRAME; - put_byte(pb, val); + avio_w8(pb, val); - put_byte(pb, stream->seq); //Media object number - put_le32(pb, m_obj_offset); //Offset Into Media Object + avio_w8(pb, stream->seq); //Media object number + avio_wl32(pb, m_obj_offset); //Offset Into Media Object // Replicated Data shall be at least 8 bytes long. // The first 4 bytes of data shall contain the // Size of the Media Object that the payload belongs to. // The next 4 bytes of data shall contain the // Presentation Time for the media object that the payload belongs to. - put_byte(pb, ASF_PAYLOAD_REPLICATED_DATA_LENGTH); + avio_w8(pb, ASF_PAYLOAD_REPLICATED_DATA_LENGTH); - put_le32(pb, m_obj_size); //Replicated Data - Media Object Size - put_le32(pb, presentation_time);//Replicated Data - Presentation Time + avio_wl32(pb, m_obj_size); //Replicated Data - Media Object Size + avio_wl32(pb, presentation_time);//Replicated Data - Presentation Time if (asf->multi_payloads_present){ - put_le16(pb, payload_len); //payload length + avio_wl16(pb, payload_len); //payload length } } @@ -762,7 +762,7 @@ static void put_frame( payload_len = frag_len1 - 2; //additional byte need to put padding length put_payload_header(s, stream, timestamp+PREROLL_TIME, m_obj_size, m_obj_offset, payload_len, flags); - put_buffer(&asf->pb, buf, payload_len); + avio_write(&asf->pb, buf, payload_len); if (asf->multi_payloads_present) asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS); @@ -837,14 +837,14 @@ static int asf_write_index(AVFormatContext *s, ASFIndex *index, uint16_t max, ui int i; put_guid(pb, &ff_asf_simple_index_header); - put_le64(pb, 24 + 16 + 8 + 4 + 4 + (4 + 2)*count); + avio_wl64(pb, 24 + 16 + 8 + 4 + 4 + (4 + 2)*count); put_guid(pb, &ff_asf_my_guid); - put_le64(pb, ASF_INDEXED_INTERVAL); - put_le32(pb, max); - put_le32(pb, count); + avio_wl64(pb, ASF_INDEXED_INTERVAL); + avio_wl32(pb, max); + avio_wl32(pb, count); for(i=0; iextradata + avctx->extradata_size; else end++; - put_buffer(s->pb, p, end-p); + avio_write(s->pb, p, end-p); ass->extra_index += end-p; if(last && !memcmp(last, "[Events]", 8)) @@ -57,7 +57,7 @@ static int write_header(AVFormatContext *s) static int write_packet(AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); @@ -69,7 +69,7 @@ static int write_trailer(AVFormatContext *s) ASSContext *ass = s->priv_data; AVCodecContext *avctx= s->streams[0]->codec; - put_buffer(s->pb, avctx->extradata + ass->extra_index, + avio_write(s->pb, avctx->extradata + ass->extra_index, avctx->extradata_size - ass->extra_index); put_flush_packet(s->pb); diff --git a/libavformat/au.c b/libavformat/au.c index 16d53fec9d..486c514087 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -54,11 +54,11 @@ static int put_au_header(AVIOContext *pb, AVCodecContext *enc) if(!enc->codec_tag) return -1; put_tag(pb, ".snd"); /* magic number */ - put_be32(pb, 24); /* header size */ - put_be32(pb, AU_UNKNOWN_SIZE); /* data size */ - put_be32(pb, (uint32_t)enc->codec_tag); /* codec ID */ - put_be32(pb, enc->sample_rate); - put_be32(pb, (uint32_t)enc->channels); + avio_wb32(pb, 24); /* header size */ + avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */ + avio_wb32(pb, (uint32_t)enc->codec_tag); /* codec ID */ + avio_wb32(pb, enc->sample_rate); + avio_wb32(pb, (uint32_t)enc->channels); return 0; } @@ -81,7 +81,7 @@ static int au_write_header(AVFormatContext *s) static int au_write_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); return 0; } @@ -95,7 +95,7 @@ static int au_write_trailer(AVFormatContext *s) /* update file size */ file_size = url_ftell(pb); url_fseek(pb, 8, SEEK_SET); - put_be32(pb, (uint32_t)(file_size - 24)); + avio_wb32(pb, (uint32_t)(file_size - 24)); url_fseek(pb, file_size, SEEK_SET); put_flush_packet(pb); diff --git a/libavformat/avc.c b/libavformat/avc.c index 79fdf1a1c2..a39343b1ca 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -78,8 +78,8 @@ int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size) while (nal_start < end) { while(!*(nal_start++)); nal_end = ff_avc_find_startcode(nal_start, end); - put_be32(pb, nal_end - nal_start); - put_buffer(pb, nal_start, nal_end - nal_start); + avio_wb32(pb, nal_end - nal_start); + avio_write(pb, nal_start, nal_end - nal_start); size += 4 + nal_end - nal_start; nal_start = nal_end; } @@ -134,21 +134,21 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) assert(sps); assert(pps); - put_byte(pb, 1); /* version */ - put_byte(pb, sps[1]); /* profile */ - put_byte(pb, sps[2]); /* profile compat */ - put_byte(pb, sps[3]); /* level */ - put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */ - put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */ + avio_w8(pb, 1); /* version */ + avio_w8(pb, sps[1]); /* profile */ + avio_w8(pb, sps[2]); /* profile compat */ + avio_w8(pb, sps[3]); /* level */ + avio_w8(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */ + avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */ - put_be16(pb, sps_size); - put_buffer(pb, sps, sps_size); - put_byte(pb, 1); /* number of pps */ - put_be16(pb, pps_size); - put_buffer(pb, pps, pps_size); + avio_wb16(pb, sps_size); + avio_write(pb, sps, sps_size); + avio_w8(pb, 1); /* number of pps */ + avio_wb16(pb, pps_size); + avio_write(pb, pps, pps_size); av_free(start); } else { - put_buffer(pb, data, len); + avio_write(pb, data, len); } } return 0; diff --git a/libavformat/avienc.c b/libavformat/avienc.c index cf3b9fbce8..61af511350 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -108,10 +108,10 @@ static void avi_write_info_tag(AVIOContext *pb, const char *tag, const char *str if (len > 0) { len++; put_tag(pb, tag); - put_le32(pb, len); + avio_wl32(pb, len); avio_put_str(pb, str); if (len & 1) - put_byte(pb, 0); + avio_w8(pb, 0); } } @@ -132,9 +132,9 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) url_fseek(pb, avist->frames_hdr_strm, SEEK_SET); ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); if(au_ssize == 0) { - put_le32(pb, avist->packet_count); + avio_wl32(pb, avist->packet_count); } else { - put_le32(pb, avist->audio_strm_length / au_ssize); + avio_wl32(pb, avist->audio_strm_length / au_ssize); } if(stream->codec_type == AVMEDIA_TYPE_VIDEO) nb_frames = FFMAX(nb_frames, avist->packet_count); @@ -142,7 +142,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) if(riff_id == 1) { assert(avi->frames_hdr_all); url_fseek(pb, avi->frames_hdr_all, SEEK_SET); - put_le32(pb, nb_frames); + avio_wl32(pb, nb_frames); } url_fseek(pb, file_size, SEEK_SET); @@ -170,7 +170,7 @@ static int avi_write_header(AVFormatContext *s) /* avi header */ put_tag(pb, "avih"); - put_le32(pb, 14 * 4); + avio_wl32(pb, 14 * 4); bitrate = 0; video_enc = NULL; @@ -184,32 +184,32 @@ static int avi_write_header(AVFormatContext *s) nb_frames = 0; if(video_enc){ - put_le32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den)); + avio_wl32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den)); } else { - put_le32(pb, 0); + avio_wl32(pb, 0); } - put_le32(pb, bitrate / 8); /* XXX: not quite exact */ - put_le32(pb, 0); /* padding */ + avio_wl32(pb, bitrate / 8); /* XXX: not quite exact */ + avio_wl32(pb, 0); /* padding */ if (url_is_streamed(pb)) - put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ + avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ else - put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ + avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */ - put_le32(pb, nb_frames); /* nb frames, filled later */ - put_le32(pb, 0); /* initial frame */ - put_le32(pb, s->nb_streams); /* nb streams */ - put_le32(pb, 1024 * 1024); /* suggested buffer size */ + avio_wl32(pb, nb_frames); /* nb frames, filled later */ + avio_wl32(pb, 0); /* initial frame */ + avio_wl32(pb, s->nb_streams); /* nb streams */ + avio_wl32(pb, 1024 * 1024); /* suggested buffer size */ if(video_enc){ - put_le32(pb, video_enc->width); - put_le32(pb, video_enc->height); + avio_wl32(pb, video_enc->width); + avio_wl32(pb, video_enc->height); } else { - put_le32(pb, 0); - put_le32(pb, 0); + avio_wl32(pb, 0); + avio_wl32(pb, 0); } - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ /* stream list */ for(i=0;icodec_type == AVMEDIA_TYPE_VIDEO || stream->codec_id == CODEC_ID_XSUB) - put_le32(pb, stream->codec_tag); + avio_wl32(pb, stream->codec_tag); else - put_le32(pb, 1); - put_le32(pb, 0); /* flags */ - put_le16(pb, 0); /* priority */ - put_le16(pb, 0); /* language */ - put_le32(pb, 0); /* initial frame */ + avio_wl32(pb, 1); + avio_wl32(pb, 0); /* flags */ + avio_wl16(pb, 0); /* priority */ + avio_wl16(pb, 0); /* language */ + avio_wl32(pb, 0); /* initial frame */ ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); - put_le32(pb, au_scale); /* scale */ - put_le32(pb, au_byterate); /* rate */ + avio_wl32(pb, au_scale); /* scale */ + avio_wl32(pb, au_byterate); /* rate */ av_set_pts_info(s->streams[i], 64, au_scale, au_byterate); - put_le32(pb, 0); /* start */ + avio_wl32(pb, 0); /* start */ avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */ if (url_is_streamed(pb)) - put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ + avio_wl32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ else - put_le32(pb, 0); /* length, XXX: filled later */ + avio_wl32(pb, 0); /* length, XXX: filled later */ /* suggested buffer size */ //FIXME set at the end to largest chunk if(stream->codec_type == AVMEDIA_TYPE_VIDEO) - put_le32(pb, 1024 * 1024); + avio_wl32(pb, 1024 * 1024); else if(stream->codec_type == AVMEDIA_TYPE_AUDIO) - put_le32(pb, 12 * 1024); + avio_wl32(pb, 12 * 1024); else - put_le32(pb, 0); - put_le32(pb, -1); /* quality */ - put_le32(pb, au_ssize); /* sample size */ - put_le32(pb, 0); - put_le16(pb, stream->width); - put_le16(pb, stream->height); + avio_wl32(pb, 0); + avio_wl32(pb, -1); /* quality */ + avio_wl32(pb, au_ssize); /* sample size */ + avio_wl32(pb, 0); + avio_wl16(pb, stream->width); + avio_wl16(pb, stream->height); ff_end_tag(pb, strh); if(stream->codec_type != AVMEDIA_TYPE_DATA){ @@ -307,16 +307,16 @@ static int avi_write_header(AVFormatContext *s) */ avist->indexes.entry = avist->indexes.ents_allocated = 0; avist->indexes.indx_start = ff_start_tag(pb, "JUNK"); - put_le16(pb, 4); /* wLongsPerEntry */ - put_byte(pb, 0); /* bIndexSubType (0 == frame index) */ - put_byte(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ - put_le32(pb, 0); /* nEntriesInUse (will fill out later on) */ + avio_wl16(pb, 4); /* wLongsPerEntry */ + avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */ + avio_w8(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ + avio_wl32(pb, 0); /* nEntriesInUse (will fill out later on) */ put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type)); /* dwChunkId */ - put_le64(pb, 0); /* dwReserved[3] - put_le32(pb, 0); Must be 0. */ + avio_wl64(pb, 0); /* dwReserved[3] + avio_wl32(pb, 0); Must be 0. */ for (j=0; j < AVI_MASTER_INDEX_SIZE * 2; j++) - put_le64(pb, 0); + avio_wl64(pb, 0); ff_end_tag(pb, avist->indexes.indx_start); } @@ -329,26 +329,26 @@ static int avi_write_header(AVFormatContext *s) int num, den; av_reduce(&num, &den, dar.num, dar.den, 0xFFFF); - put_le32(pb, 0); //video format = unknown - put_le32(pb, 0); //video standard= unknown - put_le32(pb, lrintf(1.0/av_q2d(stream->time_base))); - put_le32(pb, stream->width ); - put_le32(pb, stream->height); - put_le16(pb, den); - put_le16(pb, num); - put_le32(pb, stream->width ); - put_le32(pb, stream->height); - put_le32(pb, 1); //progressive FIXME + avio_wl32(pb, 0); //video format = unknown + avio_wl32(pb, 0); //video standard= unknown + avio_wl32(pb, lrintf(1.0/av_q2d(stream->time_base))); + avio_wl32(pb, stream->width ); + avio_wl32(pb, stream->height); + avio_wl16(pb, den); + avio_wl16(pb, num); + avio_wl32(pb, stream->width ); + avio_wl32(pb, stream->height); + avio_wl32(pb, 1); //progressive FIXME - put_le32(pb, stream->height); - put_le32(pb, stream->width ); - put_le32(pb, stream->height); - put_le32(pb, stream->width ); - put_le32(pb, 0); - put_le32(pb, 0); + avio_wl32(pb, stream->height); + avio_wl32(pb, stream->width ); + avio_wl32(pb, stream->height); + avio_wl32(pb, stream->width ); + avio_wl32(pb, 0); + avio_wl32(pb, 0); - put_le32(pb, 0); - put_le32(pb, 0); + avio_wl32(pb, 0); + avio_wl32(pb, 0); ff_end_tag(pb, vprp); } @@ -360,9 +360,9 @@ static int avi_write_header(AVFormatContext *s) avi->odml_list = ff_start_tag(pb, "JUNK"); put_tag(pb, "odml"); put_tag(pb, "dmlh"); - put_le32(pb, 248); + avio_wl32(pb, 248); for (i = 0; i < 248; i+= 4) - put_le32(pb, 0); + avio_wl32(pb, 0); ff_end_tag(pb, avi->odml_list); } @@ -380,7 +380,7 @@ static int avi_write_header(AVFormatContext *s) /* some padding for easier tag editing */ list2 = ff_start_tag(pb, "JUNK"); for (i = 0; i < 1016; i += 4) - put_le32(pb, 0); + avio_wl32(pb, 0); ff_end_tag(pb, list2); avi->movi_list = ff_start_tag(pb, "LIST"); @@ -414,21 +414,21 @@ static int avi_write_ix(AVFormatContext *s) /* Writing AVI OpenDML leaf index chunk */ ix = url_ftell(pb); put_tag(pb, &ix_tag[0]); /* ix?? */ - put_le32(pb, avist->indexes.entry * 8 + 24); + avio_wl32(pb, avist->indexes.entry * 8 + 24); /* chunk size */ - put_le16(pb, 2); /* wLongsPerEntry */ - put_byte(pb, 0); /* bIndexSubType (0 == frame index) */ - put_byte(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ - put_le32(pb, avist->indexes.entry); + avio_wl16(pb, 2); /* wLongsPerEntry */ + avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */ + avio_w8(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ + avio_wl32(pb, avist->indexes.entry); /* nEntriesInUse */ put_tag(pb, &tag[0]); /* dwChunkId */ - put_le64(pb, avi->movi_list);/* qwBaseOffset */ - put_le32(pb, 0); /* dwReserved_3 (must be 0) */ + avio_wl64(pb, avi->movi_list);/* qwBaseOffset */ + avio_wl32(pb, 0); /* dwReserved_3 (must be 0) */ for (j=0; jindexes.entry; j++) { AVIIentry* ie = avi_get_ientry(&avist->indexes, j); - put_le32(pb, ie->pos + 8); - put_le32(pb, ((uint32_t)ie->len & ~0x80000000) | + avio_wl32(pb, ie->pos + 8); + avio_wl32(pb, ((uint32_t)ie->len & ~0x80000000) | (ie->flags & 0x10 ? 0 : 0x80000000)); } put_flush_packet(pb); @@ -438,11 +438,11 @@ static int avi_write_ix(AVFormatContext *s) url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET); put_tag(pb, "indx"); /* enabling this entry */ url_fskip(pb, 8); - put_le32(pb, avi->riff_id); /* nEntriesInUse */ + avio_wl32(pb, avi->riff_id); /* nEntriesInUse */ url_fskip(pb, 16*avi->riff_id); - put_le64(pb, ix); /* qwOffset */ - put_le32(pb, pos - ix); /* dwSize */ - put_le32(pb, avist->indexes.entry); /* dwDuration */ + avio_wl64(pb, ix); /* qwOffset */ + avio_wl32(pb, pos - ix); /* dwSize */ + avio_wl32(pb, avist->indexes.entry); /* dwDuration */ url_fseek(pb, pos, SEEK_SET); } @@ -487,9 +487,9 @@ static int avi_write_idx1(AVFormatContext *s) avi_stream2fourcc(&tag[0], stream_id, s->streams[stream_id]->codec->codec_type); put_tag(pb, &tag[0]); - put_le32(pb, ie->flags); - put_le32(pb, ie->pos); - put_le32(pb, ie->len); + avio_wl32(pb, ie->flags); + avio_wl32(pb, ie->pos); + avio_wl32(pb, ie->len); avist->entry++; } } while (!empty); @@ -565,11 +565,11 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) idx->entry++; } - put_buffer(pb, tag, 4); - put_le32(pb, size); - put_buffer(pb, pkt->data, size); + avio_write(pb, tag, 4); + avio_wl32(pb, size); + avio_write(pb, pkt->data, size); if (size & 1) - put_byte(pb, 0); + avio_w8(pb, 0); put_flush_packet(pb); return 0; @@ -611,7 +611,7 @@ static int avi_write_trailer(AVFormatContext *s) } } } - put_le32(pb, nb_frames); + avio_wl32(pb, nb_frames); url_fseek(pb, file_size, SEEK_SET); avi_write_counters(s, avi->riff_id); diff --git a/libavformat/avio.h b/libavformat/avio.h index 43d94db790..f12b9f8127 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -395,6 +395,17 @@ attribute_deprecated unsigned int get_be16(AVIOContext *s); attribute_deprecated unsigned int get_be24(AVIOContext *s); attribute_deprecated unsigned int get_be32(AVIOContext *s); attribute_deprecated uint64_t get_be64(AVIOContext *s); + +attribute_deprecated void put_byte(AVIOContext *s, int b); +attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size); +attribute_deprecated void put_le64(AVIOContext *s, uint64_t val); +attribute_deprecated void put_be64(AVIOContext *s, uint64_t val); +attribute_deprecated void put_le32(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be32(AVIOContext *s, unsigned int val); +attribute_deprecated void put_le24(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be24(AVIOContext *s, unsigned int val); +attribute_deprecated void put_le16(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be16(AVIOContext *s, unsigned int val); /** * @} */ @@ -409,17 +420,17 @@ AVIOContext *avio_alloc_context( int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)); -void put_byte(AVIOContext *s, int b); +void avio_w8(AVIOContext *s, int b); void put_nbyte(AVIOContext *s, int b, int count); -void put_buffer(AVIOContext *s, const unsigned char *buf, int size); -void put_le64(AVIOContext *s, uint64_t val); -void put_be64(AVIOContext *s, uint64_t val); -void put_le32(AVIOContext *s, unsigned int val); -void put_be32(AVIOContext *s, unsigned int val); -void put_le24(AVIOContext *s, unsigned int val); -void put_be24(AVIOContext *s, unsigned int val); -void put_le16(AVIOContext *s, unsigned int val); -void put_be16(AVIOContext *s, unsigned int val); +void avio_write(AVIOContext *s, const unsigned char *buf, int size); +void avio_wl64(AVIOContext *s, uint64_t val); +void avio_wb64(AVIOContext *s, uint64_t val); +void avio_wl32(AVIOContext *s, unsigned int val); +void avio_wb32(AVIOContext *s, unsigned int val); +void avio_wl24(AVIOContext *s, unsigned int val); +void avio_wb24(AVIOContext *s, unsigned int val); +void avio_wl16(AVIOContext *s, unsigned int val); +void avio_wb16(AVIOContext *s, unsigned int val); void put_tag(AVIOContext *s, const char *tag); #if FF_API_OLD_AVIO diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index fd1419893c..275794deb9 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -134,7 +134,7 @@ static void flush_buffer(AVIOContext *s) s->buf_ptr = s->buffer; } -void put_byte(AVIOContext *s, int b) +void avio_w8(AVIOContext *s, int b) { *(s->buf_ptr)++ = b; if (s->buf_ptr >= s->buf_end) @@ -155,7 +155,7 @@ void put_nbyte(AVIOContext *s, int b, int count) } } -void put_buffer(AVIOContext *s, const unsigned char *buf, int size) +void avio_write(AVIOContext *s, const unsigned char *buf, int size) { while (size > 0) { int len = FFMIN(s->buf_end - s->buf_ptr, size); @@ -277,20 +277,20 @@ int url_ferror(AVIOContext *s) return s->error; } -void put_le32(AVIOContext *s, unsigned int val) +void avio_wl32(AVIOContext *s, unsigned int val) { - put_byte(s, val); - put_byte(s, val >> 8); - put_byte(s, val >> 16); - put_byte(s, val >> 24); + avio_w8(s, val); + avio_w8(s, val >> 8); + avio_w8(s, val >> 16); + avio_w8(s, val >> 24); } -void put_be32(AVIOContext *s, unsigned int val) +void avio_wb32(AVIOContext *s, unsigned int val) { - put_byte(s, val >> 24); - put_byte(s, val >> 16); - put_byte(s, val >> 8); - put_byte(s, val); + avio_w8(s, val >> 24); + avio_w8(s, val >> 16); + avio_w8(s, val >> 8); + avio_w8(s, val); } #if FF_API_OLD_AVIO @@ -316,6 +316,22 @@ GET(64, uint64_t) #undef GET +#define PUT(name, type ) \ + void put_le ##name(AVIOContext *s, type val)\ +{\ + avio_wl ##name(s, val);\ +}\ + void put_be ##name(AVIOContext *s, type val)\ +{\ + avio_wb ##name(s, val);\ +} + +PUT(16, unsigned int) +PUT(24, unsigned int) +PUT(32, unsigned int) +PUT(64, uint64_t) +#undef PUT + int get_byte(AVIOContext *s) { return avio_r8(s); @@ -328,6 +344,14 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size) { return ffio_read_partial(s, buf, size); } +void put_byte(AVIOContext *s, int val) +{ + avio_w8(s, val); +} +void put_buffer(AVIOContext *s, const unsigned char *buf, int size) +{ + avio_write(s, buf, size); +} #endif int avio_put_str(AVIOContext *s, const char *str) @@ -335,9 +359,9 @@ int avio_put_str(AVIOContext *s, const char *str) int len = 1; if (str) { len += strlen(str); - put_buffer(s, (const unsigned char *) str, len); + avio_write(s, (const unsigned char *) str, len); } else - put_byte(s, 0); + avio_w8(s, 0); return len; } @@ -351,9 +375,9 @@ int avio_put_str16le(AVIOContext *s, const char *str) uint16_t tmp; GET_UTF8(ch, *q++, break;) - PUT_UTF16(ch, tmp, put_le16(s, tmp);ret += 2;) + PUT_UTF16(ch, tmp, avio_wl16(s, tmp);ret += 2;) } - put_le16(s, 0); + avio_wl16(s, 0); ret += 2; return ret; } @@ -371,51 +395,51 @@ void ff_put_v(AVIOContext *bc, uint64_t val){ int i= ff_get_v_length(val); while(--i>0) - put_byte(bc, 128 | (val>>(7*i))); + avio_w8(bc, 128 | (val>>(7*i))); - put_byte(bc, val&127); + avio_w8(bc, val&127); } -void put_le64(AVIOContext *s, uint64_t val) +void avio_wl64(AVIOContext *s, uint64_t val) { - put_le32(s, (uint32_t)(val & 0xffffffff)); - put_le32(s, (uint32_t)(val >> 32)); + avio_wl32(s, (uint32_t)(val & 0xffffffff)); + avio_wl32(s, (uint32_t)(val >> 32)); } -void put_be64(AVIOContext *s, uint64_t val) +void avio_wb64(AVIOContext *s, uint64_t val) { - put_be32(s, (uint32_t)(val >> 32)); - put_be32(s, (uint32_t)(val & 0xffffffff)); + avio_wb32(s, (uint32_t)(val >> 32)); + avio_wb32(s, (uint32_t)(val & 0xffffffff)); } -void put_le16(AVIOContext *s, unsigned int val) +void avio_wl16(AVIOContext *s, unsigned int val) { - put_byte(s, val); - put_byte(s, val >> 8); + avio_w8(s, val); + avio_w8(s, val >> 8); } -void put_be16(AVIOContext *s, unsigned int val) +void avio_wb16(AVIOContext *s, unsigned int val) { - put_byte(s, val >> 8); - put_byte(s, val); + avio_w8(s, val >> 8); + avio_w8(s, val); } -void put_le24(AVIOContext *s, unsigned int val) +void avio_wl24(AVIOContext *s, unsigned int val) { - put_le16(s, val & 0xffff); - put_byte(s, val >> 16); + avio_wl16(s, val & 0xffff); + avio_w8(s, val >> 16); } -void put_be24(AVIOContext *s, unsigned int val) +void avio_wb24(AVIOContext *s, unsigned int val) { - put_be16(s, val >> 8); - put_byte(s, val); + avio_wb16(s, val >> 8); + avio_w8(s, val); } void put_tag(AVIOContext *s, const char *tag) { while (*tag) { - put_byte(s, *tag++); + avio_w8(s, *tag++); } } @@ -855,7 +879,7 @@ int url_fprintf(AVIOContext *s, const char *fmt, ...) va_start(ap, fmt); ret = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); - put_buffer(s, buf, strlen(buf)); + avio_write(s, buf, strlen(buf)); return ret; } #endif //CONFIG_MUXERS @@ -1056,7 +1080,7 @@ int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) /* don't attempt to pad fixed-size packet buffers */ if (!s->max_packet_size) { - put_buffer(s, padbuf, sizeof(padbuf)); + avio_write(s, padbuf, sizeof(padbuf)); padding = FF_INPUT_BUFFER_PADDING_SIZE; } diff --git a/libavformat/crcenc.c b/libavformat/crcenc.c index 2f9a099a21..ec106b0b38 100644 --- a/libavformat/crcenc.c +++ b/libavformat/crcenc.c @@ -49,7 +49,7 @@ static int crc_write_trailer(struct AVFormatContext *s) char buf[64]; snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval); - put_buffer(s->pb, buf, strlen(buf)); + avio_write(s->pb, buf, strlen(buf)); put_flush_packet(s->pb); return 0; } diff --git a/libavformat/daud.c b/libavformat/daud.c index c4931961ec..39a994b605 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -57,9 +57,9 @@ static int daud_write_header(struct AVFormatContext *s) static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt) { - put_be16(s->pb, pkt->size); - put_be16(s->pb, 0x8010); // unknown - put_buffer(s->pb, pkt->data, pkt->size); + avio_wb16(s->pb, pkt->size); + avio_wb16(s->pb, 0x8010); // unknown + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index faaa529813..6d90024eef 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -381,7 +381,7 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt) fsize = dv_assemble_frame(s->priv_data, s->streams[pkt->stream_index], pkt->data, pkt->size, &frame); if (fsize > 0) { - put_buffer(s->pb, frame, fsize); + avio_write(s->pb, frame, fsize); put_flush_packet(s->pb); } return 0; diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index 858bd2ffc5..eeaaa22945 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -36,14 +36,14 @@ static void flush_packet(AVFormatContext *s) av_abort(); /* put header */ - put_be16(pb, PACKET_ID); - put_be16(pb, fill_size); - put_be64(pb, ffm->dts); + avio_wb16(pb, PACKET_ID); + avio_wb16(pb, fill_size); + avio_wb64(pb, ffm->dts); h = ffm->frame_offset; if (ffm->first_packet) h |= 0x8000; - put_be16(pb, h); - put_buffer(pb, ffm->packet, ffm->packet_end - ffm->packet); + avio_wb16(pb, h); + avio_write(pb, ffm->packet, ffm->packet_end - ffm->packet); put_flush_packet(pb); /* prepare next packet */ @@ -91,17 +91,17 @@ static int ffm_write_header(AVFormatContext *s) ffm->packet_size = FFM_PACKET_SIZE; /* header */ - put_le32(pb, MKTAG('F', 'F', 'M', '1')); - put_be32(pb, ffm->packet_size); - put_be64(pb, 0); /* current write position */ + avio_wl32(pb, MKTAG('F', 'F', 'M', '1')); + avio_wb32(pb, ffm->packet_size); + avio_wb64(pb, 0); /* current write position */ - put_be32(pb, s->nb_streams); + avio_wb32(pb, s->nb_streams); bit_rate = 0; for(i=0;inb_streams;i++) { st = s->streams[i]; bit_rate += st->codec->bit_rate; } - put_be32(pb, bit_rate); + avio_wb32(pb, bit_rate); /* list of streams */ for(i=0;inb_streams;i++) { @@ -110,82 +110,82 @@ static int ffm_write_header(AVFormatContext *s) codec = st->codec; /* generic info */ - put_be32(pb, codec->codec_id); - put_byte(pb, codec->codec_type); - put_be32(pb, codec->bit_rate); - put_be32(pb, st->quality); - put_be32(pb, codec->flags); - put_be32(pb, codec->flags2); - put_be32(pb, codec->debug); + avio_wb32(pb, codec->codec_id); + avio_w8(pb, codec->codec_type); + avio_wb32(pb, codec->bit_rate); + avio_wb32(pb, st->quality); + avio_wb32(pb, codec->flags); + avio_wb32(pb, codec->flags2); + avio_wb32(pb, codec->debug); /* specific info */ switch(codec->codec_type) { case AVMEDIA_TYPE_VIDEO: - put_be32(pb, codec->time_base.num); - put_be32(pb, codec->time_base.den); - put_be16(pb, codec->width); - put_be16(pb, codec->height); - put_be16(pb, codec->gop_size); - put_be32(pb, codec->pix_fmt); - put_byte(pb, codec->qmin); - put_byte(pb, codec->qmax); - put_byte(pb, codec->max_qdiff); - put_be16(pb, (int) (codec->qcompress * 10000.0)); - put_be16(pb, (int) (codec->qblur * 10000.0)); - put_be32(pb, codec->bit_rate_tolerance); + avio_wb32(pb, codec->time_base.num); + avio_wb32(pb, codec->time_base.den); + avio_wb16(pb, codec->width); + avio_wb16(pb, codec->height); + avio_wb16(pb, codec->gop_size); + avio_wb32(pb, codec->pix_fmt); + avio_w8(pb, codec->qmin); + avio_w8(pb, codec->qmax); + avio_w8(pb, codec->max_qdiff); + avio_wb16(pb, (int) (codec->qcompress * 10000.0)); + avio_wb16(pb, (int) (codec->qblur * 10000.0)); + avio_wb32(pb, codec->bit_rate_tolerance); avio_put_str(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp"); - put_be32(pb, codec->rc_max_rate); - put_be32(pb, codec->rc_min_rate); - put_be32(pb, codec->rc_buffer_size); - put_be64(pb, av_dbl2int(codec->i_quant_factor)); - put_be64(pb, av_dbl2int(codec->b_quant_factor)); - put_be64(pb, av_dbl2int(codec->i_quant_offset)); - put_be64(pb, av_dbl2int(codec->b_quant_offset)); - put_be32(pb, codec->dct_algo); - put_be32(pb, codec->strict_std_compliance); - put_be32(pb, codec->max_b_frames); - put_be32(pb, codec->luma_elim_threshold); - put_be32(pb, codec->chroma_elim_threshold); - put_be32(pb, codec->mpeg_quant); - put_be32(pb, codec->intra_dc_precision); - put_be32(pb, codec->me_method); - put_be32(pb, codec->mb_decision); - put_be32(pb, codec->nsse_weight); - put_be32(pb, codec->frame_skip_cmp); - put_be64(pb, av_dbl2int(codec->rc_buffer_aggressivity)); - put_be32(pb, codec->codec_tag); - put_byte(pb, codec->thread_count); - put_be32(pb, codec->coder_type); - put_be32(pb, codec->me_cmp); - put_be32(pb, codec->partitions); - put_be32(pb, codec->me_subpel_quality); - put_be32(pb, codec->me_range); - put_be32(pb, codec->keyint_min); - put_be32(pb, codec->scenechange_threshold); - put_be32(pb, codec->b_frame_strategy); - put_be64(pb, av_dbl2int(codec->qcompress)); - put_be64(pb, av_dbl2int(codec->qblur)); - put_be32(pb, codec->max_qdiff); - put_be32(pb, codec->refs); - put_be32(pb, codec->directpred); + avio_wb32(pb, codec->rc_max_rate); + avio_wb32(pb, codec->rc_min_rate); + avio_wb32(pb, codec->rc_buffer_size); + avio_wb64(pb, av_dbl2int(codec->i_quant_factor)); + avio_wb64(pb, av_dbl2int(codec->b_quant_factor)); + avio_wb64(pb, av_dbl2int(codec->i_quant_offset)); + avio_wb64(pb, av_dbl2int(codec->b_quant_offset)); + avio_wb32(pb, codec->dct_algo); + avio_wb32(pb, codec->strict_std_compliance); + avio_wb32(pb, codec->max_b_frames); + avio_wb32(pb, codec->luma_elim_threshold); + avio_wb32(pb, codec->chroma_elim_threshold); + avio_wb32(pb, codec->mpeg_quant); + avio_wb32(pb, codec->intra_dc_precision); + avio_wb32(pb, codec->me_method); + avio_wb32(pb, codec->mb_decision); + avio_wb32(pb, codec->nsse_weight); + avio_wb32(pb, codec->frame_skip_cmp); + avio_wb64(pb, av_dbl2int(codec->rc_buffer_aggressivity)); + avio_wb32(pb, codec->codec_tag); + avio_w8(pb, codec->thread_count); + avio_wb32(pb, codec->coder_type); + avio_wb32(pb, codec->me_cmp); + avio_wb32(pb, codec->partitions); + avio_wb32(pb, codec->me_subpel_quality); + avio_wb32(pb, codec->me_range); + avio_wb32(pb, codec->keyint_min); + avio_wb32(pb, codec->scenechange_threshold); + avio_wb32(pb, codec->b_frame_strategy); + avio_wb64(pb, av_dbl2int(codec->qcompress)); + avio_wb64(pb, av_dbl2int(codec->qblur)); + avio_wb32(pb, codec->max_qdiff); + avio_wb32(pb, codec->refs); + avio_wb32(pb, codec->directpred); break; case AVMEDIA_TYPE_AUDIO: - put_be32(pb, codec->sample_rate); - put_le16(pb, codec->channels); - put_le16(pb, codec->frame_size); - put_le16(pb, codec->sample_fmt); + avio_wb32(pb, codec->sample_rate); + avio_wl16(pb, codec->channels); + avio_wl16(pb, codec->frame_size); + avio_wl16(pb, codec->sample_fmt); break; default: return -1; } if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) { - put_be32(pb, codec->extradata_size); - put_buffer(pb, codec->extradata, codec->extradata_size); + avio_wb32(pb, codec->extradata_size); + avio_write(pb, codec->extradata, codec->extradata_size); } } /* flush until end of block reached */ while ((url_ftell(pb) % ffm->packet_size) != 0) - put_byte(pb, 0); + avio_w8(pb, 0); put_flush_packet(pb); diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index 68b22e9551..322ec0f576 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -31,8 +31,8 @@ static void write_escape_str(AVIOContext *s, const uint8_t *str) while (*p) { if (*p == '#' || *p == ';' || *p == '=' || *p == '\\' || *p == '\n') - put_byte(s, '\\'); - put_byte(s, *p); + avio_w8(s, '\\'); + avio_w8(s, *p); p++; } } @@ -42,17 +42,17 @@ static void write_tags(AVIOContext *s, AVMetadata *m) AVMetadataTag *t = NULL; while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) { write_escape_str(s, t->key); - put_byte(s, '='); + avio_w8(s, '='); write_escape_str(s, t->value); - put_byte(s, '\n'); + avio_w8(s, '\n'); } } static int write_header(AVFormatContext *s) { put_tag(s->pb, ID_STRING); - put_byte(s->pb, '1'); // version - put_byte(s->pb, '\n'); + avio_w8(s->pb, '1'); // version + avio_w8(s->pb, '\n'); put_flush_packet(s->pb); return 0; } @@ -65,14 +65,14 @@ static int write_trailer(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { put_tag(s->pb, ID_STREAM); - put_byte(s->pb, '\n'); + avio_w8(s->pb, '\n'); write_tags(s->pb, s->streams[i]->metadata); } for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; put_tag(s->pb, ID_CHAPTER); - put_byte(s->pb, '\n'); + avio_w8(s->pb, '\n'); url_fprintf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den); url_fprintf(s->pb, "START=%"PRId64"\n", ch->start); url_fprintf(s->pb, "END=%"PRId64"\n", ch->end); diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c index 3fdfa4a36a..d20b4ecd4c 100644 --- a/libavformat/filmstripenc.c +++ b/libavformat/filmstripenc.c @@ -45,7 +45,7 @@ static int write_header(AVFormatContext *s) static int write_packet(AVFormatContext *s, AVPacket *pkt) { FilmstripMuxContext *film = s->priv_data; - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); film->nb_frames++; return 0; } @@ -57,16 +57,16 @@ static int write_trailer(AVFormatContext *s) AVStream *st = s->streams[0]; int i; - put_be32(pb, RAND_TAG); - put_be32(pb, film->nb_frames); - put_be16(pb, 0); // packing method - put_be16(pb, 0); // reserved - put_be16(pb, st->codec->width); - put_be16(pb, st->codec->height); - put_be16(pb, 0); // leading - put_be16(pb, 1/av_q2d(st->codec->time_base)); + avio_wb32(pb, RAND_TAG); + avio_wb32(pb, film->nb_frames); + avio_wb16(pb, 0); // packing method + avio_wb16(pb, 0); // reserved + avio_wb16(pb, st->codec->width); + avio_wb16(pb, st->codec->height); + avio_wb16(pb, 0); // leading + avio_wb16(pb, 1/av_q2d(st->codec->time_base)); for (i = 0; i < 16; i++) - put_byte(pb, 0x00); // reserved + avio_w8(pb, 0x00); // reserved put_flush_packet(pb); return 0; } diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index 8f5f6c2128..d11d75d27d 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -30,10 +30,10 @@ static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes, int last_block) { - put_byte(pb, last_block ? 0x81 : 0x01); - put_be24(pb, n_padding_bytes); + avio_w8(pb, last_block ? 0x81 : 0x01); + avio_wb24(pb, n_padding_bytes); while (n_padding_bytes > 0) { - put_byte(pb, 0); + avio_w8(pb, 0); n_padding_bytes--; } return 0; @@ -58,7 +58,7 @@ static int flac_write_block_comment(AVIOContext *pb, AVMetadata **m, bytestream_put_be24(&p, len); ff_vorbiscomment_write(&p, m, vendor, count); - put_buffer(pb, p0, len+4); + avio_write(pb, p0, len+4); av_freep(&p0); p = NULL; @@ -102,7 +102,7 @@ static int flac_write_trailer(struct AVFormatContext *s) /* rewrite the STREAMINFO header block data */ file_size = url_ftell(pb); url_fseek(pb, 8, SEEK_SET); - put_buffer(pb, streaminfo, FLAC_STREAMINFO_SIZE); + avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); url_fseek(pb, file_size, SEEK_SET); put_flush_packet(pb); } else { @@ -113,7 +113,7 @@ static int flac_write_trailer(struct AVFormatContext *s) static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } diff --git a/libavformat/flacenc_header.c b/libavformat/flacenc_header.c index fa7ed48241..389efbd01a 100644 --- a/libavformat/flacenc_header.c +++ b/libavformat/flacenc_header.c @@ -39,11 +39,11 @@ int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec, /* write "fLaC" stream marker and first metadata block header if needed */ if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) { - put_buffer(pb, header, 8); + avio_write(pb, header, 8); } /* write STREAMINFO or full header */ - put_buffer(pb, codec->extradata, codec->extradata_size); + avio_write(pb, codec->extradata, codec->extradata_size); return 0; } diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index a092c30c1e..71a3784396 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -142,31 +142,31 @@ static int get_audio_flags(AVCodecContext *enc){ static void put_amf_string(AVIOContext *pb, const char *str) { size_t len = strlen(str); - put_be16(pb, len); - put_buffer(pb, str, len); + avio_wb16(pb, len); + avio_write(pb, str, len); } static void put_avc_eos_tag(AVIOContext *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 */ + avio_w8(pb, FLV_TAG_TYPE_VIDEO); + avio_wb24(pb, 5); /* Tag Data Size */ + avio_wb24(pb, ts); /* lower 24 bits of timestamp in ms*/ + avio_w8(pb, (ts >> 24) & 0x7F); /* MSB of ts in ms*/ + avio_wb24(pb, 0); /* StreamId = 0 */ + avio_w8(pb, 23); /* ub[4] FrameType = 1, ub[4] CodecId = 7 */ + avio_w8(pb, 2); /* AVC end of sequence */ + avio_wb24(pb, 0); /* Always 0 for AVC EOS. */ + avio_wb32(pb, 16); /* Size of FLV tag */ } static void put_amf_double(AVIOContext *pb, double d) { - put_byte(pb, AMF_DATA_TYPE_NUMBER); - put_be64(pb, av_dbl2int(d)); + avio_w8(pb, AMF_DATA_TYPE_NUMBER); + avio_wb64(pb, av_dbl2int(d)); } static void put_amf_bool(AVIOContext *pb, int b) { - put_byte(pb, AMF_DATA_TYPE_BOOL); - put_byte(pb, !!b); + avio_w8(pb, AMF_DATA_TYPE_BOOL); + avio_w8(pb, !!b); } static int flv_write_header(AVFormatContext *s) @@ -200,19 +200,19 @@ static int flv_write_header(AVFormatContext *s) av_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */ } put_tag(pb,"FLV"); - put_byte(pb,1); - put_byte(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc + avio_w8(pb,1); + avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc + FLV_HEADER_FLAG_HASVIDEO * !!video_enc); - put_be32(pb,9); - put_be32(pb,0); + avio_wb32(pb,9); + avio_wb32(pb,0); for(i=0; inb_streams; i++){ if(s->streams[i]->codec->codec_tag == 5){ - put_byte(pb,8); // message type - put_be24(pb,0); // include flags - put_be24(pb,0); // time stamp - put_be32(pb,0); // reserved - put_be32(pb,11); // size + avio_w8(pb,8); // message type + avio_wb24(pb,0); // include flags + avio_wb24(pb,0); // time stamp + avio_wb32(pb,0); // reserved + avio_wb32(pb,11); // size flv->reserved=5; } } @@ -220,21 +220,21 @@ static int flv_write_header(AVFormatContext *s) flv->last_video_ts = -1; /* write meta_tag */ - put_byte(pb, 18); // tag type META + avio_w8(pb, 18); // tag type META metadata_size_pos= url_ftell(pb); - put_be24(pb, 0); // size of data part (sum of all parts below) - put_be24(pb, 0); // time stamp - put_be32(pb, 0); // reserved + avio_wb24(pb, 0); // size of data part (sum of all parts below) + avio_wb24(pb, 0); // time stamp + avio_wb32(pb, 0); // reserved /* now data of data_size size */ /* first event name as a string */ - put_byte(pb, AMF_DATA_TYPE_STRING); + avio_w8(pb, AMF_DATA_TYPE_STRING); put_amf_string(pb, "onMetaData"); // 12 bytes /* mixed array (hash) with size and string/type/data tuples */ - put_byte(pb, AMF_DATA_TYPE_MIXEDARRAY); - put_be32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size + avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY); + avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size put_amf_string(pb, "duration"); flv->duration_offset= url_ftell(pb); @@ -276,7 +276,7 @@ static int flv_write_header(AVFormatContext *s) 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); + avio_w8(pb, AMF_DATA_TYPE_STRING); put_amf_string(pb, tag->value); } @@ -285,41 +285,41 @@ static int flv_write_header(AVFormatContext *s) put_amf_double(pb, 0); // delayed write put_amf_string(pb, ""); - put_byte(pb, AMF_END_OF_OBJECT); + avio_w8(pb, AMF_END_OF_OBJECT); /* write total size of tag */ data_size= url_ftell(pb) - metadata_size_pos - 10; url_fseek(pb, metadata_size_pos, SEEK_SET); - put_be24(pb, data_size); + avio_wb24(pb, data_size); url_fseek(pb, data_size + 10 - 3, SEEK_CUR); - put_be32(pb, data_size + 11); + avio_wb32(pb, data_size + 11); for (i = 0; i < s->nb_streams; i++) { AVCodecContext *enc = s->streams[i]->codec; if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) { int64_t pos; - put_byte(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ? + avio_w8(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ? FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO); - put_be24(pb, 0); // size patched later - put_be24(pb, 0); // ts - put_byte(pb, 0); // ts ext - put_be24(pb, 0); // streamid + avio_wb24(pb, 0); // size patched later + avio_wb24(pb, 0); // ts + avio_w8(pb, 0); // ts ext + avio_wb24(pb, 0); // streamid pos = url_ftell(pb); if (enc->codec_id == CODEC_ID_AAC) { - put_byte(pb, get_audio_flags(enc)); - put_byte(pb, 0); // AAC sequence header - put_buffer(pb, enc->extradata, enc->extradata_size); + avio_w8(pb, get_audio_flags(enc)); + avio_w8(pb, 0); // AAC sequence header + avio_write(pb, enc->extradata, enc->extradata_size); } else { - put_byte(pb, enc->codec_tag | FLV_FRAME_KEY); // flags - put_byte(pb, 0); // AVC sequence header - put_be24(pb, 0); // composition time + avio_w8(pb, enc->codec_tag | FLV_FRAME_KEY); // flags + avio_w8(pb, 0); // AVC sequence header + avio_wb24(pb, 0); // composition time ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size); } data_size = url_ftell(pb) - pos; url_fseek(pb, -data_size - 10, SEEK_CUR); - put_be24(pb, data_size); + avio_wb24(pb, data_size); url_fseek(pb, data_size + 10 - 3, SEEK_CUR); - put_be32(pb, data_size + 11); // previous tag size + avio_wb32(pb, data_size + 11); // previous tag size } } @@ -376,7 +376,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) flags_size= 1; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { - put_byte(pb, FLV_TAG_TYPE_VIDEO); + avio_w8(pb, FLV_TAG_TYPE_VIDEO); flags = enc->codec_tag; if(flags == 0) { @@ -391,7 +391,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) assert(size); - put_byte(pb, FLV_TAG_TYPE_AUDIO); + avio_w8(pb, FLV_TAG_TYPE_AUDIO); } if (enc->codec_id == CODEC_ID_H264) { @@ -409,25 +409,25 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) 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_ - put_be24(pb,flv->reserved); - put_byte(pb,flags); + avio_wb24(pb,size + flags_size); + avio_wb24(pb,ts); + avio_w8(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_ + avio_wb24(pb,flv->reserved); + avio_w8(pb,flags); if (enc->codec_id == CODEC_ID_VP6) - put_byte(pb,0); + avio_w8(pb,0); if (enc->codec_id == CODEC_ID_VP6F) - put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0); + avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0); else if (enc->codec_id == CODEC_ID_AAC) - put_byte(pb,1); // AAC raw + avio_w8(pb,1); // AAC raw else if (enc->codec_id == CODEC_ID_H264) { - put_byte(pb,1); // AVC NALU - put_be24(pb,pkt->pts - pkt->dts); + avio_w8(pb,1); // AVC NALU + avio_wb24(pb,pkt->pts - pkt->dts); } - put_buffer(pb, data ? data : pkt->data, size); + avio_write(pb, data ? data : pkt->data, size); - put_be32(pb,size+flags_size+11); // previous tag size + avio_wb32(pb,size+flags_size+11); // previous tag size flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration); put_flush_packet(pb); diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c index f456ec6816..26ede95495 100644 --- a/libavformat/framecrcenc.c +++ b/libavformat/framecrcenc.c @@ -28,7 +28,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) char buf[256]; snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc); - put_buffer(s->pb, buf, strlen(buf)); + avio_write(s->pb, buf, strlen(buf)); put_flush_packet(s->pb); return 0; } diff --git a/libavformat/gif.c b/libavformat/gif.c index 2fdd5cdae0..f3f64d1fcc 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -116,24 +116,24 @@ static int gif_image_write_header(AVIOContext *pb, put_tag(pb, "GIF"); put_tag(pb, "89a"); - put_le16(pb, width); - put_le16(pb, height); + avio_wl16(pb, width); + avio_wl16(pb, height); - put_byte(pb, 0xf7); /* flags: global clut, 256 entries */ - put_byte(pb, 0x1f); /* background color index */ - put_byte(pb, 0); /* aspect ratio */ + avio_w8(pb, 0xf7); /* flags: global clut, 256 entries */ + avio_w8(pb, 0x1f); /* background color index */ + avio_w8(pb, 0); /* aspect ratio */ /* the global palette */ if (!palette) { - put_buffer(pb, (const unsigned char *)gif_clut, 216*3); + avio_write(pb, (const unsigned char *)gif_clut, 216*3); for(i=0;i<((256-216)*3);i++) - put_byte(pb, 0); + avio_w8(pb, 0); } else { for(i=0;i<256;i++) { v = palette[i]; - put_byte(pb, (v >> 16) & 0xff); - put_byte(pb, (v >> 8) & 0xff); - put_byte(pb, (v) & 0xff); + avio_w8(pb, (v >> 16) & 0xff); + avio_w8(pb, (v >> 8) & 0xff); + avio_w8(pb, (v) & 0xff); } } @@ -159,14 +159,14 @@ static int gif_image_write_header(AVIOContext *pb, /* application extension header */ #ifdef GIF_ADD_APP_HEADER if (loop_count >= 0 && loop_count <= 65535) { - put_byte(pb, 0x21); - put_byte(pb, 0xff); - put_byte(pb, 0x0b); + avio_w8(pb, 0x21); + avio_w8(pb, 0xff); + avio_w8(pb, 0x0b); put_tag(pb, "NETSCAPE2.0"); // bytes 4 to 14 - put_byte(pb, 0x03); // byte 15 - put_byte(pb, 0x01); // byte 16 - put_le16(pb, (uint16_t)loop_count); - put_byte(pb, 0x00); // byte 19 + avio_w8(pb, 0x03); // byte 15 + avio_w8(pb, 0x01); // byte 16 + avio_wl16(pb, (uint16_t)loop_count); + avio_w8(pb, 0x00); // byte 19 } #endif return 0; @@ -189,15 +189,15 @@ static int gif_image_write_image(AVIOContext *pb, const uint8_t *ptr; /* image block */ - put_byte(pb, 0x2c); - put_le16(pb, x1); - put_le16(pb, y1); - put_le16(pb, width); - put_le16(pb, height); - put_byte(pb, 0x00); /* flags */ + avio_w8(pb, 0x2c); + avio_wl16(pb, x1); + avio_wl16(pb, y1); + avio_wl16(pb, width); + avio_wl16(pb, height); + avio_w8(pb, 0x00); /* flags */ /* no local clut */ - put_byte(pb, 0x08); + avio_w8(pb, 0x08); left= width * height; @@ -233,13 +233,13 @@ static int gif_image_write_image(AVIOContext *pb, flush_put_bits(&p); } if(put_bits_ptr(&p) - p.buf > 0) { - put_byte(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */ - put_buffer(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */ + avio_w8(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */ + avio_write(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */ p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */ } left-=GIF_CHUNKS; } - put_byte(pb, 0x00); /* end of image block */ + avio_w8(pb, 0x00); /* end of image block */ return 0; } @@ -300,10 +300,10 @@ static int gif_write_video(AVFormatContext *s, int64_t delay; /* graphic control extension block */ - put_byte(pb, 0x21); - put_byte(pb, 0xf9); - put_byte(pb, 0x04); /* block size */ - put_byte(pb, 0x04); /* flags */ + avio_w8(pb, 0x21); + avio_w8(pb, 0xf9); + avio_w8(pb, 0x04); /* block size */ + avio_w8(pb, 0x04); /* flags */ /* 1 jiffy is 1/70 s */ /* the delay_time field indicates the number of jiffies - 1 */ @@ -314,10 +314,10 @@ static int gif_write_video(AVFormatContext *s, /* XXX: don't even remember if I really use it for now */ jiffies = (70*enc->time_base.num/enc->time_base.den) - 1; - put_le16(pb, jiffies); + avio_wl16(pb, jiffies); - put_byte(pb, 0x1f); /* transparent color index */ - put_byte(pb, 0x00); + avio_w8(pb, 0x1f); /* transparent color index */ + avio_w8(pb, 0x00); gif_image_write_image(pb, 0, 0, enc->width, enc->height, buf, enc->width * 3, PIX_FMT_RGB24); @@ -339,7 +339,7 @@ static int gif_write_trailer(AVFormatContext *s) { AVIOContext *pb = s->pb; - put_byte(pb, 0x3b); + avio_w8(pb, 0x3b); put_flush_packet(s->pb); return 0; } diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 60db45d3e5..fb6f441f3e 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -116,7 +116,7 @@ static int gxf_find_lines_index(AVStream *st) static void gxf_write_padding(AVIOContext *pb, int64_t to_pad) { for (; to_pad > 0; to_pad--) { - put_byte(pb, 0); + avio_w8(pb, 0); } } @@ -132,7 +132,7 @@ static int64_t updatePacketSize(AVIOContext *pb, int64_t pos) } curpos = url_ftell(pb); url_fseek(pb, pos + 6, SEEK_SET); - put_be32(pb, size); + avio_wb32(pb, size); url_fseek(pb, curpos, SEEK_SET); return curpos - pos; } @@ -143,20 +143,20 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos) curpos = url_ftell(pb); url_fseek(pb, pos, SEEK_SET); - put_be16(pb, curpos - pos - 2); + avio_wb16(pb, curpos - pos - 2); url_fseek(pb, curpos, SEEK_SET); return curpos - pos; } static void gxf_write_packet_header(AVIOContext *pb, GXFPktType type) { - put_be32(pb, 0); /* packet leader for synchro */ - put_byte(pb, 1); - put_byte(pb, type); /* map packet */ - put_be32(pb, 0); /* size */ - put_be32(pb, 0); /* reserved */ - put_byte(pb, 0xE1); /* trailer 1 */ - put_byte(pb, 0xE2); /* trailer 2 */ + avio_wb32(pb, 0); /* packet leader for synchro */ + avio_w8(pb, 1); + avio_w8(pb, type); /* map packet */ + avio_wb32(pb, 0); /* size */ + avio_wb32(pb, 0); /* reserved */ + avio_w8(pb, 0xE1); /* trailer 1 */ + avio_w8(pb, 0xE2); /* trailer 2 */ } static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st) @@ -191,20 +191,20 @@ static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st) (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 + 15) / 16); - put_byte(pb, TRACK_MPG_AUX); - put_byte(pb, size + 1); - put_buffer(pb, (uint8_t *)buffer, size + 1); + avio_w8(pb, TRACK_MPG_AUX); + avio_w8(pb, size + 1); + avio_write(pb, (uint8_t *)buffer, size + 1); return size + 3; } static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFStreamContext *sc) { - put_byte(pb, 0); /* fields */ - put_byte(pb, 0); /* seconds */ - put_byte(pb, 0); /* minutes */ - put_byte(pb, 0); /* flags + hours */ + avio_w8(pb, 0); /* fields */ + avio_w8(pb, 0); /* seconds */ + avio_w8(pb, 0); /* minutes */ + avio_w8(pb, 0); /* flags + hours */ /* reserved */ - put_be32(pb, 0); + avio_wb32(pb, 0); return 8; } @@ -215,51 +215,51 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int mpeg = sc->track_type == 4 || sc->track_type == 9; /* track description section */ - put_byte(pb, sc->media_type + 0x80); - put_byte(pb, index + 0xC0); + avio_w8(pb, sc->media_type + 0x80); + avio_w8(pb, index + 0xC0); pos = url_ftell(pb); - put_be16(pb, 0); /* size */ + avio_wb16(pb, 0); /* size */ /* media file name */ - put_byte(pb, TRACK_NAME); - put_byte(pb, strlen(ES_NAME_PATTERN) + 3); + avio_w8(pb, TRACK_NAME); + avio_w8(pb, strlen(ES_NAME_PATTERN) + 3); put_tag(pb, ES_NAME_PATTERN); - put_be16(pb, sc->media_info); - put_byte(pb, 0); + avio_wb16(pb, sc->media_info); + avio_w8(pb, 0); if (!mpeg) { /* auxiliary information */ - put_byte(pb, TRACK_AUX); - put_byte(pb, 8); + avio_w8(pb, TRACK_AUX); + avio_w8(pb, 8); if (sc->track_type == 3) gxf_write_timecode_auxiliary(pb, sc); else - put_le64(pb, 0); + avio_wl64(pb, 0); } /* file system version */ - put_byte(pb, TRACK_VER); - put_byte(pb, 4); - put_be32(pb, 0); + avio_w8(pb, TRACK_VER); + avio_w8(pb, 4); + avio_wb32(pb, 0); if (mpeg) gxf_write_mpeg_auxiliary(pb, s->streams[index]); /* frame rate */ - put_byte(pb, TRACK_FPS); - put_byte(pb, 4); - put_be32(pb, sc->frame_rate_index); + avio_w8(pb, TRACK_FPS); + avio_w8(pb, 4); + avio_wb32(pb, sc->frame_rate_index); /* lines per frame */ - put_byte(pb, TRACK_LINES); - put_byte(pb, 4); - put_be32(pb, sc->lines_index); + avio_w8(pb, TRACK_LINES); + avio_w8(pb, 4); + avio_wb32(pb, sc->lines_index); /* fields per frame */ - put_byte(pb, TRACK_FPF); - put_byte(pb, 4); - put_be32(pb, sc->fields); + avio_w8(pb, TRACK_FPF); + avio_w8(pb, 4); + avio_wb32(pb, sc->fields); return updateSize(pb, pos); } @@ -272,42 +272,42 @@ static int gxf_write_material_data_section(AVFormatContext *s) const char *filename = strrchr(s->filename, '/'); pos = url_ftell(pb); - put_be16(pb, 0); /* size */ + avio_wb16(pb, 0); /* size */ /* name */ if (filename) filename++; else filename = s->filename; - put_byte(pb, MAT_NAME); - put_byte(pb, strlen(SERVER_PATH) + strlen(filename) + 1); + avio_w8(pb, MAT_NAME); + avio_w8(pb, strlen(SERVER_PATH) + strlen(filename) + 1); put_tag(pb, SERVER_PATH); put_tag(pb, filename); - put_byte(pb, 0); + avio_w8(pb, 0); /* first field */ - put_byte(pb, MAT_FIRST_FIELD); - put_byte(pb, 4); - put_be32(pb, 0); + avio_w8(pb, MAT_FIRST_FIELD); + avio_w8(pb, 4); + avio_wb32(pb, 0); /* last field */ - put_byte(pb, MAT_LAST_FIELD); - put_byte(pb, 4); - put_be32(pb, gxf->nb_fields); + avio_w8(pb, MAT_LAST_FIELD); + avio_w8(pb, 4); + avio_wb32(pb, gxf->nb_fields); /* reserved */ - put_byte(pb, MAT_MARK_IN); - put_byte(pb, 4); - put_be32(pb, 0); + avio_w8(pb, MAT_MARK_IN); + avio_w8(pb, 4); + avio_wb32(pb, 0); - put_byte(pb, MAT_MARK_OUT); - put_byte(pb, 4); - put_be32(pb, gxf->nb_fields); + avio_w8(pb, MAT_MARK_OUT); + avio_w8(pb, 4); + avio_wb32(pb, gxf->nb_fields); /* estimated size */ - put_byte(pb, MAT_SIZE); - put_byte(pb, 4); - put_be32(pb, url_fsize(pb) / 1024); + avio_w8(pb, MAT_SIZE); + avio_w8(pb, 4); + avio_wb32(pb, url_fsize(pb) / 1024); return updateSize(pb, pos); } @@ -320,7 +320,7 @@ static int gxf_write_track_description_section(AVFormatContext *s) int i; pos = url_ftell(pb); - put_be16(pb, 0); /* size */ + avio_wb16(pb, 0); /* size */ for (i = 0; i < s->nb_streams; ++i) gxf_write_track_description(s, s->streams[i]->priv_data, i); @@ -350,8 +350,8 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite) gxf_write_packet_header(pb, PKT_MAP); /* preamble */ - put_byte(pb, 0xE0); /* version */ - put_byte(pb, 0xFF); /* reserved */ + avio_w8(pb, 0xE0); /* version */ + avio_w8(pb, 0xFF); /* reserved */ gxf_write_material_data_section(s); gxf_write_track_description_section(s); @@ -370,16 +370,16 @@ static int gxf_write_flt_packet(AVFormatContext *s) gxf_write_packet_header(pb, PKT_FLT); - put_le32(pb, fields_per_flt); /* number of fields */ - put_le32(pb, flt_entries); /* number of active flt entries */ + avio_wl32(pb, fields_per_flt); /* number of fields */ + avio_wl32(pb, flt_entries); /* number of active flt entries */ if (gxf->flt_entries) { for (i = 0; i < flt_entries; i++) - put_le32(pb, gxf->flt_entries[(i*fields_per_flt)>>1]); + avio_wl32(pb, gxf->flt_entries[(i*fields_per_flt)>>1]); } for (; i < 1000; i++) - put_le32(pb, 0); + avio_wl32(pb, 0); return updatePacketSize(pb, pos); } @@ -397,21 +397,21 @@ static int gxf_write_umf_material_description(AVFormatContext *s) gxf->nb_fields / timecode_base % 60 << 8 | // seconds gxf->nb_fields % timecode_base; // fields - put_le32(pb, gxf->flags); - put_le32(pb, gxf->nb_fields); /* length of the longest track */ - put_le32(pb, gxf->nb_fields); /* length of the shortest track */ - put_le32(pb, 0); /* mark in */ - put_le32(pb, gxf->nb_fields); /* mark out */ - put_le32(pb, 0); /* timecode mark in */ - put_le32(pb, timecode); /* timecode mark out */ - put_le64(pb, s->timestamp); /* modification time */ - put_le64(pb, s->timestamp); /* creation time */ - put_le16(pb, 0); /* reserved */ - put_le16(pb, 0); /* reserved */ - put_le16(pb, gxf->audio_tracks); - put_le16(pb, 1); /* timecode track count */ - put_le16(pb, 0); /* reserved */ - put_le16(pb, gxf->mpeg_tracks); + avio_wl32(pb, gxf->flags); + avio_wl32(pb, gxf->nb_fields); /* length of the longest track */ + avio_wl32(pb, gxf->nb_fields); /* length of the shortest track */ + avio_wl32(pb, 0); /* mark in */ + avio_wl32(pb, gxf->nb_fields); /* mark out */ + avio_wl32(pb, 0); /* timecode mark in */ + avio_wl32(pb, timecode); /* timecode mark out */ + avio_wl64(pb, s->timestamp); /* modification time */ + avio_wl64(pb, s->timestamp); /* creation time */ + avio_wl16(pb, 0); /* reserved */ + avio_wl16(pb, 0); /* reserved */ + avio_wl16(pb, gxf->audio_tracks); + avio_wl16(pb, 1); /* timecode track count */ + avio_wl16(pb, 0); /* reserved */ + avio_wl16(pb, gxf->mpeg_tracks); return 48; } @@ -420,18 +420,18 @@ static int gxf_write_umf_payload(AVFormatContext *s) GXFContext *gxf = s->priv_data; AVIOContext *pb = s->pb; - put_le32(pb, gxf->umf_length); /* total length of the umf data */ - put_le32(pb, 3); /* version */ - put_le32(pb, s->nb_streams+1); - put_le32(pb, gxf->umf_track_offset); /* umf track section offset */ - put_le32(pb, gxf->umf_track_size); - put_le32(pb, s->nb_streams+1); - put_le32(pb, gxf->umf_media_offset); - put_le32(pb, gxf->umf_media_size); - put_le32(pb, gxf->umf_length); /* user data offset */ - put_le32(pb, 0); /* user data size */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ + avio_wl32(pb, gxf->umf_length); /* total length of the umf data */ + avio_wl32(pb, 3); /* version */ + avio_wl32(pb, s->nb_streams+1); + avio_wl32(pb, gxf->umf_track_offset); /* umf track section offset */ + avio_wl32(pb, gxf->umf_track_size); + avio_wl32(pb, s->nb_streams+1); + avio_wl32(pb, gxf->umf_media_offset); + avio_wl32(pb, gxf->umf_media_size); + avio_wl32(pb, gxf->umf_length); /* user data offset */ + avio_wl32(pb, 0); /* user data size */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ return 48; } @@ -445,12 +445,12 @@ static int gxf_write_umf_track_description(AVFormatContext *s) gxf->umf_track_offset = pos - gxf->umf_start_offset; for (i = 0; i < s->nb_streams; ++i) { GXFStreamContext *sc = s->streams[i]->priv_data; - put_le16(pb, sc->media_info); - put_le16(pb, 1); + avio_wl16(pb, sc->media_info); + avio_wl16(pb, 1); } - put_le16(pb, gxf->timecode_track.media_info); - put_le16(pb, 1); + avio_wl16(pb, gxf->timecode_track.media_info); + avio_wl16(pb, 1); return url_ftell(pb) - pos; } @@ -460,34 +460,34 @@ static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st) GXFStreamContext *sc = st->priv_data; if (st->codec->pix_fmt == PIX_FMT_YUV422P) - put_le32(pb, 2); + avio_wl32(pb, 2); else - put_le32(pb, 1); /* default to 420 */ - put_le32(pb, sc->first_gop_closed == 1); /* closed = 1, open = 0, unknown = 255 */ - put_le32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */ - put_le32(pb, 1); /* I picture per GOP */ - put_le32(pb, sc->p_per_gop); - put_le32(pb, sc->b_per_i_or_p); + avio_wl32(pb, 1); /* default to 420 */ + avio_wl32(pb, sc->first_gop_closed == 1); /* closed = 1, open = 0, unknown = 255 */ + avio_wl32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */ + avio_wl32(pb, 1); /* I picture per GOP */ + avio_wl32(pb, sc->p_per_gop); + avio_wl32(pb, sc->b_per_i_or_p); if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) - put_le32(pb, 2); + avio_wl32(pb, 2); else if (st->codec->codec_id == CODEC_ID_MPEG1VIDEO) - put_le32(pb, 1); + avio_wl32(pb, 1); else - put_le32(pb, 0); - put_le32(pb, 0); /* reserved */ + avio_wl32(pb, 0); + avio_wl32(pb, 0); /* reserved */ return 32; } static int gxf_write_umf_media_timecode(AVIOContext *pb, GXFStreamContext *sc) { - put_le32(pb, 1); /* non drop frame */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ + avio_wl32(pb, 1); /* non drop frame */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ return 32; } @@ -496,29 +496,29 @@ static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc) int i; for (i = 0; i < 8; i++) { - put_be32(pb, 0); + avio_wb32(pb, 0); } return 32; } static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc) { - put_le64(pb, av_dbl2int(1)); /* sound level to begin to */ - put_le64(pb, av_dbl2int(1)); /* sound level to begin to */ - put_le32(pb, 0); /* number of fields over which to ramp up sound level */ - put_le32(pb, 0); /* number of fields over which to ramp down sound level */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ + avio_wl64(pb, av_dbl2int(1)); /* sound level to begin to */ + avio_wl64(pb, av_dbl2int(1)); /* sound level to begin to */ + avio_wl32(pb, 0); /* number of fields over which to ramp up sound level */ + avio_wl32(pb, 0); /* number of fields over which to ramp down sound level */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ return 32; } #if 0 static int gxf_write_umf_media_mjpeg(AVIOContext *pb, GXFStreamContext *sc) { - put_be64(pb, 0); /* FIXME FLOAT max chroma quant level */ - put_be64(pb, 0); /* FIXME FLOAT max luma quant level */ - put_be64(pb, 0); /* FIXME FLOAT min chroma quant level */ - put_be64(pb, 0); /* FIXME FLOAT min luma quant level */ + avio_wb64(pb, 0); /* FIXME FLOAT max chroma quant level */ + avio_wb64(pb, 0); /* FIXME FLOAT max luma quant level */ + avio_wb64(pb, 0); /* FIXME FLOAT min chroma quant level */ + avio_wb64(pb, 0); /* FIXME FLOAT min luma quant level */ return 32; } #endif @@ -542,22 +542,22 @@ static int gxf_write_umf_media_description(AVFormatContext *s) sc = s->streams[i]->priv_data; startpos = url_ftell(pb); - put_le16(pb, 0); /* length */ - put_le16(pb, sc->media_info); - put_le16(pb, 0); /* reserved */ - put_le16(pb, 0); /* reserved */ - put_le32(pb, gxf->nb_fields); - put_le32(pb, 0); /* attributes rw, ro */ - put_le32(pb, 0); /* mark in */ - put_le32(pb, gxf->nb_fields); /* mark out */ - put_buffer(pb, ES_NAME_PATTERN, strlen(ES_NAME_PATTERN)); - put_be16(pb, sc->media_info); + avio_wl16(pb, 0); /* length */ + avio_wl16(pb, sc->media_info); + avio_wl16(pb, 0); /* reserved */ + avio_wl16(pb, 0); /* reserved */ + avio_wl32(pb, gxf->nb_fields); + avio_wl32(pb, 0); /* attributes rw, ro */ + avio_wl32(pb, 0); /* mark in */ + avio_wl32(pb, gxf->nb_fields); /* mark out */ + avio_write(pb, ES_NAME_PATTERN, strlen(ES_NAME_PATTERN)); + avio_wb16(pb, sc->media_info); for (j = strlen(ES_NAME_PATTERN)+2; j < 88; j++) - put_byte(pb, 0); - put_le32(pb, sc->track_type); - put_le32(pb, sc->sample_rate); - put_le32(pb, sc->sample_size); - put_le32(pb, 0); /* reserved */ + avio_w8(pb, 0); + avio_wl32(pb, sc->track_type); + avio_wl32(pb, sc->sample_rate); + avio_wl32(pb, sc->sample_size); + avio_wl32(pb, 0); /* reserved */ if (sc == &gxf->timecode_track) gxf_write_umf_media_timecode(pb, sc); /* 8 0bytes */ @@ -579,7 +579,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s) curpos = url_ftell(pb); url_fseek(pb, startpos, SEEK_SET); - put_le16(pb, curpos - startpos); + avio_wl16(pb, curpos - startpos); url_fseek(pb, curpos, SEEK_SET); } return url_ftell(pb) - pos; @@ -594,8 +594,8 @@ static int gxf_write_umf_packet(AVFormatContext *s) gxf_write_packet_header(pb, PKT_UMF); /* preamble */ - put_byte(pb, 3); /* first and last (only) packet */ - put_be32(pb, gxf->umf_length); /* data length */ + avio_w8(pb, 3); /* first and last (only) packet */ + avio_wb32(pb, gxf->umf_length); /* data length */ gxf->umf_start_offset = url_ftell(pb); gxf_write_umf_payload(s); @@ -823,33 +823,33 @@ static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size) (int64_t)48000*gxf->time_base.num, AV_ROUND_UP); } - put_byte(pb, sc->media_type); - put_byte(pb, st->index); - put_be32(pb, field_nb); + avio_w8(pb, sc->media_type); + avio_w8(pb, st->index); + avio_wb32(pb, field_nb); if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - put_be16(pb, 0); - put_be16(pb, size / 2); + avio_wb16(pb, 0); + avio_wb16(pb, size / 2); } else if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) { int frame_type = gxf_parse_mpeg_frame(sc, pkt->data, pkt->size); if (frame_type == FF_I_TYPE) { - put_byte(pb, 0x0d); + avio_w8(pb, 0x0d); sc->iframes++; } else if (frame_type == FF_B_TYPE) { - put_byte(pb, 0x0f); + avio_w8(pb, 0x0f); sc->bframes++; } else { - put_byte(pb, 0x0e); + avio_w8(pb, 0x0e); sc->pframes++; } - put_be24(pb, size); + avio_wb24(pb, size); } else if (st->codec->codec_id == CODEC_ID_DVVIDEO) { - put_byte(pb, size / 4096); - put_be24(pb, 0); + avio_w8(pb, size / 4096); + avio_wb24(pb, 0); } else - put_be32(pb, size); - put_be32(pb, field_nb); - put_byte(pb, 1); /* flags */ - put_byte(pb, 0); /* reserved */ + avio_wb32(pb, size); + avio_wb32(pb, field_nb); + avio_w8(pb, 1); /* flags */ + avio_w8(pb, 0); /* reserved */ return 16; } @@ -868,7 +868,7 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) padding = GXF_AUDIO_PACKET_SIZE - pkt->size; gxf_write_media_preamble(s, pkt, pkt->size + padding); - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); gxf_write_padding(pb, padding); if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { diff --git a/libavformat/idroqenc.c b/libavformat/idroqenc.c index 8859c98a93..9935b61e1b 100644 --- a/libavformat/idroqenc.c +++ b/libavformat/idroqenc.c @@ -29,7 +29,7 @@ static int roq_write_header(struct AVFormatContext *s) 0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00 }; - put_buffer(s->pb, header, 8); + avio_write(s->pb, header, 8); put_flush_packet(s->pb); return 0; diff --git a/libavformat/img2.c b/libavformat/img2.c index f2d40d16de..56c4850efe 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -368,9 +368,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) if(codec->codec_id == CODEC_ID_RAWVIDEO){ int ysize = codec->width * codec->height; - put_buffer(pb[0], pkt->data , ysize); - put_buffer(pb[1], pkt->data + ysize, (pkt->size - ysize)/2); - put_buffer(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2); + avio_write(pb[0], pkt->data , ysize); + avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2); + avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2); put_flush_packet(pb[1]); put_flush_packet(pb[2]); url_fclose(pb[1]); @@ -382,15 +382,15 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) AV_RL32(st->codec->extradata+4) == MKTAG('j','p','2','h')){ if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c')) goto error; - put_be32(pb[0], 12); + avio_wb32(pb[0], 12); put_tag (pb[0], "jP "); - put_be32(pb[0], 0x0D0A870A); // signature - put_be32(pb[0], 20); + avio_wb32(pb[0], 0x0D0A870A); // signature + avio_wb32(pb[0], 20); put_tag (pb[0], "ftyp"); put_tag (pb[0], "jp2 "); - put_be32(pb[0], 0); + avio_wb32(pb[0], 0); put_tag (pb[0], "jp2 "); - put_buffer(pb[0], st->codec->extradata, st->codec->extradata_size); + avio_write(pb[0], st->codec->extradata, st->codec->extradata_size); }else if(pkt->size < 8 || (!st->codec->extradata_size && AV_RL32(pkt->data+4) != MKTAG('j','P',' ',' '))){ // signature @@ -399,7 +399,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) return -1; } } - put_buffer(pb[0], pkt->data, pkt->size); + avio_write(pb[0], pkt->data, pkt->size); } put_flush_packet(pb[0]); if (!img->is_pipe) { diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index d7eed73e79..3913988144 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -34,15 +34,15 @@ static int ivf_write_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Currently only VP8 is supported!\n"); return AVERROR(EINVAL); } - put_buffer(pb, "DKIF", 4); - put_le16(pb, 0); // version - put_le16(pb, 32); // header length - put_le32(pb, ctx->codec_tag ? ctx->codec_tag : AV_RL32("VP80")); - put_le16(pb, ctx->width); - put_le16(pb, ctx->height); - put_le32(pb, s->streams[0]->time_base.den); - put_le32(pb, s->streams[0]->time_base.num); - put_le64(pb, s->streams[0]->duration); // TODO: duration or number of frames?!? + avio_write(pb, "DKIF", 4); + avio_wl16(pb, 0); // version + avio_wl16(pb, 32); // header length + avio_wl32(pb, ctx->codec_tag ? ctx->codec_tag : AV_RL32("VP80")); + avio_wl16(pb, ctx->width); + avio_wl16(pb, ctx->height); + avio_wl32(pb, s->streams[0]->time_base.den); + avio_wl32(pb, s->streams[0]->time_base.num); + avio_wl64(pb, s->streams[0]->duration); // TODO: duration or number of frames?!? return 0; } @@ -50,9 +50,9 @@ static int ivf_write_header(AVFormatContext *s) static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; - put_le32(pb, pkt->size); - put_le64(pb, pkt->pts); - put_buffer(pb, pkt->data, pkt->size); + avio_wl32(pb, pkt->size); + avio_wl64(pb, pkt->pts); + avio_write(pb, pkt->data, pkt->size); put_flush_packet(pb); return 0; diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 30ada1bf2f..af94d8c30e 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -47,7 +47,7 @@ static const AVCodecTag nut_tags[] = { #if CONFIG_LIBNUT_MUXER static int av_write(void * h, size_t len, const uint8_t * buf) { AVIOContext * bc = h; - put_buffer(bc, buf, len); + avio_write(bc, buf, len); //put_flush_packet(bc); return len; } diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 545c93895f..4488dd6c50 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1376,12 +1376,12 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(ENOMEM); ffio_init_context(&b, extradata, extradata_size, 1, NULL, NULL, NULL, NULL); - put_buffer(&b, "TTA1", 4); - put_le16(&b, 1); - put_le16(&b, track->audio.channels); - put_le16(&b, track->audio.bitdepth); - put_le32(&b, track->audio.out_samplerate); - put_le32(&b, matroska->ctx->duration * track->audio.out_samplerate); + avio_write(&b, "TTA1", 4); + avio_wl16(&b, 1); + avio_wl16(&b, track->audio.channels); + avio_wl16(&b, track->audio.bitdepth); + avio_wl32(&b, track->audio.out_samplerate); + avio_wl32(&b, matroska->ctx->duration * track->audio.out_samplerate); } else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 || codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) { extradata_offset = 26; diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index fbaa8db4da..2f075942ec 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -112,7 +112,7 @@ static void put_ebml_id(AVIOContext *pb, unsigned int id) { int i = ebml_id_size(id); while (i--) - put_byte(pb, id >> (i*8)); + avio_w8(pb, id >> (i*8)); } /** @@ -123,9 +123,9 @@ static void put_ebml_id(AVIOContext *pb, unsigned int id) static void put_ebml_size_unknown(AVIOContext *pb, int bytes) { assert(bytes <= 8); - put_byte(pb, 0x1ff >> bytes); + avio_w8(pb, 0x1ff >> bytes); while (--bytes) - put_byte(pb, 0xff); + avio_w8(pb, 0xff); } /** @@ -160,7 +160,7 @@ static void put_ebml_num(AVIOContext *pb, uint64_t num, int bytes) num |= 1ULL << bytes*7; for (i = bytes - 1; i >= 0; i--) - put_byte(pb, num >> i*8); + avio_w8(pb, num >> i*8); } static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val) @@ -172,14 +172,14 @@ static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val) put_ebml_id(pb, elementid); put_ebml_num(pb, bytes, 0); for (i = bytes - 1; i >= 0; i--) - put_byte(pb, val >> i*8); + avio_w8(pb, val >> i*8); } static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val) { put_ebml_id(pb, elementid); put_ebml_num(pb, 8, 0); - put_be64(pb, av_dbl2int(val)); + avio_wb64(pb, av_dbl2int(val)); } static void put_ebml_binary(AVIOContext *pb, unsigned int elementid, @@ -187,7 +187,7 @@ static void put_ebml_binary(AVIOContext *pb, unsigned int elementid, { put_ebml_id(pb, elementid); put_ebml_num(pb, size, 0); - put_buffer(pb, buf, size); + avio_write(pb, buf, size); } static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char *str) @@ -216,7 +216,7 @@ static void put_ebml_void(AVIOContext *pb, uint64_t size) else put_ebml_num(pb, size-9, 8); while(url_ftell(pb) < currentpos + size) - put_byte(pb, 0); + avio_w8(pb, 0); } static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, uint64_t expectedsize) @@ -241,8 +241,8 @@ static void put_xiph_size(AVIOContext *pb, int size) { int i; for (i = 0; i < size / 255; i++) - put_byte(pb, 255); - put_byte(pb, size % 255); + avio_w8(pb, 255); + avio_w8(pb, size % 255); } /** @@ -426,12 +426,12 @@ static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContex return -1; } - put_byte(pb, 2); // number packets - 1 + avio_w8(pb, 2); // number packets - 1 for (j = 0; j < 2; j++) { put_xiph_size(pb, header_len[j]); } for (j = 0; j < 3; j++) - put_buffer(pb, header_start[j], header_len[j]); + avio_write(pb, header_start[j], header_len[j]); return 0; } @@ -481,13 +481,13 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo else if (codec->codec_id == CODEC_ID_H264) ret = ff_isom_write_avcc(dyn_cp, codec->extradata, codec->extradata_size); else if (codec->extradata_size) - put_buffer(dyn_cp, codec->extradata, codec->extradata_size); + avio_write(dyn_cp, codec->extradata, codec->extradata_size); } else if (codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (qt_id) { if (!codec->codec_tag) codec->codec_tag = ff_codec_get_tag(codec_movvideo_tags, codec->codec_id); if (codec->extradata_size) - put_buffer(dyn_cp, codec->extradata, codec->extradata_size); + avio_write(dyn_cp, codec->extradata, codec->extradata_size); } else { if (!codec->codec_tag) codec->codec_tag = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id); @@ -932,10 +932,10 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size)); put_ebml_id(pb, MATROSKA_ID_BLOCK); put_ebml_num(pb, size+4, 0); - put_byte(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 - put_be16(pb, pkt->pts - mkv->cluster_pts); - put_byte(pb, 0); - put_buffer(pb, buffer, size); + avio_w8(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 + avio_wb16(pb, pkt->pts - mkv->cluster_pts); + avio_w8(pb, 0); + avio_write(pb, buffer, size); put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration); end_ebml_master(pb, blockgroup); @@ -965,10 +965,10 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, data = pkt->data; put_ebml_id(pb, blockid); put_ebml_num(pb, size+4, 0); - put_byte(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 - put_be16(pb, ts - mkv->cluster_pts); - put_byte(pb, flags); - put_buffer(pb, data, size); + avio_w8(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 + avio_wb16(pb, ts - mkv->cluster_pts); + avio_w8(pb, flags); + avio_write(pb, data, size); if (data != pkt->data) av_free(data); } @@ -1018,7 +1018,7 @@ static void mkv_flush_dynbuf(AVFormatContext *s) return; bufsize = url_close_dyn_buf(mkv->dyn_bc, &dyn_buf); - put_buffer(s->pb, dyn_buf, bufsize); + avio_write(s->pb, dyn_buf, bufsize); av_free(dyn_buf); mkv->dyn_bc = NULL; } diff --git a/libavformat/md5enc.c b/libavformat/md5enc.c index dd2f7c03ae..065f7e8dc9 100644 --- a/libavformat/md5enc.c +++ b/libavformat/md5enc.c @@ -36,7 +36,7 @@ static void md5_finish(struct AVFormatContext *s, char *buf) buf[offset] = '\n'; buf[offset+1] = 0; - put_buffer(s->pb, buf, strlen(buf)); + avio_write(s->pb, buf, strlen(buf)); put_flush_packet(s->pb); } diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 1a00908eba..eb48b782d2 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -53,7 +53,7 @@ static void end_tag_be(AVIOContext *pb, int64_t start) pos = url_ftell(pb); url_fseek(pb, start - 4, SEEK_SET); - put_be32(pb, (uint32_t)(pos - start)); + avio_wb32(pb, (uint32_t)(pos - start)); url_fseek(pb, pos, SEEK_SET); } @@ -71,31 +71,31 @@ static int mmf_write_header(AVFormatContext *s) } put_tag(pb, "MMMD"); - put_be32(pb, 0); + avio_wb32(pb, 0); pos = ff_start_tag(pb, "CNTI"); - put_byte(pb, 0); /* class */ - put_byte(pb, 0); /* type */ - put_byte(pb, 0); /* code type */ - put_byte(pb, 0); /* status */ - put_byte(pb, 0); /* counts */ + avio_w8(pb, 0); /* class */ + avio_w8(pb, 0); /* type */ + avio_w8(pb, 0); /* code type */ + avio_w8(pb, 0); /* status */ + avio_w8(pb, 0); /* counts */ put_tag(pb, "VN:libavcodec,"); /* metadata ("ST:songtitle,VN:version,...") */ end_tag_be(pb, pos); - put_buffer(pb, "ATR\x00", 4); - put_be32(pb, 0); + avio_write(pb, "ATR\x00", 4); + avio_wb32(pb, 0); mmf->atrpos = url_ftell(pb); - put_byte(pb, 0); /* format type */ - put_byte(pb, 0); /* sequence type */ - put_byte(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */ - put_byte(pb, 0); /* wave base bit */ - put_byte(pb, 2); /* time base d */ - put_byte(pb, 2); /* time base g */ + avio_w8(pb, 0); /* format type */ + avio_w8(pb, 0); /* sequence type */ + avio_w8(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */ + avio_w8(pb, 0); /* wave base bit */ + avio_w8(pb, 2); /* time base d */ + avio_w8(pb, 2); /* time base g */ put_tag(pb, "Atsq"); - put_be32(pb, 16); + avio_wb32(pb, 16); mmf->atsqpos = url_ftell(pb); /* Will be filled on close */ - put_buffer(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16); + avio_write(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16); mmf->awapos = ff_start_tag(pb, "Awa\x01"); @@ -109,7 +109,7 @@ static int mmf_write_header(AVFormatContext *s) static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); return 0; } @@ -117,11 +117,11 @@ static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt) static void put_varlength(AVIOContext *pb, int val) { if(val < 128) - put_byte(pb, val); + avio_w8(pb, val); else { val -= 128; - put_byte(pb, 0x80 | val >> 7); - put_byte(pb, 0x7f & val); + avio_w8(pb, 0x80 | val >> 7); + avio_w8(pb, 0x7f & val); } } @@ -145,17 +145,17 @@ static int mmf_write_trailer(AVFormatContext *s) url_fseek(pb, mmf->atsqpos, SEEK_SET); /* "play wav" */ - put_byte(pb, 0); /* start time */ - put_byte(pb, 1); /* (channel << 6) | wavenum */ + avio_w8(pb, 0); /* start time */ + avio_w8(pb, 1); /* (channel << 6) | wavenum */ gatetime = size * 500 / s->streams[0]->codec->sample_rate; put_varlength(pb, gatetime); /* duration */ /* "nop" */ put_varlength(pb, gatetime); /* start time */ - put_buffer(pb, "\xff\x00", 2); /* nop */ + avio_write(pb, "\xff\x00", 2); /* nop */ /* "end of sequence" */ - put_buffer(pb, "\x00\x00\x00\x00", 4); + avio_write(pb, "\x00\x00\x00\x00", 4); url_fseek(pb, pos, SEEK_SET); diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 097f4641f2..9c45352e0f 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -40,7 +40,7 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos) { int64_t curpos = url_ftell(pb); url_fseek(pb, pos, SEEK_SET); - put_be32(pb, curpos - pos); /* rewrite size */ + avio_wb32(pb, curpos - pos); /* rewrite size */ url_fseek(pb, curpos, SEEK_SET); return curpos - pos; @@ -52,19 +52,19 @@ static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track) int i; int mode64 = 0; // use 32 bit size variant if possible int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ if (pos > UINT32_MAX) { mode64 = 1; put_tag(pb, "co64"); } else put_tag(pb, "stco"); - put_be32(pb, 0); /* version & flags */ - put_be32(pb, track->entry); /* entry count */ + avio_wb32(pb, 0); /* version & flags */ + avio_wb32(pb, track->entry); /* entry count */ for (i=0; ientry; i++) { if(mode64 == 1) - put_be64(pb, track->cluster[i].pos); + avio_wb64(pb, track->cluster[i].pos); else - put_be32(pb, track->cluster[i].pos); + avio_wb32(pb, track->cluster[i].pos); } return updateSize(pb, pos); } @@ -76,9 +76,9 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) int i, j, entries = 0, tst = -1, oldtst = -1; int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "stsz"); - put_be32(pb, 0); /* version & flags */ + avio_wb32(pb, 0); /* version & flags */ for (i=0; ientry; i++) { tst = track->cluster[i].size/track->cluster[i].entries; @@ -90,15 +90,15 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) } if (equalChunks) { int sSize = track->cluster[0].size/track->cluster[0].entries; - put_be32(pb, sSize); // sample size - put_be32(pb, entries); // sample count + avio_wb32(pb, sSize); // sample size + avio_wb32(pb, entries); // sample count } else { - put_be32(pb, 0); // sample size - put_be32(pb, entries); // sample count + avio_wb32(pb, 0); // sample size + avio_wb32(pb, entries); // sample count for (i=0; ientry; i++) { for (j=0; jcluster[i].entries; j++) { - put_be32(pb, track->cluster[i].size / + avio_wb32(pb, track->cluster[i].size / track->cluster[i].entries); } } @@ -113,24 +113,24 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) int64_t entryPos, curpos; int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "stsc"); - put_be32(pb, 0); // version & flags + avio_wb32(pb, 0); // version & flags entryPos = url_ftell(pb); - put_be32(pb, track->entry); // entry count + avio_wb32(pb, track->entry); // entry count for (i=0; ientry; i++) { if(oldval != track->cluster[i].samplesInChunk) { - put_be32(pb, i+1); // first chunk - put_be32(pb, track->cluster[i].samplesInChunk); // samples per chunk - put_be32(pb, 0x1); // sample description index + avio_wb32(pb, i+1); // first chunk + avio_wb32(pb, track->cluster[i].samplesInChunk); // samples per chunk + avio_wb32(pb, 0x1); // sample description index oldval = track->cluster[i].samplesInChunk; index++; } } curpos = url_ftell(pb); url_fseek(pb, entryPos, SEEK_SET); - put_be32(pb, index); // rewrite size + avio_wb32(pb, index); // rewrite size url_fseek(pb, curpos, SEEK_SET); return updateSize(pb, pos); @@ -142,35 +142,35 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) int64_t curpos, entryPos; int i, index = 0; int64_t pos = url_ftell(pb); - put_be32(pb, 0); // size + avio_wb32(pb, 0); // size put_tag(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps"); - put_be32(pb, 0); // version & flags + avio_wb32(pb, 0); // version & flags entryPos = url_ftell(pb); - put_be32(pb, track->entry); // entry count + avio_wb32(pb, track->entry); // entry count for (i=0; ientry; i++) { if (track->cluster[i].flags & flag) { - put_be32(pb, i+1); + avio_wb32(pb, i+1); index++; } } curpos = url_ftell(pb); url_fseek(pb, entryPos, SEEK_SET); - put_be32(pb, index); // rewrite size + avio_wb32(pb, index); // rewrite size url_fseek(pb, curpos, SEEK_SET); return updateSize(pb, pos); } static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track) { - put_be32(pb, 0x11); /* size */ + avio_wb32(pb, 0x11); /* size */ if (track->mode == MODE_MOV) put_tag(pb, "samr"); else put_tag(pb, "damr"); put_tag(pb, "FFMP"); - put_byte(pb, 0); /* decoder version */ + avio_w8(pb, 0); /* decoder version */ - put_be16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */ - put_byte(pb, 0x00); /* Mode change period (no restriction) */ - put_byte(pb, 0x01); /* Frames per sample */ + avio_wb16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */ + avio_w8(pb, 0x00); /* Mode change period (no restriction) */ + avio_w8(pb, 0x01); /* Frames per sample */ return 0x11; } @@ -184,7 +184,7 @@ static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track) if (track->vosLen < 7) return -1; - put_be32(pb, 11); + avio_wb32(pb, 11); put_tag(pb, "dac3"); init_get_bits(&gbc, track->vosData+4, track->vosLen-4); @@ -213,7 +213,7 @@ static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track) put_bits(&pbc, 5, 0); // reserved flush_put_bits(&pbc); - put_buffer(pb, buf, sizeof(buf)); + avio_write(pb, buf, sizeof(buf)); return 11; } @@ -224,15 +224,15 @@ static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track) */ static int mov_write_extradata_tag(AVIOContext *pb, MOVTrack *track) { - put_buffer(pb, track->enc->extradata, track->enc->extradata_size); + avio_write(pb, track->enc->extradata, track->enc->extradata_size); return track->enc->extradata_size; } static int mov_write_enda_tag(AVIOContext *pb) { - put_be32(pb, 10); + avio_wb32(pb, 10); put_tag(pb, "enda"); - put_be16(pb, 1); /* little endian */ + avio_wb16(pb, 1); /* little endian */ return 10; } @@ -246,10 +246,10 @@ static unsigned int descrLength(unsigned int len) static void putDescr(AVIOContext *pb, int tag, unsigned int size) { int i= descrLength(size) - size - 2; - put_byte(pb, tag); + avio_w8(pb, tag); for(; i>0; i--) - put_byte(pb, (size>>(7*i)) | 0x80); - put_byte(pb, size & 0x7F); + avio_w8(pb, (size>>(7*i)) | 0x80); + avio_w8(pb, size & 0x7F); } static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic @@ -257,15 +257,15 @@ static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic int64_t pos = url_ftell(pb); int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; - put_be32(pb, 0); // size + avio_wb32(pb, 0); // size put_tag(pb, "esds"); - put_be32(pb, 0); // Version + avio_wb32(pb, 0); // Version // ES descriptor putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) + descrLength(1)); - put_be16(pb, track->trackID); - put_byte(pb, 0x00); // flags (= no flags) + avio_wb16(pb, track->trackID); + avio_w8(pb, 0x00); // flags (= no flags) // DecoderConfig descriptor putDescr(pb, 0x04, 13 + decoderSpecificInfoLen); @@ -274,35 +274,35 @@ static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic if ((track->enc->codec_id == CODEC_ID_MP2 || track->enc->codec_id == CODEC_ID_MP3) && track->enc->sample_rate > 24000) - put_byte(pb, 0x6B); // 11172-3 + avio_w8(pb, 0x6B); // 11172-3 else - put_byte(pb, ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id)); + avio_w8(pb, ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id)); // the following fields is made of 6 bits to identify the streamtype (4 for video, 5 for audio) // plus 1 bit to indicate upstream and 1 bit set to 1 (reserved) if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO) - put_byte(pb, 0x15); // flags (= Audiostream) + avio_w8(pb, 0x15); // flags (= Audiostream) else - put_byte(pb, 0x11); // flags (= Visualstream) + avio_w8(pb, 0x11); // flags (= Visualstream) - put_byte(pb, track->enc->rc_buffer_size>>(3+16)); // Buffersize DB (24 bits) - put_be16(pb, (track->enc->rc_buffer_size>>3)&0xFFFF); // Buffersize DB + avio_w8(pb, track->enc->rc_buffer_size>>(3+16)); // Buffersize DB (24 bits) + avio_wb16(pb, (track->enc->rc_buffer_size>>3)&0xFFFF); // Buffersize DB - put_be32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window) + avio_wb32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window) if(track->enc->rc_max_rate != track->enc->rc_min_rate || track->enc->rc_min_rate==0) - put_be32(pb, 0); // vbr + avio_wb32(pb, 0); // vbr else - put_be32(pb, track->enc->rc_max_rate); // avg bitrate + avio_wb32(pb, track->enc->rc_max_rate); // avg bitrate if (track->vosLen) { // DecoderSpecific info descriptor putDescr(pb, 0x05, track->vosLen); - put_buffer(pb, track->vosData, track->vosLen); + avio_write(pb, track->vosData, track->vosLen); } // SL descriptor putDescr(pb, 0x06, 1); - put_byte(pb, 0x02); + avio_w8(pb, 0x02); return updateSize(pb, pos); } @@ -317,8 +317,8 @@ static int mov_pcm_le_gt16(enum CodecID codec_id) static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); - put_le32(pb, track->tag); // store it byteswapped + avio_wb32(pb, 0); + avio_wl32(pb, track->tag); // store it byteswapped track->enc->codec_tag = av_bswap16(track->tag >> 16); ff_put_wav_header(pb, track->enc); return updateSize(pb, pos); @@ -328,18 +328,18 @@ static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "wave"); - put_be32(pb, 12); /* size */ + avio_wb32(pb, 12); /* size */ put_tag(pb, "frma"); - put_le32(pb, track->tag); + avio_wl32(pb, track->tag); if (track->enc->codec_id == CODEC_ID_AAC) { /* useless atom needed by mplayer, ipod, not needed by quicktime */ - put_be32(pb, 12); /* size */ + avio_wb32(pb, 12); /* size */ put_tag(pb, "mp4a"); - put_be32(pb, 0); + avio_wb32(pb, 0); mov_write_esds_tag(pb, track); } else if (mov_pcm_le_gt16(track->enc->codec_id)) { mov_write_enda_tag(pb); @@ -354,17 +354,17 @@ static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) mov_write_ms_tag(pb, track); } - put_be32(pb, 8); /* size */ - put_be32(pb, 0); /* null tag */ + avio_wb32(pb, 8); /* size */ + avio_wb32(pb, 0); /* null tag */ return updateSize(pb, pos); } static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track) { - put_be32(pb, track->vosLen+8); + avio_wb32(pb, track->vosLen+8); put_tag(pb, "glbl"); - put_buffer(pb, track->vosData, track->vosLen); + avio_write(pb, track->vosData, track->vosLen); return 8+track->vosLen; } @@ -415,56 +415,56 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) } } - put_be32(pb, 0); /* size */ - put_le32(pb, tag); // store it byteswapped - put_be32(pb, 0); /* Reserved */ - put_be16(pb, 0); /* Reserved */ - put_be16(pb, 1); /* Data-reference index, XXX == 1 */ + avio_wb32(pb, 0); /* size */ + avio_wl32(pb, tag); // store it byteswapped + avio_wb32(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* Reserved */ + avio_wb16(pb, 1); /* Data-reference index, XXX == 1 */ /* SoundDescription */ - put_be16(pb, version); /* Version */ - put_be16(pb, 0); /* Revision level */ - put_be32(pb, 0); /* Reserved */ + avio_wb16(pb, version); /* Version */ + avio_wb16(pb, 0); /* Revision level */ + avio_wb32(pb, 0); /* Reserved */ if (version == 2) { - put_be16(pb, 3); - put_be16(pb, 16); - put_be16(pb, 0xfffe); - put_be16(pb, 0); - put_be32(pb, 0x00010000); - put_be32(pb, 72); - put_be64(pb, av_dbl2int(track->timescale)); - put_be32(pb, track->enc->channels); - put_be32(pb, 0x7F000000); - put_be32(pb, av_get_bits_per_sample(track->enc->codec_id)); - put_be32(pb, mov_get_lpcm_flags(track->enc->codec_id)); - put_be32(pb, track->sampleSize); - put_be32(pb, track->enc->frame_size); + avio_wb16(pb, 3); + avio_wb16(pb, 16); + avio_wb16(pb, 0xfffe); + avio_wb16(pb, 0); + avio_wb32(pb, 0x00010000); + avio_wb32(pb, 72); + avio_wb64(pb, av_dbl2int(track->timescale)); + avio_wb32(pb, track->enc->channels); + avio_wb32(pb, 0x7F000000); + avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id)); + avio_wb32(pb, mov_get_lpcm_flags(track->enc->codec_id)); + avio_wb32(pb, track->sampleSize); + avio_wb32(pb, track->enc->frame_size); } else { if (track->mode == MODE_MOV) { - put_be16(pb, track->enc->channels); + avio_wb16(pb, track->enc->channels); if (track->enc->codec_id == CODEC_ID_PCM_U8 || track->enc->codec_id == CODEC_ID_PCM_S8) - put_be16(pb, 8); /* bits per sample */ + avio_wb16(pb, 8); /* bits per sample */ else - put_be16(pb, 16); - put_be16(pb, track->audio_vbr ? -2 : 0); /* compression ID */ + avio_wb16(pb, 16); + avio_wb16(pb, track->audio_vbr ? -2 : 0); /* compression ID */ } else { /* reserved for mp4/3gp */ - put_be16(pb, 2); - put_be16(pb, 16); - put_be16(pb, 0); + avio_wb16(pb, 2); + avio_wb16(pb, 16); + avio_wb16(pb, 0); } - put_be16(pb, 0); /* packet size (= 0) */ - put_be16(pb, track->timescale); /* Time scale */ - put_be16(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* packet size (= 0) */ + avio_wb16(pb, track->timescale); /* Time scale */ + avio_wb16(pb, 0); /* Reserved */ } if(version == 1) { /* SoundDescription V1 extended info */ - put_be32(pb, track->enc->frame_size); /* Samples per packet */ - put_be32(pb, track->sampleSize / track->enc->channels); /* Bytes per packet */ - put_be32(pb, track->sampleSize); /* Bytes per frame */ - put_be32(pb, 2); /* Bytes per sample */ + avio_wb32(pb, track->enc->frame_size); /* Samples per packet */ + avio_wb32(pb, track->sampleSize / track->enc->channels); /* Bytes per packet */ + avio_wb32(pb, track->sampleSize); /* Bytes per frame */ + avio_wb32(pb, 2); /* Bytes per sample */ } if(track->mode == MODE_MOV && @@ -492,26 +492,26 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_d263_tag(AVIOContext *pb) { - put_be32(pb, 0xf); /* size */ + avio_wb32(pb, 0xf); /* size */ put_tag(pb, "d263"); put_tag(pb, "FFMP"); - put_byte(pb, 0); /* decoder version */ + avio_w8(pb, 0); /* decoder version */ /* FIXME use AVCodecContext level/profile, when encoder will set values */ - put_byte(pb, 0xa); /* level */ - put_byte(pb, 0); /* profile */ + avio_w8(pb, 0xa); /* level */ + avio_w8(pb, 0); /* profile */ return 0xf; } /* TODO: No idea about these values */ static int mov_write_svq3_tag(AVIOContext *pb) { - put_be32(pb, 0x15); + avio_wb32(pb, 0x15); put_tag(pb, "SMI "); put_tag(pb, "SEQH"); - put_be32(pb, 0x5); - put_be32(pb, 0xe2c0211d); - put_be32(pb, 0xc0000000); - put_byte(pb, 0); + avio_wb32(pb, 0x5); + avio_wb32(pb, 0xe2c0211d); + avio_wb32(pb, 0xc0000000); + avio_w8(pb, 0); return 0x15; } @@ -519,7 +519,7 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); + avio_wb32(pb, 0); put_tag(pb, "avcC"); ff_isom_write_avcc(pb, track->vosData, track->vosLen); return updateSize(pb, pos); @@ -529,47 +529,47 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track) { int i; - put_be32(pb, 24); /* size */ + avio_wb32(pb, 24); /* size */ put_tag(pb, "ACLR"); put_tag(pb, "ACLR"); put_tag(pb, "0001"); - put_be32(pb, 1); /* yuv 1 / rgb 2 ? */ - put_be32(pb, 0); /* unknown */ + avio_wb32(pb, 1); /* yuv 1 / rgb 2 ? */ + avio_wb32(pb, 0); /* unknown */ - put_be32(pb, 24); /* size */ + avio_wb32(pb, 24); /* size */ put_tag(pb, "APRG"); put_tag(pb, "APRG"); put_tag(pb, "0001"); - put_be32(pb, 1); /* unknown */ - put_be32(pb, 0); /* unknown */ + avio_wb32(pb, 1); /* unknown */ + avio_wb32(pb, 0); /* unknown */ - put_be32(pb, 120); /* size */ + avio_wb32(pb, 120); /* size */ put_tag(pb, "ARES"); put_tag(pb, "ARES"); put_tag(pb, "0001"); - put_be32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */ - put_be32(pb, track->enc->width); + avio_wb32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */ + avio_wb32(pb, track->enc->width); /* values below are based on samples created with quicktime and avid codecs */ if (track->vosData[5] & 2) { // interlaced - put_be32(pb, track->enc->height/2); - put_be32(pb, 2); /* unknown */ - put_be32(pb, 0); /* unknown */ - put_be32(pb, 4); /* unknown */ + avio_wb32(pb, track->enc->height/2); + avio_wb32(pb, 2); /* unknown */ + avio_wb32(pb, 0); /* unknown */ + avio_wb32(pb, 4); /* unknown */ } else { - put_be32(pb, track->enc->height); - put_be32(pb, 1); /* unknown */ - put_be32(pb, 0); /* unknown */ + avio_wb32(pb, track->enc->height); + avio_wb32(pb, 1); /* unknown */ + avio_wb32(pb, 0); /* unknown */ if (track->enc->height == 1080) - put_be32(pb, 5); /* unknown */ + avio_wb32(pb, 5); /* unknown */ else - put_be32(pb, 6); /* unknown */ + avio_wb32(pb, 6); /* unknown */ } /* padding */ for (i = 0; i < 10; i++) - put_be64(pb, 0); + avio_wb64(pb, 0); /* extra padding for stsd needed */ - put_be32(pb, 0); + avio_wb32(pb, 0); return 0; } @@ -740,27 +740,27 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) */ static int mov_write_uuid_tag_ipod(AVIOContext *pb) { - put_be32(pb, 28); + avio_wb32(pb, 28); put_tag(pb, "uuid"); - put_be32(pb, 0x6b6840f2); - put_be32(pb, 0x5f244fc5); - put_be32(pb, 0xba39a51b); - put_be32(pb, 0xcf0323f3); - put_be32(pb, 0x0); + avio_wb32(pb, 0x6b6840f2); + avio_wb32(pb, 0x5f244fc5); + avio_wb32(pb, 0xba39a51b); + avio_wb32(pb, 0xcf0323f3); + avio_wb32(pb, 0x0); return 28; } static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_le32(pb, track->tag); // store it byteswapped - put_be32(pb, 0); /* Reserved */ - put_be16(pb, 0); /* Reserved */ - put_be16(pb, 1); /* Data-reference index */ + avio_wb32(pb, 0); /* size */ + avio_wl32(pb, track->tag); // store it byteswapped + avio_wb32(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* Reserved */ + avio_wb16(pb, 1); /* Data-reference index */ if (track->enc->extradata_size) - put_buffer(pb, track->enc->extradata, track->enc->extradata_size); + avio_write(pb, track->enc->extradata, track->enc->extradata_size); return updateSize(pb, pos); } @@ -771,10 +771,10 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) av_reduce(&sar.num, &sar.den, track->enc->sample_aspect_ratio.num, track->enc->sample_aspect_ratio.den, INT_MAX); - put_be32(pb, 16); + avio_wb32(pb, 16); put_tag(pb, "pasp"); - put_be32(pb, sar.num); - put_be32(pb, sar.den); + avio_wb32(pb, sar.num); + avio_wb32(pb, sar.den); return 16; } @@ -783,47 +783,47 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) int64_t pos = url_ftell(pb); char compressor_name[32]; - put_be32(pb, 0); /* size */ - put_le32(pb, track->tag); // store it byteswapped - put_be32(pb, 0); /* Reserved */ - put_be16(pb, 0); /* Reserved */ - put_be16(pb, 1); /* Data-reference index */ + avio_wb32(pb, 0); /* size */ + avio_wl32(pb, track->tag); // store it byteswapped + avio_wb32(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* Reserved */ + avio_wb16(pb, 1); /* Data-reference index */ - put_be16(pb, 0); /* Codec stream version */ - put_be16(pb, 0); /* Codec stream revision (=0) */ + avio_wb16(pb, 0); /* Codec stream version */ + avio_wb16(pb, 0); /* Codec stream revision (=0) */ if (track->mode == MODE_MOV) { put_tag(pb, "FFMP"); /* Vendor */ if(track->enc->codec_id == CODEC_ID_RAWVIDEO) { - put_be32(pb, 0); /* Temporal Quality */ - put_be32(pb, 0x400); /* Spatial Quality = lossless*/ + avio_wb32(pb, 0); /* Temporal Quality */ + avio_wb32(pb, 0x400); /* Spatial Quality = lossless*/ } else { - put_be32(pb, 0x200); /* Temporal Quality = normal */ - put_be32(pb, 0x200); /* Spatial Quality = normal */ + avio_wb32(pb, 0x200); /* Temporal Quality = normal */ + avio_wb32(pb, 0x200); /* Spatial Quality = normal */ } } else { - put_be32(pb, 0); /* Reserved */ - put_be32(pb, 0); /* Reserved */ - put_be32(pb, 0); /* Reserved */ + avio_wb32(pb, 0); /* Reserved */ + avio_wb32(pb, 0); /* Reserved */ + avio_wb32(pb, 0); /* Reserved */ } - put_be16(pb, track->enc->width); /* Video width */ - put_be16(pb, track->height); /* Video height */ - put_be32(pb, 0x00480000); /* Horizontal resolution 72dpi */ - put_be32(pb, 0x00480000); /* Vertical resolution 72dpi */ - put_be32(pb, 0); /* Data size (= 0) */ - put_be16(pb, 1); /* Frame count (= 1) */ + avio_wb16(pb, track->enc->width); /* Video width */ + avio_wb16(pb, track->height); /* Video height */ + avio_wb32(pb, 0x00480000); /* Horizontal resolution 72dpi */ + avio_wb32(pb, 0x00480000); /* Vertical resolution 72dpi */ + avio_wb32(pb, 0); /* Data size (= 0) */ + avio_wb16(pb, 1); /* Frame count (= 1) */ memset(compressor_name,0,32); /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name) strncpy(compressor_name,track->enc->codec->name,31); - put_byte(pb, strlen(compressor_name)); - put_buffer(pb, compressor_name, 31); + avio_w8(pb, strlen(compressor_name)); + avio_write(pb, compressor_name, 31); if (track->mode == MODE_MOV && track->enc->bits_per_coded_sample) - put_be16(pb, track->enc->bits_per_coded_sample); + avio_wb16(pb, track->enc->bits_per_coded_sample); else - put_be16(pb, 0x18); /* Reserved */ - put_be16(pb, 0xffff); /* Reserved */ + avio_wb16(pb, 0x18); /* Reserved */ + avio_wb16(pb, 0xffff); /* Reserved */ if(track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if(track->enc->codec_id == CODEC_ID_H263) @@ -851,19 +851,19 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "rtp "); - put_be32(pb, 0); /* Reserved */ - put_be16(pb, 0); /* Reserved */ - put_be16(pb, 1); /* Data-reference index */ + avio_wb32(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* Reserved */ + avio_wb16(pb, 1); /* Data-reference index */ - put_be16(pb, 1); /* Hint track version */ - put_be16(pb, 1); /* Highest compatible version */ - put_be32(pb, track->max_packet_size); /* Max packet size */ + avio_wb16(pb, 1); /* Hint track version */ + avio_wb16(pb, 1); /* Highest compatible version */ + avio_wb32(pb, track->max_packet_size); /* Max packet size */ - put_be32(pb, 12); /* size */ + avio_wb32(pb, 12); /* size */ put_tag(pb, "tims"); - put_be32(pb, track->timescale); + avio_wb32(pb, track->timescale); return updateSize(pb, pos); } @@ -871,10 +871,10 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "stsd"); - put_be32(pb, 0); /* version & flags */ - put_be32(pb, 1); /* entry count */ + avio_wb32(pb, 0); /* version & flags */ + avio_wb32(pb, 1); /* entry count */ if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) mov_write_video_tag(pb, track); else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) @@ -907,13 +907,13 @@ static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) } entries++; /* last one */ atom_size = 16 + (entries * 8); - put_be32(pb, atom_size); /* size */ + avio_wb32(pb, atom_size); /* size */ put_tag(pb, "ctts"); - put_be32(pb, 0); /* version & flags */ - put_be32(pb, entries); /* entry count */ + avio_wb32(pb, 0); /* version & flags */ + avio_wb32(pb, entries); /* entry count */ for (i=0; imode == MODE_MOV) - put_byte(pb, strlen(descr)); /* pascal string */ - put_buffer(pb, descr, strlen(descr)); /* handler description */ + avio_w8(pb, strlen(descr)); /* pascal string */ + avio_write(pb, descr, strlen(descr)); /* handler description */ if (track && track->mode != MODE_MOV) - put_byte(pb, 0); /* c string */ + avio_w8(pb, 0); /* c string */ return updateSize(pb, pos); } @@ -1096,21 +1096,21 @@ static int mov_write_hmhd_tag(AVIOContext *pb) { /* This atom must be present, but leaving the values at zero * seems harmless. */ - put_be32(pb, 28); /* size */ + avio_wb32(pb, 28); /* size */ put_tag(pb, "hmhd"); - put_be32(pb, 0); /* version, flags */ - put_be16(pb, 0); /* maxPDUsize */ - put_be16(pb, 0); /* avgPDUsize */ - put_be32(pb, 0); /* maxbitrate */ - put_be32(pb, 0); /* avgbitrate */ - put_be32(pb, 0); /* reserved */ + avio_wb32(pb, 0); /* version, flags */ + avio_wb16(pb, 0); /* maxPDUsize */ + avio_wb16(pb, 0); /* avgPDUsize */ + avio_wb32(pb, 0); /* maxbitrate */ + avio_wb32(pb, 0); /* avgbitrate */ + avio_wb32(pb, 0); /* reserved */ return 28; } static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "minf"); if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO) mov_write_vmhd_tag(pb); @@ -1133,21 +1133,21 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) { int version = track->trackDuration < INT32_MAX ? 0 : 1; - (version == 1) ? put_be32(pb, 44) : put_be32(pb, 32); /* size */ + (version == 1) ? avio_wb32(pb, 44) : avio_wb32(pb, 32); /* size */ put_tag(pb, "mdhd"); - put_byte(pb, version); - put_be24(pb, 0); /* flags */ + avio_w8(pb, version); + avio_wb24(pb, 0); /* flags */ if (version == 1) { - put_be64(pb, track->time); - put_be64(pb, track->time); + avio_wb64(pb, track->time); + avio_wb64(pb, track->time); } else { - put_be32(pb, track->time); /* creation time */ - put_be32(pb, track->time); /* modification time */ + avio_wb32(pb, track->time); /* creation time */ + avio_wb32(pb, track->time); /* modification time */ } - put_be32(pb, track->timescale); /* time scale (sample rate for audio) */ - (version == 1) ? put_be64(pb, track->trackDuration) : put_be32(pb, track->trackDuration); /* duration */ - put_be16(pb, track->language); /* language */ - put_be16(pb, 0); /* reserved (quality) */ + avio_wb32(pb, track->timescale); /* time scale (sample rate for audio) */ + (version == 1) ? avio_wb64(pb, track->trackDuration) : avio_wb32(pb, track->trackDuration); /* duration */ + avio_wb16(pb, track->language); /* language */ + avio_wb16(pb, 0); /* reserved (quality) */ if(version!=0 && track->mode == MODE_MOV){ av_log(NULL, AV_LOG_ERROR, @@ -1162,7 +1162,7 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "mdia"); mov_write_mdhd_tag(pb, track); mov_write_hdlr_tag(pb, track); @@ -1176,41 +1176,41 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) track->timescale, AV_ROUND_UP); int version = duration < INT32_MAX ? 0 : 1; - (version == 1) ? put_be32(pb, 104) : put_be32(pb, 92); /* size */ + (version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */ put_tag(pb, "tkhd"); - put_byte(pb, version); - put_be24(pb, 0xf); /* flags (track enabled) */ + avio_w8(pb, version); + avio_wb24(pb, 0xf); /* flags (track enabled) */ if (version == 1) { - put_be64(pb, track->time); - put_be64(pb, track->time); + avio_wb64(pb, track->time); + avio_wb64(pb, track->time); } else { - put_be32(pb, track->time); /* creation time */ - put_be32(pb, track->time); /* modification time */ + avio_wb32(pb, track->time); /* creation time */ + avio_wb32(pb, track->time); /* modification time */ } - put_be32(pb, track->trackID); /* track-id */ - put_be32(pb, 0); /* reserved */ - (version == 1) ? put_be64(pb, duration) : put_be32(pb, duration); + avio_wb32(pb, track->trackID); /* track-id */ + avio_wb32(pb, 0); /* reserved */ + (version == 1) ? avio_wb64(pb, duration) : avio_wb32(pb, duration); - put_be32(pb, 0); /* reserved */ - put_be32(pb, 0); /* reserved */ - put_be32(pb, 0x0); /* reserved (Layer & Alternate group) */ + avio_wb32(pb, 0); /* reserved */ + avio_wb32(pb, 0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved (Layer & Alternate group) */ /* Volume, only for audio */ if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO) - put_be16(pb, 0x0100); + avio_wb16(pb, 0x0100); else - put_be16(pb, 0); - put_be16(pb, 0); /* reserved */ + avio_wb16(pb, 0); + avio_wb16(pb, 0); /* reserved */ /* Matrix structure */ - put_be32(pb, 0x00010000); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x00010000); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x40000000); /* reserved */ + avio_wb32(pb, 0x00010000); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x00010000); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x40000000); /* reserved */ /* Track width and height, for visual only */ if(st && (track->enc->codec_type == AVMEDIA_TYPE_VIDEO || @@ -1218,12 +1218,12 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); if(!sample_aspect_ratio || track->height != track->enc->height) sample_aspect_ratio = 1; - put_be32(pb, sample_aspect_ratio * track->enc->width*0x10000); - put_be32(pb, track->height*0x10000); + avio_wb32(pb, sample_aspect_ratio * track->enc->width*0x10000); + avio_wb32(pb, track->height*0x10000); } else { - put_be32(pb, 0); - put_be32(pb, 0); + avio_wb32(pb, 0); + avio_wb32(pb, 0); } return 0x5c; } @@ -1231,48 +1231,48 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) // This box seems important for the psp playback ... without it the movie seems to hang static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track) { - put_be32(pb, 0x24); /* size */ + avio_wb32(pb, 0x24); /* size */ put_tag(pb, "edts"); - put_be32(pb, 0x1c); /* size */ + avio_wb32(pb, 0x1c); /* size */ put_tag(pb, "elst"); - put_be32(pb, 0x0); - put_be32(pb, 0x1); + avio_wb32(pb, 0x0); + avio_wb32(pb, 0x1); /* duration ... doesn't seem to effect psp */ - put_be32(pb, av_rescale_rnd(track->trackDuration, MOV_TIMESCALE, + avio_wb32(pb, av_rescale_rnd(track->trackDuration, MOV_TIMESCALE, track->timescale, AV_ROUND_UP)); - put_be32(pb, track->cluster[0].cts); /* first pts is cts since dts is 0 */ - put_be32(pb, 0x00010000); + avio_wb32(pb, track->cluster[0].cts); /* first pts is cts since dts is 0 */ + avio_wb32(pb, 0x00010000); return 0x24; } static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track) { - put_be32(pb, 20); // size + avio_wb32(pb, 20); // size put_tag(pb, "tref"); - put_be32(pb, 12); // size (subatom) - put_le32(pb, track->tref_tag); - put_be32(pb, track->tref_id); + avio_wb32(pb, 12); // size (subatom) + avio_wl32(pb, track->tref_tag); + avio_wb32(pb, track->tref_id); return 20; } // goes at the end of each track! ... Critical for PSP playback ("Incompatible data" without it) static int mov_write_uuid_tag_psp(AVIOContext *pb, MOVTrack *mov) { - put_be32(pb, 0x34); /* size ... reports as 28 in mp4box! */ + avio_wb32(pb, 0x34); /* size ... reports as 28 in mp4box! */ put_tag(pb, "uuid"); put_tag(pb, "USMT"); - put_be32(pb, 0x21d24fce); - put_be32(pb, 0xbb88695c); - put_be32(pb, 0xfac9c740); - put_be32(pb, 0x1c); // another size here! + avio_wb32(pb, 0x21d24fce); + avio_wb32(pb, 0xbb88695c); + avio_wb32(pb, 0xfac9c740); + avio_wb32(pb, 0x1c); // another size here! put_tag(pb, "MTDT"); - put_be32(pb, 0x00010012); - put_be32(pb, 0x0a); - put_be32(pb, 0x55c40000); - put_be32(pb, 0x1); - put_be32(pb, 0x0); + avio_wb32(pb, 0x00010012); + avio_wb32(pb, 0x0a); + avio_wb32(pb, 0x55c40000); + avio_wb32(pb, 0x1); + avio_wb32(pb, 0x0); return 0x34; } @@ -1285,20 +1285,20 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index) av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index); len = strlen(buf); - put_be32(pb, len + 24); + avio_wb32(pb, len + 24); put_tag (pb, "udta"); - put_be32(pb, len + 16); + avio_wb32(pb, len + 16); put_tag (pb, "hnti"); - put_be32(pb, len + 8); + avio_wb32(pb, len + 8); put_tag (pb, "sdp "); - put_buffer(pb, buf, len); + avio_write(pb, buf, len); return len + 24; } static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "trak"); mov_write_tkhd_tag(pb, track, st); if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS) @@ -1317,14 +1317,14 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) /* TODO: Not sorted out, but not necessary either */ static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov) { - put_be32(pb, 0x15); /* size */ + avio_wb32(pb, 0x15); /* size */ put_tag(pb, "iods"); - put_be32(pb, 0); /* version & flags */ - put_be16(pb, 0x1007); - put_byte(pb, 0); - put_be16(pb, 0x4fff); - put_be16(pb, 0xfffe); - put_be16(pb, 0x01ff); + avio_wb32(pb, 0); /* version & flags */ + avio_wb16(pb, 0x1007); + avio_w8(pb, 0); + avio_wb16(pb, 0x4fff); + avio_wb16(pb, 0xfffe); + avio_wb16(pb, 0x01ff); return 0x15; } #endif @@ -1349,59 +1349,59 @@ static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov) } version = maxTrackLen < UINT32_MAX ? 0 : 1; - (version == 1) ? put_be32(pb, 120) : put_be32(pb, 108); /* size */ + (version == 1) ? avio_wb32(pb, 120) : avio_wb32(pb, 108); /* size */ put_tag(pb, "mvhd"); - put_byte(pb, version); - put_be24(pb, 0); /* flags */ + avio_w8(pb, version); + avio_wb24(pb, 0); /* flags */ if (version == 1) { - put_be64(pb, mov->time); - put_be64(pb, mov->time); + avio_wb64(pb, mov->time); + avio_wb64(pb, mov->time); } else { - put_be32(pb, mov->time); /* creation time */ - put_be32(pb, mov->time); /* modification time */ + avio_wb32(pb, mov->time); /* creation time */ + avio_wb32(pb, mov->time); /* modification time */ } - put_be32(pb, MOV_TIMESCALE); - (version == 1) ? put_be64(pb, maxTrackLen) : put_be32(pb, maxTrackLen); /* duration of longest track */ + avio_wb32(pb, MOV_TIMESCALE); + (version == 1) ? avio_wb64(pb, maxTrackLen) : avio_wb32(pb, maxTrackLen); /* duration of longest track */ - put_be32(pb, 0x00010000); /* reserved (preferred rate) 1.0 = normal */ - put_be16(pb, 0x0100); /* reserved (preferred volume) 1.0 = normal */ - put_be16(pb, 0); /* reserved */ - put_be32(pb, 0); /* reserved */ - put_be32(pb, 0); /* reserved */ + avio_wb32(pb, 0x00010000); /* reserved (preferred rate) 1.0 = normal */ + avio_wb16(pb, 0x0100); /* reserved (preferred volume) 1.0 = normal */ + avio_wb16(pb, 0); /* reserved */ + avio_wb32(pb, 0); /* reserved */ + avio_wb32(pb, 0); /* reserved */ /* Matrix structure */ - put_be32(pb, 0x00010000); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x00010000); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x40000000); /* reserved */ + avio_wb32(pb, 0x00010000); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x00010000); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x40000000); /* reserved */ - put_be32(pb, 0); /* reserved (preview time) */ - put_be32(pb, 0); /* reserved (preview duration) */ - put_be32(pb, 0); /* reserved (poster time) */ - put_be32(pb, 0); /* reserved (selection time) */ - put_be32(pb, 0); /* reserved (selection duration) */ - put_be32(pb, 0); /* reserved (current time) */ - put_be32(pb, maxTrackID+1); /* Next track id */ + avio_wb32(pb, 0); /* reserved (preview time) */ + avio_wb32(pb, 0); /* reserved (preview duration) */ + avio_wb32(pb, 0); /* reserved (poster time) */ + avio_wb32(pb, 0); /* reserved (selection time) */ + avio_wb32(pb, 0); /* reserved (selection duration) */ + avio_wb32(pb, 0); /* reserved (current time) */ + avio_wb32(pb, maxTrackID+1); /* Next track id */ return 0x6c; } static int mov_write_itunes_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { - put_be32(pb, 33); /* size */ + avio_wb32(pb, 33); /* size */ put_tag(pb, "hdlr"); - put_be32(pb, 0); - put_be32(pb, 0); + avio_wb32(pb, 0); + avio_wb32(pb, 0); put_tag(pb, "mdir"); put_tag(pb, "appl"); - put_be32(pb, 0); - put_be32(pb, 0); - put_byte(pb, 0); + avio_wb32(pb, 0); + avio_wb32(pb, 0); + avio_w8(pb, 0); return 33; } @@ -1410,18 +1410,18 @@ static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang { if(long_style){ int size = 16 + strlen(data); - put_be32(pb, size); /* size */ + avio_wb32(pb, size); /* size */ put_tag(pb, "data"); - put_be32(pb, 1); - put_be32(pb, 0); - put_buffer(pb, data, strlen(data)); + avio_wb32(pb, 1); + avio_wb32(pb, 0); + avio_write(pb, data, strlen(data)); return size; }else{ if (!lang) lang = ff_mov_iso639_to_lang("und", 1); - put_be16(pb, strlen(data)); /* string length */ - put_be16(pb, lang); - put_buffer(pb, data, strlen(data)); + avio_wb16(pb, strlen(data)); /* string length */ + avio_wb16(pb, lang); + avio_write(pb, data, strlen(data)); return strlen(data) + 4; } } @@ -1430,7 +1430,7 @@ static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *v int size = 0; if (value && value[0]) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, name); mov_write_string_data_tag(pb, value, lang, long_style); size= updateSize(pb, pos); @@ -1469,16 +1469,16 @@ static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0); int size = 0, track = t ? atoi(t->value) : 0; if (track) { - put_be32(pb, 32); /* size */ + avio_wb32(pb, 32); /* size */ put_tag(pb, "trkn"); - put_be32(pb, 24); /* size */ + avio_wb32(pb, 24); /* size */ put_tag(pb, "data"); - put_be32(pb, 0); // 8 bytes empty - put_be32(pb, 0); - put_be16(pb, 0); // empty - put_be16(pb, track); // track number - put_be16(pb, 0); // total track number - put_be16(pb, 0); // empty + avio_wb32(pb, 0); // 8 bytes empty + avio_wb32(pb, 0); + avio_wb16(pb, 0); // empty + avio_wb16(pb, track); // track number + avio_wb16(pb, 0); // total track number + avio_wb16(pb, 0); // empty size = 32; } return size; @@ -1489,7 +1489,7 @@ static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "ilst"); mov_write_string_metadata(s, pb, "\251nam", "title" , 1); mov_write_string_metadata(s, pb, "\251ART", "artist" , 1); @@ -1518,9 +1518,9 @@ static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov, { int size = 0; int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "meta"); - put_be32(pb, 0); + avio_wb32(pb, 0); mov_write_itunes_hdlr_tag(pb, mov, s); mov_write_ilst_tag(pb, mov, s); size = updateSize(pb, pos); @@ -1543,9 +1543,9 @@ static int ascii_to_wc(AVIOContext *pb, const uint8_t *b) int val; while(*b){ GET_UTF8(val, *b++, return -1;) - put_be16(pb, val); + avio_wb16(pb, val); } - put_be16(pb, 0x00); + avio_wb16(pb, 0x00); return 0; } @@ -1561,17 +1561,17 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0); if (!t || !utf8len(t->value)) return 0; - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag (pb, tag); /* type */ - put_be32(pb, 0); /* version + flags */ + avio_wb32(pb, 0); /* version + flags */ if (!strcmp(tag, "yrrc")) - put_be16(pb, atoi(t->value)); + avio_wb16(pb, atoi(t->value)); else { - put_be16(pb, language_code("eng")); /* language */ - put_buffer(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ + avio_wb16(pb, language_code("eng")); /* language */ + avio_write(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ if (!strcmp(tag, "albm") && (t = av_metadata_get(s->metadata, "track", NULL, 0))) - put_byte(pb, atoi(t->value)); + avio_w8(pb, atoi(t->value)); } return updateSize(pb, pos); } @@ -1581,23 +1581,23 @@ static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s) int64_t pos = url_ftell(pb); int i, nb_chapters = FFMIN(s->nb_chapters, 255); - put_be32(pb, 0); // size + avio_wb32(pb, 0); // size put_tag (pb, "chpl"); - put_be32(pb, 0x01000000); // version + flags - put_be32(pb, 0); // unknown - put_byte(pb, nb_chapters); + avio_wb32(pb, 0x01000000); // version + flags + avio_wb32(pb, 0); // unknown + avio_w8(pb, nb_chapters); for (i = 0; i < nb_chapters; i++) { AVChapter *c = s->chapters[i]; AVMetadataTag *t; - put_be64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000})); + avio_wb64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000})); if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { int len = FFMIN(strlen(t->value), 255); - put_byte(pb, len); - put_buffer(pb, t->value, len); + avio_w8(pb, len); + avio_write(pb, t->value, len); } else - put_byte(pb, 0); + avio_w8(pb, 0); } return updateSize(pb, pos); } @@ -1646,9 +1646,9 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, mov_write_chpl_tag(pb_buf, s); if ((size = url_close_dyn_buf(pb_buf, &buf)) > 0) { - put_be32(pb, size+8); + avio_wb32(pb, size+8); put_tag(pb, "udta"); - put_buffer(pb, buf, size); + avio_write(pb, buf, size); } av_free(buf); @@ -1661,10 +1661,10 @@ static void mov_write_psp_udta_tag(AVIOContext *pb, int len = utf8len(str)+1; if(len<=0) return; - put_be16(pb, len*2+10); /* size */ - put_be32(pb, type); /* type */ - put_be16(pb, language_code(lang)); /* language */ - put_be16(pb, 0x01); /* ? */ + avio_wb16(pb, len*2+10); /* size */ + avio_wb32(pb, type); /* type */ + avio_wb16(pb, language_code(lang)); /* language */ + avio_wb16(pb, 0x01); /* ? */ ascii_to_wc(pb, str); } @@ -1675,24 +1675,24 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) if (title) { pos = url_ftell(pb); - put_be32(pb, 0); /* size placeholder*/ + avio_wb32(pb, 0); /* size placeholder*/ put_tag(pb, "uuid"); put_tag(pb, "USMT"); - put_be32(pb, 0x21d24fce); /* 96 bit UUID */ - put_be32(pb, 0xbb88695c); - put_be32(pb, 0xfac9c740); + avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */ + avio_wb32(pb, 0xbb88695c); + avio_wb32(pb, 0xfac9c740); pos2 = url_ftell(pb); - put_be32(pb, 0); /* size placeholder*/ + avio_wb32(pb, 0); /* size placeholder*/ put_tag(pb, "MTDT"); - put_be16(pb, 4); + avio_wb16(pb, 4); // ? - put_be16(pb, 0x0C); /* size */ - put_be32(pb, 0x0B); /* type */ - put_be16(pb, language_code("und")); /* language */ - put_be16(pb, 0x0); /* ? */ - put_be16(pb, 0x021C); /* data */ + avio_wb16(pb, 0x0C); /* size */ + avio_wb32(pb, 0x0B); /* type */ + avio_wb16(pb, language_code("und")); /* language */ + avio_wb16(pb, 0x0); /* ? */ + avio_wb16(pb, 0x021C); /* data */ mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04); mov_write_psp_udta_tag(pb, title->value, "eng", 0x01); @@ -1711,7 +1711,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, { int i; int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size placeholder*/ + avio_wb32(pb, 0); /* size placeholder*/ put_tag(pb, "moov"); for (i=0; inb_streams; i++) { @@ -1752,11 +1752,11 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) { - put_be32(pb, 8); // placeholder for extended size field (64 bit) + avio_wb32(pb, 8); // placeholder for extended size field (64 bit) put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free"); mov->mdat_pos = url_ftell(pb); - put_be32(pb, 0); /* size placeholder*/ + avio_wb32(pb, 0); /* size placeholder*/ put_tag(pb, "mdat"); return 0; } @@ -1778,7 +1778,7 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) has_h264 = 1; } - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ put_tag(pb, "ftyp"); if (mov->mode == MODE_3GP) { @@ -1796,7 +1796,7 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) else put_tag(pb, "qt "); - put_be32(pb, minor); + avio_wb32(pb, minor); if(mov->mode == MODE_MOV) put_tag(pb, "qt "); @@ -1827,56 +1827,56 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s) int audio_kbitrate= AudioCodec->bit_rate / 1000; int video_kbitrate= FFMIN(VideoCodec->bit_rate / 1000, 800 - audio_kbitrate); - put_be32(pb, 0x94); /* size */ + avio_wb32(pb, 0x94); /* size */ put_tag(pb, "uuid"); put_tag(pb, "PROF"); - put_be32(pb, 0x21d24fce); /* 96 bit UUID */ - put_be32(pb, 0xbb88695c); - put_be32(pb, 0xfac9c740); + avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */ + avio_wb32(pb, 0xbb88695c); + avio_wb32(pb, 0xfac9c740); - put_be32(pb, 0x0); /* ? */ - put_be32(pb, 0x3); /* 3 sections ? */ + avio_wb32(pb, 0x0); /* ? */ + avio_wb32(pb, 0x3); /* 3 sections ? */ - put_be32(pb, 0x14); /* size */ + avio_wb32(pb, 0x14); /* size */ put_tag(pb, "FPRF"); - put_be32(pb, 0x0); /* ? */ - put_be32(pb, 0x0); /* ? */ - put_be32(pb, 0x0); /* ? */ + avio_wb32(pb, 0x0); /* ? */ + avio_wb32(pb, 0x0); /* ? */ + avio_wb32(pb, 0x0); /* ? */ - put_be32(pb, 0x2c); /* size */ + avio_wb32(pb, 0x2c); /* size */ put_tag(pb, "APRF"); /* audio */ - put_be32(pb, 0x0); - put_be32(pb, 0x2); /* TrackID */ + avio_wb32(pb, 0x0); + avio_wb32(pb, 0x2); /* TrackID */ put_tag(pb, "mp4a"); - put_be32(pb, 0x20f); - put_be32(pb, 0x0); - put_be32(pb, audio_kbitrate); - put_be32(pb, audio_kbitrate); - put_be32(pb, AudioRate); - put_be32(pb, AudioCodec->channels); + avio_wb32(pb, 0x20f); + avio_wb32(pb, 0x0); + avio_wb32(pb, audio_kbitrate); + avio_wb32(pb, audio_kbitrate); + avio_wb32(pb, AudioRate); + avio_wb32(pb, AudioCodec->channels); - put_be32(pb, 0x34); /* size */ + avio_wb32(pb, 0x34); /* size */ put_tag(pb, "VPRF"); /* video */ - put_be32(pb, 0x0); - put_be32(pb, 0x1); /* TrackID */ + avio_wb32(pb, 0x0); + avio_wb32(pb, 0x1); /* TrackID */ if (VideoCodec->codec_id == CODEC_ID_H264) { put_tag(pb, "avc1"); - put_be16(pb, 0x014D); - put_be16(pb, 0x0015); + avio_wb16(pb, 0x014D); + avio_wb16(pb, 0x0015); } else { put_tag(pb, "mp4v"); - put_be16(pb, 0x0000); - put_be16(pb, 0x0103); + avio_wb16(pb, 0x0000); + avio_wb16(pb, 0x0103); } - put_be32(pb, 0x0); - put_be32(pb, video_kbitrate); - put_be32(pb, video_kbitrate); - put_be32(pb, FrameRate); - put_be32(pb, FrameRate); - put_be16(pb, VideoCodec->width); - put_be16(pb, VideoCodec->height); - put_be32(pb, 0x010001); /* ? */ + avio_wb32(pb, 0x0); + avio_wb32(pb, video_kbitrate); + avio_wb32(pb, video_kbitrate); + avio_wb32(pb, FrameRate); + avio_wb32(pb, FrameRate); + avio_wb16(pb, VideoCodec->width); + avio_wb16(pb, VideoCodec->height); + avio_wb32(pb, 0x010001); /* ? */ } static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags) @@ -1946,7 +1946,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) /* nal reformating needed */ size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size); } else { - put_buffer(pb, pkt->data, size); + avio_write(pb, pkt->data, size); } if ((enc->codec_id == CODEC_ID_DNXHD || @@ -2201,13 +2201,13 @@ static int mov_write_trailer(AVFormatContext *s) /* Write size of mdat tag */ if (mov->mdat_size+8 <= UINT32_MAX) { url_fseek(pb, mov->mdat_pos, SEEK_SET); - put_be32(pb, mov->mdat_size+8); + avio_wb32(pb, mov->mdat_size+8); } else { /* overwrite 'wide' placeholder atom */ url_fseek(pb, mov->mdat_pos - 8, SEEK_SET); - put_be32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */ + avio_wb32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */ put_tag(pb, "mdat"); - put_be64(pb, mov->mdat_size+16); + avio_wb64(pb, mov->mdat_size+16); } url_fseek(pb, moov_pos, SEEK_SET); diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index d9c1e44f05..fbc7faace6 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -251,14 +251,14 @@ static void output_immediate(const uint8_t *data, int size, int len = size; if (len > 14) len = 14; - put_byte(out, 1); /* immediate constructor */ - put_byte(out, len); /* amount of valid data */ - put_buffer(out, data, len); + avio_w8(out, 1); /* immediate constructor */ + avio_w8(out, len); /* amount of valid data */ + avio_write(out, data, len); data += len; size -= len; for (; len < 14; len++) - put_byte(out, 0); + avio_w8(out, 0); (*entries)++; } @@ -267,13 +267,13 @@ static void output_immediate(const uint8_t *data, int size, static void output_match(AVIOContext *out, int match_sample, int match_offset, int match_len, int *entries) { - put_byte(out, 2); /* sample constructor */ - put_byte(out, 0); /* track reference */ - put_be16(out, match_len); - put_be32(out, match_sample); - put_be32(out, match_offset); - put_be16(out, 1); /* bytes per block */ - put_be16(out, 1); /* samples per block */ + avio_w8(out, 2); /* sample constructor */ + avio_w8(out, 0); /* track reference */ + avio_wb16(out, match_len); + avio_wb32(out, match_sample); + avio_wb32(out, match_offset); + avio_wb16(out, 1); /* bytes per block */ + avio_wb16(out, 1); /* samples per block */ (*entries)++; } @@ -318,8 +318,8 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, count_pos = url_ftell(out); /* RTPsample header */ - put_be16(out, 0); /* packet count */ - put_be16(out, 0); /* reserved */ + avio_wb16(out, 0); /* packet count */ + avio_wb16(out, 0); /* reserved */ while (size > 4) { uint32_t packet_len = AV_RB32(data); @@ -354,12 +354,12 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, count++; /* RTPpacket header */ - put_be32(out, 0); /* relative_time */ - put_buffer(out, data, 2); /* RTP header */ - put_be16(out, seq); /* RTPsequenceseed */ - put_be16(out, 0); /* reserved + flags */ + avio_wb32(out, 0); /* relative_time */ + avio_write(out, data, 2); /* RTP header */ + avio_wb16(out, seq); /* RTPsequenceseed */ + avio_wb16(out, 0); /* reserved + flags */ entries_pos = url_ftell(out); - put_be16(out, 0); /* entry count */ + avio_wb16(out, 0); /* entry count */ data += 12; size -= 12; @@ -373,13 +373,13 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, curpos = url_ftell(out); url_fseek(out, entries_pos, SEEK_SET); - put_be16(out, entries); + avio_wb16(out, entries); url_fseek(out, curpos, SEEK_SET); } curpos = url_ftell(out); url_fseek(out, count_pos, SEEK_SET); - put_be16(out, count); + avio_wb16(out, count); url_fseek(out, curpos, SEEK_SET); return count; } diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index cdecda67c3..0635228f61 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -71,10 +71,10 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) static void id3v2_put_size(AVFormatContext *s, int size) { - put_byte(s->pb, size >> 21 & 0x7f); - put_byte(s->pb, size >> 14 & 0x7f); - put_byte(s->pb, size >> 7 & 0x7f); - put_byte(s->pb, size & 0x7f); + avio_w8(s->pb, size >> 21 & 0x7f); + avio_w8(s->pb, size >> 14 & 0x7f); + avio_w8(s->pb, size >> 7 & 0x7f); + avio_w8(s->pb, size & 0x7f); } static int string_is_ascii(const uint8_t *str) @@ -104,9 +104,9 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 (!str2 || string_is_ascii(str2))) enc = ID3v2_ENCODING_ISO8859; - put_byte(dyn_buf, enc); + avio_w8(dyn_buf, enc); if (enc == ID3v2_ENCODING_UTF16BOM) { - put_le16(dyn_buf, 0xFEFF); /* BOM */ + avio_wl16(dyn_buf, 0xFEFF); /* BOM */ put = avio_put_str16le; } else put = avio_put_str; @@ -116,10 +116,10 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 put(dyn_buf, str2); len = url_close_dyn_buf(dyn_buf, &pb); - put_be32(s->pb, tag); + avio_wb32(s->pb, tag); id3v2_put_size(s, len); - put_be16(s->pb, 0); - put_buffer(s->pb, pb, len); + avio_wb16(s->pb, 0); + avio_write(s->pb, pb, len); av_freep(&pb); return len + ID3v2_HEADER_SIZE; @@ -128,7 +128,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } @@ -139,7 +139,7 @@ static int mp3_write_trailer(struct AVFormatContext *s) /* write the id3v1 tag */ if (id3v1_create_tag(s, buf) > 0) { - put_buffer(s->pb, buf, ID3v1_TAG_SIZE); + avio_write(s->pb, buf, ID3v1_TAG_SIZE); put_flush_packet(s->pb); } return 0; @@ -206,13 +206,13 @@ static int mp3_write_header(struct AVFormatContext *s) ID3v2_ENCODING_UTF8; int64_t size_pos, cur_pos; - put_be32(s->pb, MKBETAG('I', 'D', '3', mp3->id3v2_version)); - put_byte(s->pb, 0); - put_byte(s->pb, 0); /* flags */ + avio_wb32(s->pb, MKBETAG('I', 'D', '3', mp3->id3v2_version)); + avio_w8(s->pb, 0); + avio_w8(s->pb, 0); /* flags */ /* reserve space for size */ size_pos = url_ftell(s->pb); - put_be32(s->pb, 0); + avio_wb32(s->pb, 0); ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL); if (mp3->id3v2_version == 4) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index e5ee32d276..8c5c644f42 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -493,12 +493,12 @@ static int mpeg_mux_init(AVFormatContext *ctx) static inline void put_timestamp(AVIOContext *pb, int id, int64_t timestamp) { - put_byte(pb, + avio_w8(pb, (id << 4) | (((timestamp >> 30) & 0x07) << 1) | 1); - put_be16(pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1)); - put_be16(pb, (uint16_t)((((timestamp ) & 0x7fff) << 1) | 1)); + avio_wb16(pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1)); + avio_wb16(pb, (uint16_t)((((timestamp ) & 0x7fff) << 1) | 1)); } @@ -618,16 +618,16 @@ static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_ MpegMuxContext *s = ctx->priv_data; int i; - put_be32(pb, PADDING_STREAM); - put_be16(pb, packet_bytes - 6); + avio_wb32(pb, PADDING_STREAM); + avio_wb16(pb, packet_bytes - 6); if (!s->is_mpeg2) { - put_byte(pb, 0x0f); + avio_w8(pb, 0x0f); packet_bytes -= 7; } else packet_bytes -= 6; for(i=0;ipb, buffer, size); + avio_write(ctx->pb, buffer, size); - put_be32(ctx->pb, PRIVATE_STREAM_2); - put_be16(ctx->pb, 0x03d4); // length - put_byte(ctx->pb, 0x00); // substream ID, 00=PCI + avio_wb32(ctx->pb, PRIVATE_STREAM_2); + avio_wb16(ctx->pb, 0x03d4); // length + avio_w8(ctx->pb, 0x00); // substream ID, 00=PCI for (i = 0; i < 979; i++) - put_byte(ctx->pb, 0x00); + avio_w8(ctx->pb, 0x00); - put_be32(ctx->pb, PRIVATE_STREAM_2); - put_be16(ctx->pb, 0x03fa); // length - put_byte(ctx->pb, 0x01); // substream ID, 01=DSI + avio_wb32(ctx->pb, PRIVATE_STREAM_2); + avio_wb16(ctx->pb, 0x03fa); // length + avio_w8(ctx->pb, 0x01); // substream ID, 01=DSI for (i = 0; i < 1017; i++) - put_byte(ctx->pb, 0x00); + avio_w8(ctx->pb, 0x00); memset(buffer, 0, 128); buf_ptr = buffer; @@ -734,7 +734,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, } } size = buf_ptr - buffer; - put_buffer(ctx->pb, buffer, size); + avio_write(ctx->pb, buffer, size); packet_size = s->packet_size - size; @@ -839,16 +839,16 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, nb_frames= get_nb_frames(ctx, stream, payload_size - stuffing_size); - put_be32(ctx->pb, startcode); + avio_wb32(ctx->pb, startcode); - put_be16(ctx->pb, packet_size); + avio_wb16(ctx->pb, packet_size); if (!s->is_mpeg2) for(i=0;ipb, 0xff); + avio_w8(ctx->pb, 0xff); if (s->is_mpeg2) { - put_byte(ctx->pb, 0x80); /* mpeg2 id */ + avio_w8(ctx->pb, 0x80); /* mpeg2 id */ pes_flags=0; @@ -865,8 +865,8 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, if (stream->packet_number == 0) pes_flags |= 0x01; - put_byte(ctx->pb, pes_flags); /* flags */ - put_byte(ctx->pb, header_len - 3 + stuffing_size); + avio_w8(ctx->pb, pes_flags); /* flags */ + avio_w8(ctx->pb, header_len - 3 + stuffing_size); if (pes_flags & 0x80) /*write pts*/ put_timestamp(ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts); @@ -874,13 +874,13 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, put_timestamp(ctx->pb, 0x01, dts); if (pes_flags & 0x01) { /*write pes extension*/ - put_byte(ctx->pb, 0x10); /* flags */ + avio_w8(ctx->pb, 0x10); /* flags */ /* P-STD buffer info */ if ((id & 0xe0) == AUDIO_ID) - put_be16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128); + avio_wb16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128); else - put_be16(ctx->pb, 0x6000 | stream->max_buffer_size/1024); + avio_wb16(ctx->pb, 0x6000 | stream->max_buffer_size/1024); } } else { @@ -892,38 +892,38 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, put_timestamp(ctx->pb, 0x02, pts); } } else { - put_byte(ctx->pb, 0x0f); + avio_w8(ctx->pb, 0x0f); } } if (s->is_mpeg2) { /* special stuffing byte that is always written to prevent accidental generation of start codes. */ - put_byte(ctx->pb, 0xff); + avio_w8(ctx->pb, 0xff); for(i=0;ipb, 0xff); + avio_w8(ctx->pb, 0xff); } if (startcode == PRIVATE_STREAM_1) { - put_byte(ctx->pb, id); + avio_w8(ctx->pb, id); if (id >= 0xa0) { /* LPCM (XXX: check nb_frames) */ - put_byte(ctx->pb, 7); - put_be16(ctx->pb, 4); /* skip 3 header bytes */ - put_byte(ctx->pb, stream->lpcm_header[0]); - put_byte(ctx->pb, stream->lpcm_header[1]); - put_byte(ctx->pb, stream->lpcm_header[2]); + avio_w8(ctx->pb, 7); + avio_wb16(ctx->pb, 4); /* skip 3 header bytes */ + avio_w8(ctx->pb, stream->lpcm_header[0]); + avio_w8(ctx->pb, stream->lpcm_header[1]); + avio_w8(ctx->pb, stream->lpcm_header[2]); } else if (id >= 0x40) { /* AC-3 */ - put_byte(ctx->pb, nb_frames); - put_be16(ctx->pb, trailer_size+1); + avio_w8(ctx->pb, nb_frames); + avio_wb16(ctx->pb, trailer_size+1); } } /* output data */ assert(payload_size - stuffing_size <= av_fifo_size(stream->fifo)); - av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &put_buffer); + av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &avio_write); stream->bytes_to_iframe -= payload_size - stuffing_size; }else{ payload_size= @@ -934,7 +934,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, put_padding_packet(ctx,ctx->pb, pad_packet_bytes); for(i=0;ipb, 0x00); + avio_w8(ctx->pb, 0x00); put_flush_packet(ctx->pb); @@ -961,7 +961,7 @@ static void put_vcd_padding_sector(AVFormatContext *ctx) int i; for(i=0;ipacket_size;i++) - put_byte(ctx->pb, 0); + avio_w8(ctx->pb, 0); s->vcd_padding_bytes_written += s->packet_size; @@ -1220,7 +1220,7 @@ static int mpeg_mux_end(AVFormatContext *ctx) /* End header according to MPEG1 systems standard. We do not write it as it is usually not needed by decoders and because it complicates MPEG stream concatenation. */ - //put_be32(ctx->pb, ISO_11172_END_CODE); + //avio_wb32(ctx->pb, ISO_11172_END_CODE); //put_flush_packet(ctx->pb); for(i=0;inb_streams;i++) { diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 891d469ab3..99becbcb31 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -415,7 +415,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts, static void section_write_packet(MpegTSSection *s, const uint8_t *packet) { AVFormatContext *ctx = s->opaque; - put_buffer(ctx->pb, packet, TS_PACKET_SIZE); + avio_write(ctx->pb, packet, TS_PACKET_SIZE); } static int mpegts_write_header(AVFormatContext *s) @@ -625,7 +625,7 @@ static void mpegts_insert_null_packet(AVFormatContext *s) *q++ = 0xff; *q++ = 0x10; memset(q, 0x0FF, TS_PACKET_SIZE - (q - buf)); - put_buffer(s->pb, buf, TS_PACKET_SIZE); + avio_write(s->pb, buf, TS_PACKET_SIZE); } /* Write a single transport stream packet with a PCR and no payload */ @@ -650,7 +650,7 @@ static void mpegts_insert_pcr_only(AVFormatContext *s, AVStream *st) /* stuffing bytes */ memset(q, 0xFF, TS_PACKET_SIZE - (q - buf)); - put_buffer(s->pb, buf, TS_PACKET_SIZE); + avio_write(s->pb, buf, TS_PACKET_SIZE); } static void write_pts(uint8_t *q, int fourbits, int64_t pts) @@ -844,7 +844,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, memcpy(buf + TS_PACKET_SIZE - len, payload, len); payload += len; payload_size -= len; - put_buffer(s->pb, buf, TS_PACKET_SIZE); + avio_write(s->pb, buf, TS_PACKET_SIZE); } put_flush_packet(s->pb); } diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c index 76f598598b..e98fb363e7 100644 --- a/libavformat/mpjpeg.c +++ b/libavformat/mpjpeg.c @@ -29,7 +29,7 @@ static int mpjpeg_write_header(AVFormatContext *s) uint8_t buf1[256]; snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG); - put_buffer(s->pb, buf1, strlen(buf1)); + avio_write(s->pb, buf1, strlen(buf1)); put_flush_packet(s->pb); return 0; } @@ -39,11 +39,11 @@ static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt) uint8_t buf1[256]; snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n"); - put_buffer(s->pb, buf1, strlen(buf1)); - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, buf1, strlen(buf1)); + avio_write(s->pb, pkt->data, pkt->size); snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG); - put_buffer(s->pb, buf1, strlen(buf1)); + avio_write(s->pb, buf1, strlen(buf1)); put_flush_packet(s->pb); return 0; } diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 9f2e4fe08d..9e63531388 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -307,24 +307,24 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = { static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int value) { - put_buffer(pb, uuid_base, 12); - put_be16(pb, type); - put_be16(pb, value); + avio_write(pb, uuid_base, 12); + avio_wb16(pb, type); + avio_wb16(pb, value); } static void mxf_write_umid(AVFormatContext *s, int type) { MXFContext *mxf = s->priv_data; - put_buffer(s->pb, umid_ul, 13); - put_be24(s->pb, mxf->instance_number); - put_buffer(s->pb, mxf->umid, 15); - put_byte(s->pb, type); + avio_write(s->pb, umid_ul, 13); + avio_wb24(s->pb, mxf->instance_number); + avio_write(s->pb, mxf->umid, 15); + avio_w8(s->pb, type); } static void mxf_write_refs_count(AVIOContext *pb, int ref_count) { - put_be32(pb, ref_count); - put_be32(pb, 16); + avio_wb32(pb, ref_count); + avio_wb32(pb, 16); } static int klv_ber_length(uint64_t len) @@ -341,25 +341,25 @@ static int klv_encode_ber_length(AVIOContext *pb, uint64_t len) int size; if (len < 128) { //short form - put_byte(pb, len); + avio_w8(pb, len); return 1; } size = (av_log2(len) >> 3) + 1; // long form - put_byte(pb, 0x80 + size); + avio_w8(pb, 0x80 + size); while(size) { size--; - put_byte(pb, len >> 8 * size & 0xff); + avio_w8(pb, len >> 8 * size & 0xff); } return 0; } static void klv_encode_ber4_length(AVIOContext *pb, int len) { - put_byte(pb, 0x80 + 3); - put_be24(pb, len); + avio_w8(pb, 0x80 + 3); + avio_wb24(pb, len); } /* @@ -381,28 +381,28 @@ static void mxf_write_primer_pack(AVFormatContext *s) local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch); - put_buffer(pb, primer_pack_key, 16); + avio_write(pb, primer_pack_key, 16); klv_encode_ber_length(pb, local_tag_number * 18 + 8); - put_be32(pb, local_tag_number); // local_tag num - put_be32(pb, 18); // item size, always 18 according to the specs + avio_wb32(pb, local_tag_number); // local_tag num + avio_wb32(pb, 18); // item size, always 18 according to the specs for (i = 0; i < local_tag_number; i++) { - put_be16(pb, mxf_local_tag_batch[i].local_tag); - put_buffer(pb, mxf_local_tag_batch[i].uid, 16); + avio_wb16(pb, mxf_local_tag_batch[i].local_tag); + avio_write(pb, mxf_local_tag_batch[i].uid, 16); } } static void mxf_write_local_tag(AVIOContext *pb, int size, int tag) { - put_be16(pb, tag); - put_be16(pb, size); + avio_wb16(pb, tag); + avio_wb16(pb, size); } static void mxf_write_metadata_key(AVIOContext *pb, unsigned int value) { - put_buffer(pb, header_metadata_key, 13); - put_be24(pb, value); + avio_write(pb, header_metadata_key, 13); + avio_wb24(pb, value); } static void mxf_free(AVFormatContext *s) @@ -436,7 +436,7 @@ static void mxf_write_essence_container_refs(AVFormatContext *s) av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", c->essence_container_count); for (i = 0; i < c->essence_container_count; i++) { MXFStreamContext *sc = s->streams[i]->priv_data; - put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16); + avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16); } } @@ -456,11 +456,11 @@ static void mxf_write_preface(AVFormatContext *s) // last modified date mxf_write_local_tag(pb, 8, 0x3B02); - put_be64(pb, mxf->timestamp); + avio_wb64(pb, mxf->timestamp); // write version mxf_write_local_tag(pb, 2, 0x3B05); - put_be16(pb, 258); // v1.2 + avio_wb16(pb, 258); // v1.2 // write identification_refs mxf_write_local_tag(pb, 16 + 8, 0x3B06); @@ -473,7 +473,7 @@ static void mxf_write_preface(AVFormatContext *s) // operational pattern mxf_write_local_tag(pb, 16, 0x3B09); - put_buffer(pb, op1a_ul, 16); + avio_write(pb, op1a_ul, 16); // write essence_container_refs mxf_write_local_tag(pb, 8 + 16 * mxf->essence_container_count, 0x3B0A); @@ -481,7 +481,7 @@ static void mxf_write_preface(AVFormatContext *s) // write dm_scheme_refs mxf_write_local_tag(pb, 8, 0x3B0B); - put_be64(pb, 0); + avio_wb64(pb, 0); } /* @@ -492,7 +492,7 @@ static void mxf_write_local_tag_utf16(AVIOContext *pb, int tag, const char *valu int i, size = strlen(value); mxf_write_local_tag(pb, size*2, tag); for (i = 0; i < size; i++) - put_be16(pb, value[i]); + avio_wb16(pb, value[i]); } static void mxf_write_identification(AVFormatContext *s) @@ -531,7 +531,7 @@ static void mxf_write_identification(AVFormatContext *s) // modification date mxf_write_local_tag(pb, 8, 0x3C06); - put_be64(pb, mxf->timestamp); + avio_wb64(pb, mxf->timestamp); } static void mxf_write_content_storage(AVFormatContext *s) @@ -576,22 +576,22 @@ static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSe // write track id mxf_write_local_tag(pb, 4, 0x4801); - put_be32(pb, st->index+2); + avio_wb32(pb, st->index+2); // write track number mxf_write_local_tag(pb, 4, 0x4804); if (type == MaterialPackage) - put_be32(pb, 0); // track number of material package is 0 + avio_wb32(pb, 0); // track number of material package is 0 else - put_buffer(pb, sc->track_essence_element_key + 12, 4); + avio_write(pb, sc->track_essence_element_key + 12, 4); mxf_write_local_tag(pb, 8, 0x4B01); - put_be32(pb, mxf->time_base.den); - put_be32(pb, mxf->time_base.num); + avio_wb32(pb, mxf->time_base.den); + avio_wb32(pb, mxf->time_base.num); // write origin mxf_write_local_tag(pb, 8, 0x4B02); - put_be64(pb, 0); + avio_wb64(pb, 0); // write sequence refs mxf_write_local_tag(pb, 16, 0x4803); @@ -608,15 +608,15 @@ static void mxf_write_common_fields(AVFormatContext *s, AVStream *st) // find data define uls mxf_write_local_tag(pb, 16, 0x0201); if (st == mxf->timecode_track) - put_buffer(pb, smpte_12m_timecode_track_data_ul, 16); + avio_write(pb, smpte_12m_timecode_track_data_ul, 16); else { const MXFCodecUL *data_def_ul = mxf_get_data_definition_ul(st->codec->codec_type); - put_buffer(pb, data_def_ul->uid, 16); + avio_write(pb, data_def_ul->uid, 16); } // write duration mxf_write_local_tag(pb, 8, 0x0202); - put_be64(pb, mxf->duration); + avio_wb64(pb, mxf->duration); } static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) @@ -664,15 +664,15 @@ static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum // Start Time Code mxf_write_local_tag(pb, 8, 0x1501); - put_be64(pb, mxf->timecode_start); + avio_wb64(pb, mxf->timecode_start); // Rounded Time Code Base mxf_write_local_tag(pb, 2, 0x1502); - put_be16(pb, mxf->timecode_base); + avio_wb16(pb, mxf->timecode_base); // Drop Frame mxf_write_local_tag(pb, 1, 0x1503); - put_byte(pb, mxf->timecode_drop_frame); + avio_w8(pb, mxf->timecode_drop_frame); } static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) @@ -693,22 +693,22 @@ static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enu // write start_position mxf_write_local_tag(pb, 8, 0x1201); - put_be64(pb, 0); + avio_wb64(pb, 0); // write source package uid, end of the reference mxf_write_local_tag(pb, 32, 0x1101); if (type == SourcePackage) { for (i = 0; i < 4; i++) - put_be64(pb, 0); + avio_wb64(pb, 0); } else mxf_write_umid(s, 1); // write source track id mxf_write_local_tag(pb, 4, 0x1102); if (type == SourcePackage) - put_be32(pb, 0); + avio_wb32(pb, 0); else - put_be32(pb, st->index+2); + avio_wb32(pb, st->index+2); } static void mxf_write_multi_descriptor(AVFormatContext *s) @@ -728,8 +728,8 @@ static void mxf_write_multi_descriptor(AVFormatContext *s) // write sample rate mxf_write_local_tag(pb, 8, 0x3001); - put_be32(pb, mxf->time_base.den); - put_be32(pb, mxf->time_base.num); + avio_wb32(pb, mxf->time_base.den); + avio_wb32(pb, mxf->time_base.num); // write essence container ul mxf_write_local_tag(pb, 16, 0x3004); @@ -739,7 +739,7 @@ static void mxf_write_multi_descriptor(AVFormatContext *s) MXFStreamContext *sc = s->streams[0]->priv_data; ul = mxf_essence_container_uls[sc->index].container_ul; } - put_buffer(pb, ul, 16); + avio_write(pb, ul, 16); // write sub descriptor refs mxf_write_local_tag(pb, s->nb_streams * 16 + 8, 0x3F01); @@ -754,21 +754,21 @@ static void mxf_write_generic_desc(AVFormatContext *s, AVStream *st, const UID k MXFStreamContext *sc = st->priv_data; AVIOContext *pb = s->pb; - put_buffer(pb, key, 16); + avio_write(pb, key, 16); klv_encode_ber4_length(pb, size+20+8+12+20); mxf_write_local_tag(pb, 16, 0x3C0A); mxf_write_uuid(pb, SubDescriptor, st->index); mxf_write_local_tag(pb, 4, 0x3006); - put_be32(pb, st->index+2); + avio_wb32(pb, st->index+2); mxf_write_local_tag(pb, 8, 0x3001); - put_be32(pb, mxf->time_base.den); - put_be32(pb, mxf->time_base.num); + avio_wb32(pb, mxf->time_base.den); + avio_wb32(pb, mxf->time_base.num); mxf_write_local_tag(pb, 16, 0x3004); - put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16); + avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16); } static const UID mxf_mpegvideo_descriptor_key = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00 }; @@ -788,13 +788,13 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke mxf_write_generic_desc(s, st, key, size+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20); mxf_write_local_tag(pb, 4, 0x3203); - put_be32(pb, st->codec->width); + avio_wb32(pb, st->codec->width); mxf_write_local_tag(pb, 4, 0x3202); - put_be32(pb, stored_height>>sc->interlaced); + avio_wb32(pb, stored_height>>sc->interlaced); mxf_write_local_tag(pb, 4, 0x3209); - put_be32(pb, st->codec->width); + avio_wb32(pb, st->codec->width); if (st->codec->height == 608) // PAL + VBI display_height = 576; @@ -804,19 +804,19 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke display_height = st->codec->height; mxf_write_local_tag(pb, 4, 0x3208); - put_be32(pb, display_height>>sc->interlaced); + avio_wb32(pb, display_height>>sc->interlaced); // component depth mxf_write_local_tag(pb, 4, 0x3301); - put_be32(pb, 8); + avio_wb32(pb, 8); // horizontal subsampling mxf_write_local_tag(pb, 4, 0x3302); - put_be32(pb, 2); + avio_wb32(pb, 2); // frame layout mxf_write_local_tag(pb, 1, 0x320C); - put_byte(pb, sc->interlaced); + avio_w8(pb, sc->interlaced); // video line map switch (st->codec->height) { @@ -835,18 +835,18 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke } mxf_write_local_tag(pb, 12+sc->interlaced*4, 0x320D); - put_be32(pb, sc->interlaced ? 2 : 1); - put_be32(pb, 4); - put_be32(pb, f1); + avio_wb32(pb, sc->interlaced ? 2 : 1); + avio_wb32(pb, 4); + avio_wb32(pb, f1); if (sc->interlaced) - put_be32(pb, f2); + avio_wb32(pb, f2); mxf_write_local_tag(pb, 8, 0x320E); - put_be32(pb, sc->aspect_ratio.num); - put_be32(pb, sc->aspect_ratio.den); + avio_wb32(pb, sc->aspect_ratio.num); + avio_wb32(pb, sc->aspect_ratio.den); mxf_write_local_tag(pb, 16, 0x3201); - put_buffer(pb, *sc->codec_ul, 16); + avio_write(pb, *sc->codec_ul, 16); } static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st) @@ -863,13 +863,13 @@ static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st) // bit rate mxf_write_local_tag(pb, 4, 0x8000); - put_be32(pb, st->codec->bit_rate); + avio_wb32(pb, st->codec->bit_rate); // profile and level mxf_write_local_tag(pb, 1, 0x8007); if (!st->codec->profile) profile_and_level |= 0x80; // escape bit - put_byte(pb, profile_and_level); + avio_w8(pb, profile_and_level); } static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) @@ -880,18 +880,18 @@ static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con // audio locked mxf_write_local_tag(pb, 1, 0x3D02); - put_byte(pb, 1); + avio_w8(pb, 1); // write audio sampling rate mxf_write_local_tag(pb, 8, 0x3D03); - put_be32(pb, st->codec->sample_rate); - put_be32(pb, 1); + avio_wb32(pb, st->codec->sample_rate); + avio_wb32(pb, 1); mxf_write_local_tag(pb, 4, 0x3D07); - put_be32(pb, st->codec->channels); + avio_wb32(pb, st->codec->channels); mxf_write_local_tag(pb, 4, 0x3D01); - put_be32(pb, av_get_bits_per_sample(st->codec->codec_id)); + avio_wb32(pb, av_get_bits_per_sample(st->codec->codec_id)); } static void mxf_write_wav_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) @@ -901,11 +901,11 @@ static void mxf_write_wav_common(AVFormatContext *s, AVStream *st, const UID key mxf_write_generic_sound_common(s, st, key, size+6+8); mxf_write_local_tag(pb, 2, 0x3D0A); - put_be16(pb, st->codec->block_align); + avio_wb16(pb, st->codec->block_align); // avg bytes per sec mxf_write_local_tag(pb, 4, 0x3D09); - put_be32(pb, st->codec->block_align*st->codec->sample_rate); + avio_wb32(pb, st->codec->block_align*st->codec->sample_rate); } static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st) @@ -952,11 +952,11 @@ static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type) // package creation date mxf_write_local_tag(pb, 8, 0x4405); - put_be64(pb, mxf->timestamp); + avio_wb64(pb, mxf->timestamp); // package modified date mxf_write_local_tag(pb, 8, 0x4404); - put_be64(pb, mxf->timestamp); + avio_wb64(pb, mxf->timestamp); // write track refs mxf_write_local_tag(pb, track_count*16 + 8, 0x4403); @@ -1008,10 +1008,10 @@ static int mxf_write_essence_container_data(AVFormatContext *s) mxf_write_umid(s, 1); mxf_write_local_tag(pb, 4, 0x3F07); // BodySID - put_be32(pb, 1); + avio_wb32(pb, 1); mxf_write_local_tag(pb, 4, 0x3F06); // IndexSID - put_be32(pb, 2); + avio_wb32(pb, 2); return 0; } @@ -1048,7 +1048,7 @@ static void mxf_write_index_table_segment(AVFormatContext *s) if (!mxf->edit_units_count && !mxf->edit_unit_byte_count) return; - put_buffer(pb, index_table_segment_key, 16); + avio_write(pb, index_table_segment_key, 16); if (mxf->edit_unit_byte_count) { klv_encode_ber_length(pb, 80); @@ -1063,65 +1063,65 @@ static void mxf_write_index_table_segment(AVFormatContext *s) // index edit rate mxf_write_local_tag(pb, 8, 0x3F0B); - put_be32(pb, mxf->time_base.den); - put_be32(pb, mxf->time_base.num); + avio_wb32(pb, mxf->time_base.den); + avio_wb32(pb, mxf->time_base.num); // index start position mxf_write_local_tag(pb, 8, 0x3F0C); - put_be64(pb, mxf->last_indexed_edit_unit); + avio_wb64(pb, mxf->last_indexed_edit_unit); // index duration mxf_write_local_tag(pb, 8, 0x3F0D); if (mxf->edit_unit_byte_count) - put_be64(pb, 0); // index table covers whole container + avio_wb64(pb, 0); // index table covers whole container else - put_be64(pb, mxf->edit_units_count); + avio_wb64(pb, mxf->edit_units_count); // edit unit byte count mxf_write_local_tag(pb, 4, 0x3F05); - put_be32(pb, mxf->edit_unit_byte_count); + avio_wb32(pb, mxf->edit_unit_byte_count); // index sid mxf_write_local_tag(pb, 4, 0x3F06); - put_be32(pb, 2); + avio_wb32(pb, 2); // body sid mxf_write_local_tag(pb, 4, 0x3F07); - put_be32(pb, 1); + avio_wb32(pb, 1); if (!mxf->edit_unit_byte_count) { // real slice count - 1 mxf_write_local_tag(pb, 1, 0x3F08); - put_byte(pb, mxf->slice_count); + avio_w8(pb, mxf->slice_count); // delta entry array mxf_write_local_tag(pb, 8 + (s->nb_streams+1)*6, 0x3F09); - put_be32(pb, s->nb_streams+1); // num of entries - put_be32(pb, 6); // size of one entry + avio_wb32(pb, s->nb_streams+1); // num of entries + avio_wb32(pb, 6); // size of one entry // write system item delta entry - put_byte(pb, 0); - put_byte(pb, 0); // slice entry - put_be32(pb, 0); // element delta + avio_w8(pb, 0); + avio_w8(pb, 0); // slice entry + avio_wb32(pb, 0); // element delta for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MXFStreamContext *sc = st->priv_data; - put_byte(pb, sc->temporal_reordering); + avio_w8(pb, sc->temporal_reordering); if (sc->temporal_reordering) temporal_reordering = 1; if (i == 0) { // video track - put_byte(pb, 0); // slice number - put_be32(pb, KAG_SIZE); // system item size including klv fill + avio_w8(pb, 0); // slice number + avio_wb32(pb, KAG_SIZE); // system item size including klv fill } else { // audio track unsigned audio_frame_size = sc->aic.samples[0]*sc->aic.sample_size; audio_frame_size += klv_fill_size(audio_frame_size); - put_byte(pb, 1); - put_be32(pb, (i-1)*audio_frame_size); // element delta + avio_w8(pb, 1); + avio_wb32(pb, (i-1)*audio_frame_size); // element delta } } mxf_write_local_tag(pb, 8 + mxf->edit_units_count*(11+mxf->slice_count*4), 0x3F0A); - put_be32(pb, mxf->edit_units_count); // num of entries - put_be32(pb, 11+mxf->slice_count*4); // size of one entry + avio_wb32(pb, mxf->edit_units_count); // num of entries + avio_wb32(pb, 11+mxf->slice_count*4); // size of one entry for (i = 0; i < mxf->edit_units_count; i++) { int temporal_offset = 0; @@ -1143,12 +1143,12 @@ static void mxf_write_index_table_segment(AVFormatContext *s) temporal_offset = j - key_index - pic_num_in_gop; } } - put_byte(pb, temporal_offset); + avio_w8(pb, temporal_offset); if ((mxf->index_entries[i].flags & 0x30) == 0x30) { // back and forward prediction - put_byte(pb, mxf->last_key_index - i); + avio_w8(pb, mxf->last_key_index - i); } else { - put_byte(pb, key_index - i); // key frame offset + avio_w8(pb, key_index - i); // key frame offset if ((mxf->index_entries[i].flags & 0x20) == 0x20) // only forward mxf->last_key_index = key_index; } @@ -1156,11 +1156,11 @@ static void mxf_write_index_table_segment(AVFormatContext *s) if (!(mxf->index_entries[i].flags & 0x33) && // I frame mxf->index_entries[i].flags & 0x40 && !temporal_offset) mxf->index_entries[i].flags |= 0x80; // random access - put_byte(pb, mxf->index_entries[i].flags); + avio_w8(pb, mxf->index_entries[i].flags); // stream offset - put_be64(pb, mxf->index_entries[i].offset); + avio_wb64(pb, mxf->index_entries[i].offset); if (s->nb_streams > 1) - put_be32(pb, mxf->index_entries[i].slice_offset); + avio_wb32(pb, mxf->index_entries[i].slice_offset); } mxf->last_key_index = key_index - mxf->edit_units_count; @@ -1173,11 +1173,11 @@ static void mxf_write_klv_fill(AVFormatContext *s) { unsigned pad = klv_fill_size(url_ftell(s->pb)); if (pad) { - put_buffer(s->pb, klv_fill_key, 16); + avio_write(s->pb, klv_fill_key, 16); pad -= 16 + 4; klv_encode_ber4_length(s->pb, pad); for (; pad; pad--) - put_byte(s->pb, 0); + avio_w8(s->pb, 0); assert(!(url_ftell(s->pb) & (KAG_SIZE-1))); } } @@ -1213,43 +1213,43 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, } // write klv - put_buffer(pb, key, 16); + avio_write(pb, key, 16); klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count); // write partition value - put_be16(pb, 1); // majorVersion - put_be16(pb, 2); // minorVersion - put_be32(pb, KAG_SIZE); // KAGSize + avio_wb16(pb, 1); // majorVersion + avio_wb16(pb, 2); // minorVersion + avio_wb32(pb, KAG_SIZE); // KAGSize - put_be64(pb, partition_offset); // ThisPartition + avio_wb64(pb, partition_offset); // ThisPartition if (!memcmp(key, body_partition_key, 16) && mxf->body_partitions_count > 1) - put_be64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition + avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition else if (!memcmp(key, footer_partition_key, 16) && mxf->body_partitions_count) - put_be64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition + avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition else - put_be64(pb, 0); + avio_wb64(pb, 0); - put_be64(pb, mxf->footer_partition_offset); // footerPartition + avio_wb64(pb, mxf->footer_partition_offset); // footerPartition // set offset header_byte_count_offset = url_ftell(pb); - put_be64(pb, 0); // headerByteCount, update later + avio_wb64(pb, 0); // headerByteCount, update later // indexTable - put_be64(pb, index_byte_count); // indexByteCount - put_be32(pb, index_byte_count ? indexsid : 0); // indexSID + avio_wb64(pb, index_byte_count); // indexByteCount + avio_wb32(pb, index_byte_count ? indexsid : 0); // indexSID // BodyOffset if (bodysid && mxf->edit_units_count && mxf->body_partitions_count) { - put_be64(pb, mxf->body_offset); + avio_wb64(pb, mxf->body_offset); } else - put_be64(pb, 0); + avio_wb64(pb, 0); - put_be32(pb, bodysid); // bodySID + avio_wb32(pb, bodysid); // bodySID // operational pattern - put_buffer(pb, op1a_ul, 16); + avio_write(pb, op1a_ul, 16); // essence container mxf_write_essence_container_refs(s); @@ -1268,7 +1268,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, // update header_byte_count url_fseek(pb, header_byte_count_offset, SEEK_SET); - put_be64(pb, header_byte_count); + avio_wb64(pb, header_byte_count); url_fseek(pb, pos, SEEK_SET); } @@ -1564,34 +1564,34 @@ static void mxf_write_system_item(AVFormatContext *s) frame = mxf->timecode_start + mxf->last_indexed_edit_unit + mxf->edit_units_count; // write system metadata pack - put_buffer(pb, system_metadata_pack_key, 16); + avio_write(pb, system_metadata_pack_key, 16); klv_encode_ber4_length(pb, 57); - put_byte(pb, 0x5c); // UL, user date/time stamp, picture and sound item present - put_byte(pb, 0x04); // content package rate - put_byte(pb, 0x00); // content package type - put_be16(pb, 0x00); // channel handle - put_be16(pb, frame); // continuity count + avio_w8(pb, 0x5c); // UL, user date/time stamp, picture and sound item present + avio_w8(pb, 0x04); // content package rate + avio_w8(pb, 0x00); // content package type + avio_wb16(pb, 0x00); // channel handle + avio_wb16(pb, frame); // continuity count if (mxf->essence_container_count > 1) - put_buffer(pb, multiple_desc_ul, 16); + avio_write(pb, multiple_desc_ul, 16); else { MXFStreamContext *sc = s->streams[0]->priv_data; - put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16); + avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16); } - put_byte(pb, 0); - put_be64(pb, 0); - put_be64(pb, 0); // creation date/time stamp + avio_w8(pb, 0); + avio_wb64(pb, 0); + avio_wb64(pb, 0); // creation date/time stamp - put_byte(pb, 0x81); // SMPTE 12M time code + avio_w8(pb, 0x81); // SMPTE 12M time code time_code = ff_framenum_to_12m_time_code(frame, mxf->timecode_drop_frame, mxf->timecode_base); - put_be32(pb, time_code); - put_be32(pb, 0); // binary group data - put_be64(pb, 0); + avio_wb32(pb, time_code); + avio_wb32(pb, 0); // binary group data + avio_wb64(pb, 0); // write system metadata package set - put_buffer(pb, system_metadata_package_set_key, 16); + avio_write(pb, system_metadata_package_set_key, 16); klv_encode_ber4_length(pb, 35); - put_byte(pb, 0x83); // UMID - put_be16(pb, 0x20); + avio_w8(pb, 0x83); // UMID + avio_wb16(pb, 0x20); mxf_write_umid(s, 1); } @@ -1607,21 +1607,21 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke packet_size += klv_fill_size(packet_size); klv_encode_ber4_length(pb, pkt->size); - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); // ensure CBR muxing by padding to correct video frame size pad = packet_size - pkt->size - 16 - 4; if (pad > 20) { - put_buffer(s->pb, klv_fill_key, 16); + avio_write(s->pb, klv_fill_key, 16); pad -= 16 + 4; klv_encode_ber4_length(s->pb, pad); for (; pad; pad--) - put_byte(s->pb, 0); + avio_w8(s->pb, 0); assert(!(url_ftell(s->pb) & (KAG_SIZE-1))); } else { av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n"); for (; pad > 0; pad--) - put_byte(s->pb, 0); + avio_w8(s->pb, 0); } } @@ -1636,9 +1636,9 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke klv_encode_ber4_length(pb, 4 + frame_size*4*8); - put_byte(pb, (frame_size == 1920 ? 0 : (mxf->edit_units_count-1) % 5 + 1)); - put_le16(pb, frame_size); - put_byte(pb, (1<codec->channels)-1); + avio_w8(pb, (frame_size == 1920 ? 0 : (mxf->edit_units_count-1) % 5 + 1)); + avio_wl16(pb, frame_size); + avio_w8(pb, (1<codec->channels)-1); while (samples < end) { for (i = 0; i < st->codec->channels; i++) { @@ -1650,10 +1650,10 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke sample = AV_RL16(samples)<<12; samples += 2; } - put_le32(pb, sample | i); + avio_wl32(pb, sample | i); } for (; i < 8; i++) - put_le32(pb, i); + avio_wl32(pb, i); } } @@ -1719,7 +1719,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) } mxf_write_klv_fill(s); - put_buffer(pb, sc->track_essence_element_key, 16); // write key + avio_write(pb, sc->track_essence_element_key, 16); // write key if (s->oformat == &ff_mxf_d10_muxer) { if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) mxf_write_d10_video_packet(s, st, pkt); @@ -1727,7 +1727,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) mxf_write_d10_audio_packet(s, st, pkt); } else { klv_encode_ber4_length(pb, pkt->size); // write length - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); mxf->body_offset += 16+4+pkt->size + klv_fill_size(16+4+pkt->size); } @@ -1743,24 +1743,24 @@ static void mxf_write_random_index_pack(AVFormatContext *s) uint64_t pos = url_ftell(pb); int i; - put_buffer(pb, random_index_pack_key, 16); + avio_write(pb, random_index_pack_key, 16); klv_encode_ber_length(pb, 28 + 12*mxf->body_partitions_count); if (mxf->edit_unit_byte_count) - put_be32(pb, 1); // BodySID of header partition + avio_wb32(pb, 1); // BodySID of header partition else - put_be32(pb, 0); - put_be64(pb, 0); // offset of header partition + avio_wb32(pb, 0); + avio_wb64(pb, 0); // offset of header partition for (i = 0; i < mxf->body_partitions_count; i++) { - put_be32(pb, 1); // BodySID - put_be64(pb, mxf->body_partition_offset[i]); + avio_wb32(pb, 1); // BodySID + avio_wb64(pb, mxf->body_partition_offset[i]); } - put_be32(pb, 0); // BodySID of footer partition - put_be64(pb, mxf->footer_partition_offset); + avio_wb32(pb, 0); // BodySID of footer partition + avio_wb64(pb, mxf->footer_partition_offset); - put_be32(pb, url_ftell(pb) - pos + 4); + avio_wb32(pb, url_ftell(pb) - pos + 4); } static int mxf_write_footer(AVFormatContext *s) diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index ce7d6522a9..078ffac0ba 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -254,7 +254,7 @@ static void put_str(AVIOContext *bc, const char *string){ int len= strlen(string); ff_put_v(bc, len); - put_buffer(bc, string, len); + avio_write(bc, string, len); } static void put_s(AVIOContext *bc, int64_t val){ @@ -285,16 +285,16 @@ static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, in if(forw_ptr > 4096) init_checksum(bc, ff_crc04C11DB7_update, 0); - put_be64(bc, startcode); + avio_wb64(bc, startcode); ff_put_v(bc, forw_ptr); if(forw_ptr > 4096) - put_le32(bc, get_checksum(bc)); + avio_wl32(bc, get_checksum(bc)); if(calculate_checksum) init_checksum(bc, ff_crc04C11DB7_update, 0); - put_buffer(bc, dyn_buf, dyn_size); + avio_write(bc, dyn_buf, dyn_size); if(calculate_checksum) - put_le32(bc, get_checksum(bc)); + avio_wl32(bc, get_checksum(bc)); av_free(dyn_buf); } @@ -366,7 +366,7 @@ static void write_mainheader(NUTContext *nut, AVIOContext *bc){ ff_put_v(bc, nut->header_count-1); for(i=1; iheader_count; i++){ ff_put_v(bc, nut->header_len[i]); - put_buffer(bc, nut->header[i], nut->header_len[i]); + avio_write(bc, nut->header[i], nut->header_len[i]); } } @@ -382,7 +382,7 @@ static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream } ff_put_v(bc, 4); if (codec->codec_tag){ - put_le32(bc, codec->codec_tag); + avio_wl32(bc, codec->codec_tag); } else { av_log(avctx, AV_LOG_ERROR, "No codec tag defined for stream %d\n", i); return AVERROR(EINVAL); @@ -392,10 +392,10 @@ static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream ff_put_v(bc, nut->stream[i].msb_pts_shift); ff_put_v(bc, nut->stream[i].max_pts_distance); ff_put_v(bc, codec->has_b_frames); - put_byte(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */ + avio_w8(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */ ff_put_v(bc, codec->extradata_size); - put_buffer(bc, codec->extradata, codec->extradata_size); + avio_write(bc, codec->extradata, codec->extradata_size); switch(codec->codec_type){ case AVMEDIA_TYPE_AUDIO: @@ -450,7 +450,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){ ff_put_v(bc, count); dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); - put_buffer(bc, dyn_buf, dyn_size); + avio_write(bc, dyn_buf, dyn_size); av_free(dyn_buf); return 0; } @@ -479,7 +479,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){ ff_put_v(bc, count); - put_buffer(bc, dyn_buf, dyn_size); + avio_write(bc, dyn_buf, dyn_size); } av_free(dyn_buf); @@ -575,8 +575,8 @@ static int write_header(AVFormatContext *s){ build_frame_code(s); assert(nut->frame_code['N'].flags == FLAG_INVALID); - put_buffer(bc, ID_STRING, strlen(ID_STRING)); - put_byte(bc, 0); + avio_write(bc, ID_STRING, strlen(ID_STRING)); + avio_w8(bc, 0); if ((ret = write_headers(s, bc)) < 0) return ret; @@ -749,7 +749,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ header_idx= fc->header_idx; init_checksum(bc, ff_crc04C11DB7_update, 0); - put_byte(bc, frame_code); + avio_w8(bc, frame_code); if(flags & FLAG_CODED){ ff_put_v(bc, (flags^needed_flags) & ~(FLAG_CODED)); flags = needed_flags; @@ -759,10 +759,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ if(flags & FLAG_SIZE_MSB) ff_put_v(bc, pkt->size / fc->size_mul); if(flags & FLAG_HEADER_IDX) ff_put_v(bc, header_idx= best_header_idx); - if(flags & FLAG_CHECKSUM) put_le32(bc, get_checksum(bc)); + if(flags & FLAG_CHECKSUM) avio_wl32(bc, get_checksum(bc)); else get_checksum(bc); - put_buffer(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]); + avio_write(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]); nus->last_flags= flags; nus->last_pts= pkt->pts; diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 79e4a8aa90..533f89e7b8 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -69,7 +69,7 @@ static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc int64_t pos = url_ftell(pb); uint32_t checksum = get_checksum(pb); url_fseek(pb, crc_offset, SEEK_SET); - put_be32(pb, checksum); + avio_wb32(pb, checksum); url_fseek(pb, pos, SEEK_SET); } @@ -86,16 +86,16 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) return ret; init_checksum(pb, ff_crc04C11DB7_update, 0); put_tag(pb, "OggS"); - put_byte(pb, 0); - put_byte(pb, page->flags | extra_flags); - put_le64(pb, page->granule); - put_le32(pb, oggstream->serial_num); - put_le32(pb, oggstream->page_counter++); + avio_w8(pb, 0); + avio_w8(pb, page->flags | extra_flags); + avio_wl64(pb, page->granule); + avio_wl32(pb, oggstream->serial_num); + avio_wl32(pb, oggstream->page_counter++); crc_offset = url_ftell(pb); - put_le32(pb, 0); // crc - put_byte(pb, page->segments_count); - put_buffer(pb, page->segments, page->segments_count); - put_buffer(pb, page->data, page->size); + avio_wl32(pb, 0); // crc + avio_w8(pb, page->segments_count); + avio_write(pb, page->segments, page->segments_count); + avio_write(pb, page->data, page->size); ogg_update_checksum(s, pb, crc_offset); put_flush_packet(pb); @@ -104,7 +104,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) if (size < 0) return size; - put_buffer(s->pb, buf, size); + avio_write(s->pb, buf, size); put_flush_packet(s->pb); av_free(buf); oggstream->page_count--; diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index 6f9fdce4a1..20ddfd5609 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -25,7 +25,7 @@ int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } diff --git a/libavformat/riff.c b/libavformat/riff.c index 7111487f8c..4cbc2b7f0a 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -322,7 +322,7 @@ const AVCodecTag ff_codec_wav_tags[] = { int64_t ff_start_tag(AVIOContext *pb, const char *tag) { put_tag(pb, tag); - put_le32(pb, 0); + avio_wl32(pb, 0); return url_ftell(pb); } @@ -332,7 +332,7 @@ void ff_end_tag(AVIOContext *pb, int64_t start) pos = url_ftell(pb); url_fseek(pb, start - 4, SEEK_SET); - put_le32(pb, (uint32_t)(pos - start)); + avio_wl32(pb, (uint32_t)(pos - start)); url_fseek(pb, pos, SEEK_SET); } @@ -354,12 +354,12 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) || av_get_bits_per_sample(enc->codec_id) > 16; if (waveformatextensible) { - put_le16(pb, 0xfffe); + avio_wl16(pb, 0xfffe); } else { - put_le16(pb, enc->codec_tag); + avio_wl16(pb, enc->codec_tag); } - put_le16(pb, enc->channels); - put_le32(pb, enc->sample_rate); + avio_wl16(pb, enc->channels); + avio_wl32(pb, enc->sample_rate); if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) { bps = 0; } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { @@ -393,9 +393,9 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) } else { bytespersec = enc->bit_rate / 8; } - put_le32(pb, bytespersec); /* bytes per second */ - put_le16(pb, blkalign); /* block align */ - put_le16(pb, bps); /* bits per sample */ + avio_wl32(pb, bytespersec); /* bytes per second */ + avio_wl16(pb, blkalign); /* block align */ + avio_wl16(pb, bps); /* bits per sample */ if (enc->codec_id == CODEC_ID_MP3) { hdrsize += 12; bytestream_put_le16(&riff_extradata, 1); /* wID */ @@ -425,20 +425,20 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) } if(waveformatextensible) { /* write WAVEFORMATEXTENSIBLE extensions */ hdrsize += 22; - put_le16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */ - put_le16(pb, enc->bits_per_coded_sample); /* ValidBitsPerSample || SamplesPerBlock || Reserved */ - put_le32(pb, enc->channel_layout); /* dwChannelMask */ - put_le32(pb, enc->codec_tag); /* GUID + next 3 */ - put_le32(pb, 0x00100000); - put_le32(pb, 0xAA000080); - put_le32(pb, 0x719B3800); + avio_wl16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */ + avio_wl16(pb, enc->bits_per_coded_sample); /* ValidBitsPerSample || SamplesPerBlock || Reserved */ + avio_wl32(pb, enc->channel_layout); /* dwChannelMask */ + avio_wl32(pb, enc->codec_tag); /* GUID + next 3 */ + avio_wl32(pb, 0x00100000); + avio_wl32(pb, 0xAA000080); + avio_wl32(pb, 0x719B3800); } else if(riff_extradata - riff_extradata_start) { - put_le16(pb, riff_extradata - riff_extradata_start); + avio_wl16(pb, riff_extradata - riff_extradata_start); } - put_buffer(pb, riff_extradata_start, riff_extradata - riff_extradata_start); + avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start); if(hdrsize&1){ hdrsize++; - put_byte(pb, 0); + avio_w8(pb, 0); } return hdrsize; @@ -447,25 +447,25 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) /* BITMAPINFOHEADER header */ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf) { - put_le32(pb, 40 + enc->extradata_size); /* size */ - put_le32(pb, enc->width); + avio_wl32(pb, 40 + enc->extradata_size); /* size */ + avio_wl32(pb, enc->width); //We always store RGB TopDown - put_le32(pb, enc->codec_tag ? enc->height : -enc->height); - put_le16(pb, 1); /* planes */ + avio_wl32(pb, enc->codec_tag ? enc->height : -enc->height); + avio_wl16(pb, 1); /* planes */ - put_le16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */ + avio_wl16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */ /* compression type */ - put_le32(pb, enc->codec_tag); - put_le32(pb, enc->width * enc->height * 3); - put_le32(pb, 0); - put_le32(pb, 0); - put_le32(pb, 0); - put_le32(pb, 0); + avio_wl32(pb, enc->codec_tag); + avio_wl32(pb, enc->width * enc->height * 3); + avio_wl32(pb, 0); + avio_wl32(pb, 0); + avio_wl32(pb, 0); + avio_wl32(pb, 0); - put_buffer(pb, enc->extradata, enc->extradata_size); + avio_write(pb, enc->extradata, enc->extradata_size); if (!for_asf && enc->extradata_size & 1) - put_byte(pb, 0); + avio_w8(pb, 0); } #endif //CONFIG_MUXERS diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index b60b8a20eb..6ba152e45c 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -46,17 +46,17 @@ typedef struct { static void put_str(AVIOContext *s, const char *tag) { - put_be16(s,strlen(tag)); + avio_wb16(s,strlen(tag)); while (*tag) { - put_byte(s, *tag++); + avio_w8(s, *tag++); } } static void put_str8(AVIOContext *s, const char *tag) { - put_byte(s, strlen(tag)); + avio_w8(s, strlen(tag)); while (*tag) { - put_byte(s, *tag++); + avio_w8(s, *tag++); } } @@ -75,14 +75,14 @@ static int rv10_write_header(AVFormatContext *ctx, start_ptr = s->buf_ptr; put_tag(s, ".RMF"); - put_be32(s,18); /* header size */ - put_be16(s,0); - put_be32(s,0); - put_be32(s,4 + ctx->nb_streams); /* num headers */ + avio_wb32(s,18); /* header size */ + avio_wb16(s,0); + avio_wb32(s,0); + avio_wb32(s,4 + ctx->nb_streams); /* num headers */ put_tag(s,"PROP"); - put_be32(s, 50); - put_be16(s, 0); + avio_wb32(s, 50); + avio_wb16(s, 0); packet_max_size = 0; packet_total_size = 0; nb_packets = 0; @@ -100,26 +100,26 @@ static int rv10_write_header(AVFormatContext *ctx, if (v > duration) duration = v; } - put_be32(s, bit_rate); /* max bit rate */ - put_be32(s, bit_rate); /* avg bit rate */ - put_be32(s, packet_max_size); /* max packet size */ + avio_wb32(s, bit_rate); /* max bit rate */ + avio_wb32(s, bit_rate); /* avg bit rate */ + avio_wb32(s, packet_max_size); /* max packet size */ if (nb_packets > 0) packet_avg_size = packet_total_size / nb_packets; else packet_avg_size = 0; - put_be32(s, packet_avg_size); /* avg packet size */ - put_be32(s, nb_packets); /* num packets */ - put_be32(s, duration); /* duration */ - put_be32(s, BUFFER_DURATION); /* preroll */ - put_be32(s, index_pos); /* index offset */ + avio_wb32(s, packet_avg_size); /* avg packet size */ + avio_wb32(s, nb_packets); /* num packets */ + avio_wb32(s, duration); /* duration */ + avio_wb32(s, BUFFER_DURATION); /* preroll */ + avio_wb32(s, index_pos); /* index offset */ /* computation of data the data offset */ data_offset_ptr = s->buf_ptr; - put_be32(s, 0); /* data offset : will be patched after */ - put_be16(s, ctx->nb_streams); /* num streams */ + avio_wb32(s, 0); /* data offset : will be patched after */ + avio_wb16(s, ctx->nb_streams); /* num streams */ flags = 1 | 2; /* save allowed & perfect play */ if (url_is_streamed(s)) flags |= 4; /* live broadcast */ - put_be16(s, flags); + avio_wb16(s, flags); /* comments */ @@ -129,8 +129,8 @@ static int rv10_write_header(AVFormatContext *ctx, tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); if(tag) size += strlen(tag->value); } - put_be32(s,size); - put_be16(s,0); + avio_wb32(s,size); + avio_wb16(s,0); for(i=0; imetadata, ff_rm_metadata[i], NULL, 0); put_str(s, tag ? tag->value : ""); @@ -153,29 +153,29 @@ static int rv10_write_header(AVFormatContext *ctx, put_tag(s,"MDPR"); size = 10 + 9 * 4 + strlen(desc) + strlen(mimetype) + codec_data_size; - put_be32(s, size); - put_be16(s, 0); + avio_wb32(s, size); + avio_wb16(s, 0); - put_be16(s, i); /* stream number */ - put_be32(s, stream->bit_rate); /* max bit rate */ - put_be32(s, stream->bit_rate); /* avg bit rate */ - put_be32(s, stream->packet_max_size); /* max packet size */ + avio_wb16(s, i); /* stream number */ + avio_wb32(s, stream->bit_rate); /* max bit rate */ + avio_wb32(s, stream->bit_rate); /* avg bit rate */ + avio_wb32(s, stream->packet_max_size); /* max packet size */ if (stream->nb_packets > 0) packet_avg_size = stream->packet_total_size / stream->nb_packets; else packet_avg_size = 0; - put_be32(s, packet_avg_size); /* avg packet size */ - put_be32(s, 0); /* start time */ - put_be32(s, BUFFER_DURATION); /* preroll */ + avio_wb32(s, packet_avg_size); /* avg packet size */ + avio_wb32(s, 0); /* start time */ + avio_wb32(s, BUFFER_DURATION); /* preroll */ /* duration */ if (url_is_streamed(s) || !stream->total_frames) - put_be32(s, (int)(3600 * 1000)); + avio_wb32(s, (int)(3600 * 1000)); else - put_be32(s, (int)(stream->total_frames * 1000 / stream->frame_rate)); + avio_wb32(s, (int)(stream->total_frames * 1000 / stream->frame_rate)); put_str8(s, desc); put_str8(s, mimetype); - put_be32(s, codec_data_size); + avio_wb32(s, codec_data_size); if (stream->enc->codec_type == AVMEDIA_TYPE_AUDIO) { int coded_frame_size, fscode, sample_rate; @@ -184,12 +184,12 @@ static int rv10_write_header(AVFormatContext *ctx, stream->enc->frame_size) / (8 * sample_rate); /* audio codec info */ put_tag(s, ".ra"); - put_byte(s, 0xfd); - put_be32(s, 0x00040000); /* version */ + avio_w8(s, 0xfd); + avio_wb32(s, 0x00040000); /* version */ put_tag(s, ".ra4"); - put_be32(s, 0x01b53530); /* stream length */ - put_be16(s, 4); /* unknown */ - put_be32(s, 0x39); /* header size */ + avio_wb32(s, 0x01b53530); /* stream length */ + avio_wb16(s, 4); /* unknown */ + avio_wb32(s, 0x39); /* header size */ switch(sample_rate) { case 48000: @@ -208,56 +208,56 @@ static int rv10_write_header(AVFormatContext *ctx, case 8000: fscode = 3; } - put_be16(s, fscode); /* codec additional info, for AC-3, seems + avio_wb16(s, fscode); /* codec additional info, for AC-3, seems to be a frequency code */ /* special hack to compensate rounding errors... */ if (coded_frame_size == 557) coded_frame_size--; - put_be32(s, coded_frame_size); /* frame length */ - put_be32(s, 0x51540); /* unknown */ - put_be32(s, 0x249f0); /* unknown */ - put_be32(s, 0x249f0); /* unknown */ - put_be16(s, 0x01); + avio_wb32(s, coded_frame_size); /* frame length */ + avio_wb32(s, 0x51540); /* unknown */ + avio_wb32(s, 0x249f0); /* unknown */ + avio_wb32(s, 0x249f0); /* unknown */ + avio_wb16(s, 0x01); /* frame length : seems to be very important */ - put_be16(s, coded_frame_size); - put_be32(s, 0); /* unknown */ - put_be16(s, stream->enc->sample_rate); /* sample rate */ - put_be32(s, 0x10); /* unknown */ - put_be16(s, stream->enc->channels); + avio_wb16(s, coded_frame_size); + avio_wb32(s, 0); /* unknown */ + avio_wb16(s, stream->enc->sample_rate); /* sample rate */ + avio_wb32(s, 0x10); /* unknown */ + avio_wb16(s, stream->enc->channels); put_str8(s, "Int0"); /* codec name */ if (stream->enc->codec_tag) { - put_byte(s, 4); /* tag length */ - put_le32(s, stream->enc->codec_tag); + avio_w8(s, 4); /* tag length */ + avio_wl32(s, stream->enc->codec_tag); } else { av_log(ctx, AV_LOG_ERROR, "Invalid codec tag\n"); return -1; } - put_be16(s, 0); /* title length */ - put_be16(s, 0); /* author length */ - put_be16(s, 0); /* copyright length */ - put_byte(s, 0); /* end of header */ + avio_wb16(s, 0); /* title length */ + avio_wb16(s, 0); /* author length */ + avio_wb16(s, 0); /* copyright length */ + avio_w8(s, 0); /* end of header */ } else { /* video codec info */ - put_be32(s,34); /* size */ + avio_wb32(s,34); /* size */ if(stream->enc->codec_id == CODEC_ID_RV10) put_tag(s,"VIDORV10"); else put_tag(s,"VIDORV20"); - put_be16(s, stream->enc->width); - put_be16(s, stream->enc->height); - put_be16(s, (int) stream->frame_rate); /* frames per seconds ? */ - put_be32(s,0); /* unknown meaning */ - put_be16(s, (int) stream->frame_rate); /* unknown meaning */ - put_be32(s,0); /* unknown meaning */ - put_be16(s, 8); /* unknown meaning */ + avio_wb16(s, stream->enc->width); + avio_wb16(s, stream->enc->height); + avio_wb16(s, (int) stream->frame_rate); /* frames per seconds ? */ + avio_wb32(s,0); /* unknown meaning */ + avio_wb16(s, (int) stream->frame_rate); /* unknown meaning */ + avio_wb32(s,0); /* unknown meaning */ + avio_wb16(s, 8); /* unknown meaning */ /* Seems to be the codec version: only use basic H263. The next versions seems to add a diffential DC coding as in MPEG... nothing new under the sun */ if(stream->enc->codec_id == CODEC_ID_RV10) - put_be32(s,0x10000000); + avio_wb32(s,0x10000000); else - put_be32(s,0x20103001); - //put_be32(s,0x10003000); + avio_wb32(s,0x20103001); + //avio_wb32(s,0x10003000); } } @@ -271,11 +271,11 @@ static int rv10_write_header(AVFormatContext *ctx, /* data stream */ put_tag(s,"DATA"); - put_be32(s,data_size + 10 + 8); - put_be16(s,0); + avio_wb32(s,data_size + 10 + 8); + avio_wb16(s,0); - put_be32(s, nb_packets); /* number of packets */ - put_be32(s,0); /* next data header */ + avio_wb32(s, nb_packets); /* number of packets */ + avio_wb32(s,0); /* next data header */ return 0; } @@ -290,13 +290,13 @@ static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream, if (length > stream->packet_max_size) stream->packet_max_size = length; - put_be16(s,0); /* version */ - put_be16(s,length + 12); - put_be16(s, stream->num); /* stream number */ + avio_wb16(s,0); /* version */ + avio_wb16(s,length + 12); + avio_wb16(s, stream->num); /* stream number */ timestamp = (1000 * (float)stream->nb_frames) / stream->frame_rate; - put_be32(s, timestamp); /* timestamp */ - put_byte(s, 0); /* reserved */ - put_byte(s, key_frame ? 2 : 0); /* flags */ + avio_wb32(s, timestamp); /* timestamp */ + avio_w8(s, 0); /* reserved */ + avio_w8(s, key_frame ? 2 : 0); /* flags */ } static int rm_write_header(AVFormatContext *s) @@ -362,9 +362,9 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int buf1[i] = buf[i+1]; buf1[i+1] = buf[i]; } - put_buffer(pb, buf1, size); + avio_write(pb, buf1, size); } else { - put_buffer(pb, buf, size); + avio_write(pb, buf, size); } put_flush_packet(pb); stream->nb_frames++; @@ -386,31 +386,31 @@ static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int #if 1 write_packet_header(s, stream, size + 7 + (size >= 0x4000)*4, key_frame); /* bit 7: '1' if final packet of a frame converted in several packets */ - put_byte(pb, 0x81); + avio_w8(pb, 0x81); /* bit 7: '1' if I frame. bits 6..0 : sequence number in current frame starting from 1 */ if (key_frame) { - put_byte(pb, 0x81); + avio_w8(pb, 0x81); } else { - put_byte(pb, 0x01); + avio_w8(pb, 0x01); } if(size >= 0x4000){ - put_be32(pb, size); /* total frame size */ - put_be32(pb, size); /* offset from the start or the end */ + avio_wb32(pb, size); /* total frame size */ + avio_wb32(pb, size); /* offset from the start or the end */ }else{ - put_be16(pb, 0x4000 | size); /* total frame size */ - put_be16(pb, 0x4000 | size); /* offset from the start or the end */ + avio_wb16(pb, 0x4000 | size); /* total frame size */ + avio_wb16(pb, 0x4000 | size); /* offset from the start or the end */ } #else /* full frame */ write_packet_header(s, size + 6); - put_byte(pb, 0xc0); - put_be16(pb, 0x4000 + size); /* total frame size */ - put_be16(pb, 0x4000 + packet_number * 126); /* position in stream */ + avio_w8(pb, 0xc0); + avio_wb16(pb, 0x4000 + size); /* total frame size */ + avio_wb16(pb, 0x4000 + packet_number * 126); /* position in stream */ #endif - put_byte(pb, stream->nb_frames & 0xff); + avio_w8(pb, stream->nb_frames & 0xff); - put_buffer(pb, buf, size); + avio_write(pb, buf, size); put_flush_packet(pb); stream->nb_frames++; @@ -440,8 +440,8 @@ static int rm_write_trailer(AVFormatContext *s) /* FIXME: write index */ /* undocumented end header */ - put_be32(pb, 0); - put_be32(pb, 0); + avio_wb32(pb, 0); + avio_wb32(pb, 0); url_fseek(pb, 0, SEEK_SET); for(i=0;inb_streams;i++) @@ -449,8 +449,8 @@ static int rm_write_trailer(AVFormatContext *s) rv10_write_header(s, data_size, 0); } else { /* undocumented end header */ - put_be32(pb, 0); - put_be32(pb, 0); + avio_wb32(pb, 0); + avio_wb32(pb, 0); } put_flush_packet(pb); return 0; diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index 0093265772..9c5ee9bd62 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -55,10 +55,10 @@ static int rso_write_header(AVFormatContext *s) } /* format header */ - put_be16(pb, enc->codec_tag); /* codec ID */ - put_be16(pb, 0); /* data size, will be written at EOF */ - put_be16(pb, enc->sample_rate); - put_be16(pb, 0x0000); /* play mode ? (0x0000 = don't loop) */ + avio_wb16(pb, enc->codec_tag); /* codec ID */ + avio_wb16(pb, 0); /* data size, will be written at EOF */ + avio_wb16(pb, enc->sample_rate); + avio_wb16(pb, 0x0000); /* play mode ? (0x0000 = don't loop) */ put_flush_packet(pb); @@ -67,7 +67,7 @@ static int rso_write_header(AVFormatContext *s) static int rso_write_packet(AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); return 0; } @@ -92,7 +92,7 @@ static int rso_write_trailer(AVFormatContext *s) /* update file size */ url_fseek(pb, 2, SEEK_SET); - put_be16(pb, coded_file_size); + avio_wb16(pb, coded_file_size); url_fseek(pb, file_size, SEEK_SET); put_flush_packet(pb); diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 3d40729d1c..b4b8ffcd72 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -268,12 +268,12 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) return -1; // Receiver Report - put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ - put_byte(pb, RTCP_RR); - put_be16(pb, 7); /* length in words - 1 */ + avio_w8(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ + avio_w8(pb, RTCP_RR); + avio_wb16(pb, 7); /* length in words - 1 */ // 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 + avio_wb32(pb, s->ssrc + 1); + avio_wb32(pb, s->ssrc); // server SSRC // some placeholders we should really fill... // RFC 1889/p64 extended_max= stats->cycles + stats->max_seq; @@ -290,34 +290,34 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) fraction= (fraction<<24) | lost; - put_be32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */ - put_be32(pb, extended_max); /* max sequence received */ - put_be32(pb, stats->jitter>>4); /* jitter */ + avio_wb32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */ + avio_wb32(pb, extended_max); /* max sequence received */ + avio_wb32(pb, stats->jitter>>4); /* jitter */ if(s->last_rtcp_ntp_time==AV_NOPTS_VALUE) { - put_be32(pb, 0); /* last SR timestamp */ - put_be32(pb, 0); /* delay since last SR */ + avio_wb32(pb, 0); /* last SR timestamp */ + avio_wb32(pb, 0); /* delay since last SR */ } else { uint32_t middle_32_bits= s->last_rtcp_ntp_time>>16; // this is valid, right? do we need to handle 64 bit values special? uint32_t delay_since_last= ntp_time - s->last_rtcp_ntp_time; - put_be32(pb, middle_32_bits); /* last SR timestamp */ - put_be32(pb, delay_since_last); /* delay since last SR */ + avio_wb32(pb, middle_32_bits); /* last SR timestamp */ + avio_wb32(pb, delay_since_last); /* delay since last SR */ } // CNAME - put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ - put_byte(pb, RTCP_SDES); + avio_w8(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ + avio_w8(pb, RTCP_SDES); len = strlen(s->hostname); - put_be16(pb, (6 + len + 3) / 4); /* length in words - 1 */ - put_be32(pb, s->ssrc); - put_byte(pb, 0x01); - put_byte(pb, len); - put_buffer(pb, s->hostname, len); + avio_wb16(pb, (6 + len + 3) / 4); /* length in words - 1 */ + avio_wb32(pb, s->ssrc); + avio_w8(pb, 0x01); + avio_w8(pb, len); + avio_write(pb, s->hostname, len); // padding for (len = (6 + len) % 4; len % 4; len++) { - put_byte(pb, 0); + avio_w8(pb, 0); } put_flush_packet(pb); @@ -342,11 +342,11 @@ void rtp_send_punch_packets(URLContext* rtp_handle) if (url_open_dyn_buf(&pb) < 0) return; - put_byte(pb, (RTP_VERSION << 6)); - put_byte(pb, 0); /* Payload type */ - put_be16(pb, 0); /* Seq */ - put_be32(pb, 0); /* Timestamp */ - put_be32(pb, 0); /* SSRC */ + avio_w8(pb, (RTP_VERSION << 6)); + avio_w8(pb, 0); /* Payload type */ + avio_wb16(pb, 0); /* Seq */ + avio_wb32(pb, 0); /* Timestamp */ + avio_wb32(pb, 0); /* SSRC */ put_flush_packet(pb); len = url_close_dyn_buf(pb, &buf); @@ -358,10 +358,10 @@ void rtp_send_punch_packets(URLContext* rtp_handle) if (url_open_dyn_buf(&pb) < 0) return; - put_byte(pb, (RTP_VERSION << 6)); - put_byte(pb, RTCP_RR); /* receiver report */ - put_be16(pb, 1); /* length in words - 1 */ - put_be32(pb, 0); /* our own SSRC */ + avio_w8(pb, (RTP_VERSION << 6)); + avio_w8(pb, RTCP_RR); /* receiver report */ + avio_wb16(pb, 1); /* length in words - 1 */ + avio_wb32(pb, 0); /* our own SSRC */ put_flush_packet(pb); len = url_close_dyn_buf(pb, &buf); diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 0f2393f5de..f949725a0f 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -213,7 +213,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, if (!asf->pktbuf) return AVERROR(EIO); - put_buffer(asf->pktbuf, buf + off, len - off); + avio_write(asf->pktbuf, buf + off, len - off); url_fskip(pb, len - off); if (!(flags & RTP_FLAG_MARKER)) return -1; diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c index 255398df02..c6d865a650 100644 --- a/libavformat/rtpdec_latm.c +++ b/libavformat/rtpdec_latm.c @@ -68,7 +68,7 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data, if ((ret = url_open_dyn_buf(&data->dyn_buf)) < 0) return ret; } - put_buffer(data->dyn_buf, buf, len); + avio_write(data->dyn_buf, buf, len); if (!(flags & RTP_FLAG_MARKER)) return AVERROR(EAGAIN); diff --git a/libavformat/rtpdec_svq3.c b/libavformat/rtpdec_svq3.c index 36271a3c15..a4fad1cc13 100644 --- a/libavformat/rtpdec_svq3.c +++ b/libavformat/rtpdec_svq3.c @@ -94,7 +94,7 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv, if (!sv->pktbuf) return AVERROR_INVALIDDATA; - put_buffer(sv->pktbuf, buf, len); + avio_write(sv->pktbuf, buf, len); if (end_packet) { av_init_packet(pkt); diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c index 2431e6b32b..3b1ee137aa 100644 --- a/libavformat/rtpdec_vp8.c +++ b/libavformat/rtpdec_vp8.c @@ -111,7 +111,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, } } - put_buffer(vp8->data, buf, au_len); + avio_write(vp8->data, buf, au_len); buf += au_len; len -= au_len; } diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c index 17d81e7222..37e57f504f 100644 --- a/libavformat/rtpdec_xiph.c +++ b/libavformat/rtpdec_xiph.c @@ -179,7 +179,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, if((res = url_open_dyn_buf(&data->fragment)) < 0) return res; - put_buffer(data->fragment, buf, pkt_len); + avio_write(data->fragment, buf, pkt_len); data->timestamp = *timestamp; } else { @@ -198,7 +198,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, } // copy data to fragment buffer - put_buffer(data->fragment, buf, pkt_len); + avio_write(data->fragment, buf, pkt_len); if (fragmented == 3) { // end of xiph data packet diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 22e68bac97..b32a9a4041 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -197,15 +197,15 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time) s->last_rtcp_ntp_time = ntp_time; 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, RTCP_SR); - put_be16(s1->pb, 6); /* length in words - 1 */ - put_be32(s1->pb, s->ssrc); - put_be32(s1->pb, ntp_time / 1000000); - put_be32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000); - put_be32(s1->pb, rtp_ts); - put_be32(s1->pb, s->packet_count); - put_be32(s1->pb, s->octet_count); + avio_w8(s1->pb, (RTP_VERSION << 6)); + avio_w8(s1->pb, RTCP_SR); + avio_wb16(s1->pb, 6); /* length in words - 1 */ + avio_wb32(s1->pb, s->ssrc); + avio_wb32(s1->pb, ntp_time / 1000000); + avio_wb32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000); + avio_wb32(s1->pb, rtp_ts); + avio_wb32(s1->pb, s->packet_count); + avio_wb32(s1->pb, s->octet_count); put_flush_packet(s1->pb); } @@ -218,13 +218,13 @@ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m) av_dlog(s1, "rtp_send_data size=%d\n", len); /* build the RTP header */ - put_byte(s1->pb, (RTP_VERSION << 6)); - put_byte(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7)); - put_be16(s1->pb, s->seq); - put_be32(s1->pb, s->timestamp); - put_be32(s1->pb, s->ssrc); + avio_w8(s1->pb, (RTP_VERSION << 6)); + avio_w8(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7)); + avio_wb16(s1->pb, s->seq); + avio_wb32(s1->pb, s->timestamp); + avio_wb32(s1->pb, s->ssrc); - put_buffer(s1->pb, buf1, len); + avio_write(s1->pb, buf1, len); put_flush_packet(s1->pb); s->seq++; diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index 6315efd7ef..75141de789 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -54,28 +54,28 @@ static int sox_write_header(AVFormatContext *s) if (enc->codec_id == CODEC_ID_PCM_S32LE) { put_tag(pb, ".SoX"); - put_le32(pb, sox->header_size); - put_le64(pb, 0); /* number of samples */ - put_le64(pb, av_dbl2int(enc->sample_rate)); - put_le32(pb, enc->channels); - put_le32(pb, comment_size); + avio_wl32(pb, sox->header_size); + avio_wl64(pb, 0); /* number of samples */ + avio_wl64(pb, av_dbl2int(enc->sample_rate)); + avio_wl32(pb, enc->channels); + avio_wl32(pb, comment_size); } else if (enc->codec_id == CODEC_ID_PCM_S32BE) { put_tag(pb, "XoS."); - put_be32(pb, sox->header_size); - put_be64(pb, 0); /* number of samples */ - put_be64(pb, av_dbl2int(enc->sample_rate)); - put_be32(pb, enc->channels); - put_be32(pb, comment_size); + avio_wb32(pb, sox->header_size); + avio_wb64(pb, 0); /* number of samples */ + avio_wb64(pb, av_dbl2int(enc->sample_rate)); + avio_wb32(pb, enc->channels); + avio_wb32(pb, comment_size); } else { av_log(s, AV_LOG_ERROR, "invalid codec; use pcm_s32le or pcm_s32be\n"); return -1; } if (comment_len) - put_buffer(pb, comment->value, comment_len); + avio_write(pb, comment->value, comment_len); for ( ; comment_size > comment_len; comment_len++) - put_byte(pb, 0); + avio_w8(pb, 0); put_flush_packet(pb); @@ -85,7 +85,7 @@ static int sox_write_header(AVFormatContext *s) static int sox_write_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); return 0; } @@ -101,9 +101,9 @@ static int sox_write_trailer(AVFormatContext *s) int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL; url_fseek(pb, 8, SEEK_SET); if (enc->codec_id == CODEC_ID_PCM_S32LE) { - put_le64(pb, num_samples); + avio_wl64(pb, num_samples); } else - put_be64(pb, num_samples); + avio_wb64(pb, num_samples); url_fseek(pb, file_size, SEEK_SET); put_flush_packet(pb); diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index f959c96156..8c0ee70e2c 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -476,9 +476,9 @@ static av_always_inline void spdif_put_16(IEC61937Context *ctx, AVIOContext *pb, unsigned int val) { if (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN) - put_be16(pb, val); + avio_wb16(pb, val); else - put_le16(pb, val); + avio_wl16(pb, val); } static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) @@ -512,13 +512,13 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) } if (ctx->extra_bswap ^ (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN)) { - put_buffer(s->pb, ctx->out_buf, ctx->out_bytes & ~1); + avio_write(s->pb, ctx->out_buf, ctx->out_bytes & ~1); } else { av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE); if (!ctx->buffer) return AVERROR(ENOMEM); ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1); - put_buffer(s->pb, ctx->buffer, ctx->out_bytes & ~1); + avio_write(s->pb, ctx->buffer, ctx->out_bytes & ~1); } /* a final lone byte has to be MSB aligned */ diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 956e595965..c698600bdd 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -33,10 +33,10 @@ static void put_swf_tag(AVFormatContext *s, int tag) swf->tag = tag; /* reserve some room for the tag */ if (tag & TAG_LONG) { - put_le16(pb, 0); - put_le32(pb, 0); + avio_wl16(pb, 0); + avio_wl32(pb, 0); } else { - put_le16(pb, 0); + avio_wl16(pb, 0); } } @@ -53,11 +53,11 @@ static void put_swf_end_tag(AVFormatContext *s) url_fseek(pb, swf->tag_pos, SEEK_SET); if (tag & TAG_LONG) { tag &= ~TAG_LONG; - put_le16(pb, (tag << 6) | 0x3f); - put_le32(pb, tag_len - 4); + avio_wl16(pb, (tag << 6) | 0x3f); + avio_wl32(pb, tag_len - 4); } else { assert(tag_len < 0x3f); - put_le16(pb, (tag << 6) | tag_len); + avio_wl16(pb, (tag << 6) | tag_len); } url_fseek(pb, pos, SEEK_SET); } @@ -102,7 +102,7 @@ static void put_swf_rect(AVIOContext *pb, put_bits(&p, nbits, ymax & mask); flush_put_bits(&p); - put_buffer(pb, buf, put_bits_ptr(&p) - p.buf); + avio_write(pb, buf, put_bits_ptr(&p) - p.buf); } static void put_swf_line_edge(PutBitContext *pb, int dx, int dy) @@ -167,7 +167,7 @@ static void put_swf_matrix(AVIOContext *pb, put_bits(&p, nbits, ty); flush_put_bits(&p); - put_buffer(pb, buf, put_bits_ptr(&p) - p.buf); + avio_write(pb, buf, put_bits_ptr(&p) - p.buf); } static int swf_write_header(AVFormatContext *s) @@ -239,20 +239,20 @@ static int swf_write_header(AVFormatContext *s) version = 6; /* version 6 and above support FLV1 codec */ else version = 4; /* version 4 for mpeg audio support */ - put_byte(pb, version); + avio_w8(pb, version); - put_le32(pb, DUMMY_FILE_SIZE); /* dummy size + avio_wl32(pb, DUMMY_FILE_SIZE); /* dummy size (will be patched if not streamed) */ put_swf_rect(pb, 0, width * 20, 0, height * 20); - put_le16(pb, (rate * 256) / rate_base); /* frame rate */ + avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */ swf->duration_pos = url_ftell(pb); - put_le16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */ + avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */ /* avm2/swf v9 (also v8?) files require a file attribute tag */ if (version == 9) { put_swf_tag(s, TAG_FILEATTRIBUTES); - put_le32(pb, 1<<3); /* set ActionScript v3/AVM2 flag */ + avio_wl32(pb, 1<<3); /* set ActionScript v3/AVM2 flag */ put_swf_end_tag(s); } @@ -260,17 +260,17 @@ static int swf_write_header(AVFormatContext *s) if (swf->video_enc && swf->video_enc->codec_id == CODEC_ID_MJPEG) { put_swf_tag(s, TAG_DEFINESHAPE); - put_le16(pb, SHAPE_ID); /* ID of shape */ + avio_wl16(pb, SHAPE_ID); /* ID of shape */ /* bounding rectangle */ put_swf_rect(pb, 0, width, 0, height); /* style info */ - put_byte(pb, 1); /* one fill style */ - put_byte(pb, 0x41); /* clipped bitmap fill */ - put_le16(pb, BITMAP_ID); /* bitmap ID */ + avio_w8(pb, 1); /* one fill style */ + avio_w8(pb, 0x41); /* clipped bitmap fill */ + avio_wl16(pb, BITMAP_ID); /* bitmap ID */ /* position of the bitmap */ put_swf_matrix(pb, (int)(1.0 * (1 << FRAC_BITS)), 0, 0, (int)(1.0 * (1 << FRAC_BITS)), 0, 0); - put_byte(pb, 0); /* no line style */ + avio_w8(pb, 0); /* no line style */ /* shape drawing */ init_put_bits(&p, buf1, sizeof(buf1)); @@ -295,7 +295,7 @@ static int swf_write_header(AVFormatContext *s) put_bits(&p, 5, 0); flush_put_bits(&p); - put_buffer(pb, buf1, put_bits_ptr(&p) - p.buf); + avio_write(pb, buf1, put_bits_ptr(&p) - p.buf); put_swf_end_tag(s); } @@ -317,11 +317,11 @@ static int swf_write_header(AVFormatContext *s) v |= 0x02; /* 16 bit playback */ if (swf->audio_enc->channels == 2) v |= 0x01; /* stereo playback */ - put_byte(s->pb, v); + avio_w8(s->pb, v); v |= 0x20; /* mp3 compressed */ - put_byte(s->pb, v); - put_le16(s->pb, swf->samples_per_frame); /* avg samples per frame */ - put_le16(s->pb, 0); + avio_w8(s->pb, v); + avio_wl16(s->pb, swf->samples_per_frame); /* avg samples per frame */ + avio_wl16(s->pb, 0); put_swf_end_tag(s); } @@ -345,70 +345,70 @@ static int swf_write_video(AVFormatContext *s, if (swf->video_frame_number == 0) { /* create a new video object */ put_swf_tag(s, TAG_VIDEOSTREAM); - put_le16(pb, VIDEO_ID); + avio_wl16(pb, VIDEO_ID); swf->vframes_pos = url_ftell(pb); - put_le16(pb, 15000); /* hard flash player limit */ - put_le16(pb, enc->width); - put_le16(pb, enc->height); - put_byte(pb, 0); - put_byte(pb,ff_codec_get_tag(swf_codec_tags,enc->codec_id)); + avio_wl16(pb, 15000); /* hard flash player limit */ + avio_wl16(pb, enc->width); + avio_wl16(pb, enc->height); + avio_w8(pb, 0); + avio_w8(pb,ff_codec_get_tag(swf_codec_tags,enc->codec_id)); put_swf_end_tag(s); /* place the video object for the first time */ put_swf_tag(s, TAG_PLACEOBJECT2); - put_byte(pb, 0x36); - put_le16(pb, 1); - put_le16(pb, VIDEO_ID); + avio_w8(pb, 0x36); + avio_wl16(pb, 1); + avio_wl16(pb, VIDEO_ID); put_swf_matrix(pb, 1 << FRAC_BITS, 0, 0, 1 << FRAC_BITS, 0, 0); - put_le16(pb, swf->video_frame_number); + avio_wl16(pb, swf->video_frame_number); put_tag(pb, "video"); - put_byte(pb, 0x00); + avio_w8(pb, 0x00); put_swf_end_tag(s); } else { /* mark the character for update */ put_swf_tag(s, TAG_PLACEOBJECT2); - put_byte(pb, 0x11); - put_le16(pb, 1); - put_le16(pb, swf->video_frame_number); + avio_w8(pb, 0x11); + avio_wl16(pb, 1); + avio_wl16(pb, swf->video_frame_number); put_swf_end_tag(s); } /* set video frame data */ put_swf_tag(s, TAG_VIDEOFRAME | TAG_LONG); - put_le16(pb, VIDEO_ID); - put_le16(pb, swf->video_frame_number++); - put_buffer(pb, buf, size); + avio_wl16(pb, VIDEO_ID); + avio_wl16(pb, swf->video_frame_number++); + avio_write(pb, buf, size); put_swf_end_tag(s); } else if (enc->codec_id == CODEC_ID_MJPEG) { if (swf->swf_frame_number > 0) { /* remove the shape */ put_swf_tag(s, TAG_REMOVEOBJECT); - put_le16(pb, SHAPE_ID); /* shape ID */ - put_le16(pb, 1); /* depth */ + avio_wl16(pb, SHAPE_ID); /* shape ID */ + avio_wl16(pb, 1); /* depth */ put_swf_end_tag(s); /* free the bitmap */ put_swf_tag(s, TAG_FREECHARACTER); - put_le16(pb, BITMAP_ID); + avio_wl16(pb, BITMAP_ID); put_swf_end_tag(s); } put_swf_tag(s, TAG_JPEG2 | TAG_LONG); - put_le16(pb, BITMAP_ID); /* ID of the image */ + avio_wl16(pb, BITMAP_ID); /* ID of the image */ /* a dummy jpeg header seems to be required */ - put_be32(pb, 0xffd8ffd9); + avio_wb32(pb, 0xffd8ffd9); /* write the jpeg image */ - put_buffer(pb, buf, size); + avio_write(pb, buf, size); put_swf_end_tag(s); /* draw the shape */ put_swf_tag(s, TAG_PLACEOBJECT); - put_le16(pb, SHAPE_ID); /* shape ID */ - put_le16(pb, 1); /* depth */ + avio_wl16(pb, SHAPE_ID); /* shape ID */ + avio_wl16(pb, 1); /* depth */ put_swf_matrix(pb, 20 << FRAC_BITS, 0, 0, 20 << FRAC_BITS, 0, 0); put_swf_end_tag(s); } @@ -419,9 +419,9 @@ static int swf_write_video(AVFormatContext *s, if (swf->audio_enc && av_fifo_size(swf->audio_fifo)) { int frame_size = av_fifo_size(swf->audio_fifo); put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG); - put_le16(pb, swf->sound_samples); - put_le16(pb, 0); // seek samples - av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &put_buffer); + avio_wl16(pb, swf->sound_samples); + avio_wl16(pb, 0); // seek samples + av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &avio_write); put_swf_end_tag(s); /* update FIFO */ @@ -495,11 +495,11 @@ static int swf_write_trailer(AVFormatContext *s) if (!url_is_streamed(s->pb) && video_enc) { file_size = url_ftell(pb); url_fseek(pb, 4, SEEK_SET); - put_le32(pb, file_size); + avio_wl32(pb, file_size); url_fseek(pb, swf->duration_pos, SEEK_SET); - put_le16(pb, swf->video_frame_number); + avio_wl16(pb, swf->video_frame_number); url_fseek(pb, swf->vframes_pos, SEEK_SET); - put_le16(pb, swf->video_frame_number); + avio_wl16(pb, swf->video_frame_number); url_fseek(pb, file_size, SEEK_SET); } return 0; diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c index 865a157dac..65889fc55c 100644 --- a/libavformat/vc1testenc.c +++ b/libavformat/vc1testenc.c @@ -33,20 +33,20 @@ static int vc1test_write_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n"); return -1; } - put_le24(pb, 0); //frames count will be here - put_byte(pb, 0xC5); - put_le32(pb, 4); - put_buffer(pb, avc->extradata, 4); - put_le32(pb, avc->height); - put_le32(pb, avc->width); - put_le32(pb, 0xC); - put_le24(pb, 0); // hrd_buffer - put_byte(pb, 0x80); // level|cbr|res1 - put_le32(pb, 0); // hrd_rate + avio_wl24(pb, 0); //frames count will be here + avio_w8(pb, 0xC5); + avio_wl32(pb, 4); + avio_write(pb, avc->extradata, 4); + avio_wl32(pb, avc->height); + avio_wl32(pb, avc->width); + avio_wl32(pb, 0xC); + avio_wl24(pb, 0); // hrd_buffer + avio_w8(pb, 0x80); // level|cbr|res1 + avio_wl32(pb, 0); // hrd_rate if (s->streams[0]->r_frame_rate.den && s->streams[0]->r_frame_rate.num == 1) - put_le32(pb, s->streams[0]->r_frame_rate.den); + avio_wl32(pb, s->streams[0]->r_frame_rate.den); else - put_le32(pb, 0xFFFFFFFF); //variable framerate + avio_wl32(pb, 0xFFFFFFFF); //variable framerate av_set_pts_info(s->streams[0], 32, 1, 1000); return 0; @@ -59,9 +59,9 @@ static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt) if (!pkt->size) return 0; - put_le32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0)); - put_le32(pb, pkt->pts); - put_buffer(pb, pkt->data, pkt->size); + avio_wl32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0)); + avio_wl32(pb, pkt->pts); + avio_write(pb, pkt->data, pkt->size); put_flush_packet(pb); ctx->frames++; @@ -75,7 +75,7 @@ static int vc1test_write_trailer(AVFormatContext *s) if (!url_is_streamed(s->pb)) { url_fseek(pb, 0, SEEK_SET); - put_le24(pb, ctx->frames); + avio_wl24(pb, ctx->frames); put_flush_packet(pb); } return 0; diff --git a/libavformat/vocenc.c b/libavformat/vocenc.c index 3a17eb4e64..74cd4790e4 100644 --- a/libavformat/vocenc.c +++ b/libavformat/vocenc.c @@ -37,10 +37,10 @@ static int voc_write_header(AVFormatContext *s) || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO) return AVERROR_PATCHWELCOME; - put_buffer(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1); - put_le16(pb, header_size); - put_le16(pb, version); - put_le16(pb, ~version + 0x1234); + avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1); + avio_wl16(pb, header_size); + avio_wl16(pb, version); + avio_wl16(pb, ~version + 0x1234); return 0; } @@ -53,39 +53,39 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt) if (!voc->param_written) { if (enc->codec_tag > 0xFF) { - put_byte(pb, VOC_TYPE_NEW_VOICE_DATA); - put_le24(pb, pkt->size + 12); - put_le32(pb, enc->sample_rate); - put_byte(pb, enc->bits_per_coded_sample); - put_byte(pb, enc->channels); - put_le16(pb, enc->codec_tag); - put_le32(pb, 0); + avio_w8(pb, VOC_TYPE_NEW_VOICE_DATA); + avio_wl24(pb, pkt->size + 12); + avio_wl32(pb, enc->sample_rate); + avio_w8(pb, enc->bits_per_coded_sample); + avio_w8(pb, enc->channels); + avio_wl16(pb, enc->codec_tag); + avio_wl32(pb, 0); } else { if (s->streams[0]->codec->channels > 1) { - put_byte(pb, VOC_TYPE_EXTENDED); - put_le24(pb, 4); - put_le16(pb, 65536-256000000/(enc->sample_rate*enc->channels)); - put_byte(pb, enc->codec_tag); - put_byte(pb, enc->channels - 1); + avio_w8(pb, VOC_TYPE_EXTENDED); + avio_wl24(pb, 4); + avio_wl16(pb, 65536-256000000/(enc->sample_rate*enc->channels)); + avio_w8(pb, enc->codec_tag); + avio_w8(pb, enc->channels - 1); } - put_byte(pb, VOC_TYPE_VOICE_DATA); - put_le24(pb, pkt->size + 2); - put_byte(pb, 256 - 1000000 / enc->sample_rate); - put_byte(pb, enc->codec_tag); + avio_w8(pb, VOC_TYPE_VOICE_DATA); + avio_wl24(pb, pkt->size + 2); + avio_w8(pb, 256 - 1000000 / enc->sample_rate); + avio_w8(pb, enc->codec_tag); } voc->param_written = 1; } else { - put_byte(pb, VOC_TYPE_VOICE_DATA_CONT); - put_le24(pb, pkt->size); + avio_w8(pb, VOC_TYPE_VOICE_DATA_CONT); + avio_wl24(pb, pkt->size); } - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); return 0; } static int voc_write_trailer(AVFormatContext *s) { - put_byte(s->pb, 0); + avio_w8(s->pb, 0); return 0; } diff --git a/libavformat/wav.c b/libavformat/wav.c index 9a6e7619b6..dea70fa4dc 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -43,7 +43,7 @@ static int wav_write_header(AVFormatContext *s) int64_t fmt, fact; put_tag(pb, "RIFF"); - put_le32(pb, 0); /* file length */ + avio_wl32(pb, 0); /* file length */ put_tag(pb, "WAVE"); /* format header */ @@ -59,7 +59,7 @@ static int wav_write_header(AVFormatContext *s) if (s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */ && !url_is_streamed(s->pb)) { fact = ff_start_tag(pb, "fact"); - put_le32(pb, 0); + avio_wl32(pb, 0); ff_end_tag(pb, fact); } @@ -79,7 +79,7 @@ static int wav_write_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; WAVContext *wav = s->priv_data; - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); if(pkt->pts != AV_NOPTS_VALUE) { wav->minpts = FFMIN(wav->minpts, pkt->pts); wav->maxpts = FFMAX(wav->maxpts, pkt->pts); @@ -103,7 +103,7 @@ static int wav_write_trailer(AVFormatContext *s) /* update file size */ file_size = url_ftell(pb); url_fseek(pb, 4, SEEK_SET); - put_le32(pb, (uint32_t)(file_size - 8)); + avio_wl32(pb, (uint32_t)(file_size - 8)); url_fseek(pb, file_size, SEEK_SET); put_flush_packet(pb); @@ -115,7 +115,7 @@ static int wav_write_trailer(AVFormatContext *s) s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num, s->streams[0]->time_base.den); url_fseek(pb, wav->data-12, SEEK_SET); - put_le32(pb, number_of_samples); + avio_wl32(pb, number_of_samples); url_fseek(pb, file_size, SEEK_SET); put_flush_packet(pb); } diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index 54b77370af..01366b08b6 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -108,21 +108,21 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n"); return AVERROR(EIO); } else { - put_buffer(pb, buf2, strlen(buf2)); + avio_write(pb, buf2, strlen(buf2)); } } /* construct frame header */ m = snprintf(buf1, sizeof(buf1), "%s\n", Y4M_FRAME_MAGIC); - put_buffer(pb, buf1, strlen(buf1)); + avio_write(pb, buf1, strlen(buf1)); width = st->codec->width; height = st->codec->height; ptr = picture->data[0]; for(i=0;ilinesize[0]; } @@ -135,11 +135,11 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) ptr1 = picture->data[1]; ptr2 = picture->data[2]; for(i=0;ilinesize[1]; } for(i=0;ilinesize[2]; } } From 0ac8e2bf2bf3d636241bf2811018d9974687a63c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 21 Feb 2011 20:02:20 +0100 Subject: [PATCH 430/528] avio: make put_nbyte internal. Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 2 +- libavformat/avio_internal.h | 2 ++ libavformat/aviobuf.c | 6 +++++- libavformat/spdifenc.c | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index f12b9f8127..41fe6fbeca 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -397,6 +397,7 @@ attribute_deprecated unsigned int get_be32(AVIOContext *s); attribute_deprecated uint64_t get_be64(AVIOContext *s); attribute_deprecated void put_byte(AVIOContext *s, int b); +attribute_deprecated void put_nbyte(AVIOContext *s, int b, int count); attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size); attribute_deprecated void put_le64(AVIOContext *s, uint64_t val); attribute_deprecated void put_be64(AVIOContext *s, uint64_t val); @@ -421,7 +422,6 @@ AVIOContext *avio_alloc_context( int64_t (*seek)(void *opaque, int64_t offset, int whence)); void avio_w8(AVIOContext *s, int b); -void put_nbyte(AVIOContext *s, int b, int count); void avio_write(AVIOContext *s, const unsigned char *buf, int size); void avio_wl64(AVIOContext *s, uint64_t val); void avio_wb64(AVIOContext *s, uint64_t val); diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 16715377b5..85e7f069e2 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -40,4 +40,6 @@ int ffio_init_context(AVIOContext *s, */ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size); +void ffio_fill(AVIOContext *s, int b, int count); + #endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 275794deb9..eb48758c46 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -141,7 +141,7 @@ void avio_w8(AVIOContext *s, int b) flush_buffer(s); } -void put_nbyte(AVIOContext *s, int b, int count) +void ffio_fill(AVIOContext *s, int b, int count) { while (count > 0) { int len = FFMIN(s->buf_end - s->buf_ptr, count); @@ -352,6 +352,10 @@ void put_buffer(AVIOContext *s, const unsigned char *buf, int size) { avio_write(s, buf, size); } +void put_nbyte(AVIOContext *s, int b, int count) +{ + ffio_fill(s, b, count); +} #endif int avio_put_str(AVIOContext *s, const char *str) diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index 8c0ee70e2c..90ac8adc9f 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -525,7 +525,7 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) if (ctx->out_bytes & 1) spdif_put_16(ctx, s->pb, ctx->out_buf[ctx->out_bytes - 1] << 8); - put_nbyte(s->pb, 0, padding); + ffio_fill(s->pb, 0, padding); av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n", ctx->data_type, ctx->out_bytes, ctx->pkt_offset); From 381efba0ecedd41575f99ba9e9bd3826551079f6 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 21 Feb 2011 19:15:38 +0000 Subject: [PATCH 431/528] ppc: fix vc1 inverse transform, unbreak build GCC 4.3 and later are more particular about signedness matching in vector operations. The operations under if(rangered) were missing assignments and thus had no effect. Signed-off-by: Mans Rullgard --- libavcodec/ppc/vc1dsp_altivec.c | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/libavcodec/ppc/vc1dsp_altivec.c b/libavcodec/ppc/vc1dsp_altivec.c index b5cc71c3cf..05edb53b7c 100644 --- a/libavcodec/ppc/vc1dsp_altivec.c +++ b/libavcodec/ppc/vc1dsp_altivec.c @@ -146,7 +146,7 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], const vector signed int vec_1s = vec_splat_s32(1); const vector unsigned int vec_1 = vec_splat_u32(1); const vector unsigned short rangered_shift = vec_splat_u16(1); - const vector signed short signed_bias = vec_sl(vec_splat_u16(4), + const vector signed short signed_bias = vec_sl(vec_splat_s16(4), vec_splat_u16(4)); src0 = vec_ld( 0, block); @@ -219,23 +219,23 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], if (rangered) { if (!sign) { - vec_sub(src0, signed_bias); - vec_sub(src1, signed_bias); - vec_sub(src2, signed_bias); - vec_sub(src3, signed_bias); - vec_sub(src4, signed_bias); - vec_sub(src5, signed_bias); - vec_sub(src6, signed_bias); - vec_sub(src7, signed_bias); + src0 = vec_sub(src0, signed_bias); + src1 = vec_sub(src1, signed_bias); + src2 = vec_sub(src2, signed_bias); + src3 = vec_sub(src3, signed_bias); + src4 = vec_sub(src4, signed_bias); + src5 = vec_sub(src5, signed_bias); + src6 = vec_sub(src6, signed_bias); + src7 = vec_sub(src7, signed_bias); } - vec_sl(src0, rangered_shift); - vec_sl(src1, rangered_shift); - vec_sl(src2, rangered_shift); - vec_sl(src3, rangered_shift); - vec_sl(src4, rangered_shift); - vec_sl(src5, rangered_shift); - vec_sl(src6, rangered_shift); - vec_sl(src7, rangered_shift); + src0 = vec_sl(src0, rangered_shift); + src1 = vec_sl(src1, rangered_shift); + src2 = vec_sl(src2, rangered_shift); + src3 = vec_sl(src3, rangered_shift); + src4 = vec_sl(src4, rangered_shift); + src5 = vec_sl(src5, rangered_shift); + src6 = vec_sl(src6, rangered_shift); + src7 = vec_sl(src7, rangered_shift); } vec_st(src0, 0, block); From e0e46cae377347cbe1cd27c0d85568921b12c2ad Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 21 Feb 2011 15:47:27 +0000 Subject: [PATCH 432/528] vp8: ppc: fix invalid reads in altivec epel mc The 4-tap filters should only access one row/column before the reference block. Signed-off-by: Mans Rullgard --- libavcodec/ppc/vp8dsp_altivec.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/libavcodec/ppc/vp8dsp_altivec.c b/libavcodec/ppc/vp8dsp_altivec.c index 8096c4a535..8bb60aae0b 100644 --- a/libavcodec/ppc/vp8dsp_altivec.c +++ b/libavcodec/ppc/vp8dsp_altivec.c @@ -56,8 +56,8 @@ static const vec_s8 h_subpel_filters_outer[3] = vec_s8 filter_outerl = vec_sld(filter_outerh, filter_outerh, 2) #define FILTER_H(dstv, off) \ - a = vec_ld((off)-2, src); \ - b = vec_ld((off)-2+15, src); \ + a = vec_ld((off)-is6tap-1, src); \ + b = vec_ld((off)-is6tap-1+15, src); \ \ pixh = vec_perm(a, b, permh##off); \ pixl = vec_perm(a, b, perml##off); \ @@ -86,13 +86,15 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, int dst_stride, vec_s16 f16h, f16l; vec_s32 filth, filtl; - vec_u8 perm_inner = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 }; + vec_u8 perm_inner6 = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 }; + vec_u8 perm_inner4 = { 0,1,2,3, 1,2,3,4, 2,3,4,5, 3,4,5,6 }; + vec_u8 perm_inner = is6tap ? perm_inner6 : perm_inner4; vec_u8 perm_outer = { 4,9, 0,5, 5,10, 1,6, 6,11, 2,7, 7,12, 3,8 }; vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6)); vec_u16 c7 = vec_splat_u16(7); - align_vec0 = vec_lvsl( -2, src); - align_vec8 = vec_lvsl(8-2, src); + align_vec0 = vec_lvsl( -is6tap-1, src); + align_vec8 = vec_lvsl(8-is6tap-1, src); permh0 = vec_perm(align_vec0, align_vec0, perm_inner); permh8 = vec_perm(align_vec8, align_vec8, perm_inner); @@ -239,8 +241,13 @@ void put_vp8_epel ## WIDTH ## _v ## TAPS ## _altivec(uint8_t *dst, int dst_strid static void put_vp8_epel ## WIDTH ## _h ## HTAPS ## v ## VTAPS ## _altivec(uint8_t *dst, int stride, uint8_t *src, int s, int h, int mx, int my) \ { \ DECLARE_ALIGNED(16, uint8_t, tmp)[(2*WIDTH+5)*16]; \ - put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-2*stride, stride, h+5, mx, my); \ - put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+2*16, 16, h, mx, my); \ + if (VTAPS == 6) { \ + put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-2*stride, stride, h+5, mx, my); \ + put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+2*16, 16, h, mx, my); \ + } else { \ + put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-stride, stride, h+4, mx, my); \ + put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+16, 16, h, mx, my); \ + } \ } EPEL_FUNCS(16,6) From 0f86fcabdf74f658323140111dfd4de83f7f2eee Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 21 Feb 2011 15:46:45 -0500 Subject: [PATCH 433/528] spdifenc.c: fix compile because of missing include avio_internal.h. --- libavformat/spdifenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index 90ac8adc9f..b4111f62b7 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -45,6 +45,7 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "spdif.h" #include "libavcodec/ac3.h" #include "libavcodec/dca.h" From 6c065f0acd5b50a9037b561c6fc370b316832543 Mon Sep 17 00:00:00 2001 From: Tony Strauss Date: Mon, 21 Feb 2011 23:46:54 +0000 Subject: [PATCH 434/528] mpegtsenc: use correct PES stream_id for AAC This adds the AAC codec to the list of audio codecs that results in a PES stream_id of 0xc0 (audio stream). Signed-off-by: Mans Rullgard --- libavformat/mpegtsenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 99becbcb31..be11a06ff0 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -746,7 +746,8 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, *q++ = 0xe0; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && (st->codec->codec_id == CODEC_ID_MP2 || - st->codec->codec_id == CODEC_ID_MP3)) { + st->codec->codec_id == CODEC_ID_MP3 || + st->codec->codec_id == CODEC_ID_AAC)) { *q++ = 0xc0; } else { *q++ = 0xbd; From 203df50d1013ea59e558d63f3ea69ffae1249124 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Mon, 21 Feb 2011 00:01:09 -0800 Subject: [PATCH 435/528] Remove old VCSs from version.sh --- version.sh | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/version.sh b/version.sh index 3269e038a7..b34ee2c88c 100755 --- a/version.sh +++ b/version.sh @@ -1,21 +1,8 @@ #!/bin/sh -# check for SVN revision number revision=$(cd "$1" && cat snapshot_version 2> /dev/null) -test "$revision" || revision=$(cd "$1" && LC_ALL=C svn info 2> /dev/null | grep "Last Changed Rev" | cut -d' ' -f4) -test "$revision" || revision=$(cd "$1" && grep committed-rev .svn/entries 2>/dev/null | head -n 1 | cut -d '"' -f2) -test "$revision" || revision=$(cd "$1" && sed -n -e '/^dir$/{n -p -q -}' .svn/entries 2>/dev/null) test "$revision" && revision=SVN-r$revision -# check for git svn revision number -if ! test "$revision"; then - revision=$(cd "$1" && git svn find-rev HEAD 2> /dev/null) - test "$revision" && revision=git-svn-r$revision -fi - # check for git short hash if ! test "$revision"; then revision=$(cd "$1" && git describe --always 2> /dev/null) From e22910b21a6c78b0159f98426b10c204f12bc15a Mon Sep 17 00:00:00 2001 From: Young Han Lee Date: Wed, 16 Feb 2011 10:04:07 +0900 Subject: [PATCH 436/528] aacdec: Reduce the size of buf_mdct. It was doubled in size for the LTP implementation. This brings it back down to its original size. --- libavcodec/aac.h | 2 +- libavcodec/aacdec.c | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libavcodec/aac.h b/libavcodec/aac.h index a2bf70b001..73bc40843f 100644 --- a/libavcodec/aac.h +++ b/libavcodec/aac.h @@ -272,7 +272,7 @@ typedef struct { * @defgroup temporary aligned temporary buffers (We do not want to have these on the stack.) * @{ */ - DECLARE_ALIGNED(16, float, buf_mdct)[2048]; + DECLARE_ALIGNED(16, float, buf_mdct)[1024]; /** @} */ /** diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index a362d6ad4e..81a94f2fd8 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -1763,8 +1763,8 @@ static void apply_ltp(AACContext *ac, SingleChannelElement *sce) int i, sfb; if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) { - float *predTime = ac->buf_mdct; - float *predFreq = sce->ret; + float *predTime = sce->ret; + float *predFreq = ac->buf_mdct; int16_t num_samples = 2048; if (ltp->lag < 1024) @@ -1797,19 +1797,22 @@ static void update_ltp(AACContext *ac, SingleChannelElement *sce) const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; int i; - for (i = 0; i < 512; i++) - ac->buf_mdct[1535 - i] = ac->buf_mdct[512 + i]; - if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { memcpy(saved_ltp, saved, 512 * sizeof(float)); memset(saved_ltp + 576, 0, 448 * sizeof(float)); - ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, swindow, 128); + ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, &swindow[64], 64); + for (i = 0; i < 64; i++) + saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i]; } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { memcpy(saved_ltp, ac->buf_mdct + 512, 448 * sizeof(float)); memset(saved_ltp + 576, 0, 448 * sizeof(float)); - ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, swindow, 128); + ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, &swindow[64], 64); + for (i = 0; i < 64; i++) + saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i]; } else { // LONG_STOP or ONLY_LONG - ac->dsp.vector_fmul_reverse(saved_ltp, ac->buf_mdct + 512, lwindow, 1024); + ac->dsp.vector_fmul_reverse(saved_ltp, ac->buf_mdct + 512, &lwindow[512], 512); + for (i = 0; i < 512; i++) + saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * lwindow[511 - i]; } memcpy(sce->ltp_state, &sce->ltp_state[1024], 1024 * sizeof(int16_t)); From 8f935b9271052be8f97d655081b94b68b6c23bfb Mon Sep 17 00:00:00 2001 From: Benjamin Larsson Date: Tue, 8 Feb 2011 11:05:05 +0100 Subject: [PATCH 437/528] Add more AVC Intra FOURCCs Also change the comments a bit since the FOURCCs aren't specific to Flip4Mac and different ones are used for 720 versus 1080 lines. Signed-off-by: Ronald S. Bultje --- libavformat/isom.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/isom.c b/libavformat/isom.c index 8534cb8898..3a0d34874d 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -134,8 +134,10 @@ const AVCodecTag codec_movvideo_tags[] = { { CODEC_ID_RAWVIDEO, MKTAG('W', 'R', 'A', 'W') }, { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */ - { CODEC_ID_H264, MKTAG('a', 'i', '5', '5') }, /* Flip4Mac AVC Intra 50 */ - { CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* Flip4Mac AVC Intra 100 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', '5') }, /* AVC Intra 50 / 1080 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', 'q') }, /* AVC Intra 50 / 720 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* AVC Intra 100 / 1080 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', 'q') }, /* AVC Intra 100 / 720 */ { CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */ { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */ From 28c4741a6617a4c1d2490cb13fc70ae4c9c472da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sat, 19 Feb 2011 19:14:11 +0100 Subject: [PATCH 438/528] libavformat: Remove FF_NETERRNO() Map EAGAIN and EINTR from ff_neterrno to the normal AVERROR() error codes. Provide fallback definitions of other errno.h network errors, mapping them to the corresponding winsock errors. This eases catching these error codes in common code, without having to distinguish between FF_NETERRNO(EAGAIN) and AVERROR(EAGAIN). This fixes roundup issue 2614, unbreaking blocking network IO on windows. Signed-off-by: Ronald S. Bultje --- ffserver.c | 32 ++++++++++++++++---------------- libavformat/network.h | 19 +++++++++++++++---- libavformat/rtpproto.c | 14 +++++++------- libavformat/rtsp.c | 4 ++-- libavformat/rtspdec.c | 2 +- libavformat/sapenc.c | 2 +- libavformat/tcp.c | 8 ++++---- libavformat/udp.c | 10 +++++----- 8 files changed, 51 insertions(+), 40 deletions(-) diff --git a/ffserver.c b/ffserver.c index 7bda96889a..abc7cd9f96 100644 --- a/ffserver.c +++ b/ffserver.c @@ -692,8 +692,8 @@ static int http_server(void) second to handle timeouts */ do { ret = poll(poll_table, poll_entry - poll_table, delay); - if (ret < 0 && ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ret < 0 && ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) return -1; } while (ret < 0); @@ -916,8 +916,8 @@ static int handle_connection(HTTPContext *c) read_loop: len = recv(c->fd, c->buffer_ptr, 1, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) return -1; } else if (len == 0) { return -1; @@ -952,8 +952,8 @@ static int handle_connection(HTTPContext *c) return 0; len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) { + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) { /* error : close connection */ av_freep(&c->pb_buffer); return -1; @@ -1022,8 +1022,8 @@ static int handle_connection(HTTPContext *c) return 0; len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) { + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) { /* error : close connection */ av_freep(&c->pb_buffer); return -1; @@ -1049,8 +1049,8 @@ static int handle_connection(HTTPContext *c) len = send(c->fd, c->packet_buffer_ptr, c->packet_buffer_end - c->packet_buffer_ptr, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) { + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) { /* error : close connection */ av_freep(&c->packet_buffer); return -1; @@ -2550,8 +2550,8 @@ static int http_send_data(HTTPContext *c) /* TCP data output */ len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) /* error : close connection */ return -1; else @@ -2624,8 +2624,8 @@ static int http_receive_data(HTTPContext *c) len = recv(c->fd, c->buffer_ptr, 1, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) /* error : close connection */ goto fail; return 0; @@ -2651,8 +2651,8 @@ static int http_receive_data(HTTPContext *c) len = recv(c->fd, c->buffer_ptr, FFMIN(c->chunk_size, c->buffer_end - c->buffer_ptr), 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) /* error : close connection */ goto fail; } else if (len == 0) diff --git a/libavformat/network.h b/libavformat/network.h index d6aee93121..58a8e80e72 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -27,9 +27,21 @@ #include #include -#define ff_neterrno() (-WSAGetLastError()) -#define FF_NETERROR(err) (-WSA##err) -#define WSAEAGAIN WSAEWOULDBLOCK +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#define ETIMEDOUT WSAETIMEDOUT +#define ECONNREFUSED WSAECONNREFUSED +#define EINPROGRESS WSAEINPROGRESS + +static inline int ff_neterrno() { + int err = WSAGetLastError(); + switch (err) { + case WSAEWOULDBLOCK: + return AVERROR(EAGAIN); + case WSAEINTR: + return AVERROR(EINTR); + } + return -err; +} #else #include #include @@ -37,7 +49,6 @@ #include #define ff_neterrno() AVERROR(errno) -#define FF_NETERROR(err) AVERROR(err) #endif #if HAVE_ARPA_INET_H diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index dd5bc71c0e..269b1b2726 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -231,8 +231,8 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) len = recvfrom (s->rtp_fd, buf, size, 0, (struct sockaddr *)&from, &from_len); if (len < 0) { - if (ff_neterrno() == FF_NETERROR(EAGAIN) || - ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EAGAIN) || + ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } @@ -251,8 +251,8 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) len = recvfrom (s->rtcp_fd, buf, size, 0, (struct sockaddr *)&from, &from_len); if (len < 0) { - if (ff_neterrno() == FF_NETERROR(EAGAIN) || - ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EAGAIN) || + ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } @@ -264,15 +264,15 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) len = recvfrom (s->rtp_fd, buf, size, 0, (struct sockaddr *)&from, &from_len); if (len < 0) { - if (ff_neterrno() == FF_NETERROR(EAGAIN) || - ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EAGAIN) || + ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } break; } } else if (n < 0) { - if (ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index bc8cd67c81..62311cbb23 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1528,7 +1528,7 @@ redirect: goto fail; lower_transport_mask &= ~(1 << lower_transport); if (lower_transport_mask == 0 && err == 1) { - err = FF_NETERROR(EPROTONOSUPPORT); + err = AVERROR(EPROTONOSUPPORT); goto fail; } } while (err); @@ -1615,7 +1615,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, } #endif } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) { - return FF_NETERROR(ETIMEDOUT); + return AVERROR(ETIMEDOUT); } else if (n < 0 && errno != EINTR) return AVERROR(errno); } diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index e484347896..e79f873e1b 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -311,7 +311,7 @@ retry: ret = ff_rtsp_fetch_packet(s, pkt); if (ret < 0) { - if (ret == FF_NETERROR(ETIMEDOUT) && !rt->packets) { + if (ret == AVERROR(ETIMEDOUT) && !rt->packets) { if (rt->lower_transport == RTSP_LOWER_TRANSPORT_UDP && rt->lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_TCP)) { RTSPMessageHeader reply1, *reply = &reply1; diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 91c1f628c7..bd3483e296 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -240,7 +240,7 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt) 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)) + if (ret < 0 && ret != AVERROR(ECONNREFUSED)) return ret; sap->last_time = now; } diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 29eb60abe9..b01f0b85bf 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -72,13 +72,13 @@ static int tcp_open(URLContext *h, const char *uri, int flags) ret = connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen); if (ret < 0) { struct pollfd p = {fd, POLLOUT, 0}; - if (ff_neterrno() == FF_NETERROR(EINTR)) { + if (ff_neterrno() == AVERROR(EINTR)) { if (url_interrupt_cb()) goto fail1; goto redo; } - if (ff_neterrno() != FF_NETERROR(EINPROGRESS) && - ff_neterrno() != FF_NETERROR(EAGAIN)) + if (ff_neterrno() != AVERROR(EINPROGRESS) && + ff_neterrno() != AVERROR(EAGAIN)) goto fail; /* wait until we are connected or until abort */ @@ -136,7 +136,7 @@ static int tcp_wait_fd(int fd, int write) int ret; ret = poll(&p, 1, 100); - return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : FF_NETERROR(EAGAIN); + return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : AVERROR(EAGAIN); } static int tcp_read(URLContext *h, uint8_t *buf, int size) diff --git a/libavformat/udp.c b/libavformat/udp.c index 6c1b37b59d..0196573209 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -455,7 +455,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) return AVERROR(EINTR); ret = poll(&p, 1, 100); if (ret < 0) { - if (ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } @@ -463,8 +463,8 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) continue; len = recv(s->udp_fd, buf, size, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) return AVERROR(EIO); } else { break; @@ -486,8 +486,8 @@ static int udp_write(URLContext *h, const uint8_t *buf, int size) } else ret = send(s->udp_fd, buf, size, 0); if (ret < 0) { - if (ff_neterrno() != FF_NETERROR(EINTR) && - ff_neterrno() != FF_NETERROR(EAGAIN)) + if (ff_neterrno() != AVERROR(EINTR) && + ff_neterrno() != AVERROR(EAGAIN)) return ff_neterrno(); } else { break; From 22a3212e32b696028e21f00871f3cb48c044029d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 21 Feb 2011 22:45:20 +0100 Subject: [PATCH 439/528] avio: rename url_fopen/fclose -> avio_open/close. Signed-off-by: Ronald S. Bultje --- ffmpeg.c | 4 ++-- ffserver.c | 4 ++-- libavformat/applehttp.c | 16 ++++++++-------- libavformat/avformat.h | 2 +- libavformat/avio.h | 16 ++++++++++++++-- libavformat/aviobuf.c | 13 +++++++++++-- libavformat/img2.c | 12 ++++++------ libavformat/mov.c | 4 ++-- libavformat/output-example.c | 4 ++-- libavformat/rtpenc_chain.c | 2 +- libavformat/rtsp.c | 2 +- libavformat/rtspdec.c | 2 +- libavformat/sapenc.c | 2 +- libavformat/utils.c | 6 +++--- 14 files changed, 55 insertions(+), 34 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 185ca19a2b..4a737b4945 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -508,7 +508,7 @@ static int ffmpeg_exit(int ret) AVFormatContext *s = output_files[i]; int j; if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb) - url_fclose(s->pb); + avio_close(s->pb); avformat_free_context(s); av_free(output_streams_for_file[i]); } @@ -3789,7 +3789,7 @@ static void opt_output_file(const char *filename) } /* open the file */ - if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) { + if ((err = avio_open(&oc->pb, filename, URL_WRONLY)) < 0) { print_error(filename, err); ffmpeg_exit(1); } diff --git a/ffserver.c b/ffserver.c index abc7cd9f96..e5c4ac23d8 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3764,7 +3764,7 @@ static void build_feed_streams(void) } /* only write the header of the ffm file */ - if (url_fopen(&s->pb, feed->feed_filename, URL_WRONLY) < 0) { + if (avio_open(&s->pb, feed->feed_filename, URL_WRONLY) < 0) { http_log("Could not open output feed file '%s'\n", feed->feed_filename); exit(1); @@ -3783,7 +3783,7 @@ static void build_feed_streams(void) } /* XXX: need better api */ av_freep(&s->priv_data); - url_fclose(s->pb); + avio_close(s->pb); } /* get feed size and write index */ fd = open(feed->feed_filename, O_RDONLY); diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index e35aaa8ac4..5118d03670 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -154,7 +154,7 @@ static void free_variant_list(AppleHTTPContext *c) free_segment_list(var); av_free_packet(&var->pkt); if (var->pb) - url_fclose(var->pb); + avio_close(var->pb); if (var->ctx) { var->ctx->pb = NULL; av_close_input_file(var->ctx); @@ -211,7 +211,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url, if (!in) { close_in = 1; - if ((ret = url_fopen(&in, url, URL_RDONLY)) < 0) + if ((ret = avio_open(&in, url, URL_RDONLY)) < 0) return ret; } @@ -284,7 +284,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url, fail: if (close_in) - url_fclose(in); + avio_close(in); return ret; } @@ -338,7 +338,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) ret = av_open_input_file(&v->ctx, v->segments[0]->url, NULL, 0, NULL); if (ret < 0) goto fail; - url_fclose(v->ctx->pb); + avio_close(v->ctx->pb); v->ctx->pb = NULL; v->stream_offset = stream_offset; /* Create new AVStreams for each stream in this variant */ @@ -378,7 +378,7 @@ static int open_variant(AppleHTTPContext *c, struct variant *var, int skip) } if (c->cur_seq_no - var->start_seq_no >= var->n_segments) return c->finished ? AVERROR_EOF : 0; - ret = url_fopen(&var->pb, + ret = avio_open(&var->pb, var->segments[c->cur_seq_no - var->start_seq_no]->url, URL_RDONLY); if (ret < 0) @@ -435,7 +435,7 @@ start: "Closing variant stream %d, no longer needed\n", i); av_free_packet(&var->pkt); reset_packet(&var->pkt); - url_fclose(var->pb); + avio_close(var->pb); var->pb = NULL; changed = 1; } else if (!var->pb && var->needed) { @@ -484,7 +484,7 @@ start: for (i = 0; i < c->n_variants; i++) { struct variant *var = c->variants[i]; if (var->pb) { - url_fclose(var->pb); + avio_close(var->pb); var->pb = NULL; } } @@ -558,7 +558,7 @@ static int applehttp_read_seek(AVFormatContext *s, int stream_index, for (i = 0; i < c->n_variants; i++) { struct variant *var = c->variants[i]; if (var->pb) { - url_fclose(var->pb); + avio_close(var->pb); var->pb = NULL; } av_free_packet(&var->pkt); diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 3fd7f75075..4f25d66dc8 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -261,7 +261,7 @@ typedef struct AVFormatParameters { #endif } AVFormatParameters; -//! Demuxer will use url_fopen, no opened file should be provided by the caller. +//! Demuxer will use avio_open, no opened file should be provided by the caller. #define AVFMT_NOFILE 0x0001 #define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ #define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ diff --git a/libavformat/avio.h b/libavformat/avio.h index 41fe6fbeca..5876228235 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -410,6 +410,18 @@ attribute_deprecated void put_be16(AVIOContext *s, unsigned int val); /** * @} */ + + +/** + * @defgroup old_url_f_funcs Old url_f* functions + * @deprecated use the avio_ -prefixed functions instead. + * @{ + */ +attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); +attribute_deprecated int url_fclose(AVIOContext *s); +/** + * @} + */ #endif AVIOContext *avio_alloc_context( @@ -591,9 +603,9 @@ int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size); * @return 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure */ -int url_fopen(AVIOContext **s, const char *url, int flags); +int avio_open(AVIOContext **s, const char *url, int flags); -int url_fclose(AVIOContext *s); +int avio_close(AVIOContext *s); URLContext *url_fileno(AVIOContext *s); /** diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index eb48758c46..270352ecb6 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -356,6 +356,15 @@ void put_nbyte(AVIOContext *s, int b, int count) { ffio_fill(s, b, count); } + +int url_fopen(AVIOContext **s, const char *filename, int flags) +{ + return avio_open(s, filename, flags); +} +int url_fclose(AVIOContext *s) +{ + return avio_close(s); +} #endif int avio_put_str(AVIOContext *s, const char *str) @@ -843,7 +852,7 @@ int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size) return 0; } -int url_fopen(AVIOContext **s, const char *filename, int flags) +int avio_open(AVIOContext **s, const char *filename, int flags) { URLContext *h; int err; @@ -859,7 +868,7 @@ int url_fopen(AVIOContext **s, const char *filename, int flags) return 0; } -int url_fclose(AVIOContext *s) +int avio_close(AVIOContext *s) { URLContext *h = s->opaque; diff --git a/libavformat/img2.c b/libavformat/img2.c index 56c4850efe..25ed2b32e8 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -269,7 +269,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) s->path, s->img_number)<0 && s->img_number > 1) return AVERROR(EIO); for(i=0; i<3; i++){ - if (url_fopen(&f[i], filename, URL_RDONLY) < 0) { + if (avio_open(&f[i], filename, URL_RDONLY) < 0) { if(i==1) break; av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename); @@ -300,7 +300,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) if(size[i]){ ret[i]= avio_read(f[i], pkt->data + pkt->size, size[i]); if (!s->is_pipe) - url_fclose(f[i]); + avio_close(f[i]); if(ret[i]>0) pkt->size += ret[i]; } @@ -353,7 +353,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EIO); } for(i=0; i<3; i++){ - if (url_fopen(&pb[i], filename, URL_WRONLY) < 0) { + if (avio_open(&pb[i], filename, URL_WRONLY) < 0) { av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename); return AVERROR(EIO); } @@ -373,8 +373,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2); put_flush_packet(pb[1]); put_flush_packet(pb[2]); - url_fclose(pb[1]); - url_fclose(pb[2]); + avio_close(pb[1]); + avio_close(pb[2]); }else{ if(av_str2id(img_tags, s->filename) == CODEC_ID_JPEG2000){ AVStream *st = s->streams[0]; @@ -403,7 +403,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } put_flush_packet(pb[0]); if (!img->is_pipe) { - url_fclose(pb[0]); + avio_close(pb[0]); } img->img_number++; diff --git a/libavformat/mov.c b/libavformat/mov.c index eadb8f8988..6becc77c0c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1718,7 +1718,7 @@ static int mov_open_dref(AVIOContext **pb, char *src, MOVDref *ref) av_strlcat(filename, ref->path + l + 1, 1024); - if (!url_fopen(pb, filename, URL_RDONLY)) + if (!avio_open(pb, filename, URL_RDONLY)) return 0; } } @@ -2546,7 +2546,7 @@ static int mov_read_close(AVFormatContext *s) } av_freep(&sc->drefs); if (sc->pb && sc->pb != s->pb) - url_fclose(sc->pb); + avio_close(sc->pb); av_freep(&st->codec->palctrl); } diff --git a/libavformat/output-example.c b/libavformat/output-example.c index edb5c87243..b6be2b97db 100644 --- a/libavformat/output-example.c +++ b/libavformat/output-example.c @@ -492,7 +492,7 @@ int main(int argc, char **argv) /* open the output file, if needed */ if (!(fmt->flags & AVFMT_NOFILE)) { - if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) { + if (avio_open(&oc->pb, filename, URL_WRONLY) < 0) { fprintf(stderr, "Could not open '%s'\n", filename); exit(1); } @@ -545,7 +545,7 @@ int main(int argc, char **argv) if (!(fmt->flags & AVFMT_NOFILE)) { /* close the output file */ - url_fclose(oc->pb); + avio_close(oc->pb); } /* free the stream */ diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index 63918adf49..84611e690d 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -60,7 +60,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, if (ret) { if (handle) { - url_fclose(rtpctx->pb); + avio_close(rtpctx->pb); } else { uint8_t *ptr; url_close_dyn_buf(rtpctx->pb, &ptr); diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 62311cbb23..a24f12bacf 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -498,7 +498,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s) url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } else { - url_fclose(rtpctx->pb); + avio_close(rtpctx->pb); } avformat_free_context(rtpctx); } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index e79f873e1b..95b8690f3e 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -382,7 +382,7 @@ static int rtsp_read_close(AVFormatContext *s) #if 0 /* NOTE: it is valid to flush the buffer here */ if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) { - url_fclose(&rt->rtsp_gb); + avio_close(&rt->rtsp_gb); } #endif ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL); diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index bd3483e296..bc66adcd77 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -46,7 +46,7 @@ static int sap_write_close(AVFormatContext *s) if (!rtpctx) continue; av_write_trailer(rtpctx); - url_fclose(rtpctx->pb); + avio_close(rtpctx->pb); avformat_free_context(rtpctx); s->streams[i]->priv_data = NULL; } diff --git a/libavformat/utils.c b/libavformat/utils.c index f5d60a3bfc..1f0164ffac 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -616,7 +616,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, hack needed to handle RTSP/TCP */ if (!fmt || !(fmt->flags & AVFMT_NOFILE)) { /* if no file needed do not try to open one */ - if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) { + if ((err=avio_open(&pb, filename, URL_RDONLY)) < 0) { goto fail; } if (buf_size > 0) { @@ -647,7 +647,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, fail: av_freep(&pd->buf); if (pb) - url_fclose(pb); + avio_close(pb); if (ap && ap->prealloced_context) av_free(*ic_ptr); *ic_ptr = NULL; @@ -2623,7 +2623,7 @@ void av_close_input_file(AVFormatContext *s) AVIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; av_close_input_stream(s); if (pb) - url_fclose(pb); + avio_close(pb); } AVStream *av_new_stream(AVFormatContext *s, int id) From 4acc94e97a9551d11ead29735e23283d71f1d4c2 Mon Sep 17 00:00:00 2001 From: longstone Date: Wed, 23 Feb 2011 10:43:21 -0500 Subject: [PATCH 440/528] avienc: fix AVI stream index for files with >10 streams Fixes issue 2563. Signed-off-by: Ronald S. Bultje --- libavformat/avi.h | 1 + libavformat/avienc.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libavformat/avi.h b/libavformat/avi.h index f345c14760..b4e551971a 100644 --- a/libavformat/avi.h +++ b/libavformat/avi.h @@ -32,6 +32,7 @@ #define AVI_MAX_RIFF_SIZE 0x40000000LL #define AVI_MASTER_INDEX_SIZE 256 +#define AVI_MAX_STREAM_COUNT 100 /* index flags */ #define AVIIF_INDEX 0x10 diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 61af511350..e109269fa3 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -85,8 +85,8 @@ static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type) { - tag[0] = '0'; - tag[1] = '0' + index; + tag[0] = '0' + index/10; + tag[1] = '0' + index%10; if (type == AVMEDIA_TYPE_VIDEO) { tag[2] = 'd'; tag[3] = 'c'; @@ -158,6 +158,12 @@ static int avi_write_header(AVFormatContext *s) int64_t list1, list2, strh, strf; AVMetadataTag *t = NULL; + if (s->nb_streams > AVI_MAX_STREAM_COUNT) { + av_log(s, AV_LOG_ERROR, "AVI does not support >%d streams\n", + AVI_MAX_STREAM_COUNT); + return -1; + } + for(n=0;nnb_streams;n++) { s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream)); if(!s->streams[n]->priv_data) From a58bcb40b164b92957db73e702465808a9180126 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:10:58 -0500 Subject: [PATCH 441/528] vmdaudio: fix raw_block_size calculation. The size should depend on the output sample size, not the internal bit depth. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index e396c0bc9e..c7f99dbcb5 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -539,7 +539,8 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, } else if (buf[6] == 2) { /* initial chunk, may contain audio and silence */ uint32_t flags = AV_RB32(p); - int raw_block_size = s->block_align * s->bits / 8; + int raw_block_size = s->block_align * + (av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8); int silent_chunks; if(flags == 0xFFFFFFFF) silent_chunks = 32; From 1328d433137c055df06f99772b243ceec2bbf36e Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:10:59 -0500 Subject: [PATCH 442/528] vmdaudio: remove duplicated code by merging mono and stereo decoding. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index c7f99dbcb5..cbe530dbb4 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -475,19 +475,16 @@ static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data, static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, const uint8_t *buf, int silence, int data_size) { - int bytes_decoded = 0; int i; // if (silence) // av_log(s->avctx, AV_LOG_INFO, "silent block!\n"); - if (s->channels == 2) { - /* stereo handling */ if (silence) { memset(data, 0, data_size * 2); } else { if (s->bits == 16) - vmdaudio_decode_audio(s, data, buf, data_size, 1); + vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2); else { /* copy the data but convert it to signed */ for (i = 0; i < data_size; i++){ @@ -496,24 +493,6 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, } } } - } else { - bytes_decoded = data_size * 2; - - /* mono handling */ - if (silence) { - memset(data, 0, data_size * 2); - } else { - if (s->bits == 16) { - vmdaudio_decode_audio(s, data, buf, data_size, 0); - } else { - /* copy the data but convert it to signed */ - for (i = 0; i < data_size; i++){ - *data++ = buf[i] + 0x80; - *data++ = buf[i] + 0x80; - } - } - } - } return data_size * 2; } From 9b73f786005f31429d7c88092edfeef6696a5f69 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:02 -0500 Subject: [PATCH 443/528] vmdaudio: output audio samples for standalone silent blocks. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 2 +- tests/ref/fate/sierra-vmd | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index cbe530dbb4..c6043e94d2 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -534,7 +534,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, *data_size += vmdaudio_loadsound(s, output_samples, p + 4, 0, buf_size - 20); } else if (buf[6] == 3) { /* silent chunk */ - *data_size = vmdaudio_loadsound(s, output_samples, p, 1, 0); + *data_size = vmdaudio_loadsound(s, output_samples, p, 1, s->block_align); } return buf_size; diff --git a/tests/ref/fate/sierra-vmd b/tests/ref/fate/sierra-vmd index 4d9e4cdd71..fed4c447d7 100644 --- a/tests/ref/fate/sierra-vmd +++ b/tests/ref/fate/sierra-vmd @@ -301,3 +301,32 @@ 1, 1890000, 4410, 0x5d2b15f4 1, 1899000, 4410, 0x48764b7c 1, 1908000, 4410, 0x1294e119 +1, 1917000, 4410, 0x00000000 +1, 1926000, 4410, 0x00000000 +1, 1935000, 4410, 0x00000000 +1, 1944000, 4410, 0x00000000 +1, 1953000, 4410, 0x00000000 +1, 1962000, 4410, 0x00000000 +1, 1971000, 4410, 0x00000000 +1, 1980000, 4410, 0x00000000 +1, 1989000, 4410, 0x00000000 +1, 1998000, 4410, 0x00000000 +1, 2007000, 4410, 0x00000000 +1, 2016000, 4410, 0x00000000 +1, 2025000, 4410, 0x00000000 +1, 2034000, 4410, 0x00000000 +1, 2043000, 4410, 0x00000000 +1, 2052000, 4410, 0x00000000 +1, 2061000, 4410, 0x00000000 +1, 2070000, 4410, 0x00000000 +1, 2079000, 4410, 0x00000000 +1, 2088000, 4410, 0x00000000 +1, 2097000, 4410, 0x00000000 +1, 2106000, 4410, 0x00000000 +1, 2115000, 4410, 0x00000000 +1, 2124000, 4410, 0x00000000 +1, 2133000, 4410, 0x00000000 +1, 2142000, 4410, 0x00000000 +1, 2151000, 4410, 0x00000000 +1, 2160000, 4410, 0x00000000 +1, 2169000, 4410, 0x00000000 From 6989cb2dae85ea455ffcc8a36a763134fb311e29 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:03 -0500 Subject: [PATCH 444/528] vmdaudio: correct the silent chunk count in the first block. This fixes A/V sync with several samples, notably: http://samples.mplayerhq.hu/game-formats/sierra-vmd/swat_*.vmd Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index c6043e94d2..53d40a997c 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -520,11 +520,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, uint32_t flags = AV_RB32(p); int raw_block_size = s->block_align * (av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8); - int silent_chunks; - if(flags == 0xFFFFFFFF) - silent_chunks = 32; - else - silent_chunks = av_log2(flags + 1); + int silent_chunks = av_popcount(flags); if(*data_size < (s->block_align*silent_chunks + buf_size - 20) * 2) return -1; *data_size = 0; From dd1af5136fe7767f2f18ac943efe994946864640 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:04 -0500 Subject: [PATCH 445/528] vmdaudio: use macros and a local variable for block type. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 53d40a997c..a528d91190 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -414,6 +414,10 @@ static av_cold int vmdvideo_decode_end(AVCodecContext *avctx) * Audio Decoder */ +#define BLOCK_TYPE_AUDIO 1 +#define BLOCK_TYPE_INITIAL 2 +#define BLOCK_TYPE_SILENCE 3 + typedef struct VmdAudioContext { AVCodecContext *avctx; int channels; @@ -504,6 +508,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VmdAudioContext *s = avctx->priv_data; + int block_type; unsigned char *output_samples = (unsigned char *)data; /* point to the start of the encoded data */ @@ -512,10 +517,12 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, if (buf_size < 16) return buf_size; - if (buf[6] == 1) { + block_type = buf[6]; + + if (block_type == BLOCK_TYPE_AUDIO) { /* the chunk contains audio */ *data_size = vmdaudio_loadsound(s, output_samples, p, 0, buf_size - 16); - } else if (buf[6] == 2) { + } else if (block_type == BLOCK_TYPE_INITIAL) { /* initial chunk, may contain audio and silence */ uint32_t flags = AV_RB32(p); int raw_block_size = s->block_align * @@ -528,7 +535,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, output_samples += raw_block_size * silent_chunks; *data_size = raw_block_size * silent_chunks; *data_size += vmdaudio_loadsound(s, output_samples, p + 4, 0, buf_size - 20); - } else if (buf[6] == 3) { + } else if (block_type == BLOCK_TYPE_SILENCE) { /* silent chunk */ *data_size = vmdaudio_loadsound(s, output_samples, p, 1, s->block_align); } From 22f893e1c9f9387f0a021f775757130fa48e0180 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:05 -0500 Subject: [PATCH 446/528] vmdaudio: validate block type Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index a528d91190..b338da3904 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -518,6 +518,10 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, return buf_size; block_type = buf[6]; + if (block_type < BLOCK_TYPE_AUDIO || block_type > BLOCK_TYPE_SILENCE) { + av_log(avctx, AV_LOG_ERROR, "unknown block type: %d\n", block_type); + return AVERROR(EINVAL); + } if (block_type == BLOCK_TYPE_AUDIO) { /* the chunk contains audio */ From 7a4fb3fd9357dfdd27431a0a8d7250dab54a9938 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:06 -0500 Subject: [PATCH 447/528] vmdaudio: set *data_size to zero when skipping small packets and add a warning log message. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index b338da3904..1407c96588 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -514,8 +514,11 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, /* point to the start of the encoded data */ const unsigned char *p = buf + 16; - if (buf_size < 16) + if (buf_size < 16) { + av_log(avctx, AV_LOG_WARNING, "skipping small junk packet\n"); + *data_size = 0; return buf_size; + } block_type = buf[6]; if (block_type < BLOCK_TYPE_AUDIO || block_type > BLOCK_TYPE_SILENCE) { From 2d213695fce86e740800ddcf43d8d0864d2ecea5 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:07 -0500 Subject: [PATCH 448/528] vmdaudio: simplify buffer pointer and header size handling. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 1407c96588..5ee4248ab7 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -511,9 +511,6 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, int block_type; unsigned char *output_samples = (unsigned char *)data; - /* point to the start of the encoded data */ - const unsigned char *p = buf + 16; - if (buf_size < 16) { av_log(avctx, AV_LOG_WARNING, "skipping small junk packet\n"); *data_size = 0; @@ -525,29 +522,33 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "unknown block type: %d\n", block_type); return AVERROR(EINVAL); } + buf += 16; + buf_size -= 16; if (block_type == BLOCK_TYPE_AUDIO) { /* the chunk contains audio */ - *data_size = vmdaudio_loadsound(s, output_samples, p, 0, buf_size - 16); + *data_size = vmdaudio_loadsound(s, output_samples, buf, 0, buf_size); } else if (block_type == BLOCK_TYPE_INITIAL) { /* initial chunk, may contain audio and silence */ - uint32_t flags = AV_RB32(p); + uint32_t flags = AV_RB32(buf); int raw_block_size = s->block_align * (av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8); int silent_chunks = av_popcount(flags); - if(*data_size < (s->block_align*silent_chunks + buf_size - 20) * 2) + buf += 4; + buf_size -= 4; + if(*data_size < (s->block_align*silent_chunks + buf_size) * 2) return -1; *data_size = 0; memset(output_samples, 0, raw_block_size * silent_chunks); output_samples += raw_block_size * silent_chunks; *data_size = raw_block_size * silent_chunks; - *data_size += vmdaudio_loadsound(s, output_samples, p + 4, 0, buf_size - 20); + *data_size += vmdaudio_loadsound(s, output_samples, buf, 0, buf_size); } else if (block_type == BLOCK_TYPE_SILENCE) { /* silent chunk */ - *data_size = vmdaudio_loadsound(s, output_samples, p, 1, s->block_align); + *data_size = vmdaudio_loadsound(s, output_samples, buf, 1, s->block_align); } - return buf_size; + return avpkt->size; } From 868f2f4d90e07edd9a65bd9b917bb5940643ec75 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:00 -0500 Subject: [PATCH 449/528] cosmetics: reindent after previous commit Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 5ee4248ab7..e307b533e1 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -484,19 +484,19 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, // if (silence) // av_log(s->avctx, AV_LOG_INFO, "silent block!\n"); - if (silence) { - memset(data, 0, data_size * 2); - } else { - if (s->bits == 16) - vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2); - else { - /* copy the data but convert it to signed */ - for (i = 0; i < data_size; i++){ - *data++ = buf[i] + 0x80; - *data++ = buf[i] + 0x80; - } + if (silence) { + memset(data, 0, data_size * 2); + } else { + if (s->bits == 16) + vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2); + else { + /* copy the data but convert it to signed */ + for (i = 0; i < data_size; i++){ + *data++ = buf[i] + 0x80; + *data++ = buf[i] + 0x80; } } + } return data_size * 2; } From 8e9027d266ef39ab9f88b4bbad5cf9e425d0696c Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:01 -0500 Subject: [PATCH 450/528] cosmetics: remove debugging cruft Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index e307b533e1..48739a726b 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -481,9 +481,6 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, { int i; -// if (silence) -// av_log(s->avctx, AV_LOG_INFO, "silent block!\n"); - if (silence) { memset(data, 0, data_size * 2); } else { From 762b386e4aafc7bbdbec367bc652cf1199e81f51 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:08 -0500 Subject: [PATCH 451/528] vmdaudio: move all silence chunk handling to vmdaudio_loadsound(). Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 48739a726b..b3103ec220 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -477,13 +477,15 @@ static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data, } static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, - const uint8_t *buf, int silence, int data_size) + const uint8_t *buf, int silent_chunks, int data_size) { int i; + int silent_size = s->block_align * silent_chunks * 2; - if (silence) { - memset(data, 0, data_size * 2); - } else { + if (silent_chunks) { + memset(data, 0, silent_size); + data += silent_size; + } if (s->bits == 16) vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2); else { @@ -493,9 +495,8 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, *data++ = buf[i] + 0x80; } } - } - return data_size * 2; + return silent_size + data_size * 2; } static int vmdaudio_decode_frame(AVCodecContext *avctx, @@ -528,21 +529,15 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, } else if (block_type == BLOCK_TYPE_INITIAL) { /* initial chunk, may contain audio and silence */ uint32_t flags = AV_RB32(buf); - int raw_block_size = s->block_align * - (av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8); int silent_chunks = av_popcount(flags); buf += 4; buf_size -= 4; if(*data_size < (s->block_align*silent_chunks + buf_size) * 2) return -1; - *data_size = 0; - memset(output_samples, 0, raw_block_size * silent_chunks); - output_samples += raw_block_size * silent_chunks; - *data_size = raw_block_size * silent_chunks; - *data_size += vmdaudio_loadsound(s, output_samples, buf, 0, buf_size); + *data_size = vmdaudio_loadsound(s, output_samples, buf, silent_chunks, buf_size); } else if (block_type == BLOCK_TYPE_SILENCE) { /* silent chunk */ - *data_size = vmdaudio_loadsound(s, output_samples, buf, 1, s->block_align); + *data_size = vmdaudio_loadsound(s, output_samples, buf, 1, 0); } return avpkt->size; From ba9516cca845f8d3fb7ac08ef53a996c3ee0dbf5 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:09 -0500 Subject: [PATCH 452/528] cosmetics: reindent after previous commit Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index b3103ec220..d0ffa39f78 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -486,15 +486,15 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, memset(data, 0, silent_size); data += silent_size; } - if (s->bits == 16) - vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2); - else { - /* copy the data but convert it to signed */ - for (i = 0; i < data_size; i++){ - *data++ = buf[i] + 0x80; - *data++ = buf[i] + 0x80; - } + if (s->bits == 16) + vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2); + else { + /* copy the data but convert it to signed */ + for (i = 0; i < data_size; i++){ + *data++ = buf[i] + 0x80; + *data++ = buf[i] + 0x80; } + } return silent_size + data_size * 2; } From 1574eff3d23ad799d25454a449b01f94795495ea Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:10 -0500 Subject: [PATCH 453/528] vmdaudio: simplify vmdaudio_decode_frame() by handling block_type first, then making a single call to vmdaudio_loadsound(). This also adds output buffer size checks for AUDIO and SILENCE block types. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index d0ffa39f78..446e2c1dbc 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -506,7 +506,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VmdAudioContext *s = avctx->priv_data; - int block_type; + int block_type, silent_chunks; unsigned char *output_samples = (unsigned char *)data; if (buf_size < 16) { @@ -523,23 +523,23 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, buf += 16; buf_size -= 16; - if (block_type == BLOCK_TYPE_AUDIO) { - /* the chunk contains audio */ - *data_size = vmdaudio_loadsound(s, output_samples, buf, 0, buf_size); - } else if (block_type == BLOCK_TYPE_INITIAL) { - /* initial chunk, may contain audio and silence */ + silent_chunks = 0; + if (block_type == BLOCK_TYPE_INITIAL) { uint32_t flags = AV_RB32(buf); - int silent_chunks = av_popcount(flags); + silent_chunks = av_popcount(flags); buf += 4; buf_size -= 4; - if(*data_size < (s->block_align*silent_chunks + buf_size) * 2) - return -1; - *data_size = vmdaudio_loadsound(s, output_samples, buf, silent_chunks, buf_size); } else if (block_type == BLOCK_TYPE_SILENCE) { - /* silent chunk */ - *data_size = vmdaudio_loadsound(s, output_samples, buf, 1, 0); + silent_chunks = 1; + buf_size = 0; // should already be zero but set it just to be sure } + /* ensure output buffer is large enough */ + if (*data_size < (s->block_align*silent_chunks + buf_size) * 2) + return -1; + + *data_size = vmdaudio_loadsound(s, output_samples, buf, silent_chunks, buf_size); + return avpkt->size; } From 1e86d685e0935077766c645e49b8533d41ca11cb Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:11 -0500 Subject: [PATCH 454/528] vmdaudio: add out_bps to VmdAudioContext and use it to replace hard-coded sample size. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 446e2c1dbc..bd71ae46c7 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -420,6 +420,7 @@ static av_cold int vmdvideo_decode_end(AVCodecContext *avctx) typedef struct VmdAudioContext { AVCodecContext *avctx; + int out_bps; int channels; int bits; int block_align; @@ -451,6 +452,7 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) s->bits = avctx->bits_per_coded_sample; s->block_align = avctx->block_align; avctx->sample_fmt = AV_SAMPLE_FMT_S16; + s->out_bps = av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3; av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n", s->channels, s->bits, s->block_align, avctx->sample_rate); @@ -480,7 +482,7 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, const uint8_t *buf, int silent_chunks, int data_size) { int i; - int silent_size = s->block_align * silent_chunks * 2; + int silent_size = s->block_align * silent_chunks * s->out_bps; if (silent_chunks) { memset(data, 0, silent_size); @@ -496,7 +498,7 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, } } - return silent_size + data_size * 2; + return silent_size + data_size * s->out_bps; } static int vmdaudio_decode_frame(AVCodecContext *avctx, @@ -535,7 +537,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, } /* ensure output buffer is large enough */ - if (*data_size < (s->block_align*silent_chunks + buf_size) * 2) + if (*data_size < (s->block_align*silent_chunks + buf_size) * s->out_bps) return -1; *data_size = vmdaudio_loadsound(s, output_samples, buf, silent_chunks, buf_size); From 2ec7862db8b782020cc220dae827c3438d108b3a Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:12 -0500 Subject: [PATCH 455/528] vmdaudio: remove unnecessary fields from VmdAudioContext and use the corresponding AVCodecContext fields instead. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index bd71ae46c7..88f674a9fd 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -421,9 +421,6 @@ static av_cold int vmdvideo_decode_end(AVCodecContext *avctx) typedef struct VmdAudioContext { AVCodecContext *avctx; int out_bps; - int channels; - int bits; - int block_align; int predictors[2]; } VmdAudioContext; @@ -448,14 +445,13 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) VmdAudioContext *s = avctx->priv_data; s->avctx = avctx; - s->channels = avctx->channels; - s->bits = avctx->bits_per_coded_sample; - s->block_align = avctx->block_align; avctx->sample_fmt = AV_SAMPLE_FMT_S16; s->out_bps = av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3; - av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n", - s->channels, s->bits, s->block_align, avctx->sample_rate); + av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, " + "block align = %d, sample rate = %d\n", + avctx->channels, avctx->bits_per_coded_sample, avctx->block_align, + avctx->sample_rate); return 0; } @@ -482,14 +478,14 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, const uint8_t *buf, int silent_chunks, int data_size) { int i; - int silent_size = s->block_align * silent_chunks * s->out_bps; + int silent_size = s->avctx->block_align * silent_chunks * s->out_bps; if (silent_chunks) { memset(data, 0, silent_size); data += silent_size; } - if (s->bits == 16) - vmdaudio_decode_audio(s, data, buf, data_size, s->channels == 2); + if (s->avctx->bits_per_coded_sample == 16) + vmdaudio_decode_audio(s, data, buf, data_size, s->avctx->channels == 2); else { /* copy the data but convert it to signed */ for (i = 0; i < data_size; i++){ @@ -537,7 +533,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, } /* ensure output buffer is large enough */ - if (*data_size < (s->block_align*silent_chunks + buf_size) * s->out_bps) + if (*data_size < (avctx->block_align*silent_chunks + buf_size) * s->out_bps) return -1; *data_size = vmdaudio_loadsound(s, output_samples, buf, silent_chunks, buf_size); From 1108f8998c6536bb44d6ecbe5adfa18e0c1478e8 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Feb 2011 13:11:13 -0500 Subject: [PATCH 456/528] vmdaudio: output 8-bit audio as AV_SAMPLE_FMT_U8. There is no need to expand to 16-bits. Just use memcpy() to copy the raw data. Signed-off-by: Ronald S. Bultje --- libavcodec/vmdav.c | 15 +- tests/ref/fate/sierra-vmd | 372 +++++++++++++++++++------------------- 2 files changed, 193 insertions(+), 194 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 88f674a9fd..86e3683725 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -445,7 +445,10 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) VmdAudioContext *s = avctx->priv_data; s->avctx = avctx; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; + if (avctx->bits_per_coded_sample == 16) + avctx->sample_fmt = AV_SAMPLE_FMT_S16; + else + avctx->sample_fmt = AV_SAMPLE_FMT_U8; s->out_bps = av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3; av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, " @@ -477,21 +480,17 @@ static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data, static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, const uint8_t *buf, int silent_chunks, int data_size) { - int i; int silent_size = s->avctx->block_align * silent_chunks * s->out_bps; if (silent_chunks) { - memset(data, 0, silent_size); + memset(data, s->out_bps == 2 ? 0x00 : 0x80, silent_size); data += silent_size; } if (s->avctx->bits_per_coded_sample == 16) vmdaudio_decode_audio(s, data, buf, data_size, s->avctx->channels == 2); else { - /* copy the data but convert it to signed */ - for (i = 0; i < data_size; i++){ - *data++ = buf[i] + 0x80; - *data++ = buf[i] + 0x80; - } + /* just copy the data */ + memcpy(data, buf, data_size); } return silent_size + data_size * s->out_bps; diff --git a/tests/ref/fate/sierra-vmd b/tests/ref/fate/sierra-vmd index fed4c447d7..91a8e46548 100644 --- a/tests/ref/fate/sierra-vmd +++ b/tests/ref/fate/sierra-vmd @@ -1,5 +1,5 @@ 0, 0, 230400, 0x0224ab01 -1, 0, 123480, 0xc1059826 +1, 0, 123480, 0x3a794c13 0, 9000, 230400, 0x449e4d81 0, 18000, 230400, 0x3e15e07a 0, 27000, 230400, 0xdabe4172 @@ -27,280 +27,280 @@ 0, 225000, 230400, 0x76aebdae 0, 234000, 230400, 0x81357545 0, 243000, 230400, 0x38baeebd -1, 252000, 4410, 0x261a09c0 +1, 252000, 4410, 0x109d04e0 0, 252000, 230400, 0x1c5c44d4 -1, 261000, 4410, 0x68e9489e +1, 261000, 4410, 0x224d244f 0, 261000, 230400, 0x60e189cc -1, 270000, 4410, 0xb830827a +1, 270000, 4410, 0xbb72413d 0, 270000, 230400, 0xb1f4381c -1, 279000, 4410, 0xb053b70c +1, 279000, 4410, 0xaa5f5b86 0, 279000, 230400, 0xb5048fed -1, 288000, 4410, 0xd8845d5d +1, 288000, 4410, 0x94e7aea7 0, 288000, 230400, 0xc947c30e -1, 297000, 4410, 0xd741f940 +1, 297000, 4410, 0xad497ca0 0, 297000, 230400, 0xe8e31c07 -1, 306000, 4410, 0x4860193c +1, 306000, 4410, 0x1de10c9e 0, 306000, 230400, 0x6d49dd02 -1, 315000, 4410, 0x2e70df5f +1, 315000, 4410, 0x9f55efa8 0, 315000, 230400, 0x293e15d3 -1, 324000, 4410, 0x4b3e0e54 +1, 324000, 4410, 0x220a072a 0, 324000, 230400, 0x354d792e -1, 333000, 4410, 0x4afbf661 +1, 333000, 4410, 0xa7dafb29 0, 333000, 230400, 0x35468780 -1, 342000, 4410, 0x485c3903 +1, 342000, 4410, 0xd5e29c7a 0, 342000, 230400, 0x365d3991 -1, 351000, 4410, 0xc0a1a00c +1, 351000, 4410, 0xb8465006 0, 351000, 230400, 0xc9debef2 -1, 360000, 4410, 0x0ce2d38e +1, 360000, 4410, 0x518669c7 0, 360000, 230400, 0x4c4634c2 -1, 369000, 4410, 0x5b52dfa3 +1, 369000, 4410, 0xb5b5efca 0, 369000, 230400, 0x347c2dca -1, 378000, 4410, 0x0d6c02ba +1, 378000, 4410, 0x8600015d 0, 378000, 230400, 0x1efa0aaa -1, 387000, 4410, 0x55f31fe1 +1, 387000, 4410, 0xe2f68fe9 0, 387000, 230400, 0xa79a0b5a -1, 396000, 4410, 0x7350b1b2 +1, 396000, 4410, 0x8d3458d9 0, 396000, 230400, 0xfdb2dcdb -1, 405000, 4410, 0x2b918eea +1, 405000, 4410, 0xf1ff4775 0, 405000, 230400, 0x42dbea33 -1, 414000, 4410, 0x6df6cf92 +1, 414000, 4410, 0x830f67c9 0, 414000, 230400, 0x2a207e43 -1, 423000, 4410, 0x2ddd1782 +1, 423000, 4410, 0x110e0bc1 0, 423000, 230400, 0x86573783 -1, 432000, 4410, 0x12265e8e +1, 432000, 4410, 0x71682f47 0, 432000, 230400, 0xc3968473 -1, 441000, 4410, 0x00c62139 +1, 441000, 4410, 0x38119095 0, 441000, 230400, 0x8f62a7b4 -1, 450000, 4410, 0xf2579b6c +1, 450000, 4410, 0xd2494db6 0, 450000, 230400, 0x5a2e3073 -1, 459000, 4410, 0x3bc24a12 +1, 459000, 4410, 0x8b552509 0, 459000, 230400, 0xd24f5e2c -1, 468000, 4410, 0x0ce25212 +1, 468000, 4410, 0x71e52909 0, 468000, 230400, 0x1df3c67d -1, 477000, 4410, 0xad70de9a +1, 477000, 4410, 0x9f0a6f4d 0, 477000, 230400, 0xe4fd884d -1, 486000, 4410, 0x232705e4 +1, 486000, 4410, 0x901302f2 0, 486000, 230400, 0x9a228555 -1, 495000, 4410, 0x5ceba444 +1, 495000, 4410, 0x855d5222 0, 495000, 230400, 0x9eba8ed5 -1, 504000, 4410, 0x17a3660b +1, 504000, 4410, 0x324bb2fe 0, 504000, 230400, 0x3d808a3d -1, 513000, 4410, 0x291bb07e +1, 513000, 4410, 0xe85f583f 0, 513000, 230400, 0xf57e866d -1, 522000, 4410, 0xc13ccf88 +1, 522000, 4410, 0x2cbc67c4 0, 522000, 230400, 0x85f594f5 -1, 531000, 4410, 0xfb0cd542 +1, 531000, 4410, 0xc82e6aa1 0, 531000, 230400, 0xb09f99dd -1, 540000, 4410, 0xb6438478 +1, 540000, 4410, 0xb9fc423c 0, 540000, 230400, 0x2b368475 -1, 549000, 4410, 0x263e9df2 +1, 549000, 4410, 0x6b9b4ef9 0, 549000, 230400, 0xa2417afd -1, 558000, 4410, 0x81621e20 +1, 558000, 4410, 0x39290f10 0, 558000, 230400, 0x590b709d -1, 567000, 4410, 0xe9a51d77 +1, 567000, 4410, 0xad718eb4 0, 567000, 230400, 0x5d617705 -1, 576000, 4410, 0x69a3c758 +1, 576000, 4410, 0x82f463ac 0, 576000, 230400, 0xabf981ad -1, 585000, 4410, 0x725af958 +1, 585000, 4410, 0xfac87cac 0, 585000, 230400, 0x5a8590cd -1, 594000, 4410, 0x09db995d +1, 594000, 4410, 0x9e8bcca7 0, 594000, 230400, 0x1bff853d -1, 603000, 4410, 0x42963941 +1, 603000, 4410, 0x52f79c99 0, 603000, 230400, 0x71d08055 -1, 612000, 4410, 0x33a29bc4 +1, 612000, 4410, 0xf2d14de2 0, 612000, 230400, 0x2ebd817d -1, 621000, 4410, 0x02ee2bd1 +1, 621000, 4410, 0x367f95e1 0, 621000, 230400, 0x6e838255 -1, 630000, 4410, 0xda968535 +1, 630000, 4410, 0x8bfac293 0, 630000, 230400, 0x043984cd -1, 639000, 4410, 0x5414a080 +1, 639000, 4410, 0x01ea5040 0, 639000, 230400, 0x7ff18495 -1, 648000, 4410, 0x021ac433 +1, 648000, 4410, 0x8ff5e212 0, 648000, 230400, 0xa43b8385 -1, 657000, 4410, 0x50195048 +1, 657000, 4410, 0x93f32824 0, 657000, 230400, 0x72b5825d -1, 666000, 4410, 0xc40921c7 +1, 666000, 4410, 0x998f90dc 0, 666000, 230400, 0x3a178085 -1, 675000, 4410, 0xdbb622e0 +1, 675000, 4410, 0x65231170 0, 675000, 230400, 0x67748245 -1, 684000, 4410, 0xc8d07342 +1, 684000, 4410, 0xc79039a1 0, 684000, 230400, 0xeddf81d5 -1, 693000, 4410, 0x6ed9b17a +1, 693000, 4410, 0x0b0e58bd 0, 693000, 230400, 0x8b088665 -1, 702000, 4410, 0x39ac6a03 +1, 702000, 4410, 0xc24ab4fa 0, 702000, 230400, 0x6c408e15 -1, 711000, 4410, 0x119ed51c +1, 711000, 4410, 0xd3796a8e 0, 711000, 230400, 0x81f196dd -1, 720000, 4410, 0xc9a20539 +1, 720000, 4410, 0xa37f8295 0, 720000, 230400, 0xab9f953d -1, 729000, 4410, 0x6db5fdbd +1, 729000, 4410, 0xb760fed7 0, 729000, 230400, 0xa5f69795 -1, 738000, 4410, 0x64c6b468 +1, 738000, 4410, 0x05495a34 0, 738000, 230400, 0xa772950d -1, 747000, 4410, 0x1286686e +1, 747000, 4410, 0x6f203437 0, 747000, 230400, 0x6a5596d5 -1, 756000, 4410, 0x76632813 +1, 756000, 4410, 0x71299402 0, 756000, 230400, 0x1355958d -1, 765000, 4410, 0x9923669b +1, 765000, 4410, 0x72e7b346 0, 765000, 230400, 0x4134981d -1, 774000, 4410, 0x1cf31b5c +1, 774000, 4410, 0x879b0dae 0, 774000, 230400, 0x8b929515 -1, 783000, 4410, 0xa9f14389 +1, 783000, 4410, 0x041aa1bd 0, 783000, 230400, 0x482f95c5 -1, 792000, 4410, 0x9438c5cc +1, 792000, 4410, 0x18a962e6 0, 792000, 230400, 0x7a9795d5 -1, 801000, 4410, 0x48dd0a72 +1, 801000, 4410, 0x21d20539 0, 801000, 230400, 0x21c29abd -1, 810000, 4410, 0xb0fe24dd +1, 810000, 4410, 0x8f449267 0, 810000, 230400, 0x9ae6a475 -1, 819000, 4410, 0xdb9d03ac +1, 819000, 4410, 0xecdc01d6 0, 819000, 230400, 0x3734aee5 -1, 828000, 4410, 0x487d7ac3 +1, 828000, 4410, 0x458abd5a 0, 828000, 230400, 0xa0a1b365 -1, 837000, 4410, 0x2b61d4d5 +1, 837000, 4410, 0xa070ea63 0, 837000, 230400, 0x2dcab1c5 -1, 846000, 4410, 0xab934d9c +1, 846000, 4410, 0xc25b26ce 0, 846000, 230400, 0x9c8b6c44 -1, 855000, 4410, 0xd2ee6f94 +1, 855000, 4410, 0x4d9237ca 0, 855000, 230400, 0x5da75feb -1, 864000, 4410, 0x012c3002 +1, 864000, 4410, 0x748e1801 0, 864000, 230400, 0x4d02f8e3 -1, 873000, 4410, 0xfccbd3cc +1, 873000, 4410, 0xc96b69e6 0, 873000, 230400, 0x66824f3a -1, 882000, 4410, 0xe53230d8 +1, 882000, 4410, 0x6663186c 0, 882000, 230400, 0x0c9257e2 -1, 891000, 4410, 0x2f6a6102 +1, 891000, 4410, 0x7f6d3081 0, 891000, 230400, 0xb2927092 -1, 900000, 4410, 0x77bb876a +1, 900000, 4410, 0x1a0343b5 0, 900000, 230400, 0xb5dc6e9a -1, 909000, 4410, 0xbcb76718 +1, 909000, 4410, 0xc48e338c 0, 909000, 230400, 0x6e567bc6 -1, 918000, 4410, 0x51c00790 +1, 918000, 4410, 0x26fc03c8 0, 918000, 230400, 0xbf9e0f7a -1, 927000, 4410, 0x51b8fc5a +1, 927000, 4410, 0x69be7e2d 0, 927000, 230400, 0xb16f684a -1, 936000, 4410, 0x20fe9b42 +1, 936000, 4410, 0x69a74da1 0, 936000, 230400, 0xf9e55e81 -1, 945000, 4410, 0x363c5566 +1, 945000, 4410, 0x85bd2ab3 0, 945000, 230400, 0xd8d0bcba -1, 954000, 4410, 0x3424a84c +1, 954000, 4410, 0xeff05426 0, 954000, 230400, 0x44720ac0 -1, 963000, 4410, 0x7c3053c0 +1, 963000, 4410, 0x292829e0 0, 963000, 230400, 0x7d4c2058 -1, 972000, 4410, 0x368f2f30 +1, 972000, 4410, 0x8f741798 0, 972000, 230400, 0xb0973eb9 -1, 981000, 4410, 0x0f1e6fd2 +1, 981000, 4410, 0x6b9337e9 0, 981000, 230400, 0x405a13ce -1, 990000, 4410, 0x3a1fe07e +1, 990000, 4410, 0xe4e1703f 0, 990000, 230400, 0x6422f00a -1, 999000, 4410, 0x74afd86a +1, 999000, 4410, 0x043d6c35 0, 999000, 230400, 0x924b6c1e -1, 1008000, 4410, 0xfdf911dd +1, 1008000, 4410, 0x3a8988e7 0, 1008000, 230400, 0xcf7809c0 -1, 1017000, 4410, 0x1206a561 +1, 1017000, 4410, 0x1fa7d2a9 0, 1017000, 230400, 0x883a3863 -1, 1026000, 4410, 0x5f0f33d5 +1, 1026000, 4410, 0xe28799e3 0, 1026000, 230400, 0x6adc9e03 -1, 1035000, 4410, 0xca3d88e0 +1, 1035000, 4410, 0xc2df4470 0, 1035000, 230400, 0x4f5ab7a8 -1, 1044000, 4410, 0xdf8f19ea +1, 1044000, 4410, 0x694d0cf5 0, 1044000, 230400, 0xdc0aab94 -1, 1053000, 4410, 0xe3275b9e -1, 1062000, 4410, 0xee1945c5 -1, 1071000, 4410, 0x0afbd006 -1, 1080000, 4410, 0x90ff8f14 -1, 1089000, 4410, 0xfc0c887a -1, 1098000, 4410, 0xae9bc232 -1, 1107000, 4410, 0x5f688eb8 -1, 1116000, 4410, 0x9a307469 -1, 1125000, 4410, 0x27f1e324 -1, 1134000, 4410, 0x0c0d4ca2 -1, 1143000, 4410, 0xd7e8ce74 -1, 1152000, 4410, 0x16a4bfd6 -1, 1161000, 4410, 0xbfb02f6d -1, 1170000, 4410, 0xf4b81a79 -1, 1179000, 4410, 0x05d97288 -1, 1188000, 4410, 0x3a7db4be -1, 1197000, 4410, 0xc6bea83e -1, 1206000, 4410, 0x436f62ed -1, 1215000, 4410, 0x6fabea0c -1, 1224000, 4410, 0x954878aa -1, 1233000, 4410, 0x4d10f579 -1, 1242000, 4410, 0xac65932a -1, 1251000, 4410, 0x6889f957 -1, 1260000, 4410, 0x65cf5830 -1, 1269000, 4410, 0x87a7af71 -1, 1278000, 4410, 0x82378c13 -1, 1287000, 4410, 0x88ab6bd5 -1, 1296000, 4410, 0xf90a3342 -1, 1305000, 4410, 0xd790a1bc -1, 1314000, 4410, 0x89919d7c -1, 1323000, 4410, 0x7ffb22bf -1, 1332000, 4410, 0xfefbcce3 -1, 1341000, 4410, 0x07714e80 -1, 1350000, 4410, 0x73078f53 -1, 1359000, 4410, 0x35c23078 -1, 1368000, 4410, 0x452538bb -1, 1377000, 4410, 0x61493f33 -1, 1386000, 4410, 0x2137c390 -1, 1395000, 4410, 0x78c9393f -1, 1404000, 4410, 0x7aeaf8e1 -1, 1413000, 4410, 0x4bb8da1c -1, 1422000, 4410, 0x5995dfc2 -1, 1431000, 4410, 0xccce8872 -1, 1440000, 4410, 0xca2753a4 -1, 1449000, 4410, 0x4296ff6d -1, 1458000, 4410, 0xe582d191 -1, 1467000, 4410, 0xc40268da -1, 1476000, 4410, 0xda1d475e -1, 1485000, 4410, 0x5e91e4e0 -1, 1494000, 4410, 0xfeb44475 -1, 1503000, 4410, 0x17ff8e38 -1, 1512000, 4410, 0x3bd58bcf -1, 1521000, 4410, 0x9476e23c -1, 1530000, 4410, 0x440651ab -1, 1539000, 4410, 0xb08cdc74 -1, 1548000, 4410, 0x6fc3031f -1, 1557000, 4410, 0x197ab39a -1, 1566000, 4410, 0xf92f0e3d -1, 1575000, 4410, 0xd5f6b678 -1, 1584000, 4410, 0x8af127a6 -1, 1593000, 4410, 0xe22f585e -1, 1602000, 4410, 0x67515610 -1, 1611000, 4410, 0x21569d7a -1, 1620000, 4410, 0x114597d8 -1, 1629000, 4410, 0xba213fb6 -1, 1638000, 4410, 0x1aca9fee -1, 1647000, 4410, 0x48cdd264 -1, 1656000, 4410, 0x533619ec -1, 1665000, 4410, 0x21466244 -1, 1674000, 4410, 0x26e00e88 -1, 1683000, 4410, 0x8e51d07c -1, 1692000, 4410, 0xa6c4048a -1, 1701000, 4410, 0x98ce10e4 -1, 1710000, 4410, 0x379bc8c2 -1, 1719000, 4410, 0x404b09c6 -1, 1728000, 4410, 0xfc89da8a -1, 1737000, 4410, 0xbdbe6914 -1, 1746000, 4410, 0x2cb09f08 -1, 1755000, 4410, 0x835bf2d9 -1, 1764000, 4410, 0xa4611790 -1, 1773000, 4410, 0x67740896 -1, 1782000, 4410, 0x489f6bd0 -1, 1791000, 4410, 0x072bae9c -1, 1800000, 4410, 0xadce5a89 -1, 1809000, 4410, 0x209f2c2c -1, 1818000, 4410, 0xf5706665 -1, 1827000, 4410, 0x631841cb -1, 1836000, 4410, 0xa1a2c65f -1, 1845000, 4410, 0x8818b96b -1, 1854000, 4410, 0x63158025 -1, 1863000, 4410, 0xf6ae79f5 -1, 1872000, 4410, 0xb3dcd214 -1, 1881000, 4410, 0x7a745449 -1, 1890000, 4410, 0x5d2b15f4 -1, 1899000, 4410, 0x48764b7c -1, 1908000, 4410, 0x1294e119 +1, 1053000, 4410, 0x5aac2dcf +1, 1062000, 4410, 0x259fa2db +1, 1071000, 4410, 0xd16d6803 +1, 1080000, 4410, 0xa4b3478a +1, 1089000, 4410, 0xdbe0443d +1, 1098000, 4410, 0x26c16119 +1, 1107000, 4410, 0x0c06475c +1, 1116000, 4410, 0x6ffaba2d +1, 1125000, 4410, 0x5b287192 +1, 1134000, 4410, 0xf2cf2651 +1, 1143000, 4410, 0x3857673a +1, 1152000, 4410, 0x5b555feb +1, 1161000, 4410, 0x93f997af +1, 1170000, 4410, 0xb3ba8d35 +1, 1179000, 4410, 0x66433944 +1, 1188000, 4410, 0xf0005a5f +1, 1197000, 4410, 0xb948541f +1, 1206000, 4410, 0xc8f1b16f +1, 1215000, 4410, 0x7d4b7506 +1, 1224000, 4410, 0xac723c55 +1, 1233000, 4410, 0x2926fab5 +1, 1242000, 4410, 0x31684995 +1, 1251000, 4410, 0x35ebfca4 +1, 1260000, 4410, 0x9cd42c18 +1, 1269000, 4410, 0xd7ecd7b1 +1, 1278000, 4410, 0x5e13c602 +1, 1287000, 4410, 0xe955b5e3 +1, 1296000, 4410, 0xefad19a1 +1, 1305000, 4410, 0x435950de +1, 1314000, 4410, 0x9d624ebe +1, 1323000, 4410, 0x774a9158 +1, 1332000, 4410, 0x8c41e66a +1, 1341000, 4410, 0x70112740 +1, 1350000, 4410, 0x55abc7a2 +1, 1359000, 4410, 0x0ec3183c +1, 1368000, 4410, 0x54609c56 +1, 1377000, 4410, 0x60d49f92 +1, 1386000, 4410, 0x5fb061c8 +1, 1395000, 4410, 0x6e119c98 +1, 1404000, 4410, 0x3f39fc69 +1, 1413000, 4410, 0xef466d0e +1, 1422000, 4410, 0xf4cb6fe1 +1, 1431000, 4410, 0xc4434439 +1, 1440000, 4410, 0xd02329d2 +1, 1449000, 4410, 0x216cffaf +1, 1458000, 4410, 0x7e59e8c1 +1, 1467000, 4410, 0xc7c3346d +1, 1476000, 4410, 0x5b3723af +1, 1485000, 4410, 0x76097270 +1, 1494000, 4410, 0xae39a233 +1, 1503000, 4410, 0x686a471c +1, 1512000, 4410, 0x3af3c5e0 +1, 1521000, 4410, 0x11ac711e +1, 1530000, 4410, 0xcd8da8ce +1, 1539000, 4410, 0x21296e3a +1, 1548000, 4410, 0x77168188 +1, 1557000, 4410, 0x5fcf59cd +1, 1566000, 4410, 0x390c8717 +1, 1575000, 4410, 0x3d5d5b3c +1, 1584000, 4410, 0x3b8f13d3 +1, 1593000, 4410, 0x5b002c2f +1, 1602000, 4410, 0x9e1d2b08 +1, 1611000, 4410, 0x69454ebd +1, 1620000, 4410, 0x62a54bec +1, 1629000, 4410, 0x4d231fdb +1, 1638000, 4410, 0x65624ff7 +1, 1647000, 4410, 0x6fc66932 +1, 1656000, 4410, 0x23200cf6 +1, 1665000, 4410, 0xf8033122 +1, 1674000, 4410, 0x0fce0744 +1, 1683000, 4410, 0x9302683e +1, 1692000, 4410, 0xd2380245 +1, 1701000, 4410, 0x482e0872 +1, 1710000, 4410, 0xe98e6461 +1, 1719000, 4410, 0x1db404e3 +1, 1728000, 4410, 0x47a26d45 +1, 1737000, 4410, 0x449a348a +1, 1746000, 4410, 0xee874f84 +1, 1755000, 4410, 0xc4ecf965 +1, 1764000, 4410, 0xcc450bc8 +1, 1773000, 4410, 0xb18d044b +1, 1782000, 4410, 0x895435e8 +1, 1791000, 4410, 0x57e7574e +1, 1800000, 4410, 0x8041ad3d +1, 1809000, 4410, 0x853d1616 +1, 1818000, 4410, 0xa11bb32b +1, 1827000, 4410, 0xe10ea0de +1, 1836000, 4410, 0xdf2ee328 +1, 1845000, 4410, 0xd5a6dcae +1, 1854000, 4410, 0xd176c00b +1, 1863000, 4410, 0x9cd6bcf3 +1, 1872000, 4410, 0x2569690a +1, 1881000, 4410, 0x6824aa1d +1, 1890000, 4410, 0xa9110afa +1, 1899000, 4410, 0x115c25be +1, 1908000, 4410, 0x1100f085 1, 1917000, 4410, 0x00000000 1, 1926000, 4410, 0x00000000 1, 1935000, 4410, 0x00000000 From 7e06e0ede3b798f591634b277e8dfa6507b196de Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Fri, 18 Feb 2011 19:49:44 +0000 Subject: [PATCH 457/528] dca: use EXT_AUDIO_ID field to determine core extensions This avoids the core substream extensions scan when the EXT_AUDIO_ID field indicates no extensions or only unsupported extensions. The scan is done only if the value of EXT_AUDIO_ID is unknown or indicates a present XCh extension which we can decode. Signed-off-by: Mans Rullgard --- libavcodec/dca.c | 71 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/libavcodec/dca.c b/libavcodec/dca.c index bdbe018be2..14b0b2d10a 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -99,6 +99,21 @@ enum DCAExtensionMask { DCA_EXT_EXSS_XLL = 0x200, ///< lossless extension in ExSS }; +/* -1 are reserved or unknown */ +static const int dca_ext_audio_descr_mask[] = { + DCA_EXT_XCH, + -1, + DCA_EXT_X96, + DCA_EXT_XCH | DCA_EXT_X96, + -1, + -1, + DCA_EXT_XXCH, + -1, +}; + +/* extensions that reside in core substream */ +#define DCA_CORE_EXTS (DCA_EXT_XCH | DCA_EXT_XXCH | DCA_EXT_X96) + /* Tables for mapping dts channel configurations to libavcodec multichannel api. * Some compromises have been made for special configurations. Most configurations * are never used so complete accuracy is not needed. @@ -327,13 +342,11 @@ typedef struct { int current_subframe; int current_subsubframe; - /* XCh extension information */ - int xch_present; - int xch_base_channel; ///< index of first (only) channel containing XCH data + int core_ext_mask; ///< present extensions in the core substream - /* Other detected extensions in the core substream */ - int xxch_present; - int x96_present; + /* XCh extension information */ + int xch_present; ///< XCh extension present and valid + int xch_base_channel; ///< index of first (only) channel containing XCH data /* ExSS header parser */ int static_fields; ///< static fields present @@ -1508,12 +1521,9 @@ static int dca_exss_parse_asset_header(DCAContext *s) if (!(extensions_mask & DCA_EXT_CORE)) av_log(s->avctx, AV_LOG_WARNING, "DTS core detection mismatch.\n"); - if (!!(extensions_mask & DCA_EXT_XCH) != s->xch_present) - av_log(s->avctx, AV_LOG_WARNING, "DTS XCh detection mismatch.\n"); - if (!!(extensions_mask & DCA_EXT_XXCH) != s->xxch_present) - av_log(s->avctx, AV_LOG_WARNING, "DTS XXCh detection mismatch.\n"); - if (!!(extensions_mask & DCA_EXT_X96) != s->x96_present) - av_log(s->avctx, AV_LOG_WARNING, "DTS X96 detection mismatch.\n"); + if ((extensions_mask & DCA_CORE_EXTS) != s->core_ext_mask) + av_log(s->avctx, AV_LOG_WARNING, "DTS extensions detection mismatch (%d, %d)\n", + extensions_mask & DCA_CORE_EXTS, s->core_ext_mask); return 0; } @@ -1623,8 +1633,6 @@ static int dca_decode_frame(AVCodecContext * avctx, s->xch_present = 0; - s->x96_present = 0; - s->xxch_present = 0; s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); @@ -1652,11 +1660,24 @@ static int dca_decode_frame(AVCodecContext * avctx, /* record number of core channels incase less than max channels are requested */ num_core_channels = s->prim_channels; - /* extensions start at 32-bit boundaries into bitstream */ - skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); + if (s->ext_coding) + s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr]; + else + s->core_ext_mask = 0; core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8; + /* only scan for extensions if ext_descr was unknown or indicated a + * supported XCh extension */ + if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) { + + /* if ext_descr was unknown, clear s->core_ext_mask so that the + * extensions scan can fill it up */ + s->core_ext_mask = FFMAX(s->core_ext_mask, 0); + + /* extensions start at 32-bit boundaries into bitstream */ + skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); + while(core_ss_end - get_bits_count(&s->gb) >= 32) { uint32_t bits = get_bits_long(&s->gb, 32); @@ -1675,7 +1696,7 @@ static int dca_decode_frame(AVCodecContext * avctx, /* skip length-to-end-of-frame field for the moment */ skip_bits(&s->gb, 10); - s->profile = FFMAX(s->profile, FF_PROFILE_DTS_ES); + s->core_ext_mask |= DCA_EXT_XCH; /* extension amode should == 1, number of channels in extension */ /* AFAIK XCh is not used for more channels */ @@ -1699,8 +1720,7 @@ static int dca_decode_frame(AVCodecContext * avctx, /* XXCh: extended channels */ /* usually found either in core or HD part in DTS-HD HRA streams, * but not in DTS-ES which contains XCh extensions instead */ - s->xxch_present = 1; - s->profile = FFMAX(s->profile, FF_PROFILE_DTS_ES); + s->core_ext_mask |= DCA_EXT_XXCH; break; case 0x1d95f262: { @@ -1713,8 +1733,7 @@ static int dca_decode_frame(AVCodecContext * avctx, av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96); av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4)); - s->x96_present = 1; - s->profile = FFMAX(s->profile, FF_PROFILE_DTS_96_24); + s->core_ext_mask |= DCA_EXT_X96; break; } } @@ -1722,6 +1741,16 @@ static int dca_decode_frame(AVCodecContext * avctx, skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); } + } else { + /* no supported extensions, skip the rest of the core substream */ + skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb)); + } + + if (s->core_ext_mask & DCA_EXT_X96) + s->profile = FF_PROFILE_DTS_96_24; + else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) + s->profile = FF_PROFILE_DTS_ES; + /* check for ExSS (HD part) */ if (s->dca_buffer_size - s->frame_size > 32 && get_bits_long(&s->gb, 32) == DCA_HD_MARKER) From 0abdb2931719d96dee725e555e9b46b2b2f8a6be Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 24 Feb 2011 07:36:02 +0100 Subject: [PATCH 458/528] lavf: use a new ffio_wfourcc macro instead of put_tag() where possible Signed-off-by: Ronald S. Bultje --- libavformat/aiffenc.c | 11 +- libavformat/au.c | 3 +- libavformat/avienc.c | 39 +++---- libavformat/avio_internal.h | 2 + libavformat/img2.c | 9 +- libavformat/mmf.c | 5 +- libavformat/movenc.c | 215 ++++++++++++++++++------------------ libavformat/oggenc.c | 3 +- libavformat/riff.c | 3 +- libavformat/rmenc.c | 18 +-- libavformat/soxenc.c | 5 +- libavformat/wav.c | 5 +- 12 files changed, 166 insertions(+), 152 deletions(-) diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index 49aff8bd78..de88382e67 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -21,6 +21,7 @@ #include "avformat.h" #include "aiff.h" +#include "avio_internal.h" typedef struct { int64_t form; @@ -43,10 +44,10 @@ static int aiff_write_header(AVFormatContext *s) aifc = 1; /* FORM AIFF header */ - put_tag(pb, "FORM"); + ffio_wfourcc(pb, "FORM"); aiff->form = url_ftell(pb); avio_wb32(pb, 0); /* file length */ - put_tag(pb, aifc ? "AIFC" : "AIFF"); + ffio_wfourcc(pb, aifc ? "AIFC" : "AIFF"); if (aifc) { // compressed audio enc->bits_per_coded_sample = 16; @@ -55,13 +56,13 @@ static int aiff_write_header(AVFormatContext *s) return -1; } /* Version chunk */ - put_tag(pb, "FVER"); + ffio_wfourcc(pb, "FVER"); avio_wb32(pb, 4); avio_wb32(pb, 0xA2805140); } /* Common chunk */ - put_tag(pb, "COMM"); + ffio_wfourcc(pb, "COMM"); avio_wb32(pb, aifc ? 24 : 18); /* size */ avio_wb16(pb, enc->channels); /* Number of channels */ @@ -88,7 +89,7 @@ static int aiff_write_header(AVFormatContext *s) } /* Sound data chunk */ - put_tag(pb, "SSND"); + ffio_wfourcc(pb, "SSND"); aiff->ssnd = url_ftell(pb); /* Sound chunk size */ avio_wb32(pb, 0); /* Sound samples data size */ avio_wb32(pb, 0); /* Data offset */ diff --git a/libavformat/au.c b/libavformat/au.c index 486c514087..9aed1dcaf3 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -28,6 +28,7 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "pcm.h" #include "riff.h" @@ -53,7 +54,7 @@ static int put_au_header(AVIOContext *pb, AVCodecContext *enc) { if(!enc->codec_tag) return -1; - put_tag(pb, ".snd"); /* magic number */ + ffio_wfourcc(pb, ".snd"); /* magic number */ avio_wb32(pb, 24); /* header size */ avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */ avio_wb32(pb, (uint32_t)enc->codec_tag); /* codec ID */ diff --git a/libavformat/avienc.c b/libavformat/avienc.c index e109269fa3..24acc9297c 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -20,6 +20,7 @@ */ #include "avformat.h" #include "avi.h" +#include "avio_internal.h" #include "riff.h" #include "libavutil/intreadwrite.h" @@ -77,9 +78,9 @@ static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, } avi->riff_start = ff_start_tag(pb, "RIFF"); - put_tag(pb, riff_tag); + ffio_wfourcc(pb, riff_tag); loff = ff_start_tag(pb, "LIST"); - put_tag(pb, list_tag); + ffio_wfourcc(pb, list_tag); return loff; } @@ -107,7 +108,7 @@ static void avi_write_info_tag(AVIOContext *pb, const char *tag, const char *str int len = strlen(str); if (len > 0) { len++; - put_tag(pb, tag); + ffio_wfourcc(pb, tag); avio_wl32(pb, len); avio_put_str(pb, str); if (len & 1) @@ -175,7 +176,7 @@ static int avi_write_header(AVFormatContext *s) list1 = avi_start_new_riff(s, pb, "AVI ", "hdrl"); /* avi header */ - put_tag(pb, "avih"); + ffio_wfourcc(pb, "avih"); avio_wl32(pb, 14 * 4); bitrate = 0; @@ -221,7 +222,7 @@ static int avi_write_header(AVFormatContext *s) for(i=0;istreams[i]->priv_data; list2 = ff_start_tag(pb, "LIST"); - put_tag(pb, "strl"); + ffio_wfourcc(pb, "strl"); stream = s->streams[i]->codec; @@ -235,10 +236,10 @@ static int avi_write_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n"); return AVERROR_PATCHWELCOME; } - case AVMEDIA_TYPE_VIDEO: put_tag(pb, "vids"); break; - case AVMEDIA_TYPE_AUDIO: put_tag(pb, "auds"); break; -// case AVMEDIA_TYPE_TEXT : put_tag(pb, "txts"); break; - case AVMEDIA_TYPE_DATA : put_tag(pb, "dats"); break; + case AVMEDIA_TYPE_VIDEO: ffio_wfourcc(pb, "vids"); break; + case AVMEDIA_TYPE_AUDIO: ffio_wfourcc(pb, "auds"); break; +// case AVMEDIA_TYPE_TEXT : ffio_wfourcc(pb, "txts"); break; + case AVMEDIA_TYPE_DATA : ffio_wfourcc(pb, "dats"); break; } if(stream->codec_type == AVMEDIA_TYPE_VIDEO || stream->codec_id == CODEC_ID_XSUB) @@ -317,7 +318,7 @@ static int avi_write_header(AVFormatContext *s) avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */ avio_w8(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ avio_wl32(pb, 0); /* nEntriesInUse (will fill out later on) */ - put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type)); + ffio_wfourcc(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type)); /* dwChunkId */ avio_wl64(pb, 0); /* dwReserved[3] avio_wl32(pb, 0); Must be 0. */ @@ -364,8 +365,8 @@ static int avi_write_header(AVFormatContext *s) if (!url_is_streamed(pb)) { /* AVI could become an OpenDML one, if it grows beyond 2Gb range */ avi->odml_list = ff_start_tag(pb, "JUNK"); - put_tag(pb, "odml"); - put_tag(pb, "dmlh"); + ffio_wfourcc(pb, "odml"); + ffio_wfourcc(pb, "dmlh"); avio_wl32(pb, 248); for (i = 0; i < 248; i+= 4) avio_wl32(pb, 0); @@ -375,7 +376,7 @@ static int avi_write_header(AVFormatContext *s) ff_end_tag(pb, list1); list2 = ff_start_tag(pb, "LIST"); - put_tag(pb, "INFO"); + ffio_wfourcc(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))) @@ -390,7 +391,7 @@ static int avi_write_header(AVFormatContext *s) ff_end_tag(pb, list2); avi->movi_list = ff_start_tag(pb, "LIST"); - put_tag(pb, "movi"); + ffio_wfourcc(pb, "movi"); put_flush_packet(pb); @@ -419,7 +420,7 @@ static int avi_write_ix(AVFormatContext *s) /* Writing AVI OpenDML leaf index chunk */ ix = url_ftell(pb); - put_tag(pb, &ix_tag[0]); /* ix?? */ + ffio_wfourcc(pb, &ix_tag[0]); /* ix?? */ avio_wl32(pb, avist->indexes.entry * 8 + 24); /* chunk size */ avio_wl16(pb, 2); /* wLongsPerEntry */ @@ -427,7 +428,7 @@ static int avi_write_ix(AVFormatContext *s) avio_w8(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ avio_wl32(pb, avist->indexes.entry); /* nEntriesInUse */ - put_tag(pb, &tag[0]); /* dwChunkId */ + ffio_wfourcc(pb, &tag[0]); /* dwChunkId */ avio_wl64(pb, avi->movi_list);/* qwBaseOffset */ avio_wl32(pb, 0); /* dwReserved_3 (must be 0) */ @@ -442,7 +443,7 @@ static int avi_write_ix(AVFormatContext *s) /* Updating one entry in the AVI OpenDML master index */ url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET); - put_tag(pb, "indx"); /* enabling this entry */ + ffio_wfourcc(pb, "indx"); /* enabling this entry */ url_fskip(pb, 8); avio_wl32(pb, avi->riff_id); /* nEntriesInUse */ url_fskip(pb, 16*avi->riff_id); @@ -492,7 +493,7 @@ static int avi_write_idx1(AVFormatContext *s) avist= s->streams[stream_id]->priv_data; avi_stream2fourcc(&tag[0], stream_id, s->streams[stream_id]->codec->codec_type); - put_tag(pb, &tag[0]); + ffio_wfourcc(pb, &tag[0]); avio_wl32(pb, ie->flags); avio_wl32(pb, ie->pos); avio_wl32(pb, ie->len); @@ -601,7 +602,7 @@ static int avi_write_trailer(AVFormatContext *s) file_size = url_ftell(pb); url_fseek(pb, avi->odml_list - 8, SEEK_SET); - put_tag(pb, "LIST"); /* Making this AVI OpenDML one */ + ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */ url_fskip(pb, 16); for (n=nb_frames=0;nnb_streams;n++) { diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 85e7f069e2..3b38990f56 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -42,4 +42,6 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size); void ffio_fill(AVIOContext *s, int b, int count); +#define ffio_wfourcc(pb, str) avio_wl32(pb, MKTAG((str)[0], (str)[1], (str)[2], (str)[3])) + #endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/libavformat/img2.c b/libavformat/img2.c index 25ed2b32e8..a9a4a49023 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -23,6 +23,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/avstring.h" #include "avformat.h" +#include "avio_internal.h" #include typedef struct { @@ -383,13 +384,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c')) goto error; avio_wb32(pb[0], 12); - put_tag (pb[0], "jP "); + ffio_wfourcc(pb[0], "jP "); avio_wb32(pb[0], 0x0D0A870A); // signature avio_wb32(pb[0], 20); - put_tag (pb[0], "ftyp"); - put_tag (pb[0], "jp2 "); + ffio_wfourcc(pb[0], "ftyp"); + ffio_wfourcc(pb[0], "jp2 "); avio_wb32(pb[0], 0); - put_tag (pb[0], "jp2 "); + ffio_wfourcc(pb[0], "jp2 "); avio_write(pb[0], st->codec->extradata, st->codec->extradata_size); }else if(pkt->size < 8 || (!st->codec->extradata_size && diff --git a/libavformat/mmf.c b/libavformat/mmf.c index eb48b782d2..76b27dd71e 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avio_internal.h" #include "pcm.h" #include "riff.h" @@ -70,7 +71,7 @@ static int mmf_write_header(AVFormatContext *s) return -1; } - put_tag(pb, "MMMD"); + ffio_wfourcc(pb, "MMMD"); avio_wb32(pb, 0); pos = ff_start_tag(pb, "CNTI"); avio_w8(pb, 0); /* class */ @@ -91,7 +92,7 @@ static int mmf_write_header(AVFormatContext *s) avio_w8(pb, 2); /* time base d */ avio_w8(pb, 2); /* time base g */ - put_tag(pb, "Atsq"); + ffio_wfourcc(pb, "Atsq"); avio_wb32(pb, 16); mmf->atsqpos = url_ftell(pb); /* Will be filled on close */ diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 9c45352e0f..711aa68e98 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -23,6 +23,7 @@ #include "movenc.h" #include "avformat.h" +#include "avio_internal.h" #include "riff.h" #include "avio.h" #include "isom.h" @@ -55,9 +56,9 @@ static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track) avio_wb32(pb, 0); /* size */ if (pos > UINT32_MAX) { mode64 = 1; - put_tag(pb, "co64"); + ffio_wfourcc(pb, "co64"); } else - put_tag(pb, "stco"); + ffio_wfourcc(pb, "stco"); avio_wb32(pb, 0); /* version & flags */ avio_wb32(pb, track->entry); /* entry count */ for (i=0; ientry; i++) { @@ -77,7 +78,7 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "stsz"); + ffio_wfourcc(pb, "stsz"); avio_wb32(pb, 0); /* version & flags */ for (i=0; ientry; i++) { @@ -114,7 +115,7 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "stsc"); + ffio_wfourcc(pb, "stsc"); avio_wb32(pb, 0); // version & flags entryPos = url_ftell(pb); avio_wb32(pb, track->entry); // entry count @@ -143,7 +144,7 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) int i, index = 0; int64_t pos = url_ftell(pb); avio_wb32(pb, 0); // size - put_tag(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps"); + ffio_wfourcc(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps"); avio_wb32(pb, 0); // version & flags entryPos = url_ftell(pb); avio_wb32(pb, track->entry); // entry count @@ -163,9 +164,9 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track) { avio_wb32(pb, 0x11); /* size */ - if (track->mode == MODE_MOV) put_tag(pb, "samr"); - else put_tag(pb, "damr"); - put_tag(pb, "FFMP"); + if (track->mode == MODE_MOV) ffio_wfourcc(pb, "samr"); + else ffio_wfourcc(pb, "damr"); + ffio_wfourcc(pb, "FFMP"); avio_w8(pb, 0); /* decoder version */ avio_wb16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */ @@ -185,7 +186,7 @@ static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track) return -1; avio_wb32(pb, 11); - put_tag(pb, "dac3"); + ffio_wfourcc(pb, "dac3"); init_get_bits(&gbc, track->vosData+4, track->vosLen-4); fscod = get_bits(&gbc, 2); @@ -231,7 +232,7 @@ static int mov_write_extradata_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_enda_tag(AVIOContext *pb) { avio_wb32(pb, 10); - put_tag(pb, "enda"); + ffio_wfourcc(pb, "enda"); avio_wb16(pb, 1); /* little endian */ return 10; } @@ -258,7 +259,7 @@ static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; avio_wb32(pb, 0); // size - put_tag(pb, "esds"); + ffio_wfourcc(pb, "esds"); avio_wb32(pb, 0); // Version // ES descriptor @@ -329,16 +330,16 @@ static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "wave"); + ffio_wfourcc(pb, "wave"); avio_wb32(pb, 12); /* size */ - put_tag(pb, "frma"); + ffio_wfourcc(pb, "frma"); avio_wl32(pb, track->tag); if (track->enc->codec_id == CODEC_ID_AAC) { /* useless atom needed by mplayer, ipod, not needed by quicktime */ avio_wb32(pb, 12); /* size */ - put_tag(pb, "mp4a"); + ffio_wfourcc(pb, "mp4a"); avio_wb32(pb, 0); mov_write_esds_tag(pb, track); } else if (mov_pcm_le_gt16(track->enc->codec_id)) { @@ -363,7 +364,7 @@ static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track) { avio_wb32(pb, track->vosLen+8); - put_tag(pb, "glbl"); + ffio_wfourcc(pb, "glbl"); avio_write(pb, track->vosData, track->vosLen); return 8+track->vosLen; } @@ -493,8 +494,8 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_d263_tag(AVIOContext *pb) { avio_wb32(pb, 0xf); /* size */ - put_tag(pb, "d263"); - put_tag(pb, "FFMP"); + ffio_wfourcc(pb, "d263"); + ffio_wfourcc(pb, "FFMP"); avio_w8(pb, 0); /* decoder version */ /* FIXME use AVCodecContext level/profile, when encoder will set values */ avio_w8(pb, 0xa); /* level */ @@ -506,8 +507,8 @@ static int mov_write_d263_tag(AVIOContext *pb) static int mov_write_svq3_tag(AVIOContext *pb) { avio_wb32(pb, 0x15); - put_tag(pb, "SMI "); - put_tag(pb, "SEQH"); + ffio_wfourcc(pb, "SMI "); + ffio_wfourcc(pb, "SEQH"); avio_wb32(pb, 0x5); avio_wb32(pb, 0xe2c0211d); avio_wb32(pb, 0xc0000000); @@ -520,7 +521,7 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track) int64_t pos = url_ftell(pb); avio_wb32(pb, 0); - put_tag(pb, "avcC"); + ffio_wfourcc(pb, "avcC"); ff_isom_write_avcc(pb, track->vosData, track->vosLen); return updateSize(pb, pos); } @@ -530,23 +531,23 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track) { int i; avio_wb32(pb, 24); /* size */ - put_tag(pb, "ACLR"); - put_tag(pb, "ACLR"); - put_tag(pb, "0001"); + ffio_wfourcc(pb, "ACLR"); + ffio_wfourcc(pb, "ACLR"); + ffio_wfourcc(pb, "0001"); avio_wb32(pb, 1); /* yuv 1 / rgb 2 ? */ avio_wb32(pb, 0); /* unknown */ avio_wb32(pb, 24); /* size */ - put_tag(pb, "APRG"); - put_tag(pb, "APRG"); - put_tag(pb, "0001"); + ffio_wfourcc(pb, "APRG"); + ffio_wfourcc(pb, "APRG"); + ffio_wfourcc(pb, "0001"); avio_wb32(pb, 1); /* unknown */ avio_wb32(pb, 0); /* unknown */ avio_wb32(pb, 120); /* size */ - put_tag(pb, "ARES"); - put_tag(pb, "ARES"); - put_tag(pb, "0001"); + ffio_wfourcc(pb, "ARES"); + ffio_wfourcc(pb, "ARES"); + ffio_wfourcc(pb, "0001"); avio_wb32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */ avio_wb32(pb, track->enc->width); /* values below are based on samples created with quicktime and avid codecs */ @@ -741,7 +742,7 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) static int mov_write_uuid_tag_ipod(AVIOContext *pb) { avio_wb32(pb, 28); - put_tag(pb, "uuid"); + ffio_wfourcc(pb, "uuid"); avio_wb32(pb, 0x6b6840f2); avio_wb32(pb, 0x5f244fc5); avio_wb32(pb, 0xba39a51b); @@ -772,7 +773,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) track->enc->sample_aspect_ratio.den, INT_MAX); avio_wb32(pb, 16); - put_tag(pb, "pasp"); + ffio_wfourcc(pb, "pasp"); avio_wb32(pb, sar.num); avio_wb32(pb, sar.den); return 16; @@ -792,7 +793,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) avio_wb16(pb, 0); /* Codec stream version */ avio_wb16(pb, 0); /* Codec stream revision (=0) */ if (track->mode == MODE_MOV) { - put_tag(pb, "FFMP"); /* Vendor */ + ffio_wfourcc(pb, "FFMP"); /* Vendor */ if(track->enc->codec_id == CODEC_ID_RAWVIDEO) { avio_wb32(pb, 0); /* Temporal Quality */ avio_wb32(pb, 0x400); /* Spatial Quality = lossless*/ @@ -852,7 +853,7 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "rtp "); + ffio_wfourcc(pb, "rtp "); avio_wb32(pb, 0); /* Reserved */ avio_wb16(pb, 0); /* Reserved */ avio_wb16(pb, 1); /* Data-reference index */ @@ -862,7 +863,7 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) avio_wb32(pb, track->max_packet_size); /* Max packet size */ avio_wb32(pb, 12); /* size */ - put_tag(pb, "tims"); + ffio_wfourcc(pb, "tims"); avio_wb32(pb, track->timescale); return updateSize(pb, pos); @@ -872,7 +873,7 @@ static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "stsd"); + ffio_wfourcc(pb, "stsd"); avio_wb32(pb, 0); /* version & flags */ avio_wb32(pb, 1); /* entry count */ if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) @@ -908,7 +909,7 @@ static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) entries++; /* last one */ atom_size = 16 + (entries * 8); avio_wb32(pb, atom_size); /* size */ - put_tag(pb, "ctts"); + ffio_wfourcc(pb, "ctts"); avio_wb32(pb, 0); /* version & flags */ avio_wb32(pb, entries); /* entry count */ for (i=0; ienc->codec_type == AVMEDIA_TYPE_VIDEO || @@ -1001,7 +1002,7 @@ static int mov_write_dinf_tag(AVIOContext *pb) { int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "dinf"); + ffio_wfourcc(pb, "dinf"); mov_write_dref_tag(pb); return updateSize(pb, pos); } @@ -1009,7 +1010,7 @@ static int mov_write_dinf_tag(AVIOContext *pb) static int mov_write_nmhd_tag(AVIOContext *pb) { avio_wb32(pb, 12); - put_tag(pb, "nmhd"); + ffio_wfourcc(pb, "nmhd"); avio_wb32(pb, 0); return 12; } @@ -1017,9 +1018,9 @@ static int mov_write_nmhd_tag(AVIOContext *pb) static int mov_write_gmhd_tag(AVIOContext *pb) { avio_wb32(pb, 0x20); /* size */ - put_tag(pb, "gmhd"); + ffio_wfourcc(pb, "gmhd"); avio_wb32(pb, 0x18); /* gmin size */ - put_tag(pb, "gmin"); /* generic media info */ + ffio_wfourcc(pb, "gmin");/* generic media info */ avio_wb32(pb, 0); /* version & flags */ avio_wb16(pb, 0x40); /* graphics mode = */ avio_wb16(pb, 0x8000); /* opColor (r?) */ @@ -1033,7 +1034,7 @@ static int mov_write_gmhd_tag(AVIOContext *pb) static int mov_write_smhd_tag(AVIOContext *pb) { avio_wb32(pb, 16); /* size */ - put_tag(pb, "smhd"); + ffio_wfourcc(pb, "smhd"); avio_wb32(pb, 0); /* version & flags */ avio_wb16(pb, 0); /* reserved (balance, normally = 0) */ avio_wb16(pb, 0); /* reserved */ @@ -1043,7 +1044,7 @@ static int mov_write_smhd_tag(AVIOContext *pb) static int mov_write_vmhd_tag(AVIOContext *pb) { avio_wb32(pb, 0x14); /* size (always 0x14) */ - put_tag(pb, "vmhd"); + ffio_wfourcc(pb, "vmhd"); avio_wb32(pb, 0x01); /* version & flags */ avio_wb64(pb, 0); /* reserved (graphics mode = copy) */ return 0x14; @@ -1077,10 +1078,10 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) } avio_wb32(pb, 0); /* size */ - put_tag(pb, "hdlr"); + ffio_wfourcc(pb, "hdlr"); avio_wb32(pb, 0); /* Version & flags */ avio_write(pb, hdlr, 4); /* handler */ - put_tag(pb, hdlr_type); /* handler type */ + ffio_wfourcc(pb, hdlr_type); /* handler type */ avio_wb32(pb ,0); /* reserved */ avio_wb32(pb ,0); /* reserved */ avio_wb32(pb ,0); /* reserved */ @@ -1097,7 +1098,7 @@ static int mov_write_hmhd_tag(AVIOContext *pb) /* This atom must be present, but leaving the values at zero * seems harmless. */ avio_wb32(pb, 28); /* size */ - put_tag(pb, "hmhd"); + ffio_wfourcc(pb, "hmhd"); avio_wb32(pb, 0); /* version, flags */ avio_wb16(pb, 0); /* maxPDUsize */ avio_wb16(pb, 0); /* avgPDUsize */ @@ -1111,7 +1112,7 @@ static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "minf"); + ffio_wfourcc(pb, "minf"); if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO) mov_write_vmhd_tag(pb); else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) @@ -1134,7 +1135,7 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) int version = track->trackDuration < INT32_MAX ? 0 : 1; (version == 1) ? avio_wb32(pb, 44) : avio_wb32(pb, 32); /* size */ - put_tag(pb, "mdhd"); + ffio_wfourcc(pb, "mdhd"); avio_w8(pb, version); avio_wb24(pb, 0); /* flags */ if (version == 1) { @@ -1163,7 +1164,7 @@ static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "mdia"); + ffio_wfourcc(pb, "mdia"); mov_write_mdhd_tag(pb, track); mov_write_hdlr_tag(pb, track); mov_write_minf_tag(pb, track); @@ -1177,7 +1178,7 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) int version = duration < INT32_MAX ? 0 : 1; (version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */ - put_tag(pb, "tkhd"); + ffio_wfourcc(pb, "tkhd"); avio_w8(pb, version); avio_wb24(pb, 0xf); /* flags (track enabled) */ if (version == 1) { @@ -1232,9 +1233,9 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track) { avio_wb32(pb, 0x24); /* size */ - put_tag(pb, "edts"); + ffio_wfourcc(pb, "edts"); avio_wb32(pb, 0x1c); /* size */ - put_tag(pb, "elst"); + ffio_wfourcc(pb, "elst"); avio_wb32(pb, 0x0); avio_wb32(pb, 0x1); @@ -1250,7 +1251,7 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track) { avio_wb32(pb, 20); // size - put_tag(pb, "tref"); + ffio_wfourcc(pb, "tref"); avio_wb32(pb, 12); // size (subatom) avio_wl32(pb, track->tref_tag); avio_wb32(pb, track->tref_id); @@ -1261,13 +1262,13 @@ static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_uuid_tag_psp(AVIOContext *pb, MOVTrack *mov) { avio_wb32(pb, 0x34); /* size ... reports as 28 in mp4box! */ - put_tag(pb, "uuid"); - put_tag(pb, "USMT"); + ffio_wfourcc(pb, "uuid"); + ffio_wfourcc(pb, "USMT"); avio_wb32(pb, 0x21d24fce); avio_wb32(pb, 0xbb88695c); avio_wb32(pb, 0xfac9c740); avio_wb32(pb, 0x1c); // another size here! - put_tag(pb, "MTDT"); + ffio_wfourcc(pb, "MTDT"); avio_wb32(pb, 0x00010012); avio_wb32(pb, 0x0a); avio_wb32(pb, 0x55c40000); @@ -1286,11 +1287,11 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index) len = strlen(buf); avio_wb32(pb, len + 24); - put_tag (pb, "udta"); + ffio_wfourcc(pb, "udta"); avio_wb32(pb, len + 16); - put_tag (pb, "hnti"); + ffio_wfourcc(pb, "hnti"); avio_wb32(pb, len + 8); - put_tag (pb, "sdp "); + ffio_wfourcc(pb, "sdp "); avio_write(pb, buf, len); return len + 24; } @@ -1299,7 +1300,7 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) { int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "trak"); + ffio_wfourcc(pb, "trak"); mov_write_tkhd_tag(pb, track, st); if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS) mov_write_edts_tag(pb, track); // PSP Movies require edts box @@ -1318,7 +1319,7 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov) { avio_wb32(pb, 0x15); /* size */ - put_tag(pb, "iods"); + ffio_wfourcc(pb, "iods"); avio_wb32(pb, 0); /* version & flags */ avio_wb16(pb, 0x1007); avio_w8(pb, 0); @@ -1350,7 +1351,7 @@ static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov) version = maxTrackLen < UINT32_MAX ? 0 : 1; (version == 1) ? avio_wb32(pb, 120) : avio_wb32(pb, 108); /* size */ - put_tag(pb, "mvhd"); + ffio_wfourcc(pb, "mvhd"); avio_w8(pb, version); avio_wb24(pb, 0); /* flags */ if (version == 1) { @@ -1394,11 +1395,11 @@ static int mov_write_itunes_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { avio_wb32(pb, 33); /* size */ - put_tag(pb, "hdlr"); + ffio_wfourcc(pb, "hdlr"); avio_wb32(pb, 0); avio_wb32(pb, 0); - put_tag(pb, "mdir"); - put_tag(pb, "appl"); + ffio_wfourcc(pb, "mdir"); + ffio_wfourcc(pb, "appl"); avio_wb32(pb, 0); avio_wb32(pb, 0); avio_w8(pb, 0); @@ -1411,7 +1412,7 @@ static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang if(long_style){ int size = 16 + strlen(data); avio_wb32(pb, size); /* size */ - put_tag(pb, "data"); + ffio_wfourcc(pb, "data"); avio_wb32(pb, 1); avio_wb32(pb, 0); avio_write(pb, data, strlen(data)); @@ -1431,7 +1432,7 @@ static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *v if (value && value[0]) { int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, name); + ffio_wfourcc(pb, name); mov_write_string_data_tag(pb, value, lang, long_style); size= updateSize(pb, pos); } @@ -1470,9 +1471,9 @@ static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, int size = 0, track = t ? atoi(t->value) : 0; if (track) { avio_wb32(pb, 32); /* size */ - put_tag(pb, "trkn"); + ffio_wfourcc(pb, "trkn"); avio_wb32(pb, 24); /* size */ - put_tag(pb, "data"); + ffio_wfourcc(pb, "data"); avio_wb32(pb, 0); // 8 bytes empty avio_wb32(pb, 0); avio_wb16(pb, 0); // empty @@ -1490,7 +1491,7 @@ static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov, { int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "ilst"); + ffio_wfourcc(pb, "ilst"); mov_write_string_metadata(s, pb, "\251nam", "title" , 1); mov_write_string_metadata(s, pb, "\251ART", "artist" , 1); mov_write_string_metadata(s, pb, "aART", "album_artist", 1); @@ -1519,7 +1520,7 @@ static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov, int size = 0; int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "meta"); + ffio_wfourcc(pb, "meta"); avio_wb32(pb, 0); mov_write_itunes_hdlr_tag(pb, mov, s); mov_write_ilst_tag(pb, mov, s); @@ -1562,7 +1563,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, if (!t || !utf8len(t->value)) return 0; avio_wb32(pb, 0); /* size */ - put_tag (pb, tag); /* type */ + ffio_wfourcc(pb, tag); /* type */ avio_wb32(pb, 0); /* version + flags */ if (!strcmp(tag, "yrrc")) avio_wb16(pb, atoi(t->value)); @@ -1582,7 +1583,7 @@ static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s) int i, nb_chapters = FFMIN(s->nb_chapters, 255); avio_wb32(pb, 0); // size - put_tag (pb, "chpl"); + ffio_wfourcc(pb, "chpl"); avio_wb32(pb, 0x01000000); // version + flags avio_wb32(pb, 0); // unknown avio_w8(pb, nb_chapters); @@ -1647,7 +1648,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, if ((size = url_close_dyn_buf(pb_buf, &buf)) > 0) { avio_wb32(pb, size+8); - put_tag(pb, "udta"); + ffio_wfourcc(pb, "udta"); avio_write(pb, buf, size); } av_free(buf); @@ -1676,15 +1677,15 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) if (title) { pos = url_ftell(pb); avio_wb32(pb, 0); /* size placeholder*/ - put_tag(pb, "uuid"); - put_tag(pb, "USMT"); + ffio_wfourcc(pb, "uuid"); + ffio_wfourcc(pb, "USMT"); avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */ avio_wb32(pb, 0xbb88695c); avio_wb32(pb, 0xfac9c740); pos2 = url_ftell(pb); avio_wb32(pb, 0); /* size placeholder*/ - put_tag(pb, "MTDT"); + ffio_wfourcc(pb, "MTDT"); avio_wb16(pb, 4); // ? @@ -1712,7 +1713,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, int i; int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size placeholder*/ - put_tag(pb, "moov"); + ffio_wfourcc(pb, "moov"); for (i=0; inb_streams; i++) { if(mov->tracks[i].entry <= 0) continue; @@ -1753,11 +1754,11 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) { avio_wb32(pb, 8); // placeholder for extended size field (64 bit) - put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free"); + ffio_wfourcc(pb, mov->mode == MODE_MOV ? "wide" : "free"); mov->mdat_pos = url_ftell(pb); avio_wb32(pb, 0); /* size placeholder*/ - put_tag(pb, "mdat"); + ffio_wfourcc(pb, "mdat"); return 0; } @@ -1779,42 +1780,42 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) } avio_wb32(pb, 0); /* size */ - put_tag(pb, "ftyp"); + ffio_wfourcc(pb, "ftyp"); if (mov->mode == MODE_3GP) { - put_tag(pb, has_h264 ? "3gp6" : "3gp4"); + ffio_wfourcc(pb, has_h264 ? "3gp6" : "3gp4"); minor = has_h264 ? 0x100 : 0x200; } else if (mov->mode & MODE_3G2) { - put_tag(pb, has_h264 ? "3g2b" : "3g2a"); + ffio_wfourcc(pb, has_h264 ? "3g2b" : "3g2a"); minor = has_h264 ? 0x20000 : 0x10000; }else if (mov->mode == MODE_PSP) - put_tag(pb, "MSNV"); + ffio_wfourcc(pb, "MSNV"); else if (mov->mode == MODE_MP4) - put_tag(pb, "isom"); + ffio_wfourcc(pb, "isom"); else if (mov->mode == MODE_IPOD) - put_tag(pb, has_video ? "M4V ":"M4A "); + ffio_wfourcc(pb, has_video ? "M4V ":"M4A "); else - put_tag(pb, "qt "); + ffio_wfourcc(pb, "qt "); avio_wb32(pb, minor); if(mov->mode == MODE_MOV) - put_tag(pb, "qt "); + ffio_wfourcc(pb, "qt "); else{ - put_tag(pb, "isom"); - put_tag(pb, "iso2"); + ffio_wfourcc(pb, "isom"); + ffio_wfourcc(pb, "iso2"); if(has_h264) - put_tag(pb, "avc1"); + ffio_wfourcc(pb, "avc1"); } if (mov->mode == MODE_3GP) - put_tag(pb, has_h264 ? "3gp6":"3gp4"); + ffio_wfourcc(pb, has_h264 ? "3gp6":"3gp4"); else if (mov->mode & MODE_3G2) - put_tag(pb, has_h264 ? "3g2b":"3g2a"); + ffio_wfourcc(pb, has_h264 ? "3g2b":"3g2a"); else if (mov->mode == MODE_PSP) - put_tag(pb, "MSNV"); + ffio_wfourcc(pb, "MSNV"); else if (mov->mode == MODE_MP4) - put_tag(pb, "mp41"); + ffio_wfourcc(pb, "mp41"); return updateSize(pb, pos); } @@ -1828,8 +1829,8 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s) int video_kbitrate= FFMIN(VideoCodec->bit_rate / 1000, 800 - audio_kbitrate); avio_wb32(pb, 0x94); /* size */ - put_tag(pb, "uuid"); - put_tag(pb, "PROF"); + ffio_wfourcc(pb, "uuid"); + ffio_wfourcc(pb, "PROF"); avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */ avio_wb32(pb, 0xbb88695c); @@ -1839,16 +1840,16 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s) avio_wb32(pb, 0x3); /* 3 sections ? */ avio_wb32(pb, 0x14); /* size */ - put_tag(pb, "FPRF"); + ffio_wfourcc(pb, "FPRF"); avio_wb32(pb, 0x0); /* ? */ avio_wb32(pb, 0x0); /* ? */ avio_wb32(pb, 0x0); /* ? */ avio_wb32(pb, 0x2c); /* size */ - put_tag(pb, "APRF"); /* audio */ + ffio_wfourcc(pb, "APRF");/* audio */ avio_wb32(pb, 0x0); avio_wb32(pb, 0x2); /* TrackID */ - put_tag(pb, "mp4a"); + ffio_wfourcc(pb, "mp4a"); avio_wb32(pb, 0x20f); avio_wb32(pb, 0x0); avio_wb32(pb, audio_kbitrate); @@ -1857,15 +1858,15 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s) avio_wb32(pb, AudioCodec->channels); avio_wb32(pb, 0x34); /* size */ - put_tag(pb, "VPRF"); /* video */ + ffio_wfourcc(pb, "VPRF"); /* video */ avio_wb32(pb, 0x0); avio_wb32(pb, 0x1); /* TrackID */ if (VideoCodec->codec_id == CODEC_ID_H264) { - put_tag(pb, "avc1"); + ffio_wfourcc(pb, "avc1"); avio_wb16(pb, 0x014D); avio_wb16(pb, 0x0015); } else { - put_tag(pb, "mp4v"); + ffio_wfourcc(pb, "mp4v"); avio_wb16(pb, 0x0000); avio_wb16(pb, 0x0103); } @@ -2206,7 +2207,7 @@ static int mov_write_trailer(AVFormatContext *s) /* overwrite 'wide' placeholder atom */ url_fseek(pb, mov->mdat_pos - 8, SEEK_SET); avio_wb32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */ - put_tag(pb, "mdat"); + ffio_wfourcc(pb, "mdat"); avio_wb64(pb, mov->mdat_size+16); } url_fseek(pb, moov_pos, SEEK_SET); diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 533f89e7b8..fc4010d3b8 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -25,6 +25,7 @@ #include "libavcodec/bytestream.h" #include "libavcodec/flac.h" #include "avformat.h" +#include "avio_internal.h" #include "internal.h" #include "vorbiscomment.h" @@ -85,7 +86,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) if (ret < 0) return ret; init_checksum(pb, ff_crc04C11DB7_update, 0); - put_tag(pb, "OggS"); + ffio_wfourcc(pb, "OggS"); avio_w8(pb, 0); avio_w8(pb, page->flags | extra_flags); avio_wl64(pb, page->granule); diff --git a/libavformat/riff.c b/libavformat/riff.c index 4cbc2b7f0a..4e21b1c841 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -21,6 +21,7 @@ #include "libavcodec/avcodec.h" #include "avformat.h" +#include "avio_internal.h" #include "riff.h" #include "libavcodec/bytestream.h" @@ -321,7 +322,7 @@ const AVCodecTag ff_codec_wav_tags[] = { #if CONFIG_MUXERS int64_t ff_start_tag(AVIOContext *pb, const char *tag) { - put_tag(pb, tag); + ffio_wfourcc(pb, tag); avio_wl32(pb, 0); return url_ftell(pb); } diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 6ba152e45c..5d311d3599 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avio_internal.h" #include "rm.h" typedef struct { @@ -74,13 +75,13 @@ static int rv10_write_header(AVFormatContext *ctx, start_ptr = s->buf_ptr; - put_tag(s, ".RMF"); + ffio_wfourcc(s, ".RMF"); avio_wb32(s,18); /* header size */ avio_wb16(s,0); avio_wb32(s,0); avio_wb32(s,4 + ctx->nb_streams); /* num headers */ - put_tag(s,"PROP"); + ffio_wfourcc(s,"PROP"); avio_wb32(s, 50); avio_wb16(s, 0); packet_max_size = 0; @@ -123,7 +124,7 @@ static int rv10_write_header(AVFormatContext *ctx, /* comments */ - put_tag(s,"CONT"); + ffio_wfourcc(s,"CONT"); size = 4 * 2 + 10; for(i=0; imetadata, ff_rm_metadata[i], NULL, 0); @@ -151,7 +152,7 @@ static int rv10_write_header(AVFormatContext *ctx, codec_data_size = 34; } - put_tag(s,"MDPR"); + ffio_wfourcc(s,"MDPR"); size = 10 + 9 * 4 + strlen(desc) + strlen(mimetype) + codec_data_size; avio_wb32(s, size); avio_wb16(s, 0); @@ -186,7 +187,7 @@ static int rv10_write_header(AVFormatContext *ctx, put_tag(s, ".ra"); avio_w8(s, 0xfd); avio_wb32(s, 0x00040000); /* version */ - put_tag(s, ".ra4"); + ffio_wfourcc(s, ".ra4"); avio_wb32(s, 0x01b53530); /* stream length */ avio_wb16(s, 4); /* unknown */ avio_wb32(s, 0x39); /* header size */ @@ -239,10 +240,11 @@ static int rv10_write_header(AVFormatContext *ctx, } else { /* video codec info */ avio_wb32(s,34); /* size */ + ffio_wfourcc(s, "VIDO"); if(stream->enc->codec_id == CODEC_ID_RV10) - put_tag(s,"VIDORV10"); + ffio_wfourcc(s,"RV10"); else - put_tag(s,"VIDORV20"); + ffio_wfourcc(s,"RV20"); avio_wb16(s, stream->enc->width); avio_wb16(s, stream->enc->height); avio_wb16(s, (int) stream->frame_rate); /* frames per seconds ? */ @@ -270,7 +272,7 @@ static int rv10_write_header(AVFormatContext *ctx, data_offset_ptr[3] = data_pos; /* data stream */ - put_tag(s,"DATA"); + ffio_wfourcc(s, "DATA"); avio_wb32(s,data_size + 10 + 8); avio_wb16(s,0); diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index 75141de789..9c06dd7ea3 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -31,6 +31,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" +#include "avio_internal.h" #include "sox.h" typedef struct { @@ -53,14 +54,14 @@ static int sox_write_header(AVFormatContext *s) sox->header_size = SOX_FIXED_HDR + comment_size; if (enc->codec_id == CODEC_ID_PCM_S32LE) { - put_tag(pb, ".SoX"); + ffio_wfourcc(pb, ".SoX"); avio_wl32(pb, sox->header_size); avio_wl64(pb, 0); /* number of samples */ avio_wl64(pb, av_dbl2int(enc->sample_rate)); avio_wl32(pb, enc->channels); avio_wl32(pb, comment_size); } else if (enc->codec_id == CODEC_ID_PCM_S32BE) { - put_tag(pb, "XoS."); + ffio_wfourcc(pb, "XoS."); avio_wb32(pb, sox->header_size); avio_wb64(pb, 0); /* number of samples */ avio_wb64(pb, av_dbl2int(enc->sample_rate)); diff --git a/libavformat/wav.c b/libavformat/wav.c index dea70fa4dc..a574b3b16f 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -23,6 +23,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avio_internal.h" #include "pcm.h" #include "riff.h" @@ -42,9 +43,9 @@ static int wav_write_header(AVFormatContext *s) AVIOContext *pb = s->pb; int64_t fmt, fact; - put_tag(pb, "RIFF"); + ffio_wfourcc(pb, "RIFF"); avio_wl32(pb, 0); /* file length */ - put_tag(pb, "WAVE"); + ffio_wfourcc(pb, "WAVE"); /* format header */ fmt = ff_start_tag(pb, "fmt "); From 99f42c27abfe916fa19ac0c18489c8bbf8525406 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 24 Feb 2011 07:36:03 +0100 Subject: [PATCH 459/528] avienc: replace &tag[0] with tag. Signed-off-by: Ronald S. Bultje --- libavformat/avienc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 24acc9297c..c161133342 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -318,7 +318,7 @@ static int avi_write_header(AVFormatContext *s) avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */ avio_w8(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ avio_wl32(pb, 0); /* nEntriesInUse (will fill out later on) */ - ffio_wfourcc(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type)); + ffio_wfourcc(pb, avi_stream2fourcc(tag, i, stream->codec_type)); /* dwChunkId */ avio_wl64(pb, 0); /* dwReserved[3] avio_wl32(pb, 0); Must be 0. */ @@ -415,12 +415,12 @@ static int avi_write_ix(AVFormatContext *s) AVIStream *avist= s->streams[i]->priv_data; int64_t ix, pos; - avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type); + avi_stream2fourcc(tag, i, s->streams[i]->codec->codec_type); ix_tag[3] = '0' + i; /* Writing AVI OpenDML leaf index chunk */ ix = url_ftell(pb); - ffio_wfourcc(pb, &ix_tag[0]); /* ix?? */ + ffio_wfourcc(pb, ix_tag); /* ix?? */ avio_wl32(pb, avist->indexes.entry * 8 + 24); /* chunk size */ avio_wl16(pb, 2); /* wLongsPerEntry */ @@ -428,7 +428,7 @@ static int avi_write_ix(AVFormatContext *s) avio_w8(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ avio_wl32(pb, avist->indexes.entry); /* nEntriesInUse */ - ffio_wfourcc(pb, &tag[0]); /* dwChunkId */ + ffio_wfourcc(pb, tag); /* dwChunkId */ avio_wl64(pb, avi->movi_list);/* qwBaseOffset */ avio_wl32(pb, 0); /* dwReserved_3 (must be 0) */ @@ -491,9 +491,9 @@ static int avi_write_idx1(AVFormatContext *s) } if (!empty) { avist= s->streams[stream_id]->priv_data; - avi_stream2fourcc(&tag[0], stream_id, + avi_stream2fourcc(tag, stream_id, s->streams[stream_id]->codec->codec_type); - ffio_wfourcc(pb, &tag[0]); + ffio_wfourcc(pb, tag); avio_wl32(pb, ie->flags); avio_wl32(pb, ie->pos); avio_wl32(pb, ie->len); @@ -545,7 +545,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) avi->movi_list = avi_start_new_riff(s, pb, "AVIX", "movi"); } - avi_stream2fourcc(&tag[0], stream_index, enc->codec_type); + avi_stream2fourcc(tag, stream_index, enc->codec_type); if(pkt->flags&AV_PKT_FLAG_KEY) flags = 0x10; if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { From bbc413f943b53d96aa85fe272ec413c85794019f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 24 Feb 2011 07:36:04 +0100 Subject: [PATCH 460/528] lavf: replace remaining uses of put_tag with avio_write Signed-off-by: Ronald S. Bultje --- libavformat/amr.c | 4 ++-- libavformat/ffmetaenc.c | 6 +++--- libavformat/flvenc.c | 2 +- libavformat/gif.c | 6 +++--- libavformat/gxfenc.c | 11 +++++++---- libavformat/mmf.c | 2 +- libavformat/rmenc.c | 2 +- libavformat/swfenc.c | 4 ++-- 8 files changed, 20 insertions(+), 17 deletions(-) diff --git a/libavformat/amr.c b/libavformat/amr.c index 3b78ba3659..fd43283a22 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -40,11 +40,11 @@ static int amr_write_header(AVFormatContext *s) if (enc->codec_id == CODEC_ID_AMR_NB) { - put_tag(pb, AMR_header); /* magic number */ + avio_write(pb, AMR_header, sizeof(AMR_header) - 1); /* magic number */ } else if(enc->codec_id == CODEC_ID_AMR_WB) { - put_tag(pb, AMRWB_header); /* magic number */ + avio_write(pb, AMRWB_header, sizeof(AMRWB_header) - 1); /* magic number */ } else { diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index 322ec0f576..77db0b9bf8 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -50,7 +50,7 @@ static void write_tags(AVIOContext *s, AVMetadata *m) static int write_header(AVFormatContext *s) { - put_tag(s->pb, ID_STRING); + avio_write(s->pb, ID_STRING, sizeof(ID_STRING) - 1); avio_w8(s->pb, '1'); // version avio_w8(s->pb, '\n'); put_flush_packet(s->pb); @@ -64,14 +64,14 @@ static int write_trailer(AVFormatContext *s) write_tags(s->pb, s->metadata); for (i = 0; i < s->nb_streams; i++) { - put_tag(s->pb, ID_STREAM); + avio_write(s->pb, ID_STREAM, sizeof(ID_STREAM) - 1); avio_w8(s->pb, '\n'); write_tags(s->pb, s->streams[i]->metadata); } for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; - put_tag(s->pb, ID_CHAPTER); + avio_write(s->pb, ID_CHAPTER, sizeof(ID_CHAPTER) - 1); avio_w8(s->pb, '\n'); url_fprintf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den); url_fprintf(s->pb, "START=%"PRId64"\n", ch->start); diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 71a3784396..4d49a966e9 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -199,7 +199,7 @@ static int flv_write_header(AVFormatContext *s) } av_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */ } - put_tag(pb,"FLV"); + avio_write(pb, "FLV", 3); avio_w8(pb,1); avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc + FLV_HEADER_FLAG_HASVIDEO * !!video_enc); diff --git a/libavformat/gif.c b/libavformat/gif.c index f3f64d1fcc..17effaaa46 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -114,8 +114,8 @@ static int gif_image_write_header(AVIOContext *pb, int i; unsigned int v; - put_tag(pb, "GIF"); - put_tag(pb, "89a"); + avio_write(pb, "GIF", 3); + avio_write(pb, "89a", 3); avio_wl16(pb, width); avio_wl16(pb, height); @@ -162,7 +162,7 @@ static int gif_image_write_header(AVIOContext *pb, avio_w8(pb, 0x21); avio_w8(pb, 0xff); avio_w8(pb, 0x0b); - put_tag(pb, "NETSCAPE2.0"); // bytes 4 to 14 + avio_write(pb, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1); // bytes 4 to 14 avio_w8(pb, 0x03); // byte 15 avio_w8(pb, 0x01); // byte 16 avio_wl16(pb, (uint16_t)loop_count); diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index fb6f441f3e..1b12f41e22 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -224,7 +224,7 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, /* media file name */ avio_w8(pb, TRACK_NAME); avio_w8(pb, strlen(ES_NAME_PATTERN) + 3); - put_tag(pb, ES_NAME_PATTERN); + avio_write(pb, ES_NAME_PATTERN, sizeof(ES_NAME_PATTERN) - 1); avio_wb16(pb, sc->media_info); avio_w8(pb, 0); @@ -269,6 +269,7 @@ static int gxf_write_material_data_section(AVFormatContext *s) GXFContext *gxf = s->priv_data; AVIOContext *pb = s->pb; int64_t pos; + int len; const char *filename = strrchr(s->filename, '/'); pos = url_ftell(pb); @@ -279,10 +280,12 @@ static int gxf_write_material_data_section(AVFormatContext *s) filename++; else filename = s->filename; + len = strlen(filename); + avio_w8(pb, MAT_NAME); - avio_w8(pb, strlen(SERVER_PATH) + strlen(filename) + 1); - put_tag(pb, SERVER_PATH); - put_tag(pb, filename); + avio_w8(pb, strlen(SERVER_PATH) + len + 1); + avio_write(pb, SERVER_PATH, sizeof(SERVER_PATH) - 1); + avio_write(pb, filename, len); avio_w8(pb, 0); /* first field */ diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 76b27dd71e..bcb862c4b5 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -79,7 +79,7 @@ static int mmf_write_header(AVFormatContext *s) avio_w8(pb, 0); /* code type */ avio_w8(pb, 0); /* status */ avio_w8(pb, 0); /* counts */ - put_tag(pb, "VN:libavcodec,"); /* metadata ("ST:songtitle,VN:version,...") */ + avio_write(pb, "VN:libavcodec,", sizeof("VN:libavcodec,") -1); /* metadata ("ST:songtitle,VN:version,...") */ end_tag_be(pb, pos); avio_write(pb, "ATR\x00", 4); diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 5d311d3599..29a6a35d18 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -184,7 +184,7 @@ static int rv10_write_header(AVFormatContext *ctx, coded_frame_size = (stream->enc->bit_rate * stream->enc->frame_size) / (8 * sample_rate); /* audio codec info */ - put_tag(s, ".ra"); + avio_write(s, ".ra", 3); avio_w8(s, 0xfd); avio_wb32(s, 0x00040000); /* version */ ffio_wfourcc(s, ".ra4"); diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index c698600bdd..296b9c27d9 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -229,7 +229,7 @@ static int swf_write_header(AVFormatContext *s) else swf->samples_per_frame = (swf->audio_enc->sample_rate * rate_base) / rate; - put_tag(pb, "FWS"); + avio_write(pb, "FWS", 3); if (!strcmp("avm2", s->oformat->name)) version = 9; @@ -361,7 +361,7 @@ static int swf_write_video(AVFormatContext *s, avio_wl16(pb, VIDEO_ID); put_swf_matrix(pb, 1 << FRAC_BITS, 0, 0, 1 << FRAC_BITS, 0, 0); avio_wl16(pb, swf->video_frame_number); - put_tag(pb, "video"); + avio_write(pb, "video", 5); avio_w8(pb, 0x00); put_swf_end_tag(s); } else { From 61840b43607679e8c4a1a63f005770f69dda12fa Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 24 Feb 2011 07:36:05 +0100 Subject: [PATCH 461/528] avio: deprecate put_tag it's not used internally anymore and shouldn't be public. Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 2 +- libavformat/aviobuf.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 5876228235..613d77d240 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -407,6 +407,7 @@ attribute_deprecated void put_le24(AVIOContext *s, unsigned int val); attribute_deprecated void put_be24(AVIOContext *s, unsigned int val); attribute_deprecated void put_le16(AVIOContext *s, unsigned int val); attribute_deprecated void put_be16(AVIOContext *s, unsigned int val); +attribute_deprecated void put_tag(AVIOContext *s, const char *tag); /** * @} */ @@ -443,7 +444,6 @@ void avio_wl24(AVIOContext *s, unsigned int val); void avio_wb24(AVIOContext *s, unsigned int val); void avio_wl16(AVIOContext *s, unsigned int val); void avio_wb16(AVIOContext *s, unsigned int val); -void put_tag(AVIOContext *s, const char *tag); #if FF_API_OLD_AVIO attribute_deprecated void put_strz(AVIOContext *s, const char *buf); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 270352ecb6..f53ec562f5 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -449,12 +449,14 @@ void avio_wb24(AVIOContext *s, unsigned int val) avio_w8(s, val); } +#if FF_API_OLD_AVIO void put_tag(AVIOContext *s, const char *tag) { while (*tag) { avio_w8(s, *tag++); } } +#endif /* Input stream */ From cc4e9d2a24a9ca79d4e912df21053426411aa14b Mon Sep 17 00:00:00 2001 From: Dave Yeo Date: Fri, 25 Feb 2011 04:19:32 +0000 Subject: [PATCH 462/528] OS/2: lxlite should use stdout This causes lxlite to use stdout instead of vioXXX functions. This improves fate and build logs readability. Affects OS/2 only. Signed-off-by: Mans Rullgard --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 50113875e3..5795c4bdf4 100755 --- a/configure +++ b/configure @@ -2428,7 +2428,7 @@ case $target_os in ranlib="echo ignoring ranlib" ;; os/2*) - strip="lxlite" + strip="lxlite -CS" ln_s="cp -f" add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf' From 04973f8082c5a822112d2e42d535b7f3f59dccc0 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 19 Feb 2011 00:42:11 +0000 Subject: [PATCH 463/528] dxva2: define required feature selection macros Signed-off-by: Mans Rullgard --- libavcodec/dxva2_internal.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h index a9be7a07e7..23d4d87522 100644 --- a/libavcodec/dxva2_internal.h +++ b/libavcodec/dxva2_internal.h @@ -23,6 +23,8 @@ #ifndef AVCODEC_DXVA_INTERNAL_H #define AVCODEC_DXVA_INTERNAL_H +#define _WIN32_WINNT 0x0600 +#define COBJMACROS #include "dxva2.h" #include "avcodec.h" #include "mpegvideo.h" From 8997bb8807336dd6d6c96364952bb71c161ac3b2 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 25 Feb 2011 14:52:23 +0000 Subject: [PATCH 464/528] bink: use LOCAL_ALIGNED for aligned stack data Signed-off-by: Mans Rullgard --- libavcodec/bink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index b77e9db0f6..d1985eddb2 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -790,7 +790,7 @@ static int binkb_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, int v, col[2]; const uint8_t *scan; int xoff, yoff; - DECLARE_ALIGNED(16, DCTELEM, block[64]); + LOCAL_ALIGNED_16(DCTELEM, block, [64]); int coordmap[64]; int ybias = is_key ? -15 : 0; int qp; From f0ca29eb5f476a281c8066214e3745244656d417 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 20 Feb 2011 12:24:09 +1100 Subject: [PATCH 465/528] bink: set audio stream codec_tag such that binkaudio decoder can identify bitstream version Signed-off-by: Ronald S. Bultje --- libavformat/bink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/bink.c b/libavformat/bink.c index 0087320ab5..60f4081bfb 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -134,7 +134,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; - ast->codec->codec_tag = 0; + ast->codec->codec_tag = vst->codec->codec_tag; ast->codec->sample_rate = avio_rl16(pb); av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); flags = avio_rl16(pb); From 582ac86d19c61ad73c2e1a2d5ed54a5fe1e20bd1 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 20 Feb 2011 12:24:25 +1100 Subject: [PATCH 466/528] binkaudio: perform band table scaling in decode_init Signed-off-by: Ronald S. Bultje --- libavcodec/binkaudio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 39517f7eb4..fb442c00b2 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -114,10 +114,10 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); /* populate bands data */ - s->bands[0] = 1; + s->bands[0] = 2; for (i = 1; i < s->num_bands; i++) - s->bands[i] = ff_wma_critical_freqs[i - 1] * (s->frame_len / 2) / sample_rate_half; - s->bands[s->num_bands] = s->frame_len / 2; + s->bands[i] = (ff_wma_critical_freqs[i - 1] * s->frame_len / sample_rate_half) & ~1; + s->bands[s->num_bands] = s->frame_len; s->first = 1; avctx->sample_fmt = AV_SAMPLE_FMT_S16; @@ -194,11 +194,11 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) if (width == 0) { memset(coeffs + i, 0, (j - i) * sizeof(*coeffs)); i = j; - while (s->bands[k] * 2 < i) + while (s->bands[k] < i) q = quant[k++]; } else { while (i < j) { - if (s->bands[k] * 2 == i) + if (s->bands[k] == i) q = quant[k++]; coeff = get_bits(gb, width); if (coeff) { From a304def1dca50d63bf2a39651f84792980db3508 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 20 Feb 2011 12:24:38 +1100 Subject: [PATCH 467/528] binkaudio: remove unnecessary loop decode_init sets bands[0] == 2, so this loop always sets the band table index (k) to zero. Signed-off-by: Ronald S. Bultje --- libavcodec/binkaudio.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index fb442c00b2..b601a01f0a 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -164,7 +164,6 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) for (ch = 0; ch < s->channels; ch++) { FFTSample *coeffs = s->coeffs_ptr[ch]; - q = 0.0f; coeffs[0] = get_float(gb) * s->root; coeffs[1] = get_float(gb) * s->root; @@ -174,10 +173,8 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) quant[i] = expf(FFMIN(value, 95) * 0.15289164787221953823f) * s->root; } - // find band (k) - for (k = 0; s->bands[k] < 1; k++) { - q = quant[k]; - } + k = 0; + q = quant[0]; // parse coefficients i = 2; From 8a8c283edd0da5863eb729a31a94b70820400941 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 20 Feb 2011 12:24:48 +1100 Subject: [PATCH 468/528] binkaudio: simplify frame_len_bits and frame_len calculation Signed-off-by: Ronald S. Bultje --- libavcodec/binkaudio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index b601a01f0a..116bf5b7e6 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -81,7 +81,6 @@ static av_cold int decode_init(AVCodecContext *avctx) } else { frame_len_bits = 11; } - s->frame_len = 1 << frame_len_bits; if (avctx->channels > MAX_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels); @@ -91,14 +90,13 @@ static av_cold int decode_init(AVCodecContext *avctx) if (avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT) { // audio is already interleaved for the RDFT format variant sample_rate *= avctx->channels; - s->frame_len *= avctx->channels; s->channels = 1; - if (avctx->channels == 2) - frame_len_bits++; + frame_len_bits += av_log2(avctx->channels); } else { s->channels = avctx->channels; } + s->frame_len = 1 << frame_len_bits; s->overlap_len = s->frame_len / 16; s->block_size = (s->frame_len - s->overlap_len) * s->channels; sample_rate_half = (sample_rate + 1) / 2; From ccfcddb3f287545a20831f266c2a2f734d6a9f31 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 20 Feb 2011 12:25:05 +1100 Subject: [PATCH 469/528] Bink version 'b' audio decoder Signed-off-by: Ronald S. Bultje --- Changelog | 2 +- libavcodec/avcodec.h | 2 +- libavcodec/binkaudio.c | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Changelog b/Changelog index 3a9922f705..dc47dabd9f 100644 --- a/Changelog +++ b/Changelog @@ -76,7 +76,7 @@ version : - IVF muxer added - Wing Commander IV movies decoder added - movie source added -- Bink version 'b' video decoder +- Bink version 'b' audio and video decoder version 0.6: diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 86519387a9..3eedcf9463 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -33,7 +33,7 @@ #define LIBAVCODEC_VERSION_MAJOR 52 #define LIBAVCODEC_VERSION_MINOR 113 -#define LIBAVCODEC_VERSION_MICRO 1 +#define LIBAVCODEC_VERSION_MICRO 2 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 116bf5b7e6..a00d6578e2 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -1,6 +1,6 @@ /* * Bink Audio decoder - * Copyright (c) 2007-2010 Peter Ross (pross@xvid.org) + * Copyright (c) 2007-2011 Peter Ross (pross@xvid.org) * Copyright (c) 2009 Daniel Verkamp (daniel@drv.nu) * * This file is part of FFmpeg. @@ -34,6 +34,7 @@ #include "dsputil.h" #include "fft.h" #include "fmtconvert.h" +#include "libavutil/intfloat_readwrite.h" extern const uint16_t ff_wma_critical_freqs[25]; @@ -44,6 +45,7 @@ typedef struct { GetBitContext gb; DSPContext dsp; FmtConvertContext fmt_conv; + int version_b; ///< Bink version 'b' int first; int channels; int frame_len; ///< transform size (samples) @@ -87,11 +89,14 @@ static av_cold int decode_init(AVCodecContext *avctx) return -1; } + s->version_b = avctx->codec_tag == MKTAG('B','I','K','b'); + if (avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT) { // audio is already interleaved for the RDFT format variant sample_rate *= avctx->channels; s->channels = 1; - frame_len_bits += av_log2(avctx->channels); + if (!s->version_b) + frame_len_bits += av_log2(avctx->channels); } else { s->channels = avctx->channels; } @@ -162,8 +167,13 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) for (ch = 0; ch < s->channels; ch++) { FFTSample *coeffs = s->coeffs_ptr[ch]; - coeffs[0] = get_float(gb) * s->root; - coeffs[1] = get_float(gb) * s->root; + if (s->version_b) { + coeffs[0] = av_int2flt(get_bits(gb, 32)) * s->root; + coeffs[1] = av_int2flt(get_bits(gb, 32)) * s->root; + } else { + coeffs[0] = get_float(gb) * s->root; + coeffs[1] = get_float(gb) * s->root; + } for (i = 0; i < s->num_bands; i++) { /* constant is result of 0.066399999/log10(M_E) */ @@ -177,7 +187,9 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) // parse coefficients i = 2; while (i < s->frame_len) { - if (get_bits1(gb)) { + if (s->version_b) { + j = i + 16; + } else if (get_bits1(gb)) { j = i + rle_length_tab[get_bits(gb, 4)] * 8; } else { j = i + 8; From 588a3ffd9687cbef60cc26d5b3a247b8ecdbf75b Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 20 Feb 2011 13:15:38 +1100 Subject: [PATCH 470/528] bink: decode audio track identifiers into AVStream.id Signed-off-by: Ronald S. Bultje --- libavformat/bink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/bink.c b/libavformat/bink.c index 60f4081bfb..79c3a25ec5 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -143,7 +143,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1; } - url_fskip(pb, 4 * bink->num_audio_tracks); + for (i = 0; i < bink->num_audio_tracks; i++) + s->streams[i + 1]->id = avio_rl32(pb); } /* frame index table */ From e211e255aa399d68239ffa42c9cc7a52eb3d55a9 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 13 Feb 2011 14:37:20 +1100 Subject: [PATCH 471/528] bink: prevent overflows within binkidct by using int-sized intermediate array Signed-off-by: Ronald S. Bultje --- libavcodec/binkidct.c | 6 +++--- tests/ref/fate/bink-demux-video | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/binkidct.c b/libavcodec/binkidct.c index 160926e163..ddb6cc1af3 100644 --- a/libavcodec/binkidct.c +++ b/libavcodec/binkidct.c @@ -62,7 +62,7 @@ #define MUNGE_ROW(x) (((x) + 0x7F)>>8) #define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_ROW,src) -static inline void bink_idct_col(DCTELEM *dest, const DCTELEM *src) +static inline void bink_idct_col(int *dest, const DCTELEM *src) { if ((src[8]|src[16]|src[24]|src[32]|src[40]|src[48]|src[56])==0) { dest[0] = @@ -81,7 +81,7 @@ static inline void bink_idct_col(DCTELEM *dest, const DCTELEM *src) void ff_bink_idct_c(DCTELEM *block) { int i; - DCTELEM temp[64]; + int temp[64]; for (i = 0; i < 8; i++) bink_idct_col(&temp[i], &block[i]); @@ -103,7 +103,7 @@ 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) { int i; - DCTELEM temp[64]; + int temp[64]; for (i = 0; i < 8; i++) bink_idct_col(&temp[i], &block[i]); for (i = 0; i < 8; i++) { diff --git a/tests/ref/fate/bink-demux-video b/tests/ref/fate/bink-demux-video index 22fb3c5a20..f3adf76b25 100644 --- a/tests/ref/fate/bink-demux-video +++ b/tests/ref/fate/bink-demux-video @@ -13,8 +13,8 @@ 0, 72000, 460800, 0x71c0f48e 0, 78000, 460800, 0x5fc8f783 0, 84000, 460800, 0xd23d336a -0, 90000, 460800, 0xa7aca9e0 -0, 96000, 460800, 0x1dff2144 -0, 102000, 460800, 0x82cf8b2b -0, 108000, 460800, 0x4cbe3544 +0, 90000, 460800, 0xadcfa9e0 +0, 96000, 460800, 0x24222144 +0, 102000, 460800, 0x88f28b2b +0, 108000, 460800, 0x52e13544 0, 114000, 460800, 0x7e724731 From ea1afa124cb58c7eebd4fd3706434fafb58b00c0 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko Date: Fri, 25 Feb 2011 17:41:55 +0200 Subject: [PATCH 472/528] use tapt atom for sample aspect ratio Signed-off-by: Luca Barbato --- libavformat/movenc.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 711aa68e98..376555d6ae 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1216,11 +1216,16 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) /* Track width and height, for visual only */ if(st && (track->enc->codec_type == AVMEDIA_TYPE_VIDEO || track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)) { + if(track->mode == MODE_MOV) { + avio_wb32(pb, track->enc->width << 16); + avio_wb32(pb, track->enc->height << 16); + } else { double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); if(!sample_aspect_ratio || track->height != track->enc->height) sample_aspect_ratio = 1; avio_wb32(pb, sample_aspect_ratio * track->enc->width*0x10000); avio_wb32(pb, track->height*0x10000); + } } else { avio_wb32(pb, 0); @@ -1229,6 +1234,31 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) return 0x5c; } +static int mov_write_tapt_tag(ByteIOContext *pb, MOVTrack *track) +{ + int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width, + track->enc->sample_aspect_ratio.den); + + int64_t pos = url_ftell(pb); + + avio_wb32(pb, 0); /* size */ + put_tag(pb, "tapt"); + + avio_wb32(pb, 20); + put_tag(pb, "clef"); + avio_wb32(pb, 0); + avio_wb32(pb, width << 16); + avio_wb32(pb, track->enc->height << 16); + + avio_wb32(pb, 20); + put_tag(pb, "enof"); + avio_wb32(pb, 0); + avio_wb32(pb, track->enc->width << 16); + avio_wb32(pb, track->enc->height << 16); + + return updateSize(pb, pos); +}; + // This box seems important for the psp playback ... without it the movie seems to hang static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track) { @@ -1311,6 +1341,11 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) mov_write_uuid_tag_psp(pb,track); // PSP Movies require this uuid box if (track->tag == MKTAG('r','t','p',' ')) mov_write_udta_sdp(pb, track->rtp_ctx->streams[0]->codec, track->trackID); + if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO && track->mode == MODE_MOV) { + double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); + if (0.0 != sample_aspect_ratio && 1.0 != sample_aspect_ratio) + mov_write_tapt_tag(pb, track); + }; return updateSize(pb, pos); } From 77d207cbe64710b7b34865f347e608b9c0e15968 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko Date: Fri, 25 Feb 2011 17:42:56 +0200 Subject: [PATCH 473/528] reindent after tapt patch Signed-off-by: Luca Barbato --- libavformat/movenc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 376555d6ae..59c579a5ad 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1220,11 +1220,11 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) avio_wb32(pb, track->enc->width << 16); avio_wb32(pb, track->enc->height << 16); } else { - double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); - if(!sample_aspect_ratio || track->height != track->enc->height) - sample_aspect_ratio = 1; - avio_wb32(pb, sample_aspect_ratio * track->enc->width*0x10000); - avio_wb32(pb, track->height*0x10000); + double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); + if(!sample_aspect_ratio || track->height != track->enc->height) + sample_aspect_ratio = 1; + avio_wb32(pb, sample_aspect_ratio * track->enc->width*0x10000); + avio_wb32(pb, track->height*0x10000); } } else { From d184c86cd309bbd61c5d1a1dfcf60d133da4c1e3 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko Date: Tue, 15 Feb 2011 12:44:08 +0200 Subject: [PATCH 474/528] store pasp atom for all types of quicktime movie Signed-off-by: Luca Barbato --- libavformat/movenc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 59c579a5ad..93d6ce96e3 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -840,8 +840,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) } else if(track->vosLen > 0) mov_write_glbl_tag(pb, track); - if (track->mode == MODE_MOV && - track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && + if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) { mov_write_pasp_tag(pb, track); } From 13ff92d19706d17f876ff676591dace0b3e34794 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Fri, 25 Feb 2011 17:41:00 -0500 Subject: [PATCH 475/528] movenc: remove uses of deprecated API. Replace put_tag() with ffio_wfourcc() and ByteIOContext with AVIOContext. --- libavformat/movenc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 93d6ce96e3..de16b5b190 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1233,7 +1233,7 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) return 0x5c; } -static int mov_write_tapt_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track) { int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width, track->enc->sample_aspect_ratio.den); @@ -1241,16 +1241,16 @@ static int mov_write_tapt_tag(ByteIOContext *pb, MOVTrack *track) int64_t pos = url_ftell(pb); avio_wb32(pb, 0); /* size */ - put_tag(pb, "tapt"); + ffio_wfourcc(pb, "tapt"); avio_wb32(pb, 20); - put_tag(pb, "clef"); + ffio_wfourcc(pb, "clef"); avio_wb32(pb, 0); avio_wb32(pb, width << 16); avio_wb32(pb, track->enc->height << 16); avio_wb32(pb, 20); - put_tag(pb, "enof"); + ffio_wfourcc(pb, "enof"); avio_wb32(pb, 0); avio_wb32(pb, track->enc->width << 16); avio_wb32(pb, track->enc->height << 16); From aa3805a486831d9c9e40cc9e897c048d60b51c1a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 26 Feb 2011 11:51:18 +0000 Subject: [PATCH 476/528] fate: get samples location from env var if not explicitly set Use the FATE_SAMPLES environment variable if samples location is not set with the --samples configure option or on the make command line. Signed-off-by: Mans Rullgard --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 5795c4bdf4..b2756ff30d 100755 --- a/configure +++ b/configure @@ -3249,7 +3249,7 @@ SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD} SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD} SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD} SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD} -SAMPLES=$samples +SAMPLES=${samples:-\$(FATE_SAMPLES)} EOF get_version(){ From 52b3cc6047e2b93e8a798734c65904243c1a7be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sat, 26 Feb 2011 11:50:35 +0000 Subject: [PATCH 477/528] configure: document FATE_SAMPLES env var in --help text Signed-off-by: Mans Rullgard --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index b2756ff30d..4a49f3e2e7 100755 --- a/configure +++ b/configure @@ -243,7 +243,8 @@ Developer options (useful when working on FFmpeg itself): --disable-optimizations disable compiler optimizations --enable-extra-warnings enable more compiler warnings --disable-stripping disable stripping of executables and shared libraries - --samples=PATH location of test samples for FATE + --samples=PATH location of test samples for FATE, if not set use + \$FATE_SAMPLES at make invocation time. NOTE: Object files are built at the place where configure is launched. EOF From 8b454c352f49c2a61db37793d838b553db3da734 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 26 Feb 2011 18:04:53 +0000 Subject: [PATCH 478/528] ARM: fix vp8 neon with pic enabled The assembler emits literal pools too far from the load instructions, so we must do it explicitly at a suitable location. Signed-off-by: Mans Rullgard --- libavcodec/arm/vp8dsp_neon.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/arm/vp8dsp_neon.S b/libavcodec/arm/vp8dsp_neon.S index 01c39593a0..23330900f7 100644 --- a/libavcodec/arm/vp8dsp_neon.S +++ b/libavcodec/arm/vp8dsp_neon.S @@ -1294,6 +1294,8 @@ function ff_put_vp8_epel8_h4v6_neon, export=1 pop {r4,pc} endfunc +.ltorg + function ff_put_vp8_epel4_v6_neon, export=1 sub r2, r2, r3, lsl #1 push {r4,lr} From 0b32da90f893b3e04ead18a546252e241a6a0988 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 26 Feb 2011 18:05:53 +0000 Subject: [PATCH 479/528] ARM: VP8: fix build on systems with global symbol prefix Signed-off-by: Mans Rullgard --- libavcodec/arm/vp8_armv6.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/arm/vp8_armv6.S b/libavcodec/arm/vp8_armv6.S index 54c036b82a..d981db814e 100644 --- a/libavcodec/arm/vp8_armv6.S +++ b/libavcodec/arm/vp8_armv6.S @@ -56,7 +56,7 @@ function ff_decode_block_coeffs_armv6, export=1 push {r0,r1,r4-r11,lr} - movrel lr, ff_vp56_norm_shift + movrel lr, X(ff_vp56_norm_shift) ldrd r4, r5, [sp, #44] @ token_prob, qmul cmp r3, #0 ldr r11, [r5] From 00ba041cb396f88f68a1bf7907e7c98ded3760ab Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 27 Feb 2011 23:34:38 +0000 Subject: [PATCH 480/528] Use --sysroot flag for clang Although not documented, clang does support the --sysroot flag, and it does the right thing. Use this flag intead of -isysroot which only applies to header file searches, not the linker. Signed-off-by: Mans Rullgard --- configure | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/configure b/configure index 4a49f3e2e7..04f6e13211 100755 --- a/configure +++ b/configure @@ -2046,7 +2046,7 @@ add_asflags $extra_cflags if test -n "$sysroot"; then case "$cc_type" in - gcc|llvm_gcc) + gcc|llvm_gcc|clang) add_cppflags --sysroot="$sysroot" add_ldflags --sysroot="$sysroot" ;; @@ -2054,10 +2054,6 @@ if test -n "$sysroot"; then add_cppflags -I"$sysinclude" add_ldflags --sysroot="$sysroot" ;; - clang) - add_cppflags -isysroot "$sysroot" - add_ldflags -isysroot "$sysroot" - ;; esac fi From ad9791e12b6653a465803062e2543f25916300d3 Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Thu, 17 Feb 2011 03:25:00 -0500 Subject: [PATCH 481/528] pthreads: Fix bug introduced with thread_safe_callbacks For intra codecs, ff_thread_finish_setup() is called before decoding starts automatically. However, get_buffer can only be used before it's called, so adding this requirement broke frame threading for them. Fixed by moving the call until after get_buffer is finished. Signed-off-by: Ronald S. Bultje --- libavcodec/pthread.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 0e033d37c0..5b0d108ba5 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -292,7 +292,8 @@ static attribute_align_arg void *frame_worker_thread(void *arg) if (fctx->die) break; - if (!codec->update_thread_context) ff_thread_finish_setup(avctx); + if (!codec->update_thread_context && avctx->thread_safe_callbacks) + ff_thread_finish_setup(avctx); pthread_mutex_lock(&p->mutex); avcodec_get_frame_defaults(&p->frame); @@ -779,7 +780,8 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) return avctx->get_buffer(avctx, f); } - if (p->state != STATE_SETTING_UP) { + if (p->state != STATE_SETTING_UP && + (avctx->codec->update_thread_context || !avctx->thread_safe_callbacks)) { av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } @@ -810,6 +812,9 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) err = p->result; pthread_mutex_unlock(&p->progress_mutex); + + if (!avctx->codec->update_thread_context) + ff_thread_finish_setup(avctx); } pthread_mutex_unlock(&p->parent->buffer_mutex); From 76d8846c4e918749b045ea2ee7399a069af5e4a5 Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Thu, 17 Feb 2011 03:44:25 -0500 Subject: [PATCH 482/528] huffyuv: Add multithreading support Signed-off-by: Ronald S. Bultje --- libavcodec/huffyuv.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 2eb5864c47..f81a042c7f 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -32,6 +32,7 @@ #include "get_bits.h" #include "put_bits.h" #include "dsputil.h" +#include "thread.h" #define VLC_BITS 11 @@ -527,6 +528,28 @@ s->bgr32=1; return 0; } + +static av_cold int decode_init_thread_copy(AVCodecContext *avctx) +{ + HYuvContext *s = avctx->priv_data; + int i; + + avctx->coded_frame= &s->picture; + alloc_temp(s); + + for (i = 0; i < 6; i++) + s->vlc[i].table = NULL; + + if(s->version==2){ + if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size) < 0) + return -1; + }else{ + if(read_old_huffman_tables(s) < 0) + return -1; + } + + return 0; +} #endif /* CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER */ #if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER @@ -950,10 +973,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer, (const uint32_t*)buf, buf_size/4); if(p->data[0]) - avctx->release_buffer(avctx, p); + ff_thread_release_buffer(avctx, p); p->reference= 0; - if(avctx->get_buffer(avctx, p) < 0){ + if(ff_thread_get_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } @@ -1425,8 +1448,9 @@ AVCodec ff_huffyuv_decoder = { NULL, decode_end, decode_frame, - CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND, + CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, NULL, + .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy), .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"), }; #endif @@ -1441,8 +1465,9 @@ AVCodec ff_ffvhuff_decoder = { NULL, decode_end, decode_frame, - CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND, + CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, NULL, + .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy), .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"), }; #endif From 6b4aa5dac8f41aa452d0ce9a1bede9e59a303060 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 28 Feb 2011 14:57:54 +0100 Subject: [PATCH 483/528] avio: avio_ prefix for url_fseek Signed-off-by: Ronald S. Bultje --- libavformat/4xm.c | 6 +++--- libavformat/aiffdec.c | 4 ++-- libavformat/aiffenc.c | 8 ++++---- libavformat/anm.c | 8 ++++---- libavformat/ape.c | 8 ++++---- libavformat/apetag.c | 4 ++-- libavformat/asfdec.c | 24 ++++++++++++------------ libavformat/asfenc.c | 18 +++++++++--------- libavformat/au.c | 6 +++--- libavformat/avidec.c | 24 ++++++++++++------------ libavformat/avienc.c | 14 +++++++------- libavformat/avio.h | 3 ++- libavformat/aviobuf.c | 10 +++++++--- libavformat/bethsoftvid.c | 6 +++--- libavformat/bfi.c | 2 +- libavformat/bink.c | 4 ++-- libavformat/c93.c | 4 ++-- libavformat/cafdec.c | 4 ++-- libavformat/dv.c | 6 +++--- libavformat/dxa.c | 6 +++--- libavformat/electronicarts.c | 10 +++++----- libavformat/ffmdec.c | 8 ++++---- libavformat/filmstripdec.c | 6 +++--- libavformat/flacdec.c | 4 ++-- libavformat/flacenc.c | 4 ++-- libavformat/flic.c | 8 ++++---- libavformat/flvdec.c | 12 ++++++------ libavformat/flvenc.c | 14 +++++++------- libavformat/gxf.c | 12 ++++++------ libavformat/gxfenc.c | 18 +++++++++--------- libavformat/id3v1.c | 4 ++-- libavformat/id3v2.c | 4 ++-- libavformat/idcin.c | 2 +- libavformat/idroqdec.c | 6 +++--- libavformat/iff.c | 2 +- libavformat/ipmovie.c | 34 +++++++++++++++++----------------- libavformat/libnut.c | 2 +- libavformat/matroskadec.c | 10 +++++----- libavformat/matroskaenc.c | 12 ++++++------ libavformat/mm.c | 4 ++-- libavformat/mmf.c | 12 ++++++------ libavformat/mov.c | 10 +++++----- libavformat/movenc.c | 18 +++++++++--------- libavformat/movenchint.c | 8 ++++---- libavformat/mp3dec.c | 10 +++++----- libavformat/mp3enc.c | 4 ++-- libavformat/mpc.c | 8 ++++---- libavformat/mpc8.c | 6 +++--- libavformat/mpeg.c | 10 +++++----- libavformat/mpegts.c | 20 ++++++++++---------- libavformat/mtv.c | 2 +- libavformat/mxfdec.c | 8 ++++---- libavformat/mxfenc.c | 6 +++--- libavformat/nsvdec.c | 8 ++++---- libavformat/nutdec.c | 14 +++++++------- libavformat/oggdec.c | 6 +++--- libavformat/oggenc.c | 4 ++-- libavformat/pcm.c | 2 +- libavformat/psxstr.c | 2 +- libavformat/pva.c | 2 +- libavformat/r3d.c | 8 ++++---- libavformat/rdt.c | 2 +- libavformat/riff.c | 4 ++-- libavformat/rl2.c | 2 +- libavformat/rmdec.c | 8 ++++---- libavformat/rmenc.c | 4 ++-- libavformat/rpl.c | 6 +++--- libavformat/rsoenc.c | 4 ++-- libavformat/rtpdec_qt.c | 4 ++-- libavformat/sauce.c | 4 ++-- libavformat/seek.c | 6 +++--- libavformat/segafilm.c | 2 +- libavformat/sierravmd.c | 6 +++--- libavformat/smacker.c | 4 ++-- libavformat/soxenc.c | 4 ++-- libavformat/swfenc.c | 12 ++++++------ libavformat/thp.c | 4 ++-- libavformat/tiertexseq.c | 10 +++++----- libavformat/tmv.c | 2 +- libavformat/tta.c | 4 ++-- libavformat/tty.c | 4 ++-- libavformat/utils.c | 14 +++++++------- libavformat/vc1testenc.c | 2 +- libavformat/vqf.c | 2 +- libavformat/wav.c | 12 ++++++------ libavformat/wc3movie.c | 14 +++++++------- libavformat/westwood.c | 8 ++++---- libavformat/wtv.c | 26 +++++++++++++------------- libavformat/wv.c | 8 ++++---- libavformat/yop.c | 4 ++-- 90 files changed, 352 insertions(+), 347 deletions(-) diff --git a/libavformat/4xm.c b/libavformat/4xm.c index bf2d7384b5..2757e89269 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -106,7 +106,7 @@ static int fourxm_read_header(AVFormatContext *s, fourxm->fps = 1.0; /* skip the first 3 32-bit numbers */ - url_fseek(pb, 12, SEEK_CUR); + avio_seek(pb, 12, SEEK_CUR); /* check for LIST-HEAD */ GET_LIST_HEADER(); @@ -322,12 +322,12 @@ static int fourxm_read_packet(AVFormatContext *s, fourxm->tracks[track_number].audio_pts += audio_frame_count; } else { - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); } break; default: - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); break; } } diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 7b3d1e7297..b8e4ea28ed 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -152,7 +152,7 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec, /* Chunk is over */ if (size) - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); return num_frames; } @@ -276,7 +276,7 @@ got_sound: st->nb_frames * st->codec->frame_size : st->nb_frames; /* Position the stream at the first block */ - url_fseek(pb, offset, SEEK_SET); + avio_seek(pb, offset, SEEK_SET); return 0; } diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index de88382e67..150f36bdc0 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -126,19 +126,19 @@ static int aiff_write_trailer(AVFormatContext *s) if (!url_is_streamed(s->pb)) { /* File length */ - url_fseek(pb, aiff->form, SEEK_SET); + avio_seek(pb, aiff->form, SEEK_SET); avio_wb32(pb, file_size - aiff->form - 4); /* Number of sample frames */ - url_fseek(pb, aiff->frames, SEEK_SET); + avio_seek(pb, aiff->frames, SEEK_SET); avio_wb32(pb, (file_size-aiff->ssnd-12)/enc->block_align); /* Sound Data chunk size */ - url_fseek(pb, aiff->ssnd, SEEK_SET); + avio_seek(pb, aiff->ssnd, SEEK_SET); avio_wb32(pb, file_size - aiff->ssnd - 4); /* return to the end */ - url_fseek(pb, end_size, SEEK_SET); + avio_seek(pb, end_size, SEEK_SET); put_flush_packet(pb); } diff --git a/libavformat/anm.c b/libavformat/anm.c index 6bcb90db1a..463beee345 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -143,7 +143,7 @@ static int read_header(AVFormatContext *s, goto close_and_return; /* read page table */ - ret = url_fseek(pb, anm->page_table_offset, SEEK_SET); + ret = avio_seek(pb, anm->page_table_offset, SEEK_SET); if (ret < 0) goto close_and_return; @@ -192,7 +192,7 @@ repeat: /* parse page header */ if (anm->record < 0) { - url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET); + avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET); url_fskip(pb, 8 + 2*p->nb_records); anm->record = 0; } @@ -209,10 +209,10 @@ repeat: /* fetch record size */ tmp = url_ftell(pb); - url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) + + avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) + 8 + anm->record * 2, SEEK_SET); record_size = avio_rl16(pb); - url_fseek(pb, tmp, SEEK_SET); + avio_seek(pb, tmp, SEEK_SET); /* fetch record */ pkt->size = av_get_packet(s->pb, pkt, record_size); diff --git a/libavformat/ape.c b/libavformat/ape.c index 862ac1a482..657a3d9c49 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -187,7 +187,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* Skip any unknown bytes at the end of the descriptor. This is for future compatibility */ if (ape->descriptorlength > 52) - url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR); + avio_seek(pb, ape->descriptorlength - 52, SEEK_CUR); /* Read header data */ ape->compressiontype = avio_rl16(pb); @@ -212,7 +212,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) ape->finalframeblocks = avio_rl32(pb); if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { - url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */ + avio_seek(pb, 4, SEEK_CUR); /* Skip the peak level */ ape->headerlength += 4; } @@ -289,7 +289,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* try to read APE tags */ if (!url_is_streamed(pb)) { ff_ape_parse_tag(s); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); } av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype); @@ -342,7 +342,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) if (ape->currentframe > ape->totalframes) return AVERROR(EIO); - url_fseek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET); + avio_seek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET); /* Calculate how many blocks there are in this frame */ if (ape->currentframe == (ape->totalframes - 1)) diff --git a/libavformat/apetag.c b/libavformat/apetag.c index 7252fd2b2c..c3c57717bd 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -74,7 +74,7 @@ void ff_ape_parse_tag(AVFormatContext *s) if (file_size < APE_TAG_FOOTER_BYTES) return; - url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); + avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); avio_read(pb, buf, 8); /* APETAGEX */ if (strncmp(buf, "APETAGEX", 8)) { @@ -105,7 +105,7 @@ void ff_ape_parse_tag(AVFormatContext *s) return; } - url_fseek(pb, file_size - tag_bytes, SEEK_SET); + avio_seek(pb, file_size - tag_bytes, SEEK_SET); for (i=0; imetadata, key, value, 0); finish: av_freep(&value); - url_fseek(s->pb, off + len, SEEK_SET); + avio_seek(s->pb, off + len, SEEK_SET); } static int asf_read_file_properties(AVFormatContext *s, int64_t size) @@ -428,14 +428,14 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) for (i=0; ipacket_flags = c; @@ -1146,7 +1146,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos, if (s->packet_size > 0) pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset; *ppos= pos; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); //printf("asf_read_pts\n"); asf_reset_header(s); @@ -1188,7 +1188,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) int64_t current_pos= url_ftell(s->pb); int i; - url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET); + avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET); ff_get_guid(s->pb, &g); /* the data object can be followed by other top-level objects, @@ -1196,10 +1196,10 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) while (ff_guidcmp(&g, &index_guid)) { int64_t gsize= avio_rl64(s->pb); if (gsize < 24 || url_feof(s->pb)) { - url_fseek(s->pb, current_pos, SEEK_SET); + avio_seek(s->pb, current_pos, SEEK_SET); return; } - url_fseek(s->pb, gsize-24, SEEK_CUR); + avio_seek(s->pb, gsize-24, SEEK_CUR); ff_get_guid(s->pb, &g); } @@ -1227,7 +1227,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) } asf->index_read= 1; } - url_fseek(s->pb, current_pos, SEEK_SET); + avio_seek(s->pb, current_pos, SEEK_SET); } static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags) @@ -1265,7 +1265,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int // various attempts to find key frame have failed so far // asf_reset_header(s); - // url_fseek(s->pb, pos, SEEK_SET); + // avio_seek(s->pb, pos, SEEK_SET); // key_pos = pos; // for(i=0;i<16;i++){ // pos = url_ftell(s->pb); @@ -1286,7 +1286,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int /* do the seek */ av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); } asf_reset_header(s); return 0; diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index b181f2321e..267f9b3d49 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -260,9 +260,9 @@ static void end_header(AVIOContext *pb, int64_t pos) int64_t pos1; pos1 = url_ftell(pb); - url_fseek(pb, pos + 16, SEEK_SET); + avio_seek(pb, pos + 16, SEEK_SET); avio_wl64(pb, pos1 - pos); - url_fseek(pb, pos1, SEEK_SET); + avio_seek(pb, pos1, SEEK_SET); } /* write an asf chunk (only used in streaming case) */ @@ -443,9 +443,9 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data return -1; if (wavsize != extra_size) { cur_pos = url_ftell(pb); - url_fseek(pb, es_pos, SEEK_SET); + avio_seek(pb, es_pos, SEEK_SET); avio_wl32(pb, wavsize); /* wav header len */ - url_fseek(pb, cur_pos, SEEK_SET); + avio_seek(pb, cur_pos, SEEK_SET); } /* ERROR Correction */ avio_w8(pb, 0x01); @@ -530,17 +530,17 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data if (asf->is_streamed) { header_size += 8 + 30 + 50; - url_fseek(pb, header_offset - 10 - 30, SEEK_SET); + avio_seek(pb, header_offset - 10 - 30, SEEK_SET); avio_wl16(pb, header_size); - url_fseek(pb, header_offset - 2 - 30, SEEK_SET); + avio_seek(pb, header_offset - 2 - 30, SEEK_SET); avio_wl16(pb, header_size); header_size -= 8 + 30 + 50; } header_size += 24 + 6; - url_fseek(pb, header_offset - 14, SEEK_SET); + avio_seek(pb, header_offset - 14, SEEK_SET); avio_wl64(pb, header_size); - url_fseek(pb, cur_pos, SEEK_SET); + avio_seek(pb, cur_pos, SEEK_SET); /* movie chunk, followed by packets of packet_size */ asf->data_offset = cur_pos; @@ -871,7 +871,7 @@ static int asf_write_trailer(AVFormatContext *s) } else { /* rewrite an updated header */ file_size = url_ftell(s->pb); - url_fseek(s->pb, 0, SEEK_SET); + avio_seek(s->pb, 0, SEEK_SET); asf_write_header1(s, file_size, data_size - asf->data_offset); } diff --git a/libavformat/au.c b/libavformat/au.c index 9aed1dcaf3..16b33e78c7 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -95,9 +95,9 @@ static int au_write_trailer(AVFormatContext *s) /* update file size */ file_size = url_ftell(pb); - url_fseek(pb, 8, SEEK_SET); + avio_seek(pb, 8, SEEK_SET); avio_wb32(pb, (uint32_t)(file_size - 24)); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } @@ -147,7 +147,7 @@ static int au_read_header(AVFormatContext *s, if (size >= 24) { /* skip unused data */ - url_fseek(pb, size - 24, SEEK_CUR); + avio_seek(pb, size - 24, SEEK_CUR); } /* now we are ready: build format streams */ diff --git a/libavformat/avidec.c b/libavformat/avidec.c index b2db2dc36d..a0f86adea5 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -205,13 +205,13 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ return -1; } - url_fseek(pb, offset+8, SEEK_SET); + avio_seek(pb, offset+8, SEEK_SET); avi->odml_depth++; read_braindead_odml_indx(s, frame_num); avi->odml_depth--; frame_num += duration; - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } } avi->index_loaded=1; @@ -668,7 +668,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){ read_braindead_odml_indx(s, 0); } - url_fseek(pb, i+size, SEEK_SET); + avio_seek(pb, i+size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if(stream_index < (unsigned)s->nb_streams && size > 9*4){ @@ -693,7 +693,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } size -= 9*4; } - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); break; case MKTAG('s', 't', 'r', 'n'): if(s->nb_streams){ @@ -892,7 +892,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) if(i>=0){ int64_t pos= best_st->index_entries[i].pos; pos += best_ast->packet_size - best_ast->remaining; - url_fseek(s->pb, pos + 8, SEEK_SET); + avio_seek(s->pb, pos + 8, SEEK_SET); // av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos); assert(best_ast->remaining <= best_ast->packet_size); @@ -1174,7 +1174,7 @@ static int guess_ni_flag(AVFormatContext *s){ if(n >= 2){ int64_t pos= st->index_entries[0].pos; - url_fseek(s->pb, pos + 4, SEEK_SET); + avio_seek(s->pb, pos + 4, SEEK_SET); size= avio_rl32(s->pb); if(pos + size > st->index_entries[1].pos) last_start= INT64_MAX; @@ -1185,7 +1185,7 @@ static int guess_ni_flag(AVFormatContext *s){ if(st->index_entries[n-1].pos < first_end) first_end= st->index_entries[n-1].pos; } - url_fseek(s->pb, oldpos, SEEK_SET); + avio_seek(s->pb, oldpos, SEEK_SET); return last_start > first_end; } @@ -1197,7 +1197,7 @@ static int avi_load_index(AVFormatContext *s) int64_t pos= url_ftell(pb); int ret = -1; - if (url_fseek(pb, avi->movi_end, SEEK_SET) < 0) + if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0) goto the_end; // maybe truncated file #ifdef DEBUG_SEEK printf("movi_end=0x%"PRIx64"\n", avi->movi_end); @@ -1225,13 +1225,13 @@ static int avi_load_index(AVFormatContext *s) default: skip: size += (size & 1); - if (url_fseek(pb, size, SEEK_CUR) < 0) + if (avio_seek(pb, size, SEEK_CUR) < 0) goto the_end; // something is wrong here break; } } the_end: - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); return ret; } @@ -1282,7 +1282,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp /* DV demux so it can synthesize correct timestamps. */ dv_offset_reset(avi->dv_demux, timestamp); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); avi->stream_index= -1; return 0; } @@ -1324,7 +1324,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp } /* do the seek */ - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); avi->stream_index= -1; return 0; } diff --git a/libavformat/avienc.c b/libavformat/avienc.c index c161133342..49585b685b 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -130,7 +130,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) assert(avist->frames_hdr_strm); stream = s->streams[n]->codec; - url_fseek(pb, avist->frames_hdr_strm, SEEK_SET); + avio_seek(pb, avist->frames_hdr_strm, SEEK_SET); ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); if(au_ssize == 0) { avio_wl32(pb, avist->packet_count); @@ -142,10 +142,10 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) } if(riff_id == 1) { assert(avi->frames_hdr_all); - url_fseek(pb, avi->frames_hdr_all, SEEK_SET); + avio_seek(pb, avi->frames_hdr_all, SEEK_SET); avio_wl32(pb, nb_frames); } - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); return 0; } @@ -442,7 +442,7 @@ static int avi_write_ix(AVFormatContext *s) pos = url_ftell(pb); /* Updating one entry in the AVI OpenDML master index */ - url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET); + avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET); ffio_wfourcc(pb, "indx"); /* enabling this entry */ url_fskip(pb, 8); avio_wl32(pb, avi->riff_id); /* nEntriesInUse */ @@ -451,7 +451,7 @@ static int avi_write_ix(AVFormatContext *s) avio_wl32(pb, pos - ix); /* dwSize */ avio_wl32(pb, avist->indexes.entry); /* dwDuration */ - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } return 0; } @@ -601,7 +601,7 @@ static int avi_write_trailer(AVFormatContext *s) ff_end_tag(pb, avi->riff_start); file_size = url_ftell(pb); - url_fseek(pb, avi->odml_list - 8, SEEK_SET); + avio_seek(pb, avi->odml_list - 8, SEEK_SET); ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */ url_fskip(pb, 16); @@ -619,7 +619,7 @@ static int avi_write_trailer(AVFormatContext *s) } } avio_wl32(pb, nb_frames); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); avi_write_counters(s, avi->riff_id); } diff --git a/libavformat/avio.h b/libavformat/avio.h index 613d77d240..568bdd346a 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -420,6 +420,7 @@ attribute_deprecated void put_tag(AVIOContext *s, const char *tag); */ attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); attribute_deprecated int url_fclose(AVIOContext *s); +attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); /** * @} */ @@ -465,7 +466,7 @@ int avio_put_str16le(AVIOContext *s, const char *str); * fseek() equivalent for AVIOContext. * @return new position or AVERROR. */ -int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); /** * Skip given number of bytes forward. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index f53ec562f5..a74ad21604 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -176,7 +176,7 @@ void put_flush_packet(AVIOContext *s) s->must_flush = 0; } -int64_t url_fseek(AVIOContext *s, int64_t offset, int whence) +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) { int64_t offset1; int64_t pos; @@ -235,13 +235,13 @@ int64_t url_fseek(AVIOContext *s, int64_t offset, int whence) int url_fskip(AVIOContext *s, int64_t offset) { - int64_t ret = url_fseek(s, offset, SEEK_CUR); + int64_t ret = avio_seek(s, offset, SEEK_CUR); return ret < 0 ? ret : 0; } int64_t url_ftell(AVIOContext *s) { - return url_fseek(s, 0, SEEK_CUR); + return avio_seek(s, 0, SEEK_CUR); } int64_t url_fsize(AVIOContext *s) @@ -365,6 +365,10 @@ int url_fclose(AVIOContext *s) { return avio_close(s); } +int64_t url_fseek(AVIOContext *s, int64_t offset, int whence) +{ + return avio_seek(s, offset, whence); +} #endif int avio_put_str(AVIOContext *s, const char *str) diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 40d0e6296a..00b3ea2ae3 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -67,7 +67,7 @@ static int vid_read_header(AVFormatContext *s, * bytes: 'V' 'I' 'D' * int16s: always_512, nframes, width, height, delay, always_14 */ - url_fseek(pb, 5, SEEK_CUR); + avio_seek(pb, 5, SEEK_CUR); vid->nframes = avio_rl16(pb); stream = av_new_stream(s, 0); @@ -146,7 +146,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied // may contain a 0 byte even if read all pixels if(avio_r8(pb)) - url_fseek(pb, -1, SEEK_CUR); + avio_seek(pb, -1, SEEK_CUR); break; } if(bytes_copied > npixels) @@ -185,7 +185,7 @@ static int vid_read_packet(AVFormatContext *s, block_type = avio_r8(pb); switch(block_type){ case PALETTE_BLOCK: - url_fseek(pb, -1, SEEK_CUR); // include block type + avio_seek(pb, -1, SEEK_CUR); // include block type ret_value = av_get_packet(pb, pkt, 3 * 256 + 1); if(ret_value != 3 * 256 + 1){ av_free_packet(pkt); diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 7313e7b337..4d0bd097a9 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -98,7 +98,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) astream->codec->bits_per_coded_sample = 8; astream->codec->bit_rate = astream->codec->sample_rate * astream->codec->bits_per_coded_sample; - url_fseek(pb, chunk_header - 3, SEEK_SET); + avio_seek(pb, chunk_header - 3, SEEK_SET); av_set_pts_info(astream, 64, 1, astream->codec->sample_rate); return 0; } diff --git a/libavformat/bink.c b/libavformat/bink.c index 79c3a25ec5..f76d7b987a 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -225,7 +225,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels); return 0; } else { - url_fseek(pb, audio_size, SEEK_CUR); + avio_seek(pb, audio_size, SEEK_CUR); } } @@ -251,7 +251,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in return -1; /* seek to the first frame */ - url_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET); + avio_seek(s->pb, vst->index_entries[0].pos, SEEK_SET); bink->video_pts = 0; memset(bink->audio_pts, 0, sizeof(bink->audio_pts)); bink->current_track = -1; diff --git a/libavformat/c93.c b/libavformat/c93.c index 3e3cd9cb0f..84cf65c73e 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -140,13 +140,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } if (c93->current_frame == 0) { - url_fseek(pb, br->index * 2048, SEEK_SET); + avio_seek(pb, br->index * 2048, SEEK_SET); for (i = 0; i < 32; i++) { c93->frame_offsets[i] = avio_rl32(pb); } } - url_fseek(pb,br->index * 2048 + + avio_seek(pb,br->index * 2048 + c93->frame_offsets[c93->current_frame], SEEK_SET); datasize = avio_rl16(pb); /* video frame size */ diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 86f1005fdc..8532946c5c 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -292,7 +292,7 @@ static int read_header(AVFormatContext *s, /* position the stream at the start of data */ if (caf->data_size >= 0) - url_fseek(pb, caf->data_start, SEEK_SET); + avio_seek(pb, caf->data_start, SEEK_SET); return 0; } @@ -377,7 +377,7 @@ static int read_seek(AVFormatContext *s, int stream_index, return -1; } - url_fseek(s->pb, pos + caf->data_start, SEEK_SET); + avio_seek(s->pb, pos + caf->data_start, SEEK_SET); return 0; } diff --git a/libavformat/dv.c b/libavformat/dv.c index 0598607ff4..cdc5f76923 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -419,7 +419,7 @@ static int dv_read_header(AVFormatContext *s, if (state == 0x003f0700 || state == 0xff3f0700) marker_pos = url_ftell(s->pb); if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) { - url_fseek(s->pb, -163, SEEK_CUR); + avio_seek(s->pb, -163, SEEK_CUR); state = avio_rb32(s->pb); break; } @@ -428,7 +428,7 @@ static int dv_read_header(AVFormatContext *s, AV_WB32(c->buf, state); if (avio_read(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 || - url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) + avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) return AVERROR(EIO); c->dv_demux->sys = ff_dv_frame_profile(c->dv_demux->sys, c->buf, DV_PROFILE_BYTES); @@ -473,7 +473,7 @@ static int dv_read_seek(AVFormatContext *s, int stream_index, dv_offset_reset(c, offset / c->sys->frame_size); - offset = url_fseek(s->pb, offset, SEEK_SET); + offset = avio_seek(s->pb, offset, SEEK_SET); return (offset < 0) ? offset : 0; } diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 188fc29d63..60ae92a048 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -115,7 +115,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align; c->bytes_left = fsize; c->wavpos = url_ftell(pb); - url_fseek(pb, c->vidpos, SEEK_SET); + avio_seek(pb, c->vidpos, SEEK_SET); } /* now we are ready: build format streams */ @@ -151,7 +151,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(!c->readvid && c->has_sound && c->bytes_left){ c->readvid = 1; - url_fseek(s->pb, c->wavpos, SEEK_SET); + avio_seek(s->pb, c->wavpos, SEEK_SET); size = FFMIN(c->bytes_left, c->bpc); ret = av_get_packet(s->pb, pkt, size); pkt->stream_index = 1; @@ -161,7 +161,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) c->wavpos = url_ftell(s->pb); return 0; } - url_fseek(s->pb, c->vidpos, SEEK_SET); + avio_seek(s->pb, c->vidpos, SEEK_SET); while(!url_feof(s->pb) && c->frames){ avio_read(s->pb, buf, 4); switch(AV_RL32(buf)){ diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 6179d22e60..9f79897b85 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -369,10 +369,10 @@ static int process_ea_header(AVFormatContext *s) { return err; } - url_fseek(pb, startpos + size, SEEK_SET); + avio_seek(pb, startpos + size, SEEK_SET); } - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); return 1; } @@ -536,12 +536,12 @@ static int ea_read_packet(AVFormatContext *s, case fVGT_TAG: case MADm_TAG: case MADe_TAG: - url_fseek(pb, -8, SEEK_CUR); // include chunk preamble + avio_seek(pb, -8, SEEK_CUR); // include chunk preamble chunk_size += 8; goto get_video_packet; case mTCD_TAG: - url_fseek(pb, 8, SEEK_CUR); // skip ea dct header + avio_seek(pb, 8, SEEK_CUR); // skip ea dct header chunk_size -= 8; goto get_video_packet; @@ -560,7 +560,7 @@ get_video_packet: break; default: - url_fseek(pb, chunk_size, SEEK_CUR); + avio_seek(pb, chunk_size, SEEK_CUR); break; } } diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 1ae1422ea2..764d55c60a 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -118,7 +118,7 @@ static int ffm_read_data(AVFormatContext *s, len = size; if (len == 0) { if (url_ftell(pb) == ffm->file_size) - url_fseek(pb, ffm->packet_size, SEEK_SET); + avio_seek(pb, ffm->packet_size, SEEK_SET); retry_read: id = avio_rb16(pb); /* PACKET_ID */ if (id != PACKET_ID) @@ -137,7 +137,7 @@ static int ffm_read_data(AVFormatContext *s, if (!frame_offset) { /* This packet has no frame headers in it */ if (url_ftell(pb) >= ffm->packet_size * 3) { - url_fseek(pb, -ffm->packet_size * 2, SEEK_CUR); + avio_seek(pb, -ffm->packet_size * 2, SEEK_CUR); goto retry_read; } /* This is bad, we cannot find a valid frame header */ @@ -178,7 +178,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1) #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); #endif - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static int64_t get_dts(AVFormatContext *s, int64_t pos) @@ -248,7 +248,7 @@ static void adjust_write_index(AVFormatContext *s) //printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. ); end: - url_fseek(pb, ptr, SEEK_SET); + avio_seek(pb, ptr, SEEK_SET); } diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 87219c83ff..8a0770e688 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -43,7 +43,7 @@ static int read_header(AVFormatContext *s, if (url_is_streamed(s->pb)) return AVERROR(EIO); - url_fseek(pb, url_fsize(pb) - 36, SEEK_SET); + avio_seek(pb, url_fsize(pb) - 36, SEEK_SET); if (avio_rb32(pb) != RAND_TAG) { av_log(s, AV_LOG_ERROR, "magic number not found"); return AVERROR_INVALIDDATA; @@ -69,7 +69,7 @@ static int read_header(AVFormatContext *s, film->leading = avio_rb16(pb); av_set_pts_info(st, 64, 1, avio_rb16(pb)); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); return 0; } @@ -94,7 +94,7 @@ static int read_packet(AVFormatContext *s, static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVStream *st = s->streams[stream_index]; - url_fseek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET); + avio_seek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET); return 0; } diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index bed9863f9a..73eeacb422 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -41,7 +41,7 @@ static int flac_read_header(AVFormatContext *s, /* if fLaC marker is not found, assume there is no header */ if (avio_rl32(s->pb) != MKTAG('f','L','a','C')) { - url_fseek(s->pb, -4, SEEK_CUR); + avio_seek(s->pb, -4, SEEK_CUR); return 0; } @@ -65,7 +65,7 @@ static int flac_read_header(AVFormatContext *s, break; /* skip metadata block for unsupported types */ default: - ret = url_fseek(s->pb, metadata_size, SEEK_CUR); + ret = avio_seek(s->pb, metadata_size, SEEK_CUR); if (ret < 0) return ret; } diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index d11d75d27d..cfd9e09499 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -101,9 +101,9 @@ static int flac_write_trailer(struct AVFormatContext *s) if (!url_is_streamed(pb)) { /* rewrite the STREAMINFO header block data */ file_size = url_ftell(pb); - url_fseek(pb, 8, SEEK_SET); + avio_seek(pb, 8, SEEK_SET); avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } else { av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n"); diff --git a/libavformat/flic.c b/libavformat/flic.c index 2f6e218357..cdbd9c80eb 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -135,7 +135,7 @@ static int flic_read_header(AVFormatContext *s, return AVERROR(EIO); } - url_fseek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR); + avio_seek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR); /* Time to figure out the framerate: * If the first preamble's magic number is 0xAAAA then this file is from @@ -173,7 +173,7 @@ static int flic_read_header(AVFormatContext *s, av_set_pts_info(st, 64, FLIC_MC_SPEED, 70); /* rewind the stream since the first chunk is at offset 12 */ - url_fseek(pb, 12, SEEK_SET); + avio_seek(pb, 12, SEEK_SET); /* send over abbreviated FLIC header chunk */ av_free(st->codec->extradata); @@ -239,7 +239,7 @@ static int flic_read_packet(AVFormatContext *s, } /* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */ - url_fseek(pb, 10, SEEK_CUR); + avio_seek(pb, 10, SEEK_CUR); pkt->stream_index = flic->audio_stream_index; pkt->pos = url_ftell(pb); @@ -253,7 +253,7 @@ static int flic_read_packet(AVFormatContext *s, packet_read = 1; } else { /* not interested in this chunk */ - url_fseek(pb, size - 6, SEEK_CUR); + avio_seek(pb, size - 6, SEEK_CUR); } } diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index e42598d98e..05f1ab558a 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -277,7 +277,7 @@ static int flv_read_header(AVFormatContext *s, } offset = avio_rb32(s->pb); - url_fseek(s->pb, offset, SEEK_SET); + avio_seek(s->pb, offset, SEEK_SET); url_fskip(s->pb, 4); s->start_time = 0; @@ -337,7 +337,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) else /* skip packet */ av_log(s, AV_LOG_DEBUG, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags); skip: - url_fseek(s->pb, next, SEEK_SET); + avio_seek(s->pb, next, SEEK_SET); continue; } @@ -361,7 +361,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) ||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) || st->discard >= AVDISCARD_ALL ){ - url_fseek(s->pb, next, SEEK_SET); + avio_seek(s->pb, next, SEEK_SET); continue; } if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY) @@ -374,15 +374,15 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int size; const int64_t pos= url_ftell(s->pb); const int64_t fsize= url_fsize(s->pb); - url_fseek(s->pb, fsize-4, SEEK_SET); + avio_seek(s->pb, fsize-4, SEEK_SET); size= avio_rb32(s->pb); - url_fseek(s->pb, fsize-3-size, SEEK_SET); + avio_seek(s->pb, fsize-3-size, SEEK_SET); if(size == avio_rb24(s->pb) + 11){ uint32_t ts = avio_rb24(s->pb); ts |= avio_r8(s->pb) << 24; s->duration = ts * (int64_t)AV_TIME_BASE / 1000; } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); } if(is_audio){ diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 4d49a966e9..7dd47da8a4 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -289,9 +289,9 @@ static int flv_write_header(AVFormatContext *s) /* write total size of tag */ data_size= url_ftell(pb) - metadata_size_pos - 10; - url_fseek(pb, metadata_size_pos, SEEK_SET); + avio_seek(pb, metadata_size_pos, SEEK_SET); avio_wb24(pb, data_size); - url_fseek(pb, data_size + 10 - 3, SEEK_CUR); + avio_seek(pb, data_size + 10 - 3, SEEK_CUR); avio_wb32(pb, data_size + 11); for (i = 0; i < s->nb_streams; i++) { @@ -316,9 +316,9 @@ static int flv_write_header(AVFormatContext *s) ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size); } data_size = url_ftell(pb) - pos; - url_fseek(pb, -data_size - 10, SEEK_CUR); + avio_seek(pb, -data_size - 10, SEEK_CUR); avio_wb24(pb, data_size); - url_fseek(pb, data_size + 10 - 3, SEEK_CUR); + avio_seek(pb, data_size + 10 - 3, SEEK_CUR); avio_wb32(pb, data_size + 11); // previous tag size } } @@ -346,12 +346,12 @@ static int flv_write_trailer(AVFormatContext *s) file_size = url_ftell(pb); /* update informations */ - url_fseek(pb, flv->duration_offset, SEEK_SET); + avio_seek(pb, flv->duration_offset, SEEK_SET); put_amf_double(pb, flv->duration / (double)1000); - url_fseek(pb, flv->filesize_offset, SEEK_SET); + avio_seek(pb, flv->filesize_offset, SEEK_SET); put_amf_double(pb, file_size); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); return 0; } diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 5b8b33c5f2..b290035c90 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -397,10 +397,10 @@ start: if (tmp != 1) goto start; last_pos = url_ftell(pb); - if (url_fseek(pb, -5, SEEK_CUR) < 0) + if (avio_seek(pb, -5, SEEK_CUR) < 0) goto out; if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) { - if (url_fseek(pb, last_pos, SEEK_SET) < 0) + if (avio_seek(pb, last_pos, SEEK_SET) < 0) goto out; goto start; } @@ -409,12 +409,12 @@ start: cur_timestamp = avio_rb32(pb); last_found_pos = url_ftell(pb) - 16 - 6; if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) { - if (url_fseek(pb, last_pos, SEEK_SET) >= 0) + if (avio_seek(pb, last_pos, SEEK_SET) >= 0) goto start; } out: if (last_found_pos) - url_fseek(pb, last_found_pos, SEEK_SET); + avio_seek(pb, last_found_pos, SEEK_SET); return cur_timestamp; } @@ -495,7 +495,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int if (idx < st->nb_index_entries - 2) maxlen = st->index_entries[idx + 2].pos - pos; maxlen = FFMAX(maxlen, 200 * 1024); - res = url_fseek(s->pb, pos, SEEK_SET); + res = avio_seek(s->pb, pos, SEEK_SET); if (res < 0) return res; found = gxf_resync_media(s, maxlen, -1, timestamp); @@ -508,7 +508,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit) { AVIOContext *pb = s->pb; int64_t res; - if (url_fseek(pb, *pos, SEEK_SET) < 0) + if (avio_seek(pb, *pos, SEEK_SET) < 0) return AV_NOPTS_VALUE; res = gxf_resync_media(s, pos_limit - *pos, -1, -1); *pos = url_ftell(pb); diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 1b12f41e22..66accb3e08 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -131,9 +131,9 @@ static int64_t updatePacketSize(AVIOContext *pb, int64_t pos) size = url_ftell(pb) - pos; } curpos = url_ftell(pb); - url_fseek(pb, pos + 6, SEEK_SET); + avio_seek(pb, pos + 6, SEEK_SET); avio_wb32(pb, size); - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return curpos - pos; } @@ -142,9 +142,9 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos) int64_t curpos; curpos = url_ftell(pb); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); avio_wb16(pb, curpos - pos - 2); - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return curpos - pos; } @@ -581,9 +581,9 @@ static int gxf_write_umf_media_description(AVFormatContext *s) } curpos = url_ftell(pb); - url_fseek(pb, startpos, SEEK_SET); + avio_seek(pb, startpos, SEEK_SET); avio_wl16(pb, curpos - startpos); - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); } return url_ftell(pb) - pos; } @@ -776,7 +776,7 @@ static int gxf_write_trailer(AVFormatContext *s) gxf_write_eos_packet(pb); end = url_ftell(pb); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); /* overwrite map, flt and umf packets with new values */ gxf_write_map_packet(s, 1); gxf_write_flt_packet(s); @@ -784,12 +784,12 @@ static int gxf_write_trailer(AVFormatContext *s) put_flush_packet(pb); /* update duration in all map packets */ for (i = 1; i < gxf->map_offsets_nb; i++) { - url_fseek(pb, gxf->map_offsets[i], SEEK_SET); + avio_seek(pb, gxf->map_offsets[i], SEEK_SET); gxf_write_map_packet(s, 1); put_flush_packet(pb); } - url_fseek(pb, end, SEEK_SET); + avio_seek(pb, end, SEEK_SET); av_freep(&gxf->flt_entries); av_freep(&gxf->map_offsets); diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c index 35199d89f8..e17e785ad5 100644 --- a/libavformat/id3v1.c +++ b/libavformat/id3v1.c @@ -232,12 +232,12 @@ void ff_id3v1_read(AVFormatContext *s) /* XXX: change that */ filesize = url_fsize(s->pb); if (filesize > 128) { - url_fseek(s->pb, filesize - 128, SEEK_SET); + avio_seek(s->pb, filesize - 128, SEEK_SET); ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE); if (ret == ID3v1_TAG_SIZE) { parse_tag(s, buf); } - url_fseek(s->pb, 0, SEEK_SET); + avio_seek(s->pb, 0, SEEK_SET); } } } diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index a3e51407e9..43a41c2d55 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -230,7 +230,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t break; } /* Skip to end of tag */ - url_fseek(s->pb, next, SEEK_SET); + avio_seek(s->pb, next, SEEK_SET); } if (len > 0) { @@ -271,7 +271,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) (buf[9] & 0x7f); ff_id3v2_parse(s, len, buf[3], buf[5]); } else { - url_fseek(s->pb, off, SEEK_SET); + avio_seek(s->pb, off, SEEK_SET); } } while (found_header); ff_metadata_conv(&s->metadata, NULL, ff_id3v2_34_metadata_conv); diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 7421901a9b..1aecf86669 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -257,7 +257,7 @@ static int idcin_read_packet(AVFormatContext *s, chunk_size = avio_rl32(pb); /* skip the number of decoded bytes (always equal to width * height) */ - url_fseek(pb, 4, SEEK_CUR); + avio_seek(pb, 4, SEEK_CUR); chunk_size -= 4; ret= av_get_packet(pb, pkt, chunk_size); if (ret < 0) diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 5b18397532..71324d8803 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -136,14 +136,14 @@ static int roq_read_packet(AVFormatContext *s, break; } /* don't care about this chunk anymore */ - url_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR); + avio_seek(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); + avio_seek(pb, codebook_size, SEEK_CUR); if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); @@ -151,7 +151,7 @@ static int roq_read_packet(AVFormatContext *s, codebook_size; /* rewind */ - url_fseek(pb, codebook_offset, SEEK_SET); + avio_seek(pb, codebook_offset, SEEK_SET); /* load up the packet */ ret= av_get_packet(pb, pkt, chunk_size); diff --git a/libavformat/iff.c b/libavformat/iff.c index 15327c2421..a5332ab945 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -226,7 +226,7 @@ static int iff_read_header(AVFormatContext *s, url_fskip(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1)); } - url_fseek(pb, iff->body_pos, SEEK_SET); + avio_seek(pb, iff->body_pos, SEEK_SET); switch(st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 6514397a1e..e02e00b15a 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -133,7 +133,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, s->audio_chunk_size -= 6; } - url_fseek(pb, s->audio_chunk_offset, SEEK_SET); + avio_seek(pb, s->audio_chunk_offset, SEEK_SET); s->audio_chunk_offset = 0; if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size)) @@ -163,7 +163,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, return CHUNK_NOMEM; pkt->pos= s->decode_map_chunk_offset; - url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET); + avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET); s->decode_map_chunk_offset = 0; if (avio_read(pb, pkt->data, s->decode_map_chunk_size) != @@ -172,7 +172,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, return CHUNK_EOF; } - url_fseek(pb, s->video_chunk_offset, SEEK_SET); + avio_seek(pb, s->video_chunk_offset, SEEK_SET); s->video_chunk_offset = 0; if (avio_read(pb, pkt->data + s->decode_map_chunk_size, @@ -193,7 +193,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, } else { - url_fseek(pb, s->next_chunk_offset, SEEK_SET); + avio_seek(pb, s->next_chunk_offset, SEEK_SET); chunk_type = CHUNK_DONE; } @@ -299,12 +299,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_END_OF_STREAM: debug_ipmovie("end of stream\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_END_OF_CHUNK: debug_ipmovie("end of chunk\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_CREATE_TIMER: @@ -359,7 +359,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_START_STOP_AUDIO: debug_ipmovie("start/stop audio\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_INIT_VIDEO_BUFFERS: @@ -393,12 +393,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_UNKNOWN_14: case OPCODE_UNKNOWN_15: debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SEND_BUFFER: debug_ipmovie("send buffer\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_AUDIO_FRAME: @@ -407,22 +407,22 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->audio_chunk_offset = url_ftell(pb); s->audio_chunk_size = opcode_size; - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SILENCE_FRAME: debug_ipmovie("silence frame\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_INIT_VIDEO_MODE: debug_ipmovie("initialize video mode\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_CREATE_GRADIENT: debug_ipmovie("create gradient\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SET_PALETTE: @@ -464,7 +464,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_SET_PALETTE_COMPRESSED: debug_ipmovie("set palette compressed\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SET_DECODING_MAP: @@ -473,7 +473,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->decode_map_chunk_offset = url_ftell(pb); s->decode_map_chunk_size = opcode_size; - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_VIDEO_DATA: @@ -482,7 +482,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->video_chunk_offset = url_ftell(pb); s->video_chunk_size = opcode_size; - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; default: @@ -553,7 +553,7 @@ static int ipmovie_read_header(AVFormatContext *s, CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); chunk_type = AV_RL16(&chunk_preamble[2]); - url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR); + avio_seek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR); if (chunk_type == CHUNK_VIDEO) ipmovie->audio_type = CODEC_ID_NONE; /* no audio */ diff --git a/libavformat/libnut.c b/libavformat/libnut.c index af94d8c30e..467ca9c4a5 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -182,7 +182,7 @@ static off_t av_seek(void * h, long long pos, int whence) { pos = url_fsize(bc) + pos; whence = SEEK_SET; } - return url_fseek(bc, pos, whence); + return avio_seek(bc, pos, whence); } static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 4488dd6c50..72abfc1d56 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -831,7 +831,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, return ebml_parse_nest(matroska, syntax->def.n, data); case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data); case EBML_STOP: return 1; - default: return url_fseek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0; + default: return avio_seek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0; } if (res == AVERROR_INVALIDDATA) av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n"); @@ -1130,7 +1130,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) continue; /* seek */ - if (url_fseek(matroska->ctx->pb, offset, SEEK_SET) != offset) + if (avio_seek(matroska->ctx->pb, offset, SEEK_SET) != offset) continue; /* We don't want to lose our seekhead level, so we add @@ -1159,7 +1159,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) } /* seek back */ - url_fseek(matroska->ctx->pb, before_pos, SEEK_SET); + avio_seek(matroska->ctx->pb, before_pos, SEEK_SET); matroska->level_up = level_up; matroska->current_id = saved_id; } @@ -1889,7 +1889,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, timestamp = FFMAX(timestamp, st->index_entries[0].timestamp); if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) { - url_fseek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET); while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) { matroska_clear_queue(matroska); if (matroska_parse_cluster(matroska) < 0) @@ -1914,7 +1914,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, } } - url_fseek(s->pb, st->index_entries[index_min].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET); matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY); matroska->skip_to_timecode = st->index_entries[index].timestamp; matroska->done = 0; diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 2f075942ec..6f752204cc 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -231,10 +231,10 @@ static void end_ebml_master(AVIOContext *pb, ebml_master master) { int64_t pos = url_ftell(pb); - if (url_fseek(pb, master.pos - master.sizebytes, SEEK_SET) < 0) + if (avio_seek(pb, master.pos - master.sizebytes, SEEK_SET) < 0) return; put_ebml_num(pb, pos - master.pos, master.sizebytes); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static void put_xiph_size(AVIOContext *pb, int size) @@ -313,7 +313,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) currentpos = url_ftell(pb); if (seekhead->reserved_size > 0) - if (url_fseek(pb, seekhead->filepos, SEEK_SET) < 0) + if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0) return -1; metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size); @@ -334,7 +334,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) if (seekhead->reserved_size > 0) { uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb); put_ebml_void(pb, remaining); - url_fseek(pb, currentpos, SEEK_SET); + avio_seek(pb, currentpos, SEEK_SET); currentpos = seekhead->filepos; } @@ -1163,10 +1163,10 @@ static int mkv_write_trailer(AVFormatContext *s) // update the duration av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration); currentpos = url_ftell(pb); - url_fseek(pb, mkv->duration_offset, SEEK_SET); + avio_seek(pb, mkv->duration_offset, SEEK_SET); put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration); - url_fseek(pb, currentpos, SEEK_SET); + avio_seek(pb, currentpos, SEEK_SET); } end_ebml_master(pb, mkv->segment); diff --git a/libavformat/mm.c b/libavformat/mm.c index 2c0d215abf..699daac5e9 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -102,7 +102,7 @@ static int read_header(AVFormatContext *s, avio_rl16(pb); /* ibm-pc video bios mode */ width = avio_rl16(pb); height = avio_rl16(pb); - url_fseek(pb, length - 10, SEEK_CUR); /* unknown data */ + avio_seek(pb, length - 10, SEEK_CUR); /* unknown data */ /* video stream */ st = av_new_stream(s, 0); @@ -181,7 +181,7 @@ static int read_packet(AVFormatContext *s, default : av_log(s, AV_LOG_INFO, "unknown chunk type 0x%x\n", type); - url_fseek(pb, length, SEEK_CUR); + avio_seek(pb, length, SEEK_CUR); } } diff --git a/libavformat/mmf.c b/libavformat/mmf.c index bcb862c4b5..a68870c1c2 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -53,9 +53,9 @@ static void end_tag_be(AVIOContext *pb, int64_t start) int64_t pos; pos = url_ftell(pb); - url_fseek(pb, start - 4, SEEK_SET); + avio_seek(pb, start - 4, SEEK_SET); avio_wb32(pb, (uint32_t)(pos - start)); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static int mmf_write_header(AVFormatContext *s) @@ -143,7 +143,7 @@ static int mmf_write_trailer(AVFormatContext *s) size = pos - mmf->awapos; /* Fill Atsq chunk */ - url_fseek(pb, mmf->atsqpos, SEEK_SET); + avio_seek(pb, mmf->atsqpos, SEEK_SET); /* "play wav" */ avio_w8(pb, 0); /* start time */ @@ -158,7 +158,7 @@ static int mmf_write_trailer(AVFormatContext *s) /* "end of sequence" */ avio_write(pb, "\x00\x00\x00\x00", 4); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); put_flush_packet(pb); } @@ -195,7 +195,7 @@ static int mmf_read_header(AVFormatContext *s, file_size = avio_rb32(pb); /* Skip some unused chunks that may or may not be present */ - for(;; url_fseek(pb, size, SEEK_CUR)) { + for(;; avio_seek(pb, size, SEEK_CUR)) { tag = avio_rl32(pb); size = avio_rb32(pb); if(tag == MKTAG('C','N','T','I')) continue; @@ -226,7 +226,7 @@ static int mmf_read_header(AVFormatContext *s, avio_r8(pb); /* time base g */ /* Skip some unused chunks that may or may not be present */ - for(;; url_fseek(pb, size, SEEK_CUR)) { + for(;; avio_seek(pb, size, SEEK_CUR)) { tag = avio_rl32(pb); size = avio_rb32(pb); if(tag == MKTAG('A','t','s','q')) continue; diff --git a/libavformat/mov.c b/libavformat/mov.c index 6becc77c0c..f8360c6e61 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -419,7 +419,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) url_fskip(pb, len); } } - url_fseek(pb, next, SEEK_SET); + avio_seek(pb, next, SEEK_SET); } return 0; } @@ -1840,7 +1840,7 @@ static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom) uint32_t tag = avio_rl32(pb); atom.size -= 4; if (tag == MKTAG('h','d','l','r')) { - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); atom.size += 8; return mov_read_default(c, pb, atom); } @@ -2308,7 +2308,7 @@ static void mov_read_chapters(AVFormatContext *s) uint16_t ch; int len, title_len; - if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { + if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); goto finish; } @@ -2338,7 +2338,7 @@ static void mov_read_chapters(AVFormatContext *s) av_freep(&title); } finish: - url_fseek(sc->pb, cur_pos, SEEK_SET); + avio_seek(sc->pb, cur_pos, SEEK_SET); } static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -2421,7 +2421,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) sc->current_sample++; if (st->discard != AVDISCARD_ALL) { - if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { + if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n", sc->ffindex, sample->pos); return -1; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index de16b5b190..030cbda467 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -40,9 +40,9 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos) { int64_t curpos = url_ftell(pb); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); avio_wb32(pb, curpos - pos); /* rewrite size */ - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return curpos - pos; } @@ -130,9 +130,9 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) } } curpos = url_ftell(pb); - url_fseek(pb, entryPos, SEEK_SET); + avio_seek(pb, entryPos, SEEK_SET); avio_wb32(pb, index); // rewrite size - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return updateSize(pb, pos); } @@ -155,9 +155,9 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) } } curpos = url_ftell(pb); - url_fseek(pb, entryPos, SEEK_SET); + avio_seek(pb, entryPos, SEEK_SET); avio_wb32(pb, index); // rewrite size - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return updateSize(pb, pos); } @@ -2235,16 +2235,16 @@ static int mov_write_trailer(AVFormatContext *s) /* Write size of mdat tag */ if (mov->mdat_size+8 <= UINT32_MAX) { - url_fseek(pb, mov->mdat_pos, SEEK_SET); + avio_seek(pb, mov->mdat_pos, SEEK_SET); avio_wb32(pb, mov->mdat_size+8); } else { /* overwrite 'wide' placeholder atom */ - url_fseek(pb, mov->mdat_pos - 8, SEEK_SET); + avio_seek(pb, mov->mdat_pos - 8, SEEK_SET); avio_wb32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */ ffio_wfourcc(pb, "mdat"); avio_wb64(pb, mov->mdat_size+16); } - url_fseek(pb, moov_pos, SEEK_SET); + avio_seek(pb, moov_pos, SEEK_SET); mov_write_moov_tag(pb, mov, s); diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index fbc7faace6..e6f74cdb0f 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -372,15 +372,15 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, size -= packet_len; curpos = url_ftell(out); - url_fseek(out, entries_pos, SEEK_SET); + avio_seek(out, entries_pos, SEEK_SET); avio_wb16(out, entries); - url_fseek(out, curpos, SEEK_SET); + avio_seek(out, curpos, SEEK_SET); } curpos = url_ftell(out); - url_fseek(out, count_pos, SEEK_SET); + avio_seek(out, count_pos, SEEK_SET); avio_wb16(out, count); - url_fseek(out, curpos, SEEK_SET); + avio_seek(out, curpos, SEEK_SET); return count; } diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index a71638ee13..f90348c114 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -90,7 +90,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) return -1; /* Check for Xing / Info tag */ - url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR); + avio_seek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR); v = avio_rb32(s->pb); if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) { v = avio_rb32(s->pb); @@ -101,13 +101,13 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) } /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */ - url_fseek(s->pb, base + 4 + 32, SEEK_SET); + avio_seek(s->pb, base + 4 + 32, SEEK_SET); v = avio_rb32(s->pb); if(v == MKBETAG('V', 'B', 'R', 'I')) { /* Check tag version */ if(avio_rb16(s->pb) == 1) { /* skip delay and quality */ - url_fseek(s->pb, 4, SEEK_CUR); + avio_seek(s->pb, 4, SEEK_CUR); frames = avio_rb32(s->pb); size = avio_rb32(s->pb); } @@ -117,7 +117,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) return -1; /* Skip the vbr tag frame */ - url_fseek(s->pb, base + vbrtag_size, SEEK_SET); + avio_seek(s->pb, base + vbrtag_size, SEEK_SET); spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */ if(frames) @@ -153,7 +153,7 @@ static int mp3_read_header(AVFormatContext *s, ff_id3v1_read(s); if (mp3_parse_vbr_tags(s, st, off) < 0) - url_fseek(s->pb, off, SEEK_SET); + avio_seek(s->pb, off, SEEK_SET); /* the parameters will be extracted from the compressed bitstream */ return 0; diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 0635228f61..c465420691 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -238,9 +238,9 @@ static int mp3_write_header(struct AVFormatContext *s) } cur_pos = url_ftell(s->pb); - url_fseek(s->pb, size_pos, SEEK_SET); + avio_seek(s->pb, size_pos, SEEK_SET); id3v2_put_size(s, totlen); - url_fseek(s->pb, cur_pos, SEEK_SET); + avio_seek(s->pb, cur_pos, SEEK_SET); return 0; } diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 73217a31ea..c22938366b 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -98,7 +98,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) ff_ape_parse_tag(s); if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); } return 0; @@ -114,7 +114,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) return -1; if(c->curframe != c->lastframe + 1){ - url_fseek(s->pb, c->frames[c->curframe].pos, SEEK_SET); + avio_seek(s->pb, c->frames[c->curframe].pos, SEEK_SET); c->curbits = c->frames[c->curframe].skip; } c->lastframe = c->curframe; @@ -129,7 +129,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) size2 = (tmp >> (44 - curbits)) & 0xFFFFF; } curbits += 20; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); size = ((size2 + curbits + 31) & ~31) >> 3; if(cur == c->frames_noted){ @@ -153,7 +153,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pts = cur; ret = avio_read(s->pb, pkt->data + 4, size); if(c->curbits) - url_fseek(s->pb, -4, SEEK_CUR); + avio_seek(s->pb, -4, SEEK_CUR); if(ret < size){ av_free_packet(pkt); return AVERROR(EIO); diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 22439f94a0..893fb6b191 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -135,7 +135,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) int i, t, seekd; GetBitContext gb; - url_fseek(s->pb, off, SEEK_SET); + avio_seek(s->pb, off, SEEK_SET); mpc8_get_chunk_header(s->pb, &tag, &size); if(tag != TAG_SEEKTABLE){ av_log(s, AV_LOG_ERROR, "No seek table at given position\n"); @@ -179,7 +179,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in pos = url_ftell(pb) + size; off = ff_get_v(pb); mpc8_parse_seektable(s, chunk_pos + off); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); break; default: url_fskip(pb, size); @@ -273,7 +273,7 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam int index = av_index_search_timestamp(st, timestamp, flags); if(index < 0) return -1; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); c->frame = st->index_entries[index].timestamp; return 0; } diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index c5b6bfc727..6c7481e79c 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -175,7 +175,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) pos = pos_start - 16386; if (pos < 0) pos = 0; - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); avio_r8(pb); pos = pos_start; @@ -185,7 +185,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) start_code = -1; goto the_end; } - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); start_code = avio_rb32(pb); if ((start_code & 0xffffff00) == 0x100) break; @@ -244,7 +244,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, int64_t last_sync= url_ftell(s->pb); error_redo: - url_fseek(s->pb, last_sync, SEEK_SET); + avio_seek(s->pb, last_sync, SEEK_SET); redo: /* next start code (should be immediately after) */ m->header_state = 0xff; @@ -475,7 +475,7 @@ static int mpegps_read_packet(AVFormatContext *s, static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; unsigned char buf[8]; avio_read(s->pb, buf, 8); - url_fseek(s->pb, -8, SEEK_CUR); + avio_seek(s->pb, -8, SEEK_CUR); if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) codec_id = CODEC_ID_CAVS; else @@ -587,7 +587,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, #ifdef DEBUG_SEEK printf("read_dts: pos=0x%"PRIx64" next=%d -> ", pos, find_next); #endif - if (url_fseek(s->pb, pos, SEEK_SET) < 0) + if (avio_seek(s->pb, pos, SEEK_SET) < 0) return AV_NOPTS_VALUE; for(;;) { diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 3307685b41..6a1b77301b 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1316,7 +1316,7 @@ static int mpegts_resync(AVFormatContext *s) if (c < 0) return -1; if (c == 0x47) { - url_fseek(pb, -1, SEEK_CUR); + avio_seek(pb, -1, SEEK_CUR); return 0; } } @@ -1338,7 +1338,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) /* check paquet sync byte */ if (buf[0] != 0x47) { /* find a new packet start */ - url_fseek(pb, -TS_PACKET_SIZE, SEEK_CUR); + avio_seek(pb, -TS_PACKET_SIZE, SEEK_CUR); if (mpegts_resync(s) < 0) return AVERROR(EAGAIN); else @@ -1468,7 +1468,7 @@ static int mpegts_read_header(AVFormatContext *s, /* normal demux */ /* first do a scaning to get all the services */ - if (url_fseek(pb, pos, SEEK_SET) < 0) + if (avio_seek(pb, pos, SEEK_SET) < 0) av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n"); mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1); @@ -1533,7 +1533,7 @@ static int mpegts_read_header(AVFormatContext *s, #endif } - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); return 0; fail: return -1; @@ -1564,7 +1564,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, /* we read the next PCR (XXX: optimize it by using a bigger buffer */ pos = url_ftell(s->pb); for(i = 0; i < MAX_PACKET_READAHEAD; i++) { - url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET); + avio_seek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET); avio_read(s->pb, pcr_buf, 12); if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) { /* XXX: not precise enough */ @@ -1573,7 +1573,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, break; } } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); /* no next PCR found: we use previous increment */ ts->cur_pcr = pcr_h * 300 + pcr_l; } @@ -1649,7 +1649,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, pos = ((*ppos + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47; if (find_next) { for(;;) { - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && @@ -1663,7 +1663,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, pos -= ts->raw_packet_size; if (pos < 0) return AV_NOPTS_VALUE; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && @@ -1774,14 +1774,14 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in pos= url_ftell(s->pb); for(;;) { - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return -1; // pid = AV_RB16(buf + 1) & 0x1fff; if(buf[1] & 0x40) break; pos += ts->raw_packet_size; } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); return 0; } diff --git a/libavformat/mtv.c b/libavformat/mtv.c index 94d8aff548..af1a8f01ce 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -146,7 +146,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) // Jump over header - if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE) + if(avio_seek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE) return AVERROR(EIO); return 0; diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 9f694e30ff..3810c0cc63 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -897,7 +897,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF else if (read_child(ctx, pb, tag, size, uid) < 0) return -1; - url_fseek(pb, next, SEEK_SET); + avio_seek(pb, next, SEEK_SET); } if (ctx_size) ctx->type = type; return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0; @@ -912,7 +912,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n"); return -1; } - url_fseek(s->pb, -14, SEEK_CUR); + avio_seek(s->pb, -14, SEEK_CUR); mxf->fc = s; while (!url_feof(s->pb)) { const MXFMetadataReadTableEntry *metadata; @@ -924,7 +924,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || IS_KLV_KEY(klv.key, mxf_essence_element_key)) { /* FIXME avoid seek */ - url_fseek(s->pb, klv.offset, SEEK_SET); + avio_seek(s->pb, klv.offset, SEEK_SET); break; } @@ -1009,7 +1009,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti if (sample_time < 0) sample_time = 0; seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den); - url_fseek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); + avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); av_update_cur_dts(s, st, sample_time); return 0; } diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 9e63531388..395d7c392d 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1267,9 +1267,9 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, header_byte_count = pos - start + klv_fill_size(pos); // update header_byte_count - url_fseek(pb, header_byte_count_offset, SEEK_SET); + avio_seek(pb, header_byte_count_offset, SEEK_SET); avio_wb64(pb, header_byte_count); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } put_flush_packet(pb); @@ -1785,7 +1785,7 @@ static int mxf_write_footer(AVFormatContext *s) mxf_write_random_index_pack(s); if (!url_is_streamed(s->pb)) { - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); if (mxf->edit_unit_byte_count) { mxf_write_partition(s, 1, 2, header_closed_partition_key, 1); mxf_write_klv_fill(s); diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 6ac8866144..dfd5e0fc78 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -364,7 +364,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) av_dlog(s, "NSV [dataoffset][fileoffset]\n", table_entries); for (i = 0; i < table_entries; i++) { unsigned char b[8]; - url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); + avio_seek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); avio_read(pb, b, 8); av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x" "%c%c%c%c%c%c%c%c\n", @@ -372,11 +372,11 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) ); } - //url_fseek(pb, size, SEEK_SET); /* go back to end of header */ + //avio_seek(pb, size, SEEK_SET); /* go back to end of header */ #undef V #endif - url_fseek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */ + avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */ if (url_feof(pb)) return -1; @@ -700,7 +700,7 @@ static int nsv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp if(index < 0) return -1; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); nst->frame_offset = st->index_entries[index].timestamp; nsv->state = NSV_UNSYNC; return 0; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index a2e6ec17f1..7920b0d13f 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -119,7 +119,7 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){ uint64_t state=0; if(pos >= 0) - url_fseek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are + avio_seek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are while(!url_feof(bc)){ state= (state<<8) | avio_r8(bc); @@ -178,7 +178,7 @@ static int nut_probe(AVProbeData *p){ static int skip_reserved(AVIOContext *bc, int64_t pos){ pos -= url_ftell(bc); if(pos<0){ - url_fseek(bc, pos, SEEK_CUR); + avio_seek(bc, pos, SEEK_CUR); return -1; }else{ while(pos--) @@ -513,8 +513,8 @@ static int find_and_decode_index(NUTContext *nut){ int8_t *has_keyframe; int ret= -1; - url_fseek(bc, filesize-12, SEEK_SET); - url_fseek(bc, filesize-avio_rb64(bc), SEEK_SET); + avio_seek(bc, filesize-12, SEEK_SET); + avio_seek(bc, filesize-avio_rb64(bc), SEEK_SET); if(avio_rb64(bc) != INDEX_STARTCODE){ av_log(s, AV_LOG_ERROR, "no index at the end\n"); return -1; @@ -655,7 +655,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) if(!url_is_streamed(bc)){ int64_t orig_pos= url_ftell(bc); find_and_decode_index(nut); - url_fseek(bc, orig_pos, SEEK_SET); + avio_seek(bc, orig_pos, SEEK_SET); } assert(nut->next_startcode == SYNCPOINT_STARTCODE); @@ -803,7 +803,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) case STREAM_STARTCODE: case INDEX_STARTCODE: skip= get_packetheader(nut, bc, 0, tmp); - url_fseek(bc, skip, SEEK_CUR); + avio_seek(bc, skip, SEEK_CUR); break; case INFO_STARTCODE: if(decode_info_header(nut)<0) @@ -900,7 +900,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag } av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2); pos= find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos); if(pos2 > pos || pos2 + 15 < pos){ av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n"); diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index a79cd3ef9d..af9860bf53 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -97,7 +97,7 @@ ogg_restore (AVFormatContext * s, int discard) for (i = 0; i < ogg->nstreams; i++) av_free (ogg->streams[i].buf); - url_fseek (bc, ost->pos, SEEK_SET); + avio_seek (bc, ost->pos, SEEK_SET); ogg->curidx = ost->curidx; ogg->nstreams = ost->nstreams; memcpy(ogg->streams, ost->streams, @@ -468,7 +468,7 @@ ogg_get_length (AVFormatContext * s) end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0; ogg_save (s); - url_fseek (s->pb, end, SEEK_SET); + avio_seek (s->pb, end, SEEK_SET); while (!ogg_read_page (s, &i)){ if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && @@ -604,7 +604,7 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg, AVIOContext *bc = s->pb; int64_t pts = AV_NOPTS_VALUE; int i; - url_fseek(bc, *pos_arg, SEEK_SET); + avio_seek(bc, *pos_arg, SEEK_SET); ogg_reset(ogg); while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) { diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index fc4010d3b8..92591dde12 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -69,9 +69,9 @@ static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc { int64_t pos = url_ftell(pb); uint32_t checksum = get_checksum(pb); - url_fseek(pb, crc_offset, SEEK_SET); + avio_seek(pb, crc_offset, SEEK_SET); avio_wb32(pb, checksum); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) diff --git a/libavformat/pcm.c b/libavformat/pcm.c index 5de23af1cb..def183c5b2 100644 --- a/libavformat/pcm.c +++ b/libavformat/pcm.c @@ -49,7 +49,7 @@ int pcm_read_seek(AVFormatContext *s, /* 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) + if ((ret = avio_seek(s->pb, pos + s->data_offset, SEEK_SET)) < 0) return ret; return 0; } diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index 69013c5f58..a0dc531ae6 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -112,7 +112,7 @@ static int str_read_header(AVFormatContext *s, else start = 0; - url_fseek(pb, start, SEEK_SET); + avio_seek(pb, start, SEEK_SET); for(i=0; i<32; i++){ str->channels[i].video_stream_index= diff --git a/libavformat/pva.c b/libavformat/pva.c index ea7db47c76..f781026c1c 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -182,7 +182,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, while (*pos < pos_limit) { res = AV_NOPTS_VALUE; - url_fseek(pb, *pos, SEEK_SET); + avio_seek(pb, *pos, SEEK_SET); pvactx->continue_pes = 0; if (read_part_of_packet(s, &res, &length, &streamid, 0)) { diff --git a/libavformat/r3d.c b/libavformat/r3d.c index bb39e03e50..63ed26cee3 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -180,7 +180,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) if (url_is_streamed(s->pb)) return 0; // find REOB/REOF/REOS to load index - url_fseek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET); + avio_seek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET); if (read_atom(s, &atom) < 0) av_log(s, AV_LOG_ERROR, "error reading end atom\n"); @@ -192,7 +192,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) r3d_read_reos(s); if (r3d->rdvo_offset) { - url_fseek(s->pb, r3d->rdvo_offset, SEEK_SET); + avio_seek(s->pb, r3d->rdvo_offset, SEEK_SET); if (read_atom(s, &atom) < 0) av_log(s, AV_LOG_ERROR, "error reading 'rdvo' atom\n"); if (atom.tag == MKTAG('R','D','V','O')) { @@ -202,7 +202,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) } out: - url_fseek(s->pb, s->data_offset, SEEK_SET); + avio_seek(s->pb, s->data_offset, SEEK_SET); return 0; } @@ -359,7 +359,7 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i av_dlog(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time); if (frame_num < r3d->video_offsets_count) { - url_fseek(s->pb, r3d->video_offsets_count, SEEK_SET); + avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET); } else { av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num); return -1; diff --git a/libavformat/rdt.c b/libavformat/rdt.c index ad84a6cbe5..022cb720ac 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -174,7 +174,7 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) size = avio_rb32(&pb); } else { size = rdt->mlti_data_size; - url_fseek(&pb, 0, SEEK_SET); + avio_seek(&pb, 0, SEEK_SET); } if (ff_rm_read_mdpr_codecdata(rdt->rmctx, &pb, st, rdt->rmst[st->index], size) < 0) return -1; diff --git a/libavformat/riff.c b/libavformat/riff.c index 4e21b1c841..9fd5c50609 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -332,9 +332,9 @@ void ff_end_tag(AVIOContext *pb, int64_t start) int64_t pos; pos = url_ftell(pb); - url_fseek(pb, start - 4, SEEK_SET); + avio_seek(pb, start - 4, SEEK_SET); avio_wl32(pb, (uint32_t)(pos - start)); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } /* WAVEFORMATEX header */ diff --git a/libavformat/rl2.c b/libavformat/rl2.c index 16e029f679..eb1ef1285e 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -237,7 +237,7 @@ static int rl2_read_packet(AVFormatContext *s, ++rl2->index_pos[stream_id]; /** position the stream (will probably be there anyway) */ - url_fseek(pb, sample->pos, SEEK_SET); + avio_seek(pb, sample->pos, SEEK_SET); /** fill the packet */ ret = av_get_packet(pb, pkt, sample->size); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index c34d128e40..4d7c763db4 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -363,7 +363,7 @@ static int rm_read_index(AVFormatContext *s) skip: if (next_off && url_ftell(pb) != next_off && - url_fseek(pb, next_off, SEEK_SET) < 0) + avio_seek(pb, next_off, SEEK_SET) < 0) return -1; } while (next_off); @@ -482,9 +482,9 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!data_off) data_off = url_ftell(pb) - 18; if (indx_off && !url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX) && - url_fseek(pb, indx_off, SEEK_SET) >= 0) { + avio_seek(pb, indx_off, SEEK_SET) >= 0) { rm_read_index(s); - url_fseek(pb, data_off + 18, SEEK_SET); + avio_seek(pb, data_off + 18, SEEK_SET); } return 0; @@ -904,7 +904,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, if(rm->old_format) return AV_NOPTS_VALUE; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); rm->remaining_len=0; for(;;){ int seq=1; diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 29a6a35d18..8a608861f5 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -436,7 +436,7 @@ static int rm_write_trailer(AVFormatContext *s) if (!url_is_streamed(s->pb)) { /* end of file: finish to write header */ - index_pos = url_fseek(pb, 0, SEEK_CUR); + index_pos = avio_seek(pb, 0, SEEK_CUR); data_size = index_pos - rm->data_pos; /* FIXME: write index */ @@ -445,7 +445,7 @@ static int rm_write_trailer(AVFormatContext *s) avio_wb32(pb, 0); avio_wb32(pb, 0); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); for(i=0;inb_streams;i++) rm->streams[i].total_frames = rm->streams[i].nb_frames; rv10_write_header(s, data_size, 0); diff --git a/libavformat/rpl.c b/libavformat/rpl.c index 5c0a21fe90..9702fc7035 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -250,7 +250,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) error |= read_line(pb, line, sizeof(line)); // offset to key frame list // Read the index - url_fseek(pb, chunk_catalog_offset, SEEK_SET); + avio_seek(pb, chunk_catalog_offset, SEEK_SET); total_audio_size = 0; for (i = 0; i < number_of_chunks; i++) { int64_t offset, video_size, audio_size; @@ -292,7 +292,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) index_entry = &stream->index_entries[rpl->chunk_number]; if (rpl->frame_in_part == 0) - if (url_fseek(pb, index_entry->pos, SEEK_SET) < 0) + if (avio_seek(pb, index_entry->pos, SEEK_SET) < 0) return AVERROR(EIO); if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO && @@ -303,7 +303,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) frame_flags = avio_rl32(pb); frame_size = avio_rl32(pb); - if (url_fseek(pb, -8, SEEK_CUR) < 0) + if (avio_seek(pb, -8, SEEK_CUR) < 0) return AVERROR(EIO); ret = av_get_packet(pb, pkt, frame_size); diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index 9c5ee9bd62..c776a1ac2a 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -91,9 +91,9 @@ static int rso_write_trailer(AVFormatContext *s) } /* update file size */ - url_fseek(pb, 2, SEEK_SET); + avio_seek(pb, 2, SEEK_SET); avio_wb16(pb, coded_file_size); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 24052a2357..7476bb944e 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -103,7 +103,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, skip_bits(&gb, 12); // reserved data_len = get_bits(&gb, 16); - url_fseek(&pb, pos + 4, SEEK_SET); + avio_seek(&pb, pos + 4, SEEK_SET); tag = avio_rl32(&pb); if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO && tag != MKTAG('v','i','d','e')) || @@ -157,7 +157,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, /* 32-bit alignment */ url_fskip(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb)); } else - url_fseek(&pb, 4, SEEK_SET); + avio_seek(&pb, 4, SEEK_SET); if (has_packet_info) { av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1); diff --git a/libavformat/sauce.c b/libavformat/sauce.c index e861b14e16..f4ebc2fe68 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -35,7 +35,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g int datatype, filetype, t1, t2, nb_comments, flags; uint64_t start_pos = url_fsize(pb) - 128; - url_fseek(pb, start_pos, SEEK_SET); + avio_seek(pb, start_pos, SEEK_SET); if (avio_read(pb, buf, 7) != 7) return -1; if (memcmp(buf, "SAUCE00", 7)) @@ -82,7 +82,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g *fsize -= 128; if (nb_comments > 0) { - url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET); + avio_seek(pb, start_pos - 64*nb_comments - 5, SEEK_SET); if (avio_read(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) { int i; char *str = av_malloc(65*nb_comments + 1); diff --git a/libavformat/seek.c b/libavformat/seek.c index 26b622f035..9fee91101c 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -313,7 +313,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s, step = s->pb->buffer_size; curpos = FFMAX(pos - step / 2, 0); for (;;) { - url_fseek(s->pb, curpos, SEEK_SET); + avio_seek(s->pb, curpos, SEEK_SET); search_hi_lo_keyframes(s, ts, time_base, flags, @@ -385,7 +385,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s, } } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); av_free(sync); return pos; } @@ -456,7 +456,7 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state) if (!state) return; - url_fseek(s->pb, state->fpos, SEEK_SET); + avio_seek(s->pb, state->fpos, SEEK_SET); // copy context structures s->cur_st = state->cur_st; diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 906cb915ad..7b689906cc 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -217,7 +217,7 @@ static int film_read_packet(AVFormatContext *s, sample = &film->sample_table[film->current_sample]; /* position the stream (will probably be there anyway) */ - url_fseek(pb, sample->sample_offset, SEEK_SET); + avio_seek(pb, sample->sample_offset, SEEK_SET); /* do a special song and dance when loading FILM Cinepak chunks */ if ((sample->stream == film->video_stream_index) && diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 323938639c..778746594a 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -95,7 +95,7 @@ static int vmd_read_header(AVFormatContext *s, int sound_buffers; /* fetch the main header, including the 2 header length bytes */ - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); if (avio_read(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE) return AVERROR(EIO); @@ -155,7 +155,7 @@ static int vmd_read_header(AVFormatContext *s, toc_offset = AV_RL32(&vmd->vmd_header[812]); vmd->frame_count = AV_RL16(&vmd->vmd_header[6]); vmd->frames_per_block = AV_RL16(&vmd->vmd_header[18]); - url_fseek(pb, toc_offset, SEEK_SET); + avio_seek(pb, toc_offset, SEEK_SET); raw_frame_table = NULL; vmd->frame_table = NULL; @@ -243,7 +243,7 @@ static int vmd_read_packet(AVFormatContext *s, frame = &vmd->frame_table[vmd->current_frame]; /* position the stream (will probably be there already) */ - url_fseek(pb, frame->frame_offset, SEEK_SET); + avio_seek(pb, frame->frame_offset, SEEK_SET); if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD)) return AVERROR(ENOMEM); diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 42d3672d79..8feb4e5f69 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -240,7 +240,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) /* if we demuxed all streams, pass another frame */ if(smk->curstream < 0) { - url_fseek(s->pb, smk->nextpos, 0); + avio_seek(s->pb, smk->nextpos, 0); frame_size = smk->frm_size[smk->cur_frame] & (~3); flags = smk->frm_flags[smk->cur_frame]; /* handle palette change event */ @@ -279,7 +279,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) sz++; } } - url_fseek(s->pb, pos, 0); + avio_seek(s->pb, pos, 0); palchange |= 1; } flags >>= 1; diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index 9c06dd7ea3..dbb2972ead 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -100,12 +100,12 @@ static int sox_write_trailer(AVFormatContext *s) /* update number of samples */ int64_t file_size = url_ftell(pb); int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL; - url_fseek(pb, 8, SEEK_SET); + avio_seek(pb, 8, SEEK_SET); if (enc->codec_id == CODEC_ID_PCM_S32LE) { avio_wl64(pb, num_samples); } else avio_wb64(pb, num_samples); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 296b9c27d9..c898c0ec5f 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -50,7 +50,7 @@ static void put_swf_end_tag(AVFormatContext *s) pos = url_ftell(pb); tag_len = pos - swf->tag_pos - 2; tag = swf->tag; - url_fseek(pb, swf->tag_pos, SEEK_SET); + avio_seek(pb, swf->tag_pos, SEEK_SET); if (tag & TAG_LONG) { tag &= ~TAG_LONG; avio_wl16(pb, (tag << 6) | 0x3f); @@ -59,7 +59,7 @@ static void put_swf_end_tag(AVFormatContext *s) assert(tag_len < 0x3f); avio_wl16(pb, (tag << 6) | tag_len); } - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static inline void max_nbits(int *nbits_ptr, int val) @@ -494,13 +494,13 @@ static int swf_write_trailer(AVFormatContext *s) /* patch file size and number of frames if not streamed */ if (!url_is_streamed(s->pb) && video_enc) { file_size = url_ftell(pb); - url_fseek(pb, 4, SEEK_SET); + avio_seek(pb, 4, SEEK_SET); avio_wl32(pb, file_size); - url_fseek(pb, swf->duration_pos, SEEK_SET); + avio_seek(pb, swf->duration_pos, SEEK_SET); avio_wl16(pb, swf->video_frame_number); - url_fseek(pb, swf->vframes_pos, SEEK_SET); + avio_seek(pb, swf->vframes_pos, SEEK_SET); avio_wl16(pb, swf->video_frame_number); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); } return 0; } diff --git a/libavformat/thp.c b/libavformat/thp.c index 39a8bc2c35..2d1f74e38b 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -81,7 +81,7 @@ static int thp_read_header(AVFormatContext *s, thp->next_frame = thp->first_frame; /* Read the component structure. */ - url_fseek (pb, thp->compoff, SEEK_SET); + avio_seek (pb, thp->compoff, SEEK_SET); thp->compcount = avio_rb32(pb); /* Read the list of component types. */ @@ -149,7 +149,7 @@ static int thp_read_packet(AVFormatContext *s, if (thp->frame >= thp->framecnt) return AVERROR(EIO); - url_fseek(pb, thp->next_frame, SEEK_SET); + avio_seek(pb, thp->next_frame, SEEK_SET); /* Locate the next frame and read out its size. */ thp->next_frame += thp->next_framesz; diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index e368b17959..f8a5db1813 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -83,7 +83,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb) int i, sz; TiertexSeqFrameBuffer *seq_buffer; - url_fseek(pb, 256, SEEK_SET); + avio_seek(pb, 256, SEEK_SET); for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) { sz = avio_rl16(pb); @@ -113,7 +113,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num if (seq_buffer->fill_size + data_size > seq_buffer->data_size || data_size <= 0) return AVERROR_INVALIDDATA; - url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs + data_offs, SEEK_SET); if (avio_read(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size) return AVERROR(EIO); @@ -128,7 +128,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) int i, e, err; seq->current_frame_offs += SEQ_FRAME_SIZE; - url_fseek(pb, seq->current_frame_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs, SEEK_SET); /* sound data */ seq->current_audio_data_offs = avio_rl16(pb); @@ -256,7 +256,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[0] = 0; if (seq->current_pal_data_size) { pkt->data[0] |= 1; - url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET); if (avio_read(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size) return AVERROR(EIO); } @@ -279,7 +279,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) if (seq->current_audio_data_offs == 0) /* end of data reached */ return AVERROR(EIO); - url_fseek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET); rc = av_get_packet(pb, pkt, seq->current_audio_data_size); if (rc < 0) return rc; diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 3fe9e65dcc..7b0691db0f 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -173,7 +173,7 @@ static int tmv_read_seek(AVFormatContext *s, int stream_index, pos = timestamp * (tmv->audio_chunk_size + tmv->video_chunk_size + tmv->padding); - url_fseek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET); + avio_seek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET); tmv->stream_index = 0; return 0; } diff --git a/libavformat/tta.c b/libavformat/tta.c index 61a41df90b..42d551de35 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -106,7 +106,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); - url_fseek(s->pb, start_offset, SEEK_SET); + avio_seek(s->pb, start_offset, SEEK_SET); avio_read(s->pb, st->codec->extradata, st->codec->extradata_size); return 0; @@ -138,7 +138,7 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp return -1; c->currentframe = index; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); return 0; } diff --git a/libavformat/tty.c b/libavformat/tty.c index 767006b5a3..74750584c1 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -46,7 +46,7 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos) char buf[37]; int len; - url_fseek(pb, start_pos, SEEK_SET); + avio_seek(pb, start_pos, SEEK_SET); if (avio_r8(pb) != 0x1A) return -1; @@ -95,7 +95,7 @@ static int read_header(AVFormatContext *avctx, if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0) efi_read(avctx, s->fsize - 51); - url_fseek(avctx->pb, 0, SEEK_SET); + avio_seek(avctx->pb, 0, SEEK_SET); } return 0; diff --git a/libavformat/utils.c b/libavformat/utils.c index 1f0164ffac..70da4ca147 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1531,7 +1531,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts return -1; /* do the seek */ - if ((ret = url_fseek(s->pb, pos, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, pos, SEEK_SET)) < 0) return ret; av_update_cur_dts(s, st, ts); @@ -1671,7 +1671,7 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, if (pos < pos_min) pos= pos_min; else if(pos > pos_max) pos= pos_max; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); #if 0 av_update_cur_dts(s, st, ts); @@ -1701,11 +1701,11 @@ static int av_seek_frame_generic(AVFormatContext *s, if(st->nb_index_entries){ assert(st->index_entries); ie= &st->index_entries[st->nb_index_entries-1]; - if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; av_update_cur_dts(s, st, ie->timestamp); }else{ - if ((ret = url_fseek(s->pb, s->data_offset, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, s->data_offset, SEEK_SET)) < 0) return ret; } for(i=0;; i++) { @@ -1732,7 +1732,7 @@ static int av_seek_frame_generic(AVFormatContext *s, return 0; } ie = &st->index_entries[index]; - if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; av_update_cur_dts(s, st, ie->timestamp); @@ -1956,7 +1956,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset if (offset < 0) offset = 0; - url_fseek(ic->pb, offset, SEEK_SET); + avio_seek(ic->pb, offset, SEEK_SET); read_size = 0; for(;;) { if (read_size >= DURATION_MAX_READ_SIZE<<(FFMAX(retry-1,0))) @@ -1991,7 +1991,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset fill_all_stream_timings(ic); - url_fseek(ic->pb, old_offset, SEEK_SET); + avio_seek(ic->pb, old_offset, SEEK_SET); for (i=0; inb_streams; i++) { st= ic->streams[i]; st->cur_dts= st->first_dts; diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c index 65889fc55c..65ac6029ac 100644 --- a/libavformat/vc1testenc.c +++ b/libavformat/vc1testenc.c @@ -74,7 +74,7 @@ static int vc1test_write_trailer(AVFormatContext *s) AVIOContext *pb = s->pb; if (!url_is_streamed(s->pb)) { - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); avio_wl24(pb, ctx->frames); put_flush_packet(pb); } diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 8a3d170574..dfa1a156d0 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -240,7 +240,7 @@ static int vqf_read_seek(AVFormatContext *s, st->cur_dts = av_rescale(pos, st->time_base.den, st->codec->bit_rate * (int64_t)st->time_base.num); - if ((ret = url_fseek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0) return ret; c->remaining_bits = -7 - ((pos-7)&7); diff --git a/libavformat/wav.c b/libavformat/wav.c index a574b3b16f..54f9ff7d87 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -103,9 +103,9 @@ static int wav_write_trailer(AVFormatContext *s) /* update file size */ file_size = url_ftell(pb); - url_fseek(pb, 4, SEEK_SET); + avio_seek(pb, 4, SEEK_SET); avio_wl32(pb, (uint32_t)(file_size - 8)); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); @@ -115,9 +115,9 @@ static int wav_write_trailer(AVFormatContext *s) number_of_samples = av_rescale(wav->maxpts - wav->minpts + wav->last_duration, s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num, s->streams[0]->time_base.den); - url_fseek(pb, wav->data-12, SEEK_SET); + avio_seek(pb, wav->data-12, SEEK_SET); avio_wl32(pb, number_of_samples); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } } @@ -160,7 +160,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1) size = next_tag(pb, &tag); if (tag == tag1) break; - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); } return size; } @@ -243,7 +243,7 @@ static int wav_read_header(AVFormatContext *s, sample_count = avio_rl32(pb); size -= 4; } - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); } if (rf64) size = data_size; diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 478b46f913..a4dd26b442 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -101,7 +101,7 @@ static int wc3_read_header(AVFormatContext *s, wc3->vpkt.data = NULL; wc3->vpkt.size = 0; /* skip the first 3 32-bit numbers */ - url_fseek(pb, 12, SEEK_CUR); + avio_seek(pb, 12, SEEK_CUR); /* traverse through the chunks and load the header information before * the first BRCH tag */ @@ -114,12 +114,12 @@ static int wc3_read_header(AVFormatContext *s, case SOND_TAG: case INDX_TAG: /* SOND unknown, INDX unnecessary; ignore both */ - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); break; case PC__TAG: /* number of palettes, unneeded */ - url_fseek(pb, 12, SEEK_CUR); + avio_seek(pb, 12, SEEK_CUR); break; case BNAM_TAG: @@ -142,7 +142,7 @@ static int wc3_read_header(AVFormatContext *s, case PALT_TAG: /* one of several palettes */ - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); av_append_packet(pb, &wc3->vpkt, 8 + PALETTE_SIZE); break; @@ -219,13 +219,13 @@ static int wc3_read_packet(AVFormatContext *s, case SHOT_TAG: /* load up new palette */ - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); av_append_packet(pb, &wc3->vpkt, 8 + 4); break; case VGA__TAG: /* send out video chunk */ - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); ret= av_append_packet(pb, &wc3->vpkt, 8 + size); // ignore error if we have some data if (wc3->vpkt.size > 0) @@ -240,7 +240,7 @@ static int wc3_read_packet(AVFormatContext *s, case TEXT_TAG: /* subtitle chunk */ #if 0 - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); #else if ((unsigned)size > sizeof(text) || (ret = avio_read(pb, text, size)) != size) ret = AVERROR(EIO); diff --git a/libavformat/westwood.c b/libavformat/westwood.c index b923fef79c..adb35319e2 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -231,7 +231,7 @@ static int wsvqa_read_header(AVFormatContext *s, st->codec->codec_tag = 0; /* no fourcc */ /* skip to the start of the VQA header */ - url_fseek(pb, 20, SEEK_SET); + avio_seek(pb, 20, SEEK_SET); /* the VQA header needs to go to the decoder */ st->codec->extradata_size = VQA_HEADER_SIZE; @@ -303,7 +303,7 @@ static int wsvqa_read_header(AVFormatContext *s, break; } - url_fseek(pb, chunk_size, SEEK_CUR); + avio_seek(pb, chunk_size, SEEK_CUR); } while (chunk_tag != FINF_TAG); return 0; @@ -348,7 +348,7 @@ static int wsvqa_read_packet(AVFormatContext *s, } /* stay on 16-bit alignment */ if (skip_byte) - url_fseek(pb, 1, SEEK_CUR); + avio_seek(pb, 1, SEEK_CUR); return ret; } else { @@ -359,7 +359,7 @@ static int wsvqa_read_packet(AVFormatContext *s, default: av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type); } - url_fseek(pb, chunk_size + skip_byte, SEEK_CUR); + avio_seek(pb, chunk_size + skip_byte, SEEK_CUR); } } diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 0ed06aaa58..6c9993b15b 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -98,7 +98,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) int i = wf->position >> wf->sector_bits; if (i >= wf->nb_sectors || (wf->sectors[i] != wf->sectors[i - 1] + (1 << (wf->sector_bits - WTV_SECTOR_BITS)) && - url_fseek(pb, (int64_t)wf->sectors[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)) { + avio_seek(pb, (int64_t)wf->sectors[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)) { wf->error = 1; break; } @@ -123,7 +123,7 @@ static int64_t wtvfile_seek(void *opaque, int64_t offset, int whence) offset = wf->length; wf->error = offset < 0 || offset >= wf->length || - url_fseek(pb, ((int64_t)wf->sectors[offset >> wf->sector_bits] << WTV_SECTOR_BITS) + avio_seek(pb, ((int64_t)wf->sectors[offset >> wf->sector_bits] << WTV_SECTOR_BITS) + (offset & ((1 << wf->sector_bits) - 1)), SEEK_SET) < 0; wf->position = offset; return offset; @@ -159,7 +159,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int WtvFile *wf; uint8_t *buffer; - if (url_fseek(s->pb, first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0) + if (avio_seek(s->pb, first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0) return NULL; wf = av_mallocz(sizeof(WtvFile)); @@ -195,7 +195,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int } wf->nb_sectors = 0; for (i = 0; i < nb_sectors1; i++) { - if (url_fseek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0) + if (avio_seek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0) break; wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4); } @@ -222,7 +222,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int /* seek to intial sector */ wf->position = 0; - if (url_fseek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) { + if (avio_seek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) { av_free(wf->sectors); av_free(wf); return NULL; @@ -492,7 +492,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) st->codec->extradata_size = filesize; avio_read(pb, st->codec->extradata, filesize); done: - url_fseek(pb, pos + length, SEEK_SET); + avio_seek(pb, pos + length, SEEK_SET); } static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int type, int length) @@ -665,7 +665,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, url_fskip(pb, size - 32); ff_get_guid(pb, &actual_subtype); ff_get_guid(pb, &actual_formattype); - url_fseek(pb, -size, SEEK_CUR); + avio_seek(pb, -size, SEEK_CUR); st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32); url_fskip(pb, 32); @@ -963,7 +963,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) url_fskip(s->pb, 4); root_sector = avio_rl32(s->pb); - url_fseek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); + avio_seek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); root_size = avio_read(s->pb, root, root_size); if (root_size < 0) return AVERROR_INVALIDDATA; @@ -978,7 +978,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) ret = parse_chunks(s, SEEK_TO_DATA, 0, 0); if (ret < 0) return ret; - url_fseek(wtv->pb, -32, SEEK_CUR); + avio_seek(wtv->pb, -32, SEEK_CUR); timeline_pos = url_ftell(s->pb); // save before opening another file @@ -1028,7 +1028,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) } } - url_fseek(s->pb, timeline_pos, SEEK_SET); + avio_seek(s->pb, timeline_pos, SEEK_SET); return 0; } @@ -1072,9 +1072,9 @@ static int read_seek(AVFormatContext *s, int stream_index, i = ff_index_search_timestamp(wtv->index_entries, wtv->nb_index_entries, ts_relative, flags); if (i < 0) { if (wtv->last_valid_pts == AV_NOPTS_VALUE || ts < wtv->last_valid_pts) - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); else if (st->duration != AV_NOPTS_VALUE && ts_relative > st->duration && wtv->nb_index_entries) - url_fseek(pb, wtv->index_entries[wtv->nb_index_entries - 1].pos, SEEK_SET); + avio_seek(pb, wtv->index_entries[wtv->nb_index_entries - 1].pos, SEEK_SET); if (parse_chunks(s, SEEK_TO_PTS, ts, 0) < 0) return AVERROR(ERANGE); return 0; @@ -1083,7 +1083,7 @@ static int read_seek(AVFormatContext *s, int stream_index, if (wtv->epoch != AV_NOPTS_VALUE) wtv->pts += wtv->epoch; wtv->last_valid_pts = wtv->pts; - url_fseek(pb, wtv->index_entries[i].pos, SEEK_SET); + avio_seek(pb, wtv->index_entries[i].pos, SEEK_SET); return 0; } diff --git a/libavformat/wv.c b/libavformat/wv.c index fca35b818b..c2ef8d6356 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -175,7 +175,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); return -1; } - url_fseek(pb, block_end - wc->blksize + 24, SEEK_SET); + avio_seek(pb, block_end - wc->blksize + 24, SEEK_SET); } if(!wc->bpp) wc->bpp = bpp; if(!wc->chan) wc->chan = chan; @@ -228,7 +228,7 @@ static int wv_read_header(AVFormatContext *s, ff_ape_parse_tag(s); if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); - url_fseek(s->pb, cur, SEEK_SET); + avio_seek(s->pb, cur, SEEK_SET); } return 0; @@ -320,7 +320,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, /* if found, seek there */ if (index >= 0){ wc->block_parsed = 1; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); return 0; } /* if timestamp is out of bounds, return error */ @@ -331,7 +331,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, do{ ret = av_read_frame(s, pkt); if (ret < 0){ - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); return -1; } pts = pkt->pts; diff --git a/libavformat/yop.c b/libavformat/yop.c index 2e58cc660a..0c87724c53 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -104,7 +104,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR_INVALIDDATA; } - url_fseek(pb, 2048, SEEK_SET); + avio_seek(pb, 2048, SEEK_SET); av_set_pts_info(video_stream, 32, 1, frame_rate); @@ -198,7 +198,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index, frame_pos = timestamp * yop->frame_size + pos_min; yop->odd_frame = timestamp & 1; - url_fseek(s->pb, frame_pos, SEEK_SET); + avio_seek(s->pb, frame_pos, SEEK_SET); return 0; } From e356fc57a2e9887370caec58d8aafeafd1f336dc Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 28 Feb 2011 14:57:55 +0100 Subject: [PATCH 484/528] lavf: replace all uses of url_fskip with avio_seek Signed-off-by: Ronald S. Bultje --- libavformat/aea.c | 4 +-- libavformat/aiffdec.c | 6 ++-- libavformat/anm.c | 16 +++++----- libavformat/ape.c | 2 +- libavformat/asfdec.c | 30 +++++++++---------- libavformat/avidec.c | 44 +++++++++++++-------------- libavformat/avienc.c | 6 ++-- libavformat/avs.c | 4 +-- libavformat/bfi.c | 6 ++-- libavformat/bink.c | 6 ++-- libavformat/c93.c | 2 +- libavformat/cafdec.c | 16 +++++----- libavformat/dxa.c | 4 +-- libavformat/eacdata.c | 2 +- libavformat/electronicarts.c | 14 ++++----- libavformat/ffmdec.c | 2 +- libavformat/filmstripdec.c | 4 +-- libavformat/flvdec.c | 18 +++++------ libavformat/gxf.c | 28 ++++++++--------- libavformat/id3v2.c | 12 ++++---- libavformat/iff.c | 14 ++++----- libavformat/ingenientdec.c | 6 ++-- libavformat/iv8.c | 2 +- libavformat/lmlm4.c | 2 +- libavformat/lxfdec.c | 6 ++-- libavformat/matroskadec.c | 4 +-- libavformat/mov.c | 36 +++++++++++----------- libavformat/mpc8.c | 4 +-- libavformat/mpeg.c | 18 +++++------ libavformat/mpegts.c | 2 +- libavformat/msnwc_tcp.c | 12 ++++---- libavformat/mtv.c | 8 ++--- libavformat/mxfdec.c | 22 +++++++------- libavformat/ncdec.c | 2 +- libavformat/nsvdec.c | 2 +- libavformat/nutdec.c | 2 +- libavformat/nuv.c | 28 ++++++++--------- libavformat/pva.c | 2 +- libavformat/qcp.c | 14 ++++----- libavformat/r3d.c | 6 ++-- libavformat/rdt.c | 6 ++-- libavformat/riff.c | 4 +-- libavformat/rl2.c | 2 +- libavformat/rmdec.c | 22 +++++++------- libavformat/rtpdec_asf.c | 10 +++---- libavformat/rtpdec_qt.c | 4 +-- libavformat/sauce.c | 4 +-- libavformat/siff.c | 10 +++---- libavformat/soxdec.c | 6 ++-- libavformat/spdifdec.c | 2 +- libavformat/swfdec.c | 6 ++-- libavformat/tmv.c | 2 +- libavformat/tta.c | 6 ++-- libavformat/txd.c | 2 +- libavformat/vc1test.c | 2 +- libavformat/vocdec.c | 8 ++--- libavformat/vqf.c | 6 ++-- libavformat/wav.c | 6 ++-- libavformat/wtv.c | 58 ++++++++++++++++++------------------ libavformat/wv.c | 6 ++-- libavformat/xa.c | 4 +-- libavformat/yop.c | 4 +-- 62 files changed, 299 insertions(+), 299 deletions(-) diff --git a/libavformat/aea.c b/libavformat/aea.c index 8316a7e162..60b2d38fdc 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -62,9 +62,9 @@ static int aea_read_header(AVFormatContext *s, return AVERROR(ENOMEM); /* Parse the amount of channels and skip to pos 2048(0x800) */ - url_fskip(s->pb, 264); + avio_seek(s->pb, 264, SEEK_CUR); st->codec->channels = avio_r8(s->pb); - url_fskip(s->pb, 1783); + avio_seek(s->pb, 1783, SEEK_CUR); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index b8e4ea28ed..849793a14b 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -70,7 +70,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) int res; if (!str) { - url_fskip(s->pb, size); + avio_seek(s->pb, size, SEEK_CUR); return; } @@ -242,7 +242,7 @@ static int aiff_read_header(AVFormatContext *s, av_log(s, AV_LOG_ERROR, "file is not seekable\n"); return -1; } - url_fskip(pb, size - 8); + avio_seek(pb, size - 8, SEEK_CUR); break; case MKTAG('w', 'a', 'v', 'e'): if ((uint64_t)size > (1<<30)) @@ -256,7 +256,7 @@ static int aiff_read_header(AVFormatContext *s, default: /* Jump */ if (size & 1) /* Always even aligned */ size++; - url_fskip (pb, size); + avio_seek(pb, size, SEEK_CUR); } } diff --git a/libavformat/anm.c b/libavformat/anm.c index 463beee345..060cc9a086 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s, AVStream *st; int i, ret; - url_fskip(pb, 4); /* magic number */ + avio_seek(pb, 4, SEEK_CUR); /* magic number */ if (avio_rl16(pb) != MAX_PAGES) { av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n"); return AVERROR_INVALIDDATA; @@ -91,7 +91,7 @@ static int read_header(AVFormatContext *s, anm->nb_pages = avio_rl16(pb); anm->nb_records = avio_rl32(pb); - url_fskip(pb, 2); /* max records per page */ + avio_seek(pb, 2, SEEK_CUR); /* max records per page */ anm->page_table_offset = avio_rl16(pb); if (avio_rl32(pb) != ANIM_TAG) return AVERROR_INVALIDDATA; @@ -107,13 +107,13 @@ static int read_header(AVFormatContext *s, st->codec->height = avio_rl16(pb); if (avio_r8(pb) != 0) goto invalid; - url_fskip(pb, 1); /* frame rate multiplier info */ + avio_seek(pb, 1, SEEK_CUR); /* frame rate multiplier info */ /* ignore last delta record (used for looping) */ if (avio_r8(pb)) /* has_last_delta */ anm->nb_records = FFMAX(anm->nb_records - 1, 0); - url_fskip(pb, 1); /* last_delta_valid */ + avio_seek(pb, 1, SEEK_CUR); /* last_delta_valid */ if (avio_r8(pb) != 0) goto invalid; @@ -121,15 +121,15 @@ static int read_header(AVFormatContext *s, if (avio_r8(pb) != 1) goto invalid; - url_fskip(pb, 1); /* other recs per frame */ + avio_seek(pb, 1, SEEK_CUR); /* other recs per frame */ if (avio_r8(pb) != 1) goto invalid; - url_fskip(pb, 32); /* record_types */ + avio_seek(pb, 32, SEEK_CUR); /* record_types */ st->nb_frames = avio_rl32(pb); av_set_pts_info(st, 64, 1, avio_rl16(pb)); - url_fskip(pb, 58); + avio_seek(pb, 58, SEEK_CUR); /* color cycling and palette data */ st->codec->extradata_size = 16*8 + 4*256; @@ -193,7 +193,7 @@ repeat: /* parse page header */ if (anm->record < 0) { avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET); - url_fskip(pb, 8 + 2*p->nb_records); + avio_seek(pb, 8 + 2*p->nb_records, SEEK_CUR); anm->record = 0; } diff --git a/libavformat/ape.c b/libavformat/ape.c index 657a3d9c49..2de47ef483 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -239,7 +239,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* Skip any stored wav header */ if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) - url_fskip(pb, ape->wavheaderlength); + avio_seek(pb, ape->wavheaderlength, SEEK_CUR); } if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){ diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 4f6f6f2c0d..85761a3fd4 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -350,7 +350,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) avio_rl16(pb); /* panes */ st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ tag1 = avio_rl32(pb); - url_fskip(pb, 20); + avio_seek(pb, 20, SEEK_CUR); // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); if (sizeX > 40) { st->codec->extradata_size = sizeX - 40; @@ -388,7 +388,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; } pos2 = url_ftell(pb); - url_fskip(pb, size - (pos2 - pos1 + 24)); + avio_seek(pb, size - (pos2 - pos1 + 24), SEEK_CUR); return 0; } @@ -455,7 +455,7 @@ static int asf_read_content_desc(AVFormatContext *s, int64_t size) get_tag(s, "author" , 0, len2); get_tag(s, "copyright", 0, len3); get_tag(s, "comment" , 0, len4); - url_fskip(pb, len5); + avio_seek(pb, len5, SEEK_CUR); return 0; } @@ -475,7 +475,7 @@ static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) if (name_len%2) // must be even, broken lavf versions wrote len-1 name_len += 1; if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) - url_fskip(pb, name_len - ret); + avio_seek(pb, name_len - ret, SEEK_CUR); value_type = avio_rl16(pb); value_len = avio_rl16(pb); if (!value_type && value_len%2) @@ -505,7 +505,7 @@ static int asf_read_language_list(AVFormatContext *s, int64_t size) char lang[6]; unsigned int lang_len = avio_r8(pb); if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len) - url_fskip(pb, lang_len - ret); + avio_seek(pb, lang_len - ret, SEEK_CUR); if (j < 128) av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages)); } @@ -531,10 +531,10 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size) value_len= avio_rl32(pb); if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) - url_fskip(pb, name_len - ret); + avio_seek(pb, name_len - ret, SEEK_CUR); //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name); value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere - url_fskip(pb, value_len - 2); + avio_seek(pb, value_len - 2, SEEK_CUR); if(stream_num<128){ if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num; @@ -571,7 +571,7 @@ static int asf_read_marker(AVFormatContext *s, int64_t size) avio_rl32(pb); // flags name_len = avio_rl32(pb); // name length if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len) - url_fskip(pb, name_len - ret); + avio_seek(pb, name_len - ret, SEEK_CUR); ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name ); } @@ -826,16 +826,16 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ // for(i=0; ipacket_replic_size-8; i++) // av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb)); // av_log(s, AV_LOG_DEBUG, "\n"); - url_fskip(pb, 10); + avio_seek(pb, 10, SEEK_CUR); ts0= avio_rl64(pb); ts1= avio_rl64(pb); - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); avio_rl32(pb); - url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4); + avio_seek(pb, asf->packet_replic_size - 8 - 38 - 4, SEEK_CUR); if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; else asf->packet_frag_timestamp= AV_NOPTS_VALUE; }else - url_fskip(pb, asf->packet_replic_size - 8); + avio_seek(pb, asf->packet_replic_size - 8, SEEK_CUR); rsize += asf->packet_replic_size; // FIXME - check validity } else if (asf->packet_replic_size==1){ // multipacket - frag_offset is beginning timestamp @@ -895,7 +895,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb)); assert(ret>=0); /* fail safe */ - url_fskip(pb, ret); + avio_seek(pb, ret, SEEK_CUR); asf->packet_pos= url_ftell(pb); if (asf->data_object_size != (uint64_t)-1 && @@ -914,7 +914,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk ) { asf->packet_time_start = 0; /* unhandled packet (should not happen) */ - url_fskip(pb, asf->packet_frag_size); + avio_seek(pb, asf->packet_frag_size, SEEK_CUR); asf->packet_size_left -= asf->packet_frag_size; if(asf->stream_index < 0) av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size); @@ -934,7 +934,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk if (asf->packet_multi_size < asf->packet_obj_size) { asf->packet_time_start = 0; - url_fskip(pb, asf->packet_multi_size); + avio_seek(pb, asf->packet_multi_size, SEEK_CUR); asf->packet_size_left -= asf->packet_multi_size; continue; } diff --git a/libavformat/avidec.c b/libavformat/avidec.c index a0f86adea5..e8bcebc7e5 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -321,12 +321,12 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end) } if (name) av_metadata_set2(&s->metadata, name, buffer, 0); - url_fskip(s->pb, size); + avio_seek(s->pb, size, SEEK_CUR); } break; } default: - url_fskip(s->pb, size); + avio_seek(s->pb, size, SEEK_CUR); break; } } @@ -392,13 +392,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) unsigned char date[64] = {0}; size += (size & 1); size -= avio_read(pb, date, FFMIN(size, sizeof(date)-1)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); avi_metadata_creation_time(&s->metadata, date); break; } case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; - url_fskip(pb, size + (size & 1)); + avio_seek(pb, size + (size & 1), SEEK_CUR); break; case MKTAG('a', 'm', 'v', 'h'): amv_file_format=1; @@ -410,13 +410,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rl32(pb); avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; - url_fskip(pb, 2 * 4); + avio_seek(pb, 2 * 4, SEEK_CUR); avio_rl32(pb); avio_rl32(pb); avih_width=avio_rl32(pb); avih_height=avio_rl32(pb); - url_fskip(pb, size - 10 * 4); + avio_seek(pb, size - 10 * 4, SEEK_CUR); break; case MKTAG('s', 't', 'r', 'h'): /* stream header */ @@ -425,7 +425,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) handler = avio_rl32(pb); /* codec tag */ if(tag1 == MKTAG('p', 'a', 'd', 's')){ - url_fskip(pb, size - 8); + avio_seek(pb, size - 8, SEEK_CUR); break; }else{ stream_index++; @@ -469,10 +469,10 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) goto fail; } s->streams[0]->priv_data = ast; - url_fskip(pb, 3 * 4); + avio_seek(pb, 3 * 4, SEEK_CUR); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); - url_fskip(pb, 4); /* start time */ + avio_seek(pb, 4, SEEK_CUR); /* start time */ dv_dur = avio_rl32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { @@ -485,7 +485,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) */ stream_index = s->nb_streams - 1; - url_fskip(pb, size - 9*4); + avio_seek(pb, size - 9*4, SEEK_CUR); break; } @@ -542,12 +542,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if(ast->sample_size == 0) st->duration = st->nb_frames; ast->frame_offset= ast->cum_len; - url_fskip(pb, size - 12 * 4); + avio_seek(pb, size - 12 * 4, SEEK_CUR); break; case MKTAG('s', 't', 'r', 'f'): /* stream header */ if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } else { uint64_t cur_pos = url_ftell(pb); if (cur_pos < list_end) @@ -560,7 +560,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height=avih_height; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_AMV; - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } tag1 = ff_get_bmp_header(pb, st); @@ -620,7 +620,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } st->codec->height= FFABS(st->codec->height); -// url_fskip(pb, size - 5 * 4); +// avio_seek(pb, size - 5 * 4, SEEK_CUR); break; case AVMEDIA_TYPE_AUDIO: ff_get_wav_header(pb, st->codec, size); @@ -630,7 +630,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ast->sample_size= st->codec->block_align; } if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */ - url_fskip(pb, 1); + avio_seek(pb, 1, SEEK_CUR); /* Force parsing as several audio frames can be in * one packet and timestamps refer to packet start. */ st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; @@ -658,7 +658,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id= CODEC_ID_NONE; st->codec->codec_tag= 0; - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } } @@ -710,7 +710,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } /* skip tag */ size += (size & 1); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } } @@ -762,7 +762,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { goto error; ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc)); - url_fskip(pb, desc_len - ret); + avio_seek(pb, desc_len - ret, SEEK_CUR); if (*desc) av_metadata_set2(&st->metadata, "title", desc, 0); @@ -1008,14 +1008,14 @@ resync: //parse JUNK ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); //av_log(s, AV_LOG_DEBUG, "SKIP\n"); goto resync; } //parse stray LIST if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){ - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); goto resync; } @@ -1026,7 +1026,7 @@ resync: //detect ##ix chunk and skip if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){ - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); goto resync; } @@ -1060,7 +1060,7 @@ resync: /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering || st->discard >= AVDISCARD_ALL){ ast->frame_offset += get_duration(ast, size); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); goto resync; } diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 49585b685b..5aab1925be 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -444,9 +444,9 @@ static int avi_write_ix(AVFormatContext *s) /* Updating one entry in the AVI OpenDML master index */ avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET); ffio_wfourcc(pb, "indx"); /* enabling this entry */ - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); avio_wl32(pb, avi->riff_id); /* nEntriesInUse */ - url_fskip(pb, 16*avi->riff_id); + avio_seek(pb, 16*avi->riff_id, SEEK_CUR); avio_wl64(pb, ix); /* qwOffset */ avio_wl32(pb, pos - ix); /* dwSize */ avio_wl32(pb, avist->indexes.entry); /* dwDuration */ @@ -603,7 +603,7 @@ static int avi_write_trailer(AVFormatContext *s) file_size = url_ftell(pb); avio_seek(pb, avi->odml_list - 8, SEEK_SET); ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */ - url_fskip(pb, 16); + avio_seek(pb, 16, SEEK_CUR); for (n=nb_frames=0;nnb_streams;n++) { AVCodecContext *stream = s->streams[n]->codec; diff --git a/libavformat/avs.c b/libavformat/avs.c index 0ba5cebfdf..476c0a9af9 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -61,7 +61,7 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap) s->ctx_flags |= AVFMTCTX_NOHEADER; - url_fskip(s->pb, 4); + avio_seek(s->pb, 4, SEEK_CUR); avs->width = avio_rl16(s->pb); avs->height = avio_rl16(s->pb); avs->bits_per_sample = avio_rl16(s->pb); @@ -204,7 +204,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) break; default: - url_fskip(s->pb, size - 4); + avio_seek(s->pb, size - 4, SEEK_CUR); } } } diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 4d0bd097a9..21676e440a 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -65,19 +65,19 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) return AVERROR(ENOMEM); /* Set the total number of frames. */ - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); chunk_header = avio_rl32(pb); bfi->nframes = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); fps = avio_rl32(pb); - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); vstream->codec->width = avio_rl32(pb); vstream->codec->height = avio_rl32(pb); /*Load the palette to extradata */ - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); vstream->codec->extradata = av_malloc(768); vstream->codec->extradata_size = 768; avio_read(pb, vstream->codec->extradata, diff --git a/libavformat/bink.c b/libavformat/bink.c index f76d7b987a..22beb4cbbd 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -98,7 +98,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(EIO); } - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); vst->codec->width = avio_rl32(pb); vst->codec->height = avio_rl32(pb); @@ -127,7 +127,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) } if (bink->num_audio_tracks) { - url_fskip(pb, 4 * bink->num_audio_tracks); + avio_seek(pb, 4 * bink->num_audio_tracks, SEEK_CUR); for (i = 0; i < bink->num_audio_tracks; i++) { ast = av_new_stream(s, 1); @@ -169,7 +169,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) keyframe ? AVINDEX_KEYFRAME : 0); } - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); bink->current_track = -1; return 0; diff --git a/libavformat/c93.c b/libavformat/c93.c index 84cf65c73e..a4a0fe3ad0 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -122,7 +122,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(ENOMEM); c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; } - url_fskip(pb, 26); /* VOC header */ + avio_seek(pb, 26, SEEK_CUR); /* VOC header */ ret = voc_get_packet(s, pkt, c93->audio, datasize - 26); if (ret > 0) { pkt->stream_index = 1; diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 8532946c5c..d98c4bf095 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -114,22 +114,22 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n"); return AVERROR_INVALIDDATA; } - url_fskip(pb, skip); + avio_seek(pb, skip, SEEK_CUR); } 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); + avio_seek(pb, size, SEEK_CUR); return AVERROR_INVALIDDATA; } - url_fskip(pb, ALAC_PREAMBLE); + avio_seek(pb, ALAC_PREAMBLE, SEEK_CUR); st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); avio_read(pb, st->codec->extradata, ALAC_HEADER); st->codec->extradata_size = ALAC_HEADER; - url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER); + avio_seek(pb, size - ALAC_PREAMBLE - ALAC_HEADER, SEEK_CUR); } else { st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) @@ -201,7 +201,7 @@ static int read_header(AVFormatContext *s, int found_data, ret; int64_t size; - url_fskip(pb, 8); /* magic, version, file flags */ + avio_seek(pb, 8, SEEK_CUR); /* magic, version, file flags */ /* audio description chunk */ if (avio_rb32(pb) != MKBETAG('d','e','s','c')) { @@ -233,11 +233,11 @@ static int read_header(AVFormatContext *s, switch (tag) { case MKBETAG('d','a','t','a'): - url_fskip(pb, 4); /* edit count */ + avio_seek(pb, 4, SEEK_CUR); /* edit count */ caf->data_start = url_ftell(pb); caf->data_size = size < 0 ? -1 : size - 4; if (caf->data_size > 0 && !url_is_streamed(pb)) - url_fskip(pb, caf->data_size); + avio_seek(pb, caf->data_size, SEEK_CUR); found_data = 1; break; @@ -265,7 +265,7 @@ static int read_header(AVFormatContext *s, case MKBETAG('f','r','e','e'): if (size < 0) return AVERROR_INVALIDDATA; - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } } diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 60ae92a048..695ca959e1 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -96,7 +96,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) c->has_sound = 1; size = avio_rb32(pb); c->vidpos = url_ftell(pb) + size; - url_fskip(pb, 16); + avio_seek(pb, 16, SEEK_CUR); fsize = avio_rl32(pb); ast = av_new_stream(s, 0); @@ -108,7 +108,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) tag = avio_rl32(pb); fsize = avio_rl32(pb); if(tag == MKTAG('d', 'a', 't', 'a')) break; - url_fskip(pb, fsize); + avio_seek(pb, fsize, SEEK_CUR); } c->bpc = (fsize + c->frames - 1) / c->frames; if(ast->codec->block_align) diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c index 6f3564e397..8fc8c4221e 100644 --- a/libavformat/eacdata.c +++ b/libavformat/eacdata.c @@ -62,7 +62,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) }; sample_rate = avio_rb16(pb); - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); st = av_new_stream(s, 0); if (!st) diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 9f79897b85..cd3c33801a 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -222,7 +222,7 @@ static int process_audio_header_eacs(AVFormatContext *s) ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */ ea->num_channels = avio_r8(pb); compression_type = avio_r8(pb); - url_fskip(pb, 13); + avio_seek(pb, 13, SEEK_CUR); switch (compression_type) { case 0: @@ -261,7 +261,7 @@ static int process_video_header_mdec(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; AVIOContext *pb = s->pb; - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); ea->width = avio_rl16(pb); ea->height = avio_rl16(pb); ea->time_base = (AVRational){1,15}; @@ -274,7 +274,7 @@ static int process_video_header_vp6(AVFormatContext *s) EaDemuxContext *ea = s->priv_data; AVIOContext *pb = s->pb; - url_fskip(pb, 16); + avio_seek(pb, 16, SEEK_CUR); ea->time_base.den = avio_rl32(pb); ea->time_base.num = avio_rl32(pb); ea->video_codec = CODEC_ID_VP6; @@ -316,7 +316,7 @@ static int process_ea_header(AVFormatContext *s) { case SHEN_TAG : blockid = avio_rl32(pb); if (blockid == GSTR_TAG) { - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); } else if ((blockid & 0xFFFF)!=PT00_TAG) { av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n"); return 0; @@ -474,19 +474,19 @@ static int ea_read_packet(AVFormatContext *s, /* audio data */ case ISNh_TAG: /* header chunk also contains data; skip over the header portion*/ - url_fskip(pb, 32); + avio_seek(pb, 32, SEEK_CUR); chunk_size -= 32; case ISNd_TAG: case SCDl_TAG: case SNDC_TAG: case SDEN_TAG: if (!ea->audio_codec) { - url_fskip(pb, chunk_size); + avio_seek(pb, chunk_size, SEEK_CUR); break; } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || ea->audio_codec == CODEC_ID_MP3) { num_samples = avio_rl32(pb); - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); chunk_size -= 12; } ret = av_get_packet(pb, pkt, chunk_size); diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 764d55c60a..bcfc1658e2 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -187,7 +187,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) int64_t dts; ffm_seek1(s, pos); - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); dts = avio_rb64(pb); #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0); diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 8a0770e688..a987b93baf 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -59,7 +59,7 @@ static int read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; } - url_fskip(pb, 2); + avio_seek(pb, 2, SEEK_CUR); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_RAWVIDEO; st->codec->pix_fmt = PIX_FMT_RGBA; @@ -84,7 +84,7 @@ static int read_packet(AVFormatContext *s, return AVERROR(EIO); pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); - url_fskip(s->pb, st->codec->width * film->leading * 4); + avio_seek(s->pb, st->codec->width * film->leading * 4, SEEK_CUR); if (pkt->size < 0) return pkt->size; pkt->flags |= AV_PKT_FLAG_KEY; diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 05f1ab558a..3b30c7f200 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -113,7 +113,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) { int length = avio_rb16(ioc); if(length >= buffsize) { - url_fskip(ioc, length); + avio_seek(ioc, length, SEEK_CUR); return -1; } @@ -149,7 +149,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst unsigned int keylen; while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) { - url_fskip(ioc, keylen); //skip key string + avio_seek(ioc, keylen, SEEK_CUR); //skip key string if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; //if we couldn't skip, bomb out. } @@ -162,7 +162,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst case AMF_DATA_TYPE_UNSUPPORTED: break; //these take up no additional space case AMF_DATA_TYPE_MIXEDARRAY: - url_fskip(ioc, 4); //skip 32-bit max array index + avio_seek(ioc, 4, SEEK_CUR); //skip 32-bit max array index while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) { //this is the only case in which we would want a nested parse to not skip over the object if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) @@ -182,7 +182,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst } break; case AMF_DATA_TYPE_DATE: - url_fskip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16) + avio_seek(ioc, 8 + 2, SEEK_CUR); //timestamp (double) and UTC offset (int16) break; default: //unsupported type, we couldn't skip return -1; @@ -254,7 +254,7 @@ static int flv_read_header(AVFormatContext *s, { int offset, flags; - url_fskip(s->pb, 4); + avio_seek(s->pb, 4, SEEK_CUR); flags = avio_r8(s->pb); /* old flvtool cleared this field */ /* FIXME: better fix needed */ @@ -278,7 +278,7 @@ static int flv_read_header(AVFormatContext *s, offset = avio_rb32(s->pb); avio_seek(s->pb, offset, SEEK_SET); - url_fskip(s->pb, 4); + avio_seek(s->pb, 4, SEEK_CUR); s->start_time = 0; @@ -304,7 +304,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t dts, pts = AV_NOPTS_VALUE; AVStream *st = NULL; - for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ + for(;;avio_seek(s->pb, 4, SEEK_CUR)){ /* pkt size is repeated at end. skip it */ pos = url_ftell(s->pb); type = avio_r8(s->pb); size = avio_rb24(s->pb); @@ -313,7 +313,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts); if (url_feof(s->pb)) return AVERROR_EOF; - url_fskip(s->pb, 3); /* stream id, always 0 */ + avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */ flags = 0; if(size == 0) @@ -454,7 +454,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags |= AV_PKT_FLAG_KEY; leave: - url_fskip(s->pb, 4); + avio_seek(s->pb, 4, SEEK_CUR); return ret; } diff --git a/libavformat/gxf.c b/libavformat/gxf.c index b290035c90..e2625f9d41 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -174,7 +174,7 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info else if (tag == MAT_LAST_FIELD) si->last_field = value; } else - url_fskip(pb, tlen); + avio_seek(pb, tlen, SEEK_CUR); } } @@ -223,7 +223,7 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si else if (tag == TRACK_FPF && (value == 1 || value == 2)) si->fields_per_frame = value; } else - url_fskip(pb, tlen); + avio_seek(pb, tlen, SEEK_CUR); } } @@ -238,7 +238,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { int i; pkt_len -= 8; if (s->flags & AVFMT_FLAG_IGNIDX) { - url_fskip(pb, pkt_len); + avio_seek(pb, pkt_len, SEEK_CUR); return; } if (map_cnt > 1000) { @@ -247,7 +247,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { } if (pkt_len < 4 * map_cnt) { av_log(s, AV_LOG_ERROR, "invalid index length\n"); - url_fskip(pb, pkt_len); + avio_seek(pb, pkt_len, SEEK_CUR); return; } pkt_len -= 4 * map_cnt; @@ -255,7 +255,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { for (i = 0; i < map_cnt; i++) av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024, i * (uint64_t)fields_per_map + 1, 0, 0, 0); - url_fskip(pb, pkt_len); + avio_seek(pb, pkt_len, SEEK_CUR); } static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { @@ -283,7 +283,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { } map_len -= len; gxf_material_tags(pb, &len, &si); - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); map_len -= 2; len = avio_rb16(pb); // length of track description if (len > map_len) { @@ -301,7 +301,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { track_len = avio_rb16(pb); len -= track_len; gxf_track_tags(pb, &track_len, &si); - url_fskip(pb, track_len); + avio_seek(pb, track_len, SEEK_CUR); if (!(track_type & 0x80)) { av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type); continue; @@ -326,7 +326,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { if (len < 0) av_log(s, AV_LOG_ERROR, "invalid track description length specified\n"); if (map_len) - url_fskip(pb, map_len); + avio_seek(pb, map_len, SEEK_CUR); if (!parse_packet_header(pb, &pkt_type, &len)) { av_log(s, AV_LOG_ERROR, "sync lost in header\n"); return -1; @@ -342,8 +342,8 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { if (len >= 0x39) { AVRational fps; len -= 0x39; - url_fskip(pb, 5); // preamble - url_fskip(pb, 0x30); // payload description + avio_seek(pb, 5, SEEK_CUR); // preamble + avio_seek(pb, 0x30, SEEK_CUR); // payload description fps = fps_umf2avr(avio_rl32(pb)); if (!main_timebase.num || !main_timebase.den) { // this may not always be correct, but simply the best we can get @@ -354,7 +354,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { av_log(s, AV_LOG_INFO, "UMF packet too short\n"); } else av_log(s, AV_LOG_INFO, "UMF packet missing\n"); - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); // set a fallback value, 60000/1001 is specified for audio-only files // so use that regardless of why we do not know the video frame rate. if (!main_timebase.num || !main_timebase.den) @@ -437,7 +437,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { continue; } if (pkt_type != PKT_MEDIA) { - url_fskip(pb, pkt_len); + avio_seek(pb, pkt_len, SEEK_CUR); continue; } if (pkt_len < 16) { @@ -462,7 +462,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { int last = field_info & 0xffff; // last is exclusive int bps = av_get_bits_per_sample(st->codec->codec_id)>>3; if (first <= last && last*bps <= pkt_len) { - url_fskip(pb, first*bps); + avio_seek(pb, first*bps, SEEK_CUR); skip = pkt_len - last*bps; pkt_len = (last-first)*bps; } else @@ -470,7 +470,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { } ret = av_get_packet(pb, pkt, pkt_len); if (skip) - url_fskip(pb, skip); + avio_seek(pb, skip, SEEK_CUR); pkt->stream_index = stream_index; pkt->dts = field_nr; return ret; diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 43a41c2d55..47bc706dfb 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -171,7 +171,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t unsync = flags & 0x80; if (isv34 && flags & 0x40) /* Extended header present, just skip over it */ - url_fskip(s->pb, get_size(s->pb, 4)); + avio_seek(s->pb, get_size(s->pb, 4), SEEK_CUR); while (len >= taghdrlen) { unsigned int tflags; @@ -205,7 +205,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); - url_fskip(s->pb, tlen); + avio_seek(s->pb, tlen, SEEK_CUR); } else if (tag[0] == 'T') { if (unsync || tunsync) { int i, j; @@ -226,7 +226,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); - url_fskip(s->pb, tlen); + avio_seek(s->pb, tlen, SEEK_CUR); break; } /* Skip to end of tag */ @@ -235,17 +235,17 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t if (len > 0) { /* Skip padding */ - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); } if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */ - url_fskip(s->pb, 10); + avio_seek(s->pb, 10, SEEK_CUR); 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); + avio_seek(s->pb, len, SEEK_CUR); av_free(buffer); } diff --git a/libavformat/iff.c b/libavformat/iff.c index a5332ab945..6622445690 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -134,7 +134,7 @@ static int iff_read_header(AVFormatContext *s, return AVERROR(ENOMEM); st->codec->channels = 1; - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content st->codec->codec_tag = avio_rl32(pb); @@ -152,10 +152,10 @@ static int iff_read_header(AVFormatContext *s, if (data_size < 14) return AVERROR_INVALIDDATA; - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); st->codec->sample_rate = avio_rb16(pb); if (data_size >= 16) { - url_fskip(pb, 1); + avio_seek(pb, 1, SEEK_CUR); compression = avio_r8(pb); } break; @@ -186,14 +186,14 @@ static int iff_read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; st->codec->width = avio_rb16(pb); st->codec->height = avio_rb16(pb); - url_fskip(pb, 4); // x, y offset + avio_seek(pb, 4, SEEK_CUR); // x, y offset st->codec->bits_per_coded_sample = avio_r8(pb); if (data_size >= 11) { - url_fskip(pb, 1); // masking + avio_seek(pb, 1, SEEK_CUR); // masking compression = avio_r8(pb); } if (data_size >= 16) { - url_fskip(pb, 3); // paddding, transparent + avio_seek(pb, 3, SEEK_CUR); // paddding, transparent st->sample_aspect_ratio.num = avio_r8(pb); st->sample_aspect_ratio.den = avio_r8(pb); } @@ -223,7 +223,7 @@ static int iff_read_header(AVFormatContext *s, return res; } } - url_fskip(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1)); + avio_seek(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1), SEEK_CUR); } avio_seek(pb, iff->body_pos, SEEK_SET); diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c index dbb3f3bfd2..9f7065ce5d 100644 --- a/libavformat/ingenientdec.c +++ b/libavformat/ingenientdec.c @@ -35,11 +35,11 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) w = avio_rl16(s->pb); h = avio_rl16(s->pb); - url_fskip(s->pb, 8); // zero + size (padded?) - url_fskip(s->pb, 2); + avio_seek(s->pb, 8, SEEK_CUR); // zero + size (padded?) + avio_seek(s->pb, 2, SEEK_CUR); unk1 = avio_rl16(s->pb); unk2 = avio_rl16(s->pb); - url_fskip(s->pb, 22); // ASCII timestamp + avio_seek(s->pb, 22, SEEK_CUR); // 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); diff --git a/libavformat/iv8.c b/libavformat/iv8.c index d463350c5f..4671a18eac 100644 --- a/libavformat/iv8.c +++ b/libavformat/iv8.c @@ -70,7 +70,7 @@ retry: return -1; if(type==258){ - url_fskip(s->pb, size); + avio_seek(s->pb, size, SEEK_CUR); goto retry; } diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index 2991b30710..97ece0153c 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -100,7 +100,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) return AVERROR(EIO); - url_fskip(pb, padding); + avio_seek(pb, padding, SEEK_CUR); switch (frame_type) { case LMLM4_I_FRAME: diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 8692e628e5..4e98c895cf 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -137,8 +137,8 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form 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])); + avio_seek(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) + + (int64_t)(uint32_t)AV_RL32(&header[52]), SEEK_CUR); break; case 1: //audio @@ -255,7 +255,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (format == 1) { //skip extended field data - url_fskip(s->pb, (uint32_t)AV_RL32(&header[40])); + avio_seek(s->pb, (uint32_t)AV_RL32(&header[40]), SEEK_CUR); } return 0; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 72abfc1d56..7480475cd5 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1393,10 +1393,10 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) int flavor; ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size, 0, NULL, NULL, NULL, NULL); - url_fskip(&b, 22); + avio_seek(&b, 22, SEEK_CUR); flavor = avio_rb16(&b); track->audio.coded_framesize = avio_rb32(&b); - url_fskip(&b, 12); + avio_seek(&b, 12, SEEK_CUR); track->audio.sub_packet_h = avio_rb16(&b); track->audio.frame_size = avio_rb16(&b); track->audio.sub_packet_size = avio_rb16(&b); diff --git a/libavformat/mov.c b/libavformat/mov.c index f8360c6e61..537b9c6fb4 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -296,7 +296,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) parse = mov_read_udta_string; if (!parse) { /* skip leaf atoms data */ - url_fskip(pb, a.size); + avio_seek(pb, a.size, SEEK_CUR); } else { int64_t start_pos = url_ftell(pb); int64_t left; @@ -308,14 +308,14 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; left = a.size - url_ftell(pb) + start_pos; if (left > 0) /* skip garbage at atom end */ - url_fskip(pb, left); + avio_seek(pb, left, SEEK_CUR); } total_size += a.size; } if (total_size < atom.size && atom.size < 0x7ffff) - url_fskip(pb, atom.size - total_size); + avio_seek(pb, atom.size - total_size, SEEK_CUR); return 0; } @@ -357,7 +357,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) uint16_t volume_len, len; int16_t type; - url_fskip(pb, 10); + avio_seek(pb, 10, SEEK_CUR); volume_len = avio_r8(pb); volume_len = FFMIN(volume_len, 27); @@ -365,7 +365,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); len = avio_r8(pb); len = FFMIN(len, 63); @@ -373,7 +373,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->filename[len] = 0; av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); - url_fskip(pb, 16); + avio_seek(pb, 16, SEEK_CUR); /* read next level up_from_alias/down_to_target */ dref->nlvl_from = avio_rb16(pb); @@ -381,7 +381,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", dref->nlvl_from, dref->nlvl_to); - url_fskip(pb, 16); + avio_seek(pb, 16, SEEK_CUR); for (type = 0; type != -1 && url_ftell(pb) < next; ) { type = avio_rb16(pb); @@ -416,7 +416,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->dir[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir); } else - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); } } avio_seek(pb, next, SEEK_SET); @@ -663,9 +663,9 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb16(pb); /* preferred volume */ - url_fskip(pb, 10); /* reserved */ + avio_seek(pb, 10, SEEK_CUR); /* reserved */ - url_fskip(pb, 36); /* display matrix */ + avio_seek(pb, 36, SEEK_CUR); /* display matrix */ avio_rb32(pb); /* preview time */ avio_rb32(pb); /* preview duration */ @@ -782,7 +782,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (mov_read_default(c, pb, atom) < 0) return -1; } else - url_fskip(pb, atom.size); + avio_seek(pb, atom.size, SEEK_CUR); return 0; } @@ -833,7 +833,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size - 40; - url_fskip(pb, 40); + avio_seek(pb, 40, SEEK_CUR); avio_read(pb, st->codec->extradata, atom.size - 40); return 0; } @@ -945,7 +945,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) * in the MOV demuxer, patch welcome. */ multiple_stsd: av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); - url_fskip(pb, size - (url_ftell(pb) - start_pos)); + avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR); continue; } /* we cannot demux concatenated h264 streams because of different extradata */ @@ -1003,7 +1003,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) len = 31; mov_read_mac_string(c, pb, len, st->codec->codec_name, 32); if (len < 31) - url_fskip(pb, 31 - len); + avio_seek(pb, 31 - len, SEEK_CUR); /* codec_tag YV12 triggers an UV swap in rawdec.c */ if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) st->codec->codec_tag=MKTAG('I', '4', '2', '0'); @@ -1174,7 +1174,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) st->codec->height = sc->height; } else { /* other codec type, just skip (rtp, mp4s, tmcd ...) */ - url_fskip(pb, size - (url_ftell(pb) - start_pos)); + avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR); } /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ a.size = size - (url_ftell(pb) - start_pos); @@ -1182,7 +1182,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) if (mov_read_default(c, pb, a) < 0) return -1; } else if (a.size > 0) - url_fskip(pb, a.size); + avio_seek(pb, a.size, SEEK_CUR); } if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) @@ -2078,13 +2078,13 @@ static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (atom.size < 8) return 0; /* continue */ if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */ - url_fskip(pb, atom.size - 4); + avio_seek(pb, atom.size - 4, SEEK_CUR); return 0; } atom.type = avio_rl32(pb); atom.size -= 8; if (atom.type != MKTAG('m','d','a','t')) { - url_fskip(pb, atom.size); + avio_seek(pb, atom.size, SEEK_CUR); return 0; } err = mov_read_mdat(c, pb, atom); diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 893fb6b191..9d8a4d80a2 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -182,7 +182,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in avio_seek(pb, pos, SEEK_SET); break; default: - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } } @@ -212,7 +212,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } pos = url_ftell(pb); - url_fskip(pb, 4); //CRC + avio_seek(pb, 4, SEEK_CUR); //CRC c->ver = avio_r8(pb); if(c->ver != 8){ av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver); diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 6c7481e79c..a1ba6aa203 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -212,7 +212,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) ps_info_length = avio_rb16(pb); /* skip program_stream_info */ - url_fskip(pb, ps_info_length); + avio_seek(pb, ps_info_length, SEEK_CUR); es_map_length = avio_rb16(pb); /* at least one es available? */ @@ -223,7 +223,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) /* remember mapping from stream id to stream type */ m->psm_es_type[es_id] = type; /* skip program_stream_info */ - url_fskip(pb, es_info_length); + avio_seek(pb, es_info_length, SEEK_CUR); es_map_length -= 4 + es_info_length; } avio_rb32(pb); /* crc32 */ @@ -264,7 +264,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, if (startcode == SYSTEM_HEADER_START_CODE) goto redo; if (startcode == PADDING_STREAM) { - url_fskip(s->pb, avio_rb16(s->pb)); + avio_seek(s->pb, avio_rb16(s->pb), SEEK_CUR); goto redo; } if (startcode == PRIVATE_STREAM_2) { @@ -281,7 +281,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, } m->sofdec -= !m->sofdec; } - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); goto redo; } if (startcode == PROGRAM_STREAM_MAP) { @@ -359,7 +359,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext); pes_ext=skip=0; } - url_fskip(s->pb, skip); + avio_seek(s->pb, skip, SEEK_CUR); header_len -= skip; if (pes_ext & 0x01) { /* PES extension 2 */ @@ -375,7 +375,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, } if(header_len < 0) goto error_redo; - url_fskip(s->pb, header_len); + avio_seek(s->pb, header_len, SEEK_CUR); } else if( c!= 0xf ) goto redo; @@ -433,7 +433,7 @@ static int mpegps_read_packet(AVFormatContext *s, if(startcode == 0x1bd) { dvdaudio_substream_type = avio_r8(s->pb); - url_fskip(s->pb, 3); + avio_seek(s->pb, 3, SEEK_CUR); len -= 4; } @@ -525,7 +525,7 @@ static int mpegps_read_packet(AVFormatContext *s, } else { skip: /* skip packet */ - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); goto redo; } /* no stream found: add a new stream */ @@ -602,7 +602,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, dts != AV_NOPTS_VALUE) { break; } - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); } #ifdef DEBUG_SEEK printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 6a1b77301b..8815044fe3 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1346,7 +1346,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) } else { skip = raw_packet_size - TS_PACKET_SIZE; if (skip > 0) - url_fskip(pb, skip); + avio_seek(pb, skip, SEEK_CUR); break; } } diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index 3033c23a91..2a11a57201 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -104,19 +104,19 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) uint16_t keyframe; uint32_t size, timestamp; - url_fskip(pb, 1); /* one byte has been read ahead */ - url_fskip(pb, 2); - url_fskip(pb, 2); + avio_seek(pb, 1, SEEK_CUR); /* one byte has been read ahead */ + avio_seek(pb, 2, SEEK_CUR); + avio_seek(pb, 2, SEEK_CUR); keyframe = avio_rl16(pb); size = avio_rl32(pb); - url_fskip(pb, 4); - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); + avio_seek(pb, 4, SEEK_CUR); timestamp = avio_rl32(pb); if(!size || av_get_packet(pb, pkt, size) != size) return -1; - url_fskip(pb, 1); /* Read ahead one byte of struct size like read_header */ + avio_seek(pb, 1, SEEK_CUR); /* Read ahead one byte of struct size like read_header */ pkt->pts = timestamp; pkt->dts = timestamp; diff --git a/libavformat/mtv.c b/libavformat/mtv.c index af1a8f01ce..c5f14cf68e 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -83,10 +83,10 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st; unsigned int audio_subsegments; - url_fskip(pb, 3); + avio_seek(pb, 3, SEEK_CUR); mtv->file_size = avio_rl32(pb); mtv->segments = avio_rl32(pb); - url_fskip(pb, 32); + avio_seek(pb, 32, SEEK_CUR); mtv->audio_identifier = avio_rl24(pb); mtv->audio_br = avio_rl16(pb); mtv->img_colorfmt = avio_rl24(pb); @@ -105,7 +105,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3) / mtv->img_width; - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); audio_subsegments = avio_rl16(pb); mtv->full_segment_size = audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) + @@ -164,7 +164,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) { - url_fskip(pb, MTV_AUDIO_PADDING_SIZE); + avio_seek(pb, MTV_AUDIO_PADDING_SIZE, SEEK_CUR); ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE); if(ret < 0) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 3810c0cc63..be618406f7 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -262,7 +262,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv av_aes_init(mxf->aesc, s->key, 128, 1); } // crypto context - url_fskip(pb, klv_decode_ber_length(pb)); + avio_seek(pb, klv_decode_ber_length(pb), SEEK_CUR); // plaintext offset klv_decode_ber_length(pb); plaintext_size = avio_rb64(pb); @@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv &pkt->data[plaintext_size], size >> 4, ivec, 1); pkt->size = orig_size; pkt->stream_index = index; - url_fskip(pb, end - url_ftell(pb)); + avio_seek(pb, end - url_ftell(pb), SEEK_CUR); return 0; } @@ -339,7 +339,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } else skip: - url_fskip(s->pb, klv.length); + avio_seek(s->pb, klv.length, SEEK_CUR); } return AVERROR_EOF; } @@ -397,7 +397,7 @@ static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int siz mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID)); if (!mxf->packages_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); break; } @@ -416,7 +416,7 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U break; case 0x1101: /* UMID, only get last 16 bytes */ - url_fskip(pb, 16); + avio_seek(pb, 16, SEEK_CUR); avio_read(pb, source_clip->source_package_uid, 16); break; case 0x1102: @@ -437,7 +437,7 @@ static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int si package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); if (!package->tracks_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; } @@ -482,7 +482,7 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID)); if (!sequence->structural_components_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); break; } @@ -500,12 +500,12 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); if (!package->tracks_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; case 0x4401: /* UMID, only get last 16 bytes */ - url_fskip(pb, 16); + avio_seek(pb, 16, SEEK_CUR); avio_read(pb, package->package_uid, 16); break; case 0x4701: @@ -558,7 +558,7 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID)); if (!descriptor->sub_descriptors_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); break; case 0x3004: @@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) } } if (!metadata->read) - url_fskip(s->pb, klv.length); + avio_seek(s->pb, klv.length, SEEK_CUR); } return mxf_parse_structural_metadata(mxf); } diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c index 9f62f22ffb..79a4dbafab 100644 --- a/libavformat/ncdec.c +++ b/libavformat/ncdec.c @@ -73,7 +73,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) avio_r8(s->pb); size = avio_rl16(s->pb); - url_fskip(s->pb, 9); + avio_seek(s->pb, 9, SEEK_CUR); if (size == 0) { av_log(s, AV_LOG_DEBUG, "Next packet size is zero\n"); diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index dfd5e0fc78..cc0c5d7c68 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -584,7 +584,7 @@ null_chunk_retry: ((auxtag >> 16) & 0x0ff), ((auxtag >> 24) & 0x0ff), auxsize); - url_fskip(pb, auxsize); + avio_seek(pb, auxsize, SEEK_CUR); vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */ } diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 7920b0d13f..8831dc0a3e 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -757,7 +757,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) || discard >= AVDISCARD_ALL || stc->skip_until_key_frame){ - url_fskip(bc, size); + avio_seek(bc, size, SEEK_CUR); return 1; } diff --git a/libavformat/nuv.c b/libavformat/nuv.c index e360a64cfb..6c7c563b85 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -66,7 +66,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, switch (frametype) { case NUV_EXTRADATA: subtype = avio_r8(pb); - url_fskip(pb, 6); + avio_seek(pb, 6, SEEK_CUR); size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { vst->codec->extradata_size = size; @@ -78,7 +78,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, } break; case NUV_MYTHEXT: - url_fskip(pb, 7); + avio_seek(pb, 7, SEEK_CUR); size = PKTSIZE(avio_rl32(pb)); if (size != 128 * 4) break; @@ -90,7 +90,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G')) vst->codec->codec_id = CODEC_ID_NUV; } else - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); if (ast) { ast->codec->codec_tag = avio_rl32(pb); @@ -102,20 +102,20 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, ast->codec->bits_per_coded_sample); ast->need_parsing = AVSTREAM_PARSE_FULL; } else - url_fskip(pb, 4 * 4); + avio_seek(pb, 4 * 4, SEEK_CUR); size -= 6 * 4; - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); return 1; case NUV_SEEKP: size = 11; break; default: - url_fskip(pb, 7); + avio_seek(pb, 7, SEEK_CUR); size = PKTSIZE(avio_rl32(pb)); break; } - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } return 0; } @@ -130,14 +130,14 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *vst = NULL, *ast = NULL; avio_read(pb, id_string, 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12); - url_fskip(pb, 5); // version string - url_fskip(pb, 3); // padding + avio_seek(pb, 5, SEEK_CUR); // version string + avio_seek(pb, 3, SEEK_CUR); // padding width = avio_rl32(pb); height = avio_rl32(pb); avio_rl32(pb); // unused, "desiredwidth" avio_rl32(pb); // unused, "desiredheight" avio_r8(pb); // 'P' == progressive, 'I' == interlaced - url_fskip(pb, 3); // padding + avio_seek(pb, 3, SEEK_CUR); // padding aspect = av_int2dbl(avio_rl64(pb)); if (aspect > 0.9999 && aspect < 1.0001) aspect = 4.0 / 3.0; @@ -206,13 +206,13 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { switch (frametype) { case NUV_EXTRADATA: if (!ctx->rtjpg_video) { - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } case NUV_VIDEO: if (ctx->v_id < 0) { av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n"); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } ret = av_new_packet(pkt, copyhdrsize + size); @@ -236,7 +236,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { case NUV_AUDIO: if (ctx->a_id < 0) { av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n"); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } ret = av_get_packet(pb, pkt, size); @@ -250,7 +250,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { // contains no data, size value is invalid break; default: - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } } diff --git a/libavformat/pva.c b/libavformat/pva.c index f781026c1c..8091baaeb8 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -122,7 +122,7 @@ recover: if (pes_signal != 1) { pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, " "trying to recover\n"); - url_fskip(pb, length - 9); + avio_seek(pb, length - 9, SEEK_CUR); if (!read_packet) return AVERROR(EIO); goto recover; diff --git a/libavformat/qcp.c b/libavformat/qcp.c index 2c1fa3c635..6222bd5db1 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -93,7 +93,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rb32(pb); // "RIFF" s->file_size = avio_rl32(pb) + 8; - url_fskip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version + avio_seek(pb, 8 + 4 + 1 + 1, SEEK_CUR); // "QLCMfmt " + chunk-size + major-version + minor-version st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->channels = 1; @@ -110,13 +110,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n"); return AVERROR_INVALIDDATA; } - url_fskip(pb, 2 + 80); // codec-version + codec-name + avio_seek(pb, 2 + 80, SEEK_CUR); // codec-version + codec-name st->codec->bit_rate = avio_rl16(pb); s->packet_size = avio_rl16(pb); - url_fskip(pb, 2); // block-size + avio_seek(pb, 2, SEEK_CUR); // block-size st->codec->sample_rate = avio_rl16(pb); - url_fskip(pb, 2); // sample-size + avio_seek(pb, 2, SEEK_CUR); // sample-size memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode)); nb_rates = avio_rl32(pb); @@ -129,7 +129,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) } else c->rates_per_mode[mode] = size; } - url_fskip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved + avio_seek(pb, 16 - 2*nb_rates + 20, SEEK_CUR); // empty entries of rate-map-table + reserved return 0; } @@ -174,14 +174,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) case MKTAG('v', 'r', 'a', 't'): if (avio_rl32(pb)) // var-rate-flag s->packet_size = 0; - url_fskip(pb, 4); // size-in-packets + avio_seek(pb, 4, SEEK_CUR); // size-in-packets break; case MKTAG('d', 'a', 't', 'a'): c->data_size = chunk_size; break; default: - url_fskip(pb, chunk_size); + avio_seek(pb, chunk_size, SEEK_CUR); } } return AVERROR_EOF; diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 63ed26cee3..0e103b6aa4 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -72,7 +72,7 @@ static int r3d_read_red1(AVFormatContext *s) tmp = avio_rb32(s->pb); // filenum av_dlog(s, "filenum %d\n", tmp); - url_fskip(s->pb, 32); // unknown + avio_seek(s->pb, 32, SEEK_CUR); // unknown st->codec->width = avio_rb32(s->pb); st->codec->height = avio_rb32(s->pb); @@ -152,7 +152,7 @@ static void r3d_read_reos(AVFormatContext *s) tmp = avio_rb32(s->pb); av_dlog(s, "num audio chunks %d\n", tmp); - url_fskip(s->pb, 6*4); + avio_seek(s->pb, 6*4, SEEK_CUR); } static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -332,7 +332,7 @@ static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt) break; default: skip: - url_fskip(s->pb, atom.size-8); + avio_seek(s->pb, atom.size-8, SEEK_CUR); } } return err; diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 022cb720ac..ce398963e6 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -161,16 +161,16 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) num = avio_rb16(&pb); if (rule_nr < 0 || rule_nr >= num) return -1; - url_fskip(&pb, rule_nr * 2); + avio_seek(&pb, rule_nr * 2, SEEK_CUR); chunk_nr = avio_rb16(&pb); - url_fskip(&pb, (num - 1 - rule_nr) * 2); + avio_seek(&pb, (num - 1 - rule_nr) * 2, SEEK_CUR); /* read MDPR chunks */ num = avio_rb16(&pb); if (chunk_nr >= num) return -1; while (chunk_nr--) - url_fskip(&pb, avio_rb32(&pb)); + avio_seek(&pb, avio_rb32(&pb), SEEK_CUR); size = avio_rb32(&pb); } else { size = rdt->mlti_data_size; diff --git a/libavformat/riff.c b/libavformat/riff.c index 9fd5c50609..709aaad246 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -501,7 +501,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) codec->bits_per_coded_sample = avio_rl16(pb); codec->channel_layout = avio_rl32(pb); /* dwChannelMask */ id = avio_rl32(pb); /* 4 first bytes of GUID */ - url_fskip(pb, 12); /* skip end of GUID */ + avio_seek(pb, 12, SEEK_CUR); /* skip end of GUID */ cbSize -= 22; size -= 22; } @@ -514,7 +514,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) /* It is possible for the chunk to contain garbage at the end */ if (size > 0) - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample); if (codec->codec_id == CODEC_ID_AAC_LATM) { diff --git a/libavformat/rl2.c b/libavformat/rl2.c index eb1ef1285e..4538d5c5cd 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -95,7 +95,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, int i; int ret = 0; - url_fskip(pb,4); /* skip FORM tag */ + avio_seek(pb,4, SEEK_CUR); /* skip FORM tag */ back_size = avio_rl32(pb); /**< get size of the background frame */ signature = avio_rb32(pb); data_size = avio_rb32(pb); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 4d7c763db4..23f207595d 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -132,7 +132,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, if (version == 3) { int header_size = avio_rb16(pb); int64_t startpos = url_ftell(pb); - url_fskip(pb, 14); + avio_seek(pb, 14, SEEK_CUR); rm_read_metadata(s, 0); if ((startpos + header_size) >= url_ftell(pb) + 2) { // fourcc (should always be "lpcJ") @@ -141,7 +141,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, } // Skip extra header crap (this should never happen) if ((startpos + header_size) > url_ftell(pb)) - url_fskip(pb, header_size + startpos - url_ftell(pb)); + avio_seek(pb, header_size + startpos - url_ftell(pb), SEEK_CUR); st->codec->sample_rate = 8000; st->codec->channels = 1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -150,7 +150,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, int flavor, sub_packet_h, coded_framesize, sub_packet_size; int codecdata_length; /* old version (4) */ - url_fskip(pb, 2); /* unused */ + avio_seek(pb, 2, SEEK_CUR); /* unused */ avio_rb32(pb); /* .ra4 */ avio_rb32(pb); /* data size */ avio_rb16(pb); /* version2 */ @@ -321,7 +321,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, skip: /* skip codec info */ size = url_ftell(pb) - codec_pos; - url_fskip(pb, codec_data_size - size); + avio_seek(pb, codec_data_size - size, SEEK_CUR); return 0; } @@ -340,7 +340,7 @@ static int rm_read_index(AVFormatContext *s) size = avio_rb32(pb); if (size < 20) return -1; - url_fskip(pb, 2); + avio_seek(pb, 2, SEEK_CUR); n_pkts = avio_rb32(pb); str_id = avio_rb16(pb); next_off = avio_rb32(pb); @@ -353,10 +353,10 @@ static int rm_read_index(AVFormatContext *s) goto skip; for (n = 0; n < n_pkts; n++) { - url_fskip(pb, 2); + avio_seek(pb, 2, SEEK_CUR); pts = avio_rb32(pb); pos = avio_rb32(pb); - url_fskip(pb, 4); /* packet no. */ + avio_seek(pb, 4, SEEK_CUR); /* packet no. */ av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME); } @@ -469,7 +469,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) goto header_end; default: /* unknown tag: skip it */ - url_fskip(pb, tag_size - 10); + avio_seek(pb, tag_size - 10, SEEK_CUR); break; } } @@ -529,7 +529,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ if(state == MKBETAG('I', 'N', 'D', 'X')){ int n_pkts, expected_len; len = avio_rb32(pb); - url_fskip(pb, 2); + avio_seek(pb, 2, SEEK_CUR); n_pkts = avio_rb32(pb); expected_len = 20 + n_pkts * 14; if (len == 20) @@ -566,7 +566,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ if (i == s->nb_streams) { skip: /* skip packet if unknown number */ - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); rm->remaining_len = 0; continue; } @@ -929,7 +929,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, break; } - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); } *ppos = pos; return dts; diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index f949725a0f..7d0bf67214 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -187,11 +187,11 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, flags |= RTP_FLAG_KEY; len_off = avio_rb24(pb); if (mflags & 0x20) /**< relative timestamp */ - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); if (mflags & 0x10) /**< has duration */ - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); if (mflags & 0x8) /**< has location ID */ - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); off = url_ftell(pb); if (!(mflags & 0x40)) { @@ -214,7 +214,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, return AVERROR(EIO); avio_write(asf->pktbuf, buf + off, len - off); - url_fskip(pb, len - off); + avio_seek(pb, len - off, SEEK_CUR); if (!(flags & RTP_FLAG_MARKER)) return -1; out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf); @@ -234,7 +234,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, asf->buf = av_realloc(asf->buf, out_len); memcpy(asf->buf + prev_len, buf + off, FFMIN(cur_len, len - off)); - url_fskip(pb, cur_len); + avio_seek(pb, cur_len, SEEK_CUR); } } diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 7476bb944e..5cf5223c84 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -149,13 +149,13 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, break; } default: - url_fskip(&pb, tlv_len); + avio_seek(&pb, tlv_len, SEEK_CUR); break; } } /* 32-bit alignment */ - url_fskip(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb)); + avio_seek(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb), SEEK_CUR); } else avio_seek(&pb, 4, SEEK_SET); diff --git a/libavformat/sauce.c b/libavformat/sauce.c index f4ebc2fe68..ba737df1ce 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -51,14 +51,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g GET_SAUCE_META("artist", 20) GET_SAUCE_META("publisher", 20) GET_SAUCE_META("date", 8) - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); datatype = avio_r8(pb); filetype = avio_r8(pb); t1 = avio_rl16(pb); t2 = avio_rl16(pb); nb_comments = avio_r8(pb); flags = avio_r8(pb); - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); GET_SAUCE_META("encoder", 22); if (got_width && datatype && filetype) { diff --git a/libavformat/siff.c b/libavformat/siff.c index 1d24c6a504..880132ff67 100644 --- a/libavformat/siff.c +++ b/libavformat/siff.c @@ -103,7 +103,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) } width = avio_rl16(pb); height = avio_rl16(pb); - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); c->frames = avio_rl16(pb); if(!c->frames){ av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); @@ -113,7 +113,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) c->rate = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); - url_fskip(pb, 16); //zeroes + avio_seek(pb, 16, SEEK_CUR); //zeroes st = av_new_stream(s, 0); if (!st) @@ -145,7 +145,7 @@ static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n"); return -1; } - url_fskip(pb, 4); //unknown value + avio_seek(pb, 4, SEEK_CUR); //unknown value c->rate = avio_rl16(pb); c->bits = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); @@ -160,7 +160,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) if (avio_rl32(pb) != TAG_SIFF) return -1; - url_fskip(pb, 4); //ignore size + avio_seek(pb, 4, SEEK_CUR); //ignore size tag = avio_rl32(pb); if (tag != TAG_VBV1 && tag != TAG_SOUN){ @@ -176,7 +176,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n"); return -1; } - url_fskip(pb, 4); //ignore size + avio_seek(pb, 4, SEEK_CUR); //ignore size return 0; } diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index b66883441b..6d99033f47 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -58,14 +58,14 @@ static int sox_read_header(AVFormatContext *s, if (avio_rl32(pb) == SOX_TAG) { st->codec->codec_id = CODEC_ID_PCM_S32LE; header_size = avio_rl32(pb); - url_fskip(pb, 8); /* sample count */ + avio_seek(pb, 8, SEEK_CUR); /* sample count */ sample_rate = av_int2dbl(avio_rl64(pb)); st->codec->channels = avio_rl32(pb); comment_size = avio_rl32(pb); } else { st->codec->codec_id = CODEC_ID_PCM_S32BE; header_size = avio_rb32(pb); - url_fskip(pb, 8); /* sample count */ + avio_seek(pb, 8, SEEK_CUR); /* sample count */ sample_rate = av_int2dbl(avio_rb64(pb)); st->codec->channels = avio_rb32(pb); comment_size = avio_rb32(pb); @@ -105,7 +105,7 @@ static int sox_read_header(AVFormatContext *s, AV_METADATA_DONT_STRDUP_VAL); } - url_fskip(pb, header_size - SOX_FIXED_HDR - comment_size); + avio_seek(pb, header_size - SOX_FIXED_HDR - comment_size, SEEK_CUR); st->codec->sample_rate = sample_rate; st->codec->bits_per_coded_sample = 32; diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index 2fc567277f..b2194ea283 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -201,7 +201,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) } /* skip over the padding to the beginning of the next frame */ - url_fskip(pb, offset - pkt->size - BURST_HEADER_SIZE); + avio_seek(pb, offset - pkt->size - BURST_HEADER_SIZE, SEEK_CUR); if (!s->nb_streams) { /* first packet, create a stream */ diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index c567f264f1..b96b229133 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -70,7 +70,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) /* skip rectangle size */ nbits = avio_r8(pb) >> 3; len = (4 * nbits - 3 + 7) / 8; - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */ avio_rl16(pb); /* frame count */ @@ -159,7 +159,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) { if (st->codec->codec_id == CODEC_ID_MP3) { - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); av_get_packet(pb, pkt, len-4); } else { // ADPCM, PCM av_get_packet(pb, pkt, len); @@ -202,7 +202,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) return pkt->size; } skip: - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); } return 0; } diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 7b0691db0f..c632988e18 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -152,7 +152,7 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, pkt_size); if (tmv->stream_index) - url_fskip(pb, tmv->padding); + avio_seek(pb, tmv->padding, SEEK_CUR); pkt->stream_index = tmv->stream_index; tmv->stream_index ^= 1; diff --git a/libavformat/tta.c b/libavformat/tta.c index 42d551de35..221cdf3e0a 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -50,7 +50,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) if (avio_rl32(s->pb) != AV_RL32("TTA1")) return -1; // not tta file - url_fskip(s->pb, 2); // FIXME: flags + avio_seek(s->pb, 2, SEEK_CUR); // FIXME: flags channels = avio_rl16(s->pb); bps = avio_rl16(s->pb); samplerate = avio_rl32(s->pb); @@ -65,7 +65,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } - url_fskip(s->pb, 4); // header crc + avio_seek(s->pb, 4, SEEK_CUR); // header crc framelen = samplerate*256/245; c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0); @@ -91,7 +91,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME); framepos += size; } - url_fskip(s->pb, 4); // seektable crc + avio_seek(s->pb, 4, SEEK_CUR); // seektable crc st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_TTA; diff --git a/libavformat/txd.c b/libavformat/txd.c index 92a0c094aa..22dcfdbe77 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -73,7 +73,7 @@ next_chunk: if (chunk_size > 100) break; case TXD_EXTRA: - url_fskip(s->pb, chunk_size); + avio_seek(s->pb, chunk_size, SEEK_CUR); case TXD_FILE: case TXD_TEXTURE: goto next_chunk; diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 838dd43b5f..2f84b52674 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -68,7 +68,7 @@ static int vc1t_read_header(AVFormatContext *s, st->codec->width = avio_rl32(pb); if(avio_rl32(pb) != 0xC) return -1; - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); fps = avio_rl32(pb); if(fps == 0xFFFFFFFF) av_set_pts_info(st, 32, 1, 1000); diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index 01bbdb2c62..cb496bf7c2 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -45,13 +45,13 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) int header_size; AVStream *st; - url_fskip(pb, 20); + avio_seek(pb, 20, SEEK_CUR); header_size = avio_rl16(pb) - 22; if (header_size != 4) { av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size); return AVERROR(ENOSYS); } - url_fskip(pb, header_size); + avio_seek(pb, header_size, SEEK_CUR); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); @@ -114,13 +114,13 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) dec->bits_per_coded_sample = avio_r8(pb); dec->channels = avio_r8(pb); tmp_codec = avio_rl16(pb); - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); voc->remaining_size -= 12; max_size -= 12; break; default: - url_fskip(pb, voc->remaining_size); + avio_seek(pb, voc->remaining_size, SEEK_CUR); max_size -= voc->remaining_size; voc->remaining_size = 0; break; diff --git a/libavformat/vqf.c b/libavformat/vqf.c index dfa1a156d0..fb440af2fd 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -72,7 +72,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!st) return AVERROR(ENOMEM); - url_fskip(s->pb, 12); + avio_seek(s->pb, 12, SEEK_CUR); header_size = avio_rb32(s->pb); @@ -101,7 +101,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->channels = avio_rb32(s->pb) + 1; read_bitrate = avio_rb32(s->pb); rate_flag = avio_rb32(s->pb); - url_fskip(s->pb, len-12); + avio_seek(s->pb, len-12, SEEK_CUR); st->codec->bit_rate = read_bitrate*1000; st->codec->bits_per_coded_sample = 16; @@ -140,7 +140,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n", ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1], ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]); - url_fskip(s->pb, FFMIN(len, header_size)); + avio_seek(s->pb, FFMIN(len, header_size), SEEK_CUR); break; } diff --git a/libavformat/wav.c b/libavformat/wav.c index 54f9ff7d87..d6329e326a 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -217,7 +217,7 @@ static int wav_read_header(AVFormatContext *s, avio_rl64(pb); /* RIFF size */ data_size = avio_rl64(pb); sample_count = avio_rl64(pb); - url_fskip(pb, size - 16); /* skip rest of ds64 chunk */ + avio_seek(pb, size - 16, SEEK_CUR); /* skip rest of ds64 chunk */ } /* parse fmt header */ @@ -276,7 +276,7 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) return -1; if (!memcmp(guid, guid1, 16)) return size; - url_fskip(pb, FFALIGN(size, INT64_C(8)) - 24); + avio_seek(pb, FFALIGN(size, INT64_C(8)) - 24, SEEK_CUR); } return -1; } @@ -410,7 +410,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) /* subtract chunk header size - normal wav file doesn't count it */ ff_get_wav_header(pb, st->codec, size - 24); - url_fskip(pb, FFALIGN(size, INT64_C(8)) - size); + avio_seek(pb, FFALIGN(size, INT64_C(8)) - size, SEEK_CUR); st->need_parsing = AVSTREAM_PARSE_FULL; diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 6c9993b15b..6b8a58daeb 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -539,7 +539,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty } else { av_freep(&buf); av_log(s, AV_LOG_WARNING, "unsupported metadata entry; key:%s, type:%d, length:0x%x\n", key, type, length); - url_fskip(pb, length); + avio_seek(pb, length, SEEK_CUR); return; } @@ -582,7 +582,7 @@ static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st) WtvContext *wtv = s->priv_data; AVIOContext *pb = wtv->pb; - url_fskip(pb, 72); // picture aspect ratio is unreliable + avio_seek(pb, 72, SEEK_CUR); // picture aspect ratio is unreliable ff_get_bmp_header(pb, st); return 72 + 40; @@ -658,17 +658,17 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, if (size < 32) { av_log(s, AV_LOG_WARNING, "format buffer size underflow\n"); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); return NULL; } - url_fskip(pb, size - 32); + avio_seek(pb, size - 32, SEEK_CUR); ff_get_guid(pb, &actual_subtype); ff_get_guid(pb, &actual_formattype); avio_seek(pb, -size, SEEK_CUR); st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32); - url_fskip(pb, 32); + avio_seek(pb, 32, SEEK_CUR); return st; } else if (!ff_guidcmp(mediatype, mediatype_audio)) { st = new_stream(s, st, sid, AVMEDIA_TYPE_AUDIO); @@ -679,7 +679,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, } else { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) { @@ -701,14 +701,14 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (!ff_guidcmp(formattype, format_videoinfo2)) { int consumed = parse_videoinfoheader2(s, st); - url_fskip(pb, FFMAX(size - consumed, 0)); + avio_seek(pb, FFMAX(size - consumed, 0), SEEK_CUR); } else if (!ff_guidcmp(formattype, format_mpeg2_video)) { int consumed = parse_videoinfoheader2(s, st); - url_fskip(pb, FFMAX(size - consumed, 0)); + avio_seek(pb, FFMAX(size - consumed, 0), SEEK_CUR); } else { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) { @@ -726,7 +726,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); st->codec->codec_id = CODEC_ID_DVB_SUBTITLE; return st; } else if (!ff_guidcmp(mediatype, mediatype_mstvcaption) && @@ -736,21 +736,21 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); st->codec->codec_id = CODEC_ID_DVB_TELETEXT; return st; } else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) && !ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); return NULL; } av_log(s, AV_LOG_WARNING, "unknown media type, mediatype:"PRI_GUID ", subtype:"PRI_GUID", formattype:"PRI_GUID"\n", ARG_GUID(mediatype), ARG_GUID(subtype), ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); return NULL; } @@ -779,17 +779,17 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (len < 32) break; sid = avio_rl32(pb) & 0x7FFF; - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); consumed = 32; if (!ff_guidcmp(g, stream_guid)) { if (ff_find_stream_index(s, sid) < 0) { ff_asf_guid mediatype, subtype, formattype; int size; - url_fskip(pb, 28); + avio_seek(pb, 28, SEEK_CUR); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); ff_get_guid(pb, &formattype); size = avio_rl32(pb); parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); @@ -800,10 +800,10 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0 && !((WtvStream*)s->streams[stream_index]->priv_data)->seen_data) { ff_asf_guid mediatype, subtype, formattype; int size; - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); ff_get_guid(pb, &formattype); size = avio_rl32(pb); parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size); @@ -822,11 +822,11 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p const uint8_t *pbuf = buf; int buf_size; - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); consumed += 8; if (!ff_guidcmp(g, EVENTID_CtxADescriptorSpanningEvent) || !ff_guidcmp(g, EVENTID_CSDescriptorSpanningEvent)) { - url_fskip(pb, 6); + avio_seek(pb, 6, SEEK_CUR); consumed += 6; } @@ -840,7 +840,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0) { AVStream *st = s->streams[stream_index]; int audio_type; - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); audio_type = avio_r8(pb); if (audio_type == 2) st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; @@ -851,7 +851,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else if (!ff_guidcmp(g, EVENTID_DVBScramblingControlSpanningEvent)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); if (avio_rl32(pb)) av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index); consumed += 16; @@ -861,7 +861,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0) { AVStream *st = s->streams[stream_index]; uint8_t language[4]; - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); avio_read(pb, language, 3); if (language[0]) { language[3] = 0; @@ -874,7 +874,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else if (!ff_guidcmp(g, timestamp_guid)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); wtv->pts = avio_rl64(pb); consumed += 16; if (wtv->pts == -1) @@ -885,7 +885,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p wtv->epoch = wtv->pts; if (mode == SEEK_TO_PTS && wtv->pts >= seekts) { #define WTV_PAD8(x) (((x) + 7) & ~7) - url_fskip(pb, WTV_PAD8(len) - consumed); + avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR); return 0; } } @@ -923,7 +923,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else av_log(s, AV_LOG_WARNING, "unsupported chunk:"PRI_GUID"\n", ARG_GUID(g)); - url_fskip(pb, WTV_PAD8(len) - consumed); + avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR); } return AVERROR_EOF; } @@ -954,13 +954,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) wtv->last_valid_pts = AV_NOPTS_VALUE; /* read root directory sector */ - url_fskip(s->pb, 0x30); + avio_seek(s->pb, 0x30, SEEK_CUR); root_size = avio_rl32(s->pb); if (root_size > sizeof(root)) { av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n"); return AVERROR_INVALIDDATA; } - url_fskip(s->pb, 4); + avio_seek(s->pb, 4, SEEK_CUR); root_sector = avio_rl32(s->pb); avio_seek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); @@ -1047,7 +1047,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return ret; pkt->stream_index = stream_index; pkt->pts = wtv->pts; - url_fskip(pb, WTV_PAD8(len) - len); + avio_seek(pb, WTV_PAD8(len) - len, SEEK_CUR); return 0; } diff --git a/libavformat/wv.c b/libavformat/wv.c index c2ef8d6356..7a2c855f9d 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -153,7 +153,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen chmask = avio_rl32(pb); break; case 5: - url_fskip(pb, 1); + avio_seek(pb, 1, SEEK_CUR); chan |= (avio_r8(pb) & 0xF) << 8; chmask = avio_rl24(pb); break; @@ -166,10 +166,10 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen rate = avio_rl24(pb); break; default: - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } if(id&0x40) - url_fskip(pb, 1); + avio_seek(pb, 1, SEEK_CUR); } if(rate == -1){ av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); diff --git a/libavformat/xa.c b/libavformat/xa.c index 858a74201e..17cf237a9d 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -76,9 +76,9 @@ static int xa_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA; - url_fskip(pb, 4); /* Skip the XA ID */ + avio_seek(pb, 4, SEEK_CUR); /* Skip the XA ID */ xa->out_size = avio_rl32(pb); - url_fskip(pb, 2); /* Skip the tag */ + avio_seek(pb, 2, SEEK_CUR); /* Skip the tag */ st->codec->channels = avio_rl16(pb); st->codec->sample_rate = avio_rl32(pb); /* Value in file is average byte rate*/ diff --git a/libavformat/yop.c b/libavformat/yop.c index 0c87724c53..e4437b7a0e 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -81,7 +81,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) video_dec->codec_type = AVMEDIA_TYPE_VIDEO; video_dec->codec_id = CODEC_ID_YOP; - url_fskip(pb, 6); + avio_seek(pb, 6, SEEK_CUR); frame_rate = avio_r8(pb); yop->frame_size = avio_r8(pb) * 2048; @@ -153,7 +153,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) // Set position to the start of the frame pkt->pos = yop->video_packet.pos; - url_fskip(pb, yop->audio_block_length - ret); + avio_seek(pb, yop->audio_block_length - ret, SEEK_CUR); ret = avio_read(pb, yop->video_packet.data + yop->palette_size, actual_video_data_size); From 0300db8ad778a194b4a8ec98f6da3de5b41c46ee Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 28 Feb 2011 14:57:56 +0100 Subject: [PATCH 485/528] avio: deprecate url_fskip avio_seek should be used instead Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 8 +------- libavformat/aviobuf.c | 2 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 568bdd346a..cc46ad79e5 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -421,6 +421,7 @@ attribute_deprecated void put_tag(AVIOContext *s, const char *tag); attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); attribute_deprecated int url_fclose(AVIOContext *s); attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); +attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset); /** * @} */ @@ -468,13 +469,6 @@ int avio_put_str16le(AVIOContext *s, const char *str); */ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); -/** - * Skip given number of bytes forward. - * @param offset number of bytes - * @return 0 on success, <0 on error - */ -int url_fskip(AVIOContext *s, int64_t offset); - /** * ftell() equivalent for AVIOContext. * @return position or AVERROR. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index a74ad21604..0c733a704b 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -233,11 +233,13 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) return offset; } +#if FF_API_OLD_AVIO int url_fskip(AVIOContext *s, int64_t offset) { int64_t ret = avio_seek(s, offset, SEEK_CUR); return ret < 0 ? ret : 0; } +#endif int64_t url_ftell(AVIOContext *s) { From fffdee89cc0712ed3324bae1f86e271a36c02822 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Tue, 1 Mar 2011 23:36:48 +0000 Subject: [PATCH 486/528] movenc: fix tkhd height for imx Signed-off-by: Mans Rullgard --- libavformat/movenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 030cbda467..3722bb6384 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1217,7 +1217,7 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)) { if(track->mode == MODE_MOV) { avio_wb32(pb, track->enc->width << 16); - avio_wb32(pb, track->enc->height << 16); + avio_wb32(pb, track->height << 16); } else { double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); if(!sample_aspect_ratio || track->height != track->enc->height) From 99bbc781e9c134066887fc521db7a9d3607e3de1 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Tue, 1 Mar 2011 23:50:25 +0000 Subject: [PATCH 487/528] dnxhd: allow encoding with Avid Nitris compatibility. Signed-off-by: Mans Rullgard --- libavcodec/dnxhdenc.c | 16 +++++++++++++++- libavcodec/dnxhdenc.h | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index d6f8bd3cad..2e8720ac45 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -24,11 +24,20 @@ //#define DEBUG #define RC_VARIANCE 1 // use variance or ssd for fast rc +#include "libavutil/opt.h" #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" #include "dnxhdenc.h" +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM + +static const AVOption options[]={ + {"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), FF_OPT_TYPE_INT, 0, 0, 1, VE}, +{NULL} +}; +static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL_VERSION_INT }; + int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); #define LAMBDA_FRAC_BITS 10 @@ -146,7 +155,7 @@ static int dnxhd_init_rc(DNXHDEncContext *ctx) if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD) FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail); - ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8; + ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4 - ctx->min_padding) * 8; ctx->qscale = 1; ctx->lambda = 2<m.intra_quant_bias, 0) < 0) // XXX tune lbias/cbias return -1; + // Avid Nitris hardware decoder requires a minimum amount of padding in the coding unit payload + if (ctx->nitris_compat) + ctx->min_padding = 1600; + if (dnxhd_init_vlc(ctx) < 0) return -1; if (dnxhd_init_rc(ctx) < 0) @@ -858,4 +871,5 @@ AVCodec ff_dnxhd_encoder = { dnxhd_encode_end, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"), + .priv_class = &class, }; diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h index eaf33d5cb9..f0b38a5981 100644 --- a/libavcodec/dnxhdenc.h +++ b/libavcodec/dnxhdenc.h @@ -55,6 +55,9 @@ typedef struct DNXHDEncContext { int interlaced; int cur_field; + int nitris_compat; + unsigned min_padding; + DECLARE_ALIGNED(16, DCTELEM, blocks)[8][64]; int (*qmatrix_c) [64]; From 06ed4873e6e6aed8ec7cc24285d610ef4060880e Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Tue, 1 Mar 2011 23:54:29 +0000 Subject: [PATCH 488/528] movenc: use correct tag for dvcpro hd Signed-off-by: Mans Rullgard --- libavformat/movenc.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 3722bb6384..231976b0c6 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -623,12 +623,23 @@ static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag; - if (track->enc->height == 480) /* NTSC */ - if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n'); - else tag = MKTAG('d','v','c',' '); - else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p'); - else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p'); - else tag = MKTAG('d','v','p','p'); + if (track->enc->width == 720) /* SD */ + if (track->enc->height == 480) /* NTSC */ + if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n'); + else tag = MKTAG('d','v','c',' '); + else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p'); + else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p'); + else tag = MKTAG('d','v','p','p'); + else if (track->enc->height == 720) /* HD 720 line */ + if (track->enc->time_base.den == 50) tag = MKTAG('d','v','h','q'); + else tag = MKTAG('d','v','h','p'); + else if (track->enc->height == 1080) /* HD 1080 line */ + if (track->enc->time_base.den == 25) tag = MKTAG('d','v','h','5'); + else tag = MKTAG('d','v','h','6'); + else { + av_log(s, AV_LOG_ERROR, "unsupported height for dv codec\n"); + return 0; + } return tag; } From e360ada2d13af36ab7afd9ebcd2bd236d23d9b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sun, 27 Feb 2011 01:02:32 +0200 Subject: [PATCH 489/528] aviobuf: Write new data at s->buf_end in fill_buffer In most cases, s->buf_ptr will be equal to s->buf_end when fill_buffer is called, but this may not always be the case, if we're seeking forward by reading (permitted by the short seek threshold). If fill_buffer is writing to s->buf_ptr instead of s->buf_end (when they aren't equal and s->buf_ptr is ahead of s->buffer), the data between s->buf_ptr and s->buf_end is overwritten, leading to inconsistent buffer content. This could return incorrect data if later seeking back into the area before the current s->buf_ptr. Signed-off-by: Luca Barbato --- libavformat/aviobuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 0c733a704b..3f3721c58b 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -468,7 +468,7 @@ void put_tag(AVIOContext *s, const char *tag) static void fill_buffer(AVIOContext *s) { - uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_ptr : s->buffer; + uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_end : s->buffer; int len= s->buffer_size - (dst - s->buffer); int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE; From 863c471638fa667e6e5c5df059b67af263e1cd40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 24 Feb 2011 10:08:06 +0200 Subject: [PATCH 490/528] libavformat: Add av_pkt_dump{, _log}2, taking an AVStream parameter This removes a fixme issue, by allowing the av_pkt_dump functions to use the correct time base. Signed-off-by: Luca Barbato --- libavformat/avformat.h | 16 ++++++++++++---- libavformat/utils.c | 26 +++++++++++++++++++------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 4f25d66dc8..f5afde84cb 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -949,7 +949,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, * @param buf buffer * @param size buffer size * - * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 */ void av_hex_dump(FILE *f, uint8_t *buf, int size); @@ -963,7 +963,7 @@ void av_hex_dump(FILE *f, uint8_t *buf, int size); * @param buf buffer * @param size buffer size * - * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 */ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); @@ -973,8 +973,11 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); * @param f The file stream pointer where the dump should be sent to. * @param pkt packet to dump * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to */ -void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); + +attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); /** * Send a nice dump of a packet to the log. @@ -985,8 +988,13 @@ void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); * higher importance. * @param pkt packet to dump * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to */ -void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st); + +attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, + int dump_payload); /** * Initialize libavformat and register all the muxers, demuxers and diff --git a/libavformat/utils.c b/libavformat/utils.c index 70da4ca147..f48ed2ab1c 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3494,26 +3494,25 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size) hex_dump_internal(avcl, NULL, level, buf, size); } - //FIXME needs to know the time_base -static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload) +static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload, AVRational time_base) { #undef fprintf #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0) PRINT("stream #%d:\n", pkt->stream_index); PRINT(" keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0)); - PRINT(" duration=%0.3f\n", (double)pkt->duration / AV_TIME_BASE); + PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base)); /* DTS is _always_ valid after av_read_frame() */ PRINT(" dts="); if (pkt->dts == AV_NOPTS_VALUE) PRINT("N/A"); else - PRINT("%0.3f", (double)pkt->dts / AV_TIME_BASE); + PRINT("%0.3f", pkt->dts * av_q2d(time_base)); /* PTS may not be known if B-frames are present. */ PRINT(" pts="); if (pkt->pts == AV_NOPTS_VALUE) PRINT("N/A"); else - PRINT("%0.3f", (double)pkt->pts / AV_TIME_BASE); + PRINT("%0.3f", pkt->pts * av_q2d(time_base)); PRINT("\n"); PRINT(" size=%d\n", pkt->size); #undef PRINT @@ -3523,12 +3522,25 @@ static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload) { - pkt_dump_internal(NULL, f, 0, pkt, dump_payload); + AVRational tb = { 1, AV_TIME_BASE }; + pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb); +} + +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st) +{ + pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base); } void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload) { - pkt_dump_internal(avcl, NULL, level, pkt, dump_payload); + AVRational tb = { 1, AV_TIME_BASE }; + pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb); +} + +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st) +{ + pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base); } #if FF_API_URL_SPLIT From 5e33e7bdac70a4b70e31f4ae6f0344060346d0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 24 Feb 2011 10:08:07 +0200 Subject: [PATCH 491/528] ffmpeg: Use av_pkt_dump_log2 This makes dumped packet timestamps proper for streams with timebases other than AV_TIME_BASE. Signed-off-by: Luca Barbato --- ffmpeg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index 4a737b4945..e3dda9de1c 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2578,7 +2578,8 @@ static int transcode(AVFormatContext **output_files, memset(no_packet, 0, sizeof(no_packet)); if (do_pkt_dump) { - av_pkt_dump_log(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump); + av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump, + is->streams[pkt.stream_index]); } /* the following test is needed in case new streams appear dynamically in stream : we ignore them */ From fb985071263e6b3daff1c3d987df482b0146c2a0 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Wed, 2 Mar 2011 11:17:33 +0000 Subject: [PATCH 492/528] vc1: fix decoding when end sequence is present Signed-off-by: Mans Rullgard --- libavcodec/vc1dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index ed92d8cadd..b27b6d01c1 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -3149,7 +3149,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, const uint8_t *buf_start = buf; /* no supplementary picture */ - if (buf_size == 0) { + if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { /* special case for last picture */ if (s->low_delay==0 && s->next_picture_ptr) { *pict= *(AVFrame*)s->next_picture_ptr; From ff1efc524cb3c60f2f746e3b4550bb1a86c65316 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 2 Mar 2011 13:08:15 +0000 Subject: [PATCH 493/528] threads: allow thread count of zero This moves setting the thread count to a minimum of 1 to frame_thread_init(), allowing a value of zero to propagate through to the codec if frame threading is not used. This makes auto-threads work in libx264. Signed-off-by: Mans Rullgard --- libavcodec/pthread.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 5b0d108ba5..658dbacb89 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -683,6 +683,11 @@ static int frame_thread_init(AVCodecContext *avctx) FrameThreadContext *fctx; int i, err = 0; + if (thread_count <= 1) { + avctx->active_thread_type = 0; + return 0; + } + avctx->thread_opaque = fctx = av_mallocz(sizeof(FrameThreadContext)); fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count); @@ -882,8 +887,6 @@ int ff_thread_init(AVCodecContext *avctx, int thread_count) return -1; } - avctx->thread_count = FFMAX(1, thread_count); - if (avctx->codec) { validate_thread_parameters(avctx); From 8cf9a09d407c42299b3203bd1eb42af6109a0d7a Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 2 Mar 2011 12:15:07 -0500 Subject: [PATCH 494/528] vp3-mt: fix deadlock when first frame is not a keyframe. --- libavcodec/vp3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 3d4bfb4d91..97e5d64351 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1915,6 +1915,7 @@ static int vp3_decode_frame(AVCodecContext *avctx, } s->last_frame = s->golden_frame; s->last_frame.type = FF_BUFFER_TYPE_COPY; + ff_thread_report_progress(&s->last_frame, INT_MAX, 0); } } From fd085bc08203979c6d0e8a6ab031c7e19b57f7a1 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Fri, 4 Mar 2011 08:33:49 -0500 Subject: [PATCH 495/528] avio: fix fourcc if any character is >=0x80. Fixes issue 2638. --- libavformat/avio_internal.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 3b38990f56..279c7f60ff 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -42,6 +42,9 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size); void ffio_fill(AVIOContext *s, int b, int count); -#define ffio_wfourcc(pb, str) avio_wl32(pb, MKTAG((str)[0], (str)[1], (str)[2], (str)[3])) +static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s) +{ + avio_wl32(pb, MKTAG(s[0], s[1], s[2], s[3])); +} #endif // AVFORMAT_AVIO_INTERNAL_H From 41d8555f72e3bc60cf93af2a1a4786b452fd2736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Thu, 3 Mar 2011 13:51:55 +0100 Subject: [PATCH 496/528] avio: add avio_get_str() Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 14 ++++++++++++++ libavformat/aviobuf.c | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/libavformat/avio.h b/libavformat/avio.h index cc46ad79e5..fd4839c789 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -525,6 +525,20 @@ unsigned int avio_rl24(AVIOContext *s); unsigned int avio_rl32(AVIOContext *s); uint64_t avio_rl64(AVIOContext *s); +/** + * Read a string from pb into buf. The reading will terminate when either + * a NULL character was encountered, maxlen bytes have been read, or nothing + * more can be read from pb. The result is guaranteed to be NULL-terminated, it + * will be truncated if buf is too small. + * Note that the string is not interpreted or validated in any way, it + * might get truncated in the middle of a sequence for multi-byte encodings. + * + * @return number of bytes read (is always <= maxlen). + * If reading ends on EOF or error, the return value will be one more than + * bytes actually read. + */ +int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); + /** * Read a UTF-16 string from pb and convert it to UTF-8. * The reading will terminate when either a null or invalid character was diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 3f3721c58b..5b2f9c0fe7 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -705,6 +705,23 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen) return i; } +int avio_get_str(AVIOContext *s, int maxlen, char *buf, int buflen) +{ + int i; + + // reserve 1 byte for terminating 0 + buflen = FFMIN(buflen - 1, maxlen); + for (i = 0; i < buflen; i++) + if (!(buf[i] = avio_r8(s))) + return i + 1; + if (buflen) + buf[i] = 0; + for (; i < maxlen; i++) + if (!avio_r8(s)) + return i + 1; + return maxlen; +} + #define GET_STR16(type, read) \ int avio_get_str16 ##type(AVIOContext *pb, int maxlen, char *buf, int buflen)\ {\ From e16ead0716c2f988d1e26369a4c67b354ff86134 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 2 Mar 2011 17:48:45 +0100 Subject: [PATCH 497/528] lavf: deprecate get_strz() in favor of avio_get_str Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 7 ++++++- libavformat/aviobuf.c | 13 +++---------- libavformat/cafdec.c | 4 ++-- libavformat/ffmdec.c | 3 ++- libavformat/mov.c | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index fd4839c789..fba98e318f 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -548,7 +548,12 @@ int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); -char *get_strz(AVIOContext *s, char *buf, int maxlen); +#if FF_API_OLD_AVIO +/** + * @deprecated use avio_get_str instead + */ +attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen); +#endif unsigned int avio_rb16(AVIOContext *s); unsigned int avio_rb24(AVIOContext *s); unsigned int avio_rb32(AVIOContext *s); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 5b2f9c0fe7..9807c467d4 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -675,20 +675,13 @@ unsigned int avio_rb32(AVIOContext *s) return val; } +#if FF_API_OLD_AVIO char *get_strz(AVIOContext *s, char *buf, int maxlen) { - int i = 0; - char c; - - while ((c = avio_r8(s))) { - if (i < maxlen-1) - buf[i++] = c; - } - - buf[i] = 0; /* Ensure null terminated, but may be truncated */ - + avio_get_str(s, INT_MAX, buf, maxlen); return buf; } +#endif int ff_get_line(AVIOContext *s, char *buf, int maxlen) { diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index d98c4bf095..a43c34496b 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -185,8 +185,8 @@ static void read_info_chunk(AVFormatContext *s, int64_t size) for (i = 0; i < nb_entries; i++) { char key[32]; char value[1024]; - get_strz(pb, key, sizeof(key)); - get_strz(pb, value, sizeof(value)); + avio_get_str(pb, INT_MAX, key, sizeof(key)); + avio_get_str(pb, INT_MAX, value, sizeof(value)); av_metadata_set2(&s->metadata, key, value, 0); } } diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index bcfc1658e2..7dd567ed7f 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -325,7 +325,8 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) codec->qcompress = avio_rb16(pb) / 10000.0; codec->qblur = avio_rb16(pb) / 10000.0; codec->bit_rate_tolerance = avio_rb32(pb); - codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf))); + avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf)); + codec->rc_eq = av_strdup(rc_eq_buf); codec->rc_max_rate = avio_rb32(pb); codec->rc_min_rate = avio_rb32(pb); codec->rc_buffer_size = avio_rb32(pb); diff --git a/libavformat/mov.c b/libavformat/mov.c index 537b9c6fb4..ad5bada180 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2331,7 +2331,7 @@ static void mov_read_chapters(AVFormatContext *s) avio_get_str16le(sc->pb, len, title, title_len); else { AV_WB16(title, ch); - get_strz(sc->pb, title + 2, len - 1); + avio_get_str(sc->pb, len - 2, title + 2, title_len - 2); } ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title); From a2704c9712ad35cc22e7e0d8a79b581c07fa383b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Mar 2011 20:11:45 +0100 Subject: [PATCH 498/528] avio: add avio_tell macro as a replacement for url_ftell Signed-off-by: Ronald S. Bultje --- ffmpeg.c | 4 +- ffplay.c | 2 +- libavformat/4xm.c | 2 +- libavformat/aiffdec.c | 6 +-- libavformat/aiffenc.c | 8 ++-- libavformat/amr.c | 2 +- libavformat/anm.c | 2 +- libavformat/asfdec.c | 36 +++++++++--------- libavformat/asfenc.c | 20 +++++----- libavformat/au.c | 2 +- libavformat/avidec.c | 32 ++++++++-------- libavformat/avienc.c | 16 ++++---- libavformat/avio.h | 3 +- libavformat/aviobuf.c | 2 +- libavformat/avs.c | 4 +- libavformat/bethsoftvid.c | 2 +- libavformat/cafdec.c | 12 +++--- libavformat/dv.c | 4 +- libavformat/dxa.c | 14 +++---- libavformat/electronicarts.c | 2 +- libavformat/ffmdec.c | 14 +++---- libavformat/ffmenc.c | 4 +- libavformat/filmstripdec.c | 2 +- libavformat/flacenc.c | 2 +- libavformat/flic.c | 4 +- libavformat/flvdec.c | 12 +++--- libavformat/flvenc.c | 14 +++---- libavformat/gxf.c | 6 +-- libavformat/gxfenc.c | 44 ++++++++++----------- libavformat/id3v2.c | 4 +- libavformat/idroqdec.c | 4 +- libavformat/iff.c | 6 +-- libavformat/ingenientdec.c | 2 +- libavformat/ipmovie.c | 10 ++--- libavformat/iss.c | 4 +- libavformat/libnut.c | 2 +- libavformat/matroskadec.c | 16 ++++---- libavformat/matroskaenc.c | 40 +++++++++---------- libavformat/mmf.c | 8 ++-- libavformat/mov.c | 26 ++++++------- libavformat/movenc.c | 74 ++++++++++++++++++------------------ libavformat/movenchint.c | 8 ++-- libavformat/mp3dec.c | 2 +- libavformat/mp3enc.c | 4 +- libavformat/mpc.c | 4 +- libavformat/mpc8.c | 16 ++++---- libavformat/mpeg.c | 10 ++--- libavformat/mpegts.c | 14 +++---- libavformat/mpegtsenc.c | 2 +- libavformat/mtv.c | 2 +- libavformat/mxfdec.c | 12 +++--- libavformat/mxfenc.c | 20 +++++----- libavformat/nsvdec.c | 8 ++-- libavformat/nutdec.c | 32 ++++++++-------- libavformat/nutenc.c | 6 +-- libavformat/nuv.c | 2 +- libavformat/oggdec.c | 6 +-- libavformat/oggenc.c | 4 +- libavformat/psxstr.c | 2 +- libavformat/pva.c | 4 +- libavformat/qcp.c | 2 +- libavformat/r3d.c | 12 +++--- libavformat/rawdec.c | 2 +- libavformat/rdt.c | 2 +- libavformat/riff.c | 4 +- libavformat/rmdec.c | 24 ++++++------ libavformat/rsoenc.c | 2 +- libavformat/rtpdec_asf.c | 12 +++--- libavformat/rtpdec_qt.c | 14 +++---- libavformat/seek.c | 2 +- libavformat/segafilm.c | 4 +- libavformat/sierravmd.c | 2 +- libavformat/smacker.c | 8 ++-- libavformat/soxenc.c | 2 +- libavformat/spdifdec.c | 2 +- libavformat/srtdec.c | 2 +- libavformat/swfdec.c | 2 +- libavformat/swfenc.c | 10 ++--- libavformat/tta.c | 6 +-- libavformat/tty.c | 2 +- libavformat/utils.c | 6 +-- libavformat/vocdec.c | 2 +- libavformat/vqf.c | 2 +- libavformat/wav.c | 10 ++--- libavformat/wtv.c | 4 +- libavformat/wv.c | 10 ++--- libavformat/yop.c | 2 +- 87 files changed, 392 insertions(+), 391 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index e3dda9de1c..814b4977d6 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1352,7 +1352,7 @@ static void print_report(AVFormatContext **output_files, total_size = url_fsize(oc->pb); if(total_size<0) // FIXME improve url_fsize() so it works with non seekable output too - total_size= url_ftell(oc->pb); + total_size= avio_tell(oc->pb); buf[0] = '\0'; ti1 = 1e10; @@ -2555,7 +2555,7 @@ static int transcode(AVFormatContext **output_files, } /* finish if limit size exhausted */ - if (limit_filesize != 0 && limit_filesize <= url_ftell(output_files[0]->pb)) + if (limit_filesize != 0 && limit_filesize <= avio_tell(output_files[0]->pb)) break; /* read a frame from it and output it in the fifo */ diff --git a/ffplay.c b/ffplay.c index e71c9c932d..edc59380b6 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2805,7 +2805,7 @@ static void event_loop(void) }else if(cur_stream->audio_stream >= 0 && cur_stream->audio_pkt.pos>=0){ pos= cur_stream->audio_pkt.pos; }else - pos = url_ftell(cur_stream->ic->pb); + pos = avio_tell(cur_stream->ic->pb); if (cur_stream->ic->bit_rate) incr *= cur_stream->ic->bit_rate / 8.0; else diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 2757e89269..ed722805b2 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -283,7 +283,7 @@ static int fourxm_read_packet(AVFormatContext *s, return AVERROR(EIO); pkt->stream_index = fourxm->video_stream_index; pkt->pts = fourxm->video_pts; - pkt->pos = url_ftell(s->pb); + pkt->pos = avio_tell(s->pb); memcpy(pkt->data, header, 8); ret = avio_read(s->pb, &pkt->data[8], size); diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 849793a14b..9e3d39c371 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -232,10 +232,10 @@ static int aiff_read_header(AVFormatContext *s, get_meta(s, "comment" , size); break; case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */ - aiff->data_end = url_ftell(pb) + size; + aiff->data_end = avio_tell(pb) + size; offset = avio_rb32(pb); /* Offset of sound data */ avio_rb32(pb); /* BlockSize... don't care */ - offset += url_ftell(pb); /* Compute absolute data offset */ + offset += avio_tell(pb); /* Compute absolute data offset */ if (st->codec->block_align) /* Assume COMM already parsed */ goto got_sound; if (url_is_streamed(pb)) { @@ -292,7 +292,7 @@ static int aiff_read_packet(AVFormatContext *s, int res, size; /* calculate size of remaining data */ - max_size = aiff->data_end - url_ftell(s->pb); + max_size = aiff->data_end - avio_tell(s->pb); if (max_size <= 0) return AVERROR_EOF; diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index 150f36bdc0..3e5936248c 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -45,7 +45,7 @@ static int aiff_write_header(AVFormatContext *s) /* FORM AIFF header */ ffio_wfourcc(pb, "FORM"); - aiff->form = url_ftell(pb); + aiff->form = avio_tell(pb); avio_wb32(pb, 0); /* file length */ ffio_wfourcc(pb, aifc ? "AIFC" : "AIFF"); @@ -66,7 +66,7 @@ static int aiff_write_header(AVFormatContext *s) avio_wb32(pb, aifc ? 24 : 18); /* size */ avio_wb16(pb, enc->channels); /* Number of channels */ - aiff->frames = url_ftell(pb); + aiff->frames = avio_tell(pb); avio_wb32(pb, 0); /* Number of frames */ if (!enc->bits_per_coded_sample) @@ -90,7 +90,7 @@ static int aiff_write_header(AVFormatContext *s) /* Sound data chunk */ ffio_wfourcc(pb, "SSND"); - aiff->ssnd = url_ftell(pb); /* Sound chunk size */ + aiff->ssnd = avio_tell(pb); /* Sound chunk size */ avio_wb32(pb, 0); /* Sound samples data size */ avio_wb32(pb, 0); /* Data offset */ avio_wb32(pb, 0); /* Block-size (block align) */ @@ -118,7 +118,7 @@ static int aiff_write_trailer(AVFormatContext *s) /* Chunks sizes must be even */ int64_t file_size, end_size; - end_size = file_size = url_ftell(pb); + end_size = file_size = avio_tell(pb); if (file_size & 1) { avio_w8(pb, 0); end_size++; diff --git a/libavformat/amr.c b/libavformat/amr.c index fd43283a22..9d6581dee5 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -154,7 +154,7 @@ static int amr_read_packet(AVFormatContext *s, } pkt->stream_index = 0; - pkt->pos= url_ftell(s->pb); + pkt->pos= avio_tell(s->pb); pkt->data[0]=toc; pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320; read = avio_read(s->pb, pkt->data+1, size-1); diff --git a/libavformat/anm.c b/libavformat/anm.c index 060cc9a086..2a0109d1de 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -208,7 +208,7 @@ repeat: } /* fetch record size */ - tmp = url_ftell(pb); + tmp = avio_tell(pb); avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) + 8 + anm->record * 2, SEEK_SET); record_size = avio_rl16(pb); diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 85761a3fd4..e3a38073e8 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -160,7 +160,7 @@ static int get_value(AVIOContext *pb, int type){ static void get_tag(AVFormatContext *s, const char *key, int type, int len) { char *value; - int64_t off = url_ftell(s->pb); + int64_t off = avio_tell(s->pb); if ((unsigned)len >= (UINT_MAX - 1)/2) return; @@ -226,7 +226,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) return AVERROR(EINVAL); } - pos1 = url_ftell(pb); + pos1 = avio_tell(pb); st = av_new_stream(s, 0); if (!st) @@ -301,7 +301,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) st->need_parsing = AVSTREAM_PARSE_FULL; } /* We have to init the frame size at some point .... */ - pos2 = url_ftell(pb); + pos2 = avio_tell(pb); if (size >= (pos2 + 8 - pos1 + 24)) { asf_st->ds_span = avio_r8(pb); asf_st->ds_packet_size = avio_rl16(pb); @@ -338,7 +338,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) break; } } else if (type == AVMEDIA_TYPE_VIDEO && - size - (url_ftell(pb) - pos1 + 24) >= 51) { + size - (avio_tell(pb) - pos1 + 24) >= 51) { avio_rl32(pb); avio_rl32(pb); avio_r8(pb); @@ -387,7 +387,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) if(st->codec->codec_id == CODEC_ID_H264) st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; } - pos2 = url_ftell(pb); + pos2 = avio_tell(pb); avio_seek(pb, size - (pos2 - pos1 + 24), SEEK_CUR); return 0; @@ -595,14 +595,14 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_r8(pb); memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid)); for(;;) { - uint64_t gpos= url_ftell(pb); + uint64_t gpos= avio_tell(pb); ff_get_guid(pb, &g); gsize = avio_rl64(pb); av_dlog(s, "%08"PRIx64": ", gpos); print_guid(&g); av_dlog(s, " size=0x%"PRIx64"\n", gsize); if (!ff_guidcmp(&g, &ff_asf_data_header)) { - asf->data_object_offset = url_ftell(pb); + asf->data_object_offset = avio_tell(pb); // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. if (!(asf->hdr.flags & 0x01) && gsize >= 100) { asf->data_object_size = gsize - 24; @@ -652,8 +652,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) } } } - if(url_ftell(pb) != gpos + gsize) - av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", url_ftell(pb)-gpos, gsize); + if(avio_tell(pb) != gpos + gsize) + av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", avio_tell(pb)-gpos, gsize); avio_seek(pb, gpos + gsize, SEEK_SET); } ff_get_guid(pb, &g); @@ -662,7 +662,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_r8(pb); if (url_feof(pb)) return -1; - asf->data_offset = url_ftell(pb); + asf->data_offset = avio_tell(pb); asf->packet_size_left = 0; @@ -726,7 +726,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) // if we do not know packet size, allow skipping up to 32 kB off= 32768; if (s->packet_size > 0) - off= (url_ftell(pb) - s->data_offset) % s->packet_size + 3; + off= (avio_tell(pb) - s->data_offset) % s->packet_size + 3; c=d=e=-1; while(off-- > 0){ @@ -746,7 +746,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) if (url_ferror(pb) == AVERROR(EAGAIN)) return AVERROR(EAGAIN); if (!url_feof(pb)) - av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, url_ftell(pb)); + av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb)); } if ((c & 0x8f) == 0x82) { if (d || e) { @@ -770,11 +770,11 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) //the following checks prevent overflows and infinite loops if(!packet_length || packet_length >= (1U<<29)){ - av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, url_ftell(pb)); + av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, avio_tell(pb)); return -1; } if(padsize >= packet_length){ - av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, url_ftell(pb)); + av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, avio_tell(pb)); return -1; } @@ -892,12 +892,12 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk || asf->packet_segments < 1) { //asf->packet_size_left <= asf->packet_padsize) { int ret = asf->packet_size_left + asf->packet_padsize; - //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb)); + //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb)); assert(ret>=0); /* fail safe */ avio_seek(pb, ret, SEEK_CUR); - asf->packet_pos= url_ftell(pb); + asf->packet_pos= avio_tell(pb); if (asf->data_object_size != (uint64_t)-1 && (asf->packet_pos - asf->data_object_offset >= asf->data_object_size)) return AVERROR_EOF; /* Do not exceed the size of the data object */ @@ -1185,7 +1185,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) { ff_asf_guid g; ASFContext *asf = s->priv_data; - int64_t current_pos= url_ftell(s->pb); + int64_t current_pos= avio_tell(s->pb); int i; avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET); @@ -1268,7 +1268,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int // avio_seek(s->pb, pos, SEEK_SET); // key_pos = pos; // for(i=0;i<16;i++){ - // pos = url_ftell(s->pb); + // pos = avio_tell(s->pb); // if (av_read_frame(s, &pkt) < 0){ // av_log(s, AV_LOG_INFO, "seek failed\n"); // return -1; diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 267f9b3d49..3a06044036 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -248,7 +248,7 @@ static int64_t put_header(AVIOContext *pb, const ff_asf_guid *g) { int64_t pos; - pos = url_ftell(pb); + pos = avio_tell(pb); put_guid(pb, g); avio_wl64(pb, 24); return pos; @@ -259,7 +259,7 @@ static void end_header(AVIOContext *pb, int64_t pos) { int64_t pos1; - pos1 = url_ftell(pb); + pos1 = avio_tell(pb); avio_seek(pb, pos + 16, SEEK_SET); avio_wl64(pb, pos1 - pos); avio_seek(pb, pos1, SEEK_SET); @@ -337,7 +337,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data avio_w8(pb, 2); /* ??? */ /* file header */ - header_offset = url_ftell(pb); + header_offset = avio_tell(pb); hpos = put_header(pb, &ff_asf_file_header); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, file_size); @@ -425,7 +425,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data put_guid(pb, &ff_asf_video_conceal_none); } avio_wl64(pb, 0); /* ??? */ - es_pos = url_ftell(pb); + es_pos = avio_tell(pb); avio_wl32(pb, extra_size); /* wav header len */ avio_wl32(pb, extra_size2); /* additional data len */ avio_wl16(pb, n + 1); /* stream number */ @@ -442,7 +442,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data if (wavsize < 0) return -1; if (wavsize != extra_size) { - cur_pos = url_ftell(pb); + cur_pos = avio_tell(pb); avio_seek(pb, es_pos, SEEK_SET); avio_wl32(pb, wavsize); /* wav header len */ avio_seek(pb, cur_pos, SEEK_SET); @@ -525,7 +525,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data /* patch the header size fields */ - cur_pos = url_ftell(pb); + cur_pos = avio_tell(pb); header_size = cur_pos - header_offset; if (asf->is_streamed) { header_size += 8 + 30 + 50; @@ -605,7 +605,7 @@ static int put_payload_parsing_info( ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; int ppi_size, i; - int64_t start= url_ftell(pb); + int64_t start= avio_tell(pb); int iLengthTypeFlags = ASF_PPI_LENGTH_TYPE_FLAGS; @@ -642,7 +642,7 @@ static int put_payload_parsing_info( if (asf->multi_payloads_present) avio_w8(pb, nb_payloads | ASF_PAYLOAD_FLAGS); - ppi_size = url_ftell(pb) - start; + ppi_size = avio_tell(pb) - start; return ppi_size; } @@ -860,7 +860,7 @@ static int asf_write_trailer(AVFormatContext *s) flush_packet(s); /* write index */ - data_size = url_ftell(s->pb); + data_size = avio_tell(s->pb); if ((!asf->is_streamed) && (asf->nb_index_count != 0)) { asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count); } @@ -870,7 +870,7 @@ static int asf_write_trailer(AVFormatContext *s) put_chunk(s, 0x4524, 0, 0); /* end of stream */ } else { /* rewrite an updated header */ - file_size = url_ftell(s->pb); + file_size = avio_tell(s->pb); avio_seek(s->pb, 0, SEEK_SET); asf_write_header1(s, file_size, data_size - asf->data_offset); } diff --git a/libavformat/au.c b/libavformat/au.c index 16b33e78c7..9ea4010039 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -94,7 +94,7 @@ static int au_write_trailer(AVFormatContext *s) if (!url_is_streamed(s->pb)) { /* update file size */ - file_size = url_ftell(pb); + file_size = avio_tell(pb); avio_seek(pb, 8, SEEK_SET); avio_wb32(pb, (uint32_t)(file_size - 24)); avio_seek(pb, file_size, SEEK_SET); diff --git a/libavformat/avidec.c b/libavformat/avidec.c index e8bcebc7e5..79e86ad613 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -109,7 +109,7 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) /* check RIFF header */ avio_read(pb, header, 4); avi->riff_end = avio_rl32(pb); /* RIFF chunk size */ - avi->riff_end += url_ftell(pb); /* RIFF chunk end */ + avi->riff_end += avio_tell(pb); /* RIFF chunk end */ avio_read(pb, header+4, 4); for(i=0; avi_headers[i][0]; i++) @@ -198,7 +198,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ if(url_feof(pb)) return -1; - pos = url_ftell(pb); + pos = avio_tell(pb); if(avi->odml_depth > MAX_ODML_DEPTH){ av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n"); @@ -267,7 +267,7 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t static void avi_read_info(AVFormatContext *s, uint64_t end) { - while (url_ftell(s->pb) < end) { + while (avio_tell(s->pb) < end) { uint32_t tag = avio_rl32(s->pb); uint32_t size = avio_rl32(s->pb); avi_read_tag(s, NULL, tag, size); @@ -298,13 +298,13 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date) static void avi_read_nikon(AVFormatContext *s, uint64_t end) { - while (url_ftell(s->pb) < end) { + while (avio_tell(s->pb) < end) { uint32_t tag = avio_rl32(s->pb); uint32_t size = avio_rl32(s->pb); switch (tag) { case MKTAG('n', 'c', 't', 'g'): { /* Nikon Tags */ - uint64_t tag_end = url_ftell(s->pb) + size; - while (url_ftell(s->pb) < tag_end) { + uint64_t tag_end = avio_tell(s->pb) + size; + while (avio_tell(s->pb) < tag_end) { uint16_t tag = avio_rl16(s->pb); uint16_t size = avio_rl16(s->pb); const char *name = NULL; @@ -369,14 +369,14 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) switch(tag) { case MKTAG('L', 'I', 'S', 'T'): - list_end = url_ftell(pb) + size; + list_end = avio_tell(pb) + size; /* Ignored, except at start of video packets. */ tag1 = avio_rl32(pb); print_tag("list", tag1, 0); if (tag1 == MKTAG('m', 'o', 'v', 'i')) { - avi->movi_list = url_ftell(pb) - 4; + avi->movi_list = avio_tell(pb) - 4; if(size) avi->movi_end = avi->movi_list + size + (size & 1); else avi->movi_end = url_fsize(pb); av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); @@ -549,7 +549,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { avio_seek(pb, size, SEEK_CUR); } else { - uint64_t cur_pos = url_ftell(pb); + uint64_t cur_pos = avio_tell(pb); if (cur_pos < list_end) size = FFMIN(size, list_end - cur_pos); st = s->streams[stream_index]; @@ -664,7 +664,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } break; case MKTAG('i', 'n', 'd', 'x'): - i= url_ftell(pb); + i= avio_tell(pb); if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){ read_braindead_odml_indx(s, 0); } @@ -704,7 +704,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if(size > 1000000){ av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, " "I will ignore it and try to continue anyway.\n"); - avi->movi_list = url_ftell(pb) - 4; + avi->movi_list = avio_tell(pb) - 4; avi->movi_end = url_fsize(pb); goto end_of_header; } @@ -923,7 +923,7 @@ resync: if(size > ast->remaining) size= ast->remaining; - avi->last_pkt_pos= url_ftell(pb); + avi->last_pkt_pos= avio_tell(pb); err= av_get_packet(pb, pkt, size); if(err<0) return err; @@ -989,7 +989,7 @@ resync: } memset(d, -1, sizeof(int)*8); - for(i=sync=url_ftell(pb); !url_feof(pb); i++) { + for(i=sync=avio_tell(pb); !url_feof(pb); i++) { int j; for(j=0; j<7; j++) @@ -1092,7 +1092,7 @@ resync: ast->remaining= size; if(size || !ast->sample_size){ - uint64_t pos= url_ftell(pb) - 8; + uint64_t pos= avio_tell(pb) - 8; if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){ av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME); } @@ -1162,7 +1162,7 @@ static int guess_ni_flag(AVFormatContext *s){ int i; int64_t last_start=0; int64_t first_end= INT64_MAX; - int64_t oldpos= url_ftell(s->pb); + int64_t oldpos= avio_tell(s->pb); for(i=0; inb_streams; i++){ AVStream *st = s->streams[i]; @@ -1194,7 +1194,7 @@ static int avi_load_index(AVFormatContext *s) AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; uint32_t tag, size; - int64_t pos= url_ftell(pb); + int64_t pos= avio_tell(pb); int ret = -1; if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 5aab1925be..8d9980cf46 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -124,7 +124,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) int64_t file_size; AVCodecContext* stream; - file_size = url_ftell(pb); + file_size = avio_tell(pb); for(n = 0; n < s->nb_streams; n++) { AVIStream *avist= s->streams[n]->priv_data; @@ -201,7 +201,7 @@ static int avi_write_header(AVFormatContext *s) avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ else avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ - avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */ + avi->frames_hdr_all = avio_tell(pb); /* remember this offset to fill later */ avio_wl32(pb, nb_frames); /* nb frames, filled later */ avio_wl32(pb, 0); /* initial frame */ avio_wl32(pb, s->nb_streams); /* nb streams */ @@ -258,7 +258,7 @@ static int avi_write_header(AVFormatContext *s) av_set_pts_info(s->streams[i], 64, au_scale, au_byterate); avio_wl32(pb, 0); /* start */ - avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */ + avist->frames_hdr_strm = avio_tell(pb); /* remember this offset to fill later */ if (url_is_streamed(pb)) avio_wl32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ else @@ -419,7 +419,7 @@ static int avi_write_ix(AVFormatContext *s) ix_tag[3] = '0' + i; /* Writing AVI OpenDML leaf index chunk */ - ix = url_ftell(pb); + ix = avio_tell(pb); ffio_wfourcc(pb, ix_tag); /* ix?? */ avio_wl32(pb, avist->indexes.entry * 8 + 24); /* chunk size */ @@ -439,7 +439,7 @@ static int avi_write_ix(AVFormatContext *s) (ie->flags & 0x10 ? 0 : 0x80000000)); } put_flush_packet(pb); - pos = url_ftell(pb); + pos = avio_tell(pb); /* Updating one entry in the AVI OpenDML master index */ avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET); @@ -533,7 +533,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) // Make sure to put an OpenDML chunk when the file size exceeds the limits if (!url_is_streamed(pb) && - (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) { + (avio_tell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) { avi_write_ix(s); ff_end_tag(pb, avi->movi_list); @@ -567,7 +567,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) } idx->cluster[cl][id].flags = flags; - idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list; + idx->cluster[cl][id].pos = avio_tell(pb) - avi->movi_list; idx->cluster[cl][id].len = size; idx->entry++; } @@ -600,7 +600,7 @@ static int avi_write_trailer(AVFormatContext *s) ff_end_tag(pb, avi->movi_list); ff_end_tag(pb, avi->riff_start); - file_size = url_ftell(pb); + file_size = avio_tell(pb); avio_seek(pb, avi->odml_list - 8, SEEK_SET); ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */ avio_seek(pb, 16, SEEK_CUR); diff --git a/libavformat/avio.h b/libavformat/avio.h index fba98e318f..be15f8acb6 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -422,6 +422,7 @@ attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags) attribute_deprecated int url_fclose(AVIOContext *s); attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset); +attribute_deprecated int64_t url_ftell(AVIOContext *s); /** * @} */ @@ -473,7 +474,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); * ftell() equivalent for AVIOContext. * @return position or AVERROR. */ -int64_t url_ftell(AVIOContext *s); +#define avio_tell(s) avio_seek((s), 0, SEEK_CUR) /** * Get the filesize. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 9807c467d4..e273aa536a 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -239,12 +239,12 @@ int url_fskip(AVIOContext *s, int64_t offset) int64_t ret = avio_seek(s, offset, SEEK_CUR); return ret < 0 ? ret : 0; } -#endif int64_t url_ftell(AVIOContext *s) { return avio_seek(s, 0, SEEK_CUR); } +#endif int64_t url_fsize(AVIOContext *s) { diff --git a/libavformat/avs.c b/libavformat/avs.c index 476c0a9af9..0ddb0af06d 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -123,9 +123,9 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt) AvsFormat *avs = s->priv_data; int ret, size; - size = url_ftell(s->pb); + size = avio_tell(s->pb); ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size); - size = url_ftell(s->pb) - size; + size = avio_tell(s->pb) - size; avs->remaining_audio_size -= size; if (ret == AVERROR(EIO)) diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 00b3ea2ae3..7987e8e6f6 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -112,7 +112,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, return AVERROR(ENOMEM); // save the file position for the packet, include block type - position = url_ftell(pb) - 1; + position = avio_tell(pb) - 1; vidbuf_start[vidbuf_nbytes++] = block_type; diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index a43c34496b..bc0a7760ea 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -106,9 +106,9 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) int strt, skip; MOVAtom atom; - strt = url_ftell(pb); + strt = avio_tell(pb); ff_mov_read_esds(s, pb, atom); - skip = size - (url_ftell(pb) - strt); + skip = size - (avio_tell(pb) - strt); if (skip < 0 || !st->codec->extradata || st->codec->codec_id != CODEC_ID_AAC) { av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n"); @@ -150,7 +150,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) int64_t pos = 0, ccount; int num_packets, i; - ccount = url_ftell(pb); + ccount = avio_tell(pb); num_packets = avio_rb64(pb); if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets) @@ -167,7 +167,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb); } - if (url_ftell(pb) - ccount != size) { + if (avio_tell(pb) - ccount != size) { av_log(s, AV_LOG_ERROR, "error reading packet table\n"); return -1; } @@ -234,7 +234,7 @@ static int read_header(AVFormatContext *s, switch (tag) { case MKBETAG('d','a','t','a'): avio_seek(pb, 4, SEEK_CUR); /* edit count */ - caf->data_start = url_ftell(pb); + caf->data_start = avio_tell(pb); caf->data_size = size < 0 ? -1 : size - 4; if (caf->data_size > 0 && !url_is_streamed(pb)) avio_seek(pb, caf->data_size, SEEK_CUR); @@ -312,7 +312,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) /* don't read past end of data chunk */ if (caf->data_size > 0) { - left = (caf->data_start + caf->data_size) - url_ftell(pb); + left = (caf->data_start + caf->data_size) - avio_tell(pb); if (left <= 0) return AVERROR(EIO); } diff --git a/libavformat/dv.c b/libavformat/dv.c index cdc5f76923..4e256d7d39 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -417,8 +417,8 @@ static int dv_read_header(AVFormatContext *s, return -1; } if (state == 0x003f0700 || state == 0xff3f0700) - marker_pos = url_ftell(s->pb); - if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) { + marker_pos = avio_tell(s->pb); + if (state == 0xff3f0701 && avio_tell(s->pb) - marker_pos == 80) { avio_seek(s->pb, -163, SEEK_CUR); state = avio_rb32(s->pb); break; diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 695ca959e1..de72792372 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -95,7 +95,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) uint32_t size, fsize; c->has_sound = 1; size = avio_rb32(pb); - c->vidpos = url_ftell(pb) + size; + c->vidpos = avio_tell(pb) + size; avio_seek(pb, 16, SEEK_CUR); fsize = avio_rl32(pb); @@ -104,7 +104,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; ff_get_wav_header(pb, ast->codec, fsize); // find 'data' chunk - while(url_ftell(pb) < c->vidpos && !url_feof(pb)){ + while(avio_tell(pb) < c->vidpos && !url_feof(pb)){ tag = avio_rl32(pb); fsize = avio_rl32(pb); if(tag == MKTAG('d', 'a', 't', 'a')) break; @@ -114,7 +114,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) if(ast->codec->block_align) c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align; c->bytes_left = fsize; - c->wavpos = url_ftell(pb); + c->wavpos = avio_tell(pb); avio_seek(pb, c->vidpos, SEEK_SET); } @@ -133,7 +133,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height >>= 1; } c->readvid = !c->has_sound; - c->vidpos = url_ftell(pb); + c->vidpos = avio_tell(pb); s->start_time = 0; s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den; av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames); @@ -158,7 +158,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(ret != size) return AVERROR(EIO); c->bytes_left -= size; - c->wavpos = url_ftell(s->pb); + c->wavpos = avio_tell(s->pb); return 0; } avio_seek(s->pb, c->vidpos, SEEK_SET); @@ -172,7 +172,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(pal_size) memcpy(pkt->data, pal, pal_size); memcpy(pkt->data + pal_size, buf, 4); c->frames--; - c->vidpos = url_ftell(s->pb); + c->vidpos = avio_tell(s->pb); c->readvid = 0; return 0; case MKTAG('C', 'M', 'A', 'P'): @@ -198,7 +198,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(pal_size) memcpy(pkt->data, pal, pal_size); pkt->stream_index = 0; c->frames--; - c->vidpos = url_ftell(s->pb); + c->vidpos = avio_tell(s->pb); c->readvid = 0; return 0; default: diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index cd3c33801a..4abf0223e2 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -293,7 +293,7 @@ static int process_ea_header(AVFormatContext *s) { int i; for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) { - unsigned int startpos = url_ftell(pb); + unsigned int startpos = avio_tell(pb); int err = 0; blockid = avio_rl32(pb); diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 7dd567ed7f..2977527b97 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -65,7 +65,7 @@ static int ffm_is_avail_data(AVFormatContext *s, int size) len = ffm->packet_end - ffm->packet_ptr; if (size <= len) return 1; - pos = url_ftell(s->pb); + pos = avio_tell(s->pb); if (!ffm->write_index) { if (pos == ffm->file_size) return AVERROR_EOF; @@ -117,7 +117,7 @@ static int ffm_read_data(AVFormatContext *s, if (len > size) len = size; if (len == 0) { - if (url_ftell(pb) == ffm->file_size) + if (avio_tell(pb) == ffm->file_size) avio_seek(pb, ffm->packet_size, SEEK_SET); retry_read: id = avio_rb16(pb); /* PACKET_ID */ @@ -136,7 +136,7 @@ static int ffm_read_data(AVFormatContext *s, if (ffm->first_packet || (frame_offset & 0x8000)) { if (!frame_offset) { /* This packet has no frame headers in it */ - if (url_ftell(pb) >= ffm->packet_size * 3) { + if (avio_tell(pb) >= ffm->packet_size * 3) { avio_seek(pb, -ffm->packet_size * 2, SEEK_CUR); goto retry_read; } @@ -203,7 +203,7 @@ static void adjust_write_index(AVFormatContext *s) //int64_t orig_write_index = ffm->write_index; int64_t pos_min, pos_max; int64_t pts_start; - int64_t ptr = url_ftell(pb); + int64_t ptr = avio_tell(pb); pos_min = 0; @@ -381,7 +381,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) } /* get until end of block reached */ - while ((url_ftell(pb) % ffm->packet_size) != 0) + while ((avio_tell(pb) % ffm->packet_size) != 0) avio_r8(pb); /* init packet demux */ @@ -410,7 +410,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; av_dlog(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n", - url_ftell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size); + avio_tell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size); if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) != FRAME_HEADER_SIZE) return -1; @@ -437,7 +437,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) ffm->read_state = READ_HEADER; return -1; } - pkt->pos = url_ftell(s->pb); + pkt->pos = avio_tell(s->pb); if (ffm->header[1] & FLAG_KEY_FRAME) pkt->flags |= AV_PKT_FLAG_KEY; diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index eeaaa22945..e648393c89 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -32,7 +32,7 @@ static void flush_packet(AVFormatContext *s) fill_size = ffm->packet_end - ffm->packet_ptr; memset(ffm->packet_ptr, 0, fill_size); - if (url_ftell(pb) % ffm->packet_size) + if (avio_tell(pb) % ffm->packet_size) av_abort(); /* put header */ @@ -184,7 +184,7 @@ static int ffm_write_header(AVFormatContext *s) } /* flush until end of block reached */ - while ((url_ftell(pb) % ffm->packet_size) != 0) + while ((avio_tell(pb) % ffm->packet_size) != 0) avio_w8(pb, 0); put_flush_packet(pb); diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index a987b93baf..1741d57d30 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -82,7 +82,7 @@ static int read_packet(AVFormatContext *s, if (url_feof(s->pb)) return AVERROR(EIO); - pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); + pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); avio_seek(s->pb, st->codec->width * film->leading * 4, SEEK_CUR); if (pkt->size < 0) diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index cfd9e09499..079e6dd713 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -100,7 +100,7 @@ static int flac_write_trailer(struct AVFormatContext *s) if (!url_is_streamed(pb)) { /* rewrite the STREAMINFO header block data */ - file_size = url_ftell(pb); + file_size = avio_tell(pb); avio_seek(pb, 8, SEEK_SET); avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); avio_seek(pb, file_size, SEEK_SET); diff --git a/libavformat/flic.c b/libavformat/flic.c index cdbd9c80eb..520ba6423e 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -223,7 +223,7 @@ static int flic_read_packet(AVFormatContext *s, } pkt->stream_index = flic->video_stream_index; pkt->pts = flic->frame_number++; - pkt->pos = url_ftell(pb); + pkt->pos = avio_tell(pb); memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE); ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE, size - FLIC_PREAMBLE_SIZE); @@ -242,7 +242,7 @@ static int flic_read_packet(AVFormatContext *s, avio_seek(pb, 10, SEEK_CUR); pkt->stream_index = flic->audio_stream_index; - pkt->pos = url_ftell(pb); + pkt->pos = avio_tell(pb); ret = avio_read(pb, pkt->data, size); if (ret != size) { diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 3b30c7f200..6113d951bf 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -148,7 +148,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst case AMF_DATA_TYPE_OBJECT: { unsigned int keylen; - while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) { + while(avio_tell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) { avio_seek(ioc, keylen, SEEK_CUR); //skip key string if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; //if we couldn't skip, bomb out. @@ -163,7 +163,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst break; //these take up no additional space case AMF_DATA_TYPE_MIXEDARRAY: avio_seek(ioc, 4, SEEK_CUR); //skip 32-bit max array index - while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) { + while(avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) { //this is the only case in which we would want a nested parse to not skip over the object if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) return -1; @@ -175,7 +175,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst unsigned int arraylen, i; arraylen = avio_rb32(ioc); - for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) { + for(i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) { if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; //if we couldn't skip, bomb out. } @@ -305,7 +305,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) AVStream *st = NULL; for(;;avio_seek(s->pb, 4, SEEK_CUR)){ /* pkt size is repeated at end. skip it */ - pos = url_ftell(s->pb); + pos = avio_tell(s->pb); type = avio_r8(s->pb); size = avio_rb24(s->pb); dts = avio_rb24(s->pb); @@ -319,7 +319,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) if(size == 0) continue; - next= size + url_ftell(s->pb); + next= size + avio_tell(s->pb); if (type == FLV_TAG_TYPE_AUDIO) { is_audio=1; @@ -372,7 +372,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) // if not streamed and no duration from metadata then seek to end to find the duration from the timestamps if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){ int size; - const int64_t pos= url_ftell(s->pb); + const int64_t pos= avio_tell(s->pb); const int64_t fsize= url_fsize(s->pb); avio_seek(s->pb, fsize-4, SEEK_SET); size= avio_rb32(s->pb); diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 7dd47da8a4..68da7f6907 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -221,7 +221,7 @@ static int flv_write_header(AVFormatContext *s) /* write meta_tag */ avio_w8(pb, 18); // tag type META - metadata_size_pos= url_ftell(pb); + metadata_size_pos= avio_tell(pb); avio_wb24(pb, 0); // size of data part (sum of all parts below) avio_wb24(pb, 0); // time stamp avio_wb32(pb, 0); // reserved @@ -237,7 +237,7 @@ static int flv_write_header(AVFormatContext *s) avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size put_amf_string(pb, "duration"); - flv->duration_offset= url_ftell(pb); + flv->duration_offset= avio_tell(pb); put_amf_double(pb, s->duration / AV_TIME_BASE); // fill in the guessed duration, it'll be corrected later if incorrect if(video_enc){ @@ -281,14 +281,14 @@ static int flv_write_header(AVFormatContext *s) } put_amf_string(pb, "filesize"); - flv->filesize_offset= url_ftell(pb); + flv->filesize_offset= avio_tell(pb); put_amf_double(pb, 0); // delayed write put_amf_string(pb, ""); avio_w8(pb, AMF_END_OF_OBJECT); /* write total size of tag */ - data_size= url_ftell(pb) - metadata_size_pos - 10; + data_size= avio_tell(pb) - metadata_size_pos - 10; avio_seek(pb, metadata_size_pos, SEEK_SET); avio_wb24(pb, data_size); avio_seek(pb, data_size + 10 - 3, SEEK_CUR); @@ -304,7 +304,7 @@ static int flv_write_header(AVFormatContext *s) avio_wb24(pb, 0); // ts avio_w8(pb, 0); // ts ext avio_wb24(pb, 0); // streamid - pos = url_ftell(pb); + pos = avio_tell(pb); if (enc->codec_id == CODEC_ID_AAC) { avio_w8(pb, get_audio_flags(enc)); avio_w8(pb, 0); // AAC sequence header @@ -315,7 +315,7 @@ static int flv_write_header(AVFormatContext *s) avio_wb24(pb, 0); // composition time ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size); } - data_size = url_ftell(pb) - pos; + data_size = avio_tell(pb) - pos; avio_seek(pb, -data_size - 10, SEEK_CUR); avio_wb24(pb, data_size); avio_seek(pb, data_size + 10 - 3, SEEK_CUR); @@ -343,7 +343,7 @@ static int flv_write_trailer(AVFormatContext *s) } } - file_size = url_ftell(pb); + file_size = avio_tell(pb); /* update informations */ avio_seek(pb, flv->duration_offset, SEEK_SET); diff --git a/libavformat/gxf.c b/libavformat/gxf.c index e2625f9d41..dc0272d5c3 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -396,7 +396,7 @@ start: READ_ONE(); if (tmp != 1) goto start; - last_pos = url_ftell(pb); + last_pos = avio_tell(pb); if (avio_seek(pb, -5, SEEK_CUR) < 0) goto out; if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) { @@ -407,7 +407,7 @@ start: avio_r8(pb); cur_track = avio_r8(pb); cur_timestamp = avio_rb32(pb); - last_found_pos = url_ftell(pb) - 16 - 6; + last_found_pos = avio_tell(pb) - 16 - 6; if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) { if (avio_seek(pb, last_pos, SEEK_SET) >= 0) goto start; @@ -511,7 +511,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, if (avio_seek(pb, *pos, SEEK_SET) < 0) return AV_NOPTS_VALUE; res = gxf_resync_media(s, pos_limit - *pos, -1, -1); - *pos = url_ftell(pb); + *pos = avio_tell(pb); return res; } diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 66accb3e08..ea9755fcd2 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -125,12 +125,12 @@ static int64_t updatePacketSize(AVIOContext *pb, int64_t pos) int64_t curpos; int size; - size = url_ftell(pb) - pos; + size = avio_tell(pb) - pos; if (size % 4) { gxf_write_padding(pb, 4 - size % 4); - size = url_ftell(pb) - pos; + size = avio_tell(pb) - pos; } - curpos = url_ftell(pb); + curpos = avio_tell(pb); avio_seek(pb, pos + 6, SEEK_SET); avio_wb32(pb, size); avio_seek(pb, curpos, SEEK_SET); @@ -141,7 +141,7 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos) { int64_t curpos; - curpos = url_ftell(pb); + curpos = avio_tell(pb); avio_seek(pb, pos, SEEK_SET); avio_wb16(pb, curpos - pos - 2); avio_seek(pb, curpos, SEEK_SET); @@ -218,7 +218,7 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, avio_w8(pb, sc->media_type + 0x80); avio_w8(pb, index + 0xC0); - pos = url_ftell(pb); + pos = avio_tell(pb); avio_wb16(pb, 0); /* size */ /* media file name */ @@ -272,7 +272,7 @@ static int gxf_write_material_data_section(AVFormatContext *s) int len; const char *filename = strrchr(s->filename, '/'); - pos = url_ftell(pb); + pos = avio_tell(pb); avio_wb16(pb, 0); /* size */ /* name */ @@ -322,7 +322,7 @@ static int gxf_write_track_description_section(AVFormatContext *s) int64_t pos; int i; - pos = url_ftell(pb); + pos = avio_tell(pb); avio_wb16(pb, 0); /* size */ for (i = 0; i < s->nb_streams; ++i) gxf_write_track_description(s, s->streams[i]->priv_data, i); @@ -336,7 +336,7 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite) { GXFContext *gxf = s->priv_data; AVIOContext *pb = s->pb; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); if (!rewrite) { if (!(gxf->map_offsets_nb % 30)) { @@ -366,7 +366,7 @@ static int gxf_write_flt_packet(AVFormatContext *s) { GXFContext *gxf = s->priv_data; AVIOContext *pb = s->pb; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1; int flt_entries = gxf->nb_fields / fields_per_flt; int i = 0; @@ -442,7 +442,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s) { AVIOContext *pb = s->pb; GXFContext *gxf = s->priv_data; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int i; gxf->umf_track_offset = pos - gxf->umf_start_offset; @@ -455,7 +455,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s) avio_wl16(pb, gxf->timecode_track.media_info); avio_wl16(pb, 1); - return url_ftell(pb) - pos; + return avio_tell(pb) - pos; } static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st) @@ -533,7 +533,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s) int64_t pos; int i, j; - pos = url_ftell(pb); + pos = avio_tell(pb); gxf->umf_media_offset = pos - gxf->umf_start_offset; for (i = 0; i <= s->nb_streams; ++i) { GXFStreamContext *sc; @@ -544,7 +544,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s) else sc = s->streams[i]->priv_data; - startpos = url_ftell(pb); + startpos = avio_tell(pb); avio_wl16(pb, 0); /* length */ avio_wl16(pb, sc->media_info); avio_wl16(pb, 0); /* reserved */ @@ -580,19 +580,19 @@ static int gxf_write_umf_media_description(AVFormatContext *s) } } - curpos = url_ftell(pb); + curpos = avio_tell(pb); avio_seek(pb, startpos, SEEK_SET); avio_wl16(pb, curpos - startpos); avio_seek(pb, curpos, SEEK_SET); } - return url_ftell(pb) - pos; + return avio_tell(pb) - pos; } static int gxf_write_umf_packet(AVFormatContext *s) { GXFContext *gxf = s->priv_data; AVIOContext *pb = s->pb; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); gxf_write_packet_header(pb, PKT_UMF); @@ -600,12 +600,12 @@ static int gxf_write_umf_packet(AVFormatContext *s) avio_w8(pb, 3); /* first and last (only) packet */ avio_wb32(pb, gxf->umf_length); /* data length */ - gxf->umf_start_offset = url_ftell(pb); + gxf->umf_start_offset = avio_tell(pb); gxf_write_umf_payload(s); gxf_write_umf_material_description(s); gxf->umf_track_size = gxf_write_umf_track_description(s); gxf->umf_media_size = gxf_write_umf_media_description(s); - gxf->umf_length = url_ftell(pb) - gxf->umf_start_offset; + gxf->umf_length = avio_tell(pb) - gxf->umf_start_offset; return updatePacketSize(pb, pos); } @@ -759,7 +759,7 @@ static int gxf_write_header(AVFormatContext *s) static int gxf_write_eos_packet(AVIOContext *pb) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); gxf_write_packet_header(pb, PKT_EOS); return updatePacketSize(pb, pos); @@ -775,7 +775,7 @@ static int gxf_write_trailer(AVFormatContext *s) ff_audio_interleave_close(s); gxf_write_eos_packet(pb); - end = url_ftell(pb); + end = avio_tell(pb); avio_seek(pb, 0, SEEK_SET); /* overwrite map, flt and umf packets with new values */ gxf_write_map_packet(s, 1); @@ -861,9 +861,9 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) GXFContext *gxf = s->priv_data; AVIOContext *pb = s->pb; AVStream *st = s->streams[pkt->stream_index]; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int padding = 0; - int packet_start_offset = url_ftell(pb) / 1024; + int packet_start_offset = avio_tell(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 */ diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 47bc706dfb..7635735195 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -196,7 +196,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t if (len < 0) break; - next = url_ftell(s->pb) + tlen; + next = avio_tell(s->pb) + tlen; if (tflags & ID3v2_FLAG_DATALEN) { avio_rb32(s->pb); @@ -258,7 +258,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) do { /* save the current offset in case there's nothing to read/skip */ - off = url_ftell(s->pb); + off = avio_tell(s->pb); ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE); if (ret != ID3v2_HEADER_SIZE) break; diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 71324d8803..391db609b7 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -141,7 +141,7 @@ static int roq_read_packet(AVFormatContext *s, 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_offset = avio_tell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; codebook_size = chunk_size; avio_seek(pb, codebook_size, SEEK_CUR); if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != @@ -197,7 +197,7 @@ static int roq_read_packet(AVFormatContext *s, roq->audio_frame_count += (chunk_size / roq->audio_channels); } - pkt->pos= url_ftell(pb); + pkt->pos= avio_tell(pb); ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, chunk_size); if (ret != chunk_size) diff --git a/libavformat/iff.c b/libavformat/iff.c index 6622445690..dd69ce8ca5 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -144,7 +144,7 @@ static int iff_read_header(AVFormatContext *s, const char *metadata_tag = NULL; chunk_id = avio_rl32(pb); data_size = avio_rb32(pb); - orig_pos = url_ftell(pb); + orig_pos = avio_tell(pb); switch(chunk_id) { case ID_VHDR: @@ -161,7 +161,7 @@ static int iff_read_header(AVFormatContext *s, break; case ID_BODY: - iff->body_pos = url_ftell(pb); + iff->body_pos = avio_tell(pb); iff->body_size = data_size; break; @@ -223,7 +223,7 @@ static int iff_read_header(AVFormatContext *s, return res; } } - avio_seek(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1), SEEK_CUR); + avio_seek(pb, data_size - (avio_tell(pb) - orig_pos) + (data_size & 1), SEEK_CUR); } avio_seek(pb, iff->body_pos, SEEK_SET); diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c index 9f7065ce5d..eb24da9cac 100644 --- a/libavformat/ingenientdec.c +++ b/libavformat/ingenientdec.c @@ -47,7 +47,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM); - pkt->pos = url_ftell(s->pb); + pkt->pos = avio_tell(s->pb); pkt->stream_index = 0; ret = avio_read(s->pb, pkt->data, size); if (ret < 0) { diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index e02e00b15a..b54df38b23 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -405,7 +405,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, debug_ipmovie("audio frame\n"); /* log position and move on for now */ - s->audio_chunk_offset = url_ftell(pb); + s->audio_chunk_offset = avio_tell(pb); s->audio_chunk_size = opcode_size; avio_seek(pb, opcode_size, SEEK_CUR); break; @@ -471,7 +471,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, debug_ipmovie("set decoding map\n"); /* log position and move on for now */ - s->decode_map_chunk_offset = url_ftell(pb); + s->decode_map_chunk_offset = avio_tell(pb); s->decode_map_chunk_size = opcode_size; avio_seek(pb, opcode_size, SEEK_CUR); break; @@ -480,7 +480,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, debug_ipmovie("set video data\n"); /* log position and move on for now */ - s->video_chunk_offset = url_ftell(pb); + s->video_chunk_offset = avio_tell(pb); s->video_chunk_size = opcode_size; avio_seek(pb, opcode_size, SEEK_CUR); break; @@ -494,7 +494,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, } /* make a note of where the stream is sitting */ - s->next_chunk_offset = url_ftell(pb); + s->next_chunk_offset = avio_tell(pb); /* dispatch the first of any pending packets */ if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY)) @@ -541,7 +541,7 @@ static int ipmovie_read_header(AVFormatContext *s, ipmovie->decode_map_chunk_offset = 0; /* on the first read, this will position the stream at the first chunk */ - ipmovie->next_chunk_offset = url_ftell(pb) + 4; + ipmovie->next_chunk_offset = avio_tell(pb) + 4; /* process the first chunk which should be CHUNK_INIT_VIDEO */ if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_VIDEO) diff --git a/libavformat/iss.c b/libavformat/iss.c index 04bb1c52d4..8d225108ad 100644 --- a/libavformat/iss.c +++ b/libavformat/iss.c @@ -87,7 +87,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap) get_token(pb, token, sizeof(token)); //Version ID get_token(pb, token, sizeof(token)); //Size - iss->sample_start_pos = url_ftell(pb); + iss->sample_start_pos = avio_tell(pb); st = av_new_stream(s, 0); if (!st) @@ -116,7 +116,7 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EIO); pkt->stream_index = 0; - pkt->pts = url_ftell(s->pb) - iss->sample_start_pos; + pkt->pts = avio_tell(s->pb) - iss->sample_start_pos; if(s->streams[0]->codec->channels > 0) pkt->pts /= s->streams[0]->codec->channels*2; return 0; diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 467ca9c4a5..28bf76dc84 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -272,7 +272,7 @@ static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) { if (pd.flags & NUT_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY; pkt->pts = pd.pts; pkt->stream_index = pd.stream; - pkt->pos = url_ftell(avf->pb); + pkt->pos = avio_tell(avf->pb); ret = nut_read_frame(priv->nut, &pd.len, pkt->data); diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 7480475cd5..ffb9d73d3c 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -517,7 +517,7 @@ static const char *matroska_doctypes[] = { "matroska", "webm" }; static int ebml_level_end(MatroskaDemuxContext *matroska) { AVIOContext *pb = matroska->ctx->pb; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); if (matroska->num_levels > 0) { MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1]; @@ -549,7 +549,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, if (!(total = avio_r8(pb))) { /* we might encounter EOS here */ if (!url_feof(pb)) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); av_log(matroska->ctx, AV_LOG_ERROR, "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos); @@ -560,7 +560,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, /* get the length of the EBML number */ read = 8 - ff_log2_tab[total]; if (read > max_size) { - int64_t pos = url_ftell(pb) - 1; + int64_t pos = avio_tell(pb) - 1; av_log(matroska->ctx, AV_LOG_ERROR, "Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n", (uint8_t) total, pos, pos); @@ -659,7 +659,7 @@ static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) return AVERROR(ENOMEM); bin->size = length; - bin->pos = url_ftell(pb); + bin->pos = avio_tell(pb); if (avio_read(pb, bin->data, length) != length) { av_freep(&bin->data); return AVERROR(EIO); @@ -685,7 +685,7 @@ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length) } level = &matroska->levels[matroska->num_levels++]; - level->start = url_ftell(pb); + level->start = avio_tell(pb); level->length = length; return 0; @@ -827,7 +827,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, case EBML_NEST: if ((res=ebml_read_master(matroska, length)) < 0) return res; if (id == MATROSKA_ID_SEGMENT) - matroska->segment_start = url_ftell(matroska->ctx->pb); + matroska->segment_start = avio_tell(matroska->ctx->pb); return ebml_parse_nest(matroska, syntax->def.n, data); case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data); case EBML_STOP: return 1; @@ -1111,7 +1111,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) EbmlList *seekhead_list = &matroska->seekhead; MatroskaSeekhead *seekhead = seekhead_list->elem; uint32_t level_up = matroska->level_up; - int64_t before_pos = url_ftell(matroska->ctx->pb); + int64_t before_pos = avio_tell(matroska->ctx->pb); uint32_t saved_id = matroska->current_id; MatroskaLevel level; int i; @@ -1842,7 +1842,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska) EbmlList *blocks_list; MatroskaBlock *blocks; int i, res; - int64_t pos = url_ftell(matroska->ctx->pb); + int64_t pos = avio_tell(matroska->ctx->pb); matroska->prev_pkt = NULL; if (matroska->current_id) pos -= 4; /* sizeof the ID which was already read */ diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 6f752204cc..4c4f00958e 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -203,7 +203,7 @@ static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char */ static void put_ebml_void(AVIOContext *pb, uint64_t size) { - int64_t currentpos = url_ftell(pb); + int64_t currentpos = avio_tell(pb); assert(size >= 2); @@ -215,7 +215,7 @@ static void put_ebml_void(AVIOContext *pb, uint64_t size) put_ebml_num(pb, size-1, 0); else put_ebml_num(pb, size-9, 8); - while(url_ftell(pb) < currentpos + size) + while(avio_tell(pb) < currentpos + size) avio_w8(pb, 0); } @@ -224,12 +224,12 @@ static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, ui int bytes = expectedsize ? ebml_num_size(expectedsize) : 8; put_ebml_id(pb, elementid); put_ebml_size_unknown(pb, bytes); - return (ebml_master){ url_ftell(pb), bytes }; + return (ebml_master){ avio_tell(pb), bytes }; } static void end_ebml_master(AVIOContext *pb, ebml_master master) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); if (avio_seek(pb, master.pos - master.sizebytes, SEEK_SET) < 0) return; @@ -265,7 +265,7 @@ static mkv_seekhead * mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset new_seekhead->segment_offset = segment_offset; if (numelements > 0) { - new_seekhead->filepos = url_ftell(pb); + new_seekhead->filepos = avio_tell(pb); // 21 bytes max for a seek entry, 10 bytes max for the SeekHead ID // and size, and 3 bytes to guarantee that an EBML void element // will fit afterwards @@ -310,7 +310,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) int64_t currentpos; int i; - currentpos = url_ftell(pb); + currentpos = avio_tell(pb); if (seekhead->reserved_size > 0) if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0) @@ -332,7 +332,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) end_ebml_master(pb, metaseek); if (seekhead->reserved_size > 0) { - uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb); + uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb); put_ebml_void(pb, remaining); avio_seek(pb, currentpos, SEEK_SET); @@ -379,7 +379,7 @@ static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks) int64_t currentpos; int i, j; - currentpos = url_ftell(pb); + currentpos = avio_tell(pb); cues_element = start_ebml_master(pb, MATROSKA_ID_CUES, 0); for (i = 0; i < cues->num_entries; i++) { @@ -526,7 +526,7 @@ static int mkv_write_tracks(AVFormatContext *s) ebml_master tracks; int i, j, ret; - ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, url_ftell(pb)); + ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, avio_tell(pb)); if (ret < 0) return ret; tracks = start_ebml_master(pb, MATROSKA_ID_TRACKS, 0); @@ -658,7 +658,7 @@ static int mkv_write_chapters(AVFormatContext *s) if (!s->nb_chapters) return 0; - ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, url_ftell(pb)); + ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_tell(pb)); if (ret < 0) return ret; chapters = start_ebml_master(pb, MATROSKA_ID_CHAPTERS , 0); @@ -730,7 +730,7 @@ static int mkv_write_tag(AVFormatContext *s, AVMetadata *m, unsigned int element int ret; if (!tags->pos) { - ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, url_ftell(s->pb)); + ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb)); if (ret < 0) return ret; *tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0); @@ -813,7 +813,7 @@ static int mkv_write_header(AVFormatContext *s) end_ebml_master(pb, ebml_header); mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0); - mkv->segment_offset = url_ftell(pb); + mkv->segment_offset = avio_tell(pb); // we write 2 seek heads - one at the end of the file to point to each // cluster, and one at the beginning to point to all other level one @@ -824,7 +824,7 @@ static int mkv_write_header(AVFormatContext *s) if (!mkv->main_seekhead) return AVERROR(ENOMEM); - ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb)); + ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, avio_tell(pb)); if (ret < 0) return ret; segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0); @@ -847,7 +847,7 @@ static int mkv_write_header(AVFormatContext *s) // reserve space for the duration mkv->duration = 0; - mkv->duration_offset = url_ftell(pb); + mkv->duration_offset = avio_tell(pb); put_ebml_void(pb, 11); // assumes double-precision float to be written end_ebml_master(pb, segment_info); @@ -928,7 +928,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " "pts %" PRId64 ", duration %d\n", - url_ftell(pb), size, pkt->pts, duration); + avio_tell(pb), size, pkt->pts, duration); blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size)); put_ebml_id(pb, MATROSKA_ID_BLOCK); put_ebml_num(pb, size+4, 0); @@ -957,7 +957,7 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " "pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n", - url_ftell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags); + avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags); if (codec->codec_id == CODEC_ID_H264 && codec->extradata_size > 0 && (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1)) ff_avc_parse_nal_units_buf(pkt->data, &data, &size); @@ -1045,7 +1045,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) } if (!mkv->cluster_pos) { - mkv->cluster_pos = url_ftell(s->pb); + mkv->cluster_pos = avio_tell(s->pb); mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0); put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts)); mkv->cluster_pts = FFMAX(0, ts); @@ -1094,7 +1094,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) AVCodecContext *codec = s->streams[pkt->stream_index]->codec; int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; - int cluster_size = url_ftell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos); + int cluster_size = avio_tell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos); // start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or // after 4k and on a keyframe @@ -1103,7 +1103,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) || cluster_size > 5*1024*1024 || ts > mkv->cluster_pts + 5000 || (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe && cluster_size > 4*1024))) { av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %" PRIu64 - " bytes, pts %" PRIu64 "\n", url_ftell(pb), ts); + " bytes, pts %" PRIu64 "\n", avio_tell(pb), ts); end_ebml_master(pb, mkv->cluster); mkv->cluster_pos = 0; if (mkv->dyn_bc) @@ -1162,7 +1162,7 @@ static int mkv_write_trailer(AVFormatContext *s) // update the duration av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration); - currentpos = url_ftell(pb); + currentpos = avio_tell(pb); avio_seek(pb, mkv->duration_offset, SEEK_SET); put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration); diff --git a/libavformat/mmf.c b/libavformat/mmf.c index a68870c1c2..0f5cee4f71 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -52,7 +52,7 @@ static void end_tag_be(AVIOContext *pb, int64_t start) { int64_t pos; - pos = url_ftell(pb); + pos = avio_tell(pb); avio_seek(pb, start - 4, SEEK_SET); avio_wb32(pb, (uint32_t)(pos - start)); avio_seek(pb, pos, SEEK_SET); @@ -84,7 +84,7 @@ static int mmf_write_header(AVFormatContext *s) avio_write(pb, "ATR\x00", 4); avio_wb32(pb, 0); - mmf->atrpos = url_ftell(pb); + mmf->atrpos = avio_tell(pb); avio_w8(pb, 0); /* format type */ avio_w8(pb, 0); /* sequence type */ avio_w8(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */ @@ -94,7 +94,7 @@ static int mmf_write_header(AVFormatContext *s) ffio_wfourcc(pb, "Atsq"); avio_wb32(pb, 16); - mmf->atsqpos = url_ftell(pb); + mmf->atsqpos = avio_tell(pb); /* Will be filled on close */ avio_write(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16); @@ -139,7 +139,7 @@ static int mmf_write_trailer(AVFormatContext *s) end_tag_be(pb, mmf->atrpos); end_tag_be(pb, 8); - pos = url_ftell(pb); + pos = avio_tell(pb); size = pos - mmf->awapos; /* Fill Atsq chunk */ diff --git a/libavformat/mov.c b/libavformat/mov.c index ad5bada180..e9435a93c6 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -298,7 +298,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!parse) { /* skip leaf atoms data */ avio_seek(pb, a.size, SEEK_CUR); } else { - int64_t start_pos = url_ftell(pb); + int64_t start_pos = avio_tell(pb); int64_t left; int err = parse(c, pb, a); if (err < 0) @@ -306,7 +306,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (c->found_moov && c->found_mdat && (url_is_streamed(pb) || start_pos + a.size == url_fsize(pb))) return 0; - left = a.size - url_ftell(pb) + start_pos; + left = a.size - avio_tell(pb) + start_pos; if (left > 0) /* skip garbage at atom end */ avio_seek(pb, left, SEEK_CUR); } @@ -343,7 +343,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < sc->drefs_count; i++) { MOVDref *dref = &sc->drefs[i]; uint32_t size = avio_rb32(pb); - int64_t next = url_ftell(pb) + size - 4; + int64_t next = avio_tell(pb) + size - 4; if (size < 12) return -1; @@ -383,7 +383,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_seek(pb, 16, SEEK_CUR); - for (type = 0; type != -1 && url_ftell(pb) < next; ) { + for (type = 0; type != -1 && avio_tell(pb) < next; ) { type = avio_rb16(pb); len = avio_rb16(pb); av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); @@ -583,7 +583,7 @@ static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) { - c->fragment.moof_offset = url_ftell(pb) - 8; + c->fragment.moof_offset = avio_tell(pb) - 8; av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset); return mov_read_default(c, pb, atom); } @@ -925,7 +925,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) enum CodecID id; int dref_id = 1; MOVAtom a = { AV_RL32("stsd") }; - int64_t start_pos = url_ftell(pb); + int64_t start_pos = avio_tell(pb); int size = avio_rb32(pb); /* size */ uint32_t format = avio_rl32(pb); /* data format */ @@ -945,7 +945,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) * in the MOV demuxer, patch welcome. */ multiple_stsd: av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); - avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR); + avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR); continue; } /* we cannot demux concatenated h264 streams because of different extradata */ @@ -1166,7 +1166,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) } else if(st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){ // ttxt stsd contains display flags, justification, background // color, fonts, and default styles, so fake an atom to read it - MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) }; + MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) }; if (format != AV_RL32("mp4s")) // mp4s contains a regular esds atom mov_read_glbl(c, pb, fake_atom); st->codec->codec_id= id; @@ -1174,10 +1174,10 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) st->codec->height = sc->height; } else { /* other codec type, just skip (rtp, mp4s, tmcd ...) */ - avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR); + avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR); } /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ - a.size = size - (url_ftell(pb) - start_pos); + a.size = size - (avio_tell(pb) - start_pos); if (a.size > 8) { if (mov_read_default(c, pb, a) < 0) return -1; @@ -2299,7 +2299,7 @@ static void mov_read_chapters(AVFormatContext *s) st->discard = AVDISCARD_ALL; sc = st->priv_data; - cur_pos = url_ftell(sc->pb); + cur_pos = avio_tell(sc->pb); for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; @@ -2364,7 +2364,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "moov atom not found\n"); return -1; } - av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb)); + av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", avio_tell(pb)); if (!url_is_streamed(pb) && mov->chapter_track > 0) mov_read_chapters(s); @@ -2413,7 +2413,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 || url_feof(s->pb)) return AVERROR_EOF; - av_dlog(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb)); + av_dlog(s, "read fragments, offset 0x%llx\n", avio_tell(s->pb)); goto retry; } sc = st->priv_data; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 231976b0c6..e1fd79d6ec 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -39,7 +39,7 @@ //FIXME support 64 bit variant with wide placeholders static int64_t updateSize(AVIOContext *pb, int64_t pos) { - int64_t curpos = url_ftell(pb); + int64_t curpos = avio_tell(pb); avio_seek(pb, pos, SEEK_SET); avio_wb32(pb, curpos - pos); /* rewrite size */ avio_seek(pb, curpos, SEEK_SET); @@ -52,7 +52,7 @@ static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track) { int i; int mode64 = 0; // use 32 bit size variant if possible - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ if (pos > UINT32_MAX) { mode64 = 1; @@ -76,7 +76,7 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) int equalChunks = 1; int i, j, entries = 0, tst = -1, oldtst = -1; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "stsz"); avio_wb32(pb, 0); /* version & flags */ @@ -113,11 +113,11 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) int index = 0, oldval = -1, i; int64_t entryPos, curpos; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "stsc"); avio_wb32(pb, 0); // version & flags - entryPos = url_ftell(pb); + entryPos = avio_tell(pb); avio_wb32(pb, track->entry); // entry count for (i=0; ientry; i++) { if(oldval != track->cluster[i].samplesInChunk) @@ -129,7 +129,7 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) index++; } } - curpos = url_ftell(pb); + curpos = avio_tell(pb); avio_seek(pb, entryPos, SEEK_SET); avio_wb32(pb, index); // rewrite size avio_seek(pb, curpos, SEEK_SET); @@ -142,11 +142,11 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) { int64_t curpos, entryPos; int i, index = 0; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); // size ffio_wfourcc(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps"); avio_wb32(pb, 0); // version & flags - entryPos = url_ftell(pb); + entryPos = avio_tell(pb); avio_wb32(pb, track->entry); // entry count for (i=0; ientry; i++) { if (track->cluster[i].flags & flag) { @@ -154,7 +154,7 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) index++; } } - curpos = url_ftell(pb); + curpos = avio_tell(pb); avio_seek(pb, entryPos, SEEK_SET); avio_wb32(pb, index); // rewrite size avio_seek(pb, curpos, SEEK_SET); @@ -255,7 +255,7 @@ static void putDescr(AVIOContext *pb, int tag, unsigned int size) static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; avio_wb32(pb, 0); // size @@ -317,7 +317,7 @@ static int mov_pcm_le_gt16(enum CodecID codec_id) static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); avio_wl32(pb, track->tag); // store it byteswapped track->enc->codec_tag = av_bswap16(track->tag >> 16); @@ -327,7 +327,7 @@ static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "wave"); @@ -400,7 +400,7 @@ static int mov_get_lpcm_flags(enum CodecID codec_id) static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int version = 0; uint32_t tag = track->tag; @@ -518,7 +518,7 @@ static int mov_write_svq3_tag(AVIOContext *pb) static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); ffio_wfourcc(pb, "avcC"); @@ -764,7 +764,7 @@ static int mov_write_uuid_tag_ipod(AVIOContext *pb) static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ avio_wl32(pb, track->tag); // store it byteswapped avio_wb32(pb, 0); /* Reserved */ @@ -792,7 +792,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); char compressor_name[32]; avio_wb32(pb, 0); /* size */ @@ -861,7 +861,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "rtp "); avio_wb32(pb, 0); /* Reserved */ @@ -881,7 +881,7 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "stsd"); avio_wb32(pb, 0); /* version & flags */ @@ -988,7 +988,7 @@ static int mov_write_dref_tag(AVIOContext *pb) static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "stbl"); mov_write_stsd_tag(pb, track); @@ -1010,7 +1010,7 @@ static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_dinf_tag(AVIOContext *pb) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "dinf"); mov_write_dref_tag(pb); @@ -1063,7 +1063,7 @@ static int mov_write_vmhd_tag(AVIOContext *pb) static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) { const char *hdlr, *descr = NULL, *hdlr_type = NULL; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); if (!track) { /* no media --> data handler */ hdlr = "dhlr"; @@ -1120,7 +1120,7 @@ static int mov_write_hmhd_tag(AVIOContext *pb) static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "minf"); if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO) @@ -1172,7 +1172,7 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "mdia"); mov_write_mdhd_tag(pb, track); @@ -1249,7 +1249,7 @@ static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track) int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width, track->enc->sample_aspect_ratio.den); - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "tapt"); @@ -1338,7 +1338,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index) static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "trak"); mov_write_tkhd_tag(pb, track, st); @@ -1475,7 +1475,7 @@ static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){ int size = 0; if (value && value[0]) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, name); mov_write_string_data_tag(pb, value, lang, long_style); @@ -1534,7 +1534,7 @@ static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "ilst"); mov_write_string_metadata(s, pb, "\251nam", "title" , 1); @@ -1563,7 +1563,7 @@ static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int size = 0; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "meta"); avio_wb32(pb, 0); @@ -1603,7 +1603,7 @@ static uint16_t language_code(const char *str) static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, const char *tag, const char *str) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0); if (!t || !utf8len(t->value)) return 0; @@ -1624,7 +1624,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int i, nb_chapters = FFMIN(s->nb_chapters, 255); avio_wb32(pb, 0); // size @@ -1720,7 +1720,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) int64_t pos, pos2; if (title) { - pos = url_ftell(pb); + pos = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "uuid"); ffio_wfourcc(pb, "USMT"); @@ -1728,7 +1728,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) avio_wb32(pb, 0xbb88695c); avio_wb32(pb, 0xfac9c740); - pos2 = url_ftell(pb); + pos2 = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "MTDT"); avio_wb16(pb, 4); @@ -1756,7 +1756,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int i; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "moov"); @@ -1801,7 +1801,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) avio_wb32(pb, 8); // placeholder for extended size field (64 bit) ffio_wfourcc(pb, mov->mode == MODE_MOV ? "wide" : "free"); - mov->mdat_pos = url_ftell(pb); + mov->mdat_pos = avio_tell(pb); avio_wb32(pb, 0); /* size placeholder*/ ffio_wfourcc(pb, "mdat"); return 0; @@ -1811,7 +1811,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); int has_h264 = 0, has_video = 0; int minor = 0x200; int i; @@ -2011,7 +2011,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) return -1; } - trk->cluster[trk->entry].pos = url_ftell(pb) - size; + trk->cluster[trk->entry].pos = avio_tell(pb) - size; trk->cluster[trk->entry].samplesInChunk = samplesInChunk; trk->cluster[trk->entry].size = size; trk->cluster[trk->entry].entries = samplesInChunk; @@ -2242,7 +2242,7 @@ static int mov_write_trailer(AVFormatContext *s) int res = 0; int i; - int64_t moov_pos = url_ftell(pb); + int64_t moov_pos = avio_tell(pb); /* Write size of mdat tag */ if (mov->mdat_size+8 <= UINT32_MAX) { diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index e6f74cdb0f..21793cdd47 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -316,7 +316,7 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, int64_t count_pos, entries_pos; int count = 0, entries; - count_pos = url_ftell(out); + count_pos = avio_tell(out); /* RTPsample header */ avio_wb16(out, 0); /* packet count */ avio_wb16(out, 0); /* reserved */ @@ -358,7 +358,7 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, avio_write(out, data, 2); /* RTP header */ avio_wb16(out, seq); /* RTPsequenceseed */ avio_wb16(out, 0); /* reserved + flags */ - entries_pos = url_ftell(out); + entries_pos = avio_tell(out); avio_wb16(out, 0); /* entry count */ data += 12; @@ -371,13 +371,13 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, data += packet_len; size -= packet_len; - curpos = url_ftell(out); + curpos = avio_tell(out); avio_seek(out, entries_pos, SEEK_SET); avio_wb16(out, entries); avio_seek(out, curpos, SEEK_SET); } - curpos = url_ftell(out); + curpos = avio_tell(out); avio_seek(out, count_pos, SEEK_SET); avio_wb16(out, count); avio_seek(out, curpos, SEEK_SET); diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index f90348c114..98dde547c8 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -147,7 +147,7 @@ static int mp3_read_header(AVFormatContext *s, // lcm of all mp3 sample rates av_set_pts_info(st, 64, 1, 14112000); - off = url_ftell(s->pb); + off = avio_tell(s->pb); if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index c465420691..27d25f5da9 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -211,7 +211,7 @@ static int mp3_write_header(struct AVFormatContext *s) avio_w8(s->pb, 0); /* flags */ /* reserve space for size */ - size_pos = url_ftell(s->pb); + size_pos = avio_tell(s->pb); avio_wb32(s->pb, 0); ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL); @@ -237,7 +237,7 @@ static int mp3_write_header(struct AVFormatContext *s) totlen += ret; } - cur_pos = url_ftell(s->pb); + cur_pos = avio_tell(s->pb); avio_seek(s->pb, size_pos, SEEK_SET); id3v2_put_size(s, totlen); avio_seek(s->pb, cur_pos, SEEK_SET); diff --git a/libavformat/mpc.c b/libavformat/mpc.c index c22938366b..b9c5dc993e 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -94,7 +94,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) /* try to read APE tags */ if (!url_is_streamed(s->pb)) { - int64_t pos = url_ftell(s->pb); + int64_t pos = avio_tell(s->pb); ff_ape_parse_tag(s); if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); @@ -120,7 +120,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) c->lastframe = c->curframe; c->curframe++; curbits = c->curbits; - pos = url_ftell(s->pb); + pos = avio_tell(s->pb); tmp = avio_rl32(s->pb); if(curbits <= 12){ size2 = (tmp >> (12 - curbits)) & 0xFFFFF; diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 9d8a4d80a2..b55bf49650 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -120,10 +120,10 @@ static inline int64_t gb_get_v(GetBitContext *gb) static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size) { int64_t pos; - pos = url_ftell(pb); + pos = avio_tell(pb); *tag = avio_rl16(pb); *size = ff_get_v(pb); - *size -= url_ftell(pb) - pos; + *size -= avio_tell(pb) - pos; } static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) @@ -176,7 +176,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in switch(tag){ case TAG_SEEKTBLOFF: - pos = url_ftell(pb) + size; + pos = avio_tell(pb) + size; off = ff_get_v(pb); mpc8_parse_seektable(s, chunk_pos + off); avio_seek(pb, pos, SEEK_SET); @@ -194,14 +194,14 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) int tag = 0; int64_t size, pos; - c->header_pos = url_ftell(pb); + c->header_pos = avio_tell(pb); if(avio_rl32(pb) != TAG_MPCK){ av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n"); return -1; } while(!url_feof(pb)){ - pos = url_ftell(pb); + pos = avio_tell(pb); mpc8_get_chunk_header(pb, &tag, &size); if(tag == TAG_STREAMHDR) break; @@ -211,7 +211,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Stream header not found\n"); return -1; } - pos = url_ftell(pb); + pos = avio_tell(pb); avio_seek(pb, 4, SEEK_CUR); //CRC c->ver = avio_r8(pb); if(c->ver != 8){ @@ -236,7 +236,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5]; av_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate); st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2); - size -= url_ftell(pb) - pos; + size -= avio_tell(pb) - pos; return 0; } @@ -248,7 +248,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t pos, size; while(!url_feof(s->pb)){ - pos = url_ftell(s->pb); + pos = avio_tell(s->pb); mpc8_get_chunk_header(s->pb, &tag, &size); if (size < 0) return -1; diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index a1ba6aa203..740dbc94c0 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -169,7 +169,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) int max_size, start_code; max_size = *size_ptr; - pos_start = url_ftell(pb); + pos_start = avio_tell(pb); /* in order to go faster, we fill the buffer */ pos = pos_start - 16386; @@ -241,7 +241,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, int len, size, startcode, c, flags, header_len; int pes_ext, ext2_len, id_ext, skip; int64_t pts, dts; - int64_t last_sync= url_ftell(s->pb); + int64_t last_sync= avio_tell(s->pb); error_redo: avio_seek(s->pb, last_sync, SEEK_SET); @@ -250,8 +250,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, m->header_state = 0xff; size = MAX_SYNC_SIZE; startcode = find_next_start_code(s->pb, &size, &m->header_state); - last_sync = url_ftell(s->pb); - //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb)); + last_sync = avio_tell(s->pb); + //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb)); if (startcode < 0){ if(url_feof(s->pb)) return AVERROR_EOF; @@ -295,7 +295,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, (startcode == 0x1bd) || (startcode == 0x1fd))) goto redo; if (ppos) { - *ppos = url_ftell(s->pb) - 4; + *ppos = avio_tell(s->pb) - 4; } len = avio_rb16(s->pb); pts = diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 8815044fe3..b1b329e3e8 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1265,7 +1265,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) if (p >= p_end) return 0; - pos = url_ftell(ts->stream->pb); + pos = avio_tell(ts->stream->pb); ts->pos47= pos % ts->raw_packet_size; if (tss->type == MPEGTS_SECTION) { @@ -1454,7 +1454,7 @@ static int mpegts_read_header(AVFormatContext *s, } /* read the first 1024 bytes to get packet size */ - pos = url_ftell(pb); + pos = avio_tell(pb); len = avio_read(pb, buf, sizeof(buf)); if (len != sizeof(buf)) goto fail; @@ -1552,7 +1552,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, if (av_new_packet(pkt, TS_PACKET_SIZE) < 0) return AVERROR(ENOMEM); - pkt->pos= url_ftell(s->pb); + pkt->pos= avio_tell(s->pb); ret = read_packet(s, pkt->data, ts->raw_packet_size); if (ret < 0) { av_free_packet(pkt); @@ -1562,7 +1562,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, /* compute exact PCR for each packet */ if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) { /* we read the next PCR (XXX: optimize it by using a bigger buffer */ - pos = url_ftell(s->pb); + pos = avio_tell(s->pb); for(i = 0; i < MAX_PACKET_READAHEAD; i++) { avio_seek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET); avio_read(s->pb, pcr_buf, 12); @@ -1591,7 +1591,7 @@ static int mpegts_read_packet(AVFormatContext *s, MpegTSContext *ts = s->priv_data; int ret, i; - if (url_ftell(s->pb) != ts->last_pos) { + if (avio_tell(s->pb) != ts->last_pos) { /* seek detected, flush pes buffer */ for (i = 0; i < NB_PID_MAX; i++) { if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) { @@ -1620,7 +1620,7 @@ static int mpegts_read_packet(AVFormatContext *s, } } - ts->last_pos = url_ftell(s->pb); + ts->last_pos = avio_tell(s->pb); return ret; } @@ -1771,7 +1771,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0) return -1; - pos= url_ftell(s->pb); + pos= avio_tell(s->pb); for(;;) { avio_seek(s->pb, pos, SEEK_SET); diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index be11a06ff0..02bde7c4be 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -595,7 +595,7 @@ static void retransmit_si_info(AVFormatContext *s) static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb) { - return av_rescale(url_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + + return av_rescale(avio_tell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + ts->first_pcr; } diff --git a/libavformat/mtv.c b/libavformat/mtv.c index c5f14cf68e..462ae202fc 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -162,7 +162,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) int i; #endif - if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) + if((avio_tell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) { avio_seek(pb, MTV_AUDIO_PADDING_SIZE, SEEK_CUR); diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index be618406f7..19a632b01a 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -193,7 +193,7 @@ static int klv_read_packet(KLVPacket *klv, AVIOContext *pb) { if (!mxf_read_sync(pb, mxf_klv_key, 4)) return -1; - klv->offset = url_ftell(pb) - 4; + klv->offset = avio_tell(pb) - 4; memcpy(klv->key, mxf_klv_key, 4); avio_read(pb, klv->key + 4, 12); klv->length = klv_decode_ber_length(pb); @@ -247,7 +247,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b}; MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; - int64_t end = url_ftell(pb) + klv->length; + int64_t end = avio_tell(pb) + klv->length; uint64_t size; uint64_t orig_size; uint64_t plaintext_size; @@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv &pkt->data[plaintext_size], size >> 4, ivec, 1); pkt->size = orig_size; pkt->stream_index = index; - avio_seek(pb, end - url_ftell(pb), SEEK_CUR); + avio_seek(pb, end - avio_tell(pb), SEEK_CUR); return 0; } @@ -866,14 +866,14 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF { AVIOContext *pb = mxf->fc->pb; MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf; - uint64_t klv_end = url_ftell(pb) + klv->length; + uint64_t klv_end = avio_tell(pb) + klv->length; if (!ctx) return -1; - while (url_ftell(pb) + 4 < klv_end) { + while (avio_tell(pb) + 4 < klv_end) { int tag = avio_rb16(pb); int size = avio_rb16(pb); /* KLV specified by 0x53 */ - uint64_t next = url_ftell(pb) + size; + uint64_t next = avio_tell(pb) + size; UID uid = {0}; av_dlog(mxf->fc, "local tag %#04x size %d\n", tag, size); diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 395d7c392d..8e1cfc7b0d 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1171,14 +1171,14 @@ static void mxf_write_index_table_segment(AVFormatContext *s) static void mxf_write_klv_fill(AVFormatContext *s) { - unsigned pad = klv_fill_size(url_ftell(s->pb)); + unsigned pad = klv_fill_size(avio_tell(s->pb)); if (pad) { avio_write(s->pb, klv_fill_key, 16); pad -= 16 + 4; klv_encode_ber4_length(s->pb, pad); for (; pad; pad--) avio_w8(s->pb, 0); - assert(!(url_ftell(s->pb) & (KAG_SIZE-1))); + assert(!(avio_tell(s->pb) & (KAG_SIZE-1))); } } @@ -1190,7 +1190,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, AVIOContext *pb = s->pb; int64_t header_byte_count_offset; unsigned index_byte_count = 0; - uint64_t partition_offset = url_ftell(pb); + uint64_t partition_offset = avio_tell(pb); if (!mxf->edit_unit_byte_count && mxf->edit_units_count) index_byte_count = 85 + 12+(s->nb_streams+1)*6 + @@ -1233,7 +1233,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, avio_wb64(pb, mxf->footer_partition_offset); // footerPartition // set offset - header_byte_count_offset = url_ftell(pb); + header_byte_count_offset = avio_tell(pb); avio_wb64(pb, 0); // headerByteCount, update later // indexTable @@ -1260,10 +1260,10 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, unsigned header_byte_count; mxf_write_klv_fill(s); - start = url_ftell(s->pb); + start = avio_tell(s->pb); mxf_write_primer_pack(s); mxf_write_header_metadata_sets(s); - pos = url_ftell(s->pb); + pos = avio_tell(s->pb); header_byte_count = pos - start + klv_fill_size(pos); // update header_byte_count @@ -1617,7 +1617,7 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke klv_encode_ber4_length(s->pb, pad); for (; pad; pad--) avio_w8(s->pb, 0); - assert(!(url_ftell(s->pb) & (KAG_SIZE-1))); + assert(!(avio_tell(s->pb) & (KAG_SIZE-1))); } else { av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n"); for (; pad > 0; pad--) @@ -1740,7 +1740,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s) { MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; - uint64_t pos = url_ftell(pb); + uint64_t pos = avio_tell(pb); int i; avio_write(pb, random_index_pack_key, 16); @@ -1760,7 +1760,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s) avio_wb32(pb, 0); // BodySID of footer partition avio_wb64(pb, mxf->footer_partition_offset); - avio_wb32(pb, url_ftell(pb) - pos + 4); + avio_wb32(pb, avio_tell(pb) - pos + 4); } static int mxf_write_footer(AVFormatContext *s) @@ -1771,7 +1771,7 @@ static int mxf_write_footer(AVFormatContext *s) mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count; mxf_write_klv_fill(s); - mxf->footer_partition_offset = url_ftell(pb); + mxf->footer_partition_offset = avio_tell(pb); if (mxf->edit_unit_byte_count) { // no need to repeat index mxf_write_partition(s, 0, 0, footer_partition_key, 0); } else { diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index cc0c5d7c68..3bfebb263c 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -225,7 +225,7 @@ static int nsv_resync(AVFormatContext *s) uint32_t v = 0; int i; - av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state); + av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, avio_tell(pb), nsv->state); //nsv->state = NSV_UNSYNC; @@ -299,7 +299,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) if (url_feof(pb)) return -1; - av_dlog(s, "NSV got header; filepos %"PRId64"\n", url_ftell(pb)); + av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb)); if (strings_size > 0) { char *strings; /* last byte will be '\0' to play safe with str*() */ @@ -334,7 +334,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) if (url_feof(pb)) return -1; - av_dlog(s, "NSV got infos; filepos %"PRId64"\n", url_ftell(pb)); + av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_tell(pb)); if (table_entries_used > 0) { int i; @@ -355,7 +355,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) } } - av_dlog(s, "NSV got index; filepos %"PRId64"\n", url_ftell(pb)); + av_dlog(s, "NSV got index; filepos %"PRId64"\n", avio_tell(pb)); #ifdef DEBUG_DUMP_INDEX #define V(v) ((v<0x20 || v > 127)?'.':v) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 8831dc0a3e..8c1ba28599 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -98,7 +98,7 @@ static inline uint64_t get_vb_trace(AVIOContext *bc, char *file, char *func, int static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode) { int64_t size; -// start= url_ftell(bc) - 8; +// start= avio_tell(bc) - 8; startcode= av_be2ne64(startcode); startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8); @@ -148,7 +148,7 @@ static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos){ for(;;){ uint64_t startcode= find_any_startcode(bc, pos); if(startcode == code) - return url_ftell(bc) - 8; + return avio_tell(bc) - 8; else if(startcode == 0) return -1; pos=-1; @@ -176,7 +176,7 @@ static int nut_probe(AVProbeData *p){ dst= tmp; static int skip_reserved(AVIOContext *bc, int64_t pos){ - pos -= url_ftell(bc); + pos -= avio_tell(bc); if(pos<0){ avio_seek(bc, pos, SEEK_CUR); return -1; @@ -196,7 +196,7 @@ static int decode_main_header(NUTContext *nut){ int64_t tmp_match; end= get_packetheader(nut, bc, 1, MAIN_STARTCODE); - end += url_ftell(bc); + end += avio_tell(bc); GET_V(tmp , tmp >=2 && tmp <= 3) GET_V(stream_count , tmp > 0 && tmp <= NUT_MAX_STREAMS) @@ -267,7 +267,7 @@ static int decode_main_header(NUTContext *nut){ } assert(nut->frame_code['N'].flags == FLAG_INVALID); - if(end > url_ftell(bc) + 4){ + if(end > avio_tell(bc) + 4){ int rem= 1024; GET_V(nut->header_count, tmp<128U) nut->header_count++; @@ -306,7 +306,7 @@ static int decode_stream_header(NUTContext *nut){ AVStream *st; end= get_packetheader(nut, bc, 1, STREAM_STARTCODE); - end += url_ftell(bc); + end += avio_tell(bc); GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base); stc= &nut->stream[stream_id]; @@ -409,7 +409,7 @@ static int decode_info_header(NUTContext *nut){ AVMetadata **metadata = NULL; end= get_packetheader(nut, bc, 1, INFO_STARTCODE); - end += url_ftell(bc); + end += avio_tell(bc); GET_V(stream_id_plus1, tmp <= s->nb_streams) chapter_id = get_s(bc); @@ -480,10 +480,10 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ AVIOContext *bc = s->pb; int64_t end, tmp; - nut->last_syncpoint_pos= url_ftell(bc)-8; + nut->last_syncpoint_pos= avio_tell(bc)-8; end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE); - end += url_ftell(bc); + end += avio_tell(bc); tmp= ff_get_v(bc); *back_ptr= nut->last_syncpoint_pos - 16*ff_get_v(bc); @@ -521,7 +521,7 @@ static int find_and_decode_index(NUTContext *nut){ } end= get_packetheader(nut, bc, 1, INDEX_STARTCODE); - end += url_ftell(bc); + end += avio_tell(bc); ff_get_v(bc); //max_pts GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0) @@ -635,7 +635,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) pos=0; for(;;){ uint64_t startcode= find_any_startcode(bc, pos); - pos= url_ftell(bc); + pos= avio_tell(bc); if(startcode==0){ av_log(s, AV_LOG_ERROR, "EOF before video frames\n"); @@ -653,7 +653,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) s->data_offset= pos-8; if(!url_is_streamed(bc)){ - int64_t orig_pos= url_ftell(bc); + int64_t orig_pos= avio_tell(bc); find_and_decode_index(nut); avio_seek(bc, orig_pos, SEEK_SET); } @@ -671,8 +671,8 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui int size, flags, size_mul, pts_delta, i, reserved_count; uint64_t tmp; - if(url_ftell(bc) > nut->last_syncpoint_pos + nut->max_distance){ - av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", url_ftell(bc), nut->last_syncpoint_pos, nut->max_distance); + if(avio_tell(bc) > nut->last_syncpoint_pos + nut->max_distance){ + av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", avio_tell(bc), nut->last_syncpoint_pos, nut->max_distance); return AVERROR_INVALIDDATA; } @@ -763,7 +763,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ av_new_packet(pkt, size + nut->header_len[header_idx]); memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]); - pkt->pos= url_ftell(bc); //FIXME + pkt->pos= avio_tell(bc); //FIXME avio_read(bc, pkt->data + nut->header_len[header_idx], size); pkt->stream_index = stream_id; @@ -782,7 +782,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t ts, back_ptr; for(;;){ - int64_t pos= url_ftell(bc); + int64_t pos= avio_tell(bc); uint64_t tmp= nut->next_startcode; nut->next_startcode=0; diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 078ffac0ba..8ecefb012e 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -639,13 +639,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ if(pkt->pts < 0) return -1; - if(1LL<<(20+3*nut->header_count) <= url_ftell(bc)) + if(1LL<<(20+3*nut->header_count) <= avio_tell(bc)) write_headers(s, bc); if(key_frame && !(nus->last_flags & FLAG_KEY)) store_sp= 1; - if(pkt->size + 30/*FIXME check*/ + url_ftell(bc) >= nut->last_syncpoint_pos + nut->max_distance) + if(pkt->size + 30/*FIXME check*/ + avio_tell(bc) >= nut->last_syncpoint_pos + nut->max_distance) store_sp= 1; //FIXME: Ensure store_sp is 1 in the first place. @@ -668,7 +668,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp, NULL); - nut->last_syncpoint_pos= url_ftell(bc); + nut->last_syncpoint_pos= avio_tell(bc); ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; diff --git a/libavformat/nuv.c b/libavformat/nuv.c index 6c7c563b85..6f4a03192d 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -197,7 +197,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { int ret, size; while (!url_feof(pb)) { int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0; - uint64_t pos = url_ftell(pb); + uint64_t pos = avio_tell(pb); ret = avio_read(pb, hdr, HDRSIZE); if (ret < HDRSIZE) return ret < 0 ? ret : AVERROR(EIO); diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index af9860bf53..ff6b69a508 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -62,7 +62,7 @@ ogg_save (AVFormatContext * s) struct ogg_state *ost = av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams)); int i; - ost->pos = url_ftell (s->pb); + ost->pos = avio_tell (s->pb); ost->curidx = ogg->curidx; ost->next = ogg->state; ost->nstreams = ogg->nstreams; @@ -247,7 +247,7 @@ ogg_read_page (AVFormatContext * s, int *str) } os = ogg->streams + idx; - os->page_pos = url_ftell(bc) - 27; + os->page_pos = avio_tell(bc) - 27; if(os->psize > 0) ogg_new_buf(ogg, idx); @@ -607,7 +607,7 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg, avio_seek(bc, *pos_arg, SEEK_SET); ogg_reset(ogg); - while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) { + while (avio_tell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) { if (i == stream_index) { pts = ogg_calc_pts(s, i, NULL); if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY)) diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 92591dde12..39e36c8b6b 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -67,7 +67,7 @@ typedef struct { static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset) { - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); uint32_t checksum = get_checksum(pb); avio_seek(pb, crc_offset, SEEK_SET); avio_wb32(pb, checksum); @@ -92,7 +92,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) avio_wl64(pb, page->granule); avio_wl32(pb, oggstream->serial_num); avio_wl32(pb, oggstream->page_counter++); - crc_offset = url_ftell(pb); + crc_offset = avio_tell(pb); avio_wl32(pb, 0); // crc avio_w8(pb, page->segments_count); avio_write(pb, page->segments, page->segments_count); diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index a0dc531ae6..744ae94459 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -186,7 +186,7 @@ static int str_read_packet(AVFormatContext *s, if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE)) return AVERROR(EIO); - pkt->pos= url_ftell(pb) - RAW_CD_SECTOR_SIZE; + pkt->pos= avio_tell(pb) - RAW_CD_SECTOR_SIZE; pkt->stream_index = str->channels[channel].video_stream_index; } diff --git a/libavformat/pva.c b/libavformat/pva.c index 8091baaeb8..a3b350e316 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -73,7 +73,7 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, int64_t pva_pts = AV_NOPTS_VALUE, startpos; recover: - startpos = url_ftell(pb); + startpos = avio_tell(pb); syncword = avio_rb16(pb); streamid = avio_r8(pb); @@ -190,7 +190,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, continue; } if (streamid - 1 != stream_index || res == AV_NOPTS_VALUE) { - *pos = url_ftell(pb) + length; + *pos = avio_tell(pb) + length; continue; } break; diff --git a/libavformat/qcp.c b/libavformat/qcp.c index 6222bd5db1..fefc929279 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -165,7 +165,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } - if (url_ftell(pb) & 1 && avio_r8(pb)) + if (avio_tell(pb) & 1 && avio_r8(pb)) av_log(s, AV_LOG_WARNING, "Padding should be 0.\n"); tag = avio_rl32(pb); diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 0e103b6aa4..6cda30fd31 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -38,7 +38,7 @@ typedef struct { static int read_atom(AVFormatContext *s, Atom *atom) { - atom->offset = url_ftell(s->pb); + atom->offset = avio_tell(s->pb); atom->size = avio_rb32(s->pb); if (atom->size < 8) return -1; @@ -175,7 +175,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } - s->data_offset = url_ftell(s->pb); + s->data_offset = avio_tell(s->pb); av_dlog(s, "data offset %#llx\n", s->data_offset); if (url_is_streamed(s->pb)) return 0; @@ -210,7 +210,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) { AVStream *st = s->streams[0]; int tmp, tmp2; - uint64_t pos = url_ftell(s->pb); + uint64_t pos = avio_tell(s->pb); unsigned dts; int ret; @@ -241,7 +241,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) tmp = avio_rb32(s->pb); av_dlog(s, "metadata len %d\n", tmp); } - tmp = atom->size - 8 - (url_ftell(s->pb) - pos); + tmp = atom->size - 8 - (avio_tell(s->pb) - pos); if (tmp < 0) return -1; ret = av_get_packet(s->pb, pkt, tmp); @@ -264,7 +264,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) { AVStream *st = s->streams[1]; int tmp, tmp2, samples, size; - uint64_t pos = url_ftell(s->pb); + uint64_t pos = avio_tell(s->pb); unsigned dts; int ret; @@ -287,7 +287,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) tmp = avio_rb32(s->pb); // unknown av_dlog(s, "unknown %d\n", tmp); - size = atom->size - 8 - (url_ftell(s->pb) - pos); + size = atom->size - 8 - (avio_tell(s->pb) - pos); if (size < 0) return -1; ret = av_get_packet(s->pb, pkt, size); diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 1c2f1211df..02718e79c0 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -80,7 +80,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM); - pkt->pos= url_ftell(s->pb); + pkt->pos= avio_tell(s->pb); pkt->stream_index = 0; ret = ffio_read_partial(s->pb, pkt->data, size); if (ret < 0) { diff --git a/libavformat/rdt.c b/libavformat/rdt.c index ce398963e6..36e61c02ed 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -305,7 +305,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, flags = (flags & RTP_FLAG_KEY) ? 2 : 0; res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt, &seq, flags, *timestamp); - pos = url_ftell(&pb); + pos = avio_tell(&pb); if (res < 0) return res; if (res > 0) { diff --git a/libavformat/riff.c b/libavformat/riff.c index 709aaad246..8f16b7a7f0 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -324,14 +324,14 @@ int64_t ff_start_tag(AVIOContext *pb, const char *tag) { ffio_wfourcc(pb, tag); avio_wl32(pb, 0); - return url_ftell(pb); + return avio_tell(pb); } void ff_end_tag(AVIOContext *pb, int64_t start) { int64_t pos; - pos = url_ftell(pb); + pos = avio_tell(pb); avio_seek(pb, start - 4, SEEK_SET); avio_wl32(pb, (uint32_t)(pos - start)); avio_seek(pb, pos, SEEK_SET); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 23f207595d..e2e9b0298c 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -131,17 +131,17 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, version = avio_rb16(pb); /* version */ if (version == 3) { int header_size = avio_rb16(pb); - int64_t startpos = url_ftell(pb); + int64_t startpos = avio_tell(pb); avio_seek(pb, 14, SEEK_CUR); rm_read_metadata(s, 0); - if ((startpos + header_size) >= url_ftell(pb) + 2) { + if ((startpos + header_size) >= avio_tell(pb) + 2) { // fourcc (should always be "lpcJ") avio_r8(pb); get_str8(pb, buf, sizeof(buf)); } // Skip extra header crap (this should never happen) - if ((startpos + header_size) > url_ftell(pb)) - avio_seek(pb, header_size + startpos - url_ftell(pb), SEEK_CUR); + if ((startpos + header_size) > avio_tell(pb)) + avio_seek(pb, header_size + startpos - avio_tell(pb), SEEK_CUR); st->codec->sample_rate = 8000; st->codec->channels = 1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -273,7 +273,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, int ret; av_set_pts_info(st, 64, 1, 1000); - codec_pos = url_ftell(pb); + codec_pos = avio_tell(pb); v = avio_rb32(pb); if (v == MKTAG(0xfd, 'a', 'r', '.')) { /* ra type header */ @@ -301,7 +301,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, fps2= avio_rb16(pb); avio_rb16(pb); - if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0) + if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0) return ret; // av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2); @@ -320,7 +320,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, skip: /* skip codec info */ - size = url_ftell(pb) - codec_pos; + size = avio_tell(pb) - codec_pos; avio_seek(pb, codec_data_size - size, SEEK_CUR); return 0; @@ -362,7 +362,7 @@ static int rm_read_index(AVFormatContext *s) } skip: - if (next_off && url_ftell(pb) != next_off && + if (next_off && avio_tell(pb) != next_off && avio_seek(pb, next_off, SEEK_SET) < 0) return -1; } while (next_off); @@ -480,7 +480,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rb32(pb); /* next data header */ if (!data_off) - data_off = url_ftell(pb) - 18; + data_off = avio_tell(pb) - 18; if (indx_off && !url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX) && avio_seek(pb, indx_off, SEEK_SET) >= 0) { rm_read_index(s); @@ -517,7 +517,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ while(!url_feof(pb)){ int len, num, i; - *pos= url_ftell(pb) - 3; + *pos= avio_tell(pb) - 3; if(rm->remaining_len > 0){ num= rm->current_stream; len= rm->remaining_len; @@ -624,7 +624,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, vst->videobufpos = 8*vst->slices + 1; vst->cur_slice = 0; vst->curpic_num = pic_num; - vst->pktpos = url_ftell(pb); + vst->pktpos = avio_tell(pb); } if(type == 2) len = FFMIN(len, pos); @@ -841,7 +841,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) len = !ast->audio_framesize ? RAW_PACKET_SIZE : ast->coded_framesize * ast->sub_packet_h / 2; flags = (seq++ == 1) ? 2 : 0; - pos = url_ftell(s->pb); + pos = avio_tell(s->pb); } else { len=sync(s, ×tamp, &flags, &i, &pos); if (len > 0) diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index c776a1ac2a..fc7df76f76 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -77,7 +77,7 @@ static int rso_write_trailer(AVFormatContext *s) int64_t file_size; uint16_t coded_file_size; - file_size = url_ftell(pb); + file_size = avio_tell(pb); if (file_size < 0) return file_size; diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 7d0bf67214..8c4969111c 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -114,7 +114,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) if (ret < 0) return ret; av_metadata_copy(&s->metadata, rt->asf_ctx->metadata, 0); - rt->asf_pb_pos = url_ftell(&pb); + rt->asf_pb_pos = avio_tell(&pb); av_free(buf); rt->asf_ctx->pb = NULL; } @@ -179,8 +179,8 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, ffio_init_context(pb, buf, len, 0, NULL, NULL, NULL, NULL); - while (url_ftell(pb) + 4 < len) { - int start_off = url_ftell(pb); + while (avio_tell(pb) + 4 < len) { + int start_off = avio_tell(pb); mflags = avio_r8(pb); if (mflags & 0x80) @@ -192,7 +192,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, avio_seek(pb, 4, SEEK_CUR); if (mflags & 0x8) /**< has location ID */ avio_seek(pb, 4, SEEK_CUR); - off = url_ftell(pb); + off = avio_tell(pb); if (!(mflags & 0x40)) { /** @@ -201,7 +201,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, * ASF packet. This is used to spread one ASF packet over * multiple RTP packets. */ - if (asf->pktbuf && len_off != url_ftell(asf->pktbuf)) { + if (asf->pktbuf && len_off != avio_tell(asf->pktbuf)) { uint8_t *p; url_close_dyn_buf(asf->pktbuf, &p); asf->pktbuf = NULL; @@ -248,7 +248,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, int i; res = av_read_packet(rt->asf_ctx, pkt); - rt->asf_pb_pos = url_ftell(pb); + rt->asf_pb_pos = avio_tell(pb); if (res != 0) break; for (i = 0; i < s->nb_streams; i++) { diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 5cf5223c84..4041a0fca5 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -115,10 +115,10 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, if (pos + data_len > len) return AVERROR_INVALIDDATA; /* TLVs */ - while (url_ftell(&pb) + 4 < pos + data_len) { + while (avio_tell(&pb) + 4 < pos + data_len) { int tlv_len = avio_rb16(&pb); tag = avio_rl16(&pb); - if (url_ftell(&pb) + tlv_len > pos + data_len) + if (avio_tell(&pb) + tlv_len > pos + data_len) return AVERROR_INVALIDDATA; #define MKTAG16(a,b) MKTAG(a,b,0,0) @@ -155,7 +155,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, } /* 32-bit alignment */ - avio_seek(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb), SEEK_CUR); + avio_seek(&pb, ((avio_tell(&pb) + 3) & ~3) - avio_tell(&pb), SEEK_CUR); } else avio_seek(&pb, 4, SEEK_SET); @@ -164,7 +164,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, return AVERROR_NOTSUPP; } - alen = len - url_ftell(&pb); + alen = len - avio_tell(&pb); if (alen <= 0) return AVERROR_INVALIDDATA; @@ -182,7 +182,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, } if (!qt->pkt.data) return AVERROR(ENOMEM); - memcpy(qt->pkt.data + qt->pkt.size, buf + url_ftell(&pb), alen); + memcpy(qt->pkt.data + qt->pkt.size, buf + avio_tell(&pb), alen); qt->pkt.size += alen; if (has_marker_bit) { *pkt = qt->pkt; @@ -203,7 +203,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, 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); + memcpy(pkt->data, buf + avio_tell(&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) { @@ -215,7 +215,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, } qt->pkt.size = qt->remaining * qt->bytes_per_frame; memcpy(qt->pkt.data, - buf + url_ftell(&pb) + qt->bytes_per_frame, + buf + avio_tell(&pb) + qt->bytes_per_frame, qt->remaining * qt->bytes_per_frame); qt->pkt.flags = pkt->flags; return 1; diff --git a/libavformat/seek.c b/libavformat/seek.c index 9fee91101c..dd6109b68c 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -405,7 +405,7 @@ AVParserState *ff_store_parser_state(AVFormatContext *s) return NULL; } - state->fpos = url_ftell(s->pb); + state->fpos = avio_tell(s->pb); // copy context structures state->cur_st = s->cur_st; diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 7b689906cc..ae194d496b 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -222,7 +222,7 @@ static int film_read_packet(AVFormatContext *s, /* do a special song and dance when loading FILM Cinepak chunks */ if ((sample->stream == film->video_stream_index) && (film->video_type == CODEC_ID_CINEPAK)) { - pkt->pos= url_ftell(pb); + pkt->pos= avio_tell(pb); if (av_new_packet(pkt, sample->sample_size)) return AVERROR(ENOMEM); avio_read(pb, pkt->data, sample->sample_size); @@ -240,7 +240,7 @@ static int film_read_packet(AVFormatContext *s, film->stereo_buffer = av_malloc(film->stereo_buffer_size); } - pkt->pos= url_ftell(pb); + pkt->pos= avio_tell(pb); ret = avio_read(pb, film->stereo_buffer, sample->sample_size); if (ret != sample->sample_size) ret = AVERROR(EIO); diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 778746594a..0fa1142c0b 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -247,7 +247,7 @@ static int vmd_read_packet(AVFormatContext *s, if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD)) return AVERROR(ENOMEM); - pkt->pos= url_ftell(pb); + pkt->pos= avio_tell(pb); memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD); if(vmd->is_indeo3) ret = avio_read(pb, pkt->data, frame->frame_size); diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 8feb4e5f69..2603a4d71c 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -219,7 +219,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) ((int32_t*)st->codec->extradata)[3] = av_le2ne32(smk->type_size); smk->curstream = -1; - smk->nextpos = url_ftell(pb); + smk->nextpos = avio_tell(pb); return 0; } @@ -244,7 +244,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) frame_size = smk->frm_size[smk->cur_frame] & (~3); flags = smk->frm_flags[smk->cur_frame]; /* handle palette change event */ - pos = url_ftell(s->pb); + pos = avio_tell(s->pb); if(flags & SMACKER_PAL){ int size, sz, t, off, j, pos; uint8_t *pal = smk->pal; @@ -256,7 +256,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) frame_size -= size; frame_size--; sz = 0; - pos = url_ftell(s->pb) + size; + pos = avio_tell(s->pb) + size; while(sz < 256){ t = avio_r8(s->pb); if(t & 0x80){ /* skip palette entries */ @@ -313,7 +313,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->stream_index = smk->videoindex; pkt->size = ret + 769; smk->cur_frame++; - smk->nextpos = url_ftell(s->pb); + smk->nextpos = avio_tell(s->pb); } else { if (av_new_packet(pkt, smk->buf_sizes[smk->curstream])) return AVERROR(ENOMEM); diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index dbb2972ead..fb68d0b908 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -98,7 +98,7 @@ static int sox_write_trailer(AVFormatContext *s) if (!url_is_streamed(s->pb)) { /* update number of samples */ - int64_t file_size = url_ftell(pb); + int64_t file_size = avio_tell(pb); int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL; avio_seek(pb, 8, SEEK_SET); if (enc->codec_id == CODEC_ID_PCM_S32LE) { diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index b2194ea283..8a6b79dd52 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -185,7 +185,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) if (ret) return ret; - pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE; + pkt->pos = avio_tell(pb) - BURST_HEADER_SIZE; if (avio_read(pb, pkt->data, pkt->size) < pkt->size) { av_free_packet(pkt); diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index 17de8c91f5..0a94a7f518 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -75,7 +75,7 @@ static inline int is_eol(char c) static int srt_read_packet(AVFormatContext *s, AVPacket *pkt) { char buffer[2048], *ptr = buffer, *ptr2; - int64_t pos = url_ftell(s->pb); + int64_t pos = avio_tell(s->pb); int res = AVERROR_EOF; do { diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index b96b229133..c63052c66c 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -87,7 +87,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) int tag, len, i, frame, v; for(;;) { - uint64_t pos = url_ftell(pb); + uint64_t pos = avio_tell(pb); tag = get_swf_tag(pb, &len); if (tag < 0) return AVERROR(EIO); diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index c898c0ec5f..182cb65660 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -29,7 +29,7 @@ static void put_swf_tag(AVFormatContext *s, int tag) SWFContext *swf = s->priv_data; AVIOContext *pb = s->pb; - swf->tag_pos = url_ftell(pb); + swf->tag_pos = avio_tell(pb); swf->tag = tag; /* reserve some room for the tag */ if (tag & TAG_LONG) { @@ -47,7 +47,7 @@ static void put_swf_end_tag(AVFormatContext *s) int64_t pos; int tag_len, tag; - pos = url_ftell(pb); + pos = avio_tell(pb); tag_len = pos - swf->tag_pos - 2; tag = swf->tag; avio_seek(pb, swf->tag_pos, SEEK_SET); @@ -246,7 +246,7 @@ static int swf_write_header(AVFormatContext *s) put_swf_rect(pb, 0, width * 20, 0, height * 20); avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */ - swf->duration_pos = url_ftell(pb); + swf->duration_pos = avio_tell(pb); avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */ /* avm2/swf v9 (also v8?) files require a file attribute tag */ @@ -346,7 +346,7 @@ static int swf_write_video(AVFormatContext *s, /* create a new video object */ put_swf_tag(s, TAG_VIDEOSTREAM); avio_wl16(pb, VIDEO_ID); - swf->vframes_pos = url_ftell(pb); + swf->vframes_pos = avio_tell(pb); avio_wl16(pb, 15000); /* hard flash player limit */ avio_wl16(pb, enc->width); avio_wl16(pb, enc->height); @@ -493,7 +493,7 @@ static int swf_write_trailer(AVFormatContext *s) /* patch file size and number of frames if not streamed */ if (!url_is_streamed(s->pb) && video_enc) { - file_size = url_ftell(pb); + file_size = avio_tell(pb); avio_seek(pb, 4, SEEK_SET); avio_wl32(pb, file_size); avio_seek(pb, swf->duration_pos, SEEK_SET); diff --git a/libavformat/tta.c b/libavformat/tta.c index 221cdf3e0a..8669057fbd 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -46,7 +46,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); - start_offset = url_ftell(s->pb); + start_offset = avio_tell(s->pb); if (avio_rl32(s->pb) != AV_RL32("TTA1")) return -1; // not tta file @@ -84,7 +84,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) st->start_time = 0; st->duration = datalen; - framepos = url_ftell(s->pb) + 4*c->totalframes + 4; + framepos = avio_tell(s->pb) + 4*c->totalframes + 4; for (i = 0; i < c->totalframes; i++) { uint32_t size = avio_rl32(s->pb); @@ -99,7 +99,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->sample_rate = samplerate; st->codec->bits_per_coded_sample = bps; - st->codec->extradata_size = url_ftell(s->pb) - start_offset; + st->codec->extradata_size = avio_tell(s->pb) - start_offset; if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){ //this check is redundant as avio_read should fail av_log(s, AV_LOG_ERROR, "extradata_size too large\n"); diff --git a/libavformat/tty.c b/libavformat/tty.c index 74750584c1..dabbe972cb 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -112,7 +112,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) n = s->chars_per_frame; if (s->fsize) { // ignore metadata buffer - uint64_t p = url_ftell(avctx->pb); + uint64_t p = avio_tell(avctx->pb); if (p + s->chars_per_frame > s->fsize) n = s->fsize - p; } diff --git a/libavformat/utils.c b/libavformat/utils.c index f48ed2ab1c..91bc4a2025 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -330,7 +330,7 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size) if(ret<0) return ret; - pkt->pos= url_ftell(s); + pkt->pos= avio_tell(s); ret= avio_read(s, pkt->data, size); if(ret<=0) @@ -490,7 +490,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, } if (pb && !ic->data_offset) - ic->data_offset = url_ftell(ic->pb); + ic->data_offset = avio_tell(ic->pb); #if FF_API_OLD_METADATA ff_metadata_demux_compat(ic); @@ -2212,7 +2212,7 @@ int av_find_stream_info(AVFormatContext *ic) int i, count, ret, read_size, j; AVStream *st; AVPacket pkt1, *pkt; - int64_t old_offset = url_ftell(ic->pb); + int64_t old_offset = avio_tell(ic->pb); for(i=0;inb_streams;i++) { AVCodec *codec; diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index cb496bf7c2..07aeb8b321 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -80,7 +80,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) if (!voc->remaining_size) { if (url_is_streamed(s->pb)) return AVERROR(EIO); - voc->remaining_size = url_fsize(pb) - url_ftell(pb); + voc->remaining_size = url_fsize(pb) - avio_tell(pb); } max_size -= 4; diff --git a/libavformat/vqf.c b/libavformat/vqf.c index fb440af2fd..49ed8b4e95 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -200,7 +200,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt) int ret; int size = (c->frame_bit_len - c->remaining_bits + 7)>>3; - pkt->pos = url_ftell(s->pb); + pkt->pos = avio_tell(s->pb); pkt->stream_index = 0; if (av_new_packet(pkt, size+2) < 0) diff --git a/libavformat/wav.c b/libavformat/wav.c index d6329e326a..8023a791f3 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -102,7 +102,7 @@ static int wav_write_trailer(AVFormatContext *s) ff_end_tag(pb, wav->data); /* update file size */ - file_size = url_ftell(pb); + file_size = avio_tell(pb); avio_seek(pb, 4, SEEK_SET); avio_wl32(pb, (uint32_t)(file_size - 8)); avio_seek(pb, file_size, SEEK_SET); @@ -252,7 +252,7 @@ static int wav_read_header(AVFormatContext *s, if (!size) { wav->data_end = INT64_MAX; } else - wav->data_end= url_ftell(pb) + size; + wav->data_end= avio_tell(pb) + size; if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id)) sample_count = (size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); @@ -296,7 +296,7 @@ static int wav_read_packet(AVFormatContext *s, st = s->streams[0]; - left = wav->data_end - url_ftell(s->pb); + left = wav->data_end - avio_tell(s->pb); if (left <= 0){ if (CONFIG_W64_DEMUXER && wav->w64) left = find_guid(s->pb, guid_data) - 24; @@ -304,7 +304,7 @@ static int wav_read_packet(AVFormatContext *s, left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a')); if (left < 0) return AVERROR_EOF; - wav->data_end= url_ftell(s->pb) + left; + wav->data_end= avio_tell(s->pb) + left; } size = MAX_SIZE; @@ -421,7 +421,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "could not find data guid\n"); return -1; } - wav->data_end = url_ftell(pb) + size - 24; + wav->data_end = avio_tell(pb) + size - 24; wav->w64 = 1; return 0; diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 6b8a58daeb..ade4a42e1b 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -468,7 +468,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) char description[1024]; unsigned int filesize; AVStream *st; - int64_t pos = url_ftell(pb); + int64_t pos = avio_tell(pb); avio_get_str16le(pb, INT_MAX, mime, sizeof(mime)); if (strcmp(mime, "image/jpeg")) @@ -980,7 +980,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) return ret; avio_seek(wtv->pb, -32, SEEK_CUR); - timeline_pos = url_ftell(s->pb); // save before opening another file + timeline_pos = avio_tell(s->pb); // save before opening another file /* read metadata */ pb = wtvfile_open(s, root, root_size, table_0_entries_legacy_attrib_le16); diff --git a/libavformat/wv.c b/libavformat/wv.c index 7a2c855f9d..1b6061ce43 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -84,7 +84,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen int rate, bpp, chan; uint32_t chmask; - wc->pos = url_ftell(pb); + wc->pos = avio_tell(pb); if(!append){ tag = avio_rl32(pb); if (tag != MKTAG('w', 'v', 'p', 'k')) @@ -120,12 +120,12 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen chmask = wc->chmask; } if((rate == -1 || !chan) && !wc->block_parsed){ - int64_t block_end = url_ftell(pb) + wc->blksize - 24; + int64_t block_end = avio_tell(pb) + wc->blksize - 24; if(url_is_streamed(pb)){ av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n"); return -1; } - while(url_ftell(pb) < block_end){ + while(avio_tell(pb) < block_end){ int id, size; id = avio_r8(pb); size = (id & 0x80) ? avio_rl24(pb) : avio_r8(pb); @@ -224,7 +224,7 @@ static int wv_read_header(AVFormatContext *s, st->duration = wc->samples; if(!url_is_streamed(s->pb)) { - int64_t cur = url_ftell(s->pb); + int64_t cur = avio_tell(s->pb); ff_ape_parse_tag(s); if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); @@ -327,7 +327,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, if(timestamp < 0 || timestamp >= s->duration) return -1; - pos = url_ftell(s->pb); + pos = avio_tell(s->pb); do{ ret = av_read_frame(s, pkt); if (ret < 0){ diff --git a/libavformat/yop.c b/libavformat/yop.c index e4437b7a0e..6c450c7cf7 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -136,7 +136,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) return ret; - yop->video_packet.pos = url_ftell(pb); + yop->video_packet.pos = avio_tell(pb); ret = avio_read(pb, yop->video_packet.data, yop->palette_size); if (ret < 0) { From b35743ffb46558be3a90c44f24a7de5fa2c15d85 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 4 Mar 2011 16:25:17 -0500 Subject: [PATCH 499/528] ac3: define AC3_MAX_CPL_BANDS and use it in ac3dec.h --- libavcodec/ac3.h | 1 + libavcodec/ac3dec.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h index 405e3cd0a3..5e0b2621aa 100644 --- a/libavcodec/ac3.h +++ b/libavcodec/ac3.h @@ -36,6 +36,7 @@ #define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256) #define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2) #define AC3_CRITICAL_BANDS 50 +#define AC3_MAX_CPL_BANDS 18 #include "ac3tab.h" diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index 147e5e59bc..a5b1111123 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -103,12 +103,12 @@ typedef struct { int cpl_strategy_exists[AC3_MAX_BLOCKS];///< coupling strategy exists (cplstre) int channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl) int phase_flags_in_use; ///< phase flags in use (phsflginu) - int phase_flags[18]; ///< phase flags (phsflg) + int phase_flags[AC3_MAX_CPL_BANDS]; ///< phase flags (phsflg) int num_cpl_bands; ///< number of coupling bands (ncplbnd) - uint8_t cpl_band_sizes[18]; ///< number of coeffs in each coupling band + uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]; ///< number of coeffs in each coupling band int firstchincpl; ///< first channel in coupling int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states (firstcplcos) - int cpl_coords[AC3_MAX_CHANNELS][18]; ///< coupling coordinates (cplco) + int cpl_coords[AC3_MAX_CHANNELS][AC3_MAX_CPL_BANDS]; ///< coupling coordinates (cplco) ///@} ///@defgroup spx spectral extension From 53e35fd340d75c40395e4446b76a72bb1962899b Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 4 Mar 2011 16:41:49 -0500 Subject: [PATCH 500/528] ac3enc: add num_rematrixing_bands to AC3EncodeContext and use it instead of the hardcoded value. Currently it is always 4, but this change will allow it to be adjusted when bandwidth-related features are added such as channel coupling, enhanced channel coupling, and spectral extension. --- libavcodec/ac3enc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 02bc403f82..676bb5e13c 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -117,6 +117,7 @@ typedef struct AC3EncodeContext { int nb_coefs[AC3_MAX_CHANNELS]; int rematrixing; ///< determines how rematrixing strategy is calculated + int num_rematrixing_bands; ///< number of rematrixing bands /* bitrate allocation control */ int slow_gain_code; ///< slow gain code (sgaincod) @@ -305,6 +306,8 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) int blk, bnd, i; AC3Block *block, *block0; + s->num_rematrixing_bands = 4; + if (s->rematrixing & AC3_REMATRIXING_IS_STATIC) return; @@ -313,7 +316,7 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { block = &s->blocks[blk]; block->new_rematrixing_strategy = !blk; - for (bnd = 0; bnd < 4; bnd++) { + for (bnd = 0; bnd < s->num_rematrixing_bands; bnd++) { /* calculate calculate sum of squared coeffs for one band in one block */ int start = ff_ac3_rematrix_band_tab[bnd]; int end = FFMIN(nb_coefs, ff_ac3_rematrix_band_tab[bnd+1]); @@ -365,7 +368,7 @@ static void apply_rematrixing(AC3EncodeContext *s) AC3Block *block = &s->blocks[blk]; if (block->new_rematrixing_strategy) flags = block->rematrixing_flags; - for (bnd = 0; bnd < 4; bnd++) { + for (bnd = 0; bnd < s->num_rematrixing_bands; bnd++) { if (flags[bnd]) { start = ff_ac3_rematrix_band_tab[bnd]; end = FFMIN(nb_coefs, ff_ac3_rematrix_band_tab[bnd+1]); @@ -785,7 +788,7 @@ static void count_frame_bits(AC3EncodeContext *s) /* stereo rematrixing */ if (s->channel_mode == AC3_CHMODE_STEREO && s->blocks[blk].new_rematrixing_strategy) { - frame_bits += 4; + frame_bits += s->num_rematrixing_bands; } for (ch = 0; ch < s->fbw_channels; ch++) { @@ -1304,7 +1307,7 @@ static void output_audio_block(AC3EncodeContext *s, int blk) put_bits(&s->pb, 1, block->new_rematrixing_strategy); if (block->new_rematrixing_strategy) { /* rematrixing flags */ - for (rbnd = 0; rbnd < 4; rbnd++) + for (rbnd = 0; rbnd < s->num_rematrixing_bands; rbnd++) put_bits(&s->pb, 1, block->rematrixing_flags[rbnd]); } } From 391a1327bd076c25c2b2509ab7ae0081c443b94e Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 24 Feb 2011 21:25:53 +0000 Subject: [PATCH 501/528] yadif: add parens around macro parameters This fixes compilation with preprocessors which do not add whitespace around replaced tokens, resulting in invalid expressions like 1--1. Signed-off-by: Mans Rullgard --- libavfilter/vf_yadif.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index bd0a9de877..f81ee8a2c7 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -73,12 +73,12 @@ static void filter_line_c(uint8_t *dst, + 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]);\ + { 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;\ + spatial_pred= (cur[-refs +(j)] + cur[+refs -(j)])>>1;\ CHECK(-1) CHECK(-2) }} }} CHECK( 1) CHECK( 2) }} }} From f3bea9915fdc87c3f5b635fcfe0250a28e2b1a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 28 Feb 2011 15:39:17 +0200 Subject: [PATCH 502/528] URLProtocol: Add a flags field Signed-off-by: Luca Barbato --- libavformat/avio.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/avio.h b/libavformat/avio.h index be15f8acb6..fd18f0d8ea 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -295,6 +295,7 @@ typedef struct URLProtocol { int (*url_get_file_handle)(URLContext *h); int priv_data_size; const AVClass *priv_data_class; + int flags; } URLProtocol; #if FF_API_REGISTER_PROTOCOL From 8f73c060773156cbf48e153506a38bcb6e2c4c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 28 Feb 2011 15:39:36 +0200 Subject: [PATCH 503/528] URLProtocol: Add URL_PROTOCOL_FLAG_NESTED_SCHEME If this flag is set, the protocol can handle URLs where the scheme is a nested scheme such as applehttp+file: - the protocol can handle any URL where the first segment of the nested scheme belongs to this protocol. Signed-off-by: Luca Barbato --- libavformat/avio.c | 9 ++++++++- libavformat/avio.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index a19ec37cb1..4ab1b6bd75 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -175,7 +175,7 @@ int url_open_protocol (URLContext **puc, struct URLProtocol *up, int url_alloc(URLContext **puc, const char *filename, int flags) { URLProtocol *up; - char proto_str[128]; + char proto_str[128], proto_nested[128], *ptr; size_t proto_len = strspn(filename, URL_SCHEME_CHARS); if (filename[proto_len] != ':' || is_dos_path(filename)) @@ -183,10 +183,17 @@ int url_alloc(URLContext **puc, const char *filename, int flags) else av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str))); + av_strlcpy(proto_nested, proto_str, sizeof(proto_nested)); + if ((ptr = strchr(proto_nested, '+'))) + *ptr = '\0'; + up = first_protocol; while (up != NULL) { if (!strcmp(proto_str, up->name)) return url_alloc_for_protocol (puc, up, filename, flags); + if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && + !strcmp(proto_nested, up->name)) + return url_alloc_for_protocol (puc, up, filename, flags); up = up->next; } *puc = NULL; diff --git a/libavformat/avio.h b/libavformat/avio.h index fd18f0d8ea..acdd0c1bd0 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -281,6 +281,8 @@ int64_t av_url_read_seek(URLContext *h, int stream_index, */ #define AVSEEK_FORCE 0x20000 +#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ + typedef struct URLProtocol { const char *name; int (*url_open)(URLContext *h, const char *url, int flags); From f4f4e12c0d4e86c4900481b7dca94d22e733c14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 22 Jul 2010 10:30:15 +0300 Subject: [PATCH 504/528] Add Apple HTTP Live Streaming protocol handler Signed-off-by: Luca Barbato --- doc/general.texi | 1 + libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/applehttpproto.c | 358 +++++++++++++++++++++++++++++++++++ 4 files changed, 361 insertions(+) create mode 100644 libavformat/applehttpproto.c diff --git a/doc/general.texi b/doc/general.texi index cd126f9868..b7fd12938c 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -707,6 +707,7 @@ performance on systems without hardware floating point support). @multitable @columnfractions .4 .1 @item Name @tab Support +@item Apple HTTP Live Streaming @tab X @item file @tab X @item Gopher @tab X @item HTTP @tab X diff --git a/libavformat/Makefile b/libavformat/Makefile index f319031c26..eb9ca49e4d 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -308,6 +308,7 @@ OBJS-$(CONFIG_LIBNUT_MUXER) += libnut.o riff.o # protocols I/O OBJS+= avio.o aviobuf.o +OBJS-$(CONFIG_APPLEHTTP_PROTOCOL) += applehttpproto.o OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o OBJS-$(CONFIG_FILE_PROTOCOL) += file.o OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 0ff4b5aa8e..562f6248a5 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -229,6 +229,7 @@ void av_register_all(void) REGISTER_MUXDEMUX (LIBNUT, libnut); /* protocols */ + REGISTER_PROTOCOL (APPLEHTTP, applehttp); REGISTER_PROTOCOL (CONCAT, concat); REGISTER_PROTOCOL (FILE, file); REGISTER_PROTOCOL (GOPHER, gopher); diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c new file mode 100644 index 0000000000..471f94bd2a --- /dev/null +++ b/libavformat/applehttpproto.c @@ -0,0 +1,358 @@ +/* + * Apple HTTP Live Streaming Protocol Handler + * 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 Protocol Handler + * 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]; +}; + +struct variant { + int bandwidth; + char url[MAX_URL_SIZE]; +}; + +typedef struct AppleHTTPContext { + char playlisturl[MAX_URL_SIZE]; + int target_duration; + int start_seq_no; + int finished; + int n_segments; + struct segment **segments; + int n_variants; + struct variant **variants; + int cur_seq_no; + URLContext *seg_hd; + int64_t last_load_time; +} AppleHTTPContext; + +static int read_chomp_line(AVIOContext *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; + /* Absolute path, relative to the current server */ + if (base && strstr(base, "://") && rel[0] == '/') { + if (base != buf) + av_strlcpy(buf, base, size); + sep = strstr(buf, "://"); + if (sep) { + sep += 3; + sep = strchr(sep, '/'); + if (sep) + *sep = '\0'; + } + av_strlcat(buf, rel, size); + return; + } + /* 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(AppleHTTPContext *s) +{ + int i; + for (i = 0; i < s->n_segments; i++) + av_free(s->segments[i]); + av_freep(&s->segments); + s->n_segments = 0; +} + +static void free_variant_list(AppleHTTPContext *s) +{ + int i; + for (i = 0; i < s->n_variants; i++) + av_free(s->variants[i]); + av_freep(&s->variants); + s->n_variants = 0; +} + +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(URLContext *h, const char *url) +{ + AppleHTTPContext *s = h->priv_data; + AVIOContext *in; + int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0; + char line[1024]; + const char *ptr; + + if ((ret = avio_open(&in, url, URL_RDONLY)) < 0) + return ret; + + read_chomp_line(in, line, sizeof(line)); + if (strcmp(line, "#EXTM3U")) + return AVERROR_INVALIDDATA; + + free_segment_list(s); + s->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)) { + s->target_duration = atoi(ptr); + } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) { + s->start_seq_no = atoi(ptr); + } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) { + s->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_segment) { + struct segment *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(&s->segments, &s->n_segments, seg); + is_segment = 0; + } else if (is_variant) { + struct variant *var = av_malloc(sizeof(struct variant)); + if (!var) { + ret = AVERROR(ENOMEM); + goto fail; + } + var->bandwidth = bandwidth; + make_absolute_url(var->url, sizeof(var->url), url, line); + dynarray_add(&s->variants, &s->n_variants, var); + is_variant = 0; + } + } + } + s->last_load_time = av_gettime(); + +fail: + avio_close(in); + return ret; +} + +static int applehttp_open(URLContext *h, const char *uri, int flags) +{ + AppleHTTPContext *s; + int ret, i; + const char *nested_url; + + if (flags & (URL_WRONLY | URL_RDWR)) + return AVERROR_NOTSUPP; + + s = av_mallocz(sizeof(AppleHTTPContext)); + if (!s) + return AVERROR(ENOMEM); + h->priv_data = s; + h->is_streamed = 1; + + if (av_strstart(uri, "applehttp+", &nested_url)) { + av_strlcpy(s->playlisturl, nested_url, sizeof(s->playlisturl)); + } else if (av_strstart(uri, "applehttp://", &nested_url)) { + av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl)); + av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl)); + } else { + av_log(NULL, AV_LOG_ERROR, "Unsupported url %s\n", uri); + ret = AVERROR(EINVAL); + goto fail; + } + + if ((ret = parse_playlist(h, s->playlisturl)) < 0) + goto fail; + + if (s->n_segments == 0 && s->n_variants > 0) { + int max_bandwidth = 0, maxvar = -1; + for (i = 0; i < s->n_variants; i++) { + if (s->variants[i]->bandwidth > max_bandwidth || i == 0) { + max_bandwidth = s->variants[i]->bandwidth; + maxvar = i; + } + } + av_strlcpy(s->playlisturl, s->variants[maxvar]->url, + sizeof(s->playlisturl)); + if ((ret = parse_playlist(h, s->playlisturl)) < 0) + goto fail; + } + + if (s->n_segments == 0) { + av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); + ret = AVERROR(EIO); + goto fail; + } + s->cur_seq_no = s->start_seq_no; + if (!s->finished && s->n_segments >= 3) + s->cur_seq_no = s->start_seq_no + s->n_segments - 3; + + return 0; + +fail: + av_free(s); + return ret; +} + +static int applehttp_read(URLContext *h, uint8_t *buf, int size) +{ + AppleHTTPContext *s = h->priv_data; + const char *url; + int ret; + +start: + if (s->seg_hd) { + ret = url_read(s->seg_hd, buf, size); + if (ret > 0) + return ret; + } + if (s->seg_hd) { + url_close(s->seg_hd); + s->seg_hd = NULL; + s->cur_seq_no++; + } +retry: + if (!s->finished) { + int64_t now = av_gettime(); + if (now - s->last_load_time >= s->target_duration*1000000) + if ((ret = parse_playlist(h, s->playlisturl)) < 0) + return ret; + } + if (s->cur_seq_no < s->start_seq_no) { + av_log(NULL, AV_LOG_WARNING, + "skipping %d segments ahead, expired from playlist\n", + s->start_seq_no - s->cur_seq_no); + s->cur_seq_no = s->start_seq_no; + } + if (s->cur_seq_no - s->start_seq_no >= s->n_segments) { + if (s->finished) + return AVERROR_EOF; + while (av_gettime() - s->last_load_time < s->target_duration*1000000) { + if (url_interrupt_cb()) + return AVERROR(EINTR); + usleep(100*1000); + } + goto retry; + } + url = s->segments[s->cur_seq_no - s->start_seq_no]->url, + av_log(NULL, AV_LOG_DEBUG, "opening %s\n", url); + ret = url_open(&s->seg_hd, url, URL_RDONLY); + if (ret < 0) { + if (url_interrupt_cb()) + return AVERROR(EINTR); + av_log(NULL, AV_LOG_WARNING, "Unable to open %s\n", url); + s->cur_seq_no++; + goto retry; + } + goto start; +} + +static int applehttp_close(URLContext *h) +{ + AppleHTTPContext *s = h->priv_data; + + free_segment_list(s); + free_variant_list(s); + url_close(s->seg_hd); + av_free(s); + return 0; +} + +URLProtocol ff_applehttp_protocol = { + "applehttp", + applehttp_open, + applehttp_read, + NULL, /* write */ + NULL, /* seek */ + applehttp_close, + .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, +}; From 02dd3666c2944a3db44ba13916ba40dbdd41f9b1 Mon Sep 17 00:00:00 2001 From: Sean McGovern Date: Thu, 3 Mar 2011 22:22:43 -0500 Subject: [PATCH 505/528] h264_mp3toannexb_bsg: don't crash, but warn, if PPS/SPS not found. Should an AVC-1 in MP4 stream not contain SPS or PPS NAL units, this BSF is then unable to allocate an output buffer for the modified stream. Warn that the resulting stream may be unplayable. Fix roundup issue #2386. Signed-off-by: Ronald S. Bultje --- libavcodec/h264_mp4toannexb_bsf.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index d4a7f31937..e7f2e7ab04 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -75,7 +75,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, if (!ctx->extradata_parsed) { uint16_t unit_size; uint64_t total_size = 0; - uint8_t *out = NULL, unit_nb, sps_done = 0; + uint8_t *out = NULL, unit_nb, sps_done = 0, sps_seen = 0, pps_seen = 0; const uint8_t *extradata = avctx->extradata+4; static const uint8_t nalu_header[4] = {0, 0, 0, 1}; @@ -89,7 +89,15 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, if (!unit_nb) { unit_nb = *extradata++; /* number of pps unit(s) */ sps_done++; + + if (unit_nb) + pps_seen = 1; } + else + { + sps_seen = 1; + } + while (unit_nb--) { void *tmp; @@ -114,7 +122,14 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, unit_nb = *extradata++; /* number of pps unit(s) */ } - memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + if(out) + memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + + if (!sps_seen) + av_log(avctx, AV_LOG_WARNING, "Warning: SPS NALU missing or invalid. The resulting stream may not play.\n"); + if (!pps_seen) + av_log(avctx, AV_LOG_WARNING, "Warning: PPS NALU missing or invalid. The resulting stream may not play.\n"); + av_free(avctx->extradata); avctx->extradata = out; avctx->extradata_size = total_size; From 2af07d36fc0e9f7e10e07b6336748a73ae2e2909 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Thu, 3 Mar 2011 22:37:05 +1100 Subject: [PATCH 506/528] avio: add avio_skip macro This is a substitute for the url_fskip function that was deprecated by commit 0300db8ad778a194b4a8ec98f6da3de5b41c46ee. avio_fskip is provided to improve demuxer code readability. It distinguishes the act of skipping over unknown or irrelevant bytes from the standard avio_seek operation. Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/avio.h b/libavformat/avio.h index acdd0c1bd0..a998808788 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -473,6 +473,12 @@ int avio_put_str16le(AVIOContext *s, const char *str); */ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); +/** + * Skip given number of bytes forward + * @return new position or AVERROR. + */ +#define avio_skip(s, offset) avio_seek(s, offset, SEEK_CUR) + /** * ftell() equivalent for AVIOContext. * @return position or AVERROR. From 655e45e7dfafc494044cc52f8889fc6da75eff6a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 6 Mar 2011 18:04:46 +0100 Subject: [PATCH 507/528] avio: deprecate url_fgets It's not used anywhere and doesn't look ver useful to be public. Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 4 +++- libavformat/aviobuf.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index a998808788..a3bf5c01d4 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -514,9 +514,11 @@ int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ int url_fprintf(AVIOContext *s, const char *fmt, ...); #endif +#if FF_API_OLD_AVIO /** @note unlike fgets, the EOL character is not returned and a whole line is parsed. return NULL if first char read was EOF */ -char *url_fgets(AVIOContext *s, char *buf, int buf_size); +attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size); +#endif void put_flush_packet(AVIOContext *s); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index e273aa536a..290572435e 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -915,6 +915,7 @@ int url_fprintf(AVIOContext *s, const char *fmt, ...) } #endif //CONFIG_MUXERS +#if FF_API_OLD_AVIO char *url_fgets(AVIOContext *s, char *buf, int buf_size) { int c; @@ -935,6 +936,7 @@ char *url_fgets(AVIOContext *s, char *buf, int buf_size) *q = '\0'; return buf; } +#endif int url_fget_max_packet_size(AVIOContext *s) { From e51975392d85e72801193123945a35fb5221248f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 6 Mar 2011 19:59:29 +0100 Subject: [PATCH 508/528] avio: deprecate url_fgetc and remove all it uses Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 6 ++---- libavformat/aviobuf.c | 10 ++++++---- libavformat/mpegts.c | 4 ++-- libavformat/oggdec.c | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index a3bf5c01d4..22f11bb6ba 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -426,6 +426,8 @@ attribute_deprecated int url_fclose(AVIOContext *s); attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset); attribute_deprecated int64_t url_ftell(AVIOContext *s); +#define URL_EOF (-1) +attribute_deprecated int url_fgetc(AVIOContext *s); /** * @} */ @@ -503,10 +505,6 @@ int av_url_read_fpause(AVIOContext *h, int pause); int64_t av_url_read_fseek(AVIOContext *h, int stream_index, int64_t timestamp, int flags); -#define URL_EOF (-1) -/** @note return URL_EOF (-1) if EOF */ -int url_fgetc(AVIOContext *s); - /** @warning currently size is limited */ #ifdef __GNUC__ int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 290572435e..b21d3e3cf0 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -541,6 +541,7 @@ int avio_r8(AVIOContext *s) return 0; } +#if FF_API_OLD_AVIO int url_fgetc(AVIOContext *s) { if (s->buf_ptr >= s->buf_end) @@ -549,6 +550,7 @@ int url_fgetc(AVIOContext *s) return *s->buf_ptr++; return URL_EOF; } +#endif int avio_read(AVIOContext *s, unsigned char *buf, int size) { @@ -921,16 +923,16 @@ char *url_fgets(AVIOContext *s, char *buf, int buf_size) int c; char *q; - c = url_fgetc(s); - if (c == EOF) + c = avio_r8(s); + if (url_feof(s)) return NULL; q = buf; for(;;) { - if (c == EOF || c == '\n') + if (url_feof(s) || c == '\n') break; if ((q - buf) < buf_size - 1) *q++ = c; - c = url_fgetc(s); + c = avio_r8(s); } if (buf_size > 0) *q = '\0'; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index b1b329e3e8..2b55de9e46 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1312,8 +1312,8 @@ static int mpegts_resync(AVFormatContext *s) int c, i; for(i = 0;i < MAX_RESYNC_SIZE; i++) { - c = url_fgetc(pb); - if (c < 0) + c = avio_r8(pb); + if (url_feof(pb)) return -1; if (c == 0x47) { avio_seek(pb, -1, SEEK_CUR); diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index ff6b69a508..2eb9e03f76 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -218,8 +218,8 @@ ogg_read_page (AVFormatContext * s, int *str) sync[(sp + 2) & 3] == 'g' && sync[(sp + 3) & 3] == 'S') break; - c = url_fgetc (bc); - if (c < 0) + c = avio_r8(bc); + if (url_feof(bc)) return -1; sync[sp++ & 3] = c; }while (i++ < MAX_PAGE_SIZE); @@ -229,15 +229,15 @@ ogg_read_page (AVFormatContext * s, int *str) return -1; } - if (url_fgetc (bc) != 0) /* version */ + if (avio_r8(bc) != 0) /* version */ return -1; - flags = url_fgetc (bc); + flags = avio_r8(bc); gp = avio_rl64 (bc); serial = avio_rl32 (bc); seq = avio_rl32 (bc); crc = avio_rl32 (bc); - nsegs = url_fgetc (bc); + nsegs = avio_r8(bc); idx = ogg_find_stream (ogg, serial); if (idx < 0){ From 76aa876e69cf78a40821e66dec0a1006e4eb23ec Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 4 Mar 2011 19:57:36 +0100 Subject: [PATCH 509/528] avio: avio_ prefix for url_fsize Signed-off-by: Ronald S. Bultje --- ffmpeg.c | 4 ++-- ffplay.c | 2 +- libavformat/apetag.c | 2 +- libavformat/avidec.c | 8 ++++---- libavformat/avio.h | 3 ++- libavformat/aviobuf.c | 6 +++++- libavformat/cafdec.c | 2 +- libavformat/cdg.c | 2 +- libavformat/dv.c | 2 +- libavformat/ffmdec.c | 2 +- libavformat/filmstripdec.c | 2 +- libavformat/flvdec.c | 2 +- libavformat/gxfenc.c | 2 +- libavformat/id3v1.c | 2 +- libavformat/img2.c | 2 +- libavformat/libnut.c | 2 +- libavformat/mov.c | 4 ++-- libavformat/nutdec.c | 2 +- libavformat/oggdec.c | 2 +- libavformat/r3d.c | 2 +- libavformat/sauce.c | 2 +- libavformat/tty.c | 2 +- libavformat/utils.c | 6 +++--- libavformat/vocdec.c | 2 +- libavformat/yop.c | 2 +- 25 files changed, 37 insertions(+), 32 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 814b4977d6..7f909563cd 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1350,8 +1350,8 @@ static void print_report(AVFormatContext **output_files, oc = output_files[0]; - total_size = url_fsize(oc->pb); - if(total_size<0) // FIXME improve url_fsize() so it works with non seekable output too + total_size = avio_size(oc->pb); + if(total_size<0) // FIXME improve avio_size() so it works with non seekable output too total_size= avio_tell(oc->pb); buf[0] = '\0'; diff --git a/ffplay.c b/ffplay.c index edc59380b6..e304aab3b1 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2838,7 +2838,7 @@ static void event_loop(void) } if (cur_stream) { if(seek_by_bytes || cur_stream->ic->duration<=0){ - uint64_t size= url_fsize(cur_stream->ic->pb); + uint64_t size= avio_size(cur_stream->ic->pb); stream_seek(cur_stream, size*x/cur_stream->width, 0, 1); }else{ int64_t ts; diff --git a/libavformat/apetag.c b/libavformat/apetag.c index c3c57717bd..fb46d2bac2 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -66,7 +66,7 @@ static int ape_tag_read_field(AVFormatContext *s) void ff_ape_parse_tag(AVFormatContext *s) { AVIOContext *pb = s->pb; - int file_size = url_fsize(pb); + int file_size = avio_size(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; int i; diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 79e86ad613..83b86d8146 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -138,7 +138,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ AVIStream *ast; int i; int64_t last_pos= -1; - int64_t filesize= url_fsize(s->pb); + int64_t filesize= avio_size(s->pb); #ifdef DEBUG_SEEK av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n", @@ -351,7 +351,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if (get_riff(s, pb) < 0) return -1; - avi->fsize = url_fsize(pb); + avi->fsize = avio_size(pb); if(avi->fsize<=0) avi->fsize= avi->riff_end == 8 ? INT64_MAX : avi->riff_end; @@ -378,7 +378,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = avio_tell(pb) - 4; if(size) avi->movi_end = avi->movi_list + size + (size & 1); - else avi->movi_end = url_fsize(pb); + else avi->movi_end = avio_size(pb); av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); goto end_of_header; } @@ -705,7 +705,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, " "I will ignore it and try to continue anyway.\n"); avi->movi_list = avio_tell(pb) - 4; - avi->movi_end = url_fsize(pb); + avi->movi_end = avio_size(pb); goto end_of_header; } /* skip tag */ diff --git a/libavformat/avio.h b/libavformat/avio.h index 22f11bb6ba..6da0cfa1bb 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -426,6 +426,7 @@ attribute_deprecated int url_fclose(AVIOContext *s); attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset); attribute_deprecated int64_t url_ftell(AVIOContext *s); +attribute_deprecated int64_t url_fsize(AVIOContext *s); #define URL_EOF (-1) attribute_deprecated int url_fgetc(AVIOContext *s); /** @@ -491,7 +492,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); * Get the filesize. * @return filesize or AVERROR */ -int64_t url_fsize(AVIOContext *s); +int64_t avio_size(AVIOContext *s); /** * feof() equivalent for AVIOContext. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index b21d3e3cf0..aebdd7211a 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -246,7 +246,7 @@ int64_t url_ftell(AVIOContext *s) } #endif -int64_t url_fsize(AVIOContext *s) +int64_t avio_size(AVIOContext *s) { int64_t size; @@ -371,6 +371,10 @@ int64_t url_fseek(AVIOContext *s, int64_t offset, int whence) { return avio_seek(s, offset, whence); } +int64_t url_fsize(AVIOContext *s) +{ + return avio_size(s); +} #endif int avio_put_str(AVIOContext *s, const char *str) diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index bc0a7760ea..9db7608ddd 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -284,7 +284,7 @@ static int read_header(AVFormatContext *s, "block size or frame size are variable.\n"); return AVERROR_INVALIDDATA; } - s->file_size = url_fsize(pb); + s->file_size = avio_size(pb); s->file_size = FFMAX(0, s->file_size); av_set_pts_info(st, 64, 1, st->codec->sample_rate); diff --git a/libavformat/cdg.c b/libavformat/cdg.c index ed3d78285b..8fa38f74e9 100644 --- a/libavformat/cdg.c +++ b/libavformat/cdg.c @@ -38,7 +38,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) /// 75 sectors/sec * 4 packets/sector = 300 packets/sec av_set_pts_info(vst, 32, 1, 300); - ret = url_fsize(s->pb); + ret = avio_size(s->pb); if (ret > 0) vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300); diff --git a/libavformat/dv.c b/libavformat/dv.c index 4e256d7d39..1e32125c23 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -370,7 +370,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c, // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk) const DVprofile* sys = ff_dv_codec_profile(c->vst->codec); int64_t offset; - int64_t size = url_fsize(s->pb) - s->data_offset; + int64_t size = avio_size(s->pb) - s->data_offset; int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size; offset = sys->frame_size * timestamp; diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 2977527b97..53eaa8e6f7 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -282,7 +282,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ffm->write_index = avio_rb64(pb); /* get also filesize */ if (!url_is_streamed(pb)) { - ffm->file_size = url_fsize(pb); + ffm->file_size = avio_size(pb); if (ffm->write_index) adjust_write_index(s); } else { diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 1741d57d30..8d56b0e340 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -43,7 +43,7 @@ static int read_header(AVFormatContext *s, if (url_is_streamed(s->pb)) return AVERROR(EIO); - avio_seek(pb, url_fsize(pb) - 36, SEEK_SET); + avio_seek(pb, avio_size(pb) - 36, SEEK_SET); if (avio_rb32(pb) != RAND_TAG) { av_log(s, AV_LOG_ERROR, "magic number not found"); return AVERROR_INVALIDDATA; diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 6113d951bf..7e02cdd3b4 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -373,7 +373,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){ int size; const int64_t pos= avio_tell(s->pb); - const int64_t fsize= url_fsize(s->pb); + const int64_t fsize= avio_size(s->pb); avio_seek(s->pb, fsize-4, SEEK_SET); size= avio_rb32(s->pb); avio_seek(s->pb, fsize-3-size, SEEK_SET); diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index ea9755fcd2..44b5020db0 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -310,7 +310,7 @@ static int gxf_write_material_data_section(AVFormatContext *s) /* estimated size */ avio_w8(pb, MAT_SIZE); avio_w8(pb, 4); - avio_wb32(pb, url_fsize(pb) / 1024); + avio_wb32(pb, avio_size(pb) / 1024); return updateSize(pb, pos); } diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c index e17e785ad5..0152e39654 100644 --- a/libavformat/id3v1.c +++ b/libavformat/id3v1.c @@ -230,7 +230,7 @@ void ff_id3v1_read(AVFormatContext *s) if (!url_is_streamed(s->pb)) { /* XXX: change that */ - filesize = url_fsize(s->pb); + filesize = avio_size(s->pb); if (filesize > 128) { avio_seek(s->pb, filesize - 128, SEEK_SET); ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE); diff --git a/libavformat/img2.c b/libavformat/img2.c index a9a4a49023..c909078ecf 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -276,7 +276,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename); return AVERROR(EIO); } - size[i]= url_fsize(f[i]); + size[i]= avio_size(f[i]); if(codec->codec_id != CODEC_ID_RAWVIDEO) break; diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 28bf76dc84..1c13e295f7 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -179,7 +179,7 @@ static size_t av_read(void * h, size_t len, uint8_t * buf) { static off_t av_seek(void * h, long long pos, int whence) { AVIOContext * bc = h; if (whence == SEEK_END) { - pos = url_fsize(bc) + pos; + pos = avio_size(bc) + pos; whence = SEEK_SET; } return avio_seek(bc, pos, whence); diff --git a/libavformat/mov.c b/libavformat/mov.c index e9435a93c6..34b5f8e754 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -304,7 +304,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (err < 0) return err; if (c->found_moov && c->found_mdat && - (url_is_streamed(pb) || start_pos + a.size == url_fsize(pb))) + (url_is_streamed(pb) || start_pos + a.size == avio_size(pb))) return 0; left = a.size - avio_tell(pb) + start_pos; if (left > 0) /* skip garbage at atom end */ @@ -2351,7 +2351,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) mov->fc = s; /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */ if(!url_is_streamed(pb)) - atom.size = url_fsize(pb); + atom.size = avio_size(pb); else atom.size = INT64_MAX; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 8c1ba28599..107ff6815f 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -508,7 +508,7 @@ static int find_and_decode_index(NUTContext *nut){ AVIOContext *bc = s->pb; uint64_t tmp, end; int i, j, syncpoint_count; - int64_t filesize= url_fsize(bc); + int64_t filesize= avio_size(bc); int64_t *syncpoints; int8_t *has_keyframe; int ret= -1; diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 2eb9e03f76..379de7eac1 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -462,7 +462,7 @@ ogg_get_length (AVFormatContext * s) if (s->duration != AV_NOPTS_VALUE) return 0; - size = url_fsize(s->pb); + size = avio_size(s->pb); if(size < 0) return 0; end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0; diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 6cda30fd31..39f97ff9aa 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -180,7 +180,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) if (url_is_streamed(s->pb)) return 0; // find REOB/REOF/REOS to load index - avio_seek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET); + avio_seek(s->pb, avio_size(s->pb)-48-8, SEEK_SET); if (read_atom(s, &atom) < 0) av_log(s, AV_LOG_ERROR, "error reading end atom\n"); diff --git a/libavformat/sauce.c b/libavformat/sauce.c index ba737df1ce..8f1acb4a77 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -33,7 +33,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g AVIOContext *pb = avctx->pb; char buf[36]; int datatype, filetype, t1, t2, nb_comments, flags; - uint64_t start_pos = url_fsize(pb) - 128; + uint64_t start_pos = avio_size(pb) - 128; avio_seek(pb, start_pos, SEEK_SET); if (avio_read(pb, buf, 7) != 7) diff --git a/libavformat/tty.c b/libavformat/tty.c index dabbe972cb..71c00e7e0a 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -89,7 +89,7 @@ static int read_header(AVFormatContext *avctx, s->chars_per_frame = FFMAX(av_q2d(st->time_base) * (ap->sample_rate ? ap->sample_rate : LINE_RATE), 1); if (!url_is_streamed(avctx->pb)) { - s->fsize = url_fsize(avctx->pb); + s->fsize = avio_size(avctx->pb); st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame; if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0) diff --git a/libavformat/utils.c b/libavformat/utils.c index 91bc4a2025..abe3cf9021 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1557,7 +1557,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i if(ts_max == AV_NOPTS_VALUE){ int step= 1024; - filesize = url_fsize(s->pb); + filesize = avio_size(s->pb); pos_max = filesize - 1; do{ pos_max -= step; @@ -1666,7 +1666,7 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, #endif pos_min = s->data_offset; - pos_max = url_fsize(s->pb) - 1; + pos_max = avio_size(s->pb) - 1; if (pos < pos_min) pos= pos_min; else if(pos > pos_max) pos= pos_max; @@ -2007,7 +2007,7 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset) if (ic->iformat->flags & AVFMT_NOFILE) { file_size = 0; } else { - file_size = url_fsize(ic->pb); + file_size = avio_size(ic->pb); if (file_size < 0) file_size = 0; } diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index 07aeb8b321..f4fb8cc37b 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -80,7 +80,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) if (!voc->remaining_size) { if (url_is_streamed(s->pb)) return AVERROR(EIO); - voc->remaining_size = url_fsize(pb) - avio_tell(pb); + voc->remaining_size = avio_size(pb) - avio_tell(pb); } max_size -= 4; diff --git a/libavformat/yop.c b/libavformat/yop.c index 6c450c7cf7..20de06ca85 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -190,7 +190,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index, return -1; pos_min = s->data_offset; - pos_max = url_fsize(s->pb) - yop->frame_size; + pos_max = avio_size(s->pb) - yop->frame_size; frame_count = (pos_max - pos_min) / yop->frame_size; timestamp = FFMAX(0, FFMIN(frame_count, timestamp)); From d34ca1cfe3182c1cb185c31e6b1bb64f40de0e92 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 6 Mar 2011 22:05:04 +1100 Subject: [PATCH 510/528] Add audio codec 0x1600 (ADTS AAC) Signed-off-by: Ronald S. Bultje --- libavformat/riff.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/riff.c b/libavformat/riff.c index 8f16b7a7f0..920cd96e37 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -299,6 +299,7 @@ const AVCodecTag ff_codec_wav_tags[] = { { CODEC_ID_IMC, 0x0401 }, { CODEC_ID_GSM_MS, 0x1500 }, { CODEC_ID_TRUESPEECH, 0x1501 }, + { CODEC_ID_AAC, 0x1600 }, /* ADTS AAC */ { CODEC_ID_AAC_LATM, 0x1602 }, { CODEC_ID_AC3, 0x2000 }, { CODEC_ID_DTS, 0x2001 }, From 159683ddec69bb4faadfc53de8e1d357e1abbbad Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 4 Mar 2011 22:05:16 -0500 Subject: [PATCH 511/528] Fix compilation on powerpc with --disable-altivec. --- libavcodec/fmtconvert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c index e26b8997ab..bf762cc660 100644 --- a/libavcodec/fmtconvert.c +++ b/libavcodec/fmtconvert.c @@ -63,6 +63,6 @@ av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx) c->float_to_int16_interleave = float_to_int16_interleave_c; if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx); - if (ARCH_PPC) ff_fmt_convert_init_ppc(c, avctx); + if (HAVE_ALTIVEC) ff_fmt_convert_init_ppc(c, avctx); if (HAVE_MMX) ff_fmt_convert_init_x86(c, avctx); } From d21be5f15bec15933cb6360aa0159961d987f449 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 4 Mar 2011 22:51:51 -0500 Subject: [PATCH 512/528] cosmetics: rename ff_fmt_convert_init_ppc() to ff_fmt_convert_init_altivec(). It only has Altivec functions and is not compiled if Altivec is disabled. --- libavcodec/fmtconvert.c | 2 +- libavcodec/fmtconvert.h | 2 +- libavcodec/ppc/fmtconvert_altivec.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c index bf762cc660..e27c1f69f4 100644 --- a/libavcodec/fmtconvert.c +++ b/libavcodec/fmtconvert.c @@ -63,6 +63,6 @@ av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx) c->float_to_int16_interleave = float_to_int16_interleave_c; if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx); - if (HAVE_ALTIVEC) ff_fmt_convert_init_ppc(c, avctx); + if (HAVE_ALTIVEC) ff_fmt_convert_init_altivec(c, avctx); if (HAVE_MMX) ff_fmt_convert_init_x86(c, avctx); } diff --git a/libavcodec/fmtconvert.h b/libavcodec/fmtconvert.h index f2ee261f99..7416184aae 100644 --- a/libavcodec/fmtconvert.h +++ b/libavcodec/fmtconvert.h @@ -73,7 +73,7 @@ typedef struct FmtConvertContext { void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx); void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx); -void ff_fmt_convert_init_ppc(FmtConvertContext *c, AVCodecContext *avctx); +void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx); void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx); #endif /* AVCODEC_FMTCONVERT_H */ diff --git a/libavcodec/ppc/fmtconvert_altivec.c b/libavcodec/ppc/fmtconvert_altivec.c index e5287c96c1..30de0e637f 100644 --- a/libavcodec/ppc/fmtconvert_altivec.c +++ b/libavcodec/ppc/fmtconvert_altivec.c @@ -132,7 +132,7 @@ float_to_int16_interleave_altivec(int16_t *dst, const float **src, } } -void ff_fmt_convert_init_ppc(FmtConvertContext *c, AVCodecContext *avctx) +void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx) { c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec; if(!(avctx->flags & CODEC_FLAG_BITEXACT)) { From 7100d63ca5edfc2e11c68201fb70d61a08a020cb Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 4 Mar 2011 12:11:03 -0500 Subject: [PATCH 513/528] ac3enc: use av_assert2() instead of assert() to make debugging easier. --- libavcodec/ac3enc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 676bb5e13c..833904fa15 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -27,8 +27,10 @@ */ //#define DEBUG +//#define ASSERT_LEVEL 2 #include "libavutil/audioconvert.h" +#include "libavutil/avassert.h" #include "libavutil/crc.h" #include "avcodec.h" #include "put_bits.h" @@ -1101,7 +1103,7 @@ static inline int sym_quant(int c, int e, int levels) v = (v + 1) >> 1; v = (levels >> 1) - v; } - assert(v >= 0 && v < levels); + av_assert2(v >= 0 && v < levels); return v; } @@ -1123,7 +1125,7 @@ static inline int asym_quant(int c, int e, int qbits) m = (1 << (qbits-1)); if (v >= m) v = m - 1; - assert(v >= -m); + av_assert2(v >= -m); return v & ((1 << qbits)-1); } @@ -1439,7 +1441,7 @@ static void output_frame_end(AC3EncodeContext *s) flush_put_bits(&s->pb); frame = s->pb.buf; pad_bytes = s->frame_size - (put_bits_ptr(&s->pb) - frame) - 2; - assert(pad_bytes >= 0); + av_assert2(pad_bytes >= 0); if (pad_bytes > 0) memset(put_bits_ptr(&s->pb), 0, pad_bytes); From 2d9a101a1f5e102d9538de827d9e4a2e8cf17c89 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 4 Mar 2011 12:12:01 -0500 Subject: [PATCH 514/528] ac3enc: add some assertions --- libavcodec/ac3enc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 833904fa15..baa9597977 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -428,6 +428,7 @@ static void extract_exponents(AC3EncodeContext *s) e = 24; coef[i] = 0; } + av_assert2(e >= 0); } exp[i] = e; } @@ -650,16 +651,19 @@ static void group_exponents(AC3EncodeContext *s) exp1 = p[0]; p += group_size; delta0 = exp1 - exp0 + 2; + av_assert2(delta0 >= 0 && delta0 <= 4); exp0 = exp1; exp1 = p[0]; p += group_size; delta1 = exp1 - exp0 + 2; + av_assert2(delta1 >= 0 && delta1 <= 4); exp0 = exp1; exp1 = p[0]; p += group_size; delta2 = exp1 - exp0 + 2; + av_assert2(delta2 >= 0 && delta2 <= 4); block->grouped_exp[ch][i] = ((delta0 * 5 + delta1) * 5) + delta2; } @@ -947,6 +951,7 @@ static int cbr_bit_allocation(AC3EncodeContext *s) int snr_offset, snr_incr; bits_left = 8 * s->frame_size - (s->frame_bits + s->exponent_bits); + av_assert2(bits_left >= 0); snr_offset = s->coarse_snr_offset << 4; @@ -1438,6 +1443,7 @@ static void output_frame_end(AC3EncodeContext *s) frame_size_58 = ((s->frame_size >> 2) + (s->frame_size >> 4)) << 1; /* pad the remainder of the frame with zeros */ + av_assert2(s->frame_size * 8 - put_bits_count(&s->pb) >= 18); flush_put_bits(&s->pb); frame = s->pb.buf; pad_bytes = s->frame_size - (put_bits_ptr(&s->pb) - frame) - 2; From 36864ac3540445c513484017aa9927e942fac24a Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Tue, 1 Mar 2011 09:46:12 -0300 Subject: [PATCH 515/528] aac_latm_dec: use aac context and aac m4ac When decoding latm config, use the corresponding aac context and its m4ac instead of using NULL and a local variable. This fixes decoding of audio in MPEG TS from SBTVD (the Brazillian Digital TV Sytem), when there is no extradata. This is the case when using the decoder with gst-ffmpeg and a GStreamer mpegts demuxer. Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Ronald S. Bultje --- libavcodec/aacdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 81a94f2fd8..6317e429e2 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -2248,7 +2248,6 @@ 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; @@ -2258,7 +2257,8 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx, return AVERROR_INVALIDDATA; } else { bits_consumed = - decode_audio_specific_config(NULL, avctx, &m4ac, + decode_audio_specific_config(&latmctx->aac_ctx, avctx, + &latmctx->aac_ctx.m4ac, gb->buffer + (config_start_bit / 8), get_bits_left(gb) / 8); From c92562467e8900fc727d03499afb571a9363c20c Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 28 Feb 2011 20:30:03 +0200 Subject: [PATCH 516/528] lavf: document the use of multiple entries in language metadata tag Signed-off-by: Ronald S. Bultje --- libavformat/avformat.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f5afde84cb..5c799dc190 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -94,7 +94,8 @@ struct AVFormatContext; * filename -- original name of the file. * genre -- . * language -- main language in which the work is performed, preferably - * in ISO 639-2 format. + * in ISO 639-2 format. Multiple languages can be specified by + * separating them with commas. * performer -- artist who performed the work, if different from artist. * E.g for "Also sprach Zarathustra", artist would be "Richard * Strauss" and performer "London Philharmonic Orchestra". From 2790d7a9ffbd51f33e5367a31ace5c44c30401a1 Mon Sep 17 00:00:00 2001 From: Young Han Lee Date: Fri, 18 Feb 2011 09:33:11 +0900 Subject: [PATCH 517/528] aacenc: remove the data arrays Signed-off-by: Ronald S. Bultje --- libavcodec/aacenc.c | 28 +++++++++++++++------------- libavcodec/aacenc.h | 5 ++--- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 50dab1cffd..17ae6f99d3 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -225,40 +225,41 @@ static void apply_window_and_mdct(AVCodecContext *avctx, AACEncContext *s, const float * lwindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024; const float * swindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; const float * pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128; + float *output = sce->ret; if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) { - memcpy(s->output, sce->saved, sizeof(float)*1024); + memcpy(output, sce->saved, sizeof(float)*1024); if (sce->ics.window_sequence[0] == LONG_STOP_SEQUENCE) { - memset(s->output, 0, sizeof(s->output[0]) * 448); + memset(output, 0, sizeof(output[0]) * 448); for (i = 448; i < 576; i++) - s->output[i] = sce->saved[i] * pwindow[i - 448]; + output[i] = sce->saved[i] * pwindow[i - 448]; for (i = 576; i < 704; i++) - s->output[i] = sce->saved[i]; + output[i] = sce->saved[i]; } if (sce->ics.window_sequence[0] != LONG_START_SEQUENCE) { for (i = 0; i < 1024; i++) { - s->output[i+1024] = audio[i * chans] * lwindow[1024 - i - 1]; + output[i+1024] = audio[i * chans] * lwindow[1024 - i - 1]; sce->saved[i] = audio[i * chans] * lwindow[i]; } } else { for (i = 0; i < 448; i++) - s->output[i+1024] = audio[i * chans]; + output[i+1024] = audio[i * chans]; for (; i < 576; i++) - s->output[i+1024] = audio[i * chans] * swindow[576 - i - 1]; - memset(s->output+1024+576, 0, sizeof(s->output[0]) * 448); + output[i+1024] = audio[i * chans] * swindow[576 - i - 1]; + memset(output+1024+576, 0, sizeof(output[0]) * 448); for (i = 0; i < 1024; i++) sce->saved[i] = audio[i * chans]; } - ff_mdct_calc(&s->mdct1024, sce->coeffs, s->output); + ff_mdct_calc(&s->mdct1024, sce->coeffs, output); } else { for (k = 0; k < 1024; k += 128) { for (i = 448 + k; i < 448 + k + 256; i++) - s->output[i - 448 - k] = (i < 1024) + output[i - 448 - k] = (i < 1024) ? sce->saved[i] : audio[(i-1024)*chans]; - s->dsp.vector_fmul (s->output, s->output, k ? swindow : pwindow, 128); - s->dsp.vector_fmul_reverse(s->output+128, s->output+128, swindow, 128); - ff_mdct_calc(&s->mdct128, sce->coeffs + k, s->output); + s->dsp.vector_fmul (output, output, k ? swindow : pwindow, 128); + s->dsp.vector_fmul_reverse(output+128, output+128, swindow, 128); + ff_mdct_calc(&s->mdct128, sce->coeffs + k, output); } for (i = 0; i < 1024; i++) sce->saved[i] = audio[i * chans]; @@ -597,6 +598,7 @@ static int aac_encode_frame(AVCodecContext *avctx, } for (j = 0; j < chans; j++) { s->cur_channel = start_ch + j; + s->scoefs = cpe->ch[j].ret; encode_individual_channel(avctx, s, &cpe->ch[j], cpe->common_window); } start_ch += chans; diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index 86c68d3e16..3559234ff1 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -52,8 +52,7 @@ typedef struct AACEncContext { FFTContext mdct1024; ///< long (1024 samples) frame transform context FFTContext mdct128; ///< short (128 samples) frame transform context DSPContext dsp; - DECLARE_ALIGNED(16, FFTSample, output)[2048]; ///< temporary buffer for MDCT input coefficients - int16_t* samples; ///< saved preprocessed input + int16_t *samples; ///< saved preprocessed input int samplerate_index; ///< MPEG-4 samplerate index @@ -64,8 +63,8 @@ typedef struct AACEncContext { int cur_channel; int last_frame; float lambda; + float *scoefs; ///< scaled coefficients DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients - DECLARE_ALIGNED(16, float, scoefs)[1024]; ///< scaled coefficients } AACEncContext; #endif /* AVCODEC_AACENC_H */ From e8bb2e24398ec838d9e49cf115b7e132609a9fb7 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 6 Mar 2011 18:04:49 +0100 Subject: [PATCH 518/528] avio: deprecate url_fget_max_packet_size AVIOContext.max_packet_size should be used directly instead. Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 11 ++++------- libavformat/aviobuf.c | 2 +- libavformat/rtpenc.c | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 6da0cfa1bb..09777a3615 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -633,15 +633,12 @@ int avio_open(AVIOContext **s, const char *url, int flags); int avio_close(AVIOContext *s); URLContext *url_fileno(AVIOContext *s); +#if FF_API_OLD_AVIO /** - * Return the maximum packet size associated to packetized buffered file - * handle. If the file is not packetized (stream like http or file on - * disk), then 0 is returned. - * - * @param s buffered file handle - * @return maximum packet size in bytes + * @deprecated use AVIOContext.max_packet_size directly. */ -int url_fget_max_packet_size(AVIOContext *s); +attribute_deprecated int url_fget_max_packet_size(AVIOContext *s); +#endif int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index aebdd7211a..6592e9acd6 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -942,12 +942,12 @@ char *url_fgets(AVIOContext *s, char *buf, int buf_size) *q = '\0'; return buf; } -#endif int url_fget_max_packet_size(AVIOContext *s) { return s->max_packet_size; } +#endif int av_url_read_fpause(AVIOContext *s, int pause) { diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index b32a9a4041..6c49d34c31 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -93,7 +93,7 @@ static int rtp_write_header(AVFormatContext *s1) s->first_rtcp_ntp_time = (s1->start_time_realtime / 1000) * 1000 + NTP_OFFSET_US; - max_packet_size = url_fget_max_packet_size(s1->pb); + max_packet_size = s1->pb->max_packet_size; if (max_packet_size <= 12) return AVERROR(EIO); s->buf = av_malloc(max_packet_size); From f1ef2cd9ed22be231bb4da8d2f93d9a0c7877aa7 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 6 Mar 2011 20:08:30 +0100 Subject: [PATCH 519/528] avio: move ff_rewind_with_probe_data from avio.h to avio_internal.h also change its prefix to ffio Signed-off-by: Ronald S. Bultje --- libavformat/avio.h | 15 --------------- libavformat/avio_internal.h | 14 ++++++++++++++ libavformat/aviobuf.c | 2 +- libavformat/utils.c | 3 ++- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 09777a3615..8bae263833 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -600,21 +600,6 @@ int url_setbufsize(AVIOContext *s, int buf_size); int url_resetbuf(AVIOContext *s, int flags); #endif -/** - * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file. - * Used after probing to avoid seeking. - * Joins buf and s->buffer, taking any overlap into consideration. - * @note s->buffer must overlap with buf or they can't be joined and the function fails - * @note This function is NOT part of the public API - * - * @param s The read-only AVIOContext to rewind - * @param buf The probe buffer containing the first buf_size bytes of the file - * @param buf_size The size of buf - * @return 0 in case of success, a negative value corresponding to an - * AVERROR code in case of failure - */ -int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size); - /** * Create and initialize a AVIOContext for accessing the * resource indicated by url. diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 279c7f60ff..3abb619b8a 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -47,4 +47,18 @@ static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s) avio_wl32(pb, MKTAG(s[0], s[1], s[2], s[3])); } +/** + * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file. + * Used after probing to avoid seeking. + * Joins buf and s->buffer, taking any overlap into consideration. + * @note s->buffer must overlap with buf or they can't be joined and the function fails + * + * @param s The read-only AVIOContext to rewind + * @param buf The probe buffer containing the first buf_size bytes of the file + * @param buf_size The size of buf + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size); + #endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 6592e9acd6..7762d6cace 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -837,7 +837,7 @@ static int url_resetbuf(AVIOContext *s, int flags) return 0; } -int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size) +int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size) { int64_t buffer_start; int buffer_size; diff --git a/libavformat/utils.c b/libavformat/utils.c index abe3cf9021..918b07df41 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avio_internal.h" #include "internal.h" #include "libavcodec/internal.h" #include "libavutil/opt.h" @@ -585,7 +586,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, } /* rewind. reuse probe buffer to avoid seeking */ - if ((ret = ff_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0) + if ((ret = ffio_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0) av_free(buf); return ret; From 4e84f994d3c17f6786fbd4f6463a168fbaaaf477 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 7 Mar 2011 13:18:57 -0500 Subject: [PATCH 520/528] reindent. --- libavcodec/h264_mp4toannexb_bsf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index e7f2e7ab04..df49b34810 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -92,9 +92,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc, if (unit_nb) pps_seen = 1; - } - else - { + } else { sps_seen = 1; } From 89e568feeca69b1e4b975d0b26aeafbe72fd5418 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 14 Feb 2011 19:14:53 +0200 Subject: [PATCH 521/528] lavf: update documentation of AVOutputFormat.flags Signed-off-by: Ronald S. Bultje --- libavformat/avformat.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 5c799dc190..ce50053f49 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -297,7 +297,9 @@ typedef struct AVOutputFormat { int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); int (*write_trailer)(struct AVFormatContext *); /** - * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, + * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, + * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS */ int flags; /** From 435cebd01560691e9322bdb0aa5af5b2bc76c3f8 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Thu, 17 Feb 2011 17:26:35 +0200 Subject: [PATCH 522/528] mpegtsenc: handle multiple language tags per stream Signed-off-by: Ronald S. Bultje --- libavformat/mpegtsenc.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 02bde7c4be..11a840f8e4 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -283,12 +283,24 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) /* write optional descriptors here */ switch(st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: - if (lang && strlen(lang->value) == 3) { + if (lang) { + char *p; + char *next = lang->value; + uint8_t *len_ptr; + *q++ = 0x0a; /* ISO 639 language descriptor */ - *q++ = 4; - *q++ = lang->value[0]; - *q++ = lang->value[1]; - *q++ = lang->value[2]; + len_ptr = q++; + *len_ptr = 0; + + for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { + next = strchr(p, ','); + if (strlen(p) != 3 && (!next || next != p + 3)) + continue; /* not a 3-letter code */ + + *q++ = *p++; + *q++ = *p++; + *q++ = *p++; + if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) *q++ = 0x01; else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) @@ -297,6 +309,12 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) *q++ = 0x03; else *q++ = 0; /* undefined type */ + + *len_ptr += 4; + } + + if (*len_ptr == 0) + q -= 2; /* no language codes were written */ } break; case AVMEDIA_TYPE_SUBTITLE: From 789936dbbda60990220b80769ed75702775ea0b2 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sun, 20 Feb 2011 02:38:23 +0100 Subject: [PATCH 523/528] Flag DVB subtitles for the hard hearing appropriately using their component_type id. This is based on the component_type definition in the DVB SI spec [1]. [1]: http://www.dvb.org/technology/standards/a038_DVB-SI_dEN300468v1.12.1.pdf Signed-off-by: Ronald S. Bultje --- libavformat/mpegts.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 2b55de9e46..600ef534f5 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -935,7 +935,17 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type language[1] = get8(pp, desc_end); language[2] = get8(pp, desc_end); language[3] = 0; - get8(pp, desc_end); + /* hearing impaired subtitles detection */ + switch(get8(pp, desc_end)) { + case 0x20: /* DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality */ + case 0x21: /* DVB subtitles (for the hard of hearing) for display on 4:3 aspect ratio monitor */ + case 0x22: /* DVB subtitles (for the hard of hearing) for display on 16:9 aspect ratio monitor */ + case 0x23: /* DVB subtitles (for the hard of hearing) for display on 2.21:1 aspect ratio monitor */ + case 0x24: /* DVB subtitles (for the hard of hearing) for display on a high definition monitor */ + case 0x25: /* DVB subtitles (for the hard of hearing) with plano-stereoscopic disparity for display on a high definition monitor */ + st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; + break; + } if (st->codec->extradata) { if (st->codec->extradata_size == 4 && memcmp(st->codec->extradata, *pp, 4)) av_log_ask_for_sample(fc, "DVB sub with multiple IDs\n"); From 688c22e033a48ebf84fb4b52642bbd40f11e9c4e Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Fri, 4 Mar 2011 23:43:02 +0100 Subject: [PATCH 524/528] In retry_transfer_wrapper, do not check url_interrupt_cb, causes problems when writing and pressing q during encoding. Instead, check url_interrupt_cb at the end. Note that when a protocol is interrupted by url_interrupt_cb, some data may be silently discarded: the protocol context is not suitable for anything anymore. Signed-off-by: Nicolas George Signed-off-by: Ronald S. Bultje --- libavformat/avio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index 4ab1b6bd75..2265549266 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -221,8 +221,6 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int len = 0; while (len < size_min) { - if (url_interrupt_cb()) - return AVERROR(EINTR); ret = transfer_func(h, buf+len, size-len); if (ret == AVERROR(EINTR)) continue; @@ -239,6 +237,8 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int if (ret) fast_retries = FFMAX(fast_retries, 2); len += ret; + if (url_interrupt_cb()) + return AVERROR(EINTR); } return len; } From 6a7e074eb98c4d45898d7f2920312db6899ee650 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Thu, 17 Feb 2011 17:26:34 +0200 Subject: [PATCH 525/528] mpegts: add all stream languages into metadata This is used at least on some older DVB broadcasts for dual-mono audio tracks. Signed-off-by: Ronald S. Bultje --- libavformat/mpegts.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 600ef534f5..a1446d839f 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -891,7 +891,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type { const uint8_t *desc_end; int desc_len, desc_tag; - char language[4]; + char language[252]; + int i; desc_tag = get8(pp, desc_list_end); if (desc_tag < 0) @@ -960,16 +961,21 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type av_metadata_set2(&st->metadata, "language", language, 0); break; case 0x0a: /* ISO 639 language descriptor */ - language[0] = get8(pp, desc_end); - language[1] = get8(pp, desc_end); - language[2] = get8(pp, desc_end); - language[3] = 0; - av_metadata_set2(&st->metadata, "language", language, 0); + for (i = 0; i + 4 <= desc_len; i += 4) { + language[i + 0] = get8(pp, desc_end); + language[i + 1] = get8(pp, desc_end); + language[i + 2] = get8(pp, desc_end); + language[i + 3] = ','; switch (get8(pp, desc_end)) { case 0x01: st->disposition |= AV_DISPOSITION_CLEAN_EFFECTS; break; case 0x02: st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; break; case 0x03: st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; break; } + } + if (i) { + language[i - 1] = 0; + av_metadata_set2(&st->metadata, "language", language, 0); + } break; case 0x05: /* registration descriptor */ st->codec->codec_tag = bytestream_get_le32(pp); From 66e5b1df360a28b083bc9ec5a76e7add5f40ce1f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 7 Mar 2011 21:50:25 +0100 Subject: [PATCH 526/528] avio: deprecate url_feof AVIOContext.eof_reached should be used directly instead. Signed-off-by: Ronald S. Bultje --- ffplay.c | 2 +- libavformat/4xm.c | 2 +- libavformat/aiffdec.c | 2 +- libavformat/amr.c | 2 +- libavformat/anm.c | 2 +- libavformat/ape.c | 2 +- libavformat/applehttp.c | 4 ++-- libavformat/applehttpproto.c | 2 +- libavformat/asfdec.c | 12 ++++++------ libavformat/assdec.c | 2 +- libavformat/avidec.c | 12 ++++++------ libavformat/avio.h | 11 +++++------ libavformat/aviobuf.c | 10 ++++++---- libavformat/bethsoftvid.c | 2 +- libavformat/bfi.c | 4 ++-- libavformat/cafdec.c | 6 +++--- libavformat/daud.c | 2 +- libavformat/dsicin.c | 2 +- libavformat/dv.c | 2 +- libavformat/dxa.c | 4 ++-- libavformat/electronicarts.c | 4 ++-- libavformat/ffmdec.c | 2 +- libavformat/ffmetadec.c | 4 ++-- libavformat/filmstripdec.c | 2 +- libavformat/flacdec.c | 2 +- libavformat/flvdec.c | 2 +- libavformat/gxf.c | 6 +++--- libavformat/idcin.c | 2 +- libavformat/idroqdec.c | 2 +- libavformat/iff.c | 2 +- libavformat/img2.c | 2 +- libavformat/ipmovie.c | 6 +++--- libavformat/lxfdec.c | 2 +- libavformat/matroskadec.c | 2 +- libavformat/mmf.c | 2 +- libavformat/mov.c | 4 ++-- libavformat/mpc8.c | 4 ++-- libavformat/mpeg.c | 4 ++-- libavformat/mpegts.c | 2 +- libavformat/msnwc_tcp.c | 4 ++-- libavformat/mxfdec.c | 6 +++--- libavformat/mxg.c | 2 +- libavformat/ncdec.c | 2 +- libavformat/nsvdec.c | 12 ++++++------ libavformat/nutdec.c | 4 ++-- libavformat/nuv.c | 4 ++-- libavformat/oggdec.c | 2 +- libavformat/psxstr.c | 2 +- libavformat/qcp.c | 2 +- libavformat/rmdec.c | 6 +++--- libavformat/smacker.c | 2 +- libavformat/sol.c | 2 +- libavformat/soxdec.c | 2 +- libavformat/spdifdec.c | 2 +- libavformat/srtdec.c | 2 +- libavformat/swfdec.c | 2 +- libavformat/tmv.c | 2 +- libavformat/tty.c | 2 +- libavformat/txd.c | 2 +- libavformat/vc1test.c | 2 +- libavformat/wav.c | 6 +++--- libavformat/wc3movie.c | 4 ++-- libavformat/wtv.c | 10 +++++----- libavformat/wv.c | 2 +- 64 files changed, 116 insertions(+), 115 deletions(-) diff --git a/ffplay.c b/ffplay.c index e304aab3b1..60194372d9 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2568,7 +2568,7 @@ static int decode_thread(void *arg) } ret = av_read_frame(ic, pkt); if (ret < 0) { - if (ret == AVERROR_EOF || url_feof(ic->pb)) + if (ret == AVERROR_EOF || ic->pb->eof_reached) eof=1; if (url_ferror(ic->pb)) break; diff --git a/libavformat/4xm.c b/libavformat/4xm.c index ed722805b2..95bd717915 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -259,7 +259,7 @@ static int fourxm_read_packet(AVFormatContext *s, return ret; fourcc_tag = AV_RL32(&header[0]); size = AV_RL32(&header[4]); - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR(EIO); switch (fourcc_tag) { diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 9e3d39c371..8506d8b5c8 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -51,7 +51,7 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) { int size; - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR(EIO); *tag = avio_rl32(pb); diff --git a/libavformat/amr.c b/libavformat/amr.c index 9d6581dee5..522d83ea8b 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -122,7 +122,7 @@ static int amr_read_packet(AVFormatContext *s, AVCodecContext *enc = s->streams[0]->codec; int read, size = 0, toc, mode; - if (url_feof(s->pb)) + if (s->pb->eof_reached) { return AVERROR(EIO); } diff --git a/libavformat/anm.c b/libavformat/anm.c index 2a0109d1de..980920f52a 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -181,7 +181,7 @@ static int read_packet(AVFormatContext *s, Page *p; int tmp, record_size; - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR(EIO); if (anm->page < 0) diff --git a/libavformat/ape.c b/libavformat/ape.c index 2de47ef483..6c269849fd 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -337,7 +337,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) APEContext *ape = s->priv_data; uint32_t extra_size = 8; - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR(EIO); if (ape->currentframe > ape->totalframes) return AVERROR(EIO); diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 5118d03670..c1609b895d 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -224,7 +224,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url, if (var) free_segment_list(var); c->finished = 0; - while (!url_feof(in)) { + while (!in->eof_reached) { read_chomp_line(in, line, sizeof(line)); if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) { struct variant_info info = {{0}}; @@ -457,7 +457,7 @@ start: if (var->pb && !var->pkt.data) { ret = av_read_frame(var->ctx, &var->pkt); if (ret < 0) { - if (!url_feof(var->pb)) + if (!var->pb->eof_reached) return ret; reset_packet(&var->pkt); } diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 471f94bd2a..83071300e8 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/applehttpproto.c @@ -174,7 +174,7 @@ static int parse_playlist(URLContext *h, const char *url) free_segment_list(s); s->finished = 0; - while (!url_feof(in)) { + while (!in->eof_reached) { read_chomp_line(in, line, sizeof(line)); if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) { struct variant_info info = {{0}}; diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index e3a38073e8..10d34499c7 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -639,7 +639,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) continue; } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) { asf_read_marker(s, gsize); - } else if (url_feof(pb)) { + } else if (pb->eof_reached) { return -1; } else { if (!s->keylen) { @@ -660,7 +660,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rl64(pb); avio_r8(pb); avio_r8(pb); - if (url_feof(pb)) + if (pb->eof_reached) return -1; asf->data_offset = avio_tell(pb); asf->packet_size_left = 0; @@ -745,12 +745,12 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) */ if (url_ferror(pb) == AVERROR(EAGAIN)) return AVERROR(EAGAIN); - if (!url_feof(pb)) + if (!pb->eof_reached) av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb)); } if ((c & 0x8f) == 0x82) { if (d || e) { - if (!url_feof(pb)) + if (!pb->eof_reached) av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n"); return -1; } @@ -886,7 +886,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk ASFStream *asf_st = 0; for (;;) { int ret; - if(url_feof(pb)) + if(pb->eof_reached) return AVERROR_EOF; if (asf->packet_size_left < FRAME_HEADER_SIZE || asf->packet_segments < 1) { @@ -1195,7 +1195,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) skip them until the simple index object is reached */ while (ff_guidcmp(&g, &index_guid)) { int64_t gsize= avio_rl64(s->pb); - if (gsize < 24 || url_feof(s->pb)) { + if (gsize < 24 || s->pb->eof_reached) { avio_seek(s->pb, current_pos, SEEK_SET); return; } diff --git a/libavformat/assdec.c b/libavformat/assdec.c index e04d92ae65..abaf942f45 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -92,7 +92,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) header_remaining= INT_MAX; dst[0] = &st->codec->extradata; dst[1] = &ass->event_buffer; - while(!url_feof(pb)){ + while(!pb->eof_reached){ uint8_t line[MAX_LINESIZE]; len = ff_get_line(pb, line, sizeof(line)); diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 83b86d8146..8181298959 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -178,7 +178,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ #ifdef DEBUG_SEEK av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len); #endif - if(url_feof(pb)) + if(pb->eof_reached) return -1; if(last_pos == pos || pos == base - 8) @@ -195,7 +195,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ avio_rl32(pb); /* size */ duration = avio_rl32(pb); - if(url_feof(pb)) + if(pb->eof_reached) return -1; pos = avio_tell(pb); @@ -360,7 +360,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) codec_type = -1; frame_period = 0; for(;;) { - if (url_feof(pb)) + if (pb->eof_reached) goto fail; tag = avio_rl32(pb); size = avio_rl32(pb); @@ -989,7 +989,7 @@ resync: } memset(d, -1, sizeof(int)*8); - for(i=sync=avio_tell(pb); !url_feof(pb); i++) { + for(i=sync=avio_tell(pb); !pb->eof_reached; i++) { int j; for(j=0; j<7; j++) @@ -1145,7 +1145,7 @@ static int avi_read_idx1(AVFormatContext *s, int size) #if defined(DEBUG_SEEK) av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len); #endif - if(url_feof(pb)) + if(pb->eof_reached) return -1; if(last_pos == pos) @@ -1203,7 +1203,7 @@ static int avi_load_index(AVFormatContext *s) printf("movi_end=0x%"PRIx64"\n", avi->movi_end); #endif for(;;) { - if (url_feof(pb)) + if (pb->eof_reached) break; tag = avio_rl32(pb); size = avio_rl32(pb); diff --git a/libavformat/avio.h b/libavformat/avio.h index 8bae263833..2949629d57 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -432,6 +432,11 @@ attribute_deprecated int url_fgetc(AVIOContext *s); /** * @} */ + +/** + * @deprecated use AVIOContext.eof_reached + */ +attribute_deprecated int url_feof(AVIOContext *s); #endif AVIOContext *avio_alloc_context( @@ -494,12 +499,6 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); */ int64_t avio_size(AVIOContext *s); -/** - * feof() equivalent for AVIOContext. - * @return non zero if and only if end of file - */ -int url_feof(AVIOContext *s); - int url_ferror(AVIOContext *s); int av_url_read_fpause(AVIOContext *h, int pause); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 7762d6cace..d0f63df3d2 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -265,12 +265,14 @@ int64_t avio_size(AVIOContext *s) return size; } +#if FF_API_OLD_AVIO int url_feof(AVIOContext *s) { if(!s) return 0; return s->eof_reached; } +#endif int url_ferror(AVIOContext *s) { @@ -598,7 +600,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) } if (size1 == size) { if (url_ferror(s)) return url_ferror(s); - if (url_feof(s)) return AVERROR_EOF; + if (s->eof_reached) return AVERROR_EOF; } return size1 - size; } @@ -621,7 +623,7 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size) s->buf_ptr += len; if (!len) { if (url_ferror(s)) return url_ferror(s); - if (url_feof(s)) return AVERROR_EOF; + if (s->eof_reached) return AVERROR_EOF; } return len; } @@ -928,11 +930,11 @@ char *url_fgets(AVIOContext *s, char *buf, int buf_size) char *q; c = avio_r8(s); - if (url_feof(s)) + if (s->eof_reached) return NULL; q = buf; for(;;) { - if (url_feof(s) || c == '\n') + if (s->eof_reached || c == '\n') break; if ((q - buf) < buf_size - 1) *q++ = c; diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 7987e8e6f6..0b45115f0c 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -179,7 +179,7 @@ static int vid_read_packet(AVFormatContext *s, int audio_length; int ret_value; - if(vid->is_finished || url_feof(pb)) + if(vid->is_finished || pb->eof_reached) return AVERROR(EIO); block_type = avio_r8(pb); diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 21676e440a..cec02fd646 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -109,7 +109,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) BFIContext *bfi = s->priv_data; AVIOContext *pb = s->pb; int ret, audio_offset, video_offset, chunk_size, audio_size = 0; - if (bfi->nframes == 0 || url_feof(pb)) { + if (bfi->nframes == 0 || pb->eof_reached) { return AVERROR(EIO); } @@ -117,7 +117,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) if (!bfi->avflag) { uint32_t state = 0; while(state != MKTAG('S','A','V','I')){ - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR(EIO); state = 256*state + avio_r8(pb); } diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 9db7608ddd..ec3054ff2b 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -219,7 +219,7 @@ static int read_header(AVFormatContext *s, /* parse each chunk */ found_data = 0; - while (!url_feof(pb)) { + while (!pb->eof_reached) { /* stop at data chunk if seeking is not supported or data chunk size is unknown */ @@ -228,7 +228,7 @@ static int read_header(AVFormatContext *s, tag = avio_rb32(pb); size = avio_rb64(pb); - if (url_feof(pb)) + if (pb->eof_reached) break; switch (tag) { @@ -307,7 +307,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) int res, pkt_size = 0, pkt_frames = 0; int64_t left = CAF_MAX_PKT_SIZE; - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR(EIO); /* don't read past end of data chunk */ diff --git a/libavformat/daud.c b/libavformat/daud.c index 39a994b605..f852105a0c 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -38,7 +38,7 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) { static int daud_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; int ret, size; - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR(EIO); size = avio_rb16(pb); avio_rb16(pb); // unknown diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index 328f901463..7030491992 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -147,7 +147,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) { hdr->video_frame_size = avio_rl32(pb); hdr->audio_frame_size = avio_rl32(pb); - if (url_feof(pb) || url_ferror(pb)) + if (pb->eof_reached || url_ferror(pb)) return AVERROR(EIO); if (avio_rl32(pb) != 0xAA55AA55) diff --git a/libavformat/dv.c b/libavformat/dv.c index 1e32125c23..9e67e710b5 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -412,7 +412,7 @@ static int dv_read_header(AVFormatContext *s, state = avio_rb32(s->pb); while ((state & 0xffffff7f) != 0x1f07003f) { - if (url_feof(s->pb)) { + if (s->pb->eof_reached) { av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n"); return -1; } diff --git a/libavformat/dxa.c b/libavformat/dxa.c index de72792372..2c599865bb 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -104,7 +104,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; ff_get_wav_header(pb, ast->codec, fsize); // find 'data' chunk - while(avio_tell(pb) < c->vidpos && !url_feof(pb)){ + while(avio_tell(pb) < c->vidpos && !pb->eof_reached){ tag = avio_rl32(pb); fsize = avio_rl32(pb); if(tag == MKTAG('d', 'a', 't', 'a')) break; @@ -162,7 +162,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } avio_seek(s->pb, c->vidpos, SEEK_SET); - while(!url_feof(s->pb) && c->frames){ + while(!s->pb->eof_reached && c->frames){ avio_read(s->pb, buf, 4); switch(AV_RL32(buf)){ case MKTAG('N', 'U', 'L', 'L'): diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 4abf0223e2..a43cfc8d66 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -109,7 +109,7 @@ static int process_audio_header_elements(AVFormatContext *s) ea->sample_rate = -1; ea->num_channels = 1; - while (!url_feof(pb) && inHeader) { + while (!pb->eof_reached && inHeader) { int inSubheader; uint8_t byte; byte = avio_r8(pb); @@ -118,7 +118,7 @@ static int process_audio_header_elements(AVFormatContext *s) case 0xFD: av_log (s, AV_LOG_DEBUG, "entered audio subheader\n"); inSubheader = 1; - while (!url_feof(pb) && inSubheader) { + while (!pb->eof_reached && inSubheader) { uint8_t subbyte; subbyte = avio_r8(pb); diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 53eaa8e6f7..1b5be16ff7 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -91,7 +91,7 @@ static int ffm_resync(AVFormatContext *s, int state) { av_log(s, AV_LOG_ERROR, "resyncing\n"); while (state != PACKET_ID) { - if (url_feof(s->pb)) { + if (s->pb->eof_reached) { av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n"); return -1; } diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c index cc7e1da48f..ed65624520 100644 --- a/libavformat/ffmetadec.c +++ b/libavformat/ffmetadec.c @@ -48,7 +48,7 @@ static void get_line(AVIOContext *s, uint8_t *buf, int size) buf[i++] = c; } buf[i] = 0; - } while (!url_feof(s) && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0)); + } while (!s->eof_reached && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0)); } static AVChapter *read_chapter(AVFormatContext *s) @@ -126,7 +126,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) AVMetadata **m = &s->metadata; uint8_t line[1024]; - while(!url_feof(s->pb)) { + while(!s->pb->eof_reached) { get_line(s->pb, line, sizeof(line)); if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) { diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 8d56b0e340..568bc0d17a 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -80,7 +80,7 @@ static int read_packet(AVFormatContext *s, FilmstripDemuxContext *film = s->priv_data; AVStream *st = s->streams[0]; - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR(EIO); pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 73eeacb422..e935c3f168 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -46,7 +46,7 @@ static int flac_read_header(AVFormatContext *s, } /* process metadata blocks */ - while (!url_feof(s->pb) && !metadata_last) { + while (!s->pb->eof_reached && !metadata_last) { avio_read(s->pb, header, 4); ff_flac_parse_block_header(header, &metadata_last, &metadata_type, &metadata_size); diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 7e02cdd3b4..bb27131cfd 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -311,7 +311,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) dts = avio_rb24(s->pb); dts |= avio_r8(s->pb) << 24; // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts); - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR_EOF; avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */ flags = 0; diff --git a/libavformat/gxf.c b/libavformat/gxf.c index dc0272d5c3..9e47249152 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -368,7 +368,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { #define READ_ONE() \ { \ - if (!max_interval-- || url_feof(pb)) \ + if (!max_interval-- || pb->eof_reached) \ goto out; \ tmp = tmp << 8 | avio_r8(pb); \ } @@ -422,13 +422,13 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; GXFPktType pkt_type; int pkt_len; - while (!url_feof(pb)) { + while (!pb->eof_reached) { AVStream *st; int track_type, track_id, ret; int field_nr, field_info, skip = 0; int stream_index; if (!parse_packet_header(pb, &pkt_type, &pkt_len)) { - if (!url_feof(pb)) + if (!pb->eof_reached) av_log(s, AV_LOG_ERROR, "sync lost\n"); return -1; } diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 1aecf86669..78e6caf1ca 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -227,7 +227,7 @@ static int idcin_read_packet(AVFormatContext *s, unsigned char r, g, b; unsigned char palette_buffer[768]; - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR(EIO); if (idcin->next_chunk_is_video) { diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 391db609b7..1feb236188 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -111,7 +111,7 @@ static int roq_read_packet(AVFormatContext *s, while (!packet_read) { - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR(EIO); /* get the next chunk preamble */ diff --git a/libavformat/iff.c b/libavformat/iff.c index dd69ce8ca5..3e329343a4 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -138,7 +138,7 @@ static int iff_read_header(AVFormatContext *s, // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content st->codec->codec_tag = avio_rl32(pb); - while(!url_feof(pb)) { + while(!pb->eof_reached) { uint64_t orig_pos; int res; const char *metadata_tag = NULL; diff --git a/libavformat/img2.c b/libavformat/img2.c index c909078ecf..44c53fc18c 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -287,7 +287,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) infer_size(&codec->width, &codec->height, size[0]); } else { f[0] = s1->pb; - if (url_feof(f[0])) + if (f[0]->eof_reached) return AVERROR(EIO); size[0]= 4096; } diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index b54df38b23..508a82b6be 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -225,7 +225,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, return chunk_type; /* read the next chunk, wherever the file happens to be pointing */ - if (url_feof(pb)) + if (pb->eof_reached) return CHUNK_EOF; if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) @@ -271,7 +271,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) { /* read the next chunk, wherever the file happens to be pointing */ - if (url_feof(pb)) { + if (pb->eof_reached) { chunk_type = CHUNK_EOF; break; } @@ -532,7 +532,7 @@ static int ipmovie_read_header(AVFormatContext *s, while (memcmp(signature_buffer, signature, sizeof(signature))) { memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1); signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb); - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR_EOF; } /* initialize private context members */ diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 4e98c895cf..0d5d8e8f91 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -90,7 +90,7 @@ static int sync(AVFormatContext *s, uint8_t *header) return ret < 0 ? ret : AVERROR_EOF; while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) { - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR_EOF; memmove(buf, &buf[1], LXF_IDENT_LENGTH-1); diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index ffb9d73d3c..a356611930 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -548,7 +548,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, * use it safely here to catch EOS. */ if (!(total = avio_r8(pb))) { /* we might encounter EOS here */ - if (!url_feof(pb)) { + if (!pb->eof_reached) { int64_t pos = avio_tell(pb); av_log(matroska->ctx, AV_LOG_ERROR, "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 0f5cee4f71..be3f649b41 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -266,7 +266,7 @@ static int mmf_read_packet(AVFormatContext *s, AVStream *st; int ret, size; - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR(EIO); st = s->streams[0]; diff --git a/libavformat/mov.c b/libavformat/mov.c index 34b5f8e754..db798154a0 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -259,7 +259,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (atom.size < 0) atom.size = INT64_MAX; - while (total_size + 8 < atom.size && !url_feof(pb)) { + while (total_size + 8 < atom.size && !pb->eof_reached) { int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL; a.size = atom.size; a.type=0; @@ -2411,7 +2411,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) mov->found_mdat = 0; if (!url_is_streamed(s->pb) || mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 || - url_feof(s->pb)) + s->pb->eof_reached) return AVERROR_EOF; av_dlog(s, "read fragments, offset 0x%llx\n", avio_tell(s->pb)); goto retry; diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index b55bf49650..a1615a835b 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -200,7 +200,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } - while(!url_feof(pb)){ + while(!pb->eof_reached){ pos = avio_tell(pb); mpc8_get_chunk_header(pb, &tag, &size); if(tag == TAG_STREAMHDR) @@ -247,7 +247,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt) int tag; int64_t pos, size; - while(!url_feof(s->pb)){ + while(!s->pb->eof_reached){ pos = avio_tell(s->pb); mpc8_get_chunk_header(s->pb, &tag, &size); if (size < 0) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 740dbc94c0..7a93c637f7 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -143,7 +143,7 @@ static int find_next_start_code(AVIOContext *pb, int *size_ptr, state = *header_state; n = *size_ptr; while (n > 0) { - if (url_feof(pb)) + if (pb->eof_reached) break; v = avio_r8(pb); n--; @@ -253,7 +253,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, last_sync = avio_tell(s->pb); //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb)); if (startcode < 0){ - if(url_feof(s->pb)) + if(s->pb->eof_reached) return AVERROR_EOF; //FIXME we should remember header_state return AVERROR(EAGAIN); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index a1446d839f..ea41d81c11 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1329,7 +1329,7 @@ static int mpegts_resync(AVFormatContext *s) for(i = 0;i < MAX_RESYNC_SIZE; i++) { c = avio_r8(pb); - if (url_feof(pb)) + if (pb->eof_reached) return -1; if (c == 0x47) { avio_seek(pb, -1, SEEK_CUR); diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index 2a11a57201..5af1c4e0ad 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -88,9 +88,9 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) /* Some files start with "connected\r\n\r\n". * So skip until we find the first byte of struct size */ - while(avio_r8(pb) != HEADER_SIZE && !url_feof(pb)); + while(avio_r8(pb) != HEADER_SIZE && !pb->eof_reached); - if(url_feof(pb)) { + if(pb->eof_reached) { av_log(ctx, AV_LOG_ERROR, "Could not find valid start."); return -1; } diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 19a632b01a..de91fce755 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -179,7 +179,7 @@ static int64_t klv_decode_ber_length(AVIOContext *pb) static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size) { int i, b; - for (i = 0; i < size && !url_feof(pb); i++) { + for (i = 0; i < size && !pb->eof_reached; i++) { b = avio_r8(pb); if (b == key[0]) i = 0; @@ -305,7 +305,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) { KLVPacket klv; - while (!url_feof(s->pb)) { + while (!s->pb->eof_reached) { if (klv_read_packet(&klv, s->pb) < 0) return -1; PRINT_KEY(s, "read packet", klv.key); @@ -914,7 +914,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) } avio_seek(s->pb, -14, SEEK_CUR); mxf->fc = s; - while (!url_feof(s->pb)) { + while (!s->pb->eof_reached) { const MXFMetadataReadTableEntry *metadata; if (klv_read_packet(&klv, s->pb) < 0) diff --git a/libavformat/mxg.c b/libavformat/mxg.c index 81ffec6971..3a71b22054 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -132,7 +132,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) uint8_t *startmarker_ptr, *end, *search_end, marker; MXGContext *mxg = s->priv_data; - while (!url_feof(s->pb) && !url_ferror(s->pb)){ + while (!s->pb->eof_reached && !url_ferror(s->pb)){ if (mxg->cache_size <= OVERREAD_SIZE) { /* update internal buffer */ ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE); diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c index 79a4dbafab..0c44aaa5be 100644 --- a/libavformat/ncdec.c +++ b/libavformat/ncdec.c @@ -66,7 +66,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) uint32_t state=-1; while (state != NC_VIDEO_FLAG) { - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR(EIO); state = (state<<8) + avio_r8(s->pb); } diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 3bfebb263c..1dc7cb0869 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -230,7 +230,7 @@ static int nsv_resync(AVFormatContext *s) //nsv->state = NSV_UNSYNC; for (i = 0; i < NSV_MAX_RESYNC; i++) { - if (url_feof(pb)) { + if (pb->eof_reached) { av_dlog(s, "NSV EOF\n"); nsv->state = NSV_UNSYNC; return -1; @@ -296,7 +296,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) table_entries_used = avio_rl32(pb); av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", strings_size, table_entries, table_entries_used); - if (url_feof(pb)) + if (pb->eof_reached) return -1; av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb)); @@ -331,7 +331,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) } av_free(strings); } - if (url_feof(pb)) + if (pb->eof_reached) return -1; av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_tell(pb)); @@ -378,7 +378,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */ - if (url_feof(pb)) + if (pb->eof_reached) return -1; nsv->state = NSV_HAS_READ_NSVF; return 0; @@ -554,7 +554,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header) return 0; //-1; /* hey! eat what you've in your plate first! */ null_chunk_retry: - if (url_feof(pb)) + if (pb->eof_reached) return -1; for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++) @@ -588,7 +588,7 @@ null_chunk_retry: vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */ } - if (url_feof(pb)) + if (pb->eof_reached) return -1; if (!vsize && !asize) { nsv->state = NSV_UNSYNC; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 107ff6815f..d31040efb8 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -121,7 +121,7 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){ if(pos >= 0) avio_seek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are - while(!url_feof(bc)){ + while(!bc->eof_reached){ state= (state<<8) | avio_r8(bc); if((state>>56) != 'N') continue; @@ -790,7 +790,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) pos-=8; }else{ frame_code = avio_r8(bc); - if(url_feof(bc)) + if(bc->eof_reached) return -1; if(frame_code == 'N'){ tmp= frame_code; diff --git a/libavformat/nuv.c b/libavformat/nuv.c index 6f4a03192d..bd2e28145e 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -60,7 +60,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, nuv_frametype frametype; if (!vst && !myth) return 1; // no codec data needed - while (!url_feof(pb)) { + while (!pb->eof_reached) { int size, subtype; frametype = avio_r8(pb); switch (frametype) { @@ -195,7 +195,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { uint8_t hdr[HDRSIZE]; nuv_frametype frametype; int ret, size; - while (!url_feof(pb)) { + while (!pb->eof_reached) { int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0; uint64_t pos = avio_tell(pb); ret = avio_read(pb, hdr, HDRSIZE); diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 379de7eac1..76ef19ada3 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -219,7 +219,7 @@ ogg_read_page (AVFormatContext * s, int *str) break; c = avio_r8(bc); - if (url_feof(bc)) + if (bc->eof_reached) return -1; sync[sp++ & 3] = c; }while (i++ < MAX_PAGE_SIZE); diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index 744ae94459..3b0780b6ea 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -241,7 +241,7 @@ static int str_read_packet(AVFormatContext *s, break; } - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR(EIO); } } diff --git a/libavformat/qcp.c b/libavformat/qcp.c index fefc929279..b58ae33579 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -140,7 +140,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) QCPContext *c = s->priv_data; unsigned int chunk_size, tag; - while(!url_feof(pb)) { + while(!pb->eof_reached) { if (c->data_size) { int pkt_size, ret, mode = avio_r8(pb); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index e2e9b0298c..4fd2e86759 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -409,7 +409,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rb32(pb); /* number of headers */ for(;;) { - if (url_feof(pb)) + if (pb->eof_reached) return -1; tag = avio_rl32(pb); tag_size = avio_rb32(pb); @@ -515,7 +515,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ AVStream *st; uint32_t state=0xFFFFFFFF; - while(!url_feof(pb)){ + while(!pb->eof_reached){ int len, num, i; *pos= avio_tell(pb) - 3; if(rm->remaining_len > 0){ @@ -848,7 +848,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) st = s->streams[i]; } - if(len<0 || url_feof(s->pb)) + if(len<0 || s->pb->eof_reached) return AVERROR(EIO); res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt, diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 2603a4d71c..5fc6e58e59 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -235,7 +235,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) int palchange = 0; int pos; - if (url_feof(s->pb) || smk->cur_frame >= smk->frames) + if (s->pb->eof_reached || smk->cur_frame >= smk->frames) return AVERROR_EOF; /* if we demuxed all streams, pass another frame */ diff --git a/libavformat/sol.c b/libavformat/sol.c index 7ad894e304..2a3b40c02b 100644 --- a/libavformat/sol.c +++ b/libavformat/sol.c @@ -130,7 +130,7 @@ static int sol_read_packet(AVFormatContext *s, { int ret; - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR(EIO); ret= av_get_packet(s->pb, pkt, MAX_SIZE); pkt->stream_index = 0; diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index 6d99033f47..293e8463a3 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -127,7 +127,7 @@ static int sox_read_packet(AVFormatContext *s, { int ret, size; - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR_EOF; size = SOX_SAMPLES*s->streams[0]->codec->block_align; diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index 8a6b79dd52..0ca66118f0 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -171,7 +171,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) { state = (state << 8) | avio_r8(pb); - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR_EOF; } diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index 0a94a7f518..3572add0dd 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -81,7 +81,7 @@ static int srt_read_packet(AVFormatContext *s, AVPacket *pkt) do { ptr2 = ptr; ptr += ff_get_line(s->pb, ptr, sizeof(buffer)+buffer-ptr); - } while (!is_eol(*ptr2) && !url_feof(s->pb) && ptr-bufferpb->eof_reached && ptr-bufferdata, buffer, pkt->size); diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index c63052c66c..57eb233b35 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -27,7 +27,7 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr) { int tag, len; - if (url_feof(pb)) + if (pb->eof_reached) return -1; tag = avio_rl16(pb); diff --git a/libavformat/tmv.c b/libavformat/tmv.c index c632988e18..1116ca0369 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -146,7 +146,7 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt) int ret, pkt_size = tmv->stream_index ? tmv->audio_chunk_size : tmv->video_chunk_size; - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR_EOF; ret = av_get_packet(pb, pkt, pkt_size); diff --git a/libavformat/tty.c b/libavformat/tty.c index 71c00e7e0a..8af245ae60 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -106,7 +106,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) TtyDemuxContext *s = avctx->priv_data; int n; - if (url_feof(avctx->pb)) + if (avctx->pb->eof_reached) return AVERROR_EOF; n = s->chars_per_frame; diff --git a/libavformat/txd.c b/libavformat/txd.c index 22dcfdbe77..b62a7dcbf6 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -61,7 +61,7 @@ next_chunk: chunk_size = avio_rl32(pb); marker = avio_rl32(pb); - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR_EOF; if (marker != TXD_MARKER && marker != TXD_MARKER2) { av_log(s, AV_LOG_ERROR, "marker does not match\n"); diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 2f84b52674..54d96f57d7 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -92,7 +92,7 @@ static int vc1t_read_packet(AVFormatContext *s, int keyframe = 0; uint32_t pts; - if(url_feof(pb)) + if(pb->eof_reached) return AVERROR(EIO); frame_size = avio_rl24(pb); diff --git a/libavformat/wav.c b/libavformat/wav.c index 8023a791f3..d51c01208e 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -155,7 +155,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1) int64_t size; for (;;) { - if (url_feof(pb)) + if (pb->eof_reached) return -1; size = next_tag(pb, &tag); if (tag == tag1) @@ -234,7 +234,7 @@ static int wav_read_header(AVFormatContext *s, av_set_pts_info(st, 64, 1, st->codec->sample_rate); for (;;) { - if (url_feof(pb)) + if (pb->eof_reached) return -1; size = next_tag(pb, &tag); if (tag == MKTAG('d', 'a', 't', 'a')){ @@ -269,7 +269,7 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) uint8_t guid[16]; int64_t size; - while (!url_feof(pb)) { + while (!pb->eof_reached) { avio_read(pb, guid, 16); size = avio_rl64(pb); if (size <= 24) diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index a4dd26b442..e4c871ca09 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -157,7 +157,7 @@ static int wc3_read_header(AVFormatContext *s, fourcc_tag = avio_rl32(pb); /* chunk sizes are 16-bit aligned */ size = (avio_rb32(pb) + 1) & (~1); - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR(EIO); } while (fourcc_tag != BRCH_TAG); @@ -208,7 +208,7 @@ static int wc3_read_packet(AVFormatContext *s, fourcc_tag = avio_rl32(pb); /* chunk sizes are 16-bit aligned */ size = (avio_rb32(pb) + 1) & (~1); - if (url_feof(pb)) + if (pb->eof_reached) return AVERROR(EIO); switch (fourcc_tag) { diff --git a/libavformat/wtv.c b/libavformat/wtv.c index ade4a42e1b..2b3737bc84 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -79,7 +79,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) if (wf->error || url_ferror(pb)) return -1; - if (wf->position >= wf->length || url_feof(pb)) + if (wf->position >= wf->length || pb->eof_reached) return 0; buf_size = FFMIN(buf_size, wf->length - wf->position); @@ -554,7 +554,7 @@ static void parse_legacy_attrib(AVFormatContext *s, AVIOContext *pb) { ff_asf_guid guid; int length, type; - while(!url_feof(pb)) { + while(!pb->eof_reached) { char key[1024]; ff_get_guid(pb, &guid); type = avio_rl32(pb); @@ -770,7 +770,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p { WtvContext *wtv = s->priv_data; AVIOContext *pb = wtv->pb; - while (!url_feof(pb)) { + while (!pb->eof_reached) { ff_asf_guid g; int len, sid, consumed; @@ -997,7 +997,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) while(1) { uint64_t timestamp = avio_rl64(pb); uint64_t frame_nb = avio_rl64(pb); - if (url_feof(pb)) + if (pb->eof_reached) break; ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size, 0, timestamp, frame_nb, 0, AVINDEX_KEYFRAME); @@ -1011,7 +1011,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) while (1) { uint64_t frame_nb = avio_rl64(pb); uint64_t position = avio_rl64(pb); - if (url_feof(pb)) + if (pb->eof_reached) break; for (i = wtv->nb_index_entries - 1; i >= 0; i--) { AVIndexEntry *e = wtv->index_entries + i; diff --git a/libavformat/wv.c b/libavformat/wv.c index 1b6061ce43..12aaef991b 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -241,7 +241,7 @@ static int wv_read_packet(AVFormatContext *s, int ret; int size, ver, off; - if (url_feof(s->pb)) + if (s->pb->eof_reached) return AVERROR(EIO); if(wc->block_parsed){ if(wv_read_block_header(s, s->pb, 0) < 0) From 31ff9bd7b8cd8236f70e2bf5368a480fa49f7d27 Mon Sep 17 00:00:00 2001 From: Nathan Caldwell Date: Tue, 8 Mar 2011 01:22:14 -0700 Subject: [PATCH 527/528] aacenc: Fix a segfault in search_for_quantizers This reverts the removal of scoefs from AACEncContext. It resulted in scoefs being a NULL pointer when search_for_quantizers() is called. Signed-off-by: Ronald S. Bultje --- libavcodec/aacenc.c | 1 - libavcodec/aacenc.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 17ae6f99d3..0ca390e72b 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -598,7 +598,6 @@ static int aac_encode_frame(AVCodecContext *avctx, } for (j = 0; j < chans; j++) { s->cur_channel = start_ch + j; - s->scoefs = cpe->ch[j].ret; encode_individual_channel(avctx, s, &cpe->ch[j], cpe->common_window); } start_ch += chans; diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index 3559234ff1..1c8467990c 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -63,8 +63,8 @@ typedef struct AACEncContext { int cur_channel; int last_frame; float lambda; - float *scoefs; ///< scaled coefficients DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients + DECLARE_ALIGNED(16, float, scoefs)[1024]; ///< scaled coefficients } AACEncContext; #endif /* AVCODEC_AACENC_H */ From fb61a7c5343a23d845ab73dd28caf6ec98cd6101 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 7 Mar 2011 22:32:05 +0000 Subject: [PATCH 528/528] id3v2: fix typo in error message Signed-off-by: Mans Rullgard --- libavformat/id3v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 7635735195..76c7124525 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -115,7 +115,7 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha dst[len] = 0; break; default: - av_log(s, AV_LOG_WARNING, "Unknown encoding in tag %s\n.", key); + av_log(s, AV_LOG_WARNING, "Unknown encoding in tag %s.\n", key); } if (!(strcmp(key, "TCON") && strcmp(key, "TCO"))