Home Backend Development C#.Net Tutorial Briefly comment on the rendering algorithm of Adobe's Flash Player

Briefly comment on the rendering algorithm of Adobe's Flash Player

Dec 20, 2016 pm 02:09 PM
adobe

Some time ago, I saw an article on CSDN that introduced that the rendering performance of FlashPlayer is several times that of HTML 5. Recalling the research on Adobe’s FlashPlayer over the past few years, I wanted to theoretically explore why there is such a result, and also explain Let’s talk about the reasons why Adobe’s Flash Player has been criticized for traditional hardware acceleration (non-GPU solutions);
In the early years, I worked in an IC design company to develop official Flash Player hardware acceleration for a low-end platform (with hardware 3D acceleration). Several At the end of the month, the hardware rendering engine was ready, but the final result was very unexpected - the performance after switching to hardware acceleration was actually worse than software rendering; in order to explain the reason, let's start with Adobe's Flash Player software Let’s start with the principle of rendering algorithm;
In fact, FlashPlayer’s 2D rendering engine uses the most common scan line algorithm (Scanline algorithm), and simply speaking, it is a virtual display device (for anti-aliasing considerations, the virtual display The device is larger than the actual display device, such as 4 x 4 anti-aliasing. The vertical length of the virtual display device is 4 times that of the actual display device.) Each scan line calculates the intersection point with each edge (Edge) of the vector graphic and fills it according to different filling rules. The horizontal line between the two intersection points; in this way, after the scanning lines are calculated one by one from top to bottom, a complete graphic is completed in the virtual display device. Then, according to the supersampling algorithm, the graphics on the virtual display device are The graphics are output to the actual display device, so that a perfect non-aliased graphic is obtained on the actual display device; the above actions are repeated at a certain rate, and continuous animation can be obtained; FlashPlayer parses the streaming swf file, And update the screen at the specified speed to complete the animation playback. Therefore, we have some simple conclusions:
l Vector operation is a huge calculation; this also explains why FlashPlayer has performance problems on most platforms; very regrettable Yes, the current real-time 2D vector graphics playback software seems to only have FlashPlayer, so there is no way to blame this scapegoat;
l Why is the display performance of high-definition graphics much worse than that of lower quality graphics? Because in high-definition settings, FlashPlayer uses 4 x 4 super-sampling anti-aliasing, and means that the calculation amount of calculating intersection points through scan lines is 4 times that of low image quality;
(For 2D vector graphics display, refer to my previous resources: http://download.csdn. net/source/5773340)
In actual 2D vector engines, the problem is often more complicated. After considering Cap and Join, in fact, even a very simple polyline or Bezier curve is composed of many curves (such as The two endpoints of the graph polyline----Cap):

This way we can understand why there are few real-time 2D vector display programs that can compete with Adobe FlashPlayer. Isn’t this a bit contradictory: Why does Adobe’s FlashPlayer stand out? ? The above is just a principle explanation of 2D vector graphics display. Other 2D vector display engines, such as OpenVG (gingkoVG), agg, etc., use the exact same principle. Adobe's FlashPlayer, a relatively common 2D vector display engine, must have its own special Definition, carefully read Adobe's official technical document about FlashPlayer (swf_file_format_spec_v10), we quickly found two very interesting instructions:
l FlashPlayer only supports 2nd order Bezier curve (Quadratic Bezier), and does not support similar PostScript and The third-order Bezier curve (Cubic Bezier) used in traditional 2D vector engines such as OpenVG;


Compared to the second-order Beizer curve, the amount of calculation added by a single third-order Bezier curve in calculating the intersection does not seem to be large: There are several more multiplication operations; however, in most CPU systems, multiplication and division operations take longer than addition and subtraction, especially when the amount of operations is very large, the cumulative difference is even greater;
l In Adobe's official website It is clearly stated in the file that FlashPlayer does not support dot-dash (Dash)


Why doesn’t it support Dash? In fact, in vector graphics display, in addition to the calculation of the intersection of the curve and the scan line, the most difficult thing is to calculate the length of the curve. The display of Dash must rely on the calculation of the curve length in advance; when implementing gingkoVG, the curve of the Dash function is not included It shows that its display performance is 4 times that of using Dash;
l Is that all? No, but even with the above constraints, its display performance has been "improved" several times. In Adobe's FlashPlayer, some other optimization algorithms are used for rendering. Of course, these optimization algorithms are also used in most 2D vector engines as general optimization techniques; (Reference: http://download.csdn.net/source /1998019)
It is a pity that most 2D vector engines support third-order Bezier curves, dot-dash lines, and even arcs (OpenVG) because of the need to consider versatility. From an algorithmic level, it is not difficult to understand why those The open source FlashPlayer that uses a standard 2D rendering engine (such as gnash uses agg) cannot be compared with the execution performance of Adobe's FlashPlayer ----- because the 2D rendering engine of FlashPlayer is tailor-made for the real-time needs of Flash playback ; Of course, in addition to these, Adobe's Flash Player has many clever features in program optimization, which are not what we need to discuss here;
It seems that the matter can come to an end here, but with in-depth research on Flash Player, we discovered some deeper problems ----- and the reasons for the poor hardware acceleration performance of Adobe's Flash Player that has been widely criticized; without considering the For the hardware acceleration of special GPUs, we only consider the standard hardware acceleration method (OpenGL ES/OpenVG) to explain this problem; when Adobe's FlashPlayer was born, there was no universal 2D vector display standard (such as OpenVG), which was aimed at software rendering. The 2D vector graphics display can be said to be a highlight. After more than ten years of development and optimization, Adobe's 2D software vector rendering engine has been developed to perfection. This can also explain why its rendering engine has not been improved from FlashPlayer 4 to FlashPlayer 8. Such a big change can also explain why Adobe FlashPlayer software rendering performance is even better than using low-end hardware acceleration; however, success is also a failure, and too perfect standards and algorithms hinder the use of standard hardware acceleration. Possibly (hardware acceleration for special GPUs, because its flexibility is not in our consideration), we continued to carefully study Adobe's official documents, and we noticed that FlashPlayer is different from traditional 2D vector engines regarding the filling law: traditional 2D vector engines (such as OpenVG/gingkoVG) have two fill rules: even-odd fill rule (Even-odd fill rule) and non-zero fill rule (Non-zero fill rule), and Adobe's FlashPlayer adds an edge fill rule ( Edge-edge fill rule), and most 2D vector engines use a single coloring method (RColor) for each Shape/Object. In the edge-edge fill rule, an edge can have two different coloring methods depending on the left and right ( color1/color2), of course the reason why Adobe does this is to increase the flexibility of software rendering. For example, when two Shapes intersect, different coloring methods are allowed for the intersecting parts, as shown in the figure:


Unfortunately, this is when using the standard Graphics acceleration engines (OpenVG/OpenGL) will bring us confusion: that is, we may have different shading methods for a Shape, which seems to be contrary to most 2D vector engines; although we can regard the edge filling rule as There are two different odd and even filling rules, but considering that the filling rules for each edge may change at any time, the reconfirmation of a Shape with a single Color is not that easy, especially for a Shape composed of curves. However, this problem is not very troublesome compared to 2D vector graphics rendering, but we can find that Adobe FlashPlayer does not seem to be "friendly" to most traditional 2D vector engines today ----- Programmers must carefully write an intermediate layer to solve these problems , this is not Adobe's fault: these 2D vector display standards (OpenVG) had not yet appeared when FlashPlayer was born; it is just a pity that Adobe's FlashPlayer is not an open source program (AVM2 of Adobe FlashPlayer has been open source), so we must wait patiently Adobe does this for us, unless we are not going to use the official FlashPlayer;
(We use OpenVG’s FlashPlayer ourselves)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to disable automatic updates in Adobe Acrobat Reader How to disable automatic updates in Adobe Acrobat Reader Mar 14, 2024 pm 08:58 PM

AdobeAcrobatReader is a powerful tool for viewing and editing PDF files. The software is available in both free and paid versions. If you need to use Adobe Acrobat Reader to edit PDF files, you need to purchase its paid plan. To keep Adobe Acrobat Reader up to date with the latest enhancements and security fixes, the software enables automatic updates by default. However, you can choose to disable automatic updates if you wish. This article will show you how to disable automatic updates in Adobe Acrobat Reader. How to disable automatic updates in Adobe Acrobat Reader us

How to insert pictures in Adobe Acrobat Pro9-How to insert pictures in Adobe Acrobat Pro9 How to insert pictures in Adobe Acrobat Pro9-How to insert pictures in Adobe Acrobat Pro9 Mar 04, 2024 pm 11:50 PM

Are you also using Adobe Acrobat Pro 9 software in your office? But do you know how to insert pictures in Adobe Acrobat Pro 9? Below, the editor will bring you the method of inserting pictures in Adobe Acrobat Pro 9. If you are interested, take a look below. Open the Sample.pdf document in Adobe Acrobat Pro9, click "Tools" - "Content" - select "Edit Object" on the right side of the document, and the mouse cursor changes to a solid arrow + a small box in the lower right corner. Right-click in an empty space of the document and select Insert Image. A dialog box will pop up, then select the ElenaGilbert.JPEG image file in the dialog box (please confirm

Fix: Adobe Photoshop graphics processor not detected issue Fix: Adobe Photoshop graphics processor not detected issue Apr 28, 2023 pm 01:25 PM

Adobe Photoshop uses the graphics processor on your system to render 3D effects and more. Having a good graphics card is an added advantage to running Adobe Photoshop smoothly. But what if Adobe Photoshop doesn't even recognize the graphics card on your system? There are many reasons for this problem. However, there is nothing to worry about. Just follow these simple instructions to get Photoshop to detect your GPU in just a few quick steps. Fix 1 – Set the application to use the dedicated GPU If you have two GPUs on your system, you must set Photoshop to use the dedicated GPU. 1. Close

How to set the keyboard increment in Adobe Illustrator CS6 - How to set the keyboard increment in Adobe Illustrator CS6 How to set the keyboard increment in Adobe Illustrator CS6 - How to set the keyboard increment in Adobe Illustrator CS6 Mar 04, 2024 pm 06:04 PM

Many users are using the Adobe Illustrator CS6 software in their offices, so do you know how to set the keyboard increment in Adobe Illustrator CS6? Then, the editor will bring you the method of setting the keyboard increment in Adobe Illustrator CS6. Interested users can take a look below. Step 1: Start Adobe Illustrator CS6 software, as shown in the figure below. Step 2: In the menu bar, click the [Edit] → [Preferences] → [General] command in sequence. Step 3: The [Keyboard Increment] dialog box pops up, enter the required number in the [Keyboard Increment] text box, and finally click the [OK] button. Step 4: Use the shortcut key [Ctrl]

The 'leader” in AI applications emerges: Adobe! The 'leader” in AI applications emerges: Adobe! Oct 14, 2023 pm 08:21 PM

Powerful AI capabilities will revive growth prospects, which could deliver results for Adobe! At its annual AdobeMAX creative conference this week, software technology giant Adobe announced a slew of new AI tools and services and said in discussions with analysts that its fiscal fourth quarter will be a very strong quarter. Adobe demonstrated AI video editing technology ProjectFastFill. Users only need to enter text prompts to delete, add objects or change background elements in a few seconds, reducing a lot of trivial work. In addition, Adobe has launched three new generative artificial intelligence models, and its image editing functions have been fully upgraded. The newly released FireflyVector brings together a

How to get a free download of Adobe Reader on Windows 11 How to get a free download of Adobe Reader on Windows 11 May 10, 2023 am 09:16 AM

Fix Windows 11 operating system errors with RestoroPCRepairTool: This software fixes common computer errors by replacing problematic system files with initial working versions. It also protects you from severe file loss, hardware failure, and damage caused by malware and viruses. Fix PC problems and remove viruses in just 3 easy steps now: Download Restoro PC repair tool with patented technology (patent available here). Click to start the scan to find Windows 11 issues that may be causing problems on your PC. Click Fix All to fix issues affecting computer security and performance 793,675 readers downloaded R this month

Adobe is shutting down two Android Photoshop apps, recommending users to use Photoshop Express Adobe is shutting down two Android Photoshop apps, recommending users to use Photoshop Express May 05, 2024 pm 12:43 PM

According to news on May 5, Adobe recently issued a notice to users indicating that it will officially close the Photoshop Mix and Photoshop Fix applications on the Android platform on June 4, 2024. In recent years, Adobe has shifted its Photoshop product strategy on mobile platforms, from launching independent tools for specific usage scenarios, such as PhotoshopMix and PhotoshopFix, to providing comprehensive Photoshop functions in the form of suites on Android, iOS, and the web. PhotoshopMix once made it possible for users to easily combine two or more pictures, while PhotoshopFix provides

Sora comes to Adobe video editing software! The new version of Premiere Pro opens the era of AI editing Sora comes to Adobe video editing software! The new version of Premiere Pro opens the era of AI editing Apr 16, 2024 pm 03:20 PM

Sora is going to be integrated into Adobe video editing software. In the newly released PremierPro concept demonstration, Adobe showed the results of its cooperation with OpenAI: in addition to the main lens, a B-roll auxiliary lens was completely generated by Sora. In addition to Sora, other popular AI video tools Runway and Pika will also be available as options. Runway is used similarly to Sora in the demonstration and can generate a new auxiliary shot. Pika can naturally extend existing lenses for several seconds. It should be emphasized that these features are still in the early preview and research stage, and it has not yet been revealed when they will be released. In comparison, Adobe’s own AI product Firefly

See all articles