From: Xiang, Haihao Date: Mon, 26 Nov 2012 08:05:38 +0000 (+0800) Subject: mpeg2enc: Fix the period between I frames X-Git-Tag: libva-1.2.0~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11f0b90bd7b6c234348d7e7fe2979b3836aa8164;p=platform%2Fupstream%2Flibva.git mpeg2enc: Fix the period between I frames 1 for mode 0, and 16 for mode 1 and mode 2. Also temporarily assert mode 1 and mode 2 Signed-off-by: Xiang, Haihao --- diff --git a/test/encode/mpeg2enc.c b/test/encode/mpeg2enc.c index dd81742..ff5bcce 100644 --- a/test/encode/mpeg2enc.c +++ b/test/encode/mpeg2enc.c @@ -62,8 +62,6 @@ exit(1); \ } -#define INTRA_PERIOD 30 - static int const picture_type_patter[][2] = {{VAEncPictureTypeIntra, 1}, {VAEncPictureTypePredictive, 3}, {VAEncPictureTypePredictive, 3},{VAEncPictureTypePredictive, 3}, {VAEncPictureTypePredictive, 3}, {VAEncPictureTypePredictive, 3},{VAEncPictureTypePredictive, 3}, @@ -791,7 +789,12 @@ mpeg2enc_init(struct mpeg2enc_context *ctx) ctx->codedbuf_buf_id = VA_INVALID_ID; ctx->codedbuf_i_size = ctx->frame_size; ctx->codedbuf_pb_size = 0; - ctx->intra_period = INTRA_PERIOD; + + if (ctx->mode == 0) + ctx->intra_period = 1; + else + ctx->intra_period = 16; + ctx->bit_rate = -1; for (i = 0; i < MAX_SLICES; i++) { @@ -1208,10 +1211,9 @@ static void mpeg2enc_run(struct mpeg2enc_context *ctx) { int display_order = 0, coded_order = 0; - int i_frame_only = 1, i_p_frame_only = 1; for (display_order = 0; display_order < ctx->num_pictures;) { - if (i_frame_only) { + if (ctx->mode == 0) { encode_picture(ctx, coded_order, display_order, @@ -1220,7 +1222,8 @@ mpeg2enc_run(struct mpeg2enc_context *ctx) display_order + 1); display_order++; coded_order++; - } else if (i_p_frame_only) { + } else if (ctx->mode == 1) { + assert(0); if ((display_order % ctx->intra_period) == 0) { encode_picture(ctx, coded_order, @@ -1243,6 +1246,8 @@ mpeg2enc_run(struct mpeg2enc_context *ctx) } else { // follow the i,p,b pattern static int fcurrent = 0; int fnext; + + assert(0); fcurrent = fcurrent % (sizeof(picture_type_patter)/sizeof(int[2])); fnext = (fcurrent+1) % (sizeof(picture_type_patter)/sizeof(int[2]));