From: John Koleszar Date: Mon, 13 Dec 2010 21:47:34 +0000 (-0500) Subject: remove unused temporal preproc code X-Git-Tag: 1.0_branch~763^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1aa54ab26656cee4aaebb550cb806580e98ab53;p=profile%2Fivi%2Flibvpx.git remove unused temporal preproc code This code is unused, as the current preproc implementation uses the same spatial filter that postproc uses. Change-Id: Ia06d5664917d67283f279e2480016bebed602ea7 --- diff --git a/vp8/common/preproc.h b/vp8/common/preproc.h deleted file mode 100644 index 0b142bd..0000000 --- a/vp8/common/preproc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : preproc.h -* -* Description : simple preprocessor -* -****************************************************************************/ - -#ifndef __INC_PREPROC_H -#define __INC_PREPROC_H - -/**************************************************************************** -* Types -****************************************************************************/ - -typedef struct -{ - unsigned char *frame_buffer; - int frame; - unsigned int *fixed_divide; - - unsigned char *frame_buffer_alloc; - unsigned int *fixed_divide_alloc; -} pre_proc_instance; - -/**************************************************************************** -* Functions. -****************************************************************************/ -void pre_proc_machine_specific_config(void); -void delete_pre_proc(pre_proc_instance *ppi); -int init_pre_proc(pre_proc_instance *ppi, int frame_size); -extern void spatial_filter_c(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int width, int height, int pitch, int strength); -extern void (*temp_filter)(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int bytes, int strength); - -#endif diff --git a/vp8/common/preprocif.h b/vp8/common/preprocif.h deleted file mode 100644 index 7d554b5..0000000 --- a/vp8/common/preprocif.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : preproc_if.h -* -* Description : Pre-processor interface header file. -* -****************************************************************************/ - -#ifndef __PREPROC_IF_H -#define __PREPROC_IF_H - -/**************************************************************************** -* Header Files -****************************************************************************/ -#include "type_aliases.h" - -/**************************************************************************** -* Types -****************************************************************************/ - -typedef struct -{ - UINT8 *Yuv0ptr; - UINT8 *Yuv1ptr; - - UINT8 *frag_info; // blocks coded : passed in - UINT32 frag_info_element_size; // size of each element - UINT32 frag_info_coded_mask; // mask to get at whether fragment is coded - - UINT32 *region_index; // Gives pixel index for top left of each block - UINT32 video_frame_height; - UINT32 video_frame_width; - UINT8 hfrag_pixels; - UINT8 vfrag_pixels; - -} SCAN_CONFIG_DATA; - -typedef enum -{ - SCP_FILTER_ON_OFF, - SCP_SET_SRF_OFFSET, - SCP_SET_EBO_ON_OFF, - SCP_SET_VCAP_LEVEL_OFFSET, - SCP_SET_SHOW_LOCAL - -} SCP_SETTINGS; - -typedef struct PP_INSTANCE *x_pp_inst; - -/**************************************************************************** -* Module statics -****************************************************************************/ -/* Controls whether Early break out is on or off in default case */ -#define EARLY_BREAKOUT_DEFAULT TRUE - -/**************************************************************************** -* Functions -****************************************************************************/ -extern void set_scan_param(x_pp_inst ppi, UINT32 param_id, INT32 param_value); -extern UINT32 yuvanalyse_frame(x_pp_inst ppi, UINT32 *KFIndicator); -extern x_pp_inst create_pp_instance(void); -extern void delete_pp_instance(x_pp_inst *); -extern BOOL scan_yuvinit(x_pp_inst, SCAN_CONFIG_DATA *scan_config_ptr); - -#endif diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index a003828..508190c 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -3882,7 +3882,6 @@ static void encode_frame_to_data_rate if (cm->frame_type == KEY_FRAME) { vp8_de_noise(cpi->Source, cpi->Source, l , 1, 0, RTCD(postproc)); - cpi->ppi.frame = 0; } else { @@ -3894,10 +3893,6 @@ static void encode_frame_to_data_rate { src += cpi->Source->y_stride * (cpi->Source->y_height - 1); } - - //temp_filter(&cpi->ppi,src,src, - // cm->last_frame.y_width * cm->last_frame.y_height, - // cpi->oxcf.noise_sensitivity); } } diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index 63f17aa..56938be 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -18,7 +18,6 @@ #include "treewriter.h" #include "tokenize.h" #include "onyxc_int.h" -#include "preproc.h" #include "variance.h" #include "dct.h" #include "encodemb.h" @@ -464,8 +463,6 @@ typedef struct unsigned char *output_partition2; size_t output_partition2size; - pre_proc_instance ppi; - int frames_to_key; int gfu_boost; int kf_boost; diff --git a/vp8/encoder/preproc.c b/vp8/encoder/preproc.c deleted file mode 100644 index bd918fa..0000000 --- a/vp8/encoder/preproc.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : preproc.c -* -* Description : Simple pre-processor. -* -****************************************************************************/ - -/**************************************************************************** -* Header Files -****************************************************************************/ - -#include "memory.h" -#include "preproc7.h" -#include "vpx_mem/vpx_mem.h" - -/**************************************************************************** -* Macros -****************************************************************************/ -#define FRAMECOUNT 7 -#define ROUNDUP32(X) ( ( ( (unsigned long) X ) + 31 )&( 0xFFFFFFE0 ) ) - -/**************************************************************************** -* Imports -****************************************************************************/ -extern void vp8_get_processor_flags(int *mmx_enabled, int *xmm_enabled, int *wmt_enabled); - -/**************************************************************************** -* Exported Global Variables -****************************************************************************/ -void (*temp_filter)(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int bytes, int strength); -void temp_filter_mmx -( - pre_proc_instance *ppi, - unsigned char *s, - unsigned char *d, - int bytes, - int strength -); -void temp_filter_wmt -( - pre_proc_instance *ppi, - unsigned char *s, - unsigned char *d, - int bytes, - int strength -); - -/**************************************************************************** - * - * ROUTINE : temp_filter_c - * - * INPUTS : pre_proc_instance *ppi : Pointer to pre-processor instance. - * unsigned char *s : Pointer to source frame. - * unsigned char *d : Pointer to destination frame. - * int bytes : Number of bytes to filter. - * int strength : Strength of filter to apply. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Performs a closesness adjusted temporarl blur - * - * SPECIAL NOTES : Destination frame can be same as source frame. - * - ****************************************************************************/ -void temp_filter_c -( - pre_proc_instance *ppi, - unsigned char *s, - unsigned char *d, - int bytes, - int strength -) -{ - int byte = 0; - unsigned char *frameptr = ppi->frame_buffer; - - if (ppi->frame == 0) - { - do - { - int frame = 0; - - do - { - *frameptr = s[byte]; - ++frameptr; - ++frame; - } - while (frame < FRAMECOUNT); - - d[byte] = s[byte]; - - ++byte; - } - while (byte < bytes); - } - else - { - int modifier; - int offset = (ppi->frame % FRAMECOUNT); - - do - { - int accumulator = 0; - int count = 0; - int frame = 0; - - frameptr[offset] = s[byte]; - - do - { - int pixel_value = *frameptr; - - modifier = s[byte]; - modifier -= pixel_value; - modifier *= modifier; - modifier >>= strength; - modifier *= 3; - - if (modifier > 16) - modifier = 16; - - modifier = 16 - modifier; - - accumulator += modifier * pixel_value; - - count += modifier; - - frameptr++; - - ++frame; - } - while (frame < FRAMECOUNT); - - accumulator += (count >> 1); - accumulator *= ppi->fixed_divide[count]; - accumulator >>= 16; - - d[byte] = accumulator; - - ++byte; - } - while (byte < bytes); - } - - ++ppi->frame; -} -/**************************************************************************** - * - * ROUTINE : delete_pre_proc - * - * INPUTS : pre_proc_instance *ppi : Pointer to pre-processor instance. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Deletes a pre-processing instance. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -void delete_pre_proc(pre_proc_instance *ppi) -{ - if (ppi->frame_buffer_alloc) - vpx_free(ppi->frame_buffer_alloc); - - ppi->frame_buffer_alloc = 0; - ppi->frame_buffer = 0; - - if (ppi->fixed_divide_alloc) - vpx_free(ppi->fixed_divide_alloc); - - ppi->fixed_divide_alloc = 0; - ppi->fixed_divide = 0; -} - -/**************************************************************************** - * - * ROUTINE : init_pre_proc - * - * INPUTS : pre_proc_instance *ppi : Pointer to pre-processor instance. - * int frame_size : Number of bytes in one frame. - * - * OUTPUTS : None. - * - * RETURNS : int: 1 if successful, 0 if failed. - * - * FUNCTION : Initializes prepprocessor instance. - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -int init_pre_proc7(pre_proc_instance *ppi, int frame_size) -{ - int i; - int mmx_enabled; - int xmm_enabled; - int wmt_enabled; - - vp8_get_processor_flags(&mmx_enabled, &xmm_enabled, &wmt_enabled); - - if (wmt_enabled) - temp_filter = temp_filter_wmt; - else if (mmx_enabled) - temp_filter = temp_filter_mmx; - else - temp_filter = temp_filter_c; - - - delete_pre_proc(ppi); - - ppi->frame_buffer_alloc = vpx_malloc(32 + frame_size * FRAMECOUNT * sizeof(unsigned char)); - - if (!ppi->frame_buffer_alloc) - { - delete_pre_proc(ppi); - return 0; - } - - ppi->frame_buffer = (unsigned char *) ROUNDUP32(ppi->frame_buffer_alloc); - - ppi->fixed_divide_alloc = vpx_malloc(32 + 255 * sizeof(unsigned int)); - - if (!ppi->fixed_divide_alloc) - { - delete_pre_proc(ppi); - return 0; - } - - ppi->fixed_divide = (unsigned int *) ROUNDUP32(ppi->fixed_divide_alloc); - - for (i = 1; i < 255; i++) - ppi->fixed_divide[i] = 0x10000 / i; - - return 1; -} diff --git a/vp8/encoder/x86/preproc_mmx.c b/vp8/encoder/x86/preproc_mmx.c deleted file mode 100644 index a182c88..0000000 --- a/vp8/encoder/x86/preproc_mmx.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#include "memory.h" -#include "preproc.h" -#include "pragmas.h" - -/**************************************************************************** -* Macros -****************************************************************************/ -#define FRAMECOUNT 7 -#define ROUNDUP32(X) ( ( ( (unsigned long) X ) + 31 )&( 0xFFFFFFE0 ) ) - -/**************************************************************************** -* Imports -****************************************************************************/ -extern void vpx_get_processor_flags(int *mmx_enabled, int *xmm_enabled, int *wmt_enabled); - -/**************************************************************************** -* Exported Global Variables -****************************************************************************/ -void (*temp_filter)(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int bytes, int strength); - -/**************************************************************************** - * - * ROUTINE : temp_filter_wmt - * - * INPUTS : pre_proc_instance *ppi : Pointer to pre-processor instance. - * unsigned char *s : Pointer to source frame. - * unsigned char *d : Pointer to destination frame. - * int bytes : Number of bytes to filter. - * int strength : Strength of filter to apply. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Performs a closesness adjusted temporarl blur - * - * SPECIAL NOTES : Destination frame can be same as source frame. - * - ****************************************************************************/ -void temp_filter_wmt -( - pre_proc_instance *ppi, - unsigned char *s, - unsigned char *d, - int bytes, - int strength -) -{ - int byte = 0; - unsigned char *frameptr = ppi->frame_buffer; - - __declspec(align(16)) unsigned short threes[] = { 3, 3, 3, 3, 3, 3, 3, 3}; - __declspec(align(16)) unsigned short sixteens[] = {16, 16, 16, 16, 16, 16, 16, 16}; - - if (ppi->frame == 0) - { - do - { - int i; - int frame = 0; - - do - { - for (i = 0; i < 8; i++) - { - *frameptr = s[byte+i]; - ++frameptr; - } - - ++frame; - } - while (frame < FRAMECOUNT); - - for (i = 0; i < 8; i++) - d[byte+i] = s[byte+i]; - - byte += 8; - - } - while (byte < bytes); - } - else - { - int i; - int offset2 = (ppi->frame % FRAMECOUNT); - - do - { - __declspec(align(16)) unsigned short counts[8]; - __declspec(align(16)) unsigned short sums[8]; - __asm - { - mov eax, offset2 - mov edi, s // source pixels - pxor xmm1, xmm1 // accumulator - - pxor xmm7, xmm7 - - mov esi, frameptr // accumulator - pxor xmm2, xmm2 // count - - movq xmm3, QWORD PTR [edi] - - movq QWORD PTR [esi+8*eax], xmm3 - - punpcklbw xmm3, xmm2 // xmm3 source pixels - mov ecx, FRAMECOUNT - - next_frame: - movq xmm4, QWORD PTR [esi] // get frame buffer values - punpcklbw xmm4, xmm7 // xmm4 frame buffer pixels - movdqa xmm6, xmm4 // save the pixel values - psubsw xmm4, xmm3 // subtracted pixel values - pmullw xmm4, xmm4 // square xmm4 - movd xmm5, strength - psrlw xmm4, xmm5 // should be strength - pmullw xmm4, threes // 3 * modifier - movdqa xmm5, sixteens // 16s - psubusw xmm5, xmm4 // 16 - modifiers - movdqa xmm4, xmm5 // save the modifiers - pmullw xmm4, xmm6 // multiplier values - paddusw xmm1, xmm4 // accumulator - paddusw xmm2, xmm5 // count - add esi, 8 // next frame - dec ecx // next set of eight pixels - jnz next_frame - - movdqa counts, xmm2 - psrlw xmm2, 1 // divide count by 2 for rounding - paddusw xmm1, xmm2 // rounding added in - - mov frameptr, esi - - movdqa sums, xmm1 - } - - for (i = 0; i < 8; i++) - { - int blurvalue = sums[i] * ppi->fixed_divide[counts[i]]; - blurvalue >>= 16; - d[i] = blurvalue; - } - - s += 8; - d += 8; - byte += 8; - } - while (byte < bytes); - } - - ++ppi->frame; - __asm emms -} - -/**************************************************************************** - * - * ROUTINE : temp_filter_mmx - * - * INPUTS : pre_proc_instance *ppi : Pointer to pre-processor instance. - * unsigned char *s : Pointer to source frame. - * unsigned char *d : Pointer to destination frame. - * int bytes : Number of bytes to filter. - * int strength : Strength of filter to apply. - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : Performs a closesness adjusted temporarl blur - * - * SPECIAL NOTES : Destination frame can be same as source frame. - * - ****************************************************************************/ -void temp_filter_mmx -( - pre_proc_instance *ppi, - unsigned char *s, - unsigned char *d, - int bytes, - int strength -) -{ - int byte = 0; - unsigned char *frameptr = ppi->frame_buffer; - - __declspec(align(16)) unsigned short threes[] = { 3, 3, 3, 3}; - __declspec(align(16)) unsigned short sixteens[] = {16, 16, 16, 16}; - - if (ppi->frame == 0) - { - do - { - int i; - int frame = 0; - - do - { - for (i = 0; i < 4; i++) - { - *frameptr = s[byte+i]; - ++frameptr; - } - - ++frame; - } - while (frame < FRAMECOUNT); - - for (i = 0; i < 4; i++) - d[byte+i] = s[byte+i]; - - byte += 4; - - } - while (byte < bytes); - } - else - { - int i; - int offset2 = (ppi->frame % FRAMECOUNT); - - do - { - __declspec(align(16)) unsigned short counts[8]; - __declspec(align(16)) unsigned short sums[8]; - __asm - { - - mov eax, offset2 - mov edi, s // source pixels - pxor mm1, mm1 // accumulator - pxor mm7, mm7 - - mov esi, frameptr // accumulator - pxor mm2, mm2 // count - - movd mm3, DWORD PTR [edi] - movd DWORD PTR [esi+4*eax], mm3 - - punpcklbw mm3, mm2 // mm3 source pixels - mov ecx, FRAMECOUNT - - next_frame: - movd mm4, DWORD PTR [esi] // get frame buffer values - punpcklbw mm4, mm7 // mm4 frame buffer pixels - movq mm6, mm4 // save the pixel values - psubsw mm4, mm3 // subtracted pixel values - pmullw mm4, mm4 // square mm4 - movd mm5, strength - psrlw mm4, mm5 // should be strength - pmullw mm4, threes // 3 * modifier - movq mm5, sixteens // 16s - psubusw mm5, mm4 // 16 - modifiers - movq mm4, mm5 // save the modifiers - pmullw mm4, mm6 // multiplier values - paddusw mm1, mm4 // accumulator - paddusw mm2, mm5 // count - add esi, 4 // next frame - dec ecx // next set of eight pixels - jnz next_frame - - movq counts, mm2 - psrlw mm2, 1 // divide count by 2 for rounding - paddusw mm1, mm2 // rounding added in - - mov frameptr, esi - - movq sums, mm1 - - } - - for (i = 0; i < 4; i++) - { - int blurvalue = sums[i] * ppi->fixed_divide[counts[i]]; - blurvalue >>= 16; - d[i] = blurvalue; - } - - s += 4; - d += 4; - byte += 4; - } - while (byte < bytes); - } - - ++ppi->frame; - __asm emms -} diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk index bb3f825..cf47626 100644 --- a/vp8/vp8_common.mk +++ b/vp8/vp8_common.mk @@ -17,7 +17,6 @@ VP8_COMMON_SRCS-yes += common/type_aliases.h VP8_COMMON_SRCS-yes += common/pragmas.h CFLAGS+=-I$(SRC_PATH_BARE)/$(VP8_PREFIX)common -VP8_COMMON_SRCS-yes += common/preproc.h VP8_COMMON_SRCS-yes += common/vpxerrors.h CFLAGS+=-I$(SRC_PATH_BARE)/$(VP8_PREFIX)common