[XviD-devel] Conversion YUYV->YV12, UYVY->YV12
suxen_drol
xvid-devel@xvid.org
Sun, 19 Jan 2003 10:43:09 +1100
On Sat, 18 Jan 2003 23:08:39 +0100 (CET) Christoph Lampert <chl@math.uni-bonn.de> wrote:
>
> Hi,
>
> is there any specific reason why yuyv_to_yv12_c() interpolates chroma from
> two scanlines whereas uyvy_to_yv12_c() simply copies one scanline and
> drops the other?
are you sure about this? the c and assembly implementation of yuyv &
uyvy use a common macro for uv interpolation:
/* yuyv/yuyvi input */
#define READ_YUYV_Y(ROW,C1,C2,C3,C4) \
y_ptr[(ROW)*y_stride+0] = x_ptr[(ROW)*x_stride+(C1)]; \
y_ptr[(ROW)*y_stride+1] = x_ptr[(ROW)*x_stride+(C3)];
#define READ_YUYV_UV(UV_ROW,ROW1,ROW2,C1,C2,C3,C4) \
u_ptr[(UV_ROW)*uv_stride] = (x_ptr[(ROW1)*x_stride+(C2)] + x_ptr[(ROW2)*x_stride+(C2)] + 1) / 2; \
v_ptr[(UV_ROW)*uv_stride] = (x_ptr[(ROW1)*x_stride+(C4)] + x_ptr[(ROW2)*x_stride+(C4)] + 1) / 2;
#define YUYV_TO_YV12_ROW(SIZE,C1,C2,C3,C4) \
/* nothing */
#define YUYV_TO_YV12(SIZE,C1,C2,C3,C4) \
READ_YUYV_Y (0, C1,C2,C3,C4) \
READ_YUYV_Y (1, C1,C2,C3,C4) \
READ_YUYV_UV(0, 0,1, C1,C2,C3,C4)
...
MAKE_COLORSPACE(yuyv_to_yv12_c, 2,2,2, YUYV_TO_YV12, 0,1,2,3)
MAKE_COLORSPACE(uyvy_to_yv12_c, 2,2,2, YUYV_TO_YV12, 1,0,3,2)
-- pete; life is like a box of ammo