abstract apply_temporal_filter

allow for optimized versions of apply_temporal_filter
(now vp8_apply_temporal_filter_c)

the function was previously declared as static and appears to have been
inlined. with this change, that's no longer possible. performance takes
a small hit.

the declaration for vp8_cx_temp_filter_c was moved to onyx_if.c because
of a circular dependency. for rtcd, temporal_filter.h holds the
definition for the rtcd table, so it needs to be included by onyx_int.h.
however, onyx_int.h holds the definition for VP8_COMP which is needed
for the function prototype. blah.

Change-Id: I499c055fdc652ac4659c21c5a55fe10ceb7e95e3
This commit is contained in:
Johann 2010-11-29 14:21:11 -05:00
parent 6cb708d501
commit 092b5bef37
5 changed files with 60 additions and 27 deletions

View File

@ -94,6 +94,8 @@ void vp8_cmachine_specific_config(VP8_COMP *cpi)
cpi->rtcd.search.full_search = vp8_full_search_sad; cpi->rtcd.search.full_search = vp8_full_search_sad;
cpi->rtcd.search.diamond_search = vp8_diamond_search_sad; cpi->rtcd.search.diamond_search = vp8_diamond_search_sad;
cpi->rtcd.temporal.filter = vp8_apply_temporal_filter_c;
#endif #endif
// Pure C: // Pure C:

View File

@ -73,6 +73,7 @@ int vp8_estimate_entropy_savings(VP8_COMP *cpi);
int vp8_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, const vp8_variance_rtcd_vtable_t *rtcd); int vp8_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, const vp8_variance_rtcd_vtable_t *rtcd);
int vp8_calc_low_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, const vp8_variance_rtcd_vtable_t *rtcd); int vp8_calc_low_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, const vp8_variance_rtcd_vtable_t *rtcd);
extern void vp8cx_temp_filter_c(VP8_COMP *cpi);
static void set_default_lf_deltas(VP8_COMP *cpi); static void set_default_lf_deltas(VP8_COMP *cpi);

View File

@ -27,6 +27,7 @@
#include "vpx_ports/mem.h" #include "vpx_ports/mem.h"
#include "vpx/internal/vpx_codec_internal.h" #include "vpx/internal/vpx_codec_internal.h"
#include "mcomp.h" #include "mcomp.h"
#include "temporal_filter.h"
//#define SPEEDSTATS 1 //#define SPEEDSTATS 1
#define MIN_GF_INTERVAL 4 #define MIN_GF_INTERVAL 4
@ -228,6 +229,7 @@ typedef struct VP8_ENCODER_RTCD
vp8_encodemb_rtcd_vtable_t encodemb; vp8_encodemb_rtcd_vtable_t encodemb;
vp8_quantize_rtcd_vtable_t quantize; vp8_quantize_rtcd_vtable_t quantize;
vp8_search_rtcd_vtable_t search; vp8_search_rtcd_vtable_t search;
vp8_temporal_rtcd_vtable_t temporal;
} VP8_ENCODER_RTCD; } VP8_ENCODER_RTCD;
enum enum

View File

@ -111,7 +111,7 @@ static void build_predictors_mb
RECON_INVOKE(&x->rtcd->recon, copy8x8)(vptr, stride, &pred[320], 8); RECON_INVOKE(&x->rtcd->recon, copy8x8)(vptr, stride, &pred[320], 8);
} }
} }
static void apply_temporal_filter void vp8_apply_temporal_filter_c
( (
unsigned char *frame1, unsigned char *frame1,
unsigned int stride, unsigned int stride,
@ -440,32 +440,35 @@ static void vp8cx_temp_blur1_c
predictor ); predictor );
// Apply the filter (YUV) // Apply the filter (YUV)
apply_temporal_filter ( f->y_buffer + mb_y_offset, TEMPORAL_INVOKE(&cpi->rtcd.temporal, filter)
f->y_stride, (f->y_buffer + mb_y_offset,
predictor, f->y_stride,
16, predictor,
strength, 16,
filter_weight[frame], strength,
accumulator, filter_weight[frame],
count ); accumulator,
count);
apply_temporal_filter ( f->u_buffer + mb_uv_offset, TEMPORAL_INVOKE(&cpi->rtcd.temporal, filter)
f->uv_stride, (f->u_buffer + mb_uv_offset,
predictor + 256, f->uv_stride,
8, predictor + 256,
strength, 8,
filter_weight[frame], strength,
accumulator + 256, filter_weight[frame],
count + 256 ); accumulator + 256,
count + 256);
apply_temporal_filter ( f->v_buffer + mb_uv_offset, TEMPORAL_INVOKE(&cpi->rtcd.temporal, filter)
f->uv_stride, (f->v_buffer + mb_uv_offset,
predictor + 320, f->uv_stride,
8, predictor + 320,
strength, 8,
filter_weight[frame], strength,
accumulator + 320, filter_weight[frame],
count + 320 ); accumulator + 320,
count + 320);
} }
} }

View File

@ -12,8 +12,33 @@
#ifndef __INC_VP8_TEMPORAL_FILTER_H #ifndef __INC_VP8_TEMPORAL_FILTER_H
#define __INC_VP8_TEMPORAL_FILTER_H #define __INC_VP8_TEMPORAL_FILTER_H
#include "onyx_int.h" #define prototype_filter(sym)\
void (sym) \
( \
unsigned char *frame1, \
unsigned int stride, \
unsigned char *frame2, \
unsigned int block_size, \
int strength, \
int filter_weight, \
unsigned int *accumulator, \
unsigned int *count \
)
void vp8cx_temp_filter_c(VP8_COMP *cpi); #ifndef vp8_temporal_filter
#define vp8_temporal_filter vp8_apply_temporal_filter_c
#endif
extern prototype_filter(vp8_temporal_filter);
typedef struct
{
prototype_filter(*filter);
} vp8_temporal_rtcd_vtable_t;
#if CONFIG_RUNTIME_CPU_DETECT
#define TEMPORAL_INVOKE(ctx,fn) (ctx)->fn
#else
#define TEMPORAL_INVOKE(ctx,fn) vp8_temporal_##fn
#endif
#endif // __INC_VP8_TEMPORAL_FILTER_H #endif // __INC_VP8_TEMPORAL_FILTER_H