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

Subversion Repositories motion_estimation_processor

[/] [motion_estimation_processor/] [trunk/] [src_me/] [range_checker.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 eejlny
 
2
----------------------------------------------------------------------------
3
--  This file is a part of the LM VHDL IP LIBRARY
4
--  Copyright (C) 2009 Jose Nunez-Yanez
5
--
6
--  This program is free software; you can redistribute it and/or modify
7
--  it under the terms of the GNU General Public License as published by
8
--  the Free Software Foundation; either version 2 of the License, or
9
--  (at your option) any later version.
10
--
11
--  See the file COPYING for the full details of the license.
12
--
13
--  The license allows free and unlimited use of the library and tools for research and education purposes. 
14
--  The full LM core supports many more advanced motion estimation features and it is available under a 
15
--  low-cost commercial license. See the readme file to learn more or contact us at 
16
--  eejlny@byacom.co.uk or www.byacom.co.uk
17
-----------------------------------------------------------------------------
18
-- Entity:      range_checker
19
-- File:        range_checker.vhd
20
-- Author:      Jose Luis Nunez 
21
-- Description: range checker to be able to process frame edges
22
------------------------------------------------------------------------------
23
 
24
library IEEE;
25
use IEEE.std_logic_1164.all;
26
use work.config.all;
27
use IEEE.std_logic_signed."+";
28
use IEEE.std_logic_signed."<";
29
use IEEE.std_logic_signed.">";
30
use work.config.all;
31
 
32
 
33
entity range_checker is --make sure that MVs are not out of range
34
port (
35
clk : in std_logic;
36
clear : in std_logic;
37
reset : in std_logic;
38
candidate_mvx : in std_logic_vector(7 downto 0);
39
candidate_mvy : in std_logic_vector(7 downto 0);
40
frame_dimension_x : in std_logic_vector(7 downto 0); --in mb  
41
frame_dimension_y : in std_logic_vector(7 downto 0);
42
mbx_coordinate : in std_logic_vector(7 downto 0); --in mb
43
mby_coordinate : in std_logic_vector(7 downto 0);
44
range_ok : out std_logic
45
);
46
end;
47
 
48
architecture behav of range_checker is
49
 
50
 
51
signal mbx_coordinate_pixels : std_logic_vector(11 downto 0);
52
signal mby_coordinate_pixels : std_logic_vector(11 downto 0);
53
signal frame_dimension_x_pixels,candidate_mvx_long,candidate_mvy_long : std_logic_vector(11 downto 0);
54
signal frame_dimension_y_pixels : std_logic_vector(11 downto 0);
55
signal range_x_low,range_x_high,range_y_low,range_y_high : std_logic;
56
 
57
begin
58
 
59
 
60
mbx_coordinate_pixels <= mbx_coordinate & "0000";
61
mby_coordinate_pixels <= mby_coordinate & "0000";
62
frame_dimension_x_pixels <= frame_dimension_x & "0000";
63
frame_dimension_y_pixels <= frame_dimension_y & "0000";
64
candidate_mvx_long <= "0000" & candidate_mvx when candidate_mvx(7)='0' else "1111" & candidate_mvx; --sign extension
65
candidate_mvy_long <= "0000" & candidate_mvy when candidate_mvy(7)='0' else "1111" & candidate_mvy;
66
 
67
range_process_x_low : process(candidate_mvx_long,mbx_coordinate_pixels)
68
 
69
begin
70
 
71
if ((candidate_mvx_long + mbx_coordinate_pixels) < 0) then
72
        range_x_low <= '0';
73
else
74
        range_x_low <= '1';
75
end if;
76
 
77
end process;
78
 
79
range_process_x_high : process(candidate_mvx_long,mbx_coordinate_pixels,frame_dimension_x_pixels)
80
 
81
begin
82
 
83
if ((candidate_mvx_long + 16 + mbx_coordinate_pixels) > frame_dimension_x_pixels) then
84
        range_x_high <= '0';
85
else
86
        range_x_high <= '1';
87
end if;
88
 
89
end process;
90
 
91
 
92
range_process_y_low : process(candidate_mvy_long,mby_coordinate_pixels)
93
 
94
begin
95
 
96
if ((candidate_mvy_long + mby_coordinate_pixels) < 0) then
97
        range_y_low <= '0';
98
else
99
        range_y_low <= '1';
100
end if;
101
 
102
end process;
103
 
104
range_process_y_high : process(candidate_mvy_long,mby_coordinate_pixels,frame_dimension_y_pixels)
105
 
106
begin
107
 
108
if ((candidate_mvy_long + 16 + mby_coordinate_pixels) > frame_dimension_y_pixels) then
109
        range_y_high <= '0';
110
else
111
        range_y_high <= '1';
112
end if;
113
 
114
end process;
115
 
116
--rangec1 : if CFG_PIPELINE_COUNT_QP = 1 generate
117
--      range_ok <= range_x_low and range_x_high and range_y_low and range_y_high; -- if all ranges ok then ok
118
--end generate;
119
 
120
--rangec0 : if CFG_PIPELINE_COUNT_QP = 1 generate
121
        range_ok <= '1';  -- Hardwired to one since the codec can pad the reference memory with pixels. 
122
--end generate;
123
 
124
end behav;

powered by: WebSVN 2.1.0

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