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
7961ea78
Commit
7961ea78
authored
Feb 17, 1993
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved line-size stuff to single routine
parent
eeec33f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
Demo/sgi/video/LiveVideoIn.py
Demo/sgi/video/LiveVideoIn.py
+15
-11
No files found.
Demo/sgi/video/LiveVideoIn.py
View file @
7961ea78
...
...
@@ -54,7 +54,7 @@ class LiveVideoIn:
# Initialize capture
(
mode
,
self
.
realwidth
,
self
.
realheight
,
qsize
,
rate
)
=
\
v
.
InitContinuousCapture
(
SV
.
RGB8_FRAMES
,
\
self
.
realwidth
,
self
.
realheight
,
1
,
5
)
self
.
realwidth
,
self
.
realheight
,
1
,
2
)
self
.
width
=
vw
self
.
height
=
vh
self
.
x0
=
(
self
.
realwidth
-
self
.
width
)
/
2
...
...
@@ -62,8 +62,8 @@ class LiveVideoIn:
self
.
y0
=
(
self
.
realheight
-
self
.
height
)
/
2
self
.
y1
=
self
.
y0
+
self
.
height
-
1
# Compute # full lines per packet
self
.
lpp
=
pktmax
/
self
.
width
self
.
pktsize
=
self
.
lpp
*
self
.
width
self
.
lpp
=
pktmax
/
self
.
linewidth
()
self
.
pktsize
=
self
.
lpp
*
self
.
linewidth
()
self
.
data
=
None
self
.
dataoffset
=
0
self
.
lpos
=
0
...
...
@@ -86,6 +86,17 @@ class LiveVideoIn:
def
close
(
self
):
v
.
EndContinuousCapture
()
# Get the length in bytes of a video line
def
linewidth
(
self
):
if
self
.
type
==
'mono'
:
return
(
self
.
width
+
7
)
/
8
elif
self
.
type
==
'grey2'
:
return
(
self
.
width
+
3
)
/
4
elif
self
.
type
==
'grey4'
:
return
(
self
.
width
+
1
)
/
2
else
:
return
self
.
width
# Get the next video packet.
# This returns (lpos, data) where:
# - lpos is the line position
...
...
@@ -125,12 +136,5 @@ class LiveVideoIn:
data
=
self
.
data
[
self
.
dataoffset
:
self
.
dataoffset
+
self
.
pktsize
]
lpos
=
self
.
lpos
self
.
dataoffset
=
self
.
dataoffset
+
self
.
pktsize
if
self
.
type
==
'mono'
:
self
.
lpos
=
self
.
lpos
+
self
.
lpp
*
8
elif
self
.
type
==
'grey2'
:
self
.
lpos
=
self
.
lpos
+
self
.
lpp
*
4
elif
self
.
type
==
'grey4'
:
self
.
lpos
=
self
.
lpos
+
self
.
lpp
*
2
else
:
self
.
lpos
=
self
.
lpos
+
self
.
lpp
self
.
lpos
=
self
.
lpos
+
self
.
lpp
return
lpos
,
data
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