Skip to content
Snippets Groups Projects
Commit 9f555bc4 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

encode_size() moved out of opus_encoder.c

parent 6696a144
No related branches found
No related tags found
No related merge requests found
......@@ -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] = {
......
......@@ -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)
......
......@@ -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)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment