Display method of lyrics and playing device

By creating a lyrics line prefetch set, display resources are prefetched in advance, and line switching is performed when resources are ready. This solves the latency and stuttering problems in the lyrics rendering process, realizes continuous and synchronous presentation of lyrics, and reduces memory usage.

CN123178654APending Publication Date: 2026-11-27SHENZHEN ZIDOO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611695430.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-30
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, the lyrics rendering process may cause newline delays, brief blank periods, or screen stuttering due to waiting for resources, especially when resources are not ready during line switching.

Method used

By creating a lyrics line prefetch set, the display resources for the current and subsequent lyrics lines are prefetched in advance, ensuring that the current lyrics line has the highest priority. The line switching is performed when the resources are ready, avoiding the display of incomplete lyrics lines and achieving continuous and synchronous presentation of lyrics.

Benefits of technology

It effectively avoids blank lines and overlapping of old and new content in the lyrics display, ensures the synchronization and correct timing of word-by-word display, reduces memory usage, and ensures a continuous song switching effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178654A_ABST
    Figure CN123178654A_ABST
Patent Text Reader

Abstract

The application discloses a display method of lyrics and a playing device, which comprises creating a lyrics line pre-fetch set of current and subsequent lyrics lines; when the current lyrics line is displayed, the display resource of the subsequent lyrics line is requested; if the display resource of the next lyrics line is ready, the next lyrics line is activated as the current display object for rendering display; if it is not ready, the display resource preparation progress is listened to, and after the preparation is ready, the next lyrics line is activated for rendering display, and the animation duration is counted from zero at the actual activation time. The application forms a lyrics line pre-fetch set, the display resource of the subsequent lyrics line is prepared in advance, and the lyrics line is not set as the display object when the display resource is not ready, so that the continuous presentation of the lyrics is effectively ensured, and the empty line is avoided. The animation duration of the new line is counted only when the real line switching is performed, so that the correct display time of the word-by-word presentation can be ensured. The whole lyrics need not to be generated, the long-time switching waiting can be avoided, and the memory occupation is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of multimedia display technology, and in particular to a method for displaying lyrics and a playback device. Background Technology

[0002] In music players, audio-visual terminals, and large-screen devices, lyrics are no longer limited to static text overlays. To achieve their respective visual effects, lyric rendering is usually required.

[0003] Lyrics themselves are discrete content strictly driven by playback time. Once the current line reaches its end time, the next line needs to immediately begin rendering effects. If text layout and other rendering tasks are only performed synchronously when switching lines, the rendering thread may experience issues such as newline delays, brief blank spaces, or screen stuttering due to waiting for resources. Summary of the Invention

[0004] The main purpose of this application is to provide a method for displaying lyrics and a playback device, which can solve the problems in the prior art where the rendering process may experience newline delays, brief blank periods, or screen stuttering due to waiting for resources.

[0005] To achieve the above objectives, the first aspect of this application provides a method for displaying lyrics, the method comprising: Create a current lyrics line prefetch set, which includes the current lyrics line arranged in display order and M subsequent lyrics lines to be played after it; During the display of the current lyric line, display resources for subsequent lyric lines in the prefetch set of the current lyric line are requested based on the display order; Upon reaching the start time of the next lyric line or receiving a line switching notification, if the display resources for the next lyric line are ready, the next lyric line will be activated as the current display object, rendered and displayed based on the display resources, and the animation duration of the next lyric line will be timed from zero at the actual activation time. If the display resources for the next line of lyrics are not ready, the current line of lyrics remains the object to be displayed. The display resource preparation progress is monitored. Once the display resources are ready, the next line of lyrics is activated as the object to be displayed. The next line of lyrics is then rendered and displayed based on the display resources. The animation duration of the next line of lyrics is timed from zero at the actual activation moment.

[0006] To achieve the above objectives, a second aspect of this application provides a playback device, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the above-described lyrics display method.

[0007] The embodiments of this application have the following beneficial effects: This application integrates line switching with display resources and display object activation into a closed loop with clear state constraints. Based on continuous playback time, a prefetch set of lyrics lines ("current lyrics line plus subsequent lyrics lines") is formed, ensuring the current lyrics line always has the highest priority in the asynchronous text preparation queue. Display resources for subsequent lyrics lines are prepared in advance, achieving pre-generation of lyrics. Even if display resources are not ready, incomplete lyrics lines will not be set as the current display object, effectively guaranteeing continuous lyrics presentation and avoiding blank lines and overlapping of old and new content. This application only times the animation duration of the new line during actual line switching, ensuring synchronized word-by-word display and correct timing. This application does not need to wait for all lyrics to be generated during line switching, avoiding long switching wait times, reducing memory usage, and ensuring continuous song switching effects. This application establishes a sustainable operating mechanism and balance between "timely preparation of the next line" and "control of resource usage." Attached Figure Description

[0008] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0009] in: Figure 1 This is a flowchart of the method for displaying lyrics in an embodiment of this application; Figure 2 This is a structural block diagram of the playback device in the embodiments of this application. Detailed Implementation

[0010] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0011] Lyric rendering typically requires completing some necessary steps and workload, which varies depending on the number of characters, text type, font file, canvas size, and special effects resources. The completion time is not a fixed value.

[0012] Lyrics themselves are discrete content strictly driven by playback time. Once the current line reaches its end time, the next line needs to immediately begin displaying effects. When the user drags the progress bar, skips songs, pauses and resumes, adjusts the lyric delay, or changes the font size, the currently playing lyric line may suddenly change. If the preparation of display resources is only performed synchronously when switching lines, the rendering thread may wait for resources, resulting in newline delays, brief blank spaces, or screen stuttering.

[0013] If these tasks are simply placed in an asynchronous thread without explicit session identification and resource readiness checks, tasks submitted earlier may return later, overwriting the correct lyrics after the jump.

[0014] Another approach is to generate all lyrics lines at once at the beginning of the song. This can reduce waiting time for line transitions, but a song lyric may contain dozens to hundreds of lines, and each line may also have a main texture, stroke texture, word-by-word units, and effects assets. Pre-generating all of them will consume more memory and video memory, and prolong the initial display time; when font, resolution, or effects parameters change, the existing results may become invalid as a whole.

[0015] Therefore, a sustainable mechanism needs to be established between "preparing the next line in a timely manner" and "controlling resource consumption".

[0016] Based on this, this application provides a scheme for displaying lyrics.

[0017] The "playback progress reporting", "text preparation", "resource upload" and "display object switching" functions in the above scheme are independent of each other.

[0018] like Figure 1 As shown, in one embodiment, a method for displaying lyrics is provided. This method can be applied to terminal devices, not limited to music players, audio / video players, and large-screen devices. The specific steps of the lyrics display method include: S100: Create a current lyrics line prefetch set, which includes the current lyrics line arranged in display order and M subsequent lyrics lines to be played after it.

[0019] Specifically, the current lyrics line prefetch set can be viewed as a generated finite prefetch window, which contains the current lyrics line as the first lyrics line and M subsequent lyrics lines to be played in sequence after it.

[0020] For example, if the current target lyrics line is k, then the prefetch set for the current lyrics line is W = {k, k+1, ..., k+M}, where M is the subsequent prefetch depth. M is a positive integer greater than or equal to 1, and its specific value is configured according to the actual application scenario; this application does not impose any restrictions on it.

[0021] For example, if M=3, then the current lyric line and the next three lyric lines are retained in the prefetch set W of the current lyric line.

[0022] The current lyrics line prefetch set will enter the preparation queue, which is used to perform tasks such as preparing display resources for the lyrics line. Items that exceed the end of the lyrics, are empty text lines, or are no longer in W will not enter the preparation queue, and their cache can be released.

[0023] It should be noted that the current lyrics line can be the first lyric of the song when it just started playing, or any lyric that the user can drag or specify while playing the song.

[0024] This embodiment retains the current lyric line and some subsequent lyric lines in the lyric line prefetch set, which makes it easier to control memory, video memory and first display time compared to pre-generating the entire song lyrics.

[0025] S200: During the display of the current lyrics line, request display resources for subsequent lyrics lines in the prefetch set of the current lyrics line based on the display order.

[0026] Specifically, in this embodiment, display resources for each subsequent line of lyrics can be obtained through asynchronous requests.

[0027] Subsequent lyric lines and the current lyric line are prepared for display using the same method, and each has its own corresponding display task.

[0028] During the display of the current lyric line, only some display resources for subsequent or next lyric lines may be available, depending on the display duration of the current lyric line or the actual animation duration.

[0029] This embodiment determines the preparation priority based on the order of subsequent lyric lines and the current media position, and requests display resources according to the preparation priority. If the display task is processed by a single thread, the display resources of subsequent lyric lines are requested sequentially according to the preparation priority corresponding to the display order. If the display task is processed by multiple threads, the display resources of subsequent lyric lines with higher priority or sorted order can be requested synchronously first according to the preparation priority corresponding to the display order.

[0030] The obtained display resources can be cached first for use during rendering.

[0031] In one specific embodiment, if at least one of the display attributes such as font size, font, color, line spacing, character spacing, and special effects changes, the same line of lyrics is allowed to request display resources multiple times, and the old display resources stored in the cache are updated with the latest display resources.

[0032] For example, line 8 was initially formatted with a font size of 146 pixels; after formatting, it was found to be too tall and was changed to 138 pixels. The display resource with the changed font size replaced the old display resource. This isolates a batch of overall changes to layout parameters and distinguishes different batches of display resources.

[0033] It should be noted that the current lyrics line k is always at the head of the queue, and subsequent lines are arranged according to the playback order. Even if some lyrics lines are enqueued earlier, and some lyrics lines generate new display resources due to font size adaptation, etc., the priority is still determined by their role in the current lyrics line prefetch set W, rather than by the order in which the display resources were acquired.

[0034] S300: Upon reaching the start time of the next lyric line or receiving a line switching notification, if the display resources for the next lyric line are ready, the next lyric line is activated as the current display object, rendered and displayed based on the display resources, and the animation duration of the next lyric line is timed from zero at the actual activation time.

[0035] Specifically, the start time of the next lyric line is determined based on the lyric timestamp and the media time pL(t). The media time pL(t) is used to indicate "which line should be displayed now". After the current lyric line k is displayed, the media time pL(t) will indicate that the lyric line to be displayed now is the next lyric line k+1.

[0036] If the display resources for the next line of lyrics are not ready before line switching occurs, empty lines or blank displays will appear. To solve this problem, this embodiment does not immediately switch lines when the line boundary is reached. Instead, it first determines whether the display resources for the next line of lyrics are ready. If the display resources for the next line of lyrics are ready, the next line of lyrics is activated as the current display object, and rendering and display are performed based on the display resources.

[0037] Even if there is a delay in displaying resource preparation, as long as the actual activation time rather than the task submission time is used as the animation zero point or special effect zero point, the time spent on text shaping and graphic resource uploading will not cause the text to be displayed word by word starting from the middle, ensuring that the special effect time is consistent with the first frame actually seen by the user.

[0038] S400: If the display resources for the next line of lyrics are not ready, keep the current line of lyrics as the current display object, listen to the display resource preparation progress, and activate the next line of lyrics as the current display object after confirming that the display resources are ready. Render and display based on the display resources, and start timing the animation duration of the next line of lyrics from zero at the actual activation moment.

[0039] Specifically, upon reaching the start time of the next lyric line or receiving a line switching notification, if the display resources for the next lyric line are not ready, the line switching will not be performed temporarily. Instead, the current lyric line will remain the current display object, and the current lyric line will be displayed to ensure that no empty lines or blank spaces appear. At the same time, the preparation progress of the display resources for the next lyric line will continue to be monitored. Once it is determined that the display resources for the next lyric line are ready, the next lyric line will be activated as the current display object, and rendering and display will be performed based on the display resources.

[0040] This embodiment divides the media position, target lyrics line, and special effects animation time into three time domains. The media time pL(t) answers "which line should be displayed now"; the target cursor answers "which line the system is preparing"; and the animation time age answers "how long the new line has actually been displayed to the user". Each of these is timed separately: the media time pL(t) can change due to dragging the progress bar or switching songs; the cursor can point to the new line before the resources are ready; and age can only start timing from zero after the new line has actually become the active display object.

[0041] When a line boundary is reached, the currently used display object is not immediately cleared. If the display resource for the next line of lyrics is not ready, the current frame continues to use the original display object; when the display resource for the next line of lyrics is ready, at the same state commit point, the current display object is replaced with the next line of lyrics, and the animation duration (age) of the next line of lyrics is reset to zero and timed. The current frame is then drawn using a completely new object.

[0042] In this embodiment, the target cursor is updated only when the line boundary is reached, while the existing display object is maintained; the current display object is replaced only after the next line of lyrics meets the ready condition, and the animation time is reset at the actual replacement time.

[0043] In existing technologies, if the display resources are not ready before the display object is switched during line switching, empty frames will occur. Line switching is directly linked to the time-consuming preparation of display resources, and the switching delay depends on the preparation time of the current resource, making it difficult to maintain continuous visuals. The animation timing starts when the request is issued, but the lyrics line is only displayed after the display resources are ready. The first appearance of a new line may have already exceeded the animation start phase. The current display object and animation time are updated before the resources are actually available, which can easily cause blank spaces, overlapping of old and new content, or the word-by-word display starting from the middle. Although full pre-generation can avoid some switching waits, the initial preparation time, memory, and video memory overhead increase with the total number of lyrics lines, making it unsuitable for players that continuously switch songs and effects.

[0044] This embodiment links line switching with display resources and display object activation into a closed loop with clear state constraints. Based on continuous playback time, a prefetch set of lyrics lines ("current lyrics line plus subsequent lyrics lines") is formed, ensuring the current lyrics line always has the highest priority in the asynchronous text preparation queue. Display resources for subsequent lyrics lines are prepared in advance, achieving pre-generation of lyrics. Even if display resources are not ready, incomplete lyrics lines will not be set as the current display object, effectively guaranteeing continuous lyrics presentation and avoiding blank lines and the overlap of old and new content. This embodiment only times the animation duration of the new line when the actual line switching occurs, ensuring synchronous word-by-word display and correct display timing. This embodiment does not need to wait for all lyrics to be generated during line switching, avoiding long switching wait times, reducing memory usage, and ensuring continuous song switching effects. This embodiment establishes a sustainable operating mechanism and balance between "timely preparation of the next line" and "control of resource usage."

[0045] In one specific embodiment, During the display of the last subsequent lyric line in the current lyric line prefetch set, a next lyric line prefetch set is created, which includes the last subsequent lyric line in display order and M subsequent lyric lines to be played after it. During the display of the last subsequent lyric line, display resources for subsequent lyric lines in the prefetch set are requested in the order of display, and line switching operations are performed. or, During the display of the last subsequent lyric line in the current lyric line prefetch set, the next lyric line to be displayed is determined, and a next lyric line prefetch set is created, which includes the next lyric line to be displayed in display order and M subsequent lyric lines to be played after it. The next lyric line to be displayed is the first lyric line in the next lyric line prefetch set. During the display of the last subsequent lyric line, the display resources for the next lyric line to be displayed and subsequent lyric lines are requested sequentially from the prefetch set of the next lyric line in the display order, and the line switching operation is performed.

[0046] In this embodiment, the entire set of lyrics in the current lyrics prefetch set W can be replaced with the prefetch set of the next lyrics line only after all lyrics lines in the current lyrics prefetch set W have been displayed.

[0047] In one embodiment, the method further includes: If, during the display of the current lyrics line, it is detected that the lyrics line that should be displayed has jumped to another set lyrics line, then the timeline anchoring is re-performed, and a new lyrics line prefetch set is established with the set lyrics line as the first lyrics line. Request the display resources for the lyrics line. If the display resources for the lyrics line are ready, activate the lyrics line as the current display object, render and display the lyrics line. Start timing the animation duration of the lyrics line from zero at the actual activation moment. If the display resources for the set lyrics line are not ready, the current lyrics line before the jump is kept as the current display object. The preparation progress of the display resources for the set lyrics line is monitored. Once it is determined that the display resources for the set lyrics line are ready, the set lyrics line is activated as the current display object. The set lyrics line is rendered and displayed based on the display resources for the set lyrics line. The animation duration of the set lyrics line is timed from zero at the actual activation time. During the setting of lyric line display, display resources for subsequent lyric lines in the prefetch set are requested sequentially based on the display order, and line switching operations are performed.

[0048] Specifically, if a lyric line jump occurs or the user drags the progress bar, causing the lyric line to jump or the song to switch, the subsequent lyric lines in the current lyric line prefetch set may no longer need to be displayed. Therefore, this embodiment will create a new lyric line prefetch set to display the lyric lines in the new lyric line prefetch set sequentially.

[0049] Lyrics may jump or change during the display of any current line of lyrics.

[0050] The current lyrics line is the lyrics line that should be displayed at the moment. During the display of the current lyrics line, if it is detected that the lyrics line that should be displayed has jumped to the set lyrics line due to dragging or other reasons, a new lyrics line prefetch set is created to replace the current lyrics line prefetch set. The new lyrics line prefetch set will enter the preparation queue, which is used to perform tasks such as preparing display resources for the lyrics line.

[0051] Once created, the current lyrics line prefetch set will become the old lyrics line prefetch set, and the new lyrics line prefetch set will become the new current lyrics line prefetch set.

[0052] The set lyric line can be a lyric line outside the current lyric line prefetch set. For example, the set lyric line can be located in the current song after the last lyric line in the current lyric line prefetch set; the set lyric line can also be located in the current song before the first lyric line in the current lyric line prefetch set; the set lyric line can also be the first lyric line of the next song or any arbitrarily selected lyric line.

[0053] The set lyrics line can also be any other lyrics line within the current lyrics line prefetch set, excluding the current lyrics line.

[0054] For example, if we jump directly to line q, instead of scrolling line by line, we immediately start a new prefetch set of lyrics lines, W'={q, q+1, ..., q+M}. Items beyond the end of the lyrics and empty text lines are not added to the preparation queue.

[0055] After creating a new lyric line prefetch set, the set lyric line is designated as the first lyric to be displayed. Therefore, the display resources for the set lyric line are requested first, and then rendered and displayed.

[0056] During the display of the set lyrics line, the display resources of the subsequent lyrics lines in the prefetch set are requested or prepared in the order of display. When the line is switched, the line switching operation is performed according to steps S300 and S400, etc. For details, please refer to the relevant description, which will not be repeated here.

[0057] More specifically, after re-anchoring, the display resources of the set lyrics line are obtained. Once the display resources meet the readiness and validity conditions, the set lyrics line is activated at the frame boundary and its animation duration age is set to zero. During the period before readiness, the original current lyrics line can be kept as the current display object. The preparation progress of the display resources of the set lyrics line is monitored. Once the display resources of the set lyrics line are confirmed to be ready, the set lyrics line is activated as the current display object.

[0058] After creating a new lyrics line prefetch set, the display task for the old lyrics line prefetch set in the queue can be removed.

[0059] In one specific embodiment, the identifier data of the set lyrics line is requested and obtained, wherein the identifier data includes the session identifier and the line identifier; If the session identifier remains unchanged and the line identifier of the set lyrics line is still in the new lyrics line prefetch set, then the display resource of the set lyrics line is written to the cache and the display resource is marked as ready. The display resource of the set lyrics line in the cache can be overwritten by the corresponding new display resource, which is re-acquired based on the changed effect parameters.

[0060] Existing technologies that rely solely on asynchronous threads cannot guarantee correct results; after playback jumps, song changes, or parameter changes, old tasks may still return and pollute the current cache.

[0061] This embodiment can detect lyric jumps in a timely manner through monitoring and create a new lyric line prefetch set to ensure that the lyric lines displayed subsequently are synchronized with the lyric lines after the jump, preventing old lyric lines that do not need to be displayed from overwriting new lyric lines that need to be displayed.

[0062] In one embodiment, establishing a new lyrics prefetch set with the set lyrics line as the first lyrics line includes: If the set lyrics line is a different lyrics line from the current lyrics line prefetch set, then a new lyrics line prefetch set is created with the set lyrics line as the first lyrics line. The method also includes: If the set lyric line is another lyric line within the current lyric line prefetch set, then the lyric lines preceding the set lyric line are removed from the current lyric line prefetch set, the set lyric line is made the first lyric line in the current lyric line prefetch set, and the number of subsequent lyric lines equal to the number removed are added to the current lyric line prefetch set.

[0063] Specifically, if the set lyrics line is a lyric line other than the current lyrics line prefetch set, then the set lyrics line can be located in the current song after the last lyrics line k+M in the current lyrics line prefetch set; the set lyrics line can also be located in the current song before the first lyrics line (current lyrics line k) in the current lyrics line prefetch set; the set lyrics line can also be the first lyrics line of the next song or any arbitrarily selected lyrics line.

[0064] If the lyrics line is set to be located in the current song before the first lyrics line in the current lyrics line prefetch set, then the intersection of the new lyrics line prefetch set and the current lyrics line prefetch set is determined, and the display resources of the target lyrics line in the cache and the display resources already obtained in the current lyrics line prefetch set are retained, wherein the target lyrics line is a lyrics line in the intersection.

[0065] In this way, when preparing display resources for each lyric line in the new lyric line prefetch set, it is only necessary to prepare display resources for the lyric lines outside the intersection in the new lyric line prefetch set. There is no need to prepare display resources for the target lyric line again. When the target lyric line needs to be displayed, the reserved display resources can be called directly.

