From a3b7dabb5bd3d7d9469f04e3fba7a49489a75372 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 28 Apr 2011 18:59:14 +0200 Subject: [PATCH 01/12] vf_fieldorder: Replace FFmpeg by Libav in license boilerplate. --- libavfilter/vf_fieldorder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_fieldorder.c b/libavfilter/vf_fieldorder.c index 59ca77821a..b55640bbc2 100644 --- a/libavfilter/vf_fieldorder.c +++ b/libavfilter/vf_fieldorder.c @@ -1,20 +1,20 @@ /* * Copyright (c) 2011 Mark Himsley * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ From d1be646e906487b395190af1d6dd8d33c22bf25f Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 28 Apr 2011 11:09:35 +0200 Subject: [PATCH 02/12] vorbisdec: Replace some sizeof(type) by sizeof(*variable). --- libavcodec/vorbisdec.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index a9ddc7d86a..c70bd75fed 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -247,9 +247,9 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) AV_DEBUG(" Codebooks: %d \n", vc->codebook_count); - vc->codebooks = av_mallocz(vc->codebook_count * sizeof(vorbis_codebook)); - tmp_vlc_bits = av_mallocz(V_MAX_VLCS * sizeof(uint8_t)); - tmp_vlc_codes = av_mallocz(V_MAX_VLCS * sizeof(uint32_t)); + vc->codebooks = av_mallocz(vc->codebook_count * sizeof(*vc->codebooks)); + tmp_vlc_bits = av_mallocz(V_MAX_VLCS * sizeof(*tmp_vlc_bits)); + tmp_vlc_codes = av_mallocz(V_MAX_VLCS * sizeof(*tmp_vlc_codes)); codebook_multiplicands = av_malloc(V_MAX_VLCS * sizeof(*codebook_multiplicands)); for (cb = 0; cb < vc->codebook_count; ++cb) { @@ -360,7 +360,10 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) } // Weed out unused vlcs and build codevector vector - codebook_setup->codevectors = used_entries ? av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float)) : NULL; + codebook_setup->codevectors = used_entries ? av_mallocz(used_entries * + codebook_setup->dimensions * + sizeof(*codebook_setup->codevectors)) + : NULL; for (j = 0, i = 0; i < entries; ++i) { uint_fast8_t dim = codebook_setup->dimensions; @@ -472,7 +475,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) vc->floor_count = get_bits(gb, 6) + 1; - vc->floors = av_mallocz(vc->floor_count * sizeof(vorbis_floor)); + vc->floors = av_mallocz(vc->floor_count * sizeof(*vc->floors)); for (i = 0; i < vc->floor_count; ++i) { vorbis_floor *floor_setup = &vc->floors[i]; @@ -532,7 +535,8 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) for (j = 0; j < floor_setup->data.t1.partitions; ++j) floor_setup->data.t1.x_list_dim+=floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]]; - floor_setup->data.t1.list = av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(vorbis_floor1_entry)); + floor_setup->data.t1.list = av_mallocz(floor_setup->data.t1.x_list_dim * + sizeof(*floor_setup->data.t1.list)); rangebits = get_bits(gb, 4); @@ -597,8 +601,8 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) /* codebook dim is for padding if codebook dim doesn't * * divide order+1 then we need to read more data */ floor_setup->data.t0.lsp = - av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim) - * sizeof(float)); + av_malloc((floor_setup->data.t0.order + 1 + max_codebook_dim) + * sizeof(*floor_setup->data.t0.lsp)); if (!floor_setup->data.t0.lsp) return -1; @@ -640,7 +644,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc) uint_fast8_t i, j, k; vc->residue_count = get_bits(gb, 6)+1; - vc->residues = av_mallocz(vc->residue_count * sizeof(vorbis_residue)); + vc->residues = av_mallocz(vc->residue_count * sizeof(*vc->residues)); AV_DEBUG(" There are %d residues. \n", vc->residue_count); @@ -716,7 +720,7 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) uint_fast8_t i, j; vc->mapping_count = get_bits(gb, 6)+1; - vc->mappings = av_mallocz(vc->mapping_count * sizeof(vorbis_mapping)); + vc->mappings = av_mallocz(vc->mapping_count * sizeof(*vc->mappings)); AV_DEBUG(" There are %d mappings. \n", vc->mapping_count); @@ -735,8 +739,10 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) if (get_bits1(gb)) { mapping_setup->coupling_steps = get_bits(gb, 8) + 1; - mapping_setup->magnitude = av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t)); - mapping_setup->angle = av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t)); + mapping_setup->magnitude = av_mallocz(mapping_setup->coupling_steps * + sizeof(*mapping_setup->magnitude)); + mapping_setup->angle = av_mallocz(mapping_setup->coupling_steps * + sizeof(*mapping_setup->angle)); for (j = 0; j < mapping_setup->coupling_steps; ++j) { GET_VALIDATED_INDEX(mapping_setup->magnitude[j], ilog(vc->audio_channels - 1), vc->audio_channels) GET_VALIDATED_INDEX(mapping_setup->angle[j], ilog(vc->audio_channels - 1), vc->audio_channels) @@ -753,7 +759,8 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) } if (mapping_setup->submaps>1) { - mapping_setup->mux = av_mallocz(vc->audio_channels * sizeof(uint_fast8_t)); + mapping_setup->mux = av_mallocz(vc->audio_channels * + sizeof(*mapping_setup->mux)); for (j = 0; j < vc->audio_channels; ++j) mapping_setup->mux[j] = get_bits(gb, 4); } @@ -813,7 +820,7 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) uint_fast8_t i; vc->mode_count = get_bits(gb, 6) + 1; - vc->modes = av_mallocz(vc->mode_count * sizeof(vorbis_mode)); + vc->modes = av_mallocz(vc->mode_count * sizeof(*vc->modes)); AV_DEBUG(" There are %d modes.\n", vc->mode_count); @@ -925,9 +932,9 @@ static int vorbis_parse_id_hdr(vorbis_context *vc) return -2; } - vc->channel_residues = av_malloc((vc->blocksize[1] / 2) * vc->audio_channels * sizeof(float)); - vc->channel_floors = av_malloc((vc->blocksize[1] / 2) * vc->audio_channels * sizeof(float)); - vc->saved = av_mallocz((vc->blocksize[1] / 4) * vc->audio_channels * sizeof(float)); + vc->channel_residues = av_malloc((vc->blocksize[1] / 2) * vc->audio_channels * sizeof(*vc->channel_residues)); + vc->channel_floors = av_malloc((vc->blocksize[1] / 2) * vc->audio_channels * sizeof(*vc->channel_floors)); + vc->saved = av_mallocz((vc->blocksize[1] / 4) * vc->audio_channels * sizeof(*vc->saved)); vc->previous_window = 0; ff_mdct_init(&vc->mdct[0], bl0, 1, -vc->scale_bias); From 045dd4b9287551443e655b313417fd776f52aab0 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 29 Apr 2011 17:27:01 +0200 Subject: [PATCH 03/12] Replace some commented-out debug printf() / av_log() messages with av_dlog(). --- ffplay.c | 8 +++----- libavcodec/mpegaudioenc.c | 20 +++++++------------- libavcodec/mpegvideo_parser.c | 6 ++---- libavcodec/parser.c | 7 +++---- libavdevice/v4l.c | 10 ++-------- libavformat/mpeg.c | 7 +++---- libavformat/mpegenc.c | 11 +++-------- libavformat/mpegts.c | 6 ++---- libavformat/oggdec.c | 16 ++++------------ libavformat/rmdec.c | 16 +++++++--------- libavformat/utils.c | 16 +++++++--------- 11 files changed, 43 insertions(+), 80 deletions(-) diff --git a/ffplay.c b/ffplay.c index 18010ef076..73ebc6f78a 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2028,11 +2028,9 @@ static int synchronize_audio(VideoState *is, short *samples, samples_size = wanted_size; } } -#if 0 - printf("diff=%f adiff=%f sample_diff=%d apts=%0.3f vpts=%0.3f %f\n", - diff, avg_diff, samples_size - samples_size1, - is->audio_clock, is->video_clock, is->audio_diff_threshold); -#endif + av_dlog(NULL, "diff=%f adiff=%f sample_diff=%d apts=%0.3f vpts=%0.3f %f\n", + diff, avg_diff, samples_size - samples_size1, + is->audio_clock, is->video_clock, is->audio_diff_threshold); } } else { /* too big difference : may be initial PTS errors, so diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index bd581cfaa4..9659757ff8 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -399,10 +399,8 @@ static void compute_scale_factors(unsigned char scale_code[SBLIMIT], index = 62; /* value 63 is not allowed */ } -#if 0 - printf("%2d:%d in=%x %x %d\n", - j, i, vmax, scale_factor_table[index], index); -#endif + av_dlog(NULL, "%2d:%d in=%x %x %d\n", + j, i, vmax, scale_factor_table[index], index); /* store the scale factor */ assert(index >=0 && index <= 63); sf[i] = index; @@ -470,10 +468,8 @@ static void compute_scale_factors(unsigned char scale_code[SBLIMIT], code = 0; /* kill warning */ } -#if 0 - printf("%d: %2d %2d %2d %d %d -> %d\n", j, - sf[0], sf[1], sf[2], d1, d2, code); -#endif + av_dlog(NULL, "%d: %2d %2d %2d %d %d -> %d\n", j, + sf[0], sf[1], sf[2], d1, d2, code); scale_code[j] = code; sf += 3; } @@ -547,11 +543,9 @@ static void compute_bit_allocation(MpegAudioContext *s, } } } -#if 0 - printf("current=%d max=%d max_sb=%d alloc=%d\n", - current_frame_size, max_frame_size, max_sb, - bit_alloc[max_sb]); -#endif + av_dlog(NULL, "current=%d max=%d max_sb=%d alloc=%d\n", + current_frame_size, max_frame_size, max_sb, + bit_alloc[max_sb]); if (max_sb < 0) break; diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 8115df54fa..42c85874f6 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -152,10 +152,8 @@ static int mpegvideo_parse(AVCodecParserContext *s, to have the full timing information. The time take by this function should be negligible for uncorrupted streams */ mpegvideo_extract_headers(s, avctx, buf, buf_size); -#if 0 - printf("pict_type=%d frame_rate=%0.3f repeat_pict=%d\n", - s->pict_type, (double)avctx->time_base.den / avctx->time_base.num, s->repeat_pict); -#endif + av_dlog(NULL, "pict_type=%d frame_rate=%0.3f repeat_pict=%d\n", + s->pict_type, (double)avctx->time_base.den / avctx->time_base.num, s->repeat_pict); *poutbuf = buf; *poutbuf_size = buf_size; diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 4b3d30e51a..f00217399a 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -221,12 +221,11 @@ void av_parser_close(AVCodecParserContext *s) */ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size) { -#if 0 if(pc->overread){ - printf("overread %d, state:%X next:%d index:%d o_index:%d\n", pc->overread, pc->state, next, pc->index, pc->overread_index); - printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]); + av_dlog(pc, "overread %d, state:%X next:%d index:%d o_index:%d\n", + pc->overread, pc->state, next, pc->index, pc->overread_index); + av_dlog(pc, "%X %X %X %X\n", (*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]); } -#endif /* Copy overread bytes from last frame into buffer. */ for(; pc->overread>0; pc->overread--){ diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c index b3725eb0f2..d97282b7e7 100644 --- a/libavdevice/v4l.c +++ b/libavdevice/v4l.c @@ -149,14 +149,8 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) ioctl(video_fd, VIDIOCSAUDIO, &audio); ioctl(video_fd, VIDIOCGPICT, &pict); -#if 0 - printf("v4l: colour=%d hue=%d brightness=%d constrast=%d whiteness=%d\n", - pict.colour, - pict.hue, - pict.brightness, - pict.contrast, - pict.whiteness); -#endif + av_dlog(s1, "v4l: colour=%d hue=%d brightness=%d constrast=%d whiteness=%d\n", + pict.colour, pict.hue, pict.brightness, pict.contrast, pict.whiteness); /* try to choose a suitable video format */ pict.palette = desired_palette; pict.depth= desired_depth; diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 68b685cc29..0b663ab512 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -569,10 +569,9 @@ static int mpegps_read_packet(AVFormatContext *s, pkt->dts = dts; pkt->pos = dummy_pos; pkt->stream_index = st->index; -#if 0 - av_log(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f size=%d\n", - pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0, pkt->size); -#endif + av_dlog(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f size=%d\n", + pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0, + pkt->size); return 0; } diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 0e0164511a..28ca1cbd5b 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -662,10 +662,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, id = stream->id; -#if 0 - printf("packet ID=%2x PTS=%0.3f\n", - id, pts / 90000.0); -#endif + av_dlog(ctx, "packet ID=%2x PTS=%0.3f\n", id, pts / 90000.0); buf_ptr = buffer; @@ -1078,10 +1075,8 @@ retry: best_dts= pkt_desc->dts; } -#if 0 - av_log(ctx, AV_LOG_DEBUG, "bumping scr, scr:%f, dts:%f\n", - scr/90000.0, best_dts/90000.0); -#endif + av_dlog(ctx, AV_LOG_DEBUG, "bumping scr, scr:%f, dts:%f\n", + scr / 90000.0, best_dts / 90000.0); if(best_dts == INT64_MAX) return 0; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index d7f2c0c957..2ff6e55c57 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1538,10 +1538,8 @@ static int mpegts_read_header(AVFormatContext *s, s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr; st->codec->bit_rate = s->bit_rate; st->start_time = ts->cur_pcr; -#if 0 - av_log(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n", - st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr); -#endif + av_dlog(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n", + st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr); } avio_seek(pb, pos, SEEK_SET); diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 8d96320b3f..07969c816f 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -316,9 +316,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo int complete = 0; int segp = 0, psize = 0; -#if 0 - av_log (s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx); -#endif + av_dlog(s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx); do{ idx = ogg->curidx; @@ -330,11 +328,9 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo os = ogg->streams + idx; -#if 0 - av_log (s, AV_LOG_DEBUG, + av_dlog(s, AV_LOG_DEBUG, "ogg_packet: idx=%d pstart=%d psize=%d segp=%d nsegs=%d\n", idx, os->pstart, os->psize, os->segp, os->nsegs); -#endif if (!os->codec){ if (os->header < 0){ @@ -366,11 +362,9 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo } }while (!complete); -#if 0 - av_log (s, AV_LOG_DEBUG, + av_dlog(s, AV_LOG_DEBUG, "ogg_packet: idx %i, frame size %i, start %i\n", idx, os->psize, os->pstart); -#endif if (os->granule == -1) av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->page_pos); @@ -451,9 +445,7 @@ ogg_get_headers (AVFormatContext * s) return -1; }while (!ogg->headers); -#if 0 - av_log (s, AV_LOG_DEBUG, "found headers\n"); -#endif + av_dlog(s, AV_LOG_DEBUG, "found headers\n"); return 0; } diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index bcf55fddfa..843706dec3 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -414,15 +414,13 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) tag = avio_rl32(pb); tag_size = avio_rb32(pb); avio_rb16(pb); -#if 0 - printf("tag=%c%c%c%c (%08x) size=%d\n", - (tag) & 0xff, - (tag >> 8) & 0xff, - (tag >> 16) & 0xff, - (tag >> 24) & 0xff, - tag, - tag_size); -#endif + av_dlog(s, "tag=%c%c%c%c (%08x) size=%d\n", + (tag ) & 0xff, + (tag >> 8) & 0xff, + (tag >> 16) & 0xff, + (tag >> 24) & 0xff, + tag, + tag_size); if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A')) return -1; switch(tag) { diff --git a/libavformat/utils.c b/libavformat/utils.c index 88e9a49e87..6d6c8308ca 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1974,22 +1974,20 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset) } av_update_stream_timings(ic); -#if 0 { int i; AVStream *st; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; - printf("%d: start_time: %0.3f duration: %0.3f\n", - i, (double)st->start_time / AV_TIME_BASE, - (double)st->duration / AV_TIME_BASE); + av_dlog(ic, "%d: start_time: %0.3f duration: %0.3f\n", i, + (double) st->start_time / AV_TIME_BASE, + (double) st->duration / AV_TIME_BASE); } - printf("stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n", - (double)ic->start_time / AV_TIME_BASE, - (double)ic->duration / AV_TIME_BASE, - ic->bit_rate / 1000); + av_dlog(ic, "stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n", + (double) ic->start_time / AV_TIME_BASE, + (double) ic->duration / AV_TIME_BASE, + ic->bit_rate / 1000); } -#endif } static int has_codec_parameters(AVCodecContext *enc) From 03acaa4a43432d76d048986076f3aa725b64ab3d Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 26 Apr 2011 14:26:23 +0200 Subject: [PATCH 04/12] tests: Remove disabled code. --- tests/rotozoom.c | 8 -------- tests/tiny_psnr.c | 15 --------------- 2 files changed, 23 deletions(-) diff --git a/tests/rotozoom.c b/tests/rotozoom.c index 25f0e024a4..505072c4f9 100644 --- a/tests/rotozoom.c +++ b/tests/rotozoom.c @@ -222,15 +222,7 @@ static void gen_image(int num, int w, int h) for ( i=0 ; i>16)&255) + (((y>>16)&255)<<8); - put_pixel(i, j, tab_r[dep], tab_g[dep], tab_b[dep]); - } -#endif } } } diff --git a/tests/tiny_psnr.c b/tests/tiny_psnr.c index efa5e01a99..2bdb4391cf 100644 --- a/tests/tiny_psnr.c +++ b/tests/tiny_psnr.c @@ -52,21 +52,6 @@ uint64_t exp16_table[21]={ 582360139072LL, }; -#if 0 -// 16.16 fixpoint exp() -static unsigned int exp16(unsigned int a){ - int i; - int out= 1<<16; - - for(i=19;i>=0;i--){ - if(a&(1<>16; - } - - return out; -} -#endif - // 16.16 fixpoint log() static int64_t log16(uint64_t a){ int i; From 09cbf60f8eec65cc53c5931234476a9956cc27fd Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 29 Apr 2011 19:18:46 +0200 Subject: [PATCH 05/12] Replace more disabled printf() calls by av_dlog(). --- libavcodec/motion_est.c | 6 ++---- libavcodec/parser.c | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 8e85219ce3..b410c959fc 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -1119,10 +1119,8 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, // pic->mb_cmp_score[s->mb_stride * mb_y + mb_x] = dmin; c->mc_mb_var_sum_temp += (vard+128)>>8; -#if 0 - printf("varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n", - varc, s->avg_mb_var, sum, vard, mx - xx, my - yy); -#endif + av_dlog(s, "varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n", + varc, s->avg_mb_var, sum, vard, mx - xx, my - yy); if(mb_type){ int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20; diff --git a/libavcodec/parser.c b/libavcodec/parser.c index f00217399a..d1f454f722 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -273,12 +273,11 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s pc->overread++; } -#if 0 if(pc->overread){ - printf("overread %d, state:%X next:%d index:%d o_index:%d\n", pc->overread, pc->state, next, pc->index, pc->overread_index); - printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]); + av_dlog(pc, "overread %d, state:%X next:%d index:%d o_index:%d\n", + pc->overread, pc->state, next, pc->index, pc->overread_index); + av_dlog(pc, "%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]); } -#endif return 0; } From 2e15305b7088c9dfe1c8d29c248a9b49bcf0b0a3 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 29 Apr 2011 19:05:40 +0200 Subject: [PATCH 06/12] Remove some disabled printf debug cruft. --- ffmpeg.c | 1 - libavcodec/asv1.c | 11 ---------- libavcodec/dct-test.c | 19 ----------------- libavcodec/dsputil.c | 7 ------- libavcodec/h263dec.c | 8 -------- libavcodec/h264.c | 10 --------- libavcodec/huffyuv.c | 5 ----- libavcodec/motion_est_template.c | 35 -------------------------------- libavcodec/mpeg12enc.c | 4 ---- libavcodec/mpegaudioenc.c | 15 -------------- libavcodec/msmpeg4.c | 15 -------------- libavcodec/ratecontrol.c | 8 -------- libavcodec/rv10.c | 17 ---------------- libavcodec/svq1dec.c | 13 ------------ libavcodec/wmadec.c | 9 -------- libavcodec/wmv2dec.c | 14 ------------- libavformat/ffmdec.c | 3 --- libavformat/mpegts.c | 3 --- 18 files changed, 197 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index d3a85dde89..050fa98f1f 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3212,7 +3212,6 @@ static void opt_input_file(const char *filename) case AVMEDIA_TYPE_AUDIO: input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(audio_codec_name); set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM, input_codecs[nb_input_codecs-1]); - //fprintf(stderr, "\nInput Audio channels: %d", dec->channels); channel_layout = dec->channel_layout; audio_channels = dec->channels; audio_sample_rate = dec->sample_rate; diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c index cb07771718..8171945e40 100644 --- a/libavcodec/asv1.c +++ b/libavcodec/asv1.c @@ -450,17 +450,6 @@ static int decode_frame(AVCodecContext *avctx, idct_put(a, mb_x, mb_y); } } -#if 0 -int i; -printf("%d %d\n", 8*buf_size, get_bits_count(&a->gb)); -for(i=get_bits_count(&a->gb); i<8*buf_size; i++){ - printf("%d", get_bits1(&a->gb)); -} - -for(i=0; iavctx->extradata_size; i++){ - printf("%c\n", ((uint8_t*)s->avctx->extradata)[i]); -} -#endif *picture= *(AVFrame*)&a->picture; *data_size = sizeof(AVPicture); diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c index c3c376e79f..d0fe34e1d7 100644 --- a/libavcodec/dct-test.c +++ b/libavcodec/dct-test.c @@ -493,25 +493,6 @@ static void idct248_error(const char *name, if (v > err_max) err_max = v; } -#if 0 - printf("ref=\n"); - for(i=0;i<8;i++) { - int j; - for(j=0;j<8;j++) { - printf(" %3d", img_dest1[i*8+j]); - } - printf("\n"); - } - - printf("out=\n"); - for(i=0;i<8;i++) { - int j; - for(j=0;j<8;j++) { - printf(" %3d", img_dest[i*8+j]); - } - printf("\n"); - } -#endif } printf("%s %s: err_inf=%d\n", 1 ? "IDCT248" : "DCT248", diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index dbfc8ce162..32472b1a74 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -3327,13 +3327,6 @@ static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t +BUTTERFLYA(temp[8*2+i], temp[8*6+i]) +BUTTERFLYA(temp[8*3+i], temp[8*7+i]); } -#if 0 -static int maxi=0; -if(sum>maxi){ - maxi=sum; - printf("MAX:%d\n", maxi); -} -#endif return sum; } diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index afc7c9035a..934c952449 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -552,14 +552,6 @@ retry: s->workaround_bugs, s->lavc_build, s->xvid_build, s->divx_version, s->divx_build, s->divx_packed ? "p" : ""); -#if 0 // dump bits per frame / qp / complexity -{ - static FILE *f=NULL; - if(!f) f=fopen("rate_qp_cplx.txt", "w"); - fprintf(f, "%d %d %f\n", buf_size, s->qscale, buf_size*(double)s->qscale); -} -#endif - #if HAVE_MMX if (s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) { avctx->idct_algo= FF_IDCT_XVIDMMX; diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 264afe5b4e..a59f121108 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -152,10 +152,6 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_l h->nal_unit_type= src[0]&0x1F; src++; length--; -#if 0 - for(i=0; iis_avc ? 0 : buf_size; h->max_contexts = avctx->thread_count; -#if 0 - int i; - for(i=0; i<50; i++){ - av_log(NULL, AV_LOG_ERROR,"%02X ", buf[i]); - } -#endif if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){ h->current_slice = 0; if (!s->first_field) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 183ce0ea74..bdfbf88ed0 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -352,11 +352,6 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){ if(generate_bits_table(s->bits[i], s->len[i])<0){ return -1; } -#if 0 -for(j=0; j<256; j++){ -printf("%6X, %2d, %3d\n", s->bits[i][j], s->len[i][j], j); -} -#endif free_vlc(&s->vlc[i]); init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); } diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c index 09ec9f79c4..45e87a0bec 100644 --- a/libavcodec/motion_est_template.c +++ b/libavcodec/motion_est_template.c @@ -632,25 +632,6 @@ static int funny_diamond_search(MpegEncContext * s, int *best, int dmin, if(x!=best[0] || y!=best[1]) dia_size=0; -#if 0 -{ -int dx, dy, i; -static int stats[8*8]; -dx= FFABS(x-best[0]); -dy= FFABS(y-best[1]); -if(dy>dx){ - dx^=dy; dy^=dx; dx^=dy; -} -stats[dy*8 + dx] ++; -if(256*256*256*64 % (stats[0]+1)==0){ - for(i=0; i<64; i++){ - if((i&7)==0) printf("\n"); - printf("%8d ", stats[i]); - } - printf("\n"); -} -} -#endif } return dmin; } @@ -983,22 +964,6 @@ static int var_diamond_search(MpegEncContext * s, int *best, int dmin, if(x!=best[0] || y!=best[1]) dia_size=0; -#if 0 -{ -int dx, dy, i; -static int stats[8*8]; -dx= FFABS(x-best[0]); -dy= FFABS(y-best[1]); -stats[dy*8 + dx] ++; -if(256*256*256*64 % (stats[0]+1)==0){ - for(i=0; i<64; i++){ - if((i&7)==0) printf("\n"); - printf("%6d ", stats[i]); - } - printf("\n"); -} -} -#endif } return dmin; } diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 5e9b2ba3b1..c7f2f76410 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -888,10 +888,6 @@ static void mpeg1_encode_block(MpegEncContext *s, j = s->intra_scantable.permutated[i]; level = block[j]; next_coef: -#if 0 - if (level != 0) - av_dlog(s->avctx, "level[%d]=%d\n", i, level); -#endif /* encode using VLC */ if (level != 0) { run = i - last_non_zero - 1; diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 9659757ff8..65fac2ad29 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -585,13 +585,6 @@ static void compute_bit_allocation(MpegAudioContext *s, } *padding = max_frame_size - current_frame_size; assert(*padding >= 0); - -#if 0 - for(i=0;isblimit;i++) { - printf("%d ", bit_alloc[i]); - } - printf("\n"); -#endif } /* @@ -713,15 +706,7 @@ static void encode_frame(MpegAudioContext *s, /* group the 3 values to save bits */ put_bits(p, -bits, q[0] + steps * (q[1] + steps * q[2])); -#if 0 - printf("%d: gr1 %d\n", - i, q[0] + steps * (q[1] + steps * q[2])); -#endif } else { -#if 0 - printf("%d: gr3 %d %d %d\n", - i, q[0], q[1], q[2]); -#endif put_bits(p, bits, q[0]); put_bits(p, bits, q[1]); put_bits(p, bits, q[2]); diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 85713b5d40..053e1005d2 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -617,10 +617,6 @@ void msmpeg4_encode_mb(MpegEncContext * s, } coded_cbp |= val << (5 - i); } -#if 0 - if (coded_cbp) - printf("cbp=%x %x\n", cbp, coded_cbp); -#endif if(s->msmpeg4_version<=2){ if (s->pict_type == FF_I_TYPE) { @@ -1383,17 +1379,6 @@ int msmpeg4_decode_picture_header(MpegEncContext * s) { int code; -#if 0 -{ -int i; -for(i=0; igb.size_in_bits; i++) - av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); -// get_bits1(&s->gb); -av_log(s->avctx, AV_LOG_DEBUG, "END\n"); -return -1; -} -#endif - if(s->msmpeg4_version==1){ int start_code = get_bits_long(&s->gb, 32); if(start_code!=0x00000100){ diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 380e3548a7..e22d62e864 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -806,14 +806,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) rcc->last_mc_mb_var_sum= pic->mc_mb_var_sum; rcc->last_mb_var_sum= pic->mb_var_sum; } -#if 0 -{ - static int mvsum=0, texsum=0; - mvsum += s->mv_bits; - texsum += s->i_tex_bits + s->p_tex_bits; - printf("%d %d//\n\n", mvsum, texsum); -} -#endif return q; } diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 5df162b14c..4af1fd0574 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -293,23 +293,6 @@ static int rv20_decode_picture_header(MpegEncContext *s) { int seq, mb_pos, i; -#if 0 - GetBitContext gb= s->gb; - for(i=0; i<64; i++){ - av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb)); - if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); - } - av_log(s->avctx, AV_LOG_DEBUG, "\n"); -#endif -#if 0 - av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4); - for(i=0; iavctx->extradata_size; i++){ - av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[i]); - if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); - } - av_log(s->avctx, AV_LOG_DEBUG, "\n"); -#endif - if(s->avctx->sub_id == 0x30202002 || s->avctx->sub_id == 0x30203002){ if (get_bits(&s->gb, 3)){ av_log(s->avctx, AV_LOG_ERROR, "unknown triplet set\n"); diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c index 444785aa88..256a29867f 100644 --- a/libavcodec/svq1dec.c +++ b/libavcodec/svq1dec.c @@ -378,13 +378,6 @@ static int svq1_motion_inter_block (MpegEncContext *s, GetBitContext *bitbuf, if(x + (mv.x >> 1)<0) mv.x= 0; -#if 0 - int w= (s->width+15)&~15; - int h= (s->height+15)&~15; - if(x + (mv.x >> 1)<0 || y + (mv.y >> 1)<0 || x + (mv.x >> 1) + 16 > w || y + (mv.y >> 1) + 16> h) - av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mv.x >> 1), y + (mv.y >> 1)); -#endif - src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch]; dst = current; @@ -461,12 +454,6 @@ static int svq1_motion_inter_4v_block (MpegEncContext *s, GetBitContext *bitbuf, if(x + (mvx >> 1)<0) mvx= 0; -#if 0 - int w= (s->width+15)&~15; - int h= (s->height+15)&~15; - if(x + (mvx >> 1)<0 || y + (mvy >> 1)<0 || x + (mvx >> 1) + 8 > w || y + (mvy >> 1) + 8> h) - av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mvx >> 1), y + (mvy >> 1)); -#endif src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1))*pitch]; dst = current; diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index f6ed26cb59..479b34c3e0 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -178,15 +178,6 @@ static void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len) s->lsp_pow_m_table2[i] = b - a; b = a; } -#if 0 - for(i=1;i<20;i++) { - float v, r1, r2; - v = 5.0 / i; - r1 = pow_m1_4(s, v); - r2 = pow(v,-0.25); - printf("%f^-0.25=%f e=%f\n", v, r1, r2 - r1); - } -#endif } /** diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index 578cce9200..10fdde7093 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -116,16 +116,6 @@ int ff_wmv2_decode_picture_header(MpegEncContext * s) Wmv2Context * const w= (Wmv2Context*)s; int code; -#if 0 -{ -int i; -for(i=0; igb.size*8; i++) - printf("%d", get_bits1(&s->gb)); -// get_bits1(&s->gb); -printf("END\n"); -return -1; -} -#endif if(s->picture_number==0) decode_ext_header(w); @@ -316,10 +306,6 @@ static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n, if(w->per_block_abt) w->abt_type= decode012(&s->gb); -#if 0 - if(w->per_block_abt) - printf("B%d", w->abt_type); -#endif w->abt_type_table[n]= w->abt_type; if(w->abt_type){ diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 6cd2b51392..8a6226a104 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -417,9 +417,6 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) if (ffm->header[1] & FLAG_DTS) if (ffm_read_data(s, ffm->header+16, 4, 1) != 4) return -1; -#if 0 - av_hexdump_log(s, AV_LOG_DEBUG, ffm->header, FRAME_HEADER_SIZE); -#endif ffm->read_state = READ_DATA; /* fall thru */ case READ_DATA: diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 2ff6e55c57..3130eb9ff5 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -662,9 +662,6 @@ static int mpegts_push_data(MpegTSFilter *filter, if (pes->data_index == PES_START_SIZE) { /* we got all the PES or section header. We can now decide */ -#if 0 - av_hex_dump_log(pes->stream, AV_LOG_DEBUG, pes->header, pes->data_index); -#endif if (pes->header[0] == 0x00 && pes->header[1] == 0x00 && pes->header[2] == 0x01) { /* it must be an mpeg2 PES stream */ From e610098e7b3e4851e18c4f472adec4980f901ad2 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 29 Apr 2011 19:36:48 +0200 Subject: [PATCH 07/12] bswap.h: Remove disabled code. --- libavutil/bswap.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libavutil/bswap.h b/libavutil/bswap.h index c93825f6ee..3657ccd402 100644 --- a/libavutil/bswap.h +++ b/libavutil/bswap.h @@ -74,11 +74,6 @@ static av_always_inline av_const uint32_t av_bswap32(uint32_t x) #ifndef av_bswap64 static inline uint64_t av_const av_bswap64(uint64_t x) { -#if 0 - x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); - x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL); - return (x>>32) | (x<<32); -#else union { uint64_t ll; uint32_t l[2]; @@ -87,7 +82,6 @@ static inline uint64_t av_const av_bswap64(uint64_t x) r.l[0] = av_bswap32 (w.l[1]); r.l[1] = av_bswap32 (w.l[0]); return r.ll; -#endif } #endif From a734fa575f94c7c28103420f756b5f64dd0c806b Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 29 Apr 2011 19:46:10 +0200 Subject: [PATCH 08/12] Remove disabled non-optimized code variants. --- libavcodec/sh4/idct_sh4.c | 151 ------------------------ libavcodec/x86/mpegvideo_mmx_template.c | 11 -- 2 files changed, 162 deletions(-) diff --git a/libavcodec/sh4/idct_sh4.c b/libavcodec/sh4/idct_sh4.c index 0758cd9bd7..0baff396e0 100644 --- a/libavcodec/sh4/idct_sh4.c +++ b/libavcodec/sh4/idct_sh4.c @@ -54,8 +54,6 @@ static const float odd_table[] __attribute__ ((aligned(8))) = { #undef c6 #undef c7 -#if 1 - #define load_matrix(table) \ do { \ const float *t = table; \ @@ -84,52 +82,11 @@ static const float odd_table[] __attribute__ ((aligned(8))) = { register float fr2 __asm__("fr2"); \ register float fr3 __asm__("fr3") -#else - -/* generic C code for check */ - -static void ftrv_(const float xf[],float fv[]) -{ - float f0,f1,f2,f3; - f0 = fv[0]; - f1 = fv[1]; - f2 = fv[2]; - f3 = fv[3]; - fv[0] = xf[0]*f0 + xf[4]*f1 + xf[ 8]*f2 + xf[12]*f3; - fv[1] = xf[1]*f0 + xf[5]*f1 + xf[ 9]*f2 + xf[13]*f3; - fv[2] = xf[2]*f0 + xf[6]*f1 + xf[10]*f2 + xf[14]*f3; - fv[3] = xf[3]*f0 + xf[7]*f1 + xf[11]*f2 + xf[15]*f3; -} - -static void load_matrix_(float xf[],const float table[]) -{ - int i; - for(i=0;i<16;i++) xf[i]=table[i]; -} - -#define ftrv() ftrv_(xf,fv) -#define load_matrix(table) load_matrix_(xf,table) - -#define DEFREG \ - float fv[4],xf[16] - -#define fr0 fv[0] -#define fr1 fv[1] -#define fr2 fv[2] -#define fr3 fv[3] - -#endif - -#if 1 #define DESCALE(x,n) (x)*(1.0f/(1<<(n))) -#else -#define DESCALE(x,n) (((int)(x)+(1<<(n-1)))>>(n)) -#endif /* this code work worse on gcc cvs. 3.2.3 work fine */ -#if 1 //optimized void idct_sh4(DCTELEM *block) @@ -252,111 +209,3 @@ void idct_sh4(DCTELEM *block) fp_single_leave(fpscr); } -#else -void idct_sh4(DCTELEM *block) -{ - DEFREG; - - int i; - float tblock[8*8],*fblock; - - /* row */ - - /* even part */ - load_matrix(even_table); - - fblock = tblock; - i = 8; - do { - fr0 = block[0]; - fr1 = block[2]; - fr2 = block[4]; - fr3 = block[6]; - block+=8; - ftrv(); - fblock[0] = fr0; - fblock[2] = fr1; - fblock[4] = fr2; - fblock[6] = fr3; - fblock+=8; - } while(--i); - block-=8*8; - fblock-=8*8; - - load_matrix(odd_table); - - i = 8; - - do { - float t0,t1,t2,t3; - fr0 = block[1]; - fr1 = block[3]; - fr2 = block[5]; - fr3 = block[7]; - block+=8; - ftrv(); - t0 = fblock[0]; - t1 = fblock[2]; - t2 = fblock[4]; - t3 = fblock[6]; - fblock[0] = t0 + fr0; - fblock[7] = t0 - fr0; - fblock[1] = t1 + fr1; - fblock[6] = t1 - fr1; - fblock[2] = t2 + fr2; - fblock[5] = t2 - fr2; - fblock[3] = t3 + fr3; - fblock[4] = t3 - fr3; - fblock+=8; - } while(--i); - block-=8*8; - fblock-=8*8; - - /* col */ - - /* even part */ - load_matrix(even_table); - - i = 8; - - do { - fr0 = fblock[8*0]; - fr1 = fblock[8*2]; - fr2 = fblock[8*4]; - fr3 = fblock[8*6]; - ftrv(); - fblock[8*0] = fr0; - fblock[8*2] = fr1; - fblock[8*4] = fr2; - fblock[8*6] = fr3; - fblock++; - } while(--i); - fblock-=8; - - load_matrix(odd_table); - - i=8; - do { - float t0,t1,t2,t3; - fr0 = fblock[8*1]; - fr1 = fblock[8*3]; - fr2 = fblock[8*5]; - fr3 = fblock[8*7]; - ftrv(); - t0 = fblock[8*0]; - t1 = fblock[8*2]; - t2 = fblock[8*4]; - t3 = fblock[8*6]; - fblock++; - block[8*0] = DESCALE(t0 + fr0,3); - block[8*7] = DESCALE(t0 - fr0,3); - block[8*1] = DESCALE(t1 + fr1,3); - block[8*6] = DESCALE(t1 - fr1,3); - block[8*2] = DESCALE(t2 + fr2,3); - block[8*5] = DESCALE(t2 - fr2,3); - block[8*3] = DESCALE(t3 + fr3,3); - block[8*4] = DESCALE(t3 - fr3,3); - block++; - } while(--i); -} -#endif diff --git a/libavcodec/x86/mpegvideo_mmx_template.c b/libavcodec/x86/mpegvideo_mmx_template.c index ddda07afa7..0f01cb24b9 100644 --- a/libavcodec/x86/mpegvideo_mmx_template.c +++ b/libavcodec/x86/mpegvideo_mmx_template.c @@ -116,22 +116,11 @@ static int RENAME(dct_quantize)(MpegEncContext *s, q = s->c_dc_scale; /* note: block[0] is assumed to be positive */ if (!s->h263_aic) { -#if 1 __asm__ volatile ( "mul %%ecx \n\t" : "=d" (level), "=a"(dummy) : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1]) ); -#else - __asm__ volatile ( - "xorl %%edx, %%edx \n\t" - "divw %%cx \n\t" - "movzwl %%ax, %%eax \n\t" - : "=a" (level) - : "a" ((block[0]>>2) + q), "c" (q<<1) - : "%edx" - ); -#endif } else /* For AIC we skip quant/dequant of INTRADC */ level = (block[0] + 4)>>3; From cf3ac54339c42530342ec053b981d7b717404889 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 29 Apr 2011 20:12:48 +0200 Subject: [PATCH 09/12] vorbis: Replace sized int_fast integer types with plain int/unsigned. int/unsigned is the natural memory access type for CPUs, using sized types for temporary variables, counters and similar just increases code size and can possibly cause a slowdown. --- libavcodec/vorbis.c | 9 +- libavcodec/vorbis.h | 2 +- libavcodec/vorbisdec.c | 227 ++++++++++++++++++++--------------------- 3 files changed, 113 insertions(+), 125 deletions(-) diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c index d576a2035b..1a4d613ac8 100644 --- a/libavcodec/vorbis.c +++ b/libavcodec/vorbis.c @@ -51,14 +51,13 @@ unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) // the two bits[p] > 32 checks should be redundant, all calling code should // already ensure that, but since it allows overwriting the stack it seems // reasonable to check redundantly. -int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num) +int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num) { uint_fast32_t exit_at_level[33] = { 404, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint_fast8_t i, j; - uint_fast32_t code, p; + unsigned i, j, p, code; #ifdef V_DEBUG GetBitContext gb; @@ -78,8 +77,8 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num) exit_at_level[i+1] = 1 << i; #ifdef V_DEBUG - av_log(NULL, AV_LOG_INFO, " %d. of %d code len %d code %d - ", p, num, bits[p], codes[p]); - init_get_bits(&gb, (uint_fast8_t *)&codes[p], bits[p]); + av_log(NULL, AV_LOG_INFO, " %u. of %u code len %d code %d - ", p, num, bits[p], codes[p]); + init_get_bits(&gb, (uint8_t *)&codes[p], bits[p]); for (i = 0; i < bits[p]; ++i) av_log(NULL, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0"); av_log(NULL, AV_LOG_INFO, "\n"); diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h index e4754553f0..f36d26abc4 100644 --- a/libavcodec/vorbis.h +++ b/libavcodec/vorbis.h @@ -38,7 +38,7 @@ typedef struct { void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values); unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n) -int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num); +int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num); void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values, uint_fast16_t * y_list, int * flag, int multiplier, float * out, int samples); diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index c70bd75fed..6c912f0019 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -177,7 +177,7 @@ static const char idx_err_str[] = "Index value %d out of range (0 - %d) for %s a VALIDATE_INDEX(idx, limit)\ } -static float vorbisfloat2float(uint_fast32_t val) +static float vorbisfloat2float(unsigned val) { double mant = val & 0x1fffff; long exp = (val & 0x7fe00000L) >> 21; @@ -191,7 +191,7 @@ static float vorbisfloat2float(uint_fast32_t val) static void vorbis_free(vorbis_context *vc) { - int_fast16_t i; + int i; av_freep(&vc->channel_residues); av_freep(&vc->channel_floors); @@ -237,7 +237,7 @@ static void vorbis_free(vorbis_context *vc) static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) { - uint_fast16_t cb; + unsigned cb; uint8_t *tmp_vlc_bits; uint32_t *tmp_vlc_codes; GetBitContext *gb = &vc->gb; @@ -254,36 +254,39 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) for (cb = 0; cb < vc->codebook_count; ++cb) { vorbis_codebook *codebook_setup = &vc->codebooks[cb]; - uint_fast8_t ordered; - uint_fast32_t t, used_entries = 0; - uint_fast32_t entries; + unsigned ordered, t, entries, used_entries = 0; - AV_DEBUG(" %d. Codebook \n", cb); + AV_DEBUG(" %u. Codebook\n", cb); if (get_bits(gb, 24) != 0x564342) { - av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook setup data corrupt. \n", cb); + av_log(vc->avccontext, AV_LOG_ERROR, + " %u. Codebook setup data corrupt.\n", cb); goto error; } codebook_setup->dimensions=get_bits(gb, 16); if (codebook_setup->dimensions > 16 || codebook_setup->dimensions == 0) { - av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook's dimension is invalid (%d). \n", cb, codebook_setup->dimensions); + av_log(vc->avccontext, AV_LOG_ERROR, + " %u. Codebook's dimension is invalid (%d).\n", + cb, codebook_setup->dimensions); goto error; } entries = get_bits(gb, 24); if (entries > V_MAX_VLCS) { - av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook has too many entries (%"PRIdFAST32"). \n", cb, entries); + av_log(vc->avccontext, AV_LOG_ERROR, + " %u. Codebook has too many entries (%u).\n", + cb, entries); goto error; } ordered = get_bits1(gb); - AV_DEBUG(" codebook_dimensions %d, codebook_entries %d \n", codebook_setup->dimensions, entries); + AV_DEBUG(" codebook_dimensions %d, codebook_entries %u\n", + codebook_setup->dimensions, entries); if (!ordered) { - uint_fast16_t ce; - uint_fast8_t flag; - uint_fast8_t sparse = get_bits1(gb); + unsigned ce, flag; + unsigned sparse = get_bits1(gb); AV_DEBUG(" not ordered \n"); @@ -307,20 +310,20 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) tmp_vlc_bits[ce] = get_bits(gb, 5) + 1; } } else { - uint_fast16_t current_entry = 0; - uint_fast8_t current_length = get_bits(gb, 5)+1; + unsigned current_entry = 0; + unsigned current_length = get_bits(gb, 5) + 1; - AV_DEBUG(" ordered, current length: %d \n", current_length); //FIXME + AV_DEBUG(" ordered, current length: %u\n", current_length); //FIXME used_entries = entries; for (; current_entry < used_entries && current_length <= 32; ++current_length) { - uint_fast16_t i, number; + unsigned i, number; - AV_DEBUG(" number bits: %d ", ilog(entries - current_entry)); + AV_DEBUG(" number bits: %u ", ilog(entries - current_entry)); number = get_bits(gb, ilog(entries - current_entry)); - AV_DEBUG(" number: %d \n", number); + AV_DEBUG(" number: %u\n", number); for (i = current_entry; i < number+current_entry; ++i) if (i < used_entries) @@ -341,13 +344,13 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) // If the codebook is used for (inverse) VQ, calculate codevectors. if (codebook_setup->lookup_type == 1) { - uint_fast16_t i, j, k; - uint_fast16_t codebook_lookup_values = ff_vorbis_nth_root(entries, codebook_setup->dimensions); + unsigned i, j, k; + unsigned codebook_lookup_values = ff_vorbis_nth_root(entries, codebook_setup->dimensions); float codebook_minimum_value = vorbisfloat2float(get_bits_long(gb, 32)); float codebook_delta_value = vorbisfloat2float(get_bits_long(gb, 32)); - uint_fast8_t codebook_value_bits = get_bits(gb, 4)+1; - uint_fast8_t codebook_sequence_p = get_bits1(gb); + unsigned codebook_value_bits = get_bits(gb, 4) + 1; + unsigned codebook_sequence_p = get_bits1(gb); AV_DEBUG(" We expect %d numbers for building the codevectors. \n", codebook_lookup_values); AV_DEBUG(" delta %f minmum %f \n", codebook_delta_value, codebook_minimum_value); @@ -365,18 +368,18 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) sizeof(*codebook_setup->codevectors)) : NULL; for (j = 0, i = 0; i < entries; ++i) { - uint_fast8_t dim = codebook_setup->dimensions; + unsigned dim = codebook_setup->dimensions; if (tmp_vlc_bits[i]) { float last = 0.0; - uint_fast32_t lookup_offset = i; + unsigned lookup_offset = i; #ifdef V_DEBUG - av_log(vc->avccontext, AV_LOG_INFO, "Lookup offset %d ,", i); + av_log(vc->avccontext, AV_LOG_INFO, "Lookup offset %u ,", i); #endif for (k = 0; k < dim; ++k) { - uint_fast32_t multiplicand_offset = lookup_offset % codebook_lookup_values; + unsigned multiplicand_offset = lookup_offset % codebook_lookup_values; codebook_setup->codevectors[j * dim + k] = codebook_multiplicands[multiplicand_offset] * codebook_delta_value + codebook_minimum_value + last; if (codebook_sequence_p) last = codebook_setup->codevectors[j * dim + k]; @@ -385,7 +388,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) tmp_vlc_bits[j] = tmp_vlc_bits[i]; #ifdef V_DEBUG - av_log(vc->avccontext, AV_LOG_INFO, "real lookup offset %d, vector: ", j); + av_log(vc->avccontext, AV_LOG_INFO, "real lookup offset %u, vector: ", j); for (k = 0; k < dim; ++k) av_log(vc->avccontext, AV_LOG_INFO, " %f ", codebook_setup->codevectors[j * dim + k]); av_log(vc->avccontext, AV_LOG_INFO, "\n"); @@ -445,13 +448,13 @@ error: static int vorbis_parse_setup_hdr_tdtransforms(vorbis_context *vc) { GetBitContext *gb = &vc->gb; - uint_fast8_t i; - uint_fast8_t vorbis_time_count = get_bits(gb, 6) + 1; + unsigned i, vorbis_time_count = get_bits(gb, 6) + 1; for (i = 0; i < vorbis_time_count; ++i) { - uint_fast16_t vorbis_tdtransform = get_bits(gb, 16); + unsigned vorbis_tdtransform = get_bits(gb, 16); - AV_DEBUG(" Vorbis time domain transform %d: %d \n", vorbis_time_count, vorbis_tdtransform); + AV_DEBUG(" Vorbis time domain transform %u: %u\n", + vorbis_time_count, vorbis_tdtransform); if (vorbis_tdtransform) { av_log(vc->avccontext, AV_LOG_ERROR, "Vorbis time domain transform data nonzero. \n"); @@ -465,7 +468,7 @@ static int vorbis_parse_setup_hdr_tdtransforms(vorbis_context *vc) static int vorbis_floor0_decode(vorbis_context *vc, vorbis_floor_data *vfu, float *vec); -static void create_map(vorbis_context *vc, uint_fast8_t floor_number); +static void create_map(vorbis_context *vc, unsigned floor_number); static int vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *vfu, float *vec); static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) @@ -486,9 +489,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) if (floor_setup->floor_type == 1) { int maximum_class = -1; - uint_fast8_t rangebits; - uint_fast32_t rangemax; - uint_fast16_t floor1_values = 2; + unsigned rangebits, rangemax, floor1_values = 2; floor_setup->decode = vorbis_floor1_decode; @@ -543,7 +544,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) rangemax = (1 << rangebits); if (rangemax > vc->blocksize[1] / 2) { av_log(vc->avccontext, AV_LOG_ERROR, - "Floor value is too large for blocksize: %"PRIuFAST32" (%"PRIuFAST32")\n", + "Floor value is too large for blocksize: %u (%"PRIuFAST32")\n", rangemax, vc->blocksize[1] / 2); return -1; } @@ -554,14 +555,15 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) for (k = 0; k < floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]]; ++k, ++floor1_values) { floor_setup->data.t1.list[floor1_values].x = get_bits(gb, rangebits); - AV_DEBUG(" %d. floor1 Y coord. %d \n", floor1_values, floor_setup->data.t1.list[floor1_values].x); + AV_DEBUG(" %u. floor1 Y coord. %d\n", floor1_values, + floor_setup->data.t1.list[floor1_values].x); } } // Precalculate order of x coordinates - needed for decode ff_vorbis_ready_floor1_list(floor_setup->data.t1.list, floor_setup->data.t1.x_list_dim); } else if (floor_setup->floor_type == 0) { - uint_fast8_t max_codebook_dim = 0; + unsigned max_codebook_dim = 0; floor_setup->decode = vorbis_floor0_decode; @@ -587,7 +589,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) /* read book indexes */ { int idx; - uint_fast8_t book_idx; + unsigned book_idx; for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) { GET_VALIDATED_INDEX(book_idx, 8, vc->codebook_count) floor_setup->data.t0.book_list[idx] = book_idx; @@ -641,7 +643,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) static int vorbis_parse_setup_hdr_residues(vorbis_context *vc) { GetBitContext *gb = &vc->gb; - uint_fast8_t i, j, k; + unsigned i, j, k; vc->residue_count = get_bits(gb, 6)+1; vc->residues = av_mallocz(vc->residue_count * sizeof(*vc->residues)); @@ -651,12 +653,11 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc) for (i = 0; i < vc->residue_count; ++i) { vorbis_residue *res_setup = &vc->residues[i]; uint_fast8_t cascade[64]; - uint_fast8_t high_bits; - uint_fast8_t low_bits; + unsigned high_bits, low_bits; res_setup->type = get_bits(gb, 16); - AV_DEBUG(" %d. residue type %d \n", i, res_setup->type); + AV_DEBUG(" %u. residue type %d\n", i, res_setup->type); res_setup->begin = get_bits(gb, 24); res_setup->end = get_bits(gb, 24); @@ -690,7 +691,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc) high_bits = get_bits(gb, 5); cascade[j] = (high_bits << 3) + low_bits; - AV_DEBUG(" %d class casscade depth: %d \n", j, ilog(cascade[j])); + AV_DEBUG(" %u class cascade depth: %d\n", j, ilog(cascade[j])); } res_setup->maxpass = 0; @@ -699,7 +700,8 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc) if (cascade[j]&(1 << k)) { GET_VALIDATED_INDEX(res_setup->books[j][k], 8, vc->codebook_count) - AV_DEBUG(" %d class casscade depth %d book: %d \n", j, k, res_setup->books[j][k]); + AV_DEBUG(" %u class cascade depth %u book: %d\n", + j, k, res_setup->books[j][k]); if (k>res_setup->maxpass) res_setup->maxpass = k; @@ -717,7 +719,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc) static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) { GetBitContext *gb = &vc->gb; - uint_fast8_t i, j; + unsigned i, j; vc->mapping_count = get_bits(gb, 6)+1; vc->mappings = av_mallocz(vc->mapping_count * sizeof(*vc->mappings)); @@ -751,10 +753,11 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) mapping_setup->coupling_steps = 0; } - AV_DEBUG(" %d mapping coupling steps: %d \n", i, mapping_setup->coupling_steps); + AV_DEBUG(" %u mapping coupling steps: %d\n", + i, mapping_setup->coupling_steps); if (get_bits(gb, 2)) { - av_log(vc->avccontext, AV_LOG_ERROR, "%d. mapping setup data invalid. \n", i); + av_log(vc->avccontext, AV_LOG_ERROR, "%u. mapping setup data invalid.\n", i); return -1; // following spec. } @@ -770,7 +773,10 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) GET_VALIDATED_INDEX(mapping_setup->submap_floor[j], 8, vc->floor_count) GET_VALIDATED_INDEX(mapping_setup->submap_residue[j], 8, vc->residue_count) - AV_DEBUG(" %d mapping %d submap : floor %d, residue %d \n", i, j, mapping_setup->submap_floor[j], mapping_setup->submap_residue[j]); + AV_DEBUG(" %u mapping %u submap : floor %d, residue %d\n", + i, j, + mapping_setup->submap_floor[j], + mapping_setup->submap_residue[j]); } } return 0; @@ -778,14 +784,13 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) // Process modes part -static void create_map(vorbis_context *vc, uint_fast8_t floor_number) +static void create_map(vorbis_context *vc, unsigned floor_number) { vorbis_floor *floors = vc->floors; vorbis_floor0 *vf; int idx; - int_fast8_t blockflag; + int blockflag, n; int_fast32_t *map; - int_fast32_t n; //TODO: could theoretically be smaller? for (blockflag = 0; blockflag < 2; ++blockflag) { n = vc->blocksize[blockflag] / 2; @@ -817,7 +822,7 @@ static void create_map(vorbis_context *vc, uint_fast8_t floor_number) static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) { GetBitContext *gb = &vc->gb; - uint_fast8_t i; + unsigned i; vc->mode_count = get_bits(gb, 6) + 1; vc->modes = av_mallocz(vc->mode_count * sizeof(*vc->modes)); @@ -832,7 +837,9 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) mode_setup->transformtype = get_bits(gb, 16); //FIXME check GET_VALIDATED_INDEX(mode_setup->mapping, 8, vc->mapping_count); - AV_DEBUG(" %d mode: blockflag %d, windowtype %d, transformtype %d, mapping %d \n", i, mode_setup->blockflag, mode_setup->windowtype, mode_setup->transformtype, mode_setup->mapping); + AV_DEBUG(" %u mode: blockflag %d, windowtype %d, transformtype %d, mapping %d\n", + i, mode_setup->blockflag, mode_setup->windowtype, + mode_setup->transformtype, mode_setup->mapping); } return 0; } @@ -887,7 +894,7 @@ static int vorbis_parse_setup_hdr(vorbis_context *vc) static int vorbis_parse_id_hdr(vorbis_context *vc) { GetBitContext *gb = &vc->gb; - uint_fast8_t bl0, bl1; + unsigned bl0, bl1; if ((get_bits(gb, 8) != 'v') || (get_bits(gb, 8) != 'o') || (get_bits(gb, 8) != 'r') || (get_bits(gb, 8) != 'b') || @@ -1028,15 +1035,13 @@ static int vorbis_floor0_decode(vorbis_context *vc, { vorbis_floor0 *vf = &vfu->t0; float *lsp = vf->lsp; - uint_fast32_t amplitude; - uint_fast32_t book_idx; - uint_fast8_t blockflag = vc->modes[vc->mode_number].blockflag; + unsigned amplitude, book_idx; + unsigned blockflag = vc->modes[vc->mode_number].blockflag; amplitude = get_bits(&vc->gb, vf->amplitude_bits); if (amplitude > 0) { float last = 0; - uint_fast16_t lsp_len = 0; - uint_fast16_t idx; + unsigned idx, lsp_len = 0; vorbis_codebook codebook; book_idx = get_bits(&vc->gb, ilog(vf->num_books)); @@ -1139,20 +1144,12 @@ static int vorbis_floor1_decode(vorbis_context *vc, vorbis_floor1 *vf = &vfu->t1; GetBitContext *gb = &vc->gb; uint_fast16_t range_v[4] = { 256, 128, 86, 64 }; - uint_fast16_t range = range_v[vf->multiplier-1]; + unsigned range = range_v[vf->multiplier-1]; uint_fast16_t floor1_Y[258]; uint_fast16_t floor1_Y_final[258]; int floor1_flag[258]; - uint_fast8_t class; - uint_fast8_t cdim; - uint_fast8_t cbits; - uint_fast8_t csub; - uint_fast8_t cval; - int_fast16_t book; - uint_fast16_t offset; - uint_fast16_t i,j; - int_fast16_t adx, ady, dy, off, predicted; - int_fast32_t err; + unsigned class, cdim, cbits, csub, cval, offset, i, j; + int book, adx, ady, dy, off, predicted, err; if (!get_bits1(gb)) // silence @@ -1173,7 +1170,7 @@ static int vorbis_floor1_decode(vorbis_context *vc, csub = (1 << cbits) - 1; cval = 0; - AV_DEBUG("Cbits %d \n", cbits); + AV_DEBUG("Cbits %u\n", cbits); if (cbits) // this reads all subclasses for this partition's class cval = get_vlc2(gb, vc->codebooks[vf->class_masterbook[class]].vlc.table, @@ -1182,7 +1179,8 @@ static int vorbis_floor1_decode(vorbis_context *vc, for (j = 0; j < cdim; ++j) { book = vf->subclass_books[class][cval & csub]; - AV_DEBUG("book %d Cbits %d cval %d bits:%d \n", book, cbits, cval, get_bits_count(gb)); + AV_DEBUG("book %d Cbits %u cval %u bits:%d\n", + book, cbits, cval, get_bits_count(gb)); cval = cval >> cbits; if (book > -1) { @@ -1205,9 +1203,7 @@ static int vorbis_floor1_decode(vorbis_context *vc, floor1_Y_final[1] = floor1_Y[1]; for (i = 2; i < vf->x_list_dim; ++i) { - uint_fast16_t val, highroom, lowroom, room; - uint_fast16_t high_neigh_offs; - uint_fast16_t low_neigh_offs; + unsigned val, highroom, lowroom, room, high_neigh_offs, low_neigh_offs; low_neigh_offs = vf->list[i].low; high_neigh_offs = vf->list[i].high; @@ -1252,7 +1248,8 @@ static int vorbis_floor1_decode(vorbis_context *vc, floor1_Y_final[i] = predicted; } - AV_DEBUG(" Decoded floor(%d) = %d / val %d \n", vf->list[i].x, floor1_Y_final[i], val); + AV_DEBUG(" Decoded floor(%d) = %d / val %u\n", + vf->list[i].x, floor1_Y_final[i], val); } // Curve synth - connect the calculated dots and convert from dB scale FIXME optimize ? @@ -1268,20 +1265,17 @@ static int vorbis_floor1_decode(vorbis_context *vc, static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, vorbis_residue *vr, - uint_fast8_t ch, + unsigned ch, uint_fast8_t *do_not_decode, float *vec, - uint_fast16_t vlen, + unsigned vlen, int vr_type) { GetBitContext *gb = &vc->gb; - uint_fast8_t c_p_c = vc->codebooks[vr->classbook].dimensions; - uint_fast16_t ptns_to_read = vr->ptns_to_read; + unsigned c_p_c = vc->codebooks[vr->classbook].dimensions; + unsigned ptns_to_read = vr->ptns_to_read; uint8_t *classifs = vr->classifs; - uint_fast8_t pass; - uint_fast8_t ch_used; - uint_fast8_t i,j,l; - uint_fast16_t k; + unsigned pass, ch_used, i, j, k, l; if (vr_type == 2) { for (j = 1; j < ch; ++j) @@ -1296,26 +1290,24 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, AV_DEBUG(" residue type 0/1/2 decode begin, ch: %d cpc %d \n", ch, c_p_c); for (pass = 0; pass <= vr->maxpass; ++pass) { // FIXME OPTIMIZE? - uint_fast16_t voffset; - uint_fast16_t partition_count; - uint_fast16_t j_times_ptns_to_read; + uint16_t voffset, partition_count, j_times_ptns_to_read; voffset = vr->begin; for (partition_count = 0; partition_count < ptns_to_read;) { // SPEC error if (!pass) { - uint_fast32_t inverse_class = ff_inverse[vr->classifications]; + unsigned inverse_class = ff_inverse[vr->classifications]; for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) { if (!do_not_decode[j]) { - uint_fast32_t temp = get_vlc2(gb, vc->codebooks[vr->classbook].vlc.table, - vc->codebooks[vr->classbook].nb_bits, 3); + unsigned temp = get_vlc2(gb, vc->codebooks[vr->classbook].vlc.table, + vc->codebooks[vr->classbook].nb_bits, 3); - AV_DEBUG("Classword: %d \n", temp); + AV_DEBUG("Classword: %u\n", temp); assert(vr->classifications > 1 && temp <= 65536); //needed for inverse[] for (i = 0; i < c_p_c; ++i) { - uint_fast32_t temp2; + unsigned temp2; - temp2 = (((uint_fast64_t)temp) * inverse_class) >> 32; + temp2 = (((uint64_t)temp) * inverse_class) >> 32; if (partition_count + c_p_c - 1 - i < ptns_to_read) classifs[j_times_ptns_to_read + partition_count + c_p_c - 1 - i] = temp - temp2 * vr->classifications; temp = temp2; @@ -1326,17 +1318,17 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, } for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) { for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) { - uint_fast16_t voffs; + unsigned voffs; if (!do_not_decode[j]) { - uint_fast8_t vqclass = classifs[j_times_ptns_to_read+partition_count]; - int_fast16_t vqbook = vr->books[vqclass][pass]; + unsigned vqclass = classifs[j_times_ptns_to_read + partition_count]; + int vqbook = vr->books[vqclass][pass]; if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) { - uint_fast16_t coffs; - unsigned dim = vc->codebooks[vqbook].dimensions; // not uint_fast8_t: 64bit is slower here on amd64 - uint_fast16_t step = dim == 1 ? vr->partition_size - : FASTDIV(vr->partition_size, dim); + unsigned coffs; + unsigned dim = vc->codebooks[vqbook].dimensions; + unsigned step = dim == 1 ? vr->partition_size + : FASTDIV(vr->partition_size, dim); vorbis_codebook codebook = vc->codebooks[vqbook]; if (vr_type == 0) { @@ -1410,9 +1402,9 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, } static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, - uint_fast8_t ch, + unsigned ch, uint_fast8_t *do_not_decode, - float *vec, uint_fast16_t vlen) + float *vec, unsigned vlen) { if (vr->type == 2) return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, 2); @@ -1456,19 +1448,17 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) { GetBitContext *gb = &vc->gb; FFTContext *mdct; - uint_fast8_t previous_window = vc->previous_window; - uint_fast8_t mode_number; - uint_fast8_t blockflag; - uint_fast16_t blocksize; - int_fast32_t i,j; + unsigned previous_window = vc->previous_window; + unsigned mode_number, blockflag, blocksize; + int i, j; uint_fast8_t no_residue[255]; uint_fast8_t do_not_decode[255]; vorbis_mapping *mapping; float *ch_res_ptr = vc->channel_residues; float *ch_floor_ptr = vc->channel_floors; uint_fast8_t res_chan[255]; - uint_fast8_t res_num = 0; - int_fast16_t retlen = 0; + unsigned res_num = 0; + int retlen = 0; if (get_bits1(gb)) { av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n"); @@ -1483,7 +1473,8 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) vc->mode_number = mode_number; mapping = &vc->mappings[vc->modes[mode_number].mapping]; - AV_DEBUG(" Mode number: %d , mapping: %d , blocktype %d \n", mode_number, vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag); + AV_DEBUG(" Mode number: %u , mapping: %d , blocktype %d\n", mode_number, + vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag); blockflag = vc->modes[mode_number].blockflag; blocksize = vc->blocksize[blockflag]; @@ -1527,7 +1518,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) for (i = 0; i < mapping->submaps; ++i) { vorbis_residue *residue; - uint_fast8_t ch = 0; + unsigned ch = 0; for (j = 0; j < vc->audio_channels; ++j) { if ((mapping->submaps == 1) || (i == mapping->mux[j])) { @@ -1572,8 +1563,8 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) retlen = (blocksize + vc->blocksize[previous_window]) / 4; for (j = 0; j < vc->audio_channels; j++) { - uint_fast16_t bs0 = vc->blocksize[0]; - uint_fast16_t bs1 = vc->blocksize[1]; + unsigned bs0 = vc->blocksize[0]; + unsigned bs1 = vc->blocksize[1]; float *residue = vc->channel_residues + res_chan[j] * blocksize / 2; float *saved = vc->saved + j * bs1 / 4; float *ret = vc->channel_floors + j * retlen; @@ -1607,9 +1598,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, vorbis_context *vc = avccontext->priv_data ; GetBitContext *gb = &(vc->gb); const float *channel_ptrs[255]; - int i; - - int_fast16_t len; + int i, len; if (!buf_size) return 0; From 0247bdee2581a6857a24c5ff297f01d3a3112b11 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Wed, 27 Apr 2011 21:21:54 +0200 Subject: [PATCH 10/12] Fix races in default av_log handler Prevent competing threads from overwriting (shared) buffers. Original patch by: Michael Niedermayer --- libavutil/log.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavutil/log.c b/libavutil/log.c index deab11965d..cfeb21cd5a 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -83,7 +83,8 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) { static int print_prefix=1; static int count; - static char line[1024], prev[1024]; + static char prev[1024]; + char line[1024]; static int is_atty; AVClass* avc= ptr ? *(AVClass**)ptr : NULL; if(level>av_log_level) @@ -108,7 +109,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) if(!is_atty) is_atty= isatty(2) ? 1 : -1; #endif - if(print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){ + if(print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strncmp(line, prev, sizeof line)){ count++; if(is_atty==1) fprintf(stderr, " Last message repeated %d times\r", count); @@ -119,7 +120,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) count=0; } colored_fputs(av_clip(level>>3, 0, 6), line); - strcpy(prev, line); + strncpy(prev, line, sizeof line); } static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback; From 7c152a458d3fb0a2fb1aef1f05bfee90fe70697e Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Thu, 28 Apr 2011 20:47:40 +0200 Subject: [PATCH 11/12] lavf: inspect more frames for fps when container time base is coarse As per issue2629, most 23.976fps matroska H.264 files are incorrectly detected as 24fps, as the matroska timestamps usually have only millisecond precision. Fix that by doubling the amount of timestamps inspected for frame rate for streams that have coarse time base. This also fixes 29.970 detection in matroska. Signed-off-by: Michael Niedermayer (cherry picked from commit 78431098f9e306ebe27e7698d0ae539e3df2afe9) Tested with mplayer based on this report http://thread.gmane.org/gmane.comp.video.mplayer.user/66043/focus=66063 Signed-off-by: Reinhard Tartler --- libavformat/utils.c | 10 +- tests/ref/fate/cscd | 414 ++++++++++++++++++++++---------------------- 2 files changed, 216 insertions(+), 208 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 6d6c8308ca..79e70f943e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2217,12 +2217,20 @@ int av_find_stream_info(AVFormatContext *ic) /* check if one codec still needs to be handled */ for(i=0;inb_streams;i++) { + int fps_analyze_framecount = 20; + st = ic->streams[i]; if (!has_codec_parameters(st->codec)) break; + /* if the timebase is coarse (like the usual millisecond precision + of mkv), we need to analyze more frames to reliably arrive at + the correct fps */ + if (av_q2d(st->time_base) > 0.0005) + fps_analyze_framecount *= 2; /* variable fps and no guess at the real fps */ if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num) - && st->info->duration_count<20 && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) + && st->info->duration_count < fps_analyze_framecount + && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) break; if(st->parser && st->parser->parser->split && !st->codec->extradata) break; diff --git a/tests/ref/fate/cscd b/tests/ref/fate/cscd index 75a7725c18..8b89e80a10 100644 --- a/tests/ref/fate/cscd +++ b/tests/ref/fate/cscd @@ -1,208 +1,208 @@ 0, 0, 270000, 0xf90015d8 -0, 2880, 270000, 0xf90015d8 -0, 5760, 270000, 0xf90015d8 -0, 8640, 270000, 0xf90015d8 -0, 11520, 270000, 0xf90015d8 -0, 14400, 270000, 0xf90015d8 -0, 17280, 270000, 0xf90015d8 -0, 20160, 270000, 0xf90015d8 -0, 23040, 270000, 0xf90015d8 -0, 25920, 270000, 0xf90015d8 -0, 28800, 270000, 0xf90015d8 -0, 31680, 270000, 0xf90015d8 -0, 34560, 270000, 0xf90015d8 -0, 37440, 270000, 0xf90015d8 -0, 40320, 270000, 0xf90015d8 -0, 43200, 270000, 0xf90015d8 -0, 46080, 270000, 0xf90015d8 -0, 48960, 270000, 0xf90015d8 -0, 51840, 270000, 0xf90015d8 -0, 54720, 270000, 0xf90015d8 -0, 57600, 270000, 0xf90015d8 -0, 60480, 270000, 0xf90015d8 -0, 63360, 270000, 0xf90015d8 -0, 66240, 270000, 0xf90015d8 -0, 69120, 270000, 0xf90015d8 -0, 72000, 270000, 0xf90015d8 -0, 74880, 270000, 0xf90015d8 -0, 77760, 270000, 0xf90015d8 -0, 80640, 270000, 0xf90015d8 -0, 83520, 270000, 0xf90015d8 -0, 86400, 270000, 0xf90015d8 -0, 89280, 270000, 0xf90015d8 -0, 92160, 270000, 0xf90015d8 -0, 95040, 270000, 0xf90015d8 -0, 97920, 270000, 0xf90015d8 -0, 100800, 270000, 0xf90015d8 -0, 103680, 270000, 0xf90015d8 -0, 106560, 270000, 0xf90015d8 -0, 109440, 270000, 0xf90015d8 -0, 112320, 270000, 0x1f9c15d8 -0, 115200, 270000, 0x436f15d8 -0, 118080, 270000, 0xe90115d8 -0, 120960, 270000, 0xe90115d8 -0, 123840, 270000, 0x8ea215d8 -0, 126720, 270000, 0x424015d8 -0, 129600, 270000, 0x0ce315d8 -0, 132480, 270000, 0x14bc15d8 -0, 135360, 270000, 0x2a9215d8 -0, 138240, 270000, 0x233f15d8 -0, 141120, 270000, 0x764b15d8 -0, 144000, 270000, 0xf76115d8 -0, 146880, 270000, 0xbbe015d8 -0, 149760, 270000, 0x95af15d8 -0, 152640, 270000, 0x324815d8 -0, 155520, 270000, 0x311915d8 -0, 158400, 270000, 0x090ef191 -0, 161280, 270000, 0xd88974dc -0, 164160, 270000, 0xfa7f58df -0, 167040, 270000, 0x78f849c3 -0, 169920, 270000, 0xae174892 -0, 172800, 270000, 0x9d4e2332 -0, 175680, 270000, 0x874b09b4 -0, 178560, 270000, 0x4069fed6 -0, 181440, 270000, 0x4069fed6 -0, 184320, 270000, 0x4069fed6 -0, 187200, 270000, 0x4069fed6 -0, 190080, 270000, 0x4069fed6 -0, 192960, 270000, 0x4069fed6 -0, 195840, 270000, 0x4069fed6 -0, 198720, 270000, 0x4069fed6 -0, 201600, 270000, 0x4069fed6 -0, 204480, 270000, 0x4069fed6 -0, 207360, 270000, 0x4069fed6 -0, 210240, 270000, 0x773db046 -0, 213120, 270000, 0x773db046 -0, 216000, 270000, 0x773db046 -0, 218880, 270000, 0x773db046 -0, 221760, 270000, 0x773db046 -0, 224640, 270000, 0x773db046 -0, 227520, 270000, 0x773db046 -0, 230400, 270000, 0x773db046 -0, 233280, 270000, 0x773db046 -0, 236160, 270000, 0x773db046 -0, 239040, 270000, 0x773db046 -0, 241920, 270000, 0x773db046 -0, 244800, 270000, 0x773db046 -0, 247680, 270000, 0x773db046 -0, 250560, 270000, 0x773db046 -0, 253440, 270000, 0x773db046 -0, 256320, 270000, 0x773db046 -0, 259200, 270000, 0x17b9aec9 -0, 262080, 270000, 0x622fad4c -0, 264960, 270000, 0xdaea3aef -0, 267840, 270000, 0x61bb10e3 -0, 270720, 270000, 0xfc37ee0c -0, 273600, 270000, 0x50dbd01e -0, 276480, 270000, 0xcd66c27c -0, 279360, 270000, 0xd13f1e4f -0, 282240, 270000, 0xa4a2dbf5 -0, 285120, 270000, 0xf302c9ab -0, 288000, 270000, 0x4479f7fe -0, 290880, 270000, 0x1afe92c8 -0, 293760, 270000, 0x3007f4c3 -0, 296640, 270000, 0x5834c096 -0, 299520, 270000, 0x40109126 -0, 302400, 270000, 0x0a7b8882 -0, 305280, 270000, 0x15b8635d -0, 308160, 270000, 0xeaa5598e -0, 311040, 270000, 0x0b7b5489 -0, 313920, 270000, 0x0b7b5489 -0, 316800, 270000, 0x0b7b5489 -0, 319680, 270000, 0x0b7b5489 -0, 322560, 270000, 0x8f0e6eaa -0, 325440, 270000, 0xc46fc0f2 -0, 328320, 270000, 0xadd7e605 -0, 331200, 270000, 0x9d23a056 -0, 334080, 270000, 0x365afa63 -0, 336960, 270000, 0x6ac3bda2 -0, 339840, 270000, 0x14f5daf2 -0, 342720, 270000, 0x4b3afb6a -0, 345600, 270000, 0x1a3302e3 -0, 348480, 270000, 0x1a3302e3 -0, 351360, 270000, 0x1a3302e3 -0, 354240, 270000, 0x1a3302e3 -0, 357120, 270000, 0xc15526e2 -0, 360000, 270000, 0x3dd73006 -0, 362880, 270000, 0x60abb5bc -0, 365760, 270000, 0xb960c27c -0, 368640, 270000, 0x8fa4c01c -0, 371520, 270000, 0x8fa4c01c -0, 374400, 270000, 0x8fa4c01c -0, 377280, 270000, 0xb20dcc38 -0, 380160, 270000, 0x03c6ad3c -0, 383040, 270000, 0xe550b194 -0, 385920, 270000, 0xe550b194 -0, 388800, 270000, 0xe550b194 -0, 391680, 270000, 0xe550b194 -0, 394560, 270000, 0xe550b194 -0, 397440, 270000, 0xe550b194 -0, 400320, 270000, 0xe550b194 -0, 403200, 270000, 0xe550b194 -0, 406080, 270000, 0xe550b194 -0, 408960, 270000, 0xe550b194 -0, 411840, 270000, 0xe550b194 -0, 414720, 270000, 0xe550b194 -0, 417600, 270000, 0xe550b194 -0, 420480, 270000, 0xe550b194 -0, 423360, 270000, 0x4550a014 -0, 426240, 270000, 0xaf639da8 -0, 429120, 270000, 0xe4229da8 -0, 432000, 270000, 0x315d9da8 -0, 434880, 270000, 0x7e899da8 -0, 437760, 270000, 0x99b9a8a0 -0, 440640, 270000, 0x4588ac2a -0, 443520, 270000, 0x1e79ae6e -0, 446400, 270000, 0xa003cb14 -0, 449280, 270000, 0x03ef1bb8 -0, 452160, 270000, 0x3b3f30fc -0, 455040, 270000, 0x4dad3525 -0, 457920, 270000, 0x5b600c12 -0, 460800, 270000, 0x75a1fab3 -0, 463680, 270000, 0xc9f7d9ad -0, 466560, 270000, 0x9eaec58d -0, 469440, 270000, 0xb91bc3e8 -0, 472320, 270000, 0x77bdbbfb -0, 475200, 270000, 0x77bdbbfb -0, 478080, 270000, 0x77bdbbfb -0, 480960, 270000, 0x77bdbbfb -0, 483840, 270000, 0x77bdbbfb -0, 486720, 270000, 0x77bdbbfb -0, 489600, 270000, 0x3d54eac2 -0, 492480, 270000, 0x3d54eac2 -0, 495360, 270000, 0x3d54eac2 -0, 498240, 270000, 0x3d54eac2 -0, 501120, 270000, 0x3d54eac2 -0, 504000, 270000, 0x3d54eac2 -0, 506880, 270000, 0x3d54eac2 -0, 509760, 270000, 0x3d54eac2 -0, 512640, 270000, 0x3d54eac2 -0, 515520, 270000, 0x3d54eac2 -0, 518400, 270000, 0x3d54eac2 -0, 521280, 270000, 0x3d54eac2 -0, 524160, 270000, 0x3d54eac2 -0, 527040, 270000, 0x3d54eac2 -0, 529920, 270000, 0x3d54eac2 -0, 532800, 270000, 0x3d54eac2 -0, 535680, 270000, 0x3d54eac2 -0, 538560, 270000, 0x3d54eac2 -0, 541440, 270000, 0x3d54eac2 -0, 544320, 270000, 0x5f3609ba -0, 547200, 270000, 0x80921b0c -0, 550080, 270000, 0x80921b0c -0, 552960, 270000, 0x80921b0c -0, 555840, 270000, 0x80921b0c -0, 558720, 270000, 0x80921b0c -0, 561600, 270000, 0x80921b0c -0, 564480, 270000, 0x80921b0c -0, 567360, 270000, 0x80921b0c -0, 570240, 270000, 0x80921b0c -0, 573120, 270000, 0x80921b0c -0, 576000, 270000, 0x80921b0c -0, 578880, 270000, 0x80921b0c -0, 581760, 270000, 0x80921b0c -0, 584640, 270000, 0x80921b0c -0, 587520, 270000, 0x80921b0c -0, 590400, 270000, 0x80921b0c -0, 593280, 270000, 0xf0e626a8 -0, 596160, 270000, 0xf0e626a8 +0, 2865, 270000, 0xf90015d8 +0, 5729, 270000, 0xf90015d8 +0, 8594, 270000, 0xf90015d8 +0, 11459, 270000, 0xf90015d8 +0, 14324, 270000, 0xf90015d8 +0, 17188, 270000, 0xf90015d8 +0, 20053, 270000, 0xf90015d8 +0, 22918, 270000, 0xf90015d8 +0, 25782, 270000, 0xf90015d8 +0, 28647, 270000, 0xf90015d8 +0, 31512, 270000, 0xf90015d8 +0, 34377, 270000, 0xf90015d8 +0, 37241, 270000, 0xf90015d8 +0, 40106, 270000, 0xf90015d8 +0, 42971, 270000, 0xf90015d8 +0, 45836, 270000, 0xf90015d8 +0, 48700, 270000, 0xf90015d8 +0, 51565, 270000, 0xf90015d8 +0, 54430, 270000, 0xf90015d8 +0, 57294, 270000, 0xf90015d8 +0, 60159, 270000, 0xf90015d8 +0, 63024, 270000, 0xf90015d8 +0, 65889, 270000, 0xf90015d8 +0, 68753, 270000, 0xf90015d8 +0, 71618, 270000, 0xf90015d8 +0, 74483, 270000, 0xf90015d8 +0, 77347, 270000, 0xf90015d8 +0, 80212, 270000, 0xf90015d8 +0, 83077, 270000, 0xf90015d8 +0, 85942, 270000, 0xf90015d8 +0, 88806, 270000, 0xf90015d8 +0, 91671, 270000, 0xf90015d8 +0, 94536, 270000, 0xf90015d8 +0, 97401, 270000, 0xf90015d8 +0, 100265, 270000, 0xf90015d8 +0, 103130, 270000, 0xf90015d8 +0, 105995, 270000, 0xf90015d8 +0, 108859, 270000, 0xf90015d8 +0, 111724, 270000, 0x1f9c15d8 +0, 114589, 270000, 0x436f15d8 +0, 117454, 270000, 0xe90115d8 +0, 120318, 270000, 0xe90115d8 +0, 123183, 270000, 0x8ea215d8 +0, 126048, 270000, 0x424015d8 +0, 128912, 270000, 0x0ce315d8 +0, 131777, 270000, 0x14bc15d8 +0, 134642, 270000, 0x2a9215d8 +0, 137507, 270000, 0x233f15d8 +0, 140371, 270000, 0x764b15d8 +0, 143236, 270000, 0xf76115d8 +0, 146101, 270000, 0xbbe015d8 +0, 148966, 270000, 0x95af15d8 +0, 151830, 270000, 0x324815d8 +0, 154695, 270000, 0x311915d8 +0, 157560, 270000, 0x090ef191 +0, 160424, 270000, 0xd88974dc +0, 163289, 270000, 0xfa7f58df +0, 166154, 270000, 0x78f849c3 +0, 169019, 270000, 0xae174892 +0, 171883, 270000, 0x9d4e2332 +0, 174748, 270000, 0x874b09b4 +0, 177613, 270000, 0x4069fed6 +0, 180477, 270000, 0x4069fed6 +0, 183342, 270000, 0x4069fed6 +0, 186207, 270000, 0x4069fed6 +0, 189072, 270000, 0x4069fed6 +0, 191936, 270000, 0x4069fed6 +0, 194801, 270000, 0x4069fed6 +0, 197666, 270000, 0x4069fed6 +0, 200531, 270000, 0x4069fed6 +0, 203395, 270000, 0x4069fed6 +0, 206260, 270000, 0x4069fed6 +0, 209125, 270000, 0x773db046 +0, 211989, 270000, 0x773db046 +0, 214854, 270000, 0x773db046 +0, 217719, 270000, 0x773db046 +0, 220584, 270000, 0x773db046 +0, 223448, 270000, 0x773db046 +0, 226313, 270000, 0x773db046 +0, 229178, 270000, 0x773db046 +0, 232042, 270000, 0x773db046 +0, 234907, 270000, 0x773db046 +0, 237772, 270000, 0x773db046 +0, 240637, 270000, 0x773db046 +0, 243501, 270000, 0x773db046 +0, 246366, 270000, 0x773db046 +0, 249231, 270000, 0x773db046 +0, 252095, 270000, 0x773db046 +0, 254960, 270000, 0x773db046 +0, 257825, 270000, 0x17b9aec9 +0, 260690, 270000, 0x622fad4c +0, 263554, 270000, 0xdaea3aef +0, 266419, 270000, 0x61bb10e3 +0, 269284, 270000, 0xfc37ee0c +0, 272149, 270000, 0x50dbd01e +0, 275013, 270000, 0xcd66c27c +0, 277878, 270000, 0xd13f1e4f +0, 280743, 270000, 0xa4a2dbf5 +0, 283607, 270000, 0xf302c9ab +0, 286472, 270000, 0x4479f7fe +0, 289337, 270000, 0x1afe92c8 +0, 292202, 270000, 0x3007f4c3 +0, 295066, 270000, 0x5834c096 +0, 297931, 270000, 0x40109126 +0, 300796, 270000, 0x0a7b8882 +0, 303660, 270000, 0x15b8635d +0, 306525, 270000, 0xeaa5598e +0, 309390, 270000, 0x0b7b5489 +0, 312255, 270000, 0x0b7b5489 +0, 315119, 270000, 0x0b7b5489 +0, 317984, 270000, 0x0b7b5489 +0, 320849, 270000, 0x8f0e6eaa +0, 323714, 270000, 0xc46fc0f2 +0, 326578, 270000, 0xadd7e605 +0, 329443, 270000, 0x9d23a056 +0, 332308, 270000, 0x365afa63 +0, 335172, 270000, 0x6ac3bda2 +0, 338037, 270000, 0x14f5daf2 +0, 340902, 270000, 0x4b3afb6a +0, 343767, 270000, 0x1a3302e3 +0, 346631, 270000, 0x1a3302e3 +0, 349496, 270000, 0x1a3302e3 +0, 352361, 270000, 0x1a3302e3 +0, 355225, 270000, 0xc15526e2 +0, 358090, 270000, 0x3dd73006 +0, 360955, 270000, 0x60abb5bc +0, 363820, 270000, 0xb960c27c +0, 366684, 270000, 0x8fa4c01c +0, 369549, 270000, 0x8fa4c01c +0, 372414, 270000, 0x8fa4c01c +0, 375279, 270000, 0xb20dcc38 +0, 378143, 270000, 0x03c6ad3c +0, 381008, 270000, 0xe550b194 +0, 383873, 270000, 0xe550b194 +0, 386737, 270000, 0xe550b194 +0, 389602, 270000, 0xe550b194 +0, 392467, 270000, 0xe550b194 +0, 395332, 270000, 0xe550b194 +0, 398196, 270000, 0xe550b194 +0, 401061, 270000, 0xe550b194 +0, 403926, 270000, 0xe550b194 +0, 406790, 270000, 0xe550b194 +0, 409655, 270000, 0xe550b194 +0, 412520, 270000, 0xe550b194 +0, 415385, 270000, 0xe550b194 +0, 418249, 270000, 0xe550b194 +0, 421114, 270000, 0x4550a014 +0, 423979, 270000, 0xaf639da8 +0, 426844, 270000, 0xe4229da8 +0, 429708, 270000, 0x315d9da8 +0, 432573, 270000, 0x7e899da8 +0, 435438, 270000, 0x99b9a8a0 +0, 438302, 270000, 0x4588ac2a +0, 441167, 270000, 0x1e79ae6e +0, 444032, 270000, 0xa003cb14 +0, 446897, 270000, 0x03ef1bb8 +0, 449761, 270000, 0x3b3f30fc +0, 452626, 270000, 0x4dad3525 +0, 455491, 270000, 0x5b600c12 +0, 458355, 270000, 0x75a1fab3 +0, 461220, 270000, 0xc9f7d9ad +0, 464085, 270000, 0x9eaec58d +0, 466950, 270000, 0xb91bc3e8 +0, 469814, 270000, 0x77bdbbfb +0, 472679, 270000, 0x77bdbbfb +0, 475544, 270000, 0x77bdbbfb +0, 478408, 270000, 0x77bdbbfb +0, 481273, 270000, 0x77bdbbfb +0, 484138, 270000, 0x77bdbbfb +0, 487003, 270000, 0x3d54eac2 +0, 489867, 270000, 0x3d54eac2 +0, 492732, 270000, 0x3d54eac2 +0, 495597, 270000, 0x3d54eac2 +0, 498462, 270000, 0x3d54eac2 +0, 501326, 270000, 0x3d54eac2 +0, 504191, 270000, 0x3d54eac2 +0, 507056, 270000, 0x3d54eac2 +0, 509920, 270000, 0x3d54eac2 +0, 512785, 270000, 0x3d54eac2 +0, 515650, 270000, 0x3d54eac2 +0, 518515, 270000, 0x3d54eac2 +0, 521379, 270000, 0x3d54eac2 +0, 524244, 270000, 0x3d54eac2 +0, 527109, 270000, 0x3d54eac2 +0, 529973, 270000, 0x3d54eac2 +0, 532838, 270000, 0x3d54eac2 +0, 535703, 270000, 0x3d54eac2 +0, 538568, 270000, 0x3d54eac2 +0, 541432, 270000, 0x5f3609ba +0, 544297, 270000, 0x80921b0c +0, 547162, 270000, 0x80921b0c +0, 550027, 270000, 0x80921b0c +0, 552891, 270000, 0x80921b0c +0, 555756, 270000, 0x80921b0c +0, 558621, 270000, 0x80921b0c +0, 561485, 270000, 0x80921b0c +0, 564350, 270000, 0x80921b0c +0, 567215, 270000, 0x80921b0c +0, 570080, 270000, 0x80921b0c +0, 572944, 270000, 0x80921b0c +0, 575809, 270000, 0x80921b0c +0, 578674, 270000, 0x80921b0c +0, 581538, 270000, 0x80921b0c +0, 584403, 270000, 0x80921b0c +0, 587268, 270000, 0x80921b0c +0, 590133, 270000, 0xf0e626a8 +0, 592997, 270000, 0xf0e626a8 From 7089265756a84bf884a7c2290c6cda38d4dfd60f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 28 Apr 2011 21:10:04 +0200 Subject: [PATCH 12/12] AMV: disable DR1 and don't override EMU_EDGE This works around a possibly exploitable crash. Appearently, vlc can be exploited with a malicous file. This should get reverted as soon as a proper fix is found. Reported-at: Thu, 21 Apr 2011 14:38:25 +0000 Reported-by: Dominic Chell Signed-off-by: Michael Niedermayer (cherry picked from commit 89f903b3d5ec38c9c5d90fba7e626fa0eda61a32) (cherry picked from commit 9b919571e506fbb72b81a35ca1e7c1bd6efc4209) --- libavcodec/sp5xdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c index e2c371a1c2..3d01020a6d 100644 --- a/libavcodec/sp5xdec.c +++ b/libavcodec/sp5xdec.c @@ -86,7 +86,6 @@ static int sp5x_decode_frame(AVCodecContext *avctx, recoded[j++] = 0xFF; recoded[j++] = 0xD9; - avctx->flags &= ~CODEC_FLAG_EMU_EDGE; av_init_packet(&avpkt_recoded); avpkt_recoded.data = recoded; avpkt_recoded.size = j; @@ -121,6 +120,6 @@ AVCodec ff_amv_decoder = { NULL, ff_mjpeg_decode_end, sp5x_decode_frame, - CODEC_CAP_DR1, + 0, .long_name = NULL_IF_CONFIG_SMALL("AMV Video"), };