Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #46 from jliljebl/cleanups-batch-4

Cleanups batch 4
  • Loading branch information...
commit 163b9791ce5706cafd2a6a6835076d8c9c5f0b46 2 parents dbef0a5 + c232b9d
@ddennedy ddennedy authored
View
11 src/modules/core/filter_audioconvert.c
@@ -568,7 +568,7 @@ static int convert_audio( mlt_frame frame, void **audio, mlt_audio_format *forma
/** Filter processing.
*/
-static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
+static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
{
frame->convert_audio = convert_audio;
return frame;
@@ -579,8 +579,9 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
mlt_filter filter_audioconvert_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
- mlt_filter this = calloc( 1, sizeof( struct mlt_filter_s ) );
- if ( mlt_filter_init( this, this ) == 0 )
- this->process = filter_process;
- return this;
+ mlt_filter filter = calloc( 1, sizeof( struct mlt_filter_s ) );
+ if ( mlt_filter_init( filter, filter ) == 0 )
+ filter->process = filter_process;
+ return filter;
}
+
View
16 src/modules/core/filter_audiowave.c
@@ -27,13 +27,13 @@
/** Do it :-).
*/
-static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
+static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
int size = *width * *height * 2;
*format = mlt_image_yuv422;
*image = mlt_pool_alloc( size );
- mlt_frame_set_image( this, *image, size, mlt_pool_release );
- uint8_t *wave = mlt_frame_get_waveform( this, *width, *height );
+ mlt_frame_set_image( frame, *image, size, mlt_pool_release );
+ uint8_t *wave = mlt_frame_get_waveform( frame, *width, *height );
if ( wave )
{
uint8_t *p = *image;
@@ -52,7 +52,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
/** Filter processing.
*/
-static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
+static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
{
mlt_frame_push_get_image( frame, filter_get_image );
return frame;
@@ -63,9 +63,9 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
mlt_filter filter_audiowave_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
- mlt_filter this = mlt_filter_new( );
- if ( this != NULL )
- this->process = filter_process;
- return this;
+ mlt_filter filter = mlt_filter_new( );
+ if ( filter != NULL )
+ filter->process = filter_process;
+ return filter;
}
View
15 src/modules/core/filter_region.c
@@ -71,9 +71,9 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
return mlt_frame_get_image( frame, image, format, width, height, writable );
}
-static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
+static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
{
- mlt_frame_push_service( frame, this );
+ mlt_frame_push_service( frame, filter );
mlt_frame_push_get_image( frame, filter_get_image );
return frame;
@@ -85,16 +85,16 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
mlt_filter filter_region_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
// Create a new filter
- mlt_filter this = mlt_filter_new( );
+ mlt_filter filter = mlt_filter_new( );
// Further initialisation
- if ( this != NULL )
+ if ( filter != NULL )
{
// Get the properties from the filter
- mlt_properties properties = MLT_FILTER_PROPERTIES( this );
+ mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
// Assign the filter process method
- this->process = filter_process;
+ filter->process = filter_process;
// Resource defines the shape of the region
mlt_properties_set( properties, "resource", arg == NULL ? "rectangle" : arg );
@@ -104,5 +104,6 @@ mlt_filter filter_region_init( mlt_profile profile, mlt_service_type type, const
}
// Return the filter
- return this;
+ return filter;
}
+
View
46 src/modules/core/filter_transition.c
@@ -27,41 +27,41 @@
NB: Not all transitions will accept a and b frames being the same...
*/
-static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
+static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
- mlt_transition transition = mlt_frame_pop_service( this );
- if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "image_count" ) >= 1 )
- mlt_transition_process( transition, this, this );
- return mlt_frame_get_image( this, image, format, width, height, writable );
+ mlt_transition transition = mlt_frame_pop_service( frame );
+ if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "image_count" ) >= 1 )
+ mlt_transition_process( transition, frame, frame );
+ return mlt_frame_get_image( frame, image, format, width, height, writable );
}
/** Get the audio via the transition.
NB: Not all transitions will accept a and b frames being the same...
*/
-static int filter_get_audio( mlt_frame this, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
+static int filter_get_audio( mlt_frame frame, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
{
// Obtain the transition instance
- mlt_transition transition = mlt_frame_pop_audio( this );
- mlt_transition_process( transition, this, this );
- return mlt_frame_get_audio( this, buffer, format, frequency, channels, samples );
+ mlt_transition transition = mlt_frame_pop_audio( frame );
+ mlt_transition_process( transition, frame, frame );
+ return mlt_frame_get_audio( frame, buffer, format, frequency, channels, samples );
}
/** Filter processing.
*/
-static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
+static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
{
// Obtain the transition instance
- mlt_transition transition = mlt_properties_get_data( MLT_FILTER_PROPERTIES( this ), "instance", NULL );
+ mlt_transition transition = mlt_properties_get_data( MLT_FILTER_PROPERTIES( filter ), "instance", NULL );
// If we haven't created the instance, do it now
if ( transition == NULL )
{
- char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "transition" );
- mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( this ) );
+ char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "transition" );
+ mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
transition = mlt_factory_transition( profile, name, NULL );
- mlt_properties_set_data( MLT_FILTER_PROPERTIES( this ), "instance", transition, 0, ( mlt_destructor )mlt_transition_close, NULL );
+ mlt_properties_set_data( MLT_FILTER_PROPERTIES( filter ), "instance", transition, 0, ( mlt_destructor )mlt_transition_close, NULL );
}
// We may still not have a transition...
@@ -71,11 +71,11 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
int type = mlt_properties_get_int( MLT_TRANSITION_PROPERTIES( transition ), "_transition_type" );
// Set the basic info
- mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "in", mlt_properties_get_int( MLT_FILTER_PROPERTIES( this ), "in" ) );
- mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "out", mlt_properties_get_int( MLT_FILTER_PROPERTIES( this ), "out" ) );
+ mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "in", mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "in" ) );
+ mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "out", mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "out" ) );
// Refresh with current user values
- mlt_properties_pass( MLT_TRANSITION_PROPERTIES( transition ), MLT_FILTER_PROPERTIES( this ), "transition." );
+ mlt_properties_pass( MLT_TRANSITION_PROPERTIES( transition ), MLT_FILTER_PROPERTIES( filter ), "transition." );
if ( type & 1 && !mlt_frame_is_test_card( frame ) && !( mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "hide" ) & 1 ) )
{
@@ -93,7 +93,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
}
else
{
- mlt_properties_debug( MLT_FILTER_PROPERTIES( this ), "no transition", stderr );
+ mlt_properties_debug( MLT_FILTER_PROPERTIES( filter ), "no transition", stderr );
}
return frame;
@@ -104,12 +104,12 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
mlt_filter filter_transition_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
- mlt_filter this = mlt_filter_new( );
- if ( this != NULL )
+ mlt_filter filter = mlt_filter_new( );
+ if ( filter != NULL )
{
- mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "transition", arg );
- this->process = filter_process;
+ mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "transition", arg );
+ filter->process = filter_process;
}
- return this;
+ return filter;
}
View
69 src/modules/oldfilm/filter_vignette.c
@@ -24,22 +24,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
+
#define MIN(a,b) (a<b?a:b)
#define MAX(a,b) (a<b?b:a)
-
#define SIGMOD_STEPS 1000
#define POSITION_VALUE(p,s,e) (s+((double)(e-s)*p ))
-static float geometry_to_float(char *val, mlt_position pos )
+static float geometry_to_float( char *val, mlt_position pos )
{
float ret=0.0;
struct mlt_geometry_item_s item;
- mlt_geometry geom=mlt_geometry_init();
- mlt_geometry_parse(geom,val,-1,-1,-1);
- mlt_geometry_fetch(geom,&item , pos );
- ret=item.x;
- mlt_geometry_close(geom);
+ mlt_geometry geom = mlt_geometry_init();
+ mlt_geometry_parse( geom, val, -1, -1, -1);
+ mlt_geometry_fetch( geom, &item, pos );
+ ret = item.x;
+ mlt_geometry_close( geom );
return ret;
}
@@ -56,42 +56,49 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
mlt_properties filter_props = MLT_FILTER_PROPERTIES( filter ) ;
mlt_position pos = mlt_filter_get_position( filter, frame );
- smooth = geometry_to_float ( mlt_properties_get( filter_props , "smooth" ) , pos ) * 100.0 ;
- radius = geometry_to_float ( mlt_properties_get( filter_props , "radius" ) , pos ) * *width;
- cx = geometry_to_float ( mlt_properties_get( filter_props , "x" ) , pos ) * *width;
- cy = geometry_to_float ( mlt_properties_get( filter_props , "y" ) , pos ) * *height;
- opac = geometry_to_float ( mlt_properties_get( filter_props , "opacity" ) , pos );
+ smooth = geometry_to_float( mlt_properties_get( filter_props, "smooth" ), pos ) * 100.0 ;
+ radius = geometry_to_float( mlt_properties_get( filter_props, "radius" ), pos ) * *width;
+ cx = geometry_to_float( mlt_properties_get( filter_props, "x" ), pos ) * *width;
+ cy = geometry_to_float( mlt_properties_get( filter_props, "y" ), pos ) * *height;
+ opac = geometry_to_float( mlt_properties_get( filter_props, "opacity" ), pos );
int mode = mlt_properties_get_int( filter_props , "mode" );
int video_width = *width;
int video_height = *height;
- int x,y;
- int w2=cx,h2=cy;
- double delta=1.0;
- double max_opac=opac;
- for (y=0;y<video_height;y++){
- int h2_pow2=pow(y-h2,2.0);
- for (x=0;x<video_width;x++){
- uint8_t *pix=(*image+y*video_width*2+x*2);
- int dx=sqrt(h2_pow2+pow(x-w2,2.0));
+ int x, y;
+ int w2 = cx, h2 = cy;
+ double delta = 1.0;
+ double max_opac = opac;
+ for ( y=0; y < video_height; y++ )
+ {
+ int h2_pow2 = pow( y - h2, 2.0 );
+ for ( x = 0; x < video_width; x++ )
+ {
+ uint8_t *pix = ( *image + y * video_width * 2 + x * 2 );
+ int dx = sqrt( h2_pow2 + pow( x - w2, 2.0 ));
- if (radius-smooth>dx){ //center, make not darker
+ if (radius-smooth > dx) //center, make not darker
+ {
continue;
}
- else if (radius+smooth<=dx){//max dark after smooth area
- delta=0.0;
- }else{
+ else if ( radius + smooth <= dx ) //max dark after smooth area
+ {
+ delta = 0.0;
+ }
+ else
+ {
// linear pos from of opacity (from 0 to 1)
- delta=(double)(radius+smooth-dx)/(2.0*smooth);
- if (mode==1){
+ delta = (double) ( radius + smooth - dx ) / ( 2.0 * smooth );
+ if ( mode == 1 )
+ {
//make cos for smoother non linear fade
- delta = (double)pow(cos(((1.0-delta)*3.14159/2.0)),3.0);
+ delta = (double) pow( cos((( 1.0 - delta ) * 3.14159 / 2.0 )), 3.0 );
}
}
- delta=MAX(max_opac,delta);
- *pix=(double)(*pix)*delta;
- *(pix+1)=((double)(*(pix+1)-127.0)*delta)+127.0;
+ delta = MAX( max_opac, delta );
+ *pix = (double) (*pix) * delta;
+ *(pix+1) = ((double)(*(pix+1) - 127.0 ) * delta ) + 127.0;
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.