[0066] In addition, display resources for lyric lines that are outside the intersection of the display resources already acquired in the current lyric line prefetch set can be recycled or deleted.

[0067] If the lyrics are set to be other lyrics within the current lyrics prefetch set, this embodiment does not create a new lyrics prefetch set, but updates the current lyrics prefetch set by scrolling or swiping.

[0068] More specifically, the lyrics lines preceding the set lyrics line are removed from the current lyrics line prefetch set, the set lyrics line is added as the first lyrics line in the current lyrics line prefetch set, and subsequent lyrics lines equal to the number removed are added to the current lyrics line prefetch set in display order. The newly added subsequent lyrics lines are located after the last lyrics line in the current lyrics line prefetch set after the removal.

[0069] For example, if the lyrics are set to line k+2, then lines k and k+1 are removed, line k+2 is made the first line, and lines k+M+1 and k+M+2 are added after line k+M.

[0070] This embodiment distinguishes whether the set lyric line is outside or inside the current lyric line prefetch set. When it is determined that the set lyric line is inside the current lyric line prefetch set, subsequent lyric lines can be removed and added to the current lyric line prefetch set by scrolling or swiping. It is simple and convenient, and can reuse some of the acquired display resources.

[0071] In one embodiment, after activating the next line of lyrics as the object to be displayed, the method further includes: The current lyric line is removed from the current lyric line prefetch set by scrolling line by line, the next lyric line is taken as the first lyric line in the current lyric line prefetch set, and the subsequent M+1th lyric line is added to the current lyric line prefetch set. Continue requesting display resources for subsequent lyrics lines from the prefetch set after the current lyrics line is updated, following the display order.

[0072] Specifically, in this embodiment, the current lyrics line prefetch set W is a sliding prefetch window or preparation window that scrolls with the current lyrics line. After the current lyrics line k is finished being displayed, it is removed from the current lyrics line prefetch set W, and the next lyrics line k+1 becomes the first lyrics line in the current lyrics line prefetch set W. Then, the new subsequent lyrics line k+M+1 is added to the current lyrics line prefetch set W.

[0073] For example, when M=3, the current lyrics line is k, and W={k, k+1, k+2, k+3}. When the current lyrics line switches to the next lyrics line k+1, it immediately scrolls to W={k+1, k+2, k+3, k+4}. The original current lyrics line k is removed from the preparation window, and the new next lyrics line k+4 enters the prefetch queue.

[0074] It should be noted that in this embodiment, the current lyrics prefetch set W can be scrolled sequentially only if there are no jumps such as lyrics line transitions, user dragging progress, or song switching.

[0075] Furthermore, the lyrics prefetch set contains lyrics that are constantly scrolling or sliding over time after its initial creation.

[0076] This embodiment updates the lyrics line by scrolling or swiping to prefetch the current lyrics line set, which is convenient and quick, and can reuse some of the already acquired display resources.

[0077] In one embodiment, the method further includes, before activating the next line of lyrics as the object to be displayed: Request and retrieve the identifier data of the next lyric line in the current lyric line prefetch set, where the identifier data includes the session identifier and the line identifier; If the session identifier remains unchanged and the line identifier of the next lyrics line is still in the current lyrics line prefetch set, then the display resource of the next lyrics line is written to the cache, and the display resource is marked as ready. The display resource in the cache can be overwritten by the new display resource, which is re-acquired based on the changed effect parameters.

[0078] Specifically, the lyrics rendering and display involves a lot of work. If this work is simply put into an asynchronous thread without a clear session identifier and submission judgment, then tasks submitted earlier may overwrite the correct lyrics after the jump if they return at a later time.

[0079] This embodiment can determine whether to submit the prepared display resources to the cache by using identification data, thereby avoiding the lyrics of the old task from overwriting the lyrics of the new task after the lyrics jump.

[0080] More specifically, lyrics session management can create lyrics sessions for songs to be played, generate session names (or session codes) and session codes G, and record information such as the start time, end time, lyrics text, and line ID (lineId) of each lyric line in the song to be played.

[0081] Before activating the next line of lyrics as the current display object, obtain the session identifier and line identifier of the next line of lyrics. The session identifier is the session name (or, session code) and / or session number G.

[0082] After the display resources for the next line of lyrics are ready, but before the submission, the submission conditions are checked as follows: whether the line identifier of the next line of lyrics is still in the current line of lyrics prefetch set; whether the session identifier remains unchanged, that is, whether the current valid session identifier is still the session identifier to which the next line of lyrics belongs.

[0083] If the currently valid session identifier is consistent with the session identifier of the next lyrics line, and the line identifier of the next lyrics line is still in the current lyrics line prefetch set, it means that the song has not been switched, and the next lyrics line is still a lyrics line to be displayed. The display resources of the next lyrics line can be written to the cache, and the display resources are marked as ready to be called during rendering.

[0084] If the session identifier changes, it indicates that an operation such as song switching has occurred. The line identifier of the next lyric line will definitely not be in the current lyric line prefetch set. You can remove the display tasks of all remaining undisplayed lyric lines in the lyric line prefetch set where the next lyric line is located and / or delete the display resources.

[0085] If the session identifier remains unchanged, and the line identifier of the next lyric line is not in the current lyric line prefetch set, then the current lyric line prefetch set has changed. For example, if the lyrics have been dragged, the display tasks of all remaining undisplayed lyric lines in the lyric line prefetch set containing the next lyric line can be removed and / or the display resources can be deleted.

[0086] For example, the old line L k+1 Although the display task has been completed and the display resources have been obtained, the playback position has jumped to L. m Its session identifier is inconsistent with the currently valid session identifier, old line L k+1 The line identifier is also not in the current lyrics line prefetch set, therefore the old line L k+1 Display resources will not be written to the cache.

[0087] The purpose of caching is to ensure that the current and subsequent lines of lyrics are prepared before line switching, and to allow the uploaded glyph textures to be reused across animation frames for the same line. Without caching, it is impossible to directly obtain the prepared resources at line boundaries, requiring repeated layout, rasterization, and uploading, which increases switching latency and processing burden.

[0088] In addition, display resources corresponding to expired tasks are not written to the cache, which can prevent old lyrics or old parameters from occupying resources or overwriting valid results.

[0089] In addition, if at least one of the effect parameters, such as font, font size, canvas size, allowed width, line spacing, etc., is changed, a new display resource will be generated, and the new display resource will replace the old display resource in the cache.

[0090] This embodiment can determine whether to submit the prepared display resources to the cache by using identification data. In the event of a lyrics line jump, the timeline can be re-anchored, the original next line callback can be canceled, the old task running in the background but not yet finished can be canceled, and the new current lyrics line can be calculated, thereby avoiding the lyrics of the old task from overwriting the lyrics of the new task after the lyrics jump.

[0091] In this embodiment, the preparation and submission phases are clearly separated. Any candidate object completed out of order must undergo submission checks, and the order in which resources are completed will not disrupt the display order seen by the user.

[0092] In this embodiment, the asynchronous result carries a session identifier and a line identifier, and performs validity verification during task execution and before result publication; this prevents the display resources of expired tasks from being written to the current cache after playback jumps or parameter changes, which could lead to old and new content being interleaved or old lyrics overwriting new lyrics.

[0093] In one embodiment, requesting display resources for subsequent lyric lines in the prefetch set based on the display order includes: Request and retrieve the text association data for subsequent lyrics lines, wherein the text association data includes at least one of the following: font and fallback font, target canvas size, allowed width, line spacing and initial font size, and text content; The text content of subsequent lyric lines is subjected to glyph shaping to obtain multiple glyph clusters and shaping results; Based on the text association data, the glyph clusters are arranged according to the target width and maximum height. If the arrangement height exceeds the area allowed by the special effect, the glyph clusters are rearranged again by reducing the font size until the space constraints are met or the minimum font size is reached, thus obtaining the text layout. Based on the text layout and shaping results, the outline of the subsequent lyrics lines is rasterized into a line-shaped texture carrying multi-channel data, where the line-shaped texture belongs to the character texture of the lyrics line; Obtain media and graphic resources for subsequent lyric lines.

[0094] Specifically, display resources include reshaping results, text layouts, glyph textures, media resources, and graphics resources. This embodiment implements asynchronous preparation of display resources.

[0095] The text-related data for the lyrics line needs to be retrieved via a request. Among these, effects parameters affecting layout, such as font size, font type, target canvas size, and allowed width, can be reset by the user. If a lyrics line's display resource, after being prepared and cached, changes at least one of its effects parameters (font size, font type, target canvas size, allowed width, etc.), its display resource needs to be updated according to the changed parameters before it is displayed. The updated display resource will replace the old one. When simply changing animation parameters such as the final color and transparency that do not affect the text geometry, the original multi-channel glyph texture can continue to be used; only the frame-by-frame rendering parameters need to be updated.

[0096] The text preparation thread performs paragraph direction analysis and bidirectional text processing on the lyrics, selects a font based on its supported range, and uses the glyph clusters after glyph reshaping as the smallest layout unit. Line breaks, truncation, and width measurements are all performed on the pixel boundaries of the reshaping result, without truncation in the middle of UTF-8 bytes or within combined characters. This preserves the correct glyphs and baselines for Chinese characters, Latin ligatures, diacritics, and right-to-left text.

[0097] The text is formatted according to the target width and maximum height. If the formatting height exceeds the area allowed by the effect, the font size is reduced and the text is formatted again based on the current formatting result until the space constraints are met or the minimum font size is reached.

[0098] After typesetting, each line of glyphs is rasterized into a glyph texture carrying multi-channel data, instead of directly generating a plain image with the final color. The R channel stores the glyph body coverage C(x,y), the G channel stores the stroke coverage Oedge(x,y) obtained by expanding the body coverage, the B channel stores the normalized display order q(x,y) of the glyph cluster to which the pixel belongs, and the A channel stores fixed data values. The display order is arranged according to the shaped clusters, not according to the original bytes.

[0099] The shaping result includes glyph number, glyph cluster to which the glyph belongs, horizontal offset, vertical offset, advance amount, line number, and baseline. The text layout, or layout result, includes: line breaks, glyph number, included glyph clusters, font selection, position of each glyph, line width, and line height.

[0100] Text layout and glyph data (multi-channel data) are first completed on the non-rendering thread. At the beginning of each frame, the rendering thread issues a graphics resource request for the glyph textures in the lyrics prefetch set. The graphics resource management module completes the creation and uploading of glyph textures, and returns the layout result, glyph textures, effect images or videos, and the ready status of scene objects, respectively.

[0101] Media resources include special effects images (or background images) and / or videos, and other media. Graphics resources include the graphics scenes and pipelines required for each frame.

[0102] In one specific embodiment, a resource budget can be set for the glyph texture.

[0103] For example, limit the width of a single line texture to no more than 8192 pixels, the height to no more than 4096 pixels, and the total number of pixels to no more than 8×1024×1024; if the budget is exceeded, stop generating line-shaped textures and enter a controlled failure or degradation process to prevent abnormal lyrics from causing unbounded memory allocation.

[0104] In this embodiment, text preparation is based on the reshaped clusters and character boundaries. Latin words, Chinese characters, combined diacritics, and right-to-left text can be processed in the same process, avoiding glyph destruction caused by splitting by byte or simple character subscript.

[0105] In one embodiment, glyph shaping is performed on the text content of subsequent lyric lines, including: The text content of subsequent lyrics is analyzed in terms of text direction, writing system, and two-way text. Select the target font for the text in the text content; The text content of subsequent lyric lines is parsed as UTF-8 text and the character boundaries are determined to obtain multiple glyphs and glyph clusters; Wrap lines on safe pixel boundaries according to the target width; selecting a primary font or a fallback font based on a font coverage range; calculating a glyph number, a glyph cluster to which the glyph belongs, a position offset (a horizontal position and a vertical position), a baseline, an advance amount, a line width, and a line height of each glyph.

[0106] specifically, the purpose of glyph shaping is to transform a logical string into correctly drawable glyphs and positions, and process ligatures, combining diacritical marks, Arabic contextual glyphs, and mixed-direction text.

[0107] performing line wrapping at a safe grapheme boundary according to a target width, that is, rearranging according to a visual order and wrapping at a safely breakable cluster boundary.

[0108] for example, a lyric line is "Á office 你好", where the letter A and the combining accent mark should be treated as a same grapheme / shaping cluster, and cannot be split from the middle; the letter combination in "office" may form a ligature glyph according to a font rule; "你" and "好" usually form glyph clusters separately. A shaping result is not an image, but a set of data records including a glyph number, a glyph cluster to which the glyph number belongs, a horizontal offset, a vertical offset, an advance amount, a line where the glyph is located, and a baseline, and rasterization is subsequently performed according to the data records.

[0109] in the prior art, splitting directly according to character encoding may further destroy a shaping result of a ligature, a combining diacritical mark, or right-to-left text.

[0110] in this embodiment, text preparation is performed based on a shaped cluster and grapheme boundary, a Latin word, a Chinese character, a combining diacritical mark, and right-to-left text can be processed in a same process, and glyph destruction caused by splitting according to bytes or simple character subscripts is avoided.

[0111] in an embodiment, the glyph texture further includes a cell texture; the method further includes: generating a cell texture for a text unit or a glyph cluster that needs to be moved independently, without destroying a shaping result.

[0112] specifically, in a lyric line, a special effect to be displayed may require a text unit to be moved independently. In this case, a cell texture needs to be generated for an independently moved text unit (for example, a word) or glyph cluster. The cell texture is used as an optional texture in the glyph texture.

[0113] a line glyph texture is an entire line texture, and the entire line texture writes all glyphs in one typesetting line into a same multi-channel texture, which is used for entire line centering, character-by-character reveal, and the like.

[0114] however, the cell texture is a local texture separately generated, from a same layout result, for a word or glyph cluster that needs to be moved independently, and data such as a same coverage / reveal order can be used. When the cell texture passes through a same generation path, the cell texture is also constrained by a same size budget.

[0115] In one embodiment, multi-channel data is obtained through the following steps: Assign an order value to each glyph cluster according to the display order, and write the order value to the B channel of the pixels contained in the corresponding glyph cluster. The contained pixels include the main pixels, or the contained pixels include the main pixels and anti-aliased boundary pixels that share the same order value. Write the coverage of the main body of the character into the R channel of the corresponding character cluster; The stroke coverage is obtained by performing neighborhood maximum expansion on the glyph body coverage with the stroke radius, and the stroke coverage is written into the G channel of the corresponding glyph cluster.

