Compression ha C Oxford Engineering College S2
-
Upload
dinesh-peter -
Category
Documents
-
view
215 -
download
0
Transcript of Compression ha C Oxford Engineering College S2
-
8/3/2019 Compression ha C Oxford Engineering College S2
1/13
Session 2Session Name: CompressionAuthor Nam e: C. Jaya pritha
Dep artment: Informa tion Tec hnolog y
Subjec t/ Course: Graphics and Multimed ia
Compression Techniques
-
8/3/2019 Compression ha C Oxford Engineering College S2
2/13
Page 2 Ver: 1.0 CompressionC.Jayapritha, Oxford Engineering College
Session Objec tives
At the end of this session, the learner will be ab le to :
Define the term com pression.
List the needs of compression and its types.
Expla in the c om pression standards.
Disc uss the d ifferent typ es of com pression techniques.
Tea c hing Learning Ma terial
Boa rd a nd C halk
Slide Presentation
-
8/3/2019 Compression ha C Oxford Engineering College S2
3/13
Compression Page 3
C.Jayapritha,Oxford Engineering College
Session Plan
Time(in min)
Content MethodologyFaculty
ApproachTypical Student
Activity
Learning
Outcomes(Blooms +
Gardeners)
05Introduction toCompression
Brainstorming Facilitates Participates
Remembering
LinguisticIntrapersonal
Interpersonal Skills
10Need for
Compression and itsTypes
Chalk and Talk Explains Listens
RememberingUnderstanding
InterpersonalIntrapersonal Skills
15CompressionStandards
Innovative Quiz Facilitates Participates
Applying
LogicalVerbal
InterpersonalIntrapersonal Skills
15CompressionTechniques
Demonstration DemonstratesListens
UnderstandingApplying
LogicalInterpersonalIntrapersonal
Visual
10 ConclusionChoose and
DefendFacilitates
GuidesParticipates
Remembering
LinguisticInterpersonalIntrapersonal
LogicalVerbal
-
8/3/2019 Compression ha C Oxford Engineering College S2
4/13
Page 4 Ver: 1.0 CompressionC.Jayapritha, Oxford Engineering College
Session Inputs
Introduc tion to Compression
We can start this session by introducing the concept of
compression to the learners with the help of a Brainstorming
activity.
Suggested Activity: Brainstorming
The lea rners ma y not know anything abo ut c om pression te chniques but
they might know the meaning for the w ord com pression .
Additionally, some of them may have some extra knowledge on the
subject. Here, we can use the brainstorming method to extract the
responses from the learners. Reponses from the learners can be listed on
the boa rd. Then, we can ref ine the responses and the irre levant responses
can be d ismissed with a reason.
Partic ipant 1: Red uc ing the a mount
Partic ipant 2: Dec reasing the size
Partic ipant 3: Compa c tionPartic ipant 4: If we a re sta rting our motor cyc le, the ac tion of c om pression,
the red uc tion in vo lume a nd inc rea se of p ressure of the a ir or com bustib le
mixture in the cylinder prior to ignition, produced by the motion of the
p iston tow ards the c ylinder head a fter intake.
Partic ipant 5: The cod ing o f da ta to save storag e space or transmission
time.
Participant 6: A pump or other machine for reducing volume and
inc reasing pressure o f g ases.
Partic ipant 7: Run leng th enc od ingParticipant 8: A transducer that produces an output with a range of
voltages.
Participant 9: Algo rithm s
Participant 10: Prog rams
-
8/3/2019 Compression ha C Oxford Engineering College S2
5/13
Compression Page 5
C.Jayapritha,Oxford Engineering College
Data compression or source coding is the process of encoding
information using fewer bits through the use of specific encoding
schem es which a re de cod ed in the rec eiver side.
Need for Compression a nd its Types
Having d isc ussed the c onc ep t of c om pression, we c an now
expla in the types of c om pression a nd the need for it to the
learners.
Need for Compression
1. Co mpression is the reduc tion in size of da ta in order to savespace or transmission time.
2. It helps reduce the consumption of expensive resources,such as hard disk space or transmission bandwidth, i.e., to
red uce the a mount of data storag e.
3. It c an a lso red uce the cost for transmission.4. Compression is used to manage large amount of
multimed ia da ta effic iently.
5. Compression is used to rem ove the red unda nc ies.Typ es of Compression
There are two types of com pression. They are:
1. Lossless compression2. Lossy compression
Lossless compression:
In this type, compression can be done without any loss of data.
This is mostly app lied for te xt d oc uments.
Lossy com pression:
In this type, while performing compression some of the data will
be lost.
Lossy image compression is used in digital cameras, to increase
storage cap ac ities w ith m inima l deg rad ation of p ic ture qua lity.
Sim ilarly, DVDs use the lossy MPEG-2 Video codec for video
-
8/3/2019 Compression ha C Oxford Engineering College S2
6/13
Page 6 Ver: 1.0 CompressionC.Jayapritha, Oxford Engineering College
compression. Generally speaking, this compression technique isused for ima ges and videos.
Compression Standards
With the help o f the a bove d iscussion, we have ensured the
lea rners have und erstoo d the types of c ompression. Now, we c an
exp lain the com pression stand ards in a simp le way using the
innova tive quiz ac tivity.
Suggested Activity: Innovative Quiz
We can divide the learners into 4 groups. We can invite 2 volunteers to
conduct this quiz, one for asking questions and the other for marking
scores. The questions should b e p rep ared in suc h a way tha t it makes thelea rner think ab out the catego ry of the pa rticular forma t, or the type o f
com pression, e tc . By this method , lea rners will ac tively p artic ipa te and w ill
answer enthusiastically. Additionally, they will learn about different formats
ava ilab le. Fina lly, we c an c larify the ir doubts, if any.
Que stion 1: CCITT is app lied for wha t type o f doc uments?
Group 1: CCITT is app lied for text doc ume nts.
Que stion 2: Wha t typ e of c om pression is it?
Group 2: It is a typ e of lossless c ompression.
Question 3: Where is it actually used?
Group 4: It is mostly used in sending Fax documents.
Question 4: Ca n it be used for ima ge s? If yes, wha t typ e of ima ges?
Group 1: Yes, CC ITT can be used for b ina ry images.
Question 5: JPEG means?
Group 2: pass
Group 3: Joint Photographic Experts Group .
Que stion 6: What type o f doc ume nts it is used for?
Group 4: Pass
Group 1: It is used particularly for co lor ima ges.
-
8/3/2019 Compression ha C Oxford Engineering College S2
7/13
Compression Page 7
C.Jayapritha,Oxford Engineering College
Que stion 7: Wha t typ e of c om pression is it?
Group 2: It is a typ e of lossy c ompression.
The important te rms d iscussed in the session are a s fo llows:
1. CCITT- Consultative C om mittee for Inte rnationa l Telephonyand Teleg raphy
For binary imageslossless compression that too in
text d ocuments
2. JPEG-Joint Photograp hic Expe rts GroupFor color ima ges-lossy c ompression
3. MPEG-Motion Pic tures Expe rt g roupFor videos-lossy c ompression
4. Gp3 Vide os-lossy compression
Com pression Tec hniques
After explaining about the c om pression standards, it w ould nowbe approp ria te to e xpla in the c om pression tec hniques with the
help of e xec ution o f a simp le program.
Sugg ested Ac tivity: Dem onstration
We can e xec ute a simp le prog ram for text com pression. The p rog ram c an
be executed in such a way that the repeated elements in the text are
rem oved and it is g iven a symb ol to rep resent the rep ea ted eleme nts. This
can b e app lied to the repea ted wo rd a lso. The wo rd w hich oc cur mo re
number of times can be given a symbol which will reduce the space
oc cup ied . This me thod c an be fo llowed for ima ge c om pression a lso.
-
8/3/2019 Compression ha C Oxford Engineering College S2
8/13
Page 8 Ver: 1.0 CompressionC.Jayapritha, Oxford Engineering College
Program:
#include
#include
#include
#include
#include
void main()
{
FILE *f1,*f2;
int i=0,j=0,a=0,b=0,k,count=1;
char s[30],s2[30],s1[30],c[30];
clrscr();
printf("\n Enter the message");
scanf("%s",&s);
f1=fopen("Z:\INPUT.TXT","w");
while(s[i]!='\0')
{if(s[i]!=s[i+1])
{
if(count>=2)
{
s1[j+1]=s[i];
itoa(count,c,10);
s1[j++]='#';
s1[j++]=c[0];
if(count>9)
s1[j++]=c[i];
}
else
for(k=0;k
-
8/3/2019 Compression ha C Oxford Engineering College S2
9/13
Compression Page 9
C.Jayapritha,Oxford Engineering College
c[1]='\0';
count=atoi(c);
for(k=0;k
-
8/3/2019 Compression ha C Oxford Engineering College S2
10/13
Page 10 Ver: 1.0 CompressionC.Jayapritha, Oxford Engineering College
Group 1: No loss of data
Group 2: Even though there is loss, it will not affect the content in thedocument.
Group 1: But it c an a ffec t the qua lity of the p ic ture.
Group 2: As the images and videos occupy lot of memory space unlike
text, we ma y have to c om promise.
Group 1: Simple
To summarize , while performing lossy compression some o f the
data will be lost. Lossy image compression is used in digitalcameras, to increase storage capacities with minimal
degradation of picture quality. Similarly, DVDs use the lossy MPEG-
2 Video cod ec for video c om pression. Generally, this com pressiontec hnique is used for ima ges and videos.
Lossless compression can be executed without any loss of data.
This is mostly app lied for text doc uments.
-
8/3/2019 Compression ha C Oxford Engineering College S2
11/13
Compression Page 11
C.Jayapritha,Oxford Engineering College
Summary
In this session, we lea rnt to :
Define the term com pression.
List the needs of compression and its types.
Expla in the c om pression standards.
Disc uss the d ifferent typ es of com pression techniques.
-
8/3/2019 Compression ha C Oxford Engineering College S2
12/13
Page 12 Ver: 1.0 CompressionC.Jayapritha, Oxford Engineering College
Assignment
1. Take a text doc ument, define your ow n co mp ression fo rma t and try toapp ly that to the d oc ument. Then, convert your defined stand ard into
C code which should perform compression for any given text
document.
2. Take a b lack and white ima ge , tec hnic a lly a b inary ima ge and p utc hec ked lines in tha t ima ge . Now ma rk 1 for tha t particular check box
if it is in black color and 0 if it is white. Do it for the entire image. Nowwrite a C program which will accept your binary codes and should
rep roduce the ima ge .
-
8/3/2019 Compression ha C Oxford Engineering College S2
13/13
Compression Page 13
C.Jayapritha,Oxford Engineering College
References
And leigh, P.K. and Thakrar, K., Multimed ia Systems and Design , Prentice
Ha ll of India , 2003.Jud ith Jeffc oa te, Multime dia in Prac tice: Tec hnolog y and Ap p lica tions ,
Prent ice Hall of India , 1998.
ht tp :/ / 59.163.61.3:8080/ GRATEST/ SHOWTEXFILE.do?p age_id=user_ima ge&u
ser_ima ge_id=2447