diff --git a/ext/cog/cog.orc b/ext/cog/cog.orc index 2322312499..e08d98f9cd 100644 --- a/ext/cog/cog.orc +++ b/ext/cog/cog.orc @@ -53,48 +53,6 @@ avgub t4, t4, t5 avgub d1, t2, t4 -.function cogorc_downsample_420_mpeg2 -.dest 1 d1 -.source 2 s1 -.source 2 s2 -.source 2 s3 -.source 2 s4 -.temp 1 t1 -.temp 1 t2 -.temp 1 t3 -.temp 2 t4 -.temp 2 t5 -.temp 2 t6 -.temp 2 t7 - -copyw t4, s1 -select0wb t1, t4 -select1wb t2, t4 -select0wb t3, s2 -convubw t4, t1 -convubw t5, t2 -convubw t6, t3 -mullw t5, t5, 2 -addw t4, t4, t6 -addw t7, t4, t5 -copyw t4, s3 - -select0wb t1, t4 -select1wb t2, t4 -select0wb t3, s4 -convubw t4, t1 -convubw t5, t2 -convubw t6, t3 -mullw t5, t5, 2 -addw t4, t4, t6 -addw t4, t4, t5 - -addw t7, t7, t4 -addw t7, t7, 4 -shrsw t7, t7, 3 -convsuswb d1, t7 - - .function cogorc_downsample_vert_halfsite_2tap .dest 1 d1 .source 1 s1 diff --git a/ext/cog/cogvirtframe.c b/ext/cog/cogvirtframe.c index 1adfef4044..93f3849329 100644 --- a/ext/cog/cogvirtframe.c +++ b/ext/cog/cogvirtframe.c @@ -1617,10 +1617,27 @@ convert_444_420_mpeg2 (CogFrame * frame, void *_dest, int component, int i) src2 = cog_virt_frame_get_line (frame->virt_frame1, component, CLAMP (i * 2 + 1, 0, n_src - 1)); +#if 0 cogorc_downsample_420_mpeg2 (dest + 1, (uint16_t *) src1, (uint16_t *) (src1 + 2), (uint16_t *) src2, (uint16_t *) (src2 + 2), frame->components[component].width - 1); +#else + { + int j; + int x; + + for (j = 1; j < frame->components[component].width - 1; j++) { + x = 1 * src1[j * 2 - 1]; + x += 2 * src1[j * 2 + 0]; + x += 1 * src1[j * 2 + 1]; + x += 1 * src2[j * 2 - 1]; + x += 2 * src2[j * 2 + 0]; + x += 1 * src2[j * 2 + 1]; + dest[j] = CLAMP ((x + 4) >> 3, 0, 255); + } + } +#endif { int j; int x;