remove more unused stuff
[sparrow.git] / play.c
bloba748494b480ea737d66d6fddab1f54b04f73c4b4
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 UNUSED
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 for(x = row->start; x < row->end; x++){
35 line[x] = ~0;
38 GST_DEBUG("row %p %d: s %d e%d line %d\n",
39 row, y, row->start, row->end, line);
41 line += sparrow->out.width;
45 static void
46 play_from_full_lut(GstSparrow *sparrow, guint8 *in, guint8 *out){
47 memset(out, 0, sparrow->out.size);
48 guint i;
49 guint32 *out32 = (guint32 *)out;
50 guint32 *in32 = (guint32 *)in;
51 for (i = 0; i < sparrow->out.pixcount; i++){
52 if (sparrow->screenmask[i]){
53 int x = sparrow->map_lut[i].x >> SPARROW_MAP_LUT_SHIFT;
54 int y = sparrow->map_lut[i].y >> SPARROW_MAP_LUT_SHIFT;
55 if (x || y){
56 out32[i] = ~in32[y * sparrow->in.width + x];
60 if (sparrow->debug){
61 debug_frame(sparrow, out, sparrow->out.width, sparrow->out.height, PIXSIZE);
66 UNUSED
67 static void
68 simple_negation(guint8 * bytes, guint size){
69 guint i;
70 guint32 * data = (guint32 *)bytes;
71 //could use sse for superspeed
72 for (i = 0; i < size / 4; i++){
73 data[i] = ~data[i];
77 UNUSED
78 static void
79 gamma_negation(GstSparrow *sparrow, guint8 *in, guint8 *out){
80 //guint i;
81 //XXX could try oil_tablelookup_u8
82 //for (i = 0; i < size; i++){
83 // out[i] = sparrow_rgb_gamma_full_range_REVERSE[in[i]];
84 // }
87 INVISIBLE sparrow_state
88 mode_play(GstSparrow *sparrow, guint8 *in, guint8 *out){
89 //do actual stuff here
90 //memcpy(out, in, sparrow->out.size);
91 //simple_negation(out, sparrow->out.size);
92 #if USE_FULL_LUT
93 play_from_full_lut(sparrow, in, out);
94 #else
95 play_from_lut(sparrow, in, out);
96 #endif
97 return SPARROW_STATUS_QUO;
100 INVISIBLE void init_play(GstSparrow *sparrow){
101 GST_DEBUG("starting play mode\n");
104 INVISIBLE void finalise_play(GstSparrow *sparrow){
105 GST_DEBUG("leaving play mode\n");