1 /*****************************************************************************
2 * effects.c : Effects for the visualization system
3 *****************************************************************************
4 * Copyright (C) 2002 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
27 #include <stdlib.h> /* malloc(), free() */
39 /*****************************************************************************
41 *****************************************************************************/
42 int dummy_Run( visual_effect_t * p_effect, aout_instance_t *p_aout,
43 aout_buffer_t * p_buffer , picture_t * p_picture)
48 /*****************************************************************************
49 * spectrum_Run: spectrum analyser
50 *****************************************************************************/
51 int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
52 aout_buffer_t * p_buffer , picture_t * p_picture)
54 float p_output[FFT_BUFFER_SIZE]; /* Raw FFT Result */
55 int *height; /* Bar heights */
56 int *peaks; /* Peaks */
57 int i_nb_bands; /* number of bands */
58 int i_band_width; /* width of bands */
59 int i_separ; /* Should we let blanks ? */
60 int i_amp; /* Vertical amplification */
61 int i_peak; /* Should we draw peaks ? */
62 char *psz_parse = NULL; /* Args line */
64 /* Horizontal scale for 20-band equalizer */
65 const int xscale1[]={0,1,2,3,4,5,6,7,8,11,15,20,27,
66 36,47,62,82,107,141,184,255};
68 /* Horizontal scale for 80-band equalizer */
70 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
71 19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,
72 35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
73 52,53,54,55,56,57,58,59,61,63,67,72,77,82,87,93,99,105,
74 110,115,121,130,141,152,163,174,185,200,255};
76 const double y_scale = 3.60673760222; /* (log 256) */
78 fft_state *p_state; /* internal FFT data */
82 int16_t p_dest[FFT_BUFFER_SIZE]; /* Adapted FFT result */
83 int16_t p_buffer1[FFT_BUFFER_SIZE]; /* Buffer on which we perform
84 the FFT (first channel) */
86 float *p_buffl = /* Original buffer */
87 (float*)p_buffer->p_buffer;
89 int16_t *p_buffs; /* int16_t converted buffer */
90 int16_t *p_s16_buff = NULL; /* int16_t converted buffer */
92 p_s16_buff = (int16_t*)malloc(
93 p_buffer->i_nb_samples * p_effect->i_nb_chans * sizeof(int16_t));
97 msg_Err(p_aout,"out of memory");
101 p_buffs = p_s16_buff;
102 i_nb_bands = config_GetInt ( p_aout, "visual-nbbands" );
103 i_separ = config_GetInt( p_aout, "visual-separ" );
104 i_amp = config_GetInt ( p_aout, "visual-amp" );
105 i_peak = config_GetInt ( p_aout, "visual-peaks" );
107 if( i_nb_bands == 20)
117 if( !p_effect->p_data )
119 p_effect->p_data=(void *)malloc(i_nb_bands * sizeof(int) );
120 if( !p_effect->p_data)
122 msg_Err(p_aout,"out of memory");
125 peaks = (int *)p_effect->p_data;
126 for( i = 0 ; i < i_nb_bands ; i++)
134 peaks =(int *)p_effect->p_data;
138 height = (int *)malloc( i_nb_bands * sizeof(int) );
141 msg_Err(p_aout,"out of memory");
144 /* Convert the buffer to int16_t */
145 /* Pasted from float32tos16.c */
146 for (i = p_buffer->i_nb_samples * p_effect->i_nb_chans; i--; )
148 union { float f; int32_t i; } u;
149 u.f = *p_buffl + 384.0;
150 if(u.i > 0x43c07fff ) * p_buffs = 32767;
151 else if ( u.i < 0x43bf8000 ) *p_buffs = -32768;
152 else *p_buffs = u.i - 0x43c00000;
154 p_buffl++ ; p_buffs++ ;
156 p_state = visual_fft_init();
159 msg_Err(p_aout,"unable to initialize FFT transform");
162 p_buffs = p_s16_buff;
163 for ( i = 0 ; i < FFT_BUFFER_SIZE ; i++)
166 p_buffer1[i] = *p_buffs;
167 p_buffs = p_buffs + p_effect->i_nb_chans;
169 fft_perform( p_buffer1, p_output, p_state);
170 for(i= 0; i< FFT_BUFFER_SIZE ; i++ )
171 p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8;
173 for ( i = 0 ; i< i_nb_bands ;i++)
175 /* We search the maximum on one scale */
176 for( j = xscale[i] , y=0 ; j< xscale[ i + 1 ] ; j++ )
181 /* Calculate the height of the bar */
182 y >>=7;/* remove some noise */
185 height[i] = (int)log(y)* y_scale;
194 /* Draw the bar now */
195 i_band_width = floor( p_effect->i_width / i_nb_bands) ;
197 if( i_amp * height[i] > peaks[i])
199 peaks[i] = i_amp * height[i];
201 else if (peaks[i] > 0 )
203 peaks[i] -= PEAK_SPEED;
204 if( peaks[i] < i_amp * height[i] )
206 peaks[i] = i_amp * height[i];
214 if( peaks[i] > 0 && i_peak )
216 if( peaks[i] >= p_effect->i_height )
217 peaks[i] = p_effect->i_height - 2;
220 for( j = 0 ; j< i_band_width - i_separ; j++)
222 for( k = 0 ; k< 3 ; k ++)
225 *(p_picture->p[0].p_pixels +
226 (p_picture->p[0].i_lines - i_line -1 -k ) *
227 p_picture->p[0].i_pitch + (i_band_width*i +j) )
230 *(p_picture->p[1].p_pixels +
231 (p_picture->p[1].i_lines - i_line /2 -1 -k/2 ) *
232 p_picture->p[1].i_pitch +
233 ( ( i_band_width * i + j ) /2 ) )
236 if( 0x04 * (i_line + k ) - 0x0f > 0 )
238 if ( 0x04 * (i_line + k ) -0x0f < 0xff)
239 *(p_picture->p[2].p_pixels +
240 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
241 p_picture->p[2].i_pitch +
242 ( ( i_band_width * i + j ) /2 ) )
243 = ( 0x04 * ( i_line + k ) ) -0x0f ;
245 *(p_picture->p[2].p_pixels +
246 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
247 p_picture->p[2].i_pitch +
248 ( ( i_band_width * i + j ) /2 ) )
253 *(p_picture->p[2].p_pixels +
254 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
255 p_picture->p[2].i_pitch +
256 ( ( i_band_width * i + j ) /2 ) )
263 if(height[i] * i_amp > p_effect->i_height)
264 height[i] = floor(p_effect->i_height / i_amp );
266 for(i_line = 0 ; i_line < i_amp * height[i]; i_line ++ )
268 for( j = 0 ; j< i_band_width - i_separ ; j++)
270 *(p_picture->p[0].p_pixels +
271 (p_picture->p[0].i_lines - i_line -1) *
272 p_picture->p[0].i_pitch + (i_band_width*i +j) ) = 0xff;
274 *(p_picture->p[1].p_pixels +
275 (p_picture->p[1].i_lines - i_line /2 -1) *
276 p_picture->p[1].i_pitch +
277 ( ( i_band_width * i + j ) /2 ) ) = 0x00;
279 if( 0x04 * i_line - 0x0f > 0 )
281 if( 0x04 * i_line - 0x0f < 0xff )
282 *(p_picture->p[2].p_pixels +
283 (p_picture->p[2].i_lines - i_line /2 - 1) *
284 p_picture->p[2].i_pitch +
285 ( ( i_band_width * i + j ) /2 ) ) =
286 ( 0x04 * i_line) -0x0f ;
288 *(p_picture->p[2].p_pixels +
289 (p_picture->p[2].i_lines - i_line /2 - 1) *
290 p_picture->p[2].i_pitch +
291 ( ( i_band_width * i + j ) /2 ) ) =
296 *(p_picture->p[2].p_pixels +
297 (p_picture->p[2].i_lines - i_line /2 - 1) *
298 p_picture->p[2].i_pitch +
299 ( ( i_band_width * i + j ) /2 ) ) =
306 fft_close( p_state );
308 if( p_s16_buff != NULL )
314 if(height) free(height);
316 if(psz_parse) free(psz_parse);
322 /*****************************************************************************
323 * spectrometer_Run: derivative spectrum analysis
324 *****************************************************************************/
325 int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
326 aout_buffer_t * p_buffer , picture_t * p_picture)
328 #define Y(R,G,B) ((uint8_t)( (R * .299) + (G * .587) + (B * .114) ))
329 #define U(R,G,B) ((uint8_t)( (R * -.169) + (G * -.332) + (B * .500) + 128 ))
330 #define V(R,G,B) ((uint8_t)( (R * .500) + (G * -.419) + (B * -.0813) + 128 ))
331 float p_output[FFT_BUFFER_SIZE]; /* Raw FFT Result */
332 int *height; /* Bar heights */
333 int *peaks; /* Peaks */
334 int i_nb_bands; /* number of bands */
335 int i_band_width; /* width of bands */
336 int i_separ; /* Should we let blanks ? */
337 int i_amp; /* Vertical amplification */
338 int i_peak; /* Should we draw peaks ? */
340 int i_original; /* original spectrum graphic routine */
341 int i_rad; /* radius of circle of base of bands */
342 int i_sections; /* sections of spectranalysis */
343 int i_extra_width; /* extra width on peak */
344 int i_peak_height; /* height of peak */
345 int c; /* sentinel container of total spectral sections */
346 double band_sep_angle; /* angled separation between beginning of each band */
347 double section_sep_angle;/* " " ' " ' " " spectrum section */
348 int max_band_length; /* try not to go out of screen */
349 int i_show_base; /* Should we draw base of circle ? */
350 int i_show_bands; /* Should we draw bands ? */
351 //int i_invert_bands; /* do the bands point inward ? */
352 double a; /* for various misc angle situations in radians */
353 int x,y,xx,yy; /* various misc x/y */
354 char color1; /* V slide on a YUV color cube */
355 //char color2; /* U slide.. ? color2 fade color ? */
357 char *psz_parse = NULL; /* Args line */
359 /* Horizontal scale for 20-band equalizer */
360 const int xscale1[]={0,1,2,3,4,5,6,7,8,11,15,20,27,
361 36,47,62,82,107,141,184,255};
363 /* Horizontal scale for 80-band equalizer */
364 const int xscale2[] =
365 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
366 19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,
367 35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
368 52,53,54,55,56,57,58,59,61,63,67,72,77,82,87,93,99,105,
369 110,115,121,130,141,152,163,174,185,200,255};
371 const double y_scale = 3.60673760222; /* (log 256) */
373 fft_state *p_state; /* internal FFT data */
377 int16_t p_dest[FFT_BUFFER_SIZE]; /* Adapted FFT result */
378 int16_t p_buffer1[FFT_BUFFER_SIZE]; /* Buffer on which we perform
379 the FFT (first channel) */
380 float *p_buffl = /* Original buffer */
381 (float*)p_buffer->p_buffer;
383 int16_t *p_buffs; /* int16_t converted buffer */
384 int16_t *p_s16_buff = NULL; /* int16_t converted buffer */
388 p_s16_buff = (int16_t*)malloc(
389 p_buffer->i_nb_samples * p_effect->i_nb_chans * sizeof(int16_t));
393 msg_Err(p_aout,"out of memory");
397 p_buffs = p_s16_buff;
398 i_original = config_GetInt ( p_aout, "spect-show-original" );
399 i_nb_bands = config_GetInt ( p_aout, "spect-nbbands" );
400 i_separ = config_GetInt ( p_aout, "spect-separ" );
401 i_amp = config_GetInt ( p_aout, "spect-amp" );
402 i_peak = config_GetInt ( p_aout, "spect-show-peaks" );
403 i_show_base = config_GetInt ( p_aout, "spect-show-base" );
404 i_show_bands = config_GetInt ( p_aout, "spect-show-bands" );
405 i_rad = config_GetInt ( p_aout, "spect-radius" );
406 i_sections = config_GetInt ( p_aout, "spect-sections" );
407 i_extra_width = config_GetInt ( p_aout, "spect-peak-width" );
408 i_peak_height = config_GetInt ( p_aout, "spect-peak-height" );
409 color1 = config_GetInt ( p_aout, "spect-color" );
411 if( i_nb_bands == 20)
417 if( i_nb_bands > 80 )
422 if( !p_effect->p_data )
424 p_effect->p_data=(void *)malloc(i_nb_bands * sizeof(int) );
425 if( !p_effect->p_data)
427 msg_Err(p_aout,"out of memory");
430 peaks = (int *)p_effect->p_data;
431 for( i = 0 ; i < i_nb_bands ; i++)
438 peaks =(int *)p_effect->p_data;
441 height = (int *)malloc( i_nb_bands * sizeof(int) );
444 msg_Err(p_aout,"out of memory");
448 /* Convert the buffer to int16_t */
449 /* Pasted from float32tos16.c */
450 for (i = p_buffer->i_nb_samples * p_effect->i_nb_chans; i--; )
452 union { float f; int32_t i; } u;
453 u.f = *p_buffl + 384.0;
454 if(u.i > 0x43c07fff ) * p_buffs = 32767;
455 else if ( u.i < 0x43bf8000 ) *p_buffs = -32768;
456 else *p_buffs = u.i - 0x43c00000;
458 p_buffl++ ; p_buffs++ ;
460 p_state = visual_fft_init();
463 msg_Err(p_aout,"unable to initialize FFT transform");
466 p_buffs = p_s16_buff;
467 for ( i = 0 ; i < FFT_BUFFER_SIZE ; i++)
470 p_buffer1[i] = *p_buffs;
471 p_buffs = p_buffs + p_effect->i_nb_chans;
473 fft_perform( p_buffer1, p_output, p_state);
474 for(i= 0; i< FFT_BUFFER_SIZE ; i++ )
475 p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8;
477 i_nb_bands *= i_sections;
479 for ( i = 0 ; i< i_nb_bands/i_sections ;i++)
481 /* We search the maximum on one scale */
482 for( j = xscale[i] , y=0 ; j< xscale[ i + 1 ] ; j++ )
487 /* Calculate the height of the bar */
488 y >>=7;/* remove some noise */
491 height[i] = (int)log(y)* y_scale;
500 /* Draw the bar now */
501 i_band_width = floor( p_effect->i_width / (i_nb_bands/i_sections)) ;
503 if( i_amp * height[i] > peaks[i])
505 peaks[i] = i_amp * height[i];
507 else if (peaks[i] > 0 )
509 peaks[i] -= PEAK_SPEED;
510 if( peaks[i] < i_amp * height[i] )
512 peaks[i] = i_amp * height[i];
520 if( i_original != 0 )
522 if( peaks[i] > 0 && i_peak )
524 if( peaks[i] >= p_effect->i_height )
525 peaks[i] = p_effect->i_height - 2;
528 for( j = 0 ; j< i_band_width - i_separ; j++)
530 for( k = 0 ; k< 3 ; k ++)
533 *(p_picture->p[0].p_pixels +
534 (p_picture->p[0].i_lines - i_line -1 -k ) *
535 p_picture->p[0].i_pitch + (i_band_width*i +j) )
538 *(p_picture->p[1].p_pixels +
539 (p_picture->p[1].i_lines - i_line /2 -1 -k/2 ) *
540 p_picture->p[1].i_pitch +
541 ( ( i_band_width * i + j ) /2 ) )
544 if( 0x04 * (i_line + k ) - 0x0f > 0 )
546 if ( 0x04 * (i_line + k ) -0x0f < 0xff)
547 *(p_picture->p[2].p_pixels +
548 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
549 p_picture->p[2].i_pitch +
550 ( ( i_band_width * i + j ) /2 ) )
551 = ( 0x04 * ( i_line + k ) ) -0x0f ;
553 *(p_picture->p[2].p_pixels +
554 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
555 p_picture->p[2].i_pitch +
556 ( ( i_band_width * i + j ) /2 ) )
561 *(p_picture->p[2].p_pixels +
562 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
563 p_picture->p[2].i_pitch +
564 ( ( i_band_width * i + j ) /2 ) )
570 if(height[i] * i_amp > p_effect->i_height)
571 height[i] = floor(p_effect->i_height / i_amp );
573 for(i_line = 0 ; i_line < i_amp * height[i]; i_line ++ )
575 for( j = 0 ; j< i_band_width - i_separ ; j++)
577 *(p_picture->p[0].p_pixels +
578 (p_picture->p[0].i_lines - i_line -1) *
579 p_picture->p[0].i_pitch + (i_band_width*i +j) ) = 0xff;
581 *(p_picture->p[1].p_pixels +
582 (p_picture->p[1].i_lines - i_line /2 -1) *
583 p_picture->p[1].i_pitch +
584 ( ( i_band_width * i + j ) /2 ) ) = 0x00;
586 if( 0x04 * i_line - 0x0f > 0 )
588 if( 0x04 * i_line - 0x0f < 0xff )
589 *(p_picture->p[2].p_pixels +
590 (p_picture->p[2].i_lines - i_line /2 - 1) *
591 p_picture->p[2].i_pitch +
592 ( ( i_band_width * i + j ) /2 ) ) =
593 ( 0x04 * i_line) -0x0f ;
595 *(p_picture->p[2].p_pixels +
596 (p_picture->p[2].i_lines - i_line /2 - 1) *
597 p_picture->p[2].i_pitch +
598 ( ( i_band_width * i + j ) /2 ) ) =
603 *(p_picture->p[2].p_pixels +
604 (p_picture->p[2].i_lines - i_line /2 - 1) *
605 p_picture->p[2].i_pitch +
606 ( ( i_band_width * i + j ) /2 ) ) =
614 band_sep_angle = 360.0 / i_nb_bands;
615 section_sep_angle = 360.0 / i_sections;
616 if( i_peak_height < 1 )
618 max_band_length = p_picture->p[0].i_lines / 2 - ( i_rad + i_peak_height + 1 );
620 i_band_width = floor( 360 / i_nb_bands - i_separ );
621 if( i_band_width < 1 )
624 for( c = 0 ; c < i_sections ; c++ )
625 for( i = 0 ; i < (i_nb_bands / i_sections) ; i++ )
628 if( peaks[i] > 0 && i_peak )
630 if( peaks[i] >= p_effect->i_height )
631 peaks[i] = p_effect->i_height - 2;
634 /* circular line pattern(so color blend is more visible) */
635 for( j = 0 ; j < i_peak_height ; j++ )
637 x = p_picture->p[0].i_pitch / 2;
638 y = p_picture->p[0].i_lines / 2;
641 for( k = 0 ; k < (i_band_width + i_extra_width) ; k++ )
645 a = ( (i+1) * band_sep_angle + section_sep_angle * (c+1) + k )
647 x += (double)( cos(a) * (double)( i_line + j + i_rad ) );
648 y += (double)( -sin(a) * (double)( i_line + j + i_rad ) );
650 *(p_picture->p[0].p_pixels + x + y * p_picture->p[0].i_pitch
651 ) = 255;/* Y(R,G,B); */
656 *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
657 ) = 0;/* U(R,G,B); */
659 if( 0x04 * (i_line + k ) - 0x0f > 0 )
661 if ( 0x04 * (i_line + k ) -0x0f < 0xff)
662 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
663 ) = ( 0x04 * ( i_line + k ) ) -(color1-1);/* -V(R,G,B); */
665 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
666 ) = 255;/* V(R,G,B); */
670 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
671 ) = color1;/* V(R,G,B); */
677 if( (height[i] * i_amp) > p_effect->i_height )
678 height[i] = floor( p_effect->i_height / i_amp );
680 /* DO BASE OF BAND (mostly makes a circle) */
681 if( i_show_base != 0 )
683 x = p_picture->p[0].i_pitch / 2;
684 y = p_picture->p[0].i_lines / 2;
686 a = ( (i+1) * band_sep_angle + section_sep_angle * (c+1) )
688 x += (double)( cos(a) * (double)i_rad );/* newb-forceful casting */
689 y += (double)( -sin(a) * (double)i_rad );
691 *(p_picture->p[0].p_pixels + x + y * p_picture->p[0].i_pitch
692 ) = 255;/* Y(R,G,B); */
697 *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
698 ) = 0;/* U(R,G,B); */
700 if( 0x04 * i_line - 0x0f > 0 )
702 if( 0x04 * i_line -0x0f < 0xff)
703 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
704 ) = ( 0x04 * i_line) -(color1-1);/* -V(R,G,B); */
706 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
707 ) = 255;/* V(R,G,B); */
711 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
712 ) = color1;/* V(R,G,B); */
717 if( i_show_bands != 0 )
718 for( j = 0 ; j < i_band_width ; j++ )
720 x = p_picture->p[0].i_pitch / 2;
721 y = p_picture->p[0].i_lines / 2;
724 a = ( (i+1) * band_sep_angle + section_sep_angle * (c+1) + j )
727 for( k = (i_rad+1) ; k < max_band_length ; k++ )
729 if( (k-i_rad) > height[i] )
734 x += (double)( cos(a) * (double)k );/* newbed! */
735 y += (double)( -sin(a) * (double)k );
737 *(p_picture->p[0].p_pixels + x + y * p_picture->p[0].i_pitch
743 *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
746 if( 0x04 * i_line - 0x0f > 0 )
748 if ( 0x04 * i_line -0x0f < 0xff)
749 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
750 ) = ( 0x04 * i_line) -(color1-1);
752 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
757 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
764 fft_close( p_state );
766 if( p_s16_buff != NULL )
772 if(height) free(height);
774 if(psz_parse) free(psz_parse);
780 /*****************************************************************************
781 * scope_Run: scope effect
782 *****************************************************************************/
783 int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
784 aout_buffer_t * p_buffer , picture_t * p_picture)
788 uint8_t *ppp_area[2][3];
791 for( i_index = 0 ; i_index < 2 ; i_index++ )
794 for( j = 0 ; j < 3 ; j++ )
796 ppp_area[i_index][j] =
797 p_picture->p[j].p_pixels + i_index * p_picture->p[j].i_lines
798 / 2 * p_picture->p[j].i_pitch;
802 for( i_index = 0, p_sample = (float *)p_buffer->p_buffer;
803 i_index < p_effect->i_width;
809 i_value = (*p_sample++ +1) * 127;
811 + p_picture->p[0].i_pitch * i_index / p_effect->i_width
812 + p_picture->p[0].i_lines * i_value / 512
813 * p_picture->p[0].i_pitch) = 0xbf;
815 + p_picture->p[1].i_pitch * i_index / p_effect->i_width
816 + p_picture->p[1].i_lines * i_value / 512
817 * p_picture->p[1].i_pitch) = 0xff;
821 i_value = ( *p_sample++ +1 ) * 127;
823 + p_picture->p[0].i_pitch * i_index / p_effect->i_width
824 + p_picture->p[0].i_lines * i_value / 512
825 * p_picture->p[0].i_pitch) = 0x9f;
827 + p_picture->p[2].i_pitch * i_index / p_effect->i_width
828 + p_picture->p[2].i_lines * i_value / 512
829 * p_picture->p[2].i_pitch) = 0xdd;