Re: [libav-devel] [PATCH] lavfi: switch ff_default_get_audio_buffer() to av_frame_get_buffer()
On 05/30/2013 07:01 AM, Anton Khirnov wrote: This simplifies the code and avoids using libavcodec-specific avcodec_fill_audio_frame(). --- libavfilter/audio.c | 33 ++--- 1 file changed, 10 insertions(+), 23 deletions(-) Looks good. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH v2] proresenc: alpha coding support
On Tue, May 28, 2013 at 06:35:17PM +0200, Kostya Shishkov wrote: --- Now with documentation section. --- doc/encoders.texi |6 ++ libavcodec/proresenc.c | 241 +++- 2 files changed, 226 insertions(+), 21 deletions(-) ping? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] configure: Separate commonalities in msvc and icl flags
On Wed, 29 May 2013, Alex Smith wrote: Allows for easier handling of flags that may be specific to icl or msvc. Furthermore, simplify the handling of warnings and remarks thanks to icl's support of -Wall on Windows. --- configure | 47 --- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 48b405f..d9f15c8 100755 --- a/configure +++ b/configure @@ -2340,16 +2340,18 @@ ccc_flags(){ done } -msvc_flags(){ +msvc_common_flags(){ for flag; do case $flag in --fomit-frame-pointer) echo -Oy ;; --g) echo -Z7 ;; --Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ - -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \ - -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \ - -wd4996 -wd4273 ;; +# In addition to specifying certain flags under the compiler +# specific filters, they must be specified here as well or else the +# generic catch all at the bottom will print the original flag. +# Oy is available only on x86 compilers +-fomit-frame-pointer) enabled x86_32 echo -Oy ;; I guess the -Oy change could be done in a separate commit? Other than that, this looks quite good to me. // Martin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH v2] proresenc: alpha coding support
On Thu, 30 May 2013, Kostya Shishkov wrote: On Tue, May 28, 2013 at 06:35:17PM +0200, Kostya Shishkov wrote: --- Now with documentation section. --- doc/encoders.texi |6 ++ libavcodec/proresenc.c | 241 +++- 2 files changed, 226 insertions(+), 21 deletions(-) ping? The previous version was ok with me, and I don't see any drastic changes here, so still ok. // Martin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] configure: Separate commonalities in msvc and icl flags
On Wed, May 29, 2013 at 09:22:05PM -0400, Alex Smith wrote: --- a/configure +++ b/configure @@ -2340,16 +2340,18 @@ ccc_flags(){ -msvc_flags(){ +msvc_common_flags(){ for flag; do case $flag in --fomit-frame-pointer) echo -Oy ;; +-fomit-frame-pointer) enabled x86_32 echo -Oy ;; unrelated @@ -2590,13 +2616,13 @@ probe_cc(){ _ld_path='-libpath:' # -Qdiag-error to make icl error when presented with certain unknown arguments -_flags='-nologo -Qdiag-error:10157 -Qdiag-error:4044' +_flags='-nologo -Qdiag-error:4044,10157' unrelated Looks good otherwise. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] Go2Webinar decoder
--- Now it should be good enough (though I cannot guarantee it really has all possible checks). Go2Meeting (G2M2/G2M3) support will be added when it's ready (I'm not the guy who works on it because it needs lots of debugging on Windows, just be patient and wait). --- Changelog |1 + doc/general.texi|2 + libavcodec/Makefile |1 + libavcodec/allcodecs.c |1 + libavcodec/avcodec.h|1 + libavcodec/codec_desc.c |7 + libavcodec/g2meet.c | 827 +++ libavcodec/version.h|4 +- libavformat/riff.c |3 + 9 files changed, 845 insertions(+), 2 deletions(-) create mode 100644 libavcodec/g2meet.c diff --git a/Changelog b/Changelog index a20d62f..0bbe0a4 100644 --- a/Changelog +++ b/Changelog @@ -22,6 +22,7 @@ version 10: - Escape 130 video decoder - support for slice multithreading in libavfilter - VC-1 interlaced B-frame support +- Go2Webinar decoder version 9: diff --git a/doc/general.texi b/doc/general.texi index 59ac7ee..16fc5e1 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -507,6 +507,8 @@ following image formats are supported: @tab Sorenson H.263 used in Flash @item Forward Uncompressed @tab @tab X @item Fraps @tab @tab X +@item Go2Webinar @tab @tab X +@tab fourcc: G2M4 @item H.261 @tab X @tab X @item H.263 / H.263-1996 @tab X @tab X @item H.263+ / H.263-1998 / H.263 version 2 @tab X @tab X diff --git a/libavcodec/Makefile b/libavcodec/Makefile index acc2a93..0381b79 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -177,6 +177,7 @@ OBJS-$(CONFIG_FLIC_DECODER)+= flicvideo.o OBJS-$(CONFIG_FOURXM_DECODER) += 4xm.o OBJS-$(CONFIG_FRAPS_DECODER) += fraps.o OBJS-$(CONFIG_FRWU_DECODER)+= frwu.o +OBJS-$(CONFIG_G2M_DECODER) += g2meet.o mjpeg.o OBJS-$(CONFIG_G723_1_DECODER) += g723_1.o acelp_vectors.o \ celp_filters.o OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index ed8f099..ceadcf5 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -146,6 +146,7 @@ void avcodec_register_all(void) REGISTER_DECODER(FOURXM,fourxm); REGISTER_DECODER(FRAPS, fraps); REGISTER_DECODER(FRWU, frwu); +REGISTER_DECODER(G2M, g2m); REGISTER_ENCDEC (GIF, gif); REGISTER_ENCDEC (H261, h261); REGISTER_ENCDEC (H263, h263); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 21e0491..bb33d4a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -270,6 +270,7 @@ enum AVCodecID { AV_CODEC_ID_VP9, AV_CODEC_ID_AIC, AV_CODEC_ID_ESCAPE130, +AV_CODEC_ID_G2M, /* various PCM codecs */ AV_CODEC_ID_FIRST_AUDIO = 0x1, /// A dummy id pointing at the start of audio codecs diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index b385257..b0da005 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1221,6 +1221,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL(Escape 130), .props = AV_CODEC_PROP_LOSSY, }, +{ +.id= AV_CODEC_ID_G2M, +.type = AVMEDIA_TYPE_VIDEO, +.name = g2m, +.long_name = NULL_IF_CONFIG_SMALL(Go2Meeting), +.props = AV_CODEC_PROP_LOSSY, +}, /* various PCM codecs */ { diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c new file mode 100644 index 000..4a89c4d --- /dev/null +++ b/libavcodec/g2meet.c @@ -0,0 +1,827 @@ +/* + * Go2Webinar decoder + * Copyright (c) 2012 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 + * Go2Webinar decoder + */ + +#include zlib.h + +#include libavutil/intreadwrite.h +#include avcodec.h +#include bytestream.h +#include dsputil.h +#include get_bits.h +#include internal.h +#include mjpeg.h + +enum ChunkType { +FRAME_INFO = 0xC8, +TILE_DATA, +CURSOR_POS, +
Re: [libav-devel] [PATCH] Go2Webinar decoder
On 2013-05-30 13:14, Kostya Shishkov wrote: --- Now it should be good enough (though I cannot guarantee it really has all possible checks). Go2Meeting (G2M2/G2M3) support will be added when it's ready (I'm not the guy who works on it because it needs lots of debugging on Windows, just be patient and wait). --- Changelog |1 + doc/general.texi|2 + libavcodec/Makefile |1 + libavcodec/allcodecs.c |1 + libavcodec/avcodec.h|1 + libavcodec/codec_desc.c |7 + libavcodec/g2meet.c | 827 +++ libavcodec/version.h|4 +- libavformat/riff.c |3 + 9 files changed, 845 insertions(+), 2 deletions(-) create mode 100644 libavcodec/g2meet.c Does this compile standalone? I expect not, as it uses dsputil. --- /dev/null +++ b/libavcodec/g2meet.c @@ -0,0 +1,827 @@ + +enum Compression { +COMPR_EPIC_J_B = 2, +COMPR_KEMPF_J_B, +}; :-) +typedef struct G2MContext { +uint8_t*kempf_buf, *kempf_flags; +} G2MContext; I'm totally jealous ... +static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c) +{ + +ff_dsputil_init(c-dsp, avctx); Here, dsputil ... +static int jpg_decode_block(JPGContext *c, GetBitContext *gb, +int plane, int16_t *block) +{ +int dc, val, pos; +const int is_chroma = !!plane; +const uint8_t *qmat = is_chroma ? chroma_quant : luma_quant; + +c-dsp.clear_block(block); +dc = get_vlc2(gb, c-dc_vlc[is_chroma].table, 9, 3); +if (dc 0) { +return AVERROR_INVALIDDATA; +} pointless () +pos = 0; +while (pos 63) { +val = get_vlc2(gb, c-ac_vlc[is_chroma].table, 9, 3); +if (val 0) { +return AVERROR_INVALIDDATA; +} ditto +static void kempf_restore_buf(const uint8_t *src, int len, :-) +static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y, The jealousy is reaching unbearable levels... +uint8_t *dst = c-framebuf + tile_x * c-tile_width * 3 + + tile_y * c-tile_height * c-framebuf_stride; nit: We mostly put + at the end of the line. +if (sub_type != 2) { +memcpy(transp, src, 3); src += 3; +} pointless () +if (!c-synth_tile || !c-jpeg_tile +|| c-old_tile_w c-tile_width +|| c-old_tile_h c-tile_height) { +c-kempf_buf = av_mallocz((c-tile_width + 1) * aligned_height ++ FF_INPUT_BUFFER_PADDING_SIZE); +if (!c-synth_tile || !c-jpeg_tile +|| !c-kempf_buf || !c-kempf_flags) Same, put operators at the end of the line. +static int g2m_load_cursor(G2MContext *c, GetByteContext *gb) +{ +int i, j, k; +uint8_t *dst; +uint32_t bits; + +c-cursor_stride = c-cursor_w * 4; +c-cursor = av_realloc(c-cursor, c-cursor_stride * c-cursor_h); align +if ( c-width 16 || c-width avctx-width +|| c-height 16 || c-height avctx-height) { same +if (g2m_init_buffers(c)) { +return AVERROR(ENOMEM); +} pointless () +if (ret c-framebuf) { +av_log(avctx, AV_LOG_ERROR, Error decoding tile %d,%d\n, + c-tile_x, c-tile_y); +} ditto +if (cur_size = chunk_size +|| c-cursor_w * c-cursor_h / 4 cur_size) { || placement +AVCodec ff_g2m_decoder = { +.name = g2m, +.type = AVMEDIA_TYPE_VIDEO, +.id = AV_CODEC_ID_G2M, +.priv_data_size = sizeof(G2MContext), +.init = g2m_decode_init, +.close = g2m_decode_end, +.decode = g2m_decode_frame, +.capabilities = CODEC_CAP_DR1, +.long_name = NULL_IF_CONFIG_SMALL(Go2Meeting), +}; long_name after name? Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Go2Webinar decoder
On Thu, May 30, 2013 at 02:24:28PM +0200, Diego Biurrun wrote: On 2013-05-30 13:14, Kostya Shishkov wrote: --- Now it should be good enough (though I cannot guarantee it really has all possible checks). Go2Meeting (G2M2/G2M3) support will be added when it's ready (I'm not the guy who works on it because it needs lots of debugging on Windows, just be patient and wait). --- Changelog |1 + doc/general.texi|2 + libavcodec/Makefile |1 + libavcodec/allcodecs.c |1 + libavcodec/avcodec.h|1 + libavcodec/codec_desc.c |7 + libavcodec/g2meet.c | 827 +++ libavcodec/version.h|4 +- libavformat/riff.c |3 + 9 files changed, 845 insertions(+), 2 deletions(-) create mode 100644 libavcodec/g2meet.c Does this compile standalone? I expect not, as it uses dsputil. now it does --- /dev/null +++ b/libavcodec/g2meet.c @@ -0,0 +1,827 @@ + +enum Compression { +COMPR_EPIC_J_B = 2, +COMPR_KEMPF_J_B, +}; :-) +typedef struct G2MContext { +uint8_t*kempf_buf, *kempf_flags; +} G2MContext; I'm totally jealous ... And I'm diegoing this file... +static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c) +{ + +ff_dsputil_init(c-dsp, avctx); Here, dsputil ... +static int jpg_decode_block(JPGContext *c, GetBitContext *gb, +int plane, int16_t *block) +{ +int dc, val, pos; +const int is_chroma = !!plane; +const uint8_t *qmat = is_chroma ? chroma_quant : luma_quant; + +c-dsp.clear_block(block); +dc = get_vlc2(gb, c-dc_vlc[is_chroma].table, 9, 3); +if (dc 0) { +return AVERROR_INVALIDDATA; +} pointless () Pointles {} you mean? Dropped here and below. +pos = 0; +while (pos 63) { +val = get_vlc2(gb, c-ac_vlc[is_chroma].table, 9, 3); +if (val 0) { +return AVERROR_INVALIDDATA; +} ditto +static void kempf_restore_buf(const uint8_t *src, int len, :-) +static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y, The jealousy is reaching unbearable levels... +uint8_t *dst = c-framebuf + tile_x * c-tile_width * 3 + + tile_y * c-tile_height * c-framebuf_stride; nit: We mostly put + at the end of the line. as you like +if (sub_type != 2) { +memcpy(transp, src, 3); src += 3; +} pointless () nope, put the second statement on a new line to make it clearer +if (!c-synth_tile || !c-jpeg_tile +|| c-old_tile_w c-tile_width +|| c-old_tile_h c-tile_height) { +c-kempf_buf = av_mallocz((c-tile_width + 1) * aligned_height ++ FF_INPUT_BUFFER_PADDING_SIZE); +if (!c-synth_tile || !c-jpeg_tile +|| !c-kempf_buf || !c-kempf_flags) Same, put operators at the end of the line. done here and below +static int g2m_load_cursor(G2MContext *c, GetByteContext *gb) +{ +int i, j, k; +uint8_t *dst; +uint32_t bits; + +c-cursor_stride = c-cursor_w * 4; +c-cursor = av_realloc(c-cursor, c-cursor_stride * c-cursor_h); align aligned +if ( c-width 16 || c-width avctx-width +|| c-height 16 || c-height avctx-height) { same +if (g2m_init_buffers(c)) { +return AVERROR(ENOMEM); +} pointless () +if (ret c-framebuf) { +av_log(avctx, AV_LOG_ERROR, Error decoding tile %d,%d\n, + c-tile_x, c-tile_y); +} ditto +if (cur_size = chunk_size +|| c-cursor_w * c-cursor_h / 4 cur_size) { || placement +AVCodec ff_g2m_decoder = { +.name = g2m, +.type = AVMEDIA_TYPE_VIDEO, +.id = AV_CODEC_ID_G2M, +.priv_data_size = sizeof(G2MContext), +.init = g2m_decode_init, +.close = g2m_decode_end, +.decode = g2m_decode_frame, +.capabilities = CODEC_CAP_DR1, +.long_name = NULL_IF_CONFIG_SMALL(Go2Meeting), +}; long_name after name? as you like From 0f26b100d1a5aea15e9d1a93e40d4f22c7bc51f4 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov kostya.shish...@gmail.com Date: Mon, 25 Feb 2013 21:38:25 +0100 Subject: [PATCH] Go2Webinar decoder --- Changelog |1 + configure |1 + doc/general.texi|2 + libavcodec/Makefile |1 + libavcodec/allcodecs.c |1 + libavcodec/avcodec.h|1 + libavcodec/codec_desc.c |7 + libavcodec/g2meet.c | 825 +++ libavcodec/version.h|4 +- libavformat/riff.c |3 + 10 files changed, 844 insertions(+), 2 deletions(-) create mode 100644 libavcodec/g2meet.c diff --git a/Changelog b/Changelog index
[libav-devel] [PATCH] avformat/utils: improve get duration
improve the accuracy of getting duration from bit rate. Signed-off-by: Ping Kai pingkai...@gmail.com --- libavformat/utils.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index baa7177..3a06a85 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2775,7 +2775,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) int64_t old_offset = avio_tell(ic-pb); int orig_nb_streams = ic-nb_streams;// new streams might appear, no options for those int flush_codecs = ic-probesize 0; +int64_t *pSampleBitRateSum = (int64_t *)av_malloc(ic-nb_streams * sizeof(int64_t)); +int *pSampleCount = (int *)av_malloc(ic-nb_streams * sizeof(int)); +if (pSampleBitRateSum == NULL || pSampleCount == NULL) +return AVERROR_INVALIDDATA; if(ic-pb) av_log(ic, AV_LOG_DEBUG, File position before avformat_find_stream_info() is %PRId64\n, avio_tell(ic-pb)); @@ -2839,6 +2843,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) count = 0; read_size = 0; +memset(pSampleBitRateSum ,0 ,ic-nb_streams * sizeof(int64_t)); +memset(pSampleCount,0 ,ic-nb_streams * sizeof(int)); for(;;) { if (ff_check_interrupt(ic-interrupt_callback)){ ret= AVERROR_EXIT; @@ -2909,7 +2915,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) /* EOF or error*/ break; } - +if (pkt1.stream_index orig_nb_streams +ic-streams[pkt1.stream_index]-codec-bit_rate 0){ +pSampleBitRateSum += ic-streams[pkt1.stream_index]-codec-bit_rate; +pSampleCount ++; +} if (ic-flags AVFMT_FLAG_NOBUFFER) { pkt = pkt1; } else { @@ -3029,7 +3039,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) st-codec_info_nb_frames++; count++; } - +for(i=0;iorig_nb_streams;i++){ +if (pSampleCount 0) +ic-streams[i]-codec-bit_rate = (int)(pSampleBitRateSum[i] / pSampleCount[i]); +} if (flush_codecs) { AVPacket empty_pkt = { 0 }; int err = 0; @@ -3185,6 +3198,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) av_freep(st-info-duration_error); av_freep(ic-streams[i]-info); } +av_free(pSampleBitRateSum); +av_free(pSampleCount); if(ic-pb) av_log(ic, AV_LOG_DEBUG, File position after avformat_find_stream_info() is %PRId64\n, avio_tell(ic-pb)); return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] vaapi: return early from ff_vaapi_render_picture() without picture
Janne Grunau janne-libav@... writes: On 2013-05-27 21:50:23 +0200, Anton Khirnov wrote: On Tue, 21 May 2013 10:55:10 +0200, Janne Grunau janne-libav@... wrote: Fixes an assertion when called on uninitialized frame. Spotted after seeking in vlc. For reference: http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/164345 I'm not sure which is better. But i think both solves the issue. I had the crash with h264 on seek in ffmpeg. /Joakim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] avformat/utils: improve get duration
improve the accuracy of getting duration from bit rate. Signed-off-by: Ping Kai pingkai...@gmail.com --- libavformat/utils.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index baa7177..c4bf871 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2775,7 +2775,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) int64_t old_offset = avio_tell(ic-pb); int orig_nb_streams = ic-nb_streams;// new streams might appear, no options for those int flush_codecs = ic-probesize 0; +int64_t *sample_bit_rate_sum = av_malloc(ic-nb_streams * sizeof(int64_t)); +int *sample_count = av_malloc(ic-nb_streams * sizeof(int)); +if (sample_bit_rate_sum == NULL || sample_count == NULL) +return AVERROR_INVALIDDATA; if(ic-pb) av_log(ic, AV_LOG_DEBUG, File position before avformat_find_stream_info() is %PRId64\n, avio_tell(ic-pb)); @@ -2839,6 +2843,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) count = 0; read_size = 0; +memset(sample_bit_rate_sum ,0 ,ic-nb_streams * sizeof(int64_t)); +memset(sample_count,0 ,ic-nb_streams * sizeof(int)); for(;;) { if (ff_check_interrupt(ic-interrupt_callback)){ ret= AVERROR_EXIT; @@ -2909,7 +2915,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) /* EOF or error*/ break; } - +if (pkt1.stream_index orig_nb_streams +ic-streams[pkt1.stream_index]-codec-bit_rate 0){ +sample_bit_rate_sum += ic-streams[pkt1.stream_index]-codec-bit_rate; +sample_count ++; +} if (ic-flags AVFMT_FLAG_NOBUFFER) { pkt = pkt1; } else { @@ -3029,7 +3039,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) st-codec_info_nb_frames++; count++; } - +for(i=0;iorig_nb_streams;i++){ +if (sample_count[i] 0) +ic-streams[i]-codec-bit_rate = (int)(sample_bit_rate_sum[i] / sample_count[i]); +} if (flush_codecs) { AVPacket empty_pkt = { 0 }; int err = 0; @@ -3185,6 +3198,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) av_freep(st-info-duration_error); av_freep(ic-streams[i]-info); } +av_free(sample_bit_rate_sum); +av_free(sample_count); if(ic-pb) av_log(ic, AV_LOG_DEBUG, File position after avformat_find_stream_info() is %PRId64\n, avio_tell(ic-pb)); return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avformat/utils: improve get duration
On 2013-05-30 11:57 AM, Ping Kai wrote: improve the accuracy of getting duration from bit rate. You should explain how, and write full, grammatically correct commit messages. +int64_t *sample_bit_rate_sum = av_malloc(ic-nb_streams * sizeof(int64_t)); +int *sample_count = av_malloc(ic-nb_streams * sizeof(int)); +if (sample_bit_rate_sum == NULL || sample_count == NULL) +return AVERROR_INVALIDDATA; 1) It's possible to leak one of them here. 2) You should validate that ic-nb_streams is valid, rather than checking if the allocation failed. 3) In general, we use sizeof(*var) instead of sizeof(type), to future proof things. 4) You want AVERROR(ENOMEM). +memset(sample_bit_rate_sum ,0 ,ic-nb_streams * sizeof(int64_t)); +memset(sample_count,0 ,ic-nb_streams * sizeof(int)); Weird formatting. for(;;) { if (ff_check_interrupt(ic-interrupt_callback)){ ret= AVERROR_EXIT; @@ -2909,7 +2915,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) /* EOF or error*/ break; } - +if (pkt1.stream_index orig_nb_streams +ic-streams[pkt1.stream_index]-codec-bit_rate 0){ Missing whitespace. +sample_bit_rate_sum += ic-streams[pkt1.stream_index]-codec-bit_rate; +sample_count ++; Extra whitespace. Also, it looks as if you're allocating these as arrays, but not accessing them as such? - +for(i=0;iorig_nb_streams;i++){ Unrelated cosmetic change and missing whitespace. +if (sample_count[i] 0) +ic-streams[i]-codec-bit_rate = (int)(sample_bit_rate_sum[i] / sample_count[i]); You're using integer division here. } +av_free(sample_bit_rate_sum); +av_free(sample_count); if(ic-pb) Missing newlines. I think we are encouraged to use av_freep(). I could be mistaken. - Derek ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 3/3] msvc: Omit frame pointers only on x86_32
Oy is only supported on x86 compilers and will be ignored for x64. Also silences a warning about said unsupport when using ICL. --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 73f4cd8..d9f15c8 100755 --- a/configure +++ b/configure @@ -2346,10 +2346,11 @@ msvc_common_flags(){ # In addition to specifying certain flags under the compiler # specific filters, they must be specified here as well or else the # generic catch all at the bottom will print the original flag. +# Oy is available only on x86 compilers +-fomit-frame-pointer) enabled x86_32 echo -Oy ;; -Wall);; -std=c99) ;; # Common flags --fomit-frame-pointer) echo -Oy ;; -g) echo -Z7 ;; -fno-math-errno) ;; -fno-common) ;; -- 1.8.1.msysgit.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/3] configure: icl cosmetics
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 897e1ed..73f4cd8 100755 --- a/configure +++ b/configure @@ -2619,7 +2619,7 @@ probe_cc(){ _ld_lib='lib%.a' _ld_path='-libpath:' # -Qdiag-error to make icl error when presented with certain unknown arguments -_flags='-nologo -Qdiag-error:10157 -Qdiag-error:4044' +_flags='-nologo -Qdiag-error:4044,10157' # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with msvc which enables it by default _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS' if [ $pfx = hostcc ]; then -- 1.8.1.msysgit.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/3 v2] configure: Separate commonalities in msvc and icl flags
Allows for easier handling of flags that may be specific to icl or msvc. Furthermore, simplify the handling of warnings and remarks thanks to icl's support of -Wall on Windows. --- configure | 42 +- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 48b405f..897e1ed 100755 --- a/configure +++ b/configure @@ -2340,16 +2340,17 @@ ccc_flags(){ done } -msvc_flags(){ +msvc_common_flags(){ for flag; do case $flag in +# In addition to specifying certain flags under the compiler +# specific filters, they must be specified here as well or else the +# generic catch all at the bottom will print the original flag. +-Wall);; +-std=c99) ;; +# Common flags -fomit-frame-pointer) echo -Oy ;; -g) echo -Z7 ;; --Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ - -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \ - -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \ - -wd4996 -wd4273 ;; --std=c99) ;; -fno-math-errno) ;; -fno-common) ;; -fno-signed-zeros);; @@ -2365,6 +2366,30 @@ msvc_flags(){ done } +msvc_flags(){ +msvc_common_flags $@ +for flag; do +case $flag in +-Wall)echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ + -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \ + -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \ + -wd4996 -wd4273 ;; +esac +done +} + +icl_flags(){ +msvc_common_flags $@ +for flag; do +case $flag in +# Despite what Intel's documentation says -Wall, which is supported +# on Windows, does enable remarks so disable them here. +-Wall)echo $flag -Qdiag-disable:remark ;; +-std=c99) echo -Qstd=c99 ;; +esac +done +} + pgi_flags(){ for flag; do case $flag in @@ -2590,13 +2615,13 @@ probe_cc(){ fi _cc_o='-Fo $@' _cc_e='-P' -_flags_filter=msvc_flags +_flags_filter=icl_flags _ld_lib='lib%.a' _ld_path='-libpath:' # -Qdiag-error to make icl error when presented with certain unknown arguments _flags='-nologo -Qdiag-error:10157 -Qdiag-error:4044' # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with msvc which enables it by default -_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64 -Qstd=c99 -Qms0 -Qvec- -Qsimd- -GS' +_cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS' if [ $pfx = hostcc ]; then append _cflags -Dsnprintf=_snprintf fi @@ -3916,7 +3941,6 @@ elif enabled msvc; then enabled x86_32 disable aligned_stack elif enabled icl; then enabled x86_32 disable aligned_stack -check_cflags -W1 # Just warnings, no remark spam # basically -fstrict-aliasing for icl that doesn't work (correctly) on 13.x+ check_cpp_condition windows.h __ICL 1300 add_cflags -Qansi-alias # icl will pass the inline asm tests but inline asm is currently not supported (build will fail) -- 1.8.1.msysgit.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/3 v2] configure: Separate commonalities in msvc and icl flags
On Thu, 30 May 2013, Alex Smith wrote: Allows for easier handling of flags that may be specific to icl or msvc. Furthermore, simplify the handling of warnings and remarks thanks to icl's support of -Wall on Windows. --- configure | 42 +- 1 file changed, 33 insertions(+), 9 deletions(-) This looks good to me // Martin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/3] configure: icl cosmetics
On Thu, 30 May 2013, Alex Smith wrote: --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 897e1ed..73f4cd8 100755 --- a/configure +++ b/configure @@ -2619,7 +2619,7 @@ probe_cc(){ _ld_lib='lib%.a' _ld_path='-libpath:' # -Qdiag-error to make icl error when presented with certain unknown arguments -_flags='-nologo -Qdiag-error:10157 -Qdiag-error:4044' +_flags='-nologo -Qdiag-error:4044,10157' # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency with msvc which enables it by default _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS' if [ $pfx = hostcc ]; then -- 1.8.1.msysgit.1 Ok // Martin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] msvc: Omit frame pointers only on x86_32
On Thu, 30 May 2013, Alex Smith wrote: Oy is only supported on x86 compilers and will be ignored for x64. Also silences a warning about said unsupport when using ICL. --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 73f4cd8..d9f15c8 100755 --- a/configure +++ b/configure @@ -2346,10 +2346,11 @@ msvc_common_flags(){ # In addition to specifying certain flags under the compiler # specific filters, they must be specified here as well or else the # generic catch all at the bottom will print the original flag. +# Oy is available only on x86 compilers +-fomit-frame-pointer) enabled x86_32 echo -Oy ;; -Wall);; -std=c99) ;; # Common flags --fomit-frame-pointer) echo -Oy ;; -g) echo -Z7 ;; -fno-math-errno) ;; -fno-common) ;; -- 1.8.1.msysgit.1 Ok // Martin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] msvc: Omit frame pointers only on x86_32
On Thu, May 30, 2013 at 11:11 PM, Alex Smith alex.sm...@warpsharp.infowrote: Oy is only supported on x86 compilers and will be ignored for x64. Also silences a warning about said unsupport when using ICL. --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 73f4cd8..d9f15c8 100755 --- a/configure +++ b/configure @@ -2346,10 +2346,11 @@ msvc_common_flags(){ # In addition to specifying certain flags under the compiler # specific filters, they must be specified here as well or else the # generic catch all at the bottom will print the original flag. +# Oy is available only on x86 compilers +-fomit-frame-pointer) enabled x86_32 echo -Oy ;; -Wall);; -std=c99) ;; # Common flags --fomit-frame-pointer) echo -Oy ;; -g) echo -Z7 ;; -fno-math-errno) ;; -fno-common) ;; -- 1.8.1.msysgit.1 Since Oy is implied in O2, maybe just ignore the parameter in general? It also makes adding CFLAGS for debugging easier, ie. -Oy- to disable it on x86 only works if -Oy was not specifically set before. - Hendrik ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/3] configure: icl cosmetics
On Thu, May 30, 2013 at 05:11:21PM -0400, Alex Smith wrote: --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Somebody please queue with configure: icl: Merge -Qdiag-error parameters as log message. Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/3 v2] configure: Separate commonalities in msvc and icl flags
On Thu, May 30, 2013 at 05:11:20PM -0400, Alex Smith wrote: Allows for easier handling of flags that may be specific to icl or msvc. Furthermore, simplify the handling of warnings and remarks thanks to icl's support of -Wall on Windows. --- configure | 42 +- 1 file changed, 33 insertions(+), 9 deletions(-) LGTM Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/2] network: factor out bind-listening code
Introduce ff_listen_bind, to be shared with the other non-tcp network protocols. --- No changes, I might add a third patch to add the interrupt handler here as well. libavformat/network.c | 29 + libavformat/network.h | 3 +++ libavformat/tcp.c | 34 +++--- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/libavformat/network.c b/libavformat/network.c index f493c29..55d55af 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -187,3 +187,32 @@ int ff_is_multicast_address(struct sockaddr *addr) return 0; } + +int ff_listen_bind(int fd, const struct sockaddr *addr, + socklen_t addrlen, int timeout) +{ +int ret; +int reuse = 1; +struct pollfd lp = { fd, POLLIN, 0 }; +setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reuse, sizeof(reuse)); +ret = bind(fd, addr, addrlen); +if (ret) +return ff_neterrno(); + +ret = listen(fd, 1); +if (ret) +return ff_neterrno(); + +ret = poll(lp, 1, timeout = 0 ? timeout : -1); +if (ret = 0) +return AVERROR(ETIMEDOUT); + +ret = accept(fd, NULL, NULL); +if (ret 0) +return ff_neterrno(); + +closesocket(fd); + +ff_socket_nonblock(ret, 1); +return ret; +} diff --git a/libavformat/network.h b/libavformat/network.h index 5160767..db1b09a 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -209,4 +209,7 @@ const char *ff_gai_strerror(int ecode); int ff_is_multicast_address(struct sockaddr *addr); +int ff_listen_bind(int fd, const struct sockaddr *addr, + socklen_t addrlen, int timeout); + #endif /* AVFORMAT_NETWORK_H */ diff --git a/libavformat/tcp.c b/libavformat/tcp.c index bdaab7f..6e4de0d 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -85,39 +85,18 @@ static int tcp_open(URLContext *h, const char *uri, int flags) cur_ai = ai; restart: -ret = AVERROR(EIO); fd = socket(cur_ai-ai_family, cur_ai-ai_socktype, cur_ai-ai_protocol); -if (fd 0) +if (fd 0) { +ret = ff_neterrno(); goto fail; +} if (listen_socket) { -int fd1; -int reuse = 1; -struct pollfd lp = { fd, POLLIN, 0 }; -setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reuse, sizeof(reuse)); -ret = bind(fd, cur_ai-ai_addr, cur_ai-ai_addrlen); -if (ret) { -ret = ff_neterrno(); -goto fail1; -} -ret = listen(fd, 1); -if (ret) { -ret = ff_neterrno(); -goto fail1; -} -ret = poll(lp, 1, listen_timeout = 0 ? listen_timeout : -1); -if (ret = 0) { -ret = AVERROR(ETIMEDOUT); -goto fail1; -} -fd1 = accept(fd, NULL, NULL); -if (fd1 0) { -ret = ff_neterrno(); +if ((fd = ff_listen_bind(fd, cur_ai-ai_addr, cur_ai-ai_addrlen, + listen_timeout)) 0) { +ret = fd; goto fail1; } -closesocket(fd); -fd = fd1; -ff_socket_nonblock(fd, 1); } else { redo: ff_socket_nonblock(fd, 1); @@ -177,6 +156,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) cur_ai = cur_ai-ai_next; if (fd = 0) closesocket(fd); +ret = 0; goto restart; } fail1: -- 1.8.2.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/2] network: factor out connect-listening code
Introduce ff_listen_connect, to be shared with the other non-tcp network protocols. --- libavformat/network.c | 46 ++ libavformat/network.h | 5 - libavformat/tcp.c | 50 ++ 3 files changed, 56 insertions(+), 45 deletions(-) diff --git a/libavformat/network.c b/libavformat/network.c index 55d55af..88d61a5 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -19,6 +19,7 @@ */ #include network.h +#include url.h #include libavcodec/internal.h #include libavutil/mem.h @@ -216,3 +217,48 @@ int ff_listen_bind(int fd, const struct sockaddr *addr, ff_socket_nonblock(ret, 1); return ret; } + +int ff_listen_connect(int fd, const struct sockaddr *addr, + socklen_t addrlen, int timeout, URLContext *h) +{ +struct pollfd p = {fd, POLLOUT, 0}; +int ret; +socklen_t optlen; + +ff_socket_nonblock(fd, 1); + +while ((ret = connect(fd, addr, addrlen))) { +ret = ff_neterrno(); +switch (ret) { +case AVERROR(EINTR): +if (ff_check_interrupt(h-interrupt_callback)) +return AVERROR_EXIT; +continue; +case AVERROR(EINPROGRESS): +case AVERROR(EAGAIN): +while(timeout--) { +if (ff_check_interrupt(h-interrupt_callback)) +return AVERROR_EXIT; +ret = poll(p, 1, 100); +if (ret 0) +break; +} +if (ret = 0) +return AVERROR(ETIMEDOUT); +optlen = sizeof(ret); +if (getsockopt (fd, SOL_SOCKET, SO_ERROR, ret, optlen)) +ret = AVUNERROR(ff_neterrno()); +if (ret != 0) { +char errbuf[100]; +ret = AVERROR(ret); +av_strerror(ret, errbuf, sizeof(errbuf)); +av_log(h, AV_LOG_ERROR, + Connection to %s failed: %s\n, + h-filename, errbuf); +} +default: +return ret; +} +} +return ret; +} diff --git a/libavformat/network.h b/libavformat/network.h index db1b09a..454ea29 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -27,6 +27,7 @@ #include config.h #include libavutil/error.h #include os_support.h +#include url.h #if HAVE_UNISTD_H #include unistd.h @@ -211,5 +212,7 @@ int ff_is_multicast_address(struct sockaddr *addr); int ff_listen_bind(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout); - +int ff_listen_connect(int fd, const struct sockaddr *addr, + socklen_t addrlen, int timeout, + URLContext *h); #endif /* AVFORMAT_NETWORK_H */ diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 6e4de0d..fff9e1f 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -42,7 +42,6 @@ static int tcp_open(URLContext *h, const char *uri, int flags) const char *p; char buf[256]; int ret; -socklen_t optlen; int timeout = 100, listen_timeout = -1; char hostname[1024],proto[1024],path[1024]; char portstr[10]; @@ -98,53 +97,16 @@ static int tcp_open(URLContext *h, const char *uri, int flags) goto fail1; } } else { - redo: -ff_socket_nonblock(fd, 1); -ret = connect(fd, cur_ai-ai_addr, cur_ai-ai_addrlen); -} +if ((ret = ff_listen_connect(fd, cur_ai-ai_addr, cur_ai-ai_addrlen, + timeout, h)) 0) { -if (ret 0) { -struct pollfd p = {fd, POLLOUT, 0}; -ret = ff_neterrno(); -if (ret == AVERROR(EINTR)) { -if (ff_check_interrupt(h-interrupt_callback)) { -ret = AVERROR_EXIT; -goto fail1; -} -goto redo; -} -if (ret != AVERROR(EINPROGRESS) -ret != AVERROR(EAGAIN)) -goto fail; - -/* wait until we are connected or until abort */ -while(timeout--) { -if (ff_check_interrupt(h-interrupt_callback)) { -ret = AVERROR_EXIT; +if (ret == AVERROR_EXIT) goto fail1; -} -ret = poll(p, 1, 100); -if (ret 0) -break; -} -if (ret = 0) { -ret = AVERROR(ETIMEDOUT); -goto fail; -} -/* test error */ -optlen = sizeof(ret); -if (getsockopt (fd, SOL_SOCKET, SO_ERROR, ret, optlen)) -ret = AVUNERROR(ff_neterrno()); -if (ret != 0) { -char errbuf[100]; -ret = AVERROR(ret); -av_strerror(ret, errbuf, sizeof(errbuf)); -av_log(h, AV_LOG_ERROR, - TCP connection to %s:%d failed: %s\n, - hostname, port, errbuf); -goto fail; +else +
Re: [libav-devel] [PATCH] Go2Webinar decoder
On Thu, May 30, 2013 at 03:42:58PM -0400, Derek Buitenhuis wrote: On 2013-05-30 8:56 AM, Kostya Shishkov wrote: + * Copyright (c) 2012 Konstantin Shishkov 2013? +#include zlib.h configure should be changed so it requires zlib, no? True, amended locally. +static inline void yuv2rgb(uint8_t *out, int Y, int U, int V) +{ +out[0] = av_clip_uint8(Y + ( 91881 * V + 32768 16)); +out[1] = av_clip_uint8(Y + (-22554 * U - 46802 * V + 32768 16)); +out[2] = av_clip_uint8(Y + (116130 * U + 32768 16)); +} Doesn't the MSS2 decoder already have something like this? It has it deep in some DSP function. It's a trivial piece of code after all. +width = FFALIGN(width, 16); +mb_w = width 4; +mb_h = (height + 15) 4; Something something Diego. diegoed locally Over a cursory glance, it looks pretty good... and I even went specifically looking for gotchas. Though, mostly I can sum itup as magic things happen, without any comments. ;) Oh, it's rather obvious: Both Go2Meeting variants (compression 2 in G2M2/G2M3 and compression 3 in G2M4) divide frame into tiles and update each tile if needed. Tile can have two layers - sharp details (coded as RGB with an optional transparency) and smooth details (coded as baseline JPEG in form of sparse blocks). G2M2/G2M3 features Accusoft ePIC(-derived?) coding of RGB layer (with the augmented ELS coder and context modelling) and calculate JPEG block mask depending on transparent pixels in RGB layer. G2M4 uses quantisation, deflate and an explicitly coded JPEG block mask. Compression method names are derived from that too (original Compressor24 and SMPC were not good enough to me): JPEG blocks gave j-b in the name and for the compression scheme 3 I tried to find a word that would sound close to deflate, palette and be in harmony with JPEG-blocks. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel