#include "h264chroma.h"
#include "internal.h"
#include "mathops.h"
+#include "mpegutils.h"
#include "mpegvideo.h"
#include "mjpegenc.h"
#include "msmpeg4.h"
mpeg2_dc_scale_table3,
};
-const enum AVPixelFormat ff_pixfmt_list_420[] = {
- AV_PIX_FMT_YUV420P,
- AV_PIX_FMT_NONE
-};
-
static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
int16_t *block, int n, int qscale)
{
else MPV_decode_mb_internal(s, block, 0, 0);
}
-/**
- * @param h is the normal height, this will be reduced automatically if needed for the last row
- */
-void ff_draw_horiz_band(AVCodecContext *avctx, Picture *cur,
- Picture *last, int y, int h, int picture_structure,
- int first_field, int low_delay)
-{
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
- int vshift = desc->log2_chroma_h;
- const int field_pic = picture_structure != PICT_FRAME;
- if(field_pic){
- h <<= 1;
- y <<= 1;
- }
-
- h = FFMIN(h, avctx->height - y);
-
- if(field_pic && first_field && !(avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
-
- if (avctx->draw_horiz_band) {
- AVFrame *src;
- int offset[AV_NUM_DATA_POINTERS];
- int i;
-
- if(cur->f.pict_type == AV_PICTURE_TYPE_B || low_delay ||
- (avctx->slice_flags & SLICE_FLAG_CODED_ORDER))
- src = &cur->f;
- else if (last)
- src = &last->f;
- else
- return;
-
- if (cur->f.pict_type == AV_PICTURE_TYPE_B &&
- picture_structure == PICT_FRAME &&
- avctx->codec_id != AV_CODEC_ID_SVQ3) {
- for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
- offset[i] = 0;
- }else{
- offset[0]= y * src->linesize[0];
- offset[1]=
- offset[2]= (y >> vshift) * src->linesize[1];
- for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
- offset[i] = 0;
- }
-
- emms_c();
-
- avctx->draw_horiz_band(avctx, src, offset,
- y, picture_structure, h);
- }
-}
-
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
{
- ff_draw_horiz_band(s->avctx, s->current_picture_ptr,
- s->last_picture_ptr, y, h, s->picture_structure,
+ ff_draw_horiz_band(s->avctx, &s->current_picture_ptr->f,
+ &s->last_picture_ptr->f, y, h, s->picture_structure,
s->first_field, s->low_delay);
}
}
#if CONFIG_ERROR_RESILIENCE
+void ff_mpeg_set_erpic(ERPicture *dst, Picture *src)
+{
+ int i;
+
+ memset(dst, 0, sizeof(*dst));
+ if (!src)
+ return;
+
+ dst->f = &src->f;
+ dst->tf = &src->tf;
+
+ for (i = 0; i < 2; i++) {
+ dst->motion_val[i] = src->motion_val[i];
+ dst->ref_index[i] = src->ref_index[i];
+ }
+
+ dst->mb_type = src->mb_type;
+ dst->field_picture = src->field_picture;
+}
+
void ff_mpeg_er_frame_start(MpegEncContext *s)
{
ERContext *er = &s->er;
- er->cur_pic = s->current_picture_ptr;
- er->last_pic = s->last_picture_ptr;
- er->next_pic = s->next_picture_ptr;
+ ff_mpeg_set_erpic(&er->cur_pic, s->current_picture_ptr);
+ ff_mpeg_set_erpic(&er->next_pic, s->next_picture_ptr);
+ ff_mpeg_set_erpic(&er->last_pic, s->last_picture_ptr);
er->pp_time = s->pp_time;
er->pb_time = s->pb_time;