@@ -420,7 +420,8 @@ typedef struct VP9Context {
// whole-frame cache
uint8_t *intra_pred_data[3];
VP9Filter *lflvl;
- DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[71 * 80];
+ // This requires 64 + 8 rows, with 80 bytes stride
+ DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[72 * 80];
// block reconstruction intermediates
int16_t *block_base, *block, *uvblock_base[2], *uvblock[2];
@@ -1176,8 +1176,10 @@ static av_always_inline void mc_luma_dir(VP9Context
*s, vp9_mc_func(*mc)[2],
ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
// FIXME bilinear filter only needs 0/1 pixels, not 3/4
+ // The arm/aarch64 _hv filters might read one more row than what
+ // actually is needed, so switch to emulated edge one line sooner.
if (x < !!mx * 3 || y < !!my * 3 ||
- x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) {
+ x + !!mx * 4 > w - bw || y + !!my * 5 > h - bh) {
s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
ref - !!my * 3 * ref_stride - !!mx * 3,