Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d0740b43
Commit
d0740b43
authored
Feb 11, 1992
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial revision
parent
9841ed4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
0 deletions
+87
-0
Demo/sgi/video/Makefile
Demo/sgi/video/Makefile
+7
-0
Demo/sgi/video/i2v.c
Demo/sgi/video/i2v.c
+80
-0
No files found.
Demo/sgi/video/Makefile
0 → 100755
View file @
d0740b43
all
:
v2i i2v
v2i
:
v2i.o
$(CC)
v2i.o
-limage
-o
v2i
i2v
:
i2v.o
$(CC)
i2v.o
-limage
-o
i2v
Demo/sgi/video/i2v.c
0 → 100755
View file @
d0740b43
/*
* i2v -- image-to-video.
* Convert an SGI image file to a format that is immediately usable
* by lrectwrite.
* The header of the file contains a description (in ASCII)
* padded to 8196 byte for fast access of the rest of the file.
*
* Based upon "showimg.c" by Paul Haeberli.
* --Guido van Rossum, CWI, Amsterdam
*/
#include <stdio.h>
#include <gl/gl.h>
#include <gl/device.h>
#include <gl/image.h>
unsigned
short
rs
[
8192
];
unsigned
short
gs
[
8192
];
unsigned
short
bs
[
8192
];
IMAGE
*
image
;
int
xsize
,
ysize
,
zsize
;
FILE
*
fp
;
char
header
[
100
];
char
*
progname
=
"i2v"
;
main
(
argc
,
argv
)
int
argc
;
char
**
argv
;
{
int
y
;
if
(
argc
>
0
)
progname
=
argv
[
0
];
if
(
argc
!=
3
)
{
fprintf
(
stderr
,
"usage: %s infile outfile
\n
"
,
progname
);
exit
(
2
);
}
if
(
(
image
=
iopen
(
argv
[
1
],
"r"
))
==
NULL
)
{
fprintf
(
stderr
,
"%s: can't open input file %s
\n
"
,
progname
,
argv
[
1
]);
exit
(
1
);
}
xsize
=
image
->
xsize
;
ysize
=
image
->
ysize
;
zsize
=
image
->
zsize
;
if
((
fp
=
fopen
(
argv
[
2
],
"w"
))
==
NULL
)
{
fprintf
(
stderr
,
"%s: can't open output file %s
\n
"
,
progname
,
argv
[
2
]);
exit
(
1
);
}
fprintf
(
fp
,
"CMIF video 1.0
\n
"
);
fprintf
(
fp
,
"(%d, %d, %d)
\n
"
,
xsize
,
ysize
,
0
);
fprintf
(
fp
,
"0, %ld
\n
"
,
(
long
)
xsize
*
(
long
)
ysize
*
sizeof
(
long
));
fflush
(
fp
);
for
(
y
=
0
;
y
<
ysize
;
y
++
)
{
if
(
zsize
<
3
)
{
getrow
(
image
,
rs
,
y
,
0
);
writepacked
(
xsize
,
rs
,
rs
,
rs
);
}
else
{
getrow
(
image
,
rs
,
y
,
0
);
getrow
(
image
,
gs
,
y
,
1
);
getrow
(
image
,
bs
,
y
,
2
);
writepacked
(
xsize
,
rs
,
gs
,
bs
);
}
}
exit
(
0
);
}
writepacked
(
n
,
rsptr
,
gsptr
,
bsptr
)
int
n
;
short
*
rsptr
,
*
gsptr
,
*
bsptr
;
{
long
parray
[
8192
];
long
*
pptr
=
parray
;
int
i
=
n
;
while
(
--
i
>=
0
)
{
*
pptr
++
=
*
rsptr
++
|
(
*
gsptr
++<<
8
)
|
(
*
bsptr
++<<
16
);
}
if
(
fwrite
((
char
*
)
parray
,
sizeof
(
long
),
n
,
fp
)
!=
n
)
{
perror
(
"fwrite"
);
exit
(
1
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment