libkate: /home/v/Kate/WORK_TREES/kate-sorceress-backup/v/src/kate/src/kate_fp.h Source File

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

# /home/v/Kate/WORK_TREES/kate-sorceress-backup/v/src/kate/src/kate_fp.h

    00001 /* Copyright (C) 2008 Vincent Penquerc'h.
    00002    This file is part of the Kate codec library.
    00003    Written by Vincent Penquerc'h.
    00004
    00005    Use, distribution and reproduction of this library is governed
    00006    by a BSD style source license included with this source in the
    00007    file 'COPYING'. Please read these terms before distributing. */
    00008
    00009
    00010 #ifndef KATE_kate_fp_h_GUARD
    00011 #define KATE_kate_fp_h_GUARD
    00012
    00013 #include "kate_internal.h"
    00014 #include "kate/kate.h"
    00015 #include "kate_bitwise.h"
    00016
    00017 typedef int32_t kate_fp;
    00018
    00019 /* equal bits for int/frac */
    00020 /* #define KATE_FP_FRAC (sizeof(kate_fp)*8/2) */
    00021 /* more bits here for added frac precision (but less int range (and probably more space taken in the bitstream)) */
    00022 #define KATE_FP_FRAC (sizeof(kate_fp)*4)
    00023
    00024 #if 0
    00025 static inline kate_fp kate_fp_mul(kate_fp x,kate_fp y)
    00026 {
    00027   int64_t v=x;
    00028   v*=y;
    00029   v>>=KATE_FP_FRAC;
    00030   return v;
    00031 }
    00032
    00033 static inline kate_fp kate_fp_div(kate_fp x,kate_fp y)
    00034 {
    00035   int64_t v=x;
    00036   v<<=KATE_FP_FRAC;
    00037   v/=y;
    00038   return v;
    00039 }
    00040
    00041 static inline kate_fp kate_fp_add(kate_fp x, kate_fp y)
    00042 {
    00043   return x+y;
    00044 }
    00045
    00046 static inline kate_fp kate_fp_sub(kate_fp x, kate_fp y)
    00047 {
    00048   return x-y;
    00049 }
    00050 #endif
    00051
    00052 extern int kate_fp_encode(size_t count,const kate_fp *values,size_t streams,kate_pack_buffer *kpb) kate_internal;
    00053 extern int kate_fp_encode_kate_float(size_t count,const kate_float *values,size_t streams,kate_pack_buffer *kpb) kate_internal;
    00054 extern int kate_fp_decode(size_t count,kate_fp *values,size_t streams,kate_pack_buffer *kpb) kate_internal;
    00055 extern int kate_fp_decode_kate_float(size_t count,kate_float *values,size_t streams,kate_pack_buffer *kpb) kate_internal;
    00056
    00057 #endif
    00058