@@ -27,7 +27,6 @@
#include <string.h>
#include "libavutil/common.h"
-#include "libavutil/timer.h"
#include "cabac.h"
#include "cabac_functions.h"
@@ -25,7 +25,6 @@
*/
#include "libavutil/imgutils.h"
-#include "libavutil/timer.h"
#include "avcodec.h"
#include "blockdsp.h"
#define UNCHECKED_BITSTREAM_READER 1
@@ -607,13 +606,11 @@ static int dnxhd_decode_row(AVCodecContext *avctx, void *data,
return ret;
}
for (x = 0; x < ctx->mb_width; x++) {
- //START_TIMER;
int ret = dnxhd_decode_macroblock(ctx, row, data, x, rownb);
if (ret < 0) {
row->errors++;
return ret;
}
- //STOP_TIMER("decode macroblock");
}
return 0;
@@ -26,7 +26,6 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
-#include "libavutil/timer.h"
#include "avcodec.h"
#include "blockdsp.h"
@@ -933,9 +932,8 @@ static int dnxhd_encode_thread(AVCodecContext *avctx, void *arg,
int last_index = ctx->m.dct_quantize(&ctx->m, block,
ctx->is_444 ? (((i >> 1) % 3) < 1 ? 0 : 4): 4 & (2*i),
qscale, &overflow);
- // START_TIMER;
+
dnxhd_encode_block(ctx, block, last_index, n);
- // STOP_TIMER("encode_block");
}
}
if (put_bits_count(&ctx->m.pb) & 31)
@@ -31,7 +31,6 @@
#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
-#include "libavutil/timer.h"
#include "avcodec.h"
#include "internal.h"
@@ -33,7 +33,6 @@
#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
-#include "libavutil/timer.h"
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
@@ -30,7 +30,6 @@
#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
-#include "libavutil/timer.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
@@ -138,7 +137,6 @@ static int decode_plane(FFV1Context *s, uint8_t *src,
sample[1][-1] = sample[0][0];
sample[0][w] = sample[0][w - 1];
-// { START_TIMER
if (s->avctx->bits_per_raw_sample <= 8) {
int ret = decode_line(s, w, sample, plane_index, 8);
if (ret < 0)
@@ -159,7 +157,6 @@ static int decode_plane(FFV1Context *s, uint8_t *src,
}
}
}
-// STOP_TIMER("decode-line") }
}
return 0;
}
@@ -31,7 +31,6 @@
#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
-#include "libavutil/timer.h"
#include "avcodec.h"
#include "internal.h"
@@ -287,7 +286,6 @@ static int encode_plane(FFV1Context *s, uint8_t *src, int w, int h,
sample[0][-1]= sample[1][0 ];
sample[1][ w]= sample[1][w-1];
-// { START_TIMER
if (s->bits_per_raw_sample <= 8) {
for (x = 0; x < w; x++)
sample[0][x] = src[x * pixel_stride + stride * y];
@@ -306,7 +304,6 @@ static int encode_plane(FFV1Context *s, uint8_t *src, int w, int h,
if((ret = encode_line(s, w, sample, plane_index, s->bits_per_raw_sample)) < 0)
return ret;
}
-// STOP_TIMER("encode line") }
}
return 0;
}
@@ -31,7 +31,6 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
-#include "libavutil/timer.h"
#include "config.h"
#include "cabac.h"
#include "cabac_functions.h"
@@ -1895,9 +1894,7 @@ static av_always_inline void decode_cabac_luma_residual(const H264Context *h, H2
qmul = h->ps.pps->dequant4_coeff[cqm][qscale];
for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
const int index = 16*p + 4*i8x8 + i4x4;
-//START_TIMER
decode_cabac_residual_nondc(h, sl, sl->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16);
-//STOP_TIMER("decode_residual")
}
}
} else {
@@ -27,7 +27,6 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
-#include "libavutil/timer.h"
#include "internal.h"
#include "cabac.h"
#include "cabac_functions.h"
@@ -29,7 +29,6 @@
#include "libavutil/display.h"
#include "libavutil/imgutils.h"
#include "libavutil/stereo3d.h"
-#include "libavutil/timer.h"
#include "internal.h"
#include "cabac.h"
#include "cabac_functions.h"
@@ -2621,7 +2620,6 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
ff_h264_init_cabac_states(h, sl);
for (;;) {
- // START_TIMER
int ret, eos;
if (sl->mb_x + sl->mb_y * h->mb_width >= sl->next_slice_idx) {
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps with next at %d\n",
@@ -2632,7 +2630,6 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
}
ret = ff_h264_decode_mb_cabac(h, sl);
- // STOP_TIMER("decode_mb_cabac")
if (ret >= 0)
ff_h264_hl_decode_mb(h, sl);
@@ -32,7 +32,6 @@
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/stereo3d.h"
-#include "libavutil/timer.h"
#include "internal.h"
#include "bytestream.h"
#include "cabac.h"
@@ -30,7 +30,6 @@
#include "libavutil/attributes.h"
#include "libavutil/imgutils.h"
-#include "libavutil/timer.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
@@ -1124,8 +1123,6 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
ctx->switch_buffers(ctx);
- //{ START_TIMER;
-
if (ctx->is_nonnull_frame(ctx)) {
ctx->buf_invalid[ctx->dst_buf] = 1;
for (p = 0; p < 3; p++) {
@@ -1151,8 +1148,6 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (ctx->buf_invalid[ctx->dst_buf])
return -1;
- //STOP_TIMER("decode_planes"); }
-
if (!ctx->is_nonnull_frame(ctx))
return buf_size;
@@ -32,7 +32,6 @@
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/motion_vector.h"
-#include "libavutil/timer.h"
#include "avcodec.h"
#include "blockdsp.h"
#include "h264chroma.h"
@@ -469,7 +468,6 @@ int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
MpegEncContext bak;
int i, ret;
// FIXME copy only needed parts
- // START_TIMER
backup_duplicate_context(&bak, dst);
memcpy(dst, src, sizeof(MpegEncContext));
backup_duplicate_context(dst, &bak);
@@ -487,8 +485,6 @@ int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
"scratch buffers.\n");
return ret;
}
- // STOP_TIMER("update_duplicate_context")
- // about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads
return 0;
}
@@ -38,7 +38,6 @@
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
-#include "libavutil/timer.h"
#include "avcodec.h"
#include "dct.h"
#include "idctdsp.h"
@@ -4262,7 +4261,6 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
return last_non_zero;
}
-//#define REFINE_STATS 1
static int16_t basis[64][64];
static void build_basis(uint8_t *perm){
@@ -4301,15 +4299,6 @@ static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise?
uint8_t * last_length;
int lambda;
int rle_index, run, q = 1, sum; //q is only used when s->mb_intra is true
-#ifdef REFINE_STATS
-static int count=0;
-static int after_last=0;
-static int to_zero=0;
-static int from_zero=0;
-static int raise=0;
-static int lower=0;
-static int messed_sign=0;
-#endif
if(basis[0][0] == 0)
build_basis(s->idsp.idct_permutation);
@@ -4353,16 +4342,11 @@ static int messed_sign=0;
}
last_non_zero = s->block_last_index[n];
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
dc += (1<<(RECON_SHIFT-1));
for(i=0; i<64; i++){
rem[i] = dc - (orig[i] << RECON_SHIFT); // FIXME use orig directly instead of copying to rem[]
}
-#ifdef REFINE_STATS
-STOP_TIMER("memset rem[]")}
-#endif
+
sum=0;
for(i=0; i<64; i++){
int one= 36;
@@ -4380,9 +4364,7 @@ STOP_TIMER("memset rem[]")}
sum += w*w;
}
lambda= sum*(uint64_t)s->lambda2 >> (FF_LAMBDA_SHIFT - 6 + 6 + 6 + 6);
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
+
run=0;
rle_index=0;
for(i=start_i; i<=last_non_zero; i++){
@@ -4401,41 +4383,21 @@ STOP_TIMER("memset rem[]")}
run++;
}
}
-#ifdef REFINE_STATS
-if(last_non_zero>0){
-STOP_TIMER("init rem[]")
-}
-}
-{START_TIMER
-#endif
for(;;){
int best_score = s->mpvencdsp.try_8x8basis(rem, weight, basis[0], 0);
int best_coeff=0;
int best_change=0;
int run2, best_unquant_change=0, analyze_gradient;
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
analyze_gradient = last_non_zero > 2 || s->quantizer_noise_shaping >= 3;
if(analyze_gradient){
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
for(i=0; i<64; i++){
int w= weight[i];
d1[i] = (rem[i]*w*w + (1<<(RECON_SHIFT+12-1)))>>(RECON_SHIFT+12);
}
-#ifdef REFINE_STATS
-STOP_TIMER("rem*w*w")}
-{START_TIMER
-#endif
s->fdsp.fdct(d1);
-#ifdef REFINE_STATS
-STOP_TIMER("dct")}
-#endif
}
if(start_i){
@@ -4597,9 +4559,6 @@ STOP_TIMER("dct")}
run++;
}
}
-#ifdef REFINE_STATS
-STOP_TIMER("iterative step")}
-#endif
if(best_change){
int j= perm_scantable[ best_coeff ];
@@ -4609,36 +4568,13 @@ STOP_TIMER("iterative step")}
if(best_coeff > last_non_zero){
last_non_zero= best_coeff;
av_assert2(block[j]);
-#ifdef REFINE_STATS
-after_last++;
-#endif
}else{
-#ifdef REFINE_STATS
-if(block[j]){
- if(block[j] - best_change){
- if(FFABS(block[j]) > FFABS(block[j] - best_change)){
- raise++;
- }else{
- lower++;
- }
- }else{
- from_zero++;
- }
-}else{
- to_zero++;
-}
-#endif
for(; last_non_zero>=start_i; last_non_zero--){
if(block[perm_scantable[last_non_zero]])
break;
}
}
-#ifdef REFINE_STATS
-count++;
-if(256*256*256*64 % count == 0){
- av_log(s->avctx, AV_LOG_DEBUG, "after_last:%d to_zero:%d from_zero:%d raise:%d lower:%d sign:%d xyp:%d/%d/%d\n", after_last, to_zero, from_zero, raise, lower, messed_sign, s->mb_x, s->mb_y, s->picture_number);
-}
-#endif
+
run=0;
rle_index=0;
for(i=start_i; i<=last_non_zero; i++){
@@ -4658,12 +4594,6 @@ if(256*256*256*64 % count == 0){
break;
}
}
-#ifdef REFINE_STATS
-if(last_non_zero>0){
-STOP_TIMER("iterative search")
-}
-}
-#endif
return last_non_zero;
}
@@ -407,7 +407,7 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, int step,
const int QP= c->QP;
const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;
const int dcThreshold= dcOffset*2 + 1;
-//START_TIMER
+
src+= step*4; // src points to begin of the 8x8 Block
for(y=0; y<8; y++){
int numEq= 0;
@@ -511,11 +511,6 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, int step,
src += stride;
}
-/*if(step==16){
- STOP_TIMER("step16")
-}else{
- STOP_TIMER("stepX")
-}*/
}
//Note: we have C, MMX, MMX2, 3DNOW version there is no 3DNOW+MMX2 one
@@ -2548,7 +2548,7 @@ static av_always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int st
int64_t dc_mask, eq_mask, both_masks;
int64_t sums[10*8*2];
src+= step*3; // src points to begin of the 8x8 Block
- //{ START_TIMER
+
__asm__ volatile(
"movq %0, %%mm7 \n\t"
"movq %1, %%mm6 \n\t"
@@ -3071,12 +3071,6 @@ static av_always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int st
: "%"FF_REG_a
);
}
-/*if(step==16){
- STOP_TIMER("step16")
-}else{
- STOP_TIMER("stepX")
-}
- } */
}
#endif //TEMPLATE_PP_MMX
as well as includes of libavutil/timer.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavcodec/cabac.c | 1 - libavcodec/dnxhddec.c | 3 -- libavcodec/dnxhdenc.c | 4 +- libavcodec/ffv1.c | 1 - libavcodec/ffv1.h | 1 - libavcodec/ffv1dec.c | 3 -- libavcodec/ffv1enc.c | 3 -- libavcodec/h264_cabac.c | 3 -- libavcodec/h264_picture.c | 1 - libavcodec/h264_slice.c | 3 -- libavcodec/h264dec.c | 1 - libavcodec/ivi.c | 5 -- libavcodec/mpegvideo.c | 4 -- libavcodec/mpegvideo_enc.c | 76 ++---------------------------- libpostproc/postprocess.c | 7 +-- libpostproc/postprocess_template.c | 8 +--- 16 files changed, 6 insertions(+), 118 deletions(-)