Re: [libav-devel] [PATCH] Revert "VC1: merge idct8x8, coeff adjustments and put_pixels."
On Tue, May 03, 2011 at 10:40:51PM -0400, Ronald S. Bultje wrote: > This reverts commit f8bed30d8b176fa030f6737765338bb4a2bcabc9. > --- > libavcodec/ppc/vc1dsp_altivec.c | 63 +- > libavcodec/vc1.c| 28 + > libavcodec/vc1dec.c | 58 +++ > libavcodec/vc1dsp.c | 54 ++--- > libavcodec/vc1dsp.h |6 +--- > 5 files changed, 39 insertions(+), 170 deletions(-) fine with me, just don't forget to state why it's needed in commit message ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] Replace strncpy() with av_strlcpy().
On Tue, May 3, 2011 at 12:45 PM, Justin Ruggles wrote: > On 05/03/2011 03:05 PM, Aℓex Converse wrote: > >> On Tue, May 3, 2011 at 11:45 AM, Justin Ruggles >> wrote: >>> On 05/03/2011 02:21 PM, Alex Converse wrote: >>> memset(compressor_name,0,32); /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name) - strncpy(compressor_name,track->enc->codec->name,31); + av_strlcpy(compressor_name,track->enc->codec->name,32); >>> >>> >>> Can't that memset be replaced with compressor_name[0] = '\0' now that >>> the result will be null-terminated? >>> >> >> avio_w8(pb, strlen(compressor_name)); >> avio_write(pb, compressor_name, 31); >> >> avio_write() is a mem-function not a str-function so we still want it >> zerofilled to the end. Still I can't help but notice that this looks >> like a pascal string and wonder if >> >> avio_w8(pb, strlen(compressor_name)); >> avio_write(pb, compressor_name, strlen(compressor_name)); >> >> would be better. > > ah, I didn't notice that. probably is better that way from the look of > it, but I don't know what the MOV spec says. > >> On Tue, May 3, 2011 at 11:46 AM, Justin Ruggles >> wrote: >>> On 05/03/2011 02:21 PM, Alex Converse wrote: >>> @@ -1099,4 +1100,3 @@ void pp_postprocess(const uint8_t * src[3], const int srcStride[3], } } } - >>> >>> >>> stray cosmetic change >>> >> >> Fixed > > > patch ok. > Queued ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/4] get_bits: make cache unsigned to eliminate undefined signed overflow.
On Sun, May 1, 2011 at 5:48 AM, Måns Rullgård wrote: > Aℓex Converse writes: > >> From 859f6de86ee7359942a9aece8d92eea141d421d0 Mon Sep 17 00:00:00 2001 >> From: Alex Converse >> Date: Tue, 26 Apr 2011 09:09:05 -0700 >> Subject: [PATCH 4/4] get_bits: make cache unsigned to eliminate undefined >> signed overflow. >> MIME-Version: 1.0 >> Content-Type: multipart/mixed; boundary="1" >> >> This is a multi-part message in MIME format. >> --1 >> Content-Type: text/plain; charset=UTF-8; format=fixed >> Content-Transfer-Encoding: 8bit >> >> --- >> libavcodec/get_bits.h | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> --1 >> Content-Type: text/x-patch; >> name="0004-get_bits-make-cache-unsigned-to-eliminate-undefined-.patch" >> Content-Transfer-Encoding: 8bit >> Content-Disposition: attachment; >> filename="0004-get_bits-make-cache-unsigned-to-eliminate-undefined-.patch" >> >> diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h >> index 2d36b81..185ff31 100644 >> --- a/libavcodec/get_bits.h >> +++ b/libavcodec/get_bits.h >> @@ -127,7 +127,7 @@ for examples see get_bits, show_bits, skip_bits, get_vlc >> >> # define OPEN_READER(name, gb) \ >> unsigned int name##_index = (gb)->index; \ >> - int name##_cache = 0 >> + unsigned int name##_cache = 0 >> >> # define CLOSE_READER(name, gb) (gb)->index = name##_index > > Should be OK. > Queued ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/4] indeo3: Eliminate use of long.
On Tue, May 3, 2011 at 9:53 AM, Justin Ruggles wrote: > On 04/27/2011 08:10 PM, Aℓex Converse wrote: > >> --- >> libavcodec/indeo3.c | 22 +++--- >> 1 files changed, 11 insertions(+), 11 deletions(-) >> >> >> --1 >> Content-Type: text/x-patch; name="0001-indeo3-Eliminate-use-of-long.patch" >> Content-Transfer-Encoding: 8bit >> Content-Disposition: attachment; >> filename="0001-indeo3-Eliminate-use-of-long.patch" >> >> diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c >> index 29a8d4a..30b7085 100644 >> --- a/libavcodec/indeo3.c >> +++ b/libavcodec/indeo3.c >> @@ -149,13 +149,13 @@ static av_cold void iv_free_func(Indeo3DecodeContext >> *s) >> } >> >> struct ustr { >> - long xpos; >> - long ypos; >> - long width; >> - long height; >> - long split_flag; >> - long split_direction; >> - long usl7; >> + int xpos; >> + int ypos; >> + int width; >> + int height; >> + int split_flag; >> + int split_direction; >> + int usl7; >> }; >> >> >> @@ -203,12 +203,12 @@ struct ustr { >> >> static void iv_Decode_Chunk(Indeo3DecodeContext *s, >> uint8_t *cur, uint8_t *ref, int width, int height, >> - const uint8_t *buf1, long cb_offset, const uint8_t *hdr, >> + const uint8_t *buf1, int cb_offset, const uint8_t *hdr, >> const uint8_t *buf2, int min_width_160) >> { >> uint8_t bit_buf; >> - unsigned long bit_pos, lv, lv1, lv2; >> - long *width_tbl, width_tbl_arr[10]; >> + unsigned int bit_pos, lv, lv1, lv2; >> + int *width_tbl, width_tbl_arr[10]; >> const signed char *ref_vectors; >> uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2; >> uint32_t *cur_lp, *ref_lp; >> @@ -982,7 +982,7 @@ static int iv_decode_frame(AVCodecContext *avctx, >> Indeo3DecodeContext *s = avctx->priv_data; >> unsigned int image_width, image_height, >> chroma_width, chroma_height; >> - unsigned long flags, cb_offset, data_size, >> + unsigned int flags, cb_offset, data_size, >> y_offset, v_offset, u_offset, mc_vector_count; >> const uint8_t *hdr_pos, *buf_pos; > > > Ok. > Queued ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Revert "VC1: merge idct8x8, coeff adjustments and put_pixels."
Hi, On Tue, May 3, 2011 at 10:40 PM, Ronald S. Bultje wrote: > This reverts commit f8bed30d8b176fa030f6737765338bb4a2bcabc9. > --- > libavcodec/ppc/vc1dsp_altivec.c | 63 +- > libavcodec/vc1.c | 28 + > libavcodec/vc1dec.c | 58 +++ > libavcodec/vc1dsp.c | 54 ++--- > libavcodec/vc1dsp.h | 6 +--- > 5 files changed, 39 insertions(+), 170 deletions(-) Just FYI, I reverted this patch because it conflicts with bit-exactness of our VC-1 decoder. The patches that Kostya approved, and also this one, will all have a slightly negative impact on performance, at least in the short term. I intend to eventually fix that, but can't do much about it right now. We need to conform first, performance comes later. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] Revert "VC1: merge idct8x8, coeff adjustments and put_pixels."
This reverts commit f8bed30d8b176fa030f6737765338bb4a2bcabc9. --- libavcodec/ppc/vc1dsp_altivec.c | 63 +- libavcodec/vc1.c| 28 + libavcodec/vc1dec.c | 58 +++ libavcodec/vc1dsp.c | 54 ++--- libavcodec/vc1dsp.h |6 +--- 5 files changed, 39 insertions(+), 170 deletions(-) diff --git a/libavcodec/ppc/vc1dsp_altivec.c b/libavcodec/ppc/vc1dsp_altivec.c index c52b5a9..307e0e9 100644 --- a/libavcodec/ppc/vc1dsp_altivec.c +++ b/libavcodec/ppc/vc1dsp_altivec.c @@ -130,8 +130,7 @@ do { \ /** Do inverse transform on 8x8 block */ -static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], - int sign, int rangered) +static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) { vector signed short src0, src1, src2, src3, src4, src5, src6, src7; vector signed int s0, s1, s2, s3, s4, s5, s6, s7; @@ -145,9 +144,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], const vector unsigned int vec_2 = vec_splat_u32(2); const vector signed int vec_1s = vec_splat_s32(1); const vector unsigned int vec_1 = vec_splat_u32(1); -const vector unsigned short rangered_shift = vec_splat_u16(1); -const vector signed short signed_bias = vec_sl(vec_splat_s16(4), - vec_splat_u16(4)); src0 = vec_ld( 0, block); src1 = vec_ld( 16, block); @@ -217,27 +213,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], src6 = vec_pack(sE, s6); src7 = vec_pack(sF, s7); -if (rangered) { -if (!sign) { -src0 = vec_sub(src0, signed_bias); -src1 = vec_sub(src1, signed_bias); -src2 = vec_sub(src2, signed_bias); -src3 = vec_sub(src3, signed_bias); -src4 = vec_sub(src4, signed_bias); -src5 = vec_sub(src5, signed_bias); -src6 = vec_sub(src6, signed_bias); -src7 = vec_sub(src7, signed_bias); -} -src0 = vec_sl(src0, rangered_shift); -src1 = vec_sl(src1, rangered_shift); -src2 = vec_sl(src2, rangered_shift); -src3 = vec_sl(src3, rangered_shift); -src4 = vec_sl(src4, rangered_shift); -src5 = vec_sl(src5, rangered_shift); -src6 = vec_sl(src6, rangered_shift); -src7 = vec_sl(src7, rangered_shift); -} - vec_st(src0, 0, block); vec_st(src1, 16, block); vec_st(src2, 32, block); @@ -248,36 +223,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], vec_st(src7,112, block); } -static void vc1_inv_trans_8x8_add_altivec(uint8_t *dest, int stride, DCTELEM *b) -{ -vc1_inv_trans_8x8_altivec(b, 0, 0); -ff_add_pixels_clamped_c(b, dest, stride); -} - -static void vc1_inv_trans_8x8_put_signed_altivec(uint8_t *dest, int stride, DCTELEM *b) -{ -vc1_inv_trans_8x8_altivec(b, 1, 0); -ff_put_signed_pixels_clamped_c(b, dest, stride); -} - -static void vc1_inv_trans_8x8_put_signed_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b) -{ -vc1_inv_trans_8x8_altivec(b, 1, 1); -ff_put_signed_pixels_clamped_c(b, dest, stride); -} - -static void vc1_inv_trans_8x8_put_altivec(uint8_t *dest, int stride, DCTELEM *b) -{ -vc1_inv_trans_8x8_altivec(b, 0, 0); -ff_put_pixels_clamped_c(b, dest, stride); -} - -static void vc1_inv_trans_8x8_put_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b) -{ -vc1_inv_trans_8x8_altivec(b, 0, 1); -ff_put_pixels_clamped_c(b, dest, stride); -} - /** Do inverse transform on 8x4 part of block */ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block) @@ -396,11 +341,7 @@ void ff_vc1dsp_init_altivec(VC1DSPContext* dsp) if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return; -dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_altivec; -dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_altivec; -dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_altivec; -dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_altivec; -dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_altivec; +dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec; dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 536320a..7b878c1 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -280,28 +280,6 @@ static int vop_dquant_decoding(VC1Context *v) static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb); -static void simple_idct_put_rangered(uint8_t *dest, int line_size, DCTELEM *block) -{ -int i; -ff_simple_idct(block); -for (i =
Re: [libav-devel] [PATCH] asfdec: fix assert failure on invalid files
Hi, On Tue, May 3, 2011 at 10:34 PM, Luca Barbato wrote: > On 5/4/11 4:18 AM, Ronald S. Bultje wrote: >> >> From: Uoti Urpala >> >> Add an extra size validity check in asf_read_frame_header(). Without >> this asf->packet_size_left may become negative, which triggers an >> assertion failure later. >> >> Signed-off-by: Ronald S. Bultje >> --- >> libavformat/asfdec.c | 5 + >> 1 files changed, 5 insertions(+), 0 deletions(-) > > Seems fine, not sure about the new line added. Yeah I noticed after sending it, removed locally. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] asfdec: fix assert failure on invalid files
On 5/4/11 4:18 AM, Ronald S. Bultje wrote: From: Uoti Urpala Add an extra size validity check in asf_read_frame_header(). Without this asf->packet_size_left may become negative, which triggers an assertion failure later. Signed-off-by: Ronald S. Bultje --- libavformat/asfdec.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) Seems fine, not sure about the new line added. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] mpegvideo: reindent.
On 5/3/11 2:23 PM, Ronald S. Bultje wrote: --- libavcodec/mpegvideo.c | 227 +++ 1 files changed, 111 insertions(+), 116 deletions(-) I guess ok, maybe long lines could be broken as well. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avfilter: check malloc return values.
On 5/4/11 4:06 AM, Ronald S. Bultje wrote: --- libavfilter/avfilter.c | 26 +- 1 files changed, 25 insertions(+), 1 deletions(-) Looks ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] mpegvideo: reindent.
Hi, On Tue, May 3, 2011 at 8:23 AM, Ronald S. Bultje wrote: > --- > libavcodec/mpegvideo.c | 227 +++ > 1 files changed, 111 insertions(+), 116 deletions(-) Ping. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] asfdec: fix assert failure on invalid files
From: Uoti Urpala Add an extra size validity check in asf_read_frame_header(). Without this asf->packet_size_left may become negative, which triggers an assertion failure later. Signed-off-by: Ronald S. Bultje --- libavformat/asfdec.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 637ceed..76cd7a7 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -852,6 +852,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ } if (asf->packet_flags & 0x01) { DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal + if(asf->packet_frag_size > asf->packet_size_left - rsize){ if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) { av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, rsize); @@ -864,6 +865,10 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ } //printf("Fragsize %d\n", asf->packet_frag_size); } else { +if (rsize > asf->packet_size_left) { +av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); +return -1; +} asf->packet_frag_size = asf->packet_size_left - rsize; //printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize); } -- 1.7.2.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] avfilter: check malloc return values.
--- libavfilter/avfilter.c | 26 +- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c71c046..82350d1 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -583,29 +583,53 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in return AVERROR(EINVAL); ret = av_mallocz(sizeof(AVFilterContext)); +if (!ret) +return AVERROR(ENOMEM); ret->av_class = &avfilter_class; ret->filter = filter; ret->name = inst_name ? av_strdup(inst_name) : NULL; -if (filter->priv_size) +if (filter->priv_size) { ret->priv = av_mallocz(filter->priv_size); +if (!ret->priv) +goto err; +} ret->input_count = pad_count(filter->inputs); if (ret->input_count) { ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); +if (!ret->input_pads) +goto err; memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count); ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); +if (!ret->inputs) +goto err; } ret->output_count = pad_count(filter->outputs); if (ret->output_count) { ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); +if (!ret->output_pads) +goto err; memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count); ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); +if (!ret->outputs) +goto err; } *filter_ctx = ret; return 0; + +err: +av_freep(&ret->inputs); +av_freep(&ret->input_pads); +ret->input_count = 0; +av_freep(&ret->outputs); +av_freep(&ret->output_pads); +ret->output_count = 0; +av_freep(&ret->priv); +av_free(ret); +return AVERROR(ENOMEM); } void avfilter_free(AVFilterContext *filter) -- 1.7.2.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Port drawtext filter by Hemanth from the libavfilter soc repo
On 05/04/2011 02:05 AM, Stefano Sabatini wrote: > The changes look fine, but I consider the idea of picking a patch and > randomly fixing it very bad, indeed this is making very hard to spot > the differences with the original and spoiling authorship/blame > information. The signed off tag means that the first person to be contacted about a commit is the undersigned, then the author. > I suggest to apply the original patch, and apply the fixes on top of > that, this also helps the original contributor to review and > eventually port the various fixes. I'd rather not have multiple commits just because the patch imported wasn't reviewed when it hit some foreign tree... lu -- Luca Barbato Gentoo/linux http://dev.gentoo.org/~lu_zero ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Port drawtext filter by Hemanth from the libavfilter soc repo
Hi, On Tue, May 3, 2011 at 5:05 PM, Stefano Sabatini wrote: > I suggest to apply the original patch, and apply the fixes on top of > that, this also helps the original contributor to review and > eventually port the various fixes. If our goal was to make merging and upstreaming to FFmpeg easy, I would agree with you. But I don't believe that is our goal. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] ac3enc: add support for transient detection and block switching
On 05/03/2011 08:19 PM, Justin Ruggles wrote: > --- > This is an updated patch which removes some unrelated hunks and also makes it > easier to add block switching support to the ac3_fixed encoder once we have > a fixed-point iir filter. > > Still depends on the channel coupling patch. > > doc/encoders.texi |7 + > libavcodec/ac3enc.c | 297 +++- > libavcodec/ac3enc_fixed.c |4 +- > libavcodec/ac3enc_float.c | 24 +++- > libavcodec/iirfilter.c|6 + > libavcodec/iirfilter.h| 10 ++ > 6 files changed, 336 insertions(+), 12 deletions(-) > > > @@ -628,6 +877,11 @@ static void apply_channel_coupling(AC3EncodeContext *s) > new_coords = 1; > last_coord_blk = blk; > } > +/* for stereo, encode coordinates more often */ > +if (s->fbw_channels == 2 && blk > 2 && last_coord_blk < (blk-2)) > { > +new_coords = 1; > +last_coord_blk = blk; > +} > } > s->blocks[blk].new_cpl_coords = new_coords; > } *grumble* I don't know how that hunk slipped back into this patch... it's supposed to be part of the coupling patch not this one. -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] ac3enc: add support for transient detection and block switching
--- This is an updated patch which removes some unrelated hunks and also makes it easier to add block switching support to the ac3_fixed encoder once we have a fixed-point iir filter. Still depends on the channel coupling patch. doc/encoders.texi |7 + libavcodec/ac3enc.c | 297 +++- libavcodec/ac3enc_fixed.c |4 +- libavcodec/ac3enc_float.c | 24 +++- libavcodec/iirfilter.c|6 + libavcodec/iirfilter.h| 10 ++ 6 files changed, 336 insertions(+), 12 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3f6b4c9..aa3871a 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -357,6 +357,13 @@ HDCD A/D Converter @table @option +@item -block_switching @var{boolean} +Block Switching. Enables/Disables switching from long blocks to short blocks +based on transient detection. This allows the encoder to determine when it is +best to use short blocks for transient signals. This option is enabled by +default, and it is recommended that it be left as enabled except for testing +purposes or to increase encoding speed. + @item -stereo_rematrixing @var{boolean} Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This is an optional AC-3 feature that increases quality by selectively encoding diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index f09fdf6..c65d74b 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -42,6 +42,7 @@ #include "ac3.h" #include "audioconvert.h" #include "fft.h" +#include "iirfilter.h" #ifndef CONFIG_AC3ENC_FLOAT @@ -66,7 +67,9 @@ typedef int64_t CoefSumType; typedef struct AC3MDCTContext { const SampleType *window; ///< MDCT window function -FFTContext fft; ///< FFT context for MDCT calculation +SampleType *rot_tmp;///< temp buffer for pre-rotated samples +CoefType *coef_tmp; ///< temp buffer for 256-point MDCT coefs +FFTContext fft[2]; ///< FFT context for MDCT calculation } AC3MDCTContext; /** @@ -97,6 +100,7 @@ typedef struct AC3EncOptions { /* other encoding options */ int allow_per_frame_metadata; +int block_switching; int stereo_rematrixing; int channel_coupling; int cpl_start; @@ -117,6 +121,7 @@ typedef struct AC3Block { uint16_t **qmant; ///< quantized mantissas uint8_t **cpl_coord_exp; ///< coupling coord exponents (cplcoexp) uint8_t **cpl_coord_mant; ///< coupling coord mantissas (cplcomant) +uint8_t blk_switch[AC3_MAX_CHANNELS][2]; ///< block switch flags [0]=current [1]=previous uint8_t coeff_shift[AC3_MAX_CHANNELS]; ///< fixed-point coefficient shift values uint8_t new_rematrixing_strategy; ///< send new rematrixing flags in this block int num_rematrixing_bands; ///< number of rematrixing bands @@ -180,6 +185,11 @@ typedef struct AC3EncodeContext { int start_freq[AC3_MAX_CHANNELS]; ///< start frequency bin(strtmant) int cpl_end_freq; ///< coupling channel end frequency bin +int blksw_enabled; ///< block switching enabled +struct FFIIRFilterCoeffs *blksw_coefs; ///< block switch filter coefficients +struct FFIIRFilterState *blksw_state[2][AC3_MAX_CHANNELS]; /// block switch filter states +struct FFIIRFilterState *temp_state;///< block switch filter temp state + int cpl_on; ///< coupling turned on for this frame int cpl_enabled;///< coupling enabled for all frames int num_cpl_subbands; ///< number of coupling subbands(ncplsubnd) @@ -202,6 +212,7 @@ typedef struct AC3EncodeContext { int exponent_bits; ///< number of bits used for exponents SampleType **planar_samples; +SampleType *filtered_samples; uint8_t *bap_buffer; uint8_t *bap1_buffer; CoefType *mdct_coef_buffer; @@ -286,6 +297,7 @@ static const AVOption options[] = { {"standard", "Standard (default)", 0, FF_OPT_TYPE_CONST, 0, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, {"hdcd", "HDCD", 0, FF_OPT_TYPE_CONST, 1, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"}, /* Other Encoding Options */ +{"block_switching", "Block Switching", OFFSET(block_switching), FF_OPT_TYPE_INT, 1, 0, 1, AC3ENC_PARAM}, {"stereo_rematrixing", "Stereo Rematrixing", OFFSET(stereo_rematrixing), FF_OPT_TYPE_INT, 1, 0, 1, AC3ENC_PARAM}, {"channel_coupling", "Channel Coupling", OFFSET(channel_coupling), FF_OPT_TYPE_INT, 1, 0, 1, AC3ENC_PARAM, "channel_coupling"}, {"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, -1, INT_MIN, INT_MAX, AC3ENC_PARAM, "channel_coupling"}, @@ -471,6 +483,237 @@ static void deinterleave_input_samples(
Re: [libav-devel] [PATCH] Port drawtext filter by Hemanth from the libavfilter soc repo
On date Wednesday 2011-04-13 08:20:30 +0200, Anton Khirnov encoded: > From: Stefano Sabatini > > With the following additions: > * support to anti-aliased glyph rendering > * support to UTF-8 text and Unicode chars rendering > * support for RGB packed formats > * fix minor errors and typos in the filter description > * extend/clarify examples in the filter description > > Signed-off-by: Anton Khirnov [...] > +static int glyph_cmp(void *key, const void *b) > +{ > +const Glyph *a = key, *bb = b; > +int64_t diff = (int64_t)a->code - (int64_t)bb->code; > +return diff > 0 ? 1 : diff < 0 ? -1 : 0; > +} Nit: key->a, b->bb is a little schizofrenic ... The changes look fine, but I consider the idea of picking a patch and randomly fixing it very bad, indeed this is making very hard to spot the differences with the original and spoiling authorship/blame information. I suggest to apply the original patch, and apply the fixes on top of that, this also helps the original contributor to review and eventually port the various fixes. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] Replace strncpy() with av_strlcpy().
On 05/03/2011 03:05 PM, Aℓex Converse wrote: > On Tue, May 3, 2011 at 11:45 AM, Justin Ruggles > wrote: >> On 05/03/2011 02:21 PM, Alex Converse wrote: >> >>> memset(compressor_name,0,32); >>> /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ >>> if (track->mode == MODE_MOV && track->enc->codec && >>> track->enc->codec->name) >>> -strncpy(compressor_name,track->enc->codec->name,31); >>> +av_strlcpy(compressor_name,track->enc->codec->name,32); >> >> >> Can't that memset be replaced with compressor_name[0] = '\0' now that >> the result will be null-terminated? >> > > avio_w8(pb, strlen(compressor_name)); > avio_write(pb, compressor_name, 31); > > avio_write() is a mem-function not a str-function so we still want it > zerofilled to the end. Still I can't help but notice that this looks > like a pascal string and wonder if > > avio_w8(pb, strlen(compressor_name)); > avio_write(pb, compressor_name, strlen(compressor_name)); > > would be better. ah, I didn't notice that. probably is better that way from the look of it, but I don't know what the MOV spec says. > On Tue, May 3, 2011 at 11:46 AM, Justin Ruggles > wrote: >> On 05/03/2011 02:21 PM, Alex Converse wrote: >> >>> @@ -1099,4 +1100,3 @@ void pp_postprocess(const uint8_t * src[3], const >>> int srcStride[3], >>> } >>> } >>> } >>> - >> >> >> stray cosmetic change >> > > Fixed patch ok. -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] Replace strncpy() with av_strlcpy().
On Tue, May 3, 2011 at 11:45 AM, Justin Ruggles wrote: > On 05/03/2011 02:21 PM, Alex Converse wrote: > >> memset(compressor_name,0,32); >> /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ >> if (track->mode == MODE_MOV && track->enc->codec && >> track->enc->codec->name) >> - strncpy(compressor_name,track->enc->codec->name,31); >> + av_strlcpy(compressor_name,track->enc->codec->name,32); > > > Can't that memset be replaced with compressor_name[0] = '\0' now that > the result will be null-terminated? > avio_w8(pb, strlen(compressor_name)); avio_write(pb, compressor_name, 31); avio_write() is a mem-function not a str-function so we still want it zerofilled to the end. Still I can't help but notice that this looks like a pascal string and wonder if avio_w8(pb, strlen(compressor_name)); avio_write(pb, compressor_name, strlen(compressor_name)); would be better. On Tue, May 3, 2011 at 11:46 AM, Justin Ruggles wrote: > On 05/03/2011 02:21 PM, Alex Converse wrote: > >> @@ -1099,4 +1100,3 @@ void pp_postprocess(const uint8_t * src[3], const int >> srcStride[3], >> } >> } >> } >> - > > > stray cosmetic change > Fixed From 116210e7040cfaaba58234945263468e3801e48d Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Tue, 3 May 2011 11:19:31 -0700 Subject: [PATCH 1/2] Replace strncpy() with av_strlcpy(). MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1" This is a multi-part message in MIME format. --1 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit --- ffmpeg.c |3 +-- libavcodec/ac3enc.c | 43 ++- libavcodec/ass.c |4 ++-- libavformat/movenc.c |2 +- libavformat/mp3enc.c |3 ++- libavutil/log.c |3 ++- libpostproc/postprocess.c |3 ++- 7 files changed, 32 insertions(+), 29 deletions(-) --1 Content-Type: text/x-patch; name="0001-Replace-strncpy-with-av_strlcpy.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-Replace-strncpy-with-av_strlcpy.patch" diff --git a/ffmpeg.c b/ffmpeg.c index d728f14..c586811 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3695,8 +3695,7 @@ static int opt_streamid(const char *opt, const char *arg) char *p; char idx_str[16]; -strncpy(idx_str, arg, sizeof(idx_str)); -idx_str[sizeof(idx_str)-1] = '\0'; +av_strlcpy(idx_str, arg, sizeof(idx_str)); p = strchr(idx_str, ':'); if (!p) { fprintf(stderr, diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index bf106eb..a35ff29 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -33,6 +33,7 @@ #include "libavutil/audioconvert.h" #include "libavutil/avassert.h" +#include "libavutil/avstring.h" #include "libavutil/crc.h" #include "libavutil/opt.h" #include "avcodec.h" @@ -1578,10 +1579,10 @@ static void dprint_options(AVCodecContext *avctx) char strbuf[32]; switch (s->bitstream_id) { -case 6: strncpy(strbuf, "AC-3 (alt syntax)", 32); break; -case 8: strncpy(strbuf, "AC-3 (standard)", 32);break; -case 9: strncpy(strbuf, "AC-3 (dnet half-rate)", 32); break; -case 10: strncpy(strbuf, "AC-3 (dnet quater-rate", 32); break; +case 6: av_strlcpy(strbuf, "AC-3 (alt syntax)", 32); break; +case 8: av_strlcpy(strbuf, "AC-3 (standard)", 32);break; +case 9: av_strlcpy(strbuf, "AC-3 (dnet half-rate)", 32); break; +case 10: av_strlcpy(strbuf, "AC-3 (dnet quater-rate", 32); break; default: snprintf(strbuf, 32, "ERROR"); } av_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id); @@ -1608,9 +1609,9 @@ static void dprint_options(AVCodecContext *avctx) if (opt->audio_production_info) { av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level); switch (opt->room_type) { -case 0: strncpy(strbuf, "notindicated", 32); break; -case 1: strncpy(strbuf, "large", 32);break; -case 2: strncpy(strbuf, "small", 32);break; +case 0: av_strlcpy(strbuf, "notindicated", 32); break; +case 1: av_strlcpy(strbuf, "large", 32);break; +case 2: av_strlcpy(strbuf, "small", 32);break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type); } av_dlog(avctx, "room_type: %s\n", strbuf); @@ -1622,9 +1623,9 @@ static void dprint_options(AVCodecContext *avctx) av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level); if (s->channel_mode == AC3_CHMODE_STEREO) { switch (opt->dolby_surround_mode) { -case 0: strncpy(strbuf, "notindicated", 32); break; -case 1: strncpy(strbuf, "on", 32); break; -case 2: strncpy(strbuf, "off", 32); break; +case 0: av_strlcpy(strbuf, "notindicated", 32); break; +case 1:
Re: [libav-devel] [PATCH 2/2] Ban strncpy() it's too easy to misuse.
On 05/03/2011 02:21 PM, Alex Converse wrote: > --- > libavutil/internal.h |2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > > > 0002-Ban-strncpy-it-s-too-easy-to-misuse.patch > > > diff --git a/libavutil/internal.h b/libavutil/internal.h > index 37bc681..e890ae7 100644 > --- a/libavutil/internal.h > +++ b/libavutil/internal.h > @@ -137,6 +137,8 @@ > #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf > #undef strcat > #define strcat strcat_is_forbidden_due_to_security_issues_use_av_strlcat > +#undef strncpy > +#define strncpy strncpy_is_forbidden_due_to_security_issues_use_av_strlcpy > #undef exit > #define exit exit_is_forbidden > #ifndef LIBAVFORMAT_BUILD Looks like a good idea to me. -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] Replace strncpy() with av_strlcpy().
On 05/03/2011 02:21 PM, Alex Converse wrote: > @@ -1099,4 +1100,3 @@ void pp_postprocess(const uint8_t * src[3], const int > srcStride[3], > } > } > } > - stray cosmetic change ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/2] Replace strncpy() with av_strlcpy().
On 05/03/2011 02:21 PM, Alex Converse wrote: > memset(compressor_name,0,32); > /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ > if (track->mode == MODE_MOV && track->enc->codec && > track->enc->codec->name) > -strncpy(compressor_name,track->enc->codec->name,31); > +av_strlcpy(compressor_name,track->enc->codec->name,32); Can't that memset be replaced with compressor_name[0] = '\0' now that the result will be null-terminated? -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/2] Ban strncpy() it's too easy to misuse.
--- libavutil/internal.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/libavutil/internal.h b/libavutil/internal.h index 37bc681..e890ae7 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -137,6 +137,8 @@ #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf #undef strcat #define strcat strcat_is_forbidden_due_to_security_issues_use_av_strlcat +#undef strncpy +#define strncpy strncpy_is_forbidden_due_to_security_issues_use_av_strlcpy #undef exit #define exit exit_is_forbidden #ifndef LIBAVFORMAT_BUILD ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/2] Replace strncpy() with av_strlcpy().
--- ffmpeg.c |3 +-- libavcodec/ac3enc.c | 43 ++- libavcodec/ass.c |4 ++-- libavformat/movenc.c |2 +- libavformat/mp3enc.c |3 ++- libavutil/log.c |3 ++- libpostproc/postprocess.c |4 ++-- 7 files changed, 32 insertions(+), 30 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index d728f14..c586811 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3695,8 +3695,7 @@ static int opt_streamid(const char *opt, const char *arg) char *p; char idx_str[16]; -strncpy(idx_str, arg, sizeof(idx_str)); -idx_str[sizeof(idx_str)-1] = '\0'; +av_strlcpy(idx_str, arg, sizeof(idx_str)); p = strchr(idx_str, ':'); if (!p) { fprintf(stderr, diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index bf106eb..a35ff29 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -33,6 +33,7 @@ #include "libavutil/audioconvert.h" #include "libavutil/avassert.h" +#include "libavutil/avstring.h" #include "libavutil/crc.h" #include "libavutil/opt.h" #include "avcodec.h" @@ -1578,10 +1579,10 @@ static void dprint_options(AVCodecContext *avctx) char strbuf[32]; switch (s->bitstream_id) { -case 6: strncpy(strbuf, "AC-3 (alt syntax)", 32); break; -case 8: strncpy(strbuf, "AC-3 (standard)", 32);break; -case 9: strncpy(strbuf, "AC-3 (dnet half-rate)", 32); break; -case 10: strncpy(strbuf, "AC-3 (dnet quater-rate", 32); break; +case 6: av_strlcpy(strbuf, "AC-3 (alt syntax)", 32); break; +case 8: av_strlcpy(strbuf, "AC-3 (standard)", 32);break; +case 9: av_strlcpy(strbuf, "AC-3 (dnet half-rate)", 32); break; +case 10: av_strlcpy(strbuf, "AC-3 (dnet quater-rate", 32); break; default: snprintf(strbuf, 32, "ERROR"); } av_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id); @@ -1608,9 +1609,9 @@ static void dprint_options(AVCodecContext *avctx) if (opt->audio_production_info) { av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level); switch (opt->room_type) { -case 0: strncpy(strbuf, "notindicated", 32); break; -case 1: strncpy(strbuf, "large", 32);break; -case 2: strncpy(strbuf, "small", 32);break; +case 0: av_strlcpy(strbuf, "notindicated", 32); break; +case 1: av_strlcpy(strbuf, "large", 32);break; +case 2: av_strlcpy(strbuf, "small", 32);break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type); } av_dlog(avctx, "room_type: %s\n", strbuf); @@ -1622,9 +1623,9 @@ static void dprint_options(AVCodecContext *avctx) av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level); if (s->channel_mode == AC3_CHMODE_STEREO) { switch (opt->dolby_surround_mode) { -case 0: strncpy(strbuf, "notindicated", 32); break; -case 1: strncpy(strbuf, "on", 32); break; -case 2: strncpy(strbuf, "off", 32); break; +case 0: av_strlcpy(strbuf, "notindicated", 32); break; +case 1: av_strlcpy(strbuf, "on", 32); break; +case 2: av_strlcpy(strbuf, "off", 32); break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_mode); } av_dlog(avctx, "dsur_mode: %s\n", strbuf); @@ -1636,9 +1637,9 @@ static void dprint_options(AVCodecContext *avctx) if (s->bitstream_id == 6) { if (opt->extended_bsi_1) { switch (opt->preferred_stereo_downmix) { -case 0: strncpy(strbuf, "notindicated", 32); break; -case 1: strncpy(strbuf, "ltrt", 32); break; -case 2: strncpy(strbuf, "loro", 32); break; +case 0: av_strlcpy(strbuf, "notindicated", 32); break; +case 1: av_strlcpy(strbuf, "ltrt", 32); break; +case 2: av_strlcpy(strbuf, "loro", 32); break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->preferred_stereo_downmix); } av_dlog(avctx, "dmix_mode: %s\n", strbuf); @@ -1655,23 +1656,23 @@ static void dprint_options(AVCodecContext *avctx) } if (opt->extended_bsi_2) { switch (opt->dolby_surround_ex_mode) { -case 0: strncpy(strbuf, "notindicated", 32); break; -case 1: strncpy(strbuf, "on", 32); break; -case 2: strncpy(strbuf, "off", 32); break; +case 0: av_strlcpy(strbuf, "notindicated", 32); break; +case 1: av_strlcpy(strbuf, "on", 32); break; +case 2: av_strlcpy(strbuf, "off", 32); break; default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_ex_mode); } av_dlog(avctx, "dsurex_mode: %s\n", strbuf); switch (opt->dolby_headphone_mode) { -case 0: strncpy(strb
Re: [libav-devel] [PATCH] Implement fate-rsync target
On Tue, May 03, 2011 at 17:59:53 (CEST), Måns Rullgård wrote: > Reinhard Tartler writes: > >> +fate-rsync: >> +ifdef SAMPLES > > There is already a section conditional on SAMPLES. Including this there > might look nicer. The duplicated target line doesn't matter IMO. Changed > >> +rsync -vaLW rsync://fate-suite.libav.org:/fate-suite/ $(SAMPLES) > > Why the extra : ? removed >> +else >> +@echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate >> suite" >> +endif >> + >> .PHONY: documentation *test regtest-* alltools check config >> -- >> 1.7.4.1 >> patch pushed -- Gruesse/greetings, Reinhard Tartler, KeyID 945348A4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/4] indeo3: Eliminate use of long.
On 04/27/2011 08:10 PM, Aℓex Converse wrote: > --- > libavcodec/indeo3.c | 22 +++--- > 1 files changed, 11 insertions(+), 11 deletions(-) > > > --1 > Content-Type: text/x-patch; name="0001-indeo3-Eliminate-use-of-long.patch" > Content-Transfer-Encoding: 8bit > Content-Disposition: attachment; > filename="0001-indeo3-Eliminate-use-of-long.patch" > > diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c > index 29a8d4a..30b7085 100644 > --- a/libavcodec/indeo3.c > +++ b/libavcodec/indeo3.c > @@ -149,13 +149,13 @@ static av_cold void iv_free_func(Indeo3DecodeContext *s) > } > > struct ustr { > -long xpos; > -long ypos; > -long width; > -long height; > -long split_flag; > -long split_direction; > -long usl7; > +int xpos; > +int ypos; > +int width; > +int height; > +int split_flag; > +int split_direction; > +int usl7; > }; > > > @@ -203,12 +203,12 @@ struct ustr { > > static void iv_Decode_Chunk(Indeo3DecodeContext *s, > uint8_t *cur, uint8_t *ref, int width, int height, > -const uint8_t *buf1, long cb_offset, const uint8_t *hdr, > +const uint8_t *buf1, int cb_offset, const uint8_t *hdr, > const uint8_t *buf2, int min_width_160) > { > uint8_t bit_buf; > -unsigned long bit_pos, lv, lv1, lv2; > -long *width_tbl, width_tbl_arr[10]; > +unsigned int bit_pos, lv, lv1, lv2; > +int *width_tbl, width_tbl_arr[10]; > const signed char *ref_vectors; > uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2; > uint32_t *cur_lp, *ref_lp; > @@ -982,7 +982,7 @@ static int iv_decode_frame(AVCodecContext *avctx, > Indeo3DecodeContext *s = avctx->priv_data; > unsigned int image_width, image_height, > chroma_width, chroma_height; > -unsigned long flags, cb_offset, data_size, > +unsigned int flags, cb_offset, data_size, >y_offset, v_offset, u_offset, mc_vector_count; > const uint8_t *hdr_pos, *buf_pos; Ok. -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Implement fate-rsync target
Reinhard Tartler writes: > +fate-rsync: > +ifdef SAMPLES There is already a section conditional on SAMPLES. Including this there might look nicer. The duplicated target line doesn't matter IMO. > + rsync -vaLW rsync://fate-suite.libav.org:/fate-suite/ $(SAMPLES) Why the extra : ? > +else > + @echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate > suite" > +endif > + > .PHONY: documentation *test regtest-* alltools check config > -- > 1.7.4.1 > -- 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] Implement fate-rsync target
Hi, On Tue, May 3, 2011 at 8:40 AM, Reinhard Tartler wrote: > --- > Makefile | 7 +++ > 1 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/Makefile b/Makefile > index 0849443..8370adc 100644 > --- a/Makefile > +++ b/Makefile > @@ -290,4 +290,11 @@ $(FATE): ffmpeg$(EXESUF) > $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) > fate-list: > @printf '%s\n' $(sort $(FATE)) > > +fate-rsync: > +ifdef SAMPLES > + rsync -vaLW rsync://fate-suite.libav.org:/fate-suite/ $(SAMPLES) > +else > + @echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the > fate suite" > +endif > + > .PHONY: documentation *test regtest-* alltools check config Looks good, please apply. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] Implement fate-rsync target
--- Makefile |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Makefile b/Makefile index 0849443..8370adc 100644 --- a/Makefile +++ b/Makefile @@ -290,4 +290,11 @@ $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) fate-list: @printf '%s\n' $(sort $(FATE)) +fate-rsync: +ifdef SAMPLES + rsync -vaLW rsync://fate-suite.libav.org:/fate-suite/ $(SAMPLES) +else + @echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite" +endif + .PHONY: documentation *test regtest-* alltools check config -- 1.7.4.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/3] avfilter: check malloc return values.
On 5/3/11 2:23 PM, Ronald S. Bultje wrote: ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count); ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); +if (!ret->inputs || !ret->input_pads) +goto err; Wrong I guess... lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/3] nutenc: check malloc return values.
On 5/3/11 2:23 PM, Ronald S. Bultje wrote: --- libavformat/nutenc.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 4ca761a..85340b1 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -588,6 +588,12 @@ static int write_header(AVFormatContext *s){ nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters); nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams + s->nb_chapters)); +if (!nut->stream || (s->nb_chapters&& !nut->chapter) || !nut->time_base) { +av_freep(&nut->stream); +av_freep(&nut->chapter); +av_freep(&nut->time_base); +return AVERROR(ENOMEM); +} for(i=0; inb_streams; i++){ AVStream *st= s->streams[i]; Seems ok ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 3/3] mpegvideo: reindent.
--- libavcodec/mpegvideo.c | 227 +++ 1 files changed, 111 insertions(+), 116 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 6ccc50f..f4de8dd 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -521,100 +521,97 @@ av_cold int MPV_common_init(MpegEncContext *s) s->flags2= s->avctx->flags2; if (s->width && s->height) { +s->mb_width = (s->width + 15) / 16; +s->mb_stride = s->mb_width + 1; +s->b8_stride = s->mb_width*2 + 1; +s->b4_stride = s->mb_width*4 + 1; +mb_array_size= s->mb_height * s->mb_stride; +mv_table_size= (s->mb_height+2) * s->mb_stride + 1; -s->mb_width = (s->width + 15) / 16; -s->mb_stride = s->mb_width + 1; -s->b8_stride = s->mb_width*2 + 1; -s->b4_stride = s->mb_width*4 + 1; -mb_array_size= s->mb_height * s->mb_stride; -mv_table_size= (s->mb_height+2) * s->mb_stride + 1; +/* set chroma shifts */ +avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift), + &(s->chroma_y_shift) ); -/* set chroma shifts */ -avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift), -&(s->chroma_y_shift) ); +/* set default edge pos, will be overriden in decode_header if needed */ +s->h_edge_pos= s->mb_width*16; +s->v_edge_pos= s->mb_height*16; -/* set default edge pos, will be overriden in decode_header if needed */ -s->h_edge_pos= s->mb_width*16; -s->v_edge_pos= s->mb_height*16; +s->mb_num = s->mb_width * s->mb_height; -s->mb_num = s->mb_width * s->mb_height; +s->block_wrap[0]= +s->block_wrap[1]= +s->block_wrap[2]= +s->block_wrap[3]= s->b8_stride; +s->block_wrap[4]= +s->block_wrap[5]= s->mb_stride; -s->block_wrap[0]= -s->block_wrap[1]= -s->block_wrap[2]= -s->block_wrap[3]= s->b8_stride; -s->block_wrap[4]= -s->block_wrap[5]= s->mb_stride; +y_size = s->b8_stride * (2 * s->mb_height + 1); +c_size = s->mb_stride * (s->mb_height + 1); +yc_size = y_size + 2 * c_size; -y_size = s->b8_stride * (2 * s->mb_height + 1); -c_size = s->mb_stride * (s->mb_height + 1); -yc_size = y_size + 2 * c_size; +/* convert fourcc to upper case */ +s->codec_tag = ff_toupper4(s->avctx->codec_tag); -/* convert fourcc to upper case */ -s->codec_tag = ff_toupper4(s->avctx->codec_tag); +s->stream_codec_tag = ff_toupper4(s->avctx->stream_codec_tag); -s->stream_codec_tag = ff_toupper4(s->avctx->stream_codec_tag); +s->avctx->coded_frame= (AVFrame*)&s->current_picture; -s->avctx->coded_frame= (AVFrame*)&s->current_picture; - -FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num+1)*sizeof(int), fail) //error ressilience code looks cleaner with this -for(y=0; ymb_height; y++){ -for(x=0; xmb_width; x++){ -s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride; +FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num+1)*sizeof(int), fail) //error ressilience code looks cleaner with this +for(y=0; ymb_height; y++){ +for(x=0; xmb_width; x++){ +s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride; +} } -} -s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed? +s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed? -if (s->encoding) { -/* Allocate MV tables */ -FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail) -FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) -FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) -FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) -FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) -FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) -s->p_mv_table = s->p_mv_table_base+ s->mb_stride + 1; -s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1; -s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1; -s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1; -s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1; -s->b_direct_mv_table= s->b_direct_mv_table_base + s->mb_stride + 1; - -if(s->msmpeg4_version){ -
[libav-devel] [PATCH 1/3] avfilter: check malloc return values.
--- libavfilter/avfilter.c | 22 +- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c71c046..98fd2f7 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -583,18 +583,25 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in return AVERROR(EINVAL); ret = av_mallocz(sizeof(AVFilterContext)); +if (!ret) +return AVERROR(ENOMEM); ret->av_class = &avfilter_class; ret->filter = filter; ret->name = inst_name ? av_strdup(inst_name) : NULL; -if (filter->priv_size) +if (filter->priv_size) { ret->priv = av_mallocz(filter->priv_size); +if (!ret->priv) +goto err; +} ret->input_count = pad_count(filter->inputs); if (ret->input_count) { ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count); ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); +if (!ret->inputs || !ret->input_pads) +goto err; } ret->output_count = pad_count(filter->outputs); @@ -602,10 +609,23 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count); ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); +if (!ret->outputs || !ret->output_pads) +goto err; } *filter_ctx = ret; return 0; + +err: +av_freep(&ret->inputs); +av_freep(&ret->input_pads); +ret->input_count = 0; +av_freep(&ret->outputs); +av_freep(&ret->output_pads); +ret->output_count = 0; +av_freep(&ret->priv); +av_free(ret); +return AVERROR(ENOMEM); } void avfilter_free(AVFilterContext *filter) -- 1.7.2.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/3] nutenc: check malloc return values.
--- libavformat/nutenc.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 4ca761a..85340b1 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -588,6 +588,12 @@ static int write_header(AVFormatContext *s){ nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters); nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams + s->nb_chapters)); +if (!nut->stream || (s->nb_chapters && !nut->chapter) || !nut->time_base) { +av_freep(&nut->stream); +av_freep(&nut->chapter); +av_freep(&nut->time_base); +return AVERROR(ENOMEM); +} for(i=0; inb_streams; i++){ AVStream *st= s->streams[i]; -- 1.7.2.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/2] vc1: make overlap filter for I-frames bit-exact.
On Tue, May 03, 2011 at 04:52:18AM -0700, Ronald S. Bultje wrote: > Hi, > > On Mon, May 2, 2011 at 9:36 PM, Kostya wrote: > > On Mon, May 02, 2011 at 10:12:34PM -0400, Ronald S. Bultje wrote: > >> --- > >> libavcodec/vc1.h | 2 + > >> libavcodec/vc1dec.c | 279 > >> +++ > >> libavcodec/vc1dsp.c | 54 ++ > >> libavcodec/vc1dsp.h | 6 +- > >> 4 files changed, 296 insertions(+), 45 deletions(-) > >> > > [...] > >> @@ -672,6 +724,8 @@ av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { > >> dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c; > >> dsp->vc1_h_overlap = vc1_h_overlap_c; > >> dsp->vc1_v_overlap = vc1_v_overlap_c; > >> + dsp->vc1_h_s_overlap = vc1_h_s_overlap_c; > >> + dsp->vc1_v_s_overlap = vc1_v_s_overlap_c; > >> dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c; > >> dsp->vc1_h_loop_filter4 = vc1_h_loop_filter4_c; > >> dsp->vc1_v_loop_filter8 = vc1_v_loop_filter8_c; > >> diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h > >> index 7b1ae10..e1b6ba0 100644 > >> --- a/libavcodec/vc1dsp.h > >> +++ b/libavcodec/vc1dsp.h > >> @@ -40,8 +40,10 @@ typedef struct VC1DSPContext { > >> void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM > >> *block); > >> void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM > >> *block); > >> void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM > >> *block); > >> - void (*vc1_v_overlap)(uint8_t* src, int stride); > >> - void (*vc1_h_overlap)(uint8_t* src, int stride); > >> + void (*vc1_v_overlap)(uint8_t *src, int stride); > >> + void (*vc1_h_overlap)(uint8_t *src, int stride); > >> + void (*vc1_v_s_overlap)(DCTELEM *top, DCTELEM *bottom); > >> + void (*vc1_h_s_overlap)(DCTELEM *left, DCTELEM *right); > >> void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq); > >> void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq); > >> void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq); > >> -- > > > > Almost ok but I have one question - is vc1_[hv]_overlap used anymore (I > > don't > > think they should)? If not then just replace old functions with new ones but > > leave old names. > > For archive purposes: no, I only changed adv. profile I frames. > main/simple profile I frames and P frames still use the old overlap > filter. Once they're all bitexact/changed/fixed, I'll remove the 8bit > versions in a separate patch. patch ok then ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/2] vc1: make overlap filter for I-frames bit-exact.
Hi, On Mon, May 2, 2011 at 9:36 PM, Kostya wrote: > On Mon, May 02, 2011 at 10:12:34PM -0400, Ronald S. Bultje wrote: >> --- >> libavcodec/vc1.h | 2 + >> libavcodec/vc1dec.c | 279 >> +++ >> libavcodec/vc1dsp.c | 54 ++ >> libavcodec/vc1dsp.h | 6 +- >> 4 files changed, 296 insertions(+), 45 deletions(-) >> > [...] >> @@ -672,6 +724,8 @@ av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { >> dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c; >> dsp->vc1_h_overlap = vc1_h_overlap_c; >> dsp->vc1_v_overlap = vc1_v_overlap_c; >> + dsp->vc1_h_s_overlap = vc1_h_s_overlap_c; >> + dsp->vc1_v_s_overlap = vc1_v_s_overlap_c; >> dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c; >> dsp->vc1_h_loop_filter4 = vc1_h_loop_filter4_c; >> dsp->vc1_v_loop_filter8 = vc1_v_loop_filter8_c; >> diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h >> index 7b1ae10..e1b6ba0 100644 >> --- a/libavcodec/vc1dsp.h >> +++ b/libavcodec/vc1dsp.h >> @@ -40,8 +40,10 @@ typedef struct VC1DSPContext { >> void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM >> *block); >> void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM >> *block); >> void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM >> *block); >> - void (*vc1_v_overlap)(uint8_t* src, int stride); >> - void (*vc1_h_overlap)(uint8_t* src, int stride); >> + void (*vc1_v_overlap)(uint8_t *src, int stride); >> + void (*vc1_h_overlap)(uint8_t *src, int stride); >> + void (*vc1_v_s_overlap)(DCTELEM *top, DCTELEM *bottom); >> + void (*vc1_h_s_overlap)(DCTELEM *left, DCTELEM *right); >> void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq); >> void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq); >> void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq); >> -- > > Almost ok but I have one question - is vc1_[hv]_overlap used anymore (I don't > think they should)? If not then just replace old functions with new ones but > leave old names. For archive purposes: no, I only changed adv. profile I frames. main/simple profile I frames and P frames still use the old overlap filter. Once they're all bitexact/changed/fixed, I'll remove the 8bit versions in a separate patch. Ronald ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Make ffmpeg support generic data stream
On Thu, Apr 14, 2011 at 01:32:36PM +0200, Luca Barbato wrote: > The patch is the first step to support -dcodec copy > --- > cmdutils.h |1 + > ffmpeg.c | 85 +++ > libavformat/riff.c |1 + > 3 files changed, 80 insertions(+), 7 deletions(-) yes, looks fine to me ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel