X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Flumas%2Fluma.c;h=088961229c35ab91a6fed3ad574d0c80f0b24a5c;hb=61a1fd80791f7ff2042756814b2868c797426b9a;hp=76f927a1d1ca9c1bb99285c5c321a327ff294ff8;hpb=24fd9b1360d877a8db8b3ef472c7651ec2cf71a2;p=melted diff --git a/src/modules/lumas/luma.c b/src/modules/lumas/luma.c index 76f927a..0889612 100644 --- a/src/modules/lumas/luma.c +++ b/src/modules/lumas/luma.c @@ -1,3 +1,23 @@ +/* + * luma.c -- image generator for transition_luma + * Copyright (C) 2003-2004 Ushodaya Enterprises Limited + * Author: Charles Yates + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include #include #include @@ -20,11 +40,13 @@ typedef struct int pflip; int pflop; int quart; + int rotate; } luma; void luma_init( luma *this ) { + memset( this, 0, sizeof( luma ) ); this->type = 0; this->w = 720; this->h = 576; @@ -79,6 +101,13 @@ uint16_t *luma_render( luma *this ) this->h *= 2; } + if ( this->rotate ) + { + int t = this->w; + this->w = this->h; + this->h = t; + } + int max = ( 1 << 16 ) - 1; uint16_t *image = malloc( this->w * this->h * sizeof( uint16_t ) ); uint16_t *end = image + this->w * this->h; @@ -298,6 +327,26 @@ uint16_t *luma_render( luma *this ) } } + if ( this->rotate ) + { + uint16_t *image2 = malloc( this->w * this->h * sizeof( uint16_t ) ); + for ( i = 0; i < this->h; i ++ ) + { + p = image + i * this->w; + r = image2 + this->h - i - 1; + for ( j = 0; j < this->w; j ++ ) + { + *r = *( p ++ ); + r += this->h; + } + } + i = this->w; + this->w = this->h; + this->h = i; + free( image ); + image = image2; + } + return image; } @@ -345,6 +394,8 @@ int main( int argc, char **argv ) this.pflop = atoi( argv[ ++ arg ] ); else if ( !strcmp( argv[ arg ], "-quart" ) ) this.quart = atoi( argv[ ++ arg ] ); + else if ( !strcmp( argv[ arg ], "-rotate" ) ) + this.rotate = atoi( argv[ ++ arg ] ); else fprintf( stderr, "ignoring %s\n", argv[ arg ] ); }