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.
16 .
macro row_of16 Diff Pred Dst Stride
17 lvx v1
, 0, \Pred
;# v1 = pred = p0..p15
18 addi \Pred
, \Pred
, 16 ;# next pred
19 vmrghb v2
, v0
, v1
;# v2 = 16-bit p0..p7
20 lvx v3
, 0, \Diff
;# v3 = d0..d7
21 vaddshs v2
, v2
, v3
;# v2 = r0..r7
22 vmrglb v1
, v0
, v1
;# v1 = 16-bit p8..p15
23 lvx v3
, r8
, \Diff
;# v3 = d8..d15
24 addi \Diff
, \Diff
, 32 ;# next diff
25 vaddshs v3
, v3
, v1
;# v3 = r8..r15
26 vpkshus v2
, v2
, v3
;# v2 = 8-bit r0..r15
27 stvx v2
, 0, \Dst
;# to dst
28 add \Dst
, \Dst
, \Stride
;# next dst
33 ;# r3 = short *diff_ptr,
34 ;# r4 = unsigned char *pred_ptr,
35 ;# r5 = unsigned char *dst_ptr,
38 mfspr r0
, 256 ;# get old VRSAVE
39 stw r0
, -8(r1
) ;# save old VRSAVE to stack
41 mtspr
256,r0
;# set VRSAVE
46 row_of16 r3
, r4
, r5
, r6
47 row_of16 r3
, r4
, r5
, r6
48 row_of16 r3
, r4
, r5
, r6
49 row_of16 r3
, r4
, r5
, r6
51 lwz r12
, -8(r1
) ;# restore old VRSAVE from stack
52 mtspr
256, r12
;# reset old VRSAVE
56 .
macro two_rows_of8 Diff Pred Dst Stride write_first_four_pels
57 lvx v1
, 0, \Pred
;# v1 = pred = p0..p15
58 vmrghb v2
, v0
, v1
;# v2 = 16-bit p0..p7
59 lvx v3
, 0, \Diff
;# v3 = d0..d7
60 vaddshs v2
, v2
, v3
;# v2 = r0..r7
61 vmrglb v1
, v0
, v1
;# v1 = 16-bit p8..p15
62 lvx v3
, r8
, \Diff
;# v2 = d8..d15
63 vaddshs v3
, v3
, v1
;# v3 = r8..r15
64 vpkshus v2
, v2
, v3
;# v3 = 8-bit r0..r15
65 stvx v2
, 0, r10
;# 2 rows to dst from buf
67 .if \write_first_four_pels
70 stwux r0
, \Dst
, \Stride
75 stwux r0
, \Dst
, \Stride
;# advance dst to next row
81 ;# r3 = short *diff_ptr,
82 ;# r4 = unsigned char *pred_ptr,
83 ;# r5 = unsigned char *dst_ptr,
87 mfspr r0
, 256 ;# get old VRSAVE
88 stw r0
, -8(r1
) ;# save old VRSAVE to stack
90 mtspr
256,r0
;# set VRSAVE
95 la r10
, -48(r1
) ;# buf
97 two_rows_of8 r3
, r4
, r5
, r6
, 1
99 addi r4
, r4
, 16; ;# next pred
100 addi r3
, r3
, 32; ;# next diff
102 two_rows_of8 r3
, r4
, r5
, r6
, 0
104 lwz r12
, -8(r1
) ;# restore old VRSAVE from stack
105 mtspr
256, r12
;# reset old VRSAVE
109 .
macro get_two_diff_rows
121 ;# r3 = short *diff_ptr,
122 ;# r4 = unsigned char *pred_ptr,
123 ;# r5 = unsigned char *dst_ptr,
126 mfspr r0
, 256 ;# get old VRSAVE
127 stw r0
, -8(r1
) ;# save old VRSAVE to stack
129 mtspr
256,r0
;# set VRSAVE
133 la r10
, -48(r1
) ;# buf
144 lvx v1
, 0, r10
; ;# v1 = pred = p0..p15
146 lwz r0
, 0(r3
) ;# v3 = d0..d7
150 vmrghb v2
, v0
, v1
; ;# v2 = 16-bit p0..p7
151 vaddshs v2
, v2
, v3
; ;# v2 = r0..r7
153 lwzu r0
, 32(r3
) ;# v3 = d8..d15
157 vmrglb v1
, v0
, v1
; ;# v1 = 16-bit p8..p15
158 vaddshs v3
, v3
, v1
; ;# v3 = r8..r15
160 vpkshus v2
, v2
, v3
; ;# v2 = 8-bit r0..r15
161 stvx v2
, 0, r10
; ;# 16 pels to dst from buf
172 lwz r12
, -8(r1
) ;# restore old VRSAVE from stack
173 mtspr
256, r12
;# reset old VRSAVE