[FFmpeg-soc] [soc]: r2585 - mlp/mlpdec.c
ramiro
subversion at mplayerhq.hu
Sat Jun 28 13:56:36 CEST 2008
Author: ramiro
Date: Sat Jun 28 13:56:35 2008
New Revision: 2585
Log:
Use a macro to calculate parity over 2 bytes.
Modified:
mlp/mlpdec.c
Modified: mlp/mlpdec.c
==============================================================================
--- mlp/mlpdec.c (original)
+++ mlp/mlpdec.c Sat Jun 28 13:56:35 2008
@@ -965,6 +965,12 @@ static uint8_t calculate_parity(const ui
return scratch;
}
+#define PARITY_2BYTES do { \
+ parity_bits ^= *buf++; \
+ parity_bits ^= *buf++; \
+ header_size += 2; \
+ } while(0)
+
/**
* Read an access unit from the stream.
* Returns -1 on error, 0 if not enough data is present in the input stream
@@ -978,11 +984,10 @@ static int read_access_unit(AVCodecConte
GetBitContext gb;
unsigned int length, substr;
unsigned int substream_start;
- unsigned int header_size = 4;
+ unsigned int header_size = 0;
uint8_t substream_parity_present[MAX_SUBSTREAMS];
uint16_t substream_data_len[MAX_SUBSTREAMS];
uint8_t parity_bits = 0;
- int i;
if (buf_size < 4)
return 0;
@@ -992,8 +997,8 @@ static int read_access_unit(AVCodecConte
if (length > buf_size)
return -1;
- for(i = 0; i < 4; i++)
- parity_bits ^= *buf++;
+ PARITY_2BYTES;
+ PARITY_2BYTES;
init_get_bits(&gb, buf, (length - 4) * 8);
@@ -1024,15 +1029,11 @@ static int read_access_unit(AVCodecConte
end = get_bits(&gb, 12) * 2;
- parity_bits ^= *buf++;
- parity_bits ^= *buf++;
- header_size += 2;
+ PARITY_2BYTES;
if (extraword_present) {
skip_bits(&gb, 16);
- parity_bits ^= *buf++;
- parity_bits ^= *buf++;
- header_size += 2;
+ PARITY_2BYTES;
}
if (end + header_size > length) {
More information about the FFmpeg-soc
mailing list