Commit 1ba32fb7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

transcode: avoid conversion to double

parent 953f3b12
......@@ -20,6 +20,7 @@ libstream_out_transcode_plugin_la_SOURCES = \
transcode/transcode.c transcode/transcode.h \
transcode/osd.c transcode/spu.c transcode/audio.c transcode/video.c
libstream_out_transcode_plugin_la_CFLAGS = $(AM_CFLAGS)
libstream_out_transcode_plugin_la_LIBADD = $(LIBM)
stream_out_LTLIBRARIES += \
......
......@@ -30,6 +30,7 @@
#include "transcode.h"
#include <math.h>
#include <vlc_meta.h>
#include <vlc_spu.h>
#include <vlc_modules.h>
......@@ -398,11 +399,11 @@ static void transcode_video_encoder_init( sout_stream_t *p_stream,
p_fmt_out->video.i_sar_den /
p_fmt_out->video.i_height;
msg_Dbg( p_stream, "decoder aspect is %f:1", f_aspect );
msg_Dbg( p_stream, "decoder aspect is %f:1", (double) f_aspect );
/* Change f_aspect from source frame to source pixel */
f_aspect = f_aspect * i_src_visible_height / i_src_visible_width;
msg_Dbg( p_stream, "source pixel aspect is %f:1", f_aspect );
msg_Dbg( p_stream, "source pixel aspect is %f:1", (double) f_aspect );
/* Calculate scaling factor for specified parameters */
if( id->p_encoder->fmt_out.video.i_visible_width <= 0 &&
......@@ -463,17 +464,17 @@ static void transcode_video_encoder_init( sout_stream_t *p_stream,
/* Change aspect ratio from source pixel to scaled pixel */
f_aspect = f_aspect * f_scale_height / f_scale_width;
msg_Dbg( p_stream, "scaled pixel aspect is %f:1", f_aspect );
msg_Dbg( p_stream, "scaled pixel aspect is %f:1", (double) f_aspect );
/* f_scale_width and f_scale_height are now final */
/* Calculate width, height from scaling
* Make sure its multiple of 2
*/
/* width/height of output stream */
int i_dst_visible_width = 2 * (int)(f_scale_width*i_src_visible_width/2+0.5);
int i_dst_visible_height = 2 * (int)(f_scale_height*i_src_visible_height/2+0.5);
int i_dst_width = 2 * (int)(f_scale_width*p_fmt_out->video.i_width/2+0.5);
int i_dst_height = 2 * (int)(f_scale_height*p_fmt_out->video.i_height/2+0.5);
int i_dst_visible_width = 2 * lroundf(f_scale_width*i_src_visible_width/2);
int i_dst_visible_height = 2 * lroundf(f_scale_height*i_src_visible_height/2);
int i_dst_width = 2 * lroundf(f_scale_width*p_fmt_out->video.i_width/2);
int i_dst_height = 2 * lroundf(f_scale_height*p_fmt_out->video.i_height/2);
/* Change aspect ratio from scaled pixel to output frame */
f_aspect = f_aspect * i_dst_visible_width / i_dst_visible_height;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment