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
dd4f8a04
Commit
dd4f8a04
authored
Jan 20, 2005
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jpeg style yuv fixes
Originally committed as revision 3852 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
827c91bf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
22 deletions
+54
-22
mjpeg.c
libavcodec/mjpeg.c
+21
-4
mpegvideo.c
libavcodec/mpegvideo.c
+17
-2
ffmpeg.regression.ref
tests/ffmpeg.regression.ref
+6
-6
libav.regression.ref
tests/libav.regression.ref
+1
-1
regression.sh
tests/regression.sh
+3
-3
rotozoom.regression.ref
tests/rotozoom.regression.ref
+6
-6
No files found.
libavcodec/mjpeg.c
View file @
dd4f8a04
...
@@ -400,6 +400,19 @@ static void jpeg_put_comments(MpegEncContext *s)
...
@@ -400,6 +400,19 @@ static void jpeg_put_comments(MpegEncContext *s)
ptr
[
0
]
=
size
>>
8
;
ptr
[
0
]
=
size
>>
8
;
ptr
[
1
]
=
size
;
ptr
[
1
]
=
size
;
}
}
if
(
s
->
avctx
->
pix_fmt
==
PIX_FMT_YUV420P
||
s
->
avctx
->
pix_fmt
==
PIX_FMT_YUV422P
||
s
->
avctx
->
pix_fmt
==
PIX_FMT_YUV444P
){
put_marker
(
p
,
COM
);
flush_put_bits
(
p
);
ptr
=
pbBufPtr
(
p
);
put_bits
(
p
,
16
,
0
);
/* patched later */
put_string
(
p
,
"CS=ITU601"
,
1
);
size
=
strlen
(
"CS=ITU601"
)
+
3
;
ptr
[
0
]
=
size
>>
8
;
ptr
[
1
]
=
size
;
}
}
}
void
mjpeg_picture_header
(
MpegEncContext
*
s
)
void
mjpeg_picture_header
(
MpegEncContext
*
s
)
...
@@ -845,6 +858,7 @@ typedef struct MJpegDecodeContext {
...
@@ -845,6 +858,7 @@ typedef struct MJpegDecodeContext {
int
restart_count
;
int
restart_count
;
int
buggy_avid
;
int
buggy_avid
;
int
cs_itu601
;
int
interlace_polarity
;
int
interlace_polarity
;
int
mjpb_skiptosod
;
int
mjpb_skiptosod
;
...
@@ -1133,16 +1147,16 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
...
@@ -1133,16 +1147,16 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s)
if
(
s
->
rgb
){
if
(
s
->
rgb
){
s
->
avctx
->
pix_fmt
=
PIX_FMT_RGBA32
;
s
->
avctx
->
pix_fmt
=
PIX_FMT_RGBA32
;
}
else
if
(
s
->
nb_components
==
3
)
}
else
if
(
s
->
nb_components
==
3
)
s
->
avctx
->
pix_fmt
=
PIX_FMT_YUV
444P
;
s
->
avctx
->
pix_fmt
=
s
->
cs_itu601
?
PIX_FMT_YUV444P
:
PIX_FMT_YUVJ
444P
;
else
else
s
->
avctx
->
pix_fmt
=
PIX_FMT_GRAY8
;
s
->
avctx
->
pix_fmt
=
PIX_FMT_GRAY8
;
break
;
break
;
case
0x21
:
case
0x21
:
s
->
avctx
->
pix_fmt
=
PIX_FMT_YUV
422P
;
s
->
avctx
->
pix_fmt
=
s
->
cs_itu601
?
PIX_FMT_YUV422P
:
PIX_FMT_YUVJ
422P
;
break
;
break
;
default
:
default
:
case
0x22
:
case
0x22
:
s
->
avctx
->
pix_fmt
=
PIX_FMT_YUV
420P
;
s
->
avctx
->
pix_fmt
=
s
->
cs_itu601
?
PIX_FMT_YUV420P
:
PIX_FMT_YUVJ
420P
;
break
;
break
;
}
}
...
@@ -1737,6 +1751,9 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
...
@@ -1737,6 +1751,9 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
// if (s->first_picture)
// if (s->first_picture)
// printf("mjpeg: workarounding buggy AVID\n");
// printf("mjpeg: workarounding buggy AVID\n");
}
}
else
if
(
!
strcmp
(
cbuf
,
"CS=ITU601"
)){
s
->
cs_itu601
=
1
;
}
av_free
(
cbuf
);
av_free
(
cbuf
);
}
}
...
@@ -2172,7 +2189,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
...
@@ -2172,7 +2189,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
s
->
v_max
=
2
;
s
->
v_max
=
2
;
s
->
qscale_table
=
av_mallocz
((
s
->
width
+
15
)
/
16
);
s
->
qscale_table
=
av_mallocz
((
s
->
width
+
15
)
/
16
);
avctx
->
pix_fmt
=
PIX_FMT_YUV420P
;
avctx
->
pix_fmt
=
s
->
cs_itu601
?
PIX_FMT_YUV420P
:
PIX_FMT_YUVJ420
;
s
->
interlaced
=
0
;
s
->
interlaced
=
0
;
s
->
picture
.
reference
=
0
;
s
->
picture
.
reference
=
0
;
...
...
libavcodec/mpegvideo.c
View file @
dd4f8a04
...
@@ -892,7 +892,22 @@ int MPV_encode_init(AVCodecContext *avctx)
...
@@ -892,7 +892,22 @@ int MPV_encode_init(AVCodecContext *avctx)
MPV_encode_defaults
(
s
);
MPV_encode_defaults
(
s
);
avctx
->
pix_fmt
=
PIX_FMT_YUV420P
;
// FIXME
if
(
avctx
->
pix_fmt
!=
PIX_FMT_YUVJ420P
&&
avctx
->
pix_fmt
!=
PIX_FMT_YUV420P
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"only YUV420 is supported
\n
"
);
return
-
1
;
}
if
(
avctx
->
codec_id
==
CODEC_ID_MJPEG
||
avctx
->
codec_id
==
CODEC_ID_LJPEG
){
if
(
avctx
->
strict_std_compliance
>=
0
&&
avctx
->
pix_fmt
!=
PIX_FMT_YUVJ420P
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"colorspace not supported in jpeg
\n
"
);
return
-
1
;
}
}
else
{
if
(
avctx
->
strict_std_compliance
>=
0
&&
avctx
->
pix_fmt
!=
PIX_FMT_YUV420P
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"colorspace not supported
\n
"
);
return
-
1
;
}
}
s
->
bit_rate
=
avctx
->
bit_rate
;
s
->
bit_rate
=
avctx
->
bit_rate
;
s
->
width
=
avctx
->
width
;
s
->
width
=
avctx
->
width
;
...
@@ -2259,7 +2274,7 @@ int MPV_encode_picture(AVCodecContext *avctx,
...
@@ -2259,7 +2274,7 @@ int MPV_encode_picture(AVCodecContext *avctx,
AVFrame
*
pic_arg
=
data
;
AVFrame
*
pic_arg
=
data
;
int
i
,
stuffing_count
;
int
i
,
stuffing_count
;
if
(
avctx
->
pix_fmt
!=
PIX_FMT_YUV420P
){
if
(
avctx
->
pix_fmt
!=
PIX_FMT_YUV420P
&&
avctx
->
pix_fmt
!=
PIX_FMT_YUVJ420P
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"this codec supports only YUV420P
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"this codec supports only YUV420P
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
...
tests/ffmpeg.regression.ref
View file @
dd4f8a04
...
@@ -87,12 +87,12 @@ stddev: 7.03 PSNR:31.18 bytes:7602176
...
@@ -87,12 +87,12 @@ stddev: 7.03 PSNR:31.18 bytes:7602176
1037657 ./data/a-mpeg1b.mpg
1037657 ./data/a-mpeg1b.mpg
09a77de112e144c562bc1398b111b61b *./data/out.yuv
09a77de112e144c562bc1398b111b61b *./data/out.yuv
stddev: 6.35 PSNR:32.06 bytes:7602176
stddev: 6.35 PSNR:32.06 bytes:7602176
07042f42b3119c39eb26537a84a451df
*./data/a-mjpeg.avi
8e69394fdcb19995dfe5cb8c562d9441
*./data/a-mjpeg.avi
1
437768
./data/a-mjpeg.avi
1
566544
./data/a-mjpeg.avi
f23a9e50a559e174766ee808c48fea22
*./data/out.yuv
18c3a76f984e717dd886d21fa04355f6
*./data/out.yuv
stddev:
8.87 PSNR:29.15
bytes:7602176
stddev:
7.93 PSNR:30.13
bytes:7602176
1d565db4a3a054261af95f2483a37cd6
*./data/a-ljpeg.avi
a534c6fc190682842efc0defda2cd442
*./data/a-ljpeg.avi
626
27
62 ./data/a-ljpeg.avi
626
34
62 ./data/a-ljpeg.avi
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
stddev: 0.00 PSNR:99.99 bytes:7602176
49c87af74432890cadb28b93da1c653d *./data/a-rv10.rm
49c87af74432890cadb28b93da1c653d *./data/a-rv10.rm
...
...
tests/libav.regression.ref
View file @
dd4f8a04
...
@@ -43,7 +43,7 @@ b977a4fedff90a79baf70c8e02986820 *./data/b-libav.yuv4mpeg
...
@@ -43,7 +43,7 @@ b977a4fedff90a79baf70c8e02986820 *./data/b-libav.yuv4mpeg
3801810 ./data/b-libav.yuv4mpeg
3801810 ./data/b-libav.yuv4mpeg
./data/b-libav%d.pgm CRC=84c09106
./data/b-libav%d.pgm CRC=84c09106
./data/b-libav%d.ppm CRC=25c06ecf
./data/b-libav%d.ppm CRC=25c06ecf
./data/b-libav%d.jpg CRC=
afa6eff5
./data/b-libav%d.jpg CRC=
62328baa
b0a8c8063d81921db5d7c8f50a1cc454 *./data/b-libav.wav
b0a8c8063d81921db5d7c8f50a1cc454 *./data/b-libav.wav
89132 ./data/b-libav.wav
89132 ./data/b-libav.wav
./data/b-libav.wav CRC=2a09519c
./data/b-libav.wav CRC=2a09519c
...
...
tests/regression.sh
View file @
dd4f8a04
...
@@ -360,7 +360,7 @@ fi
...
@@ -360,7 +360,7 @@ fi
if
[
-n
"
$do_mjpeg
"
]
;
then
if
[
-n
"
$do_mjpeg
"
]
;
then
# mjpeg
# mjpeg
file
=
${
outfile
}
mjpeg.avi
file
=
${
outfile
}
mjpeg.avi
do_ffmpeg
$file
-y
-qscale
10
-f
pgmyuv
-i
$raw_src
-an
-vcodec
mjpeg
$file
do_ffmpeg
$file
-y
-qscale
10
-f
pgmyuv
-i
$raw_src
-an
-vcodec
mjpeg
-pix_fmt
yuvj420p
$file
# mjpeg decoding
# mjpeg decoding
do_ffmpeg
$raw_dst
-y
-i
$file
-f
rawvideo
$raw_dst
do_ffmpeg
$raw_dst
-y
-i
$file
-f
rawvideo
$raw_dst
...
@@ -370,7 +370,7 @@ fi
...
@@ -370,7 +370,7 @@ fi
if
[
-n
"
$do_ljpeg
"
]
;
then
if
[
-n
"
$do_ljpeg
"
]
;
then
# ljpeg
# ljpeg
file
=
${
outfile
}
ljpeg.avi
file
=
${
outfile
}
ljpeg.avi
do_ffmpeg
$file
-y
-f
pgmyuv
-i
$raw_src
-an
-vcodec
ljpeg
$file
do_ffmpeg
$file
-y
-f
pgmyuv
-i
$raw_src
-an
-vcodec
ljpeg
-strict
-1
$file
# ljpeg decoding
# ljpeg decoding
do_ffmpeg
$raw_dst
-y
-i
$file
-f
rawvideo
$raw_dst
do_ffmpeg
$raw_dst
-y
-i
$file
-f
rawvideo
$raw_dst
...
@@ -601,7 +601,7 @@ do_ffmpeg_crc $file -i $file
...
@@ -601,7 +601,7 @@ do_ffmpeg_crc $file -i $file
# jpeg (we do not do md5 on image files yet)
# jpeg (we do not do md5 on image files yet)
file
=
${
outfile
}
libav%d.jpg
file
=
${
outfile
}
libav%d.jpg
$ffmpeg
-t
0.5
-y
-qscale
10
-f
pgmyuv
-i
$raw_src
-bitexact
-dct_algo
1
-idct_algo
2
-f
image2
$file
$ffmpeg
-t
0.5
-y
-qscale
10
-f
pgmyuv
-i
$raw_src
-bitexact
-dct_algo
1
-idct_algo
2
-
pix_fmt
yuvj420p
-
f
image2
$file
do_ffmpeg_crc
$file
-f
image2
-i
$file
do_ffmpeg_crc
$file
-f
image2
-i
$file
####################
####################
...
...
tests/rotozoom.regression.ref
View file @
dd4f8a04
...
@@ -87,12 +87,12 @@ stddev: 4.73 PSNR:34.61 bytes:7602176
...
@@ -87,12 +87,12 @@ stddev: 4.73 PSNR:34.61 bytes:7602176
231306 ./data/a-mpeg1b.mpg
231306 ./data/a-mpeg1b.mpg
c665bd56f8e241f8bf3a5a8f803227c3 *./data/out.yuv
c665bd56f8e241f8bf3a5a8f803227c3 *./data/out.yuv
stddev: 4.13 PSNR:35.78 bytes:7602176
stddev: 4.13 PSNR:35.78 bytes:7602176
e9218a1db885fe0262e88f9df630307d
*./data/a-mjpeg.avi
fab9b15954fe07a7d94ea4fa02af1ca2
*./data/a-mjpeg.avi
63521
8 ./data/a-mjpeg.avi
70252
8 ./data/a-mjpeg.avi
a365b4da246ad68caf96b702b7f961a
1 *./data/out.yuv
b1aa72cfb6f9cc3f525b27abc86a8f5
1 *./data/out.yuv
stddev: 4.
76 PSNR:34.56
bytes:7602176
stddev: 4.
38 PSNR:35.28
bytes:7602176
defd90b44bced2772c6ca0d8eb75f668
*./data/a-ljpeg.avi
29d6f3ca0833ed83cffa279d08e79419
*./data/a-ljpeg.avi
476
48
22 ./data/a-ljpeg.avi
476
55
22 ./data/a-ljpeg.avi
dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv
dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv
stddev: 0.00 PSNR:99.99 bytes:7602176
stddev: 0.00 PSNR:99.99 bytes:7602176
2123b30d786e6e6e25caf337f24e7834 *./data/a-rv10.rm
2123b30d786e6e6e25caf337f24e7834 *./data/a-rv10.rm
...
...
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