提交 b5f74435 authored 作者: Steve Underwood's avatar Steve Underwood

Started introducing T.42 JPEG support for FAXing, but its not plumbed into the

FAX engine yet.
上级 9fe08675
......@@ -143,10 +143,6 @@ libspandsp_la_SOURCES = ademco_contactid.c \
super_tone_rx.c \
super_tone_tx.c \
swept_tone.c \
t4_t6_decode.c \
t4_t6_encode.c \
t4_rx.c \
t4_tx.c \
t30.c \
t30_api.c \
t30_logging.c \
......@@ -156,6 +152,11 @@ libspandsp_la_SOURCES = ademco_contactid.c \
t38_gateway.c \
t38_non_ecm_buffer.c \
t38_terminal.c \
t4_t6_decode.c \
t4_t6_encode.c \
t4_rx.c \
t4_tx.c \
t42.c \
t81_t82_arith_coding.c \
t85_decode.c \
t85_encode.c \
......@@ -246,6 +247,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/t4_tx.h \
spandsp/t4_t6_decode.h \
spandsp/t4_t6_encode.h \
spandsp/t42.h \
spandsp/t81_t82_arith_coding.h \
spandsp/t85.h \
spandsp/telephony.h \
......@@ -312,6 +314,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/private/t4_tx.h \
spandsp/private/t4_t6_decode.h \
spandsp/private/t4_t6_encode.h \
spandsp/private/t42.h \
spandsp/private/t81_t82_arith_coding.h \
spandsp/private/t85.h \
spandsp/private/time_scale.h \
......
......@@ -109,7 +109,7 @@
#include <spandsp/t4_t6_encode.h>
#include <spandsp/t81_t82_arith_coding.h>
#include <spandsp/t85.h>
/*#include <spandsp/t42.h>*/
#include <spandsp/t42.h>
/*#include <spandsp/t43.h>*/
#include <spandsp/t30.h>
#include <spandsp/t30_api.h>
......
......@@ -80,7 +80,7 @@
#include <spandsp/private/t4_t6_encode.h>
#include <spandsp/private/t81_t82_arith_coding.h>
#include <spandsp/private/t85.h>
/*#include <spandsp/private/t42.h>*/
#include <spandsp/private/t42.h>
/*#include <spandsp/private/t43.h>*/
#include <spandsp/private/t4_rx.h>
#include <spandsp/private/t4_tx.h>
......
/*
* SpanDSP - a series of DSP components for telephony
*
* private/t42.h - ITU T.42 JPEG for FAX image processing
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2011 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(_SPANDSP_PRIVATE_T42_H_)
#define _SPANDSP_PRIVATE_T42_H_
struct lab_params_s
{
/* Lab gamut */
float range_L;
float range_a;
float range_b;
float offset_L;
float offset_a;
float offset_b;
int ab_are_signed;
/* Illuminant */
float x_n;
float y_n;
float z_n;
};
/* State of a working instance of the T.42 JPEG FAX encoder */
struct t42_encode_state_s
{
/*! \brief Callback function to read a row of pixels from the image source. */
t4_row_read_handler_t row_read_handler;
/*! \brief Opaque pointer passed to row_read_handler. */
void *row_read_user_data;
lab_params_t lab_params;
/*! \brief Error and flow logging control */
logging_state_t logging;
};
/* State of a working instance of the T.42 JPEG FAX decoder */
struct t42_decode_state_s
{
/*! A callback routine to handle decoded pixel rows */
t4_row_write_handler_t row_write_handler;
/*! An opaque pointer passed to row_write_handler() */
void *row_write_user_data;
/*! A callback routine to handle decoded comments */
t4_row_write_handler_t comment_handler;
/*! An opaque pointer passed to comment_handler() */
void *comment_user_data;
lab_params_t lab_params;
/*! The contents for a COMMENT marker segment, to be added to the
image at the next opportunity. This is set to NULL when nothing is
pending. */
uint8_t *comment;
/*! Length of data pointed to by comment */
size_t comment_len;
/*! \brief Error and flow logging control */
logging_state_t logging;
};
#endif
/*- End of file ------------------------------------------------------------*/
/*
* SpanDSP - a series of DSP components for telephony
*
* t42.h - ITU T.42 JPEG for FAX image processing
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2011 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if !defined(_SPANDSP_T42_H_)
#define _SPANDSP_T42_H_
/*! \page t42_page T.42 (JPEG for FAX) image compression and decompression
\section t42_page_sec_1 What does it do?
\section t42_page_sec_1 How does it work?
*/
/*! State of a working instance of the T.42 encoder */
typedef struct t42_encode_state_s t42_encode_state_t;
/*! State of a working instance of the T.42 decoder */
typedef struct t42_decode_state_s t42_decode_state_t;
typedef struct lab_params_s lab_params_t;
#if defined(__cplusplus)
extern "C"
{
#endif
SPAN_DECLARE(void) srgb_to_lab(lab_params_t *s, uint8_t lab[], const uint8_t srgb[], int pixels);
SPAN_DECLARE(void) lab_to_srgb(lab_params_t *s, uint8_t srgb[], const uint8_t lab[], int pixels);
SPAN_DECLARE(void) set_lab_illuminant(lab_params_t *s, float new_xn, float new_yn, float new_zn);
SPAN_DECLARE(void) set_lab_gamut(lab_params_t *s, int L_min, int L_max, int a_min, int a_max, int b_min, int b_max, int ab_are_signed);
SPAN_DECLARE(void) set_lab_gamut2(lab_params_t *s, int L_P, int L_Q, int a_P, int a_Q, int b_P, int b_Q);
SPAN_DECLARE(void) set_illuminant_from_code(lab_params_t *s, const uint8_t code[4]);
SPAN_DECLARE(void) set_gamut_from_code(lab_params_t *s, const uint8_t code[12]);
SPAN_DECLARE(int) t42_itulab_to_itulab(tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes);
SPAN_DECLARE(int) t42_itulab_to_jpeg(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes);
SPAN_DECLARE(int) t42_jpeg_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes);
SPAN_DECLARE(int) t42_srgb_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes);
SPAN_DECLARE(int) t42_itulab_to_srgb(lab_params_t *s, tdata_t dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t *width, uint32_t *height, char *emsg, size_t max_emsg_bytes);
SPAN_DECLARE(void) t42_encode_set_options(t42_encode_state_t *s,
uint32_t l0,
int mx,
int options);
SPAN_DECLARE(int) t42_encode_set_image_width(t42_encode_state_t *s, uint32_t image_width);
SPAN_DECLARE(int) t42_encode_set_image_length(t42_encode_state_t *s, uint32_t length);
SPAN_DECLARE(void) t42_encode_abort(t42_encode_state_t *s);
SPAN_DECLARE(void) t42_encode_comment(t42_encode_state_t *s, const uint8_t comment[], size_t len);
SPAN_DECLARE(int) t42_encode_get_byte(t42_encode_state_t *s);
SPAN_DECLARE(int) t42_encode_get_chunk(t42_encode_state_t *s, uint8_t buf[], int max_len);
SPAN_DECLARE(uint32_t) t42_encode_get_image_width(t42_encode_state_t *s);
SPAN_DECLARE(uint32_t) t42_encode_get_image_length(t42_encode_state_t *s);
SPAN_DECLARE(int) t42_encode_get_compressed_image_size(t42_encode_state_t *s);
SPAN_DECLARE(int) t42_encode_set_row_read_handler(t42_encode_state_t *s,
t4_row_read_handler_t handler,
void *user_data);
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,
uint32_t image_width,
uint32_t image_length,
t4_row_read_handler_t handler,
void *user_data);
SPAN_DECLARE(int) t42_encode_release(t42_encode_state_t *s);
SPAN_DECLARE(int) t42_encode_free(t42_encode_state_t *s);
SPAN_DECLARE(void) t42_decode_rx_status(t42_decode_state_t *s, int status);
SPAN_DECLARE(int) t42_decode_put_byte(t42_decode_state_t *s, int byte);
SPAN_DECLARE(int) t42_decode_put_chunk(t42_decode_state_t *s,
const uint8_t data[],
size_t len);
SPAN_DECLARE(int) t42_decode_set_row_write_handler(t42_decode_state_t *s,
t4_row_write_handler_t handler,
void *user_data);
SPAN_DECLARE(int) t42_decode_set_comment_handler(t42_decode_state_t *s,
uint32_t max_comment_len,
t4_row_write_handler_t handler,
void *user_data);
SPAN_DECLARE(int) t42_decode_set_image_size_constraints(t42_decode_state_t *s,
uint32_t max_xd,
uint32_t max_yd);
SPAN_DECLARE(uint32_t) t42_decode_get_image_width(t42_decode_state_t *s);
SPAN_DECLARE(uint32_t) t42_decode_get_image_length(t42_decode_state_t *s);
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);
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,
t4_row_write_handler_t handler,
void *user_data);
SPAN_DECLARE(int) t42_decode_release(t42_decode_state_t *s);
SPAN_DECLARE(int) t42_decode_free(t42_decode_state_t *s);
#if defined(__cplusplus)
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/
差异被折叠。
......@@ -110,6 +110,7 @@ noinst_PROGRAMS = ademco_contactid_tests \
t38_non_ecm_buffer_tests \
t4_tests \
t4_t6_tests \
t42_tests \
t81_t82_arith_coding_tests \
t85_tests \
time_scale_tests \
......@@ -317,6 +318,9 @@ t4_tests_LDADD = $(LIBDIR) -lspandsp
t4_t6_tests_SOURCES = t4_t6_tests.c
t4_t6_tests_LDADD = $(LIBDIR) -lspandsp
t42_tests_SOURCES = t42_tests.c
t42_tests_LDADD = $(LIBDIR) -lspandsp
t81_t82_arith_coding_tests_SOURCES = t81_t82_arith_coding_tests.c
t81_t82_arith_coding_tests_LDADD = $(LIBDIR) -lspandsp
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论