gavl
gavldsp.h
1/*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2024 Members of the Gmerlin project
5 * http://github.com/bplaum
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * *****************************************************************/
20
21
22
23#ifndef GAVLDSP_H_INCLUDED
24#define GAVLDSP_H_INCLUDED
25
26#include <gavl/gavldefs.h>
27
46typedef struct gavl_dsp_context_s gavl_dsp_context_t;
47
54typedef struct
55 {
69 int (*sad_rgb15)(const uint8_t * src_1, const uint8_t * src_2,
70 int stride_1, int stride_2,
71 int w, int h);
72
86 int (*sad_rgb16)(const uint8_t * src_1, const uint8_t * src_2,
87 int stride_1, int stride_2,
88 int w, int h);
89
100 int (*sad_8)(const uint8_t * src_1, const uint8_t * src_2,
101 int stride_1, int stride_2,
102 int w, int h);
103
114 int (*sad_16)(const uint8_t * src_1, const uint8_t * src_2,
115 int stride_1, int stride_2,
116 int w, int h);
117
127 float (*sad_f)(const uint8_t * src_1, const uint8_t * src_2,
128 int stride_1, int stride_2,
129 int w, int h);
130
138 void (*average_rgb15)(const uint8_t * src_1, const uint8_t * src_2,
139 uint8_t * dst, int num);
140
147 void (*average_rgb16)(const uint8_t * src_1, const uint8_t * src_2,
148 uint8_t * dst, int num);
149
156 void (*average_8)(const uint8_t * src_1, const uint8_t * src_2,
157 uint8_t * dst, int num);
158
165 void (*average_16)(const uint8_t * src_1, const uint8_t * src_2,
166 uint8_t * dst, int num);
167
175 void (*average_f)(const uint8_t * src_1, const uint8_t * src_2,
176 uint8_t * dst, int num);
177
178
189 void (*interpolate_rgb15)(const uint8_t * src_1, const uint8_t * src_2,
190 uint8_t * dst, int num, float);
191
201 void (*interpolate_rgb16)(const uint8_t * src_1, const uint8_t * src_2,
202 uint8_t * dst, int num, float fac);
203
213 void (*interpolate_8)(const uint8_t * src_1, const uint8_t * src_2,
214 uint8_t * dst, int num, float fac);
215
225 void (*interpolate_16)(const uint8_t * src_1, const uint8_t * src_2,
226 uint8_t * dst, int num, float fac);
227
238 void (*interpolate_f)(const uint8_t * src_1, const uint8_t * src_2,
239 uint8_t * dst, int num, float fac);
240
245 void (*bswap_16)(void * ptr, int len);
246
251 void (*bswap_32)(void * ptr, int len);
252
257 void (*bswap_64)(void * ptr, int len);
258
268 void (*add_u8)(const void * src1, const void * src2, void * dst, int num);
269
278 void (*add_u8_s)(const void * src1, const void * src2, void * dst, int num);
279
288 void (*add_s8)(const void * src1, const void * src2, void * dst, int num);
289
298 void (*add_u16)(const void * src1, const void * src2, void * dst, int num);
299
308 void (*add_u16_s)(const void * src1, const void * src2, void * dst, int num);
309
318 void (*add_s16)(const void * src1, const void * src2, void * dst, int num);
319
328 void (*add_s32)(const void * src1, const void * src2, void * dst, int num);
329
338 void (*add_float)(const void * src1, const void * src2, void * dst, int num);
339
348 void (*add_double)(const void * src1, const void * src2, void * dst, int num);
349
359 void (*sub_u8)(const void * src1, const void * src2, void * dst, int num);
360
369 void (*sub_u8_s)(const void * src1, const void * src2, void * dst, int num);
370
379 void (*sub_s8)(const void * src1, const void * src2, void * dst, int num);
380
389 void (*sub_u16)(const void * src1, const void * src2, void * dst, int num);
390
399 void (*sub_u16_s)(const void * src1, const void * src2, void * dst, int num);
400
409 void (*sub_s16)(const void * src1, const void * src2, void * dst, int num);
410
419 void (*sub_s32)(const void * src1, const void * src2, void * dst, int num);
420
429 void (*sub_float)(const void * src1, const void * src2, void * dst, int num);
430
439 void (*sub_double)(const void * src1, const void * src2, void * dst, int num);
440
446 void (*shift_up_16)(void * ptr, int num, int bits);
447
453 void (*shift_down_16)(void * ptr, int num, int bits);
454
461 void (*shift_up_copy_16)(void * dst, const void * src, int num, int bits);
462
469 void (*shift_down_copy_16)(void * dst, const void * src, int num, int bits);
470
477 void (*shuffle_8_4)(void * dst, const void * src, int num, int * indices);
478
485 void (*shuffle_16_4)(void * dst, const void * src, int num, int * indices);
486
487
488
490
498GAVL_PUBLIC
500
508GAVL_PUBLIC
510 int q);
511
520GAVL_PUBLIC
522 int flags);
523
524
534GAVL_PUBLIC gavl_dsp_funcs_t *
536
541GAVL_PUBLIC
543
574GAVL_PUBLIC
576 gavl_video_format_t * format,
577 gavl_video_frame_t * src_1,
578 gavl_video_frame_t * src_2,
579 gavl_video_frame_t * dst,
580 float factor);
581
594GAVL_PUBLIC
596 gavl_audio_frame_t * frame,
597 const gavl_audio_format_t * format);
598
617GAVL_PUBLIC
619 gavl_video_frame_t * frame,
620 const gavl_video_format_t * format);
621
637GAVL_PUBLIC void
639 gavl_video_frame_t * frame,
640 const gavl_video_format_t * format, int bits);
641
642
643GAVL_PUBLIC void
644gavl_dsp_video_frame_shift_bits_copy(gavl_dsp_context_t * ctx,
645 gavl_video_frame_t * dst,
646 const gavl_video_frame_t * src,
647 const gavl_video_format_t * format, int bits);
648
649void
650gavl_dsp_video_frame_shuffle_4(gavl_dsp_context_t * ctx, gavl_video_frame_t * frame,
651 const gavl_video_format_t * format, int * src_indices);
652
653void
654gavl_dsp_video_frame_shuffle_4_copy(gavl_dsp_context_t * ctx,
655 gavl_video_frame_t * dst,
656 const gavl_video_frame_t * src,
657 const gavl_video_format_t * format,
658 int * src_indices);
659
660
665#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(void)
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:46
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 endianness 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 endianness an audio frame.
GAVL_PUBLIC 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.
Audio Format.
Definition gavl.h:273
Generic container for audio samples.
Definition gavl.h:624
Function table.
Definition gavldsp.h:55
Video format.
Definition gavl.h:2405
Definition gavl.h:2629