...
 
Commits (4)
  • Janne Grunau's avatar
    intrabc: adjust right border to multiple of the block size · a2bda884
    Janne Grunau authored
    This fixes an overlapping memcpy with
    clusterfuzz-testcase-minimized-dav1d_fuzzer_mt-5734069753610240. This is
    a regression introduced by "intrabc: use visible width/height in mv
    correction".
    
    This reverts commit 7677c120.
    a2bda884
  • Jan Beich's avatar
    arm: assume NEON if built with it · 65305637
    Jan Beich authored
    Downstream may build with -march=armv7-a and/or -mfpu=neon or have
    those enabled by default e.g., on FreeBSD armv7. There's no point
    detecting NEON then only to fail if OS doesn't support getauxval().
    65305637
  • Jan Beich's avatar
    arm: detect NEON on FreeBSD armv6 · b10771e9
    Jan Beich authored
    FreeBSD 11.2 added AT_HWCAP via sysctl() while 12.0 added elf_aux_info()
    which requires less code to use and is cached by libc. Only support the
    latter to avoid cruft to be removed after 11.* EOL on 2021-09-30.
    b10771e9
  • Ronald S. Bultje's avatar
    Don't apply QM on lossless blocks · c9dd6a50
    Ronald S. Bultje authored
    Similar to use of 'lossless' variable in setup_segmentation_dequant()
    in libaom. Fixes #226 and #228.
    c9dd6a50
......@@ -147,6 +147,9 @@ if (host_machine.cpu_family() == 'aarch64' or
if cc.has_function('getauxval', prefix : '#include <sys/auxv.h>', args : test_args)
cdata.set('HAVE_GETAUXVAL', 1)
endif
if cc.has_function('elf_aux_info', prefix : '#include <sys/auxv.h>', args : test_args)
cdata.set('HAVE_ELF_AUX_INFO', 1)
endif
endif
# Compiler flag tests
......
......@@ -37,6 +37,11 @@
#endif
#define NEON_HWCAP HWCAP_ARM_NEON
#elif defined(HAVE_ELF_AUX_INFO) && ARCH_ARM
#include <sys/auxv.h>
#define NEON_HWCAP HWCAP_NEON
#elif defined(__ANDROID__)
#include <stdio.h>
#include <string.h>
......@@ -72,9 +77,15 @@ unsigned dav1d_get_cpu_flags_arm(void) {
unsigned flags = 0;
#if ARCH_AARCH64
flags |= DAV1D_ARM_CPU_FLAG_NEON;
#elif defined(__ARM_NEON)
flags |= DAV1D_ARM_CPU_FLAG_NEON;
#elif defined(HAVE_GETAUXVAL) && ARCH_ARM
unsigned long hw_cap = getauxval(AT_HWCAP);
flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0;
#elif defined(HAVE_ELF_AUX_INFO) && ARCH_ARM
unsigned long hw_cap = 0;
elf_aux_info(AT_HWCAP, &hw_cap, sizeof(hw_cap));
flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0;
#elif defined(__ANDROID__)
flags |= parse_proc_cpuinfo("neon") ? DAV1D_ARM_CPU_FLAG_NEON : 0;
#elif defined(__APPLE__)
......
......@@ -1264,16 +1264,17 @@ static int decode_b(Dav1dTileContext *const t,
}
int src_left = t->bx * 4 + (b->mv[0].x >> 3);
int src_top = t->by * 4 + (b->mv[0].y >> 3);
int src_right = src_left + w4 * 4;
int src_bottom = src_top + h4 * 4;
int src_right = src_left + bw4 * 4;
int src_bottom = src_top + bh4 * 4;
const int border_right = ((ts->tiling.col_end + (bw4 - 1)) & ~(bw4 - 1)) * 4;
// check against left or right tile boundary and adjust if necessary
if (src_left < border_left) {
src_right += border_left - src_left;
src_left += border_left - src_left;
} else if (src_right > ts->tiling.col_end * 4) {
src_left -= src_right - ts->tiling.col_end * 4;
src_right -= src_right - ts->tiling.col_end * 4;
} else if (src_right > border_right) {
src_left -= src_right - border_right;
src_right -= src_right - border_right;
}
// check against top tile boundary and adjust if necessary
if (src_top < border_top) {
......
......@@ -205,8 +205,9 @@ static int decode_coefs(Dav1dTileContext *const t,
// residual and sign
int dc_sign = 1;
const int lossless = f->frame_hdr->segmentation.lossless[b->seg_id];
const uint16_t *const dq_tbl = ts->dq[b->seg_id][plane];
const uint8_t *const qm_tbl = f->qm[is_1d || *txtp == IDTX][tx][plane];
const uint8_t *const qm_tbl = f->qm[lossless || is_1d || *txtp == IDTX][tx][plane];
const int dq_shift = imax(0, t_dim->ctx - 2);
const int bitdepth = BITDEPTH == 8 ? 8 : f->cur.p.bpc;
const int cf_min = -(1 << (7 + bitdepth));
......