3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* image stuff |
* image stuff |
5 |
* |
* |
6 |
|
* This program is an implementation of a part of one or more MPEG-4 |
7 |
|
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
8 |
|
* to use this software module in hardware or software products are |
9 |
|
* advised that its use may infringe existing patents or copyrights, and |
10 |
|
* any such use would be at such party's own risk. The original |
11 |
|
* developer of this software module and his/her company, and subsequent |
12 |
|
* editors and their companies, will have no liability for use of this |
13 |
|
* software or modifications or derivatives thereof. |
14 |
|
* |
15 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
16 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
17 |
* the Free Software Foundation; either version 2 of the License, or |
* the Free Software Foundation; either version 2 of the License, or |
160 |
uint32_t edged_width, |
uint32_t edged_width, |
161 |
uint32_t edged_height, |
uint32_t edged_height, |
162 |
uint32_t width, |
uint32_t width, |
163 |
uint32_t height, |
uint32_t height) |
|
uint32_t interlacing) |
|
164 |
{ |
{ |
165 |
const uint32_t edged_width2 = edged_width / 2; |
const uint32_t edged_width2 = edged_width / 2; |
166 |
const uint32_t width2 = width / 2; |
const uint32_t width2 = width / 2; |
173 |
src = image->y; |
src = image->y; |
174 |
|
|
175 |
for (i = 0; i < EDGE_SIZE; i++) { |
for (i = 0; i < EDGE_SIZE; i++) { |
|
/* // if interlacing, edges contain top-most data from each field |
|
|
if (interlacing && (i & 1)) { |
|
|
memset(dst, *(src + edged_width), EDGE_SIZE); |
|
|
memcpy(dst + EDGE_SIZE, src + edged_width, width); |
|
|
memset(dst + edged_width - EDGE_SIZE, |
|
|
*(src + edged_width + width - 1), EDGE_SIZE); |
|
|
} else {*/ |
|
176 |
memset(dst, *src, EDGE_SIZE); |
memset(dst, *src, EDGE_SIZE); |
177 |
memcpy(dst + EDGE_SIZE, src, width); |
memcpy(dst + EDGE_SIZE, src, width); |
178 |
memset(dst + edged_width - EDGE_SIZE, *(src + width - 1), |
memset(dst + edged_width - EDGE_SIZE, *(src + width - 1), |
179 |
EDGE_SIZE); |
EDGE_SIZE); |
|
/*}*/ |
|
180 |
dst += edged_width; |
dst += edged_width; |
181 |
} |
} |
182 |
|
|
189 |
|
|
190 |
src -= edged_width; |
src -= edged_width; |
191 |
for (i = 0; i < EDGE_SIZE; i++) { |
for (i = 0; i < EDGE_SIZE; i++) { |
|
/* // if interlacing, edges contain bottom-most data from each field |
|
|
if (interlacing && !(i & 1)) { |
|
|
memset(dst, *(src - edged_width), EDGE_SIZE); |
|
|
memcpy(dst + EDGE_SIZE, src - edged_width, width); |
|
|
memset(dst + edged_width - EDGE_SIZE, |
|
|
*(src - edged_width + width - 1), EDGE_SIZE); |
|
|
} else {*/ |
|
192 |
memset(dst, *src, EDGE_SIZE); |
memset(dst, *src, EDGE_SIZE); |
193 |
memcpy(dst + EDGE_SIZE, src, width); |
memcpy(dst + EDGE_SIZE, src, width); |
194 |
memset(dst + edged_width - EDGE_SIZE, *(src + width - 1), |
memset(dst + edged_width - EDGE_SIZE, *(src + width - 1), |
195 |
EDGE_SIZE); |
EDGE_SIZE); |
|
/*}*/ |
|
196 |
dst += edged_width; |
dst += edged_width; |
197 |
} |
} |
198 |
|
|
287 |
v_ptr -= offset; |
v_ptr -= offset; |
288 |
hv_ptr -= offset; |
hv_ptr -= offset; |
289 |
|
|
290 |
for (y = 0; y < edged_height; y = y + 8) { |
for (y = 0; y < edged_height; y += 8) { |
291 |
for (x = 0; x < edged_width; x = x + 8) { |
for (x = 0; x < edged_width; x += 8) { |
292 |
interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width, rounding); |
interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width, rounding); |
293 |
interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width, rounding); |
interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width, rounding); |
294 |
interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width, rounding); |
interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width, rounding); |
303 |
hv_ptr += stride_add; |
hv_ptr += stride_add; |
304 |
n_ptr += stride_add; |
n_ptr += stride_add; |
305 |
} |
} |
306 |
|
/* |
307 |
#ifdef BFRAMES |
#ifdef BFRAMES |
308 |
n_ptr = refn->u; |
n_ptr = refn->u; |
309 |
h_ptr = refh->u; |
h_ptr = refh->u; |
315 |
v_ptr -= offset2; |
v_ptr -= offset2; |
316 |
hv_ptr -= offset2; |
hv_ptr -= offset2; |
317 |
|
|
318 |
for (y = 0; y < edged_height2; y = y + 8) { |
for (y = 0; y < edged_height2; y += 8) { |
319 |
for (x = 0; x < edged_width2; x = x + 8) { |
for (x = 0; x < edged_width2; x += 8) { |
320 |
interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width2, rounding); |
interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width2, rounding); |
321 |
interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width2, rounding); |
interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width2, rounding); |
322 |
interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width2, rounding); |
interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width2, rounding); |
359 |
n_ptr += stride_add2; |
n_ptr += stride_add2; |
360 |
} |
} |
361 |
#endif |
#endif |
362 |
|
*/ |
363 |
/* |
/* |
364 |
interpolate_halfpel_h( |
interpolate_halfpel_h( |
365 |
refh->y - offset, |
refh->y - offset, |