1474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/*
2474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *
4474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  Use of this source code is governed by a BSD-style license
5474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  that can be found in the LICENSE file in the root of the source
6474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  tree. An additional intellectual property rights grant can be found
7474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  in the file PATENTS.  All contributing project authors may
8474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org *  be found in the AUTHORS file in the root of the source tree.
9474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org */
10474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
11474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
125c1d3b27608a3f3f6028c069b9bf066a4de474b6hclam@chromium.org#include "vpx_config.h"
136fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org#include "vp8_rtcd.h"
145c1d3b27608a3f3f6028c069b9bf066a4de474b6hclam@chromium.org#include "vp8/encoder/block.h"
15474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#include <math.h>
16474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#include "vpx_mem/vpx_mem.h"
17474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#include "vp8/encoder/quantize.h"
18474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org#include "vp8/common/entropy.h"
19474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
20474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
215c1d3b27608a3f3f6028c069b9bf066a4de474b6hclam@chromium.org#if HAVE_NEON
22474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
23474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org/* vp8_quantize_mbX functions here differs from corresponding ones in
24474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * quantize.c only by using quantize_b_pair function pointer instead of
25474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org * the regular quantize_b function pointer */
26474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgvoid vp8_quantize_mby_neon(MACROBLOCK *x)
27474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org{
28474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    int i;
29474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
30474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org        && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
31474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
32474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    for (i = 0; i < 16; i+=2)
33474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org        x->quantize_b_pair(&x->block[i], &x->block[i+1],
34474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org                           &x->e_mbd.block[i], &x->e_mbd.block[i+1]);
35474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
36474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    if(has_2nd_order)
37474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org        x->quantize_b(&x->block[24], &x->e_mbd.block[24]);
38474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org}
39474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
40474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgvoid vp8_quantize_mb_neon(MACROBLOCK *x)
41474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org{
42474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    int i;
43474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    int has_2nd_order=(x->e_mbd.mode_info_context->mbmi.mode != B_PRED
44474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org        && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
45474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
46474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    for (i = 0; i < 24; i+=2)
47474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org        x->quantize_b_pair(&x->block[i], &x->block[i+1],
48474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org                           &x->e_mbd.block[i], &x->e_mbd.block[i+1]);
49474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
50474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    if (has_2nd_order)
51167514562bbce1eb0566271d6cb41d90d2b5ffa0hclam@chromium.org        x->quantize_b(&x->block[24], &x->e_mbd.block[24]);
52474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org}
53474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
54474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
55474eb7536515fb785e925cc9375d22817c416851hclam@chromium.orgvoid vp8_quantize_mbuv_neon(MACROBLOCK *x)
56474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org{
57474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    int i;
58474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
59474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org    for (i = 16; i < 24; i+=2)
60474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org        x->quantize_b_pair(&x->block[i], &x->block[i+1],
61474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org                           &x->e_mbd.block[i], &x->e_mbd.block[i+1]);
62474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org}
63474eb7536515fb785e925cc9375d22817c416851hclam@chromium.org
645c1d3b27608a3f3f6028c069b9bf066a4de474b6hclam@chromium.org#endif /* HAVE_NEON */
65