diff options
author | Oskar Arvidsson <oskar@irock.se> | 2011-03-29 17:48:59 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-10 22:33:42 +0200 |
commit | 8dbe5856410ee10ac4a9368105149efdacfac994 (patch) | |
tree | 6f332567746e6ef0bf33be492911263192153984 /libavcodec/dsputil_internal.h | |
parent | d268bed209828923b891aeab7979d7ef14a730b2 (diff) | |
download | ffmpeg-8dbe5856410ee10ac4a9368105149efdacfac994.tar.gz |
Adds 8-, 9- and 10-bit versions of some of the functions used by the h264 decoder.
This patch lets e.g. dsputil_init chose dsp functions with respect to
the bit depth to decode. The naming scheme of bit depth dependent
functions is <base name>_<bit depth>[_<prefix>] (i.e. the old
clear_blocks_c is now named clear_blocks_8_c).
Note: Some of the functions for high bit depth is not dependent on the
bit depth, but only on the pixel size. This leaves some room for
optimizing binary size.
Preparatory patch for high bit depth h264 decoding support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dsputil_internal.h')
-rw-r--r-- | libavcodec/dsputil_internal.h | 80 |
1 files changed, 61 insertions, 19 deletions
diff --git a/libavcodec/dsputil_internal.h b/libavcodec/dsputil_internal.h index e89751a65c..f3856bb294 100644 --- a/libavcodec/dsputil_internal.h +++ b/libavcodec/dsputil_internal.h @@ -27,25 +27,55 @@ * DSP utils */ -#include "dsputil.h" +#include "h264_high_depth.h" -#define BIT_DEPTH 8 +static inline void FUNC(copy_block2)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h) +{ + int i; + for(i=0; i<h; i++) + { + AV_WN2P(dst , AV_RN2P(src )); + dst+=dstStride; + src+=srcStride; + } +} -#define pixel uint8_t -#define pixel2 uint16_t -#define pixel4 uint32_t -#define dctcoef int16_t +static inline void FUNC(copy_block4)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h) +{ + int i; + for(i=0; i<h; i++) + { + AV_WN4P(dst , AV_RN4P(src )); + dst+=dstStride; + src+=srcStride; + } +} -#define FUNC(a) a -#define FUNCC(a) a ## _c -#define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; -#define CLIP(a) cm[a] -#define AV_RN2P AV_RN16 -#define AV_RN4P AV_RN32 -#define PIXEL_MAX ((1<<BIT_DEPTH)-1) +static inline void FUNC(copy_block8)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h) +{ + int i; + for(i=0; i<h; i++) + { + AV_WN4P(dst , AV_RN4P(src )); + AV_WN4P(dst+4*sizeof(pixel), AV_RN4P(src+4*sizeof(pixel))); + dst+=dstStride; + src+=srcStride; + } +} -#define no_rnd_avg_pixel4 no_rnd_avg32 -#define rnd_avg_pixel4 rnd_avg32 +static inline void FUNC(copy_block16)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h) +{ + int i; + for(i=0; i<h; i++) + { + AV_WN4P(dst , AV_RN4P(src )); + AV_WN4P(dst+ 4*sizeof(pixel), AV_RN4P(src+ 4*sizeof(pixel))); + AV_WN4P(dst+ 8*sizeof(pixel), AV_RN4P(src+ 8*sizeof(pixel))); + AV_WN4P(dst+12*sizeof(pixel), AV_RN4P(src+12*sizeof(pixel))); + dst+=dstStride; + src+=srcStride; + } +} /* draw the edges of width 'w' of an image of size width, height */ //FIXME check that this is ok for mpeg4 interlaced @@ -1319,10 +1349,22 @@ H264_MC(avg_, 16) #undef op2_put #endif -#define put_h264_qpel8_mc00_c ff_put_pixels8x8_c -#define avg_h264_qpel8_mc00_c ff_avg_pixels8x8_c -#define put_h264_qpel16_mc00_c ff_put_pixels16x16_c -#define avg_h264_qpel16_mc00_c ff_avg_pixels16x16_c +#if BIT_DEPTH == 8 +# define put_h264_qpel8_mc00_8_c ff_put_pixels8x8_8_c +# define avg_h264_qpel8_mc00_8_c ff_avg_pixels8x8_8_c +# define put_h264_qpel16_mc00_8_c ff_put_pixels16x16_8_c +# define avg_h264_qpel16_mc00_8_c ff_avg_pixels16x16_8_c +#elif BIT_DEPTH == 9 +# define put_h264_qpel8_mc00_9_c ff_put_pixels8x8_9_c +# define avg_h264_qpel8_mc00_9_c ff_avg_pixels8x8_9_c +# define put_h264_qpel16_mc00_9_c ff_put_pixels16x16_9_c +# define avg_h264_qpel16_mc00_9_c ff_avg_pixels16x16_9_c +#elif BIT_DEPTH == 10 +# define put_h264_qpel8_mc00_10_c ff_put_pixels8x8_10_c +# define avg_h264_qpel8_mc00_10_c ff_avg_pixels8x8_10_c +# define put_h264_qpel16_mc00_10_c ff_put_pixels16x16_10_c +# define avg_h264_qpel16_mc00_10_c ff_avg_pixels16x16_10_c +#endif void FUNCC(ff_put_pixels8x8)(uint8_t *dst, uint8_t *src, int stride) { FUNCC(put_pixels8)(dst, src, stride, 8); |