annotate libmpcodecs/vf_2xsai.c @ 35383:fa7a7312c47a

React more smoothly to user input/window redraw requests when playing slideshows.
author reimar
date Sun, 25 Nov 2012 14:46:47 +0000
parents 7af3e6f901fd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
1 /*
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
2 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
3 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
5 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
7 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
8 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
12 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
13 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
14 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
17 */
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
18
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
19 #include <stdio.h>
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
20 #include <stdlib.h>
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
21 #include <string.h>
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
22 #include <inttypes.h>
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
23
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 9593
diff changeset
24 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 9593
diff changeset
25 #include "mp_msg.h"
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
26
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
27 #include "img_format.h"
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
28 #include "mp_image.h"
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
29 #include "vf.h"
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
30
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
31 //===========================================================================//
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
32
24785
230123782da0 reminder that this filter has broken global vars
rfelker
parents: 17906
diff changeset
33 /* FIXME: these all belong in the context, not as globals! */
230123782da0 reminder that this filter has broken global vars
rfelker
parents: 17906
diff changeset
34
25003
c79fa5c75d4e Use proper inttypes.h types instead of broken uint32 etc. defines
reimar
parents: 24863
diff changeset
35 static uint32_t colorMask = 0xF7DEF7DE;
c79fa5c75d4e Use proper inttypes.h types instead of broken uint32 etc. defines
reimar
parents: 24863
diff changeset
36 static uint32_t lowPixelMask = 0x08210821;
c79fa5c75d4e Use proper inttypes.h types instead of broken uint32 etc. defines
reimar
parents: 24863
diff changeset
37 static uint32_t qcolorMask = 0xE79CE79C;
c79fa5c75d4e Use proper inttypes.h types instead of broken uint32 etc. defines
reimar
parents: 24863
diff changeset
38 static uint32_t qlowpixelMask = 0x18631863;
c79fa5c75d4e Use proper inttypes.h types instead of broken uint32 etc. defines
reimar
parents: 24863
diff changeset
39 static uint32_t redblueMask = 0xF81F;
c79fa5c75d4e Use proper inttypes.h types instead of broken uint32 etc. defines
reimar
parents: 24863
diff changeset
40 static uint32_t greenMask = 0x7E0;
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
41 static int PixelsPerMask = 2;
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
42
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
43 #define makecol(r,g,b) (r+(g<<8)+(b<<16))
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
44 #define makecol_depth(d,r,g,b) (r+(g<<8)+(b<<16))
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
45
30555
ad6740b58b0d libmpcodecs: Mark functions not used outside of their files as static.
diego
parents: 30421
diff changeset
46 static int Init_2xSaI(int d)
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
47 {
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
48
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
49 int minr = 0, ming = 0, minb = 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
50 int i;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
51
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
52 // if (d != 15 && d != 16 && d != 24 && d != 32)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
53 // return -1;
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
54
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
55 /* Get lowest color bit */
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
56 for (i = 0; i < 255; i++) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
57 if (!minr)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
58 minr = makecol(i, 0, 0);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
59 if (!ming)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
60 ming = makecol(0, i, 0);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
61 if (!minb)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
62 minb = makecol(0, 0, i);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
63 }
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
64
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
65 colorMask = (makecol_depth(d, 255, 0, 0) - minr) | (makecol_depth(d, 0, 255, 0) - ming) | (makecol_depth(d, 0, 0, 255) - minb);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
66 lowPixelMask = minr | ming | minb;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
67 qcolorMask = (makecol_depth(d, 255, 0, 0) - 3 * minr) | (makecol_depth(d, 0, 255, 0) - 3 * ming) | (makecol_depth(d, 0, 0, 255) - 3 * minb);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
68 qlowpixelMask = (minr * 3) | (ming * 3) | (minb * 3);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
69 redblueMask = makecol_depth(d, 255, 0, 255);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
70 greenMask = makecol_depth(d, 0, 255, 0);
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
71
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
72 PixelsPerMask = (d <= 16) ? 2 : 1;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
73
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
74 if (PixelsPerMask == 2) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
75 colorMask |= (colorMask << 16);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
76 qcolorMask |= (qcolorMask << 16);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
77 lowPixelMask |= (lowPixelMask << 16);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
78 qlowpixelMask |= (qlowpixelMask << 16);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
79 }
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
80
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
81 // TRACE("Color Mask: 0x%lX\n", colorMask);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
82 // TRACE("Low Pixel Mask: 0x%lX\n", lowPixelMask);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
83 // TRACE("QColor Mask: 0x%lX\n", qcolorMask);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
84 // TRACE("QLow Pixel Mask: 0x%lX\n", qlowpixelMask);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
85
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
86 return 0;
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
87 }
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
88
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
89
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
90 #define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B != D))
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
91
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
92 #define INTERPOLATE(A, B) (((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask))
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
93
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
94 #define Q_INTERPOLATE(A, B, C, D) ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2) \
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
95 + ((((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2) & qlowpixelMask)
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
96
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
97
30555
ad6740b58b0d libmpcodecs: Mark functions not used outside of their files as static.
diego
parents: 30421
diff changeset
98 static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch,
ad6740b58b0d libmpcodecs: Mark functions not used outside of their files as static.
diego
parents: 30421
diff changeset
99 uint8_t *dst, uint32_t dst_pitch,
ad6740b58b0d libmpcodecs: Mark functions not used outside of their files as static.
diego
parents: 30421
diff changeset
100 uint32_t width, uint32_t height, int sbpp)
ad6740b58b0d libmpcodecs: Mark functions not used outside of their files as static.
diego
parents: 30421
diff changeset
101 {
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
102
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
103 unsigned int x, y;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
104 uint32_t color[16];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
105 unsigned char *src_line[4];
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
106
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
107 /* Point to the first 3 lines. */
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
108 src_line[0] = src;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
109 src_line[1] = src;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
110 src_line[2] = src + src_pitch;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
111 src_line[3] = src + src_pitch * 2;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
112
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
113 x = 0, y = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
114
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
115 if (PixelsPerMask == 2) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
116 unsigned short *sbp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
117 sbp = (unsigned short*)src_line[0];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
118 color[0] = *sbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
119 color[4] = color[0]; color[5] = color[0]; color[6] = *(sbp + 1); color[7] = *(sbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
120 sbp = (unsigned short*)src_line[2];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
121 color[8] = *sbp; color[9] = color[8]; color[10] = *(sbp + 1); color[11] = *(sbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
122 sbp = (unsigned short*)src_line[3];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
123 color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
124 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
125 else {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
126 uint32_t *lbp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
127 lbp = (uint32_t*)src_line[0];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
128 color[0] = *lbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
129 color[4] = color[0]; color[5] = color[0]; color[6] = *(lbp + 1); color[7] = *(lbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
130 lbp = (uint32_t*)src_line[2];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
131 color[8] = *lbp; color[9] = color[8]; color[10] = *(lbp + 1); color[11] = *(lbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
132 lbp = (uint32_t*)src_line[3];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
133 color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
134 }
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
135
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
136 for (y = 0; y < height; y++) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
137 unsigned char *dst_line[2];
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
138
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
139 dst_line[0] = dst + dst_pitch*2*y;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
140 dst_line[1] = dst + dst_pitch*(2*y+1);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
141
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
142 /* Todo: x = width - 2, x = width - 1 */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
143
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
144 for (x = 0; x < width; x++) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
145 uint32_t product1a, product1b, product2a, product2b;
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
146
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
147 //--------------------------------------- B0 B1 B2 B3 0 1 2 3
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
148 // 4 5* 6 S2 -> 4 5* 6 7
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
149 // 1 2 3 S1 8 9 10 11
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
150 // A0 A1 A2 A3 12 13 14 15
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
151 //--------------------------------------
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
152 if (color[9] == color[6] && color[5] != color[10]) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
153 product2b = color[9];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
154 product1b = product2b;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
155 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
156 else if (color[5] == color[10] && color[9] != color[6]) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
157 product2b = color[5];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
158 product1b = product2b;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
159 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
160 else if (color[5] == color[10] && color[9] == color[6]) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
161 int r = 0;
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
162
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
163 r += GET_RESULT(color[6], color[5], color[8], color[13]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
164 r += GET_RESULT(color[6], color[5], color[4], color[1]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
165 r += GET_RESULT(color[6], color[5], color[14], color[11]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
166 r += GET_RESULT(color[6], color[5], color[2], color[7]);
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
167
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
168 if (r > 0)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
169 product1b = color[6];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
170 else if (r < 0)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
171 product1b = color[5];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
172 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
173 product1b = INTERPOLATE(color[5], color[6]);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
174
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
175 product2b = product1b;
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
176
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
177 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
178 else {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
179 if (color[6] == color[10] && color[10] == color[13] && color[9] != color[14] && color[10] != color[12])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
180 product2b = Q_INTERPOLATE(color[10], color[10], color[10], color[9]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
181 else if (color[5] == color[9] && color[9] == color[14] && color[13] != color[10] && color[9] != color[15])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
182 product2b = Q_INTERPOLATE(color[9], color[9], color[9], color[10]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
183 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
184 product2b = INTERPOLATE(color[9], color[10]);
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
185
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
186 if (color[6] == color[10] && color[6] == color[1] && color[5] != color[2] && color[6] != color[0])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
187 product1b = Q_INTERPOLATE(color[6], color[6], color[6], color[5]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
188 else if (color[5] == color[9] && color[5] == color[2] && color[1] != color[6] && color[5] != color[3])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
189 product1b = Q_INTERPOLATE(color[6], color[5], color[5], color[5]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
190 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
191 product1b = INTERPOLATE(color[5], color[6]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
192 }
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
193
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
194 if (color[5] == color[10] && color[9] != color[6] && color[4] == color[5] && color[5] != color[14])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
195 product2a = INTERPOLATE(color[9], color[5]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
196 else if (color[5] == color[8] && color[6] == color[5] && color[4] != color[9] && color[5] != color[12])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
197 product2a = INTERPOLATE(color[9], color[5]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
198 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
199 product2a = color[9];
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
200
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
201 if (color[9] == color[6] && color[5] != color[10] && color[8] == color[9] && color[9] != color[2])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
202 product1a = INTERPOLATE(color[9], color[5]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
203 else if (color[4] == color[9] && color[10] == color[9] && color[8] != color[5] && color[9] != color[0])
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
204 product1a = INTERPOLATE(color[9], color[5]);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
205 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
206 product1a = color[5];
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
207
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
208 if (PixelsPerMask == 2) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
209 *((uint32_t *) (&dst_line[0][x * 4])) = product1a | (product1b << 16);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
210 *((uint32_t *) (&dst_line[1][x * 4])) = product2a | (product2b << 16);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
211 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
212 else {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
213 *((uint32_t *) (&dst_line[0][x * 8])) = product1a;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
214 *((uint32_t *) (&dst_line[0][x * 8 + 4])) = product1b;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
215 *((uint32_t *) (&dst_line[1][x * 8])) = product2a;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
216 *((uint32_t *) (&dst_line[1][x * 8 + 4])) = product2b;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
217 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
218
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
219 /* Move color matrix forward */
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
220 color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
221 color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
222 color[2] = color[3]; color[6] = color[7]; color[10] = color[11]; color[14] = color[15];
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
223
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
224 if (x < width - 3) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
225 x += 3;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
226 if (PixelsPerMask == 2) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
227 color[3] = *(((unsigned short*)src_line[0]) + x);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
228 color[7] = *(((unsigned short*)src_line[1]) + x);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
229 color[11] = *(((unsigned short*)src_line[2]) + x);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
230 color[15] = *(((unsigned short*)src_line[3]) + x);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
231 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
232 else {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
233 color[3] = *(((uint32_t*)src_line[0]) + x);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
234 color[7] = *(((uint32_t*)src_line[1]) + x);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
235 color[11] = *(((uint32_t*)src_line[2]) + x);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
236 color[15] = *(((uint32_t*)src_line[3]) + x);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
237 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
238 x -= 3;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
239 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
240 }
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
241
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
242 /* We're done with one line, so we shift the source lines up */
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
243 src_line[0] = src_line[1];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
244 src_line[1] = src_line[2];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
245 src_line[2] = src_line[3];
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
246
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
247 /* Read next line */
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
248 if (y + 3 >= height)
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
249 src_line[3] = src_line[2];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
250 else
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
251 src_line[3] = src_line[2] + src_pitch;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
252
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
253 /* Then shift the color matrix up */
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
254 if (PixelsPerMask == 2) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
255 unsigned short *sbp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
256 sbp = (unsigned short*)src_line[0];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
257 color[0] = *sbp; color[1] = color[0]; color[2] = *(sbp + 1); color[3] = *(sbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
258 sbp = (unsigned short*)src_line[1];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
259 color[4] = *sbp; color[5] = color[4]; color[6] = *(sbp + 1); color[7] = *(sbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
260 sbp = (unsigned short*)src_line[2];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
261 color[8] = *sbp; color[9] = color[9]; color[10] = *(sbp + 1); color[11] = *(sbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
262 sbp = (unsigned short*)src_line[3];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
263 color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
264 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
265 else {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
266 uint32_t *lbp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
267 lbp = (uint32_t*)src_line[0];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
268 color[0] = *lbp; color[1] = color[0]; color[2] = *(lbp + 1); color[3] = *(lbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
269 lbp = (uint32_t*)src_line[1];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
270 color[4] = *lbp; color[5] = color[4]; color[6] = *(lbp + 1); color[7] = *(lbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
271 lbp = (uint32_t*)src_line[2];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
272 color[8] = *lbp; color[9] = color[9]; color[10] = *(lbp + 1); color[11] = *(lbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
273 lbp = (uint32_t*)src_line[3];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
274 color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
275 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
276
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
277 } // y loop
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
278
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
279 }
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
280
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
281
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
282 //===========================================================================//
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
283
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
284 static int config(struct vf_instance *vf,
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
285 int width, int height, int d_width, int d_height,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
286 unsigned int flags, unsigned int outfmt){
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
287
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
288 Init_2xSaI(outfmt&255);
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
289
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
290 return vf_next_config(vf,2*width,2*height,2*d_width,2*d_height,flags,outfmt);
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
291 }
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
292
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
293 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
294 mp_image_t *dmpi;
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
295
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
296 // hope we'll get DR buffer:
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
297 dmpi=vf_get_image(vf->next,mpi->imgfmt,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
298 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
299 2*mpi->w, 2*mpi->h);
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
300
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
301 Super2xSaI_ex(mpi->planes[0], mpi->stride[0],
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
302 dmpi->planes[0], dmpi->stride[0],
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
303 mpi->w, mpi->h, mpi->bpp/8);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25670
diff changeset
304
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
305 return vf_next_put_image(vf,dmpi, pts);
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
306 }
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
307
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
308 //===========================================================================//
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
309
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
310 static int query_format(struct vf_instance *vf, unsigned int fmt){
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
311 switch(fmt){
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
312 // case IMGFMT_BGR15:
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
313 // case IMGFMT_BGR16:
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
314 case IMGFMT_BGR32:
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30642
diff changeset
315 return vf_next_query_format(vf,fmt);
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
316 }
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
317 return 0;
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
318 }
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
319
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30555
diff changeset
320 static int vf_open(vf_instance_t *vf, char *args){
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
321 vf->config=config;
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
322 vf->put_image=put_image;
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
323 vf->query_format=query_format;
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
324 return 1;
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
325 }
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
326
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 25004
diff changeset
327 const vf_info_t vf_info_2xsai = {
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
328 "2xSai BGR bitmap 2x scaler",
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
329 "2xsai",
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
330 "A'rpi",
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
331 "http://elektron.its.tudelft.nl/~dalikifa/",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30555
diff changeset
332 vf_open,
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 8123
diff changeset
333 NULL
7919
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
334 };
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
335
b8acdbfd0882 2xSai filter... just for fun, imho useless
arpi
parents:
diff changeset
336 //===========================================================================//