removed some variables to prevent memory losses

This commit is contained in:
Reima Hyvönen 2019-03-29 15:32:29 +02:00 committed by Pauli Oikkonen
parent 247c3a7a71
commit f146de7acb

View file

@ -85,7 +85,6 @@ static int sao_edge_ddistortion_avx2(const kvz_pixel *orig_data,
int offsets[NUM_SAO_EDGE_CATEGORIES])
{
int y, x;
unsigned int sum = 0;
vector2d_t a_ofs = g_sao_edge_offsets[eo_class][0];
vector2d_t b_ofs = g_sao_edge_offsets[eo_class][1];
@ -123,11 +122,6 @@ static int sao_edge_ddistortion_avx2(const kvz_pixel *orig_data,
tmp_sum_epi32 = _mm256_add_epi32(tmp_sum_epi32, _mm256_sub_epi32(tmp1_vec_epi32, tmp2_vec_epi32));
}
bool use_6_elements = block_width - x - 1 == 6;
switch (use_6_elements)
{
case true:;
// Load the last 6 pixels to use
const kvz_pixel *c_data = &rec_data[y * block_width + x];
@ -161,35 +155,8 @@ static int sao_edge_ddistortion_avx2(const kvz_pixel *orig_data,
tmp_sum_epi32 = _mm256_hadd_epi32(tmp_sum_epi32, tmp_sum_epi32);
tmp_sum_epi32 = _mm256_add_epi32(tmp_sum_epi32, _mm256_shuffle_epi32(tmp_sum_epi32, _MM_SHUFFLE(0, 1, 0, 1)));
sum += _mm_cvtsi128_si32(_mm256_castsi256_si128(tmp_sum_epi32));
break;
default:
// Only if theres odd number of pixels left
for (int i = x; i < block_width - 1; ++i) {
const kvz_pixel *c_data = &rec_data[y * block_width + i];
kvz_pixel a = c_data[a_ofs.y * block_width + a_ofs.x];
kvz_pixel c = c_data[0];
kvz_pixel b = c_data[b_ofs.y * block_width + b_ofs.x];
int offset = offsets[sao_calc_eo_cat(a, b, c)];
if (offset != 0) {
int diff = orig_data[y * block_width + i] - c;
// Offset is applied to reconstruction, so it is subtracted from diff.
sum += (diff - offset) * (diff - offset) - diff * diff;
}
}
break;
}
}
return sum;
return (_mm_cvtsi128_si32(_mm256_castsi256_si128(tmp_sum_epi32)));
}
/**