Video conversion method, electronic device, and storage medium
By performing geometric operations and a reversible chromaticity conversion algorithm on the chromaticity map, the chromaticity values of HDR video are mapped to the small color gamut of SDR video, solving the problem of video conversion accuracy loss in existing technologies and achieving high-quality video conversion effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-01-09
- Publication Date
- 2026-05-15
AI Technical Summary
Existing video conversion solutions suffer from accuracy loss when converting video chroma, resulting in poor video conversion quality.
By performing geometric operations on the chromaticity map, the mapping method of chromaticity values is determined, converting the large gamut chromaticity values in HDR video to the small gamut chromaticity values in SDR video, and using a reversible chromaticity conversion algorithm to ensure the fidelity of chromaticity information.
It improves the image quality of converted videos, preserves the color details of the original HDR videos, and can restore SDR videos back to HDR videos when necessary.
Smart Images

Figure CN120343191B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to video conversion methods, electronic devices, and storage media. Background Technology
[0002] With the widespread use of smart devices, it has become commonplace for users to shoot videos using electronic devices such as mobile phones and tablets. Videos shot by electronic devices include High Dynamic Range (HDR) video and Standard Dynamic Range (SDR) video.
[0003] To ensure compatibility with electronic devices displaying different sizes of screens, reproduce creators' video content accurately, and deliver optimal visual effects, users often require format conversion between these two video types. For example, converting HDR video to SDR video, or vice versa.
[0004] Current video conversion solutions suffer from precision loss when converting video chroma, resulting in poor video conversion quality. Summary of the Invention
[0005] This application provides a video conversion method, electronic device, and storage medium, which can improve the video conversion effect.
[0006] In a first aspect, embodiments of this application provide a video conversion method applicable to any electronic device with video processing capabilities. The method includes: in response to an operation of converting a high dynamic range (HDR) video to a standard dynamic range (SDR) video, the electronic device acquires a first chromaticity value of a first pixel unit in a first image of the HDR video, wherein the first image is any frame image in the HDR video, and the first pixel unit is any pixel unit in the first image; the electronic device determines the regional position of the first chromaticity value in a chromaticity map; if the electronic device determines that the first chromaticity value is within a first region of the chromaticity map, the electronic device performs chromaticity conversion on the first chromaticity value to obtain a second chromaticity value of the first pixel unit in the first image of the SDR video; the distance between the second chromaticity value and the white point of the chromaticity map is less than the distance between the first chromaticity value and the white point.
[0007] For example, refer to Figure 8 The first region of the chroma diagram refers to the area within the HDR color gamut excluding the △DEF region, specifically the area within △A'B'C' excluding △DEF. Compared to the △DEF region, the first region can be considered a larger color gamut. The first chroma value corresponds to... Figure 8 Since point b is outside the △ABC region within the HDR color gamut (i.e., point b is in the first region), electronic devices can map point b to point b' based on a preset chromaticity conversion algorithm, and the second chromaticity value can correspond to... Figure 8 The middle point is b'. The white dot is... Figure 8 In the diagram, the distance between point O and the white point for the second chromaticity value corresponds to the distance between point b' and point O, and the distance between point b' and the white point for the first chromaticity value corresponds to the distance between point b and point O. The distance between point b' and point O is less than the distance between point b and point O. Compared to point b, point b' is closer to the white point.
[0008] In the above embodiments, if the electronic device determines that the chromaticity value (such as the first chromaticity value mentioned above) of a certain pixel unit in a certain frame of an HDR video is located in the first region of the chromaticity map, the electronic device performs chromaticity conversion on the chromaticity value of the pixel unit so that the converted chromaticity value (such as the second chromaticity value mentioned above) falls within the SDR color gamut of the chromaticity map, rather than falling on the boundary of the SDR color gamut. This converts the chromaticity information in the large color gamut of the image in the HDR video to a small color gamut to a certain extent, thereby improving the image quality of the converted SDR video.
[0009] In one optional embodiment of the first aspect, the electronic device performs chromaticity conversion on the first chromaticity value to obtain a second chromaticity value of the first pixel unit of the first image in the SDR video, including: the electronic device acquiring a first line connecting a first coordinate point and a white point, determining a first intersection point between the first line and the SDR color gamut boundary in the chromaticity diagram, and a second intersection point between the first line and the HDR color gamut boundary in the chromaticity diagram; the first coordinate point is the coordinate point of the first chromaticity value on the chromaticity diagram; the electronic device acquiring a first distance value between the first coordinate point and the white point, a second distance value between the first intersection point and the white point, and a third distance value between the second intersection point and the white point; the electronic device determining a fourth distance value based on the first distance value, the second distance value, and the third distance value, the fourth distance value being the distance value between the second coordinate point and the white point, the second coordinate point being the coordinate point of the second chromaticity value on the chromaticity diagram; and the electronic device determining the second chromaticity value based on the fourth distance value.
[0010] For example, refer to Figure 8 Let point b be the first coordinate point, point b' be the second coordinate point, and the first connecting line be Ob. The SDR color gamut boundary is the boundary of triangle ABC, and the HDR color gamut boundary is the boundary of triangle A'B'C'. The first intersection point is point a, and the second intersection point is point c. The first distance value is the distance between point b and point O, which can be denoted as x1. The second distance value is the distance between point a and point O, which can be denoted as dis(Oa). The third distance value is the distance between point c and point O, which can be denoted as dis(Oc). The fourth distance value is the distance between point b' and point O, which can be denoted as y1. In one example, the electronic device can determine the fourth distance value y1 using the following formula.
[0011] y1=f(x1)=βx1 / (α+β)+(α-α*β) / (α+β)
[0012] In the formula, α = dis(Oc) / dis(Oa) – 1, and β is a constant, for example, β is 0.2.
[0013] The above embodiments illustrate how, based on the position of the first chromaticity value in the chromaticity diagram, a geometric operation is used to determine how to convert the first chromaticity value to a second chromaticity value. In this way, chromaticity values in a large color gamut can be mapped to the SDR color gamut at a certain ratio, thereby converting the chromaticity information of the image in the large color gamut of the HDR video to the small color gamut.
[0014] In an optional embodiment of the first aspect, the method further includes: if the electronic device determines that the first chromaticity value is within a second region of the chromaticity map, the electronic device uses the first chromaticity value as the chromaticity value of a first pixel unit of the first image in the SDR video.
[0015] For example, refer to Figure 8 The second region of the chroma map refers to the △DEF region within the HDR color gamut. Compared to the first region mentioned above, the second region can be considered as a smaller color gamut.
[0016] In the above embodiments, if the electronic device determines that the chromaticity value (such as the first chromaticity value mentioned above) of a certain pixel unit in a certain frame of an HDR video is located in the second region of the chromaticity map, the electronic device may not perform chromaticity conversion on the chromaticity value of the pixel unit, that is, keep the chromaticity value of the pixel unit unchanged.
[0017] In an optional embodiment of the first aspect, the method further includes: in response to the operation of converting SDR video to HDR video, the electronic device acquires a third chromaticity value of a second pixel unit of a second image in the SDR video, wherein the second image is any frame image in the SDR video and the second pixel unit is any pixel unit of the second image; the electronic device determines the regional position of the third chromaticity value in a chromaticity diagram; if the electronic device determines that the third chromaticity value is in a third region of the chromaticity diagram, the electronic device performs chromaticity conversion on the third chromaticity value to obtain a fourth chromaticity value of the second pixel unit of the second image in the HDR video; the distance between the fourth chromaticity value and the white point of the chromaticity diagram is greater than the distance between the third chromaticity value and the white point.
[0018] For example, refer to Figure 8 The third region of the chromaticity diagram refers to the area within the SDR color gamut excluding the △DEF region, that is, the area in △ABC excluding △DEF. The third chromaticity value can correspond to... Figure 8 Since point f is outside the △DEF region within the SDR color gamut (i.e., in the third region), electronic devices can map point f to point f' based on a preset chromaticity conversion algorithm, and the fourth chromaticity value can then correspond to... Figure 8The distance between the fourth chromaticity value and the white point corresponds to the distance between the f' point and the O point, and the distance between the third chromaticity value and the white point corresponds to the distance between the f point and the O point. The distance between the f' point and the O point is greater than the distance between the f point and the O point. Compared to the f point, the f' point is farther away from the white point.
[0019] In the above embodiments, if the electronic device determines that the chromaticity value (such as the third chromaticity value mentioned above) of a certain pixel unit in a certain frame of an SDR video is located in the third region of the chromaticity map, the electronic device performs chromaticity conversion on the chromaticity value of the pixel unit so that the converted chromaticity value (such as the fourth chromaticity value mentioned above) falls outside the SDR color gamut of the chromaticity map, that is, converting the chromaticity value in the small color gamut to the large color gamut, which can improve the picture quality of the converted HDR video.
[0020] In one optional embodiment of the first aspect, the electronic device performs chromaticity conversion on the third chromaticity value to obtain the fourth chromaticity value of the second pixel unit of the second image in the HDR video, including: the electronic device acquiring a second line connecting the third coordinate point and the white point, determining a third intersection point between the second line and the SDR color gamut boundary in the chromaticity diagram, and a fourth intersection point between the second line and the HDR color gamut boundary in the chromaticity diagram; the third coordinate point is the coordinate point of the third chromaticity value on the chromaticity diagram; the electronic device acquiring a fifth distance value between the third coordinate point and the white point, a sixth distance value between the third intersection point and the white point, and a seventh distance value between the fourth intersection point and the white point; the electronic device determining an eighth distance value based on the fifth distance value, the sixth distance value, and the seventh distance value, the eighth distance value being the distance value between the fourth coordinate point and the white point, the fourth coordinate point being the coordinate point of the fourth chromaticity value on the chromaticity diagram; and the electronic device determining the fourth chromaticity value based on the eighth distance value.
[0021] For example, refer to Figure 8 The third coordinate point can be point f, the fourth coordinate point can be point f', the second connection is Of, the SDR color gamut boundary is the boundary of △ABC, the HDR color gamut boundary is the boundary of △A'B'C', the third intersection point is point g, and the fourth intersection point is point h. The fifth distance value is the distance between point f and point O, x2; the sixth distance value is the distance between point g and point O, which can be denoted as dis(Og); the seventh distance value is the distance between point h and point O, which can be denoted as dis(Oh); and the eighth distance value is the distance between point f' and point O, y2. In one example, the electronic device determines the distance y2 between point f' and the white point O using the following formula:
[0022] x2=f(y2)=βy2 / (α+β)+(α-α*β) / (α+β)
[0023] In the formula, α = dis(Oh) / dis(Og) – 1, and β is a constant, for example, β is 0.2.
[0024] The above embodiment shows that based on the position of the third chromaticity value in the chromaticity diagram, a formula for geometric operation is used to determine how to convert the third chromaticity value to the fourth chromaticity value. In this way, chromaticity values within a small color gamut can be mapped to outside the SDR color gamut according to a certain ratio, which can improve the picture quality of the converted HDR video.
[0025] In an optional embodiment of the first aspect, the method further includes: the electronic device determining that the third chromaticity value is in a second region of the chromaticity map, and the electronic device using the third chromaticity value as the chromaticity value of a second pixel unit of a second image in an HDR video.
[0026] In the above embodiments, if the electronic device determines that the chromaticity value (such as the third chromaticity value mentioned above) of a certain pixel unit in a certain frame of an SDR video is located in the second region of the chromaticity map, the electronic device may not perform chromaticity conversion on the chromaticity value of the pixel unit, that is, keep the chromaticity value of the pixel unit unchanged.
[0027] In one alternative implementation of the first aspect, the chromaticity diagram is the CIE1976 chromaticity diagram.
[0028] In a second aspect, embodiments of this application provide an electronic device, which includes: one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the electronic device to perform the method as described in any of the first aspects.
[0029] Thirdly, embodiments of this application provide a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform the method as described in any one of the first aspects.
[0030] Fourthly, embodiments of this application provide a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of the first aspects.
[0031] Fifthly, embodiments of this application provide a computer program product including computer program code, which, when run on an electronic device, causes the electronic device to perform the method as described in any one of the first aspects.
[0032] It should be understood that the second to fifth aspects of this application correspond to the technical solutions of the first aspect of this application, and the beneficial effects achieved by each aspect and the corresponding optional implementation are similar, and will not be repeated here. Attached Figure Description
[0033] Figure 1 A schematic diagram of the CIE 1931 chromaticity diagram;
[0034] Figure 2 Illustration of changes to the mobile phone interface provided in the embodiments of this application Figure 1 ;
[0035] Figure 3 Illustration of changes to the mobile phone interface provided in the embodiments of this application Figure 2 ;
[0036] Figure 4 Illustration of changes to the mobile phone interface provided in the embodiments of this application Figure 3 ;
[0037] Figure 5 Illustration of changes to the mobile phone interface provided in the embodiments of this application Figure 4 ;
[0038] Figure 6 This is a schematic diagram of chromaticity conversion based on the CIE1931 chromaticity diagram provided in an embodiment of this application;
[0039] Figure 7 The flow chart of the video conversion method provided in the embodiments of this application Figure 1 ;
[0040] Figure 8 A schematic diagram of chromaticity conversion based on the CIE1976 chromaticity diagram provided in this application embodiment;
[0041] Figure 9 This is a schematic diagram illustrating the functional relationship of mapping chromaticity points to chromaticity diagrams in electronic devices.
[0042] Figure 10 The flow chart of the video conversion method provided in the embodiments of this application Figure 2 ;
[0043] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0044] Figure 12 This is a software architecture diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0045] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.
[0046] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0047] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following associated objects are in an "or" relationship. "At least one of the following (kind / items)" or similar expressions refer to any combination of these items, including any combination of single (kind / items) or multiple (kind / items). For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0048] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc., including videos, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0049] To facilitate understanding, the technical terms involved in the embodiments of this application will be explained below.
[0050] 1. A chromaticity diagram is an image developed by the International Commission on Illumination (CIE) to visually represent the relationships between colors and describe the range of the color gamut. Examples include the CIE 1931 chromaticity diagram and the CIE 1976 chromaticity diagram, with the CIE 1931 being the most widely used.
[0051] Figure 1 This is a schematic diagram of the CIE 1931 chromaticity diagram. Figure 1The points on curve 1 represent monochromatic light, that is, the color of light (electromagnetic waves) of a single frequency. The values marked on curve 1 are wavelength values, ranging from 380nm to 700nm, which is the wavelength range of visible light to the human eye. Connecting the left endpoint (380nm) and the right endpoint (700nm) of curve 1 forms a closed region. Because the entire image resembles a horseshoe, it is also called a "horseshoe diagram." The area enclosed by the image covers all colors that the human eye can distinguish, and each point on the image uniquely corresponds to one color.
[0052] 2. A color space refers to the set of all colors that a device (monitor) can display. All colors that a device can display reside within this color space. In mathematical terms, it is c∈S, where c is any color that the device can display, and S is a specific color space. Figure 1 For example, the largest color space is the CIE 1931 color space, which is... Figure 1 The horseshoe-shaped closed region in the chromaticity diagram shown represents the CIE 1931 color space, which can be understood as the complete set of the color gamut, mathematically denoted by U. Any color space S is a subset of U, i.e.
[0053] 3. Color gamut refers to the range of a set of color spaces; different color spaces have different color gamuts. For example... Figure 1 The area △ABC shown corresponds to color gamut 1, and the area △A'B'C' corresponds to color gamut 2. The color space of color gamut 1 is smaller than that of color gamut 2. Color gamut 1 can be called a smaller color gamut compared to color gamut 2, and color gamut 2 can be called a larger color gamut compared to color gamut 1. In this embodiment, color gamut 1 can be the BT.709 color gamut, and color gamut 2 can be the BT.2020 color gamut. The BT.709 color gamut is a smaller color gamut compared to the BT.2020 color gamut, and the BT.2020 color gamut is a larger color gamut compared to the BT.709 color gamut. When converting HDR video to SDR video, the color gamut is converted from BT.2020 to BT.709. When converting SDR video to HDR video, the color gamut is converted from BT.709 to BT.200.
[0054] 4. White point refers to the color of white when displayed on a device at 255 ppm, usually expressed using color coordinates or color temperature in Kelvin. The white point corresponds to the standard color temperature of white balance, typically represented by Dxx. For example, Figure 1 In the diagram, the white dot is represented by color temperature D65, which is equivalent to a color temperature of 6500K. The white dot corresponding to color gamut 1 in the region of △ABC coincides with the white dot corresponding to color gamut 2 in the region of △A'B'C'.
[0055] 5. Standard Dynamic Range (SDR) is a technology that uses the brightness, contrast, and color characteristics of a cathode ray tube (CRT) display to represent light intensity. The dynamic range here generally refers to the brightness range; a larger brightness range can support higher contrast. SDR supports a brightness range between 0.1 nits and 100 nits, uses the BT.709 color gamut, and uses a gamma curve as its electro-optical transfer function (EOTF).
[0056] 6. High Dynamic Range (HDR) is an upgrade to SDR and a technology that improves video display quality. HDR changes the way brightness and color information of video and images are represented in the signal, thereby supporting a wider brightness range (0.0005-10000 nits), a wider BT.2020 color gamut, and higher precision quantization (10-bit or 12-bit).
[0057] HDR video can display more detail in both bright and dark areas, with rich colors and vivid, natural detail, making the image closer to what the human eye sees. SDR video, on the other hand, has lower color saturation and contrast than HDR video. Compared to HDR, SDR video appears dull and unnatural, and shows a significant loss of detail in both bright and dark areas.
[0058] 7. A pixel is the basic unit that constitutes a digital image. A pixel is also called a pixel point or pixel unit, and a pixel unit may include one or more pixels. This application describes the scheme using a pixel unit in an image as an example.
[0059] To facilitate understanding, the scenarios of the video conversion method provided in the embodiments of this application will be introduced first below.
[0060] Scenario 1: After shooting an HDR video using an electronic device, a user needs to convert the HDR video to SDR video to adapt to devices that support SDR video playback. In one example, the electronic device has a gallery app (or photo album app) and a video editing app installed. The user can view the shot or downloaded videos, such as HDR videos, in the gallery app. In response to editing operations on the HDR video in the gallery app, the electronic device launches the video editing app. In response to video conversion operations in the video editing app, the electronic device converts the HDR video to SDR video based on a preset color conversion algorithm. Launching the video editing app can be understood as the electronic device initiating the corresponding process for the video editing app.
[0061] The following is combined with Figures 2 to 4The user operation process in Scenario 1 above will be described. Unless otherwise specified, the following embodiments use a mobile phone as an example; the interface display and user operation of other devices are similar.
[0062] Figure 2 Illustration of changes to the mobile phone interface provided in the embodiments of this application Figure 1 .like Figure 2 As shown in a and b, in response to an operation on the gallery application icon 1011 on interface 101, the phone displays interface 102, which includes album categories such as camera, all photos, videos, screenshots / screen recordings, and my favorites. Figure 2 As shown in b and c, in response to an operation on the video control 1021 on interface 102, the mobile phone displays interface 1031, which includes multiple video segments, such as... Figure 2 The image shows three SDR video clips and one HDR video clip. (See image c.) Figure 2 As shown in C and D, in response to an operation on the HDR video 1031 applied to interface 103, the phone displays interface 104. Interface 104 includes an icon 104 and a video playback progress window 1041. The icon 104 can be located in the upper right corner of interface 104 and is used to indicate that the currently playing video is an HDR video. The bottom of interface 104 also displays controls such as share, favorite, edit, delete, and more, facilitating user operations on the video. The above example illustrates the process of a user viewing a video on a mobile phone.
[0063] Figure 3 Illustration of changes to the mobile phone interface provided in the embodiments of this application Figure 2 .like Figure 3 As shown in a and b, in response to an operation on the "Edit" control on interface 104, the phone can display interface 201. Interface 201 displays a first prompt message, which prompts the user whether they agree to use the video editing application to edit the video. Figure 3 As shown in b and c, in response to the operation of the "Agree" control on interface 201, the phone can display interface 202, which displays a second prompt message. The second prompt message is used to ask the user whether to allow the video editing application to access the music and videos on the phone. Figure 3 As shown in C and D, in response to the operation of the "Always Allow" control on interface 202, the phone can display interface 203. Interface 203 displays a third prompt message, which prompts the user whether to allow the video editing application to access photos and videos on the phone. Figure 3 As shown in d and e, in response to the operation of the "Always Allow" control on interface 203, the mobile phone can display interface 204, which is a video editing interface provided by a video editing application.
[0064] The example above illustrates the process of a user accessing a video editing app for video editing for the first time through the gallery app. After the video editing app obtains the user's authorizations, the user can then edit the video within the app. It should be understood that after obtaining the user's authorizations, when the user accesses the video editing app again through the gallery app for video editing, the phone can skip interfaces 201 to 203 and directly proceed to interface 204.
[0065] Figure 4 Illustration of changes to the mobile phone interface provided in the embodiments of this application Figure 3 .like Figure 4 As shown in a and b, in response to an operation of control 2041 applied to interface 204, the mobile phone can display window 2042 on interface 204. Window 2042 displays a video conversion selection control 2043 and an export control 2044. The current video type is HDR video (gray bold). Figure 4 As shown in b and c, in response to operation 1 (converting to "normal video") applied to selection control 2043 and operation 2 (converting to export control 2044), the phone begins video conversion, converting the current HDR video to SDR video. The video conversion process takes some time. During this process, the phone can display window 3021 on interface 302, showing the progress of the video export (video conversion). After the video export is complete, the phone can display interface 303, which is the gallery application interface. Interface 303 can pop up card 3031, which displays a fourth prompt message informing the user that the converted video has been saved to the "Pictures" album and editing drafts. Card 3021 disappears after a short period (e.g., 2 seconds). In this example, "normal video" refers to SDR video.
[0066] The example above illustrates the process of a user accessing a video editing app through the gallery app and then performing video conversion within the video editing app. After conversion, the converted SDR video is stored in the gallery app, and the phone displays the SDR video in the gallery app for the user's convenience.
[0067] Scenario 2: An electronic device stores multiple video segments, including HDR and SDR videos, and the user needs to stitch these segments together. Taking the stitching of two videos as an example, the two videos are of different types; for example, the first video is an SDR video, and the second video is an HDR video. In response to editing the first video in the gallery application, the electronic device launches a video editing application. In response to adding the second video and stitching the videos in the video editing application, the electronic device converts the SDR video to HDR video based on a preset color conversion algorithm, resulting in two SDR video segments. These two HDR video segments are then stitched together to obtain the stitched video.
[0068] It should be noted that when electronic devices stitch HDR and SDR videos, they typically use the HDR video as a base and convert the SDR video to HDR to ensure the two video segments are of the same type before stitching. However, in some embodiments, the electronic device may also convert the HDR video to SDR based on the user's selection, ensuring the two video segments are of the same type before stitching.
[0069] The following is combined with Figure 5 The user operation process in scenario two above will be described.
[0070] Figure 5 Illustration of changes to the mobile phone interface provided in the embodiments of this application Figure 4 .like Figure 5 As shown in Figure a, the mobile phone displays interface 401, which displays an SDR video clip from the gallery application. In response to an operation on the "Edit" control on interface 401, the mobile phone displays interface 402, as shown... Figure 5 As shown in Figure b, interface 402 displays controls 4021 and 4022. Control 4021 displays "1080P" to indicate that the current video type is SDR video. Control 4022 is used to trigger the addition of a new video or image. Figure 5 As shown in b and c, in response to the operation applied to control 4022, the phone displays interface 403, which displays multiple images and multiple video clips, including HDR videos. Figure 5 As shown in C and D, in response to operation 1 (selecting HDR video 4031 on interface 403) and operation 2 (adding a control on interface 403), the phone displays interface 404. Interface 404 displays control 4041, which displays "HDR|1080P" to indicate that the newly added second video is an HDR video. Area 4042 of interface 404 includes two videos: an SDR video and the newly added HDR video. Figure 5As shown in d, in response to an operation performed on region 4042, which can be a user long-pressing and holding operation on region 4042, the phone displays thumbnails of the two video clips in region 4042, as shown. Figure 5 Thumbnails 4043 and 4044 are shown in section e. In response to the user releasing their finger (or cursor) in area 4042, the phone displays interface 404.
[0071] In response to the "Export" control applied to the 404 error on the interface, the phone can first perform video conversion, such as converting an SDR video to an HDR video. Then, the converted HDR video is stitched together with a newly added second HDR video segment to obtain the final stitched video. The phone can save the stitched video to the Gallery app, and after the stitching is complete, the phone can display the stitched video (not shown) in the Gallery app.
[0072] The example above illustrates the process of a user stitching videos together. If the two videos are of different types, such as one being an SDR video and the other an HDR video, the phone can first convert the SDR video to an HDR video before stitching them together, and then stitch the two HDR videos together to ensure that the color and image quality of the stitched video are consistent.
[0073] Based on the above scenario one, HDR video consists of multiple consecutive frames. The process of converting HDR video to SDR video by an electronic device includes: the electronic device, based on a preset chroma conversion algorithm, sequentially converts the chroma of each frame in the HDR video to obtain SDR video. SDR video consists of multiple frames after chroma conversion. When converting HDR video to SDR video, the color gamut changes from BT.2020 to BT.709, which can be understood as a conversion from a large color gamut to a small color gamut. For easier understanding, the following will combine... Figure 6 The chromaticity conversion of a single pixel unit in any frame of an HDR video is illustrated.
[0074] For example, Figure 6 This is a schematic diagram of chromaticity conversion based on the CIE 1931 chromaticity diagram provided for embodiments of this application. For example... Figure 6 As shown, Image 1 is any frame image in an HDR video. After the electronic device obtains the chromaticity value of pixel unit 1 in Image 1, it can map the chromaticity value to the chromaticity map.
[0075] It should be understood that one point in a chromaticity diagram corresponds to one chromaticity value. In some embodiments, the chromaticity value is also referred to as a color value.
[0076] In one possible scenario, the chromaticity value of pixel unit 1 is mapped outside the area of triangle ABC, for example... Figure 6Point E in the diagram. The color gamut corresponding to the region △ABC is BT.709 (small color gamut), and the color gamut corresponding to the region △A'B'C' is BT.2020 (large color gamut). In this case, the electronic device needs to convert the chromaticity value of pixel unit 1. Based on a preset chromaticity conversion algorithm, the electronic device can map point E to point G, where point G is on the boundary of the region △ABC. The electronic device uses the chromaticity value corresponding to point G as the chromaticity value of pixel unit 1 after chromaticity conversion.
[0077] In another possible scenario, the chromaticity value of pixel unit 1 is mapped to the region of triangle ABC and within it, for example... Figure 6 Point I in the diagram. In this case, the electronic device may not need to convert the chromaticity value of pixel unit 1.
[0078] The electronic device can traverse every pixel unit in image 1 in the above manner to complete the color conversion of image 1.
[0079] In the example above, the chroma conversion algorithm directly performs hard clipping on the coordinates of the chroma values located outside the small color gamut but within the large color gamut (including the boundary of the large color gamut), mapping these coordinates to the boundary of the small color gamut. For example... Figure 6 In the process, multiple points, including D, E, F, and G, are mapped to point H on the boundary of a small color gamut. This means that multiple chromaticity values correspond to a single chromaticity value during the chromaticity conversion. Since multiple chromaticity values are mapped to a single chromaticity value, this will affect the color rendering effect of the converted image 1. The image chromaticity conversion accuracy is low, which in turn leads to poor quality of the converted SDR video.
[0080] It should be noted that hard clip processing is a matrix operation process that uses a preset matrix to calculate points mapped to the boundary of a small color gamut. This matrix can be a 3×3 matrix.
[0081] Furthermore, when an electronic device converts an HDR video to an SDR video based on the chroma conversion algorithm described in the example above, and then converts the SDR video back to an HDR video (corresponding to scenario two above), the electronic device cannot determine which chroma value outside the small color gamut should be mapped to for the chroma values at the small color gamut boundary. For example, to restore the original HDR video, Figure 6 The chromaticity value at point H should be mapped to the chromaticity value at point E. However, because the chromaticity conversion algorithm is irreversible, when converting SDR video back to HDR video, electronic devices may map point H to... Figure 6 Other points in the image, such as the G point. The above process causes electronic devices to be unable to reproduce the chromaticity information of the image in the original HDR video.
[0082] To address the aforementioned issues, this application proposes a video conversion method. During the conversion of HDR video to SDR video, if a pixel unit in a frame of the HDR video requires chroma conversion, the electronic device does not perform hard clipping. Instead, based on a new chroma conversion algorithm, it maps chroma values outside the small color gamut to within the small color gamut, rather than mapping them to the boundary of the small color gamut. It can be understood that, based on this new chroma conversion algorithm, two adjacent chroma values outside the small color gamut can be mapped to different chroma values within the small color gamut, thereby preserving the chroma details of the original HDR video image.
[0083] Furthermore, the aforementioned new chroma conversion algorithm is a reversible algorithm. When an electronic device converts an HDR video to an SDR video and then converts the SDR video back to an HDR video, the electronic device can use the reverse process of the new chroma conversion algorithm to map the chroma values within the small color gamut back to the chroma values outside the small color gamut, thereby restoring the original HDR video and preserving the chroma details of the image in the original HDR video.
[0084] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0085] Figure 7 The flow chart of the video conversion method provided in the embodiments of this application Figure 1 .like Figure 7 As shown, this video conversion method can be applied to any electronic device, such as a mobile phone, and the method may include:
[0086] S701. In response to the operation of converting HDR video to SDR video, the electronic device acquires the first chromaticity value of the first pixel unit of the first image in the HDR video.
[0087] The HDR video acquired by the electronic device includes a series of consecutive frames, where the first image is any frame in the series of frames, and the first pixel unit is any pixel unit in the first image. The first chromaticity value of the first pixel unit is the original chromaticity value of the first pixel unit in the HDR video, and the first chromaticity value is any chromaticity value within the HDR color gamut.
[0088] For example, Figure 8 This is a schematic diagram of chromaticity conversion based on the CIE 1931 chromaticity diagram provided for embodiments of this application. For example... Figure 8As shown, similar to the CIE 1931 chromaticity diagram, the CIE 1976 chromaticity diagram also includes two triangular regions: region △ABC and region △A'B'C'. Region △ABC corresponds to the SDR color gamut, i.e., the BT.709 color gamut (small color gamut), and region △A'B'C' corresponds to the HDR color gamut, i.e., the BT.2020 color gamut (large color gamut). △ABC and △A'B'C' share a common center point O, which is the white point of the color gamut.
[0089] The first chromaticity value of the first pixel unit can correspond to a point within the HDR color gamut in the chromaticity diagram. For example, the first chromaticity value corresponds to... Figure 8 Points a, b, c, or d in the chromaticity diagram shown.
[0090] It should be noted that, compared to the CIE1931 chromaticity diagram, the CIE1976 chromaticity diagram shows a higher geometric similarity between △ABC corresponding to a smaller color gamut and △A'B'C' corresponding to a larger color gamut. Since subsequent chromaticity conversion is based on the geometric relationship of the triangular regions corresponding to the color gamut, this embodiment uses the CIE1976 chromaticity diagram to represent the chromaticity values of pixel units in the image, which can improve the accuracy of chromaticity conversion.
[0091] S702. The electronic device determines the location of the first chromaticity value in the region of the chromaticity diagram.
[0092] In some embodiments, if the electronic device determines that the first chromaticity value is within a first region of the chromaticity map, it performs the following:
[0093] For example, refer to Figure 8 The first region can be the region in △A'B'C' of the chromaticity diagram other than △DEF.
[0094] S703. The electronic device performs a chromaticity conversion on the first chromaticity value based on the chromaticity diagram to obtain the second chromaticity value.
[0095] The second chromaticity value is located in the third region of the chromaticity diagram. For example, the third region can be any region in △ABC of the chromaticity diagram, excluding △DEF. The second chromaticity value is the chromaticity value of the first pixel unit in the SDR video. The electronic device converts the first chromaticity value from the first region of the chromaticity diagram to the third region, thus converting chromaticity values from a large color gamut to a smaller color gamut. The chromaticity conversion process is explained in detail below with a specific example.
[0096] For example, if the first chromaticity value of the first pixel unit is Figure 8Since point b is located outside the △DEF region but within the △A'B'C' region, the electronic device performs a chromaticity conversion on the chromaticity value corresponding to point b, mapping it to point b' within the △ABC region. Point b' lies on the line connecting point Ob. Based on the position of point b' on the chromaticity map, the electronic device obtains the chromaticity value corresponding to point b', which is the second chromaticity value of the first pixel unit. This process enables the mapping of chromaticity values from a large color gamut to a smaller color gamut.
[0097] Based on the above example, the electronic device can determine the chromaticity value corresponding to point b' by following these steps.
[0098] Step 11. The electronic device obtains the line connecting point b and white point O on the chromaticity map, and determines the two intersection points of the line with the boundary of the SDR color gamut and the boundary of the HDR color gamut, respectively, and records them as point a and point c.
[0099] Step 12. The electronic device acquires the distance value x1 between point b and white point O, the distance value dis(Oa) between point a and white point O, and the distance value dis(Oc) between point c and white point O on the chromaticity map.
[0100] Step 13. The electronic device determines the distance value y1 between point b' and white point O based on the distance value x1 between point b and white point O, the distance value dis(Oa) between point a and white point O, and the distance value dis(Oc) between point c and white point O. For example, the electronic device can determine the distance value y1 between point b' and white point O using the following formula:
[0101] y1=f(x1)=βx1 / (α+β)+(α-α*β) / (α+β)
[0102] In the formula, α = dis(Oc) / dis(Oa) – 1, and β is a constant, for example, β is 0.2.
[0103] It should be noted that the electronic device can also determine the distance y1 between point b' and white point O using other formulas. That is, this embodiment does not impose any restrictions on y = f(x), as long as y = f(x) satisfies monotonicity and invertibility, and f(1-β) = 1-β, f(1+α) = 1. For a detailed explanation of y = f(x), please refer to the following text. Figure 9 The illustrated embodiment.
[0104] Step 14. The electronic device determines the chromaticity value corresponding to point b' based on the distance value y1 between point b' and white point O.
[0105] Point b' lies on the line connecting point O and point B. Based on the distance y1 between point b' and the white point O, the electronic device can determine the position of point b' on the chromaticity diagram, and thus determine the chromaticity value corresponding to point b'.
[0106] It should be understood that if the first chromaticity value of the first pixel unit is... Figure 8 For any point on the midline segment dc, the electronic device can determine the corresponding mapping point based on steps 11 to 14 above, thereby determining the chromaticity value of the mapping point.
[0107] Through steps 11 to 14 above, the electronic device can map the chromaticity values in the chromaticity range corresponding to line segment dc to the chromaticity range corresponding to line segment da according to a certain ratio. This can be regarded as converting the chromaticity values in a large color gamut to a small color gamut, thereby preserving the chromaticity information in the large color gamut of the image in the HDR video in the converted SDR video, which can improve the image quality of the SDR video.
[0108] In some embodiments, if the electronic device determines that the first chromaticity value is within a second region of the chromaticity map (including the boundary of the second region), it performs the following:
[0109] S704. The electronic device uses the first chromaticity value as the chromaticity value of the first pixel unit of the first image in the SDR video.
[0110] For example, refer to Figure 8 The second region can be the region △DEF in the chromaticity diagram. This step can be seen as the electronic device not performing chromaticity conversion on the first chromaticity value of the first pixel unit, and the first chromaticity value of the first pixel unit remains unchanged.
[0111] For example, if the first chromaticity value of the first pixel unit is Figure 8 Since point e is located within the △DEF region, the electronic device does not perform chromaticity conversion on the chromaticity value corresponding to point e. That is, the chromaticity value of the first pixel unit in the SDR video remains the same as the chromaticity value corresponding to point e. In this example, it can also be considered that the electronic device maps point e in the chromaticity diagram to point e', with point e' coinciding with point e. If the distance between point e and point O is denoted as x, and the distance between point e' and point O is denoted as y, then y = x.
[0112] Based on the examples of the above embodiments, Figure 9 This diagram illustrates the functional relationship of mapping chromaticity points to a chromaticity diagram using an electronic device. A chromaticity point is the point on the chromaticity diagram corresponding to a given chromaticity value. Figure 9 In the diagram, the horizontal axis x indicates the normalized large color gamut, denoted by [0,1+α], and the vertical axis y indicates the normalized small color gamut, denoted by [0,1]. Figure 9 Line segment 1 in the diagram can be represented as y = x, x ∈ [1, 1-β], indicating the color gamut (the second region, i.e., the corresponding region). Figure 8 Within the △DEF region, the chromaticity point coincides with the mapping point, meaning the chromaticity value remains unchanged. Figure 9Line segment 2 in the equation can be represented as y = f(x), x ∈ (1-β, 1+α], indicating the color gamut (first region, i.e., the corresponding region). Figure 8 Within the region (outside △DEF, but inside △A'B'C'), chromaticity points can be mapped based on y = f(x). For example, Figure 9 In the middle, x = 1 can correspond to Figure 8 Point a in; Figure 9 In the middle x = 1 - β, it can correspond to Figure 8 In the diagram, point d, f(1-β)=1-β indicates that point d coincides with the mapped point d', meaning that the chromaticity value of point d remains unchanged; Figure 9 x = 1 + α in the equation can correspond to Figure 8 In the equation, point c, f(1+α)=1 indicates that the mapping point of point c is point d, that is, the chromaticity value of point c is converted to the chromaticity value of point d.
[0113] Based on S701 to S704 described above, the electronic device can perform chroma conversion on the chroma value of each pixel unit in each frame of the HDR video, or not perform chroma conversion, thereby obtaining the chroma information of each frame of the converted SDR video. Since the chroma conversion does not convert chroma values within a large color gamut to the boundary of a small color gamut, but rather converts chroma values within a large color gamut to the small color gamut according to a certain proportional relationship, it can, to a certain extent, convert the chroma information within the large color gamut of the HDR video image to the small color gamut, thus improving the image quality of the converted SDR video.
[0114] Figure 10 The flow chart of the video conversion method provided in the embodiments of this application Figure 2 .like Figure 10 As shown, this video conversion method can be applied to any electronic device, such as a mobile phone, and the method may include:
[0115] S1001. In response to the operation of converting SDR video to HDR video, the electronic device acquires the third chromaticity value of the second pixel unit of the second image in the SDR video.
[0116] The SDR video acquired by the electronic device includes a series of consecutive frames, the second image is any frame in the series of frames, and the second pixel unit is any pixel unit in the second image. The third chromaticity value of the second pixel unit is the original chromaticity value of the second pixel unit in the SDR video, and the third chromaticity value is any chromaticity value within the SDR color gamut.
[0117] The third chromaticity value of the second pixel unit can correspond to a certain point in the SDR color gamut of the chromaticity diagram. For example, the third chromaticity value corresponds to... Figure 8 Point f in the chromaticity diagram shown is within the SDR color gamut.
[0118] S1002. Electronic device determines the regional location of the third chromaticity value in the chromaticity diagram.
[0119] In some embodiments, if the electronic device determines that the third chromaticity value is within a third region of the chromaticity diagram, it performs the following:
[0120] S1003. The electronic device performs chromaticity conversion on the third chromaticity value based on the chromaticity diagram to obtain the fourth chromaticity value.
[0121] The fourth chromaticity value is located in the first region of the chromaticity map. This fourth chromaticity value is the chromaticity value of the second pixel unit in HDR video. Electronic devices convert the third chromaticity value from the third region of the chromaticity map to the first region, thus converting chromaticity values from a smaller color gamut to a larger color gamut. The chromaticity conversion process is explained in detail below with a specific example.
[0122] For example, if the third chromaticity value of the second pixel unit is Figure 8 Since point f is located outside the △DEF region but inside the △ABC region (i.e., within the third region of the chromaticity diagram), the electronic device determines to perform a chromaticity conversion on the chromaticity value corresponding to point f, mapping point f to point f', which is outside the △ABC region but inside the △A'B'C' region, and point f' lies on the extension of the Of line. Based on the position of point f' on the chromaticity diagram, the electronic device can obtain the chromaticity value corresponding to point f', which is denoted as the fourth chromaticity value of the second pixel unit. The above process can map chromaticity values within a small color gamut to a large color gamut.
[0123] Based on the above example, the electronic device can determine the chromaticity value corresponding to point f' by following these steps.
[0124] Step 21. The electronic device obtains the line connecting point f and white point O on the chromaticity map, and determines the two intersection points of the line with the boundary of the SDR color gamut and the boundary of the HDR color gamut, respectively, and records them as point g and point h.
[0125] Step 22. The electronic device acquires the distance value x2 between point f and white point O, the distance value dis(Og) between point g and white point O, and the distance value dis(Oh) between point h and white point O on the chromaticity map.
[0126] Step 23. The electronic device determines the distance value y2 between point f' and white point O based on the distance value x2 between point f and white point O, the distance value dis(Og) between point g and white point O, and the distance value dis(Oh) between point h and white point O. For example, the electronic device determines the distance value y2 between point f' and white point O using the following formula:
[0127] x2=f(y2)=βy2 / (α+β)+(α-α*β) / (α+β)
[0128] In the formula, α = dis(Oh) / dis(Og) – 1, and β is a constant, for example, β is 0.2.
[0129] The above formula can also be expressed as x = f -1 (y) can be viewed as the inverse function (or inverse function) of the aforementioned y = f(x). The electronic device can determine the distance y2 between point f' and white point O by using the inverse function of y = f(x).
[0130] Step 24. The electronic device determines the chromaticity value corresponding to point f' based on the distance value y2 between point f' and white point O.
[0131] Point f' lies on the extension of Of. Based on the distance y2 between point f' and white point O, the electronic device can determine the position of point f' on the chromaticity diagram, and thus determine the chromaticity value corresponding to point f'.
[0132] It should be understood that if the third chromaticity value of the second pixel unit is... Figure 8 Based on steps 21 to 24 above, the electronic device can determine the chromaticity value corresponding to any point on the midline segment ig.
[0133] Through steps 21 to 24 above, the electronic device can map the chromaticity values in the chromaticity range corresponding to line segment ig to the chromaticity range corresponding to line segment ih according to a certain ratio. This can be regarded as converting the chromaticity values in a small color gamut to a large color gamut, which can improve the picture quality of the converted HDR video.
[0134] In some embodiments, if the electronic device determines that the third chromaticity value is within a second region of the chromaticity map (including the boundary of the second region), it performs the following:
[0135] S1004. The electronic device uses the third chromaticity value as the chromaticity value of the second pixel unit of the second image in the HDR video.
[0136] This step can be viewed as the electronic device not performing chromaticity conversion on the third chromaticity value of the second pixel unit, and the third chromaticity value of the second pixel unit remains unchanged.
[0137] Based on the above steps S1001 to S1004, the electronic device can perform chroma conversion on the chroma value of each pixel unit in each frame of the SDR video, or not perform chroma conversion, thereby obtaining the chroma information of each frame of the converted HDR video. The aforementioned chroma conversion transforms a portion of the chroma values within a small color gamut to a larger color gamut according to a certain ratio, which can improve the image quality of the converted HDR video. This processing can be applied to video stitching as a pre-process for stitching multiple video segments of different types.
[0138] Figure 7The color conversion in the illustrated embodiment is from a large color gamut to a small color gamut, that is, from the BT.2020 color gamut to the BT.709 color gamut. Figure 10 The chromaticity conversion of the embodiment shown can be regarded as Figure 7 The reverse process of the illustrated embodiment, i.e. Figure 10 The chromaticity conversion in the illustrated embodiment is a conversion from a smaller color gamut to a larger color gamut, specifically from the BT.709 color gamut to the BT.2020 color gamut. Based on Figure 7 The illustrated embodiment enables the conversion of SDR video to HDR video. After converting the SDR video to HDR video, based on... Figure 10 The illustrated embodiment enables the restoration of HDR video to its original SDR video, meaning the video conversion process is reversible.
[0139] The video conversion method proposed in this application can be applied to any electronic device with video processing capabilities. This electronic device can also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The electronic device can be a mobile phone with a touchscreen, a smart TV, a wearable device, a tablet computer, a computer with wireless transceiver capabilities, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, etc. This application does not limit the specific technology or form of the electronic device used.
[0140] For example, Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 11As shown, the electronic device 100 includes: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, a sensor 180, a button 190, a camera 193, and a display screen 194.
[0141] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100. In some embodiments, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0142] It is understood that the interface connection relationships between the modules illustrated in the embodiments are merely illustrative and do not constitute a structural limitation on the electronic device 100. In some embodiments, the electronic device 100 may also employ different interface connection methods or a combination of multiple interface connection methods as described in the above embodiments.
[0143] Processor 110 may include one or more processing units. These processing units may be independent devices or integrated within one or more processors. Processor 110 may also include memory for storing instructions and data. In this embodiment, processor 110 may be used to invoke a computer program stored in memory, causing an electronic device to execute the steps of the method embodiments described below, thereby achieving conversion between different types of video, such as converting HDR video to SDR video, or vice versa.
[0144] USB port 130 is an interface that conforms to the USB standard specification, specifically it can be a Mini USB interface, Micro USB interface, USB Type C interface, etc. USB port 130 can be used to connect a charger to charge terminal devices, to transfer data between terminal devices and peripheral devices, or to connect headphones for audio playback.
[0145] The charging management module 140 is used to receive charging input from the charger. The power management module 141 is used to connect the battery 142, and the charging management module 140 is connected to the processor 110.
[0146] The wireless communication function of electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. Mobile communication module 150 can provide wireless communication solutions for electronic device 100, including 2G / 3G / 4G / 5G. Wireless communication module 160 can provide wireless communication solutions for electronic device 100, including wireless local area networks (WLAN), Bluetooth, global navigation satellite system (GNSS), frequency modulation (FM), NFC, and infrared (IR) technology.
[0147] Electronic device 100 can realize display functions through GPU, display screen 194, and application processor. GPU is a microprocessor for image processing, connected to display screen 194 and application processor. GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute instructions to generate or modify display information.
[0148] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0149] Electronic device 100 may implement its shooting function through an image signal processing (ISP) module, one or more cameras 193, a video codec, a GPU, one or more displays 194, and an application processor. Camera 193 is used to capture still images or videos. In some embodiments, electronic device 100 may include one or more cameras 193.
[0150] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, data files such as music, photos, and videos can be stored on the external memory card.
[0151] The internal memory 121 can be used to store one or more computer programs, which include instructions. The processor 110 can execute the aforementioned instructions stored in the internal memory 121, thereby enabling the electronic device 100 to perform various functional applications and data processing, etc.
[0152] The sensor 180 may include one or more of the following, such as: pressure sensor, gyroscope sensor, barometric pressure sensor, magnetic sensor, accelerometer, distance sensor, proximity sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor, or bone conduction sensor, etc.
[0153] In addition to the aforementioned components, electronic devices also run an operating system. Examples include iOS, Android, or Windows. Applications can be installed and run on this operating system.
[0154] The software system of an electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application uses the Android system as an example of a layered architecture software system to illustrate the software structure of an electronic device. Figure 12 This is a software architecture diagram of an electronic device provided in an embodiment of this application. The layered architecture divides the software system of the electronic device into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. (Refer to...) Figure 12 Electronic devices include: applications, application framework, Android runtime and system libraries, and kernel.
[0155] The application layer may include gallery applications and video editing applications. Gallery applications store various images and videos taken or downloaded by the user, including HDR and SDR videos. Video editing applications provide functions such as importing and exporting videos, video conversion, effects and filters, audio editing, subtitles and titles, transitions, and video sharing. In some embodiments, the application layer may also include applications such as camera, calendar, call, map, navigation, Bluetooth, and music.
[0156] In this embodiment of the application, the gallery application can convert HDR videos in the gallery application to SDR videos, or vice versa, by calling the video conversion and other functions provided by the video editing application.
[0157] The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications within the application layer. In this embodiment, the application framework layer may include a video processing service, which can call the chroma conversion module of the system library to perform chroma conversion on the video image according to instructions issued by the video editing application.
[0158] The Android runtime is responsible for scheduling and managing the Android system. System libraries may include multiple functional modules, such as a chroma conversion module. In this embodiment, the chroma conversion module has a pre-built chroma conversion algorithm, which involves functions related to chroma conversion, such as y = f(x) and x = f in the aforementioned embodiment. -1 (y) etc., the color conversion module can perform color conversion on the color values of pixel units in the image based on the color conversion algorithm.
[0159] For example, in response to video editing operations, such as Figure 3 As shown in Figure a, in response to an operation on the "Edit" control on interface 104, the gallery application can send a message to the video editing application. This message may include video data to be edited, such as HDR video. Upon receiving the message, the video editing application imports the video data. In response to video conversion operations, such as... Figure 4 As shown in Figure b, in response to operation 1 (converting to "normal video") applied to selection control 2043 and operation 2 (converting to export control 2044), the video editing application can send a video conversion instruction to the video processing service in the application framework layer. This video conversion instruction instructs the conversion of HDR video to SDR video. Upon receiving the video conversion instruction, the video processing service can send it to the chroma conversion module. Based on this instruction, the chroma conversion module performs the aforementioned... Figure 7 The steps of the illustrated embodiment convert HDR video into SDR video.
[0160] The above example illustrates the internal process of an electronic device converting HDR video to SDR video. This process is merely an example and does not constitute a limitation on the methods by which electronic devices perform video conversion.
[0161] The internal process by which electronic devices convert SDR video to HDR video can be seen in the example above, and will not be elaborated here.
[0162] The kernel layer is the layer between hardware and software. The kernel layer includes components such as display drivers, sensor drivers, camera drivers, and audio drivers; however, this application does not impose any limitations on these components.
[0163] Understandable, Figure 12 The modules included in each layer shown are those involved in the embodiments of this application. The modules included in each layer do not constitute a limitation on the structure of the electronic device and the hierarchy of module deployment. In some embodiments, the electronic device may include more or fewer layers than shown, and each layer may include more or fewer components; this application does not impose any limitations.
[0164] It should be noted that in the above embodiments, a "module" can be a software program, a hardware circuit, or a combination of both to implement the above functions. The hardware circuit may include an application-specific integrated circuit (ASIC), electronic circuits, a processor (e.g., a shared processor, a proprietary processor, or a group processor, etc.) and memory for executing one or more software or firmware programs, integrated logic circuits, and / or other suitable components that support the described functions.
[0165] Therefore, the modules of the various examples described in the embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0166] Based on the foregoing embodiments, this application provides a video conversion method applicable to any electronic device with video processing capabilities. The method includes: in response to an operation of converting a high dynamic range (HDR) video to a standard dynamic range (SDR) video, the electronic device acquires a first chromaticity value of a first pixel unit in a first image of the HDR video, wherein the first image is any frame image in the HDR video, and the first pixel unit is any pixel unit in the first image; the electronic device determines the regional position of the first chromaticity value in a chromaticity map; if the electronic device determines that the first chromaticity value is within a first region of the chromaticity map, the electronic device performs chromaticity conversion on the first chromaticity value to obtain a second chromaticity value of the first pixel unit in the first image of the SDR video; the distance between the second chromaticity value and the white point of the chromaticity map is less than the distance between the first chromaticity value and the white point.
[0167] For example, refer to Figure 8 The first region of the chroma diagram refers to the area within the HDR color gamut excluding the △DEF region, specifically the area within △A'B'C' excluding △DEF. Compared to the △DEF region, the first region can be considered a larger color gamut. The first chroma value corresponds to... Figure 8 Since point b is outside the △ABC region within the HDR color gamut (i.e., point b is in the first region), electronic devices can map point b to point b' based on a preset chromaticity conversion algorithm, and the second chromaticity value can correspond to... Figure 8 The middle point is b'. The white dot is... Figure 8 In the diagram, the distance between point O and the white point for the second chromaticity value corresponds to the distance between point b' and point O, and the distance between point b' and the white point for the first chromaticity value corresponds to the distance between point b and point O. The distance between point b' and point O is less than the distance between point b and point O. Compared to point b, point b' is closer to the white point.
[0168] In the above embodiments, if the electronic device determines that the chromaticity value (such as the first chromaticity value mentioned above) of a certain pixel unit in a certain frame of an HDR video is located in the first region of the chromaticity map, the electronic device performs chromaticity conversion on the chromaticity value of the pixel unit so that the converted chromaticity value (such as the second chromaticity value mentioned above) falls within the SDR color gamut of the chromaticity map, rather than falling on the boundary of the SDR color gamut. This converts the chromaticity information in the large color gamut of the image in the HDR video to a small color gamut to a certain extent, thereby improving the image quality of the converted SDR video.
[0169] In one optional embodiment, the electronic device performs chromaticity conversion on the first chromaticity value to obtain the second chromaticity value of the first pixel unit of the first image in the SDR video, including: the electronic device acquiring a first line connecting a first coordinate point and a white point, determining a first intersection point between the first line and the SDR color gamut boundary in the chromaticity diagram, and a second intersection point between the first line and the HDR color gamut boundary in the chromaticity diagram; the first coordinate point is the coordinate point of the first chromaticity value on the chromaticity diagram; the electronic device acquiring a first distance value between the first coordinate point and the white point, a second distance value between the first intersection point and the white point, and a third distance value between the second intersection point and the white point; the electronic device determining a fourth distance value based on the first distance value, the second distance value, and the third distance value, the fourth distance value being the distance value between the second coordinate point and the white point, the second coordinate point being the coordinate point of the second chromaticity value on the chromaticity diagram; and the electronic device determining the second chromaticity value based on the fourth distance value.
[0170] For example, refer to Figure 8 Let point b be the first coordinate point, point b' be the second coordinate point, and the first connecting line be Ob. The SDR color gamut boundary is the boundary of triangle ABC, and the HDR color gamut boundary is the boundary of triangle A'B'C'. The first intersection point is point a, and the second intersection point is point c. The first distance value is the distance between point b and point O, which can be denoted as x1. The second distance value is the distance between point a and point O, which can be denoted as dis(Oa). The third distance value is the distance between point c and point O, which can be denoted as dis(Oc). The fourth distance value is the distance between point b' and point O, which can be denoted as y1. In one example, the electronic device can determine the fourth distance value y1 using the following formula.
[0171] y1=f(x1)=βx1 / (α+β)+(α-α*β) / (α+β)
[0172] In the formula, α = dis(Oc) / dis(Oa) – 1, and β is a constant, for example, β is 0.2.
[0173] The above embodiments illustrate how, based on the position of the first chromaticity value in the chromaticity diagram, a geometric operation is used to determine how to convert the first chromaticity value to a second chromaticity value. In this way, chromaticity values in a large color gamut can be mapped to the SDR color gamut at a certain ratio, thereby converting the chromaticity information of the image in the large color gamut of the HDR video to the small color gamut.
[0174] In an optional embodiment, the method further includes: if the electronic device determines that the first chromaticity value is within a second region of the chromaticity map, the electronic device uses the first chromaticity value as the chromaticity value of a first pixel unit of the first image in the SDR video.
[0175] For example, refer to Figure 8 The second region of the chroma map refers to the △DEF region within the HDR color gamut. Compared to the first region mentioned above, the second region can be considered as a smaller color gamut.
[0176] In the above embodiments, if the electronic device determines that the chromaticity value (such as the first chromaticity value mentioned above) of a certain pixel unit in a certain frame of an HDR video is located in the second region of the chromaticity map, the electronic device may not perform chromaticity conversion on the chromaticity value of the pixel unit, that is, keep the chromaticity value of the pixel unit unchanged.
[0177] In an optional embodiment, the method further includes: in response to the operation of converting SDR video to HDR video, the electronic device acquires a third chromaticity value of a second pixel unit of a second image in the SDR video, wherein the second image is any frame image in the SDR video and the second pixel unit is any pixel unit in the second image; the electronic device determines the regional position of the third chromaticity value in a chromaticity diagram; if the electronic device determines that the third chromaticity value is within a third region of the chromaticity diagram, the electronic device performs chromaticity conversion on the third chromaticity value to obtain a fourth chromaticity value of the second pixel unit of the second image in the HDR video; the distance between the fourth chromaticity value and the white point of the chromaticity diagram is greater than the distance between the third chromaticity value and the white point.
[0178] For example, refer to Figure 8 The third region of the chromaticity diagram refers to the area within the SDR color gamut excluding the △DEF region, that is, the area in △ABC excluding △DEF. The third chromaticity value can correspond to... Figure 8 Since point f is outside the △DEF region within the SDR color gamut (i.e., in the third region), electronic devices can map point f to point f' based on a preset chromaticity conversion algorithm, and the fourth chromaticity value can then correspond to... Figure 8 The distance between the fourth chromaticity value and the white point corresponds to the distance between the f' point and the O point, and the distance between the third chromaticity value and the white point corresponds to the distance between the f point and the O point. The distance between the f' point and the O point is greater than the distance between the f point and the O point. Compared to the f point, the f' point is farther away from the white point.
[0179] In the above embodiments, if the electronic device determines that the chromaticity value (such as the third chromaticity value mentioned above) of a certain pixel unit in a certain frame of an SDR video is located in the third region of the chromaticity map, the electronic device performs chromaticity conversion on the chromaticity value of the pixel unit so that the converted chromaticity value (such as the fourth chromaticity value mentioned above) falls outside the SDR color gamut of the chromaticity map, that is, converting the chromaticity value in the small color gamut to the large color gamut, which can improve the picture quality of the converted HDR video.
[0180] In one optional embodiment, the electronic device performs chromaticity conversion on the third chromaticity value to obtain the fourth chromaticity value of the second pixel unit of the second image in the HDR video, including: the electronic device acquiring a second line connecting the third coordinate point and the white point, determining a third intersection point between the second line and the SDR color gamut boundary in the chromaticity diagram, and a fourth intersection point between the second line and the HDR color gamut boundary in the chromaticity diagram; the third coordinate point is the coordinate point of the third chromaticity value on the chromaticity diagram; the electronic device acquiring a fifth distance value between the third coordinate point and the white point, a sixth distance value between the third intersection point and the white point, and a seventh distance value between the fourth intersection point and the white point; the electronic device determining an eighth distance value based on the fifth distance value, the sixth distance value, and the seventh distance value, the eighth distance value being the distance value between the fourth coordinate point and the white point, the fourth coordinate point being the coordinate point of the fourth chromaticity value on the chromaticity diagram; and the electronic device determining the fourth chromaticity value based on the eighth distance value.
[0181] For example, refer to Figure 8 The third coordinate point can be point f, the fourth coordinate point can be point f', the second connection is Of, the SDR color gamut boundary is the boundary of △ABC, the HDR color gamut boundary is the boundary of △A'B'C', the third intersection point is point g, and the fourth intersection point is point h. The fifth distance value is the distance between point f and point O, x2; the sixth distance value is the distance between point g and point O, which can be denoted as dis(Og); the seventh distance value is the distance between point h and point O, which can be denoted as dis(Oh); and the eighth distance value is the distance between point f' and point O, y2. In one example, the electronic device determines the distance y2 between point f' and the white point O using the following formula:
[0182] x2=f(y2)=βy2 / (α+β)+(α-α*β) / (α+β)
[0183] In the formula, α = dis(Oh) / dis(Og) – 1, and β is a constant, for example, β is 0.2.
[0184] The above embodiment shows that based on the position of the third chromaticity value in the chromaticity diagram, a formula for geometric operation is used to determine how to convert the third chromaticity value to the fourth chromaticity value. In this way, chromaticity values within a small color gamut can be mapped to outside the SDR color gamut according to a certain ratio, which can improve the picture quality of the converted HDR video.
[0185] In an optional embodiment, the method further includes: the electronic device determining that the third chromaticity value is within a second region of the chromaticity map, and the electronic device using the third chromaticity value as the chromaticity value of a second pixel unit of the second image in the HDR video.
[0186] In the above embodiments, if the electronic device determines that the chromaticity value (such as the third chromaticity value mentioned above) of a certain pixel unit in a certain frame of an SDR video is located in the second region of the chromaticity map, the electronic device may not perform chromaticity conversion on the chromaticity value of the pixel unit, that is, keep the chromaticity value of the pixel unit unchanged.
[0187] In an optional embodiment, the chromaticity diagram is the CIE1976 chromaticity diagram.
[0188] This application also provides an electronic device, which includes one or more processors and a memory. The memory is coupled to one or more processors and is used to store computer program code. The computer program code includes computer instructions. One or more processors call the computer instructions to cause the electronic device to perform the steps as described in the foregoing method embodiments. The implementation principle and technical effects are similar to those of the foregoing related embodiments, and will not be repeated here.
[0189] This application also provides a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform the steps as described in the foregoing method embodiments. The implementation principle and technical effects are similar to those of the foregoing related embodiments, and will not be repeated here.
[0190] This application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the steps as described in the foregoing method embodiments. The implementation principle and technical effects are similar to those of the foregoing related embodiments, and will not be repeated here.
[0191] This application also provides a computer program product, which includes computer program code. When the computer program code is run on an electronic device, the electronic device performs the steps as described in the foregoing method embodiments. Its implementation principle and technical effects are similar to those of the foregoing related embodiments, and will not be repeated here.
[0192] The methods described in the above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted on a computer-readable medium. A computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. A storage medium can be any target medium accessible by a computer.
[0193] In some embodiments, a computer-readable medium may include RAM, ROM, compact discread-only memory (CD-ROM) or other optical disc storage, disk storage or other magnetic storage device, or any other medium targeted to carry or to store required program code in the form of instructions or data structures, and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disks and optical discs include optical discs, laser discs, optical discs, Digital Versatile Discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0194] This application describes embodiments of methods, apparatus (systems), and computer program products according to embodiments of this application with reference to flowchart illustrations and / or block diagrams. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0195] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0196] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.
Claims
1. A video conversion method, characterized in that, include: In response to the operation of converting a high dynamic range (HDR) video into a standard dynamic range (SDR) video, the electronic device acquires a first chromaticity value of a first pixel unit in a first image of the HDR video, wherein the first image is any frame image in the HDR video, and the first pixel unit is any pixel unit in the first image. The electronic device determines the regional position of the first chromaticity value in the chromaticity map; The chromaticity diagram includes: HDR color gamut, SDR color gamut and second region, the second region being the common color gamut of the HDR color gamut and the SDR color gamut, and the second region being smaller than the SDR color gamut; If the electronic device determines that the first chromaticity value is within a first region of the chromaticity map, the electronic device performs chromaticity conversion on the first chromaticity value to obtain a second chromaticity value of the first pixel unit of the first image in the SDR video; the first region is the region in the HDR color gamut other than the second region, the second chromaticity value is located in a third region of the chromaticity map, the third region is the region in the SDR color gamut other than the second region; the distance between the second chromaticity value and the white point of the chromaticity map is less than the distance between the first chromaticity value and the white point.
2. The method according to claim 1, characterized in that, The electronic device performs chromaticity conversion on the first chromaticity value to obtain a second chromaticity value for the first pixel unit of the first image in the SDR video, including: The electronic device acquires a first line connecting the first coordinate point and the white point, determines a first intersection point of the first line with the SDR color gamut boundary in the chromaticity diagram, and a second intersection point of the first line with the HDR color gamut boundary in the chromaticity diagram; the first coordinate point is the coordinate point of the first chromaticity value on the chromaticity diagram; The electronic device acquires a first distance value between the first coordinate point and the white point, a second distance value between the first intersection point and the white point, and a third distance value between the second intersection point and the white point. The electronic device determines a fourth distance value based on the first distance value, the second distance value, and the third distance value. The fourth distance value is the distance between the second coordinate point and the white point. The second coordinate point is the coordinate point of the second chromaticity value on the chromaticity diagram. The electronic device determines the second chromaticity value based on the fourth distance value.
3. The method according to claim 1 or 2, characterized in that, The method further includes: If the electronic device determines that the first chromaticity value is within the second region of the chromaticity map, the electronic device uses the first chromaticity value as the chromaticity value of the first pixel unit of the first image in the SDR video.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: In response to the operation of converting the SDR video to the HDR video, the electronic device acquires the third chromaticity value of a second pixel unit in a second image of the SDR video, wherein the second image is any frame image in the SDR video, and the second pixel unit is any pixel unit in the second image; The electronic device determines the regional location of the third chromaticity value in the chromaticity diagram; If the electronic device determines that the third chromaticity value is within the third region of the chromaticity diagram, the electronic device performs chromaticity conversion on the third chromaticity value to obtain the fourth chromaticity value of the second pixel unit of the second image in the HDR video; the distance between the fourth chromaticity value and the white point of the chromaticity diagram is greater than the distance between the third chromaticity value and the white point.
5. The method according to claim 4, characterized in that, The electronic device performs chromaticity conversion on the third chromaticity value to obtain a fourth chromaticity value for the second pixel unit of the second image in the HDR video, including: The electronic device acquires a second line connecting the third coordinate point and the white point, determines a third intersection point between the second line and the SDR color gamut boundary in the chromaticity diagram, and a fourth intersection point between the second line and the HDR color gamut boundary in the chromaticity diagram; the third coordinate point is the coordinate point of the third chromaticity value on the chromaticity diagram; The electronic device acquires the fifth distance value between the third coordinate point and the white point, the sixth distance value between the third intersection point and the white point, and the seventh distance value between the fourth intersection point and the white point, respectively. The electronic device determines an eighth distance value based on the fifth distance value, the sixth distance value, and the seventh distance value. The eighth distance value is the distance between the fourth coordinate point and the white point. The fourth coordinate point is the coordinate point of the fourth chromaticity value on the chromaticity diagram. The electronic device determines the fourth chromaticity value based on the eighth distance value.
6. The method according to claim 4 or 5, characterized in that, The method further includes: The electronic device determines the third chromaticity value within the second region of the chromaticity map, and uses the third chromaticity value as the chromaticity value of the second pixel unit of the second image in the HDR video.
7. The method according to any one of claims 1 to 6, characterized in that, The chromaticity diagram is the CIE1976 chromaticity diagram.
8. An electronic device, characterized in that, The electronic device includes: one or more processors and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 7.
9. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, The computer program product includes computer program code that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 7.