* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
*/
/**
#include <string.h>
#include "avcodec.h"
-#include "common.h"
#include "rangecoder.h"
+#include "bytestream.h"
void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size){
/* cast to avoid compiler warning */
ff_init_range_encoder(c, (uint8_t *) buf, buf_size);
- c->low =(*c->bytestream++)<<8;
- c->low+= *c->bytestream++;
+ c->low = bytestream_get_be16(&c->bytestream);
}
void ff_build_rac_states(RangeCoder *c, int factor, int max_p){
return c->bytestream - c->bytestream_start;
}
-#if 0 //selftest
+#ifdef TEST
#define SIZE 10240
-int main(){
+#undef random
+int main(void){
RangeCoder c;
uint8_t b[9*SIZE];
uint8_t r[9*SIZE];
STOP_TIMER("put_rac")
}
- ff_put_rac_terminate(&c);
+ ff_rac_terminate(&c);
ff_init_range_decoder(&c, b, SIZE);
return 0;
}
-#endif
+#endif /* TEST */