[0116] Specifically, suppose the text of a lyric line is shaped into N valid glyph clusters. A normalized order value qj is assigned to the j-th glyph cluster according to its display order, as shown in Formula 5. The order value, i.e., the cluster-level display order, indicates the relative position of the corresponding glyph cluster within the lyric line. This order value is written to the B channel of the pixel corresponding to the glyph cluster, enabling the texture pixel to look up the relative position of its glyph cluster within the entire line.

[0117] qj = j / max(1, N-1),j=0,1,…,N-1 Formula 5 In Formula 5, N is the number of valid glyph clusters, and j is the glyph cluster number; the denominator is 1 when there is only one cluster in the entire line. Using glyph clusters instead of character encoding numbers allows hyphens and combined diacritics to remain in the same display unit.

[0118] The glyph coverage C(x,y) is written to the R channel; the stroke radius r is used to perform neighborhood maximum expansion on C(x,y) to obtain the stroke coverage Oedge(x,y) and write it to the G channel, as shown in Formulas 6-1 to 6-2. In actual calculations, the horizontal maximum value processing can be performed first, followed by the vertical maximum value processing, to reduce redundant comparisons.

[0119] O(x,y) = max C(x+u,y+v), -r≤u≤r, -r≤v≤r Formula 6-1 Oedge(x,y)=max(O(x,y)-C(x,y),0) Formula 6-2 In Formula 6-1, (x,y) represents the pixel coordinates of the texture, and u and v are the neighborhood offsets within the stroke radius. For the transparent anti-aliased boundary of a glyph, as long as the pixel is written by a glyph cluster, qj of that cluster is also written simultaneously; thus, when the graphics interface performs linear sampling, boundaries with near-zero coverage will not be mixed into the display order of other clusters. O(x,y) is the dilated coverage, and the O(x,y) obtained by expanding the current maximum value includes the main glyph region.

[0120] In Formula 6-2, Oedge(x,y) represents the stroke coverage.

[0121] In addition, after expansion, new stroke pixels may be generated outside the main pixels. During expansion, the order value of the glyph cluster to which the neighboring pixel with the largest coverage belongs can be propagated as the order value of the corresponding stroke pixel.

[0122] When writing to the B channel, not only are sequence values ​​written to the opaque glyph pixels, but these sequence values ​​are also preserved at the transparent anti-aliased boundaries of the glyph bitmap. When the graphics processor uses bilinear sampling, the boundary pixels still have the same sequence as their respective glyph clusters, preventing glyph edges from appearing before the main body.

[0123] Transparent anti-aliased boundaries inherit the display order of their respective glyph clusters, ensuring that glyph edges do not appear before the main body when the texture is linearly filtered.

[0124] In one embodiment, rendering and displaying based on display resources includes: The display coefficient of lyrics pixels is calculated based on the transition time of a single character from transparent to fully displayed, the cumulative animation time of a new line from the actual activation time, the order value of the character cluster to which it belongs, and the start interval between adjacent character clusters. The transparency of the main body is calculated based on the visibility coefficient and the coverage of the main body of the font; Calculate the stroke transparency based on the visibility factor and stroke coverage; The main body transparency is multiplied by the main body color, and the stroke transparency is multiplied by the stroke color. Then, these are blended with the target image for transparency. The text texture carrying multi-channel data is reused in multiple frames, and then combined with the special effects parameters for frame-by-frame rendering and display.

[0125] Specifically, when rendering lyrics pixels, the frame-by-frame rendering module reads the glyph body coverage C(x,y), stroke coverage Oedge(x,y), and order value q(x,y) from the multi-channel data. age is the cumulative animation duration of the newline from the actual activation moment, λ is the sum of the start intervals between all adjacent glyph clusters, that is, the total start span from the first glyph cluster to the last glyph cluster, and d is the transition duration of a single glyph from transparent to fully displayed. Then, the display coefficient v(x,y,t) of the pixel can be calculated according to Formula 7.

[0126] v(x,y,t) = smoothstep[0, d, age - q(x,y)·λ] Formula 7 In Formula 7, q(x,y) ranges from 0 to 1, representing the relative order of the glyph cluster to which the pixel belongs within the entire row; qj is a scalar order value for the j-th glyph cluster; and q(x,y) is the pixel-by-pixel order field expanded onto the entire texture. For the main pixel belonging to the j-th glyph cluster and its anti-aliasing boundary pixels, q(x,y) = qj, and this value is written to the B channel. Therefore, the q(x,y) read from the B channel of a pixel during rendering is the qj of the glyph cluster to which that pixel belongs.

[0127] `smoothstep` is an interpolation function that smoothly varies between 0 and `d`. The cluster is invisible until `age` reaches `q(x,y)·λ`; it then gradually appears over time `d`. Since the accumulated animation duration `age` only starts from zero when the actual line transition occurs, the time consumed by text preparation and texture uploading does not cause the animation to run ahead of time.

[0128] The main body transparency α(x,y,t) and stroke transparency αo(x,y,t) are calculated by formula 8; the final color, scaling, displacement, refraction, halo and other special effects parameters participate in frame-by-frame rendering without regenerating the glyph texture.

[0129] α(x,y,t) = C(x,y)·v(x,y,t); αo(x,y,t) = Oedge(x,y)·v(x,y,t) Formula 8 In Formula 8, C(x,y) is the main body coverage of the R channel, Oedge(x,y) is the stroke coverage of the G channel, and v(x,y,t) is the display coefficient obtained from Formula 7. The main body and stroke share the same display order, but can use different colors and brightness. For effects that do not require character-by-character display, setting v(x,y,t) directly to 1 allows the reuse of the same texture. That is, multiple animation frames or graphic frames of the same lyric line share the same glyph texture, where the glyph texture includes the line glyph texture, or the glyph texture includes the line glyph texture and the unit texture.

[0130] The main body transparency α(x,y,t) and stroke transparency αo(x,y,t) are blending coefficients directly used in frame-by-frame rendering. During rendering, the main body color is multiplied by α(x,y,t), the stroke color is multiplied by αo(x,y,t), and then blended with the target image for transparency. Finally, by reusing the glyph texture carrying multi-channel data across multiple frames, and combining it with effect parameters, frame-by-frame rendering and display are performed.

[0131] Among them, the body transparency α(x,y,t) and the stroke transparency αo(x,y,t) determine how much of the glyph body and stroke are displayed in the current pixel, and are not just used for intermediate judgment.

[0132] The final effects parameters, such as color, scaling, displacement, refraction, and halo, are "determinable within the current frame." Color can come from effects configuration or user settings; scaling and displacement can be calculated based on the accumulated animation duration (age); refraction can be calculated based on the current raindrop height field; and halo can be calculated based on glyph masking and blur parameters. These parameters only change the way they are combined in the current frame; if the glyph geometry is not altered, textures do not need to be regenerated.

[0133] During rendering, the texture is sampled and the display range is calculated in conjunction with the animation time. "Sampling texture" refers to reading the value at a specified coordinate of the texture during rendering, and "display range" refers to the character clusters and their pixel range that should be displayed at the current animation moment, which is used to achieve character-by-character or word-by-word display.

