simplify mode_find_edges by splitting the sub-modes into separate functions
[sparrow.git] / play.c
blob057430cc73b316819bf5561118efa8db8cbbddc1
1 /* Copyright (C) <2010> Douglas Bagnall <douglas@halo.gen.nz>
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Library General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 02111-1307, USA.
19 #include "sparrow.h"
20 #include "gstsparrow.h"
22 #include <string.h>
23 #include <math.h>
26 static void
27 play_from_lut(GstSparrow *sparrow, guint8 *in, guint8 *out){
28 sparrow_map_t *map = &sparrow->map;
29 memset(out, 0, sparrow->out.size);
30 int x, y;
31 guint32 *line = (guint32 *)out;
32 for (y = 0; y < sparrow->out.height; y++){
33 sparrow_map_row_t *row = map->rows + y;
34 line += sparrow->out.width;
35 for(x = row->start; x < row->end; x++){
36 line[x] = ~0;
38 //GST_DEBUG("row %d: s %d e%d", y, row->start, row->end);
43 UNUSED
44 static void
45 simple_negation(guint8 * bytes, guint size){
46 guint i;
47 guint32 * data = (guint32 *)bytes;
48 //could use sse for superspeed
49 for (i = 0; i < size / 4; i++){
50 data[i] = ~data[i];
54 UNUSED
55 static void
56 gamma_negation(GstSparrow *sparrow, guint8 *in, guint8 *out){
57 //guint i;
58 //XXX could try oil_tablelookup_u8
59 //for (i = 0; i < size; i++){
60 // out[i] = sparrow_rgb_gamma_full_range_REVERSE[in[i]];
61 // }
64 INVISIBLE sparrow_state
65 mode_play(GstSparrow *sparrow, guint8 *in, guint8 *out){
66 //do actual stuff here
67 //memcpy(out, in, sparrow->out.size);
68 //simple_negation(out, sparrow->out.size);
69 play_from_lut(sparrow, in, out);
70 return SPARROW_STATUS_QUO;
73 INVISIBLE void init_play(GstSparrow *sparrow){}
74 INVISIBLE void finalise_play(GstSparrow *sparrow){}