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.
20 #include "gstsparrow.h"
27 play_from_lut(GstSparrow
*sparrow
, guint8
*in
, guint8
*out
){
28 sparrow_map_t
*map
= &sparrow
->map
;
29 memset(out
, 0, sparrow
->out
.size
);
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
++){
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
;
46 play_from_full_lut(GstSparrow
*sparrow
, guint8
*in
, guint8
*out
){
47 memset(out
, 0, sparrow
->out
.size
);
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
;
56 out32
[i
] = ~in32
[y
* sparrow
->in
.width
+ x
];
61 debug_frame(sparrow
, out
, sparrow
->out
.width
, sparrow
->out
.height
, PIXSIZE
);
68 simple_negation(guint8
* bytes
, guint size
){
70 guint32
* data
= (guint32
*)bytes
;
71 //could use sse for superspeed
72 for (i
= 0; i
< size
/ 4; i
++){
79 gamma_negation(GstSparrow
*sparrow
, guint8
*in
, guint8
*out
){
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]];
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);
93 play_from_full_lut(sparrow
, in
, out
);
95 play_from_lut(sparrow
, in
, out
);
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");