Commit b1aa54ab authored by John Koleszar's avatar John Koleszar
Browse files

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
parent b7b1e6fb
/*
* 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
/*
* 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
......@@ -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);
}
}
......
......@@ -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;
......
/*
* 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;
}
/*
* 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);