Download for Windows Download for Linux Download for FreeBSD Download for Mac Manual Wiki Forum IRC Trac

Sunday, July 20, 2008

Why rendering \k and \kf effects is fast in VSFilter

This is a repost of something I wrote earlier on the AnimeSuki forums, in relation to a discussion of how much CPU time various kinds of karaoke effects take to render.

This discussion only covers TextSub (VSFilter), I don't know what other renderers do and their use is still very limited. Also, everything that goes for \k also goes for \kf, \K and \ko. They use the same rendering technique.
This will also explain a funny "artifact" some karaokers might have seen when using \kf with vertical karaoke.

First, while TextSub does have a function that should tell whether a line is animated or not (presumably so it could avoid re-rendering static lines for every frame) that function is empty, it just says "return true;", so every line is always considered animated, no matter what's in it.

Next, the way \k effects are handled is using a "switchpoints" algorithm.
TextSub renders (up to) three different single-channel 6-bit bitmaps for each line, fill, border and shadow. (Border is Shadow minus Fill. Shadow is Fill "expanded" to give an outline.)
When the subtitle is to be painted onto the video, TextSub builds a list of switchpoints for each line component. A switchpoint has two parts: Colour (which includes alpha) and end-coordinate. The end-coordinate is which pixel index on the scanline the colour is valid up till.
(When a line has a vector-\clip, the vector drawing is rendered as a fourth 6-bit image which is used to mask the other layers while painting.)

When there is no \k effect, there is only one switchpoint for each component, which has the colour of it and the end-coordinate set to infinity (actually 0xFFFFFFFF).
When there is a \k effect, the current position of the highlight is calculated for the frame, and a switchpoint is added at the right coordinate. This is very fast to calculate. The pixel size of every syllable is already known (because the rasteriser breaks the line into "words" at every change in formatting - \k tags are formatting) and for \kf effects, getting the position within the syllable is a matter of simple linear interpolation between the endpoints of the syllable.

Now for painting an actual component.
For every scanline of the component, loop over each switchpoint. For each switchpoint, paint its colour to the video frame, using the component as mask and optionally also masking with a vector-\clip mask. When the endpoint of a switchpoint is reached, do the same for the next switchpoint, continuing where the previous one left off.
This is repeated for every scanline of the component. Also very fast.
(The case of just a single switchpoint, ie. no \k effect, is questionably optimised by removing the switchpoints-loop. I think this in practice only saves a few hundred or maybe thousand machine instructions in total for each component, but I haven't checked the actual code.)

For the reason why \k effects don't rotate when you use \frz (and family): They are scanline-based and the switchpoints are assumed to always be on the same coordinate on every scanline. The switchpoints can't change between scanlines for the same component.

This should explain why \k effects are fast to render, unlike many \t-based effects. Using purely \k-based karaoke effects is safe to do when softsubbing, any modern CPU should be able to render it, since it doesn't really take any more CPU than rendering static lines.

Related Posts by Categories



66 comments:

  1. I am really impressed by this blog. The document typing services are best to help your document so always try to use our services.

    ReplyDelete
  2. The article you have shared here very good. This is really interesting information for me. Thanks for sharing!
    hotmail.com login |hotmail login |gmail login

    ReplyDelete
  3. Facebook is a dazzling system which provides its individuals enormous probabilities to increase their perspectives. buy usa facebook likes

    ReplyDelete
  4. You will meet amazing and beautiful people that may be the same as you or complete different

    ReplyDelete
  5. I have learn some excellent stuff here. Definitely value bookmarking for revisiting. I surprise how so much effort you place to create any such wonderful informative website.
    To play the most fun games entrar aquí para comenzar a jugar for free.

    ReplyDelete
  6. Your blog is great. I read a lot of interesting things from it. Thank you very much for sharing. Hope you will update more news in the future.
    games for girls dress up

    ReplyDelete
  7. I would like to thank you for the efforts you have made in writing this article.
    fleeingthecomplexgame.com Warwings.net Flipmaster.co

    ReplyDelete
  8. If this was the kind of information that I would find on every page that I visit, it could be great. I love this kind of a post. You can always share more at all times. When looking for the most reliable and professional T-test assignment help, why not give us a call. We offer the most reliable assignment, which come at very affordable rates and on time.

    ReplyDelete
  9. I am convinced that your website is convinced that weblog is very new. Probably I am going to bookmark your site. There are certainly impressive stories. Passion for sharing your website with us.
    Regards - www.office.com/setup

    ReplyDelete
  10. This is very nice blog and informative. I have searched many sites but was not able to get information same as your site. I really like the ideas and very intersting to read.
    If you want to have fun online, discover the latest friv educational games for kids. Thanks!

    ReplyDelete
  11. Hey, my dear friends, if you are hunting for a wild look Michael Kors Handbags Outlet at a reasonable price; you really should not miss this Michael Kors Handbags On Sale. It is truly a qualifying item. (tags: Michael Kors Outlet Online,Michael Kors Sale,Michael Kors Outlet)
    It posted by Michael Kors Outlet Store.

    ReplyDelete
  12. También puede visitar una tienda de ladrillo y mortero de Michael Kors o su sitio web y comprar directamente un bolso Michael Kors desde allí. Usar un bolso de Michael Kors les permite a los demás reconocer que el habitante urbano educado toma la moda realmente con seriedad. Los bolsos de hombro son particularmente refinados y elegantes.

    {Bolsas Michael Kors Precios | Bolsos Michael Kors Outlet | Michael Kors Rebajas}

    En vacker konstnärlig skapelse av vävt läder, som ger ett skalskaligt utseende - liknar en snakeskin eller fiskhud, linjer utsidan av påsen. Läderens bältros är små läderringar. Det finns också gyllene accenter på väskan. Slutresultatet är svagt liknar kedjepost.

    {Michael Kors Rea | Michael Kors Väska Rea | Michael Kors Plånbok}

    ReplyDelete
  13. Very interesting article, thank you for sharing. I also want to share the following health articles, God willing, useful. Thank you :)

    Pengobatan Alternatif Kanker Paru-paru
    Obat Ginjal Bocor Tradisional
    Obat Kanker Lambung Herbal
    Cara Pesan QnC Jelly Gamat Asli

    ReplyDelete
  14. Thank you very useful information admin, and pardon me permission to share articles here may help :

    Cara Menghilangkan Kencing Batu Secara Alami
    Cara menyembuhkan jantung bengkak secara alami

    ReplyDelete
  15. Given article is very helpful and very useful for my admin, and pardon me permission to share articles here hopefully helped :

    Cara Menyembuhkan Giardiasis
    Cara Menyembuhkan Berengan
    Cara Menyembuhkan Sangkadi Secara Alami
    Cara Menyembuhkan Hipertiroid Secara Alami

    ReplyDelete
  16. The post is written in very a good manner and it contains many useful information for me. Thank you very useful information admin, and pardon me permission to share articles here may help :

    risa herbal
    cara menghilangkan benjolan
    toko obat herbal sapnudin
    sehat dan cantik alami
    khasiat obat herbal
    cara menghilangkan bekas jerawat

    ReplyDelete
  17. Thank you very useful information admin, and pardon me permission to share articles here may help :

    Obat darah tinggi ampuh
    Obat darah manis ampuh
    Cara Mengatasi Sakit Dada Seperti Ditusuk Tusuk

    ReplyDelete
  18. Given article is very helpful and very useful for my admin, and pardon me permission to share articles here hopefully helped :

    Cara mengatasi polip telinga

    ReplyDelete
  19. The article is very interesting. And I also want to share articles about health, I'm sure this will be useful. Read and share it. Thank you very much :)

    Obat Sakit Pinggang di Apotik
    Pengobatan Alternatif TBC Tulang
    Cara Penyembuhan Hepatitis B Akut


    ReplyDelete
  20. The article is very interesting. And I also want to share articles about health, I'm sure this will be useful. Read and share it. Thank you very much :)

    Cara Mengobati Infeksi Rahim secara Alami
    Manfaat Walatra Spirulina Untuk Wajah


    ReplyDelete
  21. Really i appreciate the effort you made to share the knowledge. This is really a great stuff for sharing. Keep it up . Thanks for sharing.

    ReplyDelete
  22. I can only express a word of thanks. Because with the content on this blog I can add knowledge I, thank has been sharing this information. Do not forget to visit our website to share information and knowledge about health. |
    Cara Mengatasi Infeksi Kelenjar ludah jelly gamat qnc
    cara mengobati kulit melepuh |
    Solusi Pengobatan Alami teripang emas |
    Apa Itu Sangkadi gamat emas |
    cara mengobati gudik bernanah|

    ReplyDelete
  23. I can only express a word of thanks. Because with the content on this blog I can add knowledge I, thank has been sharing this information. Do not forget to visit our website to share information and knowledge about health. |
    Cara Mengatasi Infeksi Kelenjar ludah jelly gamat qnc
    cara mengobati kulit melepuh |
    Solusi Pengobatan Alami teripang emas |
    Apa Itu Sangkadi gamat emas |
    cara mengobati gudik bernanah|

    ReplyDelete
  24. Here at Big Assignments, we continually provide all type of assignments, when anyone searches over internet "assignment writing help " in Australia. To impose the tendency of doing the work regularly, homeworkassignments and project work are given to the students so that they can have a grip over the subject. If you really want to online assignment at an affordable range of price get a touch with sample assignment. We provide subjective based assignment help services like, economics, physics, engineering, nursing, Computer science, Chemistry, science related topics, Along with that you can easily get cheap assignment help Australia.

    ReplyDelete
  25. Keunggulan situs judi BatuQQ dengan pelayanan livechat 24 jam, customer service yang handal dan sangat ramah, menyediakan 5 bank untuk memudahkan transaksi member, proses depo dan wd sangat cepat bahkan disaat bank offline proses depo tetap akan di proses dengan sangat cepat..
    Keunggulan dari situs domino BatuQQ Bandar Poker dari situs kami sebagai penyedia permainan online yaitu jaminan keamanan, dan privasi dari setiap data User ID seluruh member. Proses transaksi deposit, dan withdraw yang super cepat, serta pelayanan Customer Service yang professional, dan ramah. Di samping itu kami juga memberikan jaminan bahwa setiap transaksi yang ada di proses dalam waktu di bawah 3 menit, dan tidak ada batasan nominal dalam melakukan tarik dana di BatuQQ BandarQQ. ( Withdraw berapapun akan kami bayar )


    Batu4d online lottery consists of online lottery sites that provide 6 online lottery markets such as HONGKONG TOGEL, SINGAPORE TOGEL, LOTTERY PORKAS TOGEL, SYDNEY TOGEL, AUCKLAND TOGEL, PERTH TOGEL with all that can be done, fast deposit and withdrawal Batu4d togel online indonesia can be searched for lottery online. As the biggest togel site Batu4D holds a trusted online tagging site

    ReplyDelete
  26. Excellent Post as always and you have a great post and i like it thank you for sharing

    โปรโมชั่นGclub ของทางทีมงานตอนนี้แจกฟรีโบนัส 50%
    เพียงแค่คุณสมัคร Gclub กับทางทีมงานของเราเพียงเท่านั้น
    ร่วมมาเป็นส่วนหนึ่งกับเว็บไซต์คาสิโนออนไลน์ของเราได้เลยค่ะ
    สมัครสล็อตออนไลน์ >>> goldenslot
    สนใจร่วมลงทุนกับเรา สมัครเอเย่น Gclub คลิ๊กได้เลย

    ReplyDelete
  27. This is really good blog information thanks for sharing .I am really impressed with your writing abilities

    เว็บไซต์คาสิโนออนไลน์ที่ได้คุณภาพอับดับ 1 ของประเทศ
    เป็นเว็บไซต์การพนันออนไลน์ที่มีคนมา สมัคร Gclub Royal1688
    และยังมีหวยให้คุณได้เล่น สมัครหวยออนไลน์ ได้เลย
    สมัครสมาชิกที่นี่ >>> Gclub Royal1688
    ร่วมลงทุนสมัครเอเย่นคาสิโนกับทีมงานของเราได้เลย

    ReplyDelete
  28. Deep in the dark I don't need the light
    There's a ghost inside me
    It all belongs to the other side
    We live, we love, we lie

    Obat Penghancur Lipoma
    Obat Pembengkakan Hati
    Obat Tradisional Penyumbatan Usus

    ReplyDelete
  29. Hey,
    I have read your article and very impressed with the way you have organised the information and data. I found it quite fascinating and valuable too. By the way, I am here to inform you that we are associated with the world’s no. 1 assignment help services i.e. Online Assignment Expert. Here, we are associated with a pool of experts and ex-professors from a reputed university and colleges. They help us in providing a flawless and genuine nursing assignment help. Therefore, the students searching for the world’s best academic writing professionals can reach to us any time.
    Our assignment experts are well-qualified, highly-experienced and capable to deal with any type of assignment whether it is related to essay, case study, research paper or any other form of assignment.
    Hence whenever you need assistance from assignment help Australia, reach to us. We assure that you will be profoundly happy with our nursing assignment help.

    ReplyDelete
  30. A beautiful purse or handbag from Coach Outlet Online can last for many years, and represent a great overall value.
    There are Michael Kors Bags Outlet in a large number of shopping malls located throughout the country.
    Cheap Michael Kors Bags is a great way to determine which models best suit your needs.
    Official Coach Factory Outlet Online all strive to provide comfort and convenience for their owners and the seams are double-stitched for maximum durability.
    Michael Kors Factory Store, has one of the most popular handbag and accessory lines on the market today.
    Coach Handbags Wholesale says a lady is classy, elegant and sophisticated.
    Coach Store Near Me trends come and go, but a Coach stands the test of time.
    The official Michael Kors Handbags On Sale Outlet regularly posts various handbags being offered for sale.
    Compare your Coach Bags On Sale Outlet to the logo provided on the website to make sure it is similar.
    All Michael Kors Outlet Online Store have serial numbers.

    ReplyDelete
  31. We are committed to ensuring clients can afford our Research Paper Writer Services and also they are satisfied with the prices we have for our Best Essay Writing Services.

    ReplyDelete
  32. This is a great source of information, I will keep track of your posts and share them with everyone. I admire the person who wrote this post, you are so talented, hope you will promote them and become more successful.
    free friv Games 2019, jogos io online, abcya 10, cá koi mini

    ReplyDelete
  33. Our Custom Research Paper Services are purely custom oriented and we design and develop each paper according to your requirements. Your instructions and personal requirements are taken into consideration when designing your Essay Writing Services.

    ReplyDelete
  34. Thank you for making me understand about how an assignment expert is able to solve the doubts of students by going through many writing formats of assignments such as essays, reports, thesis, articles and many more. Likewise, there exist one such company as My Assignment Services that provides top quality assignment help Philippines at affordable prices. We provide world class feature of on-time assignment delivery, plagiarism check, partial payment, unlimited revisions, etc. You can contact our team of highly professional and experienced experts engaged in their respective field. We provide assistance in many subjects with our economics assignment help, Engineering, Management, and many more. Avail our exclusive discounts on our assignment help Philippines by contacting our experts at My Assignment Services.

    ReplyDelete

If you need help with Aegisub or have a bug report please use our forum instead of leaving a comment here. If you have a feature request, please go to our UserVoice page.

You will get better help on our forum than in the blog comments.