summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-12-25 18:34:02 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-12-25 18:34:02 +0000
commite8501c93b58d93505adaaaaf6d99595a9f33949c (patch)
tree72a85db1b3dd71efabbbffd7d26becf5ecde6cc9 /libavcodec
parentc9ab8df88a51821ceec673e74437817a937cb708 (diff)
support downscaling frames for dynamic b frame decission
Originally committed as revision 4776 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h7
-rw-r--r--libavcodec/mpegvideo.c5
-rw-r--r--libavcodec/utils.c1
3 files changed, 11 insertions, 2 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e09351f94b..0c810aa40f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1869,6 +1869,13 @@ typedef struct AVCodecContext {
* - decoding: unused
*/
int bidir_refine;
+
+ /**
+ *
+ * - encoding: set by user.
+ * - decoding: unused
+ */
+ int brd_scale;
} AVCodecContext;
/**
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 2b7718cca2..731a502c25 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -2145,9 +2145,9 @@ static int estimate_best_b_count(MpegEncContext *s){
AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
AVCodecContext *c= avcodec_alloc_context();
AVFrame input[FF_MAX_B_FRAMES+2];
- const int scale= 0;
+ const int scale= s->avctx->brd_scale;
int i, j, out_size;
- int outbuf_size= (s->width * s->height) >> (2*scale); //FIXME
+ int outbuf_size= s->width * s->height; //FIXME
uint8_t *outbuf= av_malloc(outbuf_size);
ImgReSampleContext *resample;
int64_t best_rd= INT64_MAX;
@@ -2198,6 +2198,7 @@ static int estimate_best_b_count(MpegEncContext *s){
input[0].pict_type= I_TYPE;
input[0].quality= 2 * FF_QP2LAMBDA;
out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[0]);
+ rd += (out_size * lambda2) >> FF_LAMBDA_SHIFT;
for(i=0; i<s->max_b_frames+1; i++){
int is_p= i % (j+1) == j || i==s->max_b_frames;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index a0e97ca7ca..28fd5804ae 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -708,6 +708,7 @@ static AVOption options[]={
{"mb_lmax", NULL, OFFSET(mb_lmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
{"me_penalty_compensation", NULL, OFFSET(me_penalty_compensation), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
{"bidir_refine", NULL, OFFSET(bidir_refine), FF_OPT_TYPE_INT, DEFAULT, 0, 4, V|E},
+{"brd_scale", NULL, OFFSET(brd_scale), FF_OPT_TYPE_INT, DEFAULT, 0, 10, V|E},
{NULL},
};