Lines Matching refs:st
85 static opus_val32 *ms_get_preemph_mem(OpusMSEncoder *st) in ms_get_preemph_mem() argument
93 ptr = (char*)st + align(sizeof(OpusMSEncoder)); in ms_get_preemph_mem()
94 for (s=0;s<st->layout.nb_streams;s++) in ms_get_preemph_mem()
96 if (s < st->layout.nb_coupled_streams) in ms_get_preemph_mem()
101 return (opus_val32*)(ptr+st->layout.nb_channels*120*sizeof(opus_val32)); in ms_get_preemph_mem()
104 static opus_val32 *ms_get_window_mem(OpusMSEncoder *st) in ms_get_window_mem() argument
112 ptr = (char*)st + align(sizeof(OpusMSEncoder)); in ms_get_window_mem()
113 for (s=0;s<st->layout.nb_streams;s++) in ms_get_window_mem()
115 if (s < st->layout.nb_coupled_streams) in ms_get_window_mem()
395 OpusMSEncoder *st, in opus_multistream_encoder_init_impl() argument
414 st->layout.nb_channels = channels; in opus_multistream_encoder_init_impl()
415 st->layout.nb_streams = streams; in opus_multistream_encoder_init_impl()
416 st->layout.nb_coupled_streams = coupled_streams; in opus_multistream_encoder_init_impl()
417 st->subframe_mem[0]=st->subframe_mem[1]=st->subframe_mem[2]=0; in opus_multistream_encoder_init_impl()
419 st->lfe_stream = -1; in opus_multistream_encoder_init_impl()
420 st->bitrate_bps = OPUS_AUTO; in opus_multistream_encoder_init_impl()
421 st->application = application; in opus_multistream_encoder_init_impl()
422 st->variable_duration = OPUS_FRAMESIZE_ARG; in opus_multistream_encoder_init_impl()
423 for (i=0;i<st->layout.nb_channels;i++) in opus_multistream_encoder_init_impl()
424 st->layout.mapping[i] = mapping[i]; in opus_multistream_encoder_init_impl()
425 if (!validate_layout(&st->layout) || !validate_encoder_layout(&st->layout)) in opus_multistream_encoder_init_impl()
427 ptr = (char*)st + align(sizeof(OpusMSEncoder)); in opus_multistream_encoder_init_impl()
431 for (i=0;i<st->layout.nb_coupled_streams;i++) in opus_multistream_encoder_init_impl()
435 if (i==st->lfe_stream) in opus_multistream_encoder_init_impl()
439 for (;i<st->layout.nb_streams;i++) in opus_multistream_encoder_init_impl()
442 if (i==st->lfe_stream) in opus_multistream_encoder_init_impl()
449 OPUS_CLEAR(ms_get_preemph_mem(st), channels); in opus_multistream_encoder_init_impl()
450 OPUS_CLEAR(ms_get_window_mem(st), channels*120); in opus_multistream_encoder_init_impl()
452 st->surround = surround; in opus_multistream_encoder_init_impl()
457 OpusMSEncoder *st, in opus_multistream_encoder_init() argument
466 …return opus_multistream_encoder_init_impl(st, Fs, channels, streams, coupled_streams, mapping, app… in opus_multistream_encoder_init()
470 OpusMSEncoder *st, in opus_multistream_surround_encoder_init() argument
482 st->lfe_stream = -1; in opus_multistream_surround_encoder_init()
506 st->lfe_stream = *streams-1; in opus_multistream_surround_encoder_init()
516 return opus_multistream_encoder_init_impl(st, Fs, channels, *streams, *coupled_streams, in opus_multistream_surround_encoder_init()
531 OpusMSEncoder *st; in opus_multistream_encoder_create() local
539 st = (OpusMSEncoder *)opus_alloc(opus_multistream_encoder_get_size(streams, coupled_streams)); in opus_multistream_encoder_create()
540 if (st==NULL) in opus_multistream_encoder_create()
546 …ret = opus_multistream_encoder_init(st, Fs, channels, streams, coupled_streams, mapping, applicati… in opus_multistream_encoder_create()
549 opus_free(st); in opus_multistream_encoder_create()
550 st = NULL; in opus_multistream_encoder_create()
554 return st; in opus_multistream_encoder_create()
569 OpusMSEncoder *st; in opus_multistream_surround_encoder_create() local
576 …st = (OpusMSEncoder *)opus_alloc(opus_multistream_surround_encoder_get_size(channels, mapping_fami… in opus_multistream_surround_encoder_create()
577 if (st==NULL) in opus_multistream_surround_encoder_create()
583 …ret = opus_multistream_surround_encoder_init(st, Fs, channels, mapping_family, streams, coupled_st… in opus_multistream_surround_encoder_create()
586 opus_free(st); in opus_multistream_surround_encoder_create()
587 st = NULL; in opus_multistream_surround_encoder_create()
591 return st; in opus_multistream_surround_encoder_create()
595 OpusMSEncoder *st, in surround_rate_allocation() argument
609 ptr = (char*)st + align(sizeof(OpusMSEncoder)); in surround_rate_allocation()
612 if (st->bitrate_bps > st->layout.nb_channels*40000) in surround_rate_allocation()
615 stream_offset = st->bitrate_bps/st->layout.nb_channels/2; in surround_rate_allocation()
627 if (st->bitrate_bps==OPUS_AUTO) in surround_rate_allocation()
630 } else if (st->bitrate_bps==OPUS_BITRATE_MAX) in surround_rate_allocation()
638 nb_lfe = (st->lfe_stream!=-1); in surround_rate_allocation()
639 nb_coupled = st->layout.nb_coupled_streams; in surround_rate_allocation()
640 nb_uncoupled = st->layout.nb_streams-nb_coupled-nb_lfe; in surround_rate_allocation()
644 …channel_rate = 256*(st->bitrate_bps-lfe_offset*nb_lfe-stream_offset*(nb_coupled+nb_uncoupled))/tot… in surround_rate_allocation()
647 if (st->variable_duration==OPUS_FRAMESIZE_VARIABLE && frame_size != Fs/50) in surround_rate_allocation()
655 for (i=0;i<st->layout.nb_streams;i++) in surround_rate_allocation()
657 if (i<st->layout.nb_coupled_streams) in surround_rate_allocation()
659 else if (i!=st->lfe_stream) in surround_rate_allocation()
670 OpusMSEncoder *st, in opus_multistream_encode_native() argument
699 if (st->surround) in opus_multistream_encode_native()
701 preemph_mem = ms_get_preemph_mem(st); in opus_multistream_encode_native()
702 mem = ms_get_window_mem(st); in opus_multistream_encode_native()
705 ptr = (char*)st + align(sizeof(OpusMSEncoder)); in opus_multistream_encode_native()
714 channels = st->layout.nb_streams + st->layout.nb_coupled_streams; in opus_multistream_encode_native()
718 st->variable_duration, channels, Fs, st->bitrate_bps, in opus_multistream_encode_native()
721 , st->subframe_mem in opus_multistream_encode_native()
744 ALLOC(bandSMR, 21*st->layout.nb_channels, opus_val16); in opus_multistream_encode_native()
745 if (st->surround) in opus_multistream_encode_native()
747 …surround_analysis(celt_mode, pcm, bandSMR, mem, preemph_mem, frame_size, 120, st->layout.nb_channe… in opus_multistream_encode_native()
750 if (max_data_bytes < 4*st->layout.nb_streams-1) in opus_multistream_encode_native()
757 surround_rate_allocation(st, bitrates, frame_size); in opus_multistream_encode_native()
760 max_data_bytes = IMIN(max_data_bytes, 3*st->bitrate_bps/(3*8*Fs/frame_size)); in opus_multistream_encode_native()
762 ptr = (char*)st + align(sizeof(OpusMSEncoder)); in opus_multistream_encode_native()
763 for (s=0;s<st->layout.nb_streams;s++) in opus_multistream_encode_native()
767 if (s < st->layout.nb_coupled_streams) in opus_multistream_encode_native()
772 if (st->surround) in opus_multistream_encode_native()
775 equiv_rate = st->bitrate_bps; in opus_multistream_encode_native()
777 equiv_rate -= 60*(Fs/frame_size - 50)*st->layout.nb_channels; in opus_multistream_encode_native()
778 if (equiv_rate > 10000*st->layout.nb_channels) in opus_multistream_encode_native()
780 else if (equiv_rate > 7000*st->layout.nb_channels) in opus_multistream_encode_native()
782 else if (equiv_rate > 5000*st->layout.nb_channels) in opus_multistream_encode_native()
786 if (s < st->layout.nb_coupled_streams) in opus_multistream_encode_native()
795 ptr = (char*)st + align(sizeof(OpusMSEncoder)); in opus_multistream_encode_native()
798 for (s=0;s<st->layout.nb_streams;s++) in opus_multistream_encode_native()
807 if (s < st->layout.nb_coupled_streams) in opus_multistream_encode_native()
811 left = get_left_channel(&st->layout, s, -1); in opus_multistream_encode_native()
812 right = get_right_channel(&st->layout, s, -1); in opus_multistream_encode_native()
814 pcm, st->layout.nb_channels, left, frame_size); in opus_multistream_encode_native()
816 pcm, st->layout.nb_channels, right, frame_size); in opus_multistream_encode_native()
818 if (st->surround) in opus_multistream_encode_native()
830 int chan = get_mono_channel(&st->layout, s, -1); in opus_multistream_encode_native()
832 pcm, st->layout.nb_channels, chan, frame_size); in opus_multistream_encode_native()
834 if (st->surround) in opus_multistream_encode_native()
842 if (st->surround) in opus_multistream_encode_native()
847 curr_max -= IMAX(0,4*(st->layout.nb_streams-s-1)-1); in opus_multistream_encode_native()
849 if (!vbr && s == st->layout.nb_streams-1) in opus_multistream_encode_native()
852 pcm, analysis_frame_size, c1, c2, st->layout.nb_channels, downmix); in opus_multistream_encode_native()
863 …data, max_data_bytes-tot_size, s != st->layout.nb_streams-1, !vbr && s == st->layout.nb_streams-1); in opus_multistream_encode_native()
917 OpusMSEncoder *st, in opus_multistream_encode() argument
924 return opus_multistream_encode_native(st, opus_copy_channel_in_short, in opus_multistream_encode()
930 OpusMSEncoder *st, in opus_multistream_encode_float() argument
937 return opus_multistream_encode_native(st, opus_copy_channel_in_float, in opus_multistream_encode_float()
946 OpusMSEncoder *st, in opus_multistream_encode_float() argument
953 return opus_multistream_encode_native(st, opus_copy_channel_in_float, in opus_multistream_encode_float()
958 OpusMSEncoder *st, in opus_multistream_encode() argument
965 return opus_multistream_encode_native(st, opus_copy_channel_in_short, in opus_multistream_encode()
970 int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) in opus_multistream_encoder_ctl() argument
981 ptr = (char*)st + align(sizeof(OpusMSEncoder)); in opus_multistream_encoder_ctl()
991 st->bitrate_bps = value; in opus_multistream_encoder_ctl()
1003 for (s=0;s<st->layout.nb_streams;s++) in opus_multistream_encoder_ctl()
1008 if (s < st->layout.nb_coupled_streams) in opus_multistream_encoder_ctl()
1050 for (s=0;s<st->layout.nb_streams;s++) in opus_multistream_encoder_ctl()
1054 if (s < st->layout.nb_coupled_streams) in opus_multistream_encoder_ctl()
1082 for (s=0;s<st->layout.nb_streams;s++) in opus_multistream_encoder_ctl()
1087 if (s < st->layout.nb_coupled_streams) in opus_multistream_encoder_ctl()
1103 if (stream_id<0 || stream_id >= st->layout.nb_streams) in opus_multistream_encoder_ctl()
1112 if (s < st->layout.nb_coupled_streams) in opus_multistream_encoder_ctl()
1123 st->variable_duration = value; in opus_multistream_encoder_ctl()
1133 *value = st->variable_duration; in opus_multistream_encoder_ctl()
1139 st->subframe_mem[0] = st->subframe_mem[1] = st->subframe_mem[2] = 0; in opus_multistream_encoder_ctl()
1140 if (st->surround) in opus_multistream_encoder_ctl()
1142 OPUS_CLEAR(ms_get_preemph_mem(st), st->layout.nb_channels); in opus_multistream_encoder_ctl()
1143 OPUS_CLEAR(ms_get_window_mem(st), st->layout.nb_channels*120); in opus_multistream_encoder_ctl()
1145 for (s=0;s<st->layout.nb_streams;s++) in opus_multistream_encoder_ctl()
1149 if (s < st->layout.nb_coupled_streams) in opus_multistream_encoder_ctl()
1171 void opus_multistream_encoder_destroy(OpusMSEncoder *st) in opus_multistream_encoder_destroy() argument
1173 opus_free(st); in opus_multistream_encoder_destroy()