aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorStefan Gehrer <stefan.gehrer@gmx.de>2009-02-10 20:51:35 +0000
committerStefan Gehrer <stefan.gehrer@gmx.de>2009-02-10 20:51:35 +0000
commitb9fce052053b230745c7a4dd097e93b03f94af71 (patch)
tree83d3082931ec848efd8d0b9b8d5ac575cf6b80a4 /libavcodec
parent4ca6f4b29c23747a6ea9b3e6151f254d0fa2d0d9 (diff)
downloadffmpeg-b9fce052053b230745c7a4dd097e93b03f94af71.tar.gz
fix multiple slices per frame
Originally committed as revision 17137 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/cavs.c2
-rw-r--r--libavcodec/cavsdec.c12
2 files changed, 11 insertions, 3 deletions
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index 6bb0f48e97..61f24f72cc 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -608,8 +608,6 @@ int ff_cavs_next_mb(AVSContext *h) {
h->cv = h->picture.data[2] + h->mby*8*h->c_stride;
if(h->mby == h->mb_height) { //frame end
return 0;
- } else {
- //check_for_slice(h);
}
}
return 1;
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 9e49589156..5f274a4446 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -415,6 +415,9 @@ static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) {
if(h->stc > 0xAF)
av_log(h->s.avctx, AV_LOG_ERROR, "unexpected start code 0x%02x\n", h->stc);
h->mby = h->stc;
+
+ /* mark top macroblocks as unavailable */
+ h->flags &= ~(B_AVAIL|C_AVAIL);
if((h->mby == 0) && (!h->qp_fixed)){
h->qp_fixed = get_bits1(gb);
h->qp = get_bits(gb,6);
@@ -431,6 +434,9 @@ static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) {
static inline void check_for_slice(AVSContext *h) {
GetBitContext *gb = &h->s.gb;
int align;
+
+ if(h->mbx)
+ return;
align = (-get_bits_count(gb)) & 7;
if((show_bits_long(gb,24+align) & 0xFFFFFF) == 0x000001) {
skip_bits_long(gb,24+align);
@@ -525,13 +531,14 @@ static int decode_pic(AVSContext *h) {
} else {
h->alpha_offset = h->beta_offset = 0;
}
- check_for_slice(h);
if(h->pic_type == FF_I_TYPE) {
do {
+ check_for_slice(h);
decode_mb_i(h, 0);
} while(ff_cavs_next_mb(h));
} else if(h->pic_type == FF_P_TYPE) {
do {
+ check_for_slice(h);
if(h->skip_mode_flag) {
skip_count = get_ue_golomb(&s->gb);
while(skip_count--) {
@@ -539,6 +546,7 @@ static int decode_pic(AVSContext *h) {
if(!ff_cavs_next_mb(h))
goto done;
}
+ check_for_slice(h);
mb_type = get_ue_golomb(&s->gb) + P_16X16;
} else
mb_type = get_ue_golomb(&s->gb) + P_SKIP;
@@ -549,6 +557,7 @@ static int decode_pic(AVSContext *h) {
} while(ff_cavs_next_mb(h));
} else { /* FF_B_TYPE */
do {
+ check_for_slice(h);
if(h->skip_mode_flag) {
skip_count = get_ue_golomb(&s->gb);
while(skip_count--) {
@@ -556,6 +565,7 @@ static int decode_pic(AVSContext *h) {
if(!ff_cavs_next_mb(h))
goto done;
}
+ check_for_slice(h);
mb_type = get_ue_golomb(&s->gb) + B_DIRECT;
} else
mb_type = get_ue_golomb(&s->gb) + B_SKIP;