gavl
gavldsp.h
1/*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2012 Members of the Gmerlin project
5 * gmerlin-general@lists.sourceforge.net
6 * http://gmerlin.sourceforge.net
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * *****************************************************************/
21
22#ifndef GAVLDSP_H_INCLUDED
23#define GAVLDSP_H_INCLUDED
24
25#include <gavl/gavldefs.h>
26
39
44
45typedef struct gavl_dsp_context_s gavl_dsp_context_t;
46
52
53typedef struct
54 {
67
68 int (*sad_rgb15)(const uint8_t * src_1, const uint8_t * src_2,
69 int stride_1, int stride_2,
70 int w, int h);
71
84
85 int (*sad_rgb16)(const uint8_t * src_1, const uint8_t * src_2,
86 int stride_1, int stride_2,
87 int w, int h);
88
98
99 int (*sad_8)(const uint8_t * src_1, const uint8_t * src_2,
100 int stride_1, int stride_2,
101 int w, int h);
102
112
113 int (*sad_16)(const uint8_t * src_1, const uint8_t * src_2,
114 int stride_1, int stride_2,
115 int w, int h);
116
126 float (*sad_f)(const uint8_t * src_1, const uint8_t * src_2,
127 int stride_1, int stride_2,
128 int w, int h);
129
136
137 void (*average_rgb15)(const uint8_t * src_1, const uint8_t * src_2,
138 uint8_t * dst, int num);
139
146 void (*average_rgb16)(const uint8_t * src_1, const uint8_t * src_2,
147 uint8_t * dst, int num);
148
155 void (*average_8)(const uint8_t * src_1, const uint8_t * src_2,
156 uint8_t * dst, int num);
157
164 void (*average_16)(const uint8_t * src_1, const uint8_t * src_2,
165 uint8_t * dst, int num);
166
173
174 void (*average_f)(const uint8_t * src_1, const uint8_t * src_2,
175 uint8_t * dst, int num);
176
177
187
188 void (*interpolate_rgb15)(const uint8_t * src_1, const uint8_t * src_2,
189 uint8_t * dst, int num, float);
190
200 void (*interpolate_rgb16)(const uint8_t * src_1, const uint8_t * src_2,
201 uint8_t * dst, int num, float fac);
202
212 void (*interpolate_8)(const uint8_t * src_1, const uint8_t * src_2,
213 uint8_t * dst, int num, float fac);
214
224 void (*interpolate_16)(const uint8_t * src_1, const uint8_t * src_2,
225 uint8_t * dst, int num, float fac);
226
236
237 void (*interpolate_f)(const uint8_t * src_1, const uint8_t * src_2,
238 uint8_t * dst, int num, float fac);
239
244 void (*bswap_16)(void * ptr, int len);
245
250 void (*bswap_32)(void * ptr, int len);
251
256 void (*bswap_64)(void * ptr, int len);
257
266
267 void (*add_u8)(const void * src1, const void * src2, void * dst, int num);
268
277 void (*add_u8_s)(const void * src1, const void * src2, void * dst, int num);
278
287 void (*add_s8)(const void * src1, const void * src2, void * dst, int num);
288
297 void (*add_u16)(const void * src1, const void * src2, void * dst, int num);
298
307 void (*add_u16_s)(const void * src1, const void * src2, void * dst, int num);
308
317 void (*add_s16)(const void * src1, const void * src2, void * dst, int num);
318
327 void (*add_s32)(const void * src1, const void * src2, void * dst, int num);
328
337 void (*add_float)(const void * src1, const void * src2, void * dst, int num);
338
347 void (*add_double)(const void * src1, const void * src2, void * dst, int num);
348
357
358 void (*sub_u8)(const void * src1, const void * src2, void * dst, int num);
359
368 void (*sub_u8_s)(const void * src1, const void * src2, void * dst, int num);
369
378 void (*sub_s8)(const void * src1, const void * src2, void * dst, int num);
379
388 void (*sub_u16)(const void * src1, const void * src2, void * dst, int num);
389
398 void (*sub_u16_s)(const void * src1, const void * src2, void * dst, int num);
399
408 void (*sub_s16)(const void * src1, const void * src2, void * dst, int num);
409
418 void (*sub_s32)(const void * src1, const void * src2, void * dst, int num);
419
428 void (*sub_float)(const void * src1, const void * src2, void * dst, int num);
429
438 void (*sub_double)(const void * src1, const void * src2, void * dst, int num);
439
445 void (*shift_up_16)(void * ptr, int num, int bits);
446
452 void (*shift_down_16)(void * ptr, int num, int bits);
453
455
462
463GAVL_PUBLIC
465
472
473GAVL_PUBLIC
475 int q);
476
484
485GAVL_PUBLIC
487 int flags);
488
489
498
499GAVL_PUBLIC gavl_dsp_funcs_t *
501
505
506GAVL_PUBLIC
508
511
522
538
539GAVL_PUBLIC
541 gavl_video_format_t * format,
542 gavl_video_frame_t * src_1,
543 gavl_video_frame_t * src_2,
544 gavl_video_frame_t * dst,
545 float factor);
546
558
559GAVL_PUBLIC
561 gavl_audio_frame_t * frame,
562 const gavl_audio_format_t * format);
563
581
582GAVL_PUBLIC
584 gavl_video_frame_t * frame,
585 const gavl_video_format_t * format);
586
601
602void
604 gavl_video_frame_t * frame,
605 const gavl_video_format_t * format, int bits);
606
607
611
612#endif // GAVLDSP_H_INCLUDED
GAVL_PUBLIC void gavl_dsp_context_destroy(gavl_dsp_context_t *ctx)
Destroy a DSP context.
GAVL_PUBLIC void gavl_dsp_context_set_quality(gavl_dsp_context_t *ctx, int q)
Set the quality for a DSP context.
GAVL_PUBLIC gavl_dsp_funcs_t * gavl_dsp_context_get_funcs(gavl_dsp_context_t *ctx)
Get the functions.
GAVL_PUBLIC gavl_dsp_context_t * gavl_dsp_context_create()
Create a DSP context.
GAVL_PUBLIC void gavl_dsp_context_set_accel_flags(gavl_dsp_context_t *ctx, int flags)
Set the acceleration flags for a DSP context.
struct gavl_dsp_context_s gavl_dsp_context_t
Opaque DSP context.
Definition gavldsp.h:45
GAVL_PUBLIC int gavl_dsp_video_frame_swap_endian(gavl_dsp_context_t *ctx, gavl_video_frame_t *frame, const gavl_video_format_t *format)
Swap endianess a video frame.
GAVL_PUBLIC int gavl_dsp_audio_frame_swap_endian(gavl_dsp_context_t *ctx, gavl_audio_frame_t *frame, const gavl_audio_format_t *format)
Swap endianess an audio frame.
void gavl_dsp_video_frame_shift_bits(gavl_dsp_context_t *ctx, gavl_video_frame_t *frame, const gavl_video_format_t *format, int bits)
Shift bits in a video frame.
GAVL_PUBLIC int gavl_dsp_interpolate_video_frame(gavl_dsp_context_t *ctx, gavl_video_format_t *format, gavl_video_frame_t *src_1, gavl_video_frame_t *src_2, gavl_video_frame_t *dst, float factor)
Do a linear interpolation of a video frame.
struct gavl_video_format_s gavl_video_format_t
Video format.
Definition gavl.h:153
struct gavl_video_frame_s gavl_video_frame_t
Audio Format.
Definition gavl.h:312
Generic container for audio samples.
Definition gavl.h:595
Function table.
Definition gavldsp.h:54
int(* sad_8)(const uint8_t *src_1, const uint8_t *src_2, int stride_1, int stride_2, int w, int h)
Get the sum of absolute differences (8 bit)
Definition gavldsp.h:99
int(* sad_rgb16)(const uint8_t *src_1, const uint8_t *src_2, int stride_1, int stride_2, int w, int h)
Get the sum of absolute differences (RGB/BGR16)
Definition gavldsp.h:85
void(* sub_u8)(const void *src1, const void *src2, void *dst, int num)
Subtract 2 uint8_t vectors.
Definition gavldsp.h:358
void(* average_16)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num)
Average 2 scanlines (16 bit)
Definition gavldsp.h:164
void(* sub_u16_s)(const void *src1, const void *src2, void *dst, int num)
Subtract 2 uint16_t vectors (for audio stored as unsigned)
Definition gavldsp.h:398
void(* average_f)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num)
Average 2 scanlines (float)
Definition gavldsp.h:174
void(* interpolate_8)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num, float fac)
Interpolate 2 scanlines (8 bit)
Definition gavldsp.h:212
void(* sub_float)(const void *src1, const void *src2, void *dst, int num)
Subtract 2 float vectors.
Definition gavldsp.h:428
void(* average_rgb15)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num)
Average 2 scanlines (RGB/BGR15)
Definition gavldsp.h:137
void(* add_s32)(const void *src1, const void *src2, void *dst, int num)
Add 2 int32_t vectors.
Definition gavldsp.h:327
int(* sad_16)(const uint8_t *src_1, const uint8_t *src_2, int stride_1, int stride_2, int w, int h)
Get the sum of absolute differences (16 bit)
Definition gavldsp.h:113
void(* add_u16_s)(const void *src1, const void *src2, void *dst, int num)
Add 2 uint16_t vectors (for audio stored as unsigned)
Definition gavldsp.h:307
void(* add_u8_s)(const void *src1, const void *src2, void *dst, int num)
Add 2 uint8_t vectors (for audio stored as unsigned)
Definition gavldsp.h:277
void(* add_s8)(const void *src1, const void *src2, void *dst, int num)
Add 2 int8_t vectors.
Definition gavldsp.h:287
void(* shift_up_16)(void *ptr, int num, int bits)
Shift up.
Definition gavldsp.h:445
void(* bswap_32)(void *ptr, int len)
Do 32 byte endian swapping.
Definition gavldsp.h:250
void(* add_double)(const void *src1, const void *src2, void *dst, int num)
Add 2 float vectors.
Definition gavldsp.h:347
void(* sub_s32)(const void *src1, const void *src2, void *dst, int num)
Subtract 2 int32_t vectors.
Definition gavldsp.h:418
void(* add_u16)(const void *src1, const void *src2, void *dst, int num)
Add 2 uint16_t vectors.
Definition gavldsp.h:297
float(* sad_f)(const uint8_t *src_1, const uint8_t *src_2, int stride_1, int stride_2, int w, int h)
Get the sum of absolute differences (float)
Definition gavldsp.h:126
void(* interpolate_16)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num, float fac)
Interpolate 2 scanlines (16 bit)
Definition gavldsp.h:224
void(* add_u8)(const void *src1, const void *src2, void *dst, int num)
Add 2 uint8_t vectors.
Definition gavldsp.h:267
void(* sub_s8)(const void *src1, const void *src2, void *dst, int num)
Subtract 2 int8_t vectors.
Definition gavldsp.h:378
void(* interpolate_rgb15)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num, float)
Interpolate 2 scanlines (RGB/BGR15)
Definition gavldsp.h:188
void(* add_s16)(const void *src1, const void *src2, void *dst, int num)
Add 2 int16_t vectors.
Definition gavldsp.h:317
void(* add_float)(const void *src1, const void *src2, void *dst, int num)
Add 2 float vectors.
Definition gavldsp.h:337
void(* average_rgb16)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num)
Average 2 scanlines (RGB/BGR16)
Definition gavldsp.h:146
void(* sub_u8_s)(const void *src1, const void *src2, void *dst, int num)
Subtract 2 uint8_t vectors (for audio stored as unsigned)
Definition gavldsp.h:368
void(* shift_down_16)(void *ptr, int num, int bits)
Shift down.
Definition gavldsp.h:452
void(* sub_double)(const void *src1, const void *src2, void *dst, int num)
Subtract 2 float vectors.
Definition gavldsp.h:438
void(* bswap_16)(void *ptr, int len)
Do 16 bit endian swapping.
Definition gavldsp.h:244
void(* sub_s16)(const void *src1, const void *src2, void *dst, int num)
Subtract 2 int16_t vectors.
Definition gavldsp.h:408
void(* sub_u16)(const void *src1, const void *src2, void *dst, int num)
Subtract 2 uint16_t vectors.
Definition gavldsp.h:388
int(* sad_rgb15)(const uint8_t *src_1, const uint8_t *src_2, int stride_1, int stride_2, int w, int h)
Get the sum of absolute differences (RGB/BGR15)
Definition gavldsp.h:68
void(* interpolate_rgb16)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num, float fac)
Interpolate 2 scanlines (RGB/BGR16)
Definition gavldsp.h:200
void(* bswap_64)(void *ptr, int len)
Do 64 byte endian swapping.
Definition gavldsp.h:256
void(* average_8)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num)
Average 2 scanlines (8 bit)
Definition gavldsp.h:155
void(* interpolate_f)(const uint8_t *src_1, const uint8_t *src_2, uint8_t *dst, int num, float fac)
Interpolate 2 scanlines (float)
Definition gavldsp.h:237