Commit 322f10ed authored by smorlat's avatar smorlat

- add missing "static" declarators and move MakeTables to the encoder.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@715 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent a2391910
This diff is collapsed.
......@@ -459,65 +459,6 @@ static uint8_t *get_psc(uint8_t *begin,uint8_t *end, int packet_size){
return ret;
}
/*
* Table K.1 from JPEG spec.
*/
static const int jpeg_luma_quantizer[64] = {
16, 11, 10, 16, 24, 40, 51, 61,
12, 12, 14, 19, 26, 58, 60, 55,
14, 13, 16, 24, 40, 57, 69, 56,
14, 17, 22, 29, 51, 87, 80, 62,
18, 22, 37, 56, 68, 109, 103, 77,
24, 35, 55, 64, 81, 104, 113, 92,
49, 64, 78, 87, 103, 121, 120, 101,
72, 92, 95, 98, 112, 100, 103, 99
};
/*
* Table K.2 from JPEG spec.
*/
static const int jpeg_chroma_quantizer[64] = {
17, 18, 24, 47, 99, 99, 99, 99,
18, 21, 26, 66, 99, 99, 99, 99,
24, 26, 56, 99, 99, 99, 99, 99,
47, 66, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99
};
/*
* Call MakeTables with the Q factor and two u_char[64] return arrays
*/
void
MakeTables(int q, u_char *lqt, u_char *cqt)
{
int i;
int factor = q;
if (q < 1) factor = 1;
if (q > 99) factor = 99;
if (q < 50)
q = 5000 / factor;
else
q = 200 - factor*2;
for (i=0; i < 64; i++) {
int lq = (jpeg_luma_quantizer[i] * q + 50) / 100;
int cq = (jpeg_chroma_quantizer[i] * q + 50) / 100;
/* Limit the quantizers to 1 <= q <= 255 */
if (lq < 1) lq = 1;
else if (lq > 255) lq = 255;
lqt[i] = lq;
if (cq < 1) cq = 1;
else if (cq > 255) cq = 255;
cqt[i] = cq;
}
}
struct jpeghdr {
//unsigned int tspec:8; /* type-specific field */
......@@ -576,7 +517,7 @@ struct jpeghdr_qtable {
* send_packet(u_int8 *data, int len) - Sends the packet to the network
*/
void mjpeg_fragment_and_send(MSFilter *f,EncState *s,mblk_t *frame, uint32_t timestamp,
static void mjpeg_fragment_and_send(MSFilter *f,EncState *s,mblk_t *frame, uint32_t timestamp,
uint8_t type, uint8_t typespec, int dri,
uint8_t q, mblk_t *lqt, mblk_t *cqt) {
struct jpeghdr jpghdr;
......@@ -658,25 +599,25 @@ void mjpeg_fragment_and_send(MSFilter *f,EncState *s,mblk_t *frame, uint32_t tim
static int find_marker(uint8_t **pbuf_ptr, uint8_t *buf_end){
uint8_t *buf_ptr;
unsigned int v, v2;
int val;
buf_ptr = *pbuf_ptr;
while (buf_ptr < buf_end) {
v = *buf_ptr++;
v2 = *buf_ptr;
if ((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe) && buf_ptr < buf_end) {
val = *buf_ptr++;
*pbuf_ptr = buf_ptr;
return val;
}
}
val = -1;
uint8_t *buf_ptr;
unsigned int v, v2;
int val;
buf_ptr = *pbuf_ptr;
while (buf_ptr < buf_end) {
v = *buf_ptr++;
v2 = *buf_ptr;
if ((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe) && buf_ptr < buf_end) {
val = *buf_ptr++;
*pbuf_ptr = buf_ptr;
return val;
}
}
val = -1;
return val;
}
mblk_t *skip_jpeg_headers(mblk_t *full_frame, mblk_t **lqt, mblk_t **cqt){
static mblk_t *skip_jpeg_headers(mblk_t *full_frame, mblk_t **lqt, mblk_t **cqt){
int err;
uint8_t *pbuf_ptr=full_frame->b_rptr;
uint8_t *buf_end=full_frame->b_wptr;
......
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