Commit 9e3a2736 authored by Diego Biurrun's avatar Diego Biurrun

golomb-test: K&R formatting cosmetics

parent 631f96f9
...@@ -27,9 +27,10 @@ ...@@ -27,9 +27,10 @@
#undef printf #undef printf
#define COUNT 8000 #define COUNT 8000
#define SIZE (COUNT*40) #define SIZE (COUNT * 40)
int main(void){ int main(void)
{
int i; int i;
uint8_t temp[SIZE]; uint8_t temp[SIZE];
PutBitContext pb; PutBitContext pb;
...@@ -37,36 +38,32 @@ int main(void){ ...@@ -37,36 +38,32 @@ int main(void){
init_put_bits(&pb, temp, SIZE); init_put_bits(&pb, temp, SIZE);
printf("testing unsigned exp golomb\n"); printf("testing unsigned exp golomb\n");
for(i=0; i<COUNT; i++){ for (i = 0; i < COUNT; i++)
set_ue_golomb(&pb, i); set_ue_golomb(&pb, i);
}
flush_put_bits(&pb); flush_put_bits(&pb);
init_get_bits(&gb, temp, 8*SIZE); init_get_bits(&gb, temp, 8 * SIZE);
for(i=0; i<COUNT; i++){ for (i = 0; i < COUNT; i++) {
int j, s = show_bits(&gb, 24); int j, s = show_bits(&gb, 24);
j= get_ue_golomb(&gb); j = get_ue_golomb(&gb);
if(j != i){ if (j != i)
printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s); printf("mismatch at %d (%d should be %d) bits: %6X\n", i, j, i, s);
}
} }
init_put_bits(&pb, temp, SIZE); init_put_bits(&pb, temp, SIZE);
printf("testing signed exp golomb\n"); printf("testing signed exp golomb\n");
for(i=0; i<COUNT; i++){ for (i = 0; i < COUNT; i++)
set_se_golomb(&pb, i - COUNT/2); set_se_golomb(&pb, i - COUNT / 2);
}
flush_put_bits(&pb); flush_put_bits(&pb);
init_get_bits(&gb, temp, 8*SIZE); init_get_bits(&gb, temp, 8 * SIZE);
for(i=0; i<COUNT; i++){ for (i = 0; i < COUNT; i++) {
int j, s = show_bits(&gb, 24); int j, s = show_bits(&gb, 24);
j= get_se_golomb(&gb); j = get_se_golomb(&gb);
if(j != i - COUNT/2){ if (j != i - COUNT / 2)
printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s); printf("mismatch at %d (%d should be %d) bits: %6X\n", i, j, i, s);
}
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment