Mercurial > libavcodec.hg
comparison mlpdec.c @ 7553:b5f8d814a206 libavcodec
mlpdec: whitespace and line-breaking cosmetics.
author | ramiro |
---|---|
date | Tue, 12 Aug 2008 18:05:58 +0000 |
parents | 88ffd7c9c0ed |
children | 8d00a2dfcb7a |
comparison
equal
deleted
inserted
replaced
7552:88ffd7c9c0ed | 7553:b5f8d814a206 |
---|---|
582 fchar); | 582 fchar); |
583 return -1; | 583 return -1; |
584 } | 584 } |
585 | 585 |
586 for (i = 0; i < order; i++) | 586 for (i = 0; i < order; i++) |
587 fp->coeff[i] = | 587 fp->coeff[i] = get_sbits(gbp, coeff_bits) << coeff_shift; |
588 get_sbits(gbp, coeff_bits) << coeff_shift; | |
589 | 588 |
590 if (get_bits1(gbp)) { | 589 if (get_bits1(gbp)) { |
591 int state_bits, state_shift; | 590 int state_bits, state_shift; |
592 | 591 |
593 if (filter == FIR) { | 592 if (filter == FIR) { |
600 state_shift = get_bits(gbp, 4); | 599 state_shift = get_bits(gbp, 4); |
601 | 600 |
602 /* TODO: Check validity of state data. */ | 601 /* TODO: Check validity of state data. */ |
603 | 602 |
604 for (i = 0; i < order; i++) | 603 for (i = 0; i < order; i++) |
605 fp->state[i] = | 604 fp->state[i] = get_sbits(gbp, state_bits) << state_shift; |
606 get_sbits(gbp, state_bits) << state_shift; | |
607 } | 605 } |
608 } | 606 } |
609 | 607 |
610 return 0; | 608 return 0; |
611 } | 609 } |
751 int32_t mask = MSB_MASK(s->quant_step_size[channel]); | 749 int32_t mask = MSB_MASK(s->quant_step_size[channel]); |
752 int index = MAX_BLOCKSIZE; | 750 int index = MAX_BLOCKSIZE; |
753 int j, i; | 751 int j, i; |
754 | 752 |
755 for (j = 0; j < NUM_FILTERS; j++) { | 753 for (j = 0; j < NUM_FILTERS; j++) { |
756 memcpy(& filter_state_buffer [j][MAX_BLOCKSIZE], | 754 memcpy(&filter_state_buffer[j][MAX_BLOCKSIZE], &fp[j]->state[0], |
757 &fp[j]->state[0], | |
758 MAX_FILTER_ORDER * sizeof(int32_t)); | 755 MAX_FILTER_ORDER * sizeof(int32_t)); |
759 } | 756 } |
760 | 757 |
761 for (i = 0; i < s->blocksize; i++) { | 758 for (i = 0; i < s->blocksize; i++) { |
762 int32_t residual = m->sample_buffer[i + s->blockpos][channel]; | 759 int32_t residual = m->sample_buffer[i + s->blockpos][channel]; |
767 /* TODO: Move this code to DSPContext? */ | 764 /* TODO: Move this code to DSPContext? */ |
768 | 765 |
769 for (j = 0; j < NUM_FILTERS; j++) | 766 for (j = 0; j < NUM_FILTERS; j++) |
770 for (order = 0; order < fp[j]->order; order++) | 767 for (order = 0; order < fp[j]->order; order++) |
771 accum += (int64_t)filter_state_buffer[j][index + order] * | 768 accum += (int64_t)filter_state_buffer[j][index + order] * |
772 fp[j]->coeff[order]; | 769 fp[j]->coeff[order]; |
773 | 770 |
774 accum = accum >> filter_shift; | 771 accum = accum >> filter_shift; |
775 result = (accum + residual) & mask; | 772 result = (accum + residual) & mask; |
776 | 773 |
777 --index; | 774 --index; |
781 | 778 |
782 m->sample_buffer[i + s->blockpos][channel] = result; | 779 m->sample_buffer[i + s->blockpos][channel] = result; |
783 } | 780 } |
784 | 781 |
785 for (j = 0; j < NUM_FILTERS; j++) { | 782 for (j = 0; j < NUM_FILTERS; j++) { |
786 memcpy(&fp[j]->state[0], | 783 memcpy(&fp[j]->state[0], &filter_state_buffer[j][index], |
787 & filter_state_buffer [j][index], | |
788 MAX_FILTER_ORDER * sizeof(int32_t)); | 784 MAX_FILTER_ORDER * sizeof(int32_t)); |
789 } | 785 } |
790 } | 786 } |
791 | 787 |
792 /** Read a block of PCM residual data (or actual if no filtering active). */ | 788 /** Read a block of PCM residual data (or actual if no filtering active). */ |