jbig2二值图像压缩算法实现,C++实现,jbig2是二值图像压缩效果效率平衡最佳的国际标准
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 217 2017-01-30 09:27 jbig2enc.gitignore
....... 219 2017-01-30 09:27 jbig2encAUTHORS
文件 1859 2017-01-30 09:27 jbig2encautogen.sh
....... 1512 2017-01-30 09:27 jbig2encChangeLog
....... 2936 2017-01-30 09:27 jbig2encconfigure.ac
....... 674 2017-01-30 09:27 jbig2encCOPYING
....... 8533 2017-01-30 09:27 jbig2encdocjbig2enc.html
....... 38 2017-01-30 09:27 jbig2encdocMakefile.am
....... 439 2017-01-30 09:27 jbig2encdocPATENTS
....... 1178352 2017-01-30 09:27 jbig2encfcd14492.pdf
....... 858 2017-01-30 09:27 jbig2encINSTALL
....... 157 2017-01-30 09:27 jbig2encMakefile.am
....... 13 2017-01-30 09:27 jbig2encNEWS
文件 5138 2017-01-30 09:27 jbig2encpdf.py
....... 1086 2017-01-30 09:27 jbig2encREADME.md
....... 14819 2017-01-30 09:27 jbig2encsrcjbig2.cc
....... 21848 2017-01-30 09:27 jbig2encsrcjbig2arith.cc
....... 8005 2017-01-30 09:27 jbig2encsrcjbig2arith.h
....... 7472 2017-01-30 09:27 jbig2encsrcjbig2comparator.cc
....... 1849 2017-01-30 09:27 jbig2encsrcjbig2comparator.h
....... 30697 2017-01-30 09:27 jbig2encsrcjbig2enc.cc
....... 6993 2017-01-30 09:27 jbig2encsrcjbig2enc.h
....... 5336 2017-01-30 09:27 jbig2encsrcjbig2segments.h
....... 3950 2017-01-30 09:27 jbig2encsrcjbig2structs.h
....... 15653 2017-01-30 09:27 jbig2encsrcjbig2sym.cc
....... 3790 2017-01-30 09:27 jbig2encsrcjbig2sym.h
....... 530 2017-01-30 09:27 jbig2encsrcMakefile.am
....... 4761 2017-01-30 09:27 jbig2encvs2008jbig2jbig2.vcproj
....... 1512 2017-01-30 09:27 jbig2encvs2008jbig2enc.sln
....... 4352 2017-01-30 09:27 jbig2encvs2008libjbig2enclibjbig2enc.vcproj
............此处省略9个文件信息
#!/usr/bin/python
# Copyright 2006 Google Inc.
# Author: agl@imperialviolet.org (Adam Langley)
#
# Licensed under the Apache License Version 2.0 (the “License“);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing software
# distributed under the License is distributed on an “AS IS“ BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# JBIG2 Encoder
# https://github.com/agl/jbig2enc
import sys
import re
import struct
import glob
import os
# This is a very simple script to make a PDF file out of the output of a
# multipage symbol compression.
# Run ./jbig2 -s -p image1.jpeg image1.jpeg ...
# python pdf.py output > out.pdf
dpi = 72
class Ref:
def __init__(self x):
self.x = x
def __str__(self):
return “%d 0 R“ % self.x
class Dict:
def __init__(self values = {}):
self.d = {}
self.d.update(values)
def __str__(self):
s = [‘<< ‘]
for (x y) in self.d.items():
s.append(‘/%s ‘ % x)
s.append(str(y))
s.append(“
“)
s.append(“>>
“)
return ‘‘.join(s)
global_next_id = 1
class Obj:
next_id = 1
def __init__(self d = {} stream = None):
global global_next_id
if stream is not None:
d[‘Length‘] = str(len(stream))
self.d = Dict(d)
self.stream = stream
self.id = global_next_id
global_next_id += 1
def __str__(self):
s = []
s.append(str(self.d))
if self.stream is not None:
s.append(‘stream
‘)
s.append(self.stream)
s.append(‘
endstream
‘)
s.append(‘endobj
‘)
return ‘‘.join(s)
class Doc:
def __init__(self):
self.objs = []
self.pages = []
def add_object(self o):
self.objs.append(o)
return o
def add_page(self o):
self.pages.append(o)
return self.add_object(o)
def __str__(self):
a = []
j = [0]
offsets = []
def add(x):
a.append(x)
j[0] += len(x) + 1
add(‘%PDF-1.4‘)
for o in self.objs:
offsets.append(j[0])
add(‘%d 0 obj‘ % o.id)
add(str(o))
xrefstart = j[0]
a.append(‘xref‘)
a.append(‘0 %d‘ % (len(offsets) + 1))
a.append(‘0000000000 65535 f ‘)
for o in offsets:
a.append(‘%010d 00000 n ‘ % o)
a.append(‘‘)
a.append(‘trailer‘)
a.append(‘<< /Size %d
/Root 1 0 R >>‘ % (len(offsets) + 1))
a.append(‘startxref‘)
a.append(str(xrefstart))
a.append(‘%%EOF‘)
# sys.stderr.write(str(offsets) + “
“)
return ‘
‘.join(a)
def ref(x):
return ‘%d 0 R‘ % x
def main(symboltable=‘symboltable‘ pagefiles=glob.glob(‘page-*‘)):
doc = Doc()
doc.add_object(Obj({‘Type‘ : ‘/Catalog‘ ‘Outlines‘ : ref(2) ‘Pages‘ : ref(3)}))
doc.add_object(Obj({‘Type‘ : ‘/Outlines‘ ‘Count‘: ‘0‘}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 217 2017-01-30 09:27 jbig2enc.gitignore
....... 219 2017-01-30 09:27 jbig2encAUTHORS
文件 1859 2017-01-30 09:27 jbig2encautogen.sh
....... 1512 2017-01-30 09:27 jbig2encChangeLog
....... 2936 2017-01-30 09:27 jbig2encconfigure.ac
....... 674 2017-01-30 09:27 jbig2encCOPYING
....... 8533 2017-01-30 09:27 jbig2encdocjbig2enc.html
....... 38 2017-01-30 09:27 jbig2encdocMakefile.am
....... 439 2017-01-30 09:27 jbig2encdocPATENTS
....... 1178352 2017-01-30 09:27 jbig2encfcd14492.pdf
....... 858 2017-01-30 09:27 jbig2encINSTALL
....... 157 2017-01-30 09:27 jbig2encMakefile.am
....... 13 2017-01-30 09:27 jbig2encNEWS
文件 5138 2017-01-30 09:27 jbig2encpdf.py
....... 1086 2017-01-30 09:27 jbig2encREADME.md
....... 14819 2017-01-30 09:27 jbig2encsrcjbig2.cc
....... 21848 2017-01-30 09:27 jbig2encsrcjbig2arith.cc
....... 8005 2017-01-30 09:27 jbig2encsrcjbig2arith.h
....... 7472 2017-01-30 09:27 jbig2encsrcjbig2comparator.cc
....... 1849 2017-01-30 09:27 jbig2encsrcjbig2comparator.h
....... 30697 2017-01-30 09:27 jbig2encsrcjbig2enc.cc
....... 6993 2017-01-30 09:27 jbig2encsrcjbig2enc.h
....... 5336 2017-01-30 09:27 jbig2encsrcjbig2segments.h
....... 3950 2017-01-30 09:27 jbig2encsrcjbig2structs.h
....... 15653 2017-01-30 09:27 jbig2encsrcjbig2sym.cc
....... 3790 2017-01-30 09:27 jbig2encsrcjbig2sym.h
....... 530 2017-01-30 09:27 jbig2encsrcMakefile.am
....... 4761 2017-01-30 09:27 jbig2encvs2008jbig2jbig2.vcproj
....... 1512 2017-01-30 09:27 jbig2encvs2008jbig2enc.sln
....... 4352 2017-01-30 09:27 jbig2encvs2008libjbig2enclibjbig2enc.vcproj
............此处省略9个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)