2 * Blackfin Pixel Operations
3 * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "libavutil/bfin/asm.h"
28 * Halfpel motion compensation with rounding (a+b+1)>>1.
29 * This is an array[4][4] of motion compensation funcions for 4
30 * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
31 * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
32 * @param block destination where the result is stored
33 * @param pixels source
34 * @param line_size number of bytes in a horizontal line of block
39 DEFUN(put_pixels8uc,mL1,
40 (uint8_t *block, const uint8_t *s0, const uint8_t *s1,
41 int dest_size, int line_size, int h)):
45 r0=[sp+12]; // dest_size
46 r2=[sp+16]; // line_size
53 LSETUP(pp8$0,pp8$1) LC0=P0;
54 DISALGNEXCPT || R0 = [I0++] || R2 =[I1++];
56 pp8$0: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++];
57 R6 = BYTEOP1P(R1:0,R3:2) || R0 = [I0++M0]|| R2 =[I1++M0];
58 R7 = BYTEOP1P(R1:0,R3:2)(R) || R0 = [I0++] || [I3++] = R6 ;
59 pp8$1: DISALGNEXCPT || R2 = [I1++] || [I3++M3] = R7;
63 DEFUN_END(put_pixels8uc)
65 DEFUN(put_pixels16uc,mL1,
66 (uint8_t *block, const uint8_t *s0, const uint8_t *s1,
67 int dest_size, int line_size, int h)):
73 r0=[fp+20]; // dest_size
74 r2=[fp+24]; // line_size
83 LSETUP(pp16$0,pp16$1) LC0=P0;
84 DISALGNEXCPT || R0 = [I0++] || R2 =[I1++];
86 pp16$0: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++];
87 R6 = BYTEOP1P(R1:0,R3:2) || R0 = [I0++] || R2 =[I1++];
88 R7 = BYTEOP1P(R1:0,R3:2)(R) || R1 = [I0++] || R3 =[I1++];
90 R6 = BYTEOP1P(R1:0,R3:2) || R0 = [I0++M0] || R2 =[I1++M0];
91 R7 = BYTEOP1P(R1:0,R3:2)(R) || R0 = [I0++] || [I3++] = R7 ;
93 pp16$1: DISALGNEXCPT || R2 = [I1++] || [I3++M3] = R7;
98 DEFUN_END(put_pixels16uc)
100 DEFUN(z_put_pixels16_xy2,mL1,
101 (uint8_t *block, const uint8_t *s0,
102 int dest_size, int line_size, int h)):
106 i0=r1; // src0--> pixels
107 i1=r1; // src1--> pixels + line_size
109 m2=r2; // m2=dest_width-4
114 i1+=m3; /* src1 + line_size */
115 m0=r2; /* line-size - 20 */
121 DISALGNEXCPT || R0 = [I0++] || R2 =[I1++];
123 LSETUP(LS$16E,LE$16E) LC0=P0;
124 LS$16E: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++];
125 R4 = BYTEOP2P (R3:2,R1:0) (RNDL) || R0 = [I0++] || R2 =[I1++];
126 R5 = BYTEOP2P (R3:2,R1:0) (RNDL,R) || R1 = [I0++] || [I3++] = R4 ;
127 DISALGNEXCPT || R3 = [I1++] || [I3++] = R5;
128 R4 = BYTEOP2P (R3:2,R1:0) (RNDL) || R0 = [I0++M0]|| R2 = [I1++M0];
129 R5 = BYTEOP2P (R3:2,R1:0) (RNDL,R) || R0 = [I0++] || [I3++] = R4 ;
130 LE$16E: DISALGNEXCPT || R2 = [I1++] || [I3++M2] = R5;
140 DISALGNEXCPT || R0 = [I0++] || R2 =[I1++];
141 LSETUP(LS$16O,LE$16O) LC0=P0;
142 LS$16O: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++];
143 R4 = BYTEOP2P (R3:2,R1:0) (RNDH) || R0 = [I0++] || R2 =[I1++];
144 R5 = BYTEOP2P (R3:2,R1:0) (RNDH,R) || R1 = [I0++] || R6 =[I3++];
145 R4 = R4 +|+ R6 || R7 = [I3--];
146 R5 = R5 +|+ R7 || [I3++] = R4;
147 DISALGNEXCPT || R3 =[I1++] || [I3++] = R5;
148 R4 = BYTEOP2P (R3:2,R1:0) (RNDH) || R0 = [I0++M0]|| R2 = [I1++M0];
149 R5 = BYTEOP2P (R3:2,R1:0) (RNDH,R) || R0 = [I0++] || R6 = [I3++];
150 R4 = R4 +|+ R6 || R7 = [I3--];
151 R5 = R5 +|+ R7 || [I3++] = R4;
152 LE$16O: DISALGNEXCPT || R2 = [I1++] || [I3++M2] = R5;
157 DEFUN_END(z_put_pixels16_xy2)
159 DEFUN(z_put_pixels8_xy2,mL1,
160 (uint8_t *block, const uint8_t *s0,
161 int dest_size, int line_size, int h)):
165 i0=r1; // src0--> pixels
166 i1=r1; // src1--> pixels + line_size
168 m2=r2; // m2=dest_width-4
173 i1+=m3; /* src1 + line_size */
174 m0=r2; /* line-size - 20 */
180 LSETUP(LS$8E,LE$8E) LC0=P0;
181 DISALGNEXCPT || R0 = [I0++] || R2 =[I1++];
182 LS$8E: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++];
183 R4 = BYTEOP2P (R3:2,R1:0) (RNDL) || R0 = [I0++M0] || R2 =[I1++M0];
184 R5 = BYTEOP2P (R3:2,R1:0) (RNDL,R) || R0 = [I0++] || [I3++] = R4 ;
185 LE$8E: DISALGNEXCPT || R2 = [I1++] || [I3++M2] = R5;
195 LSETUP(LS$8O,LE$8O) LC0=P0;
196 DISALGNEXCPT || R0 = [I0++] || R2 =[I1++];
197 LS$8O: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++];
198 R4 = BYTEOP2P (R3:2,R1:0) (RNDH) || R0 = [I0++M0] || R2 =[I1++M0];
199 R5 = BYTEOP2P (R3:2,R1:0) (RNDH,R) || R0 = [I0++] || R6 =[I3++];
200 R4 = R4 +|+ R6 || R7 = [I3--];
201 R5 = R5 +|+ R7 || [I3++] = R4;
202 LE$8O: DISALGNEXCPT || R2 =[I1++] || [I3++M2] = R5;
207 DEFUN_END(z_put_pixels8_xy2)