| 753 | } |
| 754 | |
| 755 | static int MPA_encode_frame(AVCodecContext *avctx, |
| 756 | unsigned char *frame, int buf_size, void *data) |
| 757 | { |
| 758 | MpegAudioContext *s = avctx->priv_data; |
| 759 | short *samples = data; |
| 760 | short smr[MPA_MAX_CHANNELS][SBLIMIT]; |
| 761 | unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT]; |
| 762 | int padding, i; |
| 763 | |
| 764 | for(i=0;i<s->nb_channels;i++) { |
| 765 | filter(s, i, samples + i, s->nb_channels); |
| 766 | } |
| 767 | |
| 768 | for(i=0;i<s->nb_channels;i++) { |
| 769 | compute_scale_factors(s->scale_code[i], s->scale_factors[i], |
| 770 | s->sb_samples[i], s->sblimit); |
| 771 | } |
| 772 | for(i=0;i<s->nb_channels;i++) { |
| 773 | psycho_acoustic_model(s, smr[i]); |
| 774 | } |
| 775 | compute_bit_allocation(s, smr, bit_alloc, &padding); |
| 776 | |
| 777 | init_put_bits(&s->pb, frame, MPA_MAX_CODED_FRAME_SIZE); |
| 778 | |
| 779 | encode_frame(s, bit_alloc, padding); |
| 780 | |
| 781 | s->nb_samples += MPA_FRAME_SIZE; |
| 782 | return put_bits_ptr(&s->pb) - s->pb.buf; |
| 783 | } |
| 784 | |
| 785 | static av_cold int MPA_encode_close(AVCodecContext *avctx) |
| 786 | { |
nothing calls this directly
no test coverage detected