Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
f766f3c8
Commit
f766f3c8
authored
14 years ago
by
John Koleszar
Browse files
Options
Download
Patches
Plain Diff
dixie: simple validation of the frame header
Change-Id: Iae8c2d421eb686d652807d44d8053eaec8f72897
parent
5c263fa3
dixie
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
vp8/dixie/dixie.c
+46
-0
vp8/dixie/dixie.c
vp8/dixie/dixie.h
+16
-0
vp8/dixie/dixie.h
vp8/vp8_dixie_iface.c
+5
-2
vp8/vp8_dixie_iface.c
with
67 additions
and
2 deletions
vp8/dixie/dixie.c
+
46
−
0
View file @
f766f3c8
...
@@ -11,6 +11,35 @@
...
@@ -11,6 +11,35 @@
#include
"bit_ops.h"
#include
"bit_ops.h"
#include
"dixie.h"
#include
"dixie.h"
void
decode_frame
(
struct
vp8_decoder_ctx
*
ctx
,
const
unsigned
char
*
data
,
unsigned
int
sz
)
{
vpx_codec_err_t
res
;
if
((
res
=
vp8_parse_frame_header
(
data
,
sz
,
&
ctx
->
frame_hdr
)))
vpx_internal_error
(
&
ctx
->
error
,
res
,
"Failed to parse frame header"
);
if
(
ctx
->
frame_hdr
.
is_experimental
)
vpx_internal_error
(
&
ctx
->
error
,
VPX_CODEC_UNSUP_BITSTREAM
,
"Experimental bitstreams not supported."
);
if
(
ctx
->
frame_hdr
.
version
!=
0
)
vpx_internal_error
(
&
ctx
->
error
,
VPX_CODEC_UNSUP_BITSTREAM
,
"Unsupported version %d"
,
ctx
->
frame_hdr
.
version
);
if
(
ctx
->
frame_hdr
.
is_keyframe
)
if
(
ctx
->
frame_hdr
.
kf
.
scale_w
||
ctx
->
frame_hdr
.
kf
.
scale_h
)
vpx_internal_error
(
&
ctx
->
error
,
VPX_CODEC_UNSUP_BITSTREAM
,
"Spatial resampling not supported."
);
}
vpx_codec_err_t
vpx_codec_err_t
vp8_parse_frame_header
(
const
unsigned
char
*
data
,
vp8_parse_frame_header
(
const
unsigned
char
*
data
,
unsigned
int
sz
,
unsigned
int
sz
,
...
@@ -52,3 +81,20 @@ vp8_parse_frame_header(const unsigned char *data,
...
@@ -52,3 +81,20 @@ vp8_parse_frame_header(const unsigned char *data,
return
VPX_CODEC_OK
;
return
VPX_CODEC_OK
;
}
}
vpx_codec_err_t
vp8_dixie_decode_frame
(
struct
vp8_decoder_ctx
*
ctx
,
const
unsigned
char
*
data
,
unsigned
int
sz
)
{
volatile
struct
vp8_decoder_ctx
*
ctx_
=
ctx
;
ctx
->
error
.
error_code
=
VPX_CODEC_OK
;
ctx
->
error
.
has_detail
=
0
;
if
(
!
setjmp
(
ctx
->
error
.
jmp
))
decode_frame
(
ctx
,
data
,
sz
);
return
ctx_
->
error
.
error_code
;
}
This diff is collapsed.
Click to expand it.
vp8/dixie/dixie.h
+
16
−
0
View file @
f766f3c8
...
@@ -27,9 +27,25 @@ struct vp8_frame_hdr
...
@@ -27,9 +27,25 @@ struct vp8_frame_hdr
}
kf
;
}
kf
;
};
};
struct
vp8_decoder_ctx
{
struct
vpx_internal_error_info
error
;
struct
vp8_frame_hdr
frame_hdr
;
};
vpx_codec_err_t
vpx_codec_err_t
vp8_parse_frame_header
(
const
unsigned
char
*
data
,
vp8_parse_frame_header
(
const
unsigned
char
*
data
,
unsigned
int
sz
,
unsigned
int
sz
,
struct
vp8_frame_hdr
*
hdr
);
struct
vp8_frame_hdr
*
hdr
);
vpx_codec_err_t
vp8_dixie_decode_frame
(
struct
vp8_decoder_ctx
*
ctx
,
const
unsigned
char
*
data
,
unsigned
int
sz
);
#endif
#endif
This diff is collapsed.
Click to expand it.
vp8/vp8_dixie_iface.c
+
5
−
2
View file @
f766f3c8
...
@@ -25,6 +25,7 @@ struct vpx_codec_alg_priv
...
@@ -25,6 +25,7 @@ struct vpx_codec_alg_priv
vpx_codec_priv_t
base
;
vpx_codec_priv_t
base
;
vpx_codec_dec_cfg_t
cfg
;
vpx_codec_dec_cfg_t
cfg
;
vp8_stream_info_t
si
;
vp8_stream_info_t
si
;
struct
vp8_decoder_ctx
decoder_ctx
;
vpx_image_t
img
;
vpx_image_t
img
;
int
img_setup
;
int
img_setup
;
int
img_avail
;
int
img_avail
;
...
@@ -142,9 +143,11 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
...
@@ -142,9 +143,11 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
{
{
vpx_codec_err_t
res
=
VPX_CODEC_OK
;
vpx_codec_err_t
res
=
VPX_CODEC_OK
;
ctx
->
img_avail
=
0
;
res
=
vp8_dixie_decode_frame
(
&
ctx
->
decoder_ctx
,
data
,
data_sz
);
if
(
res
)
update_error_state
(
ctx
,
&
ctx
->
decoder_ctx
.
error
);
ctx
->
img_avail
=
0
;
return
res
;
return
res
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets