Re: [FFmpeg-devel] [PATCH] ffplay: add scale_subtitles option to allow disabling the scaling

2015-07-30 Thread Marton Balint


On Wed, 29 Jul 2015, Michael Niedermayer wrote:


From: Michael Niedermayer mich...@niedermayer.cc

This theoretically is faster and might be useful on some low end embeded systems


This issue seems quite theoretical to me. Scaling happens only once per 
subtitle, usually no more often than once per second. I'd say let's wait 
until somebody actually want this for a real use-case and apply it then.


Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] ffplay: add scale_subtitles option to allow disabling the scaling

2015-07-29 Thread Michael Niedermayer
From: Michael Niedermayer mich...@niedermayer.cc

This theoretically is faster and might be useful on some low end embeded systems
Inspired-by: Compns reply
Signed-off-by: Michael Niedermayer mich...@niedermayer.cc
---
 ffplay.c |   15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index cc61dde..dee8596 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -346,6 +346,7 @@ static int nb_vfilters = 0;
 static char *afilters = NULL;
 #endif
 static int autorotate = 1;
+static int scale_subtitlies = 1;
 
 /* current context */
 static int is_full_screen;
@@ -2178,12 +2179,17 @@ static int subtitle_thread(void *arg)
 {
 int in_w = sp-sub.rects[i]-w;
 int in_h = sp-sub.rects[i]-h;
-int subw = is-subdec.avctx-width  ? is-subdec.avctx-width  
: is-viddec_width;
-int subh = is-subdec.avctx-height ? is-subdec.avctx-height 
: is-viddec_height;
-int out_w = is-viddec_width  ? in_w * is-viddec_width  / 
subw : in_w;
-int out_h = is-viddec_height ? in_h * is-viddec_height / 
subh : in_h;
+int subw = is-subdec.avctx-width;
+int subh = is-subdec.avctx-height;
+int out_w = in_w;
+int out_h = in_h;
 AVPicture newpic;
 
+if (subw  subh  is-viddec_width  is-viddec_height  
scale_subtitlies) {
+out_w = in_w * is-viddec_width  / subw;
+out_h = in_h * is-viddec_height / subh;
+}
+
 //can not use avpicture_alloc as it is not compatible with 
avsubtitle_free()
 av_image_fill_linesizes(newpic.linesize, AV_PIX_FMT_YUVA420P, 
out_w);
 newpic.data[0] = av_malloc(newpic.linesize[0] * out_h);
@@ -3586,6 +3592,7 @@ static const OptionDef options[] = {
 { scodec, HAS_ARG | OPT_STRING | OPT_EXPERT, { subtitle_codec_name }, 
force subtitle decoder, decoder_name },
 { vcodec, HAS_ARG | OPT_STRING | OPT_EXPERT, {video_codec_name }, 
force video decoder,decoder_name },
 { autorotate, OPT_BOOL, { autorotate }, automatically rotate video, 
 },
+{ scale_subtitlies, OPT_BOOL, { scale_subtitlies }, rescale subtitles 
depending on video size,  },
 { NULL, },
 };
 
-- 
1.7.9.5

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel