[FFmpeg-devel] [PATCH 1/2] Moved postprocessing routines from postprocess.c to seperate file

2015-03-12 Thread Tucker DiNapoli
This moves c functions to process blocks horozontally into a seperate
file, so that none of the postprocessing algorithms are in the main
postprecess.c file
---
 libpostproc/postprocess.c   | 352 +
 libpostproc/postprocess_c.c | 373 
 2 files changed, 374 insertions(+), 351 deletions(-)
 create mode 100644 libpostproc/postprocess_c.c

diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index 9d89782..86c0520 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -199,357 +199,7 @@ static inline void prefetcht2(const void *p)
 }
 #endif
 
-/* The horizontal functions exist only in C because the MMX
- * code is faster with vertical filters and transposing. */
-
-/**
- * Check if the given 8x8 Block is mostly flat
- */
-static inline int isHorizDC_C(const uint8_t src[], int stride, const PPContext 
*c)
-{
-int numEq= 0;
-int y;
-const int dcOffset= ((c-nonBQP*c-ppMode.baseDcDiff)8) + 1;
-const int dcThreshold= dcOffset*2 + 1;
-
-for(y=0; yBLOCK_SIZE; y++){
-numEq += ((unsigned)(src[0] - src[1] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[1] - src[2] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[2] - src[3] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[3] - src[4] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[4] - src[5] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[5] - src[6] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[6] - src[7] + dcOffset))  dcThreshold;
-src+= stride;
-}
-return numEq  c-ppMode.flatnessThreshold;
-}
-
-/**
- * Check if the middle 8x8 Block in the given 8x16 block is flat
- */
-static inline int isVertDC_C(const uint8_t src[], int stride, const PPContext 
*c)
-{
-int numEq= 0;
-int y;
-const int dcOffset= ((c-nonBQP*c-ppMode.baseDcDiff)8) + 1;
-const int dcThreshold= dcOffset*2 + 1;
-
-src+= stride*4; // src points to begin of the 8x8 Block
-for(y=0; yBLOCK_SIZE-1; y++){
-numEq += ((unsigned)(src[0] - src[0+stride] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[1] - src[1+stride] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[2] - src[2+stride] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[3] - src[3+stride] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[4] - src[4+stride] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[5] - src[5+stride] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[6] - src[6+stride] + dcOffset))  dcThreshold;
-numEq += ((unsigned)(src[7] - src[7+stride] + dcOffset))  dcThreshold;
-src+= stride;
-}
-return numEq  c-ppMode.flatnessThreshold;
-}
-
-static inline int isHorizMinMaxOk_C(const uint8_t src[], int stride, int QP)
-{
-int i;
-for(i=0; i2; i++){
-if((unsigned)(src[0] - src[5] + 2*QP)  4*QP) return 0;
-src += stride;
-if((unsigned)(src[2] - src[7] + 2*QP)  4*QP) return 0;
-src += stride;
-if((unsigned)(src[4] - src[1] + 2*QP)  4*QP) return 0;
-src += stride;
-if((unsigned)(src[6] - src[3] + 2*QP)  4*QP) return 0;
-src += stride;
-}
-return 1;
-}
-
-static inline int isVertMinMaxOk_C(const uint8_t src[], int stride, int QP)
-{
-int x;
-src+= stride*4;
-for(x=0; xBLOCK_SIZE; x+=4){
-if((unsigned)(src[  x + 0*stride] - src[  x + 5*stride] + 2*QP)  
4*QP) return 0;
-if((unsigned)(src[1+x + 2*stride] - src[1+x + 7*stride] + 2*QP)  
4*QP) return 0;
-if((unsigned)(src[2+x + 4*stride] - src[2+x + 1*stride] + 2*QP)  
4*QP) return 0;
-if((unsigned)(src[3+x + 6*stride] - src[3+x + 3*stride] + 2*QP)  
4*QP) return 0;
-}
-return 1;
-}
-
-static inline int horizClassify_C(const uint8_t src[], int stride, const 
PPContext *c)
-{
-if( isHorizDC_C(src, stride, c) ){
-return isHorizMinMaxOk_C(src, stride, c-QP);
-}else{
-return 2;
-}
-}
-
-static inline int vertClassify_C(const uint8_t src[], int stride, const 
PPContext *c)
-{
-if( isVertDC_C(src, stride, c) ){
-return isVertMinMaxOk_C(src, stride, c-QP);
-}else{
-return 2;
-}
-}
-
-static inline void doHorizDefFilter_C(uint8_t dst[], int stride, const 
PPContext *c)
-{
-int y;
-for(y=0; yBLOCK_SIZE; y++){
-const int middleEnergy= 5*(dst[4] - dst[3]) + 2*(dst[2] - dst[5]);
-
-if(FFABS(middleEnergy)  8*c-QP){
-const int q=(dst[3] - dst[4])/2;
-const int leftEnergy=  5*(dst[2] - dst[1]) + 2*(dst[0] - dst[3]);
-const int rightEnergy= 5*(dst[6] - dst[5]) + 2*(dst[4] - dst[7]);
-
-int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), 
FFABS(rightEnergy) );
-d= FFMAX(d, 0);
-
-d= (5*d + 32)  6;
-d*= FFSIGN(-middleEnergy);
-
-if(q0)
-

Re: [FFmpeg-devel] [PATCH 1/2] Moved postprocessing routines from postprocess.c to seperate file

2015-03-11 Thread Michael Niedermayer
On Wed, Mar 11, 2015 at 01:51:12PM -0400, Tucker DiNapoli wrote:
 This moves c functions to process blocks horozontally into a seperate
 file, so that none of the postprocessing algorithms are in the main
 postprecess.c file
[...]
 diff --git a/libpostproc/postprocess_c.c b/libpostproc/postprocess_c.c
 new file mode 100644
 index 000..bf22e95
 --- /dev/null
 +++ b/libpostproc/postprocess_c.c
 @@ -0,0 +1,373 @@
 +/**
 +* C implementation of postprocessing routines
 +* Copyright (C) 2001-2002 Michael Niedermayer (michae...@gmx.at)
 +* Copyright (c) 2015 Tucker DiNapoli
 +*
 +* This file is part of FFmpeg.
 +*
 +* 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.
 +*
 +* 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 FFmpeg; if not, write to the Free Software
 +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
 USA
 +**/

libpostproc is under GPL this is the LGPL license
also i suggest you add your name to the copyright when you made
significant changes to the code not when its copy and pasted

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel