MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_subframe

Function decode_subframe

libavcodec/wmalosslessdec.c:839–1017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

837}
838
839static int decode_subframe(WmallDecodeCtx *s)
840{
841 int offset = s->samples_per_frame;
842 int subframe_len = s->samples_per_frame;
843 int total_samples = s->samples_per_frame * s->num_channels;
844 int i, j, rawpcm_tile, padding_zeroes, res;
845
846 s->subframe_offset = get_bits_count(&s->gb);
847
848 /* reset channel context and find the next block offset and size
849 == the next block of the channel with the smallest number of
850 decoded samples */
851 for (i = 0; i < s->num_channels; i++) {
852 if (offset > s->channel[i].decoded_samples) {
853 offset = s->channel[i].decoded_samples;
854 subframe_len =
855 s->channel[i].subframe_len[s->channel[i].cur_subframe];
856 }
857 }
858
859 /* get a list of all channels that contain the estimated block */
860 s->channels_for_cur_subframe = 0;
861 for (i = 0; i < s->num_channels; i++) {
862 const int cur_subframe = s->channel[i].cur_subframe;
863 /* subtract already processed samples */
864 total_samples -= s->channel[i].decoded_samples;
865
866 /* and count if there are multiple subframes that match our profile */
867 if (offset == s->channel[i].decoded_samples &&
868 subframe_len == s->channel[i].subframe_len[cur_subframe]) {
869 total_samples -= s->channel[i].subframe_len[cur_subframe];
870 s->channel[i].decoded_samples +=
871 s->channel[i].subframe_len[cur_subframe];
872 s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i;
873 ++s->channels_for_cur_subframe;
874 }
875 }
876
877 /* check if the frame will be complete after processing the
878 estimated block */
879 if (!total_samples)
880 s->parsed_all_subframes = 1;
881
882
883 s->seekable_tile = get_bits1(&s->gb);
884 if (s->seekable_tile) {
885 clear_codec_buffers(s);
886
887 s->do_arith_coding = get_bits1(&s->gb);
888 if (s->do_arith_coding) {
889 avpriv_request_sample(s->avctx, "Arithmetic coding");
890 return AVERROR_PATCHWELCOME;
891 }
892 s->do_ac_filter = get_bits1(&s->gb);
893 s->do_inter_ch_decorr = get_bits1(&s->gb);
894 s->do_mclms = get_bits1(&s->gb);
895
896 if (s->do_ac_filter)

Callers 1

decode_frameFunction · 0.70

Calls 15

get_bits_countFunction · 0.85
get_bits1Function · 0.85
clear_codec_buffersFunction · 0.85
avpriv_request_sampleFunction · 0.85
decode_ac_filterFunction · 0.85
decode_mclmsFunction · 0.85
decode_cdlmsFunction · 0.85
reset_codecFunction · 0.85
av_logFunction · 0.85
av_frame_unrefFunction · 0.85
get_bits_leftFunction · 0.85
get_sbits_longFunction · 0.85

Tested by

no test coverage detected