Ignore:
Timestamp:
06/27/07 20:00:25 (17 years ago)
Author:
r2d
Message:

make aligned swaping in buffer (alignement on buffer start, there is no alignement check in any struct, it may be needed)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/trunk/libmpcdec/mpc_demux.c

    r314 r337  
    7070        mpc_uint32_t unread_bytes = d->bytes_total + d->buffer - d->bits_reader.buff
    7171                        - ((8 - d->bits_reader.count) >> 3);
     72        int offset = 0;
    7273
    7374        if (min_bytes == 0 || min_bytes > DEMUX_BUFFER_SIZE ||
     
    7980                mpc_uint32_t bytes_free = DEMUX_BUFFER_SIZE - d->bytes_total;
    8081
    81                 if (flags & MPC_BUFFER_SWAP)
     82                if (flags & MPC_BUFFER_SWAP) {
    8283                        bytes2read &= -1 << 2;
     84                        offset = (unread_bytes + 3) & ( -1 << 2);
     85                        offset -= unread_bytes;
     86                }
    8387
    8488                if (bytes2read > bytes_free) {
     
    8791                                d->bits_reader.buff++;
    8892                        }
    89                         memmove(d->buffer, d->bits_reader.buff, unread_bytes);
    90                         d->bits_reader.buff = d->buffer;
    91                         d->bytes_total = unread_bytes;
     93                        memmove(d->buffer + offset, d->bits_reader.buff, unread_bytes);
     94                        d->bits_reader.buff = d->buffer + offset;
     95                        d->bytes_total = unread_bytes + offset;
    9296                }
    9397                bytes2read = d->r->read(d->r, d->buffer + d->bytes_total, bytes2read);
Note: See TracChangeset for help on using the changeset viewer.