OpenCores
URL https://opencores.org/ocsvn/nova/nova/trunk

Subversion Repositories nova

[/] [nova/] [trunk/] [src/] [QP_decoding.v] - Diff between revs 2 and 11

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 11
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Design    : nova
// Design    : nova
// Author(s) : Ke Xu
// Author(s) : Ke Xu
// Email           : eexuke@yahoo.com
// Email           : eexuke@yahoo.com
// File      : QP_decoding.v
// File      : QP_decoding.v
// Generated : June 7, 2005
// Generated : June 7, 2005
// Copyright (C) 2008 Ke Xu                
// Copyright (C) 2008 Ke Xu                
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// Description 
// Description 
// QPy:the luma quantisation parameter
// QPy:the luma quantisation parameter
// QPi:the intermediate quantisation parameter derived from QPy
// QPi:the intermediate quantisation parameter derived from QPy
// QPc:the chroma quantisation parameter derived from QPi on Table 8-13,Page136
// QPc:the chroma quantisation parameter derived from QPi on Table 8-13,Page136
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// Revise log  
// Revise log  
// 1. March 21,2006
// 1. March 21,2006
// Input signals slice_qp_delta and mb_qp_delta are removed, using 
// Input signals slice_qp_delta and mb_qp_delta are removed, using 
// exp_golomb_decoding_output_5to0 instead since these two signals are latched at clock
// exp_golomb_decoding_output_5to0 instead since these two signals are latched at clock
// rising edge which is too late for computation. So use exp_golomb_decoding_output_5to0 directly
// rising edge which is too late for computation. So use exp_golomb_decoding_output_5to0 directly
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
 
 
// synopsys translate_off
// synopsys translate_off
`include "timescale.v"
`include "timescale.v"
// synopsys translate_on
// synopsys translate_on
`include "nova_defines.v"
`include "nova_defines.v"
 
 
module QP_decoding (clk,reset_n,slice_header_state,slice_data_state,pic_init_qp_minus26,
module QP_decoding (clk,reset_n,slice_header_state,slice_data_state,pic_init_qp_minus26,
        exp_golomb_decoding_output_5to0,chroma_qp_index_offset,QPy,QPc);
        exp_golomb_decoding_output_5to0,chroma_qp_index_offset,QPy,QPc);
        input clk,reset_n;
        input clk,reset_n;
        input [3:0] slice_header_state;
        input [3:0] slice_header_state;
        input [3:0] slice_data_state;
        input [3:0] slice_data_state;
        input [5:0] pic_init_qp_minus26;
        input [5:0] pic_init_qp_minus26;
        input [5:0] exp_golomb_decoding_output_5to0;
        input [5:0] exp_golomb_decoding_output_5to0;
        input [4:0] chroma_qp_index_offset;
        input [4:0] chroma_qp_index_offset;
        output [5:0] QPy,QPc;
        output [5:0] QPy,QPc;
        reg [5:0] QPy,QPc;
        reg [5:0] QPy,QPc;
 
 
        always @ (posedge clk)
        always @ (posedge clk)
                if (reset_n == 0)
                if (reset_n == 0)
                        QPy <= 0;
                        QPy <= 0;
                else if (slice_header_state == `slice_qp_delta_s)
                else if (slice_header_state == `slice_qp_delta_s)
                        QPy <= 26 + pic_init_qp_minus26 + exp_golomb_decoding_output_5to0;
                        QPy <= 26 + pic_init_qp_minus26 + exp_golomb_decoding_output_5to0;
                else if (slice_data_state == `mb_qp_delta_s)
                else if (slice_data_state == `mb_qp_delta_s)
                        QPy <= QPy + exp_golomb_decoding_output_5to0;
                        QPy <= QPy + exp_golomb_decoding_output_5to0;
 
 
        wire [5:0] QPi;
        wire [5:0] QPi;
        assign QPi = QPy + {1'b0,chroma_qp_index_offset};
        assign QPi = QPy + {1'b0,chroma_qp_index_offset};
        always @ (posedge clk)
        always @ (posedge clk)
                if (reset_n == 0)
                if (reset_n == 0)
                        QPc <= 0;
                        QPc <= 0;
                else
                else
                        begin
                        begin
                                if (QPi < 30)
                                if (QPi < 30)
                                        QPc <= QPi;
                                        QPc <= QPi;
                                else
                                else
                                        case (QPi)
                                        case (QPi)
                                                30      :QPc <= 29;
                                                30      :QPc <= 29;
                                                31      :QPc <= 30;
                                                31      :QPc <= 30;
                                                32      :QPc <= 31;
                                                32      :QPc <= 31;
                                                33,34   :QPc <= 32;
                                                33,34   :QPc <= 32;
                                                35      :QPc <= 33;
                                                35      :QPc <= 33;
                                                36,37   :QPc <= 34;
                                                36,37   :QPc <= 34;
                                                38,39   :QPc <= 35;
                                                38,39   :QPc <= 35;
                                                40,41   :QPc <= 36;
                                                40,41   :QPc <= 36;
                                                42,43,44:QPc <= 37;
                                                42,43,44:QPc <= 37;
                                                45,46,47:QPc <= 38;
                                                45,46,47:QPc <= 38;
                                                default :QPc <= 39;
                                                default :QPc <= 39;
                                        endcase
                                        endcase
                        end
                        end
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.