Home | History | Annotate | Download | only in src

Lines Matching defs:st

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