2 #include "gstsparrow.h"
10 typedef struct sparrow_play_s
{
15 GstBuffer
*old_frames
[OLD_FRAMES
];
21 #define SUBPIXEL(x) static inline guint8 one_subpixel_##x \
22 (sparrow_play_t *player, guint8 inpix, guint8 jpegpix, guint8 oldpix)
25 SUBPIXEL(gamma_clamp
){
26 /*clamp in pseudo gamma space*/
27 int gj
= player
->lut_hi
[jpegpix
];
28 int gi
= player
->lut_hi
[inpix
];
32 return player
->lut_lo
[diff
];
38 int diff
= jpegpix
- inpix
;
44 SUBPIXEL(full_mirror
){
45 /*full mirror -SEGFAULTS */
46 int diff
= jpegpix
- inpix
;
48 return -diff
; /*or -diff /2 */
53 guint sum
= jpegpix
+ inpix
;
58 int sum
= player
->lut_hi
[jpegpix
] + player
->lut_hi
[255 - inpix
];
59 return player
->lut_lo
[sum
>> 1];
63 int sum
= jpegpix
+ ((oldpix
- inpix
) >> 1);
71 SUBPIXEL(gentle_clamp
){
73 int error
= MAX(inpix
- oldpix
, 0) >> 1;
74 int diff
= jpegpix
- error
;
81 int error
= MAX(inpix
- oldpix
, 0) >> 1;
82 int diff
= jpegpix
- error
- (inpix
>> 1);
90 SUBPIXEL(inverse_clamp
){
92 int error
= MAX(oldpix
- inpix
, 0);
93 int diff
= jpegpix
+ error
;
101 SUBPIXEL(gamma_oldpix
){
102 /*clamp in pseudo gamma space*/
103 int jpeg_gamma
= player
->lut_lo
[jpegpix
];
104 int in_gamma
= player
->lut_lo
[inpix
];
105 int old_gamma
= player
->lut_lo
[oldpix
];
106 int error
= (in_gamma
- old_gamma
) >> 1;
107 int diff
= jpeg_gamma
- error
;
110 return player
->lut_hi
[diff
];
114 SUBPIXEL(gamma_clamp_oldpix_gentle
){
115 /*clamp in pseudo gamma space*/
116 int jpeg_gamma
= player
->lut_hi
[jpegpix
];
117 int in_gamma
= player
->lut_hi
[inpix
];
118 int old_gamma
= player
->lut_hi
[oldpix
];
119 int error
= MAX(in_gamma
- old_gamma
, 0) >> 1;
120 int diff
= jpeg_gamma
- error
;
123 return player
->lut_lo
[diff
];
126 SUBPIXEL(gamma_clamp_oldpix
){
127 /*clamp in pseudo gamma space*/
128 int jpeg_gamma
= player
->lut_hi
[jpegpix
];
129 int in_gamma
= player
->lut_hi
[inpix
];
130 int old_gamma
= player
->lut_hi
[oldpix
];
131 int error
= MAX(in_gamma
- old_gamma
, 0);
132 int diff
= jpeg_gamma
- error
;
135 return player
->lut_lo
[diff
];
142 int target
= 2 * jpegpix
- oldpix
;
143 int diff
= (target
- inpix
-inpix
) >> 1;