Image Demosaicking with Contour Stencils
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
edge.c
Go to the documentation of this file.
1
15
#include "
basic.h
"
16
#include "
edge.h
"
17
19
edgelist
NullEdgeList
= {NULL, NULL, 0};
20
21
28
int
AddEdge
(
edgelist
*List,
int
x1,
int
y1,
int
x2,
int
y2)
29
{
30
edge
*NewEdge;
31
32
if
(!List || !(NewEdge = (
edge
*)
Malloc
(
sizeof
(
edge
))))
33
return
0;
34
35
NewEdge->
x1
= x1;
36
NewEdge->
y1
= y1;
37
NewEdge->
x2
= x2;
38
NewEdge->
y2
= y2;
39
NewEdge->
Weight
= 1;
40
NewEdge->
NextEdge
= NULL;
41
42
if
(!List->
Tail
)
/* Add edge to empty list */
43
List->
Head
= List->
Tail
= NewEdge;
44
else
/* Append the edge to the end of the list */
45
{
46
List->
Tail
->
NextEdge
= NewEdge;
47
List->
Tail
= NewEdge;
48
}
49
50
(List->
NumEdges
)++;
51
return
1;
52
}
53
54
59
void
FreeEdgeList
(
edgelist
*List)
60
{
61
edge
*Edge, *NextEdge;
62
63
for
(Edge = List->
Head
; Edge; Edge = NextEdge)
64
{
65
NextEdge = Edge->
NextEdge
;
66
Free
(Edge);
67
}
68
69
List->
Head
= List->
Tail
= NULL;
70
List->
NumEdges
= 0;
71
}
72
Generated on Fri Jul 5 2013 18:57:29 for Image Demosaicking with Contour Stencils by
1.8.3.1