Commit a0ad16e2 authored by Scott LaVarnway's avatar Scott LaVarnway
Browse files

Moved error_bins to macroblock struct

Change-Id: Ic9956ddf1c2ddffcf7be7fdfc23ad9a2426fc47a
WIP: Fixing unsafe threading in VP8 encoder.
parent 2cd48bdc
......@@ -19,6 +19,7 @@
#include "vpx_ports/mem.h"
#define MAX_MODES 20
#define MAX_ERROR_BINS 1024
/* motion search site */
typedef struct
......@@ -148,6 +149,7 @@ typedef struct macroblock
int last_zbin_over_quant;
int zbin_over_quant;
int error_bins[MAX_ERROR_BINS];
void (*short_fdct4x4)(short *input, short *output, int pitch);
void (*short_fdct8x4)(short *input, short *output, int pitch);
......
......@@ -897,6 +897,10 @@ void vp8_encode_frame(VP8_COMP *cpi)
cpi->mb.count_mb_ref_frame_usage[c_idx] +=
x->count_mb_ref_frame_usage[c_idx];
for(c_idx = 0; c_idx < MAX_ERROR_BINS; c_idx++)
cpi->mb.error_bins[c_idx] +=
cpi->mb_row_ei[i].mb.error_bins[c_idx];
/* add up counts for each thread */
sum_coef_counts(x, &cpi->mb_row_ei[i].mb);
}
......
......@@ -427,6 +427,8 @@ static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc)
z->zbin_over_quant = x->zbin_over_quant;
z->zbin_mode_boost_enabled = x->zbin_mode_boost_enabled;
z->zbin_mode_boost = x->zbin_mode_boost;
vpx_memset(z->error_bins, 0, sizeof(z->error_bins));
}
}
......
......@@ -837,7 +837,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
for (i = 0; i < min; i++)
{
sum += cpi->error_bins[i];
sum += cpi->mb.error_bins[i];
}
total_skip = sum;
......@@ -846,7 +846,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
/* i starts from 2 to make sure thresh started from 2048 */
for (; i < 1024; i++)
{
sum += cpi->error_bins[i];
sum += cpi->mb.error_bins[i];
if (10 * sum >= (unsigned int)(cpi->Speed - 6)*(total_mbs - total_skip))
break;
......@@ -901,7 +901,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
if (Speed >= 15)
sf->half_pixel_search = 0;
vpx_memset(cpi->error_bins, 0, sizeof(cpi->error_bins));
vpx_memset(cpi->mb.error_bins, 0, sizeof(cpi->mb.error_bins));
}; /* switch */
......@@ -1998,7 +1998,7 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
cpi->refining_search_sad = vp8_refining_search_sad;
/* make sure frame 1 is okay */
cpi->error_bins[0] = cpi->common.MBs;
cpi->mb.error_bins[0] = cpi->common.MBs;
/* vp8cx_init_quantizer() is first called here. Add check in
* vp8cx_frame_init_quantizer() so that vp8cx_init_quantizer is only
......
......@@ -488,7 +488,6 @@ typedef struct VP8_COMP
int ref_frame_flags;
SPEED_FEATURES sf;
int error_bins[1024];
/* Count ZEROMV on all reference frames. */
int zeromv_count;
......
......@@ -1160,7 +1160,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
this_rdbin = 1023;
}
cpi->error_bins[this_rdbin] ++;
x->error_bins[this_rdbin] ++;
}
#if CONFIG_TEMPORAL_DENOISING
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment