Opened 15 years ago

Closed 15 years ago

#1410 closed defect (fixed)

incorrect render of subtitles when PlayResX/PlayResY not equal to Width/Height of video

Reported by: dr.andru@… Owned by: eugeni.stepanov@…
Priority: normal Component: libass
Version: unspecified Severity: normal
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

My English is sucks, so... don't beat up me :)

There is incorrect calculation of font_scale_x in libass/ass_render.c(function ass_start_frame):

if (frame_context.orig_width * track->PlayResY == frame_context.orig_height * track->PlayResX)

frame_context.font_scale_x = 1.;

else

frame_context.font_scale_x = ((double)(frame_context.orig_width * track->PlayResY)) / (frame_context.orig_height * track->PlayResX);

With this code we have next trouble(if PlayResX/PlayResY not equal to Width/Height of video):
http://s59.radikal.ru/i164/0902/4d/7d669ea37465.jpg
http://s59.radikal.ru/i165/0902/68/3b562add6367.jpg

Correct render will be if comment all and leave only this:
frame_context.font_scale_x = 1.

http://i056.radikal.ru/0902/87/790cc4e27dcd.jpg
http://s41.radikal.ru/i093/0902/fd/d38ef1201180.jpg

Russian:
libass/ass_render.c в функции ass_start_frame неправильно рассчитывается font_scale_x в этих строках:

if (frame_context.orig_width * track->PlayResY == frame_context.orig_height * track->PlayResX)

frame_context.font_scale_x = 1.;

else

frame_context.font_scale_x = ((double)(frame_context.orig_width * track->PlayResY)) / (frame_context.orig_height * track->PlayResX);

В следствии в ass-субтитрах, где указаны PlayResX/PlayResY отличные от видео-ряда, получается следующее:
http://s59.radikal.ru/i164/0902/4d/7d669ea37465.jpg
http://s59.radikal.ru/i165/0902/68/3b562add6367.jpg

Если же оставить font_scale_x равным 1., то все приходит в норму, и рендеринг субтитров происходит правильно в любом случаи:
http://i056.radikal.ru/0902/87/790cc4e27dcd.jpg
http://s41.radikal.ru/i093/0902/fd/d38ef1201180.jpg

Change History (2)

comment:1 by dr.andru@…, 15 years ago

In Aegisub this trouble already fixed:
http://svn.aegisub.net/trunk/libass/ass_render.c

But I think frame_context.font_scale_x is old value, that never used. Only in function ass_render_event:

ass_font_set_transform(render_context.font,

render_context.scale_x * frame_context.font_scale_x,
render_context.scale_y,
&shift );

render_context.scale_x contains correct value for scaling, and multiply to frame_context.font_scale_x... mmm, "broke all"?

comment:2 by dr.andru@…, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in svn-28835

Note: See TracTickets for help on using tickets.