Opened 16 years ago
Closed 16 years ago
#1410 closed defect (fixed)
incorrect render of subtitles when PlayResX/PlayResY not equal to Width/Height of video
Reported by: | Owned by: | ||
---|---|---|---|
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
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:
render_context.scale_x contains correct value for scaling, and multiply to frame_context.font_scale_x... mmm, "broke all"?