• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavcodec/high_bit_depth.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Libav.
00003  *
00004  * Libav is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * Libav is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with Libav; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00017  */
00018 
00019 #include "dsputil.h"
00020 
00021 #ifndef BIT_DEPTH
00022 #define BIT_DEPTH 8
00023 #endif
00024 
00025 #ifdef AVCODEC_H264_HIGH_DEPTH_H
00026 #   undef pixel
00027 #   undef pixel2
00028 #   undef pixel4
00029 #   undef dctcoef
00030 #   undef INIT_CLIP
00031 #   undef no_rnd_avg_pixel4
00032 #   undef rnd_avg_pixel4
00033 #   undef AV_RN2P
00034 #   undef AV_RN4P
00035 #   undef AV_RN4PA
00036 #   undef AV_WN2P
00037 #   undef AV_WN4P
00038 #   undef AV_WN4PA
00039 #   undef CLIP
00040 #   undef FUNC
00041 #   undef FUNCC
00042 #   undef av_clip_pixel
00043 #   undef PIXEL_SPLAT_X4
00044 #else
00045 #   define AVCODEC_H264_HIGH_DEPTH_H
00046 #   define CLIP_PIXEL(depth)\
00047     static inline uint16_t av_clip_pixel_ ## depth (int p)\
00048     {\
00049         const int pixel_max = (1 << depth)-1;\
00050         return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\
00051     }
00052 
00053 CLIP_PIXEL( 9)
00054 CLIP_PIXEL(10)
00055 #endif
00056 
00057 #if BIT_DEPTH > 8
00058 #   define pixel  uint16_t
00059 #   define pixel2 uint32_t
00060 #   define pixel4 uint64_t
00061 #   define dctcoef int32_t
00062 
00063 #   define INIT_CLIP
00064 #   define no_rnd_avg_pixel4 no_rnd_avg64
00065 #   define    rnd_avg_pixel4    rnd_avg64
00066 #   define AV_RN2P  AV_RN32
00067 #   define AV_RN4P  AV_RN64
00068 #   define AV_RN4PA AV_RN64A
00069 #   define AV_WN2P  AV_WN32
00070 #   define AV_WN4P  AV_WN64
00071 #   define AV_WN4PA AV_WN64A
00072 #   define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
00073 #else
00074 #   define pixel  uint8_t
00075 #   define pixel2 uint16_t
00076 #   define pixel4 uint32_t
00077 #   define dctcoef int16_t
00078 
00079 #   define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
00080 #   define no_rnd_avg_pixel4 no_rnd_avg32
00081 #   define    rnd_avg_pixel4    rnd_avg32
00082 #   define AV_RN2P  AV_RN16
00083 #   define AV_RN4P  AV_RN32
00084 #   define AV_RN4PA AV_RN32A
00085 #   define AV_WN2P  AV_WN16
00086 #   define AV_WN4P  AV_WN32
00087 #   define AV_WN4PA AV_WN32A
00088 #   define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
00089 #endif
00090 
00091 #if BIT_DEPTH == 8
00092 #   define av_clip_pixel(a) av_clip_uint8(a)
00093 #   define CLIP(a) cm[a]
00094 #   define FUNC(a)  a ## _8
00095 #   define FUNCC(a) a ## _8_c
00096 #elif BIT_DEPTH == 9
00097 #   define av_clip_pixel(a) av_clip_pixel_9(a)
00098 #   define CLIP(a)          av_clip_pixel_9(a)
00099 #   define FUNC(a)  a ## _9
00100 #   define FUNCC(a) a ## _9_c
00101 #elif BIT_DEPTH == 10
00102 #   define av_clip_pixel(a) av_clip_pixel_10(a)
00103 #   define CLIP(a)          av_clip_pixel_10(a)
00104 #   define FUNC(a)  a ## _10
00105 #   define FUNCC(a) a ## _10_c
00106 #endif

Generated on Fri Feb 22 2013 07:24:26 for FFmpeg by  doxygen 1.7.1