- // Pointer to the middle of the input line
- in_line = in_middle + ( dy >> 16 ) * istride;
-
- // Loop for the entirety of our output row.
- for ( dx = - outer; dx < outer; dx += scale_width )
- {
- base = dx >> 15;
- base &= 0xfffffffe;
- *out_ptr ++ = *( in_line + base );
- base &= 0xfffffffc;
- *out_ptr ++ = *( in_line + base + 1 );
- dx += scale_width;
- base = dx >> 15;
- base &= 0xfffffffe;
- *out_ptr ++ = *( in_line + base );
- base &= 0xfffffffc;
- *out_ptr ++ = *( in_line + base + 3 );
- }
-
- // Move to next output line
- out_line += ostride;
- }
-
- // Now update the frame
- mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * 2, ( mlt_destructor )mlt_pool_release, NULL );
- mlt_properties_set_int( properties, "width", owidth );
- mlt_properties_set_int( properties, "height", oheight );
-
- // Return the output
- return output;
- }
-
- // No change, return input
- return input;
-}
-
-int mlt_frame_mix_audio( mlt_frame this, mlt_frame that, float weight_start, float weight_end, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
-{
- int ret = 0;
- int16_t *src, *dest;
- int frequency_src = *frequency, frequency_dest = *frequency;
- int channels_src = *channels, channels_dest = *channels;
- int samples_src = *samples, samples_dest = *samples;
- int i, j;
- double d = 0, s = 0;
-
- mlt_frame_get_audio( that, &src, format, &frequency_src, &channels_src, &samples_src );
- mlt_frame_get_audio( this, &dest, format, &frequency_dest, &channels_dest, &samples_dest );
-
- int silent = mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "silent_audio" );
- mlt_properties_set_int( MLT_FRAME_PROPERTIES( this ), "silent_audio", 0 );
- if ( silent )
- memset( dest, 0, samples_dest * channels_dest * sizeof( int16_t ) );
-
- silent = mlt_properties_get_int( MLT_FRAME_PROPERTIES( that ), "silent_audio" );
- mlt_properties_set_int( MLT_FRAME_PROPERTIES( that ), "silent_audio", 0 );
- if ( silent )
- memset( src, 0, samples_src * channels_src * sizeof( int16_t ) );
-
- if ( channels_src > 6 )
- channels_src = 0;
- if ( channels_dest > 6 )
- channels_dest = 0;
- if ( samples_src > 4000 )
- samples_src = 0;
- if ( samples_dest > 4000 )
- samples_dest = 0;
-
- // determine number of samples to process
- *samples = samples_src < samples_dest ? samples_src : samples_dest;
- *channels = channels_src < channels_dest ? channels_src : channels_dest;
- *buffer = dest;
- *frequency = frequency_dest;
-
- // Compute a smooth ramp over start to end
- float weight = weight_start;
- float weight_step = ( weight_end - weight_start ) / *samples;
-
- if ( src == dest )
- {
- *samples = samples_src;
- *channels = channels_src;
- *buffer = src;
- *frequency = frequency_src;
- return ret;
- }
-
- // Mixdown
- for ( i = 0; i < *samples; i++ )