Photographic parameter adjustment method, electronic device, and storage medium

By generating smooth adjustment curves and using frame interpolation technology, the problems of image shake and stuttering when electronic devices change shooting parameters have been solved, thus improving the user experience.

WO2025119318A9PCT designated stage Publication Date: 2026-05-15HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2024-12-06
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

When users change shooting parameters, electronic devices may experience image shakiness or stuttering, resulting in a poor user experience.

Method used

By generating a smooth adjustment curve and calculating transition shooting parameters in real time, the shooting parameters are smoothly transitioned to the target parameters. Furthermore, by interpolating frames and adjusting the vertical synchronization signal period, uniform display of image frames is ensured, avoiding delayed response.

Benefits of technology

It achieves a smooth transition of shooting parameters, avoiding image shake and stuttering, and improving the user's visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024137354_15052026_PF_FP_ABST
    Figure CN2024137354_15052026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a photographic parameter adjustment method, an electronic device, and a storage medium. The method comprises: an electronic device receiving from a user a first operation regarding a camera application, and responding to same, so as to acquire a target photographic parameter; a photographic parameter generation module determining a first transitional photographic parameter on the basis of a frame return moment of a first image frame and the target photographic parameter; an image cropping module processing the first image frame on the basis of the first transitional photographic parameter and photographic parameters of the first image frame, so as to obtain a first transitional image frame, wherein photographic parameters of the first transitional image frame comprise the first transitional photographic parameter; and during a rendering process, rendering a first transitional image on the basis of a vertical synchronization signal cycle of the rendering process, and the electronic device displaying the rendered first transitional image in the camera application. The method ensures that a photographic parameter can smoothly transition to a target photographic parameter, and also enables the electronic device to quickly and uniformly display an image frame in response to a user operation for changing the photographic parameter, thereby avoiding the problem of a delayed response.
Need to check novelty before this filing date? Find Prior Art

Description

A method for adjusting shooting parameters, an electronic device, and a storage medium.

[0001] This application claims priority to Chinese Patent Application No. 202311692270.9, filed on December 8, 2023, entitled "A Method for Adjusting Shooting Parameters, Electronic Device and Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of terminal technology, and in particular to a method for adjusting shooting parameters, an electronic device, and a storage medium. Background Technology

[0003] With the development of technology, the shooting effects of electronic devices (such as digital cameras, or mobile phones, tablets, etc. with cameras) are getting better and better, and using electronic devices to take pictures has become a common choice for people.

[0004] When users take photos with electronic devices, they can adjust shooting parameters to achieve the desired effect. For example, users can adjust the shooting range through zoom, and they can also adjust shooting parameters such as exposure. Currently, when users change the camera's shooting parameters, the electronic device's response to the user's operation is sometimes delayed, resulting in image shake or stuttering, leading to a poor user experience. Summary of the Invention

[0005] This application provides a method for adjusting shooting parameters, an electronic device, and a storage medium, which ensures that the shooting parameters can be smoothly transitioned to the target shooting parameters, and enables the electronic device to quickly and uniformly display image frames in response to user operations that change the shooting parameters, without any delay in response.

[0006] In a first aspect, this application provides a method for generating shooting parameters, characterized in that the electronic device includes a shooting parameter generation module, an image cropping module, a display thread, and a rendering process. The method includes: the electronic device receiving and responding to a user's first operation on a camera application, and acquiring target shooting parameters, wherein the target shooting parameters are shooting parameters set by the first operation; the shooting parameter generation module determining first transition shooting parameters based on the return frame time of a first image frame and the target shooting parameters, wherein the first image frame is an image frame acquired by the electronic device after receiving the first operation; the image cropping module processing the first image frame according to the first transition shooting parameters and the shooting parameters of the first image frame to obtain a first transition image frame, wherein the shooting parameters of the first transition image frame include the first transition shooting parameters; the rendering process rendering the first transition image according to the vertical synchronization signal period of the rendering process; and the electronic device displaying the rendered first transition image within the camera application.

[0007] This method allows the electronic device to calculate one or more transitional shooting parameters in real time, enabling it to acquire and display image frames promptly according to these parameters. This ensures that changes in shooting parameters conform to a preset smooth adjustment curve, allowing for a smooth transition to the target shooting parameters and preventing image jitter or stuttering, thus improving the user's visual experience. Furthermore, by copying and cropping image frames, the electronic device can quickly display image frames in response to user actions that change shooting parameters, eliminating latency issues. Additionally, during parameter changes, the electronic device can control and modify the vsync signal period, linking the display timing of transitional image frames to the vsync signal period. This ensures uniform image frame display, further enhancing the user's visual experience.

[0008] In conjunction with the first aspect, in one possible implementation, the shooting parameter generation module determines the first transitional shooting parameters based on the return frame time of the first image frame and the target shooting parameters. Specifically, the shooting parameter generation module determines the first transitional shooting parameters based on the initial shooting parameters, the return frame time of the first image frame, and the target shooting parameters, wherein the initial shooting parameters are the shooting parameters set by the electronic device before receiving the first operation.

[0009] Using this method, electronic devices can calculate one or more transition shooting parameters in real time based on the return frame time of image frames, and smoothly switch from the initial shooting parameters to the target shooting parameters in sequence according to one or more transition shooting parameters, avoiding image shaking or stuttering during the switching of shooting parameters, thus improving the user's visual experience.

[0010] In conjunction with the first aspect, in one possible implementation, the shooting parameter generation module determines the first transitional shooting parameters based on the initial shooting parameters, the return frame time of the first image frame, and the target shooting parameters. Specifically, the shooting parameter generation module obtains a smoothing adjustment curve based on the initial shooting parameters and the target shooting parameters, where the starting point of the smoothing adjustment curve is the initial shooting parameters and the ending point of the smoothing adjustment curve is the target shooting parameters; the shooting parameter generation module determines the first transitional shooting parameters from the smoothing adjustment curve based on the return frame time of the first image frame.

[0011] In some embodiments, the smoothing adjustment curve may be a Bézier curve. The total duration of the smoothing adjustment curve may be fixed, or it may be determined by the initial shooting parameters and the target shooting parameters. The total duration of the smoothing adjustment curve may also be different depending on the initial shooting parameters and the target shooting parameters.

[0012] The starting point of the smoothing curve can correspond to the moment when the electronic device receives the first operation for the camera application. The ending point of the smoothing curve can be determined by adding the total duration of the smoothing curve to the starting point.

[0013] The electronic device can obtain a smooth adjustment curve based on the initial shooting parameters and the target shooting parameters, and determine one or more transition shooting parameters from the smooth adjustment curve by the return frame time of the image frame. This allows the camera application to smoothly switch from the initial shooting parameters to the target shooting parameters based on the one or more transition shooting parameters. The change of shooting parameters in the final image frame obtained by the electronic device conforms to the change law of the smooth adjustment curve, so that the shooting parameters can smoothly transition to the target shooting parameters, avoiding image shaking or stuttering, and improving the user's visual experience.

[0014] In conjunction with the first aspect, in one possible implementation, the rendering process renders the first transition image according to the vertical synchronization signal period of the rendering process, specifically including: when the time interval between the first time and the display time of the previous image frame is greater than or equal to m first vertical synchronization signal periods, the rendering process renders the first transition image in the first time.

[0015] In this way, the electronic device can temporarily store the image frame first, and then send the next image frame for rendering after the electronic device has finished rendering the previous image frame, thus avoiding the speed of sending image frames exceeding the speed of rendering image frames by the electronic device.

[0016] In conjunction with the first aspect, in one possible implementation, after the shooting parameter generation module determines the first transition shooting parameters based on the return frame time of the first image frame and the target shooting parameters, the method further includes: the shooting parameter generation module determining the second transition shooting parameters based on the return frame time of the first image frame, a preset duration, and the target shooting parameters; the image cropping module processing the first image frame based on the second transition shooting parameters and the shooting parameters of the first image frame to obtain a second transition image frame, wherein the shooting parameters of the second transition image frame include the second transition shooting parameters; the rendering process rendering the second transition image according to the vertical synchronization signal period of the rendering process; and the electronic device displaying the rendered second transition image within the camera application.

[0017] Optionally, the electronic device may insert more image frames than one, and this application does not limit this.

[0018] Optionally, the preset duration is related to the number of interpolated frames and the output frame rate of the HAL layer. For example, if 1 frame is interpolated and the output frame rate is 30PFS (33.3), then the preset duration is 16.7ms.

[0019] In this way, electronic devices can increase the number of image frames during the shooting parameter adjustment process by interpolating frames, thereby reducing the change value of shooting parameters between two adjacent image frames and making the shooting parameter adjustment process smoother.

[0020] In conjunction with the first aspect, in one possible implementation, the rendering process renders the second transition image according to the vertical synchronization signal period of the rendering process, specifically including: when the time interval between the second time and the display time of the previous image frame is greater than or equal to m second vertical synchronization signal periods, the rendering process renders the second transition image in the second time.

[0021] Optionally, the display frame rate of the electronic device also needs to be changed after the vertical synchronization signal period changes.

[0022] Therefore, in the case of frame interpolation, the period of the vertical synchronization signal needs to be changed so that the electronic device can render the multiple image frames obtained after interpolation in a timely manner.

[0023] In conjunction with the first aspect, in one possible implementation, the period of the second vertical synchronization signal is shorter than the period of the first vertical synchronization signal.

[0024] Thus, due to frame interpolation, the vertical synchronization signal period needs to be shortened in order to render multiple transitional image frames in a timely manner.

[0025] In conjunction with the first aspect, in one possible implementation, after the shooting parameter generation module determines the second transition shooting parameters based on the return frame time of the first image frame, the preset duration, and the target shooting parameters, the method further includes: the shooting parameter generation module acquiring the return frame time of the second image frame, wherein the second image frame is an image frame acquired by the electronic device after receiving the first operation; the shooting parameter generation module determining whether the return frame time of the second image frame is later than the time corresponding to the target shooting parameters in the smoothing adjustment curve; if the return frame time of the second image frame is later than the time corresponding to the target shooting parameters in the smoothing adjustment curve, the electronic device switches the vertical synchronization signal period from the second vertical synchronization signal period to the first vertical synchronization signal period.

[0026] Thus, after the shooting parameters are adjusted, i.e. the image frame return time is later than the time corresponding to the target shooting parameters, frame interpolation stops, and the vertical synchronization signal period needs to be restored to the previous period.

[0027] In conjunction with the first aspect, in one possible implementation, after the electronic device receives and responds to the user's first operation on the camera application, the method further includes: the electronic device switching the vertical synchronization signal period from a first vertical synchronization signal period to a second vertical synchronization signal period.

[0028] Thus, when the electronic device receives user input to change the shooting parameters, the electronic device needs to shorten the vertical synchronization signal period due to frame interpolation.

[0029] In conjunction with the first aspect, in one possible implementation, the electronic device further includes a camera module, and before the electronic device receives and responds to the user's first operation on the camera application, the method further includes: the electronic device receiving and responding to a second operation to open the camera application, acquiring initial shooting parameters; and the camera module acquiring image frames based on the initial shooting parameters.

[0030] In this way, before the electronic device receives user input to change the shooting parameters, the electronic device acquires and displays image frames with the initial shooting parameters.

[0031] In conjunction with the first aspect, in one possible implementation, the shooting parameter generation module determines the first transition shooting parameters from the smoothing adjustment curve based on the return frame time of the first image frame, specifically including:

[0032] The shooting parameter generation module determines whether the return frame time of the first image frame is earlier than the time corresponding to the target shooting parameter in the smoothing adjustment curve; if the return frame time of the first image frame is earlier than the time corresponding to the target shooting parameter, the shooting parameter generation module determines the first transition shooting parameter from the smoothing adjustment curve based on the return frame time of the first image frame.

[0033] In one possible implementation, the method further includes: when the return frame time of the first image frame is later than the time corresponding to the target shooting parameters, the camera module acquires image frames based on the target shooting parameters.

[0034] In this way, the electronic device can determine whether to determine transitional shooting parameters based on the image frame's return frame time and the time corresponding to the target shooting parameters in the smoothing adjustment curve. If the image frame's return frame time is earlier than the time corresponding to the target shooting parameters in the smoothing adjustment curve, the electronic device can determine one or more transitional shooting parameters based on the image frame's return frame time. If the image frame's return frame time is later than the time corresponding to the target shooting parameters in the smoothing adjustment curve, the electronic device does not need to determine other shooting parameters, and the shooting parameter adjustment ends.

[0035] In conjunction with the first aspect, in one possible implementation, when the initial shooting parameters are greater than the target shooting parameters, the first transition shooting parameters are less than the initial shooting parameters but greater than the target shooting parameters; when the initial shooting parameters are less than the target shooting parameters, the first transition shooting parameters are greater than the initial shooting parameters but less than the target shooting parameters.

[0036] In conjunction with the first aspect, in one possible implementation, the electronic device includes an application framework layer and a hardware abstraction layer; the first image frame is an image frame sent by the hardware abstraction layer to the application framework layer after the electronic device receives the first operation, and the return frame time of the first image frame is the time when the hardware abstraction layer sends the first image frame to the application framework layer.

[0037] In one possible implementation, the camera parameter generation module, image cropping module, and rendering process are functional modules within the application framework layer.

[0038] In this way, firstly, the calculation of transition shooting parameters is completed at the application architecture layer, reducing the interaction steps between the application layers and saving time for the application layer to send transition shooting parameters to the application architecture layer. After the HAL layer returns the image frame, the application framework layer can promptly send the camera request carrying the transition shooting parameters to the HAL layer. Secondly, when the HAL layer returns the image frame to the application architecture layer, the application architecture layer can determine the transition shooting parameters in real time based on the return frame time of the image frame returned by the HAL layer. This ensures that the smooth adjustment curve of the image frame returned by the HAL layer during the shooting parameter adjustment process conforms to the preset smooth adjustment curve change law, making the shooting parameter adjustment process smoother and preventing image jitter or stuttering, thus improving the user's visual experience.

[0039] In conjunction with the first aspect, in one possible implementation, the electronic device includes an application framework layer and a hardware abstraction layer; the camera module acquires image frames based on first transitional shooting parameters, specifically including: in response to the return frame time of the first image frame being earlier than the time corresponding to the target shooting parameters, the application framework layer sends a first request to the HAL layer, the first request carrying the first transitional shooting parameters; the HAL layer sends the first request to the camera module; the first transitional shooting parameters acquire a second image frame, specifically including: in response to the first request, the camera module acquires a second image frame based on the first transitional shooting parameters.

[0040] In this way, the application framework layer, HAL layer, and hardware layer can work together to complete the shooting parameter adjustment process.

[0041] In conjunction with the first aspect, in one possible implementation, when the return frame time of the first image frame is later than the time corresponding to the target shooting parameters, the method further includes: an image cropping module determining whether the shooting parameters of the first image frame are the same as the target shooting parameters; if the shooting parameters of the first image frame are different from the target shooting parameters, the image cropping module processes the first image frame according to the shooting parameters of the first image frame and the target shooting parameters to obtain a third transition image frame; the rendering process renders the third transition image according to the vertical synchronization signal period of the rendering process; and the electronic device displays the rendered third transition image within the camera application.

[0042] Thus, when the shooting parameters of the first image frame are inconsistent with the target shooting parameters, it indicates that the first image frame was not captured using the target shooting parameters. The electronic device can then process the first image frame captured by the camera into a third transitional image. The camera parameters of the third transitional image are the same as the target shooting parameters. Since the return frame time of the first image frame is later than the time corresponding to the target shooting parameters in the shooting parameter adjustment curve, the shooting parameter adjustment is complete, and the image frame corresponding to the shooting parameters of the first image frame has already been displayed in advance. The electronic device can then adjust the first image frame to the image frame corresponding to the target shooting parameters.

[0043] In conjunction with the first aspect, in one possible implementation, the method further includes: when the shooting parameters of the first image frame are the same as the target shooting parameters, the rendering process renders the first image frame according to the vertical synchronization signal period of the rendering process; and the electronic device displays the rendered first image frame within the camera application.

[0044] Thus, when the shooting parameters of the first image frame are consistent with the target shooting parameters, it means that the first image frame was acquired using the target shooting parameters, and the electronic device can directly render and display the first image frame.

[0045] In conjunction with the first aspect, in one possible implementation, the image cropping module processes the first image frame according to the first transition shooting parameters and the shooting parameters of the first image frame to obtain the first transition image frame. Specifically, the image cropping module changes the field of view (FOV) in the first image frame to obtain the first transition image frame.

[0046] In conjunction with the first aspect, in one possible implementation, the image cropping module changes the field of view (FOV) in the first image frame to obtain a first transition image frame. Specifically, this includes: multiplying the FOV of the first image frame by a first scaling factor to obtain the first transition image frame, wherein the first scaling factor is the ratio of the first transition shooting parameters to the shooting parameters of the first image frame.

[0047] In conjunction with the first aspect, in one possible implementation, the FOV of the first image frame is a first FOV, the FOV of the first transition image frame is a second FOV, and the second FOV is the product of the first FOV and the first scaling factor.

[0048] Thus, once the FOV of the first image frame and the first scaling factor are determined, the FOV of the second image frame can be obtained.

[0049] In conjunction with the first aspect, in one possible implementation, the size of the first image frame is a first size, and the image cropping module changes the field of view (FOV) in the first image frame to obtain a first transition image frame. Specifically, the image cropping module crops the first image frame from the first size to a second size to obtain a first image; the second size is the product of the first size and a second scaling factor, and the second scaling factor is the reciprocal of the first scaling factor; the image cropping module changes the first image at the second size from the first FOV to the second FOV; and the image cropping module scales the first image from the second size back to the first size to obtain the first transition image frame.

[0050] In this way, by cropping and scaling, the first image frame can be processed into the second image frame.

[0051] In conjunction with the first aspect, in one possible implementation, the initial shooting parameters include a first zoom ratio, and the target shooting parameters include a second zoom ratio.

[0052] In conjunction with the first aspect, in one possible implementation, before the electronic device receives and responds to the user's first operation on the camera application, the method further includes: the camera application displaying a first preview interface, the first preview interface including a zoom ratio control, the zoom ratio control indicating that the zoom ratio value of the image frame displayed in the first preview interface is a first zoom ratio; after the electronic device receives and responds to the user's first operation on the camera application, the method further includes: the camera application displaying a second preview interface, the second preview interface including a zoom ratio control, the zoom ratio control indicating that the zoom ratio value of the image frame displayed in the second preview interface is a second zoom ratio.

[0053] In this way, users can know the current zoom level from the zoom level control in the camera preview interface.

[0054] In conjunction with the first aspect, in one possible implementation, the method further includes: when the time interval between the first time and the display time of the previous image frame is less than m first vertical synchronization signal cycles, the electronic device stores the first image frame in the buffer queue of the image frames to be displayed.

[0055] In this way, the display thread module can determine whether the first image frame can be sent to the rendering process module based on the vsync signal. If the time interval between the first time and the display time of the previous image frame is less than m first vertical synchronization signal cycles, the electronic device will not render the first image frame to avoid frame loss due to untimely rendering.

[0056] In conjunction with the first aspect, in one possible implementation, the electronic device further includes a display thread and a buffer manager. The buffer manager is used to temporarily store image frames. After the image cropping module processes the first image frame according to the first transition shooting parameters and the shooting parameters of the first image frame to obtain the first transition image frame, the method further includes: if the number of image frames in the buffer manager is greater than or equal to a first threshold, the display thread sends the first transition image to the rendering process for rendering; if the number of image frames in the buffer manager is less than the first threshold, the buffer manager temporarily stores the first transition image frame.

[0057] In this way, when the number of image frames temporarily stored in the buffer manager is relatively small, the buffer manager can continue to temporarily store the first transition image frame in the buffer queue. When the number of image frames temporarily stored in the buffer manager is large, the electronic device can directly render and display the first transition image frame. This avoids queue congestion caused by storing too many image frames, which would affect the smoothness of image frame display on the electronic device.

[0058] In conjunction with the first aspect, in one possible implementation, after the buffer manager temporarily stores the first transition image frame, the method further includes: the display thread obtaining the first transition image frame from the buffer manager.

[0059] In this way, the display process can obtain the first transition image frame from the buffer manager.

[0060] In conjunction with the first aspect, in one possible implementation, the electronic device also includes a vsync signal listening module, which is used to listen for the vsync signal of the rendering process module.

[0061] In this way, the vsync signal listening module can determine whether the rendering process module has completed rendering the image frame by listening to the rendering process module.

[0062] In conjunction with the first aspect, in one possible implementation, the method further includes: the vsync signal listening module sending the vsync signal to the display process module; when the time interval between the first time and the display time of the previous image frame is greater than or equal to m first vertical synchronization signal cycles, the rendering process renders the first transition image in the first time, specifically including: when the display process module determines based on the vsync signal that the time interval between the first time and the display time of the previous image frame is greater than or equal to m vertical synchronization vsync signal cycles, the rendering process renders the first transition image in the first time.

[0063] In this way, the display thread module can determine when to send the first image frame to the rendering process module based on the vsync signal. The electronic device can then render and display the first image frame through the rendering process module.

[0064] In conjunction with the first aspect, in one possible implementation, the value of m is determined by the frame rate of the electronic device and the period interval of the vsync signal.

[0065] In conjunction with the first aspect, in one possible implementation, the value of m is equal to the first value divided by the frame rate, and then divided by the vsync signal period interval.

[0066] In this way, the value of K can be determined.

[0067] In conjunction with the first aspect, in one possible implementation, the electronic device further includes a timer module, and the method further includes: the timer sets a first timestamp for the first transition image; when the display thread module determines that the time interval between the first timestamp and the timestamp of the previous image frame sent to the rendering process by the display process module is greater than a second threshold, the rendering process renders the first transition image according to the vertical synchronization signal period of the rendering process.

[0068] In this way, the display sending thread module can determine when to send image frames to the rendering process module based on the timestamp set by the timer. This keeps the time interval for sending image frames to the rendering process module stable.

[0069] In conjunction with the first aspect, in one possible implementation, the shooting parameters include any of the following: zoom ratio, exposure, aperture, white balance, sharpness, contrast, and saturation.

[0070] In a second aspect, an electronic device is provided, which may include one or more cameras, a display, one or more processors, and one or more memories; wherein the one or more cameras, the display, and the one or more memories are coupled to one or more processors, and the one or more memories are used to store computer program code, the computer program code including computer instructions, which, when executed by one or more processors, cause the electronic device to perform the methods involved in any possible implementation of the first aspect.

[0071] Thirdly, an electronic device is provided, which may include one or more functional modules for the methods involved in any possible implementation of the first aspect.

[0072] Fourthly, a chip system is provided for use in an electronic device, the chip system including one or more processors for invoking computer instructions to cause the electronic device to perform the methods involved in any possible implementation of the first aspect.

[0073] Fifthly, a computationally readable storage medium is provided, including instructions that, when executed on an electronic device, cause the electronic device to perform the methods involved in any possible implementation of the first aspect.

[0074] In a sixth aspect, a computer program product is provided that, when the program product is run on an electronic device, causes the electronic device to perform the methods involved in any possible implementation of the first aspect. Attached Figure Description

[0075] Figure 1 shows a schematic diagram of a zoom smoothing adjustment curve;

[0076] Figure 2 illustrates the hardware and software architecture interaction diagram of the camera application switching the initial zoom level to the target zoom level based on a smooth adjustment curve;

[0077] Figure 3 shows a schematic diagram of the zoom curve of an image frame captured by an electronic device 100 during zooming.

[0078] Figure 4 shows a schematic diagram of an electronic device 100 processing a camera request;

[0079] Figure 5 shows a schematic diagram of an electronic device 100 rendering an image frame;

[0080] Figure 6 shows a schematic diagram of the structure of the electronic device 100;

[0081] Figure 7 shows a software structure block diagram of the electronic device 100;

[0082] Figures 8A-8I illustrate schematic diagrams of an electronic device 100 adjusting the zoom ratio of a camera application based on user operation;

[0083] Figure 9A shows a software architecture diagram of an electronic device 100 acquiring images at an initial zoom level according to an embodiment of this application;

[0084] Figure 9B shows a schematic flowchart of a shooting method provided in an embodiment of this application;

[0085] Figure 10 shows a timing diagram of an electronic device 100 rendering and displaying image frames periodically with a vsync signal.

[0086] Figure 11 shows a timing diagram of an electronic device 100 rendering and displaying image frames with different vsync signal cycles;

[0087] Figure 12A shows a software architecture diagram of another electronic device 100 provided in an embodiment of this application for acquiring images at an initial zoom level;

[0088] Figure 12B shows a schematic flowchart of another shooting method provided in an embodiment of this application;

[0089] Figure 12C shows a schematic flowchart of another shooting method provided in an embodiment of this application;

[0090] Figures 13A-13D show schematic diagrams of another zoom smoothing adjustment curve;

[0091] Figure 14A shows a schematic diagram of a cropped image from an electronic device 100;

[0092] Figure 14B illustrates how another electronic device 100 handles camera requests and zoom requests;

[0093] Figure 14C shows a timing diagram of another electronic device 100 rendering and displaying image frames in a vsync signal cycle;

[0094] Figure 15A shows a schematic flowchart of another shooting method provided in an embodiment of this application;

[0095] Figure 15B shows a schematic flowchart of another shooting method provided in an embodiment of this application;

[0096] Figures 16A-16B show schematic diagrams of yet another zoom smoothing adjustment curve;

[0097] Figure 17A shows a schematic diagram of how another electronic device 100 handles camera requests and zoom requests;

[0098] Figure 17B shows a timing diagram of another electronic device 100 rendering and displaying image frames in a vsync signal cycle;

[0099] Figure 18 is a flowchart illustrating a shooting parameter adjustment method provided in this application. Detailed Implementation

[0100] The technical solutions in the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; the word "and / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.

[0101] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0102] The term "user interface (UI)" used in the following embodiments of this application refers to the medium interface through which an application or operating system interacts and exchanges information with a user. It realizes the conversion between the internal form of information and the form that the user can accept. The most common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed in a graphical manner. It can be visual interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets displayed on the screen of a wearable device.

[0103] When an electronic device displays a camera application's photo preview or video preview interface, the user can change shooting parameters. Shooting parameters may include, but are not limited to, any of the following: focal length, exposure, aperture, white balance, sharpness, contrast, saturation, etc.

[0104] If a user operation to adjust the shooting parameters is detected, the electronic device can obtain a smooth adjustment curve based on the initial shooting parameters and the target shooting parameters, and then smoothly adjust the parameters to be adjusted from the initial shooting parameters to the target shooting parameters based on this smooth adjustment curve. Here, the initial shooting parameter value refers to the shooting parameter value before the current shooting parameter adjustment operation is detected, and the target shooting parameter value is the shooting parameter value after the adjustment trigger operation is detected.

