3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Image management functions - |
* - Image management functions - |
5 |
* |
* |
6 |
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> |
* Copyright(C) 2001-2004 Peter Ross <pross@xvid.org> |
7 |
* |
* |
8 |
* This program is free software ; you can redistribute it and/or modify |
* This program is free software ; you can redistribute it and/or modify |
9 |
* 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 |
127 |
memcpy(image1->v, image2->v, edged_width * height / 4); |
memcpy(image1->v, image2->v, edged_width * height / 4); |
128 |
} |
} |
129 |
|
|
130 |
|
/* setedges bug was fixed in this BS version */ |
131 |
|
#define SETEDGES_BUG_BEFORE 18 |
132 |
|
|
133 |
void |
void |
134 |
image_setedges(IMAGE * image, |
image_setedges(IMAGE * image, |
135 |
uint32_t edged_width, |
uint32_t edged_width, |
136 |
uint32_t edged_height, |
uint32_t edged_height, |
137 |
uint32_t width, |
uint32_t width, |
138 |
uint32_t height) |
uint32_t height, |
139 |
|
int bs_version) |
140 |
{ |
{ |
141 |
const uint32_t edged_width2 = edged_width / 2; |
const uint32_t edged_width2 = edged_width / 2; |
142 |
uint32_t width2; |
uint32_t width2; |
144 |
uint8_t *dst; |
uint8_t *dst; |
145 |
uint8_t *src; |
uint8_t *src; |
146 |
|
|
|
|
|
147 |
dst = image->y - (EDGE_SIZE + EDGE_SIZE * edged_width); |
dst = image->y - (EDGE_SIZE + EDGE_SIZE * edged_width); |
148 |
src = image->y; |
src = image->y; |
149 |
|
|
150 |
/* According to the Standard Clause 7.6.4, padding is done starting at 16 |
/* According to the Standard Clause 7.6.4, padding is done starting at 16 |
151 |
* pixel width and height multiples */ |
* pixel width and height multiples. This was not respected in old xvids */ |
152 |
|
if (bs_version == 0 || bs_version >= SETEDGES_BUG_BEFORE) { |
153 |
width = (width+15)&~15; |
width = (width+15)&~15; |
154 |
height = (height+15)&~15; |
height = (height+15)&~15; |
155 |
|
} |
156 |
|
|
157 |
width2 = width/2; |
width2 = width/2; |
158 |
|
|
159 |
for (i = 0; i < EDGE_SIZE; i++) { |
for (i = 0; i < EDGE_SIZE; i++) { |
622 |
|
|
623 |
case XVID_CSP_YVYU: /* u/v swapped */ |
case XVID_CSP_YVYU: /* u/v swapped */ |
624 |
safe_packed_conv( |
safe_packed_conv( |
625 |
src[0], src_stride[0], image->y, image->v, image->y, |
src[0], src_stride[0], image->y, image->v, image->u, |
626 |
edged_width, edged_width2, width, height, (csp & XVID_CSP_VFLIP), |
edged_width, edged_width2, width, height, (csp & XVID_CSP_VFLIP), |
627 |
interlacing?yuyvi_to_yv12 :yuyv_to_yv12, |
interlacing?yuyvi_to_yv12 :yuyv_to_yv12, |
628 |
interlacing?yuyvi_to_yv12_c:yuyv_to_yv12_c, 2); |
interlacing?yuyvi_to_yv12_c:yuyv_to_yv12_c, 2); |