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

📄 nc_decoding.v

📁 a H.264/AVC Baseline Decoder
💻 V
📖 第 1 页 / 共 3 页
字号:
	always @ (reset_n or cavlc_decoder_state or residual_state or mb_num_h or i8x8 or i4x4 or i4x4_CbCr or nA_availability_reg)		if (reset_n == 1'b0)			nA_availability <= 1'b0;		else if (cavlc_decoder_state == `nAnB_decoding_s)			case (residual_state)				//luma				`Intra16x16DCLevel_s:nA_availability <= (mb_num_h == 0)? 1'b0:1'b1;				`Intra16x16ACLevel_s,`LumaLevel_s:				if ((i8x8 == 0 || i8x8 == 2) && (i4x4 == 0 || i4x4 == 2))					nA_availability <= (mb_num_h == 0)? 1'b0:1'b1;				else 					nA_availability <= 1'b1;				//chroma				`ChromaACLevel_Cb_s,`ChromaACLevel_Cr_s:				nA_availability <= (mb_num_h == 0 && i4x4_CbCr[0] == 0)? 1'b0:1'b1;				default:nA_availability <= 1'b0;			endcase		else			nA_availability <= nA_availability_reg;	//-------------------	//nB_availability	//-------------------	always @ (posedge clk)		if (reset_n == 0)			nB_availability_reg <= 0;		else if (cavlc_decoder_state == `nAnB_decoding_s)			nB_availability_reg <= nB_availability;	always @ (reset_n or cavlc_decoder_state or residual_state or mb_num_v or i8x8 or i4x4 or i4x4_CbCr		or nB_availability_reg)		if (reset_n == 1'b0)			nB_availability <= 1'b0;		else if (cavlc_decoder_state == `nAnB_decoding_s)			case (residual_state)				//luma				`Intra16x16DCLevel_s:nB_availability <= (mb_num_v == 0)? 1'b0:1'b1;				`Intra16x16ACLevel_s,`LumaLevel_s:				if ((i8x8 == 0 || i8x8 == 1) && (i4x4 == 0 || i4x4 == 1))					nB_availability <= (mb_num_v == 0)? 1'b0:1'b1;				else 					nB_availability <= 1'b1;				//chroma				`ChromaACLevel_Cb_s,`ChromaACLevel_Cr_s:				nB_availability <= (mb_num_v == 0 && i4x4_CbCr[1] == 0)? 1'b0:1'b1;				default:nB_availability <= 1'b0;			endcase		else 			nB_availability <= nB_availability_reg;	//------------	//Derive nA	//------------	always @ (posedge clk)		if (reset_n == 0)			nA <= 0;		else if (cavlc_decoder_state == `nAnB_decoding_s && nA_availability == 1)			case (residual_state)				//luma				`Intra16x16DCLevel_s:nA <= (Luma_8x8_AllZeroCoeff_mbAddrA[0] == 0)? 0:LumaLevel_mbAddrA[4:0];				`Intra16x16ACLevel_s,`LumaLevel_s:				case (i8x8)					0:					case (i4x4)						0:nA <= (Luma_8x8_AllZeroCoeff_mbAddrA[0] == 0)? 0:LumaLevel_mbAddrA[4:0];						1:nA <= LumaLevel_CurrMb0[4:0];						2:nA <= (Luma_8x8_AllZeroCoeff_mbAddrA[0] == 0)? 0:LumaLevel_mbAddrA[9:5];						3:nA <= LumaLevel_CurrMb0[14:10];					endcase					1:					case (i4x4)						0:nA <= (CodedBlockPatternLuma[0] == 0)? 0:LumaLevel_CurrMb0[9:5];						1:nA <= LumaLevel_CurrMb1[4:0];						2:nA <= (CodedBlockPatternLuma[0] == 0)? 0:LumaLevel_CurrMb0[19:15];						3:nA <= LumaLevel_CurrMb1[14:10];					endcase					2:					case (i4x4)						0:nA <= (Luma_8x8_AllZeroCoeff_mbAddrA[1] == 0)? 0:LumaLevel_mbAddrA[14:10];						1:nA <= LumaLevel_CurrMb2[4:0];						2:nA <= (Luma_8x8_AllZeroCoeff_mbAddrA[1] == 0)? 0:LumaLevel_mbAddrA[19:15];						3:nA <= LumaLevel_CurrMb2[14:10];					endcase					3:					case (i4x4)						0:nA <= (CodedBlockPatternLuma[2] == 0)? 0:LumaLevel_CurrMb2[9:5];						1:nA <= LumaLevel_CurrMb3[4:0];						2:nA <= (CodedBlockPatternLuma[2] == 0)? 0:LumaLevel_CurrMb2[19:15];						3:nA <= LumaLevel_CurrMb3[14:10];					endcase				endcase				//chroma				`ChromaACLevel_Cb_s:				case (i4x4_CbCr)					2'b00:nA <= (Chroma_8x8_AllZeroCoeff_mbAddrA == 0)? 0:ChromaLevel_Cb_mbAddrA[4:0];					2'b10:nA <= (Chroma_8x8_AllZeroCoeff_mbAddrA == 0)? 0:ChromaLevel_Cb_mbAddrA[9:5];					2'b01:nA <= (CodedBlockPatternChroma         != 2)? 0:ChromaLevel_Cb_CurrMb[4:0];					2'b11:nA <= (CodedBlockPatternChroma         != 2)? 0:ChromaLevel_Cb_CurrMb[14:10];				endcase				`ChromaACLevel_Cr_s:				case (i4x4_CbCr)					2'b00:nA <= (Chroma_8x8_AllZeroCoeff_mbAddrA == 0)? 0:ChromaLevel_Cr_mbAddrA[4:0];					2'b10:nA <= (Chroma_8x8_AllZeroCoeff_mbAddrA == 0)? 0:ChromaLevel_Cr_mbAddrA[9:5];					2'b01:nA <= (CodedBlockPatternChroma         != 2)? 0:ChromaLevel_Cr_CurrMb[4:0];					2'b11:nA <= (CodedBlockPatternChroma         != 2)? 0:ChromaLevel_Cr_CurrMb[14:10];				endcase			endcase		else if (cavlc_decoder_state == `nAnB_decoding_s && nA_availability == 0)			nA <= 0;	//------------	//Derive nB	//------------	always @ (posedge clk)		if (reset_n == 0)			nB <= 0;		else if (cavlc_decoder_state == `nAnB_decoding_s && nB_availability == 1)			case (residual_state)				`Intra16x16DCLevel_s:				nB <= (Luma_8x8_AllZeroCoeff_mbAddrB[0] == 0)? 0:LumaLevel_mbAddrB_dout[19:15];				`Intra16x16ACLevel_s,`LumaLevel_s:				case (i8x8)					0:					case (i4x4)						0:nB <= (Luma_8x8_AllZeroCoeff_mbAddrB[0] == 0)? 0:LumaLevel_mbAddrB_dout[19:15];						1:nB <= (Luma_8x8_AllZeroCoeff_mbAddrB[0] == 0)? 0:LumaLevel_mbAddrB_dout[14:10];						2:nB <= LumaLevel_CurrMb0[4:0];						3:nB <= LumaLevel_CurrMb0[9:5];					endcase					1:					case (i4x4)						0:nB <= (Luma_8x8_AllZeroCoeff_mbAddrB[1] == 0)? 0:LumaLevel_mbAddrB_dout[9:5];						1:nB <= (Luma_8x8_AllZeroCoeff_mbAddrB[1] == 0)? 0:LumaLevel_mbAddrB_dout[4:0];						2:nB <= LumaLevel_CurrMb1[4:0];						3:nB <= LumaLevel_CurrMb1[9:5];					endcase					2:					case (i4x4)						0:nB <= (CodedBlockPatternLuma[0] == 0)? 0:LumaLevel_CurrMb0[14:10];						1:nB <= (CodedBlockPatternLuma[0] == 0)? 0:LumaLevel_CurrMb0[19:15];						2:nB <= LumaLevel_CurrMb2[4:0];						3:nB <= LumaLevel_CurrMb2[9:5];					endcase					3:					case (i4x4)						0:nB <= (CodedBlockPatternLuma[1] == 0)? 0:LumaLevel_CurrMb1[14:10];						1:nB <= (CodedBlockPatternLuma[1] == 0)? 0:LumaLevel_CurrMb1[19:15];						2:nB <= LumaLevel_CurrMb3[4:0];						3:nB <= LumaLevel_CurrMb3[9:5];					endcase				endcase				`ChromaACLevel_Cb_s:				case (i4x4_CbCr)					0:nB <= (Chroma_8x8_AllZeroCoeff_mbAddrB == 0)? 0:ChromaLevel_Cb_mbAddrB_dout[9:5];					1:nB <= (Chroma_8x8_AllZeroCoeff_mbAddrB == 0)? 0:ChromaLevel_Cb_mbAddrB_dout[4:0];					2:nB <= ChromaLevel_Cb_CurrMb[4:0];					3:nB <= ChromaLevel_Cb_CurrMb[9:5];				endcase				`ChromaACLevel_Cr_s:				case (i4x4_CbCr)					0:nB <= (Chroma_8x8_AllZeroCoeff_mbAddrB == 0)? 0:ChromaLevel_Cr_mbAddrB_dout[9:5];					1:nB <= (Chroma_8x8_AllZeroCoeff_mbAddrB == 0)? 0:ChromaLevel_Cr_mbAddrB_dout[4:0];					2:nB <= ChromaLevel_Cr_CurrMb[4:0];					3:nB <= ChromaLevel_Cr_CurrMb[9:5];				endcase				default: nB <= 0;			endcase		else if (cavlc_decoder_state == `nAnB_decoding_s && nB_availability == 0)			nB <= 0;	//------------	//Derive nC	//------------	always @ (posedge clk)		if (reset_n == 0)			nC <= 0;		else if (cavlc_decoder_state == `nC_decoding_s)			begin				if (residual_state == `ChromaDCLevel_Cb_s || residual_state == `ChromaDCLevel_Cr_s)					nC <= 5'b11111;				else if (nA_availability == 1 && nB_availability == 1)					nC <= (nA + nB + 1) >> 1;				else					nC <= nA + nB;			end	//-----------------------		//LumaLevel_CurrMb write 	//-----------------------	always @ (posedge clk)		if (reset_n == 0)			begin				LumaLevel_CurrMb0 <= 0;	LumaLevel_CurrMb1 <= 0;					LumaLevel_CurrMb2 <= 0; LumaLevel_CurrMb3 <= 0;			end		else if (end_of_one_residual_block == 1 && (residual_state == `Intra16x16ACLevel_s || 			residual_state == `LumaLevel_s))			case (i8x8)				0:				case (i4x4)					0:LumaLevel_CurrMb0[4:0]   <= TotalCoeff;					1:LumaLevel_CurrMb0[9:5]   <= TotalCoeff;					2:LumaLevel_CurrMb0[14:10] <= TotalCoeff;					3:LumaLevel_CurrMb0[19:15] <= TotalCoeff;				endcase				1:				case (i4x4)					0:LumaLevel_CurrMb1[4:0]   <= TotalCoeff;					1:LumaLevel_CurrMb1[9:5]   <= TotalCoeff;					2:LumaLevel_CurrMb1[14:10] <= TotalCoeff;					3:LumaLevel_CurrMb1[19:15] <= TotalCoeff;				endcase				2:				case (i4x4)					0:LumaLevel_CurrMb2[4:0]   <= TotalCoeff;					1:LumaLevel_CurrMb2[9:5]   <= TotalCoeff;					2:LumaLevel_CurrMb2[14:10] <= TotalCoeff;					3:LumaLevel_CurrMb2[19:15] <= TotalCoeff;				endcase				3:				case (i4x4)					0:LumaLevel_CurrMb3[4:0]   <= TotalCoeff;					1:LumaLevel_CurrMb3[9:5]   <= TotalCoeff;					2:LumaLevel_CurrMb3[14:10] <= TotalCoeff;					3:LumaLevel_CurrMb3[19:15] <= TotalCoeff;				endcase			endcase	//---------------------------		//ChromaLevel_Cb_CurrMb write 	//---------------------------	always @ (posedge clk)		if (reset_n == 0)			ChromaLevel_Cb_CurrMb <= 0;		else if (end_of_one_residual_block == 1 && residual_state == `ChromaACLevel_Cb_s)			case (i4x4_CbCr)				0:ChromaLevel_Cb_CurrMb[4:0]   <= TotalCoeff;				1:ChromaLevel_Cb_CurrMb[9:5]   <= TotalCoeff;				2:ChromaLevel_Cb_CurrMb[14:10] <= TotalCoeff;				3:ChromaLevel_Cb_CurrMb[19:15] <= TotalCoeff;			endcase	//---------------------------		//ChromaLevel_Cr_CurrMb write 	//---------------------------	always @ (posedge clk)		if (reset_n == 0)			ChromaLevel_Cr_CurrMb <= 0;		else if (end_of_one_residual_block == 1 && residual_state == `ChromaACLevel_Cr_s)			case (i4x4_CbCr)				0:ChromaLevel_Cr_CurrMb[4:0]   <= TotalCoeff;				1:ChromaLevel_Cr_CurrMb[9:5]   <= TotalCoeff;				2:ChromaLevel_Cr_CurrMb[14:10] <= TotalCoeff;				3:ChromaLevel_Cr_CurrMb[19:15] <= TotalCoeff;			endcase	//-----------------------		//LumaLevel_mbAddrA write 	//-----------------------	always @ (posedge clk)		if (reset_n == 0)			LumaLevel_mbAddrA <= 0;		else if (end_of_one_residual_block == 1 && (residual_state == `Intra16x16ACLevel_s || residual_state == `LumaLevel_s) && mb_num_h != 10)

⌨️ 快捷键说明

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