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
b0eeb9d4
Commit
b0eeb9d4
authored
Jul 14, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indeo5: return proper error codes
parent
25a6666f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
24 deletions
+30
-24
indeo5.c
libavcodec/indeo5.c
+30
-24
No files found.
libavcodec/indeo5.c
View file @
b0eeb9d4
...
@@ -74,7 +74,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
...
@@ -74,7 +74,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
tile_size
=
(
ctx
->
gop_flags
&
0x40
)
?
64
<<
get_bits
(
&
ctx
->
gb
,
2
)
:
0
;
tile_size
=
(
ctx
->
gop_flags
&
0x40
)
?
64
<<
get_bits
(
&
ctx
->
gb
,
2
)
:
0
;
if
(
tile_size
>
256
)
{
if
(
tile_size
>
256
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid tile size: %d
\n
"
,
tile_size
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid tile size: %d
\n
"
,
tile_size
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
/* decode number of wavelet bands */
/* decode number of wavelet bands */
...
@@ -85,7 +85,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
...
@@ -85,7 +85,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
if
(
ctx
->
is_scalable
&&
(
pic_conf
.
luma_bands
!=
4
||
pic_conf
.
chroma_bands
!=
1
))
{
if
(
ctx
->
is_scalable
&&
(
pic_conf
.
luma_bands
!=
4
||
pic_conf
.
chroma_bands
!=
1
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d
\n
"
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d
\n
"
,
pic_conf
.
luma_bands
,
pic_conf
.
chroma_bands
);
pic_conf
.
luma_bands
,
pic_conf
.
chroma_bands
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
pic_size_indx
=
get_bits
(
&
ctx
->
gb
,
4
);
pic_size_indx
=
get_bits
(
&
ctx
->
gb
,
4
);
...
@@ -98,8 +98,8 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
...
@@ -98,8 +98,8 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
}
}
if
(
ctx
->
gop_flags
&
2
)
{
if
(
ctx
->
gop_flags
&
2
)
{
av
_log
(
avctx
,
AV_LOG_ERROR
,
"YV12 picture format not supported!
\n
"
);
av
priv_report_missing_feature
(
avctx
,
"YV12 picture format
"
);
return
-
1
;
return
AVERROR_PATCHWELCOME
;
}
}
pic_conf
.
chroma_height
=
(
pic_conf
.
pic_height
+
3
)
>>
2
;
pic_conf
.
chroma_height
=
(
pic_conf
.
pic_height
+
3
)
>>
2
;
...
@@ -115,9 +115,9 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
...
@@ -115,9 +115,9 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
/* check if picture layout was changed and reallocate buffers */
/* check if picture layout was changed and reallocate buffers */
if
(
ivi_pic_config_cmp
(
&
pic_conf
,
&
ctx
->
pic_conf
))
{
if
(
ivi_pic_config_cmp
(
&
pic_conf
,
&
ctx
->
pic_conf
))
{
result
=
ff_ivi_init_planes
(
ctx
->
planes
,
&
pic_conf
);
result
=
ff_ivi_init_planes
(
ctx
->
planes
,
&
pic_conf
);
if
(
result
)
{
if
(
result
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Couldn't reallocate color planes!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Couldn't reallocate color planes!
\n
"
);
return
-
1
;
return
result
;
}
}
ctx
->
pic_conf
=
pic_conf
;
ctx
->
pic_conf
=
pic_conf
;
blk_size_changed
=
1
;
/* force reallocation of the internal structures */
blk_size_changed
=
1
;
/* force reallocation of the internal structures */
...
@@ -140,8 +140,8 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
...
@@ -140,8 +140,8 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
}
}
if
(
get_bits1
(
&
ctx
->
gb
))
{
if
(
get_bits1
(
&
ctx
->
gb
))
{
av
_log
(
avctx
,
AV_LOG_ERROR
,
"Extended transform info encountered!
\n
"
);
av
priv_report_missing_feature
(
avctx
,
"Extended transform info
"
);
return
-
1
;
return
AVERROR_PATCHWELCOME
;
}
}
/* select transform function and scan pattern according to plane and band number */
/* select transform function and scan pattern according to plane and band number */
...
@@ -209,7 +209,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
...
@@ -209,7 +209,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
if
(
get_bits
(
&
ctx
->
gb
,
2
))
{
if
(
get_bits
(
&
ctx
->
gb
,
2
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"End marker missing!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"End marker missing!
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
}
}
}
}
...
@@ -238,17 +238,17 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
...
@@ -238,17 +238,17 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
if
(
blk_size_changed
)
{
if
(
blk_size_changed
)
{
result
=
ff_ivi_init_tiles
(
ctx
->
planes
,
pic_conf
.
tile_width
,
result
=
ff_ivi_init_tiles
(
ctx
->
planes
,
pic_conf
.
tile_width
,
pic_conf
.
tile_height
);
pic_conf
.
tile_height
);
if
(
result
)
{
if
(
result
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Couldn't reallocate internal structures!
\n
"
);
"Couldn't reallocate internal structures!
\n
"
);
return
-
1
;
return
result
;
}
}
}
}
if
(
ctx
->
gop_flags
&
8
)
{
if
(
ctx
->
gop_flags
&
8
)
{
if
(
get_bits
(
&
ctx
->
gb
,
3
))
{
if
(
get_bits
(
&
ctx
->
gb
,
3
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Alignment bits are not zero!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Alignment bits are not zero!
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
if
(
get_bits1
(
&
ctx
->
gb
))
if
(
get_bits1
(
&
ctx
->
gb
))
...
@@ -297,25 +297,27 @@ static inline void skip_hdr_extension(GetBitContext *gb)
...
@@ -297,25 +297,27 @@ static inline void skip_hdr_extension(GetBitContext *gb)
*/
*/
static
int
decode_pic_hdr
(
IVI45DecContext
*
ctx
,
AVCodecContext
*
avctx
)
static
int
decode_pic_hdr
(
IVI45DecContext
*
ctx
,
AVCodecContext
*
avctx
)
{
{
int
ret
;
if
(
get_bits
(
&
ctx
->
gb
,
5
)
!=
0x1F
)
{
if
(
get_bits
(
&
ctx
->
gb
,
5
)
!=
0x1F
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid picture start code!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid picture start code!
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
ctx
->
prev_frame_type
=
ctx
->
frame_type
;
ctx
->
prev_frame_type
=
ctx
->
frame_type
;
ctx
->
frame_type
=
get_bits
(
&
ctx
->
gb
,
3
);
ctx
->
frame_type
=
get_bits
(
&
ctx
->
gb
,
3
);
if
(
ctx
->
frame_type
>=
5
)
{
if
(
ctx
->
frame_type
>=
5
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid frame type: %d
\n
"
,
ctx
->
frame_type
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid frame type: %d
\n
"
,
ctx
->
frame_type
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
ctx
->
frame_num
=
get_bits
(
&
ctx
->
gb
,
8
);
ctx
->
frame_num
=
get_bits
(
&
ctx
->
gb
,
8
);
if
(
ctx
->
frame_type
==
FRAMETYPE_INTRA
)
{
if
(
ctx
->
frame_type
==
FRAMETYPE_INTRA
)
{
ctx
->
gop_invalid
=
1
;
ctx
->
gop_invalid
=
1
;
if
(
decode_gop_header
(
ctx
,
avctx
)
)
{
if
(
(
ret
=
decode_gop_header
(
ctx
,
avctx
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid GOP header, skipping frames.
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid GOP header, skipping frames.
\n
"
);
return
AVERROR_INVALIDDATA
;
return
ret
;
}
}
ctx
->
gop_invalid
=
0
;
ctx
->
gop_invalid
=
0
;
}
}
...
@@ -332,8 +334,10 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
...
@@ -332,8 +334,10 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
skip_hdr_extension
(
&
ctx
->
gb
);
/* XXX: untested */
skip_hdr_extension
(
&
ctx
->
gb
);
/* XXX: untested */
/* decode macroblock huffman codebook */
/* decode macroblock huffman codebook */
if
(
ff_ivi_dec_huff_desc
(
&
ctx
->
gb
,
ctx
->
frame_flags
&
0x40
,
IVI_MB_HUFF
,
&
ctx
->
mb_vlc
,
avctx
))
ret
=
ff_ivi_dec_huff_desc
(
&
ctx
->
gb
,
ctx
->
frame_flags
&
0x40
,
return
-
1
;
IVI_MB_HUFF
,
&
ctx
->
mb_vlc
,
avctx
);
if
(
ret
<
0
)
return
ret
;
skip_bits
(
&
ctx
->
gb
,
3
);
/* FIXME: unknown meaning! */
skip_bits
(
&
ctx
->
gb
,
3
);
/* FIXME: unknown meaning! */
}
}
...
@@ -355,7 +359,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
...
@@ -355,7 +359,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
static
int
decode_band_hdr
(
IVI45DecContext
*
ctx
,
IVIBandDesc
*
band
,
static
int
decode_band_hdr
(
IVI45DecContext
*
ctx
,
IVIBandDesc
*
band
,
AVCodecContext
*
avctx
)
AVCodecContext
*
avctx
)
{
{
int
i
;
int
i
,
ret
;
uint8_t
band_flags
;
uint8_t
band_flags
;
band_flags
=
get_bits
(
&
ctx
->
gb
,
8
);
band_flags
=
get_bits
(
&
ctx
->
gb
,
8
);
...
@@ -379,7 +383,7 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
...
@@ -379,7 +383,7 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
if
(
band
->
num_corr
>
61
)
{
if
(
band
->
num_corr
>
61
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Too many corrections: %d
\n
"
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Too many corrections: %d
\n
"
,
band
->
num_corr
);
band
->
num_corr
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
/* read correction pairs */
/* read correction pairs */
...
@@ -391,8 +395,10 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
...
@@ -391,8 +395,10 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
band
->
rvmap_sel
=
(
band_flags
&
0x40
)
?
get_bits
(
&
ctx
->
gb
,
3
)
:
8
;
band
->
rvmap_sel
=
(
band_flags
&
0x40
)
?
get_bits
(
&
ctx
->
gb
,
3
)
:
8
;
/* decode block huffman codebook */
/* decode block huffman codebook */
if
(
ff_ivi_dec_huff_desc
(
&
ctx
->
gb
,
band_flags
&
0x80
,
IVI_BLK_HUFF
,
&
band
->
blk_vlc
,
avctx
))
ret
=
ff_ivi_dec_huff_desc
(
&
ctx
->
gb
,
band_flags
&
0x80
,
IVI_BLK_HUFF
,
return
-
1
;
&
band
->
blk_vlc
,
avctx
);
if
(
ret
<
0
)
return
ret
;
band
->
checksum_present
=
get_bits1
(
&
ctx
->
gb
);
band
->
checksum_present
=
get_bits1
(
&
ctx
->
gb
);
if
(
band
->
checksum_present
)
if
(
band
->
checksum_present
)
...
@@ -459,7 +465,7 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
...
@@ -459,7 +465,7 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
if
(
get_bits1
(
&
ctx
->
gb
))
{
if
(
get_bits1
(
&
ctx
->
gb
))
{
if
(
ctx
->
frame_type
==
FRAMETYPE_INTRA
)
{
if
(
ctx
->
frame_type
==
FRAMETYPE_INTRA
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Empty macroblock in an INTRA picture!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Empty macroblock in an INTRA picture!
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
mb
->
type
=
1
;
/* empty macroblocks are always INTER */
mb
->
type
=
1
;
/* empty macroblocks are always INTER */
mb
->
cbp
=
0
;
/* all blocks are empty */
mb
->
cbp
=
0
;
/* all blocks are empty */
...
@@ -623,7 +629,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
...
@@ -623,7 +629,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
result
=
ff_ivi_init_planes
(
ctx
->
planes
,
&
ctx
->
pic_conf
);
result
=
ff_ivi_init_planes
(
ctx
->
planes
,
&
ctx
->
pic_conf
);
if
(
result
)
{
if
(
result
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Couldn't allocate color planes!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Couldn't allocate color planes!
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
ctx
->
buf_switch
=
0
;
ctx
->
buf_switch
=
0
;
...
...
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