changeset 183:d310beb2d848 libavcodec

-npp fq:<quantizer> force quantizer (for these lq movies which where reencoded at high bitrates) (c) 2002
author michael
date Thu, 03 Jan 2002 14:16:13 +0000
parents 3ccd74a91074
children 69d105cc6158
files libpostproc/postprocess.c libpostproc/postprocess.h
diffstat 2 files changed, 30 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpostproc/postprocess.c	Fri Dec 28 13:56:04 2001 +0000
+++ b/libpostproc/postprocess.c	Thu Jan 03 14:16:13 2002 +0000
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2001 Michael Niedermayer (michaelni@gmx.at)
+    Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at)
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -175,6 +175,7 @@
 	{"ci", "cubicipoldeint",	1, 1, 4, CUBIC_IPOL_DEINT_FILTER},
 	{"md", "mediandeint", 		1, 1, 4, MEDIAN_DEINT_FILTER},
 	{"tn", "tmpnoise", 		1, 7, 8, TEMP_NOISE_FILTER},
+	{"fq", "forcequant", 		1, 0, 0, FORCE_QUANT},
 	{NULL, NULL,0,0,0,0} //End Marker
 };
 
@@ -561,6 +562,7 @@
 fa	fast					x1hdeblock:a,x1vdeblock:a,dering:a,autolevels
 tn	tmpnoise	(3 Thresholds)		Temporal Noise Reducer
 			1. <= 2. <= 3. Threshold, larger means stronger filtering
+fq	forceQuant	<quantizer>		Force quantizer (for reencoded lq stuff)
 */
 
 /**
@@ -720,6 +722,21 @@
 						     vFlatnessThreshold= val;
 					}
 				}
+				else if(filters[i].mask == FORCE_QUANT)
+				{
+					int o;
+					ppMode.forcedQuant= 15;
+
+					for(o=0; options[o]!=NULL && o<1; o++)
+					{
+						char *tail;
+						int val= strtol(options[o], &tail, 0);
+						if(tail==options[o]) break;
+
+						numOfUnknownOptions--;
+						ppMode.forcedQuant= val;
+					}
+				}
 			}
 		}
 		if(!filterNameOk) ppMode.error++;
@@ -775,7 +792,7 @@
 	if(newPPFlag)
 	{
 		ppMode= gPPMode[mode];
-		
+//		printf("%d \n",QP_store[5]);
 		postprocess2(src, src_stride, dst, dst_stride,
 			horizontal_size, vertical_size, QP_store, QP_stride, &ppMode);
 
@@ -850,11 +867,16 @@
 		 struct PPMode *mode)
 {
 
-	static QP_STORE_T zeroArray[2048/8];
-	if(QP_store==NULL)
+	QP_STORE_T quantArray[2048/8];
+	if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)) 
 	{
-		QP_store= zeroArray;
+		int i;
+		QP_store= quantArray;
 		QP_stride= 0;
+		if(mode->lumMode & FORCE_QUANT)
+			for(i=0; i<2048/8; i++) quantArray[i]= mode->forcedQuant;
+		else
+			for(i=0; i<2048/8; i++) quantArray[i]= 1;
 	}
 
 #ifdef HAVE_ODIVX_POSTPROCESS
--- a/libpostproc/postprocess.h	Fri Dec 28 13:56:04 2001 +0000
+++ b/libpostproc/postprocess.h	Thu Jan 03 14:16:13 2002 +0000
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2001 Michael Niedermayer (michaelni@gmx.at)
+    Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at)
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -57,6 +57,7 @@
 #define	MEDIAN_DEINT_FILTER		0x80000	// 524288
 
 #define TEMP_NOISE_FILTER		0x100000
+#define FORCE_QUANT			0x200000
 
 
 #define GET_PP_QUALITY_MAX 6
@@ -87,6 +88,7 @@
 	int maxTmpNoise[3]; // for Temporal Noise Reducing filter (Maximal sum of abs differences)
 	
 	int maxDcDiff; // max abs diff between pixels to be considered flat
+	int forcedQuant; // quantizer if FORCE_QUANT is used
 };
 
 struct PPFilter{