aom: update libaom to 0ec86ac7ae1e32a7e70410fa4972a655ec3670a4

This commit is contained in:
Roy Tam 2019-02-22 21:52:01 +08:00
commit eb361970c5
438 changed files with 52661 additions and 21905 deletions

View file

@ -92,6 +92,9 @@ void av1_free_ref_frame_buffers(BufferPool *pool) {
if (pool->frame_bufs[i].ref_count > 0 &&
pool->frame_bufs[i].raw_frame_buffer.data != NULL) {
pool->release_fb_cb(pool->cb_priv, &pool->frame_bufs[i].raw_frame_buffer);
pool->frame_bufs[i].raw_frame_buffer.data = NULL;
pool->frame_bufs[i].raw_frame_buffer.size = 0;
pool->frame_bufs[i].raw_frame_buffer.priv = NULL;
pool->frame_bufs[i].ref_count = 0;
}
aom_free(pool->frame_bufs[i].mvs);
@ -131,13 +134,12 @@ void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
const int ext_h = RESTORATION_UNIT_OFFSET + (mi_h << MI_SIZE_LOG2);
const int tile_stripes = (ext_h + 63) / 64;
num_stripes += tile_stripes;
cm->rst_end_stripe[i] = num_stripes;
}
// Now we need to allocate enough space to store the line buffers for the
// stripes
const int frame_w = cm->superres_upscaled_width;
const int use_highbd = cm->seq_params.use_highbitdepth ? 1 : 0;
const int use_highbd = cm->seq_params.use_highbitdepth;
for (int p = 0; p < num_planes; ++p) {
const int is_uv = p > 0;
@ -293,8 +295,8 @@ void av1_remove_common(AV1_COMMON *cm) {
aom_free(cm->fc);
cm->fc = NULL;
aom_free(cm->frame_contexts);
cm->frame_contexts = NULL;
aom_free(cm->default_frame_context);
cm->default_frame_context = NULL;
}
void av1_init_context_buffers(AV1_COMMON *cm) { cm->setup_mi(cm); }

File diff suppressed because it is too large Load diff

View file

@ -12,6 +12,8 @@
#include <arm_neon.h>
#include <assert.h>
#include "config/av1_rtcd.h"
#include "aom_ports/mem.h"
#include "av1/common/arm/mem_neon.h"

View file

@ -23,19 +23,17 @@
#include "av1/common/arm/transpose_neon.h"
#if !defined(__aarch64__)
static INLINE void compute_avg_4x1(uint16x4_t res0, uint16x4_t d0,
const uint16_t fwd_offset,
const uint16_t bck_offset,
const int16x4_t sub_const_vec,
const int16_t round_bits,
const int use_jnt_comp_avg, uint8x8_t *t0) {
static INLINE void compute_avg_4x1(
uint16x4_t res0, uint16x4_t d0, const uint16_t fwd_offset,
const uint16_t bck_offset, const int16x4_t sub_const_vec,
const int16_t round_bits, const int use_dist_wtd_comp_avg, uint8x8_t *t0) {
int16x4_t tmp0;
uint16x4_t tmp_u0;
uint32x4_t sum0;
int32x4_t dst0;
int16x8_t tmp4;
if (use_jnt_comp_avg) {
if (use_dist_wtd_comp_avg) {
const int32x4_t round_bits_vec = vdupq_n_s32((int32_t)(-round_bits));
sum0 = vmull_n_u16(res0, fwd_offset);
@ -65,12 +63,10 @@ static INLINE void compute_avg_4x1(uint16x4_t res0, uint16x4_t d0,
}
}
static INLINE void compute_avg_8x1(uint16x8_t res0, uint16x8_t d0,
const uint16_t fwd_offset,
const uint16_t bck_offset,
const int16x4_t sub_const,
const int16_t round_bits,
const int use_jnt_comp_avg, uint8x8_t *t0) {
static INLINE void compute_avg_8x1(
uint16x8_t res0, uint16x8_t d0, const uint16_t fwd_offset,
const uint16_t bck_offset, const int16x4_t sub_const,
const int16_t round_bits, const int use_dist_wtd_comp_avg, uint8x8_t *t0) {
int16x4_t tmp0, tmp2;
int16x8_t f0;
uint32x4_t sum0, sum2;
@ -78,7 +74,7 @@ static INLINE void compute_avg_8x1(uint16x8_t res0, uint16x8_t d0,
uint16x8_t tmp_u0;
if (use_jnt_comp_avg) {
if (use_dist_wtd_comp_avg) {
const int32x4_t sub_const_vec = vmovl_s16(sub_const);
const int32x4_t round_bits_vec = vdupq_n_s32(-(int32_t)round_bits);
@ -123,7 +119,7 @@ static INLINE void compute_avg_4x4(
uint16x4_t d0, uint16x4_t d1, uint16x4_t d2, uint16x4_t d3,
const uint16_t fwd_offset, const uint16_t bck_offset,
const int16x4_t sub_const_vec, const int16_t round_bits,
const int use_jnt_comp_avg, uint8x8_t *t0, uint8x8_t *t1) {
const int use_dist_wtd_comp_avg, uint8x8_t *t0, uint8x8_t *t1) {
int16x4_t tmp0, tmp1, tmp2, tmp3;
uint16x4_t tmp_u0, tmp_u1, tmp_u2, tmp_u3;
uint32x4_t sum0, sum1, sum2, sum3;
@ -132,7 +128,7 @@ static INLINE void compute_avg_4x4(
int16x8_t tmp4, tmp5;
const int16x8_t zero = vdupq_n_s16(0);
if (use_jnt_comp_avg) {
if (use_dist_wtd_comp_avg) {
const int32x4_t round_bits_vec = vdupq_n_s32((int32_t)(-round_bits));
const int32x4_t const_vec = vmovl_s16(sub_const_vec);
@ -203,8 +199,8 @@ static INLINE void compute_avg_8x4(
uint16x8_t d0, uint16x8_t d1, uint16x8_t d2, uint16x8_t d3,
const uint16_t fwd_offset, const uint16_t bck_offset,
const int16x4_t sub_const, const int16_t round_bits,
const int use_jnt_comp_avg, uint8x8_t *t0, uint8x8_t *t1, uint8x8_t *t2,
uint8x8_t *t3) {
const int use_dist_wtd_comp_avg, uint8x8_t *t0, uint8x8_t *t1,
uint8x8_t *t2, uint8x8_t *t3) {
int16x4_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int16x8_t f0, f1, f2, f3;
uint32x4_t sum0, sum1, sum2, sum3;
@ -214,7 +210,7 @@ static INLINE void compute_avg_8x4(
uint16x8_t tmp_u0, tmp_u1, tmp_u2, tmp_u3;
const int16x8_t zero = vdupq_n_s16(0);
if (use_jnt_comp_avg) {
if (use_dist_wtd_comp_avg) {
const int32x4_t sub_const_vec = vmovl_s16(sub_const);
const int32x4_t round_bits_vec = vdupq_n_s32(-(int32_t)round_bits);
@ -319,7 +315,7 @@ static INLINE void compute_avg_8x4(
}
}
static INLINE void jnt_convolve_2d_horiz_neon(
static INLINE void dist_wtd_convolve_2d_horiz_neon(
const uint8_t *src, int src_stride, int16_t *im_block, const int im_stride,
int16_t *x_filter_tmp, const int im_h, int w, const int round_0) {
const int bd = 8;
@ -563,7 +559,7 @@ static INLINE void jnt_convolve_2d_horiz_neon(
}
}
static INLINE void jnt_convolve_2d_vert_neon(
static INLINE void dist_wtd_convolve_2d_vert_neon(
int16_t *im_block, const int im_stride, uint8_t *dst8, int dst8_stride,
ConvolveParams *conv_params, const int16_t *y_filter, int h, int w) {
uint8_t *dst_u8_ptr, *d_u8;
@ -587,7 +583,7 @@ static INLINE void jnt_convolve_2d_vert_neon(
const uint16_t fwd_offset = conv_params->fwd_offset;
const uint16_t bck_offset = conv_params->bck_offset;
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
int16x4_t s0, s1, s2, s3, s4, s5, s6, s7;
uint16x4_t res4, d0;
@ -652,8 +648,8 @@ static INLINE void jnt_convolve_2d_vert_neon(
d += (dst_stride << 2);
compute_avg_4x4(res4, res5, res6, res7, d0, d1, d2, d3, fwd_offset,
bck_offset, sub_const_vec, round_bits, use_jnt_comp_avg,
&t0, &t1);
bck_offset, sub_const_vec, round_bits,
use_dist_wtd_comp_avg, &t0, &t1);
vst1_lane_u32((uint32_t *)d_u8, vreinterpret_u32_u8(t0), 0);
d_u8 += dst8_stride;
@ -691,7 +687,7 @@ static INLINE void jnt_convolve_2d_vert_neon(
d += (dst_stride);
compute_avg_4x1(res4, d0, fwd_offset, bck_offset, sub_const_vec,
round_bits, use_jnt_comp_avg, &t0);
round_bits, use_dist_wtd_comp_avg, &t0);
vst1_lane_u32((uint32_t *)d_u8, vreinterpret_u32_u8(t0), 0);
d_u8 += dst8_stride;
@ -717,12 +713,12 @@ static INLINE void jnt_convolve_2d_vert_neon(
} while (w > 0);
}
void av1_jnt_convolve_2d_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_2d_neon(const uint8_t *src, int src_stride,
uint8_t *dst8, int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
assert(!(w % 4));
assert(!(h % 4));
@ -748,19 +744,18 @@ void av1_jnt_convolve_2d_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
filter_x_coef = vshrq_n_s16(filter_x_coef, 1);
vst1q_s16(&x_filter_tmp[0], filter_x_coef);
jnt_convolve_2d_horiz_neon(src_ptr, src_stride, im_block, im_stride,
x_filter_tmp, im_h, w, round_0);
dist_wtd_convolve_2d_horiz_neon(src_ptr, src_stride, im_block, im_stride,
x_filter_tmp, im_h, w, round_0);
jnt_convolve_2d_vert_neon(im_block, im_stride, dst8, dst8_stride, conv_params,
y_filter, h, w);
dist_wtd_convolve_2d_vert_neon(im_block, im_stride, dst8, dst8_stride,
conv_params, y_filter, h, w);
}
void av1_jnt_convolve_2d_copy_neon(const uint8_t *src, int src_stride,
uint8_t *dst8, int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_2d_copy_neon(
const uint8_t *src, int src_stride, uint8_t *dst8, int dst8_stride, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
const int subpel_y_q4, ConvolveParams *conv_params) {
uint8x8_t res0_8, res1_8, res2_8, res3_8, tmp_shift0, tmp_shift1, tmp_shift2,
tmp_shift3;
uint16x8_t res_q0, res_q1, res_q2, res_q3, tmp_q0, tmp_q1, tmp_q2, tmp_q3;
@ -811,7 +806,7 @@ void av1_jnt_convolve_2d_copy_neon(const uint8_t *src, int src_stride,
compute_avg_8x4(tmp_q0, tmp_q1, tmp_q2, tmp_q3, res_q0, res_q1,
res_q2, res_q3, conv_params->fwd_offset,
conv_params->bck_offset, sub_const_vec, bits,
conv_params->use_jnt_comp_avg, &tmp_shift0,
conv_params->use_dist_wtd_comp_avg, &tmp_shift0,
&tmp_shift1, &tmp_shift2, &tmp_shift3);
vst1_u8(dst8_1 + (0 * dst8_stride), tmp_shift0);
@ -854,7 +849,7 @@ void av1_jnt_convolve_2d_copy_neon(const uint8_t *src, int src_stride,
compute_avg_4x4(tmp4, tmp5, tmp6, tmp7, res4, res5, res6, res7,
conv_params->fwd_offset, conv_params->bck_offset,
sub_const_vec, bits, conv_params->use_jnt_comp_avg,
sub_const_vec, bits, conv_params->use_dist_wtd_comp_avg,
&tmp_shift0, &tmp_shift1);
vst1_lane_u32((uint32_t *)(dst8_1), vreinterpret_u32_u8(tmp_shift0), 0);
@ -881,12 +876,12 @@ void av1_jnt_convolve_2d_copy_neon(const uint8_t *src, int src_stride,
}
}
void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_x_neon(const uint8_t *src, int src_stride,
uint8_t *dst8, int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
assert(!(w % 4));
assert(!(h % 4));
@ -902,7 +897,7 @@ void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1;
const uint16_t fwd_offset = conv_params->fwd_offset;
const uint16_t bck_offset = conv_params->bck_offset;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
(void)filter_params_y;
(void)subpel_y_q4;
@ -1031,8 +1026,8 @@ void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
compute_avg_4x4(res4, res5, res6, res7, vreinterpret_u16_s16(d0),
vreinterpret_u16_s16(d1), vreinterpret_u16_s16(d2),
vreinterpret_u16_s16(d3), fwd_offset, bck_offset,
round_offset_vec, round_bits, use_jnt_comp_avg, &t0,
&t1);
round_offset_vec, round_bits, use_dist_wtd_comp_avg,
&t0, &t1);
vst1_lane_u32((uint32_t *)d_u8, vreinterpret_u32_u8(t0),
0); // 00 01 02 03
@ -1103,7 +1098,7 @@ void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
compute_avg_4x1(res4, vreinterpret_u16_s16(d0), fwd_offset,
bck_offset, round_offset_vec, round_bits,
use_jnt_comp_avg, &t0);
use_dist_wtd_comp_avg, &t0);
vst1_lane_u32((uint32_t *)d_u8, vreinterpret_u32_u8(t0),
0); // 00 01 02 03
@ -1231,11 +1226,12 @@ void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
load_u16_8x4(d_tmp, dst_stride, &res8, &res9, &res10, &res11);
d_tmp += (dst_stride << 2);
compute_avg_8x4(
res8, res9, res10, res11, vreinterpretq_u16_s16(res0),
vreinterpretq_u16_s16(res1), vreinterpretq_u16_s16(res2),
vreinterpretq_u16_s16(res3), fwd_offset, bck_offset,
round_offset64, round_bits, use_jnt_comp_avg, &t0, &t1, &t2, &t3);
compute_avg_8x4(res8, res9, res10, res11, vreinterpretq_u16_s16(res0),
vreinterpretq_u16_s16(res1),
vreinterpretq_u16_s16(res2),
vreinterpretq_u16_s16(res3), fwd_offset, bck_offset,
round_offset64, round_bits, use_dist_wtd_comp_avg,
&t0, &t1, &t2, &t3);
store_u8_8x4(d_u8, dst8_stride, t0, t1, t2, t3);
d_u8 += (dst8_stride << 2);
@ -1243,11 +1239,12 @@ void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
load_u16_8x4(d_tmp, dst_stride, &res8, &res9, &res10, &res11);
d_tmp += (dst_stride << 2);
compute_avg_8x4(
res8, res9, res10, res11, vreinterpretq_u16_s16(res4),
vreinterpretq_u16_s16(res5), vreinterpretq_u16_s16(res6),
vreinterpretq_u16_s16(res7), fwd_offset, bck_offset,
round_offset64, round_bits, use_jnt_comp_avg, &t0, &t1, &t2, &t3);
compute_avg_8x4(res8, res9, res10, res11, vreinterpretq_u16_s16(res4),
vreinterpretq_u16_s16(res5),
vreinterpretq_u16_s16(res6),
vreinterpretq_u16_s16(res7), fwd_offset, bck_offset,
round_offset64, round_bits, use_dist_wtd_comp_avg,
&t0, &t1, &t2, &t3);
store_u8_8x4(d_u8, dst8_stride, t0, t1, t2, t3);
d_u8 += (dst8_stride << 2);
@ -1319,7 +1316,7 @@ void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
compute_avg_8x1(res8, vreinterpretq_u16_s16(res0), fwd_offset,
bck_offset, round_offset64, round_bits,
use_jnt_comp_avg, &t0);
use_dist_wtd_comp_avg, &t0);
vst1_u8(d_u8, t0);
d_u8 += (dst8_stride);
@ -1342,12 +1339,12 @@ void av1_jnt_convolve_x_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
}
}
void av1_jnt_convolve_y_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_y_neon(const uint8_t *src, int src_stride,
uint8_t *dst8, int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
assert(!(w % 4));
assert(!(h % 4));
@ -1363,7 +1360,7 @@ void av1_jnt_convolve_y_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1;
const uint16_t fwd_offset = conv_params->fwd_offset;
const uint16_t bck_offset = conv_params->bck_offset;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int shift_value = (conv_params->round_1 - 1 - bits);
(void)filter_params_x;
@ -1489,8 +1486,8 @@ void av1_jnt_convolve_y_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
compute_avg_4x4(res4, res5, res6, res7, vreinterpret_u16_s16(d0),
vreinterpret_u16_s16(d1), vreinterpret_u16_s16(d2),
vreinterpret_u16_s16(d3), fwd_offset, bck_offset,
round_offset64, round_bits, use_jnt_comp_avg, &t0,
&t1);
round_offset64, round_bits, use_dist_wtd_comp_avg,
&t0, &t1);
vst1_lane_u32((uint32_t *)d_u8, vreinterpret_u32_u8(t0), 0);
d_u8 += dst8_stride;
@ -1535,7 +1532,7 @@ void av1_jnt_convolve_y_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
compute_avg_4x1(res4, vreinterpret_u16_s16(d0), fwd_offset,
bck_offset, round_offset64, round_bits,
use_jnt_comp_avg, &t0);
use_dist_wtd_comp_avg, &t0);
vst1_lane_u32((uint32_t *)d_u8, vreinterpret_u32_u8(t0), 0);
d_u8 += dst8_stride;
@ -1654,11 +1651,12 @@ void av1_jnt_convolve_y_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
load_u16_8x4(d_tmp, dst_stride, &res8, &res9, &res10, &res11);
d_tmp += (dst_stride << 2);
compute_avg_8x4(
res8, res9, res10, res11, vreinterpretq_u16_s16(res0),
vreinterpretq_u16_s16(res1), vreinterpretq_u16_s16(res2),
vreinterpretq_u16_s16(res3), fwd_offset, bck_offset,
round_offset64, round_bits, use_jnt_comp_avg, &t0, &t1, &t2, &t3);
compute_avg_8x4(res8, res9, res10, res11, vreinterpretq_u16_s16(res0),
vreinterpretq_u16_s16(res1),
vreinterpretq_u16_s16(res2),
vreinterpretq_u16_s16(res3), fwd_offset, bck_offset,
round_offset64, round_bits, use_dist_wtd_comp_avg,
&t0, &t1, &t2, &t3);
store_u8_8x4(d_u8, dst8_stride, t0, t1, t2, t3);
d_u8 += (dst8_stride << 2);
@ -1666,11 +1664,12 @@ void av1_jnt_convolve_y_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
load_u16_8x4(d_tmp, dst_stride, &res8, &res9, &res10, &res11);
d_tmp += (dst_stride << 2);
compute_avg_8x4(
res8, res9, res10, res11, vreinterpretq_u16_s16(res4),
vreinterpretq_u16_s16(res5), vreinterpretq_u16_s16(res6),
vreinterpretq_u16_s16(res7), fwd_offset, bck_offset,
round_offset64, round_bits, use_jnt_comp_avg, &t0, &t1, &t2, &t3);
compute_avg_8x4(res8, res9, res10, res11, vreinterpretq_u16_s16(res4),
vreinterpretq_u16_s16(res5),
vreinterpretq_u16_s16(res6),
vreinterpretq_u16_s16(res7), fwd_offset, bck_offset,
round_offset64, round_bits, use_dist_wtd_comp_avg,
&t0, &t1, &t2, &t3);
store_u8_8x4(d_u8, dst8_stride, t0, t1, t2, t3);
d_u8 += (dst8_stride << 2);
@ -1718,7 +1717,7 @@ void av1_jnt_convolve_y_neon(const uint8_t *src, int src_stride, uint8_t *dst8,
compute_avg_8x1(res8, vreinterpretq_u16_s16(res0), fwd_offset,
bck_offset, round_offset64, round_bits,
use_jnt_comp_avg, &t0);
use_dist_wtd_comp_avg, &t0);
vst1_u8(d_u8, t0);
d_u8 += (dst8_stride);

View file

@ -383,6 +383,15 @@ static INLINE void load_unaligned_u8_4x2(const uint8_t *buf, int stride,
*tu0 = vset_lane_u32(a, *tu0, 1);
}
/* These intrinsics require immediate values, so we must use #defines
to enforce that. */
#define store_unaligned_u8_4x1(dst, src, lane) \
do { \
uint32_t a; \
a = vget_lane_u32(vreinterpret_u32_u8(src), lane); \
memcpy(dst, &a, 4); \
} while (0)
static INLINE void load_unaligned_u8_2x2(const uint8_t *buf, int stride,
uint16x4_t *tu0) {
uint16_t a;

View file

@ -640,7 +640,7 @@ void av1_warp_affine_neon(const int32_t *mat, const uint8_t *ref, int width,
uint16x4_t tmp16_lo = vld1_u16(p);
int32x4_t tmp32_lo = vreinterpretq_s32_u32(vmovl_u16(tmp16_lo));
int16x4_t tmp16_low;
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
res_lo = vmulq_s32(res_lo, bwd);
tmp32_lo = vmulq_s32(tmp32_lo, fwd);
tmp32_lo = vaddq_s32(tmp32_lo, res_lo);
@ -671,7 +671,7 @@ void av1_warp_affine_neon(const int32_t *mat, const uint8_t *ref, int width,
uint16x4_t tmp16_hi = vld1_u16(p4);
int32x4_t tmp32_hi = vreinterpretq_s32_u32(vmovl_u16(tmp16_hi));
int16x4_t tmp16_high;
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
res_hi = vmulq_s32(res_hi, bwd);
tmp32_hi = vmulq_s32(tmp32_hi, fwd);
tmp32_hi = vaddq_s32(tmp32_hi, res_hi);

View file

@ -183,7 +183,6 @@ void av1_get_inv_txfm_cfg(TX_TYPE tx_type, TX_SIZE tx_size,
TXFM_2D_FLIP_CFG *cfg) {
assert(cfg != NULL);
cfg->tx_size = tx_size;
set_flip_cfg(tx_type, cfg);
av1_zero(cfg->stage_range_col);
av1_zero(cfg->stage_range_row);
set_flip_cfg(tx_type, cfg);

View file

@ -32,7 +32,7 @@ static const int delta_lf_id_lut[MAX_MB_PLANE][2] = {
{ 0, 1 }, { 2, 2 }, { 3, 3 }
};
typedef enum EDGE_DIR { VERT_EDGE = 0, HORZ_EDGE = 1, NUM_EDGE_DIRS } EDGE_DIR;
enum { VERT_EDGE = 0, HORZ_EDGE = 1, NUM_EDGE_DIRS } UENUM1BYTE(EDGE_DIR);
static const int mode_lf_lut[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // INTRA_MODES
@ -40,7 +40,6 @@ static const int mode_lf_lut[] = {
1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (GLOBAL_GLOBALMV == 0)
};
#if LOOP_FILTER_BITMASK
// 256 bit masks (64x64 / 4x4) for left transform size for Y plane.
// We use 4 uint64_t to represent the 256 bit.
// Each 1 represents a position where we should apply a loop filter
@ -113,6 +112,10 @@ const int mask_id_table_tx_32x32[BLOCK_SIZES_ALL] = { -1, -1, -1, -1, -1, -1,
-1, -1, -1, 0, 1, 2,
3, -1, -1, -1, -1, -1,
-1, -1, -1, -1 };
const int mask_id_table_vert_border[BLOCK_SIZES_ALL] = { 0, 47, 49, 19, 51, 53,
33, 55, 57, 42, 59, 60,
46, -1, -1, -1, 61, 62,
63, 64, 65, 66 };
const FilterMask left_mask_univariant_reordered[67] = {
// TX_4X4
@ -402,6 +405,7 @@ const FilterMask above_mask_univariant_reordered[67] = {
0x0000000000000000ULL } }, // block size 64X16, TX_64X16
};
#if LOOP_FILTER_BITMASK
LoopFilterMask *get_loop_filter_mask(const AV1_COMMON *const cm, int mi_row,
int mi_col) {
assert(cm->lf.lfm != NULL);
@ -452,9 +456,9 @@ uint8_t get_filter_level(const AV1_COMMON *cm, const loop_filter_info_n *lfi_n,
const int dir_idx, int plane,
const MB_MODE_INFO *mbmi) {
const int segment_id = mbmi->segment_id;
if (cm->delta_lf_present_flag) {
if (cm->delta_q_info.delta_lf_present_flag) {
int delta_lf;
if (cm->delta_lf_multi) {
if (cm->delta_q_info.delta_lf_multi) {
const int delta_lf_idx = delta_lf_id_lut[plane][dir_idx];
delta_lf = mbmi->delta_lf[delta_lf_idx];
} else {
@ -531,6 +535,9 @@ void av1_loop_filter_frame_init(AV1_COMMON *cm, int plane_start,
filt_lvl_r[1] = cm->lf.filter_level_u;
filt_lvl_r[2] = cm->lf.filter_level_v;
assert(plane_start >= AOM_PLANE_Y);
assert(plane_end <= MAX_MB_PLANE);
for (plane = plane_start; plane < plane_end; plane++) {
if (plane == 0 && !filt_lvl[0] && !filt_lvl_r[0])
break;
@ -542,7 +549,6 @@ void av1_loop_filter_frame_init(AV1_COMMON *cm, int plane_start,
for (seg_id = 0; seg_id < MAX_SEGMENTS; seg_id++) {
for (int dir = 0; dir < 2; ++dir) {
int lvl_seg = (dir == 0) ? filt_lvl[plane] : filt_lvl_r[plane];
assert(plane >= 0 && plane <= 2);
const int seg_lf_feature_id = seg_lvl_lf_lut[plane][dir];
if (segfeature_active(seg, seg_id, seg_lf_feature_id)) {
const int data = get_segdata(&cm->seg, seg_id, seg_lf_feature_id);
@ -763,9 +769,11 @@ static void setup_masks(AV1_COMMON *const cm, int mi_row, int mi_col, int plane,
else
lfm->lfl_y_hor[row][col] = level;
} else if (plane == 1) {
lfm->lfl_u[row][col] = level;
lfm->lfl_u_ver[row][col] = level;
lfm->lfl_u_hor[row][col] = level;
} else {
lfm->lfl_v[row][col] = level;
lfm->lfl_v_ver[row][col] = level;
lfm->lfl_v_hor[row][col] = level;
}
}
}
@ -1053,11 +1061,13 @@ void av1_setup_bitmask(AV1_COMMON *const cm, int mi_row, int mi_col, int plane,
} else if (plane == 1) {
av1_zero(lfm->left_u);
av1_zero(lfm->above_u);
av1_zero(lfm->lfl_u);
av1_zero(lfm->lfl_u_ver);
av1_zero(lfm->lfl_u_hor);
} else {
av1_zero(lfm->left_v);
av1_zero(lfm->above_v);
av1_zero(lfm->lfl_v);
av1_zero(lfm->lfl_v_ver);
av1_zero(lfm->lfl_v_hor);
}
}
}
@ -1311,11 +1321,16 @@ static void filter_selectively_horiz(uint8_t *s, int pitch, int plane,
int count;
const int step = 1 << subsampling;
const unsigned int two_block_mask = subsampling ? 5 : 3;
int offset = 0;
for (mask = mask_16x16 | mask_8x8 | mask_4x4; mask; mask >>= step * count) {
const loop_filter_thresh *lfi = lfi_n->lfthr + *lfl;
// Next block's thresholds.
const loop_filter_thresh *lfin = lfi_n->lfthr + *(lfl + step);
// Next block's thresholds, when it is within current 64x64 block.
// If it is out of bound, its mask is zero, and it points to current edge's
// filter parameters, instead of next edge's.
int next_edge = step;
if (offset + next_edge >= MI_SIZE_64X64) next_edge = 0;
const loop_filter_thresh *lfin = lfi_n->lfthr + *(lfl + next_edge);
count = 1;
if (mask & 1) {
@ -1376,6 +1391,7 @@ static void filter_selectively_horiz(uint8_t *s, int pitch, int plane,
mask_16x16 >>= step * count;
mask_8x8 >>= step * count;
mask_4x4 >>= step * count;
offset += step * count;
}
}
@ -1387,11 +1403,16 @@ static void highbd_filter_selectively_horiz(
int count;
const int step = 1 << subsampling;
const unsigned int two_block_mask = subsampling ? 5 : 3;
int offset = 0;
for (mask = mask_16x16 | mask_8x8 | mask_4x4; mask; mask >>= step * count) {
const loop_filter_thresh *lfi = lfi_n->lfthr + *lfl;
// Next block's thresholds.
const loop_filter_thresh *lfin = lfi_n->lfthr + *(lfl + step);
// Next block's thresholds, when it is within current 64x64 block.
// If it is out of bound, its mask is zero, and it points to current edge's
// filter parameters, instead of next edge's.
int next_edge = step;
if (offset + next_edge >= MI_SIZE_64X64) next_edge = 0;
const loop_filter_thresh *lfin = lfi_n->lfthr + *(lfl + next_edge);
count = 1;
if (mask & 1) {
@ -1401,9 +1422,9 @@ static void highbd_filter_selectively_horiz(
if ((mask_16x16 & two_block_mask) == two_block_mask) {
if (plane) {
aom_highbd_lpf_horizontal_6_dual(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, lfin->mblim,
lfin->lim, lfin->hev_thr, bd);
aom_highbd_lpf_horizontal_6_dual_c(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, lfin->mblim,
lfin->lim, lfin->hev_thr, bd);
} else {
aom_highbd_lpf_horizontal_14_dual(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, lfin->mblim,
@ -1420,13 +1441,13 @@ static void highbd_filter_selectively_horiz(
if ((mask_8x8 & two_block_mask) == two_block_mask) {
if (plane) {
aom_highbd_lpf_horizontal_6_dual(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, lfin->mblim,
lfin->lim, lfin->hev_thr, bd);
aom_highbd_lpf_horizontal_6_dual_c(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, lfin->mblim,
lfin->lim, lfin->hev_thr, bd);
} else {
aom_highbd_lpf_horizontal_8_dual(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, lfin->mblim,
lfin->lim, lfin->hev_thr, bd);
aom_highbd_lpf_horizontal_8_dual_c(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, lfin->mblim,
lfin->lim, lfin->hev_thr, bd);
}
count = 2;
} else {
@ -1435,9 +1456,9 @@ static void highbd_filter_selectively_horiz(
}
} else if (mask_4x4 & 1) {
if ((mask_4x4 & two_block_mask) == two_block_mask) {
aom_highbd_lpf_horizontal_4_dual(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, lfin->mblim, lfin->lim,
lfin->hev_thr, bd);
aom_highbd_lpf_horizontal_4_dual_c(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, lfin->mblim,
lfin->lim, lfin->hev_thr, bd);
count = 2;
} else {
aom_highbd_lpf_horizontal_4(s, pitch, lfi->mblim, lfi->lim,
@ -1451,6 +1472,7 @@ static void highbd_filter_selectively_horiz(
mask_16x16 >>= step * count;
mask_8x8 >>= step * count;
mask_4x4 >>= step * count;
offset += step * count;
}
}
@ -1463,12 +1485,13 @@ void av1_build_bitmask_vert_info(
const int is_uv = plane > 0;
TX_SIZE tx_size = TX_16X16, prev_tx_size = TX_16X16;
uint8_t level, prev_level = 1;
int skip, prev_skip = 0;
int is_coding_block_border;
uint64_t skip, prev_skip = 0;
uint64_t is_coding_block_border;
for (int r = 0; (r << MI_SIZE_LOG2) < plane_ptr->dst.height; r += row_step) {
const int mi_row = r << subsampling_y;
const int row = mi_row % MI_SIZE_64X64;
const int row_uv = row | subsampling_y;
int index = 0;
const int shift = get_index_shift(0, row, &index);
@ -1482,13 +1505,14 @@ void av1_build_bitmask_vert_info(
const int x = (c + col_in_unit) << MI_SIZE_LOG2;
if (x >= plane_ptr->dst.width) break;
const int col = col_in_unit << subsampling_x;
const int col_uv = col | subsampling_x;
const uint64_t mask = ((uint64_t)1 << (shift | col));
skip = lfm->skip.bits[index] & mask;
is_coding_block_border = lfm->is_vert_border.bits[index] & mask;
switch (plane) {
case 0: level = lfm->lfl_y_ver[row][col]; break;
case 1: level = lfm->lfl_u[row][col]; break;
case 2: level = lfm->lfl_v[row][col]; break;
case 0: level = lfm->lfl_y_ver[row_uv][col_uv]; break;
case 1: level = lfm->lfl_u_ver[row_uv][col_uv]; break;
case 2: level = lfm->lfl_v_ver[row_uv][col_uv]; break;
default: assert(plane >= 0 && plane <= 2); return;
}
for (TX_SIZE ts = TX_4X4; ts <= TX_64X64; ++ts) {
@ -1502,9 +1526,7 @@ void av1_build_bitmask_vert_info(
(!prev_skip || !skip || is_coding_block_border)) {
const TX_SIZE min_tx_size =
AOMMIN(TX_16X16, AOMMIN(tx_size, prev_tx_size));
const int tmp_row = (mi_row | subsampling_y) % MI_SIZE_64X64;
const int tmp_col = (col | subsampling_x) % MI_SIZE_64X64;
const int shift_1 = get_index_shift(tmp_col, tmp_row, &index);
const int shift_1 = get_index_shift(col_uv, row_uv, &index);
const uint64_t mask_1 = ((uint64_t)1 << shift_1);
switch (plane) {
case 0: lfm->left_y[min_tx_size].bits[index] |= mask_1; break;
@ -1512,6 +1534,14 @@ void av1_build_bitmask_vert_info(
case 2: lfm->left_v[min_tx_size].bits[index] |= mask_1; break;
default: assert(plane >= 0 && plane <= 2); return;
}
if (level == 0 && prev_level != 0) {
switch (plane) {
case 0: lfm->lfl_y_ver[row_uv][col_uv] = prev_level; break;
case 1: lfm->lfl_u_ver[row_uv][col_uv] = prev_level; break;
case 2: lfm->lfl_v_ver[row_uv][col_uv] = prev_level; break;
default: assert(plane >= 0 && plane <= 2); return;
}
}
}
// update prev info
@ -1534,12 +1564,13 @@ void av1_build_bitmask_horz_info(
const int is_uv = plane > 0;
TX_SIZE tx_size = TX_16X16, prev_tx_size = TX_16X16;
uint8_t level, prev_level = 1;
int skip, prev_skip = 0;
int is_coding_block_border;
uint64_t skip, prev_skip = 0;
uint64_t is_coding_block_border;
for (int c = 0; (c << MI_SIZE_LOG2) < plane_ptr->dst.width; c += col_step) {
const int mi_col = c << subsampling_x;
const int col = mi_col % MI_SIZE_64X64;
const int col_uv = col | subsampling_x;
for (int r = 0; (r << MI_SIZE_LOG2) < plane_ptr->dst.height;
r += (tx_size_high_unit[TX_64X64] >> subsampling_y)) {
@ -1551,15 +1582,16 @@ void av1_build_bitmask_horz_info(
const int y = (r + r_in_unit) << MI_SIZE_LOG2;
if (y >= plane_ptr->dst.height) break;
const int row = r_in_unit << subsampling_y;
const int row_uv = row | subsampling_y;
int index = 0;
const int shift = get_index_shift(col, row, &index);
const uint64_t mask = ((uint64_t)1 << shift);
skip = lfm->skip.bits[index] & mask;
is_coding_block_border = lfm->is_horz_border.bits[index] & mask;
switch (plane) {
case 0: level = lfm->lfl_y_hor[row][col]; break;
case 1: level = lfm->lfl_u[row][col]; break;
case 2: level = lfm->lfl_v[row][col]; break;
case 0: level = lfm->lfl_y_hor[row_uv][col_uv]; break;
case 1: level = lfm->lfl_u_hor[row_uv][col_uv]; break;
case 2: level = lfm->lfl_v_hor[row_uv][col_uv]; break;
default: assert(plane >= 0 && plane <= 2); return;
}
for (TX_SIZE ts = TX_4X4; ts <= TX_64X64; ++ts) {
@ -1573,9 +1605,7 @@ void av1_build_bitmask_horz_info(
(!prev_skip || !skip || is_coding_block_border)) {
const TX_SIZE min_tx_size =
AOMMIN(TX_16X16, AOMMIN(tx_size, prev_tx_size));
const int tmp_row = (row | subsampling_y) % MI_SIZE_64X64;
const int tmp_col = (mi_col | subsampling_x) % MI_SIZE_64X64;
const int shift_1 = get_index_shift(tmp_col, tmp_row, &index);
const int shift_1 = get_index_shift(col_uv, row_uv, &index);
const uint64_t mask_1 = ((uint64_t)1 << shift_1);
switch (plane) {
@ -1584,6 +1614,14 @@ void av1_build_bitmask_horz_info(
case 2: lfm->above_v[min_tx_size].bits[index] |= mask_1; break;
default: assert(plane >= 0 && plane <= 2); return;
}
if (level == 0 && prev_level != 0) {
switch (plane) {
case 0: lfm->lfl_y_hor[row_uv][col_uv] = prev_level; break;
case 1: lfm->lfl_u_hor[row_uv][col_uv] = prev_level; break;
case 2: lfm->lfl_v_hor[row_uv][col_uv] = prev_level; break;
default: assert(plane >= 0 && plane <= 2); return;
}
}
}
// update prev info
@ -1628,6 +1666,7 @@ void av1_filter_block_plane_bitmask_vert(
const int shift = get_index_shift(col, row, &index);
int index_next = 0;
const int shift_next = get_index_shift(col, row_next, &index_next);
const int has_next_row = row_next < cm->mi_rows;
switch (pl) {
case 0:
mask_16x16 = lfm->left_y[TX_16X16].bits[index];
@ -1640,15 +1679,15 @@ void av1_filter_block_plane_bitmask_vert(
mask_16x16 = lfm->left_u[TX_16X16].bits[index];
mask_8x8 = lfm->left_u[TX_8X8].bits[index];
mask_4x4 = lfm->left_u[TX_4X4].bits[index];
lfl = &lfm->lfl_u[row][col];
lfl2 = &lfm->lfl_u[row_next][col];
lfl = &lfm->lfl_u_ver[row][col];
lfl2 = &lfm->lfl_u_ver[row_next][col];
break;
case 2:
mask_16x16 = lfm->left_v[TX_16X16].bits[index];
mask_8x8 = lfm->left_v[TX_8X8].bits[index];
mask_4x4 = lfm->left_v[TX_4X4].bits[index];
lfl = &lfm->lfl_v[row][col];
lfl2 = &lfm->lfl_v[row_next][col];
lfl = &lfm->lfl_v_ver[row][col];
lfl2 = &lfm->lfl_v_ver[row_next][col];
break;
default: assert(pl >= 0 && pl <= 2); return;
}
@ -1658,6 +1697,11 @@ void av1_filter_block_plane_bitmask_vert(
uint64_t mask_16x16_1 = (mask_16x16 >> shift_next) & mask_cutoff;
uint64_t mask_8x8_1 = (mask_8x8 >> shift_next) & mask_cutoff;
uint64_t mask_4x4_1 = (mask_4x4 >> shift_next) & mask_cutoff;
if (!has_next_row) {
mask_16x16_1 = 0;
mask_8x8_1 = 0;
mask_4x4_1 = 0;
}
if (cm->seq_params.use_highbitdepth)
highbd_filter_selectively_vert_row2(
@ -1712,13 +1756,13 @@ void av1_filter_block_plane_bitmask_horz(
mask_16x16 = lfm->above_u[TX_16X16].bits[index];
mask_8x8 = lfm->above_u[TX_8X8].bits[index];
mask_4x4 = lfm->above_u[TX_4X4].bits[index];
lfl = &lfm->lfl_u[row][col];
lfl = &lfm->lfl_u_hor[row][col];
break;
case 2:
mask_16x16 = lfm->above_v[TX_16X16].bits[index];
mask_8x8 = lfm->above_v[TX_8X8].bits[index];
mask_4x4 = lfm->above_v[TX_4X4].bits[index];
lfl = &lfm->lfl_v[row][col];
lfl = &lfm->lfl_v_hor[row][col];
break;
default: assert(pl >= 0 && pl <= 2); return;
}
@ -1786,15 +1830,15 @@ void av1_filter_block_plane_ver(AV1_COMMON *const cm,
mask_16x16 = lfm->left_u[TX_16X16].bits[index];
mask_8x8 = lfm->left_u[TX_8X8].bits[index];
mask_4x4 = lfm->left_u[TX_4X4].bits[index];
lfl = &lfm->lfl_u[row][col];
lfl2 = &lfm->lfl_u[row_next][col];
lfl = &lfm->lfl_u_ver[row][col];
lfl2 = &lfm->lfl_u_ver[row_next][col];
break;
case 2:
mask_16x16 = lfm->left_v[TX_16X16].bits[index];
mask_8x8 = lfm->left_v[TX_8X8].bits[index];
mask_4x4 = lfm->left_v[TX_4X4].bits[index];
lfl = &lfm->lfl_v[row][col];
lfl2 = &lfm->lfl_v[row_next][col];
lfl = &lfm->lfl_v_ver[row][col];
lfl2 = &lfm->lfl_v_ver[row_next][col];
break;
default: assert(pl >= 0 && pl <= 2); return;
}
@ -1861,13 +1905,13 @@ void av1_filter_block_plane_hor(AV1_COMMON *const cm,
mask_16x16 = lfm->above_u[TX_16X16].bits[index];
mask_8x8 = lfm->above_u[TX_8X8].bits[index];
mask_4x4 = lfm->above_u[TX_4X4].bits[index];
lfl = &lfm->lfl_u[row][col];
lfl = &lfm->lfl_u_hor[row][col];
break;
case 2:
mask_16x16 = lfm->above_v[TX_16X16].bits[index];
mask_8x8 = lfm->above_v[TX_8X8].bits[index];
mask_4x4 = lfm->above_v[TX_4X4].bits[index];
lfl = &lfm->lfl_v[row][col];
lfl = &lfm->lfl_v_hor[row][col];
break;
default: assert(pl >= 0 && pl <= 2); return;
}
@ -2219,6 +2263,92 @@ void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
}
}
void av1_filter_block_plane_vert_test(const AV1_COMMON *const cm,
const MACROBLOCKD *const xd,
const int plane,
const MACROBLOCKD_PLANE *const plane_ptr,
const uint32_t mi_row,
const uint32_t mi_col) {
const int row_step = MI_SIZE >> MI_SIZE_LOG2;
const uint32_t scale_horz = plane_ptr->subsampling_x;
const uint32_t scale_vert = plane_ptr->subsampling_y;
uint8_t *const dst_ptr = plane_ptr->dst.buf;
const int dst_stride = plane_ptr->dst.stride;
const int y_range = cm->mi_rows >> scale_vert;
const int x_range = cm->mi_cols >> scale_horz;
for (int y = 0; y < y_range; y += row_step) {
uint8_t *p = dst_ptr + y * MI_SIZE * dst_stride;
for (int x = 0; x < x_range;) {
// inner loop always filter vertical edges in a MI block. If MI size
// is 8x8, it will filter the vertical edge aligned with a 8x8 block.
// If 4x4 trasnform is used, it will then filter the internal edge
// aligned with a 4x4 block
const uint32_t curr_x = ((mi_col * MI_SIZE) >> scale_horz) + x * MI_SIZE;
const uint32_t curr_y = ((mi_row * MI_SIZE) >> scale_vert) + y * MI_SIZE;
uint32_t advance_units;
TX_SIZE tx_size;
AV1_DEBLOCKING_PARAMETERS params;
memset(&params, 0, sizeof(params));
tx_size =
set_lpf_parameters(&params, ((ptrdiff_t)1 << scale_horz), cm, xd,
VERT_EDGE, curr_x, curr_y, plane, plane_ptr);
if (tx_size == TX_INVALID) {
params.filter_length = 0;
tx_size = TX_4X4;
}
// advance the destination pointer
advance_units = tx_size_wide_unit[tx_size];
x += advance_units;
p += advance_units * MI_SIZE;
}
}
}
void av1_filter_block_plane_horz_test(const AV1_COMMON *const cm,
const MACROBLOCKD *const xd,
const int plane,
const MACROBLOCKD_PLANE *const plane_ptr,
const uint32_t mi_row,
const uint32_t mi_col) {
const int col_step = MI_SIZE >> MI_SIZE_LOG2;
const uint32_t scale_horz = plane_ptr->subsampling_x;
const uint32_t scale_vert = plane_ptr->subsampling_y;
uint8_t *const dst_ptr = plane_ptr->dst.buf;
const int dst_stride = plane_ptr->dst.stride;
const int y_range = cm->mi_rows >> scale_vert;
const int x_range = cm->mi_cols >> scale_horz;
for (int x = 0; x < x_range; x += col_step) {
uint8_t *p = dst_ptr + x * MI_SIZE;
for (int y = 0; y < y_range;) {
// inner loop always filter vertical edges in a MI block. If MI size
// is 8x8, it will first filter the vertical edge aligned with a 8x8
// block. If 4x4 trasnform is used, it will then filter the internal
// edge aligned with a 4x4 block
const uint32_t curr_x = ((mi_col * MI_SIZE) >> scale_horz) + x * MI_SIZE;
const uint32_t curr_y = ((mi_row * MI_SIZE) >> scale_vert) + y * MI_SIZE;
uint32_t advance_units;
TX_SIZE tx_size;
AV1_DEBLOCKING_PARAMETERS params;
memset(&params, 0, sizeof(params));
tx_size =
set_lpf_parameters(&params, (cm->mi_stride << scale_vert), cm, xd,
HORZ_EDGE, curr_x, curr_y, plane, plane_ptr);
if (tx_size == TX_INVALID) {
params.filter_length = 0;
tx_size = TX_4X4;
}
// advance the destination pointer
advance_units = tx_size_high_unit[tx_size];
y += advance_units;
p += advance_units * dst_stride * MI_SIZE;
}
}
}
static void loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
MACROBLOCKD *xd, int start, int stop,
#if LOOP_FILTER_BITMASK
@ -2233,6 +2363,7 @@ static void loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
#if LOOP_FILTER_BITMASK
if (is_decoding) {
cm->is_decoding = is_decoding;
for (plane = plane_start; plane < plane_end; plane++) {
if (plane == 0 && !(cm->lf.filter_level[0]) && !(cm->lf.filter_level[1]))
break;
@ -2243,24 +2374,25 @@ static void loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
av1_setup_dst_planes(pd, cm->seq_params.sb_size, frame_buffer, 0, 0,
plane, plane + 1);
av1_build_bitmask_vert_info(cm, &pd[plane], plane);
av1_build_bitmask_horz_info(cm, &pd[plane], plane);
// apply loop filtering which only goes through buffer once
for (mi_row = start; mi_row < stop; mi_row += MI_SIZE_64X64) {
for (mi_col = col_start; mi_col < col_end; mi_col += MI_SIZE_64X64) {
av1_setup_dst_planes(pd, MI_SIZE_64X64, frame_buffer, mi_row, mi_col,
av1_setup_dst_planes(pd, BLOCK_64X64, frame_buffer, mi_row, mi_col,
plane, plane + 1);
av1_filter_block_plane_bitmask_vert(cm, &pd[plane], plane, mi_row,
mi_col);
if (mi_col - MI_SIZE_64X64 >= 0) {
av1_setup_dst_planes(pd, MI_SIZE_64X64, frame_buffer, mi_row,
av1_setup_dst_planes(pd, BLOCK_64X64, frame_buffer, mi_row,
mi_col - MI_SIZE_64X64, plane, plane + 1);
av1_filter_block_plane_bitmask_horz(cm, &pd[plane], plane, mi_row,
mi_col - MI_SIZE_64X64);
}
}
av1_setup_dst_planes(pd, MI_SIZE_64X64, frame_buffer, mi_row,
av1_setup_dst_planes(pd, BLOCK_64X64, frame_buffer, mi_row,
mi_col - MI_SIZE_64X64, plane, plane + 1);
av1_filter_block_plane_bitmask_horz(cm, &pd[plane], plane, mi_row,
mi_col - MI_SIZE_64X64);
@ -2278,31 +2410,6 @@ static void loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
else if (plane == 2 && !(cm->lf.filter_level_v))
continue;
#if LOOP_FILTER_BITMASK
// filter all vertical edges every superblock (could be 128x128 or 64x64)
for (mi_row = start; mi_row < stop; mi_row += cm->seq_params.mib_size) {
for (mi_col = col_start; mi_col < col_end;
mi_col += cm->seq_params.mib_size) {
av1_setup_dst_planes(pd, cm->seq_params.sb_size, frame_buffer, mi_row,
mi_col, plane, plane + 1);
av1_setup_bitmask(cm, mi_row, mi_col, plane, pd[plane].subsampling_x,
pd[plane].subsampling_y, stop, col_end);
av1_filter_block_plane_ver(cm, &pd[plane], plane, mi_row, mi_col);
}
}
// filter all horizontal edges every superblock
for (mi_row = start; mi_row < stop; mi_row += cm->seq_params.mib_size) {
for (mi_col = col_start; mi_col < col_end;
mi_col += cm->seq_params.mib_size) {
av1_setup_dst_planes(pd, cm->seq_params.sb_size, frame_buffer, mi_row,
mi_col, plane, plane + 1);
av1_filter_block_plane_hor(cm, &pd[plane], plane, mi_row, mi_col);
}
}
#else
if (cm->lf.combine_vert_horz_lf) {
// filter all vertical and horizontal edges in every 128x128 super block
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
@ -2348,7 +2455,6 @@ static void loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
}
}
}
#endif // LOOP_FILTER_BITMASK
}
}

View file

@ -33,11 +33,11 @@ enum lf_path {
LF_PATH_SLOW,
};
#if LOOP_FILTER_BITMASK
typedef struct {
uint64_t bits[4];
} FilterMask;
#if LOOP_FILTER_BITMASK
// This structure holds bit masks for all 4x4 blocks in a 64x64 region.
// Each 1 bit represents a position in which we want to apply the loop filter.
// For Y plane, 4x4 in 64x64 requires 16x16 = 256 bit, therefore we use 4
@ -61,10 +61,12 @@ typedef struct {
uint8_t lfl_y_ver[MI_SIZE_64X64][MI_SIZE_64X64];
// U plane filter level
uint8_t lfl_u[MI_SIZE_64X64][MI_SIZE_64X64];
uint8_t lfl_u_ver[MI_SIZE_64X64][MI_SIZE_64X64];
uint8_t lfl_u_hor[MI_SIZE_64X64][MI_SIZE_64X64];
// V plane filter level
uint8_t lfl_v[MI_SIZE_64X64][MI_SIZE_64X64];
uint8_t lfl_v_ver[MI_SIZE_64X64][MI_SIZE_64X64];
uint8_t lfl_v_hor[MI_SIZE_64X64][MI_SIZE_64X64];
// other info
FilterMask skip;
@ -173,39 +175,23 @@ LoopFilterMask *get_loop_filter_mask(const struct AV1Common *const cm,
int mi_row, int mi_col);
int get_index_shift(int mi_col, int mi_row, int *index);
static const FilterMask left_txform_mask[TX_SIZES] = {
{ { 0x0000000000000001ULL, // TX_4X4,
0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL } },
void av1_build_bitmask_vert_info(
struct AV1Common *const cm, const struct macroblockd_plane *const plane_ptr,
int plane);
{ { 0x0000000000010001ULL, // TX_8X8,
0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL } },
void av1_build_bitmask_horz_info(
struct AV1Common *const cm, const struct macroblockd_plane *const plane_ptr,
int plane);
{ { 0x0001000100010001ULL, // TX_16X16,
0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL } },
void av1_filter_block_plane_bitmask_vert(
struct AV1Common *const cm, struct macroblockd_plane *const plane_ptr,
int pl, int mi_row, int mi_col);
{ { 0x0001000100010001ULL, // TX_32X32,
0x0001000100010001ULL, 0x0000000000000000ULL, 0x0000000000000000ULL } },
void av1_filter_block_plane_bitmask_horz(
struct AV1Common *const cm, struct macroblockd_plane *const plane_ptr,
int pl, int mi_row, int mi_col);
{ { 0x0001000100010001ULL, // TX_64X64,
0x0001000100010001ULL, 0x0001000100010001ULL, 0x0001000100010001ULL } },
};
static const uint64_t above_txform_mask[2][TX_SIZES] = {
{
0x0000000000000001ULL, // TX_4X4
0x0000000000000003ULL, // TX_8X8
0x000000000000000fULL, // TX_16X16
0x00000000000000ffULL, // TX_32X32
0x000000000000ffffULL, // TX_64X64
},
{
0x0000000000000001ULL, // TX_4X4
0x0000000000000005ULL, // TX_8X8
0x0000000000000055ULL, // TX_16X16
0x0000000000005555ULL, // TX_32X32
0x0000000055555555ULL, // TX_64X64
},
};
#endif // LOOP_FILTER_BITMASK
extern const int mask_id_table_tx_4x4[BLOCK_SIZES_ALL];
@ -215,10 +201,13 @@ extern const int mask_id_table_tx_16x16[BLOCK_SIZES_ALL];
extern const int mask_id_table_tx_32x32[BLOCK_SIZES_ALL];
// corresponds to entry id in table left_mask_univariant_reordered,
// of block size mxn and TX_mxn.
extern const int mask_id_table_vert_border[BLOCK_SIZES_ALL];
extern const FilterMask left_mask_univariant_reordered[67];
extern const FilterMask above_mask_univariant_reordered[67];
#endif
#ifdef __cplusplus
} // extern "C"

View file

@ -33,6 +33,8 @@ struct txfm_param;
struct aom_variance_vtable;
struct search_site_config;
struct yv12_buffer_config;
struct NN_CONFIG;
typedef struct NN_CONFIG NN_CONFIG;
/* Function pointers return by CfL functions */
typedef void (*cfl_subsample_lbd_fn)(const uint8_t *input, int input_stride,
@ -79,8 +81,11 @@ specialize qw/av1_highbd_wiener_convolve_add_src avx2/;
# directional intra predictor functions
add_proto qw/void av1_dr_prediction_z1/, "uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int dx, int dy";
specialize qw/av1_dr_prediction_z1 avx2/;
add_proto qw/void av1_dr_prediction_z2/, "uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int upsample_left, int dx, int dy";
specialize qw/av1_dr_prediction_z2 avx2/;
add_proto qw/void av1_dr_prediction_z3/, "uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_left, int dx, int dy";
specialize qw/av1_dr_prediction_z3 avx2/;
# FILTER_INTRA predictor functions
add_proto qw/void av1_filter_intra_predictor/, "uint8_t *dst, ptrdiff_t stride, TX_SIZE tx_size, const uint8_t *above, const uint8_t *left, int mode";
@ -115,14 +120,14 @@ add_proto qw/void av1_highbd_inv_txfm_add_4x4/, "const tran_low_t *dqcoeff, uin
specialize qw/av1_highbd_inv_txfm_add_4x4 sse4_1/;
add_proto qw/void av1_highbd_inv_txfm_add_8x8/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
specialize qw/av1_highbd_inv_txfm_add_8x8 sse4_1/;
add_proto qw/void av1_highbd_inv_txfm_add_16x8/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
specialize qw/av1_highbd_inv_txfm_add_16x8 sse4_1/;
add_proto qw/void av1_highbd_inv_txfm_add_8x16/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
specialize qw/av1_highbd_inv_txfm_add_8x16 sse4_1/;
add_proto qw/void av1_highbd_inv_txfm_add_16x16/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
specialize qw/av1_highbd_inv_txfm_add_16x16 sse4_1/;
add_proto qw/void av1_highbd_inv_txfm_add_32x32/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
specialize qw/av1_highbd_inv_txfm_add_32x32 sse4_1 avx2/;
add_proto qw/void av1_highbd_inv_txfm_add_4x8/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
specialize qw/av1_highbd_inv_txfm_add_4x8 sse4_1/;
add_proto qw/void av1_highbd_inv_txfm_add_8x4/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
specialize qw/av1_highbd_inv_txfm_add_8x4 sse4_1/;
add_proto qw/void av1_highbd_inv_txfm_add_4x16/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
specialize qw/av1_highbd_inv_txfm_add_4x16 sse4_1/;
add_proto qw/void av1_highbd_inv_txfm_add_16x4/, "const tran_low_t *dqcoeff, uint8_t *dst, int stride, const TxfmParam *txfm_param";
specialize qw/av1_highbd_inv_txfm_add_16x4 sse4_1/;
add_proto qw/void av1_highbd_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void av1_highbd_iwht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
@ -153,8 +158,12 @@ add_proto qw/void av1_inv_txfm2d_add_32x8/, "const int32_t *input, uint16_t *out
# directional intra predictor functions
add_proto qw/void av1_highbd_dr_prediction_z1/, "uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int dx, int dy, int bd";
specialize qw/av1_highbd_dr_prediction_z1 avx2/;
add_proto qw/void av1_highbd_dr_prediction_z2/, "uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd";
# TODO(https://crbug.com/aomedia/2288)
#specialize qw/av1_highbd_dr_prediction_z2 avx2/;
add_proto qw/void av1_highbd_dr_prediction_z3/, "uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_left, int dx, int dy, int bd";
specialize qw/av1_highbd_dr_prediction_z3 avx2/;
# build compound seg mask functions
add_proto qw/void av1_build_compound_diffwtd_mask/, "uint8_t *mask, DIFFWTD_MASK_TYPE mask_type, const uint8_t *src0, int src0_stride, const uint8_t *src1, int src1_stride, int h, int w";
@ -166,6 +175,10 @@ specialize qw/av1_build_compound_diffwtd_mask_highbd ssse3 avx2/;
add_proto qw/void av1_build_compound_diffwtd_mask_d16/, "uint8_t *mask, DIFFWTD_MASK_TYPE mask_type, const CONV_BUF_TYPE *src0, int src0_stride, const CONV_BUF_TYPE *src1, int src1_stride, int h, int w, ConvolveParams *conv_params, int bd";
specialize qw/av1_build_compound_diffwtd_mask_d16 sse4_1 avx2 neon/;
# Helper functions.
add_proto qw/void av1_round_shift_array/, "int32_t *arr, int size, int bit";
specialize "av1_round_shift_array", qw/sse4_1 neon/;
#
# Encoder functions below this point.
#
@ -196,32 +209,44 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
specialize qw/av1_lowbd_fwd_txfm sse2 sse4_1 avx2/;
add_proto qw/void av1_fwd_txfm2d_4x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_4x8 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_8x4/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_8x4 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_8x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_8x16 sse4_1/;
specialize qw/av1_fwd_txfm2d_8x16 sse4_1 avx2/;
add_proto qw/void av1_fwd_txfm2d_16x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_16x8 sse4_1/;
specialize qw/av1_fwd_txfm2d_16x8 sse4_1 avx2/;
add_proto qw/void av1_fwd_txfm2d_16x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_16x32 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_32x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_32x16 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_4x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_4x16 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_16x4/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_16x4 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_8x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_8x32 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_32x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_32x8 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_4x4/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_4x4 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_8x8/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_8x8 sse4_1/;
specialize qw/av1_fwd_txfm2d_8x8 sse4_1 avx2/;
add_proto qw/void av1_fwd_txfm2d_16x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_16x16 sse4_1/;
specialize qw/av1_fwd_txfm2d_16x16 sse4_1 avx2/;
add_proto qw/void av1_fwd_txfm2d_32x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_32x32 sse4_1/;
specialize qw/av1_fwd_txfm2d_32x32 sse4_1 avx2/;
add_proto qw/void av1_fwd_txfm2d_64x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_64x64 sse4_1/;
specialize qw/av1_fwd_txfm2d_64x64 sse4_1 avx2/;
add_proto qw/void av1_fwd_txfm2d_32x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_32x64 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_64x32/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_64x32 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_16x64/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_16x64 sse4_1/;
add_proto qw/void av1_fwd_txfm2d_64x16/, "const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd";
specialize qw/av1_fwd_txfm2d_64x16 sse4_1/;
#
# Motion search
@ -230,8 +255,9 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
add_proto qw/int av1_full_range_search/, "const struct macroblock *x, const struct search_site_config *cfg, MV *ref_mv, MV *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const MV *center_mv";
add_proto qw/void av1_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
specialize qw/av1_temporal_filter_apply sse2 msa/;
# TODO(yunqing): Add back the optimizations.
# add_proto qw/void av1_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
# specialize qw/av1_temporal_filter_apply sse2 msa/;
add_proto qw/void av1_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale";
@ -240,7 +266,7 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
add_proto qw/int64_t av1_highbd_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz, int bd";
specialize qw/av1_highbd_block_error sse2/;
add_proto qw/void av1_highbd_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
# add_proto qw/void av1_highbd_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
add_proto qw/void av1_highbd_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan, int log_scale";
specialize qw/av1_highbd_quantize_fp sse4_1 avx2/;
@ -266,18 +292,30 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
add_proto qw/uint32_t av1_get_crc32c_value/, "void *crc_calculator, uint8_t *p, int length";
specialize qw/av1_get_crc32c_value sse4_2/;
add_proto qw/void av1_compute_stats/, "int wiener_win, const uint8_t *dgd8, const uint8_t *src8, int h_start, int h_end, int v_start, int v_end, int dgd_stride, int src_stride, double *M, double *H";
add_proto qw/void av1_compute_stats/, "int wiener_win, const uint8_t *dgd8, const uint8_t *src8, int h_start, int h_end, int v_start, int v_end, int dgd_stride, int src_stride, int64_t *M, int64_t *H";
specialize qw/av1_compute_stats sse4_1 avx2/;
add_proto qw/void av1_compute_stats_highbd/, "int wiener_win, const uint8_t *dgd8, const uint8_t *src8, int h_start, int h_end, int v_start, int v_end, int dgd_stride, int src_stride, int64_t *M, int64_t *H, aom_bit_depth_t bit_depth";
specialize qw/av1_compute_stats_highbd sse4_1 avx2/;
add_proto qw/int64_t av1_lowbd_pixel_proj_error/, " const uint8_t *src8, int width, int height, int src_stride, const uint8_t *dat8, int dat_stride, int32_t *flt0, int flt0_stride, int32_t *flt1, int flt1_stride, int xq[2], const sgr_params_type *params";
specialize qw/av1_lowbd_pixel_proj_error sse4_1 avx2/;
add_proto qw/int64_t av1_highbd_pixel_proj_error/, " const uint8_t *src8, int width, int height, int src_stride, const uint8_t *dat8, int dat_stride, int32_t *flt0, int flt0_stride, int32_t *flt1, int flt1_stride, int xq[2], const sgr_params_type *params";
specialize qw/av1_highbd_pixel_proj_error sse4_1 avx2/;
add_proto qw/void av1_get_horver_correlation_full/, " const int16_t *diff, int stride, int w, int h, float *hcorr, float *vcorr";
specialize qw/av1_get_horver_correlation_full sse4_1 avx2/;
add_proto qw/void av1_nn_predict/, " const float *input_nodes, const NN_CONFIG *const nn_config, float *const output";
specialize qw/av1_nn_predict sse3/;
}
# end encoder functions
# Deringing Functions
add_proto qw/int cdef_find_dir/, "const uint16_t *img, int stride, int32_t *var, int coeff_shift";
add_proto qw/void cdef_filter_block/, "uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int max, int coeff_shift";
add_proto qw/void cdef_filter_block/, "uint8_t *dst8, uint16_t *dst16, int dstride, const uint16_t *in, int pri_strength, int sec_strength, int dir, int pri_damping, int sec_damping, int bsize, int coeff_shift";
add_proto qw/void copy_rect8_8bit_to_16bit/, "uint16_t *dst, int dstride, const uint8_t *src, int sstride, int v, int h";
add_proto qw/void copy_rect8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride, int v, int h";
@ -302,7 +340,7 @@ specialize qw/av1_highbd_warp_affine sse4_1/;
if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
add_proto qw/double compute_cross_correlation/, "unsigned char *im1, int stride1, int x1, int y1, unsigned char *im2, int stride2, int x2, int y2";
specialize qw/compute_cross_correlation sse4_1/;
specialize qw/compute_cross_correlation sse4_1 avx2/;
}
# LOOP_RESTORATION functions
@ -321,18 +359,18 @@ add_proto qw/void av1_convolve_2d_sr/, "const uint8_t *src, int src_stride, uint
add_proto qw/void av1_convolve_2d_copy_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_convolve_x_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_convolve_y_sr/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_jnt_convolve_2d/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_jnt_convolve_2d_copy/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_jnt_convolve_x/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_jnt_convolve_y/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_dist_wtd_convolve_2d/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_dist_wtd_convolve_2d_copy/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_dist_wtd_convolve_x/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_dist_wtd_convolve_y/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params";
add_proto qw/void av1_highbd_convolve_2d_copy_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_convolve_2d_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_convolve_x_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_convolve_y_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_jnt_convolve_2d/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_jnt_convolve_x/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_jnt_convolve_y/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_jnt_convolve_2d_copy/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_dist_wtd_convolve_2d/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_dist_wtd_convolve_x/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_dist_wtd_convolve_y/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_highbd_dist_wtd_convolve_2d_copy/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int subpel_y_q4, ConvolveParams *conv_params, int bd";
add_proto qw/void av1_convolve_2d_scale/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params";
add_proto qw/void av1_highbd_convolve_2d_scale/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_q4, const int x_step_qn, const int subpel_y_q4, const int y_step_qn, ConvolveParams *conv_params, int bd";
@ -342,19 +380,19 @@ add_proto qw/void av1_highbd_jnt_convolve_2d_copy/, "const uint16_t *src, int sr
specialize qw/av1_convolve_x_sr sse2 avx2 neon/;
specialize qw/av1_convolve_y_sr sse2 avx2 neon/;
specialize qw/av1_convolve_2d_scale sse4_1/;
specialize qw/av1_jnt_convolve_2d ssse3 avx2 neon/;
specialize qw/av1_jnt_convolve_2d_copy sse2 avx2 neon/;
specialize qw/av1_jnt_convolve_x sse2 avx2 neon/;
specialize qw/av1_jnt_convolve_y sse2 avx2 neon/;
specialize qw/av1_dist_wtd_convolve_2d sse2 ssse3 avx2 neon/;
specialize qw/av1_dist_wtd_convolve_2d_copy sse2 avx2 neon/;
specialize qw/av1_dist_wtd_convolve_x sse2 avx2 neon/;
specialize qw/av1_dist_wtd_convolve_y sse2 avx2 neon/;
specialize qw/av1_highbd_convolve_2d_copy_sr sse2 avx2/;
specialize qw/av1_highbd_convolve_2d_sr ssse3 avx2/;
specialize qw/av1_highbd_convolve_x_sr ssse3 avx2/;
specialize qw/av1_highbd_convolve_y_sr ssse3 avx2/;
specialize qw/av1_highbd_convolve_2d_scale sse4_1/;
specialize qw/av1_highbd_jnt_convolve_2d sse4_1 avx2/;
specialize qw/av1_highbd_jnt_convolve_x sse4_1 avx2/;
specialize qw/av1_highbd_jnt_convolve_y sse4_1 avx2/;
specialize qw/av1_highbd_jnt_convolve_2d_copy sse4_1 avx2/;
specialize qw/av1_highbd_dist_wtd_convolve_2d sse4_1 avx2/;
specialize qw/av1_highbd_dist_wtd_convolve_x sse4_1 avx2/;
specialize qw/av1_highbd_dist_wtd_convolve_y sse4_1 avx2/;
specialize qw/av1_highbd_dist_wtd_convolve_2d_copy sse4_1 avx2/;
# INTRA_EDGE functions
add_proto qw/void av1_filter_intra_edge/, "uint8_t *p, int sz, int strength";

View file

@ -10,10 +10,11 @@
*/
#include "config/aom_dsp_rtcd.h"
#include "config/av1_rtcd.h"
#include "av1/common/av1_txfm.h"
// av1_cospi_arr[i][j] = (int)round(cos(M_PI*j/128) * (1<<(cos_bit_min+i)));
// av1_cospi_arr[i][j] = (int)round(cos(PI*j/128) * (1<<(cos_bit_min+i)));
const int32_t av1_cospi_arr_data[7][64] = {
{ 1024, 1024, 1023, 1021, 1019, 1016, 1013, 1009, 1004, 999, 993, 987, 980,
972, 964, 955, 946, 936, 926, 915, 903, 891, 878, 865, 851, 837,

View file

@ -110,7 +110,7 @@ typedef void (*TxfmFunc)(const int32_t *input, int32_t *output, int8_t cos_bit,
typedef void (*FwdTxfm2dFunc)(const int16_t *input, int32_t *output, int stride,
TX_TYPE tx_type, int bd);
typedef enum TXFM_TYPE {
enum {
TXFM_TYPE_DCT4,
TXFM_TYPE_DCT8,
TXFM_TYPE_DCT16,
@ -125,7 +125,7 @@ typedef enum TXFM_TYPE {
TXFM_TYPE_IDENTITY32,
TXFM_TYPES,
TXFM_TYPE_INVALID,
} TXFM_TYPE;
} UENUM1BYTE(TXFM_TYPE);
typedef struct TXFM_2D_FLIP_CFG {
TX_SIZE tx_size;

View file

@ -38,19 +38,19 @@ extern "C" {
#define MAX_DIFFWTD_MASK_BITS 1
// DIFFWTD_MASK_TYPES should not surpass 1 << MAX_DIFFWTD_MASK_BITS
typedef enum ATTRIBUTE_PACKED {
enum {
DIFFWTD_38 = 0,
DIFFWTD_38_INV,
DIFFWTD_MASK_TYPES,
} DIFFWTD_MASK_TYPE;
} UENUM1BYTE(DIFFWTD_MASK_TYPE);
typedef enum ATTRIBUTE_PACKED {
enum {
KEY_FRAME = 0,
INTER_FRAME = 1,
INTRA_ONLY_FRAME = 2, // replaces intra-only
S_FRAME = 3,
FRAME_TYPES,
} FRAME_TYPE;
} UENUM1BYTE(FRAME_TYPE);
static INLINE int is_comp_ref_allowed(BLOCK_SIZE bsize) {
return AOMMIN(block_size_wide[bsize], block_size_high[bsize]) >= 8;
@ -156,18 +156,16 @@ static INLINE int is_masked_compound_type(COMPOUND_TYPE type) {
modes for the Y blocks to the left and above us; for interframes, there
is a single probability table. */
typedef int8_t MV_REFERENCE_FRAME;
typedef struct {
// Number of base colors for Y (0) and UV (1)
uint8_t palette_size[2];
// Value of base colors for Y, U, and V
uint16_t palette_colors[3 * PALETTE_MAX_SIZE];
// Number of base colors for Y (0) and UV (1)
uint8_t palette_size[2];
} PALETTE_MODE_INFO;
typedef struct {
uint8_t use_filter_intra;
FILTER_INTRA_MODE filter_intra_mode;
uint8_t use_filter_intra;
} FILTER_INTRA_MODE_INFO;
static const PREDICTION_MODE fimode_to_intradir[FILTER_INTRA_MODES] = {
@ -192,6 +190,11 @@ typedef struct RD_STATS {
int64_t ref_rdcost;
int zero_rate;
uint8_t invalid_rate;
#if CONFIG_ONE_PASS_SVM
int eob, eob_0, eob_1, eob_2, eob_3;
int64_t rd, rd_0, rd_1, rd_2, rd_3;
int64_t y_sse, sse_0, sse_1, sse_2, sse_3;
#endif
#if CONFIG_RD_DEBUG
int txb_coeff_cost[MAX_MB_PLANE];
int txb_coeff_cost_map[MAX_MB_PLANE][TXB_COEFF_COST_MAP_SIZE]
@ -202,10 +205,10 @@ typedef struct RD_STATS {
// This struct is used to group function args that are commonly
// sent together in functions related to interinter compound modes
typedef struct {
uint8_t *seg_mask;
int wedge_index;
int wedge_sign;
DIFFWTD_MASK_TYPE mask_type;
uint8_t *seg_mask;
COMPOUND_TYPE type;
} INTERINTER_COMPOUND_DATA;
@ -213,48 +216,18 @@ typedef struct {
#define TXK_TYPE_BUF_LEN 64
// This structure now relates to 4x4 block regions.
typedef struct MB_MODE_INFO {
// Common for both INTER and INTRA blocks
BLOCK_SIZE sb_type;
PREDICTION_MODE mode;
TX_SIZE tx_size;
uint8_t inter_tx_size[INTER_TX_SIZE_BUF_LEN];
int8_t skip;
int8_t skip_mode;
int8_t segment_id;
int8_t seg_id_predicted; // valid only when temporal_update is enabled
// Only for INTRA blocks
UV_PREDICTION_MODE uv_mode;
PALETTE_MODE_INFO palette_mode_info;
uint8_t use_intrabc;
// Only for INTER blocks
InterpFilters interp_filters;
MV_REFERENCE_FRAME ref_frame[2];
TX_TYPE txk_type[TXK_TYPE_BUF_LEN];
FILTER_INTRA_MODE_INFO filter_intra_mode_info;
// The actual prediction angle is the base angle + (angle_delta * step).
int8_t angle_delta[PLANE_TYPES];
// interintra members
INTERINTRA_MODE interintra_mode;
// TODO(debargha): Consolidate these flags
int use_wedge_interintra;
int interintra_wedge_index;
int interintra_wedge_sign;
WarpedMotionParams wm_params;
// interinter members
INTERINTER_COMPOUND_DATA interinter_comp;
MOTION_MODE motion_mode;
int overlappable_neighbors[2];
FILTER_INTRA_MODE_INFO filter_intra_mode_info;
int_mv mv[2];
uint8_t ref_mv_idx;
PARTITION_TYPE partition;
/* deringing gain *per-superblock* */
int8_t cdef_strength;
// Only for INTER blocks
InterpFilters interp_filters;
// TODO(debargha): Consolidate these flags
int interintra_wedge_index;
int interintra_wedge_sign;
int overlappable_neighbors[2];
int current_qindex;
int delta_lf_from_base;
int delta_lf[FRAME_LF_COUNT];
@ -264,15 +237,43 @@ typedef struct MB_MODE_INFO {
int mi_col;
#endif
int num_proj_ref;
WarpedMotionParams wm_params;
// Index of the alpha Cb and alpha Cr combination
int cfl_alpha_idx;
// Joint sign of alpha Cb and alpha Cr
int cfl_alpha_signs;
int compound_idx;
// Indicate if masked compound is used(1) or not(0).
int comp_group_idx;
// If comp_group_idx=0, indicate if dist_wtd_comp(0) or avg_comp(1) is used.
int compound_idx;
#if CONFIG_INSPECTION
int16_t tx_skip[TXK_TYPE_BUF_LEN];
#endif
// Common for both INTER and INTRA blocks
BLOCK_SIZE sb_type;
PREDICTION_MODE mode;
// Only for INTRA blocks
UV_PREDICTION_MODE uv_mode;
// interintra members
INTERINTRA_MODE interintra_mode;
MOTION_MODE motion_mode;
PARTITION_TYPE partition;
TX_TYPE txk_type[TXK_TYPE_BUF_LEN];
MV_REFERENCE_FRAME ref_frame[2];
int8_t use_wedge_interintra;
int8_t skip;
int8_t skip_mode;
uint8_t inter_tx_size[INTER_TX_SIZE_BUF_LEN];
TX_SIZE tx_size;
int8_t segment_id;
int8_t seg_id_predicted; // valid only when temporal_update is enabled
uint8_t use_intrabc;
// The actual prediction angle is the base angle + (angle_delta * step).
int8_t angle_delta[PLANE_TYPES];
/* deringing gain *per-superblock* */
int8_t cdef_strength;
uint8_t ref_mv_idx;
} MB_MODE_INFO;
static INLINE int is_intrabc_block(const MB_MODE_INFO *mbmi) {
@ -372,7 +373,7 @@ static INLINE void mi_to_pixel_loc(int *pixel_c, int *pixel_r, int mi_col,
}
#endif
enum ATTRIBUTE_PACKED mv_precision { MV_PRECISION_Q3, MV_PRECISION_Q4 };
enum { MV_PRECISION_Q3, MV_PRECISION_Q4 } UENUM1BYTE(mv_precision);
struct buf_2d {
uint8_t *buf;
@ -406,7 +407,7 @@ typedef struct macroblockd_plane {
ENTROPY_CONTEXT *above_context;
ENTROPY_CONTEXT *left_context;
// The dequantizers below are true dequntizers used only in the
// The dequantizers below are true dequantizers used only in the
// dequantization process. They have the same coefficient
// shift/scale as TX.
int16_t seg_dequant_QTX[MAX_SEGMENTS][2];
@ -428,13 +429,6 @@ typedef struct macroblockd_plane {
#define BLOCK_OFFSET(x, i) \
((x) + (i) * (1 << (tx_size_wide_log2[0] + tx_size_high_log2[0])))
typedef struct RefBuffer {
int idx; // frame buf idx
int map_idx; // frame map idx
YV12_BUFFER_CONFIG *buf;
struct scale_factors sf;
} RefBuffer;
typedef struct {
DECLARE_ALIGNED(16, InterpKernel, vfilter);
DECLARE_ALIGNED(16, InterpKernel, hfilter);
@ -490,11 +484,13 @@ typedef struct cfl_ctx {
int is_chroma_reference;
} CFL_CTX;
typedef struct jnt_comp_params {
int use_jnt_comp_avg;
typedef struct dist_wtd_comp_params {
int use_dist_wtd_comp_avg;
int fwd_offset;
int bck_offset;
} JNT_COMP_PARAMS;
} DIST_WTD_COMP_PARAMS;
struct scale_factors;
// Most/all of the pointers are mere pointers to actual arrays are allocated
// elsewhere. This is mostly for coding convenience.
@ -522,8 +518,8 @@ typedef struct macroblockd {
int mb_to_top_edge;
int mb_to_bottom_edge;
/* pointers to reference frames */
const RefBuffer *block_refs[2];
/* pointers to reference frame scale factors */
const struct scale_factors *block_ref_scale_factors[2];
/* pointer to current frame */
const YV12_BUFFER_CONFIG *cur_buf;
@ -592,7 +588,7 @@ typedef struct macroblockd {
uint8_t *mc_buf[2];
CFL_CTX cfl;
JNT_COMP_PARAMS jcp_param;
DIST_WTD_COMP_PARAMS jcp_param;
uint16_t cb_offset[MAX_MB_PLANE];
uint16_t txb_offset[MAX_MB_PLANE];
@ -602,7 +598,7 @@ typedef struct macroblockd {
uint8_t *tmp_obmc_bufs[2];
} MACROBLOCKD;
static INLINE int get_bitdepth_data_path_index(const MACROBLOCKD *xd) {
static INLINE int is_cur_buf_hbd(const MACROBLOCKD *xd) {
return xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH ? 1 : 0;
}
@ -646,19 +642,19 @@ static INLINE BLOCK_SIZE get_partition_subsize(BLOCK_SIZE bsize,
static TX_TYPE intra_mode_to_tx_type(const MB_MODE_INFO *mbmi,
PLANE_TYPE plane_type) {
static const TX_TYPE _intra_mode_to_tx_type[INTRA_MODES] = {
DCT_DCT, // DC
ADST_DCT, // V
DCT_ADST, // H
DCT_DCT, // D45
ADST_ADST, // D135
ADST_DCT, // D117
DCT_ADST, // D153
DCT_ADST, // D207
ADST_DCT, // D63
ADST_ADST, // SMOOTH
ADST_DCT, // SMOOTH_V
DCT_ADST, // SMOOTH_H
ADST_ADST, // PAETH
DCT_DCT, // DC_PRED
ADST_DCT, // V_PRED
DCT_ADST, // H_PRED
DCT_DCT, // D45_PRED
ADST_ADST, // D135_PRED
ADST_DCT, // D113_PRED
DCT_ADST, // D157_PRED
DCT_ADST, // D203_PRED
ADST_DCT, // D67_PRED
ADST_ADST, // SMOOTH_PRED
ADST_DCT, // SMOOTH_V_PRED
DCT_ADST, // SMOOTH_H_PRED
ADST_ADST, // PAETH_PRED
};
const PREDICTION_MODE mode =
(plane_type == PLANE_TYPE_Y) ? mbmi->mode : get_uv_mode(mbmi->uv_mode);
@ -777,11 +773,13 @@ static INLINE int av1_raster_order_to_block_index(TX_SIZE tx_size,
static INLINE TX_TYPE get_default_tx_type(PLANE_TYPE plane_type,
const MACROBLOCKD *xd,
TX_SIZE tx_size) {
TX_SIZE tx_size,
int is_screen_content_type) {
const MB_MODE_INFO *const mbmi = xd->mi[0];
if (is_inter_block(mbmi) || plane_type != PLANE_TYPE_Y ||
xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32)
xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32 ||
is_screen_content_type)
return DCT_DCT;
return intra_mode_to_tx_type(mbmi, plane_type);
@ -1045,7 +1043,8 @@ motion_mode_allowed(const WarpedMotionParams *gm_params, const MACROBLOCKD *xd,
if (!check_num_overlappable_neighbors(mbmi)) return SIMPLE_TRANSLATION;
assert(!has_second_ref(mbmi));
if (mbmi->num_proj_ref >= 1 &&
(allow_warped_motion && !av1_is_scaled(&(xd->block_refs[0]->sf)))) {
(allow_warped_motion &&
!av1_is_scaled(xd->block_ref_scale_factors[0]))) {
if (xd->cur_frame_force_integer_mv) {
return OBMC_CAUSAL;
}

View file

@ -107,7 +107,7 @@ void copy_rect8_16bit_to_16bit_c(uint16_t *dst, int dstride,
}
}
static void copy_sb8_16(AOM_UNUSED AV1_COMMON *cm, uint16_t *dst, int dstride,
static void copy_sb8_16(AV1_COMMON *cm, uint16_t *dst, int dstride,
const uint8_t *src, int src_voffset, int src_hoffset,
int sstride, int vsize, int hsize) {
if (cm->seq_params.use_highbitdepth) {
@ -140,6 +140,7 @@ static INLINE void copy_rect(uint16_t *dst, int dstride, const uint16_t *src,
void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
MACROBLOCKD *xd) {
const CdefInfo *const cdef_info = &cm->cdef_info;
const int num_planes = av1_num_planes(cm);
DECLARE_ALIGNED(16, uint16_t, src[CDEF_INBUF_SIZE]);
uint16_t *linebuf[3];
@ -231,13 +232,15 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
cm->mi_grid_visible[MI_SIZE_64X64 * fbr * cm->mi_stride +
MI_SIZE_64X64 * fbc]
->cdef_strength;
level = cm->cdef_strengths[mbmi_cdef_strength] / CDEF_SEC_STRENGTHS;
level =
cdef_info->cdef_strengths[mbmi_cdef_strength] / CDEF_SEC_STRENGTHS;
sec_strength =
cm->cdef_strengths[mbmi_cdef_strength] % CDEF_SEC_STRENGTHS;
cdef_info->cdef_strengths[mbmi_cdef_strength] % CDEF_SEC_STRENGTHS;
sec_strength += sec_strength == 3;
uv_level = cm->cdef_uv_strengths[mbmi_cdef_strength] / CDEF_SEC_STRENGTHS;
uv_level =
cdef_info->cdef_uv_strengths[mbmi_cdef_strength] / CDEF_SEC_STRENGTHS;
uv_sec_strength =
cm->cdef_uv_strengths[mbmi_cdef_strength] % CDEF_SEC_STRENGTHS;
cdef_info->cdef_uv_strengths[mbmi_cdef_strength] % CDEF_SEC_STRENGTHS;
uv_sec_strength += uv_sec_strength == 3;
if ((level == 0 && sec_strength == 0 && uv_level == 0 &&
uv_sec_strength == 0) ||
@ -252,8 +255,8 @@ void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
for (int pli = 0; pli < num_planes; pli++) {
int coffset;
int rend, cend;
int pri_damping = cm->cdef_pri_damping;
int sec_damping = cm->cdef_sec_damping;
int pri_damping = cdef_info->cdef_pri_damping;
int sec_damping = cdef_info->cdef_sec_damping;
int hsize = nhb << mi_wide_l2[pli];
int vsize = nvb << mi_high_l2[pli];

View file

@ -114,7 +114,7 @@ const int cdef_sec_taps[2][2] = { { 2, 1 }, { 2, 1 } };
void cdef_filter_block_c(uint8_t *dst8, uint16_t *dst16, int dstride,
const uint16_t *in, int pri_strength, int sec_strength,
int dir, int pri_damping, int sec_damping, int bsize,
AOM_UNUSED int max_unused, int coeff_shift) {
int coeff_shift) {
int i, j, k;
const int s = CDEF_BSTRIDE;
const int *pri_taps = cdef_pri_taps[(pri_strength >> coeff_shift) & 1];
@ -237,12 +237,11 @@ void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
by = dlist[bi].by;
bx = dlist[bi].bx;
if (dst8)
cdef_filter_block(&dst8[(by << bsizey) * dstride + (bx << bsizex)], NULL,
dstride,
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
(pli ? t : adjust_strength(t, var[by][bx])), s,
t ? dir[by][bx] : 0, pri_damping, sec_damping, bsize,
(256 << coeff_shift) - 1, coeff_shift);
cdef_filter_block(
&dst8[(by << bsizey) * dstride + (bx << bsizex)], NULL, dstride,
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
(pli ? t : adjust_strength(t, var[by][bx])), s, t ? dir[by][bx] : 0,
pri_damping, sec_damping, bsize, coeff_shift);
else
cdef_filter_block(
NULL,
@ -251,7 +250,6 @@ void cdef_filter_fb(uint8_t *dst8, uint16_t *dst16, int dstride, uint16_t *in,
dirinit ? 1 << bsizex : dstride,
&in[(by * CDEF_BSTRIDE << bsizey) + (bx << bsizex)],
(pli ? t : adjust_strength(t, var[by][bx])), s, t ? dir[by][bx] : 0,
pri_damping, sec_damping, bsize, (256 << coeff_shift) - 1,
coeff_shift);
pri_damping, sec_damping, bsize, coeff_shift);
}
}

View file

@ -45,7 +45,7 @@ typedef void (*cdef_filter_block_func)(uint8_t *dst8, uint16_t *dst16,
int dstride, const uint16_t *in,
int pri_strength, int sec_strength,
int dir, int pri_damping,
int sec_damping, int bsize, int max,
int sec_damping, int bsize,
int coeff_shift);
void copy_cdef_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src,
cdef_list *dlist, int cdef_count, int bsize);

View file

@ -226,7 +226,6 @@ void SIMD_FUNC(cdef_filter_block_4x4_8)(uint8_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
AOM_UNUSED int max_unused,
int coeff_shift) {
v128 p0, p1, p2, p3;
v256 sum, row, tap, res;
@ -393,7 +392,6 @@ void SIMD_FUNC(cdef_filter_block_8x8_8)(uint8_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
AOM_UNUSED int max_unused,
int coeff_shift) {
int i;
v128 p0, p1, p2, p3;
@ -541,7 +539,6 @@ void SIMD_FUNC(cdef_filter_block_4x4_16)(uint16_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
AOM_UNUSED int max_unused,
int coeff_shift) {
int i;
v256 p0, p1, p2, p3, sum, row, res;
@ -699,7 +696,6 @@ void SIMD_FUNC(cdef_filter_block_8x8_16)(uint16_t *dst, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir,
int pri_damping, int sec_damping,
AOM_UNUSED int max_unused,
int coeff_shift) {
int i;
v256 sum, p0, p1, p2, p3, row, res;
@ -833,56 +829,55 @@ void SIMD_FUNC(cdef_filter_block_8x8_16)(uint16_t *dst, int dstride,
void SIMD_FUNC(cdef_filter_block)(uint8_t *dst8, uint16_t *dst16, int dstride,
const uint16_t *in, int pri_strength,
int sec_strength, int dir, int pri_damping,
int sec_damping, int bsize, int max,
int coeff_shift) {
int sec_damping, int bsize, int coeff_shift) {
if (dst8) {
if (bsize == BLOCK_8X8) {
SIMD_FUNC(cdef_filter_block_8x8_8)
(dst8, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
} else if (bsize == BLOCK_4X8) {
SIMD_FUNC(cdef_filter_block_4x4_8)
(dst8, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
SIMD_FUNC(cdef_filter_block_4x4_8)
(dst8 + 4 * dstride, dstride, in + 4 * CDEF_BSTRIDE, pri_strength,
sec_strength, dir, pri_damping, sec_damping, max, coeff_shift);
sec_strength, dir, pri_damping, sec_damping, coeff_shift);
} else if (bsize == BLOCK_8X4) {
SIMD_FUNC(cdef_filter_block_4x4_8)
(dst8, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
SIMD_FUNC(cdef_filter_block_4x4_8)
(dst8 + 4, dstride, in + 4, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
} else {
SIMD_FUNC(cdef_filter_block_4x4_8)
(dst8, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
}
} else {
if (bsize == BLOCK_8X8) {
SIMD_FUNC(cdef_filter_block_8x8_16)
(dst16, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
} else if (bsize == BLOCK_4X8) {
SIMD_FUNC(cdef_filter_block_4x4_16)
(dst16, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
SIMD_FUNC(cdef_filter_block_4x4_16)
(dst16 + 4 * dstride, dstride, in + 4 * CDEF_BSTRIDE, pri_strength,
sec_strength, dir, pri_damping, sec_damping, max, coeff_shift);
sec_strength, dir, pri_damping, sec_damping, coeff_shift);
} else if (bsize == BLOCK_8X4) {
SIMD_FUNC(cdef_filter_block_4x4_16)
(dst16, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
SIMD_FUNC(cdef_filter_block_4x4_16)
(dst16 + 4, dstride, in + 4, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
} else {
assert(bsize == BLOCK_4X4);
SIMD_FUNC(cdef_filter_block_4x4_16)
(dst16, dstride, in, pri_strength, sec_strength, dir, pri_damping,
sec_damping, max, coeff_shift);
sec_damping, coeff_shift);
}
}
}

View file

@ -37,7 +37,7 @@ void cfl_store_dc_pred(MACROBLOCKD *const xd, const uint8_t *input,
assert(pred_plane < CFL_PRED_PLANES);
assert(width <= CFL_BUF_LINE);
if (get_bitdepth_data_path_index(xd)) {
if (is_cur_buf_hbd(xd)) {
uint16_t *const input_16 = CONVERT_TO_SHORTPTR(input);
memcpy(xd->cfl.dc_pred_cache[pred_plane], input_16, width << 1);
return;
@ -69,7 +69,7 @@ void cfl_load_dc_pred(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
assert(pred_plane < CFL_PRED_PLANES);
assert(width <= CFL_BUF_LINE);
assert(height <= CFL_BUF_LINE);
if (get_bitdepth_data_path_index(xd)) {
if (is_cur_buf_hbd(xd)) {
uint16_t *dst_16 = CONVERT_TO_SHORTPTR(dst);
cfl_load_dc_pred_hbd(xd->cfl.dc_pred_cache[pred_plane], dst_16, dst_stride,
width, height);
@ -158,16 +158,6 @@ static INLINE void cfl_predict_lbd_c(const int16_t *ac_buf_q3, uint8_t *dst,
}
}
// Null function used for invalid tx_sizes
void cfl_predict_lbd_null(const int16_t *ac_buf_q3, uint8_t *dst,
int dst_stride, int alpha_q3) {
(void)ac_buf_q3;
(void)dst;
(void)dst_stride;
(void)alpha_q3;
assert(0);
}
CFL_PREDICT_FN(c, lbd)
void cfl_predict_hbd_c(const int16_t *ac_buf_q3, uint16_t *dst, int dst_stride,
@ -182,17 +172,6 @@ void cfl_predict_hbd_c(const int16_t *ac_buf_q3, uint16_t *dst, int dst_stride,
}
}
// Null function used for invalid tx_sizes
void cfl_predict_hbd_null(const int16_t *ac_buf_q3, uint16_t *dst,
int dst_stride, int alpha_q3, int bd) {
(void)ac_buf_q3;
(void)dst;
(void)dst_stride;
(void)alpha_q3;
(void)bd;
assert(0);
}
CFL_PREDICT_FN(c, hbd)
static void cfl_compute_parameters(MACROBLOCKD *const xd, TX_SIZE tx_size) {
@ -217,7 +196,7 @@ void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
cfl_idx_to_alpha(mbmi->cfl_alpha_idx, mbmi->cfl_alpha_signs, plane - 1);
assert((tx_size_high[tx_size] - 1) * CFL_BUF_LINE + tx_size_wide[tx_size] <=
CFL_BUF_SQUARE);
if (get_bitdepth_data_path_index(xd)) {
if (is_cur_buf_hbd(xd)) {
uint16_t *dst_16 = CONVERT_TO_SHORTPTR(dst);
get_predict_hbd_fn(tx_size)(cfl->ac_buf_q3, dst_16, dst_stride, alpha_q3,
xd->bd);
@ -226,24 +205,6 @@ void cfl_predict_block(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
get_predict_lbd_fn(tx_size)(cfl->ac_buf_q3, dst, dst_stride, alpha_q3);
}
// Null function used for invalid tx_sizes
void cfl_subsample_lbd_null(const uint8_t *input, int input_stride,
uint16_t *output_q3) {
(void)input;
(void)input_stride;
(void)output_q3;
assert(0);
}
// Null function used for invalid tx_sizes
void cfl_subsample_hbd_null(const uint16_t *input, int input_stride,
uint16_t *output_q3) {
(void)input;
(void)input_stride;
(void)output_q3;
assert(0);
}
static void cfl_luma_subsampling_420_lbd_c(const uint8_t *input,
int input_stride,
uint16_t *output_q3, int width,
@ -427,8 +388,7 @@ void cfl_store_tx(MACROBLOCKD *const xd, int row, int col, TX_SIZE tx_size,
assert(!((row & 1) && tx_size_high[tx_size] != 4));
sub8x8_adjust_offset(cfl, &row, &col);
}
cfl_store(cfl, dst, pd->dst.stride, row, col, tx_size,
get_bitdepth_data_path_index(xd));
cfl_store(cfl, dst, pd->dst.stride, row, col, tx_size, is_cur_buf_hbd(xd));
}
void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) {
@ -444,5 +404,5 @@ void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) {
const int height = max_intra_block_height(xd, bsize, AOM_PLANE_Y, tx_size);
tx_size = get_tx_size(width, height);
cfl_store(cfl, pd->dst.buf, pd->dst.stride, row, col, tx_size,
get_bitdepth_data_path_index(xd));
is_cur_buf_hbd(xd));
}

View file

@ -80,14 +80,6 @@ void cfl_store_dc_pred(MACROBLOCKD *const xd, const uint8_t *input,
void cfl_load_dc_pred(MACROBLOCKD *const xd, uint8_t *dst, int dst_stride,
TX_SIZE tx_size, CFL_PRED_TYPE pred_plane);
// Null function used for invalid tx_sizes
void cfl_subsample_lbd_null(const uint8_t *input, int input_stride,
uint16_t *output_q3);
// Null function used for invalid tx_sizes
void cfl_subsample_hbd_null(const uint16_t *input, int input_stride,
uint16_t *output_q3);
// Allows the CFL_SUBSAMPLE function to switch types depending on the bitdepth.
#define CFL_lbd_TYPE uint8_t *cfl_type
#define CFL_hbd_TYPE uint16_t *cfl_type
@ -133,21 +125,21 @@ void cfl_subsample_hbd_null(const uint16_t *input, int input_stride,
subsample_##bd##_##sub##_8x8_##arch, /* 8x8 */ \
subsample_##bd##_##sub##_16x16_##arch, /* 16x16 */ \
subsample_##bd##_##sub##_32x32_##arch, /* 32x32 */ \
cfl_subsample_##bd##_null, /* 64x64 (invalid CFL size) */ \
NULL, /* 64x64 (invalid CFL size) */ \
subsample_##bd##_##sub##_4x8_##arch, /* 4x8 */ \
subsample_##bd##_##sub##_8x4_##arch, /* 8x4 */ \
subsample_##bd##_##sub##_8x16_##arch, /* 8x16 */ \
subsample_##bd##_##sub##_16x8_##arch, /* 16x8 */ \
subsample_##bd##_##sub##_16x32_##arch, /* 16x32 */ \
subsample_##bd##_##sub##_32x16_##arch, /* 32x16 */ \
cfl_subsample_##bd##_null, /* 32x64 (invalid CFL size) */ \
cfl_subsample_##bd##_null, /* 64x32 (invalid CFL size) */ \
NULL, /* 32x64 (invalid CFL size) */ \
NULL, /* 64x32 (invalid CFL size) */ \
subsample_##bd##_##sub##_4x16_##arch, /* 4x16 */ \
subsample_##bd##_##sub##_16x4_##arch, /* 16x4 */ \
subsample_##bd##_##sub##_8x32_##arch, /* 8x32 */ \
subsample_##bd##_##sub##_32x8_##arch, /* 32x8 */ \
cfl_subsample_##bd##_null, /* 16x64 (invalid CFL size) */ \
cfl_subsample_##bd##_null, /* 64x16 (invalid CFL size) */ \
NULL, /* 16x64 (invalid CFL size) */ \
NULL, /* 64x16 (invalid CFL size) */ \
};
// The RTCD script does not support passing in an array, so we wrap it in this
@ -160,14 +152,6 @@ void cfl_subsample_hbd_null(const uint16_t *input, int input_stride,
CFL_SUBSAMPLE_FUNCTIONS(arch, 422, hbd) \
CFL_SUBSAMPLE_FUNCTIONS(arch, 444, hbd)
// Null function used for invalid tx_sizes
static INLINE void cfl_subtract_average_null(const uint16_t *src,
int16_t *dst) {
(void)dst;
(void)src;
assert(0);
}
// Declare a size-specific wrapper for the size-generic function. The compiler
// will inline the size generic function in here, the advantage is that the size
// will be constant allowing for loop unrolling and other constant propagated
@ -201,21 +185,21 @@ static INLINE void cfl_subtract_average_null(const uint16_t *src,
subtract_average_8x8_##arch, /* 8x8 */ \
subtract_average_16x16_##arch, /* 16x16 */ \
subtract_average_32x32_##arch, /* 32x32 */ \
cfl_subtract_average_null, /* 64x64 (invalid CFL size) */ \
NULL, /* 64x64 (invalid CFL size) */ \
subtract_average_4x8_##arch, /* 4x8 */ \
subtract_average_8x4_##arch, /* 8x4 */ \
subtract_average_8x16_##arch, /* 8x16 */ \
subtract_average_16x8_##arch, /* 16x8 */ \
subtract_average_16x32_##arch, /* 16x32 */ \
subtract_average_32x16_##arch, /* 32x16 */ \
cfl_subtract_average_null, /* 32x64 (invalid CFL size) */ \
cfl_subtract_average_null, /* 64x32 (invalid CFL size) */ \
NULL, /* 32x64 (invalid CFL size) */ \
NULL, /* 64x32 (invalid CFL size) */ \
subtract_average_4x16_##arch, /* 4x16 (invalid CFL size) */ \
subtract_average_16x4_##arch, /* 16x4 (invalid CFL size) */ \
subtract_average_8x32_##arch, /* 8x32 (invalid CFL size) */ \
subtract_average_32x8_##arch, /* 32x8 (invalid CFL size) */ \
cfl_subtract_average_null, /* 16x64 (invalid CFL size) */ \
cfl_subtract_average_null, /* 64x16 (invalid CFL size) */ \
NULL, /* 16x64 (invalid CFL size) */ \
NULL, /* 64x16 (invalid CFL size) */ \
}; \
/* Modulo TX_SIZES_ALL to ensure that an attacker won't be able to */ \
/* index the function pointer array out of bounds. */ \
@ -249,14 +233,6 @@ void subtract_average_4x16_c(const uint16_t *src, int16_t *dst);
#define CFL_PREDICT_X(arch, width, height, bd) \
CFL_PREDICT_##bd(arch, width, height)
// Null function used for invalid tx_sizes
void cfl_predict_lbd_null(const int16_t *pred_buf_q3, uint8_t *dst,
int dst_stride, int alpha_q3);
// Null function used for invalid tx_sizes
void cfl_predict_hbd_null(const int16_t *pred_buf_q3, uint16_t *dst,
int dst_stride, int alpha_q3, int bd);
#define CFL_PREDICT_FN(arch, bd) \
CFL_PREDICT_X(arch, 4, 4, bd) \
CFL_PREDICT_X(arch, 4, 8, bd) \
@ -278,21 +254,21 @@ void cfl_predict_hbd_null(const int16_t *pred_buf_q3, uint16_t *dst,
predict_##bd##_8x8_##arch, /* 8x8 */ \
predict_##bd##_16x16_##arch, /* 16x16 */ \
predict_##bd##_32x32_##arch, /* 32x32 */ \
cfl_predict_##bd##_null, /* 64x64 (invalid CFL size) */ \
NULL, /* 64x64 (invalid CFL size) */ \
predict_##bd##_4x8_##arch, /* 4x8 */ \
predict_##bd##_8x4_##arch, /* 8x4 */ \
predict_##bd##_8x16_##arch, /* 8x16 */ \
predict_##bd##_16x8_##arch, /* 16x8 */ \
predict_##bd##_16x32_##arch, /* 16x32 */ \
predict_##bd##_32x16_##arch, /* 32x16 */ \
cfl_predict_##bd##_null, /* 32x64 (invalid CFL size) */ \
cfl_predict_##bd##_null, /* 64x32 (invalid CFL size) */ \
NULL, /* 32x64 (invalid CFL size) */ \
NULL, /* 64x32 (invalid CFL size) */ \
predict_##bd##_4x16_##arch, /* 4x16 */ \
predict_##bd##_16x4_##arch, /* 16x4 */ \
predict_##bd##_8x32_##arch, /* 8x32 */ \
predict_##bd##_32x8_##arch, /* 32x8 */ \
cfl_predict_##bd##_null, /* 16x64 (invalid CFL size) */ \
cfl_predict_##bd##_null, /* 64x16 (invalid CFL size) */ \
NULL, /* 16x64 (invalid CFL size) */ \
NULL, /* 64x16 (invalid CFL size) */ \
}; \
/* Modulo TX_SIZES_ALL to ensure that an attacker won't be able to */ \
/* index the function pointer array out of bounds. */ \

View file

@ -73,6 +73,45 @@ void av1_highbd_convolve_horiz_rs_c(const uint16_t *src, int src_stride,
}
}
void av1_convolve_2d_sobel_y_c(const uint8_t *src, int src_stride, double *dst,
int dst_stride, int w, int h, int dir,
double norm) {
int16_t im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE];
DECLARE_ALIGNED(256, static const int16_t, sobel_a[3]) = { 1, 0, -1 };
DECLARE_ALIGNED(256, static const int16_t, sobel_b[3]) = { 1, 2, 1 };
const int taps = 3;
int im_h = h + taps - 1;
int im_stride = w;
const int fo_vert = 1;
const int fo_horiz = 1;
// horizontal filter
const uint8_t *src_horiz = src - fo_vert * src_stride;
const int16_t *x_filter = dir ? sobel_a : sobel_b;
for (int y = 0; y < im_h; ++y) {
for (int x = 0; x < w; ++x) {
int16_t sum = 0;
for (int k = 0; k < taps; ++k) {
sum += x_filter[k] * src_horiz[y * src_stride + x - fo_horiz + k];
}
im_block[y * im_stride + x] = sum;
}
}
// vertical filter
int16_t *src_vert = im_block + fo_vert * im_stride;
const int16_t *y_filter = dir ? sobel_b : sobel_a;
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
int16_t sum = 0;
for (int k = 0; k < taps; ++k) {
sum += y_filter[k] * src_vert[(y - fo_vert + k) * im_stride + x];
}
dst[y * dst_stride + x] = sum * norm;
}
}
}
void av1_convolve_2d_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h,
const InterpFilterParams *filter_params_x,
@ -199,16 +238,16 @@ void av1_convolve_2d_copy_sr_c(const uint8_t *src, int src_stride, uint8_t *dst,
(void)conv_params;
for (int y = 0; y < h; ++y) {
memcpy(dst + y * dst_stride, src + y * src_stride, w * sizeof(src[0]));
memmove(dst + y * dst_stride, src + y * src_stride, w * sizeof(src[0]));
}
}
void av1_jnt_convolve_2d_c(const uint8_t *src, int src_stride, uint8_t *dst8,
int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_2d_c(const uint8_t *src, int src_stride,
uint8_t *dst8, int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
int16_t im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE];
@ -251,7 +290,7 @@ void av1_jnt_convolve_2d_c(const uint8_t *src, int src_stride, uint8_t *dst8,
CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1);
if (conv_params->do_average) {
int32_t tmp = dst[y * dst_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -269,12 +308,12 @@ void av1_jnt_convolve_2d_c(const uint8_t *src, int src_stride, uint8_t *dst8,
}
}
void av1_jnt_convolve_y_c(const uint8_t *src, int src_stride, uint8_t *dst8,
int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_y_c(const uint8_t *src, int src_stride,
uint8_t *dst8, int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int fo_vert = filter_params_y->taps / 2 - 1;
@ -302,7 +341,7 @@ void av1_jnt_convolve_y_c(const uint8_t *src, int src_stride, uint8_t *dst8,
if (conv_params->do_average) {
int32_t tmp = dst[y * dst_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -319,12 +358,12 @@ void av1_jnt_convolve_y_c(const uint8_t *src, int src_stride, uint8_t *dst8,
}
}
void av1_jnt_convolve_x_c(const uint8_t *src, int src_stride, uint8_t *dst8,
int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_x_c(const uint8_t *src, int src_stride,
uint8_t *dst8, int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int fo_horiz = filter_params_x->taps / 2 - 1;
@ -352,7 +391,7 @@ void av1_jnt_convolve_x_c(const uint8_t *src, int src_stride, uint8_t *dst8,
if (conv_params->do_average) {
int32_t tmp = dst[y * dst_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -369,12 +408,11 @@ void av1_jnt_convolve_x_c(const uint8_t *src, int src_stride, uint8_t *dst8,
}
}
void av1_jnt_convolve_2d_copy_c(const uint8_t *src, int src_stride,
uint8_t *dst8, int dst8_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_2d_copy_c(
const uint8_t *src, int src_stride, uint8_t *dst8, int dst8_stride, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
const int subpel_y_q4, ConvolveParams *conv_params) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int bits =
@ -395,7 +433,7 @@ void av1_jnt_convolve_2d_copy_c(const uint8_t *src, int src_stride,
if (conv_params->do_average) {
int32_t tmp = dst[y * dst_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -472,7 +510,7 @@ void av1_convolve_2d_scale_c(const uint8_t *src, int src_stride, uint8_t *dst8,
if (conv_params->is_compound) {
if (conv_params->do_average) {
int32_t tmp = dst16[y * dst16_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -593,7 +631,7 @@ void av1_highbd_convolve_2d_copy_sr_c(
(void)bd;
for (int y = 0; y < h; ++y) {
memcpy(dst + y * dst_stride, src + y * src_stride, w * sizeof(src[0]));
memmove(dst + y * dst_stride, src + y * src_stride, w * sizeof(src[0]));
}
}
@ -709,13 +747,11 @@ void av1_highbd_convolve_2d_sr_c(const uint16_t *src, int src_stride,
}
}
void av1_highbd_jnt_convolve_2d_c(const uint16_t *src, int src_stride,
uint16_t *dst16, int dst16_stride, int w,
int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params, int bd) {
void av1_highbd_dist_wtd_convolve_2d_c(
const uint16_t *src, int src_stride, uint16_t *dst16, int dst16_stride,
int w, int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
int x, y, k;
int16_t im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE];
CONV_BUF_TYPE *dst = conv_params->dst;
@ -760,7 +796,7 @@ void av1_highbd_jnt_convolve_2d_c(const uint16_t *src, int src_stride,
CONV_BUF_TYPE res = ROUND_POWER_OF_TWO(sum, conv_params->round_1);
if (conv_params->do_average) {
int32_t tmp = dst[y * dst_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -778,13 +814,11 @@ void av1_highbd_jnt_convolve_2d_c(const uint16_t *src, int src_stride,
}
}
void av1_highbd_jnt_convolve_x_c(const uint16_t *src, int src_stride,
uint16_t *dst16, int dst16_stride, int w,
int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params, int bd) {
void av1_highbd_dist_wtd_convolve_x_c(
const uint16_t *src, int src_stride, uint16_t *dst16, int dst16_stride,
int w, int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int fo_horiz = filter_params_x->taps / 2 - 1;
@ -812,7 +846,7 @@ void av1_highbd_jnt_convolve_x_c(const uint16_t *src, int src_stride,
if (conv_params->do_average) {
int32_t tmp = dst[y * dst_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -829,13 +863,11 @@ void av1_highbd_jnt_convolve_x_c(const uint16_t *src, int src_stride,
}
}
void av1_highbd_jnt_convolve_y_c(const uint16_t *src, int src_stride,
uint16_t *dst16, int dst16_stride, int w,
int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params, int bd) {
void av1_highbd_dist_wtd_convolve_y_c(
const uint16_t *src, int src_stride, uint16_t *dst16, int dst16_stride,
int w, int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
const int subpel_y_q4, ConvolveParams *conv_params, int bd) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int fo_vert = filter_params_y->taps / 2 - 1;
@ -863,7 +895,7 @@ void av1_highbd_jnt_convolve_y_c(const uint16_t *src, int src_stride,
if (conv_params->do_average) {
int32_t tmp = dst[y * dst_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -880,7 +912,7 @@ void av1_highbd_jnt_convolve_y_c(const uint16_t *src, int src_stride,
}
}
void av1_highbd_jnt_convolve_2d_copy_c(
void av1_highbd_dist_wtd_convolve_2d_copy_c(
const uint16_t *src, int src_stride, uint16_t *dst16, int dst16_stride,
int w, int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
@ -904,7 +936,7 @@ void av1_highbd_jnt_convolve_2d_copy_c(
res += round_offset;
if (conv_params->do_average) {
int32_t tmp = dst[y * dst_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -980,7 +1012,7 @@ void av1_highbd_convolve_2d_scale_c(const uint16_t *src, int src_stride,
if (conv_params->is_compound) {
if (conv_params->do_average) {
int32_t tmp = dst16[y * dst16_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {

View file

@ -26,7 +26,7 @@ typedef struct ConvolveParams {
int round_1;
int plane;
int is_compound;
int use_jnt_comp_avg;
int use_dist_wtd_comp_avg;
int fwd_offset;
int bck_offset;
} ConvolveParams;
@ -118,6 +118,11 @@ void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
const struct scale_factors *sf,
int is_intrabc, int bd);
// TODO(sarahparker) This will need to be integerized and optimized
void av1_convolve_2d_sobel_y_c(const uint8_t *src, int src_stride, double *dst,
int dst_stride, int w, int h, int dir,
double norm);
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -17,7 +17,7 @@
static void log_frame_info(AV1_COMMON *cm, const char *str, FILE *f) {
fprintf(f, "%s", str);
fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_video_frame,
fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_frame.frame_number,
cm->show_frame, cm->base_qindex);
}
/* This function dereferences a pointer to the mbmi structure
@ -40,7 +40,7 @@ static void print_mi_data(AV1_COMMON *cm, FILE *file, const char *descriptor,
mi++;
}
fprintf(file, "\n");
mi += MAX_MIB_SIZE;
mi += cm->mi_stride - cols;
}
fprintf(file, "\n");
}
@ -68,7 +68,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
mi++;
}
fprintf(mvs, "\n");
mi += MAX_MIB_SIZE;
mi += cm->mi_stride - cols;
}
fprintf(mvs, "\n");
@ -82,7 +82,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
mi++;
}
fprintf(mvs, "\n");
mi += MAX_MIB_SIZE;
mi += cm->mi_stride - cols;
}
fprintf(mvs, "\n");

View file

@ -54,12 +54,12 @@ extern "C" {
#define BASE_CONTEXT_POSITION_NUM 12
typedef enum TX_CLASS {
enum {
TX_CLASS_2D = 0,
TX_CLASS_HORIZ = 1,
TX_CLASS_VERT = 2,
TX_CLASSES = 3,
} TX_CLASS;
} UENUM1BYTE(TX_CLASS);
#define DCT_MAX_VALUE 16384
#define DCT_MAX_VALUE_HIGH10 65536

View file

@ -1068,9 +1068,16 @@ void av1_setup_frame_contexts(AV1_COMMON *cm) {
// This function must ONLY be called when cm->fc has been initialized with
// default probs, either by av1_setup_past_independence or after manually
// initializing them
cm->frame_contexts[FRAME_CONTEXT_DEFAULTS] = *cm->fc;
*cm->default_frame_context = *cm->fc;
// TODO(jack.haughton@argondesign.com): don't think this should be necessary,
// but could do with fuller testing
if (cm->large_scale_tile) {
for (int i = 0; i < FRAME_CONTEXTS; ++i) cm->frame_contexts[i] = *cm->fc;
for (int i = LAST_FRAME; i <= ALTREF_FRAME; ++i) {
RefCntBuffer *const buf = get_ref_frame_buf(cm, i);
if (buf != NULL) buf->frame_context = *cm->fc;
}
for (int i = 0; i < FRAME_BUFFERS; ++i)
cm->buffer_pool->frame_bufs[i].frame_context = *cm->fc;
}
}
@ -1079,10 +1086,8 @@ void av1_setup_past_independence(AV1_COMMON *cm) {
// Features disabled, 0, with delta coding (Default state).
av1_clearall_segfeatures(&cm->seg);
cm->current_frame_seg_map = cm->cur_frame->seg_map;
if (cm->current_frame_seg_map)
memset(cm->current_frame_seg_map, 0, (cm->mi_rows * cm->mi_cols));
if (cm->cur_frame->seg_map)
memset(cm->cur_frame->seg_map, 0, (cm->mi_rows * cm->mi_cols));
// reset mode ref deltas
av1_set_default_ref_deltas(cm->cur_frame->ref_deltas);
@ -1092,7 +1097,6 @@ void av1_setup_past_independence(AV1_COMMON *cm) {
av1_default_coef_probs(cm);
init_mode_probs(cm->fc);
av1_init_mv_probs(cm);
av1_init_lv_map(cm);
cm->fc->initialized = 1;
av1_setup_frame_contexts(cm);

View file

@ -30,12 +30,12 @@ void av1_init_mv_probs(struct AV1Common *cm);
/* Symbols for coding which components are zero jointly */
#define MV_JOINTS 4
typedef enum {
enum {
MV_JOINT_ZERO = 0, /* Zero vector */
MV_JOINT_HNZVZ = 1, /* Vert zero, hor nonzero */
MV_JOINT_HZVNZ = 2, /* Hor zero, vert nonzero */
MV_JOINT_HNZVNZ = 3, /* Both components nonzero */
} MV_JOINT_TYPE;
} UENUM1BYTE(MV_JOINT_TYPE);
static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) {
return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ;
@ -47,7 +47,7 @@ static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) {
/* Symbols for coding magnitude class of nonzero components */
#define MV_CLASSES 11
typedef enum {
enum {
MV_CLASS_0 = 0, /* (0, 2] integer pel */
MV_CLASS_1 = 1, /* (2, 4] integer pel */
MV_CLASS_2 = 2, /* (4, 8] integer pel */
@ -59,7 +59,7 @@ typedef enum {
MV_CLASS_8 = 8, /* (256, 512] integer pel */
MV_CLASS_9 = 9, /* (512, 1024] integer pel */
MV_CLASS_10 = 10, /* (1024,2048] integer pel */
} MV_CLASS_TYPE;
} UENUM1BYTE(MV_CLASS_TYPE);
#define CLASS0_BITS 1 /* bits at integer precision for class 0 */
#define CLASS0_SIZE (1 << CLASS0_BITS)
@ -91,11 +91,11 @@ typedef struct {
nmv_component comps[2];
} nmv_context;
typedef enum {
enum {
MV_SUBPEL_NONE = -1,
MV_SUBPEL_LOW_PRECISION = 0,
MV_SUBPEL_HIGH_PRECISION,
} MvSubpelPrecision;
} SENUM1BYTE(MvSubpelPrecision);
#ifdef __cplusplus
} // extern "C"

View file

@ -16,6 +16,7 @@
#include "aom/aom_codec.h"
#include "aom/aom_integer.h"
#include "aom_ports/mem.h"
#ifdef __cplusplus
extern "C" {
@ -63,17 +64,6 @@ extern "C" {
#define FRAME_OFFSET_BITS 5
#define MAX_FRAME_DISTANCE ((1 << FRAME_OFFSET_BITS) - 1)
#define REF_FRAMES_LOG2 3
#define REF_FRAMES (1 << REF_FRAMES_LOG2)
// 4 scratch frames for the new frames to support a maximum of 4 cores decoding
// in parallel, 3 for scaled references on the encoder.
// TODO(hkuang): Add ondemand frame buffers instead of hardcoding the number
// of framebuffers.
// TODO(jkoleszar): These 3 extra references could probably come from the
// normal reference pool.
#define FRAME_BUFFERS (REF_FRAMES + 7)
// 4 frame filter levels: y plane vertical, y plane horizontal,
// u plane, and v plane
#define FRAME_LF_COUNT 4
@ -95,12 +85,12 @@ extern "C" {
// Profile 2. 8-bit and 10-bit 4:2:2
// 12-bit 4:0:0, 4:2:2 and 4:4:4
// Since we have three bits for the profiles, it can be extended later.
typedef enum BITSTREAM_PROFILE {
enum {
PROFILE_0,
PROFILE_1,
PROFILE_2,
MAX_PROFILES,
} BITSTREAM_PROFILE;
} SENUM1BYTE(BITSTREAM_PROFILE);
#define LEVEL_MAJOR_BITS 3
#define LEVEL_MINOR_BITS 2
@ -149,7 +139,7 @@ typedef enum ATTRIBUTE_PACKED {
// 4X4, 8X8, 16X16, 32X32, 64X64, 128X128
#define SQR_BLOCK_SIZES 6
typedef enum ATTRIBUTE_PACKED {
enum {
PARTITION_NONE,
PARTITION_HORZ,
PARTITION_VERT,
@ -163,7 +153,7 @@ typedef enum ATTRIBUTE_PACKED {
EXT_PARTITION_TYPES,
PARTITION_TYPES = PARTITION_SPLIT + 1,
PARTITION_INVALID = 255
} PARTITION_TYPE;
} UENUM1BYTE(PARTITION_TYPE);
typedef char PARTITION_CONTEXT;
#define PARTITION_PLOFFSET 4 // number of probability models per block size
@ -171,12 +161,7 @@ typedef char PARTITION_CONTEXT;
#define PARTITION_CONTEXTS (PARTITION_BLOCK_SIZES * PARTITION_PLOFFSET)
// block transform size
#if defined(_MSC_VER)
typedef uint8_t TX_SIZE;
enum ATTRIBUTE_PACKED {
#else
typedef enum ATTRIBUTE_PACKED {
#endif
enum {
TX_4X4, // 4x4 transform
TX_8X8, // 8x8 transform
TX_16X16, // 16x16 transform
@ -200,11 +185,7 @@ typedef enum ATTRIBUTE_PACKED {
TX_SIZES = TX_4X8, // Does NOT include rectangular transforms
TX_SIZES_LARGEST = TX_64X64,
TX_INVALID = 255 // Invalid transform size
#if defined(_MSC_VER)
};
#else
} TX_SIZE;
#endif
} UENUM1BYTE(TX_SIZE);
#define TX_SIZE_LUMA_MIN (TX_4X4)
/* We don't need to code a transform size unless the allowed size is at least
@ -226,7 +207,7 @@ typedef enum ATTRIBUTE_PACKED {
#define TX_PAD_HOR 4
// Pad 6 extra rows (2 on top and 4 on bottom) to remove vertical availability
// check.
#define TX_PAD_TOP 2
#define TX_PAD_TOP 0
#define TX_PAD_BOTTOM 4
#define TX_PAD_VER (TX_PAD_TOP + TX_PAD_BOTTOM)
// Pad 16 extra bytes to avoid reading overflow in SIMD optimization.
@ -238,43 +219,43 @@ typedef enum ATTRIBUTE_PACKED {
#define MAX_TX_BLOCKS_IN_MAX_SB (1 << MAX_TX_BLOCKS_IN_MAX_SB_LOG2)
// frame transform mode
typedef enum ATTRIBUTE_PACKED {
enum {
ONLY_4X4, // use only 4x4 transform
TX_MODE_LARGEST, // transform size is the largest possible for pu size
TX_MODE_SELECT, // transform specified for each block
TX_MODES,
} TX_MODE;
} UENUM1BYTE(TX_MODE);
// 1D tx types
typedef enum ATTRIBUTE_PACKED {
enum {
DCT_1D,
ADST_1D,
FLIPADST_1D,
IDTX_1D,
TX_TYPES_1D,
} TX_TYPE_1D;
} UENUM1BYTE(TX_TYPE_1D);
typedef enum ATTRIBUTE_PACKED {
DCT_DCT, // DCT in both horizontal and vertical
ADST_DCT, // ADST in vertical, DCT in horizontal
DCT_ADST, // DCT in vertical, ADST in horizontal
ADST_ADST, // ADST in both directions
FLIPADST_DCT,
DCT_FLIPADST,
FLIPADST_FLIPADST,
ADST_FLIPADST,
FLIPADST_ADST,
IDTX,
V_DCT,
H_DCT,
V_ADST,
H_ADST,
V_FLIPADST,
H_FLIPADST,
enum {
DCT_DCT, // DCT in both horizontal and vertical
ADST_DCT, // ADST in vertical, DCT in horizontal
DCT_ADST, // DCT in vertical, ADST in horizontal
ADST_ADST, // ADST in both directions
FLIPADST_DCT, // FLIPADST in vertical, DCT in horizontal
DCT_FLIPADST, // DCT in vertical, FLIPADST in horizontal
FLIPADST_FLIPADST, // FLIPADST in both directions
ADST_FLIPADST, // ADST in vertical, FLIPADST in horizontal
FLIPADST_ADST, // FLIPADST in vertical, ADST in horizontal
IDTX, // Identity in both directions
V_DCT, // DCT in vertical, identity in horizontal
H_DCT, // Identity in vertical, DCT in horizontal
V_ADST, // ADST in vertical, identity in horizontal
H_ADST, // Identity in vertical, ADST in horizontal
V_FLIPADST, // FLIPADST in vertical, identity in horizontal
H_FLIPADST, // Identity in vertical, FLIPADST in horizontal
TX_TYPES,
} TX_TYPE;
} UENUM1BYTE(TX_TYPE);
typedef enum ATTRIBUTE_PACKED {
enum {
REG_REG,
REG_SMOOTH,
REG_SHARP,
@ -284,9 +265,9 @@ typedef enum ATTRIBUTE_PACKED {
SHARP_REG,
SHARP_SMOOTH,
SHARP_SHARP,
} DUAL_FILTER_TYPE;
} UENUM1BYTE(DUAL_FILTER_TYPE);
typedef enum ATTRIBUTE_PACKED {
enum {
// DCT only
EXT_TX_SET_DCTONLY,
// DCT + Identity only
@ -300,7 +281,7 @@ typedef enum ATTRIBUTE_PACKED {
// Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver (6)
EXT_TX_SET_ALL16,
EXT_TX_SET_TYPES
} TxSetType;
} UENUM1BYTE(TxSetType);
#define IS_2D_TRANSFORM(tx_type) (tx_type < IDTX)
@ -308,7 +289,7 @@ typedef enum ATTRIBUTE_PACKED {
#define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER
#define EXT_TX_SETS_INTRA 3 // Sets of transform selections for INTRA
typedef enum ATTRIBUTE_PACKED {
enum {
AOM_LAST_FLAG = 1 << 0,
AOM_LAST2_FLAG = 1 << 1,
AOM_LAST3_FLAG = 1 << 2,
@ -317,19 +298,15 @@ typedef enum ATTRIBUTE_PACKED {
AOM_ALT2_FLAG = 1 << 5,
AOM_ALT_FLAG = 1 << 6,
AOM_REFFRAME_ALL = (1 << 7) - 1
} AOM_REFFRAME;
} UENUM1BYTE(AOM_REFFRAME);
typedef enum ATTRIBUTE_PACKED {
enum {
UNIDIR_COMP_REFERENCE,
BIDIR_COMP_REFERENCE,
COMP_REFERENCE_TYPES,
} COMP_REFERENCE_TYPE;
} UENUM1BYTE(COMP_REFERENCE_TYPE);
typedef enum ATTRIBUTE_PACKED {
PLANE_TYPE_Y,
PLANE_TYPE_UV,
PLANE_TYPES
} PLANE_TYPE;
enum { PLANE_TYPE_Y, PLANE_TYPE_UV, PLANE_TYPES } UENUM1BYTE(PLANE_TYPE);
#define CFL_ALPHABET_SIZE_LOG2 4
#define CFL_ALPHABET_SIZE (1 << CFL_ALPHABET_SIZE_LOG2)
@ -337,24 +314,20 @@ typedef enum ATTRIBUTE_PACKED {
#define CFL_IDX_U(idx) (idx >> CFL_ALPHABET_SIZE_LOG2)
#define CFL_IDX_V(idx) (idx & (CFL_ALPHABET_SIZE - 1))
typedef enum ATTRIBUTE_PACKED {
CFL_PRED_U,
CFL_PRED_V,
CFL_PRED_PLANES
} CFL_PRED_TYPE;
enum { CFL_PRED_U, CFL_PRED_V, CFL_PRED_PLANES } UENUM1BYTE(CFL_PRED_TYPE);
typedef enum ATTRIBUTE_PACKED {
enum {
CFL_SIGN_ZERO,
CFL_SIGN_NEG,
CFL_SIGN_POS,
CFL_SIGNS
} CFL_SIGN_TYPE;
} UENUM1BYTE(CFL_SIGN_TYPE);
typedef enum ATTRIBUTE_PACKED {
enum {
CFL_DISALLOWED,
CFL_ALLOWED,
CFL_ALLOWED_TYPES
} CFL_ALLOWED_TYPE;
} UENUM1BYTE(CFL_ALLOWED_TYPE);
// CFL_SIGN_ZERO,CFL_SIGN_ZERO is invalid
#define CFL_JOINT_SIGNS (CFL_SIGNS * CFL_SIGNS - 1)
@ -371,12 +344,12 @@ typedef enum ATTRIBUTE_PACKED {
#define CFL_CONTEXT_V(js) \
(CFL_SIGN_V(js) * CFL_SIGNS + CFL_SIGN_U(js) - CFL_SIGNS)
typedef enum ATTRIBUTE_PACKED {
enum {
PALETTE_MAP,
COLOR_MAP_TYPES,
} COLOR_MAP_TYPE;
} UENUM1BYTE(COLOR_MAP_TYPE);
typedef enum ATTRIBUTE_PACKED {
enum {
TWO_COLORS,
THREE_COLORS,
FOUR_COLORS,
@ -385,9 +358,9 @@ typedef enum ATTRIBUTE_PACKED {
SEVEN_COLORS,
EIGHT_COLORS,
PALETTE_SIZES
} PALETTE_SIZE;
} UENUM1BYTE(PALETTE_SIZE);
typedef enum ATTRIBUTE_PACKED {
enum {
PALETTE_COLOR_ONE,
PALETTE_COLOR_TWO,
PALETTE_COLOR_THREE,
@ -397,11 +370,11 @@ typedef enum ATTRIBUTE_PACKED {
PALETTE_COLOR_SEVEN,
PALETTE_COLOR_EIGHT,
PALETTE_COLORS
} PALETTE_COLOR;
} UENUM1BYTE(PALETTE_COLOR);
// Note: All directional predictors must be between V_PRED and D67_PRED (both
// inclusive).
typedef enum ATTRIBUTE_PACKED {
enum {
DC_PRED, // Average of above and left pixels
V_PRED, // Vertical
H_PRED, // Horizontal
@ -442,11 +415,11 @@ typedef enum ATTRIBUTE_PACKED {
INTER_MODE_END = MB_MODE_COUNT,
INTRA_MODES = PAETH_PRED + 1, // PAETH_PRED has to be the last intra mode.
INTRA_INVALID = MB_MODE_COUNT // For uv_mode in inter blocks
} PREDICTION_MODE;
} UENUM1BYTE(PREDICTION_MODE);
// TODO(ltrudeau) Do we really want to pack this?
// TODO(ltrudeau) Do we match with PREDICTION_MODE?
typedef enum ATTRIBUTE_PACKED {
enum {
UV_DC_PRED, // Average of above and left pixels
UV_V_PRED, // Vertical
UV_H_PRED, // Horizontal
@ -463,38 +436,38 @@ typedef enum ATTRIBUTE_PACKED {
UV_CFL_PRED, // Chroma-from-Luma
UV_INTRA_MODES,
UV_MODE_INVALID, // For uv_mode in inter blocks
} UV_PREDICTION_MODE;
} UENUM1BYTE(UV_PREDICTION_MODE);
typedef enum ATTRIBUTE_PACKED {
enum {
SIMPLE_TRANSLATION,
OBMC_CAUSAL, // 2-sided OBMC
WARPED_CAUSAL, // 2-sided WARPED
MOTION_MODES
} MOTION_MODE;
} UENUM1BYTE(MOTION_MODE);
typedef enum ATTRIBUTE_PACKED {
enum {
II_DC_PRED,
II_V_PRED,
II_H_PRED,
II_SMOOTH_PRED,
INTERINTRA_MODES
} INTERINTRA_MODE;
} UENUM1BYTE(INTERINTRA_MODE);
typedef enum ATTRIBUTE_PACKED {
enum {
COMPOUND_AVERAGE,
COMPOUND_WEDGE,
COMPOUND_DIFFWTD,
COMPOUND_TYPES,
} COMPOUND_TYPE;
} UENUM1BYTE(COMPOUND_TYPE);
typedef enum ATTRIBUTE_PACKED {
enum {
FILTER_DC_PRED,
FILTER_V_PRED,
FILTER_H_PRED,
FILTER_D157_PRED,
FILTER_PAETH_PRED,
FILTER_INTRA_MODES,
} FILTER_INTRA_MODE;
} UENUM1BYTE(FILTER_INTRA_MODE);
#define DIRECTIONAL_MODES 8
#define MAX_ANGLE_DELTA 3
@ -550,28 +523,47 @@ typedef enum ATTRIBUTE_PACKED {
#define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 3)
typedef uint8_t TXFM_CONTEXT;
#define NONE_FRAME -1
#define INTRA_FRAME 0
#define LAST_FRAME 1
#define LAST2_FRAME 2
#define LAST3_FRAME 3
#define GOLDEN_FRAME 4
#define BWDREF_FRAME 5
#define ALTREF2_FRAME 6
#define ALTREF_FRAME 7
#define EXTREF_FRAME REF_FRAMES
#define LAST_REF_FRAMES (LAST3_FRAME - LAST_FRAME + 1)
// An enum for single reference types (and some derived values).
enum {
NONE_FRAME = -1,
INTRA_FRAME,
LAST_FRAME,
LAST2_FRAME,
LAST3_FRAME,
GOLDEN_FRAME,
BWDREF_FRAME,
ALTREF2_FRAME,
ALTREF_FRAME,
REF_FRAMES,
#define INTER_REFS_PER_FRAME (ALTREF_FRAME - LAST_FRAME + 1)
// Extra/scratch reference frame. It may be:
// - used to update the ALTREF2_FRAME ref (see lshift_bwd_ref_frames()), or
// - updated from ALTREF2_FRAME ref (see rshift_bwd_ref_frames()).
EXTREF_FRAME = REF_FRAMES,
// Number of inter (non-intra) reference types.
INTER_REFS_PER_FRAME = ALTREF_FRAME - LAST_FRAME + 1,
// Number of forward (aka past) reference types.
FWD_REFS = GOLDEN_FRAME - LAST_FRAME + 1,
// Number of backward (aka future) reference types.
BWD_REFS = ALTREF_FRAME - BWDREF_FRAME + 1,
SINGLE_REFS = FWD_REFS + BWD_REFS,
};
#define REF_FRAMES_LOG2 3
// REF_FRAMES for the cm->ref_frame_map array, 1 scratch frame for the new
// frame in cm->cur_frame, INTER_REFS_PER_FRAME for scaled references on the
// encoder in the cpi->scaled_ref_buf array.
#define FRAME_BUFFERS (REF_FRAMES + 1 + INTER_REFS_PER_FRAME)
#define FWD_REFS (GOLDEN_FRAME - LAST_FRAME + 1)
#define FWD_RF_OFFSET(ref) (ref - LAST_FRAME)
#define BWD_REFS (ALTREF_FRAME - BWDREF_FRAME + 1)
#define BWD_RF_OFFSET(ref) (ref - BWDREF_FRAME)
#define SINGLE_REFS (FWD_REFS + BWD_REFS)
typedef enum ATTRIBUTE_PACKED {
enum {
LAST_LAST2_FRAMES, // { LAST_FRAME, LAST2_FRAME }
LAST_LAST3_FRAMES, // { LAST_FRAME, LAST3_FRAME }
LAST_GOLDEN_FRAMES, // { LAST_FRAME, GOLDEN_FRAME }
@ -585,7 +577,7 @@ typedef enum ATTRIBUTE_PACKED {
// NOTE: UNIDIR_COMP_REFS is the number of uni-directional reference pairs
// that are explicitly signaled.
UNIDIR_COMP_REFS = BWDREF_ALTREF_FRAMES + 1,
} UNIDIR_COMP_REF;
} UENUM1BYTE(UNIDIR_COMP_REF);
#define TOTAL_COMP_REFS (FWD_REFS * BWD_REFS + TOTAL_UNIDIR_COMP_REFS)
@ -596,14 +588,18 @@ typedef enum ATTRIBUTE_PACKED {
// possible to have a reference pair not listed for explicit signaling.
#define MODE_CTX_REF_FRAMES (REF_FRAMES + TOTAL_COMP_REFS)
typedef enum ATTRIBUTE_PACKED {
// Note: It includes single and compound references. So, it can take values from
// NONE_FRAME to (MODE_CTX_REF_FRAMES - 1). Hence, it is not defined as an enum.
typedef int8_t MV_REFERENCE_FRAME;
enum {
RESTORE_NONE,
RESTORE_WIENER,
RESTORE_SGRPROJ,
RESTORE_SWITCHABLE,
RESTORE_SWITCHABLE_TYPES = RESTORE_SWITCHABLE,
RESTORE_TYPES = 4,
} RestorationType;
} UENUM1BYTE(RestorationType);
#define SUPERRES_SCALE_BITS 3
#define SUPERRES_SCALE_DENOMINATOR_MIN (SCALE_NUMERATOR + 1)

View file

@ -37,12 +37,16 @@ typedef enum ATTRIBUTE_PACKED {
EXTRA_FILTERS = INTERP_FILTERS_ALL - SWITCHABLE_FILTERS,
} InterpFilter;
// With CONFIG_DUAL_FILTER, pack two InterpFilter's into a uint32_t: since
// there are at most 10 filters, we can use 16 bits for each and have more than
// enough space. This reduces argument passing and unifies the operation of
// setting a (pair of) filters.
//
// Without CONFIG_DUAL_FILTER,
enum {
USE_2_TAPS_ORIG = 0, // This is used in temporal filtering.
USE_2_TAPS,
USE_4_TAPS,
USE_8_TAPS,
} UENUM1BYTE(SUBPEL_SEARCH_TYPE);
// Pack two InterpFilter's into a uint32_t: since there are at most 10 filters,
// we can use 16 bits for each and have more than enough space. This reduces
// argument passing and unifies the operation of setting a (pair of) filters.
typedef uint32_t InterpFilters;
static INLINE InterpFilter av1_extract_interp_filter(InterpFilters filters,
int x_filter) {
@ -192,14 +196,19 @@ av1_get_interp_filter_params_with_block_size(const InterpFilter interp_filter,
return &av1_interp_filter_params_list[interp_filter];
}
static INLINE const InterpFilterParams *av1_get_4tap_interp_filter_params(
static INLINE const InterpFilterParams *get_4tap_interp_filter_params(
const InterpFilter interp_filter) {
return &av1_interp_4tap[interp_filter];
}
static INLINE const int16_t *av1_get_interp_filter_kernel(
const InterpFilter interp_filter) {
return av1_interp_filter_params_list[interp_filter].filter_ptr;
const InterpFilter interp_filter, int subpel_search) {
assert(subpel_search >= USE_2_TAPS);
return (subpel_search == USE_2_TAPS)
? av1_interp_4tap[BILINEAR].filter_ptr
: ((subpel_search == USE_4_TAPS)
? av1_interp_4tap[interp_filter].filter_ptr
: av1_interp_filter_params_list[interp_filter].filter_ptr);
}
static INLINE const int16_t *av1_get_interp_filter_subpel_kernel(
@ -207,6 +216,17 @@ static INLINE const int16_t *av1_get_interp_filter_subpel_kernel(
return filter_params->filter_ptr + filter_params->taps * subpel;
}
static INLINE const InterpFilterParams *av1_get_filter(int subpel_search) {
assert(subpel_search >= USE_2_TAPS);
switch (subpel_search) {
case USE_2_TAPS: return get_4tap_interp_filter_params(BILINEAR);
case USE_4_TAPS: return get_4tap_interp_filter_params(EIGHTTAP_REGULAR);
case USE_8_TAPS: return &av1_interp_filter_params_list[EIGHTTAP_REGULAR];
default: assert(0); return NULL;
}
}
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -22,7 +22,11 @@ int av1_alloc_internal_frame_buffers(InternalFrameBufferList *list) {
AOM_MAXIMUM_REF_BUFFERS + AOM_MAXIMUM_WORK_BUFFERS;
list->int_fb = (InternalFrameBuffer *)aom_calloc(
list->num_internal_frame_buffers, sizeof(*list->int_fb));
return (list->int_fb == NULL);
if (list->int_fb == NULL) {
list->num_internal_frame_buffers = 0;
return 1;
}
return 0;
}
void av1_free_internal_frame_buffers(InternalFrameBufferList *list) {
@ -36,6 +40,7 @@ void av1_free_internal_frame_buffers(InternalFrameBufferList *list) {
}
aom_free(list->int_fb);
list->int_fb = NULL;
list->num_internal_frame_buffers = 0;
}
void av1_zero_unused_internal_frame_buffers(InternalFrameBufferList *list) {
@ -69,7 +74,10 @@ int av1_get_frame_buffer(void *cb_priv, size_t min_size,
// due to access uninitialized memory in frame border. It could be
// skipped if border were totally removed.
int_fb_list->int_fb[i].data = (uint8_t *)aom_calloc(1, min_size);
if (!int_fb_list->int_fb[i].data) return -1;
if (!int_fb_list->int_fb[i].data) {
int_fb_list->int_fb[i].size = 0;
return -1;
}
int_fb_list->int_fb[i].size = min_size;
}
@ -86,6 +94,5 @@ int av1_release_frame_buffer(void *cb_priv, aom_codec_frame_buffer_t *fb) {
InternalFrameBuffer *const int_fb = (InternalFrameBuffer *)fb->priv;
(void)cb_priv;
if (int_fb) int_fb->in_use = 0;
fb->priv = NULL;
return 0;
}

View file

@ -56,87 +56,87 @@ void av1_highbd_inv_txfm_add_4x4_c(const tran_low_t *input, uint8_t *dest,
av1_inv_txfm2d_add_4x4_c(src, CONVERT_TO_SHORTPTR(dest), stride, tx_type, bd);
}
void av1_highbd_inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_4x8_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
assert(av1_ext_tx_used[txfm_param->tx_set_type][txfm_param->tx_type]);
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_4x8_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_8x4_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
assert(av1_ext_tx_used[txfm_param->tx_set_type][txfm_param->tx_type]);
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_8x4_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_16x32(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_16x32_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_16x32_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_32x16(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_32x16_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_32x16_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_16x4(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_16x4_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_16x4_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_4x16(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_4x16_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_4x16_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_32x8(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_32x8_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_32x8_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_8x32(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_8x32_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_8x32_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_32x64(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_32x64_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_32x64_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_64x32(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_64x32_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_64x32_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_16x64(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_16x64_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_16x64_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
}
void av1_highbd_inv_txfm_add_64x16(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
void av1_highbd_inv_txfm_add_64x16_c(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *txfm_param) {
const int32_t *src = cast_to_int32(input);
av1_inv_txfm2d_add_64x16_c(src, CONVERT_TO_SHORTPTR(dest), stride,
txfm_param->tx_type, txfm_param->bd);
@ -204,7 +204,7 @@ static void init_txfm_param(const MACROBLOCKD *xd, int plane, TX_SIZE tx_size,
txfm_param->eob = eob;
txfm_param->lossless = xd->lossless[xd->mi[0]->segment_id];
txfm_param->bd = xd->bd;
txfm_param->is_hbd = get_bitdepth_data_path_index(xd);
txfm_param->is_hbd = is_cur_buf_hbd(xd);
txfm_param->tx_set_type = av1_get_ext_tx_set_type(
txfm_param->tx_size, is_inter_block(xd->mi[0]), reduced_tx_set);
}
@ -224,10 +224,10 @@ void av1_highbd_inv_txfm_add_c(const tran_low_t *input, uint8_t *dest,
av1_highbd_inv_txfm_add_8x8_c(input, dest, stride, txfm_param);
break;
case TX_4X8:
av1_highbd_inv_txfm_add_4x8(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_4x8_c(input, dest, stride, txfm_param);
break;
case TX_8X4:
av1_highbd_inv_txfm_add_8x4(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_8x4_c(input, dest, stride, txfm_param);
break;
case TX_8X16:
av1_highbd_inv_txfm_add_8x16_c(input, dest, stride, txfm_param);
@ -236,25 +236,25 @@ void av1_highbd_inv_txfm_add_c(const tran_low_t *input, uint8_t *dest,
av1_highbd_inv_txfm_add_16x8_c(input, dest, stride, txfm_param);
break;
case TX_16X32:
av1_highbd_inv_txfm_add_16x32(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_16x32_c(input, dest, stride, txfm_param);
break;
case TX_32X16:
av1_highbd_inv_txfm_add_32x16(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_32x16_c(input, dest, stride, txfm_param);
break;
case TX_64X64:
av1_highbd_inv_txfm_add_64x64_c(input, dest, stride, txfm_param);
break;
case TX_32X64:
av1_highbd_inv_txfm_add_32x64(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_32x64_c(input, dest, stride, txfm_param);
break;
case TX_64X32:
av1_highbd_inv_txfm_add_64x32(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_64x32_c(input, dest, stride, txfm_param);
break;
case TX_16X64:
av1_highbd_inv_txfm_add_16x64(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_16x64_c(input, dest, stride, txfm_param);
break;
case TX_64X16:
av1_highbd_inv_txfm_add_64x16(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_64x16_c(input, dest, stride, txfm_param);
break;
case TX_4X4:
// this is like av1_short_idct4x4 but has a special case around eob<=1
@ -263,16 +263,16 @@ void av1_highbd_inv_txfm_add_c(const tran_low_t *input, uint8_t *dest,
av1_highbd_inv_txfm_add_4x4_c(input, dest, stride, txfm_param);
break;
case TX_16X4:
av1_highbd_inv_txfm_add_16x4(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_16x4_c(input, dest, stride, txfm_param);
break;
case TX_4X16:
av1_highbd_inv_txfm_add_4x16(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_4x16_c(input, dest, stride, txfm_param);
break;
case TX_8X32:
av1_highbd_inv_txfm_add_8x32(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_8x32_c(input, dest, stride, txfm_param);
break;
case TX_32X8:
av1_highbd_inv_txfm_add_32x8(input, dest, stride, txfm_param);
av1_highbd_inv_txfm_add_32x8_c(input, dest, stride, txfm_param);
break;
default: assert(0 && "Invalid transform size"); break;
}

View file

@ -44,22 +44,6 @@ static INLINE const int32_t *cast_to_int32(const tran_low_t *input) {
return (const int32_t *)input;
}
typedef void(highbd_inv_txfm_add)(const tran_low_t *input, uint8_t *dest,
int stride, const TxfmParam *param);
highbd_inv_txfm_add av1_highbd_inv_txfm_add_4x8;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_8x4;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_16x32;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_32x16;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_32x64;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_64x32;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_16x64;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_64x16;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_16x4;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_4x16;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_8x32;
highbd_inv_txfm_add av1_highbd_inv_txfm_add_32x8;
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -56,13 +56,13 @@ typedef struct mv32 {
#define WARPEDDIFF_PREC_BITS (WARPEDMODEL_PREC_BITS - WARPEDPIXEL_PREC_BITS)
/* clang-format off */
typedef enum ATTRIBUTE_PACKED {
enum {
IDENTITY = 0, // identity transformation, 0-parameter
TRANSLATION = 1, // translational motion 2-parameter
ROTZOOM = 2, // simplified affine with rotation + zoom only, 4-parameter
AFFINE = 3, // affine, 6-parameter
TRANS_TYPES,
} TransformationType;
} UENUM1BYTE(TransformationType);
/* clang-format on */
// Number of types used for global motion (must be >= 3 and <= TRANS_TYPES)
@ -87,18 +87,18 @@ static const int trans_model_params[TRANS_TYPES] = { 0, 2, 4, 6 };
// z . y' = m4 m5 m1 * y
// 1] m6 m7 1) 1]
typedef struct {
TransformationType wmtype;
int32_t wmmat[8];
int16_t alpha, beta, gamma, delta;
TransformationType wmtype;
int8_t invalid;
} WarpedMotionParams;
/* clang-format off */
static const WarpedMotionParams default_warp_params = {
IDENTITY,
{ 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0,
0 },
0, 0, 0, 0,
IDENTITY,
0,
};
/* clang-format on */
@ -263,7 +263,7 @@ static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm,
return res;
}
static INLINE TransformationType get_gmtype(const WarpedMotionParams *gm) {
static INLINE TransformationType get_wmtype(const WarpedMotionParams *gm) {
if (gm->wmmat[5] == (1 << WARPEDMODEL_PREC_BITS) && !gm->wmmat[4] &&
gm->wmmat[2] == (1 << WARPEDMODEL_PREC_BITS) && !gm->wmmat[3]) {
return ((!gm->wmmat[1] && !gm->wmmat[0]) ? IDENTITY : TRANSLATION);

View file

@ -346,10 +346,11 @@ static int add_tpl_ref_mv(const AV1_COMMON *cm, const MACROBLOCKD *xd,
av1_set_ref_frame(rf, ref_frame);
if (rf[1] == NONE_FRAME) {
int cur_frame_index = cm->cur_frame->cur_frame_offset;
int buf_idx_0 = cm->frame_refs[FWD_RF_OFFSET(rf[0])].idx;
int frame0_index = cm->buffer_pool->frame_bufs[buf_idx_0].cur_frame_offset;
int cur_offset_0 = get_relative_dist(cm, cur_frame_index, frame0_index);
int cur_frame_index = cm->cur_frame->order_hint;
const RefCntBuffer *const buf_0 = get_ref_frame_buf(cm, rf[0]);
int frame0_index = buf_0->order_hint;
int cur_offset_0 = get_relative_dist(&cm->seq_params.order_hint_info,
cur_frame_index, frame0_index);
CANDIDATE_MV *ref_mv_stack = ref_mv_stacks[rf[0]];
if (prev_frame_mvs->mfmv0.as_int != INVALID_MV) {
@ -380,14 +381,16 @@ static int add_tpl_ref_mv(const AV1_COMMON *cm, const MACROBLOCKD *xd,
}
} else {
// Process compound inter mode
int cur_frame_index = cm->cur_frame->cur_frame_offset;
int buf_idx_0 = cm->frame_refs[FWD_RF_OFFSET(rf[0])].idx;
int frame0_index = cm->buffer_pool->frame_bufs[buf_idx_0].cur_frame_offset;
int cur_frame_index = cm->cur_frame->order_hint;
const RefCntBuffer *const buf_0 = get_ref_frame_buf(cm, rf[0]);
int frame0_index = buf_0->order_hint;
int cur_offset_0 = get_relative_dist(cm, cur_frame_index, frame0_index);
int buf_idx_1 = cm->frame_refs[FWD_RF_OFFSET(rf[1])].idx;
int frame1_index = cm->buffer_pool->frame_bufs[buf_idx_1].cur_frame_offset;
int cur_offset_1 = get_relative_dist(cm, cur_frame_index, frame1_index);
int cur_offset_0 = get_relative_dist(&cm->seq_params.order_hint_info,
cur_frame_index, frame0_index);
const RefCntBuffer *const buf_1 = get_ref_frame_buf(cm, rf[1]);
int frame1_index = buf_1->order_hint;
int cur_offset_1 = get_relative_dist(&cm->seq_params.order_hint_info,
cur_frame_index, frame1_index);
CANDIDATE_MV *ref_mv_stack = ref_mv_stacks[ref_frame];
if (prev_frame_mvs->mfmv0.as_int != INVALID_MV) {
@ -861,26 +864,25 @@ void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
}
void av1_setup_frame_buf_refs(AV1_COMMON *cm) {
cm->cur_frame->cur_frame_offset = cm->frame_offset;
cm->cur_frame->order_hint = cm->current_frame.order_hint;
MV_REFERENCE_FRAME ref_frame;
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
const int buf_idx = cm->frame_refs[ref_frame - LAST_FRAME].idx;
if (buf_idx >= 0)
cm->cur_frame->ref_frame_offset[ref_frame - LAST_FRAME] =
cm->buffer_pool->frame_bufs[buf_idx].cur_frame_offset;
const RefCntBuffer *const buf = get_ref_frame_buf(cm, ref_frame);
if (buf != NULL)
cm->cur_frame->ref_order_hints[ref_frame - LAST_FRAME] = buf->order_hint;
}
}
void av1_setup_frame_sign_bias(AV1_COMMON *cm) {
MV_REFERENCE_FRAME ref_frame;
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
const int buf_idx = cm->frame_refs[ref_frame - LAST_FRAME].idx;
if (cm->seq_params.enable_order_hint && buf_idx != INVALID_IDX) {
const int ref_frame_offset =
cm->buffer_pool->frame_bufs[buf_idx].cur_frame_offset;
const RefCntBuffer *const buf = get_ref_frame_buf(cm, ref_frame);
if (cm->seq_params.order_hint_info.enable_order_hint && buf != NULL) {
const int ref_order_hint = buf->order_hint;
cm->ref_frame_sign_bias[ref_frame] =
(get_relative_dist(cm, ref_frame_offset, (int)cm->frame_offset) <= 0)
(get_relative_dist(&cm->seq_params.order_hint_info, ref_order_hint,
(int)cm->current_frame.order_hint) <= 0)
? 0
: 1;
} else {
@ -935,33 +937,34 @@ static int motion_field_projection(AV1_COMMON *cm,
TPL_MV_REF *tpl_mvs_base = cm->tpl_mvs;
int ref_offset[REF_FRAMES] = { 0 };
(void)dir;
const RefCntBuffer *const start_frame_buf =
get_ref_frame_buf(cm, start_frame);
if (start_frame_buf == NULL) return 0;
const int start_frame_idx = cm->frame_refs[FWD_RF_OFFSET(start_frame)].idx;
if (start_frame_idx < 0) return 0;
if (cm->buffer_pool->frame_bufs[start_frame_idx].intra_only) return 0;
if (cm->buffer_pool->frame_bufs[start_frame_idx].mi_rows != cm->mi_rows ||
cm->buffer_pool->frame_bufs[start_frame_idx].mi_cols != cm->mi_cols)
if (start_frame_buf->frame_type == KEY_FRAME ||
start_frame_buf->frame_type == INTRA_ONLY_FRAME)
return 0;
const int start_frame_offset =
cm->buffer_pool->frame_bufs[start_frame_idx].cur_frame_offset;
const unsigned int *const ref_frame_offsets =
&cm->buffer_pool->frame_bufs[start_frame_idx].ref_frame_offset[0];
const int cur_frame_offset = cm->cur_frame->cur_frame_offset;
int start_to_current_frame_offset =
get_relative_dist(cm, start_frame_offset, cur_frame_offset);
if (start_frame_buf->mi_rows != cm->mi_rows ||
start_frame_buf->mi_cols != cm->mi_cols)
return 0;
const int start_frame_order_hint = start_frame_buf->order_hint;
const unsigned int *const ref_order_hints =
&start_frame_buf->ref_order_hints[0];
const int cur_order_hint = cm->cur_frame->order_hint;
int start_to_current_frame_offset = get_relative_dist(
&cm->seq_params.order_hint_info, start_frame_order_hint, cur_order_hint);
for (MV_REFERENCE_FRAME rf = LAST_FRAME; rf <= INTER_REFS_PER_FRAME; ++rf) {
ref_offset[rf] = get_relative_dist(cm, start_frame_offset,
ref_frame_offsets[rf - LAST_FRAME]);
ref_offset[rf] = get_relative_dist(&cm->seq_params.order_hint_info,
start_frame_order_hint,
ref_order_hints[rf - LAST_FRAME]);
}
if (dir == 2) start_to_current_frame_offset = -start_to_current_frame_offset;
MV_REF *mv_ref_base = cm->buffer_pool->frame_bufs[start_frame_idx].mvs;
MV_REF *mv_ref_base = start_frame_buf->mvs;
const int mvs_rows = (cm->mi_rows + 1) >> 1;
const int mvs_cols = (cm->mi_cols + 1) >> 1;
@ -1002,8 +1005,10 @@ static int motion_field_projection(AV1_COMMON *cm,
}
void av1_setup_motion_field(AV1_COMMON *cm) {
const OrderHintInfo *const order_hint_info = &cm->seq_params.order_hint_info;
memset(cm->ref_frame_side, 0, sizeof(cm->ref_frame_side));
if (!cm->seq_params.enable_order_hint) return;
if (!order_hint_info->enable_order_hint) return;
TPL_MV_REF *tpl_mvs_base = cm->tpl_mvs;
int size = ((cm->mi_rows + MAX_MIB_SIZE) >> 1) * (cm->mi_stride >> 1);
@ -1012,23 +1017,22 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
tpl_mvs_base[idx].ref_frame_offset = 0;
}
const int cur_order_hint = cm->cur_frame->cur_frame_offset;
RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs;
const int cur_order_hint = cm->cur_frame->order_hint;
int ref_buf_idx[INTER_REFS_PER_FRAME];
const RefCntBuffer *ref_buf[INTER_REFS_PER_FRAME];
int ref_order_hint[INTER_REFS_PER_FRAME];
for (int ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
const int ref_idx = ref_frame - LAST_FRAME;
const int buf_idx = cm->frame_refs[ref_idx].idx;
const RefCntBuffer *const buf = get_ref_frame_buf(cm, ref_frame);
int order_hint = 0;
if (buf_idx >= 0) order_hint = frame_bufs[buf_idx].cur_frame_offset;
if (buf != NULL) order_hint = buf->order_hint;
ref_buf_idx[ref_idx] = buf_idx;
ref_buf[ref_idx] = buf;
ref_order_hint[ref_idx] = order_hint;
if (get_relative_dist(cm, order_hint, cur_order_hint) > 0)
if (get_relative_dist(order_hint_info, order_hint, cur_order_hint) > 0)
cm->ref_frame_side[ref_frame] = 1;
else if (order_hint == cur_order_hint)
cm->ref_frame_side[ref_frame] = -1;
@ -1036,10 +1040,10 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
int ref_stamp = MFMV_STACK_SIZE - 1;
if (ref_buf_idx[LAST_FRAME - LAST_FRAME] >= 0) {
if (ref_buf[LAST_FRAME - LAST_FRAME] != NULL) {
const int alt_of_lst_order_hint =
frame_bufs[ref_buf_idx[LAST_FRAME - LAST_FRAME]]
.ref_frame_offset[ALTREF_FRAME - LAST_FRAME];
ref_buf[LAST_FRAME - LAST_FRAME]
->ref_order_hints[ALTREF_FRAME - LAST_FRAME];
const int is_lst_overlay =
(alt_of_lst_order_hint == ref_order_hint[GOLDEN_FRAME - LAST_FRAME]);
@ -1047,23 +1051,25 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
--ref_stamp;
}
if (get_relative_dist(cm, ref_order_hint[BWDREF_FRAME - LAST_FRAME],
if (get_relative_dist(order_hint_info,
ref_order_hint[BWDREF_FRAME - LAST_FRAME],
cur_order_hint) > 0) {
if (motion_field_projection(cm, BWDREF_FRAME, 0)) --ref_stamp;
}
if (get_relative_dist(cm, ref_order_hint[ALTREF2_FRAME - LAST_FRAME],
if (get_relative_dist(order_hint_info,
ref_order_hint[ALTREF2_FRAME - LAST_FRAME],
cur_order_hint) > 0) {
if (motion_field_projection(cm, ALTREF2_FRAME, 0)) --ref_stamp;
}
if (get_relative_dist(cm, ref_order_hint[ALTREF_FRAME - LAST_FRAME],
if (get_relative_dist(order_hint_info,
ref_order_hint[ALTREF_FRAME - LAST_FRAME],
cur_order_hint) > 0 &&
ref_stamp >= 0)
if (motion_field_projection(cm, ALTREF_FRAME, 0)) --ref_stamp;
if (ref_stamp >= 0 && ref_buf_idx[LAST2_FRAME - LAST_FRAME] >= 0)
if (motion_field_projection(cm, LAST2_FRAME, 2)) --ref_stamp;
if (ref_stamp >= 0) motion_field_projection(cm, LAST2_FRAME, 2);
}
static INLINE void record_samples(MB_MODE_INFO *mbmi, int *pts, int *pts_inref,
@ -1264,36 +1270,43 @@ int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
}
void av1_setup_skip_mode_allowed(AV1_COMMON *cm) {
cm->is_skip_mode_allowed = 0;
cm->ref_frame_idx_0 = cm->ref_frame_idx_1 = INVALID_IDX;
const OrderHintInfo *const order_hint_info = &cm->seq_params.order_hint_info;
SkipModeInfo *const skip_mode_info = &cm->current_frame.skip_mode_info;
if (!cm->seq_params.enable_order_hint || frame_is_intra_only(cm) ||
cm->reference_mode == SINGLE_REFERENCE)
skip_mode_info->skip_mode_allowed = 0;
skip_mode_info->ref_frame_idx_0 = INVALID_IDX;
skip_mode_info->ref_frame_idx_1 = INVALID_IDX;
if (!order_hint_info->enable_order_hint || frame_is_intra_only(cm) ||
cm->current_frame.reference_mode == SINGLE_REFERENCE)
return;
RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs;
const int cur_frame_offset = cm->frame_offset;
int ref_frame_offset[2] = { -1, INT_MAX };
const int cur_order_hint = cm->current_frame.order_hint;
int ref_order_hints[2] = { -1, INT_MAX };
int ref_idx[2] = { INVALID_IDX, INVALID_IDX };
// Identify the nearest forward and backward references.
for (int i = 0; i < INTER_REFS_PER_FRAME; ++i) {
const int buf_idx = cm->frame_refs[i].idx;
if (buf_idx == INVALID_IDX) continue;
const RefCntBuffer *const buf = get_ref_frame_buf(cm, LAST_FRAME + i);
if (buf == NULL) continue;
const int ref_offset = frame_bufs[buf_idx].cur_frame_offset;
if (get_relative_dist(cm, ref_offset, cur_frame_offset) < 0) {
const int ref_order_hint = buf->order_hint;
if (get_relative_dist(order_hint_info, ref_order_hint, cur_order_hint) <
0) {
// Forward reference
if (ref_frame_offset[0] == -1 ||
get_relative_dist(cm, ref_offset, ref_frame_offset[0]) > 0) {
ref_frame_offset[0] = ref_offset;
if (ref_order_hints[0] == -1 ||
get_relative_dist(order_hint_info, ref_order_hint,
ref_order_hints[0]) > 0) {
ref_order_hints[0] = ref_order_hint;
ref_idx[0] = i;
}
} else if (get_relative_dist(cm, ref_offset, cur_frame_offset) > 0) {
} else if (get_relative_dist(order_hint_info, ref_order_hint,
cur_order_hint) > 0) {
// Backward reference
if (ref_frame_offset[1] == INT_MAX ||
get_relative_dist(cm, ref_offset, ref_frame_offset[1]) < 0) {
ref_frame_offset[1] = ref_offset;
if (ref_order_hints[1] == INT_MAX ||
get_relative_dist(order_hint_info, ref_order_hint,
ref_order_hints[1]) < 0) {
ref_order_hints[1] = ref_order_hint;
ref_idx[1] = i;
}
}
@ -1301,75 +1314,71 @@ void av1_setup_skip_mode_allowed(AV1_COMMON *cm) {
if (ref_idx[0] != INVALID_IDX && ref_idx[1] != INVALID_IDX) {
// == Bi-directional prediction ==
cm->is_skip_mode_allowed = 1;
cm->ref_frame_idx_0 = AOMMIN(ref_idx[0], ref_idx[1]);
cm->ref_frame_idx_1 = AOMMAX(ref_idx[0], ref_idx[1]);
skip_mode_info->skip_mode_allowed = 1;
skip_mode_info->ref_frame_idx_0 = AOMMIN(ref_idx[0], ref_idx[1]);
skip_mode_info->ref_frame_idx_1 = AOMMAX(ref_idx[0], ref_idx[1]);
} else if (ref_idx[0] != INVALID_IDX && ref_idx[1] == INVALID_IDX) {
// == Forward prediction only ==
// Identify the second nearest forward reference.
ref_frame_offset[1] = -1;
ref_order_hints[1] = -1;
for (int i = 0; i < INTER_REFS_PER_FRAME; ++i) {
const int buf_idx = cm->frame_refs[i].idx;
if (buf_idx == INVALID_IDX) continue;
const RefCntBuffer *const buf = get_ref_frame_buf(cm, LAST_FRAME + i);
if (buf == NULL) continue;
const int ref_offset = frame_bufs[buf_idx].cur_frame_offset;
if ((ref_frame_offset[0] != -1 &&
get_relative_dist(cm, ref_offset, ref_frame_offset[0]) < 0) &&
(ref_frame_offset[1] == -1 ||
get_relative_dist(cm, ref_offset, ref_frame_offset[1]) > 0)) {
const int ref_order_hint = buf->order_hint;
if ((ref_order_hints[0] != -1 &&
get_relative_dist(order_hint_info, ref_order_hint,
ref_order_hints[0]) < 0) &&
(ref_order_hints[1] == -1 ||
get_relative_dist(order_hint_info, ref_order_hint,
ref_order_hints[1]) > 0)) {
// Second closest forward reference
ref_frame_offset[1] = ref_offset;
ref_order_hints[1] = ref_order_hint;
ref_idx[1] = i;
}
}
if (ref_frame_offset[1] != -1) {
cm->is_skip_mode_allowed = 1;
cm->ref_frame_idx_0 = AOMMIN(ref_idx[0], ref_idx[1]);
cm->ref_frame_idx_1 = AOMMAX(ref_idx[0], ref_idx[1]);
if (ref_order_hints[1] != -1) {
skip_mode_info->skip_mode_allowed = 1;
skip_mode_info->ref_frame_idx_0 = AOMMIN(ref_idx[0], ref_idx[1]);
skip_mode_info->ref_frame_idx_1 = AOMMAX(ref_idx[0], ref_idx[1]);
}
}
}
typedef struct {
int map_idx; // frame map index
int buf_idx; // frame buffer index
int sort_idx; // index based on the offset to be used for sorting
int map_idx; // frame map index
RefCntBuffer *buf; // frame buffer
int sort_idx; // index based on the offset to be used for sorting
} REF_FRAME_INFO;
// Compares the sort_idx fields. If they are equal, then compares the map_idx
// fields to break the tie. This ensures a stable sort.
static int compare_ref_frame_info(const void *arg_a, const void *arg_b) {
const REF_FRAME_INFO *info_a = (REF_FRAME_INFO *)arg_a;
const REF_FRAME_INFO *info_b = (REF_FRAME_INFO *)arg_b;
if (info_a->sort_idx < info_b->sort_idx) return -1;
if (info_a->sort_idx > info_b->sort_idx) return 1;
return (info_a->map_idx < info_b->map_idx)
? -1
: ((info_a->map_idx > info_b->map_idx) ? 1 : 0);
const int sort_idx_diff = info_a->sort_idx - info_b->sort_idx;
if (sort_idx_diff != 0) return sort_idx_diff;
return info_a->map_idx - info_b->map_idx;
}
static void set_ref_frame_info(AV1_COMMON *const cm, int frame_idx,
REF_FRAME_INFO *ref_info) {
assert(frame_idx >= 0 && frame_idx < INTER_REFS_PER_FRAME);
const int buf_idx = ref_info->buf_idx;
cm->frame_refs[frame_idx].idx = buf_idx;
cm->frame_refs[frame_idx].buf = &cm->buffer_pool->frame_bufs[buf_idx].buf;
cm->frame_refs[frame_idx].map_idx = ref_info->map_idx;
cm->remapped_ref_idx[frame_idx] = ref_info->map_idx;
}
void av1_set_frame_refs(AV1_COMMON *const cm, int lst_map_idx,
int gld_map_idx) {
BufferPool *const pool = cm->buffer_pool;
RefCntBuffer *const frame_bufs = pool->frame_bufs;
int lst_frame_sort_idx = -1;
int gld_frame_sort_idx = -1;
assert(cm->seq_params.enable_order_hint);
assert(cm->seq_params.order_hint_bits_minus_1 >= 0);
const int cur_frame_offset = (int)cm->frame_offset;
const int cur_frame_sort_idx = 1 << cm->seq_params.order_hint_bits_minus_1;
assert(cm->seq_params.order_hint_info.enable_order_hint);
assert(cm->seq_params.order_hint_info.order_hint_bits_minus_1 >= 0);
const int cur_order_hint = (int)cm->current_frame.order_hint;
const int cur_frame_sort_idx =
1 << cm->seq_params.order_hint_info.order_hint_bits_minus_1;
REF_FRAME_INFO ref_frame_info[REF_FRAMES];
int ref_flag_list[INTER_REFS_PER_FRAME] = { 0, 0, 0, 0, 0, 0, 0 };
@ -1380,18 +1389,21 @@ void av1_set_frame_refs(AV1_COMMON *const cm, int lst_map_idx,
ref_frame_info[i].map_idx = map_idx;
ref_frame_info[i].sort_idx = -1;
const int buf_idx = cm->ref_frame_map[map_idx];
ref_frame_info[i].buf_idx = buf_idx;
RefCntBuffer *const buf = cm->ref_frame_map[map_idx];
ref_frame_info[i].buf = buf;
if (buf_idx < 0 || buf_idx >= FRAME_BUFFERS) continue;
// TODO(zoeliu@google.com): To verify the checking on ref_count.
if (frame_bufs[buf_idx].ref_count <= 0) continue;
if (buf == NULL) continue;
// If this assertion fails, there is a reference leak.
assert(buf->ref_count > 0);
// TODO(wtc@google.com): Remove the checking on ref_count after 2019-03-01.
if (buf->ref_count <= 0) continue;
const int offset = (int)frame_bufs[buf_idx].cur_frame_offset;
const int offset = (int)buf->order_hint;
ref_frame_info[i].sort_idx =
(offset == -1) ? -1
: cur_frame_sort_idx +
get_relative_dist(cm, offset, cur_frame_offset);
get_relative_dist(&cm->seq_params.order_hint_info,
offset, cur_order_hint);
assert(ref_frame_info[i].sort_idx >= -1);
if (map_idx == lst_map_idx) lst_frame_sort_idx = ref_frame_info[i].sort_idx;
@ -1414,8 +1426,8 @@ void av1_set_frame_refs(AV1_COMMON *const cm, int lst_map_idx,
compare_ref_frame_info);
// Identify forward and backward reference frames.
// Forward reference: offset < cur_frame_offset
// Backward reference: offset >= cur_frame_offset
// Forward reference: offset < order_hint
// Backward reference: offset >= order_hint
int fwd_start_idx = 0, fwd_end_idx = REF_FRAMES - 1;
for (int i = 0; i < REF_FRAMES; i++) {

View file

@ -34,10 +34,10 @@ typedef struct position {
// clamp_mv_ref
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
static INLINE int get_relative_dist(const AV1_COMMON *cm, int a, int b) {
if (!cm->seq_params.enable_order_hint) return 0;
static INLINE int get_relative_dist(const OrderHintInfo *oh, int a, int b) {
if (!oh->enable_order_hint) return 0;
const int bits = cm->seq_params.order_hint_bits_minus_1 + 1;
const int bits = oh->order_hint_bits_minus_1 + 1;
assert(bits >= 1);
assert(a >= 0 && a < (1 << bits));
@ -70,18 +70,6 @@ static INLINE int_mv get_sub_block_pred_mv(const MB_MODE_INFO *candidate,
return candidate->mv[which_mv];
}
// Performs mv sign inversion if indicated by the reference frame combination.
static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
const MV_REFERENCE_FRAME this_ref_frame,
const int *ref_sign_bias) {
int_mv mv = mbmi->mv[ref];
if (ref_sign_bias[mbmi->ref_frame[ref]] != ref_sign_bias[this_ref_frame]) {
mv.as_mv.row *= -1;
mv.as_mv.col *= -1;
}
return mv;
}
// Checks that the given mi_row, mi_col and search point
// are inside the borders of the tile.
static INLINE int is_inside(const TileInfo *const tile, int mi_col, int mi_row,
@ -169,14 +157,14 @@ static MV_REFERENCE_FRAME ref_frame_map[TOTAL_COMP_REFS][2] = {
// clang-format on
static INLINE void av1_set_ref_frame(MV_REFERENCE_FRAME *rf,
int8_t ref_frame_type) {
MV_REFERENCE_FRAME ref_frame_type) {
if (ref_frame_type >= REF_FRAMES) {
rf[0] = ref_frame_map[ref_frame_type - REF_FRAMES][0];
rf[1] = ref_frame_map[ref_frame_type - REF_FRAMES][1];
} else {
assert(ref_frame_type > NONE_FRAME);
rf[0] = ref_frame_type;
rf[1] = NONE_FRAME;
assert(ref_frame_type > NONE_FRAME);
}
}

View file

@ -8,6 +8,8 @@
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <assert.h>
#include "av1/common/obu_util.h"
#include "aom_dsp/bitreader_buffer.h"
@ -112,36 +114,41 @@ aom_codec_err_t aom_read_obu_header_and_size(const uint8_t *data,
ObuHeader *obu_header,
size_t *const payload_size,
size_t *const bytes_read) {
size_t length_field_size = 0, obu_size = 0;
size_t length_field_size_obu = 0;
size_t length_field_size_payload = 0;
size_t obu_size = 0;
aom_codec_err_t status;
if (is_annexb) {
// Size field comes before the OBU header, and includes the OBU header
status =
read_obu_size(data, bytes_available, &obu_size, &length_field_size);
read_obu_size(data, bytes_available, &obu_size, &length_field_size_obu);
if (status != AOM_CODEC_OK) return status;
}
struct aom_read_bit_buffer rb = { data + length_field_size,
struct aom_read_bit_buffer rb = { data + length_field_size_obu,
data + bytes_available, 0, NULL, NULL };
status = read_obu_header(&rb, is_annexb, obu_header);
if (status != AOM_CODEC_OK) return status;
if (is_annexb) {
if (!obu_header->has_size_field) {
assert(is_annexb);
// Derive the payload size from the data we've already read
if (obu_size < obu_header->size) return AOM_CODEC_CORRUPT_FRAME;
*payload_size = obu_size - obu_header->size;
} else {
// Size field comes after the OBU header, and is just the payload size
status = read_obu_size(data + obu_header->size,
bytes_available - obu_header->size, payload_size,
&length_field_size);
status = read_obu_size(
data + length_field_size_obu + obu_header->size,
bytes_available - length_field_size_obu - obu_header->size,
payload_size, &length_field_size_payload);
if (status != AOM_CODEC_OK) return status;
}
*bytes_read = length_field_size + obu_header->size;
*bytes_read =
length_field_size_obu + obu_header->size + length_field_size_payload;
return AOM_CODEC_OK;
}

View file

@ -79,14 +79,14 @@ extern "C" {
#define TXCOEFF_TIMER 0
#define TXCOEFF_COST_TIMER 0
typedef enum {
enum {
SINGLE_REFERENCE = 0,
COMPOUND_REFERENCE = 1,
REFERENCE_MODE_SELECT = 2,
REFERENCE_MODES = 3,
} REFERENCE_MODE;
} UENUM1BYTE(REFERENCE_MODE);
typedef enum {
enum {
/**
* Frame context updates are disabled
*/
@ -96,7 +96,7 @@ typedef enum {
* updates based on entropy/counts in the decoded frame
*/
REFRESH_FRAME_CONTEXT_BACKWARD,
} REFRESH_FRAME_CONTEXT_MODE;
} UENUM1BYTE(REFRESH_FRAME_CONTEXT_MODE);
#define MFMV_STACK_SIZE 3
typedef struct {
@ -109,11 +109,39 @@ typedef struct {
MV_REFERENCE_FRAME ref_frame;
} MV_REF;
typedef struct {
// FIXME(jack.haughton@argondesign.com): This enum was originally in
// encoder/ratectrl.h, and is encoder specific. When we move to C++, this
// should go back there and BufferPool should be templatized.
enum {
INTER_NORMAL = 0,
INTER_LOW = 1,
INTER_HIGH = 2,
GF_ARF_LOW = 3,
GF_ARF_STD = 4,
KF_STD = 5,
RATE_FACTOR_LEVELS = 6
} UENUM1BYTE(RATE_FACTOR_LEVEL);
typedef struct RefCntBuffer {
// For a RefCntBuffer, the following are reference-holding variables:
// - cm->ref_frame_map[]
// - cm->cur_frame
// - cm->scaled_ref_buf[] (encoder only)
// - cm->next_ref_frame_map[] (decoder only)
// - pbi->output_frame_index[] (decoder only)
// With that definition, 'ref_count' is the number of reference-holding
// variables that are currently referencing this buffer.
// For example:
// - suppose this buffer is at index 'k' in the buffer pool, and
// - Total 'n' of the variables / array elements above have value 'k' (that
// is, they are pointing to buffer at index 'k').
// Then, pool->frame_bufs[k].ref_count = n.
// TODO(david.turner@argondesign.com) Check whether this helpful comment is
// still correct after we finish restructuring
int ref_count;
unsigned int cur_frame_offset;
unsigned int ref_frame_offset[INTER_REFS_PER_FRAME];
unsigned int order_hint;
unsigned int ref_order_hints[INTER_REFS_PER_FRAME];
MV_REF *mvs;
uint8_t *seg_map;
@ -126,36 +154,29 @@ typedef struct {
int height;
WarpedMotionParams global_motion[REF_FRAMES];
int showable_frame; // frame can be used as show existing frame in future
int film_grain_params_present;
uint8_t film_grain_params_present;
aom_film_grain_t film_grain_params;
aom_codec_frame_buffer_t raw_frame_buffer;
YV12_BUFFER_CONFIG buf;
hash_table hash_table;
uint8_t intra_only;
FRAME_TYPE frame_type;
// The Following variables will only be used in frame parallel decode.
// frame_worker_owner indicates which FrameWorker owns this buffer. NULL means
// that no FrameWorker owns, or is decoding, this buffer.
AVxWorker *frame_worker_owner;
// row and col indicate which position frame has been decoded to in real
// pixel unit. They are reset to -1 when decoding begins and set to INT_MAX
// when the frame is fully decoded.
int row;
int col;
// Inter frame reference frame delta for loop filter
int8_t ref_deltas[REF_FRAMES];
// 0 = ZERO_MV, MV
int8_t mode_deltas[MAX_MODE_LF_DELTAS];
FRAME_CONTEXT frame_context;
RATE_FACTOR_LEVEL frame_rf_level;
} RefCntBuffer;
typedef struct BufferPool {
// Protect BufferPool from being accessed by several FrameWorkers at
// the same time during frame parallel decode.
// TODO(hkuang): Try to use atomic variable instead of locking the whole pool.
// TODO(wtc): Remove this. See
// https://chromium-review.googlesource.com/c/webm/libvpx/+/560630.
#if CONFIG_MULTITHREAD
pthread_mutex_t pool_mutex;
#endif
@ -172,18 +193,45 @@ typedef struct BufferPool {
InternalFrameBufferList int_frame_buffers;
} BufferPool;
typedef struct {
int base_ctx_table[2 /*row*/][2 /*col*/][3 /*sig_map*/]
[BASE_CONTEXT_POSITION_NUM + 1];
} LV_MAP_CTX_TABLE;
typedef int BASE_CTX_TABLE[2 /*col*/][3 /*sig_map*/]
[BASE_CONTEXT_POSITION_NUM + 1];
typedef struct BitstreamLevel {
uint8_t major;
uint8_t minor;
} BitstreamLevel;
typedef struct {
int cdef_pri_damping;
int cdef_sec_damping;
int nb_cdef_strengths;
int cdef_strengths[CDEF_MAX_STRENGTHS];
int cdef_uv_strengths[CDEF_MAX_STRENGTHS];
int cdef_bits;
} CdefInfo;
typedef struct {
int delta_q_present_flag;
// Resolution of delta quant
int delta_q_res;
int delta_lf_present_flag;
// Resolution of delta lf level
int delta_lf_res;
// This is a flag for number of deltas of loop filter level
// 0: use 1 delta, for y_vertical, y_horizontal, u, and v
// 1: use separate deltas for each filter level
int delta_lf_multi;
} DeltaQInfo;
typedef struct {
int enable_order_hint; // 0 - disable order hint, and related tools
int order_hint_bits_minus_1; // dist_wtd_comp, ref_frame_mvs,
// frame_sign_bias
// if 0, enable_dist_wtd_comp and
// enable_ref_frame_mvs must be set as 0.
int enable_dist_wtd_comp; // 0 - disable dist-wtd compound modes
// 1 - enable it
int enable_ref_frame_mvs; // 0 - disable ref frame mvs
// 1 - enable it
} OrderHintInfo;
// Sequence header structure.
// Note: All syntax elements of sequence_header_obu that need to be
// bit-identical across multiple sequence headers must be part of this struct,
@ -193,51 +241,44 @@ typedef struct SequenceHeader {
int num_bits_height;
int max_frame_width;
int max_frame_height;
int frame_id_numbers_present_flag;
uint8_t frame_id_numbers_present_flag;
int frame_id_length;
int delta_frame_id_length;
BLOCK_SIZE sb_size; // Size of the superblock used for this frame
int mib_size; // Size of the superblock in units of MI blocks
int mib_size_log2; // Log 2 of above.
int order_hint_bits_minus_1;
int force_screen_content_tools; // 0 - force off
// 1 - force on
// 2 - adaptive
int force_integer_mv; // 0 - Not to force. MV can be in 1/4 or 1/8
// 1 - force to integer
// 2 - adaptive
int still_picture; // Video is a single frame still picture
int reduced_still_picture_hdr; // Use reduced header for still picture
int enable_filter_intra; // enables/disables filterintra
int enable_intra_edge_filter; // enables/disables corner/edge/upsampling
int enable_interintra_compound; // enables/disables interintra_compound
int enable_masked_compound; // enables/disables masked compound
int enable_dual_filter; // 0 - disable dual interpolation filter
// 1 - enable vert/horiz filter selection
int enable_order_hint; // 0 - disable order hint, and related tools
// jnt_comp, ref_frame_mvs, frame_sign_bias
// if 0, enable_jnt_comp and
// enable_ref_frame_mvs must be set zs 0.
int enable_jnt_comp; // 0 - disable joint compound modes
// 1 - enable it
int enable_ref_frame_mvs; // 0 - disable ref frame mvs
// 1 - enable it
int enable_warped_motion; // 0 - disable warped motion for sequence
// 1 - enable it for the sequence
int enable_superres; // 0 - Disable superres for the sequence, and disable
// transmitting per-frame superres enabled flag.
// 1 - Enable superres for the sequence, and also
// enable per-frame flag to denote if superres is
// enabled for that frame.
int enable_cdef; // To turn on/off CDEF
int enable_restoration; // To turn on/off loop restoration
OrderHintInfo order_hint_info;
uint8_t force_screen_content_tools; // 0 - force off
// 1 - force on
// 2 - adaptive
uint8_t still_picture; // Video is a single frame still picture
uint8_t reduced_still_picture_hdr; // Use reduced header for still picture
uint8_t force_integer_mv; // 0 - Don't force. MV can use subpel
// 1 - force to integer
// 2 - adaptive
uint8_t enable_filter_intra; // enables/disables filterintra
uint8_t enable_intra_edge_filter; // enables/disables edge upsampling
uint8_t enable_interintra_compound; // enables/disables interintra_compound
uint8_t enable_masked_compound; // enables/disables masked compound
uint8_t enable_dual_filter; // 0 - disable dual interpolation filter
// 1 - enable vert/horz filter selection
uint8_t enable_warped_motion; // 0 - disable warp for the sequence
// 1 - enable warp for the sequence
uint8_t enable_superres; // 0 - Disable superres for the sequence
// and no frame level superres flag
// 1 - Enable superres for the sequence
// enable per-frame superres flag
uint8_t enable_cdef; // To turn on/off CDEF
uint8_t enable_restoration; // To turn on/off loop restoration
BITSTREAM_PROFILE profile;
// Operating point info.
int operating_points_cnt_minus_1;
int operating_point_idc[MAX_NUM_OPERATING_POINTS];
int display_model_info_present_flag;
int decoder_model_info_present_flag;
uint8_t display_model_info_present_flag;
uint8_t decoder_model_info_present_flag;
BitstreamLevel level[MAX_NUM_OPERATING_POINTS];
uint8_t tier[MAX_NUM_OPERATING_POINTS]; // seq_tier in the spec. One bit: 0
// or 1.
@ -245,8 +286,8 @@ typedef struct SequenceHeader {
// Color config.
aom_bit_depth_t bit_depth; // AOM_BITS_8 in profile 0 or 1,
// AOM_BITS_10 or AOM_BITS_12 in profile 2 or 3.
int use_highbitdepth; // If true, we need to use 16bit frame buffers.
int monochrome; // Monochorme video
uint8_t use_highbitdepth; // If true, we need to use 16bit frame buffers.
uint8_t monochrome; // Monochorme video
aom_color_primaries_t color_primaries;
aom_transfer_characteristics_t transfer_characteristics;
aom_matrix_coefficients_t matrix_coefficients;
@ -254,19 +295,34 @@ typedef struct SequenceHeader {
int subsampling_x; // Chroma subsampling for x
int subsampling_y; // Chroma subsampling for y
aom_chroma_sample_position_t chroma_sample_position;
int separate_uv_delta_q;
int film_grain_params_present;
uint8_t separate_uv_delta_q;
uint8_t film_grain_params_present;
} SequenceHeader;
typedef struct {
int skip_mode_allowed;
int skip_mode_flag;
int ref_frame_idx_0;
int ref_frame_idx_1;
} SkipModeInfo;
typedef struct {
FRAME_TYPE frame_type;
REFERENCE_MODE reference_mode;
unsigned int order_hint;
unsigned int frame_number;
SkipModeInfo skip_mode_info;
int refresh_frame_flags; // Which ref frames are overwritten by this frame
} CurrentFrame;
typedef struct AV1Common {
CurrentFrame current_frame;
struct aom_internal_error_info error;
int width;
int height;
int render_width;
int render_height;
int last_width;
int last_height;
int timing_info_present;
aom_timing_info_t timing_info;
int buffer_removal_time_present;
@ -275,56 +331,59 @@ typedef struct AV1Common {
aom_op_timing_info_t op_frame_timing[MAX_NUM_OPERATING_POINTS + 1];
uint32_t frame_presentation_time;
int largest_tile_id;
size_t largest_tile_size;
int context_update_tile_id;
// Scale of the current frame with respect to itself.
struct scale_factors sf_identity;
YV12_BUFFER_CONFIG *frame_to_show;
RefCntBuffer *prev_frame;
// TODO(hkuang): Combine this with cur_buf in macroblockd.
RefCntBuffer *cur_frame;
int ref_frame_map[REF_FRAMES]; /* maps fb_idx to reference slot */
// For encoder, we have a two-level mapping from reference frame type to the
// corresponding buffer in the buffer pool:
// * 'remapped_ref_idx[i - 1]' maps reference type ‘i’ (range: LAST_FRAME ...
// EXTREF_FRAME) to a remapped index ‘j’ (in range: 0 ... REF_FRAMES - 1)
// * Later, 'cm->ref_frame_map[j]' maps the remapped index ‘j’ to a pointer to
// the reference counted buffer structure RefCntBuffer, taken from the buffer
// pool cm->buffer_pool->frame_bufs.
//
// LAST_FRAME, ..., EXTREF_FRAME
// | |
// v v
// remapped_ref_idx[LAST_FRAME - 1], ..., remapped_ref_idx[EXTREF_FRAME - 1]
// | |
// v v
// ref_frame_map[], ..., ref_frame_map[]
//
// Note: INTRA_FRAME always refers to the current frame, so there's no need to
// have a remapped index for the same.
int remapped_ref_idx[REF_FRAMES];
struct scale_factors ref_scale_factors[REF_FRAMES];
// For decoder, ref_frame_map[i] maps reference type 'i' to a pointer to
// the buffer in the buffer pool ‘cm->buffer_pool.frame_bufs’.
// For encoder, ref_frame_map[j] (where j = remapped_ref_idx[i]) maps
// remapped reference index 'j' (that is, original reference type 'i') to
// a pointer to the buffer in the buffer pool ‘cm->buffer_pool.frame_bufs’.
RefCntBuffer *ref_frame_map[REF_FRAMES];
// Prepare ref_frame_map for the next frame.
// Only used in frame parallel decode.
int next_ref_frame_map[REF_FRAMES];
// TODO(jkoleszar): could expand active_ref_idx to 4, with 0 as intra, and
// roll new_fb_idx into it.
// Each Inter frame can reference INTER_REFS_PER_FRAME buffers
RefBuffer frame_refs[INTER_REFS_PER_FRAME];
int is_skip_mode_allowed;
int skip_mode_flag;
int ref_frame_idx_0;
int ref_frame_idx_1;
int new_fb_idx;
RefCntBuffer *next_ref_frame_map[REF_FRAMES];
FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/
FRAME_TYPE frame_type;
int show_frame;
int showable_frame; // frame can be used as show existing frame in future
int last_show_frame;
int show_existing_frame;
// Flag for a frame used as a reference - not written to the bitstream
int is_reference_frame;
int reset_decoder_state;
// Flag signaling that the frame is encoded using only INTRA modes.
uint8_t intra_only;
uint8_t last_intra_only;
uint8_t disable_cdf_update;
int allow_high_precision_mv;
int cur_frame_force_integer_mv; // 0 the default in AOM, 1 only integer
uint8_t cur_frame_force_integer_mv; // 0 the default in AOM, 1 only integer
int allow_screen_content_tools;
uint8_t allow_screen_content_tools;
int allow_intrabc;
int allow_warped_motion;
@ -349,7 +408,7 @@ typedef struct AV1Common {
int u_ac_delta_q;
int v_ac_delta_q;
// The dequantizers below are true dequntizers used only in the
// The dequantizers below are true dequantizers used only in the
// dequantization process. They have the same coefficient
// shift/scale as TX.
int16_t y_dequant_QTX[MAX_SEGMENTS][2];
@ -372,6 +431,7 @@ typedef struct AV1Common {
int qm_v;
int min_qmlevel;
int max_qmlevel;
int use_quant_b_adapt;
/* We allocate a MB_MODE_INFO struct for each macroblock, together with
an extra row on top and column on the left to simplify prediction. */
@ -400,8 +460,6 @@ typedef struct AV1Common {
int allow_ref_frame_mvs;
uint8_t *last_frame_seg_map;
uint8_t *current_frame_seg_map;
int seg_map_alloc_size;
InterpFilter interp_filter;
@ -414,10 +472,6 @@ typedef struct AV1Common {
int superres_upscaled_height;
RestorationInfo rst_info[MAX_MB_PLANE];
// rst_end_stripe[i] is one more than the index of the bottom stripe
// for tile row i.
int rst_end_stripe[MAX_TILE_ROWS];
// Pointer to a scratch buffer used by self-guided restoration
int32_t *rst_tmpbuf;
RestorationLineBuffers *rlbs;
@ -441,25 +495,14 @@ typedef struct AV1Common {
// Context probabilities for reference frame prediction
MV_REFERENCE_FRAME comp_fwd_ref[FWD_REFS];
MV_REFERENCE_FRAME comp_bwd_ref[BWD_REFS];
REFERENCE_MODE reference_mode;
FRAME_CONTEXT *fc; /* this frame entropy */
FRAME_CONTEXT *frame_contexts; // FRAME_CONTEXTS
unsigned int frame_context_idx; /* Context to use/update */
int fb_of_context_type[REF_FRAMES];
FRAME_CONTEXT *default_frame_context;
int primary_ref_frame;
unsigned int frame_offset;
unsigned int current_video_frame;
aom_bit_depth_t dequant_bit_depth; // bit_depth of current dequantizer
int error_resilient_mode;
int force_primary_ref_none;
int tile_cols, tile_rows;
int last_tile_cols, last_tile_rows;
int max_tile_width_sb;
int min_log2_tile_cols;
@ -482,14 +525,6 @@ typedef struct AV1Common {
int skip_loop_filter;
int skip_film_grain;
// Private data associated with the frame buffer callbacks.
void *cb_priv;
aom_get_frame_buffer_cb_fn_t get_fb_cb;
aom_release_frame_buffer_cb_fn_t release_fb_cb;
// Handles memory for the codec.
InternalFrameBufferList int_frame_buffers;
// External BufferPool passed from outside.
BufferPool *buffer_pool;
@ -499,30 +534,14 @@ typedef struct AV1Common {
WarpedMotionParams global_motion[REF_FRAMES];
aom_film_grain_t film_grain_params;
int cdef_pri_damping;
int cdef_sec_damping;
int nb_cdef_strengths;
int cdef_strengths[CDEF_MAX_STRENGTHS];
int cdef_uv_strengths[CDEF_MAX_STRENGTHS];
int cdef_bits;
CdefInfo cdef_info;
DeltaQInfo delta_q_info; // Delta Q and Delta LF parameters
int delta_q_present_flag;
// Resolution of delta quant
int delta_q_res;
int delta_lf_present_flag;
// Resolution of delta lf level
int delta_lf_res;
// This is a flag for number of deltas of loop filter level
// 0: use 1 delta, for y_vertical, y_horizontal, u, and v
// 1: use separate deltas for each filter level
int delta_lf_multi;
int num_tg;
SequenceHeader seq_params;
int current_frame_id;
int ref_frame_id[REF_FRAMES];
int valid_for_referencing[REF_FRAMES];
int invalid_delta_frame_id_minus_1;
LV_MAP_CTX_TABLE coeff_ctx_table;
TPL_MV_REF *tpl_mvs;
int tpl_mvs_mem_size;
// TODO(jingning): This can be combined with sign_bias later.
@ -530,7 +549,6 @@ typedef struct AV1Common {
int is_annexb;
int frame_refs_short_signaling;
int temporal_layer_id;
int spatial_layer_id;
unsigned int number_temporal_layers;
@ -551,6 +569,7 @@ typedef struct AV1Common {
int64_t txcoeff_cost_count;
#endif
const cfg_options_t *options;
int is_decoding;
} AV1_COMMON;
// TODO(hkuang): Don't need to lock the whole pool after implementing atomic
@ -573,14 +592,8 @@ static void unlock_buffer_pool(BufferPool *const pool) {
static INLINE YV12_BUFFER_CONFIG *get_ref_frame(AV1_COMMON *cm, int index) {
if (index < 0 || index >= REF_FRAMES) return NULL;
if (cm->ref_frame_map[index] < 0) return NULL;
assert(cm->ref_frame_map[index] < FRAME_BUFFERS);
return &cm->buffer_pool->frame_bufs[cm->ref_frame_map[index]].buf;
}
static INLINE YV12_BUFFER_CONFIG *get_frame_new_buffer(
const AV1_COMMON *const cm) {
return &cm->buffer_pool->frame_bufs[cm->new_fb_idx].buf;
if (cm->ref_frame_map[index] == NULL) return NULL;
return &cm->ref_frame_map[index]->buf;
}
static INLINE int get_free_fb(AV1_COMMON *cm) {
@ -605,6 +618,9 @@ static INLINE int get_free_fb(AV1_COMMON *cm) {
frame_bufs[i].ref_count = 1;
} else {
// We should never run out of free buffers. If this assertion fails, there
// is a reference leak.
assert(0 && "Ran out of free frame buffers. Likely a reference leak.");
// Reset i to be INVALID_IDX to indicate no free buffer found.
i = INVALID_IDX;
}
@ -613,39 +629,90 @@ static INLINE int get_free_fb(AV1_COMMON *cm) {
return i;
}
static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) {
const int ref_index = *idx;
static INLINE RefCntBuffer *assign_cur_frame_new_fb(AV1_COMMON *const cm) {
// Release the previously-used frame-buffer
if (cm->cur_frame != NULL) {
--cm->cur_frame->ref_count;
cm->cur_frame = NULL;
}
if (ref_index >= 0 && bufs[ref_index].ref_count > 0)
bufs[ref_index].ref_count--;
// Assign a new framebuffer
const int new_fb_idx = get_free_fb(cm);
if (new_fb_idx == INVALID_IDX) return NULL;
*idx = new_idx;
cm->cur_frame = &cm->buffer_pool->frame_bufs[new_fb_idx];
cm->cur_frame->buf.buf_8bit_valid = 0;
return cm->cur_frame;
}
bufs[new_idx].ref_count++;
// Modify 'lhs_ptr' to reference the buffer at 'rhs_ptr', and update the ref
// counts accordingly.
static INLINE void assign_frame_buffer_p(RefCntBuffer **lhs_ptr,
RefCntBuffer *rhs_ptr) {
RefCntBuffer *const old_ptr = *lhs_ptr;
if (old_ptr != NULL) {
assert(old_ptr->ref_count > 0);
// One less reference to the buffer at 'old_ptr', so decrease ref count.
--old_ptr->ref_count;
}
*lhs_ptr = rhs_ptr;
// One more reference to the buffer at 'rhs_ptr', so increase ref count.
++rhs_ptr->ref_count;
}
static INLINE int frame_is_intra_only(const AV1_COMMON *const cm) {
return cm->frame_type == KEY_FRAME || cm->intra_only;
return cm->current_frame.frame_type == KEY_FRAME ||
cm->current_frame.frame_type == INTRA_ONLY_FRAME;
}
static INLINE int frame_is_sframe(const AV1_COMMON *cm) {
return cm->frame_type == S_FRAME;
return cm->current_frame.frame_type == S_FRAME;
}
static INLINE RefCntBuffer *get_prev_frame(const AV1_COMMON *const cm) {
if (cm->primary_ref_frame == PRIMARY_REF_NONE ||
cm->frame_refs[cm->primary_ref_frame].idx == INVALID_IDX) {
return NULL;
} else {
return &cm->buffer_pool
->frame_bufs[cm->frame_refs[cm->primary_ref_frame].idx];
}
// These functions take a reference frame label between LAST_FRAME and
// EXTREF_FRAME inclusive. Note that this is different to the indexing
// previously used by the frame_refs[] array.
static INLINE int get_ref_frame_map_idx(const AV1_COMMON *const cm,
const MV_REFERENCE_FRAME ref_frame) {
return (ref_frame >= LAST_FRAME && ref_frame <= EXTREF_FRAME)
? cm->remapped_ref_idx[ref_frame - LAST_FRAME]
: INVALID_IDX;
}
static INLINE RefCntBuffer *get_ref_frame_buf(
const AV1_COMMON *const cm, const MV_REFERENCE_FRAME ref_frame) {
const int map_idx = get_ref_frame_map_idx(cm, ref_frame);
return (map_idx != INVALID_IDX) ? cm->ref_frame_map[map_idx] : NULL;
}
// Both const and non-const versions of this function are provided so that it
// can be used with a const AV1_COMMON if needed.
static INLINE const struct scale_factors *get_ref_scale_factors_const(
const AV1_COMMON *const cm, const MV_REFERENCE_FRAME ref_frame) {
const int map_idx = get_ref_frame_map_idx(cm, ref_frame);
return (map_idx != INVALID_IDX) ? &cm->ref_scale_factors[map_idx] : NULL;
}
static INLINE struct scale_factors *get_ref_scale_factors(
AV1_COMMON *const cm, const MV_REFERENCE_FRAME ref_frame) {
const int map_idx = get_ref_frame_map_idx(cm, ref_frame);
return (map_idx != INVALID_IDX) ? &cm->ref_scale_factors[map_idx] : NULL;
}
static INLINE RefCntBuffer *get_primary_ref_frame_buf(
const AV1_COMMON *const cm) {
if (cm->primary_ref_frame == PRIMARY_REF_NONE) return NULL;
const int map_idx = get_ref_frame_map_idx(cm, cm->primary_ref_frame + 1);
return (map_idx != INVALID_IDX) ? cm->ref_frame_map[map_idx] : NULL;
}
// Returns 1 if this frame might allow mvs from some reference frame.
static INLINE int frame_might_allow_ref_frame_mvs(const AV1_COMMON *cm) {
return !cm->error_resilient_mode && cm->seq_params.enable_ref_frame_mvs &&
cm->seq_params.enable_order_hint && !frame_is_intra_only(cm);
return !cm->error_resilient_mode &&
cm->seq_params.order_hint_info.enable_ref_frame_mvs &&
cm->seq_params.order_hint_info.enable_order_hint &&
!frame_is_intra_only(cm);
}
// Returns 1 if this frame might use warped_motion
@ -1193,8 +1260,8 @@ static INLINE TX_SIZE get_tx_size(int width, int height) {
return TX_4X4;
}
static INLINE int txfm_partition_context(TXFM_CONTEXT *above_ctx,
TXFM_CONTEXT *left_ctx,
static INLINE int txfm_partition_context(const TXFM_CONTEXT *const above_ctx,
const TXFM_CONTEXT *const left_ctx,
BLOCK_SIZE bsize, TX_SIZE tx_size) {
const uint8_t txw = tx_size_wide[tx_size];
const uint8_t txh = tx_size_high[tx_size];
@ -1292,10 +1359,6 @@ static INLINE PARTITION_TYPE get_partition(const AV1_COMMON *const cm,
return base_partitions[split_idx];
}
static INLINE void set_use_reference_buffer(AV1_COMMON *const cm, int use) {
cm->seq_params.frame_id_numbers_present_flag = use;
}
static INLINE void set_sb_size(SequenceHeader *const seq_params,
BLOCK_SIZE sb_size) {
seq_params->sb_size = sb_size;

View file

@ -130,21 +130,21 @@ cfl_subtract_average_fn get_subtract_average_fn_vsx(TX_SIZE tx_size) {
subtract_average_8x8_vsx, /* 8x8 */
subtract_average_16x16_vsx, /* 16x16 */
subtract_average_32x32_vsx, /* 32x32 */
cfl_subtract_average_null, /* 64x64 (invalid CFL size) */
NULL, /* 64x64 (invalid CFL size) */
subtract_average_4x8_c, /* 4x8 */
subtract_average_8x4_vsx, /* 8x4 */
subtract_average_8x16_vsx, /* 8x16 */
subtract_average_16x8_vsx, /* 16x8 */
subtract_average_16x32_vsx, /* 16x32 */
subtract_average_32x16_vsx, /* 32x16 */
cfl_subtract_average_null, /* 32x64 (invalid CFL size) */
cfl_subtract_average_null, /* 64x32 (invalid CFL size) */
NULL, /* 32x64 (invalid CFL size) */
NULL, /* 64x32 (invalid CFL size) */
subtract_average_4x16_c, /* 4x16 */
subtract_average_16x4_vsx, /* 16x4 */
subtract_average_8x32_vsx, /* 8x32 */
subtract_average_32x8_vsx, /* 32x8 */
cfl_subtract_average_null, /* 16x64 (invalid CFL size) */
cfl_subtract_average_null, /* 64x16 (invalid CFL size) */
NULL, /* 16x64 (invalid CFL size) */
NULL, /* 64x16 (invalid CFL size) */
};
// Modulo TX_SIZES_ALL to ensure that an attacker won't be able to
// index the function pointer array out of bounds.

View file

@ -48,16 +48,16 @@ static INLINE int av1_get_spatial_seg_pred(const AV1_COMMON *const cm,
int prev_l = -1; // left segment_id
int prev_u = -1; // top segment_id
if ((xd->up_available) && (xd->left_available)) {
prev_ul = get_segment_id(cm, cm->current_frame_seg_map, BLOCK_4X4,
mi_row - 1, mi_col - 1);
prev_ul = get_segment_id(cm, cm->cur_frame->seg_map, BLOCK_4X4, mi_row - 1,
mi_col - 1);
}
if (xd->up_available) {
prev_u = get_segment_id(cm, cm->current_frame_seg_map, BLOCK_4X4,
mi_row - 1, mi_col - 0);
prev_u = get_segment_id(cm, cm->cur_frame->seg_map, BLOCK_4X4, mi_row - 1,
mi_col - 0);
}
if (xd->left_available) {
prev_l = get_segment_id(cm, cm->current_frame_seg_map, BLOCK_4X4,
mi_row - 0, mi_col - 1);
prev_l = get_segment_id(cm, cm->cur_frame->seg_map, BLOCK_4X4, mi_row - 0,
mi_col - 1);
}
// Pick CDF index based on number of matching/out-of-bounds segment IDs.
@ -90,18 +90,18 @@ static INLINE int av1_get_pred_context_seg_id(const MACROBLOCKD *xd) {
static INLINE int get_comp_index_context(const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
MB_MODE_INFO *mbmi = xd->mi[0];
int bck_idx = cm->frame_refs[mbmi->ref_frame[0] - LAST_FRAME].idx;
int fwd_idx = cm->frame_refs[mbmi->ref_frame[1] - LAST_FRAME].idx;
const RefCntBuffer *const bck_buf = get_ref_frame_buf(cm, mbmi->ref_frame[0]);
const RefCntBuffer *const fwd_buf = get_ref_frame_buf(cm, mbmi->ref_frame[1]);
int bck_frame_index = 0, fwd_frame_index = 0;
int cur_frame_index = cm->cur_frame->cur_frame_offset;
int cur_frame_index = cm->cur_frame->order_hint;
if (bck_idx >= 0)
bck_frame_index = cm->buffer_pool->frame_bufs[bck_idx].cur_frame_offset;
if (bck_buf != NULL) bck_frame_index = bck_buf->order_hint;
if (fwd_buf != NULL) fwd_frame_index = fwd_buf->order_hint;
if (fwd_idx >= 0)
fwd_frame_index = cm->buffer_pool->frame_bufs[fwd_idx].cur_frame_offset;
int fwd = abs(get_relative_dist(cm, fwd_frame_index, cur_frame_index));
int bck = abs(get_relative_dist(cm, cur_frame_index, bck_frame_index));
int fwd = abs(get_relative_dist(&cm->seq_params.order_hint_info,
fwd_frame_index, cur_frame_index));
int bck = abs(get_relative_dist(&cm->seq_params.order_hint_info,
cur_frame_index, bck_frame_index));
const MB_MODE_INFO *const above_mi = xd->above_mbmi;
const MB_MODE_INFO *const left_mi = xd->left_mbmi;
@ -109,14 +109,14 @@ static INLINE int get_comp_index_context(const AV1_COMMON *cm,
int above_ctx = 0, left_ctx = 0;
const int offset = (fwd == bck);
if (above_mi) {
if (above_mi != NULL) {
if (has_second_ref(above_mi))
above_ctx = above_mi->compound_idx;
else if (above_mi->ref_frame[0] == ALTREF_FRAME)
above_ctx = 1;
}
if (left_mi) {
if (left_mi != NULL) {
if (has_second_ref(left_mi))
left_ctx = left_mi->compound_idx;
else if (left_mi->ref_frame[0] == ALTREF_FRAME)

View file

@ -191,10 +191,11 @@ static const int16_t ac_qlookup_12_Q3[QINDEX_RANGE] = {
// underflow to 0 in the actual quantization routines.
int16_t av1_dc_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth) {
const int q_clamped = clamp(qindex + delta, 0, MAXQ);
switch (bit_depth) {
case AOM_BITS_8: return dc_qlookup_Q3[clamp(qindex + delta, 0, MAXQ)];
case AOM_BITS_10: return dc_qlookup_10_Q3[clamp(qindex + delta, 0, MAXQ)];
case AOM_BITS_12: return dc_qlookup_12_Q3[clamp(qindex + delta, 0, MAXQ)];
case AOM_BITS_8: return dc_qlookup_Q3[q_clamped];
case AOM_BITS_10: return dc_qlookup_10_Q3[q_clamped];
case AOM_BITS_12: return dc_qlookup_12_Q3[q_clamped];
default:
assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
return -1;
@ -202,10 +203,11 @@ int16_t av1_dc_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth) {
}
int16_t av1_ac_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth) {
const int q_clamped = clamp(qindex + delta, 0, MAXQ);
switch (bit_depth) {
case AOM_BITS_8: return ac_qlookup_Q3[clamp(qindex + delta, 0, MAXQ)];
case AOM_BITS_10: return ac_qlookup_10_Q3[clamp(qindex + delta, 0, MAXQ)];
case AOM_BITS_12: return ac_qlookup_12_Q3[clamp(qindex + delta, 0, MAXQ)];
case AOM_BITS_8: return ac_qlookup_Q3[q_clamped];
case AOM_BITS_10: return ac_qlookup_10_Q3[q_clamped];
case AOM_BITS_12: return ac_qlookup_12_Q3[q_clamped];
default:
assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
return -1;
@ -244,8 +246,10 @@ const qm_val_t *av1_qmatrix(AV1_COMMON *cm, int qmlevel, int plane,
}
#define QM_TOTAL_SIZE 3344
static const qm_val_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE];
static const qm_val_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE];
// We only use wt_matrix_ref[q] and iwt_matrix_ref[q]
// for q = 0, ..., NUM_QM_LEVELS - 2.
static const qm_val_t wt_matrix_ref[NUM_QM_LEVELS - 1][2][QM_TOTAL_SIZE];
static const qm_val_t iwt_matrix_ref[NUM_QM_LEVELS - 1][2][QM_TOTAL_SIZE];
void av1_qm_init(AV1_COMMON *cm) {
const int num_planes = av1_num_planes(cm);
@ -274,7 +278,7 @@ void av1_qm_init(AV1_COMMON *cm) {
}
}
/* Provide 16 sets of quantization matrices for chroma and luma
/* Provide 15 sets of quantization matrices for chroma and luma
and each TX size. Matrices for different TX sizes are in fact
sub-sampled from the 32x32 and 16x16 sizes, but explicitly
defined here for convenience. Intra and inter matrix sets are the
@ -283,9 +287,10 @@ void av1_qm_init(AV1_COMMON *cm) {
frame.
Matrices for different QM levels have been rescaled in the
frequency domain according to different nominal viewing
distances.
distances. Matrices for QM level 15 are omitted because they are
not used.
*/
static const qm_val_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = {
static const qm_val_t iwt_matrix_ref[NUM_QM_LEVELS - 1][2][QM_TOTAL_SIZE] = {
{
{ /* Luma */
/* Size 4x4 */
@ -6633,427 +6638,9 @@ static const qm_val_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = {
31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32,
32, 32, 32, 32 },
},
{
{ /* Luma */
/* Size 4x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 16x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32,
/* Size 32x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 4x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32,
/* Size 16x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32,
/* Size 16x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
/* Size 32x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
/* Size 4x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 16x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32,
/* Size 32x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32 },
{ /* Chroma */
/* Size 4x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 16x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32,
/* Size 32x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 4x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32,
/* Size 16x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32,
/* Size 16x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
/* Size 32x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
/* Size 4x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 16x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32,
/* Size 32x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32 },
},
};
static const qm_val_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = {
static const qm_val_t wt_matrix_ref[NUM_QM_LEVELS - 1][2][QM_TOTAL_SIZE] = {
{
{ /* Luma */
/* Size 4x4 */
@ -13255,422 +12842,4 @@ static const qm_val_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = {
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 32, 32, 32, 32, 32,
32, 32, 32, 32 },
},
{
{ /* Luma */
/* Size 4x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 16x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32,
/* Size 32x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 4x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32,
/* Size 16x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32,
/* Size 16x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
/* Size 32x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
/* Size 4x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 16x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32,
/* Size 32x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32 },
{ /* Chroma */
/* Size 4x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 16x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32,
/* Size 32x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 4x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32,
/* Size 16x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32,
/* Size 16x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
/* Size 32x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
/* Size 4x16 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 16x4 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* Size 8x32 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32,
/* Size 32x8 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32 },
},
};

View file

@ -35,10 +35,12 @@
int av1_allow_warp(const MB_MODE_INFO *const mbmi,
const WarpTypesAllowed *const warp_types,
const WarpedMotionParams *const gm_params,
int build_for_obmc, int x_scale, int y_scale,
int build_for_obmc, const struct scale_factors *const sf,
WarpedMotionParams *final_warp_params) {
if (x_scale != SCALE_SUBPEL_SHIFTS || y_scale != SCALE_SUBPEL_SHIFTS)
return 0;
// Note: As per the spec, we must test the fixed point scales here, which are
// at a higher precision (1 << 14) than the xs and ys in subpel_params (that
// have 1 << 10 precision).
if (av1_is_scaled(sf)) return 0;
if (final_warp_params != NULL) *final_warp_params = default_warp_params;
@ -75,20 +77,18 @@ void av1_make_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst,
const int do_warp =
(w >= 8 && h >= 8 &&
av1_allow_warp(mi, warp_types, &xd->global_motion[mi->ref_frame[ref]],
build_for_obmc, subpel_params->xs, subpel_params->ys,
&final_warp_params));
build_for_obmc, sf, &final_warp_params));
const int is_intrabc = mi->use_intrabc;
assert(IMPLIES(is_intrabc, !do_warp));
if (do_warp && xd->cur_frame_force_integer_mv == 0) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const struct buf_2d *const pre_buf = &pd->pre[ref];
av1_warp_plane(&final_warp_params,
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
av1_warp_plane(&final_warp_params, is_cur_buf_hbd(xd), xd->bd,
pre_buf->buf0, pre_buf->width, pre_buf->height,
pre_buf->stride, dst, p_col, p_row, w, h, dst_stride,
pd->subsampling_x, pd->subsampling_y, conv_params);
} else if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
} else if (is_cur_buf_hbd(xd)) {
highbd_inter_predictor(src, src_stride, dst, dst_stride, subpel_params, sf,
w, h, conv_params, interp_filters, is_intrabc,
xd->bd);
@ -567,14 +567,15 @@ static void build_masked_compound_no_round(
const int subh = (2 << mi_size_high_log2[sb_type]) == h;
const int subw = (2 << mi_size_wide_log2[sb_type]) == w;
const uint8_t *mask = av1_get_compound_type_mask(comp_data, sb_type);
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
if (is_cur_buf_hbd(xd)) {
aom_highbd_blend_a64_d16_mask(dst, dst_stride, src0, src0_stride, src1,
src1_stride, mask, block_size_wide[sb_type],
w, h, subw, subh, conv_params, xd->bd);
else
} else {
aom_lowbd_blend_a64_d16_mask(dst, dst_stride, src0, src0_stride, src1,
src1_stride, mask, block_size_wide[sb_type], w,
h, subw, subh, conv_params);
}
}
void av1_make_masked_inter_predictor(
@ -625,32 +626,31 @@ void av1_make_masked_inter_predictor(
mi->sb_type, h, w, conv_params, xd);
}
void av1_jnt_comp_weight_assign(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi,
int order_idx, int *fwd_offset, int *bck_offset,
int *use_jnt_comp_avg, int is_compound) {
void av1_dist_wtd_comp_weight_assign(const AV1_COMMON *cm,
const MB_MODE_INFO *mbmi, int order_idx,
int *fwd_offset, int *bck_offset,
int *use_dist_wtd_comp_avg,
int is_compound) {
assert(fwd_offset != NULL && bck_offset != NULL);
if (!is_compound || mbmi->compound_idx) {
*use_jnt_comp_avg = 0;
*use_dist_wtd_comp_avg = 0;
return;
}
*use_jnt_comp_avg = 1;
const int bck_idx = cm->frame_refs[mbmi->ref_frame[0] - LAST_FRAME].idx;
const int fwd_idx = cm->frame_refs[mbmi->ref_frame[1] - LAST_FRAME].idx;
const int cur_frame_index = cm->cur_frame->cur_frame_offset;
*use_dist_wtd_comp_avg = 1;
const RefCntBuffer *const bck_buf = get_ref_frame_buf(cm, mbmi->ref_frame[0]);
const RefCntBuffer *const fwd_buf = get_ref_frame_buf(cm, mbmi->ref_frame[1]);
const int cur_frame_index = cm->cur_frame->order_hint;
int bck_frame_index = 0, fwd_frame_index = 0;
if (bck_idx >= 0) {
bck_frame_index = cm->buffer_pool->frame_bufs[bck_idx].cur_frame_offset;
}
if (bck_buf != NULL) bck_frame_index = bck_buf->order_hint;
if (fwd_buf != NULL) fwd_frame_index = fwd_buf->order_hint;
if (fwd_idx >= 0) {
fwd_frame_index = cm->buffer_pool->frame_bufs[fwd_idx].cur_frame_offset;
}
int d0 = clamp(abs(get_relative_dist(cm, fwd_frame_index, cur_frame_index)),
int d0 = clamp(abs(get_relative_dist(&cm->seq_params.order_hint_info,
fwd_frame_index, cur_frame_index)),
0, MAX_FRAME_DISTANCE);
int d1 = clamp(abs(get_relative_dist(cm, cur_frame_index, bck_frame_index)),
int d1 = clamp(abs(get_relative_dist(&cm->seq_params.order_hint_info,
cur_frame_index, bck_frame_index)),
0, MAX_FRAME_DISTANCE);
const int order = d0 <= d1;
@ -708,10 +708,9 @@ void av1_setup_pre_planes(MACROBLOCKD *xd, int idx,
// obmc_mask_N[overlap_position]
static const uint8_t obmc_mask_1[1] = { 64 };
DECLARE_ALIGNED(2, static const uint8_t, obmc_mask_2[2]) = { 45, 64 };
static const uint8_t obmc_mask_2[2] = { 45, 64 };
static const uint8_t obmc_mask_4[4] = { 39, 50, 59, 64 };
DECLARE_ALIGNED(4, static const uint8_t, obmc_mask_4[4]) = { 39, 50, 59, 64 };
static const uint8_t obmc_mask_8[8] = { 36, 42, 48, 53, 57, 61, 64, 64 };
@ -814,7 +813,7 @@ static INLINE void build_obmc_inter_pred_above(MACROBLOCKD *xd, int rel_mi_col,
(void)above_mi;
struct obmc_inter_pred_ctxt *ctxt = (struct obmc_inter_pred_ctxt *)fun_ctxt;
const BLOCK_SIZE bsize = xd->mi[0]->sb_type;
const int is_hbd = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) ? 1 : 0;
const int is_hbd = is_cur_buf_hbd(xd);
const int overlap =
AOMMIN(block_size_high[bsize], block_size_high[BLOCK_64X64]) >> 1;
@ -851,7 +850,7 @@ static INLINE void build_obmc_inter_pred_left(MACROBLOCKD *xd, int rel_mi_row,
const BLOCK_SIZE bsize = xd->mi[0]->sb_type;
const int overlap =
AOMMIN(block_size_wide[bsize], block_size_wide[BLOCK_64X64]) >> 1;
const int is_hbd = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) ? 1 : 0;
const int is_hbd = is_cur_buf_hbd(xd);
for (int plane = 0; plane < num_planes; ++plane) {
const struct macroblockd_plane *pd = &xd->plane[plane];
@ -922,14 +921,15 @@ void av1_setup_build_prediction_by_above_pred(
for (int ref = 0; ref < num_refs; ++ref) {
const MV_REFERENCE_FRAME frame = above_mbmi->ref_frame[ref];
const RefBuffer *const ref_buf = &ctxt->cm->frame_refs[frame - LAST_FRAME];
xd->block_refs[ref] = ref_buf;
if ((!av1_is_valid_scale(&ref_buf->sf)))
const RefCntBuffer *const ref_buf = get_ref_frame_buf(ctxt->cm, frame);
const struct scale_factors *const sf =
get_ref_scale_factors_const(ctxt->cm, frame);
xd->block_ref_scale_factors[ref] = sf;
if ((!av1_is_valid_scale(sf)))
aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM,
"Reference frame has invalid dimensions");
av1_setup_pre_planes(xd, ref, ref_buf->buf, ctxt->mi_row, above_mi_col,
&ref_buf->sf, num_planes);
av1_setup_pre_planes(xd, ref, &ref_buf->buf, ctxt->mi_row, above_mi_col, sf,
num_planes);
}
xd->mb_to_left_edge = 8 * MI_SIZE * (-above_mi_col);
@ -959,14 +959,16 @@ void av1_setup_build_prediction_by_left_pred(MACROBLOCKD *xd, int rel_mi_row,
for (int ref = 0; ref < num_refs; ++ref) {
const MV_REFERENCE_FRAME frame = left_mbmi->ref_frame[ref];
const RefBuffer *const ref_buf = &ctxt->cm->frame_refs[frame - LAST_FRAME];
const RefCntBuffer *const ref_buf = get_ref_frame_buf(ctxt->cm, frame);
const struct scale_factors *const ref_scale_factors =
get_ref_scale_factors_const(ctxt->cm, frame);
xd->block_refs[ref] = ref_buf;
if ((!av1_is_valid_scale(&ref_buf->sf)))
xd->block_ref_scale_factors[ref] = ref_scale_factors;
if ((!av1_is_valid_scale(ref_scale_factors)))
aom_internal_error(xd->error_info, AOM_CODEC_UNSUP_BITSTREAM,
"Reference frame has invalid dimensions");
av1_setup_pre_planes(xd, ref, ref_buf->buf, left_mi_row, ctxt->mi_col,
&ref_buf->sf, num_planes);
av1_setup_pre_planes(xd, ref, &ref_buf->buf, left_mi_row, ctxt->mi_col,
ref_scale_factors, num_planes);
}
xd->mb_to_top_edge = 8 * MI_SIZE * (-left_mi_row);
@ -1033,12 +1035,13 @@ static void build_smooth_interintra_mask(uint8_t *mask, int stride,
}
}
static void combine_interintra(INTERINTRA_MODE mode, int use_wedge_interintra,
int wedge_index, int wedge_sign,
BLOCK_SIZE bsize, BLOCK_SIZE plane_bsize,
uint8_t *comppred, int compstride,
const uint8_t *interpred, int interstride,
const uint8_t *intrapred, int intrastride) {
static void combine_interintra(INTERINTRA_MODE mode,
int8_t use_wedge_interintra, int wedge_index,
int wedge_sign, BLOCK_SIZE bsize,
BLOCK_SIZE plane_bsize, uint8_t *comppred,
int compstride, const uint8_t *interpred,
int interstride, const uint8_t *intrapred,
int intrastride) {
const int bw = block_size_wide[plane_bsize];
const int bh = block_size_high[plane_bsize];
@ -1062,7 +1065,7 @@ static void combine_interintra(INTERINTRA_MODE mode, int use_wedge_interintra,
}
static void combine_interintra_highbd(
INTERINTRA_MODE mode, int use_wedge_interintra, int wedge_index,
INTERINTRA_MODE mode, int8_t use_wedge_interintra, int wedge_index,
int wedge_sign, BLOCK_SIZE bsize, BLOCK_SIZE plane_bsize,
uint8_t *comppred8, int compstride, const uint8_t *interpred8,
int interstride, const uint8_t *intrapred8, int intrastride, int bd) {
@ -1092,8 +1095,8 @@ static void combine_interintra_highbd(
void av1_build_intra_predictors_for_interintra(const AV1_COMMON *cm,
MACROBLOCKD *xd,
BLOCK_SIZE bsize, int plane,
BUFFER_SET *ctx, uint8_t *dst,
int dst_stride) {
const BUFFER_SET *ctx,
uint8_t *dst, int dst_stride) {
struct macroblockd_plane *const pd = &xd->plane[plane];
const int ssx = xd->plane[plane].subsampling_x;
const int ssy = xd->plane[plane].subsampling_y;
@ -1116,7 +1119,7 @@ void av1_combine_interintra(MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane,
const int ssx = xd->plane[plane].subsampling_x;
const int ssy = xd->plane[plane].subsampling_y;
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, ssx, ssy);
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
if (is_cur_buf_hbd(xd)) {
combine_interintra_highbd(
xd->mi[0]->interintra_mode, xd->mi[0]->use_wedge_interintra,
xd->mi[0]->interintra_wedge_index, xd->mi[0]->interintra_wedge_sign,
@ -1135,9 +1138,9 @@ void av1_combine_interintra(MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane,
// build interintra_predictors for one plane
void av1_build_interintra_predictors_sbp(const AV1_COMMON *cm, MACROBLOCKD *xd,
uint8_t *pred, int stride,
BUFFER_SET *ctx, int plane,
const BUFFER_SET *ctx, int plane,
BLOCK_SIZE bsize) {
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
if (is_cur_buf_hbd(xd)) {
DECLARE_ALIGNED(16, uint16_t, intrapredictor[MAX_SB_SQUARE]);
av1_build_intra_predictors_for_interintra(
cm, xd, bsize, plane, ctx, CONVERT_TO_BYTEPTR(intrapredictor),
@ -1156,7 +1159,8 @@ void av1_build_interintra_predictors_sbp(const AV1_COMMON *cm, MACROBLOCKD *xd,
void av1_build_interintra_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
uint8_t *upred, uint8_t *vpred,
int ustride, int vstride,
BUFFER_SET *ctx, BLOCK_SIZE bsize) {
const BUFFER_SET *ctx,
BLOCK_SIZE bsize) {
av1_build_interintra_predictors_sbp(cm, xd, upred, ustride, ctx, 1, bsize);
av1_build_interintra_predictors_sbp(cm, xd, vpred, vstride, ctx, 2, bsize);
}

View file

@ -47,7 +47,7 @@ extern "C" {
#define WEDGE_NONE -1
// Angles are with respect to horizontal anti-clockwise
typedef enum {
enum {
WEDGE_HORIZONTAL = 0,
WEDGE_VERTICAL = 1,
WEDGE_OBLIQUE27 = 2,
@ -55,7 +55,7 @@ typedef enum {
WEDGE_OBLIQUE117 = 4,
WEDGE_OBLIQUE153 = 5,
WEDGE_DIRECTIONS
} WedgeDirectionType;
} UENUM1BYTE(WedgeDirectionType);
// 3-tuple: {direction, x_offset, y_offset}
typedef struct {
@ -333,29 +333,32 @@ const uint8_t *av1_get_compound_type_mask(
// build interintra_predictors for one plane
void av1_build_interintra_predictors_sbp(const AV1_COMMON *cm, MACROBLOCKD *xd,
uint8_t *pred, int stride,
BUFFER_SET *ctx, int plane,
const BUFFER_SET *ctx, int plane,
BLOCK_SIZE bsize);
void av1_build_interintra_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
uint8_t *upred, uint8_t *vpred,
int ustride, int vstride,
BUFFER_SET *ctx, BLOCK_SIZE bsize);
const BUFFER_SET *ctx,
BLOCK_SIZE bsize);
void av1_build_intra_predictors_for_interintra(
const AV1_COMMON *cm, MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane,
BUFFER_SET *ctx, uint8_t *intra_pred, int intra_stride);
const BUFFER_SET *ctx, uint8_t *intra_pred, int intra_stride);
void av1_combine_interintra(MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane,
const uint8_t *inter_pred, int inter_stride,
const uint8_t *intra_pred, int intra_stride);
void av1_jnt_comp_weight_assign(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi,
int order_idx, int *fwd_offset, int *bck_offset,
int *use_jnt_comp_avg, int is_compound);
void av1_dist_wtd_comp_weight_assign(const AV1_COMMON *cm,
const MB_MODE_INFO *mbmi, int order_idx,
int *fwd_offset, int *bck_offset,
int *use_dist_wtd_comp_avg,
int is_compound);
int av1_allow_warp(const MB_MODE_INFO *const mbmi,
const WarpTypesAllowed *const warp_types,
const WarpedMotionParams *const gm_params,
int build_for_obmc, int x_scale, int y_scale,
int build_for_obmc, const struct scale_factors *const sf,
WarpedMotionParams *final_warp_params);
#ifdef __cplusplus

View file

@ -556,33 +556,37 @@ void av1_dr_prediction_z2_c(uint8_t *dst, ptrdiff_t stride, int bw, int bh,
const uint8_t *above, const uint8_t *left,
int upsample_above, int upsample_left, int dx,
int dy) {
int r, c, x, y, shift1, shift2, val, base1, base2;
assert(dx > 0);
assert(dy > 0);
const int min_base_x = -(1 << upsample_above);
const int min_base_y = -(1 << upsample_left);
(void)min_base_y;
const int frac_bits_x = 6 - upsample_above;
const int frac_bits_y = 6 - upsample_left;
const int base_inc_x = 1 << upsample_above;
x = -dx;
for (r = 0; r < bh; ++r, x -= dx, dst += stride) {
base1 = x >> frac_bits_x;
y = (r << 6) - dy;
for (c = 0; c < bw; ++c, base1 += base_inc_x, y -= dy) {
if (base1 >= min_base_x) {
shift1 = ((x * (1 << upsample_above)) & 0x3F) >> 1;
val = above[base1] * (32 - shift1) + above[base1 + 1] * shift1;
for (int r = 0; r < bh; ++r) {
for (int c = 0; c < bw; ++c) {
int val;
int y = r + 1;
int x = (c << 6) - y * dx;
const int base_x = x >> frac_bits_x;
if (base_x >= min_base_x) {
const int shift = ((x * (1 << upsample_above)) & 0x3F) >> 1;
val = above[base_x] * (32 - shift) + above[base_x + 1] * shift;
val = ROUND_POWER_OF_TWO(val, 5);
} else {
base2 = y >> frac_bits_y;
assert(base2 >= -(1 << upsample_left));
shift2 = ((y * (1 << upsample_left)) & 0x3F) >> 1;
val = left[base2] * (32 - shift2) + left[base2 + 1] * shift2;
x = c + 1;
y = (r << 6) - x * dy;
const int base_y = y >> frac_bits_y;
assert(base_y >= min_base_y);
const int shift = ((y * (1 << upsample_left)) & 0x3F) >> 1;
val = left[base_y] * (32 - shift) + left[base_y + 1] * shift;
val = ROUND_POWER_OF_TWO(val, 5);
}
dst[c] = val;
}
dst += stride;
}
}
@ -688,30 +692,33 @@ void av1_highbd_dr_prediction_z2_c(uint16_t *dst, ptrdiff_t stride, int bw,
int bh, const uint16_t *above,
const uint16_t *left, int upsample_above,
int upsample_left, int dx, int dy, int bd) {
int r, c, x, y, shift, val, base;
(void)bd;
assert(dx > 0);
assert(dy > 0);
const int min_base_x = -(1 << upsample_above);
const int min_base_y = -(1 << upsample_left);
(void)min_base_y;
const int frac_bits_x = 6 - upsample_above;
const int frac_bits_y = 6 - upsample_left;
for (r = 0; r < bh; ++r) {
for (c = 0; c < bw; ++c) {
y = r + 1;
x = (c << 6) - y * dx;
base = x >> frac_bits_x;
if (base >= min_base_x) {
shift = ((x * (1 << upsample_above)) & 0x3F) >> 1;
val = above[base] * (32 - shift) + above[base + 1] * shift;
for (int r = 0; r < bh; ++r) {
for (int c = 0; c < bw; ++c) {
int val;
int y = r + 1;
int x = (c << 6) - y * dx;
const int base_x = x >> frac_bits_x;
if (base_x >= min_base_x) {
const int shift = ((x * (1 << upsample_above)) & 0x3F) >> 1;
val = above[base_x] * (32 - shift) + above[base_x + 1] * shift;
val = ROUND_POWER_OF_TWO(val, 5);
} else {
x = c + 1;
y = (r << 6) - x * dy;
base = y >> frac_bits_y;
shift = ((y * (1 << upsample_left)) & 0x3F) >> 1;
val = left[base] * (32 - shift) + left[base + 1] * shift;
const int base_y = y >> frac_bits_y;
assert(base_y >= min_base_y);
const int shift = ((y * (1 << upsample_left)) & 0x3F) >> 1;
val = left[base_y] * (32 - shift) + left[base_y + 1] * shift;
val = ROUND_POWER_OF_TWO(val, 5);
}
dst[c] = val;
@ -1503,7 +1510,7 @@ void av1_predict_intra_block(
xd->color_index_map_offset[plane != 0];
const uint16_t *const palette =
mbmi->palette_mode_info.palette_colors + plane * PALETTE_MAX_SIZE;
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
if (is_cur_buf_hbd(xd)) {
uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
for (r = 0; r < txhpx; ++r) {
for (c = 0; c < txwpx; ++c) {
@ -1562,7 +1569,7 @@ void av1_predict_intra_block(
tx_size, row_off, col_off, pd->subsampling_x, pd->subsampling_y);
const int disable_edge_filter = !cm->seq_params.enable_intra_edge_filter;
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
if (is_cur_buf_hbd(xd)) {
build_intra_predictors_high(
xd, ref, ref_stride, dst, dst_stride, mode, angle_delta,
filter_intra_mode, tx_size, disable_edge_filter,

View file

@ -110,7 +110,7 @@ static INLINE int av1_use_intra_edge_upsample(int bs0, int bs1, int delta,
int type) {
const int d = abs(delta);
const int blk_wh = bs0 + bs1;
if (d <= 0 || d >= 40) return 0;
if (d == 0 || d >= 40) return 0;
return type ? (blk_wh <= 8) : (blk_wh <= 16);
}
#ifdef __cplusplus

View file

@ -313,6 +313,91 @@ static void interpolate_core(const uint8_t *const input, int in_length,
}
}
static void interpolate_core_double_prec(const double *const input,
int in_length, double *output,
int out_length,
const int16_t *interp_filters,
int interp_taps) {
const int32_t delta =
(((uint32_t)in_length << RS_SCALE_SUBPEL_BITS) + out_length / 2) /
out_length;
const int32_t offset =
in_length > out_length
? (((int32_t)(in_length - out_length) << (RS_SCALE_SUBPEL_BITS - 1)) +
out_length / 2) /
out_length
: -(((int32_t)(out_length - in_length)
<< (RS_SCALE_SUBPEL_BITS - 1)) +
out_length / 2) /
out_length;
double *optr = output;
int x, x1, x2, k, int_pel, sub_pel;
double sum;
int32_t y;
x = 0;
y = offset + RS_SCALE_EXTRA_OFF;
while ((y >> RS_SCALE_SUBPEL_BITS) < (interp_taps / 2 - 1)) {
x++;
y += delta;
}
x1 = x;
x = out_length - 1;
y = delta * x + offset + RS_SCALE_EXTRA_OFF;
while ((y >> RS_SCALE_SUBPEL_BITS) + (int32_t)(interp_taps / 2) >=
in_length) {
x--;
y -= delta;
}
x2 = x;
if (x1 > x2) {
for (x = 0, y = offset + RS_SCALE_EXTRA_OFF; x < out_length;
++x, y += delta) {
int_pel = y >> RS_SCALE_SUBPEL_BITS;
sub_pel = (y >> RS_SCALE_EXTRA_BITS) & RS_SUBPEL_MASK;
const int16_t *filter = &interp_filters[sub_pel * interp_taps];
sum = 0;
for (k = 0; k < interp_taps; ++k) {
const int pk = int_pel - interp_taps / 2 + 1 + k;
sum += filter[k] * input[AOMMAX(AOMMIN(pk, in_length - 1), 0)];
}
*optr++ = sum / (1 << FILTER_BITS);
}
} else {
// Initial part.
for (x = 0, y = offset + RS_SCALE_EXTRA_OFF; x < x1; ++x, y += delta) {
int_pel = y >> RS_SCALE_SUBPEL_BITS;
sub_pel = (y >> RS_SCALE_EXTRA_BITS) & RS_SUBPEL_MASK;
const int16_t *filter = &interp_filters[sub_pel * interp_taps];
sum = 0;
for (k = 0; k < interp_taps; ++k)
sum += filter[k] * input[AOMMAX(int_pel - interp_taps / 2 + 1 + k, 0)];
*optr++ = sum / (1 << FILTER_BITS);
}
// Middle part.
for (; x <= x2; ++x, y += delta) {
int_pel = y >> RS_SCALE_SUBPEL_BITS;
sub_pel = (y >> RS_SCALE_EXTRA_BITS) & RS_SUBPEL_MASK;
const int16_t *filter = &interp_filters[sub_pel * interp_taps];
sum = 0;
for (k = 0; k < interp_taps; ++k)
sum += filter[k] * input[int_pel - interp_taps / 2 + 1 + k];
*optr++ = sum / (1 << FILTER_BITS);
}
// End part.
for (; x < out_length; ++x, y += delta) {
int_pel = y >> RS_SCALE_SUBPEL_BITS;
sub_pel = (y >> RS_SCALE_EXTRA_BITS) & RS_SUBPEL_MASK;
const int16_t *filter = &interp_filters[sub_pel * interp_taps];
sum = 0;
for (k = 0; k < interp_taps; ++k)
sum += filter[k] *
input[AOMMIN(int_pel - interp_taps / 2 + 1 + k, in_length - 1)];
*optr++ = sum / (1 << FILTER_BITS);
}
}
}
static void interpolate(const uint8_t *const input, int in_length,
uint8_t *output, int out_length) {
const InterpKernel *interp_filters =
@ -322,6 +407,15 @@ static void interpolate(const uint8_t *const input, int in_length,
SUBPEL_TAPS);
}
static void interpolate_double_prec(const double *const input, int in_length,
double *output, int out_length) {
const InterpKernel *interp_filters =
choose_interp_filter(in_length, out_length);
interpolate_core_double_prec(input, in_length, output, out_length,
&interp_filters[0][0], SUBPEL_TAPS);
}
int32_t av1_get_upscale_convolve_step(int in_length, int out_length) {
return ((in_length << RS_SCALE_SUBPEL_BITS) + out_length / 2) / out_length;
}
@ -505,6 +599,12 @@ static void resize_multistep(const uint8_t *const input, int length,
}
}
static void upscale_multistep_double_prec(const double *const input, int length,
double *output, int olength) {
assert(length < olength);
interpolate_double_prec(input, length, output, olength);
}
static void fill_col_to_arr(uint8_t *img, int stride, int len, uint8_t *arr) {
int i;
uint8_t *iptr = img;
@ -523,9 +623,29 @@ static void fill_arr_to_col(uint8_t *img, int stride, int len, uint8_t *arr) {
}
}
static void resize_plane(const uint8_t *const input, int height, int width,
int in_stride, uint8_t *output, int height2,
int width2, int out_stride) {
static void fill_col_to_arr_double_prec(double *img, int stride, int len,
double *arr) {
int i;
double *iptr = img;
double *aptr = arr;
for (i = 0; i < len; ++i, iptr += stride) {
*aptr++ = *iptr;
}
}
static void fill_arr_to_col_double_prec(double *img, int stride, int len,
double *arr) {
int i;
double *iptr = img;
double *aptr = arr;
for (i = 0; i < len; ++i, iptr += stride) {
*iptr = *aptr++;
}
}
void av1_resize_plane(const uint8_t *const input, int height, int width,
int in_stride, uint8_t *output, int height2, int width2,
int out_stride) {
int i;
uint8_t *intbuf = (uint8_t *)aom_malloc(sizeof(uint8_t) * width2 * height);
uint8_t *tmpbuf =
@ -554,6 +674,33 @@ Error:
aom_free(arrbuf2);
}
void av1_upscale_plane_double_prec(const double *const input, int height,
int width, int in_stride, double *output,
int height2, int width2, int out_stride) {
int i;
double *intbuf = (double *)aom_malloc(sizeof(double) * width2 * height);
double *arrbuf = (double *)aom_malloc(sizeof(double) * height);
double *arrbuf2 = (double *)aom_malloc(sizeof(double) * height2);
if (intbuf == NULL || arrbuf == NULL || arrbuf2 == NULL) goto Error;
assert(width > 0);
assert(height > 0);
assert(width2 > 0);
assert(height2 > 0);
for (i = 0; i < height; ++i)
upscale_multistep_double_prec(input + in_stride * i, width,
intbuf + width2 * i, width2);
for (i = 0; i < width2; ++i) {
fill_col_to_arr_double_prec(intbuf + i, width2, height, arrbuf);
upscale_multistep_double_prec(arrbuf, height, arrbuf2, height2);
fill_arr_to_col_double_prec(output + i, out_stride, height2, arrbuf2);
}
Error:
aom_free(intbuf);
aom_free(arrbuf);
aom_free(arrbuf2);
}
static void upscale_normative_rect(const uint8_t *const input, int height,
int width, int in_stride, uint8_t *output,
int height2, int width2, int out_stride,
@ -871,10 +1018,9 @@ static void highbd_fill_arr_to_col(uint16_t *img, int stride, int len,
}
}
static void highbd_resize_plane(const uint8_t *const input, int height,
int width, int in_stride, uint8_t *output,
int height2, int width2, int out_stride,
int bd) {
void av1_highbd_resize_plane(const uint8_t *const input, int height, int width,
int in_stride, uint8_t *output, int height2,
int width2, int out_stride, int bd) {
int i;
uint16_t *intbuf = (uint16_t *)aom_malloc(sizeof(uint16_t) * width2 * height);
uint16_t *tmpbuf =
@ -969,11 +1115,11 @@ void av1_resize_frame420(const uint8_t *const y, int y_stride,
int uv_stride, int height, int width, uint8_t *oy,
int oy_stride, uint8_t *ou, uint8_t *ov,
int ouv_stride, int oheight, int owidth) {
resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride);
resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2, owidth / 2,
ouv_stride);
resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2, owidth / 2,
ouv_stride);
av1_resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride);
av1_resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2,
owidth / 2, ouv_stride);
av1_resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2,
owidth / 2, ouv_stride);
}
void av1_resize_frame422(const uint8_t *const y, int y_stride,
@ -981,11 +1127,11 @@ void av1_resize_frame422(const uint8_t *const y, int y_stride,
int uv_stride, int height, int width, uint8_t *oy,
int oy_stride, uint8_t *ou, uint8_t *ov,
int ouv_stride, int oheight, int owidth) {
resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride);
resize_plane(u, height, width / 2, uv_stride, ou, oheight, owidth / 2,
ouv_stride);
resize_plane(v, height, width / 2, uv_stride, ov, oheight, owidth / 2,
ouv_stride);
av1_resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride);
av1_resize_plane(u, height, width / 2, uv_stride, ou, oheight, owidth / 2,
ouv_stride);
av1_resize_plane(v, height, width / 2, uv_stride, ov, oheight, owidth / 2,
ouv_stride);
}
void av1_resize_frame444(const uint8_t *const y, int y_stride,
@ -993,9 +1139,11 @@ void av1_resize_frame444(const uint8_t *const y, int y_stride,
int uv_stride, int height, int width, uint8_t *oy,
int oy_stride, uint8_t *ou, uint8_t *ov,
int ouv_stride, int oheight, int owidth) {
resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride);
resize_plane(u, height, width, uv_stride, ou, oheight, owidth, ouv_stride);
resize_plane(v, height, width, uv_stride, ov, oheight, owidth, ouv_stride);
av1_resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride);
av1_resize_plane(u, height, width, uv_stride, ou, oheight, owidth,
ouv_stride);
av1_resize_plane(v, height, width, uv_stride, ov, oheight, owidth,
ouv_stride);
}
void av1_highbd_resize_frame420(const uint8_t *const y, int y_stride,
@ -1004,12 +1152,12 @@ void av1_highbd_resize_frame420(const uint8_t *const y, int y_stride,
uint8_t *oy, int oy_stride, uint8_t *ou,
uint8_t *ov, int ouv_stride, int oheight,
int owidth, int bd) {
highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth,
oy_stride, bd);
highbd_resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2,
owidth / 2, ouv_stride, bd);
highbd_resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2,
owidth / 2, ouv_stride, bd);
av1_highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth,
oy_stride, bd);
av1_highbd_resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2,
owidth / 2, ouv_stride, bd);
av1_highbd_resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2,
owidth / 2, ouv_stride, bd);
}
void av1_highbd_resize_frame422(const uint8_t *const y, int y_stride,
@ -1018,12 +1166,12 @@ void av1_highbd_resize_frame422(const uint8_t *const y, int y_stride,
uint8_t *oy, int oy_stride, uint8_t *ou,
uint8_t *ov, int ouv_stride, int oheight,
int owidth, int bd) {
highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth,
oy_stride, bd);
highbd_resize_plane(u, height, width / 2, uv_stride, ou, oheight, owidth / 2,
ouv_stride, bd);
highbd_resize_plane(v, height, width / 2, uv_stride, ov, oheight, owidth / 2,
ouv_stride, bd);
av1_highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth,
oy_stride, bd);
av1_highbd_resize_plane(u, height, width / 2, uv_stride, ou, oheight,
owidth / 2, ouv_stride, bd);
av1_highbd_resize_plane(v, height, width / 2, uv_stride, ov, oheight,
owidth / 2, ouv_stride, bd);
}
void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride,
@ -1032,12 +1180,12 @@ void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride,
uint8_t *oy, int oy_stride, uint8_t *ou,
uint8_t *ov, int ouv_stride, int oheight,
int owidth, int bd) {
highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth,
oy_stride, bd);
highbd_resize_plane(u, height, width, uv_stride, ou, oheight, owidth,
ouv_stride, bd);
highbd_resize_plane(v, height, width, uv_stride, ov, oheight, owidth,
ouv_stride, bd);
av1_highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth,
oy_stride, bd);
av1_highbd_resize_plane(u, height, width, uv_stride, ou, oheight, owidth,
ouv_stride, bd);
av1_highbd_resize_plane(v, height, width, uv_stride, ov, oheight, owidth,
ouv_stride, bd);
}
void av1_resize_and_extend_frame(const YV12_BUFFER_CONFIG *src,
@ -1050,15 +1198,15 @@ void av1_resize_and_extend_frame(const YV12_BUFFER_CONFIG *src,
for (int i = 0; i < AOMMIN(num_planes, MAX_MB_PLANE); ++i) {
const int is_uv = i > 0;
if (src->flags & YV12_FLAG_HIGHBITDEPTH)
highbd_resize_plane(src->buffers[i], src->crop_heights[is_uv],
src->crop_widths[is_uv], src->strides[is_uv],
dst->buffers[i], dst->crop_heights[is_uv],
dst->crop_widths[is_uv], dst->strides[is_uv], bd);
av1_highbd_resize_plane(src->buffers[i], src->crop_heights[is_uv],
src->crop_widths[is_uv], src->strides[is_uv],
dst->buffers[i], dst->crop_heights[is_uv],
dst->crop_widths[is_uv], dst->strides[is_uv], bd);
else
resize_plane(src->buffers[i], src->crop_heights[is_uv],
src->crop_widths[is_uv], src->strides[is_uv],
dst->buffers[i], dst->crop_heights[is_uv],
dst->crop_widths[is_uv], dst->strides[is_uv]);
av1_resize_plane(src->buffers[i], src->crop_heights[is_uv],
src->crop_widths[is_uv], src->strides[is_uv],
dst->buffers[i], dst->crop_heights[is_uv],
dst->crop_widths[is_uv], dst->strides[is_uv]);
}
aom_extend_frame_borders(dst, num_planes);
}
@ -1155,10 +1303,19 @@ YV12_BUFFER_CONFIG *av1_scale_if_required(AV1_COMMON *cm,
// denominator.
static void calculate_scaled_size_helper(int *dim, int denom) {
if (denom != SCALE_NUMERATOR) {
// We need to ensure the constraint in "Appendix A" of the spec:
// * FrameWidth is greater than or equal to 16
// * FrameHeight is greater than or equal to 16
// For this, we clamp the downscaled dimension to at least 16. One
// exception: if original dimension itself was < 16, then we keep the
// downscaled dimension to be same as the original, to ensure that resizing
// is valid.
const int min_dim = AOMMIN(16, *dim);
// Use this version if we need *dim to be even
// *width = (*width * SCALE_NUMERATOR + denom) / (2 * denom);
// *width <<= 1;
*dim = (*dim * SCALE_NUMERATOR + denom / 2) / (denom);
*dim = AOMMAX(*dim, min_dim);
}
}
@ -1205,7 +1362,7 @@ void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool) {
YV12_BUFFER_CONFIG copy_buffer;
memset(&copy_buffer, 0, sizeof(copy_buffer));
YV12_BUFFER_CONFIG *const frame_to_show = get_frame_new_buffer(cm);
YV12_BUFFER_CONFIG *const frame_to_show = &cm->cur_frame->buf;
const int aligned_width = ALIGN_POWER_OF_TWO(cm->width, 3);
if (aom_alloc_frame_buffer(
@ -1225,8 +1382,7 @@ void av1_superres_upscale(AV1_COMMON *cm, BufferPool *const pool) {
// Realloc the current frame buffer at a higher resolution in place.
if (pool != NULL) {
// Use callbacks if on the decoder.
aom_codec_frame_buffer_t *fb =
&pool->frame_bufs[cm->new_fb_idx].raw_frame_buffer;
aom_codec_frame_buffer_t *fb = &cm->cur_frame->raw_frame_buffer;
aom_release_frame_buffer_cb_fn_t release_fb_cb = pool->release_fb_cb;
aom_get_frame_buffer_cb_fn_t cb = pool->get_fb_cb;
void *cb_priv = pool->cb_priv;

View file

@ -23,6 +23,9 @@ extern "C" {
void av1_resize_plane(const uint8_t *const input, int height, int width,
int in_stride, uint8_t *output, int height2, int width2,
int out_stride);
void av1_upscale_plane_double_prec(const double *const input, int height,
int width, int in_stride, double *output,
int height2, int width2, int out_stride);
void av1_resize_frame420(const uint8_t *const y, int y_stride,
const uint8_t *const u, const uint8_t *const v,
int uv_stride, int height, int width, uint8_t *oy,

View file

@ -1072,13 +1072,6 @@ void av1_loop_restoration_filter_unit(
}
}
static void filter_frame_on_tile(int tile_row, int tile_col, void *priv,
AV1_COMMON *cm) {
(void)tile_col;
FilterFrameCtxt *ctxt = (FilterFrameCtxt *)priv;
ctxt->tile_stripe0 = (tile_row == 0) ? 0 : cm->rst_end_stripe[tile_row - 1];
}
static void filter_frame_on_unit(const RestorationTileLimits *limits,
const AV1PixelRect *tile_rect,
int rest_unit_idx, void *priv, int32_t *tmpbuf,
@ -1106,7 +1099,7 @@ void av1_loop_restoration_filter_frame_init(AV1LrStruct *lr_ctxt,
const int frame_height = frame->crop_heights[0];
if (aom_realloc_frame_buffer(
lr_ctxt->dst, frame_width, frame_height, seq_params->subsampling_x,
seq_params->subsampling_y, highbd, AOM_BORDER_IN_PIXELS,
seq_params->subsampling_y, highbd, AOM_RESTORATION_FRAME_BORDER,
cm->byte_alignment, NULL, NULL, NULL) < 0)
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
"Failed to allocate restoration dst buffer");
@ -1141,7 +1134,7 @@ void av1_loop_restoration_filter_frame_init(AV1LrStruct *lr_ctxt,
lr_plane_ctxt->data_stride = frame->strides[is_uv];
lr_plane_ctxt->dst_stride = lr_ctxt->dst->strides[is_uv];
lr_plane_ctxt->tile_rect = av1_whole_frame_rect(cm, is_uv);
filter_frame_on_tile(LR_TILE_ROW, LR_TILE_COL, lr_plane_ctxt, cm);
lr_plane_ctxt->tile_stripe0 = 0;
}
}
@ -1150,9 +1143,9 @@ void av1_loop_restoration_copy_planes(AV1LrStruct *loop_rest_ctxt,
typedef void (*copy_fun)(const YV12_BUFFER_CONFIG *src_ybc,
YV12_BUFFER_CONFIG *dst_ybc, int hstart, int hend,
int vstart, int vend);
static const copy_fun copy_funs[3] = {
aom_yv12_partial_copy_y, aom_yv12_partial_copy_u, aom_yv12_partial_copy_v
};
static const copy_fun copy_funs[3] = { aom_yv12_partial_coloc_copy_y,
aom_yv12_partial_coloc_copy_u,
aom_yv12_partial_coloc_copy_v };
for (int plane = 0; plane < num_planes; ++plane) {
if (cm->rst_info[plane].frame_restoration_type == RESTORE_NONE) continue;

View file

@ -22,6 +22,8 @@
extern "C" {
#endif
// Boarder for Loop restoration buffer
#define AOM_RESTORATION_FRAME_BORDER 32
#define CLIP(x, lo, hi) ((x) < (lo) ? (lo) : (x) > (hi) ? (hi) : (x))
#define RINT(x) ((x) < 0 ? (int)((x)-0.5) : (int)((x) + 0.5))

View file

@ -97,13 +97,13 @@ void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
// subpel_x_q4 != 0 && subpel_y_q4 != 0
sf->convolve[1][1][0] = av1_convolve_2d_sr;
// subpel_x_q4 == 0 && subpel_y_q4 == 0
sf->convolve[0][0][1] = av1_jnt_convolve_2d_copy;
sf->convolve[0][0][1] = av1_dist_wtd_convolve_2d_copy;
// subpel_x_q4 == 0
sf->convolve[0][1][1] = av1_jnt_convolve_y;
sf->convolve[0][1][1] = av1_dist_wtd_convolve_y;
// subpel_y_q4 == 0
sf->convolve[1][0][1] = av1_jnt_convolve_x;
sf->convolve[1][0][1] = av1_dist_wtd_convolve_x;
// subpel_x_q4 != 0 && subpel_y_q4 != 0
sf->convolve[1][1][1] = av1_jnt_convolve_2d;
sf->convolve[1][1][1] = av1_dist_wtd_convolve_2d;
// AV1 High BD convolve functions
// Special case convolve functions should produce the same result as
// av1_highbd_convolve_2d.
@ -116,11 +116,11 @@ void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
// subpel_x_q4 != 0 && subpel_y_q4 != 0
sf->highbd_convolve[1][1][0] = av1_highbd_convolve_2d_sr;
// subpel_x_q4 == 0 && subpel_y_q4 == 0
sf->highbd_convolve[0][0][1] = av1_highbd_jnt_convolve_2d_copy;
sf->highbd_convolve[0][0][1] = av1_highbd_dist_wtd_convolve_2d_copy;
// subpel_x_q4 == 0
sf->highbd_convolve[0][1][1] = av1_highbd_jnt_convolve_y;
sf->highbd_convolve[0][1][1] = av1_highbd_dist_wtd_convolve_y;
// subpel_y_q4 == 0
sf->highbd_convolve[1][0][1] = av1_highbd_jnt_convolve_x;
sf->highbd_convolve[1][0][1] = av1_highbd_dist_wtd_convolve_x;
// subpel_x_q4 != 0 && subpel_y_q4 != 0
sf->highbd_convolve[1][1][1] = av1_highbd_jnt_convolve_2d;
sf->highbd_convolve[1][1][1] = av1_highbd_dist_wtd_convolve_2d;
}

View file

@ -25,14 +25,14 @@ extern "C" {
#define MAX_NEIGHBORS 2
typedef enum SCAN_MODE {
enum {
SCAN_MODE_ZIG_ZAG,
SCAN_MODE_COL_DIAG,
SCAN_MODE_ROW_DIAG,
SCAN_MODE_COL_1D,
SCAN_MODE_ROW_1D,
SCAN_MODES
} SCAN_MODE;
} UENUM1BYTE(SCAN_MODE);
extern const SCAN_ORDER av1_default_scan_orders[TX_SIZES];
extern const SCAN_ORDER av1_scan_orders[TX_SIZES_ALL][TX_TYPES];

View file

@ -16,12 +16,19 @@
#include "av1/common/seg_common.h"
#include "av1/common/quant_common.h"
static const int seg_feature_data_signed[SEG_LVL_MAX] = { 1, 1, 1, 1, 1, 0, 0 };
static const int seg_feature_data_max[SEG_LVL_MAX] = {
MAXQ, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 7, 0
static const int seg_feature_data_signed[SEG_LVL_MAX] = {
1, 1, 1, 1, 1, 0, 0, 0
};
static const int seg_feature_data_max[SEG_LVL_MAX] = { MAXQ,
MAX_LOOP_FILTER,
MAX_LOOP_FILTER,
MAX_LOOP_FILTER,
MAX_LOOP_FILTER,
7,
0,
0 };
// These functions provide access to new segment level features.
// Eventually these function may be "optimized out" but for the moment,
// the coding mechanism is still subject to change so these provide a

View file

@ -24,7 +24,7 @@ extern "C" {
#define SEG_TEMPORAL_PRED_CTXS 3
#define SPATIAL_PREDICTION_PROBS 3
typedef enum {
enum {
SEG_LVL_ALT_Q, // Use alternate Quantizer ....
SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical
SEG_LVL_ALT_LF_Y_H, // Use alternate loop filter value on y plane horizontal
@ -34,7 +34,7 @@ typedef enum {
SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode
SEG_LVL_GLOBALMV,
SEG_LVL_MAX
} SEG_LVL_FEATURES;
} UENUM1BYTE(SEG_LVL_FEATURES);
struct segmentation {
uint8_t enabled;

View file

@ -205,7 +205,11 @@ static INLINE void sync_write(AV1LfSync *const lf_sync, int r, int c,
}
static void enqueue_lf_jobs(AV1LfSync *lf_sync, AV1_COMMON *cm, int start,
int stop, int plane_start, int plane_end) {
int stop,
#if LOOP_FILTER_BITMASK
int is_decoding,
#endif
int plane_start, int plane_end) {
int mi_row, plane, dir;
AV1LfMTInfo *lf_job_queue = lf_sync->job_queue;
lf_sync->jobs_enqueued = 0;
@ -219,7 +223,16 @@ static void enqueue_lf_jobs(AV1LfSync *lf_sync, AV1_COMMON *cm, int start,
continue;
else if (plane == 2 && !(cm->lf.filter_level_v))
continue;
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
#if LOOP_FILTER_BITMASK
int step = MAX_MIB_SIZE;
if (is_decoding) {
step = MI_SIZE_64X64;
}
for (mi_row = start; mi_row < stop; mi_row += step)
#else
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE)
#endif
{
lf_job_queue->mi_row = mi_row;
lf_job_queue->plane = plane;
lf_job_queue->dir = dir;
@ -230,7 +243,7 @@ static void enqueue_lf_jobs(AV1LfSync *lf_sync, AV1_COMMON *cm, int start,
}
}
AV1LfMTInfo *get_lf_job_info(AV1LfSync *lf_sync) {
static AV1LfMTInfo *get_lf_job_info(AV1LfSync *lf_sync) {
AV1LfMTInfo *cur_job_info = NULL;
#if CONFIG_MULTITHREAD
@ -312,15 +325,94 @@ static int loop_filter_row_worker(void *arg1, void *arg2) {
return 1;
}
#if LOOP_FILTER_BITMASK
static INLINE void thread_loop_filter_bitmask_rows(
const YV12_BUFFER_CONFIG *const frame_buffer, AV1_COMMON *const cm,
struct macroblockd_plane *planes, MACROBLOCKD *xd,
AV1LfSync *const lf_sync) {
const int sb_cols =
ALIGN_POWER_OF_TWO(cm->mi_cols, MIN_MIB_SIZE_LOG2) >> MIN_MIB_SIZE_LOG2;
int mi_row, mi_col, plane, dir;
int r, c;
(void)xd;
while (1) {
AV1LfMTInfo *cur_job_info = get_lf_job_info(lf_sync);
if (cur_job_info != NULL) {
mi_row = cur_job_info->mi_row;
plane = cur_job_info->plane;
dir = cur_job_info->dir;
r = mi_row >> MIN_MIB_SIZE_LOG2;
if (dir == 0) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_SIZE_64X64) {
c = mi_col >> MIN_MIB_SIZE_LOG2;
av1_setup_dst_planes(planes, BLOCK_64X64, frame_buffer, mi_row,
mi_col, plane, plane + 1);
av1_filter_block_plane_bitmask_vert(cm, &planes[plane], plane, mi_row,
mi_col);
sync_write(lf_sync, r, c, sb_cols, plane);
}
} else if (dir == 1) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_SIZE_64X64) {
c = mi_col >> MIN_MIB_SIZE_LOG2;
// Wait for vertical edge filtering of the top-right block to be
// completed
sync_read(lf_sync, r, c, plane);
// Wait for vertical edge filtering of the right block to be
// completed
sync_read(lf_sync, r + 1, c, plane);
av1_setup_dst_planes(planes, BLOCK_64X64, frame_buffer, mi_row,
mi_col, plane, plane + 1);
av1_filter_block_plane_bitmask_horz(cm, &planes[plane], plane, mi_row,
mi_col);
}
}
} else {
break;
}
}
}
// Row-based multi-threaded loopfilter hook
static int loop_filter_bitmask_row_worker(void *arg1, void *arg2) {
AV1LfSync *const lf_sync = (AV1LfSync *)arg1;
LFWorkerData *const lf_data = (LFWorkerData *)arg2;
thread_loop_filter_bitmask_rows(lf_data->frame_buffer, lf_data->cm,
lf_data->planes, lf_data->xd, lf_sync);
return 1;
}
#endif // LOOP_FILTER_BITMASK
static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
MACROBLOCKD *xd, int start, int stop,
int plane_start, int plane_end,
#if LOOP_FILTER_BITMASK
int is_decoding,
#endif
AVxWorker *workers, int nworkers,
AV1LfSync *lf_sync) {
const AVxWorkerInterface *const winterface = aom_get_worker_interface();
#if LOOP_FILTER_BITMASK
int sb_rows;
if (is_decoding) {
sb_rows =
ALIGN_POWER_OF_TWO(cm->mi_rows, MIN_MIB_SIZE_LOG2) >> MIN_MIB_SIZE_LOG2;
} else {
sb_rows =
ALIGN_POWER_OF_TWO(cm->mi_rows, MAX_MIB_SIZE_LOG2) >> MAX_MIB_SIZE_LOG2;
}
#else
// Number of superblock rows and cols
const int sb_rows =
ALIGN_POWER_OF_TWO(cm->mi_rows, MAX_MIB_SIZE_LOG2) >> MAX_MIB_SIZE_LOG2;
#endif
const int num_workers = nworkers;
int i;
@ -336,14 +428,26 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
sizeof(*(lf_sync->cur_sb_col[i])) * sb_rows);
}
enqueue_lf_jobs(lf_sync, cm, start, stop, plane_start, plane_end);
enqueue_lf_jobs(lf_sync, cm, start, stop,
#if LOOP_FILTER_BITMASK
is_decoding,
#endif
plane_start, plane_end);
// Set up loopfilter thread data.
for (i = 0; i < num_workers; ++i) {
AVxWorker *const worker = &workers[i];
LFWorkerData *const lf_data = &lf_sync->lfdata[i];
#if LOOP_FILTER_BITMASK
if (is_decoding) {
worker->hook = loop_filter_bitmask_row_worker;
} else {
worker->hook = loop_filter_row_worker;
}
#else
worker->hook = loop_filter_row_worker;
#endif
worker->data1 = lf_sync;
worker->data2 = lf_data;
@ -366,8 +470,12 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
MACROBLOCKD *xd, int plane_start, int plane_end,
int partial_frame, AVxWorker *workers,
int num_workers, AV1LfSync *lf_sync) {
int partial_frame,
#if LOOP_FILTER_BITMASK
int is_decoding,
#endif
AVxWorker *workers, int num_workers,
AV1LfSync *lf_sync) {
int start_mi_row, end_mi_row, mi_rows_to_filter;
start_mi_row = 0;
@ -380,8 +488,37 @@ void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
end_mi_row = start_mi_row + mi_rows_to_filter;
av1_loop_filter_frame_init(cm, plane_start, plane_end);
#if LOOP_FILTER_BITMASK
if (is_decoding) {
cm->is_decoding = is_decoding;
// TODO(chengchen): currently use one thread to build bitmasks for the
// frame. Make it support multi-thread later.
for (int plane = plane_start; plane < plane_end; plane++) {
if (plane == 0 && !(cm->lf.filter_level[0]) && !(cm->lf.filter_level[1]))
break;
else if (plane == 1 && !(cm->lf.filter_level_u))
continue;
else if (plane == 2 && !(cm->lf.filter_level_v))
continue;
// TODO(chengchen): can we remove this?
struct macroblockd_plane *pd = xd->plane;
av1_setup_dst_planes(pd, cm->seq_params.sb_size, frame, 0, 0, plane,
plane + 1);
av1_build_bitmask_vert_info(cm, &pd[plane], plane);
av1_build_bitmask_horz_info(cm, &pd[plane], plane);
}
loop_filter_rows_mt(frame, cm, xd, start_mi_row, end_mi_row, plane_start,
plane_end, 1, workers, num_workers, lf_sync);
} else {
loop_filter_rows_mt(frame, cm, xd, start_mi_row, end_mi_row, plane_start,
plane_end, 0, workers, num_workers, lf_sync);
}
#else
loop_filter_rows_mt(frame, cm, xd, start_mi_row, end_mi_row, plane_start,
plane_end, workers, num_workers, lf_sync);
#endif
}
static INLINE void lr_sync_read(void *const lr_sync, int r, int c, int plane) {
@ -630,7 +767,7 @@ static void enqueue_lr_jobs(AV1LrSync *lr_sync, AV1LrStruct *lr_ctxt,
}
}
AV1LrMTInfo *get_lr_job_info(AV1LrSync *lr_sync) {
static AV1LrMTInfo *get_lr_job_info(AV1LrSync *lr_sync) {
AV1LrMTInfo *cur_job_info = NULL;
#if CONFIG_MULTITHREAD
@ -664,9 +801,9 @@ static int loop_restoration_row_worker(void *arg1, void *arg2) {
typedef void (*copy_fun)(const YV12_BUFFER_CONFIG *src_ybc,
YV12_BUFFER_CONFIG *dst_ybc, int hstart, int hend,
int vstart, int vend);
static const copy_fun copy_funs[3] = {
aom_yv12_partial_copy_y, aom_yv12_partial_copy_u, aom_yv12_partial_copy_v
};
static const copy_fun copy_funs[3] = { aom_yv12_partial_coloc_copy_y,
aom_yv12_partial_coloc_copy_u,
aom_yv12_partial_coloc_copy_v };
while (1) {
AV1LrMTInfo *cur_job_info = get_lr_job_info(lr_sync);

View file

@ -103,6 +103,9 @@ void av1_loop_filter_dealloc(AV1LfSync *lf_sync);
void av1_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm,
struct macroblockd *mbd, int plane_start,
int plane_end, int partial_frame,
#if LOOP_FILTER_BITMASK
int is_decoding,
#endif
AVxWorker *workers, int num_workers,
AV1LfSync *lf_sync);
void av1_loop_restoration_filter_frame_mt(YV12_BUFFER_CONFIG *frame,

View file

@ -143,30 +143,6 @@ int av1_get_sb_cols_in_tile(AV1_COMMON *cm, TileInfo tile) {
return sb_cols;
}
int get_tile_size(int mi_frame_size, int log2_tile_num, int *ntiles) {
// Round the frame up to a whole number of max superblocks
mi_frame_size = ALIGN_POWER_OF_TWO(mi_frame_size, MAX_MIB_SIZE_LOG2);
// Divide by the signalled number of tiles, rounding up to the multiple of
// the max superblock size. To do this, shift right (and round up) to get the
// tile size in max super-blocks and then shift left again to convert it to
// mi units.
const int shift = log2_tile_num + MAX_MIB_SIZE_LOG2;
const int max_sb_tile_size =
ALIGN_POWER_OF_TWO(mi_frame_size, shift) >> shift;
const int mi_tile_size = max_sb_tile_size << MAX_MIB_SIZE_LOG2;
// The actual number of tiles is the ceiling of the frame size in mi units
// divided by mi_size. This is at most 1 << log2_tile_num but might be
// strictly less if max_sb_tile_size got rounded up significantly.
if (ntiles) {
*ntiles = (mi_frame_size + mi_tile_size - 1) / mi_tile_size;
assert(*ntiles <= (1 << log2_tile_num));
}
return mi_tile_size;
}
AV1PixelRect av1_get_tile_rect(const TileInfo *tile_info, const AV1_COMMON *cm,
int is_uv) {
AV1PixelRect r;
@ -205,3 +181,26 @@ AV1PixelRect av1_get_tile_rect(const TileInfo *tile_info, const AV1_COMMON *cm,
return r;
}
void av1_get_uniform_tile_size(const AV1_COMMON *cm, int *w, int *h) {
if (cm->uniform_tile_spacing_flag) {
*w = cm->tile_width;
*h = cm->tile_height;
} else {
for (int i = 0; i < cm->tile_cols; ++i) {
const int tile_width_sb =
cm->tile_col_start_sb[i + 1] - cm->tile_col_start_sb[i];
const int tile_w = tile_width_sb * cm->seq_params.mib_size;
assert(i == 0 || tile_w == *w); // ensure all tiles have same dimension
*w = tile_w;
}
for (int i = 0; i < cm->tile_rows; ++i) {
const int tile_height_sb =
cm->tile_row_start_sb[i + 1] - cm->tile_row_start_sb[i];
const int tile_h = tile_height_sb * cm->seq_params.mib_size;
assert(i == 0 || tile_h == *h); // ensure all tiles have same dimension
*h = tile_h;
}
}
}

View file

@ -25,7 +25,6 @@ struct AV1Common;
typedef struct TileInfo {
int mi_row_start, mi_row_end;
int mi_col_start, mi_col_end;
int tg_horz_boundary;
int tile_row;
int tile_col;
} TileInfo;
@ -37,12 +36,6 @@ void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row,
void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row);
void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col);
void av1_get_tile_n_bits(int mi_cols, int *min_log2_tile_cols,
int *max_log2_tile_cols);
// Calculate the correct tile size (width or height) for (1 << log2_tile_num)
// tiles horizontally or vertically in the frame.
int get_tile_size(int mi_frame_size, int log2_tile_num, int *ntiles);
int av1_get_sb_rows_in_tile(struct AV1Common *cm, TileInfo tile);
int av1_get_sb_cols_in_tile(struct AV1Common *cm, TileInfo tile);
@ -61,6 +54,7 @@ AV1PixelRect av1_get_tile_rect(const TileInfo *tile_info,
#define MAX_TILE_WIDTH (4096) // Max Tile width in pixels
#define MAX_TILE_AREA (4096 * 2304) // Maximum tile area in pixels
void av1_get_uniform_tile_size(const struct AV1Common *cm, int *w, int *h);
void av1_get_tile_limits(struct AV1Common *const cm);
void av1_calculate_tile_cols(struct AV1Common *const cm);
void av1_calculate_tile_rows(struct AV1Common *const cm);

View file

@ -453,23 +453,6 @@ const int8_t *av1_nz_map_ctx_offset[19] = {
av1_nz_map_ctx_offset_64x32, // TX_64x16
};
void av1_init_lv_map(AV1_COMMON *cm) {
LV_MAP_CTX_TABLE *coeff_ctx_table = &cm->coeff_ctx_table;
for (int row = 0; row < 2; ++row) {
for (int col = 0; col < 2; ++col) {
for (int sig_mag = 0; sig_mag < 3; ++sig_mag) {
for (int count = 0; count < BASE_CONTEXT_POSITION_NUM + 1; ++count) {
if (row == 0 && col == 0 && count > 5) continue;
if ((row == 0 || col == 0) && count > 8) continue;
coeff_ctx_table->base_ctx_table[row][col][sig_mag][count] =
get_base_ctx_from_count_mag(row, col, count, sig_mag);
}
}
}
}
}
const int16_t k_eob_group_start[12] = { 0, 1, 2, 3, 5, 9,
17, 33, 65, 129, 257, 513 };
const int16_t k_eob_offset_bits[12] = { 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

View file

@ -12,6 +12,8 @@
#ifndef AOM_AV1_COMMON_TXB_COMMON_H_
#define AOM_AV1_COMMON_TXB_COMMON_H_
#include "av1/common/onyxc_int.h"
extern const int16_t k_eob_group_start[12];
extern const int16_t k_eob_offset_bits[12];
@ -157,6 +159,19 @@ static INLINE int get_br_ctx_2d(const uint8_t *const levels,
return mag + 14;
}
static AOM_FORCE_INLINE int get_br_ctx_eob(const int c, // raster order
const int bwl,
const TX_CLASS tx_class) {
const int row = c >> bwl;
const int col = c - (row << bwl);
if (c == 0) return 0;
if ((tx_class == TX_CLASS_2D && row < 2 && col < 2) ||
(tx_class == TX_CLASS_HORIZ && col == 0) ||
(tx_class == TX_CLASS_VERT && row == 0))
return 7;
return 14;
}
static AOM_FORCE_INLINE int get_br_ctx(const uint8_t *const levels,
const int c, // raster order
const int bwl, const TX_CLASS tx_class) {
@ -270,12 +285,10 @@ static AOM_FORCE_INLINE int get_nz_map_ctx_from_stats(
const int row = coeff_idx >> bwl;
const int col = coeff_idx - (row << bwl);
return ctx + nz_map_ctx_offset_1d[col];
break;
}
case TX_CLASS_VERT: {
const int row = coeff_idx >> bwl;
return ctx + nz_map_ctx_offset_1d[row];
break;
}
default: break;
}
@ -419,6 +432,4 @@ static INLINE void get_txb_ctx(const BLOCK_SIZE plane_bsize,
#undef MAX_TX_SIZE_UNIT
}
void av1_init_lv_map(AV1_COMMON *cm);
#endif // AOM_AV1_COMMON_TXB_COMMON_H_

View file

@ -485,7 +485,7 @@ void av1_highbd_warp_affine_c(const int32_t *mat, const uint16_t *ref,
uint16_t *dst16 =
&pred[(i - p_row + k + 4) * p_stride + (j - p_col + l + 4)];
int32_t tmp32 = *p;
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp32 = tmp32 * conv_params->fwd_offset +
sum * conv_params->bck_offset;
tmp32 = tmp32 >> DIST_PRECISION_BITS;
@ -563,7 +563,7 @@ static int64_t highbd_warp_error(
uint16_t tmp[WARP_ERROR_BLOCK * WARP_ERROR_BLOCK];
ConvolveParams conv_params = get_conv_params(0, 0, bd);
conv_params.use_jnt_comp_avg = 0;
conv_params.use_dist_wtd_comp_avg = 0;
for (int i = p_row; i < p_row + p_height; i += WARP_ERROR_BLOCK) {
for (int j = p_col; j < p_col + p_width; j += WARP_ERROR_BLOCK) {
// avoid warping extra 8x8 blocks in the padded region of the frame
@ -773,7 +773,7 @@ void av1_warp_affine_c(const int32_t *mat, const uint8_t *ref, int width,
uint8_t *dst8 =
&pred[(i - p_row + k + 4) * p_stride + (j - p_col + l + 4)];
int32_t tmp32 = *p;
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp32 = tmp32 * conv_params->fwd_offset +
sum * conv_params->bck_offset;
tmp32 = tmp32 >> DIST_PRECISION_BITS;
@ -846,7 +846,7 @@ static int64_t warp_error(WarpedMotionParams *wm, const uint8_t *const ref,
int error_bsize_h = AOMMIN(p_height, WARP_ERROR_BLOCK);
uint8_t tmp[WARP_ERROR_BLOCK * WARP_ERROR_BLOCK];
ConvolveParams conv_params = get_conv_params(0, 0, 8);
conv_params.use_jnt_comp_avg = 0;
conv_params.use_dist_wtd_comp_avg = 0;
for (int i = p_row; i < p_row + p_height; i += WARP_ERROR_BLOCK) {
for (int j = p_col; j < p_col + p_width; j += WARP_ERROR_BLOCK) {

View file

@ -175,7 +175,7 @@ static void vfilter8(const int16_t *src, int src_stride, uint8_t *dst,
if (conv_params->is_compound) {
if (conv_params->do_average) {
const __m128i p_16 = _mm_loadl_epi64((__m128i *)dst_16_x);
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
const __m128i p_16_lo = _mm_unpacklo_epi16(p_16, shifted_16);
const __m128i wt_res_lo = _mm_madd_epi16(p_16_lo, wt);
const __m128i shifted_32 =
@ -207,7 +207,7 @@ static void vfilter8(const int16_t *src, int src_stride, uint8_t *dst,
if (conv_params->is_compound) {
if (conv_params->do_average) {
int32_t tmp = dst16[y * dst16_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {
@ -408,7 +408,7 @@ static void highbd_vfilter8(const int16_t *src, int src_stride, uint16_t *dst,
__m128i p_32 =
_mm_cvtepu16_epi32(_mm_loadl_epi64((__m128i *)dst_16_x));
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
shifted = _mm_add_epi32(_mm_mullo_epi32(p_32, wt0),
_mm_mullo_epi32(shifted, wt1));
shifted = _mm_srai_epi32(shifted, DIST_PRECISION_BITS);
@ -443,7 +443,7 @@ static void highbd_vfilter8(const int16_t *src, int src_stride, uint16_t *dst,
if (conv_params->is_compound) {
if (conv_params->do_average) {
int32_t tmp = dst16[y * dst16_stride + x];
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
tmp = tmp * conv_params->fwd_offset + res * conv_params->bck_offset;
tmp = tmp >> DIST_PRECISION_BITS;
} else {

View file

@ -1577,6 +1577,9 @@ static void idct64_low32_new_avx2(const __m256i *input, __m256i *output,
idct64_stage11_avx2(output, x);
}
typedef void (*transform_1d_avx2)(const __m256i *input, __m256i *output,
int8_t cos_bit);
// 1D functions process 16 pixels at one time.
static const transform_1d_avx2
lowbd_txfm_all_1d_zeros_w16_arr[TX_SIZES][ITX_TYPES_1D][4] = {

View file

@ -2437,9 +2437,10 @@ static INLINE void lowbd_inv_txfm2d_add_idtx_ssse3(const int32_t *input,
}
}
void lowbd_inv_txfm2d_add_4x4_ssse3(const int32_t *input, uint8_t *output,
int stride, TX_TYPE tx_type,
TX_SIZE tx_size_, int eob) {
static void lowbd_inv_txfm2d_add_4x4_ssse3(const int32_t *input,
uint8_t *output, int stride,
TX_TYPE tx_type, TX_SIZE tx_size_,
int eob) {
(void)tx_size_;
(void)eob;
__m128i buf[4];
@ -2708,9 +2709,10 @@ static INLINE void lowbd_inv_txfm2d_add_universe_ssse3(
}
}
void lowbd_inv_txfm2d_add_4x8_ssse3(const int32_t *input, uint8_t *output,
int stride, TX_TYPE tx_type,
TX_SIZE tx_size_, int eob) {
static void lowbd_inv_txfm2d_add_4x8_ssse3(const int32_t *input,
uint8_t *output, int stride,
TX_TYPE tx_type, TX_SIZE tx_size_,
int eob) {
(void)tx_size_;
(void)eob;
__m128i buf[8];
@ -2747,9 +2749,10 @@ void lowbd_inv_txfm2d_add_4x8_ssse3(const int32_t *input, uint8_t *output,
lowbd_write_buffer_4xn_sse2(buf, output, stride, ud_flip, txfm_size_row);
}
void lowbd_inv_txfm2d_add_8x4_ssse3(const int32_t *input, uint8_t *output,
int stride, TX_TYPE tx_type,
TX_SIZE tx_size_, int eob) {
static void lowbd_inv_txfm2d_add_8x4_ssse3(const int32_t *input,
uint8_t *output, int stride,
TX_TYPE tx_type, TX_SIZE tx_size_,
int eob) {
(void)tx_size_;
(void)eob;
__m128i buf[8];
@ -2786,9 +2789,10 @@ void lowbd_inv_txfm2d_add_8x4_ssse3(const int32_t *input, uint8_t *output,
lowbd_write_buffer_8xn_sse2(buf, output, stride, ud_flip, txfm_size_row);
}
void lowbd_inv_txfm2d_add_4x16_ssse3(const int32_t *input, uint8_t *output,
int stride, TX_TYPE tx_type,
TX_SIZE tx_size_, int eob) {
static void lowbd_inv_txfm2d_add_4x16_ssse3(const int32_t *input,
uint8_t *output, int stride,
TX_TYPE tx_type, TX_SIZE tx_size_,
int eob) {
(void)tx_size_;
(void)eob;
__m128i buf[16];
@ -2831,9 +2835,10 @@ void lowbd_inv_txfm2d_add_4x16_ssse3(const int32_t *input, uint8_t *output,
lowbd_write_buffer_4xn_sse2(buf, output, stride, ud_flip, txfm_size_row);
}
void lowbd_inv_txfm2d_add_16x4_ssse3(const int32_t *input, uint8_t *output,
int stride, TX_TYPE tx_type,
TX_SIZE tx_size_, int eob) {
static void lowbd_inv_txfm2d_add_16x4_ssse3(const int32_t *input,
uint8_t *output, int stride,
TX_TYPE tx_type, TX_SIZE tx_size_,
int eob) {
(void)tx_size_;
(void)eob;
__m128i buf[16];

View file

@ -72,13 +72,13 @@ static INLINE void round_shift_16bit_ssse3(__m128i *in, int size, int bit) {
}
// 1D itx types
typedef enum ATTRIBUTE_PACKED {
enum {
IDCT_1D,
IADST_1D,
IFLIPADST_1D = IADST_1D,
IIDENTITY_1D,
ITX_TYPES_1D,
} ITX_TYPE_1D;
} UENUM1BYTE(ITX_TYPE_1D);
static const ITX_TYPE_1D vitx_1d_tab[TX_TYPES] = {
IDCT_1D, IADST_1D, IDCT_1D, IADST_1D,

View file

@ -9,7 +9,7 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "config/aom_dsp_rtcd.h"
#include "config/av1_rtcd.h"
#include "av1/common/av1_txfm.h"
#include "av1/common/x86/av1_txfm_sse4.h"

View file

@ -27,21 +27,21 @@
subsample_##bd##_##sub##_8x8_ssse3, /* 8x8 */ \
subsample_##bd##_##sub##_16x16_ssse3, /* 16x16 */ \
subsample_##bd##_##sub##_32x32_avx2, /* 32x32 */ \
cfl_subsample_##bd##_null, /* 64x64 (invalid CFL size) */ \
NULL, /* 64x64 (invalid CFL size) */ \
subsample_##bd##_##sub##_4x8_ssse3, /* 4x8 */ \
subsample_##bd##_##sub##_8x4_ssse3, /* 8x4 */ \
subsample_##bd##_##sub##_8x16_ssse3, /* 8x16 */ \
subsample_##bd##_##sub##_16x8_ssse3, /* 16x8 */ \
subsample_##bd##_##sub##_16x32_ssse3, /* 16x32 */ \
subsample_##bd##_##sub##_32x16_avx2, /* 32x16 */ \
cfl_subsample_##bd##_null, /* 32x64 (invalid CFL size) */ \
cfl_subsample_##bd##_null, /* 64x32 (invalid CFL size) */ \
NULL, /* 32x64 (invalid CFL size) */ \
NULL, /* 64x32 (invalid CFL size) */ \
subsample_##bd##_##sub##_4x16_ssse3, /* 4x16 */ \
subsample_##bd##_##sub##_16x4_ssse3, /* 16x4 */ \
subsample_##bd##_##sub##_8x32_ssse3, /* 8x32 */ \
subsample_##bd##_##sub##_32x8_avx2, /* 32x8 */ \
cfl_subsample_##bd##_null, /* 16x64 (invalid CFL size) */ \
cfl_subsample_##bd##_null, /* 64x16 (invalid CFL size) */ \
NULL, /* 16x64 (invalid CFL size) */ \
NULL, /* 64x16 (invalid CFL size) */ \
}; \
return subfn_##sub[tx_size]; \
}
@ -279,21 +279,21 @@ cfl_predict_lbd_fn get_predict_lbd_fn_avx2(TX_SIZE tx_size) {
predict_lbd_8x8_ssse3, /* 8x8 */
predict_lbd_16x16_ssse3, /* 16x16 */
predict_lbd_32x32_avx2, /* 32x32 */
cfl_predict_lbd_null, /* 64x64 (invalid CFL size) */
NULL, /* 64x64 (invalid CFL size) */
predict_lbd_4x8_ssse3, /* 4x8 */
predict_lbd_8x4_ssse3, /* 8x4 */
predict_lbd_8x16_ssse3, /* 8x16 */
predict_lbd_16x8_ssse3, /* 16x8 */
predict_lbd_16x32_ssse3, /* 16x32 */
predict_lbd_32x16_avx2, /* 32x16 */
cfl_predict_lbd_null, /* 32x64 (invalid CFL size) */
cfl_predict_lbd_null, /* 64x32 (invalid CFL size) */
NULL, /* 32x64 (invalid CFL size) */
NULL, /* 64x32 (invalid CFL size) */
predict_lbd_4x16_ssse3, /* 4x16 */
predict_lbd_16x4_ssse3, /* 16x4 */
predict_lbd_8x32_ssse3, /* 8x32 */
predict_lbd_32x8_avx2, /* 32x8 */
cfl_predict_lbd_null, /* 16x64 (invalid CFL size) */
cfl_predict_lbd_null, /* 64x16 (invalid CFL size) */
NULL, /* 16x64 (invalid CFL size) */
NULL, /* 64x16 (invalid CFL size) */
};
// Modulo TX_SIZES_ALL to ensure that an attacker won't be able to index the
// function pointer array out of bounds.
@ -352,21 +352,21 @@ cfl_predict_hbd_fn get_predict_hbd_fn_avx2(TX_SIZE tx_size) {
predict_hbd_8x8_ssse3, /* 8x8 */
predict_hbd_16x16_avx2, /* 16x16 */
predict_hbd_32x32_avx2, /* 32x32 */
cfl_predict_hbd_null, /* 64x64 (invalid CFL size) */
NULL, /* 64x64 (invalid CFL size) */
predict_hbd_4x8_ssse3, /* 4x8 */
predict_hbd_8x4_ssse3, /* 8x4 */
predict_hbd_8x16_ssse3, /* 8x16 */
predict_hbd_16x8_avx2, /* 16x8 */
predict_hbd_16x32_avx2, /* 16x32 */
predict_hbd_32x16_avx2, /* 32x16 */
cfl_predict_hbd_null, /* 32x64 (invalid CFL size) */
cfl_predict_hbd_null, /* 64x32 (invalid CFL size) */
NULL, /* 32x64 (invalid CFL size) */
NULL, /* 64x32 (invalid CFL size) */
predict_hbd_4x16_ssse3, /* 4x16 */
predict_hbd_16x4_avx2, /* 16x4 */
predict_hbd_8x32_ssse3, /* 8x32 */
predict_hbd_32x8_avx2, /* 32x8 */
cfl_predict_hbd_null, /* 16x64 (invalid CFL size) */
cfl_predict_hbd_null, /* 64x16 (invalid CFL size) */
NULL, /* 16x64 (invalid CFL size) */
NULL, /* 64x16 (invalid CFL size) */
};
// Modulo TX_SIZES_ALL to ensure that an attacker won't be able to index the
// function pointer array out of bounds.
@ -469,21 +469,21 @@ cfl_subtract_average_fn get_subtract_average_fn_avx2(TX_SIZE tx_size) {
subtract_average_8x8_sse2, /* 8x8 */
subtract_average_16x16_avx2, /* 16x16 */
subtract_average_32x32_avx2, /* 32x32 */
cfl_subtract_average_null, /* 64x64 (invalid CFL size) */
NULL, /* 64x64 (invalid CFL size) */
subtract_average_4x8_sse2, /* 4x8 */
subtract_average_8x4_sse2, /* 8x4 */
subtract_average_8x16_sse2, /* 8x16 */
subtract_average_16x8_avx2, /* 16x8 */
subtract_average_16x32_avx2, /* 16x32 */
subtract_average_32x16_avx2, /* 32x16 */
cfl_subtract_average_null, /* 32x64 (invalid CFL size) */
cfl_subtract_average_null, /* 64x32 (invalid CFL size) */
NULL, /* 32x64 (invalid CFL size) */
NULL, /* 64x32 (invalid CFL size) */
subtract_average_4x16_sse2, /* 4x16 */
subtract_average_16x4_avx2, /* 16x4 */
subtract_average_8x32_sse2, /* 8x32 */
subtract_average_32x8_avx2, /* 32x8 */
cfl_subtract_average_null, /* 16x64 (invalid CFL size) */
cfl_subtract_average_null, /* 64x16 (invalid CFL size) */
NULL, /* 16x64 (invalid CFL size) */
NULL, /* 64x16 (invalid CFL size) */
};
// Modulo TX_SIZES_ALL to ensure that an attacker won't be able to
// index the function pointer array out of bounds.

View file

@ -195,20 +195,20 @@ void av1_convolve_2d_copy_sr_avx2(const uint8_t *src, int src_stride,
if (w == 2) {
do {
memcpy(dst, src, 2 * sizeof(*src));
memmove(dst, src, 2 * sizeof(*src));
src += src_stride;
dst += dst_stride;
memcpy(dst, src, 2 * sizeof(*src));
memmove(dst, src, 2 * sizeof(*src));
src += src_stride;
dst += dst_stride;
h -= 2;
} while (h);
} else if (w == 4) {
do {
memcpy(dst, src, 4 * sizeof(*src));
memmove(dst, src, 4 * sizeof(*src));
src += src_stride;
dst += dst_stride;
memcpy(dst, src, 4 * sizeof(*src));
memmove(dst, src, 4 * sizeof(*src));
src += src_stride;
dst += dst_stride;
h -= 2;

View file

@ -255,20 +255,20 @@ void av1_convolve_2d_copy_sr_sse2(const uint8_t *src, int src_stride,
if (w == 2) {
do {
memcpy(dst, src, 2 * sizeof(*src));
memmove(dst, src, 2 * sizeof(*src));
src += src_stride;
dst += dst_stride;
memcpy(dst, src, 2 * sizeof(*src));
memmove(dst, src, 2 * sizeof(*src));
src += src_stride;
dst += dst_stride;
h -= 2;
} while (h);
} else if (w == 4) {
do {
memcpy(dst, src, 4 * sizeof(*src));
memmove(dst, src, 4 * sizeof(*src));
src += src_stride;
dst += dst_stride;
memcpy(dst, src, 4 * sizeof(*src));
memmove(dst, src, 4 * sizeof(*src));
src += src_stride;
dst += dst_stride;
h -= 2;
@ -354,12 +354,11 @@ void av1_convolve_2d_copy_sr_sse2(const uint8_t *src, int src_stride,
}
}
void av1_jnt_convolve_2d_copy_sse2(const uint8_t *src, int src_stride,
uint8_t *dst0, int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_2d_copy_sse2(
const uint8_t *src, int src_stride, uint8_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
const int subpel_y_q4, ConvolveParams *conv_params) {
const int bd = 8;
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
@ -371,7 +370,7 @@ void av1_jnt_convolve_2d_copy_sse2(const uint8_t *src, int src_stride,
const int bits =
FILTER_BITS * 2 - conv_params->round_1 - conv_params->round_0;
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const __m128i zero = _mm_setzero_si128();
const __m128i left_shift = _mm_cvtsi32_si128(bits);
int i, j;
@ -411,14 +410,14 @@ void av1_jnt_convolve_2d_copy_sse2(const uint8_t *src, int src_stride,
const __m128i data_ref_0_hi =
_mm_loadu_si128((__m128i *)(&dst[j + 8]));
const __m128i comp_avg_res_lo =
comp_avg(&data_ref_0_lo, &res_unsigned_lo, &wt, use_jnt_comp_avg);
const __m128i comp_avg_res_lo = comp_avg(
&data_ref_0_lo, &res_unsigned_lo, &wt, use_dist_wtd_comp_avg);
const __m128i round_result_lo = convolve_rounding(
&comp_avg_res_lo, &offset_const, &rounding_const, rounding_shift);
const __m128i comp_avg_res_hi =
comp_avg(&data_ref_0_hi, &res_unsigned_hi, &wt, use_jnt_comp_avg);
const __m128i comp_avg_res_hi = comp_avg(
&data_ref_0_hi, &res_unsigned_hi, &wt, use_dist_wtd_comp_avg);
const __m128i round_result_hi = convolve_rounding(
&comp_avg_res_hi, &offset_const, &rounding_const, rounding_shift);
@ -449,7 +448,7 @@ void av1_jnt_convolve_2d_copy_sse2(const uint8_t *src, int src_stride,
const __m128i data_ref_0 = _mm_loadu_si128((__m128i *)(&dst[j]));
const __m128i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m128i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);

View file

@ -238,10 +238,10 @@ void av1_highbd_convolve_2d_copy_sr_avx2(
if (w == 2) {
do {
memcpy(dst, src, 2 * sizeof(*src));
memmove(dst, src, 2 * sizeof(*src));
src += src_stride;
dst += dst_stride;
memcpy(dst, src, 2 * sizeof(*src));
memmove(dst, src, 2 * sizeof(*src));
src += src_stride;
dst += dst_stride;
h -= 2;

View file

@ -21,7 +21,7 @@
#include "aom_dsp/x86/convolve_sse4_1.h"
#include "av1/common/convolve.h"
void av1_highbd_jnt_convolve_2d_copy_sse4_1(
void av1_highbd_dist_wtd_convolve_2d_copy_sse4_1(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
@ -37,7 +37,7 @@ void av1_highbd_jnt_convolve_2d_copy_sse4_1(
FILTER_BITS * 2 - conv_params->round_1 - conv_params->round_0;
const __m128i left_shift = _mm_cvtsi32_si128(bits);
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int w0 = conv_params->fwd_offset;
const int w1 = conv_params->bck_offset;
const __m128i wt0 = _mm_set1_epi32(w0);
@ -75,15 +75,17 @@ void av1_highbd_jnt_convolve_2d_copy_sse4_1(
const __m128i res_unsigned_lo =
_mm_add_epi32(res_32b_lo, offset_const);
const __m128i comp_avg_res_lo = highbd_comp_avg_sse4_1(
&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m128i comp_avg_res_lo =
highbd_comp_avg_sse4_1(&data_ref_0_lo, &res_unsigned_lo, &wt0,
&wt1, use_dist_wtd_comp_avg);
const __m128i res_32b_hi = _mm_unpackhi_epi16(res, zero);
const __m128i res_unsigned_hi =
_mm_add_epi32(res_32b_hi, offset_const);
const __m128i comp_avg_res_hi = highbd_comp_avg_sse4_1(
&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1, use_jnt_comp_avg);
const __m128i comp_avg_res_hi =
highbd_comp_avg_sse4_1(&data_ref_0_hi, &res_unsigned_hi, &wt0,
&wt1, use_dist_wtd_comp_avg);
const __m128i round_result_lo = highbd_convolve_rounding_sse2(
&comp_avg_res_lo, &offset_const, &rounding_const, rounding_shift);
@ -132,9 +134,9 @@ void av1_highbd_jnt_convolve_2d_copy_sse4_1(
_mm_add_epi32(res_32b_hi, offset_const);
const __m128i comp_avg_res_lo = highbd_comp_avg_sse4_1(
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_dist_wtd_comp_avg);
const __m128i comp_avg_res_hi = highbd_comp_avg_sse4_1(
&data_ref_1, &res_unsigned_hi, &wt0, &wt1, use_jnt_comp_avg);
&data_ref_1, &res_unsigned_hi, &wt0, &wt1, use_dist_wtd_comp_avg);
const __m128i round_result_lo = highbd_convolve_rounding_sse2(
&comp_avg_res_lo, &offset_const, &rounding_const, rounding_shift);
@ -166,7 +168,7 @@ void av1_highbd_jnt_convolve_2d_copy_sse4_1(
}
}
void av1_highbd_jnt_convolve_2d_sse4_1(
void av1_highbd_dist_wtd_convolve_2d_sse4_1(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
@ -179,7 +181,7 @@ void av1_highbd_jnt_convolve_2d_sse4_1(
int im_stride = MAX_SB_SIZE;
int i, j;
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int fo_vert = filter_params_y->taps / 2 - 1;
const int fo_horiz = filter_params_x->taps / 2 - 1;
const uint16_t *const src_ptr = src - fo_vert * src_stride - fo_horiz;
@ -359,8 +361,9 @@ void av1_highbd_jnt_convolve_2d_sse4_1(
const __m128i data_ref_0 = _mm_cvtepu16_epi32(data_0);
const __m128i comp_avg_res = highbd_comp_avg_sse4_1(
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m128i comp_avg_res =
highbd_comp_avg_sse4_1(&data_ref_0, &res_unsigned_lo, &wt0,
&wt1, use_dist_wtd_comp_avg);
const __m128i round_result = highbd_convolve_rounding_sse2(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -391,10 +394,12 @@ void av1_highbd_jnt_convolve_2d_sse4_1(
const __m128i data_ref_0_lo = _mm_cvtepu16_epi32(data_lo);
const __m128i data_ref_0_hi = _mm_cvtepu16_epi32(data_hi);
const __m128i comp_avg_res_lo = highbd_comp_avg_sse4_1(
&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m128i comp_avg_res_hi = highbd_comp_avg_sse4_1(
&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1, use_jnt_comp_avg);
const __m128i comp_avg_res_lo =
highbd_comp_avg_sse4_1(&data_ref_0_lo, &res_unsigned_lo, &wt0,
&wt1, use_dist_wtd_comp_avg);
const __m128i comp_avg_res_hi =
highbd_comp_avg_sse4_1(&data_ref_0_hi, &res_unsigned_hi, &wt0,
&wt1, use_dist_wtd_comp_avg);
const __m128i round_result_lo =
highbd_convolve_rounding_sse2(&comp_avg_res_lo, &offset_const,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -22,7 +22,7 @@
#include "aom_dsp/aom_filter.h"
#include "av1/common/convolve.h"
void av1_highbd_jnt_convolve_2d_copy_avx2(
void av1_highbd_dist_wtd_convolve_2d_copy_avx2(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
@ -38,7 +38,7 @@ void av1_highbd_jnt_convolve_2d_copy_avx2(
FILTER_BITS * 2 - conv_params->round_1 - conv_params->round_0;
const __m128i left_shift = _mm_cvtsi32_si128(bits);
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int w0 = conv_params->fwd_offset;
const int w1 = conv_params->bck_offset;
const __m256i wt0 = _mm256_set1_epi32(w0);
@ -78,15 +78,17 @@ void av1_highbd_jnt_convolve_2d_copy_avx2(
const __m256i res_unsigned_lo =
_mm256_add_epi32(res_32b_lo, offset_const);
const __m256i comp_avg_res_lo = highbd_comp_avg(
&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_lo =
highbd_comp_avg(&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i res_32b_hi = _mm256_unpackhi_epi16(res, zero);
const __m256i res_unsigned_hi =
_mm256_add_epi32(res_32b_hi, offset_const);
const __m256i comp_avg_res_hi = highbd_comp_avg(
&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_hi =
highbd_comp_avg(&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i round_result_lo = highbd_convolve_rounding(
&comp_avg_res_lo, &offset_const, &rounding_const, rounding_shift);
@ -135,8 +137,9 @@ void av1_highbd_jnt_convolve_2d_copy_avx2(
const __m256i res_unsigned_lo =
_mm256_add_epi32(res_32b, offset_const);
const __m256i comp_avg_res = highbd_comp_avg(
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res =
highbd_comp_avg(&data_ref_0, &res_unsigned_lo, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i round_result = highbd_convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -179,15 +182,17 @@ void av1_highbd_jnt_convolve_2d_copy_avx2(
const __m256i res_unsigned_lo =
_mm256_add_epi32(res_32b_lo, offset_const);
const __m256i comp_avg_res_lo = highbd_comp_avg(
&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_lo =
highbd_comp_avg(&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i res_32b_hi = _mm256_unpackhi_epi16(res, zero);
const __m256i res_unsigned_hi =
_mm256_add_epi32(res_32b_hi, offset_const);
const __m256i comp_avg_res_hi = highbd_comp_avg(
&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_hi =
highbd_comp_avg(&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i round_result_lo =
highbd_convolve_rounding(&comp_avg_res_lo, &offset_const,
@ -223,7 +228,7 @@ void av1_highbd_jnt_convolve_2d_copy_avx2(
}
}
void av1_highbd_jnt_convolve_2d_avx2(
void av1_highbd_dist_wtd_convolve_2d_avx2(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
@ -244,7 +249,7 @@ void av1_highbd_jnt_convolve_2d_avx2(
__m256i s[8], coeffs_y[4], coeffs_x[4];
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int w0 = conv_params->fwd_offset;
const int w1 = conv_params->bck_offset;
@ -364,8 +369,9 @@ void av1_highbd_jnt_convolve_2d_avx2(
const __m256i data_ref_0 = _mm256_unpacklo_epi16(data_01, zero);
const __m256i comp_avg_res = highbd_comp_avg(
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res =
highbd_comp_avg(&data_ref_0, &res_unsigned_lo, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i round_result = highbd_convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -409,10 +415,12 @@ void av1_highbd_jnt_convolve_2d_avx2(
const __m256i data_ref_0_lo = _mm256_unpacklo_epi16(data_01, zero);
const __m256i data_ref_0_hi = _mm256_unpackhi_epi16(data_01, zero);
const __m256i comp_avg_res_lo = highbd_comp_avg(
&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_hi = highbd_comp_avg(
&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_lo =
highbd_comp_avg(&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i comp_avg_res_hi =
highbd_comp_avg(&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i round_result_lo =
highbd_convolve_rounding(&comp_avg_res_lo, &offset_const,
@ -456,7 +464,7 @@ void av1_highbd_jnt_convolve_2d_avx2(
}
}
void av1_highbd_jnt_convolve_x_avx2(
void av1_highbd_dist_wtd_convolve_x_avx2(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
@ -473,7 +481,7 @@ void av1_highbd_jnt_convolve_x_avx2(
__m256i s[4], coeffs_x[4];
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int w0 = conv_params->fwd_offset;
const int w1 = conv_params->bck_offset;
const __m256i wt0 = _mm256_set1_epi32(w0);
@ -548,7 +556,7 @@ void av1_highbd_jnt_convolve_x_avx2(
const __m256i data_ref_0 = _mm256_unpacklo_epi16(data_01, zero);
const __m256i comp_avg_res = highbd_comp_avg(
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_dist_wtd_comp_avg);
const __m256i round_result = highbd_convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -588,10 +596,12 @@ void av1_highbd_jnt_convolve_x_avx2(
const __m256i data_ref_0_lo = _mm256_unpacklo_epi16(data_01, zero);
const __m256i data_ref_0_hi = _mm256_unpackhi_epi16(data_01, zero);
const __m256i comp_avg_res_lo = highbd_comp_avg(
&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_hi = highbd_comp_avg(
&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_lo =
highbd_comp_avg(&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i comp_avg_res_hi =
highbd_comp_avg(&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i round_result_lo = highbd_convolve_rounding(
&comp_avg_res_lo, &offset_const, &rounding_const, rounding_shift);
@ -623,7 +633,7 @@ void av1_highbd_jnt_convolve_x_avx2(
}
}
void av1_highbd_jnt_convolve_y_avx2(
void av1_highbd_dist_wtd_convolve_y_avx2(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
@ -640,7 +650,7 @@ void av1_highbd_jnt_convolve_y_avx2(
int i, j;
__m256i s[8], coeffs_y[4];
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int w0 = conv_params->fwd_offset;
const int w1 = conv_params->bck_offset;
@ -753,8 +763,9 @@ void av1_highbd_jnt_convolve_y_avx2(
const __m256i data_ref_0 = _mm256_unpacklo_epi16(data_01, zero);
const __m256i comp_avg_res = highbd_comp_avg(
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res =
highbd_comp_avg(&data_ref_0, &res_unsigned_lo, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i round_result = highbd_convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -799,10 +810,12 @@ void av1_highbd_jnt_convolve_y_avx2(
const __m256i data_ref_0_lo = _mm256_unpacklo_epi16(data_01, zero);
const __m256i data_ref_0_hi = _mm256_unpackhi_epi16(data_01, zero);
const __m256i comp_avg_res_lo = highbd_comp_avg(
&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_hi = highbd_comp_avg(
&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1, use_jnt_comp_avg);
const __m256i comp_avg_res_lo =
highbd_comp_avg(&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i comp_avg_res_hi =
highbd_comp_avg(&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1,
use_dist_wtd_comp_avg);
const __m256i round_result_lo =
highbd_convolve_rounding(&comp_avg_res_lo, &offset_const,

View file

@ -17,7 +17,7 @@
#include "aom_dsp/x86/convolve_sse2.h"
#include "aom_dsp/x86/convolve_sse4_1.h"
void av1_highbd_jnt_convolve_y_sse4_1(
void av1_highbd_dist_wtd_convolve_y_sse4_1(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
@ -33,7 +33,7 @@ void av1_highbd_jnt_convolve_y_sse4_1(
assert(bits >= 0);
int i, j;
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int w0 = conv_params->fwd_offset;
const int w1 = conv_params->bck_offset;
@ -121,10 +121,12 @@ void av1_highbd_jnt_convolve_y_sse4_1(
const __m128i data_ref_0 = _mm_unpacklo_epi16(data_0, zero);
const __m128i data_ref_1 = _mm_unpacklo_epi16(data_1, zero);
const __m128i comp_avg_res_0 = highbd_comp_avg_sse4_1(
&data_ref_0, &res_unsigned_lo_0, &wt0, &wt1, use_jnt_comp_avg);
const __m128i comp_avg_res_1 = highbd_comp_avg_sse4_1(
&data_ref_1, &res_unsigned_lo_1, &wt0, &wt1, use_jnt_comp_avg);
const __m128i comp_avg_res_0 =
highbd_comp_avg_sse4_1(&data_ref_0, &res_unsigned_lo_0, &wt0,
&wt1, use_dist_wtd_comp_avg);
const __m128i comp_avg_res_1 =
highbd_comp_avg_sse4_1(&data_ref_1, &res_unsigned_lo_1, &wt0,
&wt1, use_dist_wtd_comp_avg);
const __m128i round_result_0 =
highbd_convolve_rounding_sse2(&comp_avg_res_0, &offset_const,
@ -186,16 +188,16 @@ void av1_highbd_jnt_convolve_y_sse4_1(
const __m128i comp_avg_res_lo_0 =
highbd_comp_avg_sse4_1(&data_ref_0_lo_0, &res_unsigned_lo_0,
&wt0, &wt1, use_jnt_comp_avg);
&wt0, &wt1, use_dist_wtd_comp_avg);
const __m128i comp_avg_res_lo_1 =
highbd_comp_avg_sse4_1(&data_ref_0_lo_1, &res_unsigned_lo_1,
&wt0, &wt1, use_jnt_comp_avg);
&wt0, &wt1, use_dist_wtd_comp_avg);
const __m128i comp_avg_res_hi_0 =
highbd_comp_avg_sse4_1(&data_ref_0_hi_0, &res_unsigned_hi_0,
&wt0, &wt1, use_jnt_comp_avg);
&wt0, &wt1, use_dist_wtd_comp_avg);
const __m128i comp_avg_res_hi_1 =
highbd_comp_avg_sse4_1(&data_ref_0_hi_1, &res_unsigned_hi_1,
&wt0, &wt1, use_jnt_comp_avg);
&wt0, &wt1, use_dist_wtd_comp_avg);
const __m128i round_result_lo_0 =
highbd_convolve_rounding_sse2(&comp_avg_res_lo_0, &offset_const,
@ -257,7 +259,7 @@ void av1_highbd_jnt_convolve_y_sse4_1(
}
}
void av1_highbd_jnt_convolve_x_sse4_1(
void av1_highbd_dist_wtd_convolve_x_sse4_1(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
@ -274,7 +276,7 @@ void av1_highbd_jnt_convolve_x_sse4_1(
__m128i s[4], coeffs_x[4];
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int w0 = conv_params->fwd_offset;
const int w1 = conv_params->bck_offset;
const __m128i wt0 = _mm_set1_epi32(w0);
@ -339,7 +341,7 @@ void av1_highbd_jnt_convolve_x_sse4_1(
const __m128i data_ref_0 = _mm_unpacklo_epi16(data_0, zero);
const __m128i comp_avg_res = highbd_comp_avg_sse4_1(
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
&data_ref_0, &res_unsigned_lo, &wt0, &wt1, use_dist_wtd_comp_avg);
const __m128i round_result = highbd_convolve_rounding_sse2(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -359,10 +361,12 @@ void av1_highbd_jnt_convolve_x_sse4_1(
const __m128i data_ref_0_lo = _mm_unpacklo_epi16(data_0, zero);
const __m128i data_ref_0_hi = _mm_unpackhi_epi16(data_0, zero);
const __m128i comp_avg_res_lo = highbd_comp_avg_sse4_1(
&data_ref_0_lo, &res_unsigned_lo, &wt0, &wt1, use_jnt_comp_avg);
const __m128i comp_avg_res_hi = highbd_comp_avg_sse4_1(
&data_ref_0_hi, &res_unsigned_hi, &wt0, &wt1, use_jnt_comp_avg);
const __m128i comp_avg_res_lo =
highbd_comp_avg_sse4_1(&data_ref_0_lo, &res_unsigned_lo, &wt0,
&wt1, use_dist_wtd_comp_avg);
const __m128i comp_avg_res_hi =
highbd_comp_avg_sse4_1(&data_ref_0_hi, &res_unsigned_hi, &wt0,
&wt1, use_dist_wtd_comp_avg);
const __m128i round_result_lo = highbd_convolve_rounding_sse2(
&comp_avg_res_lo, &offset_const, &rounding_const, rounding_shift);

View file

@ -75,13 +75,20 @@ static INLINE void transpose_16x16(const __m128i *in, __m128i *out) {
out[63]);
}
static INLINE void transpose_32x32(const __m128i *input, __m128i *output) {
for (int j = 0; j < 8; j++) {
for (int i = 0; i < 8; i++) {
TRANSPOSE_4X4(input[i * 32 + j + 0], input[i * 32 + j + 8],
input[i * 32 + j + 16], input[i * 32 + j + 24],
output[j * 32 + i + 0], output[j * 32 + i + 8],
output[j * 32 + i + 16], output[j * 32 + i + 24]);
static INLINE void transpose_8nx8n(const __m128i *input, __m128i *output,
const int width, const int height) {
const int numcol = height >> 2;
const int numrow = width >> 2;
for (int j = 0; j < numrow; j++) {
for (int i = 0; i < numcol; i++) {
TRANSPOSE_4X4(input[i * width + j + (numrow * 0)],
input[i * width + j + (numrow * 1)],
input[i * width + j + (numrow * 2)],
input[i * width + j + (numrow * 3)],
output[j * height + i + (numcol * 0)],
output[j * height + i + (numcol * 1)],
output[j * height + i + (numcol * 2)],
output[j * height + i + (numcol * 3)]);
}
}
}

View file

@ -537,7 +537,7 @@ void av1_highbd_warp_affine_sse4_1(const int32_t *mat, const uint16_t *ref,
__m128i *const dst16 = (__m128i *)&pred[(i + k + 4) * p_stride + j];
__m128i p_32 = _mm_cvtepu16_epi32(_mm_loadl_epi64(p));
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
res_lo = _mm_add_epi32(_mm_mullo_epi32(p_32, wt0),
_mm_mullo_epi32(res_lo, wt1));
res_lo = _mm_srai_epi32(res_lo, DIST_PRECISION_BITS);
@ -570,7 +570,7 @@ void av1_highbd_warp_affine_sse4_1(const int32_t *mat, const uint16_t *ref,
(__m128i *)&pred[(i + k + 4) * p_stride + j + 4];
__m128i p4_32 = _mm_cvtepu16_epi32(_mm_loadl_epi64(p4));
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
res_hi = _mm_add_epi32(_mm_mullo_epi32(p4_32, wt0),
_mm_mullo_epi32(res_hi, wt1));
res_hi = _mm_srai_epi32(res_hi, DIST_PRECISION_BITS);

View file

@ -35,12 +35,12 @@ static INLINE __m256i load_line2_avx2(const void *a, const void *b) {
_mm256_castsi128_si256(_mm_loadu_si128((__m128i *)b)), 0x20);
}
void av1_jnt_convolve_x_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_x_avx2(const uint8_t *src, int src_stride,
uint8_t *dst0, int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int bd = 8;
@ -50,7 +50,7 @@ void av1_jnt_convolve_x_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
const int bits = FILTER_BITS - conv_params->round_1;
const __m256i wt = unpack_weights_avx2(conv_params);
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int offset_0 =
bd + 2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1;
const int offset = (1 << offset_0) + (1 << (offset_0 - 1));
@ -97,7 +97,7 @@ void av1_jnt_convolve_x_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
const __m256i data_ref_0 =
load_line2_avx2(&dst_data[j], &dst_data[j + dst_stride]);
const __m256i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m256i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -127,12 +127,12 @@ void av1_jnt_convolve_x_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
}
}
void av1_jnt_convolve_y_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_y_avx2(const uint8_t *src, int src_stride,
uint8_t *dst0, int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int bd = 8;
@ -146,7 +146,7 @@ void av1_jnt_convolve_y_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
const __m128i round_shift = _mm_cvtsi32_si128(conv_params->round_1);
const __m256i wt = unpack_weights_avx2(conv_params);
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int offset_0 =
bd + 2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1;
const int offset = (1 << offset_0) + (1 << (offset_0 - 1));
@ -230,8 +230,8 @@ void av1_jnt_convolve_y_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
if (do_average) {
const __m256i data_ref_0 = load_line2_avx2(
&dst[i * dst_stride + j], &dst[i * dst_stride + j + dst_stride]);
const __m256i comp_avg_res =
comp_avg(&data_ref_0, &res_lo_unsigned, &wt, use_jnt_comp_avg);
const __m256i comp_avg_res = comp_avg(&data_ref_0, &res_lo_unsigned,
&wt, use_dist_wtd_comp_avg);
const __m256i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -289,11 +289,11 @@ void av1_jnt_convolve_y_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
load_line2_avx2(&dst[i * dst_stride + j + 8],
&dst[i * dst_stride + j + 8 + dst_stride]);
const __m256i comp_avg_res_lo =
comp_avg(&data_ref_0_lo, &res_lo_unsigned, &wt, use_jnt_comp_avg);
const __m256i comp_avg_res_lo = comp_avg(
&data_ref_0_lo, &res_lo_unsigned, &wt, use_dist_wtd_comp_avg);
const __m256i comp_avg_res_hi =
comp_avg(&data_ref_0_hi, &res_hi_unsigned, &wt, use_jnt_comp_avg);
const __m256i comp_avg_res_hi = comp_avg(
&data_ref_0_hi, &res_hi_unsigned, &wt, use_dist_wtd_comp_avg);
const __m256i round_result_lo = convolve_rounding(
&comp_avg_res_lo, &offset_const, &rounding_const, rounding_shift);
@ -337,12 +337,12 @@ void av1_jnt_convolve_y_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
}
}
void av1_jnt_convolve_2d_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_2d_avx2(const uint8_t *src, int src_stride,
uint8_t *dst0, int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int bd = 8;
@ -356,7 +356,7 @@ void av1_jnt_convolve_2d_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
const uint8_t *const src_ptr = src - fo_vert * src_stride - fo_horiz;
const __m256i wt = unpack_weights_avx2(conv_params);
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int offset_0 =
bd + 2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1;
const int offset = (1 << offset_0) + (1 << (offset_0 - 1));
@ -448,8 +448,8 @@ void av1_jnt_convolve_2d_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
const __m256i data_ref_0 =
load_line2_avx2(&dst[i * dst_stride + j],
&dst[i * dst_stride + j + dst_stride]);
const __m256i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
const __m256i comp_avg_res = comp_avg(&data_ref_0, &res_unsigned,
&wt, use_dist_wtd_comp_avg);
const __m256i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -479,8 +479,8 @@ void av1_jnt_convolve_2d_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
load_line2_avx2(&dst[i * dst_stride + j],
&dst[i * dst_stride + j + dst_stride]);
const __m256i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
const __m256i comp_avg_res = comp_avg(&data_ref_0, &res_unsigned,
&wt, use_dist_wtd_comp_avg);
const __m256i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -517,12 +517,11 @@ void av1_jnt_convolve_2d_avx2(const uint8_t *src, int src_stride, uint8_t *dst0,
}
}
void av1_jnt_convolve_2d_copy_avx2(const uint8_t *src, int src_stride,
uint8_t *dst0, int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_2d_copy_avx2(
const uint8_t *src, int src_stride, uint8_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
const int subpel_y_q4, ConvolveParams *conv_params) {
const int bd = 8;
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
@ -535,7 +534,7 @@ void av1_jnt_convolve_2d_copy_avx2(const uint8_t *src, int src_stride,
FILTER_BITS * 2 - conv_params->round_1 - conv_params->round_0;
const __m128i left_shift = _mm_cvtsi32_si128(bits);
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const __m256i wt = unpack_weights_avx2(conv_params);
const __m256i zero = _mm256_setzero_si256();
@ -562,7 +561,7 @@ void av1_jnt_convolve_2d_copy_avx2(const uint8_t *src, int src_stride,
_mm256_loadu_si256((__m256i *)(&dst[i * dst_stride + j]));
const __m256i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m256i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -600,7 +599,7 @@ void av1_jnt_convolve_2d_copy_avx2(const uint8_t *src, int src_stride,
const __m256i data_ref_0 = load_line2_avx2(
&dst[i * dst_stride + j], &dst[i * dst_stride + j + dst_stride]);
const __m256i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m256i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);

View file

@ -16,12 +16,12 @@
#include "aom_dsp/aom_filter.h"
#include "aom_dsp/x86/convolve_sse2.h"
void av1_jnt_convolve_x_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_x_sse2(const uint8_t *src, int src_stride,
uint8_t *dst0, int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
const int bd = 8;
CONV_BUF_TYPE *dst = conv_params->dst;
const int dst_stride = conv_params->dst_stride;
@ -37,7 +37,7 @@ void av1_jnt_convolve_x_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
const __m128i wt1 = _mm_set1_epi16(w1);
const __m128i wt = _mm_unpacklo_epi16(wt0, wt1);
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int offset_0 =
bd + 2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1;
const int offset = (1 << offset_0) + (1 << (offset_0 - 1));
@ -77,7 +77,7 @@ void av1_jnt_convolve_x_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
const __m128i data_ref_0 = _mm_loadu_si128((__m128i *)dst);
const __m128i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m128i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -134,7 +134,7 @@ void av1_jnt_convolve_x_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
_mm_loadu_si128((__m128i *)(&dst[i * dst_stride + j]));
const __m128i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m128i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -150,12 +150,12 @@ void av1_jnt_convolve_x_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
}
}
void av1_jnt_convolve_y_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_y_sse2(const uint8_t *src, int src_stride,
uint8_t *dst0, int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
const int bd = 8;
CONV_BUF_TYPE *dst = conv_params->dst;
const int dst_stride = conv_params->dst_stride;
@ -167,7 +167,7 @@ void av1_jnt_convolve_y_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
const __m128i wt1 = _mm_set1_epi16(conv_params->bck_offset);
const __m128i wt = _mm_unpacklo_epi16(wt0, wt1);
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const int offset_0 =
bd + 2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1;
const int offset = (1 << offset_0) + (1 << (offset_0 - 1));
@ -225,7 +225,7 @@ void av1_jnt_convolve_y_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
const __m128i data_ref_0 = _mm_loadu_si128((__m128i *)dst);
const __m128i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m128i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -254,7 +254,7 @@ void av1_jnt_convolve_y_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
const __m128i data_ref_0 = _mm_loadu_si128((__m128i *)dst);
const __m128i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m128i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -331,7 +331,7 @@ void av1_jnt_convolve_y_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
_mm_loadu_si128((__m128i *)(&dst[i * dst_stride + j]));
const __m128i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m128i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -360,7 +360,7 @@ void av1_jnt_convolve_y_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
_mm_loadu_si128((__m128i *)(&dst[i * dst_stride + j]));
const __m128i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m128i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
@ -383,3 +383,233 @@ void av1_jnt_convolve_y_sse2(const uint8_t *src, int src_stride, uint8_t *dst0,
} while (j < w);
}
}
void av1_dist_wtd_convolve_2d_sse2(const uint8_t *src, int src_stride,
uint8_t *dst0, int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int bd = 8;
DECLARE_ALIGNED(16, int16_t,
im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE]);
int im_h = h + filter_params_y->taps - 1;
int im_stride = MAX_SB_SIZE;
int i, j;
const int fo_vert = filter_params_y->taps / 2 - 1;
const int fo_horiz = filter_params_x->taps / 2 - 1;
const int do_average = conv_params->do_average;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const uint8_t *const src_ptr = src - fo_vert * src_stride - fo_horiz;
const __m128i zero = _mm_setzero_si128();
const int w0 = conv_params->fwd_offset;
const int w1 = conv_params->bck_offset;
const __m128i wt0 = _mm_set1_epi16(w0);
const __m128i wt1 = _mm_set1_epi16(w1);
const __m128i wt = _mm_unpacklo_epi16(wt0, wt1);
const int offset_0 =
bd + 2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1;
const int offset = (1 << offset_0) + (1 << (offset_0 - 1));
const __m128i offset_const = _mm_set1_epi16(offset);
const int rounding_shift =
2 * FILTER_BITS - conv_params->round_0 - conv_params->round_1;
const __m128i rounding_const = _mm_set1_epi16((1 << rounding_shift) >> 1);
/* Horizontal filter */
{
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
filter_params_x, subpel_x_q4 & SUBPEL_MASK);
const __m128i coeffs_x = _mm_loadu_si128((__m128i *)x_filter);
// coeffs 0 1 0 1 2 3 2 3
const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_x, coeffs_x);
// coeffs 4 5 4 5 6 7 6 7
const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_x, coeffs_x);
// coeffs 0 1 0 1 0 1 0 1
const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
// coeffs 2 3 2 3 2 3 2 3
const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
// coeffs 4 5 4 5 4 5 4 5
const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
// coeffs 6 7 6 7 6 7 6 7
const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
const __m128i round_const = _mm_set1_epi32(
((1 << conv_params->round_0) >> 1) + (1 << (bd + FILTER_BITS - 1)));
const __m128i round_shift = _mm_cvtsi32_si128(conv_params->round_0);
for (i = 0; i < im_h; ++i) {
for (j = 0; j < w; j += 8) {
__m128i temp_lo, temp_hi;
const __m128i data =
_mm_loadu_si128((__m128i *)&src_ptr[i * src_stride + j]);
const __m128i src_lo = _mm_unpacklo_epi8(data, zero);
const __m128i src_hi = _mm_unpackhi_epi8(data, zero);
// Filter even-index pixels
const __m128i res_0 = _mm_madd_epi16(src_lo, coeff_01);
temp_lo = _mm_srli_si128(src_lo, 4);
temp_hi = _mm_slli_si128(src_hi, 12);
const __m128i src_2 = _mm_or_si128(temp_hi, temp_lo);
const __m128i res_2 = _mm_madd_epi16(src_2, coeff_23);
temp_lo = _mm_srli_si128(src_lo, 8);
temp_hi = _mm_slli_si128(src_hi, 8);
const __m128i src_4 = _mm_or_si128(temp_hi, temp_lo);
const __m128i res_4 = _mm_madd_epi16(src_4, coeff_45);
temp_lo = _mm_srli_si128(src_lo, 12);
temp_hi = _mm_slli_si128(src_hi, 4);
const __m128i src_6 = _mm_or_si128(temp_hi, temp_lo);
const __m128i res_6 = _mm_madd_epi16(src_6, coeff_67);
__m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4),
_mm_add_epi32(res_2, res_6));
res_even =
_mm_sra_epi32(_mm_add_epi32(res_even, round_const), round_shift);
// Filter odd-index pixels
temp_lo = _mm_srli_si128(src_lo, 2);
temp_hi = _mm_slli_si128(src_hi, 14);
const __m128i src_1 = _mm_or_si128(temp_hi, temp_lo);
const __m128i res_1 = _mm_madd_epi16(src_1, coeff_01);
temp_lo = _mm_srli_si128(src_lo, 6);
temp_hi = _mm_slli_si128(src_hi, 10);
const __m128i src_3 = _mm_or_si128(temp_hi, temp_lo);
const __m128i res_3 = _mm_madd_epi16(src_3, coeff_23);
temp_lo = _mm_srli_si128(src_lo, 10);
temp_hi = _mm_slli_si128(src_hi, 6);
const __m128i src_5 = _mm_or_si128(temp_hi, temp_lo);
const __m128i res_5 = _mm_madd_epi16(src_5, coeff_45);
temp_lo = _mm_srli_si128(src_lo, 14);
temp_hi = _mm_slli_si128(src_hi, 2);
const __m128i src_7 = _mm_or_si128(temp_hi, temp_lo);
const __m128i res_7 = _mm_madd_epi16(src_7, coeff_67);
__m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5),
_mm_add_epi32(res_3, res_7));
res_odd =
_mm_sra_epi32(_mm_add_epi32(res_odd, round_const), round_shift);
// Pack in the column order 0, 2, 4, 6, 1, 3, 5, 7
__m128i res = _mm_packs_epi32(res_even, res_odd);
_mm_store_si128((__m128i *)&im_block[i * im_stride + j], res);
}
}
}
/* Vertical filter */
{
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
filter_params_y, subpel_y_q4 & SUBPEL_MASK);
const __m128i coeffs_y = _mm_loadu_si128((__m128i *)y_filter);
// coeffs 0 1 0 1 2 3 2 3
const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_y, coeffs_y);
// coeffs 4 5 4 5 6 7 6 7
const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_y, coeffs_y);
// coeffs 0 1 0 1 0 1 0 1
const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
// coeffs 2 3 2 3 2 3 2 3
const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
// coeffs 4 5 4 5 4 5 4 5
const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
// coeffs 6 7 6 7 6 7 6 7
const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
const __m128i round_const = _mm_set1_epi32(
((1 << conv_params->round_1) >> 1) -
(1 << (bd + 2 * FILTER_BITS - conv_params->round_0 - 1)));
const __m128i round_shift = _mm_cvtsi32_si128(conv_params->round_1);
for (i = 0; i < h; ++i) {
for (j = 0; j < w; j += 8) {
// Filter even-index pixels
const int16_t *data = &im_block[i * im_stride + j];
const __m128i src_0 =
_mm_unpacklo_epi16(*(__m128i *)(data + 0 * im_stride),
*(__m128i *)(data + 1 * im_stride));
const __m128i src_2 =
_mm_unpacklo_epi16(*(__m128i *)(data + 2 * im_stride),
*(__m128i *)(data + 3 * im_stride));
const __m128i src_4 =
_mm_unpacklo_epi16(*(__m128i *)(data + 4 * im_stride),
*(__m128i *)(data + 5 * im_stride));
const __m128i src_6 =
_mm_unpacklo_epi16(*(__m128i *)(data + 6 * im_stride),
*(__m128i *)(data + 7 * im_stride));
const __m128i res_0 = _mm_madd_epi16(src_0, coeff_01);
const __m128i res_2 = _mm_madd_epi16(src_2, coeff_23);
const __m128i res_4 = _mm_madd_epi16(src_4, coeff_45);
const __m128i res_6 = _mm_madd_epi16(src_6, coeff_67);
const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
_mm_add_epi32(res_4, res_6));
// Filter odd-index pixels
const __m128i src_1 =
_mm_unpackhi_epi16(*(__m128i *)(data + 0 * im_stride),
*(__m128i *)(data + 1 * im_stride));
const __m128i src_3 =
_mm_unpackhi_epi16(*(__m128i *)(data + 2 * im_stride),
*(__m128i *)(data + 3 * im_stride));
const __m128i src_5 =
_mm_unpackhi_epi16(*(__m128i *)(data + 4 * im_stride),
*(__m128i *)(data + 5 * im_stride));
const __m128i src_7 =
_mm_unpackhi_epi16(*(__m128i *)(data + 6 * im_stride),
*(__m128i *)(data + 7 * im_stride));
const __m128i res_1 = _mm_madd_epi16(src_1, coeff_01);
const __m128i res_3 = _mm_madd_epi16(src_3, coeff_23);
const __m128i res_5 = _mm_madd_epi16(src_5, coeff_45);
const __m128i res_7 = _mm_madd_epi16(src_7, coeff_67);
const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
_mm_add_epi32(res_5, res_7));
// Rearrange pixels back into the order 0 ... 7
const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
const __m128i res_lo_round =
_mm_sra_epi32(_mm_add_epi32(res_lo, round_const), round_shift);
const __m128i res_hi_round =
_mm_sra_epi32(_mm_add_epi32(res_hi, round_const), round_shift);
const __m128i res_16b = _mm_packs_epi32(res_lo_round, res_hi_round);
const __m128i res_unsigned = _mm_add_epi16(res_16b, offset_const);
// Accumulate values into the destination buffer
if (do_average) {
const __m128i data_ref_0 =
_mm_loadu_si128((__m128i *)(&dst[i * dst_stride + j]));
const __m128i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m128i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);
const __m128i res_8 = _mm_packus_epi16(round_result, round_result);
if (w > 4)
_mm_storel_epi64((__m128i *)(&dst0[i * dst_stride0 + j]), res_8);
else
*(uint32_t *)(&dst0[i * dst_stride0 + j]) =
_mm_cvtsi128_si32(res_8);
} else {
_mm_store_si128((__m128i *)(&dst[i * dst_stride + j]), res_unsigned);
}
}
}
}
}

View file

@ -16,12 +16,11 @@
#include "aom_dsp/aom_filter.h"
#include "aom_dsp/x86/convolve_sse2.h"
void av1_jnt_convolve_2d_ssse3(const uint8_t *src, int src_stride,
uint8_t *dst0, int dst_stride0, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params) {
void av1_dist_wtd_convolve_2d_ssse3(
const uint8_t *src, int src_stride, uint8_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_q4,
const int subpel_y_q4, ConvolveParams *conv_params) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int bd = 8;
@ -34,7 +33,7 @@ void av1_jnt_convolve_2d_ssse3(const uint8_t *src, int src_stride,
const int fo_vert = filter_params_y->taps / 2 - 1;
const int fo_horiz = filter_params_x->taps / 2 - 1;
const int do_average = conv_params->do_average;
const int use_jnt_comp_avg = conv_params->use_jnt_comp_avg;
const int use_dist_wtd_comp_avg = conv_params->use_dist_wtd_comp_avg;
const uint8_t *const src_ptr = src - fo_vert * src_stride - fo_horiz;
const __m128i zero = _mm_setzero_si128();
@ -211,7 +210,7 @@ void av1_jnt_convolve_2d_ssse3(const uint8_t *src, int src_stride,
_mm_loadu_si128((__m128i *)(&dst[i * dst_stride + j]));
const __m128i comp_avg_res =
comp_avg(&data_ref_0, &res_unsigned, &wt, use_jnt_comp_avg);
comp_avg(&data_ref_0, &res_unsigned, &wt, use_dist_wtd_comp_avg);
const __m128i round_result = convolve_rounding(
&comp_avg_res, &offset_const, &rounding_const, rounding_shift);

View file

@ -577,7 +577,7 @@ static INLINE void store_vertical_filter_output(
__m128i *const dst8 = (__m128i *)&pred[(i + k + 4) * p_stride + j];
const __m128i p_16 = _mm_loadl_epi64(p);
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
const __m128i p_16_lo = _mm_unpacklo_epi16(p_16, temp_lo_16);
const __m128i wt_res_lo = _mm_madd_epi16(p_16_lo, *wt);
const __m128i shifted_32 =
@ -610,7 +610,7 @@ static INLINE void store_vertical_filter_output(
(__m128i *)&pred[(i + k + 4) * p_stride + j + 4];
const __m128i p4_16 = _mm_loadl_epi64(p4);
if (conv_params->use_jnt_comp_avg) {
if (conv_params->use_dist_wtd_comp_avg) {
const __m128i p_16_hi = _mm_unpacklo_epi16(p4_16, temp_hi_16);
const __m128i wt_res_hi = _mm_madd_epi16(p_16_hi, *wt);
const __m128i shifted_32 =

View file

@ -17,6 +17,7 @@
#include "av1/common/convolve.h"
#include "aom_dsp/aom_dsp_common.h"
#include "aom_dsp/aom_filter.h"
#include "aom_dsp/x86/convolve_avx2.h"
#include "aom_dsp/x86/synonyms.h"
#include "aom_dsp/x86/synonyms_avx2.h"
@ -25,236 +26,207 @@
// on the left.
// A row of, say, 8-bit pixels with values p0, p1, p2, ..., p30, p31 will be
// loaded and stored as [ p31 ... p17 p16 ][ p15 ... p1 p0 ].
// Exploiting the range of wiener filter coefficients,
// horizontal filtering can be done in 16 bit intermediate precision.
// The details are as follows :
// Consider the horizontal wiener filter coefficients of the following form :
// [C0, C1, C2, 2^(FILTER_BITS) -2 * (C0 + C1 + C2), C2, C1, C0]
// Subtracting 2^(FILTER_BITS) from the centre tap we get the following :
// [C0, C1, C2, -2 * (C0 + C1 + C2), C2, C1, C0]
// The sum of the product "C0 * p0 + C1 * p1 + C2 * p2 -2 * (C0 + C1 + C2) * p3
// + C2 * p4 + C1 * p5 + C0 * p6" would be in the range of signed 16 bit
// precision. Finally, after rounding the above result by round_0, we multiply
// the centre pixel by 2^(FILTER_BITS - round_0) and add it to get the
// horizontal filter output.
void av1_wiener_convolve_add_src_avx2(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, 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 ConvolveParams *conv_params) {
const int bd = 8;
assert(x_step_q4 == 16 && y_step_q4 == 16);
assert(!(w & 7));
(void)x_step_q4;
(void)y_step_q4;
DECLARE_ALIGNED(32, uint16_t,
temp[(MAX_SB_SIZE + SUBPEL_TAPS - 1) * MAX_SB_SIZE]);
int intermediate_height = h + SUBPEL_TAPS - 2;
memset(temp + (intermediate_height * MAX_SB_SIZE), 0, MAX_SB_SIZE);
const int center_tap = ((SUBPEL_TAPS - 1) / 2);
DECLARE_ALIGNED(32, int16_t, im_block[(MAX_SB_SIZE + SUBPEL_TAPS) * 8]);
int im_h = h + SUBPEL_TAPS - 2;
int im_stride = 8;
memset(im_block + (im_h * im_stride), 0, MAX_SB_SIZE);
int i, j;
const int center_tap = (SUBPEL_TAPS - 1) / 2;
const uint8_t *const src_ptr = src - center_tap * src_stride - center_tap;
const __m128i zero_128 = _mm_setzero_si128();
const __m256i zero_256 = _mm256_setzero_si256();
__m256i filt[4], coeffs_h[4], coeffs_v[4], filt_center;
assert(conv_params->round_0 > 0);
filt[0] = _mm256_load_si256((__m256i const *)filt1_global_avx2);
filt[1] = _mm256_load_si256((__m256i const *)filt2_global_avx2);
filt[2] = _mm256_load_si256((__m256i const *)filt3_global_avx2);
filt[3] = _mm256_load_si256((__m256i const *)filt4_global_avx2);
filt_center = _mm256_load_si256((__m256i const *)filt_center_global_avx2);
const __m128i coeffs_x = _mm_loadu_si128((__m128i *)filter_x);
const __m256i filter_coeffs_x = _mm256_broadcastsi128_si256(coeffs_x);
// coeffs 0 1 0 1 0 1 0 1
coeffs_h[0] =
_mm256_shuffle_epi8(filter_coeffs_x, _mm256_set1_epi16(0x0200u));
// coeffs 2 3 2 3 2 3 2 3
coeffs_h[1] =
_mm256_shuffle_epi8(filter_coeffs_x, _mm256_set1_epi16(0x0604u));
// coeffs 4 5 4 5 4 5 4 5
coeffs_h[2] =
_mm256_shuffle_epi8(filter_coeffs_x, _mm256_set1_epi16(0x0a08u));
// coeffs 6 7 6 7 6 7 6 7
coeffs_h[3] =
_mm256_shuffle_epi8(filter_coeffs_x, _mm256_set1_epi16(0x0e0cu));
const __m256i round_const_h =
_mm256_set1_epi16((1 << (conv_params->round_0 - 1)));
const __m128i round_shift_h = _mm_cvtsi32_si128(conv_params->round_0);
// Add an offset to account for the "add_src" part of the convolve function.
const __m128i offset = _mm_insert_epi16(zero_128, 1 << FILTER_BITS, 3);
const __m128i zero_128 = _mm_setzero_si128();
const __m128i offset_0 = _mm_insert_epi16(zero_128, 1 << FILTER_BITS, 3);
const __m128i coeffs_y = _mm_add_epi16(xx_loadu_128(filter_y), offset_0);
const __m256i clamp_low = zero_256;
const __m256i clamp_high =
_mm256_set1_epi16(WIENER_CLAMP_LIMIT(conv_params->round_0, bd) - 1);
const __m256i filter_coeffs_y = _mm256_broadcastsi128_si256(coeffs_y);
/* Horizontal filter */
{
// coeffs [ f7 f6 f5 f4 f3 f2 f1 f0 ]
const __m128i coeffs_x = _mm_add_epi16(xx_loadu_128(filter_x), offset);
// coeffs 0 1 0 1 0 1 0 1
coeffs_v[0] = _mm256_shuffle_epi32(filter_coeffs_y, 0x00);
// coeffs 2 3 2 3 2 3 2 3
coeffs_v[1] = _mm256_shuffle_epi32(filter_coeffs_y, 0x55);
// coeffs 4 5 4 5 4 5 4 5
coeffs_v[2] = _mm256_shuffle_epi32(filter_coeffs_y, 0xaa);
// coeffs 6 7 6 7 6 7 6 7
coeffs_v[3] = _mm256_shuffle_epi32(filter_coeffs_y, 0xff);
// coeffs [ f3 f2 f3 f2 f1 f0 f1 f0 ]
const __m128i coeffs_0123 = _mm_unpacklo_epi32(coeffs_x, coeffs_x);
// coeffs [ f7 f6 f7 f6 f5 f4 f5 f4 ]
const __m128i coeffs_4567 = _mm_unpackhi_epi32(coeffs_x, coeffs_x);
const __m256i round_const_v =
_mm256_set1_epi32((1 << (conv_params->round_1 - 1)));
const __m128i round_shift_v = _mm_cvtsi32_si128(conv_params->round_1);
// coeffs [ f1 f0 f1 f0 f1 f0 f1 f0 ]
const __m128i coeffs_01_128 = _mm_unpacklo_epi64(coeffs_0123, coeffs_0123);
// coeffs [ f3 f2 f3 f2 f3 f2 f3 f2 ]
const __m128i coeffs_23_128 = _mm_unpackhi_epi64(coeffs_0123, coeffs_0123);
// coeffs [ f5 f4 f5 f4 f5 f4 f5 f4 ]
const __m128i coeffs_45_128 = _mm_unpacklo_epi64(coeffs_4567, coeffs_4567);
// coeffs [ f7 f6 f7 f6 f7 f6 f7 f6 ]
const __m128i coeffs_67_128 = _mm_unpackhi_epi64(coeffs_4567, coeffs_4567);
for (j = 0; j < w; j += 8) {
for (i = 0; i < im_h; i += 2) {
__m256i data = _mm256_castsi128_si256(
_mm_loadu_si128((__m128i *)&src_ptr[(i * src_stride) + j]));
// coeffs [ f1 f0 f1 f0 f1 f0 f1 f0 ][ f1 f0 f1 f0 f1 f0 f1 f0 ]
const __m256i coeffs_01 = yy_set_m128i(coeffs_01_128, coeffs_01_128);
// coeffs [ f3 f2 f3 f2 f3 f2 f3 f2 ][ f3 f2 f3 f2 f3 f2 f3 f2 ]
const __m256i coeffs_23 = yy_set_m128i(coeffs_23_128, coeffs_23_128);
// coeffs [ f5 f4 f5 f4 f5 f4 f5 f4 ][ f5 f4 f5 f4 f5 f4 f5 f4 ]
const __m256i coeffs_45 = yy_set_m128i(coeffs_45_128, coeffs_45_128);
// coeffs [ f7 f6 f7 f6 f7 f6 f7 f6 ][ f7 f6 f7 f6 f7 f6 f7 f6 ]
const __m256i coeffs_67 = yy_set_m128i(coeffs_67_128, coeffs_67_128);
// Load the next line
if (i + 1 < im_h)
data = _mm256_inserti128_si256(
data,
_mm_loadu_si128(
(__m128i *)&src_ptr[(i * src_stride) + j + src_stride]),
1);
const __m256i round_const = _mm256_set1_epi32(
(1 << (conv_params->round_0 - 1)) + (1 << (bd + FILTER_BITS - 1)));
__m256i res = convolve_lowbd_x(data, coeffs_h, filt);
for (int i = 0; i < intermediate_height; ++i) {
for (int j = 0; j < w; j += 16) {
const uint8_t *data_ij = src_ptr + i * src_stride + j;
res =
_mm256_sra_epi16(_mm256_add_epi16(res, round_const_h), round_shift_h);
// Load 8-bit src data
const __m128i data_0 = xx_loadu_128(data_ij + 0);
const __m128i data_1 = xx_loadu_128(data_ij + 1);
const __m128i data_2 = xx_loadu_128(data_ij + 2);
const __m128i data_3 = xx_loadu_128(data_ij + 3);
const __m128i data_4 = xx_loadu_128(data_ij + 4);
const __m128i data_5 = xx_loadu_128(data_ij + 5);
const __m128i data_6 = xx_loadu_128(data_ij + 6);
const __m128i data_7 = xx_loadu_128(data_ij + 7);
__m256i data_0 = _mm256_shuffle_epi8(data, filt_center);
// (Zero-)Extend 8-bit data to 16-bit data
const __m256i src_0 = _mm256_cvtepu8_epi16(data_0);
const __m256i src_1 = _mm256_cvtepu8_epi16(data_1);
const __m256i src_2 = _mm256_cvtepu8_epi16(data_2);
const __m256i src_3 = _mm256_cvtepu8_epi16(data_3);
const __m256i src_4 = _mm256_cvtepu8_epi16(data_4);
const __m256i src_5 = _mm256_cvtepu8_epi16(data_5);
const __m256i src_6 = _mm256_cvtepu8_epi16(data_6);
const __m256i src_7 = _mm256_cvtepu8_epi16(data_7);
// multiply the center pixel by 2^(FILTER_BITS - round_0) and add it to
// the result
data_0 = _mm256_slli_epi16(data_0, FILTER_BITS - conv_params->round_0);
res = _mm256_add_epi16(res, data_0);
// Multiply src data by filter coeffs and sum pairs
const __m256i res_0 = _mm256_madd_epi16(src_0, coeffs_01);
const __m256i res_1 = _mm256_madd_epi16(src_1, coeffs_01);
const __m256i res_2 = _mm256_madd_epi16(src_2, coeffs_23);
const __m256i res_3 = _mm256_madd_epi16(src_3, coeffs_23);
const __m256i res_4 = _mm256_madd_epi16(src_4, coeffs_45);
const __m256i res_5 = _mm256_madd_epi16(src_5, coeffs_45);
const __m256i res_6 = _mm256_madd_epi16(src_6, coeffs_67);
const __m256i res_7 = _mm256_madd_epi16(src_7, coeffs_67);
// Calculate scalar product for even- and odd-indices separately,
// increasing to 32-bit precision
const __m256i res_even_sum = _mm256_add_epi32(
_mm256_add_epi32(res_0, res_4), _mm256_add_epi32(res_2, res_6));
const __m256i res_odd_sum = _mm256_add_epi32(
_mm256_add_epi32(res_1, res_5), _mm256_add_epi32(res_3, res_7));
const __m256i res_even = _mm256_srai_epi32(
_mm256_add_epi32(res_even_sum, round_const), conv_params->round_0);
const __m256i res_odd = _mm256_srai_epi32(
_mm256_add_epi32(res_odd_sum, round_const), conv_params->round_0);
// Reduce to 16-bit precision and pack even- and odd-index results
// back into one register. The _mm256_packs_epi32 intrinsic returns
// a register with the pixels ordered as follows:
// [ 15 13 11 9 14 12 10 8 ] [ 7 5 3 1 6 4 2 0 ]
const __m256i res = _mm256_packs_epi32(res_even, res_odd);
const __m256i res_clamped =
_mm256_min_epi16(_mm256_max_epi16(res, clamp_low), clamp_high);
// Store in a temporary array
yy_storeu_256(temp + i * MAX_SB_SIZE + j, res_clamped);
}
_mm256_store_si256((__m256i *)&im_block[i * im_stride], res);
}
}
/* Vertical filter */
{
// coeffs [ g7 g6 g5 g4 g3 g2 g1 g0 ]
const __m128i coeffs_y = _mm_add_epi16(xx_loadu_128(filter_y), offset);
/* Vertical filter */
{
__m256i src_0 = _mm256_loadu_si256((__m256i *)(im_block + 0 * im_stride));
__m256i src_1 = _mm256_loadu_si256((__m256i *)(im_block + 1 * im_stride));
__m256i src_2 = _mm256_loadu_si256((__m256i *)(im_block + 2 * im_stride));
__m256i src_3 = _mm256_loadu_si256((__m256i *)(im_block + 3 * im_stride));
__m256i src_4 = _mm256_loadu_si256((__m256i *)(im_block + 4 * im_stride));
__m256i src_5 = _mm256_loadu_si256((__m256i *)(im_block + 5 * im_stride));
// coeffs [ g3 g2 g3 g2 g1 g0 g1 g0 ]
const __m128i coeffs_0123 = _mm_unpacklo_epi32(coeffs_y, coeffs_y);
// coeffs [ g7 g6 g7 g6 g5 g4 g5 g4 ]
const __m128i coeffs_4567 = _mm_unpackhi_epi32(coeffs_y, coeffs_y);
__m256i s[8];
s[0] = _mm256_unpacklo_epi16(src_0, src_1);
s[1] = _mm256_unpacklo_epi16(src_2, src_3);
s[2] = _mm256_unpacklo_epi16(src_4, src_5);
// coeffs [ g1 g0 g1 g0 g1 g0 g1 g0 ]
const __m128i coeffs_01_128 = _mm_unpacklo_epi64(coeffs_0123, coeffs_0123);
// coeffs [ g3 g2 g3 g2 g3 g2 g3 g2 ]
const __m128i coeffs_23_128 = _mm_unpackhi_epi64(coeffs_0123, coeffs_0123);
// coeffs [ g5 g4 g5 g4 g5 g4 g5 g4 ]
const __m128i coeffs_45_128 = _mm_unpacklo_epi64(coeffs_4567, coeffs_4567);
// coeffs [ g7 g6 g7 g6 g7 g6 g7 g6 ]
const __m128i coeffs_67_128 = _mm_unpackhi_epi64(coeffs_4567, coeffs_4567);
s[4] = _mm256_unpackhi_epi16(src_0, src_1);
s[5] = _mm256_unpackhi_epi16(src_2, src_3);
s[6] = _mm256_unpackhi_epi16(src_4, src_5);
// coeffs [ g1 g0 g1 g0 g1 g0 g1 g0 ][ g1 g0 g1 g0 g1 g0 g1 g0 ]
const __m256i coeffs_01 = yy_set_m128i(coeffs_01_128, coeffs_01_128);
// coeffs [ g3 g2 g3 g2 g3 g2 g3 g2 ][ g3 g2 g3 g2 g3 g2 g3 g2 ]
const __m256i coeffs_23 = yy_set_m128i(coeffs_23_128, coeffs_23_128);
// coeffs [ g5 g4 g5 g4 g5 g4 g5 g4 ][ g5 g4 g5 g4 g5 g4 g5 g4 ]
const __m256i coeffs_45 = yy_set_m128i(coeffs_45_128, coeffs_45_128);
// coeffs [ g7 g6 g7 g6 g7 g6 g7 g6 ][ g7 g6 g7 g6 g7 g6 g7 g6 ]
const __m256i coeffs_67 = yy_set_m128i(coeffs_67_128, coeffs_67_128);
for (i = 0; i < h - 1; i += 2) {
const int16_t *data = &im_block[i * im_stride];
const __m256i round_const =
_mm256_set1_epi32((1 << (conv_params->round_1 - 1)) -
(1 << (bd + conv_params->round_1 - 1)));
const __m256i s6 =
_mm256_loadu_si256((__m256i *)(data + 6 * im_stride));
const __m256i s7 =
_mm256_loadu_si256((__m256i *)(data + 7 * im_stride));
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; j += 16) {
const uint16_t *data_ij = temp + i * MAX_SB_SIZE + j;
s[3] = _mm256_unpacklo_epi16(s6, s7);
s[7] = _mm256_unpackhi_epi16(s6, s7);
// Load 16-bit data from the output of the horizontal filter in
// which the pixels are ordered as follows:
// [ 15 13 11 9 14 12 10 8 ] [ 7 5 3 1 6 4 2 0 ]
const __m256i data_0 = yy_loadu_256(data_ij + 0 * MAX_SB_SIZE);
const __m256i data_1 = yy_loadu_256(data_ij + 1 * MAX_SB_SIZE);
const __m256i data_2 = yy_loadu_256(data_ij + 2 * MAX_SB_SIZE);
const __m256i data_3 = yy_loadu_256(data_ij + 3 * MAX_SB_SIZE);
const __m256i data_4 = yy_loadu_256(data_ij + 4 * MAX_SB_SIZE);
const __m256i data_5 = yy_loadu_256(data_ij + 5 * MAX_SB_SIZE);
const __m256i data_6 = yy_loadu_256(data_ij + 6 * MAX_SB_SIZE);
const __m256i data_7 = yy_loadu_256(data_ij + 7 * MAX_SB_SIZE);
__m256i res_a = convolve(s, coeffs_v);
__m256i res_b = convolve(s + 4, coeffs_v);
// Filter the even-indices, increasing to 32-bit precision
const __m256i src_0 = _mm256_unpacklo_epi16(data_0, data_1);
const __m256i src_2 = _mm256_unpacklo_epi16(data_2, data_3);
const __m256i src_4 = _mm256_unpacklo_epi16(data_4, data_5);
const __m256i src_6 = _mm256_unpacklo_epi16(data_6, data_7);
const __m256i res_a_round = _mm256_sra_epi32(
_mm256_add_epi32(res_a, round_const_v), round_shift_v);
const __m256i res_b_round = _mm256_sra_epi32(
_mm256_add_epi32(res_b, round_const_v), round_shift_v);
const __m256i res_0 = _mm256_madd_epi16(src_0, coeffs_01);
const __m256i res_2 = _mm256_madd_epi16(src_2, coeffs_23);
const __m256i res_4 = _mm256_madd_epi16(src_4, coeffs_45);
const __m256i res_6 = _mm256_madd_epi16(src_6, coeffs_67);
/* rounding code */
// 16 bit conversion
const __m256i res_16bit = _mm256_packs_epi32(res_a_round, res_b_round);
// 8 bit conversion and saturation to uint8
const __m256i res_8b = _mm256_packus_epi16(res_16bit, res_16bit);
const __m256i res_even = _mm256_add_epi32(
_mm256_add_epi32(res_0, res_2), _mm256_add_epi32(res_4, res_6));
const __m128i res_0 = _mm256_castsi256_si128(res_8b);
const __m128i res_1 = _mm256_extracti128_si256(res_8b, 1);
// Filter the odd-indices, increasing to 32-bit precision
const __m256i src_1 = _mm256_unpackhi_epi16(data_0, data_1);
const __m256i src_3 = _mm256_unpackhi_epi16(data_2, data_3);
const __m256i src_5 = _mm256_unpackhi_epi16(data_4, data_5);
const __m256i src_7 = _mm256_unpackhi_epi16(data_6, data_7);
// Store values into the destination buffer
__m128i *const p_0 = (__m128i *)&dst[i * dst_stride + j];
__m128i *const p_1 = (__m128i *)&dst[i * dst_stride + j + dst_stride];
const __m256i res_1 = _mm256_madd_epi16(src_1, coeffs_01);
const __m256i res_3 = _mm256_madd_epi16(src_3, coeffs_23);
const __m256i res_5 = _mm256_madd_epi16(src_5, coeffs_45);
const __m256i res_7 = _mm256_madd_epi16(src_7, coeffs_67);
_mm_storel_epi64(p_0, res_0);
_mm_storel_epi64(p_1, res_1);
const __m256i res_odd = _mm256_add_epi32(
_mm256_add_epi32(res_1, res_3), _mm256_add_epi32(res_5, res_7));
s[0] = s[1];
s[1] = s[2];
s[2] = s[3];
// Pixels are currently in the following order:
// res_even order: [ 14 12 10 8 ] [ 6 4 2 0 ]
// res_odd order: [ 15 13 11 9 ] [ 7 5 3 1 ]
//
// Rearrange the pixels into the following order:
// res_lo order: [ 11 10 9 8 ] [ 3 2 1 0 ]
// res_hi order: [ 15 14 13 12 ] [ 7 6 5 4 ]
const __m256i res_lo = _mm256_unpacklo_epi32(res_even, res_odd);
const __m256i res_hi = _mm256_unpackhi_epi32(res_even, res_odd);
s[4] = s[5];
s[5] = s[6];
s[6] = s[7];
}
if (h - i) {
s[0] = _mm256_permute2x128_si256(s[0], s[4], 0x20);
s[1] = _mm256_permute2x128_si256(s[1], s[5], 0x20);
s[2] = _mm256_permute2x128_si256(s[2], s[6], 0x20);
const __m256i res_lo_round = _mm256_srai_epi32(
_mm256_add_epi32(res_lo, round_const), conv_params->round_1);
const __m256i res_hi_round = _mm256_srai_epi32(
_mm256_add_epi32(res_hi, round_const), conv_params->round_1);
const int16_t *data = &im_block[i * im_stride];
const __m128i s6_ = _mm_loadu_si128((__m128i *)(data + 6 * im_stride));
const __m128i s7_ = _mm_loadu_si128((__m128i *)(data + 7 * im_stride));
// Reduce to 16-bit precision and pack into the correct order:
// [ 15 14 13 12 11 10 9 8 ][ 7 6 5 4 3 2 1 0 ]
const __m256i res_16bit =
_mm256_packs_epi32(res_lo_round, res_hi_round);
__m128i s3 = _mm_unpacklo_epi16(s6_, s7_);
__m128i s7 = _mm_unpackhi_epi16(s6_, s7_);
// Reduce to 8-bit precision. This messes up the order:
// [ - - - - - - - - 15 14 13 12 11 10 9 8 ]
// [ - - - - - - - - 7 6 5 4 3 2 1 0 ]
const __m256i res_8bit =
_mm256_packus_epi16(res_16bit, zero_256 /* don't care value */);
s[3] = _mm256_inserti128_si256(_mm256_castsi128_si256(s3), s7, 1);
__m256i convolveres = convolve(s, coeffs_v);
// Swap the two central 32-bit values to get the order:
// [ - - - - - - - - - - - - - - - - ]
// [ 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ]
const __m256i res_8bit2 = _mm256_permute4x64_epi64(res_8bit, 0xd8);
const __m256i res_round = _mm256_sra_epi32(
_mm256_add_epi32(convolveres, round_const_v), round_shift_v);
// Store the lower 128-bit lane in the dst array
xx_storeu_128(dst + i * dst_stride + j,
_mm256_castsi256_si128(res_8bit2));
/* rounding code */
// 16 bit conversion
__m128i reslo = _mm256_castsi256_si128(res_round);
__m128i reshi = _mm256_extracti128_si256(res_round, 1);
const __m128i res_16bit = _mm_packus_epi32(reslo, reshi);
// 8 bit conversion and saturation to uint8
const __m128i res_8b = _mm_packus_epi16(res_16bit, res_16bit);
__m128i *const p_0 = (__m128i *)&dst[i * dst_stride + j];
_mm_storel_epi64(p_0, res_8b);
}
}
}