[0105] Understandably, the smooth adjustment curve can include initial shooting parameters, one or more transitional shooting parameters, and a target shooting parameter. The electronic device can sequentially obtain preview image frames using the initial shooting parameters, one or more transitional shooting parameters, and the target shooting parameter. This avoids abrupt changes in the image that could occur if the electronic device directly adjusts the shooting parameters to the target shooting parameter.

[0106] For example, the shooting parameters can be focal length, the initial shooting parameters can be the initial zoom ratio, and the target shooting parameters can be the target zoom ratio.

[0107] Figure 1 shows a schematic diagram of a zoom smoothing adjustment curve.

[0108] As shown in Figure 1, upon detecting a user's focus adjustment operation, the electronic device can obtain the zoom smoothing adjustment curve shown in Figure 1 based on the initial zoom ratio and the target zoom ratio. The Bezier curve shown in Figure 1 is a curve obtained with the initial zoom ratio as the starting point and the target zoom ratio as the ending point. The Bezier curve includes one or more transition zoom ratios. For example, the Bezier curve shown in Figure 1 includes transition zoom ratio 1, transition zoom ratio 2, and transition zoom ratio 3.

[0109] In response to the detection of a user operation that adjusts the focal length, the electronic device can sequentially obtain a preview image frame through transition zoom ratio 1, transition zoom ratio 2, transition zoom ratio 3 and target zoom ratio, thus achieving a smooth transition from the initial zoom ratio to the target zoom ratio.

[0110] Currently, electronic devices use camera applications to smoothly adjust the parameters to be adjusted from the initial shooting parameters to the target shooting parameters.

[0111] Figure 2 illustrates the hardware and software architecture interaction diagram of how a camera application switches from the initial zoom level to the target zoom level based on a smooth adjustment curve.

[0112] As shown in Figure 2, the layered architecture divides the system into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the system is divided into four layers, from top to bottom: the application layer, the application framework layer, the hardware abstraction layer, and the hardware layer.

[0113] The application layer can include a series of application packages, which may include camera applications, etc.

[0114] The camera application integrates a camera request sending module and a timing module.

[0115] The camera request sending module is used to send camera requests and focus adjustment requests to the application framework layer. Camera requests can include, but are not limited to, preview requests and photo capture requests.

[0116] The preview request can be sent after the camera app is opened. The photo capture request can be sent after the camera app detects a photo capture operation. The focus adjustment request can be sent after the camera app detects a focus adjustment operation.

[0117] The timing module is used to obtain the frame interval and, after detecting a user operation to adjust the focal length, determines one or more zoom levels based on the frame interval and the Bezier curve. This allows the camera request sending module to determine the number of times to send a focal length adjustment request to the program framework layer based on one or more zoom levels.

[0118] The Application Frameworks (FWK) layer provides application programming interfaces (APIs) and programming frameworks for application packages within the application layer. The application framework layer also includes some predefined functions.

[0119] In some embodiments, the application framework layer may also include a request queue module, which may include camera requests and focus adjustment requests issued by the camera application.

[0120] In some embodiments, the application framework layer may further include a request queue processing (RequestThread) module. This request queue processing module may include a WaitForRequest module, a SendRequestsBatch module, and a PrepareHardware AbstractionLayerRequest (or PrepareHALRequest) module.

[0121] The WaitForRequest module allows camera requests awaiting execution in the request queue to wait when none of the N buffers allocated to the camera application in the electronic device's buffer are empty. The PrepareHALRequest module constructs the HAL layer's Capture request and output buffers. When there are empty buffers among the N buffers allocated to the camera application, the PrepareHALRequest module can obtain buffers from the Allocate Buffer interface for the camera request issued by the camera application. The Send module sends the HAL layer's Capture request constructed by the PrepareHALRequest module to the HAL layer.

[0122] For example, N can be 8, meaning the number of buffers allocated by the electronic device to the camera application for camera requests can be 8. N can also be other values, such as 7 or 9, etc. The embodiments of this application do not limit the value of N. The following description uses the value of N as 8 as an example.

[0123] In some embodiments, the application framework layer may further include an Allocate Buffer interface, which is used to allocate a buffer for camera requests issued by the camera application. For example, the Allocate Buffer interface can specify the address of a buffer for storing the camera request.

[0124] In some embodiments, the application framework layer may also include a result processing module, which is used to receive image frames sent by the HAL layer, or the buffer address storing the image frames. The result processing module may also send the image frame or the buffer address storing the image frame to the camera application.

[0125] In some embodiments, the application framework layer may further include a rendering process module. The rendering process module can be used to render image frames sent by the camera application and send the rendered image frames back to the camera application, which can then display the rendering results.

[0126] In some embodiments, the application framework layer may further include a frame return data processing module. The result processing module receives image frames sent by the HAL layer, or, after storing the buffer address of an image frame, sends the frame return time of that image frame to the frame return data processing module. The frame return data processing module can determine the frame interval based on the frame return time of the image frame. The frame return time of the image frame may refer to the time when the application framework layer or the result processing module in the application framework layer receives the image frame uploaded by the HAL layer, and the frame interval may refer to the time difference between the frame return times of two adjacent image frames.

[0127] In some embodiments, the application framework layer may also be referred to as the application framework layer.

[0128] The Hardware Abstraction Layer (HAL) is an interface layer located between the application framework layer and the hardware layer, providing a virtual hardware platform for the operating system.

[0129] The Hardware Abstraction Layer (HAL) can receive camera requests from the application framework layer and send the camera parameters and buffer address from the camera request to the camera module. It can also call an interface that returns results (e.g., ProcessCaptureResult) to send the image frames acquired by the camera module according to the camera parameters to the result processing module in the application framework layer.

[0130] The hardware layer may include a camera module, an image signal processor, a display, etc. The camera module may include image sensors for one or more cameras (e.g., image sensor 1, image sensor 2, etc.). Optionally, the camera module may also include a time-of-flight (TOF) sensor, a multispectral sensor, etc. The image signal processor can be used to process the image frames acquired by the camera module.

[0131] The following section, taking zoom as an example, describes in detail the processing mechanism of the electronic device 100 based on the camera request generated by the user for changing the focal length, in conjunction with the above system structure.

[0132] 1. When electronic device 100 receives a user's command to open the camera application, electronic device 100 launches the camera application. The camera application can issue multiple camera requests to obtain preview images. The first camera request issued by the camera application to obtain preview images can fill the N buffers reserved for camera requests in the cache area.

[0133] Optionally, once the camera app is enabled, it can send a camera request to the application framework layer only once if the shooting parameters remain unchanged.

[0134] The process by which electronic device 100 processes camera requests sent by the camera application and sends out image frames can be found in steps 7-16, which describe how electronic device 100 processes focus adjustment requests and sends out image frames. This application will not repeat the details here.

[0135] 2. The application framework layer of electronic device 100 obtains the return frame time of the image frame.

[0136] When the application framework layer of electronic device 100 obtains an image frame uploaded by the HAL layer, it can determine the return frame time of the image frame based on the time of the image frame uploaded by the HAL layer.

[0137] The application framework layer of electronic device 100 can determine the frame interval based on the return frame time of two adjacent image frames.

[0138] 3. The camera application obtains the frame interval.

[0139] In some embodiments, the frame interval may refer to the average frame interval, that is, the average of multiple frame intervals. In other embodiments, the frame interval may also refer to the real-time frame interval, which may refer to the time difference between the return time of the most recently returned image frame and the return time of the adjacent previously returned image frame.

[0140] 4. The camera application receives zoom operations.

[0141] The camera app can receive and respond to the user's zoom operation, determining the initial zoom ratio and the target zoom ratio. Based on these two zoom ratios, the camera app can then determine a zoom smoothing adjustment curve, which shows the correspondence between time and zoom ratio.

[0142] 5. The camera application determines one or more transition zoom magnifications based on the frame interval and zoom smoothing adjustment curve.

[0143] After obtaining the frame interval and zoom smoothing adjustment curve, the camera application can determine one or more transition zoom ratios based on these curves. This allows the camera application to determine the number of times to send a focus adjustment request to the application framework layer based on one or more transition zoom ratios.

[0144] For example, as shown in Figure 1, time t1 can be the moment when the camera application receives the zoom operation, and time t2 can be the cutoff time of the zoom smoothing adjustment curve. After time t1, the camera application can determine times t3, t4, and t5 based on the first frame interval. Then, based on times t3, t4, and t5 and the zoom smoothing adjustment curve, it can determine transition zoom ratio 1, transition zoom ratio 2, and transition zoom ratio 3, respectively.

[0145] The camera application can sequentially send focus adjustment request 1 (including transition zoom level 1), focus adjustment request 2 (including transition zoom level 2), focus adjustment request 3 (including transition zoom level 3), and focus adjustment request 4 (including target zoom level) to the application framework layer. This allows the camera module to capture and display image frames based on the transition zoom levels.

[0146] 6. The camera application sends a focus adjustment request to the application framework layer.

[0147] Electronic device 100 can receive user commands to change the focal length for a camera application. Based on this command, after the application framework layer receives an image frame returned by the HAL layer, the camera application in electronic device 100 can send a focal length adjustment request to the application framework layer.

[0148] 7. Request the queue processing module to get the buffer.

[0149] In some embodiments, the application framework layer may include an Allocate Buffer interface. In response to a focus adjustment request 1 sent by the camera application, the prepare HAL request module may send a get buffer request to the Allocate Buffer interface to obtain a free buffer and allocate a free buffer for focus adjustment request 1.

[0150] 8. The application framework layer allocates a cache for focus adjustment request 1.

[0151] When there is an empty buffer among the N buffers reserved for camera requests in the buffer area of ​​electronic device 100, electronic device 100 can send the focus adjustment request 1 to the HAL request preparation module in the request queue processing module. After the HAL request preparation module obtains the Allocate Buffer interface to allocate a buffer address for focus adjustment request 1, it can store focus adjustment request 1 in the buffer.

[0152] 9. The application framework layer sends a focus adjustment request to the HAL layer.

[0153] After the application framework layer allocates a buffer for focus adjustment request 1, it sends focus adjustment request 1 to the HAL layer. Focus adjustment request 1 carries the transition zoom magnification 1. Focus adjustment request 1 may also carry other data, which is not limited in this application.

[0154] Specifically, the HAL request preparation module can construct the focus adjustment request 1 into a HAL layer capture request and send it to the HAL layer through the batch processing request module. The HAL layer then sends the camera parameters in the capture request and the buffer address of the capture request to the camera module. The camera parameters in the capture request may include, but are not limited to, the transition zoom ratio 1.

[0155] 10. The HAL layer sends a focus adjustment request to the camera module.

[0156] In response to the focus adjustment request sent by the application framework layer, the HAL layer then sends the focus adjustment request to the camera module.

[0157] 11. Electronic device 100 turns on the camera, acquires the image frame captured by the camera based on the focal length adjustment request, and sends the image frame to the HAL layer.

[0158] The camera module in the electronic device 100 can receive a focus adjustment request and the buffer address of the focus adjustment request from the HAL layer. Then, the camera module can acquire image frames according to camera parameters (e.g., transition zoom ratio 1) and store the acquired image frames in the buffer corresponding to the buffer address carried by the focus adjustment request.

[0159] In some examples, the image frames acquired by the camera module can be transmitted to the image signal processor, which can preprocess the image frames and then upload them to the HAL layer via the camera driver or the image processor driver.

[0160] 12. The HAL layer uploads the image frames to the result processing module in the application framework layer.

[0161] After receiving the image frame uploaded by the image signal processor, the HAL layer then uploads the image frame to the result processing module in the application framework layer.

[0162] 13. The result processing module uploads the image frames to the camera application.

[0163] In response to the image frame sent by the HAL layer, the result processing module then uploads the image frame and / or the buffer address of the image frame to the camera application.

[0164] 14. The camera application sends a display command to the rendering process Surface flinger.

[0165] 15. The rendering process sends the rendered image frames to the camera application.

[0166] 16. The camera application sends and displays image frames.

[0167] After obtaining the image frame and / or the image frame's buffer address, the camera application can send the image frame to the rendering process module for rendering. The rendering process module can then obtain the rendered image frame and send it back to the camera application. The camera application then sends the rendered image frame to the display for display.

[0168] 17. Electronic device 100 clears the buffer storing the focus adjustment request.

[0169] In some embodiments, after the display successfully sends the image frame, it notifies the result processing module that the image frame has been successfully displayed. It is understood that after the image frame is sent, the buffer storing the image frame and the focus adjustment request used to retrieve it in the electronic device's cache is cleared. The result processing module can send the address of the cleared buffer to the Allocate Buffer interface. The Allocate Buffer interface can then allocate the address of the cleared buffer to the next focus adjustment request.

[0170] In some embodiments, the result processing module may also send the return frame time of the image frame to the return frame data processing module, so that the return frame data processing module can count the frame interval of multiple image frames displayed by the electronic device 100.

[0171] After the HAL layer sends the image frame acquired in response to focus adjustment request 1 to the application framework layer, the application layer can then send focus adjustment request 2 to the application framework layer, and then acquire the image frame corresponding to focus adjustment request 2 according to steps 7-16. This process continues until the application framework layer acquires the image frame corresponding to focus adjustment request 4, at which point the application layer stops sending focus adjustment requests to the application framework layer. Afterward, the electronic device 100 continuously acquires and displays image frames at the target zoom level.

[0172] However, the processing in Figure 1 has the following three defects.

[0173] Defect 1: The actual zoom curve deviates from the ideal zoom curve, and the zoom process is not smooth.

[0174] As shown in Figure 1, the electronic device 100 smoothly adjusts the zoom ratio from an initial zoom ratio to a target zoom ratio through a camera application. The camera application determines one or more transition zoom ratios based on frame intervals and a zoom smoothing adjustment curve. For example, the camera application can determine times t10, t11, and t12 based on frame intervals, and determine transition zoom ratio 1, transition zoom ratio 2, and transition zoom ratio 3 based on times t10, t11, and t12, respectively. During the zoom process, the camera module can acquire image frames based on one or more transition zoom ratios issued by the camera application and return them to the HAL layer. The HAL layer then returns the image frames to the application framework layer.

[0175] During the zoom process, based on the zoom ratio and frame return time of the image frames returned by the HAL layer to the application framework layer, the HAL layer can obtain the zoom curve shown in Figure 3. The zoom curve shown in Figure 3 reflects the zoom process of the image frames acquired by the electronic device 100 during the zoom process.

[0176] Based on the above analysis, it can be seen that one or more transition zoom ratios are determined by the camera application based on the frame interval and zoom smoothing adjustment curve. However, due to hardware performance limitations, the image acquisition and image processing algorithms are not stable in terms of time consumption, and the camera application can no longer adjust the transition zoom ratio according to the real-time image frame return time. Furthermore, it takes time for the application layer to send zoom requests to the application framework layer, and after the HAL layer returns the image frame, the application framework layer cannot send the zoom request to the HAL layer in a timely manner. Moreover, the time required for the application layer to send zoom requests to the application framework layer, and the time required for the application framework layer to send zoom requests to the HAL layer, are both unstable. Ultimately, this causes the moment when the HAL layer responds to the zoom request and the corresponding transition zoom ratio of that image frame to deviate from the zoom smoothing adjustment curve. The HAL layer can finally obtain the zoom curve shown in Figure 3, which has deviated from the zoom smoothing adjustment curve shown in Figure 3. In terms of display effect, this manifests as screen delay and screen jitter, affecting the user's visual experience.

[0177] Defect 2: There is a delay in the electronic device's response to the user's zoom operation. It will only respond to the user's zoom operation a certain amount of time after receiving the user's zoom operation.

[0178] As shown in Figure 2, the application framework layer periodically sends camera requests to the HAL layer. Before the HAL layer responds to the zoom request corresponding to the user's zoom operation, it needs to process other pending camera requests. The HAL layer will only process the zoom request after all the previous camera requests have been processed.

[0179] For example, as shown in Figure 4, before the HAL layer processes the zoom request, there are six other camera requests waiting to be processed: Camera Request 1, Camera Request 2, Camera Request 3, Camera Request 4, Camera Request 5, and Camera Request 6. If the HAL layer receives Zoom Request 1 at time tms, it places Zoom Request 1 in the queue of pending requests according to the chronological order. Following the first-in, first-out (FIFO) principle, at time tms, the HAL layer retrieves Camera Request 1 from the queue and processes it. In response to processing Camera Request 1, the camera module can acquire image frame A based on the initial zoom level and send it to the application framework layer through the HAL layer. The application framework layer then sends image frame A to the camera application, which can then display image frame A.

[0180] If the HAL layer takes 33.3ms to process a camera request, at (t+33.3)ms, the HAL layer receives zoom request 1 and places zoom request 2 in the pending request queue according to the time sequence. Following the first-in, first-out principle, at (t+33.3)ms, the HAL layer retrieves camera request 2 from the queue and processes it. In response to processing camera request 2, the camera module can acquire image frame B based on the initial zoom level and send it to the application framework layer via the HAL layer. The application framework layer then sends image frame B to the camera application, which can then display image frame B.

[0181] Similarly, at (t+66.6) ms, the HAL layer receives zoom request 3 and places it in the pending request queue according to the time sequence. Following the first-in, first-out (FIFO) principle, at (t+66.6) ms, the HAL layer retrieves camera request 3 from the queue and processes it. In response to processing camera request 3, the camera module can acquire image frame C based on the initial zoom level and send it to the application framework layer via the HAL layer. The application framework layer then sends image frame C to the camera application, which can then display image frame C.

[0182] Similarly, at (t+99.9) ms, the HAL layer receives zoom request 4 and places it in the pending request queue according to the time sequence. Following the first-in, first-out (FIFO) principle, at (t+99.9) ms, the HAL layer retrieves camera request 4 from the queue and processes it. In response to processing camera request 4, the camera module can acquire image frame D based on the initial zoom level and send it to the application framework layer via the HAL layer. The application framework layer then sends image frame D to the camera application, which can then display image frame D.

[0183] Similarly, at time (t+133.2) ms, the HAL layer receives zoom request 5 and places it in the pending request queue according to the time sequence. Following the first-in, first-out (FIFO) principle, at time (t+133.2) ms, the HAL layer retrieves camera request 5 from the queue and processes it. In response to processing camera request 5, the camera module can acquire image frame E based on the initial zoom level and send it to the application framework layer via the HAL layer. The application framework layer then sends image frame E to the camera application, which can then display image frame E.

[0184] Similarly, at time (t+166.5) ms, the HAL layer receives zoom request 6 and places it in the pending request queue according to the time sequence. Following the first-in, first-out (FIFO) principle, at time (t+166.5) ms, the HAL layer retrieves camera request 6 from the queue and processes it. In response to processing camera request 6, the camera module can acquire image frame F based on the initial zoom level and send it to the application framework layer via the HAL layer. The application framework layer then sends image frame F to the camera application, which can then display image frame F.

[0185] Similarly, at time (t+199.8) ms, the HAL layer receives zoom request 7 and places it in the pending request queue according to the time sequence. Following the first-in, first-out principle, at time (t+199.8) ms, the HAL layer retrieves zoom request 1 from the queue and processes it. In response to processing camera request 7, the camera module can acquire image frame G based on the initial zoom level and send it to the application framework layer via the HAL layer. The application framework layer then sends image frame G to the camera application, which can then display image frame G.

[0186] As can be seen from the analysis in Figure 4, the HAL layer will only respond to the zoom request corresponding to the user's zoom operation 199.8ms after receiving the user's zoom operation, which will cause zoom lag and affect the user experience.

[0187] Defect 3: During the zoom process, from the time the electronic device 100 sends a zoom request from the camera application to the time it obtains the image frame and sends the image frame to the rendering process module for rendering, the processing time for each zoom request in the electronic device 100 may be different, which may result in frame loss. This causes uneven display of the image frames by the electronic device 100, which may cause the zoom preview displayed by the electronic device to stutter during the zoom process, thus affecting the user experience.

[0188] For example, as shown in Figure 5, taking the rendering cycle of the rendering process module as 33.3ms as an example, the scene is shown where the rendering process module discards image frames when the speed at which the electronic device 100 continuously sends image frames to the rendering process module exceeds the rendering capability of the electronic device 100.

[0189] As shown in Figure 5, image frame A is sent to the rendering process module. After image frame A is rendered, the electronic device can display image frame A. Then, image frame B can be sent to the rendering process module. After image frame B is rendered, the electronic device can display image frame B. Then, image frame C can be sent to the rendering process module. After image frame C is rendered, the electronic device can display C. Then, image frame D can be sent to the rendering process module. After image frame D is rendered, the electronic device can display image frame D. While the rendering process module is still processing image frame D, image frame E has already been sent to the rendering process module, and the rendering process module will discard image frame E. After image frame D is successfully displayed, the electronic device 100 can wait for image frame F. When image frame F is sent to the rendering process module, the rendering process module can render image frame F and display image frame F.

[0190] As can be seen from the analysis of Figure 5, when the electronic device 100 displays image frame D, because image frame E is discarded, the electronic device 100 will experience a stutter while waiting for image frame F to be displayed, resulting in uneven display time for each image frame.

[0191] Based on the above analysis, this application provides a method for adjusting shooting parameters. The method includes the following steps;

[0192] Step 1: Electronic device 100 receives user input to change shooting parameters and determines initial shooting parameters and target shooting parameters.

[0193] When the electronic device 100 displays the photo preview interface or video preview interface of a camera application, the user can change the shooting parameters, adjusting them from the initial shooting parameters to the target shooting parameters. Shooting parameters may include, but are not limited to, any of the following: focal length, exposure, aperture, white balance, sharpness, contrast, saturation, etc.

[0194] The initial shooting parameter value refers to the shooting parameter value before the current shooting parameter adjustment operation is detected, while the target shooting parameter value is the shooting parameter value after the adjustment trigger operation is detected.

[0195] For example, the shooting parameter can be the focal length. The electronic device 100 can increase the zoom ratio of the camera application based on user operation. For example, if the electronic device 100 increases the zoom ratio from 1X to 5X based on user operation, then the initial zoom ratio is 1X and the target zoom ratio is 5X.

[0196] Electronic device 100 can also reduce the zoom ratio of the camera application based on user operation. For example, if electronic device 100 reduces the zoom ratio from 1X to 0.5X based on user operation, then the initial zoom ratio is 1X and the target zoom ratio is 0.5X.

[0197] Step 2: The electronic device 100 obtains a smooth adjustment curve based on the initial shooting parameters and the target shooting parameters.

[0198] Understandably, the smooth adjustment curve can include initial shooting parameters, one or more transitional shooting parameters, and a target shooting parameter. The electronic device can sequentially obtain preview image frames using the initial shooting parameters, one or more transitional shooting parameters, and the target shooting parameter. This avoids abrupt changes in the image that could occur if the electronic device directly adjusts the shooting parameters to the target shooting parameter.

[0199] For example, when the shooting parameter is zoom magnification, the electronic device 100 can obtain a focal length smoothing adjustment curve based on the initial zoom magnification and the target zoom magnification. The focal length smoothing adjustment curve is a curve that starts at the initial zoom magnification and ends at the target zoom magnification. The initial zoom magnification corresponds to time t1, and the target zoom magnification corresponds to time t2, where t2 is later than t1, and t1 is the time when the user selects to switch to the target zoom magnification. The focal length smoothing adjustment curve is used by the electronic device 100 to acquire multiple image frames sequentially through the initial zoom magnification, one or more zoom magnifications, and the target zoom magnification, achieving a smooth switch from the initial zoom magnification to the target zoom magnification.

[0200] Step 3: In response to a user's operation to change the shooting parameters, the electronic device 100 acquires the return frame time of the first image frame, which is the image captured by the camera, and determines the transition shooting parameter 1 from the smoothing adjustment curve based on the return frame time of the first image frame. The electronic device 100 determines the cropping ratio 1 based on the shooting parameters of the first image frame (e.g., the initial shooting parameters) and the transition shooting parameter 1, and crops the first image frame based on the cropping ratio 1 to obtain the transition image frame 1, and displays the transition image frame 1.

[0201] Subsequently, the electronic device 100 can obtain the return frame time of the second image frame, which is an image captured by the camera. The second image frame is then processed in the same way as the first image frame, which will not be elaborated here.

[0202] In some embodiments, the electronic device 100 may also determine the transition shooting parameter 2 from the smoothing adjustment curve based on the return frame time and preset duration of the first image frame. The electronic device 100 determines the cropping ratio 2 based on the shooting parameters (e.g., initial shooting parameters) of the first image frame and the transition shooting parameter 2, and crops the first image frame based on the cropping ratio 2 to obtain the transition image frame 2, and displays the transition image frame 2.

[0203] Optionally, the preset duration can be related to the output frame rate and the number of interpolated frames 'a' of the camera application. For example, the preset duration can be calculated as (a+1) / (1 / (output frame rate)). For instance, if the output frame rate of the camera application is 30 pfs, meaning the HAL layer returns one image frame to the application framework layer every 33.3 ms, the preset duration can be 16.7 ms when 'a' is 1.

[0204] In response to determining the transition shooting parameter 2, the electronic device 100 can modify the vsync signal period from a first value to a second value, which is greater than the first value, thereby increasing the display frame rate of the electronic device 100 and enabling the electronic device 100 to synthesize and display multiple transition image frames in a timely manner.

[0205] In some embodiments, after the transition image frame is displayed, the electronic device 100 modifies the period of the vsync signal from a second value to a first value.

[0206] In some embodiments, the electronic device 100 can calculate the rendering timing of each transition image frame based on the vsync signal period, so that the rendering duration of each transition image frame is fixed and uniform, and the frame rate of the screen seen by the user is stable.

[0207] Through the above method, on the one hand, the electronic device 100 can calculate one or more transition shooting parameters in real time, so that the electronic device 100 can acquire and display image frames in a timely manner according to one or more transition shooting parameters, so that the change of shooting parameters conforms to the preset smooth adjustment curve, and the shooting parameters can smoothly transition to the target shooting parameters, avoiding image shaking or stuttering, and improving the user's visual experience.

[0208] On the other hand, by copying and cropping image frames, the electronic device 100 can quickly display image frames in response to changes in shooting parameters without any delay in response.

[0209] On the other hand, during the process of changing shooting parameters, the electronic device 100 can control and change the vsync signal period, and associate the display timing of the transition image frame with the vsync signal period, so as to ensure that the electronic device 100 displays the image frame uniformly, thereby improving the user's visual experience.

