160{
165 if (decoder == NULL) {
166 MSG(ERROR,
"Cannot find decoder from %s to RGB!\n",
168 }
170 if (coder == NULL) {
171 MSG(ERROR,
"Cannot find encoder from %s to RGB!\n",
173 }
174 if (decoder == NULL || coder == NULL)
175 return in;
176
179
182 }
185
188 }
189
190 if (rect_x < 0 || rect_y < 0)
191 return in;
192
193 int dec_width = s->
width;
195 int linesize = dec_width * 3;
196
197 unsigned char *segment = (
unsigned char *) malloc(linesize * s->
height);
198
199 for (
unsigned int y = 0;
y < s->
height; ++
y) {
200 decoder(segment +
y * linesize, (
unsigned char *) in->
tiles[0].
data + (
y + rect_y) *
203 0, 8, 16);
204 }
205
206 const unsigned char *overlay_data = s->
logo;
207 for (
unsigned int y = 0;
y < s->
height; ++
y) {
208 unsigned char *image_data = segment +
y * linesize;
209 for (
unsigned int x = 0;
x < s->
width; ++
x) {
210 int alpha = overlay_data[3];
211 for (int i = 0; i < 3; ++i) {
212 *image_data = (*image_data * (255 - alpha) + *overlay_data++ * alpha) / 255;
213 image_data++;
214 }
215 overlay_data++;
216 }
217 }
218
219 for (
unsigned int y = 0;
y < s->
height; ++
y) {
220 coder((
unsigned char *) in->
tiles[0].
data + (rect_y +
y) *
223 segment +
y * linesize,
225 }
226
227 free(segment);
228
229 return in;
230}
int vc_get_linesize(unsigned int width, codec_t codec)
const char * get_codec_name(codec_t codec)
decoder_t get_decoder_from_to(codec_t in, codec_t out)
decoder_func_t * decoder_t
char * data
Raw tile data. Pointer must be at least 4B aligned.
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
@ RGB
RGB 8-bit (packed into 24-bit word)
int get_pf_block_bytes(codec_t codec)
returns codec_info_t::block_size_bytes