From 97a86c5b13e1ca85d957e6bfb8ae6e4d073a90b5 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Fri, 10 Dec 2010 10:48:30 -0800 Subject: [PATCH 1/4] fix a bug in multithreaded encoding with active_map enabled Added the initialization of the pointer to active map. Also added the same logic for cyclic refresh in mbrow encoding threads. Change-Id: Ic48d0849dc706b27fba72d07dcc498075725663d --- vp8/encoder/ethreading.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c index 3646375ed..3c768b24d 100644 --- a/vp8/encoder/ethreading.c +++ b/vp8/encoder/ethreading.c @@ -132,6 +132,7 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data) else xd->mode_info_context->mbmi.segment_id = 0; // Set to Segment 0 by default + x->active_ptr = cpi->active_map + seg_map_index + mb_col; if (cm->frame_type == KEY_FRAME) { @@ -163,8 +164,28 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data) if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)) cpi->inter_zz_count ++; - } + // Special case code for cyclic refresh + // If cyclic update enabled then copy xd->mbmi.segment_id; (which may have been updated based on mode + // during vp8cx_encode_inter_macroblock()) back into the global sgmentation map + if (cpi->cyclic_refresh_mode_enabled && xd->segmentation_enabled) + { + cpi->segmentation_map[seg_map_index+mb_col] = xd->mode_info_context->mbmi.segment_id; + // If the block has been refreshed mark it as clean (the magnitude of the -ve influences how long it will be before we consider another refresh): + // Else if it was coded (last frame 0,0) and has not already been refreshed then mark it as a candidate for cleanup next time (marked 0) + // else mark it as dirty (1). + if (xd->mode_info_context->mbmi.segment_id) + cpi->cyclic_refresh_map[seg_map_index+mb_col] = -1; + else if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)) + { + if (cpi->cyclic_refresh_map[seg_map_index+mb_col] == 1) + cpi->cyclic_refresh_map[seg_map_index+mb_col] = 0; + } + else + cpi->cyclic_refresh_map[seg_map_index+mb_col] = 1; + + } + } cpi->tplist[mb_row].stop = *tp; x->gf_active_ptr++; // Increment pointer into gf useage flags structure for next mb From 136bd2455e0e04298c7478e5a1a15ba4f065338c Mon Sep 17 00:00:00 2001 From: James Berry Date: Mon, 13 Dec 2010 13:10:58 -0500 Subject: [PATCH 2/4] fixed vpxenc bug where ivf files would be read incorrectly read_frame would incorrectly insert detect->buf into img for ivf files. detect->position now set to 4 if input file is detected to be ivf in file_is_ivf to keep this from occuring. Change-Id: I5e235dd3033985bc62707a35c13af5984620208e --- vpxenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 vpxenc.c diff --git a/vpxenc.c b/vpxenc.c old mode 100644 new mode 100755 index 0ae391f8b..4baeefcdf --- a/vpxenc.c +++ b/vpxenc.c @@ -347,12 +347,12 @@ unsigned int file_is_ivf(FILE *infile, unsigned int *fourcc, unsigned int *width, unsigned int *height, - char detect[4]) + struct detect_buffer *detect) { char raw_hdr[IVF_FILE_HDR_SZ]; int is_ivf = 0; - if(memcmp(detect, "DKIF", 4) != 0) + if(memcmp(detect->buf, "DKIF", 4) != 0) return 0; /* See write_ivf_file_header() for more documentation on the file header @@ -376,6 +376,7 @@ unsigned int file_is_ivf(FILE *infile, { *width = mem_get_le16(raw_hdr + 12); *height = mem_get_le16(raw_hdr + 14); + detect->position = 4; } return is_ivf; @@ -1390,7 +1391,7 @@ int main(int argc, const char **argv_) } } else if (detect.buf_read == 4 && - file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, detect.buf)) + file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, &detect)) { file_type = FILE_TYPE_IVF; switch (fourcc) From b7b1e6fb55c6b12ccd078a20cb9855f6734931b5 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Mon, 13 Dec 2010 10:11:42 -0500 Subject: [PATCH 3/4] Reduce size of TOKENEXTRA struct Change the size of structure elements to reduce memory utilization. Removed the 'section' member entirely, as it is set but never read. Change-Id: Iad043830392fb4168cb3cd6075fb0eb70c7f691c --- vp8/encoder/tokenize.c | 8 -------- vp8/encoder/tokenize.h | 7 +++---- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c index e4da83379..50dabf4a5 100644 --- a/vp8/encoder/tokenize.c +++ b/vp8/encoder/tokenize.c @@ -131,9 +131,6 @@ static void tokenize2nd_order_b t->Token = x; t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt]; - - t->section = frametype * BLOCK_TYPES * 2 + 2 * type + (c == 0); - t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0)); ++cpi->coef_counts [type] [band] [pt] [x]; @@ -184,8 +181,6 @@ static void tokenize1st_order_b t->Token = x; t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt]; - - t->section = frametype * BLOCK_TYPES * 2 + 2 * type + (c == 0); t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0)); ++cpi->coef_counts [type] [band] [pt] [x]; @@ -434,7 +429,6 @@ static __inline void stuff2nd_order_b t->Token = DCT_EOB_TOKEN; t->context_tree = cpi->common.fc.coef_probs [1] [0] [pt]; - t->section = 11; t->skip_eob_node = 0; ++cpi->coef_counts [1] [0] [pt] [DCT_EOB_TOKEN]; ++t; @@ -465,7 +459,6 @@ static __inline void stuff1st_order_b t->Token = DCT_EOB_TOKEN; t->context_tree = cpi->common.fc.coef_probs [0] [1] [pt]; - t->section = 8; t->skip_eob_node = 0; ++cpi->coef_counts [0] [1] [pt] [DCT_EOB_TOKEN]; ++t; @@ -495,7 +488,6 @@ void stuff1st_order_buv t->Token = DCT_EOB_TOKEN; t->context_tree = cpi->common.fc.coef_probs [2] [0] [pt]; - t->section = 13; t->skip_eob_node = 0; ++cpi->coef_counts[2] [0] [pt] [DCT_EOB_TOKEN]; ++t; diff --git a/vp8/encoder/tokenize.h b/vp8/encoder/tokenize.h index 01e8ec6d7..cb5b15405 100644 --- a/vp8/encoder/tokenize.h +++ b/vp8/encoder/tokenize.h @@ -25,11 +25,10 @@ typedef struct typedef struct { - int Token; - int Extra; const vp8_prob *context_tree; - int skip_eob_node; - int section; + char skip_eob_node; + char Token; + short Extra; } TOKENEXTRA; int rd_cost_mby(MACROBLOCKD *); From b1aa54ab26656cee4aaebb550cb806580e98ab53 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Mon, 13 Dec 2010 16:47:34 -0500 Subject: [PATCH 4/4] 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 --- vp8/common/preproc.h | 46 ------ vp8/common/preprocif.h | 76 --------- vp8/encoder/onyx_if.c | 5 - vp8/encoder/onyx_int.h | 3 - vp8/encoder/preproc.c | 251 ---------------------------- vp8/encoder/x86/preproc_mmx.c | 298 ---------------------------------- vp8/vp8_common.mk | 1 - 7 files changed, 680 deletions(-) delete mode 100644 vp8/common/preproc.h delete mode 100644 vp8/common/preprocif.h delete mode 100644 vp8/encoder/preproc.c delete mode 100644 vp8/encoder/x86/preproc_mmx.c diff --git a/vp8/common/preproc.h b/vp8/common/preproc.h deleted file mode 100644 index 0b142bda7..000000000 --- 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 7d554b509..000000000 --- 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 a003828b0..508190c03 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 63f17aa8c..56938bec4 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 bd918fa3c..000000000 --- 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 a182c8856..000000000 --- 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 bb3f8259c..cf4762614 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