[0210] The hardware structure of an electronic device 100 provided in the embodiments of this application is described below.

[0211] Figure 6 shows a schematic diagram of the structure of the electronic device 100.

[0212] The following description uses electronic device 100 as an example to illustrate the embodiment. It should be understood that the electronic device 100 shown in FIG. 6 is merely an example, and the electronic device 100 may have more or fewer components than those shown in FIG. 6, may combine two or more components, or may have different component configurations. The various components shown in FIG. 6 can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.

[0213] Electronic device 100 may include: processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0214] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, 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.

[0215] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0216] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.

[0217] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0218] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0219] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C buses. The processor 110 can couple to the touch sensor 180K, charger, flash, camera 193, etc., through different I2C bus interfaces. For example, the processor 110 can couple to the touch sensor 180K through the I2C interface, enabling the processor 110 and the touch sensor 180K to communicate through the I2C bus interface, thereby realizing the touch function of the electronic device 100.

[0220] The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface to enable the function of answering phone calls through a Bluetooth headset.

[0221] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via the PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering phone calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0222] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface to enable music playback through Bluetooth headphones.

[0223] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI) and a display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to enable the electronic device 100 to capture images. The processor 110 and the display screen 194 communicate via the DSI interface to enable the electronic device 100 to display images.

[0224] The GPIO interface can be configured via software. It can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to a camera 193, a display screen 194, a wireless communication module 160, an audio module 170, a sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0225] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.

[0226] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0227] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.

[0228] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.

[0229] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0230] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0231] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0232] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0233] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0234] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0235] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0236] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display panel can also be manufactured using organic light-emitting diodes (OLEDs), active-matrix organic light-emitting diodes (AMOLEDs), flexible light-emitting diodes (FLEDs), miniled, microled, micro-OLEDs, quantum dot light-emitting diodes (QLEDs), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.

[0237] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0238] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, converting it into an image visible to the naked eye. The ISP can also perform algorithmic optimization on image noise and brightness. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0239] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0240] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.

[0241] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0242] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0243] 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, music, video, and other files can be saved on the external memory card.

[0244] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0245] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0246] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.

[0247] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A.

[0248] The receiver 170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a telephone call or voice message, the receiver 170B can be brought close to the ear to listen to the voice.

[0249] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, electronic device 100 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.

[0250] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.

[0251] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the intensity of the touch operation based on pressure sensor 180A. Electronic device 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS is executed.

[0252] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 about three axes (i.e., the x, y, and z axes). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in navigation and motion-sensing game scenarios.

[0253] The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.

[0254] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip cover. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover using the magnetic sensor 180D. Then, based on the detected opening and closing state of the cover or the flip cover, features such as automatic flip unlocking can be set.

[0255] The 180E accelerometer can detect the magnitude of acceleration of electronic device 100 in various directions (typically three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of electronic devices and applied to applications such as screen orientation switching and pedometers.

[0256] A distance sensor 180F is used to measure distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, during a shooting scene, electronic device 100 can utilize the distance sensor 180F to measure distance for rapid focusing.

[0257] The proximity sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 may use the proximity sensor 180G to detect when a user holds the electronic device 100 close to their ear for a call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used in holster mode and pocket mode for automatic unlocking and locking of the screen.

[0258] The ambient light sensor 180L is used to sense the brightness of ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 based on the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also work with the proximity sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.

[0259] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can utilize the characteristics of the collected fingerprints to achieve fingerprint unlocking, accessing application locks, taking photos with fingerprints, answering calls with fingerprints, etc.

[0260] Temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 uses the temperature detected by temperature sensor 180J to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs thermal protection by reducing the performance of a processor located near temperature sensor 180J to reduce power consumption. In other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent abnormal shutdown of electronic device 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.

[0261] Touch sensor 180K, also known as a "touch panel," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touch screen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of electronic device 100, in a different position than display screen 194.

[0262] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from the vibrating bone segments of the human vocal cords. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure signals. In some embodiments, the bone conduction sensor 180M can also be incorporated into headphones to form bone conduction headphones. The audio module 170 can parse the voice signals from the vibrating bone segments of the vocal cords acquired by the bone conduction sensor 180M to realize voice functionality. The application processor can parse heart rate information from the blood pressure signals acquired by the bone conduction sensor 180M to realize heart rate detection functionality.

[0263] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.

[0264] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 194. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.

[0265] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.

[0266] The SIM card interface 195 is used to connect the SIM card.

[0267] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.

[0268] Figure 7 is a software structure block diagram of an electronic device 100 according to an embodiment of the present invention.

[0269] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, from top to bottom, these layers are the application layer, application framework layer, HAL layer, driver layer, and hardware layer.

[0270] The application layer can include a series of application packages.

[0271] As shown in Figure 7, the application package may include a camera application, and may also include applications such as gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS, which are not shown in Figure 7.

[0272] The camera application includes, but is not limited to, a camera request sending module. This module can be used to send camera requests and focus adjustment requests to the application framework layer. Camera requests can include, but are not limited to, preview requests and photo-taking requests.

[0273] The preview request can be sent after the camera app is opened. The photo capture request can be sent after the camera app detects a photo capture operation. The focus adjustment request can be sent after the camera app detects a focus adjustment operation.

[0274] The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer includes some predefined functions. It may include a window manager, content providers, a view system, a phone manager, a resource manager, a notification manager, etc. The window manager manages window programs. It can obtain the screen size, determine if a status bar is present, lock the screen, and capture the screen. The content provider stores and retrieves data, making this data accessible to applications. This data may include video, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be used to build applications. The display interface can consist of one or more views. For example, a display interface including a text notification icon may include a view for displaying text and a view for displaying images. The phone manager provides communication functions for the electronic device 100, such as managing call status (including connection, hang-up, etc.). The resource manager provides various resources for the application, such as localized strings, icons, images, layout files, video files, etc. The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0275] As shown in Figure 7, the application framework layer also includes a shooting parameter generation module, a request queue processing module, an allocation buffer interface, a result processing module, an image cropping module, a vsync signal listening module, a display thread, a timer, a buffer manager, and a rendering process surface flinger.

[0276] The shooting parameter generation module is used to generate a smooth adjustment curve based on the initial shooting parameters and the target shooting parameters sent by the camera application when it detects that the user has adjusted the shooting parameters. It also determines one or more transition shooting parameters based on the image frame return time and the smooth adjustment curve.

[0277] The shooting parameter generation module is also used to send a transitional shooting parameter to the HAL layer when it detects that the HAL layer is uploading an image frame to the result processing module. The HAL layer then sends the transitional shooting parameter to the camera module, so that the camera module can acquire the image frame based on the transitional shooting parameter.

[0278] In some embodiments, the shooting parameter generation module may also be located in the HAL layer. This application does not limit the location of the shooting parameter generation module.

[0279] The functions of the request queue processing module and the allocation cache interface can be found in the description in the embodiment of Figure 2, and will not be repeated here.

[0280] The result processing module is used to receive image frames and image frame shooting parameters sent by the HAL layer, or to store the buffer address of the image frame and image frame shooting parameters.

[0281] The result processing module is also used to send the image frame and the image frame's shooting parameters, or the buffer address storing the image frame and the image frame's shooting parameters, to the image cropping module.

[0282] In some embodiments, the result processing module is further configured to store the image frame and the image frame's shooting parameters, or the buffer address storing the image frame and the image frame's shooting parameters, in a buffer manager.

[0283] The image cropping module acquires the return frame time of an image frame and sends it to the shooting parameter generation module. The shooting parameter generation module obtains transition shooting parameters 1 based on the return frame time and a smoothing adjustment curve. The image cropping module then determines the cropping ratio based on the image frame's shooting parameters and transition shooting parameters 1, and crops the image frame received by the result processing module according to the cropping ratio to obtain transition image frame 1. Finally, it sends transition image frame 1 or the buffer address storing transition image frame 1 to the buffer manager.

[0284] In some embodiments, the image cropping module is further configured to determine the transition shooting parameter 2 from the smoothing adjustment curve based on the image frame's return frame time and a preset duration. The image cropping module determines the cropping ratio 2 based on the image frame's shooting parameters and the transition shooting parameter 2, and crops the image frame based on the cropping ratio 2 to obtain the transition image frame 2. The transition image frame 2, or the buffer address storing the transition image frame A2, is then sent to the buffer manager.

[0285] The preset duration can be related to the output frame rate and the number of interpolated frames 'a' of the camera application. For example, the preset duration can be calculated as (a+1) / (1 / (output frame rate)). For instance, if the output frame rate of the camera application is 30 pfs, meaning the HAL layer returns one image frame to the application framework layer every 33.3 ms, the preset duration can be 16.7 ms when 'a' is 1.

[0286] For example, if the camera application outputs an image frame rate of 60pfs, meaning the HAL layer returns an image frame to the application framework layer every 16.7ms, the preset duration can be 8.35ms when 'a' is 1.

[0287] The buffer manager is used to store image frames to be displayed or to store the buffer addresses of image frames to be displayed.

[0288] The buffer manager is also used to send the stored image frame or the address of the buffer containing the image frame to the display thread when the display thread acquires an image frame.

[0289] The display thread is used to determine when to retrieve the next image frame to be displayed from the buffer manager based on the vsync signal period or the timer period.

[0290] Specifically, in one possible implementation, the display thread can retrieve the next image frame to be displayed from the buffer manager after an interval of m vsync signal cycles since the previous image frame was displayed, and then send the retrieved image frame to the camera application. The camera application can then send the retrieved image frame to the rendering process module.

[0291] Optionally, in one possible implementation, the display thread can also retrieve the next image frame to be displayed from the buffer manager after a timer display cycle has elapsed since the previous image frame was displayed, and then send the retrieved image frame to the camera application. The camera application can then send the retrieved image frame to the rendering process module.

[0292] The vsync signal listening module is used to listen to the vsync signal cycle in the rendering process and send the vsync signal cycle to the display process.

[0293] A timer can be used to send a timer period signal to the display thread. The timer period can be determined by the screen refresh rate of the electronic device.

[0294] The rendering process module is used to render the image frames sent by the camera application and send the rendering results (i.e., the rendered image frames) back to the camera application, which can then display the rendering results.

[0295] In some embodiments, the application framework layer may also be referred to as the application framework layer.

[0296] The Hardware Abstraction Layer (HAL) is an interface layer located between the application framework layer and the hardware layer, providing a virtual hardware platform for the operating system.

[0297] The HAL layer can be used to receive camera requests from the application framework layer and send the camera parameters and buffer address of the camera request to the camera module. It can also call an interface that returns results (e.g., ProcessCaptureResult) to send the image frames acquired by the camera module according to the camera parameters to the result processing module in the application framework layer.

[0298] Optionally, the HAL layer can store the image frames acquired by the camera module into the corresponding buffer address requested by the camera, and send the image frame or the buffer address of the image frame to the result processing module in the application framework layer.

[0299] In some embodiments, the HAL layer is also used to send camera parameters of the image frame to the result processing module. For example, camera parameters may be shooting parameters corresponding to the image frame, such as initial shooting parameters, transition shooting parameters, or target shooting parameters.

[0300] In some embodiments, the HAL layer is further configured to send the return frame time of the image frame to the result processing module. The return frame time of the image frame is the time when the HAL layer sends the image frame to the result processing module.

[0301] The driver layer includes, but is not limited to, camera drivers and display drivers. The camera driver is used to drive the camera module to capture image frames, and the display driver is used to drive the display to show the image frames.

[0302] The hardware layer may include a camera module, an image signal processor, a display, etc. The camera module may include image sensors for one or more cameras (e.g., image sensor 1, image sensor 2, etc.). Optionally, the camera module may also include a time-of-flight (TOF) sensor, a multispectral sensor, etc. The image signal processor can be used to process the image frames acquired by the camera module. The display can be used to display the image frames sent by the camera application.

[0303] The following description, in conjunction with the UI diagram, describes how the electronic device 100 provided in this application adjusts shooting parameters based on user operation.

[0304] This application uses zoom ratio as an example to illustrate the embodiments.

[0305] Figures 8A-8I illustrate schematic diagrams of an electronic device 100 adjusting the zoom level of a camera application based on user operation.

[0306] In some embodiments, electronic device 100 can receive user input to increase the zoom level of the camera application. In other embodiments, electronic device 100 can receive user input to decrease the zoom level of the camera application.

[0307] Increase the zoom ratio of camera applications

[0308] Figures 8A-8E illustrate schematic diagrams of how electronic device 100 increases the zoom ratio of a camera application based on user operation.

[0309] As shown in Figure 8A, the electronic device 100 can display a desktop with a page containing application icons. This page includes multiple application icons (e.g., settings app icon, app store app icon, gallery app icon, browser app icon, etc.). Below these application icons, a page indicator is displayed to indicate the positional relationship between the currently displayed page and other pages. Below the page indicator is a tray area. This tray area includes multiple tray icons, such as a camera app icon, a contacts app icon, a phone app icon, and a messaging app icon. The tray area remains displayed during page switching. In some embodiments, the page may also include multiple application icons and a page indicator. The page indicator may not be part of the page and may exist independently. The tray icons are also optional, and this embodiment does not impose any limitations on this.

[0310] The electronic device 100 can receive input from a user on a camera application icon (e.g., a click), and in response to this input operation, the electronic device 100 can display a user interface as shown in FIG8B. FIG8B is a user interface for shooting and display services provided by an electronic device 100 according to an embodiment of this application, and can also be referred to as a preview interface.

[0311] As shown in Figure 8B, the preview interface may include a mode bar 501, shooting controls 502, a preview window 503, a playback control 504, a quick function area 505, and a focus adjustment option 506.

[0312] The mode bar 501 may include multiple shooting mode options, such as "Night Scene," "Portrait," "Photo," and "Video." Different shooting modes provide users with different shooting effects. Users can select any of the multiple shooting modes to shoot according to different needs. For example, "Photo" can be the default shooting mode for taking photos. "Video" is used for recording videos. "Night Scene" mode is suitable for shooting scenes with low light, such as at night. "Portrait" mode is suitable for shooting scenes where the subject is a person. Electronic device 100 may also provide more shooting modes, such as "Large Aperture," "Movie," and "Professional," which will not be listed here.

[0313] Electronic device 100 can detect user operations performed on the shooting mode options in mode bar 501, and change the currently used shooting mode according to the user operations. These user operations include, for example, left / right swipes. For instance, when it detects that the mode bar 501 is dragged to the left (left swipe operation) and the cursor stops at the "Portrait" option, electronic device 100 can switch to "Portrait" mode. By default, electronic device 100 first uses "Photo" mode.

[0314] The shooting control 502 is used to trigger taking a picture. The electronic device 100 can detect whether there is a user operation on the shooting control 502, such as a click operation. When a user operation on the shooting control 502 is detected, the electronic device 100 can generate a picture-taking command. The electronic device 100 can acquire the image reported by the camera with the corresponding timestamp according to the picture-taking command, and then save it as a photo.

[0315] The preview window 503 can be used to display images reported by the camera in real time. In different shooting modes, the electronic device 100 can process the images reported by the camera to improve the image display effect. For example, in "portrait" mode, the electronic device 100 can blur the background in the image reported by the camera to highlight the portrait. Here, the preview window 503 can display images processed by image processing algorithms corresponding to different shooting modes in real time, allowing users to perceive the shooting effects corresponding to different shooting modes in real time.

[0316] The playback control 504 can be used to browse thumbnails of previously taken photos / videos. When a user action is detected on the playback control 504, the electronic device 100 can also display the best photo corresponding to that thumbnail.

[0317] The quick access control area 505 may include controls 505A for the main character recording mode, 505B for AI scene recognition, 505C for flash, 505D for color mode, and 505E for settings. Control 505A for the main character recording mode can be used to trigger the electronic device 100 to identify the main character among multiple people in the preview screen when enabled. Control 505B for AI scene recognition can be used to trigger the electronic device 100 to identify the shooting scene in the preview screen when enabled; currently, control 505B is disabled. Control 505C for flash can be used to trigger the electronic device 100 to turn the flash on or off. Control 505D for color mode can be used to trigger the electronic device 100 to process the image captured by the camera using a color filter. Control 505E for settings can be used to set shooting parameters of the electronic device 100 (e.g., image size, image storage format, etc.), enable the "automatic capture" function of the electronic device 100, etc.

[0318] The focus adjustment option 506 shows several zoom ratio options, such as 0.5x zoom, 1x zoom, 2.5x zoom, and 10x zoom.

[0319] The current zoom level is 1x. Preview window 503 displays an image frame captured by electronic device 100 at a zoom level of 1x.

[0320] As shown in Figure 8B, the electronic device 100 can receive input from the user for the 2.5x zoom ratio option in the focus adjustment option 506. In response to the user's input, the electronic device 100 can switch the zoom ratio from 1x to 2.5x.

[0321] In response to the electronic device 100 switching the zoom ratio from 1x to 2.5x, the electronic device 100 can determine multiple transition zoom ratios based on the initial zoom ratio of 1x and the target zoom ratio of 2.5x. For example, the multiple transition zoom ratios can be 1.4x and 1.9x.

[0322] Optionally, and not limited to determining two transition zoom ratios, the electronic device 100 may also determine other, more or fewer, transition zoom ratios, which is not limited in this application. The values ​​of the initial zoom ratio, target zoom ratio, and multiple transition zoom ratios here may also be other values. This application is only used as an example to explain this application and does not constitute a limitation.

[0323] In response to the electronic device 100 determining multiple transition zoom magnifications, the electronic device 100 can sequentially acquire and display image frames based on the multiple transition zoom magnifications.

[0324] As shown in Figures 8C-8D, Figure 8C shows an image frame acquired by the electronic device 100 at a zoom ratio of 1.4x, and Figure 8D shows an image frame acquired by the electronic device 100 at a zoom ratio of 1.9x.

[0325] Subsequently, the electronic device 100 continuously acquires and displays image frames at the target zoom ratio of 2.5x. Figure 8E shows the image frames acquired by the electronic device 100 at a zoom ratio of 2.5x.

[0326] As can be seen from Figures 8A-8E, when the electronic device 100 increases the zoom ratio based on user operation, the electronic device 100 can smoothly switch to the target zoom ratio through multiple transition zoom ratios in sequence, thus achieving a smooth switch from the initial zoom ratio to the target zoom ratio.

[0327] Reduce the zoom level of the camera application.

[0328] Figures 8F-8I illustrate schematic diagrams of an electronic device 100 reducing the zoom ratio of a camera application based on user operation.

[0329] The electronic device 100 can display a preview interface of the camera application shown in Figure 8F. The current zoom ratio is 2.5x. The preview window 503 displays image frames captured by the electronic device 100 at a zoom ratio of 2.5x.

[0330] As shown in Figure 8F, the electronic device 100 can receive input from the user for the 1x zoom ratio option in the focus adjustment option 506. In response to the user's input, the electronic device 100 can switch the zoom ratio from 2.5x to 1x.

[0331] In response to the electronic device 100 switching the zoom ratio from 2.5x to 1x, the electronic device 100 can determine multiple transition zoom ratios based on the initial zoom ratio of 2.5x and the target zoom ratio of 1x. For example, the multiple transition zoom ratios can be 1.9x and 1.4x.

[0332] Optionally, and not limited to determining two transition zoom ratios, the electronic device 100 may also determine other, more or fewer, transition zoom ratios, which is not limited in this application. The values ​​of the initial zoom ratio, target zoom ratio, and multiple transition zoom ratios here may also be other values. This application is only used as an example to explain this application and does not constitute a limitation.

[0333] In response to the electronic device 100 determining multiple transition zoom magnifications, the electronic device 100 can sequentially acquire and display image frames based on the multiple transition zoom magnifications.

[0334] As shown in Figures 8G-8H, Figure 8G shows an image frame acquired by the electronic device 100 at a zoom ratio of 1.9x, and Figure 8H shows an image frame acquired by the electronic device 100 at a zoom ratio of 1.4x.

[0335] Subsequently, the electronic device 100 continuously acquires and displays image frames at the target zoom ratio of 1x. Figure 8I shows an image frame acquired by the electronic device 100 at a 1x zoom ratio.

[0336] As can be seen from Figures 8F-8I, when the electronic device 100 reduces the zoom ratio based on user operation, the electronic device 100 can smoothly switch to the target zoom ratio through multiple transition zoom ratios in sequence, thus achieving a smooth switch from the initial zoom ratio to the target zoom ratio.

[0337] It should be noted that Figures 8A-8I above are illustrated using the example of a user changing the zoom level in the camera application's photo preview interface. In other embodiments, the user can also change the zoom level in the camera application's video preview interface; this application does not limit the application scenario for changing the zoom level.

[0338] Figure 9A shows a software architecture diagram of an electronic device 100 acquiring images at an initial zoom level according to an embodiment of this application.

[0339] As shown in Figure 9A, the software architecture of electronic device 100 includes, but is not limited to: an application layer (such as a camera application), an application framework layer, a hardware abstraction layer (HAL), and the interaction and cooperation between hardware. The application layer mainly involves the camera request sending module within the camera application. The application framework layer mainly involves the request queue processing module, the buffer allocation interface, the result processing module, the surface flinger rendering process, timers, the vsync signal listening module, the display thread, and the buffer manager. The hardware mainly includes the camera module and the display, etc.

[0340] Before the electronic device 100 receives a user operation to change the zoom ratio, the electronic device 100 can acquire and display an image at the initial zoom ratio.

[0341] Including, but not limited to, the following steps:

[0342] 1. The vsync signal listening module listens for the vsync signal cycle from the rendering process.

[0343] 2. The vsync signal listening module periodically sends the vsync signal to the display thread.

[0344] When electronic device 100 receives a user's command to open the camera application, electronic device 100 launches the camera application. The vsync signal listening module can listen to the vsync signal cycle in the rendering process and send the vsync signal cycle to the display process.

[0345] 3. The timer sends the timing information to the display thread.

[0346] A timer can be used to send a timer period signal to the display thread. The timer period can be determined by the screen refresh rate of the electronic device 100. For example, if the screen refresh rate of the electronic device 100 is 30Hz, and the rendering process renders one image frame every 33.3ms, then the timing information could be 33.3ms.

[0347] It should be noted that steps 1-3 are executed continuously / irregularly / periodically after the camera application is opened.

[0348] 4. When electronic device 100 receives the user's command to open the camera application, electronic device 100 launches the camera application. The camera application can issue multiple camera requests to obtain preview images. The first camera request issued by the camera application to obtain preview images can fill the N buffers reserved for camera requests in the cache area.

[0349] Optionally, once the camera app is enabled, it can send a camera request to the application framework layer only once if the shooting parameters remain unchanged.

[0350] The process by which electronic device 100 processes camera requests sent by camera applications and displays image frames can be found in steps 6 to 14, which describe how electronic device 100 processes zoom adjustment requests and displays image frames. This application will not repeat the details here.

[0351] The camera application sends camera requests to the request queue processing module in the application framework layer.

[0352] Electronic device 100 can receive a user's action to open the camera application. Based on this action, the camera application can send a camera request to the application framework layer, which carries the initial zoom level.

[0353] 5. Request the queue processing module to get the buffer.

[0354] In some embodiments, the application framework layer may include an Allocate Buffer interface. In response to a camera request sent by the camera application, the Prepare HAL Request module may send a request to the Allocate Buffer interface to obtain a free buffer and allocate a free buffer for the camera request.

[0355] 6. The request queue processing module allocates cache for camera requests.

[0356] Electronic device 100 can send the camera request to the HAL request preparation module in the request queue processing module. When there is an empty buffer among N buffers in the buffer area of ​​electronic device 100, the HAL request preparation module obtains the Allocate Buffer interface to allocate a buffer address for the camera request and can store the camera request in the buffer.

[0357] 7. The request queue processing module sends a camera request to the HAL layer.

[0358] After allocating a cache for the camera request, the application framework layer sends the camera request to the HAL layer. The camera request carries the initial zoom level. The camera request may also carry other data, which is not limited in this application.

[0359] Specifically, the HAL request preparation module can construct the camera request into a HAL layer Capture request and send it to the HAL layer through the batch processing request module. The HAL layer then sends the camera parameters in the Capture request and the buffer address of the Capture request to the camera module. The camera parameters in the Capture request may include, but are not limited to, the initial zoom level.

[0360] 8. The HAL layer sends a camera request to the camera module.

[0361] In response to the camera request sent by the application framework layer, the HAL layer then sends the camera request to the camera module.

[0362] 9. Electronic device 100 turns on the camera, acquires the image frame captured by the camera based on the initial zoom magnification, and sends the image frame to the HAL layer.

[0363] The camera module in the electronic device 100 can receive a camera request and the buffer address of the camera from the HAL layer. Then, the camera module can acquire image frames according to camera parameters (e.g., initial zoom level) and store the acquired image frames in the buffer corresponding to the buffer address carried by the zoom level adjustment request.

[0364] In some examples, the image frames acquired by the camera module can be transmitted to the image signal processor, which can preprocess the image frames and then upload them to the HAL layer via the camera driver or the image processor driver.

[0365] 10. The HAL layer uploads the image frames to the result processing module in the application framework layer.

[0366] After receiving the image frame uploaded by the image signal processor, the HAL layer then uploads the image frame to the result processing module in the application framework layer.

[0367] In some examples, the HAL layer can upload image frames to the camera application through the application framework layer, and the camera application can process the image frame before sending it to the result processing module.

[0368] 11. The result processing module sends the return frame time of the image frame to the image cropping module.

[0369] 12. The image cropping module sends the return frame time of the image frame to the shooting parameter generation module.

[0370] 13. The result processing module sends the image frame to the buffer manager.

[0371] After receiving the image frame sent by the HAL layer, the result processing module stores the image frame in the buffer manager, so that the buffer manager can cache the image frame and send the cached image frame to the display thread at the appropriate time.

[0372] The result processing module also needs to send the image frame return time to the image cropping module, which then sends the image frame return time to the shooting parameter generation module so that the subsequent shooting parameter generation module can determine one or more transition zoom ratios based on the image frame return time.

[0373] Optionally, the result processing module can also directly send the return frame time of the image frame to the shooting parameter generation module.

[0374] 14. The display thread can determine when to retrieve the next image frame to be displayed from the buffer manager based on the vsync signal period or the timer period. It then sends a request to the buffer manager to retrieve the image frame based on the timing of the next image frame to be displayed.

[0375] 15. The display thread retrieves image frames from the buffer manager.

[0376] In one possible implementation, the display thread can be used to obtain the next image frame to be displayed from the buffer manager after an interval of m vsync signal cycles from the time the previous image frame was displayed.

[0377] In one possible implementation, the display thread can also obtain the next image frame to be displayed from the buffer manager after the timer's display cycle has elapsed since the previous image frame was displayed.

[0378] 16. The display thread sends the acquired image frame to the surface flinger.

[0379] 17. The rendering process, surface flinger, renders the image frames and sends the rendered image frames to the camera application.

[0380] 18. The camera application sends the rendered image frames to the display.

[0381] In some embodiments, after the display sending thread obtains the image frame from the buffer manager, it can first send the image frame to the camera application. The camera application then sends the image frame to the surface flinger, which renders the image frame and sends the rendered image frame back to the camera application. The camera application then sends the rendered image frame to the display.

[0382] Figure 9B shows a schematic flowchart of a shooting method provided in an embodiment of this application.

[0383] This method can be implemented based on the interaction and cooperation between the application layer (such as a camera application), the application framework layer, the hardware abstraction layer (HAL), and the hardware within the electronic device. The application layer mainly involves the camera request sending module within the camera application. The application framework layer mainly involves modules such as the request queue processing module, the buffer allocation interface, the result processing module, the surface rendering process, timers, the display thread, and the buffer manager. The hardware mainly includes the camera module and the display, etc.

[0384] S901-S918 illustrate the process by which electronic device 100 acquires and displays image frames at an initial zoom level before the user changes the zoom ratio.

[0385] S901, the user clicks the "Camera" desktop icon.

[0386] Electronic device 100 can detect when a user opens a camera application, such as when the user clicks the "camera" desktop icon.

[0387] The S902 vsync signal listening module listens for and obtains the vsync signal cycle from the rendering process.

[0388] The period of the vsync signal is determined by the screen refresh rate, and it is the reciprocal of the screen refresh rate. For example, when the screen refresh rate is 120Hz, the period of the vsync signal can be 8.3ms; when the screen refresh rate is 60Hz, the period of the vsync signal can be 16.6ms; and when the screen refresh rate is 30Hz, the period of the vsync signal can be 33.3ms.

[0389] The screen refresh rate refers to the number of times the display screen on an electronic device refreshes the displayed image frames per second. Generally, the refresh rate of an electronic device's display screen is related to fixed parameters of the display screen and is a fixed value.

[0390] Electronic devices can support multiple selectable screen refresh rates, which may include at least a minimum screen refresh rate and a maximum screen refresh rate.

[0391] Optionally, the multiple selectable screen refresh rates can have only two selectable screen refresh rates: one is the highest screen refresh rate, and the other is the lowest screen refresh rate. For example, the two selectable screen refresh rates are 60Hz and 90Hz. Here, 60Hz is the lowest screen refresh rate among the multiple selectable screen refresh rates, and 90Hz is the highest screen refresh rate among the multiple selectable screen refresh rates.

[0392] Optionally, the multiple selectable screen refresh rates may include even more selectable screen refresh rates. For example, three selectable screen refresh rates may be included: 60Hz, 90Hz, and 120Hz. 60Hz is the lowest selectable screen refresh rate, and 120Hz is the highest selectable screen refresh rate.

[0393] Understandably, depending on actual needs, multiple selectable screen refresh rates can include even more screen refresh rates. Furthermore, there can be many different choices among the selectable screen refresh rates; this is not limited here.

[0394] The vsync listener module can listen for the vsync signal in the rendering process module.

[0395] Understandably, after the camera application starts, the vsync listening module can begin periodically / irregularly listening to the vsync signal in the rendering process module. That is, S901 is continuously executed throughout the entire process of the electronic device 100 processing the camera request.

[0396] For example, the vsync signal period can be 33.3ms, meaning that the rendering process will emit a vsync signal every 33.3ms.

[0397] The vsync signal cycle is used to control the progress of the rendering process in rendering image frames. Between two vsync signals (or one vsync signal cycle), the rendering process will only render one image frame to be displayed, avoiding the situation where the rendering process continuously sends two image frames to be displayed within one vsync signal cycle, which would cause frame drops and stuttering.

[0398] The S903 vsync signal monitoring module periodically sends the acquired vsync signal to the display process module.

[0399] The rendering process module can emit a vsync signal when rendering image frames. The vsync listener module can detect the rising and falling edges of the vsync signal. The vsync signal can change periodically.

[0400] The vsync monitoring module can send a vsync signal cycle or a vsync signal to the display process module when it detects a change in the rising or falling edge of the vsync signal.

[0401] Optionally, the vsync listener module can notify the display process module once every vsync signal cycle. Alternatively, the vsync listener module can notify the display process module once every time it detects a vsync signal.

[0402] S904, the display process module obtains one image frame from the buffer manager every m vsync signal cycles.

[0403] The display process module can retrieve an image frame from the buffer manager for rendering every m vsync signal cycles. m is a positive integer greater than or equal to 1.

[0404] The value of 'm' is related to the display frame rate of the camera application and the period of the vsync signal. The display frame rate indicates the speed at which the application sends and displays image frames. The higher the display frame rate, the faster the application sends and displays image frames, resulting in a smoother display. The unit of display frame rate is FPS. For example, when the display frame rate is 120 FPS, the application sends and displays one image frame every 8.3 ms; when the display frame rate is 60 FPS, the application sends and displays one image frame every 16.6 ms; and when the display frame rate is 30 FPS, the application sends and displays one image frame every 33.3 ms.

[0405] In some embodiments, if the display frame rate is greater than the screen refresh frame rate, for example, if the display frame rate is 120 FPS and the vsync signal period is 16.6 ms, it indicates that the rendering capability of the rendering process is lower than the display capability of the application. Within one vsync signal period, for every frame rendered by the rendering process, the application needs to send two image frames to display.

[0406] In some embodiments, if the display frame rate is equal to the screen refresh frame rate, for example, if the display frame rate is 60 FPS and the vsync signal period is 16.6 ms, it means that the rendering capability of the rendering process is comparable to the display capability of the application. Within one vsync signal period, for every frame rendered by the rendering process, the application needs to send one image frame to be displayed.

[0407] In some embodiments, if the display frame rate is less than the screen refresh frame rate, for example, if the display frame rate is 30 FPS and the vsync signal period is 16.6 ms, it means that the rendering capability of the rendering process is higher than the display capability of the application. Within two vsync signal periods, the rendering process renders two screen frames, and the application will send one image frame to display. At this time, the image frame rendering capability is too fast, resulting in the accumulation of image frames.

[0408] To avoid the rendering process's rendering capability exceeding the application's display capability, resulting in image frame stacking, the value of m can be determined based on the camera application's display frame rate and the vsync signal period. Every m vsync signal periods, the rendering process renders another image frame, ensuring that the rendering process's rendering capability is comparable to the application's display capability, thus preventing image frame stacking.

[0409] For example, the value of m can be determined based on m = 1000ms / display frame rate / vsync signal period. The value of m can also be determined using other methods, which are not limited in this application.

[0410] In some embodiments, if the display frame rate is greater than the screen refresh rate and the value of m is less than 1, then the value of m is set to 1. For example, when the display frame rate is 120 FPS and the vsync signal period is 16.6 ms, the value of m is 1.

[0411] In some embodiments, if the display frame rate equals the screen refresh rate, the value of m is 1. For example, when the display frame rate is 60 FPS and the vsync signal period is 16.6 ms, the value of m is 1.

[0412] In some embodiments, if the display frame rate is less than the screen refresh rate, the value of m is greater than 1. For example, when the display frame rate is 30 FPS and the vsync signal period is 16.6 ms, the value of m is 2.

[0413] Optionally, in some embodiments, if the display process does not receive m vsync signal cycles from the vsync monitoring module after displaying an image frame, the display process can determine the rendering time of the next image frame based on the timestamp sent by the timer.

[0414] For example, the display sending process determines the rendering time of the next image frame based on the timestamp sent by the timer, which can be implemented as follows: when the time interval between the timestamp of the previous image frame already sent to rendering and the timestamp of the next image frame to be sent to rendering is greater than a preset time interval, the display sending process sends the next image frame to be sent to rendering to the rendering process for rendering. For example, the timestamp of the image frame in buffer0 is time t1, and the timestamp of the image frame in buffer1 is time 2. After the display sending process sends the image frame in buffer0 to the rendering process at time t1, when it is determined at time 2 that the time interval between time 2 and time 1 is greater than the preset time interval, the display sending process then sends the image frame in buffer1 to the rendering process.

[0415] Optionally, the display sending process sends the image frames in buffer1 to the rendering process, which may include: the display sending process uploading the address of buffer1 to the camera application. After receiving the address of buffer1, the camera application can notify the rendering process module in the application framework layer to perform rendering, and inform the rendering process module of the address of buffer1. The rendering process module can retrieve the image frames from buffer1 based on the address of buffer1 and render the image frames. Then the rendering process module can send the rendering results to the camera application.

[0416] Optionally, the display sending process can also directly send the address of buffer1 to the rendering process module without sending it through the camera application. This application does not limit this.

[0417] Alternatively, the rendering process module can also render image frames directly in buffer1. Once rendering is complete, it can notify the camera application that rendering is finished. The camera application can then retrieve the rendered image frame from buffer1 and display it on the monitor.

[0418] Optionally, in one possible implementation, the vsync listener module may not execute S903-S904. When the vsync listener module detects the m-th vsync signal in the rendering process module, it can notify the display sending process module to acquire the image frame to be rendered. Then, when the vsync listener module detects the 2m-th vsync signal in the rendering process module, it can notify the display sending process module to acquire the next image frame to be rendered. Similarly, the vsync listener module notifies the display sending process module to acquire one image frame to be rendered every m vsync signal cycles.

[0419] Alternatively, in another possible implementation, the display sending process module can also receive the timestamp sent by the timer. When the time interval between the current time and the timestamp of the previous image frame sent to rendering is greater than or equal to a preset time interval, the display sending process module can obtain the image frame to be rendered from the buffer manager.

[0420] S905: In response to clicking the "Camera" desktop icon and opening the camera application, the camera request sending module sends the first camera request (initial zoom magnification) to the request queue processing module.

[0421] For example, as shown in Figure 8A, a user can click the camera application icon. In response to this user action, the electronic device 100 launches the camera application and displays a preview interface of the camera application, which may be the photo preview interface shown in Figure 8B.

[0422] Not limited to photo preview interface, the preview interface of the camera application can also be a video preview interface, and this application does not limit it in this regard.

[0423] In response to activating the camera application, the camera request sending module can obtain the initial zoom level and send the first camera request to the request queue processing module in the application framework layer.

[0424] The first camera request may include the initial zoom level. It may also include other parameters such as initial focal length, initial exposure, initial aperture, initial white balance, initial sharpness, initial contrast, and initial saturation.

[0425] For example, the initial zoom ratio can be 1x. The initial zoom ratio can also be 2.5x.

[0426] Optionally, the camera request sending module may first send the first camera request to the shooting parameter generation module in the application framework layer, and then the shooting parameter generation module may send the first camera request to the request queue processing module. This application does not limit this.

[0427] S906, The request queue processing module allocates the first buffer for the first camera request.

[0428] The first buffer is the idle buffer.

[0429] In some embodiments, the application framework layer may further include an Allocate Buffer interface, which is used to allocate a buffer for camera requests issued by the camera application. For example, the Allocate Buffer interface can specify the address of a buffer for storing camera requests in the camera request.

[0430] In some embodiments, the request queue processing module may include the WaitForRequest module, the PrepareHALRequest module, and the SendRequestsBatch module.

[0431] The WaitForRequest module is used to keep the first camera request waiting in the request queue module in the event that none of the N buffers allocated to the camera application in the electronic device's buffer are empty. The PrepareHALRequest module is used to construct the HAL layer's Capture request and output buffers. The SendRequestsBatch module can be used to send the HAL layer's Capture request constructed by the PrepareHALRequest module to the HAL layer.

[0432] When there are empty buffers among the N buffers allocated to the camera application for the camera request, the PrepareHALRequest module can obtain the first buffer from the Allocate Buffer interface for the first camera request issued by the camera application and store the first camera request in the first buffer. Then, the PrepareHALRequest module can construct a Capture request for the HAL layer based on the first camera request and send the Capture request constructed by the PrepareHALRequest module to the HAL layer through the SendRequestsBatch module.

[0433] For example, N can be 8, meaning the number of buffers allocated by the electronic device 100 to the camera application for camera requests can be 8. N can also be other values, such as 7 or 9, etc. The embodiments of this application do not limit the value of N. The following description uses the value of N as 8 as an example.

[0434] S907, The request queue processing module sends the first camera request and the address of the first buffer to the HAL layer.

[0435] Optionally, the address of the first buffer can be carried in the first camera request and sent to the HAL layer, or the address of the first buffer can be sent to the HAL layer independently of the first camera request. This application does not limit this.

[0436] After receiving the first camera request and the address of the first buffer from the request queue processing module, the request queue processing module then sends the first camera request and the address of the first buffer to the HAL layer.

[0437] The S908 and HAL layers send the first camera request and the address of the first buffer to the camera module.

[0438] After receiving the first camera request and the address of the first buffer from the request queue processing module, the HAL layer then sends the first camera request and the address of the first buffer to the camera module.

[0439] S909: The camera module acquires and processes the raw image stream to obtain image frame A (initial zoom magnification).

[0440] After receiving the first camera request and the address of the first buffer sent by the HAL layer, the camera module responds to the first camera request by turning on and starting to acquire and process the raw image stream to obtain image frames. The image frames acquired by the camera module may include image frame A, which is the image frame acquired by the camera module at the initial zoom level.

[0441] S910, the camera module sends image frame A (initial zoom level) and the address of the first buffer to the HAL layer.

[0442] S911 and the HAL layer then send the image frame A (initial zoom level) and the address of the first buffer to the result processing module.

[0443] S912, the result processing module sends the image frame A (initial zoom level) and the address of the first buffer to the buffer manager.

[0444] After acquiring image frame A based on the initial zoom level, the camera module sends image frame A (initial zoom level) and the address of the first buffer to the HAL layer.

[0445] After obtaining the image frame A (initial zoom level) and the address of the first buffer sent by the camera module, the HAL layer then sends the image frame A (initial zoom level) and the address of the first buffer to the buffer manager.

[0446] S913, after m vsync signal cycles, the display process obtains image frame A from the buffer manager.

[0447] The display sending process module can retrieve image frames from the buffer manager every m vsync signal cycles. For example, after accumulating m vsync signal cycles, the display sending process can retrieve one image frame from the buffer manager, such as image frame A.

[0448] Optionally, the display sending process module can also receive timestamps sent by a timer. When the time interval between the current time and the timestamp of the previous image frame sent to rendering is greater than or equal to a preset time interval, the display sending process module can obtain the image frame to be rendered from the buffer manager. For example, the display sending process module can obtain image frame A to be rendered from the buffer manager.

[0449] S914, The display process sends the address of image frame A or the first buffer to the rendering process.

[0450] S915, The rendering process renders image frame A, and obtains the rendered image frame A.

[0451] After accumulating m vsync signal cycles, the display sending process can obtain image frame A from the buffer manager, and then send image frame A or the address of the first buffer to the rendering process.

[0452] After obtaining the address of image frame A or the first buffer, the rendering process can render image frame A and obtain the rendered image frame A.

[0453] In some examples, if the rendering process module obtains the address of the first buffer, it can render image frame A in the buffer corresponding to that address. Alternatively, if the rendering process module obtains the address of the first buffer, it can retrieve image frame A from the first buffer corresponding to that address and render image frame A.

[0454] S916, The rendering process sends the rendered image frame A or the address of the first buffer to the camera application.

[0455] S917, the camera application sends the rendered image frame A or the address of the first buffer to the display.

[0456] S918, The display shows the rendered image frame A.

[0457] In some embodiments, when the display shows the rendered image frame A, the request queue processing module can clear the buffer of image frame A, for example, clear the first buffer corresponding to the address of the first buffer.

[0458] The rendering process module can send the rendered image frame A or the address of the first buffer to the camera application. The camera application then sends the rendered image frame A or the address of the first buffer to the display.

[0459] After obtaining the address of the rendered image frame A or the first buffer, the monitor can display the rendered image frame A.

[0460] In some examples, if the display receives the address of the first buffer, the rendering process module can retrieve the rendered image frame A from the first buffer corresponding to the address of the first buffer and display the rendered image frame A.

[0461] In some embodiments, after m vsync signal cycles, the display sending process obtains image frame A from the buffer manager. The display sending process can first send image frame A or the address of the first buffer to the camera application. The camera application then sends image frame A or the address of the first buffer to the rendering process, which renders image frame A to obtain the rendered image frame A. Afterwards, the rendering process sends the rendered image frame A or the address of the first buffer to the camera application, which then sends the rendered image frame A or the address of the first buffer to the display, where the display shows the rendered image frame A.

[0462] For details on how the electronic device renders and displays frame A, please refer to the description in the embodiments of Figure 10 or Figure 11.

[0463] Optionally, the camera module can continuously / irregularly / periodically acquire image frames and report them to the buffer manager through the HAL layer. After image frame A, the camera module can continuously / irregularly / periodically acquire image frames B, C, D, E, etc., and render and display image frames B, C, D, and E.

[0464] The following section uses a timing diagram of the vsync signal cycle to explain how electronic device 100 renders and displays image frames.

[0465] Figure 10 shows a timing diagram of an electronic device 100 rendering and displaying image frames periodically with a vsync signal.

[0466] For example, the display frame rate can be 30 FPS, and the vsync signal period is 33.3 ms. Then m is 1, which means that the rendering process renders one image frame in each vsync signal period, and the camera application sends one image frame to be displayed in each vsync signal period.

[0467] As shown in Figure 10, between vertical synchronization signal 1 (vsync1) and vertical synchronization signal 2 (vsync2), the camera application can issue a rendering command A to the rendering process. In response to rendering command A, the rendering process can render image frame A and fill the rendered image frame A into a buffer, such as the first buffer. Simultaneously, between vertical synchronization signal 1 (vsync) and vertical synchronization signal 2 (vsync2), the camera application can send image frame 0 or the buffer of image frame 0 to the display, allowing the display to show image frame 0. That is, between time tms and time (t+33.3ms), the rendering process renders image frame A, and the display shows image frame 0.

[0468] Between vertical synchronization signal 2 (vsync2) and vertical synchronization signal 3 (vsync3), the camera application can issue rendering command B to the rendering process. In response to rendering command B, the rendering process can render image frame B and fill the buffer with the rendered image frame B. Simultaneously, between vertical synchronization signal 2 (vsync2) and vertical synchronization signal 3 (vsync3), the camera application can send image frame A or the buffer of image frame A to the display, allowing the display to show image frame A. That is, between (t+33.3ms) ms and (t+66.6ms), the rendering process renders image frame B, and the display shows image frame A.

[0469] Between vertical synchronization signal 3 (vsync3) and vertical synchronization signal 4 (vsync4), the camera application can issue a rendering command C to the rendering process. In response to rendering command C, the rendering process can render image frame C and fill the buffer with the rendered image frame C. Simultaneously, between vertical synchronization signal 3 (vsync3) and vertical synchronization signal 4 (vsync4), the camera application can send image frame B or the buffer of image frame B to the display, allowing the display to show image frame B. That is, between (t+66.6ms) ms and (t+99.9ms), the rendering process renders image frame C, and the display shows image frame B.

[0470] Between vertical synchronization signals 4 (vsync4) and 5 (vsync5), the camera application can issue a rendering command D to the rendering process. In response to rendering command D, the rendering process can render image frame D and fill the buffer with the rendered image frame D. Simultaneously, between vertical synchronization signals 4 (vsync4) and 5 (vsync5), the camera application can send image frame C or the buffer of image frame C to the display, allowing the display to show image frame C. That is, between (t+99.9ms) ms and (t+133.2ms), the rendering process renders image frame D, and the display shows image frame C.

[0471] Between vertical synchronization signals 5 (vsync5) and 6 (vsync6), the camera application can issue a rendering command E to the rendering process. In response to rendering command E, the rendering process can render image frame E and fill the buffer with the rendered image frame E. Simultaneously, between vertical synchronization signals 5 (vsync5) and 6 (vsync6), the camera application can send image frame D or the buffer of image frame D to the display, allowing the display to show image frame D. That is, between (t+133.2ms) ms and (t+166.5ms), the rendering process renders image frame E, and the display shows image frame D.

[0472] Similarly, the camera application can render and display image frames as shown in Figure 10.

[0473] Figure 11 shows a timing diagram of an electronic device 100 rendering and displaying image frames with different vsync signal cycles.

[0474] For example, if the display frame rate is 30 FPS and the vsync signal period is 16.6 ms, then m is 2, meaning that the rendering process renders one image frame every two vsync signal periods, and the camera application sends one image frame to be displayed every two vsync signal periods.

[0475] As shown in Figure 11, between vertical synchronization signal 1 (vsync1) and vertical synchronization signal 3 (vsync3), i.e., at intervals of two vsync signal cycles, the camera application can issue a rendering command A to the rendering process. In response to rendering command A, the rendering process can render image frame A and fill the rendered image frame A into a buffer, such as the first buffer. Simultaneously, between vertical synchronization signal 1 (vsync) and vertical synchronization signal 3 (vsync3), the camera application can send image frame 0 or the buffer of image frame 0 to the display, allowing the display to show image frame 0. That is, between time tms and time (t+33.3ms), the rendering process renders image frame A, and the display shows image frame 0.

[0476] Between vertical synchronization signals 3 (vsync3) and 5 (vsync5), i.e., at intervals of two vsync signal cycles, the camera application can issue rendering command B to the rendering process. In response to rendering command B, the rendering process can render image frame B and fill the buffer with the rendered image frame B. Simultaneously, between vertical synchronization signals 3 (vsync3) and 5 (vsync5), the camera application can send image frame A or the buffer of image frame A to the display, allowing the display to show image frame A. That is, between (t+33.3ms) ms and (t+66.6ms), the rendering process renders image frame B, and the display shows image frame A.

[0477] Between vertical synchronization signals 5 (vsync5) and 7 (vsync7), i.e., at intervals of two vsync signal cycles, the camera application can issue a rendering command C to the rendering process. In response to rendering command C, the rendering process can render image frame C and fill the buffer with the rendered image frame C. Simultaneously, between vertical synchronization signals 5 (vsync5) and 7 (vsync7), the camera application can send image frame B or the buffer of image frame B to the display, allowing the display to show image frame B. That is, between (t+66.6ms) ms and (t+99.9ms), the rendering process renders image frame C, and the display shows image frame B.

[0478] Between vertical synchronization signals 7 (vsync7) and 9 (vsync9), i.e., at intervals of two vsync signal cycles, the camera application can issue a rendering command D to the rendering process. In response to rendering command D, the rendering process can render image frame D and fill the buffer with the rendered image frame D. Simultaneously, between vertical synchronization signals 7 (vsync7) and 9 (vsync9), the camera application can send image frame C or the buffer of image frame C to the display, allowing the display to show image frame C. That is, between (t+99.9ms) ms and (t+133.2ms), the rendering process renders image frame D, and the display shows image frame C.

[0479] Between vertical synchronization signals 9 (vsync9) and 11 (vsync11), i.e., at intervals of two vsync signal cycles, the camera application can issue a rendering command E to the rendering process. In response to rendering command E, the rendering process can render image frame E and fill the buffer with the rendered image frame E. Simultaneously, between vertical synchronization signals 9 (vsync9) and 11 (vsync11), the camera application can send image frame D or the buffer of image frame D to the display, allowing the display to show image frame D. That is, between (t+133.2ms) ms and (t+166.5ms), the rendering process renders image frame E, and the display shows image frame D.

[0480] Similarly, the camera application can render and display image frames as shown in Figure 11.

[0481] Figure 12A shows a software architecture diagram of another electronic device 100 provided in an embodiment of this application for acquiring images at an initial zoom level.

[0482] As shown in Figure 12A, the software architecture of electronic device 100 includes, but is not limited to: an application layer (such as a camera application), an application framework layer, a hardware abstraction layer (HAL), and the interaction and cooperation between hardware. The application layer mainly involves the camera request sending module within the camera application. The application framework layer mainly involves the request queue processing module, the buffer allocation interface, the result processing module, the surface flinger rendering process, timers, the vsync signal listening module, the display thread, and the buffer manager. The hardware mainly includes the camera module and the display, etc.

[0483] After receiving a user operation to change the zoom level, the electronic device 100 can determine one or more transition zoom levels, and sequentially acquire and display images based on the one or more transition zoom levels. This includes, but is not limited to, the following steps:

[0484] 1. The vsync signal listening module listens for the vsync signal cycle from the rendering process.

[0485] 2. The vsync signal listening module periodically sends the vsync signal to the display thread.

[0486] When electronic device 100 receives a user's command to open the camera application, electronic device 100 launches the camera application. The vsync signal listening module can listen to the vsync signal cycle in the rendering process and send the vsync signal cycle to the display process.

[0487] 3. The timer sends the timing information to the display thread.

[0488] A timer can be used to send a timer period signal to the display thread. The timer period can be determined by the screen refresh rate of the electronic device 100. For example, if the screen refresh rate of the electronic device 100 is 30Hz, and the rendering process renders one image frame every 33.3ms, then the timing information could be 33.3ms.

[0489] It should be noted that steps 1-3 are executed continuously / irregularly / periodically after the camera application is opened.

[0490] 4. The camera application receives zoom commands from the user.

[0491] For example, a camera app can receive a user's action regarding a target zoom level. To enable the camera app to smoothly switch from the initial zoom level to the target zoom level, the electronic device can determine one or more transition zoom levels and sequentially acquire and display images based on one or more transition zoom levels.

[0492] 5. The camera application sends a zoom request to the shooting parameter generation module in the application framework layer.

[0493] In response to a user's zoom operation, the camera application can send a zoom request, which carries the target zoom ratio, to the shooting parameter generation module in the application framework layer.

[0494] For example, a camera application can send a zoom request to a shooting parameter generation module in the application framework layer through a camera request sending module.

[0495] In some embodiments, in response to a zoom request, the shooting parameter generation module can generate a zoom smoothing adjustment curve for an initial zoom ratio and a target zoom ratio. This zoom smoothing adjustment curve is used to determine one or more transition zoom ratios.

[0496] 6. The HAL layer sends image frames to the result processing module in the application architecture layer.

[0497] Understandably, before the user changes the zoom level, the electronic device 100 always captures image frames at the initial zoom level. Therefore, after the camera application receives the user's zoom operation, because processing the camera request takes time, the image frame sent by the HAL layer to the result processing module is the image frame captured at the initial zoom level.

[0498] 7. The result processing module sends the image frame to the image cropping module.

[0499] 8. The image cropping module sends the return frame time of the image frame to the shooting parameter generation module.

