gavl

gavldsp.h

00001 /*****************************************************************
00002  * gavl - a general purpose audio/video processing library
00003  *
00004  * Copyright (c) 2001 - 2012 Members of the Gmerlin project
00005  * gmerlin-general@lists.sourceforge.net
00006  * http://gmerlin.sourceforge.net
00007  *
00008  * This program is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  * *****************************************************************/
00021 
00022 #ifndef GAVLDSP_H_INCLUDED
00023 #define GAVLDSP_H_INCLUDED
00024 
00025 #include <gavl/gavldefs.h>
00026 
00045 typedef struct gavl_dsp_context_s gavl_dsp_context_t;
00046 
00053 typedef struct
00054   {
00068   int (*sad_rgb15)(const uint8_t * src_1, const uint8_t * src_2, 
00069                    int stride_1, int stride_2, 
00070                    int w, int h);
00071 
00085   int (*sad_rgb16)(const uint8_t * src_1, const uint8_t * src_2, 
00086                    int stride_1, int stride_2, 
00087                    int w, int h);
00088 
00099   int (*sad_8)(const uint8_t * src_1, const uint8_t * src_2, 
00100                int stride_1, int stride_2, 
00101                int w, int h);
00102 
00113   int (*sad_16)(const uint8_t * src_1, const uint8_t * src_2, 
00114                int stride_1, int stride_2, 
00115                int w, int h);
00116 
00126   float (*sad_f)(const uint8_t * src_1, const uint8_t * src_2, 
00127                  int stride_1, int stride_2, 
00128                  int w, int h);
00129 
00137   void (*average_rgb15)(const uint8_t * src_1, const uint8_t * src_2, 
00138                         uint8_t * dst, int num);
00139 
00146   void (*average_rgb16)(const uint8_t * src_1, const uint8_t * src_2, 
00147                         uint8_t * dst, int num);
00148 
00155   void (*average_8)(const uint8_t * src_1, const uint8_t * src_2, 
00156                     uint8_t * dst, int num);
00157 
00164   void (*average_16)(const uint8_t * src_1, const uint8_t * src_2, 
00165                      uint8_t * dst, int num);
00166 
00174   void (*average_f)(const uint8_t * src_1, const uint8_t * src_2, 
00175                     uint8_t * dst, int num);
00176 
00177 
00188   void (*interpolate_rgb15)(const uint8_t * src_1, const uint8_t * src_2, 
00189                             uint8_t * dst, int num, float);
00190 
00200   void (*interpolate_rgb16)(const uint8_t * src_1, const uint8_t * src_2, 
00201                             uint8_t * dst, int num, float fac);
00202 
00212   void (*interpolate_8)(const uint8_t * src_1, const uint8_t * src_2, 
00213                         uint8_t * dst, int num, float fac);
00214 
00224   void (*interpolate_16)(const uint8_t * src_1, const uint8_t * src_2, 
00225                          uint8_t * dst, int num, float fac);
00226 
00237   void (*interpolate_f)(const uint8_t * src_1, const uint8_t * src_2, 
00238                         uint8_t * dst, int num, float fac);
00239 
00244   void (*bswap_16)(void * ptr, int len);
00245 
00250   void (*bswap_32)(void * ptr, int len);
00251 
00256   void (*bswap_64)(void * ptr, int len);
00257   
00267   void (*add_u8)(const void * src1, const void * src2, void * dst, int num);
00268 
00277   void (*add_u8_s)(const void * src1, const void * src2, void * dst, int num);
00278 
00287   void (*add_s8)(const void * src1, const void * src2, void * dst, int num);
00288 
00297   void (*add_u16)(const void * src1, const void * src2, void * dst, int num);
00298 
00307   void (*add_u16_s)(const void * src1, const void * src2, void * dst, int num);
00308 
00317   void (*add_s16)(const void * src1, const void * src2, void * dst, int num);
00318 
00327   void (*add_s32)(const void * src1, const void * src2, void * dst, int num);
00328   
00337   void (*add_float)(const void * src1, const void * src2, void * dst, int num);
00338   
00347   void (*add_double)(const void * src1, const void * src2, void * dst, int num);
00348 
00358   void (*sub_u8)(const void * src1, const void * src2, void * dst, int num);
00359 
00368   void (*sub_u8_s)(const void * src1, const void * src2, void * dst, int num);
00369 
00378   void (*sub_s8)(const void * src1, const void * src2, void * dst, int num);
00379 
00388   void (*sub_u16)(const void * src1, const void * src2, void * dst, int num);
00389 
00398   void (*sub_u16_s)(const void * src1, const void * src2, void * dst, int num);
00399 
00408   void (*sub_s16)(const void * src1, const void * src2, void * dst, int num);
00409 
00418   void (*sub_s32)(const void * src1, const void * src2, void * dst, int num);
00419   
00428   void (*sub_float)(const void * src1, const void * src2, void * dst, int num);
00429   
00438   void (*sub_double)(const void * src1, const void * src2, void * dst, int num);
00439 
00445   void (*shift_up_16)(void * ptr, int num, int bits);
00446 
00452   void (*shift_down_16)(void * ptr, int num, int bits);
00453   
00454   } gavl_dsp_funcs_t;
00455 
00463 GAVL_PUBLIC
00464 gavl_dsp_context_t * gavl_dsp_context_create();
00465 
00473 GAVL_PUBLIC
00474 void gavl_dsp_context_set_quality(gavl_dsp_context_t * ctx,
00475                                   int q);
00476 
00485 GAVL_PUBLIC
00486 void gavl_dsp_context_set_accel_flags(gavl_dsp_context_t * ctx,
00487                                       int flags);
00488 
00489 
00499 GAVL_PUBLIC gavl_dsp_funcs_t * 
00500 gavl_dsp_context_get_funcs(gavl_dsp_context_t * ctx);
00501 
00506 GAVL_PUBLIC
00507 void gavl_dsp_context_destroy(gavl_dsp_context_t * ctx);
00508 
00539 GAVL_PUBLIC
00540 int gavl_dsp_interpolate_video_frame(gavl_dsp_context_t * ctx,
00541                                       gavl_video_format_t * format,
00542                                       gavl_video_frame_t * src_1,
00543                                       gavl_video_frame_t * src_2,
00544                                       gavl_video_frame_t * dst,
00545                                       float factor);
00546 
00559 GAVL_PUBLIC
00560 int gavl_dsp_audio_frame_swap_endian(gavl_dsp_context_t * ctx,
00561                                       gavl_audio_frame_t * frame,
00562                                       const gavl_audio_format_t * format);
00563 
00582 GAVL_PUBLIC
00583 int gavl_dsp_video_frame_swap_endian(gavl_dsp_context_t * ctx,
00584                                       gavl_video_frame_t * frame,
00585                                       const gavl_video_format_t * format);
00586 
00602 void
00603 gavl_dsp_video_frame_shift_bits(gavl_dsp_context_t * ctx,
00604                                 gavl_video_frame_t * frame,
00605                                 const gavl_video_format_t * format, int bits);
00606 
00607 
00612 #endif // GAVLDSP_H_INCLUDED