spandsp  0.0.6
image_translate.h
Go to the documentation of this file.
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * image_translate.h - Image translation routines for reworking colour
5  * and gray scale images to be bi-level images of an
6  * appropriate size to be FAX compatible.
7  *
8  * Written by Steve Underwood <steveu@coppice.org>
9  *
10  * Copyright (C) 2009 Steve Underwood
11  *
12  * All rights reserved.
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License version 2.1,
16  * as published by the Free Software Foundation.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this program; if not, write to the Free Software
25  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  */
27 
28 /*! \file */
29 
30 #if !defined(_SPANDSP_IMAGE_TRANSLATE_H_)
31 #define _SPANDSP_IMAGE_TRANSLATE_H_
32 
33 /*! \page image_translate_page Image translation
34 \section image_translate_page_sec_1 What does it do?
35 
36 \section image_translate_page_sec_2 How does it work?
37 
38 \section image_translate_page_sec_3 How do I use it?
39 */
40 
42 
43 enum
44 {
45  IMAGE_TRANSLATE_FROM_MONO = 1,
46  IMAGE_TRANSLATE_FROM_GRAY_8 = 2,
47  IMAGE_TRANSLATE_FROM_GRAY_16 = 3,
48  IMAGE_TRANSLATE_FROM_COLOUR_8 = 4,
49  IMAGE_TRANSLATE_FROM_COLOUR_16 = 5
50 };
51 
52 #if defined(__cplusplus)
53 extern "C"
54 {
55 #endif
56 
57 /*! \brief Get the next row of a translated image.
58  \param s The image translation context.
59  \return the length of the row buffer, in bytes */
60 SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[], size_t len);
61 
62 /*! \brief Get the width of the image being produced by an image translation context.
63  \param s The image translation context.
64  \return The width of the output image, in pixel. */
66 
67 /*! \brief Get the length of the image being produced by an image translation context.
68  \param s The image translation context.
69  \return The length of the output image, in pixel. */
71 
72 /*! \brief Initialise an image translation context for rescaling and squashing a gray scale
73  or colour image to a bi-level FAX type image.
74  \param s The image translation context.
75  \param input_format x
76  \param input_width The width of the source image, in pixels.
77  \param input_length The length of the source image, in pixels.
78  \param output_width The width of the output image, in pixels. The length of the output image
79  will be derived automatically from this and the source image dimension, to main the
80  geometry of the original image.
81  \param row_read_handler A callback routine used to pull rows of pixels from the source image
82  into the translation process.
83  \param row_read_user_data An opaque point passed to read_row_handler
84  \return A pointer to the context, or NULL if there was a problem. */
86  int input_format,
87  int input_width,
88  int input_length,
89  int output_width,
90  t4_row_read_handler_t row_read_handler,
91  void *row_read_user_data);
92 
93 /*! \brief Release the resources associated with an image translation context.
94  \param s The image translation context.
95  \return 0 for success, otherwise -1. */
97 
98 /*! \brief Free the resources associated with an image translation context.
99  \param s The image translation context.
100  \return 0 for success, otherwise -1. */
101 SPAN_DECLARE(int) image_translate_free(image_translate_state_t *s);
102 
103 #if defined(__cplusplus)
104 }
105 #endif
106 
107 #endif
108 /*- End of file ------------------------------------------------------------*/
t4_tx.h
image_translate_get_output_width
int image_translate_get_output_width(image_translate_state_t *s)
Get the width of the image being produced by an image translation context.
Definition: image_translate.c:346
image_translate_state_s
Definition: private/image_translate.h:32
image_translate_get_output_width
int image_translate_get_output_width(image_translate_state_t *s)
Get the width of the image being produced by an image translation context.
Definition: image_translate.c:346
image_translate_get_output_length
int image_translate_get_output_length(image_translate_state_t *s)
Get the length of the image being produced by an image translation context.
Definition: image_translate.c:352
ima_adpcm_encode
int ima_adpcm_encode(ima_adpcm_state_t *s, uint8_t ima_data[], const int16_t amp[], int len)
Definition: ima_adpcm.c:425
image_translate_free
int image_translate_free(image_translate_state_t *s)
Free the resources associated with an image translation context.
Definition: image_translate.c:458
t4_rx.h
t4_row_read_handler_t
int(* t4_row_read_handler_t)(void *user_data, uint8_t buf[], size_t len)
Definition: t4_tx.h:36
image_translate_release
int image_translate_release(image_translate_state_t *s)
Release the resources associated with an image translation context.
Definition: image_translate.c:437
image_translate_release
int image_translate_release(image_translate_state_t *s)
Release the resources associated with an image translation context.
Definition: image_translate.c:437
timezone.h
ima_adpcm_release
int ima_adpcm_release(ima_adpcm_state_t *s)
Definition: ima_adpcm.c:296
image_translate_init
image_translate_state_t * image_translate_init(image_translate_state_t *s, int input_format, int input_width, int input_length, int output_width, t4_row_read_handler_t row_read_handler, void *row_read_user_data)
Initialise an image translation context for rescaling and squashing a gray scale or colour image to a...
Definition: image_translate.c:358
IMA_ADPCM_IMA4
@ IMA_ADPCM_IMA4
Definition: ima_adpcm.h:48
t4_t6_encode.h
image_translate_free
int image_translate_free(image_translate_state_t *s)
Free the resources associated with an image translation context.
Definition: image_translate.c:458
saturated.h
t4_t6_decode.h
image_translate_get_output_length
int image_translate_get_output_length(image_translate_state_t *s)
Get the length of the image being produced by an image translation context.
Definition: image_translate.c:352
IMA_ADPCM_DVI4
@ IMA_ADPCM_DVI4
Definition: ima_adpcm.h:50
ima_adpcm_state_s
Definition: private/ima_adpcm.h:39
image_translate_init
image_translate_state_t * image_translate_init(image_translate_state_t *s, int input_format, int input_width, int input_length, int output_width, t4_row_read_handler_t row_read_handler, void *row_read_user_data)
Initialise an image translation context for rescaling and squashing a gray scale or colour image to a...
Definition: image_translate.c:358
image_translate_row
int image_translate_row(image_translate_state_t *s, uint8_t buf[], size_t len)
Get the next row of a translated image.
Definition: image_translate.c:228
spandsp-sim.h
IMA_ADPCM_VDVI
@ IMA_ADPCM_VDVI
Definition: ima_adpcm.h:52
ima_adpcm_init
ima_adpcm_state_t * ima_adpcm_init(ima_adpcm_state_t *s, int variant, int chunk_size)
Definition: ima_adpcm.c:279
image_translate_row
int image_translate_row(image_translate_state_t *s, uint8_t buf[], size_t len)
Get the next row of a translated image.
Definition: image_translate.c:228
ima_adpcm_decode
int ima_adpcm_decode(ima_adpcm_state_t *s, int16_t amp[], const uint8_t ima_data[], int ima_bytes)
Definition: ima_adpcm.c:309
logging.h
image_translate.h