[0500] After receiving the image frame sent by the result processing module, the result processing module then sends the image frame to the shooting parameter generation module.

[0501] The shooting parameter generation module can also obtain the return frame time of the image frame and determine the transition zoom ratio based on the return frame time of the image frame and the zoom smoothing adjustment curve.

[0502] 9. The shooting parameter generation module sends the zoom request to the request queue processing module.

[0503] The zoom request includes a transition zoom level.

[0504] The shooting parameter generation module determines the transition zoom ratio based on the return frame time of the image frame and the zoom smoothing adjustment curve, and then sends the transition zoom ratio to the request queue processing module.

[0505] 10. Request the queue processing module to get the buffer.

[0506] In some embodiments, the application framework layer may include an Allocate Buffer interface. In response to a zoom request sent by the shooting parameter generation module, the prepare HAL request module may send a request to the Allocate Buffer interface to obtain a free buffer and allocate a free buffer for the zoom request.

[0507] 11. The request queue processing module allocates a cache for zoom requests.

[0508] Electronic device 100 can send the zoom request to the HAL request preparation module in the request queue processing module. When there is an empty buffer among N buffers in the buffer area of ​​electronic device 100, the HAL request preparation module obtains the Allocate Buffer interface to allocate a buffer address for the zoom request and can store the zoom request in the buffer.

[0509] 12. The request queue processing module sends a zoom request to the HAL layer.

[0510] After allocating a cache for the zoom request, the application framework layer sends the zoom request to the HAL layer, carrying the transition zoom magnification. The zoom request may also carry other data, which is not limited in this application.

[0511] Specifically, the HAL request preparation module can construct the zoom request into a HAL layer capture request and send it to the HAL layer through the batch processing request module. The HAL layer then sends the camera parameters in the capture request and the buffer address of the capture request to the camera module. The camera parameters in the capture request may include, but are not limited to, the transition zoom magnification.

[0512] 13. The HAL layer sends a zoom request to the camera module.

[0513] In response to the zoom request sent by the application framework layer, the HAL layer then sends the zoom request to the camera module.

[0514] Optionally, since the HAL layer processes camera requests and zoom requests in a first-in-first-out queue order, the HAL layer may not process a zoom request immediately after receiving it from the request queue processing module.

[0515] 14. The shooting parameter generation module sends the transition zoom ratio to the image cropping module.

[0516] The shooting parameter generation module determines the transition zoom ratio based on the return frame time of the image frame and the zoom smoothing adjustment curve. The shooting parameter generation module also needs to send the transition zoom ratio to the image cropping module.

[0517] Optionally, step 14 can be performed before step 9, or step 14 can be performed simultaneously with step 9; this application does not limit this.

[0518] 15. The image cropping module sends the transition image frame to the buffer manager.

[0519] After receiving the transition zoom ratio from the shooting parameter generation module, the image cropping module can determine the cropping ratio based on the zoom ratio and transition zoom ratio of the image frame sent by the result processing module, and crop the image frame sent by the result processing module according to the cropping ratio to obtain a transition image frame, which is then sent to the buffer manager. For details, please refer to the description in the embodiment shown in Figure 12B; further elaboration is not provided here.

[0520] In other embodiments, the image cropping module may crop multiple transition image frames based on the image frames sent by the result processing module, rather than being limited to a single transition image frame. For details, please refer to the descriptions in the embodiments of Figures 15A and 15B, which will not be repeated here.

[0521] 16. The display thread can determine when to retrieve the next transitional image frame to be displayed from the buffer manager based on the vsync signal period or the timer period. It then sends a request to the buffer manager to retrieve the image frame based on the timing of the next image frame to be displayed.

[0522] 17. The display thread retrieves the transition image frame from the buffer manager.

[0523] In one possible implementation, the display thread can be used to obtain the next transitional image frame to be displayed from the buffer manager after an interval of m vsync signal cycles from the time the previous image frame was displayed.

[0524] In one possible implementation, the display thread can also obtain the next transition image frame to be displayed from the buffer manager after the timer display cycle has elapsed since the previous image frame was displayed.

[0525] 18. The display thread sends the acquired transition image frame to the rendering process surface flinger.

[0526] 19. The rendering process, surface flinger, renders the image frames and sends the rendered transition image frames to the camera application.

[0527] 20. The camera application sends the rendered transition image frames to the display.

[0528] In some embodiments, after the display thread obtains the transition image frame from the buffer manager, it can first send the transition image frame to the camera application, which then sends it to the surface flinger. The surface flinger renders the image frame and sends the rendered transition image frame to the camera application. Finally, the camera application sends the rendered transition image frame to the display.

[0529] In some embodiments, the electronic device 100 may also receive user input to change the shooting parameters of the camera application. For example, the electronic device 100 may receive user input to change the zoom ratio of the camera application. After the zoom ratio of the camera application is changed, the camera application needs to resend the target zoom ratio to the application framework layer so that the camera module can re-capture and display image frames according to the target zoom ratio.

[0530] Figure 12B shows a schematic flowchart of another shooting method provided in an embodiment of this application.

[0531] S1201, Electronic device 100 acquires and displays image frames at the initial zoom level.

[0532] Before receiving a user's operation to change the zoom ratio, the electronic device 100 acquires and displays image frames at the initial zoom ratio. Specifically, please refer to the description in the embodiment shown in Figure 9B.

[0533] S1202, The user clicks on the target zoom magnification option.

[0534] When a user needs to change the zoom level, they can click on other zoom level options in the camera app preview interface, allowing the camera app to switch to the user-selected zoom level.

[0535] For example, the target zoom ratio option can be the 2.5x zoom ratio option shown in Figure 8B. The user clicking the target zoom ratio option can be the user clicking the 2.5x zoom ratio option shown in Figure 8B.

[0536] For example, the target zoom ratio option could also be the 1x zoom ratio option shown in Figure 8F. When a user clicks the target zoom ratio option, it can be the 1x zoom ratio option shown in Figure 8F.

[0537] S1203, The camera application sends a second camera request (target zoom ratio) to the shooting parameter generation module.

[0538] In response to the user clicking the target zoom level option, the camera application needs to send a second camera request to the camera parameter generation module. The second camera request is used to send the target zoom level to the application framework layer.

[0539] The first camera request may include the target zoom ratio. The target camera request may also include other parameter information, such as initial focal length, initial exposure, initial aperture, initial white balance, initial sharpness, initial contrast, and initial saturation. The target camera request may also omit other parameter information, and this application does not limit this.

[0540] S1204, the shooting parameter generation module obtains the zoom smoothing adjustment curve based on the initial zoom ratio and the target zoom ratio.

[0541] After receiving the second camera request sent by the camera application, the shooting parameter generation module can obtain the target zoom ratio from the second camera request.

[0542] In response to the target zoom ratio carried in the second camera's request, the shooting parameter generation module can obtain a zoom smoothing adjustment curve based on the initial zoom ratio and the target zoom ratio. The zoom smoothing adjustment curve is a curve that starts at the initial zoom ratio and ends at the target zoom ratio. The total duration of the zoom smoothing adjustment curve is the first duration.

[0543] The starting point of the zoom smoothing adjustment curve can be the moment the user clicks the target zoom magnification option. Alternatively, it can be the moment the shooting parameter generation module receives the second camera request from the camera application. The difference between the ending point and the starting point of the zoom smoothing adjustment curve is the first duration.

[0544] In some embodiments, the first duration can be a fixed duration, i.e., the zoom duration is fixed. In other embodiments, the first duration can also be determined by the shooting parameter generation module based on the initial zoom ratio and the target zoom ratio, for example, based on the difference between the initial zoom ratio and the target zoom ratio, i.e., the zoom duration is not fixed. The first duration can also be determined in other ways, which are not limited in this application.

[0545] It should be noted that different initial zoom ratios and / or target zoom ratios will result in different zoom smoothing adjustment curves.

[0546] In some embodiments, the shooting parameter generation module can use a cubic Bézier curve to generate a zoom smoothing adjustment curve. A cubic Bézier curve is a mathematical curve used in two-dimensional graphics applications. The path of a cubic Bézier curve is described by a function B(t) given points P0 (starting point), P1 (control point), P2 (control point), and P3 (ending point): B(t) = P0(1-t)³ + 3P1t(1-t)² + 3P2²(1-t) + P3t³ Equation (1)

[0547] As shown in formula (1), t in formula (1) represents the first duration, P0 represents the position point corresponding to the initial zoom ratio, and P3 represents the position point corresponding to the target zoom ratio. The shape of the Bezier curve can be adjusted by adjusting the two control points P1 and P2.

[0548] For example, the approximate shape of a cubic Bézier curve, such as an "S" shape, can be determined through a limited number of trials, along with the information of control points P1 and P2 corresponding to the shape of the cubic Bézier curve. That is, the relative position coordinates of control point P1 and position point P0, and the relative position coordinates of control point P2 and position point P3. The information of control points P1 and P2 is preset in the electronic device 10. Each time the shooting parameters are adjusted, the shooting parameter generation module can adjust the coordinate positions of the starting point and the ending point according to the actual situation to obtain a smooth adjustment curve.

[0549] When a zoom smoothing adjustment curve is needed, the shooting parameter generation module can adjust the shape of the cubic Bézier curve based on the initial zoom ratio and the target zoom ratio to obtain a zoom smoothing adjustment curve that matches the zoom ratio reduction or increase operation.

[0550] In some embodiments, the initial zoom ratio can be less than the target zoom ratio, that is, the zoom ratio applied to the camera can be increased. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 13A.

[0551] As shown in Figure 13A, the horizontal axis represents time, and the vertical axis represents zoom ratio. The initial zoom ratio corresponds to time t1, and the target zoom ratio corresponds to time t2. The target zoom ratio is greater than the initial zoom ratio. The time difference between t2 and t1 is the first duration, and t2 is greater than t1. Time t1 can be the moment the user clicks the target zoom ratio option, or it can be the moment the shooting parameter generation module receives the second camera request sent by the camera application. Figure 13A shows that the zoom speed near the start and end of zoom is lower than the zoom speed in the intermediate time period.

[0552] In other embodiments, the initial zoom ratio can be greater than the target zoom ratio, i.e., reducing the zoom ratio applied to the camera. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 13B.

[0553] As shown in Figure 13B, the horizontal axis represents time, and the vertical axis represents zoom ratio. The initial zoom ratio corresponds to time t1, and the target zoom ratio corresponds to time t2. The target zoom ratio is less than the initial zoom ratio. The time difference between t2 and t1 is the first duration, and t2 is greater than t1. Time t1 can be the moment the user clicks the target zoom ratio option, or it can be the moment the shooting parameter generation module receives the second camera request sent by the camera application. Figure 13B shows that the zoom speed near the start and end of zoom is lower than the zoom speed in the intermediate time period.

[0554] It should be noted that the zoom smoothing adjustment curves shown in Figures 13A and 13B are zoom smoothing adjustment curves under ideal conditions.

[0555] S1205, The camera module acquires and processes the raw image stream to obtain image frame 1 (initial zoom magnification).

[0556] S1206, The camera module sends image frame 1 (initial zoom level) and the address of the buffer storing image frame 1 to the HAL layer.

[0557] S1207, the HAL layer then sends image frame 1 (initial zoom level) and the address of the buffer storing image frame 1 to the result processing module.

[0558] S1208, the result processing module then sends image frame 1 (initial zoom level) and the address of the buffer storing image frame 1 to the image cropping module.

[0559] Optionally, before the camera module acquires and processes the raw image stream to obtain image frame 1, the camera application can periodically / irregularly send camera requests to the request queue processing module. These camera requests instruct the camera module to acquire image frames at an initial zoom level. The camera module can allocate an idle buffer for image frame 1 based on the camera request corresponding to image frame 1, and send the camera request for image frame 1 and the address for allocating the idle buffer to the camera module.

[0560] After acquiring image frame 1, the camera module sends the address of the camera module and the address of the buffer storing image frame 1 to the HAL layer. The HAL layer then sends image frame 1 (initial zoom level) and the address of the buffer storing image frame 1 to the result processing module. The result processing module then sends image frame 1 (initial zoom level) and the address of the buffer storing image frame 1 to the image cropping module.

[0561] In some embodiments, the result processing module may also send image frame 1 (initial zoom level) and the address of the buffer storing image frame 1 to the buffer manager, so that the buffer manager can store image frame 1 or the address of the buffer storing image frame 1.

[0562] S1209, The image cropping module sends the return frame time of image frame 1 to the shooting parameter generation module.

[0563] S1210, The shooting parameter generation module needs to determine whether the return frame time of image frame 1 is later than the time of the target zoom magnification in the zoom smoothing adjustment curve.

[0564] After the shooting parameter generation module obtains the return frame time of image frame 1, the shooting parameter generation module needs to determine whether the return frame time of image frame 1 is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, such as time t2.

[0565] When the return frame time of image frame 1 is earlier than the time of the target zoom ratio in the zoom smoothing adjustment curve, the shooting parameter generation module needs to continue to obtain other transition zoom ratios and obtain image frames based on other transition zoom ratios, that is, execute S1211-S1220.

[0566] When the return frame time of image frame 1 is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, the shooting parameter generation module does not need to obtain other transition zoom magnifications. After zooming ends, the image frame can be acquired and displayed based on the target transition zoom magnification, that is, S1221 is executed.

[0567] S1211, The shooting parameter generation module determines the first transition zoom ratio based on the zoom smoothing adjustment curve and the return frame time of image frame 1.

[0568] In some embodiments, the first transition zoom ratio may also be referred to as transition zoom ratio 1.

[0569] Before the electronic device 100 receives a user's click on the target zoom level option, the electronic device 100 continuously acquires and displays image frames at the initial zoom level.

[0570] After the electronic device 100 receives the user's click on the target zoom level option, for example, after time t1, the electronic device 100 will also return N image frames captured at the initial zoom level. If, after time t1, at time t3, the application framework layer obtains image frame 1 returned by HAL, that is, the return time of image frame 1 is time t3, and image frame 1 is an image frame captured at the initial zoom level.

[0571] For example, image frame 1 can be the image frame shown in FIG8B or the image frame shown in FIG8F.

[0572] If the return frame time of image frame 1 is earlier than the time of the target zoom magnification in the zoom smoothing adjustment curve, in order to ensure a smooth switch from the initial zoom magnification to the target zoom magnification, the shooting parameter generation module needs to determine the first transition zoom magnification based on the zoom smoothing adjustment curve and the return frame time of image frame 1.

[0573] Optionally, after obtaining time t3, the shooting parameter generation module can also obtain the transition zoom ratio 1 based on a time before t3 and the zoom smoothing adjustment curve. Alternatively, after obtaining time t3, the shooting parameter generation module can also obtain the transition zoom ratio 1 based on a time after t3 and the zoom smoothing adjustment curve. This application only illustrates the example of the shooting parameter generation module obtaining the transition zoom ratio 1 based on time t3 and the zoom smoothing adjustment curve.

[0574] In some embodiments, the initial zoom ratio can be less than the target zoom ratio, that is, the zoom ratio applied to the camera can be increased. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 13C.

[0575] For example, as shown in Figure 13C, if the shooting parameter generation module obtains the return frame time of image frame 1 as time t3, the shooting parameter generation module can obtain the corresponding transition zoom ratio 1 from the zoom smoothing adjustment curve based on time t3.

[0576] In some embodiments, the initial zoom ratio can be greater than the target zoom ratio, i.e., the zoom ratio applied to the camera is reduced. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 13D.

[0577] For example, as shown in Figure 13D, if the shooting parameter generation module obtains the return frame time of image frame 1 as time t3, the shooting parameter generation module can obtain the corresponding transition zoom ratio 1 from the zoom smoothing adjustment curve based on time t3.

[0578] S1212, The shooting parameter generation module sends the third camera request (first transition zoom magnification) to the request queue processing module.

[0579] The third camera request includes a transition zoom ratio of 1. Optionally, the second camera request may also include other shooting parameters, such as initial exposure, initial aperture, initial white balance, initial sharpness, initial contrast, and initial saturation. The third camera request may also omit other shooting parameters; this application does not impose any limitations on this.

[0580] In some embodiments, the first transition zoom magnification can also be sent to the request queue processing module in a time-sharing manner with the third camera request, and this application does not limit this.

[0581] S1213, The request queue processing module allocates a second buffer for the third camera request.

[0582] In response to a third camera request sent by the shooting parameter generation module, the request queue processing module can allocate a second buffer for the third camera request.

[0583] S1214. The request queue processing module sends the third camera request and the address of the second buffer to the HAL layer.

[0584] S1215, the HAL layer sends the third camera request and the address of the second buffer to the camera module.

[0585] After allocating a second buffer for the third camera request, the request queue processing module sends the address of the third camera request and the second buffer to the HAL layer, which then sends the address of the third camera request and the second buffer to the camera module.

[0586] After receiving a request from the third camera, the camera module can acquire image frames based on the transition zoom level 1 carried in the third camera request.

[0587] It is understandable that, based on the analysis of the embodiment in Figure 4, there are N pending camera requests before the HAL layer processes the third camera request. The third camera request will not be processed immediately.

[0588] S1216, The shooting parameter generation module sends the first transition zoom ratio to the image cropping module.

[0589] After determining the first transition zoom ratio based on the zoom smoothing adjustment curve and the return frame time of image frame 1, the shooting parameter generation module not only needs to send a third camera request to the request queue processing module, but also needs to send the first transition zoom ratio to the image cropping module. This allows the image cropping module to crop image frame 1 based on the first transition zoom ratio and promptly display the image frame corresponding to the first transition zoom ratio, thereby speeding up the electronic device's response time to user zoom ratio switching.

[0590] Optionally, S1216 can be executed simultaneously with S1212, or S1216 can be executed before S1212. This application does not limit this.

[0591] S1217. The image cropping module determines the cropping ratio 1 based on the zoom ratio and the first transition zoom ratio of image frame 1.

[0592] S1218, The image cropping module crops image frame 1 based on cropping ratio 1 to obtain transition image frame 1.

[0593] For example, the zoom ratio of image frame 1 can be an initial zoom ratio. The image cropping module can determine the cropping ratio 1 based on the zoom ratio of image frame 1 and the first transition zoom ratio.

[0594] The image cropping module can crop image frame 1 based on a cropping ratio of 1 to obtain cropped image 1, and then scale cropped image 1 to obtain transition image frame 1. The zoom ratio of transition image frame 1 can be a first transition zoom ratio.

[0595] In some embodiments, cropped image 1 can be obtained based on formulas (2) and (3). Cropping ratio 1 = zoom ratio of image frame 1 / first transition zoom ratio Formula (2) Size of cropped image 1 = size of image frame 1 * cropping ratio 1 Formula (3)

[0596] In some embodiments, if the zoom ratio of image frame 1 is greater than the zoom ratio of the first transition zoom ratio, then the cropping ratio 1 is greater than 1, and the size of the cropped image 1 is greater than the size of image frame 1. If the zoom ratio of image frame 1 is less than the zoom ratio of the first transition zoom ratio, then the cropping ratio 1 is less than 1, and the size of the cropped image 1 is smaller than the size of image frame 1. If the zoom ratio of image frame 1 is equal to the zoom ratio of the first transition zoom ratio, then the cropping ratio 1 is equal to 1, and the size of the cropped image 1 is equal to the size of image frame 1.

[0597] For example, when the zoom ratio of image frame 1 is less than the first transition zoom ratio, that is, the cropping ratio 1 is less than 1, the zoom ratio increases from small to large.

[0598] As shown in Figure 14A, the electronic device 100 can crop the image frame 1 based on the size of the cropped image 1 to obtain the cropped image 1. Then, the electronic device 100 scales the cropped image 1 to obtain the transition image frame 1.

[0599] In some embodiments, transition image frame 1 can be obtained based on formulas (4) and (5). Scaling ratio 1 = First transition zoom ratio / Zoom ratio of image frame 1 (Formula (4)) Size of transition image frame 1 = Size of cropped image 1 * Scaling ratio 1 (Formula (5))

[0600] In some embodiments, if the zoom ratio of image frame 1 is greater than the zoom ratio of the first transition zoom ratio, then the scaling ratio 1 is less than 1, and the size of the cropped image 1 is greater than the size of image frame 1. If the zoom ratio of image frame 1 is less than the zoom ratio of the first transition zoom ratio, then the scaling ratio 1 is greater than 1, and the size of the cropped image 1 is smaller than the size of image frame 1. If the zoom ratio of image frame 1 is equal to the zoom ratio of the first transition zoom ratio, then the scaling ratio 1 is equal to 1, and the size of the cropped image 1 is equal to the size of image frame 1.

[0601] For example, when the zoom ratio of image frame 1 is less than the first transition zoom ratio, that is, the scaling ratio 1 is greater than 1.

[0602] As shown in Figure 14A, the electronic device 100 can stretch the cropped image 1 to obtain a transition image frame 1. The size of the transition image frame 1 is equal to the size of the image frame 1. Based on this method, the image frame 1 can be cropped to obtain the transition image frame 1.

[0603] In some embodiments, when the zoom ratio of image frame 1 is greater than the first transition zoom ratio, i.e., the cropping ratio 1 is greater than 1, the zoom ratio decreases from large to small. To enable the cropping of transition image frame 1 from image frame 1, electronic device 100 can acquire an original image frame based on a preset zoom ratio, and image frame 1 can be obtained by cropping from the original image frame. When it is necessary to obtain transition image frame 1 from image frame 1, electronic device 100 can crop from the original image frame to obtain transition image frame 1. The preset zoom ratio can be a minimum value, such as 0.5x. Thus, the original image frame acquired by electronic device 100 at the minimum value of 0.5x can be used as input for any other zoom ratio greater than the minimum value of 0.5x, and image frames with zoom ratios greater than the minimum value of 0.5x can be cropped from the original image frame acquired at the minimum value of 0.5x.

[0604] The minimum value is not limited to 0.5x; it can be any other value, and this application does not limit it.

[0605] S1219, The image cropping module sends the address of the transition image frame 1 and the buffer storing the transition image frame 1 to the buffer manager.

[0606] In some embodiments, the address of the buffer storing the transition image frame 1 and the address of the buffer storing the image frame 1 may be the same or different.

[0607] S1220, electronic device 100 renders and displays transition image frame 1 in accordance with the manner shown in S912-S917 for rendering and displaying image frame A.

[0608] The display sending process module can retrieve image frames from the buffer manager every m vsync signal cycles. For example, after accumulating m vsync signal cycles, the display sending process can retrieve one image frame from the buffer manager, such as transition image frame 1.

[0609] Optionally, the display process module can also receive the timestamp sent by the timer. When the time interval between the current time and the timestamp of the previous image frame sent to rendering is greater than or equal to a preset time interval, the display process module can obtain the image frame to be rendered from the buffer manager. For example, the display process module can obtain the transition image frame 1 to be rendered from the buffer manager.

[0610] After accumulating m vsync signal cycles, the display sending process can obtain transition image frame 1 from the buffer manager. The display sending process then sends transition image frame 1 or the address of the buffer storing transition image frame 1 to the camera application. The camera application then sends transition image frame 1 or the address of the buffer storing transition image frame 1 to the rendering process.

[0611] After obtaining the address of transition image frame 1 or the buffer storing transition image frame 1, the rendering process can render transition image frame 1 and obtain the rendered transition image frame 1.

[0612] In some examples, if the rendering process module obtains the address of the buffer storing transition image frame 1, the rendering process module can render transition image frame 1 in the buffer corresponding to the address of the buffer storing transition image frame 1. Alternatively, if the rendering process module obtains the address of the buffer storing transition image frame 1, the rendering process module can retrieve transition image frame 1 from the buffer corresponding to the address of the buffer storing transition image frame 1 and render transition image frame 1.

[0613] The rendering process module can send the rendered transition image frame 1 or the address of the buffer storing the rendered transition image frame 1 to the camera application. The camera application then sends the transition image frame 1 or the address of the buffer storing the rendered transition image frame 1 to the display.

[0614] After obtaining the address of the buffer containing the rendered transition image frame 1, the display can show the rendered transition image frame 1.

[0615] In some examples, if the display obtains the address of the buffer that stores the rendered transition image frame 1, the rendering process module can retrieve the rendered transition image frame 1 from the buffer corresponding to the address of the buffer that stores the rendered transition image frame 1, and display the rendered transition image frame 1.

[0616] In this way, the shooting parameter generation module can obtain multiple transition zoom magnifications and crop the image frames corresponding to the multiple transition zoom magnifications in sequence according to the method of S1210-S1219.

[0617] For example, after image frame 1, the shooting parameter generation module can also obtain the return frame time of image frame 2, where image frame 2 is the image frame following image frame 1. The shooting parameter generation module needs to determine whether the return frame time of image frame 2 is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, for example, time t2.

[0618] When the return frame time of image frame 2 is earlier than the time of the target zoom ratio in the zoom smoothing adjustment curve, the shooting parameter generation module needs to continue to obtain other transition zoom ratios and obtain image frames based on other transition zoom ratios.

[0619] In some embodiments, the initial zoom ratio can be less than the target zoom ratio, that is, the zoom ratio applied to the camera can be increased. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 13C.

[0620] For example, as shown in Figure 13C, if the shooting parameter generation module obtains the return frame time of image frame 2 as time t4, the shooting parameter generation module can obtain the corresponding transition zoom ratio 2 from the zoom smoothing adjustment curve based on time t4.

[0621] In some embodiments, the initial zoom ratio can be greater than the target zoom ratio, i.e., the zoom ratio applied to the camera is reduced. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 13D.

[0622] For example, as shown in Figure 13D, if the shooting parameter generation module obtains the return frame time of image frame 2 as time t4, the shooting parameter generation module can obtain the corresponding transition zoom ratio 2 from the zoom smoothing adjustment curve based on time t4.

[0623] After determining the transition zoom ratio 2, the electronic device 100 can crop, render, and display the image frame corresponding to the transition zoom ratio 2 in a manner similar to S1210-S1219.

[0624] For example, after image frame 2, the shooting parameter generation module can also obtain the return frame time of image frame 3, which is an image frame after image frame 2. The shooting parameter generation module needs to determine whether the return frame time of image frame 3 is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, for example, time t2.

[0625] When the return frame time of image frame 3 is earlier than the time of the target zoom ratio in the zoom smoothing adjustment curve, the shooting parameter generation module needs to continue to obtain other transition zoom ratios and obtain image frames based on other transition zoom ratios.

[0626] In some embodiments, the initial zoom ratio can be less than the target zoom ratio, that is, the zoom ratio applied to the camera can be increased. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 13C.

[0627] For example, as shown in Figure 13C, if the shooting parameter generation module obtains the return frame time of image frame 3 as time t5, the shooting parameter generation module can obtain the corresponding transition zoom ratio 3 from the zoom smoothing adjustment curve based on time t5.

[0628] In some embodiments, the initial zoom ratio can be greater than the target zoom ratio, i.e., the zoom ratio applied to the camera is reduced. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 13D.

[0629] For example, as shown in Figure 13D, if the shooting parameter generation module obtains the return frame time of image frame 3 as time t5, the shooting parameter generation module can obtain the corresponding transition zoom ratio 3 from the zoom smoothing adjustment curve based on time t5.

[0630] After determining the transition zoom ratio 3, the electronic device 100 can crop, render, and display the image frame corresponding to the transition zoom ratio 3 in a manner similar to S1210-S1219.

[0631] This process continues until the result processing module obtains the image frame returned by the HAL layer at a time later than the target zoom ratio in the zoom smoothing adjustment curve, for example, time t2. Zooming ends, and the shooting parameter generation module no longer determines other transition zoom ratios. After obtaining the image frame returned by the HAL layer, the result processing module executes S1220.

[0632] Optionally, during the zoom process, the HAL layer can obtain the zoom ratio and the frame rewind time of the image frame, and obtain the zoom curve shown in Figure 13C or the zoom curve shown in Figure 13D based on the zoom ratio and the frame rewind time of the image frame. The zoom curve shown in Figure 13C or Figure 13D reflects the zoom process of the image frame displayed by the electronic device 100 during the zoom process.

[0633] As shown in Figure 13C or Figure 13D, if the user clicks the target zoom level option at time t1, and the HAL layer returns image frame 1 to the application architecture layer at time t6, the application architecture layer needs time to send a camera request to the HAL layer, the HAL layer needs time to send a camera request to the camera module, and the camera module needs time to process the image. The time difference between time t1 and time t6 is the first duration. The first duration includes the latency of inter-layer communication and image processing. If the HAL layer starts returning images acquired for the transition zoom level to the application architecture layer at or after time t6, the HAL layer can obtain the zoom curve shown in Figure 13C or Figure 13D.

[0634] Based on the above analysis, firstly, the calculation of the transition zoom ratio is completed at the application architecture layer, reducing the interaction steps between the application and application architecture layers and saving time for the application layer to send the transition zoom ratio to the application architecture layer. After the HAL layer returns the image frame, the application framework layer can promptly send the zoom request to the HAL layer. Secondly, when the HAL layer returns the image frame to the application architecture layer, the application architecture layer can determine the transition zoom ratio in real time based on the return frame time of the image frame returned by the HAL layer. This ensures that the zoom curve corresponding to the image frame returned by the HAL layer during the zoom process conforms to the change law of the zoom smoothing adjustment curve, making the zoom process smoother. The zoom ratio can transition from the initial zoom ratio to the target zoom ratio according to the change law of the zoom smoothing adjustment curve, without image jitter or stuttering, thus improving the user's visual experience.

[0635] S1221, Electronic device 100 performs the embodiment shown in FIG12C.

[0636] When the return frame time of image frame 1 is later than the time of the target zoom magnification in the zoom smoothing curve, the electronic device 100 executes the embodiment shown in FIG12C. For details, please refer to the description in FIG12C, which will not be repeated here.

[0637] Figure 12C shows a schematic flowchart of another shooting method provided in an embodiment of this application.

[0638] S1301, The shooting parameter generation module sends the fourth camera request (target zoom ratio) to the request queue processing module.

[0639] If the return frame time of image frame 1 is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, the shooting parameter generation module does not need to obtain other transition zoom magnifications, and the shooting parameter generation module can send the target zoom magnification to the HAL layer.

[0640] In response to the fact that the return frame time of image frame 1 is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, the shooting parameter generation module can send a fourth camera request to the request queue processing module.

[0641] The fourth camera request includes the target zoom ratio. Optionally, the fourth camera request may also include other shooting parameters, such as initial exposure, initial aperture, initial white balance, initial sharpness, initial contrast, and initial saturation. The fourth camera request may also omit other shooting parameters; this application does not impose any limitations on this.

[0642] In some embodiments, the target zoom level may also be sent to the request queue processing module in a time-sharing manner with the fourth camera request, and this application does not limit this.

[0643] S1302, The request queue processing module allocates a third buffer for the fourth camera request.

[0644] In response to a fourth camera request sent by the shooting parameter generation module, the request queue processing module can allocate a third buffer for the fourth camera request.

[0645] S1303, The request queue processing module sends the fourth camera request and the address of the third buffer to the HAL layer.

[0646] S1304, the HAL layer sends the fourth camera request and the address of the third buffer to the camera module.

[0647] After allocating a third buffer for the fourth camera request, the request queue processing module sends the fourth camera request and the address of the third buffer to the HAL layer, which then sends the fourth camera request and the address of the third buffer to the camera module.

[0648] After receiving a request from the fourth camera, the camera module can acquire image frames based on the target zoom ratio carried in the fourth camera request.

[0649] It is understandable that, based on the analysis of the embodiment in Figure 4, there are N pending camera requests before the HAL layer processes the fourth camera request. The fourth camera request will not be processed immediately.

[0650] S1305 The image cropping module needs to determine whether the zoom ratio of image frame 1 is the same as the target zoom ratio.

[0651] If the return frame time of image frame 1 is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, the image cropping module does not need to obtain other transition zoom magnifications, and the image cropping module directly sends the target zoom magnification to the image cropping module.

[0652] In order to determine whether the image cropping module needs to crop the image further, the image cropping module also needs to determine whether the zoom ratio of image frame 1 is the same as the target zoom ratio.

[0653] If the zoom ratio of image frame 1 is the same as the target zoom ratio, it means that image frame 1 is an image frame captured by the camera module at the target zoom ratio. In this case, the image cropping module does not need to crop image frame 1. It can directly send image frame 1 or the address of the buffer storing image frame 1 to the buffer manager and execute S1306.

[0654] If the zoom ratio of image frame 1 is different from the target zoom ratio, it means that image frame 1 is not an image frame captured by the camera module at the target zoom ratio, but an image frame captured at the transition zoom ratio. In this case, the image cropping module needs to crop image frame 1 and execute S1307.

[0655] S1306, Electronic device 100 renders and displays image frame 1 in accordance with the manner shown in S912-S917 for rendering and displaying image frame A.

[0656] When the zoom ratio of image frame 1 is the same as the target zoom ratio, the image cropping module does not need to crop image frame 1. It directly sends image frame 1 or the address of the buffer storing image frame 1 to the buffer manager. This allows the display process to periodically retrieve and render image frames from the buffer manager according to m vsync signals. For details, please refer to the description in S1219, which will not be repeated here.

[0657] S1307 The image cropping module determines the cropping ratio 2 based on the zoom ratio of image frame 1 and the target zoom ratio.

[0658] S1308, The image cropping module crops image frame 1 based on cropping ratio 2 to obtain transition image frame 2.

[0659] For example, the zoom ratio of image frame 1 can be the initial zoom ratio. The image cropping module can determine the cropping ratio 2 based on the zoom ratio of image frame 1 and the target zoom ratio.

[0660] The image cropping module can crop image frame 1 based on cropping ratio 2 to obtain transition image frame 2. The zoom ratio of transition image frame 2 can be the target zoom ratio.

[0661] S1309, the image cropping module sends the address of the transition image frame 2 and the buffer storing the transition image frame 2 to the buffer manager.

[0662] In some embodiments, the address of the buffer storing transition image frame 2 and the address of the buffer storing image frame 1 may be the same or different.

[0663] S1310, electronic device 100 renders and displays transition image frame 2 in the manner shown in S912-S917 for rendering and displaying image frame A.

[0664] The display sending process module can retrieve image frames from the buffer manager every m vsync signal cycles. For example, after accumulating m vsync signal cycles, the display sending process can retrieve one image frame from the buffer manager, such as transition image frame 2.

[0665] Optionally, the display process module can also receive timestamps sent by timers. When the time interval between the current time and the timestamp of the previous image frame sent to rendering is greater than or equal to a preset time interval, the display process module can obtain the image frame to be rendered from the buffer manager. For example, the display process module can obtain the transition image frame 2 to be rendered from the buffer manager.

[0666] After accumulating m vsync signal cycles, the display sending process can obtain transition image frame 2 from the buffer manager. The display sending process then sends transition image frame 2 or the address of the buffer storing transition image frame 2 to the camera application. The camera application then sends transition image frame 2 or the address of the buffer storing transition image frame 2 to the rendering process.

[0667] After obtaining the address of transition image frame 2 or the buffer storing transition image frame 2, the rendering process can render transition image frame 1 to obtain the rendered transition image frame 2.

[0668] In some examples, if the rendering process module obtains the address of the buffer storing transition image frame 2, the rendering process module can render transition image frame 2 in the buffer corresponding to the address of the buffer storing transition image frame 2. Alternatively, if the rendering process module obtains the address of the buffer storing transition image frame 2, the rendering process module can retrieve transition image frame 2 from the buffer corresponding to the address of the buffer storing transition image frame 2 and render transition image frame 2.

[0669] The rendering process module can send the rendered transition image frame 2 or the address of the buffer storing the rendered transition image frame 2 to the camera application. The camera application then sends the transition image frame 2 or the address of the buffer storing the rendered transition image frame 2 to the display.

[0670] After obtaining the address of the buffer containing the rendered transition image frame 2, the display can show the rendered transition image frame 2.

[0671] In some examples, if the display obtains the address of the buffer that stores the rendered transition image frame 2, the rendering process module can retrieve the rendered transition image frame 2 from the buffer corresponding to the address of the buffer that stores the rendered transition image frame 2, and display the rendered transition image frame 2.

[0672] Similarly, even more image frames can be acquired.

[0673] Figure 14B illustrates how another electronic device 100 handles camera requests and zoom requests.

[0674] As shown in Figure 4 above, the application framework layer periodically sends camera requests to the HAL layer. Before the HAL layer responds to the zoom request corresponding to the user's zoom operation, it needs to process other pending camera requests. The HAL layer will only process the zoom request after all the camera requests preceding the zoom request have been processed.

[0675] For example, as shown in Figure 14B, before the HAL layer processes the zoom request, there are six other camera requests to be processed: Camera Request 1, Camera Request 2, Camera Request 3, Camera Request 4, Camera Request 5, and Camera Request 6. If the HAL layer receives Zoom Request 1 at time tms, Zoom Request 1 carries an initial zoom magnification of 1 and is placed in the queue of pending requests in chronological order. Following the first-in, first-out (FIFO) principle, at time tms, the HAL layer retrieves Camera Request 1 from the queue and processes it. Camera Request 1 carries an initial zoom magnification. In response to processing Camera Request 1, the camera module can acquire image frame A based on the initial zoom magnification and send it to the application framework layer through the HAL layer. After acquiring image frame A, if the application framework layer determines that the return frame time of image frame A is later than the time of the target zoom ratio in the zoom smoothing adjustment curve, the application framework layer can determine the cropping ratio 'a' based on the zoom ratio of image frame A and the transition zoom ratio 1, and crop image frame A based on the cropping ratio 'a' to obtain a transition image frame A1, which has a transition zoom ratio of 1. The application framework layer then sends the transition image frame A1 to the camera application, which can then display the transition image frame A1.

[0676] At time (t+33.3) ms, the HAL layer receives zoom request 2, which carries a transition zoom ratio of 2. Zoom request 2 is placed in the pending request queue according to the chronological order. Following the first-in, first-out principle, at time (t+33.3) ms, the HAL layer retrieves camera request 2 from the queue and processes it. Camera request 2 carries an initial zoom ratio. In response to processing camera request 2, the camera module can acquire image frame B based on the initial zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame B, if the application framework layer determines that the return frame time of image frame B is later than the time of the target zoom ratio in the zoom smoothing adjustment curve, the application framework layer can determine the cropping ratio b based on the zoom ratio and transition zoom ratio 2 of image frame B, and crop image frame B based on the cropping ratio b to obtain transition image frame B1, which has a transition zoom ratio of 2. The application framework layer then sends the transition image frame B1 to the camera application, which can then display the transition image frame B1.

[0677] At time (t+66.6) ms, the HAL layer receives zoom request 3, which carries a transition zoom ratio of 3. Zoom request 3 is placed in the pending request queue according to the chronological order. Following the first-in, first-out principle, at time (t+66.6) ms, the HAL layer retrieves camera request 3 from the queue and processes it. Camera request 3 carries an initial zoom ratio. In response to processing camera request 3, the camera module can acquire image frame C based on the initial zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame C, if the application framework layer determines that the return frame time of image frame C is later than the time of the target zoom ratio in the zoom smoothing adjustment curve, and the zoom ratio of image frame C is different from the target zoom ratio, the application framework layer can determine the cropping ratio c based on the zoom ratio and transition zoom ratio 3 of image frame C, and crop image frame C based on the cropping ratio c to obtain a transition image frame C1, which has a transition zoom ratio of 3. The application framework layer then sends the transition image frame C1 to the camera application, which can then display the transition image frame C1.

[0678] At time (t+99.9) ms, the HAL layer receives zoom request 4. Since the return frame time of image frame D is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, the shooting parameter generation module no longer identifies other transition zoom magnifications and directly sends the target zoom magnification to the HAL layer. Therefore, zoom request 4 carries the target zoom magnification and is placed in the request queue to be processed according to the time sequence. According to the first-in-first-out principle, at time (t+99.9) ms, the HAL layer retrieves camera request 4 from the queue and processes it. Camera request 4 carries the initial zoom magnification. In response to processing camera request 4, the camera module can acquire image frame D based on the initial zoom magnification and send it to the application framework layer through the HAL layer. After acquiring image frame D, if the zoom ratio of image frame D differs from the target zoom ratio, the application framework layer can determine a cropping ratio d based on both the zoom ratios of image frame D and the target zoom ratio. Then, it crops image frame D based on the cropping ratio d to obtain a transition image frame D1, which represents the target zoom ratio. The application framework layer then sends the transition image frame D1 to the camera application, which can then display it.

[0679] At time (t+133.2) ms, the HAL layer receives zoom request 5, which carries the target zoom ratio. Zoom request 5 is placed in the pending request queue according to the time sequence. Following the first-in, first-out principle, at time (t+133.2) ms, the HAL layer retrieves camera request 5 from the queue and processes it. Camera request 5 carries the initial zoom ratio. In response to processing camera request 5, the camera module can acquire image frame E based on the initial zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame E, if the zoom ratio of image frame E differs from the target zoom ratio, the application framework layer can determine the cropping ratio e based on the zoom ratio of image frame E and the target zoom ratio, and crop image frame E based on the cropping ratio e to obtain a transition image frame E1, which represents the target zoom ratio. The application framework layer then sends the transition image frame E1 to the camera application, which can then display the transition image frame E1.

[0680] At time (t+166.5) ms, the HAL layer receives zoom request 6, which carries the target zoom ratio. Zoom request 6 is placed in the pending request queue according to the time sequence. Following the first-in, first-out principle, at time (t+166.5) ms, the HAL layer retrieves camera request 6 from the queue and processes it. Camera request 6 carries the initial zoom ratio. In response to processing camera request 6, the camera module can acquire image frame F based on the initial zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame F, if the zoom ratio of image frame F differs from the target zoom ratio, the application framework layer can determine the cropping ratio f based on the zoom ratio of image frame F and the target zoom ratio, and crop image frame F based on the cropping ratio f to obtain a transition image frame F1, which represents the target zoom ratio. The application framework layer then sends the transition image frame F1 to the camera application, which can then display the transition image frame F1.

[0681] At time (t+199.8) ms, the HAL layer receives zoom request 7, which carries the target zoom ratio. Zoom request 7 is placed in the pending request queue according to the time sequence. Following the first-in, first-out principle, at time (t+199.8) ms, the HAL layer retrieves camera request 7 from the queue and processes it. Camera request 7 carries the initial zoom ratio. In response to processing camera request 7, the camera module can acquire image frame G based on the transition zoom ratio 1 and send it to the application framework layer through the HAL layer. After acquiring image frame G, if the zoom ratio of image frame G differs from the target zoom ratio, the application framework layer can determine the cropping ratio g based on the zoom ratio of image frame G and the target zoom ratio, and crop image frame G based on the cropping ratio g to obtain a transition image frame G1, which represents the target zoom ratio. The application framework layer then sends the transition image frame G1 to the camera application, which can then display the transition image frame G1.

[0682] Similarly, electronic device 100 can process zoom request 2 and zoom request 3 in the same way as zoom request 1.

[0683] At time (t+299.7) ms, the HAL layer receives zoom request 10, which carries the target zoom ratio, and places it in the pending request queue according to the time sequence. Following the first-in, first-out principle, at time (t+299.7) ms, the HAL layer retrieves zoom request 4 from the queue and processes it. Zoom request 4 carries the target zoom ratio. In response to processing zoom request 4, the camera module can acquire image frame H based on the target zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame H, if the zoom ratio of image frame H is the same as the target zoom ratio, the application framework layer does not need to crop image frame G. The application framework layer can directly send image frame G to the camera application, which can then display image frame G.

[0684] Similarly, electronic device 100 can process zoom requests 5 to 10 in the same way as zoom request 4.

[0685] As shown in Figure 14B, immediately after receiving zoom request 1, the application framework layer can respond to the transitional zoom ratio 1 carried in zoom request 1 and obtain transitional image frame A1, where the zoom ratio of transitional image frame A1 is the transitional zoom ratio 1. This eliminates the need to wait for multiple camera requests preceding zoom request 1 to complete before executing zoom request 1 and obtaining the image frame corresponding to transitional zoom ratio 1. This shortens the processing time of zoom request 1 by the HAL layer and improves the speed at which the camera application responds to user zoom operations.

[0686] Figure 14C shows a timing diagram of another electronic device 100 rendering and displaying image frames in a vsync signal cycle.

[0687] For example, the display frame rate can be 30 FPS, and the vsync signal period is 33.3 ms. Then m is 1, which means that the rendering process renders one image frame in each vsync signal period, and the camera application sends one image frame to be displayed in each vsync signal period.

[0688] As shown in Figure 14C, between vertical synchronization signal 1 (vsync1) and vertical synchronization signal 2 (vsync2), the camera application can issue a rendering command A to the rendering process. In response to rendering command A, the rendering process can render a transitional image frame A1 and fill the buffer with the rendered transitional image frame A1. Simultaneously, between vertical synchronization signal 1 (vsync) and vertical synchronization signal 2 (vsync2), the camera application can send image frame 0 or the buffer of image frame 0 to the display, allowing the display to show image frame 0. That is, between time tms and time (t+33.3ms), the rendering process renders the transitional image frame A1, and the display shows image frame 0.

[0689] Between vertical synchronization signal 2 (vsync2) and vertical synchronization signal 3 (vsync3), the camera application can issue a rendering command B to the rendering process. In response to rendering command B, the rendering process can render a transitional image frame B1 and fill the buffer with the rendered transitional image frame B1. Simultaneously, between vertical synchronization signal 2 (vsync2) and vertical synchronization signal 3 (vsync3), the camera application can send a transitional image frame A1 or a buffer of transitional image frame A1 to the display, allowing the display to show transitional image frame A1. That is, between (t+33.3ms) ms and (t+66.6ms), the rendering process renders transitional image frame B1, and the display shows transitional image frame A1.

[0690] Between vertical synchronization signal 3 (vsync3) and vertical synchronization signal 4 (vsync4), the camera application can issue a rendering command C to the rendering process. In response to rendering command C, the rendering process can render a transition image frame C1 and fill the buffer with the rendered transition image frame C1. Simultaneously, between vertical synchronization signal 3 (vsync3) and vertical synchronization signal 4 (vsync4), the camera application can send a transition image frame B1 or a buffer of transition image frame B1 to the display, allowing the display to show transition image frame B1. That is, between (t+66.6ms) ms and (t+99.9ms), the rendering process renders transition image frame C1, and the display shows transition image frame B1.

[0691] Between vertical synchronization signals 4 (vsync4) and 5 (vsync5), the camera application can issue a rendering command D to the rendering process. In response to rendering command D, the rendering process can render a transitional image frame D1 and fill the buffer with the rendered transitional image frame D1. Simultaneously, between vertical synchronization signals 4 (vsync4) and 5 (vsync5), the camera application can send a transitional image frame C1 or a buffer of transitional image frame C1 to the display, allowing the display to show the transitional image frame C1. That is, between (t+99.9ms) ms and (t+133.2ms), the rendering process renders transitional image frame B1, and the display shows transitional image frame C1.

[0692] Between vertical synchronization signals 5 (vsync5) and 6 (vsync6), the camera application can issue a rendering command E to the rendering process. In response to rendering command E, the rendering process can render a transition image frame E1 and fill the buffer with the rendered transition image frame E1. Simultaneously, between vertical synchronization signals 5 (vsync5) and 6 (vsync6), the camera application can send a transition image frame D1 or a buffer of transition image frame D1 to the display, allowing the display to show the transition image frame D1. That is, between (t+133.2ms) ms and (t+166.5ms), the rendering process renders the transition image frame E1, and the display shows the transition image frame D1.

[0693] Between vertical synchronization signal 6 (vsync6) and vertical synchronization signal 7 (vsync7), the camera application can issue a rendering command F to the rendering process. In response to rendering command F, the rendering process can render a transition image frame F1 and fill the buffer with the rendered transition image frame F1. Simultaneously, between vertical synchronization signal 6 (vsync6) and vertical synchronization signal 7 (vsync7), the camera application can send a transition image frame E1 or a buffer of transition image frame E1 to the display, allowing the display to show transition image frame E1. That is, between (t+166.5ms) ms and (t+133.2ms), the rendering process renders transition image frame F1, and the display shows transition image frame E1.

[0694] Between vertical synchronization signals 7 (vsync7) and 8 (vsync8), the camera application can issue a rendering command G to the rendering process. In response to the rendering command G, the rendering process can render a transition image frame G1 and fill the buffer with the rendered transition image frame G1. Simultaneously, between vertical synchronization signals 7 (vsync7) and 8 (vsync8), the camera application can send a transition image frame F1 or a buffer of transition image frame F1 to the display, allowing the display to show the transition image frame F1. That is, between (t+133.2ms) ms and (t+166.5ms), the rendering process renders the transition image frame G1, and the display shows the transition image frame F1.

[0695] Similarly, between vertical synchronization signal 10 (vsync10) and vertical synchronization signal 11 (vsync11), the camera application can issue a rendering command H to the rendering process. In response to the rendering command H, the rendering process can render a transition image frame H1 and fill the buffer with the rendered transition image frame H1. Simultaneously, between vertical synchronization signal 10 (vsync10) and vertical synchronization signal 11 (vsync11), the camera application can send a transition image frame I1 or a buffer of transition image frame I1 to the display, allowing the display to show the transition image frame I1. That is, between (t+266.4ms) ms and (t+299.7ms), the rendering process renders the transition image frame H1, and the display shows the transition image frame I1.

[0696] Similarly, camera applications can render and display image frames based on the vsync signal period as shown in Figure 14C.

[0697] As can be seen from Figure 14C, the rendering process can send the image frames clipped by the application framework layer or the image frames sent by the HAL layer to the rendering process for rendering and display according to a fixed vsync signal period. This ensures that the image frames are sent to the rendering process for rendering and display evenly, and that the camera application displays the image frames evenly.

[0698] As described above, in order to ensure that the electronic device 100 can smoothly switch from the initial zoom level to the target zoom level, the electronic device 100 can obtain a zoom smoothing adjustment curve based on the initial zoom level and the target zoom level. As described in the embodiments of Figures 13A-13D, the slope of the zoom smoothing adjustment curve gradually increases and then decreases, that is, the rate of change of the transition zoom level first increases and then decreases.

[0699] In some embodiments, if the electronic device 100 obtains multiple transition zoom ratios according to the method shown in the embodiments of FIG13C and FIG13D, since the slope of the zoom smoothing adjustment curve increases and then decreases, that is, the rate of change of the transition zoom ratio in the zoom smoothing adjustment curve first increases and then decreases, as can be seen from FIG13C and FIG13D, the difference between the changes of two adjacent transition zoom ratios among the multiple transition zoom ratios is too large. For example, the difference between the change value between transition zoom ratio 1 and transition zoom ratio 2, and the difference between the change value between transition zoom ratio 2 and transition zoom ratio 3, and the difference between the change value between transition zoom ratio 2 and transition zoom ratio 3 and the change value between transition zoom ratio 3 and the target zoom ratio is large. That is, the sudden change in zoom ratio affects the user's visual effect.

[0700] To reduce the change in zoom ratio between adjacent image frames during zooming, the electronic device 100 can determine an additional 'a' transition zoom ratios between two adjacent transition zoom ratios shown in Figures 13C and 13D. This reduces the rate of change in zoom ratio between adjacent image frames, thus mitigating the rate of change in zoom ratio between adjacent image frames. Here, 'a' is a positive integer greater than or equal to 1, and its value can be a preset value, such as 1 or 2. The following embodiments in this application will be described with 'a' set to 1.

[0701] Figure 15A shows a schematic flowchart of another shooting method provided in an embodiment of this application.

[0702] S1501-S1520 can be referred to the description of S1201-S1219 in the embodiment of Figure 12C, and will not be repeated here.

[0703] S1521, The shooting parameter generation module notifies the rendering process to switch the vsync signal period from the first value to the second value, and the ratio of the second value to the first value is (a+1).

[0704] In this context, both the first and second values ​​are positive integers greater than or equal to 1, with the second value being greater than the first value. The ratio of the second value to the first value is a+1.

[0705] Where a is a positive integer of 0 or greater than or equal to 1, and the value of a can be a preset value.

[0706] For example, if the value of 'a' is 1, then the ratio of the second value to the first value can be 2, meaning the rendering process shortens the vsync signal period by half. For instance, the first value could be 33.3ms and the second value could be 16.7ms.

[0707] For example, if the value of 'a' is 2, then the ratio of the second value to the first value can be 3, meaning that the rendering process shortens the vsync signal period by one-third. For instance, the first value could be 33.3ms and the second value could be 8.35ms.

[0708] The following embodiments of this application are described with a = 1.

[0709] In some embodiments, when a is 0, that is, no frame insertion is performed. The specific implementation is similar to the embodiment in Figure 12C, and will not be described again here.

[0710] Optionally, S1521 may be performed before, after, or simultaneously with any step after S1501, and this application does not limit this.

[0711] S1522, The image cropping module sends the return frame time of the transition image frame 3 to the shooting parameter generation module. The return frame time of the transition image frame 3 is equal to the sum of the return frame time of the image frame 1 and the preset duration.

[0712] Wherein, the return frame time of transition image frame 1 is equal to the return frame time of image frame 1.

[0713] For example, the return frame time of image frame 1 can be time t3.

[0714] For example, the return frame time of transition image frame 3 can be time t7.

[0715] Optionally, the preset duration can be related to the output frame rate of the camera application and the value of 'a', for example, preset duration = (a+1) / (1 / (output frame rate)). For example, if the output frame rate of the camera application is 30pfs, that is, the HAL layer returns an image frame to the application framework layer every 33.3ms, when 'a' is 1, the preset duration can be 16.7ms.

[0716] For example, if the camera application outputs an image frame rate of 60pfs, meaning the HAL layer returns an image frame to the application framework layer every 16.7ms, the preset duration can be 8.35ms when 'a' is 1.

[0717] Based on the above analysis, in order to reduce the change in zoom ratio between two adjacent image frames, the image cropping module can add one or more transition zoom ratios between two adjacent transition zoom ratios, and crop the image frame based on the one or more newly added transition zoom ratios to obtain the newly added transition image frame, and render and display the newly added transition image frame.

[0718] For example, two adjacent transition zoom ratios can be transition zoom ratio 1 and transition zoom ratio 2. The shooting parameter generation module can determine a transition zoom ratio 4 between transition zoom ratio 1 and transition zoom ratio 2, and crop the image frame returned by the HAL layer based on the transition zoom ratio 4 to obtain transition image frame 3, and then render and display transition image frame 3. In this way, by increasing the number of image frames during zooming, the change in zoom ratio between adjacent image frames can be mitigated.

[0719] For example, if the camera app's display frame rate is 30fps before zooming, when 'a' is 1, the display frame rate can be switched from 30fps to 60fps during zooming; when 'a' is 2, the display frame rate can be switched from 30fps to 90fps during zooming. This increases the camera app's display frame rate, making the zooming process smoother.

[0720] Optionally, S1522 may be performed before, after, or simultaneously with any step after S1508, and this application does not limit this.

[0721] Optionally, S1522 can also be executed by the shooting parameter generation module, and this application does not limit this.

[0722] Optionally, S1522 can also be executed by the shooting parameter generation module, and this application does not limit this.

[0723] S1523, The shooting parameter generation module determines the second transition zoom ratio based on the zoom smoothing adjustment curve and the return frame time of transition image frame 3.

[0724] After receiving the return frame time of the transition image frame 3 sent by the image cropping module, the shooting parameter generation module can determine the second transition zoom ratio based on the zoom smoothing adjustment curve and the return frame time of the transition image frame 3.

[0725] For example, the second transition zoom ratio can be a transition zoom ratio of 4.

[0726] The shooting parameter generation module can determine the preset duration based on the output frame rate of the camera application and 'a'. For example, if the output frame rate is 30pfs, that is, the HAL layer returns an image frame to the application framework layer every 33.3ms, the preset duration can be 16.7ms when 'a' is 1.

[0727] The shooting parameter generation module can determine the t7 time based on the t3 time and the preset duration (e.g., 16.7ms).

[0728] For example, the return frame time of transition image frame 3 can be time t7.

[0729] In some embodiments, the initial zoom ratio can be less than the target zoom ratio, i.e., increasing the zoom ratio applied to the camera. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 16A. The description of how the shooting parameter generation module obtains transition zoom ratio 1, transition zoom ratio 2, and transition zoom ratio 3, as shown in Figure 16A, can be found in the description of the embodiment in Figure 13C, and will not be repeated here.

[0730] For example, as shown in Figure 16A, the shooting parameter generation module can obtain the corresponding transition zoom ratio 4 from the zoom smoothing adjustment curve based on the return frame time of the transition image frame 3 (e.g., time t7).

[0731] In some embodiments, the initial zoom ratio can be greater than the target zoom ratio, i.e., the zoom ratio applied to the camera is reduced. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 16B. The description of how the shooting parameter generation module obtains the transition zoom ratio 1, transition zoom ratio 2, and transition zoom ratio 3 shown in Figure 16B can be referred to the description in the embodiment of Figure 13D, which will not be repeated here.

[0732] The shooting parameter generation module can obtain the corresponding transition zoom ratio 4 from the zoom smoothing adjustment curve based on the return frame time of the transition image frame 3 (e.g., time t7).

[0733] After determining the transition zoom ratio 4, the electronic device 100 can crop, render, and display the image frame corresponding to the transition zoom ratio 4 in a manner similar to S1210-S1219.

[0734] In some embodiments, after the electronic device 100 displays image frames according to transition zoom ratios 1 and 4, the electronic device 100 can also acquire image frames returned by the HAL layer and acquire the return frame time of the image frames, i.e., time t4. The shooting parameter generation module needs to determine whether time t4 is earlier than the time of the target zoom ratio in the zoom smoothing adjustment curve, such as time t2.

[0735] When time t4 is earlier than the time of the target zoom ratio in the zoom smoothing adjustment curve, the shooting parameter generation module needs to continue to acquire other transition zoom ratios and obtain image frames based on these other transition zoom ratios. For example, the shooting parameter generation module can determine the transition zoom ratio 2 from the zoom smoothing adjustment curve based on time t4, and crop, render, and display the image frame corresponding to the transition zoom ratio 2 according to the method in S1210-S1219.

[0736] The shooting parameter generation module can then determine the t8 time based on the t2 time and the preset duration (e.g., 16.7ms).

[0737] For example, the return frame time of transition image frame 3 can be time t8.

[0738] In some embodiments, the initial zoom ratio can be less than the target zoom ratio, that is, the zoom ratio applied to the camera can be increased. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 16A.

[0739] For example, as shown in Figure 16A, the shooting parameter generation module can obtain the corresponding transition zoom ratio 5 from the zoom smoothing adjustment curve based on the return frame time (e.g., time t8) of the transition image frame 3.

[0740] In some embodiments, the initial zoom ratio can be greater than the target zoom ratio, i.e., the zoom ratio applied to the camera is reduced. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 16B.

[0741] The shooting parameter generation module can obtain the corresponding transition zoom ratio 5 from the zoom smoothing adjustment curve based on the return frame time of the transition image frame 3 (e.g., time t8).

[0742] After determining the transition zoom ratio 5, the electronic device 100 can crop, render, and display the image frame corresponding to the transition zoom ratio 5 in a manner similar to S1210-S1219.

[0743] In some embodiments, after the electronic device 100 displays image frames according to transition zoom ratios 2 and 5, the electronic device 100 can also acquire image frames returned by the HAL layer and acquire the return frame time of the image frames, i.e., time t5. The shooting parameter generation module needs to determine whether time t5 is earlier than the time of the target zoom ratio in the zoom smoothing adjustment curve, such as time t2.

[0744] When time t5 is earlier than the target zoom ratio in the zoom smoothing adjustment curve, the shooting parameter generation module needs to continue acquiring other transition zoom ratios and obtain image frames based on these transition zoom ratios. For example, the shooting parameter generation module can determine the transition zoom ratio 3 from the zoom smoothing adjustment curve based on time t5, and crop, render, and display the image frame corresponding to the transition zoom ratio 3 according to the method in S1210-S1219.

[0745] The shooting parameter generation module can then determine the t9 time based on the t3 time and the preset duration (e.g., 16.7ms).

[0746] For example, the return frame time of transition image frame 4 can be time t9.

[0747] In some embodiments, the initial zoom ratio can be less than the target zoom ratio, that is, the zoom ratio applied to the camera can be increased. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 16A.

[0748] For example, as shown in Figure 16A, the shooting parameter generation module can obtain the corresponding transition zoom ratio 6 from the zoom smoothing adjustment curve based on the return frame time (e.g., time t9) of the transition image frame 4.

[0749] In some embodiments, the initial zoom ratio can be greater than the target zoom ratio, i.e., the zoom ratio applied to the camera is reduced. The shooting parameter generation module can obtain the zoom smoothing adjustment curve shown in Figure 16B.

[0750] The shooting parameter generation module can obtain the corresponding transition zoom ratio 6 from the zoom smoothing adjustment curve based on the return frame time of the transition image frame 4 (e.g., time t9).

[0751] After determining the transition zoom ratio 6, the electronic device 100 can crop, render, and display the image frame corresponding to the transition zoom ratio 6 in a manner similar to S1210-S1219.

[0752] This process continues until the result processing module obtains the image frame returned by the HAL layer at a time later than the time of the target zoom ratio in the zoom smoothing adjustment curve, for example, time t2. Once zooming is complete, the shooting parameter generation module no longer determines other transition zoom ratios; the application framework layer only needs to send the target zoom ratio to the HAL layer.

[0753] In some embodiments, after the electronic device 100 displays image frames according to transition zoom ratios 3 and 6, the electronic device 100 can also acquire image frames returned by the HAL layer and acquire the return frame time of the image frames, i.e., time t10. The shooting parameter generation module needs to determine whether time t10 is earlier than the time of the target zoom ratio in the zoom smoothing adjustment curve, for example, time t2.

[0754] If time t10 is later than the target zoom ratio in the zoom smoothing adjustment curve, such as time t2, the shooting parameter generation module no longer determines other transition zoom ratios, and the application framework layer only needs to send the target zoom ratio to the HAL layer.

[0755] Optionally, during the zoom process, the HAL layer can obtain the zoom ratio and the frame rewind time of the image frame, and obtain the zoom curve shown in Figure 16A or the zoom curve shown in Figure 16B based on the zoom ratio and the frame rewind time of the image frame. The zoom curve shown in Figure 16A or 16B reflects the zoom process of the image frame displayed by the electronic device 100 during the zoom process.

[0756] S1524, The shooting parameter generation module sends the second transition zoom ratio to the image cropping module.

[0757] S1525, The image cropping module determines the cropping ratio 3 based on the zoom ratio and the second transition zoom ratio of image frame 1.

[0758] S1526, The image cropping module crops image frame 1 based on cropping ratio 3 to obtain transition image frame 3.

[0759] For example, the zoom ratio of image frame 1 can be the initial zoom ratio. The image cropping module can determine the cropping ratio 3 based on the zoom ratio of image frame 1 and the second transition zoom ratio.

[0760] The image cropping module can crop image frame 1 based on cropping ratio 3 to obtain transition image frame 3. The zoom ratio of transition image frame 3 can be a second transition zoom ratio.

[0761] The description of how the image cropping module crops image frame 1 based on cropping ratio 3 to obtain transition image frame 3 can be found in the embodiment of Figure 14A, and will not be repeated here.

[0762] S1527, The image cropping module sends the address of the transition image frame 3 and the buffer storing the transition image frame 3 to the buffer manager.

[0763] In some embodiments, the address of the buffer storing the transition image frame 3 and the address of the buffer storing the image frame 3 may be the same or different.

[0764] S1528, Electronic device 100 renders and displays transitional image frame 3 in the manner shown in S912-S917 for rendering and displaying image frame 1.

[0765] In S1521, the rendering process has switched the vsync signal period from the first value to the second value and has notified the buffer manager of this switch. The rendering speed of the rendering process has increased, and to ensure that the camera application can also display the image frames rendered by the rendering process in a timely manner, the camera application's display frame rate will also be increased accordingly. For example, the camera application's display frame rate can be switched from the third value to the fourth value, where the ratio of the fourth value to the third value is a+1.

[0766] Where a is a positive integer greater than or equal to 1, and the value of a can be a preset value, such as a can be 1 or 2.

[0767] For example, if the value of 'a' is 1, then the fourth and third values ​​can be 2, meaning the display frame rate of the camera application is doubled. For instance, the fourth value could be 60 PFS and the third value could be 30 PFS.

[0768] For example, if the value of 'a' is 2, then the ratio of the second value to the first value can be 3, meaning that the display frame rate of the camera application is increased by three times. For instance, the fourth value can be 90PFS and the third value can be 30PFS.

[0769] The following embodiments of this application are described with a = 1.

[0770] Because the vsync signal period is shortened by (a+1) times, the display frame rate of the camera application is increased by (a+1) times accordingly. The rendering process still obtains one image frame from the buffer manager every m vsync signal periods, renders it, and then sends it to the display.

[0771] Optionally, the display process module can also receive the timestamp sent by the timer. When the time interval between the current time and the timestamp of the previous image frame sent to rendering is greater than or equal to a preset time interval, the display process module can obtain the image frame to be rendered from the buffer manager. For example, the display process module can obtain the transition image frame 3 to be rendered from the buffer manager.

[0772] After accumulating m vsync signal cycles, the display sending process can obtain the transition image frame 3 from the buffer manager. The display sending process then sends the transition image frame 3 or the address of the buffer storing the transition image frame 3 to the camera application. The camera application then sends the transition image frame 3 or the address of the buffer storing the transition image frame 3 to the rendering process.

[0773] After obtaining the address of the transition image frame 3 or the buffer storing the transition image frame 3, the rendering process can render the transition image frame 3 and obtain the rendered transition image frame 3.

[0774] In some examples, if the rendering process module obtains the address of the buffer storing the transition image frame 3, the rendering process module can render the transition image frame 3 in the buffer corresponding to the address of the buffer storing the transition image frame 3. Alternatively, if the rendering process module obtains the address of the buffer storing the transition image frame 3, the rendering process module can retrieve the transition image frame 3 from the buffer corresponding to the address of the buffer storing the transition image frame 3 and render the transition image frame 3.

[0775] The rendering process module can send the rendered transition image frame 3 or the address of the buffer storing the rendered transition image frame 3 to the camera application. The camera application then sends the transition image frame 3 or the address of the buffer storing the rendered transition image frame 3 to the display.

[0776] After obtaining the address of the buffer containing the rendered transition image frame 3, the display can show the rendered transition image frame 3.

[0777] In some examples, if the display obtains the address of the buffer that stores the rendered transition image frame 3, the rendering process module can retrieve the rendered transition image frame 3 from the buffer corresponding to the address of the buffer that stores the rendered transition image frame 3, and display the rendered transition image frame 3.

[0778] Figure 15B shows a schematic flowchart of another shooting method provided in an embodiment of this application.

[0779] S1601, The shooting parameter generation module notifies the rendering process to switch the vsync signal period from the second value to the first value.

[0780] In some embodiments, if the return frame time of image frame 1 is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, the shooting parameter generation module does not need to obtain other transition zoom magnifications. After zooming ends, the image frame can be acquired and displayed based on the target transition zoom magnification.

[0781] The image cropping module also needs to notify the rendering process to switch the vsync signal period from the second value to the first value, that is, to switch the vsync signal period to the value before zooming.

[0782] For example, the first value could be 33.3ms, and the second value could be 16.6ms. Before the user clicks the target zoom level option, the vsync signal period is 33.3ms. After the user clicks the target zoom level option, the vsync signal period is 16.6ms. After zooming is complete, the vsync signal period switches back to 33.3ms.

[0783] Optionally, you also need to switch the camera app's display frame rate from the fourth value to the third value, that is, switch the camera app's display frame rate back to the value before zooming.

[0784] For example, the third value could be 30PFS, and the fourth value could be 60PFS. Before the user clicks the target zoom level option, the camera app's display frame rate is set to 30PFS. After the user clicks the target zoom level option, the camera app's display frame rate is set to 60PFS. After zooming is complete, the camera app's display frame rate is switched back to 30PFS.

[0785] S1602-S1611 can be referred to the description of S1301-S1310 in the embodiment of FIG12C, and will not be repeated here.

[0786] Figure 17A illustrates how another electronic device 100 handles camera requests and zoom requests.

[0787] As shown in Figure 4 above, the application framework layer periodically sends camera requests to the HAL layer. Before the HAL layer responds to the zoom request corresponding to the user's zoom operation, it needs to process other pending camera requests. The HAL layer will only process the zoom request after all the camera requests preceding the zoom request have been processed.

[0788] For example, as shown in Figure 16A, before the HAL layer processes the zoom request, there are six other camera requests to be processed: Camera Request 1, Camera Request 2, Camera Request 3, Camera Request 4, Camera Request 5, and Camera Request 6. If the HAL layer receives Zoom Request 1 at time tms, Zoom Request 1 carries a transition zoom magnification of 1 and is placed in the queue of pending requests according to the time sequence.

[0789] Following the first-in, first-out (FIFO) principle, at time tms, the HAL layer retrieves camera request 1 from the queue and processes it. Camera request 1 carries the initial zoom ratio. In response to processing camera request 1, the camera module can acquire image frame A based on the initial zoom ratio and send it to the application framework layer via the HAL layer. After acquiring image frame A, if the application framework layer determines that the return frame time of image frame A is later than the time of the target zoom ratio in the zoom smoothing adjustment curve, it can determine the transition zoom ratio 1 based on the return frame time of image frame A and the zoom smoothing adjustment curve. Then, based on the zoom ratio of image frame A and the transition zoom ratio 1, the application framework layer can determine the cropping ratio a1 and crop image frame A based on the cropping ratio a1 to obtain transition image frame A1, which represents the transition zoom ratio 1. The application framework layer then sends the transition image frame A1 to the camera application, which can display the transition image frame A1.

[0790] Based on the above analysis, in order to reduce the change in zoom ratio between two adjacent image frames, the image cropping module can add one or more transition zoom ratios between two adjacent transition zoom ratios, and crop the image frame based on the one or more newly added transition zoom ratios to obtain the new transition image frame, and then render and display the new transition image frame. Simultaneously, the electronic device 100 needs to switch the vsync signal period from a first value to a second value, and switch the display frame rate of the camera application from a third value to a fourth value.

[0791] This application uses the example of adding a new transitional zoom level. In response to adding a new transitional zoom level, the vsync signal period needs to be shortened by half, and the display frame rate of the camera application doubles. For example, if the vsync signal period switches from 33.3ms to 16.7ms, the display frame rate of the camera application switches from 30PFS to 60PFS.

[0792] As shown in Figure 17A, at time (t+16.7) ms, the application framework layer can determine time t7 based on the return frame time of image frame A and the preset duration, and determine the transition zoom ratio 4 based on time t7 and the focus smoothing adjustment curve. The application framework layer then determines the cropping ratio a2 based on the zoom ratio of image frame A and the transition zoom ratio 4, and crops image frame A based on the cropping ratio a2 to obtain transition image frame A2, which has a transition zoom ratio of 4. The application framework layer then sends the transition image frame A2 to the camera application, which can display the transition image frame A2.

[0793] As shown in Figure 17A, at time (t+33.4) ms, the HAL layer receives zoom request 2, which carries a transition zoom ratio of 2. Zoom request 2 is placed in the pending request queue according to the time sequence. Following the first-in, first-out principle, at time (t+33.4) ms, the HAL layer retrieves camera request 2 from the queue and processes it. Camera request 2 carries an initial zoom ratio. In response to processing camera request 2, the camera module can acquire image frame B based on the initial zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame B, the application framework layer can determine the transition zoom ratio of 2 based on the return frame time of image frame B and the zoom smoothing adjustment curve. Then, based on the zoom ratio of image frame B and the transition zoom ratio of 2, the application framework layer can determine the cropping ratio b1 and crop image frame B based on the cropping ratio b1 to obtain transition image frame B1, which has a transition zoom ratio of 2. The application framework layer then sends the transition image frame B1 to the camera application, which can then display the transition image frame B1.

[0794] As shown in Figure 17A, at time (t+50.1) ms, the application framework layer can determine time t8 based on the return frame time of image frame B and the preset duration, and determine the transition zoom ratio 5 based on time t8 and the focus smoothing adjustment curve. The application framework layer then determines the cropping ratio b2 based on the zoom ratio of image frame B and the transition zoom ratio 5, and crops image frame B based on the cropping ratio b2 to obtain transition image frame B2, which has a transition zoom ratio of 5. The application framework layer then sends the transition image frame B2 to the camera application, which can display the transition image frame B2.

[0795] As shown in Figure 17A, at time (t+66.8) ms, the HAL layer receives zoom request 3, which carries a transition zoom ratio of 3. Zoom request 3 is placed in the pending request queue according to the time sequence. Following the first-in, first-out principle, at time (t+66.8) ms, the HAL layer retrieves camera request 3 from the queue and processes it. Camera request 3 carries an initial zoom ratio. In response to processing camera request 3, the camera module can acquire image frame C based on the initial zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame C, the application framework layer can determine the transition zoom ratio of 3 based on the return frame time of image frame C and the zoom smoothing adjustment curve. Then, based on the zoom ratio of image frame C and the transition zoom ratio of 3, the application framework layer can determine the cropping ratio c1 and crop image frame C based on the cropping ratio c1 to obtain transition image frame C1, which has a transition zoom ratio of 3. The application framework layer then sends the transition image frame C1 to the camera application, which can then display the transition image frame C1.

[0796] As shown in Figure 17A, at time (t+83.5) ms, the application framework layer can determine time t9 based on the return frame time of image frame C and the preset duration, and determine the transition zoom ratio 6 based on time t9 and the focus smoothing adjustment curve. The application framework layer then determines the cropping ratio c2 based on the zoom ratio of image frame B and the transition zoom ratio 6, and crops image frame C based on the cropping ratio c2 to obtain transition image frame C2, which has a transition zoom ratio of 6. The application framework layer then sends the transition image frame C2 to the camera application, which can display the transition image frame C2.

[0797] As shown in Figure 17A, at time (t+100.2) ms, the HAL layer receives zoom request 4. Since the return frame time of image frame D is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, the shooting parameter generation module no longer identifies other transition zoom magnifications and directly sends the target zoom magnification to the HAL layer. Therefore, zoom request 4 carries the target zoom magnification and is placed in the pending request queue according to the time sequence.

[0798] Simultaneously, the electronic device 100 needs to switch the vsync signal period from the second value back to the first value, and switch the display frame rate of the camera application from the fourth value back to the third value. For example, the vsync signal period switches from 16.6ms to 33.3ms, and the display frame rate of the camera application switches from 60PFS to 30PFS.

[0799] Following the first-in, first-out (FIFO) principle, at time (t+100.2) ms, the HAL layer retrieves camera request 4 from the queue and processes it. Camera request 4 carries the initial zoom ratio. In response to processing camera request 4, the camera module can acquire image frame D based on the initial zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame D, if the zoom ratio of image frame D differs from the target zoom ratio, the application framework layer can determine the cropping ratio d based on the zoom ratio of image frame D and the target zoom ratio, and crop image frame D based on the cropping ratio d to obtain a transition image frame D1, which represents the target zoom ratio. The application framework layer then sends the transition image frame D1 to the camera application, which can display the transition image frame D1.

[0800] As shown in Figure 17A, at time (t+133.5) ms, the HAL layer receives zoom request 5, which carries the target zoom ratio. Zoom request 5 is placed in the pending request queue according to the time sequence. Following the first-in, first-out principle, at time (t+133.5) ms, the HAL layer retrieves camera request 5 from the queue and processes it. Camera request 5 carries the initial zoom ratio. In response to processing camera request 5, the camera module can acquire image frame E based on the initial zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame E, if the zoom ratio of image frame E differs from the target zoom ratio, the application framework layer can determine the cropping ratio e based on the zoom ratio of image frame E and the target zoom ratio, and crop image frame E based on the cropping ratio e to obtain a transition image frame E1, which represents the target zoom ratio. The application framework layer then sends the transition image frame E1 to the camera application, which can then display the transition image frame E1.

[0801] As shown in Figure 17A, at time (t+166.8) ms, the HAL layer receives zoom request 6, which carries the target zoom ratio. Zoom request 6 is placed in the request queue to be processed according to the time sequence. Following the first-in, first-out principle, at time (t+166.8) ms, the HAL layer retrieves camera request 6 from the queue and processes it. Camera request 6 carries the initial zoom ratio. In response to processing camera request 6, the camera module can acquire image frame F based on the initial zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame F, if the zoom ratio of image frame F differs from the target zoom ratio, the application framework layer can determine the cropping ratio f based on the zoom ratio of image frame F and the target zoom ratio, and crop image frame F based on the cropping ratio f to obtain a transition image frame F1, which represents the target zoom ratio. The application framework layer then sends the transition image frame F1 to the camera application, which can then display the transition image frame F1.

[0802] As shown in Figure 17A, at time (t+200.1) ms, the HAL layer receives zoom request 7, which carries the target zoom ratio. Zoom request 7 is placed in the request queue to be processed according to the time sequence. Following the first-in, first-out principle, at time (t+200.1) ms, the HAL layer retrieves camera request 7 from the queue and processes it. Camera request 7 carries the initial zoom ratio. In response to processing camera request 7, the camera module can acquire image frame G based on the transition zoom ratio 1 and send it to the application framework layer through the HAL layer. After acquiring image frame G, if the zoom ratio of image frame G differs from the target zoom ratio, the application framework layer can determine the cropping ratio g based on the zoom ratio of image frame G and the target zoom ratio, and crop image frame G based on the cropping ratio g to obtain a transition image frame G1, which represents the target zoom ratio. The application framework layer then sends the transition image frame G1 to the camera application, which can then display the transition image frame G1.

[0803] Similarly, electronic device 100 can process zoom request 2 and zoom request 3 in the same way as zoom request 1.

[0804] As shown in Figure 17A, at time (t+300) ms, the HAL layer receives zoom request 10, which carries the target zoom ratio. Zoom request 10 is placed in the request queue to be processed according to the time sequence. Following the first-in, first-out principle, at time (t+300) ms, the HAL layer retrieves zoom request 4 from the queue and processes it. Zoom request 4 carries the target zoom ratio. In response to processing zoom request 4, the camera module can acquire image frame H based on the target zoom ratio and send it to the application framework layer through the HAL layer. After acquiring image frame H, if the zoom ratio of image frame H is the same as the target zoom ratio, the application framework layer does not need to crop image frame G. The application framework layer can directly send image frame G to the camera application, which can then display image frame G.

[0805] Similarly, electronic device 100 can process zoom requests 5 to 10 in the same way as zoom request 4.

[0806] As shown in Figure 17A, on the one hand, immediately after receiving zoom request 1, the application framework layer can respond to the transition zoom ratio 1 carried in zoom request 1 and obtain transition image frame A1, where the zoom ratio of transition image frame A1 is the transition zoom ratio 1. This eliminates the need to wait for multiple camera requests preceding zoom request 1 to complete before executing zoom request 1 and obtaining the image frame corresponding to transition zoom ratio 1, thus shortening the processing time of zoom request 1 in the HAL layer and improving the speed of camera application response to user zoom operations. On the other hand, during the zoom process, by adding transition image frames A2, B2, and C2, the change value of two adjacent transition zoom ratios can be slowed down, thus mitigating the rate of change of the zoom ratio between adjacent image frames and making the zoom process smoother.

[0807] Figure 17B shows a timing diagram of another electronic device 100 rendering and displaying image frames periodically with a vsync signal.

[0808] As shown in Figure 17B, between vertical synchronization signal 1 (vsync1) and vertical synchronization signal 2 (vsync2), the camera application can issue a rendering command A1 to the rendering process. In response to rendering command A1, the rendering process can render a transitional image frame A1 and fill the buffer with the rendered transitional image frame A1. Simultaneously, between vertical synchronization signal 1 (vsync) and vertical synchronization signal 2 (vsync2), the camera application can send image frame 0 or the buffer of image frame 0 to the display, allowing the display to show image frame 0. That is, between time tms and time (t+16.7ms), the rendering process renders the transitional image frame A1, and the display shows image frame 0.

[0809] Based on the above analysis, in order to reduce the change in zoom ratio between two adjacent image frames, the image cropping module can add one or more transition zoom ratios between two adjacent transition zoom ratios, and crop the image frame based on the one or more newly added transition zoom ratios to obtain the new transition image frame, and then render and display the new transition image frame. Simultaneously, the electronic device 100 needs to switch the vsync signal period from a first value to a second value, and switch the display frame rate of the camera application from a third value to a fourth value.

[0810] This application uses the example of adding a new transitional zoom level. In response to adding a new transitional zoom level, the vsync signal period needs to be shortened by half, and the display frame rate of the camera application doubles. For example, if the vsync signal period switches from 33.3ms to 16.7ms, the display frame rate of the camera application switches from 30PFS to 60PFS.

[0811] For example, before the electronic device 100 responds to the user clicking the target magnification option, the display frame rate of the camera application can be 30 FPS, the vsync signal period is 33.3 ms, then m is 1, that is, the rendering process renders one image frame in each vsync signal period, and the camera application sends one image frame to be displayed in each vsync signal period.

[0812] After the electronic device 100 responds to the user clicking the target magnification option, the camera application's display frame rate can be 60 FPS, the vsync signal period is 16.7ms, and m remains 1. This means that the rendering process still renders one image frame per vsync signal period, and the camera application displays one image frame per vsync signal period. Only the vsync signal period is shortened, thus increasing the camera application's display frame rate.

[0813] Between vertical synchronization signal 2 (vsync2) and vertical synchronization signal 3 (vsync3), the camera application can issue rendering commands to the rendering process. In response to these commands, the rendering process can render transition image frame A2 and fill the buffer with the rendered transition image frame A2. Simultaneously, between vertical synchronization signal 2 (vsync2) and vertical synchronization signal 3 (vsync3), the camera application can send transition image frame A1 or its buffer to the display, allowing the display to show transition image frame A1. That is, between (t+16.7ms) ms and (t+33.4ms), the rendering process renders transition image frame A2, and the display shows transition image frame A1.

[0814] Between vertical synchronization signal 3 (vsync3) and vertical synchronization signal 4 (vsync4), the camera application can issue a rendering command B1 to the rendering process. In response to rendering command B1, the rendering process can render a transition image frame B1 and fill the buffer with the rendered transition image frame B1. Simultaneously, between vertical synchronization signal 3 (vsync3) and vertical synchronization signal 4 (vsync4), the camera application can send a transition image frame A2 or a buffer of transition image frame A2 to the display, allowing the display to show transition image frame A2. That is, between (t+33.4ms) ms and (t+50.1ms), the rendering process renders transition image frame B1, and the display shows transition image frame A2.

[0815] Between vertical synchronization signal 4 (vsync4) and vertical synchronization signal 5 (vsync5), the camera application can issue rendering command B2 to the rendering process. In response to rendering command B2, the rendering process can render transition image frame B2 and fill the buffer with the rendered transition image frame B2. Simultaneously, between vertical synchronization signal 4 (vsync4) and vertical synchronization signal 5 (vsync5), the camera application can send transition image frame B1 or the buffer of transition image frame B1 to the display, allowing the display to show transition image frame B1. That is, between (t+50.1ms) ms and (t+66.8ms), the rendering process renders transition image frame B2, and the display shows transition image frame B1.

[0816] Between vertical synchronization signals 5 (vsync5) and 6 (vsync6), the camera application can issue a rendering command C1 to the rendering process. In response to rendering command C1, the rendering process can render a transition image frame C1 and fill the buffer with the rendered transition image frame C1. Simultaneously, between vertical synchronization signals 5 (vsync5) and 6 (vsync6), the camera application can send a transition image frame B2 or a buffer of transition image frame B2 to the display, allowing the display to show transition image frame B2. That is, between (t+66.8ms) ms and (t+83.5ms), the rendering process renders transition image frame C1, and the display shows transition image frame B2.

[0817] Between vertical synchronization signal 6 (vsync6) and vertical synchronization signal 7 (vsync7), the camera application can issue a rendering command C2 to the rendering process. In response to rendering command C2, the rendering process can render a transition image frame C2 and fill the buffer with the rendered transition image frame C2. Simultaneously, between vertical synchronization signal 6 (vsync6) and vertical synchronization signal 7 (vsync7), the camera application can send a transition image frame C1 or a buffer of transition image frame C1 to the display, allowing the display to show transition image frame C1. That is, between (t+83.5ms) ms and (t+100.2ms), the rendering process renders transition image frame C2, and the display shows transition image frame C1.

[0818] Based on the above analysis, at time (t+100.2) ms, the HAL layer receives zoom request 4. Since the return frame time of image frame D is later than the time of the target zoom magnification in the zoom smoothing adjustment curve, the shooting parameter generation module no longer identifies other transition zoom magnifications and directly sends the target zoom magnification to the HAL layer. Before receiving the vertical synchronization signal 7 (vsync7), the electronic device 100 needs to switch the vsync signal period from the second value back to the first value and switch the display frame rate of the camera application from the fourth value back to the third value. For example, the vsync signal period switches from 16.6 ms to 33.3 ms, and the display frame rate of the camera application switches from 60 PFS to 30 PFS.

[0819] Between vertical synchronization signal 7 (vsync7) and vertical synchronization signal 8 (vsync8), the camera application can issue a rendering command D to the rendering process. In response to rendering command D, the rendering process can render a transition image frame D1 and fill the buffer with the rendered transition image frame D1. Simultaneously, between vertical synchronization signal 7 (vsync7) and vertical synchronization signal 8 (vsync8), the camera application can send a transition image frame C2 or a buffer of transition image frame C2 to the display, allowing the display to show transition image frame C2. That is, between (t+100.2) ms and (t+133.5) ms, the rendering process renders transition image frame D1, and the display shows transition image frame C2.

[0820] Between vertical synchronization signals 8 (vsync8) and 9 (vsync9), the camera application can issue a rendering command E to the rendering process. In response to rendering command E, the rendering process can render a transitional image frame E1 and fill the buffer with the rendered transitional image frame E1. Simultaneously, between vertical synchronization signals 7 (vsync7) and 8 (vsync8), the camera application can send a transitional image frame D1 or a buffer of transitional image frame D1 to the display, allowing the display to show the transitional image frame D1. That is, between (t+133.5) ms and (t+166.8) ms, the rendering process renders the transitional image frame E1, and the display shows the transitional image frame D1.

[0821] Between vertical synchronization signal 9 (vsync9) and vertical synchronization signal 10 (vsync10), the camera application can issue a rendering command F to the rendering process. In response to rendering command F, the rendering process can render a transition image frame F1 and fill the buffer with the rendered transition image frame F1. Simultaneously, between vertical synchronization signal 9 (vsync9) and vertical synchronization signal 10 (vsync10), the camera application can send a transition image frame E1 or a buffer of transition image frame E1 to the display, allowing the display to show the transition image frame E1. That is, between (t+166.8) ms and (t+200.1) ms, the rendering process renders the transition image frame F1, and the display shows the transition image frame E1.

[0822] Between vertical synchronization signal 10 (vsync10) and vertical synchronization signal 11 (vsync11), the camera application can issue a rendering command G to the rendering process. In response to the rendering command G, the rendering process can render a transition image frame G1 and fill the buffer with the rendered transition image frame G1. Simultaneously, between vertical synchronization signal 10 (vsync10) and vertical synchronization signal 11 (vsync11), the camera application can send a transition image frame F1 or a buffer of transition image frame F1 to the display, allowing the display to show the transition image frame F1. That is, between (t+200.1) ms and (t+233.4) ms, the rendering process renders the transition image frame G1, and the display shows the transition image frame F1.

[0823] Similarly, between vertical synchronization signal 13 (vsync13) and vertical synchronization signal 14 (vsync14), the camera application can issue a rendering command H to the rendering process. In response to the rendering command H, the rendering process can render a transition image frame H1 and fill the buffer with the rendered transition image frame H1. Simultaneously, between vertical synchronization signal 13 (vsync13) and vertical synchronization signal 14 (vsync14), the camera application can send a transition image frame I1 or a buffer of transition image frame I1 to the display, allowing the display to show the transition image frame I1. That is, between (t+300) ms and (t+333.3) ms, the rendering process renders the transition image frame H1, and the display shows the transition image frame I1.

[0824] Similarly, camera applications can render and display image frames based on the vsync signal period as shown in Figure 17B.

[0825] As shown in Figure 17B, on the one hand, the rendering process can send image frames clipped by the application framework layer or image frames received by the application framework layer from the HAL layer to the rendering process for rendering and then display according to a fixed vsync signal period. This ensures that image frames are sent to the rendering process evenly for rendering and display, guaranteeing that the camera application displays image frames uniformly. On the other hand, during zooming, the period of the vsync signal and the display frame rate of the camera application can be adjusted. After zooming, the period of the vsync signal and the display frame rate of the camera application are restored, enabling the rendering process to render multiple transitional image frames in a timely manner, and the camera application to display multiple transitional image frames in a timely manner.

[0826] Figure 18 is a flowchart illustrating a shooting parameter adjustment method provided in this application.

[0827] S1801. The electronic device receives and responds to the user's first operation for the camera application, and obtains the target shooting parameters, wherein the target shooting parameters are the shooting parameters set in the first operation.

[0828] S1802, The shooting parameter generation module determines the first transition shooting parameters based on the return frame time of the first image frame and the target shooting parameters. The first image frame is the image frame acquired by the electronic device after receiving the first operation.

[0829] S1803, The image cropping module processes the first image frame according to the first transition shooting parameters and the shooting parameters of the first image frame to obtain the first transition image frame. The shooting parameters of the first transition image frame include the first transition shooting parameters.

[0830] S1804, The rendering process renders the first transition image according to the vertical synchronization signal period of the rendering process; the electronic device displays the rendered first transition image within the camera application.

[0831] This method allows the electronic device to calculate one or more transitional shooting parameters in real time, enabling it to acquire and display image frames promptly according to these parameters. This ensures that changes in shooting parameters conform to a preset smooth adjustment curve, allowing for a smooth transition to the target shooting parameters and preventing image jitter or stuttering, thus improving the user's visual experience. Furthermore, by copying and cropping image frames, the electronic device can quickly display image frames in response to user actions that change shooting parameters, eliminating latency issues. Additionally, during parameter changes, the electronic device can control and modify the vsync signal period, linking the display timing of transitional image frames to the vsync signal period. This ensures uniform image frame display, further enhancing the user's visual experience.

[0832] In one possible implementation, the shooting parameter generation module determines the first transitional shooting parameters based on the return frame time of the first image frame and the target shooting parameters. Specifically, the shooting parameter generation module determines the first transitional shooting parameters based on the initial shooting parameters, the return frame time of the first image frame, and the target shooting parameters, wherein the initial shooting parameters are the shooting parameters set by the electronic device before receiving the first operation.

[0833] Using this method, electronic devices can calculate one or more transition shooting parameters in real time based on the return frame time of image frames, and smoothly switch from the initial shooting parameters to the target shooting parameters in sequence according to one or more transition shooting parameters, avoiding image shaking or stuttering during the switching of shooting parameters, thus improving the user's visual experience.

[0834] In one possible implementation, the shooting parameter generation module determines the first transition shooting parameters based on the initial shooting parameters, the return frame time of the first image frame, and the target shooting parameters. Specifically, the shooting parameter generation module obtains a smoothing adjustment curve based on the initial shooting parameters and the target shooting parameters, where the starting point of the smoothing adjustment curve is the initial shooting parameters and the ending point of the smoothing adjustment curve is the target shooting parameters. The shooting parameter generation module determines the first transition shooting parameters from the smoothing adjustment curve based on the return frame time of the first image frame.

[0835] In some embodiments, the smoothing adjustment curve may be a Bézier curve. The total duration of the smoothing adjustment curve may be fixed, or it may be determined by the initial shooting parameters and the target shooting parameters. The total duration of the smoothing adjustment curve may also be different depending on the initial shooting parameters and the target shooting parameters.

[0836] The starting point of the smoothing curve can correspond to the moment when the electronic device receives the first operation for the camera application. The ending point of the smoothing curve can be determined by adding the total duration of the smoothing curve to the starting point.

[0837] The electronic device can obtain a smooth adjustment curve based on the initial shooting parameters and the target shooting parameters, and determine one or more transition shooting parameters from the smooth adjustment curve by the return frame time of the image frame. This allows the camera application to smoothly switch from the initial shooting parameters to the target shooting parameters based on the one or more transition shooting parameters. The change of shooting parameters in the final image frame obtained by the electronic device conforms to the change law of the smooth adjustment curve, so that the shooting parameters can smoothly transition to the target shooting parameters, avoiding image shaking or stuttering, and improving the user's visual experience.

[0838] In one possible implementation, the rendering process renders the first transition image according to the vertical synchronization signal period of the rendering process. Specifically, when the time interval between the first time and the display time of the previous image frame is greater than or equal to m first vertical synchronization signal periods, the rendering process renders the first transition image in the first time.

[0839] In this way, the electronic device can temporarily store the image frame first, and then send the next image frame for rendering after the electronic device has finished rendering the previous image frame, thus avoiding the speed of sending image frames exceeding the speed of rendering image frames by the electronic device.

[0840] In one possible implementation, after the shooting parameter generation module determines the first transition shooting parameters based on the return frame time of the first image frame and the target shooting parameters, the method further includes: the shooting parameter generation module determining the second transition shooting parameters based on the return frame time of the first image frame, a preset duration, and the target shooting parameters; the image cropping module processing the first image frame based on the second transition shooting parameters and the shooting parameters of the first image frame to obtain a second transition image frame, wherein the shooting parameters of the second transition image frame include the second transition shooting parameters; the rendering process rendering the second transition image according to the vertical synchronization signal period of the rendering process; and the electronic device displayin...

Claims

1. A method for generating shooting parameters, characterized in that, The electronic device includes a shooting parameter generation module, an image cropping module, and a rendering process; the method includes: The electronic device receives and responds to a user's first operation on the camera application to obtain target shooting parameters, wherein the target shooting parameters are the shooting parameters set in the first operation; The shooting parameter generation module determines the first transition shooting parameters based on the return frame time of the first image frame and the target shooting parameters. The first image frame is the image frame acquired by the electronic device after receiving the first operation. The image cropping module processes the first image frame according to the first transition shooting parameters and the shooting parameters of the first image frame to obtain a first transition image frame. The shooting parameters of the first transition image frame include the first transition shooting parameters. The rendering process renders the first transition image according to the vertical synchronization signal period of the rendering process. The electronic device displays the rendered first transition image within the camera application.

2. The method according to claim 1, characterized in that, The shooting parameter generation module determines the first transition shooting parameters based on the return frame time of the first image frame and the target shooting parameters, specifically including: The shooting parameter generation module determines the first transition shooting parameters based on the initial shooting parameters, the return frame time of the first image frame, and the target shooting parameters, wherein the initial shooting parameters are the shooting parameters set by the electronic device before receiving the first operation.

3. The method according to claim 2, characterized in that, The shooting parameter generation module determines the first transition shooting parameters based on the initial shooting parameters, the return frame time of the first image frame, and the target shooting parameters, specifically including: The shooting parameter generation module obtains a smoothing adjustment curve based on the initial shooting parameters and the target shooting parameters. The starting point of the smoothing adjustment curve is the initial shooting parameters, and the ending point of the smoothing adjustment curve is the target shooting parameters. The shooting parameter generation module determines the first transition shooting parameters from the smoothing adjustment curve based on the return frame time of the first image frame.

4. The method according to claim 3, characterized in that, The rendering process renders the first transition image according to the vertical synchronization signal period of the rendering process, specifically including: If the time interval between the first time and the display time of the previous image frame is greater than or equal to m first vertical synchronization signal cycles, the rendering process renders the first transition image in the first time.

5. The method according to claim 4, characterized in that, After the shooting parameter generation module determines the first transition shooting parameters based on the return frame time of the first image frame and the target shooting parameters, the method further includes: The shooting parameter generation module determines the second transition shooting parameters based on the return frame time of the first image frame, the preset duration, and the target shooting parameters: The image cropping module processes the first image frame according to the second transition shooting parameters and the shooting parameters of the first image frame to obtain a second transition image frame. The shooting parameters of the second transition image frame include the second transition shooting parameters. The rendering process renders the second transition image according to the vertical synchronization signal period of the rendering process; The electronic device displays the rendered second transition image within the camera application.

6. The method according to claim 5, characterized in that, The rendering process renders the second transition image according to the vertical synchronization signal period of the rendering process, specifically including: When the time interval between the second time and the display time of the previous image frame is greater than or equal to m second vertical synchronization signal cycles, the rendering process renders the second transition image in the second time.

7. The method according to claim 6, characterized in that, The period of the second vertical synchronization signal is shorter than the period of the first vertical synchronization signal.

8. The method according to claim 6 or 7, characterized in that, After the shooting parameter generation module determines the second transition shooting parameters based on the return frame time of the first image frame, the preset duration, and the target shooting parameters, the method further includes: The shooting parameter generation module obtains the return frame time of the second image frame, and the second image frame is the image frame acquired by the electronic device after receiving the first operation; The shooting parameter generation module determines whether the return frame time of the second image frame is later than the time corresponding to the target shooting parameter in the smoothing adjustment curve; If the return frame time of the second image frame is later than the time corresponding to the target shooting parameters in the smoothing adjustment curve, the electronic device switches the vertical synchronization signal period from the second vertical synchronization signal period to the first vertical synchronization signal period.

9. The method according to any one of claims 6-8, characterized in that, After the electronic device receives and responds to the user's first operation on the camera application, the method further includes: The electronic device switches the vertical synchronization signal period from the first vertical synchronization signal period to the second vertical synchronization signal period.

10. The method according to any one of claims 2-9, characterized in that, The electronic device further includes a camera module, and the method further includes, prior to the electronic device receiving and responding to a first user action on the camera application: The electronic device receives and responds to a second operation of activating the camera application to obtain the initial shooting parameters; The camera module acquires image frames based on the initial shooting parameters.

11. The method according to claim 3, characterized in that, The shooting parameter generation module determines the first transition shooting parameters from the smoothing adjustment curve based on the return frame time of the first image frame, specifically including: The shooting parameter generation module determines whether the return frame time of the first image frame is earlier than the time corresponding to the target shooting parameter in the smoothing adjustment curve; If the return frame time of the first image frame is earlier than the time corresponding to the target shooting parameters, the shooting parameter generation module determines the first transition shooting parameters from the smoothing adjustment curve based on the return frame time of the first image frame.

12. The method according to claim 1, characterized in that, The electronic device further includes a camera module, and the method further includes: When the return frame time of the first image frame is earlier than the time corresponding to the target shooting parameters, the camera module acquires image frames based on the first transition shooting parameters.

13. The method according to claim 11 or 12, characterized in that, The method further includes: When the return time of the first image frame is later than the time corresponding to the target shooting parameters, the camera module acquires image frames based on the target shooting parameters.

14. The method according to any one of claims 2-13, characterized in that, When the initial shooting parameter is greater than the target shooting parameter, the first transition shooting parameter is less than the initial shooting parameter and greater than the target shooting parameter; When the initial shooting parameters are less than the target shooting parameters, the first transition shooting parameters are greater than the initial shooting parameters and less than the target shooting parameters.

15. The method according to any one of claims 1-14, characterized in that, The electronic device includes an application framework layer and a hardware abstraction layer; The first image frame is the image frame sent by the hardware abstraction layer to the application framework layer after the electronic device receives the first operation, and the return frame time of the first image frame is the time when the hardware abstraction layer sends the first image frame to the application framework layer.

16. The method according to claim 15, characterized in that, The camera parameter generation module, the image cropping module, and the rendering process are functional modules in the application framework layer.

17. The method according to claim 12, characterized in that, The electronic device includes an application framework layer and a hardware abstraction layer; the camera module acquires image frames based on the first transitional shooting parameters, specifically including: In response to the fact that the return frame time of the first image frame is earlier than the time corresponding to the target shooting parameters, the application framework layer sends a first request to the HAL layer, the first request carrying the first transition shooting parameters; The HAL layer sends the first request to the camera module; The first transition shooting parameters acquire the second image frame, specifically including: In response to the first request, the camera module acquires the second image frame based on the first transition shooting parameters.

18. The method according to claim 13, characterized in that, When the return frame time of the first image frame is later than the time corresponding to the target shooting parameters, the method further includes: The image cropping module determines whether the shooting parameters of the first image frame are the same as the target shooting parameters; When the shooting parameters of the first image frame are different from the target shooting parameters, the image cropping module processes the first image frame according to the shooting parameters of the first image frame and the target shooting parameters to obtain a third transition image frame. The rendering process renders the third transition image according to the vertical synchronization signal period of the rendering process; The electronic device displays the rendered third transition image within the camera application.

19. The method according to claim 18, characterized in that, The method further includes: When the shooting parameters of the first image frame are the same as the target shooting parameters, the rendering process renders the first image frame according to the vertical synchronization signal period of the rendering process. The electronic device displays the rendered first image frame within the camera application.

20. The method according to any one of claims 1-19, characterized in that, The image cropping module processes the first image frame according to the first transition shooting parameters and the shooting parameters of the first image frame to obtain a first transition image frame, specifically including... The image cropping module changes the field of view (FOV) in the first image frame to obtain the first transition image frame.

21. The method according to claim 20, characterized in that, The image cropping module changes the field of view (FOV) in the first image frame to obtain the first transition image frame, specifically including: The image cropping module multiplies the field of view (FOV) of the first image frame by a first scaling factor to obtain the first transition image frame, wherein the first scaling factor is the ratio of the first transition shooting parameters to the shooting parameters of the first image frame.

22. The method according to claim 21, characterized in that, The FOV of the first image frame is the first FOV, and the FOV of the first transition image frame is the second FOV, which is the product of the first FOV and the first scaling factor.

23. The method according to any one of claims 20-21, characterized in that, The first image frame has a first size. The image cropping module changes the field of view (FOV) in the first image frame to obtain the first transition image frame, specifically including: The image cropping module crops the first image frame from a first size to a second size to obtain a first image; the second size is the product of the first size and a second scaling factor, and the second scaling factor is the reciprocal of the first scaling factor; The image cropping module changes the first image at the second size from the first FOV to the second FOV; The image cropping module scales the first image from the second size to the first size to obtain the first transition image frame.

24. The method according to any one of claims 2-10, characterized in that, The initial shooting parameters include a first zoom ratio, and the target shooting parameters include a second zoom ratio.

25. The method according to claim 24, characterized in that, Before the electronic device receives and responds to the user's first operation on the camera application, the method further includes: The camera application displays a first preview interface, which includes a zoom ratio control. The zoom ratio control indicates that the zoom ratio value of the image frame displayed in the first preview interface is the first zoom ratio. After the electronic device receives and responds to the user's first operation on the camera application, the method further includes: The camera application displays a second preview interface, which includes the zoom ratio control. The zoom ratio control indicates that the zoom ratio value of the image frame displayed in the second preview interface is the second zoom ratio.

26. The method according to any one of claims 4-9, characterized in that, The method further includes: If the time interval between the first time and the display time of the previous image frame is less than m first vertical synchronization signal cycles, the electronic device stores the first image frame in the buffer queue of the image frames to be displayed.

27. The method according to claim 26, characterized in that, The electronic device further includes a display thread and a buffer manager. The buffer manager is used to temporarily store image frames. After the image cropping module processes the first image frame according to the first transition shooting parameters and the shooting parameters of the first image frame to obtain the first transition image frame, the method further includes: If the number of image frames in the buffer manager is greater than or equal to a first threshold, the display thread sends the first transition image to the rendering process for rendering; If the number of image frames in the buffer manager is less than the first threshold, the buffer manager temporarily stores the first transitional image frame.

28. The method according to claim 27, characterized in that, After the buffer manager temporarily stores the first transition image frame, the method further includes: The display thread obtains the first transition image frame from the buffer manager.

29. The method according to any one of claims 4-9 or 26-28, characterized in that, The electronic device also includes a vsync signal monitoring module, which is used to monitor the vsync signal of the rendering process module.

30. The method according to claim 29, characterized in that, The method further includes: The vsync signal monitoring module sends the vsync signal to the display process module; When the time interval between the first time and the display time of the previous image frame is greater than or equal to m first vertical synchronization signal cycles, the rendering process renders the first transition image in the first time, specifically including: When the display process module determines, based on the vsync signal, that the time interval between the first time and the display time of the previous image frame is greater than or equal to m vertical synchronization vsync signal cycles, the rendering process renders the first transition image at the first time.

31. The method according to any one of claims 4-9 or 26-30, characterized in that, The value of m is determined by the frame rate of the electronic device and the period interval of the vsync signal.

32. The method according to any one of claims 4-9 or 26-31, characterized in that, The value of m is equal to the first value divided by the frame rate, and then divided by the vsync signal period interval.

33. The method according to any one of claims 1-32, characterized in that, The electronic device further includes a timer module, and the method further includes: The timer sets a first timestamp for the first transition image; When the display thread module determines that the time interval between the first timestamp and the timestamp of the previous image frame sent by the display process module to the rendering process is greater than the second threshold, the rendering process renders the first transition image according to the vertical synchronization signal period of the rendering process.

34. The method according to any one of claims 1-33, characterized in that, Shooting parameters include any of the following: zoom ratio, exposure, aperture, white balance, sharpness, contrast, and saturation.

35. An electronic device, characterized in that, The device includes a camera, one or more processors, and one or more memories; wherein the camera, the one or more memories, and the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, the computer program code including computer instructions, which, when executed by the one or more processors, cause the method as described in any one of claims 1-34 to be performed.

36. A chip system applied to an electronic device, the chip system comprising one or more processors, characterized in that, The processor is used to invoke computer instructions to perform the method as described in any one of claims 1-34.

37. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on an electronic device, they cause the method as described in any one of claims 1-34 to be performed.