133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// Copyright 2014 Google Inc. All Rights Reserved.
233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora//
333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// Use of this source code is governed by a BSD-style license
433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// that can be found in the COPYING file in the root of the source
533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// tree. An additional intellectual property rights grant can be found
633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// in the file PATENTS. All contributing project authors may
733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// be found in the AUTHORS file in the root of the source tree.
833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// -----------------------------------------------------------------------------
933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora//
1033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// MIPS version of dsp functions
1133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora//
1233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// Author(s):  Djordje Pesut    (djordje.pesut@imgtec.com)
1333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora//             Jovan Zelincevic (jovan.zelincevic@imgtec.com)
1433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
1533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora#include "./dsp.h"
1633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
1733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora#if defined(WEBP_USE_MIPS32)
1833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
197c8da7ce66017295a65ec028084b90800be377f8James Zern#include "./mips_macro.h"
207c8da7ce66017295a65ec028084b90800be377f8James Zern
2133f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic const int kC1 = 20091 + (1 << 16);
2233f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic const int kC2 = 35468;
2333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
2433f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic WEBP_INLINE int abs_mips32(int x) {
2533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int sign = x >> 31;
2633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  return (x ^ sign) - sign;
2733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
2833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
2933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// 4 pixels in, 2 pixels out
3033f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic WEBP_INLINE void do_filter2(uint8_t* p, int step) {
3133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int p1 = p[-2 * step], p0 = p[-step], q0 = p[0], q1 = p[step];
3233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a = 3 * (q0 - p0) + VP8ksclip1[p1 - q1];
3333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a1 = VP8ksclip2[(a + 4) >> 3];
3433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a2 = VP8ksclip2[(a + 3) >> 3];
3533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[-step] = VP8kclip1[p0 + a2];
3633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[    0] = VP8kclip1[q0 - a1];
3733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
3833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
3933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// 4 pixels in, 4 pixels out
4033f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic WEBP_INLINE void do_filter4(uint8_t* p, int step) {
4133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int p1 = p[-2 * step], p0 = p[-step], q0 = p[0], q1 = p[step];
4233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a = 3 * (q0 - p0);
4333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a1 = VP8ksclip2[(a + 4) >> 3];
4433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a2 = VP8ksclip2[(a + 3) >> 3];
4533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a3 = (a1 + 1) >> 1;
4633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[-2 * step] = VP8kclip1[p1 + a3];
4733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[-    step] = VP8kclip1[p0 + a2];
4833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[        0] = VP8kclip1[q0 - a1];
4933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[     step] = VP8kclip1[q1 - a3];
5033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
5133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
5233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// 6 pixels in, 6 pixels out
5333f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic WEBP_INLINE void do_filter6(uint8_t* p, int step) {
5433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int p2 = p[-3 * step], p1 = p[-2 * step], p0 = p[-step];
5533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int q0 = p[0], q1 = p[step], q2 = p[2 * step];
5633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a = VP8ksclip1[3 * (q0 - p0) + VP8ksclip1[p1 - q1]];
577c8da7ce66017295a65ec028084b90800be377f8James Zern  // a is in [-128,127], a1 in [-27,27], a2 in [-18,18] and a3 in [-9,9]
5833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a1 = (27 * a + 63) >> 7;  // eq. to ((3 * a + 7) * 9) >> 7
5933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a2 = (18 * a + 63) >> 7;  // eq. to ((2 * a + 7) * 9) >> 7
6033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int a3 = (9  * a + 63) >> 7;  // eq. to ((1 * a + 7) * 9) >> 7
6133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[-3 * step] = VP8kclip1[p2 + a3];
6233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[-2 * step] = VP8kclip1[p1 + a2];
6333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[-    step] = VP8kclip1[p0 + a1];
6433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[        0] = VP8kclip1[q0 - a1];
6533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[     step] = VP8kclip1[q1 - a2];
6633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  p[ 2 * step] = VP8kclip1[q2 - a3];
6733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
6833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
6933f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic WEBP_INLINE int hev(const uint8_t* p, int step, int thresh) {
7033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int p1 = p[-2 * step], p0 = p[-step], q0 = p[0], q1 = p[step];
7133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  return (abs_mips32(p1 - p0) > thresh) || (abs_mips32(q1 - q0) > thresh);
7233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
7333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
747c8da7ce66017295a65ec028084b90800be377f8James Zernstatic WEBP_INLINE int needs_filter(const uint8_t* p, int step, int t) {
7533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int p1 = p[-2 * step], p0 = p[-step], q0 = p[0], q1 = p[step];
767c8da7ce66017295a65ec028084b90800be377f8James Zern  return ((4 * abs_mips32(p0 - q0) + abs_mips32(p1 - q1)) <= t);
7733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
7833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
7933f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic WEBP_INLINE int needs_filter2(const uint8_t* p,
8033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                                     int step, int t, int it) {
8133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int p3 = p[-4 * step], p2 = p[-3 * step];
8233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int p1 = p[-2 * step], p0 = p[-step];
8333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  const int q0 = p[0], q1 = p[step], q2 = p[2 * step], q3 = p[3 * step];
847c8da7ce66017295a65ec028084b90800be377f8James Zern  if ((4 * abs_mips32(p0 - q0) + abs_mips32(p1 - q1)) > t) {
8533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    return 0;
8633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
8733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  return abs_mips32(p3 - p2) <= it && abs_mips32(p2 - p1) <= it &&
8833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora         abs_mips32(p1 - p0) <= it && abs_mips32(q3 - q2) <= it &&
8933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora         abs_mips32(q2 - q1) <= it && abs_mips32(q1 - q0) <= it;
9033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
9133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
9233f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic WEBP_INLINE void FilterLoop26(uint8_t* p,
9333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                                     int hstride, int vstride, int size,
9433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                                     int thresh, int ithresh, int hev_thresh) {
957c8da7ce66017295a65ec028084b90800be377f8James Zern  const int thresh2 = 2 * thresh + 1;
9633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  while (size-- > 0) {
977c8da7ce66017295a65ec028084b90800be377f8James Zern    if (needs_filter2(p, hstride, thresh2, ithresh)) {
9833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      if (hev(p, hstride, hev_thresh)) {
9933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora        do_filter2(p, hstride);
10033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      } else {
10133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora        do_filter6(p, hstride);
10233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      }
10333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    }
10433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    p += vstride;
10533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
10633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
10733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
10833f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic WEBP_INLINE void FilterLoop24(uint8_t* p,
10933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                                     int hstride, int vstride, int size,
11033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                                     int thresh, int ithresh, int hev_thresh) {
1117c8da7ce66017295a65ec028084b90800be377f8James Zern  const int thresh2 = 2 * thresh + 1;
11233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  while (size-- > 0) {
1137c8da7ce66017295a65ec028084b90800be377f8James Zern    if (needs_filter2(p, hstride, thresh2, ithresh)) {
11433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      if (hev(p, hstride, hev_thresh)) {
11533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora        do_filter2(p, hstride);
11633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      } else {
11733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora        do_filter4(p, hstride);
11833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      }
11933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    }
12033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    p += vstride;
12133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
12233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
12333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
12433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// on macroblock edges
12533f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void VFilter16(uint8_t* p, int stride,
12633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                      int thresh, int ithresh, int hev_thresh) {
12733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop26(p, stride, 1, 16, thresh, ithresh, hev_thresh);
12833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
12933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
13033f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void HFilter16(uint8_t* p, int stride,
13133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                      int thresh, int ithresh, int hev_thresh) {
13233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop26(p, 1, stride, 16, thresh, ithresh, hev_thresh);
13333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
13433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
13533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// 8-pixels wide variant, for chroma filtering
13633f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void VFilter8(uint8_t* u, uint8_t* v, int stride,
13733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                     int thresh, int ithresh, int hev_thresh) {
13833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop26(u, stride, 1, 8, thresh, ithresh, hev_thresh);
13933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop26(v, stride, 1, 8, thresh, ithresh, hev_thresh);
14033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
14133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
14233f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void HFilter8(uint8_t* u, uint8_t* v, int stride,
14333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                     int thresh, int ithresh, int hev_thresh) {
14433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop26(u, 1, stride, 8, thresh, ithresh, hev_thresh);
14533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop26(v, 1, stride, 8, thresh, ithresh, hev_thresh);
14633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
14733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
14833f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void VFilter8i(uint8_t* u, uint8_t* v, int stride,
14933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                      int thresh, int ithresh, int hev_thresh) {
15033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop24(u + 4 * stride, stride, 1, 8, thresh, ithresh, hev_thresh);
15133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop24(v + 4 * stride, stride, 1, 8, thresh, ithresh, hev_thresh);
15233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
15333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
15433f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void HFilter8i(uint8_t* u, uint8_t* v, int stride,
15533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                      int thresh, int ithresh, int hev_thresh) {
15633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop24(u + 4, 1, stride, 8, thresh, ithresh, hev_thresh);
15733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  FilterLoop24(v + 4, 1, stride, 8, thresh, ithresh, hev_thresh);
15833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
15933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
16033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// on three inner edges
16133f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void VFilter16i(uint8_t* p, int stride,
16233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                       int thresh, int ithresh, int hev_thresh) {
16333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int k;
16433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  for (k = 3; k > 0; --k) {
16533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    p += 4 * stride;
16633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    FilterLoop24(p, stride, 1, 16, thresh, ithresh, hev_thresh);
16733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
16833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
16933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
17033f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void HFilter16i(uint8_t* p, int stride,
17133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora                       int thresh, int ithresh, int hev_thresh) {
17233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int k;
17333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  for (k = 3; k > 0; --k) {
17433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    p += 4;
17533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    FilterLoop24(p, 1, stride, 16, thresh, ithresh, hev_thresh);
17633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
17733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
17833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
17933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora//------------------------------------------------------------------------------
18033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// Simple In-loop filtering (Paragraph 15.2)
18133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
18233f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void SimpleVFilter16(uint8_t* p, int stride, int thresh) {
18333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int i;
1847c8da7ce66017295a65ec028084b90800be377f8James Zern  const int thresh2 = 2 * thresh + 1;
18533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  for (i = 0; i < 16; ++i) {
1867c8da7ce66017295a65ec028084b90800be377f8James Zern    if (needs_filter(p + i, stride, thresh2)) {
18733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      do_filter2(p + i, stride);
18833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    }
18933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
19033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
19133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
19233f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void SimpleHFilter16(uint8_t* p, int stride, int thresh) {
19333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int i;
1947c8da7ce66017295a65ec028084b90800be377f8James Zern  const int thresh2 = 2 * thresh + 1;
19533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  for (i = 0; i < 16; ++i) {
1967c8da7ce66017295a65ec028084b90800be377f8James Zern    if (needs_filter(p + i * stride, 1, thresh2)) {
19733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      do_filter2(p + i * stride, 1);
19833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    }
19933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
20033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
20133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
20233f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void SimpleVFilter16i(uint8_t* p, int stride, int thresh) {
20333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int k;
20433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  for (k = 3; k > 0; --k) {
20533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    p += 4 * stride;
20633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    SimpleVFilter16(p, stride, thresh);
20733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
20833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
20933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
21033f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void SimpleHFilter16i(uint8_t* p, int stride, int thresh) {
21133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int k;
21233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  for (k = 3; k > 0; --k) {
21333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    p += 4;
21433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    SimpleHFilter16(p, stride, thresh);
21533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
21633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
21733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
21833f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void TransformOne(const int16_t* in, uint8_t* dst) {
21933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int temp0, temp1, temp2, temp3, temp4;
22033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int temp5, temp6, temp7, temp8, temp9;
22133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int temp10, temp11, temp12, temp13, temp14;
22233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int temp15, temp16, temp17, temp18;
22333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  int16_t* p_in = (int16_t*)in;
22433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
22533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  // loops unrolled and merged to avoid usage of tmp buffer
22633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  // and to reduce number of stalls. MUL macro is written
22733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  // in assembler and inlined
22833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  __asm__ volatile(
22933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp0],  0(%[in])                      \n\t"
23033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp8],  16(%[in])                     \n\t"
23133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp4],  8(%[in])                      \n\t"
23233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp12], 24(%[in])                     \n\t"
23333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp16], %[temp0],  %[temp8]           \n\t"
23433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp0],  %[temp0],  %[temp8]           \n\t"
23533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp8],  %[temp4],  %[kC2]             \n\t"
23633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp17], %[temp12], %[kC1]             \n\t"
23733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp4],  %[temp4],  %[kC1]             \n\t"
23833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp12], %[temp12], %[kC2]             \n\t"
23933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp1],  2(%[in])                      \n\t"
24033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp5],  10(%[in])                     \n\t"
24133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp9],  18(%[in])                     \n\t"
24233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp13], 26(%[in])                     \n\t"
24333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp8],  %[temp8],  16                 \n\t"
24433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp17], %[temp17], 16                 \n\t"
24533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp4],  %[temp4],  16                 \n\t"
24633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp12], %[temp12], 16                 \n\t"
24733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp2],  4(%[in])                      \n\t"
24833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp6],  12(%[in])                     \n\t"
24933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp10], 20(%[in])                     \n\t"
25033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp14], 28(%[in])                     \n\t"
25133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp17], %[temp8],  %[temp17]          \n\t"
25233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp4],  %[temp4],  %[temp12]          \n\t"
25333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp8],  %[temp16], %[temp4]           \n\t"
25433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp4],  %[temp16], %[temp4]           \n\t"
25533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp16], %[temp1],  %[temp9]           \n\t"
25633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp1],  %[temp1],  %[temp9]           \n\t"
25733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp3],  6(%[in])                      \n\t"
25833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp7],  14(%[in])                     \n\t"
25933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp11], 22(%[in])                     \n\t"
26033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "lh       %[temp15], 30(%[in])                     \n\t"
26133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp12], %[temp0],  %[temp17]          \n\t"
26233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp0],  %[temp0],  %[temp17]          \n\t"
26333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp9],  %[temp5],  %[kC2]             \n\t"
26433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp17], %[temp13], %[kC1]             \n\t"
26533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp5],  %[temp5],  %[kC1]             \n\t"
26633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp13], %[temp13], %[kC2]             \n\t"
26733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp9],  %[temp9],  16                 \n\t"
26833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp17], %[temp17], 16                 \n\t"
26933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp17], %[temp9],  %[temp17]          \n\t"
27033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp5],  %[temp5],  16                 \n\t"
27133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp13], %[temp13], 16                 \n\t"
27233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp5],  %[temp5],  %[temp13]          \n\t"
27333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp13], %[temp1],  %[temp17]          \n\t"
27433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp1],  %[temp1],  %[temp17]          \n\t"
27533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp17], %[temp14], %[kC1]             \n\t"
27633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp14], %[temp14], %[kC2]             \n\t"
27733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp9],  %[temp16], %[temp5]           \n\t"
27833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp5],  %[temp16], %[temp5]           \n\t"
27933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp16], %[temp2],  %[temp10]          \n\t"
28033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp2],  %[temp2],  %[temp10]          \n\t"
28133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp10], %[temp6],  %[kC2]             \n\t"
28233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp6],  %[temp6],  %[kC1]             \n\t"
28333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp17], %[temp17], 16                 \n\t"
28433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp14], %[temp14], 16                 \n\t"
28533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp10], %[temp10], 16                 \n\t"
28633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp6],  %[temp6],  16                 \n\t"
28733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp17], %[temp10], %[temp17]          \n\t"
28833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp6],  %[temp6],  %[temp14]          \n\t"
28933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp10], %[temp16], %[temp6]           \n\t"
29033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp6],  %[temp16], %[temp6]           \n\t"
29133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp14], %[temp2],  %[temp17]          \n\t"
29233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp2],  %[temp2],  %[temp17]          \n\t"
29333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp17], %[temp15], %[kC1]             \n\t"
29433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp15], %[temp15], %[kC2]             \n\t"
29533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp16], %[temp3],  %[temp11]          \n\t"
29633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp3],  %[temp3],  %[temp11]          \n\t"
29733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp11], %[temp7],  %[kC2]             \n\t"
29833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp7],  %[temp7],  %[kC1]             \n\t"
29933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addiu    %[temp8],  %[temp8],  4                  \n\t"
30033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addiu    %[temp12], %[temp12], 4                  \n\t"
30133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addiu    %[temp0],  %[temp0],  4                  \n\t"
30233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addiu    %[temp4],  %[temp4],  4                  \n\t"
30333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp17], %[temp17], 16                 \n\t"
30433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp15], %[temp15], 16                 \n\t"
30533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp11], %[temp11], 16                 \n\t"
30633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp7],  %[temp7],  16                 \n\t"
30733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp17], %[temp11], %[temp17]          \n\t"
30833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp7],  %[temp7],  %[temp15]          \n\t"
30933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp15], %[temp3],  %[temp17]          \n\t"
31033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp3],  %[temp3],  %[temp17]          \n\t"
31133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp11], %[temp16], %[temp7]           \n\t"
31233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp7],  %[temp16], %[temp7]           \n\t"
31333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp16], %[temp8],  %[temp10]          \n\t"
31433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp8],  %[temp8],  %[temp10]          \n\t"
31533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp10], %[temp9],  %[kC2]             \n\t"
31633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp17], %[temp11], %[kC1]             \n\t"
31733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp9],  %[temp9],  %[kC1]             \n\t"
31833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp11], %[temp11], %[kC2]             \n\t"
31933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp10], %[temp10], 16                 \n\t"
32033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp17], %[temp17], 16                 \n\t"
32133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp9],  %[temp9],  16                 \n\t"
32233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp11], %[temp11], 16                 \n\t"
32333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp17], %[temp10], %[temp17]          \n\t"
32433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp11], %[temp9],  %[temp11]          \n\t"
32533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp10], %[temp12], %[temp14]          \n\t"
32633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp12], %[temp12], %[temp14]          \n\t"
32733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp14], %[temp13], %[kC2]             \n\t"
32833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp9],  %[temp15], %[kC1]             \n\t"
32933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp13], %[temp13], %[kC1]             \n\t"
33033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp15], %[temp15], %[kC2]             \n\t"
33133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp14], %[temp14], 16                 \n\t"
33233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp9],  %[temp9],  16                 \n\t"
33333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp13], %[temp13], 16                 \n\t"
33433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp15], %[temp15], 16                 \n\t"
33533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp9],  %[temp14], %[temp9]           \n\t"
33633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp15], %[temp13], %[temp15]          \n\t"
33733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp14], %[temp0],  %[temp2]           \n\t"
33833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp0],  %[temp0],  %[temp2]           \n\t"
33933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp2],  %[temp1],  %[kC2]             \n\t"
34033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp13], %[temp3],  %[kC1]             \n\t"
34133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp1],  %[temp1],  %[kC1]             \n\t"
34233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp3],  %[temp3],  %[kC2]             \n\t"
34333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp2],  %[temp2],  16                 \n\t"
34433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp13], %[temp13], 16                 \n\t"
34533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp1],  %[temp1],  16                 \n\t"
34633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp3],  %[temp3],  16                 \n\t"
34733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp13], %[temp2],  %[temp13]          \n\t"
34833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp3],  %[temp1],  %[temp3]           \n\t"
34933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp2],  %[temp4],  %[temp6]           \n\t"
35033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp4],  %[temp4],  %[temp6]           \n\t"
35133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp6],  %[temp5],  %[kC2]             \n\t"
35233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp1],  %[temp7],  %[kC1]             \n\t"
35333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp5],  %[temp5],  %[kC1]             \n\t"
35433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "mul      %[temp7],  %[temp7],  %[kC2]             \n\t"
35533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp6],  %[temp6],  16                 \n\t"
35633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp1],  %[temp1],  16                 \n\t"
35733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp5],  %[temp5],  16                 \n\t"
35833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp7],  %[temp7],  16                 \n\t"
35933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp1],  %[temp6],  %[temp1]           \n\t"
36033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp7],  %[temp5],  %[temp7]           \n\t"
36133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp5],  %[temp16], %[temp11]          \n\t"
36233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp16], %[temp16], %[temp11]          \n\t"
36333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp11], %[temp8],  %[temp17]          \n\t"
36433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp8],  %[temp8],  %[temp17]          \n\t"
36533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp5],  %[temp5],  3                  \n\t"
36633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp16], %[temp16], 3                  \n\t"
36733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp11], %[temp11], 3                  \n\t"
36833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp8],  %[temp8],  3                  \n\t"
36933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp17], %[temp10], %[temp15]          \n\t"
37033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp10], %[temp10], %[temp15]          \n\t"
37133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp15], %[temp12], %[temp9]           \n\t"
37233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp12], %[temp12], %[temp9]           \n\t"
37333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp17], %[temp17], 3                  \n\t"
37433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp10], %[temp10], 3                  \n\t"
37533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp15], %[temp15], 3                  \n\t"
37633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp12], %[temp12], 3                  \n\t"
37733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp9],  %[temp14], %[temp3]           \n\t"
37833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp14], %[temp14], %[temp3]           \n\t"
37933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp3],  %[temp0],  %[temp13]          \n\t"
38033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp0],  %[temp0],  %[temp13]          \n\t"
38133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp9],  %[temp9],  3                  \n\t"
38233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp14], %[temp14], 3                  \n\t"
38333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp3],  %[temp3],  3                  \n\t"
38433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp0],  %[temp0],  3                  \n\t"
38533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp13], %[temp2],  %[temp7]           \n\t"
38633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp2],  %[temp2],  %[temp7]           \n\t"
38733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp7],  %[temp4],  %[temp1]           \n\t"
38833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "subu     %[temp4],  %[temp4],  %[temp1]           \n\t"
38933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp13], %[temp13], 3                  \n\t"
39033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp2],  %[temp2],  3                  \n\t"
39133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp7],  %[temp7],  3                  \n\t"
39233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp4],  %[temp4],  3                  \n\t"
39333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addiu    %[temp6],  $zero,     255                \n\t"
3947c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp1],  0+0*" XSTR(BPS) "(%[dst])     \n\t"
39533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp1],  %[temp1],  %[temp5]           \n\t"
39633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp5],  %[temp1],  8                  \n\t"
39733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp18], %[temp1],  31                 \n\t"
39833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp5],  1f                            \n\t"
39933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp1],  %[temp1],  %[temp1]           \n\t"
40033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp1],  %[temp6],  %[temp18]          \n\t"
40133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "1:                                                  \n\t"
4027c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp18], 1+0*" XSTR(BPS) "(%[dst])     \n\t"
4037c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp1],  0+0*" XSTR(BPS) "(%[dst])     \n\t"
40433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp18], %[temp18], %[temp11]          \n\t"
40533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp11], %[temp18], 8                  \n\t"
40633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp1],  %[temp18], 31                 \n\t"
40733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp11], 2f                            \n\t"
40833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp18], %[temp18], %[temp18]          \n\t"
40933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp18], %[temp6],  %[temp1]           \n\t"
41033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "2:                                                  \n\t"
4117c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp1],  2+0*" XSTR(BPS) "(%[dst])     \n\t"
4127c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp18], 1+0*" XSTR(BPS) "(%[dst])     \n\t"
41333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp1],  %[temp1],  %[temp8]           \n\t"
41433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp8],  %[temp1],  8                  \n\t"
41533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp18], %[temp1],  31                 \n\t"
41633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp8],  3f                            \n\t"
41733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp1],  %[temp1],  %[temp1]           \n\t"
41833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp1],  %[temp6],  %[temp18]          \n\t"
41933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "3:                                                  \n\t"
4207c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp18], 3+0*" XSTR(BPS) "(%[dst])     \n\t"
4217c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp1],  2+0*" XSTR(BPS) "(%[dst])     \n\t"
42233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp18], %[temp18], %[temp16]          \n\t"
42333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp16], %[temp18], 8                  \n\t"
42433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp1],  %[temp18], 31                 \n\t"
42533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp16], 4f                            \n\t"
42633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp18], %[temp18], %[temp18]          \n\t"
42733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp18], %[temp6],  %[temp1]           \n\t"
42833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "4:                                                  \n\t"
4297c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp18], 3+0*" XSTR(BPS) "(%[dst])     \n\t"
4307c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp5],  0+1*" XSTR(BPS) "(%[dst])     \n\t"
4317c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp8],  1+1*" XSTR(BPS) "(%[dst])     \n\t"
4327c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp11], 2+1*" XSTR(BPS) "(%[dst])     \n\t"
4337c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp16], 3+1*" XSTR(BPS) "(%[dst])     \n\t"
43433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp5],  %[temp5],  %[temp17]          \n\t"
43533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp8],  %[temp8],  %[temp15]          \n\t"
43633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp11], %[temp11], %[temp12]          \n\t"
43733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp16], %[temp16], %[temp10]          \n\t"
43833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp18], %[temp5],  8                  \n\t"
43933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp1],  %[temp5],  31                 \n\t"
44033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp18], 5f                            \n\t"
44133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp5],  %[temp5],  %[temp5]           \n\t"
44233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp5],  %[temp6],  %[temp1]           \n\t"
44333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "5:                                                  \n\t"
44433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp18], %[temp8],  8                  \n\t"
44533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp1],  %[temp8],  31                 \n\t"
44633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp18], 6f                            \n\t"
44733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp8],  %[temp8],  %[temp8]           \n\t"
44833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp8],  %[temp6],  %[temp1]           \n\t"
44933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "6:                                                  \n\t"
45033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp18], %[temp11], 8                  \n\t"
45133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp1],  %[temp11], 31                 \n\t"
45233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp17], %[temp16], 8                  \n\t"
45333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp15], %[temp16], 31                 \n\t"
45433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp18], 7f                            \n\t"
45533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp11], %[temp11], %[temp11]          \n\t"
45633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp11], %[temp6],  %[temp1]           \n\t"
45733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "7:                                                  \n\t"
45833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp17], 8f                            \n\t"
45933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp16], %[temp16], %[temp16]          \n\t"
46033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp16], %[temp6],  %[temp15]          \n\t"
46133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "8:                                                  \n\t"
4627c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp5],  0+1*" XSTR(BPS) "(%[dst])     \n\t"
4637c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp8],  1+1*" XSTR(BPS) "(%[dst])     \n\t"
4647c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp11], 2+1*" XSTR(BPS) "(%[dst])     \n\t"
4657c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp16], 3+1*" XSTR(BPS) "(%[dst])     \n\t"
4667c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp5],  0+2*" XSTR(BPS) "(%[dst])     \n\t"
4677c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp8],  1+2*" XSTR(BPS) "(%[dst])     \n\t"
4687c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp11], 2+2*" XSTR(BPS) "(%[dst])     \n\t"
4697c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp16], 3+2*" XSTR(BPS) "(%[dst])     \n\t"
47033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp5],  %[temp5],  %[temp9]           \n\t"
47133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp8],  %[temp8],  %[temp3]           \n\t"
47233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp11], %[temp11], %[temp0]           \n\t"
47333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp16], %[temp16], %[temp14]          \n\t"
47433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp18], %[temp5],  8                  \n\t"
47533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp1],  %[temp5],  31                 \n\t"
47633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp17], %[temp8],  8                  \n\t"
47733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp15], %[temp8],  31                 \n\t"
47833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp12], %[temp11], 8                  \n\t"
47933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp10], %[temp11], 31                 \n\t"
48033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp9],  %[temp16], 8                  \n\t"
48133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp3],  %[temp16], 31                 \n\t"
48233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp18], 9f                            \n\t"
48333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp5],  %[temp5],  %[temp5]           \n\t"
48433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp5],  %[temp6],  %[temp1]           \n\t"
48533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "9:                                                  \n\t"
48633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp17], 10f                           \n\t"
48733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp8],  %[temp8],  %[temp8]           \n\t"
48833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp8],  %[temp6],  %[temp15]          \n\t"
48933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "10:                                                 \n\t"
49033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp12], 11f                           \n\t"
49133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp11], %[temp11], %[temp11]          \n\t"
49233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp11], %[temp6],  %[temp10]          \n\t"
49333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "11:                                                 \n\t"
49433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp9],  12f                           \n\t"
49533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp16], %[temp16], %[temp16]          \n\t"
49633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp16], %[temp6],  %[temp3]           \n\t"
49733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "12:                                                 \n\t"
4987c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp5],  0+2*" XSTR(BPS) "(%[dst])     \n\t"
4997c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp8],  1+2*" XSTR(BPS) "(%[dst])     \n\t"
5007c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp11], 2+2*" XSTR(BPS) "(%[dst])     \n\t"
5017c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp16], 3+2*" XSTR(BPS) "(%[dst])     \n\t"
5027c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp5],  0+3*" XSTR(BPS) "(%[dst])     \n\t"
5037c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp8],  1+3*" XSTR(BPS) "(%[dst])     \n\t"
5047c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp11], 2+3*" XSTR(BPS) "(%[dst])     \n\t"
5057c8da7ce66017295a65ec028084b90800be377f8James Zern    "lbu      %[temp16], 3+3*" XSTR(BPS) "(%[dst])     \n\t"
50633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp5],  %[temp5],  %[temp13]          \n\t"
50733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp8],  %[temp8],  %[temp7]           \n\t"
50833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp11], %[temp11], %[temp4]           \n\t"
50933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "addu     %[temp16], %[temp16], %[temp2]           \n\t"
51033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp18], %[temp5],  8                  \n\t"
51133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp1],  %[temp5],  31                 \n\t"
51233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp17], %[temp8],  8                  \n\t"
51333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp15], %[temp8],  31                 \n\t"
51433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp12], %[temp11], 8                  \n\t"
51533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp10], %[temp11], 31                 \n\t"
51633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp9],  %[temp16], 8                  \n\t"
51733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "sra      %[temp3],  %[temp16], 31                 \n\t"
51833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp18], 13f                           \n\t"
51933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp5],  %[temp5],  %[temp5]           \n\t"
52033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp5],  %[temp6],  %[temp1]           \n\t"
52133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "13:                                                 \n\t"
52233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp17], 14f                           \n\t"
52333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp8],  %[temp8],  %[temp8]           \n\t"
52433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp8],  %[temp6],  %[temp15]          \n\t"
52533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "14:                                                 \n\t"
52633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp12], 15f                           \n\t"
52733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp11], %[temp11], %[temp11]          \n\t"
52833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp11], %[temp6],  %[temp10]          \n\t"
52933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "15:                                                 \n\t"
53033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "beqz     %[temp9],  16f                           \n\t"
53133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "xor      %[temp16], %[temp16], %[temp16]          \n\t"
53233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    "movz     %[temp16], %[temp6],  %[temp3]           \n\t"
53333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  "16:                                                 \n\t"
5347c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp5],  0+3*" XSTR(BPS) "(%[dst])     \n\t"
5357c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp8],  1+3*" XSTR(BPS) "(%[dst])     \n\t"
5367c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp11], 2+3*" XSTR(BPS) "(%[dst])     \n\t"
5377c8da7ce66017295a65ec028084b90800be377f8James Zern    "sb       %[temp16], 3+3*" XSTR(BPS) "(%[dst])     \n\t"
53833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
53933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1), [temp2]"=&r"(temp2),
54033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      [temp3]"=&r"(temp3), [temp4]"=&r"(temp4), [temp5]"=&r"(temp5),
54133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      [temp6]"=&r"(temp6), [temp7]"=&r"(temp7), [temp8]"=&r"(temp8),
54233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      [temp9]"=&r"(temp9), [temp10]"=&r"(temp10), [temp11]"=&r"(temp11),
54333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      [temp12]"=&r"(temp12), [temp13]"=&r"(temp13), [temp14]"=&r"(temp14),
54433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      [temp15]"=&r"(temp15), [temp16]"=&r"(temp16), [temp17]"=&r"(temp17),
54533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora      [temp18]"=&r"(temp18)
54633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    : [in]"r"(p_in), [kC1]"r"(kC1), [kC2]"r"(kC2), [dst]"r"(dst)
54733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    : "memory", "hi", "lo"
54833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  );
54933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
55033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
55133f74dabbc7920a65ed435d7417987589febdc16Vikas Arorastatic void TransformTwo(const int16_t* in, uint8_t* dst, int do_two) {
55233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  TransformOne(in, dst);
55333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  if (do_two) {
55433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora    TransformOne(in + 16, dst + 4);
55533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  }
55633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
55733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
55833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora//------------------------------------------------------------------------------
55933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora// Entry point
56033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
56133f74dabbc7920a65ed435d7417987589febdc16Vikas Aroraextern void VP8DspInitMIPS32(void);
56233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
5637c8da7ce66017295a65ec028084b90800be377f8James ZernWEBP_TSAN_IGNORE_FUNCTION void VP8DspInitMIPS32(void) {
56433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8InitClipTables();
56533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
56633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8Transform = TransformTwo;
56733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
56833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8VFilter16 = VFilter16;
56933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8HFilter16 = HFilter16;
57033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8VFilter8 = VFilter8;
57133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8HFilter8 = HFilter8;
57233f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8VFilter16i = VFilter16i;
57333f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8HFilter16i = HFilter16i;
57433f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8VFilter8i = VFilter8i;
57533f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8HFilter8i = HFilter8i;
57633f74dabbc7920a65ed435d7417987589febdc16Vikas Arora
57733f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8SimpleVFilter16 = SimpleVFilter16;
57833f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8SimpleHFilter16 = SimpleHFilter16;
57933f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8SimpleVFilter16i = SimpleVFilter16i;
58033f74dabbc7920a65ed435d7417987589febdc16Vikas Arora  VP8SimpleHFilter16i = SimpleHFilter16i;
58133f74dabbc7920a65ed435d7417987589febdc16Vikas Arora}
5827c8da7ce66017295a65ec028084b90800be377f8James Zern
5837c8da7ce66017295a65ec028084b90800be377f8James Zern#else  // !WEBP_USE_MIPS32
5847c8da7ce66017295a65ec028084b90800be377f8James Zern
5857c8da7ce66017295a65ec028084b90800be377f8James ZernWEBP_DSP_INIT_STUB(VP8DspInitMIPS32)
5867c8da7ce66017295a65ec028084b90800be377f8James Zern
5877c8da7ce66017295a65ec028084b90800be377f8James Zern#endif  // WEBP_USE_MIPS32
588