if (s->mb_x) {
topleft_mb_pos = (s->mb_y - 1) * s->mb_stride + s->mb_x - 1;
fieldtx = v->fieldtx_plane[topleft_mb_pos];
- stride_y = (s->linesize) << fieldtx;
+ stride_y = s->linesize << fieldtx;
v_dist = (16 - fieldtx) >> (fieldtx == 0);
s->dsp.put_signed_pixels_clamped(v->block[v->topleft_blk_idx][0],
s->dest[0] - 16 * s->linesize - 16,
uvmy = uvmy - 2 + 4 * v->cur_field_type;
}
- if (v->fastuvmc && (v->fcm != 1)) { // fastuvmc shall be ignored for interlaced frame picture
+ // fastuvmc shall be ignored for interlaced frame picture
+ if (v->fastuvmc && (v->fcm != ILACE_FRAME)) {
uvmx = uvmx + ((uvmx < 0) ? (uvmx & 1) : -(uvmx & 1));
uvmy = uvmy + ((uvmy < 0) ? (uvmy & 1) : -(uvmy & 1));
}
uint8_t *srcY;
int dxy, mx, my, src_x, src_y;
int off;
- int fieldmv = (v->fcm == 1) ? v->blk_mv_type[s->block_index[n]] : 0;
+ int fieldmv = (v->fcm == ILACE_FRAME) ? v->blk_mv_type[s->block_index[n]] : 0;
int v_edge_pos = s->v_edge_pos >> v->field_mode;
if (!v->field_mode && !v->s.last_picture.f.data[0])
v->mv_f[1][s->block_index[k] + v->blocks_off] = f;
}
- if (v->fcm == 1) { // not sure if needed for other types of picture
+ if (v->fcm == ILACE_FRAME) { // not sure if needed for other types of picture
int qx, qy;
int width = s->avctx->coded_width;
int height = s->avctx->coded_height >> 1;
my -= 8 * (qy - height - 1);
}
- if ((v->fcm == 1) && fieldmv)
+ if ((v->fcm == ILACE_FRAME) && fieldmv)
off = ((n > 1) ? s->linesize : 0) + (n & 1) * 8;
else
off = s->linesize * 4 * (n & 2) + (n & 1) * 8;
src_y = av_clip(src_y, -16, s->mb_height * 16);
} else {
src_x = av_clip(src_x, -17, s->avctx->coded_width);
- if (v->fcm == 1) {
+ if (v->fcm == ILACE_FRAME) {
if (src_y & 1)
src_y = av_clip(src_y, -17, s->avctx->coded_height + 1);
else
if (!v->field_mode || (v->field_mode && !v->numref)) {
valid_count = get_chroma_mv(mvx, mvy, intra, 0, &tx, &ty);
if (!valid_count) {
+ s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = 0;
+ s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = 0;
v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0;
return; //no need to do MC for intra blocks
}
if (dominant)
chroma_ref_type = !v->cur_field_type;
}
+ s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx;
+ s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty;
uvmx = (tx + ((tx & 3) == 3)) >> 1;
uvmy = (ty + ((ty & 3) == 3)) >> 1;
int dim, int dir)
{
int brfd, scalesame;
+ int hpel = 1 - v->s.quarter_sample;
+ n >>= hpel;
if (v->s.pict_type != AV_PICTURE_TYPE_B || v->second_field || !dir) {
if (dim)
- return scaleforsame_y(v, i, n, dir);
+ n = scaleforsame_y(v, i, n, dir) << hpel;
else
- return scaleforsame_x(v, n, dir);
+ n = scaleforsame_x(v, n, dir) << hpel;
+ return n;
}
brfd = FFMIN(v->brfd, 3);
scalesame = vc1_b_field_mvpred_scales[0][brfd];
- return n * scalesame >> 8;
+ n = (n * scalesame >> 8) << hpel;
+ return n;
}
static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */,
int dim, int dir)
{
int refdist, scaleopp;
+ int hpel = 1 - v->s.quarter_sample;
+ n >>= hpel;
if (v->s.pict_type == AV_PICTURE_TYPE_B && !v->second_field && dir == 1) {
if (dim)
- return scaleforopp_y(v, n, dir);
+ n = scaleforopp_y(v, n, dir) << hpel;
else
- return scaleforopp_x(v, n);
+ n = scaleforopp_x(v, n) << hpel;
+ return n;
}
if (v->s.pict_type != AV_PICTURE_TYPE_B)
refdist = FFMIN(v->refdist, 3);
refdist = dir ? v->brfd : v->frfd;
scaleopp = vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
- return n * scaleopp >> 8;
+ n = (n * scaleopp >> 8) << hpel;
+ return n;
}
/** Predict and set motion vector
int px, py;
int sum;
int mixedmv_pic, num_samefield = 0, num_oppfield = 0;
- int opposit, f;
- int16_t samefield_pred[2], oppfield_pred[2];
- int16_t samefield_predA[2], oppfield_predA[2];
- int16_t samefield_predB[2], oppfield_predB[2];
- int16_t samefield_predC[2], oppfield_predC[2];
- int16_t *predA, *predC;
+ int opposit, a_f, b_f, c_f;
+ int16_t field_predA[2];
+ int16_t field_predB[2];
+ int16_t field_predC[2];
int a_valid, b_valid, c_valid;
int hybridmv_thresh, y_bias = 0;
}
if (a_valid) {
- f = v->mv_f[dir][xy - wrap + v->blocks_off];
- num_oppfield += f;
- num_samefield += 1 - f;
- if (f) {
- oppfield_predA[0] = A[0];
- oppfield_predA[1] = A[1];
- samefield_predA[0] = scaleforsame(v, 0, A[0], 0, dir);
- samefield_predA[1] = scaleforsame(v, n, A[1], 1, dir);
- } else {
- samefield_predA[0] = A[0];
- samefield_predA[1] = A[1];
- if (v->numref)
- oppfield_predA[0] = scaleforopp(v, A[0], 0, dir);
- if (v->numref)
- oppfield_predA[1] = scaleforopp(v, A[1], 1, dir);
- }
+ a_f = v->mv_f[dir][xy - wrap + v->blocks_off];
+ num_oppfield += a_f;
+ num_samefield += 1 - a_f;
+ field_predA[0] = A[0];
+ field_predA[1] = A[1];
} else {
- samefield_predA[0] = samefield_predA[1] = 0;
- oppfield_predA[0] = oppfield_predA[1] = 0;
- }
- if (c_valid) {
- f = v->mv_f[dir][xy - 1 + v->blocks_off];
- num_oppfield += f;
- num_samefield += 1 - f;
- if (f) {
- oppfield_predC[0] = C[0];
- oppfield_predC[1] = C[1];
- samefield_predC[0] = scaleforsame(v, 0, C[0], 0, dir);
- samefield_predC[1] = scaleforsame(v, n, C[1], 1, dir);
- } else {
- samefield_predC[0] = C[0];
- samefield_predC[1] = C[1];
- if (v->numref)
- oppfield_predC[0] = scaleforopp(v, C[0], 0, dir);
- if (v->numref)
- oppfield_predC[1] = scaleforopp(v, C[1], 1, dir);
- }
- } else {
- samefield_predC[0] = samefield_predC[1] = 0;
- oppfield_predC[0] = oppfield_predC[1] = 0;
+ field_predA[0] = field_predA[1] = 0;
+ a_f = 0;
}
if (b_valid) {
- f = v->mv_f[dir][xy - wrap + off + v->blocks_off];
- num_oppfield += f;
- num_samefield += 1 - f;
- if (f) {
- oppfield_predB[0] = B[0];
- oppfield_predB[1] = B[1];
- samefield_predB[0] = scaleforsame(v, 0, B[0], 0, dir);
- samefield_predB[1] = scaleforsame(v, n, B[1], 1, dir);
- } else {
- samefield_predB[0] = B[0];
- samefield_predB[1] = B[1];
- if (v->numref)
- oppfield_predB[0] = scaleforopp(v, B[0], 0, dir);
- if (v->numref)
- oppfield_predB[1] = scaleforopp(v, B[1], 1, dir);
- }
+ b_f = v->mv_f[dir][xy - wrap + off + v->blocks_off];
+ num_oppfield += b_f;
+ num_samefield += 1 - b_f;
+ field_predB[0] = B[0];
+ field_predB[1] = B[1];
} else {
- samefield_predB[0] = samefield_predB[1] = 0;
- oppfield_predB[0] = oppfield_predB[1] = 0;
+ field_predB[0] = field_predB[1] = 0;
+ b_f = 0;
}
-
- if (a_valid) {
- samefield_pred[0] = samefield_predA[0];
- samefield_pred[1] = samefield_predA[1];
- oppfield_pred[0] = oppfield_predA[0];
- oppfield_pred[1] = oppfield_predA[1];
- } else if (c_valid) {
- samefield_pred[0] = samefield_predC[0];
- samefield_pred[1] = samefield_predC[1];
- oppfield_pred[0] = oppfield_predC[0];
- oppfield_pred[1] = oppfield_predC[1];
- } else if (b_valid) {
- samefield_pred[0] = samefield_predB[0];
- samefield_pred[1] = samefield_predB[1];
- oppfield_pred[0] = oppfield_predB[0];
- oppfield_pred[1] = oppfield_predB[1];
+ if (c_valid) {
+ c_f = v->mv_f[dir][xy - 1 + v->blocks_off];
+ num_oppfield += c_f;
+ num_samefield += 1 - c_f;
+ field_predC[0] = C[0];
+ field_predC[1] = C[1];
} else {
- samefield_pred[0] = samefield_pred[1] = 0;
- oppfield_pred[0] = oppfield_pred[1] = 0;
- }
-
- if (num_samefield + num_oppfield > 1) {
- samefield_pred[0] = mid_pred(samefield_predA[0], samefield_predB[0], samefield_predC[0]);
- samefield_pred[1] = mid_pred(samefield_predA[1], samefield_predB[1], samefield_predC[1]);
- if (v->numref)
- oppfield_pred[0] = mid_pred(oppfield_predA[0], oppfield_predB[0], oppfield_predC[0]);
- if (v->numref)
- oppfield_pred[1] = mid_pred(oppfield_predA[1], oppfield_predB[1], oppfield_predC[1]);
+ field_predC[0] = field_predC[1] = 0;
+ c_f = 0;
}
if (v->field_mode) {
} else
opposit = 0;
if (opposit) {
- px = oppfield_pred[0];
- py = oppfield_pred[1];
- predA = oppfield_predA;
- predC = oppfield_predC;
- v->mv_f[dir][xy + v->blocks_off] = f = 1;
+ if (a_valid && !a_f) {
+ field_predA[0] = scaleforopp(v, field_predA[0], 0, dir);
+ field_predA[1] = scaleforopp(v, field_predA[1], 1, dir);
+ }
+ if (b_valid && !b_f) {
+ field_predB[0] = scaleforopp(v, field_predB[0], 0, dir);
+ field_predB[1] = scaleforopp(v, field_predB[1], 1, dir);
+ }
+ if (c_valid && !c_f) {
+ field_predC[0] = scaleforopp(v, field_predC[0], 0, dir);
+ field_predC[1] = scaleforopp(v, field_predC[1], 1, dir);
+ }
+ v->mv_f[dir][xy + v->blocks_off] = 1;
v->ref_field_type[dir] = !v->cur_field_type;
} else {
- px = samefield_pred[0];
- py = samefield_pred[1];
- predA = samefield_predA;
- predC = samefield_predC;
- v->mv_f[dir][xy + v->blocks_off] = f = 0;
+ if (a_valid && a_f) {
+ field_predA[0] = scaleforsame(v, n, field_predA[0], 0, dir);
+ field_predA[1] = scaleforsame(v, n, field_predA[1], 1, dir);
+ }
+ if (b_valid && b_f) {
+ field_predB[0] = scaleforsame(v, n, field_predB[0], 0, dir);
+ field_predB[1] = scaleforsame(v, n, field_predB[1], 1, dir);
+ }
+ if (c_valid && c_f) {
+ field_predC[0] = scaleforsame(v, n, field_predC[0], 0, dir);
+ field_predC[1] = scaleforsame(v, n, field_predC[1], 1, dir);
+ }
+ v->mv_f[dir][xy + v->blocks_off] = 0;
v->ref_field_type[dir] = v->cur_field_type;
}
+ if (a_valid) {
+ px = field_predA[0];
+ py = field_predA[1];
+ } else if (c_valid) {
+ px = field_predC[0];
+ py = field_predC[1];
+ } else if (b_valid) {
+ px = field_predB[0];
+ py = field_predB[1];
+ } else {
+ px = 0;
+ py = 0;
+ }
+
+ if (num_samefield + num_oppfield > 1) {
+ px = mid_pred(field_predA[0], field_predB[0], field_predC[0]);
+ py = mid_pred(field_predA[1], field_predB[1], field_predC[1]);
+ }
+
/* Pullback MV as specified in 8.3.5.3.4 */
if (!v->field_mode) {
int qx, qy, X, Y;
if (!v->field_mode || s->pict_type != AV_PICTURE_TYPE_B) {
/* Calculate hybrid prediction as specified in 8.3.5.3.5 (also 10.3.5.4.3.5) */
- if (v->field_mode && !s->quarter_sample)
- hybridmv_thresh = 16;
- else
- hybridmv_thresh = 32;
+ hybridmv_thresh = 32;
if (a_valid && c_valid) {
if (is_intra[xy - wrap])
sum = FFABS(px) + FFABS(py);
else
- sum = FFABS(px - predA[0]) + FFABS(py - predA[1]);
+ sum = FFABS(px - field_predA[0]) + FFABS(py - field_predA[1]);
if (sum > hybridmv_thresh) {
if (get_bits1(&s->gb)) { // read HYBRIDPRED bit
- px = predA[0];
- py = predA[1];
+ px = field_predA[0];
+ py = field_predA[1];
} else {
- px = predC[0];
- py = predC[1];
+ px = field_predC[0];
+ py = field_predC[1];
}
} else {
if (is_intra[xy - 1])
sum = FFABS(px) + FFABS(py);
else
- sum = FFABS(px - predC[0]) + FFABS(py - predC[1]);
+ sum = FFABS(px - field_predC[0]) + FFABS(py - field_predC[1]);
if (sum > hybridmv_thresh) {
if (get_bits1(&s->gb)) {
- px = predA[0];
- py = predA[1];
+ px = field_predA[0];
+ py = field_predA[1];
} else {
- px = predC[0];
- py = predC[1];
+ px = field_predC[0];
+ py = field_predC[1];
}
}
}
int k;
if (v->s.ac_pred) {
- if (!use_pred && v->fcm == 1) {
+ if (!use_pred && v->fcm == ILACE_FRAME) {
zz_table = v->zzi_8x8;
} else {
if (!dc_pred_dir) // top
zz_table = v->zz_8x8[3];
}
} else {
- if (v->fcm != 1)
+ if (v->fcm != ILACE_FRAME)
zz_table = v->zz_8x8[1];
else
zz_table = v->zzi_8x8;
i += skip;
if (i > 63)
break;
- if (v->fcm == 0)
+ if (v->fcm == PROGRESSIVE)
block[v->zz_8x8[0][i++]] = value;
else {
- if (use_pred && (v->fcm == 1)) {
+ if (use_pred && (v->fcm == ILACE_FRAME)) {
if (!dc_pred_dir) // top
block[v->zz_8x8[2][i++]] = value;
else // left
i += skip;
if (i > 63)
break;
- if (!v->interlace)
+ if (!v->fcm)
idx = v->zz_8x8[0][i++];
else
idx = v->zzi_8x8[i++];
i += skip;
if (i > 15)
break;
- if (!v->interlace)
+ if (!v->fcm)
idx = ff_vc1_simple_progressive_4x4_zz[i++];
else
idx = ff_vc1_adv_interlaced_4x4_zz[i++];
i += skip;
if (i > 31)
break;
- if (!v->interlace)
+ if (!v->fcm)
idx = v->zz_8x4[i++] + off;
else
idx = ff_vc1_adv_interlaced_8x4_zz[i++] + off;
i += skip;
if (i > 31)
break;
- if (!v->interlace)
+ if (!v->fcm)
idx = v->zz_4x8[i++] + off;
else
idx = ff_vc1_adv_interlaced_4x8_zz[i++] + off;
vc1_apply_p_v_loop_filter(v, i);
}
- /* V always preceedes H, therefore we run H one MB before V;
+ /* V always precedes H, therefore we run H one MB before V;
* at the end of a row, we catch up to complete the row */
if (s->mb_x) {
for (i = 0; i < 6; i++) {
int skipped, fourmv;
int block_cbp = 0, pat, block_tt = 0, block_intra = 0;
- mquant = v->pq; /* Loosy initialization */
+ mquant = v->pq; /* lossy initialization */
if (v->mv_type_is_raw)
fourmv = get_bits1(gb);
int dmv_x[2], dmv_y[2];
int bmvtype = BMV_TYPE_BACKWARD;
- mquant = v->pq; /* Loosy initialization */
+ mquant = v->pq; /* lossy initialization */
s->mb_intra = 0;
if (v->dmb_is_raw)
if (v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq);
if (get_bits_count(&s->gb) > v->bits) {
- ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
+ ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, ER_MB_ERROR);
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n",
get_bits_count(&s->gb), v->bits);
return;
}
if (v->s.loop_filter)
ff_draw_horiz_band(s, (s->mb_height - 1) * 16, 16);
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, ER_MB_END);
}
/** Decode blocks of I-frame for advanced profile
if (get_bits_count(&s->gb) > v->bits) {
// TODO: may need modification to handle slice coding
- ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
+ ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR);
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n",
get_bits_count(&s->gb), v->bits);
return;
if (v->s.loop_filter)
ff_draw_horiz_band(s, (s->end_mb_y-1)*16, 16);
ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1,
- (s->end_mb_y << v->field_mode) - 1, (AC_END|DC_END|MV_END));
+ (s->end_mb_y << v->field_mode) - 1, ER_MB_END);
}
static void vc1_decode_p_blocks(VC1Context *v)
for (; s->mb_x < s->mb_width; s->mb_x++) {
ff_update_block_index(s);
- if (v->fcm == 2)
+ if (v->fcm == ILACE_FIELD)
vc1_decode_p_mb_intfi(v);
- else if (v->fcm == 1)
+ else if (v->fcm == ILACE_FRAME)
vc1_decode_p_mb_intfr(v);
else vc1_decode_p_mb(v);
- if (s->mb_y != s->start_mb_y && apply_loop_filter && v->fcm == 0)
+ if (s->mb_y != s->start_mb_y && apply_loop_filter && v->fcm == PROGRESSIVE)
vc1_apply_p_loop_filter(v);
if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
// TODO: may need modification to handle slice coding
- ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
+ ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR);
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n",
get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y);
return;
if (s->end_mb_y >= s->start_mb_y)
ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1,
- (s->end_mb_y << v->field_mode) - 1, (AC_END|DC_END|MV_END));
+ (s->end_mb_y << v->field_mode) - 1, ER_MB_END);
}
static void vc1_decode_b_blocks(VC1Context *v)
for (; s->mb_x < s->mb_width; s->mb_x++) {
ff_update_block_index(s);
- if (v->fcm == 2)
+ if (v->fcm == ILACE_FIELD)
vc1_decode_b_mb_intfi(v);
else
vc1_decode_b_mb(v);
if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
// TODO: may need modification to handle slice coding
- ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
+ ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR);
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n",
get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y);
return;
if (v->s.loop_filter)
ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1,
- (s->end_mb_y << v->field_mode) - 1, (AC_END|DC_END|MV_END));
+ (s->end_mb_y << v->field_mode) - 1, ER_MB_END);
}
static void vc1_decode_skip_blocks(VC1Context *v)
{
MpegEncContext *s = &v->s;
- ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (AC_END|DC_END|MV_END));
+ ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, ER_MB_END);
s->first_slice_line = 1;
for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) {
s->mb_x = 0;
MpegEncContext *s = &v->s;
AVFrame *pict = data;
uint8_t *buf2 = NULL;
- uint8_t *buf_field2 = NULL;
const uint8_t *buf_start = buf;
int mb_height, n_slices1;
struct {
uint8_t *buf;
GetBitContext gb;
int mby_start;
- } *slices = NULL;
+ } *slices = NULL, *tmp;
/* no supplementary picture */
if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) {
slices[n_slices].mby_start = s->mb_height >> 1;
n_slices1 = n_slices - 1; // index of the last slice of the first field
n_slices++;
- // not necessary, ad hoc until I find a way to handle WVC1i
- buf_field2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- vc1_unescape_buffer(start + 4, size, buf_field2);
break;
}
case VC1_CODE_ENTRYPOINT: /* it should be before frame data */
}
} else if (v->interlace && ((buf[0] & 0xC0) == 0xC0)) { /* WVC1 interlaced stores both fields divided by marker */
const uint8_t *divider;
+ int buf_size3;
divider = find_next_marker(buf, buf + buf_size);
if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) {
av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n");
goto err;
} else { // found field marker, unescape second field
- buf_field2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, buf_field2);
+ tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1));
+ if (!tmp)
+ goto err;
+ slices = tmp;
+ slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!slices[n_slices].buf)
+ goto err;
+ buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf);
+ init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,
+ buf_size3 << 3);
+ slices[n_slices].mby_start = s->mb_height >> 1;
+ n_slices1 = n_slices - 1;
+ n_slices++;
}
buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2);
} else {
* otherwise we cannot store anything in there. */
if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
int i = ff_find_unused_picture(s, 0);
+ if (i < 0)
+ goto err;
s->current_picture_ptr = &s->picture[i];
}
s->gb = slices[i].gb;
}
if (v->field_mode) {
- av_free(buf_field2);
v->second_field = 0;
- }
- if (v->field_mode) {
if (s->pict_type == AV_PICTURE_TYPE_B) {
memcpy(v->mv_f_base, v->mv_f_next_base,
2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2));
for (i = 0; i < n_slices; i++)
av_free(slices[i].buf);
av_free(slices);
- av_free(buf_field2);
return -1;
}