2 * Image Scaling Functions
3 * Copyright (c) 2005-2012 David A. Schleef <ds@schleef.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
33 #include "vs_scanline.h"
36 #include "gstvideoscaleorc.h"
39 #define ROUND_UP_2(x) (((x)+1)&~1)
40 #define ROUND_UP_4(x) (((x)+3)&~3)
41 #define ROUND_UP_8(x) (((x)+7)&~7)
44 vs_image_scale_nearest_RGBA (const VSImage * dest, const VSImage * src,
54 if (dest->height == 1)
57 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
62 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
67 for (i = 0; i < dest->height; i++) {
71 memcpy (dest->pixels + i * dest->stride,
72 dest->pixels + (i - 1) * dest->stride, dest->width * 4);
74 video_scale_orc_resample_nearest_u32 (dest->pixels + i * dest->stride,
75 src->pixels + j * src->stride, 0, x_increment, dest->width);
84 vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src,
96 if (dest->height == 1)
99 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
101 if (dest->width == 1)
104 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
106 dest_size = dest->width * 4;
108 #define LINE(x) ((tmpbuf) + (dest_size)*((x)&1))
111 video_scale_orc_resample_bilinear_u32 (LINE (0), src->pixels,
112 0, x_increment, dest->width);
114 for (i = 0; i < dest->height; i++) {
119 memcpy (dest->pixels + i * dest->stride, LINE (j), dest_size);
122 video_scale_orc_resample_bilinear_u32 (LINE (j),
123 src->pixels + j * src->stride, 0, x_increment, dest->width);
127 video_scale_orc_resample_bilinear_u32 (LINE (j + 1),
128 src->pixels + (j + 1) * src->stride, 0, x_increment, dest->width);
131 video_scale_orc_merge_linear_u8 (dest->pixels + i * dest->stride,
132 LINE (j), LINE (j + 1), (x >> 8), dest->width * 4);
141 vs_image_scale_nearest_RGB (const VSImage * dest, const VSImage * src,
151 if (dest->height == 1)
154 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
156 if (dest->width == 1)
159 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
162 for (i = 0; i < dest->height; i++) {
166 vs_scanline_resample_nearest_RGB (dest->pixels + i * dest->stride,
167 src->pixels + j * src->stride, src->width, dest->width, &xacc,
175 vs_image_scale_linear_RGB (const VSImage * dest, const VSImage * src,
191 if (dest->height == 1)
194 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
196 if (dest->width == 1)
199 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
201 dest_size = dest->width * 3;
204 tmp2 = tmpbuf + dest_size;
209 vs_scanline_resample_linear_RGB (tmp1, src->pixels, src->width, dest->width,
212 for (i = 0; i < dest->height; i++) {
218 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
219 } else if (j == y2) {
220 memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
223 vs_scanline_resample_linear_RGB (tmp1, src->pixels + j * src->stride,
224 src->width, dest->width, &xacc, x_increment);
226 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
232 vs_scanline_resample_linear_RGB (tmp2,
233 src->pixels + (j + 1) * src->stride, src->width, dest->width,
237 vs_scanline_merge_linear_RGB (dest->pixels + i * dest->stride,
238 tmp1, tmp2, dest->width, x);
239 } else if (j == y2) {
242 vs_scanline_resample_linear_RGB (tmp1,
243 src->pixels + (j + 1) * src->stride, src->width, dest->width,
247 vs_scanline_merge_linear_RGB (dest->pixels + i * dest->stride,
248 tmp2, tmp1, dest->width, x);
251 vs_scanline_resample_linear_RGB (tmp1, src->pixels + j * src->stride,
252 src->width, dest->width, &xacc, x_increment);
255 vs_scanline_resample_linear_RGB (tmp2,
256 src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
259 vs_scanline_merge_linear_RGB (dest->pixels + i * dest->stride,
260 tmp1, tmp2, dest->width, x);
271 vs_image_scale_nearest_YUYV (const VSImage * dest, const VSImage * src,
281 if (dest->height == 1)
284 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
286 if (dest->width == 1)
289 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
292 for (i = 0; i < dest->height; i++) {
296 vs_scanline_resample_nearest_YUYV (dest->pixels + i * dest->stride,
297 src->pixels + j * src->stride, src->width, dest->width, &xacc,
305 vs_image_scale_linear_YUYV (const VSImage * dest, const VSImage * src,
321 if (dest->height == 1)
324 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
326 if (dest->width == 1)
329 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
331 dest_size = ROUND_UP_4 (dest->width * 2);
334 tmp2 = tmpbuf + dest_size;
339 vs_scanline_resample_linear_YUYV (tmp1, src->pixels, src->width, dest->width,
342 for (i = 0; i < dest->height; i++) {
348 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
349 } else if (j == y2) {
350 memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
353 vs_scanline_resample_linear_YUYV (tmp1, src->pixels + j * src->stride,
354 src->width, dest->width, &xacc, x_increment);
356 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
362 vs_scanline_resample_linear_YUYV (tmp2,
363 src->pixels + (j + 1) * src->stride, src->width, dest->width,
367 vs_scanline_merge_linear_YUYV (dest->pixels + i * dest->stride,
368 tmp1, tmp2, dest->width, x);
369 } else if (j == y2) {
372 vs_scanline_resample_linear_YUYV (tmp1,
373 src->pixels + (j + 1) * src->stride, src->width, dest->width,
377 vs_scanline_merge_linear_YUYV (dest->pixels + i * dest->stride,
378 tmp2, tmp1, dest->width, x);
381 vs_scanline_resample_linear_YUYV (tmp1, src->pixels + j * src->stride,
382 src->width, dest->width, &xacc, x_increment);
385 vs_scanline_resample_linear_YUYV (tmp2,
386 src->pixels + (j + 1) * src->stride, src->width, dest->width,
389 vs_scanline_merge_linear_YUYV (dest->pixels + i * dest->stride,
390 tmp1, tmp2, dest->width, x);
401 vs_image_scale_nearest_UYVY (const VSImage * dest, const VSImage * src,
411 if (dest->height == 1)
414 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
416 if (dest->width == 1)
419 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
422 for (i = 0; i < dest->height; i++) {
426 vs_scanline_resample_nearest_UYVY (dest->pixels + i * dest->stride,
427 src->pixels + j * src->stride, src->width, dest->width, &xacc,
435 vs_image_scale_linear_UYVY (const VSImage * dest, const VSImage * src,
451 if (dest->height == 1)
454 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
456 if (dest->width == 1)
459 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
461 dest_size = ROUND_UP_4 (dest->width * 2);
464 tmp2 = tmpbuf + dest_size;
469 vs_scanline_resample_linear_UYVY (tmp1, src->pixels, src->width, dest->width,
472 for (i = 0; i < dest->height; i++) {
478 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
479 } else if (j == y2) {
480 memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
483 vs_scanline_resample_linear_UYVY (tmp1, src->pixels + j * src->stride,
484 src->width, dest->width, &xacc, x_increment);
486 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
492 vs_scanline_resample_linear_UYVY (tmp2,
493 src->pixels + (j + 1) * src->stride, src->width, dest->width,
497 vs_scanline_merge_linear_UYVY (dest->pixels + i * dest->stride,
498 tmp1, tmp2, dest->width, x);
499 } else if (j == y2) {
502 vs_scanline_resample_linear_UYVY (tmp1,
503 src->pixels + (j + 1) * src->stride, src->width, dest->width,
507 vs_scanline_merge_linear_UYVY (dest->pixels + i * dest->stride,
508 tmp2, tmp1, dest->width, x);
511 vs_scanline_resample_linear_UYVY (tmp1, src->pixels + j * src->stride,
512 src->width, dest->width, &xacc, x_increment);
515 vs_scanline_resample_linear_UYVY (tmp2,
516 src->pixels + (j + 1) * src->stride, src->width, dest->width,
519 vs_scanline_merge_linear_UYVY (dest->pixels + i * dest->stride,
520 tmp1, tmp2, dest->width, x);
531 vs_image_scale_nearest_NV12 (const VSImage * dest, const VSImage * src,
541 if (dest->height == 1)
544 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
546 if (dest->width == 1)
549 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
552 for (i = 0; i < dest->height; i++) {
556 vs_scanline_resample_nearest_NV12 (dest->pixels + i * dest->stride,
557 src->pixels + j * src->stride, src->width, dest->width, &xacc,
565 vs_image_scale_linear_NV12 (const VSImage * dest, const VSImage * src,
581 if (dest->height == 1)
584 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
586 if (dest->width == 1)
589 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
591 dest_size = ROUND_UP_4 (dest->width * 2);
594 tmp2 = tmpbuf + dest_size;
599 vs_scanline_resample_linear_NV12 (tmp1, src->pixels, src->width, dest->width,
602 for (i = 0; i < dest->height; i++) {
608 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
609 } else if (j == y2) {
610 memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
613 vs_scanline_resample_linear_NV12 (tmp1, src->pixels + j * src->stride,
614 src->width, dest->width, &xacc, x_increment);
616 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
622 vs_scanline_resample_linear_NV12 (tmp2,
623 src->pixels + (j + 1) * src->stride, src->width, dest->width,
627 vs_scanline_merge_linear_NV12 (dest->pixels + i * dest->stride,
628 tmp1, tmp2, dest->width, x);
629 } else if (j == y2) {
632 vs_scanline_resample_linear_NV12 (tmp1,
633 src->pixels + (j + 1) * src->stride, src->width, dest->width,
637 vs_scanline_merge_linear_NV12 (dest->pixels + i * dest->stride,
638 tmp2, tmp1, dest->width, x);
641 vs_scanline_resample_linear_NV12 (tmp1, src->pixels + j * src->stride,
642 src->width, dest->width, &xacc, x_increment);
645 vs_scanline_resample_linear_NV12 (tmp2,
646 src->pixels + (j + 1) * src->stride, src->width, dest->width,
649 vs_scanline_merge_linear_NV12 (dest->pixels + i * dest->stride,
650 tmp1, tmp2, dest->width, x);
661 vs_image_scale_nearest_Y (const VSImage * dest, const VSImage * src,
670 if (dest->height == 1)
673 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
675 if (dest->width == 1)
678 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
681 for (i = 0; i < dest->height; i++) {
684 video_scale_orc_resample_nearest_u8 (dest->pixels + i * dest->stride,
685 src->pixels + j * src->stride, 0, x_increment, dest->width);
691 vs_image_scale_linear_Y (const VSImage * dest, const VSImage * src,
706 if (dest->height == 1)
709 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
711 if (dest->width == 1)
714 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
716 dest_size = dest->width;
719 tmp2 = tmpbuf + dest_size;
723 video_scale_orc_resample_bilinear_u8 (tmp1, src->pixels,
724 0, x_increment, dest->width);
726 for (i = 0; i < dest->height; i++) {
732 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
733 } else if (j == y2) {
734 memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
736 video_scale_orc_resample_bilinear_u8 (tmp1,
737 src->pixels + j * src->stride, 0, x_increment, dest->width);
739 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
744 video_scale_orc_resample_bilinear_u8 (tmp2,
745 src->pixels + (j + 1) * src->stride, 0, x_increment, dest->width);
749 memcpy (dest->pixels + i * dest->stride, tmp1, dest->width);
751 video_scale_orc_merge_linear_u8 (dest->pixels + i * dest->stride,
752 tmp1, tmp2, (x >> 8), dest->width);
754 } else if (j == y2) {
756 video_scale_orc_resample_bilinear_u8 (tmp1,
757 src->pixels + (j + 1) * src->stride, 0, x_increment, dest->width);
761 memcpy (dest->pixels + i * dest->stride, tmp2, dest->width);
763 video_scale_orc_merge_linear_u8 (dest->pixels + i * dest->stride,
764 tmp2, tmp1, (x >> 8), dest->width);
767 video_scale_orc_resample_bilinear_u8 (tmp1,
768 src->pixels + j * src->stride, 0, x_increment, dest->width);
770 video_scale_orc_resample_bilinear_u8 (tmp2,
771 src->pixels + (j + 1) * src->stride, 0, x_increment, dest->width);
774 memcpy (dest->pixels + i * dest->stride, tmp1, dest->width);
776 video_scale_orc_merge_linear_u8 (dest->pixels + i * dest->stride,
777 tmp1, tmp2, (x >> 8), dest->width);
787 vs_image_scale_nearest_Y16 (const VSImage * dest, const VSImage * src,
797 if (dest->height == 1)
800 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
802 if (dest->width == 1)
805 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
808 for (i = 0; i < dest->height; i++) {
812 vs_scanline_resample_nearest_Y16 (dest->pixels + i * dest->stride,
813 src->pixels + j * src->stride, src->width, dest->width, &xacc,
821 vs_image_scale_linear_Y16 (const VSImage * dest, const VSImage * src,
837 if (dest->height == 1)
840 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
842 if (dest->width == 1)
845 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
847 dest_size = 2 * dest->width;
850 tmp2 = tmpbuf + dest_size;
855 vs_scanline_resample_linear_Y16 (tmp1, src->pixels, src->width, dest->width,
858 for (i = 0; i < dest->height; i++) {
864 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
865 } else if (j == y2) {
866 memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
869 vs_scanline_resample_linear_Y16 (tmp1, src->pixels + j * src->stride,
870 src->width, dest->width, &xacc, x_increment);
872 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
878 vs_scanline_resample_linear_Y16 (tmp2,
879 src->pixels + (j + 1) * src->stride, src->width, dest->width,
883 vs_scanline_merge_linear_Y16 (dest->pixels + i * dest->stride,
884 tmp1, tmp2, dest->width, x);
885 } else if (j == y2) {
888 vs_scanline_resample_linear_Y16 (tmp1,
889 src->pixels + (j + 1) * src->stride, src->width, dest->width,
893 vs_scanline_merge_linear_Y16 (dest->pixels + i * dest->stride,
894 tmp2, tmp1, dest->width, x);
897 vs_scanline_resample_linear_Y16 (tmp1, src->pixels + j * src->stride,
898 src->width, dest->width, &xacc, x_increment);
901 vs_scanline_resample_linear_Y16 (tmp2,
902 src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
905 vs_scanline_merge_linear_Y16 (dest->pixels + i * dest->stride,
906 tmp1, tmp2, dest->width, x);
917 vs_image_scale_nearest_RGB565 (const VSImage * dest, const VSImage * src,
927 if (dest->height == 1)
930 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
932 if (dest->width == 1)
935 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
938 for (i = 0; i < dest->height; i++) {
942 vs_scanline_resample_nearest_RGB565 (dest->pixels + i * dest->stride,
943 src->pixels + j * src->stride, src->width, dest->width, &xacc,
951 vs_image_scale_linear_RGB565 (const VSImage * dest, const VSImage * src,
967 if (dest->height == 1)
970 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
972 if (dest->width == 1)
975 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
977 dest_size = dest->width * 2;
980 tmp2 = tmpbuf + dest_size;
985 vs_scanline_resample_linear_RGB565 (tmp1, src->pixels, src->width,
986 dest->width, &xacc, x_increment);
988 for (i = 0; i < dest->height; i++) {
994 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
995 } else if (j == y2) {
996 memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
999 vs_scanline_resample_linear_RGB565 (tmp1, src->pixels + j * src->stride,
1000 src->width, dest->width, &xacc, x_increment);
1002 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
1008 vs_scanline_resample_linear_RGB565 (tmp2,
1009 src->pixels + (j + 1) * src->stride, src->width, dest->width,
1010 &xacc, x_increment);
1013 vs_scanline_merge_linear_RGB565 (dest->pixels + i * dest->stride,
1014 tmp1, tmp2, dest->width, x);
1015 } else if (j == y2) {
1018 vs_scanline_resample_linear_RGB565 (tmp1,
1019 src->pixels + (j + 1) * src->stride, src->width, dest->width,
1020 &xacc, x_increment);
1023 vs_scanline_merge_linear_RGB565 (dest->pixels + i * dest->stride,
1024 tmp2, tmp1, dest->width, x);
1027 vs_scanline_resample_linear_RGB565 (tmp1, src->pixels + j * src->stride,
1028 src->width, dest->width, &xacc, x_increment);
1031 vs_scanline_resample_linear_RGB565 (tmp2,
1032 src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
1035 vs_scanline_merge_linear_RGB565 (dest->pixels + i * dest->stride,
1036 tmp1, tmp2, dest->width, x);
1047 vs_image_scale_nearest_RGB555 (const VSImage * dest, const VSImage * src,
1057 if (dest->height == 1)
1060 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
1062 if (dest->width == 1)
1065 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
1068 for (i = 0; i < dest->height; i++) {
1072 vs_scanline_resample_nearest_RGB555 (dest->pixels + i * dest->stride,
1073 src->pixels + j * src->stride, src->width, dest->width, &xacc,
1081 vs_image_scale_linear_RGB555 (const VSImage * dest, const VSImage * src,
1097 if (dest->height == 1)
1100 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
1102 if (dest->width == 1)
1105 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
1107 dest_size = dest->width * 2;
1110 tmp2 = tmpbuf + dest_size;
1115 vs_scanline_resample_linear_RGB555 (tmp1, src->pixels, src->width,
1116 dest->width, &xacc, x_increment);
1118 for (i = 0; i < dest->height; i++) {
1124 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
1125 } else if (j == y2) {
1126 memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
1129 vs_scanline_resample_linear_RGB555 (tmp1, src->pixels + j * src->stride,
1130 src->width, dest->width, &xacc, x_increment);
1132 memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
1138 vs_scanline_resample_linear_RGB555 (tmp2,
1139 src->pixels + (j + 1) * src->stride, src->width, dest->width,
1140 &xacc, x_increment);
1143 vs_scanline_merge_linear_RGB555 (dest->pixels + i * dest->stride,
1144 tmp1, tmp2, dest->width, x);
1145 } else if (j == y2) {
1148 vs_scanline_resample_linear_RGB555 (tmp1,
1149 src->pixels + (j + 1) * src->stride, src->width, dest->width,
1150 &xacc, x_increment);
1153 vs_scanline_merge_linear_RGB555 (dest->pixels + i * dest->stride,
1154 tmp2, tmp1, dest->width, x);
1157 vs_scanline_resample_linear_RGB555 (tmp1, src->pixels + j * src->stride,
1158 src->width, dest->width, &xacc, x_increment);
1161 vs_scanline_resample_linear_RGB555 (tmp2,
1162 src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
1165 vs_scanline_merge_linear_RGB555 (dest->pixels + i * dest->stride,
1166 tmp1, tmp2, dest->width, x);
1175 vs_image_scale_nearest_AYUV64 (const VSImage * dest, const VSImage * src,
1185 if (dest->height == 1)
1188 y_increment = ((src->height - 1) << 16) / (dest->height - 1);
1190 if (dest->width == 1)
1193 x_increment = ((src->width - 1) << 16) / (dest->width - 1);
1198 for (i = 0; i < dest->height; i++) {
1202 memcpy (dest->pixels + i * dest->stride,
1203 dest->pixels + (i - 1) * dest->stride, dest->width * 8);
1206 vs_scanline_resample_nearest_AYUV64 (dest->pixels + i * dest->stride,
1207 src->pixels + j * src->stride, src->width, dest->width, &xacc,
1217 vs_image_scale_linear_AYUV64 (const VSImage * dest, const VSImage * src,
1230 if (dest->height == 1)
1233 y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
1235 if (dest->width == 1)
1238 x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
1240 dest_size = dest->width * 8;
1243 #define LINE(x) ((guint16 *)((tmpbuf) + (dest_size)*((x)&1)))
1247 vs_scanline_resample_linear_AYUV64 ((guint8 *) LINE (0),
1248 src->pixels, src->width, dest->width, &xacc, x_increment);
1250 for (i = 0; i < dest->height; i++) {
1255 memcpy (dest->pixels + i * dest->stride, LINE (j), dest_size);
1259 vs_scanline_resample_linear_AYUV64 ((guint8 *) LINE (j),
1260 src->pixels + j * src->stride, src->width, dest->width, &xacc,
1266 vs_scanline_resample_linear_AYUV64 ((guint8 *) LINE (j + 1),
1267 src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
1269 video_scale_orc_merge_linear_u16 ((guint16 *) (dest->pixels +
1270 i * dest->stride), LINE (j), LINE (j + 1), 65536 - x, x,
1274 video_scale_orc_merge_linear_u16 ((guint16 *) (dest->pixels +
1275 i * dest->stride), LINE (j), LINE (j + 1), 65536 - x, x,