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
3093185e
Commit
3093185e
authored
May 25, 2002
by
Fabrice Bellard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed incorrect buffer handling
Originally committed as revision 597 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
d503f970
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
22 deletions
+21
-22
mjpeg.c
libavcodec/mjpeg.c
+21
-22
No files found.
libavcodec/mjpeg.c
View file @
3093185e
/*
/*
* MJPEG encoder and decoder
* MJPEG encoder and decoder
* Copyright (c) 2000, 2001
Gerard Lantau
.
* Copyright (c) 2000, 2001
Fabrice Bellard
.
*
*
* This
program is free software; you can redistribute it and/or modify
* This
library is free software; you can redistribute it and/or
*
it under the terms of the GNU General Public License as published by
*
modify it under the terms of the GNU Lesser General Public
*
the Free Software Foundation; either version 2 of the License, o
r
*
License as published by the Free Software Foundation; eithe
r
* (at your option) any later version.
*
version 2 of the License, or
(at your option) any later version.
*
*
* This
program
is distributed in the hope that it will be useful,
* This
library
is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU
*
GNU
General Public License for more details.
*
Lesser
General Public License for more details.
*
*
* You should have received a copy of the GNU
General Public License
* You should have received a copy of the GNU
Lesser General Public
*
along with this program
; if not, write to the Free Software
*
License along with this library
; if not, write to the Free Software
* Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Support for external huffman table and various fixes (AVID workaround) by
* Support for external huffman table and various fixes (AVID workaround) by
* Alex Beregszaszi <alex@naxine.org>
* Alex Beregszaszi <alex@naxine.org>
...
@@ -815,7 +815,7 @@ static inline int decode_dc(MJpegDecodeContext *s, int dc_index)
...
@@ -815,7 +815,7 @@ static inline int decode_dc(MJpegDecodeContext *s, int dc_index)
code
=
get_vlc
(
&
s
->
gb
,
&
s
->
vlcs
[
0
][
dc_index
]);
code
=
get_vlc
(
&
s
->
gb
,
&
s
->
vlcs
[
0
][
dc_index
]);
if
(
code
<
0
)
if
(
code
<
0
)
{
{
dprintf
(
"decode_dc: bad vlc: %d:%d (%
x
)
\n
"
,
0
,
dc_index
,
dprintf
(
"decode_dc: bad vlc: %d:%d (%
p
)
\n
"
,
0
,
dc_index
,
&
s
->
vlcs
[
0
][
dc_index
]);
&
s
->
vlcs
[
0
][
dc_index
]);
return
0xffff
;
return
0xffff
;
}
}
...
@@ -987,7 +987,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s,
...
@@ -987,7 +987,7 @@ static int mjpeg_decode_sos(MJpegDecodeContext *s,
if
(
decode_block
(
s
,
s
->
block
,
i
,
if
(
decode_block
(
s
,
s
->
block
,
i
,
dc_index
[
i
],
ac_index
[
i
],
dc_index
[
i
],
ac_index
[
i
],
s
->
quant_index
[
c
])
<
0
)
{
s
->
quant_index
[
c
])
<
0
)
{
dprintf
(
"error
%d
%d
\n
"
,
mb_y
,
mb_x
);
dprintf
(
"error
y=%d x=
%d
\n
"
,
mb_y
,
mb_x
);
ret
=
-
1
;
ret
=
-
1
;
goto
the_end
;
goto
the_end
;
}
}
...
@@ -1213,9 +1213,11 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
...
@@ -1213,9 +1213,11 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
}
else
{
}
else
{
memcpy
(
s
->
buf_ptr
,
buf_start
,
len
);
memcpy
(
s
->
buf_ptr
,
buf_start
,
len
);
s
->
buf_ptr
+=
len
;
s
->
buf_ptr
+=
len
;
if
(
code
<
0
)
{
/* nothing to do: wait next marker */
}
else
if
(
code
==
0
||
code
==
0xff
)
{
/* if we got FF 00, we copy FF to the stream to unescape FF 00 */
/* if we got FF 00, we copy FF to the stream to unescape FF 00 */
/* valid marker code is between 00 and ff - alex */
/* valid marker code is between 00 and ff - alex */
if
(
code
<=
0
||
code
>=
0xff
)
{
s
->
buf_ptr
--
;
s
->
buf_ptr
--
;
}
else
{
}
else
{
/* prepare data for next start code */
/* prepare data for next start code */
...
@@ -1299,12 +1301,9 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
...
@@ -1299,12 +1301,9 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
return
-
1
;
return
-
1
;
}
}
#if 1
#if 1
if
(
start_code
>=
0xd0
&&
start_code
<=
0xd7
)
if
(
start_code
>=
0xd0
&&
start_code
<=
0xd7
)
{
{
dprintf
(
"restart marker: %d
\n
"
,
start_code
&
0x0f
);
dprintf
(
"restart marker: %d
\n
"
,
start_code
&
0x0f
);
}
}
else
if
(
s
->
first_picture
)
{
else
if
(
s
->
first_picture
)
{
/* APP fields */
/* APP fields */
if
(
start_code
>=
0xe0
&&
start_code
<=
0xef
)
if
(
start_code
>=
0xe0
&&
start_code
<=
0xef
)
mjpeg_decode_app
(
s
,
s
->
buffer
,
input_size
,
start_code
);
mjpeg_decode_app
(
s
,
s
->
buffer
,
input_size
,
start_code
);
...
...
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