Mercurial > libavcodec.hg
comparison libpostproc/postprocess.c @ 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 |
comparison
equal
deleted
inserted
replaced
| 182:3ccd74a91074 | 183:d310beb2d848 |
|---|---|
| 1 /* | 1 /* |
| 2 Copyright (C) 2001 Michael Niedermayer (michaelni@gmx.at) | 2 Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at) |
| 3 | 3 |
| 4 This program is free software; you can redistribute it and/or modify | 4 This program is free software; you can redistribute it and/or modify |
| 5 it under the terms of the GNU General Public License as published by | 5 it under the terms of the GNU General Public License as published by |
| 6 the Free Software Foundation; either version 2 of the License, or | 6 the Free Software Foundation; either version 2 of the License, or |
| 7 (at your option) any later version. | 7 (at your option) any later version. |
| 173 {"lb", "linblenddeint", 1, 1, 4, LINEAR_BLEND_DEINT_FILTER}, | 173 {"lb", "linblenddeint", 1, 1, 4, LINEAR_BLEND_DEINT_FILTER}, |
| 174 {"li", "linipoldeint", 1, 1, 4, LINEAR_IPOL_DEINT_FILTER}, | 174 {"li", "linipoldeint", 1, 1, 4, LINEAR_IPOL_DEINT_FILTER}, |
| 175 {"ci", "cubicipoldeint", 1, 1, 4, CUBIC_IPOL_DEINT_FILTER}, | 175 {"ci", "cubicipoldeint", 1, 1, 4, CUBIC_IPOL_DEINT_FILTER}, |
| 176 {"md", "mediandeint", 1, 1, 4, MEDIAN_DEINT_FILTER}, | 176 {"md", "mediandeint", 1, 1, 4, MEDIAN_DEINT_FILTER}, |
| 177 {"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER}, | 177 {"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER}, |
| 178 {"fq", "forcequant", 1, 0, 0, FORCE_QUANT}, | |
| 178 {NULL, NULL,0,0,0,0} //End Marker | 179 {NULL, NULL,0,0,0,0} //End Marker |
| 179 }; | 180 }; |
| 180 | 181 |
| 181 static char *replaceTable[]= | 182 static char *replaceTable[]= |
| 182 { | 183 { |
| 559 md mediandeint median deinterlacer | 560 md mediandeint median deinterlacer |
| 560 de default hdeblock:a,vdeblock:a,dering:a,autolevels | 561 de default hdeblock:a,vdeblock:a,dering:a,autolevels |
| 561 fa fast x1hdeblock:a,x1vdeblock:a,dering:a,autolevels | 562 fa fast x1hdeblock:a,x1vdeblock:a,dering:a,autolevels |
| 562 tn tmpnoise (3 Thresholds) Temporal Noise Reducer | 563 tn tmpnoise (3 Thresholds) Temporal Noise Reducer |
| 563 1. <= 2. <= 3. Threshold, larger means stronger filtering | 564 1. <= 2. <= 3. Threshold, larger means stronger filtering |
| 565 fq forceQuant <quantizer> Force quantizer (for reencoded lq stuff) | |
| 564 */ | 566 */ |
| 565 | 567 |
| 566 /** | 568 /** |
| 567 * returns a PPMode struct which will have a non 0 error variable if an error occured | 569 * returns a PPMode struct which will have a non 0 error variable if an error occured |
| 568 * name is the string after "-pp" on the command line | 570 * name is the string after "-pp" on the command line |
| 718 if(o==0) ppMode.maxDcDiff= val; | 720 if(o==0) ppMode.maxDcDiff= val; |
| 719 else hFlatnessThreshold= | 721 else hFlatnessThreshold= |
| 720 vFlatnessThreshold= val; | 722 vFlatnessThreshold= val; |
| 721 } | 723 } |
| 722 } | 724 } |
| 725 else if(filters[i].mask == FORCE_QUANT) | |
| 726 { | |
| 727 int o; | |
| 728 ppMode.forcedQuant= 15; | |
| 729 | |
| 730 for(o=0; options[o]!=NULL && o<1; o++) | |
| 731 { | |
| 732 char *tail; | |
| 733 int val= strtol(options[o], &tail, 0); | |
| 734 if(tail==options[o]) break; | |
| 735 | |
| 736 numOfUnknownOptions--; | |
| 737 ppMode.forcedQuant= val; | |
| 738 } | |
| 739 } | |
| 723 } | 740 } |
| 724 } | 741 } |
| 725 if(!filterNameOk) ppMode.error++; | 742 if(!filterNameOk) ppMode.error++; |
| 726 ppMode.error += numOfUnknownOptions; | 743 ppMode.error += numOfUnknownOptions; |
| 727 } | 744 } |
| 773 static QP_STORE_T zeroArray[2048/8]; | 790 static QP_STORE_T zeroArray[2048/8]; |
| 774 | 791 |
| 775 if(newPPFlag) | 792 if(newPPFlag) |
| 776 { | 793 { |
| 777 ppMode= gPPMode[mode]; | 794 ppMode= gPPMode[mode]; |
| 778 | 795 // printf("%d \n",QP_store[5]); |
| 779 postprocess2(src, src_stride, dst, dst_stride, | 796 postprocess2(src, src_stride, dst, dst_stride, |
| 780 horizontal_size, vertical_size, QP_store, QP_stride, &ppMode); | 797 horizontal_size, vertical_size, QP_store, QP_stride, &ppMode); |
| 781 | 798 |
| 782 return; | 799 return; |
| 783 } | 800 } |
| 848 int horizontal_size, int vertical_size, | 865 int horizontal_size, int vertical_size, |
| 849 QP_STORE_T *QP_store, int QP_stride, | 866 QP_STORE_T *QP_store, int QP_stride, |
| 850 struct PPMode *mode) | 867 struct PPMode *mode) |
| 851 { | 868 { |
| 852 | 869 |
| 853 static QP_STORE_T zeroArray[2048/8]; | 870 QP_STORE_T quantArray[2048/8]; |
| 854 if(QP_store==NULL) | 871 if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)) |
| 855 { | 872 { |
| 856 QP_store= zeroArray; | 873 int i; |
| 874 QP_store= quantArray; | |
| 857 QP_stride= 0; | 875 QP_stride= 0; |
| 876 if(mode->lumMode & FORCE_QUANT) | |
| 877 for(i=0; i<2048/8; i++) quantArray[i]= mode->forcedQuant; | |
| 878 else | |
| 879 for(i=0; i<2048/8; i++) quantArray[i]= 1; | |
| 858 } | 880 } |
| 859 | 881 |
| 860 #ifdef HAVE_ODIVX_POSTPROCESS | 882 #ifdef HAVE_ODIVX_POSTPROCESS |
| 861 // Note: I could make this shit outside of this file, but it would mean one | 883 // Note: I could make this shit outside of this file, but it would mean one |
| 862 // more function call... | 884 // more function call... |
