Revision 15ae1959 libavcodec/atrac3.c

View differences:

libavcodec/atrac3.c
778 778
 * @param databuf       the input data
779 779
 */
780 780

  
781
static int decodeFrame(ATRAC3Context *q, uint8_t* databuf)
781
static int decodeFrame(ATRAC3Context *q, const uint8_t* databuf)
782 782
{
783 783
    int   result, i;
784 784
    float   *p1, *p2, *p3, *p4;
785
    uint8_t    *ptr1, *ptr2;
785
    uint8_t *ptr1;
786 786

  
787 787
    if (q->codingMode == JOINT_STEREO) {
788 788

  
......
796 796

  
797 797
        /* Framedata of the su2 in the joint-stereo mode is encoded in
798 798
         * reverse byte order so we need to swap it first. */
799
        ptr1 = databuf;
800
        ptr2 = databuf+q->bytes_per_frame-1;
799
        if (databuf == q->decoded_bytes_buffer) {
800
            uint8_t *ptr2 = q->decoded_bytes_buffer+q->bytes_per_frame-1;
801
            ptr1 = q->decoded_bytes_buffer;
801 802
        for (i = 0; i < (q->bytes_per_frame/2); i++, ptr1++, ptr2--) {
802 803
            FFSWAP(uint8_t,*ptr1,*ptr2);
803 804
        }
805
        } else {
806
            const uint8_t *ptr2 = databuf+q->bytes_per_frame-1;
807
            for (i = 0; i < q->bytes_per_frame; i++)
808
                q->decoded_bytes_buffer[i] = *ptr2--;
809
        }
804 810

  
805 811
        /* Skip the sync codes (0xF8). */
806
        ptr1 = databuf;
812
        ptr1 = q->decoded_bytes_buffer;
807 813
        for (i = 4; *ptr1 == 0xF8; i++, ptr1++) {
808 814
            if (i >= q->bytes_per_frame)
809 815
                return -1;
......
875 881
            const uint8_t *buf, int buf_size) {
876 882
    ATRAC3Context *q = avctx->priv_data;
877 883
    int result = 0, i;
878
    uint8_t* databuf;
884
    const uint8_t* databuf;
879 885
    int16_t* samples = data;
880 886

  
881 887
    if (buf_size < avctx->block_align)

Also available in: Unified diff