Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guillaume Martres
aom-rav1e
Commits
46f9ad2c
Commit
46f9ad2c
authored
Feb 14, 2012
by
Paul Wilkins
Browse files
Experimental code base simplification.
Remove error concealment code. Change-Id: I882705174fbfea212e96f7f684e47a671dbe5c67
parent
d327dcf3
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
configure
View file @
46f9ad2c
...
...
@@ -35,7 +35,6 @@ Advanced options:
${
toggle_mem_tracker
}
track memory usage
${
toggle_postproc
}
postprocessing
${
toggle_spatial_resampling
}
spatial sampling (scaling) support
${
toggle_error_concealment
}
enable this option to get a decoder which is able to conceal losses
${
toggle_runtime_cpu_detect
}
runtime cpu detection
${
toggle_shared
}
shared library support
${
toggle_static
}
static library support
...
...
@@ -262,7 +261,6 @@ CONFIG_LIST="
decoders
static_msvcrt
spatial_resampling
error_concealment
shared
static
small
...
...
@@ -305,7 +303,6 @@ CMDLINE_SELECT="
static_msvcrt
mem_tracker
spatial_resampling
error_concealment
shared
static
small
...
...
examples.mk
View file @
46f9ad2c
...
...
@@ -77,11 +77,6 @@ GEN_EXAMPLES-$(CONFIG_ENCODERS) += decode_with_drops.c
endif
decode_with_drops.GUID
=
CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
decode_with_drops.DESCRIPTION
=
Drops frames
while
decoding
ifeq
($(CONFIG_DECODERS),yes)
GEN_EXAMPLES-$(CONFIG_ERROR_CONCEALMENT)
+=
decode_with_partial_drops.c
endif
decode_with_partial_drops.GUID
=
61C2D026-5754-46AC-916F-1343ECC5537E
decode_with_partial_drops.DESCRIPTION
=
Drops parts of frames
while
decoding
GEN_EXAMPLES-$(CONFIG_ENCODERS)
+=
error_resilient.c
error_resilient.GUID
=
DF5837B9-4145-4F92-A031-44E4F832E00C
error_resilient.DESCRIPTION
=
Error Resiliency Feature
...
...
examples/decode_with_partial_drops.txt
deleted
100644 → 0
View file @
d327dcf3
@TEMPLATE decoder_tmpl.c
Decode With Partial Drops Example
=========================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
This is an example utility which drops a series of frames (or parts of frames),
as specified on the command line. This is useful for observing the error
recovery features of the codec.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_INCLUDES
#include <time.h>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_INCLUDES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HELPERS
struct parsed_header
{
char key_frame;
int version;
char show_frame;
int first_part_size;
};
int next_packet(struct parsed_header* hdr, int pos, int length, int mtu)
{
int size = 0;
int remaining = length - pos;
/* Uncompressed part is 3 bytes for P frames and 10 bytes for I frames */
int uncomp_part_size = (hdr->key_frame ? 10 : 3);
/* number of bytes yet to send from header and the first partition */
int remainFirst = uncomp_part_size + hdr->first_part_size - pos;
if (remainFirst > 0)
{
if (remainFirst <= mtu)
{
size = remainFirst;
}
else
{
size = mtu;
}
return size;
}
/* second partition; just slot it up according to MTU */
if (remaining <= mtu)
{
size = remaining;
return size;
}
return mtu;
}
void throw_packets(unsigned char* frame, int* size, int loss_rate,
int* thrown, int* kept)
{
unsigned char loss_frame[256*1024];
int pkg_size = 1;
int pos = 0;
int loss_pos = 0;
struct parsed_header hdr;
unsigned int tmp;
int mtu = 1500;
if (*size < 3)
{
return;
}
putc('|', stdout);
/* parse uncompressed 3 bytes */
tmp = (frame[2] << 16) | (frame[1] << 8) | frame[0];
hdr.key_frame = !(tmp & 0x1); /* inverse logic */
hdr.version = (tmp >> 1) & 0x7;
hdr.show_frame = (tmp >> 4) & 0x1;
hdr.first_part_size = (tmp >> 5) & 0x7FFFF;
/* don't drop key frames */
if (hdr.key_frame)
{
int i;
*kept = *size/mtu + ((*size % mtu > 0) ? 1 : 0); /* approximate */
for (i=0; i < *kept; i++)
putc('.', stdout);
return;
}
while ((pkg_size = next_packet(&hdr, pos, *size, mtu)) > 0)
{
int loss_event = ((rand() + 1.0)/(RAND_MAX + 1.0) < loss_rate/100.0);
if (*thrown == 0 && !loss_event)
{
memcpy(loss_frame + loss_pos, frame + pos, pkg_size);
loss_pos += pkg_size;
(*kept)++;
putc('.', stdout);
}
else
{
(*thrown)++;
putc('X', stdout);
}
pos += pkg_size;
}
memcpy(frame, loss_frame, loss_pos);
memset(frame + loss_pos, 0, *size - loss_pos);
*size = loss_pos;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HELPERS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INIT
/* Initialize codec */
flags = VPX_CODEC_USE_ERROR_CONCEALMENT;
res = vpx_codec_dec_init(&codec, interface, &dec_cfg, flags);
if(res)
die_codec(&codec, "Failed to initialize decoder");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INIT
Usage
-----
This example adds a single argument to the `simple_decoder` example,
which specifies the range or pattern of frames to drop. The parameter is
parsed as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
if(argc < 4 || argc > 6)
die("Usage: %s <infile> <outfile> [-t <num threads>] <N-M|N/M|L,S>\n",
argv[0]);
{
char *nptr;
int arg_num = 3;
if (argc == 6 && strncmp(argv[arg_num++], "-t", 2) == 0)
dec_cfg.threads = strtol(argv[arg_num++], NULL, 0);
n = strtol(argv[arg_num], &nptr, 0);
mode = (*nptr == '\0' || *nptr == ',') ? 2 : (*nptr == '-') ? 1 : 0;
m = strtol(nptr+1, NULL, 0);
if((!n && !m) || (*nptr != '-' && *nptr != '/' &&
*nptr != '\0' && *nptr != ','))
die("Couldn't parse pattern %s\n", argv[3]);
}
seed = (m > 0) ? m : (unsigned int)time(NULL);
srand(seed);thrown_frame = 0;
printf("Seed: %u\n", seed);
printf("Threads: %d\n", dec_cfg.threads);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
Dropping A Range Of Frames
--------------------------
To drop a range of frames, specify the starting frame and the ending
frame to drop, separated by a dash. The following command will drop
frames 5 through 10 (base 1).
$ ./decode_with_partial_drops in.ivf out.i420 5-10
Dropping A Pattern Of Frames
----------------------------
To drop a pattern of frames, specify the number of frames to drop and
the number of frames after which to repeat the pattern, separated by
a forward-slash. The following command will drop 3 of 7 frames.
Specifically, it will decode 4 frames, then drop 3 frames, and then
repeat.
$ ./decode_with_partial_drops in.ivf out.i420 3/7
Dropping Random Parts Of Frames
-------------------------------
A third argument tuple is available to split the frame into 1500 bytes pieces
and randomly drop pieces rather than frames. The frame will be split at
partition boundaries where possible. The following example will seed the RNG
with the seed 123 and drop approximately 5% of the pieces. Pieces which
are depending on an already dropped piece will also be dropped.
$ ./decode_with_partial_drops in.ivf out.i420 5,123
Extra Variables
---------------
This example maintains the pattern passed on the command line in the
`n`, `m`, and `is_range` variables:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_VARS
int n, m, mode;
unsigned int seed;
int thrown=0, kept=0;
int thrown_frame=0, kept_frame=0;
vpx_codec_dec_cfg_t dec_cfg = {0};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_VARS
Making The Drop Decision
------------------------
The example decides whether to drop the frame based on the current
frame number, immediately before decoding the frame.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRE_DECODE
/* Decide whether to throw parts of the frame or the whole frame
depending on the drop mode */
thrown_frame = 0;
kept_frame = 0;
switch (mode)
{
case 0:
if (m - (frame_cnt-1)%m <= n)
{
frame_sz = 0;
}
break;
case 1:
if (frame_cnt >= n && frame_cnt <= m)
{
frame_sz = 0;
}
break;
case 2:
throw_packets(frame, &frame_sz, n, &thrown_frame, &kept_frame);
break;
default: break;
}
if (mode < 2)
{
if (frame_sz == 0)
{
putc('X', stdout);
thrown_frame++;
}
else
{
putc('.', stdout);
kept_frame++;
}
}
thrown += thrown_frame;
kept += kept_frame;
fflush(stdout);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRE_DECODE
vp8/common/alloccommon.c
View file @
46f9ad2c
...
...
@@ -157,10 +157,6 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
update_mode_info_border
(
oci
,
oci
->
mip
);
update_mode_info_in_image
(
oci
,
oci
->
mi
);
#if CONFIG_ERROR_CONCEALMENT
update_mode_info_border
(
oci
,
oci
->
prev_mip
);
update_mode_info_in_image
(
oci
,
oci
->
prev_mi
);
#endif
return
0
;
}
...
...
vp8/common/onyxd.h
View file @
46f9ad2c
...
...
@@ -32,7 +32,6 @@ extern "C"
int
Version
;
int
postprocess
;
int
max_threads
;
int
error_concealment
;
int
input_partition
;
}
VP8D_CONFIG
;
typedef
enum
...
...
vp8/decoder/decodemv.c
View file @
46f9ad2c
...
...
@@ -395,12 +395,6 @@ static void mb_mode_mv_init(VP8D_COMP *pbi)
vp8_reader
*
const
bc
=
&
pbi
->
bc
;
MV_CONTEXT
*
const
mvc
=
pbi
->
common
.
fc
.
mvc
;
#if CONFIG_ERROR_CONCEALMENT
/* Default is that no macroblock is corrupt, therefore we initialize
* mvs_corrupt_from_mb to something very big, which we can be sure is
* outside the frame. */
pbi
->
mvs_corrupt_from_mb
=
UINT_MAX
;
#endif
pbi
->
prob_skip_false
=
0
;
if
(
pbi
->
common
.
mb_no_coeff_skip
)
pbi
->
prob_skip_false
=
(
vp8_prob
)
vp8_read_literal
(
bc
,
8
);
...
...
@@ -772,27 +766,6 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
}
}
#if CONFIG_ERROR_CONCEALMENT
if
(
pbi
->
ec_enabled
)
{
mi
->
bmi
[
0
].
mv
.
as_int
=
mi
->
bmi
[
1
].
mv
.
as_int
=
mi
->
bmi
[
2
].
mv
.
as_int
=
mi
->
bmi
[
3
].
mv
.
as_int
=
mi
->
bmi
[
4
].
mv
.
as_int
=
mi
->
bmi
[
5
].
mv
.
as_int
=
mi
->
bmi
[
6
].
mv
.
as_int
=
mi
->
bmi
[
7
].
mv
.
as_int
=
mi
->
bmi
[
8
].
mv
.
as_int
=
mi
->
bmi
[
9
].
mv
.
as_int
=
mi
->
bmi
[
10
].
mv
.
as_int
=
mi
->
bmi
[
11
].
mv
.
as_int
=
mi
->
bmi
[
12
].
mv
.
as_int
=
mi
->
bmi
[
13
].
mv
.
as_int
=
mi
->
bmi
[
14
].
mv
.
as_int
=
mi
->
bmi
[
15
].
mv
.
as_int
=
mv
->
as_int
;
}
#endif
break
;
default:
;
#if CONFIG_DEBUG
...
...
@@ -886,9 +859,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
int
mb_to_top_edge
;
int
mb_to_bottom_edge
;
#if CONFIG_ERROR_CONCEALMENT
int
mb_num
;
#endif
int
offset_extended
=
row_delta
[(
i
+
1
)
&
0x3
]
*
cm
->
mode_info_stride
+
col_delta
[(
i
+
1
)
&
0x3
];
int
dy
=
row_delta
[
i
];
...
...
@@ -912,9 +882,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
mb_to_bottom_edge
=
((
pbi
->
common
.
mb_rows
-
1
-
mb_row
)
*
16
)
<<
3
;
mb_to_bottom_edge
+=
RIGHT_BOTTOM_MARGIN
;
#if CONFIG_ERROR_CONCEALMENT
mb_num
=
mb_row
*
pbi
->
common
.
mb_cols
+
mb_col
;
#endif
/*read_mb_modes_mv(pbi, cm->mode_info_context, &cm->mode_info_context->mbmi, mb_row, mb_col);*/
if
(
pbi
->
common
.
frame_type
==
KEY_FRAME
)
vp8_kfread_modes
(
pbi
,
mi
,
mb_row
,
mb_col
);
...
...
@@ -923,19 +890,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
prev_mi
,
mb_row
,
mb_col
);
#if CONFIG_ERROR_CONCEALMENT
/* look for corruption. set mvs_corrupt_from_mb to the current
* mb_num if the frame is corrupt from this macroblock. */
if
(
vp8dx_bool_error
(
&
pbi
->
bc
)
&&
mb_num
<
pbi
->
mvs_corrupt_from_mb
)
{
pbi
->
mvs_corrupt_from_mb
=
mb_num
;
/* no need to continue since the partition is corrupt from
* here on.
*/
return
;
}
#endif
prev_mi
+=
offset_extended
;
mi
+=
offset_extended
;
/* next macroblock */
}
...
...
@@ -988,9 +942,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
while
(
++
mb_col
<
pbi
->
common
.
mb_cols
)
{
#if CONFIG_ERROR_CONCEALMENT
int
mb_num
=
mb_row
*
pbi
->
common
.
mb_cols
+
mb_col
;
#endif
/*read_mb_modes_mv(pbi, xd->mode_info_context, &xd->mode_info_context->mbmi, mb_row, mb_col);*/
if
(
pbi
->
common
.
frame_type
==
KEY_FRAME
)
vp8_kfread_modes
(
pbi
,
mi
,
mb_row
,
mb_col
);
...
...
@@ -1015,19 +966,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
printf("F%3d:%d:%d\n", pbi->common.current_video_frame, mb_row, mb_col);
}
*/
#if CONFIG_ERROR_CONCEALMENT
/* look for corruption. set mvs_corrupt_from_mb to the current
* mb_num if the frame is corrupt from this macroblock. */
if
(
vp8dx_bool_error
(
&
pbi
->
bc
)
&&
mb_num
<
pbi
->
mvs_corrupt_from_mb
)
{
pbi
->
mvs_corrupt_from_mb
=
mb_num
;
/* no need to continue since the partition is corrupt from
* here on.
*/
return
;
}
#endif
#if 0
fprintf(statsfile, "%2d%2d%2d ",
mi->mbmi.segment_id, mi->mbmi.ref_frame, mi->mbmi.mode );
...
...
vp8/decoder/decodframe.c
View file @
46f9ad2c
...
...
@@ -28,9 +28,6 @@
#include
"decodemv.h"
#include
"vp8/common/extend.h"
#include
"vp8/common/modecont.h"
#if CONFIG_ERROR_CONCEALMENT
#include
"error_concealment.h"
#endif
#include
"vpx_mem/vpx_mem.h"
#include
"vp8/common/idct.h"
#include
"dequantize.h"
...
...
@@ -273,20 +270,6 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
pbi
->
frame_corrupt_residual
);
throw_residual
=
(
throw_residual
||
vp8dx_bool_error
(
xd
->
current_bc
));
#if CONFIG_ERROR_CONCEALMENT
if
(
pbi
->
ec_active
&&
(
mb_idx
>=
pbi
->
mvs_corrupt_from_mb
||
throw_residual
))
{
/* MB with corrupt residuals or corrupt mode/motion vectors.
* Better to use the predictor as reconstruction.
*/
pbi
->
frame_corrupt_residual
=
1
;
vpx_memset
(
xd
->
qcoeff
,
0
,
sizeof
(
xd
->
qcoeff
));
vp8_conceal_corrupt_mb
(
xd
);
return
;
}
#endif
/* dequantization and idct */
if
(
mode
==
I8X8_PRED
)
{
...
...
@@ -534,32 +517,6 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd)
xd
->
up_available
=
(
mb_row
!=
0
);
xd
->
left_available
=
(
mb_col
!=
0
);
#if CONFIG_ERROR_CONCEALMENT
{
int
corrupt_residual
=
(
!
pbi
->
independent_partitions
&&
pbi
->
frame_corrupt_residual
)
||
vp8dx_bool_error
(
xd
->
current_bc
);
if
(
pbi
->
ec_active
&&
xd
->
mode_info_context
->
mbmi
.
ref_frame
==
INTRA_FRAME
&&
corrupt_residual
)
{
/* We have an intra block with corrupt coefficients, better
* to conceal with an inter block. Interpolate MVs from
* neighboring MBs.
*
* Note that for the first mb with corrupt residual in a
* frame, we might not discover that before decoding the
* residual. That happens after this check, and therefore
* no inter concealment will be done.
*/
vp8_interpolate_motion
(
xd
,
mb_row
,
mb_col
,
pc
->
mb_rows
,
pc
->
mb_cols
,
pc
->
mode_info_stride
);
}
}
#endif
update_blockd_bmi
(
xd
);
recon_yoffset
=
(
mb_row
*
recon_y_stride
*
16
)
+
(
mb_col
*
16
);
...
...
@@ -659,32 +616,6 @@ decode_mb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mb_row, MACROBLOCKD *xd)
xd
->
mb_to_left_edge
=
-
((
mb_col
*
16
)
<<
3
);
xd
->
mb_to_right_edge
=
((
pc
->
mb_cols
-
1
-
mb_col
)
*
16
)
<<
3
;
#if CONFIG_ERROR_CONCEALMENT
{
int
corrupt_residual
=
(
!
pbi
->
independent_partitions
&&
pbi
->
frame_corrupt_residual
)
||
vp8dx_bool_error
(
xd
->
current_bc
);
if
(
pbi
->
ec_active
&&
xd
->
mode_info_context
->
mbmi
.
ref_frame
==
INTRA_FRAME
&&
corrupt_residual
)
{
/* We have an intra block with corrupt coefficients, better to
* conceal with an inter block. Interpolate MVs from neighboring
* MBs.
*
* Note that for the first mb with corrupt residual in a frame,
* we might not discover that before decoding the residual. That
* happens after this check, and therefore no inter concealment
* will be done.
*/
vp8_interpolate_motion
(
xd
,
mb_row
,
mb_col
,
pc
->
mb_rows
,
pc
->
mb_cols
,
pc
->
mode_info_stride
);
}
}
#endif
update_blockd_bmi
(
xd
);
xd
->
dst
.
y_buffer
=
pc
->
yv12_fb
[
dst_fb_idx
].
y_buffer
+
recon_yoffset
;
...
...
@@ -821,7 +752,7 @@ static void setup_token_decoder(VP8D_COMP *pbi,
(
TOKEN_PARTITION
)
vp8_read_literal
(
&
pbi
->
bc
,
2
);
/* Only update the multi_token_partition field if we are sure the value
* is correct. */
if
(
!
pbi
->
ec_active
||
!
vp8dx_bool_error
(
&
pbi
->
bc
))
if
(
!
vp8dx_bool_error
(
&
pbi
->
bc
))
pc
->
multi_token_partition
=
multi_token_partition
;
num_part
=
1
<<
pc
->
multi_token_partition
;
...
...
@@ -853,8 +784,6 @@ static void setup_token_decoder(VP8D_COMP *pbi,
{
if
(
read_is_valid
(
partition_size_ptr
,
3
,
user_data_end
))
partition_size
=
read_partition_size
(
partition_size_ptr
);
else
if
(
pbi
->
ec_active
)
partition_size
=
bytes_left
;
else
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_CORRUPT_FRAME
,
"Truncated partition size data"
);
...
...
@@ -868,12 +797,9 @@ static void setup_token_decoder(VP8D_COMP *pbi,
*/
if
(
!
read_is_valid
(
partition
,
partition_size
,
user_data_end
))
{
if
(
pbi
->
ec_active
)
partition_size
=
bytes_left
;
else
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_CORRUPT_FRAME
,
"Truncated packet or corrupt partition "
"%d length"
,
i
+
1
);
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_CORRUPT_FRAME
,
"Truncated packet or corrupt partition "
"%d length"
,
i
+
1
);
}
if
(
vp8dx_start_decode
(
bool_decoder
,
partition
,
partition_size
))
...
...
@@ -970,9 +896,6 @@ static void init_frame(VP8D_COMP *pbi)
xd
->
subpixel_predict_avg8x8
=
SUBPIX_INVOKE
(
RTCD_VTABLE
(
subpix
),
bilinear_avg8x8
);
xd
->
subpixel_predict_avg16x16
=
SUBPIX_INVOKE
(
RTCD_VTABLE
(
subpix
),
bilinear_avg16x16
);
}
if
(
pbi
->
decoded_key_frame
&&
pbi
->
ec_enabled
&&
!
pbi
->
ec_active
)
pbi
->
ec_active
=
1
;
}
xd
->
left_context
=
&
pc
->
left_context
;
...
...
@@ -1014,21 +937,8 @@ int vp8_decode_frame(VP8D_COMP *pbi)
if
(
data_end
-
data
<
3
)
{
if
(
pbi
->
ec_active
)
{
/* Declare the missing frame as an inter frame since it will
be handled as an inter frame when we have estimated its
motion vectors. */
pc
->
frame_type
=
INTER_FRAME
;
pc
->
version
=
0
;
pc
->
show_frame
=
1
;
first_partition_length_in_bytes
=
0
;
}
else
{
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_CORRUPT_FRAME
,
"Truncated packet"
);
}
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_CORRUPT_FRAME
,
"Truncated packet"
);
}
else
{
...
...
@@ -1038,7 +948,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
first_partition_length_in_bytes
=
(
data
[
0
]
|
(
data
[
1
]
<<
8
)
|
(
data
[
2
]
<<
16
))
>>
5
;
if
(
!
pbi
->
ec_active
&&
(
data
+
first_partition_length_in_bytes
>
data_end
if
((
data
+
first_partition_length_in_bytes
>
data_end
||
data
+
first_partition_length_in_bytes
<
data
))
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_CORRUPT_FRAME
,
"Truncated packet or corrupt partition 0 length"
);
...
...
@@ -1056,7 +966,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
/* When error concealment is enabled we should only check the sync
* code if we have enough bits available
*/
if
(
!
pbi
->
ec_active
||
data
+
3
<
data_end
)
if
(
data
+
3
<
data_end
)
{
if
(
data
[
0
]
!=
0x9d
||
data
[
1
]
!=
0x01
||
data
[
2
]
!=
0x2a
)
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_UNSUP_BITSTREAM
,
...
...
@@ -1067,7 +977,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
* if we have enough data. Otherwise we will end up with the wrong
* size.
*/
if
(
!
pbi
->
ec_active
||
data
+
6
<
data_end
)
if
(
data
+
6
<
data_end
)
{
pc
->
Width
=
(
data
[
3
]
|
(
data
[
4
]
<<
8
))
&
0x3fff
;
pc
->
horiz_scale
=
data
[
4
]
>>
6
;
...
...
@@ -1097,18 +1007,6 @@ int vp8_decode_frame(VP8D_COMP *pbi)
if
(
vp8_alloc_frame_buffers
(
pc
,
pc
->
Width
,
pc
->
Height
))
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_MEM_ERROR
,
"Failed to allocate frame buffers"
);
#if CONFIG_ERROR_CONCEALMENT
pbi
->
overlaps
=
NULL
;
if
(
pbi
->
ec_enabled
)
{
if
(
vp8_alloc_overlap_lists
(
pbi
))
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_MEM_ERROR
,
"Failed to allocate overlap lists "
"for error concealment"
);
}
#endif
}
}
}
...
...
@@ -1357,20 +1255,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
{
/* Should the GF or ARF be updated from the current frame */
pc
->
refresh_golden_frame
=
vp8_read_bit
(
bc
);
#if CONFIG_ERROR_CONCEALMENT
/* Assume we shouldn't refresh golden if the bit is missing */
xd
->
corrupted
|=
vp8dx_bool_error
(
bc
);
if
(
pbi
->
ec_active
&&
xd
->
corrupted
)
pc
->
refresh_golden_frame
=
0
;
#endif
pc
->
refresh_alt_ref_frame
=
vp8_read_bit
(
bc
);
#if CONFIG_ERROR_CONCEALMENT
/* Assume we shouldn't refresh altref if the bit is missing */
xd
->
corrupted
|=
vp8dx_bool_error
(
bc
);
if
(
pbi
->
ec_active
&&
xd
->
corrupted
)
pc
->
refresh_alt_ref_frame
=
0
;
#endif
if
(
pc
->
refresh_alt_ref_frame
)