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
86f85dca
Commit
86f85dca
authored
Nov 02, 2002
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
Originally committed as revision 1142 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
288daa84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
mpeg12.c
libavcodec/mpeg12.c
+20
-9
No files found.
libavcodec/mpeg12.c
View file @
86f85dca
...
@@ -1559,7 +1559,18 @@ static void mpeg_decode_extension(AVCodecContext *avctx,
...
@@ -1559,7 +1559,18 @@ static void mpeg_decode_extension(AVCodecContext *avctx,
}
}
}
}
/* return 1 if end of frame */
#define DECODE_SLICE_FATAL_ERROR -2
#define DECODE_SLICE_ERROR -1
#define DECODE_SLICE_OK 0
#define DECODE_SLICE_EOP 1
/**
* decodes a slice.
* @return DECODE_SLICE_FATAL_ERROR if a non recoverable error occured<br>
* DECODE_SLICE_ERROR if the slice is damaged<br>
* DECODE_SLICE_OK if this slice is ok<br>
* DECODE_SLICE_EOP if the end of the picture is reached
*/
static
int
mpeg_decode_slice
(
AVCodecContext
*
avctx
,
static
int
mpeg_decode_slice
(
AVCodecContext
*
avctx
,
AVPicture
*
pict
,
AVPicture
*
pict
,
int
start_code
,
int
start_code
,
...
@@ -1572,7 +1583,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
...
@@ -1572,7 +1583,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
start_code
=
(
start_code
-
1
)
&
0xff
;
start_code
=
(
start_code
-
1
)
&
0xff
;
if
(
start_code
>=
s
->
mb_height
){
if
(
start_code
>=
s
->
mb_height
){
fprintf
(
stderr
,
"slice below image (%d >= %d)
\n
"
,
start_code
,
s
->
mb_height
);
fprintf
(
stderr
,
"slice below image (%d >= %d)
\n
"
,
start_code
,
s
->
mb_height
);
return
-
1
;
return
DECODE_SLICE_ERROR
;
}
}
s
->
last_dc
[
0
]
=
1
<<
(
7
+
s
->
intra_dc_precision
);
s
->
last_dc
[
0
]
=
1
<<
(
7
+
s
->
intra_dc_precision
);
s
->
last_dc
[
1
]
=
s
->
last_dc
[
0
];
s
->
last_dc
[
1
]
=
s
->
last_dc
[
0
];
...
@@ -1582,7 +1593,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
...
@@ -1582,7 +1593,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
if
(
s
->
first_slice
)
{
if
(
s
->
first_slice
)
{
s
->
first_slice
=
0
;
s
->
first_slice
=
0
;
if
(
MPV_frame_start
(
s
,
avctx
)
<
0
)
if
(
MPV_frame_start
(
s
,
avctx
)
<
0
)
return
-
2
;
return
DECODE_SLICE_FATAL_ERROR
;
}
}
init_get_bits
(
&
s
->
gb
,
buf
,
buf_size
);
init_get_bits
(
&
s
->
gb
,
buf
,
buf_size
);
...
@@ -1651,7 +1662,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
...
@@ -1651,7 +1662,7 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
}
}
if
(
s
->
mb_y
>=
s
->
mb_height
){
if
(
s
->
mb_y
>=
s
->
mb_height
){
fprintf
(
stderr
,
"slice too long
\n
"
);
fprintf
(
stderr
,
"slice too long
\n
"
);
return
-
1
;
return
DECODE_SLICE_ERROR
;
}
}
}
}
eos:
//end of slice
eos:
//end of slice
...
@@ -1689,12 +1700,12 @@ eos: //end of slice
...
@@ -1689,12 +1700,12 @@ eos: //end of slice
pict
->
linesize
[
0
]
=
s
->
linesize
;
pict
->
linesize
[
0
]
=
s
->
linesize
;
pict
->
linesize
[
1
]
=
s
->
uvlinesize
;
pict
->
linesize
[
1
]
=
s
->
uvlinesize
;
pict
->
linesize
[
2
]
=
s
->
uvlinesize
;
pict
->
linesize
[
2
]
=
s
->
uvlinesize
;
return
1
;
return
DECODE_SLICE_EOP
;
}
else
{
}
else
{
return
0
;
return
DECODE_SLICE_OK
;
}
}
}
else
{
}
else
{
return
0
;
return
DECODE_SLICE_OK
;
}
}
}
}
...
@@ -1902,7 +1913,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
...
@@ -1902,7 +1913,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
start_code
<=
SLICE_MAX_START_CODE
)
{
start_code
<=
SLICE_MAX_START_CODE
)
{
ret
=
mpeg_decode_slice
(
avctx
,
picture
,
ret
=
mpeg_decode_slice
(
avctx
,
picture
,
start_code
,
s
->
buffer
,
input_size
);
start_code
,
s
->
buffer
,
input_size
);
if
(
ret
==
1
)
{
if
(
ret
==
DECODE_SLICE_EOP
)
{
/* got a picture: exit */
/* got a picture: exit */
/* first check if we must repeat the frame */
/* first check if we must repeat the frame */
avctx
->
repeat_pict
=
0
;
avctx
->
repeat_pict
=
0
;
...
@@ -1930,7 +1941,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
...
@@ -1930,7 +1941,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
goto
the_end
;
goto
the_end
;
}
else
if
(
ret
<
0
){
}
else
if
(
ret
<
0
){
printf
(
"Error while decoding slice
\n
"
);
printf
(
"Error while decoding slice
\n
"
);
if
(
ret
<-
1
)
return
-
1
;
if
(
ret
==
DECODE_SLICE_FATAL_ERROR
)
return
-
1
;
}
}
}
}
break
;
break
;
...
...
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