<s>
JPEG	O
(	O
,	O
short	O
for	O
Joint	O
Photographic	O
Experts	O
Group	O
)	O
is	O
a	O
commonly	O
used	O
method	O
of	O
lossy	B-Algorithm
compression	I-Algorithm
for	O
digital	B-Algorithm
images	I-Algorithm
,	O
particularly	O
for	O
those	O
images	O
produced	O
by	O
digital	B-Application
photography	I-Application
.	O
</s>
<s>
The	O
degree	O
of	O
compression	B-General_Concept
can	O
be	O
adjusted	O
,	O
allowing	O
a	O
selectable	O
tradeoff	O
between	O
storage	O
size	O
and	O
image	B-Algorithm
quality	I-Algorithm
.	O
</s>
<s>
JPEG	O
typically	O
achieves	O
10:1	O
compression	B-General_Concept
with	O
little	O
perceptible	O
loss	O
in	O
image	B-Algorithm
quality	I-Algorithm
.	O
</s>
<s>
Since	O
its	O
introduction	O
in	O
1992	O
,	O
JPEG	O
has	O
been	O
the	O
most	O
widely	O
used	O
image	B-General_Concept
compression	I-General_Concept
standard	O
in	O
the	O
world	O
,	O
and	O
the	O
most	O
widely	O
used	O
digital	B-Algorithm
image	I-Algorithm
format	O
,	O
with	O
several	O
billion	O
JPEG	O
images	O
produced	O
every	O
day	O
as	O
of	O
2015	O
.	O
</s>
<s>
JPEG	O
was	O
largely	O
responsible	O
for	O
the	O
proliferation	O
of	O
digital	B-Algorithm
images	I-Algorithm
and	O
digital	B-Application
photos	I-Application
across	O
the	O
Internet	O
and	O
later	O
social	O
media	O
.	O
</s>
<s>
JPEG	O
compression	B-General_Concept
is	O
used	O
in	O
a	O
number	O
of	O
image	O
file	O
formats	O
.	O
</s>
<s>
JPEG/Exif	O
is	O
the	O
most	O
common	O
image	O
format	O
used	O
by	O
digital	B-Device
cameras	I-Device
and	O
other	O
photographic	O
image	O
capture	O
devices	O
;	O
along	O
with	O
JPEG/JFIF	O
,	O
it	O
is	O
the	O
most	O
common	O
format	O
for	O
storing	O
and	O
transmitting	O
photographic	O
images	O
on	O
the	O
World	O
Wide	O
Web	O
.	O
</s>
<s>
The	O
MIME	B-Application
media	I-Application
type	I-Application
for	O
JPEG	O
is	O
"	O
image/jpeg	O
,	O
"	O
except	O
in	O
older	O
Internet	B-Protocol
Explorer	I-Protocol
versions	O
,	O
which	O
provide	O
a	O
MIME	B-Application
type	I-Application
of	O
"	O
image/pjpeg	O
"	O
when	O
uploading	O
JPEG	O
images	O
.	O
</s>
<s>
The	O
following	O
patents	O
provided	O
the	O
basis	O
for	O
its	O
arithmetic	B-Algorithm
coding	I-Algorithm
algorithm	O
.	O
</s>
<s>
Absent	O
from	O
the	O
list	O
is	O
,	O
filed	O
by	O
Compression	B-General_Concept
Labs	O
 '	O
Wen-Hsiung	O
Chen	O
and	O
Daniel	O
J	O
.	O
Klenke	O
in	O
October	O
1986	O
.	O
</s>
<s>
The	O
patent	O
describes	O
a	O
DCT-based	O
image	B-General_Concept
compression	I-General_Concept
algorithm	O
,	O
and	O
would	O
later	O
be	O
a	O
cause	O
of	O
controversy	O
in	O
2002	O
(	O
see	O
Patent	O
controversy	O
below	O
)	O
.	O
</s>
<s>
The	O
"	O
Joint	O
"	O
stood	O
for	O
ISO	B-General_Concept
TC97	O
WG8	O
and	O
CCITT	O
SGVIII	O
.	O
</s>
<s>
In	O
1987	O
,	O
ISO	B-General_Concept
TC	O
97	O
became	O
ISO/IEC	O
JTC	O
1	O
and	O
,	O
in	O
1992	O
,	O
CCITT	O
became	O
ITU-T	O
.	O
</s>
<s>
Currently	O
on	O
the	O
JTC1	O
side	O
,	O
JPEG	O
is	O
one	O
of	O
two	O
sub-groups	O
of	O
ISO/IEC	O
Joint	O
Technical	O
Committee	O
1	O
,	O
Subcommittee	O
29	O
,	O
Working	O
Group	O
1	O
(	O
ISO/IEC	O
JTC	O
1/SC	O
29/WG	O
1	O
)	O
–	O
titled	O
as	O
Coding	O
of	O
still	O
pictures	O
.	O
</s>
<s>
The	O
original	O
JPEG	O
Group	O
was	O
organized	O
in	O
1986	O
,	O
issuing	O
the	O
first	O
JPEG	O
standard	O
in	O
1992	O
,	O
which	O
was	O
approved	O
in	O
September	O
1992	O
as	O
ITU-T	O
Recommendation	O
T.81	O
and	O
,	O
in	O
1994	O
,	O
as	O
ISO/IEC	O
10918-1	O
.	O
</s>
<s>
The	O
JPEG	O
standard	O
specifies	O
the	O
codec	B-General_Concept
,	O
which	O
defines	O
how	O
an	O
image	O
is	O
compressed	O
into	O
a	O
stream	O
of	O
bytes	B-Application
and	O
decompressed	O
back	O
into	O
an	O
image	O
,	O
but	O
not	O
the	O
file	O
format	O
used	O
to	O
contain	O
that	O
stream	O
.	O
</s>
<s>
JPEG	O
standards	O
are	O
formally	O
named	O
as	O
Information	O
technology	O
–	O
Digital	O
compression	B-General_Concept
and	O
coding	O
of	O
continuous-tone	O
still	O
images	O
.	O
</s>
<s>
ISO/IEC	O
10918	O
consists	O
of	O
the	O
following	O
parts	O
:	O
</s>
<s>
+Digital	O
compression	B-General_Concept
and	O
coding	O
of	O
continuous-tone	O
still	O
images	O
–	O
Parts	O
Part	O
ISO/IEC	O
standard	O
ITU-T	O
Rec	O
.	O
</s>
<s>
First	O
public	O
release	O
date	O
Latest	O
amendment	O
Title	O
Description	O
Part	O
1	O
ISO/IEC	O
10918-1:1994	O
T.81	O
(	O
09/92	O
)	O
Requirements	O
and	O
guidelines	O
Part	O
2	O
ISO/IEC	O
10918-2:1995	O
T.83	O
(	O
11/94	O
)	O
Compliance	O
testing	O
Rules	O
and	O
checks	O
for	O
software	O
conformance	O
(	O
to	O
Part	O
1	O
)	O
.	O
</s>
<s>
Part	O
3	O
ISO/IEC	O
10918-3:1997	O
T.84	O
(	O
07/96	O
)	O
Extensions	O
Set	O
of	O
extensions	O
to	O
improve	O
the	O
Part	O
1	O
,	O
including	O
the	O
Still	O
Picture	O
Interchange	O
File	O
Format	O
(	O
SPIFF	O
)	O
.	O
</s>
<s>
Part	O
4	O
ISO/IEC	O
10918-4:1999	O
T.86	O
(	O
06/98	O
)	O
Registration	O
of	O
JPEG	O
profiles	O
,	O
SPIFF	O
profiles	O
,	O
SPIFF	O
tags	O
,	O
SPIFF	O
colour	B-Algorithm
spaces	I-Algorithm
,	O
APPn	O
markers	O
,	O
SPIFF	O
compression	B-General_Concept
types	O
and	O
Registration	O
Authorities	O
(	O
REGAUT	O
)	O
methods	O
for	O
registering	O
some	O
of	O
the	O
parameters	O
used	O
to	O
extend	O
JPEG	O
Part	O
5	O
ISO/IEC	O
10918-5:2013	O
T.871	O
(	O
05/11	O
)	O
JPEG	O
File	O
Interchange	O
Format	O
(	O
JFIF	O
)	O
A	O
popular	O
format	O
which	O
has	O
been	O
the	O
de	O
facto	O
file	O
format	O
for	O
images	O
encoded	O
by	O
the	O
JPEG	O
standard	O
.	O
</s>
<s>
In	O
2002	O
,	O
Forgent	O
Networks	O
asserted	O
that	O
it	O
owned	O
and	O
would	O
enforce	O
patent	O
rights	O
on	O
the	O
JPEG	O
technology	O
,	O
arising	O
from	O
a	O
patent	O
that	O
had	O
been	O
filed	O
on	O
October	O
27	O
,	O
1986	O
,	O
and	O
granted	O
on	O
October	O
6	O
,	O
1987	O
:	O
by	O
Compression	B-General_Concept
Labs	O
 '	O
