多媒體技術(shù)課程設(shè)計(jì)報(bào)告_第1頁(yè)
多媒體技術(shù)課程設(shè)計(jì)報(bào)告_第2頁(yè)
多媒體技術(shù)課程設(shè)計(jì)報(bào)告_第3頁(yè)
多媒體技術(shù)課程設(shè)計(jì)報(bào)告_第4頁(yè)
多媒體技術(shù)課程設(shè)計(jì)報(bào)告_第5頁(yè)
已閱讀5頁(yè),還剩30頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、PAGE PAGE 34二九 二一 學(xué)年第 二 學(xué)期應(yīng)用技術(shù)學(xué)院課程設(shè)計(jì)報(bào)告書課程名稱: 多媒體技術(shù) 班 級(jí): 09級(jí)網(wǎng)絡(luò)工程 學(xué) 號(hào):姓 名:指導(dǎo)教師:二一 年 六 月目錄TOC o 1-3 h z u HYPERLINK l _Toc263701556 1.需求分析 PAGEREF _Toc263701556 h 2 HYPERLINK l _Toc263701557 1.1課程設(shè)計(jì)題目 PAGEREF _Toc263701557 h 2 HYPERLINK l _Toc263701558 1.2課程設(shè)計(jì)要求 PAGEREF _Toc263701558 h 2 HYPERLINK l _T

2、oc263701559 1.3系統(tǒng)功能需求分析 PAGEREF _Toc263701559 h 2 HYPERLINK l _Toc263701560 2.概要設(shè)計(jì) PAGEREF _Toc263701560 h 3 HYPERLINK l _Toc263701561 3.詳細(xì)設(shè)計(jì) PAGEREF _Toc263701561 h 4 HYPERLINK l _Toc263701562 3.1界面設(shè)計(jì) PAGEREF _Toc263701562 h 4 HYPERLINK l _Toc263701563 3.2行程編碼設(shè)計(jì) PAGEREF _Toc263701563 h 11 HYPERLINK

3、 l _Toc263701564 4.程序調(diào)試 PAGEREF _Toc263701564 h 14 HYPERLINK l _Toc263701565 4.1源文件的壓縮 PAGEREF _Toc263701565 h 14 HYPERLINK l _Toc263701566 4.2源文件的解壓 PAGEREF _Toc263701566 h 15 HYPERLINK l _Toc263701567 5.總結(jié) PAGEREF _Toc263701567 h 181.需求分析1.1課程設(shè)計(jì)題目信源與信道編/解碼練習(xí)。1.2課程設(shè)計(jì)要求要求利用程序設(shè)計(jì)軟件(如VC、Java、Matlab)制作一

4、個(gè)能完成信道編/解碼(海明/CRC碼),信源編/解碼(如行程編碼)軟件?;疽鬄榫幹栖浖辽倌芨鶕?jù)所輸入的數(shù)據(jù)完成信源、信道編解碼,其中信道編碼要求能產(chǎn)生1-2位隨機(jī)錯(cuò)誤,且能糾1位錯(cuò),最后是能讀取txt文件,或者直接讀取圖片來(lái)完成,如能對(duì)視頻完成則更佳。編寫的軟件編譯后能直接運(yùn)行,驗(yàn)證編/解碼效果,否則無(wú)效。 1.3系統(tǒng)功能需求分析操作環(huán)境(軟件、硬件及條件) Windws 9x/NT/2000/XP/2003 NetBeans IDE 6.8系統(tǒng)功能此軟件是在JAVA平臺(tái)下編寫的 ,能根據(jù)所輸入的數(shù)據(jù)完成信道(海明碼)、信源編解碼(行程編碼),其中信道編碼(海明碼)能產(chǎn)生1位隨機(jī)錯(cuò)誤,且

5、能糾1位錯(cuò),最后是能直接讀取圖片或txt文件來(lái)完成。用戶操作流程 編 碼: 打開(kāi)(選擇源文件)打開(kāi)(選擇源文件)保存(選擇目標(biāo)文件)保存(選擇目標(biāo)文件)開(kāi)始編碼開(kāi)始編碼 校驗(yàn) 校驗(yàn)查看所存目標(biāo)文件是否壓縮成功查看所存目標(biāo)文件是否壓縮成功 解 碼:打開(kāi)(選擇已壓縮的文件)打開(kāi)(選擇已壓縮的文件)保存(選擇目標(biāo)文件)保存(選擇目標(biāo)文件)開(kāi)始解碼開(kāi)始解碼查看所存目標(biāo)文件是否解壓成功查看所存目標(biāo)文件是否解壓成功2.概要設(shè)計(jì)系統(tǒng)總體框架: 壓 縮 壓 縮檢 錯(cuò)打開(kāi)源文件檢 錯(cuò)打開(kāi)源文件 糾 錯(cuò)得到源文件 糾 錯(cuò)得到源文件 解 壓 解 壓3.詳細(xì)設(shè)計(jì)本次課程設(shè)計(jì)中我主要負(fù)責(zé)界面設(shè)計(jì)和行程編碼,故作以下詳細(xì)

6、介紹。3.1界面設(shè)計(jì)界面設(shè)計(jì)如圖3-1所示:圖3-1界面設(shè)計(jì)代碼如下:package DMTcode;import java.io.File;import javax.swing.JFileChooser;import javax.swing.JOptionPane;public class NewJFrame extends javax.swing.JFrame int rndChooser; byte targetBit; private int i; File f1,f2; byte mybyte1,mybyte2; public NewJFrame() initComponents()

7、; this.setTitle(重慶大學(xué) 09網(wǎng)絡(luò)工程 尹力 沈小波 多媒體課程設(shè)計(jì)); SuppressWarnings(unchecked); private void initComponents() jPanel1 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jTextF

8、ield2 = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jLab

9、el5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jButton3 = new javax.swing.JButton(); jLabel9 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBorder

10、(javax.swing.BorderFactory.createTitledBorder(行程編碼文件); jButton1.setText(打開(kāi)); jButton1.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) jButton1ActionPerformed(evt); ); jLabel1.setText(源文件:); jTextField1.setEnabled(false); jLabel2.setTe

11、xt(目標(biāo)文件:); jTextField2.setEnabled(false); jButton2.setText(保存); jButton2.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) jButton2ActionPerformed(evt); ); jButton4.setText(開(kāi)始編碼); jButton4.addActionListener(new java.awt.event.ActionList

12、ener() public void actionPerformed(java.awt.event.ActionEvent evt) jButton4ActionPerformed(evt); ); jButton5.setText(開(kāi)始解碼); jButton5.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) jButton5ActionPerformed(evt); ); javax.swing.GroupLay

13、out jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(38, 38, 38) .addGroup(jPanel1Layout.create

14、ParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField2) .addGroup(jPanel1Layout.c

15、reateSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 103,

16、 Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton2) .addComponent(jButton1) .addGap(50, 50, 50) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton5) .addComponent(j

17、Button4) .addContainerGap(98, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGr

18、oup(jPanel1Layout.createSequentialGroup() .addGap(17, 17, 17) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayou

19、t.PREFERRED_SIZE) .addGap(7, 7, 7) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup

20、(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParalle

21、lGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton5) .addComponent(jButton2) .addContainerGap(11, Short.MAX_VALUE) ); getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder( 文件信息); jPanel2.setPreferredSize

22、(new java.awt.Dimension(442, 40); jLabel3.setText(源文件大?。?; jLabel4.setText(目標(biāo)文件大小:); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LE

23、ADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(29, 29, 29) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 268, Short.MAX_VALUE) .addComponent(jLabel4) .addGap(200, 200, 200) ); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGro

24、up(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jLabel4) .addContainerGap(17, Short.MAX_VALUE) ); getContentPane().add(jPanel2, j

25、ava.awt.BorderLayout.CENTER); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(海明編碼信息); jLabel6.setText(字節(jié)二進(jìn)制編碼:); jLabel7.setText(字節(jié)海明編碼:); jLabel8.setText(隨機(jī)出錯(cuò):); jButton3.setText(校驗(yàn)); jButton3.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt

26、.event.ActionEvent evt) jButton3ActionPerformed(evt); ); jLabel9.setText(糾正:); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING

27、) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(26, 26, 26) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 321

28、, Short.MAX_VALUE) .addComponent(jLabel9) .addGap(186, 186, 186) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 278, Short.MAX_VALUE) .addComponent(jButton3) .addGap(232, 232, 232) .addGroup(jPanel3Layout.cr

29、eateSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(jLabel5) .addContainerGap(531, Short.MAX_VALUE) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA

30、DING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup

31、(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(jButton3) .addC

32、ontainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); getContentPane().add(jPanel3, java.awt.BorderLayout.SOUTH); pack(); / private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) / TODO add your handling code here: JFileChooser chooser=new JFileChooser(); chooser.showOp

33、enDialog(jLabel1); jTextField1.setText(chooser.getSelectedFile().getPath().toString(); jLabel3.setText(源文件大小:+chooser.getSelectedFile().length()+字節(jié)); f1=chooser.getSelectedFile(); private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) / TODO add your handling code here: JFileChooser ch

34、ooser1=new JFileChooser(); chooser1.showSaveDialog(jLabel1); f2=chooser1.getSelectedFile(); jTextField2.setText(chooser1.getSelectedFile().getPath().toString();jLabel4.setText(目標(biāo)文件大小:+chooser1.getSelectedFile().length()+字節(jié)); private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) jLabel

35、8.setText(隨機(jī)出錯(cuò):+myOp.revertAndCheckhammingCode()0); jLabel9.setText(糾正:+myOp.revertAndCheckhammingCode()1); private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) / TODO add your handling code here: /*調(diào)用編碼方法開(kāi)始?jí)嚎s文件*/ if(jTextField1.getText()=null&jTextField2.getText()=null) JOptionPane.

36、showMessageDialog(null, 還沒(méi)有設(shè)置文件呢!); else try mybyte1=myOp.importFile(f1); mybyte2=myOp.zipCode(mybyte1); myOp.exportFile(f2, mybyte2); jLabel4.setText(目標(biāo)文件大小:+f2.length()+字節(jié)); rndChooser=(int)(Math.random()*mybyte2.length); targetBit=mybyte2rndChooser; jLabel5.setText(字節(jié)值:+String.valueOf(targetBit);

37、 jLabel6.setText(字節(jié)二進(jìn)制編碼:+myOp.hammingCode(targetBit)0); jLabel7.setText(字節(jié)海明編碼:+myOp.hammingCode(targetBit)1); catch(Exception e) private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) /*調(diào)用解碼碼方法開(kāi)始解壓文件*/ if(jTextField1.getText()=null&jTextField2.getText()=null) JOptionPane.showMessageD

38、ialog(null, 還沒(méi)有設(shè)置文件呢!); else try mybyte1=myOp.importFile(f1); mybyte2=myOp.unzipCode(mybyte1); myOp.exportFile(f2, mybyte2); jLabel4.setText(目標(biāo)文件大小:+f2.length()+字節(jié)); rndChooser=(int)(Math.random()*mybyte2.length); targetBit=mybyte2rndChooser; jLabel5.setText(字節(jié)值:+String.valueOf(targetBit); jLabel6.s

39、etText(字節(jié)二進(jìn)制編碼:+myOp.hammingCode(targetBit)0); jLabel7.setText(字節(jié)海明編碼:+myOp.hammingCode(targetBit)1); catch(Exception e) public static void main(String args) java.awt.EventQueue.invokeLater(new Runnable() public void run() new NewJFrame().setVisible(true); ); private javax.swing.JButton jButton1; pr

40、ivate javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; privat

41、e javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swin

42、g.JTextField jTextField1; private javax.swing.JTextField jTextField2;3.2行程編碼設(shè)計(jì)由界面中的開(kāi)始解碼調(diào)用行程編碼的函數(shù),其代碼如下: public static byte zipCode(byte mycode) byte tempArray=new byte10000000;/構(gòu)建一個(gè)足夠大的臨時(shí)數(shù)組; int lengthArray=new int4;/臨時(shí)的存位數(shù)長(zhǎng)度的數(shù)組 lengthArray0=-127; int i=1; int n=0; int mycount=1; do if(mycodei=mycod

43、ei-1) mycount+; i+; else tempArrayn=mycodei-1; n+; if(mycount127) tempArrayn=(byte)lengthArray0; n+; if(lengthArray1=mycount/127)127) lengthArray2=lengthArray1/127; lengthArray1=127; tempArrayn=(byte)lengthArray1; n+; tempArrayn=(byte)lengthArray2; else tempArrayn=(byte)lengthArray1; n+; tempArrayn=

44、0; n+; lengthArray3=mycount%127; tempArrayn=(byte)lengthArray3; else tempArrayn=(byte)mycount; mycount=1; n+; i+; while(i127) tempArrayn=(byte)lengthArray0; n+; if(lengthArray1=mycount/127)127) lengthArray2=lengthArray1/127; lengthArray1=127; tempArrayn=(byte)lengthArray1; n+; tempArrayn=(byte)lengthArray2; else tempArrayn=

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論