From 3b79f2e2e928eb346dbea85cc89393dcdf010ca9 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Mon, 20 Jun 2011 15:56:35 -0700 Subject: [PATCH 01/11] H.264: fix bug in lossless 4:4:4 decoding Coefficient test for i16x16 add_pixels4 assumed luma plane. --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 13a63809a0..124f9a88cd 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1744,7 +1744,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, int mb_type, h->hpc.pred16x16_add[h->intra16x16_pred_mode](dest_y, block_offset, h->mb + (p*256 << pixel_shift), linesize); }else{ for(i=0; i<16; i++){ - if(h->non_zero_count_cache[ scan8[i+p*16] ] || dctcoef_get(h->mb, pixel_shift, i*16)) + if(h->non_zero_count_cache[ scan8[i+p*16] ] || dctcoef_get(h->mb, pixel_shift, i*16+p*256)) s->dsp.add_pixels4(dest_y + block_offset[i], h->mb + (i*16+p*256 << pixel_shift), linesize); } } From 85a88f9c0c0fcc2fc48121db1beb5ada68d24bdc Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Tue, 21 Jun 2011 01:10:37 -0700 Subject: [PATCH 02/11] H.264: reference the correct SPS in decode_scaling_matrices --- libavcodec/h264_ps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 9c41e4ca73..5ca2361a6d 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -281,12 +281,12 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb if(is_sps || pps->transform_8x8_mode){ decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]); // Intra, Y - if(h->sps.chroma_format_idc == 3){ + if(sps->chroma_format_idc == 3){ decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[0],scaling_matrix8[0]); // Intra, Cr decode_scaling_list(h,scaling_matrix8[2],64,default_scaling8[0],scaling_matrix8[1]); // Intra, Cb } decode_scaling_list(h,scaling_matrix8[3],64,default_scaling8[1],fallback[3]); // Inter, Y - if(h->sps.chroma_format_idc == 3){ + if(sps->chroma_format_idc == 3){ decode_scaling_list(h,scaling_matrix8[4],64,default_scaling8[1],scaling_matrix8[3]); // Inter, Cr decode_scaling_list(h,scaling_matrix8[5],64,default_scaling8[1],scaling_matrix8[4]); // Inter, Cb } From 932db250243812380640112fd27a59bc0642bc8a Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Tue, 21 Jun 2011 04:16:33 -0700 Subject: [PATCH 03/11] H.264: fix 4:4:4 cropping warning --- libavcodec/h264_ps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 5ca2361a6d..7491807460 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -396,6 +396,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ #endif sps->crop= get_bits1(&s->gb); if(sps->crop){ + int crop_limit = sps->chroma_format_idc == 3 ? 16 : 8; sps->crop_left = get_ue_golomb(&s->gb); sps->crop_right = get_ue_golomb(&s->gb); sps->crop_top = get_ue_golomb(&s->gb); @@ -403,7 +404,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ if(sps->crop_left || sps->crop_top){ av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n"); } - if(sps->crop_right >= (8<crop_bottom >= (8<crop_right >= crop_limit || sps->crop_bottom >= crop_limit){ av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n"); } }else{ From 7c9079ab4cf0bcf34103fc9c5e49ec1fd7dd390c Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 22 Jun 2011 02:05:14 -0700 Subject: [PATCH 04/11] H.264: fix 4:4:4 + deblocking + MBAFF --- libavcodec/h264.c | 4 ++-- libavcodec/h264_loopfilter.c | 30 ++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 124f9a88cd..6bee7c39b0 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3300,8 +3300,8 @@ static void loop_filter(H264Context *h, int start_x, int end_x){ uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2; if(mb_y&1){ //FIXME move out of this function? dest_y -= s->linesize*15; - dest_cb-= s->uvlinesize*7; - dest_cr-= s->uvlinesize*7; + dest_cb-= s->uvlinesize*((8 << CHROMA444)-1); + dest_cr-= s->uvlinesize*((8 << CHROMA444)-1); } } else { linesize = h->mb_linesize = s->linesize; diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c index 1ae534ec96..b88c338804 100644 --- a/libavcodec/h264_loopfilter.c +++ b/libavcodec/h264_loopfilter.c @@ -663,19 +663,33 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint filter_mb_mbaff_edgev ( h, img_y , linesize, bS , 1, qp [0] ); filter_mb_mbaff_edgev ( h, img_y + 8* linesize, linesize, bS+4, 1, qp [1] ); if (chroma){ - filter_mb_mbaff_edgecv( h, img_cb, uvlinesize, bS , 1, bqp[0] ); - filter_mb_mbaff_edgecv( h, img_cb + 4*uvlinesize, uvlinesize, bS+4, 1, bqp[1] ); - filter_mb_mbaff_edgecv( h, img_cr, uvlinesize, bS , 1, rqp[0] ); - filter_mb_mbaff_edgecv( h, img_cr + 4*uvlinesize, uvlinesize, bS+4, 1, rqp[1] ); + if (CHROMA444) { + filter_mb_mbaff_edgev ( h, img_cb, uvlinesize, bS , 1, bqp[0] ); + filter_mb_mbaff_edgev ( h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1] ); + filter_mb_mbaff_edgev ( h, img_cr, uvlinesize, bS , 1, rqp[0] ); + filter_mb_mbaff_edgev ( h, img_cr + 8*uvlinesize, uvlinesize, bS+4, 1, rqp[1] ); + }else{ + filter_mb_mbaff_edgecv( h, img_cb, uvlinesize, bS , 1, bqp[0] ); + filter_mb_mbaff_edgecv( h, img_cb + 4*uvlinesize, uvlinesize, bS+4, 1, bqp[1] ); + filter_mb_mbaff_edgecv( h, img_cr, uvlinesize, bS , 1, rqp[0] ); + filter_mb_mbaff_edgecv( h, img_cr + 4*uvlinesize, uvlinesize, bS+4, 1, rqp[1] ); + } } }else{ filter_mb_mbaff_edgev ( h, img_y , 2* linesize, bS , 2, qp [0] ); filter_mb_mbaff_edgev ( h, img_y + linesize, 2* linesize, bS+1, 2, qp [1] ); if (chroma){ - filter_mb_mbaff_edgecv( h, img_cb, 2*uvlinesize, bS , 2, bqp[0] ); - filter_mb_mbaff_edgecv( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] ); - filter_mb_mbaff_edgecv( h, img_cr, 2*uvlinesize, bS , 2, rqp[0] ); - filter_mb_mbaff_edgecv( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] ); + if (CHROMA444) { + filter_mb_mbaff_edgev ( h, img_cb, 2*uvlinesize, bS , 2, bqp[0] ); + filter_mb_mbaff_edgev ( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] ); + filter_mb_mbaff_edgev ( h, img_cr, 2*uvlinesize, bS , 2, rqp[0] ); + filter_mb_mbaff_edgev ( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] ); + }else{ + filter_mb_mbaff_edgecv( h, img_cb, 2*uvlinesize, bS , 2, bqp[0] ); + filter_mb_mbaff_edgecv( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] ); + filter_mb_mbaff_edgecv( h, img_cr, 2*uvlinesize, bS , 2, rqp[0] ); + filter_mb_mbaff_edgecv( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] ); + } } } } From 2702a6f114f996ddfb334f1d8ddfae50e2c7eef7 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 22 Jun 2011 02:34:02 -0700 Subject: [PATCH 05/11] H.264: fix 4:4:4 + deblocking + 8x8dct + cavlc + MBAFF --- libavcodec/h264_loopfilter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c index b88c338804..86ecb2737f 100644 --- a/libavcodec/h264_loopfilter.c +++ b/libavcodec/h264_loopfilter.c @@ -393,10 +393,10 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u AV_WN64A(bS, 0x0003000300030003ULL); } else { if(!CABAC && IS_8x8DCT(s->current_picture.mb_type[mbn_xy])){ - bS[0]= 1+((h->cbp_table[mbn_xy] & 4)||h->non_zero_count_cache[scan8[0]+0]); - bS[1]= 1+((h->cbp_table[mbn_xy] & 4)||h->non_zero_count_cache[scan8[0]+1]); - bS[2]= 1+((h->cbp_table[mbn_xy] & 8)||h->non_zero_count_cache[scan8[0]+2]); - bS[3]= 1+((h->cbp_table[mbn_xy] & 8)||h->non_zero_count_cache[scan8[0]+3]); + bS[0]= 1+((h->cbp_table[mbn_xy] & 0x4000)||h->non_zero_count_cache[scan8[0]+0]); + bS[1]= 1+((h->cbp_table[mbn_xy] & 0x4000)||h->non_zero_count_cache[scan8[0]+1]); + bS[2]= 1+((h->cbp_table[mbn_xy] & 0x8000)||h->non_zero_count_cache[scan8[0]+2]); + bS[3]= 1+((h->cbp_table[mbn_xy] & 0x8000)||h->non_zero_count_cache[scan8[0]+3]); }else{ const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 3*4; int i; @@ -635,7 +635,7 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint else{ bS[i] = 1 + !!(h->non_zero_count_cache[12+8*(i>>1)] | ((!h->pps.cabac && IS_8x8DCT(mbn_type)) ? - (h->cbp_table[mbn_xy] & ((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2)) + (h->cbp_table[mbn_xy] & (((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2) << 12)) : h->non_zero_count[mbn_xy][ off[i] ])); } From 0e4dbe2996cad6d5e0b1c1d702306f3bd8499df9 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 21 Jun 2011 13:39:02 -0400 Subject: [PATCH 06/11] ac3enc: avoid masking output in asym_quant() by using signed values for quantized mantissas. --- libavcodec/ac3enc.c | 22 +++++++++++----------- libavcodec/ac3enc.h | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 3426bd252a..1db69414a5 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -46,7 +46,7 @@ #include "eac3enc.h" typedef struct AC3Mant { - uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; ///< mantissa pointers for bap=1,2,4 + int16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; ///< mantissa pointers for bap=1,2,4 int mant1_cnt, mant2_cnt, mant4_cnt; ///< mantissa counts for bap=1,2,4 } AC3Mant; @@ -1136,7 +1136,7 @@ static inline int asym_quant(int c, int e, int qbits) if (v >= m) v = m - 1; av_assert2(v >= -m); - return v & ((1 << qbits)-1); + return v; } @@ -1145,7 +1145,7 @@ static inline int asym_quant(int c, int e, int qbits) */ static void quantize_mantissas_blk_ch(AC3Mant *s, int32_t *fixed_coef, uint8_t *exp, uint8_t *bap, - uint16_t *qmant, int start_freq, + int16_t *qmant, int start_freq, int end_freq) { int i; @@ -1497,14 +1497,14 @@ static void output_audio_block(AC3EncodeContext *s, int blk) q = block->qmant[ch][i]; b = s->ref_bap[ch][blk][i]; switch (b) { - case 0: break; - case 1: if (q != 128) put_bits(&s->pb, 5, q); break; - case 2: if (q != 128) put_bits(&s->pb, 7, q); break; - case 3: put_bits(&s->pb, 3, q); break; - case 4: if (q != 128) put_bits(&s->pb, 7, q); break; - case 14: put_bits(&s->pb, 14, q); break; - case 15: put_bits(&s->pb, 16, q); break; - default: put_bits(&s->pb, b-1, q); break; + case 0: break; + case 1: if (q != 128) put_bits (&s->pb, 5, q); break; + case 2: if (q != 128) put_bits (&s->pb, 7, q); break; + case 3: put_sbits(&s->pb, 3, q); break; + case 4: if (q != 128) put_bits (&s->pb, 7, q); break; + case 14: put_sbits(&s->pb, 14, q); break; + case 15: put_sbits(&s->pb, 16, q); break; + default: put_sbits(&s->pb, b-1, q); break; } } if (ch == CPL_CH) diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h index bf25298940..01abe94e0d 100644 --- a/libavcodec/ac3enc.h +++ b/libavcodec/ac3enc.h @@ -212,7 +212,7 @@ typedef struct AC3EncodeContext { int16_t *psd_buffer; int16_t *band_psd_buffer; int16_t *mask_buffer; - uint16_t *qmant_buffer; + int16_t *qmant_buffer; uint8_t *cpl_coord_exp_buffer; uint8_t *cpl_coord_mant_buffer; From f21fb76b1be18036c93c3e29fe1889a9fabf30b3 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 21 Jun 2011 16:14:19 -0400 Subject: [PATCH 07/11] ac3enc: remove a branch in asym_quant() by doing 2 shifts --- libavcodec/ac3enc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 1db69414a5..db45c8360e 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1123,15 +1123,9 @@ static inline int sym_quant(int c, int e, int levels) */ static inline int asym_quant(int c, int e, int qbits) { - int lshift, m, v; + int m, v; - lshift = e + qbits - 24; - if (lshift >= 0) - v = c << lshift; - else - v = c >> (-lshift); - /* rounding */ - v = (v + 1) >> 1; + v = (((c << e) >> (24 - qbits)) + 1) >> 1; m = (1 << (qbits-1)); if (v >= m) v = m - 1; From 684f4abfac6e007d3481e06e1c0777b826e3ba42 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 21 Jun 2011 16:49:16 -0400 Subject: [PATCH 08/11] ac3enc: remove unneeded local variable in asym_quant() --- libavcodec/ac3enc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index db45c8360e..1f7d05e87c 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1123,14 +1123,14 @@ static inline int sym_quant(int c, int e, int levels) */ static inline int asym_quant(int c, int e, int qbits) { - int m, v; + int m; - v = (((c << e) >> (24 - qbits)) + 1) >> 1; + c = (((c << e) >> (24 - qbits)) + 1) >> 1; m = (1 << (qbits-1)); - if (v >= m) - v = m - 1; - av_assert2(v >= -m); - return v; + if (c >= m) + c = m - 1; + av_assert2(c >= -m); + return c; } From 698a183e30a5803537ded99e4b7aee640373575c Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 6 Jun 2011 19:44:29 +0100 Subject: [PATCH 09/11] build: move test rules to tests/Makefile Signed-off-by: Mans Rullgard --- Makefile | 123 ++----------------------------------------------- configure | 1 + tests/Makefile | 121 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 120 deletions(-) create mode 100644 tests/Makefile diff --git a/Makefile b/Makefile index 084e175b90..47d0429c0d 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,6 @@ tools/%.o: tools/%.c $(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $< -include $(wildcard tools/*.d) --include $(wildcard tests/*.d) VERSION_SH = $(SRC_PATH_BARE)/version.sh GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD @@ -163,13 +162,7 @@ uninstall-data: uninstall-man: $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES)) -testclean: - $(RM) -r tests/vsynth1 tests/vsynth2 tests/data - $(RM) $(addprefix tests/,$(CLEANSUFFIXES)) - $(RM) tests/seek_test$(EXESUF) tests/seek_test.o - $(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF)) - -clean:: testclean +clean:: $(RM) $(ALLPROGS) $(RM) $(CLEANSUFFIXES) $(RM) doc/*.html doc/*.pod doc/*.1 @@ -183,119 +176,9 @@ distclean:: config: $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION) -# regression tests - check: test checkheaders -fulltest test: codectest lavftest lavfitest seektest - -FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref - -codectest: fate-codec -lavftest: fate-lavf -lavfitest: fate-lavfi -seektest: fate-seek - -AREF = fate-acodec-aref -VREF = fate-vsynth1-vref fate-vsynth2-vref -REFS = $(AREF) $(VREF) - -$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm -$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw - -ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw - @echo - @echo "Unfortunately ffserver is broken and therefore its regression" - @echo "test fails randomly. Treat the results accordingly." - @echo - $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf - -tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF) - @mkdir -p tests/vsynth1 - $(M)./$< 'tests/vsynth1/' - -tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF) - @mkdir -p tests/vsynth2 - $(M)./$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm - -tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF) - @mkdir -p tests/data - $(M)./$< $@ - -tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN - -tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS) - $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) - -tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS) - $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) - -include $(SRC_PATH_BARE)/tests/fate.mak -include $(SRC_PATH_BARE)/tests/fate2.mak - -include $(SRC_PATH_BARE)/tests/fate/aac.mak -include $(SRC_PATH_BARE)/tests/fate/als.mak -include $(SRC_PATH_BARE)/tests/fate/fft.mak -include $(SRC_PATH_BARE)/tests/fate/h264.mak -include $(SRC_PATH_BARE)/tests/fate/mp3.mak -include $(SRC_PATH_BARE)/tests/fate/vorbis.mak -include $(SRC_PATH_BARE)/tests/fate/vp8.mak - -FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%) -FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%) -FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%) -FATE_VCODEC = $(FATE_VSYNTH1) $(FATE_VSYNTH2) -FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%) -FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%) -FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%) - -FATE = $(FATE_ACODEC) \ - $(FATE_VCODEC) \ - $(FATE_LAVF) \ - $(FATE_LAVFI) \ - $(FATE_SEEK) \ - -$(filter-out %-aref,$(FATE_ACODEC)): $(AREF) -$(filter-out %-vref,$(FATE_VCODEC)): $(VREF) -$(FATE_LAVF): $(REFS) -$(FATE_LAVFI): $(REFS) tools/lavfi-showfiltfmts$(EXESUF) -$(FATE_SEEK): fate-codec fate-lavf tests/seek_test$(EXESUF) - -$(FATE_ACODEC): CMD = codectest acodec -$(FATE_VSYNTH1): CMD = codectest vsynth1 -$(FATE_VSYNTH2): CMD = codectest vsynth2 -$(FATE_LAVF): CMD = lavftest -$(FATE_LAVFI): CMD = lavfitest -$(FATE_SEEK): CMD = seektest - -fate-codec: fate-acodec fate-vcodec -fate-acodec: $(FATE_ACODEC) -fate-vcodec: $(FATE_VCODEC) -fate-lavf: $(FATE_LAVF) -fate-lavfi: $(FATE_LAVFI) -fate-seek: $(FATE_SEEK) - -ifdef SAMPLES -FATE += $(FATE_TESTS) -fate-rsync: - rsync -vaLW rsync://fate-suite.libav.org/fate-suite/ $(SAMPLES) -else -fate-rsync: - @echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite" -$(FATE_TESTS): - @echo "SAMPLES not specified, cannot run FATE" -endif - -FATE_UTILS = base64 tiny_psnr - -fate: $(FATE) - -$(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) - @echo "TEST $(@:fate-%=%)" - $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' - -fate-list: - @printf '%s\n' $(sort $(FATE)) +include tests/Makefile .PHONY: all alltools *clean check config documentation examples install* -.PHONY: *test testprogs uninstall* +.PHONY: testprogs uninstall* diff --git a/configure b/configure index b26394ec29..d9a768e4d8 100755 --- a/configure +++ b/configure @@ -3231,6 +3231,7 @@ if enabled source_path_used; then libavutil/Makefile libpostproc/Makefile libswscale/Makefile + tests/Makefile " map 'mkdir -p $v' $DIRS; map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000000..1f7ba26aff --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,121 @@ +fulltest test: codectest lavftest lavfitest seektest + +FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref + +codectest: fate-codec +lavftest: fate-lavf +lavfitest: fate-lavfi +seektest: fate-seek + +AREF = fate-acodec-aref +VREF = fate-vsynth1-vref fate-vsynth2-vref +REFS = $(AREF) $(VREF) + +$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm +$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw + +ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw + @echo + @echo "Unfortunately ffserver is broken and therefore its regression" + @echo "test fails randomly. Treat the results accordingly." + @echo + $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf + +tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF) + @mkdir -p tests/vsynth1 + $(M)./$< 'tests/vsynth1/' + +tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF) + @mkdir -p tests/vsynth2 + $(M)./$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm + +tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF) + @mkdir -p tests/data + $(M)./$< $@ + +tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN + +tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS) + $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) + +tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS) + $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) + +include $(SRC_PATH_BARE)/tests/fate.mak +include $(SRC_PATH_BARE)/tests/fate2.mak + +include $(SRC_PATH_BARE)/tests/fate/aac.mak +include $(SRC_PATH_BARE)/tests/fate/als.mak +include $(SRC_PATH_BARE)/tests/fate/fft.mak +include $(SRC_PATH_BARE)/tests/fate/h264.mak +include $(SRC_PATH_BARE)/tests/fate/mp3.mak +include $(SRC_PATH_BARE)/tests/fate/vorbis.mak +include $(SRC_PATH_BARE)/tests/fate/vp8.mak + +FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%) +FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%) +FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%) +FATE_VCODEC = $(FATE_VSYNTH1) $(FATE_VSYNTH2) +FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%) +FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%) +FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%) + +FATE = $(FATE_ACODEC) \ + $(FATE_VCODEC) \ + $(FATE_LAVF) \ + $(FATE_LAVFI) \ + $(FATE_SEEK) \ + +$(filter-out %-aref,$(FATE_ACODEC)): $(AREF) +$(filter-out %-vref,$(FATE_VCODEC)): $(VREF) +$(FATE_LAVF): $(REFS) +$(FATE_LAVFI): $(REFS) tools/lavfi-showfiltfmts$(EXESUF) +$(FATE_SEEK): fate-codec fate-lavf tests/seek_test$(EXESUF) + +$(FATE_ACODEC): CMD = codectest acodec +$(FATE_VSYNTH1): CMD = codectest vsynth1 +$(FATE_VSYNTH2): CMD = codectest vsynth2 +$(FATE_LAVF): CMD = lavftest +$(FATE_LAVFI): CMD = lavfitest +$(FATE_SEEK): CMD = seektest + +fate-codec: fate-acodec fate-vcodec +fate-acodec: $(FATE_ACODEC) +fate-vcodec: $(FATE_VCODEC) +fate-lavf: $(FATE_LAVF) +fate-lavfi: $(FATE_LAVFI) +fate-seek: $(FATE_SEEK) + +ifdef SAMPLES +FATE += $(FATE_TESTS) +fate-rsync: + rsync -vaLW rsync://fate-suite.libav.org/fate-suite/ $(SAMPLES) +else +fate-rsync: + @echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite" +$(FATE_TESTS): + @echo "SAMPLES not specified, cannot run FATE" +endif + +FATE_UTILS = base64 tiny_psnr + +fate: $(FATE) + +$(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) + @echo "TEST $(@:fate-%=%)" + $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' + +fate-list: + @printf '%s\n' $(sort $(FATE)) + +clean:: testclean + +testclean: + $(RM) -r tests/vsynth1 tests/vsynth2 tests/data + $(RM) $(addprefix tests/,$(CLEANSUFFIXES)) + $(RM) tests/seek_test$(EXESUF) tests/seek_test.o + $(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF)) + +-include $(wildcard tests/*.d) + +.PHONY: fate* *test From f87b03b50d0b4632f95da5b5d6772ec8f2a7f16f Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 6 Jun 2011 18:03:22 +0100 Subject: [PATCH 10/11] build: move documentation rules to doc/Makefile Signed-off-by: Mans Rullgard --- Makefile | 41 +++-------------------------------------- configure | 1 + doc/Makefile | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 38 deletions(-) create mode 100644 doc/Makefile diff --git a/Makefile b/Makefile index 47d0429c0d..f4d03d42f8 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,6 @@ PROGS-$(CONFIG_FFSERVER) += ffserver PROGS := $(PROGS-yes:%=%$(EXESUF)) OBJS = $(PROGS-yes:%=%.o) cmdutils.o -MANPAGES = $(PROGS-yes:%=doc/%.1) -PODPAGES = $(PROGS-yes:%=doc/%.pod) -HTMLPAGES = $(PROGS-yes:%=doc/%.html) TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher)) TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 HOSTPROGS := $(TESTTOOLS:%=tests/%) @@ -48,8 +45,6 @@ FF_LDFLAGS := $(FFLDFLAGS) FF_EXTRALIBS := $(FFEXTRALIBS) FF_DEP_LIBS := $(DEP_LIBS) -all-$(CONFIG_DOC): documentation - all: $(FF_DEP_LIBS) $(PROGS) config.h: .config @@ -105,28 +100,6 @@ version.h .version: # force version.sh to run whenever version might have changed -include .version -DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES) - -documentation: $(DOCS) - --include $(wildcard $(DOCS:%=%.d)) - -TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d) - -doc/%.html: TAG = HTML -doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init - $(Q)$(TEXIDEP) - $(M)texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init --output $@ $< - -doc/%.pod: TAG = POD -doc/%.pod: doc/%.texi - $(Q)$(TEXIDEP) - $(M)doc/texi2pod.pl $< $@ - -doc/%.1: TAG = MAN -doc/%.1: doc/%.pod - $(M)pod2man --section=1 --center=" " --release=" " $< > $@ - ifdef PROGS install: install-progs install-data endif @@ -136,7 +109,6 @@ install: install-libs install-headers install-libs: install-libs-yes install-progs-yes: -install-progs-$(CONFIG_DOC): install-man install-progs-$(CONFIG_SHARED): install-libs install-progs: install-progs-yes $(PROGS) @@ -147,11 +119,7 @@ install-data: $(DATA_FILES) $(Q)mkdir -p "$(DATADIR)" $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)" -install-man: $(MANPAGES) - $(Q)mkdir -p "$(MANDIR)/man1" - $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1" - -uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data uninstall-man +uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data uninstall-progs: $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS)) @@ -159,13 +127,9 @@ uninstall-progs: uninstall-data: $(RM) -r "$(DATADIR)" -uninstall-man: - $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES)) - clean:: $(RM) $(ALLPROGS) $(RM) $(CLEANSUFFIXES) - $(RM) doc/*.html doc/*.pod doc/*.1 $(RM) $(TOOLS) $(RM) $(CLEANSUFFIXES:%=tools/%) @@ -178,7 +142,8 @@ config: check: test checkheaders +include doc/Makefile include tests/Makefile -.PHONY: all alltools *clean check config documentation examples install* +.PHONY: all alltools *clean check config examples install* .PHONY: testprogs uninstall* diff --git a/configure b/configure index d9a768e4d8..6f1560574f 100755 --- a/configure +++ b/configure @@ -3221,6 +3221,7 @@ if enabled source_path_used; then Makefile common.mak subdir.mak + doc/Makefile doc/texi2pod.pl libavcodec/Makefile libavcodec/${arch}/Makefile diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000000..a5e090b0cc --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,43 @@ +MANPAGES = $(PROGS-yes:%=doc/%.1) +PODPAGES = $(PROGS-yes:%=doc/%.pod) +HTMLPAGES = $(PROGS-yes:%=doc/%.html) + +DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES) + +all-$(CONFIG_DOC): documentation + +documentation: $(DOCS) + +TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d) + +doc/%.html: TAG = HTML +doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init + $(Q)$(TEXIDEP) + $(M)texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init --output $@ $< + +doc/%.pod: TAG = POD +doc/%.pod: doc/%.texi + $(Q)$(TEXIDEP) + $(M)doc/texi2pod.pl $< $@ + +doc/%.1: TAG = MAN +doc/%.1: doc/%.pod + $(M)pod2man --section=1 --center=" " --release=" " $< > $@ + +install-progs-$(CONFIG_DOC): install-man + +install-man: $(MANPAGES) + $(Q)mkdir -p "$(MANDIR)/man1" + $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1" + +uninstall: uninstall-man + +uninstall-man: + $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES)) + +clean:: + $(RM) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%) + +-include $(wildcard $(DOCS:%=%.d)) + +.PHONY: documentation From 9cd7b8549b71bcfced2062596fd9eecba092aeb1 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 19 Jun 2011 18:47:06 +0100 Subject: [PATCH 11/11] configure: add --optflags option This allows overriding the default optimisation flags selected by configure. Signed-off-by: Mans Rullgard --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 6f1560574f..4032e687ad 100755 --- a/configure +++ b/configure @@ -237,6 +237,7 @@ Advanced options (experts only): --malloc-prefix=PFX prefix malloc and related names with PFX --enable-sram allow use of on-chip SRAM --disable-symver disable symbol versioning + --optflags override optimization-related compiler flags Developer options (useful when working on Libav itself): --disable-debug disable debugging symbols @@ -1181,6 +1182,7 @@ CMDLINE_SET=" logfile malloc_prefix nm + optflags pkg_config samples sysinclude @@ -3004,7 +3006,9 @@ void ff_foo(void) {} EOF fi -if enabled small; then +if [ -n "$optflags" ]; then + add_cflags $optflags +elif enabled small; then add_cflags $size_cflags elif enabled optimizations; then add_cflags $speed_cflags