Merge changes Icfc16070,Ied47a248,I8af087d9,I322a1366,If04580af into nextgenv2

* changes:
  Palette: Use inverse_color_order to find color index faster.
  Rewrite some loops to avoid -Wunsafe-loop-optimizations warnings.
  Remove some useless casts
  Add compiler warning flag -Wextra and fix related warnings.
  Declare some array sizes to be constants (known at compile time).
This commit is contained in:
Yaowu Xu
2016-10-21 17:31:42 +00:00
committed by Gerrit Code Review
32 changed files with 269 additions and 341 deletions

View File

@@ -65,6 +65,10 @@ void aom_convolve8_avg_horiz_neon(const uint8_t *src, ptrdiff_t src_stride,
assert(x_step_q4 == 16); assert(x_step_q4 == 16);
(void)x_step_q4;
(void)y_step_q4;
(void)filter_y;
q0s16 = vld1q_s16(filter_x); q0s16 = vld1q_s16(filter_x);
src -= 3; // adjust for taps src -= 3; // adjust for taps
@@ -241,6 +245,10 @@ void aom_convolve8_avg_vert_neon(const uint8_t *src, ptrdiff_t src_stride,
assert(y_step_q4 == 16); assert(y_step_q4 == 16);
(void)x_step_q4;
(void)y_step_q4;
(void)filter_x;
src -= src_stride * 3; src -= src_stride * 3;
q0s16 = vld1q_s16(filter_y); q0s16 = vld1q_s16(filter_y);
for (; w > 0; w -= 4, src += 4, dst += 4) { // loop_vert_h for (; w > 0; w -= 4, src += 4, dst += 4) { // loop_vert_h

View File

@@ -65,6 +65,10 @@ void aom_convolve8_horiz_neon(const uint8_t *src, ptrdiff_t src_stride,
assert(x_step_q4 == 16); assert(x_step_q4 == 16);
(void)x_step_q4;
(void)y_step_q4;
(void)filter_y;
q0s16 = vld1q_s16(filter_x); q0s16 = vld1q_s16(filter_x);
src -= 3; // adjust for taps src -= 3; // adjust for taps
@@ -225,6 +229,10 @@ void aom_convolve8_vert_neon(const uint8_t *src, ptrdiff_t src_stride,
assert(y_step_q4 == 16); assert(y_step_q4 == 16);
(void)x_step_q4;
(void)y_step_q4;
(void)filter_x;
src -= src_stride * 3; src -= src_stride * 3;
q0s16 = vld1q_s16(filter_y); q0s16 = vld1q_s16(filter_y);
for (; w > 0; w -= 4, src += 4, dst += 4) { // loop_vert_h for (; w > 0; w -= 4, src += 4, dst += 4) { // loop_vert_h

View File

@@ -27,6 +27,10 @@ typedef void filter8_1dfunction(const uint8_t *src_ptr, ptrdiff_t src_pitch,
const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, \ const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, \
ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, \ ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, \
const int16_t *filter_y, int y_step_q4, int w, int h) { \ const int16_t *filter_y, int y_step_q4, int w, int h) { \
(void)filter_x; \
(void)x_step_q4; \
(void)filter_y; \
(void)y_step_q4; \
assert(filter[3] != 128); \ assert(filter[3] != 128); \
assert(step_q4 == 16); \ assert(step_q4 == 16); \
if (filter[0] | filter[1] | filter[2]) { \ if (filter[0] | filter[1] | filter[2]) { \

View File

@@ -68,24 +68,25 @@ static void scale1d_2t1_i(const unsigned char *source, int source_step,
unsigned int source_scale, unsigned int source_length, unsigned int source_scale, unsigned int source_length,
unsigned char *dest, int dest_step, unsigned char *dest, int dest_step,
unsigned int dest_scale, unsigned int dest_length) { unsigned int dest_scale, unsigned int dest_length) {
unsigned int i, j; const unsigned int source_pitch = source_step;
unsigned int temp; const unsigned char *const dest_end = dest + dest_length * dest_step;
int source_pitch = source_step;
(void)source_length; (void)source_length;
(void)source_scale; (void)source_scale;
(void)dest_scale; (void)dest_scale;
source_step *= 2; source_step *= 2; // Every other row.
dest[0] = source[0];
for (i = dest_step, j = source_step; i < dest_length * dest_step; dest[0] = source[0]; // Special case: 1st pixel.
i += dest_step, j += source_step) { source += source_step;
temp = 8; dest += dest_step;
temp += 3 * source[j - source_pitch];
temp += 10 * source[j]; while (dest < dest_end) {
temp += 3 * source[j + source_pitch]; const unsigned int a = 3 * source[-source_pitch];
temp >>= 4; const unsigned int b = 10 * source[0];
dest[i] = (char)(temp); const unsigned int c = 3 * source[source_pitch];
*dest = (unsigned char)((8 + a + b + c) >> 4);
source += source_step;
dest += dest_step;
} }
} }
@@ -119,17 +120,18 @@ static void scale1d_2t1_ps(const unsigned char *source, int source_step,
unsigned int source_length, unsigned char *dest, unsigned int source_length, unsigned char *dest,
int dest_step, unsigned int dest_scale, int dest_step, unsigned int dest_scale,
unsigned int dest_length) { unsigned int dest_length) {
unsigned int i, j; const unsigned char *const dest_end = dest + dest_length * dest_step;
(void)source_length; (void)source_length;
(void)source_scale; (void)source_scale;
(void)dest_scale; (void)dest_scale;
source_step *= 2; source_step *= 2; // Every other row.
j = 0;
for (i = 0; i < dest_length * dest_step; i += dest_step, j += source_step) while (dest < dest_end) {
dest[i] = source[j]; *dest = *source;
source += source_step;
dest += dest_step;
}
} }
/**************************************************************************** /****************************************************************************
* *
@@ -159,12 +161,12 @@ static void scale1d_c(const unsigned char *source, int source_step,
unsigned int source_scale, unsigned int source_length, unsigned int source_scale, unsigned int source_length,
unsigned char *dest, int dest_step, unsigned char *dest, int dest_step,
unsigned int dest_scale, unsigned int dest_length) { unsigned int dest_scale, unsigned int dest_length) {
unsigned int i; const unsigned char *const dest_end = dest + dest_length * dest_step;
unsigned int round_value = dest_scale / 2; const unsigned int round_value = dest_scale / 2;
unsigned int left_modifier = dest_scale; unsigned int left_modifier = dest_scale;
unsigned int right_modifier = 0; unsigned int right_modifier = 0;
unsigned char left_pixel = *source; unsigned char left_pixel = source[0];
unsigned char right_pixel = *(source + source_step); unsigned char right_pixel = source[source_step];
(void)source_length; (void)source_length;
@@ -173,8 +175,8 @@ static void scale1d_c(const unsigned char *source, int source_step,
/* assert ( (source_length - 1) * dest_scale >= (dest_length - 1) * /* assert ( (source_length - 1) * dest_scale >= (dest_length - 1) *
* source_scale);*/ * source_scale);*/
for (i = 0; i < dest_length * dest_step; i += dest_step) { while (dest < dest_end) {
dest[i] = (char)((left_modifier * left_pixel + *dest = (unsigned char)((left_modifier * left_pixel +
right_modifier * right_pixel + round_value) / right_modifier * right_pixel + round_value) /
dest_scale); dest_scale);
@@ -183,8 +185,8 @@ static void scale1d_c(const unsigned char *source, int source_step,
while (right_modifier > dest_scale) { while (right_modifier > dest_scale) {
right_modifier -= dest_scale; right_modifier -= dest_scale;
source += source_step; source += source_step;
left_pixel = *source; left_pixel = source[0];
right_pixel = *(source + source_step); right_pixel = source[source_step];
} }
left_modifier = dest_scale - right_modifier; left_modifier = dest_scale - right_modifier;
@@ -236,11 +238,10 @@ static void Scale2D(
unsigned int dest_width, unsigned int dest_height, unsigned char *temp_area, unsigned int dest_width, unsigned int dest_height, unsigned char *temp_area,
unsigned char temp_area_height, unsigned int hscale, unsigned int hratio, unsigned char temp_area_height, unsigned int hscale, unsigned int hratio,
unsigned int vscale, unsigned int vratio, unsigned int interlaced) { unsigned int vscale, unsigned int vratio, unsigned int interlaced) {
/*unsigned*/ unsigned int i, j, k;
int i, j, k; unsigned int bands;
int bands; unsigned int dest_band_height;
int dest_band_height; unsigned int source_band_height;
int source_band_height;
typedef void (*Scale1D)(const unsigned char *source, int source_step, typedef void (*Scale1D)(const unsigned char *source, int source_step,
unsigned int source_scale, unsigned int source_length, unsigned int source_scale, unsigned int source_length,
@@ -331,7 +332,7 @@ static void Scale2D(
if (ratio_scalable) { if (ratio_scalable) {
if (source_height == dest_height) { if (source_height == dest_height) {
/* for each band of the image */ /* for each band of the image */
for (k = 0; k < (int)dest_height; k++) { for (k = 0; k < dest_height; ++k) {
horiz_line_scale(source, source_width, dest, dest_width); horiz_line_scale(source, source_width, dest, dest_width);
source += source_pitch; source += source_pitch;
dest += dest_pitch; dest += dest_pitch;
@@ -346,14 +347,13 @@ static void Scale2D(
horiz_line_scale(source, source_width, temp_area, dest_width); horiz_line_scale(source, source_width, temp_area, dest_width);
} }
for (k = 0; for (k = 0; k < (dest_height + dest_band_height - 1) / dest_band_height;
k < (int)(dest_height + dest_band_height - 1) / dest_band_height; ++k) {
k++) {
/* scale one band horizontally */ /* scale one band horizontally */
for (i = 0; i < source_band_height; i++) { for (i = 0; i < source_band_height; ++i) {
/* Trap case where we could read off the base of the source buffer */ /* Trap case where we could read off the base of the source buffer */
line_src = (unsigned char *)source + i * source_pitch; line_src = source + i * source_pitch;
if (line_src < source_base) line_src = source_base; if (line_src < source_base) line_src = source_base;
@@ -388,7 +388,7 @@ static void Scale2D(
if (source_height == dest_height) { if (source_height == dest_height) {
/* for each band of the image */ /* for each band of the image */
for (k = 0; k < (int)dest_height; k++) { for (k = 0; k < dest_height; ++k) {
Scale1Dh(source, 1, hscale, source_width + 1, dest, 1, hratio, Scale1Dh(source, 1, hscale, source_width + 1, dest, 1, hratio,
dest_width); dest_width);
source += source_pitch; source += source_pitch;
@@ -414,10 +414,10 @@ static void Scale2D(
/* for each band of the image */ /* for each band of the image */
bands = (dest_height + dest_band_height - 1) / dest_band_height; bands = (dest_height + dest_band_height - 1) / dest_band_height;
for (k = 0; k < bands; k++) { for (k = 0; k < bands; ++k) {
/* scale one band horizontally */ /* scale one band horizontally */
for (i = 1; i < source_band_height + 1; i++) { for (i = 1; i < source_band_height + 1; ++i) {
if (k * source_band_height + i < (int)source_height) { if (k * source_band_height + i < source_height) {
Scale1Dh(source + i * source_pitch, 1, hscale, source_width + 1, Scale1Dh(source + i * source_pitch, 1, hscale, source_width + 1,
temp_area + i * dest_pitch, 1, hratio, dest_width); temp_area + i * dest_pitch, 1, hratio, dest_width);
} else { /* Duplicate the last row */ } else { /* Duplicate the last row */
@@ -428,7 +428,7 @@ static void Scale2D(
} }
/* scale one band vertically */ /* scale one band vertically */
for (j = 0; j < (int)dest_width; j++) { for (j = 0; j < dest_width; ++j) {
Scale1Dv(&temp_area[j], dest_pitch, vscale, source_band_height + 1, Scale1Dv(&temp_area[j], dest_pitch, vscale, source_band_height + 1,
&dest[j], dest_pitch, vratio, dest_band_height); &dest[j], dest_pitch, vratio, dest_band_height);
} }
@@ -487,12 +487,12 @@ void aom_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced); temp_area, temp_height, hscale, hratio, vscale, vratio, interlaced);
if (dw < (int)dst->y_width) if (dw < (int)dst->y_width)
for (i = 0; i < dh; i++) for (i = 0; i < dh; ++i)
memset(dst->y_buffer + i * dst->y_stride + dw - 1, memset(dst->y_buffer + i * dst->y_stride + dw - 1,
dst->y_buffer[i * dst->y_stride + dw - 2], dst->y_width - dw + 1); dst->y_buffer[i * dst->y_stride + dw - 2], dst->y_width - dw + 1);
if (dh < (int)dst->y_height) if (dh < (int)dst->y_height)
for (i = dh - 1; i < (int)dst->y_height; i++) for (i = dh - 1; i < (int)dst->y_height; ++i)
memcpy(dst->y_buffer + i * dst->y_stride, memcpy(dst->y_buffer + i * dst->y_stride,
dst->y_buffer + (dh - 2) * dst->y_stride, dst->y_width + 1); dst->y_buffer + (dh - 2) * dst->y_stride, dst->y_width + 1);
@@ -502,13 +502,13 @@ void aom_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
vratio, interlaced); vratio, interlaced);
if (dw / 2 < (int)dst->uv_width) if (dw / 2 < (int)dst->uv_width)
for (i = 0; i < dst->uv_height; i++) for (i = 0; i < dst->uv_height; ++i)
memset(dst->u_buffer + i * dst->uv_stride + dw / 2 - 1, memset(dst->u_buffer + i * dst->uv_stride + dw / 2 - 1,
dst->u_buffer[i * dst->uv_stride + dw / 2 - 2], dst->u_buffer[i * dst->uv_stride + dw / 2 - 2],
dst->uv_width - dw / 2 + 1); dst->uv_width - dw / 2 + 1);
if (dh / 2 < (int)dst->uv_height) if (dh / 2 < (int)dst->uv_height)
for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++) for (i = dh / 2 - 1; i < (int)dst->y_height / 2; ++i)
memcpy(dst->u_buffer + i * dst->uv_stride, memcpy(dst->u_buffer + i * dst->uv_stride,
dst->u_buffer + (dh / 2 - 2) * dst->uv_stride, dst->uv_width); dst->u_buffer + (dh / 2 - 2) * dst->uv_stride, dst->uv_width);
@@ -518,13 +518,13 @@ void aom_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
vratio, interlaced); vratio, interlaced);
if (dw / 2 < (int)dst->uv_width) if (dw / 2 < (int)dst->uv_width)
for (i = 0; i < dst->uv_height; i++) for (i = 0; i < dst->uv_height; ++i)
memset(dst->v_buffer + i * dst->uv_stride + dw / 2 - 1, memset(dst->v_buffer + i * dst->uv_stride + dw / 2 - 1,
dst->v_buffer[i * dst->uv_stride + dw / 2 - 2], dst->v_buffer[i * dst->uv_stride + dw / 2 - 2],
dst->uv_width - dw / 2 + 1); dst->uv_width - dw / 2 + 1);
if (dh / 2 < (int)dst->uv_height) if (dh / 2 < (int)dst->uv_height)
for (i = dh / 2 - 1; i < (int)dst->y_height / 2; i++) for (i = dh / 2 - 1; i < (int)dst->y_height / 2; ++i)
memcpy(dst->v_buffer + i * dst->uv_stride, memcpy(dst->v_buffer + i * dst->uv_stride,
dst->v_buffer + (dh / 2 - 2) * dst->uv_stride, dst->uv_width); dst->v_buffer + (dh / 2 - 2) * dst->uv_stride, dst->uv_width);
} }

View File

@@ -39,27 +39,23 @@ void aom_horizontal_line_5_4_scale_c(const unsigned char *source,
unsigned int source_width, unsigned int source_width,
unsigned char *dest, unsigned char *dest,
unsigned int dest_width) { unsigned int dest_width) {
unsigned i; const unsigned char *const source_end = source + source_width;
unsigned int a, b, c, d, e;
unsigned char *des = dest;
const unsigned char *src = source;
(void)dest_width; (void)dest_width;
for (i = 0; i < source_width; i += 5) { while (source < source_end) {
a = src[0]; const unsigned int a = source[0];
b = src[1]; const unsigned int b = source[1];
c = src[2]; const unsigned int c = source[2];
d = src[3]; const unsigned int d = source[3];
e = src[4]; const unsigned int e = source[4];
des[0] = (unsigned char)a; dest[0] = (unsigned char)a;
des[1] = (unsigned char)((b * 192 + c * 64 + 128) >> 8); dest[1] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
des[2] = (unsigned char)((c * 128 + d * 128 + 128) >> 8); dest[2] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
des[3] = (unsigned char)((d * 64 + e * 192 + 128) >> 8); dest[3] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);
src += 5; source += 5;
des += 4; dest += 4;
} }
} }
@@ -67,25 +63,21 @@ void aom_vertical_band_5_4_scale_c(unsigned char *source,
unsigned int src_pitch, unsigned char *dest, unsigned int src_pitch, unsigned char *dest,
unsigned int dest_pitch, unsigned int dest_pitch,
unsigned int dest_width) { unsigned int dest_width) {
unsigned int i; const unsigned char *const dest_end = dest + dest_width;
unsigned int a, b, c, d, e; while (dest < dest_end) {
unsigned char *des = dest; const unsigned int a = source[0 * src_pitch];
unsigned char *src = source; const unsigned int b = source[1 * src_pitch];
const unsigned int c = source[2 * src_pitch];
const unsigned int d = source[3 * src_pitch];
const unsigned int e = source[4 * src_pitch];
for (i = 0; i < dest_width; i++) { dest[0 * dest_pitch] = (unsigned char)a;
a = src[0 * src_pitch]; dest[1 * dest_pitch] = (unsigned char)((b * 192 + c * 64 + 128) >> 8);
b = src[1 * src_pitch]; dest[2 * dest_pitch] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
c = src[2 * src_pitch]; dest[3 * dest_pitch] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);
d = src[3 * src_pitch];
e = src[4 * src_pitch];
des[0 * dest_pitch] = (unsigned char)a; ++source;
des[1 * dest_pitch] = (unsigned char)((b * 192 + c * 64 + 128) >> 8); ++dest;
des[2 * dest_pitch] = (unsigned char)((c * 128 + d * 128 + 128) >> 8);
des[3 * dest_pitch] = (unsigned char)((d * 64 + e * 192 + 128) >> 8);
src++;
des++;
} }
} }
@@ -114,26 +106,21 @@ void aom_horizontal_line_5_3_scale_c(const unsigned char *source,
unsigned int source_width, unsigned int source_width,
unsigned char *dest, unsigned char *dest,
unsigned int dest_width) { unsigned int dest_width) {
unsigned int i; const unsigned char *const source_end = source + source_width;
unsigned int a, b, c, d, e;
unsigned char *des = dest;
const unsigned char *src = source;
(void)dest_width; (void)dest_width;
while (source < source_end) {
const unsigned int a = source[0];
const unsigned int b = source[1];
const unsigned int c = source[2];
const unsigned int d = source[3];
const unsigned int e = source[4];
for (i = 0; i < source_width; i += 5) { dest[0] = (unsigned char)a;
a = src[0]; dest[1] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
b = src[1]; dest[2] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
c = src[2];
d = src[3];
e = src[4];
des[0] = (unsigned char)a; source += 5;
des[1] = (unsigned char)((b * 85 + c * 171 + 128) >> 8); dest += 3;
des[2] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
src += 5;
des += 3;
} }
} }
@@ -141,24 +128,20 @@ void aom_vertical_band_5_3_scale_c(unsigned char *source,
unsigned int src_pitch, unsigned char *dest, unsigned int src_pitch, unsigned char *dest,
unsigned int dest_pitch, unsigned int dest_pitch,
unsigned int dest_width) { unsigned int dest_width) {
unsigned int i; const unsigned char *const dest_end = dest + dest_width;
unsigned int a, b, c, d, e; while (dest < dest_end) {
unsigned char *des = dest; const unsigned int a = source[0 * src_pitch];
unsigned char *src = source; const unsigned int b = source[1 * src_pitch];
const unsigned int c = source[2 * src_pitch];
const unsigned int d = source[3 * src_pitch];
const unsigned int e = source[4 * src_pitch];
for (i = 0; i < dest_width; i++) { dest[0 * dest_pitch] = (unsigned char)a;
a = src[0 * src_pitch]; dest[1 * dest_pitch] = (unsigned char)((b * 85 + c * 171 + 128) >> 8);
b = src[1 * src_pitch]; dest[2 * dest_pitch] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
c = src[2 * src_pitch];
d = src[3 * src_pitch];
e = src[4 * src_pitch];
des[0 * dest_pitch] = (unsigned char)a; ++source;
des[1 * dest_pitch] = (unsigned char)((b * 85 + c * 171 + 128) >> 8); ++dest;
des[2 * dest_pitch] = (unsigned char)((d * 171 + e * 85 + 128) >> 8);
src++;
des++;
} }
} }
@@ -186,18 +169,12 @@ void aom_horizontal_line_2_1_scale_c(const unsigned char *source,
unsigned int source_width, unsigned int source_width,
unsigned char *dest, unsigned char *dest,
unsigned int dest_width) { unsigned int dest_width) {
unsigned int i; const unsigned char *const source_end = source + source_width;
unsigned int a;
unsigned char *des = dest;
const unsigned char *src = source;
(void)dest_width; (void)dest_width;
while (source < source_end) {
for (i = 0; i < source_width; i += 2) { dest[0] = source[0];
a = src[0]; source += 2;
des[0] = (unsigned char)(a); ++dest;
src += 2;
des += 1;
} }
} }
@@ -215,18 +192,14 @@ void aom_vertical_band_2_1_scale_i_c(unsigned char *source,
unsigned char *dest, unsigned char *dest,
unsigned int dest_pitch, unsigned int dest_pitch,
unsigned int dest_width) { unsigned int dest_width) {
int i; const unsigned char *const dest_end = dest + dest_width;
int temp;
int width = dest_width;
(void)dest_pitch; (void)dest_pitch;
while (dest < dest_end) {
for (i = 0; i < width; i++) { const unsigned int a = source[-src_pitch] * 3;
temp = 8; const unsigned int b = source[0] * 10;
temp += source[i - (int)src_pitch] * 3; const unsigned int c = source[src_pitch] * 3;
temp += source[i] * 10; dest[0] = (unsigned char)((8 + a + b + c) >> 4);
temp += source[i + src_pitch] * 3; ++source;
temp >>= 4; ++dest;
dest[i] = (unsigned char)(temp);
} }
} }

View File

@@ -1415,9 +1415,8 @@ static void open_output_file(struct stream_state *stream,
#if CONFIG_WEBM_IO #if CONFIG_WEBM_IO
if (stream->config.write_webm) { if (stream->config.write_webm) {
stream->webm_ctx.stream = stream->file; stream->webm_ctx.stream = stream->file;
write_webm_file_header(&stream->webm_ctx, cfg, &global->framerate, write_webm_file_header(&stream->webm_ctx, cfg, stream->config.stereo_fmt,
stream->config.stereo_fmt, global->codec->fourcc, global->codec->fourcc, pixel_aspect_ratio);
pixel_aspect_ratio);
} }
#else #else
(void)pixel_aspect_ratio; (void)pixel_aspect_ratio;

View File

@@ -828,7 +828,7 @@ static aom_codec_err_t ctrl_set_reference(aom_codec_alg_priv_t *ctx,
static aom_codec_err_t ctrl_copy_reference(aom_codec_alg_priv_t *ctx, static aom_codec_err_t ctrl_copy_reference(aom_codec_alg_priv_t *ctx,
va_list args) { va_list args) {
aom_ref_frame_t *data = va_arg(args, aom_ref_frame_t *); const aom_ref_frame_t *const frame = va_arg(args, aom_ref_frame_t *);
// Only support this function in serial decode. // Only support this function in serial decode.
if (ctx->frame_parallel_decode) { if (ctx->frame_parallel_decode) {
@@ -836,8 +836,7 @@ static aom_codec_err_t ctrl_copy_reference(aom_codec_alg_priv_t *ctx,
return AOM_CODEC_INCAPABLE; return AOM_CODEC_INCAPABLE;
} }
if (data) { if (frame) {
aom_ref_frame_t *frame = (aom_ref_frame_t *)data;
YV12_BUFFER_CONFIG sd; YV12_BUFFER_CONFIG sd;
AVxWorker *const worker = ctx->frame_workers; AVxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1; FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1;

View File

@@ -892,13 +892,14 @@ static const aom_prob default_rect_tx_prob[TX_SIZES - 1] = { 192, 192, 192 };
#if CONFIG_PALETTE #if CONFIG_PALETTE
int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r, int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
int c, int n, int *color_order) { int c, int n, uint8_t *color_order,
int *color_idx) {
int i, j, max, max_idx, temp; int i, j, max, max_idx, temp;
int scores[PALETTE_MAX_SIZE + 10]; int scores[PALETTE_MAX_SIZE + 10];
int weights[4] = { 3, 2, 3, 2 }; int weights[4] = { 3, 2, 3, 2 };
int color_ctx = 0; int color_ctx = 0;
int color_neighbors[4]; int color_neighbors[4];
int inverse_color_order[PALETTE_MAX_SIZE];
assert(n <= PALETTE_MAX_SIZE); assert(n <= PALETTE_MAX_SIZE);
if (c - 1 >= 0) if (c - 1 >= 0)
@@ -918,7 +919,10 @@ int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
else else
color_neighbors[3] = -1; color_neighbors[3] = -1;
for (i = 0; i < PALETTE_MAX_SIZE; ++i) color_order[i] = i; for (i = 0; i < PALETTE_MAX_SIZE; ++i) {
color_order[i] = i;
inverse_color_order[i] = i;
}
memset(scores, 0, PALETTE_MAX_SIZE * sizeof(scores[0])); memset(scores, 0, PALETTE_MAX_SIZE * sizeof(scores[0]));
for (i = 0; i < 4; ++i) { for (i = 0; i < 4; ++i) {
if (color_neighbors[i] >= 0) scores[color_neighbors[i]] += weights[i]; if (color_neighbors[i] >= 0) scores[color_neighbors[i]] += weights[i];
@@ -944,6 +948,8 @@ int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
temp = color_order[i]; temp = color_order[i];
color_order[i] = color_order[max_idx]; color_order[i] = color_order[max_idx];
color_order[max_idx] = temp; color_order[max_idx] = temp;
inverse_color_order[color_order[i]] = i;
inverse_color_order[color_order[max_idx]] = max_idx;
} }
} }
@@ -956,7 +962,9 @@ int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
} }
if (color_ctx >= PALETTE_COLOR_CONTEXTS) color_ctx = 0; if (color_ctx >= PALETTE_COLOR_CONTEXTS) color_ctx = 0;
if (color_idx != NULL) {
*color_idx = inverse_color_order[color_map[r * cols + c]];
}
return color_ctx; return color_ctx;
} }
#endif // CONFIG_PALETTE #endif // CONFIG_PALETTE

View File

@@ -359,7 +359,8 @@ static INLINE int av1_ceil_log2(int n) {
#if CONFIG_PALETTE #if CONFIG_PALETTE
int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r, int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r,
int c, int n, int *color_order); int c, int n, uint8_t *color_order,
int *color_idx);
#endif // CONFIG_PALETTE #endif // CONFIG_PALETTE
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -338,15 +338,15 @@ static void dec_set_contexts(const MACROBLOCKD *xd,
#if CONFIG_PALETTE #if CONFIG_PALETTE
void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane, void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
aom_reader *r) { aom_reader *r) {
MODE_INFO *const mi = xd->mi[0]; const MODE_INFO *const mi = xd->mi[0];
MB_MODE_INFO *const mbmi = &mi->mbmi; const MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type; const BLOCK_SIZE bsize = mbmi->sb_type;
const int rows = (4 * num_4x4_blocks_high_lookup[bsize]) >> const int rows = (4 * num_4x4_blocks_high_lookup[bsize]) >>
(xd->plane[plane != 0].subsampling_y); (xd->plane[plane != 0].subsampling_y);
const int cols = (4 * num_4x4_blocks_wide_lookup[bsize]) >> const int cols = (4 * num_4x4_blocks_wide_lookup[bsize]) >>
(xd->plane[plane != 0].subsampling_x); (xd->plane[plane != 0].subsampling_x);
int color_idx, color_ctx, color_order[PALETTE_MAX_SIZE]; uint8_t color_order[PALETTE_MAX_SIZE];
int n = mbmi->palette_mode_info.palette_size[plane != 0]; const int n = mbmi->palette_mode_info.palette_size[plane != 0];
int i, j; int i, j;
uint8_t *color_map = xd->plane[plane != 0].color_index_map; uint8_t *color_map = xd->plane[plane != 0].color_index_map;
const aom_prob(*const prob)[PALETTE_COLOR_CONTEXTS][PALETTE_COLORS - 1] = const aom_prob(*const prob)[PALETTE_COLOR_CONTEXTS][PALETTE_COLORS - 1] =
@@ -355,9 +355,9 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
for (i = 0; i < rows; ++i) { for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) { for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
color_ctx = const int color_ctx = av1_get_palette_color_context(color_map, cols, i, j,
av1_get_palette_color_context(color_map, cols, i, j, n, color_order); n, color_order, NULL);
color_idx = aom_read_tree(r, av1_palette_color_tree[n - 2], const int color_idx = aom_read_tree(r, av1_palette_color_tree[n - 2],
prob[n - 2][color_ctx], ACCT_STR); prob[n - 2][color_ctx], ACCT_STR);
assert(color_idx >= 0 && color_idx < n); assert(color_idx >= 0 && color_idx < n);
color_map[i * cols + j] = color_order[color_idx]; color_map[i * cols + j] = color_order[color_idx];

View File

@@ -422,39 +422,6 @@ static void dealloc_compressor_data(AV1_COMP *cpi) {
aom_free(cpi->segmentation_map); aom_free(cpi->segmentation_map);
cpi->segmentation_map = NULL; cpi->segmentation_map = NULL;
#if CONFIG_REF_MV
for (i = 0; i < NMV_CONTEXTS; ++i) {
aom_free(cpi->nmv_costs[i][0]);
aom_free(cpi->nmv_costs[i][1]);
aom_free(cpi->nmv_costs_hp[i][0]);
aom_free(cpi->nmv_costs_hp[i][1]);
cpi->nmv_costs[i][0] = NULL;
cpi->nmv_costs[i][1] = NULL;
cpi->nmv_costs_hp[i][0] = NULL;
cpi->nmv_costs_hp[i][1] = NULL;
}
#endif
aom_free(cpi->nmvcosts[0]);
aom_free(cpi->nmvcosts[1]);
cpi->nmvcosts[0] = NULL;
cpi->nmvcosts[1] = NULL;
aom_free(cpi->nmvcosts_hp[0]);
aom_free(cpi->nmvcosts_hp[1]);
cpi->nmvcosts_hp[0] = NULL;
cpi->nmvcosts_hp[1] = NULL;
aom_free(cpi->nmvsadcosts[0]);
aom_free(cpi->nmvsadcosts[1]);
cpi->nmvsadcosts[0] = NULL;
cpi->nmvsadcosts[1] = NULL;
aom_free(cpi->nmvsadcosts_hp[0]);
aom_free(cpi->nmvsadcosts_hp[1]);
cpi->nmvsadcosts_hp[0] = NULL;
cpi->nmvsadcosts_hp[1] = NULL;
av1_cyclic_refresh_free(cpi->cyclic_refresh); av1_cyclic_refresh_free(cpi->cyclic_refresh);
cpi->cyclic_refresh = NULL; cpi->cyclic_refresh = NULL;
@@ -512,27 +479,15 @@ static void save_coding_context(AV1_COMP *cpi) {
#if CONFIG_REF_MV #if CONFIG_REF_MV
for (i = 0; i < NMV_CONTEXTS; ++i) { for (i = 0; i < NMV_CONTEXTS; ++i) {
av1_copy(cc->nmv_vec_cost[i], cpi->td.mb.nmv_vec_cost[i]); av1_copy(cc->nmv_vec_cost[i], cpi->td.mb.nmv_vec_cost[i]);
memcpy(cc->nmv_costs[i][0], cpi->nmv_costs[i][0], av1_copy(cc->nmv_costs, cpi->nmv_costs);
MV_VALS * sizeof(*cpi->nmv_costs[i][0])); av1_copy(cc->nmv_costs_hp, cpi->nmv_costs_hp);
memcpy(cc->nmv_costs[i][1], cpi->nmv_costs[i][1],
MV_VALS * sizeof(*cpi->nmv_costs[i][1]));
memcpy(cc->nmv_costs_hp[i][0], cpi->nmv_costs_hp[i][0],
MV_VALS * sizeof(*cpi->nmv_costs_hp[i][0]));
memcpy(cc->nmv_costs_hp[i][1], cpi->nmv_costs_hp[i][1],
MV_VALS * sizeof(*cpi->nmv_costs_hp[i][1]));
} }
#else #else
av1_copy(cc->nmvjointcost, cpi->td.mb.nmvjointcost); av1_copy(cc->nmvjointcost, cpi->td.mb.nmvjointcost);
#endif #endif
memcpy(cc->nmvcosts[0], cpi->nmvcosts[0], av1_copy(cc->nmvcosts, cpi->nmvcosts);
MV_VALS * sizeof(*cpi->nmvcosts[0])); av1_copy(cc->nmvcosts_hp, cpi->nmvcosts_hp);
memcpy(cc->nmvcosts[1], cpi->nmvcosts[1],
MV_VALS * sizeof(*cpi->nmvcosts[1]));
memcpy(cc->nmvcosts_hp[0], cpi->nmvcosts_hp[0],
MV_VALS * sizeof(*cpi->nmvcosts_hp[0]));
memcpy(cc->nmvcosts_hp[1], cpi->nmvcosts_hp[1],
MV_VALS * sizeof(*cpi->nmvcosts_hp[1]));
av1_copy(cc->last_ref_lf_deltas, cm->lf.last_ref_deltas); av1_copy(cc->last_ref_lf_deltas, cm->lf.last_ref_deltas);
av1_copy(cc->last_mode_lf_deltas, cm->lf.last_mode_deltas); av1_copy(cc->last_mode_lf_deltas, cm->lf.last_mode_deltas);
@@ -552,25 +507,15 @@ static void restore_coding_context(AV1_COMP *cpi) {
#if CONFIG_REF_MV #if CONFIG_REF_MV
for (i = 0; i < NMV_CONTEXTS; ++i) { for (i = 0; i < NMV_CONTEXTS; ++i) {
av1_copy(cpi->td.mb.nmv_vec_cost[i], cc->nmv_vec_cost[i]); av1_copy(cpi->td.mb.nmv_vec_cost[i], cc->nmv_vec_cost[i]);
memcpy(cpi->nmv_costs[i][0], cc->nmv_costs[i][0], av1_copy(cpi->nmv_costs, cc->nmv_costs);
MV_VALS * sizeof(*cc->nmv_costs[i][0])); av1_copy(cpi->nmv_costs_hp, cc->nmv_costs_hp);
memcpy(cpi->nmv_costs[i][1], cc->nmv_costs[i][1],
MV_VALS * sizeof(*cc->nmv_costs[i][1]));
memcpy(cpi->nmv_costs_hp[i][0], cc->nmv_costs_hp[i][0],
MV_VALS * sizeof(*cc->nmv_costs_hp[i][0]));
memcpy(cpi->nmv_costs_hp[i][1], cc->nmv_costs_hp[i][1],
MV_VALS * sizeof(*cc->nmv_costs_hp[i][1]));
} }
#else #else
av1_copy(cpi->td.mb.nmvjointcost, cc->nmvjointcost); av1_copy(cpi->td.mb.nmvjointcost, cc->nmvjointcost);
#endif #endif
memcpy(cpi->nmvcosts[0], cc->nmvcosts[0], MV_VALS * sizeof(*cc->nmvcosts[0])); av1_copy(cpi->nmvcosts, cc->nmvcosts);
memcpy(cpi->nmvcosts[1], cc->nmvcosts[1], MV_VALS * sizeof(*cc->nmvcosts[1])); av1_copy(cpi->nmvcosts_hp, cc->nmvcosts_hp);
memcpy(cpi->nmvcosts_hp[0], cc->nmvcosts_hp[0],
MV_VALS * sizeof(*cc->nmvcosts_hp[0]));
memcpy(cpi->nmvcosts_hp[1], cc->nmvcosts_hp[1],
MV_VALS * sizeof(*cc->nmvcosts_hp[1]));
av1_copy(cm->lf.last_ref_deltas, cc->last_ref_lf_deltas); av1_copy(cm->lf.last_ref_deltas, cc->last_ref_lf_deltas);
av1_copy(cm->lf.last_mode_deltas, cc->last_mode_lf_deltas); av1_copy(cm->lf.last_mode_deltas, cc->last_mode_lf_deltas);
@@ -2117,33 +2062,15 @@ AV1_COMP *av1_create_compressor(AV1EncoderConfig *oxcf,
#if CONFIG_REF_MV #if CONFIG_REF_MV
for (i = 0; i < NMV_CONTEXTS; ++i) { for (i = 0; i < NMV_CONTEXTS; ++i) {
CHECK_MEM_ERROR(cm, cpi->nmv_costs[i][0], memset(cpi->nmv_costs, 0, sizeof(cpi->nmv_costs));
aom_calloc(MV_VALS, sizeof(*cpi->nmv_costs[i][0]))); memset(cpi->nmv_costs_hp, 0, sizeof(cpi->nmv_costs_hp));
CHECK_MEM_ERROR(cm, cpi->nmv_costs[i][1],
aom_calloc(MV_VALS, sizeof(*cpi->nmv_costs[i][1])));
CHECK_MEM_ERROR(cm, cpi->nmv_costs_hp[i][0],
aom_calloc(MV_VALS, sizeof(*cpi->nmv_costs_hp[i][0])));
CHECK_MEM_ERROR(cm, cpi->nmv_costs_hp[i][1],
aom_calloc(MV_VALS, sizeof(*cpi->nmv_costs_hp[i][1])));
} }
#endif #endif
CHECK_MEM_ERROR(cm, cpi->nmvcosts[0], memset(cpi->nmvcosts, 0, sizeof(cpi->nmvcosts));
aom_calloc(MV_VALS, sizeof(*cpi->nmvcosts[0]))); memset(cpi->nmvcosts_hp, 0, sizeof(cpi->nmvcosts_hp));
CHECK_MEM_ERROR(cm, cpi->nmvcosts[1], memset(cpi->nmvsadcosts, 0, sizeof(cpi->nmvsadcosts));
aom_calloc(MV_VALS, sizeof(*cpi->nmvcosts[1]))); memset(cpi->nmvsadcosts_hp, 0, sizeof(cpi->nmvsadcosts_hp));
CHECK_MEM_ERROR(cm, cpi->nmvcosts_hp[0],
aom_calloc(MV_VALS, sizeof(*cpi->nmvcosts_hp[0])));
CHECK_MEM_ERROR(cm, cpi->nmvcosts_hp[1],
aom_calloc(MV_VALS, sizeof(*cpi->nmvcosts_hp[1])));
CHECK_MEM_ERROR(cm, cpi->nmvsadcosts[0],
aom_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts[0])));
CHECK_MEM_ERROR(cm, cpi->nmvsadcosts[1],
aom_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts[1])));
CHECK_MEM_ERROR(cm, cpi->nmvsadcosts_hp[0],
aom_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts_hp[0])));
CHECK_MEM_ERROR(cm, cpi->nmvsadcosts_hp[1],
aom_calloc(MV_VALS, sizeof(*cpi->nmvsadcosts_hp[1])));
for (i = 0; i < (sizeof(cpi->mbgraph_stats) / sizeof(cpi->mbgraph_stats[0])); for (i = 0; i < (sizeof(cpi->mbgraph_stats) / sizeof(cpi->mbgraph_stats[0]));
i++) { i++) {

View File

@@ -414,14 +414,14 @@ typedef struct AV1_COMP {
CODING_CONTEXT coding_context; CODING_CONTEXT coding_context;
#if CONFIG_REF_MV #if CONFIG_REF_MV
int *nmv_costs[NMV_CONTEXTS][2]; int nmv_costs[NMV_CONTEXTS][2][MV_VALS];
int *nmv_costs_hp[NMV_CONTEXTS][2]; int nmv_costs_hp[NMV_CONTEXTS][2][MV_VALS];
#endif #endif
int *nmvcosts[2]; int nmvcosts[2][MV_VALS];
int *nmvcosts_hp[2]; int nmvcosts_hp[2][MV_VALS];
int *nmvsadcosts[2]; int nmvsadcosts[2][MV_VALS];
int *nmvsadcosts_hp[2]; int nmvsadcosts_hp[2][MV_VALS];
int64_t last_time_stamp_seen; int64_t last_time_stamp_seen;
int64_t last_end_time_stamp_seen; int64_t last_end_time_stamp_seen;

View File

@@ -1771,8 +1771,7 @@ static int rd_pick_palette_intra_sby(
if (colors > 1 && colors <= 64) { if (colors > 1 && colors <= 64) {
int r, c, i, j, k; int r, c, i, j, k;
const int max_itr = 50; const int max_itr = 50;
int color_ctx, color_idx = 0; uint8_t color_order[PALETTE_MAX_SIZE];
int color_order[PALETTE_MAX_SIZE];
float *const data = x->palette_buffer->kmeans_data_buf; float *const data = x->palette_buffer->kmeans_data_buf;
float centroids[PALETTE_MAX_SIZE]; float centroids[PALETTE_MAX_SIZE];
uint8_t *const color_map = xd->plane[0].color_index_map; uint8_t *const color_map = xd->plane[0].color_index_map;
@@ -1856,13 +1855,9 @@ static int rd_pick_palette_intra_sby(
1); 1);
for (i = 0; i < rows; ++i) { for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) { for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
color_ctx = av1_get_palette_color_context(color_map, cols, i, j, k, int color_idx;
color_order); const int color_ctx = av1_get_palette_color_context(
for (r = 0; r < k; ++r) color_map, cols, i, j, k, color_order, &color_idx);
if (color_map[i * cols + j] == color_order[r]) {
color_idx = r;
break;
}
assert(color_idx >= 0 && color_idx < k); assert(color_idx >= 0 && color_idx < k);
this_rate += cpi->palette_y_color_cost[k - 2][color_ctx][color_idx]; this_rate += cpi->palette_y_color_cost[k - 2][color_ctx][color_idx];
} }
@@ -3652,8 +3647,7 @@ static void rd_pick_palette_intra_sbuv(
if (colors > 1 && colors <= 64) { if (colors > 1 && colors <= 64) {
int r, c, n, i, j; int r, c, n, i, j;
const int max_itr = 50; const int max_itr = 50;
int color_ctx, color_idx = 0; uint8_t color_order[PALETTE_MAX_SIZE];
int color_order[PALETTE_MAX_SIZE];
int64_t this_sse; int64_t this_sse;
float lb_u, ub_u, val_u; float lb_u, ub_u, val_u;
float lb_v, ub_v, val_v; float lb_v, ub_v, val_v;
@@ -3746,13 +3740,9 @@ static void rd_pick_palette_intra_sbuv(
for (i = 0; i < rows; ++i) { for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) { for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
color_ctx = av1_get_palette_color_context(color_map, cols, i, j, n, int color_idx;
color_order); const int color_ctx = av1_get_palette_color_context(
for (r = 0; r < n; ++r) color_map, cols, i, j, n, color_order, &color_idx);
if (color_map[i * cols + j] == color_order[r]) {
color_idx = r;
break;
}
assert(color_idx >= 0 && color_idx < n); assert(color_idx >= 0 && color_idx < n);
this_rate += cpi->palette_uv_color_cost[n - 2][color_ctx][color_idx]; this_rate += cpi->palette_uv_color_cost[n - 2][color_ctx][color_idx];
} }
@@ -9383,7 +9373,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
int best_rate_nocoef; int best_rate_nocoef;
#endif #endif
int64_t distortion2 = 0, distortion_y = 0, dummy_rd = best_rd, this_rd; int64_t distortion2 = 0, distortion_y = 0, dummy_rd = best_rd, this_rd;
int skippable = 0; int skippable = 0, rate_overhead = 0;
TX_SIZE best_tx_size, uv_tx; TX_SIZE best_tx_size, uv_tx;
TX_TYPE best_tx_type; TX_TYPE best_tx_type;
PALETTE_MODE_INFO palette_mode_info; PALETTE_MODE_INFO palette_mode_info;

View File

@@ -410,18 +410,19 @@ static INLINE int get_tx_eob(const struct segmentation *seg, int segment_id,
} }
#if CONFIG_PALETTE #if CONFIG_PALETTE
void av1_tokenize_palette_sb(const AV1_COMP *cpi, struct ThreadData *const td, void av1_tokenize_palette_sb(const AV1_COMP *cpi,
int plane, TOKENEXTRA **t, RUN_TYPE dry_run, const struct ThreadData *const td, int plane,
BLOCK_SIZE bsize, int *rate) { TOKENEXTRA **t, RUN_TYPE dry_run, BLOCK_SIZE bsize,
MACROBLOCK *const x = &td->mb; int *rate) {
MACROBLOCKD *const xd = &x->e_mbd; const MACROBLOCK *const x = &td->mb;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; const MACROBLOCKD *const xd = &x->e_mbd;
uint8_t *color_map = xd->plane[plane != 0].color_index_map; const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
PALETTE_MODE_INFO *pmi = &mbmi->palette_mode_info; const uint8_t *const color_map = xd->plane[plane != 0].color_index_map;
int n = pmi->palette_size[plane != 0]; const PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
int i, j, k; const int n = pmi->palette_size[plane != 0];
int i, j;
int this_rate = 0; int this_rate = 0;
int color_idx = -1, color_ctx, color_order[PALETTE_MAX_SIZE]; uint8_t color_order[PALETTE_MAX_SIZE];
const int rows = (4 * num_4x4_blocks_high_lookup[bsize]) >> const int rows = (4 * num_4x4_blocks_high_lookup[bsize]) >>
(xd->plane[plane != 0].subsampling_y); (xd->plane[plane != 0].subsampling_y);
const int cols = (4 * num_4x4_blocks_wide_lookup[bsize]) >> const int cols = (4 * num_4x4_blocks_wide_lookup[bsize]) >>
@@ -432,17 +433,13 @@ void av1_tokenize_palette_sb(const AV1_COMP *cpi, struct ThreadData *const td,
for (i = 0; i < rows; ++i) { for (i = 0; i < rows; ++i) {
for (j = (i == 0 ? 1 : 0); j < cols; ++j) { for (j = (i == 0 ? 1 : 0); j < cols; ++j) {
color_ctx = int color_new_idx;
av1_get_palette_color_context(color_map, cols, i, j, n, color_order); const int color_ctx = av1_get_palette_color_context(
for (k = 0; k < n; ++k) color_map, cols, i, j, n, color_order, &color_new_idx);
if (color_map[i * cols + j] == color_order[k]) { assert(color_new_idx >= 0 && color_new_idx < n);
color_idx = k;
break;
}
assert(color_idx >= 0 && color_idx < n);
if (dry_run == DRY_RUN_COSTCOEFFS) if (dry_run == DRY_RUN_COSTCOEFFS)
this_rate += cpi->palette_y_color_cost[n - 2][color_ctx][color_idx]; this_rate += cpi->palette_y_color_cost[n - 2][color_ctx][color_new_idx];
(*t)->token = color_idx; (*t)->token = color_new_idx;
(*t)->context_tree = probs[n - 2][color_ctx]; (*t)->context_tree = probs[n - 2][color_ctx];
(*t)->skip_eob_node = 0; (*t)->skip_eob_node = 0;
++(*t); ++(*t);

View File

@@ -72,7 +72,7 @@ void av1_tokenize_sb_vartx(const struct AV1_COMP *cpi, struct ThreadData *td,
#endif #endif
#if CONFIG_PALETTE #if CONFIG_PALETTE
void av1_tokenize_palette_sb(const struct AV1_COMP *cpi, void av1_tokenize_palette_sb(const struct AV1_COMP *cpi,
struct ThreadData *const td, int plane, const struct ThreadData *const td, int plane,
TOKENEXTRA **t, RUN_TYPE dry_run, BLOCK_SIZE bsize, TOKENEXTRA **t, RUN_TYPE dry_run, BLOCK_SIZE bsize,
int *rate); int *rate);
#endif // CONFIG_PALETTE #endif // CONFIG_PALETTE

4
configure vendored
View File

@@ -618,6 +618,10 @@ process_toolchain() {
check_add_cflags -Wuninitialized check_add_cflags -Wuninitialized
check_add_cflags -Wunused check_add_cflags -Wunused
check_add_cflags -Wsign-compare check_add_cflags -Wsign-compare
# Enabling the following warning (in combination with -Wunused above)
# for C++ generates errors in third_party code including googletest and
# libyuv. So enable it only for C code.
check_cflags "-Wextra" && add_cflags_only "-Wextra"
# Enabling the following warning for C++ generates some useless warnings # Enabling the following warning for C++ generates some useless warnings
# about some function parameters shadowing class member function names. # about some function parameters shadowing class member function names.
# So, only enable this warning for C code. # So, only enable this warning for C code.

View File

@@ -191,8 +191,7 @@ static void find_mismatch(const aom_image_t *const img1,
} }
static void testing_decode(aom_codec_ctx_t *encoder, aom_codec_ctx_t *decoder, static void testing_decode(aom_codec_ctx_t *encoder, aom_codec_ctx_t *decoder,
aom_codec_enc_cfg_t *cfg, unsigned int frame_out, unsigned int frame_out, int *mismatch_seen) {
int *mismatch_seen) {
aom_image_t enc_img, dec_img; aom_image_t enc_img, dec_img;
struct av1_ref_frame ref_enc, ref_dec; struct av1_ref_frame ref_enc, ref_dec;
@@ -226,11 +225,10 @@ static void testing_decode(aom_codec_ctx_t *encoder, aom_codec_ctx_t *decoder,
aom_img_free(&dec_img); aom_img_free(&dec_img);
} }
static int encode_frame(aom_codec_ctx_t *ecodec, aom_codec_enc_cfg_t *cfg, static int encode_frame(aom_codec_ctx_t *ecodec, aom_image_t *img,
aom_image_t *img, unsigned int frame_in, unsigned int frame_in, AvxVideoWriter *writer,
AvxVideoWriter *writer, int test_decode, int test_decode, aom_codec_ctx_t *dcodec,
aom_codec_ctx_t *dcodec, unsigned int *frame_out, unsigned int *frame_out, int *mismatch_seen) {
int *mismatch_seen) {
int got_pkts = 0; int got_pkts = 0;
aom_codec_iter_t iter = NULL; aom_codec_iter_t iter = NULL;
const aom_codec_cx_pkt_t *pkt = NULL; const aom_codec_cx_pkt_t *pkt = NULL;
@@ -271,7 +269,7 @@ static int encode_frame(aom_codec_ctx_t *ecodec, aom_codec_enc_cfg_t *cfg,
// Mismatch checking // Mismatch checking
if (got_data && test_decode) { if (got_data && test_decode) {
testing_decode(ecodec, dcodec, cfg, *frame_out, mismatch_seen); testing_decode(ecodec, dcodec, *frame_out, mismatch_seen);
} }
return got_pkts; return got_pkts;
@@ -280,12 +278,12 @@ static int encode_frame(aom_codec_ctx_t *ecodec, aom_codec_enc_cfg_t *cfg,
int main(int argc, char **argv) { int main(int argc, char **argv) {
FILE *infile = NULL; FILE *infile = NULL;
// Encoder // Encoder
aom_codec_ctx_t ecodec = { 0 }; aom_codec_ctx_t ecodec;
aom_codec_enc_cfg_t cfg = { 0 }; aom_codec_enc_cfg_t cfg;
unsigned int frame_in = 0; unsigned int frame_in = 0;
aom_image_t raw; aom_image_t raw;
aom_codec_err_t res; aom_codec_err_t res;
AvxVideoInfo info = { 0 }; AvxVideoInfo info;
AvxVideoWriter *writer = NULL; AvxVideoWriter *writer = NULL;
const AvxInterface *encoder = NULL; const AvxInterface *encoder = NULL;
@@ -311,6 +309,12 @@ int main(int argc, char **argv) {
unsigned int limit = 0; unsigned int limit = 0;
exec_name = argv[0]; exec_name = argv[0];
// Clear explicitly, as simply assigning "{ 0 }" generates
// "missing-field-initializers" warning in some compilers.
memset(&ecodec, 0, sizeof(ecodec));
memset(&cfg, 0, sizeof(cfg));
memset(&info, 0, sizeof(info));
if (argc < 7) die("Invalid number of arguments"); if (argc < 7) die("Invalid number of arguments");
codec_arg = argv[1]; codec_arg = argv[1];
@@ -404,7 +408,7 @@ int main(int argc, char **argv) {
} }
} }
encode_frame(&ecodec, &cfg, &raw, frame_in, writer, test_decode, &dcodec, encode_frame(&ecodec, &raw, frame_in, writer, test_decode, &dcodec,
&frame_out, &mismatch_seen); &frame_out, &mismatch_seen);
frame_in++; frame_in++;
if (mismatch_seen) break; if (mismatch_seen) break;
@@ -412,8 +416,8 @@ int main(int argc, char **argv) {
// Flush encoder. // Flush encoder.
if (!mismatch_seen) if (!mismatch_seen)
while (encode_frame(&ecodec, &cfg, NULL, frame_in, writer, test_decode, while (encode_frame(&ecodec, NULL, frame_in, writer, test_decode, &dcodec,
&dcodec, &frame_out, &mismatch_seen)) { &frame_out, &mismatch_seen)) {
} }
printf("\n"); printf("\n");

View File

@@ -63,13 +63,17 @@ int main(int argc, char **argv) {
int frame_count = 0; int frame_count = 0;
aom_image_t raw; aom_image_t raw;
aom_codec_err_t res; aom_codec_err_t res;
AvxVideoInfo info = { 0 }; AvxVideoInfo info;
AvxVideoWriter *writer = NULL; AvxVideoWriter *writer = NULL;
const AvxInterface *encoder = NULL; const AvxInterface *encoder = NULL;
const int fps = 30; const int fps = 30;
exec_name = argv[0]; exec_name = argv[0];
// Clear explicitly, as simply assigning "{ 0 }" generates
// "missing-field-initializers" warning in some compilers.
memset(&info, 0, sizeof(info));
if (argc < 5) die("Invalid number of arguments"); if (argc < 5) die("Invalid number of arguments");
encoder = get_aom_encoder_by_name("av1"); encoder = get_aom_encoder_by_name("av1");

View File

@@ -151,7 +151,7 @@ int main(int argc, char **argv) {
int frame_count = 0; int frame_count = 0;
aom_image_t raw; aom_image_t raw;
aom_codec_err_t res; aom_codec_err_t res;
AvxVideoInfo info = { 0 }; AvxVideoInfo info;
AvxVideoWriter *writer = NULL; AvxVideoWriter *writer = NULL;
const AvxInterface *encoder = NULL; const AvxInterface *encoder = NULL;
const int fps = 30; const int fps = 30;
@@ -168,6 +168,10 @@ int main(int argc, char **argv) {
exec_name = argv[0]; exec_name = argv[0];
// Clear explicitly, as simply assigning "{ 0 }" generates
// "missing-field-initializers" warning in some compilers.
memset(&info, 0, sizeof(info));
if (argc != 9) die("Invalid number of arguments"); if (argc != 9) die("Invalid number of arguments");
codec_arg = argv[1]; codec_arg = argv[1];

View File

@@ -54,7 +54,6 @@ const size_t maxHeight = 256;
const size_t maxBlockSize = maxWidth * maxHeight; const size_t maxBlockSize = maxWidth * maxHeight;
const int horizOffset = 32; const int horizOffset = 32;
const int vertiOffset = 32; const int vertiOffset = 32;
const size_t testMaxBlk = 128;
const int stride = 128; const int stride = 128;
const int x_step_q4 = 16; const int x_step_q4 = 16;
@@ -90,7 +89,7 @@ class AV1ConvolveOptimzTest : public ::testing::TestWithParam<ConvParams> {
void RunVertFilterBitExactCheck(); void RunVertFilterBitExactCheck();
private: private:
void PrepFilterBuffer(int w, int h); void PrepFilterBuffer();
void DiffFilterBuffer(); void DiffFilterBuffer();
conv_filter_t conv_horiz_; conv_filter_t conv_horiz_;
conv_filter_t conv_vert_; conv_filter_t conv_vert_;
@@ -106,7 +105,7 @@ class AV1ConvolveOptimzTest : public ::testing::TestWithParam<ConvParams> {
int avg_; int avg_;
}; };
void AV1ConvolveOptimzTest::PrepFilterBuffer(int w, int h) { void AV1ConvolveOptimzTest::PrepFilterBuffer() {
int r, c; int r, c;
ACMRandom rnd(ACMRandom::DeterministicSeed()); ACMRandom rnd(ACMRandom::DeterministicSeed());
@@ -150,7 +149,7 @@ void AV1ConvolveOptimzTest::DiffFilterBuffer() {
} }
void AV1ConvolveOptimzTest::RunHorizFilterBitExactCheck() { void AV1ConvolveOptimzTest::RunHorizFilterBitExactCheck() {
PrepFilterBuffer(testMaxBlk, testMaxBlk); PrepFilterBuffer();
InterpFilterParams filter_params = av1_get_interp_filter_params(filter_); InterpFilterParams filter_params = av1_get_interp_filter_params(filter_);
@@ -167,7 +166,7 @@ void AV1ConvolveOptimzTest::RunHorizFilterBitExactCheck() {
// and test again. // and test again.
int intermediate_height = int intermediate_height =
(((height_ - 1) * 16 + subpel_) >> SUBPEL_BITS) + filter_params.taps; (((height_ - 1) * 16 + subpel_) >> SUBPEL_BITS) + filter_params.taps;
PrepFilterBuffer(testMaxBlk, testMaxBlk); PrepFilterBuffer();
av1_convolve_horiz_c(src_ref_, stride, dst_ref_, stride, width_, av1_convolve_horiz_c(src_ref_, stride, dst_ref_, stride, width_,
intermediate_height, filter_params, subpel_, x_step_q4, intermediate_height, filter_params, subpel_, x_step_q4,
@@ -180,7 +179,7 @@ void AV1ConvolveOptimzTest::RunHorizFilterBitExactCheck() {
} }
void AV1ConvolveOptimzTest::RunVertFilterBitExactCheck() { void AV1ConvolveOptimzTest::RunVertFilterBitExactCheck() {
PrepFilterBuffer(testMaxBlk, testMaxBlk); PrepFilterBuffer();
InterpFilterParams filter_params = av1_get_interp_filter_params(filter_); InterpFilterParams filter_params = av1_get_interp_filter_params(filter_);
@@ -266,7 +265,7 @@ class AV1HbdConvolveOptimzTest : public TestWithHbdConvParams {
void RunVertFilterBitExactCheck(); void RunVertFilterBitExactCheck();
private: private:
void PrepFilterBuffer(int w, int h); void PrepFilterBuffer();
void DiffFilterBuffer(); void DiffFilterBuffer();
hbd_conv_filter_t conv_horiz_; hbd_conv_filter_t conv_horiz_;
hbd_conv_filter_t conv_vert_; hbd_conv_filter_t conv_vert_;
@@ -283,7 +282,7 @@ class AV1HbdConvolveOptimzTest : public TestWithHbdConvParams {
int bit_depth_; int bit_depth_;
}; };
void AV1HbdConvolveOptimzTest::PrepFilterBuffer(int w, int h) { void AV1HbdConvolveOptimzTest::PrepFilterBuffer() {
int r, c; int r, c;
ACMRandom rnd(ACMRandom::DeterministicSeed()); ACMRandom rnd(ACMRandom::DeterministicSeed());
@@ -326,7 +325,7 @@ void AV1HbdConvolveOptimzTest::DiffFilterBuffer() {
} }
void AV1HbdConvolveOptimzTest::RunHorizFilterBitExactCheck() { void AV1HbdConvolveOptimzTest::RunHorizFilterBitExactCheck() {
PrepFilterBuffer(testMaxBlk, testMaxBlk); PrepFilterBuffer();
InterpFilterParams filter_params = av1_get_interp_filter_params(filter_); InterpFilterParams filter_params = av1_get_interp_filter_params(filter_);
@@ -344,7 +343,7 @@ void AV1HbdConvolveOptimzTest::RunHorizFilterBitExactCheck() {
// and test again. // and test again.
int intermediate_height = int intermediate_height =
(((height_ - 1) * 16 + subpel_) >> SUBPEL_BITS) + filter_params.taps; (((height_ - 1) * 16 + subpel_) >> SUBPEL_BITS) + filter_params.taps;
PrepFilterBuffer(testMaxBlk, testMaxBlk); PrepFilterBuffer();
av1_highbd_convolve_horiz_c(src_, stride, dst_ref_, stride, width_, av1_highbd_convolve_horiz_c(src_, stride, dst_ref_, stride, width_,
intermediate_height, filter_params, subpel_, intermediate_height, filter_params, subpel_,
@@ -357,7 +356,7 @@ void AV1HbdConvolveOptimzTest::RunHorizFilterBitExactCheck() {
} }
void AV1HbdConvolveOptimzTest::RunVertFilterBitExactCheck() { void AV1HbdConvolveOptimzTest::RunVertFilterBitExactCheck() {
PrepFilterBuffer(testMaxBlk, testMaxBlk); PrepFilterBuffer();
InterpFilterParams filter_params = av1_get_interp_filter_params(filter_); InterpFilterParams filter_params = av1_get_interp_filter_params(filter_);

View File

@@ -123,6 +123,9 @@ class AV1CodecFactory : public CodecFactory {
#if CONFIG_AV1_DECODER #if CONFIG_AV1_DECODER
return new AV1Decoder(cfg, flags, deadline); return new AV1Decoder(cfg, flags, deadline);
#else #else
(void)cfg;
(void)flags;
(void)deadline;
return NULL; return NULL;
#endif #endif
} }
@@ -134,6 +137,10 @@ class AV1CodecFactory : public CodecFactory {
#if CONFIG_AV1_ENCODER #if CONFIG_AV1_ENCODER
return new AV1Encoder(cfg, deadline, init_flags, stats); return new AV1Encoder(cfg, deadline, init_flags, stats);
#else #else
(void)cfg;
(void)deadline;
(void)init_flags;
(void)stats;
return NULL; return NULL;
#endif #endif
} }
@@ -143,6 +150,8 @@ class AV1CodecFactory : public CodecFactory {
#if CONFIG_AV1_ENCODER #if CONFIG_AV1_ENCODER
return aom_codec_enc_config_default(&aom_codec_av1_cx_algo, cfg, usage); return aom_codec_enc_config_default(&aom_codec_av1_cx_algo, cfg, usage);
#else #else
(void)cfg;
(void)usage;
return AOM_CODEC_INCAPABLE; return AOM_CODEC_INCAPABLE;
#endif #endif
} }

View File

@@ -264,12 +264,12 @@ void idct16x16_12(const tran_low_t *in, uint8_t *out, int stride) {
} }
void idct16x16_10_ref(const tran_low_t *in, uint8_t *out, int stride, void idct16x16_10_ref(const tran_low_t *in, uint8_t *out, int stride,
int tx_type) { int /*tx_type*/) {
idct16x16_10(in, out, stride); idct16x16_10(in, out, stride);
} }
void idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride, void idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride,
int tx_type) { int /*tx_type*/) {
idct16x16_12(in, out, stride); idct16x16_12(in, out, stride);
} }
@@ -727,7 +727,7 @@ class InvTrans16x16DCT : public Trans16x16TestBase,
virtual void TearDown() { libaom_test::ClearSystemState(); } virtual void TearDown() { libaom_test::ClearSystemState(); }
protected: protected:
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {} void RunFwdTxfm(int16_t * /*in*/, tran_low_t * /*out*/, int /*stride*/) {}
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) { void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
inv_txfm_(out, dst, stride); inv_txfm_(out, dst, stride);
} }

View File

@@ -92,7 +92,7 @@ void DecoderTest::RunLoop(CompressedVideoSource *video,
aom_codec_err_t res_dec = aom_codec_err_t res_dec =
decoder->DecodeFrame(video->cxdata(), video->frame_size()); decoder->DecodeFrame(video->cxdata(), video->frame_size());
if (!HandleDecodeResult(res_dec, *video, decoder)) break; if (!HandleDecodeResult(res_dec, decoder)) break;
} else { } else {
// Signal end of the file to the decoder. // Signal end of the file to the decoder.
const aom_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0); const aom_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);

View File

@@ -141,7 +141,6 @@ class DecoderTest {
// Hook to be called to handle decode result. Return true to continue. // Hook to be called to handle decode result. Return true to continue.
virtual bool HandleDecodeResult(const aom_codec_err_t res_dec, virtual bool HandleDecodeResult(const aom_codec_err_t res_dec,
const CompressedVideoSource & /*video*/,
Decoder *decoder) { Decoder *decoder) {
EXPECT_EQ(AOM_CODEC_OK, res_dec) << decoder->DecodeError(); EXPECT_EQ(AOM_CODEC_OK, res_dec) << decoder->DecodeError();
return AOM_CODEC_OK == res_dec; return AOM_CODEC_OK == res_dec;

View File

@@ -275,7 +275,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
aom_codec_err_t res_dec = decoder->DecodeFrame( aom_codec_err_t res_dec = decoder->DecodeFrame(
(const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz); (const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz);
if (!HandleDecodeResult(res_dec, *video, decoder.get())) break; if (!HandleDecodeResult(res_dec, decoder.get())) break;
has_dxdata = true; has_dxdata = true;
} }
@@ -293,7 +293,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
// Flush the decoder when there are no more fragments. // Flush the decoder when there are no more fragments.
if ((init_flags_ & AOM_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) { if ((init_flags_ & AOM_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) {
const aom_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0); const aom_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
if (!HandleDecodeResult(res_dec, *video, decoder.get())) break; if (!HandleDecodeResult(res_dec, decoder.get())) break;
} }
if (has_dxdata && has_cxdata) { if (has_dxdata && has_cxdata) {

View File

@@ -228,7 +228,6 @@ class EncoderTest {
// Hook to be called to handle decode result. Return true to continue. // Hook to be called to handle decode result. Return true to continue.
virtual bool HandleDecodeResult(const aom_codec_err_t res_dec, virtual bool HandleDecodeResult(const aom_codec_err_t res_dec,
const VideoSource & /*video*/,
Decoder *decoder) { Decoder *decoder) {
EXPECT_EQ(AOM_CODEC_OK, res_dec) << decoder->DecodeError(); EXPECT_EQ(AOM_CODEC_OK, res_dec) << decoder->DecodeError();
return AOM_CODEC_OK == res_dec; return AOM_CODEC_OK == res_dec;

View File

@@ -94,7 +94,6 @@ class AvxEncoderParmsGetToDecoder
} }
virtual bool HandleDecodeResult(const aom_codec_err_t res_dec, virtual bool HandleDecodeResult(const aom_codec_err_t res_dec,
const libaom_test::VideoSource & /*video*/,
libaom_test::Decoder *decoder) { libaom_test::Decoder *decoder) {
aom_codec_ctx_t *const av1_decoder = decoder->GetDecoder(); aom_codec_ctx_t *const av1_decoder = decoder->GetDecoder();
aom_codec_alg_priv_t *const priv = aom_codec_alg_priv_t *const priv =

View File

@@ -55,8 +55,7 @@ class ErrorResilienceTestLarge
nframes_++; nframes_++;
} }
virtual void PreEncodeFrameHook(libaom_test::VideoSource *video, virtual void PreEncodeFrameHook(libaom_test::VideoSource *video) {
::libaom_test::Encoder * /*encoder*/) {
frame_flags_ &= frame_flags_ &=
~(AOM_EFLAG_NO_UPD_LAST | AOM_EFLAG_NO_UPD_GF | AOM_EFLAG_NO_UPD_ARF); ~(AOM_EFLAG_NO_UPD_LAST | AOM_EFLAG_NO_UPD_GF | AOM_EFLAG_NO_UPD_ARF);
if (droppable_nframes_ > 0 && if (droppable_nframes_ > 0 &&

View File

@@ -28,7 +28,6 @@ class AV1FrameSizeTestsLarge : public ::libaom_test::EncoderTest,
} }
virtual bool HandleDecodeResult(const aom_codec_err_t res_dec, virtual bool HandleDecodeResult(const aom_codec_err_t res_dec,
const libaom_test::VideoSource & /*video*/,
libaom_test::Decoder *decoder) { libaom_test::Decoder *decoder) {
EXPECT_EQ(expected_res_, res_dec) << decoder->DecodeError(); EXPECT_EQ(expected_res_, res_dec) << decoder->DecodeError();
return !::testing::Test::HasFailure(); return !::testing::Test::HasFailure();

View File

@@ -101,8 +101,7 @@ static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, int l2w,
} }
RoundHighBitDepth(bit_depth, &se, &sse); RoundHighBitDepth(bit_depth, &se, &sse);
*sse_ptr = static_cast<uint32_t>(sse); *sse_ptr = static_cast<uint32_t>(sse);
return static_cast<uint32_t>( return static_cast<uint32_t>(sse - ((se * se) >> (l2w + l2h)));
sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
} }
/* The subpel reference functions differ from the codec version in one aspect: /* The subpel reference functions differ from the codec version in one aspect:
@@ -157,8 +156,7 @@ static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
} }
RoundHighBitDepth(bit_depth, &se, &sse); RoundHighBitDepth(bit_depth, &se, &sse);
*sse_ptr = static_cast<uint32_t>(sse); *sse_ptr = static_cast<uint32_t>(sse);
return static_cast<uint32_t>( return static_cast<uint32_t>(sse - ((se * se) >> (l2w + l2h)));
sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
} }
static uint32_t subpel_avg_variance_ref(const uint8_t *ref, const uint8_t *src, static uint32_t subpel_avg_variance_ref(const uint8_t *ref, const uint8_t *src,
@@ -211,8 +209,7 @@ static uint32_t subpel_avg_variance_ref(const uint8_t *ref, const uint8_t *src,
} }
RoundHighBitDepth(bit_depth, &se, &sse); RoundHighBitDepth(bit_depth, &se, &sse);
*sse_ptr = static_cast<uint32_t>(sse); *sse_ptr = static_cast<uint32_t>(sse);
return static_cast<uint32_t>( return static_cast<uint32_t>(sse - ((se * se) >> (l2w + l2h)));
sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@@ -24,7 +24,6 @@ const int kVideoTrackNumber = 1;
void write_webm_file_header(struct WebmOutputContext *webm_ctx, void write_webm_file_header(struct WebmOutputContext *webm_ctx,
const aom_codec_enc_cfg_t *cfg, const aom_codec_enc_cfg_t *cfg,
const struct aom_rational *fps,
stereo_format_t stereo_fmt, unsigned int fourcc, stereo_format_t stereo_fmt, unsigned int fourcc,
const struct AvxRational *par) { const struct AvxRational *par) {
mkvmuxer::MkvWriter *const writer = new mkvmuxer::MkvWriter(webm_ctx->stream); mkvmuxer::MkvWriter *const writer = new mkvmuxer::MkvWriter(webm_ctx->stream);

View File

@@ -40,7 +40,6 @@ typedef enum stereo_format {
void write_webm_file_header(struct WebmOutputContext *webm_ctx, void write_webm_file_header(struct WebmOutputContext *webm_ctx,
const aom_codec_enc_cfg_t *cfg, const aom_codec_enc_cfg_t *cfg,
const struct aom_rational *fps,
stereo_format_t stereo_fmt, unsigned int fourcc, stereo_format_t stereo_fmt, unsigned int fourcc,
const struct AvxRational *par); const struct AvxRational *par);