#ifndef DB_TRANS_H
#define DB_TRANS_H

typedef struct 
{
	int32 sign;								 
	int32 exponent;
	int32 mantissa;
	int mantissa_bits;


}double_split;

typedef struct ThreeDVAcquisitionElement
{
	double_split element[MAX_CODEVIEW];
	int32 exponent_size;

	byte skip_flag[MAX_CODEVIEW];
	byte element_equal;
	byte exponent_skip_flag[MAX_CODEVIEW];

	int32 sign_diff[MAX_CODEVIEW];
	int32 exponent_diff[MAX_CODEVIEW];
	int32 mantissa_diff[MAX_CODEVIEW];

	byte delta_flag;
	byte element_flag;
	byte pred_mode;

	int32 precision;
	int32 mantissa_length;


	double original[MAX_CODEVIEW];
	double rec[MAX_CODEVIEW];

}ThreeDVAE;
typedef struct ThreeDVAcquisitionInfo
{
	//double focal_length_x[MAX_CODEVIEW];
	//double focal_length_y[MAX_CODEVIEW];
	//double principal_point_x[MAX_CODEVIEW];
	//double principal_point_y[MAX_CODEVIEW];
	//double translation[MAX_CODEVIEW];
	//double depth_near[MAX_CODEVIEW];
	//double depth_far[MAX_CODEVIEW];

	ThreeDVAE *focal_length_x_ae;
	ThreeDVAE *focal_length_y_ae;
	ThreeDVAE *principal_point_x_ae;
	ThreeDVAE *principal_point_y_ae;
	ThreeDVAE *translation_ae;
	ThreeDVAE *depth_near_ae;
	ThreeDVAE *depth_far_ae;
#if(DEPTH_PARAMETER_SET)
	int num_views;
	int pred_direction;
	int pred_weight0;
	int ref_element_id0;
	int ref_element_id1;
#endif
#if NOKIA_DISP_CALC_B0150
	byte disp_param_flag;
	double d_disparity_scale[MAX_CODEVIEW][MAX_CODEVIEW];  //!< scale parameter for disparity [source_view_idx][target_view_idx]
	double d_disparity_offset[MAX_CODEVIEW][MAX_CODEVIEW];  //!< offset parameter for disparity [source_view_idx][target_view_idx]
	int i_disparity_scale[MAX_CODEVIEW][MAX_CODEVIEW];  //!< scale parameter for disparity [source_view_idx][target_view_idx]
	int i_disparity_offset[MAX_CODEVIEW][MAX_CODEVIEW];  //!< offset parameter for disparity [source_view_idx][target_view_idx]
	int i_disparity_scale_diff[MAX_CODEVIEW][MAX_CODEVIEW];  //!< scale parameter for disparity [source_view_idx][target_view_idx]
	int i_disparity_offset_diff[MAX_CODEVIEW][MAX_CODEVIEW];  //!< offset parameter for disparity [source_view_idx][target_view_idx]
#endif
}ThreeDVAcquisitionInfo;

typedef struct ThreeDVUpdateInfo 
{
	int pred_direction;
	int pred_weight0;
	int frame_num_diff0_minus1;
	int frame_num_diff1_minus1;
	int num_views_minus1;
	int camera_order[MAX_CODEVIEW];

	ThreeDVAcquisitionInfo* currr_3dv_acquisition_info;
	ThreeDVAcquisitionInfo* forward_3dv_acquisition_info;
	ThreeDVAcquisitionInfo* backward_3dv_acquisition_info;
	ThreeDVAcquisitionInfo* subsps_3dv_acquisition_info;
}ThreeDVUpdateInfo ;

//extern void GetExponentMantissa(ThreeDVAE* threeDV_ae);
extern void get_exponent_mantissa(ThreeDVAE* threeDV_ae,int voidx);
extern void get_rec_double_type(ThreeDVAE* threeDV, int voidx);
//extern int32 GetReconDoubleType(ThreeDVAE* threeDV_ae,int voidx,double* recon);
extern int  get_mem_acquisition_info(ThreeDVAcquisitionInfo** threeDV_acquisition_info);
extern void free_mem_acquisition_info(ThreeDVAcquisitionInfo* threeDV_acqusition_info);
extern void init_acquisition_info(ThreeDVAcquisitionInfo* ThreeDV_acquisition_info);
extern void copy_acquisition_info(ThreeDVAcquisitionInfo* dest_acquisition_infor, ThreeDVAcquisitionInfo* src_acquisition_info);

#if SONY_MDFY_SEI_AQINF_M24730
typedef struct ThreeDVAcquisitionElementSEI
{
	double_split element;
	int32 exponent_size;

	byte pred_mode;

	int32 precision;
	int32 mantissa_length;

	double original;
	double rec;
}ThreeDVAESEI;

#if NOKIA_DEPTH_SEI_C0162
typedef struct DepthAcquisitionInfoSEI
{
  ThreeDVAESEI depth_near_ae;
  ThreeDVAESEI depth_far_ae;
  ThreeDVAESEI d_min_ae;
  ThreeDVAESEI d_max_ae;
}DepthAcquisitionInfoSEI;

typedef struct MultiviewAcquisitionInfoSEI
{
  ThreeDVAESEI focal_length_x_ae;
  ThreeDVAESEI focal_length_y_ae;
  ThreeDVAESEI principal_point_x_ae;
  ThreeDVAESEI principal_point_y_ae;
  ThreeDVAESEI skew_factor_ae;
  ThreeDVAESEI rotation_ae[3][3];
  ThreeDVAESEI translation_ae[3];
}MultiviewAcquisitionInfoSEI;

#else
typedef struct ThreeDVAcquisitionInfoSEI
{
	ThreeDVAESEI *focal_length_x_ae;
	ThreeDVAESEI *focal_length_y_ae;
	ThreeDVAESEI *principal_point_x_ae;
	ThreeDVAESEI *principal_point_y_ae;
	ThreeDVAESEI *translation_ae;
	ThreeDVAESEI *depth_near_ae;
	ThreeDVAESEI *depth_far_ae;
	ThreeDVAESEI *d_min_ae;
	ThreeDVAESEI *d_max_ae;
#if NTT_MDFY_SEI_DAQINF_A0140
	ThreeDVAESEI *rotation_ae;
#endif
}ThreeDVAcquisitionInfoSEI;

typedef struct ThreeDVUpdateInfoSEI 
{
	ThreeDVAcquisitionInfoSEI **acquisition_info;
}ThreeDVUpdateInfoSEI;
#endif

extern void get_exponent_mantissa_SEI(ThreeDVAESEI* threeDV_ae);
extern void get_rec_double_type_SEI(ThreeDVAESEI* threeDV_ae);

#if NOKIA_DEPTH_SEI_C0162
extern void init_depth_acquisition_info_SEI(DepthAcquisitionInfoSEI* depth_acquisition_info);
extern void init_multiview_acquisition_info_SEI(MultiviewAcquisitionInfoSEI* multiview_acquisition_info);
#else
extern int  get_mem_acquisition_info_SEI(ThreeDVAcquisitionInfoSEI*** threeDV_acquisition_info, int num_frames);
extern void init_acquisition_info_SEI(ThreeDVAcquisitionInfoSEI* ThreeDV_acquisition_info);
extern void free_mem_acquisition_info_SEI(ThreeDVAcquisitionInfoSEI* threeDV_acqusition_info);
#endif

#endif

#endif

