⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inter_pred_pipeline.v

📁 a H.264/AVC Baseline Decoder
💻 V
📖 第 1 页 / 共 3 页
字号:
									begin										if (xInt_org_unclip[1:0] == 2'b11)	// 4 preload cycles											xInt_curr_offset <= (blk4x4_inter_preload_counter_m2[0] == 1'b1)? 5'b0:5'b0100;										else											xInt_curr_offset <= 0;									end								else									begin										if (xInt_org_unclip[1] == 1'b0)											xInt_curr_offset <= 0;										else											xInt_curr_offset <= (blk4x4_inter_preload_counter_m2[0] == 1'b1)? 5'b0:5'b0100;									end							end					end			end		else	//blk4x4_inter_preload_counter == 0 || blk4x4_inter_preload_counter == 1 			xInt_curr_offset <= 5'b0; 		//Derive unclipped x pos for each preload cycle	wire [8:0] xInt_addr_unclip;	assign xInt_addr_unclip = xInt_org_unclip + {{4{xInt_curr_offset[4]}},xInt_curr_offset};		//x addr clipped:x address in pixels	reg [7:0] xInt_addr;	always @ (xInt_addr_unclip or IsInterLuma or IsInterChroma)		if (xInt_addr_unclip[8] == 1'b1)	//negative			xInt_addr <= 0;		else if (IsInterLuma)			xInt_addr <= (xInt_addr_unclip[7:0] > (`pic_width - 4))? 8'd172:xInt_addr_unclip[7:0];		else if (IsInterChroma)			xInt_addr <= (xInt_addr_unclip[7:0] > (`half_pic_width - 4))? 8'd84:xInt_addr_unclip[7:0];		else			xInt_addr <= 0;				//yInt_p1:when loading from Xth line to (X-1)th line,yInt_p1 is set to 1'b1 at the last	//loading cycle of current Xth line	reg yInt_p1;	always @ (IsInterLuma or mv_below8x8_curr or pos_FracL or xFracC or yFracC 		or blk4x4_inter_preload_counter or blk4x4_inter_preload_counter_m2 or xInt_org_unclip[1:0] or xInt_org_unclip[1])		if (blk4x4_inter_preload_counter != 6'd0 && blk4x4_inter_preload_counter != 6'd1)			begin				if (IsInterLuma)					case (mv_below8x8_curr)						1'b0:						case (pos_FracL)							`pos_f,`pos_q,`pos_i,`pos_k,`pos_j:							yInt_p1 <= (blk4x4_inter_preload_counter_m2[1:0] == 2'b00)? 1'b1:1'b0;							`pos_d,`pos_h,`pos_n:							if (xInt_org_unclip[1:0] == 2'b00)								yInt_p1 <= (blk4x4_inter_preload_counter_m2[0] == 1'b0)? 1'b1:1'b0;							else								case (blk4x4_inter_preload_counter_m2)									6'd36,6'd33,6'd30,6'd27,6'd24,6'd21,6'd18,6'd15,6'd12,6'd9,6'd6,6'd3,6'd0:									yInt_p1 <= 1'b1;									default:yInt_p1 <= 1'b0;								endcase							`pos_a,`pos_b,`pos_c:							yInt_p1 <= (blk4x4_inter_preload_counter_m2[1:0] == 2'b00)? 1'b1:1'b0;							`pos_Int:							if (xInt_org_unclip[1:0] == 2'b00)								yInt_p1 <= (blk4x4_inter_preload_counter_m2[0] == 1'b0)? 1'b1:1'b0;							else								case (blk4x4_inter_preload_counter_m2)									6'd21,6'd18,6'd15,6'd12,6'd9,6'd6,6'd3,6'd0:yInt_p1 <= 1'b1;									default:									yInt_p1 <= 1'b0;								endcase							`pos_e,`pos_g,`pos_p,`pos_r:							case (blk4x4_inter_preload_counter_m2)								6'd45,6'd42,6'd3,6'd0:yInt_p1 <= 1'b1;								6'd6,6'd10,6'd14,6'd18,6'd22,6'd26,6'd30,6'd34,6'd38:yInt_p1 <= 1'b1;								default:yInt_p1 <= 1'b0;							endcase						endcase						1'b1:		//block partition below 8x8						case (pos_FracL)							`pos_f,`pos_q,`pos_i,`pos_k,`pos_j:							case (blk4x4_inter_preload_counter_m2)								6'd24,6'd21,6'd18,6'd15,6'd12,6'd9,6'd6,6'd3,6'd0:yInt_p1 <= 1'b1;								default:yInt_p1 <= 1'b0;							endcase							`pos_d,`pos_h,`pos_n:							if (xInt_org_unclip[1:0] == 2'b00)								yInt_p1 <= 1'b1;								else								yInt_p1 <= (blk4x4_inter_preload_counter_m2[0] == 1'b0)? 1'b1:1'b0;							`pos_a,`pos_b,`pos_c:							case (blk4x4_inter_preload_counter_m2)								5'd9,5'd6,5'd3,5'd0	:yInt_p1 <= 1'b1;								default				:yInt_p1 <= 1'b0;							endcase							`pos_Int:							if (xInt_org_unclip[1:0] == 2'b00)								yInt_p1 <= 1'b1;							else								yInt_p1 <= (blk4x4_inter_preload_counter_m2[0] == 1'b0)? 1'b1:1'b0;							`pos_e,`pos_g,`pos_p,`pos_r:							case (blk4x4_inter_preload_counter_m2)								6'd21,6'd19,6'd2,6'd0		:yInt_p1 <= 1'b1;								6'd4,6'd7,6'd10,6'd13,6'd16	:yInt_p1 <= 1'b1;								default						:yInt_p1 <= 1'b0;							endcase						endcase					endcase				else	//IsInterChroma					case (mv_below8x8_curr)						1'b0:						if (xFracC == 0 && yFracC == 0)							begin								if (xInt_org_unclip[1:0] == 2'b00)									yInt_p1 <= 1'b1;								else									yInt_p1 <= (blk4x4_inter_preload_counter_m2[0] == 1'b0)? 1'b1:1'b0;							end						else							yInt_p1 <= (blk4x4_inter_preload_counter_m2[0] == 1'b0)? 1'b1:1'b0;						1'b1:						if (xFracC == 0 && yFracC == 0)							begin								if (xInt_org_unclip[1:0] != 2'b11)									yInt_p1 <= 1'b1;								else									yInt_p1 <= (blk4x4_inter_preload_counter_m2[0] == 1'b0)? 1'b1:1'b0;							end						else							begin								if (xInt_org_unclip[1] == 1'b0)									yInt_p1 <= 1'b1;								else 									yInt_p1 <= (blk4x4_inter_preload_counter_m2[0] == 1'b0)? 1'b1:1'b0;							end					endcase			end		else	// blk4x4_inter_preload_counter == 0 || blk4x4_inter_preload_counter == 1						yInt_p1 <= 1'b0; 		//Derive unclipped y pos for each preload cycle	reg [8:0] yInt_addr_unclip;	always @ (posedge clk)		if (reset_n == 1'b0)			yInt_addr_unclip <= 0;		else if ((IsInterLuma && (trigger_blk4x4_inter_pred && (mv_below8x8_curr ||			(!mv_below8x8_curr && blk4x4_rec_counter[1:0] == 2'b00)))) ||			(IsInterChroma && (!mv_below8x8_curr && trigger_blk4x4_inter_pred) ||							   (mv_below8x8_curr && trigger_blk2x2_inter_pred)))			begin				if (IsInterLuma)	//Luma					case (pos_FracL)						`pos_a,`pos_b,`pos_c,`pos_Int:						yInt_addr_unclip <= yInt_org_unclip;						default:				//need -2 here						yInt_addr_unclip <= yInt_org_unclip + 9'b111111110;					endcase				else			   //Chroma					yInt_addr_unclip <= yInt_org_unclip;			end		else if (blk4x4_inter_preload_counter_m2 != 0 && yInt_p1 == 1'b1)			yInt_addr_unclip <= yInt_addr_unclip + 1;			//y addr clipped	reg [7:0] yInt_addr;	always @ (yInt_addr_unclip or IsInterLuma or IsInterChroma)		if (yInt_addr_unclip[8] == 1'b1)	//negative			yInt_addr <= 0;		else if (IsInterLuma)			yInt_addr <= (yInt_addr_unclip[7:0] > (`pic_height - 1))? 8'd143:yInt_addr_unclip[7:0];		else if (IsInterChroma)			yInt_addr <= (yInt_addr_unclip[7:0] > (`half_pic_height - 1))? 8'd71:yInt_addr_unclip[7:0];		else			yInt_addr <= 0;			wire [12:0] offset_constant;	wire [10:0] yInt_addr_x11;	wire [12:0]	offset_yInt_addr;	assign offset_constant = (IsInterLuma)? 0:((IsInterChroma)? ((blk4x4_rec_counter < 5'd20)? 13'd6336:13'd7920):0); 	assign yInt_addr_x11 = {yInt_addr,3'b0} + {2'b0,yInt_addr,1'b0} + {3'b0,yInt_addr};	assign offset_yInt_addr = (IsInterLuma)? {yInt_addr_x11,2'b0}:{1'b0,yInt_addr_x11,1'b0};	assign ref_frame_RAM_rd_addr = (offset_constant + {8'b0,xInt_addr[7:2]}) + {1'b0,offset_yInt_addr};		//----------------------------------------------------------------------------------------	//Inter prediction output control: from LPE or from CPE	//----------------------------------------------------------------------------------------	always @ (IsInterLuma or IsInterChroma or Is_InterChromaCopy 		or blk4x4_inter_calculate_counter or pos_FracL		or Inter_pix_copy0 or Inter_pix_copy1 or Inter_pix_copy2 or Inter_pix_copy3		or LPE0_out or LPE1_out or LPE2_out or LPE3_out		or CPE0_out or CPE1_out or CPE2_out or CPE3_out) 		if (IsInterLuma && blk4x4_inter_calculate_counter != 0)			begin				Inter_blk4x4_pred_output_valid <= 2'b01;				case (pos_FracL)					`pos_Int:					begin						Inter_pred_out0 <= Inter_pix_copy0;Inter_pred_out1 <= Inter_pix_copy1;						Inter_pred_out2 <= Inter_pix_copy2;Inter_pred_out3 <= Inter_pix_copy3;					end					`pos_i,`pos_k:					if (blk4x4_inter_calculate_counter == 4'd7 || blk4x4_inter_calculate_counter == 4'd5 || 						blk4x4_inter_calculate_counter == 4'd3 || blk4x4_inter_calculate_counter == 4'd1)						begin							Inter_pred_out0 <= LPE0_out;Inter_pred_out1 <= LPE1_out;							Inter_pred_out2 <= LPE2_out;Inter_pred_out3 <= LPE3_out;						end					else						begin							Inter_pred_out0 <= 0;Inter_pred_out1 <= 0;Inter_pred_out2 <= 0;Inter_pred_out3 <= 0;						end					default:					if (blk4x4_inter_calculate_counter == 4'd4 || blk4x4_inter_calculate_counter == 4'd3 || 						blk4x4_inter_calculate_counter == 4'd2 || blk4x4_inter_calculate_counter == 4'd1)						begin							Inter_pred_out0 <= LPE0_out;Inter_pred_out1 <= LPE1_out;							Inter_pred_out2 <= LPE2_out;Inter_pred_out3 <= LPE3_out;						end					else						begin							Inter_pred_out0 <= 0;Inter_pred_out1 <= 0;Inter_pred_out2 <= 0;Inter_pred_out3 <= 0;						end				endcase			end		else if (IsInterChroma && blk4x4_inter_calculate_counter != 0)			begin				Inter_pred_out0 <= (Is_InterChromaCopy)? Inter_pix_copy0:CPE0_out;				Inter_pred_out1 <= (Is_InterChromaCopy)? Inter_pix_copy1:CPE1_out;				Inter_pred_out2 <= (Is_InterChromaCopy)? Inter_pix_copy2:CPE2_out;				Inter_pred_out3 <= (Is_InterChromaCopy)? Inter_pix_copy3:CPE3_out;				Inter_blk4x4_pred_output_valid <= 2'b10;			end		else			begin				Inter_pred_out0 <= 0;Inter_pred_out1 <= 0;Inter_pred_out2 <= 0;Inter_pred_out3 <= 0;				Inter_blk4x4_pred_output_valid <= 2'b00;			endendmodule																																																																						

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -