Esempio n. 1
0
/**
This function is used to decode the macroblock information in a P slice.
*/
int MbPredPCabacSvc (CABACContext *c, unsigned char *state, SLICE *slice, RESIDU *CurrResidu, DATA *macroblock, short mv_cache_l0[][2], short ref_cache_l0[]){

	int index = 14 * CurrResidu -> Mode;


	//Get MotionPred flag
	if(GetCabacSVCPMotionPred(c, state, slice, macroblock, macroblock -> MotionPredL0, CurrResidu -> InCropWindow, Pred_L1, 0)){
		//Error detected
		return 1;
	}

	//Get reference index
	if(GetCabacPRefList(c, state, macroblock -> RefIdxL0, ref_cache_l0, macroblock -> MotionPredL0, 
		CurrResidu -> Mode, slice -> num_RefIdxL0_active_minus1, index)){
		return 1;
	}
	
	//Read motion vector according to the macroblock type.
	if (CurrResidu -> Mode == 3){
		ReadCabacMotionVector(c, state, mv_cache_l0, macroblock -> MvdL0[0], 3, 12);
	}else if (CurrResidu -> Mode == 1){
		// mode == 1: 8x16
		ReadCabacMotionVector(c, state, mv_cache_l0, macroblock -> MvdL0[0], 1, 12);
		ReadCabacMotionVector(c, state, mv_cache_l0, macroblock -> MvdL0[4], 1, 14);
	}else{
		ReadCabacMotionVector(c, state, mv_cache_l0, macroblock -> MvdL0[0], 2, 12);
		ReadCabacMotionVector(c, state, mv_cache_l0, macroblock -> MvdL0[4], 2, 28);
	}
	return 0;
}
Esempio n. 2
0
char mb_pred_P_cabac ( CABACContext *c, unsigned char *state, SLICE *slice, RESIDU *CurrResidu, 
					 short mv_cache_l0[][2], short *ref_cache_l0, short mvl0_cache[][2], short *refl0_cache)
{


	int index = 14 * CurrResidu -> Mode;
	char RefIdxL0[2] = {0, 0};

	//Get reference index
	if(GetCabacPRefList(c, state, RefIdxL0, ref_cache_l0, RefIdxL0, CurrResidu -> Mode, slice -> num_RefIdxL0_active_minus1, index)){
		refl0_cache [12] = refl0_cache [14] = refl0_cache [28] = refl0_cache [30] = 0;
		return 1;
	}
	
	//Read motion vector according to the macroblock type.
	if (CurrResidu -> Mode == 3){
		ReadAndComputeCabac16x16MotionVector(c, state, RefIdxL0, refl0_cache, mv_cache_l0, mvl0_cache);
	}else if (CurrResidu -> Mode == 1){
		// mode == 1: 8x16
		ReadAndComputeCabac8x16MotionVector(c, state, RefIdxL0, refl0_cache, mv_cache_l0, mvl0_cache, 12);
		ReadAndComputeCabac8x16MotionVector(c, state, &RefIdxL0[1], refl0_cache, mv_cache_l0, mvl0_cache, 14);
	}else{
		ReadAndComputeCabac16x8MotionVector(c, state, RefIdxL0, refl0_cache, mv_cache_l0, mvl0_cache, 12);
		ReadAndComputeCabac16x8MotionVector(c, state, &RefIdxL0[1], refl0_cache, mv_cache_l0, mvl0_cache, 28);
	}
	return 0;
}