2 ; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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.
12 .globl vp8_sad16x16_ppc
13 .globl vp8_sad16x8_ppc
14 .globl vp8_sad8x16_ppc
18 .
macro load_aligned_16 V R O
19 lvsl v3
, 0, \R
;# permutate value for alignment
28 mfspr r11
, 256 ;# get old VRSAVE
30 mtspr
256, r12
;# set VRSAVE
32 stwu r1
, -32(r1
) ;# create space on the stack
34 li r10
, 16 ;# load offset and loop counter
36 vspltisw v8
, 0 ;# zero out total to start
40 addi r1
, r1
, 32 ;# recover stack
42 mtspr
256, r11
;# reset old VRSAVE
51 ;# v8 += abs (v4 - v5)
55 .
macro sad_16_loop loop_label
56 lvsl v3
, 0, r5
;# only needs to be done once per block
58 ;# preload a line of data before getting into the loop
70 ;# compute difference on first row
74 ;# load up next set of data
79 ;# perform abs() of difference
83 ;# add to the running tally
86 ;# now onto the next line
91 ;# compute difference on second row
112 .
macro sad_8_loop loop_label
115 ;# only one of the inputs should need to be aligned.
116 load_aligned_16 v4
, r3
, r10
117 load_aligned_16 v5
, r5
, r10
119 ;# move onto the next line
123 ;# only one of the inputs should need to be aligned.
124 load_aligned_16 v6
, r3
, r10
125 load_aligned_16 v7
, r5
, r10
127 ;# move onto the next line
147 ;# r3 unsigned char *src_ptr
149 ;# r5 unsigned char *ref_ptr
160 sad_16_loop sad16x16_loop
167 ;# r3 unsigned char *src_ptr
169 ;# r5 unsigned char *ref_ptr
180 sad_16_loop sad16x8_loop
187 ;# r3 unsigned char *src_ptr
189 ;# r5 unsigned char *ref_ptr
200 sad_8_loop sad8x16_loop
207 ;# r3 unsigned char *src_ptr
209 ;# r5 unsigned char *ref_ptr
220 sad_8_loop sad8x8_loop
226 .
macro transfer_4x4 I P
245 ;# r3 unsigned char *src_ptr
247 ;# r5 unsigned char *ref_ptr
261 vspltisw v8
, 0 ;# zero out total to start
263 ;# v6 = abs (v4 - v5)
268 ;# v8 += abs (v4 - v5)