Wen-Hsiung	O
Chen	O
and	O
Daniel	O
J	O
.	O
Klenke	O
.	O
</s>
<s>
While	O
Forgent	O
did	O
not	O
own	O
Compression	B-General_Concept
Labs	O
at	O
the	O
time	O
,	O
Chen	O
later	O
sold	O
Compression	B-General_Concept
Labs	O
to	O
Forgent	O
,	O
before	O
Chen	O
went	O
on	O
to	O
work	O
for	O
Cisco	O
.	O
</s>
<s>
Forgent	O
's	O
2002	O
announcement	O
created	O
a	O
furor	O
reminiscent	O
of	O
Unisys	O
 '	O
attempts	O
to	O
assert	O
its	O
rights	O
over	O
the	O
GIF	O
image	B-General_Concept
compression	I-General_Concept
standard	O
.	O
</s>
<s>
Beginning	O
in	O
2011	O
and	O
continuing	O
as	O
of	O
early	O
2013	O
,	O
an	O
entity	O
known	O
as	O
Princeton	O
Digital	B-Algorithm
Image	I-Algorithm
Corporation	O
,	O
based	O
in	O
Eastern	O
Texas	O
,	O
began	O
suing	O
large	O
numbers	O
of	O
companies	O
for	O
alleged	O
infringement	O
of	O
.	O
</s>
<s>
Princeton	O
claims	O
that	O
the	O
JPEG	O
image	B-General_Concept
compression	I-General_Concept
standard	O
infringes	O
the	O
'	O
056	O
patent	O
and	O
has	O
sued	O
large	O
numbers	O
of	O
websites	O
,	O
retailers	O
,	O
camera	O
and	O
device	O
manufacturers	O
and	O
resellers	O
.	O
</s>
<s>
The	O
JPEG	O
compression	B-General_Concept
algorithm	O
operates	O
at	O
its	O
best	O
on	O
photographs	O
and	O
paintings	O
of	O
realistic	O
scenes	O
with	O
smooth	O
variations	O
of	O
tone	O
and	O
color	O
.	O
</s>
<s>
For	O
web	O
usage	O
,	O
where	O
reducing	O
the	O
amount	O
of	O
data	O
used	O
for	O
an	O
image	O
is	O
important	O
for	O
responsive	O
presentation	O
,	O
JPEG	O
's	O
compression	B-General_Concept
benefits	O
make	O
JPEG	O
popular	O
.	O
</s>
<s>
JPEG/Exif	O
is	O
also	O
the	O
most	O
common	O
format	O
saved	O
by	O
digital	B-Device
cameras	I-Device
.	O
</s>
<s>
However	O
,	O
JPEG	O
is	O
not	O
well	O
suited	O
for	O
line	O
drawings	O
and	O
other	O
textual	O
or	O
iconic	O
graphics	O
,	O
where	O
the	O
sharp	O
contrasts	O
between	O
adjacent	O
pixels	O
can	O
cause	O
noticeable	O
artifacts	B-Algorithm
.	O
</s>
<s>
Such	O
images	O
are	O
better	O
saved	O
in	O
a	O
lossless	B-Algorithm
graphics	O
format	O
such	O
as	O
TIFF	O
,	O
GIF	O
,	O
PNG	O
,	O
or	O
a	O
raw	B-Application
image	I-Application
format	I-Application
.	O
</s>
<s>
The	O
JPEG	O
standard	O
includes	O
a	O
lossless	B-Algorithm
coding	O
mode	O
,	O
but	O
that	O
mode	O
is	O
not	O
supported	O
in	O
most	O
products	O
.	O
</s>
<s>
As	O
the	O
typical	O
use	O
of	O
JPEG	O
is	O
a	O
lossy	B-Algorithm
compression	I-Algorithm
method	O
,	O
which	O
reduces	O
the	O
image	O
fidelity	O
,	O
it	O
is	O
inappropriate	O
for	O
exact	O
reproduction	O
of	O
imaging	O
data	O
(	O
such	O
as	O
some	O
scientific	O
and	O
medical	O
imaging	O
applications	O
and	O
certain	O
technical	O
image	B-Algorithm
processing	I-Algorithm
work	O
)	O
.	O
</s>
<s>
JPEG	O
is	O
also	O
not	O
well	O
suited	O
to	O
files	O
that	O
will	O
undergo	O
multiple	O
edits	O
,	O
as	O
some	O
image	B-Algorithm
quality	I-Algorithm
is	O
lost	O
each	O
time	O
the	O
image	O
is	O
recompressed	O
,	O
particularly	O
if	O
the	O
image	O
is	O
cropped	O
or	O
shifted	O
,	O
or	O
if	O
encoding	O
parameters	O
are	O
changed	O
–	O
see	O
digital	O
generation	O
loss	O
for	O
details	O
.	O
</s>
<s>
To	O
prevent	O
image	O
information	O
loss	O
during	O
sequential	O
and	O
repetitive	O
editing	O
,	O
the	O
first	O
edit	O
can	O
be	O
saved	O
in	O
a	O
lossless	B-Algorithm
format	I-Algorithm
,	O
subsequently	O
edited	O
in	O
that	O
format	O
,	O
then	O
finally	O
published	O
as	O
JPEG	O
for	O
distribution	O
.	O
</s>
<s>
JPEG	O
uses	O
a	O
lossy	B-Algorithm
form	O
of	O
compression	B-General_Concept
based	O
on	O
the	O
discrete	B-General_Concept
cosine	I-General_Concept
transform	I-General_Concept
(	O
DCT	B-General_Concept
)	O
.	O
</s>
<s>
In	O
the	O
transform	O
domain	O
,	O
the	O
process	O
of	O
reducing	O
information	O
is	O
called	O
quantization	B-Algorithm
.	O
</s>
<s>
In	O
simpler	O
terms	O
,	O
quantization	B-Algorithm
is	O
a	O
method	O
for	O
optimally	O
reducing	O
a	O
large	O
number	O
scale	O
(	O
with	O
different	O
occurrences	O
of	O
each	O
number	O
)	O
into	O
a	O
smaller	O
one	O
,	O
and	O
the	O
transform-domain	O
is	O
a	O
convenient	O
representation	O
of	O
the	O
image	O
because	O
the	O
high-frequency	O
coefficients	O
,	O
which	O
contribute	O
less	O
to	O
the	O
overall	O
picture	O
than	O
other	O
coefficients	O
,	O
are	O
characteristically	O
small-values	O
with	O
high	O
compressibility	O
.	O
</s>
<s>
The	O
quantized	B-Algorithm
coefficients	O
are	O
then	O
sequenced	O
and	O
losslessly	B-Algorithm
packed	O
into	O
the	O
output	O
bitstream	O
.	O
</s>
<s>
Nearly	O
all	O
software	O
implementations	O
of	O
JPEG	O
permit	O
user	O
control	O
over	O
the	O
compression	B-General_Concept
ratio	O
(	O
as	O
well	O
as	O
other	O
optional	O
parameters	O
)	O
,	O
allowing	O
the	O
user	O
to	O
trade	O
off	O
picture-quality	O
for	O
smaller	O
file	O
size	O
.	O
</s>
<s>
In	O
embedded	O
applications	O
(	O
such	O
as	O
miniDV	O
,	O
which	O
uses	O
a	O
similar	O
DCT-compression	O
scheme	O
)	O
,	O
the	O
parameters	O
are	O
pre-selected	O
and	O
fixed	O
for	O
the	O
application	O
.	O
</s>
<s>
The	O
compression	B-General_Concept
method	O
is	O
usually	O
lossy	B-Algorithm
,	O
meaning	O
that	O
some	O
original	O
image	O
information	O
is	O
lost	O
and	O
cannot	O
be	O
restored	O
,	O
possibly	O
affecting	O
image	B-Algorithm
quality	I-Algorithm
.	O
</s>
<s>
There	O
is	O
an	O
optional	O
lossless	B-Algorithm
mode	O
defined	O
in	O
the	O
JPEG	O
standard	O
.	O
</s>
<s>
When	O
progressive	O
JPEGs	O
are	O
received	O
by	O
programs	O
that	O
do	O
not	O
support	O
them	O
(	O
such	O
as	O
versions	O
of	O
Internet	B-Protocol
Explorer	I-Protocol
before	O
Windows	B-Device
7	I-Device
)	O
the	O
software	O
displays	O
the	O
image	O
only	O
after	O
it	O
has	O
been	O
completely	O
downloaded	O
.	O
</s>
<s>
The	O
libjpeg	B-Language
codec	B-General_Concept
supports	O
12-bit	O
JPEG	O
and	O
there	O
even	O
exists	O
a	O
high-performance	O
version	O
.	O
</s>
<s>
Several	O
alterations	O
to	O
a	O
JPEG	O
image	O
can	O
be	O
performed	O
losslessly	B-Algorithm
(	O
that	O
is	O
,	O
without	O
recompression	O
and	O
the	O
associated	O
quality	O
loss	O
)	O
as	O
long	O
as	O
the	O
image	O
size	O
is	O
a	O
multiple	O
of	O
1	O
MCU	O
block	O
(	O
Minimum	O
Coded	O
Unit	O
)	O
(	O
usually	O
16	O
pixels	O
in	O
both	O
directions	O
,	O
for	O
4:2:0	O
chroma	O
subsampling	O
)	O
.	O
</s>
<s>
jpegtran	B-Language
and	O
its	O
GUI	O
,	O
Jpegcrop	O
.	O
</s>
<s>
IrfanView	B-Protocol
using	O
"	O
JPG	O
Lossless	B-Algorithm
Crop	O
(	O
PlugIn	O
)	O
"	O
and	O
"	O
JPG	O
Lossless	B-Algorithm
Rotation	O
(	O
PlugIn	O
)	O
"	O
,	O
which	O
require	O
installing	O
the	O
JPG_TRANSFORM	O
plugin	O
.	O
</s>
<s>
FastStone	B-Application
Image	I-Application
Viewer	I-Application
using	O
"	O
Lossless	B-Algorithm
Crop	O
to	O
File	O
"	O
and	O
"	O
JPEG	O
Lossless	B-Algorithm
Rotate	O
"	O
.	O
</s>
<s>
XnViewMP	B-Protocol
using	O
"	O
JPEG	O
lossless	B-Algorithm
transformations	O
"	O
.	O
</s>
<s>
ACDSee	B-Application
supports	O
lossless	B-Algorithm
rotation	O
(	O
but	O
not	O
lossless	B-Algorithm
cropping	O
)	O
with	O
its	O
"	O
Force	O
lossless	B-Algorithm
JPEG	O
operations	O
"	O
option	O
.	O
</s>
<s>
This	O
limits	O
the	O
possible	O
lossless	B-Algorithm
crop	O
operations	O
,	O
and	O
also	O
prevents	O
flips	O
and	O
rotations	O
of	O
an	O
image	O
whose	O
bottom	O
or	O
right	O
edge	O
does	O
not	O
lie	O
on	O
a	O
block	O
boundary	O
for	O
all	O
channels	O
(	O
because	O
the	O
edge	O
would	O
end	O
up	O
on	O
top	O
or	O
left	O
,	O
where	O
–	O
as	O
aforementioned	O
–	O
a	O
block	O
boundary	O
is	O
obligatory	O
)	O
.	O
</s>
<s>
Rotations	O
where	O
the	O
image	O
is	O
not	O
a	O
multiple	O
of	O
8	O
or	O
16	O
,	O
which	O
value	O
depends	O
upon	O
the	O
chroma	O
subsampling	O
,	O
are	O
not	O
lossless	B-Algorithm
.	O
</s>
<s>
When	O
using	O
lossless	B-Algorithm
cropping	O
,	O
if	O
the	O
bottom	O
or	O
right	O
side	O
of	O
the	O
crop	O
region	O
is	O
not	O
on	O
a	O
block	O
boundary	O
,	O
then	O
the	O
rest	O
of	O
the	O
data	O
from	O
the	O
partially	O
used	O
blocks	O
will	O
still	O
be	O
present	O
in	O
the	O
cropped	O
file	O
and	O
can	O
be	O
recovered	O
.	O
</s>
<s>
Furthermore	O
,	O
several	O
JPEG	O
images	O
can	O
be	O
losslessly	B-Algorithm
joined	O
,	O
as	O
long	O
as	O
they	O
were	O
saved	O
with	O
the	O
same	O
quality	O
and	O
the	O
edges	O
coincide	O
with	O
block	O
boundaries	O
.	O
</s>
<s>
Both	O
of	O
these	O
formats	O
use	O
the	O
actual	O
JIF	O
byte	B-Application
layout	O
,	O
consisting	O
of	O
different	O
markers	O
,	O
but	O
in	O
addition	O
,	O
employ	O
one	O
of	O
the	O
JIF	O
standard	O
's	O
extension	O
points	O
,	O
namely	O
the	O
application	O
markers	O
:	O
JFIF	O
uses	O
APP0	O
,	O
while	O
Exif	O
uses	O
APP1	O
.	O
</s>
<s>
Image	O
files	O
that	O
employ	O
JPEG	O
compression	B-General_Concept
are	O
commonly	O
called	O
"	O
JPEG	O
files	O
"	O
,	O
and	O
are	O
stored	O
in	O
variants	O
of	O
the	O
JIF	O
image	O
format	O
.	O
</s>
<s>
Most	O
image	O
capture	O
devices	O
(	O
such	O
as	O
digital	B-Device
cameras	I-Device
)	O
that	O
output	O
JPEG	O
are	O
actually	O
creating	O
files	O
in	O
the	O
Exif	O
format	O
,	O
the	O
format	O
that	O
the	O
camera	O
industry	O
has	O
standardized	O
on	O
for	O
metadata	O
interchange	O
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
since	O
the	O
Exif	O
standard	O
does	O
not	O
allow	O
color	O
profiles	O
,	O
most	O
image	B-Application
editing	I-Application
software	I-Application
stores	O
JPEG	O
in	O
JFIF	O
format	O
,	O
and	O
also	O
includes	O
the	O
APP1	O
segment	O
from	O
the	O
Exif	O
file	O
to	O
include	O
the	O
metadata	O
in	O
an	O
almost-compliant	O
way	O
;	O
the	O
JFIF	O
standard	O
is	O
interpreted	O
somewhat	O
flexibly	O
.	O
</s>
<s>
The	O
most	O
common	O
filename	O
extensions	O
for	O
files	O
employing	O
JPEG	O
compression	B-General_Concept
are	O
.jpg	O
and	O
.jpeg	O
,	O
though	O
.jpe	O
,	O
.jfif	O
and	O
.jif	O
are	O
also	O
used	O
.	O
</s>
<s>
It	O
is	O
also	O
possible	O
for	O
JPEG	O
data	O
to	O
be	O
embedded	O
in	O
other	O
file	O
types	O
–	O
TIFF	O
encoded	O
files	O
often	O
embed	O
a	O
JPEG	O
image	O
as	O
a	O
thumbnail	O
of	O
the	O
main	O
image	O
;	O
and	O
MP3	B-Application
files	I-Application
can	O
contain	O
a	O
JPEG	O
of	O
cover	O
art	O
in	O
the	O
ID3v2	O
tag	O
.	O
</s>
<s>
Many	O
JPEG	O
files	O
embed	O
an	O
ICC	O
color	O
profile	O
(	O
color	B-Algorithm
space	I-Algorithm
)	O
.	O
</s>
<s>
Because	O
these	O
color	B-Algorithm
spaces	I-Algorithm
use	O
a	O
non-linear	O
transformation	O
,	O
the	O
dynamic	O
range	O
of	O
an	O
8-bit	O
JPEG	O
file	O
is	O
about	O
11	O
stops	O
;	O
see	O
gamma	O
curve	O
.	O
</s>
<s>
If	O
the	O
image	O
does	O
n't	O
specify	O
color	O
profile	O
information	O
(	O
untagged	O
)	O
,	O
the	O
color	B-Algorithm
space	I-Algorithm
is	O
assumed	O
to	O
be	O
sRGB	O
for	O
the	O
purposes	O
of	O
display	O
on	O
webpages	O
.	O
</s>
<s>
A	O
JPEG	O
image	O
consists	O
of	O
a	O
sequence	O
of	O
segments	O
,	O
each	O
beginning	O
with	O
a	O
marker	O
,	O
each	O
of	O
which	O
begins	O
with	O
a	O
0xFF	O
byte	B-Application
,	O
followed	O
by	O
a	O
byte	B-Application
indicating	O
what	O
kind	O
of	O
marker	O
it	O
is	O
.	O
</s>
<s>
Some	O
markers	O
consist	O
of	O
just	O
those	O
two	O
bytes	B-Application
;	O
others	O
are	O
followed	O
by	O
two	O
bytes	B-Application
(	O
high	O
then	O
low	O
)	O
,	O
indicating	O
the	O
length	O
of	O
marker-specific	O
payload	O
data	O
that	O
follows	O
.	O
</s>
<s>
(	O
The	O
length	O
includes	O
the	O
two	O
bytes	B-Application
for	O
the	O
length	O
,	O
but	O
not	O
the	O
two	O
bytes	B-Application
for	O
the	O
marker	O
.	O
)	O
</s>
<s>
Some	O
markers	O
are	O
followed	O
by	O
entropy-coded	B-Algorithm
data	O
;	O
the	O
length	O
of	O
such	O
a	O
marker	O
does	O
not	O
include	O
the	O
entropy-coded	B-Algorithm
data	O
.	O
</s>
<s>
Note	O
that	O
consecutive	O
0xFF	O
bytes	B-Application
are	O
used	O
as	O
fill	O
bytes	B-Application
for	O
padding	B-Application
purposes	O
,	O
although	O
this	O
fill	O
byte	B-Application
padding	B-Application
should	O
only	O
ever	O
take	O
place	O
for	O
markers	O
immediately	O
following	O
entropy-coded	B-Algorithm
scan	O
data	O
(	O
see	O
JPEG	O
specification	O
section	O
B.1.1.2	O
and	O
E.1.2	O
for	O
details	O
;	O
specifically	O
"	O
In	O
all	O
cases	O
where	O
markers	O
are	O
appended	O
after	O
the	O
compressed	O
data	O
,	O
optional	O
0xFF	O
fill	O
bytes	B-Application
may	O
precede	O
the	O
marker	O
"	O
)	O
.	O
</s>
<s>
Within	O
the	O
entropy-coded	B-Algorithm
data	O
,	O
after	O
any	O
0xFF	O
byte	B-Application
,	O
a	O
0x00	O
byte	B-Application
is	O
inserted	O
by	O
the	O
encoder	O
before	O
the	O
next	O
byte	B-Application
,	O
so	O
that	O
there	O
does	O
not	O
appear	O
to	O
be	O
a	O
marker	O
where	O
none	O
is	O
intended	O
,	O
preventing	O
framing	O
errors	O
.	O
</s>
<s>
Decoders	O
must	O
skip	O
this	O
0x00	O
byte	B-Application
.	O
</s>
<s>
This	O
technique	O
,	O
called	O
byte	B-Application
stuffing	O
(	O
see	O
JPEG	O
specification	O
section	O
F.1.2.3	O
)	O
,	O
is	O
only	O
applied	O
to	O
the	O
entropy-coded	B-Algorithm
data	O
,	O
not	O
to	O
marker	O
payload	O
data	O
.	O
</s>
<s>
Note	O
however	O
that	O
entropy-coded	B-Algorithm
data	O
has	O
a	O
few	O
markers	O
of	O
its	O
own	O
;	O
specifically	O
the	O
Reset	O
markers	O
(	O
0xD0	O
through	O
0xD7	O
)	O
,	O
which	O
are	O
used	O
to	O
isolate	O
independent	O
chunks	O
of	O
entropy-coded	B-Algorithm
data	O
to	O
allow	O
parallel	O
decoding	O
,	O
and	O
encoders	O
are	O
free	O
to	O
insert	O
these	O
Reset	O
markers	O
at	O
regular	O
intervals	O
(	O
although	O
not	O
all	O
encoders	O
do	O
this	O
)	O
.	O
</s>
<s>
+	O
Common	O
JPEG	O
markers	O
Short	O
name	O
Bytes	B-Application
Payload	O
Name	O
Comments	O
SOI	O
0xFF	O
,	O
0xD8	O
none	O
Start	O
Of	O
Image	O
SOF0	O
0xFF	O
,	O
0xC0	O
variable	O
size	O
Start	O
Of	O
Frame	O
(	O
baseline	O
DCT	B-General_Concept
)	O
Indicates	O
that	O
this	O
is	O
a	O
baseline	O
DCT-based	O
JPEG	O
,	O
and	O
specifies	O
the	O
width	O
,	O
height	O
,	O
number	O
of	O
components	O
,	O
and	O
component	O
subsampling	O
(	O
e.g.	O
,	O
4:2:0	O
)	O
.	O
</s>
<s>
SOF2	O
0xFF	O
,	O
0xC2	O
variable	O
size	O
Start	O
Of	O
Frame	O
(	O
progressive	O
DCT	B-General_Concept
)	O
Indicates	O
that	O
this	O
is	O
a	O
progressive	O
DCT-based	O
JPEG	O
,	O
and	O
specifies	O
the	O
width	O
,	O
height	O
,	O
number	O
of	O
components	O
,	O
and	O
component	O
subsampling	O
(	O
e.g.	O
,	O
4:2:0	O
)	O
.	O
</s>
<s>
DQT	O
0xFF	O
,	O
0xDB	O
variable	O
size	O
Define	O
Quantization	B-Algorithm
Table(s )	O
Specifies	O
one	O
or	O
more	O
quantization	B-Algorithm
tables	O
.	O
</s>
<s>
DRI	O
0xFF	O
,	O
0xDD	O
4	O
bytes	B-Application
Define	O
Restart	O
Interval	O
Specifies	O
the	O
interval	O
between	O
RSTn	O
markers	O
,	O
in	O
Minimum	O
Coded	O
Units	O
(	O
MCUs	O
)	O
.	O
</s>
<s>
This	O
marker	O
is	O
followed	O
by	O
two	O
bytes	B-Application
indicating	O
the	O
fixed	O
size	O
so	O
it	O
can	O
be	O
treated	O
like	O
any	O
other	O
variable	O
size	O
segment	O
.	O
</s>
<s>
In	O
baseline	O
DCT	B-General_Concept
JPEG	O
images	O
,	O
there	O
is	O
generally	O
a	O
single	O
scan	O
.	O
</s>
<s>
Progressive	O
DCT	B-General_Concept
JPEG	O
images	O
usually	O
contain	O
multiple	O
scans	O
.	O
</s>
<s>
This	O
marker	O
specifies	O
which	O
slice	O
of	O
data	O
it	O
will	O
contain	O
,	O
and	O
is	O
immediately	O
followed	O
by	O
entropy-coded	B-Algorithm
data	O
.	O
</s>
<s>
RSTn	O
0xFF	O
,	O
0xDn	O
(	O
n	O
=	O
0	O
..	O
7	O
)	O
none	O
Restart	O
Inserted	O
every	O
r	O
macroblocks	B-General_Concept
,	O
where	O
r	O
is	O
the	O
restart	O
interval	O
set	O
by	O
a	O
DRI	O
marker	O
.	O
</s>
<s>
At	O
a	O
restart	O
marker	O
,	O
block-to-block	O
predictor	O
variables	O
are	O
reset	O
,	O
and	O
the	O
bitstream	O
is	O
synchronized	O
to	O
a	O
byte	B-Application
boundary	O
.	O
</s>
<s>
Since	O
the	O
runs	O
of	O
macroblocks	B-General_Concept
between	O
restart	O
markers	O
may	O
be	O
independently	O
decoded	O
,	O
these	O
runs	O
may	O
be	O
decoded	O
in	O
parallel	O
.	O
</s>
<s>
The	O
image	O
is	O
split	O
into	O
blocks	O
of	O
8×8	O
pixels	O
,	O
and	O
for	O
each	O
block	O
,	O
each	O
of	O
the	O
Y	O
,	O
CB	O
,	O
and	O
CR	O
data	O
undergoes	O
the	O
discrete	B-General_Concept
cosine	I-General_Concept
transform	I-General_Concept
(	O
DCT	B-General_Concept
)	O
.	O
</s>
<s>
A	O
DCT	B-General_Concept
is	O
similar	O
to	O
a	O
Fourier	B-Algorithm
transform	I-Algorithm
in	O
the	O
sense	O
that	O
it	O
produces	O
a	O
kind	O
of	O
spatial	O
frequency	O
spectrum	O
.	O
</s>
<s>
The	O
amplitudes	O
of	O
the	O
frequency	O
components	O
are	O
quantized	B-Algorithm
.	O
</s>
<s>
The	O
quality	O
setting	O
of	O
the	O
encoder	O
(	O
for	O
example	O
50	O
or	O
95	O
on	O
a	O
scale	O
of	O
0	O
–	O
100	O
in	O
the	O
Independent	B-Language
JPEG	I-Language
Group	I-Language
's	O
library	O
)	O
affects	O
to	O
what	O
extent	O
the	O
resolution	O
of	O
each	O
frequency	O
component	O
is	O
reduced	O
.	O
</s>
<s>
The	O
resulting	O
data	O
for	O
all	O
8×8	O
blocks	O
is	O
further	O
compressed	O
with	O
a	O
lossless	B-Algorithm
algorithm	O
,	O
a	O
variant	O
of	O
Huffman	B-General_Concept
encoding	I-General_Concept
.	O
</s>
<s>
The	O
decoding	O
process	O
reverses	O
these	O
steps	O
,	O
except	O
the	O
quantization	B-Algorithm
because	O
it	O
is	O
irreversible	O
.	O
</s>
<s>
This	O
particular	O
option	O
is	O
a	O
lossy	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
method	O
.	O
</s>
<s>
First	O
,	O
the	O
image	O
should	O
be	O
converted	O
from	O
RGB	O
(	O
by	O
default	O
sRGB	O
,	O
but	O
other	O
color	B-Algorithm
spaces	I-Algorithm
are	O
possible	O
)	O
into	O
a	O
different	O
color	B-Algorithm
space	I-Algorithm
called	O
(	O
or	O
,	O
informally	O
,	O
YCbCr	O
)	O
.	O
</s>
<s>
This	O
is	O
basically	O
the	O
same	O
color	B-Algorithm
space	I-Algorithm
as	O
used	O
by	O
digital	B-Application
color	I-Application
television	I-Application
as	O
well	O
as	O
digital	O
video	O
including	O
video	O
DVDs	O
.	O
</s>
<s>
The	O
color	B-Algorithm
space	I-Algorithm
conversion	I-Algorithm
allows	O
greater	O
compression	B-General_Concept
without	O
a	O
significant	O
effect	O
on	O
perceptual	O
image	B-Algorithm
quality	I-Algorithm
(	O
or	O
greater	O
perceptual	O
image	B-Algorithm
quality	I-Algorithm
for	O
the	O
same	O
compression	B-General_Concept
)	O
.	O
</s>
<s>
The	O
compression	B-General_Concept
is	O
more	O
efficient	O
because	O
the	O
brightness	O
information	O
,	O
which	O
is	O
more	O
important	O
to	O
the	O
eventual	O
perceptual	O
quality	O
of	O
the	O
image	O
,	O
is	O
confined	O
to	O
a	O
single	O
channel	B-Algorithm
.	O
</s>
<s>
The	O
color	O
transformation	O
also	O
improves	O
compression	B-General_Concept
by	O
statistical	O
decorrelation	B-Algorithm
.	O
</s>
<s>
This	O
results	O
in	O
less	O
efficient	O
compression	B-General_Concept
,	O
and	O
would	O
not	O
likely	O
be	O
used	O
when	O
file	O
size	O
is	O
especially	O
important	O
.	O
</s>
<s>
The	O
transformation	O
into	O
the	O
color	O
model	O
enables	O
the	O
next	O
usual	O
step	O
,	O
which	O
is	O
to	O
reduce	O
the	O
spatial	O
resolution	O
of	O
the	O
Cb	O
and	O
Cr	O
components	O
(	O
called	O
"	O
downsampling	B-Algorithm
"	O
or	O
"	O
chroma	O
subsampling	O
"	O
)	O
.	O
</s>
<s>
The	O
ratios	O
at	O
which	O
the	O
downsampling	B-Algorithm
is	O
ordinarily	O
done	O
for	O
JPEG	O
images	O
are	O
4:4:4	O
(	O
no	O
downsampling	B-Algorithm
)	O
,	O
4:2:2	O
(	O
reduction	O
by	O
a	O
factor	O
of	O
2	O
in	O
the	O
horizontal	O
direction	O
)	O
,	O
or	O
(	O
most	O
commonly	O
)	O
4:2:0	O
(	O
reduction	O
by	O
a	O
factor	O
of	O
2	O
in	O
both	O
the	O
horizontal	O
and	O
vertical	O
directions	O
)	O
.	O
</s>
<s>
For	O
the	O
rest	O
of	O
the	O
compression	B-General_Concept
process	O
,	O
Y	O
 '	O
