/*===================================================================
* unravel.c
* Decodes a variable length coded bit sequence (a vector of
* 16-bit integers) using a binary sort from the MSB to the LSB
* (across word boundaries) based on a transition table.
*==================================================================*/
#include "mex.h"
void unravel(uint16_T *hx, double *link, double *x,
double xsz, int hxsz)
{
int i = 15, j = 0, k = 0, n = 0; /* Start at root node, 1st */
/* hx bit and x element */
while (xsz - k) { /* Do until x is filled */
if (*(link + n) > 0) { /* Is there a link? */
if ((*(hx + j) >> i) & 0x0001) /* Is bit a 1? */
n = *(link + n); /* Yes, get new node */
else n = *(link + n) - 1; /* It's 0 so get new node */
if (i) i--; else {j++; i = 15;} /* Set i, j to next bit */
if (j > hxsz) /* Bits left to decode? */
mexErrMsgTxt("Out of code bits ???");
}
else { /* It must be a leaf node */
*(x + k++) = - *(link + n); /* Output value */
n = 0; } /* Start over at root */
}
if (k == xsz - 1) /* Is one left over? */
*(x + k++) = - *(link + n);
}
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
double *link, *x, xsz;
uint16_T *hx;
int hxsz;
/* Check inputs for reasonableness */
if (nrhs != 3)
mexErrMsgTxt("Three inputs required.");
else if (nlhs > 1)
mexErrMsgTxt("Too many output arguments.");
/* Is last input argument a scalar? */
if(!mxIsDouble(prhs[2]) || mxIsComplex(prhs[2]) ||
mxGetN(prhs[2]) * mxGetM(prhs[2]) != 1)
mexErrMsgTxt("Input XSIZE must be a scalar.");
/* Create input matrix pointers and get scalar */
hx = (uint16_T *) mxGetData(prhs[0]);
link = (double *) mxGetData(prhs[1]);
xsz = mxGetScalar(prhs[2]); /* returns DOUBLE */
/* Get the number of elements in hx */
hxsz = mxGetM(prhs[0]);
/* Create 'xsz' x 1 output matrix */
plhs[0] = mxCreateDoubleMatrix(xsz, 1, mxREAL);
/* Get C pointer to a copy of the output matrix */
x = (double *) mxGetData(plhs[0]);
/* Call the C subroutine */
unravel(hx, link, x, xsz, hxsz);
}
没有合适的资源?快使用搜索试试~ 我知道了~
Ch-8.Image-compression.rar_in_tifs2cv.m
共63个文件
m:29个
tif:13个
jpg:11个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 50 浏览量
2022-09-22
23:46:52
上传
评论
收藏 2.76MB RAR 举报
温馨提示
This file consists matlab programs implemented in image compression in Digital image processing
资源推荐
资源详情
资源评论
收起资源包目录
Ch-8.Image-compression.rar (63个子文件)
Ch-8.Image compression
functions
tifs2seq.m 758B
compare.m 1KB
jpeg2im.m 3KB
ntrop.m 1KB
movie2tifs.m 831B
unravel.mexglx 8KB
unravel.mexa64 10KB
unravel.mexw64 9KB
cv2tifs.m 2KB
mat2huff.m 3KB
im2jpeg2k.m 4KB
tifs2cv.m 4KB
mat2lpc.m 1KB
quantize.m 1KB
im2jpeg.m 3KB
unravel.mexs64 10KB
jpeg2k2im.m 2KB
lpc2mat.m 2KB
tifs2movie.m 983B
seq2tifs.m 726B
huff2mat.m 3KB
unravel.mexw32 8KB
showmo.m 1KB
huffman.m 3KB
unravel.m 1KB
unravel.mexmaci 12KB
imratio.m 1KB
CH8.m 7KB
unravel.c 2KB
images
Fig0804(a)(Tracy05).jpg 41KB
SqueezeTracy.mat 210KB
Fig0807(a)(Random).tif 312KB
Fig0804(a)(Tracy).tif 260KB
Fig0807(c)(Aligned).tif 310KB
barbara.tiff 175KB
Fig0810(a)(Original).tif 242KB
Fig0804(a)(Tracy).jpg 143KB
ouput
8_5lpc.JPG 10KB
8_7_original.JPG 26KB
8_3.imratio_barbara.JPG 10KB
8_3tracy.tif 452KB
8_4_huff2matdecode.JPG 8KB
8_5_lpc.tif 268KB
8_3.barbara.JPG 489KB
8_5_barbara.tif 18KB
8_8_tracy1.tif 446KB
8_8_tracy2.tif 451KB
8_5_histogram.tif 22KB
8_8_jpegcompression.JPG 13KB
8_3.imratio.JPG 10KB
8_5_barbara_lpc.tif 482KB
8_7_original_quantized.JPG 111KB
8_4tracy.tif 452KB
8_7_barbara.JPG 14KB
8_7_barbara_quantized.tif 335KB
examples
ex8_8.m 259B
SqueezeTracy.mat 210KB
ex8_3.m 431B
ex8_5.m 236B
ex8_7.m 554B
ex8_2.m 182B
ex8_4.m 250B
ex8_1.m 265B
共 63 条
- 1
资源评论
刘良运
- 粉丝: 66
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- python tkinter-08-盒子模型.ev4.rar
- Doozy UI Manager 2023
- 基于matlab实现夜间车牌识别程序(1).rar
- 基于matlab实现无线传感器网络无需测距定位算法matlab源代码 包括apit,dv-hop,amorphous在内的共7个
- 基于python的yolov5实现的旋转目标检测
- 基于matlab实现无线传感器网络 CAB定位仿真程序 这是无线传感器节点定位CAB算法的仿真程序,由matlab完成.rar
- 基于matlab实现图像处理,本程序使用背景差分法对来往车辆进行检测和跟踪.rar
- 基于matlab实现视频监控中车型识别代码,自己写的,希望和大家多多交流.rar
- springcodespringcodespringcodespringcode
- 基于matlab实现权值的MAXDEV无线传感器网络定位算法研究 MAXDEV 无线传感器 定位 算法.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功