encode_size() moved out of opus_encoder.c

This commit is contained in:
Jean-Marc Valin 2011-08-23 02:56:12 -04:00
parent 6696a1443b
commit 9f555bc4e7
3 changed files with 17 additions and 12 deletions

View file

@ -30,11 +30,25 @@
#endif
#include "opus.h"
#include "opus_private.h"
#ifndef OPUS_VERSION
#define OPUS_VERSION "unknown"
#endif
int encode_size(int size, unsigned char *data)
{
if (size < 252)
{
data[0] = size;
return 1;
} else {
data[0] = 252+(size&0x3);
data[1] = (size-(int)data[0])>>2;
return 2;
}
}
const char *opus_strerror(int error)
{
static const char *error_strings[8] = {

View file

@ -29,6 +29,8 @@
#ifndef OPUS_PRIVATE_H
#define OPUS_PRIVATE_H
int encode_size(int size, unsigned char *data);
/* Make sure everything's aligned to 4 bytes (this may need to be increased
on really weird architectures) */
static inline int align(int i)

View file

@ -42,18 +42,7 @@ struct OpusRepacketizer {
int framesize;
};
static int encode_size(int size, unsigned char *data)
{
if (size < 252)
{
data[0] = size;
return 1;
} else {
data[0] = 252+(size&0x3);
data[1] = (size-(int)data[0])>>2;
return 2;
}
}
int opus_repacketizer_get_size(void)
{