Re: [libav-devel] [PATCH 3/3] Use parsers for RealVideo 3/4 to determine correct PTS
On Tue, Aug 16, 2011 at 04:13:35PM -0700, Ronald S. Bultje wrote: Hi, On Mon, Aug 15, 2011 at 11:43 PM, Kostya kostya.shish...@gmail.com wrote: On Mon, Aug 15, 2011 at 09:42:50PM +0100, Måns Rullgård wrote: Kostya kostya.shish...@gmail.com writes: [...] Why are most of the frames completely different? Why is there one frame less decoded? [...] Here too many frames have a different checksum. Why? Because of the wonderful synchronisation system Libav inherited (and maybe also because of wrong FPS reported). FATE ref for RV30 sample, for example, has only 46 frames, but when I invoke framecrc with -vsync 0 it decodes all real 109 frames, and those checksums are the same for Libav with and without my patches. I remember that adding proper FPS reporting made it report about actual number of frames too, so patch is pending. With that patch, the output is indeed correct. Nice job. For this patch: +} else { +if (type != 3) +s-pts = pc-key_dts + ((pts - pc-key_pts) 0x1FFF); +else +s-pts = pc-key_dts - ((pc-key_pts - pts) 0x1FFF); +} I suppose this could use some doxy. What happens if we have a matroska file with RV40 video? Does it need the PTS correction? Is the parser invoked? It's not invoked unless demuxer says so by setting stream-need_parsing. +s-pict_type = type + !type; This will subtly break if someone ever decides to change the meaning of s-pict_type defines/enums. Here you are. From a734ea5ceb2da3606a16a2b6e0eb3bffc49a8ae1 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov kostya.shish...@gmail.com Date: Mon, 15 Aug 2011 12:03:40 +0200 Subject: [PATCH 2/3] Use parsers for RealVideo 3/4 to determine correct PTS --- libavcodec/Makefile |2 + libavcodec/allcodecs.c |2 + libavcodec/rv34_parser.c | 97 ++ libavformat/rmdec.c |1 + tests/ref/fate/real-rv40 | 205 +++--- tests/ref/fate/rv30 | 63 +++--- 6 files changed, 235 insertions(+), 135 deletions(-) create mode 100644 libavcodec/rv34_parser.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 36e07a9..2264e86 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -616,6 +616,8 @@ OBJS-$(CONFIG_MPEGVIDEO_PARSER)+= mpegvideo_parser.o\ mpeg12.o mpeg12data.o \ mpegvideo.o error_resilience.o OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o +OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o +OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \ msmpeg4.o msmpeg4data.o mpeg4video.o \ h263.o mpegvideo.o error_resilience.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index dcef0d6..7ba945c 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -396,6 +396,8 @@ void avcodec_register_all(void) REGISTER_PARSER (MPEGAUDIO, mpegaudio); REGISTER_PARSER (MPEGVIDEO, mpegvideo); REGISTER_PARSER (PNM, pnm); +REGISTER_PARSER (RV30, rv30); +REGISTER_PARSER (RV40, rv40); REGISTER_PARSER (VC1, vc1); REGISTER_PARSER (VP3, vp3); REGISTER_PARSER (VP8, vp8); diff --git a/libavcodec/rv34_parser.c b/libavcodec/rv34_parser.c new file mode 100644 index 000..c2563a5 --- /dev/null +++ b/libavcodec/rv34_parser.c @@ -0,0 +1,97 @@ +/* + * RV30/40 parser + * Copyright (c) 2011 Konstantin Shishkov + * + * This file is part of Libav. + * + * Libav 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. + * + * Libav 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * RV30/40 parser + */ + +#include parser.h +#include libavutil/intreadwrite.h + +typedef struct { +ParseContext pc; +int64_t key_dts; +int key_pts; +} RV34ParseContext; + +static const int rv_to_av_frame_type[4] = { +AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, +}; + +static int rv34_parse(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t
Re: [libav-devel] [PATCH] Windows Media Image decoder (WMVP/WVP2)
On Tue, Aug 16, 2011 at 05:08:52PM -0700, Ronald S. Bultje wrote: Hi, On Tue, Aug 16, 2011 at 5:24 AM, Alberto Delmás adel...@gmail.com wrote: +av_log(avctx, AV_LOG_DEBUG, %d.%.3d, + sd-coefs[sprite][i] / (116), + (sd-coefs[sprite][i] 0x) * 1000 / (116)); I don't believe this works for negative numbers. Same for effects_param1/2. Probably should be abs(sd-coefs[sprite][i]) in the last line. @@ -208,7 +208,12 @@ void ff_copy_picture(Picture *dst, Picture *src){ */ static void free_frame_buffer(MpegEncContext *s, Picture *pic) { -ff_thread_release_buffer(s-avctx, (AVFrame*)pic); +/* Windows Media Image codecs allocate internal buffers with different + dimensions; ignore user defined callbacks for these */ +if (s-codec_id != CODEC_ID_WMV3IMAGE s-codec_id != CODEC_ID_VC1IMAGE) +ff_thread_release_buffer(s-avctx, (AVFrame*)pic); +else +avcodec_default_release_buffer(s-avctx, (AVFrame*)pic); So coming back to this old one - is there some way we can signal at the buffer request phase which buffer is to be displayed and at display height, and which isn't? That'd allow us to keep using ff_thread_release_buffer() at least for these, which can be a significant performance gain. Probably by augmenting API. I'm gonna assume Kostya also did some review here. Patch basically looks good to me. Yes, I've looked at it before it was sent to ML. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] lavf: Add an XMV demuxer
On Tue, Aug 16, 2011 at 09:26:45PM +0200, Sven Hesse wrote: New version. The wmv2dec hack was removed; the demuxer now manually converts the extradata into the standard WMV2 format. This has the added benefit that remuxing works now. Additionally, the keyframe flag is also passed to video packets containing key frames, this is apparently necessary for remuxing to work correctly. From 3ef19ef9243e397f5775b8d5273d7500a12c80d5 Mon Sep 17 00:00:00 2001 From: Sven Hesse drmc...@users.sourceforge.net Date: Mon, 15 Aug 2011 21:14:47 +0200 Subject: [PATCH] lavf: Add an XMV demuxer --- Changelog|1 + doc/general.texi |2 + libavformat/Makefile |1 + libavformat/allformats.c |1 + libavformat/version.h|2 +- libavformat/xmv.c| 576 ++ 6 files changed, 582 insertions(+), 1 deletions(-) create mode 100644 libavformat/xmv.c LGTM ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] Tell RV10/20 decoder to use edge emulation.
This removes out-of-edge motion compensation artifacts (easily spotted green blocks in avplay, gray blocks in transcoding), for example here: http://samples.libav.org/samples/real/tv_watching_t1.rm --- libavcodec/rv10.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 3939984..d789eff 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -431,6 +431,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) s-avctx= avctx; s-out_format = FMT_H263; s-codec_id= avctx-codec_id; +avctx-flags |= CODEC_FLAG_EMU_EDGE; s-orig_width = s-width = avctx-coded_width; s-orig_height= s-height = avctx-coded_height; -- 1.7.0.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] AMD testers wanted.
On Tue, Aug 16, 2011 at 08:24:40AM -0700, Alex Converse wrote: On Tue, Aug 16, 2011 at 2:33 AM, Diego Biurrun di...@biurrun.de wrote: On Mon, Aug 15, 2011 at 02:49:01PM -0700, Alex Converse wrote: On Sun, Aug 14, 2011 at 11:29 AM, Loren Merritt lor...@u.washington.edu wrote: On Sun, 14 Aug 2011, Jason Garrett-Glaser wrote: On Sun, Aug 14, 2011 at 3:41 AM, Vitor Sessak vitor1...@gmail.com wrote: On Sun, Aug 14, 2011 at 6:03 AM, Alex Converse alex.conve...@gmail.com wrote: When the 3DNOW version of vector_fmul_add was preferred over SSE the code was substantially more complex than it is now. Would someone with an AMD chip that supports both SSE and 3DNOW be willing to benchmark them and see which is current faster? According to /proc/cpuinfo: model name : AMD Athlon(tm) 64 X2 Dual Core Processor 5600+ Using the best result for each of 1000 runs: 1334000 dezicycles in 3DNOW, 1 runs, 0 skips 1336460 dezicycles in SSE, 1 runs, 0 skips Are we sure this isn't memory-bound? Of course it's memory-bound. So the SSE version should be faster on k10. What about on older AMD cpus? Like a K6-III+? :-) Does K-6 III+ support SSE? Wikipedia seems to say that SSE first showed up in AMD's line at Athlon XP/MP and Mobile Athlon 4. No, it doesn't - I forgot about the context above where you ask about CPUs with both SSE and 3DNow!, sorry for the noise. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Tell RV10/20 decoder to use edge emulation.
On Wed, Aug 17, 2011 at 01:33:07PM +0200, Luca Barbato wrote: On 8/17/11 10:36 AM, Kostya Shishkov wrote: This removes out-of-edge motion compensation artifacts (easily spotted green blocks in avplay, gray blocks in transcoding), for example here: http://samples.libav.org/samples/real/tv_watching_t1.rm --- libavcodec/rv10.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 3939984..d789eff 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -431,6 +431,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) s-avctx= avctx; s-out_format = FMT_H263; s-codec_id= avctx-codec_id; +avctx-flags |= CODEC_FLAG_EMU_EDGE; s-orig_width = s-width = avctx-coded_width; s-orig_height= s-height = avctx-coded_height; Is this patch depending on other? Seems fine. No, it's independent. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Tell RV10/20 decoder to use edge emulation.
On Wed, Aug 17, 2011 at 01:47:31PM +0200, Kostya wrote: On Wed, Aug 17, 2011 at 01:33:07PM +0200, Luca Barbato wrote: On 8/17/11 10:36 AM, Kostya Shishkov wrote: This removes out-of-edge motion compensation artifacts (easily spotted green blocks in avplay, gray blocks in transcoding), for example here: http://samples.libav.org/samples/real/tv_watching_t1.rm --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -431,6 +431,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) s-avctx= avctx; s-out_format = FMT_H263; s-codec_id= avctx-codec_id; +avctx-flags |= CODEC_FLAG_EMU_EDGE; s-orig_width = s-width = avctx-coded_width; s-orig_height= s-height = avctx-coded_height; Is this patch depending on other? Seems fine. No, it's independent. Queued. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] lavf: Add an XMV demuxer
On Wed, Aug 17, 2011 at 09:09:33AM +0200, Kostya wrote: On Tue, Aug 16, 2011 at 09:26:45PM +0200, Sven Hesse wrote: New version. From 3ef19ef9243e397f5775b8d5273d7500a12c80d5 Mon Sep 17 00:00:00 2001 From: Sven Hesse drmc...@users.sourceforge.net Date: Mon, 15 Aug 2011 21:14:47 +0200 Subject: [PATCH] lavf: Add an XMV demuxer --- Changelog|1 + doc/general.texi |2 + libavformat/Makefile |1 + libavformat/allformats.c |1 + libavformat/version.h|2 +- libavformat/xmv.c| 576 ++ 6 files changed, 582 insertions(+), 1 deletions(-) create mode 100644 libavformat/xmv.c LGTM Queued. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] RV3/4 parser: remove unused variable 'off'
--- libavcodec/rv34_parser.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/libavcodec/rv34_parser.c b/libavcodec/rv34_parser.c index c2563a5..ce86043 100644 --- a/libavcodec/rv34_parser.c +++ b/libavcodec/rv34_parser.c @@ -43,7 +43,6 @@ static int rv34_parse(AVCodecParserContext *s, const uint8_t *buf, int buf_size) { RV34ParseContext *pc = s-priv_data; -int off; int type, pts, hdr; if (buf_size 13 + *buf * 8) { @@ -52,7 +51,6 @@ static int rv34_parse(AVCodecParserContext *s, return buf_size; } -off = AV_RL32(buf + 5); hdr = AV_RB32(buf + 9 + *buf * 8); if (avctx-codec_id == CODEC_ID_RV30) { type = (hdr 27) 3; -- 1.7.0.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] RV3/4 parser: remove unused variable 'off'
On Wed, Aug 17, 2011 at 03:07:49PM +0200, Kostya Shishkov wrote: --- libavcodec/rv34_parser.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) Queued. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] ffmpeg: remove unsed variable nopts
--- ffmpeg.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 1443dd3..c4ac3f9 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -695,7 +695,6 @@ static int read_avserver_streams(AVFormatContext *s, const char *filename) { int i, err; AVFormatContext *ic = NULL; -int nopts = 0; err = avformat_open_input(ic, filename, NULL, NULL); if (err 0) @@ -726,9 +725,6 @@ static int read_avserver_streams(AVFormatContext *s, const char *filename) } else choose_pixel_fmt(st, codec); } - -if(st-codec-flags CODEC_FLAG_BITEXACT) -nopts = 1; } av_close_input_file(ic); -- 1.7.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] ffmpeg: remove unsed variable nopts
On Wed, Aug 17, 2011 at 03:39:37PM +0200, Diego Biurrun wrote: --- ffmpeg.c |4 1 files changed, 0 insertions(+), 4 deletions(-) You know, it prints This program is not developed anymore and is only provided for compatibility., so please concentrate on improving avconv instead. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] ffmpeg: remove unsed variable nopts
On Wed, Aug 17, 2011 at 03:47:10PM +0200, Kostya wrote: On Wed, Aug 17, 2011 at 03:39:37PM +0200, Diego Biurrun wrote: --- ffmpeg.c |4 1 files changed, 0 insertions(+), 4 deletions(-) You know, it prints This program is not developed anymore and is only provided for compatibility., so please concentrate on improving avconv instead. I know, but it's still there for the moment and prints an annoying warning during compilation. Getting rid of that annoyance was worth spending 5 minutes on this to me, so please just approve it. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] ffmpeg: remove unsed variable nopts
On Wed, Aug 17, 2011 at 03:54:19PM +0200, Diego Biurrun wrote: On Wed, Aug 17, 2011 at 03:47:10PM +0200, Kostya wrote: On Wed, Aug 17, 2011 at 03:39:37PM +0200, Diego Biurrun wrote: --- ffmpeg.c |4 1 files changed, 0 insertions(+), 4 deletions(-) You know, it prints This program is not developed anymore and is only provided for compatibility., so please concentrate on improving avconv instead. I know, but it's still there for the moment and prints an annoying warning during compilation. Getting rid of that annoyance was worth spending 5 minutes on this to me, so please just approve it. OK (and don't forget to drop ffmpeg.c completely after the next release) ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 02/11] avconv: make itsscale syntax consistent with other options.
Move the stream specifier to the option name. --- avconv.c | 37 + 1 files changed, 17 insertions(+), 20 deletions(-) diff --git a/avconv.c b/avconv.c index 7c72db2..84fbbaa 100644 --- a/avconv.c +++ b/avconv.c @@ -100,8 +100,7 @@ static const OptionDef options[]; #define MAX_FILES 100 static const char *last_asked_format = NULL; -static double *ts_scale; -static int nb_ts_scale; +static AVDictionary *ts_scale; static AVFormatContext *output_files[MAX_FILES]; static AVDictionary *output_opts[MAX_FILES]; @@ -2762,18 +2761,7 @@ static int opt_map_metadata(const char *opt, const char *arg) static int opt_input_ts_scale(const char *opt, const char *arg) { -unsigned int stream; -double scale; -char *p; - -stream = strtol(arg, p, 0); -if (*p) -p++; -scale= strtod(p, p); - -ts_scale = grow_array(ts_scale, sizeof(*ts_scale), nb_ts_scale, stream + 1); -ts_scale[stream] = scale; -return 0; +return av_dict_set(ts_scale, opt, arg, 0); } static int opt_recording_time(const char *opt, const char *arg) @@ -2852,12 +2840,14 @@ static AVCodec *choose_codec(AVFormatContext *s, AVStream *st, enum AVMediaType */ static void add_input_streams(AVFormatContext *ic) { -int i, rfps, rfps_base; +int i, rfps, rfps_base, ret; for (i = 0; i ic-nb_streams; i++) { AVStream *st = ic-streams[i]; AVCodecContext *dec = st-codec; +AVDictionaryEntry *e = NULL; InputStream *ist; +char *scale = NULL; dec-thread_count = thread_count; @@ -2868,8 +2858,16 @@ static void add_input_streams(AVFormatContext *ic) ist-discard = 1; ist-opts = filter_codec_opts(codec_opts, ist-st-codec-codec_id, ic, st); -if (i nb_ts_scale) -ist-ts_scale = ts_scale[i]; +while (e = av_dict_get(ts_scale, , e, AV_DICT_IGNORE_SUFFIX)) { +char *p = strchr(e-key, ':'); + +if ((ret = check_stream_specifier(ic, st, p ? p + 1 : )) 0) +scale = e-value; +else if (ret 0) +exit_program(1); +} +if (scale) +ist-ts_scale = strtod(scale, NULL); ist-dec = choose_codec(ic, st, dec-codec_type, codec_names); @@ -3053,8 +3051,7 @@ static int opt_input_file(const char *opt, const char *filename) audio_sample_rate = 0; audio_channels= 0; audio_sample_fmt = AV_SAMPLE_FMT_NONE; -av_freep(ts_scale); -nb_ts_scale = 0; +av_dict_free(ts_scale); for (i = 0; i orig_nb_streams; i++) av_dict_free(opts[i]); @@ -4046,7 +4043,7 @@ static const OptionDef options[] = { { fs, HAS_ARG | OPT_INT64, {(void*)limit_filesize}, set the limit file size in bytes, limit_size }, // { ss, HAS_ARG, {(void*)opt_start_time}, set the start time offset, time_off }, { itsoffset, HAS_ARG, {(void*)opt_input_ts_offset}, set the input ts offset, time_off }, -{ itsscale, HAS_ARG, {(void*)opt_input_ts_scale}, set the input ts scale, stream:scale }, +{ itsscale, HAS_ARG, {(void*)opt_input_ts_scale}, set the input ts scale, scale }, { metadata, HAS_ARG, {(void*)opt_metadata}, add metadata, string=string }, { dframes, OPT_INT | HAS_ARG, {(void*)max_frames[AVMEDIA_TYPE_DATA]}, set the number of data frames to record, number }, { benchmark, OPT_BOOL | OPT_EXPERT, {(void*)do_benchmark}, -- 1.7.5.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 01/11] avconv: factor out adding input streams.
--- avconv.c | 137 + 1 files changed, 74 insertions(+), 63 deletions(-) diff --git a/avconv.c b/avconv.c index 66772aa..7c72db2 100644 --- a/avconv.c +++ b/avconv.c @@ -2846,11 +2846,83 @@ static AVCodec *choose_codec(AVFormatContext *s, AVStream *st, enum AVMediaType return NULL; } +/** + * Add all the streams from the given input file to the global + * list of input streams. + */ +static void add_input_streams(AVFormatContext *ic) +{ +int i, rfps, rfps_base; + +for (i = 0; i ic-nb_streams; i++) { +AVStream *st = ic-streams[i]; +AVCodecContext *dec = st-codec; +InputStream *ist; + +dec-thread_count = thread_count; + +input_streams = grow_array(input_streams, sizeof(*input_streams), nb_input_streams, nb_input_streams + 1); +ist = input_streams[nb_input_streams - 1]; +ist-st = st; +ist-file_index = nb_input_files; +ist-discard = 1; +ist-opts = filter_codec_opts(codec_opts, ist-st-codec-codec_id, ic, st); + +if (i nb_ts_scale) +ist-ts_scale = ts_scale[i]; + +ist-dec = choose_codec(ic, st, dec-codec_type, codec_names); + +switch (dec-codec_type) { +case AVMEDIA_TYPE_AUDIO: +if(audio_disable) +st-discard= AVDISCARD_ALL; +break; +case AVMEDIA_TYPE_VIDEO: +rfps = ic-streams[i]-r_frame_rate.num; +rfps_base = ic-streams[i]-r_frame_rate.den; +if (dec-lowres) { +dec-flags |= CODEC_FLAG_EMU_EDGE; +dec-height = dec-lowres; +dec-width = dec-lowres; +} +if(me_threshold) +dec-debug |= FF_DEBUG_MV; + +if (dec-time_base.den != rfps*dec-ticks_per_frame || dec-time_base.num != rfps_base) { + +if (verbose = 0) +fprintf(stderr,\nSeems stream %d codec frame rate differs from container frame rate: %2.2f (%d/%d) - %2.2f (%d/%d)\n, +i, (float)dec-time_base.den / dec-time_base.num, dec-time_base.den, dec-time_base.num, + +(float)rfps / rfps_base, rfps, rfps_base); +} + +if(video_disable) +st-discard= AVDISCARD_ALL; +else if(video_discard) +st-discard= video_discard; +break; +case AVMEDIA_TYPE_DATA: +break; +case AVMEDIA_TYPE_SUBTITLE: +if(subtitle_disable) +st-discard = AVDISCARD_ALL; +break; +case AVMEDIA_TYPE_ATTACHMENT: +case AVMEDIA_TYPE_UNKNOWN: +break; +default: +abort(); +} +} +} + static int opt_input_file(const char *opt, const char *filename) { AVFormatContext *ic; AVInputFormat *file_iformat = NULL; -int err, i, ret, rfps, rfps_base; +int err, i, ret; int64_t timestamp; uint8_t buf[128]; AVDictionary **opts; @@ -2963,68 +3035,7 @@ static int opt_input_file(const char *opt, const char *filename) } /* update the current parameters so that they match the one of the input stream */ -for(i=0;iic-nb_streams;i++) { -AVStream *st = ic-streams[i]; -AVCodecContext *dec = st-codec; -InputStream *ist; - -dec-thread_count = thread_count; - -input_streams = grow_array(input_streams, sizeof(*input_streams), nb_input_streams, nb_input_streams + 1); -ist = input_streams[nb_input_streams - 1]; -ist-st = st; -ist-file_index = nb_input_files; -ist-discard = 1; -ist-opts = filter_codec_opts(codec_opts, ist-st-codec-codec_id, ic, st); - -if (i nb_ts_scale) -ist-ts_scale = ts_scale[i]; - -ist-dec = choose_codec(ic, st, dec-codec_type, codec_names); - -switch (dec-codec_type) { -case AVMEDIA_TYPE_AUDIO: -if(audio_disable) -st-discard= AVDISCARD_ALL; -break; -case AVMEDIA_TYPE_VIDEO: -rfps = ic-streams[i]-r_frame_rate.num; -rfps_base = ic-streams[i]-r_frame_rate.den; -if (dec-lowres) { -dec-flags |= CODEC_FLAG_EMU_EDGE; -dec-height = dec-lowres; -dec-width = dec-lowres; -} -if(me_threshold) -dec-debug |= FF_DEBUG_MV; - -if (dec-time_base.den != rfps*dec-ticks_per_frame || dec-time_base.num != rfps_base) { - -if (verbose = 0) -fprintf(stderr,\nSeems stream %d codec frame rate differs from container frame rate: %2.2f (%d/%d) - %2.2f (%d/%d)\n, -i, (float)dec-time_base.den / dec-time_base.num, dec-time_base.den, dec-time_base.num, - -(float)rfps / rfps_base, rfps, rfps_base); -} - -
[libav-devel] [PATCH 03/11] avconv: add a wrapper for output AVFormatContexts
It will be made useful in the following commits. --- avconv.c | 62 -- 1 files changed, 40 insertions(+), 22 deletions(-) diff --git a/avconv.c b/avconv.c index 84fbbaa..ebf48c5 100644 --- a/avconv.c +++ b/avconv.c @@ -102,9 +102,7 @@ static const OptionDef options[]; static const char *last_asked_format = NULL; static AVDictionary *ts_scale; -static AVFormatContext *output_files[MAX_FILES]; static AVDictionary *output_opts[MAX_FILES]; -static int nb_output_files = 0; static StreamMap *stream_maps = NULL; static int nb_stream_maps; @@ -310,11 +308,18 @@ typedef struct InputFile { int64_t ts_offset; } InputFile; +typedef struct OutputFile { +AVFormatContext *ctx; +} OutputFile; + static InputStream *input_streams = NULL; static int nb_input_streams = 0; static InputFile *input_files = NULL; static int nb_input_files = 0; +static OutputFile *output_files = NULL; +static intnb_output_files = 0; + #if CONFIG_AVFILTER static int configure_video_filters(InputStream *ist, OutputStream *ost) @@ -437,7 +442,7 @@ static int exit_program(int ret) /* close files */ for(i=0;inb_output_files;i++) { -AVFormatContext *s = output_files[i]; +AVFormatContext *s = output_files[i].ctx; if (!(s-oformat-flags AVFMT_NOFILE) s-pb) avio_close(s-pb); avformat_free_context(s); @@ -462,6 +467,7 @@ static int exit_program(int ret) av_freep(input_streams); av_freep(input_files); +av_freep(output_files); uninit_opts(); av_free(audio_buf); @@ -1256,7 +1262,7 @@ static void do_video_stats(AVFormatContext *os, OutputStream *ost, } } -static void print_report(AVFormatContext **output_files, +static void print_report(OutputFile *output_files, OutputStream **ost_table, int nb_ostreams, int is_last_report) { @@ -1284,7 +1290,7 @@ static void print_report(AVFormatContext **output_files, } -oc = output_files[0]; +oc = output_files[0].ctx; total_size = avio_size(oc-pb); if(total_size0) // FIXME improve avio_size() so it works with non seekable output too @@ -1593,7 +1599,7 @@ static int output_packet(InputStream *ist, int ist_index, if (ost-picref) ist-pts = av_rescale_q(ost-picref-pts, ist_pts_tb, AV_TIME_BASE_Q); #endif -os = output_files[ost-file_index]; +os = output_files[ost-file_index].ctx; /* set the input output pts pairs */ //ost-sync_ipts = (double)(ist-pts + input_files[ist-file_index].ts_offset - start_time)/ AV_TIME_BASE; @@ -1707,7 +1713,7 @@ static int output_packet(InputStream *ist, int ist_index, ost = ost_table[i]; if (ost-source_index == ist_index) { AVCodecContext *enc= ost-st-codec; -os = output_files[ost-file_index]; +os = output_files[ost-file_index].ctx; if(ost-st-codec-codec_type == AVMEDIA_TYPE_AUDIO enc-frame_size =1) continue; @@ -1788,19 +1794,27 @@ static int output_packet(InputStream *ist, int ist_index, return 0; } -static void print_sdp(AVFormatContext **avc, int n) +static void print_sdp(OutputFile *output_files, int n) { char sdp[2048]; +int i; +AVFormatContext **avc = av_malloc(sizeof(*avc)*n); + +if (!avc) +exit_program(1); +for (i = 0; i n; i++) +avc[i] = output_files[i].ctx; av_sdp_create(avc, n, sdp, sizeof(sdp)); printf(SDP:\n%s\n, sdp); fflush(stdout); +av_freep(avc); } /* * The following code is the main loop of the file converter */ -static int transcode(AVFormatContext **output_files, +static int transcode(OutputFile *output_files, int nb_output_files, InputFile *input_files, int nb_input_files) @@ -1822,9 +1836,9 @@ static int transcode(AVFormatContext **output_files, /* output stream init */ nb_ostreams = 0; for(i=0;inb_output_files;i++) { -os = output_files[i]; +os = output_files[i].ctx; if (!os-nb_streams !(os-oformat-flags AVFMT_NOSTREAMS)) { -av_dump_format(output_files[i], i, output_files[i]-filename, 1); +av_dump_format(os, i, os-filename, 1); fprintf(stderr, Output file #%d does not contain any stream\n, i); ret = AVERROR(EINVAL); goto fail; @@ -1837,7 +1851,7 @@ static int transcode(AVFormatContext **output_files, goto fail; n = 0; for(k=0;knb_output_files;k++) { -os = output_files[k]; +os = output_files[k].ctx; for (i = 0; i os-nb_streams; i++, n++) ost_table[n] = output_streams_for_file[k][i]; } @@ -1845,7 +1859,7 @@ static int
[libav-devel] [PATCH 06/11] avconv: get rid of the arbitrary MAX_FILES limit.
--- avconv.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/avconv.c b/avconv.c index af55d2f..a9b192a 100644 --- a/avconv.c +++ b/avconv.c @@ -97,8 +97,6 @@ typedef struct MetadataMap { static const OptionDef options[]; -#define MAX_FILES 100 - static const char *last_asked_format = NULL; static AVDictionary *ts_scale; @@ -1825,9 +1823,12 @@ static int transcode(OutputFile *output_files, InputStream *ist; char error[1024]; int want_sdp = 1; -uint8_t no_packet[MAX_FILES]={0}; +uint8_t *no_packet; int no_packet_count=0; +if (!(no_packet = av_mallocz(nb_input_files))) +exit_program(1); + if (rate_emu) for (i = 0; i nb_input_streams; i++) input_streams[i].start = av_gettime(); @@ -2251,7 +2252,7 @@ static int transcode(OutputFile *output_files, if (file_index 0) { if(no_packet_count){ no_packet_count=0; -memset(no_packet, 0, sizeof(no_packet)); +memset(no_packet, 0, nb_input_files); usleep(1); continue; } @@ -2279,7 +2280,7 @@ static int transcode(OutputFile *output_files, } no_packet_count=0; -memset(no_packet, 0, sizeof(no_packet)); +memset(no_packet, 0, nb_input_files); if (do_pkt_dump) { av_pkt_dump_log2(NULL, AV_LOG_DEBUG, pkt, do_hex_dump, @@ -2392,6 +2393,7 @@ static int transcode(OutputFile *output_files, fail: av_freep(bit_buffer); +av_freep(no_packet); if (output_streams) { for (i = 0; i nb_output_streams; i++) { @@ -3548,8 +3550,6 @@ static void opt_output_file(const char *filename) av_dict_free(metadata); -if (nb_output_files == MAX_FILES) -exit_program(1);/* a temporary hack until all the other MAX_FILES-sized arrays are removed */ output_files = grow_array(output_files, sizeof(*output_files), nb_output_files, nb_output_files + 1); output_files[nb_output_files - 1].ctx = oc; output_files[nb_output_files - 1].ost_index = nb_output_streams - oc-nb_streams; -- 1.7.5.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 05/11] avconv: get rid of the output_streams_for_file vs. ost_table schizophrenia
Instead store output streams in the same way as input streams. --- avconv.c | 97 - 1 files changed, 38 insertions(+), 59 deletions(-) diff --git a/avconv.c b/avconv.c index eaa79a0..af55d2f 100644 --- a/avconv.c +++ b/avconv.c @@ -276,9 +276,6 @@ typedef struct OutputStream { AVDictionary *opts; } OutputStream; -static OutputStream **output_streams_for_file[MAX_FILES] = { NULL }; -static int nb_output_streams_for_file[MAX_FILES] = { 0 }; - typedef struct InputStream { int file_index; AVStream *st; @@ -309,6 +306,7 @@ typedef struct InputFile { typedef struct OutputFile { AVFormatContext *ctx; AVDictionary *opts; +int ost_index; /* index of the first stream in output_streams */ } OutputFile; static InputStream *input_streams = NULL; @@ -316,6 +314,8 @@ static int nb_input_streams = 0; static InputFile *input_files = NULL; static int nb_input_files = 0; +static OutputStream *output_streams = NULL; +static intnb_output_streams = 0; static OutputFile *output_files = NULL; static intnb_output_files = 0; @@ -445,7 +445,6 @@ static int exit_program(int ret) if (!(s-oformat-flags AVFMT_NOFILE) s-pb) avio_close(s-pb); avformat_free_context(s); -av_free(output_streams_for_file[i]); av_dict_free(output_files[i].opts); } for(i=0;inb_input_files;i++) { @@ -466,6 +465,7 @@ static int exit_program(int ret) av_freep(input_streams); av_freep(input_files); +av_freep(output_streams); av_freep(output_files); uninit_opts(); @@ -1262,7 +1262,7 @@ static void do_video_stats(AVFormatContext *os, OutputStream *ost, } static void print_report(OutputFile *output_files, - OutputStream **ost_table, int nb_ostreams, + OutputStream *ost_table, int nb_ostreams, int is_last_report) { char buf[1024]; @@ -1300,7 +1300,7 @@ static void print_report(OutputFile *output_files, vid = 0; for(i=0;inb_ostreams;i++) { float q = -1; -ost = ost_table[i]; +ost = ost_table[i]; enc = ost-st-codec; if (!ost-st-stream_copy enc-coded_frame) q = enc-coded_frame-quality/(float)FF_QP2LAMBDA; @@ -1393,7 +1393,7 @@ static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_ /* pkt = NULL means EOF (needed to flush decoder buffers) */ static int output_packet(InputStream *ist, int ist_index, - OutputStream **ost_table, int nb_ostreams, + OutputStream *ost_table, int nb_ostreams, const AVPacket *pkt) { AVFormatContext *os; @@ -1543,7 +1543,7 @@ static int output_packet(InputStream *ist, int ist_index, #if CONFIG_AVFILTER if (ist-st-codec-codec_type == AVMEDIA_TYPE_VIDEO) { for (i = 0; i nb_ostreams; i++) { -ost = ost_table[i]; +ost = ost_table[i]; if (ost-input_video_filter ost-source_index == ist_index) { AVRational sar; if (ist-st-sample_aspect_ratio.num) @@ -1586,7 +1586,7 @@ static int output_packet(InputStream *ist, int ist_index, for(i=0;inb_ostreams;i++) { int frame_size; -ost = ost_table[i]; +ost = ost_table[i]; if (ost-source_index == ist_index) { #if CONFIG_AVFILTER frame_available = ist-st-codec-codec_type != AVMEDIA_TYPE_VIDEO || @@ -1709,7 +1709,7 @@ static int output_packet(InputStream *ist, int ist_index, /* EOF handling */ for(i=0;inb_ostreams;i++) { -ost = ost_table[i]; +ost = ost_table[i]; if (ost-source_index == ist_index) { AVCodecContext *enc= ost-st-codec; os = output_files[ost-file_index].ctx; @@ -1818,10 +1818,10 @@ static int transcode(OutputFile *output_files, InputFile *input_files, int nb_input_files) { -int ret = 0, i, j, k, n, nb_ostreams = 0; +int ret = 0, i, j; AVFormatContext *is, *os; AVCodecContext *codec, *icodec; -OutputStream *ost, **ost_table = NULL; +OutputStream *ost; InputStream *ist; char error[1024]; int want_sdp = 1; @@ -1833,7 +1833,6 @@ static int transcode(OutputFile *output_files, input_streams[i].start = av_gettime(); /* output stream init */ -nb_ostreams = 0; for(i=0;inb_output_files;i++) { os = output_files[i].ctx; if (!os-nb_streams !(os-oformat-flags AVFMT_NOSTREAMS)) { @@ -1842,22 +1841,11 @@ static int transcode(OutputFile *output_files, ret = AVERROR(EINVAL); goto fail; } -nb_ostreams += os-nb_streams; -} - -ost_table =
[libav-devel] [PATCH 09/11] avconv: rescue poor abused recording_time global.
Keep a per-OutputFile instance of it, thus making -t work with multiple output files. --- avconv.c | 22 ++-- tests/ref/fate/feeble-dxa |1 - tests/ref/fate/lmlm4-demux | 332 tests/ref/fate/real-rv40 |3 + 4 files changed, 16 insertions(+), 342 deletions(-) diff --git a/avconv.c b/avconv.c index 8b92158..4979815 100644 --- a/avconv.c +++ b/avconv.c @@ -272,6 +272,7 @@ typedef struct OutputStream { int sws_flags; AVDictionary *opts; + int is_past_recording_time; } OutputStream; typedef struct InputStream { @@ -289,7 +290,6 @@ typedef struct InputStream { double ts_scale; int is_start;/* is 1 at the start and after a discontinuity */ int showed_multi_packet_warning; -int is_past_recording_time; AVDictionary *opts; } InputStream; @@ -305,6 +305,7 @@ typedef struct OutputFile { AVFormatContext *ctx; AVDictionary *opts; int ost_index; /* index of the first stream in output_streams */ +int64_t recording_time; /* desired length of the resulting file in microseconds */ } OutputFile; static InputStream *input_streams = NULL; @@ -1563,12 +1564,20 @@ static int output_packet(InputStream *ist, int ist_index, encode packets and output them */ if (start_time == 0 || ist-pts = start_time) for(i=0;inb_ostreams;i++) { +OutputFile *of = output_files[ost_table[i].file_index]; int frame_size; ost = ost_table[i]; if (ost-source_index != ist_index) continue; +if (of-recording_time != INT64_MAX +av_compare_ts(ist-pts, AV_TIME_BASE_Q, of-recording_time + start_time, + (AVRational){1, 100}) = 0) { +ost-is_past_recording_time = 1; +continue; +} + #if CONFIG_AVFILTER if (ist-st-codec-codec_type == AVMEDIA_TYPE_VIDEO ost-input_video_filter) { @@ -2220,7 +2229,7 @@ static int transcode(OutputFile *output_files, ost = output_streams[i]; os = output_files[ost-file_index].ctx; ist = input_streams[ost-source_index]; -if(ist-is_past_recording_time || no_packet[ist-file_index]) +if(ost-is_past_recording_time || no_packet[ist-file_index]) continue; opts = ost-st-pts.val * av_q2d(ost-st-time_base); ipts = (double)ist-pts; @@ -2314,13 +2323,6 @@ static int transcode(OutputFile *output_files, } } -/* finish if recording time exhausted */ -if (recording_time != INT64_MAX -av_compare_ts(pkt.pts, ist-st-time_base, recording_time + start_time, (AVRational){1, 100}) = 0) { -ist-is_past_recording_time = 1; -goto discard_packet; -} - //fprintf(stderr,read #%d.%d size=%d\n, ist-file_index, ist-st-index, pkt.size); if (output_packet(ist, ist_index, output_streams, nb_output_streams, pkt) 0) { @@ -3544,6 +3546,7 @@ static void opt_output_file(const char *filename) output_files = grow_array(output_files, sizeof(*output_files), nb_output_files, nb_output_files + 1); output_files[nb_output_files - 1].ctx = oc; output_files[nb_output_files - 1].ost_index = nb_output_streams - oc-nb_streams; +output_files[nb_output_files - 1].recording_time = recording_time; av_dict_copy(output_files[nb_output_files - 1].opts, format_opts, 0); /* check filename in case of an image number is expected */ @@ -3669,6 +3672,7 @@ static void opt_output_file(const char *filename) audio_channels= 0; audio_sample_fmt = AV_SAMPLE_FMT_NONE; chapters_input_file = INT_MAX; +recording_time = INT64_MAX; av_freep(meta_data_maps); nb_meta_data_maps = 0; diff --git a/tests/ref/fate/feeble-dxa b/tests/ref/fate/feeble-dxa index 9013f99..caea4c2 100644 --- a/tests/ref/fate/feeble-dxa +++ b/tests/ref/fate/feeble-dxa @@ -62,4 +62,3 @@ 0, 171000, 921600, 0x5639e670 1, 171429, 1000, 0xa491f3ef 1, 175510, 1000, 0x2c036e18 -1, 179592, 1000, 0x52d65e2a diff --git a/tests/ref/fate/lmlm4-demux b/tests/ref/fate/lmlm4-demux index f322300..f321423 100644 --- a/tests/ref/fate/lmlm4-demux +++ b/tests/ref/fate/lmlm4-demux @@ -213,335 +213,3 @@ 1, 265680, 768, 0xfd6c7597 0, 267267, 1327, 0x7d15307c 1, 267840, 768, 0x8d766d40 -0, 270270, 1225, 0x1b5d0f5f -0, 273273, 1173, 0x840efed5 -0, 276276, 1215, 0xa8e0035e -0, 279279, 1295, 0x142918ca -0, 282282, 1144, 0xf50cef50 -0, 285285, 1527, 0x7d13bd9d -0, 288288, 5609, 0x1ae1921d -0, 291291, 1303, 0xabdc264f -0, 294294, 1419, 0x878169bf -0, 297297, 972, 0x00c4a257 -0, 300300, 1277, 0x87d520cf -0, 303303, 1014, 0x5946b4ee -0, 306306, 1177, 0x124e0e23 -0, 309309, 1402, 0x8e6363cc -0, 312312, 1171, 0x9bdaeda2 -0,
[libav-devel] [PATCH 11/11] avconv: reindent.
--- avconv.c | 230 +++--- 1 files changed, 115 insertions(+), 115 deletions(-) diff --git a/avconv.c b/avconv.c index 007e040..721acc2 100644 --- a/avconv.c +++ b/avconv.c @@ -1565,137 +1565,137 @@ static int output_packet(InputStream *ist, int ist_index, /* if output time reached then transcode raw format, encode packets and output them */ for (i = 0; i nb_ostreams; i++) { -OutputFile *of = output_files[ost_table[i].file_index]; -int frame_size; +OutputFile *of = output_files[ost_table[i].file_index]; +int frame_size; -ost = ost_table[i]; -if (ost-source_index != ist_index) -continue; +ost = ost_table[i]; +if (ost-source_index != ist_index) +continue; -if (of-start_time ist-pts of-start_time) -continue; +if (of-start_time ist-pts of-start_time) +continue; -if (of-recording_time != INT64_MAX -av_compare_ts(ist-pts, AV_TIME_BASE_Q, of-recording_time + of-start_time, - (AVRational){1, 100}) = 0) { -ost-is_past_recording_time = 1; -continue; -} +if (of-recording_time != INT64_MAX +av_compare_ts(ist-pts, AV_TIME_BASE_Q, of-recording_time + of-start_time, + (AVRational){1, 100}) = 0) { +ost-is_past_recording_time = 1; +continue; +} #if CONFIG_AVFILTER -if (ist-st-codec-codec_type == AVMEDIA_TYPE_VIDEO -ost-input_video_filter) { -AVRational sar; -if (ist-st-sample_aspect_ratio.num) -sar = ist-st-sample_aspect_ratio; -else -sar = ist-st-codec-sample_aspect_ratio; -av_vsrc_buffer_add_frame(ost-input_video_filter, picture, ist-pts, sar); -} -frame_available = ist-st-codec-codec_type != AVMEDIA_TYPE_VIDEO || -!ost-output_video_filter || avfilter_poll_frame(ost-output_video_filter-inputs[0]); -while (frame_available) { -AVRational ist_pts_tb; -if (ist-st-codec-codec_type == AVMEDIA_TYPE_VIDEO ost-output_video_filter) -get_filtered_video_frame(ost-output_video_filter, picture, ost-picref, ist_pts_tb); -if (ost-picref) -ist-pts = av_rescale_q(ost-picref-pts, ist_pts_tb, AV_TIME_BASE_Q); +if (ist-st-codec-codec_type == AVMEDIA_TYPE_VIDEO +ost-input_video_filter) { +AVRational sar; +if (ist-st-sample_aspect_ratio.num) +sar = ist-st-sample_aspect_ratio; +else +sar = ist-st-codec-sample_aspect_ratio; +av_vsrc_buffer_add_frame(ost-input_video_filter, picture, ist-pts, sar); +} +frame_available = ist-st-codec-codec_type != AVMEDIA_TYPE_VIDEO || +!ost-output_video_filter || avfilter_poll_frame(ost-output_video_filter-inputs[0]); +while (frame_available) { +AVRational ist_pts_tb; +if (ist-st-codec-codec_type == AVMEDIA_TYPE_VIDEO ost-output_video_filter) +get_filtered_video_frame(ost-output_video_filter, picture, ost-picref, ist_pts_tb); +if (ost-picref) +ist-pts = av_rescale_q(ost-picref-pts, ist_pts_tb, AV_TIME_BASE_Q); #endif -os = output_files[ost-file_index].ctx; +os = output_files[ost-file_index].ctx; -/* set the input output pts pairs */ -//ost-sync_ipts = (double)(ist-pts + input_files[ist-file_index].ts_offset - start_time)/ AV_TIME_BASE; +/* set the input output pts pairs */ +//ost-sync_ipts = (double)(ist-pts + input_files[ist-file_index].ts_offset - start_time)/ AV_TIME_BASE; -if (ost-encoding_needed) { -av_assert0(ist-decoding_needed); -switch(ost-st-codec-codec_type) { -case AVMEDIA_TYPE_AUDIO: -do_audio_out(os, ost, ist, decoded_data_buf, decoded_data_size); -break; -case AVMEDIA_TYPE_VIDEO: +if (ost-encoding_needed) { +av_assert0(ist-decoding_needed); +switch(ost-st-codec-codec_type) { +case AVMEDIA_TYPE_AUDIO: +do_audio_out(os, ost, ist, decoded_data_buf,
[libav-devel] [PATCH 08/11] avconv: merge two loops in output_packet().
--- avconv.c | 28 +--- 1 files changed, 9 insertions(+), 19 deletions(-) diff --git a/avconv.c b/avconv.c index 81315b6..8b92158 100644 --- a/avconv.c +++ b/avconv.c @@ -1538,25 +1538,6 @@ static int output_packet(InputStream *ist, int ist_index, avpkt.size = 0; } -#if CONFIG_AVFILTER -if (ist-st-codec-codec_type == AVMEDIA_TYPE_VIDEO) { -for (i = 0; i nb_ostreams; i++) { -ost = ost_table[i]; -if (ost-input_video_filter ost-source_index == ist_index) { -AVRational sar; -if (ist-st-sample_aspect_ratio.num) -sar = ist-st-sample_aspect_ratio; -else -sar = ist-st-codec-sample_aspect_ratio; -// add it to be filtered -av_vsrc_buffer_add_frame(ost-input_video_filter, picture, - ist-pts, - sar); -} -} -} -#endif - // preprocess audio (volume) if (ist-st-codec-codec_type == AVMEDIA_TYPE_AUDIO) { if (audio_volume != 256) { @@ -1589,6 +1570,15 @@ static int output_packet(InputStream *ist, int ist_index, continue; #if CONFIG_AVFILTER +if (ist-st-codec-codec_type == AVMEDIA_TYPE_VIDEO +ost-input_video_filter) { +AVRational sar; +if (ist-st-sample_aspect_ratio.num) +sar = ist-st-sample_aspect_ratio; +else +sar = ist-st-codec-sample_aspect_ratio; +av_vsrc_buffer_add_frame(ost-input_video_filter, picture, ist-pts, sar); +} frame_available = ist-st-codec-codec_type != AVMEDIA_TYPE_VIDEO || !ost-output_video_filter || avfilter_poll_frame(ost-output_video_filter-inputs[0]); while (frame_available) { -- 1.7.5.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] h264: fix PCM intra-coded blocks in monochrome case
From: Jeff Downs heydo...@somuchpressure.net Signed-off-by: Diego Biurrun di...@biurrun.de --- libavcodec/h264.c | 43 ++- 1 files changed, 30 insertions(+), 13 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index c2229ff..a9a6c8c 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1812,8 +1812,8 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i } if (!simple IS_INTRA_PCM(mb_type)) { +const int bit_depth = h-sps.bit_depth_luma; if (pixel_shift) { -const int bit_depth = h-sps.bit_depth_luma; int j; GetBitContext gb; init_get_bits(gb, (uint8_t*)h-mb, 384*bit_depth); @@ -1824,15 +1824,25 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i tmp_y[j] = get_bits(gb, bit_depth); } if(simple || !CONFIG_GRAY || !(s-flagsCODEC_FLAG_GRAY)){ -for (i = 0; i 8; i++) { -uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); -for (j = 0; j 8; j++) -tmp_cb[j] = get_bits(gb, bit_depth); -} -for (i = 0; i 8; i++) { -uint16_t *tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize); -for (j = 0; j 8; j++) -tmp_cr[j] = get_bits(gb, bit_depth); +if (!h-sps.chroma_format_idc) { +for (i = 0; i 8; i++) { +uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); +uint16_t *tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize); +for (j = 0; j 8; j++) { +tmp_cb[j] = tmp_cr[j] = 1 (bit_depth - 1); +} +} +} else { +for (i = 0; i 8; i++) { +uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); +for (j = 0; j 8; j++) +tmp_cb[j] = get_bits(gb, bit_depth); +} +for (i = 0; i 8; i++) { +uint16_t *tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize); +for (j = 0; j 8; j++) +tmp_cr[j] = get_bits(gb, bit_depth); +} } } } else { @@ -1840,9 +1850,16 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i memcpy(dest_y + i* linesize, h-mb + i*8, 16); } if(simple || !CONFIG_GRAY || !(s-flagsCODEC_FLAG_GRAY)){ -for (i=0; i8; i++) { -memcpy(dest_cb+ i*uvlinesize, h-mb + 128 + i*4, 8); -memcpy(dest_cr+ i*uvlinesize, h-mb + 160 + i*4, 8); +if (!h-sps.chroma_format_idc) { +for (i = 0; i 8; i++) { +memset(dest_cb + i*uvlinesize, 1 (bit_depth - 1), 8); +memset(dest_cr + i*uvlinesize, 1 (bit_depth - 1), 8); +} +} else { +for (i = 0; i 8; i++) { +memcpy(dest_cb + i*uvlinesize, h-mb + 128 + i*4, 8); +memcpy(dest_cr + i*uvlinesize, h-mb + 160 + i*4, 8); +} } } } -- 1.7.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 01/11] avconv: factor out adding input streams.
On Wed, Aug 17, 2011 at 05:04:42PM +0200, Anton Khirnov wrote: --- avconv.c | 137 + 1 files changed, 74 insertions(+), 63 deletions(-) lgtm ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 02/11] avconv: make itsscale syntax consistent with other options.
On Wed, Aug 17, 2011 at 05:04:43PM +0200, Anton Khirnov wrote: Move the stream specifier to the option name. --- avconv.c | 37 + 1 files changed, 17 insertions(+), 20 deletions(-) looks OK ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 04/11] avconv: merge output_opts into output_files.
On Wed, Aug 17, 2011 at 05:04:45PM +0200, Anton Khirnov wrote: --- avconv.c | 11 +-- 1 files changed, 5 insertions(+), 6 deletions(-) You'd better merge it with previous patch, I have a mild allergy on word wrapper (and patches doing nothing useful). And uniting two related things in one structure has some sense indeed. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] PATCH: LATM muxer
On Tue, Aug 16, 2011 at 04:05:02PM -0700, Kieran Kunhya wrote: Includes the patch this time... From 308c2d9efc1af199c1512d49274ed301f1c6bc5a Mon Sep 17 00:00:00 2001 From: Kieran Kunhya kie...@kunhya.com Date: Tue, 16 Aug 2011 23:58:51 +0100 Subject: [PATCH] Add LATM muxing support. --- libavformat/Makefile |1 + libavformat/allformats.c |1 + libavformat/latmenc.c| 175 ++ libavformat/version.h|2 +- 4 files changed, 178 insertions(+), 1 deletions(-) create mode 100644 libavformat/latmenc.c Docs update is missing. --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #define LIBAVFORMAT_VERSION_MAJOR 53 -#define LIBAVFORMAT_VERSION_MINOR 4 +#define LIBAVFORMAT_VERSION_MINOR 5 #define LIBAVFORMAT_VERSION_MICRO 0 Bump this again, I pushed the XMV demuxer in the meantime. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 05/11] avconv: get rid of the output_streams_for_file vs. ost_table schizophrenia
On Wed, Aug 17, 2011 at 05:04:46PM +0200, Anton Khirnov wrote: Instead store output streams in the same way as input streams. --- avconv.c | 97 - 1 files changed, 38 insertions(+), 59 deletions(-) looks reasonable ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 07/11] avconv: fix broken indentation.
On Wed, Aug 17, 2011 at 05:04:48PM +0200, Anton Khirnov wrote: --- avconv.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/avconv.c b/avconv.c index a9b192a..81315b6 100644 --- a/avconv.c +++ b/avconv.c @@ -1585,7 +1585,9 @@ static int output_packet(InputStream *ist, int ist_index, int frame_size; ost = ost_table[i]; -if (ost-source_index == ist_index) { +if (ost-source_index != ist_index) +continue; + #if CONFIG_AVFILTER frame_available = ist-st-codec-codec_type != AVMEDIA_TYPE_VIDEO || !ost-output_video_filter || avfilter_poll_frame(ost-output_video_filter-inputs[0]); @@ -1692,7 +1694,6 @@ static int output_packet(InputStream *ist, int ist_index, avfilter_unref_buffer(ost-picref); } #endif -} } av_free(buffer_to_free); -- OK ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 09/11] avconv: rescue poor abused recording_time global.
On Wed, Aug 17, 2011 at 05:04:50PM +0200, Anton Khirnov wrote: Keep a per-OutputFile instance of it, thus making -t work with multiple output files. --- avconv.c | 22 ++-- tests/ref/fate/feeble-dxa |1 - tests/ref/fate/lmlm4-demux | 332 tests/ref/fate/real-rv40 |3 + 4 files changed, 16 insertions(+), 342 deletions(-) looks OK (especially if you have found out and can explain the reason why those fate test changed). ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 07/11] avconv: fix broken indentation.
On Wed, Aug 17, 2011 at 05:04:48PM +0200, Anton Khirnov wrote: --- avconv.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) OK Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 10/11] avconv: rescue poor abused start_time global.
On Wed, Aug 17, 2011 at 05:04:51PM +0200, Anton Khirnov wrote: Keep a per-OutputFile instance of it, thus making -ss work with multiple output files. --- avconv.c | 16 +++- 1 files changed, 11 insertions(+), 5 deletions(-) Isn't it supposed to seek in input at the given position instead? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 04/11] avconv: merge output_opts into output_files.
On Wed, 17 Aug 2011 17:58:04 +0200, Kostya kostya.shish...@gmail.com wrote: On Wed, Aug 17, 2011 at 05:04:45PM +0200, Anton Khirnov wrote: --- avconv.c | 11 +-- 1 files changed, 5 insertions(+), 6 deletions(-) You'd better merge it with previous patch, I have a mild allergy on word wrapper (and patches doing nothing useful). And uniting two related things in one structure has some sense indeed. The idea was that smaller patches are generally easier to review. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 11/11] avconv: reindent.
On Wed, Aug 17, 2011 at 05:04:52PM +0200, Anton Khirnov wrote: --- avconv.c | 230 +++--- 1 files changed, 115 insertions(+), 115 deletions(-) [default OK for cosmetics] ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 08/11] avconv: merge two loops in output_packet().
On Wed, Aug 17, 2011 at 05:04:49PM +0200, Anton Khirnov wrote: --- avconv.c | 28 +--- 1 files changed, 9 insertions(+), 19 deletions(-) looks OK ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 11/11] avconv: reindent.
On Wed, Aug 17, 2011 at 05:04:52PM +0200, Anton Khirnov wrote: --- avconv.c | 230 +++--- 1 files changed, 115 insertions(+), 115 deletions(-) OK Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] h264: fix PCM intra-coded blocks in monochrome case
From: Jeff Downs heydo...@somuchpressure.net Signed-off-by: Diego Biurrun di...@biurrun.de --- libavcodec/h264.c | 34 -- 1 files changed, 24 insertions(+), 10 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index c2229ff..ef1aa3b 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1824,15 +1824,22 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i tmp_y[j] = get_bits(gb, bit_depth); } if(simple || !CONFIG_GRAY || !(s-flagsCODEC_FLAG_GRAY)){ +uint16_t *tmp_cb, *tmp_cr; for (i = 0; i 8; i++) { -uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); -for (j = 0; j 8; j++) -tmp_cb[j] = get_bits(gb, bit_depth); +tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); +tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize); } -for (i = 0; i 8; i++) { -uint16_t *tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize); -for (j = 0; j 8; j++) -tmp_cr[j] = get_bits(gb, bit_depth); +if (!h-sps.chroma_format_idc) { +for (i = 0; i 8; i++) +for (j = 0; j 8; j++) +tmp_cb[j] = tmp_cr[j] = 1 (bit_depth - 1); +} else { +for (i = 0; i 8; i++) +for (j = 0; j 8; j++) +tmp_cb[j] = get_bits(gb, bit_depth); +for (i = 0; i 8; i++) +for (j = 0; j 8; j++) +tmp_cr[j] = get_bits(gb, bit_depth); } } } else { @@ -1840,9 +1847,16 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i memcpy(dest_y + i* linesize, h-mb + i*8, 16); } if(simple || !CONFIG_GRAY || !(s-flagsCODEC_FLAG_GRAY)){ -for (i=0; i8; i++) { -memcpy(dest_cb+ i*uvlinesize, h-mb + 128 + i*4, 8); -memcpy(dest_cr+ i*uvlinesize, h-mb + 160 + i*4, 8); +if (!h-sps.chroma_format_idc) { +for (i = 0; i 8; i++) { +memset(dest_cb + i*uvlinesize, 128, 8); +memset(dest_cr + i*uvlinesize, 128, 8); +} +} else { +for (i = 0; i 8; i++) { +memcpy(dest_cb + i*uvlinesize, h-mb + 128 + i*4, 8); +memcpy(dest_cr + i*uvlinesize, h-mb + 160 + i*4, 8); +} } } } -- 1.7.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] h264: fix PCM intra-coded blocks in monochrome case
On Wed, Aug 17, 2011 at 05:52:53PM +0200, Diego Biurrun wrote: From: Jeff Downs heydo...@somuchpressure.net Discard this one, mistakenly sent without local changes. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Tell RV10/20 decoder to use edge emulation.
Hi, On Wed, Aug 17, 2011 at 1:36 AM, Kostya Shishkov kostya.shish...@gmail.com wrote: This removes out-of-edge motion compensation artifacts (easily spotted green blocks in avplay, gray blocks in transcoding), for example here: http://samples.libav.org/samples/real/tv_watching_t1.rm --- libavcodec/rv10.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 3939984..d789eff 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -431,6 +431,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) s-avctx= avctx; s-out_format = FMT_H263; s-codec_id= avctx-codec_id; + avctx-flags |= CODEC_FLAG_EMU_EDGE; Why not just ignore CODEC_FLAG_EMU_EDGE presence during MC? I don't like us overwriting user settings in AVCodecContext randomly. Some apps may not expect that. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 10/11] avconv: rescue poor abused start_time global.
On Wed, 17 Aug 2011 18:03:00 +0200, Kostya kostya.shish...@gmail.com wrote: On Wed, Aug 17, 2011 at 05:04:51PM +0200, Anton Khirnov wrote: Keep a per-OutputFile instance of it, thus making -ss work with multiple output files. --- avconv.c | 16 +++- 1 files changed, 11 insertions(+), 5 deletions(-) Isn't it supposed to seek in input at the given position instead? When given as an input file option (before -i), yes, it seeks in input. When given before an output file, it for timestamps to reach this value before it starts writing packets. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 09/11] avconv: rescue poor abused recording_time global.
On Wed, 17 Aug 2011 18:01:58 +0200, Kostya kostya.shish...@gmail.com wrote: On Wed, Aug 17, 2011 at 05:04:50PM +0200, Anton Khirnov wrote: Keep a per-OutputFile instance of it, thus making -t work with multiple output files. --- avconv.c | 22 ++-- tests/ref/fate/feeble-dxa |1 - tests/ref/fate/lmlm4-demux | 332 tests/ref/fate/real-rv40 |3 + 4 files changed, 16 insertions(+), 342 deletions(-) looks OK (especially if you have found out and can explain the reason why those fate test changed). The big change in lmlm4 is a bug in current behavior -- it produces a 15s long video stream (and correct 3s long audio) even though -t 3 is specified. After my patch the video is correctly 3 seconds long. The other twono idea. Some magic inside output_packet() most probably. I can try to investigate further if you feel it's important. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] Use parsers for RealVideo 3/4 to determine correct PTS
Ronald S. Bultje wrote: Hi, On Tue, Aug 16, 2011 at 11:06 PM, Kostyakostya.shish...@gmail.com wrote: On Tue, Aug 16, 2011 at 04:13:35PM -0700, Ronald S. Bultje wrote: On Mon, Aug 15, 2011 at 11:43 PM, Kostyakostya.shish...@gmail.com wrote: On Mon, Aug 15, 2011 at 09:42:50PM +0100, Måns Rullgård wrote: Kostyakostya.shish...@gmail.com writes: +} else { +if (type != 3) /* I/P frames have a pts that is after the previous I or P frame, so the difference is positive module 13bit */ +s-pts = pc-key_dts + ((pts - pc-key_pts) 0x1FFF); +else /* B frames have a pts that is before the previous I or P frame, so the difference is negative module 13bit */ +s-pts = pc-key_dts - ((pc-key_pts - pts) 0x1FFF); +} I suppose this could use some doxy. What happens if we have a matroska file with RV40 video? Does it need the PTS correction? Is the parser invoked? It's not invoked unless demuxer says so by setting stream-need_parsing. Some comments would still be nice so I understand the above code without crackpot smoking. see above ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] h264: fix PCM intra-coded blocks in monochrome case
Hi, On Wed, Aug 17, 2011 at 9:17 AM, Diego Biurrun di...@biurrun.de wrote: if(simple || !CONFIG_GRAY || !(s-flagsCODEC_FLAG_GRAY)){ + uint16_t *tmp_cb, *tmp_cr; for (i = 0; i 8; i++) { - uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); - for (j = 0; j 8; j++) - tmp_cb[j] = get_bits(gb, bit_depth); + tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); + tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize); } You understand that whatever happens below this is out of context and thus this code cannot possibly work, right? Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/4] h264: 4:2:2 intra decoding support
On Tue, Aug 16, 2011 at 05:40:56PM -0700, Ronald S. Bultje wrote: On Tue, Aug 16, 2011 at 8:05 AM, Diego Biurrun di...@biurrun.de wrote: - h-pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ - h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ - h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ - h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ - h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ - h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ - h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ + if (chroma_format_idc == 1) {\ + h-pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ + h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ + h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ + h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ + h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ + h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ + h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ + } else {\ + h-pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\ + h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\ + h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\ + h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ + h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ + h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ + h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ + }\ Typo? The last 4 should be 8x16, not 8x8. There is no such function. I believe the neon code misses the if (chroma == 1) additions to the 8x8 prediction init code. They should be added, else fate will fail on arm devices. You missed the if() being added in libavcodec/arm/h264dsp_init_arm.c :) Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] h264: fix PCM intra-coded blocks in monochrome case
On Wed, Aug 17, 2011 at 09:44:39AM -0700, Ronald S. Bultje wrote: On Wed, Aug 17, 2011 at 9:17 AM, Diego Biurrun di...@biurrun.de wrote: if(simple || !CONFIG_GRAY || !(s-flagsCODEC_FLAG_GRAY)){ + uint16_t *tmp_cb, *tmp_cr; for (i = 0; i 8; i++) { - uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); - for (j = 0; j 8; j++) - tmp_cb[j] = get_bits(gb, bit_depth); + tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); + tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize); } You understand that whatever happens below this is out of context and thus this code cannot possibly work, right? I'm not sure I'm following you, the scope of the variables is increased here, so I'm missing the issue you are hinting at. IIUC what you mean by out of context, i.e. out of scope, then the code would not even compile, which it does... Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] Use parsers for RealVideo 3/4 to determine correct PTS
On Wed, Aug 17, 2011 at 09:20:33AM -0700, Ronald S. Bultje wrote: Hi, On Tue, Aug 16, 2011 at 11:06 PM, Kostya kostya.shish...@gmail.com wrote: On Tue, Aug 16, 2011 at 04:13:35PM -0700, Ronald S. Bultje wrote: On Mon, Aug 15, 2011 at 11:43 PM, Kostya kostya.shish...@gmail.com wrote: On Mon, Aug 15, 2011 at 09:42:50PM +0100, Måns Rullgård wrote: Kostya kostya.shish...@gmail.com writes: + } else { + if (type != 3) + s-pts = pc-key_dts + ((pts - pc-key_pts) 0x1FFF); + else + s-pts = pc-key_dts - ((pc-key_pts - pts) 0x1FFF); + } I suppose this could use some doxy. What happens if we have a matroska file with RV40 video? Does it need the PTS correction? Is the parser invoked? It's not invoked unless demuxer says so by setting stream-need_parsing. Some comments would still be nice so I understand the above code without crackpot smoking. It's obvious for everybody in RealVideo trade and what was your nationality again? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Tell RV10/20 decoder to use edge emulation.
On Wed, Aug 17, 2011 at 09:22:00AM -0700, Ronald S. Bultje wrote: Hi, On Wed, Aug 17, 2011 at 1:36 AM, Kostya Shishkov kostya.shish...@gmail.com wrote: This removes out-of-edge motion compensation artifacts (easily spotted green blocks in avplay, gray blocks in transcoding), for example here: http://samples.libav.org/samples/real/tv_watching_t1.rm --- libavcodec/rv10.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 3939984..d789eff 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -431,6 +431,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) s-avctx= avctx; s-out_format = FMT_H263; s-codec_id= avctx-codec_id; + avctx-flags |= CODEC_FLAG_EMU_EDGE; Why not just ignore CODEC_FLAG_EMU_EDGE presence during MC? I don't like us overwriting user settings in AVCodecContext randomly. Some apps may not expect that. If you want to delve into mpegvideo gut and fix it it would extremely good. Other decoders (including e.g. VC-1 and 4XM) use the same trick too. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/4] h264: 4:2:2 intra decoding support
On Wed, Aug 17, 2011 at 09:54:52AM -0700, Ronald S. Bultje wrote: On Wed, Aug 17, 2011 at 9:51 AM, Diego Biurrun di...@biurrun.de wrote: On Tue, Aug 16, 2011 at 05:40:56PM -0700, Ronald S. Bultje wrote: On Tue, Aug 16, 2011 at 8:05 AM, Diego Biurrun di...@biurrun.de wrote: - h-pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ - h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ - h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ - h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ - h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ - h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ - h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ + if (chroma_format_idc == 1) {\ + h-pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ + h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ + h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ + h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ + h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ + h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ + h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ + } else {\ + h-pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\ + h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\ + h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\ + h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ + h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ + h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ + h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ + }\ Typo? The last 4 should be 8x16, not 8x8. There is no such function. That's because there isn't a single 8x16 function right now. They have to be written, e.g. this patch writes the one referenced above. But this patch does not add any pred8x16_mad_cow functions. I'm not following you. I believe the neon code misses the if (chroma == 1) additions to the 8x8 prediction init code. They should be added, else fate will fail on arm devices. You missed the if() being added in libavcodec/arm/h264dsp_init_arm.c :) I expect them also in ff_h264_pred_init_neon(), similar to the ones in the C init code. ff_h264_idct_add8_neon is only referenced in one place, where it is put under if(). Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 09/11] avconv: rescue poor abused recording_time global.
On Wed, Aug 17, 2011 at 06:25:19PM +0200, Anton Khirnov wrote: On Wed, 17 Aug 2011 18:01:58 +0200, Kostya kostya.shish...@gmail.com wrote: On Wed, Aug 17, 2011 at 05:04:50PM +0200, Anton Khirnov wrote: Keep a per-OutputFile instance of it, thus making -t work with multiple output files. --- avconv.c | 22 ++-- tests/ref/fate/feeble-dxa |1 - tests/ref/fate/lmlm4-demux | 332 tests/ref/fate/real-rv40 |3 + 4 files changed, 16 insertions(+), 342 deletions(-) looks OK (especially if you have found out and can explain the reason why those fate test changed). The big change in lmlm4 is a bug in current behavior -- it produces a 15s long video stream (and correct 3s long audio) even though -t 3 is specified. After my patch the video is correctly 3 seconds long. The other twono idea. Some magic inside output_packet() most probably. I can try to investigate further if you feel it's important. No, that's enough for me. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 10/11] avconv: rescue poor abused start_time global.
On Wed, Aug 17, 2011 at 06:22:31PM +0200, Anton Khirnov wrote: On Wed, 17 Aug 2011 18:03:00 +0200, Kostya kostya.shish...@gmail.com wrote: On Wed, Aug 17, 2011 at 05:04:51PM +0200, Anton Khirnov wrote: Keep a per-OutputFile instance of it, thus making -ss work with multiple output files. --- avconv.c | 16 +++- 1 files changed, 11 insertions(+), 5 deletions(-) Isn't it supposed to seek in input at the given position instead? When given as an input file option (before -i), yes, it seeks in input. When given before an output file, it for timestamps to reach this value before it starts writing packets. OK then ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/4] h264: 4:2:2 intra decoding support
Hi, On Wed, Aug 17, 2011 at 10:04 AM, Diego Biurrun di...@biurrun.de wrote: On Wed, Aug 17, 2011 at 09:54:52AM -0700, Ronald S. Bultje wrote: On Wed, Aug 17, 2011 at 9:51 AM, Diego Biurrun di...@biurrun.de wrote: On Tue, Aug 16, 2011 at 05:40:56PM -0700, Ronald S. Bultje wrote: On Tue, Aug 16, 2011 at 8:05 AM, Diego Biurrun di...@biurrun.de wrote: - h-pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ - h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ - h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ - h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ - h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ - h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ - h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ + if (chroma_format_idc == 1) {\ + h-pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ + h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ + h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ + h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ + h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ + h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ + h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ + } else {\ + h-pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\ + h-pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\ + h-pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\ + h-pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ + h-pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ + h-pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ + h-pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ + }\ Typo? The last 4 should be 8x16, not 8x8. There is no such function. That's because there isn't a single 8x16 function right now. They have to be written, e.g. this patch writes the one referenced above. But this patch does not add any pred8x16_mad_cow functions. I'm not following you. Thus, the patch is wrong, right? This is what patch review does. It finds mistakes in patches, which are then subsequently fixed. I think you should write the pred8x16_madcow functions. I believe the neon code misses the if (chroma == 1) additions to the 8x8 prediction init code. They should be added, else fate will fail on arm devices. You missed the if() being added in libavcodec/arm/h264dsp_init_arm.c :) I expect them also in ff_h264_pred_init_neon(), similar to the ones in the C init code. ff_h264_idct_add8_neon is only referenced in one place, where it is put under if(). I expect all chroma 8x8 arm predict functions to be under a similar if(). Is that more clear? Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] h264: fix PCM intra-coded blocks in monochrome case
Hi, On Wed, Aug 17, 2011 at 9:57 AM, Diego Biurrun di...@biurrun.de wrote: On Wed, Aug 17, 2011 at 09:44:39AM -0700, Ronald S. Bultje wrote: On Wed, Aug 17, 2011 at 9:17 AM, Diego Biurrun di...@biurrun.de wrote: if(simple || !CONFIG_GRAY || !(s-flagsCODEC_FLAG_GRAY)){ + uint16_t *tmp_cb, *tmp_cr; for (i = 0; i 8; i++) { - uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); - for (j = 0; j 8; j++) - tmp_cb[j] = get_bits(gb, bit_depth); + tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); + tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize); } You understand that whatever happens below this is out of context and thus this code cannot possibly work, right? I'm not sure I'm following you, the scope of the variables is increased here, so I'm missing the issue you are hinting at. IIUC what you mean by out of context, i.e. out of scope, then the code would not even compile, which it does... variable x, y; for (i = 0; i 8; i++) { x = i; y = i; } for (i = 0; i 8; i++) { for (j = 0; j 8; j++) { // do something with x; } } for (i = 0; i 8; i++) { for (j = 0; j 8; j++) { // do something with y; } } do you understand why this doesn't do what the below code does? for (i = 0; i 8; i++) { x = i; for (j = 0; j 8; j++) { // do something with x; } } // and then same for y here Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] avconv: Factorize video resampling.
--- avconv.c | 118 + 1 files changed, 64 insertions(+), 54 deletions(-) diff --git a/avconv.c b/avconv.c index 50fa1a7..6fa3e94 100644 --- a/avconv.c +++ b/avconv.c @@ -1030,58 +1030,14 @@ static void do_subtitle_out(AVFormatContext *s, static int bit_buffer_size= 1024*256; static uint8_t *bit_buffer= NULL; -static void do_video_out(AVFormatContext *s, - OutputStream *ost, - InputStream *ist, - AVFrame *in_picture, - int *frame_size, float quality) +static void do_video_resample(OutputStream *ost, + InputStream *ist, + AVFrame *in_picture, + AVFrame **out_picture) { -int nb_frames, i, ret, resample_changed; -AVFrame *final_picture, *formatted_picture; -AVCodecContext *enc, *dec; -double sync_ipts; - -enc = ost-st-codec; -dec = ist-st-codec; - -sync_ipts = get_sync_ipts(ost) / av_q2d(enc-time_base); - -/* by default, we output a single frame */ -nb_frames = 1; - -*frame_size = 0; - -if(video_sync_method){ -double vdelta = sync_ipts - ost-sync_opts; -//FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c -if (vdelta -1.1) -nb_frames = 0; -else if (video_sync_method == 2 || (video_sync_method0 (s-oformat-flags AVFMT_VARIABLE_FPS))){ -if(vdelta=-0.6){ -nb_frames=0; -}else if(vdelta0.6) -ost-sync_opts= lrintf(sync_ipts); -}else if (vdelta 1.1) -nb_frames = lrintf(vdelta); -//fprintf(stderr, vdelta:%f, ost-sync_opts:%PRId64, ost-sync_ipts:%f nb_frames:%d\n, vdelta, ost-sync_opts, get_sync_ipts(ost), nb_frames); -if (nb_frames == 0){ -++nb_frames_drop; -if (verbose2) -fprintf(stderr, *** drop!\n); -}else if (nb_frames 1) { -nb_frames_dup += nb_frames - 1; -if (verbose2) -fprintf(stderr, *** %d dup!\n, nb_frames-1); -} -}else -ost-sync_opts= lrintf(sync_ipts); - -nb_frames= FFMIN(nb_frames, max_frames[AVMEDIA_TYPE_VIDEO] - ost-frame_number); -if (nb_frames = 0) -return; - -formatted_picture = in_picture; -final_picture = formatted_picture; +int resample_changed = 0; +AVCodecContext *dec = ist-st-codec; +*out_picture = in_picture; resample_changed = ost-resample_width != dec-width || ost-resample_height != dec-height || @@ -1099,7 +1055,7 @@ static void do_video_out(AVFormatContext *s, #if !CONFIG_AVFILTER if (ost-video_resample) { -final_picture = ost-pict_tmp; +*out_picture = ost-pict_tmp; if (resample_changed) { /* initialize a new scaler context */ sws_freeContext(ost-img_resample_ctx); @@ -1116,8 +1072,8 @@ static void do_video_out(AVFormatContext *s, exit_program(1); } } -sws_scale(ost-img_resample_ctx, formatted_picture-data, formatted_picture-linesize, - 0, ost-resample_height, final_picture-data, final_picture-linesize); +sws_scale(ost-img_resample_ctx, in_picture-data, in_picture-linesize, + 0, ost-resample_height, (*out_picture)-data, (*out_picture)-linesize); } #else if (resample_changed) { @@ -1133,6 +1089,60 @@ static void do_video_out(AVFormatContext *s, ost-resample_height = dec-height; ost-resample_pix_fmt = dec-pix_fmt; } +} + + +static void do_video_out(AVFormatContext *s, + OutputStream *ost, + InputStream *ist, + AVFrame *in_picture, + int *frame_size, float quality) +{ +int nb_frames, i, ret; +AVFrame *final_picture; +AVCodecContext *enc, *dec; +double sync_ipts; + +enc = ost-st-codec; +dec = ist-st-codec; + +sync_ipts = get_sync_ipts(ost) / av_q2d(enc-time_base); + +/* by default, we output a single frame */ +nb_frames = 1; + +*frame_size = 0; + +if(video_sync_method){ +double vdelta = sync_ipts - ost-sync_opts; +//FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c +if (vdelta -1.1) +nb_frames = 0; +else if (video_sync_method == 2 || (video_sync_method0 (s-oformat-flags AVFMT_VARIABLE_FPS))){ +if(vdelta=-0.6){ +nb_frames=0; +}else if(vdelta0.6) +ost-sync_opts= lrintf(sync_ipts); +}else if (vdelta 1.1) +nb_frames = lrintf(vdelta); +//fprintf(stderr, vdelta:%f, ost-sync_opts:%PRId64, ost-sync_ipts:%f nb_frames:%d\n, vdelta, ost-sync_opts, get_sync_ipts(ost), nb_frames); +if (nb_frames == 0){ +++nb_frames_drop; +
[libav-devel] [PATCH] avconv: Factorize combining auto vsync with format.
--- avconv.c | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/avconv.c b/avconv.c index 6fa3e94..9017d48 100644 --- a/avconv.c +++ b/avconv.c @@ -1098,7 +1098,7 @@ static void do_video_out(AVFormatContext *s, AVFrame *in_picture, int *frame_size, float quality) { -int nb_frames, i, ret; +int nb_frames, i, ret, format_video_sync; AVFrame *final_picture; AVCodecContext *enc, *dec; double sync_ipts; @@ -1113,12 +1113,16 @@ static void do_video_out(AVFormatContext *s, *frame_size = 0; -if(video_sync_method){ +format_video_sync = video_sync_method; +if (format_video_sync 0) +format_video_sync = (s-oformat-flags AVFMT_VARIABLE_FPS) ? 2 : 1; + +if (format_video_sync) { double vdelta = sync_ipts - ost-sync_opts; //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c if (vdelta -1.1) nb_frames = 0; -else if (video_sync_method == 2 || (video_sync_method0 (s-oformat-flags AVFMT_VARIABLE_FPS))){ +else if (format_video_sync == 2) { if(vdelta=-0.6){ nb_frames=0; }else if(vdelta0.6) -- 1.7.3.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avconv: Factorize combining auto vsync with format.
On Wed, 17 Aug 2011 10:24:37 -0700, Alex Converse alex.conve...@gmail.com wrote: --- avconv.c | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/avconv.c b/avconv.c index 6fa3e94..9017d48 100644 --- a/avconv.c +++ b/avconv.c @@ -1098,7 +1098,7 @@ static void do_video_out(AVFormatContext *s, AVFrame *in_picture, int *frame_size, float quality) { -int nb_frames, i, ret; +int nb_frames, i, ret, format_video_sync; AVFrame *final_picture; AVCodecContext *enc, *dec; double sync_ipts; @@ -1113,12 +1113,16 @@ static void do_video_out(AVFormatContext *s, *frame_size = 0; -if(video_sync_method){ +format_video_sync = video_sync_method; +if (format_video_sync 0) +format_video_sync = (s-oformat-flags AVFMT_VARIABLE_FPS) ? 2 : 1; + +if (format_video_sync) { double vdelta = sync_ipts - ost-sync_opts; //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c if (vdelta -1.1) nb_frames = 0; -else if (video_sync_method == 2 || (video_sync_method0 (s-oformat-flags AVFMT_VARIABLE_FPS))){ +else if (format_video_sync == 2) { if(vdelta=-0.6){ nb_frames=0; }else if(vdelta0.6) -- 1.7.3.1 Ok. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avconv: Factorize video resampling.
On Wed, 17 Aug 2011 10:21:51 -0700, Alex Converse alex.conve...@gmail.com wrote: --- avconv.c | 118 + 1 files changed, 64 insertions(+), 54 deletions(-) Ok. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] Minimum Quality Standards For (Marginal) Encoders
Mike Melanson skrev 2011-07-23 00:50: 2) There's a usable Cinepak encoder patch out there. It's chatty but it does the job. I don't know about the overall quality but given the vintage of the codec, the encoder is probably doing a good job. Should we push it in? I just figured out that the author of this patch is on the list. Tomas H.: Can you comment about whether you think your Cinepak is suitable for inclusion? Well, it produces valid output and seems to live up to what Cinepak was designed for - decent video at 320x200 and 15 fps in under 1x CD rate (1200 kbps). It also supports grayscale via PIX_FMT_GRAY8. 320x200 nets around 12 fps encoding speed on my laptop in VirtualBox. Poking a little at it, it seems MAX_STRIPS 1 is broken (probably never bothered testing it). The output size can be controlled via -qscale, just like some of the other obscure encoders. Rebased patch attached. (just got back from vacation, hence the late reply) /Tomas From 98324fbde7d7ce15c7d74ebf5cce6488b5ce283b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= tomas.har...@codemill.se Date: Wed, 17 Aug 2011 14:42:56 +0200 Subject: [PATCH] Cinepak encoder --- libavcodec/Makefile |1 + libavcodec/allcodecs.c |2 +- libavcodec/cinepakenc.c | 799 +++ 3 files changed, 801 insertions(+), 1 deletions(-) create mode 100644 libavcodec/cinepakenc.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 36e07a9..ee7f931 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -99,6 +99,7 @@ OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \ mpeg12data.o mpegvideo.o OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o +OBJS-$(CONFIG_CINEPAK_ENCODER) += cinepakenc.o OBJS-$(CONFIG_CLJR_DECODER)+= cljr.o OBJS-$(CONFIG_CLJR_ENCODER)+= cljr.o OBJS-$(CONFIG_COOK_DECODER)+= cook.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index dcef0d6..d11936c 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -84,7 +84,7 @@ void avcodec_register_all(void) REGISTER_DECODER (C93, c93); REGISTER_DECODER (CAVS, cavs); REGISTER_DECODER (CDGRAPHICS, cdgraphics); -REGISTER_DECODER (CINEPAK, cinepak); +REGISTER_ENCDEC (CINEPAK, cinepak); REGISTER_DECODER (CLJR, cljr); REGISTER_DECODER (CSCD, cscd); REGISTER_DECODER (CYUV, cyuv); diff --git a/libavcodec/cinepakenc.c b/libavcodec/cinepakenc.c new file mode 100644 index 000..e1658a7 --- /dev/null +++ b/libavcodec/cinepakenc.c @@ -0,0 +1,799 @@ +#include libavutil/intreadwrite.h +#include avcodec.h +#include libavutil/lfg.h +#include elbg.h + +#define CVID_HEADER_SIZE 10 +#define STRIP_HEADER_SIZE 12 +#define CHUNK_HEADER_SIZE 4 + +#define MB_SIZE 4 //4x4 MBs +#define MB_AREA (MB_SIZE*MB_SIZE) + +#define VECTOR_MAX 6//six or four entries per vector depending on format +#define CODEBOOK_MAX 256 +#define CODEBOOK_NUM 5 //five potential codebooks (1, 4, 16, 64, 256) for V1 and V4 + +#define MAX_STRIPS 1 //Note: having fewer choices regarding the number of strip speeds up encoding (obviously) +#define MIN_STRIPS 1 //Note: having more strips speeds up encoding the frame (this is less obvious) + +typedef enum { +MODE_V1_ONLY = 0, +MODE_V1_V4, +MODE_MC, + +MODE_COUNT, +} CinepakMode; + +typedef enum { +ENC_V1, +ENC_V4, +ENC_SKIP +} mb_encoding; + +typedef struct { +int v1_vector; //index into v1 codebook +int v1_error; //error when using V1 encoding +int v4_vector[CODEBOOK_NUM][4]; //indices into v4 codebooks +int v4_error[CODEBOOK_NUM]; //error when using V4 encodings +int skip_error; //error when block is skipped (aka copied from last frame) +mb_encoding best_encoding; //last result from calculate_mode_score() +} mb_info; + +typedef struct { +int v1_codebook[CODEBOOK_MAX*VECTOR_MAX]; +int *v4_codebook; +} strip_info; + +typedef struct { +AVCodecContext *avctx; +unsigned char *pict_bufs[3], *strip_buf, *frame_buf; +AVFrame last_frame; +AVFrame best_frame; +AVFrame scratch_frame; +enum PixelFormat pix_fmt; +int w, h; +int curframe, keyint; +AVLFG randctx; +uint64_t lambda; +int *codebook_input; +int *codebook_closest; +mb_info *mb;//MB RD state +#ifdef CINEPAKENC_DEBUG +mb_info *best_mb; //TODO: remove. only used for printing stats +#endif +int num_v1_mode, num_v4_mode, num_mc_mode; +int num_v1_encs, num_v4_encs, num_skips; +} CinepakEncContext; + +static av_cold int cinepak_encode_init(AVCodecContext *avctx) +{ +CinepakEncContext *s = avctx-priv_data; +int x, mb_count, strip_buf_size, frame_buf_size; +
Re: [libav-devel] [PATCH 1/3] aac: Only output configure if audio was found.
On Tue, Aug 16, 2011 at 11:03 AM, Alex Converse alex.conve...@gmail.com wrote: Audio found is not triggered on a CCE because a CCE alone has no output. --- libavcodec/aacdec.c | 7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) Ping ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/2] aac: Set SBR and PS to unsignalled during headerless and ADTS initialization.
On Tue, Aug 16, 2011 at 2:50 PM, Alex Converse alex.conve...@gmail.com wrote: On Wed, Aug 10, 2011 at 4:37 PM, Alex Converse alex.conve...@gmail.com wrote: --- libavcodec/aacdec.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) Ping ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] aac: Only set sample rate and object type from ADTS if output hasn't been configured.
On Tue, Aug 16, 2011 at 11:04 AM, Alex Converse alex.conve...@gmail.com wrote: Long term it would be nice to support error resilient reconfiguration but right now setting this every frame does more harm than help. --- libavcodec/aacdec.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Ping. (for those confused by 3/3, this follows my other recent aac output configuration patches). ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] Use parsers for RealVideo 3/4 to determine correct PTS
Am 17.08.2011 18:34 schrieb Vladimir Pantelic vlado...@gmail.com: /* I/P frames have a pts that is after the previous I or P frame, so the difference is positive module 13bit */ Modulo of course +s-pts = pc-key_dts + ((pts - pc-key_pts) 0x1FFF); +else /* B frames have a pts that is before the previous I or P frame, so the difference is negative module 13bit */ +s-pts = pc-key_dts - ((pc-key_pts - pts) 0x1FFF); +} I suppose this could use some doxy. What happens if we have a matroska file with RV40 video? Does it need the PTS correction? Is the parser invoked? It's not invoked unless demuxer says so by setting stream-need_parsing. Some comments would still be nice so I understand the above code without crackpot smoking. see above ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [libav-commits] h264: propagate error return values for AV_LOG_ERROR-triggering events
On Tue, 2011-08-09 at 21:29 +0200, Dustin Brody wrote: Module: libav Branch: master Commit: 12fe75942316dd13dec42502145fd3292882f510 Author:Dustin Brody li...@parsoma.net Committer: Ronald S. Bultje rsbul...@gmail.com Date: Thu Aug 4 17:47:16 2011 -0400 h264: propagate error return values for AV_LOG_ERROR-triggering events This broke threaded playback of some h264 files. See http://devel.mplayer2.org/ticket/86 http://devel.mplayer2.org/ticket/89 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [libav-commits] h264: propagate error return values for AV_LOG_ERROR-triggering events
Hi, On Wed, Aug 17, 2011 at 2:26 PM, Uoti Urpala uoti.urp...@pp1.inet.fi wrote: On Tue, 2011-08-09 at 21:29 +0200, Dustin Brody wrote: Module: libav Branch: master Commit: 12fe75942316dd13dec42502145fd3292882f510 Author: Dustin Brody li...@parsoma.net Committer: Ronald S. Bultje rsbul...@gmail.com Date: Thu Aug 4 17:47:16 2011 -0400 h264: propagate error return values for AV_LOG_ERROR-triggering events This broke threaded playback of some h264 files. See http://devel.mplayer2.org/ticket/86 http://devel.mplayer2.org/ticket/89 http://git.libav.org/?p=libav.git;a=commit;h=28ca701e0b57dfaf03ab1835ce62faa1de8c4712 didn't fix that? Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [libav-commits] h264: propagate error return values for AV_LOG_ERROR-triggering events
On Wed, 2011-08-17 at 14:37 -0700, Ronald S. Bultje wrote: On Wed, Aug 17, 2011 at 2:26 PM, Uoti Urpala uoti.urp...@pp1.inet.fi wrote: On Tue, 2011-08-09 at 21:29 +0200, Dustin Brody wrote: Commit: 12fe75942316dd13dec42502145fd3292882f510 h264: propagate error return values for AV_LOG_ERROR-triggering events This broke threaded playback of some h264 files. See http://devel.mplayer2.org/ticket/86 http://devel.mplayer2.org/ticket/89 http://git.libav.org/?p=libav.git;a=commit;h=28ca701e0b57dfaf03ab1835ce62faa1de8c4712 didn't fix that? No. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [libav-commits] h264: propagate error return values for AV_LOG_ERROR-triggering events
Hi, On Wed, Aug 17, 2011 at 2:40 PM, Uoti Urpala uoti.urp...@pp1.inet.fi wrote: On Wed, 2011-08-17 at 14:37 -0700, Ronald S. Bultje wrote: On Wed, Aug 17, 2011 at 2:26 PM, Uoti Urpala uoti.urp...@pp1.inet.fi wrote: On Tue, 2011-08-09 at 21:29 +0200, Dustin Brody wrote: Commit: 12fe75942316dd13dec42502145fd3292882f510 h264: propagate error return values for AV_LOG_ERROR-triggering events This broke threaded playback of some h264 files. See http://devel.mplayer2.org/ticket/86 http://devel.mplayer2.org/ticket/89 http://git.libav.org/?p=libav.git;a=commit;h=28ca701e0b57dfaf03ab1835ce62faa1de8c4712 didn't fix that? No. Probably the err assignment in update_decode_tread_context(). Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Tell RV10/20 decoder to use edge emulation.
Kostya Shishkov kostya.shish...@gmail.com writes: This removes out-of-edge motion compensation artifacts (easily spotted green blocks in avplay, gray blocks in transcoding), for example here: http://samples.libav.org/samples/real/tv_watching_t1.rm --- libavcodec/rv10.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 3939984..d789eff 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -431,6 +431,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) s-avctx= avctx; s-out_format = FMT_H263; s-codec_id= avctx-codec_id; +avctx-flags |= CODEC_FLAG_EMU_EDGE; s-orig_width = s-width = avctx-coded_width; s-orig_height= s-height = avctx-coded_height; -- Why does it not work *without* EMU_EDGE? Usually it's the opposite. -- Måns Rullgård m...@mansr.com ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/2] Turn on resampling on sudden size change instead of bailing out during recode.
Kostya kostya.shish...@gmail.com writes: On Mon, Aug 15, 2011 at 09:47:54PM +0100, Måns Rullgård wrote: Kostya Shishkov kostya.shish...@gmail.com writes: --- avconv.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/avconv.c b/avconv.c index 18c5f07..74db59f 100644 --- a/avconv.c +++ b/avconv.c @@ -1186,7 +1186,7 @@ static void do_video_out(AVFormatContext *s, ost-resample_width, ost-resample_height, av_get_pix_fmt_name(ost-resample_pix_fmt), dec-width , dec-height , av_get_pix_fmt_name(dec-pix_fmt)); if(!ost-video_resample) -exit_program(1); +ost-video_resample = 1; } #if !CONFIG_AVFILTER -- Is this a good idea? It seems to me the correct thing to do would be to reconfigure the encoder if supported and only if that fails start scaling. I don't know many formats that allow that. Whatever input formats would trigger this action obviously support it. -- Måns Rullgård m...@mansr.com ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avconv: Factorize combining auto vsync with format.
Anton Khirnov an...@khirnov.net writes: On Tue, 16 Aug 2011 19:09:22 -0700, Alex Converse alex.conve...@gmail.com wrote: --- avconv.c | 14 +++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/avconv.c b/avconv.c index b3a4ab7..0751f19 100644 --- a/avconv.c +++ b/avconv.c @@ -1098,7 +1098,7 @@ static void do_video_out(AVFormatContext *s, AVFrame *in_picture, int *frame_size, float quality) { -int nb_frames, i, ret; +int nb_frames, i, ret, format_video_sync; AVFrame *final_picture; AVCodecContext *enc, *dec; double sync_ipts; @@ -1113,12 +1113,20 @@ static void do_video_out(AVFormatContext *s, *frame_size = 0; -if(video_sync_method){ +format_video_sync = video_sync_method; +if (format_video_sync 0) { +if (s-oformat-flags AVFMT_VARIABLE_FPS) +format_video_sync = 2; +else +format_video_sync = 1; format_video_sync = s-oformat-flags AVFMT_VARIABLE_FPS ? 2 : 1; ? Also note to self: video_sync_method looks like another abused global to be rescued. Why can't it just do the right thing without a magic method being specified? -- Måns Rullgård m...@mansr.com ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] h264: hide reference frame errors unless requested
--- libavcodec/h264_refs.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index b7e43e7..ce29caf 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -655,7 +655,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ print_short_term(h); print_long_term(h); -return err; +return h-s.avctx-error_recognition = FF_ER_EXPLODE ? err : 0; } int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){ -- 1.7.2.5 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] h264: hide reference frame errors unless requested
Hi, On Wed, Aug 17, 2011 at 3:08 PM, Dustin Brody li...@parsoma.net wrote: --- libavcodec/h264_refs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index b7e43e7..ce29caf 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -655,7 +655,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ print_short_term(h); print_long_term(h); - return err; + return h-s.avctx-error_recognition = FF_ER_EXPLODE ? err : 0; Thanks, LGTM. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Tell RV10/20 decoder to use edge emulation.
Hi, 2011/8/17 Måns Rullgård m...@mansr.com: Kostya Shishkov kostya.shish...@gmail.com writes: This removes out-of-edge motion compensation artifacts (easily spotted green blocks in avplay, gray blocks in transcoding), for example here: http://samples.libav.org/samples/real/tv_watching_t1.rm --- libavcodec/rv10.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 3939984..d789eff 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -431,6 +431,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) s-avctx= avctx; s-out_format = FMT_H263; s-codec_id= avctx-codec_id; + avctx-flags |= CODEC_FLAG_EMU_EDGE; s-orig_width = s-width = avctx-coded_width; s-orig_height= s-height = avctx-coded_height; -- Why does it not work *without* EMU_EDGE? Usually it's the opposite. I suppose it fails to call draw_edges()? Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] mjpeg: treat external huffman table setup failure as codec init failure if external huffman table use requested
--- libavcodec/mjpegdec.c |4 ++-- libavcodec/mxpegdec.c |4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 81effb4..9f987b7 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -101,8 +101,8 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_INFO, mjpeg: using external huffman table\n); init_get_bits(s-gb, avctx-extradata, avctx-extradata_size*8); if (ff_mjpeg_decode_dht(s)) { -av_log(avctx, AV_LOG_ERROR, mjpeg: error using external huffman table, switching back to internal\n); -build_basic_mjpeg_vlc(s); +av_log(avctx, AV_LOG_ERROR, mjpeg: error using external huffman table\n); +return -1; } } if (avctx-extradata_size 9 diff --git a/libavcodec/mxpegdec.c b/libavcodec/mxpegdec.c index 92fd244..fd3fef4 100644 --- a/libavcodec/mxpegdec.c +++ b/libavcodec/mxpegdec.c @@ -47,9 +47,7 @@ static av_cold int mxpeg_decode_init(AVCodecContext *avctx) s-picture[0].reference = s-picture[1].reference = 3; s-jpg.picture_ptr = s-picture[0]; -ff_mjpeg_decode_init(avctx); - -return 0; +return ff_mjpeg_decode_init(avctx); } static int mxpeg_decode_app(MXpegDecodeContext *s, -- 1.7.2.5 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel