QQ图片20211124170849.png
QQ图片20211124170849.png
QQ视频20211029154536.mp4

新时代背景下,如何做一名优秀的大学生干部(1).pptx

4 请查找下列字符的Unicode编码

  • 计算概论(B)2021
    4.jpg
    4.jpg
请查找下列字符的Unicode编码

<script>
var classObj=
    {
        //转Unicode
        toUnicode:function(str){
            var res=[];
            var res1=[];
            for(var i=0;i < str.length;i++)
                res[i]=("00"+str.charCodeAt(i).toString(16)).slice(-4);
            return "\\u"+res.join("\\u");
        },
        //Unicode转
        unUnicode:function(str){
            str=str.replace(/\\/g,"%");
            return unescape(str);
        },
    copyingTxt:function(str){
      document.getElementById(str).select();
      document.execCommand("Copy");
      }
    }
</script>

5 找一个MP3文件,查阅其采样频率、声道、码率、时长、容量等信息,计算它相对于原始音频编码容量的压缩率;

yyq.zip
压缩率:3.13 MiB/33.1 MiB=0.09

mp3

51.jpg
51.jpg

General
Complete name                  : C:\Users\FYGOD\Downloads\yyq.mp3
Format                         : MPEG Audio
File size                      : 3.13 MiB
Duration                       : 3 min 15 s
Overall bit rate mode          : Constant
Overall bit rate               : 128 kb/s
Album                          : 热门华语267
Track name                     : 燕园情
Performer                      : 北京大学校合唱团
Cover                          : Yes
Cover MIME                     : image/jpeg
Comment                        : online-audio-converter.com

Audio
Format                         : MPEG Audio
Format version                 : Version 1
Format profile                 : Layer 3
Format settings                : Joint stereo / MS Stereo
Duration                       : 3 min 15 s
Bit rate mode                  : Constant
Bit rate                       : 128 kb/s
Channel(s)                     : 2 channels
Sampling rate                  : 44.1 kHz
Frame rate                     : 38.281 FPS (1152 SPF)
Compression mode               : Lossy
Stream size                    : 2.99 MiB (95%)

wav

52.jpg
52.jpg

General
Complete name                  : C:\Users\FYGOD\Downloads\yyq.wav
Format                         : Wave
File size                      : 33.1 MiB
Duration                       : 3 min 15 s
Overall bit rate mode          : Constant
Overall bit rate               : 1 418 kb/s
Album                          : 热门华语267
Track name                     : 燕园情
Track name/Position            : 1
Track name/Total               : 1
Performer                      : 北京大学校合唱团
Director                       : 鍖椾含澶у鏍″悎鍞卞洟
Writing library                : Lavf56.4.101
Original source form/Name      : 鐑棬鍗庤267
Cover                          : Yes
Cover type                     : Cover (front)
Cover MIME                     : image/jpeg
Comment                        : 163 key(Don't modify):L64FU3W4YxX3ZFTmbZ+8/fd8oeDYkxwXMgq/LDa+L5s2YhlAnLf8djIS60YzjZcVitWzJpzyFR5JKrNwWQX9+BNe/22js3trF+s77CZu0xAKmJEpXvGek5hvDkdLoyfgcd5fU5pV4EjYTTVDBz7WpjzIvTR/cUN/EvkKdXyfmzNohUPyvJHPfhcaP4gPTvNGqaCkqPTWPqI23ov3knj1zgZ9G2QQDcTHMJYWFIB0riOAlNoy/LCDofoWLamLGqICjrYkwM7blIrgwlPAqP4BrTaJg0FNyJcv1sIPZucqAfGslyMNoFuOCBc/SZZMPnlQTx9F7lD9SPFSwX+jsxdl+GugvIqNZ0HAFOgJGJF3qCLiOsoriVN18iXh06/TAqs0tXCmxiNl3zXVe9evMsaaFBzXQYBdaY3a7p7AYwJgL9qigPeH6G801NP0bE5Ba1+qsaY5uHSrK6Hp1JI7a5slIMt3CYgmsaGXs0lsB0+/j7bQN/luNuQd6hmHuLrPN+IP
CMNT                           : 163 key(Don't modify):L64FU3W4YxX3ZFTmbZ+8/fd8oeDYkxwXMgq/LDa+L5s2YhlAnLf8djIS60YzjZcVitWzJpzyFR5JKrNwWQX9+BNe/22js3trF+s77CZu0xAKmJEpXvGek5hvDkdLoyfgcd5fU5pV4EjYTTVDBz7WpjzIvTR/cUN/EvkKdXyfmzNohUPyvJHPfhcaP4gPTvNGqaCkqPTWPqI23ov3knj1zgZ9G2QQDcTHMJYWFIB0riOAlNoy/LCDofoWLamLGqICjrYkwM7blIrgwlPAqP4BrTaJg0FNyJcv1sIPZucqAfGslyMNoFuOCBc/SZZMPnlQTx9F7lD9SPFSwX+jsxdl+GugvIqNZ0HAFOgJGJF3qCLiOsoriVN18iXh06/TAqs0tXCmxiNl3zXVe9evMsaaFBzXQYBdaY3a7p7AYwJgL9qigPeH6G801NP0bE5Ba1+qsaY5uHSrK6Hp1JI7a5slIMt3CYgmsaGXs0lsB0+/j7bQN/luNuQd6hmHuLrPN+IP
COMM                           : 163 key(Don't modify):L64FU3W4YxX3ZFTmbZ+8/fd8oeDYkxwXMgq/LDa+L5s2YhlAnLf8djIS60YzjZcVitWzJpzyFR5JKrNwWQX9+BNe/22js3trF+s77CZu0xAKmJEpXvGek5hvDkdLoyfgcd5fU5pV4EjYTTVDBz7WpjzIvTR/cUN/EvkKdXyfmzNohUPyvJHPfhcaP4gPTvNGqaCkqPTWPqI23ov3knj1zgZ9G2QQDcTHMJYWFIB0riOAlNoy/LCDofoWLamLGqICjrYkwM7blIrgwlPAqP4BrTaJg0FNyJcv1sIPZucqAfGslyMNoFuOCBc/SZZMPnlQTx9F7lD9SPFSwX+jsxdl+GugvIqNZ0HAFOgJGJF3qCLiOsoriVN18iXh06/TAqs0tXCmxiNl3zXVe9evMsaaFBzXQYBdaY3a7p7AYwJgL9qigPeH6G801NP0bE5Ba1+qsaY5uHSrK6Hp1JI7a5slIMt3CYgmsaGXs0lsB0+/j7bQN/luNuQd6hmHuLrPN+IP
TITL                           : 鐕曞洯鎯?
TRCK                           : 1

Audio
Format                         : PCM
Format settings                : Little / Signed
Codec ID                       : 1
Duration                       : 3 min 15 s
Bit rate mode                  : Constant
Bit rate                       : 1 411.2 kb/s
Channel(s)                     : 2 channels
Sampling rate                  : 44.1 kHz
Bit depth                      : 16 bits
Stream size                    : 32.9 MiB (100%)

6 找一个MIDI文件,查阅其时长、容量等信息,并播放收听,写出你对收听效果的评价;

遇见(钢琴版).zip
使用PotPlayer预览

61.jpg
61.jpg

General
Complete name                  : C:\Users\FYGOD\Downloads\遇见(钢琴版).mid
Format                         : MIDI
Format/Info                    : RIFF Musical Instrument Digital Interface
File size                      : 7.00 KiB

Audio
Format                         : MIDI
Format/Info                    : RIFF Musical Instrument Digital Interface

或者对midi文件进行解析,获取midi结构,数据,时长等信息。并进行了初步封装,制作成java application程序,
下载midi.zip

C:/Users/FYGOD/Downloads/遇见(钢琴版).mid大小为7172kb
0
0
-------------MThd-----------------
头块类型:MThd
头块长度:6
格式:1
音轨数:2
分区:1024
-------------MTrk-----------------
音轨块0:MTrk
音轨数据长度:119
0
-1
88
4
1
2
24
8
0
-1
89
2
-4
0
0
-1
81
3
10
44
42
0
-80
7
-1
0
-79
7
-1
0
-78
7
-1
0
-77
7
-1
0
-76
7
-1
0
-75
7
-1
0
-74
7
-1
0
-73
7
-1
0
-72
7
-1
0
-71
7
-1
0
-70
7
-1
0
-69
7
-1
0
-68
7
-1
0
-67
7
-1
0
-66
7
-1
0
-65
7
-1
-120
0
-1
88
4
4
2
24
8
-111
-64
0
-1
88
4
2
2
24
8
-112
0
-1
88
4
4
2
24
8
-127
-128
1
-1
47
0

或者使用python mido库

import mido
mid=mido.MidiFile("C:/Users/FYGOD/Downloads/遇见(钢琴版).mid",debug=True)
tempo = mido.bpm2tempo(131)
for i, track in enumerate(mid.tracks):
    print('Track {}: {}'.format(i, track.name))
    passed_time = 0
    for msg in track:
        ab_time = mido.tick2second(msg.time, mid.ticks_per_beat, tempo)
        # real_time就是每一个事件在整个midi文件中的真实时间位置
        real_time = ab_time + passed_time
        passed_time += ab_time
        if msg.type == "note_on":
             print(msg, " read time=" + str(round(real_time, 3)))
Header:
  000008: 4d  M
  000008: 54  T
  000008: 68  h
  000008: 64  d
  000008: 00  .
  000008: 00  .
  000008: 00  .
  000008: 06  .
  00000e: 00  .
  00000e: 01  .
  00000e: 00  .
  00000e: 02  .
  00000e: 04  .
  00000e: 00  .
-> type=1, tracks=2, ticks_per_beat=1024

Track 0:
  000016: 4d  M
  000016: 54  T
  000016: 72  r
  000016: 6b  k
  000016: 00  .
  000016: 00  .
  000016: 00  .
  000016: 77  w
-> size=119

Message:
  000017: 00  .
-> delta=0
  000018: ff  .
  000019: 58  X
  00001a: 04  .
  00001b: 01  .
  00001c: 02  .
  00001d: 18  .
  00001e: 08  .
-> MetaMessage('time_signature', numerator=1, denominator=4, clocks_per_click=24, notated_32nd_notes_per_beat=8, time=0)

Message:
  00001f: 00  .
-> delta=0
  000020: ff  .
  000021: 59  Y
  000022: 02  .
  000023: fc  .
  000024: 00  .
-> MetaMessage('key_signature', key='Ab', time=0)

Message:
  000025: 00  .
-> delta=0
  000026: ff  .
  000027: 51  Q
  000028: 03  .
  000029: 0a  .
  00002a: 2c  ,
  00002b: 2a  *
-> MetaMessage('set_tempo', tempo=666666, time=0)

Message:
  00002c: 00  .
-> delta=0
  00002d: b0  .
  00002e: 07  .
  00002f: ff  .

音效嘈杂,midi文件用音符的数字控制信号记录音乐,一首完整的音乐只要几十kb大,而能包含十条音乐轨道,midi文件就像未经修饰的初加工品,需要加上音色库来制作合成。

7 找单色、灰度、彩色照片文件各一个,查阅其文件格式、分辨率、颜色系统、容量等信息,计算它相对于原始数字图像编码容量的压缩率,并找到其中5个像素的颜色编码值;

三种格式图片.zip

import os
from PIL import Image

dir="C:/Users/FYGOD/Downloads/三种格式图片/"
filename=os.listdir(dir)
count=0
for img in filename:
    print("--------------------------------")
    image =Image.open(dir+img)
    imageSize=image.size
    imgaeWidth=image.width
    imageHeight=image.height
    imageFormat=image.format
    imageMode=image.mode
    imagePixel=image.getpixel((0,0))
    print(dir+img)
    print("分辨率:",imageSize," 长:",imgaeWidth," 宽:",imageHeight," 格式:",imageFormat," 颜色系统:",imageMode," 像素:",imagePixel)
    #以包含像素值的sequence对象形式返回图像的内容,Sequence对象的每一个元素对应一个像素点的R、G和B三个值。
    l=image.getdata()
    print("其中5个像素的颜色编码值(0,1,2,3,19999):")
    print(l[0])
    print(l[1])
    print(l[2])
    print(l[3])
    print(l[19999])
    count=count+1
    #文件压缩率
    if count==1:
        lsize = imgaeWidth * imageHeight / 2
        lxsize=lsize/float(1024*1024)
        print("编码大小:%.2f MB"%lxsize)
    elif count==2:
        lsize = imgaeWidth * imageHeight
        lxsize = lsize / float(1024 * 1024)
        print("编码大小:%.2f MB" %lxsize)
    else:
        lsize = imgaeWidth * imageHeight / 8
        lxsize = lsize / float(1024 * 1024)
        print("编码大小:%.2f MB" %lxsize)
    fsize=os.path.getsize(dir+img)/float(1024*1024)
    filesize=round(fsize,2)
    print("实际大小:%.2f MB"%filesize)
    print("压缩率:",filesize/lxsize)
print("--------------------------------")
  • 结果
PyDev console: starting.
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
runfile('F:/Users/FYGOD/PycharmProjects/pythonProject1/lenna.py', wdir='F:/Users/FYGOD/PycharmProjects/pythonProject1')
--------------------------------
C:/Users/FYGOD/Downloads/三种格式图片/lena_gray.png
分辨率: (512, 512)  长: 512  宽: 512  格式: PNG  颜色系统: L  像素: 162
其中5个像素的颜色编码值(0,1,2,3,19999):
162
162
161
160
165
编码大小:0.50 MB
实际大小:0.14 MB
压缩率: 0.28
--------------------------------
C:/Users/FYGOD/Downloads/三种格式图片/Lenna.png
分辨率: (512, 512)  长: 512  宽: 512  格式: PNG  颜色系统: RGB  像素: (226, 137, 125)
其中5个像素的颜色编码值(0,1,2,3,19999):
(226, 137, 125)
(226, 137, 125)
(223, 137, 133)
(223, 136, 128)
(234, 139, 105)
编码大小:0.75 MB
实际大小:0.45 MB
压缩率: 0.6
--------------------------------

8 找一个MP4视频文件,查阅其文件格式、分辨率、码率、时长、容量等信息,计算它相对于原始视频编码容量的压缩率。

Ielts.mp4

81.jpg
81.jpg

82.jpg
82.jpg

原始编码容量:640*360*3*142*24/(2^30)=2,355,609,600/1,073,741,824=2.19G=2,242.56MB
实际大小9.54 MB
压缩率:0.0042

General
Complete name                  : C:\Users\FYGOD\Downloads\Ielts.mp4
Format                         : MPEG-4
Format profile                 : Base Media
Codec ID                       : isom (isom/iso2/avc1/mp41)
File size                      : 9.54 MiB
Duration                       : 2 min 22 s
Overall bit rate               : 563 kb/s
Description                    : Tencent APD MTS
Writing application            : Lavf56.40.101

Video
ID                             : 1
Format                         : AVC
Format/Info                    : Advanced Video Codec
Format profile                 : High@L3
Format settings                : CABAC / 4 Ref Frames
Format settings, CABAC         : Yes
Format settings, Reference fra : 4 frames
Codec ID                       : avc1
Codec ID/Info                  : Advanced Video Coding
Duration                       : 2 min 22 s
Bit rate                       : 512 kb/s
Width                          : 640 pixels
Height                         : 360 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Constant
Frame rate                     : 24.000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Scan type                      : Progressive
Bits/(Pixel*Frame)             : 0.093
Stream size                    : 8.62 MiB (90%)
Writing library                : x264 core 148
Encoding settings              : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=512 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Codec configuration box        : avcC

Audio
ID                             : 2
Format                         : AAC LC
Format/Info                    : Advanced Audio Codec Low Complexity
Codec ID                       : mp4a-40-2
Duration                       : 2 min 22 s
Duration_LastFrame             : -12 ms
Bit rate mode                  : Constant
Bit rate                       : 48.0 kb/s
Channel(s)                     : 2 channels
Channel layout                 : L R
Sampling rate                  : 44.1 kHz
Frame rate                     : 43.066 FPS (1024 SPF)
Compression mode               : Lossy
Stream size                    : 834 KiB (9%)
Language                       : English
Default                        : Yes
Alternate group                : 1

9 回文判定图灵机

  • 请参考:https://turingmachine.io/ 中的palindrome图灵机
  • 写出能判定包含a、b、c三种字符的串是否回文串的图灵机
  • 图灵机规则的格式按照课件的表格来写
  • 写出判断abcab的过程和结果(每一步的纸带布局、状态)
  • 写出判断abcba的过程和结果(每一步的纸带布局、状态)

10 请介绍精简指令集RISC和复杂指令集CISC的定义、优势和不足;列出至少3种常见的指令集、对应类型和CPU产品(每个指令集至少3种CPU)。

RISCCISC
定义精简指令集复杂指令集
优势精简,一般小于100条,易于设计;
一般在一个周期内完成,执行效率高
不限制可访存指令,指令丰富,功能强大;
寻址方式灵活;
以微程序控制器为核心指令存储器和数据存储器共享物理存储空间,性能强大
不足只有load/store指令,功能不及CISC;
寻址方式不够灵活
一般大于200条,结构复杂,不利于超大规模集成电路实现;
各种指令执行时间相差较大,指令使用率不均衡;
不利于采用先进结构提高性能
指令集对应类型CPU产品
X86CISC,有向精简指令集的趋势Intel 8086、80186、80286、80386、80486
X64(x86-64)源自X86,也是CISCintel的Core 2 Duo、Centrino Core 2 Duo、Xeon 和AMD Athlon64/x2、 Sempron64/x2、Duron64
ARMRISCCortex-A73、Cortex-A55、Cortex-A75
MIPSRISCR8000、R10000、R12000