Index: /libmpc/branches/r2d/libmpcdec/mpc_bits_reader.c
===================================================================
--- /libmpc/branches/r2d/libmpcdec/mpc_bits_reader.c	(revision 178)
+++ /libmpc/branches/r2d/libmpcdec/mpc_bits_reader.c	(revision 179)
@@ -106,7 +106,8 @@
 { 0, 1, 0, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 31};
 
+// FIXME : make it work without 64 bit use for 32 bit output
 mpc_uint32_t mpc_bits_read(mpc_bits_reader * r, const unsigned int nb_bits)
 {
-	mpc_uint32_t ret = r->buff[0];
+	mpc_uint64_t ret = r->buff[0];
 
 	while(nb_bits > r->count){
@@ -118,5 +119,5 @@
 	r->count -= nb_bits;
 
-	return (ret >> r->count) & (-1u >> (32 - nb_bits));
+	return (mpc_uint32_t)((ret >> r->count) & (-1u >> (32 - nb_bits)));
 }
 
Index: /libmpc/branches/r2d/libmpcdec/mpc_decoder.c
===================================================================
--- /libmpc/branches/r2d/libmpcdec/mpc_decoder.c	(revision 178)
+++ /libmpc/branches/r2d/libmpcdec/mpc_decoder.c	(revision 179)
@@ -516,5 +516,5 @@
 
 	if (is_key_frame == MPC_TRUE) {
-		Max_used_Band = mpc_bits_log_dec(r, d->max_band);
+		Max_used_Band = mpc_bits_log_dec(r, d->max_band + 1);
 	} else {
 		Max_used_Band = d->last_max_band + mpc_bits_huff_dec(r, mpc_table_HuffBands);
@@ -626,4 +626,6 @@
 					}
 					break;
+				case 0:
+					break;
 				case 1:
 					Table = mpc_table_HuffQ_8 [0][0];
@@ -680,5 +682,5 @@
 					}
 					break;
-				case 9: case 10: case 11: case 12: case 13: case 14: case 15:
+				default :
 					for ( ; k < 36; k++ ) {
 						q[k] = mpc_bits_huff_dec(r, mpc_table_HuffQ9up_8);
Index: /libmpc/branches/r2d/libmpcenc/encode_sv7.c
===================================================================
--- /libmpc/branches/r2d/libmpcenc/encode_sv7.c	(revision 178)
+++ /libmpc/branches/r2d/libmpcenc/encode_sv7.c	(revision 179)
@@ -157,5 +157,5 @@
 	n++;
 	if (e->framesInBlock == 0) {
-		encodeLog(e, n, MaxBand);
+		encodeLog(e, n, MaxBand + 1);
 		MaxBand = e->MaxBand = n;
 	} else {
