1/*
2 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "vp8/common/loopfilter.h"
12#include "vpx_scale/yv12config.h"
13
14extern void vp8_memcpy_partial_neon(unsigned char *dst_ptr,
15                                    unsigned char *src_ptr,
16                                    int sz);
17
18
19void vp8_yv12_copy_partial_frame_neon(YV12_BUFFER_CONFIG *src_ybc,
20                                      YV12_BUFFER_CONFIG *dst_ybc)
21{
22    unsigned char *src_y, *dst_y;
23    int yheight;
24    int ystride;
25    int yoffset;
26    int linestocopy;
27
28    yheight  = src_ybc->y_height;
29    ystride  = src_ybc->y_stride;
30
31    /* number of MB rows to use in partial filtering */
32    linestocopy = (yheight >> 4) / PARTIAL_FRAME_FRACTION;
33    linestocopy = linestocopy ? linestocopy << 4 : 16;     /* 16 lines per MB */
34
35    /* Copy extra 4 so that full filter context is available if filtering done
36     * on the copied partial frame and not original. Partial filter does mb
37     * filtering for top row also, which can modify3 pixels above.
38     */
39    linestocopy += 4;
40    /* partial image starts at ~middle of frame (macroblock border) */
41    yoffset  = ystride * (((yheight >> 5) * 16) - 4);
42    src_y = src_ybc->y_buffer + yoffset;
43    dst_y = dst_ybc->y_buffer + yoffset;
44
45    vp8_memcpy_partial_neon(dst_y, src_y, ystride * linestocopy);
46}
47