1 : /*
2 : * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 : *
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.
9 : */
10 :
11 :
12 : #include "vpx_ports/config.h"
13 : #include "recon.h"
14 : #include "blockd.h"
15 :
16 0 : void vp8_recon_b_c
17 : (
18 : unsigned char *pred_ptr,
19 : short *diff_ptr,
20 : unsigned char *dst_ptr,
21 : int stride
22 : )
23 : {
24 : int r, c;
25 :
26 0 : for (r = 0; r < 4; r++)
27 : {
28 0 : for (c = 0; c < 4; c++)
29 : {
30 0 : int a = diff_ptr[c] + pred_ptr[c] ;
31 :
32 0 : if (a < 0)
33 0 : a = 0;
34 :
35 0 : if (a > 255)
36 0 : a = 255;
37 :
38 0 : dst_ptr[c] = (unsigned char) a ;
39 : }
40 :
41 0 : dst_ptr += stride;
42 0 : diff_ptr += 16;
43 0 : pred_ptr += 16;
44 : }
45 0 : }
46 :
47 0 : void vp8_recon4b_c
48 : (
49 : unsigned char *pred_ptr,
50 : short *diff_ptr,
51 : unsigned char *dst_ptr,
52 : int stride
53 : )
54 : {
55 : int r, c;
56 :
57 0 : for (r = 0; r < 4; r++)
58 : {
59 0 : for (c = 0; c < 16; c++)
60 : {
61 0 : int a = diff_ptr[c] + pred_ptr[c] ;
62 :
63 0 : if (a < 0)
64 0 : a = 0;
65 :
66 0 : if (a > 255)
67 0 : a = 255;
68 :
69 0 : dst_ptr[c] = (unsigned char) a ;
70 : }
71 :
72 0 : dst_ptr += stride;
73 0 : diff_ptr += 16;
74 0 : pred_ptr += 16;
75 : }
76 0 : }
77 :
78 0 : void vp8_recon2b_c
79 : (
80 : unsigned char *pred_ptr,
81 : short *diff_ptr,
82 : unsigned char *dst_ptr,
83 : int stride
84 : )
85 : {
86 : int r, c;
87 :
88 0 : for (r = 0; r < 4; r++)
89 : {
90 0 : for (c = 0; c < 8; c++)
91 : {
92 0 : int a = diff_ptr[c] + pred_ptr[c] ;
93 :
94 0 : if (a < 0)
95 0 : a = 0;
96 :
97 0 : if (a > 255)
98 0 : a = 255;
99 :
100 0 : dst_ptr[c] = (unsigned char) a ;
101 : }
102 :
103 0 : dst_ptr += stride;
104 0 : diff_ptr += 8;
105 0 : pred_ptr += 8;
106 : }
107 0 : }
108 :
109 0 : void vp8_recon_mby_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
110 : {
111 : #if ARCH_ARM
112 : BLOCKD *b = &x->block[0];
113 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
114 :
115 : /*b = &x->block[4];*/
116 : b += 4;
117 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
118 :
119 : /*b = &x->block[8];*/
120 : b += 4;
121 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
122 :
123 : /*b = &x->block[12];*/
124 : b += 4;
125 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
126 : #else
127 : int i;
128 :
129 0 : for (i = 0; i < 16; i += 4)
130 : {
131 0 : BLOCKD *b = &x->block[i];
132 :
133 0 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
134 : }
135 : #endif
136 0 : }
137 :
138 0 : void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
139 : {
140 : #if ARCH_ARM
141 : BLOCKD *b = &x->block[0];
142 :
143 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
144 : b += 4;
145 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
146 : b += 4;
147 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
148 : b += 4;
149 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
150 : b += 4;
151 :
152 : /*b = &x->block[16];*/
153 :
154 : RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
155 : b++;
156 : b++;
157 : RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
158 : b++;
159 : b++;
160 : RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
161 : b++;
162 : b++;
163 : RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
164 : #else
165 : int i;
166 :
167 0 : for (i = 0; i < 16; i += 4)
168 : {
169 0 : BLOCKD *b = &x->block[i];
170 :
171 0 : RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
172 : }
173 :
174 0 : for (i = 16; i < 24; i += 2)
175 : {
176 0 : BLOCKD *b = &x->block[i];
177 :
178 0 : RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
179 : }
180 : #endif
181 0 : }
|