summaryrefslogtreecommitdiff
path: root/contrib/ffmpeg/libpostproc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/libpostproc')
-rw-r--r--contrib/ffmpeg/libpostproc/Makefile14
-rw-r--r--contrib/ffmpeg/libpostproc/mangle.h47
-rw-r--r--contrib/ffmpeg/libpostproc/postprocess.c96
-rw-r--r--contrib/ffmpeg/libpostproc/postprocess.h42
-rw-r--r--contrib/ffmpeg/libpostproc/postprocess_altivec_template.c14
-rw-r--r--contrib/ffmpeg/libpostproc/postprocess_internal.h29
-rw-r--r--contrib/ffmpeg/libpostproc/postprocess_template.c41
7 files changed, 105 insertions, 178 deletions
diff --git a/contrib/ffmpeg/libpostproc/Makefile b/contrib/ffmpeg/libpostproc/Makefile
index d30b4a18d..8a285c6b0 100644
--- a/contrib/ffmpeg/libpostproc/Makefile
+++ b/contrib/ffmpeg/libpostproc/Makefile
@@ -1,24 +1,14 @@
include ../config.mak
-# Overload incdir, postproc include files go in a different directory.
-incdir=$(prefix)/include/postproc
-
EXTRALIBS := -L$(BUILD_ROOT)/libavutil -lavutil$(BUILDSUF) $(EXTRALIBS)
NAME=postproc
LIBVERSION=$(SPPVERSION)
LIBMAJOR=$(SPPMAJOR)
-STATIC_OBJS=postprocess.o
-SHARED_OBJS=postprocess_pic.o
-
HEADERS = postprocess.h
-include ../common.mak
-
-depend dep: postprocess.c
-
-postprocess_pic.o: postprocess.c
- $(CC) -c $(CFLAGS) -fomit-frame-pointer -fPIC -DPIC -o $@ $<
+OBJS = postprocess.o
+include ../common.mak
diff --git a/contrib/ffmpeg/libpostproc/mangle.h b/contrib/ffmpeg/libpostproc/mangle.h
deleted file mode 100644
index 3521fa9bb..000000000
--- a/contrib/ffmpeg/libpostproc/mangle.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * mangle.h - This file has some CPP macros to deal with different symbol
- * mangling across binary formats.
- *
- * (c)2002 by Felix Buenemann <atmosfear at users.sourceforge.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __MANGLE_H
-#define __MANGLE_H
-
-/* Feel free to add more to the list, eg. a.out IMO */
-/* Use rip-relative addressing if compiling PIC code on x86-64. */
-#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__OS2__) || \
- (defined(__OpenBSD__) && !defined(__ELF__))
-#if defined(ARCH_X86_64) && defined(PIC)
-#define MANGLE(a) "_" #a"(%%rip)"
-#else
-#define MANGLE(a) "_" #a
-#endif
-#else
-#if defined(ARCH_X86_64) && defined(PIC)
-#define MANGLE(a) #a"(%%rip)"
-#elif defined(CONFIG_DARWIN)
-#define MANGLE(a) "_" #a
-#else
-#define MANGLE(a) #a
-#endif
-#endif
-
-#endif /* !__MANGLE_H */
-
diff --git a/contrib/ffmpeg/libpostproc/postprocess.c b/contrib/ffmpeg/libpostproc/postprocess.c
index f68c8a723..b274bb47c 100644
--- a/contrib/ffmpeg/libpostproc/postprocess.c
+++ b/contrib/ffmpeg/libpostproc/postprocess.c
@@ -47,8 +47,8 @@ LinBlendDeinterlace e E E*
MedianDeinterlace# E Ec Ec
TempDeNoiser# E e e Ec
-* i dont have a 3dnow CPU -> its untested, but noone said it doesnt work so it seems to work
-# more or less selfinvented filters so the exactness isnt too meaningfull
+* i do not have a 3DNow! CPU -> it is untested, but no one said it does not work so it seems to work
+# more or less selfinvented filters so the exactness is not too meaningful
E = Exact implementation
e = allmost exact implementation (slightly different rounding,...)
a = alternative / approximate impl
@@ -87,14 +87,9 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
//#undef HAVE_MMX
//#undef ARCH_X86
//#define DEBUG_BRIGHTNESS
-#ifdef USE_FASTMEMCPY
-#include "libvo/fastmemcpy.h"
-#endif
#include "postprocess.h"
#include "postprocess_internal.h"
-#include "mangle.h" //FIXME should be supressed
-
#ifdef HAVE_ALTIVEC_H
#include <altivec.h>
#endif
@@ -106,20 +101,17 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
#if defined(ARCH_X86)
-static uint64_t __attribute__((aligned(8))) attribute_used w05= 0x0005000500050005LL;
-static uint64_t __attribute__((aligned(8))) attribute_used w04= 0x0004000400040004LL;
-static uint64_t __attribute__((aligned(8))) attribute_used w20= 0x0020002000200020LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b00= 0x0000000000000000LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b01= 0x0101010101010101LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b02= 0x0202020202020202LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b08= 0x0808080808080808LL;
-static uint64_t __attribute__((aligned(8))) attribute_used b80= 0x8080808080808080LL;
+DECLARE_ASM_CONST(8, uint64_t, w05)= 0x0005000500050005LL;
+DECLARE_ASM_CONST(8, uint64_t, w04)= 0x0004000400040004LL;
+DECLARE_ASM_CONST(8, uint64_t, w20)= 0x0020002000200020LL;
+DECLARE_ASM_CONST(8, uint64_t, b00)= 0x0000000000000000LL;
+DECLARE_ASM_CONST(8, uint64_t, b01)= 0x0101010101010101LL;
+DECLARE_ASM_CONST(8, uint64_t, b02)= 0x0202020202020202LL;
+DECLARE_ASM_CONST(8, uint64_t, b08)= 0x0808080808080808LL;
+DECLARE_ASM_CONST(8, uint64_t, b80)= 0x8080808080808080LL;
#endif
-static uint8_t clip_table[3*256];
-static uint8_t * const clip_tab= clip_table + 256;
-
-static const int attribute_used deringThreshold= 20;
+DECLARE_ASM_CONST(8, int, deringThreshold)= 20;
static struct PPFilter filters[]=
@@ -147,11 +139,11 @@ static struct PPFilter filters[]=
static const char *replaceTable[]=
{
- "default", "hdeblock:a,vdeblock:a,dering:a",
- "de", "hdeblock:a,vdeblock:a,dering:a",
- "fast", "x1hdeblock:a,x1vdeblock:a,dering:a",
- "fa", "x1hdeblock:a,x1vdeblock:a,dering:a",
- "ac", "ha:a:128:7,va:a,dering:a",
+ "default", "hb:a,vb:a,dr:a",
+ "de", "hb:a,vb:a,dr:a",
+ "fast", "h1:a,v1:a,dr:a",
+ "fa", "h1:a,v1:a,dr:a",
+ "ac", "ha:a:128:7,va:a,dr:a",
NULL //End Marker
};
@@ -401,8 +393,8 @@ static inline void doHorizLowPass_C(uint8_t dst[], int stride, PPContext *c)
* Experimental Filter 1 (Horizontal)
* will not damage linear gradients
* Flat blocks should look like they where passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter
- * can only smooth blocks at the expected locations (it cant smooth them if they did move)
- * MMX2 version does correct clipping C version doesnt
+ * can only smooth blocks at the expected locations (it cannot smooth them if they did move)
+ * MMX2 version does correct clipping C version does not
* not identical with the vertical one
*/
static inline void horizX1Filter(uint8_t *src, int stride, int QP)
@@ -649,18 +641,18 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, int step, int stride,
#include "postprocess_template.c"
#endif
-// minor note: the HAVE_xyz is messed up after that line so dont use it
+// minor note: the HAVE_xyz is messed up after that line so do not use it.
-static inline void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
- QP_STORE_T QPs[], int QPStride, int isColor, pp_mode_t *vm, pp_context_t *vc)
+static inline void postProcess(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
+ const QP_STORE_T QPs[], int QPStride, int isColor, pp_mode_t *vm, pp_context_t *vc)
{
PPContext *c= (PPContext *)vc;
PPMode *ppMode= (PPMode *)vm;
c->ppMode= *ppMode; //FIXME
- // useing ifs here as they are faster than function pointers allthough the
- // difference wouldnt be messureable here but its much better because
- // someone might exchange the cpu whithout restarting mplayer ;)
+ // Using ifs here as they are faster than function pointers although the
+ // difference would not be measureable here but it is much better because
+ // someone might exchange the CPU whithout restarting MPlayer ;)
#ifdef RUNTIME_CPUDETECT
#if defined(ARCH_X86)
// ordered per speed fasterst first
@@ -702,7 +694,11 @@ static inline void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int
/* -pp Command line Help
*/
-char *pp_help=
+#if LIBPOSTPROC_VERSION_INT < (52<<16)
+const char *const pp_help=
+#else
+const char pp_help[] =
+#endif
"Available postprocessing filters:\n"
"Filters Options\n"
"short long name short long option Description\n"
@@ -746,12 +742,12 @@ char *pp_help=
"\n"
;
-pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality)
+pp_mode_t *pp_get_mode_by_name_and_quality(const char *name, int quality)
{
char temp[GET_MODE_BUFFER_SIZE];
char *p= temp;
- const char *filterDelimiters= ",/";
- const char *optionDelimiters= ":";
+ static const char filterDelimiters[] = ",/";
+ static const char optionDelimiters[] = ":";
struct PPMode *ppMode;
char *filterToken;
@@ -964,7 +960,7 @@ static void reallocBuffers(PPContext *c, int width, int height, int stride, int
for(i=0; i<3; i++)
{
- //Note:the +17*1024 is just there so i dont have to worry about r/w over te end
+ //Note: The +17*1024 is just there so i do not have to worry about r/w over the end.
reallocAlign((void **)&c->tempBlured[i], 8, stride*mbHeight*16 + 17*1024);
reallocAlign((void **)&c->tempBluredPast[i], 8, 256*((height+7)&(~7))/2 + 17*1024);//FIXME size
}
@@ -975,27 +971,17 @@ static void reallocBuffers(PPContext *c, int width, int height, int stride, int
reallocAlign((void **)&c->forcedQPTable, 8, mbWidth*sizeof(QP_STORE_T));
}
-static void global_init(void){
- int i;
- memset(clip_table, 0, 256);
- for(i=256; i<512; i++)
- clip_table[i]= i;
- memset(clip_table+512, 0, 256);
-}
-
static const char * context_to_name(void * ptr) {
return "postproc";
}
-static AVClass av_codec_context_class = { "Postproc", context_to_name, NULL };
+static const AVClass av_codec_context_class = { "Postproc", context_to_name, NULL };
pp_context_t *pp_get_context(int width, int height, int cpuCaps){
PPContext *c= av_malloc(sizeof(PPContext));
int stride= (width+15)&(~15); //assumed / will realloc if needed
int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed
- global_init();
-
memset(c, 0, sizeof(PPContext));
c->av_class = &av_codec_context_class;
c->cpuCaps= cpuCaps;
@@ -1035,10 +1021,10 @@ void pp_free_context(void *vc){
av_free(c);
}
-void pp_postprocess(uint8_t * src[3], int srcStride[3],
- uint8_t * dst[3], int dstStride[3],
+void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
+ uint8_t * dst[3], const int dstStride[3],
int width, int height,
- QP_STORE_T *QP_store, int QPStride,
+ const QP_STORE_T *QP_store, int QPStride,
pp_mode_t *vm, void *vc, int pict_type)
{
int mbWidth = (width+15)>>4;
@@ -1060,16 +1046,16 @@ void pp_postprocess(uint8_t * src[3], int srcStride[3],
QP_store= c->forcedQPTable;
absQPStride = QPStride = 0;
if(mode->lumMode & FORCE_QUANT)
- for(i=0; i<mbWidth; i++) QP_store[i]= mode->forcedQuant;
+ for(i=0; i<mbWidth; i++) c->forcedQPTable[i]= mode->forcedQuant;
else
- for(i=0; i<mbWidth; i++) QP_store[i]= 1;
+ for(i=0; i<mbWidth; i++) c->forcedQPTable[i]= 1;
}
if(pict_type & PP_PICT_TYPE_QP2){
int i;
const int count= mbHeight * absQPStride;
for(i=0; i<(count>>2); i++){
- ((uint32_t*)c->stdQPTable)[i] = (((uint32_t*)QP_store)[i]>>1) & 0x7F7F7F7F;
+ ((uint32_t*)c->stdQPTable)[i] = (((const uint32_t*)QP_store)[i]>>1) & 0x7F7F7F7F;
}
for(i<<=2; i<count; i++){
c->stdQPTable[i] = QP_store[i]>>1;
@@ -1095,7 +1081,7 @@ for(y=0; y<mbHeight; y++){
int i;
const int count= mbHeight * QPStride;
for(i=0; i<(count>>2); i++){
- ((uint32_t*)c->nonBQPTable)[i] = ((uint32_t*)QP_store)[i] & 0x3F3F3F3F;
+ ((uint32_t*)c->nonBQPTable)[i] = ((const uint32_t*)QP_store)[i] & 0x3F3F3F3F;
}
for(i<<=2; i<count; i++){
c->nonBQPTable[i] = QP_store[i] & 0x3F;
diff --git a/contrib/ffmpeg/libpostproc/postprocess.h b/contrib/ffmpeg/libpostproc/postprocess.h
index eed92ba6d..818fb41ba 100644
--- a/contrib/ffmpeg/libpostproc/postprocess.h
+++ b/contrib/ffmpeg/libpostproc/postprocess.h
@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef NEWPOSTPROCESS_H
-#define NEWPOSTPROCESS_H
+#ifndef FFMPEG_POSTPROCESS_H
+#define FFMPEG_POSTPROCESS_H
/**
* @file postprocess.h
@@ -27,12 +27,18 @@
* external api for the pp stuff
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "libavutil/avutil.h"
+
+#define LIBPOSTPROC_VERSION_MAJOR 51
+#define LIBPOSTPROC_VERSION_MINOR 1
+#define LIBPOSTPROC_VERSION_MICRO 0
-#define LIBPOSTPROC_VERSION_INT ((51<<16)+(1<<8)+0)
-#define LIBPOSTPROC_VERSION 51.1.0
+#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
+ LIBPOSTPROC_VERSION_MINOR, \
+ LIBPOSTPROC_VERSION_MICRO)
+#define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \
+ LIBPOSTPROC_VERSION_MINOR, \
+ LIBPOSTPROC_VERSION_MICRO)
#define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT
#define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION)
@@ -41,15 +47,21 @@ extern "C" {
#define QP_STORE_T int8_t
+#include <inttypes.h>
+
typedef void pp_context_t;
typedef void pp_mode_t;
-extern char *pp_help; ///< a simple help text
+#if LIBPOSTPROC_VERSION_INT < (52<<16)
+extern const char *const pp_help; ///< a simple help text
+#else
+extern const char pp_help[]; ///< a simple help text
+#endif
-void pp_postprocess(uint8_t * src[3], int srcStride[3],
- uint8_t * dst[3], int dstStride[3],
+void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
+ uint8_t * dst[3], const int dstStride[3],
int horizontalSize, int verticalSize,
- QP_STORE_T *QP_store, int QP_stride,
+ const QP_STORE_T *QP_store, int QP_stride,
pp_mode_t *mode, pp_context_t *ppContext, int pict_type);
@@ -58,7 +70,7 @@ void pp_postprocess(uint8_t * src[3], int srcStride[3],
* name is the string after "-pp" on the command line
* quality is a number from 0 to PP_QUALITY_MAX
*/
-pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality);
+pp_mode_t *pp_get_mode_by_name_and_quality(const char *name, int quality);
void pp_free_mode(pp_mode_t *mode);
pp_context_t *pp_get_context(int width, int height, int flags);
@@ -77,8 +89,4 @@ void pp_free_context(pp_context_t *ppContext);
#define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+#endif /* FFMPEG_POSTPROCESS_H */
diff --git a/contrib/ffmpeg/libpostproc/postprocess_altivec_template.c b/contrib/ffmpeg/libpostproc/postprocess_altivec_template.c
index 6a76c0eb7..e93ce7ef8 100644
--- a/contrib/ffmpeg/libpostproc/postprocess_altivec_template.c
+++ b/contrib/ffmpeg/libpostproc/postprocess_altivec_template.c
@@ -22,12 +22,6 @@
#include "avutil.h"
-#ifdef CONFIG_DARWIN
-#define AVV(x...) (x)
-#else
-#define AVV(x...) {x}
-#endif
-
#define ALTIVEC_TRANSPOSE_8x8_SHORT(src_a,src_b,src_c,src_d,src_e,src_f,src_g,src_h) \
do { \
__typeof__(src_a) tempA1, tempB1, tempC1, tempD1; \
@@ -200,7 +194,7 @@ static inline void doVertLowPass_altivec(uint8_t *src, int stride, PPContext *c)
One could remove the recomputation of the perm
vector by assuming (stride % 16) == 0, unfortunately
this is not always true. Quite a lot of load/stores
- can be removed by assuming proper alignement of
+ can be removed by assuming proper alignment of
src & stride :-(
*/
uint8_t *src2 = src;
@@ -388,7 +382,7 @@ static inline void doVertDefFilter_altivec(uint8_t src[], int stride, PPContext
One could remove the recomputation of the perm
vector by assuming (stride % 16) == 0, unfortunately
this is not always true. Quite a lot of load/stores
- can be removed by assuming proper alignement of
+ can be removed by assuming proper alignment of
src & stride :-(
*/
uint8_t *src2 = src;
@@ -475,7 +469,7 @@ static inline void doVertDefFilter_altivec(uint8_t src[], int stride, PPContext
const vector signed short dornotd = vec_sel((vector signed short)zero,
dclampedfinal,
vec_cmplt(absmE, vqp));
- /* add/substract to l4 and l5 */
+ /* add/subtract to l4 and l5 */
const vector signed short vb4minusd = vec_sub(vb4, dornotd);
const vector signed short vb5plusd = vec_add(vb5, dornotd);
/* finally, stores */
@@ -512,7 +506,7 @@ static inline void dering_altivec(uint8_t src[], int stride, PPContext *c) {
One could remove the recomputation of the perm
vector by assuming (stride % 16) == 0, unfortunately
this is not always true. Quite a lot of load/stores
- can be removed by assuming proper alignement of
+ can be removed by assuming proper alignment of
src & stride :-(
*/
uint8_t *srcCopy = src;
diff --git a/contrib/ffmpeg/libpostproc/postprocess_internal.h b/contrib/ffmpeg/libpostproc/postprocess_internal.h
index 537d728c0..f2d40e1d5 100644
--- a/contrib/ffmpeg/libpostproc/postprocess_internal.h
+++ b/contrib/ffmpeg/libpostproc/postprocess_internal.h
@@ -23,7 +23,11 @@
* internal api header.
*/
+#ifndef FFMPEG_POSTPROCESS_INTERNAL_H
+#define FFMPEG_POSTPROCESS_INTERNAL_H
+
#include "avutil.h"
+#include "postprocess.h"
#define V_DEBLOCK 0x01
#define H_DEBLOCK 0x02
@@ -62,27 +66,16 @@
#define TEMP_NOISE_FILTER 0x100000
#define FORCE_QUANT 0x200000
-#if ( defined(__PIC__) || defined(__pic__) ) && ! defined(PIC)
-# define PIC
-#endif
-
-//use if u want a faster postprocessing code
-//cant differentiate between chroma & luma filters (both on or both off)
-//obviosly the -pp option at the commandline has no effect except turning the here selected
+//use if you want a faster postprocessing code
+//cannot differentiate between chroma & luma filters (both on or both off)
+//obviously the -pp option on the command line has no effect except turning the here selected
//filters on
//#define COMPILE_TIME_MODE 0x77
-#if 1
static inline int CLIP(int a){
if(a&256) return ((a)>>31)^(-1);
else return a;
}
-//#define CLIP(a) (((a)&256) ? ((a)>>31)^(-1) : (a))
-#elif 0
-#define CLIP(a) clip_tab[a]
-#else
-#define CLIP(a) (a)
-#endif
/**
* Postprocessng filter.
*/
@@ -122,7 +115,7 @@ typedef struct PPContext{
/**
* info on struct for av_log
*/
- AVClass *av_class;
+ const AVClass *av_class;
uint8_t *tempBlocks; ///<used for the horizontal code
@@ -173,11 +166,13 @@ typedef struct PPContext{
} PPContext;
-static inline void linecpy(void *dest, void *src, int lines, int stride)
+static inline void linecpy(void *dest, const void *src, int lines, int stride)
{
if (stride > 0) {
memcpy(dest, src, lines*stride);
} else {
- memcpy(dest+(lines-1)*stride, src+(lines-1)*stride, -lines*stride);
+ memcpy((uint8_t*)dest+(lines-1)*stride, (const uint8_t*)src+(lines-1)*stride, -lines*stride);
}
}
+
+#endif /* FFMPEG_POSTPROCESS_INTERNAL_H */
diff --git a/contrib/ffmpeg/libpostproc/postprocess_template.c b/contrib/ffmpeg/libpostproc/postprocess_template.c
index f084130a6..bdc23250a 100644
--- a/contrib/ffmpeg/libpostproc/postprocess_template.c
+++ b/contrib/ffmpeg/libpostproc/postprocess_template.c
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ */
/**
* @file postprocess_template.c
@@ -73,7 +73,7 @@
"paddb " #a ", " #b " \n\t"
#endif
-//FIXME? |255-0| = 1 (shouldnt be a problem ...)
+//FIXME? |255-0| = 1 (should not be a problem ...)
#ifdef HAVE_MMX
/**
* Check if the middle 8x8 Block in the given 8x16 block is flat
@@ -373,7 +373,8 @@ static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c)
* Experimental implementation of the filter (Algorithm 1) described in a paper from Ramkishor & Karandikar
* values are correctly clipped (MMX2)
* values are wraparound (C)
- * conclusion: its fast, but introduces ugly horizontal patterns if there is a continious gradient
+ * Conclusion: It is fast, but introduces ugly horizontal patterns
+ * if there is a continuous gradient.
0 8 16 24
x = 8
x/2 = 4
@@ -478,8 +479,8 @@ static inline void RENAME(vertRK1Filter)(uint8_t *src, int stride, int QP)
* Experimental Filter 1
* will not damage linear gradients
* Flat blocks should look like they where passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter
- * can only smooth blocks at the expected locations (it cant smooth them if they did move)
- * MMX2 version does correct clipping C version doesnt
+ * can only smooth blocks at the expected locations (it cannot smooth them if they did move)
+ * MMX2 version does correct clipping C version does not
*/
static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co)
{
@@ -3179,16 +3180,16 @@ asm volatile(
}
#endif //HAVE_MMX
-static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
- QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c);
+static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
+ const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c);
/**
- * Copies a block from src to dst and fixes the blacklevel
- * levelFix == 0 -> dont touch the brighness & contrast
+ * Copies a block from src to dst and fixes the blacklevel.
+ * levelFix == 0 -> do not touch the brighness & contrast
*/
#undef SCALED_CPY
-static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, uint8_t src[], int srcStride,
+static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, const uint8_t src[], int srcStride,
int levelFix, int64_t *packedOffsetAndScale)
{
#ifndef HAVE_MMX
@@ -3345,10 +3346,10 @@ static inline void RENAME(duplicate)(uint8_t src[], int stride)
/**
* Filters array of bytes (Y or U or V values)
*/
-static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
- QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2)
+static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
+ const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2)
{
- PPContext __attribute__((aligned(8))) c= *c2; //copy to stack for faster access
+ DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access
int x,y;
#ifdef COMPILE_TIME_MODE
const int mode= COMPILE_TIME_MODE;
@@ -3415,7 +3416,7 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int
sum+= yHistogram[i];
}
- /* we allways get a completly black picture first */
+ /* We always get a completely black picture first. */
maxClipped= (uint64_t)(sum * c.ppMode.maxClippedThreshold);
clipped= sum;
@@ -3461,7 +3462,7 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int
/* copy & deinterlace first row of blocks */
y=-BLOCK_SIZE;
{
- uint8_t *srcBlock= &(src[y*srcStride]);
+ const uint8_t *srcBlock= &(src[y*srcStride]);
uint8_t *dstBlock= tempDst + dstStride;
// From this point on it is guaranteed that we can read and write 16 lines downward
@@ -3498,7 +3499,7 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int
);
#elif defined(HAVE_3DNOW)
-//FIXME check if this is faster on an 3dnow chip or if its faster without the prefetch or ...
+//FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
/* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
@@ -3544,13 +3545,13 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int
for(y=0; y<height; y+=BLOCK_SIZE)
{
//1% speedup if these are here instead of the inner loop
- uint8_t *srcBlock= &(src[y*srcStride]);
+ const uint8_t *srcBlock= &(src[y*srcStride]);
uint8_t *dstBlock= &(dst[y*dstStride]);
#ifdef HAVE_MMX
uint8_t *tempBlock1= c.tempBlocks;
uint8_t *tempBlock2= c.tempBlocks + 8;
#endif
- int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
+ const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
int QP=0;
/* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards
@@ -3642,7 +3643,7 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int
);
#elif defined(HAVE_3DNOW)
-//FIXME check if this is faster on an 3dnow chip or if its faster without the prefetch or ...
+//FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
/* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
@@ -3717,7 +3718,7 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int
else if(mode & H_DEBLOCK)
{
#ifdef HAVE_ALTIVEC
- unsigned char __attribute__ ((aligned(16))) tempBlock[272];
+ DECLARE_ALIGNED(16, unsigned char, tempBlock[272]);
transpose_16x8_char_toPackedAlign_altivec(tempBlock, dstBlock - (4 + 1), stride);
const int t=vertClassify_altivec(tempBlock-48, 16, &c);