File: merge_split.h

package info (click to toggle)
libepsilon 0.9.2%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,192 kB
  • sloc: ansic: 11,329; sh: 9,321; perl: 936; xml: 86; makefile: 85
file content (98 lines) | stat: -rw-r--r-- 3,352 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * $Id: merge_split.h,v 1.17 2010/02/05 23:50:22 simakov Exp $
 *
 * EPSILON - wavelet image compression library.
 * Copyright (C) 2006,2007,2010 Alexander Simakov, <xander@entropyware.info>
 *
 * This file is part of EPSILON
 *
 * EPSILON is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * EPSILON 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 EPSILON.  If not, see <http://www.gnu.org/licenses/>.
 *
 * http://epsilon-project.sourceforge.net
 */

/** \file
 *
 *  \brief Merge and split
 *
 *  The library expects that color image consists of 3 independent
 *  channels: Y, Cb and Cr. In order to provide smooth image scaling
 *  corresponding bitstreams should be merged into a singe bitstream.
 *  On decoding, the inverse operation should be taken. */

#ifndef __MERGE_SPLIT_H__
#define __MERGE_SPLIT_H__

#ifdef __cplusplus
extern "C" {
#endif

/** \addtogroup merge_split Merge and split */
/*@{*/

#include <common.h>

/** Merge two channels
 *
 *  This function merges \a channel_A with \a channel_B. Result is stored
 *  in the \a channel_AB. Note that on return, combined \a channel_AB can
 *  be further merged with another channel.
 *
 *  \param channel_A Channel A
 *  \param channel_B Channel B
 *  \param channel_AB Combined channel AB
 *  \param len_A Length of the \a channel_A
 *  \param len_B Length of the \a channel_B
 *
 *  \note The caller should allocate at least \a len_A + \a len_B
 *  bytes for the \a channel_AB array.
 *
 *  \return \c VOID */
void merge_channels(unsigned char *channel_A, unsigned char *channel_B,
                    unsigned char *channel_AB, int len_A, int len_B);

/** Split combined channel
 *
 *  This function splits combined \a channel_AB into
 *  the \a channel_A and \a channel_B. It is important to note
 *  that \a channel_AB can be truncated at any position beforehand.
 *  In this case \a channel_A and \a channel_B will contain only
 *  part of original data. Real amount of saved bytes will be stored
 *  in the \a real_len_A and \a real_len_B respectively.
 *
 *  \param channel_AB Combined channel AB
 *  \param channel_A Channel A
 *  \param channel_B Channel B
 *  \param len_AB Current length of the \a channel_AB
 *  \param len_A Original length of the \a channel_A
 *  \param len_B Original length of the \a channel_B
 *  \param real_len_A Number of bytes actually used in the \a channel_A
 *  \param real_len_B Number of bytes actually used in the \a channel_B
 *
 *  \note The caller should allocate at least \a len_AB bytes for
 *  \a channel_A and \a channel_B arrays.
 *
 *  \return \c VOID */
void split_channels(unsigned char *channel_AB,
                    unsigned char *channel_A, unsigned char *channel_B,
                    int len_AB, int len_A, int len_B,
                    int *real_len_A, int *real_len_B);

/*@}*/

#ifdef __cplusplus
}
#endif

#endif /* __MERGE_SPLIT_H__ */