Adaptive presentation method of graphic subtitles and player device

CN123020918APending Publication Date: 2026-10-30SHENZHEN ZIDOO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

[0003]本申请的主要目的在于提供一种图形字幕的自适应呈现方法及播放设备,可以解决现有技术中无法根据原始调色板解码颜色导致颜色解码错误的技术问题

Benefits of technology

本申请在传统图形字幕解码路径之外保留原始调色板,在不破坏传统字幕解码结果的前提下,同时保留传统调色板和原始调色板,使新增颜色算法具备真实输入,避免原始调色板过早丢失,导致后续无法根据原始调色板生成候选颜色,进而导致颜色转换错误的问题;且,可使任何异常都能无损回退到既有显示结果。将源色彩状态与输出色彩状态组成颜色环境快照,并以该颜色环境快照决定是否允许生成候选调色板,形成传统调色板与候选调色板并行存在的方案,可按条件自适应选择更贴近字幕状态的目标调色板,而不是使用固定调色板,可避免亮度过高和颜色突变。联合视频源色彩状态和输出色彩状态,可准确确定字幕输出类型,避免将原生HDR字幕和SDR源转换输出混淆,可保留原有色相关系,避免字幕偏暗或偏色。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123020918A_ABST
    Figure CN123020918A_ABST
Patent Text Reader

Abstract

The application discloses a kind of self-adapting presentation method and playing equipment of graphic caption, generates color environment snapshot;Parse caption object to obtain index bitmap and original palette, obtain traditional palette according to original palette;If it is allowed to generate candidate palette, obtain candidate palette according to original palette;Determine the target palette of caption object;According to index bitmap and target palette, render out caption bitmap with transparency and display.This application retains traditional palette and original palette simultaneously, so that the newly added color has real input, avoids the original palette from being lost too early, which leads to the inability to generate candidate colors based on the original palette later, and further causes color conversion error.According to the condition, it is determined whether to allow the generation of candidate palette, forming a scheme in which traditional palette and candidate palette exist in parallel, which can adaptively select a target palette that is closer to the caption state, and can reduce color deviation and color mutation during conversion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of audio and video processing technology, and in particular to an adaptive presentation method and playback device for graphic subtitles. Background Technology

[0002] Traditional decoders read the graphic subtitle color palette and select a transformation matrix based on the video resolution or a fixed configuration to directly generate the color palette for display. Subsequent rendering only retains the transformed color palette and no longer preserves the original color palette in the bitstream. Consequently, subsequent color decoding cannot be performed based on the original color palette, leading to color decoding errors or distortion. Summary of the Invention

[0003] The main purpose of this application is to provide an adaptive presentation method and playback device for graphic subtitles, which can solve the technical problem in the prior art that the inability to decode colors based on the original color palette leads to color decoding errors.

[0004] To achieve the above objectives, the first aspect of this application provides an adaptive rendering method for graphic subtitles, the method comprising: Periodically read the current output color state and source color state. If both the current output color state and source color state are available, generate a color environment snapshot containing the available current output color state and source color state. Parse the current subtitle object to obtain the index bitmap and color entry set. The color entry set contains multiple color entries, and each color entry contains color components extracted from the current subtitle object. Based on the set of color entries, the original color palette is obtained. Then, based on the standard dynamic range conversion path, the set of color entries is converted to obtain the traditional color palette. Based on the current subtitle object's color environment snapshot, index bitmap, original color palette, and traditional color palette, determine whether to allow the generation of candidate color palettes; If candidate color palettes are allowed to be generated, then the original color palette is color-converted to obtain the candidate color palettes; Determine the target color palette for the current subtitle object, where the target color palette is either a traditional color palette or a candidate color palette; A subtitle bitmap with transparency is rendered and displayed based on the index bitmap and the target color palette.

[0005] 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 any of the above methods.

[0006] The embodiments of this application have the following beneficial effects: This application retains the original color palette outside the traditional graphic subtitle decoding path. Without disrupting the traditional subtitle decoding results, it preserves both the traditional and original color palettes, ensuring that new color algorithms have realistic input and preventing the premature loss of the original color palette, which could lead to errors in color conversion due to the inability to generate candidate colors based on it. Furthermore, it allows for lossless rollback to existing display results in case of any anomalies. A color environment snapshot is created by combining the source and output color states, and this snapshot is used to determine whether candidate color palette generation is allowed. This creates a scheme where the traditional and candidate color palettes coexist. It can adaptively select a target color palette that is closer to the subtitle state based on conditions, rather than using a fixed palette, thus avoiding excessive brightness and color abrupt changes. By combining the video source and output color states, the subtitle output type can be accurately determined, avoiding confusion between native HDR subtitles and SDR source conversion outputs. It preserves the original hue relationships and prevents subtitles from being too dark or discolored. Attached Figure Description

[0007] 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.

[0008] in: Figure 1 This is a flowchart of the adaptive rendering method for graphic subtitles in the embodiments of this application; Figure 2 This is a structural block diagram of the playback device in the embodiments of this application. Detailed Implementation

[0009] 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.

[0010] Traditional media players typically convert Y, Cr, and Cb into red, green, and blue three-channel colors according to a fixed Standard Dynamic Range (SDR) matrix when decoding color palettes. This process is usually effective for ordinary SDR sources, but new problems arise in High Dynamic Range (HDR) playback: the color values ​​in some subtitle palettes need to be interpreted in conjunction with the source's transmission characteristics and the actual output state of the device; if the conversion is still done in a fixed SDR manner, the subtitles may be too dark, have color cast, or lose their original hue relationships. In addition, when the player starts up, switches sources, or switches output modes, the video source state and the actual display output state are not necessarily synchronized; in the same output mode, subtitles created according to SDR relationships and those created according to HDR relationships may be encountered simultaneously. If HDR mapping is forcibly applied to all subtitles whenever HDR output is detected, it may incorrectly convert white or colored subtitles originally created according to SDR, resulting in excessive brightness or abrupt color changes.

[0011] Existing media players read the current output mode. When the output mode is marked as HDR, the same HDR conversion rules are used to process all palette entries for the current subtitles; when the output mode is SDR, the original conversion result is used. This approach typically only determines the output state, without further determining the characteristics of the source material or analyzing which palette colors are actually used in the current subtitles.

[0012] In existing technologies, after the decoder reads the graphic subtitle color palette, it selects a YCrCb to RGB conversion matrix based on the video resolution or a fixed configuration to directly generate the color palette for display. Subsequent rendering only retains the converted RGB color palette, no longer preserving the original Y, Cr, Cb, and A data from the bitstream. This approach leads to the premature loss of the original color palette. Once the decoder retains only the traditional RGB color palette, even if the correct source and output state are obtained later, it will be impossible to regenerate candidate colors based on the original Y, Cr, and Cb data.

[0013] Based on this, this application provides an adaptive presentation or display scheme for graphic subtitles.

[0014] like Figure 1 As shown, in one embodiment, an adaptive rendering method for graphic subtitles is provided. This method can be applied to either a playback terminal or a playback device (player). The adaptive rendering method for graphic subtitles specifically includes the following steps: S100: Periodically read the current output color state and source color state. If both the current output color state and source color state are available, generate a color environment snapshot containing the available current output color state and source color state.

[0015] Specifically, after the main feature enters the stable playback stage, the current output color state and the source color state are read simultaneously.

[0016] The source color state refers to the transfer characteristics corresponding to the video source. These include, for example, perceptual quantizer (PQ), hybrid log-gamma (HLG), and unknown states.

[0017] The current output color status refers to the actual display output status currently used by the device being played. This includes, for example, SDR output status (standard dynamic range output status), HDR output status (high dynamic range output status), and unknown output status; specific products can be further subdivided into different HDR output types.

[0018] SDR output stands for Standard Dynamic Range output.

[0019] HDR output stands for High Dynamic Range output. High Dynamic Range (HDR) is a term used to describe high dynamic range output.

[0020] When both the source color state and the current output color state are available, a color environment snapshot C=(S,O) is created by combining the two and published to the subtitle decoding thread, where S represents the source color state and O represents the current output color state.

[0021] In addition, color environment snapshots can come from device nodes, player internal states, display interface feedback, or video decoding metadata, as long as they can distinguish between source transmission characteristics and actual output states, and clear the old states when switching playback tasks.

[0022] S200: Parse the current subtitle object to obtain the index bitmap and color entry set, wherein the color entry set contains multiple color entries, and each color entry contains color components extracted from the current subtitle object.

[0023] Specifically, graphic subtitles consist of an index bitmap (B), a color palette, coordinates, and display timing. Graphic subtitles are not text reformatted by the playback device, but rather are composed of the index bitmap, color palette, display coordinates, and display duration provided by the subtitle stream.

[0024] Presentation Graphic Stream (PGS) captions are a type of graphic caption format.

[0025] Taking Presentation Graphic Stream (PGS) captions as an example, the bitmap pixels of a caption object store a palette index. Palette entries typically include color components such as luminance component Y, red color difference component Cr, blue color difference component Cb, and transparency component A.

[0026] A subtitle is a collection of one or more subtitle objects that together constitute a single frame of subtitles at the same time of presentation. For example, a PGS can correspond to a Display Set.

[0027] The decoder parses the current subtitle object in the subtitle stream to obtain the index bitmap and color entry set. The color entry set contains multiple color entries, which are also known as palette entries. For example, a subtitle object may contain 256 palette entries or color entries. Each color entry contains color components. For example, each raw entry occupies 4 bytes and sequentially stores the four color components: luminance (Y), red (Cr), blue (Cb), and alpha (A).

[0028] S300: Based on the set of color entries, obtain the original color palette. Based on the standard dynamic range conversion path, convert the set of color entries to obtain the traditional color palette.

[0029] Specifically, the original color palette is a set of color entries obtained directly from the subtitle stream.

[0030] The original color palette is obtained by preserving the color components of each color entry in the subtitle stream. For example, the luminance component Y_k, red color difference component Cr_k, blue color difference component Cb_k, and transparency component A_k of each color entry in the subtitle stream are preserved in their original order. The original color palette Q is composed of all color components that have not been converted or rewritten. The original color palette is not limited to 8-bit Y, Cr, Cb, A; other bit depths, component arrangements, or equivalent color representations can also be used. The key is to retain the data that can reconstruct candidate colors before traditional conversion and to have it exist in parallel with the traditional color palette.

[0031] By converting or rewriting the color components of the color entries according to the existing SDR conversion path of the playback device, the traditional color palette P_L can be obtained.

[0032] Among them, the traditional color palette is an RGB color palette or ARGB color palette generated according to the original SDR decoding path or conversion path of the playback device, denoted as P_L, which is the traditional result that is compatible with the behavior of existing playback devices.

[0033] The Standard Dynamic Range (SDR) conversion path is the existing conversion path of the playback device.

[0034] The traditional color palette P_L can be placed in the original rendering data area; the original color palette Q can be placed in the bypass data area.

[0035] It can also acquire and save palette metadata, which includes palette identifier, palette version, composition number, composition status, palette update flag, caption object identifier, object version, window identifier, and object composition flag.

[0036] S400: Based on the current subtitle object's color environment snapshot, index bitmap, original palette, and traditional palette, determine whether to allow the generation of candidate palettes.

[0037] Specifically, this step is used to determine whether candidate color palette generation is allowed. The entry point is determined based on the color environment snapshot (video source transmission characteristics) output in step S100 and the data integrity output in steps S200 and S300. Only when the conditions for candidate color palette generation are met will the process proceed to candidate color palette generation.

[0038] In addition, if the color environment snapshot is unknown, or is still in the switching phase, or the graphic composition method cannot be determined, then candidate palette conversion will not be performed.

[0039] S500: If generating candidate color palettes is allowed, then the original color palette is color-converted to obtain candidate color palettes.

[0040] Specifically, if candidate color palettes are allowed to be generated, then the original color palette is converted into color based on the transmission characteristics of the video source (i.e., the source color state), the actual output state read before playback begins, and the graphic white brightness reference, to obtain the candidate color palette.

[0041] Among them, the candidate color palette is a color palette regenerated from the original color palette, denoted as P_C.

[0042] After conversion, both the traditional color palette and the corresponding candidate color palette are retained.

[0043] S600: Determine the target color palette for the current subtitle object, where the target color palette is either a traditional color palette or a candidate color palette.

[0044] Specifically, after obtaining the candidate color palettes, the target color palette is selected from the traditional color palette and the candidate color palettes based on the colors actually used by the current subtitle object. That is, the target color palette is selected from the traditional color palette and the candidate color palettes based on the color components of the color entries.

[0045] If candidate palettes are not allowed to be generated, the traditional palette will be used as the final target palette for the current caption object.

[0046] S700: Renders a subtitle bitmap with transparency based on the index bitmap and the target color palette for display.

[0047] Specifically, the playback device first decodes and renders the index bitmap and target color palette into a subtitle bitmap with transparency (i.e., a color bitmap). After rendering, a subtitle bitmap with transparency is generated and handed over to the upper layer for display, so that the subtitle bitmap can be superimposed on the video screen for display.

[0048] It should be noted that a single frame of subtitles, presented at the same time, may contain one or more subtitle objects, which represent subtitles at different positions. When multiple subtitle objects are present, after obtaining the index bitmaps and target color palettes of all subtitle objects through steps S100-S700, the subtitle bitmaps are rendered and composited to achieve adaptive presentation of the graphic subtitles at the same time.

[0049] In existing technology, the player reads the current output mode. When the output mode is marked as HDR, the same set of HDR conversion rules is used to process all palette entries of the current subtitles; when the output mode is SDR, the original conversion result is used. This approach typically only determines the output state, without further determining the characteristics of the source material or analyzing which palette colors are actually used in the current subtitles.

[0050] In existing technologies, traditional decoders read the graphic subtitle color palette and select a transformation matrix based on the video resolution or a fixed configuration to directly generate a color palette for display. Subsequent rendering only retains the transformed color palette and no longer preserves the original color palette in the bitstream. Consequently, subsequent color decoding cannot be performed based on the original color palette, leading to color decoding errors or distortion.

[0051] This embodiment retains the original color palette outside the traditional graphic subtitle decoding path. Without disrupting the traditional subtitle decoding results, it preserves both the traditional and original color palettes, providing new color algorithms with realistic input and preventing the premature loss of the original color palette, which could lead to errors in color conversion due to the inability to generate candidate colors based on it. Furthermore, it allows for lossless rollback to existing display results in case of any anomalies. A color environment snapshot is created by combining the source and output color states, and this snapshot is used to adaptively determine whether to allow candidate color palette generation. This creates a scheme where the traditional and candidate color palettes coexist. It can adaptively select a target color palette that more closely matches the subtitle state based on conditions, rather than using a fixed palette, thus avoiding excessive brightness and color abrupt changes. By combining the video source and output color states, the subtitle output type can be accurately determined, avoiding confusion between native HDR subtitles and SDR source conversion outputs. It preserves the original hue relationships and prevents subtitles from being too dark or discolored.

[0052] In one embodiment, determining the target color palette for the current subtitle object, wherein the target color palette is a traditional color palette or a candidate color palette; includes: If a candidate color palette exists, count the actual number of pixels for each color entry; Color entries with the same key color component are grouped into the same first color group; The effective weight of the first color group is calculated based on the actual number of pixels and the transparency component in the color components. Calculate the total color weight of the first color group that is visible and has color differences in a traditional color palette; The significant color group in the first color group is determined based on the effective weight and the total color weight; Calculate the minimum circumferential hue difference between the first color group and the traditional color palette and the candidate color palette; The weighted average hue shift is obtained based on the minimum circumferential hue difference and the effective weights of significant color groups; Calculate the maximum absolute brightness across all channels of the salient color group; Determine white candidate entries in the color entries based on the key color components of the color entries; Determine whether a standard dynamic range white anchor point exists based on the effective weight of the white candidate item; Choose the traditional color palette as the target color palette if any of the following conditions are met; otherwise, choose the candidate color palette as the target color palette: There are standard dynamic range white anchor points; There are no standard dynamic range white anchor points, and the maximum absolute brightness exceeds the first brightness threshold; The weighted average hue shift is not less than the shift threshold, and the maximum absolute brightness exceeds the second brightness threshold.

[0053] Specifically, in this embodiment, the target color palette is selected based on the actual color used by the current subtitle object.

[0054] In this embodiment, instead of directly counting all colors in the color palette during the selection of the target color palette, it scans the index bitmap B of the current subtitle object and counts the actual number of pixels n_k for each color entry. A color entry Q_k = (Y_k, Cr_k, Cb_k, A_k), where k is the index, Y_k is the luminance component, Cr_k and Cb_k are the chromatic aberration components, and A_k is the transparency component.

[0055] Color entries with the same key color components are grouped into the same first color group T1. That is, entries with the same original Y_k, Cr_k, and Cb_k are merged into the same first color group T1. The key color components include the luminance component Y_k and the chromaticity component, and the chromaticity components include the red chromaticity component Cr_k and the blue chromaticity component Cb_k.

[0056] For any first color group, its effective weight w_eg can be calculated using the following formula 19: w_eg = Σ(n_k × A_k) Formula 19 As shown in Formula 19, the summation range of the effective weights is all color entries belonging to the first color group T1; n_k is the actual number of pixels of the color entry at index k in the current bitmap; A_k is the transparency component of the color entry (belonging to the color components), with a value ranging from 0 to 255. This effective weight gives greater influence to colors with larger areas and higher opacity, while colors not used in the bitmap or completely transparent have a weight of 0.

[0057] This embodiment counts the colors actually used in the current index bitmap and weights them by pixel count and transparency to reduce the impact of unused palette entries, noisy pixels, and fade-in initial frames on the decision.

[0058] Calculate the total color weight (effective color weight) W_c for the first color group that is visible and has color differences in the traditional color palette.

[0059] The salient color groups in the first color group are determined based on the effective weight w_eg and the total color weight W_c.

[0060] In one specific embodiment, the first color group whose effective weights w_eg satisfy the following formula 20 is determined as the salient color group: w_eg≥max(10×255, W_c / 200) Formula 20 Wherein, 10×255 represents at least 10 completely opaque pixels; W_c / 200 represents at least 0.5% of the effective color weight. The conditions in Formula 20 can prevent a single noisy pixel or fade-in of the initial frame from affecting the judgment of the entire subtitle.

[0061] For all salient color groups, the hues of the traditional colors and candidate colors are compared separately to obtain a weighted average hue shift. More specifically, the minimum circumferential hue difference of the first color group T1 between the traditional palette and the candidate palette is calculated; based on the minimum circumferential hue difference and the effective weights of the salient color groups, the weighted average hue shift H is obtained.

[0062] In one specific embodiment, the weighted average hue shift H is calculated using the following formula 21: H =Σ(w_eg×d_h(g)) / Σw_eg Formula 21 Where d_h(g) is the minimum circumferential hue difference between the first color group T1 and the traditional color palette and the candidate color palette, in degrees; H is the weighted average hue shift of all significant color groups; and w_eg is the effective weight of the significant color groups.

[0063] Find the maximum absolute brightness of all channels (three channels) in the salient color group, denoted as peak brightness Pm, in nits.

[0064] This embodiment also detects SDR white anchors. First, white candidate entries are determined in the color entries based on the key color components. Then, the existence of standard dynamic range white anchors (SDR white anchors) is determined based on the effective weights of the white candidate entries.

[0065] In one specific embodiment, the white candidate entry in the color entry can be determined by satisfying the following formula 22: Y_k≥220, and |Cr_k-128|≤3, and |Cb_k-128|≤3 (Formula 22) Where Y_k is the luminance component of the color entry at index k, Cr_k is the red color difference component, and Cb_k is the blue color difference component.

[0066] A white anchor point is confirmed to exist if the effective weight w_egw of a white candidate entry is at least equivalent to 10 completely opaque pixels and accounts for at least 0.5% of the total visible weight W_ck.

[0067] That is, if the following formula 23 is satisfied, then the existence of a white anchor point is confirmed: w_egw≥max(10×255, W_ck / 200) Formula 23 In this process, white candidate entries are divided into one or more white candidate color groups, and the effective weight w_egw of the white candidate entries can be calculated using Formula 19 above.

[0068] The visible weight W_ck can be found in the calculation of the total color weight above. The visible weight W_ck is calculated for white candidate color groups that are visible and have color differences in the traditional color palette.

[0069] Choose the traditional color palette as the target color palette if any of the following conditions are met; otherwise, choose the candidate color palette as the target color palette: J1. There is a standard dynamic range white anchor point (SDR white anchor point). J2, The maximum absolute brightness Pm exceeds the first brightness threshold; J3, the weighted average hue shift is not less than the shift threshold, and the maximum absolute brightness exceeds the second brightness threshold.

[0070] The first luminance threshold is, for example, 4 × W_g. When the maximum absolute luminance Pm exceeds the first luminance threshold (e.g., 4 × W_g), the candidate interpretation is considered abnormal, and therefore, the traditional color palette is selected as the target color palette.

[0071] The offset threshold is, for example, 12 degrees; the second brightness threshold is, for example, 100 nits. In this case, when the weighted average hue offset H is not less than 12 degrees and the maximum absolute brightness Pm is higher than 100 nits, the traditional color palette is selected.

[0072] Furthermore, conditions J1, J2, and J3 can be judged in sequence. When a certain condition is met, the target color palette can be confirmed, and subsequent conditions do not need to be judged.

[0073] It should be noted that the above thresholds are actual implementation parameters, and this application does not limit the values ​​of these thresholds. The core technology does not lie in a single isolated threshold, but in establishing evidence using the actual color usage and transparency of the current bitmap, and then making a selection between the traditional color palette and the candidate color palette.

[0074] Significant color threshold, white anchor point threshold, permissible hue shift, and peak brightness limit can be adjusted based on subtitle area, output brightness, or product calibration data, or can be implemented using a lookup table. However, the choice between a traditional color palette and a candidate color palette should be made based on evidence of the actual colors used in the current bitmap.

[0075] In addition, if there is no significant color group, a traditional color palette can be temporarily selected, and the result can be marked as "insufficient evidence" for further processing.

[0076] This embodiment determines whether to use a traditional color palette or a candidate color palette based on the actual colors, number of pixels, and transparency used in the current subtitle bitmap. Effective weights are established based on the actual number of colors and transparency used in the index bitmap, and an adaptive selection is made between the traditional and candidate color palettes using white anchor points, prominent colors, candidate peak brightness, and hue shift before and after conversion.

[0077] In one embodiment, determining the target color palette for the current caption object includes: If a candidate color palette exists, then the white candidate entries in the color entries are determined based on the key color components of the color entries, where the key color components include the luminance component and the chromaticity component. Determine whether a standard dynamic range white anchor point exists based on the effective weight of the white candidate item; If a standard dynamic range white anchor point exists, then the traditional color palette is selected as the target color palette; If there is no standard dynamic range white anchor point, color entries with the same key color component are divided into the same first color group. The effective weight of the same first color group and the total color weight of the first color group that is visible and has color differences in the traditional color palette are calculated. The significant color group in the first color group is determined based on the effective weight and the total color weight. The maximum absolute brightness in all channels of the significant color group is calculated. If the maximum absolute brightness exceeds the first brightness threshold, then the traditional color palette is selected as the target color palette; If no significant color group exists, the traditional color palette is temporarily selected, and the result is marked as insufficient evidence. If the maximum absolute brightness does not exceed the first brightness threshold, the minimum circumferential hue difference of the first color group between the traditional color palette and the candidate color palette is calculated. Based on the minimum circumferential hue difference and the effective weight of the significant color group, the weighted average hue shift is obtained. If the weighted average hue shift is not less than the shift threshold, and the maximum absolute brightness exceeds the second brightness threshold, then the traditional color palette is selected as the target color palette. In cases where none of the above conditions are met, select the candidate palette as the target palette.

[0078] This embodiment processes data and makes conditional judgments in sequence to select the target color palette, which can minimize computational overhead and select the target color palette faster.

[0079] In one embodiment, the method further includes: If both non-prominent caption objects without a prominent color group and prominent caption objects with a prominent color group exist in the same display group, then the same group reference condition judgment is performed. If the same group reference conditions are met, the target color palette selection conclusion of the prominent caption object is applied to the non-prominent caption object. The target color palette selection conclusion is to select the traditional color palette as the target color palette or to select the candidate color palette as the target color palette. If the reference conditions for the same group are not met, or if the results of the target color palette selection for prominent subtitle objects are inconsistent, then the traditional color palette will be used as the target color palette for non-prominent subtitle objects. If all of the following conditions are met, then the reference conditions for the same group are considered to be met: The original color palettes of non-prominent caption objects and prominent caption objects are identical item by item. The prominent caption object itself has a defined target color palette. The target palette selection conclusions for multiple prominent caption objects are consistent.

[0080] Specifically, all subtitle objects contained in the subtitle to be displayed belong to the same display group. Some subtitle objects have a significant color group; some subtitle objects may only display grayscale outlines, low-transparency transition frames or a very small number of colored pixels, resulting in the absence of a significant color group.

[0081] In this embodiment, for non-prominent subtitle objects without a significant color group, the target color palette can refer to the target color palette of other prominent subtitle objects with significant color groups in the same display group.

[0082] More specifically, if both non-prominent caption objects without a prominent color group and prominent caption objects with a prominent color group exist in the same display group, then the following same-group reference condition judgment is performed: Are the original color palettes of non-prominent caption objects and prominent caption objects identical item by item? Does the prominent caption object (as a reference object) itself have a defined target color palette? Whether the target palette selection conclusions for multiple prominent caption objects are consistent.

[0083] If all of the above reference conditions are met simultaneously, the target palette selection conclusion for the salient caption object will be applied to the non-salient caption object. The target palette selection conclusion is to select the traditional palette as the target palette or to select the candidate palette as the target palette.

[0084] If any of the above reference conditions for the same group are not met, or if the results of the target color palette selection for prominent caption objects are inconsistent or conflicting, then the traditional color palette will be used as the target color palette for non-prominent caption objects.

[0085] In addition, the reference conditions for the same group may also include whether the composition number of the non-prominent caption object and the prominent caption object are the same, and whether the palette identifier and palette version of the non-prominent caption object and the prominent caption object are the same.

[0086] It should be noted that the processing in this embodiment only takes effect within the same display group and does not cache subtitles for a long period of time.

[0087] This embodiment performs consistency judgment and supplementation on the color palette of subtitle objects within the same display group, which allows subtitle objects whose color palette cannot be determined to follow the color palette of prominent subtitle objects. This enables color selection to spatially reference subtitle objects in the same group, ensuring the consistency and rationality of color selection and suppressing color flickering in fade-in, fade-out, and alternating animations.

[0088] In one embodiment, determining whether to allow the generation of a candidate color palette based on a color environment snapshot, an index bitmap, the original color palette, and a traditional color palette includes: Candidate color palettes can be generated if all of the following conditions are met: The current subtitle object has valid width and height, and does not exceed the current subtitle composition canvas. Indexed bitmaps, traditional color palettes, and the original color palette are all present. The source color states available in a color environment snapshot can be achieved using perceptual quantization transfer properties or mixed log-gamma transfer properties. The available current output color state supports graphic subtitles to be synthesized according to high dynamic range. The current output color state available in the color environment snapshot has an available graphic white brightness reference.

[0089] Specifically, by comparing the effective width and height of the current subtitle object with the size of the current subtitle composition canvas, it can be determined whether the width and height of the current subtitle object exceed the size of the current subtitle composition canvas.

[0090] Perceptual quantization transfer characteristic is also known as PQ transfer characteristic; mixed log-gamma transfer characteristic is also known as HLG transfer characteristic.

[0091] Furthermore, if the source color state can only be determined to "belong to a certain type of HDR", but it cannot be determined whether the underlying layer uses PQ or HLG, then the transfer function is not guessed.

[0092] If the actual output color state is unknown, or is still in the switching phase, or the graphic compositing method cannot be determined, i.e., any of the above conditions are not met, then candidate conversion is not performed (candidate color palette generation is prohibited). In this case, the traditional color palette is used as the target color palette for the current subtitle object.

[0093] This embodiment combines the source color state with the current output color state to form a color environment snapshot, and uses this snapshot to determine whether to allow the generation of candidate color palettes, rather than relying solely on the source label or the output mode.

[0094] In one embodiment, the color entry includes a luminance component, a red chromatic aberration component, a blue chromatic aberration component, and a transparency component; In step S500, the original color palette is converted to obtain a candidate color palette, including: The luminance, red, and blue color difference components of the non-transparent color entries in the original color palette are normalized to obtain normalized luminance, red, and blue color difference components. Based on the non-constant luminance relationship and the normalized luminance component, normalized red color difference component, and normalized blue color difference component, the coding domain components are obtained, where the coding domain components include the red component, green component, and blue component in the coding domain. If the source color state is perceptual quantization, then perform perceptual quantization inverse transform on each coding domain component to obtain the inverse transform component corresponding to each coding domain component; If the source color state is a mixed log-gamma, then calculate the scene linearity value of each coding domain component; The absolute brightness of each channel is obtained based on the inverse transform component or scene linear value; The absolute brightness is normalized, converted, and compressed to obtain the color conversion components. Based on the color conversion components and corresponding transparency components of all non-transparent color entries in each channel, as well as the transparent entries, a candidate color palette is obtained.

