1 /*****************************************************************************
2 * headphone.c : headphone virtual spatialization channel mixer module
3 * -> gives the feeling of a real room with a simple headphone
4 *****************************************************************************
5 * Copyright (C) 2002-2006 the VideoLAN team
8 * Authors: Boris Dorès <babal@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <math.h> /* sqrt */
36 #include <vlc_filter.h>
37 #include <vlc_block.h>
39 /*****************************************************************************
41 *****************************************************************************/
42 static int Create ( vlc_object_t * );
43 static void Destroy ( vlc_object_t * );
45 static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
49 static int OpenFilter ( vlc_object_t * );
50 static void CloseFilter( vlc_object_t * );
51 static block_t *Convert( filter_t *, block_t * );
53 /*****************************************************************************
55 *****************************************************************************/
56 #define MODULE_DESCRIPTION N_ ( \
57 "This effect gives you the feeling that you are standing in a room " \
58 "with a complete 7.1 speaker set when using only a headphone, " \
59 "providing a more realistic sound experience. It should also be " \
60 "more comfortable and less tiring when listening to music for " \
61 "long periods of time.\nIt works with any source format from mono " \
64 #define HEADPHONE_DIM_TEXT N_("Characteristic dimension")
65 #define HEADPHONE_DIM_LONGTEXT N_( \
66 "Distance between front left speaker and listener in meters.")
68 #define HEADPHONE_COMPENSATE_TEXT N_("Compensate delay")
69 #define HEADPHONE_COMPENSATE_LONGTEXT N_( \
70 "The delay which is introduced by the physical algorithm may "\
71 "sometimes be disturbing for the synchronization between lips-movement "\
72 "and speech. In case, turn this on to compensate.")
74 #define HEADPHONE_DOLBY_TEXT N_("No decoding of Dolby Surround")
75 #define HEADPHONE_DOLBY_LONGTEXT N_( \
76 "Dolby Surround encoded streams won't be decoded before being " \
77 "processed by this filter. Enabling this setting is not recommended.")
80 set_description( _("Headphone virtual spatialization effect") );
81 set_shortname( _("Headphone effect") );
82 set_help( MODULE_DESCRIPTION );
83 set_category( CAT_AUDIO );
84 set_subcategory( SUBCAT_AUDIO_AFILTER );
86 add_integer( "headphone-dim", 10, NULL, HEADPHONE_DIM_TEXT,
87 HEADPHONE_DIM_LONGTEXT, VLC_FALSE );
88 add_bool( "headphone-compensate", 0, NULL, HEADPHONE_COMPENSATE_TEXT,
89 HEADPHONE_COMPENSATE_LONGTEXT, VLC_TRUE );
90 add_bool( "headphone-dolby", 0, NULL, HEADPHONE_DOLBY_TEXT,
91 HEADPHONE_DOLBY_LONGTEXT, VLC_TRUE );
93 set_capability( "audio filter", 0 );
94 set_callbacks( Create, Destroy );
95 add_shortcut( "headphone" );
99 set_description( _("Headphone virtual spatialization effect") );
100 set_capability( "audio filter2", 0 );
101 set_callbacks( OpenFilter, CloseFilter );
105 /*****************************************************************************
106 * Internal data structures
107 *****************************************************************************/
108 struct atomic_operation_t
110 int i_source_channel_offset;
111 int i_dest_channel_offset;
112 unsigned int i_delay;/* in sample unit */
113 double d_amplitude_factor;
116 struct aout_filter_sys_t
118 size_t i_overflow_buffer_size;/* in bytes */
119 byte_t * p_overflow_buffer;
120 unsigned int i_nb_atomic_operations;
121 struct atomic_operation_t * p_atomic_operations;
126 size_t i_overflow_buffer_size;/* in bytes */
127 byte_t * p_overflow_buffer;
128 unsigned int i_nb_atomic_operations;
129 struct atomic_operation_t * p_atomic_operations;
132 /*****************************************************************************
133 * Init: initialize internal data structures
134 * and computes the needed atomic operations
135 *****************************************************************************/
136 /* x and z represent the coordinates of the virtual speaker
137 * relatively to the center of the listener's head, measured in meters :
146 * rear left rear right
150 static void ComputeChannelOperations( struct aout_filter_sys_t * p_data
151 , unsigned int i_rate, unsigned int i_next_atomic_operation
152 , int i_source_channel_offset, double d_x, double d_z
153 , double d_compensation_length, double d_channel_amplitude_factor )
155 double d_c = 340; /*sound celerity (unit: m/s)*/
156 double d_compensation_delay = (d_compensation_length-0.1) / d_c * i_rate;
159 p_data->p_atomic_operations[i_next_atomic_operation]
160 .i_source_channel_offset = i_source_channel_offset;
161 p_data->p_atomic_operations[i_next_atomic_operation]
162 .i_dest_channel_offset = 0;/* left */
163 p_data->p_atomic_operations[i_next_atomic_operation]
164 .i_delay = (int)( sqrt( (-0.1-d_x)*(-0.1-d_x) + (0-d_z)*(0-d_z) )
165 / d_c * i_rate - d_compensation_delay );
168 p_data->p_atomic_operations[i_next_atomic_operation]
169 .d_amplitude_factor = d_channel_amplitude_factor * 1.1 / 2;
173 p_data->p_atomic_operations[i_next_atomic_operation]
174 .d_amplitude_factor = d_channel_amplitude_factor * 0.9 / 2;
178 p_data->p_atomic_operations[i_next_atomic_operation]
179 .d_amplitude_factor = d_channel_amplitude_factor / 2;
183 p_data->p_atomic_operations[i_next_atomic_operation + 1]
184 .i_source_channel_offset = i_source_channel_offset;
185 p_data->p_atomic_operations[i_next_atomic_operation + 1]
186 .i_dest_channel_offset = 1;/* right */
187 p_data->p_atomic_operations[i_next_atomic_operation + 1]
188 .i_delay = (int)( sqrt( (0.1-d_x)*(0.1-d_x) + (0-d_z)*(0-d_z) )
189 / d_c * i_rate - d_compensation_delay );
192 p_data->p_atomic_operations[i_next_atomic_operation + 1]
193 .d_amplitude_factor = d_channel_amplitude_factor * 0.9 / 2;
197 p_data->p_atomic_operations[i_next_atomic_operation + 1]
198 .d_amplitude_factor = d_channel_amplitude_factor * 1.1 / 2;
202 p_data->p_atomic_operations[i_next_atomic_operation + 1]
203 .d_amplitude_factor = d_channel_amplitude_factor / 2;
207 static int Init( vlc_object_t *p_this, struct aout_filter_sys_t * p_data
208 , unsigned int i_nb_channels, uint32_t i_physical_channels
209 , unsigned int i_rate )
211 double d_x = config_GetInt( p_this, "headphone-dim" );
213 double d_z_rear = -d_x/3;
215 unsigned int i_next_atomic_operation;
216 int i_source_channel_offset;
221 msg_Dbg( p_this, "passing a null pointer as argument" );
225 if( config_GetInt( p_this, "headphone-compensate" ) )
227 /* minimal distance to any speaker */
228 if( i_physical_channels & AOUT_CHAN_REARCENTER )
238 /* Number of elementary operations */
239 p_data->i_nb_atomic_operations = i_nb_channels * 2;
240 if( i_physical_channels & AOUT_CHAN_CENTER )
242 p_data->i_nb_atomic_operations += 2;
244 p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t)
245 * p_data->i_nb_atomic_operations );
246 if( p_data->p_atomic_operations == NULL )
248 msg_Err( p_this, "out of memory" );
252 /* For each virtual speaker, computes elementary wave propagation time
254 i_next_atomic_operation = 0;
255 i_source_channel_offset = 0;
256 if( i_physical_channels & AOUT_CHAN_LEFT )
258 ComputeChannelOperations( p_data , i_rate
259 , i_next_atomic_operation , i_source_channel_offset
260 , -d_x , d_z , d_min , 2.0 / i_nb_channels );
261 i_next_atomic_operation += 2;
262 i_source_channel_offset++;
264 if( i_physical_channels & AOUT_CHAN_RIGHT )
266 ComputeChannelOperations( p_data , i_rate
267 , i_next_atomic_operation , i_source_channel_offset
268 , d_x , d_z , d_min , 2.0 / i_nb_channels );
269 i_next_atomic_operation += 2;
270 i_source_channel_offset++;
272 if( i_physical_channels & AOUT_CHAN_MIDDLELEFT )
274 ComputeChannelOperations( p_data , i_rate
275 , i_next_atomic_operation , i_source_channel_offset
276 , -d_x , 0 , d_min , 1.5 / i_nb_channels );
277 i_next_atomic_operation += 2;
278 i_source_channel_offset++;
280 if( i_physical_channels & AOUT_CHAN_MIDDLERIGHT )
282 ComputeChannelOperations( p_data , i_rate
283 , i_next_atomic_operation , i_source_channel_offset
284 , d_x , 0 , d_min , 1.5 / i_nb_channels );
285 i_next_atomic_operation += 2;
286 i_source_channel_offset++;
288 if( i_physical_channels & AOUT_CHAN_REARLEFT )
290 ComputeChannelOperations( p_data , i_rate
291 , i_next_atomic_operation , i_source_channel_offset
292 , -d_x , d_z_rear , d_min , 1.5 / i_nb_channels );
293 i_next_atomic_operation += 2;
294 i_source_channel_offset++;
296 if( i_physical_channels & AOUT_CHAN_REARRIGHT )
298 ComputeChannelOperations( p_data , i_rate
299 , i_next_atomic_operation , i_source_channel_offset
300 , d_x , d_z_rear , d_min , 1.5 / i_nb_channels );
301 i_next_atomic_operation += 2;
302 i_source_channel_offset++;
304 if( i_physical_channels & AOUT_CHAN_REARCENTER )
306 ComputeChannelOperations( p_data , i_rate
307 , i_next_atomic_operation , i_source_channel_offset
308 , 0 , -d_z , d_min , 1.5 / i_nb_channels );
309 i_next_atomic_operation += 2;
310 i_source_channel_offset++;
312 if( i_physical_channels & AOUT_CHAN_CENTER )
314 /* having two center channels increases the spatialization effect */
315 ComputeChannelOperations( p_data , i_rate
316 , i_next_atomic_operation , i_source_channel_offset
317 , d_x / 5.0 , d_z , d_min , 0.75 / i_nb_channels );
318 i_next_atomic_operation += 2;
319 ComputeChannelOperations( p_data , i_rate
320 , i_next_atomic_operation , i_source_channel_offset
321 , -d_x / 5.0 , d_z , d_min , 0.75 / i_nb_channels );
322 i_next_atomic_operation += 2;
323 i_source_channel_offset++;
325 if( i_physical_channels & AOUT_CHAN_LFE )
327 ComputeChannelOperations( p_data , i_rate
328 , i_next_atomic_operation , i_source_channel_offset
329 , 0 , d_z_rear , d_min , 5.0 / i_nb_channels );
330 i_next_atomic_operation += 2;
331 i_source_channel_offset++;
334 /* Initialize the overflow buffer
335 * we need it because the process induce a delay in the samples */
336 p_data->i_overflow_buffer_size = 0;
337 for( i = 0 ; i < p_data->i_nb_atomic_operations ; i++ )
339 if( p_data->i_overflow_buffer_size
340 < p_data->p_atomic_operations[i].i_delay * 2 * sizeof (float) )
342 p_data->i_overflow_buffer_size
343 = p_data->p_atomic_operations[i].i_delay * 2 * sizeof (float);
346 p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size );
347 if( p_data->p_atomic_operations == NULL )
349 msg_Err( p_this, "out of memory" );
352 memset( p_data->p_overflow_buffer, 0 , p_data->i_overflow_buffer_size );
358 /*****************************************************************************
359 * Create: allocate headphone downmixer
360 *****************************************************************************/
361 static int Create( vlc_object_t *p_this )
363 aout_filter_t * p_filter = (aout_filter_t *)p_this;
364 vlc_bool_t b_fit = VLC_TRUE;
366 /* Activate this filter only with stereo devices */
367 if( p_filter->output.i_physical_channels
368 != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) )
370 msg_Dbg( p_filter, "filter discarded (incompatible format)" );
374 /* Request a specific format if not already compatible */
375 if( p_filter->input.i_original_channels
376 != p_filter->output.i_original_channels )
379 p_filter->input.i_original_channels =
380 p_filter->output.i_original_channels;
382 if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
383 || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
386 p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
387 p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
389 if( p_filter->input.i_rate != p_filter->output.i_rate )
392 p_filter->input.i_rate = p_filter->output.i_rate;
394 if( p_filter->input.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
395 && ( p_filter->input.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
396 && ! config_GetInt ( p_filter , "headphone-dolby" ) )
399 p_filter->input.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
406 msg_Dbg( p_filter, "requesting specific format" );
410 /* Allocate the memory needed to store the module's structure */
411 p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
412 if( p_filter->p_sys == NULL )
414 msg_Err( p_filter, "out of memory" );
417 p_filter->p_sys->i_overflow_buffer_size = 0;
418 p_filter->p_sys->p_overflow_buffer = NULL;
419 p_filter->p_sys->i_nb_atomic_operations = 0;
420 p_filter->p_sys->p_atomic_operations = NULL;
422 if( Init( VLC_OBJECT(p_filter), p_filter->p_sys
423 , aout_FormatNbChannels ( &p_filter->input )
424 , p_filter->input.i_physical_channels
425 , p_filter->input.i_rate ) < 0 )
430 p_filter->pf_do_work = DoWork;
431 p_filter->b_in_place = 0;
436 /*****************************************************************************
437 * Destroy: deallocate resources associated with headphone downmixer
438 *****************************************************************************/
439 static void Destroy( vlc_object_t *p_this )
441 aout_filter_t * p_filter = (aout_filter_t *)p_this;
443 if( p_filter->p_sys != NULL )
445 if( p_filter->p_sys->p_overflow_buffer != NULL )
447 free( p_filter->p_sys->p_overflow_buffer );
449 if( p_filter->p_sys->p_atomic_operations != NULL )
451 free( p_filter->p_sys->p_atomic_operations );
453 free( p_filter->p_sys );
454 p_filter->p_sys = NULL;
458 /*****************************************************************************
459 * DoWork: convert a buffer
460 *****************************************************************************/
461 static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
462 aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
464 int i_input_nb = aout_FormatNbChannels( &p_filter->input );
465 int i_output_nb = aout_FormatNbChannels( &p_filter->output );
467 float * p_in = (float*) p_in_buf->p_buffer;
472 size_t i_overflow_size; /* in bytes */
473 size_t i_out_size; /* in bytes */
477 int i_source_channel_offset;
478 int i_dest_channel_offset;
479 unsigned int i_delay;
480 double d_amplitude_factor;
482 /* out buffer characterisitcs */
483 p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
484 p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * i_output_nb / i_input_nb;
485 p_out = p_out_buf->p_buffer;
486 i_out_size = p_out_buf->i_nb_bytes;
488 if( p_filter->p_sys != NULL )
490 /* Slide the overflow buffer */
491 p_overflow = p_filter->p_sys->p_overflow_buffer;
492 i_overflow_size = p_filter->p_sys->i_overflow_buffer_size;
494 memset( p_out, 0, i_out_size );
495 if ( i_out_size > i_overflow_size )
496 memcpy( p_out, p_overflow, i_overflow_size );
498 memcpy( p_out, p_overflow, i_out_size );
500 p_slide = p_filter->p_sys->p_overflow_buffer;
501 while( p_slide < p_overflow + i_overflow_size )
503 if( p_slide + i_out_size < p_overflow + i_overflow_size )
505 memset( p_slide, 0, i_out_size );
506 if( p_slide + 2 * i_out_size < p_overflow + i_overflow_size )
507 memcpy( p_slide, p_slide + i_out_size, i_out_size );
509 memcpy( p_slide, p_slide + i_out_size,
510 p_overflow + i_overflow_size - ( p_slide + i_out_size ) );
514 memset( p_slide, 0, p_overflow + i_overflow_size - p_slide );
516 p_slide += i_out_size;
519 /* apply the atomic operations */
520 for( i = 0; i < p_filter->p_sys->i_nb_atomic_operations; i++ )
522 /* shorter variable names */
523 i_source_channel_offset
524 = p_filter->p_sys->p_atomic_operations[i].i_source_channel_offset;
525 i_dest_channel_offset
526 = p_filter->p_sys->p_atomic_operations[i].i_dest_channel_offset;
527 i_delay = p_filter->p_sys->p_atomic_operations[i].i_delay;
529 = p_filter->p_sys->p_atomic_operations[i].d_amplitude_factor;
531 if( p_out_buf->i_nb_samples > i_delay )
533 /* current buffer coefficients */
534 for( j = 0; j < p_out_buf->i_nb_samples - i_delay; j++ )
536 ((float*)p_out)[ (i_delay+j)*i_output_nb + i_dest_channel_offset ]
537 += p_in[ j * i_input_nb + i_source_channel_offset ]
538 * d_amplitude_factor;
541 /* overflow buffer coefficients */
542 for( j = 0; j < i_delay; j++ )
544 ((float*)p_overflow)[ j*i_output_nb + i_dest_channel_offset ]
545 += p_in[ (p_out_buf->i_nb_samples - i_delay + j)
546 * i_input_nb + i_source_channel_offset ]
547 * d_amplitude_factor;
552 /* overflow buffer coefficients only */
553 for( j = 0; j < p_out_buf->i_nb_samples; j++ )
555 ((float*)p_overflow)[ (i_delay - p_out_buf->i_nb_samples + j)
556 * i_output_nb + i_dest_channel_offset ]
557 += p_in[ j * i_input_nb + i_source_channel_offset ]
558 * d_amplitude_factor;
565 memset( p_out, 0, i_out_size );
572 /*****************************************************************************
574 *****************************************************************************/
575 static int OpenFilter( vlc_object_t *p_this )
577 filter_t *p_filter = (filter_t *)p_this;
578 vlc_bool_t b_fit = VLC_TRUE;
580 /* Activate this filter only with stereo devices */
581 if( p_filter->fmt_out.audio.i_physical_channels
582 != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) )
584 msg_Dbg( p_filter, "filter discarded (incompatible format)" );
588 /* Request a specific format if not already compatible */
589 if( p_filter->fmt_in.audio.i_original_channels
590 != p_filter->fmt_out.audio.i_original_channels )
593 p_filter->fmt_in.audio.i_original_channels =
594 p_filter->fmt_out.audio.i_original_channels;
596 if( p_filter->fmt_in.audio.i_format != VLC_FOURCC('f','l','3','2')
597 || p_filter->fmt_out.audio.i_format != VLC_FOURCC('f','l','3','2') )
600 p_filter->fmt_in.audio.i_format = VLC_FOURCC('f','l','3','2');
601 p_filter->fmt_out.audio.i_format = VLC_FOURCC('f','l','3','2');
603 if( p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate )
606 p_filter->fmt_in.audio.i_rate = p_filter->fmt_out.audio.i_rate;
608 if( p_filter->fmt_in.audio.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
609 && ( p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
610 && !config_GetInt( p_filter, "headphone-dolby" ) )
613 p_filter->fmt_in.audio.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
620 msg_Dbg( p_filter, "requesting specific format" );
624 /* Allocate the memory needed to store the module's structure */
625 p_filter->p_sys = malloc( sizeof(struct filter_sys_t) );
626 if( p_filter->p_sys == NULL )
628 msg_Err( p_filter, "out of memory" );
631 p_filter->p_sys->i_overflow_buffer_size = 0;
632 p_filter->p_sys->p_overflow_buffer = NULL;
633 p_filter->p_sys->i_nb_atomic_operations = 0;
634 p_filter->p_sys->p_atomic_operations = NULL;
636 if( Init( VLC_OBJECT(p_filter), (struct aout_filter_sys_t *)p_filter->p_sys
637 , aout_FormatNbChannels ( &(p_filter->fmt_in.audio) )
638 , p_filter->fmt_in.audio.i_physical_channels
639 , p_filter->fmt_in.audio.i_rate ) < 0 )
644 p_filter->pf_audio_filter = Convert;
645 p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
650 /*****************************************************************************
651 * CloseFilter : deallocate data structures
652 *****************************************************************************/
653 static void CloseFilter( vlc_object_t *p_this )
655 filter_t *p_filter = (filter_t *)p_this;
657 if( p_filter->p_sys != NULL )
659 if( p_filter->p_sys->p_overflow_buffer != NULL )
661 free ( p_filter->p_sys->p_overflow_buffer );
663 if( p_filter->p_sys->p_atomic_operations != NULL )
665 free ( p_filter->p_sys->p_atomic_operations );
667 free( p_filter->p_sys );
668 p_filter->p_sys = NULL;
672 static block_t *Convert( filter_t *p_filter, block_t *p_block )
674 aout_filter_t aout_filter;
675 aout_buffer_t in_buf, out_buf;
679 if( !p_block || !p_block->i_samples )
681 if( p_block ) p_block->pf_release( p_block );
685 i_out_size = p_block->i_samples *
686 p_filter->fmt_out.audio.i_bitspersample/8 *
687 aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
689 p_out = p_filter->pf_audio_buffer_new( p_filter, i_out_size );
692 msg_Warn( p_filter, "can't get output buffer" );
693 if( p_block ) p_block->pf_release( p_block );
697 p_out->i_samples = p_block->i_samples;
698 p_out->i_dts = p_block->i_dts;
699 p_out->i_pts = p_block->i_pts;
700 p_out->i_length = p_block->i_length;
702 aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
703 aout_filter.input = p_filter->fmt_in.audio;
704 aout_filter.input.i_format = p_filter->fmt_in.i_codec;
705 aout_filter.output = p_filter->fmt_out.audio;
706 aout_filter.output.i_format = p_filter->fmt_out.i_codec;
707 aout_filter.b_in_place = 0;
709 in_buf.p_buffer = p_block->p_buffer;
710 in_buf.i_nb_bytes = p_block->i_buffer;
711 in_buf.i_nb_samples = p_block->i_samples;
712 out_buf.p_buffer = p_out->p_buffer;
713 out_buf.i_nb_bytes = p_out->i_buffer;
714 out_buf.i_nb_samples = p_out->i_samples;
716 DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
718 p_out->i_buffer = out_buf.i_nb_bytes;
719 p_out->i_samples = out_buf.i_nb_samples;
721 if( p_block ) p_block->pf_release( p_block );