Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cacheAsBitmap in the template host #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

silid
Copy link
Contributor

@silid silid commented Jun 22, 2018

AS3 templates currently require either a blur filter in the template or disable cleartype on the server.

HTML templates perform better with cleartype enabled and so it might be preferable to enable blur on load of template into the templatehost so it isn't required in each and every template.

This prevents the black boxes that required the disabling of cleartype or blur adding to templates individually.
@jesperstarkar
Copy link

jesperstarkar commented Jun 22, 2018

I think it is cacheAsBitmap = true that makes the trick, not a Blur filter specifically. Adding filters turns on casheAsBitmap, hence has that become known as the easiest way of doing it, as it is easily available through the visual editor too.

I don't see any reason to why we shouldn't go with your implementation, just wanted to mention that it isn't specifically tied to Blur, and a more generic implementation would be to turn on cacheAsBitmap.

I haven't spent time double checking this, so I might be wrong.

@didikunz
Copy link

As I alredy said in the forum: I don't think that this is a good idea, as it cures a wrong Windows setting with something that adds to the processing power needed for the templates to play.

@silid
Copy link
Contributor Author

silid commented Jun 22, 2018

I think performance may be an issue I'll need to examine but the problem is html templates should have cleartype turned on for best appearance.

@didikunz
Copy link

I stil don't lke the idea. Normally people don't mix technologies and if you do, you simply add the blur by hand. Otherways you change the Windows setting dependant on the technology (Flash or HTML) used on the current job.

@jesperstarkar
Copy link

@didikunz I disagree. This is a good overall fix. Ideally made optional, so perhaps we should have it added to the panel/brew and opt in?

@silid shouldn't be too costly performance wise.

@silid silid changed the title Add blur filter in the template host Add cacheAsBitmap in the template host Jun 22, 2018
@silid
Copy link
Contributor Author

silid commented Jun 22, 2018

I could be convinced that it isn't a good idea to cache the whole template as a bitmap. Adding this as a feature to the template generator - in a similar way that the anti-aliasing is done is a good idea.

If only the latest source was on github @dotarmin

@didikunz
Copy link

@jesperstarkar: To have it as a setting in the TemplateGenerator seems a good idea, so that one can add it, if it makes sense. To add it in the TemplateHost as a fixed thing could be problematic in my opinion.

@dotarmin
Copy link
Contributor

@silid If only the latest source was on github @dotarmin

It should be the latest but let me confirm this once more. It's also vacation times and Andreas is on vacation but I have sent him an email and hopefully I'll get an answer, otherwise he's back in a couple of weeks.

Best regards,
Armin

@silid
Copy link
Contributor Author

silid commented Jun 26, 2018

@dotarmin It should be the latest but let me confirm this once more.

I'm referring to the latest source of CasparCG/templategenerator. I can't put the feature in there as the version on github is several versions old.

@dotarmin
Copy link
Contributor

I'm referring to the latest source of CasparCG/templategenerator.

@silid Latest source code is located but is not pushed yet by Andreas. Will be done after vacation.

@dotarmin
Copy link
Contributor

dotarmin commented Sep 4, 2018

This PR needs changes in TemplateGenerator to have the possibility to disable cacheAsBitmap in the temapltehost it-self.

@silid
Copy link
Contributor Author

silid commented Sep 4, 2018

@dotarmin Any sign of the current source of TemplateGenerator in github yet?

@silid
Copy link
Contributor Author

silid commented Sep 4, 2018

@didikunz The source has been changed and enables cacheAsBitmap on the whole template. I've been using this for a while and found it very helpful. Do you still think it will be problematic and why?

@didikunz
Copy link

didikunz commented Sep 4, 2018

@silid I would stongly recomend to have a setting for that, as I do not know, what happens with existing stuff and would not want to investigate a funny error, that appers, after a change of a variable name spelling error or the like. If it's a setting I can disable or enable it. If it is enabled fixed I would need to downgrade the whole toolchain if something werid happens because of this. I still think it's "shooting sparrows with a cannon".

@dotarmin
Copy link
Contributor

dotarmin commented Sep 4, 2018

I feel this is risky because if starts to give funny errors and community users do not update the TemplateGenerator to include this option, then it will be problematic. Also, what happens with current flahs-templates when this is enabled on a TemplateHost-level?

@silid
Copy link
Contributor Author

silid commented Sep 4, 2018

@dotarmin - this is one reason why not to use it as a setting.
It is actually a one line change (the other line is whitespace change) in the templatehost that caches the entire template as a bitmap.

It solves the problem where people see the black boxes around text and actually smooths the workflow for combined html and actionscript templates as existing templates can now be used with cleartype turned on.

It is no longer an either/or situation.

@didikunz - It does nothing to variables or names.

@didikunz
Copy link

didikunz commented Sep 4, 2018

When we do a setting, could it be disabled in the TemplateHost by default, so that people with old TemplateGenrators get the setting disabled? In the new TemplateGenarator the setting could be enabled by default, so that new users get it enabled to make the black boxes disappear. That would be the best for both kind of users.