[0095] Specifically, the original color palette contains both opaque and transparent color entries.

[0096] In this embodiment, only the luminance component Y, red color difference component Cr, and blue color difference component Cb of the non-transparent color entries are normalized within a limited range to obtain the normalized luminance component Y_n, the normalized red color difference component Cr_n, and the normalized blue color difference component Cb_n.

[0097] In one specific embodiment, the limited range of Y, Cr, and Cb can be normalized by referring to the following formulas 1-3: Y_n = clip((Y_k - H11) / H2, 0, 1) (Formula 1) Cr_n = (Cr_k - H3) / H4 (Formula 2) Cb_n = (Cb_k -H5) / H6 (Formula 3) Where Y_k, Cr_k, and Cb_k are the original components retained by color entry Q_k in the original color palette; Y_n, Cr_n, and Cb_n are the normalized results; clip(x,0,1) indicates that x is limited to between 0 and 1; H11, H2, H3, H4, H5, and H6 are the limited-range conversion parameters used in this embodiment. The conversion parameters of Formulas 1-3 can be configured according to the actual scenario, and this application does not impose any restrictions on them. For example, H11=16, H2=219, H3=128, H4=224, H5=128, H6=224.

[0098] According to the BT.2020 non-constant luminance relationship, the normalized luminance component Y_n, the normalized red color difference component Cr_n, and the normalized blue color difference component Cb_n can be processed to recover the red component R_e, green component G_e, and blue component B_e in the coding domain.

[0099] In one specific embodiment, the normalized components Y_n, Cr_n, and Cb_n can be restored to the coding domain components R_e, G_e, and B_e by referring to the following formulas 4-6: R_e = clip(Y_n + 1.4746 × Cr_n, 0, 1) (Formula 4) G_e = clip(Y_n - 0.164553 × Cb_n - 0.571353 × Cr_n, 0, 1) Formula 5 B_e = clip(Y_n + 1.8814 × Cb_n, 0, 1) (Formula 6) Here, R_e, G_e, and B_e are the coded field components that still retain source-transmission characteristics, representing the red, green, and blue components of the coded field, respectively. The subscript 'e' indicates 'encoded,' meaning the coded value has not yet been restored to linear light.

[0100] If the source color state is perceptual quantizer (PQ), then perform the inverse perceptual quantization transform (i.e., the inverse PQ transform) on each coding domain component to obtain the inverse transform component p corresponding to each coding domain component.

[0101] In one specific embodiment, the inverse PQ transform of each coding domain component E can be performed with reference to the following formula 7 to obtain the inverse transform components of each channel; the absolute luminance can be obtained through formula 8: p = E^(1 / m2) Formula 7 L = 10000 × [max(p - c1, 0) / (c2 - c3 × p)]^(1 / m1) Formula 8 Where E represents the coding domain components R_e, G_e, and B_e respectively; p represents the inverse transform component, with values ​​R_p, G_p, and B_p respectively; and L represents the absolute brightness of the corresponding channel (any one of the three channels: red, green, and blue), with values ​​L1_R, L1_G, and L1_B respectively, in nits.

[0102] m1, m2, c1, c2, and c3 are the inverse transformation parameters.

[0103] In one specific embodiment, m1=2610 / 16384, m2=2523 / 32, c1=3424 / 4096, c2=2413 / 128, c3=2392 / 128.

[0104] When the denominator is non-positive, the absolute brightness L of the corresponding channel is 0.

[0105] If the source color state is Hybrid Log-Gamma (HLG), then the scene linearity value of each coded domain component is calculated. Based on the scene linearity value, the absolute brightness of each channel is obtained.

[0106] The absolute brightness is normalized, converted, and compressed to obtain the color conversion components.

[0107] Based on the color conversion components and corresponding transparency components A_k of all non-transparent color entries in each channel, as well as the transparent entries that do not undergo color conversion, a candidate color palette P_C is obtained. The color entries contained in the candidate color palette P_C correspond one-to-one with the color entries of the traditional color palette P_L.

[0108] Both the traditional color palette P_L and the candidate color palette P_C are retained, allowing subsequent steps to make a choice between the two based on the actual color evidence of the current subtitle object.

[0109] In one embodiment, if the source color state is a mixed log-gamma, the absolute brightness of each channel is calculated using the following steps: Calculate scene brightness based on scene linear values; Calculate and output photoelectric conversion gain based on scene brightness; The absolute brightness of each channel is calculated based on the scene linearity value of each coding domain component and the output photoelectric conversion gain.

[0110] Specifically, when the source color state is HLG, the scene linearity value E_s of each coding domain component is first calculated. The scene linearity values ​​E_s of the coding domain components R_e, G_e, and B_e are R_s, G_s, and B_s, respectively.

[0111] In one specific embodiment, the scene linearity value E_s is calculated using the following formula 9: When E ≤ 0.5, E_s = E² / 3; when E > 0.5, E_s = [b + exp((Ec) / a)] / 12 (Formula 9) Where E is a coding domain component, which can take any value from R_e, G_e, and B_e. Therefore, the scene linear values ​​R_s, G_s, and B_s of the coding domain components R_e, G_e, and B_e can be calculated using Formula 9.

[0112] a, b, and c are scene parameters.

[0113] In one specific embodiment, a=0.17883277, b=0.28466892, c=0.55991073.

[0114] The scene brightness Yc_s can be calculated based on the scene linearity values ​​of all coded domain components.

[0115] In one specific embodiment, the scene brightness Yc_s is calculated using the following formula 10: Yc_s = 0.2627 × R_s + 0.6780 × G_s + 0.0593 × B_s (Formula 10) The output photoelectric conversion gain g can be calculated based on the scene brightness Yc_s.

[0116] In one specific embodiment, the output photoelectric conversion gain g is calculated using the following formula 11: g = Fc × Yc_s^(gamma - 1) (Formula 11) In one specific embodiment, gamma=1.2 and the reference peak Fc is 1000 nits.

[0117] Based on the scene linearity values ​​R_s, G_s, B_s of each coding domain component and the output photoelectric conversion gain g, the absolute brightness L2_R, L2_G, and L2_B of each channel can be calculated.

[0118] In one specific embodiment, the absolute luminances L2_R, L2_G, and L2_B of the three channels are calculated using the following formula 12: L2_R = R_s × g, L2_G = G_s × g, L2_B = B_s × g Formula 12 In one embodiment, the absolute luminance is normalized, converted, and compressed to obtain color conversion components, including: By using the graphic white brightness corresponding to the current output color state, the absolute brightness of each channel is normalized to obtain the first linear component of each channel. Convert each of the first linear components into a second linear component; The second linear component of each channel is compressed to obtain the compressed component corresponding to each channel. The compressed component is encoded and quantized to obtain the color conversion component.

[0119] Specifically, after obtaining the absolute brightness, the absolute brightness L1_R, L1_G, L1_B or L2_R, L2_G, L2_B of each channel is normalized using the graphic white brightness W_g corresponding to the current output color state, so as to obtain the normalized first linear components R_2020, G_2020 and B_2020 of each channel.

[0120] Among them, graphic whiteness refers to the whiteness or diffuse whiteness of the graphic.

[0121] In one specific embodiment, the first linear component of each channel is calculated using the following formula 13: R_2020=L_R / W_g, G_2020=L_G / W_g, B_2020=L_B / W_g Formula 13 Among them, L_R, L_G, and L_B take the values ​​L1_R, L1_G, L1_B or L2_R, L2_G, L2_B respectively.

[0122] In one specific embodiment, for standard HDR output, the white brightness W_g is 330 nits; for HLG output and another type of dynamic range output, the white brightness W_g is 203 nits.

[0123] Subsequently, based on the first linear components R_2020, G_2020 and B_2020 of all channels, each first linear component is converted into the second linear components R_709, G_709 and B_709 of BT.709.

[0124] In one specific embodiment, the second linear components R_709, G_709, and B_709 are calculated using the following formulas 14-16: R_709 = 1.660496R_2020 - 0.587656G_2020 - 0.072840B_2020 (Formula 14) G_709 = -0.124546R_2020 + 1.132895G_2020 - 0.008348B_2020 (Formula 15) B_709 = -0.018154R_2020 - 0.100597G_2020 + 1.118751B_2020 (Formula 16) The second linear component of each channel is compressed to obtain the compressed components C_out_R, C_out_G, and C_out_B corresponding to each channel.

[0125] In one specific embodiment, if the largest second linear component among the second linear components R_709, G_709, and B_709 exceeds a first threshold, then the second linear components of each channel are compressed to obtain the compressed components C_out_R, C_out_G, and C_out_B corresponding to each channel. The first threshold is, for example, set to 1.

[0126] After the BT.709 linear channel is compressed by color gamut constraint, sRGB photoelectric encoding is performed, limiting it to 0-1 and quantizing it into 8-bit RGBA. The transparency should follow the original entry, that is, the original transparency A_k is used to obtain the candidate color palette P_C.

[0127] In one specific embodiment, the absolute brightness of each channel (three channels) of each color entry in the significant color group in the aforementioned steps can be calculated by formulas 9-12, which will not be repeated here.

[0128] This embodiment uses graphic white brightness as a normalization benchmark, converts the absolute brightness restored from the source transmission characteristics into the display color required for subtitle synthesis, and adopts a color gamut compression method that maintains the channel ratio and brightness center relationship.

[0129] In one embodiment, the second linear component of each channel is compressed to obtain the compressed component corresponding to each channel, including: The second linear component of each channel is scaled according to the first scaling ratio to obtain the scaled component of each channel; Calculate linear luminance based on the second linear component; The scaling components of each channel are compressed with linear brightness as the center to obtain the compressed components of each channel.

[0130] Specifically, for the second linear component of each channel, the three channels are scaled according to the first scaling ratio to obtain the scaled component of each channel, instead of truncating them separately.

[0131] The linear luminance L_709 is calculated based on the second linear component of all channels.

[0132] In one specific embodiment, the linear luminance L_709 is calculated using the following formula 17: L_709 = 0.2126R_709 + 0.7152G_709 + 0.0722B_709 (Formula 17) The scaling components of each channel are compressed around the linear luminance L_709 to compress chromaticity that exceeds the display color gamut, resulting in the compressed component C_out of each channel.

[0133] In one specific embodiment, the compression component C_out of each channel can be calculated using the following formula 18: C_out = L_709 + s × (C_in - L_709) Formula 18 Where C_in represents the R, G, and B scaled components before compression; C_out represents the corresponding compressed components after compression; and s is the maximum common scaling factor that ensures all three output components fall within the range of 0 to 1. Using a common factor can help maintain channel proportions and perceived hue as much as possible.

[0134] Existing technologies that only perform channel-by-channel truncation can easily damage hue. For example, if the red component of a bright orange exceeds the display range, truncating only the red component may suppress the orange to appear red.

[0135] This embodiment uses channel scaling to avoid hue distortion and preserve color accuracy.

[0136] In the above embodiments, by normalizing the graphic white, compressing the highlight at a uniform ratio, and compressing the luminance center chromaticity, the probability of subtitles being too dark or too bright, as well as the probability of hue abrupt changes after high-saturation colors are cropped channel by channel, can be reduced.

[0137] In one embodiment, rendering a subtitle bitmap with transparency based on an index bitmap and a target color palette for display includes: Identify the connected regions that are separate from each other within the same subtitle object, and obtain the bounding rectangle of each connected region; Determine a connected region palette for target connected regions that have regionally significant color groups; If there are at least two target connected regions and their bounding rectangles do not overlap, then region coverage is allowed. A subtitle bitmap with transparency is rendered based on the index bitmap of the subtitle object and the target color palette. Visible pixels with non-zero transparency within the target connected region in the subtitle bitmap are overwritten according to the connected region color palette and the index bitmap. The original results of transparent pixels and pixels outside the target connected region in the subtitle bitmap are preserved. Subtitles are displayed based on the subtitle bitmap after regional coverage.

[0138] Specifically, the same subtitle object may encode two text blocks that are far apart in a single index bitmap. To avoid the two text blocks from interfering with each other, this embodiment will also perform region determination processing.

[0139] Create a grid based on the canvas size; for example, a 1080-row canvas uses a grid of at least 16×16 pixels; if the canvas is enlarged, the grid size is increased proportionally to the canvas height.

[0140] The grid containing pixels whose original transparency is not less than the transparency threshold is marked as occupied grid; the transparency threshold is, for example, 8.

[0141] The connected regions of space can be obtained by mesh connectivity, pixel connectivity, projection segmentation, or the window boundaries inherent in the subtitle object.

[0142] For example, perform an eight-neighbor connectivity search on the occupied grid to obtain connected regions that are separated from each other, and calculate and obtain the bounding rectangle of each connected region.

[0143] For each connected region, a determination is made as to whether it has a salient color group. For target connected regions that do have a salient color group, a connected region color palette is selected. The connected region color palette can be a traditional color palette, or a candidate color palette for the corresponding subtitle object.

[0144] Among them, the regional color evidence is valid for target connected regions with regionally significant color groups.

[0145] The playback device first decodes and renders the index bitmap and target color palette into a subtitle bitmap with transparency (i.e., a color bitmap). After rendering, a subtitle bitmap with transparency is generated. If there are at least two target connected regions, and their bounding rectangles do not overlap, and there exists a significant color group within the region (i.e., the region color evidence is valid), then the region conclusion is allowed to override the conclusion of the entire subtitle object. That is, it is allowed to use the connected region color palette to modify the color of visible pixels with non-zero transparency within the target connected region in the subtitle bitmap, while maintaining the original results of transparent pixels and pixels outside the target connected regions in the subtitle bitmap. The original results are obtained by rendering using the target color palette and index bitmap of the subtitle object.

[0146] If the number of target connected regions is less than 2, or if their bounding rectangles overlap, then region coverage is prohibited; that is, target connected regions and other regions use the target palette of their respective caption objects.

[0147] After the area is covered, the subtitle bitmap is handed over to the upper layer for display, so that the subtitle bitmap can be superimposed on the video screen.

[0148] This embodiment selects colors for multiple content areas separated by transparent regions within the same subtitle object, which can reduce misjudgments between regions and allow for regression to the conclusion of the entire subtitle object when regions overlap or evidence is insufficient.

[0149] This embodiment uses region-level judgment to make separate region-level judgments when the same subtitle object contains multiple independent contents, and performs local color selection and coverage when different color palettes are used, reducing misjudgment of the whole image and misjudgment between regions.

[0150] In one embodiment, determining a connected region palette for a target connected region having a salient color group includes: Count the number of second actual pixels for each color entry in the connected region; Color entries with the same key color component in the same connected region are divided into the same second color group, where the key color component includes the luminance component and the chromaticity component; The second effective weight of the second color group is calculated based on the second actual pixel count and the transparency component in the color components; Calculate the second total color weight of the second color group that is visible and has color differences; The significant color group of the region in the second color group contained in the connected region is determined according to the second effective weight and the second total color weight; Calculate the second minimum circumferential hue difference between the second color group and the conventional color palette and the candidate color palette; The second weighted average hue shift is obtained based on the second minimum circumferential hue difference and the second effective weight of the regional significant color group; Calculate the second maximum absolute brightness across all channels of the salient color group in the region; Based on the key color components of the color entries of the connected regions, determine the second white candidate entry among the color entries of the connected regions; The existence of a second standard dynamic range white anchor point is determined based on the second effective weight of the second white candidate entry. Choose the traditional color palette as the connected region palette for the target connected region with a significant color group if any of the following conditions are met; otherwise, choose the candidate color palette as the connected region palette for the target connected region: There is a second standard dynamic range white anchor point. The second maximum absolute brightness exceeds the first brightness threshold. The second weighted average hue shift is not less than the shift threshold, and the second maximum absolute brightness exceeds the second brightness threshold.

[0151] Specifically, for any connected region, the steps of this embodiment are executed to determine the target connected region and the connected region color palette.

[0152] Count the number of second actual pixels n_k1 for each color entry in the connected region. A color entry Q_k=(Y_k, Cr_k, Cb_k, A_k), where k is the index, Y_k is the luminance component, Cr_k and Cb_k are the chromatic aberration components, and A_k is the transparency component.

[0153] Color entries with the same key color components are grouped into the same second color group T2. That is, entries with the same original Y_k, Cr_k, and Cb_k are merged into the same color group T2. The key color components include the luminance component Y_k and the chromaticity component, and the chromaticity components include the red chromaticity component Cr_k and the blue chromaticity component Cb_k.

[0154] For any second color group, its second effective weight w_eg1 can be calculated using the following formula 19-1: w_eg1 = Σ(n_k1 × A_k) (Formula 19-1) As shown in Formula 19-1, the summation range of the second effective weight is all color entries belonging to the second color group T2; n_k1 is the second actual pixel count of the color entry at index k in the connected region; A_k is the transparency component (a color component) of the color entry, with a value ranging from 0 to 255. This second effective weight gives greater influence to colors with larger areas and higher opacity, while colors not used in the bitmap or completely transparent have a weight of 0.

[0155] Calculate the second total color weight (second effective color weight) W_c1 for the second color group that is visible and has color differences in the connected region.

[0156] The significant color group of the region in the second color group contained in the connected region is determined based on the second effective weight w_eg1 and the second total color weight W_c1.

[0157] In one specific embodiment, the second color group that satisfies the following formula 20-1 is determined as the region salient color group: w_eg1≥max(10×255, W_c1 / 200) Formula 20-1 Where 10×255 represents at least 10 completely opaque pixels; W_c1 / 200 represents at least 0.5% of the second effective weight of color. The conditions in Formula 20-1 can prevent a single noisy pixel or fade-in of the initial frame from affecting the judgment of the entire subtitle.

[0158] For all salient color groups in the region, the hues of the traditional colors and candidate colors are compared to obtain the second weighted average hue shift. More specifically, the second minimum circumferential hue difference of the second color group T2 between the traditional color palette and the candidate color palette is calculated; based on the second minimum circumferential hue difference and the second effective weight of the salient color groups in the region, the second weighted average hue shift H1 is obtained.

[0159] In one specific embodiment, the second weighted average hue shift H1 is calculated using the following formula 21-1: H 1=Σ(w_eg1×d_h1(g)) / Σw_eg1 (Formula 21-1) Where d_h1(g) is the second minimum circumferential hue difference between the second color group T2 and the traditional color palette and the candidate color palette, in degrees; H1 is the second weighted average hue shift of all regional salient color groups; and w_eg1 is the second effective weight of the regional salient color groups.

[0160] Find the second maximum absolute brightness of all channels (three channels) in the salient color group of the region, denoted as peak brightness Pm1, in nits.

[0161] This embodiment also detects SDR white anchor points. First, a second white candidate entry is determined from the color entries based on the key color components of the color entries. Then, the existence of a second standard dynamic range white anchor point (SDR white anchor point) in the connected region is determined based on the second effective weight of the second white candidate entry.

[0162] In one specific embodiment, the second white candidate entry in the color entries can be determined by satisfying the following formula 22-1: Y_k≥220, and |Cr_k-128|≤3, and |Cb_k-128|≤3 (Formula 22-1) Where Y_k is the luminance component of the color entry at index k, Cr_k is the red color difference component, and Cb_k is the blue color difference component.

[0163] A white anchor point is confirmed to exist if the second effective weight w_egw1 of the second white candidate entry is at least equivalent to 10 completely opaque pixels and accounts for at least 0.5% of the total visible weight W_ck1.

[0164] That is, if the following formula 23-1 is satisfied, then the existence of a white anchor point is confirmed: w_egw1≥max(10×255, W_ck1 / 200) Formula 23-1 The second white candidate item is divided into one or more white candidate color groups, and the second effective weight w_egw1 of the second white candidate item can be calculated by referring to the above formula 19-1.

[0165] The visible weight W_ck1 can be found in the calculation of the second total color weight mentioned above. The visible weight W_ck1 is calculated for white candidate color groups that are visible in the connected region and have color differences.

[0166] If any of the following conditions are met, the traditional color palette is selected as the target color palette for the corresponding target connected region; otherwise, if any of the following conditions are not met, the candidate color palette is selected as the target color palette for the corresponding target connected region: J11. There is a second standard dynamic range white anchor point (SDR white anchor point). J12, the second maximum absolute brightness Pm1 exceeds the first brightness threshold; J13, the second weighted average hue offset H1 is not less than the offset threshold, and the second maximum absolute brightness Pm1 exceeds the second brightness threshold.

[0167] The first luminance threshold is, for example, 4 × W_g. When the second maximum absolute luminance Pm1 exceeds the first luminance threshold (e.g., 4 × W_g), the candidate interpretation is considered abnormal, and therefore, the traditional color palette is selected as the target color palette.

[0168] The offset threshold is, for example, 12 degrees; the second brightness threshold is, for example, 100 nits. In this case, when the second weighted average hue offset H1 is not less than 12 degrees and the second maximum absolute brightness Pm1 is higher than 100 nits, the traditional color palette is selected.

[0169] Furthermore, for the above conditions J11, J12, and J13, judgments can be made in sequence. When a certain condition is met, the target color palette can be confirmed, and subsequent conditions do not need to be judged.

[0170] It should be noted that the above thresholds are actual implementation parameters, and this application does not limit the values ​​of these thresholds. The core technology does not lie in a single isolated threshold, but in establishing evidence using the actual color usage and transparency of the current bitmap, and then making a selection between the traditional color palette and the candidate color palette.

[0171] In one embodiment, the method further includes: Before rendering, result verification is performed. Result verification includes checking whether the transparency of the target color palette is consistent with that of the original color palette, whether the visible color entries fall within the valid encoding range, and whether the caption bounding rectangle is still within the display safe area. The caption bounding rectangle is obtained based on the currently visible pixels of the caption object. If the result fails the validation, the target color palette of the corresponding subtitle object will be reverted to the traditional color palette. If any of the following conditions exist, the target color palette for the corresponding subtitle object will revert to the traditional color palette: The original color palette of the subtitle object does not exist, the index bitmap is invalid, the source color state or output color state is unknown, the transfer characteristics cannot be determined (it is impossible to determine whether the underlying layer uses PQ or HLG), the graphic white brightness is unavailable, the boundaries of connected regions overlap, the target color palette selection conclusions of the same group of subtitle objects conflict, and the compatibility mode is manually enabled.

[0172] Specifically, for ease of verification, the debug version can log the original palette summary, index bitmap summary, traditional palette summary, candidate palette summary, object metadata, selection reason, number of significant colors, hue shift, and peak brightness. The official version disables frame-by-frame logging by default to avoid impacting playback performance.

[0173] Before rendering, a lightweight result validation can be performed to check whether the transparency of the final color palette matches the original color palette, whether visible items fall within the valid encoding range, and whether the subtitle bounding rectangle is still within the display safe area. If any check fails, it directly reverts to the traditional color palette. This validation uses the data already generated in the preceding steps and does not require re-analysis of the video footage.

[0174] The following situations will automatically revert to the traditional color palette: the original color palette does not exist; the index bitmap is invalid; the source or output state is unknown; the transitive characteristics cannot be determined; the graphic white brightness is unavailable; region boundaries overlap; there are conflicting conclusions for objects in the same group; the object continuity relationship is not unique; or compatibility mode is manually enabled. The fallback path is always preserved, so adding new methods will not block the display of existing captions.

[0175] The new processing in this embodiment has clear compatibility and rollback conditions, making it suitable for gradual activation on existing players and different display output devices.

[0176] This embodiment retains the original color palette outside the traditional graphic subtitle decoding path, forming a dual-path structure where the traditional color palette and candidate color palette coexist, are selected based on conditions, and fall back in case of anomalies. This embodiment sets explicit fallback conditions for missing input, unknown state, region conflict, non-unique object relationships, and manual compatibility mode, ensuring that the new method is compatible with the original subtitle display path.

[0177] In one embodiment, periodically reading the current output color state and the source color state includes: Before playback begins, the actual output color state is read as the output baseline; Within the fast window after playback begins, if the current output color state is equal to the output baseline, or if at least one of the current output color state and the source color state is unavailable, then the current output color state and the source color state are read with the first sampling period. If both the current output color state and the source color state are available, the current output color state and the source color state are read at the second sampling period, wherein the first sampling period is shorter than the second sampling period.

[0178] Specifically, in order to balance output switching speed and operating overhead, this embodiment adopts a two-level sampling period: within the fast window after the start, if the current output color state is still equal to the output baseline before playback, or if at least one of the source color state and the current output color state is unavailable, then sampling is repeated with a shorter period, such as the first sampling period; after detecting that the color environment where both the current output color state and the source color state are available and have been switched, sampling and monitoring continue with a longer period, such as the second sampling period.

[0179] In one specific embodiment, the first sampling period is the fast sampling period, for example, 500 milliseconds, the fast window is for example, 2 seconds, the second sampling period is the subsequent monitoring period, for example, 2 seconds, and the total sampling window is 30 seconds. The above values ​​are used to illustrate an executable configuration and do not limit this method; other devices can adjust them according to the output switching time.

[0180] In one embodiment, the environment generation number of the color environment snapshot is recorded; if any of the following events are detected: switching playback items, exiting playback items, or re-initializing, the old color environment snapshot is cleared and a new color environment snapshot is generated.

[0181] Specifically, when switching, exiting, or re-initializing a playback item, an environment generation number is added and the old snapshot is cleared, so that the delayed sampling results of the old playback task cannot cover the new task.

[0182] In one embodiment, the method further includes: Establish a bounded state record for each subtitle object with a confirmed target color palette. The bounded state record includes object identifier, window identifier, geometric position, size, source color state and output color state in the color environment snapshot, object version, composition state, display generation, and confirmed target color palette. Compare the first key field of the current subtitle object with that of the previous subtitle object. If the first key field is the same, it is confirmed that the current subtitle object and the previous subtitle object belong to the same continuous sequence. The key fields include object identifier, window identifier, geometric position, source color state in color environment snapshot and current output color state. If the target palette selection result of the current subtitle object is different from the target palette selection result of the previous subtitle object in the same continuous sequence, then calculate the selection margin of the current subtitle object and compare the size between the selection margin and the hold threshold. If the selection margin of the current subtitle object is less than the hold threshold, then the target palette selection conclusion of the previous subtitle object is used as the target palette selection conclusion of the current subtitle object. If the selection margin of the current subtitle object is not less than the hold threshold, and the number of times the target palette selection conclusion of the current subtitle object appears consecutively in the historical subtitle objects and the current subtitle object reaches a predetermined number, and the selection margin of the historical subtitle objects is not less than the hold threshold, then the target palette selection conclusion of the current subtitle object is determined to be usable.

[0183] Specifically, the display generation is the environment generation number of the color environment snapshot.

[0184] A color environment snapshot is obtained through the following steps: After entering the stable playback stage, the current output color state and source color state are periodically read; If both the current output color state and the source color state are available, a color environment snapshot containing the available current output color state and source color state is generated.

[0185] When a new subtitle object arrives, compare the first key fields of the current subtitle object and the previous subtitle object. If the object identifier, window identifier, geometric position, source color state in the color environment snapshot and the current output color state are consistent, and the object version is the same as the previous version or is a successor version of the previous version, then the current subtitle object and the previous subtitle object are considered to belong to the same continuous sequence.

[0186] It should be noted that belonging to the same continuous sequence can be understood as subtitle objects displayed at different times but at the same geometric position. That is, the current subtitle object and the previous subtitle object are subtitle objects in different display groups.

[0187] If the target palette selection result of the current subtitle object is different from the target palette selection result of the previous subtitle object in the same continuous sequence, then the selection margin M of the current subtitle object is calculated, and the size of the selection margin M is compared with the hold threshold.

[0188] If the selection margin M of the current subtitle object is less than the preservation threshold, then the current evidence is considered close to the original judgment boundary, and the target palette selection conclusion of the previous subtitle object is adopted as the target palette selection conclusion of the current subtitle object. That is, the target palette selection conclusion of the current subtitle object is changed to the target palette selection conclusion of the previous subtitle object. The target palette of the current subtitle object is the same as that of the previous subtitle object.

[0189] If the selection margin M of the current subtitle object is not less than the hold threshold, and the target palette selection result of the current subtitle object appears consecutively in the historical subtitle objects and the current subtitle object a predetermined number of times, that is, the target palette selection result of the current subtitle object appears consecutively in a predetermined number of object versions or display groups, and the selection margin M of the historical subtitle objects is not less than the hold threshold, then the target palette selection result of the current subtitle object is determined to be usable. In other words, the current subtitle object does not use the target palette of the previous subtitle object, but uses its own obtained target palette.

[0190] In addition, subtitle objects that appear for the first time and for which there are no historical reference results will directly use the target color palette obtained by themselves.

[0191] In addition, consecutive objects can be identified by object identifier and version, or the original palette summary, bitmap summary, position, size and display time can be combined into a consecutive identifier; the status record should have a clear invalidation range to prevent old subtitles from contaminating new subtitles.

[0192] This embodiment utilizes object identifiers, windows, geometric positions, versions, and display generations to maintain the color selection of continuous subtitle objects, which can suppress color flickering in fade-in / fade-out and alternating animations.

[0193] This embodiment uses an existing threshold selection margin to form a continuous version hysteresis. The color palette is only changed after a new result continuously deviates from the critical range, further reducing the back-and-forth switching of critical colors and fade-in / fade-out subtitles. This embodiment adds a hysteresis range to the existing threshold judgment, working in conjunction with the object version to avoid the color palette switching back and forth near the critical condition. By maintaining continuous versions of the subtitle object, the color selection remains stable over time and does not flicker.

[0194] In one embodiment, calculating the selection margin of the current caption object includes: Get the effective weights of white candidate entries for the current subtitle object, and the effective weights of all visible colors; Calculate the ratio of the effective weight of white candidate items to the effective weight of all visible colors to obtain the white weight ratio; Calculate the peak margin based on the maximum absolute brightness and graphic white brightness of the current subtitle object; Calculate the hue margin based on the weighted average hue shift of the current subtitle object; Calculate the margin for white anchor points based on the white weight ratio; The minimum value among the peak margin, hue margin, and white anchor margin is taken to obtain the selection margin of the current subtitle object.

[0195] Specifically, the peak margin, hue margin, and white anchor point margin are calculated using the following formulas 24-26: m_p = |Pm - 4W_g| / (4W_g) (Formula 24) m_h = |H - 12| / 12 (Formula 25) m_w = |r_w - 0.005| / 0.005 (Formula 26) Where m_p is the peak margin, representing the normalized distance between the peak brightness (maximum absolute brightness) Pm and the 4W_g threshold; m_h is the hue margin, representing the normalized distance between the weighted hue offset H and the 12-degree threshold; and m_w is the white anchor margin, representing the normalized distance between the white weight ratio r_w and the 0.5% threshold.

[0196] W_g represents the white brightness of the graphic; Pm represents the maximum absolute brightness (peak brightness); H represents the weighted average hue shift; and r_w represents the white weight ratio.

[0197] Only the margin items actually involved in the current judgment are included. The minimum value among these margin items is obtained by taking the following formula 27: M = min(m_p, m_h, m_w) Formula 27 This embodiment establishes a selection margin based on peak brightness, hue shift, and the distance between the white anchor point and its respective judgment threshold. When the current judgment approaches the threshold boundary, stabilization processing is performed by combining the selection of the previous version of the continuous subtitle object.

[0198] This embodiment forms a selection margin based on the distance between the candidate peak brightness, weighted hue shift, and white anchor point weight and the corresponding judgment threshold, and sets a hold interval in combination with the version relationship of continuous subtitle objects, which can suppress the palette back-and-forth switching under critical conditions.

[0199] In one embodiment, the method further includes: If the subtitle to be displayed is a special effect subtitle that uses two subtitle objects to alternately update the same animation or fade-in / fade-out, and the first subtitle object has a determined target color palette, the second subtitle object cannot determine a target color palette, and the second key field of the second subtitle object is consistent with that of the first subtitle object, then the target color palette of the first subtitle object is temporarily inherited as the target color palette of the second subtitle object. The consistency of the second key field includes occupying the same visual position, version relationship, and unique display generation relationship of color environment snapshot; If the target color palette of the second subtitle object itself can be determined, then the target color palette of the first subtitle object is replaced with the target color palette of the second subtitle object itself, so as to reconfirm and update the target color palette of the second subtitle object.

[0200] Specifically, some special effects subtitles use two subtitle objects to alternately update the same animation. For a second subtitle object that appears for the first time and whose target color palette cannot be determined, if it occupies the same visual position, has a unique version relationship and display generation relationship with a first subtitle object whose target color palette has been determined, it can temporarily inherit the target color palette selection of the first subtitle object.

[0201] The second subtitle object can then determine its own target color palette and replace the inherited target color palette of the first subtitle object with its own target color palette.

[0202] Furthermore, in one specific embodiment, only the object states within the two most recent display groups are retained. When an empty display group appears, a new subtitle period begins, or the object state exceeds the retention range, old records are cleared to prevent the reuse of object numbers from carrying over the color selection of the previous subtitle to the next subtitle.

[0203] In existing technologies, special effects subtitles (such as PGS special effects subtitles) continuously update transparency, object version, and color palette during fade-in and fade-out processes. If each frame selects a transition path independently, adjacent frames may repeatedly switch between the traditional color palette and the candidate color palette, resulting in visible color flickering.

[0204] Fade-in / fade-out or alternating dual-object animations will change the number of valid colors in the current frame. If each frame is judged independently, the same subtitle will switch back and forth between two color palettes.

[0205] This embodiment avoids screen flickering caused by switching between different color palettes by inheriting color palettes from the same group. It also keeps color selection stable during fade-in / fade-out, palette updates, and alternating animations between two objects.

[0206] In one embodiment, the method further includes: rendering a subtitle bitmap with transparency based on the index bitmap and the target color palette for display, including: The base position is obtained based on the original coordinates of the subtitle object and the user-set position; If a progress bar is received or a display event is detected, an interface occupancy state is generated. Based on the original coordinates, the user-set position, and the current screen size, a temporary display position is calculated. Obtain at least one rectangle occupied by the interface; The bounding rectangle of the subtitle is obtained based on the currently visible pixels of the subtitle object; Extend the safety margin outwards from the rectangle occupied by the interface. If the expanded interface rectangle overlaps with the subtitle bounding rectangle in the horizontal direction, and the lower edge of the subtitle enters the expanded interface rectangle, then calculate the avoidance distance of the corresponding interface rectangle and obtain the maximum avoidance distance. If it is determined that the subtitles will exceed the top safety boundary of the screen after being moved up based on the maximum avoidance distance, then the maximum avoidance distance will be limited and updated to the maximum value that will not exceed the top safety boundary of the screen; If the rectangle occupied by the interface cannot be obtained, the interface safety offset is used as the maximum avoidance distance; Based on the maximum avoidance distance, each subtitle object in the subtitle bitmap is shifted from its base position to a temporary display position for display.

[0207] Specifically, the basic position y_0 of the subtitle object is obtained based on its original coordinates and the user-set position. Based on a unified size conversion rule, the interface safety offset D_ui corresponding to the current screen size is calculated. The temporary display position y_1 during the display period is obtained based on the basic vertical position y_0 and the interface safety offset D_ui.

[0208] When the playback device receives a progress bar or other display event from the bottom interface, an interface occupancy state is generated. Specifically, the temporary display position y_1 is calculated using the following formula 28: y_1 = y_0 - D_ui Formula 28 Where y_0 is the basic vertical position determined by the user settings and the original coordinates of the subtitle; D_ui is the interface safety offset calculated according to the current screen size; and y_1 is the temporary display position during the interface display.

[0209] In one specific embodiment, a safe offset of approximately 60 to 70 interface size units is used on the 1080-line reference interface, and the 4K surface is converted according to a uniform size rule.

[0210] The playback device interface display event simultaneously provides the interface occupancy rectangle R_u=(x_u,y_u,w_u,h_u). The subtitle display object obtains the subtitle outer rectangle Rj_s=(x_s,y_s,w_s,h_s) based on the currently visible pixels of the subtitle object. First, the interface occupancy rectangle is expanded outward by a safety margin M_safe. When two rectangles overlap horizontally, and the lower edge of the subtitle enters the expanded interface occupancy area, the avoidance distance is calculated according to formula 29: Db_ui = max(0, y_s + h_s - y_u + M_safe) Formula 29 Where y_s+h_s is the lower edge position of the bounding rectangle of the subtitle; y_u is the upper edge position of the rectangle occupied by the interface; and M_safe is the minimum spacing that needs to be maintained between the subtitle and the interface.

[0211] If multiple interfaces occupy the rectangle simultaneously, the maximum avoidance distance is calculated and taken for each. If the subtitle moves up and exceeds the top safety boundary of the screen, the avoidance distance Db_ui is limited to the maximum value that will not cross that boundary. When the interface rectangle cannot be obtained, the aforementioned fixed safety offset is still used, so the rectangle calculation path will not affect the existing event-driven path.

[0212] Position changes affect the entire subtitle display object carrying the current subtitle bitmap, without re-decoding the index bitmap or generating a second subtitle bitmap. PGS bitmap subtitles use a translation animation of approximately 100 milliseconds; other subtitle display objects can use a translation animation of approximately 200 milliseconds.

[0213] When the interface is exited or hidden, restore the subtitle object to the base position y_0.

[0214] If display events are continuously detected, the original timer for hiding the interface is canceled, extending the current interface's occupied state; when the interface is truly exited, the restoration is executed only once. In this way, when the user continuously drags the progress bar or performs rapid operations, the subtitles will not repeatedly jump between their original position and the avoidance position.

[0215] In this embodiment, when the player interface enters the subtitle area, a smooth position offset is performed on the same subtitle object that has already completed color selection. After the interface exits, the user's original position is restored.

[0216] In this embodiment, when the playback interface appears, only the same subtitle object that has already undergone color processing is moved, thus avoiding the temporary interface, resetting the color judgment, and generating duplicate bitmaps; after the interface exits, the user's original settings position can be restored.

[0217] This embodiment calculates the movement distance based on the actual overlap between the subtitle rectangle and the interface rectangle, which can reduce the situation where the fixed upward movement is too excessive or still obscures the text, while retaining a fixed offset as a compatibility fallback.

[0218] This application does not address a single color conversion problem, but rather the entire continuous presentation problem of graphic subtitles, from palette decoding, color path selection, spatial partitioning, continuous frame stabilization to position adjustment when the subtitle appears on the screen.

[0219] refer to Figure 2 This application also 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, it causes the processor to perform the steps of any of the methods described above. See the description of the graphic subtitle display method above for details, which will not be repeated here. See the description of the adaptive display method for graphic subtitles above for details, which will not be repeated here.

[0220] The following example illustrates how this application works: After a playback task is established, the system first saves the actual output state before playback. When the main feature begins playback, the system reads the source color state and the current output color state within the fast sampling window; once a usable combination of the source color state and the current output color state is formed, a color environment snapshot is published. The subtitle decoder receives a display group, such as a PGS display group, decodes the index bitmap, and saves the original 256-item Y, Cr, Cb, A color palette before legacy conversion, while simultaneously generating a legacy color palette, such as an ARGB legacy color palette, and saving the object metadata.

[0221] For subtitle objects with a source color state of PQ and actual output supporting HDR image compositing, the system generates a candidate color palette following the steps described above. Then, it scans the object's index bitmap, counts the number of pixels for each color entry, and combines this with transparency to form effective weights. If an SDR white anchor point with sufficient weight is detected, it indicates that the subtitle better conforms to traditional production relationships, and the traditional color palette continues to be used; if there is no white anchor point, and the peak brightness, weighted average hue shift, and number of significant colors all meet safety conditions, then the candidate color palette is adopted.

[0222] The final subtitle bitmap is displayed at the user-defined location. When the user brings up the playback progress bar, the same subtitle display object smoothly moves upward; it returns to its original position after the progress bar is hidden. Throughout the entire process, a second subtitle is not regenerated, the color selection of the already confirmed subtitle object is not changed, and the current object state is not carried over to the next subtitle.

[0223] 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.

[0224] 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.

[0225] The above embodiments merely illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed. However, 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. An adaptive rendering method for graphic subtitles, characterized in that, The method includes: Periodically read the current output color state and source color state. If both the current output color state and source color state are available, generate a color environment snapshot containing the available current output color state and source color state. The current subtitle object is parsed to obtain an index bitmap and a set of color entries, wherein the set of color entries contains multiple color entries, and each color entry contains color components extracted from the current subtitle object; Based on the set of color entries, the original color palette is obtained. Then, based on the standard dynamic range conversion path, the set of color entries is converted to obtain a traditional color palette. Based on the color environment snapshot, index bitmap, original color palette and traditional color palette of the current subtitle object, determine whether to allow the generation of candidate color palettes; If candidate color palettes are allowed to be generated, then the original color palette is color-converted to obtain the candidate color palettes; Determine the target color palette for the current subtitle object, wherein the target color palette is a traditional color palette or a candidate color palette; A subtitle bitmap with transparency is rendered and displayed based on the index bitmap and the target color palette.

2. The method according to claim 1, characterized in that, The step of determining the target color palette for the current subtitle object, wherein the target color palette is a traditional color palette or a candidate color palette, includes: If a candidate color palette exists, count the actual number of pixels for each color entry; Color entries with the same key color component are grouped into the same first color group, where the key color component includes the luminance component and the color difference component; The effective weight of the first color group is calculated based on the actual number of pixels and the transparency component in the color components. Calculate the total color weight of the first color group that is visible and has color differences in a traditional color palette; The significant color group in the first color group is determined based on the effective weight and the total color weight; Calculate the minimum circumferential hue difference between the first color group and the traditional color palette and the candidate color palette; The weighted average hue shift is obtained based on the minimum circumferential hue difference and the effective weights of the significant color groups; Calculate the maximum absolute brightness across all channels of the salient color group; Determine white candidate entries in the color entries based on the key color components of the color entries; Determine whether a standard dynamic range white anchor point exists based on the effective weight of the white candidate item; Choose the traditional color palette as the target color palette if any of the following conditions are met; otherwise, choose the candidate color palette as the target color palette: There are standard dynamic range white anchor points; The maximum absolute brightness exceeds the first brightness threshold; The weighted average hue shift is not less than the shift threshold, and the maximum absolute brightness exceeds the second brightness threshold.

3. The method according to claim 1 or 2, characterized in that, The step of determining whether to allow the generation of a candidate color palette based on the color environment snapshot, index bitmap, original color palette, and traditional color palette of the current subtitle object includes: Candidate color palettes can be generated if all of the following conditions are met: The current subtitle object has valid width and height, and does not exceed the current subtitle composition canvas. Indexed bitmaps, traditional color palettes, and the original color palette are all present. The source color state in a color environment snapshot can be achieved using perceptual quantization transfer properties or mixed log-gamma transfer properties. The available current output color state supports graphic subtitles to be synthesized according to high dynamic range. The current output color state available in the color environment snapshot has an available graphic white brightness reference.

4. The method according to claim 1 or 2, characterized in that, The color entries include a luminance component, a red chromatic aberration component, a blue chromatic aberration component, and a transparency component; The process of performing color conversion on the original color palette to obtain a candidate color palette includes: The luminance, red, and blue color difference components of the non-transparent color entries in the original color palette are normalized to obtain normalized luminance, red, and blue color difference components. Based on the non-constant brightness relationship and the normalized brightness component, normalized red color difference component, and normalized blue color difference component, the coding domain component is obtained, wherein the coding domain component includes the red component, green component, and blue component in the coding domain. If the source color state is perceptual quantization, then perform perceptual quantization inverse transform on each coding domain component to obtain the inverse transform component corresponding to each coding domain component; If the source color state is a mixed log-gamma, then calculate the scene linearity value of each coding domain component; The absolute brightness of each channel is obtained based on the inverse transform component or scene linear value. The absolute brightness is normalized, converted, and compressed to obtain the color conversion component. Based on the color conversion components and corresponding transparency components of all non-transparent color entries in each channel, as well as the transparent entries, a candidate color palette is obtained.

5. The method according to claim 4, characterized in that, If the source color state is perceptually quantized, then the absolute brightness of each channel can be obtained according to the following formula 7-8: p = E^(1 / m2) Formula 7 L = 10000 × [max(p - c1, 0) / (c2 - c3 × p)]^(1 / m1) Formula 8 Where E represents the coding domain components R_e, G_e, and B_e respectively; p represents the inverse transform components, with values ​​R_p, G_p, and B_p respectively; L represents the absolute luminance, with values ​​L1_R, L1_G, and L1_B respectively, in nits; and m1, m2, c1, c2, and c3 are the inverse transform parameters. And / or, If the source color state is a mixed log-gamma, then the absolute brightness of each channel is calculated using the following steps: Calculate the scene brightness based on the scene linear value. The output photoelectric conversion gain is calculated based on the scene brightness. The absolute brightness of each channel is calculated based on the scene linearity value of each coding domain component and the output photoelectric conversion gain.

6. The method according to claim 4, characterized in that, The process of normalizing, converting, and compressing the absolute brightness to obtain color conversion components includes: By using the graphic white brightness corresponding to the current output color state, the absolute brightness of each channel is normalized to obtain the first linear component of each channel. Convert each of the first linear components into a second linear component; The second linear component of each channel is scaled according to the first scaling ratio to obtain the scaled component of each channel; Calculate the linear luminance based on the second linear component; The scaling components of each channel are compressed with the linear brightness as the center to obtain the compressed components; The compressed component is encoded and quantized to obtain the color conversion component.

7. The method according to claim 1 or 2, characterized in that, The step of rendering a subtitle bitmap with transparency based on the index bitmap and the target color palette for display includes: Identify the connected regions that are separate from each other within the same subtitle object, and obtain the bounding rectangle of each connected region; Determine a connected region palette for target connected regions that have regionally significant color groups; If there are at least two target connected regions and their bounding rectangles do not overlap, then region coverage is allowed. A subtitle bitmap with transparency is rendered based on the index bitmap of the subtitle object and the target color palette. Visible pixels with non-zero transparency within the target connected region of the subtitle bitmap are overwritten according to the connected region color palette and the index bitmap, while maintaining the original result of transparent pixels and pixels outside the target connected region in the subtitle bitmap. Subtitles are displayed based on the subtitle bitmap after regional coverage.

8. The method according to claim 1 or 2, characterized in that, The method further includes: Before rendering, result verification is performed, which includes checking whether the transparency of the target color palette is consistent with the transparency of the original color palette, whether the visible color entries fall within the valid encoding range, and whether the subtitle bounding rectangle is still located in the display safe area. The subtitle bounding rectangle is obtained based on the current visible pixels of the subtitle object. If the result fails the validation, the target color palette of the corresponding subtitle object will be reverted to the traditional color palette. If any of the following conditions exist, the target color palette for the corresponding subtitle object will revert to the traditional color palette: The original color palette of the subtitle object does not exist, the index bitmap is invalid, the source color state or output color state is unknown, the transfer characteristics cannot be determined, the graphic white brightness is unavailable, the boundaries of connected regions overlap, the target color palette selection conclusions of the same group of subtitle objects conflict, and the compatibility mode is manually enabled.

9. The method according to claim 1 or 2, characterized in that, The periodic reading of the current output color state and the source color state includes: Before playback begins, the actual output color state is read as the output baseline; Within the fast window after playback begins, if the current output color state is equal to the output baseline, or if at least one of the current output color state and the source color state is unavailable, then the current output color state and the source color state are read with the first sampling period. If both the current output color state and the source color state are available, the current output color state and the source color state are read at the second sampling period, wherein the first sampling period is shorter than the second sampling period.

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.