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

Subversion Repositories nova

[/] [nova/] [trunk/] [src/] [QP_decoding.v] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 eexuke
//--------------------------------------------------------------------------------------------------
2
// Design    : nova
3
// Author(s) : Ke Xu
4
// Email           : eexuke@yahoo.com
5
// File      : QP_decoding.v
6
// Generated : June 7, 2005
7
// Copyright (C) 2008 Ke Xu                
8
//-------------------------------------------------------------------------------------------------
9
// Description 
10
// QPy:the luma quantisation parameter
11
// QPi:the intermediate quantisation parameter derived from QPy
12
// QPc:the chroma quantisation parameter derived from QPi on Table 8-13,Page136
13
//-------------------------------------------------------------------------------------------------
14
// Revise log  
15
// 1. March 21,2006
16
// Input signals slice_qp_delta and mb_qp_delta are removed, using 
17
// exp_golomb_decoding_output_5to0 instead since these two signals are latched at clock
18
// rising edge which is too late for computation. So use exp_golomb_decoding_output_5to0 directly
19
//-------------------------------------------------------------------------------------------------
20
 
21
// synopsys translate_off
22
`include "timescale.v"
23
// synopsys translate_on
24
`include "nova_defines.v"
25
 
26
module QP_decoding (clk,reset_n,slice_header_state,slice_data_state,pic_init_qp_minus26,
27
        exp_golomb_decoding_output_5to0,chroma_qp_index_offset,QPy,QPc);
28
        input clk,reset_n;
29
        input [3:0] slice_header_state;
30
        input [3:0] slice_data_state;
31
        input [5:0] pic_init_qp_minus26;
32
        input [5:0] exp_golomb_decoding_output_5to0;
33
        input [4:0] chroma_qp_index_offset;
34
        output [5:0] QPy,QPc;
35
        reg [5:0] QPy,QPc;
36
 
37
        always @ (posedge clk)
38
                if (reset_n == 0)
39
                        QPy <= 0;
40
                else if (slice_header_state == `slice_qp_delta_s)
41
                        QPy <= 26 + pic_init_qp_minus26 + exp_golomb_decoding_output_5to0;
42
                else if (slice_data_state == `mb_qp_delta_s)
43
                        QPy <= QPy + exp_golomb_decoding_output_5to0;
44
 
45
        wire [5:0] QPi;
46
        assign QPi = QPy + {1'b0,chroma_qp_index_offset};
47
        always @ (posedge clk)
48
                if (reset_n == 0)
49
                        QPc <= 0;
50
                else
51
                        begin
52
                                if (QPi < 30)
53
                                        QPc <= QPi;
54
                                else
55
                                        case (QPi)
56
                                                30      :QPc <= 29;
57
                                                31      :QPc <= 30;
58
                                                32      :QPc <= 31;
59
                                                33,34   :QPc <= 32;
60
                                                35      :QPc <= 33;
61
                                                36,37   :QPc <= 34;
62
                                                38,39   :QPc <= 35;
63
                                                40,41   :QPc <= 36;
64
                                                42,43,44:QPc <= 37;
65
                                                45,46,47:QPc <= 38;
66
                                                default :QPc <= 39;
67
                                        endcase
68
                        end
69
endmodule
70
 

powered by: WebSVN 2.1.0

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