diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-08-19 03:12:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-08-19 03:12:28 +0000 |
commit | 1fd361a1ea06e44286c213ca1f814f49306fdc43 (patch) | |
tree | 64c8c96cf54d8718847339a403e5e67b922e8c3f /converter/ppm/ppmtompeg/mquant.c | |
download | netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.gz netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.xz netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.zip |
Create Subversion repository
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/ppmtompeg/mquant.c')
-rw-r--r-- | converter/ppm/ppmtompeg/mquant.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/converter/ppm/ppmtompeg/mquant.c b/converter/ppm/ppmtompeg/mquant.c new file mode 100644 index 00000000..1f8ca63a --- /dev/null +++ b/converter/ppm/ppmtompeg/mquant.c @@ -0,0 +1,44 @@ +#include "mtypes.h" +#include "mproto.h" + +static int qtable[][8] = { + { 8,16,19,22,26,27,29,34}, + {16,16,22,24,27,29,34,37}, + {19,22,26,27,29,34,34,38}, + {22,22,26,27,29,34,37,40}, + {22,26,27,29,32,35,40,48}, + {26,27,29,32,35,40,48,58}, + {26,27,29,34,38,46,56,69}, + {27,29,35,38,46,56,69,83} }; + + +/* + *-------------------------------------------------------------- + * + * mp_quant_block -- + * + * Quantizes a block -- removing information + * It's safe for out == in. + * + * Results: + * None. + * + * Side effects: + * Modifies the out block. + * + *-------------------------------------------------------------- + */ +void mp_quant_block(Block in, Block out) { + int i; + + for(i=0;i<8;i++) { + out[i][0] = in[i][0] / qtable[i][0]; + out[i][1] = in[i][1] / qtable[i][1]; + out[i][2] = in[i][2] / qtable[i][2]; + out[i][3] = in[i][3] / qtable[i][3]; + out[i][4] = in[i][4] / qtable[i][4]; + out[i][5] = in[i][5] / qtable[i][5]; + out[i][6] = in[i][6] / qtable[i][6]; + out[i][7] = in[i][7] / qtable[i][7]; + } +} |