Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
86eb2eaa
Commit
86eb2eaa
authored
Dec 01, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mjpegenc: do not pass MpegEncContext to ff_mjpeg_encode_dc()
This will allow deMpegEncContextizing the LJPEG encoder.
parent
3360ad99
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
ljpegenc.c
libavcodec/ljpegenc.c
+8
-8
mjpegenc.c
libavcodec/mjpegenc.c
+6
-6
mjpegenc.h
libavcodec/mjpegenc.h
+1
-1
No files found.
libavcodec/ljpegenc.c
View file @
86eb2eaa
...
@@ -115,9 +115,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -115,9 +115,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
diff
=
((
left
[
i
]
-
pred
+
0x100
)
&
0x1FF
)
-
0x100
;
diff
=
((
left
[
i
]
-
pred
+
0x100
)
&
0x1FF
)
-
0x100
;
if
(
i
==
0
)
if
(
i
==
0
)
ff_mjpeg_encode_dc
(
s
,
diff
,
m
->
huff_size_dc_luminance
,
m
->
huff_code_dc_luminance
);
//FIXME ugly
ff_mjpeg_encode_dc
(
&
s
->
pb
,
diff
,
m
->
huff_size_dc_luminance
,
m
->
huff_code_dc_luminance
);
//FIXME ugly
else
else
ff_mjpeg_encode_dc
(
s
,
diff
,
m
->
huff_size_dc_chrominance
,
m
->
huff_code_dc_chrominance
);
ff_mjpeg_encode_dc
(
&
s
->
pb
,
diff
,
m
->
huff_size_dc_chrominance
,
m
->
huff_code_dc_chrominance
);
}
}
}
}
}
}
...
@@ -158,9 +158,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -158,9 +158,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
}
}
if
(
i
==
0
)
if
(
i
==
0
)
ff_mjpeg_encode_dc
(
s
,
*
ptr
-
pred
,
m
->
huff_size_dc_luminance
,
m
->
huff_code_dc_luminance
);
//FIXME ugly
ff_mjpeg_encode_dc
(
&
s
->
pb
,
*
ptr
-
pred
,
m
->
huff_size_dc_luminance
,
m
->
huff_code_dc_luminance
);
//FIXME ugly
else
else
ff_mjpeg_encode_dc
(
s
,
*
ptr
-
pred
,
m
->
huff_size_dc_chrominance
,
m
->
huff_code_dc_chrominance
);
ff_mjpeg_encode_dc
(
&
s
->
pb
,
*
ptr
-
pred
,
m
->
huff_size_dc_chrominance
,
m
->
huff_code_dc_chrominance
);
}
}
}
}
}
}
...
@@ -170,19 +170,19 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -170,19 +170,19 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
int
x
,
y
,
h
,
v
,
linesize
;
int
x
,
y
,
h
,
v
,
linesize
;
h
=
s
->
mjpeg_hsample
[
i
];
h
=
s
->
mjpeg_hsample
[
i
];
v
=
s
->
mjpeg_vsample
[
i
];
v
=
s
->
mjpeg_vsample
[
i
];
linesize
=
p
->
linesize
[
i
];
linesize
=
pict
->
linesize
[
i
];
for
(
y
=
0
;
y
<
v
;
y
++
){
for
(
y
=
0
;
y
<
v
;
y
++
){
for
(
x
=
0
;
x
<
h
;
x
++
){
for
(
x
=
0
;
x
<
h
;
x
++
){
int
pred
;
int
pred
;
ptr
=
p
->
data
[
i
]
+
(
linesize
*
(
v
*
mb_y
+
y
))
+
(
h
*
mb_x
+
x
);
//FIXME optimize this crap
ptr
=
p
ict
->
data
[
i
]
+
(
linesize
*
(
v
*
mb_y
+
y
))
+
(
h
*
mb_x
+
x
);
//FIXME optimize this crap
PREDICT
(
pred
,
ptr
[
-
linesize
-
1
],
ptr
[
-
linesize
],
ptr
[
-
1
],
predictor
);
PREDICT
(
pred
,
ptr
[
-
linesize
-
1
],
ptr
[
-
linesize
],
ptr
[
-
1
],
predictor
);
if
(
i
==
0
)
if
(
i
==
0
)
ff_mjpeg_encode_dc
(
s
,
*
ptr
-
pred
,
m
->
huff_size_dc_luminance
,
m
->
huff_code_dc_luminance
);
//FIXME ugly
ff_mjpeg_encode_dc
(
&
s
->
pb
,
*
ptr
-
pred
,
m
->
huff_size_dc_luminance
,
m
->
huff_code_dc_luminance
);
//FIXME ugly
else
else
ff_mjpeg_encode_dc
(
s
,
*
ptr
-
pred
,
m
->
huff_size_dc_chrominance
,
m
->
huff_code_dc_chrominance
);
ff_mjpeg_encode_dc
(
&
s
->
pb
,
*
ptr
-
pred
,
m
->
huff_size_dc_chrominance
,
m
->
huff_code_dc_chrominance
);
}
}
}
}
}
}
...
...
libavcodec/mjpegenc.c
View file @
86eb2eaa
...
@@ -340,13 +340,13 @@ void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
...
@@ -340,13 +340,13 @@ void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
put_marker
(
pb
,
EOI
);
put_marker
(
pb
,
EOI
);
}
}
void
ff_mjpeg_encode_dc
(
MpegEncContext
*
s
,
int
val
,
void
ff_mjpeg_encode_dc
(
PutBitContext
*
pb
,
int
val
,
uint8_t
*
huff_size
,
uint16_t
*
huff_code
)
uint8_t
*
huff_size
,
uint16_t
*
huff_code
)
{
{
int
mant
,
nbits
;
int
mant
,
nbits
;
if
(
val
==
0
)
{
if
(
val
==
0
)
{
put_bits
(
&
s
->
pb
,
huff_size
[
0
],
huff_code
[
0
]);
put_bits
(
pb
,
huff_size
[
0
],
huff_code
[
0
]);
}
else
{
}
else
{
mant
=
val
;
mant
=
val
;
if
(
val
<
0
)
{
if
(
val
<
0
)
{
...
@@ -356,9 +356,9 @@ void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
...
@@ -356,9 +356,9 @@ void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
nbits
=
av_log2_16bit
(
val
)
+
1
;
nbits
=
av_log2_16bit
(
val
)
+
1
;
put_bits
(
&
s
->
pb
,
huff_size
[
nbits
],
huff_code
[
nbits
]);
put_bits
(
pb
,
huff_size
[
nbits
],
huff_code
[
nbits
]);
put_sbits
(
&
s
->
pb
,
nbits
,
mant
);
put_sbits
(
pb
,
nbits
,
mant
);
}
}
}
}
...
@@ -375,11 +375,11 @@ static void encode_block(MpegEncContext *s, int16_t *block, int n)
...
@@ -375,11 +375,11 @@ static void encode_block(MpegEncContext *s, int16_t *block, int n)
dc
=
block
[
0
];
/* overflow is impossible */
dc
=
block
[
0
];
/* overflow is impossible */
val
=
dc
-
s
->
last_dc
[
component
];
val
=
dc
-
s
->
last_dc
[
component
];
if
(
n
<
4
)
{
if
(
n
<
4
)
{
ff_mjpeg_encode_dc
(
s
,
val
,
m
->
huff_size_dc_luminance
,
m
->
huff_code_dc_luminance
);
ff_mjpeg_encode_dc
(
&
s
->
pb
,
val
,
m
->
huff_size_dc_luminance
,
m
->
huff_code_dc_luminance
);
huff_size_ac
=
m
->
huff_size_ac_luminance
;
huff_size_ac
=
m
->
huff_size_ac_luminance
;
huff_code_ac
=
m
->
huff_code_ac_luminance
;
huff_code_ac
=
m
->
huff_code_ac_luminance
;
}
else
{
}
else
{
ff_mjpeg_encode_dc
(
s
,
val
,
m
->
huff_size_dc_chrominance
,
m
->
huff_code_dc_chrominance
);
ff_mjpeg_encode_dc
(
&
s
->
pb
,
val
,
m
->
huff_size_dc_chrominance
,
m
->
huff_code_dc_chrominance
);
huff_size_ac
=
m
->
huff_size_ac_chrominance
;
huff_size_ac
=
m
->
huff_size_ac_chrominance
;
huff_code_ac
=
m
->
huff_code_ac_chrominance
;
huff_code_ac
=
m
->
huff_code_ac_chrominance
;
}
}
...
...
libavcodec/mjpegenc.h
View file @
86eb2eaa
...
@@ -56,7 +56,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
...
@@ -56,7 +56,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
uint16_t
intra_matrix
[
64
]);
uint16_t
intra_matrix
[
64
]);
void
ff_mjpeg_encode_picture_trailer
(
PutBitContext
*
pb
,
int
header_bits
);
void
ff_mjpeg_encode_picture_trailer
(
PutBitContext
*
pb
,
int
header_bits
);
void
ff_mjpeg_encode_stuffing
(
PutBitContext
*
pbc
);
void
ff_mjpeg_encode_stuffing
(
PutBitContext
*
pbc
);
void
ff_mjpeg_encode_dc
(
MpegEncContext
*
s
,
int
val
,
void
ff_mjpeg_encode_dc
(
PutBitContext
*
pb
,
int
val
,
uint8_t
*
huff_size
,
uint16_t
*
huff_code
);
uint8_t
*
huff_size
,
uint16_t
*
huff_code
);
void
ff_mjpeg_encode_mb
(
MpegEncContext
*
s
,
int16_t
block
[
6
][
64
]);
void
ff_mjpeg_encode_mb
(
MpegEncContext
*
s
,
int16_t
block
[
6
][
64
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment