mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-12 20:47:06 +00:00
Tweaks
This commit is contained in:
1 parent
8cb975f345
commit
887c373c92
7 files changed
+106
-80
No files matched your search
@@ -123,16 +123,6 @@
|
||||
|
||||
#define HDLC_FRAMING_OK_THRESHOLD 8
|
||||
|
||||
static void fax_modems_hdlc_tx_frame(void *user_data, const uint8_t *msg, int len)
|
||||
{
|
||||
fax_modems_state_t *s;
|
||||
|
||||
s = (fax_modems_state_t *) user_data;
|
||||
|
||||
hdlc_tx_frame(&s->hdlc_tx, msg, len);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static void tone_detected(void *user_data, int tone, int level, int delay)
|
||||
{
|
||||
t30_state_t *s;
|
||||
|
||||
@@ -98,6 +98,12 @@ SPAN_DECLARE(int) t42_encode_set_row_read_handler(t42_encode_state_t *s,
|
||||
t4_row_read_handler_t handler,
|
||||
void *user_data);
|
||||
|
||||
/*! Get the logging context associated with a T.42 encode context.
|
||||
\brief Get the logging context associated with a T.42 encode context.
|
||||
\param s The T.42 encode context.
|
||||
\return A pointer to the logging context */
|
||||
SPAN_DECLARE(logging_state_t *) t42_encode_get_logging_state(t42_encode_state_t *s);
|
||||
|
||||
SPAN_DECLARE(int) t42_encode_restart(t42_encode_state_t *s, uint32_t image_width, uint32_t image_length);
|
||||
|
||||
SPAN_DECLARE(t42_encode_state_t *) t42_encode_init(t42_encode_state_t *s,
|
||||
@@ -135,6 +141,12 @@ SPAN_DECLARE(int) t42_decode_get_compressed_image_size(t42_decode_state_t *s);
|
||||
|
||||
SPAN_DECLARE(int) t42_decode_new_plane(t42_decode_state_t *s);
|
||||
|
||||
/*! Get the logging context associated with a T.42 decode context.
|
||||
\brief Get the logging context associated with a T.42 decode context.
|
||||
\param s The T.42 decode context.
|
||||
\return A pointer to the logging context */
|
||||
SPAN_DECLARE(logging_state_t *) t42_decode_get_logging_state(t42_decode_state_t *s);
|
||||
|
||||
SPAN_DECLARE(int) t42_decode_restart(t42_decode_state_t *s);
|
||||
|
||||
SPAN_DECLARE(t42_decode_state_t *) t42_decode_init(t42_decode_state_t *s,
|
||||
|
||||
@@ -74,10 +74,11 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
T4_IMAGE_TYPE_BILEVEL = 0,
|
||||
T4_IMAGE_TYPE_GRAY_8BIT = 1,
|
||||
T4_IMAGE_TYPE_GRAY_12BIT = 2,
|
||||
T4_IMAGE_TYPE_COLOUR_8BIT = 3,
|
||||
T4_IMAGE_TYPE_COLOUR_12BIT = 4
|
||||
T4_IMAGE_TYPE_COLOUR_BILEVEL = 1,
|
||||
T4_IMAGE_TYPE_GRAY_8BIT = 2,
|
||||
T4_IMAGE_TYPE_GRAY_12BIT = 3,
|
||||
T4_IMAGE_TYPE_COLOUR_8BIT = 4,
|
||||
T4_IMAGE_TYPE_COLOUR_12BIT = 5
|
||||
} t4_image_types_t;
|
||||
|
||||
/*! Supported X resolutions, in pixels per metre. */
|
||||
|
||||
+26
-16
@@ -396,16 +396,16 @@ SPAN_DECLARE(void) srgb_to_lab(lab_params_t *s, uint8_t lab[], const uint8_t srg
|
||||
cielab_t l;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pixels; i++)
|
||||
for (i = 0; i < 3*pixels; i += 3)
|
||||
{
|
||||
#if defined(T42_USE_LUTS)
|
||||
r = srgb_to_linear[srgb[0]];
|
||||
g = srgb_to_linear[srgb[1]];
|
||||
b = srgb_to_linear[srgb[2]];
|
||||
r = srgb_to_linear[srgb[i]];
|
||||
g = srgb_to_linear[srgb[i + 1]];
|
||||
b = srgb_to_linear[srgb[i + 2]];
|
||||
#else
|
||||
r = srgb[0]/256.0f;
|
||||
g = srgb[1]/256.0f;
|
||||
b = srgb[2]/256.0f;
|
||||
r = srgb[i]/256.0f;
|
||||
g = srgb[i + 1]/256.0f;
|
||||
b = srgb[i + 2]/256.0f;
|
||||
|
||||
/* sRGB to linear RGB */
|
||||
r = (r > 0.04045f) ? powf((r + 0.055f)/1.055f, 2.4f) : r/12.92f;
|
||||
@@ -433,7 +433,6 @@ SPAN_DECLARE(void) srgb_to_lab(lab_params_t *s, uint8_t lab[], const uint8_t srg
|
||||
|
||||
lab_to_itu(s, lab, &l);
|
||||
|
||||
srgb += 3;
|
||||
lab += 3;
|
||||
}
|
||||
}
|
||||
@@ -452,7 +451,7 @@ SPAN_DECLARE(void) lab_to_srgb(lab_params_t *s, uint8_t srgb[], const uint8_t la
|
||||
int val;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pixels; i++)
|
||||
for (i = 0; i < 3*pixels; i += 3)
|
||||
{
|
||||
itu_to_lab(s, &l, lab);
|
||||
|
||||
@@ -477,22 +476,21 @@ SPAN_DECLARE(void) lab_to_srgb(lab_params_t *s, uint8_t srgb[], const uint8_t la
|
||||
|
||||
#if defined(T42_USE_LUTS)
|
||||
val = r*4096.0f;
|
||||
srgb[0] = linear_to_srgb[(val < 0) ? 0 : (val < 4095) ? val : 4095];
|
||||
srgb[i] = linear_to_srgb[(val < 0) ? 0 : (val < 4095) ? val : 4095];
|
||||
val = g*4096.0f;
|
||||
srgb[1] = linear_to_srgb[(val < 0) ? 0 : (val < 4095) ? val : 4095];
|
||||
srgb[i + 1] = linear_to_srgb[(val < 0) ? 0 : (val < 4095) ? val : 4095];
|
||||
val = b*4096.0f;
|
||||
srgb[2] = linear_to_srgb[(val < 0) ? 0 : (val < 4095) ? val : 4095];
|
||||
srgb[i + 2] = linear_to_srgb[(val < 0) ? 0 : (val < 4095) ? val : 4095];
|
||||
#else
|
||||
/* Linear RGB to sRGB */
|
||||
r = (r > 0.0031308f) ? (1.055f*powf(r, 1.0f/2.4f) - 0.055f) : r*12.92f;
|
||||
g = (g > 0.0031308f) ? (1.055f*powf(g, 1.0f/2.4f) - 0.055f) : g*12.92f;
|
||||
b = (b > 0.0031308f) ? (1.055f*powf(b, 1.0f/2.4f) - 0.055f) : b*12.92f;
|
||||
|
||||
srgb[0] = saturateu8(floorf(r*256.0f));
|
||||
srgb[1] = saturateu8(floorf(g*256.0f));
|
||||
srgb[2] = saturateu8(floorf(b*256.0f));
|
||||
srgb[i] = saturateu8(floorf(r*256.0f));
|
||||
srgb[i + 1] = saturateu8(floorf(g*256.0f));
|
||||
srgb[i + 2] = saturateu8(floorf(b*256.0f));
|
||||
#endif
|
||||
srgb += 3;
|
||||
lab += 3;
|
||||
}
|
||||
}
|
||||
@@ -1233,6 +1231,12 @@ SPAN_DECLARE(int) t42_encode_set_row_read_handler(t42_encode_state_t *s,
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(logging_state_t *) t42_encode_get_logging_state(t42_encode_state_t *s)
|
||||
{
|
||||
return &s->logging;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) t42_encode_restart(t42_encode_state_t *s, uint32_t image_width, uint32_t image_length)
|
||||
{
|
||||
//s->image_width = image_width;
|
||||
@@ -1357,6 +1361,12 @@ SPAN_DECLARE(int) t42_decode_new_plane(t42_decode_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(logging_state_t *) t42_decode_get_logging_state(t42_decode_state_t *s)
|
||||
{
|
||||
return &s->logging;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) t42_decode_restart(t42_decode_state_t *s)
|
||||
{
|
||||
s->compressed_image_size = 0;
|
||||
|
||||
+23
-13
@@ -170,6 +170,16 @@ static int get_tiff_directory_info(t4_tx_state_t *s)
|
||||
{1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200},
|
||||
{ -1.00f, -1}
|
||||
};
|
||||
static const char *tiff_fx_fax_profiles[] =
|
||||
{
|
||||
"???",
|
||||
"profile S",
|
||||
"profile F",
|
||||
"profile J",
|
||||
"profile C",
|
||||
"profile L",
|
||||
"profile M"
|
||||
};
|
||||
uint16_t res_unit;
|
||||
uint8_t parm8;
|
||||
uint16_t parm16;
|
||||
@@ -184,14 +194,14 @@ static int get_tiff_directory_info(t4_tx_state_t *s)
|
||||
uint16_t samples_per_pixel;
|
||||
|
||||
t = &s->tiff;
|
||||
parm16 = 0;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16);
|
||||
bits_per_sample = parm16;
|
||||
parm16 = 0;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, &parm16);
|
||||
samples_per_pixel = parm16;
|
||||
bits_per_sample = 1;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &bits_per_sample);
|
||||
samples_per_pixel = 1;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel);
|
||||
if (samples_per_pixel == 1 && bits_per_sample == 1)
|
||||
t->image_type = T4_IMAGE_TYPE_BILEVEL;
|
||||
else if (samples_per_pixel == 3 && bits_per_sample == 1)
|
||||
t->image_type = T4_IMAGE_TYPE_COLOUR_BILEVEL;
|
||||
else if (samples_per_pixel == 1 && bits_per_sample == 8)
|
||||
t->image_type = T4_IMAGE_TYPE_GRAY_8BIT;
|
||||
else if (samples_per_pixel == 1 && bits_per_sample > 8)
|
||||
@@ -260,19 +270,19 @@ static int get_tiff_directory_info(t4_tx_state_t *s)
|
||||
}
|
||||
#if defined(SPANDSP_SUPPORT_TIFF_FX)
|
||||
if (TIFFGetField(t->tiff_file, TIFFTAG_PROFILETYPE, &parm32))
|
||||
printf("Profile type %u\n", parm32);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Profile type %u\n", parm32);
|
||||
if (TIFFGetField(t->tiff_file, TIFFTAG_FAXPROFILE, &parm8))
|
||||
printf("FAX profile %u\n", parm8);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "FAX profile %s (%u)\n", tiff_fx_fax_profiles[parm8], parm8);
|
||||
if (TIFFGetField(t->tiff_file, TIFFTAG_CODINGMETHODS, &parm32))
|
||||
printf("Coding methods 0x%x\n", parm32);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Coding methods 0x%x\n", parm32);
|
||||
if (TIFFGetField(t->tiff_file, TIFFTAG_VERSIONYEAR, &u))
|
||||
{
|
||||
memcpy(uu, u, 4);
|
||||
uu[4] = '\0';
|
||||
printf("Version year \"%s\"\n", uu);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Version year \"%s\"\n", uu);
|
||||
}
|
||||
if (TIFFGetField(t->tiff_file, TIFFTAG_MODENUMBER, &parm8))
|
||||
printf("Mode number %u\n", parm8);
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Mode number %u\n", parm8);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -319,11 +329,11 @@ static int test_tiff_directory_info(t4_tx_state_t *s)
|
||||
t4_tx_tiff_state_t *t;
|
||||
|
||||
t = &s->tiff;
|
||||
parm16 = 0;
|
||||
parm16 = 1;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16);
|
||||
if (parm16 != 1)
|
||||
return -1;
|
||||
parm16 = 0;
|
||||
parm16 = 1;
|
||||
TIFFGetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, &parm16);
|
||||
if (parm16 != 1)
|
||||
return -1;
|
||||
|
||||
Reference in new issue
Block a user