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 *****************************************************************************/
38 /*****************************************************************************
40 *****************************************************************************/
41 int dummy_Run( visual_effect_t * p_effect, aout_instance_t *p_aout,
42 aout_buffer_t * p_buffer , picture_t * p_picture)
47 /*****************************************************************************
48 * spectrum_Run: spectrum analyser
49 *****************************************************************************/
50 int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
51 aout_buffer_t * p_buffer , picture_t * p_picture)
53 float p_output[FFT_BUFFER_SIZE]; /* Raw FFT Result */
54 int *height; /* Bar heights */
55 int *peaks; /* Peaks */
56 int i_nb_bands; /* number of bands */
57 int i_band_width; /* width of bands */
58 int i_separ; /* Should we let blanks ? */
59 int i_amp; /* Vertical amplification */
60 int i_peak; /* Should we draw peaks ? */
61 char *psz_parse = NULL; /* Args line */
63 /* Horizontal scale for 20-band equalizer */
64 const int xscale1[]={0,1,2,3,4,5,6,7,8,11,15,20,27,
65 36,47,62,82,107,141,184,255};
67 /* Horizontal scale for 80-band equalizer */
69 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
70 19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,
71 35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
72 52,53,54,55,56,57,58,59,61,63,67,72,77,82,87,93,99,105,
73 110,115,121,130,141,152,163,174,185,200,255};
75 const double y_scale = 3.60673760222; /* (log 256) */
77 fft_state *p_state; /* internal FFT data */
81 int16_t p_dest[FFT_BUFFER_SIZE]; /* Adapted FFT result */
82 int16_t p_buffer1[FFT_BUFFER_SIZE]; /* Buffer on which we perform
83 the FFT (first channel) */
85 float *p_buffl = /* Original buffer */
86 (float*)p_buffer->p_buffer;
88 int16_t *p_buffs; /* int16_t converted buffer */
89 int16_t *p_s16_buff = NULL; /* int16_t converted buffer */
91 p_s16_buff = (int16_t*)malloc(
92 p_buffer->i_nb_samples * p_effect->i_nb_chans * sizeof(int16_t));
96 msg_Err(p_aout,"out of memory");
100 p_buffs = p_s16_buff;
101 i_nb_bands = config_GetInt ( p_aout, "visual-nbbands" );
102 i_separ = config_GetInt( p_aout, "visual-separ" );
103 i_amp = config_GetInt ( p_aout, "visual-amp" );
104 i_peak = config_GetInt ( p_aout, "visual-peaks" );
106 if( i_nb_bands == 20)
116 if( !p_effect->p_data )
118 p_effect->p_data=(void *)malloc(i_nb_bands * sizeof(int) );
119 if( !p_effect->p_data)
121 msg_Err(p_aout,"out of memory");
124 peaks = (int *)p_effect->p_data;
125 for( i = 0 ; i < i_nb_bands ; i++)
133 peaks =(int *)p_effect->p_data;
137 height = (int *)malloc( i_nb_bands * sizeof(int) );
140 msg_Err(p_aout,"out of memory");
143 /* Convert the buffer to int16_t */
144 /* Pasted from float32tos16.c */
145 for (i = p_buffer->i_nb_samples * p_effect->i_nb_chans; i--; )
147 union { float f; int32_t i; } u;
148 u.f = *p_buffl + 384.0;
149 if(u.i > 0x43c07fff ) * p_buffs = 32767;
150 else if ( u.i < 0x43bf8000 ) *p_buffs = -32768;
151 else *p_buffs = u.i - 0x43c00000;
153 p_buffl++ ; p_buffs++ ;
155 p_state = visual_fft_init();
158 msg_Err(p_aout,"unable to initialize FFT transform");
161 p_buffs = p_s16_buff;
162 for ( i = 0 ; i < FFT_BUFFER_SIZE ; i++)
165 p_buffer1[i] = *p_buffs;
166 p_buffs = p_buffs + p_effect->i_nb_chans;
168 fft_perform( p_buffer1, p_output, p_state);
169 for(i= 0; i< FFT_BUFFER_SIZE ; i++ )
170 p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8;
172 for ( i = 0 ; i< i_nb_bands ;i++)
174 /* We search the maximum on one scale */
175 for( j = xscale[i] , y=0 ; j< xscale[ i + 1 ] ; j++ )
180 /* Calculate the height of the bar */
181 y >>=7;/* remove some noise */
184 height[i] = (int)log(y)* y_scale;
193 /* Draw the bar now */
194 i_band_width = floor( p_effect->i_width / i_nb_bands) ;
196 if( i_amp * height[i] > peaks[i])
198 peaks[i] = i_amp * height[i];
200 else if (peaks[i] > 0 )
202 peaks[i] -= PEAK_SPEED;
203 if( peaks[i] < i_amp * height[i] )
205 peaks[i] = i_amp * height[i];
213 if( peaks[i] > 0 && i_peak )
215 if( peaks[i] >= p_effect->i_height )
216 peaks[i] = p_effect->i_height - 2;
219 for( j = 0 ; j< i_band_width - i_separ; j++)
221 for( k = 0 ; k< 3 ; k ++)
224 *(p_picture->p[0].p_pixels +
225 (p_picture->p[0].i_lines - i_line -1 -k ) *
226 p_picture->p[0].i_pitch + (i_band_width*i +j) )
229 *(p_picture->p[1].p_pixels +
230 (p_picture->p[1].i_lines - i_line /2 -1 -k/2 ) *
231 p_picture->p[1].i_pitch +
232 ( ( i_band_width * i + j ) /2 ) )
235 if( 0x04 * (i_line + k ) - 0x0f > 0 )
237 if ( 0x04 * (i_line + k ) -0x0f < 0xff)
238 *(p_picture->p[2].p_pixels +
239 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
240 p_picture->p[2].i_pitch +
241 ( ( i_band_width * i + j ) /2 ) )
242 = ( 0x04 * ( i_line + k ) ) -0x0f ;
244 *(p_picture->p[2].p_pixels +
245 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
246 p_picture->p[2].i_pitch +
247 ( ( i_band_width * i + j ) /2 ) )
252 *(p_picture->p[2].p_pixels +
253 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
254 p_picture->p[2].i_pitch +
255 ( ( i_band_width * i + j ) /2 ) )
262 if(height[i] * i_amp > p_effect->i_height)
263 height[i] = floor(p_effect->i_height / i_amp );
265 for(i_line = 0 ; i_line < i_amp * height[i]; i_line ++ )
267 for( j = 0 ; j< i_band_width - i_separ ; j++)
269 *(p_picture->p[0].p_pixels +
270 (p_picture->p[0].i_lines - i_line -1) *
271 p_picture->p[0].i_pitch + (i_band_width*i +j) ) = 0xff;
273 *(p_picture->p[1].p_pixels +
274 (p_picture->p[1].i_lines - i_line /2 -1) *
275 p_picture->p[1].i_pitch +
276 ( ( i_band_width * i + j ) /2 ) ) = 0x00;
278 if( 0x04 * i_line - 0x0f > 0 )
280 if( 0x04 * i_line - 0x0f < 0xff )
281 *(p_picture->p[2].p_pixels +
282 (p_picture->p[2].i_lines - i_line /2 - 1) *
283 p_picture->p[2].i_pitch +
284 ( ( i_band_width * i + j ) /2 ) ) =
285 ( 0x04 * i_line) -0x0f ;
287 *(p_picture->p[2].p_pixels +
288 (p_picture->p[2].i_lines - i_line /2 - 1) *
289 p_picture->p[2].i_pitch +
290 ( ( i_band_width * i + j ) /2 ) ) =
295 *(p_picture->p[2].p_pixels +
296 (p_picture->p[2].i_lines - i_line /2 - 1) *
297 p_picture->p[2].i_pitch +
298 ( ( i_band_width * i + j ) /2 ) ) =
305 fft_close( p_state );
307 if( p_s16_buff != NULL )
313 if(height) free(height);
315 if(psz_parse) free(psz_parse);
321 /*****************************************************************************
322 * spectrometer_Run: derivative spectrum analysis
323 *****************************************************************************/
324 int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
325 aout_buffer_t * p_buffer , picture_t * p_picture)
327 #define Y(R,G,B) ((uint8_t)( (R * .299) + (G * .587) + (B * .114) ))
328 #define U(R,G,B) ((uint8_t)( (R * -.169) + (G * -.332) + (B * .500) + 128 ))
329 #define V(R,G,B) ((uint8_t)( (R * .500) + (G * -.419) + (B * -.0813) + 128 ))
330 float p_output[FFT_BUFFER_SIZE]; /* Raw FFT Result */
331 int *height; /* Bar heights */
332 int *peaks; /* Peaks */
333 int i_nb_bands; /* number of bands */
334 int i_band_width; /* width of bands */
335 int i_separ; /* Should we let blanks ? */
336 int i_amp; /* Vertical amplification */
337 int i_peak; /* Should we draw peaks ? */
339 int i_original; /* original spectrum graphic routine */
340 int i_rad; /* radius of circle of base of bands */
341 int i_sections; /* sections of spectranalysis */
342 int i_extra_width; /* extra width on peak */
343 int i_peak_height; /* height of peak */
344 int c; /* sentinel container of total spectral sections */
345 double band_sep_angle; /* angled separation between beginning of each band */
346 double section_sep_angle;/* " " ' " ' " " spectrum section */
347 int max_band_length; /* try not to go out of screen */
348 int i_show_base; /* Should we draw base of circle ? */
349 int i_show_bands; /* Should we draw bands ? */
350 //int i_invert_bands; /* do the bands point inward ? */
351 double a; /* for various misc angle situations in radians */
352 int x,y,xx,yy; /* various misc x/y */
353 char color1; /* V slide on a YUV color cube */
354 //char color2; /* U slide.. ? color2 fade color ? */
356 char *psz_parse = NULL; /* Args line */
358 /* Horizontal scale for 20-band equalizer */
359 const int xscale1[]={0,1,2,3,4,5,6,7,8,11,15,20,27,
360 36,47,62,82,107,141,184,255};
362 /* Horizontal scale for 80-band equalizer */
363 const int xscale2[] =
364 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
365 19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,
366 35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
367 52,53,54,55,56,57,58,59,61,63,67,72,77,82,87,93,99,105,
368 110,115,121,130,141,152,163,174,185,200,255};
370 const double y_scale = 3.60673760222; /* (log 256) */
372 fft_state *p_state; /* internal FFT data */
376 int16_t p_dest[FFT_BUFFER_SIZE]; /* Adapted FFT result */
377 int16_t p_buffer1[FFT_BUFFER_SIZE]; /* Buffer on which we perform
378 the FFT (first channel) */
379 float *p_buffl = /* Original buffer */
380 (float*)p_buffer->p_buffer;
382 int16_t *p_buffs; /* int16_t converted buffer */
383 int16_t *p_s16_buff = NULL; /* int16_t converted buffer */
387 p_s16_buff = (int16_t*)malloc(
388 p_buffer->i_nb_samples * p_effect->i_nb_chans * sizeof(int16_t));
392 msg_Err(p_aout,"out of memory");
396 p_buffs = p_s16_buff;
397 i_original = config_GetInt ( p_aout, "spect-show-original" );
398 i_nb_bands = config_GetInt ( p_aout, "spect-nbbands" );
399 i_separ = config_GetInt ( p_aout, "spect-separ" );
400 i_amp = config_GetInt ( p_aout, "spect-amp" );
401 i_peak = config_GetInt ( p_aout, "spect-show-peaks" );
402 i_show_base = config_GetInt ( p_aout, "spect-show-base" );
403 i_show_bands = config_GetInt ( p_aout, "spect-show-bands" );
404 i_rad = config_GetInt ( p_aout, "spect-radius" );
405 i_sections = config_GetInt ( p_aout, "spect-sections" );
406 i_extra_width = config_GetInt ( p_aout, "spect-peak-width" );
407 i_peak_height = config_GetInt ( p_aout, "spect-peak-height" );
408 color1 = config_GetInt ( p_aout, "spect-color" );
410 if( i_nb_bands == 20)
416 if( i_nb_bands > 80 )
421 if( !p_effect->p_data )
423 p_effect->p_data=(void *)malloc(i_nb_bands * sizeof(int) );
424 if( !p_effect->p_data)
426 msg_Err(p_aout,"out of memory");
429 peaks = (int *)p_effect->p_data;
430 for( i = 0 ; i < i_nb_bands ; i++)
437 peaks =(int *)p_effect->p_data;
440 height = (int *)malloc( i_nb_bands * sizeof(int) );
443 msg_Err(p_aout,"out of memory");
447 /* Convert the buffer to int16_t */
448 /* Pasted from float32tos16.c */
449 for (i = p_buffer->i_nb_samples * p_effect->i_nb_chans; i--; )
451 union { float f; int32_t i; } u;
452 u.f = *p_buffl + 384.0;
453 if(u.i > 0x43c07fff ) * p_buffs = 32767;
454 else if ( u.i < 0x43bf8000 ) *p_buffs = -32768;
455 else *p_buffs = u.i - 0x43c00000;
457 p_buffl++ ; p_buffs++ ;
459 p_state = visual_fft_init();
462 msg_Err(p_aout,"unable to initialize FFT transform");
465 p_buffs = p_s16_buff;
466 for ( i = 0 ; i < FFT_BUFFER_SIZE ; i++)
469 p_buffer1[i] = *p_buffs;
470 p_buffs = p_buffs + p_effect->i_nb_chans;
472 fft_perform( p_buffer1, p_output, p_state);
473 for(i= 0; i< FFT_BUFFER_SIZE ; i++ )
474 p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8;
476 i_nb_bands *= i_sections;
478 for ( i = 0 ; i< i_nb_bands/i_sections ;i++)
480 /* We search the maximum on one scale */
481 for( j = xscale[i] , y=0 ; j< xscale[ i + 1 ] ; j++ )
486 /* Calculate the height of the bar */
487 y >>=7;/* remove some noise */
490 height[i] = (int)log(y)* y_scale;
499 /* Draw the bar now */
500 i_band_width = floor( p_effect->i_width / (i_nb_bands/i_sections)) ;
502 if( i_amp * height[i] > peaks[i])
504 peaks[i] = i_amp * height[i];
506 else if (peaks[i] > 0 )
508 peaks[i] -= PEAK_SPEED;
509 if( peaks[i] < i_amp * height[i] )
511 peaks[i] = i_amp * height[i];
519 if( i_original != 0 )
521 if( peaks[i] > 0 && i_peak )
523 if( peaks[i] >= p_effect->i_height )
524 peaks[i] = p_effect->i_height - 2;
527 for( j = 0 ; j< i_band_width - i_separ; j++)
529 for( k = 0 ; k< 3 ; k ++)
532 *(p_picture->p[0].p_pixels +
533 (p_picture->p[0].i_lines - i_line -1 -k ) *
534 p_picture->p[0].i_pitch + (i_band_width*i +j) )
537 *(p_picture->p[1].p_pixels +
538 (p_picture->p[1].i_lines - i_line /2 -1 -k/2 ) *
539 p_picture->p[1].i_pitch +
540 ( ( i_band_width * i + j ) /2 ) )
543 if( 0x04 * (i_line + k ) - 0x0f > 0 )
545 if ( 0x04 * (i_line + k ) -0x0f < 0xff)
546 *(p_picture->p[2].p_pixels +
547 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
548 p_picture->p[2].i_pitch +
549 ( ( i_band_width * i + j ) /2 ) )
550 = ( 0x04 * ( i_line + k ) ) -0x0f ;
552 *(p_picture->p[2].p_pixels +
553 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
554 p_picture->p[2].i_pitch +
555 ( ( i_band_width * i + j ) /2 ) )
560 *(p_picture->p[2].p_pixels +
561 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
562 p_picture->p[2].i_pitch +
563 ( ( i_band_width * i + j ) /2 ) )
569 if(height[i] * i_amp > p_effect->i_height)
570 height[i] = floor(p_effect->i_height / i_amp );
572 for(i_line = 0 ; i_line < i_amp * height[i]; i_line ++ )
574 for( j = 0 ; j< i_band_width - i_separ ; j++)
576 *(p_picture->p[0].p_pixels +
577 (p_picture->p[0].i_lines - i_line -1) *
578 p_picture->p[0].i_pitch + (i_band_width*i +j) ) = 0xff;
580 *(p_picture->p[1].p_pixels +
581 (p_picture->p[1].i_lines - i_line /2 -1) *
582 p_picture->p[1].i_pitch +
583 ( ( i_band_width * i + j ) /2 ) ) = 0x00;
585 if( 0x04 * i_line - 0x0f > 0 )
587 if( 0x04 * i_line - 0x0f < 0xff )
588 *(p_picture->p[2].p_pixels +
589 (p_picture->p[2].i_lines - i_line /2 - 1) *
590 p_picture->p[2].i_pitch +
591 ( ( i_band_width * i + j ) /2 ) ) =
592 ( 0x04 * i_line) -0x0f ;
594 *(p_picture->p[2].p_pixels +
595 (p_picture->p[2].i_lines - i_line /2 - 1) *
596 p_picture->p[2].i_pitch +
597 ( ( i_band_width * i + j ) /2 ) ) =
602 *(p_picture->p[2].p_pixels +
603 (p_picture->p[2].i_lines - i_line /2 - 1) *
604 p_picture->p[2].i_pitch +
605 ( ( i_band_width * i + j ) /2 ) ) =
613 band_sep_angle = 360.0 / i_nb_bands;
614 section_sep_angle = 360.0 / i_sections;
615 if( i_peak_height < 1 )
617 max_band_length = p_picture->p[0].i_lines / 2 - ( i_rad + i_peak_height + 1 );
619 i_band_width = floor( 360 / i_nb_bands - i_separ );
620 if( i_band_width < 1 )
623 for( c = 0 ; c < i_sections ; c++ )
624 for( i = 0 ; i < (i_nb_bands / i_sections) ; i++ )
627 if( peaks[i] > 0 && i_peak )
629 if( peaks[i] >= p_effect->i_height )
630 peaks[i] = p_effect->i_height - 2;
633 /* circular line pattern(so color blend is more visible) */
634 for( j = 0 ; j < i_peak_height ; j++ )
636 x = p_picture->p[0].i_pitch / 2;
637 y = p_picture->p[0].i_lines / 2;
640 for( k = 0 ; k < (i_band_width + i_extra_width) ; k++ )
644 a = ( (i+1) * band_sep_angle + section_sep_angle * (c+1) + k )
646 x += (double)( cos(a) * (double)( i_line + j + i_rad ) );
647 y += (double)( -sin(a) * (double)( i_line + j + i_rad ) );
649 *(p_picture->p[0].p_pixels + x + y * p_picture->p[0].i_pitch
650 ) = 255;/* Y(R,G,B); */
655 *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
656 ) = 0;/* U(R,G,B); */
658 if( 0x04 * (i_line + k ) - 0x0f > 0 )
660 if ( 0x04 * (i_line + k ) -0x0f < 0xff)
661 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
662 ) = ( 0x04 * ( i_line + k ) ) -(color1-1);/* -V(R,G,B); */
664 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
665 ) = 255;/* V(R,G,B); */
669 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
670 ) = color1;/* V(R,G,B); */
676 if( (height[i] * i_amp) > p_effect->i_height )
677 height[i] = floor( p_effect->i_height / i_amp );
679 /* DO BASE OF BAND (mostly makes a circle) */
680 if( i_show_base != 0 )
682 x = p_picture->p[0].i_pitch / 2;
683 y = p_picture->p[0].i_lines / 2;
685 a = ( (i+1) * band_sep_angle + section_sep_angle * (c+1) )
687 x += (double)( cos(a) * (double)i_rad );/* newb-forceful casting */
688 y += (double)( -sin(a) * (double)i_rad );
690 *(p_picture->p[0].p_pixels + x + y * p_picture->p[0].i_pitch
691 ) = 255;/* Y(R,G,B); */
696 *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
697 ) = 0;/* U(R,G,B); */
699 if( 0x04 * i_line - 0x0f > 0 )
701 if( 0x04 * i_line -0x0f < 0xff)
702 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
703 ) = ( 0x04 * i_line) -(color1-1);/* -V(R,G,B); */
705 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
706 ) = 255;/* V(R,G,B); */
710 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
711 ) = color1;/* V(R,G,B); */
716 if( i_show_bands != 0 )
717 for( j = 0 ; j < i_band_width ; j++ )
719 x = p_picture->p[0].i_pitch / 2;
720 y = p_picture->p[0].i_lines / 2;
723 a = ( (i+1) * band_sep_angle + section_sep_angle * (c+1) + j )
726 for( k = (i_rad+1) ; k < max_band_length ; k++ )
728 if( (k-i_rad) > height[i] )
733 x += (double)( cos(a) * (double)k );/* newbed! */
734 y += (double)( -sin(a) * (double)k );
736 *(p_picture->p[0].p_pixels + x + y * p_picture->p[0].i_pitch
742 *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
745 if( 0x04 * i_line - 0x0f > 0 )
747 if ( 0x04 * i_line -0x0f < 0xff)
748 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
749 ) = ( 0x04 * i_line) -(color1-1);
751 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
756 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
763 fft_close( p_state );
765 if( p_s16_buff != NULL )
771 if(height) free(height);
773 if(psz_parse) free(psz_parse);
779 /*****************************************************************************
780 * scope_Run: scope effect
781 *****************************************************************************/
782 int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
783 aout_buffer_t * p_buffer , picture_t * p_picture)
787 uint8_t *ppp_area[2][3];
790 for( i_index = 0 ; i_index < 2 ; i_index++ )
793 for( j = 0 ; j < 3 ; j++ )
795 ppp_area[i_index][j] =
796 p_picture->p[j].p_pixels + i_index * p_picture->p[j].i_lines
797 / 2 * p_picture->p[j].i_pitch;
801 for( i_index = 0, p_sample = (float *)p_buffer->p_buffer;
802 i_index < p_effect->i_width;
808 i_value = (*p_sample++ +1) * 127;
810 + p_picture->p[0].i_pitch * i_index / p_effect->i_width
811 + p_picture->p[0].i_lines * i_value / 512
812 * p_picture->p[0].i_pitch) = 0xbf;
814 + p_picture->p[1].i_pitch * i_index / p_effect->i_width
815 + p_picture->p[1].i_lines * i_value / 512
816 * p_picture->p[1].i_pitch) = 0xff;
820 i_value = ( *p_sample++ +1 ) * 127;
822 + p_picture->p[0].i_pitch * i_index / p_effect->i_width
823 + p_picture->p[0].i_lines * i_value / 512
824 * p_picture->p[0].i_pitch) = 0x9f;
826 + p_picture->p[2].i_pitch * i_index / p_effect->i_width
827 + p_picture->p[2].i_lines * i_value / 512
828 * p_picture->p[2].i_pitch) = 0xdd;