[0134] Each line of lyrics only needs to be typed, rasterized, and have its glyph texture generated once; subsequent animation frames repeatedly sample the same glyph texture, only changing the animation time (age) and recalculating the display coefficient, so there is no need to re-rasterize the line of lyrics for each frame.

[0135] In one specific embodiment, each frame adds the actual text layout and glyph textures involved in rendering to a fixed set; after the scene is submitted, only resources that were not fixed in this frame and are no longer in the current lyrics line prefetch set W are reclaimed. If a real error occurs in typography, font loading, or media decoding, the failure is recorded and retried after a set interval; if the task is simply replaced by a new generation or the current lyrics line prefetch set, it ends directly without error retrying, thus avoiding old tasks continuously occupying the background queue.

[0136] In this embodiment, the glyph texture carrying multi-channel data is reusable. The glyph body coverage, stroke coverage, and display order based on integer clusters are encoded into a reusable multi-channel data texture, and the shader calculates the display range of the body and stroke in conjunction with animation time.

[0137] Existing technologies generate the main body, outline, and text sequentially, or recalculate them frame by frame, which increases the number of textures and the burden on the central processing unit.

[0138] In this embodiment, the same character texture simultaneously saves the main body coverage, stroke coverage, and character cluster display order, which can be reused during frame-by-frame rendering without repeatedly generating character images for different display stages; the transparent edge inherits the order value, which can reduce the premature display of edges caused by bilinear sampling.

[0139] In one embodiment, the method further includes: Calculate and update the current lyrics position based on the media playback position, the overall lyrics delay, the monotonic clock time when the media playback position is read, and the anchor time. In response to a pause operation, the media playback position at the moment of pause is calculated as the new media playback position and the pause time is accumulated; In response to the recovery operation, the system re-anchors from the new media playback position and continues to calculate and update the current lyrics position; Determine the object to be displayed based on the current position of the lyrics.

[0140] Specifically, during a pause, the elapsed time of the monotonic clock is calculated to pa and accumulation stops, while the displayed object and age remain in their current state; upon resumption, the position is re-anchored and scheduling continues. The next position report from the player will trigger a necessary state synchronization, but normal periodic polling will not continuously reset the internal clock.

[0141] An anchor point for the playback position is established using a monotonically increasing clock. Let the anchor time be ta, the anchor media playback position be pa, and the overall lyrics delay be Δ. In playback mode, the current lyrics position pL(t) is calculated according to Formula 1; in pause mode, the lyrics position remains max[0,pa+Δ].

[0142] pL(t) = max[0, pa + (t - ta) + Δ] Formula 1 In Formula 1, pL(t) represents the current lyrics position, i.e., the media time. t is the monotonic clock time when the media position is read; ta is the monotonic clock time or anchoring time recorded during the most recent effective correction or playback status change; pa is the media playback position corresponding to ta; Δ is the time offset or overall lyrics delay set by the user or given by the lyrics file. Using a monotonic clock avoids the impact of system date and time changes on the lyrics position. When pa is paused, the elapsed time is first calculated into pa, and then the accumulation stops; when resuming, the same position is re-anchored.

[0143] The player can continue to provide external position pext periodically, but periodic reporting is only for verification and does not reset the internal clock with each report. First, the deviation e between the external position and the continuously estimated position is calculated, as shown in Formula 2; only when e exceeds the threshold ε, the playback state changes, or the player is in a non-playback state and the position has indeed changed, are pa and ta updated and the position correction sent to subsequent modules.

[0144] e = |pext - [pa + (t - ta)]|; Re-anchoring formula 2 when e > ε. In Formula 2, pext is the external playback position provided by the player, and ε is the threshold for distinguishing between normal polling errors and jumps. In this embodiment, ε = 850 ms is used. This value is used to identify obvious discontinuous changes, not the lyrics display precision; line boundaries during normal playback are still calculated in milliseconds by a continuous clock. The threshold can be configured according to the player's position reporting period and jitter range.

[0145] The internal continuous clock is calculated based on the previous playback position and the monotonic clock. However, the actual media position can change discontinuously due to user dragging, pause / resume, decoder repositioning, or position reporting delays. The purpose of position correction is to realign the internal lyrics timeline with the actual playback position and redefine the boundaries between the current and next lines when a significant deviation occurs. Without correction, dragging might continue to display lyrics in the old position; however, if correction is performed with every periodic report, ordinary reporting jitter would be introduced into the lyrics timeline. Therefore, this solution only corrects when the deviation exceeds a threshold or when the playback status changes.

[0146] The current line k to be displayed is determined based on pL(t), and the start time of the next line of lyrics to be displayed is calculated directly. The scheduler schedules a timed task only once for this boundary, and the task carries a session identifier, scheduling generation H, and target line identifier. H is incremented and the old callback is canceled each time there is a jump, pause and resume, or rescheduling. If the callback is actually executed later than the original boundary, pL(t) is reread to find the current line at the actual position, instead of rolling back the display position to the line originally pointed to by the task.

[0147] The method also includes: handling playback transitions, pause / resume events, and parameter changes. When playback jumps, the timeline is re-anchored based on the new external position, the scheduling generation H is incremented, the original next-line callback is canceled, and the new current line is calculated. The current lyrics line prefetch set W is immediately moved to the vicinity of the new line; the text preparation thread removes tasks and results that are no longer in the current lyrics line prefetch set W. Old tasks that are already running in the background but have not yet finished are terminated due to generation, identifier, or valid set mismatch before the checkpoint is canceled or the result is published.

[0148] When paused, the elapsed time of the monotonic clock is calculated to pa and accumulation stops, while the displayed object and animation duration age remain in their current state; when resumed, the position is re-anchored and scheduling continues. The next position report from the player will trigger a necessary state synchronization, but normal periodic polling will not continuously reset the internal clock.

[0149] When switching lyrics, font, font size, canvas size, or effects parameters that affect layout, update the session identifier or text request generation R, clear incompatible caches, and rebuild the target set. When simply changing the final color, transparency, or animation parameters that do not affect text geometry, the original multi-channel glyph texture can be used, and only the frame-by-frame rendering parameters need to be updated.

[0150] The playback position is anchored by a monotonic clock, and the periodic position report is corrected only when the deviation exceeds the threshold or the state changes; the next line callback carries the scheduling generation, and the late callback recalculates the current line according to the actual position.

[0151] In one embodiment, the method further includes: After the last graphics frame that references the display resources of the current lyrics line completes, the display resources of the current lyrics line are recycled.

[0152] Specifically, replaced text textures, video, or graphics objects are not destroyed immediately when the switch statement is executed, but are instead subject to delayed recycling after the last graphics frame referencing the object completes. This avoids releasing old resources while the CPU state has already switched and the graphics processor is still executing old commands.

[0153] In this embodiment, old resources such as old text, textures, and media resources are recycled after the last reference frame is completed, avoiding resource lifecycle conflicts between display object switching and asynchronous execution by the graphics processor.

[0154] Taking the current lyrics line as the k-th line as an example, the timeline is established as W={k, k+1, k+2, k+3} during the display of this line. The text preparation thread completes the k-th line first; if the k-th line has already been displayed, the next three lines are prepared in sequence, and the display resources containing the glyph textures are uploaded. After reaching the start time of the k+1-th line, the scheduler changes the cursor to k+1. If the texture of the k+1-th line has been uploaded, the system switches the current lyrics line to the k+1-th line in this frame and sets age=0; if the display resources are not yet ready, the k-th line is still used as the current display object, and the switch is made again in the first frame when the complete resources are ready, and the word-by-word display is calculated from that first frame.

