OLD | NEW |
(Empty) | |
| 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 "vp9_rtcd.h" |
| 14 #include "vp9/common/vp9_blockd.h" |
| 15 |
| 16 void vp9_recon_b_c |
| 17 ( |
| 18 unsigned char *pred_ptr, |
| 19 short *diff_ptr, |
| 20 unsigned char *dst_ptr, |
| 21 int stride |
| 22 ) { |
| 23 int r, c; |
| 24 |
| 25 for (r = 0; r < 4; r++) { |
| 26 for (c = 0; c < 4; c++) { |
| 27 int a = diff_ptr[c] + pred_ptr[c]; |
| 28 |
| 29 if (a < 0) |
| 30 a = 0; |
| 31 |
| 32 if (a > 255) |
| 33 a = 255; |
| 34 |
| 35 dst_ptr[c] = (unsigned char) a; |
| 36 } |
| 37 |
| 38 dst_ptr += stride; |
| 39 diff_ptr += 16; |
| 40 pred_ptr += 16; |
| 41 } |
| 42 } |
| 43 |
| 44 void vp9_recon_uv_b_c |
| 45 ( |
| 46 unsigned char *pred_ptr, |
| 47 short *diff_ptr, |
| 48 unsigned char *dst_ptr, |
| 49 int stride |
| 50 ) { |
| 51 int r, c; |
| 52 |
| 53 for (r = 0; r < 4; r++) { |
| 54 for (c = 0; c < 4; c++) { |
| 55 int a = diff_ptr[c] + pred_ptr[c]; |
| 56 |
| 57 if (a < 0) |
| 58 a = 0; |
| 59 |
| 60 if (a > 255) |
| 61 a = 255; |
| 62 |
| 63 dst_ptr[c] = (unsigned char) a; |
| 64 } |
| 65 |
| 66 dst_ptr += stride; |
| 67 diff_ptr += 8; |
| 68 pred_ptr += 8; |
| 69 } |
| 70 } |
| 71 void vp9_recon4b_c |
| 72 ( |
| 73 unsigned char *pred_ptr, |
| 74 short *diff_ptr, |
| 75 unsigned char *dst_ptr, |
| 76 int stride |
| 77 ) { |
| 78 int r, c; |
| 79 |
| 80 for (r = 0; r < 4; r++) { |
| 81 for (c = 0; c < 16; c++) { |
| 82 int a = diff_ptr[c] + pred_ptr[c]; |
| 83 |
| 84 if (a < 0) |
| 85 a = 0; |
| 86 |
| 87 if (a > 255) |
| 88 a = 255; |
| 89 |
| 90 dst_ptr[c] = (unsigned char) a; |
| 91 } |
| 92 |
| 93 dst_ptr += stride; |
| 94 diff_ptr += 16; |
| 95 pred_ptr += 16; |
| 96 } |
| 97 } |
| 98 |
| 99 void vp9_recon2b_c |
| 100 ( |
| 101 unsigned char *pred_ptr, |
| 102 short *diff_ptr, |
| 103 unsigned char *dst_ptr, |
| 104 int stride |
| 105 ) { |
| 106 int r, c; |
| 107 |
| 108 for (r = 0; r < 4; r++) { |
| 109 for (c = 0; c < 8; c++) { |
| 110 int a = diff_ptr[c] + pred_ptr[c]; |
| 111 |
| 112 if (a < 0) |
| 113 a = 0; |
| 114 |
| 115 if (a > 255) |
| 116 a = 255; |
| 117 |
| 118 dst_ptr[c] = (unsigned char) a; |
| 119 } |
| 120 |
| 121 dst_ptr += stride; |
| 122 diff_ptr += 8; |
| 123 pred_ptr += 8; |
| 124 } |
| 125 } |
| 126 |
| 127 #if CONFIG_SUPERBLOCKS |
| 128 void vp9_recon_mby_s_c(MACROBLOCKD *xd, uint8_t *dst) { |
| 129 int x, y; |
| 130 BLOCKD *b = &xd->block[0]; |
| 131 int stride = b->dst_stride; |
| 132 short *diff = b->diff; |
| 133 |
| 134 for (y = 0; y < 16; y++) { |
| 135 for (x = 0; x < 16; x++) { |
| 136 int a = dst[x] + diff[x]; |
| 137 if (a < 0) |
| 138 a = 0; |
| 139 else if (a > 255) |
| 140 a = 255; |
| 141 dst[x] = a; |
| 142 } |
| 143 dst += stride; |
| 144 diff += 16; |
| 145 } |
| 146 } |
| 147 |
| 148 void vp9_recon_mbuv_s_c(MACROBLOCKD *xd, uint8_t *udst, uint8_t *vdst) { |
| 149 int x, y, i; |
| 150 uint8_t *dst = udst; |
| 151 |
| 152 for (i = 0; i < 2; i++, dst = vdst) { |
| 153 BLOCKD *b = &xd->block[16 + 4 * i]; |
| 154 int stride = b->dst_stride; |
| 155 short *diff = b->diff; |
| 156 |
| 157 for (y = 0; y < 8; y++) { |
| 158 for (x = 0; x < 8; x++) { |
| 159 int a = dst[x] + diff[x]; |
| 160 if (a < 0) |
| 161 a = 0; |
| 162 else if (a > 255) |
| 163 a = 255; |
| 164 dst[x] = a; |
| 165 } |
| 166 dst += stride; |
| 167 diff += 8; |
| 168 } |
| 169 } |
| 170 } |
| 171 #endif |
| 172 |
| 173 void vp9_recon_mby_c(MACROBLOCKD *xd) { |
| 174 int i; |
| 175 |
| 176 for (i = 0; i < 16; i += 4) { |
| 177 BLOCKD *b = &xd->block[i]; |
| 178 |
| 179 vp9_recon4b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride); |
| 180 } |
| 181 } |
| 182 |
| 183 void vp9_recon_mb_c(MACROBLOCKD *xd) { |
| 184 int i; |
| 185 |
| 186 for (i = 0; i < 16; i += 4) { |
| 187 BLOCKD *b = &xd->block[i]; |
| 188 |
| 189 vp9_recon4b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride); |
| 190 } |
| 191 |
| 192 for (i = 16; i < 24; i += 2) { |
| 193 BLOCKD *b = &xd->block[i]; |
| 194 |
| 195 vp9_recon2b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride); |
| 196 } |
| 197 } |
OLD | NEW |