,	O
Cb	O
and	O
Cr	O
are	O
processed	O
separately	O
and	O
in	O
a	O
very	O
similar	O
manner	O
.	O
</s>
<s>
After	O
subsampling	O
,	O
each	O
channel	B-Algorithm
must	O
be	O
split	O
into	O
8×8	O
blocks	O
.	O
</s>
<s>
In	O
video	O
compression	B-General_Concept
MCUs	O
are	O
called	O
macroblocks	B-General_Concept
.	O
</s>
<s>
If	O
the	O
data	O
for	O
a	O
channel	B-Algorithm
does	O
not	O
represent	O
an	O
integer	O
number	O
of	O
blocks	O
then	O
the	O
encoder	O
must	O
fill	O
the	O
remaining	O
area	O
of	O
the	O
incomplete	O
blocks	O
with	O
some	O
form	O
of	O
dummy	O
data	O
.	O
</s>
<s>
Filling	O
the	O
edges	O
with	O
a	O
fixed	O
color	O
(	O
for	O
example	O
,	O
black	O
)	O
can	O
create	O
ringing	B-Algorithm
artifacts	I-Algorithm
along	O
the	O
visible	O
part	O
of	O
the	O
border	O
;	O
</s>
<s>
repeating	O
the	O
edge	O
pixels	O
is	O
a	O
common	O
technique	O
that	O
reduces	O
(	O
but	O
does	O
not	O
necessarily	O
eliminate	O
)	O
such	O
artifacts	B-Algorithm
,	O
and	O
more	O
sophisticated	O
border	O
filling	O
techniques	O
can	O
also	O
be	O
applied	O
.	O
</s>
<s>
Next	O
,	O
each	O
8×8	O
block	O
of	O
each	O
component	O
(	O
Y	O
,	O
Cb	O
,	O
Cr	O
)	O
is	O
converted	O
to	O
a	O
frequency-domain	O
representation	O
,	O
using	O
a	O
normalized	O
,	O
two-dimensional	O
type-II	O
discrete	B-General_Concept
cosine	I-General_Concept
transform	I-General_Concept
(	O
DCT	B-General_Concept
)	O
,	O
see	O
Citation	O
1	O
in	O
discrete	B-General_Concept
cosine	I-General_Concept
transform	I-General_Concept
.	O
</s>
<s>
The	O
DCT	B-General_Concept
is	O
sometimes	O
referred	O
to	O
as	O
"	O
type-II	O
DCT	B-General_Concept
"	O
in	O
the	O
context	O
of	O
a	O
family	O
of	O
transforms	O
as	O
in	O
discrete	B-General_Concept
cosine	I-General_Concept
transform	I-General_Concept
,	O
and	O
the	O
corresponding	O
inverse	O
(	O
IDCT	B-General_Concept
)	O
is	O
denoted	O
as	O
"	O
type-III	O
DCT	B-General_Concept
"	O
.	O
</s>
<s>
Before	O
computing	O
the	O
DCT	B-General_Concept
of	O
the	O
8×8	O
block	O
,	O
its	O
values	O
are	O
shifted	O
from	O
a	O
positive	O
range	O
to	O
one	O
centered	O
on	O
zero	O
.	O
</s>
<s>
This	O
step	O
reduces	O
the	O
dynamic	O
range	O
requirements	O
in	O
the	O
DCT	B-General_Concept
processing	O
stage	O
that	O
follows	O
.	O
</s>
<s>
The	O
next	O
step	O
is	O
to	O
take	O
the	O
two-dimensional	O
DCT	B-General_Concept
,	O
which	O
is	O
given	O
by	O
:	O
</s>
<s>
The	O
advantage	O
of	O
the	O
DCT	B-General_Concept
is	O
its	O
tendency	O
to	O
aggregate	O
most	O
of	O
the	O
signal	O
in	O
one	O
corner	O
of	O
the	O
result	O
,	O
as	O
may	O
be	O
seen	O
above	O
.	O
</s>
<s>
The	O
quantization	B-Algorithm
step	O
to	O
follow	O
accentuates	O
this	O
effect	O
while	O
simultaneously	O
reducing	O
the	O
overall	O
size	O
of	O
the	O
DCT	B-General_Concept
coefficients	O
,	O
resulting	O
in	O
a	O
signal	O
that	O
is	O
easy	O
to	O
compress	O
efficiently	O
in	O
the	O
entropy	O
stage	O
.	O
</s>
<s>
The	O
DCT	B-General_Concept
temporarily	O
increases	O
the	O
bit-depth	O
of	O
the	O
data	O
,	O
since	O
the	O
DCT	B-General_Concept
coefficients	O
of	O
an	O
8-bit/component	O
image	O
take	O
up	O
to	O
11	O
or	O
more	O
bits	O
(	O
depending	O
on	O
fidelity	O
of	O
the	O
DCT	B-General_Concept
calculation	O
)	O
to	O
store	O
.	O
</s>
<s>
This	O
may	O
force	O
the	O
codec	B-General_Concept
to	O
temporarily	O
use	O
16-bit	O
numbers	O
to	O
hold	O
these	O
coefficients	O
,	O
doubling	O
the	O
size	O
of	O
the	O
image	O
representation	O
at	O
this	O
point	O
;	O
these	O
values	O
are	O
typically	O
reduced	O
back	O
to	O
8-bit	O
values	O
by	O
the	O
quantization	B-Algorithm
step	O
.	O
</s>
<s>
The	O
temporary	O
increase	O
in	O
size	O
at	O
this	O
stage	O
is	O
not	O
a	O
performance	O
concern	O
for	O
most	O
JPEG	O
implementations	O
,	O
since	O
typically	O
only	O
a	O
very	O
small	O
part	O
of	O
the	O
image	O
is	O
stored	O
in	O
full	O
DCT	B-General_Concept
form	O
at	O
any	O
given	O
time	O
during	O
the	O
image	O
encoding	O
or	O
decoding	O
process	O
.	O
</s>
<s>
This	O
rounding	O
operation	O
is	O
the	O
only	O
lossy	B-Algorithm
operation	O
in	O
the	O
whole	O
process	O
(	O
other	O
than	O
chroma	O
subsampling	O
)	O
if	O
the	O
DCT	B-General_Concept
computation	O
is	O
performed	O
with	O
sufficiently	O
high	O
precision	O
.	O
</s>
<s>
The	O
elements	O
in	O
the	O
quantization	B-Algorithm
matrix	O
control	O
the	O
compression	B-General_Concept
ratio	O
,	O
with	O
larger	O
values	O
producing	O
greater	O
compression	B-General_Concept
.	O
</s>
<s>
A	O
typical	O
quantization	B-Algorithm
matrix	O
(	O
for	O
a	O
quality	O
of	O
50%	O
as	O
specified	O
in	O
the	O
original	O
JPEG	O
Standard	O
)	O
,	O
is	O
as	O
follows	O
:	O
</s>
<s>
where	O
is	O
the	O
unquantized	O
DCT	B-General_Concept
coefficients	O
;	O
is	O
the	O
quantization	B-Algorithm
matrix	O
above	O
;	O
and	O
is	O
the	O
quantized	B-Algorithm
DCT	B-General_Concept
coefficients	O
.	O
</s>
<s>
Using	O
this	O
quantization	B-Algorithm
matrix	O
with	O
the	O
DCT	B-General_Concept
coefficient	O
matrix	O
from	O
above	O
results	O
in	O
:	O
</s>
<s>
Notice	O
that	O
most	O
of	O
the	O
higher-frequency	O
elements	O
of	O
the	O
sub-block	O
(	O
i.e.	O
,	O
those	O
with	O
an	O
x	O
or	O
y	O
spatial	O
frequency	O
greater	O
than	O
4	O
)	O
are	O
quantized	B-Algorithm
into	O
zero	O
values	O
.	O
</s>
<s>
Entropy	B-Algorithm
coding	I-Algorithm
is	O
a	O
special	O
form	O
of	O
lossless	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
.	O
</s>
<s>
It	O
involves	O
arranging	O
the	O
image	O
components	O
in	O
a	O
"	O
zigzag	O
"	O
order	O
employing	O
run-length	B-Algorithm
encoding	I-Algorithm
(	O
RLE	O
)	O
algorithm	O
that	O
groups	O
similar	O
frequencies	O
together	O
,	O
inserting	O
length	O
coding	O
zeros	O
,	O
and	O
then	O
using	O
Huffman	B-General_Concept
coding	I-General_Concept
on	O
what	O
is	O
left	O
.	O
</s>
<s>
The	O
JPEG	O
standard	O
also	O
allows	O
,	O
but	O
does	O
not	O
require	O
,	O
decoders	O
to	O
support	O
the	O
use	O
of	O
arithmetic	B-Algorithm
coding	I-Algorithm
,	O
which	O
is	O
mathematically	O
superior	O
to	O
Huffman	B-General_Concept
coding	I-General_Concept
.	O
</s>
<s>
However	O
,	O
this	O
feature	O
has	O
rarely	O
been	O
used	O
,	O
as	O
it	O
was	O
historically	O
covered	O
by	O
patents	O
requiring	O
royalty-bearing	O
licenses	O
,	O
and	O
because	O
it	O
is	O
slower	O
to	O
encode	O
and	O
decode	O
compared	O
to	O
Huffman	B-General_Concept
coding	I-General_Concept
.	O
</s>
<s>
Arithmetic	B-Algorithm
coding	I-Algorithm
typically	O
makes	O
files	O
about	O
5	O
–	O
7%	O
smaller	O
.	O
</s>
<s>
The	O
previous	O
quantized	B-Algorithm
DC	O
coefficient	O
is	O
used	O
to	O
predict	O
the	O
current	O
quantized	B-Algorithm
DC	O
coefficient	O
.	O
</s>
<s>
The	O
encoding	O
of	O
the	O
63	O
quantized	B-Algorithm
AC	O
coefficients	O
does	O
not	O
use	O
such	O
prediction	O
differencing	O
.	O
</s>
<s>
The	O
zigzag	O
sequence	O
for	O
the	O
above	O
quantized	B-Algorithm
coefficients	O
are	O
shown	O
below	O
.	O
</s>
<s>
If	O
the	O
i-th	O
block	O
is	O
represented	O
by	O
and	O
positions	O
within	O
each	O
block	O
are	O
represented	O
by	O
where	O
and	O
,	O
then	O
any	O
coefficient	O
in	O
the	O
DCT	B-General_Concept
image	O
can	O
be	O
represented	O
as	O
.	O
</s>
<s>
It	O
has	O
been	O
found	O
that	O
baseline	O
progressive	O
JPEG	O
encoding	O
usually	O
gives	O
better	O
compression	B-General_Concept
as	O
compared	O
to	O
baseline	O
sequential	O
JPEG	O
due	O
to	O
the	O
ability	O
to	O
use	O
different	O
Huffman	O
tables	O
(	O
see	O
below	O
)	O
tailored	O
for	O
different	O
frequencies	O
on	O
each	O
"	O
scan	O
"	O
or	O
"	O
pass	O
"	O
(	O
which	O
includes	O
similar-positioned	O
coefficients	O
)	O
,	O
though	O
the	O
difference	O
is	O
not	O
too	O
large	O
.	O
</s>
<s>
In	O
order	O
to	O
encode	O
the	O
above	O
generated	O
coefficient	O
pattern	O
,	O
JPEG	O
uses	O
Huffman	B-General_Concept
encoding	I-General_Concept
.	O
</s>
<s>
The	O
process	O
of	O
encoding	O
the	O
zig-zag	O
quantized	B-Algorithm
data	O
begins	O
with	O
a	O
run-length	B-Algorithm
encoding	I-Algorithm
explained	O
below	O
,	O
where	O
:	O
</s>
<s>
is	O
the	O
non-zero	O
,	O
quantized	B-Algorithm
AC	O
coefficient	O
.	O
</s>
<s>
The	O
run-length	B-Algorithm
encoding	I-Algorithm
works	O
by	O
examining	O
each	O
non-zero	O
AC	O
coefficient	O
and	O
determining	O
how	O
many	O
zeroes	O
came	O
before	O
the	O
previous	O
AC	O
coefficient	O
.	O
</s>
<s>
Both	O
RUNLENGTH	O
and	O
SIZE	O
rest	O
on	O
the	O
same	O
byte	B-Application
,	O
meaning	O
that	O
each	O
only	O
contains	O
four	O
bits	O
of	O
information	O
.	O
</s>
<s>
However	O
,	O
JPEG	O
defines	O
two	O
special	O
Huffman	B-General_Concept
code	I-General_Concept
words	O
.	O
</s>
<s>
In	O
our	O
example	O
block	O
,	O
most	O
of	O
the	O
quantized	B-Algorithm
coefficients	O
are	O
small	O
numbers	O
that	O
are	O
not	O
preceded	O
immediately	O
by	O
a	O
zero	O
coefficient	O
.	O
</s>
<s>
The	O
resulting	O
compression	B-General_Concept
ratio	O
can	O
be	O
varied	O
according	O
to	O
need	O
by	O
being	O
more	O
or	O
less	O
aggressive	O
in	O
the	O
divisors	O
used	O
in	O
the	O
quantization	B-Algorithm
phase	O
.	O
</s>
<s>
Ten	O
to	O
one	O
compression	B-General_Concept
usually	O
results	O
in	O
an	O
image	O
that	O
cannot	O
be	O
distinguished	O
by	O
eye	O
from	O
the	O
original	O
.	O
</s>
<s>
A	O
compression	B-General_Concept
ratio	O
of	O
100:1	O
is	O
usually	O
possible	O
,	O
but	O
will	O
look	O
distinctly	O
artifacted	B-Algorithm
compared	O
to	O
the	O
original	O
.	O
</s>
<s>
The	O
appropriate	O
level	O
of	O
compression	B-General_Concept
depends	O
on	O
the	O
use	O
to	O
which	O
the	O
image	O
will	O
be	O
put	O
.	O
</s>
<s>
Those	O
who	O
use	O
the	O
World	O
Wide	O
Web	O
may	O
be	O
familiar	O
with	O
the	O
irregularities	O
known	O
as	O
compression	B-Algorithm
artifacts	I-Algorithm
that	O
appear	O
in	O
JPEG	O
images	O
,	O
which	O
may	O
take	O
the	O
form	O
of	O
noise	O
around	O
contrasting	O
edges	O
(	O
especially	O
curves	O
and	O
corners	O
)	O
,	O
or	O
"	O
blocky	O
"	O
images	O
.	O
</s>
<s>
These	O
are	O
due	O
to	O
the	O
quantization	B-Algorithm
step	O
of	O
the	O
JPEG	O
algorithm	O
.	O
</s>
<s>
The	O
analogous	O
artifacts	B-Algorithm
in	O
MPEG	O
video	O
are	O
referred	O
to	O
as	O
mosquito	O
noise	O
,	O
as	O
the	O
resulting	O
"	O
edge	O
busyness	O
"	O
and	O
spurious	O
dots	O
,	O
which	O
change	O
over	O
time	O
,	O
resemble	O
mosquitoes	O
swarming	O
around	O
the	O
object	O
.	O
</s>
<s>
These	O
artifacts	B-Algorithm
can	O
be	O
reduced	O
by	O
choosing	O
a	O
lower	O
level	O
of	O
compression	B-General_Concept
;	O
they	O
may	O
be	O
completely	O
avoided	O
by	O
saving	O
an	O
image	O
using	O
a	O
lossless	B-Algorithm
file	O
format	O
,	O
though	O
this	O
will	O
result	O
in	O
a	O
larger	O
file	O
size	O
.	O
</s>
<s>
The	O
images	O
created	O
with	O
ray-tracing	B-Algorithm
programs	O
have	O
noticeable	O
blocky	O
shapes	O
on	O
the	O
terrain	O
.	O
</s>
<s>
Certain	O
low-intensity	O
compression	B-Algorithm
artifacts	I-Algorithm
might	O
be	O
acceptable	O
when	O
simply	O
viewing	O
the	O
images	O
,	O
but	O
can	O
be	O
emphasized	O
if	O
the	O
image	O
is	O
subsequently	O
processed	O
,	O
usually	O
resulting	O
in	O
unacceptable	O
quality	O
.	O
</s>
<s>
Consider	O
the	O
example	O
below	O
,	O
demonstrating	O
the	O
effect	O
of	O
lossy	B-Algorithm
compression	I-Algorithm
on	O
an	O
edge	B-Algorithm
detection	I-Algorithm
processing	O
step	O
.	O
</s>
<s>
Stronger	O
compression	B-General_Concept
is	O
applied	O
to	O
areas	O
of	O
the	O
image	O
that	O
show	O
fewer	O
artifacts	B-Algorithm
.	O
</s>
<s>
Since	O
the	O
quantization	B-Algorithm
stage	O
always	O
results	O
in	O
a	O
loss	O
of	O
information	O
,	O
JPEG	O
standard	O
is	O
always	O
a	O
lossy	B-Algorithm
compression	I-Algorithm
codec	B-General_Concept
.	O
</s>
<s>
Even	O
if	O
the	O
quantization	B-Algorithm
matrix	O
is	O
a	O
matrix	O
of	O
ones	O
,	O
information	O
will	O
still	O
be	O
lost	O
in	O
the	O
rounding	O
step	O
.	O
</s>
<s>
which	O
closely	O
resembles	O
the	O
original	O
DCT	B-General_Concept
coefficient	O
matrix	O
for	O
the	O
top-left	O
portion	O
.	O
</s>
<s>
The	O
next	O
step	O
is	O
to	O
take	O
the	O
two-dimensional	O
inverse	O
DCT	B-General_Concept
(	O
a	O
2D	O
type-III	O
DCT	B-General_Concept
)	O
,	O
which	O
is	O
given	O
by	O
:	O
</s>
<s>
The	O
required	O
implementation	O
precision	O
of	O
a	O
JPEG	O
codec	B-General_Concept
is	O
implicitly	O
defined	O
through	O
the	O
requirements	O
formulated	O
for	O
compliance	O
to	O
the	O
JPEG	O
standard	O
.	O
</s>
<s>
These	O
requirements	O
are	O
specified	O
in	O
ITU.T	O
Recommendation	O
T.83	O
|	O
ISO/IEC	O
10918-2	O
.	O
</s>
<s>
Unlike	O
MPEG	O
standards	O
and	O
many	O
later	O
JPEG	O
standards	O
,	O
the	O
above	O
document	O
defines	O
both	O
required	O
implementation	O
precisions	O
for	O
the	O
encoding	O
and	O
the	O
decoding	O
process	O
of	O
a	O
JPEG	O
codec	B-General_Concept
by	O
means	O
of	O
a	O
maximal	O
tolerable	O
error	O
of	O
the	O
forwards	O
and	O
inverse	O
DCT	B-General_Concept
in	O
the	O
DCT	B-General_Concept
domain	O
as	O
determined	O
by	O
reference	O
test	O
streams	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
output	O
of	O
a	O
decoder	O
implementation	O
must	O
not	O
exceed	O
an	O
error	O
of	O
one	O
quantization	B-Algorithm
unit	O
in	O
the	O
DCT	B-General_Concept
domain	O
when	O
applied	O
to	O
the	O
reference	O
testing	O
codestreams	O
provided	O
as	O
part	O
of	O
the	O
above	O
standard	O
.	O
</s>
<s>
While	O
unusual	O
,	O
and	O
unlike	O
many	O
other	O
and	O
more	O
modern	O
standards	O
,	O
ITU.T	O
T.83	O
|	O
ISO/IEC	O
10918-2	O
does	O
not	O
formulate	O
error	O
bounds	O
in	O
the	O
image	O
domain	O
.	O
</s>
<s>
JPEG	B-Algorithm
compression	I-Algorithm
artifacts	I-Algorithm
blend	O
well	O
into	O
photographs	O
with	O
detailed	O
non-uniform	O
textures	O
,	O
allowing	O
higher	O
compression	B-General_Concept
ratios	O
.	O
</s>
<s>
Notice	O
how	O
a	O
higher	O
compression	B-General_Concept
ratio	O
first	O
affects	O
the	O
high-frequency	O
textures	O
in	O
the	O
upper-left	O
corner	O
of	O
the	O
image	O
,	O
and	O
how	O
the	O
contrasting	O
lines	O
become	O
more	O
fuzzy	O
.	O
</s>
<s>
The	O
very	O
high	O
compression	B-General_Concept
ratio	O
severely	O
affects	O
the	O
quality	O
of	O
the	O
image	O
,	O
although	O
the	O
overall	O
colors	O
and	O
image	O
form	O
are	O
still	O
recognizable	O
.	O
</s>
<s>
This	O
justifies	O
the	O
fact	O
that	O
images	O
should	O
be	O
first	O
transformed	O
in	O
a	O
color	O
model	O
separating	O
the	O
luminance	O
from	O
the	O
chromatic	O
information	O
,	O
before	O
subsampling	O
the	O
chromatic	O
planes	O
(	O
which	O
may	O
also	O
use	O
lower	O
quality	O
quantization	B-Algorithm
)	O
in	O
order	O
to	O
preserve	O
the	O
precision	O
of	O
the	O
luminance	O
plane	O
with	O
more	O
information	O
bits	O
.	O
</s>
<s>
For	O
information	O
,	O
the	O
uncompressed	O
24-bit	O
RGB	O
bitmap	O
image	O
below	O
(	O
73,242	O
pixels	O
)	O
would	O
require	O
219,726	O
bytes	B-Application
(	O
excluding	O
all	O
other	O
information	O
headers	O
)	O
.	O
</s>
<s>
A	O
method	O
for	O
creating	O
better	O
quantization	B-Algorithm
matrices	O
for	O
a	O
given	O
image	B-Algorithm
quality	I-Algorithm
using	O
PSNR	O
instead	O
of	O
the	O
Q	O
factor	O
is	O
described	O
in	O
Minguillón	O
&	O
Pujol	O
(	O
2001	O
)	O
.	O
</s>
<s>
Size	O
(	O
bytes	B-Application
)	O
!	O
</s>
<s>
Compression	B-General_Concept
ratio	O
!	O
</s>
<s>
The	O
medium	O
quality	O
photo	O
uses	O
only	O
4.3	O
%	O
of	O
the	O
storage	O
space	O
required	O
for	O
the	O
uncompressed	O
image	O
,	O
but	O
has	O
little	O
noticeable	O
loss	O
of	O
detail	O
or	O
visible	O
artifacts	B-Algorithm
.	O
</s>
<s>
However	O
,	O
once	O
a	O
certain	O
threshold	O
of	O
compression	B-General_Concept
is	O
passed	O
,	O
compressed	B-General_Concept
images	I-General_Concept
show	O
increasingly	O
visible	O
defects	O
.	O
</s>
<s>
See	O
the	O
article	O
on	O
rate	B-General_Concept
–	I-General_Concept
distortion	I-General_Concept
theory	I-General_Concept
for	O
a	O
mathematical	O
explanation	O
of	O
this	O
threshold	O
effect	O
.	O
</s>
<s>
More	O
modern	O
designs	O
such	O
as	O
JPEG	O
2000	O
and	O
JPEG	B-Device
XR	I-Device
exhibit	O
a	O
more	O
graceful	O
degradation	O
of	O
quality	O
as	O
the	O
bit	O
usage	O
decreases	O
–	O
by	O
using	O
transforms	O
with	O
a	O
larger	O
spatial	O
extent	O
for	O
the	O
lower	O
frequency	O
coefficients	O
and	O
by	O
using	O
overlapping	O
transform	O
basis	O
functions	O
.	O
</s>
<s>
Standard	O
general-purpose	O
compression	B-General_Concept
tools	O
cannot	O
significantly	O
compress	O
JPEG	O
files	O
.	O
</s>
<s>
Typically	O
,	O
such	O
schemes	O
take	O
advantage	O
of	O
improvements	O
to	O
the	O
naive	O
scheme	O
for	O
coding	O
DCT	B-General_Concept
coefficients	O
,	O
which	O
fails	O
to	O
take	O
into	O
account	O
:	O
</s>
<s>
Well-known	O
schemes	O
for	O
lossless	B-Algorithm
coding	O
of	O
continuous-tone	O
images	O
can	O
be	O
applied	O
,	O
achieving	O
somewhat	O
better	O
compression	B-General_Concept
than	O
the	O
Huffman	O
coded	O
DPCM	B-General_Concept
used	O
in	O
JPEG	O
.	O
</s>
<s>
Some	O
standard	O
but	O
rarely	O
used	O
options	O
already	O
exist	O
in	O
JPEG	O
to	O
improve	O
the	O
efficiency	O
of	O
coding	O
DCT	B-General_Concept
coefficients	O
:	O
the	O
arithmetic	B-Algorithm
coding	I-Algorithm
option	O
,	O
and	O
the	O
progressive	O
coding	O
option	O
(	O
which	O
produces	O
lower	O
bitrates	O
because	O
values	O
for	O
each	O
coefficient	O
are	O
coded	O
independently	O
,	O
and	O
each	O
coefficient	O
has	O
a	O
significantly	O
different	O
distribution	O
)	O
.	O
</s>
<s>
Modern	O
methods	O
have	O
improved	O
on	O
these	O
techniques	O
by	O
reordering	O
coefficients	O
to	O
group	O
coefficients	O
of	O
larger	O
magnitude	O
together	O
;	O
using	O
adjacent	O
coefficients	O
and	O
blocks	O
to	O
predict	O
new	O
coefficient	O
values	O
;	O
dividing	O
blocks	O
or	O
coefficients	O
up	O
among	O
a	O
small	O
number	O
of	O
independently	O
coded	O
models	O
based	O
on	O
their	O
statistics	O
and	O
adjacent	O
values	O
;	O
and	O
most	O
recently	O
,	O
by	O
decoding	O
blocks	O
,	O
predicting	O
subsequent	O
blocks	O
in	O
the	O
spatial	O
domain	O
,	O
and	O
then	O
encoding	O
these	O
to	O
generate	O
predictions	O
for	O
DCT	B-General_Concept
coefficients	O
.	O
</s>
<s>
JPEG	O
XL	O
(	O
ISO/IEC	O
18181	O
)	O
of	O
2018	O
reports	O
a	O
similar	O
reduction	O
in	O
its	O
transcoding	O
.	O
</s>
<s>
JPS	O
is	O
a	O
stereoscopic	B-Algorithm
JPEG	O
image	O
used	O
for	O
creating	O
3D	O
effects	O
from	O
2D	O
images	O
.	O
</s>
<s>
JPEG	O
Stereoscopic	B-Algorithm
(	O
JPS	O
,	O
extension	O
.jps	O
)	O
is	O
a	O
JPEG-based	O
format	O
for	O
stereoscopic	B-Algorithm
images	I-Algorithm
.	O
</s>
<s>
JPEG	O
Multi-Picture	B-Algorithm
Format	I-Algorithm
(	O
MPO	O
,	O
extension	O
.mpo	O
)	O
is	O
a	O
JPEG-based	O
format	O
for	O
storing	O
multiple	O
images	O
in	O
a	O
single	O
file	O
.	O
</s>
<s>
Various	O
devices	O
use	O
it	O
to	O
store	O
3D	B-Algorithm
images	I-Algorithm
,	O
such	O
as	O
Fujifilm	B-Algorithm
FinePix	I-Algorithm
Real	I-Algorithm
3D	I-Algorithm
W1	I-Algorithm
,	O
HTC	B-Application
Evo	I-Application
3D	I-Application
,	O
JVC	O
GY-HMZ1U	O
AVCHD/MVC	O
extension	O
camcorder	O
,	O
Nintendo	B-Operating_System
3DS	I-Operating_System
,	O
Panasonic	B-Algorithm
Lumix	I-Algorithm
DMC-TZ20	I-Algorithm
,	O
DMC-TZ30	B-Algorithm
,	O
DMC-TZ60	B-Algorithm
,	O
DMC-TS4	O
(	O
FT4	O
)	O
,	O
and	O
Sony	O
DSC-HX7V	O
.	O
</s>
<s>
In	O
the	O
last	O
few	O
years	O
,	O
due	O
to	O
the	O
growing	O
use	O
of	O
stereoscopic	B-Algorithm
images	I-Algorithm
,	O
much	O
effort	O
has	O
been	O
spent	O
by	O
the	O
scientific	O
community	O
to	O
develop	O
algorithms	O
for	O
stereoscopic	B-Algorithm
image	I-Algorithm
compression	B-General_Concept
.	O
</s>
<s>
A	O
very	O
important	O
implementation	O
of	O
a	O
JPEG	O
codec	B-General_Concept
is	O
the	O
free	O
programming	O
library	O
libjpeg	B-Language
of	O
the	O
Independent	B-Language
JPEG	I-Language
Group	I-Language
.	O
</s>
<s>
The	O
development	O
went	O
quiet	O
in	O
1998	O
;	O
when	O
libjpeg	B-Language
resurfaced	O
with	O
the	O
2009	O
version	O
7	O
,	O
it	O
broke	O
ABI	B-Operating_System
compatibility	I-Operating_System
with	O
previous	O
versions	O
.	O
</s>
<s>
libjpeg-turbo	O
,	O
forked	O
from	O
the	O
1998	O
libjpeg	B-Language
6b	O
,	O
improves	O
on	O
libjpeg	B-Language
with	O
SIMD	B-Device
optimizations	O
.	O
</s>
<s>
Originally	O
seen	O
as	O
a	O
maintained	O
fork	O
of	O
libjpeg	B-Language
,	O
it	O
has	O
become	O
more	O
popular	O
after	O
the	O
incompatible	O
changes	O
of	O
2009	O
.	O
</s>
<s>
In	O
2019	O
,	O
it	O
became	O
the	O
ITU|	O
ISO/IEC	O
reference	O
implementation	O
as	O
ISO/IEC	O
10918-7	O
and	O
ITU-T	O
T.873	O
.	O
</s>
<s>
ISO/IEC	O
Joint	O
Photography	O
Experts	O
Group	O
maintains	O
the	O
other	O
reference	O
software	O
implementation	O
under	O
the	O
JPEG	O
XT	O
heading	O
.	O
</s>
<s>
It	O
can	O
encode	O
both	O
base	O
JPEG	O
(	O
ISO/IEC	O
10918-1	O
and	O
18477	O
–	O
1	O
)	O
and	O
JPEG	O
XT	O
extensions	O
(	O
ISO/IEC	O
18477	O
Parts	O
2	O
and	O
6	O
–	O
9	O
)	O
,	O
as	O
well	O
as	O
JPEG-LS	O
(	O
ISO/IEC	O
14495	O
)	O
.	O
</s>
<s>
There	O
is	O
persistent	O
interest	O
in	O
encoding	O
JPEG	O
in	O
unconventional	O
ways	O
that	O
maximize	O
image	B-Algorithm
quality	I-Algorithm
for	O
a	O
given	O
file	O
size	O
.	O
</s>
<s>
In	O
2014	O
,	O
Mozilla	B-Operating_System
created	O
mozjpeg	O
from	O
libjpeg-turbo	O
,	O
a	O
slower	O
but	O
higher-quality	O
encoder	O
intended	O
for	O
web	O
images	O
.	O
</s>
<s>
In	O
2016	O
,	O
"	O
JPEG	O
on	O
steroids	O
"	O
was	O
introduced	O
as	O
an	O
option	O
for	O
the	O
ISO	B-General_Concept
JPEG	O
XT	O
reference	O
implementation	O
.	O
</s>
<s>
In	O
March	O
2017	O
,	O
Google	O
released	O
the	O
open	O
source	O
project	O
Guetzli	B-Language
,	O
which	O
trades	O
off	O
a	O
much	O
longer	O
encoding	O
time	O
for	O
smaller	O
file	O
size	O
(	O
similar	O
to	O
what	O
Zopfli	B-Application
does	O
for	O
PNG	O
and	O
other	O
lossless	B-Algorithm
data	O
formats	O
)	O
.	O
</s>
<s>
JPEG	O
XT	O
(	O
ISO/IEC	O
18477	O
)	O
was	O
published	O
in	O
June	O
2015	O
;	O
it	O
extends	O
base	O
JPEG	O
format	O
with	O
support	O
for	O
higher	O
integer	O
bit	O
depths	O
(	O
up	O
to	O
16	O
bit	O
)	O
,	O
high	B-General_Concept
dynamic	I-General_Concept
range	I-General_Concept
imaging	O
and	O
floating-point	O
coding	O
,	O
lossless	B-Algorithm
coding	O
,	O
and	O
alpha	O
channel	B-Algorithm
coding	O
.	O
</s>
<s>
Extensions	O
are	O
backward	O
compatible	O
with	O
the	O
base	O
JPEG/JFIF	O
file	O
format	O
and	O
8-bit	O
lossy	B-Algorithm
compressed	B-General_Concept
image	I-General_Concept
.	O
</s>
<s>
JPEG	O
XL	O
(	O
ISO/IEC	O
18181	O
)	O
was	O
published	O
in	O
20212022	O
.	O
</s>
<s>
It	O
replaces	O
the	O
JPEG	O
format	O
with	O
a	O
new	O
DCT-based	O
royalty-free	O
format	O
and	O
allows	O
efficient	O
transcoding	O
as	O
a	O
storage	O
option	O
for	O
traditional	O
JPEG	O
images	O
.	O
</s>
<s>
The	O
new	O
format	O
is	O
designed	O
to	O
exceed	O
the	O
still	O
image	B-General_Concept
compression	I-General_Concept
performance	O
shown	O
by	O
HEVC	B-Algorithm
HM	O
,	O
Daala	B-Application
and	O
WebP	O
.	O
</s>
<s>
It	O
supports	O
billion-by-billion	O
pixel	O
images	O
,	O
up	O
to	O
32-bit-per-component	O
high	B-General_Concept
dynamic	I-General_Concept
range	I-General_Concept
with	O
the	O
appropriate	O
transfer	O
functions	O
(	O
PQ	B-Algorithm
and	O
HLG	O
)	O
,	O
patch	O
encoding	O
of	O
synthetic	O
images	O
such	O
as	O
bitmap	O
fonts	O
and	O
gradients	O
,	O
animated	O
images	O
,	O
alpha	O
channel	B-Algorithm
coding	O
,	O
and	O
a	O
choice	O
of	O
RGB/YCbCr/ICtCp	O
color	O
encoding	O
.	O
</s>