[0155] Suppose that during the preparation of line k+2, the user drags to line m. The timeline is immediately re-anchored, and W becomes {m, m+1, m+2, m+3}. Even if line k+2 is completed subsequently, it is discarded because it is not in the new set W; line m is placed at the head of the queue. If the old line boundary callback arrives late, the H it carries has also expired, and the display position cannot be changed back to k+1 or k+2. Thus, time scheduling and resource preparation handle their respective expired states, but ultimately converge on the same lyrics line activation condition.

[0156] refer to Figure 2 This application also provides a playback device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of any of the methods described above.

[0157] For details on how the playback device works, please refer to the description of the lyrics display method above; it will not be repeated here.

[0158] like Figure 2As shown, the playback device includes a processor, a memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program causes the processor to perform the steps in the above-described method embodiments. The internal memory may also store a computer program, which, when executed by the processor, causes the processor to perform the steps in the above-described method embodiments. Those skilled in the art will understand that... Figure 2 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the playback device to which the present application is applied. A specific playback device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0159] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0160] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0161] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for displaying lyrics, characterized in that, The method includes: Create a current lyrics line prefetch set, wherein the current lyrics line prefetch set includes the current lyrics line arranged in display order and M subsequent lyrics lines to be played after it; During the display of the current lyric line, display resources for subsequent lyric lines in the prefetch set of the current lyric line are requested based on the display order; Upon reaching the start time of the next lyric line or receiving a line switching notification, if the display resources for the next lyric line are ready, the next lyric line will be activated as the current display object, rendered and displayed based on the display resources, and the animation duration of the next lyric line will be timed from zero at the actual activation time. If the display resources for the next line of lyrics are not ready, the current line of lyrics remains the object to be displayed. The progress of the display resource preparation is monitored. Once the display resources for the next line of lyrics are ready, the next line of lyrics is activated as the object to be displayed. The lyrics are then rendered and displayed based on the display resources. The animation duration of the next line of lyrics is timed from zero at the actual activation moment.

2. The method according to claim 1, characterized in that, The method further includes: If, during the display of the current lyrics line, it is detected that the lyrics line that should be displayed jumps to the set lyrics line, then the timeline anchoring is re-performed, and a new lyrics line prefetch set is established with the set lyrics line as the first lyrics line. Request the display resources for the lyrics line. If the display resources for the lyrics line are ready, activate the lyrics line as the current display object, render and display the lyrics line. Start timing the animation duration of the lyrics line from zero at the actual activation moment. If the display resources for the set lyrics line are not ready, the current lyrics line before the jump is kept as the current display object. The preparation progress of the display resources for the set lyrics line is monitored. Once it is determined that the display resources for the set lyrics line are ready, the set lyrics line is activated as the current display object. The set lyrics line is rendered and displayed based on the display resources for the set lyrics line. The animation duration of the set lyrics line is timed from zero at the actual activation time. During the setting of lyric line display, display resources for subsequent lyric lines in the prefetch set of the new lyric line are requested sequentially based on the display order, and line switching operations are performed.

3. The method according to claim 2, characterized in that, The establishment of a new lyrics prefetch set with the set lyrics line as the first lyrics line includes: If the set lyrics line is a different lyrics line from the current lyrics line prefetch set, then a new lyrics line prefetch set is created with the set lyrics line as the first lyrics line. The method further includes: If the set lyric line is another lyric line within the current lyric line prefetch set, then the lyric lines preceding the set lyric line are removed from the current lyric line prefetch set, the set lyric line is taken as the first lyric line in the current lyric line prefetch set, and subsequent lyric lines equal to the number removed are added to the current lyric line prefetch set.

4. The method according to any one of claims 1-3, characterized in that, After activating the next line of lyrics as the currently displayed object, the method further includes: The current lyric line is removed from the current lyric line prefetch set by scrolling line by line, the next lyric line is taken as the first lyric line in the current lyric line prefetch set, and the subsequent M+1th lyric line is added to the current lyric line prefetch set. Continue requesting display resources for subsequent lyrics lines from the prefetch set after the current lyrics line is updated, following the display order.

5. The method according to any one of claims 1-3, characterized in that, Before activating the next line of lyrics as the currently displayed object, the method further includes: Request and retrieve the identifier data of the next lyric line in the current lyric line prefetch set, wherein the identifier data includes the session identifier and the line identifier; If the session identifier remains unchanged and the line identifier of the next lyrics line is still in the current lyrics line prefetch set, then the display resource of the next lyrics line is written to the cache and the display resource is marked as ready. The display resource in the cache can be overwritten by the corresponding new display resource, which is re-acquired based on the changed effect parameters.

6. The method according to any one of claims 1-3, characterized in that, The step of requesting display resources for subsequent lyric lines in the prefetch set of the current lyric line based on display order includes: Request and obtain text association data for subsequent lyrics lines, wherein the text association data includes at least one of the following: font and fallback font, target canvas size, allowed width, line spacing and initial font size, and text content; The text content of subsequent lyric lines is subjected to glyph shaping to obtain multiple glyph clusters and shaping results; Based on the text association data, the glyph clusters are arranged according to the target width and maximum height. If the arrangement height exceeds the area allowed by the special effects, the glyph clusters are rearranged again by reducing the font size until the space constraints are met or the minimum font size is reached, thus obtaining the text layout. Based on the text layout and shaping results, the outline of the subsequent lyrics lines is rasterized into a line-shaped texture carrying multi-channel data, where the line-shaped texture belongs to the character texture of the lyrics line; Obtain media and graphic resources for subsequent lyric lines.

7. The method according to claim 6, characterized in that, The glyph texture also includes unit texture; The method further includes: Without disrupting the reshaping results, generate unit textures for glyph clusters that need to be moved independently.

8. The method according to claim 6, characterized in that, The multi-channel data is obtained through the following steps: Assign an order value to each glyph cluster according to the display order, and write the order value into the B channel of the pixels contained in the corresponding glyph cluster, wherein the contained pixels include main pixels, or the contained pixels include main pixels and anti-aliased boundary pixels that share the same order value. Write the coverage of the main body of the character into the R channel of the corresponding character cluster; The stroke coverage is obtained by performing neighborhood maximum expansion on the glyph body coverage with the stroke radius, and the stroke coverage is written into the G channel of the corresponding glyph cluster.

9. The method according to claim 8, characterized in that, The rendering and display based on display resources includes: The display coefficient of lyrics pixels is calculated based on the transition time of a single character from transparent to fully displayed, the cumulative animation time of a new line from the actual activation time, the order value of the character cluster to which it belongs, and the start interval between adjacent character clusters. The transparency of the main body is calculated based on the visibility coefficient and the coverage of the main body of the font; Calculate the stroke transparency based on the visibility factor and stroke coverage; The main body transparency is multiplied by the main body color, and the stroke transparency is multiplied by the stroke color. Then, these are blended with the target image for transparency. The text texture carrying multi-channel data is reused in multiple frames, and then combined with the special effects parameters for frame-by-frame rendering and display.

10. A playback device, comprising a memory and a processor, characterized in that, The memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 9.