已阅读5页,还剩15页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
RunLengthEncoder Decoder EE113DProjectAuthors ImranHoqueYipengLiDiweiZhang Introduction WhatisRLE CompressiontechniqueRepresentsdatausingvalueandrunlengthRunlengthdefinedasnumberofconsecutiveequalvaluese g1110011111130215 RLE Values RunLengths Introduction Applications Usefulforcompressingdatathatcontainsrepeatedvaluese g outputfromafilter manyconsecutivevaluesare0 VerysimplecomparedwithothercompressiontechniquesReversible Lossless compressiondecompressionisjustaseasy Introduction Applications ImageCompression JPEG RunLengthEncoder Introduction CompressioneffectivenessdependsoninputMusthaveconsecutiverunsofvaluesinordertomaximizecompressionBestcase allvaluessameCanrepresentanylengthusingtwovaluesWorstcase norepeatingvaluesCompresseddatatwicethelengthoforiginal Shouldonlybeusedinsituationswhereweknowforsurehaverepeatingvalues Encoder Algorithm StartonthefirstelementofinputExaminenextvalueIfsameaspreviousvalueKeepacounterofconsecutivevaluesKeepexaminingthenextvalueuntiladifferentvalueorendofinputthenoutputthevaluefollowedbythecounter RepeatIfnotsameaspreviousvalueOutputthepreviousvaluefollowedby 1 runlength Repeat Encoder MatlabCode RunLengthEncoder EE113DProjectfunctionencoded RLE encode input my size size input length my size 2 run length 1 encoded fori 2 lengthifinput i input i 1 run length run length 1 elseencoded encodedinput i 1 run length run length 1 endendiflength 1 Addlastvalueandrunlengthtooutputencoded encodedinput i run length else Specialcaseifinputisoflength1encoded input 1 1 end Encoder MatlabResults RLE encode 10000222113 ans 1104231231 RLE encode 00000000000 ans 011 RLE encode 0123456789 ans 01112131415161718191 Encoder Inputfromseparate asmfileIntheformofavectore g array word4 5 5 2 7 3 6 9 9 10 10 10 10 10 10 0 0 OutputisdeclaredasdatamemoryspaceExaminememorytogetoutputOriginallydeclaredtobeall 1 ImmediateProblemOutputsizenotknownuntilrun time dependsoninputsizeaswellasinputpattern Cannotinitializevariablesizearray Encoder SolutionLimituserinputtopresetlength 16 Initializeoutputtoworstcase doubleinputlength 32 Initializeoutputtoall 1 s we reonlyhandlingpositivenumbersand0asinputs Outputendswhen 1firstappearsoriflengthofoutputequalstoworstcase Encoder DSPCode EE113DFinalProject encoder RunLengthEncoder Shortensaseriesofinputdatabyrepresenting consecutiverepeatednumbersastherepeatednumber followedby thenumberofrepetitions Writtenby Yi pengLi DiweiZhang ImranHoque setsect text 0 x500 0 Executiblecodein text sectionwillbeginat0 x500 inprogrammemory setsect data 0 x800 1 Numberstobesortedwill beginat0 x800indatamemory data Datasectionbegins copy e inputs asm Readsinputvaluesandinitializeoutput text Executiblecodesectionbegins count1 set1 Initializeacounterstartingatthenumber1count2 set15 Initializeacounterstartingatthenumber15 Encoder DSPCode AR6 array AR6pointstotheinputdatalocationAR3 array AR3pointstothenextinputdatalocationA AR3 A AR3AR5 A AR5representstheactualnumberstored inthememoryaddressAR3pointsto theactualnumberrepresentedintheinput A AR6AR0 A AR0representstheactualnumberstored inthememoryaddressAR6pointstoAR4 output AR4pointstotheoutputdatalocationAR2 count2 AR2keepstrackofhowmuchoftheinput datahasbeenread loop1initializesthecountofAR1to 1 loop1AR1 count1 RegisterAR1isusedtokeeptrackofthe numberofrepeatedinputsinsuccession loop2readsthroughtheinputdata andkeeps trackofthenumberofconsecutiveinputsloop2TC AR0 AR5 ComparesthenumberstoredinAR5withthe numberstoredinAR0A AR6 IncrementthepointerAR6A AR3 IncrementthepointerAR3 Encoder DSPCode A AR3AR5 A Re initializeAR5A AR6AR0 A Re initializeAR0if TC gotoloop3 BreakloopifnextnumberdifferentA AR1 elsecontinuecountingif AR2 0 gotoloop2 StopencoderifcountofAR2reacheszeroA AR2 LeavecountofAR2atzero loop3storestheencodedinput followedby itsrepeatedcountintotheoutputarrayloop3A AR6 PointbacktothelastrepeatednumberA AR6 AR4 A AddtherepeatednumbertooutputA AR1 AR4 A AddthecountofrepeatednumbertooutputA AR6 Movepointerbacktowhereitleftoffif AR2 0 gotoloop1 StopencoderifcountofAR2reacheszerostopnopgotostop infiniteloop end Encoder DSPResults Input 4 5 5 2 7 3 6 9 9 10 10 10 10 10 10 0 0Output 4 1 5 2 2 1 7 1 3 1 6 1 9 2 10 6 0 2 1 1 1 1 1 1 1 1 1 1 BestCase Input 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0Output 0 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 WorstCase Input 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Output 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 ValidOutput OutputEndsHere Decoder MatlabCode RunLengthDecoder EE113DProject TheinputtothisfunctionshouldbetheoutputfromRunLengthEncoder whichmeansitassumesevennumberofelementsintheinput Thefirst elementisavaluefollowedbytheruncount Thusalloddelementsin theinputareassumedthevaluesandevenelementstheruncounts functiondecoded RLE decode encoded my size size encoded length my size 2 index 1 decoded iteratethroughtheinputwhile index length getvaluewhichisfollowedbytheruncountvalue encoded index run length encoded index 1 fori 1 run length loopadding value tooutput run length timesdecoded decodedvalue end putindexatnextvalueelement oddelement index index 2 end Decoder MatlabResults RLE decode 012 ans 000000000000 RLE decode 011121314151 ans 012345 RLE decode RLE encode 0031445610 ans 0031445610 Decoder DSPCode EE113DFinalProject decoder RunLengthEncoder Takesasitsinput astringofdataencoded accordingthetherunlengthencoderalgorithm andoutputsit asthedecodedstringofdataoriginallyinputtotheencoder Writtenby Yi pengLi DiweiZhang ImranHoque setsect text 0 x500 0 Executiblecodein text sectionwillbeginat0 x500 inprogrammemory setsect data 0 x800 1 Numberstobesortedwillbeginat0 x800indatamemory data Datasectionbegins copy d inputs asm Getinputvaluesandinitialzeoutputs text Executiblecodesectionbegins count2 set14 Initializeacounterstartingatthenumber14AR6 array AR6pointstotheinputdatalocationAR3 array AR3pointstothenextinputdatalocationA AR3 A AR3AR5 A AR5keepstrackofthenumberofrepetitions Decoder DSPCode AR4 output AR4pointstotheoutputdatalocationAR2 count2 AR0keepstrackofhowmuchoftheinput datahasbeenread loop2readsthroughtheinputdatatothedecoderloop2if AR5 0 gotoloop3 Keepoutputtingthecurrentinputnumberuntil thefollowingcountofthatnumberreacheszeroA AR6 ElsecontinuereadingthruinputA A
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 注册城乡规划师考试建设用地规模测算案例专项模拟试卷及答案
- 2027年山东省教师招聘考试幼儿教育基础知识历年汇编试卷及答案
- 2027年安徽省卫生健康系统招聘考试上半年卫生管理高分冲刺试卷含解析及答案
- 2027年大庆市公立医院招聘考试下半年护理学考前必做试卷含解析及答案
- 2027年哈尔滨市教师招聘考试秋季教育基础知识模拟试卷含解析及答案
- 2027年南昌市教师招聘考试下半年学科专业知识(历史)名师押题试卷电子版及答案
- 2027年北京市卫生健康系统招聘考试康复治疗考前必做试卷含解析及答案
- 2027年乌鲁木齐市公立医院招聘考试下半年卫生管理专项练习试卷含解析及答案
- 2027年九江市公立医院招聘考试口腔医学押题试卷打印版及答案
- 2027年三门峡市教师招聘考试春季新课改模拟试卷打印版及答案
- 金川集团2026年社招考试题
- YB-T6332-2024《钢铁行业用塑烧板除尘器》
- 小学音乐课堂中生成式AI辅助的个性化音乐鉴赏路径构建教学研究课题报告
- 2025年天津事业单位财会类笔试真题及答案
- 2026年天津春考计算机考试试卷及答案
- 睡眠健康讲课课件图片
- 供电公司消防培训课件
- 无侧限抗压试件制作赵凤杰四川交通22课件
- 超声产前筛查试题及答案
- 人教版七年级数学上册第五单元一元一次方程《实际问题与一元一次方程( 第2课时)》示范公开课教学设计
- 《电力电子技术》考试复习题库(含答案)
评论
0/150
提交评论