11b362b15af34006e6a11974088a46d42b903418eJohann/*
21b362b15af34006e6a11974088a46d42b903418eJohann *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
31b362b15af34006e6a11974088a46d42b903418eJohann *
41b362b15af34006e6a11974088a46d42b903418eJohann *  Use of this source code is governed by a BSD-style license
51b362b15af34006e6a11974088a46d42b903418eJohann *  that can be found in the LICENSE file in the root of the source
61b362b15af34006e6a11974088a46d42b903418eJohann *  tree. An additional intellectual property rights grant can be found
71b362b15af34006e6a11974088a46d42b903418eJohann *  in the file PATENTS.  All contributing project authors may
81b362b15af34006e6a11974088a46d42b903418eJohann *  be found in the AUTHORS file in the root of the source tree.
91b362b15af34006e6a11974088a46d42b903418eJohann */
101b362b15af34006e6a11974088a46d42b903418eJohann
111b362b15af34006e6a11974088a46d42b903418eJohann#include "vp8/common/loopfilter.h"
121b362b15af34006e6a11974088a46d42b903418eJohann#include "vpx_scale/yv12config.h"
131b362b15af34006e6a11974088a46d42b903418eJohann
141b362b15af34006e6a11974088a46d42b903418eJohannextern void vp8_memcpy_partial_neon(unsigned char *dst_ptr,
151b362b15af34006e6a11974088a46d42b903418eJohann                                    unsigned char *src_ptr,
161b362b15af34006e6a11974088a46d42b903418eJohann                                    int sz);
171b362b15af34006e6a11974088a46d42b903418eJohann
181b362b15af34006e6a11974088a46d42b903418eJohann
191b362b15af34006e6a11974088a46d42b903418eJohannvoid vp8_yv12_copy_partial_frame_neon(YV12_BUFFER_CONFIG *src_ybc,
201b362b15af34006e6a11974088a46d42b903418eJohann                                      YV12_BUFFER_CONFIG *dst_ybc)
211b362b15af34006e6a11974088a46d42b903418eJohann{
221b362b15af34006e6a11974088a46d42b903418eJohann    unsigned char *src_y, *dst_y;
231b362b15af34006e6a11974088a46d42b903418eJohann    int yheight;
241b362b15af34006e6a11974088a46d42b903418eJohann    int ystride;
251b362b15af34006e6a11974088a46d42b903418eJohann    int yoffset;
261b362b15af34006e6a11974088a46d42b903418eJohann    int linestocopy;
271b362b15af34006e6a11974088a46d42b903418eJohann
281b362b15af34006e6a11974088a46d42b903418eJohann    yheight  = src_ybc->y_height;
291b362b15af34006e6a11974088a46d42b903418eJohann    ystride  = src_ybc->y_stride;
301b362b15af34006e6a11974088a46d42b903418eJohann
311b362b15af34006e6a11974088a46d42b903418eJohann    /* number of MB rows to use in partial filtering */
321b362b15af34006e6a11974088a46d42b903418eJohann    linestocopy = (yheight >> 4) / PARTIAL_FRAME_FRACTION;
331b362b15af34006e6a11974088a46d42b903418eJohann    linestocopy = linestocopy ? linestocopy << 4 : 16;     /* 16 lines per MB */
341b362b15af34006e6a11974088a46d42b903418eJohann
351b362b15af34006e6a11974088a46d42b903418eJohann    /* Copy extra 4 so that full filter context is available if filtering done
361b362b15af34006e6a11974088a46d42b903418eJohann     * on the copied partial frame and not original. Partial filter does mb
371b362b15af34006e6a11974088a46d42b903418eJohann     * filtering for top row also, which can modify3 pixels above.
381b362b15af34006e6a11974088a46d42b903418eJohann     */
391b362b15af34006e6a11974088a46d42b903418eJohann    linestocopy += 4;
401b362b15af34006e6a11974088a46d42b903418eJohann    /* partial image starts at ~middle of frame (macroblock border) */
411b362b15af34006e6a11974088a46d42b903418eJohann    yoffset  = ystride * (((yheight >> 5) * 16) - 4);
421b362b15af34006e6a11974088a46d42b903418eJohann    src_y = src_ybc->y_buffer + yoffset;
431b362b15af34006e6a11974088a46d42b903418eJohann    dst_y = dst_ybc->y_buffer + yoffset;
441b362b15af34006e6a11974088a46d42b903418eJohann
451b362b15af34006e6a11974088a46d42b903418eJohann    vp8_memcpy_partial_neon(dst_y, src_y, ystride * linestocopy);
461b362b15af34006e6a11974088a46d42b903418eJohann}
47