@didikunz
Copy link

didikunz commented Sep 4, 2018

@silid "It does nothing to variables or names." you missunderstud me. I know that. But when I need to open up an old template to correct a very, very minor issue, like a typo on a variable or so and then recomplie it with a new TempalteGenerator and it starts to behaive weird, then I am pissed off and a simple 2 Minute correction becomes a 2 hour or more issue.

@silid
Copy link
Contributor Author

silid commented Sep 4, 2018

@didikunz This PR does not change the templategenerator or the template. It would have zero effect on editing old templates.

@didikunz
Copy link

didikunz commented Sep 4, 2018

This PR does not change the templategenerator or the template. It would have zero effect on editing old templates.

How could that be? If I open an old template in my Adobe Flash / Animate an recompile it's a new template then :)

@silid
Copy link
Contributor Author

silid commented Sep 4, 2018

Because this PR affects the templatehost - not the templategenerator.
The templatehost loads the template files in the server.

@silid
Copy link
Contributor Author

silid commented Sep 4, 2018

I have compiled all templatehosts with my PRs available for test here: https://drive.google.com/drive/folders/1sdVZjC0UCBWbw5LpUQs4PXaRqojCjWGa?usp=sharing

They contain all PRs not just this one.

@jesperstarkar
Copy link

I fully support merging this as is.

@jeansson
Copy link

jeansson commented Sep 19, 2018

Sorry for late feedback, vacation and election happened..

I also see potential problems with using this as default setting, there are potential performance problems with caching as bitmap, and possible masking problems as well, because the flash player will change how it redraws the display object and its children when cached. I remember that this was actually tested a long time ago, and I can't rembember why, but we removed it for some reason, probably because of performance.

Have you tried to cache the template itself instead (eg this.cacheAsBitmap = true) or the parent from the template (eg this.parent.cacheAsBitmap = true)? If this does not do the trick, i support either:

  1. Adding this as a option when adding the template via AMCP, this will involve (minor I guess) changes in the server/protocol (don't know if this is popular though) and in the TemplateHost, eg CG 1 ADD 10 svtnews/info 1 true (where true is optional)

  2. Compile fth:s with this feature enabled and then the user can just replace the default fth:s with these. This option will work without any changes in the server or in the default template host

@silid
Copy link
Contributor Author

silid commented Oct 24, 2018

Have you tried to cache the template itself instead (eg this.cacheAsBitmap = true) or the parent from the template (eg this.parent.cacheAsBitmap = true)?

Yes - this does not work, it would also require recompiling templates.

I think performance may be the only issue here, but there is only one cache per templatehost and I have not noticed any issues personally. Perhaps the hardware is a lot better since you tried a similar approach?

Experience shows this actually solves problems with masks - i think because the whole template host is cached as one rather than individual components. If someone can show me a template where this mode breaks it - I'd love to see it!

However - in order to proceed:

  • I see that server 2.2 has added a config section <template-host> perhaps we could add an option here?
  • It seems there is a poorly documented option to send a start label with a CG ADD command
    We could use this to send a keyword that caches that template (rather than the templatehost)
    CG 1-20 ADD 1 "2019/NEWS" "_cacheAsBitmap" 1 "{\"f0\":\"John Smith\"}"
    However the standard client does not support this.

@jesperstarkar
Copy link

I still think @silid is right from the beginning here and I do still support adding caching to the THs globally.

@didikunz
Copy link

Ok, let's do that. As Flash is a dying technology and even I have to do the transition to HTML it probably makes sense to do that.

@dotarmin
Copy link
Contributor

I still think it should be disabled by default due to backward compatibility even if flash is dying technology. It's still widely used even if we're going towards HTML. An alternative would be to create a GitHub release with original templatehost and one release with cacheasbitmap enabled. Those who need cacheasbitmap can replace the original templatehost bundled with the server.

@silid
Copy link
Contributor Author

silid commented Oct 25, 2018

@dotarmin I'd suggest the reverse.

  1. It is a new server release - exactly the time when changing defaults is possible.
  2. It is (imo) the number 1 issue for new users developing as3 templates.
  3. I don't think this breaks compatibility. No one has shown me a template this breaks.
    I have seen plenty it fixes.
    Have any of you even tested this? If we can get it into the 2.2 beta releases we could get it more widely tested.

@dotarmin
Copy link
Contributor

Have any of you even tested this?

I have not done this, but @jeansson has some experience from this from before and why it wasn't added to the templatehost from the beginning. @jeansson, can you manage some time to test this and/or share some templates with @silid ?

/Armin

@silid
Copy link
Contributor Author

silid commented Oct 25, 2018

For anyone interested in testing I have updated the templatehost files in in my shared folder.
https://drive.google.com/drive/folders/1sdVZjC0UCBWbw5LpUQs4PXaRqojCjWGa?usp=sharing

These are now named cg22 for the version change - note that CasparCG uses the first one it finds, so you will have to remove the cg20 versions for it to pick these up.

@dotarmin
Copy link
Contributor

ping @jeansson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants