Commit d18e243f authored by Michael Niedermayer's avatar Michael Niedermayer

h264: merge _internal & template files.

seems git missed them and we temporary lost our improvments in them.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 3b6bbfa0
This diff is collapsed.
This diff is collapsed.
#include "dsputil.h"
#ifndef BIT_DEPTH
#define BIT_DEPTH 8
#endif
#ifdef AVCODEC_H264_HIGH_DEPTH_H
# undef pixel
# undef pixel2
# undef pixel4
# undef dctcoef
# undef INIT_CLIP
# undef no_rnd_avg_pixel4
# undef rnd_avg_pixel4
# undef AV_RN2P
# undef AV_RN4P
# undef AV_WN2P
# undef AV_WN4P
# undef AV_WN4PA
# undef CLIP
# undef FUNC
# undef FUNCC
# undef av_clip_pixel
# undef PIXEL_SPLAT_X4
#else
# define AVCODEC_H264_HIGH_DEPTH_H
# define CLIP_PIXEL(depth)\
static inline uint16_t av_clip_pixel_ ## depth (int p)\
{\
const int pixel_max = (1 << depth)-1;\
return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\
}
CLIP_PIXEL( 9)
CLIP_PIXEL(10)
#endif
#if BIT_DEPTH > 8
# define pixel uint16_t
# define pixel2 uint32_t
# define pixel4 uint64_t
# define dctcoef int32_t
# define INIT_CLIP
# define no_rnd_avg_pixel4 no_rnd_avg64
# define rnd_avg_pixel4 rnd_avg64
# define AV_RN2P AV_RN32
# define AV_RN4P AV_RN64
# define AV_WN2P AV_WN32
# define AV_WN4P AV_WN64
# define AV_WN4PA AV_WN64A
# define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
#else
# define pixel uint8_t
# define pixel2 uint16_t
# define pixel4 uint32_t
# define dctcoef int16_t
# define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
# define no_rnd_avg_pixel4 no_rnd_avg32
# define rnd_avg_pixel4 rnd_avg32
# define AV_RN2P AV_RN16
# define AV_RN4P AV_RN32
# define AV_WN2P AV_WN16
# define AV_WN4P AV_WN32
# define AV_WN4PA AV_WN32A
# define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
#endif
#if BIT_DEPTH == 8
# define av_clip_pixel(a) av_clip_uint8(a)
# define CLIP(a) cm[a]
# define FUNC(a) a ## _8
# define FUNCC(a) a ## _8_c
#elif BIT_DEPTH == 9
# define av_clip_pixel(a) av_clip_pixel_9(a)
# define CLIP(a) av_clip_pixel_9(a)
# define FUNC(a) a ## _9
# define FUNCC(a) a ## _9_c
#elif BIT_DEPTH == 10
# define av_clip_pixel(a) av_clip_pixel_10(a)
# define CLIP(a) av_clip_pixel_10(a)
# define FUNC(a) a ## _10
# define FUNCC(a) a ## _10_c
#endif
This diff is collapsed.
/*
* H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
* Copyright (c) 2003-2010 Michael Niedermayer <michaelni@gmx.at>
* Copyright (c) 2003-2011 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of Libav.
* This file is part of FFmpeg.
*
* Libav is free software; you can redistribute it and/or
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
......@@ -30,10 +30,10 @@
#define op_scale1(x) block[x] = av_clip_pixel( (block[x]*weight + offset) >> log2_denom )
#define op_scale2(x) dst[x] = av_clip_pixel( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1))
#define H264_WEIGHT(W,H) \
static void FUNCC(weight_h264_pixels ## W ## x ## H)(uint8_t *_block, int stride, int log2_denom, int weight, int offset){ \
static void FUNCC(weight_h264_pixels ## W ## x ## H)(uint8_t *p_block, int stride, int log2_denom, int weight, int offset){ \
int y; \
pixel *block = (pixel*)_block; \
stride /= sizeof(pixel); \
pixel *block = (pixel*)p_block; \
stride >>= sizeof(pixel)-1; \
offset <<= (log2_denom + (BIT_DEPTH-8)); \
if(log2_denom) offset += 1<<(log2_denom-1); \
for(y=0; y<H; y++, block += stride){ \
......@@ -58,11 +58,11 @@ static void FUNCC(weight_h264_pixels ## W ## x ## H)(uint8_t *_block, int stride
op_scale1(15); \
} \
} \
static void FUNCC(biweight_h264_pixels ## W ## x ## H)(uint8_t *_dst, uint8_t *_src, int stride, int log2_denom, int weightd, int weights, int offset){ \
static void FUNCC(biweight_h264_pixels ## W ## x ## H)(uint8_t *p_dst, uint8_t *p_src, int stride, int log2_denom, int weightd, int weights, int offset){ \
int y; \
pixel *dst = (pixel*)_dst; \
pixel *src = (pixel*)_src; \
stride /= sizeof(pixel); \
pixel *dst = (pixel*)p_dst; \
pixel *src = (pixel*)p_src; \
stride >>= sizeof(pixel)-1; \
offset = ((offset + 1) | 1) << log2_denom; \
for(y=0; y<H; y++, dst += stride, src += stride){ \
op_scale2(0); \
......@@ -102,12 +102,12 @@ H264_WEIGHT(2,2)
#undef op_scale2
#undef H264_WEIGHT
static av_always_inline av_flatten void FUNCC(h264_loop_filter_luma)(uint8_t *_pix, int xstride, int ystride, int inner_iters, int alpha, int beta, int8_t *tc0)
static av_always_inline av_flatten void FUNCC(h264_loop_filter_luma)(uint8_t *p_pix, int xstride, int ystride, int inner_iters, int alpha, int beta, int8_t *tc0)
{
pixel *pix = (pixel*)_pix;
pixel *pix = (pixel*)p_pix;
int i, d;
xstride /= sizeof(pixel);
ystride /= sizeof(pixel);
xstride >>= sizeof(pixel)-1;
ystride >>= sizeof(pixel)-1;
alpha <<= BIT_DEPTH - 8;
beta <<= BIT_DEPTH - 8;
for( i = 0; i < 4; i++ ) {
......@@ -163,12 +163,12 @@ static void FUNCC(h264_h_loop_filter_luma_mbaff)(uint8_t *pix, int stride, int a
FUNCC(h264_loop_filter_luma)(pix, sizeof(pixel), stride, 2, alpha, beta, tc0);
}
static av_always_inline av_flatten void FUNCC(h264_loop_filter_luma_intra)(uint8_t *_pix, int xstride, int ystride, int inner_iters, int alpha, int beta)
static av_always_inline av_flatten void FUNCC(h264_loop_filter_luma_intra)(uint8_t *p_pix, int xstride, int ystride, int inner_iters, int alpha, int beta)
{
pixel *pix = (pixel*)_pix;
pixel *pix = (pixel*)p_pix;
int d;
xstride /= sizeof(pixel);
ystride /= sizeof(pixel);
xstride >>= sizeof(pixel)-1;
ystride >>= sizeof(pixel)-1;
alpha <<= BIT_DEPTH - 8;
beta <<= BIT_DEPTH - 8;
for( d = 0; d < 4 * inner_iters; d++ ) {
......@@ -229,14 +229,14 @@ static void FUNCC(h264_h_loop_filter_luma_mbaff_intra)(uint8_t *pix, int stride,
FUNCC(h264_loop_filter_luma_intra)(pix, sizeof(pixel), stride, 2, alpha, beta);
}
static av_always_inline av_flatten void FUNCC(h264_loop_filter_chroma)(uint8_t *_pix, int xstride, int ystride, int inner_iters, int alpha, int beta, int8_t *tc0)
static av_always_inline av_flatten void FUNCC(h264_loop_filter_chroma)(uint8_t *p_pix, int xstride, int ystride, int inner_iters, int alpha, int beta, int8_t *tc0)
{
pixel *pix = (pixel*)_pix;
pixel *pix = (pixel*)p_pix;
int i, d;
xstride /= sizeof(pixel);
ystride /= sizeof(pixel);
alpha <<= BIT_DEPTH - 8;
beta <<= BIT_DEPTH - 8;
xstride >>= sizeof(pixel)-1;
ystride >>= sizeof(pixel)-1;
for( i = 0; i < 4; i++ ) {
const int tc = ((tc0[i] - 1) << (BIT_DEPTH - 8)) + 1;
if( tc <= 0 ) {
......@@ -275,12 +275,12 @@ static void FUNCC(h264_h_loop_filter_chroma_mbaff)(uint8_t *pix, int stride, int
FUNCC(h264_loop_filter_chroma)(pix, sizeof(pixel), stride, 1, alpha, beta, tc0);
}
static av_always_inline av_flatten void FUNCC(h264_loop_filter_chroma_intra)(uint8_t *_pix, int xstride, int ystride, int inner_iters, int alpha, int beta)
static av_always_inline av_flatten void FUNCC(h264_loop_filter_chroma_intra)(uint8_t *p_pix, int xstride, int ystride, int inner_iters, int alpha, int beta)
{
pixel *pix = (pixel*)_pix;
pixel *pix = (pixel*)p_pix;
int d;
xstride /= sizeof(pixel);
ystride /= sizeof(pixel);
xstride >>= sizeof(pixel)-1;
ystride >>= sizeof(pixel)-1;
alpha <<= BIT_DEPTH - 8;
beta <<= BIT_DEPTH - 8;
for( d = 0; d < 4 * inner_iters; d++ ) {
......
This diff is collapsed.
......@@ -2,20 +2,20 @@
* H.264 IDCT
* Copyright (c) 2004-2011 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of Libav.
* This file is part of FFmpeg.
*
* Libav is free software; you can redistribute it and/or
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
......@@ -25,7 +25,7 @@
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#include "high_bit_depth.h"
#include "h264_high_depth.h"
#ifndef AVCODEC_H264IDCT_INTERNAL_H
#define AVCODEC_H264IDCT_INTERNAL_H
......@@ -42,12 +42,12 @@ static const uint8_t scan8[16 + 2*4]={
};
#endif
static av_always_inline void FUNCC(idct_internal)(uint8_t *_dst, DCTELEM *_block, int stride, int block_stride, int shift, int add){
static av_always_inline void FUNCC(idct_internal)(uint8_t *p_dst, DCTELEM *p_block, int stride, int block_stride, int shift, int add){
int i;
INIT_CLIP
pixel *dst = (pixel*)_dst;
dctcoef *block = (dctcoef*)_block;
stride /= sizeof(pixel);
pixel *dst = (pixel*)p_dst;
dctcoef *block = (dctcoef*)p_block;
stride >>= sizeof(pixel)-1;
block[0] += 1<<(shift-1);
......@@ -88,12 +88,12 @@ void FUNCC(ff_h264_lowres_idct_put)(uint8_t *dst, int stride, DCTELEM *block){
FUNCC(idct_internal)(dst, block, stride, 8, 3, 0);
}
void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, DCTELEM *_block, int stride){
void FUNCC(ff_h264_idct8_add)(uint8_t *p_dst, DCTELEM *p_block, int stride){
int i;
INIT_CLIP
pixel *dst = (pixel*)_dst;
dctcoef *block = (dctcoef*)_block;
stride /= sizeof(pixel);
pixel *dst = (pixel*)p_dst;
dctcoef *block = (dctcoef*)p_block;
stride >>= sizeof(pixel)-1;
block[0] += 32;
......@@ -162,12 +162,12 @@ void FUNCC(ff_h264_idct8_add)(uint8_t *_dst, DCTELEM *_block, int stride){
}
// assumes all AC coefs are 0
void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){
void FUNCC(ff_h264_idct_dc_add)(uint8_t *p_dst, DCTELEM *block, int stride){
int i, j;
int dc = (((dctcoef*)block)[0] + 32) >> 6;
INIT_CLIP
pixel *dst = (pixel*)_dst;
stride /= sizeof(pixel);
pixel *dst = (pixel*)p_dst;
stride >>= sizeof(pixel)-1;
for( j = 0; j < 4; j++ )
{
for( i = 0; i < 4; i++ )
......@@ -176,12 +176,12 @@ void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){
}
}
void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){
void FUNCC(ff_h264_idct8_dc_add)(uint8_t *p_dst, DCTELEM *block, int stride){
int i, j;
int dc = (((dctcoef*)block)[0] + 32) >> 6;
INIT_CLIP
pixel *dst = (pixel*)_dst;
stride /= sizeof(pixel);
pixel *dst = (pixel*)p_dst;
stride >>= sizeof(pixel)-1;
for( j = 0; j < 8; j++ )
{
for( i = 0; i < 8; i++ )
......@@ -233,13 +233,13 @@ void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset, DCTELEM *
* IDCT transforms the 16 dc values and dequantizes them.
* @param qp quantization parameter
*/
void FUNCC(ff_h264_luma_dc_dequant_idct)(DCTELEM *_output, DCTELEM *_input, int qmul){
void FUNCC(ff_h264_luma_dc_dequant_idct)(DCTELEM *p_output, DCTELEM *p_input, int qmul){
#define stride 16
int i;
int temp[16];
static const uint8_t x_offset[4]={0, 2*stride, 8*stride, 10*stride};
dctcoef *input = (dctcoef*)_input;
dctcoef *output = (dctcoef*)_output;
dctcoef *input = (dctcoef*)p_input;
dctcoef *output = (dctcoef*)p_output;
for(i=0; i<4; i++){
const int z0= input[4*i+0] + input[4*i+1];
......@@ -268,11 +268,11 @@ void FUNCC(ff_h264_luma_dc_dequant_idct)(DCTELEM *_output, DCTELEM *_input, int
#undef stride
}
void FUNCC(ff_h264_chroma_dc_dequant_idct)(DCTELEM *_block, int qmul){
void FUNCC(ff_h264_chroma_dc_dequant_idct)(DCTELEM *p_block, int qmul){
const int stride= 16*2;
const int xStride= 16;
int a,b,c,d,e;
dctcoef *block = (dctcoef*)_block;
dctcoef *block = (dctcoef*)p_block;
a= block[stride*0 + xStride*0];
b= block[stride*0 + xStride*1];
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment