Loading lib_rend/ivas_reflections.c +12 −13 Original line number Diff line number Diff line Loading @@ -275,9 +275,9 @@ ivas_error ivas_er_encoder_init( for ( i = 0; i < reflections->n_total_reflections; i++ ) { /* Compute cartesian points for reflection (from degrees) */ p_x = ER_RADIUS * ( (float) cos( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * (float) cos( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); p_y = ER_RADIUS * ( (float) cos( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * (float) sin( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); p_z = ER_RADIUS * ( (float) sin( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) ); p_x = ER_RADIUS * ( cosf( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * cosf( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); p_y = ER_RADIUS * ( cosf( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * sinf( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); p_z = ER_RADIUS * ( sinf( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) ); /* Calculate the euclidean distance to each point in the config ls setup */ for ( j = 0; j < reflections->nchan_out; j++ ) Loading @@ -287,14 +287,14 @@ ivas_error ivas_er_encoder_init( { src_idx = ( j > LFE_CHANNEL ) ? j - 1 : j; p_x_src = reflections->source_positions[src_idx * 3 + 2] * ( (float) cos( reflections->source_positions[src_idx * 3 + 1] ) * (float) cos( reflections->source_positions[src_idx * 3] ) ); p_y_src = reflections->source_positions[src_idx * 3 + 2] * ( (float) cos( reflections->source_positions[src_idx * 3 + 1] ) * (float) sin( reflections->source_positions[src_idx * 3] ) ); p_z_src = reflections->source_positions[src_idx * 3 + 2] * (float) sin( reflections->source_positions[src_idx * 3 + 1] ); p_x_src = reflections->source_positions[src_idx * 3 + 2] * ( cosf( reflections->source_positions[src_idx * 3 + 1] ) * cosf( reflections->source_positions[src_idx * 3] ) ); p_y_src = reflections->source_positions[src_idx * 3 + 2] * ( cosf( reflections->source_positions[src_idx * 3 + 1] ) * sinf( reflections->source_positions[src_idx * 3] ) ); p_z_src = reflections->source_positions[src_idx * 3 + 2] * sinf( reflections->source_positions[src_idx * 3 + 1] ); tmp = ( p_x_src - p_x ) * ( p_x_src - p_x ); tmp += ( p_y_src - p_y ) * ( p_y_src - p_y ); tmp += ( p_z_src - p_z ) * ( p_z_src - p_z ); dist = (float) sqrt( tmp ); dist = sqrtf( tmp ); /* Save index of closest channel */ if ( src_idx == 0 ) Loading Loading @@ -344,9 +344,8 @@ ivas_error ivas_er_compute_reflections( } /* Run shoebox with current reflection parameters */ ivas_shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), reflections->shoebox_lib.cal.list_orig, reflections->source_positions, reflections->is_cartesian, reflections->is_relative ); ivas_shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), reflections->shoebox_lib.cal.list_orig, reflections->source_positions, reflections->is_cartesian, reflections->is_relative ); /* Convert reflection times in seconds to samples and keep track of max */ circ_len = 0; Loading @@ -354,9 +353,9 @@ ivas_error ivas_er_compute_reflections( { for ( j = 0; j < reflections->shoebox_data.n_ref; j++ ) { tmp = reflections->shoebox_data.times.data[j + ( i * (int16_t) reflections->shoebox_data.n_ref )]; tmp = (float) round( tmp * reflections->output_Fs ); reflections->shoebox_data.times.data[j + ( i * (int16_t) reflections->shoebox_data.n_ref )] = tmp; tmp = reflections->shoebox_data.times.data[j + ( i * reflections->shoebox_data.n_ref )]; tmp = roundf( tmp * reflections->output_Fs ); reflections->shoebox_data.times.data[j + ( i * reflections->shoebox_data.n_ref )] = tmp; circ_len = ( (uint16_t) tmp > circ_len ) ? (uint16_t) tmp : circ_len; } } Loading Loading
lib_rend/ivas_reflections.c +12 −13 Original line number Diff line number Diff line Loading @@ -275,9 +275,9 @@ ivas_error ivas_er_encoder_init( for ( i = 0; i < reflections->n_total_reflections; i++ ) { /* Compute cartesian points for reflection (from degrees) */ p_x = ER_RADIUS * ( (float) cos( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * (float) cos( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); p_y = ER_RADIUS * ( (float) cos( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * (float) sin( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); p_z = ER_RADIUS * ( (float) sin( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) ); p_x = ER_RADIUS * ( cosf( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * cosf( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); p_y = ER_RADIUS * ( cosf( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * sinf( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); p_z = ER_RADIUS * ( sinf( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) ); /* Calculate the euclidean distance to each point in the config ls setup */ for ( j = 0; j < reflections->nchan_out; j++ ) Loading @@ -287,14 +287,14 @@ ivas_error ivas_er_encoder_init( { src_idx = ( j > LFE_CHANNEL ) ? j - 1 : j; p_x_src = reflections->source_positions[src_idx * 3 + 2] * ( (float) cos( reflections->source_positions[src_idx * 3 + 1] ) * (float) cos( reflections->source_positions[src_idx * 3] ) ); p_y_src = reflections->source_positions[src_idx * 3 + 2] * ( (float) cos( reflections->source_positions[src_idx * 3 + 1] ) * (float) sin( reflections->source_positions[src_idx * 3] ) ); p_z_src = reflections->source_positions[src_idx * 3 + 2] * (float) sin( reflections->source_positions[src_idx * 3 + 1] ); p_x_src = reflections->source_positions[src_idx * 3 + 2] * ( cosf( reflections->source_positions[src_idx * 3 + 1] ) * cosf( reflections->source_positions[src_idx * 3] ) ); p_y_src = reflections->source_positions[src_idx * 3 + 2] * ( cosf( reflections->source_positions[src_idx * 3 + 1] ) * sinf( reflections->source_positions[src_idx * 3] ) ); p_z_src = reflections->source_positions[src_idx * 3 + 2] * sinf( reflections->source_positions[src_idx * 3 + 1] ); tmp = ( p_x_src - p_x ) * ( p_x_src - p_x ); tmp += ( p_y_src - p_y ) * ( p_y_src - p_y ); tmp += ( p_z_src - p_z ) * ( p_z_src - p_z ); dist = (float) sqrt( tmp ); dist = sqrtf( tmp ); /* Save index of closest channel */ if ( src_idx == 0 ) Loading Loading @@ -344,9 +344,8 @@ ivas_error ivas_er_compute_reflections( } /* Run shoebox with current reflection parameters */ ivas_shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), reflections->shoebox_lib.cal.list_orig, reflections->source_positions, reflections->is_cartesian, reflections->is_relative ); ivas_shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), reflections->shoebox_lib.cal.list_orig, reflections->source_positions, reflections->is_cartesian, reflections->is_relative ); /* Convert reflection times in seconds to samples and keep track of max */ circ_len = 0; Loading @@ -354,9 +353,9 @@ ivas_error ivas_er_compute_reflections( { for ( j = 0; j < reflections->shoebox_data.n_ref; j++ ) { tmp = reflections->shoebox_data.times.data[j + ( i * (int16_t) reflections->shoebox_data.n_ref )]; tmp = (float) round( tmp * reflections->output_Fs ); reflections->shoebox_data.times.data[j + ( i * (int16_t) reflections->shoebox_data.n_ref )] = tmp; tmp = reflections->shoebox_data.times.data[j + ( i * reflections->shoebox_data.n_ref )]; tmp = roundf( tmp * reflections->output_Fs ); reflections->shoebox_data.times.data[j + ( i * reflections->shoebox_data.n_ref )] = tmp; circ_len = ( (uint16_t) tmp > circ_len ) ? (uint16_t) tmp : circ_len; } } Loading