Presentation is loading. Please wait.

Presentation is loading. Please wait.

این دو عالم علم دارد در نهاد منتخب وان جهانی رمز دارد در حروف مختصر سنایی غزنوی.

Similar presentations

Presentation on theme: "این دو عالم علم دارد در نهاد منتخب وان جهانی رمز دارد در حروف مختصر سنایی غزنوی."— Presentation transcript:

1 این دو عالم علم دارد در نهاد منتخب وان جهانی رمز دارد در حروف مختصر سنایی غزنوی

2 Image/Video Compression & VOD برنا فيروزي نويد زرين درفش محمود قديمي مهندسي فناوري اطلاعات بهار 88

3 Image Compression 3

4 Compression فشرده سازی (Compression)، پردازشی است که با حذف اطلاعات اضافی، داده ها را به علایم دیجیتالی کاهش می دهد. این پردازش بسته به پهنای باند مورد نیاز برای انتقال داده ها و میزان فضای ذخیره سازی، داده ها را کاهش می دهد. کاهش پهنای باند مورد نیاز امکان انتقال داده های بیشتری را در یک زمان واحد می دهد. كاهش افزونگی (redundancy) 4

5 ديجيتال ،آنالوگ پردازش تصاوير در فضاي ديجيتال انجام مي شود اگر ما يك منبع تصويري آنالوگ داشته باشيم بايد قبل از انجام هر عمل فشرده سازي ابتدا به آن را به ديجيتال تبديل كنيم 5 5

6 Purpose of Image Compression Saving storage space Saving transfer time Easy processing Easy to transmitted over network reduce cost 6

7 هدف  در حالت ايده آل ما خواستار  حداكثر كيفيت تصوير  حداقل فضاي ذخيره سازي و پردازش منابع  ما نمي توانيم هر دو هدف را در بهترين شرايط داشته باشيم  بهترين فشرده سازي چگونه است؟ 7

8 Why we want to compress? To transmit an RGB 512X512, 24 bit image via modem 28.2 kbaud(kilobits/second) 8

9 Image Compression lossless compression Huffman Coding Run-length encoding lossy compression Predictive Coding Transform Coding Image Compression Coding 9

10 دو كلاس اصلي فشرده سازي تصاوير Lossless (بدون اتلاف( از روي ديتاهاي تصوير ذخيره شده مي توان دقيقا به تصوير اصلي رسيد تصویر ذخیره شده بدون از دست دادن كمترين داده ای، خود تصویر است. Compression rate: 2:1 (at most 3:1) )Lossyپراتلاف( از روي ديتاهاي تصوير ذخيره شده مي توان به تصويري نزديك به تصوير اصلي رسيد تصویر ذخیره شده خود تصویر اصلی نیست، بلکه شبیه آن است و اطلاعاتی را از دست داده است Compression rate: high compression 10

11 General compression system model 11

12 12 Compression System Model Compression Input Preprocessing Encoding Compressed File Compressed File Output Postprocessing Decoding Compressed File Compressed File Decompression 12

13 Compression Ratio Ex Ex Image 256X256 pixels, 256 level grayscale can be compressed file size 6554 byte. Original Image Size = 256X256(pixels) X 1(byte/pixel) = bytes 13

14 Bits per Pixel Ex Ex Image 256X256 pixels, 256 level grayscale can be compressed file size 6554 byte. Original Image Size = 256X256(pixels) X 1(byte/pixel) = bytes Compressed file = 6554(bytes)X8(bits/pixel) = bits (2) 14

15 Key of compression DataInformation Reducing Data but Retaining Information Various amounts of data can be used to represent the same amount of information. It’s “Data redundancy” Relative data redundancy 15

16 Entropy Average information in an image. Average number of bits per pixel 16

17 Compression Standard Standard: ImageVideo ISO JPEG JPEG2000 MPEG1,MPEG2, MPEG4, MPEG7 ITU N/AH.261, H.263, H.263+, H.26L 17

18 Image Compression lossless compression Huffman Coding Run-length encoding lossy compression Predictive Coding Transform Coding Image Compression Coding 18

19 Loseless Compression No data are lost Can recreated exactly original image Often the achievable compression is mush less 19

20 Huffman Coding ( VLC,Entropy)  Using Histogram probability  5 Steps 1. Find the histogram probabilities 2. Order the input probabilities(small  large) 3. Addition the 2 smallest 4. Repeat step 2&3, until 2 probability are left 5. Backward along the tree assign 0 and 1 20

21 Huffman Coding(cont)  Step 1 Histogram Probability p 0 = 20/100 = 0.2 p 1 = 30/100 = 0.3 p 2 = 10/100 = 0.1 p 3 = 40/100 = 0.4 p 3  0.4 p 1  0.3 p 0  0.2 p 2  0.1  Step 2 Order 21

22 Huffman Coding(cont)  Step 3,4 Add 2 smallest Natural CodeProbabilityHuffman Code  Step 5 assign 0 and 1 22

23 Huffman Coding(cont) The original Image :average 2 bits/pixel The Huffman Code:average 23

24 Run-length encoding (RLE) is a very simple form of data compression in which runs of data (that is, sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run. This is most useful on data that contains many such runs: for example, relatively simple graphic images such as icons, line drawings, and animations. Run Length Encoding 24

25 Run-Length Coding Counting the number of adjacent pixels with the same gray-level value Used primarily for binary image Mostly use horizontal RLC 25

26 Run-Length Coding(cont) Binary Image 8X8 horizontal 1st Row8 2nd Row4,4 3rd Row1,2,5 4th Row1,5,2 5th Row1,3,2,1,1 6th Row2,1,2,2,1 7th Row4,1,1,2 8th Row8 26

27 Example of RLE Let us take a hypothetical single scan line, with B representing a black pixel and W representing white: WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWW WWWWWWWWWWWWWWWWWWWWBWWWWWWWWWW WWWW If we apply the run-length encoding (RLE) data compression algorithm to the above hypothetical scan line, we get the following:12W1B12W3B24W1B14W 27

28 Lossy Compression Allow a loss in the actual image data Can not recreated exactly original image Commonly the achievable compression is mush more Such as JPEG 28

29 DM (Delta Modulation) DPCM (Differential Pulse Code Modulation) Predictive Coding Common Predictive Coding 29

30 The system consists of an encoder and a decoder, each containing an identical predictor. As each successive pixel of the input image, is introduced to the encoder, the predictor generates the anticipated value of that pixel based on some number of past inputs. The output of the predictor is then rounded to the nearest integer. The principle of Predictive Coding 30

31 Predictive coding model I 31

32 The predictor : The symbol encoder : generate the next element of the compressed data stream Decoder : perform the inverse of encoding The linearity predictor : Predictive coding model II 32

33 Delta Modulation I Delta modulation (DM or Δ-modulation) is an analog-to- digital and digital-to-analog signal conversion technique used for transmission of voice information where quality is not of primary importance. DM is the simplest form of differential pulse-code modulation (DPCM) where the difference between successive samples is encoded into n-bit data streams. In delta modulation, the transmitted data is reduced to a 1- bit data stream. 33

34 Differential Pulse Code Modulation Differential Pulse Code Modulation (DPCM) compares two successive analog amplitude values, quantizes and encodes the difference, and transmits the differential value. 34

35 Transform Coding I (DCT) Transform coding is a type of data compression for "natural" data like audio signals or photographic images. The transformation is typically lossy, resulting in a lower quality copy of the original input. 35

36 Transform Coding II 36

37 Transform Coding III A transform coding system 37

38 BMP (Bitmap) - lossless Use 3 bytes per pixel, one each for R, G, and B Can represent up to 2 24 = 16.7 million colors No entropy coding File size in bytes = 3*length*height, which can be very large Can use fewer than 8 bits per color, but you need to store the color palette Performs well with ZIP, RAR, etc. 38

39 GIF (Graphics Interchange Format) Can use up to 256 colors from 24-bit RGB color space – If source image contains more than 256 colors, need to reprocess image to fewer colors Suitable for simpler images such as logos and textual graphics, not so much for photographs 39

40 JPEG (Joint Photographic Experts Group) - lossly Most dominant image format today Typical file size is about 10% of that of BMP (can vary depending on quality settings) Unlike GIF, JPEG is suitable for photographs, not so much for logos and textual graphics 40

41 The name "JPEG" stands for Joint Photographic Experts Group, the name of the committee that created the standard. The group was organized in 1986, issuing a standard in 1992, which was approved in 1994 as ISO JPEG is a commonly used method of compression for photographic images. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality. Joint Picture Expert Group 41

42 JPEG2000 JPEG 2000 is a wavelet-based image compression standard. It was created by the Joint Photographic Experts Group committee in the year 2000 with the intention of superseding their original discrete cosine transform-based JPEG standard (created about 1991). 42

43 JPEG Encoding Steps Preprocess image Apply 2D forward DCT Quantize DCT coefficients Apply RLE, then entropy encoding 43

44 JPEG Block Diagram FDCT Source Image Quantizer Entropy Encoder Table Compressed image data DCT-based encoding 8x8 blocks R B G 44

45 Image Compression- JPEG Using the DCT, the entries in Y will be organized based on the human visual system. The most important values to our eyes will be placed in the upper left corner of the matrix. The least important values will be mostly in the lower right corner of the matrix. Semi- Important Most Important Least Important 45

46 JPEG 8 x 8 PixelsImage 46

47 Image Compression Gray-Scale Example: Value Range 0 (black) (white)

48 Image Compression 2D-DCT of matrix

49 Image Compression As you can see, we save a little over half the original memory. 49

50 Reconstructing the Image New Matrix and Compressed Image

51 Can You Tell the Difference? Original Compressed 51

52 Image Compression Original Compressed 52

53 Example - One everyday photo with file size of 2.76 MB 53

54 Example - One everyday photo with file size of 600 KB 54

55 Example - One everyday photo with file size of 350 KB 55

56 Example - One everyday photo with file size of 240 KB 56

57 Example - One everyday photo with file size of 144 KB 57

58 Example - One everyday photo with file size of 88 KB 58

59 Analysis Near perfect image at 2.76M, so-so image at 88K Sharpness decreases as file size decreases Which file size is the best? – No correct answer to this question – Answer depends upon how strict we are about image quality, what purpose image is to be used for, and the resources available 59

60 Conclusion Image compression is important Image compression has come a long way Image compression is nearly mature, but there is always room for improvement 60

61 Video Compression

62 Video Data Size size of uncompressed video in gigabytes image size of video 1280x720 (1.77) 640x480 (1.33) 320x x120 62

63 Video Bit Rate Calculation width  pixels(160, 320, 640, 720, 1280, 1920, …) height  pixels(120, 240, 480, 485, 720, 1080, …) depth  bits(1, 4, 8, 15, 16, 24, …) fps  frames per second (5, 15, 20, 24, 30, …) compression factor(1, 6, 24, …) width * height * depth * fps compression factor = bits/sec 63

64 Effects of Compression storage for 1 hour of compressed video in megabytes 3 bytes/pixel, 30 frames/sec 64

65 Channel Bandwidths 65

66 Channel Bandwidth 66

67 Application Requirements 67

68 Source Video Formats 68

69 The Need for Video Compression High-Definition Television (HDTV) – 1920x1080 – 30 frames per second (full motion) – 8 bits for each three primary colors (RGB)  Total 1.5 Gb/sec! Cable TV: each cable channel is 6 MHz – Max data rate of 19.2 Mb/sec – Reduced to 18 Mb/sec w/audio + control …  Compression rate must be ~ 80:1! 69

70 Some figures – Uncompressed video -> big amount of data Color picture 800x320 pix, 24 bits/pix -> 6.3 Mbit/s SDTV 720x480, 30Hz, 16 bits/pix -> 166 Mbit/s HDTV 1920x1080, 30Hz, 16 bits/pix -> 1Gbit/s – Communication and storage capacities limits Cable or satellite bandwidth : 38 Mbit/s ADSL : 1 to 8 Mbit/s DVD capacity : 5 to 8 GB The Need for Video Compression 70

71 كاربرد Video compression is now everywhere : – TV broadcasting over cable, satellite or terrestrial networks, – CD-ROM, DVD, PC video storage, – Videophone and teleconferencing, – (VoD, IPTV), – Video over moInternet streaming biles. 71

72 H.264/SVC SMPTE/VC1 2000’s1990’s1980’s1970’s1960’s Standardization (1/2) Video codecs Transform Coding 65/80 MC Prediction 72/89 Entropy Coding 49/76 H.261 MPEG-1 H.262/MPEG62 MPEG4 ASP H.263 H.264/AVC DVCPRO 1950’s DPCM 52/80 Technologies Standards Videophone 56Kb/s – 2Mb/s CD-ROM 1-1.5Mb/s Digital TV, DVD 4 to 80 Mb/s Camcorder, VTR 25 to 50 Mb/s Videophone 30 Kb/s Video streaming & post-prod 30 Kb/s to 600Mb/s Convergence of all video applications, digital cinema 30 Kb/s to 600Mb/s Wavelet 85/-- 72

73 73 Bit rate evolution Mbit/s MPEG-2 1 st generation encoders 1 st generation encoders 2 nd generation encoders MPEG-4/H.264 AVC MPEG-4 ASP C. Ratio from 4:2:  Bit rate evolution for SDTV Broadcast 3 rd generation encoders (advanced Pre-processing) 2 nd generation encoders (Stat-Mux + Rate control improvements)

74 MPEG Compression Compression through – Spatial – Temporal 74

75 Video Redundancies Spatial Neighboring pixels in a frame are statistically related. Temporal Pixels in consecutive frames are statistically related. One can achieve higher compression ratios by exploiting both spatial and temporal redundancies 75

76 Spatial Redundancy Take advantage of similarity among most neighboring pixels 76

77 Spatial Redundancy Reduction RGB to YUV – less information required for YUV (humans less sensitive to chrominance) Macro Blocks – Take groups of pixels (16x16) Discrete Cosine Transformation (DCT) – Based on Fourier analysis where represent signal as sum of sine's and cosine’s – Concentrates on higher-frequency values – Represent pixels in blocks with fewer numbers Quantization – Reduce data required for co-efficients Entropy coding – Compress 77

78 Motion Compensation Macro Block Motion Vector 16 x

79 Video compression in MPEG-1&2 Spatial redundancy reduction (DCT example) 79

80 Spatial Redundancy Reduction Zig-Zag Scan, Run-length coding Quantization major reduction controls ‘quality’ “Intra-Frame Encoded” 80

81 Loss of Resolution Original (63 kb) Low (7kb) Very Low (4 kb) 81

82 Temporal Redundancy Take advantage of similarity between successive frames

83 Temporal Redundancy Reduction 83

84 Temporal Redundancy Reduction 84

85 Temporal Redundancy Reduction frames are independently encoded P frames are based on previous I, P frames – Can send motion vector plus changes B frames are based on previous and following I and P frames – In case something is uncovered

86 Group of Pictures (GOP) Starts with an I-frame Ends with frame right before next I-frame “Open” ends in B-frame, “Closed” in P-frame MPEG Encoding a parameter, but ‘typical’: – I B B P B B P B B I – I B B P B B P B B P B B I 86

87 Question When may temporal redundancy reduction be ineffective? 87

88 Answer When may temporal redundancy reduction be ineffective? – Many scene changes – High motion 88

89 Non-Temporal Redundancy Sometimes high motion 89

90 Typical Compress. Performance Type Size Compression I 18 KB 7:1 P 6 KB 20:1 B 2.5 KB 50:1 Avg 4.8 KB 27: Note, results are Variable Bit Rate, even if frame rate is constant 90

91 Inter and Intra coding To exploit spatial redundancies within a frame (Intra coding): 8x8 DCT, similar to JPEG To exploit temporal redundancies between frame (Inter coding): Motion Estimation 91

92 Frame Types Two frame types: Intra-frames (I-frames): I-frame provides an accessing point, it uses basically JPEG. Inter-frames (P-frames): P-frames use from previous frame ("predicted"), so frames depend on eachother. 92

93 93 Some video formats The 4:2:2 format – Y 13.5 MHz – C 6.75 MHz – 8 bits per pixel – 720 active points per line – 576 lines active lines per image (2 fields) (625 lines) and 480 active lines (525 lines) – Pixels are not square (e.g. for 480 lines, only 640 active points are needed - VGA format) – Image size 720*576 or 720*480 The 4:2:0 format – Vertical chrominance resolution reduced by a factor 2 (average on two successive lines)

94 December, 20, 2006 AV Compression / Alain Bouffioux 94 Some video formats SIF format (Source Intermediate Format) Half the vertical & horizontal resolution of 4:2:0 For 50Hz countries: – Luminance: 360*288 – Chrominance: 180*120 CIF format (Common Intermediate Format) – Intermediate format used in videoconferencing (communication between US & Europe) – resolution: 360*288 – Sampling frequency: 30 Hz QCIF (Quarter CIF) – Half the vertical & horizontal resolution of CIF.

95 MPEG was an early standard for lossy compression of video and audio. Development of the MPEG standard began in May MPEG 95

96 96 MPEG Coding Performance Decoding is easy – MPEG1 decoding in software on most platforms – Hardware decoders are widely available ($150/board) – Windows graphics accelerators with MPEG decoding now entering market (e.g., Matrox, Diamond, …) Encoding is expensive – Sequential software encoders are 20:1 real-time – Real-time encoders use parallel processing – Real-time hardware encoders are expensive (e.g., $12K-$50K for MPEG1 and $100K-$500K for MPEG2) – Hardware-assisted off-line MPEG1 encoders (3:1) used for multimedia authoring at reasonable cost ($5k)

97 MPEG MPEG1: low bitrate MPEG2: VCD, DVD MP3: MPEG2 profile 3, for music MPEG4: Network streaming MPEG7: Searching and indexing

98 98 MPEG Standards MPEG-1 ~ 1-1.5Mbps (early 90s) - vhs quality (1992) – Frame encoding – For compression of 320x240 full-motion video at rates around 1.15Mb/s – Applications: video storage (VCD) – CIF images, 4:2:0 sampling, 1.5 Mbs

99 99 MPEG Standards MPEG-2 ~ 2-80Mbps (mid 90s) - broadcast quality (1994) – Frame and field encoding – For higher resolutions – Support interlaced video formats and a number of features for HDTV – Address scalable video coding – Also used in DVD – CCIR 601 images, 4:2:2 sampling, 15 Mbs – Interlaced and progressive scanning

100 MPEG Today MPEG4 ~ 9-40kbps (later 90s) – Around Objects, not Frames – For very low bit rate video and audio coding – Applications: interactive multimedia and video telephony – Lower bandwidth MPEG-7 – Provide a fast and efficient searching, filtering – New standard – Internet orientated – VOP (Video Object Plane) – Profiles and levels 100

101 H.26x H.261: first generation H.262 (MPEG2) H.263: video conference H.263++: enhancement H.26L: latest

102 VOD Watch what you want when you want

103 Standardization (2/2) DVB Transport DVB-S DVB-C DVB-S2 DVB-T DVB-H DVB-IPI in progress Satellite TV Cable Mobile TV Terrestrial TV IPTV 103

104 Video on Demand One video server Many video data Many clients Client want to watch at any time Clients can send request to the server and request to watch a particular video. The server have to response by streaming the requested video to the client. We want to be able to support large number of clients, and clients should be able to watch at anytime. 104

105 Streaming – Streaming media: the ‘real-time’ playing of a video-, audio- and/or datastream on a machine from the moment the first bytes come in. – VoD such as YouTube, MSN Video, Google Video, Yahoo Video, CNN… – 2006 April to December: MSN Video service Client-server mode Covering over 520 million streaming requests for more than 59,000 videos. 105

106 Streaming: live vs on-demand archiverealtime unicast multicast VoD Event- driven scheduled

107 Live audio and/or video streaming is a completely different sport from on-demand streaming. VoD (Video on demand) is unicast streaming from an archive. Scheduled (a tv like netcast) is usually multicast streaming from an archive Live (realtime) streaming can be done both in unicast and multicast. Streaming: live vs on-demand 107

108 Motivation VoD such as YouTube, MSN Video, Google Video, Yahoo Video, CNN… As the trend of increasing demands on such services and higher-quality videos, it becomes a costly service to provide. 108

109 109 Video-on-Demand Distribution Model A client can tune in to receive any ongoing media delivery using its Set Top Box True broadcast: Satellite and cable TV networks 109

110  VoD servers support rewind function Set-top box TV customer premise VoD servers Rewind TV IP backbone Unicast 110

111 111 Broadcast feed Media database IP Streamer Content Management Server EPG metadata Encoder Encryption Server VOD Server Application Servers Cable Modem Termination System Optical Line Terminatio n DSLAM ADSL Modem/Router Optical Network Termination Cable Modem/Router Core & Aggregation Networks STB DSL (Copper) Optical Fiber HFC (Coax) Content ProviderService Provider Network Provider CPE Remote Management Server Subscriber Management and Billing Server Licence Server RT Encoder IPTV/VOD : Full Operator model 111

112 What is IPTV? The fundamentals – IPTV = Internet Protocol Television Digital TV service delivered over a broadband network using the Internet Protoc0l IPTV usually refers to TV services over a Network Operator’s quality controlled network. Internet TV = IPTV over the public Internet 112

113  One of the first  One of the largest  150 TV channels  250,000 subscribers IPTV Network 113

114 Basic IPTV Structure 114

115 Set Top Box – Home gateway (BST) 115

116 116 IPTV Set-Top Box Broadcast TV DVRMovies On Demand On Demand 116

117 Other Services VOD – Video on Demand – Watch what you want when you want DVR – Record Live TV from your set top box HD – High Definition TV. The evolution of Television On line Gaming 117

118 Search >><< Logout | Help Selected Video Go My Content Annotate Title: The Hidden Child Description: Of the 1,600,000 Jewish children who lived in Europe before World War II, only 100,000 survived the Holocaust. Title: Ralph Golzio interview on Paterson Silk Strike of 1913 Description: Ralph Golzio was a teenager at the time of the Paterson Silk Strike of Title: Sondra Gash interview Description: Evelyn Hershey of the American Labor Museum interviews Search For and Select a Video for Annotation 118

119 - >><< Logout | Help Search Title: The Hidden Child Description: Of the 1,600,000 Jewish children who lived in Europe before World War II, only 100,000 survived the Holocaust. Title: Ralph Golzio interview on Paterson Silk Strike of 1913 Description: Ralph Golzio was a teenager at the time of the Paterson Silk Strike of Title: Sondra Gash interview Description: Evelyn Hershey of the American Labor Museum interviews My Content Annotate Go Drag and Drop Thumbnails Here To Create an Annotation Selection of video found through search 119

120 - >><< Logout | Help Search Annotate Start Time: 5:01 End Time: 8:34 Title: Amsterdam, The Netherlands Note: City street in Amsterdam. Indexed/Searchable: PrivateNJVid Wide My Content My Institution Only Save Amsterdam, The Netherlands Annotate and Capture Start/End Times Start and stop markers can be placed. Metadata placed here. Once an annotation is saved it will appear in the videos timeline. 120


Download ppt "این دو عالم علم دارد در نهاد منتخب وان جهانی رمز دارد در حروف مختصر سنایی غزنوی."

Similar presentations

Ads by Google