Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
7bbceea6
Kaydet (Commit)
7bbceea6
authored
Mar 17, 1993
tarafından
Sjoerd Mullender
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added support for "compress" type video files. This uses the
Compression Library to decompress the images.
üst
6b517fdc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
VFile.py
Demo/sgi/video/VFile.py
+26
-3
No files found.
Demo/sgi/video/VFile.py
Dosyayı görüntüle @
7bbceea6
...
@@ -168,6 +168,7 @@ bitsperpixel = { \
...
@@ -168,6 +168,7 @@ bitsperpixel = { \
'grey4'
:
4
,
\
'grey4'
:
4
,
\
'grey2'
:
2
,
\
'grey2'
:
2
,
\
'mono'
:
1
,
\
'mono'
:
1
,
\
'compress'
:
32
,
\
}
}
bppafterdecomp
=
{
'jpeg'
:
32
,
'jpeggrey'
:
8
}
bppafterdecomp
=
{
'jpeg'
:
32
,
'jpeggrey'
:
8
}
...
@@ -288,7 +289,9 @@ class VideoParams:
...
@@ -288,7 +289,9 @@ class VideoParams:
self
.
setpf
(
values
[
3
])
self
.
setpf
(
values
[
3
])
self
.
setsize
(
values
[
1
],
values
[
2
])
self
.
setsize
(
values
[
1
],
values
[
2
])
(
self
.
c0bits
,
self
.
c1bits
,
self
.
c2bits
,
\
(
self
.
c0bits
,
self
.
c1bits
,
self
.
c2bits
,
\
self
.
offset
,
self
.
chrompack
)
=
values
[
4
:]
self
.
offset
,
self
.
chrompack
)
=
values
[
4
:
9
]
if
self
.
format
==
'compress'
:
self
.
compressheader
=
values
[
9
]
self
.
setderived
()
self
.
setderived
()
# Retrieve all parameters in a format suitable for a subsequent
# Retrieve all parameters in a format suitable for a subsequent
...
@@ -342,6 +345,7 @@ class Displayer(VideoParams):
...
@@ -342,6 +345,7 @@ class Displayer(VideoParams):
self
.
color0
=
None
# magic, used by clearto()
self
.
color0
=
None
# magic, used by clearto()
self
.
fixcolor0
=
0
# don't need to fix color0
self
.
fixcolor0
=
0
# don't need to fix color0
self
.
mustunpack
=
(
not
support_packed_pixels
())
self
.
mustunpack
=
(
not
support_packed_pixels
())
self
.
decompressor
=
None
return
self
return
self
# setinfo() must reset some internal flags
# setinfo() must reset some internal flags
...
@@ -370,6 +374,19 @@ class Displayer(VideoParams):
...
@@ -370,6 +374,19 @@ class Displayer(VideoParams):
import
jpeg
import
jpeg
data
,
width
,
height
,
bytes
=
jpeg
.
decompress
(
data
)
data
,
width
,
height
,
bytes
=
jpeg
.
decompress
(
data
)
pmsize
=
bytes
*
8
pmsize
=
bytes
*
8
elif
self
.
format
==
'compress'
:
if
not
self
.
decompressor
:
import
cl
,
CL
scheme
=
cl
.
QueryScheme
(
self
.
compressheader
)
self
.
decompressor
=
cl
.
OpenDecompressor
(
scheme
)
headersize
=
self
.
decompressor
.
ReadHeader
(
self
.
compressheader
)
width
=
self
.
decompressor
.
GetParam
(
CL
.
IMAGE_WIDTH
)
height
=
self
.
decompressor
.
GetParam
(
CL
.
IMAGE_HEIGHT
)
params
=
[
CL
.
ORIGINAL_FORMAT
,
CL
.
RGBX
,
\
CL
.
ORIENTATION
,
CL
.
BOTTOM_UP
,
\
CL
.
FRAME_BUFFER_SIZE
,
width
*
height
*
CL
.
BytesPerPixel
(
CL
.
RGBX
)]
self
.
decompressor
.
SetParams
(
params
)
data
=
self
.
decompressor
.
Decompress
(
1
,
data
)
elif
self
.
format
in
(
'mono'
,
'grey4'
):
elif
self
.
format
in
(
'mono'
,
'grey4'
):
if
self
.
mustunpack
:
if
self
.
mustunpack
:
if
self
.
format
==
'mono'
:
if
self
.
format
==
'mono'
:
...
@@ -422,7 +439,7 @@ class Displayer(VideoParams):
...
@@ -422,7 +439,7 @@ class Displayer(VideoParams):
self
.
colormapinited
=
1
self
.
colormapinited
=
1
self
.
color0
=
None
self
.
color0
=
None
self
.
fixcolor0
=
0
self
.
fixcolor0
=
0
if
self
.
format
in
(
'rgb'
,
'jpeg'
):
if
self
.
format
in
(
'rgb'
,
'jpeg'
,
'compress'
):
gl
.
RGBmode
()
gl
.
RGBmode
()
gl
.
gconfig
()
gl
.
gconfig
()
gl
.
RGBcolor
(
200
,
200
,
200
)
# XXX rather light grey
gl
.
RGBcolor
(
200
,
200
,
200
)
# XXX rather light grey
...
@@ -568,6 +585,7 @@ def readfileheader(fp, filename):
...
@@ -568,6 +585,7 @@ def readfileheader(fp, filename):
# XXX Could be version 0.0 without identifying header
# XXX Could be version 0.0 without identifying header
raise
Error
,
\
raise
Error
,
\
filename
+
': Unrecognized file header: '
+
`line`
[:
20
]
filename
+
': Unrecognized file header: '
+
`line`
[:
20
]
compressheader
=
None
#
#
# Get color encoding info
# Get color encoding info
# (The format may change to 'rgb' later when packfactor == 0)
# (The format may change to 'rgb' later when packfactor == 0)
...
@@ -598,6 +616,11 @@ def readfileheader(fp, filename):
...
@@ -598,6 +616,11 @@ def readfileheader(fp, filename):
c0bits
=
c1bits
=
c2bits
=
0
c0bits
=
c1bits
=
c2bits
=
0
chrompack
=
0
chrompack
=
0
offset
=
0
offset
=
0
elif
format
==
'compress'
:
c0bits
=
c1bits
=
c2bits
=
0
chrompack
=
0
offset
=
0
compressheader
=
rest
elif
format
in
(
'grey'
,
'jpeggrey'
,
'mono'
,
'grey2'
,
'grey4'
):
elif
format
in
(
'grey'
,
'jpeggrey'
,
'mono'
,
'grey2'
,
'grey4'
):
c0bits
=
rest
c0bits
=
rest
c1bits
=
c2bits
=
0
c1bits
=
c2bits
=
0
...
@@ -650,7 +673,7 @@ def readfileheader(fp, filename):
...
@@ -650,7 +673,7 @@ def readfileheader(fp, filename):
# Return (version, values)
# Return (version, values)
#
#
values
=
(
format
,
width
,
height
,
packfactor
,
\
values
=
(
format
,
width
,
height
,
packfactor
,
\
c0bits
,
c1bits
,
c2bits
,
offset
,
chrompack
)
c0bits
,
c1bits
,
c2bits
,
offset
,
chrompack
,
compressheader
)
return
(
version
,
values
)
return
(
version
,
values
)
...
...
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