Mercurial > libavcodec.hg
comparison wmadec.c @ 5525:bc4791868c52 libavcodec
various simplifications around recent av_clip_int16() usage
author | aurel |
---|---|
date | Sat, 11 Aug 2007 23:17:03 +0000 |
parents | c2ab2ac31edb |
children | 0f2c4fa2c4f2 |
comparison
equal
deleted
inserted
replaced
5524:f47bc5359101 | 5525:bc4791868c52 |
---|---|
710 } | 710 } |
711 | 711 |
712 /* decode a frame of frame_len samples */ | 712 /* decode a frame of frame_len samples */ |
713 static int wma_decode_frame(WMACodecContext *s, int16_t *samples) | 713 static int wma_decode_frame(WMACodecContext *s, int16_t *samples) |
714 { | 714 { |
715 int ret, i, n, a, ch, incr; | 715 int ret, i, n, ch, incr; |
716 int16_t *ptr; | 716 int16_t *ptr; |
717 float *iptr; | 717 float *iptr; |
718 | 718 |
719 #ifdef TRACE | 719 #ifdef TRACE |
720 tprintf(s->avctx, "***decode_frame: %d size=%d\n", s->frame_count++, s->frame_len); | 720 tprintf(s->avctx, "***decode_frame: %d size=%d\n", s->frame_count++, s->frame_len); |
737 for(ch = 0; ch < s->nb_channels; ch++) { | 737 for(ch = 0; ch < s->nb_channels; ch++) { |
738 ptr = samples + ch; | 738 ptr = samples + ch; |
739 iptr = s->frame_out[ch]; | 739 iptr = s->frame_out[ch]; |
740 | 740 |
741 for(i=0;i<n;i++) { | 741 for(i=0;i<n;i++) { |
742 a = lrintf(*iptr++); | 742 *ptr = av_clip_int16(lrintf(*iptr++)); |
743 a = av_clip_int16(a); | |
744 *ptr = a; | |
745 ptr += incr; | 743 ptr += incr; |
746 } | 744 } |
747 /* prepare for next block */ | 745 /* prepare for next block */ |
748 memmove(&s->frame_out[ch][0], &s->frame_out[ch][s->frame_len], | 746 memmove(&s->frame_out[ch][0], &s->frame_out[ch][s->frame_len], |
749 s->frame_len * sizeof(float)); | 747 s->frame_len * sizeof(float)); |