




已阅读5页,还剩42页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1,Chapter7DigitalCameraExample,太原房产网,2,Outline,IntroductiontoasimpledigitalcameraDesignersperspectiveRequirementsspecificationDesignFourimplementations,3,PuttingitalltogetherGeneral-purposeprocessorSingle-purposeprocessorCustomStandardMemoryInterfacingKnowledgeappliedtodesigningasimpledigitalcameraGeneral-purposevs.single-purposeprocessorsPartitioningoffunctionalityamongdifferentprocessortypes,Introduction,4,Introductiontoasimpledigitalcamera,CapturesimagesStoresimagesindigitalformatNofilmMultipleimagesstoredincameraNumberdependsonamountofmemoryandbitsusedperimageDownloadsimagestoPCOnlyrecentlypossibleSystems-on-a-chipMultipleprocessorsandmemoriesononeICHigh-capacityflashmemoryVerysimpledescriptionusedforexampleManymorefeatureswithrealdigitalcameraVariablesizeimages,imagedeletion,digitalstretching,zoominginandout,etc.,5,Designersperspective,TwokeytasksProcessingimagesandstoringinmemoryWhenshutterpressed:ImagecapturedConvertedtodigitalformbycharge-coupleddevice(CCD)CompressedandarchivedininternalmemoryUploadingimagestoPCDigitalcameraattachedtoPCSpecialsoftwarecommandscameratotransmitarchivedimagesserially,6,Charge-coupleddevice(CCD),SpecialsensorthatcapturesanimageLight-sensitivesiliconsolid-statedevicecomposedofmanycells,7,Zero-biaserror,ManufacturingerrorscausecellstomeasureslightlyaboveorbelowactuallightintensityErrortypicallysameacrosscolumns,butdifferentacrossrowsSomeofleftmostcolumnsblockedbyblackpainttodetectzero-biaserrorReadingofotherthan0inblockedcellsiszero-biaserrorEachrowiscorrectedbysubtractingtheaverageerrorfoundinblockedcellsforthatrow,8,Compression,StoremoreimagesTransmitimagetoPCinlesstimeJPEG(JointPhotographicExpertsGroup)PopularstandardformatforrepresentingdigitalimagesinacompressedformProvidesforanumberofdifferentmodesofoperationModeusedinthischapterprovideshighcompressionratiosusingDCT(discretecosinetransform)Imagedatadividedintoblocksof8x8pixels3stepsperformedoneachblockDCTQuantizationHuffmanencoding,9,DCTstep,Transformsoriginal8x8blockintoacosine-frequencydomainUpper-leftcornervaluesrepresentmoreoftheessenceoftheimageLower-rightcornervaluesrepresentfinerdetailsCanreduceprecisionofthesevaluesandretainreasonableimagequalityFDCT(ForwardDCT)formulaC(h)=if(h=0)then1/sqrt(2)else1.0AuxiliaryfunctionusedinmainfunctionF(u,v)F(u,v)=xC(u)xC(v)x=0.7y=0.7Dxyxcos(2u+1)u/16)xcos(2y+1)v/16)Givesencodedpixelatrowu,columnvDxyisoriginalpixelvalueatrowx,columnyIDCT(InverseDCT)Reversesprocesstoobtainoriginalblock(notneededforthisdesign),10,Quantizationstep,AchievehighcompressionratiobyreducingimagequalityReducebitprecisionofencodeddataFewerbitsneededforencodingOnewayistodivideallvaluesbyafactorof2SimplerightshiftscandothisDequantizationwouldreverseprocessfordecompression,AfterbeingdecodedusingDCT,Afterquantization,Divideeachcellsvalueby8,11,Serialize8x8blockofpixelsValuesareconvertedintosinglelistusingzigzagpatternPerformHuffmanencodingMorefrequentlyoccurringpixelsassignedshortbinarycodeLongerbinarycodesleftforlessfrequentlyoccurringpixelsEachpixelinseriallistconvertedtoHuffmanencodedvaluesMuchshorterlist,thuscompression,Huffmanencodingstep,12,Huffmanencodingexample,PixelfrequenciesonleftPixelvalue1occurs15timesPixelvalue14occurs1timeBuildHuffmantreefrombottomupCreateoneleafnodeforeachpixelvalueandassignfrequencyasnodesvalueCreateaninternalnodebyjoininganytwonodeswhosesumisaminimalvalueThissumisinternalnodesvalueRepeatuntilcompletebinarytreeTraversetreefromroottoleaftoobtainbinarycodeforleafspixelvalueAppend0forlefttraversal,1forrighttraversalHuffmanencodingisreversibleNocodeisaprefixofanothercode,13,Archivestep,RecordstartingaddressandimagesizeCanuselinkedlistOnepossiblewaytoarchiveimagesIfmaxnumberofimagesarchivedisN:SetasidememoryforNaddressesandNimage-sizevariablesKeepacounterforlocationofnextavailableaddressInitializeaddressesandimage-sizevariablesto0SetglobalmemoryaddresstoNx4Assumingaddresses,image-sizevariablesoccupyNx4bytesFirstimagearchivedstartingataddressNx4GlobalmemoryaddressupdatedtoNx4+(compressedimagesize)MemoryrequirementbasedonN,imagesize,andaveragecompressionratio,14,UploadingtoPC,WhenconnectedtoPCanduploadcommandreceivedReadimagesfrommemoryTransmitseriallyusingUARTWhiletransmittingResetpointers,image-sizevariablesandglobalmemorypointeraccordingly,15,RequirementsSpecification,SystemsrequirementswhatsystemshoulddoNonfunctionalrequirementsConstraintsondesignmetrics(e.g.,“shoulduse0.001wattorless”)FunctionalrequirementsSystemsbehavior(e.g.,“outputXshouldbeinputYtimes2”)Initialspecificationmaybeverygeneralandcomefrommarketingdept.E.g.,shortdocumentdetailingmarketneedforalow-enddigitalcamerathat:capturesandstoresatleast50low-resimagesanduploadstoPC,costsaround$100withsinglemedium-sizeICcostinglessthat$25,haslongaspossiblebatterylife,hasexpectedsalesvolumeof200,000ifmarketentry6months,100,000ifbetween6and12months,insignificantsalesbeyond12months,16,Nonfunctionalrequirements,DesignmetricsofimportancebasedoninitialspecificationPerformance:timerequiredtoprocessimageSize:numberofelementarylogicgates(2-inputNANDgate)inICPower:measureofavg.electricalenergyconsumedwhileprocessingEnergy:batterylifetime(powerxtime)ConstrainedmetricsValuesmustbebelow(sometimesabove)certainthresholdOptimizationmetricsImprovedasmuchaspossibletoimproveproductMetriccanbebothconstrainedandoptimization,17,Nonfunctionalrequirements(cont.),PerformanceMustprocessimagefastenoughtobeuseful1secreasonableconstraintSlowerwouldbeannoyingFasternotnecessaryforlow-endofmarketTherefore,constrainedmetricSizeMustuseICthatfitsinreasonablysizedcameraConstrainedandoptimizationmetricConstraintmaybe200,000gates,butsmallerwouldbecheaperPowerMustoperatebelowcertaintemperature(coolingfannotpossible)Therefore,constrainedmetricEnergyReducingpowerortimereducesenergyOptimizedmetric:wantbatterytolastaslongaspossible,18,Informalfunctionalspecification,FlowchartbreaksfunctionalitydownintosimplerfunctionsEachfunctionsdetailscouldthenbedescribedinEnglishDoneearlierinchapterLowqualityimagehasresolutionof64x64Mappingfunctionstoaparticularprocessortypenotdoneatthisstage,19,Refinedfunctionalspecification,RefineinformalspecificationintoonethatcanactuallybeexecutedCanuseC/C+codetodescribeeachfunctionCalledsystem-levelmodel,prototype,orsimplymodelAlsoisfirstimplementationCanprovideinsightintooperationsofsystemProfilingcanfindcomputationallyintensivefunctionsCanobtainsampleoutputusedtoverifycorrectnessoffinalimplementation,Executablemodelofdigitalcamera,20,CCDmodule,SimulatesrealCCDCcdInitializeispassednameofimagefileCcdCapturereads“image”fromfileCcdPopPixeloutputspixelsoneatatime,charCcdPopPixel(void)charpixel;pixel=bufferrowIndexcolIndex;if(+colIndex=SZ_COL)colIndex=0;if(+rowIndex=SZ_ROW)colIndex=-1;rowIndex=-1;returnpixel;,#include#defineSZ_ROW64#defineSZ_COL(64+2)staticFILE*imageFileHandle;staticcharbufferSZ_ROWSZ_COL;staticunsignedrowIndex,colIndex;,voidCcdInitialize(constchar*imageFileName)imageFileHandle=fopen(imageFileName,r);rowIndex=-1;colIndex=-1;,voidCcdCapture(void)intpixel;rewind(imageFileHandle);for(rowIndex=0;rowIndexSZ_ROW;rowIndex+)for(colIndex=0;colIndexSZ_COL;colIndex+)if(fscanf(imageFileHandle,%i,21,CCDPP(CCDPreProcessing)module,Performszero-biasadjustmentCcdppCaptureusesCcdCaptureandCcdPopPixeltoobtainimagePerformszero-biasadjustmentaftereachrowreadin,#defineSZ_ROW64#defineSZ_COL64staticcharbufferSZ_ROWSZ_COL;staticunsignedrowIndex,colIndex;,voidCcdppInitialize()rowIndex=-1;colIndex=-1;,voidCcdppCapture(void)charbias;CcdCapture();for(rowIndex=0;rowIndexSZ_ROW;rowIndex+)for(colIndex=0;colIndexSZ_COL;colIndex+)bufferrowIndexcolIndex=CcdPopPixel();bias=(CcdPopPixel()+CcdPopPixel()/2;for(colIndex=0;colIndexSZ_COL;colIndex+)bufferrowIndexcolIndex-=bias;rowIndex=0;colIndex=0;,charCcdppPopPixel(void)charpixel;pixel=bufferrowIndexcolIndex;if(+colIndex=SZ_COL)colIndex=0;if(+rowIndex=SZ_ROW)colIndex=-1;rowIndex=-1;returnpixel;,22,UARTmodule,ActuallyahalfUARTOnlytransmits,doesnotreceiveUartInitializeispassednameoffiletooutputtoUartSendtransmits(writestooutputfile)bytesatatime,#includestaticFILE*outputFileHandle;voidUartInitialize(constchar*outputFileName)outputFileHandle=fopen(outputFileName,w);voidUartSend(chard)fprintf(outputFileHandle,%in,(int)d);,23,CODECmodule,ModelsFDCTencodingibufferholdsoriginal8x8blockobufferholdsencoded8x8blockCodecPushPixelcalled64timestofillibufferwithoriginalblockCodecDoFdctcalledoncetotransform8x8blockExplainedinnextslideCodecPopPixelcalled64timestoretrieveencodedblockfromobuffer,24,CODEC(cont.),ImplementingFDCTformulaC(h)=if(h=0)then1/sqrt(2)else1.0F(u,v)=xC(u)xC(v)x=0.7y=0.7Dxyxcos(2u+1)u/16)xcos(2y+1)v/16)Only64possibleinputstoCOS,sotablecanbeusedtosaveperformancetimeFloating-pointvaluesmultipliedby32,678androundedtonearestinteger32,678choseninordertostoreeachvaluein2bytesofmemoryFixed-pointrepresentationexplainedmorelaterFDCTunrollsinnerloopofsummation,implementsoutersummationastwoconsecutiveforloops,staticconstshortCOS_TABLE88=32768,32138,30273,27245,23170,18204,12539,6392,32768,27245,12539,-6392,-23170,-32138,-30273,-18204,32768,18204,-12539,-32138,-23170,6392,30273,27245,32768,6392,-30273,-18204,23170,27245,-12539,-32138,32768,-6392,-30273,18204,23170,-27245,-12539,32138,32768,-18204,-12539,32138,-23170,-6392,30273,-27245,32768,-27245,12539,6392,-23170,32138,-30273,18204,32768,-32138,30273,-27245,23170,-18204,12539,-6392;,staticintFDCT(intu,intv,shortimg88)doubles8,r=0;intx;for(x=0;x2?argv2:image.txt;/*initializethemodules*/UartInitialize(uartOutputFileName);CcdInitialize(imageFileName);CcdppInitialize();CodecInitialize();CntrlInitialize();/*simulatefunctionality*/CntrlCaptureImage();CntrlCompressImage();CntrlSendImage();,27,Design,DeterminesystemsarchitectureProcessorsAnycombinationofsingle-purpose(customorstandard)orgeneral-purposeprocessorsMemories,busesMapfunctionalitytothatarchitectureMultiplefunctionsononeprocessorOnefunctionononeormoreprocessorsImplementationAparticulararchitectureandmappingSolutionspaceissetofallimplementationsStartingpointLow-endgeneral-purposeprocessorconnectedtoflashmemoryAllfunctionalitymappedtosoftwarerunningonprocessorUsuallysatisfiespower,size,andtime-to-marketconstraintsIftimingconstraintnotsatisfiedthenlaterimplementationscould:usesingle-purposeprocessorsfortime-criticalfunctionsrewritefunctionalspecification,28,Implementation1:Microcontrolleralone,Low-endprocessorcouldbeIntel8051microcontrollerTotalICcostincludingNREabout$5Wellbelow200mWpowerTime-to-marketabout3monthsHowever,oneimagepersecondnotpossible12MHz,12cyclesperinstructionExecutesonemillioninstructionspersecondCcdppCapturehasnestedloopsresultingin4096(64x64)iterations100assemblyinstructionseachiteration409,000(4096x100)instructionsperimageHalfofbudgetforreadingimagealoneWouldbeoverbudgetafteraddingcompute-intensiveDCTandHuffmanencoding,29,Implementation2:MicrocontrollerandCCDPP,CCDPPfunctionimplementedoncustomsingle-purposeprocessorImprovesperformancelessmicrocontrollercyclesIncreasesNREcostandtime-to-marketEasytoimplementSimpledatapathFewstatesincontrollerSimpleUARTeasytoimplementassingle-purposeprocessoralsoEEPROMforprogrammemoryandRAMfordatamemoryaddedaswell,30,Microcontroller,SynthesizableversionofIntel8051availableWritteninVHDLCapturedatregistertransferlevel(RTL)FetchesinstructionfromROMDecodesusingInstructionDecoderALUexecutesarithmeticoperationsSourceanddestinationregistersresideinRAMSpecialdatamovementinstructionsusedtoloadandstoreexternallySpecialprogramgeneratesVHDLdescriptionofROMfromoutputofCcompiler/linker,31,UART,UARTinidlemodeuntilinvokedUARTinvokedwhen8051executesstoreinstructionwithUARTsenableregisterastargetaddressMemory-mappedcommunicationbetween8051andallsingle-purposeprocessorsLower8-bitsofmemoryaddressforRAMUpper8-bitsofmemoryaddressformemory-mappedI/OdevicesStartstatetransmits0indicatingstartofbytetransmissionthentransitionstoDatastateDatastatesends8bitsseriallythentransitionstoStopstateStopstatetransmits1indicatingtransmissiondonethentransitionsbacktoidlemode,invoked,I=8,I10millionintegeroperationsperimageProceduresincreasecodesizeFixed-pointarithmeticcanimproveonthis,39,Fixed-pointarithmetic,IntegerusedtorepresentarealnumberConstantnumberofintegersbitsrepresentsfractionalportionofrealnumberMorebits,moreaccuratetherepresentationRemainingbitsrepresentportionofrealnumberbeforedecimalpointTranslatingarealconstanttoafixed-pointrepresentationMultiplyrealvalueby2(#ofbitsusedforfractionalpart)RoundtonearestintegerE.g.,represent3.14as8-bitintegerwith4bitsforfraction24=163.14x16=50.2450=0011001016(24)possiblevaluesforfraction,eachrepresents0.0625(1/16)Last4bits(0010)=22x0.0625=0.1253(0011)+0.125=3.1253.14(morebitsforfractionwouldincreaseaccuracy),40,Fixed-pointarithmeticoperations,AdditionSimplyaddintegerrepresentationsE.g.,3.14+2.71=5.853.1450=001100102.7143=0010101150+43=93=010111015(0101)+13(1101)x0.0625=5.81255.85MultiplyMultiplyintegerrepresentationsShiftresultrightby#ofbitsinfractionalpartE.g.,3.14*2.71=8.509450*43=2150=1000011001104=100001108(1000)+6(0110)x0.0625=8.3758.5094Rangeofrealvaluesusedlimitedbybitwidthsofpossibleresultingvalues,41,Fixed-pointimplementationofCODEC,COS_TABLEgives8-bitfixed-pointrepresentationofcosinevalues6bitsusedforfractionalportionResultofmultiplicationsshiftedrightby6,voidCodecDoFdct(void)unsignedshortx,y;for(x=0;x6;return(short)(r*(16*C(u)6)*C(v)6)6)6);,voidCodecPushPixel(shortp)if(idx=64)idx=0;inBufferidx/8idx%8=p6;idx+;,42,Implementation3:MicrocontrollerandCCDPP/Fixed-PointDCT,Analysisofimplementation3Usesameanalysistechniquesasimplementation2Totalexecutiontimeforprocessingoneimage:1.5secondsPowerconsumption:0.033watt(sameas2)Energyconsumption:0.050joule(1.5sx0.033watt)Batterylife6xlonger!Totalchiparea:90,000gates8,000lessgates(lessmemoryneededforcode),43,Implementation4:MicrocontrollerandCCDPP/DCT,Perform
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年眼科常见疾病治疗方案考核答案及解析
- 2025年老年病学常见疾病护理知识测试答案及解析
- 文化旅游项目投资可行性研究
- 建筑冠梁拆除施工安全技术要点
- 2025年口腔科常见口腔疾病诊疗知识考核答案及解析
- 教育评估体系构建与实施方案
- 2025年儿科感染性疾病诊疗实践考试卷答案及解析
- 企业燃气工程安全管理标准流程
- 高一英语完形填空技巧及典型题目解析
- 2025银行岗位全真模拟模拟题及答案详解(名校卷)
- 妊娠合并贫血课件
- 手术室感染监测课件
- 抖音:短视频与直播运营全套教学课件
- 拍卖行业发展趋势PPT
- 【监理公司】市政工程(道路及排水)质量评估报告范本(WORD档)
- 中国特色社会主义思想概论 课件 第四章 坚持以人民为中心
- 退役士兵求职简历模板+自荐书
- 湘菜湖南美食文化介绍PPT
- 外科学外科休克PPT
- 浙人美2011版四年级美术上册《水资源》教案及教学反思
- 全桥LLC自动计算表格
评论
0/150
提交评论