int has_stereo3d;
uint8_t *a53_caption;
int a53_caption_size;
+ uint8_t afd;
+ int has_afd;
int slice_count;
int save_aspect_info;
int save_width, save_height, save_progressive_seq;
{
Mpeg1Context *s = avctx->priv_data;
MpegEncContext *s2 = &s->mpeg_enc_ctx;
- int i;
-
- /* we need some permutation to store matrices,
- * until MPV_common_init() sets the real permutation. */
- for (i = 0; i < 64; i++)
- s2->idsp.idct_permutation[i] = i;
- ff_MPV_decode_defaults(s2);
+ ff_mpv_decode_defaults(s2);
+ ff_mpv_decode_init(s2, avctx);
s->mpeg_enc_ctx.avctx = avctx;
- s->mpeg_enc_ctx.flags = avctx->flags;
- s->mpeg_enc_ctx.flags2 = avctx->flags2;
+
+ /* we need some permutation to store matrices,
+ * until the decoder sets the real permutation. */
+ ff_mpv_idct_init(s2);
ff_mpeg12_common_init(&s->mpeg_enc_ctx);
ff_mpeg12_init_vlcs();
if (s1->mpeg_enc_ctx_allocated) {
ParseContext pc = s->parse_context;
s->parse_context.buffer = 0;
- ff_MPV_common_end(s);
+ ff_mpv_common_end(s);
s->parse_context = pc;
s1->mpeg_enc_ctx_allocated = 0;
}
* if DCT permutation is changed. */
memcpy(old_permutation, s->idsp.idct_permutation, 64 * sizeof(uint8_t));
- if (ff_MPV_common_init(s) < 0)
+ ff_mpv_idct_init(s);
+ if (ff_mpv_common_init(s) < 0)
return -2;
quant_matrix_rebuild(s->intra_matrix, old_permutation, s->idsp.idct_permutation);
if (s->first_field || s->picture_structure == PICT_FRAME) {
AVFrameSideData *pan_scan;
- if (ff_MPV_frame_start(s, avctx) < 0)
+ if (ff_mpv_frame_start(s, avctx) < 0)
return -1;
ff_mpeg_er_frame_start(s);
*stereo = s1->stereo3d;
s1->has_stereo3d = 0;
}
+
+ if (s1->has_afd) {
+ AVFrameSideData *sd =
+ av_frame_new_side_data(s->current_picture_ptr->f,
+ AV_FRAME_DATA_AFD, 1);
+ if (!sd)
+ return AVERROR(ENOMEM);
+
+ *sd->data = s1->afd;
+ s1->has_afd = 0;
+ }
+
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME))
ff_thread_finish_setup(avctx);
} else { // second field
s->dest[1] +=(16 >> lowres) >> s->chroma_x_shift;
s->dest[2] +=(16 >> lowres) >> s->chroma_x_shift;
- ff_MPV_decode_mb(s, s->block);
+ ff_mpv_decode_mb(s, s->block);
if (++s->mb_x >= s->mb_width) {
const int mb_size = 16 >> s->avctx->lowres;
ff_mpeg_draw_horiz_band(s, mb_size * (s->mb_y >> field_pic), mb_size);
- ff_MPV_report_decode_progress(s);
+ ff_mpv_report_decode_progress(s);
s->mb_x = 0;
s->mb_y += 1 << field_pic;
} else
goto eos;
}
+ // There are some files out there which are missing the last slice
+ // in cases where the slice is completely outside the visible
+ // area, we detect this here instead of running into the end expecting
+ // more data
if (s->mb_y >= ((s->height + 15) >> 4) &&
s->progressive_frame &&
!s->progressive_sequence &&
ff_er_frame_end(&s->er);
- ff_MPV_frame_end(s);
+ ff_mpv_frame_end(s);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
int ret = av_frame_ref(pict, s->current_picture_ptr->f);
s->picture_number++;
/* latency of 1 frame for I- and P-frames */
/* XXX: use another variable than picture_number */
- if (s->last_picture_ptr != NULL) {
+ if (s->last_picture_ptr) {
int ret = av_frame_ref(pict, s->last_picture_ptr->f);
if (ret < 0)
return ret;
/* start new MPEG-1 context decoding */
s->out_format = FMT_MPEG1;
if (s1->mpeg_enc_ctx_allocated) {
- ff_MPV_common_end(s);
+ ff_mpv_common_end(s);
s1->mpeg_enc_ctx_allocated = 0;
}
s->width = avctx->coded_width;
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
setup_hwaccel_for_pixfmt(avctx);
- if (ff_MPV_common_init(s) < 0)
+ ff_mpv_idct_init(s);
+ if (ff_mpv_common_init(s) < 0)
return -1;
s1->mpeg_enc_ctx_allocated = 1;
{
Mpeg1Context *s = avctx->priv_data;
const uint8_t *buf_end = p + buf_size;
+ Mpeg1Context *s1 = avctx->priv_data;
if (buf_size > 29){
int i;
if (flags & 0x40) {
if (buf_end - p < 1)
return;
+#if FF_API_AFD
+FF_DISABLE_DEPRECATION_WARNINGS
avctx->dtg_active_format = p[0] & 0x0f;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_AFD */
+ s1->has_afd = 1;
+ s1->afd = p[0] & 0x0f;
}
} else if (buf_end - p >= 6 &&
p[0] == 'J' && p[1] == 'P' && p[2] == '3' && p[3] == 'D' &&
S3D_video_format_type == 0x04 ||
S3D_video_format_type == 0x08 ||
S3D_video_format_type == 0x23) {
- Mpeg1Context *s1 = avctx->priv_data;
s1->has_stereo3d = 1;
return -1;
}
- if (s2->last_picture_ptr == NULL) {
+ if (!s2->last_picture_ptr) {
/* Skip B-frames if we do not have reference frames and
* GOP is not closed. */
if (s2->pict_type == AV_PICTURE_TYPE_B) {
}
if (s2->pict_type == AV_PICTURE_TYPE_I || (s2->flags2 & CODEC_FLAG2_SHOW_ALL))
s->sync = 1;
- if (s2->next_picture_ptr == NULL) {
+ if (!s2->next_picture_ptr) {
/* Skip P-frames if we do not have a reference frame or
* we have an invalid header. */
if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) {
Mpeg1Context *s = avctx->priv_data;
if (s->mpeg_enc_ctx_allocated)
- ff_MPV_common_end(&s->mpeg_enc_ctx);
+ ff_mpv_common_end(&s->mpeg_enc_ctx);
av_freep(&s->a53_caption);
return 0;
}