• zhengzj
    了解作者
  • Asm
    开发工具
  • 6KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 42
    下载次数
  • 2006-06-27 10:39
    上传日期
此代码的TI DSP 5000系列的DSP汇编源代码,模块化好,执行效率高
JPEG_asm_for_dsp5000.rar
  • JPEG.txt
    24.1KB
  • www.pudn.com.txt
    218B
内容介绍
;--------------------- ;JPEG编码 ;--------------------- JPEGEN.ASM .MMREGS .GLOBAL JPEG_EN .DEF JPEG_EN .DEF J_STATUS,J_STACK .REF PICT,NEXT_LINE .REF IMAGE_LENGTH,IMAGE_WIDTH .REF BLOCK_ENCODE,HUFF_EN .REF DCT_CODE,Y_QUANTIZE_TABLE .REF QUANT_TABLE,ZIGZAG_TABLE .REF DCTB1,COMPRESS_DATA .REF MASKDATA,MASKSIZE,EOB .REF DIFF1,RZERO,IN_SIZE,COWORD .REF ABSDIFF,ABSDIFF1,TRANSDIFF .REF DC_HEAD,DC_TAIL,LESS_BIT .REF DIFF,USER_BIT,RNDOFF .REF LAST_DC,LAST_RESULT .REF ZIGZAG_TABLE0,RDCHUFF .REF DCHUFF,NEXT_SECTION .BSS J_STATUS,2 J_STACK .USECT "J_STACK",10H DCTB1_ADDR .SET DCTB1 .TEXT JPEG_EN: ;---------------------- ;保存程序运行环境 ;---------------------- MVMD ST0,J_STATUS MVMD ST1,J_STATUS+1 LD #J_STACK,DP MVMD AR1,J_STACK+1 MVMD AR2,J_STACK+2 MVMD AR3,J_STACK+3 MVMD AR4,J_STACK+4 MVMD AR5,J_STACK+5 POPD J_STACK+8 ;------------------------ ;JPEG编码初始化 ;------------------------ CALL JPEG_EN_INIT STM #IMAGE_WIDTH-1,AR7 BLOCKEN_LOOP0: STM #IMAGE_LENGTH-1,AR6 BLOCKEN_LOOP: ;-------------------------- ;块编码 ;-------------------------- CALL BLOCK_INIT CALL BLOCK_ENCODE MAR AR6 BANZ BLOCK_LOOP,#AR6- STM #NEXT_SECTION,AR0 MAR AR4 MAR *AR4+0 MAR AR7 BANZ BLOCKEN_LOOP0,*AR7- ;---------------------------- ;恢复程序运行环境 ;---------------------------- LD #J_STACK,DP PSHD J_STACK+8 MVMD J_STACK+5,AR5 MVMD J_STACK+4,AR4 MVMD J_STACK+3,AR3 MVMD J_STACK+2,AR2 MVMD J_STACK+1,AR1 LD #0,DP MVMD J_STATUS+1,ST1 MVMD J_STATUS,ST0 RET ;-------------------------- ;块编码初始化 ;-------------------------- BLOCK_INIT; STM #NEXT_LINE,AR0 MAR AR4 RPT #7 MVDK *AR4,#DCTB1 MAR *AR4+0 RPT #7 MVDK *AR4+,#DCTB1+8 MAR *AR4+0 RPT #7 MVDK *AR4+,#DCTB1+16 MAR *AR4+0 PRT #7 MVDK *AR4+,#DCTB1+24 MAR *AR4+0 RPT #7 MVDK *AR4+,#DCTB1+32 MAR *AR4+0 RPT #7 MVDK *AR4+,#DCTB1+40 MAR *AR4+0 RPT #7 MVDK *AR4+,#DCTB1+48 MAR *AR4+0 RPT #7 MVDK *AR4+,#DCTB1+56 STM #NEXT_SECTION,AR0 MAR *AR4-0 MAR AR2 STM #DCTB1,AR2 STM #63,AR3 JI_LOOP: MAR AR2 LD *AR2,A SUB #128,A STLM A,*AR2+ MAR AR3 BANZ JI_LOOP,*AR3- LD #RNDOFF,DP STM #800OH,RNDOFF RET ;---------------------------- ;JPEG编码初始化 ;包括DCT、量化和Huffman编码三部分 ;----------------------------- JPEG_EN_INIT: DCT_INIT ORM #0000H,PMST RSBX OVLY SSBX SXM SSBX OVM MAR AR5 STM #0FF00H,AR5 RPT #63 MVPD #DCT_COEF,*AR5+ ORM #0020H,PMST SSBX OVLY QUANT_INIT MAR AR5 STM #QUANT_TABLE,AR5 RPT #63 MVPD #Y_QUANTIZE_TABLE,*AR5+ STM #ZIGZAG_TABLE,AR5 RPT #63 MVPD #ZIGZAG_TABLE0,*AR5+ HUFFEN_INIT: STM #DCHUFF,AR1 MAR AR1 RPT #220 MVPD #RDCHUFF,*AR1+ STM #COMPRESS_DATA,AR1 LD #0,A RPT #255 STM 0,*AR1+ STM #COMPRESS_DATA,AR5 STM #PICT,AR4 LD #DIFF,DP ST #0FFF0H,MASKDATA ST #0F000H,MASKSIZE ST #0AH,EOB ST #0H,LAST_DC ST #0H,LAST_RESULT ST #010H,USER_BIT ST #0H,LESS_BIT RET ;------------------------ ;块编码 ;------------------------ BLOCKEN.ASM .MMREGS .DEF BLOCK_ENCODE,IDCT .DEF RNDOFF,BLK2_ADDR,DCTB1 .DEF QUANT_TABLE,ZIGZAG_TABLE .DEF B_STATUS,B_STACK .REF DCT_CODE,Y_QUANTIZE_TABLE .REF MAX_VALUE,MIN_VALUE .DEF DIFF,DIFF1,ABSDIFF,ABSDIFF1 .DEF RZERO,IN_SIZE,COWORD,EOB .DEF MASKDATA,MASKSIZE .DEF SRC,DST,DC_TAIL,DC_HEAD .DEF ACHUFF,DCHUFF,LMASK .DEF QZBI,QZBR,LESS_BIT,DATA .DEF HUFF_EN,DCT2,EOB_SIZE .DEF DCHUFF,TRANSDIFF,LAST_DC .DEF LAST_RESULT,USER_BIT .REF RDCHUFF,DIFFSIZE .REF COMPRESS_DATA .REF ZIGZAG_TABLE0 B_STACK .USER".B_STACK",10H RNDOFF .USECT".DCT_VAR",1 DCTB1 .USECT"DCT_BLK",64 DCTB2 .USECT"DCT_BLK",64 QZBI .USECT".QZ_BLK",64 QZBR .USECT".QZ_BLK",64 QUANT_TABLE .USECT".QZ_TBL",64 ZIGZAG_TABLE .USECT".QZ_TBL",64 DIFF .USECT".HUF_VAR",1 DIFF1 .USECT".HUF_VAR",1 ABSDIFF .USECT".HUF_VAR",1 ABSDIFF1 .USECT".HUF_VAR",1 RZERO .USECT".HUF_VAR",1 IN_SIZE .USECT".HUF_VAR",1 COWORD .USECT".HUF_VAR",1 TRANSDIFF .USECT".HUF_VAR",1 MASKDATA .USECT".HUF_VAR",1 MASKSIZE .USECT".HUF_VAR",1 EOB .USECT".HUF_VAR",1 LAST_DC .USECT".HUF_VAR",1 LAST_RESULT .USECT".HUF_VAR",1 USER_BIT .USECT".HUF_VAR",1 LESS_BIT .USECT".HUF_VAR",1 DC_HEAD .USECT".HUF_VAR",1 DC TALL .USECT".HUF_VAR",1 BLOCK_NUMBER .USECT".HUF_VAR",1 SRC .USECT".HUF_VAR",1 DST .USECT".HUF_VAR",1 LENGTH .USECT".HUF_VAR",1 DATA .USECT".HUF_VAE",12R",1 DCHUFF .USECT"HUFTABL DIFFSIZE .USECT"HUFTABLE",16 LMASK .USECT"HUFTABLE",17 ACHUFF .USECT"HUFTABLE",176 .BSS B_STATUS,2 EOB_SIZE .SET 4 BLK2_ADDR.SET QZBR .TEXT BLOCK_ENCODE ;---------------------------------- ;保存程序运行环境 ;---------------------------------- MVMD ST0,B_STATUS MVMD ST1,B_STATUS+1 LD #B_STACK,DP MVMD AR1,B_STACK MVMD AR2,B_STACK+1 MVMD AR3,B_STACK+2 MVMD AR6,B_STACK+3 POPD B_STACK+4 ;---------------------------------- ;块编码包括DCT、量化和Huffman编码三部分 ;---------------------------------- CALL DCT CALL QUANT CALL HUFF_EN ;---------------------------------- ;恢复程序运行环境 ;---------------------------------- LD #B_STACK,DP PSHD B_STACK+4 MVDM B_STACK+3,AR6 MVDM B_STACK+2,AR3 MVDM B_STACK+1,AR2 MVDM B_STACK,AR1 LD #0,DP MVDM B_STATUS+1,ST1 MVDM B_STATUS,ST0 RET ;----------------------------------- ;DCT与IDCT ;----------------------------------- IDCT: DCT: STM #DCTB1,AR1 STM #DCTB2,AR2 CALL DCT1D STM #DCTB2,AR1 STM #DCTB1,AR2 CALL DCT1D RET ;----------------------------------- ;一维DCT变换 ;---------------------------------- DCT1D: STM #64,AR0 LD #RNDOFF,DP MAR AR1 STM #7,AR3 ROW1: MAR AR1 LD #0,A RPT #7 MACP *AR1+,0FF00H,A MAR AR2 ADDS RNDOFF,A STH A,*AR2+ MAR AR3 BANZ ROW1,*AR3- MAR *AR1-0 ST #7,AR3 ROW2: MAR AR1 LD #0,A RPT #7 MACP *AR1+,0FF08H,A MAR AR2 ADDS RNDOFF,A STH A,*AR2+ MAR AR3 BANZ ROW2,*AR3- MAR *AR1-0 ST #7,AR3 ROW3: MAR AR1 LD #0,A RPT #7 MACP *AR1+,0FF10H,A MAR AR2 ADDS RNDOFF,A STH A,*AR2+ MAR AR3 BANZ ROW3,*AR3- MAR *AR1-0 ST #7,AR3 ROW4: MAR AR1 LD #0,A RPT #7 MACP *AR1+,0FF18H,A MAR AR2 ADDS RNDOFF,A STH A,*AR2+ MAR AR3 BANZ ROW4,*AR3- MAR *AR1-0 ST #7,AR3 ROW5: MAR AR1 LD #0,A RPT #7 ADDS RNDOFF,A STH A,*AR2+ MAR AR3 BANZ ROW8,*AR3- MAR *AR1 RET ;------------------------ ;量化 ;注意ZIGZAG表的应用 ;量化间隔是不均匀的 ;------------------------ QUANT: STM #63,AR0 STM #DCTB1,AR1 STM #ZIGZAG_TABLE,AR2 STM #QUANT_TABLE,AR6 Q_LOOP: MAR AR2 MVDK *AR2+,AR3 MAR AR1 MVDK *AR1+,T MAR AR6 MPY *AR6+,A ADD #0,1,A,A MAR AR3 ADDS RNDOFF,A STH A,*AR3 MAR AR0 BANZ Q_LOOP,*AR0- RET ;------------------------ ;Huffman编码 ;------------------------ HUFF_EN: LD #DIFF,DP LD #0,A STL A,DIFF STL A,IN_SIZE STL A,RZERO DCENHUFF: MAR AR1 STM #QZBR,AR1 LD *AR1,A SUB LAST_DC,A CALL GSIZE MAR AR3 STM #DCHUFF,AR3 MVDM ABSDIFF,AR0 MAR *AR3+0 LD *AR3-0,12,A MAR AR5 CALL GCOWORD ACENHUFF: STM #QZBR,AR1 STM #3EH,AR6 MAR AR1 LD *AR1+,A STL A,LAST_DC CHECKZERO: LD *AR1+,A MAR AR6 BC CKZERO,AEQ CALL GSIZE CONCHECK: LD RZERO.A SUB #10H,A BC NEXT1,ALT LTD ABSDIFF LTD DIFF STL A,RZERO LD #07F9BH,12,A STL A,4,ABSDIFF STL A,4,DIFF CALL GCOWORD LD ABSDIFF1,A STL A,ABSDIFF LD DIFF1,A B CONCHECK NEXT1: RSBX SXM LD RZERO,A ADD ABSDIFF,4,A STL A,TRANSDIFF MAR AR3 MVDM ACHUFF,AR3 MVDM TRANSDIFF,AR0 MAR *AR3+0 BIT *AR3,15 BC NOUSER_16,NTC BIT *AR3,7 BC NOUSER_16,NTC USER_16: LD *AR3-0,16,A B CONTE NOUSER_16: LD *AR3-0,12,A
评论
    相关推荐
    • C6000DSP_JPEG.rar
      利用C6000DSP实现对图像的JPEG压缩代码
    • bmp2jpeg.rar
      将位图转换成jpeg压缩图像,转换速度很快,且通过代码设置参数得到不同质量的jpeg图像,对于开发相关工程很有帮助。
    • JPEG.zip
      jpeg格式压缩的源代码,以及哈夫曼编码的源代码
    • 749673327JPEG可用.rar
      只有在图像区域非常低的视频信号中才含有高频频谱。因此,在数字视频信号处理,根据频谱分配比特的比特数的因素:包含大量的区域分布较低的频谱信息的比特数含有较高的频谱分配较低量的信息,和图像质量并没有明显的损伤...
    • dsp.rar
      高集成的编辑器调整 C 和 DSP 汇编代码: CCS5000 的内建编辑器支持 C 和汇编文件的动态语法加亮显示。使用户能很容 易地阅读代码和当场发现语法错误。
    • 利用C6000DSP实现对图像的JPEG压缩代码.7z
      利用C6000DSP实现对图像的JPEG压缩代码
    • DSP上实现的JPEG算法
      DSP上实现的JPEG算法,简单易用!
    • dsp2p P2P网贷系统、借贷系统
      DSP2P是由宁波天发网络的DSWJCMS团队开发的一套P2P网贷系统,提供P2P网贷基础功能,免费开源,可二次开发,可直接上线运营。 保证该软件可用,安装只需几秒,安装好后,可直接上线运营,所有内容都可后台修改,完全...
    • jpeg压缩纯C语言实现
      利用visual studio 2013平台,实现了对灰度图像的JPEG压缩,纯C语言实现,可直接移植到DSP,单片机等嵌入式平台当中
    • jpeg压缩纯C语言实现
      利用visual studio 2013平台,实现了对灰度图像的JPEG压缩,纯C语言实现,可直接移植到DSP,单片机等嵌入式平台当中