ArDrone SDK 1.8 added
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / VLIB / video_quantizer.h
1 #ifndef _VIDEO_QUANTIZER_H_
2 #define _VIDEO_QUANTIZER_H_
3
4 #include <VLIB/video_controller.h>
5
6 // (quant > 0)&&(quant < 31) => use table quantization generated with QUANT_I(i,quant) macro
7 // quant == 31                           => old quantization table mode, means QUANT_I(i,2) (backward compatibility)
8 #define TABLE_QUANTIZATION 31   // quant transmitted for old TABLE_QUANTIZATION mode
9 #define TBL_QUANT_QUALITY 2             // real quant used for old TABLE_QUANTIZATION mode
10
11 // quantization macro
12 #define QUANT_IJ(i,j,quality) (1 + (1 +(i) + (j))*(quality))
13 #define QUANT_I(i,quality) (1 + (1 +(i/8) + (i%8))*(quality))
14
15 // Utility functions
16 int16_t* do_quantize_intra_mb(int16_t* ptr, int32_t invQuant, int32_t* last_ptr);
17 int16_t* do_quantize_inter_mb(int16_t* ptr, int32_t quant, int32_t invQuant, int32_t* last_ptr);
18 C_RESULT do_unquantize(int16_t* ptr, int32_t picture_type, int32_t quant, int32_t num_coeff);
19
20 // Default quantization scheme
21 C_RESULT video_quantizer_init( video_controller_t* controller );
22 C_RESULT video_quantizer_update( video_controller_t* controller );
23 C_RESULT video_quantize( video_controller_t* controller, video_macroblock_t* macroblock, int32_t num_macro_blocks );
24 C_RESULT video_unquantize( video_controller_t* controller, video_macroblock_t* macroblock, int32_t num_macro_blocks );
25
26 #endif // _VIDEO_QUANTIZER_H_