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 *****************************************************************************/
42 /*****************************************************************************
44 *****************************************************************************/
45 int dummy_Run( visual_effect_t * p_effect, aout_instance_t *p_aout,
46 aout_buffer_t * p_buffer , picture_t * p_picture)
48 VLC_UNUSED(p_effect); VLC_UNUSED(p_aout); VLC_UNUSED(p_buffer);
49 VLC_UNUSED(p_picture);
53 /*****************************************************************************
54 * spectrum_Run: spectrum analyser
55 *****************************************************************************/
56 int spectrum_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
57 aout_buffer_t * p_buffer , picture_t * p_picture)
59 float p_output[FFT_BUFFER_SIZE]; /* Raw FFT Result */
60 int *height; /* Bar heights */
61 int *peaks; /* Peaks */
62 int i_nb_bands; /* number of bands */
63 int i_band_width; /* width of bands */
64 int i_separ; /* Should we let blanks ? */
65 int i_amp; /* Vertical amplification */
66 int i_peak; /* Should we draw peaks ? */
67 char *psz_parse = NULL; /* Args line */
69 /* Horizontal scale for 20-band equalizer */
70 const int xscale1[]={0,1,2,3,4,5,6,7,8,11,15,20,27,
71 36,47,62,82,107,141,184,255};
73 /* Horizontal scale for 80-band equalizer */
75 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
76 19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,
77 35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
78 52,53,54,55,56,57,58,59,61,63,67,72,77,82,87,93,99,105,
79 110,115,121,130,141,152,163,174,185,200,255};
81 const double y_scale = 3.60673760222; /* (log 256) */
83 fft_state *p_state; /* internal FFT data */
87 int16_t p_dest[FFT_BUFFER_SIZE]; /* Adapted FFT result */
88 int16_t p_buffer1[FFT_BUFFER_SIZE]; /* Buffer on which we perform
89 the FFT (first channel) */
91 float *p_buffl = /* Original buffer */
92 (float*)p_buffer->p_buffer;
94 int16_t *p_buffs; /* int16_t converted buffer */
95 int16_t *p_s16_buff = NULL; /* int16_t converted buffer */
97 p_s16_buff = (int16_t*)malloc(
98 p_buffer->i_nb_samples * p_effect->i_nb_chans * sizeof(int16_t));
102 msg_Err(p_aout,"out of memory");
106 p_buffs = p_s16_buff;
107 i_nb_bands = config_GetInt ( p_aout, "visual-nbbands" );
108 i_separ = config_GetInt( p_aout, "visual-separ" );
109 i_amp = config_GetInt ( p_aout, "visual-amp" );
110 i_peak = config_GetInt ( p_aout, "visual-peaks" );
112 if( i_nb_bands == 20)
122 if( !p_effect->p_data )
124 p_effect->p_data=(void *)malloc(i_nb_bands * sizeof(int) );
125 if( !p_effect->p_data)
127 msg_Err(p_aout,"out of memory");
130 peaks = (int *)p_effect->p_data;
131 for( i = 0 ; i < i_nb_bands ; i++)
139 peaks =(int *)p_effect->p_data;
143 height = (int *)malloc( i_nb_bands * sizeof(int) );
146 msg_Err(p_aout,"out of memory");
149 /* Convert the buffer to int16_t */
150 /* Pasted from float32tos16.c */
151 for (i = p_buffer->i_nb_samples * p_effect->i_nb_chans; i--; )
153 union { float f; int32_t i; } u;
154 u.f = *p_buffl + 384.0;
155 if(u.i > 0x43c07fff ) * p_buffs = 32767;
156 else if ( u.i < 0x43bf8000 ) *p_buffs = -32768;
157 else *p_buffs = u.i - 0x43c00000;
159 p_buffl++ ; p_buffs++ ;
161 p_state = visual_fft_init();
164 msg_Err(p_aout,"unable to initialize FFT transform");
167 p_buffs = p_s16_buff;
168 for ( i = 0 ; i < FFT_BUFFER_SIZE ; i++)
171 p_buffer1[i] = *p_buffs;
172 p_buffs = p_buffs + p_effect->i_nb_chans;
174 fft_perform( p_buffer1, p_output, p_state);
175 for(i= 0; i< FFT_BUFFER_SIZE ; i++ )
176 p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8;
178 for ( i = 0 ; i< i_nb_bands ;i++)
180 /* We search the maximum on one scale */
181 for( j = xscale[i] , y=0 ; j< xscale[ i + 1 ] ; j++ )
186 /* Calculate the height of the bar */
187 y >>=7;/* remove some noise */
190 height[i] = (int)log(y)* y_scale;
199 /* Draw the bar now */
200 i_band_width = floor( p_effect->i_width / i_nb_bands) ;
202 if( i_amp * height[i] > peaks[i])
204 peaks[i] = i_amp * height[i];
206 else if (peaks[i] > 0 )
208 peaks[i] -= PEAK_SPEED;
209 if( peaks[i] < i_amp * height[i] )
211 peaks[i] = i_amp * height[i];
219 if( peaks[i] > 0 && i_peak )
221 if( peaks[i] >= p_effect->i_height )
222 peaks[i] = p_effect->i_height - 2;
225 for( j = 0 ; j< i_band_width - i_separ; j++)
227 for( k = 0 ; k< 3 ; k ++)
230 *(p_picture->p[0].p_pixels +
231 (p_picture->p[0].i_lines - i_line -1 -k ) *
232 p_picture->p[0].i_pitch + (i_band_width*i +j) )
235 *(p_picture->p[1].p_pixels +
236 (p_picture->p[1].i_lines - i_line /2 -1 -k/2 ) *
237 p_picture->p[1].i_pitch +
238 ( ( i_band_width * i + j ) /2 ) )
241 if( 0x04 * (i_line + k ) - 0x0f > 0 )
243 if ( 0x04 * (i_line + k ) -0x0f < 0xff)
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 ) )
248 = ( 0x04 * ( i_line + k ) ) -0x0f ;
250 *(p_picture->p[2].p_pixels +
251 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
252 p_picture->p[2].i_pitch +
253 ( ( i_band_width * i + j ) /2 ) )
258 *(p_picture->p[2].p_pixels +
259 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
260 p_picture->p[2].i_pitch +
261 ( ( i_band_width * i + j ) /2 ) )
268 if(height[i] * i_amp > p_effect->i_height)
269 height[i] = floor(p_effect->i_height / i_amp );
271 for(i_line = 0 ; i_line < i_amp * height[i]; i_line ++ )
273 for( j = 0 ; j< i_band_width - i_separ ; j++)
275 *(p_picture->p[0].p_pixels +
276 (p_picture->p[0].i_lines - i_line -1) *
277 p_picture->p[0].i_pitch + (i_band_width*i +j) ) = 0xff;
279 *(p_picture->p[1].p_pixels +
280 (p_picture->p[1].i_lines - i_line /2 -1) *
281 p_picture->p[1].i_pitch +
282 ( ( i_band_width * i + j ) /2 ) ) = 0x00;
284 if( 0x04 * i_line - 0x0f > 0 )
286 if( 0x04 * i_line - 0x0f < 0xff )
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 ) ) =
291 ( 0x04 * i_line) -0x0f ;
293 *(p_picture->p[2].p_pixels +
294 (p_picture->p[2].i_lines - i_line /2 - 1) *
295 p_picture->p[2].i_pitch +
296 ( ( i_band_width * i + j ) /2 ) ) =
301 *(p_picture->p[2].p_pixels +
302 (p_picture->p[2].i_lines - i_line /2 - 1) *
303 p_picture->p[2].i_pitch +
304 ( ( i_band_width * i + j ) /2 ) ) =
311 fft_close( p_state );
313 if( p_s16_buff != NULL )
319 if(height) free(height);
321 if(psz_parse) free(psz_parse);
327 /*****************************************************************************
328 * spectrometer_Run: derivative spectrum analysis
329 *****************************************************************************/
330 int spectrometer_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
331 aout_buffer_t * p_buffer , picture_t * p_picture)
333 #define Y(R,G,B) ((uint8_t)( (R * .299) + (G * .587) + (B * .114) ))
334 #define U(R,G,B) ((uint8_t)( (R * -.169) + (G * -.332) + (B * .500) + 128 ))
335 #define V(R,G,B) ((uint8_t)( (R * .500) + (G * -.419) + (B * -.0813) + 128 ))
336 float p_output[FFT_BUFFER_SIZE]; /* Raw FFT Result */
337 int *height; /* Bar heights */
338 int *peaks; /* Peaks */
339 int i_nb_bands; /* number of bands */
340 int i_band_width; /* width of bands */
341 int i_separ; /* Should we let blanks ? */
342 int i_amp; /* Vertical amplification */
343 int i_peak; /* Should we draw peaks ? */
345 int i_original; /* original spectrum graphic routine */
346 int i_rad; /* radius of circle of base of bands */
347 int i_sections; /* sections of spectranalysis */
348 int i_extra_width; /* extra width on peak */
349 int i_peak_height; /* height of peak */
350 int c; /* sentinel container of total spectral sections */
351 double band_sep_angle; /* angled separation between beginning of each band */
352 double section_sep_angle;/* " " ' " ' " " spectrum section */
353 int max_band_length; /* try not to go out of screen */
354 int i_show_base; /* Should we draw base of circle ? */
355 int i_show_bands; /* Should we draw bands ? */
356 //int i_invert_bands; /* do the bands point inward ? */
357 double a; /* for various misc angle situations in radians */
358 int x,y,xx,yy; /* various misc x/y */
359 char color1; /* V slide on a YUV color cube */
360 //char color2; /* U slide.. ? color2 fade color ? */
362 char *psz_parse = NULL; /* Args line */
364 /* Horizontal scale for 20-band equalizer */
365 const int xscale1[]={0,1,2,3,4,5,6,7,8,11,15,20,27,
366 36,47,62,82,107,141,184,255};
368 /* Horizontal scale for 80-band equalizer */
369 const int xscale2[] =
370 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
371 19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,
372 35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
373 52,53,54,55,56,57,58,59,61,63,67,72,77,82,87,93,99,105,
374 110,115,121,130,141,152,163,174,185,200,255};
376 const double y_scale = 3.60673760222; /* (log 256) */
378 fft_state *p_state; /* internal FFT data */
382 int16_t p_dest[FFT_BUFFER_SIZE]; /* Adapted FFT result */
383 int16_t p_buffer1[FFT_BUFFER_SIZE]; /* Buffer on which we perform
384 the FFT (first channel) */
385 float *p_buffl = /* Original buffer */
386 (float*)p_buffer->p_buffer;
388 int16_t *p_buffs; /* int16_t converted buffer */
389 int16_t *p_s16_buff = NULL; /* int16_t converted buffer */
393 p_s16_buff = (int16_t*)malloc(
394 p_buffer->i_nb_samples * p_effect->i_nb_chans * sizeof(int16_t));
398 msg_Err(p_aout,"out of memory");
402 p_buffs = p_s16_buff;
403 i_original = config_GetInt ( p_aout, "spect-show-original" );
404 i_nb_bands = config_GetInt ( p_aout, "spect-nbbands" );
405 i_separ = config_GetInt ( p_aout, "spect-separ" );
406 i_amp = config_GetInt ( p_aout, "spect-amp" );
407 i_peak = config_GetInt ( p_aout, "spect-show-peaks" );
408 i_show_base = config_GetInt ( p_aout, "spect-show-base" );
409 i_show_bands = config_GetInt ( p_aout, "spect-show-bands" );
410 i_rad = config_GetInt ( p_aout, "spect-radius" );
411 i_sections = config_GetInt ( p_aout, "spect-sections" );
412 i_extra_width = config_GetInt ( p_aout, "spect-peak-width" );
413 i_peak_height = config_GetInt ( p_aout, "spect-peak-height" );
414 color1 = config_GetInt ( p_aout, "spect-color" );
416 if( i_nb_bands == 20)
422 if( i_nb_bands > 80 )
427 if( !p_effect->p_data )
429 p_effect->p_data=(void *)malloc(i_nb_bands * sizeof(int) );
430 if( !p_effect->p_data)
432 msg_Err(p_aout,"out of memory");
435 peaks = (int *)p_effect->p_data;
436 for( i = 0 ; i < i_nb_bands ; i++)
443 peaks =(int *)p_effect->p_data;
446 height = (int *)malloc( i_nb_bands * sizeof(int) );
449 msg_Err(p_aout,"out of memory");
453 /* Convert the buffer to int16_t */
454 /* Pasted from float32tos16.c */
455 for (i = p_buffer->i_nb_samples * p_effect->i_nb_chans; i--; )
457 union { float f; int32_t i; } u;
458 u.f = *p_buffl + 384.0;
459 if(u.i > 0x43c07fff ) * p_buffs = 32767;
460 else if ( u.i < 0x43bf8000 ) *p_buffs = -32768;
461 else *p_buffs = u.i - 0x43c00000;
463 p_buffl++ ; p_buffs++ ;
465 p_state = visual_fft_init();
468 msg_Err(p_aout,"unable to initialize FFT transform");
471 p_buffs = p_s16_buff;
472 for ( i = 0 ; i < FFT_BUFFER_SIZE ; i++)
475 p_buffer1[i] = *p_buffs;
476 p_buffs = p_buffs + p_effect->i_nb_chans;
478 fft_perform( p_buffer1, p_output, p_state);
479 for(i= 0; i< FFT_BUFFER_SIZE ; i++ )
480 p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8;
482 i_nb_bands *= i_sections;
484 for ( i = 0 ; i< i_nb_bands/i_sections ;i++)
486 /* We search the maximum on one scale */
487 for( j = xscale[i] , y=0 ; j< xscale[ i + 1 ] ; j++ )
492 /* Calculate the height of the bar */
493 y >>=7;/* remove some noise */
496 height[i] = (int)log(y)* y_scale;
505 /* Draw the bar now */
506 i_band_width = floor( p_effect->i_width / (i_nb_bands/i_sections)) ;
508 if( i_amp * height[i] > peaks[i])
510 peaks[i] = i_amp * height[i];
512 else if (peaks[i] > 0 )
514 peaks[i] -= PEAK_SPEED;
515 if( peaks[i] < i_amp * height[i] )
517 peaks[i] = i_amp * height[i];
525 if( i_original != 0 )
527 if( peaks[i] > 0 && i_peak )
529 if( peaks[i] >= p_effect->i_height )
530 peaks[i] = p_effect->i_height - 2;
533 for( j = 0 ; j< i_band_width - i_separ; j++)
535 for( k = 0 ; k< 3 ; k ++)
538 *(p_picture->p[0].p_pixels +
539 (p_picture->p[0].i_lines - i_line -1 -k ) *
540 p_picture->p[0].i_pitch + (i_band_width*i +j) )
543 *(p_picture->p[1].p_pixels +
544 (p_picture->p[1].i_lines - i_line /2 -1 -k/2 ) *
545 p_picture->p[1].i_pitch +
546 ( ( i_band_width * i + j ) /2 ) )
549 if( 0x04 * (i_line + k ) - 0x0f > 0 )
551 if ( 0x04 * (i_line + k ) -0x0f < 0xff)
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 ) )
556 = ( 0x04 * ( i_line + k ) ) -0x0f ;
558 *(p_picture->p[2].p_pixels +
559 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
560 p_picture->p[2].i_pitch +
561 ( ( i_band_width * i + j ) /2 ) )
566 *(p_picture->p[2].p_pixels +
567 (p_picture->p[2].i_lines - i_line /2 - 1 -k/2 ) *
568 p_picture->p[2].i_pitch +
569 ( ( i_band_width * i + j ) /2 ) )
575 if(height[i] * i_amp > p_effect->i_height)
576 height[i] = floor(p_effect->i_height / i_amp );
578 for(i_line = 0 ; i_line < i_amp * height[i]; i_line ++ )
580 for( j = 0 ; j< i_band_width - i_separ ; j++)
582 *(p_picture->p[0].p_pixels +
583 (p_picture->p[0].i_lines - i_line -1) *
584 p_picture->p[0].i_pitch + (i_band_width*i +j) ) = 0xff;
586 *(p_picture->p[1].p_pixels +
587 (p_picture->p[1].i_lines - i_line /2 -1) *
588 p_picture->p[1].i_pitch +
589 ( ( i_band_width * i + j ) /2 ) ) = 0x00;
591 if( 0x04 * i_line - 0x0f > 0 )
593 if( 0x04 * i_line - 0x0f < 0xff )
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 ) ) =
598 ( 0x04 * i_line) -0x0f ;
600 *(p_picture->p[2].p_pixels +
601 (p_picture->p[2].i_lines - i_line /2 - 1) *
602 p_picture->p[2].i_pitch +
603 ( ( i_band_width * i + j ) /2 ) ) =
608 *(p_picture->p[2].p_pixels +
609 (p_picture->p[2].i_lines - i_line /2 - 1) *
610 p_picture->p[2].i_pitch +
611 ( ( i_band_width * i + j ) /2 ) ) =
619 band_sep_angle = 360.0 / i_nb_bands;
620 section_sep_angle = 360.0 / i_sections;
621 if( i_peak_height < 1 )
623 max_band_length = p_picture->p[0].i_lines / 2 - ( i_rad + i_peak_height + 1 );
625 i_band_width = floor( 360 / i_nb_bands - i_separ );
626 if( i_band_width < 1 )
629 for( c = 0 ; c < i_sections ; c++ )
630 for( i = 0 ; i < (i_nb_bands / i_sections) ; i++ )
633 if( peaks[i] > 0 && i_peak )
635 if( peaks[i] >= p_effect->i_height )
636 peaks[i] = p_effect->i_height - 2;
639 /* circular line pattern(so color blend is more visible) */
640 for( j = 0 ; j < i_peak_height ; j++ )
642 x = p_picture->p[0].i_pitch / 2;
643 y = p_picture->p[0].i_lines / 2;
646 for( k = 0 ; k < (i_band_width + i_extra_width) ; k++ )
650 a = ( (i+1) * band_sep_angle + section_sep_angle * (c+1) + k )
652 x += (double)( cos(a) * (double)( i_line + j + i_rad ) );
653 y += (double)( -sin(a) * (double)( i_line + j + i_rad ) );
655 *(p_picture->p[0].p_pixels + x + y * p_picture->p[0].i_pitch
656 ) = 255;/* Y(R,G,B); */
661 *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
662 ) = 0;/* U(R,G,B); */
664 if( 0x04 * (i_line + k ) - 0x0f > 0 )
666 if ( 0x04 * (i_line + k ) -0x0f < 0xff)
667 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
668 ) = ( 0x04 * ( i_line + k ) ) -(color1-1);/* -V(R,G,B); */
670 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
671 ) = 255;/* V(R,G,B); */
675 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
676 ) = color1;/* V(R,G,B); */
682 if( (height[i] * i_amp) > p_effect->i_height )
683 height[i] = floor( p_effect->i_height / i_amp );
685 /* DO BASE OF BAND (mostly makes a circle) */
686 if( i_show_base != 0 )
688 x = p_picture->p[0].i_pitch / 2;
689 y = p_picture->p[0].i_lines / 2;
691 a = ( (i+1) * band_sep_angle + section_sep_angle * (c+1) )
693 x += (double)( cos(a) * (double)i_rad );/* newb-forceful casting */
694 y += (double)( -sin(a) * (double)i_rad );
696 *(p_picture->p[0].p_pixels + x + y * p_picture->p[0].i_pitch
697 ) = 255;/* Y(R,G,B); */
702 *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
703 ) = 0;/* U(R,G,B); */
705 if( 0x04 * i_line - 0x0f > 0 )
707 if( 0x04 * i_line -0x0f < 0xff)
708 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
709 ) = ( 0x04 * i_line) -(color1-1);/* -V(R,G,B); */
711 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
712 ) = 255;/* V(R,G,B); */
716 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
717 ) = color1;/* V(R,G,B); */
722 if( i_show_bands != 0 )
723 for( j = 0 ; j < i_band_width ; j++ )
725 x = p_picture->p[0].i_pitch / 2;
726 y = p_picture->p[0].i_lines / 2;
729 a = ( (i+1) * band_sep_angle + section_sep_angle * (c+1) + j )
732 for( k = (i_rad+1) ; k < max_band_length ; k++ )
734 if( (k-i_rad) > height[i] )
739 x += (double)( cos(a) * (double)k );/* newbed! */
740 y += (double)( -sin(a) * (double)k );
742 *(p_picture->p[0].p_pixels + x + y * p_picture->p[0].i_pitch
748 *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch
751 if( 0x04 * i_line - 0x0f > 0 )
753 if ( 0x04 * i_line -0x0f < 0xff)
754 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
755 ) = ( 0x04 * i_line) -(color1-1);
757 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
762 *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch
769 fft_close( p_state );
771 if( p_s16_buff != NULL )
777 if(height) free(height);
779 if(psz_parse) free(psz_parse);
785 /*****************************************************************************
786 * scope_Run: scope effect
787 *****************************************************************************/
788 int scope_Run(visual_effect_t * p_effect, aout_instance_t *p_aout,
789 aout_buffer_t * p_buffer , picture_t * p_picture)
794 uint8_t *ppp_area[2][3];
797 for( i_index = 0 ; i_index < 2 ; i_index++ )
800 for( j = 0 ; j < 3 ; j++ )
802 ppp_area[i_index][j] =
803 p_picture->p[j].p_pixels + i_index * p_picture->p[j].i_lines
804 / 2 * p_picture->p[j].i_pitch;
808 for( i_index = 0, p_sample = (float *)p_buffer->p_buffer;
809 i_index < p_effect->i_width;
815 i_value = (*p_sample++ +1) * 127;
817 + p_picture->p[0].i_pitch * i_index / p_effect->i_width
818 + p_picture->p[0].i_lines * i_value / 512
819 * p_picture->p[0].i_pitch) = 0xbf;
821 + p_picture->p[1].i_pitch * i_index / p_effect->i_width
822 + p_picture->p[1].i_lines * i_value / 512
823 * p_picture->p[1].i_pitch) = 0xff;
827 i_value = ( *p_sample++ +1 ) * 127;
829 + p_picture->p[0].i_pitch * i_index / p_effect->i_width
830 + p_picture->p[0].i_lines * i_value / 512
831 * p_picture->p[0].i_pitch) = 0x9f;
833 + p_picture->p[2].i_pitch * i_index / p_effect->i_width
834 + p_picture->p[2].i_lines * i_value / 512
835 * p_picture->p[2].i_pitch) = 0xdd;