/******************************************************************** * * * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 * * by the Xiph.Org Foundation and contributors http://www.xiph.org/ * * * ******************************************************************** function: last mod: $Id$ ********************************************************************/ #include <stdlib.h> #include <string.h> #include <ogg/ogg.h> #include "quant.h" #include "decint.h" /*The maximum output of the DCT with +/- 255 inputs is +/- 8157. These minimum quantizers ensure the result after quantization (and after prediction for DC) will be no more than +/- 510. The tokenization system can handle values up to +/- 580, so there is no need to do any coefficient clamping. I would rather have allowed smaller quantizers and had to clamp, but these minimums were required when constructing the original VP3 matrices and have been formalized in the spec.*/ static const unsigned OC_DC_QUANT_MIN[2]= …; static const unsigned OC_AC_QUANT_MIN[2]= …; /*Initializes the dequantization tables from a set of quantizer info. Currently the dequantizer (and elsewhere enquantizer) tables are expected to be initialized as pointing to the storage reserved for them in the oc_theora_state (resp. oc_enc_ctx) structure. If some tables are duplicates of others, the pointers will be adjusted to point to a single copy of the tables, but the storage for them will not be freed. If you're concerned about the memory footprint, the obvious thing to do is to move the storage out of its fixed place in the structures and allocate it on demand. However, a much, much better option is to only store the quantization matrices being used for the current frame, and to recalculate these as the qi values change between frames (this is what VP3 did).*/ void oc_dequant_tables_init(ogg_uint16_t *_dequant[64][3][2], int _pp_dc_scale[64],const th_quant_info *_qinfo){ … }